@aplus-frontend/ui 6.17.1 → 6.18.0

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 (28) hide show
  1. package/es/src/ap-grid/index.vue.mjs +8 -1
  2. package/es/src/ap-grid/utils/table.d.ts +1 -1
  3. package/es/src/ap-grid/utils/table.mjs +31 -31
  4. package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue.d.ts +11 -18
  5. package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue2.mjs +394 -142
  6. package/es/src/business/ap-draggable-grid/constans.d.ts +4 -8
  7. package/es/src/business/ap-draggable-grid/constans.mjs +4 -8
  8. package/es/src/business/ap-draggable-grid/index.d.ts +17 -30
  9. package/es/src/business/ap-draggable-grid/interface.d.ts +2 -0
  10. package/es/src/version.d.ts +1 -1
  11. package/es/src/version.mjs +1 -1
  12. package/lib/src/ap-grid/index.vue.js +1 -1
  13. package/lib/src/ap-grid/utils/table.d.ts +1 -1
  14. package/lib/src/ap-grid/utils/table.js +1 -1
  15. package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue.d.ts +11 -18
  16. package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue2.js +1 -1
  17. package/lib/src/business/ap-draggable-grid/constans.d.ts +4 -8
  18. package/lib/src/business/ap-draggable-grid/constans.js +1 -1
  19. package/lib/src/business/ap-draggable-grid/index.d.ts +17 -30
  20. package/lib/src/business/ap-draggable-grid/interface.d.ts +2 -0
  21. package/lib/src/version.d.ts +1 -1
  22. package/lib/src/version.js +1 -1
  23. package/package.json +3 -3
  24. package/theme/ap-descriptions/ap-descriptions.css +1 -1
  25. package/theme/ap-descriptions/ap-descriptions.less +1 -1
  26. package/theme/ap-draggable-grid/ap-draggable-grid.css +8 -5
  27. package/theme/ap-draggable-grid/ap-draggable-grid.less +10 -4
  28. package/theme/index.css +9 -6
@@ -1,188 +1,440 @@
1
- import { defineComponent as W, ref as O, computed as C, useTemplateRef as z, reactive as H, watch as M, onMounted as U, onUnmounted as V, createBlock as J, openBlock as w, unref as u, withCtx as X, createElementVNode as Y, normalizeStyle as A, normalizeClass as G, createElementBlock as $, Fragment as j, renderList as K, renderSlot as Q, createTextVNode as Z, toDisplayString as L } from "vue";
2
- import { ApDraggableGridProps as ee } from "./constans.mjs";
3
- import { Spin as re } from "@aplus-frontend/antdv";
1
+ import { defineComponent as lo, ref as N, computed as I, useTemplateRef as co, reactive as io, watch as fo, onMounted as po, onUnmounted as uo, createBlock as wo, openBlock as k, unref as R, withCtx as go, createElementVNode as ho, normalizeStyle as J, normalizeClass as U, createElementBlock as z, Fragment as mo, renderList as vo, renderSlot as Eo } from "vue";
2
+ import { ApDraggableGridProps as yo } from "./constans.mjs";
3
+ import { Spin as So } from "@aplus-frontend/antdv";
4
4
  import "../../config-provider/index.mjs";
