@aeria-ui/ui 0.0.85 → 0.0.87

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