@aplus-frontend/ui 6.26.1 → 6.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- import { defineComponent as re, useSlots as ae, ref as V, useModel as ne, watch as ie, computed as u, createVNode as d, Fragment as y, createElementBlock as B, openBlock as i, mergeProps as se, createCommentVNode as C, createElementVNode as de, normalizeStyle as I, normalizeClass as g, unref as h, createBlock as p, renderSlot as F, resolveDynamicComponent as v, withCtx as H, mergeModels as ue } from "vue";
2
- import { Spin as ce, Tooltip as fe } from "@aplus-frontend/antdv";
3
- import { QuestionCircleOutlined as pe } from "@ant-design/icons-vue";
1
+ import { defineComponent as ae, useSlots as ne, ref as V, useModel as ie, watch as se, computed as u, createVNode as d, Fragment as y, createElementBlock as C, openBlock as i, mergeProps as de, createCommentVNode as g, createElementVNode as ue, normalizeStyle as I, normalizeClass as h, unref as B, createBlock as f, renderSlot as F, resolveDynamicComponent as b, withCtx as H, mergeModels as ce } from "vue";
2
+ import { Spin as pe, Tooltip as fe } from "@aplus-frontend/antdv";
3
+ import { QuestionCircleOutlined as ye } from "@ant-design/icons-vue";
4
4
  import "../../../config-provider/index.mjs";
5
5
  import { mergeClass as A } from "../../../editable-table/utils.mjs";
6
- import ye from "@aplus-frontend/antdv/es/_util/hooks/useBreakpoint";
6
+ import be from "@aplus-frontend/antdv/es/_util/hooks/useBreakpoint";
7
7
  import { IconApAdFillDown as ve } from "@aplus-frontend/icon";
8
8
  import { useNamespace as xe } from "../../../config-provider/hooks/use-namespace.mjs";
