@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/dist/vtable.js CHANGED
@@ -35325,6 +35325,9 @@
35325
35325
  this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);
35326
35326
  if (this.border) {
35327
35327
  this.border.setAttribute('width', this.border.attribute.width + deltaX);
35328
+ if (this.border.type === 'group') {
35329
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.width + deltaX);
35330
+ }
35328
35331
  }
35329
35332
  }
35330
35333
  setDeltaHeight(deltaY) {
@@ -35334,6 +35337,9 @@
35334
35337
  this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);
35335
35338
  if (this.border) {
35336
35339
  this.border.setAttribute('height', this.border.attribute.height + deltaY);
35340
+ if (this.border.type === 'group') {
35341
+ this.border.firstChild.setAttribute('width', this.border.firstChild.attribute.height + deltaY);
35342
+ }
35337
35343
  }
35338
35344
  }
35339
35345
  setDeltaX(deltaX) {
@@ -35451,6 +35457,9 @@
35451
35457
  }
35452
35458
  };
35453
35459
  function after(group, selfChange) {
35460
+ if (!group.stage.dirtyBounds) {
35461
+ return;
35462
+ }
35454
35463
  if (!(group.stage && group.stage.renderCount)) {
35455
35464
  return;
35456
35465
  }
@@ -38887,8 +38896,14 @@
38887
38896
  table._clearRowRangeHeightsMap();
38888
38897
  }
38889
38898
  for (let row = rowStart; row < table.columnHeaderLevelCount; row++) {
38899
+ let startCol = 0;
38900
+ let endCol = table.colCount - 1;
38901
+ if ((table.isPivotTable() || table.isPivotChart()) && checkPivotFixedStyleAndNoWrap(table, row)) {
38902
+ startCol = 0;
38903
+ endCol = table.rowHeaderLevelCount;
38904
+ }
38890
38905
  if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') {
38891
- const height = computeRowHeight(row, 0, table.colCount - 1, table);
38906
+ const height = computeRowHeight(row, startCol, endCol, table);
38892
38907
  if (update) {
38893
38908
  newHeights[row] = height;
38894
38909
  }
@@ -39108,6 +39123,7 @@
39108
39123
  if (typeof cellDefine.style === 'function' ||
39109
39124
  typeof cellDefine.icon === 'function' ||
39110
39125
  cellDefine.define?.customRender ||
39126
+ cellDefine.define?.customLayout ||
39111
39127
  typeof cellDefine.define?.icon === 'function') {
39112
39128
  return false;
39113
39129
  }
@@ -39131,6 +39147,7 @@
39131
39147
  if (typeof cellDefine.style === 'function' ||
39132
39148
  typeof cellDefine.icon === 'function' ||
39133
39149
  cellDefine.define?.customRender ||
39150
+ cellDefine.define?.customLayout ||
39134
39151
  typeof cellDefine.define?.icon === 'function') {
39135
39152
  return false;
39136
39153
  }
@@ -39143,6 +39160,29 @@
39143
39160
  }
39144
39161
  return true;
39145
39162
  }
