@meethive/components 0.0.9 → 0.0.11
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.
- package/es/EditTable/props.js +1 -1
- package/es/ProLayout/SiderMenu/SiderMenu.js +133 -147
- package/es/ProLayout/TopHeader/index.js +91 -99
- package/es/ProTable/Alert.js +30 -15
- package/es/ProTable/Content.js +118 -30
- package/es/ProTable/Header.js +47 -14
- package/es/ProTable/Pagination.js +25 -14
- package/es/ProTable/ProTable.js +77 -30
- package/es/ProTable/setting.js +1 -1
- package/es/Search/Advanced/History.js +142 -0
- package/es/Search/Advanced/SaveHistory.js +124 -0
- package/es/Search/Advanced/index.js +369 -0
- package/es/Search/Item.js +70 -21
- package/es/Search/Search.js +81 -24
- package/es/Search/index.js +3 -3
- package/es/VirtualTable/VirtualTable.js +4 -4
- package/es/components.js +1 -1
- package/lib/EditTable/props.js +1 -1
- package/lib/ProLayout/SiderMenu/SiderMenu.js +133 -147
- package/lib/ProLayout/TopHeader/index.js +91 -99
- package/lib/ProTable/Alert.js +30 -15
- package/lib/ProTable/Content.js +118 -30
- package/lib/ProTable/Header.js +47 -14
- package/lib/ProTable/Pagination.js +25 -14
- package/lib/ProTable/ProTable.js +77 -30
- package/lib/ProTable/setting.js +1 -1
- package/lib/Search/Advanced/History.js +142 -0
- package/lib/Search/Advanced/SaveHistory.js +124 -0
- package/lib/Search/Advanced/index.js +369 -0
- package/lib/Search/Item.js +70 -21
- package/lib/Search/Search.js +81 -24
- package/lib/Search/index.js +3 -3
- package/lib/VirtualTable/VirtualTable.js +4 -4
- package/lib/components.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
style: {
|
|
6
|
+
"width": "240px"
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
import { ref, reactive } from 'vue';
|
|
10
|
+
import { Form, Button, FormItem, Popover, Textarea, message } from 'ant-design-vue';
|
|
11
|
+
import { isFunction } from 'lodash-es';
|
|
12
|
+
import { useLocaleReceiver } from '../../LocaleReciver';
|
|
13
|
+
const __sfc_main__ = _defineComponent({
|
|
14
|
+
__name: 'SaveHistory',
|
|
15
|
+
props: {
|
|
16
|
+
terms: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => ({})
|
|
19
|
+
},
|
|
20
|
+
target: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '',
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
request: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: null
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
setup(__props) {
|
|
31
|
+
const props = __props;
|
|
32
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
33
|
+
const saveHistoryLoading = ref(false);
|
|
34
|
+
const visible = ref(false);
|
|
35
|
+
const formRef = ref();
|
|
36
|
+
const modelRef = reactive({
|
|
37
|
+
name: undefined
|
|
38
|
+
});
|
|
39
|
+
const visibleChange = e => {
|
|
40
|
+
visible.value = e;
|
|
41
|
+
if (!e) {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
modelRef.name = undefined;
|
|
44
|
+
}, 100);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 保存当前查询条件
|
|
50
|
+
*/
|
|
51
|
+
const saveHistory = async () => {
|
|
52
|
+
// 获取当前查询条件并转化为字符串
|
|
53
|
+
const formData = await formRef.value.validate();
|
|
54
|
+
if (formData && props.request && isFunction(props.request)) {
|
|
55
|
+
formData.content = JSON.stringify(props.terms);
|
|
56
|
+
saveHistoryLoading.value = true;
|
|
57
|
+
const resp = await props.request(formData, props.target);
|
|
58
|
+
saveHistoryLoading.value = false;
|
|
59
|
+
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
60
|
+
message.success(contextLocale.value.advanced.saveHistory.success);
|
|
61
|
+
visibleChange(false);
|
|
62
|
+
} else {
|
|
63
|
+
message.error(contextLocale.value.advanced.saveHistory.fail);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return _openBlock(), _createBlock(_unref(Popover), {
|
|
69
|
+
open: visible.value,
|
|
70
|
+
"onUpdate:open": _cache[1] || (_cache[1] = $event => visible.value = $event),
|
|
71
|
+
title: _unref(contextLocale).advanced.saveHistory.searchName,
|
|
72
|
+
trigger: "click",
|
|
73
|
+
placement: "bottom",
|
|
74
|
+
onVisibleChange: visibleChange
|
|
75
|
+
}, {
|
|
76
|
+
content: _withCtx(() => [visible.value ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_createVNode(_unref(Form), {
|
|
77
|
+
ref_key: "formRef",
|
|
78
|
+
ref: formRef,
|
|
79
|
+
model: modelRef
|
|
80
|
+
}, {
|
|
81
|
+
default: _withCtx(() => [_createVNode(_unref(FormItem), {
|
|
82
|
+
name: "name",
|
|
83
|
+
rules: [{
|
|
84
|
+
required: true,
|
|
85
|
+
message: _unref(contextLocale).advanced.saveHistory.placeholder
|
|
86
|
+
}, {
|
|
87
|
+
max: 64,
|
|
88
|
+
message: _unref(contextLocale).advanced.saveHistory.ruleName
|
|
89
|
+
}]
|
|
90
|
+
}, {
|
|
91
|
+
default: _withCtx(() => [_createVNode(_unref(Textarea), {
|
|
92
|
+
value: modelRef.name,
|
|
93
|
+
"onUpdate:value": _cache[0] || (_cache[0] = $event => modelRef.name = $event),
|
|
94
|
+
rows: 3,
|
|
95
|
+
maxlength: 200
|
|
96
|
+
}, null, 8 /* PROPS */, ["value"])]),
|
|
97
|
+
_: 1 /* STABLE */
|
|
98
|
+
}, 8 /* PROPS */, ["rules"])]),
|
|
99
|
+
_: 1 /* STABLE */
|
|
100
|
+
}, 8 /* PROPS */, ["model"]), _createVNode(_unref(Button), {
|
|
101
|
+
loading: saveHistoryLoading.value,
|
|
102
|
+
type: "primary",
|
|
103
|
+
class: "save-btn",
|
|
104
|
+
style: {
|
|
105
|
+
"width": "100%"
|
|
106
|
+
},
|
|
107
|
+
onClick: saveHistory
|
|
108
|
+
}, {
|
|
109
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.saveHistory.save), 1 /* TEXT */)]),
|
|
110
|
+
_: 1 /* STABLE */
|
|
111
|
+
}, 8 /* PROPS */, ["loading"])])) : _createCommentVNode("v-if", true)]),
|
|
112
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
113
|
+
ghost: "",
|
|
114
|
+
type: "primary"
|
|
115
|
+
}, {
|
|
116
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.saveHistory.save), 1 /* TEXT */)]),
|
|
117
|
+
_: 1 /* STABLE */
|
|
118
|
+
})]),
|
|
119
|
+
_: 1 /* STABLE */
|
|
120
|
+
}, 8 /* PROPS */, ["open", "title"]);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createElementVNode as _createElementVNode, createVNode as _createVNode, normalizeClass as _normalizeClass, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, normalizeStyle as _normalizeStyle } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "left"
|
|
5
|
+
};
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
class: "left-items"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "center"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_4 = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "right"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_5 = {
|
|
18
|
+
class: "right-items"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_6 = {
|
|
21
|
+
class: "JSearch-footer--btns"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_7 = {
|
|
24
|
+
class: "more-text"
|
|
25
|
+
};
|
|
26
|
+
const _hoisted_8 = {
|
|
27
|
+
class: "JSearch-content single big pack-up"
|
|
28
|
+
};
|
|
29
|
+
const _hoisted_9 = {
|
|
30
|
+
class: "JSearch-items"
|
|
31
|
+
};
|
|
32
|
+
const _hoisted_10 = {
|
|
33
|
+
class: "left"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_11 = {
|
|
36
|
+
class: "JSearch-footer"
|
|
37
|
+
};
|
|
38
|
+
const _hoisted_12 = {
|
|
39
|
+
class: "JSearch-footer--btns"
|
|
40
|
+
};
|
|
41
|
+
import SearchItem from '../Item.js';
|
|
42
|
+
import { typeOptions } from '../setting';
|
|
43
|
+
import { useHandleColumns, useOptionMapContent, useRouteQuery } from '../hooks';
|
|
44
|
+
import { ref, reactive, watch, useAttrs, inject, computed } from 'vue';
|
|
45
|
+
import SaveHistory from './SaveHistory.js';
|
|
46
|
+
import History from './History.js';
|
|
47
|
+
import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat } from '../util';
|
|
48
|
+
import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
|
|
49
|
+
import AIcon from '../../Icon';
|
|
50
|
+
import { useLocaleReceiver } from '../../LocaleReciver';
|
|
51
|
+
import { SearchConfig } from '../../utils/constants';
|
|
52
|
+
import { isObject } from 'lodash-es';
|
|
53
|
+
import useSearchStyle from '../style';
|
|
54
|
+
const __sfc_main__ = _defineComponent({
|
|
55
|
+
...{
|
|
56
|
+
name: 'JAdvancedSearch',
|
|
57
|
+
inheritAttrs: false
|
|
58
|
+
},
|
|
59
|
+
__name: 'index',
|
|
60
|
+
props: {
|
|
61
|
+
columns: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: () => [],
|
|
64
|
+
required: true
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'advanced'
|
|
69
|
+
},
|
|
70
|
+
target: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
73
|
+
required: true
|
|
74
|
+
},
|
|
75
|
+
request: {
|
|
76
|
+
type: Function,
|
|
77
|
+
default: undefined
|
|
78
|
+
},
|
|
79
|
+
historyRequest: {
|
|
80
|
+
type: Function,
|
|
81
|
+
default: undefined
|
|
82
|
+
},
|
|
83
|
+
deleteRequest: {
|
|
84
|
+
type: Function,
|
|
85
|
+
default: null
|
|
86
|
+
},
|
|
87
|
+
deleteKey: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'key'
|
|
90
|
+
},
|
|
91
|
+
defaultValues: {
|
|
92
|
+
type: Object,
|
|
93
|
+
default: undefined
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
emits: ['search'],
|
|
97
|
+
setup(__props, {
|
|
98
|
+
expose: __expose,
|
|
99
|
+
emit: __emit
|
|
100
|
+
}) {
|
|
101
|
+
const props = __props;
|
|
102
|
+
const emit = __emit;
|
|
103
|
+
const columnsOptionMap = ref({}); // 存储每个columnItem的option
|
|
104
|
+
const terms = reactive({
|
|
105
|
+
terms: []
|
|
106
|
+
}); // 当前查询条件
|
|
107
|
+
const expand = ref(false);
|
|
108
|
+
const layout = ref('horizontal');
|
|
109
|
+
const compatible = ref(false);
|
|
110
|
+
const screenSize = ref(true);
|
|
111
|
+
const context = inject(SearchConfig);
|
|
112
|
+
const prefixCls = computed(() => 'JSearch');
|
|
113
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls);
|
|
114
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
115
|
+
const attrs = useAttrs();
|
|
116
|
+
const q = useRouteQuery('q');
|
|
117
|
+
const target = useRouteQuery('target');
|
|
118
|
+
const {
|
|
119
|
+
initValues,
|
|
120
|
+
columnsMap,
|
|
121
|
+
defaultCacheValues
|
|
122
|
+
} = useHandleColumns(props, terms, {
|
|
123
|
+
mode: 'advanced'
|
|
124
|
+
});
|
|
125
|
+
useOptionMapContent(columnsOptionMap);
|
|
126
|
+
const expandChange = () => {
|
|
127
|
+
expand.value = !expand.value;
|
|
128
|
+
terms.terms.length = 1;
|
|
129
|
+
if (expand.value) {
|
|
130
|
+
// 展开
|
|
131
|
+
let arr = Object.values(columnsMap.value);
|
|
132
|
+
const mergeArr = [];
|
|
133
|
+
for (let i = 1; i < 6; i++) {
|
|
134
|
+
const indexIn = i % arr.length;
|
|
135
|
+
const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues.value);
|
|
136
|
+
if (i === 3) {
|
|
137
|
+
obj.type = 'and';
|
|
138
|
+
}
|
|
139
|
+
mergeArr.push(obj);
|
|
140
|
+
}
|
|
141
|
+
terms.terms = [...terms.terms, ...mergeArr];
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const addUrlParams = () => {
|
|
145
|
+
if (props.target) {
|
|
146
|
+
q.value = encodeURI(JSON.stringify(terms));
|
|
147
|
+
target.value = props.target;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const submitData = () => {
|
|
151
|
+
const data = termsParamsFormat(terms, columnsMap.value);
|
|
152
|
+
emit('search', data);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 提交
|
|
157
|
+
*/
|
|
158
|
+
const searchSubmit = () => {
|
|
159
|
+
submitData();
|
|
160
|
+
if (props.type === 'advanced') {
|
|
161
|
+
addUrlParams();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 重置查询
|
|
167
|
+
*/
|
|
168
|
+
const reset = () => {
|
|
169
|
+
expand.value = false;
|
|
170
|
+
initValues();
|
|
171
|
+
if (props.type === 'advanced') {
|
|
172
|
+
q.value = null;
|
|
173
|
+
target.value = null;
|
|
174
|
+
}
|
|
175
|
+
emit('search', {
|
|
176
|
+
terms: []
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 历史下拉单选
|
|
182
|
+
* @param content {string}
|
|
183
|
+
*/
|
|
184
|
+
const historyItemClick = content => {
|
|
185
|
+
try {
|
|
186
|
+
const object = compatibleOldTerms(content, columnsMap.value, defaultCacheValues.value);
|
|
187
|
+
terms.terms = object.terms || [];
|
|
188
|
+
expand.value = object.expand;
|
|
189
|
+
searchSubmit();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
console.warn(`Search组件中han.dleUrlParams处理JSON时异常:【${e}】`);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* 处理URL中的查询参数
|
|
197
|
+
*/
|
|
198
|
+
const handleUrlParams = () => {
|
|
199
|
+
if (props.target && props.target === target.value) {
|
|
200
|
+
const params = decodeURI(q.value);
|
|
201
|
+
historyItemClick(params);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 处理传入的默认值
|
|
207
|
+
*/
|
|
208
|
+
const handleDefaultValues = value => {
|
|
209
|
+
if (!isObject(value)) return;
|
|
210
|
+
const _value = JSON.parse(JSON.stringify(value));
|
|
211
|
+
if (!(_value.terms.length === 1 && _value.terms[0].terms.length === 1)) {
|
|
212
|
+
let arr = Object.values(columnsMap.value);
|
|
213
|
+
for (let i = 1; i < 6; i++) {
|
|
214
|
+
const aIndex = i < 3 ? 0 : 1;
|
|
215
|
+
const bIndex = i % 3;
|
|
216
|
+
const item = _value.terms[aIndex].terms[bIndex];
|
|
217
|
+
if (!item) {
|
|
218
|
+
const fillItem = getItemDefaultValue(arr[aIndex * 3 + bIndex], defaultCacheValues.value);
|
|
219
|
+
if (i === 3) {
|
|
220
|
+
fillItem.type = 'and';
|
|
221
|
+
}
|
|
222
|
+
_value.terms[aIndex].terms[bIndex] = fillItem;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
historyItemClick(JSON.stringify(_value));
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* 清除值
|
|
231
|
+
*/
|
|
232
|
+
const clearValue = () => {
|
|
233
|
+
if (props.type === 'advanced' && props.target !== target.value) {
|
|
234
|
+
q.value = null;
|
|
235
|
+
target.value = null;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
handleUrlParams();
|
|
239
|
+
watch(() => props.target, () => {
|
|
240
|
+
clearValue();
|
|
241
|
+
}, {
|
|
242
|
+
immediate: true
|
|
243
|
+
});
|
|
244
|
+
__expose({
|
|
245
|
+
setValues: handleDefaultValues,
|
|
246
|
+
reset
|
|
247
|
+
});
|
|
248
|
+
return (_ctx, _cache) => {
|
|
249
|
+
return _openBlock(), _createBlock(_unref(Form), {
|
|
250
|
+
model: terms,
|
|
251
|
+
onFinish: searchSubmit
|
|
252
|
+
}, {
|
|
253
|
+
default: _withCtx(() => [_createElementVNode("div", {
|
|
254
|
+
ref: "searchRef",
|
|
255
|
+
class: _normalizeClass(['JSearch-warp senior', [_unref(attrs).class, _unref(hashId)]]),
|
|
256
|
+
style: _normalizeStyle(_unref(attrs).style)
|
|
257
|
+
}, [_createCommentVNode(" 高级模式 "), props.type === 'advanced' ? (_openBlock(), _createElementBlock("div", {
|
|
258
|
+
key: 0,
|
|
259
|
+
ref: "searchRefContentRef",
|
|
260
|
+
class: _normalizeClass(['JSearch-content', expand.value || compatible.value ? 'senior-expand' : 'pack-up', screenSize.value ? 'big' : 'small'])
|
|
261
|
+
}, [_createElementVNode("div", {
|
|
262
|
+
class: _normalizeClass(['JSearch-items', expand.value ? 'items-expand' : '', layout.value])
|
|
263
|
+
}, [_createElementVNode("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms.slice(0, 3), (item, index) => {
|
|
264
|
+
return _openBlock(), _createBlock(SearchItem, {
|
|
265
|
+
key: index,
|
|
266
|
+
expand: expand.value,
|
|
267
|
+
index: index + 1,
|
|
268
|
+
onlyValue: false,
|
|
269
|
+
value: item.value,
|
|
270
|
+
"onUpdate:value": $event => item.value = $event,
|
|
271
|
+
termType: item.termType,
|
|
272
|
+
"onUpdate:termType": $event => item.termType = $event,
|
|
273
|
+
column: item.column,
|
|
274
|
+
"onUpdate:column": $event => item.column = $event,
|
|
275
|
+
type: item.type,
|
|
276
|
+
"onUpdate:type": $event => item.type = $event
|
|
277
|
+
}, null, 8 /* PROPS */, ["expand", "index", "value", "onUpdate:value", "termType", "onUpdate:termType", "column", "onUpdate:column", "type", "onUpdate:type"]);
|
|
278
|
+
}), 128 /* KEYED_FRAGMENT */))])]), expand.value ? (_openBlock(), _createElementBlock("div", _hoisted_3, [_createVNode(_unref(Select), {
|
|
279
|
+
value: terms.terms[3].type,
|
|
280
|
+
"onUpdate:value": _cache[0] || (_cache[0] = $event => terms.terms[3].type = $event),
|
|
281
|
+
class: "center-select",
|
|
282
|
+
style: {
|
|
283
|
+
"width": "100px"
|
|
284
|
+
},
|
|
285
|
+
options: _unref(typeOptions)(_unref(contextLocale))
|
|
286
|
+
}, null, 8 /* PROPS */, ["value", "options"])])) : _createCommentVNode("v-if", true), expand.value ? (_openBlock(), _createElementBlock("div", _hoisted_4, [_createElementVNode("div", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms.slice(3, 6), (item, index) => {
|
|
287
|
+
return _openBlock(), _createElementBlock(_Fragment, {
|
|
288
|
+
key: index
|
|
289
|
+
}, [expand.value && index !== 4 ? (_openBlock(), _createBlock(SearchItem, {
|
|
290
|
+
key: 0,
|
|
291
|
+
expand: expand.value,
|
|
292
|
+
index: index + 4,
|
|
293
|
+
onlyValue: false,
|
|
294
|
+
value: item.value,
|
|
295
|
+
"onUpdate:value": $event => item.value = $event,
|
|
296
|
+
termType: item.termType,
|
|
297
|
+
"onUpdate:termType": $event => item.termType = $event,
|
|
298
|
+
column: item.column,
|
|
299
|
+
"onUpdate:column": $event => item.column = $event,
|
|
300
|
+
type: item.type,
|
|
301
|
+
"onUpdate:type": $event => item.type = $event
|
|
302
|
+
}, null, 8 /* PROPS */, ["expand", "index", "value", "onUpdate:value", "termType", "onUpdate:termType", "column", "onUpdate:column", "type", "onUpdate:type"])) : _createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */);
|
|
303
|
+
}), 128 /* KEYED_FRAGMENT */))])])) : _createCommentVNode("v-if", true)], 2 /* CLASS */), _createElementVNode("div", {
|
|
304
|
+
class: _normalizeClass(['JSearch-footer', expand.value || compatible.value ? 'expand' : ''])
|
|
305
|
+
}, [_renderSlot(_ctx.$slots, "footerRender", {
|
|
306
|
+
reset: reset,
|
|
307
|
+
submit: searchSubmit,
|
|
308
|
+
expandChange: expandChange
|
|
309
|
+
}, () => [_createElementVNode("div", _hoisted_6, [_createVNode(_unref(Button), {
|
|
310
|
+
onClick: reset
|
|
311
|
+
}, {
|
|
312
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.reset), 1 /* TEXT */)]),
|
|
313
|
+
_: 1 /* STABLE */
|
|
314
|
+
}), _createVNode(SaveHistory, {
|
|
315
|
+
terms: terms,
|
|
316
|
+
target: _unref(target),
|
|
317
|
+
request: props.request || _unref(context)?.saveRequest
|
|
318
|
+
}, null, 8 /* PROPS */, ["terms", "target", "request"]), _createVNode(History, {
|
|
319
|
+
target: _unref(target),
|
|
320
|
+
request: props.historyRequest || _unref(context)?.historyRequest,
|
|
321
|
+
"delete-request": props.deleteRequest || _unref(context)?.deleteRequest,
|
|
322
|
+
"delete-key": props.deleteKey || _unref(context)?.deleteKey,
|
|
323
|
+
onClick: searchSubmit,
|
|
324
|
+
onItemClick: historyItemClick
|
|
325
|
+
}, null, 8 /* PROPS */, ["target", "request", "delete-request", "delete-key"])]), _createVNode(_unref(Button), {
|
|
326
|
+
type: "link",
|
|
327
|
+
class: "more-btn",
|
|
328
|
+
onClick: expandChange
|
|
329
|
+
}, {
|
|
330
|
+
default: _withCtx(() => [_createElementVNode("span", _hoisted_7, _toDisplayString(_unref(contextLocale).advanced.more), 1 /* TEXT */), _createVNode(_unref(AIcon), {
|
|
331
|
+
type: "DoubleRightOutlined",
|
|
332
|
+
class: _normalizeClass(['more-icon', expand.value ? 'more-up' : 'more-down'])
|
|
333
|
+
}, null, 8 /* PROPS */, ["class"])]),
|
|
334
|
+
_: 1 /* STABLE */
|
|
335
|
+
})])], 2 /* CLASS */)], 2 /* CLASS */)) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
336
|
+
key: 1
|
|
337
|
+
}, [_createCommentVNode(" 简单模式 "), _createElementVNode("div", _hoisted_8, [_createElementVNode("div", _hoisted_9, [_createElementVNode("div", _hoisted_10, [_createVNode(SearchItem, {
|
|
338
|
+
expand: false,
|
|
339
|
+
index: 1,
|
|
340
|
+
onlyValue: false,
|
|
341
|
+
value: terms.terms[0].value,
|
|
342
|
+
"onUpdate:value": _cache[1] || (_cache[1] = $event => terms.terms[0].value = $event),
|
|
343
|
+
termType: terms.terms[0].termType,
|
|
344
|
+
"onUpdate:termType": _cache[2] || (_cache[2] = $event => terms.terms[0].termType = $event),
|
|
345
|
+
column: terms.terms[0].column,
|
|
346
|
+
"onUpdate:column": _cache[3] || (_cache[3] = $event => terms.terms[0].column = $event),
|
|
347
|
+
type: terms.terms[0].type,
|
|
348
|
+
"onUpdate:type": _cache[4] || (_cache[4] = $event => terms.terms[0].type = $event)
|
|
349
|
+
}, null, 8 /* PROPS */, ["value", "termType", "column", "type"])])]), _createElementVNode("div", _hoisted_11, [_createElementVNode("div", _hoisted_12, [_createVNode(_unref(FormItemRest), null, {
|
|
350
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
351
|
+
onClick: reset
|
|
352
|
+
}, {
|
|
353
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.reset), 1 /* TEXT */)]),
|
|
354
|
+
_: 1 /* STABLE */
|
|
355
|
+
}), _createVNode(_unref(Button), {
|
|
356
|
+
"html-type": "submit",
|
|
357
|
+
type: "primary"
|
|
358
|
+
}, {
|
|
359
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.search), 1 /* TEXT */)]),
|
|
360
|
+
_: 1 /* STABLE */
|
|
361
|
+
})]),
|
|
362
|
+
_: 1 /* STABLE */
|
|
363
|
+
})])])])], 64 /* STABLE_FRAGMENT */))], 6 /* CLASS, STYLE */)]),
|
|
364
|
+
_: 3 /* FORWARDED */
|
|
365
|
+
}, 8 /* PROPS */, ["model"]);
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
export default __sfc_main__;
|
package/es/Search/Item.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createVNode as _createVNode, Fragment as _Fragment, resolveDynamicComponent as _resolveDynamicComponent, mergeProps as _mergeProps, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "JSearch-item--type"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 1
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_3 = {
|
|
11
|
+
class: "JSearch-item--value"
|
|
12
|
+
};
|
|
13
|
+
import { computed, ref, reactive, watch, isRef } from 'vue';
|
|
2
14
|
import { Select } from 'ant-design-vue';
|
|
3
15
|
import { componentProps, componentType, typeOptions } from './setting';
|
|
4
16
|
import { getTermOptions, getItemDefaultValue } from './util';
|
|
@@ -6,11 +18,11 @@ import { useLocaleReceiver } from '../LocaleReciver';
|
|
|
6
18
|
import { useColumnsMap, useDefaultValue, useOptionMap } from './hooks';
|
|
7
19
|
import { isArray, isFunction } from 'lodash-es';
|
|
8
20
|
import useSearchStyle from './style';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Select
|
|
21
|
+
const __sfc_main__ = _defineComponent({
|
|
22
|
+
...{
|
|
23
|
+
name: 'JSearchItem'
|
|
13
24
|
},
|
|
25
|
+
__name: 'Item',
|
|
14
26
|
props: {
|
|
15
27
|
column: {
|
|
16
28
|
type: String
|
|
@@ -44,9 +56,11 @@ export default defineComponent({
|
|
|
44
56
|
}
|
|
45
57
|
},
|
|
46
58
|
emits: ['update:value', 'update:termType', 'update:type', 'update:column'],
|
|
47
|
-
setup(
|
|
48
|
-
emit
|
|
59
|
+
setup(__props, {
|
|
60
|
+
emit: __emit
|
|
49
61
|
}) {
|
|
62
|
+
const props = __props;
|
|
63
|
+
const emit = __emit;
|
|
50
64
|
const termsModel = reactive({
|
|
51
65
|
type: props.type || 'or',
|
|
52
66
|
value: props.value || '',
|
|
@@ -193,19 +207,54 @@ export default defineComponent({
|
|
|
193
207
|
termsModel.column = props.column;
|
|
194
208
|
termsModel.type = props.type;
|
|
195
209
|
});
|
|
196
|
-
return {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
return (_ctx, _cache) => {
|
|
211
|
+
return _openBlock(), _createElementBlock("div", {
|
|
212
|
+
class: _normalizeClass(['JSearch-item', _unref(hashId)])
|
|
213
|
+
}, [_createCommentVNode(" onlyValue 为 true 时显示 label "), __props.onlyValue ? (_openBlock(), _createElementBlock("div", {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "JSearch-item--label",
|
|
216
|
+
style: _normalizeStyle({
|
|
217
|
+
minWidth: `${__props.labelWidth}px`
|
|
218
|
+
})
|
|
219
|
+
}, _toDisplayString(targetComponents.value.label), 5 /* TEXT, STYLE */)) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
220
|
+
key: 1
|
|
221
|
+
}, [_createCommentVNode(" onlyValue 为 false 时显示更多选项 "), _createCommentVNode(" 展开模式下显示类型选择 "), __props.expand ? (_openBlock(), _createElementBlock("div", _hoisted_1, [__props.index !== 1 && __props.index !== 4 ? (_openBlock(), _createBlock(_unref(Select), {
|
|
222
|
+
key: 0,
|
|
223
|
+
value: termsModel.type,
|
|
224
|
+
"onUpdate:value": _cache[0] || (_cache[0] = $event => termsModel.type = $event),
|
|
225
|
+
options: _unref(typeOptions)(_unref(contextLocale)),
|
|
226
|
+
style: {
|
|
227
|
+
"width": "100%"
|
|
228
|
+
},
|
|
229
|
+
onChange: onTypeChange
|
|
230
|
+
}, null, 8 /* PROPS */, ["value", "options"])) : (_openBlock(), _createElementBlock("span", _hoisted_2, _toDisplayString(__props.index === 1 ? _unref(contextLocale).item.firstGroup : _unref(contextLocale).item.secondGroup), 1 /* TEXT */))])) : _createCommentVNode("v-if", true), _createCommentVNode(" 列选择 "), _createVNode(_unref(Select), {
|
|
231
|
+
value: termsModel.column,
|
|
232
|
+
"onUpdate:value": _cache[1] || (_cache[1] = $event => termsModel.column = $event),
|
|
233
|
+
placeholder: _unref(contextLocale).item.placeholder,
|
|
234
|
+
class: "JSearch-item--column",
|
|
235
|
+
options: columnOptions.value,
|
|
236
|
+
onChange: onColumnChange
|
|
237
|
+
}, null, 8 /* PROPS */, ["value", "placeholder", "options"]), _createCommentVNode(" 条件类型选择 "), _createVNode(_unref(Select), {
|
|
238
|
+
value: termsModel.termType,
|
|
239
|
+
"onUpdate:value": _cache[2] || (_cache[2] = $event => termsModel.termType = $event),
|
|
240
|
+
placeholder: _unref(contextLocale).item.placeholder,
|
|
241
|
+
class: "JSearch-item--termType",
|
|
242
|
+
options: termTypeOptions.value,
|
|
243
|
+
onChange: onTermTypeChange
|
|
244
|
+
}, null, 8 /* PROPS */, ["value", "placeholder", "options"])], 64 /* STABLE_FRAGMENT */)), _createCommentVNode(" 值输入 "), _createElementVNode("div", _hoisted_3, [(_openBlock(), _createBlock(_resolveDynamicComponent(targetComponents.value.name), _mergeProps({
|
|
245
|
+
"allow-clear": "",
|
|
246
|
+
style: {
|
|
247
|
+
"width": "100%",
|
|
248
|
+
"min-width": "80px"
|
|
249
|
+
}
|
|
250
|
+
}, targetComponents.value.props, {
|
|
251
|
+
options: !['treeSelect', 'tree'].includes(targetComponents.value.type) && valueOptions.value,
|
|
252
|
+
treeData: ['treeSelect', 'tree'].includes(targetComponents.value.type) && valueOptions.value,
|
|
253
|
+
value: termsModel.value,
|
|
254
|
+
"onUpdate:value": _cache[3] || (_cache[3] = $event => termsModel.value = $event),
|
|
255
|
+
onChange: onValueChange
|
|
256
|
+
}), null, 16 /* FULL_PROPS */, ["options", "treeData", "value"]))])], 2 /* CLASS */);
|
|
209
257
|
};
|
|
210
258
|
}
|
|
211
|
-
});
|
|
259
|
+
});
|
|
260
|
+
export default __sfc_main__;
|