@visactor/vtable-calendar 1.13.3-alpha.6 → 1.14.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.
@@ -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
  }
@@ -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.0", 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,
@@ -46789,13 +46786,15 @@
46789
46786
  heightWithoutPadding = 0;
46790
46787
  if (this.canvasSizeSeted) widthWithoutPadding = this.canvasWidth, heightWithoutPadding = this.canvasHeight;else if (element.parentElement) {
46791
46788
  const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
46792
- widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10), heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20), widthWithoutPadding = (null != widthWithoutPadding ? widthWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), heightWithoutPadding = (null != heightWithoutPadding ? heightWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0);
46789
+ widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10), heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20);
46793
46790
  }
46794
- element.style.width = widthWithoutPadding && widthWithoutPadding - padding.left - padding.right + "px" || "0px", element.style.height = heightWithoutPadding && heightWithoutPadding - padding.top - padding.bottom + "px" || "0px";
46791
+ const width1 = null != widthWithoutPadding ? widthWithoutPadding : 0,
46792
+ height1 = null != heightWithoutPadding ? heightWithoutPadding : 0;
46793
+ element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px", element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
46795
46794
  const {
46796
46795
  canvas: canvas
46797
46796
  } = this.internalProps;
46798
- widthP = (null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), heightP = (null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), (null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "", canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`, canvas.style.height = `${heightP}px`);
46797
+ widthP = null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 0, heightP = null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 0, (null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "", canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`, canvas.style.height = `${heightP}px`);
46799
46798
  } else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
46800
46799
  const width = Math.floor(widthP - getVerticalScrollBarSize(this.getTheme().scrollStyle)),
46801
46800
  height = Math.floor(heightP - getHorizontalScrollBarSize(this.getTheme().scrollStyle));
@@ -48177,9 +48176,9 @@
48177
48176
  var _a;
48178
48177
  null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.registerCustomCellStyle(customStyleId, customStyle);
48179
48178
  }
48180
- arrangeCustomCellStyle(cellPos, customStyleId) {
48179
+ arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
48181
48180
  var _a;
48182
- null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId);
48181
+ null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate);
48183
48182
  }
48184
48183
  isSeriesNumber(col, row) {
48185
48184
  return this.internalProps.layoutMap.isSeriesNumber(col, row);
@@ -49706,7 +49705,7 @@
49706
49705
  }
49707
49706
  }
49708
49707
 
49709
- class EditManeger {
49708
+ class EditManager {
49710
49709
  constructor(table) {
49711
49710
  this.isValidatingValue = !1, this.table = table, this.bindEvent();
49712
49711
  }
@@ -49781,14 +49780,17 @@
49781
49780
  if (editor.targetIsOnEditor(target)) return !1;
49782
49781
  } else if (!editor.isEditorElement || editor.isEditorElement(target)) return !1;
49783
49782
  if (this.editingEditor.getValue, this.editingEditor.validateValue) {
49784
- const maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a);
49783
+ this.isValidatingValue = !0;
49784
+ const newValue = this.editingEditor.getValue(),
49785
+ oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
49786
+ maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a, newValue, oldValue, this.editCell, this.table);
49785
49787
  return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
49786
49788
  maybePromiseOrValue.then(result => {
49787
- result ? (this.doExit(), resolve(!0)) : (this.isValidatingValue = !1, resolve(!1));
49789
+ dealWithValidateValue(result, this, oldValue, resolve);
49788
49790
  }).catch(err => {
49789
49791
  this.isValidatingValue = !1, reject(err);
49790
49792
  });
49791
- })) : !!maybePromiseOrValue && (this.doExit(), !0);
49793
+ })) : dealWithValidateValue(maybePromiseOrValue, this, oldValue);
49792
49794
  }
49793
49795
  return this.doExit(), !0;
49794
49796
  }
@@ -49809,6 +49811,9 @@
49809
49811
  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
49812
  }
49811
49813
  }
49814
+ function dealWithValidateValue(validateValue, editManager, oldValue, resolve) {
49815
+ 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);
49816
+ }
49812
49817
 
49813
49818
  function getGroupByDataConfig(groupByOption) {
49814
49819
  if (isString$2(groupByOption)) return {
@@ -49893,7 +49898,7 @@
49893
49898
  oldValue = oldValues[i][j],
49894
49899
  value = rowValues[j],
49895
49900
  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;
49901
+ isCanChange = !!isPromise(maybePromiseOrValue) || !0 === maybePromiseOrValue || "validate-exit" === maybePromiseOrValue || "invalidate-exit" === maybePromiseOrValue;
49897
49902
  }
49898
49903
  if (isCanChange) {
49899
49904
  const value = rowValues[j],
@@ -50310,7 +50315,7 @@
50310
50315
  var _a, _b, _c, _d, _e, _f;
50311
50316
  "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
50317
  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, {
50318
+ 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
50319
  sortState: internalProps.sortState
50315
50320
  }) : this.setRecords([]), options.title) {
50316
50321
  const Title = Factory.getComponent("title");
@@ -55039,7 +55044,7 @@
55039
55044
  }
55040
55045
 
55041
55046
  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;
55047
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
55043
55048
  if ((null == axisOption ? void 0 : axisOption.zero) && (min = Math.min(min, 0), max = Math.max(max, 0)), null == axisOption ? void 0 : axisOption.expand) {
55044
55049
  const domainMin = min,
55045
55050
  domainMax = max;
@@ -55055,8 +55060,8 @@
55055
55060
  }
55056
55061
  })), "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
55062
  }
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
55063
+ 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, {
55064
+ noDecimals: null === (_r = null == axisOption ? void 0 : axisOption.tick) || void 0 === _r ? void 0 : _r.noDecimals
55060
55065
  }), {
55061
55066
  range: scale.domain(),
55062
55067
  ticks: scaleTicks