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
|
|
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
|
|
4
|
-
import { ElLink as
|
|
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
|
|
22
|
-
const
|
|
21
|
+
import { Search as N } from "@element-plus/icons-vue";
|
|
22
|
+
const Ce = R({
|
|
23
23
|
name: "YaheeComplexSearch",
|
|
24
24
|
components: {
|
|
25
|
-
ElInput:
|
|
26
|
-
ElCheckbox:
|
|
27
|
-
ElSelect:
|
|
28
|
-
ElDialog:
|
|
29
|
-
ElIcon:
|
|
30
|
-
ElForm:
|
|
31
|
-
ElFormItem:
|
|
32
|
-
ElRow:
|
|
33
|
-
ElButton:
|
|
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:
|
|
36
|
-
Search:
|
|
35
|
+
ElLink: G,
|
|
36
|
+
Search: N
|
|
37
37
|
},
|
|
38
38
|
props: {
|
|
39
39
|
defaultSearch: {
|
|
40
40
|
type: String,
|
|
41
|
-
default:
|
|
41
|
+
default: l().defaultSearch
|
|
42
42
|
},
|
|
43
43
|
options: {
|
|
44
44
|
type: Array,
|
|
45
|
-
default:
|
|
45
|
+
default: l().options
|
|
46
46
|
},
|
|
47
47
|
placeholderText: {
|
|
48
48
|
type: String,
|
|
49
|
-
default:
|
|
49
|
+
default: l().placeholderText
|
|
50
50
|
},
|
|
51
51
|
showPatchSearch: {
|
|
52
52
|
type: Boolean,
|
|
53
|
-
default:
|
|
53
|
+
default: l().showPatchSearch
|
|
54
54
|
},
|
|
55
55
|
showWithinFilterCheckbox: {
|
|
56
56
|
type: Boolean,
|
|
57
|
-
default:
|
|
57
|
+
default: l().showWithinFilterCheckbox
|
|
58
58
|
},
|
|
59
59
|
specialOptions: {
|
|
60
60
|
type: Array,
|
|
61
|
-
default:
|
|
61
|
+
default: l().specialOptions
|
|
62
62
|
},
|
|
63
63
|
normalOptions: {
|
|
64
64
|
type: Array,
|
|
65
|
-
default:
|
|
65
|
+
default: l().normalOptions
|
|
66
66
|
},
|
|
67
67
|
showSelect: {
|
|
68
68
|
type: Boolean,
|
|
69
|
-
default:
|
|
69
|
+
default: l().showSelect
|
|
70
70
|
},
|
|
71
71
|
searchItem: {
|
|
72
72
|
type: Object,
|
|
73
|
-
default:
|
|
73
|
+
default: l().searchItem
|
|
74
74
|
},
|
|
75
75
|
isBatchSelectOptionsSameWithInput: {
|
|
76
76
|
type: Boolean,
|
|
77
|
-
default:
|
|
77
|
+
default: l().isBatchSelectOptionsSameWithInput
|
|
78
78
|
},
|
|
79
79
|
batchOptions: {
|
|
80
80
|
type: Array,
|
|
81
|
-
default:
|
|
81
|
+
default: l().batchOptions
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
emits: ["filterChangeGrandson", "update:searchItem"],
|
|
85
|
-
setup(y, { emit:
|
|
86
|
-
const { specialOptions: C, normalOptions:
|
|
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
|
-
},
|
|
88
|
+
}, c = n({ ...E.value });
|
|
89
89
|
k(
|
|
90
90
|
() => E.value,
|
|
91
|
-
(
|
|
92
|
-
|
|
91
|
+
(e) => {
|
|
92
|
+
c.value = { ...e }, g();
|
|
93
93
|
},
|
|
94
94
|
{ deep: !0 }
|
|
95
95
|
);
|
|
96
|
-
const
|
|
97
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
117
|
-
const a = { ...
|
|
118
|
-
return v.map(C.value, (
|
|
119
|
-
},
|
|
120
|
-
let
|
|
121
|
-
v.forEach(
|
|
122
|
-
|
|
123
|
-
const { checkedValues:
|
|
124
|
-
v.isEmpty(
|
|
125
|
-
}),
|
|
126
|
-
},
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
},
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
143
|
+
}, L = (e) => {
|
|
144
|
+
const t = O(e);
|
|
145
|
+
if (t) {
|
|
134
146
|
const a = r.value.searchContent || "";
|
|
135
|
-
r.value.searchContent = a ? `${a},${
|
|
147
|
+
r.value.searchContent = a ? `${a},${t}` : t;
|
|
136
148
|
}
|
|
137
|
-
}, O = (
|
|
149
|
+
}, O = (e) => {
|
|
138
150
|
var a;
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
return
|
|
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:
|
|
145
|
-
putSearch:
|
|
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:
|
|
152
|
-
rules:
|
|
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:
|
|
170
|
+
pasteFormatInput: D,
|
|
159
171
|
confirmSearch: () => {
|
|
160
|
-
S.value && S.value.validate((
|
|
161
|
-
var
|
|
162
|
-
if (
|
|
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
|
-
...
|
|
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
|
-
},
|
|
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:
|
|
177
|
-
filterChange:
|
|
178
|
-
getSearchItem: () =>
|
|
188
|
+
pasteFormat: L,
|
|
189
|
+
filterChange: A,
|
|
190
|
+
getSearchItem: () => c.value
|
|
179
191
|
};
|
|
180
192
|
}
|
|
181
193
|
});
|
|
182
194
|
export {
|
|
183
|
-
|
|
195
|
+
Ce as default
|
|
184
196
|
};
|