@declarion/react 0.81.0 → 0.83.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
|
@@ -7,60 +7,62 @@ import { applyRowState as o, findListScreenForEntity as s, resolveActionLayoutFo
|
|
|
7
7
|
import { useActionRunner as u } from "./ActionRunner.js";
|
|
8
8
|
import { dispatchAction as d } from "../../lib/action-dispatch.js";
|
|
9
9
|
import { ResponsiveActionBar as f } from "./ResponsiveActionBar.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { useRowTenant as p } from "../../hooks/useRowTenant.js";
|
|
11
|
+
import { variantActionCodesForRecord as m } from "../../lib/variants.js";
|
|
12
|
+
import { useMemo as h } from "react";
|
|
13
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
+
import { useLocation as v } from "react-router";
|
|
14
15
|
//#region src/components/actions/ObjectActionBar.tsx
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
|
|
16
|
+
function y({ entity: f, object: g, slot: _, screen: y, select: b, onAfterRun: S }) {
|
|
17
|
+
let w = t(), T = t("errors"), { data: E } = e(), { run: D, isRunning: O } = u(), k = i(), A = a(), j = v(), M = E?.entities?.[f], N = p(M), P = h(() => x(E, f, y, j.pathname), [
|
|
18
|
+
E,
|
|
18
19
|
f,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]),
|
|
20
|
+
y,
|
|
21
|
+
j.pathname
|
|
22
|
+
]), F = E?.actions, I = s(E, f);
|
|
22
23
|
return {
|
|
23
|
-
nodes:
|
|
24
|
-
if (!
|
|
25
|
-
let e =
|
|
26
|
-
return o(
|
|
24
|
+
nodes: h(() => {
|
|
25
|
+
if (!M || !g) return [];
|
|
26
|
+
let e = C(c(P?.action_layout, M.action_layout, M.actions, F, _), b);
|
|
27
|
+
return o(w, e, M.actions, F, g, [], N, m(M, g));
|
|
27
28
|
}, [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
h,
|
|
32
|
-
N,
|
|
29
|
+
w,
|
|
30
|
+
P?.action_layout,
|
|
31
|
+
M,
|
|
33
32
|
g,
|
|
34
|
-
|
|
33
|
+
F,
|
|
34
|
+
_,
|
|
35
|
+
b,
|
|
36
|
+
N
|
|
35
37
|
]),
|
|
36
38
|
run: (e, t) => {
|
|
37
|
-
if (!
|
|
38
|
-
let i = d(
|
|
39
|
+
if (!M || !g) return;
|
|
40
|
+
let i = d(T, e, t, { row: g }, f);
|
|
39
41
|
if (i === null) return;
|
|
40
|
-
let a = l(
|
|
41
|
-
return
|
|
42
|
+
let a = l(g, M), o = a ? [a] : [], s = e === "__delete" && I ? I.route : null;
|
|
43
|
+
return D({
|
|
42
44
|
action: t,
|
|
43
|
-
title:
|
|
44
|
-
row:
|
|
45
|
+
title: w(t.display?.name) || e,
|
|
46
|
+
row: g,
|
|
45
47
|
execute: (e) => r(i, n(e, o)),
|
|
46
48
|
onSuccess: (t) => {
|
|
47
|
-
s &&
|
|
49
|
+
s && k(s, { replace: !0 }), S?.(e, t);
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
52
|
},
|
|
51
|
-
isBusy:
|
|
52
|
-
widgetContext:
|
|
53
|
-
if (!
|
|
54
|
-
let e = l(
|
|
53
|
+
isBusy: O,
|
|
54
|
+
widgetContext: h(() => {
|
|
55
|
+
if (!M || !g) return;
|
|
56
|
+
let e = l(g, M);
|
|
55
57
|
return {
|
|
56
|
-
entity:
|
|
58
|
+
entity: M,
|
|
57
59
|
entityCode: f,
|
|
58
|
-
screen:
|
|
59
|
-
screenRoute:
|
|
60
|
-
selectedRows: [
|
|
60
|
+
screen: P,
|
|
61
|
+
screenRoute: P?.route ?? "",
|
|
62
|
+
selectedRows: [g],
|
|
61
63
|
selectedIds: e ? [e] : [],
|
|
62
|
-
t:
|
|
63
|
-
tabNavigate: (e, t) =>
|
|
64
|
+
t: w,
|
|
65
|
+
tabNavigate: (e, t) => A(e, {
|
|
64
66
|
title: t?.title,
|
|
65
67
|
icon: t?.icon,
|
|
66
68
|
search: t?.search
|
|
@@ -68,17 +70,17 @@ function v({ entity: f, object: h, slot: g, screen: v, select: y, onAfterRun: x
|
|
|
68
70
|
runActionApi: (e, t) => r(e, t)
|
|
69
71
|
};
|
|
70
72
|
}, [
|
|
71
|
-
j,
|
|
72
|
-
f,
|
|
73
73
|
M,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
f,
|
|
75
|
+
P,
|
|
76
|
+
g,
|
|
77
|
+
w,
|
|
78
|
+
A
|
|
77
79
|
])
|
|
78
80
|
};
|
|
79
81
|
}
|
|
80
|
-
function
|
|
81
|
-
let { data: c } = e(), { nodes: l, run: u, widgetContext: d } =
|
|
82
|
+
function b({ entity: t, object: n, slot: r, screen: i, select: a, extraActions: o, onAfterRun: s }) {
|
|
83
|
+
let { data: c } = e(), { nodes: l, run: u, widgetContext: d } = y({
|
|
82
84
|
entity: t,
|
|
83
85
|
object: n,
|
|
84
86
|
slot: r,
|
|
@@ -86,9 +88,9 @@ function y({ entity: t, object: n, slot: r, screen: i, select: a, extraActions:
|
|
|
86
88
|
select: a,
|
|
87
89
|
onAfterRun: s
|
|
88
90
|
}), p = c?.entities?.[t];
|
|
89
|
-
return l.length === 0 && !o ? null : /* @__PURE__ */
|
|
91
|
+
return l.length === 0 && !o ? null : /* @__PURE__ */ _("span", {
|
|
90
92
|
style: { display: "contents" },
|
|
91
|
-
children: [l.length > 0 && /* @__PURE__ */
|
|
93
|
+
children: [l.length > 0 && /* @__PURE__ */ g(f, {
|
|
92
94
|
layout: l,
|
|
93
95
|
row: n,
|
|
94
96
|
onRun: u,
|
|
@@ -100,28 +102,28 @@ function y({ entity: t, object: n, slot: r, screen: i, select: a, extraActions:
|
|
|
100
102
|
}), o]
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
|
-
function
|
|
105
|
+
function x(e, t, n, r) {
|
|
104
106
|
if (!e?.screens) return;
|
|
105
107
|
if (n) return e.screens[n];
|
|
106
108
|
let i = r.replace(/\/+$/, "") || "/";
|
|
107
|
-
return Object.values(e.screens).find((e) => e.entity !== t || !e.route ? !1 :
|
|
109
|
+
return Object.values(e.screens).find((e) => e.entity !== t || !e.route ? !1 : S(e.route).test(i));
|
|
108
110
|
}
|
|
109
|
-
function
|
|
111
|
+
function S(e) {
|
|
110
112
|
let t = (e.replace(/\/+$/, "") || "/").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
111
113
|
return RegExp(`^${t.join("/")}$`);
|
|
112
114
|
}
|
|
113
|
-
function
|
|
115
|
+
function C(e, t) {
|
|
114
116
|
if (!t) return e;
|
|
115
117
|
let n = t.include ? new Set(t.include) : null, r = t.exclude ? new Set(t.exclude) : null;
|
|
116
|
-
return e.map((e) =>
|
|
118
|
+
return e.map((e) => w(e, n, r)).filter((e) => e !== null);
|
|
117
119
|
}
|
|
118
|
-
function
|
|
120
|
+
function w(e, t, n) {
|
|
119
121
|
if (e.kind === "action") return t && !t.has(e.code) || n?.has(e.code) ? null : e;
|
|
120
|
-
let r = e.items.map((e) =>
|
|
122
|
+
let r = e.items.map((e) => w(e, t, n)).filter((e) => e !== null);
|
|
121
123
|
return r.length > 0 ? {
|
|
122
124
|
...e,
|
|
123
125
|
items: r
|
|
124
126
|
} : null;
|
|
125
127
|
}
|
|
126
128
|
//#endregion
|
|
127
|
-
export {
|
|
129
|
+
export { b as ObjectActionBar, y as useObjectActions };
|
|
@@ -4,76 +4,79 @@ import { IconBtn as n } from "../primitives/IconBtn.js";
|
|
|
4
4
|
import { useText as r } from "../../hooks/useText.js";
|
|
5
5
|
import { Select as i } from "../primitives/Fields.js";
|
|
6
6
|
import { renderField as a } from "../fields/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { useRowTenant as o } from "../../hooks/useRowTenant.js";
|
|
8
|
+
import { buildMassEditTargets as s } from "../../lib/mass-edit.js";
|
|
9
|
+
import { useCallback as c, useMemo as l, useState as u } from "react";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/actions/PropertyGridEditor.tsx
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
|
|
12
|
+
var p = Symbol.for("declarion.mass-edit.multiple");
|
|
13
|
+
function m({ entity: e, filterTargets: t, selectedRows: n, value: i, onChange: a }) {
|
|
14
|
+
let u = r(), m = r("errors"), { tenantId: g } = o(e), _ = l(() => s(u, e, t, n ?? [], g), [
|
|
15
|
+
u,
|
|
15
16
|
e,
|
|
16
|
-
t
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
t,
|
|
18
|
+
n,
|
|
19
|
+
g
|
|
20
|
+
]), b = l(() => Object.keys(i).map((e) => {
|
|
21
|
+
let t = _.find((t) => t.code === e);
|
|
19
22
|
return t ? {
|
|
20
23
|
target: t,
|
|
21
24
|
value: i[e]
|
|
22
25
|
} : null;
|
|
23
|
-
}).filter((e) => e !== null), [i,
|
|
24
|
-
let e = new Set(
|
|
25
|
-
return
|
|
26
|
-
}, [
|
|
27
|
-
let t =
|
|
28
|
-
r[e.code] = t ===
|
|
26
|
+
}).filter((e) => e !== null), [i, _]), x = l(() => {
|
|
27
|
+
let e = new Set(b.map((e) => e.target.code));
|
|
28
|
+
return _.filter((t) => !e.has(t.code));
|
|
29
|
+
}, [b, _]), S = c((e) => {
|
|
30
|
+
let t = y(e, n), r = { ...i };
|
|
31
|
+
r[e.code] = t === p ? void 0 : t, a(r);
|
|
29
32
|
}, [
|
|
30
33
|
i,
|
|
31
34
|
n,
|
|
32
35
|
a
|
|
33
|
-
]),
|
|
36
|
+
]), C = c((e, t) => {
|
|
34
37
|
a({
|
|
35
38
|
...i,
|
|
36
39
|
[e]: t
|
|
37
40
|
});
|
|
38
|
-
}, [i, a]),
|
|
41
|
+
}, [i, a]), w = c((e) => {
|
|
39
42
|
let t = { ...i };
|
|
40
43
|
delete t[e], a(t);
|
|
41
44
|
}, [i, a]);
|
|
42
|
-
return e ? /* @__PURE__ */
|
|
45
|
+
return e ? /* @__PURE__ */ f("div", {
|
|
43
46
|
style: {
|
|
44
47
|
display: "flex",
|
|
45
48
|
flexDirection: "column",
|
|
46
49
|
gap: 8
|
|
47
50
|
},
|
|
48
51
|
children: [
|
|
49
|
-
|
|
52
|
+
b.length === 0 && /* @__PURE__ */ d("div", {
|
|
50
53
|
style: {
|
|
51
54
|
fontSize: 12,
|
|
52
55
|
color: "var(--text-3)"
|
|
53
56
|
},
|
|
54
|
-
children:
|
|
57
|
+
children: u("action.mass_edit.no_targets", "No targets selected. Add a field, status, or property to edit across all selected rows.")
|
|
55
58
|
}),
|
|
56
|
-
|
|
59
|
+
b.map((e) => /* @__PURE__ */ d(h, {
|
|
57
60
|
row: e,
|
|
58
|
-
onChange: (t) =>
|
|
59
|
-
onRemove: () =>
|
|
61
|
+
onChange: (t) => C(e.target.code, t),
|
|
62
|
+
onRemove: () => w(e.target.code)
|
|
60
63
|
}, e.target.code)),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
targets:
|
|
63
|
-
onPick:
|
|
64
|
+
/* @__PURE__ */ d(v, {
|
|
65
|
+
targets: x,
|
|
66
|
+
onPick: S
|
|
64
67
|
})
|
|
65
68
|
]
|
|
66
|
-
}) : /* @__PURE__ */
|
|
69
|
+
}) : /* @__PURE__ */ d("div", {
|
|
67
70
|
style: {
|
|
68
71
|
fontSize: 12,
|
|
69
72
|
color: "var(--text-3)"
|
|
70
73
|
},
|
|
71
|
-
children:
|
|
74
|
+
children: m("action.mass_edit_entity_missing", "Entity schema unavailable. Mass edit requires an entity-bound action.")
|
|
72
75
|
});
|
|
73
76
|
}
|
|
74
|
-
function
|
|
77
|
+
function h({ row: t, onChange: i, onRemove: a }) {
|
|
75
78
|
let o = r(), { target: s } = t;
|
|
76
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ f("div", {
|
|
77
80
|
"data-testid": "mass-edit-row",
|
|
78
81
|
style: {
|
|
79
82
|
display: "grid",
|
|
@@ -82,7 +85,7 @@ function m({ row: t, onChange: i, onRemove: a }) {
|
|
|
82
85
|
alignItems: "center"
|
|
83
86
|
},
|
|
84
87
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ d("div", {
|
|
86
89
|
style: {
|
|
87
90
|
fontSize: 12.5,
|
|
88
91
|
color: "var(--text-2)"
|
|
@@ -90,28 +93,28 @@ function m({ row: t, onChange: i, onRemove: a }) {
|
|
|
90
93
|
title: s.code,
|
|
91
94
|
children: s.label
|
|
92
95
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ d(g, {
|
|
94
97
|
row: t,
|
|
95
98
|
onChange: i
|
|
96
99
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
icon: /* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ d(n, {
|
|
101
|
+
icon: /* @__PURE__ */ d(e.x, { size: 12 }),
|
|
99
102
|
onClick: a,
|
|
100
103
|
title: o("action.mass_edit.remove_target", "Remove target")
|
|
101
104
|
})
|
|
102
105
|
]
|
|
103
106
|
});
|
|
104
107
|
}
|
|
105
|
-
function
|
|
106
|
-
let n = r(), { target: o } = e, s = e.value ===
|
|
108
|
+
function g({ row: e, onChange: t }) {
|
|
109
|
+
let n = r(), { target: o } = e, s = e.value === p, c = s ? n("action.mass_edit.multiple_values", "<multiple values>") : void 0, l = s ? "" : e.value;
|
|
107
110
|
if (o.kind === "status" && o.statusGroup) {
|
|
108
111
|
let e = o.statusGroup.statuses.map((e) => ({
|
|
109
112
|
value: e.code,
|
|
110
113
|
label: n(e.name) || e.code
|
|
111
114
|
}));
|
|
112
|
-
return /* @__PURE__ */
|
|
115
|
+
return /* @__PURE__ */ d("div", {
|
|
113
116
|
"data-testid": `value-${o.code}`,
|
|
114
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ d(i, {
|
|
115
118
|
value: typeof l == "string" ? l : "",
|
|
116
119
|
options: e,
|
|
117
120
|
onChange: t,
|
|
@@ -119,18 +122,18 @@ function h({ row: e, onChange: t }) {
|
|
|
119
122
|
})
|
|
120
123
|
});
|
|
121
124
|
}
|
|
122
|
-
let
|
|
123
|
-
return /* @__PURE__ */
|
|
125
|
+
let u = _(o);
|
|
126
|
+
return /* @__PURE__ */ f("div", {
|
|
124
127
|
"data-testid": `value-${o.code}`,
|
|
125
128
|
style: { position: "relative" },
|
|
126
129
|
children: [a({
|
|
127
|
-
field:
|
|
130
|
+
field: u,
|
|
128
131
|
fieldName: o.bare,
|
|
129
132
|
value: l ?? "",
|
|
130
133
|
mode: "edit",
|
|
131
134
|
onChange: t,
|
|
132
135
|
t: n
|
|
133
|
-
}), c && /* @__PURE__ */
|
|
136
|
+
}), c && /* @__PURE__ */ d("div", {
|
|
134
137
|
"data-testid": `multiple-values-${o.code}`,
|
|
135
138
|
style: {
|
|
136
139
|
fontSize: 11,
|
|
@@ -142,7 +145,7 @@ function h({ row: e, onChange: t }) {
|
|
|
142
145
|
})]
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
|
-
function
|
|
148
|
+
function _(e) {
|
|
146
149
|
if (e.kind === "field" && e.field) return e.field;
|
|
147
150
|
if (e.kind === "property" && e.property) {
|
|
148
151
|
let t = e.property;
|
|
@@ -157,15 +160,15 @@ function g(e) {
|
|
|
157
160
|
}
|
|
158
161
|
return { type: "string" };
|
|
159
162
|
}
|
|
160
|
-
function
|
|
161
|
-
let o = r(), [s, c] =
|
|
162
|
-
return n.length === 0 ? null : s ? /* @__PURE__ */
|
|
163
|
+
function v({ targets: n, onPick: a }) {
|
|
164
|
+
let o = r(), [s, c] = u(!1);
|
|
165
|
+
return n.length === 0 ? null : s ? /* @__PURE__ */ d("div", {
|
|
163
166
|
"data-testid": "mass-edit-target-picker",
|
|
164
167
|
style: {
|
|
165
168
|
alignSelf: "flex-start",
|
|
166
169
|
minWidth: 220
|
|
167
170
|
},
|
|
168
|
-
children: /* @__PURE__ */
|
|
171
|
+
children: /* @__PURE__ */ d(i, {
|
|
169
172
|
value: "",
|
|
170
173
|
placeholder: o("action.mass_edit.select_target", "Select target..."),
|
|
171
174
|
options: n.map((e) => ({
|
|
@@ -177,26 +180,26 @@ function _({ targets: n, onPick: a }) {
|
|
|
177
180
|
t && a(t), c(!1);
|
|
178
181
|
}
|
|
179
182
|
})
|
|
180
|
-
}) : /* @__PURE__ */
|
|
183
|
+
}) : /* @__PURE__ */ f(t, {
|
|
181
184
|
kind: "ghost",
|
|
182
185
|
onClick: () => c(!0),
|
|
183
186
|
style: { alignSelf: "flex-start" },
|
|
184
187
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ d(e.plus, { size: 12 }),
|
|
186
189
|
" ",
|
|
187
190
|
o("action.mass_edit.add_target", "Add target")
|
|
188
191
|
]
|
|
189
192
|
});
|
|
190
193
|
}
|
|
191
|
-
function
|
|
194
|
+
function y(e, t) {
|
|
192
195
|
if (!t || t.length === 0 || e.kind !== "field") return;
|
|
193
196
|
let n, r = !1;
|
|
194
197
|
for (let i of t) {
|
|
195
198
|
let t = i[e.bare];
|
|
196
199
|
if (!r) n = t, r = !0;
|
|
197
|
-
else if (n !== t) return
|
|
200
|
+
else if (n !== t) return p;
|
|
198
201
|
}
|
|
199
202
|
return n;
|
|
200
203
|
}
|
|
201
204
|
//#endregion
|
|
202
|
-
export {
|
|
205
|
+
export { p as MULTIPLE_VALUES, m as PropertyGridEditor, y as detectCommonValue };
|
|
@@ -8,83 +8,85 @@ import { applyRowState as s } from "../../lib/actions.js";
|
|
|
8
8
|
import { useActionRunner as c } from "./ActionRunner.js";
|
|
9
9
|
import { dispatchAction as l } from "../../lib/action-dispatch.js";
|
|
10
10
|
import { RowMenuContent as u } from "./ResponsiveActionBar.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { useRowTenant as d } from "../../hooks/useRowTenant.js";
|
|
12
|
+
import { variantActionCodesForRecord as f } from "../../lib/variants.js";
|
|
13
|
+
import { useCallback as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
14
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
14
15
|
//#region src/components/actions/RowActionsKebab.tsx
|
|
15
|
-
function
|
|
16
|
-
let
|
|
16
|
+
function y({ actions: y, objectIds: b, row: x, entity: S, onSuccess: C, preMenu: w, divider: T, size: E = 22, align: D = "end" }) {
|
|
17
|
+
let O = r(), k = d(S), A = r("errors"), j = h(null), [M, N] = g(!1), [P, F] = g(null), { run: I } = c(), L = m(() => {
|
|
17
18
|
let e = {};
|
|
18
|
-
for (let { code: t, action: n } of
|
|
19
|
+
for (let { code: t, action: n } of y) e[t] = n;
|
|
19
20
|
return e;
|
|
20
|
-
}, [
|
|
21
|
-
let e =
|
|
21
|
+
}, [y]), R = m(() => {
|
|
22
|
+
let e = y.map(({ code: e }) => ({
|
|
22
23
|
kind: "action",
|
|
23
24
|
code: e,
|
|
24
25
|
enabled: !0,
|
|
25
26
|
reason: null
|
|
26
27
|
}));
|
|
27
|
-
return
|
|
28
|
+
return x ? s(O, e, L, void 0, x, [], k, f(S, x)) : e;
|
|
28
29
|
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
O,
|
|
31
|
+
y,
|
|
32
|
+
L,
|
|
33
|
+
x,
|
|
34
|
+
S,
|
|
35
|
+
k
|
|
36
|
+
]), z = p((e, t) => {
|
|
37
|
+
N(!1);
|
|
38
|
+
let n = l(A, e, t, { row: x });
|
|
39
|
+
if (n !== null) return I({
|
|
38
40
|
action: t,
|
|
39
|
-
title:
|
|
40
|
-
row:
|
|
41
|
+
title: O(t.display?.name) || e,
|
|
42
|
+
row: x,
|
|
41
43
|
execute: async (e) => {
|
|
42
|
-
let t = await o(n, a(e,
|
|
43
|
-
return
|
|
44
|
+
let t = await o(n, a(e, b));
|
|
45
|
+
return C?.(), t;
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
48
|
}, [
|
|
47
|
-
D,
|
|
48
49
|
O,
|
|
49
|
-
|
|
50
|
+
A,
|
|
51
|
+
I,
|
|
52
|
+
x,
|
|
50
53
|
b,
|
|
51
|
-
|
|
52
|
-
S
|
|
54
|
+
C
|
|
53
55
|
]);
|
|
54
|
-
return !
|
|
56
|
+
return !w && R.length === 0 ? null : /* @__PURE__ */ v("div", {
|
|
55
57
|
className: "sl-row-actions",
|
|
56
|
-
"data-open":
|
|
58
|
+
"data-open": M ? "true" : void 0,
|
|
57
59
|
style: {
|
|
58
60
|
display: "flex",
|
|
59
61
|
alignItems: "center",
|
|
60
62
|
justifyContent: "flex-end"
|
|
61
63
|
},
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
-
ref:
|
|
64
|
-
size:
|
|
65
|
-
icon: /* @__PURE__ */
|
|
66
|
-
onClick: () =>
|
|
67
|
-
title:
|
|
68
|
-
}), /* @__PURE__ */
|
|
69
|
-
open:
|
|
70
|
-
anchor:
|
|
71
|
-
onClose: () =>
|
|
64
|
+
children: [/* @__PURE__ */ _(t, {
|
|
65
|
+
ref: j,
|
|
66
|
+
size: E,
|
|
67
|
+
icon: /* @__PURE__ */ _(e.more, { size: Math.round(E * .55) }),
|
|
68
|
+
onClick: () => N((e) => !e),
|
|
69
|
+
title: O("action.menu.title", "Actions")
|
|
70
|
+
}), /* @__PURE__ */ v(n, {
|
|
71
|
+
open: M,
|
|
72
|
+
anchor: j.current,
|
|
73
|
+
onClose: () => N(!1),
|
|
72
74
|
width: 200,
|
|
73
|
-
align:
|
|
75
|
+
align: D,
|
|
74
76
|
children: [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
layout:
|
|
79
|
-
entityActions:
|
|
80
|
-
onRun:
|
|
81
|
-
loading:
|
|
82
|
-
onLoadingChange:
|
|
83
|
-
row:
|
|
77
|
+
w,
|
|
78
|
+
w && T && R.length > 0 && /* @__PURE__ */ _(i, { divider: !0 }),
|
|
79
|
+
/* @__PURE__ */ _(u, {
|
|
80
|
+
layout: R,
|
|
81
|
+
entityActions: L,
|
|
82
|
+
onRun: z,
|
|
83
|
+
loading: P,
|
|
84
|
+
onLoadingChange: F,
|
|
85
|
+
row: x
|
|
84
86
|
})
|
|
85
87
|
]
|
|
86
88
|
})]
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
91
|
//#endregion
|
|
90
|
-
export {
|
|
92
|
+
export { y as RowActionsKebab };
|