9
- const ke = /* @__PURE__ */ re({
9
+ const Ae = /* @__PURE__ */ ae({
10
10
  name: "ApProCard",
11
11
  __name: "index",
12
- props: /* @__PURE__ */ ue({
12
+ props: /* @__PURE__ */ ce({
13
13
  headStyle: {},
14
14
  bodyStyle: {},
15
15
  actionsStyle: {},
@@ -82,22 +82,22 @@ const ke = /* @__PURE__ */ re({
82
82
  }),
83
83
  emits: ["update:collapsed"],
84
84
  setup(O) {
85
- const t = O, r = ae(), x = V(t.defaultCollapsed), G = ne(O, "collapsed");
86
- ie(() => G.value, (e) => {
87
- e !== void 0 && (x.value = e);
85
+ const t = O, r = ne(), v = V(t.defaultCollapsed), G = ie(O, "collapsed");
86
+ se(() => G.value, (e) => {
87
+ e !== void 0 && (v.value = e);
88
88
  }, {
89
89
  immediate: !0
90
90
  });
91
91
  const Q = () => {
92
- x.value = !x.value;
92
+ v.value = !v.value;
93
93
  }, {
94
94
  b: c
95
- } = xe("pro-card"), m = ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs"], b = ye(), w = (e, o) => e ? o : {}, T = (e) => {
95
+ } = xe("pro-card"), S = ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs"], x = be(), w = (e, o) => e ? o : {}, T = (e) => {
96
96
  const o = [0, 0];
97
97
  return (Array.isArray(e) ? e : [e, 0]).forEach((n, l) => {
98
98
  if (typeof n == "object")
99
- for (let s = 0; s < m.length; s += 1) {
100
- const f = m[s];
99
+ for (let s = 0; s < S.length; s += 1) {
100
+ const p = S[s];
101
101
  if ({
102
102
  lg: !0,
103
103
  md: !0,
@@ -106,9 +106,9 @@ const ke = /* @__PURE__ */ re({
106
106
  xs: !1,
107
107
  xxl: !1,
108
108
  xxxl: !1,
109
- ...b == null ? void 0 : b.value
110
- }[f] && n[f] !== void 0) {
111
- o[l] = n[f];
109
+ ...x == null ? void 0 : x.value
110
+ }[p] && n[p] !== void 0) {
111
+ o[l] = n[p];
112
112
  break;
113
113
  }
114
114
  }
@@ -118,8 +118,8 @@ const ke = /* @__PURE__ */ re({
118
118
  }, q = (e) => {
119
119
  let o = e;
120
120
  if (typeof e == "object")
121
- for (let n = 0; n < m.length; n += 1) {
122
- const l = m[n], s = {
121
+ for (let n = 0; n < S.length; n += 1) {
122
+ const l = S[n], s = {
123
123
  lg: !0,
124
124
  md: !0,
125
125
  sm: !0,
@@ -127,7 +127,7 @@ const ke = /* @__PURE__ */ re({
127
127
  xs: !1,
128
128
  xxl: !1,
129
129
  xxxl: !1,
130
- ...b == null ? void 0 : b.value
130
+ ...x == null ? void 0 : x.value
131
131
  };
132
132
  if (s != null && s[l] && (e == null ? void 0 : e[l]) !== void 0) {
133
133
  o = e[l];
@@ -153,7 +153,7 @@ const ke = /* @__PURE__ */ re({
153
153
  }), W = u(() => {
154
154
  var e;
155
155
  return d(y, null, [t.actions || ((e = r.actions) == null ? void 0 : e.call(r))]);
156
- }), X = u(() => t.loading === !0 ? d(ce, {
156
+ }), X = u(() => t.loading === !0 ? d(pe, {
157
157
  style: {
158
158
  width: "100%",
159
159
  height: "100%",
@@ -161,18 +161,17 @@ const ke = /* @__PURE__ */ re({
161
161
  alignItems: "center",
162
162
  justifyContent: "center"
163
163
  }
164
- }, null) : d(y, null, [t.loading])), $ = u(() => {
164
+ }, null) : d(y, null, [t.loading])), $ = u(() => t.collapsible && G.value === void 0), Y = () => {
165
165
  var e;
166
- if (t.collapsible && G.value === void 0)
167
- return t.collapsibleIconRender ? (e = t.collapsibleIconRender) == null ? void 0 : e.call(t, {
168
- collapsed: x.value
169
- }) : d(y, null, [d(ve, {
170
- class: c("collapsible-icon"),
171
- style: {
172
- transform: x.value ? "rotate(-90deg)" : "rotate(0deg)"
173
- }
174
- }, null)]);
175
- }), P = (e, o = []) => {
166
+ return t.collapsibleIconRender ? (e = t.collapsibleIconRender) == null ? void 0 : e.call(t, {
167
+ collapsed: v.value
168
+ }) : d(y, null, [d(ve, {
169
+ class: c("collapsible-icon"),
170
+ style: {
171
+ transform: v.value ? "rotate(-90deg)" : "rotate(0deg)"
172
+ }
173
+ }, null)]);
174
+ }, P = (e, o = []) => {
176
175
  if ((e == null ? void 0 : e.type) === Symbol.for("v-fgt")) {
177
176
  const a = Array.isArray(e == null ? void 0 : e.children) ? e == null ? void 0 : e.children : [e == null ? void 0 : e.children];
178
177
  if (a != null && a.length)
@@ -181,24 +180,24 @@ const ke = /* @__PURE__ */ re({
181
180
  } else
182
181
  e && o.push(e);
183
182
  return o;
184
- }, Y = () => {
183
+ }, Z = () => {
185
184
  var o, a, n;
186
185
  const e = (o = r.default) == null ? void 0 : o.call(r);
187
186
  return M(!1), d(y, null, [(n = (a = e == null ? void 0 : e.reduce((l, s) => {
188
- const f = P(s);
189
- return [...l, ...f];
190
- }, [])) == null ? void 0 : a.filter((l) => l.type !== Symbol.for("v-cmt"))) == null ? void 0 : n.map((l, s, f) => {
187
+ const p = P(s);
188
+ return [...l, ...p];
189
+ }, [])) == null ? void 0 : a.filter((l) => l.type !== Symbol.for("v-cmt"))) == null ? void 0 : n.map((l, s, p) => {
191
190
  var z, D, R;
192
191
  if (l && typeof l == "object" && "type" in l && ((z = l.type) == null ? void 0 : z.isProCard) === !0) {
193
192
  M(!0);
194
- const te = ((D = l == null ? void 0 : l.props) == null ? void 0 : D.colSpan) || ((R = l == null ? void 0 : l.props) == null ? void 0 : R["col-span"]) || {}, {
195
- span: S,
196
- colSpanStyle: le
197
- } = q(te), k = c("col"), oe = A(`${k}`, [typeof S == "number" && S >= 0 && S <= 24 ? `${k}-span-${S}` : void 0, t.split === "horizontal" && s !== f.length - 1 ? `${k}-split-horizontal` : void 0, t.split === "vertical" && s !== f.length - 1 ? `${k}-split-vertical` : void 0].filter(Boolean)), [j, E] = J.value;
193
+ const le = ((D = l == null ? void 0 : l.props) == null ? void 0 : D.colSpan) || ((R = l == null ? void 0 : l.props) == null ? void 0 : R["col-span"]) || {}, {
194
+ span: m,
195
+ colSpanStyle: oe
196
+ } = q(le), k = c("col"), re = A(`${k}`, [typeof m == "number" && m >= 0 && m <= 24 ? `${k}-span-${m}` : void 0, t.split === "horizontal" && s !== p.length - 1 ? `${k}-split-horizontal` : void 0, t.split === "vertical" && s !== p.length - 1 ? `${k}-split-vertical` : void 0].filter(Boolean)), [j, E] = J.value;
198
197
  return d("div", {
199
- class: oe,
198
+ class: re,
200
199
  style: {
201
- ...le,
200
+ ...oe,
202
201
  ...w(j > 0, {
203
202
  paddingInlineStart: `${j / 2}px`,
204
203
  paddingInlineEnd: `${j / 2}px`
@@ -213,61 +212,63 @@ const ke = /* @__PURE__ */ re({
213
212
  }
214
213
  return l;
215
214
  })]);
216
- }, Z = u(() => {
215
+ }, _ = u(() => {
217
216
  const e = c();
218
- return A(`${e}`, [t.bordered ? `${e}-border` : void 0, t.boxShadow ? `${e}-box-shadow` : void 0, N.value ? `${e}-contain-card` : void 0, t.loading ? `${e}-loading` : void 0, t.split === "vertical" || t.split === "horizontal" ? `${e}-split` : void 0, t.ghost ? `${e}-ghost` : void 0, t.hoverable ? `${e}-hoverable` : void 0, t.type ? `${e}-type-${t.type}` : void 0, x.value ? `${e}-collapsed` : void 0].filter(Boolean));
219
- }), _ = u(() => {
217
+ return A(`${e}`, [t.bordered ? `${e}-border` : void 0, t.boxShadow ? `${e}-box-shadow` : void 0, N.value ? `${e}-contain-card` : void 0, t.loading ? `${e}-loading` : void 0, t.split === "vertical" || t.split === "horizontal" ? `${e}-split` : void 0, t.ghost ? `${e}-ghost` : void 0, t.hoverable ? `${e}-hoverable` : void 0, t.type ? `${e}-type-${t.type}` : void 0, v.value ? `${e}-collapsed` : void 0].filter(Boolean));
218
+ }), ee = u(() => {
220
219
  const e = c("header");
221
220
  return A(`${e}`, [t.headerBordered || t.type === "inner" ? `${e}-border` : void 0, $.value ? `${e}-collapsible` : void 0].filter(Boolean));
222
- }), ee = u(() => {
221
+ }), te = u(() => {
223
222
  const e = c("body");
224
223
  return A(`${e}`, [t.layout === "center" ? `${e}-center` : void 0, t.split === "horizontal" || t.direction === "column" ? `${e}-direction-column` : void 0, t.wrap && N.value ? `${e}-wrap` : void 0].filter(Boolean));
225
224
  });
226
- return (e, o) => (i(), B("div", se({
227
- class: Z.value
225
+ return (e, o) => (i(), C("div", de({
226
+ class: _.value
228
227
  }, {
229
228
  ...e.$attrs
230
- }), [t.title || r.title || t.extra || r.extra || $.value ? (i(), B("div", {
229
+ }), [t.title || r.title || t.extra || r.extra || $.value ? (i(), C("div", {
231
230
  key: 0,
232
- class: g(_.value),
231
+ class: h(ee.value),
233
232
  style: I({
234
233
  ...t.headStyle
235
234
  }),
236
235
  onClick: o[0] || (o[0] = () => {
237
236
  $.value && Q();
238
237
  })
239
- }, [t.title || r.title || $.value ? (i(), B("div", {
238
+ }, [t.title || r.title || $.value ? (i(), C("div", {
240
239
  key: 0,
241
- class: g(h(c)("header-title"))
242
- }, [(i(), p(v($.value))), F(e.$slots, "title", {}, () => [(i(), p(v(K.value)))]), t.tooltip ? (i(), p(h(fe), {
240
+ class: h(B(c)("header-title"))
241
+ }, [$.value ? (i(), f(b(Y()), {
243
242
  key: 0
243
+ })) : g("", !0), F(e.$slots, "title", {}, () => [(i(), f(b(K.value)))]), t.tooltip ? (i(), f(B(fe), {
244
+ key: 1
244
245
  }, {
245
- title: H(() => [(i(), p(v(L.value)))]),
246
- default: H(() => [d(h(pe), {
247
- class: g(h(c)("header-title-tooltip"))
246
+ title: H(() => [(i(), f(b(L.value)))]),
247
+ default: H(() => [d(B(ye), {
248
+ class: h(B(c)("header-title-tooltip"))
248
249
  }, null, 8, ["class"])]),
249
250
  _: 1
250
- })) : C("", !0)], 2)) : C("", !0), t.extra || r.extra ? (i(), B("div", {
251
+ })) : g("", !0)], 2)) : g("", !0), t.extra || r.extra ? (i(), C("div", {
251
252
  key: 1,
252
- class: g(h(c)("header-extra"))
253
- }, [F(e.$slots, "extra", {}, () => [(i(), p(v(U.value)))])], 2)) : C("", !0)], 6)) : C("", !0), de("div", {
254
- class: g(ee.value),
253
+ class: h(B(c)("header-extra"))
254
+ }, [F(e.$slots, "extra", {}, () => [(i(), f(b(U.value)))])], 2)) : g("", !0)], 6)) : g("", !0), ue("div", {
255
+ class: h(te.value),
255
256
  style: I({
256
257
  ...t.bodyStyle
257
258
  })
258
- }, [t.loading ? (i(), p(v(X.value), {
259
+ }, [t.loading ? (i(), f(b(X.value), {
259
260
  key: 0
260
- })) : (i(), p(v(Y()), {
261
+ })) : (i(), f(b(Z()), {
261
262
  key: 1
262
- }))], 6), t.actions || r.actions ? (i(), B("div", {
263
+ }))], 6), t.actions || r.actions ? (i(), C("div", {
263
264
  key: 1,
264
- class: g(h(c)("actions")),
265
+ class: h(B(c)("actions")),
265
266
  style: I({
266
267
  ...t.actionsStyle
267
268
  })
268
- }, [(i(), p(v(W.value)))], 6)) : C("", !0)], 16));
269
+ }, [(i(), f(b(W.value)))], 6)) : g("", !0)], 16));
269
270
  }
270
271
  });
271
272
  export {
272
- ke as default
273
+ Ae as default
273
274
  };
@@ -25,7 +25,9 @@ declare function __VLS_template(): {
25
25
  rootEl: HTMLDivElement;
26
26
  };
27
27
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
28
- declare const __VLS_component: DefineComponent<ApStatisticCardProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApStatisticCardProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
28
+ declare const __VLS_component: DefineComponent<ApStatisticCardProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApStatisticCardProps> & Readonly<{}>, {
29
+ collapsed: boolean;
30
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
29
31
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
30
32
  export default _default;
31
33
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,12 +1,12 @@
1
- import { defineComponent as w, useSlots as V, computed as o, createVNode as n, mergeProps as x, createBlock as d, openBlock as f, createSlots as z, withCtx as O, createCommentVNode as N, renderSlot as _, resolveDynamicComponent as $, renderList as F, unref as I } from "vue";
1
+ import { defineComponent as w, useSlots as V, computed as o, createVNode as n, mergeProps as x, createBlock as d, openBlock as f, createSlots as z, withCtx as O, createCommentVNode as N, renderSlot as _, resolveDynamicComponent as $, renderList as I, unref as L } from "vue";
2
2
  import "../../../config-provider/index.mjs";
3
3
  import "../card/index.vue.mjs";
4
4
  import "../statistic/index.vue.mjs";
5
5
  import { mergeClass as A } from "../../../editable-table/utils.mjs";
6
- import { omit as L } from "lodash-unified";
7
- import { useNamespace as R } from "../../../config-provider/hooks/use-namespace.mjs";
8
- import T from "../statistic/index.vue2.mjs";
9
- import q from "../card/index.vue2.mjs";
6
+ import { omit as R } from "lodash-unified";
7
+ import { useNamespace as T } from "../../../config-provider/hooks/use-namespace.mjs";
8
+ import q from "../statistic/index.vue2.mjs";
9
+ import E from "../card/index.vue2.mjs";
10
10
  const Y = /* @__PURE__ */ w({
11
11
  name: "ApStatisticCard",
12
12
  __name: "index",
@@ -58,11 +58,10 @@ const Y = /* @__PURE__ */ w({
58
58
  type: Boolean
59
59
  },
60
60
  collapsed: {
61
- type: Boolean
62
- },
63
- collapsibleIconRender: {
64
- type: Function
61
+ type: Boolean,
62
+ default: void 0
65
63
  },
64
+ collapsibleIconRender: {},
66
65
  boxShadow: {
67
66
  type: Boolean
68
67
  },
@@ -78,7 +77,7 @@ const Y = /* @__PURE__ */ w({
78
77
  setup(j) {
79
78
  const t = j, e = V(), {
80
79
  b: i
81
- } = R("statistic-card"), P = o(() => i()), D = o(() => {
80
+ } = T("statistic-card"), P = o(() => i()), D = o(() => {
82
81
  const r = i("chart");
83
82
  return A(`${r}`, [t.chartPlacement === "left" ? `${r}-left` : void 0, t.chartPlacement === "right" ? `${r}-right` : void 0].filter(Boolean));
84
83
  }), m = o(() => {
@@ -86,7 +85,7 @@ const Y = /* @__PURE__ */ w({
86
85
  return A(`${r}`, [t.chartPlacement === "left" || t.chartPlacement === "right" ? `${r}-horizontal` : void 0].filter(Boolean));
87
86
  }), k = o(() => i("footer")), l = o(() => {
88
87
  var r, s, p, a, y, h, v, b, B, S, g, C;
89
- return t.statistic ? n(T, x({
88
+ return t.statistic ? n(q, x({
90
89
  layout: "vertical"
91
90
  }, t.statistic, {
92
91
  title: ((r = t.statistic) == null ? void 0 : r.title) || ((s = e.statisticTitle) == null ? void 0 : s.call(e)),
@@ -111,7 +110,7 @@ const Y = /* @__PURE__ */ w({
111
110
  class: k.value
112
111
  }, [t.footer || ((r = e.footer) == null ? void 0 : r.call(e))]) : void 0;
113
112
  });
114
- return (r, s) => (f(), d(q, x({
113
+ return (r, s) => (f(), d(E, x({
115
114
  class: P.value
116
115
  }, {
117
116
  ...t
@@ -122,7 +121,7 @@ const Y = /* @__PURE__ */ w({
122
121
  key: 1
123
122
  })) : N("", !0)]),
124
123
  _: 2
125
- }, [F(I(L)(e, ["chart", "footer", "description", "default"]), (p, a) => ({
124
+ }, [I(L(R)(e, ["chart", "footer", "description", "default"]), (p, a) => ({
126
125
  name: a,
127
126
  fn: O(() => [_(r.$slots, a)])
128
127
  }))]), 1040, ["class"]));
@@ -1,44 +1,44 @@
1
- import { defineComponent as te, ref as T, computed as H, useTemplateRef as ne, watch as ae, toRaw as le, onMounted as se, onUnmounted as ie, createBlock as ue, openBlock as M, unref as G, withCtx as de, createElementVNode as ce, normalizeStyle as q, normalizeClass as z, createElementBlock as U, Fragment as ge, renderList as fe, renderSlot as pe } from "vue";
2
- import { ApDraggableGridProps as me } from "./constans.mjs";
3
- import { Spin as we } from "@aplus-frontend/antdv";
1
+ import { defineComponent as ae, ref as T, computed as G, useTemplateRef as ne, watch as le, toRaw as se, onMounted as ie, onUnmounted as ue, createBlock as ce, openBlock as F, unref as L, withCtx as de, createElementVNode as ge, normalizeStyle as z, normalizeClass as U, createElementBlock as V, Fragment as fe, renderList as me, renderSlot as pe } from "vue";
2
+ import { ApDraggableGridProps as we } from "./constans.mjs";
3
+ import { Spin as ve } from "@aplus-frontend/antdv";
4
4
  import "../../config-provider/index.mjs";
5
5
  import { sortItemsByRowAndCol as D } from "./utils/sortItemsByRowAndCol.mjs";
6
6
  import { useNamespace as he } from "../../config-provider/hooks/use-namespace.mjs";
7
- const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "data-module", "draggable"], Ee = /* @__PURE__ */ te({
7
+ const ye = ["data-span", "data-index", "data-row", "data-col", "data-height", "data-module", "draggable"], Te = /* @__PURE__ */ ae({
8
8
  __name: "ApDraggableGrid",
9
- props: me(),
9
+ props: we(),
10
10
  emits: ["onGridListChange"],
11
- setup(V, { expose: j, emit: K }) {
12
- const g = V, { b: F, e: L, m: Q } = he("ap-draggable-grid"), C = T(!1), R = T(!1), O = H(() => L("item")), P = H(() => L("dragging")), X = H(() => g.customWrapper ? `.${g.customWrapper} .${O.value}:not(.${P.value})` : `.${O.value}:not(.${P.value})`), Y = K, f = ne("gridContainer"), I = T([]);
13
- ae(
14
- () => g.gridList,
11
+ setup(j, { expose: K, emit: Q }) {
12
+ const c = j, { b: R, e: A, m: X } = he("ap-draggable-grid"), C = T(!1), O = T(!1), P = G(() => A("item")), W = G(() => A("dragging")), x = G(() => A("overlay")), Y = G(() => c.customWrapper ? `.${c.customWrapper} .${P.value}:not(.${W.value})` : `.${P.value}:not(.${W.value})`), Z = Q, f = ne("gridContainer"), E = T([]);
13
+ le(
14
+ () => c.gridList,
15
15
  (e) => {
16
- Array.isArray(e) && s(e);
16
+ Array.isArray(e) && i(e);
17
17
  },
18
18
  { deep: !0, immediate: !0 }
19
19
  );
20
- function s(e) {
21
- const t = [...e].sort((o, i) => o.row - i.row);
22
- I.value = t.map((o) => ({
20
+ function i(e) {
21
+ const t = [...e].sort((o, u) => o.row - u.row);
22
+ E.value = t.map((o) => ({
23
23
  ...o
24
- })), Y(
24
+ })), Z(
25
25
  "onGridListChange",
26
- JSON.parse(JSON.stringify(I.value))
26
+ JSON.parse(JSON.stringify(E.value))
27
27
  );
28
28
  }
29
- const Z = (e) => ({
29
+ const ee = (e) => ({
30
30
  gridColumn: `${e.col} / span ${e.span}`,
31
31
  gridRow: e.row,
32
- minHeight: e.showHeight ? e.showHeight + "px" : `${g.gridItemHeight}px`,
33
- height: e.showHeight ? e.showHeight + "px" : `${g.gridItemHeight}px`,
34
- boxShadow: g.gridItemShadow ? g.gridItemShadow : "none"
32
+ minHeight: e.showHeight ? e.showHeight + "px" : `${c.gridItemHeight}px`,
33
+ height: e.showHeight ? e.showHeight + "px" : `${c.gridItemHeight}px`,
34
+ boxShadow: c.gridItemShadow ? c.gridItemShadow : "none"
35
35
  });
36
36
  async function k() {
37
- if (s([]), typeof g.request == "function")
37
+ if (i([]), typeof c.request == "function")
38
38
  try {
39
39
  C.value = !0;
40
- const e = await g.request();
41
- Array.isArray(e) ? (console.log("ApDraggableGrid: 请求到的布局数据:", e), s(e)) : console.warn(
40
+ const e = await c.request();
41
+ Array.isArray(e) ? (console.log("ApDraggableGrid: 请求到的布局数据:", e), i(e)) : console.warn(
42
42
  "ApDraggableGrid: 请求函数必须返回一个符合 ApDraggableGridItemBase 数组的格式"
43
43
  );
44
44
  } catch (e) {
@@ -47,11 +47,11 @@ const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "d
47
47
  C.value = !1;
48
48
  }
49
49
  }
50
- let N = T(null), S = T(null), w = null, A = !1, v = null;
51
- const W = (e) => {
52
- if (!A && (A = !0, e.dataTransfer && e.target instanceof HTMLElement)) {
50
+ let $ = T(null), N = T(null), w = null, H = !1, h = null;
51
+ const J = (e) => {
52
+ if (!H && (H = !0, e.dataTransfer && e.target instanceof HTMLElement)) {
53
53
  const t = e.target.dataset;
54
- e.dataTransfer.setData("text/plain", t.module), e.dataTransfer.effectAllowed = "move", N.value = {
54
+ e.dataTransfer.setData("text/plain", t.module), e.dataTransfer.effectAllowed = "move", $.value = {
55
55
  span: Number(t.span),
56
56
  col: Number(t.col),
57
57
  row: Number(t.row),
@@ -60,16 +60,20 @@ const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "d
60
60
  index: Number(t.index)
61
61
  }, w = e.target, w.style.opacity = "0";
62
62
  }
63
- }, J = (e) => {
64
- if (e.preventDefault(), v && clearTimeout(v), v = window.setTimeout(() => {
65
- A = !1, v = null;
63
+ }, q = (e) => {
64
+ if (e.preventDefault(), h && clearTimeout(h), h = window.setTimeout(() => {
65
+ H = !1, h = null;
66
66
  }, 300), e.dataTransfer && e.target instanceof HTMLElement) {
67
67
  const t = e.target.closest(
68
- X.value
68
+ Y.value
69
69
  );
70
70
  if (!t) return;
71
71
  const o = t.dataset;
72
- S.value = {
72
+ document.querySelectorAll(
73
+ `.${c.customWrapper} div[data-row="${o.row}"]`
74
+ ).forEach((s) => {
75
+ s.classList.add(x.value);
76
+ }), N.value = {
73
77
  span: Number(o.span),
74
78
  col: Number(o.col),
75
79
  row: Number(o.row),
@@ -79,110 +83,112 @@ const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "d
79
83
  };
80
84
  }
81
85
  }, B = (e) => {
82
- e.preventDefault(), w && (w.style.opacity = "1", w = null), ee(N, S) && oe(N, S), N.value = null, S.value = null, R.value = !1;
86
+ e.preventDefault(), w && (w.style.opacity = "1", w = null), oe($, N) && re($, N), document.querySelectorAll(`.${x.value}`).forEach((t) => {
87
+ t.classList.remove(x.value);
88
+ }), $.value = null, N.value = null, O.value = !1;
83
89
  }, _ = () => {
84
- w && (w.style.opacity = "1", w = null), N.value = null, S.value = null, R.value = !1;
85
- }, ee = (e, t) => {
86
- const { span: o, module: i } = e.value, { span: u, module: d } = t.value;
87
- return i === d && o === u ? (console.log("如果自己放在自己之上不能交换数据"), !1) : !0;
90
+ w && (w.style.opacity = "1", w = null), $.value = null, N.value = null, O.value = !1;
88
91
  }, oe = (e, t) => {
92
+ const { span: o, module: u } = e.value, { span: s, module: d } = t.value;
93
+ return u === d && o === s ? (console.log("如果自己放在自己之上不能交换数据"), !1) : !0;
94
+ }, re = (e, t) => {
89
95
  if (!e.value || !t.value) return;
90
96
  const {
91
97
  span: o,
92
- col: i,
93
- row: u,
98
+ col: u,
99
+ row: s,
94
100
  module: d,
95
- height: $,
96
- index: a
101
+ height: S,
102
+ index: n
97
103
  } = e.value, {
98
104
  span: b,
99
- col: h,
100
- row: p,
101
- module: re,
102
- height: x,
103
- index: c
105
+ col: v,
106
+ row: m,
107
+ module: te,
108
+ height: M,
109
+ index: g
104
110
  } = t.value;
105
- if (u === p && i === h && o === b && $ === x && d === re) {
111
+ if (s === m && u === v && o === b && S === M && d === te) {
106
112
  console.log("从同一位置拖拽到同一位置,不做任何操作");
107
113
  return;
108
114
  }
109
- let r = [...le(I.value)];
110
- const E = JSON.parse(JSON.stringify(r));
111
- if (u === p)
112
- if (a > c) {
113
- console.log("", "从右向左拖拽"), console.log(a, c), console.log(a - c), a - c === 1 ? (r[c].col = o + h, r[a].col = h) : (r.forEach((m, n) => {
114
- n < a && n >= c && (m.col += b);
115
- }), r[a].col = h);
115
+ let r = [...se(E.value)];
116
+ const I = JSON.parse(JSON.stringify(r));
117
+ if (s === m)
118
+ if (n > g) {
119
+ console.log("", "从右向左拖拽"), console.log(n, g), console.log(n - g), n - g === 1 ? (r[g].col = o + v, r[n].col = v) : (r.forEach((p, a) => {
120
+ a < n && a >= g && (p.col += b);
121
+ }), r[n].col = v);
116
122
  const l = D(r);
117
123
  if (!y(l)) {
118
124
  console.warn("交换后的布局无效,恢复原始布局");
119
125
  return;
120
126
  }
121
- s(l);
127
+ i(l);
122
128
  return;
123
129
  } else {
124
- console.log(a, c), console.log("", "从左向右拖拽"), c - a === 1 ? (r[a].col = b + 1, r[c].col = i) : (r.forEach((m, n) => {
125
- n > a && n <= c && (m.col -= b);
126
- }), r[a].col = h);
130
+ console.log(n, g), console.log("", "从左向右拖拽"), g - n === 1 ? (r[n].col = b + 1, r[g].col = u) : (r.forEach((p, a) => {
131
+ a > n && a <= g && (p.col -= b);
132
+ }), r[n].col = v);
127
133
  const l = D(r);
128
134
  if (console.log("交换后的布局:", l), !y(l)) {
129
- console.warn("交换后的布局无效,恢复原始布局"), s(E);
135
+ console.warn("交换后的布局无效,恢复原始布局"), i(I);
130
136
  return;
131
137
  }
132
- s(l);
138
+ i(l);
133
139
  return;
134
140
  }
135
- else if (p < u) {
141
+ else if (m < s) {
136
142
  if (console.log("从下向上拖拽"), o === 24) {
137
143
  const l = [];
138
- for (let n = p; n < u; n++)
139
- l.push(n);
140
- r.forEach((n) => {
141
- l.includes(n.row) && (n.row += 1);
142
- }), r[a].row = p;
143
- const m = D(r);
144
- if (!y(m)) {
145
- console.warn("交换后的布局无效,恢复原始布局"), s(E);
144
+ for (let a = m; a < s; a++)
145
+ l.push(a);
146
+ r.forEach((a) => {
147
+ l.includes(a.row) && (a.row += 1);
148
+ }), r[n].row = m;
149
+ const p = D(r);
150
+ if (!y(p)) {
151
+ console.warn("交换后的布局无效,恢复原始布局"), i(I);
146
152
  return;
147
153
  }
148
- s(m);
154
+ i(p);
149
155
  return;
150
156
  }
151
- if (o === b && $ === x) {
152
- r[a].row = p, r[a].col = h, r[c].row = u, r[c].col = i;
157
+ if (o === b && S === M) {
158
+ r[n].row = m, r[n].col = v, r[g].row = s, r[g].col = u;
153
159
  const l = D(r);
154
160
  if (!y(l)) {
155
- console.warn("交换后的布局无效,恢复原始布局"), s(E);
161
+ console.warn("交换后的布局无效,恢复原始布局"), i(I);
156
162
  return;
157
163
  }
158
- s(l);
164
+ i(l);
159
165
  return;
160
166
  }
161
167
  } else {
162
168
  if (console.log("从上向下拖拽"), o === 24) {
163
169
  console.log("如果拖拽元素跨度为24", "从上向下拖拽");
164
170
  const l = [];
165
- for (let n = u + 1; n <= p; n++)
166
- l.push(n);
167
- r.forEach((n) => {
168
- l.includes(n.row) && (n.row -= 1);
169
- }), r[a].row = p;
170
- const m = D(r);
171
- if (!y(m)) {
172
- console.warn("交换后的布局无效,恢复原始布局"), s(E);
171
+ for (let a = s + 1; a <= m; a++)
172
+ l.push(a);
173
+ r.forEach((a) => {
174
+ l.includes(a.row) && (a.row -= 1);
175
+ }), r[n].row = m;
176
+ const p = D(r);
177
+ if (!y(p)) {
178
+ console.warn("交换后的布局无效,恢复原始布局"), i(I);
173
179
  return;
174
180
  }
175
- s(m);
181
+ i(p);
176
182
  return;
177
183
  }
178
- if (o === b && $ === x) {
179
- r[a].row = p, r[a].col = h, r[c].row = u, r[c].col = i;
184
+ if (o === b && S === M) {
185
+ r[n].row = m, r[n].col = v, r[g].row = s, r[g].col = u;
180
186
  const l = D(r);
181
187
  if (!y(l)) {
182
- console.warn("交换后的布局无效,恢复原始布局"), s(E);
188
+ console.warn("交换后的布局无效,恢复原始布局"), i(I);
183
189
  return;
184
190
  }
185
- s(l);
191
+ i(l);
186
192
  return;
187
193
  }
188
194
  }
@@ -192,14 +198,14 @@ const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "d
192
198
  t[o.row] || (t[o.row] = []), t[o.row].push(o);
193
199
  });
194
200
  for (const o in t) {
195
- const i = t[o].sort((d, $) => d.col - $.col);
196
- let u = 1;
197
- for (const d of i) {
198
- if (d.col < u)
201
+ const u = t[o].sort((d, S) => d.col - S.col);
202
+ let s = 1;
203
+ for (const d of u) {
204
+ if (d.col < s)
199
205
  return console.warn(
200
- `行 ${o} 中的元素重叠: 元素 ${d.module} 在列 ${d.col}, 但当前列已经是 ${u}`
206
+ `行 ${o} 中的元素重叠: 元素 ${d.module} 在列 ${d.col}, 但当前列已经是 ${s}`
201
207
  ), !1;
202
- if (u = d.col + d.span, u > 25)
208
+ if (s = d.col + d.span, s > 25)
203
209
  return console.warn(
204
210
  `行 ${o} 中的元素超出界限: 元素 ${d.module} 在列 ${d.col} 跨度 ${d.span}`
205
211
  ), !1;
@@ -207,48 +213,48 @@ const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "d
207
213
  }
208
214
  return !0;
209
215
  };
210
- return se(async () => {
211
- await k(), !g.disableDrag && f.value && (f.value.addEventListener("dragstart", W), f.value.addEventListener("dragover", J), f.value.addEventListener("drop", B), f.value.addEventListener("dragend", _));
212
- }), ie(() => {
213
- f.value && (f.value.removeEventListener("dragstart", W), f.value.removeEventListener("dragover", J), f.value.removeEventListener("drop", B), f.value.removeEventListener("dragend", _), v && clearTimeout(v));
214
- }), j({
216
+ return ie(async () => {
217
+ await k(), !c.disableDrag && f.value && (f.value.addEventListener("dragstart", J), f.value.addEventListener("dragover", q), f.value.addEventListener("drop", B), f.value.addEventListener("dragend", _));
218
+ }), ue(() => {
219
+ f.value && (f.value.removeEventListener("dragstart", J), f.value.removeEventListener("dragover", q), f.value.removeEventListener("drop", B), f.value.removeEventListener("dragend", _), h && clearTimeout(h));
220
+ }), K({
215
221
  setGridItems: (e) => {
216
- s(e);
222
+ i(e);
217
223
  },
218
- getGridItems: () => JSON.parse(JSON.stringify(I.value)),
224
+ getGridItems: () => JSON.parse(JSON.stringify(E.value)),
219
225
  refreshGrid: () => {
220
226
  (async () => {
221
227
  await k();
222
228
  })();
223
229
  }
224
- }), (e, t) => (M(), ue(G(we), { spinning: C.value }, {
230
+ }), (e, t) => (F(), ce(L(ve), { spinning: C.value }, {
225
231
  default: de(() => [
226
- ce("div", {
232
+ ge("div", {
227
233
  ref_key: "gridContainer",
228
234
  ref: f,
229
- class: z([C.value ? G(F)("loading") : G(F)(), g.customWrapper]),
230
- style: q({
235
+ class: U([C.value ? L(R)("loading") : L(R)(), c.customWrapper]),
236
+ style: z({
231
237
  width: typeof e.gridWidth == "number" ? `${e.gridWidth}px` : e.gridWidth,
232
238
  gap: `${e.gapWidth}px`
233
239
  })
234
240
  }, [
235
- (M(!0), U(ge, null, fe(I.value, (o, i) => (M(), U("div", {
236
- key: i,
237
- class: z([G(L)("item"), g.disableDrag ? "" : G(Q)("canDrag")]),
241
+ (F(!0), V(fe, null, me(E.value, (o, u) => (F(), V("div", {
242
+ key: u,
243
+ class: U([L(A)("item"), c.disableDrag ? "" : L(X)("canDrag")]),
238
244
  "data-span": o.span,
239
- "data-index": i,
245
+ "data-index": u,
240
246
  "data-row": o.row,
241
247
  "data-col": o.col,
242
248
  "data-height": o.height,
243
249
  "data-module": o.module,
244
- style: q([Z(o)]),
245
- draggable: !g.disableDrag
250
+ style: z([ee(o)]),
251
+ draggable: !c.disableDrag
246
252
  }, [
247
253
  pe(e.$slots, "item", {
248
254
  item: o,
249
- index: i
255
+ index: u
250
256
  })
251
- ], 14, ve))), 128))
257
+ ], 14, ye))), 128))
252
258
  ], 6)
253
259
  ]),
254
260
  _: 3
@@ -256,5 +262,5 @@ const ve = ["data-span", "data-index", "data-row", "data-col", "data-height", "d
256
262
  }
257
263
  });
258
264
  export {
259
- Ee as default
265
+ Te as default
260
266
  };
@@ -1,2 +1,2 @@
1
- declare const _default: "6.26.1";
1
+ declare const _default: "6.26.2";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "6.26.1";
1
+ const e = "6.26.2";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w=require("@aplus-frontend/antdv"),J=require("@ant-design/icons-vue");require("../../../config-provider/index.js");const g=require("../../../editable-table/utils.js"),K=require("@aplus-frontend/antdv/es/_util/hooks/useBreakpoint"),L=require("@aplus-frontend/icon"),U=require("../../../config-provider/hooks/use-namespace.js"),W=e.defineComponent({name:"ApProCard",__name:"index",props:e.mergeModels({headStyle:{},bodyStyle:{},actionsStyle:{},headerBordered:{type:Boolean,default:!1},title:{type:[Object,String,Number,Boolean,null,Array]},tooltip:{type:[Object,String,Number,Boolean,null,Array]},extra:{type:[Object,String,Number,Boolean,null,Array]},layout:{},type:{},direction:{},wrap:{type:Boolean,default:!1},loading:{type:[Boolean,Object,String,Number,null,Array]},colSpan:{},colStyle:{},gutter:{default:0},actions:{type:[Object,String,Number,Boolean,null,Array]},split:{},bordered:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},defaultCollapsed:{type:Boolean,default:!1},collapsed:{type:Boolean},collapsibleIconRender:{},boxShadow:{type:Boolean,default:!1}},{collapsed:{type:Boolean,default:void 0},collapsedModifiers:{}}),emits:["update:collapsed"],setup(h){const o=h,n=e.useSlots(),u=e.ref(o.defaultCollapsed),S=e.useModel(h,"collapsed");e.watch(()=>S.value,t=>{t!==void 0&&(u.value=t)},{immediate:!0});const A=()=>{u.value=!u.value},{b:c}=U.useNamespace("pro-card"),y=["xxxl","xxl","xl","lg","md","sm","xs"],p=K(),B=(t,r)=>t?r:{},E=t=>{const r=[0,0];return(Array.isArray(t)?t:[t,0]).forEach((s,l)=>{if(typeof s=="object")for(let i=0;i<y.length;i+=1){const d=y[i];if({lg:!0,md:!0,sm:!0,xl:!1,xs:!1,xxl:!1,xxxl:!1,...p==null?void 0:p.value}[d]&&s[d]!==void 0){r[l]=s[d];break}}else r[l]=s||0}),r},j=t=>{let r=t;if(typeof t=="object")for(let s=0;s<y.length;s+=1){const l=y[s],i={lg:!0,md:!0,sm:!0,xl:!1,xs:!1,xxl:!1,xxxl:!1,...p==null?void 0:p.value};if(i!=null&&i[l]&&(t==null?void 0:t[l])!==void 0){r=t[l];break}}const a=B(typeof r=="string"&&/\d%|\dpx/i.test(r),{width:r,flexShrink:0});return{span:r,colSpanStyle:a}},D=e.computed(()=>E(o.gutter)),C=e.ref(!1),$=t=>{C.value=t},q=e.computed(()=>{var t;return e.createVNode(e.Fragment,null,[o.title||((t=n.title)==null?void 0:t.call(n))])}),F=e.computed(()=>e.createVNode(e.Fragment,null,[o.tooltip])),I=e.computed(()=>{var t;return e.createVNode(e.Fragment,null,[o.extra||((t=n.extra)==null?void 0:t.call(n))])}),O=e.computed(()=>{var t;return e.createVNode(e.Fragment,null,[o.actions||((t=n.actions)==null?void 0:t.call(n))])}),M=e.computed(()=>o.loading===!0?e.createVNode(w.Spin,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},null):e.createVNode(e.Fragment,null,[o.loading])),f=e.computed(()=>{var t;if(o.collapsible&&S.value===void 0)return o.collapsibleIconRender?(t=o.collapsibleIconRender)==null?void 0:t.call(o,{collapsed:u.value}):e.createVNode(e.Fragment,null,[e.createVNode(L.IconApAdFillDown,{class:c("collapsible-icon"),style:{transform:u.value?"rotate(-90deg)":"rotate(0deg)"}},null)])}),N=(t,r=[])=>{if((t==null?void 0:t.type)===Symbol.for("v-fgt")){const a=Array.isArray(t==null?void 0:t.children)?t==null?void 0:t.children:[t==null?void 0:t.children];if(a!=null&&a.length)for(let s=0;s<a.length;s++)a!=null&&a[s]&&N(a==null?void 0:a[s],r)}else t&&r.push(t);return r},P=()=>{var r,a,s;const t=(r=n.default)==null?void 0:r.call(n);return $(!1),e.createVNode(e.Fragment,null,[(s=(a=t==null?void 0:t.reduce((l,i)=>{const d=N(i);return[...l,...d]},[]))==null?void 0:a.filter(l=>l.type!==Symbol.for("v-cmt")))==null?void 0:s.map((l,i,d)=>{var b,z,V;if(l&&typeof l=="object"&&"type"in l&&((b=l.type)==null?void 0:b.isProCard)===!0){$(!0);const _=((z=l==null?void 0:l.props)==null?void 0:z.colSpan)||((V=l==null?void 0:l.props)==null?void 0:V["col-span"])||{},{span:m,colSpanStyle:H}=j(_),v=c("col"),Q=g.mergeClass(`${v}`,[typeof m=="number"&&m>=0&&m<=24?`${v}-span-${m}`:void 0,o.split==="horizontal"&&i!==d.length-1?`${v}-split-horizontal`:void 0,o.split==="vertical"&&i!==d.length-1?`${v}-split-vertical`:void 0].filter(Boolean)),[x,k]=D.value;return e.createVNode("div",{class:Q,style:{...H,...B(x>0,{paddingInlineStart:`${x/2}px`,paddingInlineEnd:`${x/2}px`}),...B(k>0,{paddingBlockStart:`${k/2}px`,paddingBlockEnd:`${k/2}px`}),...o.colStyle}},[l])}return l})])},G=e.computed(()=>{const t=c();return g.mergeClass(`${t}`,[o.bordered?`${t}-border`:void 0,o.boxShadow?`${t}-box-shadow`:void 0,C.value?`${t}-contain-card`:void 0,o.loading?`${t}-loading`:void 0,o.split==="vertical"||o.split==="horizontal"?`${t}-split`:void 0,o.ghost?`${t}-ghost`:void 0,o.hoverable?`${t}-hoverable`:void 0,o.type?`${t}-type-${o.type}`:void 0,u.value?`${t}-collapsed`:void 0].filter(Boolean))}),R=e.computed(()=>{const t=c("header");return g.mergeClass(`${t}`,[o.headerBordered||o.type==="inner"?`${t}-border`:void 0,f.value?`${t}-collapsible`:void 0].filter(Boolean))}),T=e.computed(()=>{const t=c("body");return g.mergeClass(`${t}`,[o.layout==="center"?`${t}-center`:void 0,o.split==="horizontal"||o.direction==="column"?`${t}-direction-column`:void 0,o.wrap&&C.value?`${t}-wrap`:void 0].filter(Boolean))});return(t,r)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:G.value},{...t.$attrs}),[o.title||n.title||o.extra||n.extra||f.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(R.value),style:e.normalizeStyle({...o.headStyle}),onClick:r[0]||(r[0]=()=>{f.value&&A()})},[o.title||n.title||f.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(c)("header-title"))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.value))),e.renderSlot(t.$slots,"title",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(q.value)))]),o.tooltip?(e.openBlock(),e.createBlock(e.unref(w.Tooltip),{key:0},{title:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(F.value)))]),default:e.withCtx(()=>[e.createVNode(e.unref(J.QuestionCircleOutlined),{class:e.normalizeClass(e.unref(c)("header-title-tooltip"))},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),o.extra||n.extra?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(c)("header-extra"))},[e.renderSlot(t.$slots,"extra",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(I.value)))])],2)):e.createCommentVNode("",!0)],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(T.value),style:e.normalizeStyle({...o.bodyStyle})},[o.loading?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(M.value),{key:0})):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P()),{key:1}))],6),o.actions||n.actions?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(c)("actions")),style:e.normalizeStyle({...o.actionsStyle})},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(O.value)))],6)):e.createCommentVNode("",!0)],16))}});exports.default=W;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w=require("@aplus-frontend/antdv"),K=require("@ant-design/icons-vue");require("../../../config-provider/index.js");const g=require("../../../editable-table/utils.js"),L=require("@aplus-frontend/antdv/es/_util/hooks/useBreakpoint"),U=require("@aplus-frontend/icon"),W=require("../../../config-provider/hooks/use-namespace.js"),X=e.defineComponent({name:"ApProCard",__name:"index",props:e.mergeModels({headStyle:{},bodyStyle:{},actionsStyle:{},headerBordered:{type:Boolean,default:!1},title:{type:[Object,String,Number,Boolean,null,Array]},tooltip:{type:[Object,String,Number,Boolean,null,Array]},extra:{type:[Object,String,Number,Boolean,null,Array]},layout:{},type:{},direction:{},wrap:{type:Boolean,default:!1},loading:{type:[Boolean,Object,String,Number,null,Array]},colSpan:{},colStyle:{},gutter:{default:0},actions:{type:[Object,String,Number,Boolean,null,Array]},split:{},bordered:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},defaultCollapsed:{type:Boolean,default:!1},collapsed:{type:Boolean},collapsibleIconRender:{},boxShadow:{type:Boolean,default:!1}},{collapsed:{type:Boolean,default:void 0},collapsedModifiers:{}}),emits:["update:collapsed"],setup(h){const o=h,n=e.useSlots(),u=e.ref(o.defaultCollapsed),S=e.useModel(h,"collapsed");e.watch(()=>S.value,t=>{t!==void 0&&(u.value=t)},{immediate:!0});const A=()=>{u.value=!u.value},{b:i}=W.useNamespace("pro-card"),y=["xxxl","xxl","xl","lg","md","sm","xs"],p=L(),B=(t,r)=>t?r:{},E=t=>{const r=[0,0];return(Array.isArray(t)?t:[t,0]).forEach((s,l)=>{if(typeof s=="object")for(let c=0;c<y.length;c+=1){const d=y[c];if({lg:!0,md:!0,sm:!0,xl:!1,xs:!1,xxl:!1,xxxl:!1,...p==null?void 0:p.value}[d]&&s[d]!==void 0){r[l]=s[d];break}}else r[l]=s||0}),r},j=t=>{let r=t;if(typeof t=="object")for(let s=0;s<y.length;s+=1){const l=y[s],c={lg:!0,md:!0,sm:!0,xl:!1,xs:!1,xxl:!1,xxxl:!1,...p==null?void 0:p.value};if(c!=null&&c[l]&&(t==null?void 0:t[l])!==void 0){r=t[l];break}}const a=B(typeof r=="string"&&/\d%|\dpx/i.test(r),{width:r,flexShrink:0});return{span:r,colSpanStyle:a}},D=e.computed(()=>E(o.gutter)),C=e.ref(!1),$=t=>{C.value=t},q=e.computed(()=>{var t;return e.createVNode(e.Fragment,null,[o.title||((t=n.title)==null?void 0:t.call(n))])}),F=e.computed(()=>e.createVNode(e.Fragment,null,[o.tooltip])),I=e.computed(()=>{var t;return e.createVNode(e.Fragment,null,[o.extra||((t=n.extra)==null?void 0:t.call(n))])}),O=e.computed(()=>{var t;return e.createVNode(e.Fragment,null,[o.actions||((t=n.actions)==null?void 0:t.call(n))])}),M=e.computed(()=>o.loading===!0?e.createVNode(w.Spin,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},null):e.createVNode(e.Fragment,null,[o.loading])),f=e.computed(()=>o.collapsible&&S.value===void 0),P=()=>{var t;return o.collapsibleIconRender?(t=o.collapsibleIconRender)==null?void 0:t.call(o,{collapsed:u.value}):e.createVNode(e.Fragment,null,[e.createVNode(U.IconApAdFillDown,{class:i("collapsible-icon"),style:{transform:u.value?"rotate(-90deg)":"rotate(0deg)"}},null)])},N=(t,r=[])=>{if((t==null?void 0:t.type)===Symbol.for("v-fgt")){const a=Array.isArray(t==null?void 0:t.children)?t==null?void 0:t.children:[t==null?void 0:t.children];if(a!=null&&a.length)for(let s=0;s<a.length;s++)a!=null&&a[s]&&N(a==null?void 0:a[s],r)}else t&&r.push(t);return r},G=()=>{var r,a,s;const t=(r=n.default)==null?void 0:r.call(n);return $(!1),e.createVNode(e.Fragment,null,[(s=(a=t==null?void 0:t.reduce((l,c)=>{const d=N(c);return[...l,...d]},[]))==null?void 0:a.filter(l=>l.type!==Symbol.for("v-cmt")))==null?void 0:s.map((l,c,d)=>{var b,V,z;if(l&&typeof l=="object"&&"type"in l&&((b=l.type)==null?void 0:b.isProCard)===!0){$(!0);const H=((V=l==null?void 0:l.props)==null?void 0:V.colSpan)||((z=l==null?void 0:l.props)==null?void 0:z["col-span"])||{},{span:m,colSpanStyle:Q}=j(H),v=i("col"),J=g.mergeClass(`${v}`,[typeof m=="number"&&m>=0&&m<=24?`${v}-span-${m}`:void 0,o.split==="horizontal"&&c!==d.length-1?`${v}-split-horizontal`:void 0,o.split==="vertical"&&c!==d.length-1?`${v}-split-vertical`:void 0].filter(Boolean)),[x,k]=D.value;return e.createVNode("div",{class:J,style:{...Q,...B(x>0,{paddingInlineStart:`${x/2}px`,paddingInlineEnd:`${x/2}px`}),...B(k>0,{paddingBlockStart:`${k/2}px`,paddingBlockEnd:`${k/2}px`}),...o.colStyle}},[l])}return l})])},R=e.computed(()=>{const t=i();return g.mergeClass(`${t}`,[o.bordered?`${t}-border`:void 0,o.boxShadow?`${t}-box-shadow`:void 0,C.value?`${t}-contain-card`:void 0,o.loading?`${t}-loading`:void 0,o.split==="vertical"||o.split==="horizontal"?`${t}-split`:void 0,o.ghost?`${t}-ghost`:void 0,o.hoverable?`${t}-hoverable`:void 0,o.type?`${t}-type-${o.type}`:void 0,u.value?`${t}-collapsed`:void 0].filter(Boolean))}),T=e.computed(()=>{const t=i("header");return g.mergeClass(`${t}`,[o.headerBordered||o.type==="inner"?`${t}-border`:void 0,f.value?`${t}-collapsible`:void 0].filter(Boolean))}),_=e.computed(()=>{const t=i("body");return g.mergeClass(`${t}`,[o.layout==="center"?`${t}-center`:void 0,o.split==="horizontal"||o.direction==="column"?`${t}-direction-column`:void 0,o.wrap&&C.value?`${t}-wrap`:void 0].filter(Boolean))});return(t,r)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:R.value},{...t.$attrs}),[o.title||n.title||o.extra||n.extra||f.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(T.value),style:e.normalizeStyle({...o.headStyle}),onClick:r[0]||(r[0]=()=>{f.value&&A()})},[o.title||n.title||f.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(i)("header-title"))},[f.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P()),{key:0})):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"title",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(q.value)))]),o.tooltip?(e.openBlock(),e.createBlock(e.unref(w.Tooltip),{key:1},{title:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(F.value)))]),default:e.withCtx(()=>[e.createVNode(e.unref(K.QuestionCircleOutlined),{class:e.normalizeClass(e.unref(i)("header-title-tooltip"))},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),o.extra||n.extra?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i)("header-extra"))},[e.renderSlot(t.$slots,"extra",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(I.value)))])],2)):e.createCommentVNode("",!0)],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(_.value),style:e.normalizeStyle({...o.bodyStyle})},[o.loading?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(M.value),{key:0})):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(G()),{key:1}))],6),o.actions||n.actions?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i)("actions")),style:e.normalizeStyle({...o.actionsStyle})},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(O.value)))],6)):e.createCommentVNode("",!0)],16))}});exports.default=X;
@@ -25,7 +25,9 @@ declare function __VLS_template(): {
25
25
  rootEl: HTMLDivElement;
26
26
  };
27
27
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
28
- declare const __VLS_component: DefineComponent<ApStatisticCardProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApStatisticCardProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
28
+ declare const __VLS_component: DefineComponent<ApStatisticCardProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApStatisticCardProps> & Readonly<{}>, {
29
+ collapsed: boolean;
30
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
29
31
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
30
32
  export default _default;
31
33
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../../config-provider/index.js");require("../card/index.vue.js");require("../statistic/index.vue.js");const _=require("../../../editable-table/utils.js"),O=require("lodash-unified"),q=require("../../../config-provider/hooks/use-namespace.js"),P=require("../statistic/index.vue2.js"),j=require("../card/index.vue2.js"),k=e.defineComponent({name:"ApStatisticCard",__name:"index",props:{headStyle:{},bodyStyle:{},actionsStyle:{},headerBordered:{type:Boolean},title:{type:[Object,String,Number,Boolean,null,Array]},tooltip:{type:[Object,String,Number,Boolean,null,Array]},extra:{type:[Object,String,Number,Boolean,null,Array]},layout:{},type:{},direction:{},wrap:{type:Boolean},loading:{type:[Boolean,Object,String,Number,null,Array]},colSpan:{},colStyle:{},gutter:{},actions:{type:[Object,String,Number,Boolean,null,Array]},split:{},bordered:{type:Boolean},hoverable:{type:Boolean},ghost:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},collapsed:{type:Boolean},collapsibleIconRender:{type:Function},boxShadow:{type:Boolean},chart:{type:[Object,String,Number,Boolean,null,Array]},statistic:{},chartPlacement:{},footer:{type:[Object,String,Number,Boolean,null,Array]}},setup(g){const r=g,t=e.useSlots(),{b:n}=q.useNamespace("statistic-card"),S=e.computed(()=>n()),C=e.computed(()=>{const o=n("chart");return _.mergeClass(`${o}`,[r.chartPlacement==="left"?`${o}-left`:void 0,r.chartPlacement==="right"?`${o}-right`:void 0].filter(Boolean))}),d=e.computed(()=>{const o=n("content");return _.mergeClass(`${o}`,[r.chartPlacement==="left"||r.chartPlacement==="right"?`${o}-horizontal`:void 0].filter(Boolean))}),N=e.computed(()=>n("footer")),c=e.computed(()=>{var o,u,s,a,p,f,m,y,v,h,B,b;return r.statistic?e.createVNode(P.default,e.mergeProps({layout:"vertical"},r.statistic,{title:((o=r.statistic)==null?void 0:o.title)||((u=t.statisticTitle)==null?void 0:u.call(t)),prefix:((s=r.statistic)==null?void 0:s.prefix)||((a=t.prefix)==null?void 0:a.call(t)),suffix:((p=r.statistic)==null?void 0:p.suffix)||((f=t.suffix)==null?void 0:f.call(t)),icon:((m=r.statistic)==null?void 0:m.icon)||((y=t.icon)==null?void 0:y.call(t)),tip:((v=r.statistic)==null?void 0:v.tip)||((h=t.tip)==null?void 0:h.call(t)),description:((B=r.statistic)==null?void 0:B.description)||((b=t.description)==null?void 0:b.call(t))}),null):void 0}),l=e.computed(()=>{var o;return r.chart||t.chart?e.createVNode("div",{class:C.value},[r.chart||((o=t.chart)==null?void 0:o.call(t))]):void 0}),i=e.computed(()=>l.value||c.value?r.chartPlacement==="left"?e.createVNode("div",{class:d.value},[l.value,c.value]):e.createVNode("div",{class:d.value},[c.value,l.value]):void 0),x=e.computed(()=>{var o;return r.footer||t.footer?e.createVNode("div",{class:N.value},[r.footer||((o=t.footer)==null?void 0:o.call(t))]):void 0});return(o,u)=>(e.openBlock(),e.createBlock(j.default,e.mergeProps({class:S.value},{...r}),e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{key:0})):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default"),i.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.value),{key:1})):e.createCommentVNode("",!0)]),_:2},[e.renderList(e.unref(O.omit)(t,["chart","footer","description","default"]),(s,a)=>({name:a,fn:e.withCtx(()=>[e.renderSlot(o.$slots,a)])}))]),1040,["class"]))}});exports.default=k;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../../config-provider/index.js");require("../card/index.vue.js");require("../statistic/index.vue.js");const _=require("../../../editable-table/utils.js"),O=require("lodash-unified"),q=require("../../../config-provider/hooks/use-namespace.js"),P=require("../statistic/index.vue2.js"),j=require("../card/index.vue2.js"),k=e.defineComponent({name:"ApStatisticCard",__name:"index",props:{headStyle:{},bodyStyle:{},actionsStyle:{},headerBordered:{type:Boolean},title:{type:[Object,String,Number,Boolean,null,Array]},tooltip:{type:[Object,String,Number,Boolean,null,Array]},extra:{type:[Object,String,Number,Boolean,null,Array]},layout:{},type:{},direction:{},wrap:{type:Boolean},loading:{type:[Boolean,Object,String,Number,null,Array]},colSpan:{},colStyle:{},gutter:{},actions:{type:[Object,String,Number,Boolean,null,Array]},split:{},bordered:{type:Boolean},hoverable:{type:Boolean},ghost:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},collapsed:{type:Boolean,default:void 0},collapsibleIconRender:{},boxShadow:{type:Boolean},chart:{type:[Object,String,Number,Boolean,null,Array]},statistic:{},chartPlacement:{},footer:{type:[Object,String,Number,Boolean,null,Array]}},setup(g){const r=g,t=e.useSlots(),{b:n}=q.useNamespace("statistic-card"),S=e.computed(()=>n()),C=e.computed(()=>{const o=n("chart");return _.mergeClass(`${o}`,[r.chartPlacement==="left"?`${o}-left`:void 0,r.chartPlacement==="right"?`${o}-right`:void 0].filter(Boolean))}),d=e.computed(()=>{const o=n("content");return _.mergeClass(`${o}`,[r.chartPlacement==="left"||r.chartPlacement==="right"?`${o}-horizontal`:void 0].filter(Boolean))}),N=e.computed(()=>n("footer")),c=e.computed(()=>{var o,u,s,a,p,f,m,y,v,h,B,b;return r.statistic?e.createVNode(P.default,e.mergeProps({layout:"vertical"},r.statistic,{title:((o=r.statistic)==null?void 0:o.title)||((u=t.statisticTitle)==null?void 0:u.call(t)),prefix:((s=r.statistic)==null?void 0:s.prefix)||((a=t.prefix)==null?void 0:a.call(t)),suffix:((p=r.statistic)==null?void 0:p.suffix)||((f=t.suffix)==null?void 0:f.call(t)),icon:((m=r.statistic)==null?void 0:m.icon)||((y=t.icon)==null?void 0:y.call(t)),tip:((v=r.statistic)==null?void 0:v.tip)||((h=t.tip)==null?void 0:h.call(t)),description:((B=r.statistic)==null?void 0:B.description)||((b=t.description)==null?void 0:b.call(t))}),null):void 0}),l=e.computed(()=>{var o;return r.chart||t.chart?e.createVNode("div",{class:C.value},[r.chart||((o=t.chart)==null?void 0:o.call(t))]):void 0}),i=e.computed(()=>l.value||c.value?r.chartPlacement==="left"?e.createVNode("div",{class:d.value},[l.value,c.value]):e.createVNode("div",{class:d.value},[c.value,l.value]):void 0),x=e.computed(()=>{var o;return r.footer||t.footer?e.createVNode("div",{class:N.value},[r.footer||((o=t.footer)==null?void 0:o.call(t))]):void 0});return(o,u)=>(e.openBlock(),e.createBlock(j.default,e.mergeProps({class:S.value},{...r}),e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{key:0})):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default"),i.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.value),{key:1})):e.createCommentVNode("",!0)]),_:2},[e.renderList(e.unref(O.omit)(t,["chart","footer","description","default"]),(s,a)=>({name:a,fn:e.withCtx(()=>[e.renderSlot(o.$slots,a)])}))]),1040,["class"]))}});exports.default=k;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),X=require("./constans.js"),Y=require("@aplus-frontend/antdv");require("../../config-provider/index.js");const D=require("./utils/sortItemsByRowAndCol.js"),Z=require("../../config-provider/hooks/use-namespace.js"),ee=["data-span","data-index","data-row","data-col","data-height","data-module","draggable"],oe=r.defineComponent({__name:"ApDraggableGrid",props:X.ApDraggableGridProps(),emits:["onGridListChange"],setup(P,{expose:W,emit:_}){const f=P,{b:R,e:$,m:J}=Z.useNamespace("ap-draggable-grid"),T=r.ref(!1),B=r.ref(!1),x=r.computed(()=>$("item")),M=r.computed(()=>$("dragging")),z=r.computed(()=>f.customWrapper?`.${f.customWrapper} .${x.value}:not(.${M.value})`:`.${x.value}:not(.${M.value})`),j=_,m=r.useTemplateRef("gridContainer"),S=r.ref([]);r.watch(()=>f.gridList,e=>{Array.isArray(e)&&i(e)},{deep:!0,immediate:!0});function i(e){const n=[...e].sort((o,u)=>o.row-u.row);S.value=n.map(o=>({...o})),j("onGridListChange",JSON.parse(JSON.stringify(S.value)))}const U=e=>({gridColumn:`${e.col} / span ${e.span}`,gridRow:e.row,minHeight:e.showHeight?e.showHeight+"px":`${f.gridItemHeight}px`,height:e.showHeight?e.showHeight+"px":`${f.gridItemHeight}px`,boxShadow:f.gridItemShadow?f.gridItemShadow:"none"});async function H(){if(i([]),typeof f.request=="function")try{T.value=!0;const e=await f.request();Array.isArray(e)?(console.log("ApDraggableGrid: 请求到的布局数据:",e),i(e)):console.warn("ApDraggableGrid: 请求函数必须返回一个符合 ApDraggableGridItemBase 数组的格式")}catch(e){console.error("ApDraggableGrid: 请求错误:",e)}finally{T.value=!1}}let C=r.ref(null),N=r.ref(null),v=null,G=!1,y=null;const k=e=>{if(!G&&(G=!0,e.dataTransfer&&e.target instanceof HTMLElement)){const n=e.target.dataset;e.dataTransfer.setData("text/plain",n.module),e.dataTransfer.effectAllowed="move",C.value={span:Number(n.span),col:Number(n.col),row:Number(n.row),module:n.module,height:Number(n.height),index:Number(n.index)},v=e.target,v.style.opacity="0"}},q=e=>{if(e.preventDefault(),y&&clearTimeout(y),y=window.setTimeout(()=>{G=!1,y=null},300),e.dataTransfer&&e.target instanceof HTMLElement){const n=e.target.closest(z.value);if(!n)return;const o=n.dataset;N.value={span:Number(o.span),col:Number(o.col),row:Number(o.row),module:o.module,height:Number(o.height),index:Number(o.index)}}},F=e=>{e.preventDefault(),v&&(v.style.opacity="1",v=null),V(C,N)&&K(C,N),C.value=null,N.value=null,B.value=!1},O=()=>{v&&(v.style.opacity="1",v=null),C.value=null,N.value=null,B.value=!1},V=(e,n)=>{const{span:o,module:u}=e.value,{span:c,module:d}=n.value;return u===d&&o===c?(console.log("如果自己放在自己之上不能交换数据"),!1):!0},K=(e,n)=>{if(!e.value||!n.value)return;const{span:o,col:u,row:c,module:d,height:A,index:l}=e.value,{span:I,col:h,row:p,module:Q,height:L,index:g}=n.value;if(c===p&&u===h&&o===I&&A===L&&d===Q){console.log("从同一位置拖拽到同一位置,不做任何操作");return}let t=[...r.toRaw(S.value)];const E=JSON.parse(JSON.stringify(t));if(c===p)if(l>g){console.log("","从右向左拖拽"),console.log(l,g),console.log(l-g),l-g===1?(t[g].col=o+h,t[l].col=h):(t.forEach((w,a)=>{a<l&&a>=g&&(w.col+=I)}),t[l].col=h);const s=D.sortItemsByRowAndCol(t);if(!b(s)){console.warn("交换后的布局无效,恢复原始布局");return}i(s);return}else{console.log(l,g),console.log("","从左向右拖拽"),g-l===1?(t[l].col=I+1,t[g].col=u):(t.forEach((w,a)=>{a>l&&a<=g&&(w.col-=I)}),t[l].col=h);const s=D.sortItemsByRowAndCol(t);if(console.log("交换后的布局:",s),!b(s)){console.warn("交换后的布局无效,恢复原始布局"),i(E);return}i(s);return}else if(p<c){if(console.log("从下向上拖拽"),o===24){const s=[];for(let a=p;a<c;a++)s.push(a);t.forEach(a=>{s.includes(a.row)&&(a.row+=1)}),t[l].row=p;const w=D.sortItemsByRowAndCol(t);if(!b(w)){console.warn("交换后的布局无效,恢复原始布局"),i(E);return}i(w);return}if(o===I&&A===L){t[l].row=p,t[l].col=h,t[g].row=c,t[g].col=u;const s=D.sortItemsByRowAndCol(t);if(!b(s)){console.warn("交换后的布局无效,恢复原始布局"),i(E);return}i(s);return}}else{if(console.log("从上向下拖拽"),o===24){console.log("如果拖拽元素跨度为24","从上向下拖拽");const s=[];for(let a=c+1;a<=p;a++)s.push(a);t.forEach(a=>{s.includes(a.row)&&(a.row-=1)}),t[l].row=p;const w=D.sortItemsByRowAndCol(t);if(!b(w)){console.warn("交换后的布局无效,恢复原始布局"),i(E);return}i(w);return}if(o===I&&A===L){t[l].row=p,t[l].col=h,t[g].row=c,t[g].col=u;const s=D.sortItemsByRowAndCol(t);if(!b(s)){console.warn("交换后的布局无效,恢复原始布局"),i(E);return}i(s);return}}},b=e=>{const n={};e.forEach(o=>{n[o.row]||(n[o.row]=[]),n[o.row].push(o)});for(const o in n){const u=n[o].sort((d,A)=>d.col-A.col);let c=1;for(const d of u){if(d.col<c)return console.warn(`行 ${o} 中的元素重叠: 元素 ${d.module} 在列 ${d.col}, 但当前列已经是 ${c}`),!1;if(c=d.col+d.span,c>25)return console.warn(`行 ${o} 中的元素超出界限: 元素 ${d.module} 在列 ${d.col} 跨度 ${d.span}`),!1}}return!0};return r.onMounted(async()=>{await H(),!f.disableDrag&&m.value&&(m.value.addEventListener("dragstart",k),m.value.addEventListener("dragover",q),m.value.addEventListener("drop",F),m.value.addEventListener("dragend",O))}),r.onUnmounted(()=>{m.value&&(m.value.removeEventListener("dragstart",k),m.value.removeEventListener("dragover",q),m.value.removeEventListener("drop",F),m.value.removeEventListener("dragend",O),y&&clearTimeout(y))}),W({setGridItems:e=>{i(e)},getGridItems:()=>JSON.parse(JSON.stringify(S.value)),refreshGrid:()=>{(async()=>{await H()})()}}),(e,n)=>(r.openBlock(),r.createBlock(r.unref(Y.Spin),{spinning:T.value},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"gridContainer",ref:m,class:r.normalizeClass([T.value?r.unref(R)("loading"):r.unref(R)(),f.customWrapper]),style:r.normalizeStyle({width:typeof e.gridWidth=="number"?`${e.gridWidth}px`:e.gridWidth,gap:`${e.gapWidth}px`})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(S.value,(o,u)=>(r.openBlock(),r.createElementBlock("div",{key:u,class:r.normalizeClass([r.unref($)("item"),f.disableDrag?"":r.unref(J)("canDrag")]),"data-span":o.span,"data-index":u,"data-row":o.row,"data-col":o.col,"data-height":o.height,"data-module":o.module,style:r.normalizeStyle([U(o)]),draggable:!f.disableDrag},[r.renderSlot(e.$slots,"item",{item:o,index:u})],14,ee))),128))],6)]),_:3},8,["spinning"]))}});exports.default=oe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),Y=require("./constans.js"),Z=require("@aplus-frontend/antdv");require("../../config-provider/index.js");const S=require("./utils/sortItemsByRowAndCol.js"),ee=require("../../config-provider/hooks/use-namespace.js"),oe=["data-span","data-index","data-row","data-col","data-height","data-module","draggable"],re=r.defineComponent({__name:"ApDraggableGrid",props:Y.ApDraggableGridProps(),emits:["onGridListChange"],setup(W,{expose:_,emit:J}){const d=W,{b:B,e:A,m:z}=ee.useNamespace("ap-draggable-grid"),T=r.ref(!1),x=r.ref(!1),M=r.computed(()=>A("item")),q=r.computed(()=>A("dragging")),L=r.computed(()=>A("overlay")),j=r.computed(()=>d.customWrapper?`.${d.customWrapper} .${M.value}:not(.${q.value})`:`.${M.value}:not(.${q.value})`),U=J,m=r.useTemplateRef("gridContainer"),D=r.ref([]);r.watch(()=>d.gridList,e=>{Array.isArray(e)&&u(e)},{deep:!0,immediate:!0});function u(e){const n=[...e].sort((o,c)=>o.row-c.row);D.value=n.map(o=>({...o})),U("onGridListChange",JSON.parse(JSON.stringify(D.value)))}const V=e=>({gridColumn:`${e.col} / span ${e.span}`,gridRow:e.row,minHeight:e.showHeight?e.showHeight+"px":`${d.gridItemHeight}px`,height:e.showHeight?e.showHeight+"px":`${d.gridItemHeight}px`,boxShadow:d.gridItemShadow?d.gridItemShadow:"none"});async function H(){if(u([]),typeof d.request=="function")try{T.value=!0;const e=await d.request();Array.isArray(e)?(console.log("ApDraggableGrid: 请求到的布局数据:",e),u(e)):console.warn("ApDraggableGrid: 请求函数必须返回一个符合 ApDraggableGridItemBase 数组的格式")}catch(e){console.error("ApDraggableGrid: 请求错误:",e)}finally{T.value=!1}}let E=r.ref(null),C=r.ref(null),v=null,G=!1,y=null;const k=e=>{if(!G&&(G=!0,e.dataTransfer&&e.target instanceof HTMLElement)){const n=e.target.dataset;e.dataTransfer.setData("text/plain",n.module),e.dataTransfer.effectAllowed="move",E.value={span:Number(n.span),col:Number(n.col),row:Number(n.row),module:n.module,height:Number(n.height),index:Number(n.index)},v=e.target,v.style.opacity="0"}},F=e=>{if(e.preventDefault(),y&&clearTimeout(y),y=window.setTimeout(()=>{G=!1,y=null},300),e.dataTransfer&&e.target instanceof HTMLElement){const n=e.target.closest(j.value);if(!n)return;const o=n.dataset;document.querySelectorAll(`.${d.customWrapper} div[data-row="${o.row}"]`).forEach(i=>{i.classList.add(L.value)}),C.value={span:Number(o.span),col:Number(o.col),row:Number(o.row),module:o.module,height:Number(o.height),index:Number(o.index)}}},O=e=>{e.preventDefault(),v&&(v.style.opacity="1",v=null),K(E,C)&&Q(E,C),document.querySelectorAll(`.${L.value}`).forEach(n=>{n.classList.remove(L.value)}),E.value=null,C.value=null,x.value=!1},P=()=>{v&&(v.style.opacity="1",v=null),E.value=null,C.value=null,x.value=!1},K=(e,n)=>{const{span:o,module:c}=e.value,{span:i,module:g}=n.value;return c===g&&o===i?(console.log("如果自己放在自己之上不能交换数据"),!1):!0},Q=(e,n)=>{if(!e.value||!n.value)return;const{span:o,col:c,row:i,module:g,height:N,index:l}=e.value,{span:I,col:h,row:p,module:X,height:R,index:f}=n.value;if(i===p&&c===h&&o===I&&N===R&&g===X){console.log("从同一位置拖拽到同一位置,不做任何操作");return}let t=[...r.toRaw(D.value)];const $=JSON.parse(JSON.stringify(t));if(i===p)if(l>f){console.log("","从右向左拖拽"),console.log(l,f),console.log(l-f),l-f===1?(t[f].col=o+h,t[l].col=h):(t.forEach((w,a)=>{a<l&&a>=f&&(w.col+=I)}),t[l].col=h);const s=S.sortItemsByRowAndCol(t);if(!b(s)){console.warn("交换后的布局无效,恢复原始布局");return}u(s);return}else{console.log(l,f),console.log("","从左向右拖拽"),f-l===1?(t[l].col=I+1,t[f].col=c):(t.forEach((w,a)=>{a>l&&a<=f&&(w.col-=I)}),t[l].col=h);const s=S.sortItemsByRowAndCol(t);if(console.log("交换后的布局:",s),!b(s)){console.warn("交换后的布局无效,恢复原始布局"),u($);return}u(s);return}else if(p<i){if(console.log("从下向上拖拽"),o===24){const s=[];for(let a=p;a<i;a++)s.push(a);t.forEach(a=>{s.includes(a.row)&&(a.row+=1)}),t[l].row=p;const w=S.sortItemsByRowAndCol(t);if(!b(w)){console.warn("交换后的布局无效,恢复原始布局"),u($);return}u(w);return}if(o===I&&N===R){t[l].row=p,t[l].col=h,t[f].row=i,t[f].col=c;const s=S.sortItemsByRowAndCol(t);if(!b(s)){console.warn("交换后的布局无效,恢复原始布局"),u($);return}u(s);return}}else{if(console.log("从上向下拖拽"),o===24){console.log("如果拖拽元素跨度为24","从上向下拖拽");const s=[];for(let a=i+1;a<=p;a++)s.push(a);t.forEach(a=>{s.includes(a.row)&&(a.row-=1)}),t[l].row=p;const w=S.sortItemsByRowAndCol(t);if(!b(w)){console.warn("交换后的布局无效,恢复原始布局"),u($);return}u(w);return}if(o===I&&N===R){t[l].row=p,t[l].col=h,t[f].row=i,t[f].col=c;const s=S.sortItemsByRowAndCol(t);if(!b(s)){console.warn("交换后的布局无效,恢复原始布局"),u($);return}u(s);return}}},b=e=>{const n={};e.forEach(o=>{n[o.row]||(n[o.row]=[]),n[o.row].push(o)});for(const o in n){const c=n[o].sort((g,N)=>g.col-N.col);let i=1;for(const g of c){if(g.col<i)return console.warn(`行 ${o} 中的元素重叠: 元素 ${g.module} 在列 ${g.col}, 但当前列已经是 ${i}`),!1;if(i=g.col+g.span,i>25)return console.warn(`行 ${o} 中的元素超出界限: 元素 ${g.module} 在列 ${g.col} 跨度 ${g.span}`),!1}}return!0};return r.onMounted(async()=>{await H(),!d.disableDrag&&m.value&&(m.value.addEventListener("dragstart",k),m.value.addEventListener("dragover",F),m.value.addEventListener("drop",O),m.value.addEventListener("dragend",P))}),r.onUnmounted(()=>{m.value&&(m.value.removeEventListener("dragstart",k),m.value.removeEventListener("dragover",F),m.value.removeEventListener("drop",O),m.value.removeEventListener("dragend",P),y&&clearTimeout(y))}),_({setGridItems:e=>{u(e)},getGridItems:()=>JSON.parse(JSON.stringify(D.value)),refreshGrid:()=>{(async()=>{await H()})()}}),(e,n)=>(r.openBlock(),r.createBlock(r.unref(Z.Spin),{spinning:T.value},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"gridContainer",ref:m,class:r.normalizeClass([T.value?r.unref(B)("loading"):r.unref(B)(),d.customWrapper]),style:r.normalizeStyle({width:typeof e.gridWidth=="number"?`${e.gridWidth}px`:e.gridWidth,gap:`${e.gapWidth}px`})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(D.value,(o,c)=>(r.openBlock(),r.createElementBlock("div",{key:c,class:r.normalizeClass([r.unref(A)("item"),d.disableDrag?"":r.unref(z)("canDrag")]),"data-span":o.span,"data-index":c,"data-row":o.row,"data-col":o.col,"data-height":o.height,"data-module":o.module,style:r.normalizeStyle([V(o)]),draggable:!d.disableDrag},[r.renderSlot(e.$slots,"item",{item:o,index:c})],14,oe))),128))],6)]),_:3},8,["spinning"]))}});exports.default=re;
@@ -1,2 +1,2 @@
1
- declare const _default: "6.26.1";
1
+ declare const _default: "6.26.2";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.26.1";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.26.2";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "6.26.1",
3
+ "version": "6.26.2",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -37,8 +37,8 @@
37
37
  "scroll-into-view-if-needed": "^3.1.0",
