@jetlinks-web/components 3.1.5 → 3.1.6

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/Search/Item.js CHANGED
@@ -50,6 +50,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
50
50
  "columnsValues": "setup-maybe-ref",
51
51
  "targetComponents": "setup-ref",
52
52
  "valueOptions": "setup-ref",
53
+ "btwKeys": "setup-const",
53
54
  "prefixCls": "setup-ref",
54
55
  "wrapSSR": "setup-maybe-ref",
55
56
  "hashId": "setup-maybe-ref",
@@ -131,6 +132,7 @@ const __sfc_main__ = _defineComponent({
131
132
  const columnsValues = useDefaultValue();
132
133
  const targetComponents = ref({});
133
134
  const valueOptions = ref();
135
+ const btwKeys = ['in', 'nin'];
134
136
  const prefixCls = computed(() => 'JSearch');
135
137
  const [wrapSSR, hashId] = useSearchStyle(prefixCls);
136
138
  const termTypeOptions = computed(() => {
@@ -185,29 +187,40 @@ const __sfc_main__ = _defineComponent({
185
187
  onValueChange();
186
188
  };
187
189
  const onTermTypeChange = () => {
190
+ const isBtw = btwKeys.includes(termsModel.termType);
191
+ if (!isBtw && Array.isArray(termsModel.value)) {
192
+ termsModel.value = termsModel.value[0];
193
+ onValueChange();
194
+ }
195
+ else if (isBtw && !Array.isArray(termsModel.value)) {
196
+ termsModel.value = [termsModel.value];
197
+ onValueChange();
198
+ }
188
199
  emit('update:termType', termsModel.termType);
189
200
  };
190
201
  const onValueChange = () => {
191
202
  emit('update:value', termsModel.value);
192
203
  };
193
204
  watch(() => termsModel.termType, () => {
194
- const isBtw = ['in', 'nin'].includes(termsModel.termType);
205
+ const isBtw = btwKeys.includes(termsModel.termType);
195
206
  if (targetComponents.value.type === componentType.treeSelect) {
196
207
  targetComponents.value.props = {
197
- multiple: isBtw,
198
208
  ...targetComponents.value.props,
209
+ multiple: isBtw,
199
210
  };
200
211
  }
201
212
  else if (targetComponents.value.type === componentType.select) {
202
213
  targetComponents.value.props = {
203
- mode: isBtw ? 'multiple' : 'combobox',
204
214
  ...targetComponents.value.props,
215
+ mode: isBtw ? 'multiple' : 'combobox',
205
216
  };
206
217
  }
207
218
  }, { immediate: true });
208
- watch(() => termsModel.column, async () => {
219
+ watch(() => [termsModel.column, columnsMap.value], async () => {
209
220
  // 根据column从map中获取record,再解析search属性
210
221
  const record = findItemByColumn();
222
+ if (!record)
223
+ return;
211
224
  const options = findOptionsByColumn();
212
225
  targetComponents.value = componentProps(record.search);
213
226
  targetComponents.value.label = record.title;
@@ -218,7 +231,7 @@ const __sfc_main__ = _defineComponent({
218
231
  else {
219
232
  await handleColumnsOptions(record.search.options);
220
233
  }
221
- }, { immediate: true });
234
+ }, { immediate: true, deep: true });
222
235
  watch(() => [props.value, props.termType, props.column, props.type], () => {
223
236
  termsModel.value = props.value;
224
237
  termsModel.termType = props.termType;
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
2
  import { TreeSelect, Select, Input, InputNumber, DatePicker, TimePicker, InputPassword, RangePicker, TimeRangePicker } from 'ant-design-vue';
4
3
  import { filterSelectNode, filterTreeSelectNode } from "./util";
@@ -108,7 +107,7 @@ export var termType = function termType(locale) {
108
107
  };
109
108
  export var componentType = {
110
109
  input: 'input',
111
- inputNumber: 'inputNumber',
110
+ inputNumber: 'number',
112
111
  password: 'password',
113
112
  switch: 'switch',
114
113
  radio: 'radio',
@@ -183,7 +182,7 @@ export var componentProps = function componentProps(record) {
183
182
  return {
184
183
  type: type,
185
184
  name: TreeSelect,
186
- props: _objectSpread(_defineProperty({
185
+ props: _objectSpread({
187
186
  showSearch: true,
188
187
  height: 350,
189
188
  fieldNames: {
@@ -193,9 +192,7 @@ export var componentProps = function componentProps(record) {
193
192
  filterTreeNode: function filterTreeNode(v, option) {
194
193
  return filterTreeSelectNode(v, option);
195
194
  }
196
- }, "filterTreeNode", function filterTreeNode(v, option) {
197
- return filterTreeSelectNode(v, option);
198
- }), _props)
195
+ }, _props)
199
196
  };
200
197
  case componentType.select:
201
198
  return {
@@ -50,6 +50,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
50
50
  "columnsValues": "setup-maybe-ref",
51
51
  "targetComponents": "setup-ref",
52
52
  "valueOptions": "setup-ref",
53
+ "btwKeys": "setup-const",
53
54
  "prefixCls": "setup-ref",
54
55
  "wrapSSR": "setup-maybe-ref",
55
56
  "hashId": "setup-maybe-ref",
@@ -131,6 +132,7 @@ const __sfc_main__ = _defineComponent({
131
132
  const columnsValues = useDefaultValue();
132
133
  const targetComponents = ref({});
133
134
  const valueOptions = ref();
135
+ const btwKeys = ['in', 'nin'];
134
136
  const prefixCls = computed(() => 'JSearch');
135
137
  const [wrapSSR, hashId] = useSearchStyle(prefixCls);
136
138
  const termTypeOptions = computed(() => {
@@ -185,29 +187,40 @@ const __sfc_main__ = _defineComponent({
185
187
  onValueChange();
186
188
  };
187
189
  const onTermTypeChange = () => {
190
+ const isBtw = btwKeys.includes(termsModel.termType);
191
+ if (!isBtw && Array.isArray(termsModel.value)) {
192
+ termsModel.value = termsModel.value[0];
193
+ onValueChange();
194
+ }
195
+ else if (isBtw && !Array.isArray(termsModel.value)) {
196
+ termsModel.value = [termsModel.value];
197
+ onValueChange();
198
+ }
188
199
  emit('update:termType', termsModel.termType);
189
200
  };
190
201
  const onValueChange = () => {
191
202
  emit('update:value', termsModel.value);
192
203
  };
193
204
  watch(() => termsModel.termType, () => {
194
- const isBtw = ['in', 'nin'].includes(termsModel.termType);
205
+ const isBtw = btwKeys.includes(termsModel.termType);
195
206
  if (targetComponents.value.type === componentType.treeSelect) {
196
207
  targetComponents.value.props = {
197
- multiple: isBtw,
198
208
  ...targetComponents.value.props,
209
+ multiple: isBtw,
199
210
  };
200
211
  }
201
212
  else if (targetComponents.value.type === componentType.select) {
202
213
  targetComponents.value.props = {
203
- mode: isBtw ? 'multiple' : 'combobox',
204
214
  ...targetComponents.value.props,
215
+ mode: isBtw ? 'multiple' : 'combobox',
205
216
  };
206
217
  }
207
218
  }, { immediate: true });
208
- watch(() => termsModel.column, async () => {
219
+ watch(() => [termsModel.column, columnsMap.value], async () => {
209
220
  // 根据column从map中获取record,再解析search属性
210
221
  const record = findItemByColumn();
222
+ if (!record)
223
+ return;
211
224
  const options = findOptionsByColumn();
212
225
  targetComponents.value = componentProps(record.search);
213
226
  targetComponents.value.label = record.title;
@@ -218,7 +231,7 @@ const __sfc_main__ = _defineComponent({
218
231
  else {
219
232
  await handleColumnsOptions(record.search.options);
220
233
  }
221
- }, { immediate: true });
234
+ }, { immediate: true, deep: true });
222
235
  watch(() => [props.value, props.termType, props.column, props.type], () => {
223
236
  termsModel.value = props.value;
224
237
  termsModel.termType = props.termType;
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.typeOptions = exports.termType = exports.searchProps = exports.optionsMapKey = exports.componentType = exports.componentProps = exports.TermTypeMap = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
9
  var _antDesignVue = require("ant-design-vue");
11
10
  var _util = require("./util");
12
11
  var optionsMapKey = exports.optionsMapKey = Symbol('searchOptionsMap');
@@ -115,7 +114,7 @@ var termType = exports.termType = function termType(locale) {
115
114
  };
116
115
  var componentType = exports.componentType = {
117
116
  input: 'input',
118
- inputNumber: 'inputNumber',
117
+ inputNumber: 'number',
119
118
  password: 'password',
120
119
  switch: 'switch',
121
120
  radio: 'radio',
@@ -157,7 +156,7 @@ var componentProps = exports.componentProps = function componentProps(record) {
157
156
  return {
158
157
  type: type,
159
158
  name: _antDesignVue.TimePicker,
160
- props: (0, _objectSpread3.default)({
159
+ props: (0, _objectSpread2.default)({
161
160
  valueFormat: 'HH:mm:ss'
162
161
  }, _props)
163
162
  };
@@ -165,7 +164,7 @@ var componentProps = exports.componentProps = function componentProps(record) {
165
164
  return {
166
165
  type: type,
167
166
  name: _antDesignVue.DatePicker,
168
- props: (0, _objectSpread3.default)({
167
+ props: (0, _objectSpread2.default)({
169
168
  valueFormat: 'YYYY-MM-DD HH:mm:ss'
170
169
  }, _props)
171
170
  };
@@ -173,7 +172,7 @@ var componentProps = exports.componentProps = function componentProps(record) {
173
172
  return {
174
173
  type: type,
175
174
  name: _antDesignVue.TimeRangePicker,
176
- props: (0, _objectSpread3.default)({
175
+ props: (0, _objectSpread2.default)({
177
176
  valueFormat: 'HH:mm:ss'
178
177
  }, _props)
179
178
  };
@@ -181,7 +180,7 @@ var componentProps = exports.componentProps = function componentProps(record) {
181
180
  return {
182
181
  type: type,
183
182
  name: _antDesignVue.RangePicker,
184
- props: (0, _objectSpread3.default)({
183
+ props: (0, _objectSpread2.default)({
185
184
  valueFormat: 'YYYY-MM-DD HH:mm:ss',
186
185
  showTime: true
187
186
  }, _props)
@@ -190,7 +189,7 @@ var componentProps = exports.componentProps = function componentProps(record) {
190
189
  return {
191
190
  type: type,
192
191
  name: _antDesignVue.TreeSelect,
193
- props: (0, _objectSpread3.default)((0, _defineProperty2.default)({
192
+ props: (0, _objectSpread2.default)({
194
193
  showSearch: true,
195
194
  height: 350,
196
195
  fieldNames: {
@@ -200,15 +199,13 @@ var componentProps = exports.componentProps = function componentProps(record) {
200
199
  filterTreeNode: function filterTreeNode(v, option) {
201
200
  return (0, _util.filterTreeSelectNode)(v, option);
202
201
  }
203
- }, "filterTreeNode", function filterTreeNode(v, option) {
204
- return (0, _util.filterTreeSelectNode)(v, option);
205
- }), _props)
202
+ }, _props)
206
203
  };
207
204
  case componentType.select:
208
205
  return {
209
206
  type: type,
210
207
  name: _antDesignVue.Select,
211
- props: (0, _objectSpread3.default)({
208
+ props: (0, _objectSpread2.default)({
212
209
  showSearch: true,
213
210
  // mode: isBtw ? 'multiple' : 'combobox',
214
211
  filterOption: function filterOption(v, option) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -154,8 +154,8 @@
154
154
  "webpack-dev-server": "^4.0.0",
155
155
  "webpack-merge": "^5.0.0",
156
156
  "webpackbar": "^5.0.2",
157
- "@jetlinks-web/hooks": "^1.1.1",
158
157
  "@jetlinks-web/constants": "^1.0.9",
158
+ "@jetlinks-web/hooks": "^1.1.1",
159
159
  "@jetlinks-web/utils": "^1.2.12"
160
160
  },
161
161
  "publishConfig": {