yahee-components 0.0.103 → 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,7 +1,229 @@
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=dcda9a8e&lang.scss";
3
- import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-dcda9a8e"]]);
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
+ import s from "../_virtual/lodash.js";
3
+ import { stylesUtils as j } from "../utils/style.js";
4
+ import { storage as G } from "../utils/storage.js";
5
+ import { M2 as x } from "../utils/translate.js";
6
+ import { ElButton as P, ElDropdown as ie, ElCheckboxGroup as Y, ElCheckbox as K } 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" }, ve = { key: 0 }, fe = { 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 $ = _({});
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();
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), c[o] = j.getBackgroundColor(!0), h.value = !1) : (ne(o), c[t.text] = {}, h.value = !0), h.value = D(), A();
36
+ }
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;
39
+ return Object.values(n).map((l) => l.length).reduce((l, f) => l + f, 0) === t + o || s.isEmpty(Object.values(n).flat());
40
+ }
41
+ function X(t) {
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] = {
43
+ backgroundColor: "#0F7535",
44
+ color: "#fff",
45
+ borderColor: "#0F7535"
46
+ }, h.value = D(), A();
47
+ }
48
+ function Z() {
49
+ h.value = D(), A();
50
+ }
51
+ function A() {
52
+ M("setNoNeedRefreshNumFilterName", w.value);
53
+ }
54
+ function ee() {
55
+ h.value = !0;
56
+ for (const t in c)
57
+ c[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) => j.getBackgroundColor(t);
65
+ function le(t) {
66
+ if (t)
67
+ $ = s.cloneDeep(n);
68
+ else {
69
+ if (s.isEqual($, 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 = r.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
+ var e;
91
+ if (V.value && V.value.length > 0) {
92
+ r.value = [...V.value];
93
+ return;
94
+ }
95
+ const t = `filter-key-${m.enumEntity}`, o = G.getWithExpireTime(t);
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);
98
+ }).catch((l) => {
99
+ console.log(l);
100
+ }));
101
+ }
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);
106
+ }
107
+ ), ce(() => {
108
+ ue();
109
+ }), (t, o) => (a(), i("div", de, [
110
+ W(u(P), {
111
+ size: "small",
112
+ class: "el-button el-button--small custom-total-button",
113
+ style: z(te(h.value)),
114
+ onClick: ee
115
+ }, {
116
+ default: d(() => [
117
+ k(v(u(x)("全部")) + " ", 1),
118
+ u(C) ? (a(), i("span", ve, "(" + v(T.value) + ")", 1)) : N("", !0)
119
+ ]),
120
+ _: 1
121
+ }, 8, ["style"]),
122
+ W(u(ie), {
123
+ ref_key: "dropdown1",
124
+ ref: Q,
125
+ "popper-class": "custom-dropdown",
126
+ onVisibleChange: le
127
+ }, {
128
+ dropdown: d(() => [
129
+ E("div", he, [
130
+ (a(!0), i(b, null, U(r.value, (e) => (a(), y(u(Y), {
131
+ key: e.value,
132
+ modelValue: n[e.text],
133
+ "onUpdate:modelValue": (l) => n[e.text] = l,
134
+ size: "small",
135
+ class: "checkbox-group inner-checkbox-group custom-dropdown-checkbox-group",
136
+ onChange: (l) => X(e)
137
+ }, {
138
+ default: d(() => [
139
+ u(s).isNil(e.subs) ? (a(), y(u(K), {
140
+ key: 1,
141
+ value: e.value,
142
+ class: "checkbox custom-dropdown-button",
143
+ border: ""
144
+ }, {
145
+ default: d(() => [
146
+ k(v(u(x)(e.text)), 1)
147
+ ]),
148
+ _: 2
149
+ }, 1032, ["value"])) : (a(), i(b, { key: 0 }, [
150
+ E("span", {
151
+ class: "el-button custom-dropdown-button el-button--small inner-el-button",
152
+ style: z(c[e.text]),
153
+ onClick: (l) => q(e)
154
+ }, v(u(x)(e.text)), 13, me),
155
+ E("div", ge, [
156
+ (a(!0), i(b, null, U(e.subs, (l) => (a(), y(u(K), {
157
+ key: l.value,
158
+ class: "checkbox custom-dropdown-button",
159
+ value: l.value,
160
+ border: ""
161
+ }, {
162
+ default: d(() => {
163
+ var f;
164
+ return [
165
+ k(v(u(x)(l.text)), 1),
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))
167
+ ];
168
+ }),
169
+ _: 2
170
+ }, 1032, ["value"]))), 128))
171
+ ])
172
+ ], 64))
173
+ ]),
174
+ _: 2
175
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]))), 128))
176
+ ])
177
+ ]),
178
+ default: d(() => [
179
+ E("div", fe, [
180
+ (a(!0), i(b, null, U(r.value, (e) => (a(), i(b, null, [
181
+ e.isCheckbox ? (a(), y(u(Y), {
182
+ key: e.value,
183
+ modelValue: n[e.text],
184
+ "onUpdate:modelValue": (l) => n[e.text] = l,
185
+ class: "checkbox-group",
186
+ size: "small",
187
+ onChange: Z
188
+ }, {
189
+ default: d(() => [
190
+ e.isCheckbox ? (a(), y(u(K), {
191
+ key: 0,
192
+ class: "custom-dropdown-button",
193
+ value: e.value,
194
+ border: ""
195
+ }, {
196
+ default: d(() => [
197
+ k(v(u(x)(e.text)), 1)
198
+ ]),
199
+ _: 2
200
+ }, 1032, ["value"])) : N("", !0)
201
+ ]),
202
+ _: 2
203
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), y(u(P), {
204
+ key: e.text,
205
+ style: z(c[e.text]),
206
+ class: "custom-dropdown-button",
207
+ size: "small",
208
+ onClick: (l) => q(e)
209
+ }, {
210
+ default: d(() => {
211
+ var l;
212
+ return [
213
+ k(v(u(x)(e.text)) + " ", 1),
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))
215
+ ];
216
+ }),
217
+ _: 2
218
+ }, 1032, ["style", "onClick"]))
219
+ ], 64))), 256))
220
+ ])
221
+ ]),
222
+ _: 1
223
+ }, 512)
224
+ ]));
225
+ }
226
+ });
5
227
  export {
6
- d as default
228
+ Ae as default
7
229
  };
