yahee-components 0.0.89 → 0.0.90
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,177 @@ 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: p }) {
|
|
86
|
+
const { specialOptions: C, normalOptions: I, searchItem: E } = _(y), s = n(y.defaultSearch || "WHOLE_SEARCH"), o = n(""), i = n(!1), S = n(!1), u = n(!1), d = 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
|
+
i.value ? e = {
|
|
99
|
+
...c.value,
|
|
100
|
+
...o.value ? { putSearch: o.value } : {},
|
|
101
|
+
searchType: s.value
|
|
102
|
+
} : e = {
|
|
103
|
+
...c.value,
|
|
104
|
+
searchType: s.value
|
|
105
|
+
}, e.putSearch === "" && delete e.putSearch, console.log("左侧筛选条件变化,触发搜索:", e), p("filterChangeGrandson", e, s.value);
|
|
106
|
+
}, m = () => {
|
|
107
|
+
let e = {};
|
|
108
|
+
i.value ? e = {
|
|
109
|
+
...c.value,
|
|
110
|
+
putSearch: o.value || "",
|
|
111
|
+
searchType: s.value
|
|
112
|
+
} : e = {
|
|
113
|
+
putSearch: o.value || "",
|
|
114
|
+
searchType: s.value
|
|
115
|
+
}, e.putSearch === "" && delete e.putSearch, console.log("搜索框变化,触发搜索:", e), p("filterChangeGrandson", e, s.value);
|
|
116
|
+
}, b = () => {
|
|
117
|
+
m();
|
|
98
118
|
}, 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);
|
|
119
|
+
o.value = "", m();
|
|
110
120
|
}, W = () => {
|
|
111
|
-
|
|
121
|
+
o.value ? m() : g();
|
|
112
122
|
}, x = () => {
|
|
113
123
|
u.value = !0;
|
|
114
124
|
}, B = () => {
|
|
115
125
|
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
|
-
|
|
126
|
+
}, H = (e, t) => {
|
|
127
|
+
const a = { ...e };
|
|
128
|
+
return v.map(C.value, (h) => h.key).includes(t.filterKey) ? C.value.forEach((h) => delete a[h.key]) : delete a[t.filterKey], a;
|
|
129
|
+
}, A = (e) => {
|
|
130
|
+
let t = { ...c.value };
|
|
131
|
+
v.forEach(e, (a) => {
|
|
132
|
+
t = H(t, a);
|
|
133
|
+
const { checkedValues: h, filterKey: f } = a;
|
|
134
|
+
v.isEmpty(h) ? delete t[f] : I.value.includes(f) ? t[f] = h[0] : t[f] = h;
|
|
135
|
+
}), c.value = t, p("update:searchItem", t);
|
|
136
|
+
}, D = (e) => {
|
|
137
|
+
const t = O(e);
|
|
138
|
+
t !== null && (o.value = t, setTimeout(() => {
|
|
139
|
+
m();
|
|
130
140
|
}, 50));
|
|
131
|
-
},
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
141
|
+
}, L = (e) => {
|
|
142
|
+
const t = O(e);
|
|
143
|
+
if (t) {
|
|
134
144
|
const a = r.value.searchContent || "";
|
|
135
|
-
r.value.searchContent = a ? `${a},${
|
|
145
|
+
r.value.searchContent = a ? `${a},${t}` : t;
|
|
136
146
|
}
|
|
137
|
-
}, O = (
|
|
147
|
+
}, O = (e) => {
|
|
138
148
|
var a;
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
return
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
const t = (a = e.clipboardData) == null ? void 0 : a.getData("text/plain");
|
|
151
|
+
return t == null ? void 0 : t.replace(/[\n\r\t]+/g, ",");
|
|
142
152
|
};
|
|
143
153
|
return {
|
|
144
|
-
selectedSearchType:
|
|
145
|
-
putSearch:
|
|
146
|
-
isWithinFilterOptions:
|
|
147
|
-
confirmLoading:
|
|
154
|
+
selectedSearchType: s,
|
|
155
|
+
putSearch: o,
|
|
156
|
+
isWithinFilterOptions: i,
|
|
157
|
+
confirmLoading: S,
|
|
148
158
|
showBatchSearch: u,
|
|
149
|
-
batchSearchFormRef:
|
|
159
|
+
batchSearchFormRef: d,
|
|
150
160
|
batchSearchForm: r,
|
|
151
|
-
defalutOptions:
|
|
152
|
-
rules:
|
|
161
|
+
defalutOptions: T,
|
|
162
|
+
rules: F,
|
|
153
163
|
showBatchSearchDialog: x,
|
|
154
164
|
handleBatchSearchClose: B,
|
|
155
165
|
searchWithinFilterOptions: W,
|
|
156
166
|
handleSearch: b,
|
|
157
167
|
handleClear: w,
|
|
158
|
-
pasteFormatInput:
|
|
168
|
+
pasteFormatInput: D,
|
|
159
169
|
confirmSearch: () => {
|
|
160
|
-
|
|
161
|
-
var
|
|
162
|
-
if (
|
|
163
|
-
|
|
170
|
+
d.value && d.value.validate((e) => {
|
|
171
|
+
var t;
|
|
172
|
+
if (e && ((t = r.value.searchContent) != null && t.trim())) {
|
|
173
|
+
S.value = !0;
|
|
164
174
|
let a = {};
|
|
165
|
-
|
|
166
|
-
...
|
|
175
|
+
i.value ? a = {
|
|
176
|
+
...c.value,
|
|
167
177
|
putSearch: r.value.searchContent.trim(),
|
|
168
178
|
searchType: r.value.searchType
|
|
169
179
|
} : a = {
|
|
170
180
|
putSearch: r.value.searchContent.trim(),
|
|
171
181
|
searchType: r.value.searchType
|
|
172
|
-
},
|
|
182
|
+
}, p("filterChangeGrandson", a, r.value.searchType), r.value = { searchType: "WHOLE_SEARCH", searchContent: "" }, u.value = !1, S.value = !1;
|
|
173
183
|
}
|
|
174
184
|
});
|
|
175
185
|
},
|
|
176
|
-
pasteFormat:
|
|
177
|
-
filterChange:
|
|
178
|
-
getSearchItem: () =>
|
|
186
|
+
pasteFormat: L,
|
|
187
|
+
filterChange: A,
|
|
188
|
+
getSearchItem: () => c.value
|
|
179
189
|
};
|
|
180
190
|
}
|
|
181
191
|
});
|
|
182
192
|
export {
|
|
183
|
-
|
|
193
|
+
Ce as default
|
|
184
194
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SFCWithInstall } from '../utils/typescript';
|
|
2
|
-
import { DefineComponent } from 'vue';
|
|
3
|
-
export declare const YaheeComplexSearch: SFCWithInstall<DefineComponent> & Record<string, any>;
|
|
4
|
-
export default YaheeComplexSearch;
|
|
5
|
-
export * from './complex-search.vue';
|
|
6
|
-
export * from './complex-search';
|
|
7
|
-
export * from './props';
|