@nivaro/react 0.3.50 → 0.3.52
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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/shared/components/ItemEditForm.js +4801 -4666
- package/dist/shared/components/QueryTable.js +337 -324
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
- package/dist/shared/components/item-edit/FieldRow.js +287 -265
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineTableField.js +491 -466
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
- package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/line-midair.js +76 -70
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +30 -30
- package/dist/shared/components/panels/PipelinePanel.js +956 -901
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +141 -130
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,99 +1,103 @@
|
|
|
1
1
|
import { jsx as n, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import { ExternalLink as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { useDrilldown as
|
|
5
|
-
import { getFieldInterface as
|
|
6
|
-
import { precisionOf as
|
|
7
|
-
import { resolveOptionFilterTokens as
|
|
8
|
-
import { counterOf as
|
|
9
|
-
import { choiceLabel as
|
|
10
|
-
import { Badge as
|
|
2
|
+
import { ExternalLink as qe } from "lucide-react";
|
|
3
|
+
import { memo as Te, useContext as Je, useRef as J, useEffect as oe, useState as He } from "react";
|
|
4
|
+
import { useDrilldown as Ve, useParentDraft as $e, RelationPathDataContext as Ge, useApiFetchConfig as Ke, fieldDrilldownConfig as V } from "../../context.js";
|
|
5
|
+
import { getFieldInterface as We } from "../../lib/field-interfaces.js";
|
|
6
|
+
import { precisionOf as Ye } from "../../lib/format-value.js";
|
|
7
|
+
import { resolveOptionFilterTokens as ne } from "../../lib/option-filter-tokens.js";
|
|
8
|
+
import { counterOf as ze } from "../../lib/placement-behaviour.js";
|
|
9
|
+
import { choiceLabel as Ue } from "../../lib/utils.js";
|
|
10
|
+
import { Badge as Qe } from "../ui/badge.js";
|
|
11
11
|
import { Input as T } from "../ui/input.js";
|
|
12
|
-
import { Label as
|
|
13
|
-
import { NumberDraftInput as
|
|
14
|
-
import { SimpleSelect as
|
|
15
|
-
import { Switch as
|
|
12
|
+
import { Label as Ce } from "../ui/label.js";
|
|
13
|
+
import { NumberDraftInput as Xe } from "../ui/number-draft-input.js";
|
|
14
|
+
import { SimpleSelect as Ze } from "../ui/SimpleSelect.js";
|
|
15
|
+
import { Switch as Oe } from "../ui/switch.js";
|
|
16
16
|
import { Textarea as $ } from "../ui/textarea.js";
|
|
17
|
-
import { CatalogPickerField as
|
|
18
|
-
import { columnMaxLength as
|
|
19
|
-
import { useFieldAffordances as
|
|
20
|
-
import { ProgressField as
|
|
21
|
-
import { FilePickerField as
|
|
17
|
+
import { CatalogPickerField as et } from "./CatalogPickerField.js";
|
|
18
|
+
import { columnMaxLength as me } from "./column-length.js";
|
|
19
|
+
import { useFieldAffordances as tt } from "./FieldAffordances.js";
|
|
20
|
+
import { ProgressField as ie, RatingScaleField as ae, DurationReadOnly as rt, ChecklistReadOnly as ot, ColorPackField as le, PhoneField as se, EmailField as nt, AddressAutocompleteField as it } from "./FieldPack.js";
|
|
21
|
+
import { FilePickerField as at, FileM2MField as lt } from "./FilePickerField.js";
|
|
22
22
|
import { formatDisplayValue as B } from "./GroupSection.js";
|
|
23
|
-
import { parseJson as y, toLocalDatetime as
|
|
24
|
-
import { InlineGridField as
|
|
25
|
-
import { InlineTableField as
|
|
26
|
-
import { checkNumberEntry as
|
|
27
|
-
import { M2MSingleSelectCombobox as
|
|
28
|
-
import { MembershipSetField as
|
|
29
|
-
import { PlanGridField as
|
|
30
|
-
import { smartParseDate as
|
|
31
|
-
import { QuickCreateButton as
|
|
32
|
-
import { RelationCombobox as
|
|
33
|
-
import { RelationGroupedCombobox as
|
|
34
|
-
import { RichTextEditor as
|
|
35
|
-
function
|
|
36
|
-
plugin:
|
|
23
|
+
import { parseJson as y, toLocalDatetime as st } from "./helpers.js";
|
|
24
|
+
import { InlineGridField as ct } from "./InlineGridField.js";
|
|
25
|
+
import { InlineTableField as dt } from "./InlineTableField.js";
|
|
26
|
+
import { checkNumberEntry as ut } from "./line-qty.js";
|
|
27
|
+
import { M2MSingleSelectCombobox as mt, M2MCombobox as pt } from "./M2MCombobox.js";
|
|
28
|
+
import { MembershipSetField as yt } from "./MembershipSetField.js";
|
|
29
|
+
import { PlanGridField as _t } from "./PlanGrid.js";
|
|
30
|
+
import { smartParseDate as ft, CountdownChip as bt, DurationField as xt, FiscalPeriodField as ht, ChecklistField as gt, RepeaterField as vt, RangeSliderField as wt, DateRangeField as Nt, AddressField as kt, maskFor as Ft, applyInputMask as ce } from "./PolishFields.js";
|
|
31
|
+
import { QuickCreateButton as At } from "./QuickCreateButton.js";
|
|
32
|
+
import { RelationCombobox as Rt } from "./RelationCombobox.js";
|
|
33
|
+
import { RelationGroupedCombobox as St } from "./RelationGroupedCombobox.js";
|
|
34
|
+
import { RichTextEditor as jt } from "./RichTextEditor.js";
|
|
35
|
+
function Dt({
|
|
36
|
+
plugin: h,
|
|
37
37
|
props: e
|
|
38
38
|
}) {
|
|
39
|
-
const i = J(null),
|
|
40
|
-
return p.current = e,
|
|
39
|
+
const i = J(null), a = J(void 0), p = J(e);
|
|
40
|
+
return p.current = e, oe(() => {
|
|
41
41
|
if (i.current)
|
|
42
|
-
return i.current.innerHTML = "",
|
|
42
|
+
return i.current.innerHTML = "", a.current = h.mount(i.current, p.current), () => {
|
|
43
43
|
var c, d;
|
|
44
|
-
(d = (c =
|
|
44
|
+
(d = (c = a.current) == null ? void 0 : c.destroy) == null || d.call(c), a.current = void 0;
|
|
45
45
|
};
|
|
46
|
-
}, [
|
|
46
|
+
}, [h]), oe(() => {
|
|
47
47
|
var c, d;
|
|
48
|
-
(d = (c =
|
|
49
|
-
}, [e]), /* @__PURE__ */ n("div", { ref: i, "data-custom-interface":
|
|
48
|
+
(d = (c = a.current) == null ? void 0 : c.update) == null || d.call(c, e);
|
|
49
|
+
}, [e]), /* @__PURE__ */ n("div", { ref: i, "data-custom-interface": h.interface });
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const e =
|
|
51
|
+
function de(h) {
|
|
52
|
+
const e = h.validation_rules, i = Array.isArray(e) ? e : y(typeof e == "string" ? e : null);
|
|
53
53
|
if (!Array.isArray(i)) return {};
|
|
54
|
-
const
|
|
54
|
+
const a = (c) => {
|
|
55
55
|
const d = /* @__PURE__ */ new Date();
|
|
56
56
|
d.setDate(d.getDate() + c);
|
|
57
|
-
const b = (
|
|
57
|
+
const b = (v) => String(v).padStart(2, "0");
|
|
58
58
|
return `${d.getFullYear()}-${b(d.getMonth() + 1)}-${b(d.getDate())}`;
|
|
59
59
|
}, p = {};
|
|
60
60
|
for (const c of i) {
|
|
61
61
|
const d = Number(c == null ? void 0 : c.value);
|
|
62
|
-
Number.isFinite(d) && ((c == null ? void 0 : c.type) === "min_days_from_today" && (p.min =
|
|
62
|
+
Number.isFinite(d) && ((c == null ? void 0 : c.type) === "min_days_from_today" && (p.min = a(d)), (c == null ? void 0 : c.type) === "max_days_from_today" && (p.max = a(d)));
|
|
63
63
|
}
|
|
64
64
|
return p;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
function ue(h) {
|
|
67
|
+
const e = me(h), i = y(h.options), a = Number(i == null ? void 0 : i.max_length);
|
|
68
|
+
return Number.isFinite(a) && a > 0 ? e != null ? Math.min(e, a) : a : e ?? void 0;
|
|
69
|
+
}
|
|
70
|
+
const pr = Te(function({
|
|
67
71
|
field: e,
|
|
68
72
|
value: i,
|
|
69
|
-
onChange:
|
|
73
|
+
onChange: a,
|
|
70
74
|
relations: p,
|
|
71
75
|
collection: c,
|
|
72
76
|
itemId: d,
|
|
73
77
|
cascadeFilter: b,
|
|
74
|
-
requiredParentLabel:
|
|
78
|
+
requiredParentLabel: v,
|
|
75
79
|
narrowedBy: u,
|
|
76
80
|
onCountChange: N,
|
|
77
81
|
displayOnly: G,
|
|
78
82
|
prefillParentId: pe,
|
|
79
83
|
pinnedOption: K
|
|
80
84
|
}) {
|
|
81
|
-
var Q, C, X, Z, O, ee, te, re
|
|
82
|
-
const j =
|
|
85
|
+
var U, Q, C, X, Z, O, ee, te, re;
|
|
86
|
+
const j = Ve(), M = tt(), A = $e(), H = Je(Ge), D = A, _ = (() => {
|
|
83
87
|
try {
|
|
84
|
-
return
|
|
88
|
+
return Ke();
|
|
85
89
|
} catch {
|
|
86
90
|
return null;
|
|
87
91
|
}
|
|
88
|
-
})(), s = e.interface ?? "", W = J(
|
|
92
|
+
})(), s = e.interface ?? "", W = J(We(s)).current;
|
|
89
93
|
if (W)
|
|
90
94
|
return /* @__PURE__ */ n(
|
|
91
|
-
|
|
95
|
+
Dt,
|
|
92
96
|
{
|
|
93
97
|
plugin: W,
|
|
94
98
|
props: {
|
|
95
99
|
value: i,
|
|
96
|
-
onChange:
|
|
100
|
+
onChange: a,
|
|
97
101
|
field: { field: e.field, label: e.label, options: e.options },
|
|
98
102
|
readOnly: !!e.readonly || !!G,
|
|
99
103
|
collection: c,
|
|
@@ -104,10 +108,10 @@ const mr = qe(function({
|
|
|
104
108
|
if (s === "file-image" || s === "file") {
|
|
105
109
|
const r = y(e.options);
|
|
106
110
|
return /* @__PURE__ */ n(
|
|
107
|
-
|
|
111
|
+
at,
|
|
108
112
|
{
|
|
109
113
|
value: i,
|
|
110
|
-
onChange:
|
|
114
|
+
onChange: a,
|
|
111
115
|
disabled: e.readonly,
|
|
112
116
|
allowUpload: (r == null ? void 0 : r.allow_upload) !== !1,
|
|
113
117
|
allowPick: (r == null ? void 0 : r.allow_pick) !== !1
|
|
@@ -122,11 +126,11 @@ const mr = qe(function({
|
|
|
122
126
|
const m = y(e.options);
|
|
123
127
|
if (m != null && m.group_field && (m != null && m.option_field))
|
|
124
128
|
return /* @__PURE__ */ n(
|
|
125
|
-
|
|
129
|
+
St,
|
|
126
130
|
{
|
|
127
131
|
collection: k.one_collection,
|
|
128
132
|
value: i,
|
|
129
|
-
onChange:
|
|
133
|
+
onChange: a,
|
|
130
134
|
groupField: m.group_field,
|
|
131
135
|
optionField: m.option_field,
|
|
132
136
|
disabled: e.readonly,
|
|
@@ -136,24 +140,24 @@ const mr = qe(function({
|
|
|
136
140
|
}
|
|
137
141
|
);
|
|
138
142
|
}
|
|
139
|
-
const r = j && i != null && i !== "" ? V(e) : null, o = y(e.options),
|
|
143
|
+
const r = j && i != null && i !== "" ? V(e) : null, o = y(e.options), l = ne(
|
|
140
144
|
o != null && o.option_filter && typeof o.option_filter == "object" ? o.option_filter : void 0,
|
|
141
145
|
A == null ? void 0 : A.draft,
|
|
142
146
|
d
|
|
143
|
-
), t =
|
|
144
|
-
|
|
147
|
+
), t = l ? b ? { _and: [l, b] } : l : b, f = /* @__PURE__ */ n(
|
|
148
|
+
Rt,
|
|
145
149
|
{
|
|
146
150
|
fieldKey: e.field,
|
|
147
|
-
missPlacement: (
|
|
151
|
+
missPlacement: (M == null ? void 0 : M.layoutId) != null && M.pickerMisses !== !1 ? { layoutId: Number(M.layoutId), collection: c, field: e.field } : null,
|
|
148
152
|
collection: k.one_collection,
|
|
149
153
|
value: i,
|
|
150
|
-
onChange:
|
|
154
|
+
onChange: a,
|
|
151
155
|
disabled: e.readonly,
|
|
152
156
|
placeholder: e.placeholder ?? void 0,
|
|
153
157
|
extraFilter: t,
|
|
154
158
|
autoSelectSingle: (o == null ? void 0 : o.auto_select_single) === !0,
|
|
155
159
|
optionSort: typeof (o == null ? void 0 : o.option_sort) == "string" && o.option_sort ? o.option_sort : void 0,
|
|
156
|
-
requiredParent:
|
|
160
|
+
requiredParent: v ?? void 0,
|
|
157
161
|
narrowedBy: u,
|
|
158
162
|
pinned: K,
|
|
159
163
|
facets: Array.isArray(o == null ? void 0 : o.picker_facets) ? o.picker_facets.map((m) => ({
|
|
@@ -162,18 +166,18 @@ const mr = qe(function({
|
|
|
162
166
|
// _and clause pruning) as option_filter, resolved from the same
|
|
163
167
|
// parent draft — keeps facet option lists in sync with the main
|
|
164
168
|
// option query's eligibility clauses.
|
|
165
|
-
filter: m.filter && typeof m.filter == "object" ?
|
|
169
|
+
filter: m.filter && typeof m.filter == "object" ? ne(m.filter, A == null ? void 0 : A.draft, d) : void 0
|
|
166
170
|
})) : void 0
|
|
167
171
|
}
|
|
168
|
-
),
|
|
169
|
-
return !r && !
|
|
172
|
+
), w = o != null && o.quick_create && Array.isArray(o.quick_create.fields) && !e.readonly ? o.quick_create : null;
|
|
173
|
+
return !r && !w ? f : /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
|
|
170
174
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: f }),
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
w && /* @__PURE__ */ n(
|
|
176
|
+
At,
|
|
173
177
|
{
|
|
174
178
|
targetCollection: k.one_collection,
|
|
175
|
-
config:
|
|
176
|
-
onCreated: (m) =>
|
|
179
|
+
config: w,
|
|
180
|
+
onCreated: (m) => a(m)
|
|
177
181
|
}
|
|
178
182
|
),
|
|
179
183
|
r && /* @__PURE__ */ n(
|
|
@@ -188,60 +192,60 @@ const mr = qe(function({
|
|
|
188
192
|
width: r.width
|
|
189
193
|
}),
|
|
190
194
|
className: "shrink-0 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-nvr-cyan dark:hover:bg-slate-800",
|
|
191
|
-
children: /* @__PURE__ */ n(
|
|
195
|
+
children: /* @__PURE__ */ n(qe, { className: "h-3.5 w-3.5" })
|
|
192
196
|
}
|
|
193
197
|
)
|
|
194
198
|
] });
|
|
195
199
|
}
|
|
196
200
|
const L = Y && !k ? (() => {
|
|
197
201
|
const r = p.find(
|
|
198
|
-
(
|
|
202
|
+
(l) => l.one_collection === c && (l.one_field === e.field || l.junction_field != null && l.many_collection === e.field)
|
|
199
203
|
);
|
|
200
204
|
if (!r) return null;
|
|
201
205
|
if (r.junction_field) return r;
|
|
202
206
|
const o = p.find(
|
|
203
|
-
(
|
|
207
|
+
(l) => l.many_collection === r.many_collection && l.id !== r.id
|
|
204
208
|
);
|
|
205
209
|
return o ? { ...r, junction_field: o.many_field } : null;
|
|
206
210
|
})() : null;
|
|
207
211
|
if (L) {
|
|
208
212
|
if (s === "files-m2m") {
|
|
209
|
-
const
|
|
213
|
+
const l = y(e.options);
|
|
210
214
|
return /* @__PURE__ */ n(
|
|
211
|
-
|
|
215
|
+
lt,
|
|
212
216
|
{
|
|
213
217
|
relation: L,
|
|
214
218
|
parentId: d,
|
|
215
219
|
allRelations: p,
|
|
216
220
|
disabled: e.readonly,
|
|
217
|
-
allowUpload: (
|
|
218
|
-
allowPick: (
|
|
219
|
-
pendingSave: (
|
|
221
|
+
allowUpload: (l == null ? void 0 : l.allow_upload) !== !1,
|
|
222
|
+
allowPick: (l == null ? void 0 : l.allow_pick) !== !1,
|
|
223
|
+
pendingSave: (l == null ? void 0 : l.pending_save) === !0
|
|
220
224
|
}
|
|
221
225
|
);
|
|
222
226
|
}
|
|
223
227
|
const r = y(e.options), o = typeof (r == null ? void 0 : r.option_sort) == "string" && r.option_sort ? r.option_sort : void 0;
|
|
224
228
|
return (r == null ? void 0 : r.max_values) === 1 ? /* @__PURE__ */ n(
|
|
225
|
-
|
|
229
|
+
mt,
|
|
226
230
|
{
|
|
227
231
|
relation: L,
|
|
228
232
|
parentId: d,
|
|
229
233
|
allRelations: p,
|
|
230
234
|
extraFilter: b,
|
|
231
235
|
optionSort: o,
|
|
232
|
-
requiredParent:
|
|
236
|
+
requiredParent: v ?? void 0,
|
|
233
237
|
onCountChange: N,
|
|
234
238
|
readOnly: G
|
|
235
239
|
}
|
|
236
240
|
) : /* @__PURE__ */ n(
|
|
237
|
-
|
|
241
|
+
pt,
|
|
238
242
|
{
|
|
239
243
|
relation: L,
|
|
240
244
|
parentId: d,
|
|
241
245
|
allRelations: p,
|
|
242
246
|
extraFilter: b,
|
|
243
247
|
optionSort: o,
|
|
244
|
-
requiredParent:
|
|
248
|
+
requiredParent: v ?? void 0,
|
|
245
249
|
onCountChange: N,
|
|
246
250
|
drilldown: V(e)
|
|
247
251
|
}
|
|
@@ -249,8 +253,8 @@ const mr = qe(function({
|
|
|
249
253
|
}
|
|
250
254
|
if (e.readonly && s !== "inline-table") {
|
|
251
255
|
if (s === "relation-path" && i != null && i !== "" && j) {
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
256
|
+
const l = V(e), t = H == null ? void 0 : H[e.field];
|
|
257
|
+
if (l && (t != null && t.target_collection) && t.ids.length > 0)
|
|
254
258
|
return /* @__PURE__ */ n("div", { className: "min-h-[36px] flex items-center", children: /* @__PURE__ */ n(
|
|
255
259
|
"button",
|
|
256
260
|
{
|
|
@@ -258,8 +262,8 @@ const mr = qe(function({
|
|
|
258
262
|
onClick: () => j.open({
|
|
259
263
|
collection: t.target_collection,
|
|
260
264
|
itemId: t.ids[0],
|
|
261
|
-
layoutId:
|
|
262
|
-
width:
|
|
265
|
+
layoutId: l.layout_id,
|
|
266
|
+
width: l.width,
|
|
263
267
|
title: String(i)
|
|
264
268
|
}),
|
|
265
269
|
className: "text-left text-sm text-slate-700 underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
@@ -267,9 +271,9 @@ const mr = qe(function({
|
|
|
267
271
|
}
|
|
268
272
|
) });
|
|
269
273
|
}
|
|
270
|
-
const r = (
|
|
274
|
+
const r = (U = e.options) == null ? void 0 : U.__live_delta;
|
|
271
275
|
if (r && Number.isFinite(Number(r.live))) {
|
|
272
|
-
const
|
|
276
|
+
const l = Number(r.original), t = Number(r.live) - (Number.isFinite(l) ? l : 0), f = Math.round(t * 100) / 100;
|
|
273
277
|
return /* @__PURE__ */ x("div", { className: "flex min-h-[36px] flex-wrap items-center gap-x-2 gap-y-0.5", children: [
|
|
274
278
|
/* @__PURE__ */ n("span", { className: "text-sm text-slate-400 line-through tabular-nums", children: B(r.original, e) }),
|
|
275
279
|
/* @__PURE__ */ n("span", { className: "text-slate-300", "aria-hidden": !0, children: "→" }),
|
|
@@ -286,37 +290,37 @@ const mr = qe(function({
|
|
|
286
290
|
)
|
|
287
291
|
] });
|
|
288
292
|
}
|
|
289
|
-
if (s === "progress") return /* @__PURE__ */ n(
|
|
293
|
+
if (s === "progress") return /* @__PURE__ */ n(ie, { value: i, onChange: a, readOnly: !0 });
|
|
290
294
|
if (s === "rating") {
|
|
291
|
-
const
|
|
292
|
-
return /* @__PURE__ */ n(
|
|
295
|
+
const l = (Q = y(e.options)) == null ? void 0 : Q.rating_max;
|
|
296
|
+
return /* @__PURE__ */ n(ae, { value: i, onChange: a, max: l ?? 5, readOnly: !0 });
|
|
293
297
|
}
|
|
294
|
-
if (s === "duration") return /* @__PURE__ */ n(
|
|
295
|
-
if (s === "checklist") return /* @__PURE__ */ n(
|
|
298
|
+
if (s === "duration") return /* @__PURE__ */ n(rt, { value: i });
|
|
299
|
+
if (s === "checklist") return /* @__PURE__ */ n(ot, { value: i });
|
|
296
300
|
if (s === "color")
|
|
297
|
-
return /* @__PURE__ */ n(
|
|
298
|
-
if (s === "phone") return /* @__PURE__ */ n(
|
|
299
|
-
const o = i == null ? /* @__PURE__ */ n("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof i == "boolean" ? /* @__PURE__ */ n(
|
|
301
|
+
return /* @__PURE__ */ n(le, { field: e, value: i, onChange: a, readOnly: !0 });
|
|
302
|
+
if (s === "phone") return /* @__PURE__ */ n(se, { value: i, onChange: a, readOnly: !0 });
|
|
303
|
+
const o = i == null ? /* @__PURE__ */ n("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof i == "boolean" ? /* @__PURE__ */ n(Qe, { variant: i ? "default" : "secondary", children: i ? "Yes" : "No" }) : /* @__PURE__ */ n("span", { className: "text-sm tabular-nums", children: B(i, e) });
|
|
300
304
|
return /* @__PURE__ */ n("div", { className: "min-h-[36px] flex items-center", children: o });
|
|
301
305
|
}
|
|
302
|
-
const
|
|
306
|
+
const g = i == null ? "" : String(i);
|
|
303
307
|
if (e.type === "boolean")
|
|
304
308
|
return /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
|
|
305
|
-
/* @__PURE__ */ n(
|
|
306
|
-
/* @__PURE__ */ n(
|
|
309
|
+
/* @__PURE__ */ n(Oe, { checked: !!i, onCheckedChange: a }),
|
|
310
|
+
/* @__PURE__ */ n(Ce, { className: "font-normal text-sm", children: i ? "Yes" : "No" })
|
|
307
311
|
] });
|
|
308
312
|
if (e.type === "datetime" || s === "datetime") {
|
|
309
313
|
const r = y(e.options);
|
|
310
314
|
if ((r == null ? void 0 : r.date_mode) === "date") {
|
|
311
|
-
const o =
|
|
315
|
+
const o = de(e);
|
|
312
316
|
return /* @__PURE__ */ n(
|
|
313
317
|
T,
|
|
314
318
|
{
|
|
315
319
|
type: "date",
|
|
316
|
-
value:
|
|
320
|
+
value: g.slice(0, 10),
|
|
317
321
|
min: o.min,
|
|
318
322
|
max: o.max,
|
|
319
|
-
onChange: (
|
|
323
|
+
onChange: (l) => a(l.target.value || null),
|
|
320
324
|
placeholder: e.placeholder ?? void 0
|
|
321
325
|
}
|
|
322
326
|
);
|
|
@@ -325,32 +329,32 @@ const mr = qe(function({
|
|
|
325
329
|
T,
|
|
326
330
|
{
|
|
327
331
|
type: "datetime-local",
|
|
328
|
-
value:
|
|
329
|
-
onChange: (o) =>
|
|
332
|
+
value: st(i),
|
|
333
|
+
onChange: (o) => a(o.target.value ? new Date(o.target.value).toISOString() : null),
|
|
330
334
|
placeholder: e.placeholder ?? void 0
|
|
331
335
|
}
|
|
332
336
|
);
|
|
333
337
|
}
|
|
334
338
|
if (e.type === "date" || s === "date") {
|
|
335
|
-
const r = ((
|
|
339
|
+
const r = ((C = y(e.options)) == null ? void 0 : C.countdown) === !0, o = de(e);
|
|
336
340
|
return /* @__PURE__ */ x("div", { className: "flex items-center", children: [
|
|
337
341
|
/* @__PURE__ */ n(
|
|
338
342
|
T,
|
|
339
343
|
{
|
|
340
344
|
type: "date",
|
|
341
|
-
value:
|
|
345
|
+
value: g.slice(0, 10),
|
|
342
346
|
min: o.min,
|
|
343
347
|
max: o.max,
|
|
344
|
-
onChange: (
|
|
345
|
-
onPaste: (
|
|
346
|
-
const t =
|
|
347
|
-
t && (
|
|
348
|
+
onChange: (l) => a(l.target.value || null),
|
|
349
|
+
onPaste: (l) => {
|
|
350
|
+
const t = ft(l.clipboardData.getData("text"));
|
|
351
|
+
t && (l.preventDefault(), a(t));
|
|
348
352
|
},
|
|
349
353
|
placeholder: e.placeholder ?? void 0,
|
|
350
354
|
className: "flex-1"
|
|
351
355
|
}
|
|
352
356
|
),
|
|
353
|
-
r && /* @__PURE__ */ n(
|
|
357
|
+
r && /* @__PURE__ */ n(bt, { value: g.slice(0, 10) })
|
|
354
358
|
] });
|
|
355
359
|
}
|
|
356
360
|
if ([
|
|
@@ -371,22 +375,22 @@ const mr = qe(function({
|
|
|
371
375
|
].includes(e.type)) {
|
|
372
376
|
const r = ["integer", "bigInteger", "int", "bigint", "smallint", "tinyint"].includes(
|
|
373
377
|
e.type
|
|
374
|
-
), o = r ? 0 :
|
|
378
|
+
), o = r ? 0 : Ye(e.options, -1), l = r ? "1" : o >= 0 ? String(10 ** -o) : "any", t = ut(i, { type: e.type, label: e.label || "Value" }), f = t.ok ? null : t.message;
|
|
375
379
|
return /* @__PURE__ */ x("div", { children: [
|
|
376
380
|
/* @__PURE__ */ n(
|
|
377
|
-
|
|
381
|
+
Xe,
|
|
378
382
|
{
|
|
379
383
|
type: "number",
|
|
380
384
|
"aria-invalid": f ? !0 : void 0,
|
|
381
|
-
step:
|
|
385
|
+
step: l,
|
|
382
386
|
value: i,
|
|
383
|
-
onValue:
|
|
384
|
-
onBlur: (
|
|
385
|
-
if (o < 0 ||
|
|
386
|
-
const m = Number(
|
|
387
|
+
onValue: a,
|
|
388
|
+
onBlur: (w) => {
|
|
389
|
+
if (o < 0 || w.target.value === "") return;
|
|
390
|
+
const m = Number(w.target.value);
|
|
387
391
|
if (!Number.isFinite(m)) return;
|
|
388
392
|
const E = Number(m.toFixed(o));
|
|
389
|
-
E !== m &&
|
|
393
|
+
E !== m && a(E);
|
|
390
394
|
},
|
|
391
395
|
placeholder: e.placeholder ?? void 0
|
|
392
396
|
}
|
|
@@ -400,12 +404,12 @@ const mr = qe(function({
|
|
|
400
404
|
{
|
|
401
405
|
className: "font-mono text-xs",
|
|
402
406
|
rows: 4,
|
|
403
|
-
value: typeof i == "object" ? JSON.stringify(i, null, 2) :
|
|
407
|
+
value: typeof i == "object" ? JSON.stringify(i, null, 2) : g,
|
|
404
408
|
onChange: (r) => {
|
|
405
409
|
try {
|
|
406
|
-
|
|
410
|
+
a(JSON.parse(r.target.value));
|
|
407
411
|
} catch {
|
|
408
|
-
|
|
412
|
+
a(r.target.value);
|
|
409
413
|
}
|
|
410
414
|
},
|
|
411
415
|
placeholder: e.placeholder ?? void 0
|
|
@@ -416,9 +420,9 @@ const mr = qe(function({
|
|
|
416
420
|
$,
|
|
417
421
|
{
|
|
418
422
|
rows: 4,
|
|
419
|
-
maxLength:
|
|
420
|
-
value:
|
|
421
|
-
onChange: (r) =>
|
|
423
|
+
maxLength: ue(e),
|
|
424
|
+
value: g,
|
|
425
|
+
onChange: (r) => a(r.target.value),
|
|
422
426
|
placeholder: e.placeholder ?? void 0
|
|
423
427
|
}
|
|
424
428
|
);
|
|
@@ -427,21 +431,21 @@ const mr = qe(function({
|
|
|
427
431
|
$,
|
|
428
432
|
{
|
|
429
433
|
rows: 6,
|
|
430
|
-
value:
|
|
431
|
-
onChange: (r) =>
|
|
434
|
+
value: g,
|
|
435
|
+
onChange: (r) => a(r.target.value),
|
|
432
436
|
placeholder: e.placeholder ?? void 0,
|
|
433
437
|
className: "font-mono text-sm"
|
|
434
438
|
}
|
|
435
439
|
);
|
|
436
440
|
if (s === "input-rich-text-html" || s === "rich_text" || e.type === "rich_text" || s === "extension-editorjs")
|
|
437
441
|
return /* @__PURE__ */ n(
|
|
438
|
-
|
|
442
|
+
jt,
|
|
439
443
|
{
|
|
440
|
-
value:
|
|
441
|
-
onChange:
|
|
444
|
+
value: g,
|
|
445
|
+
onChange: a,
|
|
442
446
|
placeholder: e.placeholder ?? void 0,
|
|
443
447
|
disabled: e.readonly,
|
|
444
|
-
pastePlain: ((
|
|
448
|
+
pastePlain: ((X = y(e.options)) == null ? void 0 : X.paste_plain) === !0
|
|
445
449
|
}
|
|
446
450
|
);
|
|
447
451
|
if (s === "inline-grid" || s === "relation-list" || s === "list-o2m") {
|
|
@@ -449,8 +453,8 @@ const mr = qe(function({
|
|
|
449
453
|
(o) => o.one_collection === c && !o.junction_field && (o.one_field === e.field || o.many_collection === e.field)
|
|
450
454
|
);
|
|
451
455
|
if (r) {
|
|
452
|
-
const o = r.many_collection ?? null,
|
|
453
|
-
if (o &&
|
|
456
|
+
const o = r.many_collection ?? null, l = r.many_field ?? null;
|
|
457
|
+
if (o && l && d) {
|
|
454
458
|
const f = (typeof e.options == "string" ? (() => {
|
|
455
459
|
try {
|
|
456
460
|
return JSON.parse(e.options);
|
|
@@ -459,10 +463,10 @@ const mr = qe(function({
|
|
|
459
463
|
}
|
|
460
464
|
})() : e.options ?? {}).layout_slug ?? null;
|
|
461
465
|
return /* @__PURE__ */ n(
|
|
462
|
-
|
|
466
|
+
ct,
|
|
463
467
|
{
|
|
464
468
|
relatedCollection: o,
|
|
465
|
-
manyField:
|
|
469
|
+
manyField: l,
|
|
466
470
|
parentId: d,
|
|
467
471
|
layoutSlug: f,
|
|
468
472
|
parentFieldKey: e.field,
|
|
@@ -478,21 +482,21 @@ const mr = qe(function({
|
|
|
478
482
|
(o) => o.one_collection === c && !o.junction_field && (o.one_field === e.field || o.many_collection === e.field)
|
|
479
483
|
);
|
|
480
484
|
if (r) {
|
|
481
|
-
const o = r.many_collection ?? null,
|
|
482
|
-
if (o &&
|
|
485
|
+
const o = r.many_collection ?? null, l = r.many_field ?? null;
|
|
486
|
+
if (o && l && d) {
|
|
483
487
|
const t = typeof e.options == "string" ? (() => {
|
|
484
488
|
try {
|
|
485
489
|
return JSON.parse(e.options);
|
|
486
490
|
} catch {
|
|
487
491
|
return {};
|
|
488
492
|
}
|
|
489
|
-
})() : e.options ?? {}, f = t.layout_id ?? null,
|
|
493
|
+
})() : e.options ?? {}, f = t.layout_id ?? null, w = !!t.show_row_revisions, m = !!t.row_comments, E = t.allow_revision_restore !== !1, _e = t.save_mode ?? "immediate", fe = !!t.show_line_numbers, be = t.enable_reorder !== !1, xe = Array.isArray(t.parent_cascades) ? t.parent_cascades : void 0, he = Array.isArray(t.row_rules) ? t.row_rules : void 0, ge = Array.isArray(t.column_presets) ? t.column_presets : void 0, ve = typeof t.default_preset == "string" && t.default_preset ? t.default_preset : void 0, we = Array.isArray(t.drawer_relations) ? t.drawer_relations : void 0, Ne = Array.isArray(t.parent_context_fields) ? t.parent_context_fields : void 0, ke = Array.isArray(t.unique_by) ? t.unique_by : void 0, Fe = typeof t.sort_field == "string" && t.sort_field ? t.sort_field : void 0, Ae = t.sort_dir === "desc" ? "desc" : "asc", Re = t.freeze_first_column === !0, Se = typeof t.section_group_by == "string" && t.section_group_by.includes(".") ? t.section_group_by : void 0, je = t.row_filter && typeof t.row_filter == "object" ? t.row_filter : void 0, De = t.allocate_drawer && typeof t.allocate_drawer == "object" ? t.allocate_drawer : void 0, Ie = t.auto_allocate && typeof t.auto_allocate == "object" ? t.auto_allocate : void 0, Me = Array.isArray(t.row_bulk_actions) ? t.row_bulk_actions : void 0, Pe = typeof t.upload_template == "string" && t.upload_template ? t.upload_template : void 0, Be = t.row_match_panel ?? void 0, Le = t.row_defaults && typeof t.row_defaults == "object" ? t.row_defaults : void 0, Ee = t.submission_errors === !0 ? {} : t.submission_errors && typeof t.submission_errors == "object" ? t.submission_errors : void 0, R = t.membership_set;
|
|
490
494
|
if (R != null && R.key_field && (R != null && R.value_field))
|
|
491
495
|
return /* @__PURE__ */ n(
|
|
492
|
-
|
|
496
|
+
yt,
|
|
493
497
|
{
|
|
494
498
|
relatedCollection: o,
|
|
495
|
-
manyField:
|
|
499
|
+
manyField: l,
|
|
496
500
|
parentId: d,
|
|
497
501
|
config: R,
|
|
498
502
|
readOnly: e.readonly
|
|
@@ -501,10 +505,10 @@ const mr = qe(function({
|
|
|
501
505
|
const S = t.catalog_mode;
|
|
502
506
|
if (S != null && S.item_field && (S != null && S.section_by))
|
|
503
507
|
return /* @__PURE__ */ n(
|
|
504
|
-
|
|
508
|
+
et,
|
|
505
509
|
{
|
|
506
510
|
relatedCollection: o,
|
|
507
|
-
manyField:
|
|
511
|
+
manyField: l,
|
|
508
512
|
parentId: d,
|
|
509
513
|
parentCollection: c,
|
|
510
514
|
config: S,
|
|
@@ -515,10 +519,10 @@ const mr = qe(function({
|
|
|
515
519
|
if (F != null && F.key_field && (F != null && F.category_field) && Array.isArray(F.value_fields)) {
|
|
516
520
|
const q = t.spread_remaining;
|
|
517
521
|
return /* @__PURE__ */ n(
|
|
518
|
-
|
|
522
|
+
_t,
|
|
519
523
|
{
|
|
520
524
|
relatedCollection: o,
|
|
521
|
-
manyField:
|
|
525
|
+
manyField: l,
|
|
522
526
|
parentId: d,
|
|
523
527
|
config: F,
|
|
524
528
|
compareSeries: t.compare_series && typeof t.compare_series == "object" && typeof t.compare_series.endpoint == "string" ? t.compare_series : null,
|
|
@@ -526,43 +530,43 @@ const mr = qe(function({
|
|
|
526
530
|
sumCap: t.sum_cap && typeof t.sum_cap == "object" ? t.sum_cap : null,
|
|
527
531
|
remaining: typeof (q == null ? void 0 : q.remaining) == "string" ? q.remaining : null,
|
|
528
532
|
readOnly: e.readonly,
|
|
529
|
-
showHistory:
|
|
533
|
+
showHistory: w,
|
|
530
534
|
emptyLabel: e.label || void 0
|
|
531
535
|
}
|
|
532
536
|
);
|
|
533
537
|
}
|
|
534
538
|
return /* @__PURE__ */ n(
|
|
535
|
-
|
|
539
|
+
dt,
|
|
536
540
|
{
|
|
537
541
|
relatedCollection: o,
|
|
538
|
-
manyField:
|
|
542
|
+
manyField: l,
|
|
539
543
|
parentId: d,
|
|
540
544
|
parentCollection: c,
|
|
541
545
|
layoutId: f,
|
|
542
|
-
showRowRevisions:
|
|
546
|
+
showRowRevisions: w,
|
|
543
547
|
rowComments: m,
|
|
544
548
|
allowRevisionRestore: E,
|
|
545
|
-
saveMode:
|
|
546
|
-
showLineNumbers:
|
|
547
|
-
enableReorder:
|
|
548
|
-
parentCascades:
|
|
549
|
-
rowRules:
|
|
550
|
-
columnPresets:
|
|
551
|
-
defaultPreset:
|
|
552
|
-
drawerRelations:
|
|
553
|
-
parentContextFields:
|
|
554
|
-
uniqueBy:
|
|
555
|
-
sortField:
|
|
556
|
-
sortDir:
|
|
557
|
-
sectionGroupBy:
|
|
558
|
-
freezeFirstColumn:
|
|
559
|
-
rowFilter:
|
|
560
|
-
rowDefaults:
|
|
561
|
-
allocateDrawer:
|
|
562
|
-
autoAllocate:
|
|
563
|
-
rowBulkActions:
|
|
549
|
+
saveMode: _e,
|
|
550
|
+
showLineNumbers: fe,
|
|
551
|
+
enableReorder: be,
|
|
552
|
+
parentCascades: xe,
|
|
553
|
+
rowRules: he,
|
|
554
|
+
columnPresets: ge,
|
|
555
|
+
defaultPreset: ve,
|
|
556
|
+
drawerRelations: we,
|
|
557
|
+
parentContextFields: Ne,
|
|
558
|
+
uniqueBy: ke,
|
|
559
|
+
sortField: Fe,
|
|
560
|
+
sortDir: Ae,
|
|
561
|
+
sectionGroupBy: Se,
|
|
562
|
+
freezeFirstColumn: Re,
|
|
563
|
+
rowFilter: je,
|
|
564
|
+
rowDefaults: Le,
|
|
565
|
+
allocateDrawer: De,
|
|
566
|
+
autoAllocate: Ie,
|
|
567
|
+
rowBulkActions: Me,
|
|
564
568
|
uploadTemplate: Pe,
|
|
565
|
-
rowMatchPanel:
|
|
569
|
+
rowMatchPanel: Be,
|
|
566
570
|
lineSla: t.line_sla ?? null,
|
|
567
571
|
editorMode: t.editor_mode === "split" ? "split" : "drawer",
|
|
568
572
|
rowLints: Array.isArray(t.row_lints) ? t.row_lints : null,
|
|
@@ -570,7 +574,7 @@ const mr = qe(function({
|
|
|
570
574
|
sumCap: t.sum_cap && typeof t.sum_cap == "object" ? t.sum_cap : null,
|
|
571
575
|
spreadRemaining: t.spread_remaining && typeof t.spread_remaining == "object" ? t.spread_remaining : null,
|
|
572
576
|
compareSeries: t.compare_series && typeof t.compare_series == "object" && typeof t.compare_series.endpoint == "string" ? t.compare_series : null,
|
|
573
|
-
submissionErrors:
|
|
577
|
+
submissionErrors: Ee,
|
|
574
578
|
prefillParentId: pe,
|
|
575
579
|
parentFieldKey: e.field,
|
|
576
580
|
readOnly: e.readonly,
|
|
@@ -581,71 +585,71 @@ const mr = qe(function({
|
|
|
581
585
|
}
|
|
582
586
|
return /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 py-1", children: "Inline table editing not available in embedded form" });
|
|
583
587
|
}
|
|
584
|
-
if (s === "color") return /* @__PURE__ */ n(
|
|
588
|
+
if (s === "color") return /* @__PURE__ */ n(le, { field: e, value: i, onChange: a });
|
|
585
589
|
if (s === "rating") {
|
|
586
|
-
const r = (
|
|
587
|
-
return /* @__PURE__ */ n(
|
|
590
|
+
const r = (Z = y(e.options)) == null ? void 0 : Z.rating_max;
|
|
591
|
+
return /* @__PURE__ */ n(ae, { value: i, onChange: a, max: r ?? 5 });
|
|
588
592
|
}
|
|
589
|
-
if (s === "progress") return /* @__PURE__ */ n(
|
|
593
|
+
if (s === "progress") return /* @__PURE__ */ n(ie, { value: i, onChange: a });
|
|
590
594
|
if (s === "phone")
|
|
591
|
-
return /* @__PURE__ */ n(
|
|
595
|
+
return /* @__PURE__ */ n(se, { value: i, onChange: a, placeholder: e.placeholder ?? void 0 });
|
|
592
596
|
if (s === "email")
|
|
593
|
-
return /* @__PURE__ */ n(
|
|
597
|
+
return /* @__PURE__ */ n(nt, { value: i, onChange: a, placeholder: e.placeholder ?? void 0 });
|
|
594
598
|
if (s === "address-autocomplete")
|
|
595
599
|
return /* @__PURE__ */ n(
|
|
596
|
-
|
|
600
|
+
it,
|
|
597
601
|
{
|
|
598
602
|
field: e,
|
|
599
603
|
value: i,
|
|
600
|
-
onChange:
|
|
604
|
+
onChange: a,
|
|
601
605
|
apiBase: _ == null ? void 0 : _.apiBase,
|
|
602
606
|
authHeaders: _ == null ? void 0 : _.authHeaders,
|
|
603
607
|
credentials: _ == null ? void 0 : _.credentials,
|
|
604
608
|
placeholder: e.placeholder ?? void 0
|
|
605
609
|
}
|
|
606
610
|
);
|
|
607
|
-
if (s === "duration") return /* @__PURE__ */ n(
|
|
608
|
-
if (s === "fiscal_period") return /* @__PURE__ */ n(
|
|
609
|
-
if (s === "checklist") return /* @__PURE__ */ n(
|
|
611
|
+
if (s === "duration") return /* @__PURE__ */ n(xt, { value: i, onChange: a });
|
|
612
|
+
if (s === "fiscal_period") return /* @__PURE__ */ n(ht, { value: i, onChange: a });
|
|
613
|
+
if (s === "checklist") return /* @__PURE__ */ n(gt, { value: i, onChange: a });
|
|
610
614
|
if (s === "repeater" || e.repeater_schema && e.type === "json")
|
|
611
|
-
return /* @__PURE__ */ n(
|
|
615
|
+
return /* @__PURE__ */ n(vt, { field: e, value: i, onChange: a });
|
|
612
616
|
if (s === "range_slider") {
|
|
613
|
-
const r = (
|
|
617
|
+
const r = (O = y(e.options)) == null ? void 0 : O.range_end_field;
|
|
614
618
|
return /* @__PURE__ */ n(
|
|
615
|
-
|
|
619
|
+
wt,
|
|
616
620
|
{
|
|
617
621
|
field: e,
|
|
618
622
|
value: i,
|
|
619
|
-
onChange:
|
|
620
|
-
pairedValue: r ? (
|
|
623
|
+
onChange: a,
|
|
624
|
+
pairedValue: r ? (ee = D == null ? void 0 : D.draft) == null ? void 0 : ee[r] : void 0
|
|
621
625
|
}
|
|
622
626
|
);
|
|
623
627
|
}
|
|
624
628
|
if (s === "date_range") {
|
|
625
|
-
const r = (
|
|
629
|
+
const r = (te = y(e.options)) == null ? void 0 : te.range_end_field;
|
|
626
630
|
return /* @__PURE__ */ n(
|
|
627
|
-
|
|
631
|
+
Nt,
|
|
628
632
|
{
|
|
629
633
|
field: e,
|
|
630
634
|
value: i,
|
|
631
|
-
onChange:
|
|
632
|
-
pairedValue: r ? (
|
|
635
|
+
onChange: a,
|
|
636
|
+
pairedValue: r ? (re = D == null ? void 0 : D.draft) == null ? void 0 : re[r] : void 0
|
|
633
637
|
}
|
|
634
638
|
);
|
|
635
639
|
}
|
|
636
640
|
if (s === "address")
|
|
637
641
|
return /* @__PURE__ */ n(
|
|
638
|
-
|
|
642
|
+
kt,
|
|
639
643
|
{
|
|
640
644
|
field: e,
|
|
641
645
|
value: i,
|
|
642
|
-
onChange:
|
|
646
|
+
onChange: a,
|
|
643
647
|
apiBase: _ == null ? void 0 : _.apiBase,
|
|
644
648
|
authHeaders: _ == null ? void 0 : _.authHeaders
|
|
645
649
|
}
|
|
646
650
|
);
|
|
647
651
|
if (s === "tags")
|
|
648
|
-
return /* @__PURE__ */ n(
|
|
652
|
+
return /* @__PURE__ */ n(It, { field: e, value: i, onChange: a });
|
|
649
653
|
if (s === "select-dropdown" || s === "radio-buttons") {
|
|
650
654
|
const r = (() => {
|
|
651
655
|
const o = y(e.options);
|
|
@@ -653,64 +657,64 @@ const mr = qe(function({
|
|
|
653
657
|
})();
|
|
654
658
|
if (r.length > 0)
|
|
655
659
|
return /* @__PURE__ */ n(
|
|
656
|
-
|
|
660
|
+
Ze,
|
|
657
661
|
{
|
|
658
|
-
value:
|
|
659
|
-
onChange: (o) =>
|
|
662
|
+
value: g,
|
|
663
|
+
onChange: (o) => a(o || null),
|
|
660
664
|
options: [
|
|
661
665
|
{ value: "", label: "— Select —" },
|
|
662
|
-
...r.map((o) => ({ value: o.value, label:
|
|
666
|
+
...r.map((o) => ({ value: o.value, label: Ue(o.text) }))
|
|
663
667
|
],
|
|
664
668
|
ariaLabel: e.label ?? e.field,
|
|
665
669
|
className: "h-9 rounded-md text-sm"
|
|
666
670
|
}
|
|
667
671
|
);
|
|
668
672
|
}
|
|
669
|
-
const I =
|
|
673
|
+
const I = Ft(e), ye = me(e), P = (() => {
|
|
670
674
|
const r = y(e.options);
|
|
671
675
|
if (Number.isFinite(Number(r == null ? void 0 : r.max_length))) return Number(r == null ? void 0 : r.max_length);
|
|
672
|
-
const o = y(e.validation_rules),
|
|
673
|
-
return
|
|
674
|
-
})(),
|
|
676
|
+
const o = y(e.validation_rules), l = Array.isArray(o) ? o.find((t) => (t == null ? void 0 : t.type) === "max") : null;
|
|
677
|
+
return l && Number.isFinite(Number(l.value)) ? Number(l.value) : ye;
|
|
678
|
+
})(), z = /* @__PURE__ */ n(
|
|
675
679
|
T,
|
|
676
680
|
{
|
|
677
|
-
maxLength: I ? void 0 :
|
|
678
|
-
value: I ?
|
|
681
|
+
maxLength: I ? void 0 : ue(e),
|
|
682
|
+
value: I ? ce(I, g).display : g,
|
|
679
683
|
onChange: (r) => {
|
|
680
684
|
if (I) {
|
|
681
|
-
const { clean: o } =
|
|
682
|
-
|
|
685
|
+
const { clean: o } = ce(I, r.target.value);
|
|
686
|
+
a(o || null);
|
|
683
687
|
} else
|
|
684
|
-
|
|
688
|
+
a(r.target.value || null);
|
|
685
689
|
},
|
|
686
690
|
placeholder: e.placeholder ?? I ?? void 0
|
|
687
691
|
}
|
|
688
692
|
);
|
|
689
|
-
if (
|
|
690
|
-
const r =
|
|
693
|
+
if (P != null && P > 0 && !ze(e._overrides)) {
|
|
694
|
+
const r = g.length;
|
|
691
695
|
return /* @__PURE__ */ x("div", { children: [
|
|
692
|
-
|
|
693
|
-
r >=
|
|
696
|
+
z,
|
|
697
|
+
r >= P * 0.6 && /* @__PURE__ */ x(
|
|
694
698
|
"p",
|
|
695
699
|
{
|
|
696
|
-
className: r >
|
|
700
|
+
className: r > P ? "mt-0.5 text-right text-[10.5px] tabular-nums text-red-500" : "mt-0.5 text-right text-[10.5px] tabular-nums text-slate-400",
|
|
697
701
|
children: [
|
|
698
702
|
r,
|
|
699
703
|
"/",
|
|
700
|
-
|
|
704
|
+
P
|
|
701
705
|
]
|
|
702
706
|
}
|
|
703
707
|
)
|
|
704
708
|
] });
|
|
705
709
|
}
|
|
706
|
-
return
|
|
710
|
+
return z;
|
|
707
711
|
});
|
|
708
|
-
function
|
|
709
|
-
field:
|
|
712
|
+
function It({
|
|
713
|
+
field: h,
|
|
710
714
|
value: e,
|
|
711
715
|
onChange: i
|
|
712
716
|
}) {
|
|
713
|
-
const [
|
|
717
|
+
const [a, p] = He(""), c = (() => {
|
|
714
718
|
if (Array.isArray(e)) return e.map(String);
|
|
715
719
|
if (typeof e == "string" && e.trim().startsWith("["))
|
|
716
720
|
try {
|
|
@@ -721,9 +725,9 @@ function Dt({
|
|
|
721
725
|
}
|
|
722
726
|
return typeof e == "string" && e.trim() !== "" ? [e] : [];
|
|
723
727
|
})(), d = (() => {
|
|
724
|
-
const u = y(
|
|
728
|
+
const u = y(h.options);
|
|
725
729
|
return Array.isArray(u == null ? void 0 : u.tag_options) ? u.tag_options.map(String) : [];
|
|
726
|
-
})(), b = (u) => i(u.length > 0 ? JSON.stringify(u) : null),
|
|
730
|
+
})(), b = (u) => i(u.length > 0 ? JSON.stringify(u) : null), v = (u) => {
|
|
727
731
|
const N = u.trim();
|
|
728
732
|
!N || c.includes(N) || (b([...c, N]), p(""));
|
|
729
733
|
};
|
|
@@ -752,12 +756,12 @@ function Dt({
|
|
|
752
756
|
/* @__PURE__ */ n(
|
|
753
757
|
"input",
|
|
754
758
|
{
|
|
755
|
-
value:
|
|
759
|
+
value: a,
|
|
756
760
|
onChange: (u) => p(u.target.value),
|
|
757
761
|
onKeyDown: (u) => {
|
|
758
|
-
(u.key === "Enter" || u.key === ",") && (u.preventDefault(),
|
|
762
|
+
(u.key === "Enter" || u.key === ",") && (u.preventDefault(), v(a)), u.key === "Backspace" && a === "" && c.length > 0 && b(c.slice(0, -1));
|
|
759
763
|
},
|
|
760
|
-
onBlur: () =>
|
|
764
|
+
onBlur: () => v(a),
|
|
761
765
|
placeholder: c.length === 0 ? "Type and press Enter…" : "",
|
|
762
766
|
className: "h-6 min-w-[120px] flex-1 bg-transparent text-[13px] outline-none"
|
|
763
767
|
}
|
|
@@ -767,7 +771,7 @@ function Dt({
|
|
|
767
771
|
"button",
|
|
768
772
|
{
|
|
769
773
|
type: "button",
|
|
770
|
-
onClick: () =>
|
|
774
|
+
onClick: () => v(u),
|
|
771
775
|
className: "rounded-full border border-slate-200 px-2 py-0.5 text-[11px] text-slate-500 hover:border-nvr-cyan/50 hover:text-slate-700 dark:border-border dark:text-slate-400",
|
|
772
776
|
children: [
|
|
773
777
|
"+ ",
|
|
@@ -779,6 +783,6 @@ function Dt({
|
|
|
779
783
|
] });
|
|
780
784
|
}
|
|
781
785
|
export {
|
|
782
|
-
|
|
783
|
-
|
|
786
|
+
pr as FieldRenderer,
|
|
787
|
+
ne as resolveOptionFilterTokens
|
|
784
788
|
};
|