laif-ds 0.1.32 → 0.1.34

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.
Files changed (52) hide show
  1. package/dist/components/ui/accordion.js +2 -7
  2. package/dist/components/ui/alert-dialog.js +10 -37
  3. package/dist/components/ui/alert.js +1 -5
  4. package/dist/components/ui/app-multiple-select-dropdown.js +120 -116
  5. package/dist/components/ui/app-select.js +9 -1
  6. package/dist/components/ui/app-sidebar.js +9 -23
  7. package/dist/components/ui/aspect-ratio.js +1 -3
  8. package/dist/components/ui/async-select.js +80 -64
  9. package/dist/components/ui/audio-visualizer.js +3 -2
  10. package/dist/components/ui/button.js +45 -5
  11. package/dist/components/ui/card.js +7 -2
  12. package/dist/components/ui/charts/circular.js +1 -1
  13. package/dist/components/ui/chat-message.js +34 -16
  14. package/dist/components/ui/chat.js +4 -4
  15. package/dist/components/ui/command.js +1 -1
  16. package/dist/components/ui/data-cross-table.js +33 -9
  17. package/dist/components/ui/data-table.js +4 -4
  18. package/dist/components/ui/date-picker.js +2 -2
  19. package/dist/components/ui/dropdown-menu.js +7 -7
  20. package/dist/components/ui/file-preview.js +9 -9
  21. package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +25 -3
  22. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +32 -13
  23. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +7 -1
  24. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +6 -1
  25. package/dist/components/ui/gantt/components/Chart/Chart.js +19 -3
  26. package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +80 -71
  27. package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +72 -54
  28. package/dist/components/ui/gantt/components/Controls/Controls.js +4 -2
  29. package/dist/components/ui/gantt/hooks/useGanttCalculate.js +11 -1
  30. package/dist/components/ui/gantt/utils/getWholeWidth.js +4 -1
  31. package/dist/components/ui/gantt/utils/transformData.js +7 -4
  32. package/dist/components/ui/input-selector.js +5 -2
  33. package/dist/components/ui/input.js +41 -46
  34. package/dist/components/ui/interrupt-prompt.js +2 -2
  35. package/dist/components/ui/markdown-renderer.js +2 -2
  36. package/dist/components/ui/message-input.js +12 -10
  37. package/dist/components/ui/multiple-selector.js +44 -31
  38. package/dist/components/ui/prompt-suggestions.js +2 -2
  39. package/dist/components/ui/resizable.js +1 -1
  40. package/dist/components/ui/select.js +6 -10
  41. package/dist/components/ui/sidebar.js +27 -19
  42. package/dist/components/ui/slider.js +103 -89
  43. package/dist/components/ui/table-skeleton.js +29 -11
  44. package/dist/components/ui/table.js +4 -1
  45. package/dist/components/ui/tabs.js +1 -1
  46. package/dist/components/ui/theme-switcher.js +2 -7
  47. package/dist/components/ui/typing-indicator.js +4 -4
  48. package/dist/components/ui/typo.js +1 -8
  49. package/dist/hooks/use-mobile.js +3 -1
  50. package/dist/index.d.ts +9 -8
  51. package/dist/styles.css +1 -1
  52. package/package.json +3 -1