@@ -1,222 +1,4 @@
1
- import { defineComponent as re, ref as g, reactive as E, toRefs as ie, watch as I, onMounted as de, resolveComponent as w, createElementBlock as f, openBlock as a, createVNode as A, normalizeStyle as R, withCtx as v, createTextVNode as y, createCommentVNode as z, toDisplayString as p, unref as i, createElementVNode as V, Fragment as _, renderList as L, createBlock as x } from "vue";
2
- import s from "../_virtual/lodash.js";
3
- import { stylesUtils as U } from "../utils/style.js";
4
- import { storage as J } from "../utils/storage.js";
5
- import { M2 as b } from "../utils/translate.js";
6
- const fe = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, pe = { style: { display: "flex", "align-items": "center", outline: "none" } }, he = { key: 0 }, me = { style: { display: "flex", width: "auto", padding: "10px" } }, ge = ["onClick"], be = { class: "scrollable-container" }, ke = { key: 0 }, Ee = /* @__PURE__ */ re({
7
- name: "YaheeDropDownCondition",
8
- __name: "drop-down-condition",
9
- props: {
10
- filterList: {},
11
- totalCount: {},
12
- level1Count: {},
13
- level2Count: {},
14
- filterKey: {},
15
- enumEntity: {},
16
- noNeedRefreshNumFilterName: {},
17
- initFilters: { type: Function }
18
- },
19
- emits: ["filterChange", "setNoNeedRefreshNumFilterName"],
20
- setup(Q, { emit: X }) {
21
- const Z = g(), n = E({}), $ = E({}), d = E({}), h = E({}), k = g(!0), r = g([]), m = Q, K = X, { filterKey: F, filterList: C, totalCount: S, level1Count: M, level2Count: T, noNeedRefreshNumFilterName: q } = ie(m), W = g(s.get(S, "value", 0)), j = g(s.get(M, "value", [])), B = g(s.get(T, "value", []));
22
- function ee() {
23
- if (C.value && C.value.length > 0) {
24
- r.value = [...C.value];
25
- return;
26
- }
27
- const e = `filter-key-${m.enumEntity}`, t = J.getWithExpireTime(e);
28
- t ? r.value = t : m.initFilters && m.initFilters(m.enumEntity).then((o) => {
29
- r.value = o.data, J.setWithExpireTime(e, r.value, 1200 * 1e3);
30
- }).catch((o) => {
31
- console.error(`获取${m.enumEntity}筛选列表失败:`, o);
32
- });
33
- }
34
- function P(e) {
35
- const { text: t, value: o } = e, c = n[t];
36
- s.isNil(c) || s.isEmpty(c) ? n[t] = [o] : n[t] = [], h[t] = !h[t], h[t] ? (se(t), d[t] = U.getBackgroundColor(!0)) : (ue(t), d[e.text] = {}), k.value = D(), O();
37
- }
38
- function D() {
39
- if (!r.value.length) return !0;
40
- const e = r.value.filter((c) => !s.isEmpty(c.subs)).flatMap((c) => c.subs).length, t = r.value.filter((c) => s.isEmpty(c.subs)).length, o = Object.values(n).flat().length;
41
- return o === e + t || o === 0;
42
- }
43
- function te(e) {
44
- const t = n[e.text] || [], o = s.get(e, "subs.length", 1);
45
- s.isEmpty(t) ? (d[e.text] = {}, h[e.text] = !1) : t.length === o ? (d[e.text] = U.getBackgroundColor(!0), h[e.text] = !0) : d[e.text] = {
46
- backgroundColor: "#0F7535",
47
- color: "#fff",
48
- borderColor: "#0F7535"
49
- }, k.value = D(), O();
50
- }
51
- function le() {
52
- k.value = D(), O();
53
- }
54
- function O() {
55
- K("setNoNeedRefreshNumFilterName", F.value);
56
- }
57
- function Y() {
58
- k.value = !0, Object.keys(d).forEach((e) => {
59
- d[e] = {};
60
- }), Object.keys(n).forEach((e) => {
61
- delete n[e];
62
- }), Object.keys(h).forEach((e) => {
63
- delete h[e];
64
- }), G();
65
- }
66
- const oe = (e) => U.getBackgroundColor(e);
67
- function ne(e) {
68
- e ? Object.assign($, s.cloneDeep(n)) : s.isEqual($, n) || G();
69
- }
70
- function G() {
71
- K("filterChange", [
72
- {
73
- filterKey: F.value,
74
- checkedValues: Object.values(n).flat()
75
- }
76
- ]);
77
- }
78
- function se(e) {
79
- const t = r.value.find((o) => o.text === e);
80
- t != null && t.subs && (n[e] = t.subs.map((o) => o.value));
81
- }
82
- function ue(e) {
83
- n[e] = [];
84
- }
85
- return I(
86
- () => C.value,
87
- (e) => {
88
- e && e.length > 0 && (r.value = [...e], Y());
89
- },
90
- { deep: !0 }
91
- ), I(
92
- [() => S.value, () => M.value, () => T.value],
93
- ([e, t, o]) => {
94
- (!q.value || !s.eq(q.value, F.value)) && (W.value = e, j.value = t, B.value = o);
95
- }
96
- ), de(() => {
97
- ee();
98
- }), (e, t) => {
99
- const o = w("el-button"), c = w("el-checkbox"), H = w("el-checkbox-group"), ae = w("el-dropdown");
100
- return a(), f("div", fe, [
101
- A(o, {
102
- size: "small",
103
- class: "el-button el-button--small custom-total-button",
104
- style: R(oe(k.value)),
105
- onClick: Y
106
- }, {
107
- default: v(() => [
108
- y(p(i(b)("全部")) + " ", 1),
109
- i(S) ? (a(), f("span", ve, "(" + p(W.value) + ")", 1)) : z("", !0)
110
- ]),
111
- _: 1
112
- }, 8, ["style"]),
113
- A(ae, {
114
- ref_key: "dropdown1",
115
- ref: Z,
116
- "popper-class": "custom-dropdown",
117
- onVisibleChange: ne
118
- }, {
119
- dropdown: v(() => [
120
- V("div", me, [
121
- (a(!0), f(_, null, L(r.value, (l) => (a(), x(H, {
122
- key: l.value,
123
- modelValue: n[l.text],
124
- "onUpdate:modelValue": (u) => n[l.text] = u,
125
- size: "small",
126
- class: "checkbox-group inner-checkbox-group custom-dropdown-checkbox-group",
127
- onChange: (u) => te(l)
128
- }, {
129
- default: v(() => [
130
- i(s).isNil(l.subs) ? (a(), x(c, {
131
- key: 1,
132
- value: l.value,
133
- class: "checkbox custom-dropdown-button",
134
- border: ""
135
- }, {
136
- default: v(() => [
137
- y(p(i(b)(l.text)), 1)
138
- ]),
139
- _: 2
140
- }, 1032, ["value"])) : (a(), f(_, { key: 0 }, [
141
- V("span", {
142
- class: "el-button custom-dropdown-button el-button--small inner-el-button",
143
- style: R(d[l.text]),
144
- onClick: (u) => P(l)
145
- }, p(i(b)(l.text)), 13, ge),
146
- V("div", be, [
147
- (a(!0), f(_, null, L(l.subs, (u) => (a(), x(c, {
148
- key: u.value,
149
- class: "checkbox custom-dropdown-button",
150
- value: u.value,
151
- border: ""
152
- }, {
153
- default: v(() => {
154
- var N;
155
- return [
156
- y(p(i(b)(u.text)), 1),
157
- i(s).isEmpty(B.value) ? z("", !0) : (a(), f("span", ke, "(" + p((N = B.value.filter((ce) => ce.value == u.value)[0]) == null ? void 0 : N.count) + ")", 1))
158
- ];
159
- }),
160
- _: 2
161
- }, 1032, ["value"]))), 128))
162
- ])
163
- ], 64))
164
- ]),
165
- _: 2
166
- }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]))), 128))
167
- ])
168
- ]),
169
- default: v(() => [
170
- V("div", pe, [
171
- (a(!0), f(_, null, L(r.value, (l) => (a(), f(_, {
172
- key: l.value
173
- }, [
174
- l.isCheckbox ? (a(), x(H, {
175
- key: 0,
176
- modelValue: n[l.text],
177
- "onUpdate:modelValue": (u) => n[l.text] = u,
178
- class: "checkbox-group",
179
- size: "small",
180
- onChange: le
181
- }, {
182
- default: v(() => [
183
- A(c, {
184
- class: "custom-dropdown-button",
185
- value: l.value,
186
- border: ""
187
- }, {
188
- default: v(() => [
189
- y(p(i(b)(l.text)), 1)
190
- ]),
191
- _: 2
192
- }, 1032, ["value"])
193
- ]),
194
- _: 2
195
- }, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), x(o, {
196
- key: 1,
197
- style: R(d[l.text]),
198
- class: "custom-dropdown-button",
199
- size: "small",
200
- onClick: (u) => P(l)
201
- }, {
202
- default: v(() => {
203
- var u;
204
- return [
205
- y(p(i(b)(l.text)) + " ", 1),
206
- i(s).isEmpty(j.value) ? z("", !0) : (a(), f("span", he, "(" + p((u = j.value.filter((N) => N.value == l.value)[0]) == null ? void 0 : u.count) + ")", 1))
207
- ];
208
- }),
209
- _: 2
210
- }, 1032, ["style", "onClick"]))
211
- ], 64))), 128))
212
- ])
213
- ]),
214
- _: 1
215
- }, 512)
216
- ]);
217
- };
218
- }
219
- });
1
+ import f from "./drop-down-condition.vue.js";
220
2
  export {
221
- Ee as default
3
+ f as default
222
4
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yahee-components",
3
3
  "private": false,
4
- "version": "0.0.103",
4
+ "version": "0.0.104",
5
5
  "description": "深圳前海亚讯前端组件库",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -1,42 +1,28 @@
1
1
  import { DropdownEntity } from './drop-down-condition';
2
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, CreateComponentPublicInstanceWithMixins, ExtractPropTypes, PropType, ComputedRef, Ref, CSSProperties, VNodeProps, AllowedComponentProps, ComponentCustomProps, GlobalComponents, GlobalDirectives } from 'vue';
3
3
  import { TooltipTriggerType, PopperEffect, Placement, Options, ButtonProps, Translator, TooltipInstance } from 'element-plus';
