@visactor/vtable-calendar 1.11.2-alpha.3 → 1.11.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.
@@ -33680,8 +33680,9 @@
33680
33680
  dy: 0
33681
33681
  });
33682
33682
  }), renderDefault) {
33683
- const style = table._getCellStyle(colStart, rowStart);
33684
- updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, table);
33683
+ const style = table._getCellStyle(colStart, rowStart),
33684
+ padding = getQuadProps(getProp("padding", style, col, row, table));
33685
+ updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, padding, style.textAlign, style.textBaseline, table);
33685
33686
  }
33686
33687
  const rangeHeight = table.getRowHeight(row),
33687
33688
  rangeWidth = table.getColWidth(col);
@@ -33701,8 +33702,9 @@
33701
33702
  widthChange && (singleCellGroup.needUpdateWidth = !0);
33702
33703
  }
33703
33704
  } else {
33704
- const style = table._getCellStyle(cellGroup.col, cellGroup.row);
33705
- updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, table);
33705
+ const style = table._getCellStyle(cellGroup.col, cellGroup.row),
33706
+ padding = getQuadProps(getProp("padding", style, cellGroup.col, cellGroup.row, table));
33707
+ updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, style.textAlign, style.textBaseline, table);
33706
33708
  }
33707
33709
  }
33708
33710
 
@@ -33898,7 +33900,7 @@
33898
33900
  let changed = !1;
33899
33901
  if (renderDefault) {
33900
33902
  const style = table._getCellStyle(colStart, rowStart),
33901
- padding = getQuadProps(style.padding),
33903
+ padding = getQuadProps(getProp("padding", style, col, row, table)),
33902
33904
  textAlign = style.textAlign,
33903
33905
  textBaseline = style.textBaseline;
33904
33906
  changed = updateCellContentWidth(singleCellGroup, distWidth, cellHeight, detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
@@ -33929,7 +33931,7 @@
33929
33931
  return isHeightChange;
33930
33932
  }
33931
33933
  const style = table._getCellStyle(cellGroup.col, cellGroup.row),
33932
- padding = getQuadProps(style.padding),
33934
+ padding = getQuadProps(getProp("padding", style, cellGroup.col, cellGroup.row, table)),
33933
33935
  textAlign = style.textAlign,
33934
33936
  textBaseline = style.textBaseline;
33935
33937
  return updateCellContentWidth(cellGroup, distWidth, table.getRowHeight(cellGroup.row), detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
@@ -40752,12 +40754,16 @@
40752
40754
  function initCheckedState(records, state) {
40753
40755
  state.checkedState = [], state.headerCheckedState = {}, state.radioState = {};
40754
40756
  let isNeedInitHeaderCheckedStateFromRecord = !1;
40755
- state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
40757
+ if (state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
40756
40758
  if ("checkbox" === hd.headerType) {
40757
40759
  const headerChecked = hd.define.checked;
40758
40760
  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
40761
  }
40760
- }), isNeedInitHeaderCheckedStateFromRecord && records.forEach((record, index) => {
40762
+ }), 1 === state.table.leftRowSeriesNumberCount) state.headerCheckedState._vtable_rowSeries_number = !1, state._checkboxCellTypeFields.push("_vtable_rowSeries_number"), isNeedInitHeaderCheckedStateFromRecord = !0;else if (state.table.leftRowSeriesNumberCount > 1) {
40763
+ for (let i = 0; i < state.table.leftRowSeriesNumberCount; i++) state.headerCheckedState[`_vtable_rowSeries_number_${i}`] = !1, state._checkboxCellTypeFields.push(`_vtable_rowSeries_number_${i}`);
40764
+ isNeedInitHeaderCheckedStateFromRecord = !0;
40765
+ }
40766
+ isNeedInitHeaderCheckedStateFromRecord && records.forEach((record, index) => {
40761
40767
  state._checkboxCellTypeFields.forEach(field => {
40762
40768
  const value = record[field];
40763
40769
  let isChecked;
@@ -40801,14 +40807,28 @@
40801
40807
  }
40802
40808
  }
40803
40809
  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;
40810
+ const cellGroup = table.scenegraph.getCell(col, row),
40811
+ checkbox = null == cellGroup ? void 0 : cellGroup.getChildByName("checkbox");
40812
+ if (!checkbox) {
40813
+ const field = table.getHeaderField(col, row);
40814
+ if (table.isHeader(col, row)) {
40815
+ table.stateManager.setHeaderCheckedState(field, checked);
40816
+ "checkbox" === table.getCellType(col, row) && table.scenegraph.updateCheckboxCellState(col, row, checked);
40817
+ } else {
40818
+ table.stateManager.setCheckedState(col, row, field, checked);
40819
+ if ("checkbox" === table.getCellType(col, row)) {
40820
+ const oldHeaderCheckedState = table.stateManager.headerCheckedState[field],
40821
+ newHeaderCheckedState = table.stateManager.updateHeaderCheckedState(field, col, row);
40822
+ oldHeaderCheckedState !== newHeaderCheckedState && table.scenegraph.updateHeaderCheckboxCellState(col, row, newHeaderCheckedState);
40823
+ }
40824
+ }
40825
+ return;
40826
+ }
40807
40827
  const {
40808
40828
  checked: oldChecked,
40809
40829
  indeterminate: indeterminate
40810
- } = chechbox.attribute;
40811
- indeterminate ? (checked || chechbox._handlePointerUp(), chechbox._handlePointerUp()) : oldChecked ? checked || chechbox._handlePointerUp() : checked && chechbox._handlePointerUp();
40830
+ } = checkbox.attribute;
40831
+ indeterminate ? (checked || checkbox._handlePointerUp(), checkbox._handlePointerUp()) : oldChecked ? checked || checkbox._handlePointerUp() : checked && checkbox._handlePointerUp();
40812
40832
  }
40813
40833
  function changeCheckboxOrder(sourceIndex, targetIndex, state) {
40814
40834
  const {
@@ -41636,9 +41656,11 @@
41636
41656
  data = Object.assign({
41637
41657
  __value: cellValue,
41638
41658
  __dataValue: cellOriginValue
41639
- }, rowData),
41640
- re = /\{\s*(\S+?)\s*\}/g;
41641
- url = templateLink.replace(re, (matchs, key) => data[key]);
41659
+ }, rowData);
41660
+ if (isFunction$1(templateLink)) url = templateLink(data, col, row, table);else {
41661
+ const re = /\{\s*(\S+?)\s*\}/g;
41662
+ url = templateLink.replace(re, (matchs, key) => data[key]);
41663
+ }
41642
41664
  } else if (linkDetect) {
41643
41665
  if (!regUrl.test(cellValue)) return;
41644
41666
  url = cellValue;
@@ -44360,19 +44382,22 @@
44360
44382
  this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
44361
44383
  }
