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.mjs CHANGED
@@ -7788,6 +7788,7 @@ function ResourceTimelineChart({
7788
7788
  rowHeaderWidth = DEFAULT_ROW_HEADER_WIDTH,
7789
7789
  laneHeight = DEFAULT_LANE_HEIGHT,
7790
7790
  headerHeight = DEFAULT_HEADER_HEIGHT,
7791
+ allowVerticalPan = false,
7791
7792
  customDays,
7792
7793
  isWeekend: isWeekend3,
7793
7794
  businessDays = true,
@@ -7795,6 +7796,7 @@ function ResourceTimelineChart({
7795
7796
  disableResourceReassignment,
7796
7797
  renderItem,
7797
7798
  getItemClassName,
7799
+ onResourceItemClick,
7798
7800
  onResourceItemMove
7799
7801
  }) {
7800
7802
  const scrollContainerRef = useRef8(null);
@@ -7883,7 +7885,9 @@ function ResourceTimelineChart({
7883
7885
  return;
7884
7886
  }
7885
7887
  container.scrollLeft = pan.scrollX - (event.clientX - pan.startX);
7886
- container.scrollTop = pan.scrollY - (event.clientY - pan.startY);
7888
+ if (allowVerticalPan) {
7889
+ container.scrollTop = pan.scrollY - (event.clientY - pan.startY);
7890
+ }
7887
7891
  };
7888
7892
  const handlePanEnd = () => {
7889
7893
  if (!panStateRef.current?.active) {
@@ -7901,13 +7905,14 @@ function ResourceTimelineChart({
7901
7905
  window.removeEventListener("mousemove", handlePanMove);
7902
7906
  window.removeEventListener("mouseup", handlePanEnd);
7903
7907
  };
7904
- }, []);
7908
+ }, [allowVerticalPan]);
7905
7909
  return /* @__PURE__ */ jsx15("div", { className: "gantt-container gantt-resourceTimeline", children: /* @__PURE__ */ jsx15(
7906
7910
  "div",
7907
7911
  {
7908
7912
  ref: scrollContainerRef,
7909
7913
  className: "gantt-resourceTimeline-scrollContainer",
7910
7914
  style: { cursor: "grab" },
7915
+ "data-allow-vertical-pan": allowVerticalPan ? "true" : "false",
7911
7916
  onMouseDown: handlePanStart,
7912
7917
  children: /* @__PURE__ */ jsxs12("div", { className: "gantt-resourceTimeline-scrollContent", children: [
7913
7918
  /* @__PURE__ */ jsxs12(
@@ -8042,6 +8047,18 @@ function ResourceTimelineChart({
8042
8047
  className,
8043
8048
  "data-resource-item-id": layoutItem.itemId,
8044
8049
  onMouseDown: (event) => startDrag(event, layoutItem),
8050
+ onClick: () => onResourceItemClick?.(layoutItem.item),
8051
+ onKeyDown: (event) => {
8052
+ if (!onResourceItemClick) {
8053
+ return;
8054
+ }
8055
+ if (event.key === "Enter" || event.key === " ") {
8056
+ event.preventDefault();
8057
+ onResourceItemClick(layoutItem.item);
8058
+ }
8059
+ },
8060
+ role: onResourceItemClick ? "button" : void 0,
8061
+ tabIndex: onResourceItemClick ? 0 : void 0,
8045
8062
  style: {
8046
8063
  left: `${itemGeometry.left}px`,
8047
8064
  top: `${itemGeometry.top}px`,
@@ -8079,18 +8096,19 @@ function ResourceTimelineChart({
8079
8096
  },
8080
8097
  `conflict-overlay-${index}`
8081
8098
  )),
8082
- /* @__PURE__ */ jsx15("div", { className: "gantt-resourceTimeline-itemInner", children: renderItem ? renderItem(layoutItem.item, renderContext) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
8083
- /* @__PURE__ */ jsx15(
8084
- "span",
8085
- {
8086
- className: "gantt-resourceTimeline-itemDurationChip",
8087
- "aria-label": `${durationValue} \u0434`,
8088
- children: durationValue
8089
- }
8090
- ),
8091
- /* @__PURE__ */ jsx15("span", { className: "gantt-resourceTimeline-itemTitle", children: layoutItem.item.title }),
8092
- layoutItem.item.subtitle && /* @__PURE__ */ jsx15("span", { className: "gantt-resourceTimeline-itemSubtitle", children: layoutItem.item.subtitle }),
8093
- /* @__PURE__ */ jsx15("span", { className: "gantt-resourceTimeline-itemDates", children: formatDateRangeLabel(layoutItem.startDate, layoutItem.endDate) })
8099
+ /* @__PURE__ */ jsx15("div", { className: "gantt-resourceTimeline-itemInner", children: renderItem ? renderItem(layoutItem.item, renderContext) : /* @__PURE__ */ jsxs12("div", { className: "gantt-resourceTimeline-defaultItemContent", children: [
8100
+ /* @__PURE__ */ jsxs12("div", { className: "gantt-resourceTimeline-defaultItemMain", children: [
8101
+ /* @__PURE__ */ jsx15(
8102
+ "span",
8103
+ {
8104
+ className: "gantt-resourceTimeline-itemDurationChip",
8105
+ "aria-label": `${durationValue} \u0434`,
8106
+ children: durationValue
8107
+ }
8108
+ ),
8109
+ /* @__PURE__ */ jsx15("span", { className: "gantt-resourceTimeline-itemTitle", children: layoutItem.item.title })
8110
+ ] }),
8111
+ layoutItem.item.subtitle && /* @__PURE__ */ jsx15("span", { className: "gantt-resourceTimeline-itemSubtitle", children: layoutItem.item.subtitle })
8094
8112
  ] }) })
8095
8113
  ]
8096
8114
  },