@aeria-ui/ui 0.0.116 → 0.0.118

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