yahee-components 0.0.89 → 0.0.91

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,7 @@
1
- import { defineComponent as R, toRefs as _, ref as l, watch as k } from "vue";
1
+ import { defineComponent as R, toRefs as _, ref as n, watch as k } from "vue";
2
2
  import v from "../_virtual/lodash.js";
3
- import { defaultComplexSearchProps as o } from "./props.js";
4
- import { ElLink as L, ElOption as P, ElButton as G, ElRow as K, ElFormItem as V, ElForm as j, ElIcon as q, ElDialog as Y, ElSelect as $, ElCheckbox as z, ElInput as J } from "element-plus";
3
+ import { defaultComplexSearchProps as l } from "./props.js";
4
+ import { ElLink as G, ElOption as P, ElButton as K, ElRow as V, ElFormItem as j, ElForm as q, ElIcon as Y, ElDialog as $, ElSelect as z, ElCheckbox as J, ElInput as M } from "element-plus";
5
5
  import "element-plus/theme-chalk/src/base.scss";
6
6
  import "element-plus/theme-chalk/src/input.scss";
7
7
  import "element-plus/theme-chalk/src/checkbox.scss";
@@ -18,167 +18,179 @@ import "element-plus/theme-chalk/src/form-item.scss";
18
18
  import "element-plus/theme-chalk/src/row.scss";
19
19
  import "element-plus/theme-chalk/src/button.scss";
20
20
  import "element-plus/theme-chalk/src/link.scss";
