@nice2dev/ui 1.4.19 → 1.4.21
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/CHANGELOG.md +57 -0
- package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
- package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
- package/dist/NiceWindow-DQyf5wat.cjs +1 -0
- package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-DirbU7jp.cjs} +1 -1
- package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
- package/dist/display/NiceLeaderboard.mjs +47 -40
- package/dist/display/NiceQuestCard.mjs +93 -76
- package/dist/docs/NiceGantt.doc.json.mjs +9 -9
- package/dist/documentation/utils.mjs +1 -1
- package/dist/index.cjs +94 -94
- package/dist/index.d.ts +58 -2
- package/dist/index.mjs +778 -776
- package/dist/navigation/NiceMenu.mjs +249 -248
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/overlays/NiceResponsiveBox.mjs +51 -24
- package/dist/overlays/NiceTutorial.mjs +136 -127
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +25 -2
- package/dist/planning/NiceGantt.mjs +130 -121
- package/dist/planning/NiceStepper.mjs +36 -35
- package/dist/style.css +2 -2
- package/dist/tools/NiceDraggable.mjs +44 -29
- package/dist/tools/NiceSortable.mjs +66 -48
- package/dist/tools/NiceSpeechToText.mjs +67 -52
- package/dist/tools/NiceValidationBuilder.mjs +210 -119
- package/dist/tools/NiceViewRegistry.mjs +67 -34
- package/package.json +4 -4
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
- package/dist/NiceGantt-BygumlaY.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
- package/dist/NiceWindow-BklnkBpu.cjs +0 -1
- package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceTranslation as J, useNiceAccessMode as
|
|
3
|
-
import { useState as K, useRef as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
},
|
|
8
|
-
tasks:
|
|
9
|
-
columns:
|
|
10
|
-
scale:
|
|
11
|
-
rowHeight:
|
|
12
|
-
dayWidth:
|
|
13
|
-
onTaskClick:
|
|
14
|
-
onTaskUpdate:
|
|
1
|
+
import { jsxs as m, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as J, useNiceAccessMode as le, clickOnActivationKey as he } from "@nice2dev/ui-core";
|
|
3
|
+
import { useState as K, useRef as W, useEffect as P, useMemo as T, useCallback as A } from "react";
|
|
4
|
+
const ue = [], p = (_, w) => {
|
|
5
|
+
const D = new Date(_);
|
|
6
|
+
return D.setDate(D.getDate() + w), D;
|
|
7
|
+
}, y = (_, w) => Math.ceil((w.getTime() - _.getTime()) / 864e5), me = ({
|
|
8
|
+
tasks: _ = ue,
|
|
9
|
+
columns: w,
|
|
10
|
+
scale: D = "day",
|
|
11
|
+
rowHeight: f = 36,
|
|
12
|
+
dayWidth: Y = 30,
|
|
13
|
+
onTaskClick: M,
|
|
14
|
+
onTaskUpdate: b,
|
|
15
15
|
showDependencies: G = !0,
|
|
16
16
|
dependencyStyle: V = "square",
|
|
17
|
-
draggable:
|
|
17
|
+
draggable: N,
|
|
18
18
|
zoomControls: Z,
|
|
19
19
|
className: H,
|
|
20
20
|
style: k,
|
|
@@ -22,64 +22,64 @@ const fe = [], b = (m, N) => {
|
|
|
22
22
|
id: ee,
|
|
23
23
|
"data-testid": te
|
|
24
24
|
}) => {
|
|
25
|
-
const { t: ne } = J(), ae =
|
|
25
|
+
const { t: ne } = J(), ae = le(U, ee) === "hidden", { t: fe } = J(), [d, z] = K(Y), [v, R] = K(null), E = w || [
|
|
26
26
|
{ field: "title", title: ne("gantt.task", "Task"), width: 200 }
|
|
27
|
-
],
|
|
27
|
+
], j = E.reduce((e, t) => e + (t.width || 120), 0), B = W(null), I = W(null), x = W(!1);
|
|
28
28
|
P(() => {
|
|
29
|
-
const e =
|
|
29
|
+
const e = B.current, t = I.current;
|
|
30
30
|
if (!e || !t)
|
|
31
31
|
return;
|
|
32
|
-
const a = (
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const a = (o, i) => () => {
|
|
33
|
+
x.current || (x.current = !0, i.scrollTop = o.scrollTop, requestAnimationFrame(() => {
|
|
34
|
+
x.current = !1;
|
|
35
35
|
}));
|
|
36
36
|
}, n = a(e, t), r = a(t, e);
|
|
37
37
|
return e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("scroll", r, { passive: !0 }), () => {
|
|
38
38
|
e.removeEventListener("scroll", n), t.removeEventListener("scroll", r);
|
|
39
39
|
};
|
|
40
40
|
}, []);
|
|
41
|
-
const
|
|
42
|
-
const e = (t) =>
|
|
41
|
+
const h = T(() => {
|
|
42
|
+
const e = (t) => _.filter((n) => (n.parentId ?? null) === t).flatMap((n) => [n, ...e(n.id)]);
|
|
43
43
|
return e(null);
|
|
44
|
-
}, [
|
|
45
|
-
if (
|
|
44
|
+
}, [_]), g = T(() => {
|
|
45
|
+
if (h.length === 0)
|
|
46
46
|
return { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date(), days: 30 };
|
|
47
|
-
let e = new Date(
|
|
48
|
-
return
|
|
47
|
+
let e = new Date(h[0].start), t = new Date(h[0].end);
|
|
48
|
+
return h.forEach((a) => {
|
|
49
49
|
new Date(a.start) < e && (e = new Date(a.start)), new Date(a.end) > t && (t = new Date(a.end));
|
|
50
|
-
}), e =
|
|
51
|
-
}, [
|
|
50
|
+
}), e = p(e, -2), t = p(t, 2), { start: e, end: t, days: y(e, t) };
|
|
51
|
+
}, [h]), X = g.days * d;
|
|
52
52
|
P(() => {
|
|
53
|
-
if (!
|
|
53
|
+
if (!v || !b)
|
|
54
54
|
return;
|
|
55
55
|
const e = (a) => {
|
|
56
|
-
const n = a.clientX -
|
|
56
|
+
const n = a.clientX - v.startX, r = Math.round(n / d);
|
|
57
57
|
if (r === 0)
|
|
58
58
|
return;
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
...
|
|
64
|
-
start:
|
|
65
|
-
end:
|
|
59
|
+
const o = _.find((i) => i.id === v.taskId);
|
|
60
|
+
if (o)
|
|
61
|
+
if (v.mode === "move")
|
|
62
|
+
b({
|
|
63
|
+
...o,
|
|
64
|
+
start: p(v.origStart, r),
|
|
65
|
+
end: p(v.origEnd, r)
|
|
66
66
|
});
|
|
67
67
|
else {
|
|
68
|
-
const i =
|
|
69
|
-
i >
|
|
68
|
+
const i = p(v.origEnd, r);
|
|
69
|
+
i > v.origStart && b({ ...o, end: i });
|
|
70
70
|
}
|
|
71
|
-
}, t = () =>
|
|
71
|
+
}, t = () => R(null);
|
|
72
72
|
return document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), () => {
|
|
73
73
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t);
|
|
74
74
|
};
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
75
|
+
}, [v, d, _, b]);
|
|
76
|
+
const C = A(
|
|
77
77
|
(e, t, a) => {
|
|
78
|
-
if (!
|
|
78
|
+
if (!N || !b)
|
|
79
79
|
return;
|
|
80
80
|
a.stopPropagation();
|
|
81
|
-
const n =
|
|
82
|
-
n &&
|
|
81
|
+
const n = _.find((r) => r.id === e);
|
|
82
|
+
n && R({
|
|
83
83
|
taskId: e,
|
|
84
84
|
mode: t,
|
|
85
85
|
startX: a.clientX,
|
|
@@ -87,10 +87,10 @@ const fe = [], b = (m, N) => {
|
|
|
87
87
|
origEnd: new Date(n.end)
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
|
-
[
|
|
91
|
-
), re =
|
|
90
|
+
[N, _, b]
|
|
91
|
+
), re = A(() => z((e) => Math.min(100, e + 5)), []), se = A(() => z((e) => Math.max(8, e - 5)), []), ie = () => {
|
|
92
92
|
const e = [], t = [];
|
|
93
|
-
new Date(
|
|
93
|
+
new Date(g.start);
|
|
94
94
|
const a = [
|
|
95
95
|
"Jan",
|
|
96
96
|
"Feb",
|
|
@@ -105,16 +105,16 @@ const fe = [], b = (m, N) => {
|
|
|
105
105
|
"Nov",
|
|
106
106
|
"Dec"
|
|
107
107
|
];
|
|
108
|
-
if (
|
|
108
|
+
if (D === "day") {
|
|
109
109
|
let n = -1, r = 0;
|
|
110
|
-
for (let
|
|
111
|
-
const i =
|
|
110
|
+
for (let o = 0; o < g.days; o++) {
|
|
111
|
+
const i = p(g.start, o);
|
|
112
112
|
i.getMonth() !== n && (n >= 0 && e.push(
|
|
113
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ m(
|
|
114
114
|
"div",
|
|
115
115
|
{
|
|
116
116
|
className: "nice-gantt__header-cell",
|
|
117
|
-
style: { width: (
|
|
117
|
+
style: { width: (o - r) * d },
|
|
118
118
|
children: [
|
|
119
119
|
a[n],
|
|
120
120
|
" ",
|
|
@@ -123,17 +123,17 @@ const fe = [], b = (m, N) => {
|
|
|
123
123
|
},
|
|
124
124
|
`m${n}-${r}`
|
|
125
125
|
)
|
|
126
|
-
), n = i.getMonth(), r =
|
|
127
|
-
const
|
|
126
|
+
), n = i.getMonth(), r = o);
|
|
127
|
+
const c = i.getDay() === 0 || i.getDay() === 6;
|
|
128
128
|
t.push(
|
|
129
129
|
/* @__PURE__ */ s(
|
|
130
130
|
"div",
|
|
131
131
|
{
|
|
132
|
-
className: `nice-gantt__header-cell nice-gantt__header-cell--sub ${
|
|
133
|
-
style: { width:
|
|
132
|
+
className: `nice-gantt__header-cell nice-gantt__header-cell--sub ${c ? "nice-gantt__header-cell--weekend" : ""}`,
|
|
133
|
+
style: { width: d },
|
|
134
134
|
children: i.getDate()
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
o
|
|
137
137
|
)
|
|
138
138
|
);
|
|
139
139
|
}
|
|
@@ -142,44 +142,44 @@ const fe = [], b = (m, N) => {
|
|
|
142
142
|
"div",
|
|
143
143
|
{
|
|
144
144
|
className: "nice-gantt__header-cell",
|
|
145
|
-
style: { width: (
|
|
145
|
+
style: { width: (g.days - r) * d },
|
|
146
146
|
children: a[n]
|
|
147
147
|
},
|
|
148
148
|
`m${n}-last`
|
|
149
149
|
)
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ m("div", { className: "nice-gantt__chart-header", children: [
|
|
153
153
|
/* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: e }),
|
|
154
154
|
/* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: t })
|
|
155
155
|
] });
|
|
156
156
|
}, ce = (e, t) => {
|
|
157
|
-
const a =
|
|
158
|
-
return /* @__PURE__ */
|
|
157
|
+
const a = y(g.start, new Date(e.start)) * d, n = Math.max(y(new Date(e.start), new Date(e.end)) * d, d), r = t * f + 4, o = f - 8, i = e.progress ?? 0;
|
|
158
|
+
return /* @__PURE__ */ m(
|
|
159
159
|
"div",
|
|
160
160
|
{
|
|
161
|
-
role:
|
|
162
|
-
tabIndex:
|
|
163
|
-
onKeyDown:
|
|
164
|
-
className: `nice-gantt__bar ${
|
|
161
|
+
role: M ? "button" : void 0,
|
|
162
|
+
tabIndex: M ? 0 : void 0,
|
|
163
|
+
onKeyDown: M ? he : void 0,
|
|
164
|
+
className: `nice-gantt__bar ${N ? "nice-gantt__bar--draggable" : ""}`,
|
|
165
165
|
title: `${e.title} (${Math.round(i)}%)`,
|
|
166
166
|
style: {
|
|
167
167
|
left: a,
|
|
168
168
|
top: r,
|
|
169
169
|
width: n,
|
|
170
|
-
height:
|
|
170
|
+
height: o,
|
|
171
171
|
backgroundColor: e.color || "var(--nice-color-primary, #3b82f6)"
|
|
172
172
|
},
|
|
173
|
-
onClick: () =>
|
|
174
|
-
onMouseDown:
|
|
173
|
+
onClick: () => M?.(e),
|
|
174
|
+
onMouseDown: N ? (c) => C(e.id, "move", c) : void 0,
|
|
175
175
|
children: [
|
|
176
176
|
i > 0 && /* @__PURE__ */ s("div", { className: "nice-gantt__bar-progress", style: { width: `${i}%` } }),
|
|
177
177
|
/* @__PURE__ */ s("span", { className: "nice-gantt__bar-label", children: e.title }),
|
|
178
|
-
|
|
178
|
+
N && /* @__PURE__ */ s(
|
|
179
179
|
"div",
|
|
180
180
|
{
|
|
181
181
|
className: "nice-gantt__bar-resize",
|
|
182
|
-
onMouseDown: (
|
|
182
|
+
onMouseDown: (c) => C(e.id, "resize", c)
|
|
183
183
|
}
|
|
184
184
|
)
|
|
185
185
|
]
|
|
@@ -187,44 +187,53 @@ const fe = [], b = (m, N) => {
|
|
|
187
187
|
e.id
|
|
188
188
|
);
|
|
189
189
|
}, oe = (e, t, a, n, r) => {
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
`L ${g} ${t}`,
|
|
195
|
-
`L ${g} ${p}`,
|
|
196
|
-
`L ${v} ${p}`,
|
|
197
|
-
`L ${v} ${n}`,
|
|
198
|
-
`L ${a} ${n}`
|
|
199
|
-
].join(" ");
|
|
200
|
-
const le = Math.max(0, v - g), he = Math.abs(n - t), me = Math.min(he / 2 || 10, le / 2 || 10), $ = Math.max(2, Math.min(10, me));
|
|
201
|
-
return [
|
|
190
|
+
const c = e + 10, l = a - 14, L = Math.abs(n - t) < 1, S = l <= c + 4;
|
|
191
|
+
if (L && !S)
|
|
192
|
+
return `M ${e} ${t} L ${a} ${n}`;
|
|
193
|
+
const u = L ? t + f / 2 : (t + n) / 2, O = [
|
|
202
194
|
`M ${e} ${t}`,
|
|
203
|
-
`L ${
|
|
204
|
-
`
|
|
205
|
-
`L ${
|
|
206
|
-
`
|
|
207
|
-
`L ${
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
`L ${c} ${t}`,
|
|
196
|
+
`L ${c} ${u}`,
|
|
197
|
+
`L ${l} ${u}`,
|
|
198
|
+
`L ${l} ${n}`,
|
|
199
|
+
`L ${a} ${n}`
|
|
200
|
+
].join(" ");
|
|
201
|
+
if (!r)
|
|
202
|
+
return O;
|
|
203
|
+
const Q = u >= t ? 1 : -1, q = n >= u ? 1 : -1, F = l >= c ? 1 : -1, $ = Math.min(
|
|
204
|
+
8,
|
|
205
|
+
10,
|
|
206
|
+
Math.abs(u - t) / 2,
|
|
207
|
+
Math.abs(n - u) / 2,
|
|
208
|
+
Math.abs(l - c) / 2
|
|
209
|
+
);
|
|
210
|
+
return $ < 1 ? O : [
|
|
211
|
+
`M ${e} ${t}`,
|
|
212
|
+
`L ${c - $} ${t}`,
|
|
213
|
+
`Q ${c} ${t} ${c} ${t + Q * $}`,
|
|
214
|
+
`L ${c} ${u - Q * $}`,
|
|
215
|
+
`Q ${c} ${u} ${c + F * $} ${u}`,
|
|
216
|
+
`L ${l - F * $} ${u}`,
|
|
217
|
+
`Q ${l} ${u} ${l} ${u + q * $}`,
|
|
218
|
+
`L ${l} ${n - q * $}`,
|
|
219
|
+
`Q ${l} ${n} ${l + $} ${n}`,
|
|
211
220
|
`L ${a} ${n}`
|
|
212
221
|
].join(" ");
|
|
213
222
|
}, de = () => {
|
|
214
223
|
if (!G)
|
|
215
224
|
return null;
|
|
216
|
-
const e = [], t = new Map(
|
|
217
|
-
return
|
|
225
|
+
const e = [], t = new Map(h.map((a, n) => [a.id, n]));
|
|
226
|
+
return h.forEach((a) => {
|
|
218
227
|
(a.dependencies || []).forEach((n) => {
|
|
219
|
-
const r = t.get(n),
|
|
220
|
-
if (r == null ||
|
|
228
|
+
const r = t.get(n), o = t.get(a.id);
|
|
229
|
+
if (r == null || o == null)
|
|
221
230
|
return;
|
|
222
|
-
const i =
|
|
231
|
+
const i = h[r], c = y(g.start, new Date(i.end)) * d, l = r * f + f / 2, L = y(g.start, new Date(a.start)) * d, S = o * f + f / 2;
|
|
223
232
|
e.push(
|
|
224
233
|
/* @__PURE__ */ s(
|
|
225
234
|
"path",
|
|
226
235
|
{
|
|
227
|
-
d: oe(
|
|
236
|
+
d: oe(c, l, L, S, V === "rounded"),
|
|
228
237
|
fill: "none",
|
|
229
238
|
stroke: "var(--nice-text-secondary, #6b7280)",
|
|
230
239
|
strokeWidth: 1.5,
|
|
@@ -236,12 +245,12 @@ const fe = [], b = (m, N) => {
|
|
|
236
245
|
)
|
|
237
246
|
);
|
|
238
247
|
});
|
|
239
|
-
}), /* @__PURE__ */
|
|
248
|
+
}), /* @__PURE__ */ m(
|
|
240
249
|
"svg",
|
|
241
250
|
{
|
|
242
251
|
className: "nice-gantt__deps",
|
|
243
|
-
width:
|
|
244
|
-
height:
|
|
252
|
+
width: X,
|
|
253
|
+
height: h.length * f,
|
|
245
254
|
style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" },
|
|
246
255
|
children: [
|
|
247
256
|
/* @__PURE__ */ s("defs", { children: /* @__PURE__ */ s("marker", { id: "arrowhead", markerWidth: "6", markerHeight: "4", refX: "5", refY: "2", orient: "auto", children: /* @__PURE__ */ s("polygon", { points: "0 0, 6 2, 0 4", fill: "var(--nice-text-secondary, #6b7280)" }) }) }),
|
|
@@ -250,18 +259,18 @@ const fe = [], b = (m, N) => {
|
|
|
250
259
|
}
|
|
251
260
|
);
|
|
252
261
|
};
|
|
253
|
-
return ae ? null : /* @__PURE__ */
|
|
254
|
-
Z && /* @__PURE__ */
|
|
262
|
+
return ae ? null : /* @__PURE__ */ m("div", { className: `nice-gantt ${H || ""}`, style: k, "data-testid": te, children: [
|
|
263
|
+
Z && /* @__PURE__ */ m("div", { className: "nice-gantt__zoom-controls", children: [
|
|
255
264
|
/* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: se, children: "−" }),
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
|
|
265
|
+
/* @__PURE__ */ m("span", { className: "nice-gantt__zoom-label", children: [
|
|
266
|
+
d,
|
|
258
267
|
"px"
|
|
259
268
|
] }),
|
|
260
269
|
/* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: re, children: "+" })
|
|
261
270
|
] }),
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ m("div", { className: "nice-gantt__container", children: [
|
|
272
|
+
/* @__PURE__ */ m("div", { className: "nice-gantt__table", style: { width: j, minWidth: j }, children: [
|
|
273
|
+
/* @__PURE__ */ m("div", { className: "nice-gantt__table-header", children: [
|
|
265
274
|
/* @__PURE__ */ s(
|
|
266
275
|
"div",
|
|
267
276
|
{
|
|
@@ -270,7 +279,7 @@ const fe = [], b = (m, N) => {
|
|
|
270
279
|
children: " "
|
|
271
280
|
}
|
|
272
281
|
),
|
|
273
|
-
/* @__PURE__ */ s("div", { className: "nice-gantt__table-header-row nice-gantt__table-header-row--sub", children:
|
|
282
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__table-header-row nice-gantt__table-header-row--sub", children: E.map((e, t) => /* @__PURE__ */ s(
|
|
274
283
|
"div",
|
|
275
284
|
{
|
|
276
285
|
className: "nice-gantt__table-header-cell",
|
|
@@ -280,7 +289,7 @@ const fe = [], b = (m, N) => {
|
|
|
280
289
|
t
|
|
281
290
|
)) })
|
|
282
291
|
] }),
|
|
283
|
-
/* @__PURE__ */ s("div", { className: "nice-gantt__table-body", ref:
|
|
292
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__table-body", ref: B, children: h.map((e, t) => /* @__PURE__ */ s("div", { className: "nice-gantt__table-row", style: { height: f }, children: E.map((a, n) => /* @__PURE__ */ s(
|
|
284
293
|
"div",
|
|
285
294
|
{
|
|
286
295
|
className: "nice-gantt__table-cell",
|
|
@@ -290,27 +299,27 @@ const fe = [], b = (m, N) => {
|
|
|
290
299
|
n
|
|
291
300
|
)) }, e.id)) })
|
|
292
301
|
] }),
|
|
293
|
-
/* @__PURE__ */ s("div", { className: "nice-gantt__chart", children: /* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__chart", children: /* @__PURE__ */ m("div", { className: "nice-gantt__chart-body-wrap", ref: I, children: [
|
|
294
303
|
ie(),
|
|
295
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ m(
|
|
296
305
|
"div",
|
|
297
306
|
{
|
|
298
307
|
className: "nice-gantt__chart-body",
|
|
299
308
|
style: {
|
|
300
|
-
width:
|
|
301
|
-
height:
|
|
309
|
+
width: X,
|
|
310
|
+
height: h.length * f,
|
|
302
311
|
position: "relative"
|
|
303
312
|
},
|
|
304
313
|
children: [
|
|
305
|
-
Array.from({ length:
|
|
306
|
-
const a =
|
|
314
|
+
Array.from({ length: g.days }, (e, t) => {
|
|
315
|
+
const a = p(g.start, t), n = a.getDay() === 0 || a.getDay() === 6;
|
|
307
316
|
return /* @__PURE__ */ s(
|
|
308
317
|
"div",
|
|
309
318
|
{
|
|
310
319
|
className: `nice-gantt__gridline ${n ? "nice-gantt__gridline--weekend" : ""}`,
|
|
311
320
|
style: {
|
|
312
|
-
left: t *
|
|
313
|
-
width:
|
|
321
|
+
left: t * d,
|
|
322
|
+
width: d,
|
|
314
323
|
height: "100%",
|
|
315
324
|
position: "absolute",
|
|
316
325
|
top: 0
|
|
@@ -319,7 +328,7 @@ const fe = [], b = (m, N) => {
|
|
|
319
328
|
t
|
|
320
329
|
);
|
|
321
330
|
}),
|
|
322
|
-
|
|
331
|
+
h.map((e, t) => ce(e, t)),
|
|
323
332
|
de()
|
|
324
333
|
]
|
|
325
334
|
}
|
|
@@ -328,7 +337,7 @@ const fe = [], b = (m, N) => {
|
|
|
328
337
|
] })
|
|
329
338
|
] });
|
|
330
339
|
};
|
|
331
|
-
process.env.NODE_ENV !== "production" && (
|
|
340
|
+
process.env.NODE_ENV !== "production" && (me.displayName = "NiceGantt");
|
|
332
341
|
export {
|
|
333
|
-
|
|
342
|
+
me as NiceGantt
|
|
334
343
|
};
|
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
steps: s =
|
|
6
|
-
activeStep:
|
|
7
|
-
orientation:
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as g, NiceIcon as m } from "@nice2dev/ui-core";
|
|
3
|
+
import z from "react";
|
|
4
|
+
const E = [], C = ({
|
|
5
|
+
steps: s = E,
|
|
6
|
+
activeStep: r,
|
|
7
|
+
orientation: _ = "horizontal",
|
|
8
8
|
onStepClick: a,
|
|
9
9
|
allowStepClick: l = !1,
|
|
10
|
-
showStepNumbers:
|
|
11
|
-
className:
|
|
12
|
-
style:
|
|
13
|
-
"data-testid":
|
|
10
|
+
showStepNumbers: v = !0,
|
|
11
|
+
className: h,
|
|
12
|
+
style: N,
|
|
13
|
+
"data-testid": u
|
|
14
14
|
}) => {
|
|
15
|
-
const { t:
|
|
16
|
-
return /* @__PURE__ */
|
|
15
|
+
const { t: f } = g();
|
|
16
|
+
return /* @__PURE__ */ o(
|
|
17
17
|
"div",
|
|
18
18
|
{
|
|
19
|
-
className: `nice-stepper nice-stepper--${
|
|
20
|
-
style:
|
|
21
|
-
"data-testid":
|
|
19
|
+
className: `nice-stepper nice-stepper--${_} ${h || ""}`,
|
|
20
|
+
style: N,
|
|
21
|
+
"data-testid": u,
|
|
22
22
|
children: [
|
|
23
|
-
/* @__PURE__ */ e("div", { className: "nice-stepper__header", children: s.map((
|
|
24
|
-
const r = t
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
23
|
+
/* @__PURE__ */ e("div", { className: "nice-stepper__header", children: s.map((t, n) => {
|
|
24
|
+
const d = (i, p) => i.status ?? (p < r ? "completed" : p === r ? "active" : "pending"), c = d(t, n), b = c === "completed", $ = c === "active", x = n > 0 && d(s[n - 1], n - 1) === "completed", y = c === "pending" ? "" : `nice-stepper__step--${c}`;
|
|
25
|
+
return /* @__PURE__ */ o(z.Fragment, { children: [
|
|
26
|
+
n > 0 && /* @__PURE__ */ e(
|
|
27
27
|
"div",
|
|
28
28
|
{
|
|
29
|
-
className: `nice-stepper__connector ${
|
|
29
|
+
className: `nice-stepper__connector ${x ? "nice-stepper__connector--completed" : ""}`
|
|
30
30
|
}
|
|
31
31
|
),
|
|
32
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ o(
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
|
-
className: `nice-stepper__step ${
|
|
36
|
-
"aria-current":
|
|
35
|
+
className: `nice-stepper__step ${y}`,
|
|
36
|
+
"aria-current": $ ? "step" : void 0,
|
|
37
37
|
...l && {
|
|
38
38
|
role: "button",
|
|
39
39
|
tabIndex: 0,
|
|
40
|
-
onClick: () => a?.(
|
|
41
|
-
onKeyDown: (
|
|
42
|
-
(
|
|
40
|
+
onClick: () => a?.(n),
|
|
41
|
+
onKeyDown: (i) => {
|
|
42
|
+
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), a?.(n));
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
style: { cursor: l ? "pointer" : void 0 },
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */ e("div", { className: "nice-stepper__indicator", children:
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */ e("div", { className: "nice-stepper__title", children:
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
/* @__PURE__ */ e("div", { className: "nice-stepper__indicator", children: t.icon ? t.icon : b ? /* @__PURE__ */ e(m, { name: "check", size: 14 }) : c === "error" ? /* @__PURE__ */ e(m, { name: "close", size: 14 }) : v ? n + 1 : "" }),
|
|
48
|
+
/* @__PURE__ */ o("div", { className: "nice-stepper__labels", children: [
|
|
49
|
+
/* @__PURE__ */ e("div", { className: "nice-stepper__title", children: t.title }),
|
|
50
|
+
t.subtitle && /* @__PURE__ */ e("div", { className: "nice-stepper__subtitle", children: t.subtitle }),
|
|
51
|
+
t.optional && /* @__PURE__ */ e("div", { className: "nice-stepper__optional", children: f("optional", "Optional") }),
|
|
52
|
+
t.description && /* @__PURE__ */ e("div", { className: "nice-stepper__description", children: t.description })
|
|
52
53
|
] })
|
|
53
54
|
]
|
|
54
55
|
}
|
|
55
56
|
)
|
|
56
|
-
] },
|
|
57
|
+
] }, n);
|
|
57
58
|
}) }),
|
|
58
|
-
s[
|
|
59
|
+
s[r]?.content && /* @__PURE__ */ e("div", { className: "nice-stepper__content", children: s[r].content })
|
|
59
60
|
]
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
63
|
};
|
|
63
64
|
export {
|
|
64
|
-
|
|
65
|
+
C as NiceStepper
|
|
65
66
|
};
|