@archbase/template 3.0.6 → 3.0.8

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