@visactor/vtable 0.15.5-alpha.1 → 0.15.5-alpha.3

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.
Files changed (51) hide show
  1. package/cjs/core/BaseTable.js +2 -2
  2. package/cjs/core/BaseTable.js.map +1 -1
  3. package/cjs/index.d.ts +1 -1
  4. package/cjs/index.js +1 -1
  5. package/cjs/index.js.map +1 -1
  6. package/cjs/layout/pivot-header-layout.d.ts +9 -8
  7. package/cjs/layout/pivot-header-layout.js +38 -132
  8. package/cjs/layout/pivot-header-layout.js.map +1 -1
  9. package/cjs/layout/pivot-layout-helper.d.ts +10 -2
  10. package/cjs/layout/pivot-layout-helper.js +108 -6
  11. package/cjs/layout/pivot-layout-helper.js.map +1 -1
  12. package/cjs/layout/simple-header-layout.d.ts +1 -0
  13. package/cjs/layout/simple-header-layout.js +5 -7
  14. package/cjs/layout/simple-header-layout.js.map +1 -1
  15. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  16. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  17. package/cjs/scenegraph/graphic/group.js +5 -3
  18. package/cjs/scenegraph/graphic/group.js.map +1 -1
  19. package/cjs/scenegraph/layout/compute-row-height.js +21 -7
  20. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  21. package/cjs/scenegraph/style/frame-border.js +8 -6
  22. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  23. package/cjs/themes/BRIGHT.js +2 -1
  24. package/cjs/themes/DARK.js +1 -2
  25. package/dist/vtable.js +244 -175
  26. package/dist/vtable.min.js +2 -2
  27. package/es/core/BaseTable.js +2 -2
  28. package/es/core/BaseTable.js.map +1 -1
  29. package/es/index.d.ts +1 -1
  30. package/es/index.js +1 -1
  31. package/es/index.js.map +1 -1
  32. package/es/layout/pivot-header-layout.d.ts +9 -8
  33. package/es/layout/pivot-header-layout.js +37 -129
  34. package/es/layout/pivot-header-layout.js.map +1 -1
  35. package/es/layout/pivot-layout-helper.d.ts +10 -2
  36. package/es/layout/pivot-layout-helper.js +107 -5
  37. package/es/layout/pivot-layout-helper.js.map +1 -1
  38. package/es/layout/simple-header-layout.d.ts +1 -0
  39. package/es/layout/simple-header-layout.js +5 -7
  40. package/es/layout/simple-header-layout.js.map +1 -1
  41. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  42. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  43. package/es/scenegraph/graphic/group.js +5 -3
  44. package/es/scenegraph/graphic/group.js.map +1 -1
  45. package/es/scenegraph/layout/compute-row-height.js +21 -7
  46. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  47. package/es/scenegraph/style/frame-border.js +9 -7
  48. package/es/scenegraph/style/frame-border.js.map +1 -1
  49. package/es/themes/BRIGHT.js +2 -1
  50. package/es/themes/DARK.js +1 -2
  51. package/package.json +4 -4
package/es/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import type { MousePointerCellEvent } from './ts-types/events';
12
12
  import * as CustomLayout from './render/layout';
13
13
  export { getDataCellPath } from './tools/get-data-path';
14
14
  export * from './render/jsx';
15
- export declare const version = "0.15.5-alpha.1";
15
+ export declare const version = "0.15.5-alpha.3";
16
16
  export { TYPES, core, ListTable, ListTableConstructorOptions, PivotTable, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, IHeaderTreeDefine, IDimension, IIndicator, ITitleDefine, ICornerDefine, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, themes, data, MousePointerCellEvent, getIcons, clearGlobal, register, DataStatistics, CustomLayout };