44362
44384
  getCustomCellStyle(col, row) {
44363
- const customStyleId = this.getCustomCellStyleId(col, row);
44364
- if (customStyleId) {
44365
- const styleOption = this.getCustomCellStyleOption(customStyleId);
44366
- return null == styleOption ? void 0 : styleOption.style;
44367
- }
44368
- }
44369
- getCustomCellStyleId(col, row) {
44370
- let customStyleId;
44371
- const range = this.table.getCellRange(col, row);
44385
+ const customStyleIds = this.getCustomCellStyleIds(col, row);
44386
+ if (customStyleIds.length) {
44387
+ const styles = [];
44388
+ return customStyleIds.forEach(customStyleId => {
44389
+ const styleOption = this.getCustomCellStyleOption(customStyleId);
44390
+ (null == styleOption ? void 0 : styleOption.style) && styles.push(styleOption.style);
44391
+ }), merge({}, ...styles);
44392
+ }
44393
+ }
44394
+ getCustomCellStyleIds(col, row) {
44395
+ const customStyleIds = [],
44396
+ range = this.table.getCellRange(col, row);
44372
44397
  for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.customCellStyleArrangement.forEach(style => {
44373
- style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && (customStyleId = style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && (customStyleId = style.customStyleId);
44398
+ style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId);
44374
44399
  });
44375
- return customStyleId;
44400
+ return customStyleIds;
44376
44401
  }
44377
44402
  getCustomCellStyleOption(customStyleId) {
44378
44403
  return this.customCellStyle.find(style => style.id === customStyleId);
@@ -45488,7 +45513,7 @@
45488
45513
  constructor(container) {
45489
45514
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45490
45515
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45491
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.2-alpha.3", 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");
45516
+ if (super(), this.showFrozenIcon = !0, this.version = "1.11.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");
45492
45517
  const {
45493
45518
  frozenColCount = 0,
45494
45519
  frozenRowCount: frozenRowCount,
@@ -45558,7 +45583,8 @@
45558
45583
  parentElement: this.getElement(),
45559
45584
  renderMode: "html",
45560
45585
  isShowOverflowTextTooltip: !1,
45561
- confine: !0
45586
+ confine: !0,
45587
+ position: Placement.bottom
45562
45588
  }, options.tooltip), "html" === internalProps.tooltip.renderMode) {
45563
45589
  const TooltipHandler = Factory.getComponent("tooltipHandler");
45564
45590
  TooltipHandler && (internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine));
