laif-ds 0.1.8 → 0.1.9
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/components/ui/breadcrumb.js +105 -0
- package/dist/components/ui/button.js +28 -17
- package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +0 -1
- package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +6 -7
- package/dist/components/ui/gantt/components/Chart/Chart.js +25 -26
- package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +0 -1
- package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +13 -14
- package/dist/components/ui/gantt/components/Controls/Controls.js +36 -35
- package/dist/components/ui/gantt/components/Gantt/Gantt.js +55 -44
- package/dist/components/ui/gantt/components/Gantt/GanttContext.js +4 -3
- package/dist/components/ui/input.js +2 -2
- package/dist/index.d.ts +46 -2
- package/dist/index.js +249 -237
- package/dist/styles.css +1 -2
- package/dist/styles.v3.css +1 -0
- package/package.json +14 -8
- package/dist/laif-ds.css +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { j as a } from "../../_virtual/jsx-runtime.js";
|
|
3
|
+
import { Root as o } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
4
|
+
import { cn as t } from "../../lib/utils.js";
|
|
5
|
+
import i from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
|
|
6
|
+
import l from "../../node_modules/lucide-react/dist/esm/icons/ellipsis.js";
|
|
7
|
+
function p({ ...r }) {
|
|
8
|
+
return /* @__PURE__ */ a.jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...r });
|
|
9
|
+
}
|
|
10
|
+
function f({ className: r, ...e }) {
|
|
11
|
+
return /* @__PURE__ */ a.jsx(
|
|
12
|
+
"ol",
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "breadcrumb-list",
|
|
15
|
+
className: t(
|
|
16
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
17
|
+
r
|
|
18
|
+
),
|
|
19
|
+
...e
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function x({ className: r, ...e }) {
|
|
24
|
+
return /* @__PURE__ */ a.jsx(
|
|
25
|
+
"li",
|
|
26
|
+
{
|
|
27
|
+
"data-slot": "breadcrumb-item",
|
|
28
|
+
className: t("inline-flex items-center gap-1.5", r),
|
|
29
|
+
...e
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function j({
|
|
34
|
+
asChild: r,
|
|
35
|
+
className: e,
|
|
36
|
+
...s
|
|
37
|
+
}) {
|
|
38
|
+
const n = r ? o : "a";
|
|
39
|
+
return /* @__PURE__ */ a.jsx(
|
|
40
|
+
n,
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "breadcrumb-link",
|
|
43
|
+
className: t("hover:text-foreground transition-colors", e),
|
|
44
|
+
...s
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function g({ className: r, ...e }) {
|
|
49
|
+
return /* @__PURE__ */ a.jsx(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
"data-slot": "breadcrumb-page",
|
|
53
|
+
role: "link",
|
|
54
|
+
"aria-disabled": "true",
|
|
55
|
+
"aria-current": "page",
|
|
56
|
+
className: t("text-foreground font-normal", r),
|
|
57
|
+
...e
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function h({
|
|
62
|
+
children: r,
|
|
63
|
+
className: e,
|
|
64
|
+
...s
|
|
65
|
+
}) {
|
|
66
|
+
return /* @__PURE__ */ a.jsx(
|
|
67
|
+
"li",
|
|
68
|
+
{
|
|
69
|
+
"data-slot": "breadcrumb-separator",
|
|
70
|
+
role: "presentation",
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
className: t("[&>svg]:size-3.5", e),
|
|
73
|
+
...s,
|
|
74
|
+
children: r ?? /* @__PURE__ */ a.jsx(i, {})
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function N({
|
|
79
|
+
className: r,
|
|
80
|
+
...e
|
|
81
|
+
}) {
|
|
82
|
+
return /* @__PURE__ */ a.jsxs(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
86
|
+
role: "presentation",
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
className: t("flex size-9 items-center justify-center", r),
|
|
89
|
+
...e,
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ a.jsx(l, { className: "size-4" }),
|
|
92
|
+
/* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "More" })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
p as Breadcrumb,
|
|
99
|
+
N as BreadcrumbEllipsis,
|
|
100
|
+
x as BreadcrumbItem,
|
|
101
|
+
j as BreadcrumbLink,
|
|
102
|
+
f as BreadcrumbList,
|
|
103
|
+
g as BreadcrumbPage,
|
|
104
|
+
h as BreadcrumbSeparator
|
|
105
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as r } from "../../_virtual/jsx-runtime.js";
|
|
3
|
-
import { Root as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { cn as
|
|
3
|
+
import { Root as l } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
4
|
+
import { cva as g } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
+
import { cn as i } from "../../lib/utils.js";
|
|
6
6
|
import { Icon as c } from "./icon.js";
|
|
7
|
-
const v =
|
|
7
|
+
const v = g(
|
|
8
8
|
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
@@ -30,32 +30,43 @@ const v = l(
|
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
32
|
function h({
|
|
33
|
-
className:
|
|
34
|
-
variant:
|
|
33
|
+
className: s,
|
|
34
|
+
variant: o,
|
|
35
35
|
size: e,
|
|
36
|
-
asChild:
|
|
37
|
-
iconLeft:
|
|
38
|
-
iconRight:
|
|
36
|
+
asChild: n = !1,
|
|
37
|
+
iconLeft: a,
|
|
38
|
+
iconRight: d,
|
|
39
39
|
...t
|
|
40
40
|
}) {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
|
|
41
|
+
const u = n ? l : "button";
|
|
42
|
+
return n ? /* @__PURE__ */ r.jsx(
|
|
43
|
+
u,
|
|
44
44
|
{
|
|
45
45
|
"data-slot": "button",
|
|
46
|
-
className:
|
|
46
|
+
className: i(v({ variant: o, size: e, className: s })),
|
|
47
47
|
...t
|
|
48
48
|
}
|
|
49
49
|
) : /* @__PURE__ */ r.jsxs(
|
|
50
|
-
|
|
50
|
+
u,
|
|
51
51
|
{
|
|
52
52
|
"data-slot": "button",
|
|
53
|
-
className:
|
|
53
|
+
className: i(v({ variant: o, size: e, className: s }), "relative"),
|
|
54
54
|
...t,
|
|
55
55
|
children: [
|
|
56
|
-
|
|
56
|
+
/* @__PURE__ */ r.jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: i(
|
|
60
|
+
"absolute inset-0",
|
|
61
|
+
// "bg-linear-to-r from-primary/50 via-primary/50 to-primary",
|
|
62
|
+
"opacity-40 group-hover:opacity-80",
|
|
63
|
+
"blur-[2.5px] transition-opacity duration-500"
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
a && /* @__PURE__ */ r.jsx(c, { name: a, size: e === "default" ? "md" : e === "sm" ? "xs" : "sm" }),
|
|
57
68
|
t.children,
|
|
58
|
-
|
|
69
|
+
d && /* @__PURE__ */ r.jsx(c, { name: d, size: e === "default" ? "md" : e === "sm" ? "xs" : "sm" })
|
|
59
70
|
]
|
|
60
71
|
}
|
|
61
72
|
);
|
|
@@ -6,7 +6,6 @@ import { createSnapModifier as N, restrictToHorizontalAxis as K } from "../../..
|
|
|
6
6
|
import p from "../../../../../../_virtual/dayjs.min.js";
|
|
7
7
|
import { VariableSizeList as O } from "../../../../../../node_modules/react-window/dist/index.esm.js";
|
|
8
8
|
import { GanttContext as B } from "../../Gantt/GanttContext.js";
|
|
9
|
-
/* empty css */
|
|
10
9
|
import { getWholeWidth as V } from "../../../utils/getWholeWidth.js";
|
|
11
10
|
import q from "./BarsRow/BarsRow.js";
|
|
12
11
|
import { GanttConsts as J } from "../../../constants/GanttConsts.js";
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as e } from "../../../../../../../_virtual/jsx-runtime.js";
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { BarsRowContext as
|
|
3
|
+
import { useContext as a, useMemo as m } from "react";
|
|
4
|
+
import { BarsRowContext as p } from "./BarsRowContext.js";
|
|
5
5
|
import { GanttContext as d } from "../../../Gantt/GanttContext.js";
|
|
6
|
-
/* empty css */
|
|
7
6
|
import l from "./BarsItems/BarItems.js";
|
|
8
|
-
const
|
|
9
|
-
const { settings: s } =
|
|
7
|
+
const v = ({ barData: t, index: r, style: o, onBarDoubleClick: n }) => {
|
|
8
|
+
const { settings: s } = a(d), i = m(() => ({
|
|
10
9
|
...o,
|
|
11
10
|
backgroundImage: `repeating-linear-gradient(to right, var(--border) 0px 1px, ${r % 2 === 0 ? "var(--background)" : "var(--muted)"} 1px ${s.stepWidth}px`
|
|
12
11
|
}), [r, s.stepWidth, o]);
|
|
13
|
-
return /* @__PURE__ */ e.jsx(
|
|
12
|
+
return /* @__PURE__ */ e.jsx(p.Provider, { value: { barData: t }, children: /* @__PURE__ */ e.jsx("div", { className: "gantt-bars-row-wrap", style: i, children: /* @__PURE__ */ e.jsx(
|
|
14
13
|
l,
|
|
15
14
|
{
|
|
16
15
|
data: t.data,
|
|
@@ -22,5 +21,5 @@ const h = ({ barData: t, index: r, style: o, onBarDoubleClick: n }) => {
|
|
|
22
21
|
) }) });
|
|
23
22
|
};
|
|
24
23
|
export {
|
|
25
|
-
|
|
24
|
+
v as default
|
|
26
25
|
};
|
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as s } from "../../../../../_virtual/jsx-runtime.js";
|
|
3
|
-
import { useContext as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { GanttContext as
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import { GanttDimensionsSettings as P } from "../../constants/DimensionsSettings.js";
|
|
3
|
+
import { useContext as _, useRef as a, useState as o, useCallback as M, useMemo as N, useEffect as u } from "react";
|
|
4
|
+
import k from "../../../../../_virtual/index5.js";
|
|
5
|
+
import y from "../../../../../_virtual/debounce.js";
|
|
6
|
+
import { GanttContext as A } from "../Gantt/GanttContext.js";
|
|
7
|
+
import { transformData as B } from "../../utils/transformData.js";
|
|
8
|
+
import F from "./Scale/Scale.js";
|
|
9
|
+
import O from "./Tree/Tree.js";
|
|
10
|
+
import P from "./Bars/Bars.js";
|
|
11
|
+
import { GanttConsts as m } from "../../constants/GanttConsts.js";
|
|
12
|
+
import { GanttDimensionsSettings as q } from "../../constants/DimensionsSettings.js";
|
|
14
13
|
const w = ({ data: f, className: H, onBarDoubleClick: S, onBarChange: W }) => {
|
|
15
|
-
const { settings: n, scaleDates: c, wrapRef: t, setCurrentDate: d } =
|
|
14
|
+
const { settings: n, scaleDates: c, wrapRef: t, setCurrentDate: d, treeTitle: I } = _(A), h = a(null), T = a(null), g = a(null), [D, i] = o([]), [l, b] = o(!0), [p, G] = o(0), [x, L] = o(0), E = M(() => {
|
|
16
15
|
var r;
|
|
17
16
|
const e = Math.round(
|
|
18
|
-
((((r = t == null ? void 0 : t.current) == null ? void 0 : r.scrollLeft) || 0) +
|
|
17
|
+
((((r = t == null ? void 0 : t.current) == null ? void 0 : r.scrollLeft) || 0) + m.TREE_WIDTH) * q[n.dimension].secondsInPixel
|
|
19
18
|
);
|
|
20
19
|
d(c[0] + e);
|
|
21
|
-
}, [c, d, n.dimension, t]),
|
|
22
|
-
return
|
|
20
|
+
}, [c, d, n.dimension, t]), R = N(() => y(E, 100), [E]);
|
|
21
|
+
return u(() => {
|
|
23
22
|
var e, r;
|
|
24
|
-
(e = t == null ? void 0 : t.current) != null && e.clientWidth && ((r = t == null ? void 0 : t.current) != null && r.clientHeight) && (
|
|
25
|
-
}, []),
|
|
23
|
+
(e = t == null ? void 0 : t.current) != null && e.clientWidth && ((r = t == null ? void 0 : t.current) != null && r.clientHeight) && (G(t.current.clientWidth - m.TREE_WIDTH), L(t.current.clientHeight - m.HEADER_HEIGHT), b(!1));
|
|
24
|
+
}, []), u(() => {
|
|
26
25
|
!l && t.current && (t.current.scrollLeft = n.initialScrollOffset);
|
|
27
|
-
}, [l]),
|
|
28
|
-
i(
|
|
26
|
+
}, [l]), u(() => {
|
|
27
|
+
i(B(f));
|
|
29
28
|
}, [f]), /* @__PURE__ */ s.jsx(
|
|
30
29
|
"div",
|
|
31
30
|
{
|
|
32
|
-
className:
|
|
31
|
+
className: k("gantt-chart-wrap", H),
|
|
33
32
|
ref: t,
|
|
34
33
|
onScroll: (e) => {
|
|
35
34
|
var r, j, C;
|
|
36
|
-
(r = g.current) == null || r.scrollTo(e.currentTarget.scrollTop), (j = T.current) == null || j.scrollTo(e.currentTarget.scrollTop), (C = h.current) == null || C.scrollTo(e.currentTarget.scrollLeft),
|
|
35
|
+
(r = g.current) == null || r.scrollTo(e.currentTarget.scrollTop), (j = T.current) == null || j.scrollTo(e.currentTarget.scrollTop), (C = h.current) == null || C.scrollTo(e.currentTarget.scrollLeft), R();
|
|
37
36
|
},
|
|
38
37
|
children: l ? /* @__PURE__ */ s.jsx(
|
|
39
38
|
"div",
|
|
@@ -43,15 +42,15 @@ const w = ({ data: f, className: H, onBarDoubleClick: S, onBarChange: W }) => {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
) : /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
46
|
-
/* @__PURE__ */ s.jsx(
|
|
47
|
-
/* @__PURE__ */ s.jsx(
|
|
45
|
+
/* @__PURE__ */ s.jsx(F, { width: p, wrapRef: t, ref: h }),
|
|
46
|
+
/* @__PURE__ */ s.jsx(O, { height: x, data: D, setData: i, ref: T, treeTitle: I }),
|
|
48
47
|
/* @__PURE__ */ s.jsx(
|
|
49
|
-
|
|
48
|
+
P,
|
|
50
49
|
{
|
|
51
50
|
ref: g,
|
|
52
|
-
data:
|
|
51
|
+
data: D,
|
|
53
52
|
setData: i,
|
|
54
|
-
width:
|
|
53
|
+
width: p,
|
|
55
54
|
height: x,
|
|
56
55
|
onBarDoubleClick: S,
|
|
57
56
|
onBarChange: W
|
|
@@ -4,7 +4,6 @@ import { forwardRef as T, useContext as A, useRef as M, useCallback as u, useEff
|
|
|
4
4
|
import c from "../../../../../../_virtual/dayjs.min.js";
|
|
5
5
|
import { VariableSizeList as O } from "../../../../../../node_modules/react-window/dist/index.esm.js";
|
|
6
6
|
import { GanttContext as R } from "../../Gantt/GanttContext.js";
|
|
7
|
-
/* empty css */
|
|
8
7
|
import { useForwardRef as _ } from "../../../hooks/useForwardRef.js";
|
|
9
8
|
import { getScaleItems as v } from "../../../utils/getScaleItems.js";
|
|
10
9
|
import { GanttDimensions as p } from "../../../enums/GanttDimensions.js";
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as r } from "../../../../../../_virtual/jsx-runtime.js";
|
|
3
|
-
import { forwardRef as p, useMemo as
|
|
3
|
+
import { forwardRef as p, useMemo as g, useCallback as f } from "react";
|
|
4
4
|
import { VariableSizeList as h } from "../../../../../../node_modules/react-window/dist/index.esm.js";
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { PlusSquareOutlined as x } from "../../../assets/icons/PlusSquareOutlined.js";
|
|
5
|
+
import { MinusSquareOutlined as x } from "../../../assets/icons/MinusSquareOutlined.js";
|
|
6
|
+
import { PlusSquareOutlined as E } from "../../../assets/icons/PlusSquareOutlined.js";
|
|
8
7
|
import { GanttConsts as a } from "../../../constants/GanttConsts.js";
|
|
9
|
-
const
|
|
10
|
-
const o =
|
|
8
|
+
const y = p(({ height: d, data: i, setData: l, treeTitle: c = "Attività" }, m) => {
|
|
9
|
+
const o = g(() => {
|
|
11
10
|
const n = [];
|
|
12
11
|
for (const e of i)
|
|
13
12
|
e.hasOwnProperty("expanded") && !e.expanded && n.push(e.key);
|
|
14
13
|
return i.filter((e) => !e.parentsKeys.some((s) => n.includes(s)));
|
|
15
|
-
}, [i]),
|
|
14
|
+
}, [i]), u = f(
|
|
16
15
|
(n) => {
|
|
17
16
|
const e = [...i], t = e.find((s) => s.key === n);
|
|
18
17
|
t != null && t.hasOwnProperty("expanded") && (t.expanded = !t.expanded), l(e);
|
|
@@ -22,7 +21,7 @@ const E = p(({ height: d, data: i, setData: l }, c) => {
|
|
|
22
21
|
return /* @__PURE__ */ r.jsx(
|
|
23
22
|
"div",
|
|
24
23
|
{
|
|
25
|
-
className: "gantt-tree-wrap bg-background
|
|
24
|
+
className: "gantt-tree-wrap bg-background",
|
|
26
25
|
style: {
|
|
27
26
|
width: a.TREE_WIDTH,
|
|
28
27
|
marginTop: -a.HEADER_HEIGHT
|
|
@@ -30,7 +29,7 @@ const E = p(({ height: d, data: i, setData: l }, c) => {
|
|
|
30
29
|
children: /* @__PURE__ */ r.jsx(
|
|
31
30
|
h,
|
|
32
31
|
{
|
|
33
|
-
ref:
|
|
32
|
+
ref: m,
|
|
34
33
|
className: "gantt-tree-list bg-background",
|
|
35
34
|
layout: "vertical",
|
|
36
35
|
width: "100%",
|
|
@@ -39,7 +38,7 @@ const E = p(({ height: d, data: i, setData: l }, c) => {
|
|
|
39
38
|
itemSize: () => a.ROW_HEIGHT,
|
|
40
39
|
itemData: o,
|
|
41
40
|
innerElementType: ({ children: n, props: e }) => /* @__PURE__ */ r.jsxs("div", { style: { height: o.length * a.ROW_HEIGHT }, ...e, children: [
|
|
42
|
-
/* @__PURE__ */ r.jsx("div", { className: "gantt-tree-title bg-background", style: { height: a.HEADER_HEIGHT }, children:
|
|
41
|
+
/* @__PURE__ */ r.jsx("div", { className: "gantt-tree-title bg-background", style: { height: a.HEADER_HEIGHT }, children: c }),
|
|
43
42
|
/* @__PURE__ */ r.jsx("div", { className: "gantt-tree-inner-wrap", children: n })
|
|
44
43
|
] }),
|
|
45
44
|
children: ({ style: n, index: e, data: t }) => {
|
|
@@ -53,9 +52,9 @@ const E = p(({ height: d, data: i, setData: l }, c) => {
|
|
|
53
52
|
backgroundColor: e % 2 === 0 ? "var(--background)" : "var(--muted)",
|
|
54
53
|
paddingLeft: a.LEAF_TITLE_PADDING_LEFT + s.level * a.LEAF_CHILDREN_PADDING_LEFT
|
|
55
54
|
},
|
|
56
|
-
onClick: () =>
|
|
55
|
+
onClick: () => u(s.key),
|
|
57
56
|
children: [
|
|
58
|
-
s.hasOwnProperty("expanded") ? s.expanded ? /* @__PURE__ */ r.jsx(
|
|
57
|
+
s.hasOwnProperty("expanded") ? s.expanded ? /* @__PURE__ */ r.jsx(x, { className: "gantt-tree-icon" }) : /* @__PURE__ */ r.jsx(E, { className: "gantt-tree-icon" }) : null,
|
|
59
58
|
/* @__PURE__ */ r.jsx("div", { children: t[e].title })
|
|
60
59
|
]
|
|
61
60
|
}
|
|
@@ -66,7 +65,7 @@ const E = p(({ height: d, data: i, setData: l }, c) => {
|
|
|
66
65
|
}
|
|
67
66
|
);
|
|
68
67
|
});
|
|
69
|
-
|
|
68
|
+
y.displayName = "Tree";
|
|
70
69
|
export {
|
|
71
|
-
|
|
70
|
+
y as default
|
|
72
71
|
};
|
|
@@ -1,64 +1,65 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as n } from "../../../../../_virtual/jsx-runtime.js";
|
|
3
|
-
import { useContext as V, useState as x, useMemo as p, useCallback as
|
|
4
|
-
import
|
|
5
|
-
import { cn as
|
|
3
|
+
import { useContext as V, useState as x, useMemo as p, useCallback as r } from "react";
|
|
4
|
+
import y from "../../../../../_virtual/dayjs.min.js";
|
|
5
|
+
import { cn as G } from "../../../../../lib/utils.js";
|
|
6
6
|
import { Button as h } from "../../../button.js";
|
|
7
7
|
import { Select as j, SelectTrigger as f, SelectValue as g, SelectContent as S, SelectItem as v } from "../../../select.js";
|
|
8
|
-
import { GanttContext as
|
|
9
|
-
import { useGanttCalculate as
|
|
8
|
+
import { GanttContext as P } from "../Gantt/GanttContext.js";
|
|
9
|
+
import { useGanttCalculate as R } from "../../hooks/useGanttCalculate.js";
|
|
10
10
|
import B from "../../../../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
|
|
11
11
|
import E from "../../../../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
|
|
12
|
-
import {
|
|
13
|
-
import { GanttDimensionsSettings as l } from "../../constants/DimensionsSettings.js";
|
|
12
|
+
import { GanttDimensionsSettings as o } from "../../constants/DimensionsSettings.js";
|
|
14
13
|
import { DragStepOptions as d } from "../../constants/DragStepOptions.js";
|
|
15
|
-
const
|
|
16
|
-
const { calculate: i } =
|
|
17
|
-
|
|
14
|
+
const X = ({ className: b }) => {
|
|
15
|
+
const { calculate: i } = R(), { settings: a, setSettings: u, currentDate: C } = V(P), [D, c] = x(a.dimension), [s, m] = x(
|
|
16
|
+
Object.keys(o).findIndex((e) => e === a.dimension)
|
|
17
|
+
), l = p(() => Object.keys(o).map((e, t) => ({
|
|
18
|
+
label: o[e].label,
|
|
18
19
|
value: e,
|
|
19
|
-
index:
|
|
20
|
-
})), []), z =
|
|
20
|
+
index: t
|
|
21
|
+
})), []), z = r(
|
|
21
22
|
(e) => {
|
|
22
|
-
const
|
|
23
|
-
c(e), m(
|
|
23
|
+
const t = l.findIndex((w) => w.value === e);
|
|
24
|
+
c(e), m(t), i(e);
|
|
24
25
|
},
|
|
25
|
-
[i,
|
|
26
|
-
), N =
|
|
27
|
-
if (
|
|
28
|
-
const e = Object.keys(
|
|
29
|
-
c(e), m(
|
|
26
|
+
[i, l]
|
|
27
|
+
), N = r(() => {
|
|
28
|
+
if (s < l.length - 1) {
|
|
29
|
+
const e = Object.keys(o)[s + 1];
|
|
30
|
+
c(e), m(s + 1), i(e);
|
|
30
31
|
}
|
|
31
|
-
}, [i,
|
|
32
|
-
if (
|
|
33
|
-
const e = Object.keys(
|
|
34
|
-
c(e), m(
|
|
32
|
+
}, [i, l.length, s]), O = r(() => {
|
|
33
|
+
if (s > 0) {
|
|
34
|
+
const e = Object.keys(o)[s - 1];
|
|
35
|
+
c(e), m(s - 1), i(e);
|
|
35
36
|
}
|
|
36
|
-
}, [i,
|
|
37
|
+
}, [i, s]), k = p(() => Object.keys(d).map((e) => ({
|
|
37
38
|
label: d[e].label,
|
|
38
39
|
value: e
|
|
39
|
-
})), []),
|
|
40
|
+
})), []), I = r(
|
|
40
41
|
(e) => {
|
|
41
42
|
u(() => {
|
|
42
|
-
const
|
|
43
|
-
return
|
|
43
|
+
const t = { ...a };
|
|
44
|
+
return t.dragStepSize = e, t.gridSize = d[e].seconds / o[t.dimension].secondsInPixel, t;
|
|
44
45
|
});
|
|
45
46
|
},
|
|
46
|
-
[u,
|
|
47
|
+
[u, a]
|
|
47
48
|
);
|
|
48
|
-
return /* @__PURE__ */ n.jsxs("div", { className:
|
|
49
|
+
return /* @__PURE__ */ n.jsxs("div", { className: G("flex items-center gap-2 p-4 border-b", b), children: [
|
|
49
50
|
/* @__PURE__ */ n.jsx(
|
|
50
51
|
h,
|
|
51
52
|
{
|
|
52
53
|
variant: "outline",
|
|
53
54
|
size: "icon",
|
|
54
55
|
onClick: O,
|
|
55
|
-
disabled:
|
|
56
|
+
disabled: s <= 0,
|
|
56
57
|
children: /* @__PURE__ */ n.jsx(B, { className: "h-4 w-4" })
|
|
57
58
|
}
|
|
58
59
|
),
|
|
59
60
|
/* @__PURE__ */ n.jsxs(j, { value: D, onValueChange: z, children: [
|
|
60
61
|
/* @__PURE__ */ n.jsx(f, { className: "w-[180px]", children: /* @__PURE__ */ n.jsx(g, { placeholder: "Seleziona dimensione" }) }),
|
|
61
|
-
/* @__PURE__ */ n.jsx(S, { className: "z-100", children:
|
|
62
|
+
/* @__PURE__ */ n.jsx(S, { className: "z-100", children: l.map((e) => /* @__PURE__ */ n.jsx(v, { value: e.value, children: e.label }, e.value)) })
|
|
62
63
|
] }),
|
|
63
64
|
/* @__PURE__ */ n.jsx(
|
|
64
65
|
h,
|
|
@@ -66,17 +67,17 @@ const Z = ({ className: b }) => {
|
|
|
66
67
|
variant: "outline",
|
|
67
68
|
size: "icon",
|
|
68
69
|
onClick: N,
|
|
69
|
-
disabled:
|
|
70
|
+
disabled: s >= l.length - 1,
|
|
70
71
|
children: /* @__PURE__ */ n.jsx(E, { className: "h-4 w-4" })
|
|
71
72
|
}
|
|
72
73
|
),
|
|
73
|
-
/* @__PURE__ */ n.jsx("div", { className: "px-4 text-sm font-medium", children:
|
|
74
|
-
/* @__PURE__ */ n.jsxs(j, { value:
|
|
74
|
+
/* @__PURE__ */ n.jsx("div", { className: "px-4 text-sm font-medium", children: y.unix(C).format("ddd, ll") }),
|
|
75
|
+
/* @__PURE__ */ n.jsxs(j, { value: a.dragStepSize, onValueChange: I, children: [
|
|
75
76
|
/* @__PURE__ */ n.jsx(f, { className: "w-[180px]", children: /* @__PURE__ */ n.jsx(g, { placeholder: "Seleziona step" }) }),
|
|
76
77
|
/* @__PURE__ */ n.jsx(S, { children: k.map((e) => /* @__PURE__ */ n.jsx(v, { value: e.value, children: e.label }, e.value)) })
|
|
77
78
|
] })
|
|
78
79
|
] });
|
|
79
80
|
};
|
|
80
81
|
export {
|
|
81
|
-
|
|
82
|
+
X as default
|
|
82
83
|
};
|
|
@@ -1,58 +1,69 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { j as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { GanttContext as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
import { j as i } from "../../../../../_virtual/jsx-runtime.js";
|
|
3
|
+
import { useMemo as a, useRef as T, useState as e } from "react";
|
|
4
|
+
import p from "../../../../../_virtual/dayjs.min.js";
|
|
5
|
+
import z from "../../../../../_virtual/localizedFormat.js";
|
|
6
|
+
import { GanttContext as H } from "./GanttContext.js";
|
|
7
|
+
import M from "../Chart/Chart.js";
|
|
8
|
+
import N from "../Controls/Controls.js";
|
|
9
|
+
import { GanttDimensions as c } from "../../enums/GanttDimensions.js";
|
|
10
|
+
import { GanttUnitOfTimes as m } from "../../enums/GanttUnitOfTimes.js";
|
|
11
|
+
import { getScaleDates as P } from "../../utils/getScaleDates.js";
|
|
12
|
+
import { getInitialScrollOffset as Y } from "../../utils/getInitialScrollOffset.js";
|
|
13
|
+
import { DragStepSizes as A } from "../../enums/DragStepSizes.js";
|
|
14
|
+
import { GanttConsts as U } from "../../constants/GanttConsts.js";
|
|
15
|
+
import { GanttDimensionsSettings as s } from "../../constants/DimensionsSettings.js";
|
|
16
|
+
import { DragStepOptions as _ } from "../../constants/DragStepOptions.js";
|
|
17
|
+
p.extend(z);
|
|
18
|
+
const l = ({
|
|
19
|
+
children: S,
|
|
20
|
+
draggable: d = !1,
|
|
21
|
+
defaultDimension: t = c.HOUR,
|
|
22
|
+
defaultDragStepSize: n = A.THIRTY_MIN,
|
|
23
|
+
treeTitle: f
|
|
24
|
+
}) => {
|
|
25
|
+
const r = a(() => {
|
|
26
|
+
const o = t === c.DAY ? m.MONTH : m.DAY;
|
|
27
|
+
return P(void 0, void 0, o);
|
|
28
|
+
}, [t]), x = a(() => Y(t, r), [t, r]), I = T(null), [g, u] = e(p().unix()), [v, O] = e(r), [R, C] = e({
|
|
29
|
+
stepWidth: s[t].stepWidth,
|
|
30
|
+
secondsInPixel: s[t].secondsInPixel,
|
|
31
|
+
scaleStepItems: U.HOURS_IN_DAY,
|
|
32
|
+
initialScrollOffset: x,
|
|
33
|
+
dimension: t,
|
|
34
|
+
draggable: d,
|
|
35
|
+
dragStepSize: n,
|
|
36
|
+
gridSize: (() => {
|
|
37
|
+
const o = _[n].seconds, j = s[t].secondsInPixel, D = o / j;
|
|
38
|
+
return Math.max(D, 1);
|
|
39
|
+
})()
|
|
40
|
+
}), [G, h] = e({
|
|
31
41
|
overscanStartIndex: 0,
|
|
32
42
|
overscanStopIndex: 0,
|
|
33
43
|
visibleStartIndex: 0,
|
|
34
44
|
visibleStopIndex: 0
|
|
35
45
|
});
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
|
|
46
|
+
return /* @__PURE__ */ i.jsx(
|
|
47
|
+
H.Provider,
|
|
38
48
|
{
|
|
39
49
|
value: {
|
|
40
|
-
wrapRef:
|
|
41
|
-
scaleDates:
|
|
42
|
-
setScaleDates:
|
|
43
|
-
settings:
|
|
44
|
-
setSettings:
|
|
45
|
-
scaleRenderState:
|
|
46
|
-
setScaleRenderState:
|
|
47
|
-
currentDate:
|
|
48
|
-
setCurrentDate:
|
|
50
|
+
wrapRef: I,
|
|
51
|
+
scaleDates: v,
|
|
52
|
+
setScaleDates: O,
|
|
53
|
+
settings: R,
|
|
54
|
+
setSettings: C,
|
|
55
|
+
scaleRenderState: G,
|
|
56
|
+
setScaleRenderState: h,
|
|
57
|
+
currentDate: g,
|
|
58
|
+
setCurrentDate: u,
|
|
59
|
+
treeTitle: f
|
|
49
60
|
},
|
|
50
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ i.jsx("div", { className: "gantt-wrap", children: S })
|
|
51
62
|
}
|
|
52
63
|
);
|
|
53
64
|
};
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
l.Chart = M;
|
|
66
|
+
l.Controls = N;
|
|
56
67
|
export {
|
|
57
|
-
|
|
68
|
+
l as default
|
|
58
69
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createContext as e } from "react";
|
|
3
3
|
import { DragStepSizes as t } from "../../enums/DragStepSizes.js";
|
|
4
4
|
import { GanttDimensions as s } from "../../enums/GanttDimensions.js";
|
|
5
|
-
const
|
|
5
|
+
const a = e({
|
|
6
6
|
wrapRef: { current: null },
|
|
7
7
|
scaleDates: [],
|
|
8
8
|
setScaleDates: () => {
|
|
@@ -28,8 +28,9 @@ const i = e({
|
|
|
28
28
|
setScaleRenderState: () => {
|
|
29
29
|
},
|
|
30
30
|
currentDate: 0,
|
|
31
|
-
setCurrentDate: () => 0
|
|
31
|
+
setCurrentDate: () => 0,
|
|
32
|
+
treeTitle: "Attività"
|
|
32
33
|
});
|
|
33
34
|
export {
|
|
34
|
-
|
|
35
|
+
a as GanttContext
|
|
35
36
|
};
|