@nice2dev/ui 1.4.14 → 1.4.16
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 +80 -0
- package/dist/{NiceColorPicker-BLwYNSXJ.cjs → NiceColorPicker-79rkvaSk.cjs} +1 -1
- package/dist/NiceDataGrid-B1AOjgjm.cjs +10 -0
- package/dist/NiceForm-fmePSeA9.cjs +1 -0
- package/dist/{NiceHtmlEditor-BzECmDO3.cjs → NiceHtmlEditor-By7R1wRo.cjs} +1 -1
- package/dist/{NiceMention-CYRqPKGU.cjs → NiceMention-i7n2BoMw.cjs} +1 -1
- package/dist/{NiceModuleLifecyclePanel-CiYbPcHV.cjs → NiceModuleLifecyclePanel-DVHQuhc-.cjs} +1 -1
- package/dist/{NicePagination-BAxwqeEd.cjs → NicePagination-D9JguOl0.cjs} +1 -1
- package/dist/NicePivotGrid-B_7iQJys.cjs +2 -0
- package/dist/NiceSavedQueryPanel-ChY4HwpM.cjs +587 -0
- package/dist/{NiceScheduler-BqYiHPvz.cjs → NiceScheduler-B2DamQ_L.cjs} +1 -1
- package/dist/backup/NiceBackupScheduler.mjs +171 -119
- package/dist/charts/NiceOrganizationChart.mjs +159 -59
- package/dist/charts/orgChartExport.mjs +71 -0
- package/dist/charts/tidyTree.mjs +43 -0
- package/dist/charts-C3Q3r8Yz.cjs +918 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +9 -0
- package/dist/{core-lazy-BQexApr7.cjs → core-lazy-ChKRuEPb.cjs} +1 -1
- package/dist/data/NiceDataGrid.mjs +301 -320
- package/dist/data/NiceRowEditDialog.mjs +57 -0
- package/dist/data/NiceTreeGrid.mjs +478 -433
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +43 -2
- package/dist/{devops-cgRBnZVX.cjs → devops-o6Zm0VKB.cjs} +3 -3
- package/dist/devops.cjs +1 -1
- package/dist/editors/forms/NiceForm.mjs +216 -167
- package/dist/editors/inputs/NiceUpload.mjs +238 -238
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +13 -1
- package/dist/feedback.cjs +1 -1
- package/dist/index.cjs +254 -254
- package/dist/index.d.ts +198 -5
- package/dist/index.mjs +928 -920
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +11 -1
- package/dist/navigation.cjs +1 -1
- package/dist/no-code/NiceDataMapper.mjs +398 -361
- package/dist/no-code-CN_q6TcB.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +11 -1
- package/dist/style.css +1 -1
- package/dist/tools/NicePermissionMatrix.mjs +171 -138
- package/dist/tools/NiceRoleEditor.mjs +334 -297
- package/package.json +4 -4
- package/dist/NiceDataGrid-D3qRQSjy.cjs +0 -10
- package/dist/NiceForm-BWb4LTQJ.cjs +0 -1
- package/dist/NicePivotGrid-Cxu5PECg.cjs +0 -152
- package/dist/NiceSavedQueryPanel-C1nxEmMu.cjs +0 -587
- package/dist/charts-BzlvCCg9.cjs +0 -768
- package/dist/no-code-B1jzfUF5.cjs +0 -331
package/dist/devops.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./devops-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./devops-o6Zm0VKB.cjs");exports.NiceBranchManager=e.NiceBranchManager;exports.NiceGitBlame=e.NiceGitBlame;exports.NiceGitConflictResolver=e.NiceGitConflictResolver;exports.NiceGitDiffViewer=e.NiceGitDiffViewer;exports.NiceGitGraph=e.NiceGitGraph;exports.NiceGitHooks=e.NiceGitHooks;exports.NiceMergeRequestBuilder=e.NiceMergeRequestBuilder;exports.NicePipelineEditor=e.NicePipelineEditor;exports.NicePipelineMonitor=e.NicePipelineMonitor;
|
|
@@ -1,119 +1,147 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { NiceButton as
|
|
5
|
-
import { NiceTabs as
|
|
6
|
-
import { NiceAutocomplete as
|
|
7
|
-
import { NiceCheckbox as
|
|
8
|
-
import { NiceMaskedInput as
|
|
9
|
-
import { NiceNumberInput as
|
|
10
|
-
import { NicePasswordInput as
|
|
11
|
-
import { NiceRadioGroup as
|
|
12
|
-
import { NiceRating as
|
|
13
|
-
import { NiceSelect as
|
|
14
|
-
import { NiceSlider as
|
|
15
|
-
import { NiceTagBox as
|
|
16
|
-
import { NiceTextArea as
|
|
17
|
-
import { NiceTextInput as
|
|
18
|
-
import { NiceToggle as
|
|
19
|
-
import { NiceUpload as
|
|
20
|
-
import { NiceAddress as
|
|
21
|
-
import { NiceColorPicker as
|
|
22
|
-
import { NiceCountryPicker as
|
|
23
|
-
import { NiceDateTimePicker as
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as Se, useNiceAccessMode as Ae, useNiceRecord as Ie } from "@nice2dev/ui-core";
|
|
3
|
+
import { useMemo as q, useState as E, useRef as U, useEffect as O, useCallback as h, useId as Le } from "react";
|
|
4
|
+
import { NiceButton as V } from "../../buttons/NiceButton.mjs";
|
|
5
|
+
import { NiceTabs as Re } from "../../navigation/NiceTabs.mjs";
|
|
6
|
+
import { NiceAutocomplete as we } from "../inputs/NiceAutocomplete.mjs";
|
|
7
|
+
import { NiceCheckbox as Fe } from "../inputs/NiceCheckbox.mjs";
|
|
8
|
+
import { NiceMaskedInput as $e } from "../inputs/NiceMaskedInput.mjs";
|
|
9
|
+
import { NiceNumberInput as ce } from "../inputs/NiceNumberInput.mjs";
|
|
10
|
+
import { NicePasswordInput as Ee } from "../inputs/NicePasswordInput.mjs";
|
|
11
|
+
import { NiceRadioGroup as Oe } from "../inputs/NiceRadioGroup.mjs";
|
|
12
|
+
import { NiceRating as Pe } from "../inputs/NiceRating.mjs";
|
|
13
|
+
import { NiceSelect as Ge } from "../inputs/NiceSelect.mjs";
|
|
14
|
+
import { NiceSlider as De } from "../inputs/NiceSlider.mjs";
|
|
15
|
+
import { NiceTagBox as Me } from "../inputs/NiceTagBox.mjs";
|
|
16
|
+
import { NiceTextArea as je } from "../inputs/NiceTextArea.mjs";
|
|
17
|
+
import { NiceTextInput as P } from "../inputs/NiceTextInput.mjs";
|
|
18
|
+
import { NiceToggle as Be } from "../inputs/NiceToggle.mjs";
|
|
19
|
+
import { NiceUpload as He } from "../inputs/NiceUpload.mjs";
|
|
20
|
+
import { NiceAddress as Ue } from "../pickers/NiceAddress.mjs";
|
|
21
|
+
import { NiceColorPicker as Ve } from "../pickers/NiceColorPicker.mjs";
|
|
22
|
+
import { NiceCountryPicker as We } from "../pickers/NiceCountryPicker.mjs";
|
|
23
|
+
import { NiceDateTimePicker as W } from "../pickers/NiceDateTimePicker.mjs";
|
|
24
|
+
const Ye = [], Je = [
|
|
25
|
+
'input:not([type="hidden"]), select, textarea',
|
|
26
|
+
'[role="combobox"], [role="spinbutton"], [role="slider"], [role="switch"], [role="radiogroup"], [role="listbox"], [role="textbox"]',
|
|
27
|
+
'button, [tabindex]:not([tabindex="-1"])'
|
|
28
|
+
];
|
|
29
|
+
function Qe(x) {
|
|
30
|
+
for (const T of Je) {
|
|
31
|
+
const d = x.querySelector(T);
|
|
32
|
+
if (d)
|
|
33
|
+
return d;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const Xe = ({
|
|
38
|
+
items: x = Ye,
|
|
39
|
+
data: T,
|
|
40
|
+
onFieldChange: d,
|
|
41
|
+
onSubmit: k,
|
|
42
|
+
dataSource: Y,
|
|
43
|
+
recordKey: J,
|
|
44
|
+
columns: S = 1,
|
|
45
|
+
responsiveColumns: A,
|
|
46
|
+
gap: se = 16,
|
|
47
|
+
labelPosition: ie = "top",
|
|
48
|
+
size: v = "md",
|
|
49
|
+
readOnly: g,
|
|
50
|
+
disabled: N,
|
|
51
|
+
className: le,
|
|
52
|
+
style: Q,
|
|
53
|
+
accessMode: ue,
|
|
54
|
+
id: de,
|
|
55
|
+
autoSaveDelay: G,
|
|
56
|
+
onDirtyChange: X,
|
|
57
|
+
showActions: fe,
|
|
58
|
+
submitLabel: me,
|
|
59
|
+
resetLabel: pe,
|
|
60
|
+
onCancel: Z,
|
|
61
|
+
cancelLabel: he,
|
|
62
|
+
"data-testid": be
|
|
50
63
|
}) => {
|
|
51
|
-
const { t:
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
() =>
|
|
55
|
-
[
|
|
56
|
-
), [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
}, [
|
|
64
|
+
const { t: D } = Se(), ve = me ?? D("form.submit", "Submit"), ge = pe ?? D("form.reset", "Reset"), Ne = he ?? D("form.cancel", "Cancel"), M = Ae(ue, de), _e = M === "hidden";
|
|
65
|
+
M === "disabled" && (N = !0), M === "readOnly" && (g = !0);
|
|
66
|
+
const l = Ie(Y ?? null, J), u = !!Y && J != null, s = q(
|
|
67
|
+
() => u ? l.editData : T ?? {},
|
|
68
|
+
[u, l.editData, T]
|
|
69
|
+
), [K] = E(() => ({ ...s })), [_, z] = E([]), y = q(() => Object.keys(s).some((e) => s[e] !== K[e]), [s, K]), ee = U(!1);
|
|
70
|
+
O(() => {
|
|
71
|
+
y !== ee.current && (ee.current = y, X?.(y));
|
|
72
|
+
}, [y, X]);
|
|
73
|
+
const C = U(null), re = h(() => {
|
|
74
|
+
G && (C.current && clearTimeout(C.current), C.current = setTimeout(() => {
|
|
75
|
+
u ? l.save() : k?.(s);
|
|
76
|
+
}, G));
|
|
77
|
+
}, [G, u, l, k, s]), te = h(
|
|
65
78
|
(e, t) => {
|
|
66
|
-
|
|
79
|
+
g || N || (z((n) => [...n, { field: e, prev: s[e] }]), u ? l.set(e, t) : d?.(e, t), re());
|
|
67
80
|
},
|
|
68
|
-
[
|
|
69
|
-
),
|
|
70
|
-
if (
|
|
81
|
+
[u, l, d, g, N, s, re]
|
|
82
|
+
), ye = h(() => {
|
|
83
|
+
if (_.length === 0)
|
|
71
84
|
return;
|
|
72
|
-
const e =
|
|
73
|
-
|
|
74
|
-
}, [
|
|
85
|
+
const e = _[_.length - 1];
|
|
86
|
+
z((t) => t.slice(0, -1)), u ? l.set(e.field, e.prev) : d?.(e.field, e.prev);
|
|
87
|
+
}, [_, u, l, d]), Ce = h(
|
|
75
88
|
(e) => {
|
|
76
|
-
e.preventDefault(),
|
|
89
|
+
e.preventDefault(), C.current && clearTimeout(C.current), u ? l.save() : k?.(s);
|
|
77
90
|
},
|
|
78
|
-
[s,
|
|
79
|
-
),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
[s, k, u, l]
|
|
92
|
+
), I = U(null), L = Le(), R = h((e) => `${L}-f-${e}`, [L]), j = h((e) => `${L}-l-${e}`, [L]);
|
|
93
|
+
O(() => {
|
|
94
|
+
const e = I.current;
|
|
95
|
+
e && e.querySelectorAll(".nice-form__item[data-field]").forEach((t) => {
|
|
96
|
+
const n = t.dataset.field ?? "", m = [...t.children], c = m.find((r) => r.classList.contains("nice-form__label")), a = m.find((r) => r.classList.contains("nice-form__control")), i = a ? Qe(a) : null;
|
|
97
|
+
!c || !i || (i.id || (i.id = R(n)), c.htmlFor !== i.id && (c.htmlFor = i.id), i.getAttribute("aria-labelledby") || i.setAttribute("aria-labelledby", c.id));
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const [qe, B] = E(S);
|
|
101
|
+
O(() => {
|
|
102
|
+
if (!A || !I.current) {
|
|
103
|
+
B(S);
|
|
83
104
|
return;
|
|
84
105
|
}
|
|
85
|
-
const e =
|
|
86
|
-
const
|
|
106
|
+
const e = I.current, t = new ResizeObserver((n) => {
|
|
107
|
+
const m = n[0]?.contentRect.width ?? 0, c = Object.keys(A).map(Number).sort((a, i) => i - a);
|
|
87
108
|
for (const a of c)
|
|
88
|
-
if (
|
|
89
|
-
|
|
109
|
+
if (m >= a) {
|
|
110
|
+
B(A[a]);
|
|
90
111
|
return;
|
|
91
112
|
}
|
|
92
|
-
|
|
113
|
+
B(S);
|
|
93
114
|
});
|
|
94
115
|
return t.observe(e), () => t.disconnect();
|
|
95
|
-
}, [
|
|
96
|
-
const
|
|
97
|
-
() =>
|
|
98
|
-
[
|
|
99
|
-
),
|
|
116
|
+
}, [A, S]);
|
|
117
|
+
const b = q(
|
|
118
|
+
() => x.filter((e) => !(e.visible === !1 || e.hidden || e.visibleWhen && !e.visibleWhen(s))),
|
|
119
|
+
[x, s]
|
|
120
|
+
), ne = q(() => {
|
|
100
121
|
const e = [];
|
|
101
122
|
let t = null;
|
|
102
|
-
for (const n of
|
|
123
|
+
for (const n of b)
|
|
103
124
|
!t || t.name !== n.group ? (t = { name: n.group, items: [n] }, e.push(t)) : t.items.push(n);
|
|
104
125
|
return e;
|
|
105
|
-
}, [
|
|
126
|
+
}, [b]), xe = h(
|
|
106
127
|
(e) => {
|
|
107
|
-
const t = s[e.field] !== void 0 ? s[e.field] : e.defaultValue, n = (r) =>
|
|
128
|
+
const t = s[e.field] !== void 0 ? s[e.field] : e.defaultValue, n = (r) => te(e.field, r);
|
|
108
129
|
if (e.render)
|
|
109
|
-
return e.render(t, n
|
|
110
|
-
|
|
130
|
+
return e.render(t, n, {
|
|
131
|
+
id: R(e.field),
|
|
132
|
+
labelId: j(e.field)
|
|
133
|
+
});
|
|
134
|
+
const m = e.type || "text", c = e.options?.map(
|
|
111
135
|
(r) => typeof r == "string" ? { label: r, value: r } : { label: r.label, value: String(r.value) }
|
|
112
|
-
), a = {
|
|
113
|
-
|
|
136
|
+
), a = {
|
|
137
|
+
size: v,
|
|
138
|
+
disabled: N || e.disabled,
|
|
139
|
+
readOnly: g || e.readOnly
|
|
140
|
+
}, i = e.placeholder;
|
|
141
|
+
switch (m) {
|
|
114
142
|
case "number":
|
|
115
143
|
return /* @__PURE__ */ o(
|
|
116
|
-
|
|
144
|
+
ce,
|
|
117
145
|
{
|
|
118
146
|
...a,
|
|
119
147
|
value: t ?? null,
|
|
@@ -123,7 +151,7 @@ const He = [], Ve = ({
|
|
|
123
151
|
);
|
|
124
152
|
case "currency":
|
|
125
153
|
return /* @__PURE__ */ o(
|
|
126
|
-
|
|
154
|
+
ce,
|
|
127
155
|
{
|
|
128
156
|
...a,
|
|
129
157
|
value: t ?? null,
|
|
@@ -136,10 +164,19 @@ const He = [], Ve = ({
|
|
|
136
164
|
}
|
|
137
165
|
);
|
|
138
166
|
case "textarea":
|
|
139
|
-
return /* @__PURE__ */ o(
|
|
167
|
+
return /* @__PURE__ */ o(
|
|
168
|
+
je,
|
|
169
|
+
{
|
|
170
|
+
...a,
|
|
171
|
+
value: t ?? "",
|
|
172
|
+
onChange: (r) => n(r),
|
|
173
|
+
rows: 3,
|
|
174
|
+
placeholder: i
|
|
175
|
+
}
|
|
176
|
+
);
|
|
140
177
|
case "address":
|
|
141
178
|
return /* @__PURE__ */ o(
|
|
142
|
-
|
|
179
|
+
Ue,
|
|
143
180
|
{
|
|
144
181
|
...a,
|
|
145
182
|
value: t ?? {},
|
|
@@ -150,17 +187,18 @@ const He = [], Ve = ({
|
|
|
150
187
|
);
|
|
151
188
|
case "select":
|
|
152
189
|
return /* @__PURE__ */ o(
|
|
153
|
-
|
|
190
|
+
Ge,
|
|
154
191
|
{
|
|
155
192
|
...a,
|
|
156
193
|
value: t ?? "",
|
|
157
194
|
onChange: (r) => n(r),
|
|
158
|
-
options: c ?? []
|
|
195
|
+
options: c ?? [],
|
|
196
|
+
placeholder: i
|
|
159
197
|
}
|
|
160
198
|
);
|
|
161
199
|
case "autocomplete":
|
|
162
200
|
return /* @__PURE__ */ o(
|
|
163
|
-
|
|
201
|
+
we,
|
|
164
202
|
{
|
|
165
203
|
...a,
|
|
166
204
|
value: t ?? "",
|
|
@@ -170,7 +208,7 @@ const He = [], Ve = ({
|
|
|
170
208
|
);
|
|
171
209
|
case "radio":
|
|
172
210
|
return /* @__PURE__ */ o(
|
|
173
|
-
|
|
211
|
+
Oe,
|
|
174
212
|
{
|
|
175
213
|
...a,
|
|
176
214
|
value: t ?? "",
|
|
@@ -180,7 +218,7 @@ const He = [], Ve = ({
|
|
|
180
218
|
);
|
|
181
219
|
case "checkbox":
|
|
182
220
|
return /* @__PURE__ */ o(
|
|
183
|
-
|
|
221
|
+
Fe,
|
|
184
222
|
{
|
|
185
223
|
...a,
|
|
186
224
|
checked: !!t,
|
|
@@ -189,12 +227,12 @@ const He = [], Ve = ({
|
|
|
189
227
|
}
|
|
190
228
|
);
|
|
191
229
|
case "toggle":
|
|
192
|
-
return /* @__PURE__ */ o(
|
|
230
|
+
return /* @__PURE__ */ o(Be, { ...a, checked: !!t, onChange: (r) => n(r) });
|
|
193
231
|
case "date":
|
|
194
|
-
return /* @__PURE__ */ o(
|
|
232
|
+
return /* @__PURE__ */ o(W, { ...a, value: t ?? "", onChange: (r) => n(r) });
|
|
195
233
|
case "time":
|
|
196
234
|
return /* @__PURE__ */ o(
|
|
197
|
-
|
|
235
|
+
W,
|
|
198
236
|
{
|
|
199
237
|
...a,
|
|
200
238
|
dateFormatPreset: "time",
|
|
@@ -204,7 +242,7 @@ const He = [], Ve = ({
|
|
|
204
242
|
);
|
|
205
243
|
case "datetime":
|
|
206
244
|
return /* @__PURE__ */ o(
|
|
207
|
-
|
|
245
|
+
W,
|
|
208
246
|
{
|
|
209
247
|
...a,
|
|
210
248
|
dateFormatPreset: "datetime-local",
|
|
@@ -214,7 +252,7 @@ const He = [], Ve = ({
|
|
|
214
252
|
);
|
|
215
253
|
case "color":
|
|
216
254
|
return /* @__PURE__ */ o(
|
|
217
|
-
|
|
255
|
+
Ve,
|
|
218
256
|
{
|
|
219
257
|
...a,
|
|
220
258
|
value: t ?? "var(--nice-text-primary, #000000)",
|
|
@@ -223,7 +261,7 @@ const He = [], Ve = ({
|
|
|
223
261
|
);
|
|
224
262
|
case "slider":
|
|
225
263
|
return /* @__PURE__ */ o(
|
|
226
|
-
|
|
264
|
+
De,
|
|
227
265
|
{
|
|
228
266
|
...a,
|
|
229
267
|
value: typeof t == "number" ? t : 0,
|
|
@@ -232,7 +270,7 @@ const He = [], Ve = ({
|
|
|
232
270
|
);
|
|
233
271
|
case "rating":
|
|
234
272
|
return /* @__PURE__ */ o(
|
|
235
|
-
|
|
273
|
+
Pe,
|
|
236
274
|
{
|
|
237
275
|
...a,
|
|
238
276
|
value: typeof t == "number" ? t : 0,
|
|
@@ -241,7 +279,7 @@ const He = [], Ve = ({
|
|
|
241
279
|
);
|
|
242
280
|
case "password":
|
|
243
281
|
return /* @__PURE__ */ o(
|
|
244
|
-
|
|
282
|
+
Ee,
|
|
245
283
|
{
|
|
246
284
|
...a,
|
|
247
285
|
value: t ?? "",
|
|
@@ -252,7 +290,7 @@ const He = [], Ve = ({
|
|
|
252
290
|
case "phone":
|
|
253
291
|
case "tel":
|
|
254
292
|
return /* @__PURE__ */ o(
|
|
255
|
-
|
|
293
|
+
P,
|
|
256
294
|
{
|
|
257
295
|
...a,
|
|
258
296
|
type: "tel",
|
|
@@ -262,10 +300,10 @@ const He = [], Ve = ({
|
|
|
262
300
|
}
|
|
263
301
|
);
|
|
264
302
|
case "country":
|
|
265
|
-
return /* @__PURE__ */ o(
|
|
303
|
+
return /* @__PURE__ */ o(We, { ...a, value: t ?? "", onChange: (r) => n(r) });
|
|
266
304
|
case "tags":
|
|
267
305
|
return /* @__PURE__ */ o(
|
|
268
|
-
|
|
306
|
+
Me,
|
|
269
307
|
{
|
|
270
308
|
...a,
|
|
271
309
|
value: Array.isArray(t) ? t : [],
|
|
@@ -275,7 +313,7 @@ const He = [], Ve = ({
|
|
|
275
313
|
);
|
|
276
314
|
case "masked":
|
|
277
315
|
return /* @__PURE__ */ o(
|
|
278
|
-
|
|
316
|
+
$e,
|
|
279
317
|
{
|
|
280
318
|
...a,
|
|
281
319
|
value: t ?? "",
|
|
@@ -284,21 +322,22 @@ const He = [], Ve = ({
|
|
|
284
322
|
}
|
|
285
323
|
);
|
|
286
324
|
case "file":
|
|
287
|
-
return /* @__PURE__ */ o(
|
|
325
|
+
return /* @__PURE__ */ o(He, { ...a, onFilesSelected: (r) => n(r) });
|
|
288
326
|
case "email":
|
|
289
327
|
return /* @__PURE__ */ o(
|
|
290
|
-
|
|
328
|
+
P,
|
|
291
329
|
{
|
|
292
330
|
...a,
|
|
293
331
|
type: "email",
|
|
294
332
|
value: t ?? "",
|
|
295
333
|
onChange: (r) => n(r),
|
|
296
|
-
required: e.required
|
|
334
|
+
required: e.required,
|
|
335
|
+
placeholder: i
|
|
297
336
|
}
|
|
298
337
|
);
|
|
299
338
|
case "url":
|
|
300
339
|
return /* @__PURE__ */ o(
|
|
301
|
-
|
|
340
|
+
P,
|
|
302
341
|
{
|
|
303
342
|
...a,
|
|
304
343
|
type: "url",
|
|
@@ -309,117 +348,127 @@ const He = [], Ve = ({
|
|
|
309
348
|
);
|
|
310
349
|
default:
|
|
311
350
|
return /* @__PURE__ */ o(
|
|
312
|
-
|
|
351
|
+
P,
|
|
313
352
|
{
|
|
314
353
|
...a,
|
|
315
354
|
value: t ?? "",
|
|
316
355
|
onChange: (r) => n(r),
|
|
317
|
-
required: e.required
|
|
356
|
+
required: e.required,
|
|
357
|
+
placeholder: i
|
|
318
358
|
}
|
|
319
359
|
);
|
|
320
360
|
}
|
|
321
361
|
},
|
|
322
|
-
[s,
|
|
323
|
-
),
|
|
362
|
+
[s, te, N, g, v, R, j]
|
|
363
|
+
), w = (e) => /* @__PURE__ */ p(
|
|
324
364
|
"div",
|
|
325
365
|
{
|
|
326
366
|
className: "nice-form__item",
|
|
367
|
+
"data-field": e.field,
|
|
327
368
|
style: { gridColumn: e.colSpan ? `span ${e.colSpan}` : void 0 },
|
|
328
369
|
children: [
|
|
329
|
-
e.label &&
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
370
|
+
e.label && e.type !== "checkbox" && /* @__PURE__ */ p(
|
|
371
|
+
"label",
|
|
372
|
+
{
|
|
373
|
+
className: "nice-form__label",
|
|
374
|
+
id: j(e.field),
|
|
375
|
+
htmlFor: R(e.field),
|
|
376
|
+
children: [
|
|
377
|
+
e.label,
|
|
378
|
+
e.required && /* @__PURE__ */ o("span", { className: "nice-field__required", children: "*" })
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
/* @__PURE__ */ o("div", { className: "nice-form__control", children: xe(e) }),
|
|
334
383
|
e.hint && /* @__PURE__ */ o("div", { className: "nice-form__hint", children: e.hint })
|
|
335
384
|
]
|
|
336
385
|
},
|
|
337
386
|
e.field
|
|
338
|
-
),
|
|
387
|
+
), F = {
|
|
339
388
|
display: "grid",
|
|
340
|
-
gridTemplateColumns: `repeat(${
|
|
341
|
-
gap:
|
|
342
|
-
},
|
|
389
|
+
gridTemplateColumns: `repeat(${qe}, 1fr)`,
|
|
390
|
+
gap: se
|
|
391
|
+
}, oe = ne.some((e) => e.name != null), f = q(() => {
|
|
343
392
|
const e = /* @__PURE__ */ new Set(), t = [];
|
|
344
|
-
for (const n of
|
|
393
|
+
for (const n of b)
|
|
345
394
|
n.tab && !e.has(n.tab) && (e.add(n.tab), t.push(n.tab));
|
|
346
395
|
return t;
|
|
347
|
-
}, [
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}, [
|
|
351
|
-
const
|
|
396
|
+
}, [b]), $ = f.length > 0, [H, ae] = E("");
|
|
397
|
+
O(() => {
|
|
398
|
+
$ && !f.includes(H) && ae(f[0]);
|
|
399
|
+
}, [$, f, H]);
|
|
400
|
+
const Te = (e) => {
|
|
352
401
|
const t = [];
|
|
353
402
|
let n = null;
|
|
354
403
|
for (const c of e)
|
|
355
404
|
!n || n.name !== c.group ? (n = { name: c.group, items: [c] }, t.push(n)) : n.items.push(c);
|
|
356
|
-
return t.some((c) => c.name != null) ? t.map((c, a) => /* @__PURE__ */
|
|
405
|
+
return t.some((c) => c.name != null) ? t.map((c, a) => /* @__PURE__ */ p(
|
|
357
406
|
"fieldset",
|
|
358
407
|
{
|
|
359
408
|
className: c.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
|
|
360
409
|
children: [
|
|
361
410
|
c.name && /* @__PURE__ */ o("legend", { className: "nice-form__group-title", children: c.name }),
|
|
362
|
-
/* @__PURE__ */ o("div", { style:
|
|
411
|
+
/* @__PURE__ */ o("div", { style: F, children: c.items.map(w) })
|
|
363
412
|
]
|
|
364
413
|
},
|
|
365
414
|
a
|
|
366
|
-
)) : /* @__PURE__ */ o("div", { style:
|
|
367
|
-
},
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
|
|
415
|
+
)) : /* @__PURE__ */ o("div", { style: F, children: e.map(w) });
|
|
416
|
+
}, ke = fe ? /* @__PURE__ */ p("div", { className: "nice-form__actions", children: [
|
|
417
|
+
/* @__PURE__ */ p("div", { className: "nice-form__actions-left", children: [
|
|
418
|
+
Z && /* @__PURE__ */ o(V, { type: "button", variant: "secondary", size: v, onClick: Z, children: Ne }),
|
|
370
419
|
/* @__PURE__ */ o(
|
|
371
|
-
|
|
420
|
+
V,
|
|
372
421
|
{
|
|
373
422
|
type: "button",
|
|
374
423
|
variant: "ghost",
|
|
375
|
-
size:
|
|
376
|
-
onClick:
|
|
377
|
-
disabled:
|
|
378
|
-
children:
|
|
424
|
+
size: v,
|
|
425
|
+
onClick: ye,
|
|
426
|
+
disabled: _.length === 0,
|
|
427
|
+
children: ge
|
|
379
428
|
}
|
|
380
429
|
)
|
|
381
430
|
] }),
|
|
382
|
-
/* @__PURE__ */ o("div", { className: "nice-form__actions-right", children: /* @__PURE__ */ o(
|
|
431
|
+
/* @__PURE__ */ o("div", { className: "nice-form__actions-right", children: /* @__PURE__ */ o(V, { type: "submit", variant: "primary", size: v, children: ve }) })
|
|
383
432
|
] }) : null;
|
|
384
|
-
return
|
|
433
|
+
return _e ? null : /* @__PURE__ */ p(
|
|
385
434
|
"form",
|
|
386
435
|
{
|
|
387
|
-
ref:
|
|
388
|
-
className: `nice-form nice-form--label-${
|
|
389
|
-
style:
|
|
390
|
-
onSubmit:
|
|
391
|
-
"data-testid":
|
|
436
|
+
ref: I,
|
|
437
|
+
className: `nice-form nice-form--label-${ie}${y ? " nice-form--dirty" : ""} ${le || ""}`,
|
|
438
|
+
style: oe || $ ? { ...Q } : { ...F, ...Q },
|
|
439
|
+
onSubmit: Ce,
|
|
440
|
+
"data-testid": be,
|
|
392
441
|
noValidate: !0,
|
|
393
442
|
children: [
|
|
394
|
-
|
|
395
|
-
|
|
443
|
+
$ ? /* @__PURE__ */ o(
|
|
444
|
+
Re,
|
|
396
445
|
{
|
|
397
446
|
className: "nice-form__tabs",
|
|
398
|
-
activeTab:
|
|
399
|
-
onChange:
|
|
400
|
-
tabs:
|
|
447
|
+
activeTab: H || f[0],
|
|
448
|
+
onChange: ae,
|
|
449
|
+
tabs: f.map((e) => ({
|
|
401
450
|
id: e,
|
|
402
451
|
label: e,
|
|
403
|
-
content: /* @__PURE__ */ o("div", { className: "nice-form__tab-panel", children:
|
|
452
|
+
content: /* @__PURE__ */ o("div", { className: "nice-form__tab-panel", children: Te(b.filter((t) => (t.tab ?? f[0]) === e)) })
|
|
404
453
|
}))
|
|
405
454
|
}
|
|
406
|
-
) :
|
|
455
|
+
) : oe ? ne.map((e, t) => /* @__PURE__ */ p(
|
|
407
456
|
"fieldset",
|
|
408
457
|
{
|
|
409
458
|
className: e.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
|
|
410
459
|
children: [
|
|
411
460
|
e.name && /* @__PURE__ */ o("legend", { className: "nice-form__group-title", children: e.name }),
|
|
412
|
-
/* @__PURE__ */ o("div", { style:
|
|
461
|
+
/* @__PURE__ */ o("div", { style: F, children: e.items.map(w) })
|
|
413
462
|
]
|
|
414
463
|
},
|
|
415
464
|
t
|
|
416
|
-
)) :
|
|
417
|
-
|
|
465
|
+
)) : b.map(w),
|
|
466
|
+
ke
|
|
418
467
|
]
|
|
419
468
|
}
|
|
420
469
|
);
|
|
421
470
|
};
|
|
422
|
-
process.env.NODE_ENV !== "production" && (
|
|
471
|
+
process.env.NODE_ENV !== "production" && (Xe.displayName = "NiceForm");
|
|
423
472
|
export {
|
|
424
|
-
|
|
473
|
+
Xe as NiceForm
|
|
425
474
|
};
|