21
- import { Search as M } from "@element-plus/icons-vue";
22
- const ye = R({
21
+ import { Search as N } from "@element-plus/icons-vue";
22
+ const Ce = R({
23
23
  name: "YaheeComplexSearch",
24
24
  components: {
25
- ElInput: J,
26
- ElCheckbox: z,
27
- ElSelect: $,
28
- ElDialog: Y,
29
- ElIcon: q,
30
- ElForm: j,
31
- ElFormItem: V,
32
- ElRow: K,
33
- ElButton: G,
25
+ ElInput: M,
26
+ ElCheckbox: J,
27
+ ElSelect: z,
28
+ ElDialog: $,
29
+ ElIcon: Y,
30
+ ElForm: q,
31
+ ElFormItem: j,
32
+ ElRow: V,
33
+ ElButton: K,
34
34
  ElOption: P,
35
- ElLink: L,
36
- Search: M
35
+ ElLink: G,
36
+ Search: N
37
37
  },
38
38
  props: {
39
39
  defaultSearch: {
40
40
  type: String,
41
- default: o().defaultSearch
41
+ default: l().defaultSearch
42
42
  },
43
43
  options: {
44
44
  type: Array,
45
- default: o().options
45
+ default: l().options
46
46
  },
47
47
  placeholderText: {
48
48
  type: String,
49
- default: o().placeholderText
49
+ default: l().placeholderText
50
50
  },
51
51
  showPatchSearch: {
52
52
  type: Boolean,
53
- default: o().showPatchSearch
53
+ default: l().showPatchSearch
54
54
  },
55
55
  showWithinFilterCheckbox: {
56
56
  type: Boolean,
57
- default: o().showWithinFilterCheckbox
57
+ default: l().showWithinFilterCheckbox
58
58
  },
59
59
  specialOptions: {
60
60
  type: Array,
61
- default: o().specialOptions
61
+ default: l().specialOptions
62
62
  },
63
63
  normalOptions: {
64
64
  type: Array,
65
- default: o().normalOptions
65
+ default: l().normalOptions
66
66
  },
67
67
  showSelect: {
68
68
  type: Boolean,
69
- default: o().showSelect
69
+ default: l().showSelect
70
70
  },
71
71
  searchItem: {
72
72
  type: Object,
73
- default: o().searchItem
73
+ default: l().searchItem
74
74
  },
75
75
  isBatchSelectOptionsSameWithInput: {
76
76
  type: Boolean,
77
- default: o().isBatchSelectOptionsSameWithInput
77
+ default: l().isBatchSelectOptionsSameWithInput
78
78
  },
79
79
  batchOptions: {
80
80
  type: Array,
81
- default: o().batchOptions
81
+ default: l().batchOptions
82
82
  }
83
83
  },
84
84
  emits: ["filterChangeGrandson", "update:searchItem"],
85
- setup(y, { emit: f }) {
86
- const { specialOptions: C, normalOptions: g, searchItem: E } = _(y), i = l(y.defaultSearch || "WHOLE_SEARCH"), h = l(""), p = l(!1), d = l(!1), u = l(!1), S = l(null), r = l({ searchType: "WHOLE_SEARCH", searchContent: "" }), I = [{ value: "WHOLE_SEARCH", label: "综合搜索" }], T = {
85
+ setup(y, { emit: i }) {
86
+ const { specialOptions: C, normalOptions: I, searchItem: E } = _(y), h = n(y.defaultSearch || "WHOLE_SEARCH"), o = n(""), p = n(!1), d = n(!1), u = n(!1), S = n(null), r = n({ searchType: "WHOLE_SEARCH", searchContent: "" }), T = [{ value: "WHOLE_SEARCH", label: "综合搜索" }], F = {
87
87
  searchContent: [{ required: !0, message: "请输入查询内容", trigger: "blur" }]
88
- }, n = l({ ...E.value });
88
+ }, c = n({ ...E.value });
89
89
  k(
90
90
  () => E.value,
91
- (t) => {
92
- n.value = { ...t }, s();
91
+ (e) => {
92
+ c.value = { ...e }, g();
93
93
  },
94
94
  { deep: !0 }
95
95
  );
96
- const b = () => {
97
- s();
96
+ const g = () => {
97
+ let e = {};
98
+ p.value ? e = {
99
+ ...c.value,
100
+ ...o.value ? { putSearch: o.value } : {},
101
+ searchType: h.value
102
+ // 包含 searchType
103
+ } : e = {
104
+ ...c.value
105
+ // 注意:这里不包含 searchType
106
+ }, e.putSearch === "" && delete e.putSearch, console.log("左侧筛选条件变化,触发搜索:", e), p.value ? i("filterChangeGrandson", e, h.value) : i("filterChangeGrandson", e, void 0);
107
+ }, m = () => {
108
+ let e = {};
109
+ p.value ? e = {
110
+ ...c.value,
111
+ putSearch: o.value || "",
112
+ searchType: h.value
113
+ } : e = {
114
+ putSearch: o.value || "",
115
+ searchType: h.value
116
+ // 包含 searchType
117
+ }, e.putSearch === "" && delete e.putSearch, console.log("搜索框变化,触发搜索:", e), i("filterChangeGrandson", e, h.value);
118
+ }, b = () => {
119
+ m();
98
120
  }, w = () => {
99
- h.value = "", s();
100
- }, s = () => {
101
- let t = {};
102
- p.value ? t = {
103
- ...n.value,
104
- putSearch: h.value || "",
105
- searchType: i.value
106
- } : t = {
107
- putSearch: h.value || "",
108
- searchType: i.value
109
- }, f("filterChangeGrandson", t, i.value);
121
+ o.value = "", m();
110
122
  }, W = () => {
111
- s();
123
+ o.value ? m() : g();
112
124
  }, x = () => {
113
125
  u.value = !0;
114
126
  }, B = () => {
115
127
  u.value = !1, r.value = { searchType: "WHOLE_SEARCH", searchContent: "" };
116
- }, F = (t, e) => {
117
- const a = { ...t };
118
- return v.map(C.value, (c) => c.key).includes(e.filterKey) ? C.value.forEach((c) => delete a[c.key]) : delete a[e.filterKey], a;
119
- }, H = (t) => {
120
- let e = { ...n.value };
121
- v.forEach(t, (a) => {
122
- e = F(e, a);
123
- const { checkedValues: c, filterKey: m } = a;
124
- v.isEmpty(c) ? delete e[m] : g.value.includes(m) ? e[m] = c[0] : e[m] = c;
125
- }), n.value = e, f("update:searchItem", e), p.value && s();
126
- }, A = (t) => {
127
- const e = O(t);
128
- e !== null && (h.value = e, setTimeout(() => {
129
- s();
128
+ }, H = (e, t) => {
129
+ const a = { ...e };
130
+ return v.map(C.value, (s) => s.key).includes(t.filterKey) ? C.value.forEach((s) => delete a[s.key]) : delete a[t.filterKey], a;
131
+ }, A = (e) => {
132
+ let t = { ...c.value };
133
+ v.forEach(e, (a) => {
134
+ t = H(t, a);
135
+ const { checkedValues: s, filterKey: f } = a;
136
+ v.isEmpty(s) ? delete t[f] : I.value.includes(f) ? t[f] = s[0] : t[f] = s;
137
+ }), c.value = t, i("update:searchItem", t);
138
+ }, D = (e) => {
139
+ const t = O(e);
140
+ t !== null && (o.value = t, setTimeout(() => {
141
+ m();
130
142
  }, 50));
131
- }, D = (t) => {
132
- const e = O(t);
133
- if (e) {
143
+ }, L = (e) => {
144
+ const t = O(e);
145
+ if (t) {
134
146
  const a = r.value.searchContent || "";
135
- r.value.searchContent = a ? `${a},${e}` : e;
147
+ r.value.searchContent = a ? `${a},${t}` : t;
136
148
  }
137
- }, O = (t) => {
149
+ }, O = (e) => {
138
150
  var a;
139
- t.preventDefault();
140
- const e = (a = t.clipboardData) == null ? void 0 : a.getData("text/plain");
141
- return e == null ? void 0 : e.replace(/[\n\r\t]+/g, ",");
151
+ e.preventDefault();
152
+ const t = (a = e.clipboardData) == null ? void 0 : a.getData("text/plain");
153
+ return t == null ? void 0 : t.replace(/[\n\r\t]+/g, ",");
142
154
  };
143
155
  return {
144
- selectedSearchType: i,
145
- putSearch: h,
156
+ selectedSearchType: h,
157
+ putSearch: o,
146
158
  isWithinFilterOptions: p,
147
159
  confirmLoading: d,
148
160
  showBatchSearch: u,
149
161
  batchSearchFormRef: S,
150
162
  batchSearchForm: r,
151
- defalutOptions: I,
152
- rules: T,
163
+ defalutOptions: T,
164
+ rules: F,
153
165
  showBatchSearchDialog: x,
154
166
  handleBatchSearchClose: B,
155
167
  searchWithinFilterOptions: W,
156
168
  handleSearch: b,
157
169
  handleClear: w,
158
- pasteFormatInput: A,
170
+ pasteFormatInput: D,
159
171
  confirmSearch: () => {
160
- S.value && S.value.validate((t) => {
161
- var e;
162
- if (t && ((e = r.value.searchContent) != null && e.trim())) {
172
+ S.value && S.value.validate((e) => {
173
+ var t;
174
+ if (e && ((t = r.value.searchContent) != null && t.trim())) {
163
175
  d.value = !0;
164
176
  let a = {};
165
177
  p.value ? a = {
166
- ...n.value,
178
+ ...c.value,
167
179
  putSearch: r.value.searchContent.trim(),
168
180
  searchType: r.value.searchType
169
181
  } : a = {
170
182
  putSearch: r.value.searchContent.trim(),
171
183
  searchType: r.value.searchType
172
- }, f("filterChangeGrandson", a, r.value.searchType), r.value = { searchType: "WHOLE_SEARCH", searchContent: "" }, u.value = !1, d.value = !1;
184
+ }, i("filterChangeGrandson", a, r.value.searchType), r.value = { searchType: "WHOLE_SEARCH", searchContent: "" }, u.value = !1, d.value = !1;
173
185
  }
174
186
  });
175
187
  },
176
- pasteFormat: D,
177
- filterChange: H,
178
- getSearchItem: () => n.value
188
+ pasteFormat: L,
189
+ filterChange: A,
190
+ getSearchItem: () => c.value
179
191
  };
180
192
  }
181
193
  });
182
194
  export {
183
- ye as default
195
+ Ce as default
184
196
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yahee-components",
3
3
  "private": false,
4
- "version": "0.0.89",
4
+ "version": "0.0.91",
5
5
  "description": "深圳前海亚讯前端组件库",
6
6
  "main": "lib",
7
7
  "module": "es",