@visactor/vtable 1.26.0 → 1.26.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/PivotTable.js +84 -12
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/style.js +2 -1
- package/cjs/core/BaseTable.js +2 -3
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/DataStatistics.js +2 -1
- package/cjs/edit/edit-manager.js +0 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/index.js +1 -1
- package/cjs/layout/layout-helper.js +1 -1
- package/cjs/layout/pivot-header-layout.js +1 -1
- package/cjs/layout/row-height-map.js +1 -1
- package/cjs/layout/simple-header-layout.js +1 -1
- package/cjs/layout/tree-helper.js +1 -1
- package/cjs/plugins/index.js +1 -1
- package/cjs/plugins/interface.js +1 -1
- package/cjs/plugins/invert-highlight.js +1 -1
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/plugin-manager.js +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/ts-types/dataset/aggregation.js +94 -39
- package/cjs/ts-types/dataset/aggregation.js.map +1 -1
- package/cjs/ts-types/icon.d.ts +2 -2
- package/cjs/ts-types/icon.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +203 -78
- package/dist/vtable.min.js +1 -1
- package/es/PivotTable.js +84 -12
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/style.js +2 -1
- package/es/core/BaseTable.js +2 -3
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/DataStatistics.js +2 -1
- package/es/edit/edit-manager.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/index.js +1 -1
- package/es/layout/layout-helper.js +1 -1
- package/es/layout/pivot-header-layout.js +1 -1
- package/es/layout/row-height-map.js +1 -1
- package/es/layout/simple-header-layout.js +1 -1
- package/es/layout/tree-helper.js +1 -1
- package/es/plugins/index.js +1 -1
- package/es/plugins/interface.js +1 -1
- package/es/plugins/invert-highlight.js +1 -1
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/plugin-manager.js +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/ts-types/dataset/aggregation.js +68 -38
- package/es/ts-types/dataset/aggregation.js.map +1 -1
- package/es/ts-types/icon.d.ts +2 -2
- package/es/ts-types/icon.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +7 -6
|
@@ -77,4 +77,5 @@ function dateFormat(baseField, formatString, utcOutput, mthNames, dayNames) {
|
|
|
77
77
|
Object.defineProperty(exports, "__esModule", {
|
|
78
78
|
value: !0
|
|
79
79
|
}), exports.dateFormat = exports.numberFormat = void 0, exports.numberFormat = numberFormat,
|
|
80
|
-
exports.dateFormat = dateFormat;
|
|
80
|
+
exports.dateFormat = dateFormat;
|
|
81
|
+
//# sourceMappingURL=DataStatistics.js.map
|
package/cjs/edit/edit-manager.js
CHANGED
package/cjs/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { toBoxArray } from './tools/helper';
|
|
|
24
24
|
export { Icon } from './scenegraph/graphic/icon';
|
|
25
25
|
export { CUSTOM_MERGE_PRE_NAME, CUSTOM_CONTAINER_NAME } from './scenegraph/component/custom';
|
|
26
26
|
export { matrixAllocate, transformPointForCanvas, mapToCanvasPointForCanvas, registerGlobalEventTransformer, registerWindowEventTransformer, vglobal, Group, graphicUtil } from './vrender';
|
|
27
|
-
export declare const version = "1.26.0";
|
|
27
|
+
export declare const version = "1.26.1-alpha.0";
|
|
28
28
|
export { TYPES, core, ListTable, ListTableSimple, BaseTableAPI, ListTableConstructorOptions, PivotTable, PivotTableSimple, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, IHeaderTreeDefine, IDimension, IIndicator, ITitleDefine, ICornerDefine, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, textMeasure, themes, data, MousePointerCellEvent, getIcons, clearGlobal, register, DataStatistics, CustomLayout, updateCell, renderChart, setCustomAlphabetCharSet, restoreMeasureText, pluginsDefinition };
|
|
29
29
|
declare function getIcons(): {
|
|
30
30
|
[key: string]: TYPES.ColumnIconOption;
|
package/cjs/index.js
CHANGED
|
@@ -249,7 +249,7 @@ Object.defineProperty(exports, "matrixAllocate", {
|
|
|
249
249
|
get: function() {
|
|
250
250
|
return vrender_2.graphicUtil;
|
|
251
251
|
}
|
|
252
|
-
}), exports.version = "1.26.0", exports.getIcons = getIcons, exports.clearGlobal = clearGlobal,
|
|
252
|
+
}), exports.version = "1.26.1-alpha.0", exports.getIcons = getIcons, exports.clearGlobal = clearGlobal,
|
|
253
253
|
TYPES.AggregationType, __exportStar(require("./components"), exports), __exportStar(require("./scenegraph/group-creater/cell-type"), exports);
|
|
254
254
|
|
|
255
255
|
var TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE");
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA+C;AAC/C,IAAA,4BAAkB,GAAE,CAAC;AAErB,kDAAoC;AA4ElC,sBAAK;AA3EP,6CAA+B;AA4E7B,oBAAI;AA3EN,6CAA+B;AAuG7B,oBAAI;AAtGN,+CAAiC;AACjC,qDAAuC;AA0GrC,4BAAQ;AAzGV,iDAAmC;AAmGjC,wBAAM;AAlGR,yEAA2D;AA4GzD,wCAAc;AA3GhB,6DAA+C;AAiH7C,8CAAiB;AA3FnB,mDAA4D;AAiD1D,0FAjDuB,4BAAS,OAiDvB;AAhDX,yDAAqD;AAiDnD,gGAjDO,kCAAe,OAiDP;AA/CjB,qDAA+D;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uEAAqD;AAErD,4DAA2D;AAAlD,oHAAA,gBAAgB,OAAA;AACzB,wFAA+G;AAAtG,gIAAA,sBAAsB,OAAA;AAAE,gIAAA,sBAAsB,OAAA;AAEvD,mDAAkD;AAAzC,0GAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { registerForVrender } from './vrender';\nregisterForVrender();\n\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport * as pluginsDefinition from './plugins';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTableAll as ListTable } from './ListTable-all';\nimport { ListTableSimple } from './ListTable-simple';\n// import { PivotTable } from './PivotTable';\nimport { PivotTableAll as PivotTable } from './PivotTable-all';\nimport { PivotTableSimple } from './PivotTable-simple';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\nimport { updateCell } from './scenegraph/group-creater/cell-helper';\nimport { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';\nimport { restoreMeasureText, setCustomAlphabetCharSet, textMeasure } from './scenegraph/utils/text-measure';\nimport type { BaseTableAPI } from './ts-types/base-table';\n\n// import { container, loadCanvasPicker } from '@src/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\nexport { getTargetCell } from './event/util';\nexport { toBoxArray } from './tools/helper';\nexport { Icon } from './scenegraph/graphic/icon';\nexport { CUSTOM_MERGE_PRE_NAME, CUSTOM_CONTAINER_NAME } from './scenegraph/component/custom';\n// 为插件等场景提供必要的 vrender 能力:只导出用到的符号,避免与 render/jsx 的导出成员发生命名冲突。\nexport {\n matrixAllocate,\n transformPointForCanvas,\n mapToCanvasPointForCanvas,\n registerGlobalEventTransformer,\n registerWindowEventTransformer,\n vglobal,\n Group,\n graphicUtil\n} from './vrender';\n\n// export * as VRender from './vrender';\n// import * as VRender from './vrender';\n\nexport const version = \"1.26.1-alpha.0\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableSimple,\n BaseTableAPI,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableSimple,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n textMeasure,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout,\n updateCell,\n renderChart,\n setCustomAlphabetCharSet,\n restoreMeasureText,\n pluginsDefinition\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n\nexport * from './components';\nexport * from './scenegraph/group-creater/cell-type';\n\nexport { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE';\nexport { PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';\n\nexport { EventTarget } from './event/EventTarget';\n"]}
|
package/cjs/layout/index.js
CHANGED
|
@@ -151,4 +151,4 @@ exports.checkHasAggregationOnBottom = checkHasAggregationOnBottom, exports.check
|
|
|
151
151
|
exports.hasAutoImageColumn = hasAutoImageColumn, exports.parseColKeyRowKeyForPivotTable = parseColKeyRowKeyForPivotTable,
|
|
152
152
|
exports.supplementIndicatorNodesForCustomTree = supplementIndicatorNodesForCustomTree,
|
|
153
153
|
exports.deleteHideIndicatorNode = deleteHideIndicatorNode;
|
|
154
|
-
//# sourceMappingURL=layout-helper.js.map
|
|
154
|
+
//# sourceMappingURL=layout-helper.js.map
|
|
@@ -2036,5 +2036,5 @@ function bandSpace(count, paddingInner, paddingOuter) {
|
|
|
2036
2036
|
count ? space > 0 ? space : 1 : 0;
|
|
2037
2037
|
}
|
|
2038
2038
|
|
|
2039
|
+
exports.PivotHeaderLayoutMap = PivotHeaderLayoutMap;
|
|
2039
2040
|
//# sourceMappingURL=pivot-header-layout.js.map
|
|
2040
|
-
exports.PivotHeaderLayoutMap = PivotHeaderLayoutMap;
|
|
@@ -411,4 +411,4 @@ function deleteTreeHideNode(tree_children, dimensionPath, indicators, hasHideNod
|
|
|
411
411
|
exports.DimensionTree = DimensionTree, exports.generateLayoutTree = generateLayoutTree,
|
|
412
412
|
exports.countLayoutTree = countLayoutTree, exports.dealHeader = dealHeader, exports.dealHeaderForGridTreeMode = dealHeaderForGridTreeMode,
|
|
413
413
|
exports.dealHeaderForTreeMode = dealHeaderForTreeMode, exports.deleteTreeHideNode = deleteTreeHideNode;
|
|
414
|
-
//# sourceMappingURL=tree-helper.js.map
|
|
414
|
+
//# sourceMappingURL=tree-helper.js.map
|
package/cjs/plugins/index.js
CHANGED
package/cjs/plugins/interface.js
CHANGED
|
@@ -20,4 +20,4 @@ function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
|
|
23
|
-
//# sourceMappingURL=invert-highlight.js.map
|
|
23
|
+
//# sourceMappingURL=invert-highlight.js.map
|
|
@@ -175,45 +175,70 @@ class SumAggregator extends Aggregator {
|
|
|
175
175
|
record.isAggregator && this.children) {
|
|
176
176
|
this.children.push(record);
|
|
177
177
|
const value = record.value();
|
|
178
|
-
this.sum
|
|
178
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
179
|
+
vutils_1.precisionAdd)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
180
|
+
vutils_1.precisionAdd)(this.nagetiveSum, value)));
|
|
179
181
|
} else if (this.field && !isNaN(parseFloat(record[this.field]))) {
|
|
180
182
|
const value = parseFloat(record[this.field]);
|
|
181
|
-
this.sum
|
|
183
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, value), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
184
|
+
vutils_1.precisionAdd)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
185
|
+
vutils_1.precisionAdd)(this.nagetiveSum, value)));
|
|
182
186
|
}
|
|
183
187
|
this.clearCacheValue();
|
|
184
188
|
}
|
|
185
189
|
deleteRecord(record) {
|
|
186
|
-
if (record)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
if (record) {
|
|
191
|
+
if (this.isRecord && this.records) {
|
|
192
|
+
const index = this.records.indexOf(record);
|
|
193
|
+
-1 !== index && this.records.splice(index, 1);
|
|
194
|
+
}
|
|
195
|
+
if (record.isAggregator && this.children) {
|
|
196
|
+
const index = this.children.indexOf(record);
|
|
197
|
+
-1 !== index && this.children.splice(index, 1);
|
|
198
|
+
const value = record.value();
|
|
199
|
+
this.sum = (0, vutils_1.precisionSub)(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
200
|
+
vutils_1.precisionSub)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
201
|
+
vutils_1.precisionSub)(this.nagetiveSum, value)));
|
|
202
|
+
} else if (this.field && !isNaN(parseFloat(record[this.field]))) {
|
|
203
|
+
const value = parseFloat(record[this.field]);
|
|
204
|
+
this.sum = (0, vutils_1.precisionSub)(this.sum, value), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
205
|
+
vutils_1.precisionSub)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
206
|
+
vutils_1.precisionSub)(this.nagetiveSum, value)));
|
|
207
|
+
}
|
|
194
208
|
}
|
|
195
209
|
this.clearCacheValue();
|
|
196
210
|
}
|
|
197
211
|
updateRecord(oldRecord, newRecord) {
|
|
198
212
|
if (oldRecord && newRecord) {
|
|
199
|
-
if (this.isRecord && this.records
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
213
|
+
if (this.isRecord && this.records) {
|
|
214
|
+
const index = this.records.indexOf(oldRecord);
|
|
215
|
+
-1 !== index && (this.records[index] = newRecord);
|
|
216
|
+
}
|
|
217
|
+
if (oldRecord.isAggregator && this.children) {
|
|
218
|
+
const oldValue = oldRecord.value(), index = this.children.indexOf(oldRecord);
|
|
219
|
+
-1 !== index && (this.children[index] = newRecord);
|
|
203
220
|
const newValue = newRecord.value();
|
|
204
|
-
this.
|
|
205
|
-
|
|
221
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, (0, vutils_1.precisionSub)(newValue, oldValue)),
|
|
222
|
+
this.needSplitPositiveAndNegativeForSum && (oldValue > 0 ? this.positiveSum = (0,
|
|
223
|
+
vutils_1.precisionSub)(this.positiveSum, oldValue) : oldValue < 0 && (this.nagetiveSum = (0,
|
|
224
|
+
vutils_1.precisionSub)(this.nagetiveSum, oldValue)), newValue > 0 ? this.positiveSum = (0,
|
|
225
|
+
vutils_1.precisionAdd)(this.positiveSum, newValue) : newValue < 0 && (this.nagetiveSum = (0,
|
|
226
|
+
vutils_1.precisionAdd)(this.nagetiveSum, newValue)));
|
|
206
227
|
} else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
|
|
207
228
|
const oldValue = parseFloat(oldRecord[this.field]), newValue = parseFloat(newRecord[this.field]);
|
|
208
|
-
this.sum
|
|
209
|
-
|
|
229
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, (0, vutils_1.precisionSub)(newValue, oldValue)),
|
|
230
|
+
this.needSplitPositiveAndNegativeForSum && (oldValue > 0 ? this.positiveSum = (0,
|
|
231
|
+
vutils_1.precisionSub)(this.positiveSum, oldValue) : oldValue < 0 && (this.nagetiveSum = (0,
|
|
232
|
+
vutils_1.precisionSub)(this.nagetiveSum, oldValue)), newValue > 0 ? this.positiveSum = (0,
|
|
233
|
+
vutils_1.precisionAdd)(this.positiveSum, newValue) : newValue < 0 && (this.nagetiveSum = (0,
|
|
234
|
+
vutils_1.precisionAdd)(this.nagetiveSum, newValue)));
|
|
210
235
|
}
|
|
211
236
|
this.clearCacheValue();
|
|
212
237
|
}
|
|
213
238
|
}
|
|
214
239
|
value() {
|
|
215
|
-
var _a
|
|
216
|
-
return null !== (_a = this.changedValue) && void 0 !== _a ? _a :
|
|
240
|
+
var _a;
|
|
241
|
+
return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.records && this.records.length >= 1 || !1 === this.isRecord ? this.sum : void 0;
|
|
217
242
|
}
|
|
218
243
|
positiveValue() {
|
|
219
244
|
return this.positiveSum;
|
|
@@ -229,16 +254,22 @@ class SumAggregator extends Aggregator {
|
|
|
229
254
|
const child = this.children[i];
|
|
230
255
|
if (child.isAggregator) {
|
|
231
256
|
const value = child.value();
|
|
232
|
-
this.sum
|
|
257
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
258
|
+
vutils_1.precisionAdd)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
259
|
+
vutils_1.precisionAdd)(this.nagetiveSum, value)));
|
|
233
260
|
}
|
|
234
261
|
} else if (this.records) for (let i = 0; i < this.records.length; i++) {
|
|
235
262
|
const record = this.records[i];
|
|
236
263
|
if (record.isAggregator) {
|
|
237
264
|
const value = record.value();
|
|
238
|
-
this.sum
|
|
265
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
266
|
+
vutils_1.precisionAdd)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
267
|
+
vutils_1.precisionAdd)(this.nagetiveSum, value)));
|
|
239
268
|
} else if (this.field && !isNaN(parseFloat(record[this.field]))) {
|
|
240
269
|
const value = parseFloat(record[this.field]);
|
|
241
|
-
this.sum
|
|
270
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, value), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = (0,
|
|
271
|
+
vutils_1.precisionAdd)(this.positiveSum, value) : value < 0 && (this.nagetiveSum = (0,
|
|
272
|
+
vutils_1.precisionAdd)(this.nagetiveSum, value)));
|
|
242
273
|
}
|
|
243
274
|
}
|
|
244
275
|
}
|
|
@@ -295,24 +326,48 @@ class AvgAggregator extends Aggregator {
|
|
|
295
326
|
push(record) {
|
|
296
327
|
record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
|
|
297
328
|
record.isAggregator && record.type === __1.AggregationType.AVG ? (this.children && this.children.push(record),
|
|
298
|
-
this.sum
|
|
299
|
-
this.
|
|
329
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, record.sum), this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum = (0,
|
|
330
|
+
vutils_1.precisionAdd)(this.sum, parseFloat(record[this.field])), this.count++)),
|
|
331
|
+
this.clearCacheValue();
|
|
300
332
|
}
|
|
301
333
|
deleteRecord(record) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
334
|
+
if (record) {
|
|
335
|
+
if (this.isRecord && this.records) {
|
|
336
|
+
const index = this.records.indexOf(record);
|
|
337
|
+
-1 !== index && this.records.splice(index, 1);
|
|
338
|
+
}
|
|
339
|
+
if (record.isAggregator && record.type === __1.AggregationType.AVG) {
|
|
340
|
+
if (this.children) {
|
|
341
|
+
const index = this.children.indexOf(record);
|
|
342
|
+
-1 !== index && this.children.splice(index, 1);
|
|
343
|
+
}
|
|
344
|
+
this.sum = (0, vutils_1.precisionSub)(this.sum, record.sum), this.count -= record.count;
|
|
345
|
+
} else this.field && !isNaN(parseFloat(record[this.field])) && (this.sum = (0, vutils_1.precisionSub)(this.sum, parseFloat(record[this.field])),
|
|
346
|
+
this.count--);
|
|
347
|
+
}
|
|
348
|
+
this.clearCacheValue();
|
|
306
349
|
}
|
|
307
350
|
updateRecord(oldRecord, newRecord) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
351
|
+
if (oldRecord && newRecord) {
|
|
352
|
+
if (this.isRecord && this.records) {
|
|
353
|
+
const index = this.records.indexOf(oldRecord);
|
|
354
|
+
-1 !== index && (this.records[index] = newRecord);
|
|
355
|
+
}
|
|
356
|
+
if (oldRecord.isAggregator && oldRecord.type === __1.AggregationType.AVG) {
|
|
357
|
+
if (this.children && newRecord.isAggregator) {
|
|
358
|
+
const index = this.children.indexOf(oldRecord);
|
|
359
|
+
-1 !== index && (this.children[index] = newRecord);
|
|
360
|
+
}
|
|
361
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, (0, vutils_1.precisionSub)(newRecord.sum, oldRecord.sum)),
|
|
362
|
+
this.count += newRecord.count - oldRecord.count;
|
|
363
|
+
} else this.field && !isNaN(parseFloat(oldRecord[this.field])) && (this.sum = (0,
|
|
364
|
+
vutils_1.precisionAdd)(this.sum, (0, vutils_1.precisionSub)(parseFloat(newRecord[this.field]), parseFloat(oldRecord[this.field]))));
|
|
365
|
+
this.clearCacheValue();
|
|
366
|
+
}
|
|
312
367
|
}
|
|
313
368
|
value() {
|
|
314
|
-
var _a
|
|
315
|
-
return null !== (_a = this.changedValue) && void 0 !== _a ? _a :
|
|
369
|
+
var _a;
|
|
370
|
+
return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.records && this.records.length >= 1 || !1 === this.isRecord && this.count > 0 ? this.sum / this.count : void 0;
|
|
316
371
|
}
|
|
317
372
|
reset() {
|
|
318
373
|
this.changedValue = void 0, this.children = [], this.records = [], this.sum = 0,
|
|
@@ -323,13 +378,13 @@ class AvgAggregator extends Aggregator {
|
|
|
323
378
|
const child = this.children[i];
|
|
324
379
|
if (child.isAggregator && child.type === __1.AggregationType.AVG) {
|
|
325
380
|
const childValue = child.value();
|
|
326
|
-
this.sum
|
|
381
|
+
this.sum = (0, vutils_1.precisionAdd)(this.sum, childValue * child.count), this.count += child.count;
|
|
327
382
|
}
|
|
328
383
|
} else if (this.records) for (let i = 0; i < this.records.length; i++) {
|
|
329
384
|
const record = this.records[i];
|
|
330
|
-
record.isAggregator && record.type === __1.AggregationType.AVG ? (this.sum
|
|
331
|
-
this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum
|
|
332
|
-
this.count++);
|
|
385
|
+
record.isAggregator && record.type === __1.AggregationType.AVG ? (this.sum = (0,
|
|
386
|
+
vutils_1.precisionAdd)(this.sum, record.sum), this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum = (0,
|
|
387
|
+
vutils_1.precisionAdd)(this.sum, parseFloat(record[this.field])), this.count++);
|
|
333
388
|
}
|
|
334
389
|
}
|
|
335
390
|
}
|