yahee-components 0.0.105 → 0.0.106
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/drop-down-condition/drop-down-condition.vue.js +5 -226
- package/es/drop-down-condition/drop-down-condition.vue2.js +314 -2
- package/package.json +1 -1
- package/types/src/drop-down-condition/drop-down-condition.d.ts +4 -0
- package/types/src/drop-down-condition/drop-down-condition.vue.d.ts +28 -14
- package/types/src/drop-down-condition/index.d.ts +24 -24
- package/types/src/installs.d.ts +24 -24
|
@@ -1,228 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { M2 as x } from "../utils/translate.js";
|
|
6
|
-
import { ElButton as P, ElDropdown as ie, ElCheckboxGroup as Y, ElCheckbox as $ } from "element-plus";
|
|
7
|
-
import "element-plus/theme-chalk/src/base.scss";
|
|
8
|
-
import "element-plus/theme-chalk/src/button.scss";
|
|
9
|
-
import "element-plus/theme-chalk/src/checkbox.scss";
|
|
10
|
-
import "element-plus/theme-chalk/src/checkbox-group.scss";
|
|
11
|
-
import "element-plus/theme-chalk/src/button-group.scss";
|
|
12
|
-
import "element-plus/theme-chalk/src/popper.scss";
|
|
13
|
-
import "element-plus/theme-chalk/src/scrollbar.scss";
|
|
14
|
-
import "element-plus/theme-chalk/src/dropdown.scss";
|
|
15
|
-
const de = { class: "yahee-drop-down-condition" }, fe = { key: 0 }, ve = { style: { display: "flex", "align-items": "center", outline: "none" } }, pe = { key: 0 }, he = { style: { display: "flex", width: "auto", padding: "10px" } }, me = ["onClick"], ge = { class: "scrollable-container" }, ye = { key: 0 }, Ae = /* @__PURE__ */ se({
|
|
16
|
-
name: "YaheeDropDownCondition",
|
|
17
|
-
__name: "drop-down-condition",
|
|
18
|
-
props: {
|
|
19
|
-
filterList: {},
|
|
20
|
-
totalCount: {},
|
|
21
|
-
level1Count: {},
|
|
22
|
-
level2Count: {},
|
|
23
|
-
filterKey: {},
|
|
24
|
-
enumEntity: {},
|
|
25
|
-
noNeedRefreshNumFilterName: {},
|
|
26
|
-
initFilters: { type: Function }
|
|
27
|
-
},
|
|
28
|
-
emits: ["filterChange", "setNoNeedRefreshNumFilterName"],
|
|
29
|
-
setup(H, { emit: J }) {
|
|
30
|
-
const Q = g(), n = _({});
|
|
31
|
-
let j = _({});
|
|
32
|
-
const r = _({}), p = _({}), h = g(!0), m = H, M = J, { filterKey: w, filterList: V, totalCount: C, level1Count: F, level2Count: S, noNeedRefreshNumFilterName: O } = ae(m), T = g(s.get(C, "value", 0)), B = g(s.get(F, "value", [])), D = g(s.get(S, "value", [])), c = g();
|
|
33
|
-
function q(t) {
|
|
34
|
-
const { text: o, value: e } = t, l = n[o];
|
|
35
|
-
s.isNil(l) || s.isEmpty(l) ? n[o] = [e] : n[o] = [], p[o] = !p[o], p[o] ? (oe(o), r[o] = U.getBackgroundColor(!0), h.value = !1) : (ne(o), r[t.text] = {}, h.value = !0), h.value = L(), A();
|
|
36
|
-
}
|
|
37
|
-
function L() {
|
|
38
|
-
const t = c.value.filter((l) => !s.isEmpty(l.subs)).flatMap((l) => l.subs).length, o = c.value.filter((l) => s.isEmpty(l.subs)).length;
|
|
39
|
-
return Object.values(n).map((l) => l.length).reduce((l, v) => l + v, 0) === t + o || s.isEmpty(Object.values(n).flat());
|
|
40
|
-
}
|
|
41
|
-
function X(t) {
|
|
42
|
-
s.isEmpty(n[t.text]) ? (r[t.text] = {}, p[t.text] = !1) : n[t.text].length === s.get(t, "subs.length", 1) ? (r[t.text] = U.getBackgroundColor(!0), p[t.text] = !0) : r[t.text] = {
|
|
43
|
-
backgroundColor: "#0F7535",
|
|
44
|
-
color: "#fff",
|
|
45
|
-
borderColor: "#0F7535"
|
|
46
|
-
}, h.value = L(), A();
|
|
47
|
-
}
|
|
48
|
-
function Z() {
|
|
49
|
-
h.value = L(), A();
|
|
50
|
-
}
|
|
51
|
-
function A() {
|
|
52
|
-
M("setNoNeedRefreshNumFilterName", w.value);
|
|
53
|
-
}
|
|
54
|
-
function ee() {
|
|
55
|
-
h.value = !0;
|
|
56
|
-
for (const t in r)
|
|
57
|
-
r[t] = {};
|
|
58
|
-
for (const t in n)
|
|
59
|
-
delete n[t];
|
|
60
|
-
for (const t in p)
|
|
61
|
-
delete p[t];
|
|
62
|
-
I();
|
|
63
|
-
}
|
|
64
|
-
const te = (t) => U.getBackgroundColor(t);
|
|
65
|
-
function le(t) {
|
|
66
|
-
if (t)
|
|
67
|
-
j = s.cloneDeep(n);
|
|
68
|
-
else {
|
|
69
|
-
if (s.isEqual(j, n))
|
|
70
|
-
return;
|
|
71
|
-
I();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function I() {
|
|
75
|
-
M("filterChange", [
|
|
76
|
-
{
|
|
77
|
-
filterKey: w.value,
|
|
78
|
-
checkedValues: Object.values(n).flat()
|
|
79
|
-
}
|
|
80
|
-
]);
|
|
81
|
-
}
|
|
82
|
-
function oe(t) {
|
|
83
|
-
const o = c.value.find((e) => e.text === t);
|
|
84
|
-
o && o.subs && (n[t] = o.subs.map((e) => e.value));
|
|
85
|
-
}
|
|
86
|
-
function ne(t) {
|
|
87
|
-
n[t] = [];
|
|
88
|
-
}
|
|
89
|
-
function ue() {
|
|
90
|
-
if (V.value && V.value.length > 0) {
|
|
91
|
-
c.value = [...V.value];
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const t = `filter-key-${m.enumEntity}`, o = G.getWithExpireTime(t);
|
|
95
|
-
o ? c.value = o : m.initFilters && m.initFilters(m.enumEntity).then((e) => {
|
|
96
|
-
c.value = e.data, G.setWithExpireTime(t, c.value, 1200 * 1e3);
|
|
97
|
-
}).catch((e) => {
|
|
98
|
-
console.error(`获取${m.enumEntity}筛选列表失败:`, e);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return re(
|
|
102
|
-
[() => C.value, () => F.value, () => S.value],
|
|
103
|
-
([t, o, e], [l, v, R]) => {
|
|
104
|
-
console.log(t, o, e), console.log(l, v, R), (!O.value || !s.eq(O.value, w.value)) && (T.value = C.value, B.value = F.value, D.value = S.value);
|
|
105
|
-
}
|
|
106
|
-
), ce(() => {
|
|
107
|
-
ue();
|
|
108
|
-
}), (t, o) => (a(), i("div", de, [
|
|
109
|
-
W(u(P), {
|
|
110
|
-
size: "small",
|
|
111
|
-
class: "el-button el-button--small custom-total-button",
|
|
112
|
-
style: z(te(h.value)),
|
|
113
|
-
onClick: ee
|
|
114
|
-
}, {
|
|
115
|
-
default: d(() => [
|
|
116
|
-
k(f(u(x)("全部")) + " ", 1),
|
|
117
|
-
u(C) ? (a(), i("span", fe, "(" + f(T.value) + ")", 1)) : N("", !0)
|
|
118
|
-
]),
|
|
119
|
-
_: 1
|
|
120
|
-
}, 8, ["style"]),
|
|
121
|
-
W(u(ie), {
|
|
122
|
-
ref_key: "dropdown1",
|
|
123
|
-
ref: Q,
|
|
124
|
-
"popper-class": "custom-dropdown",
|
|
125
|
-
onVisibleChange: le
|
|
126
|
-
}, {
|
|
127
|
-
dropdown: d(() => [
|
|
128
|
-
E("div", he, [
|
|
129
|
-
(a(!0), i(b, null, K(c.value, (e) => (a(), y(u(Y), {
|
|
130
|
-
key: e.value,
|
|
131
|
-
modelValue: n[e.text],
|
|
132
|
-
"onUpdate:modelValue": (l) => n[e.text] = l,
|
|
133
|
-
size: "small",
|
|
134
|
-
class: "checkbox-group inner-checkbox-group custom-dropdown-checkbox-group",
|
|
135
|
-
onChange: (l) => X(e)
|
|
136
|
-
}, {
|
|
137
|
-
default: d(() => [
|
|
138
|
-
u(s).isNil(e.subs) ? (a(), y(u($), {
|
|
139
|
-
key: 1,
|
|
140
|
-
value: e.value,
|
|
141
|
-
class: "checkbox custom-dropdown-button",
|
|
142
|
-
border: ""
|
|
143
|
-
}, {
|
|
144
|
-
default: d(() => [
|
|
145
|
-
k(f(u(x)(e.text)), 1)
|
|
146
|
-
]),
|
|
147
|
-
_: 2
|
|
148
|
-
}, 1032, ["value"])) : (a(), i(b, { key: 0 }, [
|
|
149
|
-
E("span", {
|
|
150
|
-
class: "el-button custom-dropdown-button el-button--small inner-el-button",
|
|
151
|
-
style: z(r[e.text]),
|
|
152
|
-
onClick: (l) => q(e)
|
|
153
|
-
}, f(u(x)(e.text)), 13, me),
|
|
154
|
-
E("div", ge, [
|
|
155
|
-
(a(!0), i(b, null, K(e.subs, (l) => (a(), y(u($), {
|
|
156
|
-
key: l.value,
|
|
157
|
-
class: "checkbox custom-dropdown-button",
|
|
158
|
-
value: l.value,
|
|
159
|
-
border: ""
|
|
160
|
-
}, {
|
|
161
|
-
default: d(() => {
|
|
162
|
-
var v;
|
|
163
|
-
return [
|
|
164
|
-
k(f(u(x)(l.text)), 1),
|
|
165
|
-
u(s).isEmpty(D.value) ? N("", !0) : (a(), i("span", ye, "(" + f((v = D.value.filter((R) => R.value == l.value)[0]) == null ? void 0 : v.count) + ")", 1))
|
|
166
|
-
];
|
|
167
|
-
}),
|
|
168
|
-
_: 2
|
|
169
|
-
}, 1032, ["value"]))), 128))
|
|
170
|
-
])
|
|
171
|
-
], 64))
|
|
172
|
-
]),
|
|
173
|
-
_: 2
|
|
174
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]))), 128))
|
|
175
|
-
])
|
|
176
|
-
]),
|
|
177
|
-
default: d(() => [
|
|
178
|
-
E("div", ve, [
|
|
179
|
-
(a(!0), i(b, null, K(c.value, (e) => (a(), i(b, null, [
|
|
180
|
-
e.isCheckbox ? (a(), y(u(Y), {
|
|
181
|
-
key: e.value,
|
|
182
|
-
modelValue: n[e.text],
|
|
183
|
-
"onUpdate:modelValue": (l) => n[e.text] = l,
|
|
184
|
-
class: "checkbox-group",
|
|
185
|
-
size: "small",
|
|
186
|
-
onChange: Z
|
|
187
|
-
}, {
|
|
188
|
-
default: d(() => [
|
|
189
|
-
e.isCheckbox ? (a(), y(u($), {
|
|
190
|
-
key: 0,
|
|
191
|
-
class: "custom-dropdown-button",
|
|
192
|
-
value: e.value,
|
|
193
|
-
border: ""
|
|
194
|
-
}, {
|
|
195
|
-
default: d(() => [
|
|
196
|
-
k(f(u(x)(e.text)), 1)
|
|
197
|
-
]),
|
|
198
|
-
_: 2
|
|
199
|
-
}, 1032, ["value"])) : N("", !0)
|
|
200
|
-
]),
|
|
201
|
-
_: 2
|
|
202
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), y(u(P), {
|
|
203
|
-
key: e.text,
|
|
204
|
-
style: z(r[e.text]),
|
|
205
|
-
class: "custom-dropdown-button",
|
|
206
|
-
size: "small",
|
|
207
|
-
onClick: (l) => q(e)
|
|
208
|
-
}, {
|
|
209
|
-
default: d(() => {
|
|
210
|
-
var l;
|
|
211
|
-
return [
|
|
212
|
-
k(f(u(x)(e.text)) + " ", 1),
|
|
213
|
-
u(s).isEmpty(B.value) ? N("", !0) : (a(), i("span", pe, "(" + f((l = B.value.filter((v) => v.value == e.value)[0]) == null ? void 0 : l.count) + ")", 1))
|
|
214
|
-
];
|
|
215
|
-
}),
|
|
216
|
-
_: 2
|
|
217
|
-
}, 1032, ["style", "onClick"]))
|
|
218
|
-
], 64))), 256))
|
|
219
|
-
])
|
|
220
|
-
]),
|
|
221
|
-
_: 1
|
|
222
|
-
}, 512)
|
|
223
|
-
]));
|
|
224
|
-
}
|
|
225
|
-
});
|
|
1
|
+
import o from "./drop-down-condition.vue2.js";
|
|
2
|
+
import "E:/工作/项目代码/common_componentsweb/packages/components/src/drop-down-condition/drop-down-condition.vue?vue&type=style&index=0&scoped=f18be258&lang.scss";
|
|
3
|
+
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const i = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f18be258"]]);
|
|
226
5
|
export {
|
|
227
|
-
|
|
6
|
+
i as default
|
|
228
7
|
};
|
|
@@ -1,4 +1,316 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as me, ref as V, reactive as D, toRefs as le, watch as Y, onMounted as _e, resolveComponent as E, createElementBlock as v, openBlock as n, createVNode as O, normalizeStyle as U, withCtx as i, createTextVNode as k, createCommentVNode as $, toDisplayString as d, unref as a, createElementVNode as S, Fragment as y, renderList as B, createBlock as _ } from "vue";
|
|
2
|
+
import s from "../_virtual/lodash.js";
|
|
3
|
+
import { stylesUtils as A } from "../utils/style.js";
|
|
4
|
+
import { storage as oe } from "../utils/storage.js";
|
|
5
|
+
import { M2 as h } from "../utils/translate.js";
|
|
6
|
+
const be = { class: "yahee-drop-down-condition" }, ke = { key: 0 }, ye = { style: { display: "flex", "align-items": "center", outline: "none" } }, xe = { key: 0 }, Ce = { style: { display: "flex", width: "auto", padding: "10px" } }, Ne = ["onClick"], Ve = { class: "scrollable-container" }, we = { key: 0 }, Ee = ["onClick"], Se = { class: "scrollable-container" }, Fe = { key: 0 }, Oe = /* @__PURE__ */ me({
|
|
7
|
+
name: "YaheeDropDownCondition",
|
|
8
|
+
__name: "drop-down-condition",
|
|
9
|
+
props: {
|
|
10
|
+
mode: {},
|
|
11
|
+
filterList: {},
|
|
12
|
+
totalCount: {},
|
|
13
|
+
level1Count: {},
|
|
14
|
+
level2Count: {},
|
|
15
|
+
filterKey: {},
|
|
16
|
+
enumEntity: {},
|
|
17
|
+
noNeedRefreshNumFilterName: {},
|
|
18
|
+
initFilters: { type: Function }
|
|
19
|
+
},
|
|
20
|
+
emits: ["filterChange", "setNoNeedRefreshNumFilterName"],
|
|
21
|
+
setup(ne, { emit: ue }) {
|
|
22
|
+
const ae = V(), r = D({}), R = D({}), b = D({}), x = D({}), m = V(!0), f = V([]), c = V(""), C = ne, { mode: g = "multiple" } = le(C), G = ue, { filterKey: L, filterList: j, totalCount: K, level1Count: H, level2Count: J, noNeedRefreshNumFilterName: Q } = le(C), X = V(s.get(K, "value", 0)), M = V(s.get(H, "value", [])), F = V(s.get(J, "value", []));
|
|
23
|
+
function se() {
|
|
24
|
+
if (j.value && j.value.length > 0) {
|
|
25
|
+
f.value = [...j.value];
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const e = `filter-key-${C.enumEntity}`, l = oe.getWithExpireTime(e);
|
|
29
|
+
l ? f.value = l : C.initFilters && C.initFilters(C.enumEntity).then((u) => {
|
|
30
|
+
f.value = u.data, oe.setWithExpireTime(e, f.value, 1200 * 1e3);
|
|
31
|
+
}).catch((u) => {
|
|
32
|
+
console.error(`获取${C.enumEntity}筛选列表失败:`, u);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function T(e) {
|
|
36
|
+
return g.value === "single" ? c.value === e.value ? A.getBackgroundColor(!0) : {} : b[e.text] || {};
|
|
37
|
+
}
|
|
38
|
+
function q(e) {
|
|
39
|
+
const { text: l, value: u } = e;
|
|
40
|
+
if (g.value === "single") {
|
|
41
|
+
c.value === u ? (c.value = "", m.value = !0) : (c.value = u, m.value = !1), w();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const p = r[l];
|
|
45
|
+
s.isNil(p) || s.isEmpty(p) ? r[l] = [u] : r[l] = [], x[l] = !x[l], x[l] ? (pe(l), b[l] = A.getBackgroundColor(!0)) : (ge(l), b[e.text] = {}), m.value = z(), w();
|
|
46
|
+
}
|
|
47
|
+
function z() {
|
|
48
|
+
if (!f.value.length) return !0;
|
|
49
|
+
if (g.value === "single")
|
|
50
|
+
return c.value === "";
|
|
51
|
+
const e = f.value.filter((p) => !s.isEmpty(p.subs)).flatMap((p) => p.subs).length, l = f.value.filter((p) => s.isEmpty(p.subs)).length, u = Object.values(r).flat().length;
|
|
52
|
+
return u === e + l || u === 0;
|
|
53
|
+
}
|
|
54
|
+
function re(e) {
|
|
55
|
+
const l = r[e.text] || [], u = s.get(e, "subs.length", 1);
|
|
56
|
+
s.isEmpty(l) ? (b[e.text] = {}, x[e.text] = !1) : l.length === u ? (b[e.text] = A.getBackgroundColor(!0), x[e.text] = !0) : b[e.text] = {
|
|
57
|
+
backgroundColor: "#0F7535",
|
|
58
|
+
color: "#fff",
|
|
59
|
+
borderColor: "#0F7535"
|
|
60
|
+
}, m.value = z(), w();
|
|
61
|
+
}
|
|
62
|
+
function ce(e) {
|
|
63
|
+
m.value = !1, w();
|
|
64
|
+
}
|
|
65
|
+
function ie() {
|
|
66
|
+
m.value = z(), w();
|
|
67
|
+
}
|
|
68
|
+
function de() {
|
|
69
|
+
m.value = z(), w();
|
|
70
|
+
}
|
|
71
|
+
function w() {
|
|
72
|
+
G("setNoNeedRefreshNumFilterName", L.value);
|
|
73
|
+
}
|
|
74
|
+
function W() {
|
|
75
|
+
m.value = !0, g.value === "single" ? c.value = "" : (Object.keys(b).forEach((e) => {
|
|
76
|
+
b[e] = {};
|
|
77
|
+
}), Object.keys(r).forEach((e) => {
|
|
78
|
+
delete r[e];
|
|
79
|
+
}), Object.keys(x).forEach((e) => {
|
|
80
|
+
delete x[e];
|
|
81
|
+
})), Z();
|
|
82
|
+
}
|
|
83
|
+
const ve = (e) => A.getBackgroundColor(e);
|
|
84
|
+
function fe(e) {
|
|
85
|
+
if (e)
|
|
86
|
+
g.value === "single" ? R.singleValue = c.value : Object.assign(R, s.cloneDeep(r));
|
|
87
|
+
else {
|
|
88
|
+
let l = !1;
|
|
89
|
+
g.value === "single" ? l = R.singleValue !== c.value : l = !s.isEqual(R, r), l && Z();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function Z() {
|
|
93
|
+
let e = [];
|
|
94
|
+
g.value === "single" ? e = c.value ? [c.value] : [] : e = Object.values(r).flat(), G("filterChange", [
|
|
95
|
+
{
|
|
96
|
+
filterKey: L.value,
|
|
97
|
+
checkedValues: e
|
|
98
|
+
}
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
function pe(e) {
|
|
102
|
+
const l = f.value.find((u) => u.text === e);
|
|
103
|
+
l != null && l.subs && (r[e] = l.subs.map((u) => u.value));
|
|
104
|
+
}
|
|
105
|
+
function ge(e) {
|
|
106
|
+
r[e] = [];
|
|
107
|
+
}
|
|
108
|
+
return Y(
|
|
109
|
+
() => j.value,
|
|
110
|
+
(e) => {
|
|
111
|
+
e && e.length > 0 && (f.value = [...e], W());
|
|
112
|
+
},
|
|
113
|
+
{ deep: !0 }
|
|
114
|
+
), Y(
|
|
115
|
+
() => g.value,
|
|
116
|
+
() => {
|
|
117
|
+
W();
|
|
118
|
+
}
|
|
119
|
+
), Y(
|
|
120
|
+
[() => K.value, () => H.value, () => J.value],
|
|
121
|
+
([e, l, u]) => {
|
|
122
|
+
(!Q.value || !s.eq(Q.value, L.value)) && (X.value = e, M.value = l, F.value = u);
|
|
123
|
+
}
|
|
124
|
+
), _e(() => {
|
|
125
|
+
se();
|
|
126
|
+
}), (e, l) => {
|
|
127
|
+
const u = E("el-button"), p = E("el-checkbox"), ee = E("el-checkbox-group"), I = E("el-radio"), te = E("el-radio-group"), he = E("el-dropdown");
|
|
128
|
+
return n(), v("div", be, [
|
|
129
|
+
O(u, {
|
|
130
|
+
size: "small",
|
|
131
|
+
class: "el-button el-button--small custom-total-button",
|
|
132
|
+
style: U(ve(m.value)),
|
|
133
|
+
onClick: W
|
|
134
|
+
}, {
|
|
135
|
+
default: i(() => [
|
|
136
|
+
k(d(a(h)("全部")) + " ", 1),
|
|
137
|
+
a(K) ? (n(), v("span", ke, "(" + d(X.value) + ")", 1)) : $("", !0)
|
|
138
|
+
]),
|
|
139
|
+
_: 1
|
|
140
|
+
}, 8, ["style"]),
|
|
141
|
+
O(he, {
|
|
142
|
+
ref_key: "dropdown1",
|
|
143
|
+
ref: ae,
|
|
144
|
+
"popper-class": "custom-dropdown",
|
|
145
|
+
onVisibleChange: fe
|
|
146
|
+
}, {
|
|
147
|
+
dropdown: i(() => [
|
|
148
|
+
S("div", Ce, [
|
|
149
|
+
a(g) === "multiple" ? (n(!0), v(y, { key: 0 }, B(f.value, (t) => (n(), _(ee, {
|
|
150
|
+
key: t.value,
|
|
151
|
+
modelValue: r[t.text],
|
|
152
|
+
"onUpdate:modelValue": (o) => r[t.text] = o,
|
|
153
|
+
size: "small",
|
|
154
|
+
class: "checkbox-group inner-checkbox-group custom-dropdown-checkbox-group",
|
|
155
|
+
onChange: (o) => re(t)
|
|
156
|
+
}, {
|
|
157
|
+
default: i(() => [
|
|
158
|
+
a(s).isNil(t.subs) ? (n(), _(p, {
|
|
159
|
+
key: 1,
|
|
160
|
+
value: t.value,
|
|
161
|
+
class: "checkbox custom-dropdown-button",
|
|
162
|
+
border: ""
|
|
163
|
+
}, {
|
|
164
|
+
default: i(() => [
|
|
165
|
+
k(d(a(h)(t.text)), 1)
|
|
166
|
+
]),
|
|
167
|
+
_: 2
|
|
168
|
+
}, 1032, ["value"])) : (n(), v(y, { key: 0 }, [
|
|
169
|
+
S("span", {
|
|
170
|
+
class: "el-button custom-dropdown-button el-button--small inner-el-button",
|
|
171
|
+
style: U(T(t)),
|
|
172
|
+
onClick: (o) => q(t)
|
|
173
|
+
}, d(a(h)(t.text)), 13, Ne),
|
|
174
|
+
S("div", Ve, [
|
|
175
|
+
(n(!0), v(y, null, B(t.subs, (o) => (n(), _(p, {
|
|
176
|
+
key: o.value,
|
|
177
|
+
class: "checkbox custom-dropdown-button",
|
|
178
|
+
value: o.value,
|
|
179
|
+
border: ""
|
|
180
|
+
}, {
|
|
181
|
+
default: i(() => {
|
|
182
|
+
var N;
|
|
183
|
+
return [
|
|
184
|
+
k(d(a(h)(o.text)), 1),
|
|
185
|
+
a(s).isEmpty(F.value) ? $("", !0) : (n(), v("span", we, "(" + d((N = F.value.filter((P) => P.value == o.value)[0]) == null ? void 0 : N.count) + ")", 1))
|
|
186
|
+
];
|
|
187
|
+
}),
|
|
188
|
+
_: 2
|
|
189
|
+
}, 1032, ["value"]))), 128))
|
|
190
|
+
])
|
|
191
|
+
], 64))
|
|
192
|
+
]),
|
|
193
|
+
_: 2
|
|
194
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]))), 128)) : (n(!0), v(y, { key: 1 }, B(f.value, (t) => (n(), _(te, {
|
|
195
|
+
key: t.value,
|
|
196
|
+
modelValue: c.value,
|
|
197
|
+
"onUpdate:modelValue": l[1] || (l[1] = (o) => c.value = o),
|
|
198
|
+
size: "small",
|
|
199
|
+
class: "radio-group inner-radio-group custom-dropdown-radio-group",
|
|
200
|
+
onChange: (o) => ce()
|
|
201
|
+
}, {
|
|
202
|
+
default: i(() => [
|
|
203
|
+
a(s).isNil(t.subs) ? (n(), _(I, {
|
|
204
|
+
key: 1,
|
|
205
|
+
value: t.value,
|
|
206
|
+
class: "radio custom-dropdown-button",
|
|
207
|
+
border: ""
|
|
208
|
+
}, {
|
|
209
|
+
default: i(() => [
|
|
210
|
+
k(d(a(h)(t.text)), 1)
|
|
211
|
+
]),
|
|
212
|
+
_: 2
|
|
213
|
+
}, 1032, ["value"])) : (n(), v(y, { key: 0 }, [
|
|
214
|
+
S("span", {
|
|
215
|
+
class: "el-button custom-dropdown-button el-button--small inner-el-button",
|
|
216
|
+
style: U(T(t)),
|
|
217
|
+
onClick: (o) => q(t)
|
|
218
|
+
}, d(a(h)(t.text)), 13, Ee),
|
|
219
|
+
S("div", Se, [
|
|
220
|
+
(n(!0), v(y, null, B(t.subs, (o) => (n(), _(I, {
|
|
221
|
+
key: o.value,
|
|
222
|
+
class: "radio custom-dropdown-button",
|
|
223
|
+
value: o.value,
|
|
224
|
+
border: ""
|
|
225
|
+
}, {
|
|
226
|
+
default: i(() => {
|
|
227
|
+
var N;
|
|
228
|
+
return [
|
|
229
|
+
k(d(a(h)(o.text)), 1),
|
|
230
|
+
a(s).isEmpty(F.value) ? $("", !0) : (n(), v("span", Fe, "(" + d((N = F.value.filter((P) => P.value == o.value)[0]) == null ? void 0 : N.count) + ")", 1))
|
|
231
|
+
];
|
|
232
|
+
}),
|
|
233
|
+
_: 2
|
|
234
|
+
}, 1032, ["value"]))), 128))
|
|
235
|
+
])
|
|
236
|
+
], 64))
|
|
237
|
+
]),
|
|
238
|
+
_: 2
|
|
239
|
+
}, 1032, ["modelValue", "onChange"]))), 128))
|
|
240
|
+
])
|
|
241
|
+
]),
|
|
242
|
+
default: i(() => [
|
|
243
|
+
S("div", ye, [
|
|
244
|
+
(n(!0), v(y, null, B(f.value, (t) => (n(), v(y, {
|
|
245
|
+
key: t.value
|
|
246
|
+
}, [
|
|
247
|
+
a(g) === "multiple" && t.isCheckbox ? (n(), _(ee, {
|
|
248
|
+
key: 0,
|
|
249
|
+
modelValue: r[t.text],
|
|
250
|
+
"onUpdate:modelValue": (o) => r[t.text] = o,
|
|
251
|
+
class: "checkbox-group",
|
|
252
|
+
size: "small",
|
|
253
|
+
onChange: ie
|
|
254
|
+
}, {
|
|
255
|
+
default: i(() => [
|
|
256
|
+
O(p, {
|
|
257
|
+
class: "custom-dropdown-button",
|
|
258
|
+
value: t.value,
|
|
259
|
+
border: ""
|
|
260
|
+
}, {
|
|
261
|
+
default: i(() => [
|
|
262
|
+
k(d(a(h)(t.text)), 1)
|
|
263
|
+
]),
|
|
264
|
+
_: 2
|
|
265
|
+
}, 1032, ["value"])
|
|
266
|
+
]),
|
|
267
|
+
_: 2
|
|
268
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : a(g) === "single" && t.isCheckbox ? (n(), _(te, {
|
|
269
|
+
key: 1,
|
|
270
|
+
modelValue: c.value,
|
|
271
|
+
"onUpdate:modelValue": l[0] || (l[0] = (o) => c.value = o),
|
|
272
|
+
class: "radio-group",
|
|
273
|
+
size: "small",
|
|
274
|
+
onChange: de
|
|
275
|
+
}, {
|
|
276
|
+
default: i(() => [
|
|
277
|
+
O(I, {
|
|
278
|
+
class: "custom-dropdown-button",
|
|
279
|
+
value: t.value,
|
|
280
|
+
border: ""
|
|
281
|
+
}, {
|
|
282
|
+
default: i(() => [
|
|
283
|
+
k(d(a(h)(t.text)), 1)
|
|
284
|
+
]),
|
|
285
|
+
_: 2
|
|
286
|
+
}, 1032, ["value"])
|
|
287
|
+
]),
|
|
288
|
+
_: 2
|
|
289
|
+
}, 1032, ["modelValue"])) : (n(), _(u, {
|
|
290
|
+
key: t.text,
|
|
291
|
+
style: U(T(t)),
|
|
292
|
+
class: "custom-dropdown-button",
|
|
293
|
+
size: "small",
|
|
294
|
+
onClick: (o) => q(t)
|
|
295
|
+
}, {
|
|
296
|
+
default: i(() => {
|
|
297
|
+
var o;
|
|
298
|
+
return [
|
|
299
|
+
k(d(a(h)(t.text)) + " ", 1),
|
|
300
|
+
a(s).isEmpty(M.value) ? $("", !0) : (n(), v("span", xe, "(" + d((o = M.value.filter((N) => N.value == t.value)[0]) == null ? void 0 : o.count) + ")", 1))
|
|
301
|
+
];
|
|
302
|
+
}),
|
|
303
|
+
_: 2
|
|
304
|
+
}, 1032, ["style", "onClick"]))
|
|
305
|
+
], 64))), 128))
|
|
306
|
+
])
|
|
307
|
+
]),
|
|
308
|
+
_: 1
|
|
309
|
+
}, 512)
|
|
310
|
+
]);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
});
|
|
2
314
|
export {
|
|
3
|
-
|
|
315
|
+
Oe as default
|
|
4
316
|
};
|
package/package.json
CHANGED
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
import { DropdownEntity } from './drop-down-condition';
|
|
2
|
+
import { CountItem } from './drop-down-condition.type';
|
|
2
3
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, CreateComponentPublicInstanceWithMixins, ExtractPropTypes, PropType, ComputedRef, Ref, CSSProperties, VNodeProps, AllowedComponentProps, ComponentCustomProps, GlobalComponents, GlobalDirectives } from 'vue';
|
|
3
4
|
import { TooltipTriggerType, PopperEffect, Placement, Options, ButtonProps, Translator, TooltipInstance } from 'element-plus';
|
|
5
|
+
type SelectMode = 'multiple' | 'single';
|
|
4
6
|
type __VLS_Props = {
|
|
5
|
-
|
|
7
|
+
/** 选择模式:multiple(多选) / single(单选) */
|
|
8
|
+
mode?: SelectMode;
|
|
9
|
+
/** 父子层级渲染条件项(优先级最高,传入后跳过接口请求) */
|
|
10
|
+
filterList?: DropdownEntity[];
|
|
11
|
+
/** 当前条件下显示的条数 */
|
|
6
12
|
totalCount?: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
value: string;
|
|
13
|
-
count: number;
|
|
14
|
-
}>;
|
|
13
|
+
/** 父级显示条数 */
|
|
14
|
+
level1Count?: CountItem[];
|
|
15
|
+
/** 子级显示数量 */
|
|
16
|
+
level2Count?: CountItem[];
|
|
17
|
+
/** 发往后端的请求参数key */
|
|
15
18
|
filterKey: string;
|
|
19
|
+
/** 后端接口枚举标识(用于缓存key) */
|
|
16
20
|
enumEntity: string;
|
|
21
|
+
/** 是否需要刷新当前项 */
|
|
17
22
|
noNeedRefreshNumFilterName?: string;
|
|
18
|
-
|
|
23
|
+
/** 查询接口方法(仅当未传入filterList时调用) */
|
|
24
|
+
initFilters?: (enumEntity: string) => Promise<{
|
|
25
|
+
data: DropdownEntity[];
|
|
26
|
+
}>;
|
|
19
27
|
};
|
|
20
28
|
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
21
|
-
filterChange: (
|
|
22
|
-
|
|
29
|
+
filterChange: (payload: {
|
|
30
|
+
filterKey: string;
|
|
31
|
+
checkedValues: string[];
|
|
32
|
+
}[]) => any;
|
|
33
|
+
setNoNeedRefreshNumFilterName: (filterKey: string) => any;
|
|
23
34
|
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
24
|
-
onFilterChange?: (
|
|
25
|
-
|
|
35
|
+
onFilterChange?: (payload: {
|
|
36
|
+
filterKey: string;
|
|
37
|
+
checkedValues: string[];
|
|
38
|
+
}[]) => any;
|
|
39
|
+
onSetNoNeedRefreshNumFilterName?: (filterKey: string) => any;
|
|
26
40
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
27
41
|
dropdown1: CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
|
|
28
42
|
readonly trigger: {
|
|
@@ -3,41 +3,41 @@ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOp
|
|
|
3
3
|
import { DropdownEntity } from './drop-down-condition';
|
|
4
4
|
import { TooltipTriggerType, PopperEffect, Placement, Options, ButtonProps, Translator, TooltipInstance } from 'element-plus';
|
|
5
5
|
export declare const YaheeDropDownCondition: SFCWithInstall<DefineComponent<{
|
|
6
|
-
|
|
6
|
+
mode?: "multiple" | "single";
|
|
7
|
+
filterList?: DropdownEntity[];
|
|
7
8
|
totalCount?: number;
|
|
8
|
-
level1Count?:
|
|
9
|
-
|
|
10
|
-
count: number;
|
|
11
|
-
}>;
|
|
12
|
-
level2Count?: Array<{
|
|
13
|
-
value: string;
|
|
14
|
-
count: number;
|
|
15
|
-
}>;
|
|
9
|
+
level1Count?: CountItem[];
|
|
10
|
+
level2Count?: CountItem[];
|
|
16
11
|
filterKey: string;
|
|
17
12
|
enumEntity: string;
|
|
18
13
|
noNeedRefreshNumFilterName?: string;
|
|
19
|
-
initFilters?:
|
|
14
|
+
initFilters?: (enumEntity: string) => Promise<{
|
|
15
|
+
data: DropdownEntity[];
|
|
16
|
+
}>;
|
|
20
17
|
}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
21
|
-
filterChange: (
|
|
22
|
-
|
|
18
|
+
filterChange: (payload: {
|
|
19
|
+
filterKey: string;
|
|
20
|
+
checkedValues: string[];
|
|
21
|
+
}[]) => any;
|
|
22
|
+
setNoNeedRefreshNumFilterName: (filterKey: string) => any;
|
|
23
23
|
}, string, PublicProps, Readonly<{
|
|
24
|
-
|
|
24
|
+
mode?: "multiple" | "single";
|
|
25
|
+
filterList?: DropdownEntity[];
|
|
25
26
|
totalCount?: number;
|
|
26
|
-
level1Count?:
|
|
27
|
-
|
|
28
|
-
count: number;
|
|
29
|
-
}>;
|
|
30
|
-
level2Count?: Array<{
|
|
31
|
-
value: string;
|
|
32
|
-
count: number;
|
|
33
|
-
}>;
|
|
27
|
+
level1Count?: CountItem[];
|
|
28
|
+
level2Count?: CountItem[];
|
|
34
29
|
filterKey: string;
|
|
35
30
|
enumEntity: string;
|
|
36
31
|
noNeedRefreshNumFilterName?: string;
|
|
37
|
-
initFilters?:
|
|
32
|
+
initFilters?: (enumEntity: string) => Promise<{
|
|
33
|
+
data: DropdownEntity[];
|
|
34
|
+
}>;
|
|
38
35
|
}> & Readonly<{
|
|
39
|
-
onFilterChange?: (
|
|
40
|
-
|
|
36
|
+
onFilterChange?: (payload: {
|
|
37
|
+
filterKey: string;
|
|
38
|
+
checkedValues: string[];
|
|
39
|
+
}[]) => any;
|
|
40
|
+
onSetNoNeedRefreshNumFilterName?: (filterKey: string) => any;
|
|
41
41
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
42
42
|
dropdown1: CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
|
|
43
43
|
readonly trigger: {
|
package/types/src/installs.d.ts
CHANGED
|
@@ -1419,41 +1419,41 @@ declare const _default: (( SFCWithInstall<DefineComponent<ExtractPropTypes<{
|
|
|
1419
1419
|
defaultValues: (string | boolean | number)[];
|
|
1420
1420
|
enumEntity: string;
|
|
1421
1421
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>> & Record<string, any>) | ( SFCWithInstall<DefineComponent<{
|
|
1422
|
-
|
|
1422
|
+
mode?: "multiple" | "single";
|
|
1423
|
+
filterList?: DropdownEntity[];
|
|
1423
1424
|
totalCount?: number;
|
|
1424
|
-
level1Count?:
|
|
1425
|
-
|
|
1426
|
-
count: number;
|
|
1427
|
-
}>;
|
|
1428
|
-
level2Count?: Array<{
|
|
1429
|
-
value: string;
|
|
1430
|
-
count: number;
|
|
1431
|
-
}>;
|
|
1425
|
+
level1Count?: CountItem[];
|
|
1426
|
+
level2Count?: CountItem[];
|
|
1432
1427
|
filterKey: string;
|
|
1433
1428
|
enumEntity: string;
|
|
1434
1429
|
noNeedRefreshNumFilterName?: string;
|
|
1435
|
-
initFilters?:
|
|
1430
|
+
initFilters?: (enumEntity: string) => Promise<{
|
|
1431
|
+
data: DropdownEntity[];
|
|
1432
|
+
}>;
|
|
1436
1433
|
}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
1437
|
-
filterChange: (
|
|
1438
|
-
|
|
1434
|
+
filterChange: (payload: {
|
|
1435
|
+
filterKey: string;
|
|
1436
|
+
checkedValues: string[];
|
|
1437
|
+
}[]) => any;
|
|
1438
|
+
setNoNeedRefreshNumFilterName: (filterKey: string) => any;
|
|
1439
1439
|
}, string, PublicProps, Readonly<{
|
|
1440
|
-
|
|
1440
|
+
mode?: "multiple" | "single";
|
|
1441
|
+
filterList?: DropdownEntity[];
|
|
1441
1442
|
totalCount?: number;
|
|
1442
|
-
level1Count?:
|
|
1443
|
-
|
|
1444
|
-
count: number;
|
|
1445
|
-
}>;
|
|
1446
|
-
level2Count?: Array<{
|
|
1447
|
-
value: string;
|
|
1448
|
-
count: number;
|
|
1449
|
-
}>;
|
|
1443
|
+
level1Count?: CountItem[];
|
|
1444
|
+
level2Count?: CountItem[];
|
|
1450
1445
|
filterKey: string;
|
|
1451
1446
|
enumEntity: string;
|
|
1452
1447
|
noNeedRefreshNumFilterName?: string;
|
|
1453
|
-
initFilters?:
|
|
1448
|
+
initFilters?: (enumEntity: string) => Promise<{
|
|
1449
|
+
data: DropdownEntity[];
|
|
1450
|
+
}>;
|
|
1454
1451
|
}> & Readonly<{
|
|
1455
|
-
onFilterChange?: (
|
|
1456
|
-
|
|
1452
|
+
onFilterChange?: (payload: {
|
|
1453
|
+
filterKey: string;
|
|
1454
|
+
checkedValues: string[];
|
|
1455
|
+
}[]) => any;
|
|
1456
|
+
onSetNoNeedRefreshNumFilterName?: (filterKey: string) => any;
|
|
1457
1457
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
1458
1458
|
dropdown1: CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
|
|
1459
1459
|
readonly trigger: {
|