@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/cjs/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/cjs/index.js CHANGED
@@ -101,6 +101,6 @@ Object.defineProperty(exports, "getDataCellPath", {
101
101
  get: function() {
102
102
  return get_data_path_1.getDataCellPath;
103
103
  }
104
- }), __exportStar(require("./render/jsx"), exports), exports.version = "0.15.5-alpha.1",
104
+ }), __exportStar(require("./render/jsx"), exports), exports.version = "0.15.5-alpha.3",
105
105
  exports.getIcons = getIcons, exports.clearGlobal = clearGlobal, TYPES.AggregationType;
106
106
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAiDlC,sBAAK;AAhDP,6CAA+B;AAiD7B,oBAAI;AAhDN,6CAA+B;AAwE7B,oBAAI;AAvEN,+CAAiC;AACjC,qDAAuC;AA2ErC,4BAAQ;AA1EV,iDAAmC;AAoEjC,wBAAM;AAnER,yEAA2D;AA6EzD,wCAAc;AAvDhB,2CAAwC;AAuBtC,0FAvBO,qBAAS,OAuBP;AAtBX,6CAA0C;AAwBxC,2FAxBO,uBAAU,OAwBP;AAvBZ,6CAA0C;AA0BxC,2FA1BO,uBAAU,OA0BP;AAxBZ,8DAAgD;AAoD9C,oCAAY;AA/Cd,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAgDxC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAhBC,4BAAQ;AAkBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AArBC,kCAAW;AAsBb,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,kDAAoC;AAiDlC,sBAAK;AAhDP,6CAA+B;AAiD7B,oBAAI;AAhDN,6CAA+B;AAwE7B,oBAAI;AAvEN,+CAAiC;AACjC,qDAAuC;AA2ErC,4BAAQ;AA1EV,iDAAmC;AAoEjC,wBAAM;AAnER,yEAA2D;AA6EzD,wCAAc;AAvDhB,2CAAwC;AAuBtC,0FAvBO,qBAAS,OAuBP;AAtBX,6CAA0C;AAwBxC,2FAxBO,uBAAU,OAwBP;AAvBZ,6CAA0C;AA0BxC,2FA1BO,uBAAU,OA0BP;AAxBZ,8DAAgD;AAoD9C,oCAAY;AA/Cd,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAgDxC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAhBC,4BAAQ;AAkBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AArBC,kCAAW;AAsBb,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;
@@ -2,17 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.PivotHeaderLayoutMap = exports.sharedVar = void 0;
5
+ }), exports.PivotHeaderLayoutMap = void 0;
6
6
 
7
- const util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"), global_1 = require("../tools/global"), diff_cell_1 = require("../tools/diff-cell"), get_chart_spec_1 = require("./chart-helper/get-chart-spec"), pivot_layout_helper_1 = require("./pivot-layout-helper"), vutils_1 = require("@visactor/vutils"), padding_1 = require("../scenegraph/utils/padding"), get_axis_config_1 = require("./chart-helper/get-axis-config");
8
-
9
- exports.sharedVar = {
10
- seqId: 0
11
- };
12
-
13
- let colIndex = 0;
14
-
15
- const defaultDimension = {
7
+ const util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"), global_1 = require("../tools/global"), diff_cell_1 = require("../tools/diff-cell"), get_chart_spec_1 = require("./chart-helper/get-chart-spec"), pivot_layout_helper_1 = require("./pivot-layout-helper"), vutils_1 = require("@visactor/vutils"), padding_1 = require("../scenegraph/utils/padding"), get_axis_config_1 = require("./chart-helper/get-axis-config"), defaultDimension = {
16
8
  startInTotal: 0,
17
9
  level: 0
18
10
  };
