@visactor/vtable 1.2.0 → 1.2.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/cjs/PivotChart.d.ts +1 -5
  2. package/cjs/PivotChart.js +7 -30
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/PivotTable.d.ts +7 -2
  5. package/cjs/PivotTable.js +85 -17
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.js +5 -5
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/header-helper/header-helper.d.ts +1 -0
  10. package/cjs/header-helper/header-helper.js +12 -2
  11. package/cjs/header-helper/header-helper.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +2 -2
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/layout/pivot-header-layout.js +26 -8
  16. package/cjs/layout/pivot-header-layout.js.map +1 -1
  17. package/cjs/layout/tree-helper.js +4 -1
  18. package/cjs/layout/tree-helper.js.map +1 -1
  19. package/cjs/state/state.js +2 -2
  20. package/cjs/state/state.js.map +1 -1
  21. package/cjs/themes/theme.js +1 -1
  22. package/cjs/themes/theme.js.map +1 -1
  23. package/cjs/ts-types/common.d.ts +4 -13
  24. package/cjs/ts-types/common.js.map +1 -1
  25. package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -1
  26. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  27. package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +3 -1
  28. package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  29. package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -0
  30. package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  31. package/cjs/ts-types/table-engine.d.ts +4 -1
  32. package/cjs/ts-types/table-engine.js.map +1 -1
  33. package/cjs/vrender.js.map +1 -1
  34. package/dist/vtable.js +229 -64
  35. package/dist/vtable.min.js +2 -2
  36. package/es/PivotChart.d.ts +1 -5
  37. package/es/PivotChart.js +6 -31
  38. package/es/PivotChart.js.map +1 -1
  39. package/es/PivotTable.d.ts +7 -2
  40. package/es/PivotTable.js +87 -19
  41. package/es/PivotTable.js.map +1 -1
  42. package/es/core/BaseTable.js +5 -5
  43. package/es/core/BaseTable.js.map +1 -1
  44. package/es/header-helper/header-helper.d.ts +1 -0
  45. package/es/header-helper/header-helper.js +12 -2
  46. package/es/header-helper/header-helper.js.map +1 -1
  47. package/es/index.d.ts +1 -1
  48. package/es/index.js +1 -1
  49. package/es/index.js.map +1 -1
  50. package/es/layout/pivot-header-layout.js +26 -8
  51. package/es/layout/pivot-header-layout.js.map +1 -1
  52. package/es/layout/tree-helper.js +4 -1
  53. package/es/layout/tree-helper.js.map +1 -1
  54. package/es/state/state.js +2 -2
  55. package/es/state/state.js.map +1 -1
  56. package/es/themes/theme.js +1 -1
  57. package/es/themes/theme.js.map +1 -1
  58. package/es/ts-types/common.d.ts +4 -13
  59. package/es/ts-types/common.js.map +1 -1
  60. package/es/ts-types/list-table/layout-map/api.d.ts +2 -1
  61. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  62. package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +3 -1
  63. package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  64. package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -0
  65. package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  66. package/es/ts-types/table-engine.d.ts +4 -1
  67. package/es/ts-types/table-engine.js.map +1 -1
  68. package/es/vrender.js.map +1 -1
  69. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vrender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAIhC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IACD,QAAQ,GAAG,IAAI,CAAC;IAEhB,IAAA,+BAAgB,GAAE,CAAC;IAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;QAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;KAC3B;SAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;QACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;KACxB;IACD,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,gCAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,iCAAkB,GAAE,CAAC;IACrB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;AACrB,CAAC;AA/BD,gDA+BC;AAED,yDAAuC;AACvC,yDAAuC","file":"vrender.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\n// export const version = \"1.2.0\";\n\nlet registed = false;\nexport function registerForVrender() {\n if (registed) {\n return;\n }\n registed = true;\n // 注册内置组件\n preLoadAllModule();\n\n if (isBrowserEnv()) {\n loadBrowserEnv(container);\n } else if (isNodeEnv()) {\n loadNodeEnv(container);\n }\n registerArc();\n registerArc3d();\n registerArea();\n registerCircle();\n registerGlyph();\n registerGroup();\n registerImage();\n registerLine();\n registerPath();\n registerPolygon();\n registerPyramid3d();\n registerRect();\n registerRect3d();\n registerRichtext();\n registerShadowRoot();\n registerSymbol();\n registerText();\n registerWrapText();\n}\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/vrender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAIhC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IACD,QAAQ,GAAG,IAAI,CAAC;IAEhB,IAAA,+BAAgB,GAAE,CAAC;IAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;QAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;KAC3B;SAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;QACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;KACxB;IACD,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,gCAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,iCAAkB,GAAE,CAAC;IACrB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;AACrB,CAAC;AA/BD,gDA+BC;AAED,yDAAuC;AACvC,yDAAuC","file":"vrender.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\n// export const version = \"1.2.1-alpha.0\";\n\nlet registed = false;\nexport function registerForVrender() {\n if (registed) {\n return;\n }\n registed = true;\n // 注册内置组件\n preLoadAllModule();\n\n if (isBrowserEnv()) {\n loadBrowserEnv(container);\n } else if (isNodeEnv()) {\n loadNodeEnv(container);\n }\n registerArc();\n registerArc3d();\n registerArea();\n registerCircle();\n registerGlyph();\n registerGroup();\n registerImage();\n registerLine();\n registerPath();\n registerPolygon();\n registerPyramid3d();\n registerRect();\n registerRect3d();\n registerRichtext();\n registerShadowRoot();\n registerSymbol();\n registerText();\n registerWrapText();\n}\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/vtable.js CHANGED
