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