4
- interface CountItem {
5
- value: string;
6
- count: number;
7
- }
8
4
  type __VLS_Props = {
9
- /** 父子层级渲染条件项(优先级最高,传入后跳过接口请求) */
10
- filterList?: DropdownEntity[];
11
- /** 当前条件下显示的条数 */
5
+ filterList?: Array<DropdownEntity>;
12
6
  totalCount?: number;
13
- /** 父级显示条数 */
14
- level1Count?: CountItem[];
15
- /** 子级显示数量 */
16
- level2Count?: CountItem[];
17
- /** 发往后端的请求参数key */
7
+ level1Count?: Array<{
8
+ value: string;
9
+ count: number;
10
+ }>;
11
+ level2Count?: Array<{
12
+ value: string;
13
+ count: number;
14
+ }>;
18
15
  filterKey: string;
19
- /** 后端接口枚举标识(用于缓存key) */
20
16
  enumEntity: string;
21
- /** 是否需要刷新当前项 */
22
17
  noNeedRefreshNumFilterName?: string;
23
- /** 查询接口方法(仅当未传入filterList时调用) */
24
- initFilters?: (enumEntity: string) => Promise<{
25
- data: DropdownEntity[];
26
- }>;
18
+ initFilters?: Function;
27
19
  };
28
20
  declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
29
- filterChange: (payload: {
30
- filterKey: string;
31
- checkedValues: string[];
32
- }[]) => any;
33
- setNoNeedRefreshNumFilterName: (filterKey: string) => any;
21
+ filterChange: (...args: any[]) => void;
22
+ setNoNeedRefreshNumFilterName: (...args: any[]) => void;
34
23
  }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onFilterChange?: (payload: {
36
- filterKey: string;
37
- checkedValues: string[];
38
- }[]) => any;
39
- onSetNoNeedRefreshNumFilterName?: (filterKey: string) => any;
24
+ onFilterChange?: (...args: any[]) => any;
25
+ onSetNoNeedRefreshNumFilterName?: (...args: any[]) => any;
40
26
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
41
27
  dropdown1: CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
42
28
  readonly trigger: {