@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.
@@ -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__;
@@ -1,4 +1,16 @@
1
- import { defineComponent, computed, ref, reactive, watch, isRef } from 'vue';
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
- export default defineComponent({
10
- name: 'JSearchItem',
11
- components: {
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(props, {
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
- termsModel,
198
- contextLocale,
199
- targetComponents,
200
- valueOptions,
201
- hashId,
202
- termTypeOptions,
203
- columnOptions,
204
- typeOptions,
205
- onTypeChange,
206
- onColumnChange,
207
- onTermTypeChange,
208
- onValueChange
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__;
@@ -1,4 +1,12 @@
1
- import { defineComponent, reactive, ref, computed, inject, useAttrs } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue";
3
+ const _hoisted_1 = {
4
+ class: "JSearch-content simple"
5
+ };
6
+ const _hoisted_2 = {
7
+ class: "JSearch-items"
8
+ };
9
+ import { reactive, ref, computed, inject, useAttrs } from 'vue';
2
10
  import { searchProps } from './setting';
3
11
  import { useLocaleReceiver } from '../LocaleReciver';
4
12
  import { Button, Col, Form, FormItemRest, Row } from 'ant-design-vue';
@@ -7,25 +15,22 @@ import Item from './Item.js';
7
15
  import { useHandleColumns, useOptionMapContent } from './hooks';
8
16
  import { termsParamsFormat } from './util';
9
17
  import useSearchStyle from './style';
10
- export default defineComponent({
11
- name: 'JSearch',
12
- components: {
13
- Button,
14
- Col,
15
- Form,
16
- FormItemRest,
17
- Row,
18
- Item
18
+ const __sfc_main__ = _defineComponent({
19
+ ...{
20
+ name: 'JSearch',
21
+ inheritAttrs: false
19
22
  },
20
- inheritAttrs: false,
23
+ __name: 'Search',
21
24
  props: {
22
25
  ...searchProps()
23
26
  },
24
27
  emits: ['search'],
25
- setup(props, {
26
- emit,
27
- expose
28
+ setup(__props, {
29
+ expose: __expose,
30
+ emit: __emit
28
31
  }) {
32
+ const props = __props;
33
+ const emit = __emit;
29
34
  const [contextLocale] = useLocaleReceiver('Search');
30
35
  const attrs = useAttrs();
31
36
  const columnsOptionMap = ref({}); // 存储每个columnItem的option
@@ -73,18 +78,70 @@ export default defineComponent({
73
78
  });
74
79
  emit('search', termsParamsFormat(terms, columnsMap.value));
75
80
  };
76
- expose({
81
+ __expose({
77
82
  setValues: handleDefaultValues,
78
83
  reset
79
84
  });
80
- return {
81
- contextLocale,
82
- attrs,
83
- terms,
84
- hashId,
85
- footerStyles,
86
- searchSubmit,
87
- reset
85
+ return (_ctx, _cache) => {
86
+ return _openBlock(), _createBlock(_unref(Form), {
87
+ model: terms,
88
+ onFinish: searchSubmit
89
+ }, {
90
+ default: _withCtx(() => [_createElementVNode("div", {
91
+ class: _normalizeClass(['JSearch-warp', _unref(attrs).class, _unref(hashId)]),
92
+ style: _normalizeStyle(_unref(attrs).style)
93
+ }, [_createElementVNode("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_createVNode(_unref(Row), {
94
+ gutter: [16, 16]
95
+ }, {
96
+ default: _withCtx(() => [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms, (item, index) => {
97
+ return _openBlock(), _createBlock(_unref(Col), {
98
+ key: index,
99
+ span: item._span || 24 / _ctx.column
100
+ }, {
101
+ default: _withCtx(() => [_createVNode(Item, {
102
+ value: item.value,
103
+ "onUpdate:value": $event => item.value = $event,
104
+ termType: item.termType,
105
+ "onUpdate:termType": $event => item.termType = $event,
106
+ column: item.column,
107
+ "onUpdate:column": $event => item.column = $event,
108
+ type: item.type,
109
+ "onUpdate:type": $event => item.type = $event,
110
+ labelWidth: _ctx.labelWidth
111
+ }, null, 8 /* PROPS */, ["value", "onUpdate:value", "termType", "onUpdate:termType", "column", "onUpdate:column", "type", "onUpdate:type", "labelWidth"])]),
112
+ _: 2 /* DYNAMIC */
113
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["span"]);
114
+ }), 128 /* KEYED_FRAGMENT */)), _createVNode(_unref(Col), {
115
+ span: 24 / _ctx.column
116
+ }, {
117
+ default: _withCtx(() => [_renderSlot(_ctx.$slots, "footerRender", {
118
+ reset: reset,
119
+ submit: searchSubmit
120
+ }, () => [_createElementVNode("div", {
121
+ class: "JSearch-footer--btns",
122
+ style: _normalizeStyle(footerStyles.value)
123
+ }, [_createVNode(_unref(Button), {
124
+ onClick: reset
125
+ }, {
126
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(_ctx.resetText || _unref(contextLocale)?.search?.reset), 1 /* TEXT */)]),
127
+ _: 1 /* STABLE */
128
+ }), _createVNode(_unref(FormItemRest), null, {
129
+ default: _withCtx(() => [_createVNode(_unref(Button), {
130
+ "html-type": "submit",
131
+ type: "primary"
132
+ }, {
133
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(_ctx.submitText || _unref(contextLocale)?.search?.search), 1 /* TEXT */)]),
134
+ _: 1 /* STABLE */
135
+ })]),
136
+ _: 1 /* STABLE */
137
+ })], 4 /* STYLE */)])]),
138
+ _: 3 /* FORWARDED */
139
+ }, 8 /* PROPS */, ["span"])]),
140
+ _: 3 /* FORWARDED */
141
+ })])])], 6 /* CLASS, STYLE */)]),
142
+ _: 3 /* FORWARDED */
143
+ }, 8 /* PROPS */, ["model"]);
88
144
  };
89
145
  }
90
- });
146
+ });
147
+ export default __sfc_main__;
@@ -1,10 +1,10 @@
1
+ import AdvancedSearch from './Advanced/index.js'
1
2
  import Search from './Search.js'
