@plumile/backoffice-react 0.1.185 → 0.1.188

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.
Files changed (55) hide show
  1. package/lib/esm/auth/authRefreshNotice.css.js +1 -2
  2. package/lib/esm/auth/login/loginPage.css.js +1 -2
  3. package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js +349 -404
  4. package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
  5. package/lib/esm/components/backoffice/actions/backofficeEntityActionFormDialog.css.js +1 -1
  6. package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js +1 -1
  7. package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js +1 -1
  8. package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js +3 -3
  9. package/lib/esm/components/backoffice/detail/BackofficeRelationsSummaryGrid.js +1 -1
  10. package/lib/esm/components/backoffice/detail/BackofficeUsageCostBreakdown.js +10 -10
  11. package/lib/esm/components/backoffice/detail/backofficeDetailErrorList.css.js +1 -1
  12. package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +1 -1
  13. package/lib/esm/components/backoffice/detail/backofficeEntitySummaryHeader.css.js +2 -1
  14. package/lib/esm/components/backoffice/detail/backofficeRelationsSummaryGrid.css.js +1 -1
  15. package/lib/esm/components/backoffice/detail/backofficeUsageCostBreakdown.css.js +1 -1
  16. package/lib/esm/components/backoffice/filters/backofficeFilterAction.css.js +2 -1
  17. package/lib/esm/components/backoffice/filters/deferredFilterSearchInput.css.js +2 -1
  18. package/lib/esm/components/backoffice/filters/entityIdFilterField.css.js +1 -1
  19. package/lib/esm/components/backoffice/hub/BackofficeHubTemplate.js +4 -4
  20. package/lib/esm/components/backoffice/hub/backofficeHubTemplate.css.js +1 -1
  21. package/lib/esm/components/backoffice/layout/backofficeSidebarActions.css.js +1 -1
  22. package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js +2 -2
  23. package/lib/esm/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.js +1 -2
  24. package/lib/esm/components/backoffice/links/BackofficeLinkContent.js +1 -1
  25. package/lib/esm/components/backoffice/links/backofficeLink.css.js +1 -1
  26. package/lib/esm/components/backoffice/list/RowFlagsCell.css.js +1 -1
  27. package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js +1 -1
  28. package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +1 -1
  29. package/lib/esm/components/backoffice/refs/backofficeRelatedCountLink.css.js +1 -1
  30. package/lib/esm/components/backoffice/routing/backofficeContentBoundary.css.js +1 -1
  31. package/lib/esm/components/backoffice/routing/backofficeContentError.css.js +1 -1
  32. package/lib/esm/components/backoffice/routing/backofficeContentFallback.css.js +1 -1
  33. package/lib/esm/components/backoffice/routing/backofficeRouteFallback.css.js +1 -1
  34. package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js +1 -1
  35. package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js +1 -1
  36. package/lib/esm/components/backoffice/shared/backofficeFilterableCell.css.js +3 -3
  37. package/lib/esm/components/backoffice/shared/backofficeInlineFilterRow.css.js +1 -1
  38. package/lib/esm/components/backoffice/tools/BackofficeToolsDocPanel.js +1 -1
  39. package/lib/esm/components/backoffice/tools/BackofficeToolsJsonForm.js +4 -4
  40. package/lib/esm/components/backoffice/tools/backofficeToolsDocPanel.css.js +1 -1
  41. package/lib/esm/components/backoffice/tools/backofficeToolsForm.css.js +1 -1
  42. package/lib/esm/pages/BackofficeEntityDetailPage.helpers.js.map +1 -1
  43. package/lib/esm/pages/BackofficeEntityListPage.helpers.js.map +1 -1
  44. package/lib/esm/pages/backofficeDashboardPage.css.js +1 -1
  45. package/lib/esm/pages/backofficeEntityDetailPage.css.js +1 -1
  46. package/lib/esm/pages/backofficeEntityListPage.css.js +1 -1
  47. package/lib/esm/storybook/relay/RelayStory.css.js +1 -1
  48. package/lib/esm/style.css +1 -1
  49. package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts +1 -1
  50. package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
  51. package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts +2 -2
  52. package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts.map +1 -1
  53. package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts +1 -1
  54. package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts.map +1 -1
  55. package/package.json +13 -13
@@ -4,31 +4,31 @@ import { useBackofficeConfig as n } from "../../../provider/BackofficeConfigCont
4
4
  import { EntityIdFilterField as r } from "../filters/EntityIdFilterField.js";
5
5
  import { EntityIdPickerDialog as i } from "../pickers/EntityIdPickerDialog.js";
6
6
  import { resolveToastSpec as a, resolveToastViewActions as o } from "./toastViewAction.js";
7
- import { actions as s, checkboxGroup as c, fieldset as l, form as u, legend as ee } from "./backofficeEntityActionFormDialog.css.js";
8
- import { useCallback as d, useContext as f, useEffect as p, useId as te, useMemo as m, useState as h } from "react";
9
- import { Fragment as ne, jsx as g, jsxs as _ } from "react/jsx-runtime";
10
- import { useTranslation as re } from "react-i18next";
11
- import { Button as ie } from "@plumile/ui/atomic/atoms/button/Button.js";
12
- import { FormError as ae } from "@plumile/ui/atomic/molecules/form_error/FormError.js";
13
- import { Form as oe } from "@plumile/ui/atomic/molecules/form/Form.js";
7
+ import { actions as s, checkboxGroup as c, form as l } from "./backofficeEntityActionFormDialog.css.js";
8
+ import { useCallback as u, useContext as d, useEffect as f, useId as ee, useMemo as p, useState as m } from "react";
9
+ import { Fragment as te, jsx as h, jsxs as g } from "react/jsx-runtime";
10
+ import { useTranslation as ne } from "react-i18next";
11
+ import { Button as _ } from "@plumile/ui/atomic/atoms/button/Button.js";
12
+ import { FormError as re } from "@plumile/ui/atomic/molecules/form_error/FormError.js";
13
+ import { Form as ie } from "@plumile/ui/atomic/molecules/form/Form.js";
14
14
  import * as v from "react-relay";
