@dcodegroup-au/dsg-vue 0.1.4 → 0.1.6

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,8 +1,8 @@
1
- import { defineComponent as W, mergeModels as G, useModel as Y, computed as V, withDirectives as oe, createElementBlock as s, openBlock as a, createCommentVNode as P, createElementVNode as k, normalizeClass as E, createVNode as R, Fragment as H, renderList as q, vShow as Se, ref as w, useTemplateRef as ge, useAttrs as Fe, unref as U, withCtx as Z, renderSlot as B, toDisplayString as x, createBlock as N, resolveDynamicComponent as Be, normalizeStyle as J, watch as ee, onMounted as Me, Transition as Le, createTextVNode as Ee, useSlots as Re, createSlots as He, normalizeProps as Ie, mergeProps as ze, vModelSelect as Ae } from "vue";
2
- import { _ as O, k as Ve, v as Oe, f as Ue, u as qe, c as be, e as ce, i as ve, j as Ne } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-Dj3jH6bn.js";
3
- import { ucfirst as We, ucwords as je, toSnakeCase as Ke } from "./dsg-vue.helpers-string.esm.js";
4
- import { data_get as ne } from "./dsg-vue.helpers-object.esm.js";
5
- const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disabled"], Je = ["onClick", "innerHTML"], Xe = ["onClick", "innerHTML"], Ze = ["disabled"], xe = ["disabled"], fe = /* @__PURE__ */ W({
1
+ import { defineComponent as W, mergeModels as G, useModel as Y, computed as V, withDirectives as re, createElementBlock as o, openBlock as l, createCommentVNode as P, createElementVNode as k, normalizeClass as E, createVNode as R, Fragment as H, renderList as q, vShow as Be, ref as w, useTemplateRef as be, useAttrs as Me, unref as U, withCtx as Z, renderSlot as B, toDisplayString as x, createBlock as N, resolveDynamicComponent as Le, normalizeStyle as J, watch as ee, onMounted as Ee, Transition as Re, createTextVNode as He, useSlots as Ae, createSlots as Ie, normalizeProps as ze, mergeProps as Ve, vModelSelect as Oe } from "vue";
2
+ import { _ as O, k as Ue, v as qe, f as Ne, u as We, c as fe, e as ve, i as pe, j as je } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-Dj3jH6bn.js";
3
+ import { ucfirst as Ke, ucwords as Qe, toSnakeCase as Ye } from "./dsg-vue.helpers-string.esm.js";
4
+ import { data_get as ie } from "./dsg-vue.helpers-object.esm.js";
5
+ const Ge = { class: "dsg-table--pagination" }, Je = ["disabled"], Xe = ["disabled"], Ze = ["onClick", "innerHTML"], xe = ["onClick", "innerHTML"], _e = ["disabled"], et = ["disabled"], he = /* @__PURE__ */ W({
6
6
  __name: "DsgTablePagination",
7
7
  props: /* @__PURE__ */ G({
8
8
  onEachSide: { default: 3 },
@@ -17,79 +17,79 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
17
17
  paginationModifiers: {}
18
18
  }),
19
19
  emits: /* @__PURE__ */ G(["dsg-table:change-page"], ["update:pagination"]),
20
- setup(t, { expose: D, emit: g }) {
21
- const d = Y(t, "pagination"), p = V(() => d.value === null ? 0 : d.value?.last_page - t.firstPage + 1), b = V(() => d.value === null ? 0 : d.value?.last_page), m = V(() => d.value === null ? !1 : d.value?.current_page === t.firstPage), y = V(() => d.value === null ? !1 : d.value?.current_page === b.value), A = V(() => p.value < t.onEachSide * 2 + 4), I = V(() => t.onEachSide * 2 + 1), h = V(() => !d.value || d.value?.current_page <= t.onEachSide ? 1 : d.value?.current_page >= p.value - t.onEachSide ? p.value - t.onEachSide * 2 : d.value?.current_page - t.onEachSide), v = g, n = (c) => {
22
- v("dsg-table:change-page", c);
23
- }, r = (c) => c === d.value?.current_page;
24
- return D({
25
- loadPage: n
26
- }), (c, F) => oe((a(), s("div", Qe, [
27
- c.showFirstLast ? (a(), s("a", {
20
+ setup(t, { expose: $, emit: b }) {
21
+ const d = Y(t, "pagination"), p = V(() => d.value === null ? 0 : d.value?.last_page - t.firstPage + 1), c = V(() => d.value === null ? 0 : d.value?.last_page), m = V(() => d.value === null ? !1 : d.value?.current_page === t.firstPage), y = V(() => d.value === null ? !1 : d.value?.current_page === c.value), z = V(() => p.value < t.onEachSide * 2 + 4), A = V(() => t.onEachSide * 2 + 1), h = V(() => !d.value || d.value?.current_page <= t.onEachSide ? 1 : d.value?.current_page >= p.value - t.onEachSide ? p.value - t.onEachSide * 2 : d.value?.current_page - t.onEachSide), f = b, s = (v) => {
22
+ f("dsg-table:change-page", v);
23
+ }, r = (v) => v === d.value?.current_page;
24
+ return $({
25
+ loadPage: s
26
+ }), (v, F) => re((l(), o("div", Ge, [
27
+ v.showFirstLast ? (l(), o("a", {
28
28
  key: 0,
29
- onClick: F[0] || (F[0] = (C) => n(c.firstPage)),
29
+ onClick: F[0] || (F[0] = (C) => s(v.firstPage)),
30
30
  class: E([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
31
31
  disabled: m.value,
32
32
  title: "First",
33
33
  "aria-label": "First"
34
34
  }, [
35
35
  R(O, {
36
- icon: c.firstIcon,
36
+ icon: v.firstIcon,
37
37
  size: "sm"
38
38
  }, null, 8, ["icon"])
39
- ], 10, Ye)) : P("", !0),
39
+ ], 10, Je)) : P("", !0),
40
40
  k("a", {
41
- onClick: F[1] || (F[1] = (C) => n("prev")),
41
+ onClick: F[1] || (F[1] = (C) => s("prev")),
42
42
  class: E([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
43
43
  disabled: m.value,
44
44
  title: "Previous",
45
45
  "aria-label": "Previous"
46
46
  }, [
47
47
  R(O, {
48
- icon: c.prevIcon,
48
+ icon: v.prevIcon,
49
49
  size: "sm"
50
50
  }, null, 8, ["icon"])
51
- ], 10, Ge),
52
- A.value ? (a(!0), s(H, { key: 1 }, q(p.value, (C, T) => (a(), s("a", {
51
+ ], 10, Xe),
52
+ z.value ? (l(!0), o(H, { key: 1 }, q(p.value, (C, T) => (l(), o("a", {
53
53
  key: T,
54
- onClick: (j) => n(T + c.firstPage),
55
- class: E([[r(T + c.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
54
+ onClick: (j) => s(T + v.firstPage),
55
+ class: E([[r(T + v.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
56
56
  innerHTML: C
57
- }, null, 10, Je))), 128)) : (a(!0), s(H, { key: 2 }, q(I.value, (C, T) => (a(), s("a", {
57
+ }, null, 10, Ze))), 128)) : (l(!0), o(H, { key: 2 }, q(A.value, (C, T) => (l(), o("a", {
58
58
  key: T,
59
- onClick: (j) => n(h.value + T + c.firstPage - 1),
60
- class: E([[r(h.value + T + c.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
59
+ onClick: (j) => s(h.value + T + v.firstPage - 1),
60
+ class: E([[r(h.value + T + v.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
61
61
  innerHTML: h.value + C - 1
62
- }, null, 10, Xe))), 128)),
62
+ }, null, 10, xe))), 128)),
63
63
  k("a", {
64
- onClick: F[2] || (F[2] = (C) => n("next")),
64
+ onClick: F[2] || (F[2] = (C) => s("next")),
65
65
  class: E([[y.value ? "disabled" : ""], "dsg-table--pagination-link"]),
66
66
  disabled: y.value,
67
67
  title: "Next",
68
68
  "aria-label": "Next"
69
69
  }, [
70
70
  R(O, {
71
- icon: c.nextIcon,
71
+ icon: v.nextIcon,
72
72
  size: "sm"
73
73
  }, null, 8, ["icon"])
74
- ], 10, Ze),
75
- c.showFirstLast ? (a(), s("a", {
74
+ ], 10, _e),
75
+ v.showFirstLast ? (l(), o("a", {
76
76
  key: 3,
77
- onClick: F[3] || (F[3] = (C) => n(b.value)),
77
+ onClick: F[3] || (F[3] = (C) => s(c.value)),
78
78
  class: E([[y.value ? "disabled" : ""], "dsg-table--pagination-link"]),
79
79
  disabled: y.value,
80
80
  title: "Last",
81
81
  "aria-label": "Last"
82
82
  }, [
83
83
  R(O, {
84
- icon: c.lastIcon,
84
+ icon: v.lastIcon,
85
85
  size: "sm"
86
86
  }, null, 8, ["icon"])
87
- ], 10, xe)) : P("", !0)
87
+ ], 10, et)) : P("", !0)
88
88
  ], 512)), [
89
- [Se, d.value && b.value > c.firstPage]
89
+ [Be, d.value && c.value > v.firstPage]
90
90
  ]);
91
91
  }
92
- }), _e = ["innerHTML"], pe = /* @__PURE__ */ W({
92
+ }), tt = ["innerHTML"], me = /* @__PURE__ */ W({
93
93
  __name: "DsgTablePaginationInfo",
94
94
  props: /* @__PURE__ */ G({
95
95
  infoTemplate: { default: "Displaying {from} to {to} of {total} items" },
@@ -100,29 +100,29 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
100
100
  }),
101
101
  emits: ["update:pagination"],
102
102
  setup(t) {
103
- const D = Y(t, "pagination"), g = V(() => D.value == null || D.value.total == 0 ? t.noDataTemplate : t.infoTemplate.replace("{from}", (D.value?.from || 0).toString()).replace("{to}", (D.value?.to || 0).toString()).replace("{total}", (D.value?.total || 0).toString()));
104
- return (d, p) => (a(), s("div", {
103
+ const $ = Y(t, "pagination"), b = V(() => $.value == null || $.value.total == 0 ? t.noDataTemplate : t.infoTemplate.replace("{from}", ($.value?.from || 0).toString()).replace("{to}", ($.value?.to || 0).toString()).replace("{total}", ($.value?.total || 0).toString()));
104
+ return (d, p) => (l(), o("div", {
105
105
  class: "dsg-table--pagination-info",
106
- innerHTML: g.value
107
- }, null, 8, _e));
106
+ innerHTML: b.value
107
+ }, null, 8, tt));
108
108
  }
109
- }), et = {
109
+ }), at = {
110
110
  class: "dsg-table--actions",
111
111
  ref: "dsgTableActions"
112
- }, tt = { class: "dsg-table--action-trigger" }, at = {
112
+ }, lt = { class: "dsg-table--action-trigger" }, st = {
113
113
  key: 0,
114
114
  class: "dsg-table--actions-menu-wrapper"
115
- }, lt = ["href", "target", "onClick"], st = ["textContent"], nt = { key: 0 }, ot = { key: 1 }, it = ["href", "target", "onClick"], rt = { class: "flex-1" }, he = /* @__PURE__ */ W({
115
+ }, nt = ["href", "target", "onClick"], ot = ["textContent"], it = { key: 0 }, rt = { key: 1 }, dt = ["href", "target", "onClick"], ut = { class: "flex-1" }, ye = /* @__PURE__ */ W({
116
116
  __name: "DsgTableActions",
117
117
  props: {
118
118
  placement: { default: "auto" }
119
119
  },
120
120
  emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked"],
121
- setup(t, { emit: D }) {
122
- const g = w(!1);
123
- ge("dsgTableActions");
124
- const d = Fe(), p = w(d.data.rowData?.actions ?? null), b = w(d.data.rowData?.links ?? null), m = w(d.data.rowData ?? null), y = (v) => {
125
- switch (v) {
121
+ setup(t, { emit: $ }) {
122
+ const b = w(!1);
123
+ be("dsgTableActions");
124
+ const d = Me(), p = w(d.data.rowData?.actions ?? null), c = w(d.data.rowData?.links ?? null), m = w(d.data.rowData ?? null), y = (f) => {
125
+ switch (f) {
126
126
  case "edit":
127
127
  return "edit-05";
128
128
  case "view":
@@ -134,8 +134,8 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
134
134
  default:
135
135
  return "dots-horizontal";
136
136
  }
137
- }, A = (v, n, r) => {
138
- switch (n) {
137
+ }, z = (f, s, r) => {
138
+ switch (s) {
139
139
  case "edit":
140
140
  h("dsg-table:action-edit", r, m.value);
141
141
  break;
@@ -149,79 +149,79 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
149
149
  h("dsg-table:action-archive", r, m.value);
150
150
  break;
151
151
  }
152
- }, I = (v, n) => {
153
- const r = v.actionId || v.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
154
- h("dsg-table:link-clicked", n, r, m.value);
155
- }, h = D;
156
- return (v, n) => oe((a(), s("div", et, [
157
- R(U(Ve), {
152
+ }, A = (f, s) => {
153
+ const r = f.actionId || f.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
154
+ h("dsg-table:link-clicked", s, r, m.value);
155
+ }, h = $;
156
+ return (f, s) => re((l(), o("div", at, [
157
+ R(U(Ue), {
158
158
  triggers: [],
159
- placement: v.placement,
159
+ placement: f.placement,
160
160
  "handle-resize": !0,
161
161
  strategy: "absolute",
162
- shown: g.value,
162
+ shown: b.value,
163
163
  class: "dsg-table--actions__popper",
164
- onHide: n[1] || (n[1] = (r) => g.value = !1),
164
+ onHide: s[1] || (s[1] = (r) => b.value = !1),
165
165
  ref: "floatingVueFilterDropdown"
166
166
  }, {
167
167
  popper: Z(() => [
168
- g.value ? (a(), s("div", at, [
169
- (a(!0), s(H, null, q(p.value, (r, c) => (a(), s(H, null, [
170
- ["edit", "view", "delete", "archive"].includes(String(c)) ? (a(), s("a", {
171
- key: c,
168
+ b.value ? (l(), o("div", st, [
169
+ (l(!0), o(H, null, q(p.value, (r, v) => (l(), o(H, null, [
170
+ ["edit", "view", "delete", "archive"].includes(String(v)) ? (l(), o("a", {
171
+ key: v,
172
172
  href: p.value?.link,
173
173
  target: p.value?.target || "_self",
174
- onClick: (F) => A(r, String(c), F)
174
+ onClick: (F) => z(r, String(v), F)
175
175
  }, [
176
176
  k("div", {
177
- class: E(["dsg-table--actions-menu-item", String(c)])
177
+ class: E(["dsg-table--actions-menu-item", String(v)])
178
178
  }, [
179
179
  R(O, {
180
- icon: y(String(c)),
180
+ icon: y(String(v)),
181
181
  size: "sm"
182
182
  }, null, 8, ["icon"]),
183
183
  k("span", {
184
184
  class: "flex-1",
185
- textContent: x(U(We)(String(c)))
186
- }, null, 8, st)
185
+ textContent: x(U(Ke)(String(v)))
186
+ }, null, 8, ot)
187
187
  ], 2)
188
- ], 8, lt)) : P("", !0)
188
+ ], 8, nt)) : P("", !0)
189
189
  ], 64))), 256)),
190
- p.value && b.value ? (a(), s("hr", nt)) : P("", !0),
191
- b.value ? (a(!0), s(H, { key: 1 }, q(b.value, (r) => (a(), s(H, {
190
+ p.value && c.value ? (l(), o("hr", it)) : P("", !0),
191
+ c.value ? (l(!0), o(H, { key: 1 }, q(c.value, (r) => (l(), o(H, {
192
192
  key: r.label
193
193
  }, [
194
- r.hasOwnProperty("component") ? (a(), N(Be(r.component), {
194
+ r.hasOwnProperty("component") ? (l(), N(Le(r.component), {
195
195
  key: 0,
196
196
  quote: U(d).data.data.rowData,
197
197
  "row-data": U(d).data.data.rowData
198
- }, null, 8, ["quote", "row-data"])) : r.hasOwnProperty("type") && r.type == "break" ? (a(), s("hr", ot)) : (a(), s("a", {
198
+ }, null, 8, ["quote", "row-data"])) : r.hasOwnProperty("type") && r.type == "break" ? (l(), o("hr", rt)) : (l(), o("a", {
199
199
  key: 2,
200
200
  href: r.link,
201
201
  target: r.target || "_self",
202
202
  class: E(["dsg-table--actions-menu-item", r.class]),
203
- onClick: (c) => I(r, c)
203
+ onClick: (v) => A(r, v)
204
204
  }, [
205
- r.icon ? (a(), N(O, {
205
+ r.icon ? (l(), N(O, {
206
206
  key: 0,
207
207
  icon: r.icon,
208
208
  size: "sm"
209
209
  }, null, 8, ["icon"])) : P("", !0),
210
- k("span", rt, x(r.label), 1)
211
- ], 10, it))
210
+ k("span", ut, x(r.label), 1)
211
+ ], 10, dt))
212
212
  ], 64))), 128)) : P("", !0)
213
213
  ])) : P("", !0)
214
214
  ]),
215
215
  default: Z(() => [
216
- k("div", tt, [
216
+ k("div", lt, [
217
217
  k("button", {
218
218
  type: "button",
219
219
  class: "dsg-table--actions-button",
220
220
  "aria-expanded": "false",
221
221
  "aria-haspopup": "true",
222
- onClick: n[0] || (n[0] = (r) => g.value = !g.value)
222
+ onClick: s[0] || (s[0] = (r) => b.value = !b.value)
223
223
  }, [
224
- B(v.$slots, "dsg-table-action-button-content", {}, () => [
224
+ B(f.$slots, "dsg-table-action-button-content", {}, () => [
225
225
  R(O, {
226
226
  icon: "dots-vertical",
227
227
  size: "sm"
@@ -233,10 +233,10 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
233
233
  _: 3
234
234
  }, 8, ["placement", "shown"])
235
235
  ])), [
236
- [U(Oe), () => g.value = !1]
236
+ [U(qe), () => b.value = !1]
237
237
  ]);
238
238
  }
239
- }), dt = { class: "dsg-table--search" }, me = /* @__PURE__ */ W({
239
+ }), ct = { class: "dsg-table--search" }, ke = /* @__PURE__ */ W({
240
240
  __name: "DsgTableSearch",
241
241
  props: {
242
242
  name: {},
@@ -250,21 +250,21 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
250
250
  eventName: {}
251
251
  },
252
252
  emits: ["dsg-table:term-changed"],
253
- setup(t, { emit: D }) {
254
- const g = w(""), d = D, p = qe((b) => {
255
- g.value = b, d("dsg-table:term-changed", g.value);
253
+ setup(t, { emit: $ }) {
254
+ const b = w(""), d = $, p = We((c) => {
255
+ b.value = c, d("dsg-table:term-changed", b.value);
256
256
  }, 300);
257
- return (b, m) => (a(), s("div", dt, [
258
- R(Ue, {
259
- value: g.value,
260
- "onUpdate:value": m[0] || (m[0] = (y) => g.value = y),
261
- name: b.name,
262
- id: b.id || b.name,
263
- placeholder: b.placeholder,
264
- disabled: b.disabled,
265
- required: b.required,
266
- readonly: b.readonly,
267
- hidden: b.hidden,
257
+ return (c, m) => (l(), o("div", ct, [
258
+ R(Ne, {
259
+ value: b.value,
260
+ "onUpdate:value": m[0] || (m[0] = (y) => b.value = y),
261
+ name: c.name,
262
+ id: c.id || c.name,
263
+ placeholder: c.placeholder,
264
+ disabled: c.disabled,
265
+ required: c.required,
266
+ readonly: c.readonly,
267
+ hidden: c.hidden,
268
268
  "has-clear-button": !0,
269
269
  autocomplete: "off",
270
270
  size: "sm",
@@ -276,18 +276,18 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
276
276
  }, null, 8, ["value", "name", "id", "placeholder", "disabled", "required", "readonly", "hidden"])
277
277
  ]));
278
278
  }
279
- }), ut = { class: "dsg-table--header-row" }, ct = {
279
+ }), gt = { class: "dsg-table--header-row" }, vt = {
280
280
  key: 0,
281
281
  class: "dsg-table--th dsg-table--th-checkbox",
282
282
  scope: "col"
283
- }, gt = {
283
+ }, bt = {
284
284
  key: 1,
285
285
  class: "dsg-table--th dsg-table--th-expand-detail",
286
286
  scope: "col"
287
- }, bt = ["title", "id", "onClick"], vt = {
287
+ }, ft = ["title", "id", "onClick"], pt = {
288
288
  key: 0,
289
289
  class: "dsg-table--th-sort-icon"
290
- }, ft = ["innerHTML"], pt = ["innerHTML"], ye = /* @__PURE__ */ W({
290
+ }, ht = ["innerHTML"], mt = ["innerHTML"], we = /* @__PURE__ */ W({
291
291
  __name: "DsgTableRowHeader",
292
292
  props: /* @__PURE__ */ G({
293
293
  fields: {},
@@ -304,89 +304,89 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
304
304
  hasSelectedModifiers: {}
305
305
  }),
306
306
  emits: /* @__PURE__ */ G(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
307
- setup(t, { emit: D }) {
308
- const g = Y(t, "sortField"), d = Y(t, "selectedRows"), p = Y(t, "hasSelected"), b = w("17px"), m = (h) => {
307
+ setup(t, { emit: $ }) {
308
+ const b = Y(t, "sortField"), d = Y(t, "selectedRows"), p = Y(t, "hasSelected"), c = w("17px"), m = (h) => {
309
309
  p.value && d.value.length > 0 && d.value.length !== t.tableDataLength ? (p.value = !0, y("dsg-table:on-select-all")) : !p.value && d.value.length === 0 ? (p.value = !1, y("dsg-table:on-select-all")) : y("dsg-table:on-deselect-all");
310
- }, y = D, A = (h, v) => [
310
+ }, y = $, z = (h, f) => [
311
311
  h,
312
- h + "-" + Ke(String(v?.name)),
313
- v.titleClass || "",
314
- { sortable: v.sortable },
315
- { "sort-active": g.value?.name === v.name }
316
- ], I = (h) => {
317
- h.sortable && (g.value = {
312
+ h + "-" + Ye(String(f?.name)),
313
+ f.titleClass || "",
314
+ { sortable: f.sortable },
315
+ { "sort-active": b.value?.name === f.name }
316
+ ], A = (h) => {
317
+ h.sortable && (b.value = {
318
318
  name: String(h?.name),
319
319
  field: String(h?.sortField),
320
- direction: g.value?.name === h.name && g.value?.direction === "asc" ? "desc" : "asc"
320
+ direction: b.value?.name === h.name && b.value?.direction === "asc" ? "desc" : "asc"
321
321
  }, y("dsg-table:sort-field", h));
322
322
  };
323
- return (h, v) => (a(), s("tr", ut, [
324
- h.hasSelectAll ? (a(), s("th", ct, [
325
- R(be, {
323
+ return (h, f) => (l(), o("tr", gt, [
324
+ h.hasSelectAll ? (l(), o("th", vt, [
325
+ R(fe, {
326
326
  modelValue: p.value,
327
327
  "onUpdate:modelValue": [
328
- v[0] || (v[0] = (n) => p.value = n),
328
+ f[0] || (f[0] = (s) => p.value = s),
329
329
  m
330
330
  ],
331
331
  indeterminate: d.value.length > 0 && d.value.length !== h.tableDataLength
332
332
  }, null, 8, ["modelValue", "indeterminate"])
333
333
  ])) : P("", !0),
334
- h.showExpandDetail ? (a(), s("th", gt)) : P("", !0),
335
- (a(!0), s(H, null, q(h.fields, (n, r) => (a(), s(H, null, [
336
- n?.visible ? (a(), s("th", {
334
+ h.showExpandDetail ? (l(), o("th", bt)) : P("", !0),
335
+ (l(!0), o(H, null, q(h.fields, (s, r) => (l(), o(H, null, [
336
+ s?.visible ? (l(), o("th", {
337
337
  key: r,
338
- class: E(A("dsg-table--th", n)),
339
- style: J([{ width: n.width || void 0 }, n.style]),
340
- title: n.title + (n.sortable ? " Sort" : ""),
341
- id: "_" + n.name,
342
- onClick: (c) => I(n),
338
+ class: E(z("dsg-table--th", s)),
339
+ style: J([{ width: s.width || void 0 }, s.style]),
340
+ title: s.title + (s.sortable ? " Sort" : ""),
341
+ id: "_" + s.name,
342
+ onClick: (v) => A(s),
343
343
  scope: "col"
344
344
  }, [
345
- n.sortable ? (a(), s("div", vt, [
346
- n.title ? (a(), s("span", {
345
+ s.sortable ? (l(), o("div", pt, [
346
+ s.title ? (l(), o("span", {
347
347
  key: 0,
348
348
  class: "dsg-table--th-title",
349
- innerHTML: n.title
350
- }, null, 8, ft)) : P("", !0),
351
- n.sortable && g.value?.name !== n.name ? (a(), N(O, {
349
+ innerHTML: s.title
350
+ }, null, 8, ht)) : P("", !0),
351
+ s.sortable && b.value?.name !== s.name ? (l(), N(O, {
352
352
  key: 1,
353
353
  icon: "chevron-selector-vertical",
354
354
  class: "inline-flex",
355
355
  size: "xs"
356
356
  })) : P("", !0),
357
- n.sortable && g.value?.name === n.name && g.value?.direction === "asc" ? (a(), N(O, {
357
+ s.sortable && b.value?.name === s.name && b.value?.direction === "asc" ? (l(), N(O, {
358
358
  key: 2,
359
359
  icon: "chevron-down",
360
360
  class: "inline-flex",
361
361
  size: "xs"
362
362
  })) : P("", !0),
363
- n.sortable && g.value?.name === n.name && g.value?.direction === "desc" ? (a(), N(O, {
363
+ s.sortable && b.value?.name === s.name && b.value?.direction === "desc" ? (l(), N(O, {
364
364
  key: 3,
365
365
  icon: "chevron-up",
366
366
  class: "inline-flex",
367
367
  size: "xs"
368
368
  })) : P("", !0)
369
- ])) : (a(), s("span", {
369
+ ])) : (l(), o("span", {
370
370
  key: 1,
371
371
  class: "dsg-table--th-title",
372
- innerHTML: U(je)(String(n?.title))
373
- }, null, 8, pt))
374
- ], 14, bt)) : P("", !0)
372
+ innerHTML: U(Qe)(String(s?.title))
373
+ }, null, 8, mt))
374
+ ], 14, ft)) : P("", !0)
375
375
  ], 64))), 256)),
376
- h.scrollVisible ? (a(), s("th", {
376
+ h.scrollVisible ? (l(), o("th", {
377
377
  key: 2,
378
- style: J({ width: b.value }),
378
+ style: J({ width: c.value }),
379
379
  class: "dsg-table--th-col-gutter"
380
380
  }, null, 4)) : P("", !0)
381
381
  ]));
382
382
  }
383
- }), ht = { class: "dsg-table--wrapper" }, mt = ["span"], yt = {
383
+ }), yt = { class: "dsg-table--wrapper" }, kt = ["span"], wt = {
384
384
  key: 0,
385
385
  class: "dsg-table--loading"
386
- }, kt = ["colspan"], wt = ["colspan"], Pt = ["onClick", "onDblclick", "onMouseover"], $t = {
386
+ }, Pt = ["colspan"], Dt = ["colspan"], $t = ["onClick", "onDblclick", "onMouseover"], Ct = {
387
387
  key: 0,
388
388
  class: "dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"
389
- }, Dt = ["onClick", "onDblclick", "onContextmenu"], Ct = ["innerHTML"], Tt = ["onClick"], St = ["colspan"], Ft = { key: 2 }, Bt = ["colspan"], Mt = { class: "dsg-table--footer" }, Lt = /* @__PURE__ */ W({
389
+ }, Tt = ["onClick", "onDblclick", "onContextmenu"], St = ["innerHTML"], Ft = ["onClick"], Bt = ["colspan"], Mt = { key: 2 }, Lt = ["colspan"], Et = { class: "dsg-table--footer" }, Rt = /* @__PURE__ */ W({
390
390
  __name: "DsgTableComponent",
391
391
  props: /* @__PURE__ */ G({
392
392
  fields: { default: () => [] },
@@ -445,20 +445,20 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
445
445
  perPageModifiers: {}
446
446
  }),
447
447
  emits: /* @__PURE__ */ G(["dsg-table:loading", "dsg-table:loaded", "dsg-table:load-success", "dsg-table:load-error", "dsg-table:pagination-data", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick"], ["update:filterParams", "update:perPage"]),
448
- setup(t, { expose: D, emit: g }) {
449
- const d = (e) => e.map((o, u) => ({
450
- field: o.field || "",
451
- title: o.title || "",
452
- name: o.name || "",
453
- titleClass: o.titleClass || "",
454
- dataClass: o.dataClass || "",
455
- visible: o.visible !== !1,
456
- width: o.width || void 0,
457
- sortField: o.sortField || null,
458
- sortable: o.sortField,
459
- formatter: o.formatter || null,
448
+ setup(t, { expose: $, emit: b }) {
449
+ const d = (e) => e.map((n, u) => ({
450
+ field: n.field || "",
451
+ title: n.title || "",
452
+ name: n.name || "",
453
+ titleClass: n.titleClass || "",
454
+ dataClass: n.dataClass || "",
455
+ visible: n.visible !== !1,
456
+ width: n.width || void 0,
457
+ sortField: n.sortField || null,
458
+ sortable: n.sortField,
459
+ formatter: n.formatter || null,
460
460
  $_index: u
461
- })), p = w(d(t.fields)), b = w(t.data), m = w(null), y = w(t.initialPage), A = w("17px"), I = w(!1), h = w({}), v = w(0), n = w(!0), r = w(null), c = w(null), F = Y(t, "filterParams"), C = Y(t, "perPage"), T = w([]), j = w(!1), K = V(() => t.tableHeight != null), Q = V(() => p.value.filter((e) => e.visible).length);
461
+ })), p = w(d(t.fields)), c = w(t.data), m = w(null), y = w(t.initialPage), z = w("17px"), A = w(!1), h = w({}), f = w(0), s = w(!0), r = w(null), v = w(null), F = Y(t, "filterParams"), C = Y(t, "perPage"), T = w([]), j = w(!1), K = V(() => t.tableHeight != null), Q = V(() => p.value.filter((e) => e.visible).length);
462
462
  ee(
463
463
  () => T.value.length,
464
464
  (e) => {
@@ -483,80 +483,86 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
483
483
  X();
484
484
  }
485
485
  );
486
- const z = g, te = (e, o) => e.formatter && typeof e.formatter == "function" ? e.formatter(e, o) : ne(o, String(e?.name), ""), _ = (e) => "dsg-field--" + e.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), ae = (e) => {
486
+ const I = b, te = (e, n) => e.formatter && typeof e.formatter == "function" ? e.formatter(e, n) : ie(n, String(e?.name), ""), ae = (e) => "dsg-field--" + e.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), le = (e) => {
487
487
  if (t.selectable) {
488
488
  if (e.selected)
489
489
  T.value.push(e);
490
490
  else {
491
- const o = T.value.findIndex((u) => u[t.trackBy] === e[t.trackBy]);
492
- o !== -1 && T.value.splice(o, 1);
491
+ const n = T.value.findIndex((u) => u[t.trackBy] === e[t.trackBy]);
492
+ n !== -1 && T.value.splice(n, 1);
493
493
  }
494
- z("dsg-table:rows-selected", T.value);
494
+ I("dsg-table:rows-selected", T.value);
495
495
  }
496
- }, l = () => {
497
- t.selectable && (b.value?.forEach((e) => {
496
+ }, _ = () => {
497
+ t.selectable && (c.value?.forEach((e) => {
498
498
  e.selected = !0;
499
- }), T.value = b.value?.filter((e) => e.selected) ?? [], z("dsg-table:rows-selected", T.value));
500
- }, i = () => {
501
- t.selectable && (b.value?.forEach((e) => {
499
+ }), T.value = c.value?.filter((e) => e.selected) ?? [], I("dsg-table:rows-selected", T.value));
500
+ }, se = () => {
501
+ t.selectable && (c.value?.forEach((e) => {
502
502
  e.selected = !1;
503
- }), T.value = [], z("dsg-table:rows-selected", T.value));
504
- }, f = (e) => {
503
+ }), T.value = [], I("dsg-table:rows-selected", T.value));
504
+ }, a = (e) => {
505
+ c.value = Array.isArray(e) ? e : [], t.selectable && c.value.forEach((n) => {
506
+ n.selected = n.selected ?? !1;
507
+ });
508
+ }, i = () => c.value ?? [], g = (e) => {
505
509
  e === "prev" ? y.value > t.firstPage && y.value-- : e === "next" ? y.value < (m.value?.last_page ?? 0) && y.value++ : e != y.value && e >= t.firstPage && e <= (m.value?.last_page ?? 0) && (y.value = e), X();
506
- }, $ = () => ({
510
+ }, D = () => ({
507
511
  [t.queryParams?.sort]: r.value ? (r.value?.direction === "desc" ? "-" : "") + r.value?.field : void 0,
508
512
  [t.queryParams?.order]: r.value?.direction,
509
513
  [t.queryParams?.page]: y.value,
510
514
  [t.queryParams?.perPage]: C.value
511
515
  }), S = () => {
512
- c.value && (c.value.abort(), c.value = null);
513
- }, le = async (e, o) => {
516
+ v.value && (v.value.abort(), v.value = null);
517
+ }, ne = async (e, n) => {
514
518
  S();
515
519
  const u = new AbortController();
516
- if (o.signal = u.signal, c.value = u, t.httpMethod.toLowerCase() === "get")
517
- return await ce.get(e, o);
520
+ if (n.signal = u.signal, v.value = u, t.httpMethod.toLowerCase() === "get")
521
+ return await ve.get(e, n);
518
522
  {
519
- const L = o.params;
520
- return delete o.params, await ce.post(e, L, o);
523
+ const L = n.params;
524
+ return delete n.params, await ve.post(e, L, n);
521
525
  }
522
- }, ie = (e) => {
523
- z("dsg-table:load-success", e);
524
- const o = t.transform ? t.transform(e.data) : e.data;
525
- b.value = ne(o, t.dataPath, null), t.selectable && b.value?.forEach((u) => {
526
+ }, de = (e) => {
527
+ I("dsg-table:load-success", e);
528
+ const n = t.transform ? t.transform(e.data) : e.data;
529
+ c.value = ie(n, t.dataPath, null), t.selectable && c.value?.forEach((u) => {
526
530
  u.selected = u.selected ?? !1;
527
- }), m.value = ne(o, t.paginationPath, null) ?? null, v.value = b.value?.length ? b.value[0].order : v, m.value === null && console.warn(
531
+ }), m.value = ie(n, t.paginationPath, null) ?? null, f.value = c.value?.length ? c.value[0].order : f, m.value === null && console.warn(
528
532
  'DsgTable: pagination-path "' + t.paginationPath + `" not found. It looks like the data returned from the server does not have pagination information or you may have set it incorrectly.
529
533
  You can explicitly suppress this warning by setting pagination-path="".`
530
- ), z("dsg-table:pagination-data", m.value), y.value > (m.value?.to || 0) && (y.value = t.initialPage), z("dsg-table:loaded"), n.value = !1;
531
- }, re = (e) => {
532
- console.error("load-error", e), z("dsg-table:load-error", e), z("dsg-table:loaded"), n.value = !1;
533
- }, X = (e = ie, o = re, u = {}) => {
534
- const L = e || ie, M = o || re;
534
+ ), I("dsg-table:pagination-data", m.value), y.value > (m.value?.to || 0) && (y.value = t.initialPage), I("dsg-table:loaded"), s.value = !1;
535
+ }, ue = (e) => {
536
+ console.error("load-error", e), I("dsg-table:load-error", e), I("dsg-table:loaded"), s.value = !1;
537
+ }, X = (e = de, n = ue, u = {}) => {
538
+ const L = e || de, M = n || ue;
535
539
  if (t.apiMode)
536
- return n.value = !0, z("dsg-table:loading", n.value), t.httpOptions.params = {
537
- ...$(),
540
+ return s.value = !0, I("dsg-table:loading", s.value), t.httpOptions.params = {
541
+ ...D(),
538
542
  ...F.value
539
- }, le(t.apiUrl, t.httpOptions).then(L).catch((se) => M(se));
540
- }, ke = (e, o, u) => {
541
- z("dsg-table:row-clicked", e, o, u);
542
- }, we = (e, o, u) => {
543
- z("dsg-table:row-dblclick", e, o, u);
544
- }, Pe = (e, o, u) => {
545
- }, $e = (e, o, u, L) => {
546
- }, De = (e, o, u, L) => {
547
- }, Ce = (e, o, u, L) => {
548
- }, Te = (e, o, u) => {
543
+ }, ne(t.apiUrl, t.httpOptions).then(L).catch((oe) => M(oe));
544
+ }, Pe = (e, n, u) => {
545
+ I("dsg-table:row-clicked", e, n, u);
546
+ }, De = (e, n, u) => {
547
+ I("dsg-table:row-dblclick", e, n, u);
548
+ }, $e = (e, n, u) => {
549
+ }, Ce = (e, n, u, L) => {
550
+ }, Te = (e, n, u, L) => {
551
+ }, Se = (e, n, u, L) => {
552
+ }, Fe = (e, n, u) => {
549
553
  };
550
- Me(() => {
554
+ Ee(() => {
551
555
  t.apiMode === !0 && X();
552
556
  });
553
- const de = () => {
557
+ const ce = () => {
554
558
  t.apiMode && (T.value = [], S(), X());
555
559
  };
556
- return D({
557
- changePage: f,
558
- reload: de
559
- }), (e, o) => (a(), s("div", ht, [
560
+ return $({
561
+ changePage: g,
562
+ reload: ce,
563
+ getData: i,
564
+ setData: a
565
+ }), (e, n) => (l(), o("div", yt, [
560
566
  k("div", {
561
567
  ref: "dsgTableBodyWrapper",
562
568
  class: E(["dsg-table-body-wrapper", { "fixed-header": K.value }]),
@@ -566,45 +572,45 @@ You can explicitly suppress this warning by setting pagination-path="".`
566
572
  class: E(["dsg-table-main", K.value ? "fixed-header" : "", h.value.table, "table-" + e.tableLayout])
567
573
  }, [
568
574
  k("colgroup", { span: Q.value }, [
569
- (a(!0), s(H, null, q(p.value, (u, L) => (a(), s(H, null, [
570
- u?.visible ? (a(), s("col", {
575
+ (l(!0), o(H, null, q(p.value, (u, L) => (l(), o(H, null, [
576
+ u?.visible ? (l(), o("col", {
571
577
  key: L,
572
578
  style: J({ width: u.width || void 0 }),
573
579
  class: E("dsg-table--col-" + u.name + " " + u.titleClass)
574
580
  }, null, 6)) : P("", !0)
575
581
  ], 64))), 256)),
576
- !K.value && I.value ? (a(), s("col", {
582
+ !K.value && A.value ? (l(), o("col", {
577
583
  key: 0,
578
- style: J({ width: A.value }),
584
+ style: J({ width: z.value }),
579
585
  class: "dsg-table--col-gutter"
580
586
  }, null, 4)) : P("", !0)
581
- ], 8, mt),
587
+ ], 8, kt),
582
588
  k("thead", {
583
589
  class: E([[h.value.thead, { sticky: K.value, "top-0": K.value }], "dsg-table--head"])
584
590
  }, [
585
591
  B(e.$slots, "tableHeader", { fields: p.value }, () => [
586
- R(ye, {
592
+ R(we, {
587
593
  fields: p.value,
588
594
  "has-select-all": e.selectable,
589
595
  "selected-rows": T.value,
590
- "onUpdate:selectedRows": o[0] || (o[0] = (u) => T.value = u),
596
+ "onUpdate:selectedRows": n[0] || (n[0] = (u) => T.value = u),
591
597
  "has-selected": j.value,
592
- "onUpdate:hasSelected": o[1] || (o[1] = (u) => j.value = u),
593
- "scroll-visible": I.value,
598
+ "onUpdate:hasSelected": n[1] || (n[1] = (u) => j.value = u),
599
+ "scroll-visible": A.value,
594
600
  "show-expand-detail": e.hasDetailRow && e.showExpandDetail,
595
- "table-data-length": b.value?.length,
601
+ "table-data-length": c.value?.length,
596
602
  "sort-field": r.value,
597
- "onUpdate:sortField": o[2] || (o[2] = (u) => r.value = u),
598
- "onDsgTable:sortField": o[3] || (o[3] = (u) => de()),
599
- "onDsgTable:onSelectAll": l,
600
- "onDsgTable:onDeselectAll": i
603
+ "onUpdate:sortField": n[2] || (n[2] = (u) => r.value = u),
604
+ "onDsgTable:sortField": n[3] || (n[3] = (u) => ce()),
605
+ "onDsgTable:onSelectAll": _,
606
+ "onDsgTable:onDeselectAll": se
601
607
  }, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
602
608
  ])
603
609
  ], 2),
604
610
  k("tbody", {
605
611
  class: E(["dsg-table--body", h.value.tbody])
606
612
  }, [
607
- n.value ? (a(), s("tr", yt, [
613
+ s.value ? (l(), o("tr", wt, [
608
614
  k("td", { colspan: Q.value }, [
609
615
  k("div", {
610
616
  "aria-label": "Loading...",
@@ -617,52 +623,52 @@ You can explicitly suppress this warning by setting pagination-path="".`
617
623
  icon: "loading-02",
618
624
  class: "animate-spin"
619
625
  }),
620
- o[4] || (o[4] = k("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
626
+ n[4] || (n[4] = k("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
621
627
  ])
622
- ], 8, wt)
623
- ], 8, kt)
624
- ])) : (a(!0), s(H, { key: 1 }, q(b.value, (u, L) => (a(), s(H, { key: L }, [
628
+ ], 8, Dt)
629
+ ], 8, Pt)
630
+ ])) : (l(!0), o(H, { key: 1 }, q(c.value, (u, L) => (l(), o(H, { key: L }, [
625
631
  k("tr", {
626
632
  class: E(["dsg-table--tbody-row", { odd: L % 2 === 0, even: L % 2 !== 0, "row-selected": u.selected }]),
627
- onClick: (M) => ke(M, L, u),
628
- onDblclick: (M) => we(M, L, u),
629
- onMouseover: (M) => Pe()
633
+ onClick: (M) => Pe(M, L, u),
634
+ onDblclick: (M) => De(M, L, u),
635
+ onMouseover: (M) => $e()
630
636
  }, [
631
- e.selectable ? (a(), s("td", $t, [
632
- R(be, {
637
+ e.selectable ? (l(), o("td", Ct, [
638
+ R(fe, {
633
639
  modelValue: u.selected,
634
- "onUpdate:modelValue": [(M) => u.selected = M, (M) => ae(u)]
640
+ "onUpdate:modelValue": [(M) => u.selected = M, (M) => le(u)]
635
641
  }, null, 8, ["modelValue", "onUpdate:modelValue"])
636
642
  ])) : P("", !0),
637
- (a(!0), s(H, null, q(p.value, (M, se) => (a(), s(H, { key: se }, [
638
- M.visible ? (a(), s("td", {
643
+ (l(!0), o(H, null, q(p.value, (M, oe) => (l(), o(H, { key: oe }, [
644
+ M.visible ? (l(), o("td", {
639
645
  key: 0,
640
646
  class: E(["dsg-table--tbody-cell", M.dataClass]),
641
647
  style: J({ width: M.width || void 0 }),
642
- onClick: (ue) => $e(),
643
- onDblclick: (ue) => De(),
644
- onContextmenu: (ue) => Ce()
648
+ onClick: (ge) => Ce(),
649
+ onDblclick: (ge) => Te(),
650
+ onContextmenu: (ge) => Se()
645
651
  }, [
646
- B(e.$slots, _(M), {
652
+ B(e.$slots, ae(M), {
647
653
  rowData: u,
648
654
  rowIndex: L,
649
655
  rowField: M
650
656
  }, () => [
651
657
  k("span", {
652
658
  innerHTML: te(M, u)
653
- }, null, 8, Ct)
659
+ }, null, 8, St)
654
660
  ])
655
- ], 46, Dt)) : P("", !0)
661
+ ], 46, Tt)) : P("", !0)
656
662
  ], 64))), 128))
657
- ], 42, Pt),
658
- e.hasDetailRow ? (a(), N(Le, {
663
+ ], 42, $t),
664
+ e.hasDetailRow ? (l(), N(Re, {
659
665
  key: 0,
660
666
  name: e.detailRowTransition
661
667
  }, {
662
668
  default: Z(() => [
663
669
  k("tr", {
664
670
  class: "dsg-table--tbody-detail-row",
665
- onClick: (M) => Te()
671
+ onClick: (M) => Fe()
666
672
  }, [
667
673
  k("td", { colspan: Q.value }, [
668
674
  B(e.$slots, "dsg-table-detail-row", {
@@ -670,45 +676,45 @@ You can explicitly suppress this warning by setting pagination-path="".`
670
676
  rowIndex: L,
671
677
  options: e.detailRowOptions
672
678
  })
673
- ], 8, St)
674
- ], 8, Tt)
679
+ ], 8, Bt)
680
+ ], 8, Ft)
675
681
  ]),
676
682
  _: 2
677
683
  }, 1032, ["name"])) : P("", !0)
678
684
  ], 64))), 128)),
679
- !n.value && !b.value?.length && e.noDataTemplate.length ? (a(), s("tr", Ft, [
685
+ !s.value && !c.value?.length && e.noDataTemplate.length ? (l(), o("tr", Mt, [
680
686
  k("td", {
681
687
  colspan: Q.value,
682
688
  class: "dsg-table--empty-result"
683
689
  }, [
684
690
  B(e.$slots, "dsg-table-empty-result", {}, () => [
685
- Ee(x(e.noDataTemplate), 1)
691
+ He(x(e.noDataTemplate), 1)
686
692
  ])
687
- ], 8, Bt)
693
+ ], 8, Lt)
688
694
  ])) : P("", !0)
689
695
  ], 2),
690
- k("tfoot", Mt, [
696
+ k("tfoot", Et, [
691
697
  B(e.$slots, "dsg-table-footer", {
692
698
  fields: p.value,
693
- data: b.value
699
+ data: c.value
694
700
  })
695
701
  ])
696
702
  ], 2)
697
703
  ], 6)
698
704
  ]));
699
705
  }
700
- }), Et = { class: "dsg-table" }, Rt = {
706
+ }), Ht = { class: "dsg-table" }, At = {
701
707
  key: 0,
702
708
  class: "dsg-table--pre-header"
703
- }, Ht = { class: "dsg-table--pre-header-left" }, It = ["textContent"], zt = { class: "dsg-table--pre-header-right" }, At = {
709
+ }, It = { class: "dsg-table--pre-header-left" }, zt = ["textContent"], Vt = { class: "dsg-table--pre-header-right" }, Ot = {
704
710
  key: 1,
705
711
  class: "dsg-table--search-header",
706
712
  ref: "dsgTableSearchHeaderEl"
707
- }, Vt = { class: "dsg-table--search-top" }, Ot = {
713
+ }, Ut = { class: "dsg-table--search-top" }, qt = {
708
714
  key: 2,
709
715
  class: "dsg-table--footer",
710
716
  ref: "dsgTableFooterEl"
711
- }, Ut = { class: "dsg-table--footer-left" }, qt = { class: "dsg-table--footer-center" }, Nt = { class: "dsg-table--footer-right" }, Wt = /* @__PURE__ */ W({
717
+ }, Nt = { class: "dsg-table--footer-left" }, Wt = { class: "dsg-table--footer-center" }, jt = { class: "dsg-table--footer-right" }, Kt = /* @__PURE__ */ W({
712
718
  __name: "DsgTable",
713
719
  props: {
714
720
  getUrl: {},
@@ -732,175 +738,182 @@ You can explicitly suppress this warning by setting pagination-path="".`
732
738
  css: { default: () => ({ tableWrapper: "border-b" }) }
733
739
  },
734
740
  emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:filter-updated", "dsg-table:term-changed", "dsg-table:data-loaded"],
735
- setup(t, { expose: D, emit: g }) {
736
- const d = (l) => {
737
- c.value = l;
738
- }, p = w(!!(t.filterEntity || t.filterEndpoint)), b = () => {
741
+ setup(t, { expose: $, emit: b }) {
742
+ const d = (a) => {
743
+ v.value = a;
744
+ }, p = w(!!(t.filterEntity || t.filterEndpoint)), c = () => {
739
745
  if (p.value) {
740
- let l = {};
741
- return Ne().forEach((i) => {
746
+ let a = {};
747
+ return je().forEach((i) => {
742
748
  if (i.key.startsWith("filter[")) {
743
- const f = i.key.replace("filter[", "").replace("]", ""), $ = i.value;
744
- l[`filter[${f}]`] = $.join(",");
749
+ const g = i.key.replace("filter[", "").replace("]", ""), D = i.value;
750
+ a[`filter[${g}]`] = D.join(",");
745
751
  }
746
- }), l;
752
+ }), a;
747
753
  } else
748
754
  return {};
749
755
  }, m = V(() => ({
750
756
  ...t.css,
751
757
  tableWrapper: "border-b " + (t.css?.tableWrapper || "")
752
- })), y = Re(), A = w(!0), I = w(null), h = w("<p>Showing {from} to {to} of {total}</p>"), v = w(null), n = ge("dsgTable"), r = w({ perPage: 20, change: d }), c = w(20), F = w({ ...b(), ...t.initialFilters }), C = g, T = (l) => {
753
- n.value?.changePage(l);
754
- }, j = (l) => {
755
- v.value = l;
756
- }, K = ({ data: l }) => {
757
- I.value = l, C("dsg-table:data-loaded", l);
758
+ })), y = Ae(), z = w(!0), A = w(null), h = w("<p>Showing {from} to {to} of {total}</p>"), f = w(null), s = be("dsgTable"), r = w({ perPage: 20, change: d }), v = w(20), F = w({ ...c(), ...t.initialFilters }), C = b, T = (a) => {
759
+ s.value?.changePage(a);
760
+ }, j = (a) => {
761
+ f.value = a;
762
+ }, K = ({ data: a }) => {
763
+ A.value = a, C("dsg-table:data-loaded", a);
758
764
  }, Q = () => {
759
- A.value === !1 && n.value?.reload();
760
- }, z = (l) => {
761
- n.value?.setData(
762
- n.value?.tableData.map((i) => i.id === l.id ? l : i)
763
- );
764
- }, te = (l) => {
765
- F.value = l;
766
- }, _ = (l) => {
767
- F.value["filter[term]"] = l, C("dsg-table:term-changed", l);
768
- }, ae = (l, i, f) => {
769
- F.value = { "filter[term]": F.value["filter[term]"], ...l }, C("dsg-table:filter-updated", F.value, i, f);
765
+ z.value === !1 && s.value?.reload();
766
+ }, I = (a) => {
767
+ const i = s.value?.getData?.() ?? [];
768
+ s.value?.setData(i.map((g) => g.id === a.id ? a : g));
769
+ }, te = (a) => {
770
+ const i = s.value?.getData?.() ?? [];
771
+ s.value?.setData([...i, a]);
772
+ }, ae = (a) => {
773
+ const i = s.value?.getData?.() ?? [];
774
+ s.value?.setData(i.filter((g) => g.id !== a.id));
775
+ }, le = (a) => {
776
+ F.value = a;
777
+ }, _ = (a) => {
778
+ F.value["filter[term]"] = a, C("dsg-table:term-changed", a);
779
+ }, se = (a, i, g) => {
780
+ F.value = { "filter[term]": F.value["filter[term]"], ...a }, C("dsg-table:filter-updated", F.value, i, g);
770
781
  };
771
- return D({
782
+ return $({
772
783
  reloadTable: Q,
773
- updateRowTable: z,
784
+ updateRowTable: I,
785
+ addRowTable: te,
786
+ deleteRowTable: ae,
774
787
  termChanged: _,
775
- setFilters: te
776
- }), (l, i) => (a(), s("div", Et, [
777
- l.hasHeader ? (a(), s("div", Rt, [
778
- B(l.$slots, "dsg-table--pre-header", {}, () => [
779
- k("div", Ht, [
780
- B(l.$slots, "dsg-table--page-title", {
781
- data: I.value,
782
- title: l.title
788
+ setFilters: le
789
+ }), (a, i) => (l(), o("div", Ht, [
790
+ a.hasHeader ? (l(), o("div", At, [
791
+ B(a.$slots, "dsg-table--pre-header", {}, () => [
792
+ k("div", It, [
793
+ B(a.$slots, "dsg-table--page-title", {
794
+ data: A.value,
795
+ title: a.title
783
796
  }, () => [
784
- l.title.length > 0 ? (a(), s("h1", {
797
+ a.title.length > 0 ? (l(), o("h1", {
785
798
  key: 0,
786
799
  class: "dsg-table--title",
787
- textContent: x(l.title)
788
- }, null, 8, It)) : P("", !0)
800
+ textContent: x(a.title)
801
+ }, null, 8, zt)) : P("", !0)
789
802
  ])
790
803
  ]),
791
- k("div", zt, [
792
- B(l.$slots, "dsg-table--page-actions", { data: I.value })
804
+ k("div", Vt, [
805
+ B(a.$slots, "dsg-table--page-actions", { data: A.value })
793
806
  ])
794
807
  ])
795
808
  ])) : P("", !0),
796
- l.displayPaginationInfo ? (a(), s("div", At, [
797
- k("div", Vt, [
798
- B(l.$slots, "dsg-table--search-header", { data: I.value }, () => [
799
- R(me, {
809
+ a.displayPaginationInfo ? (l(), o("div", Ot, [
810
+ k("div", Ut, [
811
+ B(a.$slots, "dsg-table--search-header", { data: A.value }, () => [
812
+ R(ke, {
800
813
  name: "term",
801
- "onDsgTable:termChanged": i[0] || (i[0] = (f) => _(f))
814
+ "onDsgTable:termChanged": i[0] || (i[0] = (g) => _(g))
802
815
  }),
803
- R(ve, {
804
- entity: l.filterEntity,
805
- "filter-endpoint": l.filterEndpoint,
806
- "search-endpoint": l.filterSearchEndpoint,
807
- filters: l.filters,
808
- "onDsgTable:filterUpdated": i[1] || (i[1] = (f, $, S) => ae(f, $, S))
816
+ R(pe, {
817
+ entity: a.filterEntity,
818
+ "filter-endpoint": a.filterEndpoint,
819
+ "search-endpoint": a.filterSearchEndpoint,
820
+ filters: a.filters,
821
+ "onDsgTable:filterUpdated": i[1] || (i[1] = (g, D, S) => se(g, D, S))
809
822
  }, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
810
- B(l.$slots, "dsg-table--search-actions", { data: I.value })
823
+ B(a.$slots, "dsg-table--search-actions", { data: A.value })
811
824
  ])
812
825
  ]),
813
- B(l.$slots, "dsg-table--search-navigation")
826
+ B(a.$slots, "dsg-table--search-navigation")
814
827
  ], 512)) : P("", !0),
815
- R(Lt, {
828
+ R(Rt, {
816
829
  ref: "dsgTable",
817
- "api-url": l.getUrl,
830
+ "api-url": a.getUrl,
818
831
  "filter-params": F.value,
819
- "onUpdate:filterParams": i[7] || (i[7] = (f) => F.value = f),
820
- "per-page": c.value,
821
- "onUpdate:perPage": i[8] || (i[8] = (f) => c.value = f),
822
- fields: l.fields,
823
- "load-on-start": l.loadOnStart,
832
+ "onUpdate:filterParams": i[7] || (i[7] = (g) => F.value = g),
833
+ "per-page": v.value,
834
+ "onUpdate:perPage": i[8] || (i[8] = (g) => v.value = g),
835
+ fields: a.fields,
836
+ "load-on-start": a.loadOnStart,
824
837
  "pagination-path": "meta",
825
- selectable: l.selectable,
826
- "track-by": l.trackBy,
827
- "table-layout": l.tableLayout,
838
+ selectable: a.selectable,
839
+ "track-by": a.trackBy,
840
+ "table-layout": a.tableLayout,
828
841
  css: m.value,
829
- data: l.data,
830
- "onDsgTable:loading": i[9] || (i[9] = (f) => A.value = !0),
831
- "onDsgTable:loaded": i[10] || (i[10] = (f) => A.value = !1),
842
+ data: a.data,
843
+ "onDsgTable:loading": i[9] || (i[9] = (g) => z.value = !0),
844
+ "onDsgTable:loaded": i[10] || (i[10] = (g) => z.value = !1),
832
845
  "onDsgTable:paginationData": j,
833
846
  "onDsgTable:loadSuccess": K,
834
- "onDsgTable:rowsSelected": i[11] || (i[11] = (f) => C("dsg-table:rows-selected", f)),
835
- "onDsgTable:rowClicked": i[12] || (i[12] = (f, $, S) => C("dsg-table:row-clicked", f, $, S)),
836
- "onDsgTable:rowHover": i[13] || (i[13] = (f, $, S) => C("dsg-table:row-hover", f, $, S)),
837
- "onDsgTable:rowDblclick": i[14] || (i[14] = (f, $, S) => C("dsg-table:row-dblclick", f, $, S))
838
- }, He({
839
- "dsg-field--actions": Z((f) => [
840
- B(l.$slots, "dsg-table-actions", { data: f }, () => [
841
- (a(), N(he, {
842
- key: f.rowIndex,
843
- data: f,
844
- "onDsgTable:actionEdit": i[2] || (i[2] = ($, S) => C("dsg-table:action-edit", $, S)),
845
- "onDsgTable:actionView": i[3] || (i[3] = ($, S) => C("dsg-table:action-view", $, S)),
846
- "onDsgTable:actionDelete": i[4] || (i[4] = ($, S) => C("dsg-table:action-delete", $, S)),
847
- "onDsgTable:actionArchive": i[5] || (i[5] = ($, S) => C("dsg-table:action-archive", $, S)),
848
- "onDsgTable:linkClicked": i[6] || (i[6] = ($, S, le) => C("dsg-table:link-clicked", $, S, le))
847
+ "onDsgTable:rowsSelected": i[11] || (i[11] = (g) => C("dsg-table:rows-selected", g)),
848
+ "onDsgTable:rowClicked": i[12] || (i[12] = (g, D, S) => C("dsg-table:row-clicked", g, D, S)),
849
+ "onDsgTable:rowHover": i[13] || (i[13] = (g, D, S) => C("dsg-table:row-hover", g, D, S)),
850
+ "onDsgTable:rowDblclick": i[14] || (i[14] = (g, D, S) => C("dsg-table:row-dblclick", g, D, S))
851
+ }, Ie({
852
+ "dsg-field--actions": Z((g) => [
853
+ B(a.$slots, "dsg-table-actions", { data: g }, () => [
854
+ (l(), N(ye, {
855
+ key: g.rowIndex,
856
+ data: g,
857
+ "onDsgTable:actionEdit": i[2] || (i[2] = (D, S) => C("dsg-table:action-edit", D, S)),
858
+ "onDsgTable:actionView": i[3] || (i[3] = (D, S) => C("dsg-table:action-view", D, S)),
859
+ "onDsgTable:actionDelete": i[4] || (i[4] = (D, S) => C("dsg-table:action-delete", D, S)),
860
+ "onDsgTable:actionArchive": i[5] || (i[5] = (D, S) => C("dsg-table:action-archive", D, S)),
861
+ "onDsgTable:linkClicked": i[6] || (i[6] = (D, S, ne) => C("dsg-table:link-clicked", D, S, ne))
849
862
  }, null, 8, ["data"]))
850
863
  ])
851
864
  ]),
852
865
  _: 2
853
866
  }, [
854
- q(U(y), (f, $) => ({
855
- name: $,
867
+ q(U(y), (g, D) => ({
868
+ name: D,
856
869
  fn: Z((S) => [
857
- String($) !== "dsg-field--actions" ? B(l.$slots, $, Ie(ze({ key: 0 }, S))) : P("", !0)
870
+ String(D) !== "dsg-field--actions" ? B(a.$slots, D, ze(Ve({ key: 0 }, S))) : P("", !0)
858
871
  ])
859
872
  }))
860
873
  ]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout", "css", "data"]),
861
- l.hasFooter ? (a(), s("div", Ot, [
862
- k("div", Ut, [
863
- B(l.$slots, "dsg-table--footer-left", {
864
- data: v.value,
874
+ a.hasFooter ? (l(), o("div", qt, [
875
+ k("div", Nt, [
876
+ B(a.$slots, "dsg-table--footer-left", {
877
+ data: f.value,
865
878
  perPage: r.value
866
879
  }, () => [
867
- R(pe, {
880
+ R(me, {
868
881
  ref: "paginationInfoStart",
869
- pagination: v.value,
870
- "onUpdate:pagination": i[15] || (i[15] = (f) => v.value = f),
882
+ pagination: f.value,
883
+ "onUpdate:pagination": i[15] || (i[15] = (g) => f.value = g),
871
884
  "info-template": h.value
872
885
  }, null, 8, ["pagination", "info-template"]),
873
- B(l.$slots, "dsg-table--footer-left-extras", {
874
- data: v.value,
886
+ B(a.$slots, "dsg-table--footer-left-extras", {
887
+ data: f.value,
875
888
  perPage: r.value
876
889
  })
877
890
  ])
878
891
  ]),
879
- k("div", qt, [
880
- B(l.$slots, "dsg-table--footer-center", {
881
- data: v.value,
892
+ k("div", Wt, [
893
+ B(a.$slots, "dsg-table--footer-center", {
894
+ data: f.value,
882
895
  perPage: r.value
883
896
  }, () => [
884
- B(l.$slots, "dsg-table--footer-center-extras", {
885
- data: v.value,
897
+ B(a.$slots, "dsg-table--footer-center-extras", {
898
+ data: f.value,
886
899
  perPage: r.value
887
900
  })
888
901
  ])
889
902
  ]),
890
- k("div", Nt, [
891
- B(l.$slots, "dsg-table--footer-right", {
892
- data: v.value,
903
+ k("div", jt, [
904
+ B(a.$slots, "dsg-table--footer-right", {
905
+ data: f.value,
893
906
  perPage: r.value
894
907
  }, () => [
895
- A.value === !1 ? (a(), N(fe, {
908
+ z.value === !1 ? (l(), N(he, {
896
909
  key: 0,
897
910
  ref: "pagination",
898
- pagination: v.value,
899
- "onUpdate:pagination": i[16] || (i[16] = (f) => v.value = f),
911
+ pagination: f.value,
912
+ "onUpdate:pagination": i[16] || (i[16] = (g) => f.value = g),
900
913
  "onDsgTable:changePage": T
901
914
  }, null, 8, ["pagination"])) : P("", !0),
902
- B(l.$slots, "dsg-table--footer-right-extras", {
903
- data: v.value,
915
+ B(a.$slots, "dsg-table--footer-right-extras", {
916
+ data: f.value,
904
917
  perPage: r.value
905
918
  })
906
919
  ])
@@ -908,47 +921,47 @@ You can explicitly suppress this warning by setting pagination-path="".`
908
921
  ], 512)) : P("", !0)
909
922
  ]));
910
923
  }
911
- }), jt = { class: "dsg-table--per-page" }, Kt = ["value", "textContent"], Qt = /* @__PURE__ */ W({
924
+ }), Qt = { class: "dsg-table--per-page" }, Yt = ["value", "textContent"], Gt = /* @__PURE__ */ W({
912
925
  __name: "DsgTablePerPage",
913
926
  props: {
914
927
  perPageOptions: { default: () => [10, 20, 30, 50, 100] },
915
928
  perPage: {}
916
929
  },
917
930
  setup(t) {
918
- return (D, g) => (a(), s("div", jt, [
919
- oe(k("select", {
920
- "onUpdate:modelValue": g[0] || (g[0] = (d) => D.perPage.perPage = d),
931
+ return ($, b) => (l(), o("div", Qt, [
932
+ re(k("select", {
933
+ "onUpdate:modelValue": b[0] || (b[0] = (d) => $.perPage.perPage = d),
921
934
  class: "dsg-table--per-page-select",
922
- onChange: g[1] || (g[1] = (d) => D.perPage.change(D.perPage.perPage))
935
+ onChange: b[1] || (b[1] = (d) => $.perPage.change($.perPage.perPage))
923
936
  }, [
924
- (a(!0), s(H, null, q(D.perPageOptions, (d) => (a(), s("option", {
937
+ (l(!0), o(H, null, q($.perPageOptions, (d) => (l(), o("option", {
925
938
  key: d,
926
939
  value: d,
927
940
  textContent: x(d)
928
- }, null, 8, Kt))), 128))
941
+ }, null, 8, Yt))), 128))
929
942
  ], 544), [
930
- [Ae, D.perPage.perPage]
943
+ [Oe, $.perPage.perPage]
931
944
  ])
932
945
  ]));
933
946
  }
934
- }), Yt = Wt, Gt = he, Jt = Qt, Xt = ve, Zt = fe, xt = pe, _t = me, ea = ye, na = {
935
- DsgTable: Yt,
936
- DsgTableActions: Gt,
937
- DsgTablePerPage: Jt,
938
- DsgTableFilter: Xt,
939
- DsgTablePagination: Zt,
940
- DsgTablePaginationInfo: xt,
941
- DsgTableSearch: _t,
942
- DsgTableRowHeader: ea
947
+ }), Jt = Kt, Xt = ye, Zt = Gt, xt = pe, _t = he, ea = me, ta = ke, aa = we, ia = {
948
+ DsgTable: Jt,
949
+ DsgTableActions: Xt,
950
+ DsgTablePerPage: Zt,
951
+ DsgTableFilter: xt,
952
+ DsgTablePagination: _t,
953
+ DsgTablePaginationInfo: ea,
954
+ DsgTableSearch: ta,
955
+ DsgTableRowHeader: aa
943
956
  };
944
957
  export {
945
- Yt as DsgTable,
946
- Gt as DsgTableActions,
947
- Xt as DsgTableFilter,
948
- Zt as DsgTablePagination,
949
- xt as DsgTablePaginationInfo,
950
- Jt as DsgTablePerPage,
951
- ea as DsgTableRowHeader,
952
- _t as DsgTableSearch,
953
- na as default
958
+ Jt as DsgTable,
959
+ Xt as DsgTableActions,
960
+ xt as DsgTableFilter,
961
+ _t as DsgTablePagination,
962
+ ea as DsgTablePaginationInfo,
963
+ Zt as DsgTablePerPage,
964
+ aa as DsgTableRowHeader,
965
+ ta as DsgTableSearch,
966
+ ia as default
954
967
  };