39163
+ function checkPivotFixedStyleAndNoWrap(table, row) {
39164
+ const { layoutMap } = table.internalProps;
39165
+ if (table.internalProps.autoWrapText &&
39166
+ (table.options.heightMode === 'autoHeight' || table.options.heightMode === 'adaptive')) {
39167
+ return false;
39168
+ }
39169
+ const headerDefine = layoutMap.getHeader(table.rowHeaderLevelCount, row);
39170
+ if (typeof headerDefine.style === 'function' ||
39171
+ typeof headerDefine.icons === 'function' ||
39172
+ headerDefine.define?.headerCustomRender ||
39173
+ headerDefine.define?.headerCustomLayout ||
39174
+ typeof headerDefine.define?.icon === 'function') {
39175
+ return false;
39176
+ }
39177
+ const headerStyle = table._getCellStyle(table.rowHeaderLevelCount, row);
39178
+ if (typeof headerStyle.padding === 'function' ||
39179
+ typeof headerStyle.fontSize === 'function' ||
39180
+ typeof headerStyle.lineHeight === 'function' ||
39181
+ headerStyle.autoWrapText === true) {
39182
+ return false;
39183
+ }
39184
+ return true;
39185
+ }
39146
39186
  function fillRowsHeight(height, startRow, endRow, table, newHeights) {
39147
39187
  for (let row = startRow; row <= endRow; row++) {
39148
39188
  if (newHeights) {
@@ -40679,12 +40719,15 @@
40679
40719
  rectAttributes.y = borderTop / 2;
40680
40720
  rectAttributes.pickable = false;
40681
40721
  if (isTableGroup) {
40682
- rectAttributes.x = group.attribute.x - borderLeft / 2;
40683
- rectAttributes.y = group.attribute.y - borderTop / 2;
40722
+ rectAttributes.x = -borderLeft / 2;
40723
+ rectAttributes.y = -borderTop / 2;
40684
40724
  rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2;
40685
40725
  rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2;
40686
- const borderRect = createRect(rectAttributes);
40687
- borderRect.name = 'table-border-rect';
40726
+ let borderRect;
40727
+ {
40728
+ borderRect = createRect(rectAttributes);
40729
+ borderRect.name = 'table-border-rect';
40730
+ }
40688
40731
  group.parent.insertBefore(borderRect, group);
40689
40732
  group.border = borderRect;
40690
40733
  }
@@ -40743,6 +40786,12 @@
40743
40786
  width: group.attribute.width - borderLeft / 2 - borderRight / 2,
40744
40787
  height: group.attribute.height - borderTop / 2 - borderBottom / 2
40745
40788
  });
40789
+ if (group.border.type === 'group') {
40790
+ group.border.firstChild.setAttributes({
40791
+ width: group.attribute.width,
40792
+ height: group.attribute.height
40793
+ });
40794
+ }
40746
40795
  }
40747
40796
 
