@visactor/vtable-gantt 1.11.2-alpha.2 → 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.
@@ -26864,7 +26864,7 @@
26864
26864
  if (this.gridStyle?.verticalLine.lineWidth & 1) {
26865
26865
  x = 0.5;
26866
26866
  }
26867
- for (let i = 0; i < this.timelineDates.length - 1; i++) {
26867
+ for (let i = 0; i < this.timelineDates?.length - 1; i++) {
26868
26868
  const dateline = this.timelineDates[i];
26869
26869
  x = x + Math.floor(this.colWidthPerDay * dateline.days);
26870
26870
  const line = createLine({
@@ -28038,7 +28038,7 @@
28038
28038
  dateHeader.addChild(rowHeader);
28039
28039
  const { unit, timelineDates, customLayout } = scene._gantt.parsedOptions.sortedTimelineScales[i];
28040
28040
  let x = 0;
28041
- for (let j = 0; j < timelineDates.length; j++) {
28041
+ for (let j = 0; j < timelineDates?.length; j++) {
28042
28042
  const { days, endDate, startDate, title, dateIndex } = timelineDates[j];
28043
28043
  const date = new Group$2({
28044
28044
  x,
@@ -29550,11 +29550,14 @@
29550
29550
  }
29551
29551
  refreshAll() {
29552
29552
  this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);
29553
+ this.tableGroupWidth = this._gantt.tableNoFrameWidth;
29553
29554
  this.tableGroup.setAttribute('height', this.tableGroupHeight);
29555
+ this.tableGroup.setAttribute('width', this.tableGroupWidth);
29554
29556
  this.timelineHeader.refresh();
29555
29557
  this.grid.refresh();
29556
29558
  this.taskBar.refresh();
29557
29559
  this.markLine.refresh();
29560
+ this.dependencyLink.refresh();
29558
29561
  this.frameBorder.resize();
29559
29562
  this.scrollbarComponent.updateScrollBar();
29560
29563
  this.updateNextFrame();
@@ -29577,6 +29580,7 @@
29577
29580
  }
29578
29581
  updateTableSize() {
29579
29582
  this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);
29583
+ this.tableGroupWidth = this._gantt.tableNoFrameWidth;
29580
29584
  this.tableGroup.setAttributes({
29581
29585
  x: this._gantt.tableX,
29582
29586
  y: this._gantt.tableY,
@@ -36689,8 +36693,9 @@
36689
36693
  dy: 0
36690
36694
  });
36691
36695
  }), renderDefault) {
36692
- const style = table._getCellStyle(colStart, rowStart);
36693
- updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, table);
36696
+ const style = table._getCellStyle(colStart, rowStart),
36697
+ padding = getQuadProps(getProp("padding", style, col, row, table));
36698
+ updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, padding, style.textAlign, style.textBaseline, table);
36694
36699
  }
36695
36700
  const rangeHeight = table.getRowHeight(row),
36696
36701
  rangeWidth = table.getColWidth(col);
@@ -36710,8 +36715,9 @@
36710
36715
  widthChange && (singleCellGroup.needUpdateWidth = !0);
36711
36716
  }
36712
36717
  } else {
36713
- const style = table._getCellStyle(cellGroup.col, cellGroup.row);
36714
- updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, table);
36718
+ const style = table._getCellStyle(cellGroup.col, cellGroup.row),
36719
+ padding = getQuadProps(getProp("padding", style, cellGroup.col, cellGroup.row, table));
36720
+ updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, style.textAlign, style.textBaseline, table);
36715
36721
  }
36716
36722
  }
36717
36723
 
@@ -36907,7 +36913,7 @@
36907
36913
  let changed = !1;
