@aplus-frontend/ui 6.26.4 → 6.27.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.
- package/es/src/ag-grid/hooks/use-columns-def.d.ts +2 -2
- package/es/src/ag-grid/hooks/use-columns-def.mjs +29 -29
- package/es/src/ag-grid/hooks/use-columns.d.ts +1 -1
- package/es/src/ag-grid/hooks/use-columns.mjs +8 -8
- package/es/src/ag-grid/hooks/use-pinned-row.d.ts +7 -0
- package/es/src/ag-grid/hooks/use-pinned-row.mjs +32 -0
- package/es/src/ag-grid/hooks/use-virtual-config.d.ts +5 -0
- package/es/src/ag-grid/hooks/use-virtual-config.mjs +25 -0
- package/es/src/ag-grid/index.vue.mjs +274 -232
- package/es/src/ag-grid/interface.d.ts +25 -2
- package/es/src/ap-field/select/index.vue.d.ts +51 -21
- package/es/src/ap-field/select/index.vue.mjs +51 -49
- package/es/src/ap-field/select/read.vue2.mjs +4 -1
- package/es/src/ap-field/tree-select/index.vue.d.ts +29 -21
- package/es/src/ap-field/tree-select/index.vue.mjs +11 -9
- package/es/src/ap-field/tree-select/read.vue2.mjs +7 -5
- package/es/src/ap-form/ap-form.vue.d.ts +20 -0
- package/es/src/ap-form/ap-form.vue2.mjs +11 -10
- package/es/src/ap-form/drawer-form/index.vue.d.ts +22 -0
- package/es/src/ap-form/drawer-form/index.vue.mjs +1 -0
- package/es/src/ap-form/hooks/use-watch.mjs +25 -28
- package/es/src/ap-form/interface.d.ts +1 -1
- package/es/src/ap-form/items/select/index.vue.d.ts +64 -28
- package/es/src/ap-form/items/tree-select/index.vue.d.ts +40 -28
- package/es/src/ap-form/modal-form/index.vue.d.ts +22 -0
- package/es/src/ap-form/modal-form/index.vue.mjs +31 -30
- package/es/src/ap-form/search-form/index.vue.d.ts +24 -2
- package/es/src/ap-form/search-form/index.vue.mjs +72 -68
- package/es/src/ap-table/constants.d.ts +52 -28
- package/es/src/ap-upload/apUpload.vue.d.ts +9 -0
- package/es/src/ap-upload/apUpload.vue.mjs +38 -34
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +59 -59
- package/es/src/ap-upload/components/Picture.vue2.mjs +74 -74
- package/es/src/ap-upload/components/SingleFile.vue2.mjs +95 -95
- package/es/src/business/ap-value-select-card/index.vue2.mjs +120 -123
- package/es/src/business/ap-view/components/main-button-content.vue.d.ts +11 -0
- package/es/src/business/ap-view/components/menu-list-content.vue.d.ts +11 -0
- package/es/src/business/hooks/usePageListAgGrid.d.ts +1 -1
- package/es/src/business/hooks/usePageListAgGrid.mjs +4 -4
- package/es/src/business/hooks/usePageListApGrid.mjs +14 -14
- package/es/src/config-provider/config-provider-props.d.ts +14 -1
- package/es/src/config-provider/config-provider.d.ts +31 -1
- package/es/src/config-provider/hooks/use-global-config.d.ts +14 -1
- package/es/src/config-provider/index.d.ts +52 -1
- package/es/src/utils/config-provider-preset.d.ts +11 -1
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/es/src/work-order-modal/work-order-modal.vue.d.ts +11 -0
- package/lib/src/ag-grid/hooks/use-columns-def.d.ts +2 -2
- package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
- package/lib/src/ag-grid/hooks/use-columns.d.ts +1 -1
- package/lib/src/ag-grid/hooks/use-columns.js +1 -1
- package/lib/src/ag-grid/hooks/use-pinned-row.d.ts +7 -0
- package/lib/src/ag-grid/hooks/use-pinned-row.js +1 -0
- package/lib/src/ag-grid/hooks/use-virtual-config.d.ts +5 -0
- package/lib/src/ag-grid/hooks/use-virtual-config.js +1 -0
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ag-grid/interface.d.ts +25 -2
- package/lib/src/ap-field/select/index.vue.d.ts +51 -21
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-field/select/read.vue2.js +1 -1
- package/lib/src/ap-field/tree-select/index.vue.d.ts +29 -21
- package/lib/src/ap-field/tree-select/index.vue.js +1 -1
- package/lib/src/ap-field/tree-select/read.vue2.js +1 -1
- package/lib/src/ap-form/ap-form.vue.d.ts +20 -0
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +22 -0
- package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
- package/lib/src/ap-form/hooks/use-watch.js +1 -1
- package/lib/src/ap-form/interface.d.ts +1 -1
- package/lib/src/ap-form/items/select/index.vue.d.ts +64 -28
- package/lib/src/ap-form/items/tree-select/index.vue.d.ts +40 -28
- package/lib/src/ap-form/modal-form/index.vue.d.ts +22 -0
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.d.ts +24 -2
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +52 -28
- package/lib/src/ap-upload/apUpload.vue.d.ts +9 -0
- package/lib/src/ap-upload/apUpload.vue.js +1 -1
- package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-value-select-card/index.vue2.js +1 -1
- package/lib/src/business/ap-view/components/main-button-content.vue.d.ts +11 -0
- package/lib/src/business/ap-view/components/menu-list-content.vue.d.ts +11 -0
- package/lib/src/business/hooks/usePageListAgGrid.d.ts +1 -1
- package/lib/src/business/hooks/usePageListAgGrid.js +1 -1
- package/lib/src/business/hooks/usePageListApGrid.js +1 -1
- package/lib/src/config-provider/config-provider-props.d.ts +14 -1
- package/lib/src/config-provider/config-provider.d.ts +31 -1
- package/lib/src/config-provider/hooks/use-global-config.d.ts +14 -1
- package/lib/src/config-provider/index.d.ts +52 -1
- package/lib/src/utils/config-provider-preset.d.ts +11 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/lib/src/work-order-modal/work-order-modal.vue.d.ts +11 -0
- package/package.json +3 -3
- package/theme/ap-pro-card/index.css +5 -5
- package/theme/ap-pro-card/index.less +5 -5
- package/theme/ap-value-select-card/index.css +3 -4
- package/theme/ap-value-select-card/index.less +3 -4
- package/theme/index.css +8 -9
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as le, inject as o, ref as h, watch as se, computed as re, createElementBlock as z, openBlock as _, normalizeClass as ie, unref as t, createElementVNode as r, createCommentVNode as A, toDisplayString as b, normalizeStyle as ce, createBlock as ue, withModifiers as pe, createVNode as de } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getName as
|
|
4
|
-
import { useOss as
|
|
5
|
-
import { fileMatchesAccept as
|
|
6
|
-
import { message as c, Progress as
|
|
7
|
-
import { DeleteOutlined as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
3
|
+
import { getName as ve, getReturnData as I } from "../utils/returnData.mjs";
|
|
4
|
+
import { useOss as fe, useOssInit as me } from "../hooks/useOss.mjs";
|
|
5
|
+
import { fileMatchesAccept as ge, getAcceptText as he } from "../utils/accept.mjs";
|
|
6
|
+
import { message as c, Progress as _e } from "@aplus-frontend/antdv";
|
|
7
|
+
import { DeleteOutlined as ke } from "@ant-design/icons-vue";
|
|
8
|
+
import j from "../assets/single-file-icon.png.mjs";
|
|
9
|
+
import { useLocale as we } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
10
|
import { useNamespace as ye } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
-
const
|
|
11
|
+
const De = ["accept"], Ue = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "state-un"
|
|
14
|
-
},
|
|
14
|
+
}, Fe = ["src"], Ce = { class: "state-un-title" }, Ee = { class: "state-un-subtitle" }, Se = {
|
|
15
15
|
key: 1,
|
|
16
16
|
class: "state-ing"
|
|
17
|
-
},
|
|
17
|
+
}, Ne = { class: "left" }, xe = ["src"], ze = { class: "center" }, Ae = { class: "center-progress" }, Ie = /* @__PURE__ */ le({
|
|
18
18
|
__name: "SingleFile",
|
|
19
|
-
setup(
|
|
20
|
-
const { t: s } =
|
|
21
|
-
|
|
19
|
+
setup(be, { expose: G }) {
|
|
20
|
+
const { t: s } = we(), { b: k } = ye("ap-upload-single-file"), { put: W, client: R } = fe(), w = o("theme"), H = o("dirName"), y = o("accept") || "*", D = o("maxSize") ?? 500, J = o("title") || s("ap.apUpload.clickOrDragUpload"), U = o("subTitle"), i = o("value"), F = o("needName"), u = o("uploadingCount"), B = o("beforeUpload"), M = o("customRequest"), K = o("getOssAccess"), Q = o("maxSizeErrorMsg"), X = o("acceptErrorMsg"), O = o("onRemove"), C = o("showUploadErrorMsg"), n = h(null);
|
|
21
|
+
se(
|
|
22
22
|
() => i?.value,
|
|
23
23
|
function(e) {
|
|
24
|
-
|
|
24
|
+
n.value === null && e && P(e);
|
|
25
25
|
},
|
|
26
26
|
{ immediate: !0 }
|
|
27
27
|
);
|
|
28
|
-
function
|
|
28
|
+
function P(e) {
|
|
29
29
|
e ? setTimeout(() => {
|
|
30
|
-
const a =
|
|
31
|
-
l.value = 3,
|
|
32
|
-
}) : (l.value = 1,
|
|
30
|
+
const a = ve(F, e);
|
|
31
|
+
l.value = 3, n.value = new File([e], a, {}), i.value = e;
|
|
32
|
+
}) : (l.value = 1, n.value = null, i.value = void 0);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
const l = h(1), v = h(0), f = h(null),
|
|
36
|
-
function
|
|
34
|
+
G({ setValue: P });
|
|
35
|
+
const l = h(1), v = h(0), f = h(null), T = re(() => n.value && i?.value);
|
|
36
|
+
function Y() {
|
|
37
37
|
l.value === 1 && f.value?.click();
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function L(e) {
|
|
40
40
|
e.preventDefault(), e.stopPropagation();
|
|
41
41
|
}
|
|
42
|
-
function Y(e) {
|
|
43
|
-
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
44
|
-
}
|
|
45
42
|
function Z(e) {
|
|
46
|
-
|
|
43
|
+
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
47
44
|
}
|
|
48
45
|
function ee(e) {
|
|
46
|
+
V(e);
|
|
47
|
+
}
|
|
48
|
+
function ae(e) {
|
|
49
49
|
if (e.preventDefault(), e.stopPropagation(), l.value !== 1)
|
|
50
50
|
return;
|
|
51
|
-
var a = e.dataTransfer, m = [],
|
|
51
|
+
var a = e.dataTransfer, m = [], $ = 0, q = a.files.length;
|
|
52
52
|
function p() {
|
|
53
|
-
|
|
53
|
+
$ === q - 1 && ee(m), $++;
|
|
54
54
|
}
|
|
55
55
|
if (a.items !== void 0)
|
|
56
|
-
for (var
|
|
57
|
-
var
|
|
58
|
-
if (
|
|
59
|
-
var
|
|
60
|
-
m.push(
|
|
56
|
+
for (var E = 0; E < a.items.length; E++) {
|
|
57
|
+
var S = a.items[E];
|
|
58
|
+
if (S.kind === "file" && S.webkitGetAsEntry().isFile) {
|
|
59
|
+
var ne = S.getAsFile();
|
|
60
|
+
m.push(ne), p();
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
else
|
|
64
|
-
for (let
|
|
65
|
-
var g = a.files[
|
|
64
|
+
for (let x = 0; x < q; x++) {
|
|
65
|
+
var g = a.files[x];
|
|
66
66
|
if (g.type)
|
|
67
67
|
m.push(g), p();
|
|
68
68
|
else
|
|
69
69
|
try {
|
|
70
|
-
var
|
|
71
|
-
|
|
70
|
+
var N = new FileReader();
|
|
71
|
+
N.readAsDataURL(g.slice(0, 3)), N.addEventListener(
|
|
72
72
|
"load",
|
|
73
73
|
function(d) {
|
|
74
74
|
console.warn(d, "load"), m.push(g), p();
|
|
75
75
|
},
|
|
76
76
|
!1
|
|
77
|
-
),
|
|
77
|
+
), N.addEventListener(
|
|
78
78
|
"error",
|
|
79
79
|
function(d) {
|
|
80
80
|
console.warn(d, "error"), c.warning(s("ap.apUpload.foldersNotSupported")), p();
|
|
@@ -86,41 +86,41 @@ const we = ["accept"], De = {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
async function
|
|
89
|
+
async function te(e) {
|
|
90
90
|
const a = e.target;
|
|
91
|
-
await
|
|
91
|
+
await V(a?.files), f.value && (f.value.value = "");
|
|
92
92
|
}
|
|
93
|
-
async function
|
|
93
|
+
async function V(e) {
|
|
94
94
|
if (e?.length) {
|
|
95
95
|
if (e[0].size > D * 1024 * 1024) {
|
|
96
96
|
c.warning(
|
|
97
|
-
|
|
97
|
+
Q || s("ap.apUpload.maxUploadFileSize", {
|
|
98
98
|
maxSize: D
|
|
99
99
|
})
|
|
100
100
|
);
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
if (!
|
|
103
|
+
if (!ge(e[0], y)) {
|
|
104
104
|
c.warning(
|
|
105
|
-
|
|
105
|
+
X || s("ap.apUpload.fileFormatNotSupported")
|
|
106
106
|
);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
if (typeof
|
|
109
|
+
if (typeof B == "function" && await B(e[0]) === !1)
|
|
110
110
|
return;
|
|
111
|
-
if (
|
|
112
|
-
|
|
111
|
+
if (n.value = e[0], l.value = 2, v.value = 0, u.value++, typeof M == "function") {
|
|
112
|
+
M({
|
|
113
113
|
onProgress: (a) => {
|
|
114
114
|
v.value = a;
|
|
115
115
|
},
|
|
116
116
|
onError: (a) => {
|
|
117
|
-
c.warning(a || s("ap.apUpload.networkAnomaly")), l.value = 1,
|
|
117
|
+
C && c.warning(a || s("ap.apUpload.networkAnomaly")), l.value = 1, n.value = null, u.value--;
|
|
118
118
|
},
|
|
119
119
|
onSuccess: (a) => {
|
|
120
|
-
i.value =
|
|
120
|
+
i.value = I(
|
|
121
121
|
F,
|
|
122
122
|
a,
|
|
123
|
-
|
|
123
|
+
n.value.name
|
|
124
124
|
), l.value = 3, u.value--;
|
|
125
125
|
},
|
|
126
126
|
file: e[0]
|
|
@@ -128,98 +128,98 @@ const we = ["accept"], De = {
|
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
try {
|
|
131
|
-
await
|
|
132
|
-
file:
|
|
133
|
-
dirName:
|
|
134
|
-
oss:
|
|
131
|
+
await me(K), W({
|
|
132
|
+
file: n.value,
|
|
133
|
+
dirName: H,
|
|
134
|
+
oss: R,
|
|
135
135
|
successCallBack(a) {
|
|
136
|
-
i.value =
|
|
136
|
+
i.value = I(
|
|
137
137
|
F,
|
|
138
138
|
a,
|
|
139
|
-
|
|
139
|
+
n.value.name
|
|
140
140
|
), l.value = 3, u.value--;
|
|
141
141
|
},
|
|
142
142
|
errorCallBack(a) {
|
|
143
|
-
c.warning(a || s("ap.apUpload.networkAnomaly")), l.value = 1,
|
|
143
|
+
C && c.warning(a || s("ap.apUpload.networkAnomaly")), l.value = 1, n.value = null, u.value--;
|
|
144
144
|
},
|
|
145
145
|
progressCallBack(a) {
|
|
146
146
|
v.value = a;
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
} catch (a) {
|
|
150
|
-
c.warning(
|
|
150
|
+
C && c.warning(
|
|
151
151
|
typeof a?.message == "string" ? a.message : s("ap.apUpload.networkAnomaly")
|
|
152
|
-
), l.value = 1,
|
|
152
|
+
), l.value = 1, n.value = null, u.value--;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
156
|
+
function oe() {
|
|
157
|
+
O && O?.(n.value), n.value && !i?.value && R.pauseUpload(), l.value = 1, n.value = null, i.value = void 0;
|
|
158
158
|
}
|
|
159
|
-
return (e, a) => (_(),
|
|
160
|
-
class:
|
|
159
|
+
return (e, a) => (_(), z("div", {
|
|
160
|
+
class: ie({
|
|
161
161
|
[t(k)()]: !0,
|
|
162
|
-
[t(k)("admin")]: t(
|
|
162
|
+
[t(k)("admin")]: t(w) === "admin",
|
|
163
163
|
[t(k)("un")]: l.value === 1
|
|
164
164
|
}),
|
|
165
|
-
onClick:
|
|
166
|
-
onDragenter:
|
|
167
|
-
onDragover:
|
|
168
|
-
onDragleave:
|
|
169
|
-
onDrop:
|
|
165
|
+
onClick: Y,
|
|
166
|
+
onDragenter: L,
|
|
167
|
+
onDragover: Z,
|
|
168
|
+
onDragleave: L,
|
|
169
|
+
onDrop: ae
|
|
170
170
|
}, [
|
|
171
171
|
r("input", {
|
|
172
172
|
ref_key: "fileRef",
|
|
173
173
|
ref: f,
|
|
174
174
|
style: { display: "none" },
|
|
175
175
|
type: "file",
|
|
176
|
-
accept: t(
|
|
177
|
-
onChange:
|
|
178
|
-
}, null, 40,
|
|
179
|
-
l.value === 1 ? (_(),
|
|
176
|
+
accept: t(y),
|
|
177
|
+
onChange: te
|
|
178
|
+
}, null, 40, De),
|
|
179
|
+
l.value === 1 ? (_(), z("div", Ue, [
|
|
180
180
|
r("img", {
|
|
181
181
|
class: "state-un-icon",
|
|
182
|
-
src: t(
|
|
183
|
-
}, null, 8,
|
|
184
|
-
r("div",
|
|
185
|
-
r("div",
|
|
186
|
-
t(
|
|
182
|
+
src: t(j)
|
|
183
|
+
}, null, 8, Fe),
|
|
184
|
+
r("div", Ce, b(t(J)), 1),
|
|
185
|
+
r("div", Ee, b(typeof t(U) == "string" && t(U).length > 0 ? t(U) : `${t(s)("ap.apUpload.supportExtension")}:${t(he)(
|
|
186
|
+
t(y)
|
|
187
187
|
)},${t(s)("ap.apUpload.maxWarnUploadFileSize", {
|
|
188
188
|
maxSize: t(D)
|
|
189
189
|
})}`), 1)
|
|
190
|
-
])) :
|
|
191
|
-
[2, 3].includes(l.value) ? (_(),
|
|
192
|
-
r("div",
|
|
193
|
-
r("img", { src: t(
|
|
190
|
+
])) : A("", !0),
|
|
191
|
+
[2, 3].includes(l.value) ? (_(), z("div", Se, [
|
|
192
|
+
r("div", Ne, [
|
|
193
|
+
r("img", { src: t(j) }, null, 8, xe)
|
|
194
194
|
]),
|
|
195
|
-
r("div",
|
|
195
|
+
r("div", ze, [
|
|
196
196
|
r("div", {
|
|
197
197
|
class: "center-title",
|
|
198
|
-
style:
|
|
199
|
-
color:
|
|
198
|
+
style: ce({
|
|
199
|
+
color: T.value ? "#0070FF" : "#182948"
|
|
200
200
|
})
|
|
201
|
-
},
|
|
202
|
-
r("div",
|
|
203
|
-
|
|
201
|
+
}, b(n.value?.name), 5),
|
|
202
|
+
r("div", Ae, [
|
|
203
|
+
T.value ? A("", !0) : (_(), ue(t(_e), {
|
|
204
204
|
key: 0,
|
|
205
205
|
percent: v.value,
|
|
206
206
|
size: 4,
|
|
207
207
|
"show-info": !1,
|
|
208
|
-
"trail-color": t(
|
|
209
|
-
"stroke-color": t(
|
|
208
|
+
"trail-color": t(w) === "admin" ? "#D9D9D9" : "#DEE4ED",
|
|
209
|
+
"stroke-color": t(w) === "admin" ? "#34B77C" : "#0070FF"
|
|
210
210
|
}, null, 8, ["percent", "trail-color", "stroke-color"]))
|
|
211
211
|
])
|
|
212
212
|
]),
|
|
213
213
|
r("div", {
|
|
214
214
|
class: "right",
|
|
215
|
-
onClick:
|
|
215
|
+
onClick: pe(oe, ["stop"])
|
|
216
216
|
}, [
|
|
217
|
-
|
|
217
|
+
de(t(ke))
|
|
218
218
|
])
|
|
219
|
-
])) :
|
|
219
|
+
])) : A("", !0)
|
|
220
220
|
], 34));
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
223
|
export {
|
|
224
|
-
|
|
224
|
+
Ie as default
|
|
225
225
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Popover as
|
|
3
|
-
import { PlusOutlined as q } from "@ant-design/icons-vue";
|
|
1
|
+
import { defineComponent as z, ref as I, computed as T, createElementBlock as r, openBlock as a, normalizeStyle as A, normalizeClass as d, unref as s, createVNode as b, withCtx as V, createElementVNode as c, createCommentVNode as y, Fragment as N, renderList as R, withModifiers as f, renderSlot as u, createTextVNode as g, toDisplayString as h, createBlock as L } from "vue";
|
|
2
|
+
import { Popover as j } from "@aplus-frontend/antdv";
|
|
3
|
+
import { PlusOutlined as G, InfoCircleFilled as q } from "@ant-design/icons-vue";
|
|
4
4
|
import { IconApAdLinePoor as J } from "@aplus-frontend/icon";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
6
|
import { useNamespace as Q } from "../../config-provider/hooks/use-namespace.mjs";
|
|
7
7
|
import { useGlobalConfig as U } from "../../config-provider/hooks/use-global-config.mjs";
|
|
8
|
-
const W = ["onClick"], X = { class: "label" }, Y = { class: "value" }, Z = ["onClick"],
|
|
8
|
+
const W = ["onClick"], X = { class: "label" }, Y = { class: "value" }, Z = ["onClick"], _ = ["onClick"], x = { class: "label" }, ee = { class: "value" }, te = { class: "text" }, re = /* @__PURE__ */ z({
|
|
9
9
|
name: "ApValueSelectCard",
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: {
|
|
@@ -24,165 +24,162 @@ const W = ["onClick"], X = { class: "label" }, Y = { class: "value" }, Z = ["onC
|
|
|
24
24
|
wrapperStyle: { type: [Boolean, null, String, Object, Array] }
|
|
25
25
|
},
|
|
26
26
|
emits: ["update:selectedKeys", "update:highlightedKeys", "change", "select", "remove", "highlight"],
|
|
27
|
-
setup(v, { expose:
|
|
28
|
-
const
|
|
27
|
+
setup(v, { expose: F, emit: H }) {
|
|
28
|
+
const o = H, l = v, { b: n, m: D } = Q("ap-value-select-card"), E = U("uiMode", "aplus"), M = I(null), p = I(!1), K = T(() => l.options), C = T(() => K.value.filter(
|
|
29
29
|
(e) => l.selectedKeys.includes(e.key)
|
|
30
30
|
)), B = (e) => l.selectedKeys.includes(e), S = (e) => l.highlightedKeys.includes(e), $ = (e) => {
|
|
31
|
-
l.selectedKeys.includes(e) ? k(e) :
|
|
32
|
-
},
|
|
31
|
+
l.selectedKeys.includes(e) ? k(e) : O(e);
|
|
32
|
+
}, O = (e) => {
|
|
33
33
|
if (l.maxSelected && l.selectedKeys.length >= l.maxSelected)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const i = [...l.selectedKeys, e];
|
|
36
|
+
o("update:selectedKeys", i), o("change", i), o("select", e), l.highlightedKeys.includes(e) || w(e);
|
|
37
37
|
}, k = (e) => {
|
|
38
38
|
if (l.selectedKeys.length <= 1 || l.highlightedKeys.length <= 1 && l.highlightedKeys.includes(e))
|
|
39
39
|
return;
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
40
|
+
const i = l.selectedKeys.filter((t) => t !== e);
|
|
41
|
+
if (o("update:selectedKeys", i), o("change", i), o("remove", e), l.highlightedKeys.includes(e)) {
|
|
42
|
+
const t = l.highlightedKeys.filter((m) => m !== e);
|
|
43
|
+
o("update:highlightedKeys", t), o("highlight", t);
|
|
44
44
|
}
|
|
45
45
|
}, w = (e) => {
|
|
46
|
-
let
|
|
46
|
+
let i;
|
|
47
47
|
if (l.highlightedKeys.includes(e))
|
|
48
48
|
if (l.highlightedKeys.length > 1)
|
|
49
|
-
|
|
49
|
+
i = l.highlightedKeys.filter((t) => t !== e);
|
|
50
50
|
else
|
|
51
51
|
return;
|
|
52
52
|
else
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
e || (
|
|
53
|
+
i = [...l.highlightedKeys, e];
|
|
54
|
+
o("update:highlightedKeys", i), o("highlight", i);
|
|
55
|
+
}, P = (e) => {
|
|
56
|
+
e || (p.value = e);
|
|
57
57
|
};
|
|
58
|
-
return
|
|
59
|
-
popoverVisible:
|
|
58
|
+
return F({
|
|
59
|
+
popoverVisible: p,
|
|
60
60
|
allOptions: K,
|
|
61
61
|
selectedOptions: C,
|
|
62
62
|
isSelected: B,
|
|
63
63
|
isHighlighted: S,
|
|
64
64
|
toggleOption: $,
|
|
65
|
-
addOption:
|
|
65
|
+
addOption: O,
|
|
66
66
|
removeOption: k,
|
|
67
67
|
highlightOption: w
|
|
68
|
-
}), (e,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
}), (e, i) => (a(), r("div", {
|
|
69
|
+
class: d([s(n)(), `${s(D)(s(E))}`]),
|
|
70
|
+
style: A({
|
|
71
|
+
...e.wrapperStyle,
|
|
72
|
+
"--ap-value-select-card-column-count": e.maxRowDisplay
|
|
73
|
+
})
|
|
74
|
+
}, [
|
|
75
|
+
b(s(j), {
|
|
76
|
+
open: p.value,
|
|
77
|
+
trigger: "click",
|
|
78
|
+
placement: "bottomRight",
|
|
79
|
+
arrow: !1,
|
|
80
|
+
"get-popup-container": e.getContainer,
|
|
81
|
+
onOpenChange: P
|
|
82
|
+
}, {
|
|
83
|
+
content: V(() => [
|
|
84
|
+
c("div", {
|
|
85
|
+
class: d(s(n)("popover"))
|
|
86
|
+
}, [
|
|
87
|
+
e.popoverTitle ? (a(), r("div", {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: d(s(n)("title"))
|
|
88
90
|
}, [
|
|
89
|
-
e.
|
|
91
|
+
e.showTitleIcon ? (a(), L(s(q), {
|
|
90
92
|
key: 0,
|
|
91
|
-
class: d(s(n)("title"))
|
|
92
|
-
}, [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, null, 8, ["class"])) : y("", !0),
|
|
97
|
-
p(" " + g(e.popoverTitle), 1)
|
|
98
|
-
], 2)) : y("", !0),
|
|
99
|
-
u("div", {
|
|
100
|
-
class: d(s(n)("list"))
|
|
101
|
-
}, [
|
|
102
|
-
(a(!0), c(N, null, R(K.value, (t) => (a(), c("div", {
|
|
103
|
-
key: t.key,
|
|
104
|
-
class: d([
|
|
105
|
-
s(n)("list-item"),
|
|
106
|
-
"all",
|
|
107
|
-
{
|
|
108
|
-
select: B(t.key),
|
|
109
|
-
disabled: e.maxSelected && e.selectedKeys.length >= e.maxSelected
|
|
110
|
-
}
|
|
111
|
-
]),
|
|
112
|
-
onClick: f((O) => $(t.key), ["stop"])
|
|
113
|
-
}, [
|
|
114
|
-
u("div", X, [
|
|
115
|
-
h(e.$slots, "popover-label", { option: t }, () => [
|
|
116
|
-
p(g(t.label), 1)
|
|
117
|
-
])
|
|
118
|
-
]),
|
|
119
|
-
u("div", Y, [
|
|
120
|
-
h(e.$slots, "popover-value", { option: t }, () => [
|
|
121
|
-
p(g(t.value), 1)
|
|
122
|
-
])
|
|
123
|
-
])
|
|
124
|
-
], 10, W))), 128))
|
|
125
|
-
], 2)
|
|
126
|
-
], 2)
|
|
127
|
-
]),
|
|
128
|
-
default: F(() => [
|
|
129
|
-
u("div", {
|
|
93
|
+
class: d(s(n)("title-icon"))
|
|
94
|
+
}, null, 8, ["class"])) : y("", !0),
|
|
95
|
+
g(" " + h(e.popoverTitle), 1)
|
|
96
|
+
], 2)) : y("", !0),
|
|
97
|
+
c("div", {
|
|
130
98
|
class: d(s(n)("list"))
|
|
131
99
|
}, [
|
|
132
|
-
(a(!0),
|
|
100
|
+
(a(!0), r(N, null, R(K.value, (t) => (a(), r("div", {
|
|
133
101
|
key: t.key,
|
|
134
|
-
ref_for: !0,
|
|
135
|
-
ref_key: "listItemRef",
|
|
136
|
-
ref: P,
|
|
137
102
|
class: d([
|
|
138
103
|
s(n)("list-item"),
|
|
104
|
+
"all",
|
|
139
105
|
{
|
|
140
|
-
select:
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
t.customClass
|
|
106
|
+
select: B(t.key),
|
|
107
|
+
disabled: e.maxSelected && e.selectedKeys.length >= e.maxSelected
|
|
108
|
+
}
|
|
144
109
|
]),
|
|
145
|
-
|
|
146
|
-
onClick: f((O) => w(t.key), ["stop"])
|
|
110
|
+
onClick: f((m) => $(t.key), ["stop"])
|
|
147
111
|
}, [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
onClick: f((O) => k(t.key), ["stop"])
|
|
152
|
-
}, [
|
|
153
|
-
h(e.$slots, "close-icon", {}, () => [
|
|
154
|
-
b(s(J))
|
|
155
|
-
])
|
|
156
|
-
], 10, x)) : y("", !0),
|
|
157
|
-
u("div", ee, [
|
|
158
|
-
h(e.$slots, "label", { option: t }, () => [
|
|
159
|
-
p(g(t.label), 1)
|
|
112
|
+
c("div", X, [
|
|
113
|
+
u(e.$slots, "popover-label", { option: t }, () => [
|
|
114
|
+
g(h(t.label), 1)
|
|
160
115
|
])
|
|
161
116
|
]),
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
117
|
+
c("div", Y, [
|
|
118
|
+
u(e.$slots, "popover-value", { option: t }, () => [
|
|
119
|
+
g(h(t.value), 1)
|
|
165
120
|
])
|
|
166
121
|
])
|
|
167
|
-
],
|
|
168
|
-
|
|
122
|
+
], 10, W))), 128))
|
|
123
|
+
], 2)
|
|
124
|
+
], 2)
|
|
125
|
+
]),
|
|
126
|
+
default: V(() => [
|
|
127
|
+
c("div", {
|
|
128
|
+
class: d(s(n)("list"))
|
|
129
|
+
}, [
|
|
130
|
+
(a(!0), r(N, null, R(C.value, (t) => (a(), r("div", {
|
|
131
|
+
key: t.key,
|
|
132
|
+
ref_for: !0,
|
|
133
|
+
ref_key: "listItemRef",
|
|
134
|
+
ref: M,
|
|
135
|
+
class: d([
|
|
136
|
+
s(n)("list-item"),
|
|
137
|
+
{
|
|
138
|
+
select: S(t.key),
|
|
139
|
+
custom: t.customClass
|
|
140
|
+
},
|
|
141
|
+
t.customClass
|
|
142
|
+
]),
|
|
143
|
+
style: A(e.getCardStyle(t.key)),
|
|
144
|
+
onClick: f((m) => w(t.key), ["stop"])
|
|
145
|
+
}, [
|
|
146
|
+
e.showCloseIcon && (!(e.highlightedKeys.length === 1 && S(t.key)) && C.value.length > 1) ? (a(), r("div", {
|
|
169
147
|
key: 0,
|
|
170
|
-
class: d(
|
|
171
|
-
onClick:
|
|
148
|
+
class: d(s(n)("list-item-close")),
|
|
149
|
+
onClick: f((m) => k(t.key), ["stop"])
|
|
172
150
|
}, [
|
|
173
|
-
|
|
174
|
-
b(s(
|
|
175
|
-
u("span", le, g(e.addButtonText), 1)
|
|
151
|
+
u(e.$slots, "close-icon", {}, () => [
|
|
152
|
+
b(s(J))
|
|
176
153
|
])
|
|
177
|
-
],
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
154
|
+
], 10, _)) : y("", !0),
|
|
155
|
+
c("div", x, [
|
|
156
|
+
u(e.$slots, "label", { option: t }, () => [
|
|
157
|
+
g(h(t.label), 1)
|
|
158
|
+
])
|
|
159
|
+
]),
|
|
160
|
+
c("div", ee, [
|
|
161
|
+
u(e.$slots, "value", { option: t }, () => [
|
|
162
|
+
g(h(t.value), 1)
|
|
163
|
+
])
|
|
164
|
+
])
|
|
165
|
+
], 14, Z))), 128)),
|
|
166
|
+
e.showAddButton && (!e.maxSelected || e.selectedKeys.length < e.maxSelected) ? (a(), r("div", {
|
|
167
|
+
key: 0,
|
|
168
|
+
class: d([s(n)("list-item"), "choose"]),
|
|
169
|
+
onClick: i[0] || (i[0] = f((t) => p.value = !0, ["stop"]))
|
|
170
|
+
}, [
|
|
171
|
+
u(e.$slots, "add-button", {}, () => [
|
|
172
|
+
b(s(G)),
|
|
173
|
+
c("span", te, h(e.addButtonText), 1)
|
|
174
|
+
])
|
|
175
|
+
], 2)) : y("", !0)
|
|
176
|
+
], 2)
|
|
177
|
+
]),
|
|
178
|
+
_: 3
|
|
179
|
+
}, 8, ["open", "get-popup-container"])
|
|
180
|
+
], 6));
|
|
184
181
|
}
|
|
185
182
|
});
|
|
186
183
|
export {
|
|
187
|
-
|
|
184
|
+
re as default
|
|
188
185
|
};
|