yahee-components 0.0.103 → 0.0.105

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,228 @@
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 f, createElementVNode as E, Fragment as b, renderList as K, createBlock as y } from "vue";
2
+ import s from "../_virtual/lodash.js";
3
+ import { stylesUtils as U } 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 $ } 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
+ });
5
226
  export {
6
- d as default
227
+ Ae as default
7
228
  };
@@ -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.105",
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: {