36908
36914
  if (renderDefault) {
36909
36915
  const style = table._getCellStyle(colStart, rowStart),
36910
- padding = getQuadProps(style.padding),
36916
+ padding = getQuadProps(getProp("padding", style, col, row, table)),
36911
36917
  textAlign = style.textAlign,
36912
36918
  textBaseline = style.textBaseline;
36913
36919
  changed = updateCellContentWidth(singleCellGroup, distWidth, cellHeight, detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
@@ -36938,7 +36944,7 @@
36938
36944
  return isHeightChange;
36939
36945
  }
36940
36946
  const style = table._getCellStyle(cellGroup.col, cellGroup.row),
36941
- padding = getQuadProps(style.padding),
36947
+ padding = getQuadProps(getProp("padding", style, cellGroup.col, cellGroup.row, table)),
36942
36948
  textAlign = style.textAlign,
36943
36949
  textBaseline = style.textBaseline;
36944
36950
  return updateCellContentWidth(cellGroup, distWidth, table.getRowHeight(cellGroup.row), detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
@@ -43761,12 +43767,16 @@
43761
43767
  function initCheckedState(records, state) {
43762
43768
  state.checkedState = [], state.headerCheckedState = {}, state.radioState = {};
43763
43769
  let isNeedInitHeaderCheckedStateFromRecord = !1;
43764
- state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
43770
+ if (state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
43765
43771
  if ("checkbox" === hd.headerType) {
43766
43772
  const headerChecked = hd.define.checked;
43767
43773
  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);
43768
43774
  }
43769
- }), isNeedInitHeaderCheckedStateFromRecord && records.forEach((record, index) => {
43775
+ }), 1 === state.table.leftRowSeriesNumberCount) state.headerCheckedState._vtable_rowSeries_number = !1, state._checkboxCellTypeFields.push("_vtable_rowSeries_number"), isNeedInitHeaderCheckedStateFromRecord = !0;else if (state.table.leftRowSeriesNumberCount > 1) {
43776
+ for (let i = 0; i < state.table.leftRowSeriesNumberCount; i++) state.headerCheckedState[`_vtable_rowSeries_number_${i}`] = !1, state._checkboxCellTypeFields.push(`_vtable_rowSeries_number_${i}`);
43777
+ isNeedInitHeaderCheckedStateFromRecord = !0;
43778
+ }
43779
+ isNeedInitHeaderCheckedStateFromRecord && records.forEach((record, index) => {
43770
43780
  state._checkboxCellTypeFields.forEach(field => {
43771
43781
  const value = record[field];
43772
43782
  let isChecked;
@@ -43810,14 +43820,28 @@
43810
43820
  }
43811
43821
  }
43812
43822
  function setCellCheckboxState(col, row, checked, table) {
43813
- const cellGoup = table.scenegraph.getCell(col, row),
43814
- chechbox = null == cellGoup ? void 0 : cellGoup.getChildByName("checkbox");
43815
- if (!chechbox) return;
43823
+ const cellGroup = table.scenegraph.getCell(col, row),
43824
+ checkbox = null == cellGroup ? void 0 : cellGroup.getChildByName("checkbox");
43825
+ if (!checkbox) {
43826
+ const field = table.getHeaderField(col, row);
43827
+ if (table.isHeader(col, row)) {
43828
+ table.stateManager.setHeaderCheckedState(field, checked);
43829
+ "checkbox" === table.getCellType(col, row) && table.scenegraph.updateCheckboxCellState(col, row, checked);
43830
+ } else {
43831
+ table.stateManager.setCheckedState(col, row, field, checked);
43832
+ if ("checkbox" === table.getCellType(col, row)) {
43833
+ const oldHeaderCheckedState = table.stateManager.headerCheckedState[field],
43834
+ newHeaderCheckedState = table.stateManager.updateHeaderCheckedState(field, col, row);
43835
+ oldHeaderCheckedState !== newHeaderCheckedState && table.scenegraph.updateHeaderCheckboxCellState(col, row, newHeaderCheckedState);
43836
+ }
43837
+ }
43838
+ return;
43839
+ }
43816
43840
  const {
43817
43841
  checked: oldChecked,
43818
43842
  indeterminate: indeterminate
43819
- } = chechbox.attribute;
43820
- indeterminate ? (checked || chechbox._handlePointerUp(), chechbox._handlePointerUp()) : oldChecked ? checked || chechbox._handlePointerUp() : checked && chechbox._handlePointerUp();
43843
+ } = checkbox.attribute;
43844
+ indeterminate ? (checked || checkbox._handlePointerUp(), checkbox._handlePointerUp()) : oldChecked ? checked || checkbox._handlePointerUp() : checked && checkbox._handlePointerUp();
43821
43845
  }
43822
43846
  function changeCheckboxOrder(sourceIndex, targetIndex, state) {
43823
43847
  const {
@@ -44645,9 +44669,11 @@
44645
44669
  data = Object.assign({
44646
44670
  __value: cellValue,
44647
44671
  __dataValue: cellOriginValue
44648
- }, rowData),
44649
- re = /\{\s*(\S+?)\s*\}/g;
44650
- url = templateLink.replace(re, (matchs, key) => data[key]);
44672
+ }, rowData);
44673
+ if (isFunction$1(templateLink)) url = templateLink(data, col, row, table);else {
44674
+ const re = /\{\s*(\S+?)\s*\}/g;
44675
+ url = templateLink.replace(re, (matchs, key) => data[key]);
44676
+ }
44651
44677
  } else if (linkDetect) {
44652
44678
  if (!regUrl.test(cellValue)) return;
44653
44679
  url = cellValue;
@@ -46316,12 +46342,14 @@
46316
46342
  }