17
17
  declare function getIcons(): {
18
18
  [key: string]: TYPES.ColumnIconOption;
package/es/index.js CHANGED
@@ -24,7 +24,7 @@ export { getDataCellPath } from "./tools/get-data-path";
24
24
 
25
25
  export * from "./render/jsx";
26
26
 
27
- export const version = "0.15.5-alpha.1";
27
+ export const version = "0.15.5-alpha.3";
28
28
 
29
29
  export { TYPES, core, ListTable, PivotTable, PivotChart, themes, data, getIcons, clearGlobal, register, DataStatistics, CustomLayout };
30
30
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAC;AAsB3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAIxC,OAAO,EAKL,KAAK,EACL,IAAI,EACJ,SAAS,EAET,UAAU,EAGV,UAAU,EAiBV,MAAM,EACN,IAAI,EAEJ,QAAQ,EACR,WAAW,EAEX,QAAQ,EAIR,cAAc,EACd,YAAY,EACb,CAAC;AAGF,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AACD,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\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 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 { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.15.5-alpha.1\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\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 themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\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"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAC;AAsB3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAIxC,OAAO,EAKL,KAAK,EACL,IAAI,EACJ,SAAS,EAET,UAAU,EAGV,UAAU,EAiBV,MAAM,EACN,IAAI,EAEJ,QAAQ,EACR,WAAW,EAEX,QAAQ,EAIR,cAAc,EACd,YAAY,EACb,CAAC;AAGF,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AACD,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\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 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 { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.15.5-alpha.3\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\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 themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\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"]}
@@ -2,13 +2,14 @@ import type { CellAddress, CellRange, IPivotTableCellHeaderPaths, LayoutObjectId
2
2
  import type { HeaderData, IndicatorData, LayoutMapAPI, WidthData } from '../ts-types/list-table/layout-map/api';
3
3
  import type { PivotTable } from '../PivotTable';
4
4
  import type { PivotChart } from '../PivotChart';
5
- import type { LayouTreeNode } from './pivot-layout-helper';
5
+ import type { LayouTreeNode, IPivotLayoutHeadNode } from './pivot-layout-helper';
6
6
  import { DimensionTree } from './pivot-layout-helper';
7
7
  import type { Dataset } from '../dataset/dataset';
8
- export declare const sharedVar: {
9
- seqId: number;
10
- };
11
8
  export declare class PivotHeaderLayoutMap implements LayoutMapAPI {
9
+ sharedVar: {
10
+ seqId: number;
11
+ };
12
+ colIndex: number;
12
13
  _showHeader: boolean;
13
14
  rowDimensionTree: DimensionTree;
14
15
  columnDimensionTree: DimensionTree;
@@ -28,9 +29,9 @@ export declare class PivotHeaderLayoutMap implements LayoutMapAPI {
28
29
  columnsDefine: (IColumnDimension | string)[];
29
30
  indicatorsDefine: (IIndicator | string)[];
30
31
  columnPaths: number[][];
31
- private _headerObjects;
32
+ _headerObjects: HeaderData[];
32
33
  private _headerObjectMap;
33
- private _indicators;
34
+ _indicators: IndicatorData[];
34
35
  indicatorTitle: string;
35
36
  indicatorsAsCol: boolean;
36
37
  hideIndicatorName: boolean;
@@ -64,8 +65,8 @@ export declare class PivotHeaderLayoutMap implements LayoutMapAPI {
64
65
  _chartItemBandSize: number;
65
66
  _chartPadding?: number | number[];
66
67
  constructor(table: PivotTable | PivotChart, dataset: Dataset);
67
- private _addHeaders;
68
- private _addHeadersForTreeMode;
68
+ _addHeaders(_headerCellIds: number[][], row: number, header: IPivotLayoutHeadNode[], roots: number[]): HeaderData[];
69
+ _addHeadersForTreeMode(_headerCellIds: number[][], row: number, header: IPivotLayoutHeadNode[], roots: number[], totalLevel: number, show: boolean, dimensions: (IDimension | string)[]): HeaderData[];
69
70
  private _addCornerHeaders;
70
71
  private generateExtensionRowTree;
71
72
  private setColumnWidths;
@@ -8,7 +8,7 @@ import { diffCellAddress } from "../tools/diff-cell";
8
8
 
9
9
  import { getChartAxes, getChartDataId, getChartSpec, getRawChartSpec } from "./chart-helper/get-chart-spec";
10
10
 
11
- import { DimensionTree, countLayoutTree, generateLayoutTree } from "./pivot-layout-helper";
11
+ import { DimensionTree, countLayoutTree, dealHeader, dealHeaderForTreeMode, generateLayoutTree } from "./pivot-layout-helper";
12
12
 
13
13
  import { cloneDeep, isArray, isValid } from "@visactor/vutils";
14
14
 
@@ -16,12 +16,6 @@ import { getQuadProps } from "../scenegraph/utils/padding";
16
16
 
17
17
  import { getAxisConfigInPivotChart } from "./chart-helper/get-axis-config";
18
18
 
19
- export const sharedVar = {
20
- seqId: 0
21
- };
22
-
23
- let colIndex = 0;
24
-
25
19
  const defaultDimension = {
26
20
  startInTotal: 0,
27
21
  level: 0
@@ -30,7 +24,7 @@ const defaultDimension = {
30
24
  export class PivotHeaderLayoutMap {
31
25
  constructor(table, dataset) {
32
26
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
33
- if (this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
27
+ if (this.colIndex = 0, this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
34
28
  this._cornerHeaderCellIds = [], this._columnHeaderCellIds = [], this._rowHeaderCellIds = [],
35
29
  this._rowHeaderCellIds_FULL = [], this._columnWidths = [], this.columnPaths = [],
36
30
  this._headerObjects = [], this._headerObjectMap = {}, this._indicators = [], this.indicatorsAsCol = !0,
@@ -38,7 +32,9 @@ export class PivotHeaderLayoutMap {
38
32
  this._indicatorShowType = "column", this.rowDimensionKeys = [], this.colDimensionKeys = [],
39
33
  this.indicatorKeys = [], this.indicatorDimensionKey = IndicatorDimensionKeyPlaceholder,
40
34
  this._rowHeaderExtensionTree = {}, this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [],
41
- this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
35
+ this.sharedVar = {
36
+ seqId: 0
37
+ }, this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
42
38
  this.dataset = dataset, this._CellHeaderPathMap = new Map, this.rowTree = table.internalProps.rowTree,
43
39
  this.columnTree = table.internalProps.columnTree, this.rowsDefine = null !== (_a = table.internalProps.rows) && void 0 !== _a ? _a : [],
44
40
  this.columnsDefine = null !== (_b = table.internalProps.columns) && void 0 !== _b ? _b : [],
@@ -71,13 +67,13 @@ export class PivotHeaderLayoutMap {
71
67
  }
72
68
  if (null === (_o = this.indicatorsDefine) || void 0 === _o || _o.forEach((indicator => {
73
69
  "string" == typeof indicator ? this.indicatorKeys.push(indicator) : this.indicatorKeys.push(indicator.indicatorKey);
74
- })), this.columnDimensionTree = new DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : []),
75
- this.rowDimensionTree = new DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
70
+ })), this.columnDimensionTree = new DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : [], this.sharedVar),
71
+ this.rowDimensionTree = new DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
76
72
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr(), this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(),
77
73
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
78
74
  this.resetRowHeaderLevelCount(), (null === (_r = this.columnDimensionTree.tree.children) || void 0 === _r ? void 0 : _r.length) >= 1 && (this.columnHeaderObjs = this._addHeaders(this._columnHeaderCellIds, 0, this.columnDimensionTree.tree.children, [])),
79
75
  this.columnHeaderTitle) {
80
- const id = ++sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
76
+ const id = ++this.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
81
77
  this._columnHeaderCellIds.unshift(firstRowIds);
82
78
  const cell = {
83
79
  id: id,
@@ -91,9 +87,9 @@ export class PivotHeaderLayoutMap {
91
87
  };
92
88
  this.columnHeaderObjs.push(cell), this._headerObjects[id] = cell;
93
89
  }
94
- if (colIndex = 0, (null === (_t = this.rowDimensionTree.tree.children) || void 0 === _t ? void 0 : _t.length) >= 1 && (this.rowHeaderObjs = "tree" === this.rowHierarchyType ? this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine) : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [])),
90
+ if (this.colIndex = 0, (null === (_t = this.rowDimensionTree.tree.children) || void 0 === _t ? void 0 : _t.length) >= 1 && (this.rowHeaderObjs = "tree" === this.rowHierarchyType ? this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine) : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [])),
95
91
  this.rowHeaderTitle) {
96
- const id = ++sharedVar.seqId, firstColIds = Array(null !== (_v = null === (_u = this._rowHeaderCellIds_FULL[0]) || void 0 === _u ? void 0 : _u.length) && void 0 !== _v ? _v : this.rowDimensionTree.tree.size).fill(id);
92
+ const id = ++this.sharedVar.seqId, firstColIds = Array(null !== (_v = null === (_u = this._rowHeaderCellIds_FULL[0]) || void 0 === _u ? void 0 : _u.length) && void 0 !== _v ? _v : this.rowDimensionTree.tree.size).fill(id);
97
93
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
98
94
  const cell = {
99
95
  id: id,
@@ -123,7 +119,7 @@ export class PivotHeaderLayoutMap {
123
119
  const extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []);
124
120
  this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
125
121
  } else this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(this.rowDimensionKeys) : this.rowDimensionKeys, this.rowsDefine); else this.cornerHeaderObjs = this._addCornerHeaders(null, void 0);
126
- colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
122
+ this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
127
123
  o)), {}), this.indicatorsAsCol && !this.hideIndicatorName ? this._indicatorShowType = "column" : this.indicatorsAsCol || this.hideIndicatorName ? this._indicatorShowType = "none" : this._indicatorShowType = "row",
128
124
  this.setPagination(table.options.pagination), this._table.isPivotChart() && (this._chartItemSpanSize = 0,
129
125
  this._chartItemBandSize = 0, this._indicators.find((indicatorObject => {
@@ -139,126 +135,41 @@ export class PivotHeaderLayoutMap {
139
135
  }))), this.setColumnWidths();
140
136
  }
141
137
  _addHeaders(_headerCellIds, row, header, roots) {
138
+ const _this = this;
142
139
  const results = [];
143
- return _headerCellIds[row] || function(row) {
140
+ _headerCellIds[row] || function(row) {
144
141
  const newRow = _headerCellIds[row] = [];
145
- if (0 === colIndex) return newRow;
142
+ if (0 === _this.colIndex) return newRow;
146
143
  const prev = _headerCellIds[row - 1];
147
144
  for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
148
- }(row), header.forEach((hd => {
149
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
150
- const id = hd.id, dimensionInfo = null !== (_b = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey))) && void 0 !== _b ? _b : null === (_c = this.columnsDefine) || void 0 === _c ? void 0 : _c.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), indicatorInfo = null === (_d = this.indicatorsDefine) || void 0 === _d ? void 0 : _d.find((indicator => "string" != typeof indicator && (hd.indicatorKey ? indicator.indicatorKey === hd.indicatorKey : indicator.title === hd.value))), cell = {
151
- id: id,
152
- title: null !== (_e = hd.value) && void 0 !== _e ? _e : null == indicatorInfo ? void 0 : indicatorInfo.title,
153
- field: hd.dimensionKey,
154
- style: "function" == typeof (null === (_f = null != indicatorInfo ? indicatorInfo : dimensionInfo) || void 0 === _f ? void 0 : _f.headerStyle) ? null === (_g = null != indicatorInfo ? indicatorInfo : dimensionInfo) || void 0 === _g ? void 0 : _g.headerStyle : Object.assign({}, null === (_h = null != indicatorInfo ? indicatorInfo : dimensionInfo) || void 0 === _h ? void 0 : _h.headerStyle),
155
- headerType: null !== (_k = null !== (_j = null == indicatorInfo ? void 0 : indicatorInfo.headerType) && void 0 !== _j ? _j : null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _k ? _k : "text",
156
- headerIcon: null !== (_l = null == indicatorInfo ? void 0 : indicatorInfo.headerIcon) && void 0 !== _l ? _l : null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
157
- define: Object.assign({}, hd, null != indicatorInfo ? indicatorInfo : dimensionInfo),
158
- fieldFormat: null !== (_m = null == indicatorInfo ? void 0 : indicatorInfo.headerFormat) && void 0 !== _m ? _m : null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
159
- dropDownMenu: null !== (_o = null == indicatorInfo ? void 0 : indicatorInfo.dropDownMenu) && void 0 !== _o ? _o : null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
160
- pivotInfo: {
161
- value: hd.value,
162
- dimensionKey: hd.dimensionKey,
163
- isPivotCorner: !1
164
- },
165
- width: null == dimensionInfo ? void 0 : dimensionInfo.width,
166
- minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
167
- maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
168
- showSort: null !== (_p = null == indicatorInfo ? void 0 : indicatorInfo.showSort) && void 0 !== _p ? _p : null == dimensionInfo ? void 0 : dimensionInfo.showSort,
169
- description: null == dimensionInfo ? void 0 : dimensionInfo.description
170
- };
171
- indicatorInfo ? (indicatorInfo.customRender && (hd.customRender = indicatorInfo.customRender),
172
- isValid(null === (_q = this._indicators) || void 0 === _q ? void 0 : _q.find((indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) || null === (_r = this._indicators) || void 0 === _r || _r.push({
173
- id: ++sharedVar.seqId,
174
- indicatorKey: indicatorInfo.indicatorKey,
175
- field: indicatorInfo.indicatorKey,
176
- fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
177
- cellType: null !== (_t = null !== (_s = null == indicatorInfo ? void 0 : indicatorInfo.cellType) && void 0 !== _s ? _s : null == indicatorInfo ? void 0 : indicatorInfo.columnType) && void 0 !== _t ? _t : "text",
178
- chartModule: "chartModule" in indicatorInfo ? indicatorInfo.chartModule : null,
179
- chartSpec: "chartSpec" in indicatorInfo ? indicatorInfo.chartSpec : null,
180
- sparklineSpec: "sparklineSpec" in indicatorInfo ? indicatorInfo.sparklineSpec : null,
181
- style: null == indicatorInfo ? void 0 : indicatorInfo.style,
182
- icon: null == indicatorInfo ? void 0 : indicatorInfo.icon,
183
- define: Object.assign({}, hd, indicatorInfo, {
184
- dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
185
- }),
186
- width: null == indicatorInfo ? void 0 : indicatorInfo.width,
187
- minWidth: null == indicatorInfo ? void 0 : indicatorInfo.minWidth,
188
- maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
189
- disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
190
- })) : hd.indicatorKey && (isValid(null === (_u = this._indicators) || void 0 === _u ? void 0 : _u.find((indicator => indicator.indicatorKey === hd.indicatorKey))) || null === (_v = this._indicators) || void 0 === _v || _v.push({
191
- id: ++sharedVar.seqId,
192
- indicatorKey: hd.indicatorKey,
193
- field: hd.indicatorKey,
194
- cellType: "text",
195
- define: Object.assign({}, hd)
196
- })), results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
197
- for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
198
- if ((null === (_w = hd.children) || void 0 === _w ? void 0 : _w.length) >= 1) this._addHeaders(_headerCellIds, row + 1, null !== (_x = hd.children) && void 0 !== _x ? _x : [], [ ...roots, id ]).forEach((c => results.push(c))); else {
199
- for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
200
- colIndex++;
201
- }
202
- })), results;
145
+ }(row);
146
+ for (let i = 0; i < header.length; i++) {
147
+ const hd = header[i];
148
+ dealHeader(hd, _headerCellIds, results, roots, row, this);
149
+ }
150
+ return results;
203
151
  }
204
152
  _addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
153
+ const _this = this;
205
154
  const results = [];
206
- return _headerCellIds[row] || function(row) {
155
+ _headerCellIds[row] || function(row) {
207
156
  const newRow = _headerCellIds[row] = [];
208
- if (0 === colIndex) return newRow;
157
+ if (0 === _this.colIndex) return newRow;
209
158
  const prev = _headerCellIds[row - 1];
210
159
  for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
211
- }(row), header.forEach((hd => {
212
- var _a, _b, _c, _d;
213
- const id = hd.id, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), cell = {
214
- id: id,
215
- title: hd.value,
216
- field: hd.dimensionKey,
217
- style: hd.level + 1 === totalLevel || "function" == typeof (null == dimensionInfo ? void 0 : dimensionInfo.headerStyle) ? null == dimensionInfo ? void 0 : dimensionInfo.headerStyle : Object.assign({}, null == dimensionInfo ? void 0 : dimensionInfo.headerStyle, {
218
- textAlign: "left"
219
- }),
220
- headerType: null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _a ? _a : "text",
221
- headerIcon: null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
222
- define: Object.assign(hd, {
223
- linkJump: null == dimensionInfo ? void 0 : dimensionInfo.linkJump,
224
- linkDetect: null == dimensionInfo ? void 0 : dimensionInfo.linkDetect,
225
- templateLink: null == dimensionInfo ? void 0 : dimensionInfo.templateLink,
226
- keepAspectRatio: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.keepAspectRatio) && void 0 !== _b && _b,
227
- imageAutoSizing: null == dimensionInfo ? void 0 : dimensionInfo.imageAutoSizing,
228
- headerCustomRender: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomRender,
229
- headerCustomLayout: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomLayout,
230
- dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
231
- }),
232
- fieldFormat: null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
233
- dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
234
- pivotInfo: {
235
- value: hd.value,
236
- dimensionKey: hd.dimensionKey,
237
- isPivotCorner: !1
238
- },
239
- hierarchyLevel: hd.level,
240
- dimensionTotalLevel: totalLevel,
241
- hierarchyState: hd.level + 1 === totalLevel ? void 0 : hd.hierarchyState,
242
- width: null == dimensionInfo ? void 0 : dimensionInfo.width,
243
- minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
244
- maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
245
- parentCellId: roots[roots.length - 1]
246
- };
247
- results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
248
- for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
249
- if (hd.hierarchyState === HierarchyState.expand && (null === (_c = hd.children) || void 0 === _c ? void 0 : _c.length) >= 1) show && colIndex++,
250
- this._addHeadersForTreeMode(_headerCellIds, row, null !== (_d = hd.children) && void 0 !== _d ? _d : [], [ ...roots, id ], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions).forEach((c => results.push(c))); else {
251
- show && colIndex++;
252
- for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
253
- }
254
- })), results;
160
+ }(row);
161
+ for (let i = 0; i < header.length; i++) {
162
+ const hd = header[i];
163
+ dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this);
164
+ }
165
+ return results;
255
166
  }
