yahee-components 0.0.104 → 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,9 +1,9 @@
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";
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
2
  import s from "../_virtual/lodash.js";
3
- import { stylesUtils as j } from "../utils/style.js";
3
+ import { stylesUtils as U } 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 K } from "element-plus";
6
+ import { ElButton as P, ElDropdown as ie, ElCheckboxGroup as Y, ElCheckbox as $ } 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";
@@ -12,7 +12,7 @@ import "element-plus/theme-chalk/src/button-group.scss";
12
12
  import "element-plus/theme-chalk/src/popper.scss";
13
13
  import "element-plus/theme-chalk/src/scrollbar.scss";
14
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({
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
16
  name: "YaheeDropDownCondition",
17
17
  __name: "drop-down-condition",
18
18
  props: {
@@ -28,45 +28,45 @@ 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 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();
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
33
  function q(t) {
34
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();
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
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());
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
40
  }
41
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] = {
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
43
  backgroundColor: "#0F7535",
44
44
  color: "#fff",
45
45
  borderColor: "#0F7535"
46
- }, h.value = D(), A();
46
+ }, h.value = L(), A();
47
47
  }
48
48
  function Z() {
49
- h.value = D(), A();
49
+ h.value = L(), A();
50
50
  }
51
51
  function A() {
52
52
  M("setNoNeedRefreshNumFilterName", w.value);
53
53
  }
54
54
  function ee() {
55
55
  h.value = !0;
56
- for (const t in c)
57
- c[t] = {};
56
+ for (const t in r)
57
+ r[t] = {};
58
58
  for (const t in n)
59
59
  delete n[t];
60
60
  for (const t in p)
61
61
  delete p[t];
62
62
  I();
63
63
  }
64
- const te = (t) => j.getBackgroundColor(t);
64
+ const te = (t) => U.getBackgroundColor(t);
65
65
  function le(t) {
66
66
  if (t)
67
- $ = s.cloneDeep(n);
67
+ j = s.cloneDeep(n);
68
68
  else {
69
- if (s.isEqual($, n))
69
+ if (s.isEqual(j, n))
70
70
  return;
71
71
  I();
72
72
  }
@@ -80,29 +80,28 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
80
80
  ]);
81
81
  }
82
82
  function oe(t) {
83
- const o = r.value.find((e) => e.text === t);
83
+ const o = c.value.find((e) => e.text === t);
84
84
  o && o.subs && (n[t] = o.subs.map((e) => e.value));
85
85
  }
86
86
  function ne(t) {
87
87
  n[t] = [];
88
88
  }
89
89
  function ue() {
90
- var e;
91
90
  if (V.value && V.value.length > 0) {
92
- r.value = [...V.value];
91
+ c.value = [...V.value];
93
92
  return;
94
93
  }
95
94
  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
- }));
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
+ });
101
100
  }
102
101
  return re(
103
102
  [() => 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
+ ([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);
106
105
  }
107
106
  ), ce(() => {
108
107
  ue();
@@ -114,8 +113,8 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
114
113
  onClick: ee
115
114
  }, {
116
115
  default: d(() => [
117
- k(v(u(x)("全部")) + " ", 1),
118
- u(C) ? (a(), i("span", ve, "(" + v(T.value) + ")", 1)) : N("", !0)
116
+ k(f(u(x)("全部")) + " ", 1),
117
+ u(C) ? (a(), i("span", fe, "(" + f(T.value) + ")", 1)) : N("", !0)
119
118
  ]),
120
119
  _: 1
121
120
  }, 8, ["style"]),
@@ -127,7 +126,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
127
126
  }, {
128
127
  dropdown: d(() => [
129
128
  E("div", he, [
130
- (a(!0), i(b, null, U(r.value, (e) => (a(), y(u(Y), {
129
+ (a(!0), i(b, null, K(c.value, (e) => (a(), y(u(Y), {
131
130
  key: e.value,
132
131
  modelValue: n[e.text],
133
132
  "onUpdate:modelValue": (l) => n[e.text] = l,
@@ -136,34 +135,34 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
136
135
  onChange: (l) => X(e)
137
136
  }, {
138
137
  default: d(() => [
139
- u(s).isNil(e.subs) ? (a(), y(u(K), {
138
+ u(s).isNil(e.subs) ? (a(), y(u($), {
140
139
  key: 1,
141
140
  value: e.value,
142
141
  class: "checkbox custom-dropdown-button",
143
142
  border: ""
144
143
  }, {
145
144
  default: d(() => [
146
- k(v(u(x)(e.text)), 1)
145
+ k(f(u(x)(e.text)), 1)
147
146
  ]),
148
147
  _: 2
149
148
  }, 1032, ["value"])) : (a(), i(b, { key: 0 }, [
150
149
  E("span", {
151
150
  class: "el-button custom-dropdown-button el-button--small inner-el-button",
152
- style: z(c[e.text]),
151
+ style: z(r[e.text]),
153
152
  onClick: (l) => q(e)
154
- }, v(u(x)(e.text)), 13, me),
153
+ }, f(u(x)(e.text)), 13, me),
155
154
  E("div", ge, [
156
- (a(!0), i(b, null, U(e.subs, (l) => (a(), y(u(K), {
155
+ (a(!0), i(b, null, K(e.subs, (l) => (a(), y(u($), {
157
156
  key: l.value,
158
157
  class: "checkbox custom-dropdown-button",
159
158
  value: l.value,
160
159
  border: ""
161
160
  }, {
162
161
  default: d(() => {
163
- var f;
162
+ var v;
164
163
  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))
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))
167
166
  ];
168
167
  }),
169
168
  _: 2
@@ -176,8 +175,8 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
176
175
  ])
177
176
  ]),
178
177
  default: d(() => [
179
- E("div", fe, [
180
- (a(!0), i(b, null, U(r.value, (e) => (a(), i(b, null, [
178
+ E("div", ve, [
179
+ (a(!0), i(b, null, K(c.value, (e) => (a(), i(b, null, [
181
180
  e.isCheckbox ? (a(), y(u(Y), {
182
181
  key: e.value,
183
182
  modelValue: n[e.text],
@@ -187,14 +186,14 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
187
186
  onChange: Z
188
187
  }, {
189
188
  default: d(() => [
190
- e.isCheckbox ? (a(), y(u(K), {
189
+ e.isCheckbox ? (a(), y(u($), {
191
190
  key: 0,
192
191
  class: "custom-dropdown-button",
193
192
  value: e.value,
194
193
  border: ""
195
194
  }, {
196
195
  default: d(() => [
197
- k(v(u(x)(e.text)), 1)
196
+ k(f(u(x)(e.text)), 1)
198
197
  ]),
199
198
  _: 2
200
199
  }, 1032, ["value"])) : N("", !0)
@@ -202,7 +201,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
202
201
  _: 2
203
202
  }, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), y(u(P), {
204
203
  key: e.text,
205
- style: z(c[e.text]),
204
+ style: z(r[e.text]),
206
205
  class: "custom-dropdown-button",
207
206
  size: "small",
208
207
  onClick: (l) => q(e)
@@ -210,8 +209,8 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
210
209
  default: d(() => {
211
210
  var l;
212
211
  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))
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))
215
214
  ];
216
215
  }),
217
216
  _: 2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yahee-components",
3
3
  "private": false,
4
- "version": "0.0.104",
4
+ "version": "0.0.105",
5
5
  "description": "深圳前海亚讯前端组件库",
6
6
  "main": "lib",
7
7
  "module": "es",