@jetlinks-web/components 2.4.11 → 2.4.13

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.
@@ -48,7 +48,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
48
48
  "onFieldChange": "setup-const"
49
49
  } */
50
50
  import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
51
- const _withScopeId = n => (_pushScopeId("data-v-1734058145743"), n = n(), _popScopeId(), n);
51
+ const _withScopeId = n => (_pushScopeId("data-v-1735098504716"), n = n(), _popScopeId(), n);
52
52
  const _hoisted_1 = { style: { "color": "#1d2129" } };
53
53
  const _hoisted_2 = {
54
54
  key: 0,
@@ -9,7 +9,7 @@
9
9
  } */
10
10
  import { defineComponent as _defineComponent } from 'vue';
11
11
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
- const _withScopeId = n => (_pushScopeId("data-v-1734058146991"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1735098505186"), n = n(), _popScopeId(), n);
13
13
  const _hoisted_1 = { class: "full-page-warp-content" };
14
14
  import { ref, inject } from 'vue';
15
15
  import { useElementBounding } from '@vueuse/core';
@@ -149,14 +149,6 @@ const __sfc_main__ = _defineComponent({
149
149
  }
150
150
  };
151
151
  const _debounceFn = debounce(handleSearch, 300);
152
- watch(() => props.params, (newValue) => {
153
- _debounceFn(newValue || {});
154
- }, { deep: true, immediate: true });
155
- watch(() => props.dataSource, (newVal) => {
156
- if (newVal && !props.request) {
157
- handleSearch(props.params);
158
- }
159
- }, { deep: true, immediate: true });
160
152
  const onPageChange = (_page, size) => {
161
153
  handleSearch({
162
154
  ...props.params,
@@ -218,6 +210,14 @@ const __sfc_main__ = _defineComponent({
218
210
  }
219
211
  }
220
212
  };
213
+ watch(() => props.params, (newValue) => {
214
+ _debounceFn(newValue || {});
215
+ }, { deep: true, immediate: true });
216
+ watch(() => props.dataSource, (newVal) => {
217
+ if (newVal && !props.request) {
218
+ handleSearch(props.params);
219
+ }
220
+ }, { deep: true, immediate: true });
221
221
  onMounted(() => {
222
222
  windowChange(); // 初始化
223
223
  window.onresize = () => {
@@ -3,6 +3,7 @@ import { tableProps } from "ant-design-vue/es/table/Table";
3
3
  import "vue";
4
4
  import "ant-design-vue/es/table";
5
5
  import { paginationProps } from 'ant-design-vue/es/pagination/Pagination';
6
+ import { omit } from 'lodash-es';
6
7
  export var _headerProps = {
7
8
  mode: {
8
9
  type: [String, undefined],
@@ -57,7 +58,7 @@ export var _contentProps = _objectSpread(_objectSpread(_objectSpread({}, tablePr
57
58
  default: 'id'
58
59
  }
59
60
  });
60
- export var _paginationProps = _objectSpread(_objectSpread({}, paginationProps()), {}, {
61
+ export var _paginationProps = _objectSpread(_objectSpread({}, omit(paginationProps(), ['onChange'])), {}, {
61
62
  total: {
62
63
  type: Number,
63
64
  default: 0
@@ -10,7 +10,7 @@
10
10
  "onClick": "setup-const"
11
11
  } */
12
12
  import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
13
- const _withScopeId = n => (_pushScopeId("data-v-1734058148932"), n = n(), _popScopeId(), n);
13
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506101"), n = n(), _popScopeId(), n);
14
14
  const _hoisted_1 = ["onClick"];
15
15
  const __sfc_main__ = Object.assign({
16
16
  name: 'JRadioButton',
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
23
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
- const _withScopeId = n => (_pushScopeId("data-v-1734058149795"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506939"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
@@ -25,6 +25,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
25
25
  "deleteKey": "props",
26
26
  "routerMode": "props",
27
27
  "style": "props",
28
+ "defaultValues": "props",
28
29
  "SearchItem": "setup-const",
29
30
  "optionsMapKey": "setup-maybe-ref",
30
31
  "typeOptions": "setup-maybe-ref",
@@ -42,6 +43,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
42
43
  "handleQData": "setup-maybe-ref",
43
44
  "hasExpand": "setup-maybe-ref",
44
45
  "termsParamsFormat": "setup-maybe-ref",
46
+ "termsToValue": "setup-maybe-ref",
45
47
  "Select": "setup-maybe-ref",
46
48
  "Button": "setup-maybe-ref",
47
49
  "Form": "setup-maybe-ref",
@@ -59,6 +61,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
59
61
  "compatible": "setup-ref",
60
62
  "screenSize": "setup-ref",
61
63
  "resetNumber": "setup-ref",
64
+ "isFirstHandleDefaultValues": "setup-let",
62
65
  "searchItems": "setup-ref",
63
66
  "termsData": "setup-reactive-const",
64
67
  "columnOptionMap": "setup-ref",
@@ -71,6 +74,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
71
74
  "reset": "setup-const",
72
75
  "historyItemClick": "setup-const",
73
76
  "handleUrlParams": "setup-const",
77
+ "handleDefaultValues": "setup-const",
74
78
  "handleItems": "setup-const"
75
79
  } */
76
80
  import { defineComponent as _defineComponent } from 'vue';
@@ -100,7 +104,7 @@ import { useRouteQuery } from '@vueuse/router';
100
104
  import { ref, reactive, watch, provide } from 'vue';
101
105
  import SaveHistory from './SaveHistory.js';
102
106
  import History from './History.js';
103
- import { compatibleOldTerms, getTermTypeFn, handleQData, hasExpand, termsParamsFormat, } from '../util';
107
+ import { compatibleOldTerms, getTermTypeFn, handleQData, hasExpand, termsParamsFormat, termsToValue, } from '../util';
104
108
  import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
105
109
  import { AIcon } from '../../../';
106
110
  import { cloneDeep } from 'lodash-es';
@@ -151,9 +155,13 @@ const __sfc_main__ = _defineComponent({
151
155
  type: [String, Object],
152
156
  default: undefined,
153
157
  },
158
+ defaultValues: {
159
+ type: Object,
160
+ default: undefined,
161
+ }
154
162
  },
155
163
  emits: ["search"],
156
- setup(__props, { emit: __emit }) {
164
+ setup(__props, { expose: __expose, emit: __emit }) {
157
165
  const props = __props;
158
166
  const searchRef = ref(null);
159
167
  const searchRefContentRef = ref(null);
@@ -169,6 +177,7 @@ const __sfc_main__ = _defineComponent({
169
177
  // 当前组件宽度 true 大于1000
170
178
  const screenSize = ref(true);
171
179
  const resetNumber = ref(1);
180
+ let isFirstHandleDefaultValues = false;
172
181
  const searchItems = ref([]); // 当前查询条件
173
182
  const termsData = reactive({
174
183
  terms: [
@@ -232,18 +241,6 @@ const __sfc_main__ = _defineComponent({
232
241
  resetNumber.value += 1;
233
242
  emit('search', { terms: [] });
234
243
  };
235
- watch(width, (value) => {
236
- if (value < 1000) {
237
- layout.value = 'vertical';
238
- screenSize.value = false;
239
- compatible.value = value < 760;
240
- }
241
- else {
242
- layout.value = 'horizontal';
243
- screenSize.value = true;
244
- compatible.value = false;
245
- }
246
- }, { immediate: true });
247
244
  const historyItemClick = (content) => {
248
245
  try {
249
246
  termsData.terms = _optionalChain([handleQData, 'call', _2 => _2(compatibleOldTerms(content)), 'optionalAccess', _3 => _3.terms]) || [];
@@ -267,6 +264,20 @@ const __sfc_main__ = _defineComponent({
267
264
  emit('search', termsParamsFormat(termsData, columnOptionMap.value));
268
265
  }
269
266
  };
267
+ /**
268
+ * 处理传入的默认值
269
+ */
270
+ const handleDefaultValues = () => {
271
+ const defaultValues = props.defaultValues.terms.map((a) => {
272
+ a.terms.map((b) => {
273
+ return termsToValue(b, searchItems.value);
274
+ });
275
+ return a;
276
+ });
277
+ termsData.terms = _optionalChain([handleQData, 'call', _6 => _6(compatibleOldTerms(JSON.stringify({ terms: defaultValues }))), 'optionalAccess', _7 => _7.terms]) || [];
278
+ expand.value = hasExpand(termsData.terms);
279
+ emit('search', termsParamsFormat(termsData, columnOptionMap.value));
280
+ };
270
281
  /**
271
282
  * 处理每项的key为Item组件所需要的key
272
283
  */
@@ -309,7 +320,13 @@ const __sfc_main__ = _defineComponent({
309
320
  }
310
321
  });
311
322
  submitData();
312
- handleUrlParams({ q: q.value, target: target.value });
323
+ if (props.defaultValues && !isFirstHandleDefaultValues) {
324
+ handleDefaultValues();
325
+ isFirstHandleDefaultValues = true;
326
+ }
327
+ else {
328
+ handleUrlParams({ q: q.value, target: target.value });
329
+ }
313
330
  };
314
331
  watch(() => props.columns, () => {
315
332
  termsData.terms = [
@@ -325,7 +342,22 @@ const __sfc_main__ = _defineComponent({
325
342
  }, {
326
343
  deep: true,
327
344
  });
345
+ watch(width, (value) => {
346
+ if (value < 1000) {
347
+ layout.value = 'vertical';
348
+ screenSize.value = false;
349
+ compatible.value = value < 760;
350
+ }
351
+ else {
352
+ layout.value = 'horizontal';
353
+ screenSize.value = true;
354
+ compatible.value = false;
355
+ }
356
+ }, { immediate: true });
328
357
  handleItems();
358
+ __expose({
359
+ setValues: handleDefaultValues,
360
+ });
329
361
  return (_ctx, _cache) => {
330
362
  return (_openBlock(), _createBlock(_unref(Form), {
331
363
  model: termsData,
package/es/Search/Item.js CHANGED
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1734058149050"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506445"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -155,6 +155,7 @@ const __sfc_main__ = _defineComponent({
155
155
  * @param column {}
156
156
  * @param options {}
157
157
  * @param defaultTermType {}
158
+ * @param termFilter {}
158
159
  */
159
160
  const getTermType = (type, column, options, defaultTermType, termFilter) => {
160
161
  termTypeOptions.option = _optionalChain([options, 'optionalAccess', _10 => _10.length])
@@ -43,7 +43,7 @@
43
43
  } */
44
44
  import { defineComponent as _defineComponent } from 'vue';
45
45
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
46
- const _withScopeId = n => (_pushScopeId("data-v-1734058149145"), n = n(), _popScopeId(), n);
46
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506529"), n = n(), _popScopeId(), n);
47
47
  const _hoisted_1 = { class: "JSearch-content simple" };
48
48
  const _hoisted_2 = { class: "JSearch-items" };
49
49
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
package/es/Search/util.js CHANGED
@@ -153,6 +153,7 @@ export var compatibleOldTerms = function compatibleOldTerms(q) {
153
153
  terms: _terms
154
154
  };
155
155
  } catch (e) {
156
+ console.warn('[Pro Search Error] > ', e);
156
157
  return {
157
158
  terms: _terms
158
159
  };
@@ -231,4 +232,25 @@ export var getTermOptions = function getTermOptions(type, column) {
231
232
  break;
232
233
  }
233
234
  return keys.length ? getTermTypes(keys) : termType;
235
+ };
236
+ export var termsToValue = function termsToValue(targetItem, searchItems) {
237
+ if (['like', 'nlike'].includes(targetItem.termType) && !!targetItem.value) {
238
+ if (targetItem.value.startsWith('%') && targetItem.value.endsWith('%')) {
239
+ targetItem.value = targetItem.value.slice(1, -1);
240
+ }
241
+ }
242
+ // 处理重命名
243
+ var searchItem = searchItems.filter(function (item) {
244
+ return item.rename;
245
+ }).find(function (item) {
246
+ if (item.rename === targetItem.column) {
247
+ targetItem.column = item.column;
248
+ return true;
249
+ }
250
+ return item.column === targetItem.column;
251
+ });
252
+ if (!targetItem.termType) {
253
+ targetItem.termType = getTermTypeFn(searchItem.type);
254
+ }
255
+ return targetItem;
234
256
  };
@@ -48,7 +48,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
48
48
  "onFieldChange": "setup-const"
49
49
  } */
50
50
  import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
51
- const _withScopeId = n => (_pushScopeId("data-v-1734058145684"), n = n(), _popScopeId(), n);
51
+ const _withScopeId = n => (_pushScopeId("data-v-1735098504693"), n = n(), _popScopeId(), n);
52
52
  const _hoisted_1 = { style: { "color": "#1d2129" } };
53
53
  const _hoisted_2 = {
54
54
  key: 0,
@@ -9,7 +9,7 @@
9
9
  } */
10
10
  import { defineComponent as _defineComponent } from 'vue';
11
11
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
- const _withScopeId = n => (_pushScopeId("data-v-1734058146976"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1735098505192"), n = n(), _popScopeId(), n);
13
13
  const _hoisted_1 = { class: "full-page-warp-content" };
14
14
  import { ref, inject } from 'vue';
15
15
  import { useElementBounding } from '@vueuse/core';
@@ -149,14 +149,6 @@ const __sfc_main__ = _defineComponent({
149
149
  }
150
150
  };
151
151
  const _debounceFn = debounce(handleSearch, 300);
152
- watch(() => props.params, (newValue) => {
153
- _debounceFn(newValue || {});
154
- }, { deep: true, immediate: true });
155
- watch(() => props.dataSource, (newVal) => {
156
- if (newVal && !props.request) {
157
- handleSearch(props.params);
158
- }
159
- }, { deep: true, immediate: true });
160
152
  const onPageChange = (_page, size) => {
161
153
  handleSearch({
162
154
  ...props.params,
@@ -218,6 +210,14 @@ const __sfc_main__ = _defineComponent({
218
210
  }
219
211
  }
220
212
  };
213
+ watch(() => props.params, (newValue) => {
214
+ _debounceFn(newValue || {});
215
+ }, { deep: true, immediate: true });
216
+ watch(() => props.dataSource, (newVal) => {
217
+ if (newVal && !props.request) {
218
+ handleSearch(props.params);
219
+ }
220
+ }, { deep: true, immediate: true });
221
221
  onMounted(() => {
222
222
  windowChange(); // 初始化
223
223
  window.onresize = () => {
@@ -10,6 +10,7 @@ var _Table = require("ant-design-vue/es/table/Table");
10
10
  require("vue");
11
11
  require("ant-design-vue/es/table");
12
12
  var _Pagination = require("ant-design-vue/es/pagination/Pagination");
13
+ var _lodashEs = require("lodash");
13
14
  var _headerProps = exports._headerProps = {
14
15
  mode: {
15
16
  type: [String, undefined],
@@ -64,7 +65,7 @@ var _contentProps = exports._contentProps = (0, _objectSpread2.default)((0, _obj
64
65
  default: 'id'
65
66
  }
66
67
  });
67
- var _paginationProps = exports._paginationProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _Pagination.paginationProps)()), {}, {
68
+ var _paginationProps = exports._paginationProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodashEs.omit)((0, _Pagination.paginationProps)(), ['onChange'])), {}, {
68
69
  total: {
69
70
  type: Number,
70
71
  default: 0
@@ -10,7 +10,7 @@
10
10
  "onClick": "setup-const"
11
11
  } */
12
12
  import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
13
- const _withScopeId = n => (_pushScopeId("data-v-1734058148922"), n = n(), _popScopeId(), n);
13
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506110"), n = n(), _popScopeId(), n);
14
14
  const _hoisted_1 = ["onClick"];
15
15
  const __sfc_main__ = Object.assign({
16
16
  name: 'JRadioButton',
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
23
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
- const _withScopeId = n => (_pushScopeId("data-v-1734058149772"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506926"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
@@ -25,6 +25,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
25
25
  "deleteKey": "props",
26
26
  "routerMode": "props",
27
27
  "style": "props",
28
+ "defaultValues": "props",
28
29
  "SearchItem": "setup-const",
29
30
  "optionsMapKey": "setup-maybe-ref",
30
31
  "typeOptions": "setup-maybe-ref",
@@ -42,6 +43,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
42
43
  "handleQData": "setup-maybe-ref",
43
44
  "hasExpand": "setup-maybe-ref",
44
45
  "termsParamsFormat": "setup-maybe-ref",
46
+ "termsToValue": "setup-maybe-ref",
45
47
  "Select": "setup-maybe-ref",
46
48
  "Button": "setup-maybe-ref",
47
49
  "Form": "setup-maybe-ref",
@@ -59,6 +61,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
59
61
  "compatible": "setup-ref",
60
62
  "screenSize": "setup-ref",
61
63
  "resetNumber": "setup-ref",
64
+ "isFirstHandleDefaultValues": "setup-let",
62
65
  "searchItems": "setup-ref",
63
66
  "termsData": "setup-reactive-const",
64
67
  "columnOptionMap": "setup-ref",
@@ -71,6 +74,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
71
74
  "reset": "setup-const",
72
75
  "historyItemClick": "setup-const",
73
76
  "handleUrlParams": "setup-const",
77
+ "handleDefaultValues": "setup-const",
74
78
  "handleItems": "setup-const"
75
79
  } */
76
80
  import { defineComponent as _defineComponent } from 'vue';
@@ -100,7 +104,7 @@ import { useRouteQuery } from '@vueuse/router';
100
104
  import { ref, reactive, watch, provide } from 'vue';
101
105
  import SaveHistory from './SaveHistory.js';
102
106
  import History from './History.js';
103
- import { compatibleOldTerms, getTermTypeFn, handleQData, hasExpand, termsParamsFormat, } from '../util';
107
+ import { compatibleOldTerms, getTermTypeFn, handleQData, hasExpand, termsParamsFormat, termsToValue, } from '../util';
104
108
  import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
105
109
  import { AIcon } from '../../../';
106
110
  import { cloneDeep } from 'lodash-es';
@@ -151,9 +155,13 @@ const __sfc_main__ = _defineComponent({
151
155
  type: [String, Object],
152
156
  default: undefined,
153
157
  },
158
+ defaultValues: {
159
+ type: Object,
160
+ default: undefined,
161
+ }
154
162
  },
155
163
  emits: ["search"],
156
- setup(__props, { emit: __emit }) {
164
+ setup(__props, { expose: __expose, emit: __emit }) {
157
165
  const props = __props;
158
166
  const searchRef = ref(null);
159
167
  const searchRefContentRef = ref(null);
@@ -169,6 +177,7 @@ const __sfc_main__ = _defineComponent({
169
177
  // 当前组件宽度 true 大于1000
170
178
  const screenSize = ref(true);
171
179
  const resetNumber = ref(1);
180
+ let isFirstHandleDefaultValues = false;
172
181
  const searchItems = ref([]); // 当前查询条件
173
182
  const termsData = reactive({
174
183
  terms: [
@@ -232,18 +241,6 @@ const __sfc_main__ = _defineComponent({
232
241
  resetNumber.value += 1;
233
242
  emit('search', { terms: [] });
234
243
  };
235
- watch(width, (value) => {
236
- if (value < 1000) {
237
- layout.value = 'vertical';
238
- screenSize.value = false;
239
- compatible.value = value < 760;
240
- }
241
- else {
242
- layout.value = 'horizontal';
243
- screenSize.value = true;
244
- compatible.value = false;
245
- }
246
- }, { immediate: true });
247
244
  const historyItemClick = (content) => {
248
245
  try {
249
246
  termsData.terms = _optionalChain([handleQData, 'call', _2 => _2(compatibleOldTerms(content)), 'optionalAccess', _3 => _3.terms]) || [];
@@ -267,6 +264,20 @@ const __sfc_main__ = _defineComponent({
267
264
  emit('search', termsParamsFormat(termsData, columnOptionMap.value));
268
265
  }
269
266
  };
267
+ /**
268
+ * 处理传入的默认值
269
+ */
270
+ const handleDefaultValues = () => {
271
+ const defaultValues = props.defaultValues.terms.map((a) => {
272
+ a.terms.map((b) => {
273
+ return termsToValue(b, searchItems.value);
274
+ });
275
+ return a;
276
+ });
277
+ termsData.terms = _optionalChain([handleQData, 'call', _6 => _6(compatibleOldTerms(JSON.stringify({ terms: defaultValues }))), 'optionalAccess', _7 => _7.terms]) || [];
278
+ expand.value = hasExpand(termsData.terms);
279
+ emit('search', termsParamsFormat(termsData, columnOptionMap.value));
280
+ };
270
281
  /**
271
282
  * 处理每项的key为Item组件所需要的key
272
283
  */
@@ -309,7 +320,13 @@ const __sfc_main__ = _defineComponent({
309
320
  }
310
321
  });
311
322
  submitData();
312
- handleUrlParams({ q: q.value, target: target.value });
323
+ if (props.defaultValues && !isFirstHandleDefaultValues) {
324
+ handleDefaultValues();
325
+ isFirstHandleDefaultValues = true;
326
+ }
327
+ else {
328
+ handleUrlParams({ q: q.value, target: target.value });
329
+ }
313
330
  };
314
331
  watch(() => props.columns, () => {
315
332
  termsData.terms = [
@@ -325,7 +342,22 @@ const __sfc_main__ = _defineComponent({
325
342
  }, {
326
343
  deep: true,
327
344
  });
345
+ watch(width, (value) => {
346
+ if (value < 1000) {
347
+ layout.value = 'vertical';
348
+ screenSize.value = false;
349
+ compatible.value = value < 760;
350
+ }
351
+ else {
352
+ layout.value = 'horizontal';
353
+ screenSize.value = true;
354
+ compatible.value = false;
355
+ }
356
+ }, { immediate: true });
328
357
  handleItems();
358
+ __expose({
359
+ setValues: handleDefaultValues,
360
+ });
329
361
  return (_ctx, _cache) => {
330
362
  return (_openBlock(), _createBlock(_unref(Form), {
331
363
  model: termsData,
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1734058148966"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506396"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -155,6 +155,7 @@ const __sfc_main__ = _defineComponent({
155
155
  * @param column {}
156
156
  * @param options {}
157
157
  * @param defaultTermType {}
158
+ * @param termFilter {}
158
159
  */
159
160
  const getTermType = (type, column, options, defaultTermType, termFilter) => {
160
161
  termTypeOptions.option = _optionalChain([options, 'optionalAccess', _10 => _10.length])
@@ -43,7 +43,7 @@
43
43
  } */
44
44
  import { defineComponent as _defineComponent } from 'vue';
45
45
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
46
- const _withScopeId = n => (_pushScopeId("data-v-1734058149125"), n = n(), _popScopeId(), n);
46
+ const _withScopeId = n => (_pushScopeId("data-v-1735098506509"), n = n(), _popScopeId(), n);
47
47
  const _hoisted_1 = { class: "JSearch-content simple" };
48
48
  const _hoisted_2 = { class: "JSearch-items" };
49
49
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.termsParamsFormat = exports.hasExpand = exports.handleQData = exports.handleParamsToString = exports.handleLikeValue = exports.getTermTypes = exports.getTermTypeFn = exports.getTermOptions = exports.filterTreeSelectNode = exports.filterSelectNode = exports.compatibleOldTerms = void 0;
7
+ exports.termsToValue = exports.termsParamsFormat = exports.hasExpand = exports.handleQData = exports.handleParamsToString = exports.handleLikeValue = exports.getTermTypes = exports.getTermTypeFn = exports.getTermOptions = exports.filterTreeSelectNode = exports.filterSelectNode = exports.compatibleOldTerms = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _lodashEs = require("lodash");
@@ -160,6 +160,7 @@ var compatibleOldTerms = exports.compatibleOldTerms = function compatibleOldTerm
160
160
  terms: _terms
161
161
  };
162
162
  } catch (e) {
163
+ console.warn('[Pro Search Error] > ', e);
163
164
  return {
164
165
  terms: _terms
165
166
  };
@@ -238,4 +239,25 @@ var getTermOptions = exports.getTermOptions = function getTermOptions(type, colu
238
239
  break;
239
240
  }
240
241
  return keys.length ? getTermTypes(keys) : _setting.termType;
242
+ };
243
+ var termsToValue = exports.termsToValue = function termsToValue(targetItem, searchItems) {
244
+ if (['like', 'nlike'].includes(targetItem.termType) && !!targetItem.value) {
245
+ if (targetItem.value.startsWith('%') && targetItem.value.endsWith('%')) {
246
+ targetItem.value = targetItem.value.slice(1, -1);
247
+ }
248
+ }
249
+ // 处理重命名
250
+ var searchItem = searchItems.filter(function (item) {
251
+ return item.rename;
252
+ }).find(function (item) {
253
+ if (item.rename === targetItem.column) {
254
+ targetItem.column = item.column;
255
+ return true;
256
+ }
257
+ return item.column === targetItem.column;
258
+ });
259
+ if (!targetItem.termType) {
260
+ targetItem.termType = getTermTypeFn(searchItem.type);
261
+ }
262
+ return targetItem;
241
263
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.4.11",
3
+ "version": "2.4.13",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -19,7 +19,7 @@
19
19
  "@ant-design/icons-vue": "^7.0.1",
20
20
  "@vuemap/vue-amap": "^2.0.17",
21
21
  "@vueuse/core": "^10.2.1",
22
- "@vueuse/router": "^10.9.0",
22
+ "@vueuse/router": "^12.1.0",
23
23
  "async-validator": "^4.2.5",
24
24
  "echarts": "^5.4.3",
25
25
  "markdown-it": "^14.1.0",
@@ -152,8 +152,8 @@
152
152
  "webpack-dev-server": "^4.0.0",
153
153
  "webpack-merge": "^5.0.0",
154
154
  "webpackbar": "^5.0.2",
155
- "@jetlinks-web/constants": "^1.0.7",
156
155
  "@jetlinks-web/hooks": "^1.0.20",
156
+ "@jetlinks-web/constants": "^1.0.7",
157
157
  "@jetlinks-web/utils": "^1.2.5"
158
158
  },
159
159
  "publishConfig": {