vlite3 1.4.32 → 1.4.34

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.
Files changed (44) hide show
  1. package/README.md +7 -0
  2. package/components/Alert.vue.js +45 -40
  3. package/components/Barcode/Barcode.vue.js +34 -21
  4. package/components/CategoryManager/CategoryNode.vue.js +30 -30
  5. package/components/CategoryMenu/CategoryMenu.vue.js +9 -11
  6. package/components/Chart/GanttChart.vue.d.ts +5 -1
  7. package/components/Chart/GanttChart.vue.js +2 -2
  8. package/components/Chart/GanttChart.vue2.js +977 -812
  9. package/components/Chart/GanttChartConnectorRouting.d.ts +83 -0
  10. package/components/Chart/GanttChartConnectorRouting.js +405 -0
  11. package/components/Chart/GanttChartDependencyUtils.js +43 -47
  12. package/components/Chart/types.d.ts +16 -1
  13. package/components/ColorPicker/ColorIro.vue2.js +78 -64
  14. package/components/ColorPicker/ColorPicker.vue.d.ts +5 -0
  15. package/components/ColorPicker/ColorPicker.vue.js +110 -64
  16. package/components/ColorPicker/constants.d.ts +2 -0
  17. package/components/ColorPicker/constants.js +4 -0
  18. package/components/ColorPicker/index.d.ts +1 -0
  19. package/components/Dropdown/Dropdown.vue.js +100 -97
  20. package/components/ExportData/ExportData.vue.js +85 -63
  21. package/components/FilePreview/FilePreview.vue.js +31 -13
  22. package/components/Form/FormField.vue.js +9 -8
  23. package/components/ImportData/ImportStep1.vue.js +80 -75
  24. package/components/Kanban/Kanban.vue.d.ts +16 -2
  25. package/components/Kanban/Kanban.vue.js +2 -2
  26. package/components/Kanban/Kanban.vue2.js +150 -86
  27. package/components/Kanban/types.d.ts +37 -0
  28. package/components/QRCode/QRCode.vue.js +31 -26
  29. package/components/ToastNotification.vue.js +1 -1
  30. package/components/ToastNotification.vue2.js +3 -3
  31. package/components/index.d.ts +1 -1
  32. package/composables/useKeyStroke.d.ts +18 -0
  33. package/composables/useKeyStroke.js +103 -77
  34. package/composables/useTheme.js +1 -1
  35. package/directives/vScrollReveal.js +23 -18
  36. package/index.d.ts +1 -0
  37. package/index.js +235 -233
  38. package/package.json +11 -4
  39. package/style.css +1 -1
  40. package/utils/UtilsModuleInterop.d.ts +6 -0
  41. package/utils/UtilsModuleInterop.js +9 -0
  42. package/utils/environment.d.ts +29 -0
  43. package/utils/environment.js +4 -0
  44. package/utils/functions.js +14 -13