38
38
  "vue-virtual-scroller": "2.0.0-beta.8",
39
39
  "vuedraggable": "^4.1.0",
40
- "@aplus-frontend/hooks": "1.0.7",
41
- "@aplus-frontend/utils": "1.0.61"
40
+ "@aplus-frontend/utils": "1.0.61",
41
+ "@aplus-frontend/hooks": "1.0.7"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@aplus-frontend/antdv": "^1.2.3",
@@ -61,8 +61,11 @@
61
61
  overflow: hidden;
62
62
  box-sizing: border-box;
63
63
  }
64
+ .aplus-ap-draggable-grid--canDrag {
65
+ cursor: pointer;
66
+ }
64
67
  .aplus-ap-draggable-grid--canDrag:hover {
65
- border: 1px solid var(--ap-color-primary);
68
+ border: 1px solid #66a9ff;
66
69
  }
67
70
  .aplus-ap-draggable-grid--dragging {
68
71
  cursor: move;
@@ -74,7 +77,7 @@
74
77
  z-index: 999;
75
78
  }
76
79
  .aplus-ap-draggable-grid__overlay {
77
- border: 1px solid var(--ap-color-primary);
80
+ border: 1px solid #66a9ff;
78
81
  }
79
82
  .aplus-ap-draggable-grid-loading {
80
83
  display: flex;
@@ -17,8 +17,9 @@
17
17
  box-sizing: border-box;
18
18
  }
