@visactor/vtable-calendar 1.13.3-alpha.6 → 1.14.1

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.
@@ -12229,10 +12229,7 @@
12229
12229
  const {
12230
12230
  context: context
12231
12231
  } = drawContext;
12232
- context.highPerformanceSave();
12233
- const t1 = graphic.parent.globalTransMatrix,
12234
- t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
12235
- if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
12232
+ if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
12236
12233
  tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
12237
12234
  const m = graphic.globalTransMatrix.getInverse();
12238
12235
  drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
@@ -41597,17 +41594,18 @@
41597
41594
  for (let i = 0; i < state.table.leftRowSeriesNumberCount; i++) state.headerCheckedState[`_vtable_rowSeries_number_${i}`] = !1, state._checkboxCellTypeFields.push(`_vtable_rowSeries_number_${i}`);
41598
41595
  isNeedInitHeaderCheckedStateFromRecord = !0;
41599
41596
  }
41600
- isNeedInitHeaderCheckedStateFromRecord && initRecordCheckState(state);
41597
+ isNeedInitHeaderCheckedStateFromRecord && initRecordCheckState(records, state);
41601
41598
  }
41602
41599
  function updateHeaderCheckedState(field, state, col, row) {
41603
41600
  let allChecked = !0,
41604
41601
  allUnChecked = !0,
41605
41602
  hasChecked = !1;
41606
41603
  return state.checkedState.forEach((check_state, index) => {
41604
+ var _a;
41607
41605
  index = index.includes(",") ? index.split(",").map(item => Number(item)) : Number(index);
41608
41606
  const tableIndex = state.table.getTableIndexByRecordIndex(index),
41609
41607
  mergeCell = state.table.transpose ? state.table.getCustomMerge(tableIndex, row) : state.table.getCustomMerge(col, tableIndex),
41610
- data = state.table.dataSource.get(index);
41608
+ data = null === (_a = state.table.dataSource) || void 0 === _a ? void 0 : _a.get(index);
41611
41609
  mergeCell || data.vtableMerge || (!0 !== (null == check_state ? void 0 : check_state[field]) ? allChecked = !1 : (allUnChecked = !1, hasChecked = !0));
41612
41610
  }), allChecked ? (state.headerCheckedState[field] = !0, allChecked) : allUnChecked ? (state.headerCheckedState[field] = !1, !1) : !!hasChecked && (state.headerCheckedState[field] = "indeterminate", "indeterminate");
41613
41611
  }
@@ -41653,7 +41651,7 @@
41653
41651
  table: table
41654
41652
  } = state;
41655
41653
  let source, target;
41656
- if (table.internalProps.transpose ? (sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = table.getRecordShowIndexByCell(targetIndex, 0)) : (source = table.getRecordIndexByCell(0, sourceIndex), target = table.getRecordIndexByCell(0, targetIndex)), isNumber$2(source) && isNumber$2(target)) {
41654
+ if (table.internalProps.transpose ? (sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = table.getRecordShowIndexByCell(targetIndex, 0)) : (source = table.isPivotTable() ? void 0 : table.getRecordIndexByCell(0, sourceIndex), target = table.isPivotTable() ? void 0 : table.getRecordIndexByCell(0, targetIndex)), isNumber$2(source) && isNumber$2(target)) {
41657
41655
  if (sourceIndex > targetIndex) {
41658
41656
  const sourceRecord = checkedState.get(sourceIndex.toString());
41659
41657
  for (let i = sourceIndex; i > targetIndex; i--) checkedState.set(i.toString(), checkedState.get((i - 1).toString()));
@@ -41696,14 +41694,14 @@
41696
41694
  }
41697
41695
  }), result;
41698
41696
  }