15
15
  import { Input as y } from "@plumile/ui/atomic/atoms/input/Input.js";
16
- import { Label as b } from "@plumile/ui/atomic/atoms/label/Label.js";
17
- import { Modal as se } from "@plumile/ui/atomic/atoms/modal/Modal.js";
18
- import { Textarea as x } from "@plumile/ui/atomic/atoms/textarea/Textarea.js";
19
- import { CheckboxField as S } from "@plumile/ui/atomic/molecules/checkbox_field/CheckboxField.js";
20
- import { FormGroup as C } from "@plumile/ui/atomic/molecules/form/FormGroup.js";
21
- import { HighlightCode as ce } from "@plumile/ui/atomic/molecules/highlight/HighlightCode.js";
22
- import { useToast as le } from "@plumile/ui/atomic/molecules/toast/ToastProvider.js";
23
- import { BackofficeFormSection as ue } from "@plumile/ui/backoffice/molecules/backoffice_form_section/BackofficeFormSection.js";
24
- import { SimpleSelect as de } from "@plumile/ui/components/select/SimpleSelect.js";
25
- import fe from "@plumile/router/routing/RoutingContext.js";
16
+ import { Modal as ae } from "@plumile/ui/atomic/atoms/modal/Modal.js";
17
+ import { Textarea as b } from "@plumile/ui/atomic/atoms/textarea/Textarea.js";
18
+ import { CheckboxField as x } from "@plumile/ui/atomic/molecules/checkbox_field/CheckboxField.js";
19
+ import { FormGrid as oe } from "@plumile/ui/atomic/molecules/form_grid/FormGrid.js";
20
+ import { FormFieldLayout as S } from "@plumile/ui/atomic/molecules/form_field_layout/FormFieldLayout.js";
21
+ import { HighlightCode as se } from "@plumile/ui/atomic/molecules/highlight/HighlightCode.js";
22
+ import { useToast as ce } from "@plumile/ui/atomic/molecules/toast/ToastProvider.js";
23
+ import { BackofficeFormSection as le } from "@plumile/ui/backoffice/molecules/backoffice_form_section/BackofficeFormSection.js";
24
+ import { SimpleSelect as ue } from "@plumile/ui/components/select/SimpleSelect.js";
25
+ import de from "@plumile/router/routing/RoutingContext.js";
26
26
  //#region src/components/backoffice/actions/BackofficeEntityActionFormDialog.tsx
