@aeria-ui/ui 0.0.19 → 0.0.21

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