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

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 (47) 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 +26 -12
  22. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  23. package/dist/vtable.js +263 -177
  24. package/dist/vtable.min.js +2 -2
  25. package/es/core/BaseTable.js +2 -2
  26. package/es/core/BaseTable.js.map +1 -1
  27. package/es/index.d.ts +1 -1
  28. package/es/index.js +1 -1
  29. package/es/index.js.map +1 -1
  30. package/es/layout/pivot-header-layout.d.ts +9 -8
  31. package/es/layout/pivot-header-layout.js +37 -129
  32. package/es/layout/pivot-header-layout.js.map +1 -1
  33. package/es/layout/pivot-layout-helper.d.ts +10 -2
  34. package/es/layout/pivot-layout-helper.js +107 -5
  35. package/es/layout/pivot-layout-helper.js.map +1 -1
  36. package/es/layout/simple-header-layout.d.ts +1 -0
  37. package/es/layout/simple-header-layout.js +5 -7
  38. package/es/layout/simple-header-layout.js.map +1 -1
  39. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  40. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  41. package/es/scenegraph/graphic/group.js +5 -3
  42. package/es/scenegraph/graphic/group.js.map +1 -1
  43. package/es/scenegraph/layout/compute-row-height.js +21 -7
  44. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  45. package/es/scenegraph/style/frame-border.js +25 -11
  46. package/es/scenegraph/style/frame-border.js.map +1 -1
  47. package/package.json +2 -2
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) {
@@ -40624,6 +40664,7 @@
40624
40664
  }
40625
40665
  const isTableGroup = role === 'table';
40626
40666
  const { shadowBlur, shadowOffsetX, shadowOffsetY, shadowColor, cornerRadius, borderColor, borderLineWidth, borderLineDash } = frameTheme;
40667
+ let hasShadow = false;
40627
40668
  const groupAttributes = {};
40628
40669
  const rectAttributes = {
40629
40670
  pickable: false
@@ -40636,8 +40677,7 @@
40636
40677
  rectAttributes.stroke = true;
40637
40678
  rectAttributes.stroke = shadowColor;
40638
40679
  rectAttributes.lineWidth = 1;
40639
- rectAttributes.fill = true;
40640
- rectAttributes.fillOpacity = 0.01;
40680
+ hasShadow = true;
40641
40681
  }
40642
40682
  if (borderLineWidth) {
40643
40683
  rectAttributes.stroke = true;
@@ -40679,12 +40719,32 @@
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 shadowRect;
40727
+ let borderRect;
40728
+ if (hasShadow) {
40729
+ rectAttributes.fill = 'white';
40730
+ rectAttributes.notAdjustPos = true;
40731
+ shadowRect = createRect(rectAttributes);
40732
+ borderRect = createGroup({
40733
+ x: group.attribute.x,
40734
+ y: group.attribute.y,
40735
+ width: group.attribute.width,
40736
+ height: group.attribute.height,
40737
+ fill: 'red',
40738
+ cornerRadius: group.attribute.cornerRadius,
40739
+ globalCompositeOperation: 'destination-out'
40740
+ });
40741
+ borderRect.name = 'table-border-rect';
40742
+ borderRect.addChild(shadowRect);
40743
+ }
40744
+ else {
40745
+ borderRect = createRect(rectAttributes);
40746
+ borderRect.name = 'table-border-rect';
40747
+ }
40688
40748
  group.parent.insertBefore(borderRect, group);
40689
40749
  group.border = borderRect;
40690
40750
  }
@@ -40743,6 +40803,12 @@
40743
40803
  width: group.attribute.width - borderLeft / 2 - borderRight / 2,
40744
40804
  height: group.attribute.height - borderTop / 2 - borderBottom / 2
40745
40805
  });
40806
+ if (group.border.type === 'group') {
40807
+ group.border.firstChild.setAttributes({
40808
+ width: group.attribute.width,
40809
+ height: group.attribute.height
40810
+ });
40811
+ }
40746
40812
  }
40747
40813
 
