gantt-lib 0.76.0 → 0.77.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.js CHANGED
@@ -7885,6 +7885,7 @@ function ResourceTimelineChart({
7885
7885
  rowHeaderWidth = DEFAULT_ROW_HEADER_WIDTH,
7886
7886
  laneHeight = DEFAULT_LANE_HEIGHT,
7887
7887
  headerHeight = DEFAULT_HEADER_HEIGHT,
7888
+ allowVerticalPan = false,
7888
7889
  customDays,
7889
7890
  isWeekend: isWeekend3,
7890
7891
  businessDays = true,
@@ -7892,6 +7893,7 @@ function ResourceTimelineChart({
7892
7893
  disableResourceReassignment,
7893
7894
  renderItem,
7894
7895
  getItemClassName,
7896
+ onResourceItemClick,
7895
7897
  onResourceItemMove
7896
7898
  }) {
7897
7899
  const scrollContainerRef = (0, import_react14.useRef)(null);
@@ -7980,7 +7982,9 @@ function ResourceTimelineChart({
7980
7982
  return;
7981
7983
  }
7982
7984
  container.scrollLeft = pan.scrollX - (event.clientX - pan.startX);
7983
- container.scrollTop = pan.scrollY - (event.clientY - pan.startY);
7985
+ if (allowVerticalPan) {
7986
+ container.scrollTop = pan.scrollY - (event.clientY - pan.startY);
7987
+ }
7984
7988
  };
7985
7989
  const handlePanEnd = () => {
7986
7990
  if (!panStateRef.current?.active) {
@@ -7998,13 +8002,14 @@ function ResourceTimelineChart({
7998
8002
  window.removeEventListener("mousemove", handlePanMove);
7999
8003
  window.removeEventListener("mouseup", handlePanEnd);
8000
8004
  };
8001
- }, []);
8005
+ }, [allowVerticalPan]);
8002
8006
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "gantt-container gantt-resourceTimeline", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8003
8007
  "div",
8004
8008
  {
8005
8009
  ref: scrollContainerRef,
8006
8010
  className: "gantt-resourceTimeline-scrollContainer",
8007
8011
  style: { cursor: "grab" },
8012
+ "data-allow-vertical-pan": allowVerticalPan ? "true" : "false",
8008
8013
  onMouseDown: handlePanStart,
8009
8014
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "gantt-resourceTimeline-scrollContent", children: [
8010
8015
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
@@ -8139,6 +8144,18 @@ function ResourceTimelineChart({
8139
8144
  className,
8140
8145
  "data-resource-item-id": layoutItem.itemId,
8141
8146
  onMouseDown: (event) => startDrag(event, layoutItem),
8147
+ onClick: () => onResourceItemClick?.(layoutItem.item),
8148
+ onKeyDown: (event) => {
8149
+ if (!onResourceItemClick) {
8150
+ return;
8151
+ }
8152
+ if (event.key === "Enter" || event.key === " ") {
8153
+ event.preventDefault();
8154
+ onResourceItemClick(layoutItem.item);
8155
+ }
8156
+ },
8157
+ role: onResourceItemClick ? "button" : void 0,
8158
+ tabIndex: onResourceItemClick ? 0 : void 0,
8142
8159
  style: {
8143
8160
  left: `${itemGeometry.left}px`,
8144
8161
  top: `${itemGeometry.top}px`,
@@ -8176,18 +8193,19 @@ function ResourceTimelineChart({
8176
8193
  },
8177
8194
  `conflict-overlay-${index}`
8178
8195
  )),
8179
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "gantt-resourceTimeline-itemInner", children: renderItem ? renderItem(layoutItem.item, renderContext) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
8180
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8181
- "span",
8182
- {
8183
- className: "gantt-resourceTimeline-itemDurationChip",
8184
- "aria-label": `${durationValue} \u0434`,
8185
- children: durationValue
8186
- }
8187
- ),
8188
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "gantt-resourceTimeline-itemTitle", children: layoutItem.item.title }),
8189
- layoutItem.item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "gantt-resourceTimeline-itemSubtitle", children: layoutItem.item.subtitle }),
8190
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "gantt-resourceTimeline-itemDates", children: formatDateRangeLabel(layoutItem.startDate, layoutItem.endDate) })
8196
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "gantt-resourceTimeline-itemInner", children: renderItem ? renderItem(layoutItem.item, renderContext) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "gantt-resourceTimeline-defaultItemContent", children: [
8197
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "gantt-resourceTimeline-defaultItemMain", children: [
8198
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8199
+ "span",
8200
+ {
8201
+ className: "gantt-resourceTimeline-itemDurationChip",
8202
+ "aria-label": `${durationValue} \u0434`,
8203
+ children: durationValue
8204
+ }
8205
+ ),
8206
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "gantt-resourceTimeline-itemTitle", children: layoutItem.item.title })
8207
+ ] }),
8208
+ layoutItem.item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "gantt-resourceTimeline-itemSubtitle", children: layoutItem.item.subtitle })
8191
8209
  ] }) })
8192
8210
  ]
8193
8211
  },