@@ -46309,7 +46335,8 @@
46309
46335
  parentElement: this.getElement(),
46310
46336
  renderMode: "html",
46311
46337
  isShowOverflowTextTooltip: !1,
46312
- confine: !0
46338
+ confine: !0,
46339
+ position: Placement.bottom
46313
46340
  }, options.tooltip), "html" === internalProps.tooltip.renderMode && !internalProps.tooltipHandler) {
46314
46341
  const TooltipHandler = Factory.getComponent("tooltipHandler");
46315
46342
  internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine);
@@ -47930,18 +47957,20 @@
47930
47957
  }
47931
47958
  handleRowSeriesNumber(rowSeriesNumber) {
47932
47959
  var _a, _b;
47933
- rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map(seriesNumber => {
47934
- var _a, _b;
47960
+ rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map((seriesNumber, index) => {
47961
+ var _a, _b, _c;
47935
47962
  return {
47936
47963
  id: this.seqId++,
47937
47964
  title: seriesNumber.title,
47938
- define: seriesNumber,
47965
+ define: merge({
47966
+ field: "_vtable_rowSeries_number_" + index
47967
+ }, seriesNumber),
47939
47968
  cellType: null !== (_a = seriesNumber.cellType) && void 0 !== _a ? _a : "text",
47940
47969
  headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
47941
47970
  style: seriesNumber.style,
47942
47971
  width: seriesNumber.width,
47943
47972
  format: seriesNumber.format,
47944
- field: seriesNumber.field,
47973
+ field: null !== (_c = seriesNumber.field) && void 0 !== _c ? _c : "_vtable_rowSeries_number_" + index,
47945
47974
  icon: seriesNumber.icon,
47946
47975
  headerIcon: seriesNumber.headerIcon,
47947
47976
  isChildNode: !1
@@ -47949,13 +47978,15 @@
47949
47978
  }) : this.rowSeriesNumberColumn = [{
47950
47979
  id: this.seqId++,
47951
47980
  title: rowSeriesNumber.title,
47952
- define: rowSeriesNumber,
47981
+ define: merge({
47982
+ field: "_vtable_rowSeries_number"
47983
+ }, rowSeriesNumber),
47953
47984
  cellType: null !== (_a = rowSeriesNumber.cellType) && void 0 !== _a ? _a : "text",
47954
47985
  headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
47955
47986
  style: rowSeriesNumber.style,
47956
47987
  width: rowSeriesNumber.width,
47957
47988
  format: rowSeriesNumber.format,
47958
- field: "",
47989
+ field: "_vtable_rowSeries_number",
47959
47990
  icon: rowSeriesNumber.icon,
47960
47991
  headerIcon: rowSeriesNumber.headerIcon,
47961
47992
  isChildNode: !1
@@ -48348,9 +48379,11 @@
48348
48379
  return this._headerObjectMap[id];
48349
48380
  }
48350
48381
  getHeaderField(col, row) {
48351
- var _a;
48382
+ var _a, _b, _c;
48383
+ if (this.isSeriesNumberInHeader(col, row)) return null === (_a = this.getSeriesNumberHeader(col, row)) || void 0 === _a ? void 0 : _a.field;
48384
+ if (this.isSeriesNumberInBody(col, row)) return null === (_b = this.getSeriesNumberBody(col, row)) || void 0 === _b ? void 0 : _b.field;
48352
48385
  const id = this.getCellId(col, row);
48353
- 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);
48386
+ 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);
48354
48387
  }
48355
48388
  getHeaderCellAdressById(id) {
48356
48389
  for (let i = 0; i < this._headerCellIds.length; i++) {
@@ -51616,7 +51649,7 @@
51616
51649
  tooltipOption = {
51617
51650
  content: headerDescription,
51618
51651
  referencePosition: {
51619
- placement: Placement.bottom,
51652
+ placement: table.internalProps.tooltip.position,
51620
51653
  rect: rect
51621
51654
  },
51622
51655
  disappearDelay: null !== (_a = table.internalProps.tooltip.overflowTextTooltipDisappearDelay) && void 0 !== _a ? _a : 0,
@@ -51631,7 +51664,7 @@
51631
51664
  overflowText && (tooltipOption = {
51632
51665
  content: headerDescription ? `${headerDescription}\n ${overflowText}` : overflowText,
51633
51666
  referencePosition: {
51634
- placement: Placement.bottom,
51667
+ placement: table.internalProps.tooltip.position,
51635
51668
  rect: rect
51636
51669
  },
51637
51670
  disappearDelay: null !== (_c = table.internalProps.tooltip.overflowTextTooltipDisappearDelay) && void 0 !== _c ? _c : 0,