40748
40814
  /*! *****************************************************************************
@@ -41369,8 +41435,9 @@
41369
41435
  useStyle = true;
41370
41436
  order = 0;
41371
41437
  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 &&
41438
+ const { lineWidth = groupAttribute.lineWidth, stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor = groupAttribute.strokeArrayColor, notAdjustPos } = group.attribute;
41439
+ if (notAdjustPos !== true &&
41440
+ stroke &&
41374
41441
  Array.isArray(lineDash) &&
41375
41442
  !lineDash.length &&
41376
41443
  !Array.isArray(strokeArrayColor) &&
@@ -41388,9 +41455,10 @@
41388
41455
  useStyle = true;
41389
41456
  order = 0;
41390
41457
  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;
41458
+ const { lineWidth = groupAttribute.lineWidth, stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor = groupAttribute.strokeArrayColor, notAdjustPos } = group.attribute;
41392
41459
  const { width = groupAttribute.width, height = groupAttribute.height } = group.attribute;
41393
- if (stroke &&
41460
+ if (notAdjustPos !== true &&
41461
+ stroke &&
41394
41462
  Array.isArray(lineDash) &&
41395
41463
  !lineDash.length &&
41396
41464
  !Array.isArray(strokeArrayColor) &&
@@ -51798,7 +51866,7 @@
51798
51866
  return TABLE_EVENT_TYPE;
51799
51867
  }
51800
51868
  options;
51801
- version = "0.15.5-alpha.1";
51869
+ version = "0.15.5-alpha.2";
51802
51870
  pagination;
51803
51871
  id = `VTable${Date.now()}`;
51804
51872
  headerStyleCache;
@@ -52833,6 +52901,7 @@
52833
52901
  internalProps.releaseList = null;
52834
52902
  }
52835
52903
  this.scenegraph.stage.release();
52904
+ this.scenegraph.proxy.release();
52836
52905
  const { parentElement } = internalProps.element;
52837
52906
  if (parentElement) {
52838
52907
  parentElement.removeChild(internalProps.element);
@@ -54358,8 +54427,8 @@
54358
54427
  };
54359
54428
  }
54360
54429
 
54361
- let seqId = 0;
54362
54430
  class SimpleHeaderLayoutMap {
54431
+ seqId = 0;
54363
54432
  _headerObjects;
54364
54433
  _headerObjectMap;
54365
54434
  _headerCellIds;
@@ -54867,7 +54936,7 @@
54867
54936
  const rowCells = this._newRow(row, hideColumnsSubHeader);
54868
54937
  column.forEach((hd) => {
54869
54938
  const col = this._columns.length;
54870
- const id = seqId++;
54939
+ const id = this.seqId++;
54871
54940
  const cell = {
54872
54941
  id,
54873
54942
  title: hd.title ?? hd.caption,
@@ -54897,7 +54966,7 @@
54897
54966
  else {
54898
54967
  const colDef = hd;
54899
54968
  this._columns.push({
54900
- id: seqId++,
54969
+ id: this.seqId++,
54901
54970
  field: colDef.field,
54902
54971
  fieldKey: colDef.fieldKey,
54903
54972
  fieldFormat: colDef.fieldFormat,
@@ -56016,6 +56085,7 @@
56016
56085
  }
56017
56086
 
56018
56087
  class DimensionTree {
56088
+ sharedVar;
56019
56089
  sizeIncludeParent = false;
56020
56090
  rowExpandLevel;
56021
56091
  hierarchyType;
@@ -56032,10 +56102,11 @@
56032
56102
  };
56033
56103
  totalLevel = 0;
56034
56104
  dimensionKeys = new NumberMap();
56035
- constructor(tree, hierarchyType = 'grid', rowExpandLevel = undefined) {
56105
+ constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
56036
56106
  this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
56037
56107
  this.rowExpandLevel = rowExpandLevel;
56038
56108
  this.hierarchyType = hierarchyType;
56109
+ this.sharedVar = sharedVar;
56039
56110
  this.reset(tree);
56040
56111
  }
56041
56112
  reset(tree, updateTreeNode = false) {
@@ -56051,7 +56122,7 @@
56051
56122
  !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
56052
56123
  this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
56053
56124
  if (!node.id) {
56054
- node.id = ++sharedVar.seqId;
56125
+ node.id = ++this.sharedVar.seqId;
56055
56126
  }
56056
56127
  }
56057
56128
  let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0;
@@ -56211,11 +56282,158 @@
56211
56282
  });
56212
56283
  return count;
56213
56284
  }
56285
+ function dealHeader(hd, _headerCellIds, results, roots, row, layoutMap) {
56286
+ const id = hd.id;
56287
+ const dimensionInfo = layoutMap.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
56288
+ layoutMap.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56289
+ const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => {
56290
+ if (typeof indicator === 'string') {
56291
+ return false;
56292
+ }
56293
+ if (hd.indicatorKey) {
56294
+ return indicator.indicatorKey === hd.indicatorKey;
56295
+ }
56296
+ return indicator.title === hd.value;
56297
+ });
56298
+ const cell = {
56299
+ id,
56300
+ title: hd.value ?? indicatorInfo?.title,
56301
+ field: hd.dimensionKey,
56302
+ style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
56303
+ ? (indicatorInfo ?? dimensionInfo)?.headerStyle
56304
+ : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
56305
+ headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
56306
+ headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
56307
+ define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
56308
+ fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
56309
+ dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
56310
+ pivotInfo: {
56311
+ value: hd.value,
56312
+ dimensionKey: hd.dimensionKey,
56313
+ isPivotCorner: false
56314
+ },
56315
+ width: dimensionInfo?.width,
56316
+ minWidth: dimensionInfo?.minWidth,
56317
+ maxWidth: dimensionInfo?.maxWidth,
56318
+ showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
56319
+ description: dimensionInfo?.description
56320
+ };
56321
+ if (indicatorInfo) {
56322
+ if (indicatorInfo.customRender) {
56323
+ hd.customRender = indicatorInfo.customRender;
56324
+ }
56325
+ if (!isValid$5(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
56326
+ layoutMap._indicators?.push({
56327
+ id: ++layoutMap.sharedVar.seqId,
56328
+ indicatorKey: indicatorInfo.indicatorKey,
56329
+ field: indicatorInfo.indicatorKey,
56330
+ fieldFormat: indicatorInfo?.format,
56331
+ cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
56332
+ chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
56333
+ chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
56334
+ sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
56335
+ style: indicatorInfo?.style,
56336
+ icon: indicatorInfo?.icon,
56337
+ define: Object.assign({}, hd, indicatorInfo, {
56338
+ dragHeader: dimensionInfo?.dragHeader
56339
+ }),
56340
+ width: indicatorInfo?.width,
56341
+ minWidth: indicatorInfo?.minWidth,
56342
+ maxWidth: indicatorInfo?.maxWidth,
56343
+ disableColumnResize: indicatorInfo?.disableColumnResize
56344
+ });
56345
+ }
56346
+ }
56347
+ else if (hd.indicatorKey) {
56348
+ if (!isValid$5(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
56349
+ layoutMap._indicators?.push({
56350
+ id: ++layoutMap.sharedVar.seqId,
56351
+ indicatorKey: hd.indicatorKey,
56352
+ field: hd.indicatorKey,
56353
+ cellType: 'text',
56354
+ define: Object.assign({}, hd)
56355
+ });
56356
+ }
56357
+ }
56358
+ results[id] = cell;
56359
+ layoutMap._headerObjects[id] = cell;
56360
+ _headerCellIds[row][layoutMap.colIndex] = id;
56361
+ for (let r = row - 1; r >= 0; r--) {
56362
+ _headerCellIds[r][layoutMap.colIndex] = roots[r];
56363
+ }
56364
+ if (hd.children?.length >= 1) {
56365
+ layoutMap
56366
+ ._addHeaders(_headerCellIds, row + 1, hd.children ?? [], [...roots, id])
56367
+ .forEach(c => results.push(c));
56368
+ }
56369
+ else {
56370
+ for (let r = row + 1; r < _headerCellIds.length; r++) {
56371
+ _headerCellIds[r][layoutMap.colIndex] = id;
56372
+ }
56373
+ layoutMap.colIndex++;
56374
+ }
56375
+ }
56376
+ function dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, layoutMap) {
56377
+ const id = hd.id;
56378
+ const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56379
+ const cell = {
56380
+ id,
56381
+ title: hd.value,
56382
+ field: hd.dimensionKey,
56383
+ style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
56384
+ ? dimensionInfo?.headerStyle
56385
+ : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
56386
+ headerType: dimensionInfo?.headerType ?? 'text',
56387
+ headerIcon: dimensionInfo?.headerIcon,
56388
+ define: Object.assign(hd, {
56389
+ linkJump: dimensionInfo?.linkJump,
56390
+ linkDetect: dimensionInfo?.linkDetect,
56391
+ templateLink: dimensionInfo?.templateLink,
56392
+ keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
56393
+ imageAutoSizing: dimensionInfo?.imageAutoSizing,
56394
+ headerCustomRender: dimensionInfo?.headerCustomRender,
56395
+ headerCustomLayout: dimensionInfo?.headerCustomLayout,
56396
+ dragHeader: dimensionInfo?.dragHeader
56397
+ }),
56398
+ fieldFormat: dimensionInfo?.headerFormat,
56399
+ dropDownMenu: dimensionInfo?.dropDownMenu,
56400
+ pivotInfo: {
56401
+ value: hd.value,
56402
+ dimensionKey: hd.dimensionKey,
56403
+ isPivotCorner: false
56404
+ },
56405
+ hierarchyLevel: hd.level,
56406
+ dimensionTotalLevel: totalLevel,
56407
+ hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
56408
+ width: dimensionInfo?.width,
56409
+ minWidth: dimensionInfo?.minWidth,
56410
+ maxWidth: dimensionInfo?.maxWidth,
56411
+ parentCellId: roots[roots.length - 1]
56412
+ };
56413
+ results[id] = cell;
56414
+ layoutMap._headerObjects[id] = cell;
56415
+ _headerCellIds[row][layoutMap.colIndex] = id;
56416
+ for (let r = row - 1; r >= 0; r--) {
56417
+ _headerCellIds[r][layoutMap.colIndex] = roots[r];
56418
+ }
56419
+ if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
56420
+ show && layoutMap.colIndex++;
56421
+ layoutMap
56422
+ ._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions)
56423
+ .forEach(c => results.push(c));
56424
+ }
56425
+ else {
56426
+ show && layoutMap.colIndex++;
56427
+ for (let r = row + 1; r < _headerCellIds.length; r++) {
56428
+ _headerCellIds[r][layoutMap.colIndex] = id;
56429
+ }
56430
+ }
56431
+ }
56214
56432
 
56215
- const sharedVar = { seqId: 0 };
56216
- let colIndex = 0;
56217
56433
  const defaultDimension = { startInTotal: 0, level: 0 };
56218
56434
  class PivotHeaderLayoutMap {
56435
+ sharedVar;
56436
+ colIndex = 0;
56219
56437
  _showHeader = true;
56220
56438
  rowDimensionTree;
56221
56439
  columnDimensionTree;
@@ -56271,6 +56489,7 @@
56271
56489
  _chartItemBandSize;
56272
56490
  _chartPadding;
56273
56491
  constructor(table, dataset) {
56492
+ this.sharedVar = { seqId: 0 };
56274
56493
  this._table = table;
56275
56494
  if (table.options.rowHierarchyType === 'tree') {
56276
56495
  this.extensionRows = table.options.extensionRows;
@@ -56333,8 +56552,8 @@
56333
56552
  this.indicatorKeys.push(indicator.indicatorKey);
56334
56553
  }
56335
56554
  });
56336
- this.columnDimensionTree = new DimensionTree(this.columnTree ?? []);
56337
- this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
56555
+ this.columnDimensionTree = new DimensionTree(this.columnTree ?? [], this.sharedVar);
56556
+ this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
56338
56557
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr();
56339
56558
  this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr();
56340
56559
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys);
@@ -56343,7 +56562,7 @@
56343
56562
  this.columnHeaderObjs = this._addHeaders(this._columnHeaderCellIds, 0, this.columnDimensionTree.tree.children, []);
56344
56563
  }
56345
56564
  if (this.columnHeaderTitle) {
56346
- const id = ++sharedVar.seqId;
56565
+ const id = ++this.sharedVar.seqId;
56347
56566
  const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
56348
56567
  this._columnHeaderCellIds.unshift(firstRowIds);
56349
56568
  const cell = {
@@ -56366,7 +56585,7 @@
56366
56585
  this.columnHeaderObjs.push(cell);
56367
56586
  this._headerObjects[id] = cell;
56368
56587
  }
56369
- colIndex = 0;
56588
+ this.colIndex = 0;
56370
56589
  if (this.rowDimensionTree.tree.children?.length >= 1) {
56371
56590
  this.rowHeaderObjs =
56372
56591
  this.rowHierarchyType === 'tree'
@@ -56374,7 +56593,7 @@
56374
56593
  : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, []);
56375
56594
  }
56376
56595
  if (this.rowHeaderTitle) {
56377
- const id = ++sharedVar.seqId;
56596
+ const id = ++this.sharedVar.seqId;
56378
56597
  const firstColIds = Array(this._rowHeaderCellIds_FULL[0]?.length ?? this.rowDimensionTree.tree.size).fill(id);
56379
56598
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
56380
56599
  const cell = {
@@ -56447,7 +56666,7 @@
56447
56666
  else {
56448
56667
  this.cornerHeaderObjs = this._addCornerHeaders(null, undefined);
56449
56668
  }
56450
- colIndex = 0;
56669
+ this.colIndex = 0;
56451
56670
  this._headerObjectMap = this._headerObjects.reduce((o, e) => {
56452
56671
  o[e.id] = e;
56453
56672
  return o;
@@ -56500,9 +56719,10 @@
56500
56719
  this.setColumnWidths();
56501
56720
  }
56502
56721
  _addHeaders(_headerCellIds, row, header, roots) {
56722
+ const _this = this;
56503
56723
  function _newRow(row) {
56504
56724
  const newRow = (_headerCellIds[row] = []);
56505
- if (colIndex === 0) {
56725
+ if (_this.colIndex === 0) {
56506
56726
  return newRow;
56507
56727
  }
56508
56728
  const prev = _headerCellIds[row - 1];
@@ -56515,101 +56735,17 @@
56515
56735
  if (!_headerCellIds[row]) {
56516
56736
  _newRow(row);
56517
56737
  }
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
- });
56738
+ for (let i = 0; i < header.length; i++) {
56739
+ const hd = header[i];
56740
+ dealHeader(hd, _headerCellIds, results, roots, row, this);
56741
+ }
56607
56742
  return results;
56608
56743
  }
56609
56744
  _addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
56745
+ const _this = this;
56610
56746
  function _newRow(row) {
56611
56747
  const newRow = (_headerCellIds[row] = []);
56612
- if (colIndex === 0) {
56748
+ if (_this.colIndex === 0) {
56613
56749
  return newRow;
56614
56750
  }
56615
56751
  const prev = _headerCellIds[row - 1];
@@ -56622,67 +56758,17 @@
56622
56758
  if (!_headerCellIds[row]) {
56623
56759
  _newRow(row);
56624
56760
  }
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
- });
56761
+ for (let i = 0; i < header.length; i++) {
56762
+ const hd = header[i];
56763
+ dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this);
56764
+ }
56679
56765
  return results;
56680
56766
  }
56681
56767
  _addCornerHeaders(dimensionKeys, dimensions) {
56682
56768
  const results = [];
56683
56769
  if (dimensionKeys) {
56684
56770
  dimensionKeys.forEach((dimensionKey, key) => {
56685
- const id = ++sharedVar.seqId;
56771
+ const id = ++this.sharedVar.seqId;
56686
56772
  const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === dimensionKey);
56687
56773
  const cell = {
56688
56774
  id,
@@ -56730,7 +56816,7 @@
56730
56816
  });
56731
56817
  }
56732
56818
  else {
56733
- const id = ++sharedVar.seqId;
56819
+ const id = ++this.sharedVar.seqId;
56734
56820
  const cell = {
56735
56821
  id,
56736
56822
  title: '',
@@ -56762,7 +56848,7 @@
56762
56848
  this._rowHeaderCellIds_FULL = [];
56763
56849
  old_rowHeaderCellIds.forEach((row_ids, index) => {
56764
56850
  const key = row_ids[row_ids.length - 1];
56765
- colIndex = 0;
56851
+ this.colIndex = 0;
56766
56852
  let tree;
56767
56853
  if (typeof extensionRow.rowTree === 'function') {
56768
56854
  const fullCellIds = this.findFullCellIds(row_ids);
@@ -56779,7 +56865,7 @@
56779
56865
  rowExtensionDimensionTree = this._rowHeaderExtensionTree[key];
56780
56866
  }
56781
56867
  else {
56782
- rowExtensionDimensionTree = new DimensionTree(tree ?? [], this.rowHierarchyType, undefined);
56868
+ rowExtensionDimensionTree = new DimensionTree(tree ?? [], this.sharedVar, this.rowHierarchyType, undefined);
56783
56869
  this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree;
56784
56870
  }
56785
56871
  const extensionRowTreeHeaderIds = [];
@@ -57519,7 +57605,7 @@
57519
57605
  this._rowHeaderCellIds_FULL = [];
57520
57606
  this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, true, this.rowsDefine);
57521
57607
  if (this.rowHeaderTitle) {
57522
- const id = ++sharedVar.seqId;
57608
+ const id = ++this.sharedVar.seqId;
57523
57609
  const firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
57524
57610
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
57525
57611
  const cell = {
@@ -57548,7 +57634,7 @@
57548
57634
  if (this.rowHierarchyType === 'tree' && this.extensionRows?.length >= 1) {
57549
57635
  this.generateExtensionRowTree();
57550
57636
  }
57551
- colIndex = 0;
57637
+ this.colIndex = 0;
57552
57638
  this._headerObjectMap = this._headerObjects.reduce((o, e) => {
57553
57639
  o[e.id] = e;
57554
57640
  return o;
@@ -61959,7 +62045,7 @@
61959
62045
  return new Tag$1(params ? params.attribute : {});
61960
62046
  }
61961
62047
 
61962
- const version = "0.15.5-alpha.1";
62048
+ const version = "0.15.5-alpha.2";
61963
62049
  function getIcons() {
61964
62050
  return get$2();
61965
62051
  }