@visactor/vtable-gantt 1.23.2 → 1.23.3

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.
Files changed (43) hide show
  1. package/cjs/Gantt.d.ts +10 -0
  2. package/cjs/Gantt.js +44 -0
  3. package/cjs/Gantt.js.map +1 -1
  4. package/cjs/event/touch.js +0 -1
  5. package/cjs/gantt-helper.d.ts +7 -0
  6. package/cjs/gantt-helper.js +74 -64
  7. package/cjs/gantt-helper.js.map +1 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/plugins/index.js +2 -1
  12. package/cjs/scenegraph/task-bar.d.ts +4 -1
  13. package/cjs/scenegraph/task-bar.js +74 -20
  14. package/cjs/scenegraph/task-bar.js.map +1 -1
  15. package/cjs/state/gantt-table-sync.js +0 -1
  16. package/cjs/state/state-manager.js +1 -0
  17. package/cjs/ts-types/gantt-engine.d.ts +5 -0
  18. package/cjs/ts-types/gantt-engine.js.map +1 -1
  19. package/cjs/zoom-scale/ZoomScaleManager.js +1 -2
  20. package/cjs/zoom-scale/index.js +2 -1
  21. package/dist/vtable-gantt.js +285 -55
  22. package/dist/vtable-gantt.min.js +2 -2
  23. package/es/Gantt.d.ts +10 -0
  24. package/es/Gantt.js +43 -0
  25. package/es/Gantt.js.map +1 -1
  26. package/es/event/touch.js +1 -2
  27. package/es/gantt-helper.d.ts +7 -0
  28. package/es/gantt-helper.js +73 -61
  29. package/es/gantt-helper.js.map +1 -1
  30. package/es/index.d.ts +1 -1
  31. package/es/index.js +1 -1
  32. package/es/index.js.map +1 -1
  33. package/es/plugins/index.js +2 -1
  34. package/es/scenegraph/task-bar.d.ts +4 -1
  35. package/es/scenegraph/task-bar.js +72 -20
  36. package/es/scenegraph/task-bar.js.map +1 -1
  37. package/es/state/gantt-table-sync.js +1 -2
  38. package/es/state/state-manager.js +2 -1
  39. package/es/ts-types/gantt-engine.d.ts +5 -0
  40. package/es/ts-types/gantt-engine.js.map +1 -1
  41. package/es/zoom-scale/ZoomScaleManager.js +1 -2
  42. package/es/zoom-scale/index.js +2 -1
  43. package/package.json +5 -5
@@ -20,4 +20,5 @@ Object.defineProperty(exports, "DataZoomIntegration", {
20
20
  get: function() {
21
21
  return DataZoomIntegration_1.DataZoomIntegration;
22
22
  }
23
- });
23
+ });
24
+ //# sourceMappingURL=index.js.map
@@ -685,28 +685,59 @@
685
685
  }
686
686
  addEventListener(type, listener, options) {
687
687
  if (!listener) return;
688
+ const capture = this._resolveCapture(options),
689
+ once = this._resolveOnce(options),
690
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
691
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
692
+ if (wrappedMap.has(capture)) return;
688
693
  const wrappedListener = event => {
689
694
  const transformedEvent = this._eventListenerTransformer(event);
690
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
695
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
691
696
  };
692
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
697
+ wrappedMap.set(capture, {
698
+ wrappedListener: wrappedListener,
699
+ options: options
700
+ }), this._nativeAddEventListener(type, wrappedListener, options);
693
701
  }
694
702
  removeEventListener(type, listener, options) {
695
- var _a;
703
+ var _a, _b;
696
704
  if (!listener) return;
697
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
698
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
705
+ const capture = this._resolveCapture(options),
706
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
707
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
699
708
  }
700
709
  dispatchEvent(event) {
701
710
  return this._nativeDispatchEvent(event);
702
711
  }
