@archbase/template 3.0.6 → 3.0.7

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 He, Paper as _e, Box as Ke, ScrollArea as vt, LoadingOverlay as dt, Group as ce, useMantineColorScheme as Ye, Modal as ut, Flex as Ce, px as Tt, Text as ke, Grid as Se, Pagination as wt, Stack as Bt, Center as Vt, Loader as Pt } from "@mantine/core";
3
+ import { useForceUpdate as ht, useUncontrolled as Nt, useHotkeys as kt } from "@mantine/hooks";
4
+ import { IconBug as Je, IconDeviceFloppy as Gt, IconX as Ge, IconCheck as je, IconPlus as ft, IconEdit as mt, IconTrash as Ze, IconEye as pt } from "@tabler/icons-react";
5
+ import { useArchbaseAppContext as De, useValidationErrors as $t, ValidationErrorsProvider as At, getI18nextInstance as p, processErrorMessage as be, useArchbaseTheme as et, emit as Lt, useArchbaseTranslation as zt } from "@archbase/core";
6
+ import qe, { useMemo as Ie, useState as q, useCallback as K, forwardRef as yt, useRef as pe, useImperativeHandle as Ft, useEffect as Xe, Fragment as Ut, Profiler as Mt, createContext as jt, useContext as Rt } from "react";
7
+ import { useArchbaseV1V2Compatibility as Le, useArchbaseDataSourceListener as tt, DataSourceEventNames as Ae, ArchbaseDataSource as qt } from "@archbase/data";
8
+ import { ArchbaseAlert as We, ArchbaseDialog as gt, ArchbaseDataGrid as Et, GridToolBarActions as Ht, ArchbaseDebugInspector as _t, ArchbaseMasonryProvider as Jt, ArchbaseMasonryResponsive as Wt, ArchbaseMasonry as Ot, ArchbaseActionButtons as St } from "@archbase/components";
9
+ import { ArchbaseSpaceFixed as nt, ArchbaseSpaceTop as bt, ArchbaseSpaceFill as rt, ArchbaseForm as It, ArchbaseSpaceBottom as it } from "@archbase/layout";
10
+ import { ArchbaseQueryBuilder as Ct, buildFrom as Kt, ArchbaseGlobalFilter as Qt } from "@archbase/advanced";
11
+ import Qe from "@rehooks/component-size";
12
+ import { uniqueId as Xt } from "lodash";
13
+ const Yt = {
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
+ }, Re = (t) => Ie(() => Yt, []), vn = () => !1;
25
+ function wn(t) {
26
+ const {
27
+ onSelect: n,
28
+ onSelectMultiple: a,
29
+ initialValue: f = null,
30
+ initialValues: r = [],
31
+ selectionMode: i = "single",
32
+ autoClose: u = !0,
33
+ onOpen: b,
34
+ onClose: h
35
+ } = t || {}, [x, N] = q(!1), [o, c] = q(f), [E, v] = q(r), F = K(() => {
36
+ N(!0), b?.();
37
+ }, [b]), m = K(() => {
38
+ N(!1), h?.();
39
+ }, [h]), k = K(() => {
40
+ c(null), v([]);
41
+ }, []), R = K(
42
+ (g) => {
43
+ c(g), v([g]), n?.(g), u && (N(!1), h?.());
44
+ },
45
+ [n, u, h]
46
+ ), S = K(
47
+ (g) => {
48
+ v(g), c(g.length > 0 ? g[0] : null), a?.(g), u && (N(!1), h?.());
49
+ },
50
+ [a, u, h]
51
+ ), z = K(() => {
52
+ N(!1), h?.();
53
+ }, [h]), A = Ie(
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: k,
73
+ setSelectedItem: c,
74
+ setSelectedItems: v,
75
+ // Handlers
76
+ handleSelect: R,
77
+ handleSelectMultiple: S,
78
+ handleClose: z,
79
+ // Props para template
80
+ lookupProps: A
81
+ };
82
+ }
83
+ const he = ({
25
84
  actionName: t,
26
- actionDescription: r,
85
+ actionDescription: n,
27
86
  children: a,
28
- fallback: d = null,
29
- autoRegister: n = !0,
30
- onClick: o,
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 = Re();
93
+ return qe.useEffect(() => {
94
+ r && t && n && b.isAvailable && b.registerAction();
95
+ }, [t, n, r, b.isAvailable, b.registerAction]), !t || !b.isAvailable ? /* @__PURE__ */ e(He, { onClick: i, ...u, children: a }) : b.hasPermission() ? /* @__PURE__ */ e(He, { onClick: i, ...u, children: a }) : /* @__PURE__ */ e($e, { children: f });
96
+ }, An = ({
38
97
  actionName: t,
39
- actionDescription: r,
98
+ actionDescription: n,
40
99
  children: a,
41
- fallback: d = null,
42
- onClick: n,
43
- ...o
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] = qe.useState(null), [h, x] = qe.useState(!1);
105
+ return qe.useEffect(() => {
47
106
  if (!t) {
48
- f(/* @__PURE__ */ e($e, { onClick: n, ...o, children: a }));
107
+ b(/* @__PURE__ */ e(He, { onClick: r, ...i, children: a }));
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(He, { onClick: r, ...i, children: a }));
111
+ }, [t, n, a, f, i]), /* @__PURE__ */ e($e, { children: u });
112
+ }, Te = ({
54
113
  children: t
55
- }) => /* @__PURE__ */ e(Ie, { children: t }), gr = (t) => we(() => ({
114
+ }) => /* @__PURE__ */ e($e, { children: t }), yn = (t) => Ie(() => ({
56
115
  shouldWrap: !1,
57
116
  isSecurityAvailable: !1,
58
117
  hasResourceName: !!t
59
118
  }), [t]);
60
- function xr({
119
+ function Fn({
61
120
  innerRef: t,
62
- title: r,
121
+ title: n,
63
122
  isError: a = !1,
64
- isCanceling: d = !1,
65
- isSaving: n = !1,
66
- error: o = "",
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,
128
+ autoCloseAlertError: b = 15e3,
129
+ width: h = "100%",
130
+ height: x = "100%",
131
+ withBorder: N = !0,
132
+ children: o,
74
133
  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,
134
+ variant: E,
135
+ footerAlign: v = "left",
136
+ footerContent: F,
137
+ dataSource: m,
138
+ onSave: k,
139
+ onCancel: R,
140
+ onBeforeSave: S,
141
+ onAfterSave: z,
142
+ onBeforeCancel: A,
143
+ onAfterCancel: g,
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: ie,
147
+ resourceDescription: Q,
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 = De(), [_, T] = q(a), [de, ee] = q(i), X = ht();
154
+ Re({
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
+ tt({
164
+ dataSource: m,
165
+ listener: (L) => {
166
+ L.type === Ae.onError && (T(!0), ee(L.error)), (L.type === Ae.afterEdit || L.type === Ae.afterInsert) && (U.isDataSourceV2 || X());
108
167
  }
109
168
  });
110
- const $ = Bt(), J = async (E) => {
169
+ const M = $t(), Y = 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
+ k ? k(L) : (S && await S(L), m.isBrowsing() || m.save().then(() => {
172
+ M?.clearAll(), z && z(L);
173
+ }).catch((oe) => {
174
+ I && I(be(oe)), T(!0), ee(be(oe));
116
175
  }));
117
- } catch (Z) {
118
- y && y(de(Z)), R(!0), H(de(Z));
176
+ } catch (oe) {
177
+ I && I(be(oe)), T(!0), ee(be(oe));
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() : (A && A(), m.isBrowsing() || m.cancel(), M?.clearAll(), g && g());
182
+ } catch (L) {
183
+ I && I(be(L)), T(!0), ee(be(L));
125
184
  }
126
185
  }, W = () => {
127
- u && u(), R(!1), H("");
186
+ u && u(), T(!1), ee("");
128
187
  };
129
188
  return /* @__PURE__ */ e(
130
- ye,
189
+ Te,
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(
139
- We,
191
+ resourceName: ie,
192
+ resourceDescription: Q,
193
+ requiredPermissions: H,
194
+ fallbackComponent: G,
195
+ onSecurityReady: P?.onSecurityReady,
196
+ onAccessDenied: P?.onAccessDenied,
197
+ children: /* @__PURE__ */ e(At, { children: /* @__PURE__ */ C(
198
+ _e,
140
199
  {
141
200
  ref: t,
142
- withBorder: ee,
201
+ withBorder: N,
143
202
  radius: c,
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(Ke, { style: { flexShrink: 0 }, children: /* @__PURE__ */ e(
212
+ We,
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(Je, { size: "1.4rem" }),
218
+ title: p().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(dt, { visible: f || r, opacity: 0.3 }),
236
+ o
178
237
  ]
179
238
  }
180
239
  ),
181
240
  /* @__PURE__ */ C(
182
- Se,
241
+ Ke,
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(Ke, { 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 ${Q || "registro"}`,
259
+ leftSection: /* @__PURE__ */ e(Gt, {}),
260
+ onClick: () => Y(m.getCurrentRecord()),
261
+ disabled: m && m.isBrowsing(),
262
+ variant: E ?? D.variant,
204
263
  color: "green",
205
- children: `${m().t("Ok")}`
264
+ children: `${p().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: `${p().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: `${p().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(Ke, { 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 Rn({
243
302
  title: t,
244
- withOverlay: r = !0,
303
+ withOverlay: n = !0,
245
304
  overlayProps: a,
246
- children: d,
247
- withCloseButton: n = !0,
248
- closeButtonProps: o,
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,
309
+ fullScreen: b,
310
+ centered: h,
311
+ variant: x,
312
+ closeOnEscape: N = !0,
313
+ size: o,
255
314
  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 = () => {
315
+ height: E,
316
+ userActions: v,
317
+ onAfterSave: F,
318
+ onClickOk: m,
319
+ onClickCancel: k,
320
+ onBeforeOk: R,
321
+ onCustomSave: S,
322
+ isError: z,
323
+ error: A = "",
324
+ clearError: g = () => {
266
325
  },
267
- onError: y,
268
- autoCloseAlertError: Y = 15e3,
269
- loadingOverlayStyles: _,
326
+ onError: I,
327
+ autoCloseAlertError: ie = 15e3,
328
+ loadingOverlayStyles: Q,
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 T = De(), de = et(), { colorScheme: ee } = Ye(), [X, U] = q(z), [M, Y] = q(A), [J, W] = q(!1), L = ht();
338
+ Re({
339
+ resourceDescription: G || t?.toString(),
340
+ autoRegisterActions: D?.autoRegisterActions ?? !0
282
341
  });
283
- const Z = Pe(
342
+ const oe = Le(
284
343
  "ArchbaseFormModalTemplate",
285
344
  c,
286
345
  void 0,
287
346
  void 0
288
347
  );
289
- et({
348
+ tt({
290
349
  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());
350
+ listener: (te) => {
351
+ te.type === Ae.onError && (U(!0), Y(te.error)), (te.type === Ae.afterEdit || te.type === Ae.afterInsert) && (oe.isDataSourceV2 || L());
293
352
  }
294
353
  });
295
- const fe = async () => {
354
+ const xe = async () => {
296
355
  if (c && !c.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 c.save(), F && F(c.getCurrentRecord());
358
+ } catch (te) {
359
+ return I && I(be(te)), U(!0), Y(be(te)), W(!1), !1;
301
360
  }
302
361
  return W(!1), !0;
303
- }, s = () => {
362
+ }, d = () => {
304
363
  if (c && !c.isBrowsing())
305
364
  try {
306
365
  c.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
+ c && S(c.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(c.getCurrentRecord());
375
+ te instanceof Promise && te.then(async () => {
376
+ await xe() && m && m();
377
+ }).catch((Ee) => {
378
+ I && I(be(Ee)), U(!0), Y(be(Ee));
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 xe() && m && m();
382
+ }, Z = () => {
383
+ d(), k && k();
384
+ }, ue = () => {
385
+ gt.showWarning(p().t("archbase:Click on Ok or Cancel to close"));
386
+ }, fe = () => {
387
+ g && g(), U(!1), Y("");
329
388
  };
330
389
  return /* @__PURE__ */ e(
331
- ye,
390
+ Te,
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,
402
+ withOverlay: n,
344
403
  overlayProps: a || {
345
- color: H === "dark" ? re.colors.dark[7] : re.colors.gray[6],
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: N,
414
+ size: o,
415
+ ..._,
416
+ children: /* @__PURE__ */ C(At, { children: [
417
+ /* @__PURE__ */ e(dt, { styles: Q, visible: J, opacity: 0.8 }),
418
+ /* @__PURE__ */ C(nt, { height: E, children: [
419
+ X ? /* @__PURE__ */ e(bt, { size: "100px", children: /* @__PURE__ */ e(
420
+ We,
362
421
  {
363
- autoClose: Y,
422
+ autoClose: ie,
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(Je, { size: "1.4rem" }),
426
+ title: p().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 ?? T.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(rt, { children: /* @__PURE__ */ e(It, { children: f }) }),
434
+ /* @__PURE__ */ e(it, { size: "40px", children: /* @__PURE__ */ C(Ce, { justify: "space-between", align: "center", children: [
435
+ /* @__PURE__ */ e(ce, { children: v }),
436
+ c && !c.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,
441
+ actionDescription: `Salvar ${G || t || "registro"}`,
442
+ leftSection: /* @__PURE__ */ e(je, {}),
443
+ onClick: j,
385
444
  disabled: c && c.isBrowsing(),
386
- variant: v ?? R.variant,
445
+ variant: x ?? T.variant,
387
446
  color: "green",
388
- children: `${m().t("Ok")}`
447
+ children: `${p().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,
455
+ leftSection: /* @__PURE__ */ e(Ge, {}),
456
+ onClick: Z,
398
457
  disabled: c && c.isBrowsing(),
399
- variant: v ?? R.variant,
458
+ variant: x ?? T.variant,
400
459
  color: "red",
401
- children: `${m().t("Cancel")}`
460
+ children: `${p().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: Z,
470
+ variant: x ?? T.variant,
471
+ children: `${p().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 En({
424
483
  title: t,
425
- withOverlay: r = !0,
484
+ withOverlay: n = !0,
426
485
  overlayProps: a,
427
- children: d,
428
- withCloseButton: n = !0,
429
- closeButtonProps: o,
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,
490
+ fullScreen: b,
491
+ centered: h,
492
+ variant: x,
493
+ closeOnEscape: N = !0,
494
+ size: o,
436
495
  height: c,
437
- onlyOkButton: M = !1,
438
- onClose: A,
439
- onClickOk: T,
440
- onClickCancel: h,
441
- userActions: B,
496
+ onlyOkButton: E = !1,
497
+ onClose: v,
498
+ onClickOk: F,
499
+ onClickCancel: m,
500
+ userActions: k,
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: A,
506
+ securityOptions: g
448
507
  }) {
449
- const y = Ae(), Y = Oe(), { colorScheme: _ } = Ke();
450
- ge({
451
- autoRegisterActions: x?.autoRegisterActions ?? !0
508
+ const I = De(), ie = et(), { colorScheme: Q } = Ye();
509
+ Re({
510
+ autoRegisterActions: g?.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
+ gt.showWarning(p().t("Click on Ok or Cancel to close"));
459
518
  };
460
519
  return /* @__PURE__ */ e(
461
- ye,
520
+ Te,
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: A,
526
+ onSecurityReady: g?.onSecurityReady,
527
+ onAccessDenied: g?.onAccessDenied,
469
528
  children: /* @__PURE__ */ e(
470
- ct,
529
+ ut,
471
530
  {
472
531
  title: t,
473
- withOverlay: r,
532
+ withOverlay: n,
474
533
  overlayProps: a || {
475
- color: _ === "dark" ? Y.colors.dark[7] : Y.colors.gray[6],
534
+ color: Q === "dark" ? ie.colors.dark[7] : ie.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: N,
544
+ size: o,
545
+ children: /* @__PURE__ */ C(nt, { height: c, children: [
546
+ /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(It, { children: f }) }),
547
+ /* @__PURE__ */ e(it, { size: "40px", children: /* @__PURE__ */ C(Ce, { justify: "space-between", align: "center", children: [
548
+ /* @__PURE__ */ e(ce, { children: k }),
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(je, {}),
556
+ onClick: H,
557
+ variant: x ?? I.variant,
499
558
  color: "green",
500
- children: `${m().t("Ok")}`
559
+ children: `${p().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 ? `${p().t("Cancel")}` : `${p().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 Zt = (t, n, a) => {
583
+ if (!t || !n || !n.existsValue(`${t.viewName}_${t.componentName}`)) {
584
+ let f = -1, r;
585
+ return a && a.getFilters().length > 0 && (f = 0, r = JSON.parse(a.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 en(t, n) {
535
594
  const {
536
595
  title: a,
537
- printTitle: d,
538
- dataSource: n,
539
- filterOptions: o,
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,
600
+ pageIndex: b = 0,
601
+ columns: h,
602
+ filterFields: x,
603
+ logoPrint: N,
604
+ userActions: o,
546
605
  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 = () => {
606
+ customRenderRowActions: E,
607
+ innerRef: v,
608
+ isLoading: F = !1,
609
+ isLoadingFilter: m = !1,
610
+ isError: k = !1,
611
+ enableTopToolbar: R = !0,
612
+ enableTopToolbarActions: S = !0,
613
+ error: z = "",
614
+ clearError: A = () => {
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: g,
617
+ width: I = "100%",
618
+ height: ie = "100%",
619
+ onSearchByFilter: Q,
620
+ getRowId: H,
621
+ withBorder: G = !0,
622
+ filterPersistenceDelegator: P,
623
+ variant: $,
624
+ store: D,
625
+ cellPadding: _,
626
+ bottomToolbarMinHeight: T,
627
+ enableRowSelection: de = !0,
628
+ enableRowNumbers: ee = !0,
629
+ enableRowActions: X = !0,
630
+ positionActionsColumn: U = "first",
631
+ actionsColumnWidth: M,
632
+ tableHeadCellPadding: Y,
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: oe,
637
+ onSelectedRowsChanged: xe,
638
+ onCellDoubleClick: d,
639
+ onFilterModelChange: j,
640
+ paginationLabels: Z,
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: Ee,
646
+ securityOptions: ve,
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: B,
649
+ withPaginationBorder: le,
650
+ toolbarPadding: ze,
651
+ paginationPadding: Be,
652
+ rowHeight: Ue,
653
+ hideFooter: Ve = !0
654
+ } = t, Pe = pe(null), V = pe(null);
655
+ et();
656
+ const { colorScheme: ot } = Ye();
657
+ Re({
658
+ autoRegisterActions: ve?.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
+ Ft(n, () => ({
608
667
  refreshData: () => {
609
- j.current && j.current.refreshData();
668
+ V.current && V.current.refreshData();
610
669
  },
611
- getSelectedRows: () => j.current ? j.current.getSelectedRows() : [],
670
+ getSelectedRows: () => V.current ? V.current.getSelectedRows() : [],
612
671
  clearSelection: () => {
613
- j.current && j.current.clearSelection();
672
+ V.current && V.current.clearSelection();
614
673
  },
615
674
  exportData: () => {
616
- j.current && j.current.exportData();
675
+ V.current && V.current.exportData();
617
676
  },
618
677
  printData: () => {
619
- j.current && j.current.printData();
678
+ V.current && V.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: () => V,
681
+ getFilterModel: () => V.current ? V.current.getFilterModel() : { items: [], quickFilterValues: [] }
682
+ }), [V]);
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);
688
+ Xe(() => {
689
+ const s = Zt(i, D, P);
690
+ me(s);
691
+ }, [m]);
692
+ const ye = (s) => {
693
+ if (E)
694
+ return E(s);
636
695
  if (!c || !c.actions)
637
696
  return;
638
- const ce = c.actions;
697
+ const w = c.actions;
639
698
  return /* @__PURE__ */ e(
640
- ce,
699
+ w,
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: c.onEditRow ? (re) => c.onEditRow && c.onEditRow(re) : void 0,
702
+ onRemoveRow: c.onRemoveRow ? (re) => c.onRemoveRow && c.onRemoveRow(re) : void 0,
703
+ onViewRow: c.onViewRow ? (re) => c.onViewRow && c.onViewRow(re) : void 0,
704
+ row: s,
705
+ variant: $ ?? ge.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
+ }, ge = De(), we = pe(null), l = Ie(() => oe, [oe]);
709
+ qe.useEffect(() => {
710
+ v && v.current !== we.current && v.current && we.current && (v.current = we.current);
711
+ }, [v]);
712
+ const y = (s, w) => {
713
+ const re = { ...O, currentFilter: s, activeFilterIndex: w };
714
+ me(re), D && i && D?.setValue(`${i.viewName}_${i.componentName}`, re);
715
+ }, se = (s) => {
716
+ const w = { ...O, expandedFilter: s };
717
+ me(w), D && i && D?.setValue(`${i.viewName}_${i.componentName}`, w);
718
+ }, ae = (s, w) => {
719
+ const re = { ...O, currentFilter: s, activeFilterIndex: w };
720
+ me(re), D && i && D?.setValue(`${i.viewName}_${i.componentName}`, re);
721
+ }, Me = () => {
722
+ if (O.currentFilter)
723
+ if (Q)
724
+ Q();
725
+ else if (O.currentFilter.filter.filterType === "quick") {
726
+ const s = r.getOptions();
727
+ O.currentFilter.filter.quickFilterText && O.currentFilter.filter.quickFilterText !== "" ? (s.filter = JSON.stringify({
728
+ search: O.currentFilter.filter.quickFilterText,
729
+ fields: O.currentFilter.filter.quickFilterFieldsText
730
+ }), s.sort = O.currentFilter.sort.quickFilterSort ? O.currentFilter.sort.quickFilterSort.split(",") : []) : (s.filter = void 0, s.sort = void 0), r.refreshData(s), 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 s = Kt(O.currentFilter);
733
+ if (s && s.expressionNode) {
734
+ const w = Lt(s.expressionNode), re = r.getOptions();
735
+ re.filter = w, re.sort = s?.sortStrings, r.refreshData(re), 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 Ne, Fe;
740
+ const Oe = (s) => {
741
+ Ne = s;
742
+ }, lt = (s) => {
743
+ Fe = s;
744
+ }, st = () => {
745
+ Fe && Fe();
746
+ }, at = () => {
747
+ Ne && Ne();
748
+ }, ct = () => g === "none" ? /* @__PURE__ */ e("div", {}) : g === "advanced" ? /* @__PURE__ */ e(
749
+ Ct,
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: Pe,
755
+ variant: $ ?? ge.variant,
756
+ expandedFilter: O.expandedFilter,
757
+ persistenceDelegator: P,
758
+ currentFilter: O.currentFilter,
759
+ activeFilterIndex: O.activeFilterIndex,
760
+ onSelectedFilter: ae,
761
+ onFilterChanged: y,
762
+ onSearchByFilter: Me,
763
+ onToggleExpandedFilter: se,
764
+ onExport: st,
765
+ onPrint: at,
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
+ ) : g === "normal" ? /* @__PURE__ */ e("div", {}) : /* @__PURE__ */ e("div", {});
714
773
  return /* @__PURE__ */ e(
715
- ye,
774
+ Te,
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: Ee,
780
+ onSecurityReady: ve?.onSecurityReady,
781
+ onAccessDenied: ve?.onAccessDenied,
782
+ children: /* @__PURE__ */ C(_e, { withBorder: G, ref: we, style: { height: "100%" }, children: [
783
+ k ? /* @__PURE__ */ e(
784
+ We,
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(Je, { size: "1.4rem" }),
790
+ title: p().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: $ ?? ge.variant,
793
+ onClose: () => A && A(),
794
+ children: /* @__PURE__ */ e("span", { children: z })
736
795
  }
737
796
  ) : null,
738
797
  /* @__PURE__ */ C(
739
- Lt,
798
+ Et,
740
799
  {
741
- gridRef: j,
742
- printTitle: d || a,
743
- logoPrint: ee,
744
- width: y,
745
- height: Y,
800
+ gridRef: V,
801
+ printTitle: f || a,
802
+ logoPrint: N,
803
+ width: I,
804
+ height: ie,
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: X,
811
+ enableTopToolbar: R,
812
+ enableTopToolbarActions: S,
754
813
  manualPagination: !0,
755
814
  manualSorting: !0,
756
- isLoading: T,
815
+ isLoading: F,
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: g !== "none",
819
+ enableGlobalFilter: g !== "none",
820
+ renderToolbarInternalActions: g == "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: xe,
824
+ onCellDoubleClick: d,
825
+ onFilterModelChange: j,
826
+ renderRowActions: X ? ye : void 0,
827
+ positionActionsColumn: U,
828
+ actionsColumnWidth: M,
829
+ toolbarAlignment: L,
830
+ toolbarLeftContent: l,
831
+ renderToolbarActions: g === "advanced" || g === "none" ? ct : void 0,
832
+ paginationLabels: Z,
833
+ cellPadding: _,
834
+ bottomToolbarMinHeight: T,
835
+ tableHeadCellPadding: Y,
836
+ getRowId: H,
837
+ renderDetailPanel: J ? ({ row: s }) => J({ row: s }) : 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: lt,
840
+ onPrint: Oe,
841
+ variant: $,
842
+ withToolbarBorder: B,
843
+ withPaginationBorder: le,
844
+ toolbarPadding: ze,
845
+ paginationPadding: Be,
846
+ rowHeight: Ue,
847
+ hideFooter: Ve,
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(Ht, { children: /* @__PURE__ */ C($e, { children: [
851
+ /* @__PURE__ */ e("h3", { className: "only-print", children: f || a }),
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: $ ?? ge.variant,
861
+ leftSection: /* @__PURE__ */ e(ft, {}),
862
+ onClick: () => o && o.onAddExecute && o.onAddExecute(),
863
+ children: o.labelAdd || p().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: $ ?? ge.variant,
875
+ onClick: () => o && o.onEditExecute && o.onEditExecute(),
876
+ children: o.labelEdit || p().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(Ze, {}),
886
+ disabled: !o?.allowRemove || !r.isBrowsing() || r.isEmpty(),
887
+ variant: $ ?? ge.variant,
888
+ onClick: () => o && o.onRemoveExecute && o.onRemoveExecute(),
889
+ children: o.labelRemove || p().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(pt, {}),
899
+ disabled: !r.isBrowsing() || r.isEmpty(),
900
+ variant: $ ?? ge.variant,
901
+ onClick: () => o && o.onViewExecute && o.onViewExecute(),
902
+ children: o.labelView || p().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 Sn = yt(en);
916
+ function tn(t, n, a, 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(Se, { m: 0, gutter: "xs", justify: "center", align: "center", grow: !0, children: [
861
920
  /* @__PURE__ */ e(
862
- me.Col,
921
+ Se.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
+ Se.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
+ Se.Col,
898
957
  {
899
958
  span: {
900
959
  xs: u.xs,
@@ -903,7 +962,7 @@ 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"
@@ -913,30 +972,30 @@ function Yt(t, r, a, d) {
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
1000
  children: a
942
1001
  }
@@ -944,39 +1003,39 @@ function Yt(t, r, a, d) {
944
1003
  ] });
945
1004
  }
946
1005
  }
947
- function Zt(t, r, a, d) {
1006
+ function nn(t, n, a, 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(Se, { m: 0, gutter: "xs", justify: "center", align: "center", grow: !0, children: [
951
1010
  /* @__PURE__ */ e(
952
- me.Col,
1011
+ Se.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
+ Se.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
+ Se.Col,
988
1047
  {
989
1048
  span: {
990
1049
  xs: u.xs,
@@ -993,7 +1052,7 @@ 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"
@@ -1003,32 +1062,32 @@ function Zt(t, r, a, d) {
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
1092
  padding: a && "calc(0.625rem / 2)"
1034
1093
  },
@@ -1038,120 +1097,120 @@ function Zt(t, r, a, d) {
1038
1097
  ] });
1039
1098
  }
1040
1099
  }
1041
- function wt({
1100
+ function Dt({
1042
1101
  title: t,
1043
- innerRef: r,
1102
+ innerRef: n,
1044
1103
  isError: a = !1,
1045
- error: d = "",
1046
- clearError: n,
1047
- width: o = "100%",
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,
1108
+ withBorder: b = !0,
1109
+ children: h,
1110
+ radius: x,
1111
+ debug: N,
1112
+ defaultDebug: o,
1054
1113
  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 = {
1114
+ headerMiddle: E,
1115
+ headerRight: v,
1116
+ footerLeft: F,
1117
+ footerMiddle: m,
1118
+ footerRight: k,
1119
+ variant: R,
1120
+ options: S = {},
1121
+ style: z,
1122
+ debugOptions: A = {
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: g,
1129
+ resourceDescription: I,
1130
+ requiredPermissions: ie,
1131
+ fallbackComponent: Q,
1132
+ securityOptions: H
1074
1133
  }) {
1075
- const [V, F] = Tt({
1076
- value: ee,
1077
- defaultValue: l,
1134
+ const [G, P] = Nt({
1135
+ value: N,
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
+ kt([[A && A.debugLayoutHotKey, () => P(!G)]]);
1140
+ const $ = De(), { t: D } = zt();
1141
+ Re({
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), T = n || _, de = pe(null), ee = pe(null), X = Qe(de), U = Qe(ee), M = Qe(T), Y = Ie(() => ({
1145
+ height: M.height - X.height - U.height - Number(Tt("0.625rem")),
1146
+ width: M.width - X.width - U.width
1147
+ }), [M.height, M.width, X.height, X.width, U.height, U.width]), J = pe(o);
1148
+ Xe(() => {
1149
+ o !== J.current && (P(o), J.current = o);
1150
+ }, [o, P]);
1151
+ const W = /* @__PURE__ */ C($e, { children: [
1093
1152
  /* @__PURE__ */ e(
1094
- We,
1153
+ _e,
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) }) }),
1155
+ ref: T,
1156
+ withBorder: b,
1157
+ radius: x,
1158
+ style: { width: i, height: u, padding: 4, ...z },
1159
+ children: /* @__PURE__ */ C(nt, { height: "100%", children: [
1160
+ /* @__PURE__ */ e(bt, { size: X.height, children: /* @__PURE__ */ e("div", { ref: de, children: tn(S, c, v, G) }) }),
1102
1161
  /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(
1103
- st,
1162
+ vt,
1104
1163
  {
1105
- h: J.height,
1164
+ h: Y.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: [
1169
+ children: h ? /* @__PURE__ */ C(Ut, { children: [
1111
1170
  a && /* @__PURE__ */ e(
1112
- je,
1171
+ We,
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(Je, { 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: Y.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(it, { size: U.height, children: /* @__PURE__ */ e("div", { ref: ee, children: nn(S, F, k, G) }) })
1130
1189
  ] })
1131
1190
  }
1132
1191
  ),
1133
1192
  /* @__PURE__ */ e(
1134
- kt,
1193
+ _t,
1135
1194
  {
1136
- debugObjectInspectorHotKey: b && b.debugObjectInspectorHotKey,
1137
- objectsToInspect: b && b.objectsToInspect
1195
+ debugObjectInspectorHotKey: A && A.debugObjectInspectorHotKey,
1196
+ objectsToInspect: A && A.objectsToInspect
1138
1197
  }
1139
1198
  )
1140
1199
  ] });
1141
1200
  return /* @__PURE__ */ e(
1142
- ye,
1201
+ Te,
1143
1202
  {
1144
- resourceName: x,
1145
- resourceDescription: y,
1146
- requiredPermissions: Y,
1147
- fallbackComponent: _,
1148
- onSecurityReady: S?.onSecurityReady,
1149
- onAccessDenied: S?.onAccessDenied,
1203
+ resourceName: g,
1204
+ resourceDescription: I,
1205
+ requiredPermissions: ie,
1206
+ fallbackComponent: Q,
1207
+ onSecurityReady: H?.onSecurityReady,
1208
+ onAccessDenied: H?.onAccessDenied,
1150
1209
  children: W
1151
1210
  }
1152
1211
  );
1153
1212
  }
1154
- const Ot = {
1213
+ const rn = {
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 on(t, n, a, f, r, i) {
1222
+ console.log(`Render de "${t}" na fase "${n}": ${a}ms`);
1164
1223
  }
1165
- function Ar({
1224
+ function In({
1166
1225
  title: t,
1167
- dataSource: r,
1226
+ dataSource: n,
1168
1227
  // dataSourceEdition,
1169
1228
  filterOptions: a,
1170
- globalFilterFieldNames: d,
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: N = () => {
1180
1239
  },
1181
- width: l = "100%",
1240
+ width: o = "100%",
1182
1241
  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,
1242
+ withBorder: E = !0,
1243
+ filterPersistenceDelegator: v,
1244
+ withPagination: F = !0,
1245
+ radius: m,
1246
+ userActions: k,
1247
+ columnsCountBreakPoints: R,
1248
+ columnsCount: S,
1249
+ gutter: z,
1250
+ component: A,
1251
+ activeIndex: g,
1252
+ activeBackgroundColor: I,
1253
+ activeColor: ie,
1254
+ onItemEnter: Q,
1255
+ onItemLeave: H,
1256
+ style: G,
1257
+ actionsButtonsOptions: P,
1258
+ spaceOptions: $,
1259
+ variant: D,
1260
+ id: _ = Xt("masonry"),
1261
+ debugOptions: T,
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: X,
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 Y = De(), J = Re({
1270
+ autoRegisterActions: M?.autoRegisterActions ?? !0
1271
+ }), [W] = q(_), L = i || pe(null), oe = pe(null), [xe, d] = q(n.getCurrentPage()), [j, Z] = q(
1272
+ g || (n && n.getTotalRecords() > 0 ? 0 : -1)
1214
1273
  );
1215
- Ge(E);
1216
- const [ie, oe] = te({
1274
+ Qe(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, Ee] = q(0), {
1279
+ isDataSourceV2: ve,
1280
+ v1State: { forceUpdate: B }
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
+ tt({
1286
+ dataSource: n,
1287
+ listener: (l) => {
1288
+ (l.type === Ae.afterRemove || l.type === Ae.refreshData) && (Ee((y) => y + 1), ve || B());
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 le = Ie(() => {
1292
+ const l = { ...rn, ...k }, y = [], se = (ae) => J.isAvailable ? (J.registerAction(), J.hasPermission()) : !0;
1293
+ return l.allowAdd && l.onAddExecute && se() && y.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 : p().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: `${p().t("archbase:Clique para criar um novo registro")}`
1303
+ }), l.allowEdit && l.onEditExecute && se() && y.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 : p().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: `${p().t("archbase:Clique para editar o registro")}`
1313
+ }), l.allowRemove && l.onRemoveExecute && se() && y.push({
1255
1314
  id: "actRemove",
1256
- icon: /* @__PURE__ */ e(Ye, {}),
1315
+ icon: /* @__PURE__ */ e(Ze, {}),
1257
1316
  color: "red",
1258
- label: i.labelRemove ? i.labelRemove : m().t("archbase:Remove"),
1317
+ label: l.labelRemove ? l.labelRemove : p().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: `${p().t("archbase:Clique para remover o registro")}`
1323
+ }), l.allowView && l.onViewExecute && se() && y.push({
1265
1324
  id: "actView",
1266
- icon: /* @__PURE__ */ e(Ze, {}),
1267
- label: i.labelView ? i.labelView : m().t("archbase:View"),
1325
+ icon: /* @__PURE__ */ e(pt, {}),
1326
+ label: l.labelView ? l.labelView : p().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: `${p().t("archbase:Clique para visualizar o registro")}`
1332
+ }), l.customUserActions && l.positionCustomUserActions === "before" ? [...l.customUserActions, ...y] : l.customUserActions && l.positionCustomUserActions === "after" ? [...y, ...l.customUserActions] : y;
1333
+ }, [k, n, J]), ze = Ie(() => {
1334
+ if (A) {
1335
+ const l = A.type;
1336
+ let y = {};
1337
+ return A.props && (y = A.props), n.browseRecords().map((se, ae) => {
1338
+ const Me = `${W}_${ae}`, Ne = `${W}_${ae}`;
1339
+ let Fe = se.active === void 0 ? !1 : se.active;
1340
+ return j >= 0 && (Fe = !1, j === ae && (Fe = !0)), /* @__PURE__ */ e(
1341
+ l,
1283
1342
  {
1284
- id: Ve,
1285
- active: ve,
1286
- index: se,
1287
- dataSource: r,
1288
- recordData: le,
1289
- disabled: le.disabled,
1290
- ...p
1343
+ id: Ne,
1344
+ active: Fe,
1345
+ index: ae,
1346
+ dataSource: n,
1347
+ recordData: se,
1348
+ disabled: se.disabled,
1349
+ ...y
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, A, W, n, te]), Be = (l, y) => {
1357
+ fe({ ...ue, currentFilter: l, activeFilterIndex: y });
1358
+ }, Ue = (l) => {
1359
+ fe({ ...ue, expandedFilter: l });
1360
+ }, Ve = (l, y) => {
1361
+ fe({ ...ue, currentFilter: l, activeFilterIndex: y });
1362
+ }, Pe = () => {
1363
+ }, V = (l, y) => {
1364
+ Z(l), n && n.gotoRecordByData(y);
1365
+ }, ot = (l) => {
1366
+ if (n) {
1367
+ const y = n.getOptions();
1368
+ y.filter = l, y.currentPage = xe, n.refreshData(y), ve || B();
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 y = n.getOptions();
1373
+ y.currentPage = l, n.refreshData(y), ve || B();
1315
1374
  }
1316
- }, L = () => f === "normal" && d ? /* @__PURE__ */ e(
1317
- Jt,
1375
+ }, O = () => b === "normal" && f ? /* @__PURE__ */ e(
1376
+ Qt,
1318
1377
  {
1319
- searchableFields: d,
1320
- onFilter: lt,
1378
+ searchableFields: f,
1379
+ onFilter: ot,
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(Mt, { id: `profile_${a.componentName}`, onRender: on, children: /* @__PURE__ */ e(
1383
+ Ct,
1325
1384
  {
1326
1385
  id: a.componentName,
1327
1386
  viewName: a.viewName,
1328
1387
  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,
1388
+ ref: oe,
1389
+ variant: D || Y.variant,
1390
+ expandedFilter: ue.expandedFilter,
1391
+ persistenceDelegator: v,
1392
+ currentFilter: ue.currentFilter,
1393
+ activeFilterIndex: ue.activeFilterIndex,
1394
+ onSelectedFilter: Ve,
1395
+ onFilterChanged: Be,
1396
+ onSearchByFilter: Pe,
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
+ }, ye = {
1347
1406
  headerFlexGrow: "left",
1348
1407
  footerGridColumns: {}
1349
- }, he = { ...Re, ...F }, Ee = { ...He, ...N };
1408
+ }, ge = { ...me, ...P }, we = { ...ye, ...$ };
1350
1409
  return /* @__PURE__ */ e(
1351
- ye,
1410
+ Te,
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: X,
1415
+ fallbackComponent: U,
1416
+ onSecurityReady: M?.onSecurityReady,
1417
+ onAccessDenied: M?.onAccessDenied,
1359
1418
  children: /* @__PURE__ */ e(
1360
- wt,
1419
+ Dt,
1361
1420
  {
1362
- innerRef: E,
1363
- width: l,
1421
+ innerRef: L,
1422
+ width: o,
1364
1423
  height: c,
1365
- radius: h,
1366
- withBorder: M,
1367
- isError: I,
1368
- error: v,
1369
- clearError: ee,
1424
+ radius: m,
1425
+ withBorder: E,
1426
+ isError: h,
1427
+ error: x,
1428
+ clearError: N,
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: T,
1432
+ style: G,
1433
+ options: we,
1434
+ headerLeft: /* @__PURE__ */ e(St, { actions: le, options: ge }),
1435
+ headerRight: O(),
1436
+ footerRight: F ? /* @__PURE__ */ e(wt, { total: n.getTotalPages(), onChange: ne }) : void 0,
1378
1437
  children: /* @__PURE__ */ e(
1379
- zt,
1438
+ Jt,
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: V,
1444
+ activeBackgroundColor: I,
1445
+ activeColor: ie,
1446
+ onItemEnter: Q,
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(Wt, { columnsCountBreakPoints: R, children: /* @__PURE__ */ e(Ot, { 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 ln = {
1399
1458
  visible: !0,
1400
1459
  allowAdd: !0,
1401
1460
  allowEdit: !0,
@@ -1403,205 +1462,531 @@ const tr = {
1403
1462
  allowRemove: !0,
1404
1463
  positionCustomUserActions: "after"
1405
1464
  };
1406
- function yr({
1465
+ function Dn({
1407
1466
  title: t,
1408
- dataSource: r,
1467
+ dataSource: n,
1409
1468
  // dataSourceEdition,
1410
1469
  filterOptions: a,
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,
1478
+ width: h = "100%",
1479
+ height: x = "100%",
1480
+ withBorder: N = !0,
1481
+ filterPersistenceDelegator: o,
1423
1482
  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,
1483
+ children: E,
1484
+ radius: v,
1485
+ userActions: F,
1486
+ debug: m = !1,
1487
+ variant: k,
1488
+ actionsButtonsOptions: R,
1489
+ spaceOptions: S,
1490
+ style: z,
1491
+ debugOptions: A,
1433
1492
  // Props de segurança (opcionais)
1434
- resourceName: x,
1435
- resourceDescription: y,
1436
- requiredPermissions: Y,
1437
- fallbackComponent: _,
1438
- securityOptions: S
1493
+ resourceName: g,
1494
+ resourceDescription: I,
1495
+ requiredPermissions: ie,
1496
+ fallbackComponent: Q,
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 = De(), P = Re({
1500
+ autoRegisterActions: H?.autoRegisterActions ?? !0
1501
+ }), $ = r || pe(null), D = pe(null), [_, T] = 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
+ ), X = Ie(() => {
1511
+ const d = { ...ln, ...F }, j = (ue) => P.isAvailable ? (P.registerAction(), P.hasPermission()) : !0, Z = [];
1512
+ return d.allowAdd && d.onAddExecute && j() && Z.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: d.labelAdd ? d.labelAdd : p().t("archbase:New"),
1458
1517
  executeAction: () => {
1459
- s && s.onAddExecute && s.onAddExecute();
1518
+ d && d.onAddExecute && d.onAddExecute();
1460
1519
  },
1461
1520
  enabled: !0,
1462
1521
  hint: "Clique para criar."
1463
- }), s.allowEdit && s.onEditExecute && z() && O.push({
1522
+ }), d.allowEdit && d.onEditExecute && j() && Z.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: d.labelEdit ? d.labelEdit : p().t("archbase:Edit"),
1468
1527
  executeAction: () => {
1469
- s && s.onEditExecute && s.onEditExecute();
1528
+ d && d.onEditExecute && d.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
+ }), d.allowRemove && d.onRemoveExecute && j() && Z.push({
1474
1533
  id: "3",
1475
- icon: /* @__PURE__ */ e(Ye, {}),
1534
+ icon: /* @__PURE__ */ e(Ze, {}),
1476
1535
  color: "red",
1477
- label: s.labelRemove ? s.labelRemove : m().t("archbase:Remove"),
1536
+ label: d.labelRemove ? d.labelRemove : p().t("archbase:Remove"),
1478
1537
  executeAction: () => {
1479
- s && s.onRemoveExecute && s.onRemoveExecute();
1538
+ d && d.onRemoveExecute && d.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
+ }), d.allowView && d.onView && j() && Z.push({
1484
1543
  id: "4",
1485
- icon: /* @__PURE__ */ e(Ze, {}),
1544
+ icon: /* @__PURE__ */ e(pt, {}),
1486
1545
  color: "green",
1487
- label: s.labelView ? s.labelView : m().t("archbase:View"),
1546
+ label: d.labelView ? d.labelView : p().t("archbase:View"),
1488
1547
  executeAction: () => {
1489
- s && s.onView && s.onView();
1548
+ d && d.onView && d.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
+ }), d.customUserActions && d.positionCustomUserActions === "before" ? [...d.customUserActions, ...Z] : d.customUserActions && d.positionCustomUserActions === "after" ? [...Z, ...d.customUserActions] : Z;
1553
+ }, [F, n, P]), U = (d, j) => {
1554
+ T({ ..._, currentFilter: d, activeFilterIndex: j });
1555
+ }, M = (d) => {
1556
+ T({ ..._, expandedFilter: d });
1557
+ }, Y = (d, j) => {
1558
+ T({ ..._, currentFilter: d, 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
+ }, oe = { ...W, ...R }, xe = { ...L, ...S };
1509
1568
  return /* @__PURE__ */ e(
1510
- ye,
1569
+ Te,
1511
1570
  {
1512
- resourceName: x,
1513
- resourceDescription: y,
1514
- requiredPermissions: Y,
1515
- fallbackComponent: _,
1516
- onSecurityReady: S?.onSecurityReady,
1517
- onAccessDenied: S?.onAccessDenied,
1571
+ resourceName: g,
1572
+ resourceDescription: I,
1573
+ requiredPermissions: ie,
1574
+ fallbackComponent: Q,
1575
+ onSecurityReady: H?.onSecurityReady,
1576
+ onAccessDenied: H?.onAccessDenied,
1518
1577
  children: /* @__PURE__ */ e(
1519
- wt,
1578
+ Dt,
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: N,
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: A,
1591
+ style: z,
1592
+ options: xe,
1593
+ headerLeft: /* @__PURE__ */ e(St, { actions: X, options: oe }),
1535
1594
  headerRight: /* @__PURE__ */ e(
1536
- it,
1595
+ Ct,
1537
1596
  {
1538
1597
  id: a.componentName,
1539
1598
  viewName: a.viewName,
1540
1599
  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: $,
1600
+ ref: D,
1601
+ variant: k || G.variant,
1602
+ expandedFilter: _.expandedFilter,
1603
+ persistenceDelegator: o,
1604
+ currentFilter: _.currentFilter,
1605
+ activeFilterIndex: _.activeFilterIndex,
1606
+ onSelectedFilter: Y,
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: c && /* @__PURE__ */ e(wt, { total: 10 }),
1616
+ children: E
1558
1617
  }
1559
1618
  )
1560
1619
  }
1561
1620
  );
1562
1621
  }
1563
- function Cr() {
1622
+ function Tn() {
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 sn(t, n) {
1626
+ const {
1627
+ // Props obrigatórias
1628
+ opened: a,
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: N,
1638
+ initialSelectedItems: o,
1639
+ selectOnDoubleClick: c = !0,
1640
+ onBeforeConfirm: E,
1641
+ onAfterConfirm: v,
1642
+ // DataSource
1643
+ dataSource: F,
1644
+ loadData: m,
1645
+ searchFields: k = "",
1646
+ pageSize: R = 100,
1647
+ // Aparência
1648
+ displaySubField: S,
1649
+ renderSelectedItem: z,
1650
+ renderSelectedItems: A,
1651
+ icon: g,
1652
+ modalSize: I = "70%",
1653
+ modalHeight: ie = "600px",
1654
+ gridHeight: Q = 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: T,
1664
+ isError: de = !1,
1665
+ error: ee = "",
1666
+ clearError: X,
1667
+ autoCloseAlertError: U = 15e3,
1668
+ onError: M,
1669
+ // Customização
1670
+ userActions: Y,
1671
+ labels: J,
1672
+ variant: W,
1673
+ // Segurança
1674
+ resourceName: L,
1675
+ resourceDescription: oe,
1676
+ requiredPermissions: xe,
1677
+ fallbackComponent: d,
1678
+ securityOptions: j
1679
+ } = t, Z = De(), ue = et(), { colorScheme: fe } = Ye(), te = ht(), [Ee, ve] = q(!1), [B, le] = q(o || []), [ze, Be] = q(!1), [Ue, Ve] = q(""), Pe = pe(null), V = !!F, ne = K(() => V && F ? F : (Pe.current || (Pe.current = new qt("dsLookup", {
1680
+ records: [],
1681
+ grandTotalRecords: 0,
1682
+ currentPage: 0,
1683
+ totalPages: 0,
1684
+ pageSize: R
1685
+ })), Pe.current), [V, F, R])();
1686
+ Re({
1687
+ autoRegisterActions: j?.autoRegisterActions ?? !0
1688
+ });
1689
+ const O = Le(
1690
+ "ArchbaseLookupDataTemplate",
1691
+ ne,
1692
+ void 0,
1693
+ void 0
1694
+ );
1695
+ tt({
1696
+ dataSource: ne,
1697
+ listener: (s) => {
1698
+ if (s.type === Ae.onError && (Be(!0), Ve(s.error || "")), s.type === Ae.afterScroll) {
1699
+ if (h === "single") {
1700
+ const w = ne.getCurrentRecord();
1701
+ w && le([w]);
1702
+ }
1703
+ O.isDataSourceV2 || te();
1704
+ }
1705
+ }
1706
+ });
1707
+ const me = {
1708
+ okButton: p().t("archbase:Ok"),
1709
+ cancelButton: p().t("archbase:Cancel"),
1710
+ clearButton: p().t("archbase:Clear"),
1711
+ selectedLabel: p().t("archbase:Selected"),
1712
+ doubleClickHint: p().t("archbase:Double click to select"),
1713
+ noItemSelected: p().t("archbase:No item selected"),
1714
+ itemsSelected: p().t("archbase:items selected"),
1715
+ ...J
1716
+ }, ye = K(
1717
+ async (s) => {
1718
+ if (!(V || !m)) {
1719
+ ve(!0);
1720
+ try {
1721
+ const w = await m(s, k);
1722
+ ne.open({
1723
+ records: w,
1724
+ grandTotalRecords: w.length,
1725
+ currentPage: 0,
1726
+ totalPages: Math.ceil(w.length / R),
1727
+ pageSize: R
1728
+ });
1729
+ } catch (w) {
1730
+ Be(!0), Ve(be(w)), M?.(w);
1731
+ } finally {
1732
+ ve(!1);
1733
+ }
1734
+ }
1735
+ },
1736
+ [V, m, k, R, ne, M]
1737
+ ), ge = K(
1738
+ (s) => {
1739
+ const w = s?.quickFilterValues?.[0] || "";
1740
+ m && !V && ye(w);
1741
+ },
1742
+ [m, V, ye]
1743
+ );
1744
+ Xe(() => {
1745
+ a && (o?.length ? le(o) : le([]), ye());
1746
+ }, [a]), Xe(() => {
1747
+ o && le(o);
1748
+ }, [o]);
1749
+ const we = K(
1750
+ (s) => {
1751
+ h === "single" ? le(s.slice(0, 1)) : $ && s.length > $ ? le(s.slice(0, $)) : le(s);
1752
+ },
1753
+ [h, $]
1754
+ ), l = K(
1755
+ (s) => {
1756
+ if (h === "single" && c) {
1757
+ const w = ne.getCurrentRecord();
1758
+ w && (x?.(w), i());
1759
+ }
1760
+ },
1761
+ [h, c, ne, x, i]
1762
+ ), y = K(() => {
1763
+ le([]);
1764
+ }, []), se = K(async () => {
1765
+ E && !await E(B) || (h === "single" ? B.length > 0 && x?.(B[0]) : N?.(B), v?.(B), i());
1766
+ }, [B, h, x, N, E, v, i]), ae = K(() => {
1767
+ i();
1768
+ }, [i]), Me = () => {
1769
+ gt.showWarning(p().t("archbase:Click on Ok or Cancel to close"));
1770
+ }, Ne = () => {
1771
+ X?.(), Be(!1), Ve("");
1772
+ };
1773
+ Ft(
1774
+ n,
1775
+ () => ({
1776
+ getSelectedItems: () => B,
1777
+ getSelectedItem: () => B[0] || null,
1778
+ clearSelection: () => le([]),
1779
+ selectItems: (s) => we(s),
1780
+ selectItem: (s) => le([s]),
1781
+ deselectItem: (s) => {
1782
+ le((w) => w.filter((re) => re[u] !== s[u]));
1783
+ },
1784
+ refreshData: () => ye(),
1785
+ getDataSource: () => ne,
1786
+ confirmSelection: async () => {
1787
+ await se();
1788
+ },
1789
+ cancelSelection: ae
1790
+ }),
1791
+ [B, we, u, ye, ne, se, ae]
1792
+ );
1793
+ const Fe = K(
1794
+ (s) => {
1795
+ const w = s[u];
1796
+ return w !== void 0 ? w : "";
1797
+ },
1798
+ [u]
1799
+ ), Oe = T || Ee, lt = ee || Ue, st = de || ze, at = /* @__PURE__ */ C(ce, { gap: "sm", children: [
1800
+ g,
1801
+ /* @__PURE__ */ e(ke, { fw: 600, children: f })
1802
+ ] }), ct = () => {
1803
+ if (!P)
1804
+ return null;
1805
+ if (h === "single" && B.length > 0 && z)
1806
+ return z(B[0]);
1807
+ if (h === "multiple" && B.length > 0 && A)
1808
+ return A(B);
1809
+ if (h === "single" && B.length > 0) {
1810
+ const s = B[0];
1811
+ return /* @__PURE__ */ e(_e, { 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(je, { 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(s[b]) }),
1819
+ S && /* @__PURE__ */ e(ke, { size: "sm", c: "dimmed", children: String(s[S] || "") })
1820
+ ] }),
1821
+ /* @__PURE__ */ e(ke, { size: "xs", c: "dimmed", children: me.doubleClickHint })
1822
+ ] }) });
1823
+ }
1824
+ return h === "multiple" && B.length > 0 ? /* @__PURE__ */ e(_e, { 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(je, { size: 16, color: "green" }),
1827
+ /* @__PURE__ */ C(ke, { size: "sm", fw: 500, children: [
1828
+ B.length,
1829
+ " ",
1830
+ me.itemsSelected
1831
+ ] })
1832
+ ] }),
1833
+ _ && /* @__PURE__ */ e(
1834
+ He,
1835
+ {
1836
+ size: "xs",
1837
+ variant: "subtle",
1838
+ color: "red",
1839
+ leftSection: /* @__PURE__ */ e(Ze, { size: 14 }),
1840
+ onClick: y,
1841
+ children: me.clearButton
1842
+ }
1843
+ )
1844
+ ] }) }) : null;
1845
+ };
1846
+ return /* @__PURE__ */ e(
1847
+ Te,
1848
+ {
1849
+ resourceName: L,
1850
+ resourceDescription: oe,
1851
+ requiredPermissions: xe,
1852
+ fallbackComponent: d,
1853
+ onSecurityReady: j?.onSecurityReady,
1854
+ onAccessDenied: j?.onAccessDenied,
1855
+ children: /* @__PURE__ */ C(
1856
+ ut,
1857
+ {
1858
+ title: at,
1859
+ opened: a,
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: [
1871
+ /* @__PURE__ */ e(dt, { visible: Oe, opacity: 0.8 }),
1872
+ /* @__PURE__ */ C(nt, { height: ie, children: [
1873
+ st && /* @__PURE__ */ e(bt, { size: "100px", children: /* @__PURE__ */ e(
1874
+ We,
1875
+ {
1876
+ autoClose: U,
1877
+ withCloseButton: !0,
1878
+ withBorder: !0,
1879
+ icon: /* @__PURE__ */ e(Je, { size: "1.4rem" }),
1880
+ title: p().t("archbase:WARNING"),
1881
+ titleColor: "rgb(250, 82, 82)",
1882
+ variant: W ?? Z.variant,
1883
+ onClose: Ne,
1884
+ children: /* @__PURE__ */ e("span", { children: lt })
1885
+ }
1886
+ ) }),
1887
+ /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ C(Bt, { gap: "md", h: "100%", children: [
1888
+ Y && /* @__PURE__ */ e(ce, { justify: "flex-end", children: Y }),
1889
+ Oe && !T ? /* @__PURE__ */ e(Vt, { h: Q, children: /* @__PURE__ */ e(Pt, {}) }) : /* @__PURE__ */ e(
1890
+ Et,
1891
+ {
1892
+ dataSource: ne,
1893
+ height: Q,
1894
+ rowHeight: H,
1895
+ withBorder: !0,
1896
+ striped: !0,
1897
+ highlightOnHover: !0,
1898
+ enableRowSelection: h === "multiple",
1899
+ enableRowNumbers: !0,
1900
+ enableColumnFilterModes: !0,
1901
+ enableTopToolbar: !0,
1902
+ enableGlobalFilter: !0,
1903
+ getRowId: Fe,
1904
+ onCellDoubleClick: l,
1905
+ onSelectedRowsChanged: h === "multiple" ? we : void 0,
1906
+ onFilterModelChange: ge,
1907
+ children: r
1908
+ }
1909
+ ),
1910
+ ct()
1911
+ ] }) }),
1912
+ /* @__PURE__ */ e(it, { size: "50px", children: /* @__PURE__ */ C(Ce, { justify: "space-between", align: "center", children: [
1913
+ /* @__PURE__ */ e(ce, {}),
1914
+ /* @__PURE__ */ C(ce, { gap: "md", children: [
1915
+ /* @__PURE__ */ e(
1916
+ he,
1917
+ {
1918
+ actionName: "confirm",
1919
+ actionDescription: "Confirmar seleção",
1920
+ leftSection: /* @__PURE__ */ e(je, {}),
1921
+ onClick: se,
1922
+ disabled: B.length === 0,
1923
+ variant: W ?? Z.variant,
1924
+ color: "green",
1925
+ children: me.okButton
1926
+ }
1927
+ ),
1928
+ /* @__PURE__ */ e(
1929
+ he,
1930
+ {
1931
+ actionName: "cancel",
1932
+ actionDescription: "Cancelar seleção",
1933
+ leftSection: /* @__PURE__ */ e(Ge, {}),
1934
+ onClick: ae,
1935
+ variant: W ?? Z.variant,
1936
+ color: "red",
1937
+ children: me.cancelButton
1938
+ }
1939
+ )
1940
+ ] })
1941
+ ] }) })
1942
+ ] })
1943
+ ]
1944
+ }
1945
+ )
1946
+ }
1947
+ );
1948
+ }
1949
+ const Bn = yt(sn), xt = jt(void 0);
1950
+ function Vn({ children: t }) {
1951
+ const [n, a] = q({}), f = K((b, h) => {
1952
+ a((x) => ({ ...x, [b]: h }));
1953
+ }, []), r = K((b) => {
1954
+ a((h) => {
1955
+ const x = { ...h };
1956
+ return delete x[b], x;
1574
1957
  });
1575
- }, []), o = Ne(() => {
1958
+ }, []), i = K(() => {
1576
1959
  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 });
1960
+ }, []), u = K((b) => n[b], [n]);
1961
+ return /* @__PURE__ */ e(xt.Provider, { value: { errors: n, setError: f, clearError: r, clearAll: i, getError: u }, children: t });
1579
1962
  }
1580
- function Rr() {
1581
- return pt(ot);
1963
+ function Pn() {
1964
+ return Rt(xt);
1582
1965
  }
1583
- function Er() {
1584
- const t = pt(ot);
1966
+ function Nn() {
1967
+ const t = Rt(xt);
1585
1968
  if (!t)
1586
1969
  throw new Error("useRequiredValidationErrors must be used within ValidationErrorsProvider");
1587
1970
  return t;
1588
1971
  }
1589
1972
  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
1973
+ An as ArchbaseAdvancedSmartButton,
1974
+ Te as ArchbaseConditionalSecurityWrapper,
1975
+ Rn as ArchbaseFormModalTemplate,
1976
+ Fn as ArchbaseFormTemplate,
1977
+ Sn as ArchbaseGridTemplate,
1978
+ Bn as ArchbaseLookupDataTemplate,
1979
+ In as ArchbaseMasonryTemplate,
1980
+ En as ArchbaseModalTemplate,
1981
+ Dn as ArchbasePanelTemplate,
1982
+ Tn as ArchbaseSearchTemplate,
1983
+ he as ArchbaseSmartActionButton,
1984
+ Dt as ArchbaseSpaceTemplate,
1985
+ Vn as ValidationErrorsProvider,
1986
+ wn as useArchbaseLookup,
1987
+ yn as useConditionalSecurity,
1988
+ Re as useOptionalTemplateSecurity,
1989
+ Nn as useRequiredValidationErrors,
1990
+ vn as useTemplateSecurityAvailable,
1991
+ Pn as useValidationErrors
1607
1992
  };