@@ -69,7 +69,7 @@ const Be = /* @__PURE__ */ q({
69
69
  richTextEditor: t(se)
70
70
  }, P = t(s), e = d, h = j, o = (a, l) => {
71
71
  h("change", { value: a, data: l });
72
- }, k = (a) => {
72
+ }, R = (a) => {
73
73
  h("change", { value: a });
74
74
  }, u = c(() => K(e.field, {
75
75
  values: e.values,
@@ -92,7 +92,7 @@ const Be = /* @__PURE__ */ q({
92
92
  }, y = X(
93
93
  e.field.placeholderI18n,
94
94
  e.field.placeholder
95
- ), R = e.variant === "floating" && e.label && !e.floatingActive, f = R ? "" : y;
95
+ ), k = e.variant === "floating" && e.label && !e.floatingActive, f = k ? "" : y;
96
96
  if (a === "text" || a === "email" || a === "password" || a === "tel" || a === "url" || a === "search" || a === "textarea" || !a)
97
97
  return {
98
98
  ...i,
@@ -185,7 +185,7 @@ const Be = /* @__PURE__ */ q({
185
185
  triggerProps: {
186
186
  variant: e.variant === "floating" ? "outline-floating" : e.variant || "outline",
187
187
  size: e.size,
188
- ...R ? { text: "​" } : {}
188
+ ...k ? { text: "​" } : {}
189
189
  }
190
190
  };
191
191
  if (a === "multiSelect")
@@ -233,7 +233,7 @@ const Be = /* @__PURE__ */ q({
233
233
  variant: e.variant === "floating" ? "outline-floating" : e.variant || "outline",
234
234
  size: e.size,
235
235
  class: "px-3!",
236
- ...R ? { text: "​" } : {}
236
+ ...k ? { text: "​" } : {}
237
237
  }
238
238
  };
239
239
  if (a === "dateRangePicker")
@@ -298,7 +298,8 @@ const Be = /* @__PURE__ */ q({
298
298
  modelValue: e.value || "#000000",
299
299
  variant: e.variant,
300
300
  size: e.size,
301
- rounded: e.rounded
301
+ rounded: e.rounded,
302
+ allowReset: e.field.props?.allowReset ?? !1
302
303
  };
303
304
  if (a === "iconPicker")
304
305
  return {
@@ -342,14 +343,14 @@ const Be = /* @__PURE__ */ q({
342
343
  }), N = c(() => {
343
344
  const a = u.value;
344
345
  return a === "text" || a === "email" || a === "password" || a === "tel" || a === "url" || a === "search" || a === "textarea" || a === "switch" || a === "check" || !a ? {
345
- "update:modelValue": k
346
+ "update:modelValue": R
346
347
  } : a === "number" && x.value ? {
347
348
  "update:modelValue": (l) => {
348
349
  const n = l === "" ? void 0 : Number(l);
349
350
  h("change", { value: isNaN(n) ? void 0 : n });
350
351
  }
351
352
  } : a === "number" ? {
352
- "update:modelValue": k
353
+ "update:modelValue": R
353
354
  } : a === "select" ? {
354
355
  onSelect: (l) => {
355
356
  o(l.value, l.data);
@@ -381,7 +382,7 @@ const Be = /* @__PURE__ */ q({
381
382
  o(l);
382
383
  }
383
384
  } : a === "tags" ? {
384
- "update:modelValue": k,
385
+ "update:modelValue": R,
385
386
  change: (l) => o(l)
386
387
  } : a === "richTextEditor" ? {
387
388
  "update:modelValue": (l) => o(l)
@@ -1,15 +1,15 @@
1
- import { defineComponent as A, ref as b, computed as d, openBlock as w, createElementBlock as V, createElementVNode as r, toDisplayString as n, withModifiers as F, normalizeClass as E, createVNode as v, createCommentVNode as J, withCtx as K, createTextVNode as L } from "vue";
2
- import R from "papaparse";
3
- import M from "../Icon.vue.js";
4
- import W from "../Button.vue.js";
5
- import q from "../Textarea.vue.js";
1
+ import { defineComponent as J, ref as y, computed as d, openBlock as V, createElementBlock as F, createElementVNode as o, toDisplayString as n, withModifiers as E, normalizeClass as M, createVNode as v, createCommentVNode as K, withCtx as L, createTextVNode as W } from "vue";
2
+ import S from "../Icon.vue.js";
3
+ import q from "../Button.vue.js";
4
+ import G from "../Textarea.vue.js";
6
5
  import { showToast as h } from "../../composables/useNotifications.js";
7
6
  import { $t as k } from "../../utils/i18n.js";
8
7
  import { camelCase as g } from "../../utils/functions.js";
9
- const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { class: "space-y-6" }, Y = { class: "flex flex-col items-center justify-center pointer-events-none" }, Z = { class: "w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mb-4 text-primary" }, ee = { class: "font-medium text-foreground mb-1" }, te = { class: "text-sm text-muted-foreground" }, ae = {
8
+ import { resolveModuleRuntime as Q } from "../../utils/UtilsModuleInterop.js";
9
+ const X = { class: "space-y-2" }, Y = { class: "font-medium text-md" }, Z = { class: "space-y-6" }, ee = { class: "flex flex-col items-center justify-center pointer-events-none" }, te = { class: "w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mb-4 text-primary" }, re = { class: "font-medium text-foreground mb-1" }, ae = { class: "text-sm text-muted-foreground" }, oe = {
10
10
  key: 0,
11
11
  class: "mt-4 text-sm font-semibold text-primary bg-background px-3 py-1 rounded-md border border-border shadow-sm inline-block"
12
- }, re = { class: "flex items-center gap-3 mb-4" }, oe = { class: "w-8 h-8 rounded-lg bg-secondary flex items-center justify-center text-secondary-foreground" }, se = { class: "font-medium text-foreground leading-none" }, ie = { class: "flex justify-end mt-3" }, ve = /* @__PURE__ */ A({
12
+ }, se = { class: "flex items-center gap-3 mb-4" }, ie = { class: "w-8 h-8 rounded-lg bg-secondary flex items-center justify-center text-secondary-foreground" }, ne = { class: "font-medium text-foreground leading-none" }, le = { class: "flex justify-end mt-3" }, ge = /* @__PURE__ */ J({
13
13
  __name: "ImportStep1",
14
14
  props: {
15
15
  importMethod: {},
@@ -29,133 +29,138 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
29
29
  "next"
30
30
  ],
31
31
  setup(l, { emit: P }) {
32
- const y = l, i = P, s = (t, e, a) => {
33
- const o = a ? k(t, a) : k(t);
34
- return o !== t ? o : e;
35
- }, D = b(null), m = b(!1), c = b(""), S = (t) => {
36
- if (t.preventDefault(), m.value = !1, t.dataTransfer?.files && t.dataTransfer.files.length > 0) {
37
- const e = t.dataTransfer.files[0];
38
- e.type === "text/csv" || e.name.endsWith(".csv") ? _(e) : h(s("vlite.importData.csvOnly", "Please upload a CSV file"), "error");
32
+ const b = l, i = P, s = (r, e, a) => {
33
+ const t = a ? k(r, a) : k(r);
34
+ return t !== r ? t : e;
35
+ }, D = y(null), m = y(!1), c = y(""), T = (r) => {
36
+ if (r.preventDefault(), m.value = !1, r.dataTransfer?.files && r.dataTransfer.files.length > 0) {
37
+ const e = r.dataTransfer.files[0];
38
+ e.type === "text/csv" || e.name.endsWith(".csv") ? w(e) : h(s("vlite.importData.csvOnly", "Please upload a CSV file"), "error");
39
39
  }
40
- }, _ = (t) => {
41
- i("update:csvFile", t), i("update:importMethod", "file");
40
+ }, w = (r) => {
41
+ i("update:csvFile", r), i("update:importMethod", "file");
42
42
  const e = new FileReader();
43
43
  e.onload = (a) => {
44
- a.target?.result && C(a.target.result);
45
- }, e.readAsText(t);
46
- }, T = () => {
47
- i("update:importMethod", "paste"), c.value && C(c.value);
48
- }, j = (t) => {
49
- const e = g(t), a = {};
50
- return y.fields.forEach((o) => {
51
- a[g(o.field)] = o.field, a[g(o.title)] = o.field, o.matchings?.forEach((u) => {
52
- a[g(u)] = o.field;
44
+ a.target?.result && _(a.target.result);
45
+ }, e.readAsText(r);
46
+ }, j = () => {
47
+ i("update:importMethod", "paste"), c.value && _(c.value);
48
+ }, O = (r) => {
49
+ const e = g(r), a = {};
50
+ return b.fields.forEach((t) => {
51
+ a[g(t.field)] = t.field, a[g(t.title)] = t.field, t.matchings?.forEach((u) => {
52
+ a[g(u)] = t.field;
53
53
  });
54
54
  }), a[e] || "";
55
- }, C = (t) => {
55
+ }, _ = async (r) => {
56
56
  try {
57
- R.parse(t, {
57
+ const e = await import("papaparse"), a = Q(
58
+ e,
59
+ (t) => !!(t && typeof t == "object" && "parse" in t && typeof t.parse == "function")
60
+ );
61
+ if (!a) throw new Error("The CSV import runtime is unavailable.");
62
+ a.parse(r, {
58
63
  header: !0,
59
64
  skipEmptyLines: !0,
60
- complete: (e) => {
61
- if (!e.data || e.data.length === 0) {
65
+ complete: (t) => {
66
+ if (!t.data || t.data.length === 0) {
62
67
  h(s("vlite.importData.emptyCsv", "The CSV file is empty."), "warning");
63
68
  return;
64
69
  }
65
- const a = Object.keys(e.data[0]);
66
- i("update:headers", a);
67
- const o = e.data.map((p) => {
70
+ const u = Object.keys(t.data[0]);
71
+ i("update:headers", u);
72
+ const A = t.data.map((p) => {
68
73
  const f = {};
69
74
  return Object.keys(p).forEach((x) => {
70
- f[x] = p[x] || y.fields.find((B) => B.field === x)?.defaultValue;
75
+ f[x] = p[x] || b.fields.find((R) => R.field === x)?.defaultValue;
71
76
  }), f;
72
77
  });
73
- i("update:importData", o), i("update:preview", e.data.slice(0, 3));
74
- const u = {};
75
- a.forEach((p) => {
76
- const f = j(p);
77
- u[p] = f || "";
78
- }), i("update:mappings", u), i("next");
78
+ i("update:importData", A), i("update:preview", t.data.slice(0, 3));
79
+ const C = {};
80
+ u.forEach((p) => {
81
+ const f = O(p);
82
+ C[p] = f || "";
83
+ }), i("update:mappings", C), i("next");
79
84
  },
80
- error: (e) => h(
81
- s("vlite.importData.parseError", "Failed to parse CSV: ") + e.message,
85
+ error: (t) => h(
86
+ s("vlite.importData.parseError", "Failed to parse CSV: ") + t.message,
82
87
  "error"
83
88
  )
84
89
  });
85
90
  } catch (e) {
86
91
  h(s("vlite.importData.processError", "Error processing CSV data"), "error"), console.error(e);
87
92
  }
88
- }, O = (t) => {
89
- const e = t.target;
90
- e.files && e.files.length > 0 && _(e.files[0]);
91
- }, $ = d(() => s("vlite.importData.uploadData", "Upload Data")), I = d(() => s("vlite.importData.dragDrop", "Drag & drop a file here or click to browse")), z = d(() => s("vlite.importData.csvOnlyHint", "Only CSV files are supported")), H = d(() => s("vlite.importData.pasteData", "Or paste CSV/Excel data")), N = d(() => s("vlite.importData.process", "Process Data")), U = d(() => s("vlite.importData.pastePlaceholder", `id, name, email
93
+ }, $ = (r) => {
94
+ const e = r.target;
95
+ e.files && e.files.length > 0 && w(e.files[0]);
96
+ }, I = d(() => s("vlite.importData.uploadData", "Upload Data")), z = d(() => s("vlite.importData.dragDrop", "Drag & drop a file here or click to browse")), B = d(() => s("vlite.importData.csvOnlyHint", "Only CSV files are supported")), H = d(() => s("vlite.importData.pasteData", "Or paste CSV/Excel data")), N = d(() => s("vlite.importData.process", "Process Data")), U = d(() => s("vlite.importData.pastePlaceholder", `id, name, email
92
97
  1, John Doe, john@example.com`));
93
- return (t, e) => (w(), V("div", G, [
94
- r("h5", Q, n($.value), 1),
95
- r("div", X, [
96
- r("div", {
97
- class: E([
98
+ return (r, e) => (V(), F("div", X, [
99
+ o("h5", Y, n(I.value), 1),
100
+ o("div", Z, [
101
+ o("div", {
102
+ class: M([
98
103
  "relative border-2 border-dashed rounded-xl p-8 text-center cursor-pointer transition-colors",
99
104
  l.importMethod === "file" ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
100
105
  m.value ? "border-primary bg-primary/10 scale-[1.01]" : ""
101
106
  ]),
102
107
  onClick: e[0] || (e[0] = (a) => D.value?.click()),
103
- onDragover: e[1] || (e[1] = F((a) => m.value = !0, ["prevent"])),
104
- onDragleave: e[2] || (e[2] = F((a) => m.value = !1, ["prevent"])),
105
- onDrop: S
108
+ onDragover: e[1] || (e[1] = E((a) => m.value = !0, ["prevent"])),
109
+ onDragleave: e[2] || (e[2] = E((a) => m.value = !1, ["prevent"])),
110
+ onDrop: T
106
111
  }, [
107
- r("input", {
112
+ o("input", {
108
113
  type: "file",
109
114
  ref_key: "fileInput",
110
115
  ref: D,
111
116
  class: "hidden",
112
117
  accept: ".csv",
113
- onChange: O
118
+ onChange: $
114
119
  }, null, 544),
115
- r("div", Y, [
116
- r("div", Z, [
117
- v(M, {
120
+ o("div", ee, [
121
+ o("div", te, [
122
+ v(S, {
118
123
  icon: "lucide:upload-cloud",
119
124
  class: "w-6 h-6"
120
125
  })
121
126
  ]),
122
- r("p", ee, n(I.value), 1),
123
- r("p", te, n(z.value), 1),
124
- l.csvFile ? (w(), V("p", ae, n(l.csvFile.name) + " (" + n((l.csvFile.size / 1024).toFixed(2)) + " KB) ", 1)) : J("", !0)
127
+ o("p", re, n(z.value), 1),
128
+ o("p", ae, n(B.value), 1),
129
+ l.csvFile ? (V(), F("p", oe, n(l.csvFile.name) + " (" + n((l.csvFile.size / 1024).toFixed(2)) + " KB) ", 1)) : K("", !0)
125
130
  ])
126
131
  ], 34),
127
- r("div", {
128
- class: E([
132
+ o("div", {
133
+ class: M([
129
134
  "border rounded-xl p-6 transition-colors",
130
135
  l.importMethod === "paste" ? "border-primary shadow-sm ring-1 ring-primary/20" : "border-border"
131
136
  ])
132
137
  }, [
133
- r("div", re, [
134
- r("div", oe, [
135
- v(M, {
138
+ o("div", se, [
139
+ o("div", ie, [
140
+ v(S, {
136
141
  icon: "lucide:clipboard-paste",
137
142
  class: "w-4 h-4"
138
143
  })
139
144
  ]),
140
- r("div", null, [
141
- r("p", se, n(H.value), 1)
145
+ o("div", null, [
146
+ o("p", ne, n(H.value), 1)
142
147
  ])
143
148
  ]),
144
- v(q, {
149
+ v(G, {
145
150
  modelValue: c.value,
146
151
  "onUpdate:modelValue": e[3] || (e[3] = (a) => c.value = a),
147
152
  class: "w-full h-32",
148
153
  placeholder: U.value
149
154
  }, null, 8, ["modelValue", "placeholder"]),
150
- r("div", ie, [
151
- v(W, {
155
+ o("div", le, [
156
+ v(q, {
152
157
  variant: "secondary",
153
158
  size: "sm",
154
- onClick: T,
159
+ onClick: j,
155
160
  disabled: !c.value
156
161
  }, {
157
- default: K(() => [
158
- L(n(N.value), 1)
162
+ default: L(() => [
163
+ W(n(N.value), 1)
159
164
  ]),
160
165
  _: 1
161
166
  }, 8, ["disabled"])
@@ -166,5 +171,5 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
166
171
  }
167
172
  });
168
173
  export {
169
- ve as default
174
+ ge as default
170
175
  };
@@ -32,12 +32,26 @@ declare const __VLS_component: import('vue').DefineComponent<KanbanProps, {}, {}
32
32
  change: (payload: KanbanChangeEvent) => any;
33
33
  move: (payload: KanbanMoveEvent) => any;
34
34
  "update:data": (val: Record<string | number, any[]>) => any;
35
- "item-moved": (itemId: string | number, toColumnId: string | number, newPosition: number, item: any) => any;
35
+ "item-move-failed": (payload: {
36
+ itemId: string | number;
37
+ toColumnId: string | number;
38
+ fromColumnId: string | number;
39
+ newPosition: number;
40
+ item: any;
41
+ error: unknown;
42
+ }) => any;
36
43
  }, string, import('vue').PublicProps, Readonly<KanbanProps> & Readonly<{
37
44
  onChange?: (payload: KanbanChangeEvent) => any;
38
45
  onMove?: (payload: KanbanMoveEvent) => any;
39
46
  "onUpdate:data"?: (val: Record<string | number, any[]>) => any;
40
- "onItem-moved"?: (itemId: string | number, toColumnId: string | number, newPosition: number, item: any) => any;
47
+ "onItem-move-failed"?: (payload: {
48
+ itemId: string | number;
49
+ toColumnId: string | number;
50
+ fromColumnId: string | number;
51
+ newPosition: number;
52
+ item: any;
53
+ error: unknown;
54
+ }) => any;
41
55
  }>, {
42
56
  class: string;
43
57
  group: string;
@@ -1,7 +1,7 @@
1
1
  import o from "./Kanban.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-52c07c6d"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2dd0633e"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as D, ref as b, watch as k, openBlock as v, createElementBlock as h, normalizeClass as B, Fragment as w, renderList as P, createBlock as E, withCtx as i, renderSlot as m, mergeProps as c } from "vue";
2
- import $ from "./KanbanBoard.vue.js";
3
- const U = /* @__PURE__ */ D({
1
+ import { defineComponent as G, ref as K, watch as U, openBlock as C, createElementBlock as P, normalizeClass as j, Fragment as q, renderList as w, createBlock as z, withCtx as v, renderSlot as g, mergeProps as h } from "vue";
2
+ import F from "./KanbanBoard.vue.js";
3
+ const T = /* @__PURE__ */ G({
4
4
  __name: "Kanban",
5
5
  props: {
6
6
  columns: {},
@@ -17,109 +17,173 @@ const U = /* @__PURE__ */ D({
17
17
  draggableClass: {},
18
18
  ghostClass: {},
19
19
  class: { default: "h-full w-full" },
20
- isItemDisabled: {}
20
+ isItemDisabled: {},
21
+ onItemMoved: {}
21
22
  },
22
- emits: ["change", "move", "update:data", "item-moved"],
23
- setup(s, { emit: I }) {
24
- const o = s, d = I, r = b({}), u = b({});
25
- k(
26
- [() => o.data, () => o.rawData],
27
- ([e, n]) => {
28
- if (n && Array.isArray(n)) {
29
- const t = {};
30
- o.columns.forEach((a) => t[a.id] = []), n.forEach((a) => {
31
- const l = a[o.groupKey];
32
- t[l] ? t[l].push({ ...a }) : t[l] = [{ ...a }];
33
- }), Object.keys(t).forEach((a) => {
34
- t[a].sort((l, x) => (l[o.positionKey] || 0) - (x[o.positionKey] || 0));
35
- }), u.value = t;
36
- } else e && (u.value = { ...e });
23
+ emits: ["change", "move", "update:data", "item-move-failed"],
24
+ setup(l, { emit: B }) {
25
+ const s = l, c = B, u = K({}), d = K({}), p = K(!1);
26
+ U(
27
+ [() => s.data, () => s.rawData],
28
+ ([e, a]) => {
29
+ if (!p.value)
30
+ if (a && Array.isArray(a)) {
31
+ const o = {};
32
+ s.columns.forEach((t) => o[t.id] = []), a.forEach((t) => {
33
+ const i = t[s.groupKey];
34
+ o[i] ? o[i].push({ ...t }) : o[i] = [{ ...t }];
35
+ }), Object.keys(o).forEach((t) => {
36
+ o[t].sort((i, r) => (i[s.positionKey] || 0) - (r[s.positionKey] || 0));
37
+ }), d.value = o;
38
+ } else e && (d.value = { ...e });
37
39
  },
38
40
  { immediate: !0, deep: !0 }
39
41
  );
40
- const C = (e, n) => {
41
- let t = 0, a = 0;
42
- return n > 0 && (t = Number(e[n - 1]?.[o.positionKey]) || 0), n < e.length - 1 && (a = Number(e[n + 1]?.[o.positionKey]) || 0), t === 0 && a === 0 ? 1024 : t === 0 ? a / 2 : a === 0 ? t + 1024 : (t + a) / 2;
43
- }, g = (e, n) => {
44
- const t = u.value[e];
45
- if (!t) return;
46
- const a = t[n];
47
- if (!a) return;
48
- const l = C(t, n);
49
- a[o.positionKey] = l, a[o.groupKey] = e, d("item-moved", a[o.itemKey], e, l, a);
50
- }, f = (e) => o.columns.find((n) => n.id === e)?.disabled === !0, K = (e) => {
51
- if (d("change", e), e.type === "remove")
52
- r.value.remove = { columnId: e.columnId, event: e.event };
42
+ const A = (e, a) => {
43
+ let o = 0, t = 0;
44
+ return a > 0 && (o = Number(e[a - 1]?.[s.positionKey]) || 0), a < e.length - 1 && (t = Number(e[a + 1]?.[s.positionKey]) || 0), o === 0 && t === 0 ? 1024 : o === 0 ? t / 2 : t === 0 ? o + 1024 : (o + t) / 2;
45
+ }, E = (e) => {
46
+ p.value = !0;
47
+ try {
48
+ const a = s.itemKey, o = { ...d.value }, t = [...o[e.toColumnId] || []];
49
+ let i = t.find((n) => n?.[a] === e.itemId) || e.item;
50
+ const r = t.findIndex((n) => n?.[a] === e.itemId);
51
+ if (r >= 0)
52
+ i = t.splice(r, 1)[0];
53
+ else if (e.fromColumnId === e.toColumnId) {
54
+ const n = t.findIndex((m) => m?.[a] === e.itemId);
55
+ n >= 0 && (i = t.splice(n, 1)[0]);
56
+ }
57
+ if (!i) return;
58
+ if (i[s.positionKey] = e.previousPosition, i[s.groupKey] = e.previousGroupValue, e.fromColumnId === e.toColumnId) {
59
+ const n = Math.min(Math.max(e.oldIndex, 0), t.length);
60
+ t.splice(n, 0, i), o[e.toColumnId] = t;
61
+ } else {
62
+ o[e.toColumnId] = t;
63
+ const n = [...o[e.fromColumnId] || []], m = n.findIndex((f) => f?.[a] === e.itemId);
64
+ m >= 0 && n.splice(m, 1);
65
+ const I = Math.min(Math.max(e.oldIndex, 0), n.length);
66
+ n.splice(I, 0, i), o[e.fromColumnId] = n;
67
+ }
68
+ d.value = o, s.data && c("update:data", { ...o });
69
+ } finally {
70
+ queueMicrotask(() => {
71
+ p.value = !1;
72
+ });
73
+ }
74
+ }, k = async (e, a, o, t) => {
75
+ const i = d.value[e];
76
+ if (!i) return;
77
+ const r = i[a];
78
+ if (!r) return;
79
+ const n = r[s.itemKey], m = r[s.positionKey], I = r[s.groupKey], f = A(i, a);
80
+ r[s.positionKey] = f, r[s.groupKey] = e;
81
+ const y = () => E({
82
+ itemId: n,
83
+ item: r,
84
+ fromColumnId: o,
85
+ toColumnId: e,
86
+ oldIndex: t,
87
+ previousPosition: m,
88
+ previousGroupValue: I
89
+ }), V = {
90
+ fromColumnId: o,
91
+ oldIndex: t,
92
+ newIndex: a,
93
+ previousPosition: m,
94
+ revert: y
95
+ };
96
+ c("move", {
97
+ itemId: n,
98
+ item: r,
99
+ fromColumnId: o,
100
+ toColumnId: e,
101
+ oldIndex: t,
102
+ newIndex: a
103
+ });
104
+ const D = s.onItemMoved;
105
+ if (D)
106
+ try {
107
+ await D(n, e, f, r, V) === !1 && y();
108
+ } catch (M) {
109
+ y(), c("item-move-failed", {
110
+ itemId: n,
111
+ toColumnId: e,
112
+ fromColumnId: o,
113
+ newPosition: f,
114
+ item: r,
115
+ error: M
116
+ });
117
+ }
118
+ }, b = (e) => s.columns.find((a) => a.id === e)?.disabled === !0, $ = (e) => {
119
+ if (c("change", e), e.type === "remove")
120
+ u.value.remove = { columnId: e.columnId, event: e.event };
53
121
  else if (e.type === "add")
54
- r.value.add = { columnId: e.columnId, event: e.event };
122
+ u.value.add = { columnId: e.columnId, event: e.event };
55
123
  else if (e.type === "update") {
56
- if (f(e.columnId)) {
57
- r.value = {};
124
+ if (b(e.columnId)) {
125
+ u.value = {};
58
126
  return;
59
127
  }
60
- g(e.columnId, e.event.newIndex), d("move", {
61
- itemId: e.event.data?.[o.itemKey] || e.event.item?._underlying_vm_?.[o.itemKey],
62
- item: e.event.data,
63
- fromColumnId: e.columnId,
64
- toColumnId: e.columnId,
65
- oldIndex: e.event.oldIndex,
66
- newIndex: e.event.newIndex
67
- });
128
+ k(
129
+ e.columnId,
130
+ e.event.newIndex,
131
+ e.columnId,
132
+ e.event.oldIndex
133
+ );
68
134
  }
69
- if (r.value.remove && r.value.add) {
70
- const { remove: n, add: t } = r.value;
71
- if (f(n.columnId) || f(t.columnId)) {
72
- r.value = {};
135
+ if (u.value.remove && u.value.add) {
136
+ const { remove: a, add: o } = u.value;
137
+ if (b(a.columnId) || b(o.columnId)) {
138
+ u.value = {};
73
139
  return;
74
140
  }
75
- g(t.columnId, t.event.newIndex), d("move", {
76
- itemId: t.event.data?.[o.itemKey],
77
- item: t.event.data,
78
- fromColumnId: n.columnId,
79
- toColumnId: t.columnId,
80
- oldIndex: n.event.oldIndex,
81
- newIndex: t.event.newIndex
82
- }), r.value = {};
141
+ k(
142
+ o.columnId,
143
+ o.event.newIndex,
144
+ a.columnId,
145
+ a.event.oldIndex
146
+ ), u.value = {};
83
147
  }
84
148
  setTimeout(() => {
85
- r.value = {};
149
+ u.value = {};
86
150
  }, 100);
87
- }, p = (e, n) => {
88
- u.value[e] = n, o.data && d("update:data", { ...o.data, [e]: n });
89
- }, y = (e) => u.value[e] || [];
90
- return (e, n) => (v(), h("div", {
91
- class: B([
151
+ }, L = (e, a) => {
152
+ d.value[e] = a, s.data && c("update:data", { ...s.data, [e]: a });
153
+ }, N = (e) => d.value[e] || [];
154
+ return (e, a) => (C(), P("div", {
155
+ class: j([
92
156
  "flex gap-4 scrollbar-thin overflow-x-auto p-1 scrollbar-thin-x scrollable-container",
93
- o.class
157
+ s.class
94
158
  ])
95
159
  }, [
96
- (v(!0), h(w, null, P(s.columns, (t) => (v(), E($, {
97
- key: t.id,
98
- column: t,
99
- group: s.group,
100
- "item-key": s.itemKey,
101
- "load-data": s.loadData,
102
- "column-data": y(t.id),
103
- "board-class": s.boardClass,
104
- "header-class": s.headerClass,
105
- "body-class": s.bodyClass,
106
- "draggable-class": s.draggableClass,
107
- "ghost-class": s.ghostClass,
108
- "is-item-disabled": s.isItemDisabled,
109
- onChange: K,
110
- "onUpdate:columnData": (a) => p(t.id, a)
160
+ (C(!0), P(q, null, w(l.columns, (o) => (C(), z(F, {
161
+ key: o.id,
162
+ column: o,
163
+ group: l.group,
164
+ "item-key": l.itemKey,
165
+ "load-data": l.loadData,
166
+ "column-data": N(o.id),
167
+ "board-class": l.boardClass,
168
+ "header-class": l.headerClass,
169
+ "body-class": l.bodyClass,
170
+ "draggable-class": l.draggableClass,
171
+ "ghost-class": l.ghostClass,
172
+ "is-item-disabled": l.isItemDisabled,
173
+ onChange: $,
174
+ "onUpdate:columnData": (t) => L(o.id, t)
111
175
  }, {
112
- header: i((a) => [
113
- m(e.$slots, "column-header", c({ ref_for: !0 }, a), void 0, !0)
176
+ header: v((t) => [
177
+ g(e.$slots, "column-header", h({ ref_for: !0 }, t), void 0, !0)
114
178
  ]),
115
- "prepend-item": i((a) => [
116
- m(e.$slots, "prepend-item", c({ ref_for: !0 }, a), void 0, !0)
179
+ "prepend-item": v((t) => [
180
+ g(e.$slots, "prepend-item", h({ ref_for: !0 }, t), void 0, !0)
117
181
  ]),
118
- item: i((a) => [
119
- m(e.$slots, "item", c({ ref_for: !0 }, a), void 0, !0)
182
+ item: v((t) => [
183
+ g(e.$slots, "item", h({ ref_for: !0 }, t), void 0, !0)
120
184
  ]),
121
- "append-item": i((a) => [
122
- m(e.$slots, "append-item", c({ ref_for: !0 }, a), void 0, !0)
185
+ "append-item": v((t) => [
186
+ g(e.$slots, "append-item", h({ ref_for: !0 }, t), void 0, !0)
123
187
  ]),
124
188
  _: 3
125
189
  }, 8, ["column", "group", "item-key", "load-data", "column-data", "board-class", "header-class", "body-class", "draggable-class", "ghost-class", "is-item-disabled", "onUpdate:columnData"]))), 128))
@@ -127,5 +191,5 @@ const U = /* @__PURE__ */ D({
127
191
  }
128
192
  });
129
193
  export {
130
- U as default
194
+ T as default
131
195
  };