@aplus-frontend/ui 6.15.0 → 6.17.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 (63) hide show
  1. package/es/index.mjs +83 -81
  2. package/es/src/business/ap-batch-action/ApBatchAction.vue.d.ts +3 -1
  3. package/es/src/business/ap-batch-action/ApBatchAction.vue2.mjs +35 -31
  4. package/es/src/business/ap-batch-action/index.d.ts +9 -3
  5. package/es/src/business/ap-batch-action/interface.d.ts +4 -0
  6. package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue.d.ts +124 -0
  7. package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue.mjs +4 -0
  8. package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue2.mjs +194 -0
  9. package/es/src/business/ap-draggable-grid/constans.d.ts +40 -0
  10. package/es/src/business/ap-draggable-grid/constans.mjs +41 -0
  11. package/es/src/business/ap-draggable-grid/index.d.ts +197 -0
  12. package/es/src/business/ap-draggable-grid/index.mjs +8 -0
  13. package/es/src/business/ap-draggable-grid/interface.d.ts +14 -0
  14. package/es/src/business/ap-draggable-grid/interface.mjs +1 -0
  15. package/es/src/business/ap-draggable-grid/style/css.d.ts +0 -0
  16. package/es/src/business/ap-draggable-grid/style/css.js +1 -0
  17. package/es/src/business/ap-draggable-grid/style/index.d.ts +0 -0
  18. package/es/src/business/ap-draggable-grid/style/index.js +1 -0
  19. package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +82 -82
  20. package/es/src/business/index.d.ts +1 -0
  21. package/es/src/business/index.mjs +20 -18
  22. package/es/src/index.mjs +59 -57
  23. package/es/src/path-map.mjs +2 -1
  24. package/es/src/text/index.vue.d.ts +1 -1
  25. package/es/src/text/index.vue.mjs +49 -43
  26. package/es/src/version.d.ts +1 -1
  27. package/es/src/version.mjs +1 -1
  28. package/es/test/setup.d.ts +1 -5
  29. package/lib/index.js +1 -1
  30. package/lib/src/business/ap-batch-action/ApBatchAction.vue.d.ts +3 -1
  31. package/lib/src/business/ap-batch-action/ApBatchAction.vue2.js +1 -1
  32. package/lib/src/business/ap-batch-action/index.d.ts +9 -3
  33. package/lib/src/business/ap-batch-action/interface.d.ts +4 -0
  34. package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue.d.ts +124 -0
  35. package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue.js +1 -0
  36. package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue2.js +1 -0
  37. package/lib/src/business/ap-draggable-grid/constans.d.ts +40 -0
  38. package/lib/src/business/ap-draggable-grid/constans.js +1 -0
  39. package/lib/src/business/ap-draggable-grid/index.d.ts +197 -0
  40. package/lib/src/business/ap-draggable-grid/index.js +1 -0
  41. package/lib/src/business/ap-draggable-grid/interface.d.ts +14 -0
  42. package/lib/src/business/ap-draggable-grid/interface.js +1 -0
  43. package/lib/src/business/ap-draggable-grid/style/css.cjs +1 -0
  44. package/lib/src/business/ap-draggable-grid/style/css.d.ts +0 -0
  45. package/lib/src/business/ap-draggable-grid/style/index.cjs +1 -0
  46. package/lib/src/business/ap-draggable-grid/style/index.d.ts +0 -0
  47. package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -1
  48. package/lib/src/business/index.d.ts +1 -0
  49. package/lib/src/business/index.js +1 -1
  50. package/lib/src/index.js +1 -1
  51. package/lib/src/path-map.js +1 -1
  52. package/lib/src/text/index.vue.d.ts +1 -1
  53. package/lib/src/text/index.vue.js +1 -1
  54. package/lib/src/version.d.ts +1 -1
  55. package/lib/src/version.js +1 -1
  56. package/lib/test/setup.d.ts +1 -5
  57. package/package.json +2 -28
  58. package/theme/ap-draggable-grid/ap-draggable-grid.css +82 -0
  59. package/theme/ap-draggable-grid/ap-draggable-grid.less +38 -0
  60. package/theme/index.css +39 -0
  61. package/theme/index.less +1 -0
  62. package/theme/text/index.css +3 -0
  63. package/theme/text/index.less +3 -0
