@aeria-ui/ui 0.0.188 → 0.0.190

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