@meethive/components 0.0.10 → 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.
@@ -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__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meethive/components",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",