703
712
  clearAllEventListeners() {
704
- this._listenerMap.forEach((listenersMap, type) => {
705
- listenersMap.forEach((wrappedListener, originalListener) => {
706
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
713
+ this._listenerMap.forEach((listenerMap, type) => {
714
+ listenerMap.forEach(wrappedMap => {
715
+ wrappedMap.forEach((wrappedRecord, capture) => {
716
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
717
+ });
707
718
  });
708
719
  }), this._listenerMap.clear();
709
720
  }
721
+ _resolveCapture(options) {
722
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
723
+ }
724
+ _resolveOnce(options) {
725
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
726
+ }
727
+ _getOrCreateListenerTypeMap(type) {
728
+ let listenerTypeMap = this._listenerMap.get(type);
729
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
730
+ }
731
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
732
+ let wrappedMap = listenerTypeMap.get(listener);
733
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
734
+ }
735
+ _deleteListenerRecord(type, listener, capture) {
736
+ const listenerTypeMap = this._listenerMap.get(type);
737
+ if (!listenerTypeMap) return;
738
+ const wrappedMap = listenerTypeMap.get(listener);
739
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
740
+ }
710
741
  _nativeAddEventListener(type, listener, options) {
711
742
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
712
743
  }
@@ -7220,7 +7251,9 @@
7220
7251
  var _a;
7221
7252
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
7222
7253
  const constructor = event.constructor;
7223
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7254
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
7255
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
7256
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7224
7257
  }
7225
7258
  notifyListeners(e, type) {
7226
7259
  const listeners = e.currentTarget._events[type];
@@ -9824,7 +9857,7 @@
9824
9857
  });
9825
9858
  }
9826
9859
  release() {
9827
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
9860
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
9828
9861
  }
9829
9862
  _emitCustomEvent(type, context) {
9830
9863
  var _a, _b;
@@ -17330,12 +17363,12 @@
17330
17363
  throw new Error("暂不支持");
17331
17364
  }
17332
17365
  release() {
17333
- var _a, _b;
17366
+ var _a, _b, _d;
17334
17367
  super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
17335
17368
  layer.release();
17336
17369
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
17337
17370
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
17338
- }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
17371
+ }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
17339
17372
  }
17340
17373
  setStage(stage) {}
17341
17374
  dirty(b, matrix) {
@@ -21646,7 +21679,7 @@
21646
21679
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
21647
21680
  }
21648
21681
  release(all) {
21649
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
21682
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
21650
21683
  passive: !1
21651
21684
  }), this._clearDragEvents();
21652
21685
  }
@@ -23229,17 +23262,21 @@
23229
23262
  } = this.attribute.label;
23230
23263
  textStyle = isFunction$3(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
23231
23264
  const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
23232
- return textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
23265
+ textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
23233
23266
  label: tickDatum.label,
23234
23267
  value: tickDatum.rawValue,
23235
23268
  index: tickDatum.index,
23236
23269
  layer: layer
23237
- })), Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
23270
+ }));
23271
+ let reactStyle = textStyle.react;
23272
+ return isFunction$3(reactStyle) && (reactStyle = reactStyle(tickDatum, index, tickData, layer)), Object.assign(Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
23238
23273
  text: null != text ? text : textContent,
23239
23274
  _originText: tickDatum.label,
23240
23275
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
23241
23276
  type: type
23242
- }), textStyle);
23277
+ }), textStyle), {
23278
+ react: reactStyle
23279
+ });
23243
23280
  }
23244
23281
  getLabelPosition(point, vector, text, style) {
23245
23282
  return point;
@@ -24268,6 +24305,8 @@
24268
24305
  this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
24269
24306
  timeline.tick(delta);
24270
24307
  }), this.emit("tick", delta));
24308
+ }, this._handleGraphTick = () => {
24309
+ this.initHandler(!1);
24271
24310
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
24272
24311
  }
24273
24312
  bindStage(stage) {
@@ -24277,9 +24316,7 @@
24277
24316
  this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
24278
24317
  }
24279
24318
  init() {
24280
- this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
24281
- this.initHandler(!1);
24282
- }), application.global.env && this.initHandler(!1);
24319
+ this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
24283
24320
  }
24284
24321
  addTimeline(timeline) {
24285
24322
  this.timelines.push(timeline);
@@ -24352,7 +24389,7 @@
24352
24389
  }
