@jetlinks-web/components 3.3.3 → 3.3.4

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.
@@ -20,12 +20,10 @@
20
20
  "useAttrs": "setup-const",
21
21
  "inject": "setup-const",
22
22
  "computed": "setup-const",
23
- "toRefs": "setup-const",
24
23
  "SaveHistory": "setup-const",
25
24
  "History": "setup-const",
26
25
  "compatibleOldTerms": "setup-maybe-ref",
27
26
  "getItemDefaultValue": "setup-maybe-ref",
28
- "hasExpand": "setup-maybe-ref",
29
27
  "termsParamsFormat": "setup-maybe-ref",
30
28
  "Select": "setup-maybe-ref",
31
29
  "Button": "setup-maybe-ref",
@@ -34,6 +32,7 @@
34
32
  "AIcon": "setup-maybe-ref",
35
33
  "useLocaleReceiver": "setup-maybe-ref",
36
34
  "SearchConfig": "setup-maybe-ref",
35
+ "cloneDeep": "setup-maybe-ref",
37
36
  "isObject": "setup-maybe-ref",
38
37
  "useSearchStyle": "setup-maybe-ref",
39
38
  "props": "setup-reactive-const",
@@ -44,6 +43,7 @@
44
43
  "layout": "setup-ref",
45
44
  "compatible": "setup-ref",
46
45
  "screenSize": "setup-ref",
46
+ "expandedTermsCache": "setup-ref",
47
47
  "context": "setup-maybe-ref",
48
48
  "prefixCls": "setup-ref",
49
49
  "wrapSSR": "setup-maybe-ref",
@@ -54,6 +54,7 @@
54
54
  "initValues": "setup-maybe-ref",
55
55
  "columnsMap": "setup-maybe-ref",
56
56
  "defaultCacheValues": "setup-maybe-ref",
57
+ "getExpandedTerms": "setup-const",
57
58
  "expandChange": "setup-const",
58
59
  "addUrlParams": "setup-const",
59
60
  "submitData": "setup-const",
@@ -90,12 +91,12 @@ import { useHandleColumns, useOptionMapContent, useRouteQuery } from '../hooks';
90
91
  import { ref, reactive, watch, useAttrs, inject, computed, } from 'vue';
91
92
  import SaveHistory from './SaveHistory.js';
92
93
  import History from './History.js';
93
- import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat, } from '../util';
94
+ import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat } from '../util';
94
95
  import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
95
96
  import { AIcon } from '../../components';
96
97
  import { useLocaleReceiver } from '../../LocaleReciver';
97
98
  import { SearchConfig } from '../../utils/constants';
98
- import { isObject } from 'lodash-es';
99
+ import { cloneDeep, isObject } from 'lodash-es';
99
100
  import useSearchStyle from '../style';