256
167
  _addCornerHeaders(dimensionKeys, dimensions) {
257
168
  var _a;
258
169
  const results = [];
259
170
  if (dimensionKeys) dimensionKeys.forEach(((dimensionKey, key) => {
260
171
  var _a, _b;
261
- const id = ++sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
172
+ const id = ++this.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
262
173
  id: id,
263
174
  title: dimensionKey === this.indicatorDimensionKey ? this.indicatorTitle : dimensionInfo ? dimensionInfo.title : "axis" === dimensionKey ? "" : dimensionKey,
264
175
  field: "维度名称",
@@ -283,7 +194,7 @@ export class PivotHeaderLayoutMap {
283
194
  } else if ("row" === this.cornerSetting.titleOnDimension) for (let r = 0; r < this.columnHeaderLevelCount; r++) this._cornerHeaderCellIds[r] || (this._cornerHeaderCellIds[r] = []),
284
195
  this._cornerHeaderCellIds[r][key] = id;
285
196
  })); else {
286
- const id = ++sharedVar.seqId, cell = {
197
+ const id = ++this.sharedVar.seqId, cell = {
287
198
  id: id,
288
199
  title: "",
289
200
  field: "维度名称",
@@ -307,7 +218,7 @@ export class PivotHeaderLayoutMap {
307
218
  this._rowHeaderCellIds_FULL = [], old_rowHeaderCellIds.forEach(((row_ids, index) => {
308
219
  const key = row_ids[row_ids.length - 1];
309
220
  let tree, rowExtensionDimensionTree;
310
- if (colIndex = 0, "function" == typeof extensionRow.rowTree) {
221
+ if (this.colIndex = 0, "function" == typeof extensionRow.rowTree) {
311
222
  const fullCellIds = this.findFullCellIds(row_ids);
312
223
  tree = extensionRow.rowTree(fullCellIds.map((id => ({
313
224
  dimensionKey: this._headerObjects[id].field,
@@ -315,7 +226,7 @@ export class PivotHeaderLayoutMap {
315
226
  }))));
316
227
  } else tree = cloneDeep(extensionRow.rowTree);
317
228
  this._rowHeaderExtensionTree[key] ? (this._rowHeaderExtensionTree[key].reset(this._rowHeaderExtensionTree[key].tree.children, !0),
318
- rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new DimensionTree(null != tree ? tree : [], this.rowHierarchyType, void 0),
229
+ rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new DimensionTree(null != tree ? tree : [], this.sharedVar, this.rowHierarchyType, void 0),
319
230
  this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree);
320
231
  const extensionRowTreeHeaderIds = [];
321
232
  this._addHeadersForTreeMode(extensionRowTreeHeaderIds, 0, rowExtensionDimensionTree.tree.children, [], rowExtensionDimensionTree.totalLevel, !0, extensionRow.rows);
@@ -804,7 +715,7 @@ export class PivotHeaderLayoutMap {
804
715
  this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._rowHeaderCellIds_FULL = [],
805
716
  this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine),
806
717
  this.rowHeaderTitle) {
807
- const id = ++sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
718
+ const id = ++this.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
808
719
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
809
720
  const cell = {
810
721
  id: id,
@@ -821,7 +732,7 @@ export class PivotHeaderLayoutMap {
821
732
  this.rowHeaderObjs.push(cell), this._headerObjects[id] = cell;
822
733
  }
823
734
  this._rowHeaderCellIds_FULL = transpose(this._rowHeaderCellIds_FULL), "tree" === this.rowHierarchyType && (null === (_b = this.extensionRows) || void 0 === _b ? void 0 : _b.length) >= 1 && this.generateExtensionRowTree(),
824
- colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
735
+ this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
825
736
  o)), {}), this._CellHeaderPathMap = new Map;
826
737
  const diffCell = diffCellAddress(col, row, oldRowHeaderCellIds.map((oldCellId => oldCellId[col])), this._rowHeaderCellIds_FULL.map((newCellId => newCellId[col])), oldRowHeaderCellPositons, this);
827
738
  return this._rowHeaderCellIds = this._rowHeaderCellIds_FULL, diffCell;
@@ -922,11 +833,8 @@ export class PivotHeaderLayoutMap {
922
833
  }
923
834
  getRowHeaderCellAddressByCellId(cellId) {
924
835
  let col, row;
925
- if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => {
926
- const finded = cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
927
- !0)));
928
- return !!finded && (row = rowIndex, !0);
929
- })), isValid(col) && isValid(row)) return {
836
+ if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => !!cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
837
+ !0))) && (row = rowIndex, !0))), isValid(col) && isValid(row)) return {
930
838
  col: col,
931
839
  row: row + this.columnHeaderLevelCount
932
840
  };