@jsg-developer/vue-pack 0.0.1 → 0.0.2

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,2142 +0,0 @@
1
- import { defineComponent as ue, createElementBlock as s, openBlock as n, mergeProps as Ve, renderSlot as qe, createTextVNode as oe, toDisplayString as k, ref as V, computed as X, inject as Ge, createCommentVNode as L, createVNode as I, createElementVNode as a, unref as l, normalizeClass as re, Fragment as W, renderList as q, createBlock as ce, normalizeStyle as je, onMounted as Se, onUnmounted as Qe, Transition as De, withCtx as Me, withModifiers as Je, watch as Ae, nextTick as $e, withKeys as ze, toRaw as Te, provide as Xe, withDirectives as He, isRef as Ke, vModelText as Ye, vModelCheckbox as Fe } from "vue";
2
- import { aa as me, m as Ue, ab as et, y as ke, a9 as fe, ac as tt, x as at, w as Be, L as nt, F as st } from "./TabelData.vue_vue_type_style_index_0_scoped_76b9b7a6_lang-Dtm1AO8H.js";
3
- const it = ["src", "alt"], lt = /* @__PURE__ */ ue({
4
- __name: "BaseImage",
5
- props: {
6
- src: {},
7
- alt: {}
8
- },
9
- setup(e) {
10
- return (d, r) => (n(), s("img", Ve({
11
- src: e.src,
12
- alt: e.alt,
13
- loading: "lazy",
14
- decoding: "async",
15
- class: "image-cover"
16
- }, d.$attrs), null, 16, it));
17
- }
18
- }), ys = /* @__PURE__ */ me(lt, [["__scopeId", "data-v-42adc665"]]), ot = { class: "base-label" }, rt = /* @__PURE__ */ ue({
19
- __name: "BaseLabel",
20
- props: {
21
- label: {}
22
- },
23
- setup(e) {
24
- return (d, r) => (n(), s("label", ot, [
25
- qe(d.$slots, "default", {}, () => [
26
- oe(k(e.label), 1)
27
- ], !0)
28
- ]));
29
- }
30
- }), P = /* @__PURE__ */ me(rt, [["__scopeId", "data-v-1f7d7c4b"]]);
31
- function Ie(e = "id-ID", d = "Asia/Jakarta") {
32
- let r = e, o = d;
33
- try {
34
- typeof navigator < "u" && (r = navigator.language || e), o = Intl.DateTimeFormat().resolvedOptions().timeZone || d;
35
- } catch {
36
- }
37
- return { locale: r, timeZone: o };
38
- }
39
- function Le(e, d = "id-ID") {
40
- const r = Intl.DateTimeFormat.supportedLocalesOf([e]);
41
- return r.length > 0 ? r[0] : d;
42
- }
43
- function Ne(e) {
44
- return e instanceof Date && !isNaN(e.getTime());
45
- }
46
- const ct = (e) => {
47
- try {
48
- if (!e) return "-";
49
- const d = new Date(e);
50
- if (!Ne(d)) return e;
51
- const { locale: r, timeZone: o } = Ie();
52
- return d.toLocaleDateString(Le(r), {
53
- weekday: "long",
54
- year: "numeric",
55
- month: "long",
56
- day: "numeric",
57
- timeZone: o
58
- });
59
- } catch {
60
- return e;
61
- }
62
- }, ut = (e) => {
63
- try {
64
- if (!e) return "-";
65
- const d = /* @__PURE__ */ new Date(`1970-01-01T${e}`);
66
- if (!Ne(d)) return e;
67
- const { locale: r, timeZone: o } = Ie();
68
- return d.toLocaleTimeString(Le(r), {
69
- hour: "2-digit",
70
- minute: "2-digit",
71
- timeZone: o
72
- });
73
- } catch {
74
- return e;
75
- }
76
- }, dt = (e) => {
77
- try {
78
- if (!e) return "-";
79
- const d = new Date(e);
80
- if (!Ne(d)) return e;
81
- const { locale: r, timeZone: o } = Ie();
82
- return d.toLocaleString(Le(r), {
83
- weekday: "short",
84
- year: "numeric",
85
- month: "short",
86
- day: "numeric",
87
- hour: "2-digit",
88
- minute: "2-digit",
89
- timeZone: o
90
- });
91
- } catch {
92
- return e;
93
- }
94
- }, vt = ["id"], mt = { key: 0 }, ht = { class: "field-value" }, yt = { key: 1 }, ft = ["innerHTML"], bt = {
95
- key: 1,
96
- class: "field-value"
97
- }, gt = { key: 2 }, kt = ["innerHTML"], wt = {
98
- key: 1,
99
- class: "field-value"
100
- }, pt = { key: 3 }, _t = { class: "password-wrapper" }, Ct = { class: "password-text" }, Dt = { key: 4 }, Mt = { class: "field-value" }, $t = { key: 5 }, At = { class: "field-value" }, Tt = { key: 6 }, xt = { class: "field-value" }, Ot = { key: 7 }, jt = { key: 8 }, Ht = { key: 0 }, Kt = ["href"], Bt = {
101
- key: 1,
102
- class: "file-info"
103
- }, Vt = { class: "file-size" }, St = ["href"], It = {
104
- key: 1,
105
- class: "no-value"
106
- }, Lt = { key: 9 }, Nt = {
107
- key: 0,
108
- class: "file-array-container"
109
- }, Ft = ["href"], Pt = {
110
- key: 1,
111
- class: "file-info"
112
- }, Et = { class: "file-size" }, zt = ["href"], Ut = {
113
- key: 1,
114
- class: "no-value"
115
- }, Wt = { key: 10 }, Rt = { class: "field-value" }, Zt = { key: 11 }, qt = { class: "field-value" }, Gt = { key: 12 }, Qt = ["href"], Jt = { key: 13 }, Xt = { class: "field-value" }, Yt = { key: 14 }, ea = {
116
- key: 0,
117
- class: "object-container"
118
- }, ta = {
119
- key: 1,
120
- class: "no-value"
121
- }, aa = { key: 15 }, na = { key: 0 }, sa = ["src"], ia = {
122
- key: 1,
123
- class: "no-value"
124
- }, la = { key: 16 }, oa = {
125
- key: 0,
126
- class: "image-array-container"
127
- }, ra = ["src", "alt", "onClick"], ca = {
128
- key: 1,
129
- class: "no-value"
130
- }, ua = { key: 17 }, da = { class: "color-container" }, va = ["title", "onClick"], ma = {
131
- key: 1,
132
- class: "no-value"
133
- }, ha = { key: 18 }, ya = { class: "field-value" }, fa = { key: 19 }, ba = {
134
- key: 0,
135
- class: "array-object-container"
136
- }, ga = {
137
- key: 1,
138
- class: "no-value"
139
- }, ka = {
140
- key: 1,
141
- class: "field-wrapper"
142
- }, wa = { class: "option-group-grid" }, pa = /* @__PURE__ */ ue({
143
- __name: "FieldDetailRenderer",
144
- props: {
145
- field: {},
146
- fieldKey: {},
147
- formData: {},
148
- requiredText: {},
149
- valueNullView: { type: Boolean },
150
- optionalText: {},
151
- lang: {}
152
- },
153
- emits: ["image-click"],
154
- setup(e, { emit: d }) {
155
- const r = V(!1), o = e, c = d, t = X(() => o.formData?.[o.fieldKey]), h = X(() => {
156
- const b = t.value;
157
- return o.valueNullView && o.field.type !== "optionGroupSchema" ? !0 : b != null && b !== "";
158
- }), y = Ge("TableComponents", {
159
- labels: V(Ue[o.lang ?? "en"])
160
- }).labels, i = X(() => {
161
- let b = o.field.label || o.fieldKey || "";
162
- return o.field.type === "optionGroupSchema" ? o.field.label ?? "" : b;
163
- }), C = (b) => b instanceof File, O = (b) => URL.createObjectURL(b), F = (b) => {
164
- navigator.clipboard.writeText(b).then(() => console.log("Copied:", b)).catch(console.error);
165
- };
166
- return (b, S) => h.value ? (n(), s("div", {
167
- key: 0,
168
- class: "field-wrapper",
169
- id: e.fieldKey
170
- }, [
171
- e.field.type === "text" ? (n(), s("div", mt, [
172
- I(l(P), { label: i.value }, null, 8, ["label"]),
173
- a("p", ht, k(t.value || "-"), 1)
174
- ])) : e.field.type === "richText" ? (n(), s("div", yt, [
175
- I(l(P), { label: i.value }, null, 8, ["label"]),
176
- t.value ? (n(), s("div", {
177
- key: 0,
178
- class: "prose-content",
179
- innerHTML: t.value
180
- }, null, 8, ft)) : (n(), s("p", bt, "-"))
181
- ])) : e.field.type === "textArea" ? (n(), s("div", gt, [
182
- I(l(P), { label: i.value }, null, 8, ["label"]),
183
- t.value ? (n(), s("div", {
184
- key: 0,
185
- class: "prose-content",
186
- innerHTML: t.value
187
- }, null, 8, kt)) : (n(), s("p", wt, "-"))
188
- ])) : e.field.type === "password" ? (n(), s("div", pt, [
189
- I(l(P), { label: i.value }, null, 8, ["label"]),
190
- a("div", _t, [
191
- a("p", Ct, k(r.value ? t.value ?? "-" : t.value ? "•".repeat(String(t.value).length) : "-"), 1),
192
- t.value ? (n(), s("button", {
193
- key: 0,
194
- type: "button",
195
- class: "toggle-visibility-button",
196
- onClick: S[0] || (S[0] = ($) => r.value = !r.value)
197
- }, k(r.value ? "Hide" : "Show"), 1)) : L("", !0)
198
- ])
199
- ])) : e.field.type === "date" ? (n(), s("div", Dt, [
200
- I(l(P), { label: i.value }, null, 8, ["label"]),
201
- a("p", Mt, k(t.value ? l(ct)(t.value) : "-"), 1)
202
- ])) : e.field.type === "time" ? (n(), s("div", $t, [
203
- I(l(P), { label: i.value }, null, 8, ["label"]),
204
- a("p", At, k(t.value ? l(ut)(t.value) : "-"), 1)
205
- ])) : e.field.type === "dateTime" ? (n(), s("div", Tt, [
206
- I(l(P), { label: i.value }, null, 8, ["label"]),
207
- a("p", xt, k(t.value ? l(dt)(t.value) : "-"), 1)
208
- ])) : e.field.type === "toggle" ? (n(), s("div", Ot, [
209
- I(l(P), { label: i.value }, null, 8, ["label"]),
210
- a("p", {
211
- class: re(["toggle-badge", t.value ? "active" : "inactive"])
212
- }, k(t.value ? l(y).btn.toogle.active : l(y).btn.toogle.inactive) + " ⦿ ", 3)
213
- ])) : e.field.type === "file" ? (n(), s("div", jt, [
214
- I(l(P), { label: i.value }, null, 8, ["label"]),
215
- t.value ? (n(), s("div", Ht, [
216
- typeof t.value == "string" ? (n(), s("a", {
217
- key: 0,
218
- href: t.value,
219
- target: "_blank",
220
- rel: "noopener noreferrer",
221
- class: "file-link"
222
- }, k(t.value.split("/").pop() || t.value), 9, Kt)) : C(t.value) ? (n(), s("div", Bt, [
223
- a("span", null, k(t.value.name), 1),
224
- a("span", Vt, "(" + k((t.value.size / 1024).toFixed(1)) + " KB)", 1),
225
- a("a", {
226
- href: O(t.value),
227
- target: "_blank",
228
- rel: "noopener noreferrer",
229
- class: "file-preview-link"
230
- }, " Preview ", 8, St)
231
- ])) : L("", !0)
232
- ])) : (n(), s("div", It, "-"))
233
- ])) : e.field.type === "fileArray" ? (n(), s("div", Lt, [
234
- I(l(P), { label: i.value }, null, 8, ["label"]),
235
- Array.isArray(t.value) && t.value.length ? (n(), s("div", Nt, [
236
- (n(!0), s(W, null, q(t.value, ($, H) => (n(), s("div", { key: H }, [
237
- typeof $ == "string" ? (n(), s("a", {
238
- key: 0,
239
- href: $,
240
- target: "_blank",
241
- rel: "noopener noreferrer",
242
- class: "file-link"
243
- }, k($.split("/").pop() || $), 9, Ft)) : C($) ? (n(), s("div", Pt, [
244
- a("span", null, k($.name), 1),
245
- a("span", Et, "(" + k(($.size / 1024).toFixed(1)) + " KB)", 1),
246
- a("a", {
247
- href: O($),
248
- target: "_blank",
249
- rel: "noopener noreferrer",
250
- class: "file-preview-link"
251
- }, " Preview ", 8, zt)
252
- ])) : L("", !0)
253
- ]))), 128))
254
- ])) : (n(), s("div", Ut, "-"))
255
- ])) : e.field.type === "number" ? (n(), s("div", Wt, [
256
- I(l(P), { label: i.value }, null, 8, ["label"]),
257
- a("p", Rt, k(t.value ?? "-"), 1)
258
- ])) : e.field.type === "email" ? (n(), s("div", Zt, [
259
- I(l(P), { label: i.value }, null, 8, ["label"]),
260
- a("p", qt, k(t.value ?? "-"), 1)
261
- ])) : e.field.type === "url" ? (n(), s("div", Gt, [
262
- I(l(P), { label: i.value }, null, 8, ["label"]),
263
- a("a", {
264
- href: t.value,
265
- target: "_blank",
266
- rel: "noopener noreferrer",
267
- class: "url-link"
268
- }, k(t.value ?? "-"), 9, Qt)
269
- ])) : e.field.type === "tag" ? (n(), s("div", Jt, [
270
- I(l(P), { label: i.value }, null, 8, ["label"]),
271
- a("p", Xt, k(t.value ?? "-"), 1)
272
- ])) : e.field.type === "object" ? (n(), s("div", Yt, [
273
- I(l(P), { label: i.value }, null, 8, ["label"]),
274
- t.value && typeof t.value == "object" && Object.keys(t.value).length ? (n(), s("div", ea, [
275
- (n(!0), s(W, null, q(e.field.schema, ($, H) => (n(), ce(l(xe), {
276
- key: H,
277
- field: $,
278
- "field-key": H,
279
- "form-data": t.value,
280
- "value-null-view": e.valueNullView,
281
- "optional-text": e.optionalText,
282
- "required-text": e.requiredText,
283
- onImageClick: S[1] || (S[1] = (E) => c("image-click", E))
284
- }, null, 8, ["field", "field-key", "form-data", "value-null-view", "optional-text", "required-text"]))), 128))
285
- ])) : (n(), s("div", ta, "-"))
286
- ])) : e.field.type === "image" ? (n(), s("div", aa, [
287
- I(l(P), { label: i.value }, null, 8, ["label"]),
288
- t.value ? (n(), s("div", na, [
289
- a("img", {
290
- src: t.value,
291
- alt: "Image",
292
- class: "image-preview-single",
293
- onClick: S[2] || (S[2] = ($) => c("image-click", t.value))
294
- }, null, 8, sa)
295
- ])) : (n(), s("div", ia, "-"))
296
- ])) : e.field.type === "imageArray" ? (n(), s("div", la, [
297
- I(l(P), { label: i.value }, null, 8, ["label"]),
298
- Array.isArray(t.value) && t.value.length ? (n(), s("div", oa, [
299
- (n(!0), s(W, null, q(t.value, ($, H) => (n(), s("div", { key: H }, [
300
- a("img", {
301
- src: $,
302
- alt: `Image ${H + 1}`,
303
- class: "image-preview-multi",
304
- onClick: (E) => c("image-click", $)
305
- }, null, 8, ra)
306
- ]))), 128))
307
- ])) : (n(), s("div", ca, "-"))
308
- ])) : e.field.type === "color" ? (n(), s("div", ua, [
309
- I(l(P), { label: i.value }, null, 8, ["label"]),
310
- a("div", da, [
311
- Array.isArray(t.value) && t.value.length ? (n(!0), s(W, { key: 0 }, q(t.value, ($, H) => (n(), s("div", {
312
- key: H,
313
- class: "color-swatch",
314
- style: je({ backgroundColor: $ }),
315
- title: $,
316
- onClick: (E) => F($)
317
- }, null, 12, va))), 128)) : (n(), s("div", ma, "-"))
318
- ])
319
- ])) : e.field.type === "select" ? (n(), s("div", ha, [
320
- I(l(P), { label: i.value }, null, 8, ["label"]),
321
- a("p", ya, k(t.value || "-"), 1)
322
- ])) : e.field.type === "arrayObject" ? (n(), s("div", fa, [
323
- I(l(P), { label: i.value }, null, 8, ["label"]),
324
- Array.isArray(t.value) && t.value.length ? (n(), s("div", ba, [
325
- (n(!0), s(W, null, q(t.value, ($, H) => (n(), s("div", {
326
- key: H,
327
- class: "array-object-item"
328
- }, [
329
- (n(!0), s(W, null, q(e.field.schema, (E, B) => (n(), ce(l(xe), {
330
- key: B,
331
- field: E,
332
- "field-key": B,
333
- "form-data": $,
334
- "value-null-view": e.valueNullView,
335
- "optional-text": e.optionalText,
336
- "required-text": e.requiredText,
337
- onImageClick: S[3] || (S[3] = (p) => c("image-click", p))
338
- }, null, 8, ["field", "field-key", "form-data", "value-null-view", "optional-text", "required-text"]))), 128))
339
- ]))), 128))
340
- ])) : (n(), s("div", ga, "-"))
341
- ])) : L("", !0)
342
- ], 8, vt)) : e.field.type === "optionGroupSchema" ? (n(), s("div", ka, [
343
- e.formData[e.fieldKey] || i.value ? (n(), ce(l(P), {
344
- key: 0,
345
- label: e.formData[e.fieldKey] ? i.value + ":" + (e.formData[e.fieldKey] ?? "") : i.value,
346
- class: "option-group-main-label"
347
- }, null, 8, ["label"])) : L("", !0),
348
- a("div", wa, [
349
- (n(!0), s(W, null, q(e.field.options, ($, H) => (n(), s("div", {
350
- key: H,
351
- class: "option-group-item"
352
- }, [
353
- I(l(P), {
354
- label: H,
355
- class: "option-group-item-label"
356
- }, null, 8, ["label"]),
357
- S[5] || (S[5] = a("hr", { class: "option-group-divider" }, null, -1)),
358
- (n(!0), s(W, null, q($, (E, B) => (n(), ce(l(xe), {
359
- key: B,
360
- field: E,
361
- "field-key": B,
362
- "form-data": e.formData,
363
- "value-null-view": e.valueNullView,
364
- "optional-text": e.optionalText,
365
- "required-text": e.requiredText,
366
- onImageClick: S[4] || (S[4] = (p) => c("image-click", p))
367
- }, null, 8, ["field", "field-key", "form-data", "value-null-view", "optional-text", "required-text"]))), 128))
368
- ]))), 128))
369
- ])
370
- ])) : L("", !0);
371
- }
372
- }), xe = /* @__PURE__ */ me(pa, [["__scopeId", "data-v-77044b61"]]), _a = ["src", "alt"], Ca = /* @__PURE__ */ ue({
373
- __name: "ImagePreview",
374
- props: {
375
- imageUrl: {},
376
- watermarkUrl: { default: "https://res.cloudinary.com/doyufai9q/image/upload/v1754227461/Logo_transparent_b6qrek.png" },
377
- watermarkSize: { default: 4 },
378
- alt: { default: "" }
379
- },
380
- setup(e) {
381
- const d = e, r = V(null), o = V(!0), c = (h) => new Promise((v, y) => {
382
- const i = new Image();
383
- i.crossOrigin = "anonymous", i.onload = () => v(i), i.onerror = (C) => y(C), i.src = h;
384
- }), t = (h, v) => {
385
- const y = document.createElement("canvas"), i = y.getContext("2d");
386
- if (!i)
387
- return console.error("Gagal mendapatkan konteks canvas 2D."), h.src;
388
- y.width = h.width, y.height = h.height, i.drawImage(h, 0, 0);
389
- const C = h.width / d.watermarkSize, O = v.height / v.width * C, F = h.width - C - 10, b = h.height - O - 10;
390
- return i.globalAlpha = 0.8, i.drawImage(v, F, b, C, O), i.globalAlpha = 1, y.toDataURL("image/png");
391
- };
392
- return Se(async () => {
393
- try {
394
- const h = await c(d.imageUrl), v = await c(d.watermarkUrl);
395
- r.value = t(h, v);
396
- } catch (h) {
397
- console.error("Gagal menerapkan watermark, menampilkan gambar asli:", h), r.value = d.imageUrl;
398
- } finally {
399
- o.value = !1;
400
- }
401
- }), (h, v) => (n(), s(W, null, [
402
- o.value ? (n(), s("div", Ve({
403
- key: 0,
404
- class: "skeleton-loader"
405
- }, h.$attrs), null, 16)) : L("", !0),
406
- !o.value && r.value ? (n(), s("img", Ve({
407
- key: 1,
408
- loading: "lazy",
409
- src: r.value,
410
- alt: d.alt
411
- }, h.$attrs), null, 16, _a)) : L("", !0)
412
- ], 64));
413
- }
414
- }), fs = /* @__PURE__ */ me(Ca, [["__scopeId", "data-v-bc2fb469"]]), Da = { class: "modal-header" }, Ma = { class: "header-content" }, $a = { class: "title-section" }, Aa = { class: "modal-title" }, Ta = { class: "modal-body" }, xa = { class: "form-fields-container" }, Oa = { class: "modal-footer" }, ja = { class: "footer-buttons" }, Ha = { class: "btn-content" }, Ka = ["src"], Ba = /* @__PURE__ */ ue({
415
- __name: "ModalDetailData",
416
- props: {
417
- schema: {},
418
- formData: {},
419
- valueNullView: { type: Boolean },
420
- title: {},
421
- closeText: {},
422
- requiredText: {},
423
- optionalText: {},
424
- lang: {}
425
- },
426
- emits: ["close"],
427
- setup(e, { emit: d }) {
428
- const r = d, o = V(!1), c = V(""), t = () => r("close"), h = (i) => {
429
- c.value = i, o.value = !0;
430
- }, v = V(!1), y = () => {
431
- v.value = window.innerWidth < 768;
432
- };
433
- return Se(() => {
434
- y(), window.addEventListener("resize", y);
435
- }), Qe(() => {
436
- window.removeEventListener("resize", y);
437
- }), (i, C) => (n(), s(W, null, [
438
- I(De, {
439
- name: "modal-overlay",
440
- appear: ""
441
- }, {
442
- default: Me(() => [
443
- a("div", {
444
- class: "modal-overlay",
445
- onClick: Je(t, ["self"])
446
- }, [
447
- I(De, {
448
- name: "modal-container",
449
- appear: ""
450
- }, {
451
- default: Me(() => [
452
- a("div", {
453
- class: re(["modal-container", { "mobile-view": v.value }])
454
- }, [
455
- a("div", Da, [
456
- a("div", Ma, [
457
- a("div", $a, [
458
- C[1] || (C[1] = a("div", { class: "icon-container" }, [
459
- a("svg", {
460
- width: "24",
461
- height: "24",
462
- viewBox: "0 0 24 24",
463
- fill: "none",
464
- xmlns: "http://www.w3.org/2000/svg"
465
- }, [
466
- a("path", {
467
- d: "M10 3H6C4.89543 3 4 3.89543 4 5V19C4 20.1046 4.89543 21 6 21H18C19.1046 21 20 20.1046 20 19V5C20 3.89543 19.1046 3 18 3H14M10 3V6C10 6.55228 10.4477 7 11 7H13C13.5523 7 14 6.55228 14 6V3M10 3V1M14 3V1M9 11H15M9 15H15",
468
- stroke: "currentColor",
469
- "stroke-width": "2",
470
- "stroke-linecap": "round",
471
- "stroke-linejoin": "round"
472
- })
473
- ])
474
- ], -1)),
475
- a("h2", Aa, k(e.title ?? "Detail Data"), 1)
476
- ]),
477
- a("button", {
478
- class: "close-btn",
479
- onClick: t,
480
- "aria-label": "Close"
481
- }, [...C[2] || (C[2] = [
482
- a("svg", {
483
- width: "20",
484
- height: "20",
485
- viewBox: "0 0 24 24",
486
- fill: "none",
487
- xmlns: "http://www.w3.org/2000/svg"
488
- }, [
489
- a("path", {
490
- d: "M18 6L6 18M6 6L18 18",
491
- stroke: "currentColor",
492
- "stroke-width": "2",
493
- "stroke-linecap": "round",
494
- "stroke-linejoin": "round"
495
- })
496
- ], -1)
497
- ])])
498
- ])
499
- ]),
500
- a("div", Ta, [
501
- a("div", xa, [
502
- (n(!0), s(W, null, q(e.schema, (O, F) => (n(), ce(l(xe), {
503
- key: F,
504
- field: O,
505
- "field-key": F,
506
- "form-data": e.formData,
507
- "required-text": e.requiredText,
508
- "optional-text": e.optionalText,
509
- "value-null-view": e.valueNullView,
510
- onImageClick: h,
511
- lang: e.lang
512
- }, null, 8, ["field", "field-key", "form-data", "required-text", "optional-text", "value-null-view", "lang"]))), 128))
513
- ])
514
- ]),
515
- a("div", Oa, [
516
- a("div", ja, [
517
- a("button", {
518
- type: "button",
519
- onClick: t,
520
- class: "btn btn-primary"
521
- }, [
522
- a("span", Ha, [
523
- C[3] || (C[3] = a("svg", {
524
- width: "16",
525
- height: "16",
526
- viewBox: "0 0 24 24",
527
- fill: "none",
528
- xmlns: "http://www.w3.org/2000/svg"
529
- }, [
530
- a("path", {
531
- d: "M6 18L18 6M6 6L18 18",
532
- stroke: "currentColor",
533
- "stroke-width": "2",
534
- "stroke-linecap": "round",
535
- "stroke-linejoin": "round"
536
- })
537
- ], -1)),
538
- oe(" " + k(e.closeText ?? "Close"), 1)
539
- ])
540
- ])
541
- ])
542
- ])
543
- ], 2)
544
- ]),
545
- _: 1
546
- })
547
- ])
548
- ]),
549
- _: 1
550
- }),
551
- I(De, {
552
- name: "modal-overlay",
553
- appear: ""
554
- }, {
555
- default: Me(() => [
556
- o.value ? (n(), s("div", {
557
- key: 0,
558
- class: "modal-overlay image-preview-overlay",
559
- onClick: C[0] || (C[0] = (O) => o.value = !1)
560
- }, [
561
- I(De, {
562
- name: "modal-container",
563
- appear: ""
564
- }, {
565
- default: Me(() => [
566
- a("img", {
567
- src: c.value,
568
- alt: "Preview",
569
- class: "image-preview-content"
570
- }, null, 8, Ka)
571
- ]),
572
- _: 1
573
- })
574
- ])) : L("", !0)
575
- ]),
576
- _: 1
577
- })
578
- ], 64));
579
- }
580
- }), Va = /* @__PURE__ */ me(Ba, [["__scopeId", "data-v-a78353a9"]]), Sa = ["innerHTML"], bs = /* @__PURE__ */ ue({
581
- __name: "SafeHtml",
582
- props: {
583
- html: {}
584
- },
585
- setup(e) {
586
- const d = e, r = X(() => et.sanitize(d.html));
587
- return (o, c) => e.html ? (n(), s("div", {
588
- key: 0,
589
- innerHTML: r.value
590
- }, null, 8, Sa)) : L("", !0);
591
- }
592
- }), Ia = {
593
- class: "alert-icon",
594
- "aria-hidden": "true",
595
- xmlns: "http://www.w3.org/2000/svg",
596
- fill: "currentColor",
597
- viewBox: "0 0 20 20"
598
- }, La = {
599
- key: 0,
600
- d: "M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"
601
- }, Na = {
602
- key: 1,
603
- d: "M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z"
604
- }, Fa = { class: "sr-only" }, Pa = { class: "alert-title" }, Ea = { class: "alert-messages" }, za = /* @__PURE__ */ ue({
605
- __name: "AlertApp",
606
- setup(e, { expose: d }) {
607
- const r = V([]), o = V([]), c = V([]);
608
- let t = 0;
609
- function h() {
610
- let y = 0;
611
- c.value = o.value.map((i) => {
612
- const C = i?.offsetHeight || 0, O = y;
613
- return y += C + 10, O;
614
- });
615
- }
616
- function v(y) {
617
- y.id = t++, y.show = !1, r.value.push(y), $e(() => {
618
- y.show = !0, h();
619
- }), setTimeout(() => {
620
- y.show = !1, $e(() => {
621
- h(), setTimeout(() => {
622
- r.value = r.value.filter((i) => i.id !== y.id), $e(h);
623
- }, 200);
624
- });
625
- }, 5e3);
626
- }
627
- return Ae(r, () => {
628
- $e(h);
629
- }), d({
630
- addAlert: v
631
- }), (y, i) => (n(!0), s(W, null, q(r.value, (C, O) => (n(), s("div", {
632
- key: C.id,
633
- ref_for: !0,
634
- ref_key: "alertRefs",
635
- ref: o,
636
- class: re(["alert-container", C.type === "error" ? "alert-error" : "alert-success"]),
637
- style: je({
638
- top: `${c.value[O] ?? 0}px`,
639
- transform: `translateX(${C.show ? "0" : "200%"})`
640
- }),
641
- role: "alert"
642
- }, [
643
- (n(), s("svg", Ia, [
644
- C.type === "error" ? (n(), s("path", La)) : (n(), s("path", Na))
645
- ])),
646
- a("span", Fa, k(C.type === "error" ? "Error" : "Success"), 1),
647
- a("div", null, [
648
- a("span", Pa, k(C.title), 1),
649
- a("ul", Ea, [
650
- (n(!0), s(W, null, q(C.messages, (F, b) => (n(), s("li", { key: b }, k(F), 1))), 128))
651
- ])
652
- ])
653
- ], 6))), 128));
654
- }
655
- }), Ua = /* @__PURE__ */ me(za, [["__scopeId", "data-v-005a57aa"]]), Wa = ["aria-labelledby"], Ra = {
656
- id: "dialog-title",
657
- class: "dialog-title"
658
- }, Za = {
659
- id: "dialog-desc",
660
- class: "dialog-message"
661
- }, qa = { class: "button-container" }, Ga = /* @__PURE__ */ ue({
662
- __name: "WarningForm",
663
- props: {
664
- title: { default: "Warning Title" },
665
- message: { default: "Warning Message" },
666
- isGreen: { type: Boolean, default: !1 }
667
- },
668
- emits: ["confirm", "close"],
669
- setup(e, { emit: d }) {
670
- const r = e, o = d;
671
- return (c, t) => (n(), s("div", {
672
- class: "warning-overlay",
673
- onKeydown: t[2] || (t[2] = ze((h) => o("close"), ["esc"]))
674
- }, [
675
- a("div", {
676
- class: "warning-dialog",
677
- role: "dialog",
678
- "aria-modal": "true",
679
- "aria-labelledby": r.title
680
- }, [
681
- a("h2", Ra, k(r.title), 1),
682
- a("p", Za, k(r.message), 1),
683
- a("div", qa, [
684
- a("button", {
685
- class: re(["btn btn-confirm", r.isGreen ? "btn-green" : "btn-red"]),
686
- onClick: t[0] || (t[0] = (h) => o("confirm"))
687
- }, " Ya ", 2),
688
- a("button", {
689
- class: "btn btn-cancel",
690
- onClick: t[1] || (t[1] = (h) => o("close"))
691
- }, "Tidak")
692
- ])
693
- ], 8, Wa)
694
- ], 32));
695
- }
696
- }), Pe = /* @__PURE__ */ me(Ga, [["__scopeId", "data-v-a8d3c182"]]);
697
- async function Oe(e, d, r, o) {
698
- const c = {};
699
- for (const [t, h] of Object.entries(d)) {
700
- const v = h?.type;
701
- if (v === "select" && h.DB_NAME && !h.optionsIsNumber) {
702
- const i = e[h.baseKey?.base ?? t];
703
- if (i !== null) {
704
- const C = await ke(h.DB_NAME, i);
705
- c[t] = C[h.baseKey.name ?? "name"] ?? "";
706
- } else
707
- c[t] = "";
708
- continue;
709
- }
710
- if (v === "object") {
711
- const i = e[t] || {};
712
- c[t] = await Oe(
713
- e[t] || {},
714
- h.schema || {},
715
- i,
716
- h.baseKey?.base ?? "id"
717
- );
718
- continue;
719
- }
720
- if (v === "optionGroupSchema" && h.options) {
721
- if (h.withValue) {
722
- const i = e[t];
723
- c[t] = await ge(i);
724
- }
725
- for (const [i, C] of Object.entries(
726
- h.options
727
- ))
728
- for (const [O, F] of Object.entries(C)) {
729
- const b = F, S = e[O];
730
- if (b.type === "optionGroupSchema" && b.options) {
731
- const $ = await Oe(
732
- e,
733
- { [O]: b },
734
- r,
735
- o
736
- );
737
- Object.assign(c, $);
738
- continue;
739
- }
740
- if (b.type === "object") {
741
- c[O] = await Oe(
742
- e[O] || {},
743
- b.schema || {},
744
- e[O] || {},
745
- b.baseKey?.base ?? "id"
746
- );
747
- continue;
748
- }
749
- if (b.type === "select" && b.DB_NAME && !b.optionsIsNumber) {
750
- const $ = e[b.baseKey?.base ?? O];
751
- if ($ != null) {
752
- const H = b.DB_NAME, E = await ke(H, $);
753
- c[O] = E[b.baseKey?.name ?? "name"] ?? void 0;
754
- } else
755
- c[O] = void 0;
756
- } else
757
- c[O] = ge(S);
758
- }
759
- continue;
760
- }
761
- const y = e[t];
762
- c[t] = ge(y);
763
- }
764
- return r && e?.[o ?? "id"] && (c[o ?? "id"] = e?.[o ?? "id"]), c;
765
- }
766
- async function we(e, d) {
767
- const r = {};
768
- console.log(e);
769
- for (const [o, c] of Object.entries(d)) {
770
- const t = c?.type, h = e[c.baseKey?.base ?? o];
771
- if (t === "select" && c.optionsView && c.options && h) {
772
- const v = c.options.findIndex((y) => y === h);
773
- if (!c.optionsView[v] && c.DB_NAME && c.baseKey.name) {
774
- const i = (await ke(c.DB_NAME, h))[c.baseKey.name];
775
- r[o] = i;
776
- } else
777
- r[o] = c.optionsView[v] ?? h;
778
- continue;
779
- }
780
- if (t === "object") {
781
- r[o] = await we(h || {}, c.schema || {});
782
- continue;
783
- }
784
- if (t === "optionGroupSchema") {
785
- const v = [];
786
- for (const [i, C] of Object.entries(
787
- c.options
788
- ))
789
- v.push(C);
790
- const y = await We(e, v);
791
- Object.assign(r, y);
792
- continue;
793
- }
794
- if (t === "arrayObject") {
795
- const v = [];
796
- for (const y of h) {
797
- const i = await we(y, c.schema || {});
798
- v.push(i);
799
- }
800
- r[o] = v;
801
- continue;
802
- }
803
- r[o] = ge(h);
804
- }
805
- return r;
806
- }
807
- async function We(e, d) {
808
- const r = {};
809
- for (const o of d)
810
- for (const [c, t] of Object.entries(o)) {
811
- const h = t?.type, v = e[t.baseKey?.base ?? c];
812
- if (h === "select" && t.optionsView && t.options && v) {
813
- const y = t.options.findIndex((i) => i === v);
814
- if (!t.optionsView[y] && t.DB_NAME && t.baseKey.name) {
815
- const C = (await ke(t.DB_NAME, v))[t.baseKey.name];
816
- r[c] = C;
817
- } else
818
- r[c] = t.optionsView[y] ?? v;
819
- } else if (h === "optionGroupSchema") {
820
- const y = [];
821
- for (const [C, O] of Object.entries(
822
- t.options
823
- ))
824
- y.push(O);
825
- const i = await We(e, y);
826
- Object.assign(r, i);
827
- } else if (h === "object")
828
- r[c] = await we(v || {}, t.schema || {});
829
- else if (h === "arrayObject") {
830
- const y = [];
831
- for (const i of v) {
832
- const C = await we(i, t.schema || {});
833
- y.push(C);
834
- }
835
- r[c] = y;
836
- continue;
837
- } else
838
- r[c] = ge(v);
839
- }
840
- return r;
841
- }
842
- function ge(e, d) {
843
- return e ?? null;
844
- }
845
- function ve(e) {
846
- const d = Te(e), r = Array.isArray(d) ? [] : {};
847
- if (Array.isArray(d))
848
- return d.map((o) => o !== null && typeof o == "object" && !(o instanceof File || o instanceof Blob || o instanceof Date) && !Array.isArray(o) ? ve(o) : o);
849
- for (const o in d) {
850
- const c = d[o];
851
- c === void 0 ? r[o] = null : c instanceof File || c instanceof Blob || c instanceof Date ? r[o] = c : typeof c == "string" && (c.trim() === "" || c === "<p><br></p>") || typeof c == "number" && c === 0 ? r[o] = null : Array.isArray(c) ? r[o] = c.map((t) => t !== null && typeof t == "object" && !(t instanceof File || t instanceof Blob || t instanceof Date) && !Array.isArray(t) ? ve(t) : t) : typeof c == "object" && c !== null ? r[o] = ve(c) : r[o] = c;
852
- }
853
- return r;
854
- }
855
- function Re(e) {
856
- return e ? typeof e == "string" ? /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(e.toLowerCase()) || e.startsWith("data:image/") || e.startsWith("blob:") : e instanceof File || typeof e == "object" && e.type?.startsWith("image/") : !1;
857
- }
858
- function Ee(e) {
859
- return typeof e == "string" ? e : e instanceof File || typeof e == "object" && e.url ? e.url || URL.createObjectURL(e) : "";
860
- }
861
- function Qa(e) {
862
- return Array.isArray(e) && e.every((d) => Re(d));
863
- }
864
- function Ja(e) {
865
- return Array.isArray(e) ? e.every((d) => Ze(d)) : !1;
866
- }
867
- function Ze(e) {
868
- return typeof e != "string" ? !1 : /^#([0-9A-F]{3}){1,2}$/i.test(e) || /^rgb(a?)\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d\.]+\s*)?\)$/i.test(e) || /^hsl(a?)\(\s*\d+\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%\s*(,\s*[\d\.]+\s*)?\)$/i.test(e) ? !0 : [
869
- "red",
870
- "blue",
871
- "green",
872
- "yellow",
873
- "orange",
874
- "purple",
875
- "pink",
876
- "brown",
877
- "black",
878
- "white",
879
- "gray",
880
- "cyan",
881
- "magenta",
882
- "lime",
883
- "maroon",
884
- "navy",
885
- "olive",
886
- "teal",
887
- "silver",
888
- "aqua"
889
- ].includes(e.toLowerCase());
890
- }
891
- function Xa(e) {
892
- return /<\/?[a-z][\s\S]*>/i.test(e);
893
- }
894
- function Ya(e) {
895
- return Object.keys(e).reduce((d, r) => (r !== "id" && (d[r] = e[r]), d), {});
896
- }
897
- function en(e, d, r, o, c, t, h, v) {
898
- const y = V({});
899
- async function i(B) {
900
- o.value?.show("loading", t.message.process.loading);
901
- try {
902
- const p = await h(e.data, B);
903
- if (v.isUpdate.value = Number(B), !p) {
904
- o.value?.show("error", t.message.notFound);
905
- return;
906
- }
907
- const z = e.base.schema.update ?? e.base.schema.global ?? {};
908
- if (y.value = await Oe(
909
- p,
910
- z,
911
- v.isUpdate.value,
912
- e.keys?.idKey ?? "id"
913
- ), e.base?.justTabel || e.manual?.update || !e.endPoints?.update) {
914
- d("edit", y.value, B), o.value?.hide();
915
- return;
916
- }
917
- v.FormModalOpen.value = !0, o.value?.hide();
918
- } catch (p) {
919
- const z = typeof p == "string" ? p : p instanceof Error ? p.message : JSON.stringify(p, Object.getOwnPropertyNames(p));
920
- o.value?.show("error", z || "An unknown error occurred");
921
- }
922
- }
923
- function C() {
924
- if (e.base?.justTabel || e.manual?.create || !e.endPoints?.create) {
925
- d("create");
926
- return;
927
- }
928
- v.isUpdate.value = null, v.FormModalOpen.value = !0;
929
- }
930
- async function O(B) {
931
- o.value?.show("loading", t.message.process.loading);
932
- try {
933
- const p = await h(e.data, B);
934
- if (v.isUpdate.value = Number(B), !p) {
935
- o.value?.show("error", t.message.notFound);
936
- return;
937
- }
938
- if (y.value = await we(
939
- p,
940
- e.base?.schema.display ?? e.base?.schema.global ?? {}
941
- ), e.base.justTabel || e.manual?.display) {
942
- d("show", y.value, B), o.value?.hide();
943
- return;
944
- }
945
- v.detailItemModal.value = !0, o.value?.hide();
946
- } catch (p) {
947
- o.value?.show("error", JSON.stringify(p));
948
- }
949
- }
950
- function F(B) {
951
- v.idData.value = B, v.showWarningModel.value = !0;
952
- }
953
- function b() {
954
- v.showWarningModelSelected.value = !0;
955
- }
956
- function S() {
957
- v.showWarningModel.value = !1, v.showWarningModelSelected.value = !1, v.FormModalOpen.value = !1, v.detailItemModal.value = !1, y.value = {}, v.isUpdate.value = null;
958
- }
959
- const $ = async (B) => {
960
- const p = v.isUpdate.value !== null, z = p ? e.endPoints?.update : e.endPoints?.create, R = p ? e.validation?.update || null : e.validation?.create || null, te = p ? "update" : "create", Z = p ? t.message.success.update : t.message.success.create, G = p ? t.message.error.update : t.message.error.create;
961
- if (!z) {
962
- o.value?.show(
963
- "error",
964
- p ? t.message.error.update : t.message.error.create
965
- );
966
- return;
967
- }
968
- if (Array.isArray(v.dataChildDelete.value) && v.dataChildDelete.value.length > 0 && p) {
969
- const U = e.base.schema.update ?? e.base.schema.global ?? {};
970
- let N = "", Y, ne = await h(
971
- e.data,
972
- v.isUpdate.value
973
- ), de, he, ye = !0;
974
- for (const ee in U) {
975
- const Q = U[ee];
976
- if (Q.type === "arrayObject") {
977
- N = ee, Y = Q.endPoint?.deleteMany ?? e.endPoints?.deleteMany, de = Q.DB_NAME ?? e.base.source.DB_NAME, he = Q.deleteValidation ?? e.validation?.delete ?? void 0, ye = !0;
978
- break;
979
- }
980
- }
981
- if (Array.isArray(y.value[N]))
982
- for (let ee = 0; ee < v.dataChildDelete.value.length; ee++) {
983
- const Q = v.dataChildDelete.value[ee];
984
- e.keys?.idKey, y.value[N] = y.value[N].filter((J) => J?.[e.keys?.idKey ?? "id"] !== Q), ne && Array.isArray(ne[N]) && (ne[N] = ne[N].filter((J) => J?.[e.keys?.idKey ?? "id"] !== Q));
985
- }
986
- const ae = tt(ve(B), ve(Te(y.value))), se = await E(
987
- v.dataChildDelete.value,
988
- Y,
989
- he,
990
- de,
991
- ye
992
- );
993
- if (se?.response && ae) {
994
- o.value?.show("success", t.message.success.delete), await at(de, ve(Te(ne))), await r(), S();
995
- return;
996
- } else if (!se?.response) {
997
- o.value?.show("error", se.message);
998
- return;
999
- }
1000
- }
1001
- try {
1002
- o.value?.show(
1003
- "loading",
1004
- p ? t.message.process.update : t.message.process.create
1005
- );
1006
- const U = p ? e.submitOption?.update?.authType ?? e.submitOption?.global?.authType ?? "cookie" : e.submitOption?.create?.authType ?? e.submitOption?.global?.authType ?? "cookie", N = p ? e.submitOption?.update?.token ?? e.submitOption?.global?.token ?? void 0 : e.submitOption?.create?.token ?? e.submitOption?.global?.token ?? void 0, Y = p ? e.submitOption?.update?.customHeaders ?? e.submitOption?.global?.customHeaders ?? void 0 : e.submitOption?.create?.customHeaders ?? e.submitOption?.global?.customHeaders ?? void 0;
1007
- await fe({
1008
- data: ve(B),
1009
- oldData: p ? ve(Te(y.value)) : void 0,
1010
- validation: R ?? void 0,
1011
- endpoint: z,
1012
- mode: te,
1013
- token: N,
1014
- authType: U,
1015
- customHeaders: Y,
1016
- db: e.base.source.DB_NAME,
1017
- ...p ? e.submitOption?.update ?? e.submitOption?.global : e.submitOption?.create ?? e.submitOption?.global
1018
- }), e.base.dataTabelCustomDisplay ? d("refreshData") : r(), o.value?.show("success", Z), S();
1019
- } catch (U) {
1020
- c(
1021
- "error",
1022
- G,
1023
- Object.entries(U).map(([N, Y]) => `${N} : ${Y}`)
1024
- ), o.value?.show("error", G);
1025
- }
1026
- };
1027
- async function H(B, p, z, R, te = !0) {
1028
- if (e.base.justTabel || e.manual?.delete || !e.endPoints?.delete) {
1029
- d("delete", B);
1030
- return;
1031
- }
1032
- if (p = p ?? e.endPoints?.delete, z = z ?? e.validation?.delete, R = R ?? e.base?.source.DB_NAME ?? void 0, !p) {
1033
- o.value?.show("error", t.message.error.delete);
1034
- return;
1035
- }
1036
- const Z = { [e.keys?.idKey ?? "id"]: B };
1037
- try {
1038
- o.value?.show("loading", t.message.process.delete);
1039
- const G = e.submitOption?.delete?.authType ?? e.submitOption?.global?.authType ?? "cookie", U = e.submitOption?.delete?.token ?? e.submitOption?.global?.token ?? void 0, N = e.submitOption?.delete?.customHeaders ?? e.submitOption?.global?.customHeaders ?? void 0;
1040
- await fe({
1041
- data: Z,
1042
- validation: z ?? void 0,
1043
- endpoint: p,
1044
- mode: "delete",
1045
- token: U,
1046
- authType: G,
1047
- customHeaders: N,
1048
- db: R,
1049
- deleteDataDB: te,
1050
- ...e.submitOption?.delete ?? e.submitOption?.global
1051
- }), e.base?.dataTabelCustomDisplay ? d("refreshData") : r(), o.value?.show("success", t.message.success.delete);
1052
- } catch (G) {
1053
- c(
1054
- "error",
1055
- t.message.error.delete,
1056
- Object.entries(G).map(([U, N]) => `${U} : ${N}`)
1057
- ), o.value?.show("error", t.message.error.delete);
1058
- } finally {
1059
- S();
1060
- }
1061
- }
1062
- async function E(B, p, z, R, te = !0) {
1063
- if (e.base?.justTabel || e.manual?.delete || !e.endPoints?.delete) {
1064
- d("deleteMany", B);
1065
- return;
1066
- }
1067
- if (p = p ?? e.endPoints?.deleteMany, z = z ?? e.validation?.deleteMany, R = R ?? e.base?.source.DB_NAME ?? void 0, !p) {
1068
- o.value?.show("error", t.message.error.deleteMany);
1069
- return;
1070
- }
1071
- try {
1072
- o.value?.show("loading", t.message.process.deleteMany);
1073
- const Z = e.submitOption?.delete?.authType ?? e.submitOption?.global?.authType ?? "cookie", G = e.submitOption?.delete?.token ?? e.submitOption?.global?.token ?? void 0, U = e.submitOption?.delete?.customHeaders ?? e.submitOption?.global?.customHeaders ?? void 0, N = await fe({
1074
- data: { [e.keys?.idsKey ?? "ids"]: B },
1075
- validation: z ?? void 0,
1076
- endpoint: p,
1077
- mode: "delete",
1078
- db: R,
1079
- authType: Z,
1080
- token: G,
1081
- customHeaders: U,
1082
- deleteDataDB: te
1083
- });
1084
- return v.selectedItems.value = [], e.base?.dataTabelCustomDisplay ? (d("refreshData"), o.value?.show("success", t.message.success.deleteMany), S(), N) : (await r(), o.value?.show("success", t.message.success.deleteMany), S(), N);
1085
- } catch (Z) {
1086
- c(
1087
- "error",
1088
- t.message.error.deleteMany,
1089
- Object.entries(Z).map(([G, U]) => `${G} : ${U}`)
1090
- ), o.value?.show("error", t.message.error.deleteMany);
1091
- }
1092
- }
1093
- return {
1094
- initialData: y,
1095
- openEditModal: i,
1096
- openCreateModal: C,
1097
- openShowModal: O,
1098
- openWarningDeleteData: F,
1099
- openWarningDeleteSelectedData: b,
1100
- closeModal: S,
1101
- submitFormData: $,
1102
- DeleteData: H,
1103
- DeleteSeletedData: E
1104
- };
1105
- }
1106
- function tn(e, d, r, o) {
1107
- const c = V(""), t = V(1), h = V([]), v = V(!1), y = V(!1), i = V(!1), C = V(null), O = V(null), F = V("asc"), b = V(!1), S = V(!1), $ = V(null), H = V(null), E = X(() => e.pagination?.itemsPerPage ?? 10), B = X(() => e.pagination?.maxVisiblePages ?? 5);
1108
- V(null), V("none");
1109
- const p = X(() => {
1110
- const m = e.keys?.idKey;
1111
- return e.data.find((A) => A?.[m ?? "id"] === C.value) || {};
1112
- }), z = X(() => {
1113
- const m = e.keys?.idKey ?? "id", A = e.keys?.nameKey ?? "name";
1114
- return e.data.filter((j) => h.value.includes(j[m])).map((j) => j[A]).join(", ");
1115
- }), R = X(() => {
1116
- let m = (e.base.data ?? []).filter(
1117
- (A) => Object.values(A).some(
1118
- (j) => String(j).toLowerCase().includes(c.value.toLowerCase())
1119
- )
1120
- );
1121
- return O.value && m.sort((A, j) => {
1122
- let _ = A[O.value], M = j[O.value];
1123
- return typeof _ == "string" && (_ = _.toLowerCase()), typeof M == "string" && (M = M.toLowerCase()), _ < M ? F.value === "asc" ? -1 : 1 : _ > M ? F.value === "asc" ? 1 : -1 : 0;
1124
- }), m;
1125
- }), te = X(() => {
1126
- const m = (t.value - 1) * E.value;
1127
- return R.value.slice(m, m + E.value);
1128
- }), Z = X(() => Math.ceil(R.value.length / E.value)), G = X(() => {
1129
- const m = [], A = Z.value, j = t.value, _ = B.value;
1130
- if (A <= _ + 2) {
1131
- for (let w = 1; w <= A; w++) m.push(w);
1132
- return m;
1133
- }
1134
- m.push(1);
1135
- let M = Math.max(2, j - 2), f = Math.min(A - 1, j + 2);
1136
- M > 2 && m.push("...");
1137
- for (let w = M; w <= f; w++)
1138
- m.push(w);
1139
- return f < A - 1 && m.push("..."), m.push(A), m;
1140
- });
1141
- function U() {
1142
- h.value = v.value ? te.value.map((m) => m?.[e.keys?.idKey ?? "id"]) : [];
1143
- }
1144
- function N(m) {
1145
- O.value === m ? F.value = F.value === "desc" ? "asc" : "desc" : (O.value = m, F.value = "desc");
1146
- }
1147
- function Y() {
1148
- t.value > 1 && t.value--;
1149
- }
1150
- function ne() {
1151
- t.value < Z.value && t.value++;
1152
- }
1153
- async function de() {
1154
- if (e.base.source.DB_NAME) {
1155
- const m = await Be(e.base.source.DB_NAME);
1156
- if (e.base.source.connect?.length) {
1157
- const A = {};
1158
- return await Promise.all(
1159
- e.base.source.connect.map(async (j) => {
1160
- A[j.DB_NAME] = await Be(j.DB_NAME);
1161
- })
1162
- ), m.map((j) => {
1163
- let _ = { ...j };
1164
- for (const M of e.base.source.connect) {
1165
- const f = M.key, w = M.connectKey, T = (A[M.DB_NAME] || []).filter(
1166
- (K) => J(K, w) === J(j, f)
1167
- );
1168
- _[M.DB_NAME] = T.length > 0 ? T : null;
1169
- }
1170
- return _;
1171
- });
1172
- }
1173
- return m;
1174
- } else if (e.base.source.fetchApi?.getAll) {
1175
- const m = e.submitOption?.delete?.authType ?? e.submitOption?.global?.authType ?? "cookie", A = e.submitOption?.delete?.token ?? e.submitOption?.global?.token, j = e.submitOption?.delete?.customHeaders ?? e.submitOption?.global?.customHeaders, _ = await fe({
1176
- mode: "get",
1177
- endpoint: e.base.source.fetchApi?.getAll,
1178
- db: e.base.source.DB_NAME,
1179
- authType: m,
1180
- token: A,
1181
- customHeaders: j
1182
- });
1183
- if (e.base.source.fetchApi.connect?.length) {
1184
- const M = {};
1185
- return await Promise.all(
1186
- e.base.source.fetchApi.connect.map(async (f) => {
1187
- const w = await fe({
1188
- mode: "get",
1189
- endpoint: f.url,
1190
- db: e.base.source.DB_NAME,
1191
- authType: m,
1192
- token: A,
1193
- customHeaders: j
1194
- }), T = f.valueKey ?? f.url ?? f.key;
1195
- M[T] = w.data ?? [];
1196
- })
1197
- ), !_.data || !Array.isArray(_.data) ? _.data : _.data.map((f) => {
1198
- let w = { ...f };
1199
- for (const T of e.base.source.fetchApi.connect) {
1200
- const K = T.key, x = T.connectKey, u = T.valueKey ?? T.url ?? T.key, g = (M[u] || []).filter(
1201
- (D) => J(D, x) === J(f, K)
1202
- );
1203
- w[u] = g.length > 0 ? g : null;
1204
- }
1205
- return w;
1206
- });
1207
- }
1208
- return _.data ?? [];
1209
- } else
1210
- return;
1211
- }
1212
- async function he(m, A) {
1213
- if (m.connect?.withDB)
1214
- return await ke(m.connect.withDB.DB_NAME, A);
1215
- if (m.connect?.withFetch) {
1216
- const j = e.submitOption?.delete?.authType ?? e.submitOption?.global?.authType ?? "cookie", _ = e.submitOption?.delete?.token ?? e.submitOption?.global?.token ?? void 0, M = e.submitOption?.delete?.customHeaders ?? e.submitOption?.global?.customHeaders ?? void 0, f = await fe({
1217
- mode: "get",
1218
- endpoint: m.connect?.withFetch.url + "/" + A,
1219
- db: e.base.source.DB_NAME,
1220
- authType: j,
1221
- token: _,
1222
- customHeaders: M
1223
- });
1224
- if (f.data)
1225
- return f.data;
1226
- } else
1227
- return;
1228
- }
1229
- async function ye(m, A) {
1230
- return m.find((j) => j[e.keys?.idKey ?? "id"] == A);
1231
- }
1232
- let ae = !0, se = null;
1233
- async function ee() {
1234
- if (ae && r.value?.show("loading", o.message.process.loading), e.base?.dataTabelCustomDisplay && e.base?.dataTabelCustomDisplay.length !== 0) {
1235
- e.base.data = e.base.dataTabelCustomDisplay, e.data = await de(), await Q(), ae && (r.value?.hide(), ae = !1);
1236
- return;
1237
- }
1238
- const m = await de();
1239
- if (e.data = m, await Q(), Array.isArray(m)) {
1240
- const _ = e.keys?.idKey ?? "id";
1241
- m.sort((M, f) => M.updatedAt && f.updatedAt ? new Date(f.updatedAt).getTime() - new Date(M.updatedAt).getTime() : (f[_] ?? 0) - (M[_] ?? 0)), e.data = m;
1242
- } else {
1243
- ae && (r.value?.hide(), ae = !1);
1244
- return;
1245
- }
1246
- const A = e.keys?.idKey, j = e.base.headersTabelDisplay?.length === 0 || e.base.headersTabelDisplay === void 0;
1247
- e.base.data = await Promise.all(
1248
- m.map(async (_) => {
1249
- const M = {};
1250
- if (A && _[A] != null && (M[A] = _[A], j && (!e.base.headersTabelDisplay?.includes(A) || e.base.headersTabelDisplay === void 0) && (e.base.headersTabelDisplay = [])), e.base.dataTabelDisplay)
1251
- for (const [f, w] of Object.entries(e.base.dataTabelDisplay))
1252
- if (typeof w == "string") {
1253
- const T = J(_, w);
1254
- M[f] = Array.isArray(T) ? T.map((K) => ie(K)) : ie(T ?? "-"), j && !e.base.headersTabelDisplay?.includes(f) && e.base.headersTabelDisplay?.push(f);
1255
- } else {
1256
- let T = J(_, w.valueKey);
1257
- if ((w.connect?.withDB || w.connect?.withFetch) && T)
1258
- if (Array.isArray(T)) {
1259
- const K = await Promise.all(
1260
- T.map(async (x) => {
1261
- const u = await he(w, x);
1262
- return u ? u[w.connect?.withDB?.valueKey ?? w.connect?.withFetch?.valueKey] : x;
1263
- })
1264
- );
1265
- M[f] = K.map((x) => ie(x));
1266
- } else {
1267
- const K = await he(w, T);
1268
- K && (T = K[w.connect.withDB?.valueKey ?? w.connect.withFetch?.valueKey]), M[f] = ie(T);
1269
- }
1270
- else
1271
- M[f] = ie(T);
1272
- j && !e.base.headersTabelDisplay?.includes(f) && e.base.headersTabelDisplay?.push(f);
1273
- }
1274
- else {
1275
- let f = 0;
1276
- for (const [w, T] of Object.entries(_)) {
1277
- if (w === A) continue;
1278
- if (f >= 8) break;
1279
- const K = be(w);
1280
- M[K] = ie(T), j && !e.base.headersTabelDisplay?.includes(K) && e.base.headersTabelDisplay?.push(K), f++;
1281
- }
1282
- }
1283
- return M;
1284
- })
1285
- ), ae && (r.value?.hide(), ae = !1), e.base?.source?.fetchApi?.autoRefresh?.time && (se && clearTimeout(se), se = setTimeout(() => {
1286
- ee();
1287
- }, e.base.source.fetchApi.autoRefresh.time));
1288
- }
1289
- async function Q() {
1290
- const m = {
1291
- global: e.base.schema.global ?? {},
1292
- create: e.base.schema.create ?? {},
1293
- update: e.base.schema.update ?? {},
1294
- display: e.base.schema.display ?? {}
1295
- }, A = (f) => ({
1296
- authType: e.submitOption?.[f]?.authType ?? e.submitOption?.global?.authType ?? "cookie",
1297
- token: e.submitOption?.[f]?.token ?? e.submitOption?.global?.token,
1298
- customHeaders: e.submitOption?.[f]?.customHeaders ?? e.submitOption?.global?.customHeaders
1299
- }), j = async (f) => {
1300
- const w = f.options?.valueKey ?? "id", T = f.options?.viewKey ?? "name";
1301
- let K;
1302
- if (f.options?.url && (K = await fe({
1303
- mode: "get",
1304
- endpoint: f.options.url,
1305
- ...A("get")
1306
- }), Array.isArray(K?.data) && (f.options = K.data.map((x) => x[w]) ?? [], f.options?.viewKey ? f.optionsView = K.map((x) => x[T]) ?? [] : f.optionsView = K.map((x) => x[w]) ?? [])), f.options?.DB_NAME) {
1307
- const x = f.options?.DB_NAME ?? f.optionsView?.DB_NAME;
1308
- if (K = await Be(x), Array.isArray(K)) {
1309
- const u = f.options;
1310
- u?.DB_NAME && (f.options = K.map((g) => g[w]) ?? []), u?.viewKey ? f.optionsView = K.map((g) => g[T]) ?? [] : f.optionsView = K.map((g) => g[w]) ?? [];
1311
- }
1312
- }
1313
- }, _ = (f, w) => {
1314
- e.data && f.validate?.duplicate === !0 && (f.validate.duplicate = e.data.map((T) => T[w]) ?? []);
1315
- };
1316
- async function M(f) {
1317
- for (const [w, T] of Object.entries(f)) {
1318
- const K = T?.type;
1319
- if (K === "select" && await j(T), K === "text" && _(T, w), K === "optionGroupSchema") {
1320
- const x = T?.options ?? {};
1321
- for (const [u, g] of Object.entries(x))
1322
- await M(g);
1323
- }
1324
- K === "arrayObject" && T.schema && await M(T.schema), K === "object" && T.schema && await M(T.schema);
1325
- }
1326
- }
1327
- for (const [f, w] of Object.entries(m))
1328
- w && await M(w);
1329
- }
1330
- function J(m, A) {
1331
- if (!(!m || typeof A != "string"))
1332
- try {
1333
- const j = A.replace(/\[(\d+)\]/g, ".$1").split(".");
1334
- let _ = m;
1335
- for (const M of j) {
1336
- if (_ == null) return;
1337
- if (Array.isArray(_)) {
1338
- const f = Number(M);
1339
- isNaN(f) ? (_ = _.map((w) => w?.[M]).filter((w) => w !== void 0), _.some((w) => Array.isArray(w)) && (_ = _.flat()), _.length === 1 && (_ = _[0])) : _ = _[f];
1340
- } else
1341
- _ = _?.[M];
1342
- }
1343
- return _;
1344
- } catch {
1345
- return "-";
1346
- }
1347
- }
1348
- function be(m) {
1349
- return m.replace(/([A-Z])/g, " $1").replace(/[_\-]/g, " ").replace(/\s+/g, " ").trim().replace(/\w\S*/g, (A) => A.charAt(0).toUpperCase() + A.slice(1).toLowerCase());
1350
- }
1351
- function ie(m) {
1352
- if (Array.isArray(m)) {
1353
- if (m.length === 0) return "Empty";
1354
- if (typeof m[0] == "string") return m.join(", ");
1355
- if (typeof m[0] == "object") return `${m.length} item`;
1356
- }
1357
- return typeof m == "object" && m !== null ? Object.keys(m).length > 0 ? "Objek" : "Empty" : m != null ? String(m) : "—";
1358
- }
1359
- return {
1360
- searchQuery: c,
1361
- currentPage: t,
1362
- selectedItems: h,
1363
- selectAll: v,
1364
- showWarningModel: y,
1365
- showWarningModelSelected: i,
1366
- idData: C,
1367
- sortField: O,
1368
- sortDirection: F,
1369
- FormModalOpen: b,
1370
- detailItemModal: S,
1371
- isUpdate: $,
1372
- dataChildDelete: H,
1373
- selectedItem: p,
1374
- selectedItemNames: z,
1375
- filteredData: R,
1376
- paginatedData: te,
1377
- totalPages: Z,
1378
- visiblePages: G,
1379
- toggleAll: U,
1380
- sortBy: N,
1381
- prevPage: Y,
1382
- nextPage: ne,
1383
- summarizeValue: ie,
1384
- setUpData: ee,
1385
- getValueByPath: J,
1386
- toTitleCase: be,
1387
- GetDataById: ye
1388
- };
1389
- }
1390
- const an = {
1391
- idKey: "id",
1392
- idsKey: "ids"
1393
- }, nn = {
1394
- btnInfoActive: !0,
1395
- searchQueryActive: !0,
1396
- sortable: !0,
1397
- createActive: !0,
1398
- updateActive: !0,
1399
- deleteActive: !0,
1400
- deleteManyActive: !0,
1401
- displayActive: !0
1402
- }, gs = {
1403
- create: !1,
1404
- update: !1,
1405
- delete: !1,
1406
- deleteMany: !1,
1407
- display: !1
1408
- }, sn = {
1409
- itemsPerPage: 5,
1410
- maxVisiblePages: 5
1411
- }, ln = {
1412
- create: void 0,
1413
- update: void 0,
1414
- delete: void 0,
1415
- deleteMany: void 0
1416
- }, ks = {
1417
- create: void 0,
1418
- update: void 0,
1419
- delete: void 0,
1420
- deleteMany: void 0
1421
- }, ws = {
1422
- global: {
1423
- authType: "cookie"
1424
- }
1425
- }, on = { class: "table-container" }, rn = { class: "table-wrapper" }, cn = { class: "table-header" }, un = { class: "header-top" }, dn = { class: "header-actions" }, vn = { class: "action-buttons" }, mn = ["disabled"], hn = { class: "header-search" }, yn = {
1426
- key: 0,
1427
- class: "search-container"
1428
- }, fn = ["placeholder"], bn = {
1429
- key: 0,
1430
- class: "selection-indicator"
1431
- }, gn = { class: "selection-count" }, kn = {
1432
- key: 0,
1433
- class: "empty-state"
1434
- }, wn = { class: "empty-title" }, pn = { class: "empty-description" }, _n = {
1435
- key: 1,
1436
- class: "table-content"
1437
- }, Cn = { class: "table-scroll-container" }, Dn = { class: "data-table" }, Mn = { class: "table-header-row" }, $n = { class: "checkbox-column" }, An = { class: "header-content" }, Tn = ["onClick"], xn = { class: "actions-column" }, On = { class: "table-body" }, jn = { class: "checkbox-cell" }, Hn = ["value"], Kn = ["innerHTML"], Bn = {
1438
- key: 1,
1439
- class: "status-badge"
1440
- }, Vn = {
1441
- key: 2,
1442
- class: "text-cell datetime-cell"
1443
- }, Sn = {
1444
- key: 3,
1445
- class: "text-cell date-cell"
1446
- }, In = {
1447
- key: 4,
1448
- class: "text-cell time-cell"
1449
- }, Ln = {
1450
- key: 5,
1451
- class: "image-cell"
1452
- }, Nn = { class: "image-container" }, Fn = ["src", "alt"], Pn = {
1453
- key: 6,
1454
- class: "color-array-cell"
1455
- }, En = ["title"], zn = {
1456
- key: 0,
1457
- class: "color-count"
1458
- }, Un = {
1459
- key: 7,
1460
- class: "color-cell"
1461
- }, Wn = ["title"], Rn = {
1462
- key: 8,
1463
- class: "image-array-cell"
1464
- }, Zn = ["src", "alt"], qn = {
1465
- key: 0,
1466
- class: "image-count"
1467
- }, Gn = {
1468
- key: 9,
1469
- class: "array-cell"
1470
- }, Qn = {
1471
- key: 10,
1472
- class: "text-cell"
1473
- }, Jn = { class: "actions-cell" }, Xn = { class: "action-buttons-group" }, Yn = ["onClick"], es = { class: "action-text" }, ts = ["onClick"], as = { class: "action-text" }, ns = ["onClick"], ss = { class: "action-text" }, is = { class: "pagination-container" }, ls = { class: "pagination-info" }, os = { class: "pagination-controls" }, rs = ["disabled"], cs = { class: "pagination-pages" }, us = ["onClick", "disabled"], ds = ["disabled"], vs = /* @__PURE__ */ ue({
1474
- __name: "TabelData",
1475
- props: {
1476
- base: {},
1477
- keys: { default: () => an },
1478
- formDesign: {},
1479
- submitOption: {},
1480
- feature: { default: () => nn },
1481
- pagination: { default: () => sn },
1482
- validation: { default: () => ln },
1483
- manual: {},
1484
- endPoints: {}
1485
- },
1486
- emits: ["refreshData", "edit", "create", "show", "delete", "deleteMany"],
1487
- setup(e, { emit: d }) {
1488
- const r = (x) => typeof x == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(x), o = (x) => typeof x == "string" && /^\d{4}-\d{2}-\d{2}$/.test(x), c = (x) => typeof x == "string" && /^\d{2}:\d{2}$/.test(x);
1489
- function t(x, u = "en") {
1490
- try {
1491
- const g = new Date(x), D = u === "id" ? "id-ID" : u;
1492
- return new Intl.DateTimeFormat(D, {
1493
- dateStyle: "medium",
1494
- // "18 Okt 2025"
1495
- timeStyle: "short"
1496
- // "10.54"
1497
- }).format(g);
1498
- } catch {
1499
- return x;
1500
- }
1501
- }
1502
- function h(x, u = "en") {
1503
- try {
1504
- const g = /* @__PURE__ */ new Date(`${x}T00:00:00`), D = u === "id" ? "id-ID" : u;
1505
- return new Intl.DateTimeFormat(D, {
1506
- dateStyle: "medium"
1507
- // "18 Okt 2025"
1508
- }).format(g);
1509
- } catch {
1510
- return x;
1511
- }
1512
- }
1513
- function v(x, u = "en") {
1514
- try {
1515
- const [g, D] = x.split(":"), le = /* @__PURE__ */ new Date();
1516
- le.setHours(parseInt(g, 10), parseInt(D, 10), 0, 0);
1517
- const pe = u === "id" ? "id-ID" : u;
1518
- return new Intl.DateTimeFormat(pe, {
1519
- timeStyle: "short"
1520
- // "10.54"
1521
- }).format(le);
1522
- } catch {
1523
- return x;
1524
- }
1525
- }
1526
- const y = e, i = V({
1527
- ...y
1528
- }), C = d, O = V(null), F = V(), b = X(() => Ue[y.base?.lang ?? "en"]), {
1529
- searchQuery: S,
1530
- currentPage: $,
1531
- selectedItems: H,
1532
- selectAll: E,
1533
- showWarningModel: B,
1534
- showWarningModelSelected: p,
1535
- idData: z,
1536
- FormModalOpen: R,
1537
- detailItemModal: te,
1538
- isUpdate: Z,
1539
- dataChildDelete: G,
1540
- selectedItem: U,
1541
- filteredData: N,
1542
- paginatedData: Y,
1543
- totalPages: ne,
1544
- visiblePages: de,
1545
- selectedItemNames: he,
1546
- toggleAll: ye,
1547
- sortBy: ae,
1548
- prevPage: se,
1549
- nextPage: ee,
1550
- setUpData: Q,
1551
- GetDataById: J
1552
- } = tn(i.value, C, O, b.value), {
1553
- initialData: be,
1554
- openEditModal: ie,
1555
- openCreateModal: m,
1556
- openShowModal: A,
1557
- openWarningDeleteData: j,
1558
- openWarningDeleteSelectedData: _,
1559
- closeModal: M,
1560
- submitFormData: f,
1561
- DeleteData: w,
1562
- DeleteSeletedData: T
1563
- } = en(
1564
- i.value,
1565
- C,
1566
- Q,
1567
- O,
1568
- K,
1569
- b.value,
1570
- J,
1571
- {
1572
- selectedItems: H,
1573
- idData: z,
1574
- isUpdate: Z,
1575
- FormModalOpen: R,
1576
- detailItemModal: te,
1577
- dataChildDelete: G,
1578
- showWarningModel: B,
1579
- showWarningModelSelected: p
1580
- }
1581
- );
1582
- Ae(H, (x) => {
1583
- E.value = x.length === Y.value.length && Y.value.length > 0;
1584
- }), Ae(S, () => {
1585
- $.value = 1;
1586
- }), Ae(
1587
- () => y.base.dataTabelCustomDisplay || y.base.schema,
1588
- async () => {
1589
- Object.assign(i.value, {
1590
- ...y
1591
- }), H.value = [], await Q();
1592
- }
1593
- ), Se(async () => {
1594
- Object.assign(i.value, {
1595
- ...y
1596
- }), await Q();
1597
- }), Xe("TableComponents", { ShowAlert: K, loader: O, labels: b });
1598
- function K(x, u, g) {
1599
- const D = {
1600
- type: x,
1601
- title: u,
1602
- messages: g
1603
- };
1604
- F.value?.addAlert(D);
1605
- }
1606
- return (x, u) => (n(), s("div", on, [
1607
- I(l(nt), {
1608
- ref_key: "loader",
1609
- ref: O
1610
- }, null, 512),
1611
- l(B) ? (n(), ce(l(Pe), {
1612
- key: 0,
1613
- title: b.value.warning.delete,
1614
- message: `${l(U).name ?? l(U)[i.value?.keys?.nameKey ?? i.value?.keys?.idKey ?? "id"]}`,
1615
- onConfirm: u[0] || (u[0] = () => {
1616
- l(z) !== null && l(w)(l(z));
1617
- }),
1618
- onClose: l(M)
1619
- }, null, 8, ["title", "message", "onClose"])) : L("", !0),
1620
- l(p) ? (n(), ce(l(Pe), {
1621
- key: 1,
1622
- title: b.value.warning.deleteMany,
1623
- message: l(he),
1624
- onConfirm: u[1] || (u[1] = () => l(T)(l(H))),
1625
- onClose: l(M)
1626
- }, null, 8, ["title", "message", "onClose"])) : L("", !0),
1627
- l(te) ? (n(), ce(l(Va), {
1628
- key: 2,
1629
- title: b.value?.title?.display,
1630
- "close-text": b.value?.btn?.close,
1631
- schema: i.value?.base?.schema.display ?? i.value?.base?.schema.global ?? {},
1632
- "form-data": l(be) ?? {},
1633
- "value-null-view": !0,
1634
- onClose: l(M)
1635
- }, null, 8, ["title", "close-text", "schema", "form-data", "onClose"])) : L("", !0),
1636
- I(l(Ua), {
1637
- ref_key: "alert",
1638
- ref: F
1639
- }, null, 512),
1640
- l(R) ? (n(), ce(st, {
1641
- key: 3,
1642
- id: l(Z) ?? null,
1643
- "is-update": !!l(Z),
1644
- schema: l(Z) ? i.value.base.schema.update ?? i.value.base.schema.global : i.value.base.schema.create ?? i.value.base.schema.global,
1645
- "initial-data": l(Z) ? l(be) : void 0,
1646
- lang: i.value.base.lang ?? "en",
1647
- onCancel: u[2] || (u[2] = (g) => R.value = !1),
1648
- onDataChildRemove: u[3] || (u[3] = (g) => G.value = g),
1649
- onSubmit: l(f)
1650
- }, null, 8, ["id", "is-update", "schema", "initial-data", "lang", "onSubmit"])) : L("", !0),
1651
- a("div", rn, [
1652
- a("div", cn, [
1653
- a("div", un, [
1654
- a("div", dn, [
1655
- a("div", vn, [
1656
- i.value?.feature?.createActive ? (n(), s("button", {
1657
- key: 0,
1658
- onClick: u[4] || (u[4] = (g) => l(m)()),
1659
- class: "btn btn-primary"
1660
- }, [
1661
- u[14] || (u[14] = a("span", { class: "btn-icon" }, [
1662
- a("svg", {
1663
- width: "16",
1664
- height: "16",
1665
- viewBox: "0 0 24 24",
1666
- fill: "none"
1667
- }, [
1668
- a("path", {
1669
- d: "M12 5V19M5 12H19",
1670
- stroke: "currentColor",
1671
- "stroke-width": "2",
1672
- "stroke-linecap": "round",
1673
- "stroke-linejoin": "round"
1674
- })
1675
- ])
1676
- ], -1)),
1677
- oe(" " + k(b.value?.btn?.add), 1)
1678
- ])) : L("", !0),
1679
- l(H).length > 0 && i.value?.feature?.deleteManyActive ? (n(), s("button", {
1680
- key: 1,
1681
- onClick: u[5] || (u[5] = (g) => l(_)()),
1682
- class: re(["btn btn-danger", { disabled: l(H).length === 0 }]),
1683
- disabled: l(H).length === 0
1684
- }, [
1685
- u[15] || (u[15] = a("span", { class: "btn-icon" }, [
1686
- a("svg", {
1687
- width: "16",
1688
- height: "16",
1689
- viewBox: "0 0 24 24",
1690
- fill: "none"
1691
- }, [
1692
- a("path", {
1693
- d: "M19 7L18.1327 19.1425C18.0579 20.1891 17.187 21 16.1378 21H7.86224C6.81296 21 5.94208 20.1891 5.86732 19.1425L5 7M10 11V17M14 11V17M15 7V4C15 3.44772 14.5523 3 14 3H10C9.44772 3 9 3.44772 9 4V7M4 7H20",
1694
- stroke: "currentColor",
1695
- "stroke-width": "2",
1696
- "stroke-linecap": "round",
1697
- "stroke-linejoin": "round"
1698
- })
1699
- ])
1700
- ], -1)),
1701
- oe(" " + k(b.value?.btn?.deleteMany), 1)
1702
- ], 10, mn)) : L("", !0)
1703
- ])
1704
- ]),
1705
- a("div", hn, [
1706
- i.value?.feature?.searchQueryActive ? (n(), s("div", yn, [
1707
- u[16] || (u[16] = a("div", { class: "search-icon" }, [
1708
- a("svg", {
1709
- width: "16",
1710
- height: "16",
1711
- viewBox: "0 0 24 24",
1712
- fill: "none"
1713
- }, [
1714
- a("path", {
1715
- d: "M21 21L16.514 16.506M19 10.5C19 15.194 15.194 19 10.5 19C5.806 19 2 15.194 2 10.5C2 5.806 5.806 2 10.5 2C15.194 2 19 5.806 19 10.5Z",
1716
- stroke: "currentColor",
1717
- "stroke-width": "2",
1718
- "stroke-linecap": "round",
1719
- "stroke-linejoin": "round"
1720
- })
1721
- ])
1722
- ], -1)),
1723
- He(a("input", {
1724
- "onUpdate:modelValue": u[6] || (u[6] = (g) => Ke(S) ? S.value = g : null),
1725
- type: "text",
1726
- placeholder: b.value?.search || "Search...",
1727
- class: "search-input",
1728
- onKeyup: u[7] || (u[7] = ze((g) => $.value = 1, ["enter"]))
1729
- }, null, 40, fn), [
1730
- [Ye, l(S)]
1731
- ])
1732
- ])) : L("", !0)
1733
- ])
1734
- ]),
1735
- l(H).length > 0 ? (n(), s("div", bn, [
1736
- a("span", gn, k(l(H).length), 1),
1737
- oe(" " + k(l(H).length === 1 ? b.value.selection.selectedOne ?? "item is selected" : b.value.selection.selected ?? "items are selected"), 1)
1738
- ])) : L("", !0)
1739
- ]),
1740
- l(N).length === 0 ? (n(), s("div", kn, [
1741
- u[18] || (u[18] = a("div", { class: "empty-icon" }, [
1742
- a("svg", {
1743
- width: "64",
1744
- height: "64",
1745
- viewBox: "0 0 24 24",
1746
- fill: "none"
1747
- }, [
1748
- a("path", {
1749
- d: "M3 7V17C3 18.1046 3.89543 19 5 19H19C20.1046 19 21 18.1046 21 17V9C21 7.89543 20.1046 7 19 7H3ZM3 7V5C3 3.89543 3.89543 3 5 3H9",
1750
- stroke: "currentColor",
1751
- "stroke-width": "2",
1752
- "stroke-linecap": "round"
1753
- }),
1754
- a("path", {
1755
- d: "M15 13C15 14.6569 13.6569 16 12 16C10.3431 16 9 14.6569 9 13C9 11.3431 10.3431 10 12 10C13.6569 10 15 11.3431 15 13Z",
1756
- stroke: "currentColor",
1757
- "stroke-width": "2"
1758
- })
1759
- ])
1760
- ], -1)),
1761
- a("h3", wn, k(b.value?.message?.notFound), 1),
1762
- a("p", pn, k(b.value?.message?.notFoundDesc || "No data available"), 1),
1763
- i.value?.feature?.createActive ? (n(), s("button", {
1764
- key: 0,
1765
- onClick: u[8] || (u[8] = (g) => l(m)()),
1766
- class: "btn btn-primary empty-action"
1767
- }, [
1768
- u[17] || (u[17] = a("span", { class: "btn-icon" }, [
1769
- a("svg", {
1770
- width: "16",
1771
- height: "16",
1772
- viewBox: "0 0 24 24",
1773
- fill: "none"
1774
- }, [
1775
- a("path", {
1776
- d: "M12 5V19M5 12H19",
1777
- stroke: "currentColor",
1778
- "stroke-width": "2",
1779
- "stroke-linecap": "round",
1780
- "stroke-linejoin": "round"
1781
- })
1782
- ])
1783
- ], -1)),
1784
- oe(" " + k(b.value?.btn?.add), 1)
1785
- ])) : L("", !0)
1786
- ])) : (n(), s("div", _n, [
1787
- a("div", Cn, [
1788
- a("table", Dn, [
1789
- a("thead", Mn, [
1790
- a("tr", null, [
1791
- a("th", $n, [
1792
- i.value?.feature?.deleteManyActive ? He((n(), s("input", {
1793
- key: 0,
1794
- type: "checkbox",
1795
- onChange: u[9] || (u[9] = //@ts-ignore
1796
- (...g) => l(ye) && l(ye)(...g)),
1797
- "onUpdate:modelValue": u[10] || (u[10] = (g) => Ke(E) ? E.value = g : null),
1798
- class: "checkbox-input"
1799
- }, null, 544)), [
1800
- [Fe, l(E)]
1801
- ]) : L("", !0)
1802
- ]),
1803
- (n(!0), s(W, null, q(i.value?.base.headersTabelDisplay, (g, D) => (n(), s("th", {
1804
- key: g,
1805
- class: re(["table-header-cell", { "hidden-mobile": D > 0 }])
1806
- }, [
1807
- a("div", An, [
1808
- oe(k(g) + " ", 1),
1809
- i.value?.feature?.sortable ? (n(), s("button", {
1810
- key: 0,
1811
- onClick: (le) => l(ae)(g),
1812
- class: "sort-button"
1813
- }, [...u[19] || (u[19] = [
1814
- a("svg", {
1815
- width: "16",
1816
- height: "16",
1817
- viewBox: "0 0 24 24",
1818
- fill: "none"
1819
- }, [
1820
- a("path", {
1821
- d: "M8 9L12 5L16 9M16 15L12 19L8 15",
1822
- stroke: "currentColor",
1823
- "stroke-width": "2",
1824
- "stroke-linecap": "round",
1825
- "stroke-linejoin": "round"
1826
- })
1827
- ], -1)
1828
- ])], 8, Tn)) : L("", !0)
1829
- ])
1830
- ], 2))), 128)),
1831
- a("th", xn, k(b.value?.action || "Actions"), 1)
1832
- ])
1833
- ]),
1834
- a("tbody", On, [
1835
- (n(!0), s(W, null, q(l(Y), (g) => (n(), s("tr", {
1836
- key: g?.[i.value?.keys?.idKey ?? "id"],
1837
- class: "table-row"
1838
- }, [
1839
- a("td", jn, [
1840
- i.value?.feature?.deleteManyActive ? He((n(), s("input", {
1841
- key: 0,
1842
- type: "checkbox",
1843
- "onUpdate:modelValue": u[11] || (u[11] = (D) => Ke(H) ? H.value = D : null),
1844
- value: g?.[i.value?.keys?.idKey ?? "id"],
1845
- class: "checkbox-input"
1846
- }, null, 8, Hn)), [
1847
- [Fe, l(H)]
1848
- ]) : L("", !0)
1849
- ]),
1850
- (n(!0), s(W, null, q(l(Ya)(g), (D, le, pe) => (n(), s("td", {
1851
- key: le,
1852
- class: re(["table-cell", {
1853
- "hidden-mobile": pe > 0,
1854
- "primary-cell": pe === 0
1855
- }])
1856
- }, [
1857
- l(Xa)(D) ? (n(), s("div", {
1858
- key: 0,
1859
- innerHTML: D,
1860
- class: "html-content"
1861
- }, null, 8, Kn)) : le === "status" || le === "active" ? (n(), s("div", Bn, [
1862
- a("span", {
1863
- class: re({
1864
- "status-active": D,
1865
- "status-inactive": !D
1866
- })
1867
- }, k(D ? b.value?.btn.toogle?.active || "Active" : b.value?.btn.toogle?.inactive || "Inactive"), 3)
1868
- ])) : r(D) ? (n(), s("div", Vn, [
1869
- u[20] || (u[20] = a("svg", {
1870
- width: "14",
1871
- height: "14",
1872
- viewBox: "0 0 24 24",
1873
- fill: "none",
1874
- class: "cell-icon"
1875
- }, [
1876
- a("path", {
1877
- d: "M8 7V3M16 7V3M4 11H20M5 21H19C20.1046 21 21 20.1046 21 19V7C21 5.89543 20.1046 5 19 5H5C3.89543 5 3 5.89543 3 7V19C3 20.1046 3.89543 21 5 21Z",
1878
- stroke: "currentColor",
1879
- "stroke-width": "2",
1880
- "stroke-linecap": "round",
1881
- "stroke-linejoin": "round"
1882
- }),
1883
- a("path", {
1884
- d: "M12 15H12.01M12 18H12.01M16 15H16.01M16 18H16.01M8 15H8.01M8 18H8.01",
1885
- stroke: "currentColor",
1886
- "stroke-width": "2",
1887
- "stroke-linecap": "round",
1888
- "stroke-linejoin": "round"
1889
- })
1890
- ], -1)),
1891
- a("span", null, k(t(D, i.value.base.lang ?? "en")), 1)
1892
- ])) : o(D) ? (n(), s("div", Sn, [
1893
- u[21] || (u[21] = a("svg", {
1894
- width: "14",
1895
- height: "14",
1896
- viewBox: "0 0 24 24",
1897
- fill: "none",
1898
- class: "cell-icon"
1899
- }, [
1900
- a("path", {
1901
- d: "M8 7V3M16 7V3M4 11H20M5 21H19C20.1046 21 21 20.1046 21 19V7C21 5.89543 20.1046 5 19 5H5C3.89543 5 3 5.89543 3 7V19C3 20.1046 3.89543 21 5 21Z",
1902
- stroke: "currentColor",
1903
- "stroke-width": "2",
1904
- "stroke-linecap": "round",
1905
- "stroke-linejoin": "round"
1906
- })
1907
- ], -1)),
1908
- a("span", null, k(h(D, i.value.base.lang ?? "en")), 1)
1909
- ])) : c(D) ? (n(), s("div", In, [
1910
- u[22] || (u[22] = a("svg", {
1911
- width: "14",
1912
- height: "14",
1913
- viewBox: "0 0 24 24",
1914
- fill: "none",
1915
- class: "cell-icon"
1916
- }, [
1917
- a("path", {
1918
- d: "M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",
1919
- stroke: "currentColor",
1920
- "stroke-width": "2",
1921
- "stroke-linecap": "round",
1922
- "stroke-linejoin": "round"
1923
- }),
1924
- a("path", {
1925
- d: "M12 6V12L16 14",
1926
- stroke: "currentColor",
1927
- "stroke-width": "2",
1928
- "stroke-linecap": "round",
1929
- "stroke-linejoin": "round"
1930
- })
1931
- ], -1)),
1932
- a("span", null, k(v(D, i.value.base.lang ?? "en")), 1)
1933
- ])) : l(Re)(D) ? (n(), s("div", Ln, [
1934
- a("div", Nn, [
1935
- a("img", {
1936
- src: l(Ee)(D),
1937
- class: "image-preview",
1938
- alt: `Preview ${le}`
1939
- }, null, 8, Fn)
1940
- ])
1941
- ])) : l(Ja)(D) ? (n(), s("div", Pn, [
1942
- (n(!0), s(W, null, q(D.slice(0, 3), (_e, Ce) => (n(), s("div", {
1943
- key: Ce,
1944
- style: je({ backgroundColor: _e }),
1945
- class: "color-chip",
1946
- title: _e
1947
- }, null, 12, En))), 128)),
1948
- D.length > 3 ? (n(), s("span", zn, "+" + k(D.length - 3), 1)) : L("", !0)
1949
- ])) : l(Ze)(D) ? (n(), s("div", Un, [
1950
- a("div", {
1951
- style: je({ backgroundColor: D }),
1952
- class: "color-chip single",
1953
- title: D
1954
- }, null, 12, Wn)
1955
- ])) : l(Qa)(D) ? (n(), s("div", Rn, [
1956
- (n(!0), s(W, null, q(D.slice(0, 3), (_e, Ce) => (n(), s("div", {
1957
- key: Ce,
1958
- class: "image-container small"
1959
- }, [
1960
- a("img", {
1961
- src: l(Ee)(_e),
1962
- class: "image-preview",
1963
- alt: `Preview ${le}-${Ce}`
1964
- }, null, 8, Zn)
1965
- ]))), 128)),
1966
- D.length > 3 ? (n(), s("span", qn, "+" + k(D.length - 3), 1)) : L("", !0)
1967
- ])) : Array.isArray(D) ? (n(), s("div", Gn, k(D.join(", ")), 1)) : (n(), s("div", Qn, k(D), 1))
1968
- ], 2))), 128)),
1969
- a("td", Jn, [
1970
- a("div", Xn, [
1971
- i.value?.feature?.updateActive ? (n(), s("button", {
1972
- key: 0,
1973
- onClick: (D) => l(ie)(g?.[i.value?.keys?.idKey ?? "id"]),
1974
- class: "action-btn btn-edit"
1975
- }, [
1976
- u[23] || (u[23] = a("span", { class: "action-icon" }, [
1977
- a("svg", {
1978
- width: "16",
1979
- height: "16",
1980
- viewBox: "0 0 24 24",
1981
- fill: "none"
1982
- }, [
1983
- a("path", {
1984
- d: "M11 5H6C4.89543 5 4 5.89543 4 7V18C4 19.1046 4.89543 20 6 20H17C18.1046 20 19 19.1046 19 18V13M17.5858 3.58579C18.3668 2.80474 19.6332 2.80474 20.4142 3.58579C21.1953 4.36683 21.1953 5.63316 20.4142 6.41421L11.8284 15H9L9 12.1716L17.5858 3.58579Z",
1985
- stroke: "currentColor",
1986
- "stroke-width": "2",
1987
- "stroke-linecap": "round",
1988
- "stroke-linejoin": "round"
1989
- })
1990
- ])
1991
- ], -1)),
1992
- a("span", es, k(b.value?.btn?.update), 1)
1993
- ], 8, Yn)) : L("", !0),
1994
- i.value?.feature?.deleteActive ? (n(), s("button", {
1995
- key: 1,
1996
- onClick: (D) => l(j)(g?.[i.value?.keys?.idKey ?? "id"]),
1997
- class: "action-btn btn-delete"
1998
- }, [
1999
- u[24] || (u[24] = a("span", { class: "action-icon" }, [
2000
- a("svg", {
2001
- width: "16",
2002
- height: "16",
2003
- viewBox: "0 0 24 24",
2004
- fill: "none"
2005
- }, [
2006
- a("path", {
2007
- d: "M19 7L18.1327 19.1425C18.0579 20.1891 17.187 21 16.1378 21H7.86224C6.81296 21 5.94208 20.1891 5.86732 19.1425L5 7M10 11V17M14 11V17M15 7V4C15 3.44772 14.5523 3 14 3H10C9.44772 3 9 3.44772 9 4V7M4 7H20",
2008
- stroke: "currentColor",
2009
- "stroke-width": "2",
2010
- "stroke-linecap": "round",
2011
- "stroke-linejoin": "round"
2012
- })
2013
- ])
2014
- ], -1)),
2015
- a("span", as, k(b.value?.btn?.remove), 1)
2016
- ], 8, ts)) : L("", !0),
2017
- i.value?.feature?.displayActive ? (n(), s("button", {
2018
- key: 2,
2019
- onClick: (D) => l(A)(g?.[i.value?.keys?.idKey ?? "id"]),
2020
- class: "action-btn btn-view"
2021
- }, [
2022
- u[25] || (u[25] = a("span", { class: "action-icon" }, [
2023
- a("svg", {
2024
- width: "16",
2025
- height: "16",
2026
- viewBox: "0 0 24 24",
2027
- fill: "none"
2028
- }, [
2029
- a("path", {
2030
- d: "M1 12C1 12 5 4 12 4C19 4 23 12 23 12C23 12 19 20 12 20C5 20 1 12 1 12Z",
2031
- stroke: "currentColor",
2032
- "stroke-width": "2"
2033
- }),
2034
- a("path", {
2035
- d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
2036
- stroke: "currentColor",
2037
- "stroke-width": "2"
2038
- })
2039
- ])
2040
- ], -1)),
2041
- a("span", ss, k(b.value?.btn?.display), 1)
2042
- ], 8, ns)) : L("", !0)
2043
- ])
2044
- ])
2045
- ]))), 128))
2046
- ])
2047
- ])
2048
- ]),
2049
- a("div", is, [
2050
- a("div", ls, k(i.value?.pagination?.indicator?.displayingText || "Showing") + " " + k((l($) - 1) * (i.value?.pagination?.itemsPerPage ?? 5) + 1) + " - " + k(Math.min(
2051
- l($) * (i.value?.pagination?.itemsPerPage ?? 5),
2052
- l(N).length
2053
- )) + " of " + k(l(N).length) + " " + k(i.value?.pagination?.indicator?.dataText || "") + " data ", 1),
2054
- a("div", os, [
2055
- a("button", {
2056
- onClick: u[12] || (u[12] = //@ts-ignore
2057
- (...g) => l(se) && l(se)(...g)),
2058
- disabled: l($) === 1,
2059
- class: "pagination-btn pagination-prev"
2060
- }, [
2061
- u[26] || (u[26] = a("span", { class: "btn-icon" }, [
2062
- a("svg", {
2063
- width: "16",
2064
- height: "16",
2065
- viewBox: "0 0 24 24",
2066
- fill: "none"
2067
- }, [
2068
- a("path", {
2069
- d: "M15 18L9 12L15 6",
2070
- stroke: "currentColor",
2071
- "stroke-width": "2",
2072
- "stroke-linecap": "round",
2073
- "stroke-linejoin": "round"
2074
- })
2075
- ])
2076
- ], -1)),
2077
- oe(" " + k(b.value?.btn?.prev || "Previous"), 1)
2078
- ], 8, rs),
2079
- a("div", cs, [
2080
- (n(!0), s(W, null, q(l(de), (g) => (n(), s("button", {
2081
- key: g + "",
2082
- onClick: (D) => typeof g == "number" && ($.value = g),
2083
- disabled: g === "...",
2084
- class: re([{
2085
- "page-active": l($) === g,
2086
- "page-ellipsis": g === "..."
2087
- }, "page-btn"])
2088
- }, k(g), 11, us))), 128))
2089
- ]),
2090
- a("button", {
2091
- onClick: u[13] || (u[13] = //@ts-ignore
2092
- (...g) => l(ee) && l(ee)(...g)),
2093
- disabled: l($) === l(ne) || l(ne) === 0,
2094
- class: "pagination-btn pagination-next"
2095
- }, [
2096
- oe(k(b.value?.btn?.next || "Next") + " ", 1),
2097
- u[27] || (u[27] = a("span", { class: "btn-icon" }, [
2098
- a("svg", {
2099
- width: "16",
2100
- height: "16",
2101
- viewBox: "0 0 24 24",
2102
- fill: "none"
2103
- }, [
2104
- a("path", {
2105
- d: "M9 18L15 12L9 6",
2106
- stroke: "currentColor",
2107
- "stroke-width": "2",
2108
- "stroke-linecap": "round",
2109
- "stroke-linejoin": "round"
2110
- })
2111
- ])
2112
- ], -1))
2113
- ], 8, ds)
2114
- ])
2115
- ])
2116
- ]))
2117
- ])
2118
- ]));
2119
- }
2120
- }), ps = /* @__PURE__ */ me(vs, [["__scopeId", "data-v-76b9b7a6"]]);
2121
- export {
2122
- Ua as A,
2123
- ys as B,
2124
- xe as F,
2125
- fs as I,
2126
- Va as M,
2127
- ps as T,
2128
- Pe as W,
2129
- bs as _,
2130
- P as a,
2131
- nn as b,
2132
- gs as c,
2133
- an as d,
2134
- sn as e,
2135
- ln as f,
2136
- ks as g,
2137
- ws as h,
2138
- Ie as i,
2139
- ct as j,
2140
- ut as k,
2141
- dt as l
2142
- };