apexgantt 3.5.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,6 +46,20 @@ const gantt = new ApexGantt(document.getElementById('gantt-container'), ganttOpt
46
46
  gantt.render();
47
47
  ```
48
48
 
49
+ ## Setting the License
50
+
51
+ To use ApexGantt with a commercial license, set your license key before creating any chart instances:
52
+
53
+ ```js
54
+ import ApexGantt from 'apexgantt';
55
+
56
+ // set license key before creating any charts
57
+ ApexGantt.setLicense('your-license-key');
58
+
59
+ const gantt = new ApexGantt(document.getElementById('gantt-container'), ganttOptions);
60
+ gantt.render();
61
+ ```
62
+
49
63
  ## ApexGantt Options
50
64
 
51
65
  The layout can be configured by either setting the properties in the table below by passing a second arg to ApexGantt with these properties set. The latter takes precedence.
@@ -5919,6 +5919,109 @@ registerMorphableType([
5919
5919
  Point
5920
5920
  ]);
5921
5921
  makeMorphable();
5922
+ const ToolbarStyle = `
5923
+ #toolbar {
5924
+ display: flex;
5925
+ gap: 5px;
5926
+ position: absolute;
5927
+ right: 10px;
5928
+ top: 10px;
5929
+ z-index: 100;
5930
+ }
5931
+
5932
+ .toolbar-item {
5933
+ align-items: center;
5934
+ background-color: var(--toolbar-bg-color, #FFFFFF);
5935
+ border: 1px solid var(--toolbar-border-color, #BCBCBC);
5936
+ cursor: pointer;
5937
+ display: flex;
5938
+ height: 30px;
5939
+ justify-content: center;
5940
+ width: 30px;
5941
+ border-radius: 3px;
5942
+ transition: all 0.2s ease;
5943
+ position: relative;
5944
+ }
5945
+
5946
+ .toolbar-item:hover {
5947
+ background-color: var(--toolbar-hover-bg-color, #f8f9fa);
5948
+ border-color: var(--toolbar-border-color, #999);
5949
+ transform: translateY(-1px);
5950
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
5951
+ }
5952
+
5953
+ .toolbar-item:active {
5954
+ transform: translateY(0);
5955
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
5956
+ }
5957
+
5958
+ .toolbar-item:focus {
5959
+ outline: none;
5960
+ border-color: var(--button-bg-color, #0066cc);
5961
+ box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
5962
+ }
5963
+
5964
+ .toolbar-item img {
5965
+ width: 16px;
5966
+ height: 16px;
5967
+ pointer-events: none;
5968
+ filter: var(--toolbar-icon-filter, none);
5969
+ }
5970
+
5971
+ .toolbar-item[disabled] {
5972
+ opacity: 0.5;
5973
+ cursor: not-allowed;
5974
+ pointer-events: none;
5975
+ }
5976
+
5977
+ /* Tooltip styles */
5978
+ .toolbar-item::after {
5979
+ content: attr(data-tooltip);
5980
+ position: absolute;
5981
+ bottom: -35px;
5982
+ left: 50%;
5983
+ transform: translateX(-50%);
5984
+ background: var(--tooltip-bg-color, #333);
5985
+ color: var(--tooltip-text-color, white);
5986
+ padding: 4px 8px;
5987
+ border-radius: 4px;
5988
+ font-size: 12px;
5989
+ white-space: nowrap;
5990
+ opacity: 0;
5991
+ pointer-events: none;
5992
+ transition: opacity 0.2s ease;
5993
+ z-index: 1000;
5994
+ }
5995
+
5996
+ .toolbar-item::before {
5997
+ content: '';
5998
+ position: absolute;
5999
+ bottom: -25px;
6000
+ left: 50%;
6001
+ transform: translateX(-50%);
6002
+ border: 5px solid transparent;
6003
+ border-bottom-color: var(--tooltip-bg-color, #333);
6004
+ opacity: 0;
6005
+ pointer-events: none;
6006
+ transition: opacity 0.2s ease;
6007
+ z-index: 1000;
6008
+ }
6009
+
6010
+ .toolbar-item:hover::after,
6011
+ .toolbar-item:hover::before {
6012
+ opacity: 1;
6013
+ }
6014
+
6015
+ /* Shadow DOM specific adjustments */
6016
+ :host #toolbar {
6017
+ display: flex;
6018
+ gap: 5px;
6019
+ position: absolute;
6020
+ right: 10px;
6021
+ top: 10px;
6022
+ z-index: 100;
6023
+ }
6024
+ `;
5922
6025
  const _Watermark = class _Watermark {
5923
6026
  /**
5924
6027
  * Add watermark to a container element
@@ -6465,14 +6568,12 @@ const getCursorFollowingTooltipStyles = ({
6465
6568
  fontFamily,
6466
6569
  fontSize,
6467
6570
  fontWeight,
6468
- maxWidth = 300,
6571
+ maxWidth,
6469
6572
  padding,
6470
6573
  x: x2,
6471
6574
  y: y2
6472
6575
  }) => {
6473
6576
  const styles = ["position: absolute;", "z-index: 1000;", "pointer-events: none;"];
6474
- styles.push(`width: ${maxWidth}px;`);
6475
- styles.push(`max-width: ${maxWidth}px;`);
6476
6577
  styles.push("box-sizing: border-box;");
6477
6578
  styles.push("word-wrap: break-word;");
6478
6579
  styles.push("overflow-wrap: break-word;");
@@ -6481,6 +6582,10 @@ const getCursorFollowingTooltipStyles = ({
6481
6582
  if (borderColor) {
6482
6583
  styles.push(`border: 1px solid ${borderColor};`);
6483
6584
  }
6585
+ if (maxWidth) {
6586
+ styles.push(`width: ${maxWidth}px;`);
6587
+ styles.push(`max-width: ${maxWidth}px;`);
6588
+ }
6484
6589
  styles.push("border-radius: 6px;");
6485
6590
  styles.push("box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);");
6486
6591
  styles.push("transition: opacity 0.2s ease;");
@@ -15883,109 +15988,6 @@ const TooltipStyle = `
15883
15988
  margin-bottom: 0;
15884
15989
  }
15885
15990
  `;
15886
- const ToolbarStyle = `
15887
- #toolbar {
15888
- display: flex;
15889
- gap: 5px;
15890
- position: absolute;
15891
- right: 10px;
15892
- top: 10px;
15893
- z-index: 100;
15894
- }
15895
-
15896
- .toolbar-item {
15897
- align-items: center;
15898
- background-color: var(--toolbar-bg-color, #FFFFFF);
15899
- border: 1px solid var(--toolbar-border-color, #BCBCBC);
15900
- cursor: pointer;
15901
- display: flex;
15902
- height: 30px;
15903
- justify-content: center;
15904
- width: 30px;
15905
- border-radius: 3px;
15906
- transition: all 0.2s ease;
15907
- position: relative;
15908
- }
15909
-
15910
- .toolbar-item:hover {
15911
- background-color: var(--toolbar-hover-bg-color, #f8f9fa);
15912
- border-color: var(--toolbar-border-color, #999);
15913
- transform: translateY(-1px);
15914
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
15915
- }
15916
-
15917
- .toolbar-item:active {
15918
- transform: translateY(0);
15919
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
15920
- }
15921
-
15922
- .toolbar-item:focus {
15923
- outline: none;
15924
- border-color: var(--button-bg-color, #0066cc);
15925
- box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
15926
- }
15927
-
15928
- .toolbar-item img {
15929
- width: 16px;
15930
- height: 16px;
15931
- pointer-events: none;
15932
- filter: var(--toolbar-icon-filter, none);
15933
- }
15934
-
15935
- .toolbar-item[disabled] {
15936
- opacity: 0.5;
15937
- cursor: not-allowed;
15938
- pointer-events: none;
15939
- }
15940
-
15941
- /* Tooltip styles */
15942
- .toolbar-item::after {
15943
- content: attr(data-tooltip);
15944
- position: absolute;
15945
- bottom: -35px;
15946
- left: 50%;
15947
- transform: translateX(-50%);
15948
- background: var(--tooltip-bg-color, #333);
15949
- color: var(--tooltip-text-color, white);
15950
- padding: 4px 8px;
15951
- border-radius: 4px;
15952
- font-size: 12px;
15953
- white-space: nowrap;
15954
- opacity: 0;
15955
- pointer-events: none;
15956
- transition: opacity 0.2s ease;
15957
- z-index: 1000;
15958
- }
15959
-
15960
- .toolbar-item::before {
15961
- content: '';
15962
- position: absolute;
15963
- bottom: -25px;
15964
- left: 50%;
15965
- transform: translateX(-50%);
15966
- border: 5px solid transparent;
15967
- border-bottom-color: var(--tooltip-bg-color, #333);
15968
- opacity: 0;
15969
- pointer-events: none;
15970
- transition: opacity 0.2s ease;
15971
- z-index: 1000;
15972
- }
15973
-
15974
- .toolbar-item:hover::after,
15975
- .toolbar-item:hover::before {
15976
- opacity: 1;
15977
- }
15978
-
15979
- /* Shadow DOM specific adjustments */
15980
- :host #toolbar {
15981
- display: flex;
15982
- gap: 5px;
15983
- position: absolute;
15984
- right: 10px;
15985
- top: 10px;
15986
- z-index: 100;
15987
- }
15988
- `;
15989
15991
  const DefaultOptions = {
15990
15992
  paddingX: 20,
15991
15993
  paddingY: 15
@@ -17188,7 +17190,7 @@ class ApexGantt extends BaseChart {
17188
17190
  }
17189
17191
  }
17190
17192
  disableHeaderMousewheelScroll() {
17191
- const timelineHeader = this.chartContext.querySelector(".timeline-header");
17193
+ const timelineHeader = this.element.querySelector(".timeline-header");
17192
17194
  if (!timelineHeader) {
17193
17195
  return;
17194
17196
  }
@@ -17273,16 +17275,16 @@ class ApexGantt extends BaseChart {
17273
17275
  this.chartContext.addEventListener("splitview-resize", this.splitBarResizeHandler);
17274
17276
  }
17275
17277
  positionHorizontalScrollbar() {
17276
- const horizontalScroll = this.chartContext.querySelector(".timeline-horizontal-scroll");
17277
- const ganttContainer = this.chartContext.querySelector(".gantt-container");
17278
- const tasksContainer = this.chartContext.querySelector(".tasks-container");
17278
+ const horizontalScroll = this.element.querySelector(".timeline-horizontal-scroll");
17279
+ const ganttContainer = this.element.querySelector(".gantt-container");
17280
+ const tasksContainer = this.element.querySelector(".tasks-container");
17279
17281
  if (!horizontalScroll || !ganttContainer) {
17280
17282
  console.warn("Missing elements for scrollbar positioning");
17281
17283
  return;
17282
17284
  }
17283
17285
  void ganttContainer.offsetHeight;
17284
17286
  const tasksWidth = tasksContainer ? tasksContainer.offsetWidth : 0;
17285
- const splitBar = this.chartContext.querySelector(".split-bar-container");
17287
+ const splitBar = this.element.querySelector(".split-bar-container");
17286
17288
  const splitBarWidth = splitBar ? splitBar.offsetWidth : 0;
17287
17289
  const totalOffset = tasksWidth + splitBarWidth + 2;
17288
17290
  const computedStyle = window.getComputedStyle(this.element);
@@ -17294,8 +17296,8 @@ class ApexGantt extends BaseChart {
17294
17296
  horizontalScroll.style.width = `${Math.max(0, availableWidth)}px`;
17295
17297
  }
17296
17298
  compensateForScrollbar() {
17297
- const bodyWrapper = this.chartContext.querySelector(".tasks-body-wrapper");
17298
- const headerContainer = this.chartContext.querySelector(".tasks-header");
17299
+ const bodyWrapper = this.element.querySelector(".tasks-body-wrapper");
17300
+ const headerContainer = this.element.querySelector(".tasks-header");
17299
17301
  if (!bodyWrapper || !headerContainer) {
17300
17302
  return;
17301
17303
  }
@@ -17308,9 +17310,9 @@ class ApexGantt extends BaseChart {
17308
17310
  }
17309
17311
  }
17310
17312
  setupTimelineHorizontalScroll() {
17311
- const horizontalScroll = this.chartContext.querySelector(".timeline-horizontal-scroll");
17312
- const timelineHeader = this.chartContext.querySelector(".timeline-header");
17313
- const timelineBodyWrapper = this.chartContext.querySelector(".timeline-body-wrapper");
17313
+ const horizontalScroll = this.element.querySelector(".timeline-horizontal-scroll");
17314
+ const timelineHeader = this.element.querySelector(".timeline-header");
17315
+ const timelineBodyWrapper = this.element.querySelector(".timeline-body-wrapper");
17314
17316
  if (!horizontalScroll || !timelineHeader || !timelineBodyWrapper) {
17315
17317
  return;
17316
17318
  }
@@ -17437,15 +17439,15 @@ class ApexGantt extends BaseChart {
17437
17439
  const tasksWithDependency = this.dataManager.getFlatVisibleTasks().filter((task) => !!task.dependency).map((task) => {
17438
17440
  const sourceSelector = `.bar-container [data-taskid="${task.dependency}"][data-chart-instance="${chartInstanceId}"]`;
17439
17441
  const targetSelector = `.bar-container [data-taskid="${task.id}"][data-chart-instance="${chartInstanceId}"]`;
17440
- const source = this.chartContext.querySelector(sourceSelector);
17441
- const target = this.chartContext.querySelector(targetSelector);
17442
+ const source = this.element.querySelector(sourceSelector);
17443
+ const target = this.element.querySelector(targetSelector);
17442
17444
  return {
17443
17445
  id: `${task.dependency}-${task.id}`,
17444
17446
  source,
17445
17447
  target
17446
17448
  };
17447
17449
  }).filter((edge) => edge.source && edge.target);
17448
- const timelineBody = this.chartContext.querySelector(".timeline-body");
17450
+ const timelineBody = this.element.querySelector(".timeline-body");
17449
17451
  if (!timelineBody) {
17450
17452
  console.warn(`[${chartInstanceId}] Timeline body not found for arrows`);
17451
17453
  return;
@@ -17736,7 +17738,7 @@ class ApexGantt extends BaseChart {
17736
17738
  return this.isColorDark(currentBgColor) ? "dark" : "light";
17737
17739
  }
17738
17740
  fillEmptyRowsAfterRender() {
17739
- const ganttContainer = this.chartContext.querySelector(".gantt-container");
17741
+ const ganttContainer = this.element.querySelector(".gantt-container");
17740
17742
  const timelineBody = ganttContainer == null ? void 0 : ganttContainer.querySelector(".timeline-body");
17741
17743
  const tasksBody = ganttContainer == null ? void 0 : ganttContainer.querySelector(".tasks-data-container");
17742
17744
  if (!ganttContainer || !timelineBody || !tasksBody) {
@@ -17884,9 +17886,9 @@ class ApexGantt extends BaseChart {
17884
17886
  * update the horizontal scrollbar's content width to match timeline width
17885
17887
  */
17886
17888
  updateHorizontalScrollbarContent() {
17887
- const horizontalScroll = this.chartContext.querySelector(".timeline-horizontal-scroll");
17889
+ const horizontalScroll = this.element.querySelector(".timeline-horizontal-scroll");
17888
17890
  const scrollContent = horizontalScroll == null ? void 0 : horizontalScroll.querySelector(".timeline-horizontal-scroll-content");
17889
- const timelineBody = this.chartContext.querySelector(".timeline-body");
17891
+ const timelineBody = this.element.querySelector(".timeline-body");
17890
17892
  if (!horizontalScroll || !scrollContent || !timelineBody) {
17891
17893
  console.warn("Scrollbar update: Missing elements", {
17892
17894
  horizontalScroll: !!horizontalScroll,