41699
- function initRecordCheckState(state) {
41697
+ function initRecordCheckState(records, state) {
41700
41698
  const table = state.table,
41701
- start = table.internalProps.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
41702
- end = table.internalProps.transpose ? table.colCount : table.rowCount;
41699
+ start = table.isPivotTable() ? 0 : table.internalProps.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
41700
+ end = table.isPivotTable() ? isArray$1(records) ? records.length : 0 : table.internalProps.transpose ? table.colCount : table.rowCount;
41703
41701
  for (let index = 0; index + start < end; index++) {
41704
- const record = table.dataSource.get(index);
41702
+ const record = table.isPivotTable() ? records[index] : table.dataSource.get(index);
41705
41703
  state._checkboxCellTypeFields.forEach(field => {
41706
- const value = record[field];
41704
+ const value = record && record[field];
41707
41705
  let isChecked;
41708
41706
  if (isObject$4(value) ? isChecked = value.checked : "boolean" == typeof value && (isChecked = value), null == isChecked) {
41709
41707
  const headerCheckFunc = state._headerCheckFuncs[field];
@@ -41718,7 +41716,7 @@
41718
41716
  });
41719
41717
  }
41720
41718
  }
41721
- const dataIndex = state.table.dataSource.getIndexKey(index).toString();
41719
+ const dataIndex = table.isPivotTable() ? index.toString() : state.table.dataSource.getIndexKey(index).toString();
41722
41720
  state.checkedState.get(dataIndex) || state.checkedState.set(dataIndex, {}), state.checkedState.get(dataIndex)[field] = isChecked;
41723
41721
  });
41724
41722
  }
@@ -46296,7 +46294,7 @@
46296
46294
  if (cellStyle.customStyleId === customStyleId) if (cellPos.range) for (let col = Math.max(0, cellPos.range.start.col); col <= Math.min(this.table.colCount - 1, cellPos.range.end.col); col++) for (let row = Math.max(0, cellPos.range.start.row); row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row); row++) this.table.scenegraph.updateCellContent(col, row);else this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);
46297
46295
  }), this.table.scenegraph.updateNextFrame();
46298
46296
  }
46299
- arrangeCustomCellStyle(cellPos, customStyleId) {
46297
+ arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
46300
46298
  var _a;
46301
46299
  const index = this.customCellStyleArrangement.findIndex(style => style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row);
46302
46300
  if (-1 === index && !customStyleId) return;
@@ -46312,7 +46310,6 @@
46312
46310
  customStyleId ? this.customCellStyleArrangement[index].customStyleId = customStyleId : this.customCellStyleArrangement.splice(index, 1);
46313
46311
  }
46314
46312
  const style = null === (_a = this.getCustomCellStyleOption(customStyleId)) || void 0 === _a ? void 0 : _a.style;
46315
- let forceFastUpdate;
46316
46313
  if (style) {
46317
46314
  forceFastUpdate = !0;
46318
46315
  for (const key in style) if (-1 === cellStyleKeys.indexOf(key)) {
@@ -46484,7 +46481,7 @@
46484
46481
  constructor(container) {
46485
46482
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46486
46483
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46487
- if (super(), this.showFrozenIcon = !0, this.version = "1.13.3-alpha.6", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
46484
+ if (super(), this.showFrozenIcon = !0, this.version = "1.14.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
46488
46485
  const {
46489
46486
  frozenColCount = 0,
46490
46487
  frozenRowCount: frozenRowCount,
@@ -48177,9 +48174,9 @@
48177
48174
  var _a;
48178
48175
  null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.registerCustomCellStyle(customStyleId, customStyle);
48179
48176
  }
48180
- arrangeCustomCellStyle(cellPos, customStyleId) {
48177
+ arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
48181
48178
  var _a;
48182
- null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId);
48179
+ null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate);
48183
48180
  }
48184
48181
  isSeriesNumber(col, row) {
48185
48182
  return this.internalProps.layoutMap.isSeriesNumber(col, row);
@@ -49706,7 +49703,7 @@
49706
49703
  }
49707
49704
  }
49708
49705
 
49709
- class EditManeger {
49706
+ class EditManager {
49710
49707
  constructor(table) {
49711
49708
  this.isValidatingValue = !1, this.table = table, this.bindEvent();
49712
49709
  }
@@ -49781,14 +49778,17 @@
49781
49778
  if (editor.targetIsOnEditor(target)) return !1;
49782
49779
  } else if (!editor.isEditorElement || editor.isEditorElement(target)) return !1;
49783
49780
  if (this.editingEditor.getValue, this.editingEditor.validateValue) {
49784
- const maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a);
49781
+ this.isValidatingValue = !0;
49782
+ const newValue = this.editingEditor.getValue(),
49783
+ oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
49784
+ maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a, newValue, oldValue, this.editCell, this.table);
49785
49785
  return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
49786
49786
  maybePromiseOrValue.then(result => {
49787
- result ? (this.doExit(), resolve(!0)) : (this.isValidatingValue = !1, resolve(!1));
49787
+ dealWithValidateValue(result, this, oldValue, resolve);
49788
49788
  }).catch(err => {
49789
49789
  this.isValidatingValue = !1, reject(err);
49790
49790
  });
49791
- })) : !!maybePromiseOrValue && (this.doExit(), !0);
49791
+ })) : dealWithValidateValue(maybePromiseOrValue, this, oldValue);
49792
49792
  }