46317
46343
  class MenuElement {
46318
46344
  constructor(table) {
46319
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46345
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
46320
46346
  this._handler = new EventHandler$1(), this._rootElement = createMenuDomElement$1(), this._secondElement = createMenuDomElement$1(), this._secondElement.sub = !0, this._showChildrenIndex = -1, this._rootElement.addEventListener("wheel", e => {
46321
46347
  e.stopPropagation();
46322
46348
  }), null === (_a = this._rootElement) || void 0 === _a || _a.addEventListener("mousedown", e => {
46323
46349
  e.stopPropagation(), e.preventDefault();
46324
- }), null === (_b = this._rootElement) || void 0 === _b || _b.addEventListener("touchend", e => {
46350
+ }), null === (_b = this._rootElement) || void 0 === _b || _b.addEventListener("contextmenu", e => {
46351
+ e.stopPropagation(), e.preventDefault();
46352
+ }), null === (_c = this._rootElement) || void 0 === _c || _c.addEventListener("touchend", e => {
46325
46353
  if (e.stopPropagation(), e.preventDefault(), this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46326
46354
  const {
46327
46355
  col: col,
@@ -46344,7 +46372,7 @@
46344
46372
  cellLocation: table.getCellLocation(col, row),
46345
46373
  event: e
46346
46374
  }), table.fireListeners(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLEAR, null), table.fireListeners(TABLE_EVENT_TYPE.HIDE_MENU, null), e.stopPropagation();
46347
- }), null === (_c = this._rootElement) || void 0 === _c || _c.addEventListener("click", e => {
46375
+ }), null === (_d = this._rootElement) || void 0 === _d || _d.addEventListener("click", e => {
46348
46376
  if (e.stopPropagation(), e.preventDefault(), this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46349
46377
  const {
46350
46378
  col: col,
@@ -46367,7 +46395,7 @@
46367
46395
  cellLocation: table.getCellLocation(col, row),
46368
46396
  event: e
46369
46397
  }), table.fireListeners(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLEAR, null), table.fireListeners(TABLE_EVENT_TYPE.HIDE_MENU, null), e.stopPropagation();
46370
- }), null === (_d = this._rootElement) || void 0 === _d || _d.addEventListener("mousemove", e => {
46398
+ }), null === (_e = this._rootElement) || void 0 === _e || _e.addEventListener("mousemove", e => {
46371
46399
  var _a, _b;
46372
46400
  if (this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46373
46401
  e.stopPropagation();
@@ -46400,17 +46428,17 @@
46400
46428
  null == secondElement || secondElement.classList.remove(SHOWN_CLASSNAME$1), null == secondElement || secondElement.classList.add(HIDDEN_CLASSNAME$1);
46401
46429
  }
46402
46430
  }, 300);
46403
- }), null === (_e = this._secondElement) || void 0 === _e || _e.addEventListener("wheel", e => {
46431
+ }), null === (_f = this._secondElement) || void 0 === _f || _f.addEventListener("wheel", e => {
46404
46432
  e.stopPropagation();
46405
- }), null === (_f = this._secondElement) || void 0 === _f || _f.addEventListener("mousemove", e => {
46433
+ }), null === (_g = this._secondElement) || void 0 === _g || _g.addEventListener("mousemove", e => {
46406
46434
  this._rootElement.classList.contains(HIDDEN_CLASSNAME$1) || e.stopPropagation();
46407
- }), null === (_g = this._secondElement) || void 0 === _g || _g.addEventListener("mouseenter", e => {
46435
+ }), null === (_h = this._secondElement) || void 0 === _h || _h.addEventListener("mouseenter", e => {
46408
46436
  this._mouseEnterSecondElement = !0;
46409
- }), null === (_h = this._secondElement) || void 0 === _h || _h.addEventListener("mouseleave", e => {
46437
+ }), null === (_j = this._secondElement) || void 0 === _j || _j.addEventListener("mouseleave", e => {
46410
46438
  this._mouseEnterSecondElement = !1;
46411
- }), null === (_j = this._secondElement) || void 0 === _j || _j.addEventListener("mousedown", e => {
46439
+ }), null === (_k = this._secondElement) || void 0 === _k || _k.addEventListener("mousedown", e => {
46412
46440
  e.stopPropagation(), e.preventDefault();
46413
- }), null === (_k = this._secondElement) || void 0 === _k || _k.addEventListener("click", e => {
46441
+ }), null === (_l = this._secondElement) || void 0 === _l || _l.addEventListener("click", e => {
46414
46442
  if (e.stopPropagation(), e.preventDefault(), this._secondElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46415
46443
  const {
46416
46444
  col: col,
@@ -46480,11 +46508,12 @@
46480
46508
  this._menuInstanceInfo = void 0, (null == rootElement ? void 0 : rootElement.parentElement) && (rootElement.classList.remove(SHOWN_CLASSNAME$1), rootElement.classList.add(HIDDEN_CLASSNAME$1)), (null == secondElement ? void 0 : secondElement.parentElement) && (secondElement.classList.remove(SHOWN_CLASSNAME$1), secondElement.classList.add(HIDDEN_CLASSNAME$1));
46481
46509
  }
46482
46510
  _canBindToCell(table, col, row) {
46511
+ var _a;
46483
46512
  const rect = table.getCellRangeRelativeRect({
46484
46513
  col: col,
46485
46514
  row: row
46486
46515
  }),
46487
- element = table.getElement(),
46516
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
46488
46517
  {
46489
46518
  top: top,
46490
46519
  bottom: bottom,
@@ -46500,12 +46529,15 @@
46500
46529
  return !(offsetHeight < top) && !(offsetWidth < left);
46501
46530
  }
46502
46531
  _bindToCell(table, col, row, position, referencePosition) {
46532
+ var _a;
46503
46533
  const rootElement = this._rootElement,
46504
- element = table.getElement(),
46534
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
46505
46535
  {
46506
46536
  width: containerWidth,
46507
- height: containerHeight
46508
- } = table.internalProps.element.getBoundingClientRect();
46537
+ height: containerHeight,
46538
+ left: containerLeft,
46539
+ top: containerTop
46540
+ } = element.getBoundingClientRect();
46509
46541
  if (rootElement) {
46510
46542
  rootElement.parentElement !== element && element.appendChild(rootElement), rootElement.style.left = "0px";
46511
46543
  const maxWidth = .8 * containerWidth;
@@ -46517,19 +46549,30 @@
46517
46549
  const rect = element.getBoundingClientRect(),
46518
46550
  scaleX = rect.width / element.offsetWidth,
46519
46551
  scaleY = rect.height / element.offsetHeight;
46520
- return rootElementTop * scaleY + rootElementHeight > containerHeight && (rootElementTop = (containerHeight - rootElementHeight) / scaleY), rootElementTop < 0 && (rootElementTop /= 2), rootElement.style.top = `${rootElementTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft * scaleX + rootElementWidth > containerWidth && (rootElementLeft = (containerWidth - rootElementWidth) / scaleX), rootElement.style.left = `${rootElementLeft}px`, !0;
46552
+ rootElementTop * scaleY + rootElementHeight > containerHeight && (rootElementTop = (containerHeight - rootElementHeight) / scaleY), rootElementTop < 0 && (rootElementTop /= 2);
46553
+ let deltaTop = 0,
46554
+ deltaLeft = 0;
46555
+ if (table.getElement() !== element) {
46556
+ const {
46557
+ left: left,
46558
+ top: top
46559
+ } = table.getElement().getBoundingClientRect();
46560
+ deltaTop = top - containerTop, deltaLeft = left - containerLeft;
46561
+ }
46562
+ return rootElement.style.top = `${rootElementTop + deltaTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft * scaleX + rootElementWidth > containerWidth && (rootElementLeft = (containerWidth - rootElementWidth) / scaleX), rootElement.style.left = `${rootElementLeft + deltaLeft}px`, !0;
46521
46563
  }
46522
46564
  return !1;
46523
46565
  }
46524
46566
  _bindSecondElement(table, col, row, x, y) {
46567
+ var _a;
46525
46568
  const secondElement = this._secondElement,
46526
46569
  rootElement = this._rootElement,
46527
- element = table.getElement(),
46570
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
46528
46571
  {
46529
46572
  width: containerWidth,
46530
46573
  left: containerLeft,
46531
46574
  top: containerTop
46532
- } = table.internalProps.element.getBoundingClientRect(),
46575
+ } = element.getBoundingClientRect(),
46533
46576
  {
46534
46577
  x: rootLeft,
46535
46578
  y: rootTop,
@@ -47352,19 +47395,22 @@
47352
47395
  this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
47353
47396
  }
47354
47397
  getCustomCellStyle(col, row) {
47355
- const customStyleId = this.getCustomCellStyleId(col, row);
47356
- if (customStyleId) {
47357
- const styleOption = this.getCustomCellStyleOption(customStyleId);
47358
- return null == styleOption ? void 0 : styleOption.style;
47359
- }
47360
- }
47361
- getCustomCellStyleId(col, row) {
47362
- let customStyleId;
47363
- const range = this.table.getCellRange(col, row);
47398
+ const customStyleIds = this.getCustomCellStyleIds(col, row);
47399
+ if (customStyleIds.length) {
47400
+ const styles = [];
47401
+ return customStyleIds.forEach(customStyleId => {
47402
+ const styleOption = this.getCustomCellStyleOption(customStyleId);
47403
+ (null == styleOption ? void 0 : styleOption.style) && styles.push(styleOption.style);
47404
+ }), merge({}, ...styles);
47405
+ }
47406
+ }
47407
+ getCustomCellStyleIds(col, row) {
47408
+ const customStyleIds = [],
47409
+ range = this.table.getCellRange(col, row);
47364
47410
  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 => {
47365
- 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);
47411
+ 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);
47366
47412
  });
47367
- return customStyleId;
47413
+ return customStyleIds;
47368
47414
  }
47369
47415
  getCustomCellStyleOption(customStyleId) {
47370
47416
  return this.customCellStyle.find(style => style.id === customStyleId);
@@ -48480,7 +48526,7 @@
48480
48526
  constructor(container) {
48481
48527
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
48482
48528
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
48483
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.2-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");
48529
+ 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");
48484
48530
  const {
48485
48531
  frozenColCount = 0,
48486
48532
  frozenRowCount: frozenRowCount,
@@ -48550,7 +48596,8 @@
48550
48596
  parentElement: this.getElement(),
48551
48597
  renderMode: "html",
48552
48598
  isShowOverflowTextTooltip: !1,
48553
- confine: !0
48599
+ confine: !0,
48600
+ position: Placement.bottom
48554
48601
  }, options.tooltip), "html" === internalProps.tooltip.renderMode) {
48555
48602
  const TooltipHandler = Factory.getComponent("tooltipHandler");
48556
48603
  TooltipHandler && (internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine));
@@ -49301,7 +49348,8 @@
49301
49348
  parentElement: this.getElement(),
49302
49349
  renderMode: "html",
49303
49350
  isShowOverflowTextTooltip: !1,
49304
- confine: !0
49351
+ confine: !0,
49352
+ position: Placement.bottom
49305
49353
  }, options.tooltip), "html" === internalProps.tooltip.renderMode && !internalProps.tooltipHandler) {
49306
49354
  const TooltipHandler = Factory.getComponent("tooltipHandler");
49307
49355
  internalProps.tooltipHandler = new TooltipHandler(this, internalProps.tooltip.confine);
@@ -50954,18 +51002,20 @@
50954
51002
  }