@@ -25209,7 +25209,7 @@
25209
25209
  return hasThemeProperty(obj, names) || hasThemeProperty(superTheme, names);
25210
25210
  }
25211
25211
  extends(obj) {
25212
- return new TableTheme(obj, this);
25212
+ return new TableTheme(obj, this.internalTheme.superTheme || this.internalTheme.obj);
25213
25213
  }
25214
25214
  getStyle(style) {
25215
25215
  const that = this;
@@ -52705,7 +52705,10 @@
52705
52705
  }
52706
52706
  triggerSort(col, row, iconMark, event) {
52707
52707
  if (this.table.isPivotTable()) {
52708
- const order = this.table.getPivotSortState(col, row);
52708
+ const sortState = this.table.getPivotSortState(col, row);
52709
+ const order = sortState ? sortState.toUpperCase() : 'DESC';
52710
+ const new_order = order === 'ASC' ? 'DESC' : 'ASC';
52711
+ this.table.sort(col, row, new_order);
52709
52712
  this.table.fireListeners(PIVOT_TABLE_EVENT_TYPE.PIVOT_SORT_CLICK, {
52710
52713
  col: col,
52711
52714
  row: row,
@@ -56064,10 +56067,19 @@
56064
56067
  getIcons(col, row) {
56065
56068
  const icons = [];
56066
56069
  if (this._table.isPivotTable()) {
56067
- const { showSort } = this._table.internalProps.layoutMap.getHeader(col, row);
56070
+ const { showSort, sort } = this._table.internalProps.layoutMap.getHeader(col, row);
56068
56071
  if (showSort) {
56069
- const order = this._table.getPivotSortState(col, row);
56070
- const sortIcon = order === 'asc' ? this.downIcon : order === 'desc' ? this.upIcon : this.normalIcon;
56072
+ let order = this._table.getPivotSortState(col, row);
56073
+ if (order) {
56074
+ order = order.toUpperCase();
56075
+ }
56076
+ const sortIcon = order === 'ASC' ? this.downIcon : order === 'DESC' ? this.upIcon : this.normalIcon;
56077
+ if (sortIcon) {
56078
+ icons.push(sortIcon);
56079
+ }
56080
+ }
56081
+ else if (sort) {
56082
+ const sortIcon = this.getSortIconForPivotTable(this._table.getPivotSortState(col, row), this._table, col, row);
56071
56083
  if (sortIcon) {
56072
56084
  icons.push(sortIcon);
56073
56085
  }
@@ -56190,6 +56202,17 @@
56190
56202
  }
56191
56203
  return icon;
56192
56204
  }
56205
+ getSortIconForPivotTable(order, _table, col, row) {
56206
+ const headerC = _table.getHeaderDefine(col, row);
56207
+ if (!headerC ||
56208
+ headerC.showSort === false ||
56209
+ (!isValid$1(headerC.showSort) && !headerC.sort) ||
56210
+ (headerC.columns && headerC.columns.length > 0)) {
56211
+ return null;
56212
+ }
56213
+ const icon = order === 'ASC' ? this.downIcon : order === 'DESC' ? this.upIcon : this.normalIcon;
56214
+ return icon;
56215
+ }
56193
56216
  getDropDownStateIcons(_table, col, row) {
56194
56217
  const headerC = _table.getHeaderDefine(col, row);
56195
56218
  const headerL = _table._getHeaderLayoutMap(col, row);
@@ -58616,7 +58639,7 @@
58616
58639
  : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
58617
58640
  headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
58618
58641
  headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
58619
- define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
58642
+ define: Object.assign({}, hd, indicatorInfo ?? Object.assign({}, dimensionInfo, { sort: undefined })),
58620
58643
  fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
58621
58644
  dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
58622
58645
  pivotInfo: {
@@ -58628,6 +58651,7 @@
58628
58651
  minWidth: dimensionInfo?.minWidth,
58629
58652
  maxWidth: dimensionInfo?.maxWidth,
58630
58653
  showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
58654
+ sort: indicatorInfo?.sort,
58631
58655
  description: dimensionInfo?.description
58632
58656
  };
58633
58657
  if (indicatorInfo) {
@@ -59044,7 +59068,7 @@
59044
59068
  return TABLE_EVENT_TYPE;
59045
59069
  }
59046
59070
  options;
59047
- version = "1.2.0";
59071
+ version = "1.2.1-alpha.0";
59048
59072
  pagination;
59049
59073
  id = `VTable${Date.now()}`;
59050
59074
  headerStyleCache;
@@ -60248,6 +60272,7 @@
60248
60272
  IconCache.clearAll();
60249
60273
  super.release?.();
60250
60274
  internalProps.handler?.release?.();
60275
+ this.eventManager.release();
60251
60276
  internalProps.focusControl?.release?.();
60252
60277
  internalProps.legends?.forEach(legend => {
60253
60278
  legend?.release();
@@ -60269,6 +60294,8 @@
60269
60294
  }
60270
60295
  this.editorManager?.editingEditor?.onEnd?.();
60271
60296
  this.isReleased = true;
60297
+ this.scenegraph = null;
60298
+ this.internalProps = null;
60272
60299
  }
60273
60300
  fireListeners(type, event) {
60274
60301
  return super.fireListeners(type, event);
@@ -60966,8 +60993,11 @@
60966
60993
  let cacheKey;
60967
60994
  if (this.isPivotTable() && !this.isBottomFrozenRow(row) && !this.isRightFrozenColumn(col)) {
60968
60995
  const define = this.getHeaderDefine(col, row);
60996
+ const isCorner = this.isCornerHeader(col, row);
60969
60997
  cacheKey = define?.dimensionKey
60970
- ? `dim-${define.dimensionKey}`
60998
+ ? isCorner
60999
+ ? `dim-cor-${define.dimensionKey}`
61000
+ : `dim-${define.dimensionKey}`
60971
61001
  : define?.indicatorKey
60972
61002
  ? `ind-${define.indicatorKey}`
60973
61003
  : `${col}-${row}`;
@@ -65731,11 +65761,15 @@
65731
65761
  : dimensionKey === 'axis'
65732
65762
  ? ''
65733
65763
  : dimensionKey,
65734
- field: '维度名称',
65764
+ field: dimensionKey,
65735
65765
  style: this.cornerSetting.headerStyle,
65736
65766
  headerType: this.cornerSetting.headerType ?? 'text',
65767
+ showSort: dimensionInfo?.showSortInCorner,
65768
+ sort: dimensionInfo?.sort,
65737
65769
  define: {
65738
- dimensionKey: '维度名称',
65770
+ showSort: dimensionInfo?.showSortInCorner,
65771
+ sort: dimensionInfo?.sort,
65772
+ dimensionKey: dimensionKey,
65739
65773
  id,
65740
65774
  value: dimensionKey,
65741
65775
  disableHeaderHover: !!this.cornerSetting.disableHeaderHover,
@@ -67019,6 +67053,7 @@
67019
67053
  getCellAdressByHeaderPath(dimensionPaths) {
67020
67054
  let colHeaderPaths;
67021
67055
  let rowHeaderPaths;
67056
+ let isCornerCell = false;
67022
67057
  let forceBody = false;
67023
67058
  if (Array.isArray(dimensionPaths)) {
67024
67059
  if (dimensionPaths.length > this.rowDimensionKeys.length + this.colDimensionKeys.length) {
@@ -67047,6 +67082,32 @@
67047
67082
  return (this.fullRowDimensionKeys.indexOf(a.dimensionKey ?? this.indicatorDimensionKey) -
67048
67083
  this.fullRowDimensionKeys.indexOf(b.dimensionKey ?? this.indicatorDimensionKey));
67049
67084
  });
67085
+ colHeaderPaths?.forEach(a => {
67086
+ if (a.isPivotCorner) {
67087
+ isCornerCell = true;
67088
+ }
67089
+ });
67090
+ rowHeaderPaths?.forEach(a => {
67091
+ if (a.isPivotCorner) {
67092
+ isCornerCell = true;
67093
+ }
67094
+ });
67095
+ if (isCornerCell) {
67096
+ if (this.cornerSetting.titleOnDimension === 'row') {
67097
+ for (let i = 0; i < this.rowDimensionKeys.length; i++) {
67098
+ if (rowHeaderPaths[0].dimensionKey === this.rowDimensionKeys[i]) {
67099
+ return { col: i + this.leftRowSeriesNumberColumnCount, row: 0 };
67100
+ }
67101
+ }
67102
+ }
67103
+ else {
67104
+ for (let i = 0; i < this.colDimensionKeys.length; i++) {
67105
+ if (colHeaderPaths[0].dimensionKey === this.colDimensionKeys[i]) {
67106
+ return { col: 0, row: i };
67107
+ }
67108
+ }
67109
+ }
67110
+ }
67050
67111
  let needLowestLevel = false;
67051
67112
  if (colHeaderPaths?.length >= 1 && rowHeaderPaths?.length >= 1) {
67052
67113
  needLowestLevel = true;
@@ -67147,7 +67208,7 @@
67147
67208
  }
67148
67209
  }
67149
67210
  if (colDimensionFinded || forceBody) {
67150
- col = this.rowHeaderLevelCount;
67211
+ col = this.rowHeaderLevelCount + this.leftRowSeriesNumberColumnCount;
67151
67212
  const { startInTotal, level } = colDimensionFinded ?? defaultDimension;
67152
67213
  col += startInTotal ?? 0;
67153
67214
  defaultRow = this.columnHeaderTitle ? level + 1 : level;
@@ -67666,7 +67727,9 @@
67666
67727
  return totalCount;
67667
67728
  }
67668
67729
  resetHeaderTree() {
67730
+ this.colIndex = 0;
67669
67731
  this._rowHeaderCellFullPathIds_FULL = [];
67732
+ this._columnHeaderCellFullPathIds = [];
67670
67733
  this._columnHeaderCellIds = [];
67671
67734
  const dataset = this.dataset;
67672
67735
  this.rowTree = dataset.rowHeaderTree;
@@ -67682,6 +67745,8 @@
67682
67745
  o[e.id] = e;
67683
67746
  return o;
67684
67747
  }, {});
67748
+ this._CellHeaderPathMap = new Map();
67749
+ this._largeCellRangeCache.length = 0;
67685
67750
  this.generateCellIdsConsiderHideHeader();
67686
67751
  this.setPagination(this.pagination);
67687
67752
  }
@@ -69286,9 +69351,10 @@
69286
69351
  }
69287
69352
  this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69288
69353
  }
69289
- this.pivotSortState = [];
69290
- if (options.pivotSortState) {
69291
- this.updatePivotSortState(options.pivotSortState);
69354
+ this._changePivotSortStateBySortRules();
69355
+ if ((options.pivotSortState?.length ?? 0) > 0) {
69356
+ this.pivotSortState = [];
69357
+ this.pivotSortState = options.pivotSortState;
69292
69358
  }
69293
69359
  if (Env.mode !== 'node') {
69294
69360
  this.editorManager = new EditManeger(this);
@@ -69423,9 +69489,10 @@
69423
69489
  }
69424
69490
  internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69425
69491
  }
69426
- this.pivotSortState = [];
69427
- if (options.pivotSortState) {
69428
- this.updatePivotSortState(options.pivotSortState);
69492
+ this._changePivotSortStateBySortRules();
69493
+ if ((options.pivotSortState?.length ?? 0) > 0) {
69494
+ this.pivotSortState = [];
69495
+ this.pivotSortState = options.pivotSortState;
69429
69496
  }
69430
69497
  this.refreshHeader();
69431
69498
  if (internalProps.releaseList) {
@@ -69863,24 +69930,147 @@
69863
69930
  }
69864
69931
  }
69865
69932
  updateSortRules(sortRules) {
69866
- this.internalProps.dataConfig.sortRules = sortRules;
69933
+ if (this.internalProps.dataConfig) {
69934
+ this.internalProps.dataConfig.sortRules = sortRules;
69935
+ }
69936
+ else {
69937
+ this.internalProps.dataConfig = { sortRules };
69938
+ }
69867
69939
  this.dataset.updateSortRules(sortRules);
69940
+ this._changePivotSortStateBySortRules();
69868
69941
  this.internalProps.layoutMap.resetHeaderTree();
69869
69942
  this.scenegraph.clearCells();
69870
69943
  this.refreshHeader();
69871
69944
  this.scenegraph.createSceneGraph();
69872
69945
  this.render();
69873
69946
  }
69874
- updatePivotSortState(pivotSortStateConfig) {
69875
- for (let i = 0; i < pivotSortStateConfig.length; i++) {
69876
- const { dimensions, order } = pivotSortStateConfig[i];
69877
- const cellAddress = this.internalProps.layoutMap.getPivotCellAdress(dimensions);
69878
- cellAddress &&
69947
+ _changePivotSortStateBySortRules() {
69948
+ this.pivotSortState = [];
69949
+ const sortRules = this.internalProps.dataConfig?.sortRules ?? [];
69950
+ for (let i = 0; i < sortRules.length; i++) {
69951
+ const sortRule = sortRules[i];
69952
+ if (sortRule.sortType) {
69953
+ const dimensions = [];
69954
+ if (sortRule.sortByIndicator) {
69955
+ if (sortRule.sortField ===
69956
+ (this.dataset.indicatorsAsCol
69957
+ ? this.dataset.rows[this.dataset.rows.length - 1]
69958
+ : this.dataset.columns[this.dataset.columns.length - 1])) {
69959
+ for (let j = 0; j < sortRule.query.length; j++) {
69960
+ dimensions.push({
69961
+ dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
69962
+ value: sortRule.query[j]
69963
+ });
69964
+ }
69965
+ dimensions.push({
69966
+ indicatorKey: sortRule.sortByIndicator,
69967
+ value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)
69968
+ ?.title ?? sortRule.sortByIndicator
69969
+ });
69970
+ }
69971
+ }
69972
+ else {
69973
+ dimensions.push({
69974
+ dimensionKey: sortRule.sortField,
69975
+ isPivotCorner: true,
69976
+ value: sortRule.sortField
69977
+ });
69978
+ }
69879
69979
  this.pivotSortState.push({
69880
- col: cellAddress.col,
69881
- row: cellAddress.row,
69882
- order
69980
+ dimensions,
69981
+ order: sortRule.sortType
69883
69982
  });
69983
+ }
69984
+ }
69985
+ }
69986
+ updatePivotSortState(pivotSortStateConfig) {
69987
+ this.pivotSortState = pivotSortStateConfig;
69988
+ }
69989
+ sort(col, row, order) {
69990
+ let dimensions;
69991
+ if (this.isCornerHeader(col, row)) {
69992
+ const dimensionInfo = this.getHeaderDefine(col, row);
69993
+ dimensions = [];
69994
+ const dimension = {
69995
+ isPivotCorner: true,
69996
+ dimensionKey: dimensionInfo.value,
69997
+ value: dimensionInfo.value
69998
+ };
69999
+ dimensions.push(dimension);
70000
+ }
70001
+ else if (this.isColumnHeader(col, row)) {
70002
+ dimensions = this.getCellHeaderPaths(col, row).colHeaderPaths;
70003
+ }
70004
+ else {
70005
+ dimensions = this.getCellHeaderPaths(col, row).rowHeaderPaths;
70006
+ }
70007
+ const sortIndicator = dimensions[dimensions.length - 1].indicatorKey;
70008
+ const headerDefine = this.getHeaderDefine(col, row);
70009
+ if (headerDefine.sort) {
70010
+ if (this.dataset.sortRules) {
70011
+ for (let i = this.dataset.sortRules.length - 1; i >= 0; i--) {
70012
+ const sortRule = this.dataset.sortRules[i];
70013
+ if (headerDefine.dimensionKey && sortRule.sortField === headerDefine.dimensionKey) {
70014
+ this.dataset.sortRules.splice(i, 1);
70015
+ }
70016
+ else if (sortIndicator &&
70017
+ sortRule.sortField ===
70018
+ (this.dataset.indicatorsAsCol
70019
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70020
+ : this.dataset.columns[this.dataset.columns.length - 1])) {
70021
+ this.dataset.sortRules.splice(i, 1);
70022
+ }
70023
+ }
70024
+ if (sortIndicator) {
70025
+ this.dataset.sortRules.push({
70026
+ sortField: this.dataset.indicatorsAsCol
70027
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70028
+ : this.dataset.columns[this.dataset.columns.length - 1],
70029
+ sortType: SortType[order],
70030
+ sortByIndicator: sortIndicator,
70031
+ query: dimensions.reduce((arr, dimension) => {
70032
+ if (dimension.dimensionKey) {
70033
+ arr.push(dimension.value);
70034
+ }
70035
+ return arr;
70036
+ }, [])
70037
+ });
70038
+ }
70039
+ else {
70040
+ this.dataset.sortRules.push({
70041
+ sortField: headerDefine.dimensionKey,
70042
+ sortType: SortType[order]
70043
+ });
70044
+ }
70045
+ }
70046
+ else {
70047
+ if (sortIndicator) {
70048
+ this.dataset.sortRules = [
70049
+ {
70050
+ sortField: this.dataset.indicatorsAsCol
70051
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70052
+ : this.dataset.columns[this.dataset.columns.length - 1],
70053
+ sortType: SortType[order],
70054
+ sortByIndicator: sortIndicator,
70055
+ query: dimensions.reduce((arr, dimension) => {
70056
+ if (dimension.dimensionKey) {
70057
+ arr.push(dimension.value);
70058
+ }
70059
+ return arr;
70060
+ }, [])
70061
+ }
70062
+ ];
70063
+ }
70064
+ else {
70065
+ this.dataset.sortRules = [
70066
+ {
70067
+ sortField: headerDefine.dimensionKey,
70068
+ sortType: SortType[order]
70069
+ }
70070
+ ];
70071
+ }
70072
+ }
70073
+ this.updateSortRules(this.dataset.sortRules);
69884
70074
  }
69885
70075
  }
69886
70076
  getPivotSortState(col, row) {
@@ -69889,8 +70079,11 @@
69889
70079
  }
69890
70080
  const cellRange = this.getCellRange(col, row);
69891
70081
  for (let i = 0; i < this.pivotSortState.length; i++) {
69892
- const { col: sortCol, row: sortRow, order } = this.pivotSortState[i];
69893
- if (cellInRange(cellRange, sortCol, sortRow)) {
70082
+ const pivotState = this.pivotSortState[i];
70083
+ const dimensions = pivotState.dimensions;
70084
+ const cell = this.getCellAddressByHeaderPaths(dimensions);
70085
+ const order = pivotState.order;
70086
+ if (cell && cellInRange(cellRange, cell.col, cell.row)) {
69894
70087
  return order;
69895
70088
  }
69896
70089
  }
@@ -70079,7 +70272,7 @@
70079
70272
  internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
70080
70273
  this.pivotSortState = [];
70081
70274
  if (options.pivotSortState) {
70082
- this.updatePivotSortState(options.pivotSortState);
70275
+ this.pivotSortState = options.pivotSortState;
70083
70276
  }
70084
70277
  }
70085
70278
  this.refreshHeader();
@@ -70893,7 +71086,12 @@
70893
71086
  return this.getCellOriginRecord(col, row);
70894
71087
  }
70895
71088
  updateSortRules(sortRules) {
70896
- this.internalProps.dataConfig.sortRules = sortRules;
71089
+ if (this.internalProps.dataConfig) {
71090
+ this.internalProps.dataConfig.sortRules = sortRules;
71091
+ }
71092
+ else {
71093
+ this.internalProps.dataConfig = { sortRules };
71094
+ }
70897
71095
  this.dataset.updateSortRules(sortRules);
70898
71096
  this.internalProps.layoutMap.resetHeaderTree();
70899
71097
  this.scenegraph.clearCells();
@@ -70901,18 +71099,6 @@
70901
71099
  this.scenegraph.createSceneGraph();
70902
71100
  this.render();
70903
71101
  }
70904
- updatePivotSortState(pivotSortStateConfig) {
70905
- for (let i = 0; i < pivotSortStateConfig.length; i++) {
70906
- const { dimensions, order } = pivotSortStateConfig[i];
70907
- const cellAddress = this.internalProps.layoutMap.getPivotCellAdress(dimensions);
70908
- cellAddress &&
70909
- this.pivotSortState.push({
70910
- col: cellAddress.col,
70911
- row: cellAddress.row,
70912
- order
70913
- });
70914
- }
70915
- }
70916
71102
  getPivotSortState(col, row) {
70917
71103
  if (!this.pivotSortState) {
70918
71104
  return undefined;
@@ -70953,27 +71139,6 @@
70953
71139
  return null;
70954
71140
  }
70955
71141
  toggleHierarchyState(col, row) {
70956
- const hierarchyState = this.getHierarchyState(col, row);
70957
- if (hierarchyState === HierarchyState.expand) {
70958
- this.fireListeners(PIVOT_CHART_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
70959
- col: col,
70960
- row: row,
70961
- hierarchyState: HierarchyState.collapse
70962
- });
70963
- }
70964
- else if (hierarchyState === HierarchyState.collapse) {
70965
- this.fireListeners(PIVOT_CHART_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
70966
- col: col,
70967
- row: row,
70968
- hierarchyState: HierarchyState.expand,
70969
- originData: this.getCellOriginRecord(col, row)
70970
- });
70971
- }
70972
- const result = this.internalProps.layoutMap.toggleHierarchyState(col, row);
70973
- this.refreshRowColCount();
70974
- this.clearCellStyleCache();
70975
- this.scenegraph.updateHierarchyIcon(col, row);
70976
- this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions);
70977
71142
  }
70978
71143
  getHeaderCellAddressByPath(dimensionPaths) {
70979
71144
  const cellAddress = this.internalProps.layoutMap.getPivotCellAdress(dimensionPaths);
@@ -72023,7 +72188,7 @@
72023
72188
  }
72024
72189
 
72025
72190
  registerForVrender();
72026
- const version = "1.2.0";
72191
+ const version = "1.2.1-alpha.0";
72027
72192
  function getIcons() {
72028
72193
  return get$2();
72029
72194
  }