27
- var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T = (e) => typeof e == "object" && !!e && !Array.isArray(e), he = (e) => {
28
- if (!T(e)) return null;
29
- for (let t of Object.values(e)) if (T(t) && ("status" in t || "result" in t)) return t;
27
+ var { commitMutation: fe, useRelayEnvironment: pe } = v, C = (e, t) => e(t), w = (e) => typeof e == "object" && !!e && !Array.isArray(e), me = (e) => {
28
+ if (!w(e)) return null;
29
+ for (let t of Object.values(e)) if (w(t) && ("status" in t || "result" in t)) return t;
30
30
  return null;
31
- }, E = (e) => {
31
+ }, T = (e) => {
32
32
  let t = {};
33
33
  return e.forEach((e) => {
34
34
  if (e.kind === "boolean") {
@@ -45,43 +45,45 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
45
45
  }
46
46
  t[e.id] = "";
47
47
  }), t;
48
- }, D = (e, t) => e.kind === "number" ? typeof t == "number" ? String(t) : typeof t == "string" ? t : "" : e.kind === "multiEnum" ? Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim() !== "") : [] : e.kind === "boolean" ? t === !0 : typeof t == "string" ? t : t ?? "", ge = (e, t) => {
49
- let n = E(e.fields);
48
+ }, E = (e, t) => e.kind === "number" ? typeof t == "number" ? String(t) : typeof t == "string" ? t : "" : e.kind === "multiEnum" ? Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim() !== "") : [] : e.kind === "boolean" ? t === !0 : typeof t == "string" ? t : t ?? "", he = (e, t) => {
49
+ let n = T(e.fields);
50
50
  if (e.getInitialValues == null) return n;
51
- let r = e.getInitialValues(t), i = { ...n };
51
+ let r = e.getInitialValues(t);
52
+ if (!w(r)) return n;
53
+ let i = { ...n };
52
54
  return e.fields.forEach((e) => {
53
- e.id in r && (i[e.id] = D(e, r[e.id]));
55
+ e.id in r && (i[e.id] = E(e, r[e.id]));
54
56
  }), i;
55
- }, O = ({ isOpen: v, action: E, node: D, onClose: O, onSuccess: k }) => {
56
- let { t: A } = re(), { t: j } = e(), { entities: M } = n(), N = f(fe), P = me(), F = le(), _e = te(), [I, L] = h({}), [ve, R] = h(null), [ye, z] = h({}), [B, V] = h(!1), [H, U] = h(null), [W, G] = h(null), [K, q] = h(null);
57
- p(() => {
58
- v && (L(ge(E, D)), R(null), z({}), U(null), G(null));
57
+ }, D = ({ isOpen: v, action: T, node: E, onClose: D, onSuccess: O }) => {
58
+ let { t: k } = ne(), { t: A } = e(), { entities: j } = n(), M = d(de), N = pe(), P = ce(), ge = ee(), [F, I] = m({}), [_e, L] = m(null), [ve, R] = m({}), [z, B] = m(!1), [V, H] = m(null), [U, W] = m(null), [G, K] = m(null);
59
+ f(() => {
60
+ v && (I(he(T, E)), L(null), R({}), H(null), W(null));
59
61
  }, [
60
- E,
62
+ T,
61
63
  v,
62
- D
64
+ E
63
65
  ]);
64
- let J = d(() => {
65
- B || O();
66
- }, [B, O]), Y = d((e, t) => {
67
- L((n) => ({
66
+ let q = u(() => {
67
+ z || D();
68
+ }, [z, D]), J = u((e, t) => {
69
+ I((n) => ({
68
70
  ...n,
69
71
  [e]: t
70
- })), z((t) => {
72
+ })), R((t) => {
71
73
  if (t[e] == null) return t;
72
74
  let { [e]: n, ...r } = t;
73
75
  return r;
74
76
  });
75
- }, []), be = w(E.label, A), X = d((e) => j("actions.form.errors.required", { label: e }), [j]), xe = d((e) => j("actions.form.errors.invalidNumber", { label: e }), [j]), Se = d((e) => j("actions.form.errors.invalidJson", { label: e }), [j]), Ce = d((e) => j("actions.form.errors.invalidJsonObject", { label: e }), [j]), we = d((e) => j("actions.form.errors.invalidJsonArray", { label: e }), [j]), Te = d(() => {
77
+ }, []), ye = C(T.label, k), Y = u((e) => A("actions.form.errors.required", { label: e }), [A]), X = u((e) => A("actions.form.errors.invalidNumber", { label: e }), [A]), be = u((e) => A("actions.form.errors.invalidJson", { label: e }), [A]), xe = u((e) => A("actions.form.errors.invalidJsonObject", { label: e }), [A]), Se = u((e) => A("actions.form.errors.invalidJsonArray", { label: e }), [A]), Ce = u(() => {
76
78
  let e = {};
77
- for (let t of E.fields) {
78
- let n = w(t.label, A), r = I[t.id];
79
+ for (let t of T.fields) {
80
+ let n = C(t.label, k), r = F[t.id];
79
81
  switch (t.kind) {
80
82
  case "text": {
81
83
  let i = "";
82
84
  if (typeof r == "string" && (i = r.trim()), i === "") {
83
85
  if (t.required) return {
84
- error: X(n),
86
+ error: Y(n),
85
87
  fieldId: t.id
86
88
  };
87
89
  break;
@@ -93,7 +95,7 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
93
95
  let i = "";
94
96
  if (typeof r == "string" && (i = r.trim()), i === "") {
95
97
  if (t.required) return {
96
- error: X(n),
98
+ error: Y(n),
97
99
  fieldId: t.id
98
100
  };
99
101
  break;
@@ -105,14 +107,14 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
105
107
  let i = "";
106
108
  if (typeof r == "string" ? i = r.trim() : typeof r == "number" && Number.isFinite(r) && (i = String(r)), i === "") {
107
109
  if (t.required) return {
108
- error: X(n),
110
+ error: Y(n),
109
111
  fieldId: t.id
110
112
  };
111
113
  break;
112
114
  }
113
115
  let a = Number(i);
114
116
  if (!Number.isFinite(a)) return {
115
- error: xe(n),
117
+ error: X(n),
116
118
  fieldId: t.id
117
119
  };
118
120
  e[t.id] = a;
@@ -122,7 +124,7 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
122
124
  let i = "";
123
125
  if (typeof r == "string" && (i = r.trim()), i === "") {
124
126
  if (t.required) return {
125
- error: X(n),
127
+ error: Y(n),
126
128
  fieldId: t.id
127
129
  };
128
130
  break;
@@ -132,17 +134,17 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
132
134
  a = JSON.parse(i);
133
135
  } catch {
134
136
  return {
135
- error: Se(n),
137
+ error: be(n),
136
138
  fieldId: t.id
137
139
  };
138
140
  }
139
141
  let o = t.jsonType ?? "object";
140
- if (o === "object" && !T(a)) return {
141
- error: Ce(n),
142
+ if (o === "object" && !w(a)) return {
143
+ error: xe(n),
142
144
  fieldId: t.id
143
145
  };
144
146
  if (o === "array" && !Array.isArray(a)) return {
145
- error: we(n),
147
+ error: Se(n),
146
148
  fieldId: t.id
147
149
  };
148
150
  e[t.id] = a;
@@ -152,7 +154,7 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
152
154
  let i = "";
153
155
  if (typeof r == "string" && (i = r.trim()), i === "") {
154
156
  if (t.required) return {
155
- error: X(n),
157
+ error: Y(n),
156
158
  fieldId: t.id
157
159
  };
158
160
  break;
@@ -167,7 +169,7 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
167
169
  let i = "";
168
170
  if (typeof r == "string" && (i = r.trim()), i === "") {
169
171
  if (t.required) return {
170
- error: X(n),
172
+ error: Y(n),
171
173
  fieldId: t.id
172
174
  };
173
175
  break;
@@ -179,7 +181,7 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
179
181
  let i = [];
180
182
  if (Array.isArray(r) && (i = r.filter((e) => typeof e == "string" && e.trim() !== "")), i.length === 0) {
181
183
  if (t.required) return {
182
- error: X(n),
184
+ error: Y(n),
183
185
  fieldId: t.id
184
186
  };
185
187
  break;
@@ -192,461 +194,404 @@ var { commitMutation: pe, useRelayEnvironment: me } = v, w = (e, t) => e(t), T =
192
194
  }
193
195
  return { values: e };
194
196
  }, [
195
- E.fields,
196
- we,
197
+ T.fields,
197
198
  Se,
198
- Ce,
199
+ be,
199
200
  xe,
200
201
  X,
201
- A,
202
- I
203
- ]), Z = d(() => {
204
- if (B) return;
205
- R(null), z({});
206
- let e = Te();
202
+ Y,
203
+ k,
204
+ F
205
+ ]), Z = u(() => {
206
+ if (z) return;
207
+ L(null), R({});
208
+ let e = Ce();
207
209
  if ("error" in e) {
208
- R(e.error), e.fieldId != null && z({ [e.fieldId]: e.error });
210
+ L(e.error), e.fieldId != null && R({ [e.fieldId]: e.error });
209
211
  return;
210
212
  }
211
213
  let n;
212
214
  try {
213
- n = E.getVariables(D, e.values);
215
+ n = T.getVariables(E, e.values);
214
216
  } catch {
215
- R(j("actions.form.errors.invalidPayload"));
217
+ L(A("actions.form.errors.invalidPayload"));
216
218
  return;
217
219
  }
218
- V(!0), pe(P, {
219
- mutation: E.mutation,
220
+ B(!0), fe(N, {
221
+ mutation: T.mutation,
220
222
  variables: n,
221
223
  updater: (e) => {
222
- E.updater?.(e, D);
224
+ T.updater?.(e, E);
223
225
  },
224
226
  onCompleted: (e) => {
225
- V(!1);
226
- let n = he(e);
227
+ B(!1);
228
+ let n = me(e);
227
229
  if (n != null) {
228
- let e = j("actions.form.errors.invalidPayload");
229
- E.toasts?.error?.message == null ? E.toasts?.error?.title != null && (e = w(E.toasts.error.title, A)) : e = w(E.toasts.error.message, A);
230
+ let e = A("actions.form.errors.invalidPayload");
231
+ T.toasts?.error?.message == null ? T.toasts?.error?.title != null && (e = C(T.toasts.error.title, k)) : e = C(T.toasts.error.message, k);
230
232
  let r = t(n, {
231
233
  defaultErrorMessage: e,
232
234
  mapReason: (e) => {
233
- let t = E.mapErrorReason?.(e, D);
234
- return t == null ? null : typeof t == "function" ? w(t, A) : String(t);
235
+ let t = T.mapErrorReason?.(e, E);
236
+ return t == null ? null : typeof t == "function" ? C(t, k) : String(t);
235
237
  }
236
238
  });
237
239
  if (!r.ok) {
238
240
  let e = Error(r.message);
239
- if (R(r.message), E.onError?.(e, D), E.toasts?.error != null) {
240
- let e = w(E.toasts.error.title, A), t;
241
- E.toasts.error.message != null && (t = w(E.toasts.error.message, A)), F.error(e, t);
241
+ if (L(r.message), T.onError?.(e, E), T.toasts?.error != null) {
242
+ let e = C(T.toasts.error.title, k), t;
243
+ T.toasts.error.message != null && (t = C(T.toasts.error.message, k)), P.error(e, t);
242
244
  }
243
245
  return;
244
246
  }
245
247
  }
246
- E.onCompleted?.(e, D);
248
+ T.onCompleted?.(e, E);
247
249
  let r = !1;
248
- if (E.result?.render != null && E.result.render(e, D) != null && (r = !0, G(e)), E.toasts?.success != null) {
249
- let t = a(E.toasts.success, A), n = o({
250
- toast: E.toasts.success,
250
+ if (T.result?.render != null && T.result.render(e, E) != null && (r = !0, W(e)), T.toasts?.success != null) {
251
+ let t = a(T.toasts.success, k), n = o({
252
+ toast: T.toasts.success,
251
253
  response: e,
252
- node: D,
253
- tApp: A,
254
- entities: M,
255
- defaultLabel: j("actions.view"),
254
+ node: E,
255
+ tApp: k,
256
+ entities: j,
257
+ defaultLabel: A("actions.view"),
256
258
  navigateTo: (e) => {
257
- N?.history.push({ pathname: e });
259
+ M?.history.push({ pathname: e });
258
260
  }
259
261
  });
260
- F.push({
262
+ P.push({
261
263
  kind: "info",
262
264
  title: t.title,
263
265
  message: t.message,
264
266
  actions: n
265
267
  });
266
268
  }
267
- if (E.result != null) {
268
- let t = E.result.getValue(e, D);
269
+ if (T.result != null) {
270
+ let t = T.result.getValue(e, E);
269
271
  if (typeof t == "string" && t.trim() !== "") {
270
- U(t), k?.();
272
+ H(t), O?.();
271
273
  return;
272
274
  }
273
275
  }
274
276
  if (r) {
275
- k?.();
277
+ O?.();
276
278
  return;
277
279
  }
278
- k?.(), O();
280
+ O?.(), D();
279
281
  },
280
282
  onError: (e) => {
281
- if (V(!1), R(j("actions.form.errors.submitFailed")), E.onError?.(e, D), E.toasts?.error != null) {
282
- let e = w(E.toasts.error.title, A), t;
283
- E.toasts.error.message != null && (t = w(E.toasts.error.message, A)), F.error(e, t);
283
+ if (B(!1), L(A("actions.form.errors.submitFailed")), T.onError?.(e, E), T.toasts?.error != null) {
284
+ let e = C(T.toasts.error.title, k), t;
285
+ T.toasts.error.message != null && (t = C(T.toasts.error.message, k)), P.error(e, t);
284
286
  }
285
287
  }
286
288
  });
287
289
  }, [
290
+ T,
291
+ Ce,
292
+ j,
293
+ N,
294
+ z,
288
295
  E,
289
- Te,
290
- M,
291
- P,
292
- B,
293
296
  D,
294
297
  O,
295
- k,
296
- N?.history,
297
- j,
298
+ M?.history,
298
299
  A,
299
- F
300
- ]), Ee = d((e) => {
300
+ k,
301
+ P
302
+ ]), we = u((e) => {
301
303
  e.preventDefault(), Z();
302
- }, [Z]), Q = m(() => E.result == null ? null : w(E.result.label, A), [E.result, A]), De = m(() => E.result?.render == null || W == null ? null : E.result.render(W, D), [
303
- E.result,
304
- D,
305
- W
306
- ]), $ = H != null && Q != null || De != null, Oe = w(E.label, A);
307
- return v ? /* @__PURE__ */ _(ne, { children: [/* @__PURE__ */ g(se, {
304
+ }, [Z]), Q = p(() => T.result == null ? null : C(T.result.label, k), [T.result, k]), Te = p(() => T.result?.render == null || U == null ? null : T.result.render(U, E), [
305
+ T.result,
306
+ E,
307
+ U
308
+ ]), $ = V != null && Q != null || Te != null, Ee = C(T.label, k);
309
+ return v ? /* @__PURE__ */ g(te, { children: [/* @__PURE__ */ h(ae, {
308
310
  isOpen: v,
309
- onClose: J,
310
- title: be,
311
+ onClose: q,
312
+ title: ye,
311
313
  initialFocus: "first-form-control",
312
- footer: /* @__PURE__ */ _("div", {
314
+ footer: /* @__PURE__ */ g("div", {
313
315
  className: s,
314
- children: [/* @__PURE__ */ g(ie, {
316
+ children: [/* @__PURE__ */ h(_, {
315
317
  type: "button",
316
318
  variant: "secondary",
317
319
  size: "small",
318
- disabled: B,
319
- onClick: J,
320
- children: j("actions.form.cancel")
321
- }), !$ && /* @__PURE__ */ g(ie, {
320
+ disabled: z,
321
+ onClick: q,
322
+ children: A("actions.form.cancel")
323
+ }), !$ && /* @__PURE__ */ h(_, {
322
324
  type: "submit",
323
325
  variant: "primary",
324
326
  size: "small",
325
- disabled: B,
326
- isLoading: B,
327
- loadingLabel: j("actions.form.submitting"),
327
+ disabled: z,
328
+ isLoading: z,
329
+ loadingLabel: A("actions.form.submitting"),
328
330
  onClick: Z,
329
- children: Oe
331
+ children: Ee
330
332
  })]
331
333
  }),
332
- children: /* @__PURE__ */ _(oe, {
333
- onSubmit: Ee,
334
- className: u,
334
+ children: /* @__PURE__ */ g(ie, {
335
+ onSubmit: we,
336
+ className: l,
335
337
  children: [
336
- /* @__PURE__ */ g(ae, { message: ve }),
337
- /* @__PURE__ */ g(ue, { children: E.fields.map((e) => {
338
- let t = w(e.label, A), n = null;
339
- e.description != null && (n = w(e.description, A));
340
- let i = `${_e}-${e.id}`, a = `${i}-description`, o = `${i}-error`, s = ye[e.id] ?? null, u = s != null, d, f = "default";
341
- u && (d = "error", f = "error");
342
- let p;
343
- switch (n != null && s != null ? p = `${a} ${o}` : n == null ? s != null && (p = o) : p = a, e.kind) {
344
- case "text": {
345
- let r = I[e.id], c = "";
346
- typeof r == "string" && (c = r);
347
- let l;
348
- return e.placeholder != null && (l = w(e.placeholder, A)), /* @__PURE__ */ _(C, { children: [
349
- /* @__PURE__ */ g(b, {
350
- htmlFor: i,
338
+ /* @__PURE__ */ h(re, { message: _e }),
339
+ /* @__PURE__ */ h(le, { children: /* @__PURE__ */ h(oe, {
340
+ layout: "vertical",
341
+ children: T.fields.map((e) => {
342
+ let t = C(e.label, k), n = null;
343
+ e.description != null && (n = C(e.description, k));
344
+ let i = `${ge}-${e.id}`, a = `${i}-description`, o = `${i}-error`, s = ve[e.id] ?? null, l = s != null, u, d = "default";
345
+ l && (u = "error", d = "error");
346
+ let f;
347
+ switch (n != null && s != null ? f = `${a} ${o}` : n == null ? s != null && (f = o) : f = a, e.kind) {
348
+ case "text": {
349
+ let r = F[e.id], c = "";
350
+ typeof r == "string" && (c = r);
351
+ let d;
352
+ return e.placeholder != null && (d = C(e.placeholder, k)), /* @__PURE__ */ h(S, {
353
+ label: t,
354
+ labelFor: i,
351
355
  required: e.required,
352
- children: t
353
- }),
354
- n != null && /* @__PURE__ */ g("span", {
355
- id: a,
356
- className: "txvbqb96 txvbqb1bff",
357
- children: n
358
- }),
359
- /* @__PURE__ */ g(y, {
360
- id: i,
361
- type: "text",
362
- value: c,
363
- placeholder: l,
364
- "aria-describedby": p,
365
- "aria-invalid": u,
366
- disabled: B,
367
- variant: d,
368
- onChange: (t) => {
369
- Y(e.id, t.target.value);
370
- },
371
- fullWidth: !0
372
- }),
373
- s != null && /* @__PURE__ */ g("span", {
374
- id: o,
375
- className: "txvbqb96 txvbqb1bij",
376
- children: s
377
- })
378
- ] }, e.id);
379
- }
380
- case "textarea": {
381
- let r = I[e.id], c = "";
382
- typeof r == "string" && (c = r);
383
- let l;
384
- return e.placeholder != null && (l = w(e.placeholder, A)), /* @__PURE__ */ _(C, { children: [
385
- /* @__PURE__ */ g(b, {
386
- htmlFor: i,
356
+ description: n,
357
+ descriptionId: a,
358
+ error: s,
359
+ errorId: o,
360
+ children: /* @__PURE__ */ h(y, {
361
+ id: i,
362
+ type: "text",
363
+ value: c,
364
+ placeholder: d,
365
+ "aria-describedby": f,
366
+ "aria-invalid": l,
367
+ disabled: z,
368
+ variant: u,
369
+ onChange: (t) => {
370
+ J(e.id, t.target.value);
371
+ },
372
+ fullWidth: !0
373
+ })
374
+ }, e.id);
375
+ }
376
+ case "textarea": {
377
+ let r = F[e.id], c = "";
378
+ typeof r == "string" && (c = r);
379
+ let d;
380
+ return e.placeholder != null && (d = C(e.placeholder, k)), /* @__PURE__ */ h(S, {
381
+ label: t,
382
+ labelFor: i,
387
383
  required: e.required,
388
- children: t
389
- }),
390
- n != null && /* @__PURE__ */ g("span", {
391
- id: a,
392
- className: "txvbqb96 txvbqb1bff",
393
- children: n
394
- }),
395
- /* @__PURE__ */ g(x, {
396
- id: i,
397
- value: c,
398
- placeholder: l,
399
- rows: e.rows ?? 8,
400
- "aria-describedby": p,
401
- "aria-invalid": u,
402
- disabled: B,
403
- variant: d,
404
- onChange: (t) => {
405
- Y(e.id, t.target.value);
406
- },
407
- fullWidth: !0
408
- }),
409
- s != null && /* @__PURE__ */ g("span", {
410
- id: o,
411
- className: "txvbqb96 txvbqb1bij",
412
- children: s
413
- })
414
- ] }, e.id);
415
- }
416
- case "number": {
417
- let r = I[e.id], c = "";
418
- typeof r == "string" && (c = r);
419
- let l;
420
- return e.placeholder != null && (l = w(e.placeholder, A)), /* @__PURE__ */ _(C, { children: [
421
- /* @__PURE__ */ g(b, {
422
- htmlFor: i,
384
+ description: n,
385
+ descriptionId: a,
386
+ error: s,
387
+ errorId: o,
388
+ children: /* @__PURE__ */ h(b, {
389
+ id: i,
390
+ value: c,
391
+ placeholder: d,
392
+ rows: e.rows ?? 8,
393
+ "aria-describedby": f,
394
+ "aria-invalid": l,
395
+ disabled: z,
396
+ variant: u,
397
+ onChange: (t) => {
398
+ J(e.id, t.target.value);
399
+ },
400
+ fullWidth: !0
401
+ })
402
+ }, e.id);
403
+ }
404
+ case "number": {
405
+ let r = F[e.id], c = "";
406
+ typeof r == "string" && (c = r);
407
+ let d;
408
+ return e.placeholder != null && (d = C(e.placeholder, k)), /* @__PURE__ */ h(S, {
409
+ label: t,
410
+ labelFor: i,
423
411
  required: e.required,
424
- children: t
425
- }),
426
- n != null && /* @__PURE__ */ g("span", {
427
- id: a,
428
- className: "txvbqb96 txvbqb1bff",
429
- children: n
430
- }),
431
- /* @__PURE__ */ g(y, {
432
- id: i,
433
- type: "number",
434
- value: c,
435
- placeholder: l,
436
- "aria-describedby": p,
437
- "aria-invalid": u,
438
- disabled: B,
439
- variant: d,
440
- onChange: (t) => {
441
- Y(e.id, t.target.value);
442
- },
443
- fullWidth: !0
444
- }),
445
- s != null && /* @__PURE__ */ g("span", {
446
- id: o,
447
- className: "txvbqb96 txvbqb1bij",
448
- children: s
449
- })
450
- ] }, e.id);
451
- }
452
- case "json": {
453
- let r = I[e.id], c = "";
454
- typeof r == "string" && (c = r);
455
- let l;
456
- return e.placeholder != null && (l = w(e.placeholder, A)), /* @__PURE__ */ _(C, { children: [
457
- /* @__PURE__ */ g(b, {
458
- htmlFor: i,
412
+ description: n,
413
+ descriptionId: a,
414
+ error: s,
415
+ errorId: o,
416
+ children: /* @__PURE__ */ h(y, {
417
+ id: i,
418
+ type: "number",
419
+ value: c,
420
+ placeholder: d,
421
+ "aria-describedby": f,
422
+ "aria-invalid": l,
423
+ disabled: z,
424
+ variant: u,
425
+ onChange: (t) => {
426
+ J(e.id, t.target.value);
427
+ },
428
+ fullWidth: !0
429
+ })
430
+ }, e.id);
431
+ }
432
+ case "json": {
433
+ let r = F[e.id], c = "";
434
+ typeof r == "string" && (c = r);
435
+ let d;
436
+ return e.placeholder != null && (d = C(e.placeholder, k)), /* @__PURE__ */ h(S, {
437
+ label: t,
438
+ labelFor: i,
459
439
  required: e.required,
460
- children: t
461
- }),
462
- n != null && /* @__PURE__ */ g("span", {
463
- id: a,
464
- className: "txvbqb96 txvbqb1bff",
465
- children: n
466
- }),
467
- /* @__PURE__ */ g(x, {
468
- id: i,
469
- value: c,
470
- placeholder: l,
471
- rows: 8,
472
- "aria-describedby": p,
473
- "aria-invalid": u,
474
- disabled: B,
475
- variant: d,
476
- onChange: (t) => {
477
- Y(e.id, t.target.value);
478
- },
479
- fullWidth: !0
480
- }),
481
- s != null && /* @__PURE__ */ g("span", {
482
- id: o,
483
- className: "txvbqb96 txvbqb1bij",
484
- children: s
485
- })
486
- ] }, e.id);
487
- }
488
- case "enum": {
489
- let r = I[e.id], c = "";
490
- typeof r == "string" && (c = r);
491
- let l = e.options.map((e) => ({
492
- id: e.value,
493
- value: e.value,
494
- label: w(e.label, A)
495
- }));
496
- return /* @__PURE__ */ _(C, { children: [
497
- /* @__PURE__ */ g(b, {
498
- id: `${i}-label`,
440
+ description: n,
441
+ descriptionId: a,
442
+ error: s,
443
+ errorId: o,
444
+ children: /* @__PURE__ */ h(b, {
445
+ id: i,
446
+ value: c,
447
+ placeholder: d,
448
+ rows: 8,
449
+ "aria-describedby": f,
450
+ "aria-invalid": l,
451
+ disabled: z,
452
+ variant: u,
453
+ onChange: (t) => {
454
+ J(e.id, t.target.value);
455
+ },
456
+ fullWidth: !0
457
+ })
458
+ }, e.id);
459
+ }
460
+ case "enum": {
461
+ let r = F[e.id], c = "";
462
+ typeof r == "string" && (c = r);
463
+ let u = e.options.map((e) => ({
464
+ id: e.value,
465
+ value: e.value,
466
+ label: C(e.label, k)
467
+ }));
468
+ return /* @__PURE__ */ h(S, {
469
+ label: t,
470
+ labelId: `${i}-label`,
499
471
  required: e.required,
500
- children: t
501
- }),
502
- n != null && /* @__PURE__ */ g("span", {
503
- id: a,
504
- className: "txvbqb96 txvbqb1bff",
505
- children: n
506
- }),
507
- /* @__PURE__ */ g(de, {
508
- options: l,
509
- value: c,
510
- placeholder: t,
511
- ariaDescribedBy: p,
512
- ariaInvalid: u,
513
- ariaLabelledBy: `${i}-label`,
514
- isDisabled: B,
515
- state: f,
472
+ description: n,
473
+ descriptionId: a,
474
+ error: s,
475
+ errorId: o,
476
+ children: /* @__PURE__ */ h(ue, {
477
+ options: u,
478
+ value: c,
479
+ placeholder: t,
480
+ ariaDescribedBy: f,
481
+ ariaInvalid: l,
482
+ ariaLabelledBy: `${i}-label`,
483
+ isDisabled: z,
484
+ state: d,
485
+ onChange: (t) => {
486
+ J(e.id, t);
487
+ }
488
+ })
489
+ }, e.id);
490
+ }
491
+ case "boolean": {
492
+ let r = F[e.id] === !0;
493
+ return /* @__PURE__ */ h(S, { children: /* @__PURE__ */ h(x, {
494
+ id: i,
495
+ label: t,
496
+ helperText: n ?? void 0,
497
+ error: s ?? void 0,
498
+ checked: r,
499
+ disabled: z,
516
500
  onChange: (t) => {
517
- Y(e.id, t);
501
+ J(e.id, t.target.checked);
518
502
  }
519
- }),
520
- s != null && /* @__PURE__ */ g("span", {
521
- id: o,
522
- className: "txvbqb96 txvbqb1bij",
523
- children: s
524
- })
525
- ] }, e.id);
526
- }
527
- case "boolean": {
528
- let r = I[e.id] === !0;
529
- return /* @__PURE__ */ g(C, { children: /* @__PURE__ */ g(S, {
530
- id: i,
531
- label: t,
532
- helperText: n ?? void 0,
533
- error: s ?? void 0,
534
- checked: r,
535
- disabled: B,
536
- onChange: (t) => {
537
- Y(e.id, t.target.checked);
538
- }
539
- }) }, e.id);
540
- }
541
- case "entityId": {
542
- let c = I[e.id], l = "";
543
- return typeof c == "string" && (l = c), /* @__PURE__ */ _(C, { children: [
544
- /* @__PURE__ */ g(b, {
545
- htmlFor: i,
503
+ }) }, e.id);
504
+ }
505
+ case "entityId": {
506
+ let c = F[e.id], u = "";
507
+ return typeof c == "string" && (u = c), /* @__PURE__ */ h(S, {
508
+ label: t,
509
+ labelFor: i,
546
510
  required: e.required,
547
- children: t
548
- }),
549
- n != null && /* @__PURE__ */ g("span", {
550
- id: a,
551
- className: "txvbqb96 txvbqb1bff",
552
- children: n
553
- }),
554
- /* @__PURE__ */ g(r, {
555
- id: i,
511
+ description: n,
512
+ descriptionId: a,
513
+ error: s,
514
+ errorId: o,
515
+ children: /* @__PURE__ */ h(r, {
516
+ id: i,
517
+ label: t,
518
+ value: u,
519
+ ariaDescribedBy: f,
520
+ ariaInvalid: l,
521
+ disabled: z,
522
+ onPick: () => {
523
+ K({
524
+ fieldId: e.id,
525
+ entity: e.entity,
526
+ label: t
527
+ });
528
+ },
529
+ onClear: () => {
530
+ J(e.id, "");
531
+ }
532
+ })
533
+ }, e.id);
534
+ }
535
+ case "multiEnum": {
536
+ let r = F[e.id], u = `${i}-legend`, d = [];
537
+ return Array.isArray(r) && (d = r.filter((e) => typeof e == "string")), /* @__PURE__ */ h(S, {
538
+ as: "fieldset",
556
539
  label: t,
557
- value: l,
558
- ariaDescribedBy: p,
559
- ariaInvalid: u,
560
- disabled: B,
561
- onPick: () => {
562
- q({
563
- fieldId: e.id,
564
- entity: e.entity,
565
- label: t
566
- });
567
- },
568
- onClear: () => {
569
- Y(e.id, "");
570
- }
571
- }),
572
- s != null && /* @__PURE__ */ g("span", {
573
- id: o,
574
- className: "txvbqb96 txvbqb1bij",
575
- children: s
576
- })
577
- ] }, e.id);
578
- }
579
- case "multiEnum": {
580
- let r = I[e.id], d = `${i}-legend`, f = [];
581
- return Array.isArray(r) && (f = r.filter((e) => typeof e == "string")), /* @__PURE__ */ _(C, { children: [/* @__PURE__ */ _("fieldset", {
582
- className: l,
583
- children: [
584
- /* @__PURE__ */ _("legend", {
585
- id: d,
586
- className: ee,
587
- children: [t, e.required && /* @__PURE__ */ g("span", {
588
- className: "txvbqbq3e txvbqb1bij",
589
- children: "*"
590
- })]
591
- }),
592
- n != null && /* @__PURE__ */ g("span", {
593
- id: a,
594
- className: "txvbqb96 txvbqb1bff",
595
- children: n
596
- }),
597
- /* @__PURE__ */ g("div", {
540
+ labelId: u,
541
+ required: e.required,
542
+ description: n,
543
+ descriptionId: a,
544
+ error: s,
545
+ errorId: o,
546
+ children: /* @__PURE__ */ h("div", {
598
547
  className: c,
599
548
  role: "group",
600
- "aria-labelledby": d,
601
- "aria-describedby": p,
602
- "aria-invalid": u,
549
+ "aria-labelledby": u,
550
+ "aria-describedby": f,
551
+ "aria-invalid": l,
603
552
  children: e.options.map((t, n) => {
604
- let r = w(t.label, A), a = f.includes(t.value);
605
- return /* @__PURE__ */ g(S, {
553
+ let r = C(t.label, k), a = d.includes(t.value);
554
+ return /* @__PURE__ */ h(x, {
606
555
  id: `${i}-${n}`,
607
556
  label: r,
608
557
  checked: a,
609
- disabled: B,
558
+ disabled: z,
610
559
  onChange: (n) => {
611
- let r = f;
612
- n.target.checked ? f.includes(t.value) || (r = [...f, t.value]) : r = f.filter((e) => e !== t.value), Y(e.id, r);
560
+ let r = d;
561
+ n.target.checked ? d.includes(t.value) || (r = [...d, t.value]) : r = d.filter((e) => e !== t.value), J(e.id, r);
613
562
  }
614
563
  }, `${t.value}-${n}`);
615
564
  })
616
565
  })
617
- ]
618
- }), s != null && /* @__PURE__ */ g("span", {
619
- id: o,
620
- className: "txvbqb96 txvbqb1bij",
621
- children: s
622
- })] }, e.id);
566
+ }, e.id);
567
+ }
568
+ default: return null;
623
569
  }
624
- default: return null;
625
- }
570
+ })
626
571
  }) }),
627
- $ && /* @__PURE__ */ _("div", {
572
+ $ && /* @__PURE__ */ g("div", {
628
573
  className: "txvbqbfpn txvbqbh4x txvbqbhdl",
629
- children: [H != null && Q != null && /* @__PURE__ */ g(ce, {
574
+ children: [V != null && Q != null && /* @__PURE__ */ h(se, {
630
575
  badgeLabel: Q,
631
- copyCode: H,
632
- fallbackCodeText: H
633
- }), De]
576
+ copyCode: V,
577
+ fallbackCodeText: V
578
+ }), Te]
634
579
  })
635
580
  ]
636
581
  })
637
- }), /* @__PURE__ */ g(i, {
638
- isOpen: K != null,
639
- entity: K?.entity ?? "",
640
- title: K?.label ?? "",
582
+ }), /* @__PURE__ */ h(i, {
583
+ isOpen: G != null,
584
+ entity: G?.entity ?? "",
585
+ title: G?.label ?? "",
641
586
  onClose: () => {
642
- q(null);
587
+ K(null);
643
588
  },
644
589
  onSelectId: (e) => {
645
- K != null && (Y(K.fieldId, e), q(null));
590
+ G != null && (J(G.fieldId, e), K(null));
646
591
  }
647
592
  })] }) : null;
648
593
  };
649
594
  //#endregion
650
- export { O as BackofficeEntityActionFormDialog, O as default };
595
+ export { D as BackofficeEntityActionFormDialog, D as default };
651
596
 
652
597
  //# sourceMappingURL=BackofficeEntityActionFormDialog.js.map