@declarion/react 0.80.0 → 0.82.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/components/actions/ObjectActionBar.js +56 -54
- package/dist-lib/components/actions/PropertyGridEditor.js +56 -53
- package/dist-lib/components/actions/RowActionsKebab.js +51 -49
- package/dist-lib/components/detail-layout/AssociatedBlock.js +385 -383
- package/dist-lib/components/list/QuickPeek.js +77 -75
- package/dist-lib/components/pages/SmartDetailPage.impl.js +484 -458
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +207 -206
- package/dist-lib/components/pages/list/DataCell.js +15 -15
- package/dist-lib/components/pages/list/ListFloatbar.js +55 -53
- package/dist-lib/components/pages/list/ListHeader.js +54 -52
- package/dist-lib/components/pages/list/ListTable.js +64 -64
- package/dist-lib/components/pages/list/cardProjection.js +85 -80
- package/dist-lib/components/pages/list/column-sizing.js +11 -1
- package/dist-lib/components/pages/list/use-filter-value-labels.js +29 -78
- package/dist-lib/components/pages/list/useListRowInteraction.js +78 -76
- package/dist-lib/components/pages/list/useRowMenu.js +60 -58
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +341 -262
- package/dist-lib/components/params/ParamsBlock.js +59 -59
- package/dist-lib/components/params/param-editors.js +114 -99
- package/dist-lib/components/shared/ConfirmDialog.js +33 -66
- package/dist-lib/components/shared/ModalFrame.js +53 -0
- package/dist-lib/hooks/useRefRecords.js +73 -0
- package/dist-lib/hooks/useRowTenant.js +12 -0
- package/dist-lib/index.d.ts +4 -3
- package/dist-lib/lib/actions.js +105 -89
- package/dist-lib/lib/mass-edit.js +13 -13
- package/dist-lib/types/schema.js +29 -22
- package/package.json +1 -1
|
@@ -1,120 +1,122 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../../lib/display-value.js";
|
|
2
|
-
import { buildEntityDetailHref as t, extractPkValues as n, fieldDisplayName as r, getDisplayValue as i, pkValuesToDetailId as a } from "../../../types/schema.js";
|
|
3
|
-
import { useText as
|
|
4
|
-
import { buildActionBody as
|
|
5
|
-
import { resolveSchemaFieldLabel as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { buildEntityDetailHref as t, extractPkValues as n, fieldDisplayName as r, getDisplayValue as i, pkValuesToDetailId as a, rowSetInTenant as o } from "../../../types/schema.js";
|
|
3
|
+
import { useText as s } from "../../../hooks/useText.js";
|
|
4
|
+
import { buildActionBody as c, executeAction as l } from "../../../api/data.js";
|
|
5
|
+
import { resolveSchemaFieldLabel as u } from "../../file-widgets/host.js";
|
|
6
|
+
import { useRowTenant as d } from "../../../hooks/useRowTenant.js";
|
|
7
|
+
import { effectiveScreenForRecord as f } from "../../../lib/variants.js";
|
|
8
|
+
import { setPeekDraft as p } from "../../list/peekDraftStore.js";
|
|
9
|
+
import { resolveQuickPeekFieldNames as m } from "./cardProjection.js";
|
|
10
|
+
import { rowSelectionKey as h } from "./useListSelection.js";
|
|
11
|
+
import { classifyRowClick as g, isInteractiveRowTarget as _ } from "../../../lib/rowClickGesture.js";
|
|
12
|
+
import { useLongPress as v } from "../../../hooks/useLongPress.js";
|
|
13
|
+
import { useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
13
14
|
//#region src/components/pages/list/useListRowInteraction.ts
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function w({ entity: w, screen: T, screens: E, entities: D, searchParams: O, tabNavigate: k, commitScreenTabSearch: A, isPhone: j, canUpdate: M }) {
|
|
16
|
+
let N = s(), P = d(w), [F, I] = C(null), [L, R] = C(null), z = S(null), B = S(null);
|
|
17
|
+
b(() => () => {
|
|
18
|
+
B.current && clearTimeout(B.current.timer);
|
|
18
19
|
}, []);
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
21
|
-
let o = n(
|
|
20
|
+
let V = T?.on_row_click === "peek" && T.quick_peek?.enabled !== !1 && !j, H = y((e, r) => {
|
|
21
|
+
if (!w || !T) return;
|
|
22
|
+
let o = n(w, e), s = a(w, o), c = t(T, w, E, o);
|
|
22
23
|
if (!c) return;
|
|
23
24
|
if (r?.draft) {
|
|
24
|
-
|
|
25
|
+
p(s, r.draft);
|
|
25
26
|
let [e, t] = c.split("?", 2), n = new URLSearchParams(t ?? "");
|
|
26
27
|
n.set("edit", "true"), c = `${e}?${n.toString()}`;
|
|
27
28
|
}
|
|
28
|
-
let l = i(
|
|
29
|
-
O
|
|
29
|
+
let l = i(N, e, w) ?? N(w.display.name), u = T.display?.icon || w.display.icon;
|
|
30
|
+
A(O.toString()), k(c, {
|
|
30
31
|
title: l,
|
|
31
32
|
icon: u
|
|
32
33
|
});
|
|
33
34
|
}, [
|
|
34
|
-
|
|
35
|
-
S,
|
|
36
|
-
C,
|
|
35
|
+
N,
|
|
37
36
|
w,
|
|
37
|
+
T,
|
|
38
38
|
E,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
t
|
|
39
|
+
O,
|
|
40
|
+
k,
|
|
41
|
+
A
|
|
42
|
+
]), U = v(y((e) => {
|
|
43
|
+
let t = z.current;
|
|
44
|
+
t && R({
|
|
44
45
|
x: e.x,
|
|
45
46
|
y: e.y,
|
|
46
47
|
row: t
|
|
47
48
|
});
|
|
48
|
-
}, [])),
|
|
49
|
-
if (
|
|
50
|
-
if (!
|
|
51
|
-
|
|
49
|
+
}, [])), W = y((e, t) => {
|
|
50
|
+
if (U.consumePressFired() || _(e.target)) return;
|
|
51
|
+
if (!V || !w) {
|
|
52
|
+
H(t);
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
let n =
|
|
55
|
-
if (
|
|
56
|
-
clearTimeout(
|
|
55
|
+
let n = h(w, t);
|
|
56
|
+
if (g(B.current, n) === "double") {
|
|
57
|
+
clearTimeout(B.current.timer), B.current = null, I(null), H(t);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
B.current && clearTimeout(B.current.timer);
|
|
60
61
|
let r = setTimeout(() => {
|
|
61
|
-
|
|
62
|
+
B.current = null, I(t);
|
|
62
63
|
}, 250);
|
|
63
|
-
|
|
64
|
+
B.current = {
|
|
64
65
|
rowId: n,
|
|
65
66
|
timer: r
|
|
66
67
|
};
|
|
67
68
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
w,
|
|
70
|
+
V,
|
|
71
|
+
H,
|
|
72
|
+
U
|
|
72
73
|
]);
|
|
73
74
|
return {
|
|
74
|
-
peekAllowed:
|
|
75
|
-
peekRow:
|
|
76
|
-
setPeekRow:
|
|
77
|
-
peekFields:
|
|
78
|
-
if (!
|
|
79
|
-
let e =
|
|
80
|
-
return
|
|
81
|
-
if (
|
|
75
|
+
peekAllowed: V,
|
|
76
|
+
peekRow: F,
|
|
77
|
+
setPeekRow: I,
|
|
78
|
+
peekFields: x(() => {
|
|
79
|
+
if (!V || !w || !F) return [];
|
|
80
|
+
let e = f(w, T, F), t = M && o(w, F, P.tenantId);
|
|
81
|
+
return m(w, e, E).map((e) => {
|
|
82
|
+
if (w.files?.get(e)) return {
|
|
82
83
|
key: e,
|
|
83
|
-
label:
|
|
84
|
+
label: u(N, w, e, D),
|
|
84
85
|
kind: "file",
|
|
85
|
-
readOnly: !
|
|
86
|
+
readOnly: !t
|
|
86
87
|
};
|
|
87
|
-
let
|
|
88
|
+
let n = w.fields.get(e), i = t && !n.primary && !n.auto && !n.ref && n.files?.mode !== "rich_text_inline";
|
|
88
89
|
return {
|
|
89
90
|
key: e,
|
|
90
|
-
label: r(
|
|
91
|
+
label: r(N, n, e, D),
|
|
91
92
|
kind: "field",
|
|
92
|
-
field:
|
|
93
|
-
readOnly: !
|
|
93
|
+
field: n,
|
|
94
|
+
readOnly: !i
|
|
94
95
|
};
|
|
95
96
|
});
|
|
96
97
|
}, [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
S,
|
|
101
|
-
C,
|
|
102
|
-
T,
|
|
98
|
+
N,
|
|
99
|
+
V,
|
|
100
|
+
F,
|
|
103
101
|
w,
|
|
104
|
-
|
|
102
|
+
T,
|
|
103
|
+
D,
|
|
104
|
+
E,
|
|
105
|
+
M,
|
|
106
|
+
P
|
|
105
107
|
]),
|
|
106
|
-
peekActions:
|
|
107
|
-
peekExecute:
|
|
108
|
-
let i =
|
|
109
|
-
return
|
|
110
|
-
}, [
|
|
111
|
-
contextMenu:
|
|
112
|
-
setContextMenu:
|
|
113
|
-
pressedRow:
|
|
114
|
-
longPress:
|
|
115
|
-
onRowClick:
|
|
116
|
-
navigateToDetail:
|
|
108
|
+
peekActions: x(() => w?.actions ?? {}, [w?.actions]),
|
|
109
|
+
peekExecute: y(async (t, n, r) => {
|
|
110
|
+
let i = w?.fields.names().find((e) => w.fields.get(e)?.primary), a = i && F ? [e(F[i])] : void 0, o = n.entity ? `${n.entity}.${t}` : t;
|
|
111
|
+
return l(o, c(r, a));
|
|
112
|
+
}, [w, F]),
|
|
113
|
+
contextMenu: L,
|
|
114
|
+
setContextMenu: R,
|
|
115
|
+
pressedRow: z,
|
|
116
|
+
longPress: U,
|
|
117
|
+
onRowClick: W,
|
|
118
|
+
navigateToDetail: H
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
//#endregion
|
|
120
|
-
export {
|
|
122
|
+
export { w as useListRowInteraction };
|
|
@@ -5,16 +5,17 @@ import { buildActionBody as r, executeAction as i } from "../../../api/data.js";
|
|
|
5
5
|
import { PEEK_ACTION_CODE as a, applyRowState as o, defaultFlatForSlot as s, filterLayoutForSlot as c } from "../../../lib/actions.js";
|
|
6
6
|
import { useActionRunner as l } from "../../actions/ActionRunner.js";
|
|
7
7
|
import { dispatchAction as u } from "../../../lib/action-dispatch.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useRowTenant as d } from "../../../hooks/useRowTenant.js";
|
|
9
|
+
import { effectiveScreenForRecord as f, variantActionCodesForRecord as p } from "../../../lib/variants.js";
|
|
10
|
+
import { useCallback as m, useMemo as h } from "react";
|
|
10
11
|
//#region src/components/pages/list/useRowMenu.ts
|
|
11
|
-
function
|
|
12
|
+
function g(e, t) {
|
|
12
13
|
let n = (e) => e === "__peek" && !t.peek || e === "__open" && !t.open, r = [];
|
|
13
14
|
for (let i of e) if (i.kind === "action") {
|
|
14
15
|
if (n(i.code)) continue;
|
|
15
16
|
r.push(i);
|
|
16
17
|
} else {
|
|
17
|
-
let e =
|
|
18
|
+
let e = g(i.items, t);
|
|
18
19
|
e.length > 0 && r.push({
|
|
19
20
|
...i,
|
|
20
21
|
items: e
|
|
@@ -22,85 +23,86 @@ function h(e, t) {
|
|
|
22
23
|
}
|
|
23
24
|
return r;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function _(e, t) {
|
|
26
27
|
for (let n of e) if (n.kind === "action") {
|
|
27
28
|
if (n.code === t) return !0;
|
|
28
|
-
} else if (
|
|
29
|
+
} else if (_(n.items, t)) return !0;
|
|
29
30
|
return !1;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
let
|
|
33
|
-
...
|
|
34
|
-
detail_screen:
|
|
35
|
-
} :
|
|
36
|
-
let e = {}, t =
|
|
37
|
-
for (let { code: n, action: r } of
|
|
32
|
+
function v({ row: v, rowId: y, screen: b, fullScreen: x, entity: S, entityCode: C, rowActions: w, tabNavigate: T, peekAllowed: E, hasDetailTarget: D, onPeek: O }) {
|
|
33
|
+
let k = n(), A = d(S), j = n("errors"), { run: M } = l(), { data: N } = t(), P = x.detail_screen === void 0 && b.detail_screen !== void 0 ? {
|
|
34
|
+
...x,
|
|
35
|
+
detail_screen: b.detail_screen
|
|
36
|
+
} : x, F = f(S, P, v) ?? P, I = h(() => {
|
|
37
|
+
let e = {}, t = F.row_actions === void 0 ? void 0 : new Set(F.row_actions);
|
|
38
|
+
for (let { code: n, action: r } of w) (!t || t.has(n)) && (e[n] = r);
|
|
38
39
|
return e;
|
|
39
|
-
}, [
|
|
40
|
-
entity:
|
|
41
|
-
entityCode:
|
|
42
|
-
screen:
|
|
43
|
-
screenRoute:
|
|
40
|
+
}, [w, F.row_actions]), L = h(() => ({
|
|
41
|
+
entity: S,
|
|
42
|
+
entityCode: C ?? "",
|
|
43
|
+
screen: F,
|
|
44
|
+
screenRoute: F.route,
|
|
44
45
|
selectedRows: [],
|
|
45
46
|
selectedIds: [],
|
|
46
|
-
t:
|
|
47
|
-
tabNavigate: (e, t) =>
|
|
47
|
+
t: k,
|
|
48
|
+
tabNavigate: (e, t) => T(e, {
|
|
48
49
|
title: t?.title,
|
|
49
50
|
icon: t?.icon,
|
|
50
51
|
search: t?.search
|
|
51
52
|
}),
|
|
52
53
|
runActionApi: (e, t) => i(e, t),
|
|
53
|
-
openPeek: (e) =>
|
|
54
|
-
recordHref: (t) => e(
|
|
54
|
+
openPeek: (e) => O(e ?? v),
|
|
55
|
+
recordHref: (t) => e(F, t, S, N?.screens)
|
|
55
56
|
}), [
|
|
56
|
-
x,
|
|
57
57
|
S,
|
|
58
|
-
|
|
58
|
+
C,
|
|
59
|
+
F,
|
|
60
|
+
k,
|
|
61
|
+
T,
|
|
59
62
|
O,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let e = N.action_layout ?? null, t = x.action_layout ?? null, n = e ?? t ?? s(P, "list_row");
|
|
66
|
-
return c(n, P, void 0, "list_row");
|
|
63
|
+
v,
|
|
64
|
+
N?.screens
|
|
65
|
+
]), R = h(() => {
|
|
66
|
+
let e = F.action_layout ?? null, t = S.action_layout ?? null, n = e ?? t ?? s(I, "list_row");
|
|
67
|
+
return c(n, I, void 0, "list_row");
|
|
67
68
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
]),
|
|
72
|
-
peek:
|
|
73
|
-
open:
|
|
69
|
+
F,
|
|
70
|
+
S,
|
|
71
|
+
I
|
|
72
|
+
]), z = h(() => g(o(k, R, I, void 0, v, [], A, p(S, v)), {
|
|
73
|
+
peek: E,
|
|
74
|
+
open: D
|
|
74
75
|
}), [
|
|
75
|
-
|
|
76
|
+
k,
|
|
77
|
+
R,
|
|
76
78
|
I,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
v,
|
|
80
|
+
S,
|
|
81
|
+
E,
|
|
82
|
+
D,
|
|
83
|
+
A
|
|
82
84
|
]);
|
|
83
85
|
return {
|
|
84
|
-
layout:
|
|
85
|
-
entityActions:
|
|
86
|
-
runRowAction:
|
|
87
|
-
let n = u(
|
|
88
|
-
if (n !== null) return
|
|
86
|
+
layout: z,
|
|
87
|
+
entityActions: I,
|
|
88
|
+
runRowAction: m((e, t) => {
|
|
89
|
+
let n = u(j, e, t, { row: v });
|
|
90
|
+
if (n !== null) return M({
|
|
89
91
|
action: t,
|
|
90
|
-
title:
|
|
91
|
-
row:
|
|
92
|
-
execute: (e) => i(n, r(e, [
|
|
92
|
+
title: k(t.display?.name) || e,
|
|
93
|
+
row: v,
|
|
94
|
+
execute: (e) => i(n, r(e, [y]))
|
|
93
95
|
});
|
|
94
96
|
}, [
|
|
95
|
-
O,
|
|
96
97
|
k,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
j,
|
|
99
|
+
M,
|
|
100
|
+
y,
|
|
101
|
+
v
|
|
100
102
|
]),
|
|
101
|
-
widgetContext:
|
|
102
|
-
hasPeek:
|
|
103
|
+
widgetContext: L,
|
|
104
|
+
hasPeek: h(() => _(z, a), [z])
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
107
|
//#endregion
|
|
106
|
-
export {
|
|
108
|
+
export { v as useRowMenu };
|