gantt-lib 0.72.0 → 0.72.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.
package/dist/index.js CHANGED
@@ -7245,8 +7245,13 @@ var TaskList = ({
7245
7245
  };
7246
7246
 
7247
7247
  // src/components/GanttChart/print.ts
7248
- function getPrintDocumentTitle({ header, title, fileName }) {
7249
- return header?.projectName || title || header?.serviceName || fileName || "Gantt chart";
7248
+ function getPrintDocumentTitle({
7249
+ header,
7250
+ documentTitle,
7251
+ title,
7252
+ fileName
7253
+ }) {
7254
+ return documentTitle || fileName || title || header?.projectName || header?.serviceName || "Gantt chart";
7250
7255
  }
7251
7256
  function formatHeaderExportDate(exportDate) {
7252
7257
  if (!exportDate) return null;
@@ -7358,7 +7363,7 @@ function createPrintStyle(targetDocument, orientation) {
7358
7363
  const style = targetDocument.createElement("style");
7359
7364
  style.textContent = `
7360
7365
  @page {
7361
- size: ${orientation};
7366
+ ${orientation ? `size: ${orientation};` : ""}
7362
7367
  margin: 12mm;
7363
7368
  }
7364
7369
 
@@ -7541,6 +7546,7 @@ async function printGanttChart({
7541
7546
  sourceContainer,
7542
7547
  printContent,
7543
7548
  header,
7549
+ documentTitle,
7544
7550
  title,
7545
7551
  fileName,
7546
7552
  orientation
@@ -7552,7 +7558,7 @@ async function printGanttChart({
7552
7558
  if (!printWindow || !printDocument) {
7553
7559
  throw new Error("Unable to create print frame");
7554
7560
  }
7555
- const printTitle = getPrintDocumentTitle({ header, title, fileName });
7561
+ const printTitle = getPrintDocumentTitle({ header, documentTitle, title, fileName });
7556
7562
  printDocument.open();
7557
7563
  printDocument.write('<!doctype html><html><head><meta charset="utf-8" /></head><body></body></html>');
7558
7564
  printDocument.close();
@@ -7920,6 +7926,7 @@ function GanttChartInner(props, ref) {
7920
7926
  }
7921
7927
  if (includeChart) {
7922
7928
  chartClone?.classList.remove("gantt-chart-hidden");
7929
+ if (chartClone) chartClone.style.display = "";
7923
7930
  } else {
7924
7931
  chartClone?.remove();
7925
7932
  }
@@ -7928,9 +7935,10 @@ function GanttChartInner(props, ref) {
7928
7935
  sourceContainer,
7929
7936
  printContent,
7930
7937
  header: options?.header,
7938
+ documentTitle: options?.documentTitle,
7931
7939
  title: options?.title,
7932
7940
  fileName: options?.fileName,
7933
- orientation: options?.orientation ?? "landscape"
7941
+ orientation: options?.orientation
7934
7942
  });
7935
7943
  }, [showTaskList, showChart]);
7936
7944
  (0, import_react13.useImperativeHandle)(
@@ -8115,100 +8123,107 @@ function GanttChartInner(props, ref) {
8115
8123
  additionalColumns
8116
8124
  }
8117
8125
  ),
8118
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: showChart ? "gantt-chartSurface" : "gantt-chartSurface gantt-chart-hidden", style: { minWidth: `${gridWidth}px`, flex: 1 }, children: [
8119
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "gantt-stickyHeader", style: { width: `${gridWidth}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8120
- TimeScaleHeader_default,
8121
- {
8122
- days: dateRange,
8123
- dayWidth,
8124
- headerHeight,
8125
- viewMode,
8126
- isCustomWeekend
8127
- }
8128
- ) }),
8129
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
8130
- "div",
8131
- {
8132
- className: "gantt-taskArea",
8133
- style: {
8134
- position: "relative",
8135
- width: `${gridWidth}px`
8136
- },
8137
- children: [
8138
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8139
- GridBackground_default,
8140
- {
8141
- dateRange,
8142
- dayWidth,
8143
- totalHeight: totalGridHeight,
8144
- viewMode,
8145
- isCustomWeekend
8146
- }
8147
- ),
8148
- todayInRange && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TodayIndicator_default, { monthStart, dayWidth }),
8149
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8150
- DependencyLines_default,
8151
- {
8152
- tasks: previewVisibleTasks,
8153
- allTasks: previewNormalizedTasks,
8154
- collapsedParentIds,
8155
- monthStart,
8156
- dayWidth,
8157
- rowHeight,
8158
- gridWidth,
8159
- dragOverrides: dependencyOverrides,
8160
- selectedDep: selectedChip,
8161
- businessDays,
8162
- weekendPredicate: isCustomWeekend
8163
- }
8164
- ),
8165
- dragGuideLines && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8166
- DragGuideLines_default,
8167
- {
8168
- isDragging: dragGuideLines.isDragging,
8169
- dragMode: dragGuideLines.dragMode,
8170
- left: dragGuideLines.left,
8171
- width: dragGuideLines.width,
8172
- totalHeight: totalGridHeight
8173
- }
8174
- ),
8175
- visibleTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8176
- TaskRow_default,
8177
- {
8178
- task,
8179
- monthStart,
8180
- dayWidth,
8181
- rowHeight,
8182
- onTasksChange: handleTaskChange,
8183
- onDragStateChange: (state) => {
8184
- if (state.isDragging) {
8185
- setDragGuideLines(state);
8186
- setDraggedTaskOverride({ taskId: task.id, left: state.left, width: state.width });
8187
- } else {
8188
- setDragGuideLines(null);
8189
- setDraggedTaskOverride(null);
8190
- }
8191
- },
8192
- rowIndex: index,
8193
- allTasks: normalizedTasks,
8194
- enableAutoSchedule: enableAutoSchedule ?? false,
8195
- disableConstraints: disableConstraints ?? false,
8196
- overridePosition: cascadeOverrides.get(task.id),
8197
- onCascadeProgress: handleCascadeProgress,
8198
- onCascade: handleCascade,
8199
- highlightExpiredTasks,
8200
- isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
8201
- businessDays,
8202
- customDays,
8203
- isWeekend: isWeekend3,
8204
- disableTaskDrag
8126
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
8127
+ "div",
8128
+ {
8129
+ className: showChart ? "gantt-chartSurface" : "gantt-chartSurface gantt-chart-hidden",
8130
+ style: { minWidth: `${gridWidth}px`, flex: 1, display: showChart ? void 0 : "none" },
8131
+ children: [
8132
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "gantt-stickyHeader", style: { width: `${gridWidth}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8133
+ TimeScaleHeader_default,
8134
+ {
8135
+ days: dateRange,
8136
+ dayWidth,
8137
+ headerHeight,
8138
+ viewMode,
8139
+ isCustomWeekend
8140
+ }
8141
+ ) }),
8142
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
8143
+ "div",
8144
+ {
8145
+ className: "gantt-taskArea",
8146
+ style: {
8147
+ position: "relative",
8148
+ width: `${gridWidth}px`
8205
8149
  },
8206
- task.id
8207
- ))
8208
- ]
8209
- }
8210
- )
8211
- ] })
8150
+ children: [
8151
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8152
+ GridBackground_default,
8153
+ {
8154
+ dateRange,
8155
+ dayWidth,
8156
+ totalHeight: totalGridHeight,
8157
+ viewMode,
8158
+ isCustomWeekend
8159
+ }
8160
+ ),
8161
+ todayInRange && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TodayIndicator_default, { monthStart, dayWidth }),
8162
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8163
+ DependencyLines_default,
8164
+ {
8165
+ tasks: previewVisibleTasks,
8166
+ allTasks: previewNormalizedTasks,
8167
+ collapsedParentIds,
8168
+ monthStart,
8169
+ dayWidth,
8170
+ rowHeight,
8171
+ gridWidth,
8172
+ dragOverrides: dependencyOverrides,
8173
+ selectedDep: selectedChip,
8174
+ businessDays,
8175
+ weekendPredicate: isCustomWeekend
8176
+ }
8177
+ ),
8178
+ dragGuideLines && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8179
+ DragGuideLines_default,
8180
+ {
8181
+ isDragging: dragGuideLines.isDragging,
8182
+ dragMode: dragGuideLines.dragMode,
8183
+ left: dragGuideLines.left,
8184
+ width: dragGuideLines.width,
8185
+ totalHeight: totalGridHeight
8186
+ }
8187
+ ),
8188
+ visibleTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8189
+ TaskRow_default,
8190
+ {
8191
+ task,
8192
+ monthStart,
8193
+ dayWidth,
8194
+ rowHeight,
8195
+ onTasksChange: handleTaskChange,
8196
+ onDragStateChange: (state) => {
8197
+ if (state.isDragging) {
8198
+ setDragGuideLines(state);
8199
+ setDraggedTaskOverride({ taskId: task.id, left: state.left, width: state.width });
8200
+ } else {
8201
+ setDragGuideLines(null);
8202
+ setDraggedTaskOverride(null);
8203
+ }
8204
+ },
8205
+ rowIndex: index,
8206
+ allTasks: normalizedTasks,
8207
+ enableAutoSchedule: enableAutoSchedule ?? false,
8208
+ disableConstraints: disableConstraints ?? false,
8209
+ overridePosition: cascadeOverrides.get(task.id),
8210
+ onCascadeProgress: handleCascadeProgress,
8211
+ onCascade: handleCascade,
8212
+ highlightExpiredTasks,
8213
+ isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
8214
+ businessDays,
8215
+ customDays,
8216
+ isWeekend: isWeekend3,
8217
+ disableTaskDrag
8218
+ },
8219
+ task.id
8220
+ ))
8221
+ ]
8222
+ }
8223
+ )
8224
+ ]
8225
+ }
8226
+ )
8212
8227
  ] })
8213
8228
  }
8214
8229
  ) });