49793
49793
  return this.doExit(), !0;
49794
49794
  }
@@ -49809,6 +49809,9 @@
49809
49809
  this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null);
49810
49810
  }
49811
49811
  }
49812
+ function dealWithValidateValue(validateValue, editManager, oldValue, resolve) {
49813
+ return editManager.isValidatingValue = !1, "validate-exit" === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : "invalidate-exit" === validateValue ? (editManager.editingEditor.setValue(oldValue), editManager.doExit(), null == resolve || resolve(!0), !0) : "validate-not-exit" === validateValue || "invalidate-not-exit" === validateValue ? (null == resolve || resolve(!1), !1) : !0 === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : (null == resolve || resolve(!1), !1);
49814
+ }
49812
49815
 
49813
49816
  function getGroupByDataConfig(groupByOption) {
49814
49817
  if (isString$2(groupByOption)) return {
@@ -49852,12 +49855,13 @@
49852
49855
  newHeight = computeRowHeight(row, 0, table.colCount - 1, table);
49853
49856
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
49854
49857
  }
49855
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
49858
+ const changedValue = table.getCellOriginValue(col, row);
49859
+ oldValue !== changedValue && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
49856
49860
  col: col,
49857
49861
  row: row,
49858
49862
  rawValue: beforeChangeValue,
49859
49863
  currentValue: oldValue,
49860
- changedValue: table.getCellOriginValue(col, row)
49864
+ changedValue: changedValue
49861
49865
  }), table.scenegraph.updateNextFrame();
49862
49866
  }
49863
49867
  }
@@ -49893,7 +49897,7 @@
49893
49897
  oldValue = oldValues[i][j],
49894
49898
  value = rowValues[j],
49895
49899
  maybePromiseOrValue = null === (_b = null === (_a = null == editor ? void 0 : editor.validateValue) || void 0 === _a ? void 0 : _a.call(editor, value, oldValue)) || void 0 === _b || _b;
49896
- isCanChange = !!isPromise(maybePromiseOrValue) || maybePromiseOrValue;
49900
+ isCanChange = !!isPromise(maybePromiseOrValue) || !0 === maybePromiseOrValue || "validate-exit" === maybePromiseOrValue || "invalidate-exit" === maybePromiseOrValue;
49897
49901
  }
49898
49902
  if (isCanChange) {
49899
49903
  const value = rowValues[j],
@@ -49903,12 +49907,14 @@
49903
49907
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
49904
49908
  beforeChangeValue = beforeChangeValues[i][j],
49905
49909
  oldValue = oldValues[i][j];
49906
- table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table), table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
49910
+ table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
49911
+ const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
49912
+ oldValue !== changedValue && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
49907
49913
  col: startCol + j,
49908
49914
  row: startRow + i,
49909
49915
  rawValue: beforeChangeValue,
49910
49916
  currentValue: oldValue,
49911
- changedValue: table.getCellOriginValue(startCol + j, startRow + i)
49917
+ changedValue: changedValue
49912
49918
  });
49913
49919
  }
49914
49920
  }
@@ -50310,7 +50316,7 @@
50310
50316
  var _a, _b, _c, _d, _e, _f;
50311
50317
  "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), super(container, options), this.showHeader = !0;
50312
50318
  const internalProps = this.internalProps;