24353
24390
  release() {
24354
24391
  var _a;
24355
- this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
24392
+ this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
24356
24393
  }
24357
24394
  checkSkip(delta) {
24358
24395
  var _a, _b, _c;
@@ -31990,7 +32027,7 @@
31990
32027
  });
31991
32028
  }
31992
32029
  clearVGlobalEvents() {
31993
- ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
32030
+ ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
31994
32031
  passive: !1
31995
32032
  });
31996
32033
  }
@@ -33916,7 +33953,7 @@
33916
33953
  };
33917
33954
  }
33918
33955
  release(all) {
33919
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
33956
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
33920
33957
  passive: !1
33921
33958
  }), this._clearAllDragEvents();
33922
33959
  }
@@ -36129,6 +36166,13 @@
36129
36166
  fontFamily: 'Arial',
36130
36167
  fontSize: 14
36131
36168
  };
36169
+ const defaultBaselineStyle = {
36170
+ barColor: '#d3d3d3',
36171
+ completedBarColor: '#a9a9a9',
36172
+ width: 20,
36173
+ cornerRadius: 3,
36174
+ borderWidth: 0
36175
+ };
36132
36176
  function setWidthToDefaultTaskBarStyle(width) {
36133
36177
  defaultTaskBarStyle.width = width;
36134
36178
  }
@@ -36212,6 +36256,9 @@
36212
36256
  gantt.parsedOptions.startDateField = options.taskBar?.startDateField ?? 'startDate';
36213
36257
  gantt.parsedOptions.endDateField = options.taskBar?.endDateField ?? 'endDate';
36214
36258
  gantt.parsedOptions.progressField = options.taskBar?.progressField ?? 'progress';
36259
+ gantt.parsedOptions.baselineStartDateField = options.taskBar?.baselineStartDateField;
36260
+ gantt.parsedOptions.baselineEndDateField = options.taskBar?.baselineEndDateField;
36261
+ gantt.parsedOptions.baselinePosition = options.taskBar?.baselinePosition ?? 'bottom';
36215
36262
  gantt.parsedOptions.taskBarClip = options?.taskBar?.clip ?? true;
36216
36263
  gantt.parsedOptions.projectSubTasksExpandable = options?.projectSubTasksExpandable ?? true;
36217
36264
  const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
@@ -36264,6 +36311,10 @@
36264
36311
  : options?.taskBar?.projectStyle
36265
36312
  ? Object.assign({}, defaultTaskBarStyle, options?.taskBar?.projectStyle)
36266
36313
  : gantt.parsedOptions.taskBarStyle;
36314
+ gantt.parsedOptions.baselineStyle =
36315
+ options?.taskBar?.baselineStyle && typeof options?.taskBar?.baselineStyle === 'function'
36316
+ ? options.taskBar.baselineStyle
36317
+ : Object.assign({}, defaultBaselineStyle, options?.taskBar?.baselineStyle);
36267
36318
  const defaultMilestoneStyle = {
36268
36319
  labelTextStyle: {
36269
36320
  fontSize: 16,
@@ -37710,6 +37761,7 @@
37710
37761
  };
37711
37762
  }
37712
37763
  on(type, listener) {
37764
+ if (!this.listenersData) return;
37713
37765
  const list = this.listenersData.listeners[type] || (this.listenersData.listeners[type] = []);
37714
37766
  list.push(listener);
37715
37767
  const id = idCount$3++;
@@ -37717,9 +37769,10 @@
37717
37769
  type: type,
37718
37770
  listener: listener,
37719
37771
  remove: () => {
37772
+ if (!this.listenersData) return;
37720
37773
  delete this.listenersData.listenerData[id];
37721
37774
  const index = list.indexOf(listener);
37722
- list.splice(index, 1), this.listenersData.listeners[type].length || delete this.listenersData.listeners[type];
37775
+ list.splice(index, 1), this.listenersData.listeners[type] && !this.listenersData.listeners[type].length && delete this.listenersData.listeners[type];
37723
37776
  }
37724
37777
  }, id;
37725
37778
  }
@@ -60388,7 +60441,7 @@
60388
60441
  }