40748
40797
  /*! *****************************************************************************
@@ -41369,8 +41418,9 @@
41369
41418
  useStyle = true;
41370
41419
  order = 0;
41371
41420
  drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
41372
- const { lineWidth = groupAttribute.lineWidth, stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor = groupAttribute.strokeArrayColor } = group.attribute;
41373
- if (stroke &&
41421
+ const { lineWidth = groupAttribute.lineWidth, stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor = groupAttribute.strokeArrayColor, notAdjustPos } = group.attribute;
41422
+ if (notAdjustPos !== true &&
41423
+ stroke &&
41374
41424
  Array.isArray(lineDash) &&
41375
41425
  !lineDash.length &&
41376
41426
  !Array.isArray(strokeArrayColor) &&
@@ -41388,9 +41438,10 @@
41388
41438
  useStyle = true;
41389
41439
  order = 0;
41390
41440
  drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
41391
- const { lineWidth = groupAttribute.lineWidth, stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor = groupAttribute.strokeArrayColor } = group.attribute;
41441
+ const { lineWidth = groupAttribute.lineWidth, stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor = groupAttribute.strokeArrayColor, notAdjustPos } = group.attribute;
41392
41442
  const { width = groupAttribute.width, height = groupAttribute.height } = group.attribute;
41393
- if (stroke &&
41443
+ if (notAdjustPos !== true &&
41444
+ stroke &&
41394
41445
  Array.isArray(lineDash) &&
41395
41446
  !lineDash.length &&
41396
41447
  !Array.isArray(strokeArrayColor) &&
@@ -51798,7 +51849,7 @@
51798
51849
  return TABLE_EVENT_TYPE;
51799
51850
  }
51800
51851
  options;
51801
- version = "0.15.5-alpha.1";
51852
+ version = "0.15.5-alpha.3";
51802
51853
  pagination;
51803
51854
  id = `VTable${Date.now()}`;
51804
51855
  headerStyleCache;
@@ -52833,6 +52884,7 @@
52833
52884
  internalProps.releaseList = null;
52834
52885
  }
52835
52886
  this.scenegraph.stage.release();
52887
+ this.scenegraph.proxy.release();
52836
52888
  const { parentElement } = internalProps.element;
52837
52889
  if (parentElement) {
52838
52890
  parentElement.removeChild(internalProps.element);
@@ -54358,8 +54410,8 @@
54358
54410
  };
54359
54411
  }
54360
54412
 
54361
- let seqId = 0;
54362
54413
  class SimpleHeaderLayoutMap {
54414
+ seqId = 0;
54363
54415
  _headerObjects;
54364
54416
  _headerObjectMap;
54365
54417
  _headerCellIds;
@@ -54867,7 +54919,7 @@
54867
54919
  const rowCells = this._newRow(row, hideColumnsSubHeader);
54868
54920
  column.forEach((hd) => {
54869
54921
  const col = this._columns.length;
54870
- const id = seqId++;
54922
+ const id = this.seqId++;
54871
54923
  const cell = {
54872
54924
  id,
54873
54925
  title: hd.title ?? hd.caption,
@@ -54897,7 +54949,7 @@
54897
54949
  else {
54898
54950
  const colDef = hd;
54899
54951
  this._columns.push({
54900
- id: seqId++,
54952
+ id: this.seqId++,
54901
54953
  field: colDef.field,
54902
54954
  fieldKey: colDef.fieldKey,
54903
54955
  fieldFormat: colDef.fieldFormat,
@@ -56016,6 +56068,7 @@
56016
56068
  }
56017
56069
 
56018
56070
  class DimensionTree {
56071
+ sharedVar;
56019
56072
  sizeIncludeParent = false;
56020
56073
  rowExpandLevel;
56021
56074
  hierarchyType;
@@ -56032,10 +56085,11 @@
56032
56085
  };
56033
56086
  totalLevel = 0;
56034
56087
  dimensionKeys = new NumberMap();
56035
- constructor(tree, hierarchyType = 'grid', rowExpandLevel = undefined) {
56088
+ constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
56036
56089
  this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
56037
56090
  this.rowExpandLevel = rowExpandLevel;
56038
56091
  this.hierarchyType = hierarchyType;
56092
+ this.sharedVar = sharedVar;
56039
56093
  this.reset(tree);
56040
56094
  }
56041
56095
  reset(tree, updateTreeNode = false) {
@@ -56051,7 +56105,7 @@
56051
56105
  !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
56052
56106
  this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
56053
56107
  if (!node.id) {
56054
- node.id = ++sharedVar.seqId;
56108
+ node.id = ++this.sharedVar.seqId;
56055
56109
  }
56056
56110
  }
56057
56111
  let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0;
@@ -56211,11 +56265,158 @@
56211
56265
  });
56212
56266
  return count;
56213
56267
  }
56268
+ function dealHeader(hd, _headerCellIds, results, roots, row, layoutMap) {
56269
+ const id = hd.id;
56270
+ const dimensionInfo = layoutMap.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
56271
+ layoutMap.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56272
+ const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => {
56273
+ if (typeof indicator === 'string') {
56274
+ return false;
56275
+ }
56276
+ if (hd.indicatorKey) {
56277
+ return indicator.indicatorKey === hd.indicatorKey;
56278
+ }
56279
+ return indicator.title === hd.value;
56280
+ });
56281
+ const cell = {
56282
+ id,
56283
+ title: hd.value ?? indicatorInfo?.title,
56284
+ field: hd.dimensionKey,
56285
+ style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
56286
+ ? (indicatorInfo ?? dimensionInfo)?.headerStyle
56287
+ : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
56288
+ headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
56289
+ headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
56290
+ define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
56291
+ fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
56292
+ dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
56293
+ pivotInfo: {
56294
+ value: hd.value,
56295
+ dimensionKey: hd.dimensionKey,
56296
+ isPivotCorner: false
56297
+ },
56298
+ width: dimensionInfo?.width,
56299
+ minWidth: dimensionInfo?.minWidth,
56300
+ maxWidth: dimensionInfo?.maxWidth,
56301
+ showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
56302
+ description: dimensionInfo?.description
56303
+ };
56304
+ if (indicatorInfo) {
56305
+ if (indicatorInfo.customRender) {
56306
+ hd.customRender = indicatorInfo.customRender;
56307
+ }
56308
+ if (!isValid$5(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
56309
+ layoutMap._indicators?.push({
56310
+ id: ++layoutMap.sharedVar.seqId,
56311
+ indicatorKey: indicatorInfo.indicatorKey,
56312
+ field: indicatorInfo.indicatorKey,
56313
+ fieldFormat: indicatorInfo?.format,
56314
+ cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
56315
+ chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
56316
+ chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
56317
+ sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
56318
+ style: indicatorInfo?.style,
56319
+ icon: indicatorInfo?.icon,
56320
+ define: Object.assign({}, hd, indicatorInfo, {
56321
+ dragHeader: dimensionInfo?.dragHeader
56322
+ }),
56323
+ width: indicatorInfo?.width,
56324
+ minWidth: indicatorInfo?.minWidth,
56325
+ maxWidth: indicatorInfo?.maxWidth,
56326
+ disableColumnResize: indicatorInfo?.disableColumnResize
56327
+ });
56328
+ }
56329
+ }
56330
+ else if (hd.indicatorKey) {
56331
+ if (!isValid$5(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
56332
+ layoutMap._indicators?.push({
56333
+ id: ++layoutMap.sharedVar.seqId,
56334
+ indicatorKey: hd.indicatorKey,
56335
+ field: hd.indicatorKey,
56336
+ cellType: 'text',
56337
+ define: Object.assign({}, hd)
56338
+ });
56339
+ }
56340
+ }
56341
+ results[id] = cell;
56342
+ layoutMap._headerObjects[id] = cell;
56343
+ _headerCellIds[row][layoutMap.colIndex] = id;
56344
+ for (let r = row - 1; r >= 0; r--) {
56345
+ _headerCellIds[r][layoutMap.colIndex] = roots[r];
56346
+ }
56347
+ if (hd.children?.length >= 1) {
56348
+ layoutMap
56349
+ ._addHeaders(_headerCellIds, row + 1, hd.children ?? [], [...roots, id])
56350
+ .forEach(c => results.push(c));
56351
+ }
56352
+ else {
56353
+ for (let r = row + 1; r < _headerCellIds.length; r++) {
56354
+ _headerCellIds[r][layoutMap.colIndex] = id;
56355
+ }
56356
+ layoutMap.colIndex++;
56357
+ }
56358
+ }
56359
+ function dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, layoutMap) {
56360
+ const id = hd.id;
56361
+ const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56362
+ const cell = {
56363
+ id,
56364
+ title: hd.value,
56365
+ field: hd.dimensionKey,
56366
+ style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
56367
+ ? dimensionInfo?.headerStyle
56368
+ : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
56369
+ headerType: dimensionInfo?.headerType ?? 'text',
56370
+ headerIcon: dimensionInfo?.headerIcon,
56371
+ define: Object.assign(hd, {
56372
+ linkJump: dimensionInfo?.linkJump,
56373
+ linkDetect: dimensionInfo?.linkDetect,
56374
+ templateLink: dimensionInfo?.templateLink,
56375
+ keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
56376
+ imageAutoSizing: dimensionInfo?.imageAutoSizing,
56377
+ headerCustomRender: dimensionInfo?.headerCustomRender,
56378
+ headerCustomLayout: dimensionInfo?.headerCustomLayout,
56379
+ dragHeader: dimensionInfo?.dragHeader
56380
+ }),
56381
+ fieldFormat: dimensionInfo?.headerFormat,
56382
+ dropDownMenu: dimensionInfo?.dropDownMenu,
56383
+ pivotInfo: {
56384
+ value: hd.value,
56385
+ dimensionKey: hd.dimensionKey,
56386
+ isPivotCorner: false
56387
+ },
56388
+ hierarchyLevel: hd.level,
56389
+ dimensionTotalLevel: totalLevel,
56390
+ hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
56391
+ width: dimensionInfo?.width,
56392
+ minWidth: dimensionInfo?.minWidth,
56393
+ maxWidth: dimensionInfo?.maxWidth,
56394
+ parentCellId: roots[roots.length - 1]
56395
+ };
56396
+ results[id] = cell;
56397
+ layoutMap._headerObjects[id] = cell;
56398
+ _headerCellIds[row][layoutMap.colIndex] = id;
56399
+ for (let r = row - 1; r >= 0; r--) {
56400
+ _headerCellIds[r][layoutMap.colIndex] = roots[r];
56401
+ }
56402
+ if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
56403
+ show && layoutMap.colIndex++;
56404
+ layoutMap
56405
+ ._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions)
56406
+ .forEach(c => results.push(c));
56407
+ }
56408
+ else {
56409
+ show && layoutMap.colIndex++;
56410
+ for (let r = row + 1; r < _headerCellIds.length; r++) {
56411
+ _headerCellIds[r][layoutMap.colIndex] = id;
56412
+ }
56413
+ }
56414
+ }
56214
56415
 
56215
- const sharedVar = { seqId: 0 };
56216
- let colIndex = 0;
56217
56416
  const defaultDimension = { startInTotal: 0, level: 0 };
56218
56417
  class PivotHeaderLayoutMap {
56418
+ sharedVar;
56419
+ colIndex = 0;
56219
56420
  _showHeader = true;
56220
56421
  rowDimensionTree;
56221
56422
  columnDimensionTree;
@@ -56271,6 +56472,7 @@
56271
56472
  _chartItemBandSize;
56272
56473
  _chartPadding;
56273
56474
  constructor(table, dataset) {
56475
+ this.sharedVar = { seqId: 0 };
56274
56476
  this._table = table;
56275
56477
  if (table.options.rowHierarchyType === 'tree') {
56276
56478
  this.extensionRows = table.options.extensionRows;
@@ -56333,8 +56535,8 @@
56333
56535
  this.indicatorKeys.push(indicator.indicatorKey);
56334
56536
  }
56335
56537
  });
56336
- this.columnDimensionTree = new DimensionTree(this.columnTree ?? []);
56337
- this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
56538
+ this.columnDimensionTree = new DimensionTree(this.columnTree ?? [], this.sharedVar);
56539
+ this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
56338
56540
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr();
56339
56541
  this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr();
56340
56542
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys);
@@ -56343,7 +56545,7 @@
56343
56545
  this.columnHeaderObjs = this._addHeaders(this._columnHeaderCellIds, 0, this.columnDimensionTree.tree.children, []);
56344
56546
  }
56345
56547
  if (this.columnHeaderTitle) {
56346
- const id = ++sharedVar.seqId;
56548
+ const id = ++this.sharedVar.seqId;
56347
56549
  const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
56348
56550
  this._columnHeaderCellIds.unshift(firstRowIds);
56349
56551
  const cell = {
@@ -56366,7 +56568,7 @@
56366
56568
  this.columnHeaderObjs.push(cell);
56367
56569
  this._headerObjects[id] = cell;
56368
56570
  }
56369
- colIndex = 0;
56571
+ this.colIndex = 0;
56370
56572
  if (this.rowDimensionTree.tree.children?.length >= 1) {
56371
56573
  this.rowHeaderObjs =
56372
56574
  this.rowHierarchyType === 'tree'
@@ -56374,7 +56576,7 @@
56374
56576
  : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, []);
56375
56577
  }
56376
56578
  if (this.rowHeaderTitle) {
56377
- const id = ++sharedVar.seqId;
56579
+ const id = ++this.sharedVar.seqId;
56378
56580
  const firstColIds = Array(this._rowHeaderCellIds_FULL[0]?.length ?? this.rowDimensionTree.tree.size).fill(id);
56379
56581
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
56380
56582
  const cell = {
@@ -56447,7 +56649,7 @@
56447
56649
  else {
56448
56650
  this.cornerHeaderObjs = this._addCornerHeaders(null, undefined);
56449
56651
  }
56450
- colIndex = 0;
56652
+ this.colIndex = 0;
56451
56653
  this._headerObjectMap = this._headerObjects.reduce((o, e) => {
56452
56654
  o[e.id] = e;
56453
56655
  return o;
@@ -56500,9 +56702,10 @@
56500
56702
  this.setColumnWidths();
56501
56703
  }
56502
56704
  _addHeaders(_headerCellIds, row, header, roots) {
56705
+ const _this = this;
56503
56706
  function _newRow(row) {
56504
56707
  const newRow = (_headerCellIds[row] = []);
56505
- if (colIndex === 0) {
56708
+ if (_this.colIndex === 0) {
56506
56709
  return newRow;
56507
56710
  }
56508
56711
  const prev = _headerCellIds[row - 1];
@@ -56515,101 +56718,17 @@
56515
56718
  if (!_headerCellIds[row]) {
56516
56719
  _newRow(row);
56517
56720
  }
56518
- header.forEach(hd => {
56519
- const id = hd.id;
56520
- const dimensionInfo = this.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
56521
- this.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56522
- const indicatorInfo = this.indicatorsDefine?.find(indicator => {
56523
- if (typeof indicator === 'string') {
56524
- return false;
56525
- }
56526
- if (hd.indicatorKey) {
56527
- return indicator.indicatorKey === hd.indicatorKey;
56528
- }
56529
- return indicator.title === hd.value;
56530
- });
56531
- const cell = {
56532
- id,
56533
- title: hd.value ?? indicatorInfo?.title,
56534
- field: hd.dimensionKey,
56535
- style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
56536
- ? (indicatorInfo ?? dimensionInfo)?.headerStyle
56537
- : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
56538
- headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
56539
- headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
56540
- define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
56541
- fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
56542
- dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
56543
- pivotInfo: {
56544
- value: hd.value,
56545
- dimensionKey: hd.dimensionKey,
56546
- isPivotCorner: false
56547
- },
56548
- width: dimensionInfo?.width,
56549
- minWidth: dimensionInfo?.minWidth,
56550
- maxWidth: dimensionInfo?.maxWidth,
56551
- showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
56552
- description: dimensionInfo?.description
56553
- };
56554
- if (indicatorInfo) {
56555
- if (indicatorInfo.customRender) {
56556
- hd.customRender = indicatorInfo.customRender;
56557
- }
56558
- if (!isValid$5(this._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
56559
- this._indicators?.push({
56560
- id: ++sharedVar.seqId,
56561
- indicatorKey: indicatorInfo.indicatorKey,
56562
- field: indicatorInfo.indicatorKey,
56563
- fieldFormat: indicatorInfo?.format,
56564
- cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
56565
- chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
56566
- chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
56567
- sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
56568
- style: indicatorInfo?.style,
56569
- icon: indicatorInfo?.icon,
56570
- define: Object.assign({}, hd, indicatorInfo, {
56571
- dragHeader: dimensionInfo?.dragHeader
56572
- }),
56573
- width: indicatorInfo?.width,
56574
- minWidth: indicatorInfo?.minWidth,
56575
- maxWidth: indicatorInfo?.maxWidth,
56576
- disableColumnResize: indicatorInfo?.disableColumnResize
56577
- });
56578
- }
56579
- }
56580
- else if (hd.indicatorKey) {
56581
- if (!isValid$5(this._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
56582
- this._indicators?.push({
56583
- id: ++sharedVar.seqId,
56584
- indicatorKey: hd.indicatorKey,
56585
- field: hd.indicatorKey,
56586
- cellType: 'text',
56587
- define: Object.assign({}, hd)
56588
- });
56589
- }
56590
- }
56591
- results[id] = cell;
56592
- this._headerObjects[id] = cell;
56593
- _headerCellIds[row][colIndex] = id;
56594
- for (let r = row - 1; r >= 0; r--) {
56595
- _headerCellIds[r][colIndex] = roots[r];
56596
- }
56597
- if (hd.children?.length >= 1) {
56598
- this._addHeaders(_headerCellIds, row + 1, hd.children ?? [], [...roots, id]).forEach(c => results.push(c));
56599
- }
56600
- else {
56601
- for (let r = row + 1; r < _headerCellIds.length; r++) {
56602
- _headerCellIds[r][colIndex] = id;
56603
- }
56604
- colIndex++;
56605
- }
56606
- });
56721
+ for (let i = 0; i < header.length; i++) {
56722
+ const hd = header[i];
56723
+ dealHeader(hd, _headerCellIds, results, roots, row, this);
56724
+ }
56607
56725
  return results;
56608
56726
  }
56609
56727
  _addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
56728
+ const _this = this;
56610
56729
  function _newRow(row) {
56611
56730
  const newRow = (_headerCellIds[row] = []);
56612
- if (colIndex === 0) {
56731
+ if (_this.colIndex === 0) {
56613
56732
  return newRow;
56614
56733
  }
56615
56734
  const prev = _headerCellIds[row - 1];
@@ -56622,67 +56741,17 @@
56622
56741
  if (!_headerCellIds[row]) {
56623
56742
  _newRow(row);
56624
56743
  }
56625
- header.forEach(hd => {
56626
- const id = hd.id;
56627
- const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56628
- const cell = {
56629
- id,
56630
- title: hd.value,
56631
- field: hd.dimensionKey,
56632
- style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
56633
- ? dimensionInfo?.headerStyle
56634
- : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
56635
- headerType: dimensionInfo?.headerType ?? 'text',
56636
- headerIcon: dimensionInfo?.headerIcon,
56637
- define: Object.assign(hd, {
56638
- linkJump: dimensionInfo?.linkJump,
56639
- linkDetect: dimensionInfo?.linkDetect,
56640
- templateLink: dimensionInfo?.templateLink,
56641
- keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
56642
- imageAutoSizing: dimensionInfo?.imageAutoSizing,
56643
- headerCustomRender: dimensionInfo?.headerCustomRender,
56644
- headerCustomLayout: dimensionInfo?.headerCustomLayout,
56645
- dragHeader: dimensionInfo?.dragHeader
56646
- }),
56647
- fieldFormat: dimensionInfo?.headerFormat,
56648
- dropDownMenu: dimensionInfo?.dropDownMenu,
56649
- pivotInfo: {
56650
- value: hd.value,
56651
- dimensionKey: hd.dimensionKey,
56652
- isPivotCorner: false
56653
- },
56654
- hierarchyLevel: hd.level,
56655
- dimensionTotalLevel: totalLevel,
56656
- hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
56657
- width: dimensionInfo?.width,
56658
- minWidth: dimensionInfo?.minWidth,
56659
- maxWidth: dimensionInfo?.maxWidth,
56660
- parentCellId: roots[roots.length - 1]
56661
- };
56662
- results[id] = cell;
56663
- this._headerObjects[id] = cell;
56664
- _headerCellIds[row][colIndex] = id;
56665
- for (let r = row - 1; r >= 0; r--) {
56666
- _headerCellIds[r][colIndex] = roots[r];
56667
- }
56668
- if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
56669
- show && colIndex++;
56670
- this._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions).forEach(c => results.push(c));
56671
- }
56672
- else {
56673
- show && colIndex++;
56674
- for (let r = row + 1; r < _headerCellIds.length; r++) {
56675
- _headerCellIds[r][colIndex] = id;
56676
- }
56677
- }
56678
- });
56744
+ for (let i = 0; i < header.length; i++) {
56745
+ const hd = header[i];
56746
+ dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this);
56747
+ }
56679
56748
  return results;
56680
56749
  }
56681
56750
  _addCornerHeaders(dimensionKeys, dimensions) {
56682
56751
  const results = [];
56683
56752
  if (dimensionKeys) {
56684
56753
  dimensionKeys.forEach((dimensionKey, key) => {
56685
- const id = ++sharedVar.seqId;
56754
+ const id = ++this.sharedVar.seqId;
56686
56755
  const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === dimensionKey);
56687
56756
  const cell = {
56688
56757
  id,
@@ -56730,7 +56799,7 @@
56730
56799
  });
56731
56800
  }
56732
56801
  else {
56733
- const id = ++sharedVar.seqId;
56802
+ const id = ++this.sharedVar.seqId;
56734
56803
  const cell = {
56735
56804
  id,
56736
56805
  title: '',
@@ -56762,7 +56831,7 @@
56762
56831
  this._rowHeaderCellIds_FULL = [];
56763
56832
  old_rowHeaderCellIds.forEach((row_ids, index) => {
56764
56833
  const key = row_ids[row_ids.length - 1];
56765
- colIndex = 0;
56834
+ this.colIndex = 0;
56766
56835
  let tree;
56767
56836
  if (typeof extensionRow.rowTree === 'function') {
56768
56837
  const fullCellIds = this.findFullCellIds(row_ids);
@@ -56779,7 +56848,7 @@
56779
56848
  rowExtensionDimensionTree = this._rowHeaderExtensionTree[key];
56780
56849
  }
56781
56850
  else {
56782
- rowExtensionDimensionTree = new DimensionTree(tree ?? [], this.rowHierarchyType, undefined);
56851
+ rowExtensionDimensionTree = new DimensionTree(tree ?? [], this.sharedVar, this.rowHierarchyType, undefined);
56783
56852
  this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree;
56784
56853
  }
56785
56854
  const extensionRowTreeHeaderIds = [];
@@ -57519,7 +57588,7 @@
57519
57588
  this._rowHeaderCellIds_FULL = [];
57520
57589
  this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, true, this.rowsDefine);
57521
57590
  if (this.rowHeaderTitle) {
57522
- const id = ++sharedVar.seqId;
57591
+ const id = ++this.sharedVar.seqId;
57523
57592
  const firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
57524
57593
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
57525
57594
  const cell = {
@@ -57548,7 +57617,7 @@
57548
57617
  if (this.rowHierarchyType === 'tree' && this.extensionRows?.length >= 1) {
57549
57618
  this.generateExtensionRowTree();
57550
57619
  }
57551
- colIndex = 0;
57620
+ this.colIndex = 0;
57552
57621
  this._headerObjectMap = this._headerObjects.reduce((o, e) => {
57553
57622
  o[e.id] = e;
57554
57623
  return o;
@@ -61959,7 +62028,7 @@
61959
62028
  return new Tag$1(params ? params.attribute : {});
61960
62029
  }
61961
62030
 
61962
- const version = "0.15.5-alpha.1";
62031
+ const version = "0.15.5-alpha.3";
61963
62032
  function getIcons() {
61964
62033
  return get$2();
61965
62034
  }