@anzusystems/common-admin 1.47.0-beta.99 → 1.47.0-beta.dev-1771794053

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.
package/dist/labs.js ADDED
@@ -0,0 +1,749 @@
1
+ import { bS as ve, d as D, j as U, k as Me, h as X, i as le, ai as be, aj as ye, ak as he, al as Ce, af as re, a$ as Ae, a9 as we, aa as _e, ab as xe, ac as ke, am as Fe, an as Pe, ad as Se, ae as Te, bT as Be, bU as Ee, bV as Ie, bW as qe, ar as De, bX as ce, ao as Je, ap as Ke, aT as He, F as Qe, a7 as We, b3 as Ye, aq as Ge, a1 as Oe, bY as Xe, q as Ze, p as et, x as tt, a6 as ot, aH as at, m as st, l as nt } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-BmclBDsI.mjs";
2
+ import { aD as ho, bZ as Co, b_ as Ao, az as wo, aA as _o, aC as xo, aE as ko, aB as Fo, aQ as Po, aI as So, bc as To, aF as Bo, aG as Eo, ax as Io, ay as Do, b$ as No, c4 as Vo, c5 as jo, c2 as Lo, c3 as Ro, ah as Uo, ag as zo, c0 as $o, c1 as Mo, c6 as qo } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-BmclBDsI.mjs";
3
+ import { defineComponent as ue, mergeModels as fe, useModel as lt, inject as Ne, computed as x, watch as ee, createElementBlock as z, openBlock as S, createElementVNode as F, createVNode as _, toDisplayString as k, unref as w, withCtx as P, createTextVNode as K, Fragment as de, renderList as Ve, createBlock as Z, normalizeClass as je, createCommentVNode as Le, withModifiers as Y, ref as W, onMounted as Re, toRaw as pe, resolveComponent as ge, renderSlot as R, mergeProps as rt, withDirectives as it, vShow as ct } from "vue";
4
+ import { useI18n as me } from "vue-i18n";
5
+ import { VBtn as Q } from "vuetify/components/VBtn";
6
+ import { VList as ut, VListItem as dt, VListItemTitle as mt } from "vuetify/components/VList";
7
+ import { VMenu as ft } from "vuetify/components/VMenu";
8
+ import { useThrottleFn as ae, useDebounceFn as pt } from "@vueuse/core";
9
+ import { VBtnToggle as gt } from "vuetify/components/VBtnToggle";
10
+ import Ue from "axios";
11
+ import { VCard as vt } from "vuetify/components/VCard";
12
+ import { VDialog as bt } from "vuetify/components/VDialog";
13
+ import { VSpacer as yt } from "vuetify/components/VGrid";
14
+ import { VIcon as ht } from "vuetify/components/VIcon";
15
+ import { VToolbar as Ct } from "vuetify/components/VToolbar";
16
+ import { VTooltip as At } from "vuetify/components/VTooltip";
17
+ import { Intersect as wt } from "vuetify/directives";
18
+ const _t = { class: "d-flex align-center justify-center" }, xt = { class: "text-body-small mr-1" }, uo = /* @__PURE__ */ ue({
19
+ __name: "ADatatableOrdering",
20
+ props: /* @__PURE__ */ fe({
21
+ variant: { default: "id" },
22
+ customOptions: { default: void 0 },
23
+ paginationUpdateCustomCb: { type: Function, default: void 0 }
24
+ }, {
25
+ modelValue: {
26
+ default: 1,
27
+ required: !1
28
+ },
29
+ modelModifiers: {}
30
+ }),
31
+ emits: /* @__PURE__ */ fe(["sortByChange"], ["update:modelValue"]),
32
+ setup(t, { emit: b }) {
33
+ const p = t, e = b, d = lt(t, "modelValue"), l = Ne(ve);
34
+ if (D(l))
35
+ throw new Error("Incorrect provide/inject config.");
36
+ const { t: n } = me(), r = [
37
+ {
38
+ id: 1,
39
+ titleT: "common.system.datatable.ordering.mostRecent",
40
+ sortBy: { key: "createdAt", order: U.Desc }
41
+ },
42
+ {
43
+ id: 2,
44
+ titleT: "common.system.datatable.ordering.oldest",
45
+ sortBy: { key: "createdAt", order: U.Asc }
46
+ }
47
+ ], i = [
48
+ {
49
+ id: 1,
50
+ titleT: "common.system.datatable.ordering.mostRecent",
51
+ sortBy: { key: "id", order: U.Desc }
52
+ },
53
+ {
54
+ id: 2,
55
+ titleT: "common.system.datatable.ordering.oldest",
56
+ sortBy: { key: "id", order: U.Asc }
57
+ }
58
+ ], c = [
59
+ {
60
+ id: 3,
61
+ titleT: "common.system.datatable.ordering.mostRelevant",
62
+ sortBy: { key: Me, order: U.Desc }
63
+ },
64
+ {
65
+ id: 1,
66
+ titleT: "common.system.datatable.ordering.mostRecent",
67
+ sortBy: { key: "createdAt", order: U.Desc }
68
+ },
69
+ {
70
+ id: 2,
71
+ titleT: "common.system.datatable.ordering.oldest",
72
+ sortBy: { key: "createdAt", order: U.Asc }
73
+ }
74
+ ], C = x(() => {
75
+ const o = y.value.find((v) => v.id === d.value);
76
+ return o ? n(o.titleT) : "";
77
+ }), y = x(() => p.customOptions ? p.customOptions : p.variant === "most-relevant" ? c : p.variant === "id" ? i : r), h = (o) => {
78
+ d.value = o.id;
79
+ }, u = (o) => {
80
+ o.sortBy || (l.value = {
81
+ ...l.value,
82
+ sortBy: null
83
+ }, e("sortByChange", o)), l.value.sortBy = o.sortBy, e("sortByChange", o);
84
+ };
85
+ return ee(d, (o, v) => {
86
+ if (o === v) return;
87
+ const a = y.value.find((m) => m.id === o);
88
+ if (!D(a)) {
89
+ if (D(p.paginationUpdateCustomCb)) {
90
+ u(a);
91
+ return;
92
+ }
93
+ p.paginationUpdateCustomCb(a, l);
94
+ }
95
+ }), ee(
96
+ l,
97
+ (o, v) => {
98
+ if (o.sortBy?.key === v?.sortBy?.key && o.sortBy?.order === v?.sortBy?.order)
99
+ return;
100
+ const a = y.value.find((m) => o.sortBy?.key === m.sortBy?.key && o.sortBy?.order === m.sortBy?.order);
101
+ D(a) || (d.value = a.id);
102
+ },
103
+ { immediate: !0 }
104
+ ), (o, v) => (S(), z("div", _t, [
105
+ F("div", xt, k(w(n)("common.system.datatable.ordering.title")) + ": ", 1),
106
+ _(Q, {
107
+ variant: "text",
108
+ rounded: "xl",
109
+ size: "small",
110
+ "append-icon": "mdi-chevron-down"
111
+ }, {
112
+ default: P(() => [
113
+ K(k(C.value) + " ", 1),
114
+ _(ft, {
115
+ activator: "parent",
116
+ location: "bottom",
117
+ "close-on-content-click": ""
118
+ }, {
119
+ default: P(() => [
120
+ _(ut, {
121
+ density: "compact",
122
+ class: "pa-0"
123
+ }, {
124
+ default: P(() => [
125
+ (S(!0), z(de, null, Ve(y.value, (a) => (S(), Z(dt, {
126
+ key: a.id,
127
+ onClick: (m) => h(a)
128
+ }, {
129
+ default: P(() => [
130
+ _(mt, {
131
+ class: je({ "font-weight-bold": a.id === d.value })
132
+ }, {
133
+ default: P(() => [
134
+ K(k(w(n)(a.titleT)), 1)
135
+ ]),
136
+ _: 2
137
+ }, 1032, ["class"])
138
+ ]),
139
+ _: 2
140
+ }, 1032, ["onClick"]))), 128))
141
+ ]),
142
+ _: 1
143
+ })
144
+ ]),
145
+ _: 1
146
+ })
147
+ ]),
148
+ _: 1
149
+ })
150
+ ]));
151
+ }
152
+ }), kt = { class: "anzu-data-footer" }, Ft = {
153
+ key: 0,
154
+ class: "anzu-data-footer__page-limit"
155
+ }, Pt = { class: "anzu-data-footer__pagination" }, St = { class: "anzu-data-footer__icons-before" }, Tt = { class: "current-page" }, Bt = { class: "anzu-data-footer__icons-after" }, Et = /* @__PURE__ */ ue({
156
+ __name: "ADatatablePagination",
157
+ props: {
158
+ itemsPerPageOptions: { default: () => [10, 25, 50] },
159
+ hideRecordsPerPage: { type: Boolean, default: !1 }
160
+ },
161
+ emits: ["change"],
162
+ setup(t, { emit: b }) {
163
+ const p = b, e = Ne(ve);
164
+ if (D(e))
165
+ throw new Error("Incorrect provide/inject config.");
166
+ const { t: d } = me(), l = x(() => Math.ceil(e.value.totalCount / e.value.rowsPerPage)), n = x(() => e.value.page * e.value.rowsPerPage - e.value.rowsPerPage + 1), r = x(() => e.value.page * e.value.rowsPerPage - e.value.rowsPerPage + e.value.currentViewCount), i = x(() => e.value.page === 1), c = x(() => !X(e.value.hasNextPage) || e.value.page === l.value), C = x(() => X(e.value.hasNextPage) && e.value.page === l.value || e.value.hasNextPage === !1), y = x(() => X(e.value.hasNextPage) ? e.value.totalCount : e.value.hasNextPage ? r.value + 1 + "+" : r.value);
167
+ ee(
168
+ () => e.value.rowsPerPage,
169
+ (a, m) => {
170
+ a !== m && (e.value.page = 1, p("change"));
171
+ }
172
+ ), ee(
173
+ () => e.value.page,
174
+ (a, m) => {
175
+ a !== m && p("change");
176
+ }
177
+ );
178
+ const h = ae(() => {
179
+ e.value.page = 1;
180
+ }, 300), u = ae(() => {
181
+ e.value.page = l.value;
182
+ }, 300), o = ae(() => {
183
+ e.value.page = e.value.page - 1;
184
+ }, 300), v = ae(() => {
185
+ e.value.page = e.value.page + 1;
186
+ }, 300);
187
+ return (a, m) => (S(), z("div", kt, [
188
+ t.hideRecordsPerPage ? Le("", !0) : (S(), z("div", Ft, [
189
+ K(k(w(d)("common.system.datatable.itemsPerPage")) + ": ", 1),
190
+ _(gt, {
191
+ modelValue: w(e).rowsPerPage,
192
+ "onUpdate:modelValue": m[0] || (m[0] = (T) => w(e).rowsPerPage = T),
193
+ class: "ml-2",
194
+ density: "compact",
195
+ mandatory: "",
196
+ "data-cy": "table-size"
197
+ }, {
198
+ default: P(() => [
199
+ (S(!0), z(de, null, Ve(t.itemsPerPageOptions, (T) => (S(), Z(Q, {
200
+ key: T,
201
+ color: T === w(e).rowsPerPage ? "secondary" : "",
202
+ value: T,
203
+ density: "compact",
204
+ size: "small",
205
+ variant: "text"
206
+ }, {
207
+ default: P(() => [
208
+ K(k(T), 1)
209
+ ]),
210
+ _: 2
211
+ }, 1032, ["color", "value"]))), 128))
212
+ ]),
213
+ _: 1
214
+ }, 8, ["modelValue"])
215
+ ])),
216
+ F("div", Pt, k(n.value) + " - " + k(r.value) + " " + k(w(d)("common.system.datatable.from")) + " " + k(y.value), 1),
217
+ F("div", St, [
218
+ _(Q, {
219
+ disabled: i.value,
220
+ icon: "mdi-page-first",
221
+ size: "small",
222
+ variant: "text",
223
+ onClick: Y(w(h), ["stop"])
224
+ }, null, 8, ["disabled", "onClick"]),
225
+ _(Q, {
226
+ disabled: i.value,
227
+ icon: "mdi-chevron-left",
228
+ size: "small",
229
+ variant: "text",
230
+ onClick: Y(w(o), ["stop"])
231
+ }, null, 8, ["disabled", "onClick"])
232
+ ]),
233
+ F("div", Tt, [
234
+ F("span", null, k(w(e).page), 1)
235
+ ]),
236
+ F("div", Bt, [
237
+ _(Q, {
238
+ disabled: C.value,
239
+ icon: "mdi-chevron-right",
240
+ size: "small",
241
+ variant: "text",
242
+ onClick: Y(w(v), ["stop"])
243
+ }, null, 8, ["disabled", "onClick"]),
244
+ _(Q, {
245
+ disabled: c.value,
246
+ icon: "mdi-page-last",
247
+ size: "small",
248
+ variant: "text",
249
+ onClick: Y(w(u), ["stop"])
250
+ }, null, 8, ["disabled", "onClick"])
251
+ ])
252
+ ]));
253
+ }
254
+ }), It = (t, b, p = "id") => {
255
+ const { querySetLimit: e, querySetOffset: d, querySetOrder: l, queryBuild: n, queryAddFilter: r, queryAdd: i } = qe(), c = t.length;
256
+ return e(c), d(1, c), l(p, !1), b ? i(p, t.join(",")) : r("in", p, t.join(",")), n();
257
+ };
258
+ function mo(t, b, p, e, d, l, n, r) {
259
+ let i, c, C, y, h, u, o, v;
260
+ typeof t == "function" ? (i = t, c = b, C = p, y = e, h = d, u = l ?? {}, o = n ?? !1, v = r ?? "id") : (i = t.client, c = t.system, C = t.entity, y = t.urlTemplate, h = t.urlParams, u = t.options ?? {}, o = t.isSearchApi ?? !1, v = t.field ?? "id");
261
+ let a = null;
262
+ return {
263
+ executeFetch: async ($, N = void 0, g = void 0) => {
264
+ a = new AbortController();
265
+ let B, E;
266
+ typeof N == "object" && N !== null ? (B = N.urlTemplate, E = N.urlParams) : (B = N, E = g);
267
+ try {
268
+ const s = le(E) ? E : h, I = le(B) ? B : y;
269
+ if (D(I)) throw new Error("Url template is undefined");
270
+ const H = (D(s) ? I : be(I, s)) + It($, o, v), V = await i().get(H, {
271
+ ...u,
272
+ signal: a.signal
273
+ });
274
+ if (!ye(V.status))
275
+ throw new he(V.status);
276
+ if (V.data?.data)
277
+ return V.data.data;
278
+ if (V.status === Ce)
279
+ return [];
280
+ throw new re();
281
+ } catch (s) {
282
+ if (s instanceof DOMException && s.name === "AbortError")
283
+ return [];
284
+ throw Ae(s) ? s : we(s) ? new _e(s, s.config?.url) : xe(s) ? new ke(s, c, C, s) : Fe(s) ? new Pe(s, c, C, s) : Se(s) ? new Te(s, s) : Be(s) ? new Ee(s) : Ue.isAxiosError(s) ? (console.error("Axios error: " + y, s.cause), new Ie(s)) : (console.error("AnzuFatalError: ", s), new re(s));
285
+ } finally {
286
+ a = null;
287
+ }
288
+ },
289
+ abortFetch: () => {
290
+ a && a.abort();
291
+ }
292
+ };
293
+ }
294
+ function fo(t, b, p, e, d, l) {
295
+ let n, r, i, c, C, y;
296
+ typeof t == "function" ? (n = t, r = b, i = p, c = e, C = d, y = l ?? {}) : (n = t.client, r = t.system, i = t.entity, c = t.urlTemplate, C = t.urlParams, y = t.options ?? {});
297
+ let h = null;
298
+ return {
299
+ executeFetch: async (v, a, m = void 0, T = void 0, $ = "id", N = !0, g = 100, B = !1) => {
300
+ h = new AbortController();
301
+ let E, s, I, H, V, G;
302
+ typeof m == "object" && m !== null ? (E = m.urlTemplate, s = m.urlParams, I = m.sortBy ?? "id", H = m.sortDesc ?? !0, V = m.batchSize ?? 100, G = m.forceElastic ?? !1) : (E = m, s = T, I = $, H = N, V = g, G = B);
303
+ try {
304
+ const f = a.general.elastic || G ? "/search" : "", M = le(s) ? s : C, te = le(E) ? E : c;
305
+ if (D(te)) throw new Error("Url template is undefined");
306
+ const { pagination: A } = De(
307
+ I,
308
+ H ? U.Desc : U.Asc,
309
+ {
310
+ rowsPerPage: V
311
+ }
312
+ ), q = (D(M) ? te : be(te, M)) + f, j = [], L = await n().get(
313
+ q + ce(A, v, a),
314
+ {
315
+ ...y,
316
+ signal: h.signal
317
+ }
318
+ );
319
+ if (!ye(L.status))
320
+ throw new he(L.status);
321
+ if (L.data) {
322
+ const J = L.data;
323
+ if (j.push(...J.data), Je(J))
324
+ for (A.value.hasNextPage = J.hasNextPage; A.value.hasNextPage; ) {
325
+ A.value.page++;
326
+ const oe = (await n().get(
327
+ q + ce(A, v, a),
328
+ {
329
+ ...y,
330
+ signal: h.signal
331
+ }
332
+ )).data;
333
+ j.push(...oe.data), A.value.hasNextPage = oe.hasNextPage;
334
+ }
335
+ else if (Ke(J)) {
336
+ if (A.value.totalCount = J.totalCount, A.value.totalCount <= A.value.rowsPerPage)
337
+ return j;
338
+ const ie = [], oe = Math.ceil(A.value.totalCount / A.value.rowsPerPage);
339
+ for (let O = 1; O < oe; O++) {
340
+ const ze = { ...A.value, page: O + 1 }, $e = W(ze);
341
+ ie.push(
342
+ n().get(
343
+ q + ce($e, v, a),
344
+ {
345
+ ...y,
346
+ signal: h.signal
347
+ }
348
+ )
349
+ );
350
+ }
351
+ (await Promise.all(ie)).forEach((O) => {
352
+ j.push(...O.data.data);
353
+ });
354
+ }
355
+ return j;
356
+ }
357
+ if (L.status === Ce)
358
+ return [];
359
+ throw new re();
360
+ } catch (f) {
361
+ if (f instanceof DOMException && f.name === "AbortError")
362
+ return [];
363
+ throw Ae(f) ? f : we(f) ? new _e(f, f.config?.url) : xe(f) ? new ke(f, r, i, f) : Fe(f) ? new Pe(f, r, i, f) : Se(f) ? new Te(f, f) : Be(f) ? new Ee(f) : Ue.isAxiosError(f) ? (console.error("Axios error: " + c, f.cause), new Ie(f)) : (console.error("AnzuFatalError: ", f), new re(f));
364
+ } finally {
365
+ h = null;
366
+ }
367
+ },
368
+ abortFetch: () => {
369
+ h && h.abort();
370
+ }
371
+ };
372
+ }
373
+ const se = "/adm/v1/job", ne = "job";
374
+ function po(t, b) {
375
+ return {
376
+ useFetchJobList: () => We({ client: t, system: b, entity: ne, urlTemplate: se }),
377
+ fetchJob: (n) => Qe(t, se + "/:id", { id: n }, b, ne),
378
+ createJob: (n) => {
379
+ const r = Ye(n._resourceName).slice(4).replace("-kind-", "-kind/");
380
+ return Ge(t, n, se + "/:type", { type: r }, b, ne);
381
+ },
382
+ deleteJob: (n) => He(t, se + "/:id", { id: n }, b, ne)
383
+ };
384
+ }
385
+ const Dt = {
386
+ key: "",
387
+ title: void 0,
388
+ sortable: !1,
389
+ fixed: !1
390
+ }, Nt = {
391
+ storeColumnsLocalStorage: !0,
392
+ disableActions: !1,
393
+ customI18n: void 0,
394
+ showExpand: !1
395
+ };
396
+ function Vt(t, b, p, e, d = {}) {
397
+ const l = { ...Nt, ...d }, n = l.customI18n ?? Oe, { t: r } = n.global || n;
398
+ let i;
399
+ tt(l.storeColumnsLocalStorage) ? i = l.storeColumnsLocalStorage : ot(l.storeColumnsLocalStorage) && l.storeColumnsLocalStorage === !0 && (i = "table_" + p + "_" + e);
400
+ const c = t.map((u) => {
401
+ const o = { ...Dt, ...u };
402
+ return D(o.title) && (D(o.title) && Xe.includes(o.key) ? o.title = r("common.model.tracking." + o.key) : D(o.title) && p && e ? o.title = r(p + "." + e + ".model." + o.key) : o.title = ""), o;
403
+ }), C = x(() => {
404
+ const u = [];
405
+ return l.showExpand && u.push({ key: "data-table-expand", sortable: !1 }), c.forEach((o) => {
406
+ b.value.includes(o.key) || u.push(o);
407
+ }), l.disableActions || u.push({ key: "actions", sortable: !1, fixed: "end" }), u;
408
+ }), y = () => {
409
+ if (!i || !localStorage) return;
410
+ const u = localStorage.getItem(i);
411
+ if (!u) return;
412
+ const o = JSON.parse(u);
413
+ Ze(o) && et(o.hidden) && (b.value = o.hidden);
414
+ }, h = (u) => {
415
+ !i || !localStorage || localStorage.setItem(i, JSON.stringify({ hidden: u }));
416
+ };
417
+ return Re(() => {
418
+ y();
419
+ }), ee(b, (u) => {
420
+ h(u);
421
+ }), {
422
+ columnsAll: c,
423
+ columnsVisible: C,
424
+ columnsHidden: b
425
+ };
426
+ }
427
+ function go(t, b, p, e, d, l, n, r = null, i = void 0, c = void 0, C = !1, y = !1) {
428
+ const h = W(!1), u = W([]), o = W([]), v = W(!1), { pagination: a, setSortBy: m, incrementPage: T } = De(
429
+ X(r) ? null : r.key,
430
+ r?.order
431
+ ), { resetFilter: $, submitFilter: N } = at(l, n, {
432
+ storeFiltersLocalStorage: !1,
433
+ populateUrlParams: !1
434
+ }), { showErrorsDefault: g } = st(), { columnsVisible: B, columnsAll: E, columnsHidden: s } = Vt(
435
+ t,
436
+ b,
437
+ p,
438
+ e,
439
+ { storeColumnsLocalStorage: !1, disableActions: !y }
440
+ ), I = () => {
441
+ G(), M();
442
+ }, H = (A) => {
443
+ m(A.sortBy), M();
444
+ }, V = async () => {
445
+ v.value = !0, T();
446
+ try {
447
+ const A = await d(
448
+ a,
449
+ l,
450
+ n,
451
+ i,
452
+ c,
453
+ C
454
+ );
455
+ u.value.push(...A);
456
+ } catch (A) {
457
+ g(A);
458
+ } finally {
459
+ v.value = !1;
460
+ }
461
+ }, G = () => {
462
+ u.value = [], o.value = [];
463
+ }, f = async () => {
464
+ v.value = !0;
465
+ try {
466
+ u.value = await d(
467
+ a,
468
+ l,
469
+ n,
470
+ i,
471
+ c,
472
+ C
473
+ );
474
+ } catch (A) {
475
+ g(A);
476
+ } finally {
477
+ v.value = !1;
478
+ }
479
+ }, M = pt(async () => {
480
+ await f();
481
+ });
482
+ return {
483
+ items: u,
484
+ selected: o,
485
+ pagination: a,
486
+ columnsVisible: B,
487
+ columnsHidden: s,
488
+ columnsAll: E,
489
+ filterTouched: h,
490
+ loading: v,
491
+ onRowClick: (A) => {
492
+ const q = A.target;
493
+ if (!q || q.tagName === "INPUT" && q.type === "checkbox")
494
+ return;
495
+ const j = q.closest(".v-data-table__tr");
496
+ if (!j || !j.classList.contains("v-data-table__tr")) return;
497
+ const L = j.firstElementChild;
498
+ if (!L || !L.classList.contains("v-data-table__td")) return;
499
+ const J = L.querySelector("input");
500
+ J && J.click();
501
+ },
502
+ onFetchNextPage: V,
503
+ onOpen: I,
504
+ sortByChange: H,
505
+ getList: M,
506
+ resetFilter: () => $(a, M),
507
+ submitFilter: () => N(a, M)
508
+ };
509
+ }
510
+ const jt = { class: "d-flex flex-column w-100 px-1 align-center" }, Lt = { class: "d-flex justify-space-between w-100 align-center" }, Rt = { class: "d-flex align-center" }, Ut = { class: "d-flex align-center" }, zt = { class: "subject-select__sidebar system-border-r" }, $t = { class: "subject-select-filter" }, Mt = { class: "subject-select__content" }, qt = {
511
+ key: 0,
512
+ class: "d-flex w-100 align-center justify-center pa-4"
513
+ }, Jt = { class: "subject-select__actions system-border-t" }, Kt = { key: 0 }, Ht = { key: 1 }, vo = /* @__PURE__ */ ue({
514
+ __name: "ASubjectSelect",
515
+ props: {
516
+ selectedItems: {},
517
+ pagination: {},
518
+ loading: { type: Boolean, default: !1 },
519
+ minCount: { default: 1 },
520
+ maxCount: { default: 1 },
521
+ modelValue: { type: Boolean, default: void 0 },
522
+ dialogTitleT: { default: "common.subjectSelect.texts.title" },
523
+ paginationMode: { default: "standard" },
524
+ autoOpen: { type: Boolean, default: !1 }
525
+ },
526
+ emits: ["update:modelValue", "update:pagination", "onOpen", "onPageChange", "onConfirm", "onFetchNextPage"],
527
+ setup(t, { expose: b, emit: p }) {
528
+ const e = t, d = p, l = W(!1), n = x({
529
+ get() {
530
+ return D(e.modelValue) ? l.value : e.modelValue;
531
+ },
532
+ set(g) {
533
+ l.value = g, d("update:modelValue", g);
534
+ }
535
+ }), r = x({
536
+ get: () => e.pagination,
537
+ set: (g) => {
538
+ d("update:pagination", { ...pe(g) });
539
+ }
540
+ }), i = W(!0), { t: c } = me(), C = x(() => e.selectedItems.length), y = x(() => C.value < e.minCount || C.value > e.maxCount), h = () => {
541
+ d("onOpen"), i.value = !0, n.value = !0;
542
+ }, u = () => {
543
+ i.value = !i.value;
544
+ }, o = () => {
545
+ n.value = !1;
546
+ }, v = () => {
547
+ d(
548
+ "onConfirm",
549
+ e.selectedItems.map((g) => pe(g))
550
+ ), o();
551
+ }, a = () => {
552
+ d("onFetchNextPage");
553
+ }, m = () => {
554
+ d("onPageChange");
555
+ }, T = x(() => Math.ceil(r.value.totalCount / r.value.rowsPerPage)), $ = x(() => !(X(r.value.hasNextPage) && r.value.page === T.value || r.value.hasNextPage === !1)), N = (g) => {
556
+ g && $.value && !e.loading && a();
557
+ };
558
+ return Re(() => {
559
+ e.autoOpen && h();
560
+ }), b({
561
+ open: h
562
+ }), (g, B) => {
563
+ const E = ge("ABtnSecondary"), s = ge("ABtnPrimary");
564
+ return S(), z(de, null, [
565
+ R(g.$slots, "activator", {
566
+ props: { onClick: Y(() => h(), ["stop"]) }
567
+ }),
568
+ _(bt, rt(g.$attrs, {
569
+ "model-value": n.value,
570
+ fullscreen: "",
571
+ class: "subject-select",
572
+ "onUpdate:modelValue": B[1] || (B[1] = (I) => d("update:modelValue", I))
573
+ }), {
574
+ default: P(() => [
575
+ n.value ? (S(), Z(vt, {
576
+ key: 0,
577
+ class: "subject-select__card"
578
+ }, {
579
+ default: P(() => [
580
+ _(nt, {
581
+ class: "subject-select__toolbar system-border-b",
582
+ onOnCancel: o
583
+ }, {
584
+ default: P(() => [
585
+ R(g.$slots, "title", {}, () => [
586
+ K(k(w(c)(t.dialogTitleT)), 1)
587
+ ])
588
+ ]),
589
+ _: 3
590
+ }),
591
+ _(Ct, {
592
+ density: "compact",
593
+ color: "transparent",
594
+ height: 46,
595
+ elevation: "0",
596
+ class: "system-border-b subject-select__second-bar"
597
+ }, {
598
+ default: P(() => [
599
+ R(g.$slots, "second-bar", {}, () => [
600
+ F("div", jt, [
601
+ F("div", Lt, [
602
+ F("div", Rt, [
603
+ _(Q, {
604
+ icon: "",
605
+ width: 30,
606
+ height: 30,
607
+ onClick: u
608
+ }, {
609
+ default: P(() => [
610
+ _(ht, {
611
+ icon: "mdi-tune",
612
+ size: 16
613
+ }),
614
+ _(At, {
615
+ activator: "parent",
616
+ location: "bottom"
617
+ }, {
618
+ default: P(() => [
619
+ K(k(w(c)("common.subjectSelect.filter.toggle")), 1)
620
+ ]),
621
+ _: 1
622
+ })
623
+ ]),
624
+ _: 1
625
+ }),
626
+ R(g.$slots, "second-bar-left")
627
+ ]),
628
+ F("div", Ut, [
629
+ R(g.$slots, "second-bar-right")
630
+ ])
631
+ ])
632
+ ])
633
+ ])
634
+ ]),
635
+ _: 3
636
+ }),
637
+ F("div", {
638
+ class: je(["subject-select__main", { "subject-select__main--sidebar-active": i.value }])
639
+ }, [
640
+ F("div", zt, [
641
+ F("div", $t, [
642
+ R(g.$slots, "filter")
643
+ ])
644
+ ]),
645
+ F("div", Mt, [
646
+ R(g.$slots, "content"),
647
+ t.paginationMode === "more" ? (S(), z("div", qt, [
648
+ it((S(), Z(E, {
649
+ loading: t.loading,
650
+ size: "small",
651
+ onClick: a
652
+ }, {
653
+ default: P(() => [
654
+ R(g.$slots, "button-confirm-title", {}, () => [
655
+ K(k(w(c)("common.button.loadMore")), 1)
656
+ ])
657
+ ]),
658
+ _: 3
659
+ }, 8, ["loading"])), [
660
+ [ct, $.value || t.loading],
661
+ [
662
+ wt,
663
+ N,
664
+ void 0,
665
+ { quiet: !0 }
666
+ ]
667
+ ])
668
+ ])) : (S(), Z(Et, {
669
+ key: 1,
670
+ modelValue: r.value,
671
+ "onUpdate:modelValue": B[0] || (B[0] = (I) => r.value = I),
672
+ onChange: m
673
+ }, null, 8, ["modelValue"]))
674
+ ])
675
+ ], 2),
676
+ F("div", Jt, [
677
+ t.minCount === t.maxCount ? (S(), z("div", Kt, k(w(c)("common.subjectSelect.texts.pickExactCount", {
678
+ count: t.minCount,
679
+ selected: C.value
680
+ })), 1)) : (S(), z("div", Ht, k(w(c)("common.subjectSelect.texts.pickRangeCount", {
681
+ minCount: t.minCount,
682
+ maxCount: t.maxCount,
683
+ selected: C.value
684
+ })), 1)),
685
+ _(yt),
686
+ _(s, {
687
+ disabled: y.value,
688
+ onClick: Y(v, ["stop"])
689
+ }, {
690
+ default: P(() => [
691
+ R(g.$slots, "button-confirm-title", {}, () => [
692
+ K(k(w(c)("common.button.confirm")), 1)
693
+ ])
694
+ ]),
695
+ _: 3
696
+ }, 8, ["disabled"])
697
+ ])
698
+ ]),
699
+ _: 3
700
+ })) : Le("", !0)
701
+ ]),
702
+ _: 3
703
+ }, 16, ["model-value"])
704
+ ], 64);
705
+ };
706
+ }
707
+ });
708
+ export {
709
+ uo as ADatatableOrdering,
710
+ Et as ADatatablePagination,
711
+ ho as AFilterBooleanSelect,
712
+ Co as AFilterDatetimePicker,
713
+ Ao as AFilterInteger,
714
+ wo as AFilterRemoteAutocomplete,
715
+ _o as AFilterRemoteAutocompleteWithMinimal,
716
+ xo as AFilterString,
717
+ ko as AFilterTimeInterval,
718
+ Fo as AFilterValueObjectOptionsSelect,
719
+ Po as AFilterWrapper,
720
+ So as AFilterWrapperSubjectSelect,
721
+ To as AFormRemoteAutocomplete,
722
+ vo as ASubjectSelect,
723
+ ve as DatatablePaginationKey,
724
+ Bo as FilterConfigKey,
725
+ Eo as FilterDataKey,
726
+ Io as FilterInnerConfigKey,
727
+ Do as FilterInnerDataKey,
728
+ No as TimeIntervalSpecialOptions,
729
+ Vo as UserAdminConfigLayoutType,
730
+ jo as UserAdminConfigLayoutTypeDefault,
731
+ Lo as UserAdminConfigType,
732
+ Ro as UserAdminConfigTypeDefault,
733
+ Vt as createDatatableColumnsConfig,
734
+ Uo as createFilter,
735
+ zo as createFilterStore,
736
+ ce as generateListQuery,
737
+ mo as useApiFetchByIds,
738
+ We as useApiFetchList,
739
+ fo as useApiFetchListBatch,
740
+ qe as useApiQueryBuilder,
741
+ $o as useApiRequest,
742
+ at as useFilterHelpers,
743
+ po as useJobApi,
744
+ De as usePagination,
745
+ go as useSubjectSelect,
746
+ Mo as useUserAdminConfigApi,
747
+ qo as useUserAdminConfigFactory
748
+ };
749
+ //# sourceMappingURL=labs.js.map