@@ -11,7 +11,7 @@ const B = w, E = x, I = s.forwardRef(({ className: e, inset: t, children: o, ...
11
11
  {
12
12
  ref: d,
13
13
  className: r(
14
- "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
14
+ "focus:bg-accent data-[state=open]:bg-accent flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
15
15
  t && "pl-8",
16
16
  e
17
17
  ),
@@ -28,7 +28,7 @@ const C = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a(
28
28
  {
29
29
  ref: o,
30
30
  className: r(
31
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
31
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border p-1 shadow-lg",
32
32
  e
33
33
  ),
34
34
  ...t
@@ -41,7 +41,7 @@ const D = s.forwardRef(({ className: e, sideOffset: t = 4, ...o }, n) => /* @__P
41
41
  ref: n,
42
42
  sideOffset: t,
43
43
  className: r(
44
- "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
44
+ "bg-popover text-popover-foreground z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
45
45
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
46
46
  e
47
47
  ),
@@ -54,7 +54,7 @@ const M = s.forwardRef(({ className: e, inset: t, ...o }, n) => /* @__PURE__ */
54
54
  {
55
55
  ref: n,
56
56
  className: r(
57
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
57
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
58
58
  t && "pl-8",
59
59
  e
60
60
  ),
@@ -67,7 +67,7 @@ const S = s.forwardRef(({ className: e, children: t, checked: o, ...n }, d) => /
67
67
  {
68
68
  ref: d,
69
69
  className: r(
70
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
70
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
71
71
  e
72
72
  ),
73
73
  checked: o,
@@ -84,7 +84,7 @@ const z = s.forwardRef(({ className: e, children: t, ...o }, n) => /* @__PURE__
84
84
  {
85
85
  ref: n,
86
86
  className: r(
87
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
87
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
88
88
  e
89
89
  ),
90
90
  ...o,
@@ -112,7 +112,7 @@ const T = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a(
112
112
  p,
113
113
  {
114
114
  ref: o,
115
- className: r("-mx-1 my-1 h-px bg-muted", e),
115
+ className: r("bg-muted -mx-1 my-1 h-px", e),
116
116
  ...t
117
117
  }
118
118
  ));
@@ -24,16 +24,16 @@ const m = l.forwardRef(
24
24
  "img",
25
25
  {
26
26
  alt: `Attachment ${e.name}`,
27
- className: "grid h-10 w-10 shrink-0 place-items-center rounded-sm border bg-d-secondary object-cover",
27
+ className: "bg-d-secondary grid h-10 w-10 shrink-0 place-items-center rounded-sm border object-cover",
28
28
  src: URL.createObjectURL(e)
29
29
  }
30
30
  ),
31
- /* @__PURE__ */ t("span", { className: "w-full truncate text-d-secondary-foreground", children: e.name })
31
+ /* @__PURE__ */ t("span", { className: "text-d-secondary-foreground w-full truncate", children: e.name })
32
32
  ] }),
33
33
  r ? /* @__PURE__ */ t(
34
34
  "button",
35
35
  {
36
- className: "absolute -right-2 -top-2 flex h-4 w-4 items-center justify-center rounded-full border bg-d-background",
36
+ className: "bg-d-background absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
37
37
  type: "button",
38
38
  onClick: r,
39
39
  "aria-label": "Remove attachment",
@@ -67,13 +67,13 @@ const u = l.forwardRef(
67
67
  exit: { opacity: 0, y: "100%" },
68
68
  children: [
69
69
  /* @__PURE__ */ a("div", { className: "flex w-full items-center space-x-2", children: [
70
- /* @__PURE__ */ t("div", { className: "grid h-10 w-10 shrink-0 place-items-center rounded-sm border bg-d-secondary p-0.5", children: /* @__PURE__ */ t("div", { className: "h-full w-full overflow-hidden text-[6px] leading-none text-d-secondary-foreground", children: x || "Loading..." }) }),
71
- /* @__PURE__ */ t("span", { className: "w-full truncate text-d-secondary-foreground", children: e.name })
70
+ /* @__PURE__ */ t("div", { className: "bg-d-secondary grid h-10 w-10 shrink-0 place-items-center rounded-sm border p-0.5", children: /* @__PURE__ */ t("div", { className: "text-d-secondary-foreground h-full w-full overflow-hidden text-[6px] leading-none", children: x || "Loading..." }) }),
71
+ /* @__PURE__ */ t("span", { className: "text-d-secondary-foreground w-full truncate", children: e.name })
72
72
  ] }),
73
73
  r ? /* @__PURE__ */ t(
74
74
  "button",
75
75
  {
76
- className: "absolute -right-2 -top-2 flex h-4 w-4 items-center justify-center rounded-full border bg-d-background",
76
+ className: "bg-d-background absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
77
77
  type: "button",
78
78
  onClick: r,
79
79
  "aria-label": "Remove attachment",
@@ -98,13 +98,13 @@ const f = l.forwardRef(
98
98
  exit: { opacity: 0, y: "100%" },
99
99
  children: [
100
100
  /* @__PURE__ */ a("div", { className: "flex w-full items-center space-x-2", children: [
101
- /* @__PURE__ */ t("div", { className: "grid h-10 w-10 shrink-0 place-items-center rounded-sm border bg-d-secondary", children: /* @__PURE__ */ t(p, { className: "h-6 w-6 text-d-foreground" }) }),
102
- /* @__PURE__ */ t("span", { className: "w-full truncate text-d-secondary-foreground", children: e.name })
101
+ /* @__PURE__ */ t("div", { className: "bg-d-secondary grid h-10 w-10 shrink-0 place-items-center rounded-sm border", children: /* @__PURE__ */ t(p, { className: "text-d-foreground h-6 w-6" }) }),
102
+ /* @__PURE__ */ t("span", { className: "text-d-secondary-foreground w-full truncate", children: e.name })
103
103
  ] }),
104
104
  r ? /* @__PURE__ */ t(
105
105
  "button",
106
106
  {
107
- className: "absolute -right-2 -top-2 flex h-4 w-4 items-center justify-center rounded-full border bg-d-background",
107
+ className: "bg-d-background absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
108
108
  type: "button",
109
109
  onClick: r,
110
110
  "aria-label": "Remove attachment",
@@ -10,18 +10,40 @@ import { getWholeWidth as V } from "../../../utils/getWholeWidth.js";
10
10
  import q from "./BarsRow/BarsRow.js";
11
11
  import { GanttConsts as J } from "../../../constants/GanttConsts.js";
12
12
  import { DragTypes as u } from "../../../enums/DragTypes.js";
13
- const Q = ({ scaleWidth: D, style: y, children: c, ...h }) => /* @__PURE__ */ T("div", { style: { ...y, width: D, position: "relative" }, ...h, children: c }), U = F(
13
+ const Q = ({
14
+ scaleWidth: D,
15
+ style: y,
16
+ children: c,
17
+ ...h
18
+ }) => /* @__PURE__ */ T(
19
+ "div",
20
+ {
21
+ style: { ...y, width: D, position: "relative" },
22
+ ...h,
23
+ children: c
24
+ }
25
+ ), U = F(
14
26
  ({ width: D, height: y, data: c, setData: h, onBarDoubleClick: W, onBarChange: x }, v) => {
15
27
  const { settings: n, scaleDates: S } = L(B), H = E(() => V(
16
28
  S,
17
29
  n.dimension,
18
30
  n.scaleStepItems,
19
31
  n.stepWidth
20
- ), [S, n.dimension, n.scaleStepItems, n.stepWidth]), _ = E(() => j(n.gridSize), [n.gridSize]), I = E(() => {
32
+ ), [
33
+ S,
34
+ n.dimension,
35
+ n.scaleStepItems,
36
+ n.stepWidth
37
+ ]), _ = E(
38
+ () => j(n.gridSize),
39
+ [n.gridSize]
40
+ ), I = E(() => {
21
41
  const l = [];
22
42
  for (const o of c)
23
43
  o.hasOwnProperty("expanded") && !o.expanded && l.push(o.key);
24
- return c.filter((o) => !o.parentsKeys.some((m) => l.includes(m)));
44
+ return c.filter((o) => !o.parentsKeys.some(
45
+ (m) => l.includes(m)
46
+ ));
25
47
  }, [c]), Z = P(() => J.ROW_HEIGHT, []), A = P(
26
48
  (l) => {
27
49
  var R, b, G, M, g, z, k, C;
@@ -10,8 +10,23 @@ import { GanttContext as q } from "../../../../Gantt/GanttContext.js";
10
10
  import { DragTypes as s } from "../../../../../enums/DragTypes.js";
11
11
  let R;
12
12
  const J = W(
13
- ({ title: L, barKey: A, startDate: d, endDate: x, repetead: N, onBarDoubleClick: T, leftRender: h }) => {
14
- const { scaleDates: S, settings: n } = D(q), { barData: g } = D(U), e = n.draggable === !0, { attributes: b, listeners: a, transform: w, activatorEvent: c, setNodeRef: k, setActivatorNodeRef: v } = H({
13
+ ({
14
+ title: L,
15
+ barKey: A,
16
+ startDate: d,
17
+ endDate: x,
18
+ repetead: N,
19
+ onBarDoubleClick: T,
20
+ leftRender: h
21
+ }) => {
22
+ const { scaleDates: S, settings: n } = D(q), { barData: g } = D(U), e = n.draggable === !0, {
23
+ attributes: b,
24
+ listeners: a,
25
+ transform: w,
26
+ activatorEvent: c,
27
+ setNodeRef: k,
28
+ setActivatorNodeRef: v
29
+ } = H({
15
30
  id: A,
16
31
  disabled: !e
17
32
  }), f = l(() => (x - d) / n.secondsInPixel, [x, n.secondsInPixel, d]), y = l(() => N ? (24 * 3600 - 1) / n.secondsInPixel : 0, [N, n.secondsInPixel]), C = l(() => (d - S[0]) / n.secondsInPixel, [S, n.secondsInPixel, d]), o = l(() => {
@@ -25,12 +40,16 @@ const J = W(
25
40
  let u = o === s.RESIZE_LEFT ? -w.x : w.x;
26
41
  return u !== 0 && o !== s.DRAG && (t !== null && u > t && (u = t), u < m && (u = m)), u;
27
42
  }, [o, y, n.gridSize, f, w]), I = l(() => o === s.DRAG ? f : f + r, [o, r, f]), Z = l(() => o === s.DRAG ? `translateX(${r}px)` : `translateX(${o === s.RESIZE_LEFT ? -r : 0}px)`, [o, r]), _ = l(() => {
28
- const t = [s.RESIZE_LEFT, s.DRAG].includes(o) ? r * n.secondsInPixel : 0;
43
+ const t = [s.RESIZE_LEFT, s.DRAG].includes(
44
+ o
45
+ ) ? r * n.secondsInPixel : 0;
29
46
  return G.unix(
30
47
  d + (o === s.RESIZE_LEFT ? -t : t)
31
48
  ).format("L LTS");
32
49
  }, [o, r, n.secondsInPixel, d]), j = l(() => {
33
- const t = [s.RESIZE_RIGHT, s.DRAG].includes(o) ? r * n.secondsInPixel : 0;
50
+ const t = [s.RESIZE_RIGHT, s.DRAG].includes(
51
+ o
52
+ ) ? r * n.secondsInPixel : 0;
34
53
  return G.unix(x + t).format("L LTS");
35
54
  }, [o, r, x, n.secondsInPixel]), z = E(() => {
36
55
  T && T(g);
@@ -48,7 +67,7 @@ const J = W(
48
67
  /* @__PURE__ */ i(M, { asChild: !0, children: /* @__PURE__ */ i(
49
68
  "div",
50
69
  {
51
- className: "absolute flex items-center z-10",
70
+ className: "absolute z-10 flex items-center",
52
71
  style: {
53
72
  height: "40px",
54
73
  top: 0,
@@ -60,7 +79,7 @@ const J = W(
60
79
  children: /* @__PURE__ */ p(
61
80
  "div",
62
81
  {
63
- className: "flex justify-between items-center w-full h-6 rounded px-0.5 text-white",
82
+ className: "flex h-6 w-full items-center justify-between rounded px-0.5 text-white",
64
83
  "data-dragtype": s.DRAG,
65
84
  ...e ? a : {},
66
85
  ...e ? b : {},
@@ -76,7 +95,7 @@ const J = W(
76
95
  "div",
77
96
  {
78
97
  className: P(
79
- "flex-shrink-0 flex justify-between w-2.5 h-full rounded bg-black/25 cursor-w-resize",
98
+ "flex h-full w-2.5 flex-shrink-0 cursor-w-resize justify-between rounded bg-black/25",
80
99
  I < 25 && "hidden group-hover:flex"
81
100
  ),
82
101
  ref: e ? v : void 0,
@@ -87,8 +106,8 @@ const J = W(
87
106
  ...e ? {} : { cursor: "default", pointerEvents: "none" }
88
107
  },
89
108
  children: [
90
- /* @__PURE__ */ i("span", { className: "w-0.5 h-full bg-white/60" }),
91
- /* @__PURE__ */ i("span", { className: "w-0.5 h-full bg-white/60" })
109
+ /* @__PURE__ */ i("span", { className: "h-full w-0.5 bg-white/60" }),
110
+ /* @__PURE__ */ i("span", { className: "h-full w-0.5 bg-white/60" })
92
111
  ]
93
112
  }
94
113
  ),
@@ -96,7 +115,7 @@ const J = W(
96
115
  "div",
97
116
  {
98
117
  className: P(
99
- "px-2 overflow-hidden whitespace-nowrap text-ellipsis select-none flex items-center gap-2",
118
+ "flex items-center gap-2 overflow-hidden px-2 text-ellipsis whitespace-nowrap select-none",
100
119
  I < 100 && "hidden"
101
120
  ),
102
121
  "data-dragtype": s.DRAG,
@@ -119,7 +138,7 @@ const J = W(
119
138
  "div",
120
139
  {
121
140
  className: P(
122
- "flex-shrink-0 flex justify-between w-2.5 h-full rounded bg-black/25 cursor-e-resize",
141
+ "flex h-full w-2.5 flex-shrink-0 cursor-e-resize justify-between rounded bg-black/25",
123
142
  I < 25 && "hidden group-hover:flex"
124
143
  ),
125
144
  ref: e ? v : void 0,
@@ -130,8 +149,8 @@ const J = W(
130
149
  ...e ? {} : { cursor: "default", pointerEvents: "none" }
131
150
  },
132
151
  children: [
133
- /* @__PURE__ */ i("span", { className: "w-0.5 h-full bg-white/60" }),
134
- /* @__PURE__ */ i("span", { className: "w-0.5 h-full bg-white/60" })
152
+ /* @__PURE__ */ i("span", { className: "h-full w-0.5 bg-white/60" }),
153
+ /* @__PURE__ */ i("span", { className: "h-full w-0.5 bg-white/60" })
135
154
  ]
136
155
  }
137
156
  )
@@ -5,7 +5,13 @@ import x from "../../../../../../../../_virtual/dayjs.min.js";
5
5
  import { GanttContext as I } from "../../../../Gantt/GanttContext.js";
6
6
  import S from "../RepeteadBars/RepeteadBars.js";
7
7
  import v from "../BarItem/BarItem.js";
8
- const M = ({ data: e, title: s, barKey: o, leftRender: D, onBarDoubleClick: m }) => {
8
+ const M = ({
9
+ data: e,
10
+ title: s,
11
+ barKey: o,
12
+ leftRender: D,
13
+ onBarDoubleClick: m
14
+ }) => {
9
15
  const { scaleDates: r, scaleRenderState: t } = l(I), u = n(() => r[t.overscanStartIndex], [r, t.overscanStartIndex]), p = n(() => r[t.overscanStopIndex], [r, t.overscanStopIndex]), c = n(() => x(e == null ? void 0 : e.startDate).unix(), [e == null ? void 0 : e.startDate]), f = n(() => x(e == null ? void 0 : e.endDate).unix(), [e == null ? void 0 : e.endDate]);
10
16
  return e ? e.repeatType ? /* @__PURE__ */ i(
11
17
  S,
@@ -4,7 +4,12 @@ import { useContext as i, useMemo as a } from "react";
4
4
  import { BarsRowContext as p } from "./BarsRowContext.js";
5
5
  import { GanttContext as m } from "../../../Gantt/GanttContext.js";
6
6
  import l from "./BarsItems/BarItems.js";
7
- const v = ({ barData: t, index: r, style: o, onBarDoubleClick: s }) => {
7
+ const v = ({
8
+ barData: t,
9
+ index: r,
10
+ style: o,
11
+ onBarDoubleClick: s
12
+ }) => {
8
13
  const { settings: n } = i(m), d = a(() => ({
9
14
  ...o,
10
15
  backgroundImage: `repeating-linear-gradient(to right, var(--d-border) 0px 1px, ${r % 2 === 0 ? "var(--d-background)" : "var(--d-secondary)"} 1px ${n.stepWidth}px`
@@ -10,8 +10,15 @@ import q from "./Tree/Tree.js";
10
10
  import v from "./Bars/Bars.js";
11
11
  import { GanttConsts as m } from "../../constants/GanttConsts.js";
12
12
  import { GanttDimensionsSettings as z } from "../../constants/DimensionsSettings.js";
13
- const et = ({ data: f, className: x, onBarDoubleClick: W, onBarChange: I }) => {
14
- const { settings: n, scaleDates: c, wrapRef: t, setCurrentDate: d, treeTitle: b } = R(F), h = a(null), T = a(null), g = a(null), [D, i] = s([]), [l, G] = s(!0), [p, L] = s(0), [C, _] = s(0), E = k(() => {
13
+ const et = ({
14
+ data: f,
15
+ className: x,
16
+ onBarDoubleClick: W,
17
+ onBarChange: I
18
+ }) => {
19
+ const { settings: n, scaleDates: c, wrapRef: t, setCurrentDate: d, treeTitle: b } = R(F), h = a(null), T = a(null), g = a(null), [D, i] = s(
20
+ []
21
+ ), [l, G] = s(!0), [p, L] = s(0), [C, _] = s(0), E = k(() => {
15
22
  var r;
16
23
  const e = Math.round(
17
24
  ((((r = t == null ? void 0 : t.current) == null ? void 0 : r.scrollLeft) || 0) + m.TREE_WIDTH) * z[n.dimension].secondsInPixel
@@ -43,7 +50,16 @@ const et = ({ data: f, className: x, onBarDoubleClick: W, onBarChange: I }) => {
43
50
  }
44
51
  ) : /* @__PURE__ */ M(N, { children: [
45
52
  /* @__PURE__ */ o(P, { width: p, wrapRef: t, ref: h }),
46
- /* @__PURE__ */ o(q, { height: C, data: D, setData: i, ref: T, treeTitle: b }),
53
+ /* @__PURE__ */ o(
54
+ q,
55
+ {
56
+ height: C,
57
+ data: D,
58
+ setData: i,
59
+ ref: T,
60
+ treeTitle: b
61
+ }
62
+ ),
47
63
  /* @__PURE__ */ o(
48
64
  v,
49
65
  {
@@ -9,78 +9,87 @@ import { getScaleItems as G } from "../../../utils/getScaleItems.js";
9
9
  import { GanttDimensions as p } from "../../../enums/GanttDimensions.js";
10
10
  import { GanttDimensionsSettings as L } from "../../../constants/DimensionsSettings.js";
11
11
  import { GanttConsts as m } from "../../../constants/GanttConsts.js";
12
- const R = C(({ width: W, wrapRef: f }, y) => {
13
- const { scaleDates: s, setScaleDates: d, setScaleRenderState: h, settings: t } = O(w), e = F(y), l = M(null), N = M(null), Y = u(
14
- (n) => {
15
- const i = c.unix(s[n]);
16
- return t.dimension === p.DAY ? i.daysInMonth() * t.stepWidth : t.scaleStepItems * t.stepWidth;
17
- },
18
- [s, t.dimension, t.scaleStepItems, t.stepWidth]
19
- ), E = u(
20
- ({ scrollOffset: n }) => {
21
- var r, a, S, I, g;
22
- const i = L[t.dimension].unitOfTime;
23
- if (n < m.MIN_SCROLL_OFFSET) {
24
- const x = c.unix(s[0]).subtract(1, i);
25
- let D = t.scaleStepItems * t.stepWidth;
26
- t.dimension === p.DAY && (D = x.daysInMonth() * t.stepWidth), d([x.unix(), ...s]), (r = f.current) == null || r.scrollTo({ left: n + D }), (a = e == null ? void 0 : e.current) == null || a.resetAfterIndex(0);
12
+ const R = C(
13
+ ({ width: W, wrapRef: f }, y) => {
14
+ const { scaleDates: s, setScaleDates: d, setScaleRenderState: h, settings: t } = O(w), e = F(y), l = M(null), N = M(null), Y = u(
15
+ (n) => {
16
+ const i = c.unix(s[n]);
17
+ return t.dimension === p.DAY ? i.daysInMonth() * t.stepWidth : t.scaleStepItems * t.stepWidth;
18
+ },
19
+ [
20
+ s,
21
+ t.dimension,
22
+ t.scaleStepItems,
23
+ t.stepWidth
24
+ ]
25
+ ), E = u(
26
+ ({ scrollOffset: n }) => {
27
+ var r, a, S, I, g;
28
+ const i = L[t.dimension].unitOfTime;
29
+ if (n < m.MIN_SCROLL_OFFSET) {
30
+ const x = c.unix(s[0]).subtract(1, i);
31
+ let D = t.scaleStepItems * t.stepWidth;
32
+ t.dimension === p.DAY && (D = x.daysInMonth() * t.stepWidth), d([x.unix(), ...s]), (r = f.current) == null || r.scrollTo({ left: n + D }), (a = e == null ? void 0 : e.current) == null || a.resetAfterIndex(0);
33
+ }
34
+ (((S = l.current) == null ? void 0 : S.scrollWidth) || 0) - (((I = l.current) == null ? void 0 : I.clientWidth) || 0) - n - m.TREE_WIDTH < m.MIN_SCROLL_OFFSET && (d([
35
+ ...s,
36
+ c.unix(s[s.length - 1]).add(1, i).unix()
37
+ ]), (g = e == null ? void 0 : e.current) == null || g.resetAfterIndex(0));
38
+ },
39
+ [
40
+ e,
41
+ s,
42
+ d,
43
+ t.dimension,
44
+ t.scaleStepItems,
45
+ t.stepWidth,
46
+ f
47
+ ]
48
+ ), T = u(
49
+ (n) => {
50
+ h(n);
51
+ },
52
+ [h]
53
+ );
54
+ return _(() => {
55
+ var n;
56
+ (n = e == null ? void 0 : e.current) == null || n.resetAfterIndex(0);
57
+ }, [e, t.dimension]), /* @__PURE__ */ o("div", { className: "gantt-scale-wrap", children: /* @__PURE__ */ o(
58
+ v,
59
+ {
60
+ className: "gantt-scale-list",
61
+ layout: "horizontal",
62
+ width: W,
63
+ height: m.HEADER_HEIGHT,
64
+ itemCount: s.length,
65
+ itemSize: Y,
66
+ itemData: s,
67
+ ref: e,
68
+ outerRef: l,
69
+ innerRef: N,
70
+ initialScrollOffset: t.initialScrollOffset,
71
+ onScroll: E,
72
+ onItemsRendered: T,
73
+ children: ({ style: n, index: i, data: r }) => /* @__PURE__ */ A("div", { className: "gantt-scale-item", style: n, children: [
74
+ /* @__PURE__ */ o("div", { className: "gantt-scale-title", children: c.unix(r[i]).format(
75
+ t.dimension === p.DAY ? "MMMM, YYYY" : "ddd, D MMMM, YY"
76
+ ) }),
77
+ /* @__PURE__ */ o("div", { className: "gantt-scale-steps", children: G(t.dimension, r[i]).map(
78
+ (a) => /* @__PURE__ */ o(
79
+ "div",
80
+ {
81
+ className: "gantt-scale-step",
82
+ style: { width: t.stepWidth },
83
+ children: a
84
+ },
85
+ a
86
+ )
87
+ ) })
88
+ ] })
27
89
  }
28
- (((S = l.current) == null ? void 0 : S.scrollWidth) || 0) - (((I = l.current) == null ? void 0 : I.clientWidth) || 0) - n - m.TREE_WIDTH < m.MIN_SCROLL_OFFSET && (d([
29
- ...s,
30
- c.unix(s[s.length - 1]).add(1, i).unix()
31
- ]), (g = e == null ? void 0 : e.current) == null || g.resetAfterIndex(0));
32
- },
33
- [
34
- e,
35
- s,
36
- d,
37
- t.dimension,
38
- t.scaleStepItems,
39
- t.stepWidth,
40
- f
41
- ]
42
- ), T = u(
43
- (n) => {
44
- h(n);
45
- },
46
- [h]
47
- );
48
- return _(() => {
49
- var n;
50
- (n = e == null ? void 0 : e.current) == null || n.resetAfterIndex(0);
51
- }, [e, t.dimension]), /* @__PURE__ */ o("div", { className: "gantt-scale-wrap", children: /* @__PURE__ */ o(
52
- v,
53
- {
54
- className: "gantt-scale-list",
55
- layout: "horizontal",
56
- width: W,
57
- height: m.HEADER_HEIGHT,
58
- itemCount: s.length,
59
- itemSize: Y,
60
- itemData: s,
61
- ref: e,
62
- outerRef: l,
63
- innerRef: N,
64
- initialScrollOffset: t.initialScrollOffset,
65
- onScroll: E,
66
- onItemsRendered: T,
67
- children: ({ style: n, index: i, data: r }) => /* @__PURE__ */ A("div", { className: "gantt-scale-item", style: n, children: [
68
- /* @__PURE__ */ o("div", { className: "gantt-scale-title", children: c.unix(r[i]).format(
69
- t.dimension === p.DAY ? "MMMM, YYYY" : "ddd, D MMMM, YY"
70
- ) }),
71
- /* @__PURE__ */ o("div", { className: "gantt-scale-steps", children: G(t.dimension, r[i]).map((a) => /* @__PURE__ */ o(
72
- "div",
73
- {
74
- className: "gantt-scale-step",
75
- style: { width: t.stepWidth },
76
- children: a
77
- },
78
- a
79
- )) })
80
- ] })
81
- }
82
- ) });
83
- });
90
+ ) });
91
+ }
92
+ );
84
93
  R.displayName = "Scale";
85
94
  export {
86
95
  R as default
@@ -5,66 +5,84 @@ import { VariableSizeList as E } from "../../../../../../node_modules/react-wind
5
5
  import { MinusSquareOutlined as y } from "../../../assets/icons/MinusSquareOutlined.js";
6
6
  import { PlusSquareOutlined as T } from "../../../assets/icons/PlusSquareOutlined.js";
7
7
  import { GanttConsts as i } from "../../../constants/GanttConsts.js";
8
- const b = g(({ height: c, data: s, setData: l, treeTitle: m = "Attività" }, p) => {
9
- const o = f(() => {
10
- const r = [];
11
- for (const e of s)
12
- e.hasOwnProperty("expanded") && !e.expanded && r.push(e.key);
13
- return s.filter((e) => !e.parentsKeys.some((n) => r.includes(n)));
14
- }, [s]), u = h(
15
- (r) => {
16
- const e = [...s], t = e.find((n) => n.key === r);
17
- t != null && t.hasOwnProperty("expanded") && (t.expanded = !t.expanded), l(e);
18
- },
19
- [s, l]
20
- );
21
- return /* @__PURE__ */ a(
22
- "div",
23
- {
24
- className: "gantt-tree-wrap bg-d-background",
25
- style: {
26
- width: i.TREE_WIDTH,
27
- marginTop: -i.HEADER_HEIGHT
8
+ const b = g(
9
+ ({ height: c, data: s, setData: l, treeTitle: m = "Attività" }, p) => {
10
+ const o = f(() => {
11
+ const r = [];
12
+ for (const e of s)
13
+ e.hasOwnProperty("expanded") && !e.expanded && r.push(e.key);
14
+ return s.filter((e) => !e.parentsKeys.some(
15
+ (n) => r.includes(n)
16
+ ));
17
+ }, [s]), u = h(
18
+ (r) => {
19
+ const e = [...s], t = e.find((n) => n.key === r);
20
+ t != null && t.hasOwnProperty("expanded") && (t.expanded = !t.expanded), l(e);
28
21
  },
29
- children: /* @__PURE__ */ a(
30
- E,
31
- {
32
- ref: p,
33
- className: "gantt-tree-list bg-d-background",
34
- layout: "vertical",
35
- width: "100%",
36
- height: c,
37
- itemCount: o.length,
38
- itemSize: () => i.ROW_HEIGHT,
39
- itemData: o,
40
- innerElementType: ({ children: r, props: e }) => /* @__PURE__ */ d("div", { style: { height: o.length * i.ROW_HEIGHT }, ...e, children: [
41
- /* @__PURE__ */ a("div", { className: "gantt-tree-title bg-d-background", style: { height: i.HEADER_HEIGHT }, children: m }),
42
- /* @__PURE__ */ a("div", { className: "gantt-tree-inner-wrap", children: r })
43
- ] }),
44
- children: ({ style: r, index: e, data: t }) => {
45
- const n = t[e];
46
- return /* @__PURE__ */ d(
47
- "button",
22
+ [s, l]
23
+ );
24
+ return /* @__PURE__ */ a(
25
+ "div",
26
+ {
27
+ className: "gantt-tree-wrap bg-d-background",
28
+ style: {
29
+ width: i.TREE_WIDTH,
30
+ marginTop: -i.HEADER_HEIGHT
31
+ },
32
+ children: /* @__PURE__ */ a(
33
+ E,
34
+ {
35
+ ref: p,
36
+ className: "gantt-tree-list bg-d-background",
37
+ layout: "vertical",
38
+ width: "100%",
39
+ height: c,
40
+ itemCount: o.length,
41
+ itemSize: () => i.ROW_HEIGHT,
42
+ itemData: o,
43
+ innerElementType: ({ children: r, props: e }) => /* @__PURE__ */ d(
44
+ "div",
48
45
  {
49
- className: "gantt-tree-list-item bg-d-background text-foreground",
50
- style: {
51
- ...r,
52
- backgroundColor: e % 2 === 0 ? "var(--d-background)" : "var(--d-secondary)",
53
- paddingLeft: i.LEAF_TITLE_PADDING_LEFT + n.level * i.LEAF_CHILDREN_PADDING_LEFT
54
- },
55
- onClick: () => u(n.key),
46
+ style: { height: o.length * i.ROW_HEIGHT },
47
+ ...e,
56
48
  children: [
57
- n.hasOwnProperty("expanded") ? n.expanded ? /* @__PURE__ */ a(y, { className: "gantt-tree-icon" }) : /* @__PURE__ */ a(T, { className: "gantt-tree-icon" }) : null,
58
- /* @__PURE__ */ a("div", { children: t[e].title })
49
+ /* @__PURE__ */ a(
50
+ "div",
51
+ {
52
+ className: "gantt-tree-title bg-d-background",
53
+ style: { height: i.HEADER_HEIGHT },
54
+ children: m
55
+ }
56
+ ),
57
+ /* @__PURE__ */ a("div", { className: "gantt-tree-inner-wrap", children: r })
59
58
  ]
60
59
  }
61
- );
60
+ ),
61
+ children: ({ style: r, index: e, data: t }) => {
62
+ const n = t[e];
63
+ return /* @__PURE__ */ d(
64
+ "button",
65
+ {
66
+ className: "gantt-tree-list-item bg-d-background text-foreground",
67
+ style: {
68
+ ...r,
69
+ backgroundColor: e % 2 === 0 ? "var(--d-background)" : "var(--d-secondary)",
70
+ paddingLeft: i.LEAF_TITLE_PADDING_LEFT + n.level * i.LEAF_CHILDREN_PADDING_LEFT
71
+ },
72
+ onClick: () => u(n.key),
73
+ children: [
74
+ n.hasOwnProperty("expanded") ? n.expanded ? /* @__PURE__ */ a(y, { className: "gantt-tree-icon" }) : /* @__PURE__ */ a(T, { className: "gantt-tree-icon" }) : null,
75
+ /* @__PURE__ */ a("div", { children: t[e].title })
76
+ ]
77
+ }
78
+ );
79
+ }
62
80
  }
63
- }
64
- )
65
- }
66
- );
67
- });
81
+ )
82
+ }
83
+ );
84
+ }
85
+ );
68
86
  b.displayName = "Tree";
69
87
  export {
70
88
  b as default