@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
|
@@ -1,108 +1,108 @@
|
|
|
1
1
|
import { Icon as e } from "../primitives/Icons.js";
|
|
2
2
|
import { Btn as t } from "../primitives/Btn.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
3
|
+
import { Pill as n } from "../primitives/Pill.js";
|
|
4
|
+
import { useText as r } from "../../hooks/useText.js";
|
|
5
|
+
import { SectionCard as i } from "../primitives/SectionCard.js";
|
|
6
|
+
import { Spinner as a } from "../primitives/Spinner.js";
|
|
7
|
+
import { useAllParams as o, useCarrierParamOverrides as s } from "../../hooks/useParams.js";
|
|
8
|
+
import { EditParamDialog as c, ErrorLine as l, ResetParamControl as u, ValuePreview as d, paramSourceName as f, useParamRefLabels as p } from "./param-editors.js";
|
|
9
|
+
import { useMemo as m, useState as h } from "react";
|
|
10
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
12
11
|
//#region src/components/params/ParamsBlock.tsx
|
|
13
|
-
function
|
|
12
|
+
function v(e) {
|
|
14
13
|
return e === "tenant" || e === "role" || e === "user" ? e : "object";
|
|
15
14
|
}
|
|
16
|
-
function
|
|
15
|
+
function y(e, t) {
|
|
17
16
|
return e ? e.filter((e) => e.scopes?.includes(t)) : [];
|
|
18
17
|
}
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
carrierEntityCode:
|
|
22
|
-
rowId:
|
|
23
|
-
enabled:
|
|
24
|
-
}),
|
|
25
|
-
await
|
|
18
|
+
function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w }) {
|
|
19
|
+
let T = r(), E = r("errors"), D = o(), O = m(() => y(D.data, x), [D.data, x]), [k, A] = h(null), j = p(O), { overrideByCode: M, missingParams: N, isLoading: P, error: F, clearError: I, save: L, reset: R } = s({
|
|
20
|
+
carrierEntityCode: b,
|
|
21
|
+
rowId: S,
|
|
22
|
+
enabled: O.length > 0
|
|
23
|
+
}), z = async (e, t) => {
|
|
24
|
+
await L(e, t) && A((t) => t === e ? null : t);
|
|
26
25
|
};
|
|
27
|
-
return
|
|
28
|
-
title:
|
|
29
|
-
icon:
|
|
30
|
-
children: [
|
|
26
|
+
return O.length === 0 ? null : /* @__PURE__ */ _(i, {
|
|
27
|
+
title: C ?? T("params.title", "Parameters"),
|
|
28
|
+
icon: w ?? /* @__PURE__ */ g(e.settings, { size: 14 }),
|
|
29
|
+
children: [N ? /* @__PURE__ */ g(l, { text: E("param.overrides_unreadable", "The current parameter overrides could not be read.") }) : P ? /* @__PURE__ */ g("div", {
|
|
31
30
|
style: { padding: "8px 0" },
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
}) : /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ g(a, { size: 16 })
|
|
32
|
+
}) : /* @__PURE__ */ _("div", {
|
|
34
33
|
style: {
|
|
35
34
|
display: "flex",
|
|
36
35
|
flexDirection: "column",
|
|
37
36
|
gap: 10
|
|
38
37
|
},
|
|
39
|
-
children: [
|
|
40
|
-
let
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
"data-testid": `param-row-${
|
|
38
|
+
children: [F && !k && /* @__PURE__ */ g(l, { text: F }), O.map((r) => {
|
|
39
|
+
let i = M.get(r.code), a = i !== void 0, o = a && r.source === v(x);
|
|
40
|
+
return /* @__PURE__ */ _("div", {
|
|
41
|
+
"data-testid": `param-row-${r.code}`,
|
|
43
42
|
style: {
|
|
44
43
|
display: "flex",
|
|
45
44
|
alignItems: "center",
|
|
46
45
|
gap: 10
|
|
47
46
|
},
|
|
48
47
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ g("div", {
|
|
50
49
|
style: {
|
|
51
50
|
flex: 1,
|
|
52
51
|
minWidth: 0,
|
|
53
52
|
fontSize: 12.5,
|
|
54
53
|
fontWeight: 500
|
|
55
54
|
},
|
|
56
|
-
children:
|
|
55
|
+
children: T(r.name) || r.code
|
|
57
56
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
type:
|
|
60
|
-
value:
|
|
61
|
-
values:
|
|
57
|
+
/* @__PURE__ */ g(d, {
|
|
58
|
+
type: r.type,
|
|
59
|
+
value: r.value,
|
|
60
|
+
values: r.values,
|
|
61
|
+
label: j(r)
|
|
62
62
|
}),
|
|
63
|
-
|
|
63
|
+
o && /* @__PURE__ */ g(n, {
|
|
64
64
|
tone: "violet",
|
|
65
65
|
size: "xs",
|
|
66
|
-
children:
|
|
66
|
+
children: T("params.overridden", "overridden")
|
|
67
67
|
}),
|
|
68
|
-
|
|
69
|
-
"data-testid": `param-not-applied-${
|
|
70
|
-
title:
|
|
71
|
-
value: JSON.stringify(
|
|
72
|
-
source: f(
|
|
68
|
+
a && !o && /* @__PURE__ */ g("span", {
|
|
69
|
+
"data-testid": `param-not-applied-${r.code}`,
|
|
70
|
+
title: T("params.block.not_applied_hint", "You set {value}, and it no longer satisfies this parameter's declaration. Source of the value in effect: {source}. Reset to remove what you set, or edit it to a value the declaration accepts.", {
|
|
71
|
+
value: JSON.stringify(i.value),
|
|
72
|
+
source: f(T, r.source)
|
|
73
73
|
}),
|
|
74
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ g(n, {
|
|
75
75
|
tone: "amber",
|
|
76
76
|
size: "xs",
|
|
77
|
-
children:
|
|
77
|
+
children: T("params.not_applied", "not applied")
|
|
78
78
|
})
|
|
79
79
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ g(t, {
|
|
81
81
|
size: "xs",
|
|
82
|
-
icon: /* @__PURE__ */
|
|
82
|
+
icon: /* @__PURE__ */ g(e.edit, { size: 12 }),
|
|
83
83
|
onClick: () => {
|
|
84
|
-
|
|
84
|
+
I(), A(r);
|
|
85
85
|
},
|
|
86
|
-
children:
|
|
86
|
+
children: T("params.edit", "Edit")
|
|
87
87
|
}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
a && /* @__PURE__ */ g(u, {
|
|
89
|
+
param: r,
|
|
90
|
+
description: T("params.reset_confirm.block_description", "The value set here is removed, and the value it inherits applies again."),
|
|
91
|
+
onReset: (e) => void R(e)
|
|
92
92
|
})
|
|
93
93
|
]
|
|
94
|
-
},
|
|
94
|
+
}, r.code);
|
|
95
95
|
})]
|
|
96
|
-
}),
|
|
97
|
-
param:
|
|
98
|
-
current:
|
|
99
|
-
error:
|
|
96
|
+
}), k && /* @__PURE__ */ g(c, {
|
|
97
|
+
param: k,
|
|
98
|
+
current: M.get(k.code)?.value ?? k.value,
|
|
99
|
+
error: F,
|
|
100
100
|
onCancel: () => {
|
|
101
|
-
|
|
101
|
+
A(null), I();
|
|
102
102
|
},
|
|
103
|
-
onSave: (e) =>
|
|
103
|
+
onSave: (e) => z(k, e)
|
|
104
104
|
})]
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
|
-
export {
|
|
108
|
+
export { b as ParamsBlock };
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../lib/display-value.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { useSchema as t } from "../../hooks/useSchema.js";
|
|
3
|
+
import { pluralText as n } from "../../lib/language.js";
|
|
4
|
+
import { Icon as r } from "../primitives/Icons.js";
|
|
5
|
+
import { Btn as i } from "../primitives/Btn.js";
|
|
6
|
+
import { useText as a } from "../../hooks/useText.js";
|
|
7
|
+
import { Spinner as o } from "../primitives/Spinner.js";
|
|
8
|
+
import { FieldLabel as s } from "../primitives/Fields.js";
|
|
9
|
+
import { ModalFrame as c } from "../shared/ModalFrame.js";
|
|
10
|
+
import { ConfirmDialog as l } from "../shared/ConfirmDialog.js";
|
|
11
|
+
import { renderField as u } from "../fields/index.js";
|
|
12
|
+
import { refLabel as d, useRefRecords as f } from "../../hooks/useRefRecords.js";
|
|
13
|
+
import { useState as p } from "react";
|
|
14
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
15
|
//#region src/components/params/param-editors.tsx
|
|
12
|
-
var
|
|
16
|
+
var _ = {
|
|
13
17
|
object: ["params.source.object", "Record"],
|
|
14
18
|
user: ["params.source.user", "User"],
|
|
15
19
|
role: ["params.source.role", "Role"],
|
|
@@ -18,12 +22,29 @@ var f = {
|
|
|
18
22
|
yaml: ["params.source.yaml", "Default"],
|
|
19
23
|
none: ["params.source.none", "Not set"]
|
|
20
24
|
};
|
|
21
|
-
function
|
|
22
|
-
let n =
|
|
25
|
+
function v(e, t) {
|
|
26
|
+
let n = _[t];
|
|
23
27
|
return n ? e(n[0], n[1]) : t;
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
var y = r["undo-2"];
|
|
30
|
+
function b({ param: e, description: t, onReset: n }) {
|
|
31
|
+
let r = a(), [o, s] = p(!1);
|
|
32
|
+
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(i, {
|
|
33
|
+
size: "xs",
|
|
34
|
+
icon: /* @__PURE__ */ h(y, { size: 12 }),
|
|
35
|
+
onClick: () => s(!0),
|
|
36
|
+
children: r("params.reset", "Reset to default")
|
|
37
|
+
}), /* @__PURE__ */ h(l, {
|
|
38
|
+
open: o,
|
|
39
|
+
onOpenChange: s,
|
|
40
|
+
title: r("params.reset_confirm.title", "Reset {name} to default?", { name: r(e.name) || e.code }),
|
|
41
|
+
description: t,
|
|
42
|
+
confirmLabel: r("params.reset", "Reset to default"),
|
|
43
|
+
onConfirm: () => n(e)
|
|
44
|
+
})] });
|
|
45
|
+
}
|
|
46
|
+
function x({ text: e }) {
|
|
47
|
+
return /* @__PURE__ */ g("div", {
|
|
27
48
|
style: {
|
|
28
49
|
padding: "8px 10px",
|
|
29
50
|
background: "var(--danger-soft)",
|
|
@@ -33,153 +54,147 @@ function m({ text: e }) {
|
|
|
33
54
|
display: "flex",
|
|
34
55
|
gap: 6
|
|
35
56
|
},
|
|
36
|
-
children: [/* @__PURE__ */
|
|
57
|
+
children: [/* @__PURE__ */ h(r.info, { size: 13 }), /* @__PURE__ */ h("span", { children: e })]
|
|
37
58
|
});
|
|
38
59
|
}
|
|
39
|
-
function
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
function S(e) {
|
|
61
|
+
let n = a(), { data: r } = t(), i = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
|
|
62
|
+
ref: e.ref,
|
|
63
|
+
value: e.value
|
|
64
|
+
}] : []), { refs: o } = f(i, void 0, r?.entities);
|
|
65
|
+
return (e) => e.ref?.entity ? d(n, o, e.ref, e.value, r?.entities) : void 0;
|
|
66
|
+
}
|
|
67
|
+
function C({ type: t, value: r, values: i, label: o, maxWidth: s = 180 }) {
|
|
68
|
+
let c = a(), l = (t) => {
|
|
69
|
+
let n = i?.find((e) => e.code === t);
|
|
70
|
+
return n && c(n.name) || e(t);
|
|
71
|
+
}, u;
|
|
72
|
+
if (o !== void 0) u = o;
|
|
73
|
+
else if (r == null) u = "—";
|
|
74
|
+
else if (i && i.length > 0) u = (Array.isArray(r) ? r.map(l).join(", ") : l(r)) || "—";
|
|
75
|
+
else if (t === "bool") u = r ? c("params.value.on", "On") : c("params.value.off", "Off");
|
|
76
|
+
else if (t === "multilang" || t === "multilang_text") u = c(r) || "—";
|
|
77
|
+
else if (t === "multilang_array" && Array.isArray(r)) u = r.map((e) => c(e)).join(", ") || "—";
|
|
78
|
+
else if (t === "json" || t === "structure") {
|
|
50
79
|
if (r && typeof r == "object") {
|
|
51
80
|
let e = Array.isArray(r) ? r.length : Object.keys(r).length;
|
|
52
|
-
|
|
81
|
+
u = `{${n(c, "params.value.keys", e, {
|
|
53
82
|
one: "{count} key",
|
|
54
83
|
other: "{count} keys"
|
|
55
84
|
})}}`;
|
|
56
|
-
} else
|
|
57
|
-
} else
|
|
58
|
-
return /* @__PURE__ */
|
|
85
|
+
} else u = e(r);
|
|
86
|
+
} else u = e(r);
|
|
87
|
+
return /* @__PURE__ */ h("span", {
|
|
59
88
|
className: "mono",
|
|
89
|
+
title: u,
|
|
60
90
|
style: {
|
|
91
|
+
display: "inline-block",
|
|
92
|
+
verticalAlign: "middle",
|
|
61
93
|
fontSize: 11.5,
|
|
62
94
|
color: "var(--text-2)",
|
|
63
|
-
maxWidth:
|
|
95
|
+
maxWidth: s,
|
|
64
96
|
overflow: "hidden",
|
|
65
97
|
textOverflow: "ellipsis",
|
|
66
98
|
whiteSpace: "nowrap"
|
|
67
99
|
},
|
|
68
|
-
children:
|
|
100
|
+
children: u
|
|
69
101
|
});
|
|
70
102
|
}
|
|
71
|
-
function
|
|
72
|
-
let
|
|
73
|
-
async function
|
|
74
|
-
|
|
103
|
+
function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
|
|
104
|
+
let d = a(), [f, m] = p(() => E(e, t)), [_, v] = p(!1), [y, b] = p(null);
|
|
105
|
+
async function S() {
|
|
106
|
+
b(null);
|
|
75
107
|
let e;
|
|
76
108
|
try {
|
|
77
|
-
e =
|
|
109
|
+
e = D(d, f);
|
|
78
110
|
} catch (e) {
|
|
79
|
-
|
|
111
|
+
b(String(e instanceof Error ? e.message : e));
|
|
80
112
|
return;
|
|
81
113
|
}
|
|
82
|
-
|
|
114
|
+
v(!0);
|
|
83
115
|
try {
|
|
84
|
-
await
|
|
116
|
+
await u(e);
|
|
85
117
|
} finally {
|
|
86
|
-
|
|
118
|
+
v(!1);
|
|
87
119
|
}
|
|
88
120
|
}
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
background: "var(--scrim)",
|
|
95
|
-
zIndex: 60
|
|
96
|
-
}
|
|
97
|
-
}), /* @__PURE__ */ d("div", {
|
|
98
|
-
"data-testid": "param-edit-dialog",
|
|
99
|
-
style: {
|
|
100
|
-
position: "fixed",
|
|
101
|
-
top: "50%",
|
|
102
|
-
left: "50%",
|
|
103
|
-
transform: "translate(-50%, -50%)",
|
|
104
|
-
zIndex: 61,
|
|
105
|
-
width: 440,
|
|
106
|
-
maxWidth: "calc(100vw - 24px)",
|
|
107
|
-
background: "var(--surface)",
|
|
108
|
-
borderRadius: "var(--radius-lg)",
|
|
109
|
-
boxShadow: "var(--shadow-lg)",
|
|
110
|
-
border: "1px solid var(--border)",
|
|
111
|
-
overflow: "hidden"
|
|
112
|
-
},
|
|
121
|
+
return /* @__PURE__ */ g(c, {
|
|
122
|
+
label: d(e.name) || e.code,
|
|
123
|
+
maxWidth: 440,
|
|
124
|
+
onClose: l,
|
|
125
|
+
testId: "param-edit-dialog",
|
|
113
126
|
children: [
|
|
114
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ g("div", {
|
|
115
128
|
style: { padding: "14px 18px 0" },
|
|
116
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ h("div", {
|
|
117
130
|
style: {
|
|
118
131
|
fontSize: 14,
|
|
119
132
|
fontWeight: 600
|
|
120
133
|
},
|
|
121
|
-
children:
|
|
122
|
-
}), e.description && /* @__PURE__ */
|
|
134
|
+
children: d(e.name) || e.code
|
|
135
|
+
}), e.description && /* @__PURE__ */ h("div", {
|
|
123
136
|
style: {
|
|
124
137
|
fontSize: 11.5,
|
|
125
138
|
color: "var(--text-3)",
|
|
126
139
|
marginTop: 2
|
|
127
140
|
},
|
|
128
|
-
children:
|
|
141
|
+
children: d(e.description)
|
|
129
142
|
})]
|
|
130
143
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ g("div", {
|
|
132
145
|
style: {
|
|
133
146
|
padding: "12px 18px 16px",
|
|
134
147
|
display: "flex",
|
|
135
148
|
flexDirection: "column",
|
|
136
|
-
gap: 10
|
|
149
|
+
gap: 10,
|
|
150
|
+
overflowY: "auto"
|
|
137
151
|
},
|
|
138
152
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ h(s, { children: d("params.value", "Value") }),
|
|
154
|
+
/* @__PURE__ */ h(T, {
|
|
141
155
|
param: e,
|
|
142
|
-
value:
|
|
143
|
-
onChange:
|
|
156
|
+
value: f,
|
|
157
|
+
onChange: m
|
|
144
158
|
}),
|
|
145
|
-
(
|
|
159
|
+
(y || n) && /* @__PURE__ */ h(x, { text: y || n })
|
|
146
160
|
]
|
|
147
161
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ g("div", {
|
|
149
163
|
style: {
|
|
150
164
|
padding: "10px 16px",
|
|
151
165
|
borderTop: "1px solid var(--divider)",
|
|
152
166
|
display: "flex",
|
|
153
167
|
gap: 8,
|
|
154
|
-
background: "var(--surface-2)"
|
|
168
|
+
background: "var(--surface-2)",
|
|
169
|
+
flexShrink: 0
|
|
155
170
|
},
|
|
156
171
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
onClick:
|
|
160
|
-
children:
|
|
172
|
+
/* @__PURE__ */ h("div", { style: { flex: 1 } }),
|
|
173
|
+
/* @__PURE__ */ h(i, {
|
|
174
|
+
onClick: l,
|
|
175
|
+
children: d("dialog.cancel", "Cancel")
|
|
161
176
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ h(i, {
|
|
163
178
|
kind: "primary",
|
|
164
|
-
icon:
|
|
165
|
-
onClick:
|
|
166
|
-
disabled:
|
|
167
|
-
children:
|
|
179
|
+
icon: h(_ ? o : r.check, { size: 13 }),
|
|
180
|
+
onClick: S,
|
|
181
|
+
disabled: _,
|
|
182
|
+
children: _ ? d("dialog.saving", "Saving…") : d("dialog.save", "Save")
|
|
168
183
|
})
|
|
169
184
|
]
|
|
170
185
|
})
|
|
171
186
|
]
|
|
172
|
-
})
|
|
187
|
+
});
|
|
173
188
|
}
|
|
174
|
-
function
|
|
175
|
-
let r =
|
|
189
|
+
function T({ param: e, value: t, onChange: n }) {
|
|
190
|
+
let r = a(), i = {
|
|
176
191
|
type: e.type,
|
|
177
192
|
structure: e.structure,
|
|
178
193
|
values: e.values,
|
|
179
194
|
ref: e.ref
|
|
180
195
|
};
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
field:
|
|
196
|
+
return /* @__PURE__ */ h(m, { children: u({
|
|
197
|
+
field: i,
|
|
183
198
|
fieldName: e.code,
|
|
184
199
|
value: t,
|
|
185
200
|
mode: "edit",
|
|
@@ -187,23 +202,23 @@ function _({ param: e, value: t, onChange: n }) {
|
|
|
187
202
|
t: r
|
|
188
203
|
}) });
|
|
189
204
|
}
|
|
190
|
-
function
|
|
205
|
+
function E(e, t) {
|
|
191
206
|
return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? {} : t ?? null;
|
|
192
207
|
}
|
|
193
|
-
function
|
|
208
|
+
function D(e, t) {
|
|
194
209
|
if (t == null) throw Error(e("params.value.required", "Enter a value."));
|
|
195
210
|
return t;
|
|
196
211
|
}
|
|
197
|
-
var
|
|
212
|
+
var O = /* @__PURE__ */ new Set([
|
|
198
213
|
"server",
|
|
199
214
|
"database",
|
|
200
215
|
"auth",
|
|
201
216
|
"sso",
|
|
202
217
|
"seeder"
|
|
203
218
|
]);
|
|
204
|
-
function
|
|
219
|
+
function k(e) {
|
|
205
220
|
let t = e.scopes ?? [];
|
|
206
|
-
return t.length === 0 ? !
|
|
221
|
+
return t.length === 0 ? !O.has(e.category ?? "") : t.includes("tenant");
|
|
207
222
|
}
|
|
208
223
|
//#endregion
|
|
209
|
-
export {
|
|
224
|
+
export { w as EditParamDialog, x as ErrorLine, b as ResetParamControl, C as ValuePreview, v as paramSourceName, k as paramTenantEditable, S as useParamRefLabels };
|
|
@@ -2,50 +2,16 @@ import { Icon as e } from "../primitives/Icons.js";
|
|
|
2
2
|
import { Btn as t } from "../primitives/Btn.js";
|
|
3
3
|
import { IconBtn as n } from "../primitives/IconBtn.js";
|
|
4
4
|
import { useText as r } from "../../hooks/useText.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ModalFrame as i } from "./ModalFrame.js";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/shared/ConfirmDialog.tsx
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
return i
|
|
11
|
-
l
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
position: "fixed",
|
|
16
|
-
inset: 0,
|
|
17
|
-
background: "var(--scrim)",
|
|
18
|
-
zIndex: 60,
|
|
19
|
-
backdropFilter: "blur(2px)"
|
|
20
|
-
}
|
|
21
|
-
}), /* @__PURE__ */ c("div", {
|
|
22
|
-
ref: _,
|
|
23
|
-
role: "dialog",
|
|
24
|
-
"aria-modal": "true",
|
|
25
|
-
"aria-label": d,
|
|
26
|
-
tabIndex: -1,
|
|
27
|
-
onKeyDown: (e) => {
|
|
28
|
-
e.key === "Escape" && u(!1);
|
|
29
|
-
},
|
|
30
|
-
style: {
|
|
31
|
-
position: "fixed",
|
|
32
|
-
top: "50%",
|
|
33
|
-
left: "50%",
|
|
34
|
-
transform: "translate(-50%, -50%)",
|
|
35
|
-
zIndex: 61,
|
|
36
|
-
width: "calc(100vw - 24px)",
|
|
37
|
-
maxWidth: 460,
|
|
38
|
-
maxHeight: "calc(var(--app-height) - var(--safe-area-top) - var(--safe-area-bottom) - 16px)",
|
|
39
|
-
background: "var(--surface)",
|
|
40
|
-
borderRadius: "var(--radius-lg)",
|
|
41
|
-
boxShadow: "var(--shadow-lg)",
|
|
42
|
-
border: "1px solid var(--border)",
|
|
43
|
-
overflow: "hidden",
|
|
44
|
-
display: "flex",
|
|
45
|
-
flexDirection: "column",
|
|
46
|
-
outline: "none"
|
|
47
|
-
},
|
|
48
|
-
children: [/* @__PURE__ */ c("div", {
|
|
8
|
+
function s({ open: s, onOpenChange: c, title: l, description: u, confirmLabel: d, onConfirm: f, destructive: p = !1 }) {
|
|
9
|
+
let m = r();
|
|
10
|
+
return s ? /* @__PURE__ */ o(i, {
|
|
11
|
+
label: l,
|
|
12
|
+
maxWidth: 460,
|
|
13
|
+
onClose: () => c(!1),
|
|
14
|
+
children: [/* @__PURE__ */ o("div", {
|
|
49
15
|
style: {
|
|
50
16
|
padding: "14px 18px",
|
|
51
17
|
display: "flex",
|
|
@@ -55,47 +21,48 @@ function l({ open: l, onOpenChange: u, title: d, description: f, confirmLabel: p
|
|
|
55
21
|
overflowY: "auto"
|
|
56
22
|
},
|
|
57
23
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ a("span", {
|
|
59
25
|
style: {
|
|
60
26
|
width: 28,
|
|
61
27
|
height: 28,
|
|
62
28
|
borderRadius: "var(--radius-md)",
|
|
63
|
-
background:
|
|
64
|
-
color:
|
|
29
|
+
background: p ? "var(--danger-soft)" : "var(--accent-soft)",
|
|
30
|
+
color: p ? "var(--danger)" : "var(--accent)",
|
|
65
31
|
display: "inline-flex",
|
|
66
32
|
alignItems: "center",
|
|
67
33
|
justifyContent: "center",
|
|
68
34
|
flexShrink: 0
|
|
69
35
|
},
|
|
70
|
-
children:
|
|
36
|
+
children: a(p ? e.trash : e.info, { size: 15 })
|
|
71
37
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ o("div", {
|
|
73
39
|
style: {
|
|
74
40
|
flex: 1,
|
|
75
41
|
minWidth: 0
|
|
76
42
|
},
|
|
77
|
-
children: [/* @__PURE__ */
|
|
43
|
+
children: [/* @__PURE__ */ a("div", {
|
|
78
44
|
style: {
|
|
79
45
|
fontSize: 14,
|
|
80
46
|
fontWeight: 600,
|
|
81
47
|
color: "var(--text)"
|
|
82
48
|
},
|
|
83
|
-
children:
|
|
84
|
-
}), /* @__PURE__ */
|
|
49
|
+
children: l
|
|
50
|
+
}), /* @__PURE__ */ a("div", {
|
|
85
51
|
style: {
|
|
86
52
|
fontSize: 11.5,
|
|
87
53
|
color: "var(--text-3)",
|
|
88
54
|
marginTop: 2
|
|
89
55
|
},
|
|
90
|
-
children:
|
|
56
|
+
children: u
|
|
91
57
|
})]
|
|
92
58
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
icon: /* @__PURE__ */
|
|
95
|
-
|
|
59
|
+
/* @__PURE__ */ a(n, {
|
|
60
|
+
icon: /* @__PURE__ */ a(e.x, { size: 14 }),
|
|
61
|
+
title: m("dialog.close", "Close"),
|
|
62
|
+
onClick: () => c(!1)
|
|
96
63
|
})
|
|
97
64
|
]
|
|
98
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ o("div", {
|
|
99
66
|
style: {
|
|
100
67
|
padding: "10px 16px",
|
|
101
68
|
borderTop: "1px solid var(--divider)",
|
|
@@ -108,22 +75,22 @@ function l({ open: l, onOpenChange: u, title: d, description: f, confirmLabel: p
|
|
|
108
75
|
flexShrink: 0
|
|
109
76
|
},
|
|
110
77
|
children: [
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
onClick: () =>
|
|
114
|
-
children:
|
|
78
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 } }),
|
|
79
|
+
/* @__PURE__ */ a(t, {
|
|
80
|
+
onClick: () => c(!1),
|
|
81
|
+
children: m("dialog.cancel", "Cancel")
|
|
115
82
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ a(t, {
|
|
117
84
|
kind: "primary",
|
|
118
|
-
danger:
|
|
85
|
+
danger: p,
|
|
119
86
|
onClick: () => {
|
|
120
|
-
|
|
87
|
+
f(), c(!1);
|
|
121
88
|
},
|
|
122
|
-
children:
|
|
89
|
+
children: d ?? m("dialog.confirm", "Confirm")
|
|
123
90
|
})
|
|
124
91
|
]
|
|
125
92
|
})]
|
|
126
|
-
})
|
|
93
|
+
}) : null;
|
|
127
94
|
}
|
|
128
95
|
//#endregion
|
|
129
|
-
export {
|
|
96
|
+
export { s as ConfirmDialog };
|