yahee-components 0.0.102 → 0.0.104
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,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as se, ref as g, reactive as _, toRefs as ae, watch as
|
|
1
|
+
import { defineComponent as se, ref as g, reactive as _, toRefs as ae, watch as re, onMounted as ce, createElementBlock as i, openBlock as a, createVNode as W, unref as u, normalizeStyle as z, withCtx as d, createTextVNode as k, createCommentVNode as N, toDisplayString as v, createElementVNode as E, Fragment as b, renderList as U, createBlock as y } from "vue";
|
|
2
2
|
import s from "../_virtual/lodash.js";
|
|
3
|
-
import { stylesUtils as
|
|
3
|
+
import { stylesUtils as j } from "../utils/style.js";
|
|
4
4
|
import { storage as G } from "../utils/storage.js";
|
|
5
5
|
import { M2 as x } from "../utils/translate.js";
|
|
6
|
-
import { ElButton as P, ElDropdown as ie, ElCheckboxGroup as Y, ElCheckbox as
|
|
6
|
+
import { ElButton as P, ElDropdown as ie, ElCheckboxGroup as Y, ElCheckbox as K } from "element-plus";
|
|
7
7
|
import "element-plus/theme-chalk/src/base.scss";
|
|
8
8
|
import "element-plus/theme-chalk/src/button.scss";
|
|
9
9
|
import "element-plus/theme-chalk/src/checkbox.scss";
|
|
@@ -28,52 +28,51 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
28
28
|
emits: ["filterChange", "setNoNeedRefreshNumFilterName"],
|
|
29
29
|
setup(H, { emit: J }) {
|
|
30
30
|
const Q = g(), n = _({});
|
|
31
|
-
let
|
|
32
|
-
const
|
|
33
|
-
M.value && (c.value = [...M.value]);
|
|
31
|
+
let $ = _({});
|
|
32
|
+
const c = _({}), 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", [])), L = g(s.get(S, "value", [])), r = g();
|
|
34
33
|
function q(t) {
|
|
35
34
|
const { text: o, value: e } = t, l = n[o];
|
|
36
|
-
s.isNil(l) || s.isEmpty(l) ? n[o] = [e] : n[o] = [], p[o] = !p[o], p[o] ? (oe(o),
|
|
35
|
+
s.isNil(l) || s.isEmpty(l) ? n[o] = [e] : n[o] = [], p[o] = !p[o], p[o] ? (oe(o), c[o] = j.getBackgroundColor(!0), h.value = !1) : (ne(o), c[t.text] = {}, h.value = !0), h.value = D(), A();
|
|
37
36
|
}
|
|
38
|
-
function
|
|
39
|
-
const t =
|
|
37
|
+
function D() {
|
|
38
|
+
const t = r.value.filter((l) => !s.isEmpty(l.subs)).flatMap((l) => l.subs).length, o = r.value.filter((l) => s.isEmpty(l.subs)).length;
|
|
40
39
|
return Object.values(n).map((l) => l.length).reduce((l, f) => l + f, 0) === t + o || s.isEmpty(Object.values(n).flat());
|
|
41
40
|
}
|
|
42
41
|
function X(t) {
|
|
43
|
-
s.isEmpty(n[t.text]) ? (
|
|
42
|
+
s.isEmpty(n[t.text]) ? (c[t.text] = {}, p[t.text] = !1) : n[t.text].length === s.get(t, "subs.length", 1) ? (c[t.text] = j.getBackgroundColor(!0), p[t.text] = !0) : c[t.text] = {
|
|
44
43
|
backgroundColor: "#0F7535",
|
|
45
44
|
color: "#fff",
|
|
46
45
|
borderColor: "#0F7535"
|
|
47
|
-
}, h.value =
|
|
46
|
+
}, h.value = D(), A();
|
|
48
47
|
}
|
|
49
48
|
function Z() {
|
|
50
|
-
h.value =
|
|
49
|
+
h.value = D(), A();
|
|
51
50
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
51
|
+
function A() {
|
|
52
|
+
M("setNoNeedRefreshNumFilterName", w.value);
|
|
54
53
|
}
|
|
55
54
|
function ee() {
|
|
56
55
|
h.value = !0;
|
|
57
|
-
for (const t in
|
|
58
|
-
|
|
56
|
+
for (const t in c)
|
|
57
|
+
c[t] = {};
|
|
59
58
|
for (const t in n)
|
|
60
59
|
delete n[t];
|
|
61
60
|
for (const t in p)
|
|
62
61
|
delete p[t];
|
|
63
62
|
I();
|
|
64
63
|
}
|
|
65
|
-
const te = (t) =>
|
|
64
|
+
const te = (t) => j.getBackgroundColor(t);
|
|
66
65
|
function le(t) {
|
|
67
66
|
if (t)
|
|
68
|
-
|
|
67
|
+
$ = s.cloneDeep(n);
|
|
69
68
|
else {
|
|
70
|
-
if (s.isEqual(
|
|
69
|
+
if (s.isEqual($, n))
|
|
71
70
|
return;
|
|
72
71
|
I();
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
function I() {
|
|
76
|
-
|
|
75
|
+
M("filterChange", [
|
|
77
76
|
{
|
|
78
77
|
filterKey: w.value,
|
|
79
78
|
checkedValues: Object.values(n).flat()
|
|
@@ -81,7 +80,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
81
80
|
]);
|
|
82
81
|
}
|
|
83
82
|
function oe(t) {
|
|
84
|
-
const o =
|
|
83
|
+
const o = r.value.find((e) => e.text === t);
|
|
85
84
|
o && o.subs && (n[t] = o.subs.map((e) => e.value));
|
|
86
85
|
}
|
|
87
86
|
function ne(t) {
|
|
@@ -89,25 +88,29 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
89
88
|
}
|
|
90
89
|
function ue() {
|
|
91
90
|
var e;
|
|
91
|
+
if (V.value && V.value.length > 0) {
|
|
92
|
+
r.value = [...V.value];
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
92
95
|
const t = `filter-key-${m.enumEntity}`, o = G.getWithExpireTime(t);
|
|
93
|
-
o ?
|
|
94
|
-
console.log(l),
|
|
96
|
+
o ? r.value = o : (console.log(m.enumEntity), (e = m == null ? void 0 : m.initFilters(m.enumEntity)) == null || e.then((l) => {
|
|
97
|
+
console.log(l), r.value = l.data, G.setWithExpireTime(t, r.value, 1200 * 1e3), console.log(r.value);
|
|
95
98
|
}).catch((l) => {
|
|
96
99
|
console.log(l);
|
|
97
100
|
}));
|
|
98
101
|
}
|
|
99
|
-
return
|
|
100
|
-
[() => C.value, () =>
|
|
101
|
-
([t, o, e], [l, f,
|
|
102
|
-
console.log(t, o, e), console.log(l, f,
|
|
102
|
+
return re(
|
|
103
|
+
[() => C.value, () => F.value, () => S.value],
|
|
104
|
+
([t, o, e], [l, f, R]) => {
|
|
105
|
+
console.log(t, o, e), console.log(l, f, R), (!O.value || !s.eq(O.value, w.value)) && (T.value = C.value, B.value = F.value, L.value = S.value);
|
|
103
106
|
}
|
|
104
|
-
),
|
|
107
|
+
), ce(() => {
|
|
105
108
|
ue();
|
|
106
109
|
}), (t, o) => (a(), i("div", de, [
|
|
107
110
|
W(u(P), {
|
|
108
111
|
size: "small",
|
|
109
112
|
class: "el-button el-button--small custom-total-button",
|
|
110
|
-
style:
|
|
113
|
+
style: z(te(h.value)),
|
|
111
114
|
onClick: ee
|
|
112
115
|
}, {
|
|
113
116
|
default: d(() => [
|
|
@@ -124,7 +127,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
124
127
|
}, {
|
|
125
128
|
dropdown: d(() => [
|
|
126
129
|
E("div", he, [
|
|
127
|
-
(a(!0), i(b, null,
|
|
130
|
+
(a(!0), i(b, null, U(r.value, (e) => (a(), y(u(Y), {
|
|
128
131
|
key: e.value,
|
|
129
132
|
modelValue: n[e.text],
|
|
130
133
|
"onUpdate:modelValue": (l) => n[e.text] = l,
|
|
@@ -133,7 +136,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
133
136
|
onChange: (l) => X(e)
|
|
134
137
|
}, {
|
|
135
138
|
default: d(() => [
|
|
136
|
-
u(s).isNil(e.subs) ? (a(), y(u(
|
|
139
|
+
u(s).isNil(e.subs) ? (a(), y(u(K), {
|
|
137
140
|
key: 1,
|
|
138
141
|
value: e.value,
|
|
139
142
|
class: "checkbox custom-dropdown-button",
|
|
@@ -146,11 +149,11 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
146
149
|
}, 1032, ["value"])) : (a(), i(b, { key: 0 }, [
|
|
147
150
|
E("span", {
|
|
148
151
|
class: "el-button custom-dropdown-button el-button--small inner-el-button",
|
|
149
|
-
style:
|
|
152
|
+
style: z(c[e.text]),
|
|
150
153
|
onClick: (l) => q(e)
|
|
151
154
|
}, v(u(x)(e.text)), 13, me),
|
|
152
155
|
E("div", ge, [
|
|
153
|
-
(a(!0), i(b, null,
|
|
156
|
+
(a(!0), i(b, null, U(e.subs, (l) => (a(), y(u(K), {
|
|
154
157
|
key: l.value,
|
|
155
158
|
class: "checkbox custom-dropdown-button",
|
|
156
159
|
value: l.value,
|
|
@@ -160,7 +163,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
160
163
|
var f;
|
|
161
164
|
return [
|
|
162
165
|
k(v(u(x)(l.text)), 1),
|
|
163
|
-
u(s).isEmpty(
|
|
166
|
+
u(s).isEmpty(L.value) ? N("", !0) : (a(), i("span", ye, "(" + v((f = L.value.filter((R) => R.value == l.value)[0]) == null ? void 0 : f.count) + ")", 1))
|
|
164
167
|
];
|
|
165
168
|
}),
|
|
166
169
|
_: 2
|
|
@@ -174,7 +177,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
174
177
|
]),
|
|
175
178
|
default: d(() => [
|
|
176
179
|
E("div", fe, [
|
|
177
|
-
(a(!0), i(b, null,
|
|
180
|
+
(a(!0), i(b, null, U(r.value, (e) => (a(), i(b, null, [
|
|
178
181
|
e.isCheckbox ? (a(), y(u(Y), {
|
|
179
182
|
key: e.value,
|
|
180
183
|
modelValue: n[e.text],
|
|
@@ -184,7 +187,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
184
187
|
onChange: Z
|
|
185
188
|
}, {
|
|
186
189
|
default: d(() => [
|
|
187
|
-
e.isCheckbox ? (a(), y(u(
|
|
190
|
+
e.isCheckbox ? (a(), y(u(K), {
|
|
188
191
|
key: 0,
|
|
189
192
|
class: "custom-dropdown-button",
|
|
190
193
|
value: e.value,
|
|
@@ -199,7 +202,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
199
202
|
_: 2
|
|
200
203
|
}, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), y(u(P), {
|
|
201
204
|
key: e.text,
|
|
202
|
-
style:
|
|
205
|
+
style: z(c[e.text]),
|
|
203
206
|
class: "custom-dropdown-button",
|
|
204
207
|
size: "small",
|
|
205
208
|
onClick: (l) => q(e)
|
|
@@ -208,7 +211,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
208
211
|
var l;
|
|
209
212
|
return [
|
|
210
213
|
k(v(u(x)(e.text)) + " ", 1),
|
|
211
|
-
u(s).isEmpty(
|
|
214
|
+
u(s).isEmpty(B.value) ? N("", !0) : (a(), i("span", pe, "(" + v((l = B.value.filter((f) => f.value == e.value)[0]) == null ? void 0 : l.count) + ")", 1))
|
|
212
215
|
];
|
|
213
216
|
}),
|
|
214
217
|
_: 2
|