@archbase/template 3.0.22 → 3.0.25

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/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { jsx as e, Fragment as ke, jsxs as x } from "react/jsx-runtime";
2
- import { Button as We, Paper as Oe, Box as Xe, ScrollArea as Ft, LoadingOverlay as Rt, Group as se, useMantineColorScheme as Ze, Modal as ft, Flex as ge, px as Pt, Text as Te, Grid as Fe, Pagination as At, Stack as kt } from "@mantine/core";
3
- import { useForceUpdate as mt, useUncontrolled as Gt, useHotkeys as $t } from "@mantine/hooks";
4
- import { IconBug as Ke, IconDeviceFloppy as zt, IconX as Pe, IconCheck as qe, IconPlus as gt, IconEdit as pt, IconTrash as et, IconEye as bt } from "@tabler/icons-react";
5
- import { useArchbaseAppContext as Re, useValidationErrors as Lt, ValidationErrorsProvider as Et, getI18nextInstance as C, processErrorMessage as pe, useArchbaseTheme as tt, emit as Mt, useArchbaseTranslation as Ut } from "@archbase/core";
6
- import Je, { useMemo as Be, useState as O, useCallback as Q, forwardRef as St, useRef as ue, useImperativeHandle as It, useEffect as _e, Fragment as jt, Profiler as Ht, createContext as qt, useContext as Dt } from "react";
7
- import { useArchbaseV1V2Compatibility as Ge, useArchbaseDataSourceListener as nt, DataSourceEventNames as Ce, ArchbaseDataSource as Jt } from "@archbase/data";
8
- import { ArchbaseAlert as Qe, ArchbaseDialog as Ct, ArchbaseDataGrid as Tt, GridToolBarActions as _t, ArchbaseDebugInspector as Wt, ArchbaseMasonryProvider as Ot, ArchbaseMasonryResponsive as Kt, ArchbaseMasonry as Qt, ArchbaseActionButtons as Xt } from "@archbase/components";
9
- import { ArchbaseSpaceFixed as rt, ArchbaseSpaceTop as xt, ArchbaseSpaceFill as it, ArchbaseForm as Bt, ArchbaseSpaceBottom as ot } from "@archbase/layout";
10
- import { ArchbaseQueryBuilder as vt, buildFrom as Yt, ArchbaseGlobalFilter as Zt } from "@archbase/advanced";
11
- import Ye from "@rehooks/component-size";
12
- import { uniqueId as en } from "lodash";
13
- const tn = {
1
+ import { jsx as e, Fragment as Me, jsxs as c } from "react/jsx-runtime";
2
+ import { Button as We, Paper as Le, Box as he, Flex as pe, Group as oe, ActionIcon as pt, Title as Tt, Text as ye, ScrollArea as Xe, LoadingOverlay as vt, useMantineColorScheme as lt, Modal as Ct, px as Mt, Grid as be, Pagination as kt, Stack as yt, Tabs as rt, Badge as Ut } from "@mantine/core";
3
+ import { useForceUpdate as ot, useUncontrolled as Ht, useHotkeys as _t } from "@mantine/hooks";
4
+ import { IconArrowLeft as Bt, IconBug as Oe, IconDeviceFloppy as xt, IconX as Be, IconCheck as Ye, IconPlus as bt, IconEdit as wt, IconTrash as tt, IconEye as Ft } from "@tabler/icons-react";
5
+ import { useArchbaseAppContext as ze, useValidationErrors as Nt, ValidationErrorsProvider as At, getI18nextInstance as x, processErrorMessage as fe, useArchbaseTheme as at, emit as qt, useArchbaseTranslation as Jt } from "@archbase/core";
6
+ import Ze, { useMemo as He, useState as Q, useCallback as ie, forwardRef as Vt, useRef as Ae, useImperativeHandle as zt, useEffect as et, Fragment as Wt, Profiler as Ot, createContext as Kt, useContext as Pt } from "react";
7
+ import { useArchbaseV1V2Compatibility as _e, useArchbaseDataSourceListener as nt, DataSourceEventNames as Re, ArchbaseDataSource as Qt } from "@archbase/data";
8
+ import { ArchbaseAlert as Ke, ArchbaseDialog as Rt, ArchbaseDataGrid as Gt, GridToolBarActions as Xt, ArchbaseDebugInspector as Yt, ArchbaseMasonryProvider as Zt, ArchbaseMasonryResponsive as en, ArchbaseMasonry as tn, ArchbaseActionButtons as nn } from "@archbase/components";
9
+ import { ArchbaseSpaceFixed as ct, ArchbaseSpaceTop as Et, ArchbaseSpaceFill as st, ArchbaseForm as $t, ArchbaseSpaceBottom as dt } from "@archbase/layout";
10
+ import { ArchbaseQueryBuilder as St, buildFrom as rn, ArchbaseGlobalFilter as ln } from "@archbase/advanced";
11
+ import it from "@rehooks/component-size";
12
+ import { uniqueId as on } from "lodash";
13
+ const an = {
14
14
  isAvailable: !1,
15
15
  hasPermission: () => !0,
16
16
  // Default: sempre permite
@@ -21,454 +21,533 @@ const tn = {
21
21
  canEdit: !0,
22
22
  canDelete: !0,
23
23
  canView: !0
24
- }, Ae = (t) => Be(() => tn, []), yn = () => !1;
25
- function Fn(t) {
24
+ }, Pe = (t) => He(() => an, []), Sn = () => !1;
25
+ function In(t) {
26
26
  const {
27
27
  onSelect: n,
28
- onSelectMultiple: l,
28
+ onSelectMultiple: o,
29
29
  initialValue: f = null,
30
30
  initialValues: r = [],
31
31
  selectionMode: i = "single",
32
- autoClose: c = !0,
33
- onOpen: b,
34
- onClose: h
35
- } = t || {}, [v, G] = O(!1), [o, a] = O(f), [S, w] = O(r), E = Q(() => {
36
- G(!0), b?.();
37
- }, [b]), g = Q(() => {
38
- G(!1), h?.();
39
- }, [h]), d = Q(() => {
40
- a(null), w([]);
41
- }, []), R = Q(
42
- (p) => {
43
- a(p), w([p]), n?.(p), c && (G(!1), h?.());
32
+ autoClose: u = !0,
33
+ onOpen: v,
34
+ onClose: a
35
+ } = t || {}, [C, P] = Q(!1), [l, s] = Q(f), [L, I] = Q(r), w = ie(() => {
36
+ P(!0), v?.();
37
+ }, [v]), R = ie(() => {
38
+ P(!1), a?.();
39
+ }, [a]), m = ie(() => {
40
+ s(null), I([]);
41
+ }, []), D = ie(
42
+ (h) => {
43
+ s(h), I([h]), n?.(h), u && (P(!1), a?.());
44
44
  },
45
- [n, c, h]
46
- ), I = Q(
47
- (p) => {
48
- w(p), a(p.length > 0 ? p[0] : null), l?.(p), c && (G(!1), h?.());
45
+ [n, u, a]
46
+ ), N = ie(
47
+ (h) => {
48
+ I(h), s(h.length > 0 ? h[0] : null), o?.(h), u && (P(!1), a?.());
49
49
  },
50
- [l, c, h]
51
- ), L = Q(() => {
52
- G(!1), h?.();
53
- }, [h]), y = Be(
50
+ [o, u, a]
51
+ ), V = ie(() => {
52
+ P(!1), a?.();
53
+ }, [a]), F = He(
54
54
  () => ({
55
- opened: v,
56
- onClose: L,
57
- onSelect: R,
58
- onSelectMultiple: I,
55
+ opened: C,
56
+ onClose: V,
57
+ onSelect: D,
58
+ onSelectMultiple: N,
59
59
  selectionMode: i,
60
- initialSelectedItems: i === "multiple" ? S : o ? [o] : void 0
60
+ initialSelectedItems: i === "multiple" ? L : l ? [l] : void 0
61
61
  }),
62
- [v, L, R, I, i, o, S]
62
+ [C, V, D, N, i, l, L]
63
63
  );
64
64
  return {
65
65
  // Estado
66
- opened: v,
67
- selectedItem: o,
68
- selectedItems: S,
66
+ opened: C,
67
+ selectedItem: l,
68
+ selectedItems: L,
69
69
  // Ações
70
- open: E,
71
- close: g,
72
- clear: d,
73
- setSelectedItem: a,
74
- setSelectedItems: w,
70
+ open: w,
71
+ close: R,
72
+ clear: m,
73
+ setSelectedItem: s,
74
+ setSelectedItems: I,
75
75
  // Handlers
76
- handleSelect: R,
77
- handleSelectMultiple: I,
78
- handleClose: L,
76
+ handleSelect: D,
77
+ handleSelectMultiple: N,
78
+ handleClose: V,
79
79
  // Props para template
80
- lookupProps: y
80
+ lookupProps: F
81
81
  };
82
82
  }
83
- const ee = ({
83
+ const J = ({
84
84
  actionName: t,
85
85
  actionDescription: n,
86
- children: l,
86
+ children: o,
87
87
  fallback: f = null,
88
88
  autoRegister: r = !0,
89
89
  onClick: i,
90
- ...c
90
+ ...u
91
91
  }) => {
92
- const b = Ae();
93
- return Je.useEffect(() => {
94
- r && t && n && b.isAvailable && b.registerAction();
95
- }, [t, n, r, b.isAvailable, b.registerAction]), !t || !b.isAvailable ? /* @__PURE__ */ e(We, { onClick: i, ...c, children: l }) : b.hasPermission() ? /* @__PURE__ */ e(We, { onClick: i, ...c, children: l }) : /* @__PURE__ */ e(ke, { children: f });
96
- }, Rn = ({
92
+ const v = Pe();
93
+ return Ze.useEffect(() => {
94
+ r && t && n && v.isAvailable && v.registerAction();
95
+ }, [t, n, r, v.isAvailable, v.registerAction]), !t || !v.isAvailable ? /* @__PURE__ */ e(We, { onClick: i, ...u, children: o }) : v.hasPermission() ? /* @__PURE__ */ e(We, { onClick: i, ...u, children: o }) : /* @__PURE__ */ e(Me, { children: f });
96
+ }, Dn = ({
97
97
  actionName: t,
98
98
  actionDescription: n,
99
- children: l,
99
+ children: o,
100
100
  fallback: f = null,
101
101
  onClick: r,
102
102
  ...i
103
103
  }) => {
104
- const [c, b] = Je.useState(null), [h, v] = Je.useState(!1);
105
- return Je.useEffect(() => {
104
+ const [u, v] = Ze.useState(null), [a, C] = Ze.useState(!1);
105
+ return Ze.useEffect(() => {
106
106
  if (!t) {
107
- b(/* @__PURE__ */ e(We, { onClick: r, ...i, children: l }));
107
+ v(/* @__PURE__ */ e(We, { onClick: r, ...i, children: o }));
108
108
  return;
109
109
  }
110
- v(!1), b(/* @__PURE__ */ e(We, { onClick: r, ...i, children: l }));
111
- }, [t, n, l, f, i]), /* @__PURE__ */ e(ke, { children: c });
112
- }, Ee = ({
110
+ C(!1), v(/* @__PURE__ */ e(We, { onClick: r, ...i, children: o }));
111
+ }, [t, n, o, f, i]), /* @__PURE__ */ e(Me, { children: u });
112
+ }, Ge = ({
113
113
  children: t
114
- }) => /* @__PURE__ */ e(ke, { children: t }), An = (t) => Be(() => ({
114
+ }) => /* @__PURE__ */ e(Me, { children: t }), Tn = (t) => He(() => ({
115
115
  shouldWrap: !1,
116
116
  isSecurityAvailable: !1,
117
117
  hasResourceName: !!t
118
118
  }), [t]);
119
- function En({
119
+ function kn({
120
120
  innerRef: t,
121
121
  title: n,
122
- isError: l = !1,
123
- isCanceling: f = !1,
124
- isSaving: r = !1,
125
- error: i = "",
126
- clearError: c = () => {
122
+ subtitle: o,
123
+ isError: f = !1,
124
+ isCanceling: r = !1,
125
+ isSaving: i = !1,
126
+ isLoading: u = !1,
127
+ error: v = "",
128
+ clearError: a = () => {
127
129
  },
128
- autoCloseAlertError: b = 15e3,
129
- width: h = "100%",
130
- height: v = "100%",
131
- withBorder: G = !0,
132
- children: o,
133
- radius: a,
134
- variant: S,
135
- footerAlign: w = "left",
136
- footerContent: E,
137
- dataSource: g,
138
- onSave: d,
139
- onCancel: R,
140
- onBeforeSave: I,
141
- onAfterSave: L,
142
- onBeforeCancel: y,
143
- onAfterCancel: p,
144
- onError: D,
130
+ autoCloseAlertError: C = 15e3,
131
+ width: P = "100%",
132
+ height: l = "100%",
133
+ withBorder: s = !0,
134
+ children: L,
135
+ radius: I,
136
+ variant: w,
137
+ buttonsPosition: R = "footer",
138
+ saveLabel: m,
139
+ cancelLabel: D,
140
+ onBack: N,
141
+ footerAlign: V = "left",
142
+ footerContent: F,
143
+ dataSource: h,
144
+ onSave: X,
145
+ onCancel: Z,
146
+ onBeforeSave: ae,
147
+ onAfterSave: W,
148
+ onBeforeCancel: G,
149
+ onAfterCancel: M,
150
+ onError: y,
151
+ routePath: U,
152
+ onBeforeClose: ee,
153
+ useNavigationListener: E,
145
154
  // Props de segurança (opcionais)
146
- resourceName: oe,
147
- resourceDescription: te,
148
- requiredPermissions: K,
149
- fallbackComponent: M,
150
- securityOptions: B,
151
- ...A
155
+ resourceName: te,
156
+ resourceDescription: se,
157
+ requiredPermissions: ne,
158
+ fallbackComponent: H,
159
+ securityOptions: z,
160
+ ...Y
152
161
  }) {
153
- const T = Re(), [X, V] = O(l), [Y, ne] = O(i), Z = mt();
154
- Ae({
155
- autoRegisterActions: B?.autoRegisterActions ?? !0
162
+ const O = ze(), [_, ue] = Q(f), [Ce, le] = Q(v), d = ot();
163
+ Pe({
164
+ autoRegisterActions: z?.autoRegisterActions ?? !0
156
165
  });
157
- const U = Ge(
166
+ const k = _e(
158
167
  "ArchbaseFormTemplate",
159
- g,
168
+ h,
160
169
  void 0,
161
170
  void 0
162
171
  );
163
172
  nt({
164
- dataSource: g,
165
- listener: (j) => {
166
- j.type === Ce.onError && (V(!0), ne(j.error)), (j.type === Ce.afterEdit || j.type === Ce.afterInsert) && (U.isDataSourceV2 || Z());
173
+ dataSource: h,
174
+ listener: (re) => {
175
+ re.type === Re.onError && (ue(!0), le(re.error)), (re.type === Re.afterEdit || re.type === Re.afterInsert) && (k.isDataSourceV2 || d());
167
176
  }
168
177
  });
169
- const $ = Lt(), _ = async (j) => {
178
+ const $ = Nt(), we = ie((re, S) => ({
179
+ closeAllowed: ($e) => {
180
+ }
181
+ }), []), de = E || we, { closeAllowed: B } = de(U || "", () => {
182
+ ee && ee() === !1 || B();
183
+ }), me = async (re) => {
170
184
  try {
171
- d ? d(j) : (I && await I(j), g.isBrowsing() || g.save().then(() => {
172
- $?.clearAll(), L && L(j);
173
- }).catch((le) => {
174
- D && D(pe(le)), V(!0), ne(pe(le));
185
+ X ? X(re) : (ae && await ae(re), h.isBrowsing() || h.save().then(() => {
186
+ $?.clearAll(), W && W(re), E && B();
187
+ }).catch((S) => {
188
+ y && y(fe(S)), ue(!0), le(fe(S));
175
189
  }));
176
- } catch (le) {
177
- D && D(pe(le)), V(!0), ne(pe(le));
190
+ } catch (S) {
191
+ y && y(fe(S)), ue(!0), le(fe(S));
178
192
  }
179
- }, re = () => {
193
+ }, xe = () => {
180
194
  try {
181
- R ? R() : (y && y(), g.isBrowsing() || g.cancel(), $?.clearAll(), p && p());
182
- } catch (j) {
183
- D && D(pe(j)), V(!0), ne(pe(j));
195
+ Z ? Z.length > 0 ? Z(B) : Z() : (G && G(), h.isBrowsing() || h.cancel(), $?.clearAll(), M && M(), E && B());
196
+ } catch (re) {
197
+ y && y(fe(re)), ue(!0), le(fe(re));
184
198
  }
185
- }, ie = () => {
186
- c && c(), V(!1), ne("");
187
- };
199
+ }, Fe = () => {
200
+ a && a(), ue(!1), le("");
201
+ }, Ie = h && !h.isBrowsing(), A = R === "header" || R === "both", ce = R === "footer" || R === "both", Ne = () => /* @__PURE__ */ e(oe, { gap: "sm", children: Ie ? /* @__PURE__ */ c(Me, { children: [
202
+ /* @__PURE__ */ e(
203
+ J,
204
+ {
205
+ actionName: "cancel",
206
+ actionDescription: "Cancelar operação",
207
+ leftSection: /* @__PURE__ */ e(Be, { size: 16 }),
208
+ onClick: xe,
209
+ variant: "default",
210
+ loading: r,
211
+ children: D || x().t("Cancel")
212
+ }
213
+ ),
214
+ /* @__PURE__ */ e(
215
+ J,
216
+ {
217
+ actionName: "save",
218
+ actionDescription: `Salvar ${se || "registro"}`,
219
+ leftSection: /* @__PURE__ */ e(xt, { size: 16 }),
220
+ onClick: () => me(h.getCurrentRecord()),
221
+ variant: w ?? O.variant,
222
+ color: "blue",
223
+ loading: i,
224
+ children: m || x().t("Ok")
225
+ }
226
+ )
227
+ ] }) : /* @__PURE__ */ e(
228
+ J,
229
+ {
230
+ actionName: "close",
231
+ actionDescription: "Fechar formulário",
232
+ leftSection: /* @__PURE__ */ e(Be, { size: 16 }),
233
+ onClick: xe,
234
+ variant: "default",
235
+ children: x().t("Close")
236
+ }
237
+ ) }), De = () => /* @__PURE__ */ c(
238
+ he,
239
+ {
240
+ style: {
241
+ flexShrink: 0,
242
+ padding: "calc(0.625rem / 2)",
243
+ display: "flex",
244
+ justifyContent: V === "center" ? "center" : "space-between",
245
+ alignItems: "center",
246
+ gap: "1rem"
247
+ },
248
+ children: [
249
+ V === "right" && F && /* @__PURE__ */ e(he, { style: { flex: 1 }, children: F }),
250
+ Ie ? /* @__PURE__ */ c(oe, { gap: "md", children: [
251
+ /* @__PURE__ */ e(
252
+ J,
253
+ {
254
+ actionName: "save",
255
+ actionDescription: `Salvar ${se || "registro"}`,
256
+ leftSection: /* @__PURE__ */ e(xt, {}),
257
+ onClick: () => me(h.getCurrentRecord()),
258
+ disabled: h && h.isBrowsing(),
259
+ variant: w ?? O.variant,
260
+ color: "green",
261
+ children: m || `${x().t("Ok")}`
262
+ }
263
+ ),
264
+ /* @__PURE__ */ e(
265
+ J,
266
+ {
267
+ actionName: "cancel",
268
+ actionDescription: "Cancelar operação",
269
+ leftSection: /* @__PURE__ */ e(Be, {}),
270
+ onClick: xe,
271
+ disabled: h && h.isBrowsing(),
272
+ variant: w ?? O.variant,
273
+ color: "red",
274
+ children: D || `${x().t("Cancel")}`
275
+ }
276
+ )
277
+ ] }) : /* @__PURE__ */ e(oe, { gap: "md", children: /* @__PURE__ */ e(
278
+ J,
279
+ {
280
+ actionName: "close",
281
+ actionDescription: "Fechar formulário",
282
+ leftSection: /* @__PURE__ */ e(Be, {}),
283
+ onClick: xe,
284
+ variant: w ?? O.variant,
285
+ children: `${x().t("Close")}`
286
+ }
287
+ ) }),
288
+ (V === "left" || V === "center") && F && /* @__PURE__ */ e(he, { style: { flex: V === "left" ? 1 : 0, textAlign: "right" }, children: F })
289
+ ]
290
+ }
291
+ );
188
292
  return /* @__PURE__ */ e(
189
- Ee,
293
+ Ge,
190
294
  {
191
- resourceName: oe,
192
- resourceDescription: te,
193
- requiredPermissions: K,
194
- fallbackComponent: M,
195
- onSecurityReady: B?.onSecurityReady,
196
- onAccessDenied: B?.onAccessDenied,
197
- children: /* @__PURE__ */ e(Et, { children: /* @__PURE__ */ x(
198
- Oe,
295
+ resourceName: te,
296
+ resourceDescription: se,
297
+ requiredPermissions: ne,
298
+ fallbackComponent: H,
299
+ onSecurityReady: z?.onSecurityReady,
300
+ onAccessDenied: z?.onAccessDenied,
301
+ children: /* @__PURE__ */ e(At, { children: /* @__PURE__ */ c(
302
+ Le,
199
303
  {
200
304
  ref: t,
201
- withBorder: G,
202
- radius: a,
305
+ withBorder: s,
306
+ radius: I,
203
307
  style: {
204
- width: h,
205
- height: v,
308
+ width: P,
309
+ height: l,
206
310
  display: "flex",
207
311
  flexDirection: "column",
208
- padding: 4
312
+ padding: A ? 0 : 4
209
313
  },
210
314
  children: [
211
- X && /* @__PURE__ */ e(Xe, { style: { flexShrink: 0 }, children: /* @__PURE__ */ e(
212
- Qe,
315
+ A && /* @__PURE__ */ e(
316
+ he,
317
+ {
318
+ style: {
319
+ flexShrink: 0,
320
+ padding: "16px 24px",
321
+ borderBottom: "1px solid var(--mantine-color-gray-2)"
322
+ },
323
+ children: /* @__PURE__ */ c(pe, { justify: "space-between", align: "center", children: [
324
+ /* @__PURE__ */ c(oe, { gap: "md", children: [
325
+ N && /* @__PURE__ */ e(
326
+ pt,
327
+ {
328
+ variant: "subtle",
329
+ color: "gray",
330
+ size: "lg",
331
+ onClick: N,
332
+ style: { border: "1px solid var(--mantine-color-gray-3)" },
333
+ children: /* @__PURE__ */ e(Bt, { size: 18 })
334
+ }
335
+ ),
336
+ (n || o) && /* @__PURE__ */ c(he, { children: [
337
+ n && /* @__PURE__ */ e(Tt, { order: 4, fw: 600, children: n }),
338
+ o && /* @__PURE__ */ e(ye, { size: "sm", c: "dimmed", children: o })
339
+ ] })
340
+ ] }),
341
+ Ne()
342
+ ] })
343
+ }
344
+ ),
345
+ _ && /* @__PURE__ */ e(he, { style: { flexShrink: 0, padding: A ? "16px 24px 0" : void 0 }, children: /* @__PURE__ */ e(
346
+ Ke,
213
347
  {
214
- autoClose: b,
348
+ autoClose: C,
215
349
  withCloseButton: !0,
216
350
  withBorder: !0,
217
- icon: /* @__PURE__ */ e(Ke, { size: "1.4rem" }),
218
- title: C().t("WARNING"),
351
+ icon: /* @__PURE__ */ e(Oe, { size: "1.4rem" }),
352
+ title: x().t("WARNING"),
219
353
  titleColor: "rgb(250, 82, 82)",
220
- variant: S ?? T.variant,
221
- onClose: ie,
222
- children: /* @__PURE__ */ e("span", { children: Y })
354
+ variant: w ?? O.variant,
355
+ onClose: Fe,
356
+ children: /* @__PURE__ */ e("span", { children: Ce })
223
357
  }
224
358
  ) }),
225
- /* @__PURE__ */ x(
226
- Ft,
359
+ /* @__PURE__ */ c(
360
+ Xe,
227
361
  {
228
362
  style: {
229
363
  flex: 1,
230
364
  minHeight: 0,
231
- // Importante para flex funcionar
232
- padding: "calc(0.625rem / 2)"
365
+ padding: A ? "24px" : "calc(0.625rem / 2)"
233
366
  },
234
367
  children: [
235
- /* @__PURE__ */ e(Rt, { visible: f || r, opacity: 0.3 }),
236
- o
368
+ /* @__PURE__ */ e(vt, { visible: u || r || i, opacity: 0.3 }),
369
+ L
237
370
  ]
238
371
  }
239
372
  ),
240
- /* @__PURE__ */ x(
241
- Xe,
242
- {
243
- style: {
244
- flexShrink: 0,
245
- padding: "calc(0.625rem / 2)",
246
- display: "flex",
247
- justifyContent: w === "center" ? "center" : "space-between",
248
- alignItems: "center",
249
- gap: "1rem"
250
- },
251
- children: [
252
- w === "right" && E && /* @__PURE__ */ e(Xe, { style: { flex: 1 }, children: E }),
253
- g && !g.isBrowsing() ? /* @__PURE__ */ x(se, { gap: "md", children: [
254
- /* @__PURE__ */ e(
255
- ee,
256
- {
257
- actionName: "save",
258
- actionDescription: `Salvar ${te || "registro"}`,
259
- leftSection: /* @__PURE__ */ e(zt, {}),
260
- onClick: () => _(g.getCurrentRecord()),
261
- disabled: g && g.isBrowsing(),
262
- variant: S ?? T.variant,
263
- color: "green",
264
- children: `${C().t("Ok")}`
265
- }
266
- ),
267
- /* @__PURE__ */ e(
268
- ee,
269
- {
270
- actionName: "cancel",
271
- actionDescription: "Cancelar operação",
272
- leftSection: /* @__PURE__ */ e(Pe, {}),
273
- onClick: re,
274
- disabled: g && g.isBrowsing(),
275
- variant: S ?? T.variant,
276
- color: "red",
277
- children: `${C().t("Cancel")}`
278
- }
279
- )
280
- ] }) : /* @__PURE__ */ e(se, { gap: "md", children: /* @__PURE__ */ e(
281
- ee,
282
- {
283
- actionName: "close",
284
- actionDescription: "Fechar formulário",
285
- leftSection: /* @__PURE__ */ e(Pe, {}),
286
- onClick: re,
287
- variant: S ?? T.variant,
288
- children: `${C().t("Close")}`
289
- }
290
- ) }),
291
- (w === "left" || w === "center") && E && /* @__PURE__ */ e(Xe, { style: { flex: w === "left" ? 1 : 0, textAlign: "right" }, children: E })
292
- ]
293
- }
294
- )
373
+ ce && De()
295
374
  ]
296
375
  }
297
376
  ) })
298
377
  }
299
378
  );
300
379
  }
301
- function Sn({
380
+ function Bn({
302
381
  title: t,
303
382
  withOverlay: n = !0,
304
- overlayProps: l,
383
+ overlayProps: o,
305
384
  children: f,
306
385
  withCloseButton: r = !0,
307
386
  closeButtonProps: i,
308
- opened: c,
309
- fullScreen: b,
310
- centered: h,
311
- variant: v,
312
- closeOnEscape: G = !0,
313
- size: o,
314
- dataSource: a,
315
- height: S,
316
- userActions: w,
317
- onAfterSave: E,
318
- onClickOk: g,
319
- onClickCancel: d,
320
- onBeforeOk: R,
321
- onCustomSave: I,
322
- isError: L,
323
- error: y = "",
324
- clearError: p = () => {
387
+ opened: u,
388
+ fullScreen: v,
389
+ centered: a,
390
+ variant: C,
391
+ closeOnEscape: P = !0,
392
+ size: l,
393
+ dataSource: s,
394
+ height: L,
395
+ userActions: I,
396
+ onAfterSave: w,
397
+ onClickOk: R,
398
+ onClickCancel: m,
399
+ onBeforeOk: D,
400
+ onCustomSave: N,
401
+ isError: V,
402
+ error: F = "",
403
+ clearError: h = () => {
325
404
  },
326
- onError: D,
327
- autoCloseAlertError: oe = 15e3,
328
- loadingOverlayStyles: te,
405
+ onError: X,
406
+ autoCloseAlertError: Z = 15e3,
407
+ loadingOverlayStyles: ae,
329
408
  // Props de segurança (opcionais)
330
- resourceName: K,
331
- resourceDescription: M,
332
- requiredPermissions: B,
333
- fallbackComponent: A,
334
- securityOptions: T,
335
- ...X
409
+ resourceName: W,
410
+ resourceDescription: G,
411
+ requiredPermissions: M,
412
+ fallbackComponent: y,
413
+ securityOptions: U,
414
+ ...ee
336
415
  }) {
337
- const V = Re(), Y = tt(), { colorScheme: ne } = Ze(), [Z, U] = O(L), [$, _] = O(y), [re, ie] = O(!1), j = mt();
338
- Ae({
339
- resourceDescription: M || t?.toString(),
340
- autoRegisterActions: T?.autoRegisterActions ?? !0
416
+ const E = ze(), te = at(), { colorScheme: se } = lt(), [ne, H] = Q(V), [z, Y] = Q(F), [O, _] = Q(!1), ue = ot();
417
+ Pe({
418
+ resourceDescription: G || t?.toString(),
419
+ autoRegisterActions: U?.autoRegisterActions ?? !0
341
420
  });
342
- const le = Ge(
421
+ const Ce = _e(
343
422
  "ArchbaseFormModalTemplate",
344
- a,
423
+ s,
345
424
  void 0,
346
425
  void 0
347
426
  );
348
427
  nt({
349
- dataSource: a,
350
- listener: (H) => {
351
- H.type === Ce.onError && (U(!0), _(H.error)), (H.type === Ce.afterEdit || H.type === Ce.afterInsert) && (le.isDataSourceV2 || j());
428
+ dataSource: s,
429
+ listener: (B) => {
430
+ B.type === Re.onError && (H(!0), Y(B.error)), (B.type === Re.afterEdit || B.type === Re.afterInsert) && (Ce.isDataSourceV2 || ue());
352
431
  }
353
432
  });
354
- const he = async () => {
355
- if (a && !a.isBrowsing())
433
+ const le = async () => {
434
+ if (s && !s.isBrowsing())
356
435
  try {
357
- ie(!0), await a.save(), E && E(a.getCurrentRecord());
358
- } catch (H) {
359
- return D && D(pe(H)), U(!0), _(pe(H)), ie(!1), !1;
436
+ _(!0), await s.save(), w && w(s.getCurrentRecord());
437
+ } catch (B) {
438
+ return X && X(fe(B)), H(!0), Y(fe(B)), _(!1), !1;
360
439
  }
361
- return ie(!1), !0;
362
- }, s = () => {
363
- if (a && !a.isBrowsing())
440
+ return _(!1), !0;
441
+ }, d = () => {
442
+ if (s && !s.isBrowsing())
364
443
  try {
365
- a.cancel();
444
+ s.cancel();
366
445
  } catch {
367
446
  }
368
- }, N = async () => {
369
- if (I)
370
- a && I(a.getCurrentRecord(), () => {
371
- g && g();
447
+ }, k = async () => {
448
+ if (N)
449
+ s && N(s.getCurrentRecord(), () => {
450
+ R && R();
372
451
  });
373
- else if (R) {
374
- const H = R(a.getCurrentRecord());
375
- H instanceof Promise && H.then(async () => {
376
- await he() && g && g();
377
- }).catch((be) => {
378
- D && D(pe(be)), U(!0), _(pe(be));
452
+ else if (D) {
453
+ const B = D(s.getCurrentRecord());
454
+ B instanceof Promise && B.then(async () => {
455
+ await le() && R && R();
456
+ }).catch((me) => {
457
+ X && X(fe(me)), H(!0), Y(fe(me));
379
458
  });
380
459
  } else
381
- await he() && g && g();
382
- }, W = () => {
383
- s(), d && d();
384
- }, xe = () => {
385
- Ct.showWarning(C().t("archbase:Click on Ok or Cancel to close"));
386
- }, fe = () => {
387
- p && p(), U(!1), _("");
460
+ await le() && R && R();
461
+ }, $ = () => {
462
+ d(), m && m();
463
+ }, we = () => {
464
+ Rt.showWarning(x().t("archbase:Click on Ok or Cancel to close"));
465
+ }, de = () => {
466
+ h && h(), H(!1), Y("");
388
467
  };
389
468
  return /* @__PURE__ */ e(
390
- Ee,
469
+ Ge,
391
470
  {
392
- resourceName: K,
393
- resourceDescription: M,
394
- requiredPermissions: B,
395
- fallbackComponent: A,
396
- onSecurityReady: T?.onSecurityReady,
397
- onAccessDenied: T?.onAccessDenied,
471
+ resourceName: W,
472
+ resourceDescription: G,
473
+ requiredPermissions: M,
474
+ fallbackComponent: y,
475
+ onSecurityReady: U?.onSecurityReady,
476
+ onAccessDenied: U?.onAccessDenied,
398
477
  children: /* @__PURE__ */ e(
399
- ft,
478
+ Ct,
400
479
  {
401
480
  title: t,
402
481
  withOverlay: n,
403
- overlayProps: l || {
404
- color: ne === "dark" ? Y.colors.dark[7] : Y.colors.gray[6],
482
+ overlayProps: o || {
483
+ color: se === "dark" ? te.colors.dark[7] : te.colors.gray[6],
405
484
  opacity: 0.25
406
485
  },
407
486
  withCloseButton: r,
408
487
  closeButtonProps: i,
409
- onClose: xe,
410
- opened: c,
411
- fullScreen: b,
412
- centered: h,
413
- closeOnEscape: G,
414
- size: o,
415
- ...X,
416
- children: /* @__PURE__ */ x(Et, { children: [
417
- /* @__PURE__ */ e(Rt, { styles: te, visible: re, opacity: 0.8 }),
418
- /* @__PURE__ */ x(rt, { height: S, children: [
419
- Z ? /* @__PURE__ */ e(xt, { size: "100px", children: /* @__PURE__ */ e(
420
- Qe,
488
+ onClose: we,
489
+ opened: u,
490
+ fullScreen: v,
491
+ centered: a,
492
+ closeOnEscape: P,
493
+ size: l,
494
+ ...ee,
495
+ children: /* @__PURE__ */ c(At, { children: [
496
+ /* @__PURE__ */ e(vt, { styles: ae, visible: O, opacity: 0.8 }),
497
+ /* @__PURE__ */ c(ct, { height: L, children: [
498
+ ne ? /* @__PURE__ */ e(Et, { size: "100px", children: /* @__PURE__ */ e(
499
+ Ke,
421
500
  {
422
- autoClose: oe,
501
+ autoClose: Z,
423
502
  withCloseButton: !0,
424
503
  withBorder: !0,
425
- icon: /* @__PURE__ */ e(Ke, { size: "1.4rem" }),
426
- title: C().t("WARNING"),
504
+ icon: /* @__PURE__ */ e(Oe, { size: "1.4rem" }),
505
+ title: x().t("WARNING"),
427
506
  titleColor: "rgb(250, 82, 82)",
428
- variant: v ?? V.variant,
429
- onClose: fe,
430
- children: /* @__PURE__ */ e("span", { children: $ })
507
+ variant: C ?? E.variant,
508
+ onClose: de,
509
+ children: /* @__PURE__ */ e("span", { children: z })
431
510
  }
432
511
  ) }) : null,
433
- /* @__PURE__ */ e(it, { children: /* @__PURE__ */ e(Bt, { children: f }) }),
434
- /* @__PURE__ */ e(ot, { size: "40px", children: /* @__PURE__ */ x(ge, { justify: "space-between", align: "center", children: [
435
- /* @__PURE__ */ e(se, { children: w }),
436
- a && !a.isBrowsing() ? /* @__PURE__ */ x(se, { gap: "md", children: [
512
+ /* @__PURE__ */ e(st, { children: /* @__PURE__ */ e($t, { children: f }) }),
513
+ /* @__PURE__ */ e(dt, { size: "40px", children: /* @__PURE__ */ c(pe, { justify: "space-between", align: "center", children: [
514
+ /* @__PURE__ */ e(oe, { children: I }),
515
+ s && !s.isBrowsing() ? /* @__PURE__ */ c(oe, { gap: "md", children: [
437
516
  /* @__PURE__ */ e(
438
- ee,
517
+ J,
439
518
  {
440
519
  actionName: "save",
441
- actionDescription: `Salvar ${M || t || "registro"}`,
442
- leftSection: /* @__PURE__ */ e(qe, {}),
443
- onClick: N,
444
- disabled: a && a.isBrowsing(),
445
- variant: v ?? V.variant,
520
+ actionDescription: `Salvar ${G || t || "registro"}`,
521
+ leftSection: /* @__PURE__ */ e(Ye, {}),
522
+ onClick: k,
523
+ disabled: s && s.isBrowsing(),
524
+ variant: C ?? E.variant,
446
525
  color: "green",
447
- children: `${C().t("Ok")}`
526
+ children: `${x().t("Ok")}`
448
527
  }
449
528
  ),
450
529
  /* @__PURE__ */ e(
451
- ee,
530
+ J,
452
531
  {
453
532
  actionName: "cancel",
454
533
  actionDescription: "Cancelar operação",
455
- leftSection: /* @__PURE__ */ e(Pe, {}),
456
- onClick: W,
457
- disabled: a && a.isBrowsing(),
458
- variant: v ?? V.variant,
534
+ leftSection: /* @__PURE__ */ e(Be, {}),
535
+ onClick: $,
536
+ disabled: s && s.isBrowsing(),
537
+ variant: C ?? E.variant,
459
538
  color: "red",
460
- children: `${C().t("Cancel")}`
539
+ children: `${x().t("Cancel")}`
461
540
  }
462
541
  )
463
- ] }) : /* @__PURE__ */ e(se, { gap: "md", children: /* @__PURE__ */ e(
464
- ee,
542
+ ] }) : /* @__PURE__ */ e(oe, { gap: "md", children: /* @__PURE__ */ e(
543
+ J,
465
544
  {
466
545
  actionName: "close",
467
546
  actionDescription: "Fechar janela",
468
- leftSection: /* @__PURE__ */ e(Pe, {}),
469
- onClick: W,
470
- variant: v ?? V.variant,
471
- children: `${C().t("Close")}`
547
+ leftSection: /* @__PURE__ */ e(Be, {}),
548
+ onClick: $,
549
+ variant: C ?? E.variant,
550
+ children: `${x().t("Close")}`
472
551
  }
473
552
  ) })
474
553
  ] }) })
@@ -479,96 +558,96 @@ function Sn({
479
558
  }
480
559
  );
481
560
  }
482
- function In({
561
+ function Nn({
483
562
  title: t,
484
563
  withOverlay: n = !0,
485
- overlayProps: l,
564
+ overlayProps: o,
486
565
  children: f,
487
566
  withCloseButton: r = !0,
488
567
  closeButtonProps: i,
489
- opened: c,
490
- fullScreen: b,
491
- centered: h,
492
- variant: v,
493
- closeOnEscape: G = !0,
494
- size: o,
495
- height: a,
496
- onlyOkButton: S = !1,
497
- onClose: w,
498
- onClickOk: E,
499
- onClickCancel: g,
500
- userActions: d,
568
+ opened: u,
569
+ fullScreen: v,
570
+ centered: a,
571
+ variant: C,
572
+ closeOnEscape: P = !0,
573
+ size: l,
574
+ height: s,
575
+ onlyOkButton: L = !1,
576
+ onClose: I,
577
+ onClickOk: w,
578
+ onClickCancel: R,
579
+ userActions: m,
501
580
  // Props de segurança (opcionais)
502
- resourceName: R,
503
- resourceDescription: I,
504
- requiredPermissions: L,
505
- fallbackComponent: y,
506
- securityOptions: p
581
+ resourceName: D,
582
+ resourceDescription: N,
583
+ requiredPermissions: V,
584
+ fallbackComponent: F,
585
+ securityOptions: h
507
586
  }) {
508
- const D = Re(), oe = tt(), { colorScheme: te } = Ze();
509
- Ae({
510
- autoRegisterActions: p?.autoRegisterActions ?? !0
587
+ const X = ze(), Z = at(), { colorScheme: ae } = lt();
588
+ Pe({
589
+ autoRegisterActions: h?.autoRegisterActions ?? !0
511
590
  });
512
- const K = () => {
513
- E && E(), w();
591
+ const W = () => {
592
+ w && w(), I();
593
+ }, G = () => {
594
+ R && R(), I();
514
595
  }, M = () => {
515
- g && g(), w();
516
- }, B = () => {
517
- Ct.showWarning(C().t("Click on Ok or Cancel to close"));
596
+ Rt.showWarning(x().t("Click on Ok or Cancel to close"));
518
597
  };
519
598
  return /* @__PURE__ */ e(
520
- Ee,
599
+ Ge,
521
600
  {
522
- resourceName: R,
523
- resourceDescription: I,
524
- requiredPermissions: L,
525
- fallbackComponent: y,
526
- onSecurityReady: p?.onSecurityReady,
527
- onAccessDenied: p?.onAccessDenied,
601
+ resourceName: D,
602
+ resourceDescription: N,
603
+ requiredPermissions: V,
604
+ fallbackComponent: F,
605
+ onSecurityReady: h?.onSecurityReady,
606
+ onAccessDenied: h?.onAccessDenied,
528
607
  children: /* @__PURE__ */ e(
529
- ft,
608
+ Ct,
530
609
  {
531
610
  title: t,
532
611
  withOverlay: n,
533
- overlayProps: l || {
534
- color: te === "dark" ? oe.colors.dark[7] : oe.colors.gray[6],
612
+ overlayProps: o || {
613
+ color: ae === "dark" ? Z.colors.dark[7] : Z.colors.gray[6],
535
614
  opacity: 0.25
536
615
  },
537
616
  withCloseButton: r,
538
617
  closeButtonProps: i,
539
- onClose: B,
540
- opened: c,
541
- fullScreen: b,
542
- centered: h,
543
- closeOnEscape: G,
544
- size: o,
545
- children: /* @__PURE__ */ x(rt, { height: a, children: [
546
- /* @__PURE__ */ e(it, { children: /* @__PURE__ */ e(Bt, { children: f }) }),
547
- /* @__PURE__ */ e(ot, { size: "40px", children: /* @__PURE__ */ x(ge, { justify: "space-between", align: "center", children: [
548
- /* @__PURE__ */ e(se, { children: d }),
549
- /* @__PURE__ */ x(se, { gap: "md", children: [
618
+ onClose: M,
619
+ opened: u,
620
+ fullScreen: v,
621
+ centered: a,
622
+ closeOnEscape: P,
623
+ size: l,
624
+ children: /* @__PURE__ */ c(ct, { height: s, children: [
625
+ /* @__PURE__ */ e(st, { children: /* @__PURE__ */ e($t, { children: f }) }),
626
+ /* @__PURE__ */ e(dt, { size: "40px", children: /* @__PURE__ */ c(pe, { justify: "space-between", align: "center", children: [
627
+ /* @__PURE__ */ e(oe, { children: m }),
628
+ /* @__PURE__ */ c(oe, { gap: "md", children: [
550
629
  /* @__PURE__ */ e(
551
- ee,
630
+ J,
552
631
  {
553
632
  actionName: "save",
554
- actionDescription: `Salvar ${I || "registro"}`,
555
- leftSection: /* @__PURE__ */ e(qe, {}),
556
- onClick: K,
557
- variant: v ?? D.variant,
633
+ actionDescription: `Salvar ${N || "registro"}`,
634
+ leftSection: /* @__PURE__ */ e(Ye, {}),
635
+ onClick: W,
636
+ variant: C ?? X.variant,
558
637
  color: "green",
559
- children: `${C().t("Ok")}`
638
+ children: `${x().t("Ok")}`
560
639
  }
561
640
  ),
562
- S ? null : /* @__PURE__ */ e(
563
- ee,
641
+ L ? null : /* @__PURE__ */ e(
642
+ J,
564
643
  {
565
644
  actionName: "cancel",
566
645
  actionDescription: "Cancelar operação",
567
- leftSection: /* @__PURE__ */ e(Pe, {}),
568
- onClick: M,
569
- variant: v ?? D.variant,
646
+ leftSection: /* @__PURE__ */ e(Be, {}),
647
+ onClick: G,
648
+ variant: C ?? X.variant,
570
649
  color: "red",
571
- children: g ? `${C().t("Cancel")}` : `${C().t("Close")}`
650
+ children: R ? `${x().t("Cancel")}` : `${x().t("Close")}`
572
651
  }
573
652
  )
574
653
  ] })
@@ -579,10 +658,10 @@ function In({
579
658
  }
580
659
  );
581
660
  }
582
- const nn = (t, n, l) => {
661
+ const cn = (t, n, o) => {
583
662
  if (!t || !n || !n.existsValue(`${t.viewName}_${t.componentName}`)) {
584
663
  let f = -1, r;
585
- return l && l.getFilters().length > 0 && (f = 0, r = JSON.parse(l.getFirstFilter()?.filter)), {
664
+ return o && o.getFilters().length > 0 && (f = 0, r = JSON.parse(o.getFirstFilter()?.filter)), {
586
665
  activeFilterIndex: f,
587
666
  expandedFilter: !1,
588
667
  currentFilter: r
@@ -590,319 +669,319 @@ const nn = (t, n, l) => {
590
669
  }
591
670
  return n.getValue(`${t.viewName}_${t.componentName}`);
592
671
  };
593
- function rn(t, n) {
672
+ function sn(t, n) {
594
673
  const {
595
- title: l,
674
+ title: o,
596
675
  printTitle: f,
597
676
  dataSource: r,
598
677
  filterOptions: i,
599
- pageSize: c = 15,
600
- pageIndex: b = 0,
601
- columns: h,
602
- filterFields: v,
603
- logoPrint: G,
604
- userActions: o,
605
- userRowActions: a,
606
- customRenderRowActions: S,
607
- innerRef: w,
608
- isLoading: E = !1,
609
- isLoadingFilter: g = !1,
610
- isError: d = !1,
611
- enableTopToolbar: R = !0,
612
- enableTopToolbarActions: I = !0,
613
- error: L = "",
614
- clearError: y = () => {
678
+ pageSize: u = 15,
679
+ pageIndex: v = 0,
680
+ columns: a,
681
+ filterFields: C,
682
+ logoPrint: P,
683
+ userActions: l,
684
+ userRowActions: s,
685
+ customRenderRowActions: L,
686
+ innerRef: I,
687
+ isLoading: w = !1,
688
+ isLoadingFilter: R = !1,
689
+ isError: m = !1,
690
+ enableTopToolbar: D = !0,
691
+ enableTopToolbarActions: N = !0,
692
+ error: V = "",
693
+ clearError: F = () => {
615
694
  },
616
- filterType: p,
617
- width: D = "100%",
618
- height: oe = "100%",
619
- onSearchByFilter: te,
620
- getRowId: K,
621
- withBorder: M = !0,
622
- filterPersistenceDelegator: B,
623
- variant: A,
624
- store: T,
625
- cellPadding: X,
626
- bottomToolbarMinHeight: V,
627
- enableRowSelection: Y = !0,
628
- enableRowNumbers: ne = !0,
629
- enableRowActions: Z = !0,
630
- positionActionsColumn: U = "first",
631
- actionsColumnWidth: $,
632
- tableHeadCellPadding: _,
633
- renderDetailPanel: re,
634
- renderTopToolbar: ie,
635
- toolbarAlignment: j = "right",
636
- toolbarLeftContent: le,
637
- onSelectedRowsChanged: he,
638
- onCellDoubleClick: s,
639
- onFilterModelChange: N,
640
- paginationLabels: W,
695
+ filterType: h,
696
+ width: X = "100%",
697
+ height: Z = "100%",
698
+ onSearchByFilter: ae,
699
+ getRowId: W,
700
+ withBorder: G = !0,
701
+ filterPersistenceDelegator: M,
702
+ variant: y,
703
+ store: U,
704
+ cellPadding: ee,
705
+ bottomToolbarMinHeight: E,
706
+ enableRowSelection: te = !0,
707
+ enableRowNumbers: se = !0,
708
+ enableRowActions: ne = !0,
709
+ positionActionsColumn: H = "first",
710
+ actionsColumnWidth: z,
711
+ tableHeadCellPadding: Y,
712
+ renderDetailPanel: O,
713
+ renderTopToolbar: _,
714
+ toolbarAlignment: ue = "right",
715
+ toolbarLeftContent: Ce,
716
+ onSelectedRowsChanged: le,
717
+ onCellDoubleClick: d,
718
+ onFilterModelChange: k,
719
+ paginationLabels: $,
641
720
  // Props de segurança (opcionais)
642
- resourceName: xe,
643
- resourceDescription: fe,
644
- requiredPermissions: H,
645
- fallbackComponent: be,
646
- securityOptions: ye,
721
+ resourceName: we,
722
+ resourceDescription: de,
723
+ requiredPermissions: B,
724
+ fallbackComponent: me,
725
+ securityOptions: xe,
647
726
  // Props para controle de bordas internas
648
- withToolbarBorder: $e,
649
- withPaginationBorder: Ve,
650
- toolbarPadding: z,
651
- paginationPadding: ae,
652
- rowHeight: ze,
653
- hideFooter: Se = !0
654
- } = t, Le = ue(null), q = ue(null);
655
- tt();
656
- const { colorScheme: Me } = Ze();
657
- Ae({
658
- autoRegisterActions: ye?.autoRegisterActions ?? !0
727
+ withToolbarBorder: Fe,
728
+ withPaginationBorder: Ie,
729
+ toolbarPadding: A,
730
+ paginationPadding: ce,
731
+ rowHeight: Ne,
732
+ hideFooter: De = !0
733
+ } = t, re = Ae(null), S = Ae(null);
734
+ at();
735
+ const { colorScheme: $e } = lt();
736
+ Pe({
737
+ autoRegisterActions: xe?.autoRegisterActions ?? !0
659
738
  });
660
- const ve = Ge(
739
+ const Te = _e(
661
740
  "ArchbaseGridTemplate",
662
741
  r,
663
742
  void 0,
664
743
  void 0
665
744
  );
666
- It(n, () => ({
745
+ zt(n, () => ({
667
746
  refreshData: () => {
668
- q.current && q.current.refreshData();
747
+ S.current && S.current.refreshData();
669
748
  },
670
- getSelectedRows: () => q.current ? q.current.getSelectedRows() : [],
749
+ getSelectedRows: () => S.current ? S.current.getSelectedRows() : [],
671
750
  clearSelection: () => {
672
- q.current && q.current.clearSelection();
751
+ S.current && S.current.clearSelection();
673
752
  },
674
753
  exportData: () => {
675
- q.current && q.current.exportData();
754
+ S.current && S.current.exportData();
676
755
  },
677
756
  printData: () => {
678
- q.current && q.current.printData();
757
+ S.current && S.current.printData();
679
758
  },
680
- getDataGridRef: () => q,
681
- getFilterModel: () => q.current ? q.current.getFilterModel() : { items: [], quickFilterValues: [] }
682
- }), [q]);
683
- const [m, P] = O({
759
+ getDataGridRef: () => S,
760
+ getFilterModel: () => S.current ? S.current.getFilterModel() : { items: [], quickFilterValues: [] }
761
+ }), [S]);
762
+ const [g, j] = Q({
684
763
  activeFilterIndex: -1,
685
764
  currentFilter: void 0,
686
765
  expandedFilter: !1
687
766
  });
688
- _e(() => {
689
- const F = nn(i, T, B);
690
- P(F);
691
- }, [g]);
692
- const J = (F) => {
693
- if (S)
694
- return S(F);
695
- if (!a || !a.actions)
767
+ et(() => {
768
+ const T = cn(i, U, M);
769
+ j(T);
770
+ }, [R]);
771
+ const q = (T) => {
772
+ if (L)
773
+ return L(T);
774
+ if (!s || !s.actions)
696
775
  return;
697
- const me = a.actions;
776
+ const Se = s.actions;
698
777
  return /* @__PURE__ */ e(
699
- me,
778
+ Se,
700
779
  {
701
- onEditRow: a.onEditRow ? (u) => a.onEditRow && a.onEditRow(u) : void 0,
702
- onRemoveRow: a.onRemoveRow ? (u) => a.onRemoveRow && a.onRemoveRow(u) : void 0,
703
- onViewRow: a.onViewRow ? (u) => a.onViewRow && a.onViewRow(u) : void 0,
704
- row: F,
705
- variant: A ?? ce.variant
780
+ onEditRow: s.onEditRow ? (p) => s.onEditRow && s.onEditRow(p) : void 0,
781
+ onRemoveRow: s.onRemoveRow ? (p) => s.onRemoveRow && s.onRemoveRow(p) : void 0,
782
+ onViewRow: s.onViewRow ? (p) => s.onViewRow && s.onViewRow(p) : void 0,
783
+ row: T,
784
+ variant: y ?? ge.variant
706
785
  }
707
786
  );
708
- }, ce = Re(), de = ue(null), we = d ? !1 : E, Ie = Be(() => le, [le]);
709
- Je.useEffect(() => {
710
- w && w.current !== de.current && w.current && de.current && (w.current = de.current);
711
- }, [w]);
712
- const Ue = (F, me) => {
713
- const u = { ...m, currentFilter: F, activeFilterIndex: me };
714
- P(u), T && i && T?.setValue(`${i.viewName}_${i.componentName}`, u);
715
- }, lt = (F) => {
716
- const me = { ...m, expandedFilter: F };
717
- P(me), T && i && T?.setValue(`${i.viewName}_${i.componentName}`, me);
718
- }, at = (F, me) => {
719
- const u = { ...m, currentFilter: F, activeFilterIndex: me };
720
- P(u), T && i && T?.setValue(`${i.viewName}_${i.componentName}`, u);
721
- }, je = () => {
722
- if (m.currentFilter)
723
- if (te)
724
- te();
725
- else if (m.currentFilter.filter.filterType === "quick") {
726
- const F = r.getOptions();
727
- m.currentFilter.filter.quickFilterText && m.currentFilter.filter.quickFilterText !== "" ? (F.filter = JSON.stringify({
728
- search: m.currentFilter.filter.quickFilterText,
729
- fields: m.currentFilter.filter.quickFilterFieldsText
730
- }), F.sort = m.currentFilter.sort.quickFilterSort ? m.currentFilter.sort.quickFilterSort.split(",") : []) : (F.filter = void 0, F.sort = void 0), r.refreshData(F), ve.isDataSourceV2 || ve.v1State.forceUpdate();
787
+ }, ge = ze(), ve = Ae(null), ke = m ? !1 : w, Ve = He(() => Ce, [Ce]);
788
+ Ze.useEffect(() => {
789
+ I && I.current !== ve.current && I.current && ve.current && (I.current = ve.current);
790
+ }, [I]);
791
+ const Ue = (T, Se) => {
792
+ const p = { ...g, currentFilter: T, activeFilterIndex: Se };
793
+ j(p), U && i && U?.setValue(`${i.viewName}_${i.componentName}`, p);
794
+ }, qe = (T) => {
795
+ const Se = { ...g, expandedFilter: T };
796
+ j(Se), U && i && U?.setValue(`${i.viewName}_${i.componentName}`, Se);
797
+ }, b = (T, Se) => {
798
+ const p = { ...g, currentFilter: T, activeFilterIndex: Se };
799
+ j(p), U && i && U?.setValue(`${i.viewName}_${i.componentName}`, p);
800
+ }, Ee = () => {
801
+ if (g.currentFilter)
802
+ if (ae)
803
+ ae();
804
+ else if (g.currentFilter.filter.filterType === "quick") {
805
+ const T = r.getOptions();
806
+ g.currentFilter.filter.quickFilterText && g.currentFilter.filter.quickFilterText !== "" ? (T.filter = JSON.stringify({
807
+ search: g.currentFilter.filter.quickFilterText,
808
+ fields: g.currentFilter.filter.quickFilterFieldsText
809
+ }), T.sort = g.currentFilter.sort.quickFilterSort ? g.currentFilter.sort.quickFilterSort.split(",") : []) : (T.filter = void 0, T.sort = void 0), r.refreshData(T), Te.isDataSourceV2 || Te.v1State.forceUpdate();
731
810
  } else {
732
- const F = Yt(m.currentFilter);
733
- if (F && F.expressionNode) {
734
- const me = Mt(F.expressionNode), u = r.getOptions();
735
- u.filter = me, u.sort = F?.sortStrings, r.refreshData(u), ve.isDataSourceV2 || ve.v1State.forceUpdate();
811
+ const T = rn(g.currentFilter);
812
+ if (T && T.expressionNode) {
813
+ const Se = qt(T.expressionNode), p = r.getOptions();
814
+ p.filter = Se, p.sort = T?.sortStrings, r.refreshData(p), Te.isDataSourceV2 || Te.v1State.forceUpdate();
736
815
  }
737
816
  }
738
817
  };
739
- let De, He;
740
- const st = (F) => {
741
- De = F;
742
- }, ct = (F) => {
743
- He = F;
744
- }, dt = () => {
745
- He && He();
746
- }, ut = () => {
747
- De && De();
748
- }, ht = () => p === "none" ? /* @__PURE__ */ e("div", {}) : p === "advanced" ? /* @__PURE__ */ e(
749
- vt,
818
+ let je, Qe;
819
+ const ht = (T) => {
820
+ je = T;
821
+ }, ut = (T) => {
822
+ Qe = T;
823
+ }, ft = () => {
824
+ Qe && Qe();
825
+ }, mt = () => {
826
+ je && je();
827
+ }, gt = () => h === "none" ? /* @__PURE__ */ e("div", {}) : h === "advanced" ? /* @__PURE__ */ e(
828
+ St,
750
829
  {
751
830
  id: i?.componentName,
752
831
  viewName: i?.viewName,
753
832
  apiVersion: i?.apiVersion,
754
- ref: Le,
755
- variant: A ?? ce.variant,
756
- expandedFilter: m.expandedFilter,
757
- persistenceDelegator: B,
758
- currentFilter: m.currentFilter,
759
- activeFilterIndex: m.activeFilterIndex,
760
- onSelectedFilter: at,
833
+ ref: re,
834
+ variant: y ?? ge.variant,
835
+ expandedFilter: g.expandedFilter,
836
+ persistenceDelegator: M,
837
+ currentFilter: g.currentFilter,
838
+ activeFilterIndex: g.activeFilterIndex,
839
+ onSelectedFilter: b,
761
840
  onFilterChanged: Ue,
762
- onSearchByFilter: je,
763
- onToggleExpandedFilter: lt,
764
- onExport: dt,
765
- onPrint: ut,
841
+ onSearchByFilter: Ee,
842
+ onToggleExpandedFilter: qe,
843
+ onExport: ft,
844
+ onPrint: mt,
766
845
  showExportButton: !0,
767
846
  showPrintButton: !0,
768
847
  width: "560px",
769
848
  height: "170px",
770
- children: v
849
+ children: C
771
850
  }
772
- ) : p === "normal" ? /* @__PURE__ */ e("div", {}) : /* @__PURE__ */ e("div", {});
851
+ ) : h === "normal" ? /* @__PURE__ */ e("div", {}) : /* @__PURE__ */ e("div", {});
773
852
  return /* @__PURE__ */ e(
774
- Ee,
853
+ Ge,
775
854
  {
776
- resourceName: xe,
777
- resourceDescription: fe,
778
- requiredPermissions: H,
779
- fallbackComponent: be,
780
- onSecurityReady: ye?.onSecurityReady,
781
- onAccessDenied: ye?.onAccessDenied,
782
- children: /* @__PURE__ */ x(Oe, { withBorder: M, ref: de, style: { height: "100%" }, children: [
783
- d ? /* @__PURE__ */ e(
784
- Qe,
855
+ resourceName: we,
856
+ resourceDescription: de,
857
+ requiredPermissions: B,
858
+ fallbackComponent: me,
859
+ onSecurityReady: xe?.onSecurityReady,
860
+ onAccessDenied: xe?.onAccessDenied,
861
+ children: /* @__PURE__ */ c(Le, { withBorder: G, ref: ve, style: { height: "100%" }, children: [
862
+ m ? /* @__PURE__ */ e(
863
+ Ke,
785
864
  {
786
865
  autoClose: 2e4,
787
866
  withCloseButton: !0,
788
867
  withBorder: !0,
789
- icon: /* @__PURE__ */ e(Ke, { size: "1.4rem" }),
790
- title: C().t("archbase:WARNING"),
868
+ icon: /* @__PURE__ */ e(Oe, { size: "1.4rem" }),
869
+ title: x().t("archbase:WARNING"),
791
870
  titleColor: "rgb(250, 82, 82)",
792
- variant: A ?? ce.variant,
793
- onClose: () => y && y(),
794
- children: /* @__PURE__ */ e("span", { children: L })
871
+ variant: y ?? ge.variant,
872
+ onClose: () => F && F(),
873
+ children: /* @__PURE__ */ e("span", { children: V })
795
874
  }
796
875
  ) : null,
797
- /* @__PURE__ */ x(
798
- Tt,
876
+ /* @__PURE__ */ c(
877
+ Gt,
799
878
  {
800
- gridRef: q,
801
- printTitle: f || l,
802
- logoPrint: G,
803
- width: D,
804
- height: oe,
879
+ gridRef: S,
880
+ printTitle: f || o,
881
+ logoPrint: P,
882
+ width: X,
883
+ height: Z,
805
884
  withBorder: !1,
806
885
  dataSource: r,
807
886
  enableColumnResizing: !0,
808
- enableRowNumbers: ne,
809
- enableRowSelection: Y,
810
- enableRowActions: Z,
811
- enableTopToolbar: R,
812
- enableTopToolbarActions: I,
887
+ enableRowNumbers: se,
888
+ enableRowSelection: te,
889
+ enableRowActions: ne,
890
+ enableTopToolbar: D,
891
+ enableTopToolbarActions: N,
813
892
  manualPagination: !0,
814
893
  manualSorting: !0,
815
- isLoading: we,
816
- pageSize: c,
817
- pageIndex: b,
818
- allowColumnFilters: p !== "none",
819
- enableGlobalFilter: p !== "none",
820
- renderToolbarInternalActions: p == "none" ? () => /* @__PURE__ */ e("div", {}) : void 0,
894
+ isLoading: ke,
895
+ pageSize: u,
896
+ pageIndex: v,
897
+ allowColumnFilters: h !== "none",
898
+ enableGlobalFilter: h !== "none",
899
+ renderToolbarInternalActions: h == "none" ? () => /* @__PURE__ */ e("div", {}) : void 0,
821
900
  allowExportData: !0,
822
901
  allowPrintData: !0,
823
- onSelectedRowsChanged: he,
824
- onCellDoubleClick: s,
825
- onFilterModelChange: N,
826
- renderRowActions: Z ? J : void 0,
827
- positionActionsColumn: U,
828
- actionsColumnWidth: $,
829
- toolbarAlignment: j,
830
- toolbarLeftContent: Ie,
831
- renderToolbarActions: p === "advanced" || p === "none" ? ht : void 0,
832
- paginationLabels: W,
833
- cellPadding: X,
834
- bottomToolbarMinHeight: V,
835
- tableHeadCellPadding: _,
836
- getRowId: K,
837
- renderDetailPanel: re ? ({ row: F }) => re({ row: F }) : void 0,
838
- renderTopToolbar: ie,
839
- onExport: ct,
840
- onPrint: st,
841
- variant: A,
842
- withToolbarBorder: $e,
843
- withPaginationBorder: Ve,
844
- toolbarPadding: z,
845
- paginationPadding: ae,
846
- rowHeight: ze,
847
- hideFooter: Se,
902
+ onSelectedRowsChanged: le,
903
+ onCellDoubleClick: d,
904
+ onFilterModelChange: k,
905
+ renderRowActions: ne ? q : void 0,
906
+ positionActionsColumn: H,
907
+ actionsColumnWidth: z,
908
+ toolbarAlignment: ue,
909
+ toolbarLeftContent: Ve,
910
+ renderToolbarActions: h === "advanced" || h === "none" ? gt : void 0,
911
+ paginationLabels: $,
912
+ cellPadding: ee,
913
+ bottomToolbarMinHeight: E,
914
+ tableHeadCellPadding: Y,
915
+ getRowId: W,
916
+ renderDetailPanel: O ? ({ row: T }) => O({ row: T }) : void 0,
917
+ renderTopToolbar: _,
918
+ onExport: ut,
919
+ onPrint: ht,
920
+ variant: y,
921
+ withToolbarBorder: Fe,
922
+ withPaginationBorder: Ie,
923
+ toolbarPadding: A,
924
+ paginationPadding: ce,
925
+ rowHeight: Ne,
926
+ hideFooter: De,
848
927
  children: [
849
- h,
850
- o?.visible ? /* @__PURE__ */ e(_t, { children: /* @__PURE__ */ x(ke, { children: [
851
- /* @__PURE__ */ e("h3", { className: "only-print", children: f || l }),
852
- /* @__PURE__ */ e("div", { className: "no-print", children: /* @__PURE__ */ x(ge, { gap: "8px", rowGap: "8px", children: [
853
- o.customUserActions && o.customUserActionsPosition === "left" ? o.customUserActions : null,
854
- o.onAddExecute ? /* @__PURE__ */ e(
855
- ee,
928
+ a,
929
+ l?.visible ? /* @__PURE__ */ e(Xt, { children: /* @__PURE__ */ c(Me, { children: [
930
+ /* @__PURE__ */ e("h3", { className: "only-print", children: f || o }),
931
+ /* @__PURE__ */ e("div", { className: "no-print", children: /* @__PURE__ */ c(pe, { gap: "8px", rowGap: "8px", children: [
932
+ l.customUserActions && l.customUserActionsPosition === "left" ? l.customUserActions : null,
933
+ l.onAddExecute ? /* @__PURE__ */ e(
934
+ J,
856
935
  {
857
936
  actionName: "add",
858
- actionDescription: `Adicionar novo ${fe || "registro"}`,
937
+ actionDescription: `Adicionar novo ${de || "registro"}`,
859
938
  color: "green",
860
- variant: A ?? ce.variant,
861
- leftSection: /* @__PURE__ */ e(gt, {}),
862
- onClick: () => o && o.onAddExecute && o.onAddExecute(),
863
- children: o.labelAdd || C().t("archbase:New")
939
+ variant: y ?? ge.variant,
940
+ leftSection: /* @__PURE__ */ e(bt, {}),
941
+ onClick: () => l && l.onAddExecute && l.onAddExecute(),
942
+ children: l.labelAdd || x().t("archbase:New")
864
943
  }
865
944
  ) : null,
866
- o.onEditExecute ? /* @__PURE__ */ e(
867
- ee,
945
+ l.onEditExecute ? /* @__PURE__ */ e(
946
+ J,
868
947
  {
869
948
  actionName: "edit",
870
- actionDescription: `Editar ${fe || "registro"}`,
949
+ actionDescription: `Editar ${de || "registro"}`,
871
950
  color: "blue",
872
- leftSection: /* @__PURE__ */ e(pt, {}),
951
+ leftSection: /* @__PURE__ */ e(wt, {}),
873
952
  disabled: !r.isBrowsing() || r.isEmpty(),
874
- variant: A ?? ce.variant,
875
- onClick: () => o && o.onEditExecute && o.onEditExecute(),
876
- children: o.labelEdit || C().t("archbase:Edit")
953
+ variant: y ?? ge.variant,
954
+ onClick: () => l && l.onEditExecute && l.onEditExecute(),
955
+ children: l.labelEdit || x().t("archbase:Edit")
877
956
  }
878
957
  ) : null,
879
- o.onRemoveExecute ? /* @__PURE__ */ e(
880
- ee,
958
+ l.onRemoveExecute ? /* @__PURE__ */ e(
959
+ J,
881
960
  {
882
961
  actionName: "delete",
883
- actionDescription: `Remover ${fe || "registro"}`,
962
+ actionDescription: `Remover ${de || "registro"}`,
884
963
  color: "red",
885
- leftSection: /* @__PURE__ */ e(et, {}),
886
- disabled: !o?.allowRemove || !r.isBrowsing() || r.isEmpty(),
887
- variant: A ?? ce.variant,
888
- onClick: () => o && o.onRemoveExecute && o.onRemoveExecute(),
889
- children: o.labelRemove || C().t("archbase:Remove")
964
+ leftSection: /* @__PURE__ */ e(tt, {}),
965
+ disabled: !l?.allowRemove || !r.isBrowsing() || r.isEmpty(),
966
+ variant: y ?? ge.variant,
967
+ onClick: () => l && l.onRemoveExecute && l.onRemoveExecute(),
968
+ children: l.labelRemove || x().t("archbase:Remove")
890
969
  }
891
970
  ) : null,
892
- o.onViewExecute ? /* @__PURE__ */ e(
893
- ee,
971
+ l.onViewExecute ? /* @__PURE__ */ e(
972
+ J,
894
973
  {
895
974
  actionName: "view",
896
- actionDescription: `Visualizar ${fe || "registro"}`,
975
+ actionDescription: `Visualizar ${de || "registro"}`,
897
976
  color: "gray.7",
898
- leftSection: /* @__PURE__ */ e(bt, {}),
977
+ leftSection: /* @__PURE__ */ e(Ft, {}),
899
978
  disabled: !r.isBrowsing() || r.isEmpty(),
900
- variant: A ?? ce.variant,
901
- onClick: () => o && o.onViewExecute && o.onViewExecute(),
902
- children: o.labelView || C().t("archbase:View")
979
+ variant: y ?? ge.variant,
980
+ onClick: () => l && l.onViewExecute && l.onViewExecute(),
981
+ children: l.labelView || x().t("archbase:View")
903
982
  }
904
983
  ) : null,
905
- o.customUserActions && o.customUserActionsPosition === "right" ? o.customUserActions : null
984
+ l.customUserActions && l.customUserActionsPosition === "right" ? l.customUserActions : null
906
985
  ] }) })
907
986
  ] }) }) : null
908
987
  ]
@@ -912,13 +991,13 @@ function rn(t, n) {
912
991
  }
913
992
  );
914
993
  }
915
- const Dn = St(rn);
916
- function on(t, n, l, f) {
994
+ const Vn = Vt(sn);
995
+ function dn(t, n, o, f) {
917
996
  if (t && t.headerGridColumns) {
918
- const r = t.headerGridColumns.left ? t.headerGridColumns.left : { xs: "auto", sm: "auto", md: "auto", lg: "auto" }, i = t.headerGridColumns.middle ? t.headerGridColumns.middle : { xs: "auto", sm: "auto", md: "auto", lg: "auto" }, c = t.headerGridColumns.right ? t.headerGridColumns.right : { xs: "auto", sm: "auto", md: "auto", lg: "auto" };
919
- return /* @__PURE__ */ x(Fe, { m: 0, gutter: "xs", justify: "center", align: "center", grow: !0, children: [
997
+ const r = t.headerGridColumns.left ? t.headerGridColumns.left : { xs: "auto", sm: "auto", md: "auto", lg: "auto" }, i = t.headerGridColumns.middle ? t.headerGridColumns.middle : { xs: "auto", sm: "auto", md: "auto", lg: "auto" }, u = t.headerGridColumns.right ? t.headerGridColumns.right : { xs: "auto", sm: "auto", md: "auto", lg: "auto" };
998
+ return /* @__PURE__ */ c(be, { m: 0, gutter: "xs", justify: "center", align: "center", grow: !0, children: [
920
999
  /* @__PURE__ */ e(
921
- Fe.Col,
1000
+ be.Col,
922
1001
  {
923
1002
  span: {
924
1003
  xs: r.xs,
@@ -936,7 +1015,7 @@ function on(t, n, l, f) {
936
1015
  }
937
1016
  ),
938
1017
  /* @__PURE__ */ e(
939
- Fe.Col,
1018
+ be.Col,
940
1019
  {
941
1020
  span: {
942
1021
  xs: i.xs,
@@ -953,13 +1032,13 @@ function on(t, n, l, f) {
953
1032
  }
954
1033
  ),
955
1034
  /* @__PURE__ */ e(
956
- Fe.Col,
1035
+ be.Col,
957
1036
  {
958
1037
  span: {
959
- xs: c.xs,
960
- sm: c.sm,
961
- md: c.md,
962
- lg: c.lg
1038
+ xs: u.xs,
1039
+ sm: u.sm,
1040
+ md: u.md,
1041
+ lg: u.lg
963
1042
  },
964
1043
  style: {
965
1044
  border: f ? "1px dashed" : "",
@@ -967,20 +1046,20 @@ function on(t, n, l, f) {
967
1046
  justifyContent: "flex-end",
968
1047
  alignItems: "center"
969
1048
  },
970
- children: l
1049
+ children: o
971
1050
  }
972
1051
  )
973
1052
  ] });
974
1053
  } else {
975
- const r = t && t.headerFlexGrow ? t.headerFlexGrow : "even", i = t && t.headerFlexRightJustifyContent ? t.headerFlexRightJustifyContent : "flex-end", c = t && t.headerFlexLeftJustifyContent ? t.headerFlexLeftJustifyContent : "flex-start";
976
- return /* @__PURE__ */ x(ge, { justify: "space-between", children: [
1054
+ const r = t && t.headerFlexGrow ? t.headerFlexGrow : "even", i = t && t.headerFlexRightJustifyContent ? t.headerFlexRightJustifyContent : "flex-end", u = t && t.headerFlexLeftJustifyContent ? t.headerFlexLeftJustifyContent : "flex-start";
1055
+ return /* @__PURE__ */ c(pe, { justify: "space-between", children: [
977
1056
  /* @__PURE__ */ e(
978
- ge,
1057
+ pe,
979
1058
  {
980
1059
  w: r === "left" || r === "even" ? "100%" : void 0,
981
1060
  maw: r === "left" || r === "even" ? void 0 : "100%",
982
1061
  align: "center",
983
- justify: c,
1062
+ justify: u,
984
1063
  style: {
985
1064
  border: f ? "1px dashed" : ""
986
1065
  },
@@ -988,7 +1067,7 @@ function on(t, n, l, f) {
988
1067
  }
989
1068
  ),
990
1069
  /* @__PURE__ */ e(
991
- ge,
1070
+ pe,
992
1071
  {
993
1072
  w: r === "right" || r === "even" ? "100%" : void 0,
994
1073
  maw: r === "right" || r === "even" ? void 0 : "100%",
@@ -997,18 +1076,18 @@ function on(t, n, l, f) {
997
1076
  style: {
998
1077
  border: f ? "1px dashed" : ""
999
1078
  },
1000
- children: l
1079
+ children: o
1001
1080
  }
1002
1081
  )
1003
1082
  ] });
1004
1083
  }
1005
1084
  }
1006
- function ln(t, n, l, f) {
1085
+ function hn(t, n, o, f) {
1007
1086
  if (t && t.footerGridColumns) {
1008
- const r = t.footerGridColumns.left ? t.footerGridColumns.left : { xs: "content", sm: "content", md: "content", lg: "content" }, i = t.footerGridColumns.middle ? t.footerGridColumns.middle : { xs: "auto", sm: "auto", md: "auto", lg: "auto" }, c = t.footerGridColumns.right ? t.footerGridColumns.right : { xs: "content", sm: "content", md: "content", lg: "content" };
1009
- return /* @__PURE__ */ x(Fe, { m: 0, gutter: "xs", justify: "center", align: "center", grow: !0, children: [
1087
+ const r = t.footerGridColumns.left ? t.footerGridColumns.left : { xs: "content", sm: "content", md: "content", lg: "content" }, i = t.footerGridColumns.middle ? t.footerGridColumns.middle : { xs: "auto", sm: "auto", md: "auto", lg: "auto" }, u = t.footerGridColumns.right ? t.footerGridColumns.right : { xs: "content", sm: "content", md: "content", lg: "content" };
1088
+ return /* @__PURE__ */ c(be, { m: 0, gutter: "xs", justify: "center", align: "center", grow: !0, children: [
1010
1089
  /* @__PURE__ */ e(
1011
- Fe.Col,
1090
+ be.Col,
1012
1091
  {
1013
1092
  span: {
1014
1093
  xs: r.xs,
@@ -1026,7 +1105,7 @@ function ln(t, n, l, f) {
1026
1105
  }
1027
1106
  ),
1028
1107
  /* @__PURE__ */ e(
1029
- Fe.Col,
1108
+ be.Col,
1030
1109
  {
1031
1110
  span: {
1032
1111
  xs: i.xs,
@@ -1043,13 +1122,13 @@ function ln(t, n, l, f) {
1043
1122
  }
1044
1123
  ),
1045
1124
  /* @__PURE__ */ e(
1046
- Fe.Col,
1125
+ be.Col,
1047
1126
  {
1048
1127
  span: {
1049
- xs: c.xs,
1050
- sm: c.sm,
1051
- md: c.md,
1052
- lg: c.lg
1128
+ xs: u.xs,
1129
+ sm: u.sm,
1130
+ md: u.md,
1131
+ lg: u.lg
1053
1132
  },
1054
1133
  style: {
1055
1134
  border: f ? "1px dashed" : "",
@@ -1057,20 +1136,20 @@ function ln(t, n, l, f) {
1057
1136
  justifyContent: "flex-end",
1058
1137
  alignItems: "center"
1059
1138
  },
1060
- children: l
1139
+ children: o
1061
1140
  }
1062
1141
  )
1063
1142
  ] });
1064
1143
  } else {
1065
- const r = t && t.footerFlexGrow ? t.footerFlexGrow : "even", i = t && t.footerFlexRightJustifyContent ? t.footerFlexRightJustifyContent : "flex-end", c = t && t.footerFlexLeftJustifyContent ? t.footerFlexLeftJustifyContent : "flex-start";
1066
- return /* @__PURE__ */ x(ge, { justify: "space-between", children: [
1144
+ const r = t && t.footerFlexGrow ? t.footerFlexGrow : "even", i = t && t.footerFlexRightJustifyContent ? t.footerFlexRightJustifyContent : "flex-end", u = t && t.footerFlexLeftJustifyContent ? t.footerFlexLeftJustifyContent : "flex-start";
1145
+ return /* @__PURE__ */ c(pe, { justify: "space-between", children: [
1067
1146
  /* @__PURE__ */ e(
1068
- ge,
1147
+ pe,
1069
1148
  {
1070
1149
  w: r === "left" || r === "even" ? "100%" : void 0,
1071
1150
  maw: r === "left" || r === "even" ? void 0 : "100%",
1072
1151
  align: "center",
1073
- justify: c,
1152
+ justify: u,
1074
1153
  style: {
1075
1154
  border: f ? "1px dashed" : "",
1076
1155
  height: "auto",
@@ -1080,7 +1159,7 @@ function ln(t, n, l, f) {
1080
1159
  }
1081
1160
  ),
1082
1161
  /* @__PURE__ */ e(
1083
- ge,
1162
+ pe,
1084
1163
  {
1085
1164
  w: r === "right" || r === "even" ? "100%" : void 0,
1086
1165
  maw: r === "right" || r === "even" ? void 0 : "100%",
@@ -1089,362 +1168,362 @@ function ln(t, n, l, f) {
1089
1168
  style: {
1090
1169
  border: f ? "1px dashed" : "",
1091
1170
  height: "auto",
1092
- padding: l && "calc(0.625rem / 2)"
1171
+ padding: o && "calc(0.625rem / 2)"
1093
1172
  },
1094
- children: l
1173
+ children: o
1095
1174
  }
1096
1175
  )
1097
1176
  ] });
1098
1177
  }
1099
1178
  }
1100
- function Vt({
1179
+ function jt({
1101
1180
  title: t,
1102
1181
  innerRef: n,
1103
- isError: l = !1,
1182
+ isError: o = !1,
1104
1183
  error: f = "",
1105
1184
  clearError: r,
1106
1185
  width: i = "100%",
1107
- height: c = "100%",
1108
- withBorder: b = !0,
1109
- children: h,
1110
- radius: v,
1111
- debug: G,
1112
- defaultDebug: o,
1113
- headerLeft: a,
1114
- headerMiddle: S,
1115
- headerRight: w,
1116
- footerLeft: E,
1117
- footerMiddle: g,
1118
- footerRight: d,
1119
- variant: R,
1120
- options: I = {},
1121
- style: L,
1122
- debugOptions: y = {
1186
+ height: u = "100%",
1187
+ withBorder: v = !0,
1188
+ children: a,
1189
+ radius: C,
1190
+ debug: P,
1191
+ defaultDebug: l,
1192
+ headerLeft: s,
1193
+ headerMiddle: L,
1194
+ headerRight: I,
1195
+ footerLeft: w,
1196
+ footerMiddle: R,
1197
+ footerRight: m,
1198
+ variant: D,
1199
+ options: N = {},
1200
+ style: V,
1201
+ debugOptions: F = {
1123
1202
  debugLayoutHotKey: "ctrl+shift+S",
1124
1203
  debugObjectInspectorHotKey: "ctrl+shift+D",
1125
1204
  objectsToInspect: []
1126
1205
  },
1127
1206
  // Props de segurança (opcionais)
1128
- resourceName: p,
1129
- resourceDescription: D,
1130
- requiredPermissions: oe,
1131
- fallbackComponent: te,
1132
- securityOptions: K
1207
+ resourceName: h,
1208
+ resourceDescription: X,
1209
+ requiredPermissions: Z,
1210
+ fallbackComponent: ae,
1211
+ securityOptions: W
1133
1212
  }) {
1134
- const [M, B] = Gt({
1135
- value: G,
1136
- defaultValue: o,
1213
+ const [G, M] = Ht({
1214
+ value: P,
1215
+ defaultValue: l,
1137
1216
  finalValue: !1
1138
1217
  });
1139
- $t([[y && y.debugLayoutHotKey, () => B(!M)]]);
1140
- const A = Re(), { t: T } = Ut();
1141
- Ae({
1142
- autoRegisterActions: K?.autoRegisterActions ?? !0
1218
+ _t([[F && F.debugLayoutHotKey, () => M(!G)]]);
1219
+ const y = ze(), { t: U } = Jt();
1220
+ Pe({
1221
+ autoRegisterActions: W?.autoRegisterActions ?? !0
1143
1222
  });
1144
- const X = ue(null), V = n || X, Y = ue(null), ne = ue(null), Z = Ye(Y), U = Ye(ne), $ = Ye(V), _ = Be(() => ({
1145
- height: $.height - Z.height - U.height - Number(Pt("0.625rem")),
1146
- width: $.width - Z.width - U.width
1147
- }), [$.height, $.width, Z.height, Z.width, U.height, U.width]), re = ue(o);
1148
- _e(() => {
1149
- o !== re.current && (B(o), re.current = o);
1150
- }, [o, B]);
1151
- const ie = /* @__PURE__ */ x(ke, { children: [
1223
+ const ee = Ae(null), E = n || ee, te = Ae(null), se = Ae(null), ne = it(te), H = it(se), z = it(E), Y = He(() => ({
1224
+ height: z.height - ne.height - H.height - Number(Mt("0.625rem")),
1225
+ width: z.width - ne.width - H.width
1226
+ }), [z.height, z.width, ne.height, ne.width, H.height, H.width]), O = Ae(l);
1227
+ et(() => {
1228
+ l !== O.current && (M(l), O.current = l);
1229
+ }, [l, M]);
1230
+ const _ = /* @__PURE__ */ c(Me, { children: [
1152
1231
  /* @__PURE__ */ e(
1153
- Oe,
1232
+ Le,
1154
1233
  {
1155
- ref: V,
1156
- withBorder: b,
1157
- radius: v,
1158
- style: { width: i, height: c, padding: 4, ...L },
1159
- children: /* @__PURE__ */ x(rt, { height: "100%", children: [
1160
- /* @__PURE__ */ e(xt, { size: Z.height, children: /* @__PURE__ */ e("div", { ref: Y, children: on(I, a, w, M) }) }),
1161
- /* @__PURE__ */ e(it, { children: /* @__PURE__ */ e(
1162
- Ft,
1234
+ ref: E,
1235
+ withBorder: v,
1236
+ radius: C,
1237
+ style: { width: i, height: u, padding: 4, ...V },
1238
+ children: /* @__PURE__ */ c(ct, { height: "100%", children: [
1239
+ /* @__PURE__ */ e(Et, { size: ne.height, children: /* @__PURE__ */ e("div", { ref: te, children: dn(N, s, I, G) }) }),
1240
+ /* @__PURE__ */ e(st, { children: /* @__PURE__ */ e(
1241
+ Xe,
1163
1242
  {
1164
- h: _.height,
1243
+ h: Y.height,
1165
1244
  style: {
1166
- border: M ? "1px dashed" : "",
1245
+ border: G ? "1px dashed" : "",
1167
1246
  padding: "calc(0.625rem / 2)"
1168
1247
  },
1169
- children: h ? /* @__PURE__ */ x(jt, { children: [
1170
- l && /* @__PURE__ */ e(
1171
- Qe,
1248
+ children: a ? /* @__PURE__ */ c(Wt, { children: [
1249
+ o && /* @__PURE__ */ e(
1250
+ Ke,
1172
1251
  {
1173
1252
  autoClose: 2e4,
1174
1253
  withCloseButton: !0,
1175
1254
  withBorder: !0,
1176
- icon: /* @__PURE__ */ e(Ke, { size: "1.4rem" }),
1177
- title: `${T("WARNING")}`,
1255
+ icon: /* @__PURE__ */ e(Oe, { size: "1.4rem" }),
1256
+ title: `${U("WARNING")}`,
1178
1257
  titleColor: "rgb(250, 82, 82)",
1179
- variant: R ?? A.variant,
1258
+ variant: D ?? y.variant,
1180
1259
  onClose: () => r && r(),
1181
1260
  children: /* @__PURE__ */ e("span", { children: f })
1182
1261
  }
1183
1262
  ),
1184
- h
1185
- ] }) : M && /* @__PURE__ */ e(ge, { h: _.height + 80, justify: "center", align: "center", wrap: "wrap", children: /* @__PURE__ */ e(Te, { size: "lg", children: "INSIRA O CONTEÚDO DO PAINEL AQUI." }) })
1263
+ a
1264
+ ] }) : G && /* @__PURE__ */ e(pe, { h: Y.height + 80, justify: "center", align: "center", wrap: "wrap", children: /* @__PURE__ */ e(ye, { size: "lg", children: "INSIRA O CONTEÚDO DO PAINEL AQUI." }) })
1186
1265
  }
1187
1266
  ) }),
1188
- /* @__PURE__ */ e(ot, { size: U.height, children: /* @__PURE__ */ e("div", { ref: ne, children: ln(I, E, d, M) }) })
1267
+ /* @__PURE__ */ e(dt, { size: H.height, children: /* @__PURE__ */ e("div", { ref: se, children: hn(N, w, m, G) }) })
1189
1268
  ] })
1190
1269
  }
1191
1270
  ),
1192
1271
  /* @__PURE__ */ e(
1193
- Wt,
1272
+ Yt,
1194
1273
  {
1195
- debugObjectInspectorHotKey: y && y.debugObjectInspectorHotKey,
1196
- objectsToInspect: y && y.objectsToInspect
1274
+ debugObjectInspectorHotKey: F && F.debugObjectInspectorHotKey,
1275
+ objectsToInspect: F && F.objectsToInspect
1197
1276
  }
1198
1277
  )
1199
1278
  ] });
1200
1279
  return /* @__PURE__ */ e(
1201
- Ee,
1280
+ Ge,
1202
1281
  {
1203
- resourceName: p,
1204
- resourceDescription: D,
1205
- requiredPermissions: oe,
1206
- fallbackComponent: te,
1207
- onSecurityReady: K?.onSecurityReady,
1208
- onAccessDenied: K?.onAccessDenied,
1209
- children: ie
1282
+ resourceName: h,
1283
+ resourceDescription: X,
1284
+ requiredPermissions: Z,
1285
+ fallbackComponent: ae,
1286
+ onSecurityReady: W?.onSecurityReady,
1287
+ onAccessDenied: W?.onAccessDenied,
1288
+ children: _
1210
1289
  }
1211
1290
  );
1212
1291
  }
1213
- function an(t, n, l, f, r, i) {
1214
- console.log(`Render de "${t}" na fase "${n}": ${l}ms`);
1292
+ function un(t, n, o, f, r, i) {
1293
+ console.log(`Render de "${t}" na fase "${n}": ${o}ms`);
1215
1294
  }
1216
- function Tn({
1295
+ function zn({
1217
1296
  title: t,
1218
1297
  dataSource: n,
1219
1298
  // dataSourceEdition,
1220
- filterOptions: l,
1299
+ filterOptions: o,
1221
1300
  globalFilterFieldNames: f,
1222
1301
  //pageSize,
1223
1302
  filterFields: r,
1224
1303
  innerRef: i,
1225
1304
  //isLoading = false,
1226
- debug: c = !1,
1227
- filterType: b = "normal",
1228
- isError: h = !1,
1229
- error: v = "",
1230
- clearError: G = () => {
1305
+ debug: u = !1,
1306
+ filterType: v = "normal",
1307
+ isError: a = !1,
1308
+ error: C = "",
1309
+ clearError: P = () => {
1231
1310
  },
1232
- width: o = "100%",
1233
- height: a = "100%",
1234
- withBorder: S = !0,
1235
- filterPersistenceDelegator: w,
1236
- withPagination: E = !0,
1237
- radius: g,
1238
- userActions: d,
1239
- columnsCountBreakPoints: R,
1240
- columnsCount: I,
1241
- gutter: L,
1242
- component: y,
1243
- activeIndex: p,
1244
- activeBackgroundColor: D,
1245
- activeColor: oe,
1246
- onItemEnter: te,
1247
- onItemLeave: K,
1248
- style: M,
1249
- spaceOptions: B,
1250
- variant: A,
1251
- id: T = en("masonry"),
1252
- debugOptions: X,
1311
+ width: l = "100%",
1312
+ height: s = "100%",
1313
+ withBorder: L = !0,
1314
+ filterPersistenceDelegator: I,
1315
+ withPagination: w = !0,
1316
+ radius: R,
1317
+ userActions: m,
1318
+ columnsCountBreakPoints: D,
1319
+ columnsCount: N,
1320
+ gutter: V,
1321
+ component: F,
1322
+ activeIndex: h,
1323
+ activeBackgroundColor: X,
1324
+ activeColor: Z,
1325
+ onItemEnter: ae,
1326
+ onItemLeave: W,
1327
+ style: G,
1328
+ spaceOptions: M,
1329
+ variant: y,
1330
+ id: U = on("masonry"),
1331
+ debugOptions: ee,
1253
1332
  // Props de segurança (opcionais)
1254
- resourceName: V,
1255
- resourceDescription: Y,
1256
- requiredPermissions: ne,
1257
- fallbackComponent: Z,
1258
- securityOptions: U
1333
+ resourceName: E,
1334
+ resourceDescription: te,
1335
+ requiredPermissions: se,
1336
+ fallbackComponent: ne,
1337
+ securityOptions: H
1259
1338
  }) {
1260
- const $ = Re(), [_] = O(T), re = i || ue(null), ie = ue(null), [j, le] = O(n.getCurrentPage()), [he, s] = O(
1261
- p || (n && n.getTotalRecords() > 0 ? 0 : -1)
1339
+ const z = ze(), [Y] = Q(U), O = i || Ae(null), _ = Ae(null), [ue, Ce] = Q(n.getCurrentPage()), [le, d] = Q(
1340
+ h || (n && n.getTotalRecords() > 0 ? 0 : -1)
1262
1341
  );
1263
- Ye(re);
1264
- const [N, W] = O({
1342
+ it(O);
1343
+ const [k, $] = Q({
1265
1344
  activeFilterIndex: -1,
1266
1345
  expandedFilter: !1
1267
- }), [xe, fe] = O(0), {
1268
- isDataSourceV2: H,
1269
- v1State: { forceUpdate: be }
1270
- } = Ge(
1346
+ }), [we, de] = Q(0), {
1347
+ isDataSourceV2: B,
1348
+ v1State: { forceUpdate: me }
1349
+ } = _e(
1271
1350
  "ArchbaseMasonryTemplate",
1272
1351
  n
1273
1352
  );
1274
1353
  nt({
1275
1354
  dataSource: n,
1276
- listener: (m) => {
1277
- (m.type === Ce.afterRemove || m.type === Ce.refreshData) && (fe((P) => P + 1), H || be());
1355
+ listener: (g) => {
1356
+ (g.type === Re.afterRemove || g.type === Re.refreshData) && (de((j) => j + 1), B || me());
1278
1357
  }
1279
1358
  });
1280
- const ye = Be(() => {
1281
- if (y) {
1282
- const m = y.type;
1283
- let P = {};
1284
- return y.props && (P = y.props), n.browseRecords().map((J, ce) => {
1285
- const de = `${_}_${ce}`, we = `${_}_${ce}`;
1286
- let Ie = J.active === void 0 ? !1 : J.active;
1287
- return he >= 0 && (Ie = !1, he === ce && (Ie = !0)), /* @__PURE__ */ e(
1288
- m,
1359
+ const xe = He(() => {
1360
+ if (F) {
1361
+ const g = F.type;
1362
+ let j = {};
1363
+ return F.props && (j = F.props), n.browseRecords().map((q, ge) => {
1364
+ const ve = `${Y}_${ge}`, ke = `${Y}_${ge}`;
1365
+ let Ve = q.active === void 0 ? !1 : q.active;
1366
+ return le >= 0 && (Ve = !1, le === ge && (Ve = !0)), /* @__PURE__ */ e(
1367
+ g,
1289
1368
  {
1290
- id: we,
1291
- active: Ie,
1292
- index: ce,
1369
+ id: ke,
1370
+ active: Ve,
1371
+ index: ge,
1293
1372
  dataSource: n,
1294
- recordData: J,
1295
- disabled: J.disabled,
1296
- ...P
1373
+ recordData: q,
1374
+ disabled: q.disabled,
1375
+ ...j
1297
1376
  },
1298
- de
1377
+ ve
1299
1378
  );
1300
1379
  });
1301
1380
  }
1302
1381
  return [];
1303
- }, [he, y, _, n, xe]), $e = (m, P) => {
1304
- W({ ...N, currentFilter: m, activeFilterIndex: P });
1305
- }, Ve = (m) => {
1306
- W({ ...N, expandedFilter: m });
1307
- }, z = (m, P) => {
1308
- W({ ...N, currentFilter: m, activeFilterIndex: P });
1309
- }, ae = () => {
1310
- }, ze = (m, P) => {
1311
- s(m), n && n.gotoRecordByData(P);
1312
- }, Se = (m) => {
1382
+ }, [le, F, Y, n, we]), Fe = (g, j) => {
1383
+ $({ ...k, currentFilter: g, activeFilterIndex: j });
1384
+ }, Ie = (g) => {
1385
+ $({ ...k, expandedFilter: g });
1386
+ }, A = (g, j) => {
1387
+ $({ ...k, currentFilter: g, activeFilterIndex: j });
1388
+ }, ce = () => {
1389
+ }, Ne = (g, j) => {
1390
+ d(g), n && n.gotoRecordByData(j);
1391
+ }, De = (g) => {
1313
1392
  if (n) {
1314
- const P = n.getOptions();
1315
- P.filter = m, P.currentPage = j, n.refreshData(P), H || be();
1393
+ const j = n.getOptions();
1394
+ j.filter = g, j.currentPage = ue, n.refreshData(j), B || me();
1316
1395
  }
1317
- }, Le = (m) => {
1396
+ }, re = (g) => {
1318
1397
  if (n) {
1319
- const P = n.getOptions();
1320
- P.currentPage = m, n.refreshData(P), H || be();
1398
+ const j = n.getOptions();
1399
+ j.currentPage = g, n.refreshData(j), B || me();
1321
1400
  }
1322
- }, q = () => b === "normal" && f ? /* @__PURE__ */ e(
1323
- Zt,
1401
+ }, S = () => v === "normal" && f ? /* @__PURE__ */ e(
1402
+ ln,
1324
1403
  {
1325
1404
  searchableFields: f,
1326
- onFilter: Se,
1405
+ onFilter: De,
1327
1406
  minFilterValueLength: 1
1328
1407
  }
1329
- ) : b === "advanced" ? /* @__PURE__ */ e(Ht, { id: `profile_${l.componentName}`, onRender: an, children: /* @__PURE__ */ e(
1330
- vt,
1408
+ ) : v === "advanced" ? /* @__PURE__ */ e(Ot, { id: `profile_${o.componentName}`, onRender: un, children: /* @__PURE__ */ e(
1409
+ St,
1331
1410
  {
1332
- id: l.componentName,
1333
- viewName: l.viewName,
1334
- apiVersion: l.apiVersion,
1335
- ref: ie,
1336
- variant: A || $.variant,
1337
- expandedFilter: N.expandedFilter,
1338
- persistenceDelegator: w,
1339
- currentFilter: N.currentFilter,
1340
- activeFilterIndex: N.activeFilterIndex,
1341
- onSelectedFilter: z,
1342
- onFilterChanged: $e,
1343
- onSearchByFilter: ae,
1344
- onToggleExpandedFilter: Ve,
1411
+ id: o.componentName,
1412
+ viewName: o.viewName,
1413
+ apiVersion: o.apiVersion,
1414
+ ref: _,
1415
+ variant: y || z.variant,
1416
+ expandedFilter: k.expandedFilter,
1417
+ persistenceDelegator: I,
1418
+ currentFilter: k.currentFilter,
1419
+ activeFilterIndex: k.activeFilterIndex,
1420
+ onSelectedFilter: A,
1421
+ onFilterChanged: Fe,
1422
+ onSearchByFilter: ce,
1423
+ onToggleExpandedFilter: Ie,
1345
1424
  width: "660px",
1346
1425
  height: "170px",
1347
1426
  children: r
1348
1427
  }
1349
- ) }) : /* @__PURE__ */ e(ke, {}), ve = { ...{
1428
+ ) }) : /* @__PURE__ */ e(Me, {}), Te = { ...{
1350
1429
  headerFlexGrow: "left",
1351
1430
  footerGridColumns: {}
1352
- }, ...B };
1431
+ }, ...M };
1353
1432
  return /* @__PURE__ */ e(
1354
- Ee,
1433
+ Ge,
1355
1434
  {
1356
- resourceName: V,
1357
- resourceDescription: Y,
1358
- requiredPermissions: ne,
1359
- fallbackComponent: Z,
1360
- onSecurityReady: U?.onSecurityReady,
1361
- onAccessDenied: U?.onAccessDenied,
1435
+ resourceName: E,
1436
+ resourceDescription: te,
1437
+ requiredPermissions: se,
1438
+ fallbackComponent: ne,
1439
+ onSecurityReady: H?.onSecurityReady,
1440
+ onAccessDenied: H?.onAccessDenied,
1362
1441
  children: /* @__PURE__ */ e(
1363
- Vt,
1442
+ jt,
1364
1443
  {
1365
- innerRef: re,
1366
- width: o,
1367
- height: a,
1368
- radius: g,
1369
- withBorder: S,
1370
- isError: h,
1371
- error: v,
1372
- clearError: G,
1444
+ innerRef: O,
1445
+ width: l,
1446
+ height: s,
1447
+ radius: R,
1448
+ withBorder: L,
1449
+ isError: a,
1450
+ error: C,
1451
+ clearError: P,
1373
1452
  title: t,
1374
- defaultDebug: c,
1375
- debugOptions: X,
1376
- style: M,
1377
- options: ve,
1378
- headerLeft: d?.visible !== !1 ? /* @__PURE__ */ x(ge, { gap: "8px", rowGap: "8px", children: [
1379
- d?.customUserActions && d?.customUserActionsPosition === "left" ? d.customUserActions : null,
1380
- d?.allowAdd !== !1 && d?.onAddExecute ? /* @__PURE__ */ e(
1381
- ee,
1453
+ defaultDebug: u,
1454
+ debugOptions: ee,
1455
+ style: G,
1456
+ options: Te,
1457
+ headerLeft: m?.visible !== !1 ? /* @__PURE__ */ c(pe, { gap: "8px", rowGap: "8px", children: [
1458
+ m?.customUserActions && m?.customUserActionsPosition === "left" ? m.customUserActions : null,
1459
+ m?.allowAdd !== !1 && m?.onAddExecute ? /* @__PURE__ */ e(
1460
+ J,
1382
1461
  {
1383
1462
  actionName: "add",
1384
- actionDescription: `Adicionar novo ${Y || "registro"}`,
1463
+ actionDescription: `Adicionar novo ${te || "registro"}`,
1385
1464
  color: "green",
1386
- variant: A ?? $.variant,
1387
- leftSection: /* @__PURE__ */ e(gt, {}),
1388
- onClick: () => d.onAddExecute(),
1389
- children: d.labelAdd || C().t("archbase:New")
1465
+ variant: y ?? z.variant,
1466
+ leftSection: /* @__PURE__ */ e(bt, {}),
1467
+ onClick: () => m.onAddExecute(),
1468
+ children: m.labelAdd || x().t("archbase:New")
1390
1469
  }
1391
1470
  ) : null,
1392
- d?.allowEdit !== !1 && d?.onEditExecute ? /* @__PURE__ */ e(
1393
- ee,
1471
+ m?.allowEdit !== !1 && m?.onEditExecute ? /* @__PURE__ */ e(
1472
+ J,
1394
1473
  {
1395
1474
  actionName: "edit",
1396
- actionDescription: `Editar ${Y || "registro"}`,
1475
+ actionDescription: `Editar ${te || "registro"}`,
1397
1476
  color: "blue",
1398
- leftSection: /* @__PURE__ */ e(pt, {}),
1477
+ leftSection: /* @__PURE__ */ e(wt, {}),
1399
1478
  disabled: !n.isBrowsing() || n.isEmpty(),
1400
- variant: A ?? $.variant,
1401
- onClick: () => d.onEditExecute(),
1402
- children: d.labelEdit || C().t("archbase:Edit")
1479
+ variant: y ?? z.variant,
1480
+ onClick: () => m.onEditExecute(),
1481
+ children: m.labelEdit || x().t("archbase:Edit")
1403
1482
  }
1404
1483
  ) : null,
1405
- d?.allowRemove !== !1 && d?.onRemoveExecute ? /* @__PURE__ */ e(
1406
- ee,
1484
+ m?.allowRemove !== !1 && m?.onRemoveExecute ? /* @__PURE__ */ e(
1485
+ J,
1407
1486
  {
1408
1487
  actionName: "delete",
1409
- actionDescription: `Remover ${Y || "registro"}`,
1488
+ actionDescription: `Remover ${te || "registro"}`,
1410
1489
  color: "red",
1411
- leftSection: /* @__PURE__ */ e(et, {}),
1490
+ leftSection: /* @__PURE__ */ e(tt, {}),
1412
1491
  disabled: !n.isBrowsing() || n.isEmpty(),
1413
- variant: A ?? $.variant,
1414
- onClick: () => d.onRemoveExecute(),
1415
- children: d.labelRemove || C().t("archbase:Remove")
1492
+ variant: y ?? z.variant,
1493
+ onClick: () => m.onRemoveExecute(),
1494
+ children: m.labelRemove || x().t("archbase:Remove")
1416
1495
  }
1417
1496
  ) : null,
1418
- d?.allowView !== !1 && d?.onViewExecute ? /* @__PURE__ */ e(
1419
- ee,
1497
+ m?.allowView !== !1 && m?.onViewExecute ? /* @__PURE__ */ e(
1498
+ J,
1420
1499
  {
1421
1500
  actionName: "view",
1422
- actionDescription: `Visualizar ${Y || "registro"}`,
1501
+ actionDescription: `Visualizar ${te || "registro"}`,
1423
1502
  color: "gray.7",
1424
- leftSection: /* @__PURE__ */ e(bt, {}),
1503
+ leftSection: /* @__PURE__ */ e(Ft, {}),
1425
1504
  disabled: !n.isBrowsing() || n.isEmpty(),
1426
- variant: A ?? $.variant,
1427
- onClick: () => d.onViewExecute(),
1428
- children: d.labelView || C().t("archbase:View")
1505
+ variant: y ?? z.variant,
1506
+ onClick: () => m.onViewExecute(),
1507
+ children: m.labelView || x().t("archbase:View")
1429
1508
  }
1430
1509
  ) : null,
1431
- d?.customUserActions && d?.customUserActionsPosition === "right" ? d.customUserActions : null
1510
+ m?.customUserActions && m?.customUserActionsPosition === "right" ? m.customUserActions : null
1432
1511
  ] }) : void 0,
1433
- headerRight: q(),
1434
- footerRight: E ? /* @__PURE__ */ e(At, { total: n.getTotalPages(), onChange: Le }) : void 0,
1512
+ headerRight: S(),
1513
+ footerRight: w ? /* @__PURE__ */ e(kt, { total: n.getTotalPages(), onChange: re }) : void 0,
1435
1514
  children: /* @__PURE__ */ e(
1436
- Ot,
1515
+ Zt,
1437
1516
  {
1438
1517
  value: {
1439
1518
  dataSource: n,
1440
- ownerId: T,
1441
- handleSelectItem: ze,
1442
- activeBackgroundColor: D,
1443
- activeColor: oe,
1444
- onItemEnter: te,
1445
- onItemLeave: K
1519
+ ownerId: U,
1520
+ handleSelectItem: Ne,
1521
+ activeBackgroundColor: X,
1522
+ activeColor: Z,
1523
+ onItemEnter: ae,
1524
+ onItemLeave: W
1446
1525
  },
1447
- children: /* @__PURE__ */ e(Kt, { columnsCountBreakPoints: R, children: /* @__PURE__ */ e(Qt, { gutter: L, columnsCount: I, children: ye }) })
1526
+ children: /* @__PURE__ */ e(en, { columnsCountBreakPoints: D, children: /* @__PURE__ */ e(tn, { gutter: V, columnsCount: N, children: xe }) })
1448
1527
  }
1449
1528
  )
1450
1529
  }
@@ -1452,7 +1531,7 @@ function Tn({
1452
1531
  }
1453
1532
  );
1454
1533
  }
1455
- const sn = {
1534
+ const fn = {
1456
1535
  visible: !0,
1457
1536
  allowAdd: !0,
1458
1537
  allowEdit: !0,
@@ -1460,499 +1539,899 @@ const sn = {
1460
1539
  allowRemove: !0,
1461
1540
  positionCustomUserActions: "after"
1462
1541
  };
1463
- function Bn({
1542
+ function Pn({
1464
1543
  title: t,
1465
1544
  dataSource: n,
1466
1545
  // dataSourceEdition,
1467
- filterOptions: l,
1546
+ filterOptions: o,
1468
1547
  //pageSize,
1469
1548
  filterFields: f,
1470
1549
  innerRef: r,
1471
1550
  //isLoading = false,
1472
1551
  isError: i = !1,
1473
- error: c = "",
1474
- clearError: b = () => {
1552
+ error: u = "",
1553
+ clearError: v = () => {
1475
1554
  },
1476
- width: h = "100%",
1477
- height: v = "100%",
1478
- withBorder: G = !0,
1479
- filterPersistenceDelegator: o,
1480
- withPagination: a = !0,
1481
- children: S,
1482
- radius: w,
1483
- userActions: E,
1484
- debug: g = !1,
1485
- variant: d,
1486
- actionsButtonsOptions: R,
1487
- spaceOptions: I,
1488
- style: L,
1489
- debugOptions: y,
1555
+ width: a = "100%",
1556
+ height: C = "100%",
1557
+ withBorder: P = !0,
1558
+ filterPersistenceDelegator: l,
1559
+ withPagination: s = !0,
1560
+ children: L,
1561
+ radius: I,
1562
+ userActions: w,
1563
+ debug: R = !1,
1564
+ variant: m,
1565
+ actionsButtonsOptions: D,
1566
+ spaceOptions: N,
1567
+ style: V,
1568
+ debugOptions: F,
1490
1569
  // Props de segurança (opcionais)
1491
- resourceName: p,
1492
- resourceDescription: D,
1493
- requiredPermissions: oe,
1494
- fallbackComponent: te,
1495
- securityOptions: K
1570
+ resourceName: h,
1571
+ resourceDescription: X,
1572
+ requiredPermissions: Z,
1573
+ fallbackComponent: ae,
1574
+ securityOptions: W
1496
1575
  }) {
1497
- const M = Re(), B = Ae({
1498
- autoRegisterActions: K?.autoRegisterActions ?? !0
1499
- }), A = r || ue(null), T = ue(null), [X, V] = O({
1576
+ const G = ze(), M = Pe({
1577
+ autoRegisterActions: W?.autoRegisterActions ?? !0
1578
+ }), y = r || Ae(null), U = Ae(null), [ee, E] = Q({
1500
1579
  activeFilterIndex: -1,
1501
1580
  expandedFilter: !1
1502
1581
  }), {
1503
- isDataSourceV2: Y,
1504
- v1State: { forceUpdate: ne }
1505
- } = Ge(
1582
+ isDataSourceV2: te,
1583
+ v1State: { forceUpdate: se }
1584
+ } = _e(
1506
1585
  "ArchbasePanelTemplate",
1507
1586
  n
1508
- ), Z = Be(() => {
1509
- const s = { ...sn, ...E }, N = (xe) => B.isAvailable ? (B.registerAction(), B.hasPermission()) : !0, W = [];
1510
- return s.allowAdd && s.onAddExecute && N() && W.push({
1587
+ ), ne = He(() => {
1588
+ const d = { ...fn, ...w }, k = (we) => M.isAvailable ? (M.registerAction(), M.hasPermission()) : !0, $ = [];
1589
+ return d.allowAdd && d.onAddExecute && k() && $.push({
1511
1590
  id: "1",
1512
- icon: /* @__PURE__ */ e(gt, {}),
1591
+ icon: /* @__PURE__ */ e(bt, {}),
1513
1592
  color: "green",
1514
- label: s.labelAdd ? s.labelAdd : C().t("archbase:New"),
1593
+ label: d.labelAdd ? d.labelAdd : x().t("archbase:New"),
1515
1594
  executeAction: () => {
1516
- s && s.onAddExecute && s.onAddExecute();
1595
+ d && d.onAddExecute && d.onAddExecute();
1517
1596
  },
1518
1597
  enabled: !0,
1519
1598
  hint: "Clique para criar."
1520
- }), s.allowEdit && s.onEditExecute && N() && W.push({
1599
+ }), d.allowEdit && d.onEditExecute && k() && $.push({
1521
1600
  id: "2",
1522
- icon: /* @__PURE__ */ e(pt, {}),
1601
+ icon: /* @__PURE__ */ e(wt, {}),
1523
1602
  color: "blue",
1524
- label: s.labelEdit ? s.labelEdit : C().t("archbase:Edit"),
1603
+ label: d.labelEdit ? d.labelEdit : x().t("archbase:Edit"),
1525
1604
  executeAction: () => {
1526
- s && s.onEditExecute && s.onEditExecute();
1605
+ d && d.onEditExecute && d.onEditExecute();
1527
1606
  },
1528
1607
  enabled: !n.isEmpty() && n.isBrowsing(),
1529
1608
  hint: "Clique para editar."
1530
- }), s.allowRemove && s.onRemoveExecute && N() && W.push({
1609
+ }), d.allowRemove && d.onRemoveExecute && k() && $.push({
1531
1610
  id: "3",
1532
- icon: /* @__PURE__ */ e(et, {}),
1611
+ icon: /* @__PURE__ */ e(tt, {}),
1533
1612
  color: "red",
1534
- label: s.labelRemove ? s.labelRemove : C().t("archbase:Remove"),
1613
+ label: d.labelRemove ? d.labelRemove : x().t("archbase:Remove"),
1535
1614
  executeAction: () => {
1536
- s && s.onRemoveExecute && s.onRemoveExecute();
1615
+ d && d.onRemoveExecute && d.onRemoveExecute();
1537
1616
  },
1538
1617
  enabled: !n.isEmpty() && n.isBrowsing(),
1539
1618
  hint: "Clique para remover."
1540
- }), s.allowView && s.onView && N() && W.push({
1619
+ }), d.allowView && d.onView && k() && $.push({
1541
1620
  id: "4",
1542
- icon: /* @__PURE__ */ e(bt, {}),
1621
+ icon: /* @__PURE__ */ e(Ft, {}),
1543
1622
  color: "green",
1544
- label: s.labelView ? s.labelView : C().t("archbase:View"),
1623
+ label: d.labelView ? d.labelView : x().t("archbase:View"),
1545
1624
  executeAction: () => {
1546
- s && s.onView && s.onView();
1625
+ d && d.onView && d.onView();
1547
1626
  },
1548
1627
  enabled: !n.isEmpty() && n.isBrowsing(),
1549
1628
  hint: "Clique para visualizar."
1550
- }), s.customUserActions && s.positionCustomUserActions === "before" ? [...s.customUserActions, ...W] : s.customUserActions && s.positionCustomUserActions === "after" ? [...W, ...s.customUserActions] : W;
1551
- }, [E, n, B]), U = (s, N) => {
1552
- V({ ...X, currentFilter: s, activeFilterIndex: N });
1553
- }, $ = (s) => {
1554
- V({ ...X, expandedFilter: s });
1555
- }, _ = (s, N) => {
1556
- V({ ...X, currentFilter: s, activeFilterIndex: N });
1557
- }, re = () => {
1558
- }, ie = {
1629
+ }), d.customUserActions && d.positionCustomUserActions === "before" ? [...d.customUserActions, ...$] : d.customUserActions && d.positionCustomUserActions === "after" ? [...$, ...d.customUserActions] : $;
1630
+ }, [w, n, M]), H = (d, k) => {
1631
+ E({ ...ee, currentFilter: d, activeFilterIndex: k });
1632
+ }, z = (d) => {
1633
+ E({ ...ee, expandedFilter: d });
1634
+ }, Y = (d, k) => {
1635
+ E({ ...ee, currentFilter: d, activeFilterIndex: k });
1636
+ }, O = () => {
1637
+ }, _ = {
1559
1638
  menuButtonColor: "blue.5",
1560
1639
  menuPosition: "left"
1561
- }, j = {
1640
+ }, ue = {
1562
1641
  headerFlexGrow: "left",
1563
1642
  footerFlexGrow: "right"
1564
1643
  // footerGridColumns: {},
1565
- }, le = { ...ie, ...R }, he = { ...j, ...I };
1644
+ }, Ce = { ..._, ...D }, le = { ...ue, ...N };
1566
1645
  return /* @__PURE__ */ e(
1567
- Ee,
1646
+ Ge,
1568
1647
  {
1569
- resourceName: p,
1570
- resourceDescription: D,
1571
- requiredPermissions: oe,
1572
- fallbackComponent: te,
1573
- onSecurityReady: K?.onSecurityReady,
1574
- onAccessDenied: K?.onAccessDenied,
1648
+ resourceName: h,
1649
+ resourceDescription: X,
1650
+ requiredPermissions: Z,
1651
+ fallbackComponent: ae,
1652
+ onSecurityReady: W?.onSecurityReady,
1653
+ onAccessDenied: W?.onAccessDenied,
1575
1654
  children: /* @__PURE__ */ e(
1576
- Vt,
1655
+ jt,
1577
1656
  {
1578
- innerRef: A,
1579
- width: h,
1580
- height: v,
1581
- radius: w,
1582
- withBorder: G,
1657
+ innerRef: y,
1658
+ width: a,
1659
+ height: C,
1660
+ radius: I,
1661
+ withBorder: P,
1583
1662
  isError: i,
1584
- error: c,
1585
- clearError: b,
1663
+ error: u,
1664
+ clearError: v,
1586
1665
  title: t,
1587
- defaultDebug: g,
1588
- debugOptions: y,
1589
- style: L,
1590
- options: he,
1591
- headerLeft: /* @__PURE__ */ e(Xt, { actions: Z, options: le }),
1666
+ defaultDebug: R,
1667
+ debugOptions: F,
1668
+ style: V,
1669
+ options: le,
1670
+ headerLeft: /* @__PURE__ */ e(nn, { actions: ne, options: Ce }),
1592
1671
  headerRight: /* @__PURE__ */ e(
1593
- vt,
1672
+ St,
1594
1673
  {
1595
- id: l.componentName,
1596
- viewName: l.viewName,
1597
- apiVersion: l.apiVersion,
1598
- ref: T,
1599
- variant: d || M.variant,
1600
- expandedFilter: X.expandedFilter,
1601
- persistenceDelegator: o,
1602
- currentFilter: X.currentFilter,
1603
- activeFilterIndex: X.activeFilterIndex,
1604
- onSelectedFilter: _,
1605
- onFilterChanged: U,
1606
- onSearchByFilter: re,
1607
- onToggleExpandedFilter: $,
1674
+ id: o.componentName,
1675
+ viewName: o.viewName,
1676
+ apiVersion: o.apiVersion,
1677
+ ref: U,
1678
+ variant: m || G.variant,
1679
+ expandedFilter: ee.expandedFilter,
1680
+ persistenceDelegator: l,
1681
+ currentFilter: ee.currentFilter,
1682
+ activeFilterIndex: ee.activeFilterIndex,
1683
+ onSelectedFilter: Y,
1684
+ onFilterChanged: H,
1685
+ onSearchByFilter: O,
1686
+ onToggleExpandedFilter: z,
1608
1687
  width: "660px",
1609
1688
  height: "170px",
1610
1689
  children: f
1611
1690
  }
1612
1691
  ),
1613
- footerRight: a && /* @__PURE__ */ e(At, { total: 10 }),
1614
- children: S
1692
+ footerRight: s && /* @__PURE__ */ e(kt, { total: 10 }),
1693
+ children: L
1615
1694
  }
1616
1695
  )
1617
1696
  }
1618
1697
  );
1619
1698
  }
1620
- function Vn() {
1699
+ function Gn() {
1621
1700
  return /* @__PURE__ */ e("div", { children: "SEARCH TEMPLATE" });
1622
1701
  }
1623
- function cn(t, n) {
1702
+ function $n({
1703
+ // Header
1704
+ title: t,
1705
+ subtitle: n,
1706
+ onBack: o,
1707
+ headerActions: f,
1708
+ showDeleteButton: r = !1,
1709
+ onDelete: i,
1710
+ saveLabel: u,
1711
+ cancelLabel: v,
1712
+ buttonsPosition: a = "header",
1713
+ // Left Column
1714
+ leftColumnContent: C,
1715
+ leftColumnSpan: P = 6,
1716
+ hideLeftColumn: l = !1,
1717
+ // Right Column - Form
1718
+ formTitle: s,
1719
+ formSubtitle: L,
1720
+ statusBadge: I,
1721
+ tabs: w,
1722
+ defaultTab: R,
1723
+ tabsVariant: m = "default",
1724
+ children: D,
1725
+ // Layout
1726
+ width: N = "100%",
1727
+ height: V = "100%",
1728
+ withBorder: F = !0,
1729
+ radius: h,
1730
+ style: X,
1731
+ // States
1732
+ innerRef: Z,
1733
+ isLoading: ae = !1,
1734
+ isCanceling: W = !1,
1735
+ isSaving: G = !1,
1736
+ isError: M = !1,
1737
+ error: y = "",
1738
+ clearError: U = () => {
1739
+ },
1740
+ autoCloseAlertError: ee = 15e3,
1741
+ // DataSource
1742
+ dataSource: E,
1743
+ variant: te,
1744
+ // Callbacks
1745
+ onSave: se,
1746
+ onCancel: ne,
1747
+ onBeforeSave: H,
1748
+ onAfterSave: z,
1749
+ onBeforeCancel: Y,
1750
+ onAfterCancel: O,
1751
+ onError: _,
1752
+ // Navigation
1753
+ routePath: ue,
1754
+ onBeforeClose: Ce,
1755
+ useNavigationListener: le,
1756
+ // Security
1757
+ resourceName: d,
1758
+ resourceDescription: k,
1759
+ requiredPermissions: $,
1760
+ fallbackComponent: we,
1761
+ securityOptions: de,
1762
+ ...B
1763
+ }) {
1764
+ const me = ze(), [xe, Fe] = Q(M), [Ie, A] = Q(y), [ce, Ne] = Q(R || (w?.[0]?.value ?? null)), De = ot();
1765
+ Pe({
1766
+ autoRegisterActions: de?.autoRegisterActions ?? !0
1767
+ });
1768
+ const re = _e(
1769
+ "ArchbaseTwoColumnFormTemplate",
1770
+ E,
1771
+ void 0,
1772
+ void 0
1773
+ );
1774
+ nt({
1775
+ dataSource: E,
1776
+ listener: (b) => {
1777
+ b.type === Re.onError && (Fe(!0), A(b.error)), (b.type === Re.afterEdit || b.type === Re.afterInsert) && (re.isDataSourceV2 || De());
1778
+ }
1779
+ });
1780
+ const S = Nt(), $e = ie((b, Ee) => ({
1781
+ closeAllowed: (je) => {
1782
+ }
1783
+ }), []), Te = le || $e, { closeAllowed: g } = Te(ue || "", () => {
1784
+ Ce && Ce() === !1 || g();
1785
+ }), j = async (b) => {
1786
+ try {
1787
+ se ? se(b) : (H && await H(b), E.isBrowsing() || E.save().then(() => {
1788
+ S?.clearAll(), z && z(b), g();
1789
+ }).catch((Ee) => {
1790
+ _ && _(fe(Ee)), Fe(!0), A(fe(Ee));
1791
+ }));
1792
+ } catch (Ee) {
1793
+ _ && _(fe(Ee)), Fe(!0), A(fe(Ee));
1794
+ }
1795
+ }, q = () => {
1796
+ try {
1797
+ ne ? ne(g) : (Y && Y(), E.isBrowsing() || E.cancel(), S?.clearAll(), O && O(), g());
1798
+ } catch (b) {
1799
+ _ && _(fe(b)), Fe(!0), A(fe(b));
1800
+ }
1801
+ }, ge = () => {
1802
+ U && U(), Fe(!1), A("");
1803
+ }, ve = l ? 12 : 12 - P, ke = E && !E.isBrowsing(), Ve = a === "header" || a === "both", Ue = a === "footer" || a === "both", qe = () => /* @__PURE__ */ e(oe, { gap: "sm", children: ke ? /* @__PURE__ */ c(Me, { children: [
1804
+ /* @__PURE__ */ e(
1805
+ J,
1806
+ {
1807
+ actionName: "cancel",
1808
+ actionDescription: "Cancelar operação",
1809
+ leftSection: /* @__PURE__ */ e(Be, { size: 16 }),
1810
+ onClick: q,
1811
+ variant: "default",
1812
+ loading: W,
1813
+ children: v || x().t("Cancel")
1814
+ }
1815
+ ),
1816
+ /* @__PURE__ */ e(
1817
+ J,
1818
+ {
1819
+ actionName: "save",
1820
+ actionDescription: `Salvar ${k || "registro"}`,
1821
+ leftSection: /* @__PURE__ */ e(xt, { size: 16 }),
1822
+ onClick: () => j(E.getCurrentRecord()),
1823
+ variant: te ?? me.variant,
1824
+ color: "blue",
1825
+ loading: G,
1826
+ children: u || x().t("Ok")
1827
+ }
1828
+ )
1829
+ ] }) : /* @__PURE__ */ e(
1830
+ J,
1831
+ {
1832
+ actionName: "close",
1833
+ actionDescription: "Fechar formulário",
1834
+ leftSection: /* @__PURE__ */ e(Be, { size: 16 }),
1835
+ onClick: q,
1836
+ variant: "default",
1837
+ children: x().t("Close")
1838
+ }
1839
+ ) });
1840
+ return /* @__PURE__ */ e(
1841
+ Ge,
1842
+ {
1843
+ resourceName: d,
1844
+ resourceDescription: k,
1845
+ requiredPermissions: $,
1846
+ fallbackComponent: we,
1847
+ onSecurityReady: de?.onSecurityReady,
1848
+ onAccessDenied: de?.onAccessDenied,
1849
+ children: /* @__PURE__ */ e(At, { children: /* @__PURE__ */ c(
1850
+ Le,
1851
+ {
1852
+ ref: Z,
1853
+ withBorder: F,
1854
+ radius: h,
1855
+ style: {
1856
+ width: N,
1857
+ height: V,
1858
+ display: "flex",
1859
+ flexDirection: "column",
1860
+ ...X
1861
+ },
1862
+ children: [
1863
+ /* @__PURE__ */ e(
1864
+ he,
1865
+ {
1866
+ style: {
1867
+ flexShrink: 0,
1868
+ padding: "16px 24px",
1869
+ borderBottom: "1px solid var(--mantine-color-gray-2)"
1870
+ },
1871
+ children: /* @__PURE__ */ c(pe, { justify: "space-between", align: "center", children: [
1872
+ /* @__PURE__ */ c(oe, { gap: "md", children: [
1873
+ o && /* @__PURE__ */ e(
1874
+ pt,
1875
+ {
1876
+ variant: "subtle",
1877
+ color: "gray",
1878
+ size: "lg",
1879
+ onClick: o,
1880
+ style: { border: "1px solid var(--mantine-color-gray-3)" },
1881
+ children: /* @__PURE__ */ e(Bt, { size: 18 })
1882
+ }
1883
+ ),
1884
+ /* @__PURE__ */ c(he, { children: [
1885
+ /* @__PURE__ */ e(Tt, { order: 4, fw: 600, children: t }),
1886
+ n && /* @__PURE__ */ e(ye, { size: "sm", c: "dimmed", children: n })
1887
+ ] })
1888
+ ] }),
1889
+ /* @__PURE__ */ c(oe, { gap: "sm", children: [
1890
+ f?.map((b) => /* @__PURE__ */ e(
1891
+ We,
1892
+ {
1893
+ variant: b.variant || "subtle",
1894
+ color: b.color,
1895
+ leftSection: b.icon,
1896
+ onClick: b.onClick,
1897
+ disabled: b.disabled,
1898
+ loading: b.loading,
1899
+ children: b.label
1900
+ },
1901
+ b.id
1902
+ )),
1903
+ r && i && /* @__PURE__ */ e(
1904
+ pt,
1905
+ {
1906
+ variant: "subtle",
1907
+ color: "red",
1908
+ size: "lg",
1909
+ onClick: i,
1910
+ style: { border: "1px solid var(--mantine-color-gray-3)" },
1911
+ children: /* @__PURE__ */ e(tt, { size: 18 })
1912
+ }
1913
+ ),
1914
+ Ve && qe()
1915
+ ] })
1916
+ ] })
1917
+ }
1918
+ ),
1919
+ xe && /* @__PURE__ */ e(he, { style: { flexShrink: 0, padding: "0 24px" }, children: /* @__PURE__ */ e(
1920
+ Ke,
1921
+ {
1922
+ autoClose: ee,
1923
+ withCloseButton: !0,
1924
+ withBorder: !0,
1925
+ icon: /* @__PURE__ */ e(Oe, { size: "1.4rem" }),
1926
+ title: x().t("WARNING"),
1927
+ titleColor: "rgb(250, 82, 82)",
1928
+ variant: te ?? me.variant,
1929
+ onClose: ge,
1930
+ children: /* @__PURE__ */ e("span", { children: Ie })
1931
+ }
1932
+ ) }),
1933
+ /* @__PURE__ */ c(he, { style: { flex: 1, minHeight: 0, padding: "24px" }, children: [
1934
+ /* @__PURE__ */ e(vt, { visible: ae || W || G, opacity: 0.3 }),
1935
+ /* @__PURE__ */ c(be, { gutter: "xl", style: { height: "100%" }, children: [
1936
+ !l && /* @__PURE__ */ e(be.Col, { span: { base: 12, md: P }, children: /* @__PURE__ */ e(Xe, { style: { height: "100%" }, children: /* @__PURE__ */ e(yt, { gap: "md", children: C }) }) }),
1937
+ /* @__PURE__ */ e(be.Col, { span: { base: 12, md: ve }, children: /* @__PURE__ */ c(
1938
+ Le,
1939
+ {
1940
+ withBorder: !0,
1941
+ radius: "md",
1942
+ style: {
1943
+ height: "100%",
1944
+ display: "flex",
1945
+ flexDirection: "column",
1946
+ backgroundColor: "var(--mantine-color-white)"
1947
+ },
1948
+ children: [
1949
+ (s || I) && /* @__PURE__ */ e(
1950
+ he,
1951
+ {
1952
+ style: {
1953
+ flexShrink: 0,
1954
+ padding: "16px 20px",
1955
+ borderBottom: w ? "1px solid var(--mantine-color-gray-2)" : "none"
1956
+ },
1957
+ children: /* @__PURE__ */ c(pe, { justify: "space-between", align: "flex-start", children: [
1958
+ /* @__PURE__ */ c(he, { children: [
1959
+ s && /* @__PURE__ */ e(ye, { fw: 600, size: "lg", children: s }),
1960
+ L && /* @__PURE__ */ e(ye, { size: "sm", c: "dimmed", mt: 4, children: L })
1961
+ ] }),
1962
+ I
1963
+ ] })
1964
+ }
1965
+ ),
1966
+ /* @__PURE__ */ e(he, { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: w && w.length > 0 ? /* @__PURE__ */ c(
1967
+ rt,
1968
+ {
1969
+ value: ce,
1970
+ onChange: Ne,
1971
+ variant: m,
1972
+ style: { flex: 1, display: "flex", flexDirection: "column" },
1973
+ children: [
1974
+ /* @__PURE__ */ e(rt.List, { style: { flexShrink: 0, padding: "0 20px" }, children: w.map((b) => /* @__PURE__ */ e(
1975
+ rt.Tab,
1976
+ {
1977
+ value: b.value,
1978
+ leftSection: b.icon,
1979
+ children: b.label
1980
+ },
1981
+ b.value
1982
+ )) }),
1983
+ w.map((b) => /* @__PURE__ */ e(
1984
+ rt.Panel,
1985
+ {
1986
+ value: b.value,
1987
+ style: { flex: 1, minHeight: 0 },
1988
+ children: /* @__PURE__ */ e(Xe, { style: { height: "100%", padding: "20px" }, children: b.content })
1989
+ },
1990
+ b.value
1991
+ ))
1992
+ ]
1993
+ }
1994
+ ) : /* @__PURE__ */ e(Xe, { style: { flex: 1, padding: "20px" }, children: D }) })
1995
+ ]
1996
+ }
1997
+ ) })
1998
+ ] })
1999
+ ] }),
2000
+ Ue && /* @__PURE__ */ e(
2001
+ he,
2002
+ {
2003
+ style: {
2004
+ flexShrink: 0,
2005
+ padding: "16px 24px",
2006
+ borderTop: "1px solid var(--mantine-color-gray-2)",
2007
+ display: "flex",
2008
+ justifyContent: "flex-end"
2009
+ },
2010
+ children: qe()
2011
+ }
2012
+ )
2013
+ ]
2014
+ }
2015
+ ) })
2016
+ }
2017
+ );
2018
+ }
2019
+ function jn({ title: t, description: n, headerAction: o, children: f }) {
2020
+ return /* @__PURE__ */ c(Le, { withBorder: !0, radius: "md", p: "md", children: [
2021
+ /* @__PURE__ */ c(pe, { justify: "space-between", align: "flex-start", mb: n || o ? "sm" : 0, children: [
2022
+ /* @__PURE__ */ c(he, { children: [
2023
+ /* @__PURE__ */ e(ye, { fw: 600, size: "sm", children: t }),
2024
+ n && /* @__PURE__ */ e(ye, { size: "xs", c: "dimmed", mt: 2, children: n })
2025
+ ] }),
2026
+ o
2027
+ ] }),
2028
+ f
2029
+ ] });
2030
+ }
2031
+ function Ln({ images: t, onAddImage: n, onRemoveImage: o, onSetCover: f, maxImages: r = 6 }) {
2032
+ const i = t.find((a) => a.isCover) || t[0], u = t.filter((a) => a.id !== i?.id), v = t.length < r;
2033
+ return /* @__PURE__ */ c(yt, { gap: "sm", children: [
2034
+ i && /* @__PURE__ */ c(he, { style: { position: "relative" }, children: [
2035
+ /* @__PURE__ */ e(
2036
+ "img",
2037
+ {
2038
+ src: i.url,
2039
+ alt: i.alt || "Cover",
2040
+ style: {
2041
+ width: "100%",
2042
+ height: 200,
2043
+ objectFit: "cover",
2044
+ borderRadius: "var(--mantine-radius-md)",
2045
+ border: "1px solid var(--mantine-color-gray-3)"
2046
+ }
2047
+ }
2048
+ ),
2049
+ /* @__PURE__ */ e(
2050
+ Ut,
2051
+ {
2052
+ style: { position: "absolute", bottom: 8, left: 8 },
2053
+ variant: "filled",
2054
+ color: "dark",
2055
+ children: "Cover"
2056
+ }
2057
+ )
2058
+ ] }),
2059
+ /* @__PURE__ */ c(be, { gutter: "sm", children: [
2060
+ u.map((a) => /* @__PURE__ */ e(be.Col, { span: 4, children: /* @__PURE__ */ e(
2061
+ he,
2062
+ {
2063
+ style: { position: "relative", cursor: f ? "pointer" : "default" },
2064
+ onClick: () => f?.(a.id),
2065
+ children: /* @__PURE__ */ e(
2066
+ "img",
2067
+ {
2068
+ src: a.url,
2069
+ alt: a.alt || "Thumbnail",
2070
+ style: {
2071
+ width: "100%",
2072
+ height: 80,
2073
+ objectFit: "cover",
2074
+ borderRadius: "var(--mantine-radius-sm)",
2075
+ border: "1px solid var(--mantine-color-gray-3)"
2076
+ }
2077
+ }
2078
+ )
2079
+ }
2080
+ ) }, a.id)),
2081
+ v && n && /* @__PURE__ */ e(be.Col, { span: 4, children: /* @__PURE__ */ e(
2082
+ he,
2083
+ {
2084
+ onClick: n,
2085
+ style: {
2086
+ width: "100%",
2087
+ height: 80,
2088
+ border: "2px dashed var(--mantine-color-gray-4)",
2089
+ borderRadius: "var(--mantine-radius-sm)",
2090
+ display: "flex",
2091
+ alignItems: "center",
2092
+ justifyContent: "center",
2093
+ cursor: "pointer",
2094
+ backgroundColor: "var(--mantine-color-gray-0)"
2095
+ },
2096
+ children: /* @__PURE__ */ e(ye, { size: "xl", c: "dimmed", children: "+" })
2097
+ }
2098
+ ) })
2099
+ ] })
2100
+ ] });
2101
+ }
2102
+ function mn(t, n) {
1624
2103
  const {
1625
2104
  // Props obrigatórias
1626
- opened: l,
2105
+ opened: o,
1627
2106
  title: f,
1628
2107
  children: r,
1629
2108
  onClose: i,
1630
- idField: c,
1631
- displayField: b,
2109
+ idField: u,
2110
+ displayField: v,
1632
2111
  // Seleção
1633
- selectionMode: h = "single",
1634
- onSelect: v,
1635
- onSelectMultiple: G,
1636
- initialSelectedItems: o,
1637
- selectOnDoubleClick: a = !0,
1638
- onBeforeConfirm: S,
1639
- onAfterConfirm: w,
2112
+ selectionMode: a = "single",
2113
+ onSelect: C,
2114
+ onSelectMultiple: P,
2115
+ initialSelectedItems: l,
2116
+ selectOnDoubleClick: s = !0,
2117
+ onBeforeConfirm: L,
2118
+ onAfterConfirm: I,
1640
2119
  // DataSource
1641
- dataSource: E,
1642
- loadData: g,
1643
- searchFields: d = "",
1644
- pageSize: R = 100,
2120
+ dataSource: w,
2121
+ loadData: R,
2122
+ searchFields: m = "",
2123
+ pageSize: D = 100,
1645
2124
  // Aparência
1646
- displaySubField: I,
1647
- renderSelectedItem: L,
1648
- renderSelectedItems: y,
1649
- icon: p,
1650
- modalSize: D = "70%",
1651
- modalHeight: oe = "600px",
1652
- gridHeight: te = 400,
1653
- rowHeight: K,
1654
- selectionIndicatorColor: M = "blue.0",
1655
- showSelectionIndicator: B = !0,
2125
+ displaySubField: N,
2126
+ renderSelectedItem: V,
2127
+ renderSelectedItems: F,
2128
+ icon: h,
2129
+ modalSize: X = "70%",
2130
+ modalHeight: Z = "600px",
2131
+ gridHeight: ae = 400,
2132
+ rowHeight: W,
2133
+ selectionIndicatorColor: G = "blue.0",
2134
+ showSelectionIndicator: M = !0,
1656
2135
  // Múltipla seleção
1657
- maxSelections: A,
1658
- showSelectionCount: T = !0,
1659
- allowClearAll: X = !0,
2136
+ maxSelections: y,
2137
+ showSelectionCount: U = !0,
2138
+ allowClearAll: ee = !0,
1660
2139
  // Estado
1661
- isLoading: V,
1662
- isError: Y = !1,
1663
- error: ne = "",
1664
- clearError: Z,
1665
- autoCloseAlertError: U = 15e3,
1666
- onError: $,
2140
+ isLoading: E,
2141
+ isError: te = !1,
2142
+ error: se = "",
2143
+ clearError: ne,
2144
+ autoCloseAlertError: H = 15e3,
2145
+ onError: z,
1667
2146
  // Customização
1668
- userActions: _,
1669
- labels: re,
1670
- variant: ie,
2147
+ userActions: Y,
2148
+ labels: O,
2149
+ variant: _,
1671
2150
  // Segurança
1672
- resourceName: j,
1673
- resourceDescription: le,
1674
- requiredPermissions: he,
1675
- fallbackComponent: s,
1676
- securityOptions: N
1677
- } = t, W = Re(), xe = tt(), { colorScheme: fe } = Ze(), H = fe === "dark", be = mt(), ye = H ? "dark.5" : M, [$e, Ve] = O(!1), [z, ae] = O(o || []), [ze, Se] = O(!1), [Le, q] = O(""), Me = ue(null), ve = ue([]), m = !!E, J = Q(() => m && E ? E : (Me.current || (Me.current = new Jt("dsLookup", {
2151
+ resourceName: ue,
2152
+ resourceDescription: Ce,
2153
+ requiredPermissions: le,
2154
+ fallbackComponent: d,
2155
+ securityOptions: k
2156
+ } = t, $ = ze(), we = at(), { colorScheme: de } = lt(), B = de === "dark", me = ot(), xe = B ? "dark.5" : G, [Fe, Ie] = Q(!1), [A, ce] = Q(l || []), [Ne, De] = Q(!1), [re, S] = Q(""), $e = Ae(null), Te = Ae([]), g = !!w, q = ie(() => g && w ? w : ($e.current || ($e.current = new Qt("dsLookup", {
1678
2157
  records: [],
1679
2158
  grandTotalRecords: 0,
1680
2159
  currentPage: 0,
1681
2160
  totalPages: 0,
1682
- pageSize: R
1683
- })), Me.current), [m, E, R])();
1684
- Ae({
1685
- autoRegisterActions: N?.autoRegisterActions ?? !0
2161
+ pageSize: D
2162
+ })), $e.current), [g, w, D])();
2163
+ Pe({
2164
+ autoRegisterActions: k?.autoRegisterActions ?? !0
1686
2165
  });
1687
- const ce = Ge(
2166
+ const ge = _e(
1688
2167
  "ArchbaseLookupDataTemplate",
1689
- J,
2168
+ q,
1690
2169
  void 0,
1691
2170
  void 0
1692
2171
  );
1693
2172
  nt({
1694
- dataSource: J,
1695
- listener: (u) => {
1696
- if (u.type === Ce.onError && (Se(!0), q(u.error || "")), u.type === Ce.afterScroll) {
1697
- if (h === "single") {
1698
- const k = J.getCurrentRecord();
1699
- k && ae([k]);
2173
+ dataSource: q,
2174
+ listener: (p) => {
2175
+ if (p.type === Re.onError && (De(!0), S(p.error || "")), p.type === Re.afterScroll) {
2176
+ if (a === "single") {
2177
+ const K = q.getCurrentRecord();
2178
+ K && ce([K]);
1700
2179
  }
1701
- ce.isDataSourceV2 || be();
2180
+ ge.isDataSourceV2 || me();
1702
2181
  }
1703
2182
  }
1704
2183
  });
1705
- const de = {
1706
- okButton: C().t("archbase:Ok"),
1707
- cancelButton: C().t("archbase:Cancel"),
1708
- clearButton: C().t("archbase:Clear"),
1709
- selectedLabel: C().t("archbase:Selected"),
1710
- doubleClickHint: C().t("archbase:Double click to select"),
1711
- noItemSelected: C().t("archbase:No item selected"),
1712
- itemsSelected: C().t("archbase:items selected"),
1713
- ...re
2184
+ const ve = {
2185
+ okButton: x().t("archbase:Ok"),
2186
+ cancelButton: x().t("archbase:Cancel"),
2187
+ clearButton: x().t("archbase:Clear"),
2188
+ selectedLabel: x().t("archbase:Selected"),
2189
+ doubleClickHint: x().t("archbase:Double click to select"),
2190
+ noItemSelected: x().t("archbase:No item selected"),
2191
+ itemsSelected: x().t("archbase:items selected"),
2192
+ ...O
1714
2193
  };
1715
- _e(() => {
1716
- if (m)
2194
+ et(() => {
2195
+ if (g)
1717
2196
  return;
1718
- const u = (k) => {
1719
- const Ne = ve.current;
1720
- if (Ne.length === 0)
2197
+ const p = (K) => {
2198
+ const Je = Te.current;
2199
+ if (Je.length === 0)
1721
2200
  return;
1722
- const Nt = k?.currentPage ?? 0, yt = k?.pageSize ?? R;
1723
- J.open({
1724
- records: Ne,
1725
- grandTotalRecords: Ne.length,
1726
- currentPage: Nt,
1727
- totalPages: Math.ceil(Ne.length / yt),
1728
- pageSize: yt
2201
+ const Lt = K?.currentPage ?? 0, Dt = K?.pageSize ?? D;
2202
+ q.open({
2203
+ records: Je,
2204
+ grandTotalRecords: Je.length,
2205
+ currentPage: Lt,
2206
+ totalPages: Math.ceil(Je.length / Dt),
2207
+ pageSize: Dt
1729
2208
  });
1730
2209
  };
1731
- return J.emitter.on("refreshData", u), () => {
1732
- J.emitter.off("refreshData", u);
2210
+ return q.emitter.on("refreshData", p), () => {
2211
+ q.emitter.off("refreshData", p);
1733
2212
  };
1734
- }, [m, J, R]);
1735
- const we = Q(
1736
- async (u) => {
1737
- if (!(m || !g)) {
1738
- Ve(!0);
2213
+ }, [g, q, D]);
2214
+ const ke = ie(
2215
+ async (p) => {
2216
+ if (!(g || !R)) {
2217
+ Ie(!0);
1739
2218
  try {
1740
- const k = await g(u, d);
1741
- ve.current = k, J.open({
1742
- records: k,
1743
- grandTotalRecords: k.length,
2219
+ const K = await R(p, m);
2220
+ Te.current = K, q.open({
2221
+ records: K,
2222
+ grandTotalRecords: K.length,
1744
2223
  currentPage: 0,
1745
- totalPages: Math.ceil(k.length / R),
1746
- pageSize: R
2224
+ totalPages: Math.ceil(K.length / D),
2225
+ pageSize: D
1747
2226
  });
1748
- } catch (k) {
1749
- Se(!0), q(pe(k)), $?.(k);
2227
+ } catch (K) {
2228
+ De(!0), S(fe(K)), z?.(K);
1750
2229
  } finally {
1751
- Ve(!1);
2230
+ Ie(!1);
1752
2231
  }
1753
2232
  }
1754
2233
  },
1755
- [m, g, d, R, J, $]
1756
- ), Ie = Q(
1757
- (u) => {
1758
- const k = u?.quickFilterValues?.[0] || "";
1759
- g && !m && we(k);
2234
+ [g, R, m, D, q, z]
2235
+ ), Ve = ie(
2236
+ (p) => {
2237
+ const K = p?.quickFilterValues?.[0] || "";
2238
+ R && !g && ke(K);
1760
2239
  },
1761
- [g, m, we]
2240
+ [R, g, ke]
1762
2241
  );
1763
- _e(() => {
1764
- l && (o?.length ? ae(o) : ae([]), we());
1765
- }, [l]), _e(() => {
1766
- o && ae(o);
1767
- }, [o]);
1768
- const Ue = Q(
1769
- (u) => {
1770
- h === "single" ? ae(u.slice(0, 1)) : A && u.length > A ? ae(u.slice(0, A)) : ae(u);
2242
+ et(() => {
2243
+ o && (l?.length ? ce(l) : ce([]), ke());
2244
+ }, [o]), et(() => {
2245
+ l && ce(l);
2246
+ }, [l]);
2247
+ const Ue = ie(
2248
+ (p) => {
2249
+ a === "single" ? ce(p.slice(0, 1)) : y && p.length > y ? ce(p.slice(0, y)) : ce(p);
1771
2250
  },
1772
- [h, A]
1773
- ), lt = Q(
1774
- (u) => {
1775
- if (h === "single" && a) {
1776
- const k = J.getCurrentRecord();
1777
- k && (v?.(k), i());
2251
+ [a, y]
2252
+ ), qe = ie(
2253
+ (p) => {
2254
+ if (a === "single" && s) {
2255
+ const K = q.getCurrentRecord();
2256
+ K && (C?.(K), i());
1778
2257
  }
1779
2258
  },
1780
- [h, a, J, v, i]
1781
- ), at = Q(() => {
1782
- ae([]);
1783
- }, []), je = Q(async () => {
1784
- S && !await S(z) || (h === "single" ? z.length > 0 && v?.(z[0]) : G?.(z), w?.(z), i());
1785
- }, [z, h, v, G, S, w, i]), De = Q(() => {
2259
+ [a, s, q, C, i]
2260
+ ), b = ie(() => {
2261
+ ce([]);
2262
+ }, []), Ee = ie(async () => {
2263
+ L && !await L(A) || (a === "single" ? A.length > 0 && C?.(A[0]) : P?.(A), I?.(A), i());
2264
+ }, [A, a, C, P, L, I, i]), je = ie(() => {
1786
2265
  i();
1787
- }, [i]), He = () => {
1788
- Ct.showWarning(C().t("archbase:Click on Ok or Cancel to close"));
1789
- }, st = () => {
1790
- Z?.(), Se(!1), q("");
2266
+ }, [i]), Qe = () => {
2267
+ Rt.showWarning(x().t("archbase:Click on Ok or Cancel to close"));
2268
+ }, ht = () => {
2269
+ ne?.(), De(!1), S("");
1791
2270
  };
1792
- It(
2271
+ zt(
1793
2272
  n,
1794
2273
  () => ({
1795
- getSelectedItems: () => z,
1796
- getSelectedItem: () => z[0] || null,
1797
- clearSelection: () => ae([]),
1798
- selectItems: (u) => Ue(u),
1799
- selectItem: (u) => ae([u]),
1800
- deselectItem: (u) => {
1801
- ae((k) => k.filter((Ne) => Ne[c] !== u[c]));
2274
+ getSelectedItems: () => A,
2275
+ getSelectedItem: () => A[0] || null,
2276
+ clearSelection: () => ce([]),
2277
+ selectItems: (p) => Ue(p),
2278
+ selectItem: (p) => ce([p]),
2279
+ deselectItem: (p) => {
2280
+ ce((K) => K.filter((Je) => Je[u] !== p[u]));
1802
2281
  },
1803
- refreshData: () => we(),
1804
- getDataSource: () => J,
2282
+ refreshData: () => ke(),
2283
+ getDataSource: () => q,
1805
2284
  confirmSelection: async () => {
1806
- await je();
2285
+ await Ee();
1807
2286
  },
1808
- cancelSelection: De
2287
+ cancelSelection: je
1809
2288
  }),
1810
- [z, Ue, c, we, J, je, De]
2289
+ [A, Ue, u, ke, q, Ee, je]
1811
2290
  );
1812
- const ct = Q(
1813
- (u) => {
1814
- const k = u[c];
1815
- return k !== void 0 ? k : "";
2291
+ const ut = ie(
2292
+ (p) => {
2293
+ const K = p[u];
2294
+ return K !== void 0 ? K : "";
1816
2295
  },
1817
- [c]
1818
- ), dt = V || $e, ut = ne || Le, ht = Y || ze, F = /* @__PURE__ */ x(se, { gap: "sm", children: [
1819
- p,
1820
- /* @__PURE__ */ e(Te, { fw: 600, children: f })
1821
- ] }), me = () => {
1822
- if (!B)
2296
+ [u]
2297
+ ), ft = E || Fe, mt = se || re, gt = te || Ne, T = /* @__PURE__ */ c(oe, { gap: "sm", children: [
2298
+ h,
2299
+ /* @__PURE__ */ e(ye, { fw: 600, children: f })
2300
+ ] }), Se = () => {
2301
+ if (!M)
1823
2302
  return null;
1824
- if (h === "single" && z.length > 0 && L)
1825
- return L(z[0]);
1826
- if (h === "multiple" && z.length > 0 && y)
1827
- return y(z);
1828
- if (h === "single" && z.length > 0) {
1829
- const u = z[0];
1830
- return /* @__PURE__ */ e(Oe, { withBorder: !0, p: "sm", radius: "md", bg: ye, children: /* @__PURE__ */ x(se, { justify: "space-between", children: [
1831
- /* @__PURE__ */ x(se, { gap: "xs", children: [
1832
- /* @__PURE__ */ e(qe, { size: 16, color: "green" }),
1833
- /* @__PURE__ */ x(Te, { size: "sm", fw: 500, children: [
1834
- de.selectedLabel,
2303
+ if (a === "single" && A.length > 0 && V)
2304
+ return V(A[0]);
2305
+ if (a === "multiple" && A.length > 0 && F)
2306
+ return F(A);
2307
+ if (a === "single" && A.length > 0) {
2308
+ const p = A[0];
2309
+ return /* @__PURE__ */ e(Le, { withBorder: !0, p: "sm", radius: "md", bg: xe, children: /* @__PURE__ */ c(oe, { justify: "space-between", children: [
2310
+ /* @__PURE__ */ c(oe, { gap: "xs", children: [
2311
+ /* @__PURE__ */ e(Ye, { size: 16, color: "green" }),
2312
+ /* @__PURE__ */ c(ye, { size: "sm", fw: 500, children: [
2313
+ ve.selectedLabel,
1835
2314
  ":"
1836
2315
  ] }),
1837
- /* @__PURE__ */ e(Te, { size: "sm", fw: 600, children: String(u[b]) }),
1838
- I && /* @__PURE__ */ e(Te, { size: "sm", c: H ? "gray.4" : "dimmed", children: String(u[I] || "") })
2316
+ /* @__PURE__ */ e(ye, { size: "sm", fw: 600, children: String(p[v]) }),
2317
+ N && /* @__PURE__ */ e(ye, { size: "sm", c: B ? "gray.4" : "dimmed", children: String(p[N] || "") })
1839
2318
  ] }),
1840
- /* @__PURE__ */ e(Te, { size: "xs", c: H ? "gray.4" : "dimmed", children: de.doubleClickHint })
2319
+ /* @__PURE__ */ e(ye, { size: "xs", c: B ? "gray.4" : "dimmed", children: ve.doubleClickHint })
1841
2320
  ] }) });
1842
2321
  }
1843
- return h === "multiple" && z.length > 0 ? /* @__PURE__ */ e(Oe, { withBorder: !0, p: "sm", radius: "md", bg: ye, children: /* @__PURE__ */ x(se, { justify: "space-between", children: [
1844
- /* @__PURE__ */ x(se, { gap: "xs", children: [
1845
- /* @__PURE__ */ e(qe, { size: 16, color: "green" }),
1846
- /* @__PURE__ */ x(Te, { size: "sm", fw: 500, children: [
1847
- z.length,
2322
+ return a === "multiple" && A.length > 0 ? /* @__PURE__ */ e(Le, { withBorder: !0, p: "sm", radius: "md", bg: xe, children: /* @__PURE__ */ c(oe, { justify: "space-between", children: [
2323
+ /* @__PURE__ */ c(oe, { gap: "xs", children: [
2324
+ /* @__PURE__ */ e(Ye, { size: 16, color: "green" }),
2325
+ /* @__PURE__ */ c(ye, { size: "sm", fw: 500, children: [
2326
+ A.length,
1848
2327
  " ",
1849
- de.itemsSelected
2328
+ ve.itemsSelected
1850
2329
  ] })
1851
2330
  ] }),
1852
- X && /* @__PURE__ */ e(
2331
+ ee && /* @__PURE__ */ e(
1853
2332
  We,
1854
2333
  {
1855
2334
  size: "xs",
1856
2335
  variant: "subtle",
1857
2336
  color: "red",
1858
- leftSection: /* @__PURE__ */ e(et, { size: 14 }),
1859
- onClick: at,
1860
- children: de.clearButton
2337
+ leftSection: /* @__PURE__ */ e(tt, { size: 14 }),
2338
+ onClick: b,
2339
+ children: ve.clearButton
1861
2340
  }
1862
2341
  )
1863
2342
  ] }) }) : null;
1864
2343
  };
1865
2344
  return /* @__PURE__ */ e(
1866
- Ee,
2345
+ Ge,
1867
2346
  {
1868
- resourceName: j,
1869
- resourceDescription: le,
1870
- requiredPermissions: he,
1871
- fallbackComponent: s,
1872
- onSecurityReady: N?.onSecurityReady,
1873
- onAccessDenied: N?.onAccessDenied,
2347
+ resourceName: ue,
2348
+ resourceDescription: Ce,
2349
+ requiredPermissions: le,
2350
+ fallbackComponent: d,
2351
+ onSecurityReady: k?.onSecurityReady,
2352
+ onAccessDenied: k?.onAccessDenied,
1874
2353
  children: /* @__PURE__ */ e(
1875
- ft,
2354
+ Ct,
1876
2355
  {
1877
- title: F,
1878
- opened: l,
1879
- onClose: He,
1880
- size: D,
2356
+ title: T,
2357
+ opened: o,
2358
+ onClose: Qe,
2359
+ size: X,
1881
2360
  centered: !0,
1882
2361
  closeOnEscape: !1,
1883
2362
  closeOnClickOutside: !1,
1884
2363
  withCloseButton: !1,
1885
2364
  overlayProps: {
1886
- color: fe === "dark" ? xe.colors.dark[7] : xe.colors.gray[6],
2365
+ color: de === "dark" ? we.colors.dark[7] : we.colors.gray[6],
1887
2366
  opacity: 0.25
1888
2367
  },
1889
- children: /* @__PURE__ */ x(rt, { height: oe, children: [
1890
- ht && /* @__PURE__ */ e(xt, { size: "100px", children: /* @__PURE__ */ e(
1891
- Qe,
2368
+ children: /* @__PURE__ */ c(ct, { height: Z, children: [
2369
+ gt && /* @__PURE__ */ e(Et, { size: "100px", children: /* @__PURE__ */ e(
2370
+ Ke,
1892
2371
  {
1893
- autoClose: U,
2372
+ autoClose: H,
1894
2373
  withCloseButton: !0,
1895
2374
  withBorder: !0,
1896
- icon: /* @__PURE__ */ e(Ke, { size: "1.4rem" }),
1897
- title: C().t("archbase:WARNING"),
2375
+ icon: /* @__PURE__ */ e(Oe, { size: "1.4rem" }),
2376
+ title: x().t("archbase:WARNING"),
1898
2377
  titleColor: "rgb(250, 82, 82)",
1899
- variant: ie ?? W.variant,
1900
- onClose: st,
1901
- children: /* @__PURE__ */ e("span", { children: ut })
2378
+ variant: _ ?? $.variant,
2379
+ onClose: ht,
2380
+ children: /* @__PURE__ */ e("span", { children: mt })
1902
2381
  }
1903
2382
  ) }),
1904
- /* @__PURE__ */ e(it, { children: /* @__PURE__ */ x(kt, { gap: "md", h: "100%", children: [
1905
- _ && /* @__PURE__ */ e(se, { justify: "flex-end", children: _ }),
2383
+ /* @__PURE__ */ e(st, { children: /* @__PURE__ */ c(yt, { gap: "md", h: "100%", children: [
2384
+ Y && /* @__PURE__ */ e(oe, { justify: "flex-end", children: Y }),
1906
2385
  /* @__PURE__ */ e(
1907
- Tt,
2386
+ Gt,
1908
2387
  {
1909
- dataSource: J,
1910
- height: te,
1911
- rowHeight: K,
2388
+ dataSource: q,
2389
+ height: ae,
2390
+ rowHeight: W,
1912
2391
  withBorder: !0,
1913
2392
  striped: !0,
1914
2393
  highlightOnHover: !0,
1915
- isLoading: dt,
1916
- enableRowSelection: h === "multiple",
2394
+ isLoading: ft,
2395
+ enableRowSelection: a === "multiple",
1917
2396
  enableRowNumbers: !0,
1918
2397
  enableColumnFilterModes: !0,
1919
2398
  enableTopToolbar: !0,
1920
2399
  enableGlobalFilter: !0,
1921
- getRowId: ct,
1922
- onCellDoubleClick: lt,
1923
- onSelectedRowsChanged: h === "multiple" ? Ue : void 0,
1924
- onFilterModelChange: Ie,
2400
+ getRowId: ut,
2401
+ onCellDoubleClick: qe,
2402
+ onSelectedRowsChanged: a === "multiple" ? Ue : void 0,
2403
+ onFilterModelChange: Ve,
1925
2404
  children: r
1926
2405
  }
1927
2406
  ),
1928
- me()
2407
+ Se()
1929
2408
  ] }) }),
1930
- /* @__PURE__ */ e(ot, { size: "50px", children: /* @__PURE__ */ x(ge, { justify: "space-between", align: "center", children: [
1931
- /* @__PURE__ */ e(se, {}),
1932
- /* @__PURE__ */ x(se, { gap: "md", children: [
2409
+ /* @__PURE__ */ e(dt, { size: "50px", children: /* @__PURE__ */ c(pe, { justify: "space-between", align: "center", children: [
2410
+ /* @__PURE__ */ e(oe, {}),
2411
+ /* @__PURE__ */ c(oe, { gap: "md", children: [
1933
2412
  /* @__PURE__ */ e(
1934
- ee,
2413
+ J,
1935
2414
  {
1936
2415
  actionName: "confirm",
1937
2416
  actionDescription: "Confirmar seleção",
1938
- leftSection: /* @__PURE__ */ e(qe, {}),
1939
- onClick: je,
1940
- disabled: z.length === 0,
1941
- variant: ie ?? W.variant,
2417
+ leftSection: /* @__PURE__ */ e(Ye, {}),
2418
+ onClick: Ee,
2419
+ disabled: A.length === 0,
2420
+ variant: _ ?? $.variant,
1942
2421
  color: "green",
1943
- children: de.okButton
2422
+ children: ve.okButton
1944
2423
  }
1945
2424
  ),
1946
2425
  /* @__PURE__ */ e(
1947
- ee,
2426
+ J,
1948
2427
  {
1949
2428
  actionName: "cancel",
1950
2429
  actionDescription: "Cancelar seleção",
1951
- leftSection: /* @__PURE__ */ e(Pe, {}),
1952
- onClick: De,
1953
- variant: ie ?? W.variant,
2430
+ leftSection: /* @__PURE__ */ e(Be, {}),
2431
+ onClick: je,
2432
+ variant: _ ?? $.variant,
1954
2433
  color: "red",
1955
- children: de.cancelButton
2434
+ children: ve.cancelButton
1956
2435
  }
1957
2436
  )
1958
2437
  ] })
@@ -1963,47 +2442,50 @@ function cn(t, n) {
1963
2442
  }
1964
2443
  );
1965
2444
  }
1966
- const Nn = St(cn), wt = qt(void 0);
1967
- function Pn({ children: t }) {
1968
- const [n, l] = O({}), f = Q((b, h) => {
1969
- l((v) => ({ ...v, [b]: h }));
1970
- }, []), r = Q((b) => {
1971
- l((h) => {
1972
- const v = { ...h };
1973
- return delete v[b], v;
2445
+ const Mn = Vt(mn), It = Kt(void 0);
2446
+ function Un({ children: t }) {
2447
+ const [n, o] = Q({}), f = ie((v, a) => {
2448
+ o((C) => ({ ...C, [v]: a }));
2449
+ }, []), r = ie((v) => {
2450
+ o((a) => {
2451
+ const C = { ...a };
2452
+ return delete C[v], C;
1974
2453
  });
1975
- }, []), i = Q(() => {
1976
- l({});
1977
- }, []), c = Q((b) => n[b], [n]);
1978
- return /* @__PURE__ */ e(wt.Provider, { value: { errors: n, setError: f, clearError: r, clearAll: i, getError: c }, children: t });
2454
+ }, []), i = ie(() => {
2455
+ o({});
2456
+ }, []), u = ie((v) => n[v], [n]);
2457
+ return /* @__PURE__ */ e(It.Provider, { value: { errors: n, setError: f, clearError: r, clearAll: i, getError: u }, children: t });
1979
2458
  }
1980
- function kn() {
1981
- return Dt(wt);
2459
+ function Hn() {
2460
+ return Pt(It);
1982
2461
  }
1983
- function Gn() {
1984
- const t = Dt(wt);
2462
+ function _n() {
2463
+ const t = Pt(It);
1985
2464
  if (!t)
1986
2465
  throw new Error("useRequiredValidationErrors must be used within ValidationErrorsProvider");
1987
2466
  return t;
1988
2467
  }
1989
2468
  export {
1990
- Rn as ArchbaseAdvancedSmartButton,
1991
- Ee as ArchbaseConditionalSecurityWrapper,
1992
- Sn as ArchbaseFormModalTemplate,
1993
- En as ArchbaseFormTemplate,
1994
- Dn as ArchbaseGridTemplate,
1995
- Nn as ArchbaseLookupDataTemplate,
1996
- Tn as ArchbaseMasonryTemplate,
1997
- In as ArchbaseModalTemplate,
1998
- Bn as ArchbasePanelTemplate,
1999
- Vn as ArchbaseSearchTemplate,
2000
- ee as ArchbaseSmartActionButton,
2001
- Vt as ArchbaseSpaceTemplate,
2002
- Pn as ValidationErrorsProvider,
2003
- Fn as useArchbaseLookup,
2004
- An as useConditionalSecurity,
2005
- Ae as useOptionalTemplateSecurity,
2006
- Gn as useRequiredValidationErrors,
2007
- yn as useTemplateSecurityAvailable,
2008
- kn as useValidationErrors
2469
+ Dn as ArchbaseAdvancedSmartButton,
2470
+ Ge as ArchbaseConditionalSecurityWrapper,
2471
+ Bn as ArchbaseFormModalTemplate,
2472
+ kn as ArchbaseFormTemplate,
2473
+ Vn as ArchbaseGridTemplate,
2474
+ Mn as ArchbaseLookupDataTemplate,
2475
+ zn as ArchbaseMasonryTemplate,
2476
+ Nn as ArchbaseModalTemplate,
2477
+ Pn as ArchbasePanelTemplate,
2478
+ Gn as ArchbaseSearchTemplate,
2479
+ J as ArchbaseSmartActionButton,
2480
+ jt as ArchbaseSpaceTemplate,
2481
+ $n as ArchbaseTwoColumnFormTemplate,
2482
+ Ln as FormImageGallery,
2483
+ jn as FormSectionCard,
2484
+ Un as ValidationErrorsProvider,
2485
+ In as useArchbaseLookup,
2486
+ Tn as useConditionalSecurity,
2487
+ Pe as useOptionalTemplateSecurity,
2488
+ _n as useRequiredValidationErrors,
2489
+ Sn as useTemplateSecurityAvailable,
2490
+ Hn as useValidationErrors
2009
2491
  };