@nivaro/react 0.3.10 → 0.3.12
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/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +1 -1
- package/dist/hooks/useSessionRecorder.js +109 -102
- package/dist/index.d.ts +34 -3
- package/dist/shared/components/CollectionBrowserView.js +1546 -1477
- package/dist/shared/components/ItemEditForm.js +4332 -4195
- package/dist/shared/components/PageRenderer.js +512 -465
- package/dist/shared/components/ProfileView.js +115 -109
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/chat/ChatPanel.js +492 -472
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/UserChip.js +301 -233
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/profile/PersonAdminTools.js +168 -144
- package/dist/shared/components/profile/PersonProfile.js +42 -41
- package/dist/shared/components/profile/session-actions.js +52 -0
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1005 -935
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/replay-checkout.js +20 -0
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
1
|
+
import { jsx as i, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import { ExternalLink as Me } from "lucide-react";
|
|
3
|
-
import { useContext as Be, useRef as
|
|
4
|
-
import { useDrilldown as
|
|
3
|
+
import { useContext as Be, useRef as J, useEffect as re, useState as Le } from "react";
|
|
4
|
+
import { useDrilldown as Ee, useParentDraft as qe, RelationPathDataContext as Te, useApiFetchConfig as Je, fieldDrilldownConfig as V } from "../../context.js";
|
|
5
5
|
import { getFieldInterface as He } from "../../lib/field-interfaces.js";
|
|
6
|
-
import { precisionOf as
|
|
7
|
-
import { resolveOptionFilterTokens as
|
|
8
|
-
import { counterOf as
|
|
9
|
-
import { choiceLabel as
|
|
10
|
-
import { Badge as
|
|
6
|
+
import { precisionOf as Ve } from "../../lib/format-value.js";
|
|
7
|
+
import { resolveOptionFilterTokens as oe } from "../../lib/option-filter-tokens.js";
|
|
8
|
+
import { counterOf as $e } from "../../lib/placement-behaviour.js";
|
|
9
|
+
import { choiceLabel as Ge } from "../../lib/utils.js";
|
|
10
|
+
import { Badge as Ke } from "../ui/badge.js";
|
|
11
11
|
import { Input as B } from "../ui/input.js";
|
|
12
12
|
import { Label as We } from "../ui/label.js";
|
|
13
13
|
import { SimpleSelect as Ye } from "../ui/SimpleSelect.js";
|
|
@@ -15,77 +15,78 @@ import { Switch as ze } from "../ui/switch.js";
|
|
|
15
15
|
import { Textarea as $ } from "../ui/textarea.js";
|
|
16
16
|
import { CatalogPickerField as Ue } from "./CatalogPickerField.js";
|
|
17
17
|
import { useFieldAffordances as Ce } from "./FieldAffordances.js";
|
|
18
|
-
import { ProgressField as
|
|
18
|
+
import { ProgressField as ne, RatingScaleField as ie, DurationReadOnly as Qe, ChecklistReadOnly as Xe, ColorPackField as ae, PhoneField as le, EmailField as Ze, AddressAutocompleteField as Oe } from "./FieldPack.js";
|
|
19
19
|
import { FilePickerField as et, FileM2MField as tt } from "./FilePickerField.js";
|
|
20
20
|
import { formatDisplayValue as L } from "./GroupSection.js";
|
|
21
21
|
import { parseJson as _, toLocalDatetime as rt } from "./helpers.js";
|
|
22
22
|
import { InlineGridField as ot } from "./InlineGridField.js";
|
|
23
23
|
import { InlineTableField as nt } from "./InlineTableField.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
|
|
24
|
+
import { checkNumberEntry as it } from "./line-qty.js";
|
|
25
|
+
import { M2MSingleSelectCombobox as at, M2MCombobox as lt } from "./M2MCombobox.js";
|
|
26
|
+
import { MembershipSetField as st } from "./MembershipSetField.js";
|
|
27
|
+
import { PlanGridField as ct } from "./PlanGrid.js";
|
|
28
|
+
import { smartParseDate as dt, CountdownChip as ut, DurationField as mt, FiscalPeriodField as pt, ChecklistField as yt, RepeaterField as _t, RangeSliderField as ft, DateRangeField as bt, AddressField as xt, maskFor as ht, applyInputMask as se } from "./PolishFields.js";
|
|
29
|
+
import { QuickCreateButton as gt } from "./QuickCreateButton.js";
|
|
30
|
+
import { RelationCombobox as vt } from "./RelationCombobox.js";
|
|
31
|
+
import { RelationGroupedCombobox as wt } from "./RelationGroupedCombobox.js";
|
|
32
|
+
import { RichTextEditor as Nt } from "./RichTextEditor.js";
|
|
33
|
+
function kt({
|
|
33
34
|
plugin: e,
|
|
34
35
|
props: n
|
|
35
36
|
}) {
|
|
36
|
-
const l =
|
|
37
|
-
return
|
|
37
|
+
const l = J(null), m = J(void 0), y = J(n);
|
|
38
|
+
return y.current = n, re(() => {
|
|
38
39
|
if (l.current)
|
|
39
|
-
return l.current.innerHTML = "", m.current = e.mount(l.current,
|
|
40
|
+
return l.current.innerHTML = "", m.current = e.mount(l.current, y.current), () => {
|
|
40
41
|
var c, u;
|
|
41
42
|
(u = (c = m.current) == null ? void 0 : c.destroy) == null || u.call(c), m.current = void 0;
|
|
42
43
|
};
|
|
43
|
-
}, [e]),
|
|
44
|
+
}, [e]), re(() => {
|
|
44
45
|
var c, u;
|
|
45
46
|
(u = (c = m.current) == null ? void 0 : c.update) == null || u.call(c, n);
|
|
46
47
|
}, [n]), /* @__PURE__ */ i("div", { ref: l, "data-custom-interface": e.interface });
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function ce(e) {
|
|
49
50
|
const n = e.validation_rules, l = Array.isArray(n) ? n : _(typeof n == "string" ? n : null);
|
|
50
51
|
if (!Array.isArray(l)) return {};
|
|
51
52
|
const m = (c) => {
|
|
52
53
|
const u = /* @__PURE__ */ new Date();
|
|
53
54
|
u.setDate(u.getDate() + c);
|
|
54
|
-
const
|
|
55
|
-
return `${u.getFullYear()}-${
|
|
56
|
-
},
|
|
55
|
+
const v = (F) => String(F).padStart(2, "0");
|
|
56
|
+
return `${u.getFullYear()}-${v(u.getMonth() + 1)}-${v(u.getDate())}`;
|
|
57
|
+
}, y = {};
|
|
57
58
|
for (const c of l) {
|
|
58
59
|
const u = Number(c == null ? void 0 : c.value);
|
|
59
|
-
Number.isFinite(u) && ((c == null ? void 0 : c.type) === "min_days_from_today" && (
|
|
60
|
+
Number.isFinite(u) && ((c == null ? void 0 : c.type) === "min_days_from_today" && (y.min = m(u)), (c == null ? void 0 : c.type) === "max_days_from_today" && (y.max = m(u)));
|
|
60
61
|
}
|
|
61
|
-
return
|
|
62
|
+
return y;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function ir({
|
|
64
65
|
field: e,
|
|
65
66
|
value: n,
|
|
66
67
|
onChange: l,
|
|
67
68
|
relations: m,
|
|
68
|
-
collection:
|
|
69
|
+
collection: y,
|
|
69
70
|
itemId: c,
|
|
70
71
|
cascadeFilter: u,
|
|
71
|
-
requiredParentLabel:
|
|
72
|
+
requiredParentLabel: v,
|
|
72
73
|
narrowedBy: F,
|
|
73
74
|
onCountChange: d,
|
|
74
75
|
displayOnly: w,
|
|
75
|
-
prefillParentId:
|
|
76
|
+
prefillParentId: de,
|
|
76
77
|
pinnedOption: G
|
|
77
78
|
}) {
|
|
78
|
-
var
|
|
79
|
-
const j =
|
|
79
|
+
var z, U, C, Q, X, Z, O, ee, te;
|
|
80
|
+
const j = Ee(), I = Ce(), A = qe(), H = Be(Te), D = A, f = (() => {
|
|
80
81
|
try {
|
|
81
82
|
return Je();
|
|
82
83
|
} catch {
|
|
83
84
|
return null;
|
|
84
85
|
}
|
|
85
|
-
})(), s = e.interface ?? "", K =
|
|
86
|
+
})(), s = e.interface ?? "", K = J(He(s)).current;
|
|
86
87
|
if (K)
|
|
87
88
|
return /* @__PURE__ */ i(
|
|
88
|
-
|
|
89
|
+
kt,
|
|
89
90
|
{
|
|
90
91
|
plugin: K,
|
|
91
92
|
props: {
|
|
@@ -93,7 +94,7 @@ function or({
|
|
|
93
94
|
onChange: l,
|
|
94
95
|
field: { field: e.field, label: e.label, options: e.options },
|
|
95
96
|
readOnly: !!e.readonly || !!w,
|
|
96
|
-
collection:
|
|
97
|
+
collection: y,
|
|
97
98
|
itemId: c || null
|
|
98
99
|
}
|
|
99
100
|
}
|
|
@@ -111,21 +112,21 @@ function or({
|
|
|
111
112
|
}
|
|
112
113
|
);
|
|
113
114
|
}
|
|
114
|
-
const
|
|
115
|
-
(r) => r.many_collection ===
|
|
115
|
+
const W = !s || s.startsWith("relation-") || s === "select-multiple-m2m" || s.endsWith("-m2o") || s.endsWith("-m2m"), N = W ? m.find(
|
|
116
|
+
(r) => r.many_collection === y && r.many_field === e.field && !r.junction_field
|
|
116
117
|
) : null;
|
|
117
118
|
if (N != null && N.one_collection) {
|
|
118
119
|
if (s === "relation-grouped") {
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
120
|
+
const p = _(e.options);
|
|
121
|
+
if (p != null && p.group_field && (p != null && p.option_field))
|
|
121
122
|
return /* @__PURE__ */ i(
|
|
122
|
-
|
|
123
|
+
wt,
|
|
123
124
|
{
|
|
124
125
|
collection: N.one_collection,
|
|
125
126
|
value: n,
|
|
126
127
|
onChange: l,
|
|
127
|
-
groupField:
|
|
128
|
-
optionField:
|
|
128
|
+
groupField: p.group_field,
|
|
129
|
+
optionField: p.option_field,
|
|
129
130
|
disabled: e.readonly,
|
|
130
131
|
placeholder: e.placeholder ?? void 0,
|
|
131
132
|
extraFilter: u,
|
|
@@ -133,15 +134,15 @@ function or({
|
|
|
133
134
|
}
|
|
134
135
|
);
|
|
135
136
|
}
|
|
136
|
-
const r = j && n != null && n !== "" ?
|
|
137
|
+
const r = j && n != null && n !== "" ? V(e) : null, o = _(e.options), a = oe(
|
|
137
138
|
o != null && o.option_filter && typeof o.option_filter == "object" ? o.option_filter : void 0,
|
|
138
139
|
A == null ? void 0 : A.draft,
|
|
139
140
|
c
|
|
140
141
|
), t = a ? u ? { _and: [a, u] } : a : u, b = /* @__PURE__ */ i(
|
|
141
|
-
|
|
142
|
+
vt,
|
|
142
143
|
{
|
|
143
144
|
fieldKey: e.field,
|
|
144
|
-
missPlacement: (I == null ? void 0 : I.layoutId) != null && I.pickerMisses !== !1 ? { layoutId: Number(I.layoutId), collection:
|
|
145
|
+
missPlacement: (I == null ? void 0 : I.layoutId) != null && I.pickerMisses !== !1 ? { layoutId: Number(I.layoutId), collection: y, field: e.field } : null,
|
|
145
146
|
collection: N.one_collection,
|
|
146
147
|
value: n,
|
|
147
148
|
onChange: l,
|
|
@@ -150,27 +151,27 @@ function or({
|
|
|
150
151
|
extraFilter: t,
|
|
151
152
|
autoSelectSingle: (o == null ? void 0 : o.auto_select_single) === !0,
|
|
152
153
|
optionSort: typeof (o == null ? void 0 : o.option_sort) == "string" && o.option_sort ? o.option_sort : void 0,
|
|
153
|
-
requiredParent:
|
|
154
|
+
requiredParent: v ?? void 0,
|
|
154
155
|
narrowedBy: F,
|
|
155
156
|
pinned: G,
|
|
156
|
-
facets: Array.isArray(o == null ? void 0 : o.picker_facets) ? o.picker_facets.map((
|
|
157
|
-
...
|
|
157
|
+
facets: Array.isArray(o == null ? void 0 : o.picker_facets) ? o.picker_facets.map((p) => ({
|
|
158
|
+
...p,
|
|
158
159
|
// Facet filters support the same '$parent.<field>' tokens (and
|
|
159
160
|
// _and clause pruning) as option_filter, resolved from the same
|
|
160
161
|
// parent draft — keeps facet option lists in sync with the main
|
|
161
162
|
// option query's eligibility clauses.
|
|
162
|
-
filter:
|
|
163
|
+
filter: p.filter && typeof p.filter == "object" ? oe(p.filter, A == null ? void 0 : A.draft, c) : void 0
|
|
163
164
|
})) : void 0
|
|
164
165
|
}
|
|
165
|
-
),
|
|
166
|
-
return !r && !
|
|
166
|
+
), h = o != null && o.quick_create && Array.isArray(o.quick_create.fields) && !e.readonly ? o.quick_create : null;
|
|
167
|
+
return !r && !h ? b : /* @__PURE__ */ g("div", { className: "flex items-center gap-1.5", children: [
|
|
167
168
|
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: b }),
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
h && /* @__PURE__ */ i(
|
|
170
|
+
gt,
|
|
170
171
|
{
|
|
171
172
|
targetCollection: N.one_collection,
|
|
172
|
-
config:
|
|
173
|
-
onCreated: (
|
|
173
|
+
config: h,
|
|
174
|
+
onCreated: (p) => l(p)
|
|
174
175
|
}
|
|
175
176
|
),
|
|
176
177
|
r && /* @__PURE__ */ i(
|
|
@@ -190,9 +191,9 @@ function or({
|
|
|
190
191
|
)
|
|
191
192
|
] });
|
|
192
193
|
}
|
|
193
|
-
const
|
|
194
|
+
const E = W && !N ? (() => {
|
|
194
195
|
const r = m.find(
|
|
195
|
-
(a) => a.one_collection ===
|
|
196
|
+
(a) => a.one_collection === y && (a.one_field === e.field || a.junction_field != null && a.many_collection === e.field)
|
|
196
197
|
);
|
|
197
198
|
if (!r) return null;
|
|
198
199
|
if (r.junction_field) return r;
|
|
@@ -201,13 +202,13 @@ function or({
|
|
|
201
202
|
);
|
|
202
203
|
return o ? { ...r, junction_field: o.many_field } : null;
|
|
203
204
|
})() : null;
|
|
204
|
-
if (
|
|
205
|
+
if (E) {
|
|
205
206
|
if (s === "files-m2m") {
|
|
206
207
|
const a = _(e.options);
|
|
207
208
|
return /* @__PURE__ */ i(
|
|
208
209
|
tt,
|
|
209
210
|
{
|
|
210
|
-
relation:
|
|
211
|
+
relation: E,
|
|
211
212
|
parentId: c,
|
|
212
213
|
allRelations: m,
|
|
213
214
|
disabled: e.readonly,
|
|
@@ -219,34 +220,34 @@ function or({
|
|
|
219
220
|
}
|
|
220
221
|
const r = _(e.options), o = typeof (r == null ? void 0 : r.option_sort) == "string" && r.option_sort ? r.option_sort : void 0;
|
|
221
222
|
return (r == null ? void 0 : r.max_values) === 1 ? /* @__PURE__ */ i(
|
|
222
|
-
|
|
223
|
+
at,
|
|
223
224
|
{
|
|
224
|
-
relation:
|
|
225
|
+
relation: E,
|
|
225
226
|
parentId: c,
|
|
226
227
|
allRelations: m,
|
|
227
228
|
extraFilter: u,
|
|
228
229
|
optionSort: o,
|
|
229
|
-
requiredParent:
|
|
230
|
+
requiredParent: v ?? void 0,
|
|
230
231
|
onCountChange: d,
|
|
231
232
|
readOnly: w
|
|
232
233
|
}
|
|
233
234
|
) : /* @__PURE__ */ i(
|
|
234
|
-
|
|
235
|
+
lt,
|
|
235
236
|
{
|
|
236
|
-
relation:
|
|
237
|
+
relation: E,
|
|
237
238
|
parentId: c,
|
|
238
239
|
allRelations: m,
|
|
239
240
|
extraFilter: u,
|
|
240
241
|
optionSort: o,
|
|
241
|
-
requiredParent:
|
|
242
|
+
requiredParent: v ?? void 0,
|
|
242
243
|
onCountChange: d,
|
|
243
|
-
drilldown:
|
|
244
|
+
drilldown: V(e)
|
|
244
245
|
}
|
|
245
246
|
);
|
|
246
247
|
}
|
|
247
248
|
if (e.readonly && s !== "inline-table") {
|
|
248
249
|
if (s === "relation-path" && n != null && n !== "" && j) {
|
|
249
|
-
const a =
|
|
250
|
+
const a = V(e), t = H == null ? void 0 : H[e.field];
|
|
250
251
|
if (a && (t != null && t.target_collection) && t.ids.length > 0)
|
|
251
252
|
return /* @__PURE__ */ i("div", { className: "min-h-[36px] flex items-center", children: /* @__PURE__ */ i(
|
|
252
253
|
"button",
|
|
@@ -264,14 +265,14 @@ function or({
|
|
|
264
265
|
}
|
|
265
266
|
) });
|
|
266
267
|
}
|
|
267
|
-
const r = (
|
|
268
|
+
const r = (z = e.options) == null ? void 0 : z.__live_delta;
|
|
268
269
|
if (r && Number.isFinite(Number(r.live))) {
|
|
269
270
|
const a = Number(r.original), t = Number(r.live) - (Number.isFinite(a) ? a : 0), b = Math.round(t * 100) / 100;
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ g("div", { className: "flex min-h-[36px] flex-wrap items-center gap-x-2 gap-y-0.5", children: [
|
|
271
272
|
/* @__PURE__ */ i("span", { className: "text-sm text-slate-400 line-through tabular-nums", children: L(r.original, e) }),
|
|
272
273
|
/* @__PURE__ */ i("span", { className: "text-slate-300", "aria-hidden": !0, children: "→" }),
|
|
273
274
|
/* @__PURE__ */ i("span", { className: "text-sm font-medium tabular-nums", children: L(r.live, e) }),
|
|
274
|
-
b !== 0 && /* @__PURE__ */
|
|
275
|
+
b !== 0 && /* @__PURE__ */ g(
|
|
275
276
|
"span",
|
|
276
277
|
{
|
|
277
278
|
className: `rounded px-1.5 py-px text-[11px] font-medium tabular-nums ${b > 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"}`,
|
|
@@ -283,29 +284,29 @@ function or({
|
|
|
283
284
|
)
|
|
284
285
|
] });
|
|
285
286
|
}
|
|
286
|
-
if (s === "progress") return /* @__PURE__ */ i(
|
|
287
|
+
if (s === "progress") return /* @__PURE__ */ i(ne, { value: n, onChange: l, readOnly: !0 });
|
|
287
288
|
if (s === "rating") {
|
|
288
|
-
const a = (
|
|
289
|
-
return /* @__PURE__ */ i(
|
|
289
|
+
const a = (U = _(e.options)) == null ? void 0 : U.rating_max;
|
|
290
|
+
return /* @__PURE__ */ i(ie, { value: n, onChange: l, max: a ?? 5, readOnly: !0 });
|
|
290
291
|
}
|
|
291
292
|
if (s === "duration") return /* @__PURE__ */ i(Qe, { value: n });
|
|
292
293
|
if (s === "checklist") return /* @__PURE__ */ i(Xe, { value: n });
|
|
293
294
|
if (s === "color")
|
|
294
|
-
return /* @__PURE__ */ i(
|
|
295
|
-
if (s === "phone") return /* @__PURE__ */ i(
|
|
296
|
-
const o = n == null ? /* @__PURE__ */ i("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof n == "boolean" ? /* @__PURE__ */ i(
|
|
295
|
+
return /* @__PURE__ */ i(ae, { field: e, value: n, onChange: l, readOnly: !0 });
|
|
296
|
+
if (s === "phone") return /* @__PURE__ */ i(le, { value: n, onChange: l, readOnly: !0 });
|
|
297
|
+
const o = n == null ? /* @__PURE__ */ i("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof n == "boolean" ? /* @__PURE__ */ i(Ke, { variant: n ? "default" : "secondary", children: n ? "Yes" : "No" }) : /* @__PURE__ */ i("span", { className: "text-sm tabular-nums", children: L(n, e) });
|
|
297
298
|
return /* @__PURE__ */ i("div", { className: "min-h-[36px] flex items-center", children: o });
|
|
298
299
|
}
|
|
299
300
|
const x = n == null ? "" : String(n);
|
|
300
301
|
if (e.type === "boolean")
|
|
301
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ g("div", { className: "flex items-center gap-2", children: [
|
|
302
303
|
/* @__PURE__ */ i(ze, { checked: !!n, onCheckedChange: l }),
|
|
303
304
|
/* @__PURE__ */ i(We, { className: "font-normal text-sm", children: n ? "Yes" : "No" })
|
|
304
305
|
] });
|
|
305
306
|
if (e.type === "datetime" || s === "datetime") {
|
|
306
307
|
const r = _(e.options);
|
|
307
308
|
if ((r == null ? void 0 : r.date_mode) === "date") {
|
|
308
|
-
const o =
|
|
309
|
+
const o = ce(e);
|
|
309
310
|
return /* @__PURE__ */ i(
|
|
310
311
|
B,
|
|
311
312
|
{
|
|
@@ -329,8 +330,8 @@ function or({
|
|
|
329
330
|
);
|
|
330
331
|
}
|
|
331
332
|
if (e.type === "date" || s === "date") {
|
|
332
|
-
const r = ((
|
|
333
|
-
return /* @__PURE__ */
|
|
333
|
+
const r = ((C = _(e.options)) == null ? void 0 : C.countdown) === !0, o = ce(e);
|
|
334
|
+
return /* @__PURE__ */ g("div", { className: "flex items-center", children: [
|
|
334
335
|
/* @__PURE__ */ i(
|
|
335
336
|
B,
|
|
336
337
|
{
|
|
@@ -340,14 +341,14 @@ function or({
|
|
|
340
341
|
max: o.max,
|
|
341
342
|
onChange: (a) => l(a.target.value || null),
|
|
342
343
|
onPaste: (a) => {
|
|
343
|
-
const t =
|
|
344
|
+
const t = dt(a.clipboardData.getData("text"));
|
|
344
345
|
t && (a.preventDefault(), l(t));
|
|
345
346
|
},
|
|
346
347
|
placeholder: e.placeholder ?? void 0,
|
|
347
348
|
className: "flex-1"
|
|
348
349
|
}
|
|
349
350
|
),
|
|
350
|
-
r && /* @__PURE__ */ i(
|
|
351
|
+
r && /* @__PURE__ */ i(ut, { value: x.slice(0, 10) })
|
|
351
352
|
] });
|
|
352
353
|
}
|
|
353
354
|
if ([
|
|
@@ -368,24 +369,28 @@ function or({
|
|
|
368
369
|
].includes(e.type)) {
|
|
369
370
|
const r = ["integer", "bigInteger", "int", "bigint", "smallint", "tinyint"].includes(
|
|
370
371
|
e.type
|
|
371
|
-
), o = r ? 0 :
|
|
372
|
-
return /* @__PURE__ */
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
372
|
+
), o = r ? 0 : Ve(e.options, -1), a = r ? "1" : o >= 0 ? String(10 ** -o) : "any", t = it(n, { type: e.type, label: e.label || "Value" }), b = t.ok ? null : t.message;
|
|
373
|
+
return /* @__PURE__ */ g("div", { children: [
|
|
374
|
+
/* @__PURE__ */ i(
|
|
375
|
+
B,
|
|
376
|
+
{
|
|
377
|
+
type: "number",
|
|
378
|
+
"aria-invalid": b ? !0 : void 0,
|
|
379
|
+
step: a,
|
|
380
|
+
value: x,
|
|
381
|
+
onChange: (h) => l(h.target.value === "" ? null : Number(h.target.value)),
|
|
382
|
+
onBlur: (h) => {
|
|
383
|
+
if (o < 0 || h.target.value === "") return;
|
|
384
|
+
const p = Number(h.target.value);
|
|
385
|
+
if (!Number.isFinite(p)) return;
|
|
386
|
+
const q = Number(p.toFixed(o));
|
|
387
|
+
q !== p && l(q);
|
|
388
|
+
},
|
|
389
|
+
placeholder: e.placeholder ?? void 0
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
b && /* @__PURE__ */ i("p", { className: "mt-1 text-[11.5px] text-red-600 dark:text-red-400", "data-number-entry-error": !0, children: b })
|
|
393
|
+
] });
|
|
389
394
|
}
|
|
390
395
|
if (e.type === "json" || s === "code")
|
|
391
396
|
return /* @__PURE__ */ i(
|
|
@@ -427,18 +432,18 @@ function or({
|
|
|
427
432
|
);
|
|
428
433
|
if (s === "input-rich-text-html" || s === "rich_text" || e.type === "rich_text" || s === "extension-editorjs")
|
|
429
434
|
return /* @__PURE__ */ i(
|
|
430
|
-
|
|
435
|
+
Nt,
|
|
431
436
|
{
|
|
432
437
|
value: x,
|
|
433
438
|
onChange: l,
|
|
434
439
|
placeholder: e.placeholder ?? void 0,
|
|
435
440
|
disabled: e.readonly,
|
|
436
|
-
pastePlain: ((
|
|
441
|
+
pastePlain: ((Q = _(e.options)) == null ? void 0 : Q.paste_plain) === !0
|
|
437
442
|
}
|
|
438
443
|
);
|
|
439
444
|
if (s === "inline-grid" || s === "relation-list" || s === "list-o2m") {
|
|
440
445
|
const r = m.find(
|
|
441
|
-
(o) => o.one_collection ===
|
|
446
|
+
(o) => o.one_collection === y && !o.junction_field && (o.one_field === e.field || o.many_collection === e.field)
|
|
442
447
|
);
|
|
443
448
|
if (r) {
|
|
444
449
|
const o = r.many_collection ?? null, a = r.many_field ?? null;
|
|
@@ -467,7 +472,7 @@ function or({
|
|
|
467
472
|
}
|
|
468
473
|
if (s === "inline-table") {
|
|
469
474
|
const r = m.find(
|
|
470
|
-
(o) => o.one_collection ===
|
|
475
|
+
(o) => o.one_collection === y && !o.junction_field && (o.one_field === e.field || o.many_collection === e.field)
|
|
471
476
|
);
|
|
472
477
|
if (r) {
|
|
473
478
|
const o = r.many_collection ?? null, a = r.many_field ?? null;
|
|
@@ -478,10 +483,10 @@ function or({
|
|
|
478
483
|
} catch {
|
|
479
484
|
return {};
|
|
480
485
|
}
|
|
481
|
-
})() : e.options ?? {}, b = t.layout_id ?? null,
|
|
486
|
+
})() : e.options ?? {}, b = t.layout_id ?? null, h = !!t.show_row_revisions, p = !!t.row_comments, q = t.allow_revision_restore !== !1, ue = t.save_mode ?? "immediate", me = !!t.show_line_numbers, pe = t.enable_reorder !== !1, ye = Array.isArray(t.parent_cascades) ? t.parent_cascades : void 0, _e = Array.isArray(t.row_rules) ? t.row_rules : void 0, fe = Array.isArray(t.column_presets) ? t.column_presets : void 0, be = typeof t.default_preset == "string" && t.default_preset ? t.default_preset : void 0, xe = Array.isArray(t.drawer_relations) ? t.drawer_relations : void 0, he = Array.isArray(t.parent_context_fields) ? t.parent_context_fields : void 0, ge = Array.isArray(t.unique_by) ? t.unique_by : void 0, ve = typeof t.sort_field == "string" && t.sort_field ? t.sort_field : void 0, we = t.sort_dir === "desc" ? "desc" : "asc", Ne = t.freeze_first_column === !0, ke = typeof t.section_group_by == "string" && t.section_group_by.includes(".") ? t.section_group_by : void 0, Fe = t.row_filter && typeof t.row_filter == "object" ? t.row_filter : void 0, Ae = t.allocate_drawer && typeof t.allocate_drawer == "object" ? t.allocate_drawer : void 0, Se = t.auto_allocate && typeof t.auto_allocate == "object" ? t.auto_allocate : void 0, Re = Array.isArray(t.row_bulk_actions) ? t.row_bulk_actions : void 0, je = typeof t.upload_template == "string" && t.upload_template ? t.upload_template : void 0, De = t.row_match_panel ?? void 0, Ie = t.row_defaults && typeof t.row_defaults == "object" ? t.row_defaults : void 0, Pe = t.submission_errors === !0 ? {} : t.submission_errors && typeof t.submission_errors == "object" ? t.submission_errors : void 0, S = t.membership_set;
|
|
482
487
|
if (S != null && S.key_field && (S != null && S.value_field))
|
|
483
488
|
return /* @__PURE__ */ i(
|
|
484
|
-
|
|
489
|
+
st,
|
|
485
490
|
{
|
|
486
491
|
relatedCollection: o,
|
|
487
492
|
manyField: a,
|
|
@@ -498,7 +503,7 @@ function or({
|
|
|
498
503
|
relatedCollection: o,
|
|
499
504
|
manyField: a,
|
|
500
505
|
parentId: c,
|
|
501
|
-
parentCollection:
|
|
506
|
+
parentCollection: y,
|
|
502
507
|
config: R,
|
|
503
508
|
readOnly: e.readonly
|
|
504
509
|
}
|
|
@@ -507,7 +512,7 @@ function or({
|
|
|
507
512
|
if (k != null && k.key_field && (k != null && k.category_field) && Array.isArray(k.value_fields)) {
|
|
508
513
|
const T = t.spread_remaining;
|
|
509
514
|
return /* @__PURE__ */ i(
|
|
510
|
-
|
|
515
|
+
ct,
|
|
511
516
|
{
|
|
512
517
|
relatedCollection: o,
|
|
513
518
|
manyField: a,
|
|
@@ -518,7 +523,7 @@ function or({
|
|
|
518
523
|
sumCap: t.sum_cap && typeof t.sum_cap == "object" ? t.sum_cap : null,
|
|
519
524
|
remaining: typeof (T == null ? void 0 : T.remaining) == "string" ? T.remaining : null,
|
|
520
525
|
readOnly: e.readonly,
|
|
521
|
-
showHistory:
|
|
526
|
+
showHistory: h,
|
|
522
527
|
emptyLabel: e.label || void 0
|
|
523
528
|
}
|
|
524
529
|
);
|
|
@@ -529,11 +534,11 @@ function or({
|
|
|
529
534
|
relatedCollection: o,
|
|
530
535
|
manyField: a,
|
|
531
536
|
parentId: c,
|
|
532
|
-
parentCollection:
|
|
537
|
+
parentCollection: y,
|
|
533
538
|
layoutId: b,
|
|
534
|
-
showRowRevisions:
|
|
535
|
-
rowComments:
|
|
536
|
-
allowRevisionRestore:
|
|
539
|
+
showRowRevisions: h,
|
|
540
|
+
rowComments: p,
|
|
541
|
+
allowRevisionRestore: q,
|
|
537
542
|
saveMode: ue,
|
|
538
543
|
showLineNumbers: me,
|
|
539
544
|
enableReorder: pe,
|
|
@@ -563,7 +568,7 @@ function or({
|
|
|
563
568
|
spreadRemaining: t.spread_remaining && typeof t.spread_remaining == "object" ? t.spread_remaining : null,
|
|
564
569
|
compareSeries: t.compare_series && typeof t.compare_series == "object" && typeof t.compare_series.endpoint == "string" ? t.compare_series : null,
|
|
565
570
|
submissionErrors: Pe,
|
|
566
|
-
prefillParentId:
|
|
571
|
+
prefillParentId: de,
|
|
567
572
|
parentFieldKey: e.field,
|
|
568
573
|
readOnly: e.readonly,
|
|
569
574
|
emptyLabel: e.label || void 0
|
|
@@ -573,14 +578,14 @@ function or({
|
|
|
573
578
|
}
|
|
574
579
|
return /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-400 py-1", children: "Inline table editing not available in embedded form" });
|
|
575
580
|
}
|
|
576
|
-
if (s === "color") return /* @__PURE__ */ i(
|
|
581
|
+
if (s === "color") return /* @__PURE__ */ i(ae, { field: e, value: n, onChange: l });
|
|
577
582
|
if (s === "rating") {
|
|
578
|
-
const r = (
|
|
579
|
-
return /* @__PURE__ */ i(
|
|
583
|
+
const r = (X = _(e.options)) == null ? void 0 : X.rating_max;
|
|
584
|
+
return /* @__PURE__ */ i(ie, { value: n, onChange: l, max: r ?? 5 });
|
|
580
585
|
}
|
|
581
|
-
if (s === "progress") return /* @__PURE__ */ i(
|
|
586
|
+
if (s === "progress") return /* @__PURE__ */ i(ne, { value: n, onChange: l });
|
|
582
587
|
if (s === "phone")
|
|
583
|
-
return /* @__PURE__ */ i(
|
|
588
|
+
return /* @__PURE__ */ i(le, { value: n, onChange: l, placeholder: e.placeholder ?? void 0 });
|
|
584
589
|
if (s === "email")
|
|
585
590
|
return /* @__PURE__ */ i(Ze, { value: n, onChange: l, placeholder: e.placeholder ?? void 0 });
|
|
586
591
|
if (s === "address-autocomplete")
|
|
@@ -596,38 +601,38 @@ function or({
|
|
|
596
601
|
placeholder: e.placeholder ?? void 0
|
|
597
602
|
}
|
|
598
603
|
);
|
|
599
|
-
if (s === "duration") return /* @__PURE__ */ i(
|
|
600
|
-
if (s === "fiscal_period") return /* @__PURE__ */ i(
|
|
601
|
-
if (s === "checklist") return /* @__PURE__ */ i(
|
|
604
|
+
if (s === "duration") return /* @__PURE__ */ i(mt, { value: n, onChange: l });
|
|
605
|
+
if (s === "fiscal_period") return /* @__PURE__ */ i(pt, { value: n, onChange: l });
|
|
606
|
+
if (s === "checklist") return /* @__PURE__ */ i(yt, { value: n, onChange: l });
|
|
602
607
|
if (s === "repeater" || e.repeater_schema && e.type === "json")
|
|
603
|
-
return /* @__PURE__ */ i(
|
|
608
|
+
return /* @__PURE__ */ i(_t, { field: e, value: n, onChange: l });
|
|
604
609
|
if (s === "range_slider") {
|
|
605
|
-
const r = (
|
|
610
|
+
const r = (Z = _(e.options)) == null ? void 0 : Z.range_end_field;
|
|
606
611
|
return /* @__PURE__ */ i(
|
|
607
|
-
|
|
612
|
+
ft,
|
|
608
613
|
{
|
|
609
614
|
field: e,
|
|
610
615
|
value: n,
|
|
611
616
|
onChange: l,
|
|
612
|
-
pairedValue: r ? (
|
|
617
|
+
pairedValue: r ? (O = D == null ? void 0 : D.draft) == null ? void 0 : O[r] : void 0
|
|
613
618
|
}
|
|
614
619
|
);
|
|
615
620
|
}
|
|
616
621
|
if (s === "date_range") {
|
|
617
|
-
const r = (
|
|
622
|
+
const r = (ee = _(e.options)) == null ? void 0 : ee.range_end_field;
|
|
618
623
|
return /* @__PURE__ */ i(
|
|
619
|
-
|
|
624
|
+
bt,
|
|
620
625
|
{
|
|
621
626
|
field: e,
|
|
622
627
|
value: n,
|
|
623
628
|
onChange: l,
|
|
624
|
-
pairedValue: r ? (
|
|
629
|
+
pairedValue: r ? (te = D == null ? void 0 : D.draft) == null ? void 0 : te[r] : void 0
|
|
625
630
|
}
|
|
626
631
|
);
|
|
627
632
|
}
|
|
628
633
|
if (s === "address")
|
|
629
634
|
return /* @__PURE__ */ i(
|
|
630
|
-
|
|
635
|
+
xt,
|
|
631
636
|
{
|
|
632
637
|
field: e,
|
|
633
638
|
value: n,
|
|
@@ -637,7 +642,7 @@ function or({
|
|
|
637
642
|
}
|
|
638
643
|
);
|
|
639
644
|
if (s === "tags")
|
|
640
|
-
return /* @__PURE__ */ i(
|
|
645
|
+
return /* @__PURE__ */ i(Ft, { field: e, value: n, onChange: l });
|
|
641
646
|
if (s === "select-dropdown" || s === "radio-buttons") {
|
|
642
647
|
const r = (() => {
|
|
643
648
|
const o = _(e.options);
|
|
@@ -651,25 +656,25 @@ function or({
|
|
|
651
656
|
onChange: (o) => l(o || null),
|
|
652
657
|
options: [
|
|
653
658
|
{ value: "", label: "— Select —" },
|
|
654
|
-
...r.map((o) => ({ value: o.value, label:
|
|
659
|
+
...r.map((o) => ({ value: o.value, label: Ge(o.text) }))
|
|
655
660
|
],
|
|
656
661
|
ariaLabel: e.label ?? e.field,
|
|
657
662
|
className: "h-9 rounded-md text-sm"
|
|
658
663
|
}
|
|
659
664
|
);
|
|
660
665
|
}
|
|
661
|
-
const P =
|
|
666
|
+
const P = ht(e), M = (() => {
|
|
662
667
|
const r = _(e.options);
|
|
663
668
|
if (Number.isFinite(Number(r == null ? void 0 : r.max_length))) return Number(r == null ? void 0 : r.max_length);
|
|
664
669
|
const o = _(e.validation_rules), a = Array.isArray(o) ? o.find((t) => (t == null ? void 0 : t.type) === "max") : null;
|
|
665
670
|
return a && Number.isFinite(Number(a.value)) ? Number(a.value) : null;
|
|
666
|
-
})(),
|
|
671
|
+
})(), Y = /* @__PURE__ */ i(
|
|
667
672
|
B,
|
|
668
673
|
{
|
|
669
|
-
value: P ?
|
|
674
|
+
value: P ? se(P, x).display : x,
|
|
670
675
|
onChange: (r) => {
|
|
671
676
|
if (P) {
|
|
672
|
-
const { clean: o } =
|
|
677
|
+
const { clean: o } = se(P, r.target.value);
|
|
673
678
|
l(o || null);
|
|
674
679
|
} else
|
|
675
680
|
l(r.target.value || null);
|
|
@@ -677,11 +682,11 @@ function or({
|
|
|
677
682
|
placeholder: e.placeholder ?? P ?? void 0
|
|
678
683
|
}
|
|
679
684
|
);
|
|
680
|
-
if (M != null && M > 0 &&
|
|
685
|
+
if (M != null && M > 0 && !$e(e._overrides)) {
|
|
681
686
|
const r = x.length;
|
|
682
|
-
return /* @__PURE__ */
|
|
683
|
-
|
|
684
|
-
r >= M * 0.6 && /* @__PURE__ */
|
|
687
|
+
return /* @__PURE__ */ g("div", { children: [
|
|
688
|
+
Y,
|
|
689
|
+
r >= M * 0.6 && /* @__PURE__ */ g(
|
|
685
690
|
"p",
|
|
686
691
|
{
|
|
687
692
|
className: r > M ? "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",
|
|
@@ -694,14 +699,14 @@ function or({
|
|
|
694
699
|
)
|
|
695
700
|
] });
|
|
696
701
|
}
|
|
697
|
-
return
|
|
702
|
+
return Y;
|
|
698
703
|
}
|
|
699
|
-
function
|
|
704
|
+
function Ft({
|
|
700
705
|
field: e,
|
|
701
706
|
value: n,
|
|
702
707
|
onChange: l
|
|
703
708
|
}) {
|
|
704
|
-
const [m,
|
|
709
|
+
const [m, y] = Le(""), c = (() => {
|
|
705
710
|
if (Array.isArray(n)) return n.map(String);
|
|
706
711
|
if (typeof n == "string" && n.trim().startsWith("["))
|
|
707
712
|
try {
|
|
@@ -714,13 +719,13 @@ function kt({
|
|
|
714
719
|
})(), u = (() => {
|
|
715
720
|
const d = _(e.options);
|
|
716
721
|
return Array.isArray(d == null ? void 0 : d.tag_options) ? d.tag_options.map(String) : [];
|
|
717
|
-
})(),
|
|
722
|
+
})(), v = (d) => l(d.length > 0 ? JSON.stringify(d) : null), F = (d) => {
|
|
718
723
|
const w = d.trim();
|
|
719
|
-
!w || c.includes(w) || (
|
|
724
|
+
!w || c.includes(w) || (v([...c, w]), y(""));
|
|
720
725
|
};
|
|
721
|
-
return /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
c.map((d) => /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ g("div", { className: "rounded-md border border-input bg-background px-2 py-1.5", children: [
|
|
727
|
+
/* @__PURE__ */ g("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
728
|
+
c.map((d) => /* @__PURE__ */ g(
|
|
724
729
|
"span",
|
|
725
730
|
{
|
|
726
731
|
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",
|
|
@@ -731,7 +736,7 @@ function kt({
|
|
|
731
736
|
{
|
|
732
737
|
type: "button",
|
|
733
738
|
"aria-label": `Remove ${d}`,
|
|
734
|
-
onClick: () =>
|
|
739
|
+
onClick: () => v(c.filter((w) => w !== d)),
|
|
735
740
|
className: "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
|
|
736
741
|
children: "×"
|
|
737
742
|
}
|
|
@@ -744,9 +749,9 @@ function kt({
|
|
|
744
749
|
"input",
|
|
745
750
|
{
|
|
746
751
|
value: m,
|
|
747
|
-
onChange: (d) =>
|
|
752
|
+
onChange: (d) => y(d.target.value),
|
|
748
753
|
onKeyDown: (d) => {
|
|
749
|
-
(d.key === "Enter" || d.key === ",") && (d.preventDefault(), F(m)), d.key === "Backspace" && m === "" && c.length > 0 &&
|
|
754
|
+
(d.key === "Enter" || d.key === ",") && (d.preventDefault(), F(m)), d.key === "Backspace" && m === "" && c.length > 0 && v(c.slice(0, -1));
|
|
750
755
|
},
|
|
751
756
|
onBlur: () => F(m),
|
|
752
757
|
placeholder: c.length === 0 ? "Type and press Enter…" : "",
|
|
@@ -754,7 +759,7 @@ function kt({
|
|
|
754
759
|
}
|
|
755
760
|
)
|
|
756
761
|
] }),
|
|
757
|
-
u.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1 flex flex-wrap gap-1 border-t border-slate-100 pt-1 dark:border-border/60", children: u.filter((d) => !c.includes(d)).map((d) => /* @__PURE__ */
|
|
762
|
+
u.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1 flex flex-wrap gap-1 border-t border-slate-100 pt-1 dark:border-border/60", children: u.filter((d) => !c.includes(d)).map((d) => /* @__PURE__ */ g(
|
|
758
763
|
"button",
|
|
759
764
|
{
|
|
760
765
|
type: "button",
|
|
@@ -770,6 +775,6 @@ function kt({
|
|
|
770
775
|
] });
|
|
771
776
|
}
|
|
772
777
|
export {
|
|
773
|
-
|
|
774
|
-
|
|
778
|
+
ir as FieldRenderer,
|
|
779
|
+
oe as resolveOptionFilterTokens
|
|
775
780
|
};
|