100
101
  const __sfc_main__ = _defineComponent({
101
102
  ...{
@@ -152,6 +153,7 @@ const __sfc_main__ = _defineComponent({
152
153
  const layout = ref('horizontal');
153
154
  const compatible = ref(false);
154
155
  const screenSize = ref(true);
156
+ const expandedTermsCache = ref([]);
155
157
  const context = inject(SearchConfig);
156
158
  const prefixCls = computed(() => 'JSearch');
157
159
  const [wrapSSR, hashId] = useSearchStyle(prefixCls);
@@ -161,23 +163,35 @@ const __sfc_main__ = _defineComponent({
161
163
  const target = useRouteQuery('target');
162
164
  const { initValues, columnsMap, defaultCacheValues } = useHandleColumns(props, terms, { mode: 'advanced' });
163
165
  useOptionMapContent(columnsOptionMap);
166
+ const getExpandedTerms = () => {
167
+ if (expandedTermsCache.value.length) {
168
+ const cacheTerms = cloneDeep(expandedTermsCache.value);
169
+ if (terms.terms[0]) {
170
+ cacheTerms[0] = cloneDeep(terms.terms[0]);
171
+ }
172
+ return cacheTerms;
173
+ }
174
+ const arr = Object.values(columnsMap.value);
175
+ const mergeArr = [];
176
+ for (let i = 1; i < 6; i++) {
177
+ const indexIn = i % arr.length;
178
+ const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues.value);
179
+ if (i === 3) {
180
+ obj.type = 'and';
181
+ }
182
+ mergeArr.push(obj);
183
+ }
184
+ return [...terms.terms, ...mergeArr];
185
+ };
164
186
  const expandChange = () => {
165
- expand.value = !expand.value;
166
- terms.terms.length = 1;
167
187
  if (expand.value) {
168
- // 展开
169
- let arr = Object.values(columnsMap.value);
170
- const mergeArr = [];
171
- for (let i = 1; i < 6; i++) {
172
- const indexIn = i % arr.length;
173
- const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues.value);
174
- if (i === 3) {
175
- obj.type = 'and';
176
- }
177
- mergeArr.push(obj);
178
- }
179
- terms.terms = [...terms.terms, ...mergeArr];
188
+ expandedTermsCache.value = cloneDeep(terms.terms);
189
+ terms.terms = terms.terms.slice(0, 1);
190
+ }
191
+ else {
192
+ terms.terms = getExpandedTerms();
180
193
  }
194
+ expand.value = !expand.value;
181
195
  };
182
196
  const addUrlParams = () => {
183
197
  if (props.target) {
@@ -203,6 +217,7 @@ const __sfc_main__ = _defineComponent({
203
217
  */
204
218
  const reset = () => {
205
219
  expand.value = false;
220
+ expandedTermsCache.value = [];
206
221
  initValues();
207
222
  if (props.type === 'advanced') {
208
223
  q.value = undefined;
@@ -220,6 +235,9 @@ const __sfc_main__ = _defineComponent({
220
235
  const object = compatibleOldTerms(content, columnsMap.value, defaultCacheValues.value);
221
236
  terms.terms = object.terms || [];
222
237
  expand.value = object.expand;
238
+ expandedTermsCache.value = object.expand
239
+ ? cloneDeep((object.terms || []))
240
+ : [];
223
241
  searchSubmit();
224
242
  }
225
243
  catch (e) {
@@ -20,12 +20,10 @@
20
20
  "useAttrs": "setup-const",
21
21
  "inject": "setup-const",
22
22
  "computed": "setup-const",
23
- "toRefs": "setup-const",
24
23
  "SaveHistory": "setup-const",
25
24
  "History": "setup-const",
26
25
  "compatibleOldTerms": "setup-maybe-ref",
27
26
  "getItemDefaultValue": "setup-maybe-ref",
28
- "hasExpand": "setup-maybe-ref",
29
27
  "termsParamsFormat": "setup-maybe-ref",
30
28
  "Select": "setup-maybe-ref",
31
29
  "Button": "setup-maybe-ref",
@@ -34,6 +32,7 @@
34
32
  "AIcon": "setup-maybe-ref",
35
33
  "useLocaleReceiver": "setup-maybe-ref",
36
34
  "SearchConfig": "setup-maybe-ref",
35
+ "cloneDeep": "setup-maybe-ref",
37
36
  "isObject": "setup-maybe-ref",
38
37
  "useSearchStyle": "setup-maybe-ref",
39
38
  "props": "setup-reactive-const",
@@ -44,6 +43,7 @@
44
43
  "layout": "setup-ref",
45
44
  "compatible": "setup-ref",
46
45
  "screenSize": "setup-ref",
46
+ "expandedTermsCache": "setup-ref",
47
47
  "context": "setup-maybe-ref",
48
48
  "prefixCls": "setup-ref",
49
49
  "wrapSSR": "setup-maybe-ref",
@@ -54,6 +54,7 @@
54
54
  "initValues": "setup-maybe-ref",
55
55
  "columnsMap": "setup-maybe-ref",
56
56
  "defaultCacheValues": "setup-maybe-ref",
57
+ "getExpandedTerms": "setup-const",
57
58
  "expandChange": "setup-const",
58
59
  "addUrlParams": "setup-const",
59
60
  "submitData": "setup-const",
@@ -90,12 +91,12 @@ import { useHandleColumns, useOptionMapContent, useRouteQuery } from '../hooks';
90
91
  import { ref, reactive, watch, useAttrs, inject, computed, } from 'vue';
91
92
  import SaveHistory from './SaveHistory.js';
92
93
  import History from './History.js';
93
- import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat, } from '../util';
94
+ import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat } from '../util';
94
95
  import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
95
96
  import { AIcon } from '../../components';
96
97
  import { useLocaleReceiver } from '../../LocaleReciver';
97
98
  import { SearchConfig } from '../../utils/constants';
98
- import { isObject } from 'lodash-es';
99
+ import { cloneDeep, isObject } from 'lodash-es';
99
100
  import useSearchStyle from '../style';
100
101
  const __sfc_main__ = _defineComponent({
101
102
  ...{
@@ -152,6 +153,7 @@ const __sfc_main__ = _defineComponent({
152
153
  const layout = ref('horizontal');
153
154
  const compatible = ref(false);
154
155
  const screenSize = ref(true);
156
+ const expandedTermsCache = ref([]);
155
157
  const context = inject(SearchConfig);
156
158
  const prefixCls = computed(() => 'JSearch');
157
159
  const [wrapSSR, hashId] = useSearchStyle(prefixCls);
@@ -161,23 +163,35 @@ const __sfc_main__ = _defineComponent({
161
163
  const target = useRouteQuery('target');
162
164
  const { initValues, columnsMap, defaultCacheValues } = useHandleColumns(props, terms, { mode: 'advanced' });
163
165
  useOptionMapContent(columnsOptionMap);
166
+ const getExpandedTerms = () => {
167
+ if (expandedTermsCache.value.length) {
168
+ const cacheTerms = cloneDeep(expandedTermsCache.value);
169
+ if (terms.terms[0]) {
170
+ cacheTerms[0] = cloneDeep(terms.terms[0]);
171
+ }
172
+ return cacheTerms;
173
+ }
174
+ const arr = Object.values(columnsMap.value);
175
+ const mergeArr = [];
176
+ for (let i = 1; i < 6; i++) {
177
+ const indexIn = i % arr.length;
178
+ const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues.value);
179
+ if (i === 3) {
180
+ obj.type = 'and';
181
+ }
182
+ mergeArr.push(obj);
183
+ }
184
+ return [...terms.terms, ...mergeArr];
185
+ };
164
186
  const expandChange = () => {
165
- expand.value = !expand.value;
166
- terms.terms.length = 1;
167
187
  if (expand.value) {
168
- // 展开
169
- let arr = Object.values(columnsMap.value);
170
- const mergeArr = [];
171
- for (let i = 1; i < 6; i++) {
172
- const indexIn = i % arr.length;
173
- const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues.value);
174
- if (i === 3) {
175
- obj.type = 'and';
176
- }
177
- mergeArr.push(obj);
178
- }
179
- terms.terms = [...terms.terms, ...mergeArr];
188
+ expandedTermsCache.value = cloneDeep(terms.terms);
189
+ terms.terms = terms.terms.slice(0, 1);
190
+ }
191
+ else {
192
+ terms.terms = getExpandedTerms();
180
193
  }
194
+ expand.value = !expand.value;
181
195
  };
182
196
  const addUrlParams = () => {
183
197
  if (props.target) {
@@ -203,6 +217,7 @@ const __sfc_main__ = _defineComponent({
203
217
  */
204
218
  const reset = () => {
205
219
  expand.value = false;
220
+ expandedTermsCache.value = [];
206
221
  initValues();
207
222
  if (props.type === 'advanced') {
208
223
  q.value = undefined;
@@ -220,6 +235,9 @@ const __sfc_main__ = _defineComponent({
220
235
  const object = compatibleOldTerms(content, columnsMap.value, defaultCacheValues.value);
221
236
  terms.terms = object.terms || [];
222
237
  expand.value = object.expand;
238
+ expandedTermsCache.value = object.expand
239
+ ? cloneDeep((object.terms || []))
240
+ : [];
223
241
  searchSubmit();
224
242
  }
225
243
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -154,9 +154,9 @@
154
154
  "webpack-dev-server": "^4.0.0",
155
155
  "webpack-merge": "^5.0.0",
156
156
  "webpackbar": "^5.0.2",
157
- "@jetlinks-web/constants": "^1.0.9",
157
+ "@jetlinks-web/utils": "^1.3.3",
158
158
  "@jetlinks-web/hooks": "^1.1.1",
159
- "@jetlinks-web/utils": "^1.3.3"
159
+ "@jetlinks-web/constants": "^1.0.9"
160
160
  },
161
161
  "publishConfig": {
162
162
  "registry": "https://registry.npmjs.org/",