60389
60442
  constructor(container, options = {}) {
60390
60443
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
60391
- if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60444
+ if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60392
60445
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60393
60446
  options: options,
60394
60447
  container: container
@@ -61327,17 +61380,18 @@
61327
61380
  this.release();
61328
61381
  }
61329
61382
  release() {
61330
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
61383
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
61384
+ null === (_c = null === (_b = null === (_a = this.scenegraph) || void 0 === _a ? void 0 : _a.component) || void 0 === _b ? void 0 : _b.vScrollBar) || void 0 === _c || _c.release(), null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.hScrollBar) || void 0 === _f || _f.release(), this.animationManager.clear(), this.animationManager.ticker.release(), null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.stage) || void 0 === _h ? void 0 : _h.ticker) || void 0 === _j || _j.release();
61331
61385
  const internalProps = this.internalProps;
61332
61386
  if (this.isReleased) return;
61333
- null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a), null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c), null === (_e = super.release) || void 0 === _e || _e.call(this), this.pluginManager.release(), null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f), this.eventManager.release(), null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h), null === (_k = internalProps.legends) || void 0 === _k || _k.forEach(legend => {
61387
+ null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
61334
61388
  null == legend || legend.release();
61335
- }), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null, null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
61389
+ }), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null, null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
61336
61390
  var _a;
61337
61391
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
61338
61392
  }), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
61339
- const parentElement = null === (_o = internalProps.element) || void 0 === _o ? void 0 : _o.parentElement;
61340
- parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (_r = null === (_q = null === (_p = this.editorManager) || void 0 === _p ? void 0 : _p.editingEditor) || void 0 === _q ? void 0 : _q.onEnd) || void 0 === _r || _r.call(_q), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_s = this.reactCustomLayout) || void 0 === _s || _s.clearCache(), clearChartRenderQueue();
61393
+ const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
61394
+ parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (_0 = null === (_z = null === (_y = this.editorManager) || void 0 === _y ? void 0 : _y.editingEditor) || void 0 === _z ? void 0 : _z.onEnd) || void 0 === _0 || _0.call(_z), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_1 = this.reactCustomLayout) || void 0 === _1 || _1.clearCache(), clearChartRenderQueue();
61341
61395
  }
61342
61396
  fireListeners(type, event) {
61343
61397
  return super.fireListeners(type, event);
@@ -64166,7 +64220,10 @@
64166
64220
  }
64167
64221
  cancelEdit() {
64168
64222
  var _a, _b, _c, _d;
64169
- 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);
64223
+ 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), Object.values(this.cacheLastSelectedCellEditor).forEach(editor => {
64224
+ var _a;
64225
+ return null === (_a = null == editor ? void 0 : editor.onEnd) || void 0 === _a ? void 0 : _a.call(editor);
64226
+ }), this.cacheLastSelectedCellEditor = {};
64170
64227
  }
