@aeria-ui/ui 0.0.109 → 0.0.111

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