@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,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { NiceFilterBuilder as
|
|
5
|
-
const
|
|
1
|
+
import { jsxs as s, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as w, useControllableState as x, NiceTutorialButton as E, resolveTutorial as G, NiceIcon as f } from "@nice2dev/ui-core";
|
|
3
|
+
import { useCallback as p, useMemo as I } from "react";
|
|
4
|
+
import { NiceFilterBuilder as M } from "./NiceFilterBuilder.mjs";
|
|
5
|
+
const F = [], L = [
|
|
6
6
|
{
|
|
7
7
|
target: ".nice-validationbuilder",
|
|
8
8
|
titleKey: "tutorial.validationBuilder.intro.title",
|
|
@@ -11,7 +11,7 @@ const T = [], x = [
|
|
|
11
11
|
content: "Add validation rules per field — required, length/number bounds, pattern, cross-field comparisons — and optionally limit each rule to apply only when a condition holds. These rules are enforced by the generated forms.",
|
|
12
12
|
placement: "auto"
|
|
13
13
|
}
|
|
14
|
-
],
|
|
14
|
+
], R = [
|
|
15
15
|
{ value: "required", label: "Required", kind: "none" },
|
|
16
16
|
{ value: "minLength", label: "Min length", kind: "value" },
|
|
17
17
|
{ value: "maxLength", label: "Max length", kind: "value" },
|
|
@@ -28,185 +28,276 @@ const T = [], x = [
|
|
|
28
28
|
{ value: "greaterThanField", label: "Greater than field", kind: "field" },
|
|
29
29
|
{ value: "lessThanField", label: "Less than field", kind: "field" },
|
|
30
30
|
{ value: "custom", label: "Custom (code)", kind: "custom" }
|
|
31
|
-
],
|
|
32
|
-
const { t
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
31
|
+
], q = (e) => R.find((v) => v.value === e)?.kind ?? "value", O = () => `vr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`, k = ({ rule: e, fields: v, onChange: r, onRemove: N }) => {
|
|
32
|
+
const { t } = w(), b = q(e.op), g = v.find((l) => l.field === e.field);
|
|
33
|
+
return /* @__PURE__ */ s("div", { className: "nice-validationbuilder__rule", children: [
|
|
34
|
+
/* @__PURE__ */ s("div", { className: "nice-validationbuilder__rule-main", children: [
|
|
35
|
+
/* @__PURE__ */ n(
|
|
36
36
|
"select",
|
|
37
37
|
{
|
|
38
38
|
className: "nice-filterbuilder__select",
|
|
39
|
-
value:
|
|
40
|
-
onChange: (
|
|
41
|
-
"aria-label":
|
|
42
|
-
children:
|
|
39
|
+
value: e.field,
|
|
40
|
+
onChange: (l) => r({ ...e, field: l.target.value }),
|
|
41
|
+
"aria-label": t("validationBuilder.field", "Field"),
|
|
42
|
+
children: v.map((l) => /* @__PURE__ */ n("option", { value: l.field, children: l.label }, l.field))
|
|
43
43
|
}
|
|
44
44
|
),
|
|
45
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ n(
|
|
46
46
|
"select",
|
|
47
47
|
{
|
|
48
48
|
className: "nice-filterbuilder__select",
|
|
49
|
-
value:
|
|
50
|
-
onChange: (
|
|
51
|
-
"aria-label":
|
|
52
|
-
children:
|
|
49
|
+
value: e.op,
|
|
50
|
+
onChange: (l) => r({ ...e, op: l.target.value }),
|
|
51
|
+
"aria-label": t("validationBuilder.validation", "Validation"),
|
|
52
|
+
children: R.map((l) => /* @__PURE__ */ n("option", { value: l.value, children: l.label }, l.value))
|
|
53
53
|
}
|
|
54
54
|
),
|
|
55
|
-
|
|
55
|
+
b === "value" && /* @__PURE__ */ n(
|
|
56
56
|
"input",
|
|
57
57
|
{
|
|
58
58
|
className: "nice-filterbuilder__input",
|
|
59
|
-
type:
|
|
60
|
-
value: String(
|
|
61
|
-
onChange: (
|
|
62
|
-
...
|
|
63
|
-
value:
|
|
59
|
+
type: g?.type === "number" ? "number" : "text",
|
|
60
|
+
value: String(e.value ?? ""),
|
|
61
|
+
onChange: (l) => r({
|
|
62
|
+
...e,
|
|
63
|
+
value: g?.type === "number" ? Number(l.target.value) : l.target.value
|
|
64
64
|
}),
|
|
65
|
-
placeholder:
|
|
66
|
-
"aria-label":
|
|
65
|
+
placeholder: t("validationBuilder.value", "Value"),
|
|
66
|
+
"aria-label": t("validationBuilder.value", "Value")
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
|
|
69
|
+
b === "field" && /* @__PURE__ */ s(
|
|
70
70
|
"select",
|
|
71
71
|
{
|
|
72
72
|
className: "nice-filterbuilder__select",
|
|
73
|
-
value:
|
|
74
|
-
onChange: (
|
|
75
|
-
"aria-label":
|
|
73
|
+
value: e.compareField ?? "",
|
|
74
|
+
onChange: (l) => r({ ...e, compareField: l.target.value }),
|
|
75
|
+
"aria-label": t("validationBuilder.compareField", "Compare field"),
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
77
|
+
/* @__PURE__ */ n("option", { value: "", children: t("validationBuilder.field2", "-- field --") }),
|
|
78
|
+
v.map((l) => /* @__PURE__ */ n("option", { value: l.field, children: l.label }, l.field))
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
|
-
|
|
83
|
-
/* @__PURE__ */
|
|
82
|
+
b === "custom" && /* @__PURE__ */ n("span", { className: "nice-validationbuilder__custom-hint", children: t("validationBuilder.predicateWiredInCode", "predicate wired in code") }),
|
|
83
|
+
/* @__PURE__ */ n(
|
|
84
84
|
"input",
|
|
85
85
|
{
|
|
86
86
|
className: "nice-filterbuilder__input",
|
|
87
|
-
value:
|
|
88
|
-
onChange: (
|
|
89
|
-
placeholder:
|
|
90
|
-
"aria-label":
|
|
87
|
+
value: e.message ?? "",
|
|
88
|
+
onChange: (l) => r({ ...e, message: l.target.value || void 0 }),
|
|
89
|
+
placeholder: t("validationBuilder.messageOptional", "Message (optional)"),
|
|
90
|
+
"aria-label": t("validationBuilder.message", "Message")
|
|
91
91
|
}
|
|
92
92
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ s(
|
|
94
94
|
"select",
|
|
95
95
|
{
|
|
96
96
|
className: "nice-filterbuilder__select",
|
|
97
|
-
value:
|
|
98
|
-
onChange: (
|
|
99
|
-
"aria-label":
|
|
97
|
+
value: e.severity ?? "error",
|
|
98
|
+
onChange: (l) => r({ ...e, severity: l.target.value }),
|
|
99
|
+
"aria-label": t("validationBuilder.severity", "Severity"),
|
|
100
100
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ n("option", { value: "error", children: t("validationBuilder.error", "Error") }),
|
|
102
|
+
/* @__PURE__ */ n("option", { value: "warning", children: t("validationBuilder.warning", "Warning") })
|
|
103
103
|
]
|
|
104
104
|
}
|
|
105
105
|
),
|
|
106
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ n(
|
|
107
107
|
"button",
|
|
108
108
|
{
|
|
109
109
|
type: "button",
|
|
110
110
|
className: "nice-validationbuilder__when-toggle",
|
|
111
|
-
onClick: () =>
|
|
112
|
-
...
|
|
113
|
-
when:
|
|
111
|
+
onClick: () => r({
|
|
112
|
+
...e,
|
|
113
|
+
when: e.when ? void 0 : { type: "group", logic: "and", items: [] }
|
|
114
114
|
}),
|
|
115
|
-
"aria-pressed":
|
|
116
|
-
title:
|
|
117
|
-
children:
|
|
115
|
+
"aria-pressed": e.when != null,
|
|
116
|
+
title: t("validationBuilder.applyOnlyWhen", "Apply only when…"),
|
|
117
|
+
children: t("validationBuilder.when", "when…")
|
|
118
118
|
}
|
|
119
119
|
),
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ n(
|
|
121
121
|
"button",
|
|
122
122
|
{
|
|
123
123
|
type: "button",
|
|
124
124
|
className: "nice-filterbuilder__remove",
|
|
125
|
-
onClick:
|
|
126
|
-
"aria-label":
|
|
127
|
-
children: /* @__PURE__ */
|
|
125
|
+
onClick: N,
|
|
126
|
+
"aria-label": t("validationBuilder.removeRule", "Remove rule"),
|
|
127
|
+
children: /* @__PURE__ */ n(f, { name: "close", size: 14 })
|
|
128
128
|
}
|
|
129
129
|
)
|
|
130
130
|
] }),
|
|
131
|
-
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
131
|
+
e.when && /* @__PURE__ */ s("div", { className: "nice-validationbuilder__when", children: [
|
|
132
|
+
/* @__PURE__ */ n("span", { className: "nice-validationbuilder__when-label", children: t("validationBuilder.validateOnlyWhen", "Validate only when:") }),
|
|
133
|
+
/* @__PURE__ */ n(
|
|
134
|
+
M,
|
|
135
135
|
{
|
|
136
|
-
fields:
|
|
137
|
-
value:
|
|
138
|
-
onChange: (
|
|
136
|
+
fields: v,
|
|
137
|
+
value: e.when,
|
|
138
|
+
onChange: (l) => r({ ...e, when: l })
|
|
139
139
|
}
|
|
140
140
|
)
|
|
141
141
|
] })
|
|
142
142
|
] });
|
|
143
|
-
},
|
|
144
|
-
fields:
|
|
145
|
-
value:
|
|
146
|
-
defaultValue:
|
|
147
|
-
onChange:
|
|
148
|
-
tutorial:
|
|
149
|
-
className:
|
|
150
|
-
style:
|
|
151
|
-
"data-testid":
|
|
143
|
+
}, A = ({
|
|
144
|
+
fields: e = F,
|
|
145
|
+
value: v,
|
|
146
|
+
defaultValue: r,
|
|
147
|
+
onChange: N,
|
|
148
|
+
tutorial: t,
|
|
149
|
+
className: b,
|
|
150
|
+
style: g,
|
|
151
|
+
"data-testid": l
|
|
152
152
|
}) => {
|
|
153
|
-
const { t:
|
|
154
|
-
value:
|
|
155
|
-
defaultValue:
|
|
153
|
+
const { t: c } = w(), [d, u] = x({
|
|
154
|
+
value: v,
|
|
155
|
+
defaultValue: r,
|
|
156
156
|
fallbackValue: [],
|
|
157
|
-
onChange:
|
|
157
|
+
onChange: N,
|
|
158
158
|
componentName: "NiceValidationBuilder"
|
|
159
|
-
}),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
}), _ = p(
|
|
160
|
+
(i) => {
|
|
161
|
+
const a = {
|
|
162
|
+
id: O(),
|
|
163
|
+
field: e[0]?.field ?? "",
|
|
164
|
+
op: "required",
|
|
165
|
+
severity: "error"
|
|
166
|
+
};
|
|
167
|
+
i && (a.group = i), u([...d, a]);
|
|
168
168
|
},
|
|
169
|
-
[d,
|
|
170
|
-
),
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
[d, u, e]
|
|
170
|
+
), m = I(() => {
|
|
171
|
+
const i = [];
|
|
172
|
+
for (const a of d)
|
|
173
|
+
a.group && !i.includes(a.group) && i.push(a.group);
|
|
174
|
+
return i;
|
|
175
|
+
}, [d]), V = p(() => {
|
|
176
|
+
const i = c("validationBuilder.groupName", "Group");
|
|
177
|
+
let a = m.length + 1;
|
|
178
|
+
for (; m.includes(`${i} ${a}`); )
|
|
179
|
+
a++;
|
|
180
|
+
_(`${i} ${a}`);
|
|
181
|
+
}, [m, _, c]), C = p(
|
|
182
|
+
(i, a) => {
|
|
183
|
+
const o = a.trim();
|
|
184
|
+
!o || o === i || m.includes(o) || u(d.map((h) => h.group === i ? { ...h, group: o } : h));
|
|
185
|
+
},
|
|
186
|
+
[d, u, m]
|
|
187
|
+
), T = p(
|
|
188
|
+
(i) => u(d.filter((a) => a.group !== i)),
|
|
189
|
+
[d, u]
|
|
190
|
+
), y = p(
|
|
191
|
+
(i, a) => {
|
|
192
|
+
const o = [...d];
|
|
193
|
+
o[i] = a, u(o);
|
|
194
|
+
},
|
|
195
|
+
[d, u]
|
|
196
|
+
), B = p(
|
|
197
|
+
(i) => u(d.filter((a, o) => o !== i)),
|
|
198
|
+
[d, u]
|
|
173
199
|
);
|
|
174
|
-
return /* @__PURE__ */
|
|
200
|
+
return /* @__PURE__ */ s(
|
|
175
201
|
"div",
|
|
176
202
|
{
|
|
177
|
-
className: `nice-validationbuilder ${
|
|
178
|
-
style: { position: "relative", ...
|
|
179
|
-
"data-testid":
|
|
203
|
+
className: `nice-validationbuilder ${b || ""}`,
|
|
204
|
+
style: { position: "relative", ...g },
|
|
205
|
+
"data-testid": l,
|
|
180
206
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
d.map(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
207
|
+
/* @__PURE__ */ n("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ n(E, { steps: G(t, L) }) }),
|
|
208
|
+
/* @__PURE__ */ s("div", { className: "nice-validationbuilder__rules", children: [
|
|
209
|
+
d.map(
|
|
210
|
+
(i, a) => i.group ? null : /* @__PURE__ */ n(
|
|
211
|
+
k,
|
|
212
|
+
{
|
|
213
|
+
rule: i,
|
|
214
|
+
fields: e,
|
|
215
|
+
onChange: (o) => y(a, o),
|
|
216
|
+
onRemove: () => B(a)
|
|
217
|
+
},
|
|
218
|
+
i.id
|
|
219
|
+
)
|
|
220
|
+
),
|
|
221
|
+
d.length === 0 && /* @__PURE__ */ n("div", { className: "nice-validationbuilder__empty", children: c("validationBuilder.noValidationRulesYet", "No validation rules yet.") })
|
|
194
222
|
] }),
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
"
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
223
|
+
m.map((i) => /* @__PURE__ */ s("section", { className: "nice-validationbuilder__group", children: [
|
|
224
|
+
/* @__PURE__ */ s("header", { className: "nice-validationbuilder__group-head", children: [
|
|
225
|
+
/* @__PURE__ */ n(f, { name: "folder", size: 14 }),
|
|
226
|
+
/* @__PURE__ */ n(
|
|
227
|
+
"input",
|
|
228
|
+
{
|
|
229
|
+
className: "nice-filterbuilder__input nice-validationbuilder__group-name",
|
|
230
|
+
defaultValue: i,
|
|
231
|
+
onBlur: (a) => C(i, a.target.value),
|
|
232
|
+
onKeyDown: (a) => {
|
|
233
|
+
a.key === "Enter" && a.target.blur();
|
|
234
|
+
},
|
|
235
|
+
"aria-label": c("validationBuilder.groupNameAria", "Group name")
|
|
236
|
+
},
|
|
237
|
+
i
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ n(
|
|
240
|
+
"button",
|
|
241
|
+
{
|
|
242
|
+
type: "button",
|
|
243
|
+
className: "nice-btn nice-btn--sm",
|
|
244
|
+
onClick: () => _(i),
|
|
245
|
+
disabled: e.length === 0,
|
|
246
|
+
children: c("validationBuilder.rule", "+ Rule")
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ n(
|
|
250
|
+
"button",
|
|
251
|
+
{
|
|
252
|
+
type: "button",
|
|
253
|
+
className: "nice-filterbuilder__remove",
|
|
254
|
+
onClick: () => T(i),
|
|
255
|
+
"aria-label": c("validationBuilder.removeGroup", "Remove group and its rules"),
|
|
256
|
+
title: c("validationBuilder.removeGroup", "Remove group and its rules"),
|
|
257
|
+
children: /* @__PURE__ */ n(f, { name: "trash", size: 14 })
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
] }),
|
|
261
|
+
/* @__PURE__ */ n("div", { className: "nice-validationbuilder__rules", children: d.map(
|
|
262
|
+
(a, o) => a.group === i ? /* @__PURE__ */ n(
|
|
263
|
+
k,
|
|
264
|
+
{
|
|
265
|
+
rule: a,
|
|
266
|
+
fields: e,
|
|
267
|
+
onChange: (h) => y(o, h),
|
|
268
|
+
onRemove: () => B(o)
|
|
269
|
+
},
|
|
270
|
+
a.id
|
|
271
|
+
) : null
|
|
272
|
+
) })
|
|
273
|
+
] }, i)),
|
|
274
|
+
/* @__PURE__ */ s("div", { className: "nice-validationbuilder__footer", children: [
|
|
275
|
+
/* @__PURE__ */ n(
|
|
276
|
+
"button",
|
|
277
|
+
{
|
|
278
|
+
type: "button",
|
|
279
|
+
className: "nice-btn nice-btn--sm",
|
|
280
|
+
onClick: () => _(),
|
|
281
|
+
disabled: e.length === 0,
|
|
282
|
+
children: c("validationBuilder.rule", "+ Rule")
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
/* @__PURE__ */ n(
|
|
286
|
+
"button",
|
|
287
|
+
{
|
|
288
|
+
type: "button",
|
|
289
|
+
className: "nice-btn nice-btn--sm",
|
|
290
|
+
onClick: V,
|
|
291
|
+
disabled: e.length === 0,
|
|
292
|
+
children: c("validationBuilder.group", "+ Group")
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
] })
|
|
205
296
|
]
|
|
206
297
|
}
|
|
207
298
|
);
|
|
208
299
|
};
|
|
209
|
-
process.env.NODE_ENV !== "production" && (
|
|
300
|
+
process.env.NODE_ENV !== "production" && (A.displayName = "NiceValidationBuilder");
|
|
210
301
|
export {
|
|
211
|
-
|
|
302
|
+
A as NiceValidationBuilder
|
|
212
303
|
};
|
|
@@ -10,8 +10,8 @@ class s {
|
|
|
10
10
|
}
|
|
11
11
|
/** Register multiple components at once. */
|
|
12
12
|
registerAll(e) {
|
|
13
|
-
for (const
|
|
14
|
-
this.register(
|
|
13
|
+
for (const t of e)
|
|
14
|
+
this.register(t);
|
|
15
15
|
return this;
|
|
16
16
|
}
|
|
17
17
|
/** Unregister a component type. */
|
|
@@ -32,7 +32,7 @@ class s {
|
|
|
32
32
|
}
|
|
33
33
|
/** Get components by category. */
|
|
34
34
|
getByCategory(e) {
|
|
35
|
-
return this.getAll().filter((
|
|
35
|
+
return this.getAll().filter((t) => t.category === e);
|
|
36
36
|
}
|
|
37
37
|
/** Get all category names. */
|
|
38
38
|
getCategories() {
|
|
@@ -40,8 +40,8 @@ class s {
|
|
|
40
40
|
}
|
|
41
41
|
// ── Action Handlers ───────────────────────────────────
|
|
42
42
|
/** Register a custom action handler. */
|
|
43
|
-
registerAction(e,
|
|
44
|
-
return this.actionHandlers.set(e,
|
|
43
|
+
registerAction(e, t) {
|
|
44
|
+
return this.actionHandlers.set(e, t), this;
|
|
45
45
|
}
|
|
46
46
|
/** Get a registered action handler. */
|
|
47
47
|
getAction(e) {
|
|
@@ -58,23 +58,23 @@ class s {
|
|
|
58
58
|
// ── Validation ────────────────────────────────────────
|
|
59
59
|
/** Validate that all controlTypes in a view definition are registered. */
|
|
60
60
|
validateTypes(e) {
|
|
61
|
-
const
|
|
62
|
-
for (const
|
|
63
|
-
this.has(
|
|
64
|
-
return
|
|
61
|
+
const t = [];
|
|
62
|
+
for (const r of e)
|
|
63
|
+
this.has(r) || t.push(r);
|
|
64
|
+
return t;
|
|
65
65
|
}
|
|
66
66
|
/** Clear all registrations (useful for testing). */
|
|
67
67
|
clear() {
|
|
68
68
|
this.components.clear(), this.actionHandlers.clear();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
function
|
|
73
|
-
const
|
|
74
|
-
return
|
|
71
|
+
const p = /* @__PURE__ */ u();
|
|
72
|
+
function u() {
|
|
73
|
+
const a = new s();
|
|
74
|
+
return m(a), y(a), a;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
76
|
+
function m(a) {
|
|
77
|
+
a.registerAll([
|
|
78
78
|
{
|
|
79
79
|
type: "text",
|
|
80
80
|
label: "Text",
|
|
@@ -90,9 +90,9 @@ function u(t) {
|
|
|
90
90
|
label: "Heading",
|
|
91
91
|
category: "content",
|
|
92
92
|
component: ((e) => {
|
|
93
|
-
const
|
|
93
|
+
const r = `h${Math.min(6, Math.max(1, Number(e.level ?? 2)))}`;
|
|
94
94
|
return i.createElement(
|
|
95
|
-
|
|
95
|
+
r,
|
|
96
96
|
{ className: "nice-view-v2__heading" },
|
|
97
97
|
String(e.text ?? "")
|
|
98
98
|
);
|
|
@@ -126,74 +126,107 @@ function u(t) {
|
|
|
126
126
|
}
|
|
127
127
|
]);
|
|
128
128
|
}
|
|
129
|
-
function n(
|
|
130
|
-
const
|
|
131
|
-
|
|
129
|
+
function n(a, e, t, r) {
|
|
130
|
+
const l = i.lazy(() => e().then((c) => ({ default: t(c) }))), o = (c) => i.createElement(i.Suspense, { fallback: null }, i.createElement(l, c));
|
|
131
|
+
a.register({ ...r, component: o });
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function y(a) {
|
|
134
134
|
n(
|
|
135
|
-
|
|
135
|
+
a,
|
|
136
136
|
() => import("../editors/inputs/NiceTextInput.mjs"),
|
|
137
137
|
(e) => e.NiceTextInput,
|
|
138
138
|
{ type: "textInput", label: "Text Input", category: "input" }
|
|
139
139
|
), n(
|
|
140
|
-
|
|
140
|
+
a,
|
|
141
141
|
() => import("../editors/inputs/NiceTextArea.mjs"),
|
|
142
142
|
(e) => e.NiceTextArea,
|
|
143
143
|
{ type: "textArea", label: "Text Area", category: "input" }
|
|
144
144
|
), n(
|
|
145
|
-
|
|
145
|
+
a,
|
|
146
146
|
() => import("../editors/inputs/NiceNumberInput.mjs"),
|
|
147
147
|
(e) => e.NiceNumberInput,
|
|
148
148
|
{ type: "numberInput", label: "Number Input", category: "input" }
|
|
149
149
|
), n(
|
|
150
|
-
|
|
150
|
+
a,
|
|
151
151
|
() => import("../editors/inputs/NiceCheckbox.mjs"),
|
|
152
152
|
(e) => e.NiceCheckbox,
|
|
153
153
|
{ type: "checkbox", label: "Checkbox", category: "input" }
|
|
154
154
|
), n(
|
|
155
|
-
|
|
155
|
+
a,
|
|
156
156
|
() => import("../editors/inputs/NiceSelect.mjs"),
|
|
157
157
|
(e) => e.NiceSelect,
|
|
158
158
|
{ type: "select", label: "Select", category: "input" }
|
|
159
159
|
), n(
|
|
160
|
-
|
|
160
|
+
a,
|
|
161
161
|
() => import("../editors/inputs/NiceSlider.mjs"),
|
|
162
162
|
(e) => e.NiceSlider,
|
|
163
163
|
{ type: "slider", label: "Slider", category: "input" }
|
|
164
164
|
), n(
|
|
165
|
-
|
|
165
|
+
a,
|
|
166
166
|
() => import("../editors/inputs/NiceRating.mjs"),
|
|
167
167
|
(e) => e.NiceRating,
|
|
168
168
|
{ type: "rating", label: "Rating", category: "input" }
|
|
169
169
|
), n(
|
|
170
|
-
|
|
170
|
+
a,
|
|
171
171
|
() => import("../editors/inputs/NiceRadioGroup.mjs"),
|
|
172
172
|
(e) => e.NiceRadioGroup,
|
|
173
173
|
{ type: "radioGroup", label: "Radio Group", category: "input" }
|
|
174
174
|
), n(
|
|
175
|
-
|
|
175
|
+
a,
|
|
176
176
|
() => import("../editors/pickers/NiceDateTimePicker.mjs"),
|
|
177
177
|
(e) => e.NiceDateTimePicker,
|
|
178
178
|
{ type: "datePicker", label: "Date Picker", category: "input" }
|
|
179
179
|
), n(
|
|
180
|
-
|
|
180
|
+
a,
|
|
181
181
|
() => import("../editors/pickers/NiceDateTimePicker.mjs"),
|
|
182
182
|
(e) => e.NiceDateTimePicker,
|
|
183
183
|
{ type: "timePicker", label: "Time Picker", category: "input" }
|
|
184
184
|
), n(
|
|
185
|
-
|
|
185
|
+
a,
|
|
186
186
|
() => import("../editors/pickers/NiceColorPicker.mjs"),
|
|
187
187
|
(e) => e.NiceColorPicker,
|
|
188
188
|
{ type: "colorPicker", label: "Color Picker", category: "input" }
|
|
189
189
|
), n(
|
|
190
|
-
|
|
190
|
+
a,
|
|
191
191
|
() => import("../navigation/NiceCard.mjs"),
|
|
192
192
|
(e) => e.NiceCard,
|
|
193
193
|
{ type: "card", label: "Card", category: "layout" }
|
|
194
|
+
), n(
|
|
195
|
+
a,
|
|
196
|
+
() => import("../data/NiceDataGrid.mjs"),
|
|
197
|
+
(e) => ((t) => i.createElement(e.NiceDataGrid, {
|
|
198
|
+
...t,
|
|
199
|
+
data: Array.isArray(t.data) ? t.data : []
|
|
200
|
+
})),
|
|
201
|
+
{ type: "dataGrid", label: "Data Grid", category: "data" }
|
|
202
|
+
), n(
|
|
203
|
+
a,
|
|
204
|
+
() => import("../charts/NiceChart.mjs"),
|
|
205
|
+
(e) => ((t) => i.createElement(e.NiceChart, {
|
|
206
|
+
...t,
|
|
207
|
+
series: Array.isArray(t.series) ? t.series : []
|
|
208
|
+
})),
|
|
209
|
+
{ type: "chart", label: "Chart", category: "data" }
|
|
210
|
+
), n(
|
|
211
|
+
a,
|
|
212
|
+
() => import("../display/NiceStatistic.mjs"),
|
|
213
|
+
(e) => ((t) => i.createElement(e.NiceStatistic, {
|
|
214
|
+
...t,
|
|
215
|
+
title: String(t.title ?? t.label ?? "KPI"),
|
|
216
|
+
value: typeof t.value == "number" || typeof t.value == "string" ? t.value : "—"
|
|
217
|
+
})),
|
|
218
|
+
{ type: "kpi", label: "KPI", category: "data" }
|
|
219
|
+
), n(
|
|
220
|
+
a,
|
|
221
|
+
() => import("../display/NiceBadge.mjs"),
|
|
222
|
+
(e) => ((t) => i.createElement(e.NiceBadge, {
|
|
223
|
+
...t,
|
|
224
|
+
children: t.children ?? String(t.text ?? t.label ?? "Badge")
|
|
225
|
+
})),
|
|
226
|
+
{ type: "badge", label: "Badge", category: "display" }
|
|
194
227
|
);
|
|
195
228
|
}
|
|
196
229
|
export {
|
|
197
230
|
s as NiceViewRegistry,
|
|
198
|
-
|
|
231
|
+
p as defaultViewRegistry
|
|
199
232
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.21",
|
|
4
4
|
"description": "Nice2Dev UI — Universal, themeable, i18n-ready React component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"react-dom": ">=17.0.0"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@nice2dev/i18n": "^1.4.
|
|
101
|
-
"@nice2dev/ui-core": "^1.4.
|
|
100
|
+
"@nice2dev/i18n": "^1.4.21",
|
|
101
|
+
"@nice2dev/ui-core": "^1.4.21",
|
|
102
102
|
"country-flag-icons": "^1.6.20"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@nice2dev/testing": "^1.4.
|
|
105
|
+
"@nice2dev/testing": "^1.4.21",
|
|
106
106
|
"@playwright/test": "^1.62.1",
|
|
107
107
|
"@testing-library/dom": "^10.4.1",
|
|
108
108
|
"@testing-library/jest-dom": "^7.0.1",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceBottomSheet",n="Bottom sheet with snap points and drag-to-dismiss.",o="mobile",s="1.0.0",a="stable",i=[{name:"open",type:"boolean",required:!0,description:"Open state"},{name:"onOpenChange",type:"(open: boolean) => void",required:!0,description:"Open change callback"},{name:"children",type:"React.ReactNode",required:!0,description:"Sheet content"},{name:"snapPoints",type:"number[]",default:"[0.5, 1]",description:"Snap points (0-1)"},{name:"initialSnap",type:"number",default:"0",description:"Default snap point index"},{name:"onSnap",type:"(index: number) => void",description:"Snap callback"},{name:"showHandle",type:"boolean",default:"true",description:"Show drag handle"}],c=[{title:"Bottom Sheet",description:"Draggable sheet",code:`<NiceBottomSheet
|
|
2
|
-
open={sheetOpen}
|
|
3
|
-
onOpenChange={setSheetOpen}
|
|
4
|
-
snapPoints={[0.3, 0.7, 1]}
|
|
5
|
-
showHandle
|
|
6
|
-
>
|
|
7
|
-
<DetailPanel />
|
|
8
|
-
</NiceBottomSheet>`}],p={keyboard:["Tab within sheet","Escape to close"],aria:["Dialog role","Drag handle description"]},r=["NiceActionSheet","NiceDrawer"],d={$schema:e,name:t,description:n,category:o,since:s,status:a,props:i,examples:c,accessibility:p,seeAlso:r};exports.$schema=e;exports.accessibility=p;exports.category=o;exports.default=d;exports.description=n;exports.examples=c;exports.name=t;exports.props=i;exports.seeAlso=r;exports.since=s;exports.status=a;
|