@@ -20,7 +12,7 @@ const defaultDimension = {
20
12
  class PivotHeaderLayoutMap {
21
13
  constructor(table, dataset) {
22
14
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
23
- if (this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
15
+ if (this.colIndex = 0, this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
24
16
  this._cornerHeaderCellIds = [], this._columnHeaderCellIds = [], this._rowHeaderCellIds = [],
25
17
  this._rowHeaderCellIds_FULL = [], this._columnWidths = [], this.columnPaths = [],
26
18
  this._headerObjects = [], this._headerObjectMap = {}, this._indicators = [], this.indicatorsAsCol = !0,
@@ -28,7 +20,9 @@ class PivotHeaderLayoutMap {
28
20
  this._indicatorShowType = "column", this.rowDimensionKeys = [], this.colDimensionKeys = [],
29
21
  this.indicatorKeys = [], this.indicatorDimensionKey = global_1.IndicatorDimensionKeyPlaceholder,
30
22
  this._rowHeaderExtensionTree = {}, this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [],
31
- this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
23
+ this.sharedVar = {
24
+ seqId: 0
25
+ }, this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
32
26
  this.dataset = dataset, this._CellHeaderPathMap = new Map, this.rowTree = table.internalProps.rowTree,
33
27
  this.columnTree = table.internalProps.columnTree, this.rowsDefine = null !== (_a = table.internalProps.rows) && void 0 !== _a ? _a : [],
34
28
  this.columnsDefine = null !== (_b = table.internalProps.columns) && void 0 !== _b ? _b : [],
@@ -61,13 +55,13 @@ class PivotHeaderLayoutMap {
61
55
  }
62
56
  if (null === (_o = this.indicatorsDefine) || void 0 === _o || _o.forEach((indicator => {
63
57
  "string" == typeof indicator ? this.indicatorKeys.push(indicator) : this.indicatorKeys.push(indicator.indicatorKey);
64
- })), this.columnDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : []),
65
- this.rowDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
58
+ })), this.columnDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : [], this.sharedVar),
59
+ this.rowDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
66
60
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr(), this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(),
67
61
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
68
62
  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, [])),
69
63
  this.columnHeaderTitle) {
70
- const id = ++exports.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
64
+ const id = ++this.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
71
65
  this._columnHeaderCellIds.unshift(firstRowIds);
72
66
  const cell = {
73
67
  id: id,
@@ -81,9 +75,9 @@ class PivotHeaderLayoutMap {
81
75
  };
82
76
  this.columnHeaderObjs.push(cell), this._headerObjects[id] = cell;
83
77
  }
84
- 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, [])),
78
+ 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, [])),
85
79
  this.rowHeaderTitle) {
86
- const id = ++exports.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);
80
+ 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);
87
81
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
88
82
  const cell = {
89
83
  id: id,
@@ -113,7 +107,7 @@ class PivotHeaderLayoutMap {
113
107
  const extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []);
114
108
  this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
115
109
  } else this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(this.rowDimensionKeys) : this.rowDimensionKeys, this.rowsDefine); else this.cornerHeaderObjs = this._addCornerHeaders(null, void 0);
116
- colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
110
+ this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
117
111
  o)), {}), this.indicatorsAsCol && !this.hideIndicatorName ? this._indicatorShowType = "column" : this.indicatorsAsCol || this.hideIndicatorName ? this._indicatorShowType = "none" : this._indicatorShowType = "row",
118
112
  this.setPagination(table.options.pagination), this._table.isPivotChart() && (this._chartItemSpanSize = 0,
119
113
  this._chartItemBandSize = 0, this._indicators.find((indicatorObject => {
@@ -129,126 +123,41 @@ class PivotHeaderLayoutMap {
129
123
  }))), this.setColumnWidths();
130
124
  }
