golden-logic-ui 1.3.26 → 1.3.28
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/components/GeneralComponents/DataTable/DatatableAction.vue.js +38 -36
- package/dist/components/GeneralComponents/DataTable/DatatableActionsMenu.vue.js +99 -0
- package/dist/components/GeneralComponents/DataTable/DatatableDeleteAction.vue.js +42 -40
- package/dist/components/GeneralComponents/DataTable/DatatableDeleteEditAction.vue.js +58 -56
- package/dist/components/GeneralComponents/DataTable/GLDataTable.vue.js +52 -49
- package/dist/components/GeneralComponents/DataTable/GLDataTableServerSide.vue.js +74 -74
- package/dist/components/GeneralComponents/DataTable/GlDataTableComponent.vue.js +30 -27
- package/dist/components/GeneralComponents/DataTable/useGlFloatingMenu.js +31 -0
- package/dist/components/GeneralComponents/GlTabsWrapper.vue.js +69 -62
- package/dist/golden-logic-ui.css +1 -1
- package/dist/main.js +83 -79
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ const X = {
|
|
|
130
130
|
generateRandomString(t) {
|
|
131
131
|
let s = "";
|
|
132
132
|
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", o = i.length;
|
|
133
|
-
for (let
|
|
133
|
+
for (let a = 0; a < t; a++)
|
|
134
134
|
s += i.charAt(
|
|
135
135
|
Math.floor(Math.random() * o)
|
|
136
136
|
);
|
|
@@ -155,7 +155,7 @@ const X = {
|
|
|
155
155
|
this.$refs.ConfirmationDelete.showLoading(), this.isLoading = !0;
|
|
156
156
|
const s = await Promise.allSettled(
|
|
157
157
|
this.checkedIds.map((o) => axios.delete(`${this.xprops.route}/${o}`))
|
|
158
|
-
), i = s.map((o,
|
|
158
|
+
), i = s.map((o, a) => ({ result: o, id: this.checkedIds[a] })).filter(({ result: o }) => o.status === "rejected");
|
|
159
159
|
if (this.checkedIds = [], this.$refs.ConfirmationDelete.hideLoading(), i.length === 0)
|
|
160
160
|
L.methods.add({
|
|
161
161
|
message: this.language?.selected_items_deleted_successfully ?? "Selected items deleted successfully.",
|
|
@@ -163,9 +163,9 @@ const X = {
|
|
|
163
163
|
duration: 5e3
|
|
164
164
|
});
|
|
165
165
|
else {
|
|
166
|
-
const o = i[0].result.reason?.response?.data?.message,
|
|
166
|
+
const o = i[0].result.reason?.response?.data?.message, a = s.length - i.length;
|
|
167
167
|
L.methods.add({
|
|
168
|
-
message: `${
|
|
168
|
+
message: `${a} of ${s.length} deleted. Not deleted: #${i.map(({ id: d }) => d).join(", #")}.` + (o ? ` ${o}` : ""),
|
|
169
169
|
type: "error",
|
|
170
170
|
duration: 1e4
|
|
171
171
|
});
|
|
@@ -268,7 +268,7 @@ const X = {
|
|
|
268
268
|
this.sortField = this.columns && this.columns.length > 0 ? this.columns[0].field_name : "", this.sortOrder = "asc", this.page = 1, this.GetItemLists(this.page);
|
|
269
269
|
},
|
|
270
270
|
async exportToExcel() {
|
|
271
|
-
const t = await import("xlsx"), s = t.default || t, i = document.querySelector("#table" + this.Random_string), o = Array.from(i.querySelectorAll("thead th")).map((p) => p.innerText), d = ["", ...["action"]], A = o.map((p, e) => d.includes(p) ? e : -1).filter((p) => p !== -1), F = Array.from(i.querySelectorAll("tbody tr")).map((p) => Array.from(p.querySelectorAll("td")).map((h) => h.innerText).filter((h,
|
|
271
|
+
const t = await import("xlsx"), s = t.default || t, i = document.querySelector("#table" + this.Random_string), o = Array.from(i.querySelectorAll("thead th")).map((p) => p.innerText), d = ["", ...["action"]], A = o.map((p, e) => d.includes(p) ? e : -1).filter((p) => p !== -1), F = Array.from(i.querySelectorAll("tbody tr")).map((p) => Array.from(p.querySelectorAll("td")).map((h) => h.innerText).filter((h, r) => !A.includes(r))), w = [o.filter((p, e) => !A.includes(e)), ...F], I = s.utils.aoa_to_sheet(w), y = s.utils.book_new();
|
|
272
272
|
s.utils.book_append_sheet(y, I, "Sheet1"), s.writeFile(y, "exported-file.xlsx");
|
|
273
273
|
}
|
|
274
274
|
},
|
|
@@ -300,7 +300,7 @@ const X = {
|
|
|
300
300
|
directives: {
|
|
301
301
|
print: B
|
|
302
302
|
}
|
|
303
|
-
}, W = { class: "p-0" }, K = { class: "flex flex-col flex-wrap gap-4 pb-4 xl:flex-row xl:items-center xl:justify-between" }, $ = { class: "flex items-center gap-2" }, ee = { class: "font-medium" }, te = { class: "mt-[3px]" }, le = { class: "font-medium" }, ie = { class: "relative" }, se = ["placeholder"],
|
|
303
|
+
}, W = { class: "p-0" }, K = { class: "flex flex-col flex-wrap gap-4 pb-4 xl:flex-row xl:items-center xl:justify-between" }, $ = { class: "flex items-center gap-2" }, ee = { class: "font-medium" }, te = { class: "mt-[3px]" }, le = { class: "font-medium" }, ie = { class: "relative" }, se = ["placeholder"], ae = { class: "flex flex-wrap mb-3 gap-1 lg:gap-0!" }, re = ["id"], ne = ["aria-labelledby"], de = { class: "flex items-center p-2 rounded-sm hover:bg-gray-100 dark:hover:bg-gray-600" }, oe = ["id", "onUpdate:modelValue"], ce = ["for"], ge = ["id"], ue = ["id"], he = { class: "hidden text-sm font-normal text-center text-gray-600 print:table-header-group! lg:table-header-group dark:border-gray-600 bg-gray-50 dark:bg-gray-800 dark:text-gray-400 print:border-[1px]!" }, me = {
|
|
304
304
|
key: 0,
|
|
305
305
|
class: "w-full px-4 py-2 lg:w-[3%]! print:hidden!"
|
|
306
306
|
}, fe = ["onClick"], _e = { class: "inline-flex items-center justify-center gap-1" }, pe = {
|
|
@@ -314,10 +314,10 @@ const X = {
|
|
|
314
314
|
class: "text-xs text-gray-500 dark:text-gray-400"
|
|
315
315
|
}, Ve = {
|
|
316
316
|
key: 0,
|
|
317
|
-
class: "print:hidden! text-center rounded-t-lg lg:rounded-t-none! print:rounded-t-none! text-pretty before:content-[attr(data-label)] before:font-bold dark:before:text-gray-400 lg:before:content-[''] print:before:content-['']! flex flex-col justify-between gap-2 lg:table-cell py-
|
|
317
|
+
class: "print:hidden! text-center rounded-t-lg lg:rounded-t-none! print:rounded-t-none! text-pretty before:content-[attr(data-label)] before:font-bold dark:before:text-gray-400 lg:before:content-[''] print:before:content-['']! flex flex-col justify-between gap-2 lg:table-cell py-2 px-4 lg:py-3 lg:px-4 print:py-3! print:px-4! border! dark:border-gray-700",
|
|
318
318
|
"data-label": ""
|
|
319
319
|
}, Se = ["checked", "onChange"], Fe = ["data-label"], De = { class: "flex items-center justify-between bg-white border-gray-200 dark:text-gray-400 dark:bg-gray-800" };
|
|
320
|
-
function Ie(t, s, i, o,
|
|
320
|
+
function Ie(t, s, i, o, a, d) {
|
|
321
321
|
const A = k("DynamicConfirmation"), F = k("dropdown"), D = k("GlDropdown"), w = k("GlTextInput"), I = k("GlDateRangePicker"), y = k("gl-button"), P = k("TailwindPagination"), p = H("click-outside");
|
|
322
322
|
return n(), c(f, null, [
|
|
323
323
|
x(A, { ref: "ConfirmationDelete" }, null, 512),
|
|
@@ -329,9 +329,9 @@ function Ie(t, s, i, o, r, d) {
|
|
|
329
329
|
x(F, {
|
|
330
330
|
options_top_size: 0,
|
|
331
331
|
has_cancel: !1,
|
|
332
|
-
options:
|
|
333
|
-
modelValue:
|
|
334
|
-
"onUpdate:modelValue": s[0] || (s[0] = (e) =>
|
|
332
|
+
options: a.pageOptions,
|
|
333
|
+
modelValue: a.perPage,
|
|
334
|
+
"onUpdate:modelValue": s[0] || (s[0] = (e) => a.perPage = e),
|
|
335
335
|
is_required: !1,
|
|
336
336
|
field_name: "perPage",
|
|
337
337
|
label_name: "",
|
|
@@ -350,12 +350,12 @@ function Ie(t, s, i, o, r, d) {
|
|
|
350
350
|
s[4] || (s[4] = l("div", { class: "absolute inset-y-0 left-0 flex items-center pointer-events-none rtl:inset-r-0 rtl:right-0 ps-3" }, null, -1)),
|
|
351
351
|
V(l("input", {
|
|
352
352
|
type: "text",
|
|
353
|
-
"onUpdate:modelValue": s[1] || (s[1] = (e) =>
|
|
353
|
+
"onUpdate:modelValue": s[1] || (s[1] = (e) => a.search = e),
|
|
354
354
|
onInput: s[2] || (s[2] = (e) => d.handleSearch()),
|
|
355
355
|
class: "gl-input-form",
|
|
356
356
|
placeholder: i.language?.search ? i.language?.search + " ..." : "Search ..."
|
|
357
357
|
}, null, 40, se), [
|
|
358
|
-
[R,
|
|
358
|
+
[R, a.search]
|
|
359
359
|
])
|
|
360
360
|
])
|
|
361
361
|
]),
|
|
@@ -367,8 +367,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
367
367
|
key: 0,
|
|
368
368
|
has_cancel: !0,
|
|
369
369
|
options: e.options,
|
|
370
|
-
modelValue:
|
|
371
|
-
"onUpdate:modelValue": (
|
|
370
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
371
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
372
372
|
is_required: !1,
|
|
373
373
|
field_name: e.field_name,
|
|
374
374
|
label_name: e.field_label,
|
|
@@ -380,8 +380,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
380
380
|
type: "text",
|
|
381
381
|
is_required: !1,
|
|
382
382
|
show: !1,
|
|
383
|
-
modelValue:
|
|
384
|
-
"onUpdate:modelValue": (
|
|
383
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
384
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
385
385
|
field_name: e.field_name,
|
|
386
386
|
label_name: e.field_label
|
|
387
387
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "field_name", "label_name"])) : g("", !0),
|
|
@@ -390,8 +390,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
390
390
|
type: "date",
|
|
391
391
|
is_required: !1,
|
|
392
392
|
show: !1,
|
|
393
|
-
modelValue:
|
|
394
|
-
"onUpdate:modelValue": (
|
|
393
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
394
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
395
395
|
field_name: e.field_name,
|
|
396
396
|
label_name: e.field_label
|
|
397
397
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "field_name", "label_name"])) : g("", !0),
|
|
@@ -399,8 +399,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
399
399
|
key: 3,
|
|
400
400
|
is_required: !1,
|
|
401
401
|
show: !1,
|
|
402
|
-
modelValue:
|
|
403
|
-
"onUpdate:modelValue": (
|
|
402
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
403
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
404
404
|
field_name: e.field_name,
|
|
405
405
|
label_name: e.field_label,
|
|
406
406
|
date_format: e.date_format || "YYYY-MM-DD"
|
|
@@ -412,8 +412,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
412
412
|
key: 0,
|
|
413
413
|
has_cancel: !0,
|
|
414
414
|
options: e.hasOwnFilter.options,
|
|
415
|
-
modelValue:
|
|
416
|
-
"onUpdate:modelValue": (
|
|
415
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
416
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
417
417
|
is_required: !1,
|
|
418
418
|
field_name: e.field_name,
|
|
419
419
|
label_name: e.field_label,
|
|
@@ -425,8 +425,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
425
425
|
type: "text",
|
|
426
426
|
is_required: !1,
|
|
427
427
|
show: !1,
|
|
428
|
-
modelValue:
|
|
429
|
-
"onUpdate:modelValue": (
|
|
428
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
429
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
430
430
|
field_name: e.field_name,
|
|
431
431
|
label_name: e.field_label
|
|
432
432
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "field_name", "label_name"])) : g("", !0),
|
|
@@ -435,15 +435,15 @@ function Ie(t, s, i, o, r, d) {
|
|
|
435
435
|
type: "date",
|
|
436
436
|
is_required: !1,
|
|
437
437
|
show: !1,
|
|
438
|
-
modelValue:
|
|
439
|
-
"onUpdate:modelValue": (
|
|
438
|
+
modelValue: a.dynamicFilters[e.field_name],
|
|
439
|
+
"onUpdate:modelValue": (r) => a.dynamicFilters[e.field_name] = r,
|
|
440
440
|
field_name: e.field_name,
|
|
441
441
|
label_name: e.field_label
|
|
442
442
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "field_name", "label_name"])) : g("", !0)
|
|
443
443
|
], 64)) : g("", !0)
|
|
444
444
|
], 64))), 128))
|
|
445
445
|
], 2),
|
|
446
|
-
l("div",
|
|
446
|
+
l("div", ae, [
|
|
447
447
|
i.enable_select_deselect_delete ? (n(), _(y, {
|
|
448
448
|
key: 0,
|
|
449
449
|
onClick: d.toggleSelectAll,
|
|
@@ -473,12 +473,12 @@ function Ie(t, s, i, o, r, d) {
|
|
|
473
473
|
x(y, {
|
|
474
474
|
onClick: d.delayedPrint,
|
|
475
475
|
tag: "button",
|
|
476
|
-
is_loading:
|
|
476
|
+
is_loading: a.isLoadinPrint,
|
|
477
477
|
button_type: "light",
|
|
478
478
|
has_border_reduced: !1,
|
|
479
479
|
classes: "rounded-lg lg:rounded-none",
|
|
480
|
-
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
481
|
-
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M16.444 18H19a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h2.556M17 11V5a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v6h10ZM7 15h10v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-4Z"
|
|
480
|
+
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
481
|
+
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M16.444 18H19a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h2.556M17 11V5a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v6h10ZM7 15h10v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-4Z"/>
|
|
482
482
|
</svg>`
|
|
483
483
|
}, {
|
|
484
484
|
default: C(() => [
|
|
@@ -492,9 +492,9 @@ function Ie(t, s, i, o, r, d) {
|
|
|
492
492
|
button_type: "light",
|
|
493
493
|
has_border_reduced: !1,
|
|
494
494
|
classes: "rounded-lg lg:rounded-none",
|
|
495
|
-
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
496
|
-
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M10 3v4a1 1 0 0 1-1 1H5m14-4v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z"
|
|
497
|
-
</svg
|
|
495
|
+
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
496
|
+
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M10 3v4a1 1 0 0 1-1 1H5m14-4v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z"/>
|
|
497
|
+
</svg>
|
|
498
498
|
`
|
|
499
499
|
}, {
|
|
500
500
|
default: C(() => [
|
|
@@ -544,22 +544,22 @@ function Ie(t, s, i, o, r, d) {
|
|
|
544
544
|
], -1))
|
|
545
545
|
], 2),
|
|
546
546
|
V(l("div", {
|
|
547
|
-
id: "db_" +
|
|
547
|
+
id: "db_" + a.Random_string,
|
|
548
548
|
class: "z-10 absolute w-42 bg-white rounded-lg shadow-sm dark:bg-gray-700"
|
|
549
549
|
}, [
|
|
550
550
|
l("ul", {
|
|
551
551
|
class: "p-3 space-y-1 text-sm text-gray-700 dark:text-gray-200",
|
|
552
|
-
"aria-labelledby": "db_" +
|
|
552
|
+
"aria-labelledby": "db_" + a.Random_string
|
|
553
553
|
}, [
|
|
554
554
|
(n(!0), c(f, null, v(i.columns, (e, h) => (n(), c("li", null, [
|
|
555
555
|
l("div", de, [
|
|
556
556
|
V(l("input", {
|
|
557
557
|
id: "cb_" + e.field_name,
|
|
558
558
|
type: "checkbox",
|
|
559
|
-
"onUpdate:modelValue": (
|
|
559
|
+
"onUpdate:modelValue": (r) => a.columnVisibility[e.field_name] = r,
|
|
560
560
|
class: "w-4 h-4 rounded-sm"
|
|
561
561
|
}, null, 8, oe), [
|
|
562
|
-
[z,
|
|
562
|
+
[z, a.columnVisibility[e.field_name]]
|
|
563
563
|
]),
|
|
564
564
|
l("label", {
|
|
565
565
|
for: "cb_" + e.field_name,
|
|
@@ -568,8 +568,8 @@ function Ie(t, s, i, o, r, d) {
|
|
|
568
568
|
])
|
|
569
569
|
]))), 256))
|
|
570
570
|
], 8, ne)
|
|
571
|
-
], 8,
|
|
572
|
-
[Z,
|
|
571
|
+
], 8, re), [
|
|
572
|
+
[Z, a.isOpenColumnVisibility]
|
|
573
573
|
])
|
|
574
574
|
])), [
|
|
575
575
|
[p, d.closeColumnVisibilityDropdown]
|
|
@@ -581,23 +581,23 @@ function Ie(t, s, i, o, r, d) {
|
|
|
581
581
|
button_type: "red",
|
|
582
582
|
has_border_reduced: !1,
|
|
583
583
|
classes: "rounded-lg lg:rounded-none lg:rounded-e-lg!",
|
|
584
|
-
is_disabled:
|
|
585
|
-
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
586
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"
|
|
584
|
+
is_disabled: a.checkedIds.length <= 0,
|
|
585
|
+
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
586
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"/>
|
|
587
587
|
</svg>`
|
|
588
588
|
}, {
|
|
589
589
|
default: C(() => [
|
|
590
|
-
b(u(i.language?.delete_selected ?? "Delete selected") + " " + u(
|
|
590
|
+
b(u(i.language?.delete_selected ?? "Delete selected") + " " + u(a.checkedIds.length > 0 ? `(${a.checkedIds.length})` : ""), 1)
|
|
591
591
|
]),
|
|
592
592
|
_: 1
|
|
593
593
|
}, 8, ["onClick", "is_disabled"])) : g("", !0)
|
|
594
594
|
]),
|
|
595
595
|
l("div", {
|
|
596
|
-
id: "print_" +
|
|
596
|
+
id: "print_" + a.Random_string,
|
|
597
597
|
class: "overflow-auto rounded-lg dark:text-gray-400 dark:bg-gray-800"
|
|
598
598
|
}, [
|
|
599
599
|
l("table", {
|
|
600
|
-
id: "table" +
|
|
600
|
+
id: "table" + a.Random_string,
|
|
601
601
|
class: "w-full h-full max-w-full overflow-hidden bg-white border-separate xl:overflow-auto lg:border-collapse print:border-collapse! border-spacing-y-5 lg:border-spacing-y-0 print:border-spacing-y-0! dark:border-gray-800 dark:bg-gray-900"
|
|
602
602
|
}, [
|
|
603
603
|
l("thead", he, [
|
|
@@ -605,12 +605,12 @@ function Ie(t, s, i, o, r, d) {
|
|
|
605
605
|
i.enable_select_deselect_delete ? (n(), c("th", me)) : g("", !0),
|
|
606
606
|
(n(!0), c(f, null, v(d.visibleColumns, (e, h) => (n(), c("th", {
|
|
607
607
|
key: h,
|
|
608
|
-
onClick: (
|
|
608
|
+
onClick: (r) => d.updateSortColumn(e.field_name, e.sortable),
|
|
609
609
|
class: "w-full px-4 py-2 lg:w-2/12 print:w-2/12! print:border!"
|
|
610
610
|
}, [
|
|
611
611
|
l("div", _e, [
|
|
612
612
|
l("span", null, u(e.field_label), 1),
|
|
613
|
-
|
|
613
|
+
a.sortField === e.field_name ? (n(), c("span", pe, s[8] || (s[8] = [
|
|
614
614
|
l("svg", {
|
|
615
615
|
class: "w-4 h-4",
|
|
616
616
|
"aria-hidden": "true",
|
|
@@ -632,7 +632,7 @@ function Ie(t, s, i, o, r, d) {
|
|
|
632
632
|
])
|
|
633
633
|
]),
|
|
634
634
|
l("tbody", ye, [
|
|
635
|
-
|
|
635
|
+
a.isLoading ? (n(), c("tr", be, [
|
|
636
636
|
l("td", {
|
|
637
637
|
colspan: i.columns.length + (i.enable_select_deselect_delete ? 1 : 0)
|
|
638
638
|
}, s[9] || (s[9] = [
|
|
@@ -679,14 +679,14 @@ function Ie(t, s, i, o, r, d) {
|
|
|
679
679
|
], -1)
|
|
680
680
|
]), 8, ke)
|
|
681
681
|
])) : g("", !0),
|
|
682
|
-
!
|
|
682
|
+
!a.isLoading && a.error ? (n(), c("tr", we, [
|
|
683
683
|
l("td", {
|
|
684
684
|
colspan: i.columns.length + (i.enable_select_deselect_delete ? 1 : 0),
|
|
685
685
|
class: "px-5 py-6 border! dark:border-gray-700"
|
|
686
686
|
}, [
|
|
687
687
|
l("div", ve, [
|
|
688
688
|
l("p", Ce, u(i.language?.failed_to_load_data ?? "Could not load the data."), 1),
|
|
689
|
-
|
|
689
|
+
a.errorMessage ? (n(), c("p", Ae, u(a.errorMessage), 1)) : g("", !0),
|
|
690
690
|
x(y, {
|
|
691
691
|
tag: "button",
|
|
692
692
|
button_type: "light",
|
|
@@ -700,56 +700,56 @@ function Ie(t, s, i, o, r, d) {
|
|
|
700
700
|
])
|
|
701
701
|
], 8, xe)
|
|
702
702
|
])) : g("", !0),
|
|
703
|
-
!
|
|
703
|
+
!a.isLoading && !a.error ? (n(!0), c(f, { key: 2 }, v(a.itemLists.data, (e, h) => (n(), c("tr", {
|
|
704
704
|
key: h,
|
|
705
705
|
class: "text-gray-500 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
|
706
706
|
}, [
|
|
707
707
|
i.enable_select_deselect_delete ? (n(), c("td", Ve, [
|
|
708
708
|
l("input", {
|
|
709
|
-
checked:
|
|
710
|
-
onChange: (
|
|
709
|
+
checked: a.checkedIds.includes(e.id),
|
|
710
|
+
onChange: (r) => d.toggleCheck(e.id),
|
|
711
711
|
type: "checkbox",
|
|
712
712
|
value: "",
|
|
713
713
|
class: "w-4 h-4 rounded-sm"
|
|
714
714
|
}, null, 40, Se)
|
|
715
715
|
])) : g("", !0),
|
|
716
|
-
(n(!0), c(f, null, v(d.visibleColumns, (
|
|
717
|
-
style: Y(
|
|
716
|
+
(n(!0), c(f, null, v(d.visibleColumns, (r, O) => (n(), c("td", {
|
|
717
|
+
style: Y(r?.style),
|
|
718
718
|
key: O,
|
|
719
|
-
"data-label":
|
|
720
|
-
class: S(["text-pretty before:content-[attr(data-label)] before:font-bold lg:before:content-none print:before:content-none! flex flex-
|
|
719
|
+
"data-label": r.field_label,
|
|
720
|
+
class: S(["text-pretty before:content-[attr(data-label)] before:font-bold lg:before:content-none print:before:content-none! flex flex-row flex-wrap items-center justify-between gap-x-4 gap-y-1 wrap-anywhere lg:wrap-normal lg:table-cell print:table-cell! py-2.5 px-4 lg:py-3 lg:px-4 print:py-3! print:px-4! border! dark:border-gray-700", {
|
|
721
721
|
/* 'rounded-t-lg lg:rounded-t-none': colIndex === 0,*/
|
|
722
722
|
"rounded-b-lg lg:rounded-b-none!": O === i.columns.length - 1
|
|
723
723
|
}])
|
|
724
724
|
}, [
|
|
725
725
|
l("div", {
|
|
726
|
-
class: S([
|
|
726
|
+
class: S([r.field_name === "action" ? "" : "overflow-auto", "td_overflow_auto max-h-40 max-w-100"])
|
|
727
727
|
}, [
|
|
728
|
-
|
|
728
|
+
r.tdComp ? (n(), _(Q(d.forDynCompIs(r.tdComp)), {
|
|
729
729
|
key: 0,
|
|
730
730
|
language: i.language,
|
|
731
731
|
row: e,
|
|
732
|
-
field:
|
|
732
|
+
field: r.field_name,
|
|
733
733
|
xprops: i.xprops,
|
|
734
|
-
tdProps:
|
|
734
|
+
tdProps: r.tdProps,
|
|
735
735
|
onDeleteAction: (m) => {
|
|
736
|
-
d.GetItemLists(), d.cellAction("deleteAction", e, m,
|
|
736
|
+
d.GetItemLists(), d.cellAction("deleteAction", e, m, r);
|
|
737
737
|
},
|
|
738
738
|
onEditAction: (m) => {
|
|
739
|
-
d.editAction(e), d.cellAction("editAction", e, m,
|
|
739
|
+
d.editAction(e), d.cellAction("editAction", e, m, r);
|
|
740
740
|
},
|
|
741
741
|
onGeneralAction: (m) => {
|
|
742
|
-
d.generalAction(e), d.cellAction("generalAction", e, m,
|
|
742
|
+
d.generalAction(e), d.cellAction("generalAction", e, m, r);
|
|
743
743
|
},
|
|
744
744
|
onGeneralAction1: (m) => {
|
|
745
|
-
d.generalAction1(e), d.cellAction("generalAction1", e, m,
|
|
745
|
+
d.generalAction1(e), d.cellAction("generalAction1", e, m, r);
|
|
746
746
|
},
|
|
747
747
|
onGeneralAction2: (m) => {
|
|
748
|
-
d.generalAction2(e), d.cellAction("generalAction2", e, m,
|
|
748
|
+
d.generalAction2(e), d.cellAction("generalAction2", e, m, r);
|
|
749
749
|
},
|
|
750
|
-
onCellAction: (m, G) => d.cellAction(m, e, G,
|
|
750
|
+
onCellAction: (m, G) => d.cellAction(m, e, G, r)
|
|
751
751
|
}, null, 40, ["language", "row", "field", "xprops", "tdProps", "onDeleteAction", "onEditAction", "onGeneralAction", "onGeneralAction1", "onGeneralAction2", "onCellAction"])) : (n(), c(f, { key: 1 }, [
|
|
752
|
-
b(u(e[
|
|
752
|
+
b(u(e[r.field_name]), 1)
|
|
753
753
|
], 64))
|
|
754
754
|
], 2)
|
|
755
755
|
], 14, Fe))), 128))
|
|
@@ -761,17 +761,17 @@ function Ie(t, s, i, o, r, d) {
|
|
|
761
761
|
x(P, {
|
|
762
762
|
class: "mt-3 mb-0",
|
|
763
763
|
classes: "px-4 py-3 sm:px-6",
|
|
764
|
-
data:
|
|
765
|
-
limit:
|
|
766
|
-
size:
|
|
767
|
-
align:
|
|
764
|
+
data: a.itemLists,
|
|
765
|
+
limit: a.limit,
|
|
766
|
+
size: a.size,
|
|
767
|
+
align: a.align,
|
|
768
768
|
onPaginationChangePage: d.GetItemLists
|
|
769
769
|
}, null, 8, ["data", "limit", "size", "align", "onPaginationChangePage"])
|
|
770
770
|
])
|
|
771
771
|
])
|
|
772
772
|
], 64);
|
|
773
773
|
}
|
|
774
|
-
const Ee = /* @__PURE__ */ J(X, [["render", Ie], ["__scopeId", "data-v-
|
|
774
|
+
const Ee = /* @__PURE__ */ J(X, [["render", Ie], ["__scopeId", "data-v-cd37a6ae"]]);
|
|
775
775
|
export {
|
|
776
776
|
Ee as default
|
|
777
777
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import M from "../../../node_modules/vue3-print-nb/dist/vue3-print-nb.es.js";
|
|
2
|
-
import { resolveComponent as D, resolveDirective as E, createElementBlock as g, openBlock as d, withDirectives as j, createElementVNode as e, createCommentVNode as v, createVNode as
|
|
2
|
+
import { resolveComponent as D, resolveDirective as E, createElementBlock as g, openBlock as d, withDirectives as j, createElementVNode as e, createCommentVNode as v, createVNode as _, vModelText as S, withCtx as L, createTextVNode as f, Fragment as b, renderList as w, toDisplayString as y, normalizeClass as k, createBlock as I, resolveDynamicComponent as O, withModifiers as P } from "vue";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import B from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
5
5
|
const H = {
|
|
@@ -93,8 +93,8 @@ const H = {
|
|
|
93
93
|
},
|
|
94
94
|
methods: {
|
|
95
95
|
async exportToExcel() {
|
|
96
|
-
const r = await import("xlsx"), t = r.default || r, n = document.querySelector("#table" + this.Random_string), c = Array.from(n.querySelectorAll("thead th")).map((o) => o.innerText), a = ["", ...["action"]], p = c.map((o,
|
|
97
|
-
t.utils.book_append_sheet(i,
|
|
96
|
+
const r = await import("xlsx"), t = r.default || r, n = document.querySelector("#table" + this.Random_string), c = Array.from(n.querySelectorAll("thead th")).map((o) => o.innerText), a = ["", ...["action"]], p = c.map((o, u) => a.includes(o) ? u : -1).filter((o) => o !== -1), x = Array.from(n.querySelectorAll("tbody tr")).map((o) => Array.from(o.querySelectorAll("td")).map((C) => C.innerText).filter((C, T) => !p.includes(T))), s = [c.filter((o, u) => !p.includes(u)), ...x], h = t.utils.aoa_to_sheet(s), i = t.utils.book_new();
|
|
97
|
+
t.utils.book_append_sheet(i, h, "Sheet1"), t.writeFile(i, "exported-file.xlsx");
|
|
98
98
|
},
|
|
99
99
|
generateRandomString(r) {
|
|
100
100
|
let t = "";
|
|
@@ -173,7 +173,7 @@ const H = {
|
|
|
173
173
|
}, V = { class: "p-0" }, K = {
|
|
174
174
|
ref: "hiddenPrintBtn",
|
|
175
175
|
style: { display: "none" }
|
|
176
|
-
}, q = { class: "flex flex-col flex-wrap gap-4 pb-4 xl:flex-row xl:items-center xl:justify-between" }, R = { class: "flex items-center gap-2" },
|
|
176
|
+
}, q = { class: "flex flex-col flex-wrap gap-4 pb-4 xl:flex-row xl:items-center xl:justify-between" }, R = { class: "flex items-center gap-2" }, G = { class: "mt-[9px]" }, N = { class: "relative" }, F = { class: "flex flex-wrap mb-3" }, Z = ["id"], z = ["id"], U = { class: "hidden text-sm font-normal text-center text-gray-600 print:table-header-group! lg:table-header-group dark:border-gray-600 bg-gray-50 dark:bg-gray-800 dark:text-gray-400 print:border-[1px]!" }, X = ["onClick"], W = { class: "inline-flex items-center justify-center gap-1" }, J = {
|
|
177
177
|
key: 0,
|
|
178
178
|
class: "print:hidden!"
|
|
179
179
|
}, Q = { class: "bg-white dark:bg-gray-900" }, Y = { key: 0 }, $ = ["colspan"], ee = ["data-label"], te = {
|
|
@@ -183,7 +183,7 @@ const H = {
|
|
|
183
183
|
key: 0,
|
|
184
184
|
class: "flex items-center justify-between px-4 py-3 bg-white border-gray-200 sm:px-6 dark:text-gray-400 dark:bg-gray-800"
|
|
185
185
|
}, ae = { class: "flex flex-col items-center w-full gap-2" }, le = { class: "text-sm text-gray-700 dark:text-gray-400" }, ne = { class: "font-semibold text-gray-900 dark:text-white" }, ie = { class: "font-semibold text-gray-900 dark:text-white" }, oe = { class: "font-semibold text-gray-900 dark:text-white" }, de = { "aria-label": "Page navigation" }, ge = { class: "flex items-center h-8 -space-x-px text-sm" }, ce = ["onClick", "aria-current"];
|
|
186
|
-
function
|
|
186
|
+
function he(r, t, n, c, l, a) {
|
|
187
187
|
const p = D("dropdown"), x = D("gl-button"), A = E("print");
|
|
188
188
|
return d(), g("div", V, [
|
|
189
189
|
j(e("button", K, null, 512), [
|
|
@@ -192,8 +192,8 @@ function ue(r, t, n, c, l, a) {
|
|
|
192
192
|
e("div", q, [
|
|
193
193
|
e("div", R, [
|
|
194
194
|
t[4] || (t[4] = e("span", { class: "font-medium" }, " Show ", -1)),
|
|
195
|
-
e("div",
|
|
196
|
-
|
|
195
|
+
e("div", G, [
|
|
196
|
+
_(p, {
|
|
197
197
|
has_cancel: !1,
|
|
198
198
|
options: l.showNoOfEntries,
|
|
199
199
|
modelValue: l.itemsPerPage,
|
|
@@ -212,7 +212,7 @@ function ue(r, t, n, c, l, a) {
|
|
|
212
212
|
for: "table-search",
|
|
213
213
|
class: "sr-only"
|
|
214
214
|
}, "Search", -1)),
|
|
215
|
-
e("div",
|
|
215
|
+
e("div", N, [
|
|
216
216
|
t[6] || (t[6] = e("div", { class: "absolute inset-y-0 left-0 flex items-center pointer-events-none rtl:inset-r-0 rtl:right-0 ps-3" }, null, -1)),
|
|
217
217
|
j(e("input", {
|
|
218
218
|
type: "text",
|
|
@@ -225,15 +225,15 @@ function ue(r, t, n, c, l, a) {
|
|
|
225
225
|
])
|
|
226
226
|
]),
|
|
227
227
|
e("div", F, [
|
|
228
|
-
|
|
228
|
+
_(x, {
|
|
229
229
|
onClick: a.delayedPrint,
|
|
230
230
|
tag: "button",
|
|
231
231
|
is_loading: r.isLoadingPrint,
|
|
232
232
|
button_type: "light",
|
|
233
233
|
has_border_reduced: !1,
|
|
234
234
|
classes: "rounded-s-lg",
|
|
235
|
-
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
236
|
-
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M16.444 18H19a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h2.556M17 11V5a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v6h10ZM7 15h10v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-4Z"
|
|
235
|
+
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
236
|
+
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M16.444 18H19a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h2.556M17 11V5a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v6h10ZM7 15h10v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-4Z"/>
|
|
237
237
|
</svg>`
|
|
238
238
|
}, {
|
|
239
239
|
default: L(() => t[8] || (t[8] = [
|
|
@@ -241,15 +241,15 @@ function ue(r, t, n, c, l, a) {
|
|
|
241
241
|
])),
|
|
242
242
|
_: 1
|
|
243
243
|
}, 8, ["onClick", "is_loading"]),
|
|
244
|
-
|
|
244
|
+
_(x, {
|
|
245
245
|
onClick: a.exportToExcel,
|
|
246
246
|
tag: "button",
|
|
247
247
|
button_type: "light",
|
|
248
248
|
has_border_reduced: !1,
|
|
249
249
|
classes: "rounded-e-lg",
|
|
250
|
-
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
251
|
-
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M10 3v4a1 1 0 0 1-1 1H5m14-4v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z"
|
|
252
|
-
</svg
|
|
250
|
+
svg_icon: `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
251
|
+
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M10 3v4a1 1 0 0 1-1 1H5m14-4v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z"/>
|
|
252
|
+
</svg>
|
|
253
253
|
`
|
|
254
254
|
}, {
|
|
255
255
|
default: L(() => t[9] || (t[9] = [
|
|
@@ -268,8 +268,8 @@ function ue(r, t, n, c, l, a) {
|
|
|
268
268
|
}, [
|
|
269
269
|
e("thead", U, [
|
|
270
270
|
e("tr", null, [
|
|
271
|
-
(d(!0), g(b, null, w(n.columns, (s,
|
|
272
|
-
key:
|
|
271
|
+
(d(!0), g(b, null, w(n.columns, (s, h) => (d(), g("th", {
|
|
272
|
+
key: h,
|
|
273
273
|
onClick: (i) => a.sort(s.field_name, s.sortable),
|
|
274
274
|
class: "w-full px-4 py-2 lg:w-2/12 print:w-2/12! print:border!"
|
|
275
275
|
}, [
|
|
@@ -344,20 +344,20 @@ function ue(r, t, n, c, l, a) {
|
|
|
344
344
|
], -1)
|
|
345
345
|
]), 8, $)
|
|
346
346
|
])) : v("", !0),
|
|
347
|
-
l.isLoading ? v("", !0) : (d(!0), g(b, { key: 1 }, w(a.paginatedData, (s,
|
|
348
|
-
key:
|
|
347
|
+
l.isLoading ? v("", !0) : (d(!0), g(b, { key: 1 }, w(a.paginatedData, (s, h) => (d(), g("tr", {
|
|
348
|
+
key: h,
|
|
349
349
|
class: "text-gray-500 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
|
350
350
|
}, [
|
|
351
351
|
(d(!0), g(b, null, w(n.columns, (i, m) => (d(), g("td", {
|
|
352
352
|
key: m,
|
|
353
353
|
"data-label": i.field_label,
|
|
354
|
-
class:
|
|
354
|
+
class: k(["text-pretty before:content-[attr(data-label)] before:font-bold dark:before:text-gray-400 lg:before:content-[''] print:before:content-['']! flex flex-row flex-wrap items-center justify-between gap-x-4 gap-y-1 wrap-anywhere lg:wrap-normal lg:table-cell print:table-cell! py-2.5 px-4 lg:py-3 lg:px-4 print:py-3! print:px-4! border-[1px]! dark:border-gray-700", {
|
|
355
355
|
"rounded-t-lg lg:rounded-t-none!": m === 0,
|
|
356
356
|
"rounded-b-lg lg:rounded-b-none!": m === n.columns.length - 1
|
|
357
357
|
}])
|
|
358
358
|
}, [
|
|
359
359
|
e("div", {
|
|
360
|
-
class:
|
|
360
|
+
class: k([i.field_name === "action" ? "" : "overflow-auto", "td_overflow_auto max-h-40 max-w-100"])
|
|
361
361
|
}, [
|
|
362
362
|
i.tdComp ? (d(), I(O(a.forDynCompIs(i.tdComp)), {
|
|
363
363
|
key: 0,
|
|
@@ -372,7 +372,7 @@ function ue(r, t, n, c, l, a) {
|
|
|
372
372
|
a.generalAction(s), a.cellAction("generalAction", s, o, i);
|
|
373
373
|
},
|
|
374
374
|
onDeleteAction: (o) => a.cellAction("deleteAction", s, o, i),
|
|
375
|
-
onCellAction: (o,
|
|
375
|
+
onCellAction: (o, u) => a.cellAction(o, s, u, i)
|
|
376
376
|
}, null, 40, ["row", "field", "xprops", "tdProps", "onEditAction", "onGeneralAction", "onDeleteAction", "onCellAction"])) : (d(), g(b, { key: 1 }, [
|
|
377
377
|
a.isEscapedColumn(i) ? (d(), g("p", te, y(s[i.field_name]), 1)) : (d(), g("p", {
|
|
378
378
|
key: 1,
|
|
@@ -423,14 +423,17 @@ function ue(r, t, n, c, l, a) {
|
|
|
423
423
|
], -1)
|
|
424
424
|
]))
|
|
425
425
|
]),
|
|
426
|
-
(d(!0), g(b, null, w(a.displayedPageNumbers, (s) => (d(), g("li", {
|
|
426
|
+
(d(!0), g(b, null, w(a.displayedPageNumbers, (s) => (d(), g("li", {
|
|
427
|
+
key: s,
|
|
428
|
+
class: k(Math.abs(s - l.currentPage) > 2 ? "hidden sm:block" : "")
|
|
429
|
+
}, [
|
|
427
430
|
e("a", {
|
|
428
431
|
href: "#",
|
|
429
|
-
onClick: P((
|
|
430
|
-
class:
|
|
432
|
+
onClick: P((h) => a.goToPage(s), ["prevent"]),
|
|
433
|
+
class: k(l.currentPage === s ? "z-10 flex items-center justify-center h-8 px-3 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white" : "flex items-center justify-center h-8 px-3 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"),
|
|
431
434
|
"aria-current": l.currentPage === s ? "page" : void 0
|
|
432
435
|
}, y(s), 11, ce)
|
|
433
|
-
]))), 128)),
|
|
436
|
+
], 2))), 128)),
|
|
434
437
|
e("li", null, [
|
|
435
438
|
e("a", {
|
|
436
439
|
href: "#",
|
|
@@ -461,7 +464,7 @@ function ue(r, t, n, c, l, a) {
|
|
|
461
464
|
])) : v("", !0)
|
|
462
465
|
]);
|
|
463
466
|
}
|
|
464
|
-
const pe = /* @__PURE__ */ B(H, [["render",
|
|
467
|
+
const pe = /* @__PURE__ */ B(H, [["render", he], ["__scopeId", "data-v-d7a78d8a"]]);
|
|
465
468
|
export {
|
|
466
469
|
pe as default
|
|
467
470
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ref as r, onBeforeUnmount as M, nextTick as m } from "vue";
|
|
2
|
+
const c = 4, s = 8;
|
|
3
|
+
function $() {
|
|
4
|
+
const o = r(!1), n = r(null), i = r({});
|
|
5
|
+
let l = null;
|
|
6
|
+
const u = (e) => {
|
|
7
|
+
e.key === "Escape" && t();
|
|
8
|
+
}, h = () => {
|
|
9
|
+
window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), document.addEventListener("keydown", u);
|
|
10
|
+
}, d = () => {
|
|
11
|
+
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t), document.removeEventListener("keydown", u);
|
|
12
|
+
}, x = async () => {
|
|
13
|
+
if (!l || !n.value)
|
|
14
|
+
return;
|
|
15
|
+
const e = l.getBoundingClientRect(), a = n.value.offsetWidth, v = n.value.offsetHeight, p = window.innerHeight - e.bottom, E = p < v + c + s && e.top > p, L = getComputedStyle(l).direction === "rtl", f = E ? Math.max(s, e.top - v - c) : e.bottom + c, w = Math.min(Math.max(s, L ? e.left : e.right - a), window.innerWidth - a - s);
|
|
16
|
+
if (i.value = { top: `${f}px`, left: `${w}px`, visibility: "hidden" }, await m(), !n.value)
|
|
17
|
+
return;
|
|
18
|
+
const g = n.value.getBoundingClientRect();
|
|
19
|
+
i.value = { top: `${2 * f - g.top}px`, left: `${2 * w - g.left}px` };
|
|
20
|
+
}, y = (e) => {
|
|
21
|
+
l = e.currentTarget, i.value = { top: "0px", left: "0px", visibility: "hidden" }, o.value = !0, h(), m(x);
|
|
22
|
+
};
|
|
23
|
+
function t() {
|
|
24
|
+
o.value = !1, d();
|
|
25
|
+
}
|
|
26
|
+
const b = (e) => o.value ? t() : y(e);
|
|
27
|
+
return M(d), { open: o, menu: n, style: i, toggle: b, close: t };
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
$ as useGlFloatingMenu
|
|
31
|
+
};
|