64171
64228
  release() {
64172
64229
  this.listenersId.forEach(id => {
@@ -70075,16 +70132,22 @@
70075
70132
  const record = this._scene._gantt.getRecordByIndex(i);
70076
70133
  if (record.children?.length > 0) {
70077
70134
  for (let j = 0; j < record.children?.length; j++) {
70078
- const barGroup = this.initBar(i, j, record.children.length);
70079
- if (barGroup) {
70080
- this.barContainer.appendChild(barGroup);
70135
+ const { barGroupBox, baselineBar } = this.initBar(i, j, record.children.length);
70136
+ if (baselineBar) {
70137
+ this.barContainer.appendChild(baselineBar);
70138
+ }
70139
+ if (barGroupBox) {
70140
+ this.barContainer.appendChild(barGroupBox);
70081
70141
  }
70082
70142
  }
70083
70143
  }
70084
70144
  else {
70085
- const barGroup = this.initBar(i);
70086
- if (barGroup) {
70087
- this.barContainer.appendChild(barGroup);
70145
+ const { barGroupBox, baselineBar } = this.initBar(i);
70146
+ if (baselineBar) {
70147
+ this.barContainer.appendChild(baselineBar);
70148
+ }
70149
+ if (barGroupBox) {
70150
+ this.barContainer.appendChild(barGroupBox);
70088
70151
  }
70089
70152
  }
70090
70153
  continue;
@@ -70100,9 +70163,12 @@
70100
70163
  for (let j = 0; j < record.children?.length; j++) {
70101
70164
  const child_record = record.children[j];
70102
70165
  if (child_record.type !== TaskType.PROJECT) {
70103
- const barGroup = this.initBar(i, [...sub_task_indexs, j], record.children.length);
70104
- if (barGroup) {
70105
- this.barContainer.appendChild(barGroup);
70166
+ const { barGroupBox, baselineBar } = this.initBar(i, [...sub_task_indexs, j], record.children.length);
70167
+ if (baselineBar) {
70168
+ this.barContainer.appendChild(baselineBar);
70169
+ }
70170
+ if (barGroupBox) {
70171
+ this.barContainer.appendChild(barGroupBox);
70106
70172
  }
70107
70173
  }
70108
70174
  else {
@@ -70114,17 +70180,23 @@
70114
70180
  callInitBar(record, sub_task_indexs);
70115
70181
  }
70116
70182
  else {
70117
- const barGroup = this.initBar(i);
70118
- if (barGroup) {
70119
- this.barContainer.appendChild(barGroup);
70183
+ const { barGroupBox, baselineBar } = this.initBar(i);
70184
+ if (baselineBar) {
70185
+ this.barContainer.appendChild(baselineBar);
70186
+ }
70187
+ if (barGroupBox) {
70188
+ this.barContainer.appendChild(barGroupBox);
70120
70189
  }
70121
70190
  }
70122
70191
  continue;
70123
70192
  }
70124
70193
  else {
70125
- const barGroup = this.initBar(i);
70126
- if (barGroup) {
70127
- this.barContainer.appendChild(barGroup);
70194
+ const { barGroupBox, baselineBar } = this.initBar(i);
70195
+ if (baselineBar) {
70196
+ this.barContainer.appendChild(baselineBar);
70197
+ }
70198
+ if (barGroupBox) {
70199
+ this.barContainer.appendChild(barGroupBox);
70128
70200
  }
70129
70201
  }
70130
70202
  }
@@ -70135,7 +70207,7 @@
70135
70207
  const isMilestone = taskRecord.type === TaskType.MILESTONE;
70136
70208
  if ((isMilestone && !startDate) ||
70137
70209
  (!isMilestone && (taskDays <= 0 || !startDate || !endDate || startDate.getTime() > endDate.getTime()))) {
70138
- return null;
70210
+ return { barGroupBox: null, baselineBar: null };
70139
70211
  }
70140
70212
  const { unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
70141
70213
  let taskBarSize = computeCountToTimeScale(endDate, startDate, unit, step, 1) * this._scene._gantt.parsedOptions.timelineColWidth;
@@ -70149,14 +70221,104 @@
70149
70221
  const x = computeCountToTimeScale(startDate, this._scene._gantt.parsedOptions.minDate, unit, step) *
70150
70222
  this._scene._gantt.parsedOptions.timelineColWidth -
70151
70223
  (isMilestone ? milestoneTaskBarHeight / 2 : 0);
70152
- const y = this._scene._gantt.getRowsHeightByIndex(0, index - 1) +
70224
+ let y = this._scene._gantt.getRowsHeightByIndex(0, index - 1) +
70153
70225
  (this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate
70154
70226
  ? (childIndex ?? 0) * oneTaskHeigth
70155
70227
  : this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange ||
70156
70228
  this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact
70157
70229
  ? taskRecord.vtable_gantt_showIndex * oneTaskHeigth
70158
- : 0) +
70159
- (oneTaskHeigth - (isMilestone ? milestoneTaskBarHeight : taskbarHeight)) / 2;
70230
+ : 0);
70231
+ const baselineInfo = this._scene._gantt.getBaselineInfoByTaskListIndex(index, childIndex);
70232
+ const hasBaseline = baselineInfo.baselineStartDate && baselineInfo.baselineEndDate && baselineInfo.baselineDays > 0;
70233
+ const baselinePosition = this._scene._gantt.parsedOptions.baselinePosition;
70234
+ let baselineBar = null;
70235
+ let taskBarYOffset = 0;
70236
+ if (hasBaseline && !isMilestone) {
70237
+ const baselineStyle = this._scene._gantt.getBaselineStyle(index, childIndex);
70238
+ const baselineX = computeCountToTimeScale(baselineInfo.baselineStartDate, this._scene._gantt.parsedOptions.minDate, unit, step) *
70239
+ this._scene._gantt.parsedOptions.timelineColWidth;
70240
+ const baselineWidth = computeCountToTimeScale(baselineInfo.baselineEndDate, baselineInfo.baselineStartDate, unit, step, 1) *
70241
+ this._scene._gantt.parsedOptions.timelineColWidth;
70242
+ let baselineY;
70243
+ const taskBarPaddingTop = taskBarStyle.paddingTop ?? undefined;
70244
+ const baselinePaddingTop = baselineStyle.paddingTop ?? undefined;
70245
+ if (baselinePosition === 'overlap') {
70246
+ if (taskBarPaddingTop !== undefined) {
70247
+ baselineY = y + taskBarPaddingTop;
70248
+ }
70249
+ else {
70250
+ baselineY = y + (oneTaskHeigth - baselineStyle.width) / 2;
70251
+ }
70252
+ }
70253
+ else if (baselinePosition === 'top') {
70254
+ const gap = 4;
70255
+ if (baselinePaddingTop !== undefined && taskBarPaddingTop !== undefined) {
70256
+ baselineY = y + baselinePaddingTop;
70257
+ taskBarYOffset = taskBarPaddingTop;
70258
+ }
70259
+ else if (baselinePaddingTop !== undefined) {
70260
+ baselineY = y + baselinePaddingTop;
70261
+ taskBarYOffset = baselinePaddingTop + baselineStyle.width + gap;
70262
+ }
70263
+ else if (taskBarPaddingTop !== undefined) {
70264
+ const totalHeight = baselineStyle.width + gap + taskbarHeight;
70265
+ const startY = (oneTaskHeigth - totalHeight) / 2;
70266
+ baselineY = y + startY;
70267
+ taskBarYOffset = taskBarPaddingTop;
70268
+ }
70269
+ else {
70270
+ const totalHeight = baselineStyle.width + gap + taskbarHeight;
70271
+ const startY = (oneTaskHeigth - totalHeight) / 2;
70272
+ baselineY = y + startY;
70273
+ taskBarYOffset = startY + baselineStyle.width + gap;
70274
+ }
70275
+ }
70276
+ else {
70277
+ const gap = 4;
70278
+ if (taskBarPaddingTop !== undefined && baselinePaddingTop !== undefined) {
70279
+ taskBarYOffset = taskBarPaddingTop;
70280
+ baselineY = y + baselinePaddingTop;
70281
+ }
70282
+ else if (taskBarPaddingTop !== undefined) {
70283
+ taskBarYOffset = taskBarPaddingTop;
70284
+ baselineY = y + taskBarPaddingTop + taskbarHeight + gap;
70285
+ }
70286
+ else if (baselinePaddingTop !== undefined) {
70287
+ const totalHeight = taskbarHeight + gap + baselineStyle.width;
70288
+ const startY = (oneTaskHeigth - totalHeight) / 2;
70289
+ taskBarYOffset = startY;
70290
+ baselineY = y + baselinePaddingTop;
70291
+ }
70292
+ else {
70293
+ const totalHeight = taskbarHeight + gap + baselineStyle.width;
70294
+ const startY = (oneTaskHeigth - totalHeight) / 2;
70295
+ taskBarYOffset = startY;
70296
+ baselineY = y + startY + taskbarHeight + gap;
70297
+ }
70298
+ }
70299
+ baselineBar = createRect({
70300
+ x: baselineX,
70301
+ y: baselineY,
70302
+ width: Math.max(baselineWidth, baselineStyle.minSize || 0),
70303
+ height: baselineStyle.width,
70304
+ fill: baselineStyle.barColor,
70305
+ cornerRadius: baselineStyle.cornerRadius,
70306
+ lineWidth: (baselineStyle.borderLineWidth ?? baselineStyle.borderWidth) * 2,
70307
+ stroke: baselineStyle.borderColor,
70308
+ pickable: false
70309
+ });
70310
+ baselineBar.name = 'baseline-bar';
70311
+ }
70312
+ const taskBarPaddingTop = taskBarStyle.paddingTop ?? undefined;
70313
+ if (hasBaseline && !isMilestone && baselinePosition !== 'overlap') {
70314
+ y = y + taskBarYOffset;
70315
+ }
70316
+ else if (taskBarPaddingTop !== undefined) {
70317
+ y = y + taskBarPaddingTop;
70318
+ }
70319
+ else {
70320
+ y += (oneTaskHeigth - (isMilestone ? milestoneTaskBarHeight : taskbarHeight)) / 2 + taskBarYOffset;
70321
+ }
70160
70322
  const barGroupBox = new GanttTaskBarNode({
70161
70323
  x,
70162
70324
  y,
@@ -70306,17 +70468,20 @@
70306
70468
  barGroupBox.milestoneTextLabel = milestoneLabel;
70307
70469
  barGroupBox.milestoneTextContainer = textContainer;
70308
70470
  }
70309
- return barGroupBox;
70471
+ return { barGroupBox, baselineBar };
70310
70472
  }
70311
70473
  updateTaskBarNode(index, sub_task_index) {
70312
70474
  const taskbarGroup = this.getTaskBarNodeByIndex(index, sub_task_index);
70313
70475
  if (taskbarGroup) {
70314
70476
  this.barContainer.removeChild(taskbarGroup);
70315
70477
  }
70316
- const barGroup = this.initBar(index, sub_task_index);
70317
- if (barGroup) {
70318
- this.barContainer.insertInto(barGroup, index);
70319
- barGroup.updateTextPosition();
70478
+ const { barGroupBox, baselineBar } = this.initBar(index, sub_task_index);
70479
+ if (barGroupBox) {
70480
+ this.barContainer.insertInto(barGroupBox, index);
70481
+ barGroupBox.updateTextPosition();
70482
+ }
70483
+ if (baselineBar) {
70484
+ this.barContainer.insertBefore(baselineBar, barGroupBox);
70320
70485
  }
70321
70486
  }
70322
70487
  initHoverBarIcons() {
@@ -76319,6 +76484,7 @@
76319
76484
  if (record) {
76320
76485
  return (record.children?.length || 1) * this.parsedOptions.rowHeight;
76321
76486
  }
76487
+ return undefined;
76322
76488
  };
76323
76489
  listTable_options.defaultRowHeight = 'auto';
76324
76490
  listTable_options.customConfig = { forceComputeAllRowHeight: true };
@@ -76330,6 +76496,7 @@
76330
76496
  if (record) {
76331
76497
  return computeRowsCountByRecordDateForCompact(this, record) * this.parsedOptions.rowHeight;
76332
76498
  }
76499
+ return undefined;
76333
76500
  };
76334
76501
  listTable_options.defaultRowHeight = 'auto';
76335
76502
  listTable_options.customConfig = { forceComputeAllRowHeight: true };
@@ -76341,6 +76508,7 @@
76341
76508
  if (record) {
76342
76509
  return computeRowsCountByRecordDate(this, record) * this.parsedOptions.rowHeight;
76343
76510
  }
76511
+ return undefined;
76344
76512
  };
76345
76513
  listTable_options.defaultRowHeight = 'auto';
76346
76514
  listTable_options.customConfig = { forceComputeAllRowHeight: true };
@@ -76528,6 +76696,53 @@
76528
76696
  progress
76529
76697
  };
76530
76698
  }
76699
+ getBaselineInfoByTaskListIndex(taskShowIndex, sub_task_index) {
76700
+ const taskRecord = this.getRecordByIndex(taskShowIndex, sub_task_index);
76701
+ const baselineStartDateField = this.parsedOptions.baselineStartDateField;
76702
+ const baselineEndDateField = this.parsedOptions.baselineEndDateField;
76703
+ if (!baselineStartDateField ||
76704
+ !baselineEndDateField ||
76705
+ !taskRecord?.[baselineStartDateField] ||
76706
+ !taskRecord?.[baselineEndDateField]) {
76707
+ return {
76708
+ baselineStartDate: null,
76709
+ baselineEndDate: null,
76710
+ baselineDays: 0
76711
+ };
76712
+ }
76713
+ const rawBaselineStartDateTime = createDateAtMidnight(taskRecord?.[baselineStartDateField]).getTime();
76714
+ const rawBaselineEndDateTime = createDateAtMidnight(taskRecord?.[baselineEndDateField]).getTime();
76715
+ if (rawBaselineEndDateTime < this.parsedOptions._minDateTime ||
76716
+ rawBaselineStartDateTime > this.parsedOptions._maxDateTime) {
76717
+ return {
76718
+ baselineStartDate: null,
76719
+ baselineEndDate: null,
76720
+ baselineDays: 0
76721
+ };
76722
+ }
76723
+ let baselineStartDate;
76724
+ let baselineEndDate;
76725
+ if (this.parsedOptions.timeScaleIncludeHour) {
76726
+ baselineStartDate = createDateAtMidnight(Math.min(Math.max(this.parsedOptions._minDateTime, rawBaselineStartDateTime), this.parsedOptions._maxDateTime));
76727
+ const rawEnd = taskRecord?.[baselineEndDateField];
76728
+ let hasMillisecondProvided = false;
76729
+ if (typeof rawEnd === 'string') {
76730
+ hasMillisecondProvided = /:\d{2}\.\d+/.test(rawEnd);
76731
+ }
76732
+ const shouldForceMillisecond = !hasMillisecondProvided;
76733
+ baselineEndDate = createDateAtLastMillisecond(Math.max(Math.min(this.parsedOptions._maxDateTime, rawBaselineEndDateTime), this.parsedOptions._minDateTime), shouldForceMillisecond);
76734
+ }
76735
+ else {
76736
+ baselineStartDate = createDateAtMidnight(Math.min(Math.max(this.parsedOptions._minDateTime, rawBaselineStartDateTime), this.parsedOptions._maxDateTime), true);
76737
+ baselineEndDate = createDateAtLastHour(Math.max(Math.min(this.parsedOptions._maxDateTime, rawBaselineEndDateTime), this.parsedOptions._minDateTime), true);
76738
+ }
76739
+ const baselineDays = (baselineEndDate.getTime() - baselineStartDate.getTime() + 1) / (1000 * 60 * 60 * 24);
76740
+ return {
76741
+ baselineStartDate,
76742
+ baselineEndDate,
76743
+ baselineDays
76744
+ };
76745
+ }
76531
76746
  _updateStartDateToTaskRecord(startDate, index, sub_task_index) {
76532
76747
  const taskRecord = this.getRecordByIndex(index, sub_task_index);
76533
76748
  const startDateField = this.parsedOptions.startDateField;
@@ -76894,6 +77109,21 @@
76894
77109
  }
76895
77110
  return style;
76896
77111
  }
77112
+ getBaselineStyle(task_index, sub_task_index) {
77113
+ const { startDate, endDate, taskRecord } = this.getTaskInfoByTaskListIndex(task_index, sub_task_index);
77114
+ const style = this.parsedOptions.baselineStyle;
77115
+ if (typeof style === 'function') {
77116
+ const args = {
77117
+ index: task_index,
77118
+ startDate,
77119
+ endDate,
77120
+ taskRecord,
77121
+ ganttInstance: this
77122
+ };
77123
+ return style(args);
77124
+ }
77125
+ return style;
77126
+ }
76897
77127
  formatDate(date, format) {
76898
77128
  return formatDate(date instanceof Date ? date : new Date(date), format);
76899
77129
  }
@@ -76962,7 +77192,7 @@
76962
77192
  PluginManager: PluginManager
76963
77193
  });
76964
77194
 
76965
- const version = "1.23.2";
77195
+ const version = "1.23.3";
76966
77196
 
76967
77197
  exports.Gantt = Gantt;
76968
77198
  exports.TYPES = index$4;