@visactor/vtable 0.11.1-alpha.9 → 0.12.0-alpha.1
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/ListTable.d.ts +0 -2
- package/cjs/ListTable.js +10 -16
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +2 -2
- package/cjs/PivotChart.js +53 -28
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +63 -31
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +6 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.js +5 -12
- package/cjs/dataset/dataset.d.ts +9 -8
- package/cjs/dataset/dataset.js +105 -61
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/flatDataToObject.js +2 -3
- package/cjs/event/event.js +2 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/scroll-bar.js +6 -6
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/pivot-chart/axis-click.js.map +1 -1
- package/cjs/event/pivot-chart/axis-hover.js.map +1 -1
- package/cjs/event/sparkline-event.js.map +1 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.d.ts +4 -4
- package/cjs/layout/chart-helper/get-axis-config.js +25 -23
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
- package/cjs/layout/chart-helper/get-axis-domain.js +2 -2
- package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.d.ts +4 -5
- package/cjs/layout/chart-helper/get-chart-spec.js +14 -13
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +58 -44
- package/cjs/layout/pivot-header-layout.js +425 -200
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout-helper.d.ts +40 -0
- package/cjs/layout/pivot-layout-helper.js +96 -0
- package/cjs/layout/pivot-layout-helper.js.map +1 -0
- package/cjs/layout/pivot-layout.d.ts +1 -145
- package/cjs/layout/pivot-layout.js +0 -819
- package/cjs/layout/pivot-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +1 -1
- package/cjs/layout/simple-header-layout.js +2 -2
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/menu.d.ts +41 -0
- package/cjs/scenegraph/context/module.js +2 -4
- package/cjs/scenegraph/debug-tool/debug-tool.js +1 -1
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +2 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +9 -9
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js +3 -3
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/index.d.ts +1 -1
- package/cjs/scenegraph/graphic/contributions/index.js +2 -2
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +3 -3
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/group.d.ts +3 -0
- package/cjs/scenegraph/graphic/group.js +20 -0
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +3 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js +15 -13
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +2 -2
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.d.ts +1 -1
- package/cjs/scenegraph/layout/update-row.js +5 -1
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -1
- package/cjs/scenegraph/scenegraph.js +9 -6
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/break-string.js +3 -4
- package/cjs/scenegraph/utils/deal-promise-data.js +1 -3
- package/cjs/scenegraph/utils/render-service.d.ts +7 -0
- package/cjs/scenegraph/utils/render-service.js +27 -0
- package/cjs/scenegraph/utils/render-service.js.map +1 -0
- package/{es/scenegraph/utils/measure-text.d.ts → cjs/scenegraph/utils/text-measure.d.ts} +10 -3
- package/cjs/scenegraph/utils/{measure-text.js → text-measure.js} +30 -15
- package/cjs/scenegraph/utils/text-measure.js.map +1 -0
- package/cjs/state/state.d.ts +1 -0
- package/cjs/state/state.js +4 -2
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/BRIGHT.js +1 -2
- package/cjs/themes/DARK.js +2 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/calc.js +1 -1
- package/cjs/tools/diff-cell.d.ts +9 -2
- package/cjs/tools/diff-cell.js +16 -4
- package/cjs/tools/diff-cell.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.js +2 -2
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/tools/get-data-path/index.js +9 -4
- package/cjs/tools/get-data-path/index.js.map +1 -1
- package/cjs/tools/isx.d.ts +1 -1
- package/cjs/tools/util.d.ts +1 -3
- package/cjs/tools/util.js +2 -33
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +14 -6
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -2
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +9 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +58114 -69799
- package/dist/vtable.min.js +12 -14
- package/es/ListTable.d.ts +0 -2
- package/es/ListTable.js +8 -12
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +2 -2
- package/es/PivotChart.js +53 -29
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +61 -32
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +5 -5
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset-pivot-table.js +5 -12
- package/es/dataset/dataset.d.ts +9 -8
- package/es/dataset/dataset.js +104 -61
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/flatDataToObject.js +2 -3
- package/es/event/event.js +2 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/scroll-bar.js +6 -6
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/pivot-chart/axis-click.js.map +1 -1
- package/es/event/pivot-chart/axis-hover.js.map +1 -1
- package/es/event/sparkline-event.js.map +1 -1
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -3
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.d.ts +4 -4
- package/es/layout/chart-helper/get-axis-config.js +21 -19
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
- package/es/layout/chart-helper/get-axis-domain.js +2 -2
- package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.d.ts +4 -5
- package/es/layout/chart-helper/get-chart-spec.js +13 -12
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +58 -44
- package/es/layout/pivot-header-layout.js +425 -197
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout-helper.d.ts +40 -0
- package/es/layout/pivot-layout-helper.js +94 -0
- package/es/layout/pivot-layout-helper.js.map +1 -0
- package/es/layout/pivot-layout.d.ts +1 -145
- package/es/layout/pivot-layout.js +1 -823
- package/es/layout/pivot-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +1 -1
- package/es/layout/simple-header-layout.js +2 -2
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/menu.d.ts +41 -0
- package/es/scenegraph/context/module.js +2 -4
- package/es/scenegraph/debug-tool/debug-tool.js +1 -1
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +1 -3
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +1 -3
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/image-contribution-render.js +1 -3
- package/es/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/index.d.ts +1 -1
- package/es/scenegraph/graphic/contributions/index.js +1 -3
- package/es/scenegraph/graphic/contributions/index.js.map +1 -1
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js +1 -3
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/group.d.ts +3 -0
- package/es/scenegraph/graphic/group.js +20 -0
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +3 -0
- package/es/scenegraph/group-creater/progress/proxy.js +15 -13
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +2 -2
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.d.ts +1 -1
- package/es/scenegraph/layout/update-row.js +5 -1
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -1
- package/es/scenegraph/scenegraph.js +10 -7
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/break-string.js +3 -4
- package/es/scenegraph/utils/deal-promise-data.js +1 -3
- package/es/scenegraph/utils/render-service.d.ts +7 -0
- package/es/scenegraph/utils/render-service.js +19 -0
- package/es/scenegraph/utils/render-service.js.map +1 -0
- package/{cjs/scenegraph/utils/measure-text.d.ts → es/scenegraph/utils/text-measure.d.ts} +10 -3
- package/es/scenegraph/utils/{measure-text.js → text-measure.js} +31 -19
- package/es/scenegraph/utils/text-measure.js.map +1 -0
- package/es/state/state.d.ts +1 -0
- package/es/state/state.js +4 -2
- package/es/state/state.js.map +1 -1
- package/es/themes/BRIGHT.js +1 -2
- package/es/themes/DARK.js +2 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/calc.js +1 -1
- package/es/tools/diff-cell.d.ts +9 -2
- package/es/tools/diff-cell.js +16 -4
- package/es/tools/diff-cell.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.js +2 -2
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/tools/get-data-path/index.js +10 -5
- package/es/tools/get-data-path/index.js.map +1 -1
- package/es/tools/isx.d.ts +1 -1
- package/es/tools/util.d.ts +1 -3
- package/es/tools/util.js +1 -31
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +14 -6
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +2 -2
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +9 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +8 -9
- package/cjs/components/axis/get-axis-attributes.d.ts +0 -151
- package/cjs/scenegraph/utils/measure-text.js.map +0 -1
- package/es/components/axis/get-axis-attributes.d.ts +0 -151
- package/es/scenegraph/utils/measure-text.js.map +0 -1
|
@@ -33,23 +33,16 @@ class DatasetForPivotTable {
|
|
|
33
33
|
}
|
|
34
34
|
if (records) {
|
|
35
35
|
this.records = records;
|
|
36
|
-
|
|
36
|
+
"undefined" != typeof window && window.performance.now();
|
|
37
37
|
this.setRecords(records);
|
|
38
|
-
|
|
39
|
-
console.log("processRecords:", t1 - t0);
|
|
40
|
-
const t4 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
38
|
+
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
41
39
|
this.totalStatistics();
|
|
42
|
-
|
|
43
|
-
console.log("totalStatistics:", t5 - t4);
|
|
44
|
-
const t2 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
40
|
+
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
45
41
|
this.sortKeys();
|
|
46
|
-
|
|
47
|
-
console.log("sortKeys:", t3 - t2);
|
|
48
|
-
const t7 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
42
|
+
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
49
43
|
this.rowKeysPath = customRowTree ? this.TreeToArr2(customRowTree) : this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_0 = null === (_z = null == this ? void 0 : this.totals) || void 0 === _z ? void 0 : _z.row) || void 0 === _0 ? void 0 : _0.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
|
|
50
44
|
this.colKeysPath = customColTree ? this.TreeToArr2(customColTree) : this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_2 = null === (_1 = this.totals) || void 0 === _1 ? void 0 : _1.column) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
|
|
51
|
-
|
|
52
|
-
console.log("TreeToArr:", t8 - t7);
|
|
45
|
+
"undefined" != typeof window && window.performance.now();
|
|
53
46
|
}
|
|
54
47
|
delete this.rowFlatKeys, delete this.colFlatKeys;
|
|
55
48
|
}
|
package/cjs/dataset/dataset.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import type { FilterRules, IDataConfig, SortRule, AggregationRules, SortRules, DerivedFieldRules, Totals, MappingRules, IHeaderTreeDefine, CollectValueBy, CollectedValue,
|
|
1
|
+
import type { FilterRules, IDataConfig, SortRule, AggregationRules, SortRules, DerivedFieldRules, Totals, MappingRules, IHeaderTreeDefine, CollectValueBy, CollectedValue, IIndicator } from '../ts-types';
|
|
2
2
|
import type { Aggregator } from './statistics-helper';
|
|
3
3
|
import { typeSort } from './statistics-helper';
|
|
4
4
|
export declare class Dataset {
|
|
5
5
|
dataConfig: IDataConfig;
|
|
6
|
-
pagination: IPagination;
|
|
7
6
|
records: any[] | Record<string, any[]>;
|
|
8
7
|
tree: Record<string, Record<string, Aggregator[]>>;
|
|
9
8
|
private colFlatKeys;
|
|
10
9
|
private rowFlatKeys;
|
|
11
10
|
colKeys: string[][];
|
|
12
11
|
rowKeys: string[][];
|
|
13
|
-
rowKeysPath: string[][];
|
|
14
|
-
colKeysPath: string[][];
|
|
15
12
|
rowOrder: string;
|
|
16
13
|
colOrder: string;
|
|
17
14
|
sorted: boolean;
|
|
@@ -45,8 +42,12 @@ export declare class Dataset {
|
|
|
45
42
|
rows: string[];
|
|
46
43
|
columns: string[];
|
|
47
44
|
indicatorKeys: string[];
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
colHeaderTree: any[];
|
|
46
|
+
rowHeaderTree: any[];
|
|
47
|
+
rowHierarchyType: 'grid' | 'tree';
|
|
48
|
+
indicators: (string | IIndicator)[];
|
|
49
|
+
indicatorsAsCol: boolean;
|
|
50
|
+
constructor(dataConfig: IDataConfig, rows: string[], columns: string[], indicatorKeys: string[], indicators: (string | IIndicator)[], indicatorsAsCol: boolean, records: any[] | Record<string, any[]>, rowHierarchyType?: 'grid' | 'tree', customColTree?: IHeaderTreeDefine[], customRowTree?: IHeaderTreeDefine[], needSplitPositiveAndNegative?: boolean);
|
|
50
51
|
registerAggregator(type: string, aggregator: any): void;
|
|
51
52
|
registerAggregators(): void;
|
|
52
53
|
private setRecords;
|
|
@@ -57,16 +58,16 @@ export declare class Dataset {
|
|
|
57
58
|
private processRecord;
|
|
58
59
|
updateSortRules(sortRules: SortRules): void;
|
|
59
60
|
updateFilterRules(filterRules: FilterRules, isResetTree?: boolean): void;
|
|
60
|
-
updatePagination(pagination: IPagination): void;
|
|
61
61
|
private getAggregatorRule;
|
|
62
62
|
getAggregator(rowKey: string[] | string, colKey: string[] | string, indicator: string): Aggregator;
|
|
63
63
|
sortKeys(): void;
|
|
64
64
|
arrSort(fieldArr: string[], isRow: boolean): (a: string[], b: string[]) => number;
|
|
65
65
|
getSort(sortRule: SortRule, isSortRow: boolean): typeof typeSort;
|
|
66
66
|
totalStatistics(): void;
|
|
67
|
+
private ArrToTree1;
|
|
67
68
|
private ArrToTree;
|
|
68
69
|
private TreeToArr;
|
|
69
|
-
private TreeToArr2;
|
|
70
70
|
private dealWithZeroAlign;
|
|
71
71
|
private cacheDeminsionCollectedValues;
|
|
72
|
+
private _adjustCustomTree;
|
|
72
73
|
}
|
package/cjs/dataset/dataset.js
CHANGED
|
@@ -4,21 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.Dataset = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"),
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"), statistics_helper_1 = require("./statistics-helper"), zero_align_1 = require("./util/zero-align");
|
|
8
8
|
|
|
9
9
|
class Dataset {
|
|
10
|
-
constructor(dataConfig,
|
|
10
|
+
constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
|
|
11
11
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
12
12
|
this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {}, this.colKeys = [],
|
|
13
13
|
this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z", this.sorted = !1,
|
|
14
14
|
this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
|
|
15
15
|
this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.cacheCollectedValues = {},
|
|
16
|
-
this.registerAggregators(), this.dataConfig = dataConfig, this.
|
|
16
|
+
this.registerAggregators(), this.dataConfig = dataConfig, this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid",
|
|
17
|
+
this.sortRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.sortRules,
|
|
17
18
|
this.aggregationRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.aggregationRules,
|
|
18
19
|
this.derivedFieldRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.derivedFieldRules,
|
|
19
20
|
this.mappingRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.mappingRules,
|
|
20
21
|
this.totals = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals,
|
|
21
|
-
this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.
|
|
22
|
+
this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.indicatorsAsCol = indicatorsAsCol,
|
|
23
|
+
this.indicators = indicators, this.colGrandTotalLabel = null !== (_h = null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.grandTotalLabel) && void 0 !== _h ? _h : "总计",
|
|
22
24
|
this.colSubTotalLabel = null !== (_l = null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalLabel) && void 0 !== _l ? _l : "小计",
|
|
23
25
|
this.rowGrandTotalLabel = null !== (_p = null === (_o = null === (_m = this.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.grandTotalLabel) && void 0 !== _p ? _p : "总计",
|
|
24
26
|
this.rowSubTotalLabel = null !== (_s = null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.subTotalLabel) && void 0 !== _s ? _s : "小计",
|
|
@@ -33,28 +35,23 @@ class Dataset {
|
|
|
33
35
|
const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
|
|
34
36
|
this.colsIsTotal[dimensionIndex] = !0;
|
|
35
37
|
}
|
|
36
|
-
if (
|
|
38
|
+
if (records) {
|
|
37
39
|
this.records = records;
|
|
38
|
-
|
|
40
|
+
"undefined" != typeof window && window.performance.now();
|
|
39
41
|
this.setRecords(), this.processCollectedValuesWithSumBy(), this.processCollectedValuesWithSortBy();
|
|
40
|
-
|
|
41
|
-
console.log("processRecords:", t1 - t0);
|
|
42
|
-
const t4 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
42
|
+
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
43
43
|
this.totalStatistics();
|
|
44
|
-
|
|
45
|
-
console.log("totalStatistics:", t5 - t4);
|
|
46
|
-
const t2 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
44
|
+
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
47
45
|
this.sortKeys();
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
47
|
+
customRowTree ? (indicatorsAsCol || (customRowTree = this._adjustCustomTree(customRowTree)),
|
|
48
|
+
this.rowHeaderTree = customRowTree) : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, indicatorsAsCol ? void 0 : indicators) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, indicatorsAsCol ? void 0 : indicators, this.rowsIsTotal, (null === (_1 = null === (_0 = null == this ? void 0 : this.totals) || void 0 === _0 ? void 0 : _0.row) || void 0 === _1 ? void 0 : _1.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel),
|
|
49
|
+
customColTree ? (indicatorsAsCol && (customColTree = this._adjustCustomTree(customColTree)),
|
|
50
|
+
this.colHeaderTree = customColTree) : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, indicatorsAsCol ? indicators : void 0, this.colsIsTotal, null === (_3 = null === (_2 = this.totals) || void 0 === _2 ? void 0 : _2.column) || void 0 === _3 ? void 0 : _3.showGrandTotals, this.colGrandTotalLabel, this.colSubTotalLabel);
|
|
51
|
+
"undefined" != typeof window && window.performance.now();
|
|
52
|
+
(null === (_4 = this.dataConfig) || void 0 === _4 ? void 0 : _4.isPivotChart) && (this.dealWithZeroAlign(),
|
|
55
53
|
this.cacheDeminsionCollectedValues());
|
|
56
54
|
}
|
|
57
|
-
this.updatePagination(pagination);
|
|
58
55
|
}
|
|
59
56
|
registerAggregator(type, aggregator) {
|
|
60
57
|
this.aggregators[type] = aggregator;
|
|
@@ -179,9 +176,7 @@ class Dataset {
|
|
|
179
176
|
}
|
|
180
177
|
}
|
|
181
178
|
updateSortRules(sortRules) {
|
|
182
|
-
|
|
183
|
-
this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.rowKeysPath_FULL = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_b = null === (_a = null == this ? void 0 : this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
|
|
184
|
-
this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.column) || void 0 === _d ? void 0 : _d.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
|
|
179
|
+
this.sorted = !1, this.sortRules = sortRules, this.sortKeys();
|
|
185
180
|
}
|
|
186
181
|
updateFilterRules(filterRules, isResetTree = !1) {
|
|
187
182
|
var _a;
|
|
@@ -189,16 +184,6 @@ class Dataset {
|
|
|
189
184
|
this.collectedValues = {}, this.processRecords(), this.processCollectedValuesWithSumBy(),
|
|
190
185
|
this.processCollectedValuesWithSortBy(), (null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.isPivotChart) && this.dealWithZeroAlign();
|
|
191
186
|
}
|
|
192
|
-
updatePagination(pagination) {
|
|
193
|
-
var _a, _b, _c, _d;
|
|
194
|
-
if (this.pagination = pagination, (0, util_1.isValid)(null === (_a = this.pagination) || void 0 === _a ? void 0 : _a.perPageCount) && (0,
|
|
195
|
-
util_1.isValid)(null === (_b = this.pagination) || void 0 === _b ? void 0 : _b.currentPage)) {
|
|
196
|
-
this.pagination.perPageCount = Math.ceil(this.pagination.perPageCount / this.indicatorKeys.length) * this.indicatorKeys.length;
|
|
197
|
-
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, startIndex = Math.ceil(perPageCount * (currentPage || 0) / this.indicatorKeys.length), endIndex = startIndex + Math.ceil(perPageCount / this.indicatorKeys.length);
|
|
198
|
-
this.rowKeysPath = null === (_c = this.rowKeysPath_FULL) || void 0 === _c ? void 0 : _c.slice(startIndex, endIndex);
|
|
199
|
-
} else this.rowKeysPath = this.rowKeysPath_FULL;
|
|
200
|
-
this.pagination && (this.pagination.totalCount = null === (_d = this.rowKeysPath_FULL) || void 0 === _d ? void 0 : _d.length);
|
|
201
|
-
}
|
|
202
187
|
getAggregatorRule(indicatorKey) {
|
|
203
188
|
var _a;
|
|
204
189
|
return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
|
|
@@ -321,7 +306,7 @@ class Dataset {
|
|
|
321
306
|
const dimension = that.totals.column.subTotalsDimensions[i], dimensionIndex = that.columns.indexOf(dimension);
|
|
322
307
|
if (dimensionIndex >= 0) {
|
|
323
308
|
const colTotalKey = colKey.slice(0, dimensionIndex + 1);
|
|
324
|
-
colTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
|
|
309
|
+
"grid" === this.rowHierarchyType && colTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
|
|
325
310
|
const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
|
|
326
311
|
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
327
312
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
@@ -353,7 +338,7 @@ class Dataset {
|
|
|
353
338
|
const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
|
|
354
339
|
if (dimensionIndex >= 0) {
|
|
355
340
|
const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
|
|
356
|
-
rowTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.row) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
|
|
341
|
+
"grid" === this.rowHierarchyType && rowTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.row) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
|
|
357
342
|
const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
|
|
358
343
|
if (this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
359
344
|
!this.tree[flatRowTotalKey][flatColKey]) {
|
|
@@ -389,9 +374,35 @@ class Dataset {
|
|
|
389
374
|
}));
|
|
390
375
|
}
|
|
391
376
|
}
|
|
392
|
-
|
|
377
|
+
ArrToTree1(arr, rows, indicators) {
|
|
393
378
|
const result = [], concatStr = this.stringJoinChar, map = new Map;
|
|
394
|
-
|
|
379
|
+
return arr.forEach((item => function(list) {
|
|
380
|
+
const path = [];
|
|
381
|
+
let node;
|
|
382
|
+
list.forEach(((value, index) => {
|
|
383
|
+
path.push(value);
|
|
384
|
+
const flatKey = path.join(concatStr);
|
|
385
|
+
let item = map.get(flatKey);
|
|
386
|
+
item || (item = {
|
|
387
|
+
value: value,
|
|
388
|
+
dimensionKey: rows[index],
|
|
389
|
+
children: index === list.length - 1 && (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
|
|
390
|
+
indicatorKey: indicator,
|
|
391
|
+
value: indicator
|
|
392
|
+
} : {
|
|
393
|
+
indicatorKey: indicator.indicatorKey,
|
|
394
|
+
value: indicator.title
|
|
395
|
+
})) : []
|
|
396
|
+
}, map.set(flatKey, item), node ? node.children.push(item) : result.push(item)),
|
|
397
|
+
node = item;
|
|
398
|
+
}));
|
|
399
|
+
}(item))), result;
|
|
400
|
+
}
|
|
401
|
+
ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel) {
|
|
402
|
+
var _a;
|
|
403
|
+
let result = [];
|
|
404
|
+
const concatStr = this.stringJoinChar, map = new Map;
|
|
405
|
+
if ((null == arr ? void 0 : arr.length) ? arr.forEach((item => function(list) {
|
|
395
406
|
const path = [];
|
|
396
407
|
let node;
|
|
397
408
|
list.forEach(((value, index) => {
|
|
@@ -400,14 +411,28 @@ class Dataset {
|
|
|
400
411
|
let item = map.get(flatKey);
|
|
401
412
|
if (!item) {
|
|
402
413
|
if (item = {
|
|
403
|
-
|
|
404
|
-
|
|
414
|
+
value: value,
|
|
415
|
+
dimensionKey: rows[index],
|
|
416
|
+
children: index === list.length - 1 && (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
|
|
417
|
+
indicatorKey: indicator,
|
|
418
|
+
value: indicator
|
|
419
|
+
} : {
|
|
420
|
+
indicatorKey: indicator.indicatorKey,
|
|
421
|
+
value: indicator.title
|
|
422
|
+
})) : []
|
|
405
423
|
}, subTotalFlags[index]) {
|
|
406
424
|
let curChild = item.children;
|
|
407
425
|
for (let i = index; i < list.length - 1; i++) {
|
|
408
426
|
const totalChild = {
|
|
409
|
-
|
|
410
|
-
|
|
427
|
+
value: subTotalLabel,
|
|
428
|
+
dimensionKey: rows[index + 1],
|
|
429
|
+
children: index + 1 === list.length - 1 && (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
|
|
430
|
+
indicatorKey: indicator,
|
|
431
|
+
value: indicator
|
|
432
|
+
} : {
|
|
433
|
+
indicatorKey: indicator.indicatorKey,
|
|
434
|
+
value: indicator.title
|
|
435
|
+
})) : []
|
|
411
436
|
};
|
|
412
437
|
curChild.push(totalChild), curChild = totalChild.children;
|
|
413
438
|
}
|
|
@@ -416,19 +441,25 @@ class Dataset {
|
|
|
416
441
|
}
|
|
417
442
|
node = item;
|
|
418
443
|
}));
|
|
419
|
-
}(item)))
|
|
444
|
+
}(item))) : indicators && (result = null == indicators ? void 0 : indicators.map((indicator => {
|
|
445
|
+
var _a;
|
|
446
|
+
return {
|
|
447
|
+
indicatorKey: indicator.indicatorKey,
|
|
448
|
+
value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
|
|
449
|
+
};
|
|
450
|
+
}))), isGrandTotal && (null == arr ? void 0 : arr.length)) {
|
|
420
451
|
const node = {
|
|
421
|
-
|
|
422
|
-
|
|
452
|
+
value: grandTotalLabel,
|
|
453
|
+
dimensionKey: rows[0],
|
|
454
|
+
rowSpan: subTotalFlags.length,
|
|
455
|
+
children: null !== (_a = null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
|
|
456
|
+
indicatorKey: indicator,
|
|
457
|
+
value: indicator
|
|
458
|
+
} : {
|
|
459
|
+
indicatorKey: indicator.indicatorKey,
|
|
460
|
+
value: indicator.title
|
|
461
|
+
}))) && void 0 !== _a ? _a : []
|
|
423
462
|
};
|
|
424
|
-
let curChild = node.children;
|
|
425
|
-
for (let i = 1; i < subTotalFlags.length; i++) {
|
|
426
|
-
const totalChild = {
|
|
427
|
-
id: grandTotalLabel,
|
|
428
|
-
children: []
|
|
429
|
-
};
|
|
430
|
-
curChild.push(totalChild), curChild = totalChild.children;
|
|
431
|
-
}
|
|
432
463
|
result.push(node);
|
|
433
464
|
}
|
|
434
465
|
return result;
|
|
@@ -441,15 +472,6 @@ class Dataset {
|
|
|
441
472
|
}
|
|
442
473
|
return tree.forEach((treeNode => getPath(treeNode, []))), result;
|
|
443
474
|
}
|
|
444
|
-
TreeToArr2(tree) {
|
|
445
|
-
const result = [];
|
|
446
|
-
function getPath(node, arr) {
|
|
447
|
-
var _a, _b;
|
|
448
|
-
arr.push(arr.length > 0 ? [ arr[arr.length - 1], node.value ].join(String.fromCharCode(0)) : node.value),
|
|
449
|
-
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) > 0 && !node.children[0].indicatorKey ? null === (_b = node.children) || void 0 === _b || _b.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
|
|
450
|
-
}
|
|
451
|
-
return tree.forEach((treeNode => getPath(treeNode, []))), result;
|
|
452
|
-
}
|
|
453
475
|
dealWithZeroAlign() {
|
|
454
476
|
const indicatorsToAlign = [];
|
|
455
477
|
for (let i = 0; i < this.aggregationRules.length; i++) {
|
|
@@ -491,6 +513,28 @@ class Dataset {
|
|
|
491
513
|
cacheDeminsionCollectedValues() {
|
|
492
514
|
for (const key in this.collectValuesBy) "xField" !== this.collectValuesBy[key].type && "yField" !== this.collectValuesBy[key].type || (this.dataConfig.dimensionSortArray ? this.cacheCollectedValues[key] = arraySortByAnotherArray(this.collectedValues[key], this.dataConfig.dimensionSortArray) : this.cacheCollectedValues[key] = this.collectedValues[key]);
|
|
493
515
|
}
|
|
516
|
+
_adjustCustomTree(customTree) {
|
|
517
|
+
var _a;
|
|
518
|
+
const checkNode = (nodes, isHasIndicator) => {
|
|
519
|
+
nodes.forEach((node => {
|
|
520
|
+
var _a, _b;
|
|
521
|
+
node.indicatorKey || isHasIndicator || (null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? node.children && checkNode(node.children, isHasIndicator || !!node.indicatorKey) : node.children = null === (_b = this.indicators) || void 0 === _b ? void 0 : _b.map((indicator => {
|
|
522
|
+
var _a;
|
|
523
|
+
return {
|
|
524
|
+
indicatorKey: indicator.indicatorKey,
|
|
525
|
+
value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
|
|
526
|
+
};
|
|
527
|
+
}));
|
|
528
|
+
}));
|
|
529
|
+
};
|
|
530
|
+
return (null == customTree ? void 0 : customTree.length) ? checkNode(customTree, !1) : customTree = null === (_a = this.indicators) || void 0 === _a ? void 0 : _a.map((indicator => {
|
|
531
|
+
var _a;
|
|
532
|
+
return {
|
|
533
|
+
indicatorKey: indicator.indicatorKey,
|
|
534
|
+
value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
|
|
535
|
+
};
|
|
536
|
+
})), customTree;
|
|
537
|
+
}
|
|
494
538
|
}
|
|
495
539
|
|
|
496
540
|
function arraySortByAnotherArray(array, sortArray) {
|