131
125
  _addHeaders(_headerCellIds, row, header, roots) {
126
+ const _this = this;
132
127
  const results = [];
133
- return _headerCellIds[row] || function(row) {
128
+ _headerCellIds[row] || function(row) {
134
129
  const newRow = _headerCellIds[row] = [];
135
- if (0 === colIndex) return newRow;
130
+ if (0 === _this.colIndex) return newRow;
136
131
  const prev = _headerCellIds[row - 1];
137
132
  for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
138
- }(row), header.forEach((hd => {
139
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
140
- 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 = {
141
- id: id,
142
- title: null !== (_e = hd.value) && void 0 !== _e ? _e : null == indicatorInfo ? void 0 : indicatorInfo.title,
143
- field: hd.dimensionKey,
144
- 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),
145
- 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",
146
- headerIcon: null !== (_l = null == indicatorInfo ? void 0 : indicatorInfo.headerIcon) && void 0 !== _l ? _l : null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
147
- define: Object.assign({}, hd, null != indicatorInfo ? indicatorInfo : dimensionInfo),
148
- fieldFormat: null !== (_m = null == indicatorInfo ? void 0 : indicatorInfo.headerFormat) && void 0 !== _m ? _m : null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
149
- dropDownMenu: null !== (_o = null == indicatorInfo ? void 0 : indicatorInfo.dropDownMenu) && void 0 !== _o ? _o : null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
150
- pivotInfo: {
151
- value: hd.value,
152
- dimensionKey: hd.dimensionKey,
153
- isPivotCorner: !1
154
- },
155
- width: null == dimensionInfo ? void 0 : dimensionInfo.width,
156
- minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
157
- maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
158
- showSort: null !== (_p = null == indicatorInfo ? void 0 : indicatorInfo.showSort) && void 0 !== _p ? _p : null == dimensionInfo ? void 0 : dimensionInfo.showSort,
159
- description: null == dimensionInfo ? void 0 : dimensionInfo.description
160
- };
161
- indicatorInfo ? (indicatorInfo.customRender && (hd.customRender = indicatorInfo.customRender),
162
- (0, vutils_1.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({
163
- id: ++exports.sharedVar.seqId,
164
- indicatorKey: indicatorInfo.indicatorKey,
165
- field: indicatorInfo.indicatorKey,
166
- fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
167
- 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",
168
- chartModule: "chartModule" in indicatorInfo ? indicatorInfo.chartModule : null,
169
- chartSpec: "chartSpec" in indicatorInfo ? indicatorInfo.chartSpec : null,
170
- sparklineSpec: "sparklineSpec" in indicatorInfo ? indicatorInfo.sparklineSpec : null,
171
- style: null == indicatorInfo ? void 0 : indicatorInfo.style,
172
- icon: null == indicatorInfo ? void 0 : indicatorInfo.icon,
173
- define: Object.assign({}, hd, indicatorInfo, {
174
- dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
175
- }),
176
- width: null == indicatorInfo ? void 0 : indicatorInfo.width,
177
- minWidth: null == indicatorInfo ? void 0 : indicatorInfo.minWidth,
178
- maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
179
- disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
180
- })) : hd.indicatorKey && ((0, vutils_1.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({
181
- id: ++exports.sharedVar.seqId,
182
- indicatorKey: hd.indicatorKey,
183
- field: hd.indicatorKey,
184
- cellType: "text",
185
- define: Object.assign({}, hd)
186
- })), results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
187
- for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
188
- 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 {
189
- for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
190
- colIndex++;
191
- }
192
- })), results;
133
+ }(row);
134
+ for (let i = 0; i < header.length; i++) {
135
+ const hd = header[i];
136
+ (0, pivot_layout_helper_1.dealHeader)(hd, _headerCellIds, results, roots, row, this);
137
+ }
138
+ return results;
193
139
  }
194
140
  _addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
141
+ const _this = this;
195
142
  const results = [];
196
- return _headerCellIds[row] || function(row) {
143
+ _headerCellIds[row] || function(row) {
197
144
  const newRow = _headerCellIds[row] = [];
198
- if (0 === colIndex) return newRow;
145
+ if (0 === _this.colIndex) return newRow;
199
146
  const prev = _headerCellIds[row - 1];
200
147
  for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
201
- }(row), header.forEach((hd => {
202
- var _a, _b, _c, _d;
203
- const id = hd.id, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), cell = {
204
- id: id,
205
- title: hd.value,
206
- field: hd.dimensionKey,
207
- 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, {
208
- textAlign: "left"
209
- }),
210
- headerType: null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _a ? _a : "text",
211
- headerIcon: null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
212
- define: Object.assign(hd, {
213
- linkJump: null == dimensionInfo ? void 0 : dimensionInfo.linkJump,
214
- linkDetect: null == dimensionInfo ? void 0 : dimensionInfo.linkDetect,
215
- templateLink: null == dimensionInfo ? void 0 : dimensionInfo.templateLink,
216
- keepAspectRatio: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.keepAspectRatio) && void 0 !== _b && _b,
217
- imageAutoSizing: null == dimensionInfo ? void 0 : dimensionInfo.imageAutoSizing,
218
- headerCustomRender: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomRender,
219
- headerCustomLayout: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomLayout,
220
- dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
221
- }),
222
- fieldFormat: null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
223
- dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
224
- pivotInfo: {
225
- value: hd.value,
226
- dimensionKey: hd.dimensionKey,
227
- isPivotCorner: !1
228
- },
229
- hierarchyLevel: hd.level,
230
- dimensionTotalLevel: totalLevel,
231
- hierarchyState: hd.level + 1 === totalLevel ? void 0 : hd.hierarchyState,
232
- width: null == dimensionInfo ? void 0 : dimensionInfo.width,
233
- minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
234
- maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
235
- parentCellId: roots[roots.length - 1]
236
- };
237
- results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
238
- for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
239
- if (hd.hierarchyState === ts_types_1.HierarchyState.expand && (null === (_c = hd.children) || void 0 === _c ? void 0 : _c.length) >= 1) show && colIndex++,
240
- this._addHeadersForTreeMode(_headerCellIds, row, null !== (_d = hd.children) && void 0 !== _d ? _d : [], [ ...roots, id ], totalLevel, show && hd.hierarchyState === ts_types_1.HierarchyState.expand, dimensions).forEach((c => results.push(c))); else {
241
- show && colIndex++;
242
- for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
243
- }
244
- })), results;
148
+ }(row);
149
+ for (let i = 0; i < header.length; i++) {
150
+ const hd = header[i];
151
+ (0, pivot_layout_helper_1.dealHeaderForTreeMode)(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this);
152
+ }
153
+ return results;
245
154
  }
