Skip to content

Commit

Permalink
Update document for efx-grid v6.0.146
Browse files Browse the repository at this point in the history
  • Loading branch information
efx-grid committed Jul 1, 2024
1 parent 687519b commit 6fd5f15
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 77 deletions.
2 changes: 1 addition & 1 deletion index.html

Large diffs are not rendered by default.

88 changes: 50 additions & 38 deletions resources/elf-halo-dark.js
Original file line number Diff line number Diff line change
Expand Up @@ -82240,6 +82240,12 @@ Recommended fix:
min: 0,
max: 1e7
},
"CHILD_ORDER": {
type: "set",
ignore: true,
members: [undefined]
},
// eslint-disable-line
"RI_FLAG": {
type: "set",
members: ["R", "Q", "I", "_", ""]
Expand Down Expand Up @@ -82588,8 +82594,12 @@ Recommended fix:
* @return {*}
*/
let randMember = function (set, seed) {
if (set) {
let index = randIndex(set.length, seed);
var len = set ? set.length || 0 : 0;
if (len) {
if (len === 1) {
return set[0];
}
let index = randIndex(len, seed);
return set[index];
}
return String.fromCharCode(randInt(65, 90, seed));
Expand Down Expand Up @@ -84288,48 +84298,47 @@ Recommended fix:
// find key to random subs (key is subId)
let key = keys[this._dataGen.randIndex(len)]; // WARNING: Same sub could be picked more than once
let subs = this._dataMap.getItems(key); // Get all subs with the same RIC

let sub = subs[0]; // Only the first sub is need to generate data
let values, j, jLen;
let subParent = sub.parent;
let subCount = subs.length;
let j;
let firstSub = subs[0]; // Only the first sub is need to generate data
let subParent = firstSub.parent;
let updatePosition = this._dataGen.randInt(0, 100) < this._percentageOrderChange * 100 ? true : false; // Random chance to change dynamic chain position (2% to change)

let values = this._generateQuoteData(firstSub, fields);
if (_isDynamicChain(key) && subParent && updatePosition) {
// subParent in header of dynamic chain is behavior like a normal ric
// subParent in header of dynamic chain behaves like a normal ric
let children = subParent.children;
let childCount = children.length;
children = _shuffleArray(children); // Random swap children in array
let childrenLen = children.length;
let subIndex = children.indexOf(sub);
sub["CHILD_ORDER"] = subIndex;
values = this._generateQuoteData(sub, fields);
jLen = subs.length;
for (j = 0; j < jLen; ++j) {
let newOrder = children.indexOf(firstSub);
firstSub["CHILD_ORDER"] = newOrder; // This is bad
values["CHILD_ORDER"] = newOrder;
childOrderChange = true;
for (j = 0; j < subCount; ++j) {
// It could be same ric and it need to dispatch with same ric number
for (let k = 0; k < childrenLen; k++) {
let child = children[k];
if (subs[j] === child) {
values["CHILD_ORDER"] = child["CHILD_ORDER"];
this._dispatchDataChanged(subs[j], values);
} else {
let currentChild = child["CHILD_ORDER"];
this._dispatchDataChanged(child, {
X_RIC_NAME: child.ric,
CHILD_ORDER: currentChild
this._dispatchDataChanged(subs[j], values);
// Update child order for all children with the same parent
for (let k = 0; k < childCount; k++) {
// This is not correct, if there is a duplicate dynamic chain
if (k !== newOrder) {
this._dispatchDataChanged(children[k], {
X_RIC_NAME: children[k].ric,
CHILD_ORDER: k
});
}
}
childOrderChange = true;
}
} else {
values = this._generateQuoteData(sub, fields);
jLen = subs.length; // Duplicate ric or chain
for (j = 0; j < jLen; ++j) {
// It could be same ric and it need to dispatch with same ric number
let childOrder = subs[j]["CHILD_ORDER"];
if (subCount > 1) {
// Duplicate CHILD_ORDER from the first sub for other sub with the same RIC (not entirely correct)
let childOrder = firstSub["CHILD_ORDER"];
if (childOrder != null) {
// Children of chain will have a CHILD_ORDER
values["CHILD_ORDER"] = childOrder;
}
}
for (j = 0; j < subCount; ++j) {
// It could be same ric and it need to dispatch with same ric number
this._dispatchDataChanged(subs[j], values);
updateCount++;
}
Expand Down Expand Up @@ -84368,19 +84377,22 @@ Recommended fix:
prefix: sub["parent"] ? sub["parent"]["ric"] : "" // prefix for constituents
};
for (let field in fields) {
let data = this._dataGen.generateQuoteData(field, options);
let fInfo = this._dataGen.generateQuoteData(field, options);
if (fInfo.ignore) {
continue;
}
let formattedField = field + "_FORMATTED";
if (prevData) {
if (data.changeOnly) {
if (prevData[field] === data.value) {
if (fInfo.changeOnly) {
if (prevData[field] === fInfo.value) {
continue;
}
}
prevData[field] = data.value;
prevData[formattedField] = data.formattedValue;
prevData[field] = fInfo.value;
prevData[formattedField] = fInfo.formattedValue;
}
values[field] = data.value;
values[formattedField] = data.formattedValue;
values[field] = fInfo.value;
values[formattedField] = fInfo.formattedValue;
}

// The delay symbol for X_RIC_NAME will depend on the INDICATOR field.
Expand Down Expand Up @@ -157139,7 +157151,7 @@ Recommended fix:
* @return {string}
*/
Core.getVersion = function () {
return "__grid_version__";
return "5.1.137";
};
/** {@link ElementWrapper#dispose}
* @override
Expand Down Expand Up @@ -167499,7 +167511,7 @@ Recommended fix:
"subId": subId
};
for (let i = 0; i < count; i++) {
let childRowDef = constituents[i]; // TODO: the constituents should be sorted by CHILD_ORDER first
let childRowDef = constituents[i];
evtArg["ric"] = childRowDef.getRic();
evtArg["values"] = childRowDef.cloneRowData();
evtArg["values"]["SUB_ID"] = subId; // Imitate real-time service responses
Expand Down
88 changes: 50 additions & 38 deletions resources/elf-halo-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -82240,6 +82240,12 @@ Recommended fix:
min: 0,
max: 1e7
},
"CHILD_ORDER": {
type: "set",
ignore: true,
members: [undefined]
},
// eslint-disable-line
"RI_FLAG": {
type: "set",
members: ["R", "Q", "I", "_", ""]
Expand Down Expand Up @@ -82588,8 +82594,12 @@ Recommended fix:
* @return {*}
*/
let randMember = function (set, seed) {
if (set) {
let index = randIndex(set.length, seed);
var len = set ? set.length || 0 : 0;
if (len) {
if (len === 1) {
return set[0];
}
let index = randIndex(len, seed);
return set[index];
}
return String.fromCharCode(randInt(65, 90, seed));
Expand Down Expand Up @@ -84288,48 +84298,47 @@ Recommended fix:
// find key to random subs (key is subId)
let key = keys[this._dataGen.randIndex(len)]; // WARNING: Same sub could be picked more than once
let subs = this._dataMap.getItems(key); // Get all subs with the same RIC

let sub = subs[0]; // Only the first sub is need to generate data
let values, j, jLen;
let subParent = sub.parent;
let subCount = subs.length;
let j;
let firstSub = subs[0]; // Only the first sub is need to generate data
let subParent = firstSub.parent;
let updatePosition = this._dataGen.randInt(0, 100) < this._percentageOrderChange * 100 ? true : false; // Random chance to change dynamic chain position (2% to change)

let values = this._generateQuoteData(firstSub, fields);
if (_isDynamicChain(key) && subParent && updatePosition) {
// subParent in header of dynamic chain is behavior like a normal ric
// subParent in header of dynamic chain behaves like a normal ric
let children = subParent.children;
let childCount = children.length;
children = _shuffleArray(children); // Random swap children in array
let childrenLen = children.length;
let subIndex = children.indexOf(sub);
sub["CHILD_ORDER"] = subIndex;
values = this._generateQuoteData(sub, fields);
jLen = subs.length;
for (j = 0; j < jLen; ++j) {
let newOrder = children.indexOf(firstSub);
firstSub["CHILD_ORDER"] = newOrder; // This is bad
values["CHILD_ORDER"] = newOrder;
childOrderChange = true;
for (j = 0; j < subCount; ++j) {
// It could be same ric and it need to dispatch with same ric number
for (let k = 0; k < childrenLen; k++) {
let child = children[k];
if (subs[j] === child) {
values["CHILD_ORDER"] = child["CHILD_ORDER"];
this._dispatchDataChanged(subs[j], values);
} else {
let currentChild = child["CHILD_ORDER"];
this._dispatchDataChanged(child, {
X_RIC_NAME: child.ric,
CHILD_ORDER: currentChild
this._dispatchDataChanged(subs[j], values);
// Update child order for all children with the same parent
for (let k = 0; k < childCount; k++) {
// This is not correct, if there is a duplicate dynamic chain
if (k !== newOrder) {
this._dispatchDataChanged(children[k], {
X_RIC_NAME: children[k].ric,
CHILD_ORDER: k
});
}
}
childOrderChange = true;
}
} else {
values = this._generateQuoteData(sub, fields);
jLen = subs.length; // Duplicate ric or chain
for (j = 0; j < jLen; ++j) {
// It could be same ric and it need to dispatch with same ric number
let childOrder = subs[j]["CHILD_ORDER"];
if (subCount > 1) {
// Duplicate CHILD_ORDER from the first sub for other sub with the same RIC (not entirely correct)
let childOrder = firstSub["CHILD_ORDER"];
if (childOrder != null) {
// Children of chain will have a CHILD_ORDER
values["CHILD_ORDER"] = childOrder;
}
}
for (j = 0; j < subCount; ++j) {
// It could be same ric and it need to dispatch with same ric number
this._dispatchDataChanged(subs[j], values);
updateCount++;
}
Expand Down Expand Up @@ -84368,19 +84377,22 @@ Recommended fix:
prefix: sub["parent"] ? sub["parent"]["ric"] : "" // prefix for constituents
};
for (let field in fields) {
let data = this._dataGen.generateQuoteData(field, options);
let fInfo = this._dataGen.generateQuoteData(field, options);
if (fInfo.ignore) {
continue;
}
let formattedField = field + "_FORMATTED";
if (prevData) {
if (data.changeOnly) {
if (prevData[field] === data.value) {
if (fInfo.changeOnly) {
if (prevData[field] === fInfo.value) {
continue;
}
}
prevData[field] = data.value;
prevData[formattedField] = data.formattedValue;
prevData[field] = fInfo.value;
prevData[formattedField] = fInfo.formattedValue;
}
values[field] = data.value;
values[formattedField] = data.formattedValue;
values[field] = fInfo.value;
values[formattedField] = fInfo.formattedValue;
}

// The delay symbol for X_RIC_NAME will depend on the INDICATOR field.
Expand Down Expand Up @@ -157139,7 +157151,7 @@ Recommended fix:
* @return {string}
*/
Core.getVersion = function () {
return "__grid_version__";
return "5.1.137";
};
/** {@link ElementWrapper#dispose}
* @override
Expand Down Expand Up @@ -167499,7 +167511,7 @@ Recommended fix:
"subId": subId
};
for (let i = 0; i < count; i++) {
let childRowDef = constituents[i]; // TODO: the constituents should be sorted by CHILD_ORDER first
let childRowDef = constituents[i];
evtArg["ric"] = childRowDef.getRic();
evtArg["values"] = childRowDef.cloneRowData();
evtArg["values"]["SUB_ID"] = subId; // Imitate real-time service responses
Expand Down

0 comments on commit 6fd5f15

Please sign in to comment.