50955
51003
  handleRowSeriesNumber(rowSeriesNumber) {
50956
51004
  var _a, _b;
50957
- rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map(seriesNumber => {
50958
- var _a, _b;
51005
+ rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map((seriesNumber, index) => {
51006
+ var _a, _b, _c;
50959
51007
  return {
50960
51008
  id: this.seqId++,
50961
51009
  title: seriesNumber.title,
50962
- define: seriesNumber,
51010
+ define: merge({
51011
+ field: "_vtable_rowSeries_number_" + index
51012
+ }, seriesNumber),
50963
51013
  cellType: null !== (_a = seriesNumber.cellType) && void 0 !== _a ? _a : "text",
50964
51014
  headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
50965
51015
  style: seriesNumber.style,
50966
51016
  width: seriesNumber.width,
50967
51017
  format: seriesNumber.format,
50968
- field: seriesNumber.field,
51018
+ field: null !== (_c = seriesNumber.field) && void 0 !== _c ? _c : "_vtable_rowSeries_number_" + index,
50969
51019
  icon: seriesNumber.icon,
50970
51020
  headerIcon: seriesNumber.headerIcon,
50971
51021
  isChildNode: !1
@@ -50973,13 +51023,15 @@
50973
51023
  }) : this.rowSeriesNumberColumn = [{
50974
51024
  id: this.seqId++,
50975
51025
  title: rowSeriesNumber.title,
50976
- define: rowSeriesNumber,
51026
+ define: merge({
51027
+ field: "_vtable_rowSeries_number"
51028
+ }, rowSeriesNumber),
50977
51029
  cellType: null !== (_a = rowSeriesNumber.cellType) && void 0 !== _a ? _a : "text",
50978
51030
  headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
50979
51031
  style: rowSeriesNumber.style,
50980
51032
  width: rowSeriesNumber.width,
50981
51033
  format: rowSeriesNumber.format,
50982
- field: "",
51034
+ field: "_vtable_rowSeries_number",
50983
51035
  icon: rowSeriesNumber.icon,
50984
51036
  headerIcon: rowSeriesNumber.headerIcon,
50985
51037
  isChildNode: !1
@@ -51372,9 +51424,11 @@
51372
51424
  return this._headerObjectMap[id];
51373
51425
  }
51374
51426
  getHeaderField(col, row) {
51375
- var _a;
51427
+ var _a, _b, _c;
51428
+ if (this.isSeriesNumberInHeader(col, row)) return null === (_a = this.getSeriesNumberHeader(col, row)) || void 0 === _a ? void 0 : _a.field;
51429
+ if (this.isSeriesNumberInBody(col, row)) return null === (_b = this.getSeriesNumberBody(col, row)) || void 0 === _b ? void 0 : _b.field;
51376
51430
  const id = this.getCellId(col, row);
51377
- 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);
51431
+ 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);
51378
51432
  }
51379
51433
  getHeaderCellAdressById(id) {
51380
51434
  for (let i = 0; i < this._headerCellIds.length; i++) {
@@ -54015,11 +54069,12 @@
54015
54069
  this._menuInstanceInfo = void 0, (null == rootElement ? void 0 : rootElement.parentElement) && (rootElement.classList.remove(SHOWN_CLASSNAME), rootElement.classList.add(HIDDEN_CLASSNAME));
54016
54070
  }
54017
54071
  _canBindToCell(table, col, row) {
54072
+ var _a;
54018
54073
  const rect = table.getCellRangeRelativeRect({
54019
54074
  col: col,
54020
54075
  row: row
54021
54076
  }),
54022
- element = table.getElement(),
54077
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
54023
54078
  {
54024
54079
  top: top,
54025
54080
  bottom: bottom,
@@ -54035,12 +54090,15 @@
54035
54090
  return !(offsetHeight < top) && !(offsetWidth < left);
54036
54091
  }
54037
54092
  _bindCell(table, col, row, position, referencePosition) {
54093
+ var _a;
54038
54094
  const rootElement = this._rootElement,
54039
- element = table.getElement(),
54095
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
54040
54096
  {
54041
54097
  width: containerWidth,
54042
- height: containerHeight
54043
- } = table.internalProps.element.getBoundingClientRect();
54098
+ height: containerHeight,
54099
+ left: containerLeft,
54100
+ top: containerTop
54101
+ } = element.getBoundingClientRect();
54044
54102
  if (rootElement) {
54045
54103
  rootElement.parentElement !== element && element.appendChild(rootElement), rootElement.style.left = "0px";
54046
54104
  const maxWidth = .8 * containerWidth;
@@ -54048,7 +54106,17 @@
54048
54106
  const rootElementWidth = rootElement.clientWidth,
54049
54107
  rootElementHeight = rootElement.clientHeight;
54050
54108
  let rootElementLeft, rootElementTop;
54051
- return position && (rootElementLeft = position.x, rootElementTop = position.y), referencePosition && (rootElementLeft = referencePosition.rect.right - rootElementWidth, rootElementTop = referencePosition.rect.bottom), rootElementTop + rootElementHeight > containerHeight && (rootElementTop = containerHeight - rootElementHeight, rootElementLeft += rootElementWidth - 2), rootElementTop < 0 && (rootElementTop /= 2), rootElement.style.top = `${rootElementTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft + rootElementWidth > containerWidth && (rootElementLeft = containerWidth - rootElementWidth), rootElement.style.left = `${rootElementLeft}px`, !0;
54109
+ position && (rootElementLeft = position.x, rootElementTop = position.y), referencePosition && (rootElementLeft = referencePosition.rect.right - rootElementWidth, rootElementTop = referencePosition.rect.bottom), rootElementTop + rootElementHeight > containerHeight && (rootElementTop = containerHeight - rootElementHeight, rootElementLeft += rootElementWidth - 2), rootElementTop < 0 && (rootElementTop /= 2);
54110
+ let deltaTop = 0,
54111
+ deltaLeft = 0;
54112
+ if (table.getElement() !== element) {
54113
+ const {
54114
+ left: left,
54115
+ top: top
54116
+ } = table.getElement().getBoundingClientRect();
54117
+ deltaTop = top - containerTop, deltaLeft = left - containerLeft;
54118
+ }
54119
+ return rootElement.style.top = `${rootElementTop + deltaTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft + rootElementWidth > containerWidth && (rootElementLeft = containerWidth - rootElementWidth), rootElement.style.left = `${rootElementLeft + deltaLeft}px`, !0;
54052
54120
  }
54053
54121
  return !1;
54054
54122
  }
@@ -54626,7 +54694,7 @@
54626
54694
  tooltipOption = {
54627
54695
  content: headerDescription,
54628
54696
  referencePosition: {
54629
- placement: Placement.bottom,
54697
+ placement: table.internalProps.tooltip.position,
54630
54698
  rect: rect
54631
54699
  },
54632
54700
  disappearDelay: null !== (_a = table.internalProps.tooltip.overflowTextTooltipDisappearDelay) && void 0 !== _a ? _a : 0,
@@ -54641,7 +54709,7 @@
54641
54709
  overflowText && (tooltipOption = {
54642
54710
  content: headerDescription ? `${headerDescription}\n ${overflowText}` : overflowText,
54643
54711
  referencePosition: {
54644
- placement: Placement.bottom,
54712
+ placement: table.internalProps.tooltip.position,
54645
54713
  rect: rect
54646
54714
  },
54647
54715
  disappearDelay: null !== (_c = table.internalProps.tooltip.overflowTextTooltipDisappearDelay) && void 0 !== _c ? _c : 0,
@@ -57746,7 +57814,7 @@
57746
57814
  const needMaxDate = !this.maxDate;
57747
57815
  let minDate = Number.MAX_SAFE_INTEGER;
57748
57816
  let maxDate = Number.MIN_SAFE_INTEGER;
57749
- if (needMinDate || needMaxDate) {
57817
+ if ((needMinDate || needMaxDate) && this.records.length) {
57750
57818
  for (let i = 0; i < this.records.length; i++) {
57751
57819
  const record = this.records[i];
57752
57820
  if (needMinDate) {
@@ -57766,6 +57834,10 @@
57766
57834
  this._gantt.parsedOptions._maxDateTime = this._gantt.parsedOptions.maxDate.getTime();
57767
57835
  }
57768
57836
  }
57837
+ setRecords(records) {
57838
+ this.records = records;
57839
+ this.processRecords();
57840
+ }
57769
57841
  }
57770
57842
 
57771
57843
  function createRootElement(padding, className = 'vtable-gantt') {
@@ -58119,31 +58191,36 @@
58119
58191
  }
58120
58192
  }
58121
58193
  _generateTimeLineDateMap() {
58122
- const startDate = createDateAtMidnight(this.parsedOptions.minDate);
58123
- const endDate = createDateAtMidnight(this.parsedOptions.maxDate);
58124
- let colWidthIncludeDays = 1000000;
58125
- for (const scale of this.parsedOptions.reverseSortedTimelineScales) {
58126
- const currentDate = createDateAtMidnight(startDate);
58127
- scale.timelineDates = generateTimeLineDate(currentDate, endDate, scale);
58128
- }
58129
- const firstScale = this.parsedOptions.reverseSortedTimelineScales[0];
58130
- const { unit, step } = firstScale;
58131
- if (unit === 'day') {
58132
- colWidthIncludeDays = step;
58133
- }
58134
- else if (unit === 'month') {
58135
- colWidthIncludeDays = 30;
58136
- }
58137
- else if (unit === 'week') {
58138
- colWidthIncludeDays = 7;
58139
- }
58140
- else if (unit === 'quarter') {
58141
- colWidthIncludeDays = 90;
58194
+ if (this.parsedOptions.minDate && this.parsedOptions.maxDate) {
58195
+ const startDate = createDateAtMidnight(this.parsedOptions.minDate);
58196
+ const endDate = createDateAtMidnight(this.parsedOptions.maxDate);
58197
+ let colWidthIncludeDays = 1000000;
58198
+ for (const scale of this.parsedOptions.reverseSortedTimelineScales) {
58199
+ const currentDate = createDateAtMidnight(startDate);
58200
+ scale.timelineDates = generateTimeLineDate(currentDate, endDate, scale);
58201
+ }
58202
+ const firstScale = this.parsedOptions.reverseSortedTimelineScales[0];
58203
+ const { unit, step } = firstScale;
58204
+ if (unit === 'day') {
58205
+ colWidthIncludeDays = step;
58206
+ }
58207
+ else if (unit === 'month') {
58208
+ colWidthIncludeDays = 30;
58209
+ }
58210
+ else if (unit === 'week') {
58211
+ colWidthIncludeDays = 7;
58212
+ }
58213
+ else if (unit === 'quarter') {
58214
+ colWidthIncludeDays = 90;
58215
+ }
58216
+ else if (unit === 'year') {
58217
+ colWidthIncludeDays = 365;
58218
+ }
58219
+ this.parsedOptions.colWidthPerDay = this.parsedOptions.timelineColWidth / colWidthIncludeDays;
58142
58220
  }
58143
- else if (unit === 'year') {
58144
- colWidthIncludeDays = 365;
58221
+ else {
58222
+ this.parsedOptions.colWidthPerDay = 0;
58145
58223
  }
58146
- this.parsedOptions.colWidthPerDay = this.parsedOptions.timelineColWidth / colWidthIncludeDays;
58147
58224
  }
58148
58225
  getAllRowsHeight() {
58149
58226
  return this.getAllHeaderRowsHeight() + this.itemCount * this.parsedOptions.rowHeight;
@@ -58275,10 +58352,14 @@
58275
58352
  }
58276
58353
  setRecords(records) {
58277
58354
  this.records = records;
58355
+ this.data.setRecords(records);
58278
58356
  this.taskListTableInstance.setRecords(records);
58279
58357
  this._syncPropsFromTable();
58358
+ this._generateTimeLineDateMap();
58359
+ this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length;
58360
+ this._updateSize();
58361
+ this.scenegraph.refreshAll();
58280
58362
  this.verticalSplitResizeLine.style.height = this.drawHeight + 'px';
58281
- this.scenegraph.refreshTaskBarsAndGrid();
58282
58363
  const left = this.stateManager.scroll.horizontalBarPos;
58283
58364
  const top = this.stateManager.scroll.verticalBarPos;
58284
58365
  this.scenegraph.setX(-left);
@@ -58308,7 +58389,7 @@
58308
58389
  }
58309
58390
  }
58310
58391
  _scrollToMarkLine() {
58311
- if (this.parsedOptions.scrollToMarkLineDate) {
58392
+ if (this.parsedOptions.scrollToMarkLineDate && this.parsedOptions.minDate) {
58312
58393
  const minDate = this.parsedOptions.minDate;
58313
58394
  const targetDayDistance = ((this.parsedOptions.scrollToMarkLineDate.getTime() - minDate.getTime()) / (1000 * 60 * 60 * 24)) *
58314
58395
  this.parsedOptions.colWidthPerDay;
@@ -58363,7 +58444,7 @@
58363
58444
  themes: themes$1
58364
58445
  });
58365
58446
 
58366
- const version = "1.11.2-alpha.2";
58447
+ const version = "1.11.2";
58367
58448
 
58368
58449
  exports.Gantt = Gantt;
58369
58450
  exports.TYPES = index$2;