19
19
  &--canDrag {
20
+ cursor: pointer;
20
21
  &:hover{
21
- border: 1px solid var(--ap-color-primary);
22
+ border: 1px solid #66a9ff;
22
23
  }
23
24
  }
24
25
  &--dragging {
@@ -31,7 +32,7 @@
31
32
  z-index: 999;
32
33
  }
33
34
  &__overlay {
34
- border: 1px solid var(--ap-color-primary);
35
+ border: 1px solid #66a9ff;
35
36
  }
36
37
  });
37
38
  .b('ap-draggable-grid-loading',{
package/theme/index.css CHANGED
@@ -4166,8 +4166,11 @@ div.aplus-ap-info-layout-admin__header-shadow.aplus-ap-info-layout-admin__sticky
4166
4166
  overflow: hidden;
4167
4167
  box-sizing: border-box;
4168
4168
  }
4169
+ .aplus-ap-draggable-grid--canDrag {
4170
+ cursor: pointer;
4171
+ }
4169
4172
  .aplus-ap-draggable-grid--canDrag:hover {
4170
- border: 1px solid var(--ap-color-primary);
4173
+ border: 1px solid #66a9ff;
4171
4174
  }
4172
4175
  .aplus-ap-draggable-grid--dragging {
4173
4176
  cursor: move;
@@ -4179,7 +4182,7 @@ div.aplus-ap-info-layout-admin__header-shadow.aplus-ap-info-layout-admin__sticky
4179
4182
  z-index: 999;
4180
4183
  }
4181
4184
  .aplus-ap-draggable-grid__overlay {
4182
- border: 1px solid var(--ap-color-primary);
4185
+ border: 1px solid #66a9ff;
4183
4186
  }
4184
4187
  .aplus-ap-draggable-grid-loading {
4185
4188
  display: flex;