@aeria-ui/ui 0.0.74 → 0.0.76

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