246
155
  _addCornerHeaders(dimensionKeys, dimensions) {
247
156
  var _a;
248
157
  const results = [];
249
158
  if (dimensionKeys) dimensionKeys.forEach(((dimensionKey, key) => {
250
159
  var _a, _b;
251
- const id = ++exports.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
160
+ const id = ++this.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
252
161
  id: id,
253
162
  title: dimensionKey === this.indicatorDimensionKey ? this.indicatorTitle : dimensionInfo ? dimensionInfo.title : "axis" === dimensionKey ? "" : dimensionKey,
254
163
  field: "维度名称",
@@ -273,7 +182,7 @@ class PivotHeaderLayoutMap {
273
182
  } else if ("row" === this.cornerSetting.titleOnDimension) for (let r = 0; r < this.columnHeaderLevelCount; r++) this._cornerHeaderCellIds[r] || (this._cornerHeaderCellIds[r] = []),
274
183
  this._cornerHeaderCellIds[r][key] = id;
275
184
  })); else {
276
- const id = ++exports.sharedVar.seqId, cell = {
185
+ const id = ++this.sharedVar.seqId, cell = {
277
186
  id: id,
278
187
  title: "",
279
188
  field: "维度名称",
@@ -297,7 +206,7 @@ class PivotHeaderLayoutMap {
297
206
  this._rowHeaderCellIds_FULL = [], old_rowHeaderCellIds.forEach(((row_ids, index) => {
298
207
  const key = row_ids[row_ids.length - 1];
299
208
  let tree, rowExtensionDimensionTree;
300
- if (colIndex = 0, "function" == typeof extensionRow.rowTree) {
209
+ if (this.colIndex = 0, "function" == typeof extensionRow.rowTree) {
301
210
  const fullCellIds = this.findFullCellIds(row_ids);
302
211
  tree = extensionRow.rowTree(fullCellIds.map((id => ({
303
212
  dimensionKey: this._headerObjects[id].field,
@@ -305,7 +214,7 @@ class PivotHeaderLayoutMap {
305
214
  }))));
306
215
  } else tree = (0, vutils_1.cloneDeep)(extensionRow.rowTree);
307
216
  this._rowHeaderExtensionTree[key] ? (this._rowHeaderExtensionTree[key].reset(this._rowHeaderExtensionTree[key].tree.children, !0),
308
- rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new pivot_layout_helper_1.DimensionTree(null != tree ? tree : [], this.rowHierarchyType, void 0),
217
+ rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new pivot_layout_helper_1.DimensionTree(null != tree ? tree : [], this.sharedVar, this.rowHierarchyType, void 0),
309
218
  this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree);
310
219
  const extensionRowTreeHeaderIds = [];
311
220
  this._addHeadersForTreeMode(extensionRowTreeHeaderIds, 0, rowExtensionDimensionTree.tree.children, [], rowExtensionDimensionTree.totalLevel, !0, extensionRow.rows);
@@ -794,7 +703,7 @@ class PivotHeaderLayoutMap {
794
703
  this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._rowHeaderCellIds_FULL = [],
795
704
  this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine),
796
705
  this.rowHeaderTitle) {
797
- const id = ++exports.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
706
+ const id = ++this.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
798
707
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
799
708
  const cell = {
800
709
  id: id,
@@ -812,7 +721,7 @@ class PivotHeaderLayoutMap {
812
721
  }
813
722
  this._rowHeaderCellIds_FULL = (0, util_1.transpose)(this._rowHeaderCellIds_FULL),
814
723
  "tree" === this.rowHierarchyType && (null === (_b = this.extensionRows) || void 0 === _b ? void 0 : _b.length) >= 1 && this.generateExtensionRowTree(),
815
- colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
724
+ this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
816
725
  o)), {}), this._CellHeaderPathMap = new Map;
817
726
  const diffCell = (0, diff_cell_1.diffCellAddress)(col, row, oldRowHeaderCellIds.map((oldCellId => oldCellId[col])), this._rowHeaderCellIds_FULL.map((newCellId => newCellId[col])), oldRowHeaderCellPositons, this);
818
727
  return this._rowHeaderCellIds = this._rowHeaderCellIds_FULL, diffCell;
@@ -915,11 +824,8 @@ class PivotHeaderLayoutMap {
915
824
  }
916
825
  getRowHeaderCellAddressByCellId(cellId) {
917
826
  let col, row;
918
- if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => {
919
- const finded = cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
920
- !0)));
921
- return !!finded && (row = rowIndex, !0);
922
- })), (0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) return {
827
+ if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => !!cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
828
+ !0))) && (row = rowIndex, !0))), (0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) return {
923
829
  col: col,
924
830
  row: row + this.columnHeaderLevelCount
925
831
  };