@@ -0,0 +1,194 @@
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";
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({
7
+ __name: "ApDraggableGrid",
8
+ props: ee(),
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);
16
+ },
17
+ { deep: !0, immediate: !0 }
18
+ );
19
+ function h(e) {
20
+ o.splice(0, o.length), e.forEach((r) => {
21
+ o.push({
22
+ ...r,
23
+ isDragging: !1,
24
+ isOverlay: !1
25
+ });
26
+ });
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);
43
+ };
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 : ""
51
+ })
52
+ );
53
+ B("onGridListChange", e);
54
+ }
55
+ async function b() {
56
+ if (h([]), typeof l.request == "function")
57
+ try {
58
+ p.value = !0;
59
+ const e = await l.request();
60
+ Array.isArray(e) ? h(e) : console.warn(
61
+ "ApDraggableGrid: 请求函数必须返回一个符合 ApDraggableGridItemBase 数组的格式"
62
+ );
63
+ } catch (e) {
64
+ console.error("ApDraggableGrid: 请求错误:", e);
65
+ } finally {
66
+ p.value = !1;
67
+ }
68
+ }
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})`
77
+ );
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
+ if (!t) return;
87
+ const n = t.closest(
88
+ `.${v.value}:not(.${E.value})`
89
+ );
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;
97
+ };
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));
100
+ });
101
+ });
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;
117
+ }
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;
123
+ }
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;
127
+ }
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;
138
+ });
139
+ });
140
+ }
141
+ return T({
142
+ setGridItems: (e) => {
143
+ h(e), y(), m();
144
+ },
145
+ refreshGrid: () => {
146
+ (async () => {
147
+ await b(), y(), m();
148
+ })();
149
+ }
150
+ }), (e, r) => (w(), J(u(re), { spinning: p.value }, {
151
+ default: X(() => [
152
+ Y("div", {
153
+ 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`
159
+ })
160
+ }, [
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") : ""
168
+ ]),
169
+ "data-span": a.span,
170
+ style: A([
171
+ F(a),
172
+ q(a),
173
+ { height: a.height ? a.height + "px" : "" }
174
+ ]),
175
+ draggable: !l.disableDrag,
176
+ onDragstart: (n) => x(n, t),
177
+ onDragend: _
178
+ }, [
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))
186
+ ], 6)
187
+ ]),
188
+ _: 3
189
+ }, 8, ["spinning"]));
190
+ }
191
+ });
192
+ export {
193
+ ce as default
194
+ };
@@ -0,0 +1,40 @@
1
+ import { PropType } from 'vue';
2
+ import { ApDraggableGridItemBase } from './interface';
3
+ export declare const ApDraggableGridProps: () => {
4
+ gridList: {
5
+ type: PropType<Array<ApDraggableGridItemBase>>;
6
+ default: () => never[];
7
+ };
8
+ request: {
9
+ type: PropType<() => Promise<ApDraggableGridItemBase[]>>;
10
+ default: null;
11
+ };
12
+ gridWidth: {
13
+ type: (NumberConstructor | StringConstructor)[];
14
+ default: string;
15
+ };
16
+ gridItemHeight: {
17
+ type: NumberConstructor;
18
+ default: number;
19
+ };
20
+ gridItemShadow: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ gapWidth: {
25
+ type: NumberConstructor;
26
+ default: number;
27
+ };
28
+ dragOverlayColor: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ dragOverlayBorderColor: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ disableDrag: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
40
+ };
@@ -0,0 +1,41 @@
1
+ const e = () => ({
2
+ gridList: {
3
+ type: Array,
4
+ default: () => []
5
+ },
6
+ request: {
7
+ type: Function,
8
+ default: null
9
+ },
10
+ gridWidth: {
11
+ type: [String, Number],
12
+ default: "100%"
13
+ },
14
+ gridItemHeight: {
15
+ type: Number,
16
+ default: 300
17
+ },
18
+ gridItemShadow: {
19
+ type: String,
20
+ default: "0px 4px 6px 0px rgba(73, 107, 158, 0.1)"
21
+ },
22
+ gapWidth: {
23
+ type: Number,
24
+ default: 12
25
+ },
26
+ dragOverlayColor: {
27
+ type: String,
28
+ default: "#66a9ff"
29
+ },
30
+ dragOverlayBorderColor: {
31
+ type: String,
32
+ default: "#4d97f7"
33
+ },
34
+ disableDrag: {
35
+ type: Boolean,
36
+ default: !1
37
+ }
38
+ });
39
+ export {
40
+ e as ApDraggableGridProps
41
+ };
@@ -0,0 +1,197 @@
1
+ import { CreateComponentPublicInstanceWithMixins, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps, Plugin } from 'vue';
2
+ import { ApDraggableGridItemBase } from './interface';
3
+ export * from './interface';
4
+ declare const ApDraggableGrid: {
5
+ new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
6
+ gridList: {
7
+ type: PropType<Array< ApDraggableGridItemBase>>;
8
+ default: () => never[];
9
+ };
10
+ request: {
11
+ type: PropType<() => Promise< ApDraggableGridItemBase[]>>;
12
+ default: null;
13
+ };
14
+ gridWidth: {
15
+ type: (NumberConstructor | StringConstructor)[];
16
+ default: string;
17
+ };
18
+ gridItemHeight: {
19
+ type: NumberConstructor;
20
+ default: number;
21
+ };
22
+ gridItemShadow: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ gapWidth: {
27
+ type: NumberConstructor;
28
+ default: number;
29
+ };
30
+ dragOverlayColor: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ dragOverlayBorderColor: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ disableDrag: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ }>> & Readonly<{
43
+ onOnGridListChange?: ((args_0: ApDraggableGridItemBase[]) => any) | undefined;
44
+ }>, {
45
+ setGridItems: (items: ApDraggableGridItemBase[]) => void;
46
+ refreshGrid: () => void;
47
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
48
+ onGridListChange: (args_0: ApDraggableGridItemBase[]) => any;
49
+ }, PublicProps, {
50
+ request: () => Promise< ApDraggableGridItemBase[]>;
51
+ gridList: ApDraggableGridItemBase[];
52
+ gridWidth: string | number;
53
+ gridItemHeight: number;
54
+ gridItemShadow: string;
55
+ gapWidth: number;
56
+ dragOverlayColor: string;
57
+ dragOverlayBorderColor: string;
58
+ disableDrag: boolean;
59
+ }, true, {}, {}, GlobalComponents, GlobalDirectives, string, {
60
+ gridContainer: HTMLDivElement;
61
+ }, any, ComponentProvideOptions, {
62
+ P: {};
63
+ B: {};
64
+ D: {};
65
+ C: {};
66
+ M: {};
67
+ Defaults: {};
68
+ }, Readonly< ExtractPropTypes<{
69
+ gridList: {
70
+ type: PropType<Array< ApDraggableGridItemBase>>;
71
+ default: () => never[];
72
+ };
73
+ request: {
74
+ type: PropType<() => Promise< ApDraggableGridItemBase[]>>;
75
+ default: null;
76
+ };
77
+ gridWidth: {
78
+ type: (NumberConstructor | StringConstructor)[];
79
+ default: string;
80
+ };
81
+ gridItemHeight: {
82
+ type: NumberConstructor;
83
+ default: number;
84
+ };
85
+ gridItemShadow: {
86
+ type: StringConstructor;
87
+ default: string;
88
+ };
89
+ gapWidth: {
90
+ type: NumberConstructor;
91
+ default: number;
92
+ };
93
+ dragOverlayColor: {
94
+ type: StringConstructor;
95
+ default: string;
96
+ };
97
+ dragOverlayBorderColor: {
98
+ type: StringConstructor;
99
+ default: string;
100
+ };
101
+ disableDrag: {
102
+ type: BooleanConstructor;
103
+ default: boolean;
104
+ };
105
+ }>> & Readonly<{
106
+ onOnGridListChange?: ((args_0: ApDraggableGridItemBase[]) => any) | undefined;
107
+ }>, {
108
+ setGridItems: (items: ApDraggableGridItemBase[]) => void;
109
+ refreshGrid: () => void;
110
+ }, {}, {}, {}, {
111
+ request: () => Promise< ApDraggableGridItemBase[]>;
112
+ gridList: ApDraggableGridItemBase[];
113
+ gridWidth: string | number;
114
+ gridItemHeight: number;
115
+ gridItemShadow: string;
116
+ gapWidth: number;
117
+ dragOverlayColor: string;
118
+ dragOverlayBorderColor: string;
119
+ disableDrag: boolean;
120
+ }>;
121
+ __isFragment?: never;
122
+ __isTeleport?: never;
123
+ __isSuspense?: never;
124
+ } & ComponentOptionsBase<Readonly< ExtractPropTypes<{
125
+ gridList: {
126
+ type: PropType<Array< ApDraggableGridItemBase>>;
127
+ default: () => never[];
128
+ };
129
+ request: {
130
+ type: PropType<() => Promise< ApDraggableGridItemBase[]>>;
131
+ default: null;
132
+ };
133
+ gridWidth: {
134
+ type: (NumberConstructor | StringConstructor)[];
135
+ default: string;
136
+ };
137
+ gridItemHeight: {
138
+ type: NumberConstructor;
139
+ default: number;
140
+ };
141
+ gridItemShadow: {
142
+ type: StringConstructor;
143
+ default: string;
144
+ };
145
+ gapWidth: {
146
+ type: NumberConstructor;
147
+ default: number;
148
+ };
149
+ dragOverlayColor: {
150
+ type: StringConstructor;
151
+ default: string;
152
+ };
153
+ dragOverlayBorderColor: {
154
+ type: StringConstructor;
155
+ default: string;
156
+ };
157
+ disableDrag: {
158
+ type: BooleanConstructor;
159
+ default: boolean;
160
+ };
161
+ }>> & Readonly<{
162
+ onOnGridListChange?: ((args_0: ApDraggableGridItemBase[]) => any) | undefined;
163
+ }>, {
164
+ setGridItems: (items: ApDraggableGridItemBase[]) => void;
165
+ refreshGrid: () => void;
166
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
167
+ onGridListChange: (args_0: ApDraggableGridItemBase[]) => any;
168
+ }, string, {
169
+ request: () => Promise< ApDraggableGridItemBase[]>;
170
+ gridList: ApDraggableGridItemBase[];
171
+ gridWidth: string | number;
172
+ gridItemHeight: number;
173
+ gridItemShadow: string;
174
+ gapWidth: number;
175
+ dragOverlayColor: string;
176
+ dragOverlayBorderColor: string;
177
+ disableDrag: boolean;
178
+ }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
179
+ $slots: {
180
+ item?(_: {
181
+ item: {
182
+ isDragging: boolean;
183
+ isOverlay: boolean;
184
+ span: number;
185
+ row: number;
186
+ col: number;
187
+ height?: number | string | undefined;
188
+ };
189
+ index: number;
190
+ }): any;
191
+ };
192
+ }) & ( Plugin & (new (...args: any[]) => {
193
+ $props: {
194
+ onClick?: () => void;
195
+ };
196
+ }));
197
+ export { ApDraggableGrid };
@@ -0,0 +1,8 @@
1
+ import { withInstall as r } from "@aplus-frontend/utils";
2
+ import "./ApDraggableGrid.vue.mjs";
3
+ import "./interface.mjs";
4
+ import o from "./ApDraggableGrid.vue2.mjs";
5
+ const a = r(o);
6
+ export {
7
+ a as ApDraggableGrid
8
+ };
@@ -0,0 +1,14 @@
1
+ export interface ApDraggableGridItemBase {
2
+ span: number;
3
+ row: number;
4
+ col: number;
5
+ height?: number | string;
6
+ }
7
+ export interface ApDraggableGridItem extends ApDraggableGridItemBase {
8
+ isDragging: boolean;
9
+ isOverlay: boolean;
10
+ }
11
+ export type ApDraggableGridExpose = {
12
+ setGridItems: (items: ApDraggableGridItemBase[]) => void;
13
+ refreshGrid: () => void;
14
+ };
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ap-draggable-grid/ap-draggable-grid.css';
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ap-draggable-grid/ap-draggable-grid.less';