5
- import { useNamespace as ae } from "../../config-provider/hooks/use-namespace.mjs";
6
- const te = ["data-span", "draggable", "onDragstart"], ce = /* @__PURE__ */ W({
5
+ import { useNamespace as Ro } from "../../config-provider/hooks/use-namespace.mjs";
6
+ const Do = ["data-span", "draggable", "onDragstart"], Co = /* @__PURE__ */ lo({
7
7
  __name: "ApDraggableGrid",
8
- props: ee(),
8
+ props: yo(),
9
9
  emits: ["onGridListChange"],
10
- setup(k, { expose: T, emit: N }) {
11
- const l = k, { b: D, e: f, m: R } = ae("ap-draggable-grid"), p = O(!1), v = C(() => f("item")), E = C(() => f("dragging")), B = N, d = z("gridContainer"), i = O(null), o = H([]);
12
- M(
13
- () => l.gridList,
14
- (e) => {
15
- Array.isArray(e) && h(e);
10
+ setup(V, { expose: X, emit: Y }) {
11
+ const h = V, { b: W, e: M, m: H } = Ro("ap-draggable-grid"), $ = N(!1), L = N([]), A = I(() => M("item")), B = I(() => M("dragging")), P = I(() => h.customWrapper ? `.${h.customWrapper} .${A.value}` : `.${A.value}`), q = I(() => h.customWrapper ? `.${h.customWrapper} .${A.value}:not(.${B.value})` : `.${A.value}:not(.${B.value})`), K = Y, D = co("gridContainer"), y = N(null), c = io([]);
12
+ fo(
13
+ () => h.gridList,
14
+ (r) => {
15
+ Array.isArray(r) && G(r);
16
16
  },
17
17
  { deep: !0, immediate: !0 }
18
18
  );
19
- function h(e) {
20
- o.splice(0, o.length), e.forEach((r) => {
21
- o.push({
22
- ...r,
19
+ function G(r) {
20
+ c.splice(0, c.length), r.forEach((s) => {
21
+ c.push({
22
+ ...s,
23
23
  isDragging: !1,
24
24
  isOverlay: !1
25
25
  });
26
26
  });
27
27
  }
28
- const F = (e) => ({
29
- gridColumn: `${e.col} / span ${e.span}`,
30
- gridRow: e.row,
31
- minHeight: `${l.gridItemHeight}px`,
32
- boxShadow: l.gridItemShadow ? l.gridItemShadow : "none"
33
- }), q = (e) => {
34
- if (e.isOverlay) {
35
- const r = {};
36
- return l.dragOverlayColor && (r.backgroundColor = l.dragOverlayColor), l.dragOverlayBorderColor && (r.border = `2px dashed ${l.dragOverlayBorderColor}`, r.boxSizing = "border-box"), r;
37
- }
38
- return {};
39
- }, x = (e, r) => {
40
- i.value = r, o[r].isDragging = !0, e.dataTransfer && (e.dataTransfer.setData("text/plain", String(r)), e.dataTransfer.effectAllowed = "move");
41
- }, _ = () => {
42
- i.value !== null && (o[i.value].isDragging = !1, m(), i.value = null), o.forEach((e) => e.isOverlay = !1);
28
+ const Q = (r) => ({
29
+ gridColumn: `${r.col} / span ${r.span}`,
30
+ gridRow: r.row,
31
+ minHeight: `${h.gridItemHeight}px`,
32
+ boxShadow: h.gridItemShadow ? h.gridItemShadow : "none"
33
+ }), Z = (r, s) => {
34
+ y.value = s, c[s].isDragging = !0, L.value = c.map((o) => ({
35
+ row: o.row,
36
+ col: o.col
37
+ })), r.dataTransfer && (r.dataTransfer.setData("text/plain", String(s)), r.dataTransfer.effectAllowed = "move");
38
+ }, x = () => {
39
+ y.value !== null && (c[y.value].isDragging = !1, C(), y.value = null), c.forEach((r) => r.isOverlay = !1);
43
40
  };
44
- function m() {
45
- const e = o.map(
46
- (r) => ({
47
- span: r.span,
48
- row: r.row,
49
- col: r.col,
50
- height: r.height ? r.height : ""
41
+ function C() {
42
+ const r = c.map(
43
+ (s) => ({
44
+ span: s.span,
45
+ row: s.row,
46
+ col: s.col,
47
+ height: s.height ? s.height : "",
48
+ showHeight: s.showHeight ? s.showHeight : "",
49
+ module: s.module
51
50
  })
52
51
  );
53
- B("onGridListChange", e);
52
+ K("onGridListChange", r);
54
53
  }
55
- async function b() {
56
- if (h([]), typeof l.request == "function")
54
+ async function _() {
55
+ if (G([]), typeof h.request == "function")
57
56
  try {
58
- p.value = !0;
59
- const e = await l.request();
60
- Array.isArray(e) ? h(e) : console.warn(
57
+ $.value = !0;
58
+ const r = await h.request();
59
+ Array.isArray(r) ? G(r) : console.warn(
61
60
  "ApDraggableGrid: 请求函数必须返回一个符合 ApDraggableGridItemBase 数组的格式"
62
61
  );
63
- } catch (e) {
64
- console.error("ApDraggableGrid: 请求错误:", e);
62
+ } catch (r) {
63
+ console.error("ApDraggableGrid: 请求错误:", r);
65
64
  } finally {
66
- p.value = !1;
65
+ $.value = !1;
67
66
  }
68
67
  }
69
- U(async () => {
70
- if (await b(), y(), l.disableDrag || !d.value) return;
71
- const e = (a) => {
72
- if (a.preventDefault(), i.value === null || !a.target) return;
73
- const t = document.elementFromPoint(a.clientX, a.clientY);
74
- if (!t) return;
75
- const n = t.closest(
76
- `.${v.value}:not(.${E.value})`
68
+ function oo() {
69
+ L.value.length === c.length && c.forEach((r, s) => {
70
+ const o = L.value[s];
71
+ r.row = o.row, r.col = o.col;
72
+ });
73
+ }
74
+ po(async () => {
75
+ if (await _(), O(), h.disableDrag || !D.value) return;
76
+ const r = (o) => {
77
+ if (o.preventDefault(), y.value === null || !o.target) return;
78
+ const e = document.elementFromPoint(o.clientX, o.clientY);
79
+ if (!e) return;
80
+ const t = e.closest(
81
+ q.value
77
82
  );
78
- if (!n) return;
79
- const s = Array.from(
80
- document.querySelectorAll(`.${v.value}`)
81
- ).indexOf(n);
82
- s >= 0 && s !== i.value && (o.forEach((c) => c.isOverlay = !1), o[s].isOverlay = !0, S(i.value, s) ? a.dataTransfer.dropEffect = "move" : a.dataTransfer.dropEffect = "none");
83
- }, r = (a) => {
84
- if (a.preventDefault(), i.value === null) return;
85
- const t = document.elementFromPoint(a.clientX, a.clientY);
86
83
  if (!t) return;
87
- const n = t.closest(
88
- `.${v.value}:not(.${E.value})`
84
+ const a = Array.from(
85
+ document.querySelectorAll(P.value)
86
+ ).indexOf(t);
87
+ a >= 0 && a !== y.value && (c.forEach((f) => f.isOverlay = !1), c[a].isOverlay = !0, j(y.value, a) ? o.dataTransfer.dropEffect = "move" : o.dataTransfer.dropEffect = "none");
88
+ }, s = (o) => {
89
+ if (o.preventDefault(), y.value === null) return;
90
+ const e = document.elementFromPoint(o.clientX, o.clientY);
91
+ if (!e) return;
92
+ const t = e.closest(
93
+ q.value
89
94
  );
90
- if (!n) return;
91
- const s = Array.from(
92
- document.querySelectorAll(`.${v.value}`)
93
- ).indexOf(n);
94
- s >= 0 && S(i.value, s) && (P(i.value, s), y(), m()), o.forEach((c) => {
95
- c.isDragging = !1, c.isOverlay = !1;
96
- }), i.value = null;
95
+ if (!t) return;
96
+ const a = Array.from(
97
+ document.querySelectorAll(P.value)
98
+ ).indexOf(t);
99
+ a >= 0 && ro(y.value, a) ? (no(y.value, a), O(), C()) : oo(), c.forEach((f) => {
100
+ f.isDragging = !1, f.isOverlay = !1;
101
+ }), y.value = null;
97
102
  };
98
- d.value.addEventListener("dragover", e), d.value.addEventListener("drop", r), V(() => {
99
- d.value && (d.value.removeEventListener("dragover", e), d.value.removeEventListener("drop", r));
103
+ D.value.addEventListener("dragover", r), D.value.addEventListener("drop", s), uo(() => {
104
+ D.value && (D.value.removeEventListener("dragover", r), D.value.removeEventListener("drop", s));
100
105
  });
101
106
  });
102
- function S(e, r) {
103
- const a = JSON.parse(
104
- JSON.stringify(o)
105
- ), t = a[e], n = a[r], g = t.height === n.height, s = I(
106
- t.span,
107
- n.row,
108
- e,
109
- r
110
- ), c = I(
111
- n.span,
112
- t.row,
113
- r,
114
- e
115
- );
116
- return s && c && g;
107
+ function j(r, s) {
108
+ const o = c[r], e = c[s];
109
+ if (o.row === e.row) {
110
+ const t = c.filter(
111
+ (a) => a.row === o.row
112
+ );
113
+ let i = 0;
114
+ return t.forEach((a) => {
115
+ c.indexOf(a) !== r && c.indexOf(a) !== s && (i += a.span);
116
+ }), i += o.span + e.span, i <= 24;
117
+ }
118
+ return o.span === e.span && o.height === e.height ? !0 : o.span === 24 ? c.filter(
119
+ (a) => a.row === e.row
120
+ ).reduce(
121
+ (a, f) => a + f.span,
122
+ 0
123
+ ) === 24 : e.span === 24 ? c.filter(
124
+ (a) => a.row === o.row
125
+ ).reduce(
126
+ (a, f) => a + f.span,
127
+ 0
128
+ ) === 24 : !1;
117
129
  }
118
- function I(e, r, a, t) {
119
- let n = 0, g = 1;
120
- return o.forEach((s, c) => {
121
- s.row === r && c !== t && c !== a && (n += s.span, s.col <= g && (g = s.col + s.span));
122
- }), n + e <= 24;
130
+ function ro(r, s) {
131
+ const o = c[r], e = c[s];
132
+ if (o.row === e.row)
133
+ return j(r, s);
134
+ const t = JSON.parse(JSON.stringify(c)), i = o.row, a = e.row, f = a < i, m = /* @__PURE__ */ new Map();
135
+ if (t.forEach((n, p) => {
136
+ m.has(n.row) || m.set(n.row, []), m.get(n.row).push(p);
137
+ }), o.span === 24 && e.span === 24) {
138
+ t[r].row = a, t[r].col = 1;
139
+ const n = f ? a + 1 : a - 1;
140
+ t[s].row = n, t[s].col = 1;
141
+ const p = t.map((u) => u.row);
142
+ t.forEach((u, l) => {
143
+ l !== r && l !== s && (f ? (p[l] > a && p[l] < i || p[l] === n) && (u.row += 1) : (p[l] > i && p[l] < a || p[l] === n) && (u.row -= 1));
144
+ });
145
+ } else if (o.span === 24) {
146
+ const n = t.filter(
147
+ (u) => u.row === a
148
+ );
149
+ if (n.reduce(
150
+ (u, l) => u + l.span,
151
+ 0
152
+ ) !== 24) return !1;
153
+ if (t[r].row = a, t[r].col = 1, f) {
154
+ const u = /* @__PURE__ */ new Set();
155
+ for (let l = a; l < i; l++)
156
+ u.add(l);
157
+ t.forEach((l, E) => {
158
+ E !== r && u.has(l.row) && (l.row += 1);
159
+ }), n.forEach((l) => {
160
+ t.indexOf(l) !== r && (l.row = a + 1);
161
+ });
162
+ } else
163
+ n.forEach((u) => {
164
+ t.indexOf(u) !== r && (u.row = i);
165
+ });
166
+ } else if (e.span === 24) {
167
+ const n = t.filter(
168
+ (u) => u.row === i
169
+ );
170
+ if (n.reduce(
171
+ (u, l) => u + l.span,
172
+ 0
173
+ ) !== 24) return !1;
174
+ t[s].row = i, t[s].col = 1, f ? n.forEach((u) => {
175
+ t.indexOf(u) !== s && (u.row = a + 1);
176
+ }) : n.forEach((u) => {
177
+ t.indexOf(u) !== s && (u.row = a);
178
+ });
179
+ } else if (o.span === e.span)
180
+ t[r].row = a, t[r].col = e.col, t[s].row = i, t[s].col = o.col;
181
+ else
182
+ return !1;
183
+ const v = /* @__PURE__ */ new Map();
184
+ t.forEach((n) => {
185
+ v.has(n.row) || v.set(n.row, []), v.get(n.row).push(n);
186
+ });
187
+ const S = Array.from(v.keys()).sort((n, p) => n - p);
188
+ let w = 1;
189
+ for (const n of S)
190
+ v.get(n).forEach((u) => {
191
+ u.row = w;
192
+ }), w++;
193
+ return eo(t);
194
+ }
195
+ function eo(r) {
196
+ const s = {};
197
+ r.forEach((o) => {
198
+ s[o.row] || (s[o.row] = []), s[o.row].push(o);
199
+ });
200
+ for (const o in s) {
201
+ const e = s[o];
202
+ if (e.reduce((a, f) => a + f.span, 0) > 24)
203
+ return !1;
204
+ e.sort((a, f) => a.col - f.col);
205
+ let i = 0;
206
+ for (const a of e) {
207
+ if (a.col <= i)
208
+ return !1;
209
+ i = a.col + a.span - 1;
210
+ }
211
+ }
212
+ return !0;
123
213
  }
124
- function P(e, r) {
125
- const a = o[e], t = o[r], n = a.row, g = a.col;
126
- a.row = t.row, a.col = t.col, t.row = n, t.col = g;
214
+ function no(r, s) {
215
+ const o = c[r], e = c[s], t = JSON.parse(JSON.stringify(c)), i = o.row, a = e.row;
216
+ if (o.span === 24 && e.span === 24) {
217
+ ao(
218
+ o,
219
+ e,
220
+ i,
221
+ a,
222
+ t
223
+ );
224
+ return;
225
+ }
226
+ if (i === a) {
227
+ const w = o.col;
228
+ o.col = e.col, e.col = w;
229
+ return;
230
+ }
231
+ const f = a < i, m = c.map((w) => w.row), v = c.map((w) => w.col), S = c.map((w) => w.span);
232
+ if (o.span === 24 && e.span === 24) {
233
+ const w = i, n = a;
234
+ o.row = n, o.col = 1, o.span = 24, e.row = w, e.col = 1, e.span = 24;
235
+ const p = Math.abs(w - n), u = /* @__PURE__ */ new Set();
236
+ for (let l = Math.min(w, n); l <= Math.max(w, n); l++)
237
+ u.add(l);
238
+ if (p !== 1) {
239
+ const l = Math.min(w, n), E = Math.max(w, n), d = /* @__PURE__ */ new Map();
240
+ if (f) {
241
+ d.set(w, n), d.set(n, n + 1);
242
+ for (let g = n + 1; g < w; g++)
243
+ d.set(g, g + 1);
244
+ } else {
245
+ d.set(w, n), d.set(n, n - 1);
246
+ for (let g = w + 1; g < n; g++)
247
+ d.set(g, g - 1);
248
+ }
249
+ c.forEach((g, b) => {
250
+ if (b !== r && b !== s) {
251
+ const T = m[b];
252
+ T >= l && T <= E && d.has(T) && (g.row = d.get(T), g.col = v[b], g.span = S[b]);
253
+ }
254
+ });
255
+ }
256
+ } else if (o.span === 24) {
257
+ const w = c.filter(
258
+ (n) => n.row === a
259
+ );
260
+ o.row = a, o.col = 1, f ? c.forEach((n, p) => {
261
+ p !== r && (n.row === a ? n.row = a + 1 : n.row > a && n.row < i && (n.row += 1));
262
+ }) : w.forEach((n) => {
263
+ c.indexOf(n) !== r && (n.row = i);
264
+ });
265
+ } else if (e.span === 24) {
266
+ const w = c.filter(
267
+ (n) => n.row === i
268
+ );
269
+ e.row = i, e.col = 1, f ? (w.forEach((n) => {
270
+ c.indexOf(n) !== s && (n.row = a + 1);
271
+ }), c.forEach((n, p) => {
272
+ p !== s && !w.includes(n) && n.row > a && n.row < i && (n.row += 1);
273
+ })) : w.forEach((n) => {
274
+ c.indexOf(n) !== s && (n.row = a);
275
+ });
276
+ } else o.span === e.span && (o.row = a, o.col = e.col, e.row = i, e.col = o.col);
277
+ O();
127
278
  }
128
- function y() {
129
- const e = {};
130
- o.forEach((r) => {
131
- e[r.row] || (e[r.row] = []), e[r.row].push(r);
132
- }), Object.keys(e).forEach((r) => {
133
- const a = parseInt(r);
134
- e[a].sort((n, g) => n.col - g.col);
135
- let t = 1;
136
- e[a].forEach((n) => {
137
- n.col = t, t += n.span;
279
+ function ao(r, s, o, e, t) {
280
+ const i = r.module, a = s.module, f = t.map((l) => ({ ...l })), m = /* @__PURE__ */ new Map();
281
+ f.forEach((l) => {
282
+ m.has(l.row) || m.set(l.row, []), m.get(l.row).push(l);
283
+ });
284
+ const v = f.find(
285
+ (l) => l.module === i
286
+ ), S = f.find(
287
+ (l) => l.module === a
288
+ ), w = Array.from(
289
+ /* @__PURE__ */ new Set([o, e, ...Array.from(m.keys())])
290
+ ).sort((l, E) => l - E), n = {};
291
+ let p = 1;
292
+ for (const l of w) {
293
+ if (n[p]) {
294
+ p++;
295
+ continue;
296
+ }
297
+ if (l === o)
298
+ p === e && p++, n[p] = [S], S.row = p, S.col = 1, S.span = 24, p++;
299
+ else if (l === e)
300
+ p === o && p++, n[p] = [v], v.row = p, v.col = 1, v.span = 24, p++;
301
+ else {
302
+ const d = (m.get(l) || []).filter(
303
+ (g) => g.module !== i && g.module !== a
304
+ );
305
+ d.length > 0 && (d.forEach((g) => {
306
+ g.row = p, g.col = g === d[0] ? 1 : d[0].col + d[0].span;
307
+ }), n[p] = d, p++);
308
+ }
309
+ }
310
+ c.splice(0, c.length);
311
+ const u = Object.keys(n).map(Number).sort((l, E) => l - E);
312
+ for (const l of u) {
313
+ const E = n[l];
314
+ E.sort((d, g) => d.col - g.col), E.forEach((d) => {
315
+ c.push(d);
138
316
  });
317
+ }
318
+ O();
319
+ }
320
+ function O() {
321
+ c.forEach((e) => {
322
+ if (e.module) {
323
+ const t = so(e.module);
324
+ t && (e.span <= 0 || e.span > 24) ? (console.log(
325
+ `Restoring original span ${t} for module ${e.module}`
326
+ ), e.span = t) : (e.span <= 0 && (e.span = 1), e.span > 24 && (e.span = 24));
327
+ } else
328
+ e.span <= 0 && (e.span = 1), e.span > 24 && (e.span = 24);
329
+ e.span === 24 && (e.col = 1);
139
330
  });
331
+ const r = {};
332
+ c.forEach((e) => {
333
+ r[e.row] || (r[e.row] = []), r[e.row].push(e);
334
+ }), Object.keys(r).forEach((e) => {
335
+ const t = parseInt(e), i = r[t];
336
+ if (i.sort((f, m) => f.col - m.col), i.length === 1 && i[0].span === 24) {
337
+ i[0].col = 1;
338
+ return;
339
+ }
340
+ let a = 1;
341
+ i.forEach((f, m) => {
342
+ f.col = a;
343
+ const v = 24 - a + 1;
344
+ f.span > v && (m === 0 ? f.span = Math.min(f.span, 24) : f.span = v), a += f.span;
345
+ }), F(i);
346
+ });
347
+ const s = Object.keys(r).map(Number).sort((e, t) => e - t);
348
+ let o = 1;
349
+ s.forEach((e) => {
350
+ e !== o && r[e].forEach((t) => {
351
+ t.row = o;
352
+ }), o++;
353
+ }), to();
354
+ }
355
+ function so(r) {
356
+ return {
357
+ 1: 8,
358
+ 2: 16,
359
+ 3: 24,
360
+ 4: 16,
361
+ 5: 8,
362
+ 6: 16,
363
+ 7: 8,
364
+ 8: 24,
365
+ 9: 12,
366
+ 10: 12
367
+ }[r] || null;
368
+ }
369
+ function to() {
370
+ const r = [...new Set(c.map((o) => o.row))].sort(
371
+ (o, e) => o - e
372
+ );
373
+ for (let o = 0; o < r.length - 1; o++)
374
+ r[o + 1] - r[o] !== 1 && console.warn(`Row gap detected: ${r[o]} to ${r[o + 1]}`);
375
+ const s = {};
376
+ c.forEach((o) => {
377
+ s[o.row] || (s[o.row] = []), s[o.row].push(o);
378
+ }), Object.keys(s).forEach((o) => {
379
+ F(s[parseInt(o)]);
380
+ });
381
+ }
382
+ function F(r) {
383
+ r.sort((s, o) => s.col - o.col);
384
+ for (let s = 0; s < r.length; s++) {
385
+ const o = r[s], e = o.col, t = o.span;
386
+ if (o.span <= 0 && (o.span = 1), o.span > 24 && (o.span = 24), o.col < 1 && (o.col = 1), o.col + o.span - 1 > 24 && (o.col > 1 ? o.col = Math.max(1, 25 - o.span) : o.span = 24 - o.col + 1), s > 0) {
387
+ const a = r[s - 1], f = a.col + a.span - 1;
388
+ o.col <= f && (o.col = f + 1, o.col + o.span - 1 > 24 && (o.span = Math.max(1, 24 - o.col + 1)));
389
+ }
390
+ (e !== o.col || t !== o.span) && console.warn(
391
+ `Item layout corrected: col ${e} -> ${o.col}, span ${t} -> ${o.span}`
392
+ );
393
+ }
140
394
  }
141
- return T({
142
- setGridItems: (e) => {
143
- h(e), y(), m();
395
+ return X({
396
+ setGridItems: (r) => {
397
+ G(r), O(), C();
144
398
  },
145
399
  refreshGrid: () => {
146
400
  (async () => {
147
- await b(), y(), m();
401
+ await _(), O(), C();
148
402
  })();
149
403
  }
150
- }), (e, r) => (w(), J(u(re), { spinning: p.value }, {
151
- default: X(() => [
152
- Y("div", {
404
+ }), (r, s) => (k(), wo(R(So), { spinning: $.value }, {
405
+ default: go(() => [
406
+ ho("div", {
153
407
  ref_key: "gridContainer",
154
- ref: d,
155
- class: G([p.value ? u(D)("loading") : u(D)()]),
156
- style: A({
157
- width: typeof e.gridWidth == "number" ? `${e.gridWidth}px` : e.gridWidth,
158
- gap: `${e.gapWidth}px`
408
+ ref: D,
409
+ class: U([$.value ? R(W)("loading") : R(W)(), h.customWrapper]),
410
+ style: J({
411
+ width: typeof r.gridWidth == "number" ? `${r.gridWidth}px` : r.gridWidth,
412
+ gap: `${r.gapWidth}px`
159
413
  })
160
414
  }, [
161
- (w(!0), $(j, null, K(o, (a, t) => (w(), $("div", {
162
- key: t,
163
- class: G([
164
- u(f)("item"),
165
- l.disableDrag ? "" : u(R)("dragging"),
166
- a.isDragging ? u(f)("dragging") : "",
167
- a.isOverlay ? u(f)("overlay") : ""
415
+ (k(!0), z(mo, null, vo(c, (o, e) => (k(), z("div", {
416
+ key: e,
417
+ class: U([
418
+ R(M)("item"),
419
+ h.disableDrag ? "" : R(H)("dragging"),
420
+ o.isDragging ? R(M)("dragging") : "",
421
+ o.isOverlay ? R(M)("overlay") : "",
422
+ h.disableDrag ? "" : R(H)("canDrag")
168
423
  ]),
169
- "data-span": a.span,
170
- style: A([
171
- F(a),
172
- q(a),
173
- { height: a.height ? a.height + "px" : "" }
424
+ "data-span": o.span,
425
+ style: J([
426
+ Q(o),
427
+ { height: o.showHeight ? o.showHeight + "px" : "" }
174
428
  ]),
175
- draggable: !l.disableDrag,
176
- onDragstart: (n) => x(n, t),
177
- onDragend: _
429
+ draggable: !h.disableDrag,
430
+ onDragstart: (t) => Z(t, e),
431
+ onDragend: x
178
432
  }, [
179
- Q(e.$slots, "item", {
180
- item: a,
181
- index: t
182
- }, () => [
183
- Z(L(Math.round(a.span / 24 * 100)) + "% (" + L(a.span) + "/24) ", 1)
184
- ])
185
- ], 46, te))), 128))
433
+ Eo(r.$slots, "item", {
434
+ item: o,
435
+ index: e
436
+ })
437
+ ], 46, Do))), 128))
186
438
  ], 6)
187
439
  ]),
188
440
  _: 3
@@ -190,5 +442,5 @@ const te = ["data-span", "draggable", "onDragstart"], ce = /* @__PURE__ */ W({
190
442
  }
191
443
  });
192
444
  export {
193
- ce as default
445
+ Co as default
194
446
  };
@@ -25,16 +25,12 @@ export declare const ApDraggableGridProps: () => {
25
25
  type: NumberConstructor;
26
26
  default: number;
27
27
  };
28
- dragOverlayColor: {
29
- type: StringConstructor;
30
- default: string;
31
- };
32
- dragOverlayBorderColor: {
33
- type: StringConstructor;
34
- default: string;
35
- };
36
28
  disableDrag: {
37
29
  type: BooleanConstructor;
38
30
  default: boolean;
39
31
  };
32
+ customWrapper: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
40
36
  };
@@ -23,17 +23,13 @@ const e = () => ({
23
23
  type: Number,
24
24
  default: 12
25
25
  },
26
- dragOverlayColor: {
27
- type: String,
28
- default: "#66a9ff"
29
- },
30
- dragOverlayBorderColor: {
31
- type: String,
32
- default: "#4d97f7"
33
- },
34
26
  disableDrag: {
35
27
  type: Boolean,
36
28
  default: !1
29
+ },
30
+ customWrapper: {
31
+ type: String,
32
+ default: "ap-draggable-grid"
37
33
  }
38
34
  });
39
35
  export {