@visactor/vtable-calendar 1.11.1 → 1.11.2-alpha.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.
@@ -40752,12 +40752,16 @@
40752
40752
  function initCheckedState(records, state) {
40753
40753
  state.checkedState = [], state.headerCheckedState = {}, state.radioState = {};
40754
40754
  let isNeedInitHeaderCheckedStateFromRecord = !1;
40755
- state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
40755
+ if (state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
40756
40756
  if ("checkbox" === hd.headerType) {
40757
40757
  const headerChecked = hd.define.checked;
40758
40758
  null == headerChecked || "function" == typeof headerChecked ? (isNeedInitHeaderCheckedStateFromRecord = !0, "function" == typeof headerChecked && (state._headerCheckFuncs[hd.field] = headerChecked)) : state.headerCheckedState[hd.field] = headerChecked, "checkbox" !== hd.define.cellType || hd.fieldFormat || state._checkboxCellTypeFields.push(hd.field);
40759
40759
  }
40760
- }), isNeedInitHeaderCheckedStateFromRecord && records.forEach((record, index) => {
40760
+ }), 1 === state.table.leftRowSeriesNumberCount) state.headerCheckedState._vtable_rowSeries_number = !1, state._checkboxCellTypeFields.push("_vtable_rowSeries_number"), isNeedInitHeaderCheckedStateFromRecord = !0;else if (state.table.leftRowSeriesNumberCount > 1) {
40761
+ for (let i = 0; i < state.table.leftRowSeriesNumberCount; i++) state.headerCheckedState[`_vtable_rowSeries_number_${i}`] = !1, state._checkboxCellTypeFields.push(`_vtable_rowSeries_number_${i}`);
40762
+ isNeedInitHeaderCheckedStateFromRecord = !0;
40763
+ }
40764
+ isNeedInitHeaderCheckedStateFromRecord && records.forEach((record, index) => {
40761
40765
  state._checkboxCellTypeFields.forEach(field => {
40762
40766
  const value = record[field];
40763
40767
  let isChecked;
@@ -40801,14 +40805,28 @@
40801
40805
  }
40802
40806
  }
40803
40807
  function setCellCheckboxState(col, row, checked, table) {
40804
- const cellGoup = table.scenegraph.getCell(col, row),
40805
- chechbox = null == cellGoup ? void 0 : cellGoup.getChildByName("checkbox");
40806
- if (!chechbox) return;
40808
+ const cellGroup = table.scenegraph.getCell(col, row),
40809
+ checkbox = null == cellGroup ? void 0 : cellGroup.getChildByName("checkbox");
40810
+ if (!checkbox) {
40811
+ const field = table.getHeaderField(col, row);
40812
+ if (table.isHeader(col, row)) {
40813
+ table.stateManager.setHeaderCheckedState(field, checked);
40814
+ "checkbox" === table.getCellType(col, row) && table.scenegraph.updateCheckboxCellState(col, row, checked);
40815
+ } else {
40816
+ table.stateManager.setCheckedState(col, row, field, checked);
40817
+ if ("checkbox" === table.getCellType(col, row)) {
40818
+ const oldHeaderCheckedState = table.stateManager.headerCheckedState[field],
40819
+ newHeaderCheckedState = table.stateManager.updateHeaderCheckedState(field, col, row);
40820
+ oldHeaderCheckedState !== newHeaderCheckedState && table.scenegraph.updateHeaderCheckboxCellState(col, row, newHeaderCheckedState);
40821
+ }
40822
+ }
40823
+ return;
40824
+ }
40807
40825
  const {
40808
40826
  checked: oldChecked,
40809
40827
  indeterminate: indeterminate
40810
- } = chechbox.attribute;
40811
- indeterminate ? (checked || chechbox._handlePointerUp(), chechbox._handlePointerUp()) : oldChecked ? checked || chechbox._handlePointerUp() : checked && chechbox._handlePointerUp();
40828
+ } = checkbox.attribute;
40829
+ indeterminate ? (checked || checkbox._handlePointerUp(), checkbox._handlePointerUp()) : oldChecked ? checked || checkbox._handlePointerUp() : checked && checkbox._handlePointerUp();
40812
40830
  }
40813
40831
  function changeCheckboxOrder(sourceIndex, targetIndex, state) {
40814
40832
  const {
@@ -45474,7 +45492,7 @@
45474
45492
  constructor(container) {
45475
45493
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45476
45494
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45477
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.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");
45495
+ if (super(), this.showFrozenIcon = !0, this.version = "1.11.2-alpha.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");
45478
45496
  const {
45479
45497
  frozenColCount = 0,
45480
45498
  frozenRowCount: frozenRowCount,
@@ -47916,18 +47934,20 @@
47916
47934
  }
47917
47935
  handleRowSeriesNumber(rowSeriesNumber) {
47918
47936
  var _a, _b;
47919
- rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map(seriesNumber => {
47920
- var _a, _b;
47937
+ rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map((seriesNumber, index) => {
47938
+ var _a, _b, _c;
47921
47939
  return {
47922
47940
  id: this.seqId++,
47923
47941
  title: seriesNumber.title,
47924
- define: seriesNumber,
47942
+ define: merge({
47943
+ field: "_vtable_rowSeries_number_" + index
47944
+ }, seriesNumber),
47925
47945
  cellType: null !== (_a = seriesNumber.cellType) && void 0 !== _a ? _a : "text",
47926
47946
  headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
47927
47947
  style: seriesNumber.style,
47928
47948
  width: seriesNumber.width,
47929
47949
  format: seriesNumber.format,
47930
- field: seriesNumber.field,
47950
+ field: null !== (_c = seriesNumber.field) && void 0 !== _c ? _c : "_vtable_rowSeries_number_" + index,
47931
47951
  icon: seriesNumber.icon,
47932
47952
  headerIcon: seriesNumber.headerIcon,
47933
47953
  isChildNode: !1
@@ -47935,13 +47955,15 @@
47935
47955
  }) : this.rowSeriesNumberColumn = [{
47936
47956
  id: this.seqId++,
47937
47957
  title: rowSeriesNumber.title,
47938
- define: rowSeriesNumber,
47958
+ define: merge({
47959
+ field: "_vtable_rowSeries_number"
47960
+ }, rowSeriesNumber),
47939
47961
  cellType: null !== (_a = rowSeriesNumber.cellType) && void 0 !== _a ? _a : "text",
47940
47962
  headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
47941
47963
  style: rowSeriesNumber.style,
47942
47964
  width: rowSeriesNumber.width,
47943
47965
  format: rowSeriesNumber.format,
47944
- field: "",
47966
+ field: "_vtable_rowSeries_number",
47945
47967
  icon: rowSeriesNumber.icon,
47946
47968
  headerIcon: rowSeriesNumber.headerIcon,
47947
47969
  isChildNode: !1
@@ -48334,9 +48356,11 @@
48334
48356
  return this._headerObjectMap[id];
48335
48357
  }
48336
48358
  getHeaderField(col, row) {
48337
- var _a;
48359
+ var _a, _b, _c;
48360
+ if (this.isSeriesNumberInHeader(col, row)) return null === (_a = this.getSeriesNumberHeader(col, row)) || void 0 === _a ? void 0 : _a.field;
48361
+ if (this.isSeriesNumberInBody(col, row)) return null === (_b = this.getSeriesNumberBody(col, row)) || void 0 === _b ? void 0 : _b.field;
48338
48362
  const id = this.getCellId(col, row);
48339
- return (null === (_a = this._headerObjectMap[id]) || void 0 === _a ? void 0 : _a.field) || (this.transpose ? this._columns[row] && this._columns[row].field : this._columns[col - this.leftRowSeriesNumberColumnCount] && this._columns[col - this.leftRowSeriesNumberColumnCount].field);
48363
+ return (null === (_c = this._headerObjectMap[id]) || void 0 === _c ? void 0 : _c.field) || (this.transpose ? this._columns[row] && this._columns[row].field : this._columns[col - this.leftRowSeriesNumberColumnCount] && this._columns[col - this.leftRowSeriesNumberColumnCount].field);
48340
48364
  }
48341
48365
  getHeaderCellAdressById(id) {
48342
48366
  for (let i = 0; i < this._headerCellIds.length; i++) {