2
3
 
3
4
  Search.install = function (app) {
4
5
  app.component(Search.name, Search)
6
+ app.component(AdvancedSearch.name, AdvancedSearch)
5
7
  }
6
8
 
9
+ export { AdvancedSearch }
7
10
  export default Search
8
- export * from './hooks'
9
- export * from './util'
10
- export * from './setting'
@@ -27,7 +27,7 @@ export default defineComponent({
27
27
  default: () => []
28
28
  },
29
29
  rowSelection: {
30
- type: Object
30
+ type: [Object, Boolean]
31
31
  },
32
32
  rowKey: {
33
33
  type: [String, Function],
@@ -220,10 +220,10 @@ export default defineComponent({
220
220
  container,
221
221
  selectedAll,
222
222
  visibleRows,
223
- _indeterminate,
223
+ checkIndeterminate: _indeterminate,
224
224
  viewportHeight,
225
- _columns,
226
- _rowSelection,
225
+ tableColumns: _columns,
226
+ tableRowSelection: _rowSelection,
227
227
  totalHeight,
228
228
  offsetY,
229
229
  firstColumn,
package/lib/components.js CHANGED
@@ -10,7 +10,7 @@ export { default as PermissionButton } from './PermissionButton'
10
10
  export { default as ProLayout, PageContainer } from './ProLayout'
11
11
  export { default as ProTable } from './ProTable'
12
12
  export { default as Scrollbar } from './Scrollbar'
13
- export { default as Search } from './Search'
13
+ export { default as Search, AdvancedSearch } from './Search'
14
14
  export { default as ValueItem } from './ValueItem'
15
15
  export { default as TimeFormat } from './TimeFormat'
16
16
  export { default as DragModal } from './DragModal'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meethive/components",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",