@visactor/vtable-calendar 1.17.1-alpha.2 → 1.17.1-alpha.4

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.
@@ -41410,8 +41410,7 @@
41410
41410
  updateReactContainer(this.table);
41411
41411
  }
41412
41412
  setLoadingHierarchyState(col, row) {
41413
- const cellGroup = this.getCell(col, row),
41414
- iconGraphic = cellGroup.getChildByName("collapse", !0) || cellGroup.getChildByName("expand", !0);
41413
+ const iconGraphic = this.getCell(col, row).getChildByName("collapse", !0);
41415
41414
  if (iconGraphic) {
41416
41415
  const loadingIcon = get$2()[InternalIconName.loadingIconName];
41417
41416
  loadingIcon && dealWithIcon(loadingIcon, iconGraphic, col, row);
@@ -42314,7 +42313,14 @@
42314
42313
  if (recordIndex >= 0) {
42315
42314
  const dataIndex = state.table.dataSource.getIndexKey(recordIndex).toString();
42316
42315
  if (isValid$3(null === (_b = state.checkedState.get(dataIndex)) || void 0 === _b ? void 0 : _b[field])) return state.checkedState.get(dataIndex)[field];
42317
- state.checkedState.has(dataIndex) ? state.checkedState.get(dataIndex)[field] = checked : state.checkedState.set(dataIndex, {
42316
+ if (state.checkedState.has(dataIndex)) state.checkedState.get(dataIndex)[field] = checked;else if (dataIndex.includes(",")) {
42317
+ const parentDataIndex = dataIndex.split(",").slice(0, -1).join(",");
42318
+ state.checkedState.has(parentDataIndex) && !0 === state.checkedState.get(parentDataIndex)[field] ? state.checkedState.set(dataIndex, {
42319
+ [field]: !0
42320
+ }) : state.checkedState.set(dataIndex, {
42321
+ [field]: checked
42322
+ });
42323
+ } else state.checkedState.set(dataIndex, {
42318
42324
  [field]: checked
42319
42325
  });
42320
42326
  }
@@ -44538,7 +44544,7 @@
44538
44544
 
44539
44545
  function bindGroupTitleCheckboxChange(table) {
44540
44546
  table.on("checkbox_state_change", args => {
44541
- var _a;
44547
+ var _a, _b;
44542
44548
  if (!0 !== (null === (_a = table.internalProps.rowSeriesNumber) || void 0 === _a ? void 0 : _a.enableTreeCheckbox)) return;
44543
44549
  const {
44544
44550
  col: col,
@@ -44549,7 +44555,7 @@
44549
44555
  indexedData = table.dataSource.currentPagerIndexedData,
44550
44556
  titleShowIndex = table.getRecordShowIndexByCell(col, row);
44551
44557
  let titleIndex = indexedData[titleShowIndex];
44552
- if (isNumber$4(titleIndex) && (titleIndex = [titleIndex]), record.vtableMerge) {
44558
+ if (isNumber$4(titleIndex) && (titleIndex = [titleIndex]), record.vtableMerge || (null === (_b = record.children) || void 0 === _b ? void 0 : _b.length)) {
44553
44559
  if (checked) table.getHierarchyState(col, row) === HierarchyState.collapse ? updateChildrenCheckboxState(!0, titleIndex, table) : setAllChildrenCheckboxState(!0, titleShowIndex, titleIndex, indexedData, table), updateGroupTitleCheckboxState(titleShowIndex, titleIndex, indexedData, table);else {
44554
44560
  table.getHierarchyState(col, row) === HierarchyState.collapse ? updateChildrenCheckboxState(!1, titleIndex, table) : setAllChildrenCheckboxState(!1, titleShowIndex, titleIndex, indexedData, table), updateGroupTitleCheckboxState(titleShowIndex, titleIndex, indexedData, table);
44555
44561
  const oldHeaderCheckedState = table.stateManager.headerCheckedState._vtable_rowSeries_number,
@@ -44587,8 +44593,23 @@
44587
44593
  key = currentIndex.toString(),
44588
44594
  currentIndexLength = isArray$7(currentIndex) ? currentIndex.length : 1;
44589
44595
  let start = !1;
44590
- const result = [];
44591
- if (checkedState.forEach((value, index) => {
44596
+ const result = [],
44597
+ keys = Array.from(checkedState.keys()).sort((a, b) => {
44598
+ var _a, _b;
44599
+ const aArr = a.split(","),
44600
+ bArr = b.split(","),
44601
+ maxLength = Math.max(aArr.length, bArr.length);
44602
+ for (let i = 0; i < maxLength; i++) {
44603
+ const a = null !== (_a = Number(aArr[i])) && void 0 !== _a ? _a : 0,
44604
+ b = null !== (_b = Number(bArr[i])) && void 0 !== _b ? _b : 0;
44605
+ if (a !== b) return a - b;
44606
+ }
44607
+ return 0;
44608
+ }),
44609
+ stateArr = keys.map(key => checkedState.get(key));
44610
+ if (stateArr.forEach((state, i) => {
44611
+ const index = keys[i],
44612
+ value = state;
44592
44613
  if (start) {
44593
44614
  index.split(",").length === currentIndexLength ? start = !1 : result.push(value._vtable_rowSeries_number);
44594
44615
  }
@@ -47419,7 +47440,7 @@
47419
47440
  constructor(container) {
47420
47441
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
47421
47442
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
47422
- if (super(), this.showFrozenIcon = !0, this.version = "1.17.1-alpha.2", 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");
47443
+ if (super(), this.showFrozenIcon = !0, this.version = "1.17.1-alpha.4", 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");
47423
47444
  !1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
47424
47445
  const {
47425
47446
  frozenColCount = 0,
@@ -52512,7 +52533,18 @@
52512
52533
  }
52513
52534
  getCheckboxState(field) {
52514
52535
  if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount && this.stateManager.initLeftRecordsCheckState(this.records), isValid$3(field)) {
52515
- let stateArr = Array.from(this.stateManager.checkedState.keys()).sort((a, b) => Number(a) - Number(b)).map(key => this.stateManager.checkedState.get(key));
52536
+ let stateArr = Array.from(this.stateManager.checkedState.keys()).sort((a, b) => {
52537
+ var _a, _b;
52538
+ const aArr = a.split(","),
52539
+ bArr = b.split(","),
52540
+ maxLength = Math.max(aArr.length, bArr.length);
52541
+ for (let i = 0; i < maxLength; i++) {
52542
+ const a = null !== (_a = Number(aArr[i])) && void 0 !== _a ? _a : 0,
52543
+ b = null !== (_b = Number(bArr[i])) && void 0 !== _b ? _b : 0;
52544
+ if (a !== b) return a - b;
52545
+ }
52546
+ return 0;
52547
+ }).map(key => this.stateManager.checkedState.get(key));
52516
52548
  return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), Array.from(stateArr, state => state[field]);
52517
52549
  }
52518
52550
  return new Array(...this.stateManager.checkedState.values());