@aeria-ui/ui 0.0.64 → 0.0.65

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.
@@ -1,3416 +0,0 @@
1
- import { defineComponent as q, ref as X, resolveDirective as te, openBlock as o, createElementBlock as i, normalizeClass as Q, Fragment as Z, renderList as U, withDirectives as P, toDisplayString as V, createCommentVNode as h, createTextVNode as H, unref as e, renderSlot as O, inject as ve, computed as D, createElementVNode as C, mergeProps as E, createBlock as k, resolveDynamicComponent as he, withCtx as v, useCssVars as Vt, Teleport as Ke, onMounted as ft, watch as re, createVNode as R, vModelDynamic as Ct, onBeforeMount as vt, normalizeStyle as $e, withModifiers as Fe, pushScopeId as Ue, popScopeId as Ee, provide as ye, createSlots as ue, normalizeProps as de, guardReactiveProps as Ve, vModelCheckbox as It, onUnmounted as Ot, isRef as ut, resolveComponent as At, Suspense as Bt, useSlots as wt, h as St } from "vue";
2
- import { t as z, useI18n as jt } from "@aeria-ui/i18n";
3
- import { useScrollObserver as Xe, useBreakpoints as Re, useMask as Tt, PAGINATION_PER_PAGE_DEFAULTS as Lt, API_URL as yt, request as Rt, useDebounce as ht, isDocumentComplete as zt, getObjectKey as Mt, convertToSearchQuery as Ft, useAction as qt, convertFromSearchQuery as Ut, usePasswordPolicy as Et } from "@aeria-ui/core";
4
- import { arraysIntersect as $t, getReferenceProperty as pe, convertConditionToQuery as Dt, deepClone as Le, freshItem as Ht, isRequired as Qt, evaluateCondition as We } from "@aeriajs/common";
5
- import { useStore as se, getStoreId as ze, useParentStore as ge, STORE_ID as De, getGlobalStateManager as bt } from "@aeria-ui/state-management";
6
- import { useRouter as Oe } from "vue-router";
7
- const Gt = ["onClick"], Wt = { key: 0 }, Kt = {
8
- key: 0,
9
- class: "accordion__content"
10
- }, Xt = /* @__PURE__ */ q({
11
- __name: "aeria-accordion",
12
- props: {
13
- enumerate: { type: Boolean },
14
- noPadding: { type: Boolean },
15
- headers: {}
16
- },
17
- setup(d) {
18
- const r = X(null), a = (t) => typeof t == "string" ? t : t.title;
19
- return (t, l) => {
20
- const s = te("clickable");
21
- return o(), i("div", {
22
- class: Q({
23
- accordion: !0,
24
- "accordion--padded": !t.noPadding
25
- })
26
- }, [
27
- (o(!0), i(Z, null, U(Object.keys(t.$slots).filter((u) => u !== "default"), (u, y) => (o(), i("div", {
28
- key: u,
29
- class: "accordion__slot"
30
- }, [
31
- P((o(), i("div", {
32
- class: "accordion__header",
33
- onClick: (c) => r.value === u ? r.value = null : r.value = u
34
- }, [
35
- t.enumerate ? (o(), i("span", Wt, V(y + 1) + ". ", 1)) : h("", !0),
36
- H(" " + V(t.headers[u] ? a(t.headers[u]) : e(z)(u)), 1)
37
- ], 8, Gt)), [
38
- [s]
39
- ]),
40
- r.value === u ? (o(), i("div", Kt, [
41
- O(t.$slots, u, {}, void 0, !0)
42
- ])) : h("", !0)
43
- ]))), 128))
44
- ], 2);
45
- };
46
- }
47
- });
48
- const G = (d, r) => {
49
- const a = d.__vccOpts || d;
50
- for (const [t, l] of r)
51
- a[t] = l;
52
- return a;
53
- }, Ll = /* @__PURE__ */ G(Xt, [["__scopeId", "data-v-3ea933d4"]]), Yt = /* @__PURE__ */ q({
54
- __name: "aeria-badge",
55
- props: {
56
- large: { type: Boolean },
57
- alt: { type: Boolean }
58
- },
59
- setup(d) {
60
- return (r, a) => (o(), i("div", {
61
- class: Q(`
62
- badge
63
- ${r.large && "badge--large"}
64
- ${r.alt && "badge--alt"}
65
- `)
66
- }, [
67
- O(r.$slots, "default", {}, void 0, !0)
68
- ], 2));
69
- }
70
- });
71
- const be = /* @__PURE__ */ G(Yt, [["__scopeId", "data-v-47f92648"]]), Jt = /* @__PURE__ */ q({
72
- __name: "aeria-bare-button",
73
- props: {
74
- disabled: { type: Boolean }
75
- },
76
- emits: ["click"],
77
- setup(d, { emit: r }) {
78
- const a = d, t = r, l = (s) => {
79
- a.disabled || t("click", s);
80
- };
81
- return (s, u) => (o(), i("button", {
82
- class: Q(`
83
- barebutton
84
- barebutton--${s.disabled ? "disabled" : "enabled"}
85
- `),
86
- onClick: l
87
- }, [
88
- O(s.$slots, "default", {}, void 0, !0)
89
- ], 2));
90
- }
91
- });
92
- const fe = /* @__PURE__ */ G(Jt, [["__scopeId", "data-v-35bc81ae"]]), Zt = ["href"], Pt = {
93
- key: 0,
94
- "data-component": "icon-label"
95
- }, Nt = /* @__PURE__ */ q({
96
- __name: "aeria-icon",
97
- props: {
98
- icon: {},
99
- size: {},
100
- medium: { type: Boolean },
101
- reactive: { type: [Boolean, null] },
102
- iconRight: { type: Boolean },
103
- fill: {}
104
- },
105
- setup(d) {
106
- const r = d, a = typeof r.reactive == "boolean" ? r.reactive : ve("iconReactive", !1), t = D(() => {
107
- var l;
108
- return (l = r.icon) != null && l.includes(":") ? r.icon : `regular:${r.icon}`;
109
- });
110
- return (l, s) => (o(), i("a", {
111
- class: Q(`
112
- icon
113
- ${e(a) && "icon--reactive"}
114
- ${l.$slots.default ? "icon--centered" : "icon--standalone"}
115
- `)
116
- }, [
117
- C("div", {
118
- class: Q(`
119
- icon__icon
120
- ${l.size && `icon__icon--${l.size}`}
121
- ${l.iconRight && "icon__icon--right"}
122
- `)
123
- }, [
124
- (o(), i("svg", E({
125
- width: "24",
126
- height: "24",
127
- viewBox: "0 0 256 256",
128
- "data-component": "icon"
129
- }, {
130
- ...l.fill ? { fill: l.fill } : {}
131
- }), [
132
- C("use", {
133
- href: `/assets/icons.svg#${t.value}`
134
- }, null, 8, Zt)
135
- ], 16))
136
- ], 2),
137
- l.$slots.default ? (o(), i("div", Pt, [
138
- O(l.$slots, "default", {}, void 0, !0)
139
- ])) : h("", !0)
140
- ], 2));
141
- }
142
- });
143
- const N = /* @__PURE__ */ G(Nt, [["__scopeId", "data-v-4b763bd3"]]), xt = { class: "panel__header-left" }, en = { key: 1 }, tn = {
144
- key: 2,
145
- style: { "margin-left": "auto" }
146
- }, nn = /* @__PURE__ */ q({
147
- __name: "aeria-panel",
148
- props: {
149
- closeHint: { type: Boolean, default: !1 },
150
- modelValue: { default: !0 },
151
- title: {},
152
- float: { type: Boolean },
153
- fixedRight: { type: Boolean },
154
- floating: { type: Boolean },
155
- loading: { type: Boolean },
156
- bordered: { type: Boolean },
157
- overlay: { type: Boolean },
158
- invisibleOverlay: { type: Boolean },
159
- collapsed: { type: Boolean },
160
- collapsible: { type: Boolean, default: !1 },
161
- fill: { type: Boolean },
162
- fillFooter: { type: Boolean },
163
- transparent: { type: Boolean },
164
- transparentMobile: { type: Boolean },
165
- outerHeader: { type: Boolean },
166
- overlayLayer: {}
167
- },
168
- emits: ["update:modelValue", "update:collapsed", "update:closeHint", "overlayClick", "close"],
169
- setup(d, { emit: r }) {
170
- const a = d, t = r, l = D(() => a.floating || a.float), s = X(a.collapsed), u = X(null), { reachedEnd: y } = Xe(u), c = () => {
171
- t("update:modelValue", !1), t("close");
172
- }, $ = () => {
173
- t("overlayClick");
174
- }, m = (n) => {
175
- t("update:collapsed", n), s.value = n;
176
- };
177
- return (n, f) => {
178
- const b = te("clickable"), g = te("loading"), w = te("overlay");
179
- return n.modelValue ? P((o(), i("div", {
180
- key: 0,
181
- class: Q(`
182
- panel
183
- ${n.fixedRight && "panel--fixed"}
184
- `)
185
- }, [
186
- (o(), k(he(
187
- l.value ? "dialog" : "div"
188
- ), {
189
- "data-component": "panel",
190
- class: Q(`
191
- aeria-surface
192
- panel__content
193
- ${l.value && "panel__content--floating"}
194
- ${n.bordered && "panel__content--bordered"}
195
- ${n.fixedRight && "panel__content--fixed-right"}
196
- ${n.transparent && "panel__content--transparent"}
197
- ${n.transparentMobile && "panel__content--transparent-mobile"}
198
- ${n.outerHeader && "panel__content--outer-header"}
199
- `),
200
- onClick: f[2] || (f[2] = (T) => T.stopPropagation())
201
- }, {
202
- default: v(() => [
203
- n.$slots.header || n.title ? (o(), i("div", {
204
- key: 0,
205
- class: Q(`
206
- panel__header
207
- ${s.value && "panel__header--collapsed"}
208
- ${n.outerHeader && "panel__header--outer"}
209
- `)
210
- }, [
211
- C("div", xt, [
212
- n.$slots.header ? O(n.$slots, "header", { key: 0 }, void 0, !0) : n.title ? (o(), i("div", en, V(n.title), 1)) : h("", !0),
213
- n.$slots.extra ? (o(), i("div", tn, [
214
- O(n.$slots, "extra", {}, void 0, !0)
215
- ])) : h("", !0)
216
- ]),
217
- n.collapsible && s.value ? P((o(), k(N, {
218
- key: 0,
219
- reactive: "",
220
- icon: "plus",
221
- onClick: f[0] || (f[0] = (T) => m(!s.value))
222
- }, null, 512)), [
223
- [b]
224
- ]) : n.collapsible && !s.value ? P((o(), k(N, {
225
- key: 1,
226
- reactive: "",
227
- icon: "minus",
228
- onClick: f[1] || (f[1] = (T) => m(!s.value))
229
- }, null, 512)), [
230
- [b]
231
- ]) : n.closeHint ? P((o(), k(N, {
232
- key: 2,
233
- reactive: "",
234
- icon: "x",
235
- onClick: c
236
- }, null, 512)), [
237
- [b]
238
- ]) : h("", !0)
239
- ], 2)) : h("", !0),
240
- s.value ? h("", !0) : P((o(), i("div", {
241
- key: 1,
242
- ref_key: "body",
243
- ref: u,
244
- class: Q(`
245
- panel__body
246
- ${n.fill || "panel__body--padded"}
247
- `)
248
- }, [
249
- O(n.$slots, "default", {}, void 0, !0)
250
- ], 2)), [
251
- [g, n.loading]
252
- ]),
253
- n.$slots.footer ? (o(), i("div", {
254
- key: 2,
255
- class: Q(`
256
- panel__footer
257
- ${n.fillFooter || "panel__footer--padded"}
258
- ${e(y) || "panel__footer--shadowed"}
259
- `)
260
- }, [
261
- O(n.$slots, "footer", {}, void 0, !0)
262
- ], 2)) : h("", !0)
263
- ]),
264
- _: 3
265
- }, 8, ["class"]))
266
- ], 2)), [
267
- [w, {
268
- condition: n.overlay || n.fixedRight || l.value,
269
- invisible: n.invisibleOverlay,
270
- click: $,
271
- layer: n.overlayLayer || (l.value ? 60 : n.fixedRight ? 50 : 0)
272
- }]
273
- ]) : h("", !0);
274
- };
275
- }
276
- });
277
- const Ae = /* @__PURE__ */ G(nn, [["__scopeId", "data-v-73b47cf0"]]), on = { class: "button__content" }, an = {
278
- key: 1,
279
- class: "button__content"
280
- }, ln = /* @__PURE__ */ q({
281
- __name: "aeria-button",
282
- props: {
283
- size: {},
284
- variant: {},
285
- small: { type: Boolean },
286
- large: { type: Boolean },
287
- icon: {},
288
- disabled: { type: Boolean },
289
- loading: { type: Boolean }
290
- },
291
- setup(d) {
292
- const r = d, a = ve("buttonVariant", r.variant) || "primary", t = (() => {
293
- switch (!0) {
294
- case r.small:
295
- return "small";
296
- case r.large:
297
- return "large";
298
- }
299
- return ve("buttonSize", r.size) || "medium";
300
- })();
301
- return (l, s) => (o(), k(fe, {
302
- class: Q(`
303
- button
304
- button--${e(a)}
305
- button--${e(t)}
306
- ${l.loading && "button--loading"}
307
- `),
308
- disabled: l.disabled
309
- }, {
310
- default: v(() => [
311
- l.icon ? (o(), k(N, {
312
- key: 0,
313
- icon: l.icon
314
- }, {
315
- default: v(() => [
316
- C("div", on, [
317
- O(l.$slots, "default", {}, void 0, !0)
318
- ])
319
- ]),
320
- _: 3
321
- }, 8, ["icon"])) : (o(), i("div", an, [
322
- O(l.$slots, "default", {}, void 0, !0)
323
- ]))
324
- ]),
325
- _: 3
326
- }, 8, ["class", "disabled"]));
327
- }
328
- });
329
- const ie = /* @__PURE__ */ G(ln, [["__scopeId", "data-v-c328251b"]]), sn = { class: "card__picture" }, rn = { class: "card__footer" }, un = { class: "card__footer-upper" }, cn = { class: "card__badge" }, dn = /* @__PURE__ */ q({
330
- __name: "aeria-card",
331
- props: {
332
- inactive: { type: Boolean },
333
- horizontal: { type: Boolean }
334
- },
335
- setup(d) {
336
- return (r, a) => (o(), i("div", {
337
- class: Q(`
338
- card
339
- ${r.inactive && "card--inactive"}
340
- ${r.horizontal && "card--horizontal"}
341
- `)
342
- }, [
343
- C("div", sn, [
344
- O(r.$slots, "default", {}, void 0, !0)
345
- ]),
346
- C("div", rn, [
347
- C("div", un, [
348
- C("div", null, [
349
- O(r.$slots, "footer", {}, void 0, !0)
350
- ]),
351
- r.$slots.actions ? O(r.$slots, "actions", { key: 0 }, void 0, !0) : h("", !0)
352
- ]),
353
- C("div", cn, [
354
- O(r.$slots, "badge", {}, void 0, !0)
355
- ])
356
- ])
357
- ], 2));
358
- }
359
- });
360
- const pn = /* @__PURE__ */ G(dn, [["__scopeId", "data-v-c1a322df"]]), _n = { class: "content__body" }, mn = {
361
- key: 0,
362
- class: "content__section"
363
- }, fn = { class: "content__item" }, vn = /* @__PURE__ */ q({
364
- __name: "aeria-context-menu",
365
- props: {
366
- actions: {},
367
- subject: {},
368
- overlayLayer: {}
369
- },
370
- emits: ["actionClick"],
371
- setup(d, { emit: r }) {
372
- Vt((c) => ({
373
- "21ea8da7": y.value.x,
374
- "21ea8da8": y.value.y
375
- }));
376
- const a = r, t = X(null), l = X(!1), s = (c) => c == null ? void 0 : c.filter(($) => {
377
- if ($.roles) {
378
- const m = se("user");
379
- return $t($.roles, m.currentUser.roles);
380
- }
381
- return !0;
382
- }), u = (c, $) => {
383
- c.click($), a("actionClick", {
384
- action: c,
385
- subject: $
386
- }), l.value = !1;
387
- }, y = D(() => {
388
- if (!t.value)
389
- return {
390
- x: 0,
391
- y: 0
392
- };
393
- const c = t.value.getBoundingClientRect().top, $ = t.value.getBoundingClientRect().left, m = t.value.offsetHeight;
394
- return {
395
- _: l.value,
396
- x: Math.floor($) + "px",
397
- y: Math.floor(c + m) + "px"
398
- };
399
- });
400
- return (c, $) => {
401
- const m = te("overlay");
402
- return o(), i(Z, null, [
403
- Object.keys(c.$slots).some((n) => n !== "default") || c.actions !== void 0 && c.actions.length > 0 ? (o(), i("div", {
404
- key: 0,
405
- ref_key: "contextmenu",
406
- ref: t,
407
- class: "contextmenu"
408
- }, [
409
- C("a", {
410
- class: "contextmenu__trigger",
411
- onClick: $[0] || ($[0] = (n) => l.value = !0)
412
- }, [
413
- O(c.$slots, "default", {}, void 0, !0)
414
- ])
415
- ], 512)) : h("", !0),
416
- l.value ? (o(), k(Ke, {
417
- key: 1,
418
- to: "main"
419
- }, [
420
- P((o(), k(Ae, {
421
- modelValue: l.value,
422
- "onUpdate:modelValue": $[4] || ($[4] = (n) => l.value = n),
423
- fill: "",
424
- bordered: "",
425
- class: "content",
426
- style: { "--panel-min-width": "0" }
427
- }, {
428
- default: v(() => [
429
- C("div", _n, [
430
- c.$slots.header ? (o(), i("div", mn, [
431
- O(c.$slots, "header", {}, void 0, !0)
432
- ])) : h("", !0),
433
- Object.keys(c.$slots).filter((n) => !["default", "extra", "header"].includes(n)).length > 0 ? (o(), i("div", {
434
- key: 1,
435
- class: "content__section",
436
- onClick: $[1] || ($[1] = (n) => l.value = !1)
437
- }, [
438
- (o(!0), i(Z, null, U(Object.keys(c.$slots).filter((n) => !["default", "extra", "header"].includes(n)), (n, f) => (o(), k(fe, {
439
- key: `slot-${f}`,
440
- class: "content__item content__item--reactive"
441
- }, {
442
- default: v(() => [
443
- O(c.$slots, n, {}, void 0, !0)
444
- ]),
445
- _: 2
446
- }, 1024))), 128))
447
- ])) : h("", !0),
448
- c.actions !== void 0 && c.actions.length > 0 ? (o(), i("div", {
449
- key: 2,
450
- class: "content__section",
451
- onClick: $[2] || ($[2] = (n) => l.value = !1)
452
- }, [
453
- (o(!0), i(Z, null, U(s(c.actions), (n, f) => (o(), k(fe, {
454
- key: `action-${f}`,
455
- class: "content__item content__item--reactive",
456
- onClick: (b) => u(n, c.subject)
457
- }, {
458
- default: v(() => [
459
- n.icon ? (o(), k(N, {
460
- key: 0,
461
- icon: n.icon
462
- }, {
463
- default: v(() => [
464
- H(V(n.translate ? e(z)(n.label, { capitalize: !0 }) : n.label), 1)
465
- ]),
466
- _: 2
467
- }, 1032, ["icon"])) : h("", !0)
468
- ]),
469
- _: 2
470
- }, 1032, ["onClick"]))), 128))
471
- ])) : h("", !0),
472
- c.$slots.extra ? (o(), i("div", {
473
- key: 3,
474
- class: "content__section",
475
- onClick: $[3] || ($[3] = (n) => l.value = !1)
476
- }, [
477
- C("div", fn, [
478
- c.$slots.extra ? O(c.$slots, "extra", { key: 0 }, void 0, !0) : h("", !0)
479
- ])
480
- ])) : h("", !0)
481
- ])
482
- ]),
483
- _: 3
484
- }, 8, ["modelValue"])), [
485
- [
486
- m,
487
- {
488
- layer: c.overlayLayer,
489
- click: () => {
490
- l.value = !1;
491
- }
492
- },
493
- void 0,
494
- { invisibleOnLarge: !0 }
495
- ]
496
- ])
497
- ])) : h("", !0)
498
- ], 64);
499
- };
500
- }
501
- });
502
- const Ce = /* @__PURE__ */ G(vn, [["__scopeId", "data-v-35e35d32"]]), yn = { class: "info__content" }, hn = /* @__PURE__ */ q({
503
- __name: "aeria-info",
504
- props: {
505
- where: {}
506
- },
507
- setup(d) {
508
- const r = d, a = Re(), t = X(!1), l = r.where || "top";
509
- return (s, u) => e(a).md ? (o(), i("div", {
510
- key: 0,
511
- class: "info",
512
- onMouseleave: u[1] || (u[1] = (y) => t.value = !1)
513
- }, [
514
- t.value ? (o(), i("div", {
515
- key: 0,
516
- class: Q(`
517
- info__bubble
518
- info__bubble--${e(l)}
519
- `)
520
- }, [
521
- C("div", yn, [
522
- O(s.$slots, "text", {}, void 0, !0)
523
- ])
524
- ], 2)) : h("", !0),
525
- C("div", {
526
- onMouseover: u[0] || (u[0] = (y) => t.value = !0)
527
- }, [
528
- O(s.$slots, "default", {}, void 0, !0)
529
- ], 32)
530
- ], 32)) : O(s.$slots, "default", { key: 1 }, void 0, !0);
531
- }
532
- });
533
- const $n = /* @__PURE__ */ G(hn, [["__scopeId", "data-v-76defa0b"]]), bn = { class: "input" }, gn = {
534
- key: 0,
535
- class: "input__label"
536
- }, kn = {
537
- key: 1,
538
- class: "input__hint"
539
- }, Vn = ["placeholder", "readonly", "value"], Cn = ["value"], In = {
540
- key: 1,
541
- class: "input__clipboard"
542
- }, On = /* @__PURE__ */ q({
543
- __name: "aeria-input",
544
- props: {
545
- modelValue: {},
546
- property: {},
547
- propertyName: {},
548
- parentPropertyName: {},
549
- parentCollection: {},
550
- readOnly: { type: Boolean },
551
- variant: {}
552
- },
553
- emits: ["update:modelValue", "input", "change"],
554
- setup(d, { emit: r }) {
555
- var A;
556
- const a = d, t = a.property || {}, l = "icon" in t || "inputType" in t && t.inputType === "search", s = ve("searchOnly", !1), u = ve("innerInputLabel", !1), y = !s && (a.readOnly || t.readOnly), c = (M) => navigator.clipboard.writeText(M), $ = r, m = ve("inputVariant", a.variant) || "normal", n = {
557
- name: a.propertyName,
558
- readonly: y,
559
- type: (() => {
560
- if ("type" in t)
561
- switch (t.type) {
562
- case "number":
563
- case "integer":
564
- return "number";
565
- }
566
- if (t.inputType)
567
- return t.inputType;
568
- switch (typeof a.modelValue) {
569
- case "string":
570
- return "text";
571
- case "number":
572
- return "number";
573
- default:
574
- return "text";
575
- }
576
- })(),
577
- placeholder: u ? t.description || a.propertyName : t.placeholder
578
- };
579
- "type" in t && ((t.type === "number" || t.type === "integer") && (t.minimum && (n.min = t.minimum), t.exclusiveMinimum && (n.min = t.exclusiveMinimum + 1), t.maximum && (n.max = t.maximum), t.exclusiveMaximum && (n.max = t.exclusiveMaximum - 1)), t.type === "string" && ((t.format === "date" || t.format === "date-time") && (n.type = !s && t.format === "date-time" ? "datetime-local" : "date"), n.minlength = t.minLength, n.maxlength = t.maxLength)), n.type === "text" && s && (n.type = "search"), ft(() => {
580
- a.modelValue !== null && T(a.modelValue);
581
- });
582
- const f = () => {
583
- try {
584
- return a.modelValue ? new Date(a.modelValue).toISOString().split("T").shift() : "";
585
- } catch {
586
- return "";
587
- }
588
- }, b = X([
589
- "date",
590
- "date-time"
591
- ].includes(n.type) ? f() : a.modelValue === null || a.modelValue === void 0 ? "" : a.modelValue), g = ((A = a.property) == null ? void 0 : A.type) === "string" && a.property.mask ? Tt(a.property.mask) : null, w = (M) => {
592
- var W;
593
- return typeof b.value == "string" && ((W = a.property) == null ? void 0 : W.type) === "string" && g !== null ? (b.value = g.enmask(b.value, void 0, {
594
- defaultValue: !0
595
- }), a.property.maskedValue === !0 ? b.value : g.unmask(b.value)) : M;
596
- }, T = (M) => {
597
- const W = (() => {
598
- if (!M || typeof M != "string")
599
- return M;
600
- if (n.type === "number" || n.type === "integer")
601
- return Number(M);
602
- if (!("type" in t && t.type === "string"))
603
- return w(M);
604
- switch (t.format) {
605
- case "date":
606
- case "date-time":
607
- return new Date(M);
608
- default:
609
- return w(M);
610
- }
611
- })();
612
- $("input", W), $("update:modelValue", W);
613
- }, Y = (M) => {
614
- const W = M.target.value;
615
- b.value = W, T(W);
616
- };
617
- return re(() => a.modelValue, (M, W) => {
618
- M instanceof Date || (W && !M ? b.value = void 0 : b.value = g ? g.enmask(String(M), void 0, {
619
- defaultValue: !0
620
- }) : String(M));
621
- }), (M, W) => {
622
- const B = te("focus"), ee = te("clickable");
623
- return o(), i("label", bn, [
624
- e(u) ? h("", !0) : (o(), i("div", gn, [
625
- M.$slots.default ? O(M.$slots, "default", { key: 0 }, void 0, !0) : O(M.$slots, "description", { key: 1 }, void 0, !0)
626
- ])),
627
- M.$slots.hint ? (o(), i("div", kn, [
628
- O(M.$slots, "hint", {}, void 0, !0)
629
- ])) : h("", !0),
630
- "element" in e(t) && e(t).element === "textarea" ? (o(), i("div", {
631
- key: 2,
632
- class: Q(`
633
- input__container
634
- input__container--${e(m)}
635
- `)
636
- }, [
637
- P(C("textarea", {
638
- placeholder: n.placeholder,
639
- readonly: n.readonly,
640
- value: M.modelValue,
641
- class: Q(`
642
- input__textarea
643
- input__input--${e(m)}
644
- `),
645
- onInput: Y
646
- }, null, 42, Vn), [
647
- [B, e(t).focus]
648
- ])
649
- ], 2)) : (o(), i("div", {
650
- key: 3,
651
- class: Q(`
652
- input__container
653
- input__container--${e(m)}
654
- `)
655
- }, [
656
- P(C("input", E(n, {
657
- value: b.value,
658
- "data-component": "input",
659
- class: `
660
- input__input
661
- input__input--${e(m)}
662
- ${e(l) && "input__input--icon"}
663
- ${e(y) && "input__input--readOnly"}
664
- `,
665
- onInput: Y,
666
- onChange: W[0] || (W[0] = (I) => $("change", I))
667
- }), null, 16, Cn), [
668
- [B, e(t).focus]
669
- ]),
670
- e(l) ? (o(), k(N, {
671
- key: 0,
672
- icon: e(t).icon || "magnifying-glass",
673
- class: Q(`
674
- input__icon
675
- input__icon--${e(m)}
676
- `)
677
- }, null, 8, ["icon", "class"])) : h("", !0),
678
- e(y) ? (o(), i("div", In, [
679
- R($n, null, {
680
- text: v(() => [
681
- H("Copiar")
682
- ]),
683
- default: v(() => [
684
- P(R(N, {
685
- icon: "clipboard",
686
- onClick: W[1] || (W[1] = (I) => c(String(M.modelValue || "")))
687
- }, null, 512), [
688
- [ee]
689
- ])
690
- ]),
691
- _: 1
692
- })
693
- ])) : h("", !0)
694
- ], 2))
695
- ]);
696
- };
697
- }
698
- });
699
- const Ie = /* @__PURE__ */ G(On, [["__scopeId", "data-v-fa830575"]]), An = ["value"], Bn = {
700
- key: 1,
701
- value: ""
702
- }, wn = ["value", "data-selected"], Sn = /* @__PURE__ */ q({
703
- __name: "aeria-select",
704
- props: {
705
- modelValue: {},
706
- property: {},
707
- propertyName: {},
708
- parentPropertyName: {},
709
- parentCollection: {},
710
- readOnly: { type: Boolean },
711
- booleanRef: { type: Boolean },
712
- multiple: { type: [Boolean, Number] },
713
- noOutline: { type: Boolean }
714
- },
715
- emits: ["update:modelValue", "change"],
716
- setup(d, { emit: r }) {
717
- const a = d, t = r, l = X(null), s = a.property, u = (m) => {
718
- a.booleanRef && (y.value = m), t("update:modelValue", (m == null ? void 0 : m._id) || m), t("change", (m == null ? void 0 : m._id) || m);
719
- }, y = a.booleanRef ? (() => {
720
- const m = X(a.modelValue);
721
- return D({
722
- get: () => m.value === "true" ? !0 : m.value === "false" ? !1 : null,
723
- set: (f) => {
724
- m.value = f;
725
- }
726
- });
727
- })() : D({
728
- get: () => a.modelValue,
729
- set: u
730
- }), c = (m) => Array.isArray(a.modelValue) ? a.modelValue.includes(m) : a.modelValue === m, $ = D(() => a.multiple ? typeof a.multiple == "number" ? a.multiple : 5 : 1);
731
- return a.multiple && re(() => a.modelValue, (m) => {
732
- var f;
733
- if (!l.value)
734
- return;
735
- const n = l.value.querySelector('option[data-selected="true"]');
736
- n && n.removeAttribute("data-selected"), (f = l.value.querySelector(`option[value="${m}"]`)) == null || f.setAttribute("data-selected", "true");
737
- }), (m, n) => (o(), i("div", {
738
- class: Q({
739
- select: !0,
740
- "select--outline": !m.noOutline
741
- })
742
- }, [
743
- C("select", E({
744
- ref_key: "select",
745
- ref: l,
746
- value: e(y)
747
- }, {
748
- size: $.value
749
- }, {
750
- class: {
751
- select__select: !0,
752
- "select__select--multiple": !!a.multiple
753
- },
754
- onChange: n[0] || (n[0] = (f) => u(f.target.value))
755
- }), [
756
- e(s) && e(s).icon ? (o(), k(N, {
757
- key: 0,
758
- icon: e(s).icon
759
- }, null, 8, ["icon"])) : h("", !0),
760
- a.multiple ? h("", !0) : (o(), i("option", Bn, V(e(z)("none")), 1)),
761
- (o(!0), i(Z, null, U(e(s) && "enum" in e(s) ? e(s).enum : [], (f) => {
762
- var b;
763
- return o(), i("option", {
764
- key: f,
765
- value: f,
766
- "data-selected": c(f)
767
- }, V((b = e(s)) != null && b.translate ? e(z)(f) : f), 9, wn);
768
- }), 128)),
769
- O(m.$slots, "default", {}, void 0, !0)
770
- ], 16, An)
771
- ], 2));
772
- }
773
- });
774
- const He = /* @__PURE__ */ G(Sn, [["__scopeId", "data-v-614fff11"]]), jn = { class: "pagination" }, Tn = ["value"], Ln = { class: "pagination__control" }, Rn = { class: "pagination__page-input" }, zn = /* @__PURE__ */ q({
775
- __name: "aeria-pagination",
776
- props: {
777
- pagination: {}
778
- },
779
- emits: ["paginate"],
780
- setup(d, { emit: r }) {
781
- const a = d, t = r, l = D({
782
- get: () => Math.floor(a.pagination.offset / a.pagination.limit),
783
- set: ($) => {
784
- a.pagination.offset = $ * a.pagination.limit;
785
- }
786
- }), s = D({
787
- get: () => a.pagination.limit,
788
- set: ($) => {
789
- a.pagination.limit = Number($);
790
- }
791
- }), u = X(l.value ? l.value + 1 : 1), y = D(() => Math.ceil(a.pagination.recordsTotal / a.pagination.limit)), c = ($) => {
792
- l.value = $ === "previous" ? l.value - 1 : l.value + 1;
793
- };
794
- return re([
795
- l,
796
- s
797
- ], ([$]) => {
798
- u.value = $ + 1, t("paginate", {
799
- offset: l.value * s.value,
800
- limit: s.value
801
- });
802
- }), ($, m) => (o(), i("div", jn, [
803
- R(He, {
804
- modelValue: s.value,
805
- "onUpdate:modelValue": m[0] || (m[0] = (n) => s.value = n),
806
- property: {
807
- enum: [],
808
- icon: "list"
809
- },
810
- class: "pagination__control"
811
- }, {
812
- default: v(() => [
813
- (o(!0), i(Z, null, U(e(Lt), (n) => (o(), i("option", {
814
- key: `limit-${n}`,
815
- value: n
816
- }, V(n), 9, Tn))), 128))
817
- ]),
818
- _: 1
819
- }, 8, ["modelValue"]),
820
- C("div", Ln, [
821
- R(fe, {
822
- onClick: m[1] || (m[1] = (n) => l.value = 0)
823
- }, {
824
- default: v(() => [
825
- R(N, {
826
- reactive: "",
827
- icon: "caret-double-left"
828
- })
829
- ]),
830
- _: 1
831
- }),
832
- R(fe, {
833
- disabled: l.value === 0,
834
- onClick: m[2] || (m[2] = (n) => c("previous"))
835
- }, {
836
- default: v(() => [
837
- R(N, {
838
- reactive: "",
839
- icon: "caret-left"
840
- })
841
- ]),
842
- _: 1
843
- }, 8, ["disabled"]),
844
- C("div", Rn, [
845
- (o(), k(Ie, {
846
- key: l.value,
847
- modelValue: u.value,
848
- "onUpdate:modelValue": m[3] || (m[3] = (n) => u.value = n),
849
- property: {
850
- type: "number",
851
- minimum: 1
852
- },
853
- onChange: m[4] || (m[4] = (n) => {
854
- l.value = u.value === 0 ? 0 : u.value - 1;
855
- })
856
- }, null, 8, ["modelValue"])),
857
- C("span", null, V(e(z)("of")) + " " + V(y.value), 1)
858
- ]),
859
- R(fe, {
860
- disabled: l.value === y.value - 1,
861
- onClick: m[5] || (m[5] = (n) => c("next"))
862
- }, {
863
- default: v(() => [
864
- R(N, {
865
- reactive: "",
866
- icon: "caret-right"
867
- })
868
- ]),
869
- _: 1
870
- }, 8, ["disabled"]),
871
- R(fe, {
872
- onClick: m[6] || (m[6] = (n) => l.value = y.value - 1)
873
- }, {
874
- default: v(() => [
875
- R(N, {
876
- reactive: "",
877
- icon: "caret-double-right"
878
- })
879
- ]),
880
- _: 1
881
- })
882
- ])
883
- ]));
884
- }
885
- });
886
- const Mn = /* @__PURE__ */ G(zn, [["__scopeId", "data-v-41aa1ffc"]]), Fn = { class: "checkbox__text" }, qn = ["innerHTML"], Un = { class: "checkbox__hint" }, En = ["innerHTML"], Dn = {
887
- inheritAttrs: !1
888
- }, Hn = /* @__PURE__ */ q({
889
- ...Dn,
890
- __name: "aeria-checkbox",
891
- props: {
892
- modelValue: {},
893
- property: {},
894
- propertyName: {},
895
- parentPropertyName: {},
896
- parentCollection: {},
897
- readOnly: { type: Boolean },
898
- value: {},
899
- variant: {}
900
- },
901
- emits: ["update:modelValue", "change"],
902
- setup(d, { emit: r }) {
903
- const a = d, t = a.property, l = a.readOnly || (t == null ? void 0 : t.readOnly), s = (() => {
904
- if (t && "type" in t)
905
- switch (t.type) {
906
- case "array":
907
- case "boolean":
908
- return "checkbox";
909
- }
910
- return "radio";
911
- })(), u = r, y = a.value || !1, c = D({
912
- get: () => {
913
- var m;
914
- if (t) {
915
- if ("type" in t && t.type === "boolean")
916
- return !!a.value;
917
- if ("items" in t)
918
- return (m = a.modelValue) == null ? void 0 : m.includes(a.value);
919
- }
920
- return a.modelValue === a.value;
921
- },
922
- set: () => {
923
- var m;
924
- if (!l) {
925
- if (t) {
926
- if ("type" in t && t.type === "boolean") {
927
- u("update:modelValue", !a.modelValue);
928
- return;
929
- }
930
- if ("items" in t) {
931
- if ((m = a.modelValue) != null && m.includes(y)) {
932
- u("update:modelValue", a.modelValue.filter((n) => n !== y));
933
- return;
934
- }
935
- u("update:modelValue", [y].concat(a.modelValue || []));
936
- return;
937
- }
938
- }
939
- u("update:modelValue", a.value);
940
- }
941
- }
942
- }), $ = (m) => {
943
- l && m.preventDefault();
944
- };
945
- return (m, n) => {
946
- var b, g;
947
- const f = te("clickable");
948
- return P((o(), i("label", {
949
- class: Q(`
950
- checkbox
951
- ${e(l) && "checkbox--readOnly"}
952
- `)
953
- }, [
954
- P(C("input", E({
955
- "onUpdate:modelValue": n[0] || (n[0] = (w) => c.value = w)
956
- }, {
957
- type: e(s),
958
- readOnly: e(l),
959
- checked: c.value
960
- }, {
961
- class: "checkbox__input",
962
- onClick: $
963
- }), null, 16), [
964
- [Ct, c.value]
965
- ]),
966
- C("div", Fn, [
967
- C("div", null, [
968
- m.$slots.description ? O(m.$slots, "description", { key: 0 }, void 0, !0) : e(y) ? (o(), i("div", {
969
- key: 1,
970
- innerHTML: (b = e(t)) != null && b.translate ? e(z)(e(y)) : e(y)
971
- }, null, 8, qn)) : O(m.$slots, "default", { key: 2 }, void 0, !0)
972
- ]),
973
- C("div", Un, [
974
- m.$slots.hint ? O(m.$slots, "hint", { key: 0 }, void 0, !0) : (g = e(t)) != null && g.hint ? (o(), i("div", {
975
- key: 1,
976
- innerHTML: e(t).hint
977
- }, null, 8, En)) : h("", !0)
978
- ])
979
- ])
980
- ], 2)), [
981
- [f]
982
- ]);
983
- };
984
- }
985
- });
986
- const Qn = /* @__PURE__ */ G(Hn, [["__scopeId", "data-v-db5fafae"]]), Gn = {
987
- inheritAttrs: !1
988
- }, Wn = /* @__PURE__ */ q({
989
- ...Gn,
990
- __name: "aeria-options",
991
- props: {
992
- modelValue: {},
993
- propertyName: {},
994
- parentPropertyName: {},
995
- parentCollection: {},
996
- readOnly: { type: Boolean },
997
- property: {},
998
- columns: { default: 1 }
999
- },
1000
- emits: ["update:modelValue"],
1001
- setup(d, { emit: r }) {
1002
- const a = d, t = r, l = a.readOnly || a.property.readOnly, s = "items" in a.property ? a.property.items.enum : a.property.enum, u = (y) => {
1003
- t("update:modelValue", y);
1004
- };
1005
- return vt(() => {
1006
- a.modelValue || t(
1007
- "update:modelValue",
1008
- "items" in a.property ? [] : ""
1009
- );
1010
- }), (y, c) => (o(), i("div", {
1011
- class: "options",
1012
- style: $e(`
1013
- --columns: ${y.columns};
1014
- grid-template-columns: repeat(var(--columns), 1fr);
1015
- `)
1016
- }, [
1017
- (o(!0), i(Z, null, U(e(s), ($) => (o(), i("div", {
1018
- key: `option-${$}`,
1019
- class: "options__checkbox"
1020
- }, [
1021
- R(Qn, E({ ref_for: !0 }, {
1022
- value: $,
1023
- readOnly: e(l),
1024
- property: y.property
1025
- }, {
1026
- "model-value": y.modelValue,
1027
- "onUpdate:modelValue": u
1028
- }), null, 16, ["model-value"])
1029
- ]))), 128))
1030
- ], 4));
1031
- }
1032
- });
1033
- const Kn = /* @__PURE__ */ G(Wn, [["__scopeId", "data-v-39b61318"]]), Xn = (d) => (Ue("data-v-220b2101"), d = d(), Ee(), d), Yn = { class: "switch-wrapper" }, Jn = /* @__PURE__ */ Xn(() => /* @__PURE__ */ C("div", { class: "switch__slider" }, null, -1)), Zn = { key: 1 }, Pn = {
1034
- inheritAttrs: !1
1035
- }, Nn = /* @__PURE__ */ q({
1036
- ...Pn,
1037
- __name: "aeria-switch",
1038
- props: {
1039
- modelValue: {},
1040
- property: {},
1041
- propertyName: {},
1042
- parentPropertyName: {},
1043
- parentCollection: {},
1044
- readOnly: { type: Boolean }
1045
- },
1046
- emits: ["update:modelValue", "change"],
1047
- setup(d, { emit: r }) {
1048
- const a = d, t = r, l = a.property, s = a.readOnly || (l == null ? void 0 : l.readOnly), u = () => {
1049
- s || (t("change", !a.modelValue), t("update:modelValue", !a.modelValue));
1050
- };
1051
- return (y, c) => {
1052
- var m;
1053
- const $ = te("clickable");
1054
- return o(), i("div", Yn, [
1055
- P((o(), i("a", {
1056
- class: Q(`
1057
- switch
1058
- ${y.modelValue && "switch--active"}
1059
- ${e(s) && "switch--readOnly"}
1060
- `),
1061
- onClick: Fe(u, ["stop"])
1062
- }, [
1063
- Jn,
1064
- C("div", {
1065
- class: Q(`
1066
- switch__dummy
1067
- ${!y.modelValue && "switch__dummy--flex"}
1068
- `)
1069
- }, null, 2)
1070
- ], 2)), [
1071
- [$, {
1072
- blocked: e(s)
1073
- }]
1074
- ]),
1075
- y.$slots.default ? O(y.$slots, "default", { key: 0 }, void 0, !0) : (o(), i("div", Zn, V(((m = e(l)) == null ? void 0 : m.description) || y.propertyName), 1))
1076
- ]);
1077
- };
1078
- }
1079
- });
1080
- const xn = /* @__PURE__ */ G(Nn, [["__scopeId", "data-v-220b2101"]]), gt = (d) => (Ue("data-v-153a2e0f"), d = d(), Ee(), d), eo = { class: "picture" }, to = {
1081
- key: 0,
1082
- style: { position: "fixed", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }
1083
- }, no = ["src", "alt"], oo = {
1084
- key: 0,
1085
- class: "picture__meta"
1086
- }, ao = ["src"], lo = /* @__PURE__ */ gt(() => /* @__PURE__ */ C("line", {
1087
- x1: "0",
1088
- y1: "0",
1089
- x2: "200",
1090
- y2: "200",
1091
- stroke: "#000",
1092
- "vector-effect": "non-scaling-stroke"
1093
- }, null, -1)), so = /* @__PURE__ */ gt(() => /* @__PURE__ */ C("line", {
1094
- x1: "200",
1095
- y1: "0",
1096
- x2: "0",
1097
- y2: "200",
1098
- stroke: "#000",
1099
- "vector-effect": "non-scaling-stroke"
1100
- }, null, -1)), io = [
1101
- lo,
1102
- so
1103
- ], ro = { key: 5 }, uo = /* @__PURE__ */ q({
1104
- __name: "aeria-picture",
1105
- props: {
1106
- url: {},
1107
- alt: {},
1108
- fileId: {},
1109
- modelValue: {},
1110
- objectFit: {},
1111
- bordered: { type: Boolean },
1112
- width: {},
1113
- height: {},
1114
- expandable: { type: Boolean },
1115
- meta: {}
1116
- },
1117
- setup(d) {
1118
- const r = d, a = D(() => r.fileId ? `${yt}/file/${r.fileId}/picture` : r.url || r.modelValue), t = X(!1);
1119
- return (l, s) => {
1120
- var y;
1121
- const u = te("overlay");
1122
- return o(), i("figure", eo, [
1123
- a.value ? (o(), k(Ke, {
1124
- key: 0,
1125
- to: "main"
1126
- }, [
1127
- t.value ? P((o(), i("div", to, [
1128
- C("img", {
1129
- src: a.value,
1130
- alt: l.alt,
1131
- style: `
1132
- max-height: 60vh;
1133
- object-fit: contain;
1134
- `,
1135
- onClick: s[0] || (s[0] = (c) => t.value = !0)
1136
- }, null, 8, no),
1137
- (y = l.meta) != null && y.owner ? (o(), i("div", oo, " Criado por " + V(l.meta.owner.name) + " em " + V(l.formatDateTime(l.meta.created_at, { hours: !0 })), 1)) : h("", !0)
1138
- ])), [
1139
- [u, {
1140
- click: () => {
1141
- t.value = !1;
1142
- }
1143
- }]
1144
- ]) : h("", !0)
1145
- ])) : h("", !0),
1146
- a.value ? (o(), i("img", {
1147
- key: 1,
1148
- src: a.value,
1149
- class: Q(`
1150
- picture__image
1151
- ${l.bordered && "picture__image--bordered"}
1152
- ${l.expandable && "picture__image--expandable"}
1153
- `),
1154
- style: $e(`
1155
- object-fit: ${l.objectFit || "cover"};
1156
- width: ${l.width || "100%"};
1157
- height: ${l.height || "100%"};
1158
- `),
1159
- onClick: s[1] || (s[1] = () => {
1160
- l.expandable && (t.value = !0);
1161
- })
1162
- }, null, 14, ao)) : l.$slots.fallback ? O(l.$slots, "fallback", { key: 2 }, void 0, !0) : l.$slots.default ? O(l.$slots, "default", { key: 3 }, void 0, !0) : (o(), i("svg", {
1163
- key: 4,
1164
- class: Q(["picture__background", `
1165
- ${l.bordered && "picture__image--bordered"}
1166
- `]),
1167
- xmlns: "http://www.w3.org/2000/svg",
1168
- viewBox: "0 0 200 200",
1169
- preserveAspectRatio: "none",
1170
- style: $e(`
1171
- object-fit: ${l.objectFit || "cover"};
1172
- width: ${l.width || "100%"};
1173
- height: ${l.height || "100%"};
1174
- `)
1175
- }, io, 6)),
1176
- l.$slots.caption ? (o(), i("figcaption", ro, [
1177
- O(l.$slots, "caption", {}, void 0, !0)
1178
- ])) : h("", !0)
1179
- ]);
1180
- };
1181
- }
1182
- });
1183
- const qe = /* @__PURE__ */ G(uo, [["__scopeId", "data-v-153a2e0f"]]), co = { class: "file" }, po = { key: 0 }, _o = ["href"], mo = {
1184
- key: 1,
1185
- class: "file__actions"
1186
- }, fo = ["accept"], vo = {
1187
- key: 0,
1188
- class: "file__buttons"
1189
- }, yo = {
1190
- key: 1,
1191
- class: "file__buttons"
1192
- }, ho = /* @__PURE__ */ q({
1193
- __name: "aeria-file",
1194
- props: {
1195
- modelValue: {},
1196
- property: {},
1197
- propertyName: {},
1198
- parentPropertyName: {},
1199
- parentCollection: {},
1200
- readOnly: { type: Boolean },
1201
- meta: {},
1202
- content: {}
1203
- },
1204
- emits: ["update:content", "change", "update:modelValue"],
1205
- setup(d, { emit: r }) {
1206
- var b;
1207
- const a = d, t = r, s = ze() ? ge() : null, u = X(((b = a.modelValue) == null ? void 0 : b.file) || null), y = D(() => {
1208
- var g;
1209
- return u.value ? URL.createObjectURL(u.value) : (g = a.modelValue) == null ? void 0 : g.link;
1210
- }), c = D(() => {
1211
- var g, w, T;
1212
- return /^image\//.test((g = a.modelValue) == null ? void 0 : g.type) && !((w = u.value) != null && w.type) || /^image\//.test((T = u.value) == null ? void 0 : T.type);
1213
- }), $ = (g) => new Promise((w) => {
1214
- const T = new FileReader();
1215
- T.onload = () => w(T.result), T.readAsArrayBuffer(g);
1216
- }), m = () => {
1217
- a.modelValue.tempId && t("update:modelValue", null), u.value = null;
1218
- }, n = async (g) => {
1219
- u.value = g.target.files[0];
1220
- const w = u.value, T = await $(w);
1221
- if (s) {
1222
- const { data: { error: Y, result: A } } = await Rt(`${yt}/${s.$id}/upload?name=${w.name}`, T, {
1223
- params: {
1224
- method: "POST",
1225
- headers: {
1226
- "content-type": w.type || "application/octet-stream",
1227
- "x-stream-request": "1"
1228
- }
1229
- }
1230
- });
1231
- if (Y)
1232
- return;
1233
- t("update:modelValue", {
1234
- tempId: A.tempId,
1235
- file: w
1236
- });
1237
- } else
1238
- t("update:modelValue", w);
1239
- t("update:content", T), t("change", T);
1240
- }, f = async () => {
1241
- t("update:modelValue", null);
1242
- };
1243
- return (g, w) => {
1244
- var T, Y, A, M, W, B;
1245
- return o(), i("div", co, [
1246
- u.value || (T = g.modelValue) != null && T._id ? (o(), i("div", po, [
1247
- c.value ? (o(), k(qe, {
1248
- key: 0,
1249
- modelValue: y.value,
1250
- "onUpdate:modelValue": w[0] || (w[0] = (ee) => y.value = ee),
1251
- alt: "Image preview",
1252
- expandable: g.readOnly,
1253
- class: Q(`
1254
- file__image
1255
- ${!e(s) || ((Y = g.modelValue) == null ? void 0 : Y._id) || "file__image--unsent"}
1256
- `)
1257
- }, null, 8, ["modelValue", "expandable", "class"])) : h("", !0),
1258
- (A = g.modelValue) != null && A._id ? (o(), i("a", {
1259
- key: 1,
1260
- href: g.modelValue.download_link
1261
- }, V(g.modelValue.filename), 9, _o)) : h("", !0)
1262
- ])) : h("", !0),
1263
- g.readOnly ? h("", !0) : (o(), i("div", mo, [
1264
- C("input", {
1265
- ref: "file",
1266
- type: "file",
1267
- accept: (W = (M = g.property) == null ? void 0 : M.accept) == null ? void 0 : W.join(","),
1268
- onChange: n
1269
- }, null, 40, fo),
1270
- u.value ? (o(), i("div", vo, [
1271
- R(ie, {
1272
- small: "",
1273
- onClick: Fe(m, ["prevent"])
1274
- }, {
1275
- default: v(() => [
1276
- H(V(e(z)("action.clear", { capitalize: !0 })), 1)
1277
- ]),
1278
- _: 1
1279
- })
1280
- ])) : (B = g.modelValue) != null && B._id ? (o(), i("div", yo, [
1281
- R(ie, {
1282
- small: "",
1283
- onClick: Fe(f, ["prevent"])
1284
- }, {
1285
- default: v(() => [
1286
- H(V(e(z)("action.remove", { capitalize: !0 })), 1)
1287
- ]),
1288
- _: 1
1289
- })
1290
- ])) : h("", !0)
1291
- ]))
1292
- ]);
1293
- };
1294
- }
1295
- });
1296
- const $o = /* @__PURE__ */ G(ho, [["__scopeId", "data-v-aeeec9a8"]]), bo = { class: "container" }, go = {
1297
- key: 1,
1298
- class: "container__footer"
1299
- }, ko = /* @__PURE__ */ q({
1300
- __name: "aeria-search-container",
1301
- props: {
1302
- observeScroll: { type: Boolean }
1303
- },
1304
- emits: ["endReached"],
1305
- setup(d, { emit: r }) {
1306
- const a = d, t = r, l = X(null), s = a.observeScroll ? Xe(l, {
1307
- antecipate: 100
1308
- }).reachedEnd : null;
1309
- return s !== null && re(s, (u) => {
1310
- u && t("endReached", u);
1311
- }), (u, y) => (o(), i("div", bo, [
1312
- u.$slots.default ? (o(), i("div", {
1313
- key: 0,
1314
- ref_key: "containerEl",
1315
- ref: l,
1316
- class: "container__content"
1317
- }, [
1318
- O(u.$slots, "default", {}, void 0, !0)
1319
- ], 512)) : h("", !0),
1320
- u.$slots.footer ? (o(), i("div", go, [
1321
- O(u.$slots, "footer", {}, void 0, !0)
1322
- ])) : h("", !0)
1323
- ]));
1324
- }
1325
- });
1326
- const ct = /* @__PURE__ */ G(ko, [["__scopeId", "data-v-c86e2d2a"]]), Vo = { class: "item__values" }, Co = /* @__PURE__ */ q({
1327
- __name: "aeria-search-item",
1328
- props: {
1329
- item: {},
1330
- indexes: {},
1331
- modelValue: {},
1332
- property: {},
1333
- readOnly: { type: Boolean }
1334
- },
1335
- emits: ["update:modelValue", "change"],
1336
- setup(d, { emit: r }) {
1337
- const a = Oe(), t = d, l = r, s = t.property, u = pe(s), y = ge(), c = D(() => Array.isArray(t.modelValue) ? Array.isArray(t.modelValue) && Object.values(t.modelValue).some(({ _id: f }) => t.item._id === f) : t.modelValue && t.modelValue._id === t.item._id), $ = () => {
1338
- if (c.value)
1339
- return;
1340
- const f = (g) => g.filter((w) => !!(w != null && w._id)), b = "items" in s ? f(Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue]) : t.modelValue;
1341
- l("update:modelValue", Array.isArray(b) ? [
1342
- ...b,
1343
- t.item
1344
- ] : t.item), l("change", t.item);
1345
- }, m = async (f) => {
1346
- if (u.purge && (f != null && f.purge)) {
1347
- const { _id: g } = t.item;
1348
- await y.$actions.remove({
1349
- filters: {
1350
- _id: g
1351
- }
1352
- });
1353
- }
1354
- const b = () => {
1355
- const g = [...t.modelValue], w = g.findIndex((T) => T._id === t.item._id);
1356
- return g.splice(w, 1), g;
1357
- };
1358
- l("update:modelValue", "items" in s ? b() : null);
1359
- }, n = () => {
1360
- if (t.readOnly) {
1361
- a.push({
1362
- name: "/dashboard/crud/:id",
1363
- params: {
1364
- collection: u.$ref,
1365
- id: t.item._id
1366
- }
1367
- });
1368
- return;
1369
- }
1370
- return c.value ? m() : $();
1371
- };
1372
- return (f, b) => {
1373
- const g = te("clickable");
1374
- return P((o(), i("div", {
1375
- class: Q({
1376
- item: !0,
1377
- "item--selected": c.value
1378
- }),
1379
- onClick: n
1380
- }, [
1381
- O(f.$slots, "default", {}, void 0, !0),
1382
- C("div", Vo, [
1383
- (o(!0), i(Z, null, U(f.indexes, (w, T) => (o(), i("div", {
1384
- key: `index-${f.item._id}-${T}`,
1385
- class: "item__value"
1386
- }, V(f.item[w]), 1))), 128))
1387
- ])
1388
- ], 2)), [
1389
- [g]
1390
- ]);
1391
- };
1392
- }
1393
- });
1394
- const Ge = /* @__PURE__ */ G(Co, [["__scopeId", "data-v-e14c02a3"]]), Io = { class: "search__panel" }, Oo = { class: "search__input" }, Ao = ["value"], Bo = { style: { flex: "1" } }, wo = { key: 1 }, So = { key: 0 }, jo = { key: 1 }, To = { class: "search__summary" }, Lo = {
1395
- key: 1,
1396
- class: "search"
1397
- }, Ro = { key: 0 }, Me = 10, zo = /* @__PURE__ */ q({
1398
- __name: "aeria-search",
1399
- props: {
1400
- modelValue: {},
1401
- parentPropertyName: {},
1402
- parentCollection: {},
1403
- readOnly: { type: Boolean },
1404
- property: {},
1405
- propertyName: {},
1406
- selectOnly: { type: Boolean },
1407
- panel: { default: void 0 }
1408
- },
1409
- emits: ["update:modelValue", "change", "update:panel"],
1410
- setup(d, { emit: r }) {
1411
- const a = d, t = pe(a.property), l = a.panel !== void 0 ? D(() => a.panel) : X(!1), s = r, u = se(pe(a.property).$ref), y = ze(), c = y ? ge() : null, $ = t.indexes;
1412
- ye(De, pe(a.property).$ref), ye("innerInputLabel", !0), ye("omitInputLabels", !0);
1413
- const m = X(a.modelValue), n = X({
1414
- data: [],
1415
- pagination: {}
1416
- }), f = D(() => n.value.data), b = D(() => n.value.pagination), g = X(0), w = X($[0]), T = X(!1), Y = X({}), A = () => {
1417
- const L = {};
1418
- if (y) {
1419
- const p = e(y);
1420
- L[p] = c;
1421
- }
1422
- return t.constraints ? Dt(t.constraints, L) : {};
1423
- }, M = () => {
1424
- f.value.length < b.value.recordsTotal && (g.value += 1, B());
1425
- }, W = async () => {
1426
- if (Object.values(Y.value).every((p) => !(String(p).length > 0)))
1427
- return u.$actions.custom("getAll", {
1428
- limit: Me,
1429
- offset: g.value * Me,
1430
- filters: A()
1431
- });
1432
- const L = $.filter((p) => {
1433
- var F;
1434
- return ((F = Y.value[p]) == null ? void 0 : F.length) > 0;
1435
- }).map((p) => ({
1436
- [p]: {
1437
- $regex: Y.value[p].trim().replace("(", "\\(").replace(")", "\\)"),
1438
- $options: "i"
1439
- }
1440
- }));
1441
- return u.$actions.custom("getAll", {
1442
- limit: Me,
1443
- offset: g.value * Me,
1444
- filters: {
1445
- ...A(),
1446
- ...L.length > 0 && {
1447
- $or: L
1448
- }
1449
- }
1450
- });
1451
- }, B = async () => {
1452
- if (u.loading.getAll)
1453
- return;
1454
- const { error: L, result: p } = await W();
1455
- if (L) {
1456
- se("meta").$actions.spawnToast({
1457
- text: "Request failed",
1458
- icon: "warning"
1459
- });
1460
- return;
1461
- }
1462
- n.value.pagination = p.pagination, g.value === 0 && n.value.data.splice(0), n.value.data.push(...p.data);
1463
- }, [ee] = ht({
1464
- delay: 800
1465
- })(() => {
1466
- g.value = 0, B(), T.value = !1;
1467
- }), I = () => {
1468
- T.value = !0, ee();
1469
- }, S = () => {
1470
- "effect" in l ? s("update:panel", !0) : l.value = !0, B();
1471
- }, ne = () => {
1472
- g.value = 0, n.value.data.splice(0), "effect" in l ? s("update:panel", !1) : l.value = !1;
1473
- }, oe = D(() => !Object.values(Y.value).some((L) => !!L));
1474
- re(oe, (L, p) => {
1475
- L && !p && B();
1476
- }), ft(() => {
1477
- a.selectOnly && B();
1478
- });
1479
- const le = (L) => {
1480
- m.value = L, a.selectOnly || s("update:modelValue", L);
1481
- }, ae = () => {
1482
- ne(), s("update:modelValue", m.value);
1483
- };
1484
- return (L, p) => {
1485
- const F = te("clickable");
1486
- return o(), i("div", null, [
1487
- e(l) ? (o(), k(Ke, {
1488
- key: 0,
1489
- to: "main"
1490
- }, [
1491
- R(Ae, {
1492
- float: "",
1493
- "close-hint": "",
1494
- title: `${e(z)("action.select", { capitalize: !0 })} ${e(z)(L.propertyName)}`,
1495
- "overlay-layer": 65,
1496
- "model-value": e(l),
1497
- style: { "--panel-max-width": "36rem" },
1498
- onClose: ne,
1499
- onOverlayClick: ne
1500
- }, {
1501
- footer: v(() => [
1502
- R(ie, {
1503
- large: "",
1504
- onClick: ae
1505
- }, {
1506
- default: v(() => [
1507
- H(V(e(z)("action.save", { capitalize: !0 })), 1)
1508
- ]),
1509
- _: 1
1510
- })
1511
- ]),
1512
- default: v(() => {
1513
- var K, J;
1514
- return [
1515
- C("div", Io, [
1516
- C("div", Oo, [
1517
- e($).length > 1 ? (o(), k(He, {
1518
- key: 0,
1519
- modelValue: w.value,
1520
- "onUpdate:modelValue": p[0] || (p[0] = (_) => w.value = _),
1521
- onChange: p[1] || (p[1] = (_) => Y.value = {})
1522
- }, {
1523
- default: v(() => [
1524
- (o(!0), i(Z, null, U(e($), (_) => (o(), i("option", {
1525
- key: `searchfield-${_}`,
1526
- value: _
1527
- }, V(e(z)(_)), 9, Ao))), 128))
1528
- ]),
1529
- _: 1
1530
- }, 8, ["modelValue"])) : h("", !0),
1531
- C("div", Bo, [
1532
- (o(), k(Ie, {
1533
- key: `field-${w.value}`,
1534
- modelValue: Y.value[w.value],
1535
- "onUpdate:modelValue": p[2] || (p[2] = (_) => Y.value[w.value] = _),
1536
- property: {
1537
- ...e(u).properties[w.value],
1538
- inputType: "search"
1539
- },
1540
- onInput: I
1541
- }, null, 8, ["modelValue", "property"]))
1542
- ])
1543
- ]),
1544
- f.value.length ? (o(), k(ct, {
1545
- key: 0,
1546
- "observe-scroll": "",
1547
- onEndReached: M
1548
- }, {
1549
- default: v(() => [
1550
- (o(!0), i(Z, null, U(f.value, (_) => (o(), k(Ge, E({ ref_for: !0 }, {
1551
- item: _,
1552
- indexes: e($),
1553
- property: L.property
1554
- }, {
1555
- key: `matching-${_._id}`,
1556
- modelValue: m.value,
1557
- "onUpdate:modelValue": p[3] || (p[3] = (j) => m.value = j)
1558
- }), null, 16, ["modelValue"]))), 128))
1559
- ]),
1560
- _: 1
1561
- })) : (o(), i("div", wo, [
1562
- T.value ? (o(), i("div", So, V(e(z)("searching", { capitalize: !0 })) + "... ", 1)) : !e(u).loading.getAll && Object.values(Y.value).filter((_) => !!_).length > 0 && !("items" in L.property && ((K = L.modelValue) != null && K.length) || !Array.isArray(L.modelValue) && ((J = L.modelValue) != null && J._id)) ? (o(), i("div", jo, V(e(z)("no_results", { capitalize: !0 })), 1)) : h("", !0)
1563
- ]))
1564
- ]),
1565
- C("div", To, V(e(z)("showing", { capitalize: !0 })) + " " + V(f.value.length) + " " + V(e(z)("of")) + " " + V(b.value.recordsTotal), 1)
1566
- ];
1567
- }),
1568
- _: 1
1569
- }, 8, ["title", "model-value"])
1570
- ])) : h("", !0),
1571
- L.selectOnly ? h("", !0) : (o(), i("div", Lo, [
1572
- R(ct, null, ue({
1573
- default: v(() => {
1574
- var K;
1575
- return [
1576
- "items" in L.property ? (o(), i("div", Ro, [
1577
- (o(!0), i(Z, null, U(L.modelValue, (J) => (o(), k(Ge, E({ ref_for: !0 }, {
1578
- item: J,
1579
- indexes: e($),
1580
- property: L.property,
1581
- readOnly: L.readOnly,
1582
- modelValue: L.modelValue
1583
- }, {
1584
- key: `selected-${J._id}`,
1585
- "onUpdate:modelValue": le
1586
- }), null, 16))), 128))
1587
- ])) : (K = L.modelValue) != null && K._id ? (o(), k(Ge, E({ key: 1 }, {
1588
- item: L.modelValue,
1589
- indexes: e($),
1590
- property: e(t),
1591
- modelValue: L.modelValue
1592
- }, { "onUpdate:modelValue": le }), null, 16)) : h("", !0)
1593
- ];
1594
- }),
1595
- _: 2
1596
- }, [
1597
- L.readOnly ? void 0 : {
1598
- name: "footer",
1599
- fn: v(() => [
1600
- P((o(), k(N, {
1601
- icon: "plus",
1602
- onClick: S
1603
- }, {
1604
- default: v(() => [
1605
- H(V(e(z)("action.select", { capitalize: !0 })), 1)
1606
- ]),
1607
- _: 1
1608
- })), [
1609
- [F]
1610
- ])
1611
- ]),
1612
- key: "0"
1613
- }
1614
- ]), 1024)
1615
- ]))
1616
- ]);
1617
- };
1618
- }
1619
- });
1620
- const Mo = /* @__PURE__ */ G(zo, [["__scopeId", "data-v-5fd0bcfa"]]), dt = (d, r) => {
1621
- const a = "items" in d ? d.items : d, t = {
1622
- options: Kn,
1623
- select: He,
1624
- switch: xn,
1625
- file: $o,
1626
- search: Mo,
1627
- input: Ie,
1628
- form: Qe
1629
- }, l = (() => {
1630
- if ("type" in a) {
1631
- if (a.type === "object")
1632
- return "form";
1633
- if (a.type === "boolean")
1634
- return "switch";
1635
- }
1636
- if ("element" in d) {
1637
- if (d.element === "checkbox" || d.element === "radio")
1638
- return "options";
1639
- if (d.element === "select")
1640
- return "select";
1641
- }
1642
- const s = pe(d);
1643
- return s ? s.inline ? "form" : s.$ref === "file" ? "file" : "search" : "items" in d && d.uniqueItems ? "options" : "enum" in a ? "select" : "input";
1644
- })();
1645
- return r[l] ? r[l] : t[l];
1646
- }, Fo = (d, r, a) => {
1647
- d ?? (d = []);
1648
- const t = "items" in r ? r.items : r;
1649
- if ("$ref" in t) {
1650
- const l = se(t.$ref, a), s = Le(l.$freshItem);
1651
- return d.push(s);
1652
- }
1653
- return "properties" in t ? d.push(Ht(t)) : "type" in t && t.type === "boolean" ? d.push({}) : d.push(null);
1654
- }, qo = (d, r) => {
1655
- d.splice(r, 1);
1656
- }, Uo = {
1657
- key: 0,
1658
- class: "form__header"
1659
- }, Eo = { class: "form__fieldset" }, Do = { key: 0 }, Ho = ["innerHTML"], Qo = ["onInput"], Go = { key: 4 }, Wo = { value: "true" }, Ko = { value: "false" }, Xo = {
1660
- key: 5,
1661
- style: { display: "grid", "row-gap": ".4rem" }
1662
- }, Yo = { class: "form__array" }, Jo = { style: { "flex-grow": "1" } }, Zo = {
1663
- key: 7,
1664
- class: "form__validation-error"
1665
- }, Po = { key: 0 }, No = { key: 1 }, xo = {
1666
- key: 2,
1667
- class: "form__footer"
1668
- }, ea = /* @__PURE__ */ q({
1669
- __name: "aeria-form",
1670
- props: {
1671
- modelValue: {},
1672
- property: {},
1673
- propertyName: {},
1674
- parentPropertyName: {},
1675
- parentCollection: {},
1676
- readOnly: { type: Boolean },
1677
- form: {},
1678
- collection: {},
1679
- searchOnly: { type: Boolean },
1680
- layout: {},
1681
- formLayout: {},
1682
- required: {},
1683
- formComponents: {},
1684
- propertyComponents: {},
1685
- omitFormHeader: { type: Boolean },
1686
- omitInputLabels: { type: Boolean },
1687
- innerInputLabel: { type: Boolean },
1688
- validationErrors: { default: null },
1689
- highlightRequired: { type: Boolean, default: !0 },
1690
- focus: { type: Boolean }
1691
- },
1692
- emits: ["update:modelValue", "input", "change"],
1693
- setup(d, { emit: r }) {
1694
- var L;
1695
- const a = bt(), t = d, l = r;
1696
- vt(() => {
1697
- t.modelValue || l("update:modelValue", t.property && "items" in t.property ? [] : {});
1698
- });
1699
- const s = t.property && pe(t.property), u = s ? s.$ref : t.collection || ze(), y = t.readOnly || ((L = t.property) == null ? void 0 : L.readOnly), c = u ? se(e(u)) : null;
1700
- !u && process.env.NODE_ENV !== "production" && console.warn(`aeria-form was used without providing storeId or specifying
1701
- collection prop, some features may not work as intended`);
1702
- const $ = X(!1), m = D(() => !t.form && t.property ? "properties" in t.property ? t.property.properties : c == null ? void 0 : c.properties : t.form), n = D(() => t.layout || (c == null ? void 0 : c.description.formLayout)), f = (p) => {
1703
- const F = ve(p, t[p]);
1704
- return t[p] && ye(p, t[p]), F;
1705
- }, b = D(() => t.validationErrors !== null ? t.validationErrors : c == null ? void 0 : c.validationErrors), g = f("formComponents") || {}, w = f("propertyComponents") || {}, T = f("omitFormHeader"), Y = f("omitInputLabels"), A = f("innerInputLabel");
1706
- u && ye(De, u), ye("searchOnly", t.searchOnly);
1707
- const M = (p) => m.value ? Object.entries(m.value).filter(([F, K]) => !K.noForm && p([
1708
- F,
1709
- K
1710
- ])) : null, W = (p) => {
1711
- var K;
1712
- if (t.searchOnly || !u)
1713
- return !0;
1714
- const F = t.property && "properties" in t.property ? t.property.form : (K = c == null ? void 0 : c.description) == null ? void 0 : K.form;
1715
- return !F || F.includes(p);
1716
- }, B = M(([p]) => W(p)), ee = Re(), I = {}, S = (p, F) => {
1717
- var j, _e, me, Be;
1718
- const K = [], J = ((_e = (j = n.value) == null ? void 0 : j.fields) == null ? void 0 : _e[p]) || ((Be = (me = n.value) == null ? void 0 : me.fields) == null ? void 0 : Be.$default);
1719
- if (!F)
1720
- return;
1721
- if (J != null && J.if && !t.searchOnly) {
1722
- const we = We(
1723
- t.modelValue,
1724
- J.if
1725
- );
1726
- we.satisfied || (I[p] && (c ? t.modelValue[p] = typeof c.$freshItem[p] == "object" ? Le(c.$freshItem[p]) : c.$freshItem[p] : t.modelValue[p] = [
1727
- void 0,
1728
- null
1729
- ].includes(t.modelValue[p]) ? null : t.modelValue[p].constructor()), K.push("display: none;")), I[p] = we.satisfied;
1730
- }
1731
- const _ = ee.value.md && (J == null ? void 0 : J.span) || 6;
1732
- return K.push(`
1733
- --field-span: ${_};
1734
- grid-column: span var(--field-span) / span var(--field-span);
1735
- `), J && (J.verticalSpacing && K.push(`
1736
- --vertical-spacing: ${J.verticalSpacing};
1737
- padding: var(--vertical-spacing) 0;
1738
- `), J.separator && K.push(`
1739
- border-top: 1px solid var(--theme-border-color);
1740
- border-width: 1px 0 1px 0;
1741
- padding: 1rem 0;
1742
- margin: 1rem 0;
1743
- `)), K.join("");
1744
- }, ne = (p) => p === null || p instanceof Object && !Object.keys(p).length, oe = D(() => t.required ? t.required : t.property && "required" in t.property ? t.property.required : c == null ? void 0 : c.description.required), le = D(() => t.form ? zt(
1745
- t.modelValue,
1746
- t.form,
1747
- oe.value,
1748
- c == null ? void 0 : c.description
1749
- ) : !0), ae = (p, F) => {
1750
- var K;
1751
- return (K = b.value) != null && K[p] && (typeof b.value[p].index != "number" || b.value[p].index === F) ? b.value[p].errors : null;
1752
- };
1753
- return (p, F) => {
1754
- const K = te("clickable"), J = te("focus");
1755
- return o(), i("form", {
1756
- class: "form",
1757
- style: $e(`row-gap: ${e(T) ? ".8rem" : "var(--form-internal-gap, 1.6rem);"};`)
1758
- }, [
1759
- p.$slots.header && !e(T) ? (o(), i("header", Uo, [
1760
- O(p.$slots, "header", {}, void 0, !0)
1761
- ])) : h("", !0),
1762
- O(p.$slots, "default", {}, void 0, !0),
1763
- C("fieldset", Eo, [
1764
- (o(!0), i(Z, null, U(e(B), ([_, j]) => {
1765
- var _e, me, Be, we, Ye, Je, Ze, Pe, Ne, xe, et, tt, nt;
1766
- return o(), i("div", {
1767
- key: `field-${_}`,
1768
- style: $e(S(_, j)),
1769
- class: "form__field"
1770
- }, [
1771
- (!("type" in j) || j.type !== "boolean" || p.searchOnly) && !j.noLabel && !e(Y) && !e(A) ? (o(), i("label", Do, [
1772
- C("div", {
1773
- class: Q({
1774
- "form__field-label": !0,
1775
- "form__field-label--section": "items" in j ? "properties" in j.items : "properties" in j,
1776
- "form__field-required-hint": p.highlightRequired && !e(y) && !p.searchOnly && (!oe.value || e(Qt)(_, oe.value, p.modelValue))
1777
- })
1778
- }, V(j.description || e(z)(_)), 3),
1779
- j.hint ? (o(), i("div", {
1780
- key: 0,
1781
- innerHTML: j.hint
1782
- }, null, 8, Ho)) : h("", !0)
1783
- ])) : h("", !0),
1784
- p.$slots[`field-${_}`] ? O(p.$slots, `field-${_}`, E({
1785
- key: 1,
1786
- ref_for: !0
1787
- }, {
1788
- propery: j,
1789
- properyName: _,
1790
- modelValue: p.modelValue
1791
- }), void 0, !0) : (Be = (me = (_e = p.layout) == null ? void 0 : _e.fields) == null ? void 0 : me[_]) != null && Be.component && e(w)[p.layout.fields[_].component.name] ? (o(), k(he(e(w)[p.layout.fields[_].component.name]), E({
1792
- key: 2,
1793
- modelValue: p.modelValue[_],
1794
- "onUpdate:modelValue": (x) => p.modelValue[_] = x,
1795
- ref_for: !0
1796
- }, {
1797
- readOnly: e(y),
1798
- property: j,
1799
- propertyName: _,
1800
- ...p.layout.fields[_].component.props || {}
1801
- }, {
1802
- onInput: (x) => l("input", _),
1803
- onChange: F[0] || (F[0] = (x) => l("change", x))
1804
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onInput"])) : "format" in j && ["date", "date-time"].includes(j.format) && p.searchOnly ? (o(), i("div", {
1805
- key: 3,
1806
- style: { display: "grid", "grid-template-columns": "repeat(2, 1fr)", "column-gap": "1rem" },
1807
- onInput: (x) => l("input", _),
1808
- onChange: F[1] || (F[1] = (x) => l("change", x))
1809
- }, [
1810
- R(Ie, E({
1811
- modelValue: p.modelValue[_].$gte,
1812
- "onUpdate:modelValue": (x) => p.modelValue[_].$gte = x,
1813
- ref_for: !0
1814
- }, {
1815
- property: j,
1816
- propertyName: _
1817
- }), null, 16, ["modelValue", "onUpdate:modelValue"]),
1818
- R(Ie, E({
1819
- modelValue: p.modelValue[_].$lte,
1820
- "onUpdate:modelValue": (x) => p.modelValue[_].$lte = x,
1821
- ref_for: !0
1822
- }, {
1823
- property: j,
1824
- propertyName: _
1825
- }), null, 16, ["modelValue", "onUpdate:modelValue"])
1826
- ], 40, Qo)) : "type" in j && j.type === "boolean" && p.searchOnly ? (o(), i("div", Go, [
1827
- R(He, E({ ref_for: !0 }, {
1828
- property: j,
1829
- propertyName: _
1830
- }, {
1831
- "boolean-ref": "",
1832
- "model-value": p.modelValue[_],
1833
- onChange: F[2] || (F[2] = (x) => l("change", x)),
1834
- "onUpdate:modelValue": (x) => {
1835
- p.modelValue[_] = x == "true" ? !0 : x == "false" ? !1 : null;
1836
- }
1837
- }), {
1838
- default: v(() => [
1839
- C("option", Wo, V(e(z)("yes")), 1),
1840
- C("option", Ko, V(e(z)("no")), 1)
1841
- ]),
1842
- _: 2
1843
- }, 1040, ["model-value", "onUpdate:modelValue"])
1844
- ])) : p.modelValue && "items" in j && !j.uniqueItems && (!("$ref" in j.items) || j.items.inline || j.items.$ref === "file") ? (o(), i("div", Xo, [
1845
- C("div", null, [
1846
- R(ie, {
1847
- small: "",
1848
- variant: "alt",
1849
- icon: "plus",
1850
- disabled: !("inline" in j.items && j.items.inline) && (((we = p.modelValue[_]) == null ? void 0 : we.length) >= j.maxItems || ne((Je = p.modelValue[_]) == null ? void 0 : Je[((Ye = p.modelValue[_]) == null ? void 0 : Ye.length) - 1])),
1851
- onClick: Fe((x) => {
1852
- p.modelValue[_] || (p.modelValue[_] = []), e(Fo)(p.modelValue[_], j, e(a));
1853
- }, ["prevent"])
1854
- }, {
1855
- default: v(() => [
1856
- H(V(e(z)("action.add", { capitalize: !0 })), 1)
1857
- ]),
1858
- _: 2
1859
- }, 1032, ["disabled", "onClick"])
1860
- ]),
1861
- C("div", Yo, [
1862
- (o(!0), i(Z, null, U(p.modelValue[_], (x, Se) => {
1863
- var ot, at, lt, st, it, rt;
1864
- return o(), i("div", {
1865
- key: `rep-${_}-${e(Mt)(x, Se)}`,
1866
- class: "form__array-item"
1867
- }, [
1868
- C("div", Jo, [
1869
- (o(), k(he(e(dt)(j, e(g))), E({
1870
- modelValue: p.modelValue[_][Se],
1871
- "onUpdate:modelValue": (je) => p.modelValue[_][Se] = je,
1872
- ref_for: !0
1873
- }, {
1874
- readOnly: e(y),
1875
- property: j.items,
1876
- propertyName: _,
1877
- parentCollection: e(u),
1878
- parentPropertyName: p.parentPropertyName,
1879
- columns: ((lt = (at = (ot = p.layout) == null ? void 0 : ot.fields) == null ? void 0 : at[_]) == null ? void 0 : lt.optionsColumns) || ((rt = (it = (st = p.layout) == null ? void 0 : st.fields) == null ? void 0 : it.$default) == null ? void 0 : rt.optionsColumns),
1880
- validationErrors: ae(_, Se),
1881
- ...j.componentProps || {}
1882
- }, {
1883
- onInput: (je) => l("input", _),
1884
- onChange: F[3] || (F[3] = (je) => l("change", je))
1885
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onInput"]))
1886
- ]),
1887
- P(R(N, {
1888
- reactive: "",
1889
- icon: "trash",
1890
- onClick: (je) => e(qo)(p.modelValue[_], Se)
1891
- }, null, 8, ["onClick"]), [
1892
- [K]
1893
- ])
1894
- ]);
1895
- }), 128))
1896
- ])
1897
- ])) : p.modelValue ? P((o(), k(he(e(dt)(j, e(g))), E({
1898
- key: 6,
1899
- modelValue: p.modelValue[_],
1900
- "onUpdate:modelValue": (x) => p.modelValue[_] = x,
1901
- ref_for: !0
1902
- }, {
1903
- readOnly: e(y),
1904
- property: j,
1905
- propertyName: _,
1906
- parentPropertyName: p.parentPropertyName,
1907
- parentCollection: e(u),
1908
- columns: ((Ne = (Pe = (Ze = p.layout) == null ? void 0 : Ze.fields) == null ? void 0 : Pe[_]) == null ? void 0 : Ne.optionsColumns) || ((tt = (et = (xe = p.layout) == null ? void 0 : xe.fields) == null ? void 0 : et.$default) == null ? void 0 : tt.optionsColumns),
1909
- ...j.componentProps || {},
1910
- validationErrors: ae(_)
1911
- }, {
1912
- onInput: (x) => l("input", _),
1913
- onChange: F[4] || (F[4] = (x) => l("change", x))
1914
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onInput"])), [
1915
- [J, !$.value && ($.value = !!p.focus)]
1916
- ]) : h("", !0),
1917
- (nt = b.value) != null && nt[_] ? (o(), i("div", Zo, [
1918
- b.value[_].type ? (o(), i("span", Po, V(e(z)(`validation_error.${b.value[_].type}`)), 1)) : h("", !0),
1919
- b.value[_].detail ? (o(), i("span", No, V(e(z)(b.value[_].detail)), 1)) : h("", !0)
1920
- ])) : h("", !0)
1921
- ], 4);
1922
- }), 128))
1923
- ]),
1924
- p.$slots.after ? O(p.$slots, "after", { key: 1 }, void 0, !0) : h("", !0),
1925
- p.$slots.footer ? (o(), i("div", xo, [
1926
- O(p.$slots, "footer", de(Ve({
1927
- isInsertReady: le.value
1928
- })), void 0, !0)
1929
- ])) : h("", !0)
1930
- ], 4);
1931
- };
1932
- }
1933
- });
1934
- const Qe = /* @__PURE__ */ G(ea, [["__scopeId", "data-v-8492f370"]]), ta = /* @__PURE__ */ q({
1935
- __name: "aeria-filter-panel",
1936
- emits: ["update:modelValue"],
1937
- setup(d, { emit: r }) {
1938
- const a = r, t = ge(), l = Oe(), s = () => {
1939
- t.pagination.offset = 0, t.$actions.filter(), a("update:modelValue", !1), l.push({
1940
- query: Ft(t)
1941
- });
1942
- };
1943
- return (u, y) => (o(), k(Ae, {
1944
- "close-hint": "",
1945
- "fixed-right": "",
1946
- title: u.t("filter_by", { capitalize: !0 }),
1947
- onClose: y[2] || (y[2] = (c) => a("update:modelValue", !1)),
1948
- onOverlayClick: y[3] || (y[3] = (c) => a("update:modelValue", !1))
1949
- }, {
1950
- footer: v(() => [
1951
- e(t).filtersCount > 0 ? (o(), k(ie, {
1952
- key: 0,
1953
- variant: "transparent",
1954
- onClick: y[1] || (y[1] = (c) => {
1955
- e(t).$actions.clearFilters(), s(), a("update:modelValue", !1);
1956
- })
1957
- }, {
1958
- default: v(() => [
1959
- H(V(u.t("action.clear", { capitalize: !0 })) + " ", 1),
1960
- R(be, null, {
1961
- default: v(() => [
1962
- H(V(e(t).filtersCount), 1)
1963
- ]),
1964
- _: 1
1965
- })
1966
- ]),
1967
- _: 1
1968
- })) : h("", !0),
1969
- R(ie, {
1970
- large: "",
1971
- icon: "funnel",
1972
- disabled: !e(t).hasActiveFilters,
1973
- onClick: s
1974
- }, {
1975
- default: v(() => [
1976
- H(V(u.t("action.filter", { capitalize: !0 })), 1)
1977
- ]),
1978
- _: 1
1979
- }, 8, ["disabled"])
1980
- ]),
1981
- default: v(() => [
1982
- R(Qe, E({
1983
- modelValue: e(t).filters,
1984
- "onUpdate:modelValue": y[0] || (y[0] = (c) => e(t).filters = c)
1985
- }, {
1986
- searchOnly: !0,
1987
- form: e(t).availableFilters,
1988
- layout: e(t).description.formLayout || {}
1989
- }, { focus: "" }), null, 16, ["modelValue"])
1990
- ]),
1991
- _: 1
1992
- }, 8, ["title"]));
1993
- }
1994
- }), na = /* @__PURE__ */ q({
1995
- __name: "aeria-insert-panel",
1996
- props: {
1997
- collection: {},
1998
- modelValue: { type: Boolean },
1999
- readOnly: { type: Boolean }
2000
- },
2001
- emits: ["update:modelValue", "cancel"],
2002
- setup(d, { emit: r }) {
2003
- const a = d, t = r, l = se("meta"), s = se(a.collection || l.view.collection), u = ve("individualActions", []), y = async () => {
2004
- const { error: m } = await s.$actions.deepInsert();
2005
- m || t("update:modelValue", !1);
2006
- }, { t: c } = jt(), $ = () => {
2007
- l.$actions.ask({
2008
- action: () => {
2009
- s.$actions.clearItem(), s.validationErrors = {}, t("cancel");
2010
- },
2011
- body: c("prompt.close_panel")
2012
- });
2013
- };
2014
- return re(() => s.item._id, (m) => {
2015
- m === null && t("update:modelValue", !1);
2016
- }), (m, n) => {
2017
- const f = te("clickable");
2018
- return o(), k(Ae, {
2019
- loading: e(s).loading.get,
2020
- onOverlayClick: $
2021
- }, ue({
2022
- extra: v(() => [
2023
- R(Ce, E({
2024
- subject: e(s).item,
2025
- actions: e(u).filter(({ action: b }) => b !== "ui/spawnEdit")
2026
- }, {
2027
- onActionClick: n[2] || (n[2] = (b) => t("update:modelValue", !1))
2028
- }), {
2029
- default: v(() => [
2030
- e(s).item._id ? P((o(), k(N, {
2031
- key: 0,
2032
- reactive: "",
2033
- icon: "dots-three"
2034
- }, null, 512)), [
2035
- [f]
2036
- ]) : h("", !0)
2037
- ]),
2038
- _: 1
2039
- }, 16)
2040
- ]),
2041
- default: v(() => [
2042
- R(Qe, E({
2043
- modelValue: e(s).item,
2044
- "onUpdate:modelValue": n[0] || (n[0] = (b) => e(s).item = b)
2045
- }, {
2046
- readOnly: m.readOnly,
2047
- collection: e(l).view.collection,
2048
- form: e(s).description.form ? e(s).$actions.useProperties(e(s).description.form) : e(s).properties,
2049
- layout: e(s).description.formLayout || {}
2050
- }, {
2051
- focus: "",
2052
- onAdd: n[1] || (n[1] = (b) => b.preventDefault())
2053
- }), ue({ _: 2 }, [
2054
- U(Object.keys(m.$slots).filter((b) => b.startsWith("field-")), (b) => ({
2055
- name: b,
2056
- fn: v((g) => [
2057
- O(m.$slots, b, de(Ve(g)))
2058
- ])
2059
- }))
2060
- ]), 1040, ["modelValue"])
2061
- ]),
2062
- _: 2
2063
- }, [
2064
- m.$slots.header ? {
2065
- name: "header",
2066
- fn: v(() => [
2067
- O(m.$slots, "header")
2068
- ]),
2069
- key: "0"
2070
- } : void 0,
2071
- m.readOnly ? void 0 : {
2072
- name: "footer",
2073
- fn: v(() => [
2074
- R(ie, {
2075
- variant: "transparent",
2076
- onClick: $
2077
- }, {
2078
- default: v(() => [
2079
- H(V(e(c)("action.cancel", { capitalize: !0 })), 1)
2080
- ]),
2081
- _: 1
2082
- }),
2083
- R(ie, {
2084
- large: "",
2085
- disabled: !e(s).isInsertReady || e(s).loading.get,
2086
- loading: e(s).loading.insert,
2087
- onClick: y
2088
- }, {
2089
- default: v(() => [
2090
- H(V(e(c)("action.insert", { capitalize: !0 })), 1)
2091
- ]),
2092
- _: 1
2093
- }, 8, ["disabled", "loading"])
2094
- ]),
2095
- key: "1"
2096
- }
2097
- ]), 1032, ["loading"]);
2098
- };
2099
- }
2100
- }), kt = (d, r) => {
2101
- if (r) {
2102
- if (!d) {
2103
- r.filtersPreset = {}, r.preferredTableProperties = [], r.pagination.offset = 0;
2104
- return;
2105
- }
2106
- r.filtersPreset = d.filters || {}, r.preferredTableProperties = d.table ? Array.from(d.table) : [], r.pagination.offset = 0;
2107
- }
2108
- }, oa = (d, r = {
2109
- persistInQuery: !0
2110
- }) => {
2111
- const t = Oe().currentRoute;
2112
- return re(() => t.value.query.section, (l) => {
2113
- if (d) {
2114
- if (d.description.filtersPresets) {
2115
- const s = l || Object.keys(d.description.filtersPresets)[0];
2116
- kt(d.description.filtersPresets[s], d);
2117
- }
2118
- if (r.persistInQuery) {
2119
- const s = t.value.query;
2120
- s.offset && (d.pagination.offset = +s.offset), s.limit && (d.pagination.limit = +s.limit), s.search && (d.textQuery = s.search, d.filters.$text = {
2121
- $search: `"${s.search}"`,
2122
- $caseSensitive: !1
2123
- });
2124
- }
2125
- }
2126
- }, {
2127
- immediate: !0
2128
- });
2129
- }, aa = (d) => (Ue("data-v-7f75c4c2"), d = d(), Ee(), d), la = {
2130
- key: 0,
2131
- class: "table aeria-surface"
2132
- }, sa = { key: 0 }, ia = { key: 1 }, ra = { key: 0 }, ua = ["checked"], ca = {
2133
- key: 1,
2134
- style: { "text-align": "right" }
2135
- }, da = { key: 2 }, pa = { key: 3 }, _a = ["onClick"], ma = { key: 0 }, fa = ["value"], va = { class: "table__cell-mobile-label" }, ya = {
2136
- key: 0,
2137
- class: "table__cell-container"
2138
- }, ha = {
2139
- key: 1,
2140
- class: "table__cell-container"
2141
- }, $a = { class: "table__cell-grid" }, ba = { key: 0 }, ga = { key: 1 }, ka = ["href"], Va = { key: 3 }, Ca = { key: 2 }, Ia = { key: 0 }, Oa = { key: 1 }, Aa = { key: 2 }, Ba = {
2142
- key: 1,
2143
- class: "no-print"
2144
- }, wa = { class: "table__cell-actions" }, Sa = {
2145
- key: 2,
2146
- class: "no-print table__mobile-actions"
2147
- }, ja = ["id"], Ta = { key: 1 }, La = /* @__PURE__ */ aa(() => /* @__PURE__ */ C("td", { colspan: 10 }, [
2148
- /* @__PURE__ */ C("div", { class: "table__empty" }, " Não foram encontrados resultados. ")
2149
- ], -1)), Ra = [
2150
- La
2151
- ], za = /* @__PURE__ */ q({
2152
- __name: "aeria-table",
2153
- props: {
2154
- columns: {},
2155
- rows: {},
2156
- collection: {},
2157
- checkbox: { type: Boolean },
2158
- actions: {},
2159
- layout: {}
2160
- },
2161
- emits: ["itemClick"],
2162
- setup(d, { emit: r }) {
2163
- const a = d, t = r, l = Re(), s = a.collection || ze(), u = s ? se(typeof s == "string" ? s : s.value) : null, y = D({
2164
- get: () => u == null ? void 0 : u.selected,
2165
- set: (f) => u == null ? void 0 : u.$actions.selectManyItems(f, !0)
2166
- }), c = (f, b) => f != null && f.button ? typeof f.button == "object" ? We(b, f.button).satisfied : f.button : !1, $ = (f) => {
2167
- var b;
2168
- return !l.value.xl || !((b = a.layout) != null && b.actions) || !a.actions ? [] : a.actions.filter((g) => {
2169
- const w = a.layout.actions[g.action];
2170
- return c(w, f);
2171
- });
2172
- }, m = (f) => {
2173
- var b;
2174
- return a.actions ? !l.value.xl || !((b = a.layout) != null && b.actions) ? a.actions : a.actions.filter((g) => {
2175
- const w = a.layout.actions[g.action];
2176
- if (g.roles) {
2177
- const T = se("user");
2178
- if (!$t(g.roles, T.currentUser.roles))
2179
- return !1;
2180
- }
2181
- return !c(w, f);
2182
- }) : [];
2183
- }, n = (f, b) => {
2184
- var T, Y;
2185
- const g = [], w = (Y = (T = a.layout) == null ? void 0 : T.actions) == null ? void 0 : Y[b.action];
2186
- return w != null && w.if && (We(
2187
- f,
2188
- w.if
2189
- ).satisfied || g.push("display: none;")), g.join("");
2190
- };
2191
- return (f, b) => {
2192
- var w, T, Y;
2193
- const g = te("clickable");
2194
- return f.columns && Object.keys(f.columns).length > 0 || f.$slots.thead ? (o(), i("table", la, [
2195
- f.$slots.thead ? (o(), i("thead", sa, [
2196
- O(f.$slots, "thead", {}, void 0, !0)
2197
- ])) : (o(), i("thead", ia, [
2198
- C("tr", null, [
2199
- f.checkbox && e(u) && e(l).md ? (o(), i("th", ra, [
2200
- C("input", {
2201
- type: "checkbox",
2202
- checked: e(u).selected.length > 0 && e(u).selected.length === e(u).itemsCount,
2203
- onChange: b[0] || (b[0] = (A) => e(u).$actions.selectAllItems(A.target.checked))
2204
- }, null, 40, ua)
2205
- ])) : h("", !0),
2206
- (o(!0), i(Z, null, U(Object.entries(f.columns), ([A, M], W) => (o(), i("th", {
2207
- key: `header-${W}`,
2208
- class: "table__header"
2209
- }, V(M.description || e(z)(A)), 1))), 128)),
2210
- (w = f.actions) != null && w.length ? (o(), i("th", ca)) : h("", !0)
2211
- ])
2212
- ])),
2213
- f.$slots.tbody ? (o(), i("tbody", da, [
2214
- O(f.$slots, "tbody", {}, void 0, !0)
2215
- ])) : (o(), i("tbody", pa, [
2216
- (o(!0), i(Z, null, U(f.rows, (A) => {
2217
- var M, W;
2218
- return o(), i("tr", {
2219
- key: A._id,
2220
- onClick: (B) => t("itemClick", A)
2221
- }, [
2222
- e(u) && f.checkbox && e(l).md ? (o(), i("td", ma, [
2223
- P(C("input", {
2224
- "onUpdate:modelValue": b[1] || (b[1] = (B) => y.value = B),
2225
- type: "checkbox",
2226
- value: A._id
2227
- }, null, 8, fa), [
2228
- [It, y.value]
2229
- ])
2230
- ])) : h("", !0),
2231
- (o(!0), i(Z, null, U(Object.entries(f.columns), ([B, ee], I) => {
2232
- var S, ne, oe, le, ae, L;
2233
- return o(), i("td", {
2234
- key: `column-${A._id}-${I}`
2235
- }, [
2236
- C("div", va, V(ee.description || e(z)(B)), 1),
2237
- `row-${B}` in f.$slots ? (o(), i("div", ya, [
2238
- O(f.$slots, `row-${B}`, E({ ref_for: !0 }, {
2239
- store: e(u),
2240
- column: B,
2241
- property: ee,
2242
- row: A
2243
- }), void 0, !0)
2244
- ])) : (o(), i("div", ha, [
2245
- C("div", $a, [
2246
- "type" in ee && ee.type === "boolean" ? (o(), i("div", ba, [
2247
- A[B] ? (o(), k(N, {
2248
- key: 0,
2249
- icon: "check",
2250
- "icon-classes": "aeria-blueish"
2251
- }, {
2252
- default: v(() => [
2253
- H(V(e(z)("yes")), 1)
2254
- ]),
2255
- _: 1
2256
- })) : (o(), k(N, {
2257
- key: 1,
2258
- icon: "x",
2259
- "icon-classes": "aeria-redish"
2260
- }, {
2261
- default: v(() => [
2262
- H(V(e(z)("no")), 1)
2263
- ]),
2264
- _: 1
2265
- }))
2266
- ])) : ((S = e(pe)(ee)) == null ? void 0 : S.$ref) === "file" ? (o(), i("div", ga, [
2267
- /^image/.test((ne = A[B][0]) == null ? void 0 : ne.type) && "items" in ee ? (o(), k(qe, {
2268
- key: 0,
2269
- modelValue: A[B][0].link,
2270
- "onUpdate:modelValue": (p) => A[B][0].link = p,
2271
- expandable: "",
2272
- meta: A[B][0],
2273
- alt: "Row image",
2274
- class: "table__picture"
2275
- }, null, 8, ["modelValue", "onUpdate:modelValue", "meta"])) : /^image/.test((oe = A[B]) == null ? void 0 : oe.type) ? (o(), k(qe, {
2276
- key: 1,
2277
- modelValue: A[B].link,
2278
- "onUpdate:modelValue": (p) => A[B].link = p,
2279
- expandable: "",
2280
- meta: A[B],
2281
- alt: "Row image",
2282
- class: "table__picture"
2283
- }, null, 8, ["modelValue", "onUpdate:modelValue", "meta"])) : (le = A[B]) != null && le.link ? (o(), i("a", {
2284
- key: 2,
2285
- href: A[B].link,
2286
- style: { "font-size": "10pt" }
2287
- }, V(A[B].filename), 9, ka)) : (o(), i("div", Va, " - "))
2288
- ])) : (o(), i("div", Ca, [
2289
- e(u) ? (o(), i("span", Ia, V(e(u).$actions.formatValue({
2290
- value: A[B],
2291
- key: B,
2292
- property: ee
2293
- })), 1)) : (o(), i("span", Oa, V(Array.isArray(A[B]) ? A[B].filter((p) => !!p).join(", ") : [void 0, null].includes(A[B]) ? "-" : A[B]), 1)),
2294
- ((L = (ae = e(pe)(ee)) == null ? void 0 : ae.indexes) == null ? void 0 : L.length) > 1 ? (o(), i("div", Aa, [
2295
- (o(!0), i(Z, null, U(e(pe)(ee).indexes.slice(1, 2), (p, F) => (o(), i("div", {
2296
- key: `subvalue-${F}`,
2297
- class: "table__cell-subvalue"
2298
- }, V(e(u).$actions.formatValue({
2299
- value: A[B],
2300
- key: B,
2301
- property: ee,
2302
- index: p
2303
- })), 1))), 128))
2304
- ])) : h("", !0)
2305
- ]))
2306
- ])
2307
- ]))
2308
- ]);
2309
- }), 128)),
2310
- (M = f.actions) != null && M.length && e(l).md ? (o(), i("td", Ba, [
2311
- C("div", wa, [
2312
- (o(!0), i(Z, null, U($(A), (B) => (o(), k(ie, {
2313
- key: `action-${B.action}`,
2314
- small: "",
2315
- variant: "transparent",
2316
- icon: B.icon,
2317
- style: $e(n(A, B)),
2318
- onClick: (ee) => B.click(A)
2319
- }, {
2320
- default: v(() => [
2321
- H(V(e(z)(B.label)), 1)
2322
- ]),
2323
- _: 2
2324
- }, 1032, ["icon", "style", "onClick"]))), 128)),
2325
- m(A).length > 0 ? (o(), k(Ce, E({
2326
- key: 0,
2327
- ref_for: !0
2328
- }, {
2329
- subject: A,
2330
- actions: m(A)
2331
- }), {
2332
- default: v(() => [
2333
- P(R(N, {
2334
- reactive: "",
2335
- icon: "dots-three"
2336
- }, null, 512), [
2337
- [g]
2338
- ])
2339
- ]),
2340
- _: 2
2341
- }, 1040)) : h("", !0)
2342
- ])
2343
- ])) : (W = f.actions) != null && W.length ? (o(), i("td", Sa, [
2344
- C("div", {
2345
- class: "table__mobile-actions-grid",
2346
- style: $e(`grid-template-columns: repeat(${$(A).length + (m(A).length ? 1 : 0)}, 1fr);`)
2347
- }, [
2348
- (o(!0), i(Z, null, U($(A), (B) => (o(), k(fe, {
2349
- key: `action-${B.action}`,
2350
- class: "table__mobile-actions-button",
2351
- onClick: (ee) => B.click(A)
2352
- }, {
2353
- default: v(() => [
2354
- R(N, {
2355
- icon: B.icon || "gear"
2356
- }, {
2357
- default: v(() => [
2358
- H(V(e(z)(B.label)), 1)
2359
- ]),
2360
- _: 2
2361
- }, 1032, ["icon"])
2362
- ]),
2363
- _: 2
2364
- }, 1032, ["onClick"]))), 128)),
2365
- m(A).length > 0 ? (o(), k(Ce, E({
2366
- key: 0,
2367
- ref_for: !0
2368
- }, {
2369
- subject: A,
2370
- actions: m(A)
2371
- }), {
2372
- default: v(() => [
2373
- R(N, {
2374
- icon: "dots-three",
2375
- class: "table__mobile-actions-button"
2376
- })
2377
- ]),
2378
- _: 2
2379
- }, 1040)) : h("", !0)
2380
- ], 4)
2381
- ])) : h("", !0),
2382
- C("div", {
2383
- id: `dropdown-${A._id}`
2384
- }, null, 8, ja)
2385
- ], 8, _a);
2386
- }), 128))
2387
- ])),
2388
- C("tfoot", null, [
2389
- f.$slots.tfoot ? O(f.$slots, "tfoot", { key: 0 }, void 0, !0) : f.columns && !((T = f.rows) != null && T.length) && !((Y = e(u)) != null && Y.loading.getAll) ? (o(), i("tr", Ta, Ra)) : h("", !0)
2390
- ])
2391
- ])) : h("", !0);
2392
- };
2393
- }
2394
- });
2395
- const Ma = /* @__PURE__ */ G(za, [["__scopeId", "data-v-7f75c4c2"]]), Fa = /* @__PURE__ */ q({
2396
- __name: "aeria-tabular",
2397
- props: {
2398
- individualActions: {},
2399
- layoutOptions: {},
2400
- componentProps: {}
2401
- },
2402
- setup(d) {
2403
- const r = d, a = ge(), t = ze(), l = D(() => {
2404
- const s = {
2405
- collection: t,
2406
- checkbox: a.hasSelectionActions,
2407
- columns: a.tableProperties,
2408
- rows: a.items,
2409
- actions: r.individualActions,
2410
- layout: a.tableLayout
2411
- };
2412
- return Object.assign(s, r.componentProps);
2413
- });
2414
- return (s, u) => (o(), i("div", null, [
2415
- s.$slots.inner ? O(s.$slots, "inner", { key: 0 }) : h("", !0),
2416
- e(a).properties ? (o(), k(Ma, E({ key: 1 }, l.value, {
2417
- key: e(a).$id
2418
- }), ue({ _: 2 }, [
2419
- U(Object.keys(s.$slots).filter((y) => !["inner"].includes(y)), (y) => ({
2420
- name: y,
2421
- fn: v((c) => [
2422
- O(s.$slots, y, de(Ve(c)))
2423
- ])
2424
- }))
2425
- ]), 1040)) : h("", !0)
2426
- ]));
2427
- }
2428
- }), qa = /* @__PURE__ */ q({
2429
- __name: "aeria-grid",
2430
- props: {
2431
- list: { type: Boolean }
2432
- },
2433
- setup(d) {
2434
- return (r, a) => (o(), i("div", {
2435
- class: Q(`
2436
- grid
2437
- ${r.list && "grid--list"}
2438
- `)
2439
- }, [
2440
- O(r.$slots, "default", {}, void 0, !0)
2441
- ], 2));
2442
- }
2443
- });
2444
- const Ua = /* @__PURE__ */ G(qa, [["__scopeId", "data-v-438c4aed"]]), Ea = { key: 0 }, Da = {
2445
- key: 1,
2446
- class: "card__information"
2447
- }, Ha = /* @__PURE__ */ q({
2448
- __name: "aeria-grid",
2449
- props: {
2450
- individualActions: {},
2451
- hasSelectionActions: { type: Boolean },
2452
- layoutOptions: {},
2453
- componentName: {}
2454
- },
2455
- setup(d) {
2456
- const a = d.layoutOptions, t = ge(), l = (s) => Array.isArray(s) ? s[0] : s;
2457
- return (s, u) => {
2458
- const y = te("clickable");
2459
- return o(), k(Ua, {
2460
- list: s.componentName === "list"
2461
- }, {
2462
- default: v(() => [
2463
- (o(!0), i(Z, null, U(e(t).items, (c) => (o(), k(pn, {
2464
- key: c,
2465
- inactive: !!(e(a).active && !c[e(a).active]),
2466
- horizontal: s.componentName === "list"
2467
- }, ue({
2468
- footer: v(() => [
2469
- e(a).title ? (o(), i("div", Ea, V(c[e(a).title]), 1)) : h("", !0),
2470
- e(a).information ? (o(), i("div", Da, V(c[e(a).information]), 1)) : h("", !0)
2471
- ]),
2472
- actions: v(() => [
2473
- s.individualActions.length > 0 ? (o(), k(Ce, E({
2474
- key: 0,
2475
- ref_for: !0
2476
- }, {
2477
- subject: c,
2478
- actions: s.individualActions
2479
- }), {
2480
- default: v(() => [
2481
- P(R(N, {
2482
- reactive: "",
2483
- icon: "dots-three-vertical"
2484
- }, null, 512), [
2485
- [y]
2486
- ])
2487
- ]),
2488
- _: 2
2489
- }, 1040)) : h("", !0)
2490
- ]),
2491
- default: v(() => {
2492
- var $;
2493
- return [
2494
- R(qe, {
2495
- alt: "Item picture",
2496
- expandable: "",
2497
- url: ($ = l(c[e(a).picture])) == null ? void 0 : $.link,
2498
- meta: l(c[e(a).picture])
2499
- }, null, 8, ["url", "meta"])
2500
- ];
2501
- }),
2502
- _: 2
2503
- }, [
2504
- e(a).badge && Array.isArray(c[e(a).badge]) ? {
2505
- name: "badge",
2506
- fn: v(() => [
2507
- (o(!0), i(Z, null, U(c[e(a).badge], ($) => (o(), k(be, {
2508
- key: `${c._id}-${$}`,
2509
- large: ""
2510
- }, {
2511
- default: v(() => [
2512
- H(V(e(a).translateBadge ? e(z)($) : $), 1)
2513
- ]),
2514
- _: 2
2515
- }, 1024))), 128))
2516
- ]),
2517
- key: "0"
2518
- } : e(a).badge ? {
2519
- name: "badge",
2520
- fn: v(() => [
2521
- R(be, null, {
2522
- default: v(() => [
2523
- H(V(e(a).translateBadge ? e(z)(c[e(a).badge]) : c[e(a).badge]), 1)
2524
- ]),
2525
- _: 2
2526
- }, 1024)
2527
- ]),
2528
- key: "1"
2529
- } : void 0
2530
- ]), 1032, ["inactive", "horizontal"]))), 128))
2531
- ]),
2532
- _: 1
2533
- }, 8, ["list"]);
2534
- };
2535
- }
2536
- });
2537
- const pt = /* @__PURE__ */ G(Ha, [["__scopeId", "data-v-113dd7db"]]), Qa = (d) => ({
2538
- tabular: Fa,
2539
- grid: pt,
2540
- list: pt
2541
- })[d], ce = X(!1);
2542
- X(!1);
2543
- const ke = X(!1), Te = X((...d) => null), _t = X(), Ga = (d) => (Ue("data-v-120eef49"), d = d(), Ee(), d), Wa = {
2544
- key: 2,
2545
- class: "crud__controls"
2546
- }, Ka = {
2547
- key: 0,
2548
- class: "crud__search"
2549
- }, Xa = { class: "crud__actions" }, Ya = { class: "crud__context-badge" }, Ja = /* @__PURE__ */ Ga(() => /* @__PURE__ */ C("div", null, "Filtros", -1)), Za = { key: 0 }, Pa = {
2550
- key: 3,
2551
- class: "crud__pagination"
2552
- }, mt = 30, Na = /* @__PURE__ */ q({
2553
- __name: "aeria-crud",
2554
- props: {
2555
- collection: {},
2556
- noControls: { type: Boolean },
2557
- noActions: { type: Boolean },
2558
- noFetch: { type: Boolean },
2559
- noLayoutToggle: { type: Boolean },
2560
- layout: {},
2561
- action: {},
2562
- componentProps: {},
2563
- scrollPagination: { type: Boolean },
2564
- noQueryPersistence: { type: Boolean }
2565
- },
2566
- emits: ["uiEvent"],
2567
- setup(d, { emit: r }) {
2568
- const a = d, t = r, l = Oe(), s = ht({
2569
- delay: 600
2570
- }), u = se("meta"), y = Re(), { reachedEnd: c, detach: $ } = Xe(null, {
2571
- antecipate: 600
2572
- }), m = !y.value.md || a.scrollPagination;
2573
- m && re(c, (I) => {
2574
- I && n.pagination.recordsTotal > n.items.length && g.value < mt && (g.value += 1, T());
2575
- });
2576
- const n = se(a.collection);
2577
- oa(n, {
2578
- persistInQuery: !a.noQueryPersistence
2579
- });
2580
- const f = bt(), b = a.action ? e(a.action) : qt(n, l, f);
2581
- Te.value = b[0], _t.value = b[1];
2582
- const g = X(0), w = X(!1), T = async (I) => {
2583
- n.activeFilters = Object.assign({}, (I == null ? void 0 : I.filters) || n.$filters), Object.assign(n.activeFilters, n.filtersPreset);
2584
- const S = {
2585
- filters: n.activeFilters,
2586
- limit: n.pagination.limit,
2587
- offset: n.pagination.offset,
2588
- project: n.preferredTableProperties.length > 0 ? n.preferredTableProperties : n.description.table || Object.keys(n.properties)
2589
- };
2590
- g.value > 0 && (S.limit = 15, S.offset = g.value * S.limit), n.description.tableMeta && (S.project = S.project.concat(n.description.tableMeta)), I && Object.assign(S, I), n.loading.getAll = !0;
2591
- const { error: ne, result: oe } = await n.$actions.retrieveItems(S);
2592
- if (ne)
2593
- return;
2594
- const { data: le, pagination: ae } = oe;
2595
- n.pagination.recordsCount = ae.recordsCount, n.pagination.recordsTotal = ae.recordsTotal, g.value === 0 && n.items.splice(0), n.items.push(...le), n.loading.getAll = !1, w.value = !0;
2596
- }, Y = async (I) => {
2597
- l.push({
2598
- query: {
2599
- ...l.currentRoute.value.query,
2600
- offset: I.offset,
2601
- limit: I.limit
2602
- }
2603
- }), n.pagination.offset = I.offset, n.pagination.limit = I.limit, T();
2604
- }, A = ve("noResultsComponent", null);
2605
- re(() => [
2606
- l.currentRoute.value.path,
2607
- l.currentRoute.value.query.section
2608
- ], async (I, S) => {
2609
- if (S && S[0] === I[0] && S[1] === I[1])
2610
- return;
2611
- const ne = l.currentRoute.value;
2612
- if (u.view.title = a.collection, u.view.collection = a.collection, !a.noFetch && !ne.query._popstate) {
2613
- const oe = Ut(n, ne);
2614
- Object.keys(oe).length > 0 && Object.assign(n.filters, oe), await T();
2615
- }
2616
- }, {
2617
- immediate: !0,
2618
- flush: "post"
2619
- });
2620
- const [M] = s((I) => (l.push({
2621
- query: {
2622
- search: I || void 0
2623
- }
2624
- }), I ? (n.filters = Object.assign(Le(n.freshFilters), {
2625
- $text: {
2626
- $search: `"${I}"`,
2627
- $caseSensitive: !1
2628
- }
2629
- }), T({
2630
- offset: 0
2631
- })) : (n.filters = Le(n.freshFilters), g.value = 0, T())));
2632
- re(() => n.textQuery, (I) => {
2633
- M(I);
2634
- });
2635
- const W = (I) => {
2636
- I.currentLayout = I.currentLayout === "tabular" ? I.description.layout.name : "tabular";
2637
- };
2638
- Ot(() => {
2639
- n.$actions.clearFilters(), n.textQuery = "", $();
2640
- }), re(() => _t.value, async (I) => {
2641
- var oe;
2642
- const S = Le(I);
2643
- let ne;
2644
- if (S)
2645
- if ((S.name === "spawnEdit" || S.name === "duplicate") && (ne = n.$actions.get({
2646
- filters: {
2647
- _id: S.params._id
2648
- }
2649
- })), S.name === "spawnAdd")
2650
- n.$actions.clearItem(), (oe = S.params) != null && oe.item && (n.$actions.setItem(S.params.item), Object.keys(S.params.item).forEach((le) => {
2651
- delete n.referenceItem[le];
2652
- })), ce.value = "add";
2653
- else if (S.name === "spawnEdit")
2654
- n.$actions.setItem(S.params), ce.value = "edit";
2655
- else if (S.name === "duplicate") {
2656
- await ne;
2657
- const le = Object.entries(n.item).reduce((ae, [L, p]) => {
2658
- if (!(L in n.properties))
2659
- return {
2660
- ...ae,
2661
- [L]: p
2662
- };
2663
- const F = n.properties[L];
2664
- if (F.readOnly)
2665
- return ae;
2666
- const K = (J) => {
2667
- const _ = pe(F);
2668
- if (!_)
2669
- return J;
2670
- if (_.$ref === "file")
2671
- return {};
2672
- if (_.inline && J) {
2673
- const { _id: j, ..._e } = J;
2674
- return _e;
2675
- }
2676
- return J;
2677
- };
2678
- return p = Array.isArray(p) ? p.map(K) : K(p), {
2679
- ...ae,
2680
- [L]: p
2681
- };
2682
- }, {});
2683
- n.$actions.setItem(le), delete n.item._id, n.referenceItem = {}, ce.value = "duplicate";
2684
- } else
2685
- t("uiEvent", S);
2686
- }, {
2687
- deep: !0
2688
- }), re(() => ce, (I) => {
2689
- I.value === !1 && (u.view.collection = a.collection, n.$actions.clearItem());
2690
- });
2691
- const B = D(() => n.individualActions.map((I) => ({
2692
- click: Te.value(I),
2693
- ...I
2694
- }))), ee = D(() => n.actions.filter((I) => !I.button));
2695
- return ye(De, D(() => a.collection)), ye("individualActions", B), (I, S) => {
2696
- var le, ae, L, p, F, K, J;
2697
- const ne = te("clickable"), oe = te("loading");
2698
- return o(), i(Z, null, [
2699
- e(ke) ? (o(), k(ta, {
2700
- key: e(n).$id,
2701
- modelValue: e(ke),
2702
- "onUpdate:modelValue": S[0] || (S[0] = (_) => ut(ke) ? ke.value = _ : null)
2703
- }, null, 8, ["modelValue"])) : h("", !0),
2704
- e(ce) ? (o(), k(na, {
2705
- key: 1,
2706
- modelValue: e(ce),
2707
- "onUpdate:modelValue": S[1] || (S[1] = (_) => ut(ce) ? ce.value = _ : null),
2708
- "fixed-right": "",
2709
- onCancel: S[2] || (S[2] = (_) => ce.value = !1)
2710
- }, ue({
2711
- header: v(() => [
2712
- C("span", null, V((() => {
2713
- switch (e(ce)) {
2714
- case "add":
2715
- return e(z)("action.add", { capitalize: !0 });
2716
- case "duplicate":
2717
- return e(z)("action.duplicate", { capitalize: !0 });
2718
- case "edit":
2719
- default:
2720
- return e(z)("action.edit", { capitalize: !0 });
2721
- }
2722
- })()), 1),
2723
- C("span", null, " " + V(e(z)(e(u).view.collection)), 1)
2724
- ]),
2725
- _: 2
2726
- }, [
2727
- U(Object.keys(I.$slots).filter((_) => _.startsWith("field-")), (_) => ({
2728
- name: _,
2729
- fn: v((j) => [
2730
- O(I.$slots, _, de(Ve(j)), void 0, !0)
2731
- ])
2732
- }))
2733
- ]), 1032, ["modelValue"])) : h("", !0),
2734
- !I.noActions && (e(n).description.search || Object.keys(e(n).availableFilters).length > 0 || ((le = e(n)) == null ? void 0 : le.actions.length) > 0 || I.$slots.actions || !I.noLayoutToggle && e(n).description.layout && ((ae = e(n).description.layout) == null ? void 0 : ae.name) !== "tabular") ? (o(), i("div", Wa, [
2735
- e(n).description.search ? (o(), i("div", Ka, [
2736
- R(Ie, E({
2737
- modelValue: e(n).textQuery,
2738
- "onUpdate:modelValue": S[3] || (S[3] = (_) => e(n).textQuery = _)
2739
- }, {
2740
- property: {
2741
- type: "string",
2742
- placeholder: e(n).description.search.placeholder || "Pesquise aqui",
2743
- inputType: "search"
2744
- }
2745
- }), null, 16, ["modelValue"])
2746
- ])) : h("", !0),
2747
- C("div", Xa, [
2748
- ee.value.length > 0 || !I.noLayoutToggle && e(n).description.layout && ((L = e(n).description.layout) == null ? void 0 : L.name) !== "tabular" ? (o(), k(Ce, { key: 0 }, ue({
2749
- default: v(() => [
2750
- R(ie, {
2751
- variant: "alt",
2752
- icon: "sliders"
2753
- }, {
2754
- default: v(() => [
2755
- e(n).filtersCount ? (o(), k(be, { key: 0 }, {
2756
- default: v(() => [
2757
- H(V(e(n).filtersCount), 1)
2758
- ]),
2759
- _: 1
2760
- })) : h("", !0)
2761
- ]),
2762
- _: 1
2763
- })
2764
- ]),
2765
- _: 2
2766
- }, [
2767
- Object.keys(e(n).availableFilters).length > 0 ? {
2768
- name: "filter",
2769
- fn: v(() => [
2770
- P((o(), k(N, {
2771
- icon: "funnel",
2772
- onClick: S[4] || (S[4] = (_) => ke.value = !0)
2773
- }, {
2774
- default: v(() => [
2775
- H(V(e(z)("filters", { capitalize: !0 })), 1)
2776
- ]),
2777
- _: 1
2778
- })), [
2779
- [ne]
2780
- ]),
2781
- C("div", Ya, [
2782
- e(n).filtersCount ? (o(), k(be, { key: 0 }, {
2783
- default: v(() => [
2784
- H(V(e(n).filtersCount), 1)
2785
- ]),
2786
- _: 1
2787
- })) : h("", !0)
2788
- ])
2789
- ]),
2790
- key: "0"
2791
- } : void 0,
2792
- !I.noLayoutToggle && e(n).description.layout && ((p = e(n).description.layout) == null ? void 0 : p.name) !== "tabular" ? {
2793
- name: "layout-toggle",
2794
- fn: v(() => [
2795
- P((o(), k(N, {
2796
- icon: "table",
2797
- onClick: S[5] || (S[5] = (_) => W(e(n)))
2798
- }, {
2799
- default: v(() => [
2800
- H(V(e(z)("change_layout", { capitalize: !0 })), 1)
2801
- ]),
2802
- _: 1
2803
- })), [
2804
- [ne]
2805
- ])
2806
- ]),
2807
- key: "1"
2808
- } : void 0,
2809
- U(ee.value, (_, j) => ({
2810
- name: `action-${j}`,
2811
- fn: v(() => [
2812
- _ ? (o(), k(N, {
2813
- key: 0,
2814
- icon: _.icon || "gear",
2815
- disabled: e(n).selected.length === 0 && _.selection,
2816
- onClick: (_e) => e(Te)(_)({ _id: e(n).selected.map((me) => me._id) })
2817
- }, {
2818
- default: v(() => [
2819
- H(V(e(z)(_.label, { capitalize: !0 })), 1)
2820
- ]),
2821
- _: 2
2822
- }, 1032, ["icon", "disabled", "onClick"])) : h("", !0)
2823
- ])
2824
- }))
2825
- ]), 1024)) : Object.keys(e(n).availableFilters).length > 0 ? (o(), k(ie, {
2826
- key: 1,
2827
- variant: "alt",
2828
- icon: "funnel",
2829
- onClick: S[6] || (S[6] = (_) => ke.value = !0)
2830
- }, {
2831
- default: v(() => [
2832
- Ja,
2833
- e(n).filtersCount ? (o(), k(be, { key: 0 }, {
2834
- default: v(() => [
2835
- H(V(e(n).filtersCount), 1)
2836
- ]),
2837
- _: 1
2838
- })) : h("", !0)
2839
- ]),
2840
- _: 1
2841
- })) : h("", !0),
2842
- (o(!0), i(Z, null, U(e(n).actions.filter((_) => _.button), (_, j) => (o(), k(ie, {
2843
- key: `action-${j}`,
2844
- icon: _.icon,
2845
- disabled: e(n).selected.length === 0 && _.selection,
2846
- onClick: (_e) => e(Te)(_)({ _id: e(n).selected.map((me) => me._id) })
2847
- }, {
2848
- default: v(() => [
2849
- H(V(e(z)(_.label, { capitalize: !0 })), 1)
2850
- ]),
2851
- _: 2
2852
- }, 1032, ["icon", "disabled", "onClick"]))), 128)),
2853
- I.$slots.actions ? O(I.$slots, "actions", { key: 2 }, void 0, !0) : h("", !0)
2854
- ])
2855
- ])) : h("", !0),
2856
- P((o(), i("div", null, [
2857
- e(n).itemsCount === 0 && !e(n).loading.getAll && w.value && (e(A) || I.$slots.empty) ? (o(), i("div", Za, [
2858
- e(A) ? (o(), k(he(e(A)), de(E({ key: 0 }, {
2859
- collection: e(n).$id
2860
- })), {
2861
- default: v(() => [
2862
- e(n).filtersCount === 0 && e(n).description.actions && "ui:spawnAdd" in e(n).description.actions ? (o(), k(ie, {
2863
- key: 0,
2864
- icon: "plus",
2865
- onClick: S[7] || (S[7] = (_) => e(Te)({
2866
- action: "ui:spawnAdd"
2867
- })())
2868
- }, {
2869
- default: v(() => [
2870
- H(V(e(z)("add_first_item", { capitalize: !0 })), 1)
2871
- ]),
2872
- _: 1
2873
- })) : h("", !0)
2874
- ]),
2875
- _: 1
2876
- }, 16)) : O(I.$slots, "empty", de(E({ key: 1 }, {
2877
- collection: e(n).$id
2878
- })), void 0, !0)
2879
- ])) : I.$slots.component ? O(I.$slots, "component", de(E({ key: 1 }, {
2880
- store: e(n)
2881
- })), void 0, !0) : (o(), k(he(e(Qa)(((F = I.layout) == null ? void 0 : F.name) || e(n).$currentLayout)), E({ key: 2 }, {
2882
- individualActions: B.value,
2883
- layoutOptions: ((K = I.layout) == null ? void 0 : K.options) || e(n).layout.options,
2884
- componentProps: I.componentProps
2885
- }, {
2886
- "component-name": ((J = I.layout) == null ? void 0 : J.name) || e(n).$currentLayout
2887
- }), ue({ _: 2 }, [
2888
- U(Object.keys(I.$slots).filter((_) => _.startsWith("row-")), (_) => ({
2889
- name: _,
2890
- fn: v((j) => [
2891
- O(I.$slots, _, de(Ve(j)), void 0, !0)
2892
- ])
2893
- })),
2894
- I.$slots.tfoot ? {
2895
- name: "tfoot",
2896
- fn: v(() => [
2897
- O(I.$slots, "tfoot", {}, void 0, !0)
2898
- ]),
2899
- key: "0"
2900
- } : void 0
2901
- ]), 1040, ["component-name"]))
2902
- ])), [
2903
- [oe, (!e(m) || g.value === mt) && e(n).loading.getAll]
2904
- ]),
2905
- !e(n).loading.getAll && e(n).itemsCount > 0 ? (o(), i("div", Pa, [
2906
- R(Mn, {
2907
- pagination: e(n).pagination,
2908
- onPaginate: Y
2909
- }, null, 8, ["pagination"])
2910
- ])) : h("", !0)
2911
- ], 64);
2912
- };
2913
- }
2914
- });
2915
- const Rl = /* @__PURE__ */ G(Na, [["__scopeId", "data-v-120eef49"]]), xa = { class: "prompt" }, el = /* @__PURE__ */ q({
2916
- __name: "aeria-prompt",
2917
- props: {
2918
- title: {},
2919
- actions: {}
2920
- },
2921
- setup(d) {
2922
- const r = se("meta"), a = (t) => {
2923
- r.$actions.fulfillPrompt(t);
2924
- };
2925
- return (t, l) => (o(), k(Ae, {
2926
- float: "",
2927
- "fill-footer": "",
2928
- "close-hint": !1,
2929
- style: { "--panel-min-width": "32rem" }
2930
- }, ue({
2931
- footer: v(() => [
2932
- C("div", {
2933
- class: "prompt__actions",
2934
- style: $e(`grid-template-columns: repeat(${t.actions.length}, 1fr)`)
2935
- }, [
2936
- (o(!0), i(Z, null, U(t.actions, (s, u) => (o(), k(fe, {
2937
- key: `action-${u}`,
2938
- class: Q(`
2939
- prompt__action
2940
- prompt__action--${s.variant || "primary"}
2941
- `),
2942
- onClick: (y) => s.click ? s.click(s) : a(s)
2943
- }, {
2944
- default: v(() => [
2945
- H(V(s.title || s.name), 1)
2946
- ]),
2947
- _: 2
2948
- }, 1032, ["class", "onClick"]))), 128))
2949
- ], 4)
2950
- ]),
2951
- default: v(() => [
2952
- C("div", xa, [
2953
- O(t.$slots, "default", {}, void 0, !0)
2954
- ])
2955
- ]),
2956
- _: 2
2957
- }, [
2958
- t.title ? {
2959
- name: "title",
2960
- fn: v(() => [
2961
- H(V(t.title), 1)
2962
- ]),
2963
- key: "0"
2964
- } : void 0
2965
- ]), 1024));
2966
- }
2967
- });
2968
- const tl = /* @__PURE__ */ G(el, [["__scopeId", "data-v-5443f297"]]), nl = { class: "toast__content" }, ol = { class: "toast__time" }, al = /* @__PURE__ */ q({
2969
- __name: "aeria-toast",
2970
- props: {
2971
- idx: {},
2972
- itr: {},
2973
- date: {},
2974
- icon: {}
2975
- },
2976
- setup(d) {
2977
- const r = se("meta");
2978
- return (a, t) => {
2979
- const l = te("clickable");
2980
- return P((o(), i("div", {
2981
- class: Q({
2982
- toast: !0,
2983
- "toast--animate": e(r).toasts[0].itr === a.itr
2984
- }),
2985
- onAnimationend: t[0] || (t[0] = (s) => e(r).$actions.popToast()),
2986
- onClick: t[1] || (t[1] = (s) => e(r).$actions.popToast(a.itr))
2987
- }, [
2988
- R(N, E(
2989
- a.icon ? { icon: a.icon } : { icon: "warning-circle" },
2990
- { style: { "--icon-size": "4rem", "--icon-color": "var(--theme-brand-color-shade-3)" } }
2991
- ), null, 16),
2992
- C("div", nl, [
2993
- O(a.$slots, "default", {}, void 0, !0),
2994
- C("div", ol, V(a.formatDateTime(a.date, { hoursOnly: !0 })), 1)
2995
- ])
2996
- ], 34)), [
2997
- [l]
2998
- ]);
2999
- };
3000
- }
3001
- });
3002
- const ll = /* @__PURE__ */ G(al, [["__scopeId", "data-v-21bbe178"]]), sl = ["innerHTML"], il = { class: "main__toasts" }, rl = ["innerHTML"], ul = /* @__PURE__ */ q({
3003
- __name: "aeria-main",
3004
- setup(d) {
3005
- const r = se("meta"), a = D(() => r.themeOverride || r.theme);
3006
- return (t, l) => {
3007
- const s = At("router-view");
3008
- return o(), i("main", {
3009
- id: "main",
3010
- class: Q(`
3011
- main
3012
- main--${a.value}
3013
- ${a.value === "dark" && "tw-dark"}
3014
- `)
3015
- }, [
3016
- (o(), k(Bt, null, {
3017
- default: v(() => [
3018
- R(s, null, {
3019
- default: v(({ Component: u }) => [
3020
- (o(), k(he(u), null, ue({ _: 2 }, [
3021
- U(Object.keys(t.$slots), (y) => ({
3022
- name: y,
3023
- fn: v(() => [
3024
- O(t.$slots, y, {}, void 0, !0)
3025
- ])
3026
- }))
3027
- ]), 1024))
3028
- ]),
3029
- _: 3
3030
- })
3031
- ]),
3032
- _: 3
3033
- })),
3034
- O(t.$slots, "default", {}, void 0, !0),
3035
- R(Ae, E({
3036
- modelValue: e(r).modal.visible,
3037
- "onUpdate:modelValue": l[0] || (l[0] = (u) => e(r).modal.visible = u),
3038
- float: "",
3039
- "close-hint": ""
3040
- }, e(r).modal, {
3041
- "overlay-layer": 70,
3042
- onOverlayClick: l[1] || (l[1] = (u) => e(r).modal.visible = !1)
3043
- }), {
3044
- default: v(() => [
3045
- e(r).modal.body ? (o(), i("div", {
3046
- key: 0,
3047
- style: { "white-space": "pre-wrap" },
3048
- innerHTML: e(r).modal.body
3049
- }, null, 8, sl)) : h("", !0),
3050
- e(r).modal.component ? (o(), k(he(e(r).modal.component), { key: 1 })) : h("", !0)
3051
- ]),
3052
- _: 1
3053
- }, 16, ["modelValue"]),
3054
- e(r).prompt.visible ? (o(), k(tl, de(E({ key: 0 }, e(r).prompt)), {
3055
- default: v(() => [
3056
- H(V(e(r).prompt.body), 1)
3057
- ]),
3058
- _: 1
3059
- }, 16)) : h("", !0),
3060
- C("div", il, [
3061
- (o(!0), i(Z, null, U(e(r).toasts, (u) => (o(), k(ll, E({ ref_for: !0 }, u, {
3062
- key: `toast-${u.itr}`
3063
- }), {
3064
- default: v(() => [
3065
- C("div", {
3066
- innerHTML: e(z)(u.text)
3067
- }, null, 8, rl)
3068
- ]),
3069
- _: 2
3070
- }, 1040))), 128))
3071
- ])
3072
- ], 2);
3073
- };
3074
- }
3075
- });
3076
- const zl = /* @__PURE__ */ G(ul, [["__scopeId", "data-v-1166be3d"]]);
3077
- const cl = {}, dl = { class: "menu" };
3078
- function pl(d, r) {
3079
- return o(), i("menu", dl, [
3080
- (o(!0), i(Z, null, U(Object.keys(d.$slots), (a) => (o(), i("div", {
3081
- key: a,
3082
- class: "menu__entry"
3083
- }, [
3084
- O(d.$slots, a, {}, void 0, !0)
3085
- ]))), 128))
3086
- ]);
3087
- }
3088
- const Ml = /* @__PURE__ */ G(cl, [["render", pl], ["__scopeId", "data-v-3cfef7fb"]]), _l = { class: "tabs" }, ml = {
3089
- key: 0,
3090
- class: "tabs__horizontal"
3091
- }, fl = {
3092
- key: 0,
3093
- class: "tabs__tab tabs__tab--info"
3094
- }, vl = ["onClick"], yl = {
3095
- key: 1,
3096
- class: "tabs__context-menu"
3097
- }, hl = ["onClick"], $l = /* @__PURE__ */ q({
3098
- __name: "aeria-tabs",
3099
- props: {
3100
- query: {},
3101
- param: {},
3102
- dropdown: { type: Boolean }
3103
- },
3104
- setup(d) {
3105
- const r = d, a = wt(), t = Oe(), l = Re(), s = "query" in r && r.query ? "query" : "params", u = D(() => {
3106
- const c = t.currentRoute.value[s][r.query || r.param];
3107
- return c || Object.keys(a)[0];
3108
- }), y = (c) => {
3109
- if (s === "query") {
3110
- t.push({
3111
- query: {
3112
- ...t.currentRoute.value.query,
3113
- [r.query]: c
3114
- }
3115
- });
3116
- return;
3117
- }
3118
- t.push({
3119
- params: {
3120
- [r.param]: c
3121
- }
3122
- });
3123
- };
3124
- return (c, $) => {
3125
- const m = te("clickable");
3126
- return o(), i("div", _l, [
3127
- e(l).md && !c.dropdown ? (o(), i("div", ml, [
3128
- c.$slots.default ? (o(), i("div", fl, [
3129
- O(c.$slots, "default", {}, void 0, !0)
3130
- ])) : h("", !0),
3131
- (o(!0), i(Z, null, U(Object.keys(c.$slots).filter((n) => n !== "default"), (n, f) => (o(), i("div", {
3132
- key: n,
3133
- class: Q({
3134
- tabs__tab: !0,
3135
- "tabs__tab--current": n === u.value || !u.value && f === 0
3136
- }),
3137
- onClick: (b) => y(n)
3138
- }, [
3139
- O(c.$slots, n, {}, void 0, !0)
3140
- ], 10, vl))), 128))
3141
- ])) : (o(), i("div", yl, [
3142
- R(Ce, null, ue({
3143
- default: v(() => [
3144
- P((o(), k(N, {
3145
- "icon-right": "",
3146
- icon: "caret-down",
3147
- style: { "--icon-color": "var(--theme-brand-color-shade-1)" },
3148
- class: "tabs__context-menu-icon"
3149
- }, {
3150
- default: v(() => [
3151
- O(c.$slots, u.value, {}, void 0, !0)
3152
- ]),
3153
- _: 3
3154
- })), [
3155
- [m]
3156
- ])
3157
- ]),
3158
- _: 2
3159
- }, [
3160
- U(Object.keys(c.$slots).filter((n) => n !== "default"), (n) => ({
3161
- name: n,
3162
- fn: v(() => [
3163
- C("div", {
3164
- onClick: (f) => y(n)
3165
- }, [
3166
- O(c.$slots, n, {}, void 0, !0)
3167
- ], 8, hl)
3168
- ])
3169
- }))
3170
- ]), 1024)
3171
- ]))
3172
- ]);
3173
- };
3174
- }
3175
- });
3176
- const bl = /* @__PURE__ */ G($l, [["__scopeId", "data-v-4dd516ec"]]), gl = q({
3177
- props: {
3178
- initialValue: String,
3179
- promise: Promise
3180
- },
3181
- setup(d) {
3182
- const r = X(d.initialValue);
3183
- return d.promise instanceof Promise && d.promise.then((a) => {
3184
- r.value = a;
3185
- }), () => St("div", r.value);
3186
- }
3187
- }), kl = ["onClick"], Vl = { key: 1 }, Cl = /* @__PURE__ */ q({
3188
- __name: "aeria-crud-topbar",
3189
- props: {
3190
- collection: {}
3191
- },
3192
- setup(d) {
3193
- const r = d, t = Oe().currentRoute, l = D(() => {
3194
- try {
3195
- const s = r.collection ? r.collection : t.value.meta.collection || t.value.params.collection;
3196
- return ge(s);
3197
- } catch {
3198
- return null;
3199
- }
3200
- });
3201
- return (s, u) => l.value && l.value.description.filtersPresets ? (o(), k(bl, {
3202
- key: 0,
3203
- dropdown: "",
3204
- query: "section"
3205
- }, ue({ _: 2 }, [
3206
- U(Object.entries(l.value.description.filtersPresets), ([y, c]) => ({
3207
- name: y,
3208
- fn: v(() => [
3209
- C("div", {
3210
- class: "topbar__preset",
3211
- onClick: ($) => e(kt)(c, l.value)
3212
- }, [
3213
- c.icon ? (o(), k(N, {
3214
- key: 0,
3215
- icon: c.icon
3216
- }, {
3217
- default: v(() => [
3218
- H(V(c.label || e(z)(y, { plural: !0 })), 1)
3219
- ]),
3220
- _: 2
3221
- }, 1032, ["icon"])) : (o(), i("div", Vl, V(c.label || e(z)(y, { plural: !0 })), 1)),
3222
- c.badgeFunction ? (o(), k(be, { key: 2 }, {
3223
- default: v(() => [
3224
- R(e(gl), {
3225
- "initial-value": "0",
3226
- promise: l.value.$functions[c.badgeFunction]({ filters: c.filters })
3227
- }, null, 8, ["promise"])
3228
- ]),
3229
- _: 2
3230
- }, 1024)) : h("", !0)
3231
- ], 8, kl)
3232
- ])
3233
- }))
3234
- ]), 1024)) : h("", !0);
3235
- }
3236
- });
3237
- const Il = /* @__PURE__ */ G(Cl, [["__scopeId", "data-v-326eee9d"]]), Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3238
- __proto__: null,
3239
- default: Il
3240
- }, Symbol.toStringTag, { value: "Module" })), Fl = /* @__PURE__ */ q({
3241
- __name: "aeria-password-form",
3242
- props: {
3243
- modelValue: {}
3244
- },
3245
- emits: ["update:modelValue"],
3246
- setup(d) {
3247
- const r = d;
3248
- ye(De, null);
3249
- const a = Et(), t = D(() => a(
3250
- r.modelValue.password,
3251
- r.modelValue.confirmation
3252
- ));
3253
- return (l, s) => (o(), k(Qe, {
3254
- form: {
3255
- password: {
3256
- type: "string",
3257
- icon: "key",
3258
- inputType: "password"
3259
- },
3260
- confirmation: {
3261
- type: "string",
3262
- icon: "key",
3263
- inputType: "password"
3264
- }
3265
- },
3266
- "model-value": l.modelValue,
3267
- "onUpdate:modelValue": s[0] || (s[0] = (u) => l.$emit("update:modelValue", u))
3268
- }, {
3269
- after: v(() => [
3270
- C("div", null, V(t.value || "Senhas conferem"), 1),
3271
- O(l.$slots, "default", de(Ve({ passwordError: t.value })))
3272
- ]),
3273
- _: 3
3274
- }, 8, ["model-value"]));
3275
- }
3276
- }), ql = (d, r = []) => ({
3277
- path: "/user",
3278
- name: "/builtin:user",
3279
- component: d,
3280
- children: r.concat([
3281
- {
3282
- path: "invite/:id",
3283
- name: "/user/invite/:id",
3284
- redirect: (a) => ({
3285
- path: "/user/signup",
3286
- params: {
3287
- inviteId: a.params.id
3288
- }
3289
- })
3290
- },
3291
- {
3292
- path: "signin",
3293
- name: "/user/signin",
3294
- component: () => import("./signin-847b157f.js"),
3295
- meta: {
3296
- title: "Autenticação"
3297
- }
3298
- },
3299
- {
3300
- path: "signup",
3301
- name: "/user/signup",
3302
- component: () => import("./signup-6a194afc.js"),
3303
- meta: {
3304
- title: "Registro"
3305
- }
3306
- },
3307
- {
3308
- path: "activation",
3309
- name: "/user/activation",
3310
- component: () => import("./activation-57b4c031.js"),
3311
- meta: {
3312
- title: "Ativação"
3313
- }
3314
- }
3315
- ])
3316
- }), Ul = (d, r = []) => ({
3317
- path: "/dashboard",
3318
- name: "/builtin:dashboard",
3319
- component: d,
3320
- redirect: {
3321
- name: "/dashboard/"
3322
- },
3323
- meta: {
3324
- title: "Dashboard"
3325
- },
3326
- children: r.concat([
3327
- {
3328
- path: "c/:collection",
3329
- name: "/dashboard/crud",
3330
- props: !0,
3331
- components: {
3332
- default: () => import("./index-1e2c789e.js"),
3333
- topbar: () => Promise.resolve().then(() => Ol)
3334
- },
3335
- meta: {
3336
- title: "%viewTitle%"
3337
- }
3338
- },
3339
- {
3340
- path: "c/:collection/:id/:section?",
3341
- name: "/dashboard/crud/:id",
3342
- props: !0,
3343
- components: {
3344
- default: () => import("./_id_-b18f0e75.js")
3345
- },
3346
- meta: {
3347
- title: "%viewTitle%"
3348
- }
3349
- },
3350
- {
3351
- path: "user",
3352
- name: "/dashboard/user",
3353
- meta: {
3354
- title: "user",
3355
- icon: "users",
3356
- collection: "user"
3357
- },
3358
- redirect: "/dashboard/c/user",
3359
- children: [
3360
- {
3361
- path: "profile",
3362
- component: () => import("./index-5f6fe3df.js"),
3363
- meta: {
3364
- title: "Meu perfil",
3365
- icon: "user-square"
3366
- }
3367
- },
3368
- {
3369
- path: "changepass",
3370
- name: "/dashboard/user/changepass",
3371
- component: () => import("./index-97e23443.js"),
3372
- meta: {
3373
- title: "Mudar senha",
3374
- icon: "lock"
3375
- }
3376
- }
3377
- ]
3378
- }
3379
- ])
3380
- });
3381
- export {
3382
- Qe as A,
3383
- gl as B,
3384
- tl as C,
3385
- ll as D,
3386
- Il as E,
3387
- ql as F,
3388
- Ul as G,
3389
- Fl as _,
3390
- ie as a,
3391
- N as b,
3392
- Qn as c,
3393
- Rl as d,
3394
- na as e,
3395
- qe as f,
3396
- Ml as g,
3397
- Ae as h,
3398
- G as i,
3399
- Ll as j,
3400
- be as k,
3401
- fe as l,
3402
- pn as m,
3403
- Ce as n,
3404
- Ua as o,
3405
- $n as p,
3406
- zl as q,
3407
- Mn as r,
3408
- Ma as s,
3409
- bl as t,
3410
- $o as u,
3411
- Ie as v,
3412
- Kn as w,
3413
- Mo as x,
3414
- He as y,
3415
- xn as z
3416
- };