gantt-lib 0.83.0 → 0.85.0

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.d.mts CHANGED
@@ -304,6 +304,7 @@ declare const progressInRange: (min: number, max: number) => TaskPredicate;
304
304
  declare const nameContains: (substring: string, caseSensitive?: boolean) => TaskPredicate;
305
305
 
306
306
  type BuiltInTaskListColumnId = 'number' | 'name' | 'startDate' | 'endDate' | 'duration' | 'progress' | 'dependencies' | 'actions';
307
+ type TaskListColumnId = BuiltInTaskListColumnId | (string & {});
307
308
  type TaskListColumnAnchor = {
308
309
  after: BuiltInTaskListColumnId | string;
309
310
  } | {
@@ -500,6 +501,8 @@ interface GanttModeProps<TTask extends Task = Task> {
500
501
  showChart?: boolean;
501
502
  /** Additional custom columns to render in the TaskList after built-in columns */
502
503
  additionalColumns?: TaskListColumn<TTask>[];
504
+ /** Built-in or custom TaskList column IDs to hide after column placement is resolved */
505
+ hiddenTaskListColumns?: readonly TaskListColumnId[];
503
506
  /** Additional commands rendered in the TaskList row three-dots menu */
504
507
  taskListMenuCommands?: TaskListMenuCommand<TTask>[];
505
508
  }
@@ -771,6 +774,8 @@ interface TaskListProps {
771
774
  isFilterActive?: boolean;
772
775
  /** Additional columns to display after built-in columns */
773
776
  additionalColumns?: TaskListColumn<any>[];
777
+ /** Built-in or custom TaskList column IDs to hide after column placement is resolved */
778
+ hiddenTaskListColumns?: readonly TaskListColumnId[];
774
779
  /** Additional commands rendered in each row three-dots menu */
775
780
  taskListMenuCommands?: TaskListMenuCommand<Task>[];
776
781
  }
@@ -1264,4 +1269,4 @@ interface VisibleReorderPosition {
1264
1269
  */
1265
1270
  declare function getVisibleReorderPosition(orderedTasks: TaskLike[], visibleTasks: TaskLike[], movedTaskId: string, originVisibleIndex: number, dropVisibleIndex: number): VisibleReorderPosition | null;
1266
1271
 
1267
- export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, type Task, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
1272
+ export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, type Task, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
package/dist/index.d.ts CHANGED
@@ -304,6 +304,7 @@ declare const progressInRange: (min: number, max: number) => TaskPredicate;
304
304
  declare const nameContains: (substring: string, caseSensitive?: boolean) => TaskPredicate;
305
305
 
306
306
  type BuiltInTaskListColumnId = 'number' | 'name' | 'startDate' | 'endDate' | 'duration' | 'progress' | 'dependencies' | 'actions';
307
+ type TaskListColumnId = BuiltInTaskListColumnId | (string & {});
307
308
  type TaskListColumnAnchor = {
308
309
  after: BuiltInTaskListColumnId | string;
309
310
  } | {
@@ -500,6 +501,8 @@ interface GanttModeProps<TTask extends Task = Task> {
500
501
  showChart?: boolean;
501
502
  /** Additional custom columns to render in the TaskList after built-in columns */
502
503
  additionalColumns?: TaskListColumn<TTask>[];
504
+ /** Built-in or custom TaskList column IDs to hide after column placement is resolved */
505
+ hiddenTaskListColumns?: readonly TaskListColumnId[];
503
506
  /** Additional commands rendered in the TaskList row three-dots menu */
504
507
  taskListMenuCommands?: TaskListMenuCommand<TTask>[];
505
508
  }
@@ -771,6 +774,8 @@ interface TaskListProps {
771
774
  isFilterActive?: boolean;
772
775
  /** Additional columns to display after built-in columns */
773
776
  additionalColumns?: TaskListColumn<any>[];
777
+ /** Built-in or custom TaskList column IDs to hide after column placement is resolved */
778
+ hiddenTaskListColumns?: readonly TaskListColumnId[];
774
779
  /** Additional commands rendered in each row three-dots menu */
775
780
  taskListMenuCommands?: TaskListMenuCommand<Task>[];
776
781
  }
@@ -1264,4 +1269,4 @@ interface VisibleReorderPosition {
1264
1269
  */
1265
1270
  declare function getVisibleReorderPosition(orderedTasks: TaskLike[], visibleTasks: TaskLike[], movedTaskId: string, originVisibleIndex: number, dropVisibleIndex: number): VisibleReorderPosition | null;
1266
1271
 
1267
- export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, type Task, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
1272
+ export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, type Task, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
package/dist/index.js CHANGED
@@ -6434,7 +6434,7 @@ function createBuiltInColumns(opts) {
6434
6434
  }
6435
6435
 
6436
6436
  // src/components/TaskList/columns/resolveTaskListColumns.ts
6437
- function resolveTaskListColumns(builtIn, custom) {
6437
+ function resolveTaskListColumns(builtIn, custom, hiddenColumnIds = []) {
6438
6438
  if (process.env.NODE_ENV !== "production") {
6439
6439
  const ids = /* @__PURE__ */ new Set();
6440
6440
  for (const col of [...builtIn, ...custom]) {
@@ -6444,8 +6444,10 @@ function resolveTaskListColumns(builtIn, custom) {
6444
6444
  ids.add(col.id);
6445
6445
  }
6446
6446
  }
6447
+ const hiddenIds = new Set(hiddenColumnIds);
6448
+ const filterHiddenColumns = (columns) => hiddenIds.size === 0 ? columns : columns.filter((col) => !hiddenIds.has(col.id));
6447
6449
  if (custom.length === 0) {
6448
- return [...builtIn];
6450
+ return filterHiddenColumns([...builtIn]);
6449
6451
  }
6450
6452
  const result = [...builtIn];
6451
6453
  const lastInsertAfter = /* @__PURE__ */ new Map();
@@ -6481,7 +6483,7 @@ function resolveTaskListColumns(builtIn, custom) {
6481
6483
  }
6482
6484
  result.splice(insertAt, 0, col);
6483
6485
  }
6484
- return result;
6486
+ return filterHiddenColumns(result);
6485
6487
  }
6486
6488
 
6487
6489
  // src/components/TaskList/TaskList.tsx
@@ -6598,6 +6600,7 @@ var TaskList = ({
6598
6600
  filteredTaskIds = /* @__PURE__ */ new Set(),
6599
6601
  isFilterActive = false,
6600
6602
  additionalColumns,
6603
+ hiddenTaskListColumns,
6601
6604
  taskListMenuCommands
6602
6605
  }) => {
6603
6606
  const [internalCollapsedParentIds, setInternalCollapsedParentIds] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
@@ -7129,8 +7132,12 @@ var TaskList = ({
7129
7132
  }, [orderedTasks, onReorder]);
7130
7133
  const builtInColumns = (0, import_react12.useMemo)(() => createBuiltInColumns({ businessDays }), [businessDays]);
7131
7134
  const resolvedColumns = (0, import_react12.useMemo)(
7132
- () => resolveTaskListColumns(builtInColumns, additionalColumns ?? []),
7133
- [builtInColumns, additionalColumns]
7135
+ () => resolveTaskListColumns(
7136
+ builtInColumns,
7137
+ additionalColumns ?? [],
7138
+ hiddenTaskListColumns
7139
+ ),
7140
+ [builtInColumns, additionalColumns, hiddenTaskListColumns]
7134
7141
  );
7135
7142
  const resolvedColumnWidthTotal = (0, import_react12.useMemo)(
7136
7143
  () => resolvedColumns.reduce((sum, col) => sum + (col.width ?? 120), 0),
@@ -7901,6 +7908,13 @@ var ResourceTypeIcon = ({ type }) => {
7901
7908
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M12 16h.01" })
7902
7909
  ] });
7903
7910
  };
7911
+ function isInactiveResourceStatus(status) {
7912
+ return status?.trim().toLocaleLowerCase() === "inactive";
7913
+ }
7914
+ var ResourceStatusLockIcon = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { className: "gantt-resourceTimeline-resourceStatusIcon", width: "12", height: "12", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
7915
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "5", y: "11", width: "14", height: "10", rx: "2" }),
7916
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M8 11V8a4 4 0 1 1 8 0v3" })
7917
+ ] });
7904
7918
  var ResourceHeader = ({
7905
7919
  resource,
7906
7920
  resourceId,
@@ -7930,6 +7944,7 @@ var ResourceHeader = ({
7930
7944
  const type = resource.type ?? "\u0414\u0440\u0443\u0433\u043E\u0435";
7931
7945
  const scope = resource.scope ?? "Project";
7932
7946
  const scopeLabel = RESOURCE_SCOPE_LABELS[scope] ?? scope;
7947
+ const isInactive = isInactiveResourceStatus(resource.status);
7933
7948
  const applyResourcePatch = (0, import_react14.useCallback)((patch) => {
7934
7949
  onResourceChange?.({ ...resource, ...patch });
7935
7950
  }, [onResourceChange, resource]);
@@ -7990,7 +8005,7 @@ var ResourceHeader = ({
7990
8005
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
7991
8006
  "div",
7992
8007
  {
7993
- className: `gantt-resourceTimeline-resourceHeader${menuOpen ? " gantt-resourceTimeline-resourceHeaderMenuOpen" : ""}`,
8008
+ className: `gantt-resourceTimeline-resourceHeader${menuOpen ? " gantt-resourceTimeline-resourceHeaderMenuOpen" : ""}${isInactive ? " gantt-resourceTimeline-resourceHeaderInactive" : ""}`,
7994
8009
  "data-resource-row-id": resourceId,
7995
8010
  style: {
7996
8011
  height: `${height}px`,
@@ -8057,7 +8072,18 @@ var ResourceHeader = ({
8057
8072
  onResourceNameClick?.(resourceId);
8058
8073
  },
8059
8074
  onDoubleClick: handleNameDoubleClick,
8060
- children: resource.name
8075
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "gantt-resourceTimeline-resourceNameContent", children: [
8076
+ isInactive && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8077
+ "span",
8078
+ {
8079
+ className: "gantt-resourceTimeline-resourceStatusMarker",
8080
+ "aria-label": `\u0420\u0435\u0441\u0443\u0440\u0441 ${resource.name} \u043D\u0435\u0430\u043A\u0442\u0438\u0432\u0435\u043D`,
8081
+ title: "\u041D\u0435\u0430\u043A\u0442\u0438\u0432\u0435\u043D",
8082
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ResourceStatusLockIcon, {})
8083
+ }
8084
+ ),
8085
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "gantt-resourceTimeline-resourceNameText", children: resource.name })
8086
+ ] })
8061
8087
  }
8062
8088
  )
8063
8089
  ] }),
@@ -9335,6 +9361,7 @@ function TaskGanttChartInner(props, ref) {
9335
9361
  disableTaskDrag = false,
9336
9362
  showChart = true,
9337
9363
  additionalColumns,
9364
+ hiddenTaskListColumns,
9338
9365
  taskListMenuCommands
9339
9366
  } = props;
9340
9367
  const containerRef = (0, import_react15.useRef)(null);
@@ -9867,6 +9894,7 @@ function TaskGanttChartInner(props, ref) {
9867
9894
  filteredTaskIds: matchedTaskIds,
9868
9895
  isFilterActive: !!taskFilter,
9869
9896
  additionalColumns,
9897
+ hiddenTaskListColumns,
9870
9898
  taskListMenuCommands
9871
9899
  }
9872
9900
  ),