@declarion/react 0.358.0 → 0.365.0
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-lib/api/access-expiry.js +17 -17
- package/dist-lib/api/session-renewal.js +6 -5
- package/dist-lib/components/fields/ErrorField.js +27 -0
- package/dist-lib/components/fields/JsonField.js +101 -57
- package/dist-lib/components/fields/cells/factories/errorTitle.js +11 -0
- package/dist-lib/components/fields/cells/factories/json.js +1 -0
- package/dist-lib/components/fields/cells/registry.js +8 -6
- package/dist-lib/components/fields/index.js +53 -51
- package/dist-lib/components/list/QuickPeek.js +51 -55
- package/dist-lib/components/pages/list/cardProjection.js +1 -0
- package/dist-lib/components/pages/list/filter-meta.js +44 -41
- package/dist-lib/components/pages/list/useListFilterPresentation.js +25 -22
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +78 -75
- package/dist-lib/components/primitives/Avatar.js +1 -1
- package/dist-lib/components/shared/LucideIcon.js +5 -1
- package/dist-lib/hooks/useScreenTab.js +20 -8
- package/dist-lib/index.d.ts +4 -2
- package/dist-lib/lib/error-options.js +8 -0
- package/dist-lib/lib/filter-evaluator.js +2 -1
- package/dist-lib/types/fieldType.js +1 -1
- package/package.json +1 -1
|
@@ -20,43 +20,43 @@ var w = {
|
|
|
20
20
|
tab: "Tab",
|
|
21
21
|
esc: "Esc"
|
|
22
22
|
};
|
|
23
|
-
function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarName: j, fields: M, refs: N, screen:
|
|
24
|
-
let
|
|
25
|
-
h(
|
|
26
|
-
let
|
|
23
|
+
function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarName: j, fields: M, refs: N, screen: te, actions: P, screenActionLayout: F, entityActionLayout: I, executeAction: L, onClose: R, onOpen: z, onSave: B }) {
|
|
24
|
+
let V = p(), H = m(T), [U, W] = b({ ...O }), [G, K] = b(!1);
|
|
25
|
+
h(G);
|
|
26
|
+
let q = y(null), { run: J } = a(), Y = d(T, te, U);
|
|
27
27
|
_(() => {
|
|
28
|
-
|
|
28
|
+
W({ ...O }), K(!1);
|
|
29
29
|
}, [O]), _(() => {
|
|
30
|
-
|
|
30
|
+
q.current?.focus();
|
|
31
31
|
}, []);
|
|
32
|
-
let
|
|
33
|
-
let e =
|
|
34
|
-
return s(
|
|
32
|
+
let X = v(() => {
|
|
33
|
+
let e = Y?.action_layout ?? F ?? I ?? c(P, "quick_peek"), t = l(e, P, void 0, "quick_peek");
|
|
34
|
+
return s(V, t, P, void 0, U, [], H, f(T, U));
|
|
35
35
|
}, [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
I,
|
|
39
|
-
L,
|
|
36
|
+
V,
|
|
37
|
+
Y?.action_layout,
|
|
40
38
|
F,
|
|
41
|
-
|
|
39
|
+
I,
|
|
40
|
+
P,
|
|
41
|
+
U,
|
|
42
42
|
T,
|
|
43
|
-
|
|
44
|
-
]),
|
|
45
|
-
|
|
43
|
+
H
|
|
44
|
+
]), Z = ({ code: e, action: t }) => {
|
|
45
|
+
J({
|
|
46
46
|
action: t,
|
|
47
|
-
title:
|
|
48
|
-
row:
|
|
49
|
-
execute: (n) =>
|
|
47
|
+
title: V(t.display?.name) || e,
|
|
48
|
+
row: U,
|
|
49
|
+
execute: (n) => L(e, t, n)
|
|
50
50
|
});
|
|
51
|
-
},
|
|
51
|
+
}, Q = (e, t) => {
|
|
52
52
|
let n = {
|
|
53
|
-
...
|
|
53
|
+
...U,
|
|
54
54
|
[e]: t
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
},
|
|
56
|
+
W(n), K(!0), B?.(n);
|
|
57
|
+
}, ne = Y?.quick_peek?.width ?? 480, $ = M.some((e) => !e.readOnly);
|
|
58
58
|
return /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
|
|
59
|
-
onClick:
|
|
59
|
+
onClick: R,
|
|
60
60
|
style: {
|
|
61
61
|
position: "fixed",
|
|
62
62
|
inset: 0,
|
|
@@ -64,19 +64,19 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
64
64
|
zIndex: 40
|
|
65
65
|
}
|
|
66
66
|
}), /* @__PURE__ */ C("aside", {
|
|
67
|
-
ref:
|
|
67
|
+
ref: q,
|
|
68
68
|
role: "dialog",
|
|
69
|
-
"aria-label":
|
|
69
|
+
"aria-label": V("list.peek.dialog", "Quick peek"),
|
|
70
70
|
tabIndex: -1,
|
|
71
71
|
onKeyDown: (e) => {
|
|
72
|
-
e.key === "Escape" &&
|
|
72
|
+
e.key === "Escape" && R();
|
|
73
73
|
},
|
|
74
74
|
style: {
|
|
75
75
|
position: "fixed",
|
|
76
76
|
top: "var(--topbar-h)",
|
|
77
77
|
right: 0,
|
|
78
78
|
bottom: "var(--tabbar-h)",
|
|
79
|
-
width:
|
|
79
|
+
width: ne,
|
|
80
80
|
background: "var(--surface)",
|
|
81
81
|
borderLeft: "1px solid var(--border)",
|
|
82
82
|
zIndex: 41,
|
|
@@ -124,13 +124,13 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
124
124
|
}),
|
|
125
125
|
/* @__PURE__ */ S(r, {
|
|
126
126
|
icon: /* @__PURE__ */ S(n.external, { size: 13 }),
|
|
127
|
-
title:
|
|
128
|
-
onClick: () =>
|
|
127
|
+
title: G ? V("list.peek.open_in_tab_dirty", "Open in tab (keeps unsaved changes)") : V("list.peek.open_in_tab", "Open in tab"),
|
|
128
|
+
onClick: () => z(G ? U : null)
|
|
129
129
|
}),
|
|
130
130
|
/* @__PURE__ */ S(r, {
|
|
131
131
|
icon: /* @__PURE__ */ S(n.x, { size: 14 }),
|
|
132
|
-
title:
|
|
133
|
-
onClick:
|
|
132
|
+
title: V("list.peek.close", "Close"),
|
|
133
|
+
onClick: R
|
|
134
134
|
})
|
|
135
135
|
]
|
|
136
136
|
}),
|
|
@@ -154,35 +154,31 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
154
154
|
alignItems: "center",
|
|
155
155
|
gap: 6
|
|
156
156
|
},
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */ S(n.sparkle, { size: 12 }),
|
|
159
|
-
" ",
|
|
160
|
-
H("list.peek.hint", "Inline quick-edit — click any field to change.")
|
|
161
|
-
] }), g(H("list.peek.keys_hint", "{tab} to move, {esc} to close."), {
|
|
157
|
+
children: [$ && /* @__PURE__ */ S(n.sparkle, { size: 12 }), /* @__PURE__ */ C("span", { children: [$ && /* @__PURE__ */ C(x, { children: [V("list.peek.hint", "Inline quick-edit — click any field to change."), " "] }), g(V("list.peek.keys_hint", "{tab} to move, {esc} to close."), {
|
|
162
158
|
tab: /* @__PURE__ */ S(i, { children: w.tab }),
|
|
163
159
|
esc: /* @__PURE__ */ S(i, { children: w.esc })
|
|
164
|
-
})]
|
|
160
|
+
})] })]
|
|
165
161
|
}), M.map((e) => /* @__PURE__ */ S(E, {
|
|
166
162
|
label: e.label,
|
|
167
163
|
children: e.kind === "file" ? ee({
|
|
168
164
|
entity: T,
|
|
169
165
|
entityCode: D,
|
|
170
166
|
fieldName: e.key,
|
|
171
|
-
record:
|
|
167
|
+
record: U,
|
|
172
168
|
mode: e.readOnly ? "display" : "edit",
|
|
173
|
-
onChange: (t) =>
|
|
169
|
+
onChange: (t) => Q(e.key, t),
|
|
174
170
|
refs: N,
|
|
175
171
|
disabled: e.readOnly,
|
|
176
|
-
t:
|
|
172
|
+
t: V
|
|
177
173
|
}) : /* @__PURE__ */ S(o, {
|
|
178
174
|
field: e.field,
|
|
179
175
|
fieldName: e.key,
|
|
180
176
|
label: e.label,
|
|
181
|
-
value:
|
|
182
|
-
record:
|
|
177
|
+
value: U[e.key],
|
|
178
|
+
record: U,
|
|
183
179
|
refs: N,
|
|
184
180
|
readOnly: e.readOnly,
|
|
185
|
-
onCommit: (t) =>
|
|
181
|
+
onCommit: (t) => Q(e.key, t)
|
|
186
182
|
})
|
|
187
183
|
}, e.key))]
|
|
188
184
|
}),
|
|
@@ -195,7 +191,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
195
191
|
alignItems: "center"
|
|
196
192
|
},
|
|
197
193
|
children: [
|
|
198
|
-
|
|
194
|
+
G && /* @__PURE__ */ C("span", {
|
|
199
195
|
style: {
|
|
200
196
|
fontSize: 11,
|
|
201
197
|
color: "var(--warn)",
|
|
@@ -208,7 +204,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
208
204
|
height: 6,
|
|
209
205
|
borderRadius: 999,
|
|
210
206
|
background: "var(--warn)"
|
|
211
|
-
} }),
|
|
207
|
+
} }), V("list.peek.unsaved", "Unsaved")]
|
|
212
208
|
}),
|
|
213
209
|
/* @__PURE__ */ S("div", {
|
|
214
210
|
style: {
|
|
@@ -217,24 +213,24 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
217
213
|
display: "flex",
|
|
218
214
|
justifyContent: "flex-end"
|
|
219
215
|
},
|
|
220
|
-
children:
|
|
221
|
-
layout:
|
|
222
|
-
row:
|
|
223
|
-
onRun: (e, t) =>
|
|
216
|
+
children: X.length > 0 && /* @__PURE__ */ S(u, {
|
|
217
|
+
layout: X,
|
|
218
|
+
row: U,
|
|
219
|
+
onRun: (e, t) => Z({
|
|
224
220
|
code: e,
|
|
225
221
|
action: t
|
|
226
222
|
}),
|
|
227
223
|
kind: "toolbar",
|
|
228
|
-
entityActions:
|
|
224
|
+
entityActions: P,
|
|
229
225
|
align: "trailing",
|
|
230
|
-
ariaLabel:
|
|
226
|
+
ariaLabel: V("list.peek.actions", "Quick peek actions")
|
|
231
227
|
})
|
|
232
228
|
}),
|
|
233
229
|
/* @__PURE__ */ S(t, {
|
|
234
230
|
kind: "primary",
|
|
235
231
|
icon: /* @__PURE__ */ S(n.edit, { size: 13 }),
|
|
236
|
-
onClick: () =>
|
|
237
|
-
children:
|
|
232
|
+
onClick: () => z(G ? U : null),
|
|
233
|
+
children: V("list.peek.open_full", "Open full")
|
|
238
234
|
})
|
|
239
235
|
]
|
|
240
236
|
})
|
|
@@ -1,74 +1,77 @@
|
|
|
1
1
|
import { effectiveSpecialValues as e, fieldDisplayName as t } from "../../../types/schema.js";
|
|
2
|
+
import { errorOptions as n } from "../../../lib/error-options.js";
|
|
2
3
|
// src/components/pages/list/filter-meta.ts
|
|
3
|
-
function
|
|
4
|
+
function r(e, t, n, r, i) {
|
|
4
5
|
if (!t || !n) return [];
|
|
5
|
-
let
|
|
6
|
-
return
|
|
6
|
+
let o = t.filter_operators ?? {}, s = (t.filters ?? []).filter((e) => o[e]?.length);
|
|
7
|
+
return a({
|
|
7
8
|
t: e,
|
|
8
9
|
screen: t,
|
|
9
10
|
entity: n,
|
|
10
|
-
entities: r
|
|
11
|
-
|
|
11
|
+
entities: r,
|
|
12
|
+
errors: i
|
|
13
|
+
}, s, o);
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
return !t || !n ? [] :
|
|
15
|
+
function i(e, t, n, r, i) {
|
|
16
|
+
return !t || !n ? [] : a({
|
|
15
17
|
t: e,
|
|
16
18
|
screen: t,
|
|
17
19
|
entity: n,
|
|
18
|
-
entities: r
|
|
20
|
+
entities: r,
|
|
21
|
+
errors: i
|
|
19
22
|
}, Object.keys(n.filter_operators), n.filter_operators);
|
|
20
23
|
}
|
|
21
|
-
function
|
|
22
|
-
let
|
|
23
|
-
for (let
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
let e =
|
|
24
|
+
function a({ t: r, screen: i, entity: a, entities: o, errors: s }, c, l) {
|
|
25
|
+
let u = [];
|
|
26
|
+
for (let d of c) {
|
|
27
|
+
let c = l[d];
|
|
28
|
+
if (d.startsWith("$status.")) {
|
|
29
|
+
let e = d.slice(8), t = a.status_groups?.[e];
|
|
27
30
|
if (!t) continue;
|
|
28
|
-
|
|
29
|
-
code:
|
|
30
|
-
label:
|
|
31
|
+
u.push({
|
|
32
|
+
code: d,
|
|
33
|
+
label: r(t.name) || e,
|
|
31
34
|
type: "status",
|
|
32
|
-
operators:
|
|
35
|
+
operators: c,
|
|
33
36
|
options: t.statuses.map((e) => ({
|
|
34
37
|
value: e.code,
|
|
35
|
-
label:
|
|
38
|
+
label: r(e.name) || e.code,
|
|
36
39
|
color: e.color
|
|
37
40
|
}))
|
|
38
41
|
});
|
|
39
42
|
continue;
|
|
40
43
|
}
|
|
41
|
-
if (
|
|
42
|
-
let e =
|
|
44
|
+
if (d.startsWith("$property.")) {
|
|
45
|
+
let e = d.slice(10), t = a.properties?.[e];
|
|
43
46
|
if (!t) continue;
|
|
44
|
-
|
|
45
|
-
code:
|
|
46
|
-
label:
|
|
47
|
+
u.push({
|
|
48
|
+
code: d,
|
|
49
|
+
label: r(t.name) || e,
|
|
47
50
|
type: "property",
|
|
48
|
-
operators:
|
|
51
|
+
operators: c
|
|
49
52
|
});
|
|
50
53
|
continue;
|
|
51
54
|
}
|
|
52
|
-
let
|
|
53
|
-
if (!
|
|
54
|
-
let
|
|
55
|
+
let f = a.fields.get(d);
|
|
56
|
+
if (!f) continue;
|
|
57
|
+
let p = t(r, f, d, o), m = f.type === "error" ? n(s, r) : f.values?.map((e) => ({
|
|
55
58
|
value: e.code,
|
|
56
|
-
label:
|
|
59
|
+
label: r(e.name) || e.code,
|
|
57
60
|
color: e.color
|
|
58
|
-
})),
|
|
59
|
-
|
|
60
|
-
code:
|
|
61
|
-
label:
|
|
62
|
-
type:
|
|
63
|
-
operators:
|
|
64
|
-
options:
|
|
65
|
-
ref:
|
|
66
|
-
specialValues:
|
|
61
|
+
})), h = e(f.special_values, i?.special_values?.[d]);
|
|
62
|
+
u.push({
|
|
63
|
+
code: d,
|
|
64
|
+
label: p,
|
|
65
|
+
type: f.type,
|
|
66
|
+
operators: c,
|
|
67
|
+
options: m,
|
|
68
|
+
ref: f.ref,
|
|
69
|
+
specialValues: h.length > 0 ? h : void 0
|
|
67
70
|
});
|
|
68
71
|
}
|
|
69
|
-
return
|
|
72
|
+
return u;
|
|
70
73
|
}
|
|
71
|
-
function
|
|
74
|
+
function o(e, n, r, i) {
|
|
72
75
|
if (i.startsWith("$status.")) {
|
|
73
76
|
let t = n.status_groups?.[i.slice(8)];
|
|
74
77
|
return t && e(t.name) || i;
|
|
@@ -80,4 +83,4 @@ function a(e, n, r, i) {
|
|
|
80
83
|
let a = n.fields.get(i);
|
|
81
84
|
return a ? t(e, a, i, r) : i;
|
|
82
85
|
}
|
|
83
|
-
export {
|
|
86
|
+
export { i as buildFilterDisplayMeta, r as buildFilterFieldMeta, o as filterFieldLabel };
|
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
import { useText as e } from "../../../hooks/useText.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useSchema as t } from "../../../hooks/useSchema.js";
|
|
3
|
+
import { useJsonSnapshot as n } from "../../../hooks/useJsonSnapshot.js";
|
|
4
|
+
import { buildFilterDisplayMeta as r, buildFilterFieldMeta as i, filterFieldLabel as a } from "./filter-meta.js";
|
|
5
|
+
import { visibleFilters as o } from "./visible-filters.js";
|
|
6
|
+
import { useCallback as s, useMemo as c } from "react";
|
|
6
7
|
// src/components/pages/list/useListFilterPresentation.ts
|
|
7
|
-
function
|
|
8
|
-
let
|
|
8
|
+
function l(l, u, d, f) {
|
|
9
|
+
let p = e(), m = t().data?.errors, h = n(f);
|
|
9
10
|
return {
|
|
10
|
-
visibleFilterState:
|
|
11
|
-
filters:
|
|
11
|
+
visibleFilterState: c(() => u ? o(h, u.filter_operators) : {
|
|
12
|
+
filters: h,
|
|
12
13
|
omitted: !1
|
|
13
|
-
}, [
|
|
14
|
-
filterFieldMeta:
|
|
15
|
-
|
|
16
|
-
c,
|
|
14
|
+
}, [h, u]),
|
|
15
|
+
filterFieldMeta: c(() => i(p, l, u, d, m), [
|
|
16
|
+
p,
|
|
17
17
|
l,
|
|
18
|
-
u
|
|
18
|
+
u,
|
|
19
|
+
d,
|
|
20
|
+
m
|
|
19
21
|
]),
|
|
20
|
-
allFilterFieldMeta:
|
|
21
|
-
|
|
22
|
-
c,
|
|
22
|
+
allFilterFieldMeta: c(() => r(p, l, u, d, m), [
|
|
23
|
+
p,
|
|
23
24
|
l,
|
|
24
|
-
u
|
|
25
|
+
u,
|
|
26
|
+
d,
|
|
27
|
+
m
|
|
25
28
|
]),
|
|
26
|
-
filterFieldName:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
filterFieldName: s((e) => u ? a(p, u, d, e) : e, [
|
|
30
|
+
p,
|
|
31
|
+
u,
|
|
32
|
+
d
|
|
30
33
|
])
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
|
-
export {
|
|
36
|
+
export { l as useListFilterPresentation };
|