50313
- if (internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = options.groupBy ? getGroupByDataConfig(options.groupBy) : {}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_b = null !== (_a = options.enableTreeNodeMerge) && void 0 !== _a ? _a : isValid$1(options.groupBy)) && void 0 !== _b && _b, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, this.transpose = null !== (_d = options.transpose) && void 0 !== _d && _d, "node" !== Env.mode && (this.editorManager = new EditManeger(this)), this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? _setDataSource(this, options.dataSource) : options.records ? this.setRecords(options.records, {
50319
+ if (internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = options.groupBy ? getGroupByDataConfig(options.groupBy) : {}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_b = null !== (_a = options.enableTreeNodeMerge) && void 0 !== _a ? _a : isValid$1(options.groupBy)) && void 0 !== _b && _b, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, this.transpose = null !== (_d = options.transpose) && void 0 !== _d && _d, "node" !== Env.mode && (this.editorManager = new EditManager(this)), this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? _setDataSource(this, options.dataSource) : options.records ? this.setRecords(options.records, {
50314
50320
  sortState: internalProps.sortState
50315
50321
  }) : this.setRecords([]), options.title) {
50316
50322
  const Title = Factory.getComponent("title");
@@ -55039,7 +55045,7 @@
55039
55045
  }
55040
55046
 
55041
55047
  function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign, axisLength, target) {
55042
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
55048
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
55043
55049
  if ((null == axisOption ? void 0 : axisOption.zero) && (min = Math.min(min, 0), max = Math.max(max, 0)), null == axisOption ? void 0 : axisOption.expand) {
55044
55050
  const domainMin = min,
55045
55051
  domainMax = max;
@@ -55055,8 +55061,8 @@
55055
55061
  }
55056
55062
  })), "accurateFirst" === axisOption.niceType && (tickCount = Math.max(10, tickCount)), isNil$1(axisOption.min) && isNil$1(axisOption.max) ? scale.nice(tickCount) : isValid$1(axisOption.min) && isNil$1(axisOption.max) ? scale.niceMax(tickCount) : isNil$1(axisOption.min) && isValid$1(axisOption.max) && scale.niceMin(tickCount);
55057
55063
  }
55058
- return delete scale._niceType, scaleTicks = (null !== (_k = null === (_j = null == target ? void 0 : target.targetTicks) || void 0 === _j ? void 0 : _j.length) && void 0 !== _k ? _k : null === (_l = null == axisOption ? void 0 : axisOption.tick) || void 0 === _l ? void 0 : _l.forceTickCount) ? scale.forceTicks(null !== (_o = null === (_m = null == target ? void 0 : target.targetTicks) || void 0 === _m ? void 0 : _m.length) && void 0 !== _o ? _o : null === (_p = null == axisOption ? void 0 : axisOption.tick) || void 0 === _p ? void 0 : _p.forceTickCount) : scale.ticks(null !== (_r = null === (_q = null == axisOption ? void 0 : axisOption.tick) || void 0 === _q ? void 0 : _q.tickCount) && void 0 !== _r ? _r : 5, {
55059
- noDecimals: null === (_s = null == axisOption ? void 0 : axisOption.tick) || void 0 === _s ? void 0 : _s.noDecimals
55064
+ return delete scale._niceType, scaleTicks = (null !== (_k = null === (_j = null == target ? void 0 : target.targetTicks) || void 0 === _j ? void 0 : _j.length) && void 0 !== _k ? _k : null === (_l = null == axisOption ? void 0 : axisOption.tick) || void 0 === _l ? void 0 : _l.forceTickCount) ? scale.forceTicks(null !== (_o = null === (_m = null == target ? void 0 : target.targetTicks) || void 0 === _m ? void 0 : _m.length) && void 0 !== _o ? _o : null === (_p = null == axisOption ? void 0 : axisOption.tick) || void 0 === _p ? void 0 : _p.forceTickCount) : scale.ticks(isNumber$2(null === (_q = null == axisOption ? void 0 : axisOption.tick) || void 0 === _q ? void 0 : _q.tickCount) ? axisOption.tick.tickCount : 5, {
55065
+ noDecimals: null === (_r = null == axisOption ? void 0 : axisOption.tick) || void 0 === _r ? void 0 : _r.noDecimals
55060
55066
  }), {
55061
55067
  range: scale.domain(),
55062
55068
  ticks: scaleTicks