@94ai/nf-search-form 100.1.15 → 100.1.19

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/lib/index.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  import { PluginObject } from 'vue-demi';
2
2
  declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{}, Readonly<import("vue-demi").ExtractPropTypes<{
3
+ columns: {
4
+ type: import("vue-demi").PropType<number>;
5
+ default: undefined;
6
+ };
7
+ top: {
8
+ type: import("vue-demi").PropType<string>;
9
+ default: string;
10
+ };
3
11
  storageKey: {
4
12
  type: import("vue-demi").PropType<string>;
5
13
  default: string;
@@ -20,10 +28,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
20
28
  type: import("vue-demi").PropType<boolean>;
21
29
  default: boolean;
22
30
  };
23
- top: {
24
- type: import("vue-demi").PropType<string>;
25
- default: string;
26
- };
27
31
  appendToBody: {
28
32
  type: import("vue-demi").PropType<boolean>;
29
33
  default: boolean;
@@ -64,10 +68,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
64
68
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
65
69
  default: string;
66
70
  };
67
- columns: {
68
- type: import("vue-demi").PropType<number>;
69
- default: undefined;
70
- };
71
71
  selectEmptyWarningTips: {
72
72
  type: import("vue-demi").PropType<string>;
73
73
  default: string;
@@ -405,6 +405,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
405
405
  default: string;
406
406
  };
407
407
  }>>, Readonly<import("vue-demi").ExtractPropTypes<{
408
+ columns: {
409
+ type: import("vue-demi").PropType<number>;
410
+ default: undefined;
411
+ };
412
+ top: {
413
+ type: import("vue-demi").PropType<string>;
414
+ default: string;
415
+ };
408
416
  storageKey: {
409
417
  type: import("vue-demi").PropType<string>;
410
418
  default: string;
@@ -425,10 +433,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
425
433
  type: import("vue-demi").PropType<boolean>;
426
434
  default: boolean;
427
435
  };
428
- top: {
429
- type: import("vue-demi").PropType<string>;
430
- default: string;
431
- };
432
436
  appendToBody: {
433
437
  type: import("vue-demi").PropType<boolean>;
434
438
  default: boolean;
@@ -469,10 +473,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
469
473
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
470
474
  default: string;
471
475
  };
472
- columns: {
473
- type: import("vue-demi").PropType<number>;
474
- default: undefined;
475
- };
476
476
  selectEmptyWarningTips: {
477
477
  type: import("vue-demi").PropType<string>;
478
478
  default: string;
@@ -818,12 +818,13 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
818
818
  isCollapseChange: (event: boolean) => void;
819
819
  "update:showItems": (event: string[] | undefined) => void;
820
820
  }, {
821
+ columns: number;
822
+ top: string;
821
823
  storageKey: string;
822
824
  columnEdit: boolean;
823
825
  modalAppendToBody: boolean;
824
826
  modal: boolean;
825
827
  fullscreen: boolean;
826
- top: string;
827
828
  appendToBody: boolean;
828
829
  lockScroll: boolean;
829
830
  customClass: string;
@@ -834,7 +835,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
834
835
  center: boolean;
835
836
  destroyOnClose: boolean;
836
837
  size: "medium" | "small" | "mini";
837
- columns: number;
838
838
  selectEmptyWarningTips: string;
839
839
  disabled: boolean;
840
840
  itemWidth: number;
@@ -914,6 +914,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
914
914
  resetBtnText: string;
915
915
  resetBtnClass: string;
916
916
  }, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{
917
+ columns: {
918
+ type: import("vue-demi").PropType<number>;
919
+ default: undefined;
920
+ };
921
+ top: {
922
+ type: import("vue-demi").PropType<string>;
923
+ default: string;
924
+ };
917
925
  storageKey: {
918
926
  type: import("vue-demi").PropType<string>;
919
927
  default: string;
@@ -934,10 +942,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
934
942
  type: import("vue-demi").PropType<boolean>;
935
943
  default: boolean;
936
944
  };
937
- top: {
938
- type: import("vue-demi").PropType<string>;
939
- default: string;
940
- };
941
945
  appendToBody: {
942
946
  type: import("vue-demi").PropType<boolean>;
943
947
  default: boolean;
@@ -978,10 +982,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
978
982
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
979
983
  default: string;
980
984
  };
981
- columns: {
982
- type: import("vue-demi").PropType<number>;
983
- default: undefined;
984
- };
985
985
  selectEmptyWarningTips: {
986
986
  type: import("vue-demi").PropType<string>;
987
987
  default: string;
@@ -1320,11 +1320,11 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1320
1320
  };
1321
1321
  }>>> & import("vue-demi").ShallowUnwrapRef<{
1322
1322
  localShowItems: import("vue-demi").Ref<string[]>;
1323
- syncLocalShowColumnToCookies: () => Promise<void>;
1323
+ syncLocalShowColumnToCookies: () => void;
1324
1324
  syncCookiesToLocalShowColumn: () => Promise<void>;
1325
1325
  syncShowItemToInitHidden: () => void;
1326
1326
  hiddenNfSearchFormItemOptionField: (prop: any) => Promise<void>;
1327
- refreshNfSearchFormModel: (outEmit?: boolean, init?: boolean) => Promise<void>;
1327
+ refreshNfSearchFormModel: (outEmit?: boolean, init?: boolean) => void;
1328
1328
  renderSearchFormItemOptions: import("vue-demi").Ref<{
1329
1329
  key?: string | undefined;
1330
1330
  _index?: number | undefined;
@@ -1388,6 +1388,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1388
1388
  onResize: (params?: Record<string, any>) => Promise<void>;
1389
1389
  visibleChange: () => void;
1390
1390
  }> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
1391
+ columns: {
1392
+ type: import("vue-demi").PropType<number>;
1393
+ default: undefined;
1394
+ };
1395
+ top: {
1396
+ type: import("vue-demi").PropType<string>;
1397
+ default: string;
1398
+ };
1391
1399
  storageKey: {
1392
1400
  type: import("vue-demi").PropType<string>;
1393
1401
  default: string;
@@ -1408,10 +1416,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1408
1416
  type: import("vue-demi").PropType<boolean>;
1409
1417
  default: boolean;
1410
1418
  };
1411
- top: {
1412
- type: import("vue-demi").PropType<string>;
1413
- default: string;
1414
- };
1415
1419
  appendToBody: {
1416
1420
  type: import("vue-demi").PropType<boolean>;
1417
1421
  default: boolean;
@@ -1452,10 +1456,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1452
1456
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
1453
1457
  default: string;
1454
1458
  };
1455
- columns: {
1456
- type: import("vue-demi").PropType<number>;
1457
- default: undefined;
1458
- };
1459
1459
  selectEmptyWarningTips: {
1460
1460
  type: import("vue-demi").PropType<string>;
1461
1461
  default: string;
@@ -1793,6 +1793,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1793
1793
  default: string;
1794
1794
  };
1795
1795
  }>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{
1796
+ columns: {
1797
+ type: import("vue-demi").PropType<number>;
1798
+ default: undefined;
1799
+ };
1800
+ top: {
1801
+ type: import("vue-demi").PropType<string>;
1802
+ default: string;
1803
+ };
1796
1804
  storageKey: {
1797
1805
  type: import("vue-demi").PropType<string>;
1798
1806
  default: string;
@@ -1813,10 +1821,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1813
1821
  type: import("vue-demi").PropType<boolean>;
1814
1822
  default: boolean;
1815
1823
  };
1816
- top: {
1817
- type: import("vue-demi").PropType<string>;
1818
- default: string;
1819
- };
1820
1824
  appendToBody: {
1821
1825
  type: import("vue-demi").PropType<boolean>;
1822
1826
  default: boolean;
@@ -1857,10 +1861,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1857
1861
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
1858
1862
  default: string;
1859
1863
  };
1860
- columns: {
1861
- type: import("vue-demi").PropType<number>;
1862
- default: undefined;
1863
- };
1864
1864
  selectEmptyWarningTips: {
1865
1865
  type: import("vue-demi").PropType<string>;
1866
1866
  default: string;
@@ -2199,11 +2199,11 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2199
2199
  };
2200
2200
  }>>, {
2201
2201
  localShowItems: import("vue-demi").Ref<string[]>;
2202
- syncLocalShowColumnToCookies: () => Promise<void>;
2202
+ syncLocalShowColumnToCookies: () => void;
2203
2203
  syncCookiesToLocalShowColumn: () => Promise<void>;
2204
2204
  syncShowItemToInitHidden: () => void;
2205
2205
  hiddenNfSearchFormItemOptionField: (prop: any) => Promise<void>;
2206
- refreshNfSearchFormModel: (outEmit?: boolean, init?: boolean) => Promise<void>;
2206
+ refreshNfSearchFormModel: (outEmit?: boolean, init?: boolean) => void;
2207
2207
  renderSearchFormItemOptions: import("vue-demi").Ref<{
2208
2208
  key?: string | undefined;
2209
2209
  _index?: number | undefined;
@@ -2275,12 +2275,13 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2275
2275
  isCollapseChange: (event: boolean) => void;
2276
2276
  "update:showItems": (event: string[] | undefined) => void;
2277
2277
  }, string, {
2278
+ columns: number;
2279
+ top: string;
2278
2280
  storageKey: string;
2279
2281
  columnEdit: boolean;
2280
2282
  modalAppendToBody: boolean;
2281
2283
  modal: boolean;
2282
2284
  fullscreen: boolean;
2283
- top: string;
2284
2285
  appendToBody: boolean;
2285
2286
  lockScroll: boolean;
2286
2287
  customClass: string;
@@ -2291,7 +2292,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2291
2292
  center: boolean;
2292
2293
  destroyOnClose: boolean;
2293
2294
  size: "medium" | "small" | "mini";
2294
- columns: number;
2295
2295
  selectEmptyWarningTips: string;
2296
2296
  disabled: boolean;
2297
2297
  itemWidth: number;
@@ -2372,6 +2372,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2372
2372
  resetBtnClass: string;
2373
2373
  }> & {
2374
2374
  props: {
2375
+ columns: {
2376
+ type: import("vue-demi").PropType<number>;
2377
+ default: undefined;
2378
+ };
2379
+ top: {
2380
+ type: import("vue-demi").PropType<string>;
2381
+ default: string;
2382
+ };
2375
2383
  storageKey: {
2376
2384
  type: import("vue-demi").PropType<string>;
2377
2385
  default: string;
@@ -2392,10 +2400,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2392
2400
  type: import("vue-demi").PropType<boolean>;
2393
2401
  default: boolean;
2394
2402
  };
2395
- top: {
2396
- type: import("vue-demi").PropType<string>;
2397
- default: string;
2398
- };
2399
2403
  appendToBody: {
2400
2404
  type: import("vue-demi").PropType<boolean>;
2401
2405
  default: boolean;
@@ -2436,10 +2440,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2436
2440
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
2437
2441
  default: string;
2438
2442
  };
2439
- columns: {
2440
- type: import("vue-demi").PropType<number>;
2441
- default: undefined;
2442
- };
2443
2443
  selectEmptyWarningTips: {
2444
2444
  type: import("vue-demi").PropType<string>;
2445
2445
  default: string;
@@ -1,5 +1,13 @@
1
- import { NfSearchFormItemOption } from '../..nf-search-form/lib/types';
1
+ import { NfSearchFormItemOption } from './types';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<{
3
+ top: {
4
+ type: import("vue-demi").PropType<string>;
5
+ default: string;
6
+ };
7
+ width: {
8
+ type: import("vue-demi").PropType<string>;
9
+ default: string;
10
+ };
3
11
  storageKey: {
4
12
  type: import("vue-demi").PropType<string>;
5
13
  default: string;
@@ -16,10 +24,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
16
24
  type: import("vue-demi").PropType<string>;
17
25
  default: string;
18
26
  };
19
- width: {
20
- type: import("vue-demi").PropType<string>;
21
- default: string;
22
- };
23
27
  confirmText: {
24
28
  type: import("vue-demi").PropType<string>;
25
29
  default: string;
@@ -44,10 +48,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
44
48
  type: import("vue-demi").PropType<boolean>;
45
49
  default: boolean;
46
50
  };
47
- top: {
48
- type: import("vue-demi").PropType<string>;
49
- default: string;
50
- };
51
51
  appendToBody: {
52
52
  type: import("vue-demi").PropType<boolean>;
53
53
  default: boolean;
@@ -88,6 +88,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
88
88
  "update:show": (event: boolean) => void;
89
89
  save: (event: Record<string, any>) => void;
90
90
  }, string, Readonly<import("vue-demi").ExtractPropTypes<{
91
+ top: {
92
+ type: import("vue-demi").PropType<string>;
93
+ default: string;
94
+ };
95
+ width: {
96
+ type: import("vue-demi").PropType<string>;
97
+ default: string;
98
+ };
91
99
  storageKey: {
92
100
  type: import("vue-demi").PropType<string>;
93
101
  default: string;
@@ -104,10 +112,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
104
112
  type: import("vue-demi").PropType<string>;
105
113
  default: string;
106
114
  };
107
- width: {
108
- type: import("vue-demi").PropType<string>;
109
- default: string;
110
- };
111
115
  confirmText: {
112
116
  type: import("vue-demi").PropType<string>;
113
117
  default: string;
@@ -132,10 +136,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
132
136
  type: import("vue-demi").PropType<boolean>;
133
137
  default: boolean;
134
138
  };
135
- top: {
136
- type: import("vue-demi").PropType<string>;
137
- default: string;
138
- };
139
139
  appendToBody: {
140
140
  type: import("vue-demi").PropType<boolean>;
141
141
  default: boolean;
@@ -173,18 +173,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
173
173
  default: boolean;
174
174
  };
175
175
  }>>, {
176
+ top: string;
177
+ width: string;
176
178
  storageKey: string;
177
179
  columnEdit: boolean;
178
180
  show: boolean;
179
181
  title: string;
180
- width: string;
181
182
  confirmText: string;
182
183
  cancelText: string;
183
184
  tableColumns: NfSearchFormItemOption[];
184
185
  modalAppendToBody: boolean;
185
186
  modal: boolean;
186
187
  fullscreen: boolean;
187
- top: string;
188
188
  appendToBody: boolean;
189
189
  lockScroll: boolean;
190
190
  customClass: string;
@@ -40,7 +40,7 @@ declare const _default: import("vue-demi").DefineComponent<{
40
40
  default: (length: any) => string;
41
41
  };
42
42
  }, {
43
- syncTableColumnsToCookies: () => Promise<Record<string, any>>;
43
+ syncTableColumnsToCookies: () => Record<string, any>;
44
44
  setFields: (tableColumns: any) => void;
45
45
  updateColumn: () => void;
46
46
  handleSearch: (str: any) => void;
@@ -746,40 +746,6 @@ var _sfc_render$3 = function render3() {
746
746
  var _sfc_staticRenderFns$3 = [];
747
747
  var __component__$3 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(__sfc_main$3, _sfc_render$3, _sfc_staticRenderFns$3, false, null, null, null, null);
748
748
  const SearchFormItem = __component__$3.exports;
749
- function promisifyRequest(request) {
750
- return new Promise((resolve, reject) => {
751
- request.oncomplete = request.onsuccess = () => resolve(request.result);
752
- request.onabort = request.onerror = () => reject(request.error);
753
- });
754
- }
755
- function createStore(dbName, storeName) {
756
- const request = indexedDB.open(dbName);
757
- request.onupgradeneeded = () => request.result.createObjectStore(storeName);
758
- const dbp = promisifyRequest(request);
759
- return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
760
- }
761
- let defaultGetStoreFunc;
762
- function defaultGetStore() {
763
- if (!defaultGetStoreFunc) {
764
- defaultGetStoreFunc = createStore("keyval-store", "keyval");
765
- }
766
- return defaultGetStoreFunc;
767
- }
768
- function get(key, customStore = defaultGetStore()) {
769
- return customStore("readonly", (store) => promisifyRequest(store.get(key)));
770
- }
771
- function set(key, value, customStore = defaultGetStore()) {
772
- return customStore("readwrite", (store) => {
773
- store.put(value, key);
774
- return promisifyRequest(store.transaction);
775
- });
776
- }
777
- function del(key, customStore = defaultGetStore()) {
778
- return customStore("readwrite", (store) => {
779
- store.delete(key);
780
- return promisifyRequest(store.transaction);
781
- });
782
- }
783
749
  const __sfc_main$2 = vueDemi.defineComponent({
784
750
  name: "NfColumnCheckDialog"
785
751
  });
@@ -946,7 +912,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
946
912
  addInitValue();
947
913
  });
948
914
  (_a = vueDemi.getCurrentInstance()) == null ? void 0 : _a.proxy;
949
- const submit = async () => {
915
+ const submit = () => {
950
916
  visible.value = false;
951
917
  const columnState = {};
952
918
  props.tableColumns.map((i, index2) => {
@@ -958,7 +924,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
958
924
  });
959
925
  emit("save", tableData.value);
960
926
  if (props.columnEdit) {
961
- await set(props.storageKey, columnState);
927
+ commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
962
928
  }
963
929
  };
964
930
  const addInitValue = () => {
@@ -6174,7 +6140,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6174
6140
  });
6175
6141
  updateColumn();
6176
6142
  };
6177
- const syncTableColumnsToCookies = async () => {
6143
+ const syncTableColumnsToCookies = () => {
6178
6144
  var _a2;
6179
6145
  const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value];
6180
6146
  if (newTableColumns.filter((item) => !item.initHidden).length === 0) {
@@ -6197,7 +6163,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6197
6163
  obj[i.prop] = !columnState[i.prop].initHidden;
6198
6164
  });
6199
6165
  if (props.columnEdit) {
6200
- await set(props.storageKey, columnState);
6166
+ commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
6201
6167
  }
6202
6168
  return obj;
6203
6169
  };
@@ -7061,8 +7027,10 @@ __sfc_main.setup = (__props, __ctx) => {
7061
7027
  const columnCheckDrawer = vueDemi.ref();
7062
7028
  const columnCheckDialog = vueDemi.ref();
7063
7029
  const nfSearchFormModel = vueDemi.ref({});
7064
- const initLocalShow = () => {
7065
- props.formOptions._skip = true;
7030
+ const initLocalShow = (init = false) => {
7031
+ if (!init) {
7032
+ props.formOptions._skip = true;
7033
+ }
7066
7034
  const result = props.formOptions.filter((item) => {
7067
7035
  var _a2;
7068
7036
  if ((_a2 = props.showItems) == null ? void 0 : _a2.includes(item.prop)) {
@@ -7070,9 +7038,11 @@ __sfc_main.setup = (__props, __ctx) => {
7070
7038
  }
7071
7039
  return !item.initHidden;
7072
7040
  }).map((item) => item.prop);
7073
- vueDemi.nextTick(() => {
7074
- props.formOptions._skip = false;
7075
- });
7041
+ if (!init) {
7042
+ vueDemi.nextTick(() => {
7043
+ props.formOptions._skip = false;
7044
+ });
7045
+ }
7076
7046
  if (result.length) {
7077
7047
  return result;
7078
7048
  }
@@ -7090,7 +7060,7 @@ __sfc_main.setup = (__props, __ctx) => {
7090
7060
  }, {
7091
7061
  immediate: true
7092
7062
  });
7093
- const syncLocalShowColumnToCookies = async () => {
7063
+ const syncLocalShowColumnToCookies = () => {
7094
7064
  if (props.columnEdit) {
7095
7065
  const columnState = {};
7096
7066
  props.formOptions.map((i, index2) => {
@@ -7101,13 +7071,16 @@ __sfc_main.setup = (__props, __ctx) => {
7101
7071
  index: index2
7102
7072
  };
7103
7073
  });
7104
- await set(props.storageKey, columnState);
7074
+ commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
7105
7075
  }
7106
7076
  };
7107
7077
  const syncCookiesToLocalShowColumn = async () => {
7108
7078
  if (props.columnEdit) {
7109
7079
  try {
7110
- let columnState = await get(props.storageKey);
7080
+ let columnState = commonUtils.CachedManager.syncCachedGet(props.storageKey);
7081
+ if (!columnState) {
7082
+ columnState = await commonUtils.CachedManager.asyncCachedGet(props.storageKey);
7083
+ }
7111
7084
  if (columnState) {
7112
7085
  if (typeof columnState === "string") {
7113
7086
  columnState = JSON.parse(columnState);
@@ -7122,7 +7095,6 @@ __sfc_main.setup = (__props, __ctx) => {
7122
7095
  }
7123
7096
  } catch (e) {
7124
7097
  console.log(e);
7125
- await del(props.storageKey);
7126
7098
  }
7127
7099
  }
7128
7100
  };
@@ -7143,16 +7115,15 @@ __sfc_main.setup = (__props, __ctx) => {
7143
7115
  const initCachedData = async () => {
7144
7116
  var _a2, _b;
7145
7117
  if (props.columnEdit) {
7146
- try {
7147
- const cached = await get(props.storageKey);
7148
- const cachedPriority = props.priority === "cached";
7149
- if (cachedPriority ? cached : (_a2 = localShowItems.value) == null ? void 0 : _a2.length) {
7150
- cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies();
7151
- } else if (cachedPriority ? (_b = localShowItems.value) == null ? void 0 : _b.length : cached) {
7152
- cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
7153
- }
7154
- } catch (e) {
7155
- await del(props.storageKey);
7118
+ let cached = commonUtils.CachedManager.syncCachedGet(props.storageKey);
7119
+ if (!cached) {
7120
+ cached = await commonUtils.CachedManager.asyncCachedGet(props.storageKey);
7121
+ }
7122
+ const cachedPriority = props.priority === "cached";
7123
+ if (cachedPriority ? cached : (_a2 = localShowItems.value) == null ? void 0 : _a2.length) {
7124
+ cachedPriority ? await syncCookiesToLocalShowColumn() : syncLocalShowColumnToCookies();
7125
+ } else if (cachedPriority ? (_b = localShowItems.value) == null ? void 0 : _b.length : cached) {
7126
+ cachedPriority ? syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
7156
7127
  }
7157
7128
  }
7158
7129
  };
@@ -7164,6 +7135,7 @@ __sfc_main.setup = (__props, __ctx) => {
7164
7135
  });
7165
7136
  const renderSearchFormItemOptions = vueDemi.ref([]);
7166
7137
  const syncCookiesToSearchFormItemOptions = async (readCached = true) => {
7138
+ renderSearchFormItemOptions.value = [];
7167
7139
  props.formOptions._skip = true;
7168
7140
  const columns = props.formOptions.map((item, index2) => {
7169
7141
  item.key = item.key || commonUtils.createUniqueString();
@@ -7175,7 +7147,10 @@ __sfc_main.setup = (__props, __ctx) => {
7175
7147
  });
7176
7148
  if (readCached && props.columnEdit) {
7177
7149
  try {
7178
- let columnState = await get(props.storageKey);
7150
+ let columnState = commonUtils.CachedManager.syncCachedGet(props.storageKey);
7151
+ if (!columnState) {
7152
+ columnState = await commonUtils.CachedManager.asyncCachedGet(props.storageKey);
7153
+ }
7179
7154
  props.formOptions._skip = true;
7180
7155
  if (columnState) {
7181
7156
  if (typeof columnState === "string") {
@@ -7197,9 +7172,9 @@ __sfc_main.setup = (__props, __ctx) => {
7197
7172
  console.log(e);
7198
7173
  }
7199
7174
  }
7175
+ renderSearchFormItemOptions.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
7200
7176
  await vueDemi.nextTick();
7201
7177
  props.formOptions._skip = false;
7202
- renderSearchFormItemOptions.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
7203
7178
  };
7204
7179
  syncCookiesToSearchFormItemOptions();
7205
7180
  const itemIsShow = (item) => {
@@ -7240,7 +7215,7 @@ __sfc_main.setup = (__props, __ctx) => {
7240
7215
  });
7241
7216
  refreshNfSearchFormModel(false, true);
7242
7217
  });
7243
- const refreshNfSearchFormModel = async (outEmit = true, init = false) => {
7218
+ const refreshNfSearchFormModel = (outEmit = true, init = false) => {
7244
7219
  const obj = {};
7245
7220
  props.formOptions.filter((item) => !item.destory).forEach((v) => {
7246
7221
  if (localShowItems.value.includes(v.prop)) {
@@ -7259,8 +7234,9 @@ __sfc_main.setup = (__props, __ctx) => {
7259
7234
  nfSearchFormModel.value = obj;
7260
7235
  if (outEmit) {
7261
7236
  emit("onChange", nfSearchFormModel.value);
7262
- await vueDemi.nextTick();
7263
- emit("itemsChange", localShowItems.value);
7237
+ vueDemi.nextTick(() => {
7238
+ emit("itemsChange", localShowItems.value);
7239
+ });
7264
7240
  }
7265
7241
  }
7266
7242
  };
@@ -7363,7 +7339,7 @@ __sfc_main.setup = (__props, __ctx) => {
7363
7339
  localShowItems.value = prop.formOptions.filter((item) => !item.initHidden).map((item) => item.prop);
7364
7340
  await syncLocalShowColumnToCookies();
7365
7341
  await syncCookiesToSearchFormItemOptions();
7366
- await refreshNfSearchFormModel();
7342
+ refreshNfSearchFormModel();
7367
7343
  await vueDemi.nextTick();
7368
7344
  refreshLabel();
7369
7345
  };
@@ -7384,7 +7360,7 @@ __sfc_main.setup = (__props, __ctx) => {
7384
7360
  columnCheckConfirmFeedback(value);
7385
7361
  await syncCookiesToLocalShowColumn();
7386
7362
  await syncCookiesToSearchFormItemOptions();
7387
- await refreshNfSearchFormModel();
7363
+ refreshNfSearchFormModel();
7388
7364
  await vueDemi.nextTick();
7389
7365
  refreshLabel();
7390
7366
  cb();
@@ -7397,7 +7373,7 @@ __sfc_main.setup = (__props, __ctx) => {
7397
7373
  columnCheckConfirmFeedback(value);
7398
7374
  await syncCookiesToLocalShowColumn();
7399
7375
  await syncCookiesToSearchFormItemOptions();
7400
- await refreshNfSearchFormModel();
7376
+ refreshNfSearchFormModel();
7401
7377
  await vueDemi.nextTick();
7402
7378
  refreshLabel();
7403
7379
  };
@@ -1,8 +1,8 @@
1
1
  import { defineComponent, ref, getCurrentInstance, computed, watch, onBeforeMount, onMounted, nextTick, onBeforeUnmount } from "vue-demi";
2
2
  import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
3
- import { createUniqueString, deepClone } from "@94ai/common-utils";
3
+ import { createUniqueString, CachedManager, deepClone } from "@94ai/common-utils";
4
4
  import ResizeObserver from "resize-observer-polyfill";
5
- import { set as set$1 } from "vue";
5
+ import { set } from "vue";
6
6
  import NfMessage from "@94ai/nf-message";
7
7
  const __sfc_main$5 = defineComponent({
8
8
  name: "NfNumberRange"
@@ -744,40 +744,6 @@ var _sfc_render$3 = function render3() {
744
744
  var _sfc_staticRenderFns$3 = [];
745
745
  var __component__$3 = /* @__PURE__ */ normalizeComponent(__sfc_main$3, _sfc_render$3, _sfc_staticRenderFns$3, false, null, null, null, null);
746
746
  const SearchFormItem = __component__$3.exports;
747
- function promisifyRequest(request) {
748
- return new Promise((resolve, reject) => {
749
- request.oncomplete = request.onsuccess = () => resolve(request.result);
750
- request.onabort = request.onerror = () => reject(request.error);
751
- });
752
- }
753
- function createStore(dbName, storeName) {
754
- const request = indexedDB.open(dbName);
755
- request.onupgradeneeded = () => request.result.createObjectStore(storeName);
756
- const dbp = promisifyRequest(request);
757
- return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
758
- }
759
- let defaultGetStoreFunc;
760
- function defaultGetStore() {
761
- if (!defaultGetStoreFunc) {
762
- defaultGetStoreFunc = createStore("keyval-store", "keyval");
763
- }
764
- return defaultGetStoreFunc;
765
- }
766
- function get(key, customStore = defaultGetStore()) {
767
- return customStore("readonly", (store) => promisifyRequest(store.get(key)));
768
- }
769
- function set(key, value, customStore = defaultGetStore()) {
770
- return customStore("readwrite", (store) => {
771
- store.put(value, key);
772
- return promisifyRequest(store.transaction);
773
- });
774
- }
775
- function del(key, customStore = defaultGetStore()) {
776
- return customStore("readwrite", (store) => {
777
- store.delete(key);
778
- return promisifyRequest(store.transaction);
779
- });
780
- }
781
747
  const __sfc_main$2 = defineComponent({
782
748
  name: "NfColumnCheckDialog"
783
749
  });
@@ -944,7 +910,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
944
910
  addInitValue();
945
911
  });
946
912
  (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
947
- const submit = async () => {
913
+ const submit = () => {
948
914
  visible.value = false;
949
915
  const columnState = {};
950
916
  props.tableColumns.map((i, index2) => {
@@ -956,7 +922,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
956
922
  });
957
923
  emit("save", tableData.value);
958
924
  if (props.columnEdit) {
959
- await set(props.storageKey, columnState);
925
+ CachedManager.syncCachedSet(props.storageKey, columnState);
960
926
  }
961
927
  };
962
928
  const addInitValue = () => {
@@ -6172,7 +6138,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6172
6138
  });
6173
6139
  updateColumn();
6174
6140
  };
6175
- const syncTableColumnsToCookies = async () => {
6141
+ const syncTableColumnsToCookies = () => {
6176
6142
  var _a2;
6177
6143
  const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value];
6178
6144
  if (newTableColumns.filter((item) => !item.initHidden).length === 0) {
@@ -6195,7 +6161,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6195
6161
  obj[i.prop] = !columnState[i.prop].initHidden;
6196
6162
  });
6197
6163
  if (props.columnEdit) {
6198
- await set(props.storageKey, columnState);
6164
+ CachedManager.syncCachedSet(props.storageKey, columnState);
6199
6165
  }
6200
6166
  return obj;
6201
6167
  };
@@ -7059,8 +7025,10 @@ __sfc_main.setup = (__props, __ctx) => {
7059
7025
  const columnCheckDrawer = ref();
7060
7026
  const columnCheckDialog = ref();
7061
7027
  const nfSearchFormModel = ref({});
7062
- const initLocalShow = () => {
7063
- props.formOptions._skip = true;
7028
+ const initLocalShow = (init = false) => {
7029
+ if (!init) {
7030
+ props.formOptions._skip = true;
7031
+ }
7064
7032
  const result = props.formOptions.filter((item) => {
7065
7033
  var _a2;
7066
7034
  if ((_a2 = props.showItems) == null ? void 0 : _a2.includes(item.prop)) {
@@ -7068,9 +7036,11 @@ __sfc_main.setup = (__props, __ctx) => {
7068
7036
  }
7069
7037
  return !item.initHidden;
7070
7038
  }).map((item) => item.prop);
7071
- nextTick(() => {
7072
- props.formOptions._skip = false;
7073
- });
7039
+ if (!init) {
7040
+ nextTick(() => {
7041
+ props.formOptions._skip = false;
7042
+ });
7043
+ }
7074
7044
  if (result.length) {
7075
7045
  return result;
7076
7046
  }
@@ -7088,7 +7058,7 @@ __sfc_main.setup = (__props, __ctx) => {
7088
7058
  }, {
7089
7059
  immediate: true
7090
7060
  });
7091
- const syncLocalShowColumnToCookies = async () => {
7061
+ const syncLocalShowColumnToCookies = () => {
7092
7062
  if (props.columnEdit) {
7093
7063
  const columnState = {};
7094
7064
  props.formOptions.map((i, index2) => {
@@ -7099,13 +7069,16 @@ __sfc_main.setup = (__props, __ctx) => {
7099
7069
  index: index2
7100
7070
  };
7101
7071
  });
7102
- await set(props.storageKey, columnState);
7072
+ CachedManager.syncCachedSet(props.storageKey, columnState);
7103
7073
  }
7104
7074
  };
7105
7075
  const syncCookiesToLocalShowColumn = async () => {
7106
7076
  if (props.columnEdit) {
7107
7077
  try {
7108
- let columnState = await get(props.storageKey);
7078
+ let columnState = CachedManager.syncCachedGet(props.storageKey);
7079
+ if (!columnState) {
7080
+ columnState = await CachedManager.asyncCachedGet(props.storageKey);
7081
+ }
7109
7082
  if (columnState) {
7110
7083
  if (typeof columnState === "string") {
7111
7084
  columnState = JSON.parse(columnState);
@@ -7120,7 +7093,6 @@ __sfc_main.setup = (__props, __ctx) => {
7120
7093
  }
7121
7094
  } catch (e) {
7122
7095
  console.log(e);
7123
- await del(props.storageKey);
7124
7096
  }
7125
7097
  }
7126
7098
  };
@@ -7141,16 +7113,15 @@ __sfc_main.setup = (__props, __ctx) => {
7141
7113
  const initCachedData = async () => {
7142
7114
  var _a2, _b;
7143
7115
  if (props.columnEdit) {
7144
- try {
7145
- const cached = await get(props.storageKey);
7146
- const cachedPriority = props.priority === "cached";
7147
- if (cachedPriority ? cached : (_a2 = localShowItems.value) == null ? void 0 : _a2.length) {
7148
- cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies();
7149
- } else if (cachedPriority ? (_b = localShowItems.value) == null ? void 0 : _b.length : cached) {
7150
- cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
7151
- }
7152
- } catch (e) {
7153
- await del(props.storageKey);
7116
+ let cached = CachedManager.syncCachedGet(props.storageKey);
7117
+ if (!cached) {
7118
+ cached = await CachedManager.asyncCachedGet(props.storageKey);
7119
+ }
7120
+ const cachedPriority = props.priority === "cached";
7121
+ if (cachedPriority ? cached : (_a2 = localShowItems.value) == null ? void 0 : _a2.length) {
7122
+ cachedPriority ? await syncCookiesToLocalShowColumn() : syncLocalShowColumnToCookies();
7123
+ } else if (cachedPriority ? (_b = localShowItems.value) == null ? void 0 : _b.length : cached) {
7124
+ cachedPriority ? syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
7154
7125
  }
7155
7126
  }
7156
7127
  };
@@ -7162,18 +7133,22 @@ __sfc_main.setup = (__props, __ctx) => {
7162
7133
  });
7163
7134
  const renderSearchFormItemOptions = ref([]);
7164
7135
  const syncCookiesToSearchFormItemOptions = async (readCached = true) => {
7136
+ renderSearchFormItemOptions.value = [];
7165
7137
  props.formOptions._skip = true;
7166
7138
  const columns = props.formOptions.map((item, index2) => {
7167
7139
  item.key = item.key || createUniqueString();
7168
7140
  item._index = index2;
7169
7141
  item.__index = index2;
7170
- set$1(item, "initHidden", !!item.initHidden);
7171
- set$1(item, "destory", !!item.destory);
7142
+ set(item, "initHidden", !!item.initHidden);
7143
+ set(item, "destory", !!item.destory);
7172
7144
  return item;
7173
7145
  });
7174
7146
  if (readCached && props.columnEdit) {
7175
7147
  try {
7176
- let columnState = await get(props.storageKey);
7148
+ let columnState = CachedManager.syncCachedGet(props.storageKey);
7149
+ if (!columnState) {
7150
+ columnState = await CachedManager.asyncCachedGet(props.storageKey);
7151
+ }
7177
7152
  props.formOptions._skip = true;
7178
7153
  if (columnState) {
7179
7154
  if (typeof columnState === "string") {
@@ -7195,9 +7170,9 @@ __sfc_main.setup = (__props, __ctx) => {
7195
7170
  console.log(e);
7196
7171
  }
7197
7172
  }
7173
+ renderSearchFormItemOptions.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
7198
7174
  await nextTick();
7199
7175
  props.formOptions._skip = false;
7200
- renderSearchFormItemOptions.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
7201
7176
  };
7202
7177
  syncCookiesToSearchFormItemOptions();
7203
7178
  const itemIsShow = (item) => {
@@ -7238,7 +7213,7 @@ __sfc_main.setup = (__props, __ctx) => {
7238
7213
  });
7239
7214
  refreshNfSearchFormModel(false, true);
7240
7215
  });
7241
- const refreshNfSearchFormModel = async (outEmit = true, init = false) => {
7216
+ const refreshNfSearchFormModel = (outEmit = true, init = false) => {
7242
7217
  const obj = {};
7243
7218
  props.formOptions.filter((item) => !item.destory).forEach((v) => {
7244
7219
  if (localShowItems.value.includes(v.prop)) {
@@ -7257,8 +7232,9 @@ __sfc_main.setup = (__props, __ctx) => {
7257
7232
  nfSearchFormModel.value = obj;
7258
7233
  if (outEmit) {
7259
7234
  emit("onChange", nfSearchFormModel.value);
7260
- await nextTick();
7261
- emit("itemsChange", localShowItems.value);
7235
+ nextTick(() => {
7236
+ emit("itemsChange", localShowItems.value);
7237
+ });
7262
7238
  }
7263
7239
  }
7264
7240
  };
@@ -7361,7 +7337,7 @@ __sfc_main.setup = (__props, __ctx) => {
7361
7337
  localShowItems.value = prop.formOptions.filter((item) => !item.initHidden).map((item) => item.prop);
7362
7338
  await syncLocalShowColumnToCookies();
7363
7339
  await syncCookiesToSearchFormItemOptions();
7364
- await refreshNfSearchFormModel();
7340
+ refreshNfSearchFormModel();
7365
7341
  await nextTick();
7366
7342
  refreshLabel();
7367
7343
  };
@@ -7382,7 +7358,7 @@ __sfc_main.setup = (__props, __ctx) => {
7382
7358
  columnCheckConfirmFeedback(value);
7383
7359
  await syncCookiesToLocalShowColumn();
7384
7360
  await syncCookiesToSearchFormItemOptions();
7385
- await refreshNfSearchFormModel();
7361
+ refreshNfSearchFormModel();
7386
7362
  await nextTick();
7387
7363
  refreshLabel();
7388
7364
  cb();
@@ -7395,7 +7371,7 @@ __sfc_main.setup = (__props, __ctx) => {
7395
7371
  columnCheckConfirmFeedback(value);
7396
7372
  await syncCookiesToLocalShowColumn();
7397
7373
  await syncCookiesToSearchFormItemOptions();
7398
- await refreshNfSearchFormModel();
7374
+ refreshNfSearchFormModel();
7399
7375
  await nextTick();
7400
7376
  refreshLabel();
7401
7377
  };
@@ -1,6 +1,14 @@
1
1
  import { NfSearchFormItemOption } from './types';
2
2
  import { ITabItem } from '@94ai/nf-drawer/lib/types';
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<{
4
+ columns: {
5
+ type: import("vue-demi").PropType<number>;
6
+ default: undefined;
7
+ };
8
+ top: {
9
+ type: import("vue-demi").PropType<string>;
10
+ default: string;
11
+ };
4
12
  storageKey: {
5
13
  type: import("vue-demi").PropType<string>;
6
14
  default: string;
@@ -21,10 +29,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
21
29
  type: import("vue-demi").PropType<boolean>;
22
30
  default: boolean;
23
31
  };
24
- top: {
25
- type: import("vue-demi").PropType<string>;
26
- default: string;
27
- };
28
32
  appendToBody: {
29
33
  type: import("vue-demi").PropType<boolean>;
30
34
  default: boolean;
@@ -65,10 +69,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
65
69
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
66
70
  default: string;
67
71
  };
68
- columns: {
69
- type: import("vue-demi").PropType<number>;
70
- default: undefined;
71
- };
72
72
  selectEmptyWarningTips: {
73
73
  type: import("vue-demi").PropType<string>;
74
74
  default: string;
@@ -407,11 +407,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
407
407
  };
408
408
  }, {
409
409
  localShowItems: import("vue-demi").Ref<string[]>;
410
- syncLocalShowColumnToCookies: () => Promise<void>;
410
+ syncLocalShowColumnToCookies: () => void;
411
411
  syncCookiesToLocalShowColumn: () => Promise<void>;
412
412
  syncShowItemToInitHidden: () => void;
413
413
  hiddenNfSearchFormItemOptionField: (prop: any) => Promise<void>;
414
- refreshNfSearchFormModel: (outEmit?: boolean, init?: boolean) => Promise<void>;
414
+ refreshNfSearchFormModel: (outEmit?: boolean, init?: boolean) => void;
415
415
  renderSearchFormItemOptions: import("vue-demi").Ref<{
416
416
  key?: string | undefined;
417
417
  _index?: number | undefined;
@@ -483,6 +483,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
483
483
  isCollapseChange: (event: boolean) => void;
484
484
  "update:showItems": (event: string[] | undefined) => void;
485
485
  }, string, Readonly<import("vue-demi").ExtractPropTypes<{
486
+ columns: {
487
+ type: import("vue-demi").PropType<number>;
488
+ default: undefined;
489
+ };
490
+ top: {
491
+ type: import("vue-demi").PropType<string>;
492
+ default: string;
493
+ };
486
494
  storageKey: {
487
495
  type: import("vue-demi").PropType<string>;
488
496
  default: string;
@@ -503,10 +511,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
503
511
  type: import("vue-demi").PropType<boolean>;
504
512
  default: boolean;
505
513
  };
506
- top: {
507
- type: import("vue-demi").PropType<string>;
508
- default: string;
509
- };
510
514
  appendToBody: {
511
515
  type: import("vue-demi").PropType<boolean>;
512
516
  default: boolean;
@@ -547,10 +551,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
547
551
  type: import("vue-demi").PropType<"medium" | "small" | "mini">;
548
552
  default: string;
549
553
  };
550
- columns: {
551
- type: import("vue-demi").PropType<number>;
552
- default: undefined;
553
- };
554
554
  selectEmptyWarningTips: {
555
555
  type: import("vue-demi").PropType<string>;
556
556
  default: string;
@@ -888,12 +888,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
888
888
  default: string;
889
889
  };
890
890
  }>>, {
891
+ columns: number;
892
+ top: string;
891
893
  storageKey: string;
892
894
  columnEdit: boolean;
893
895
  modalAppendToBody: boolean;
894
896
  modal: boolean;
895
897
  fullscreen: boolean;
896
- top: string;
897
898
  appendToBody: boolean;
898
899
  lockScroll: boolean;
899
900
  customClass: string;
@@ -904,7 +905,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
904
905
  center: boolean;
905
906
  destroyOnClose: boolean;
906
907
  size: 'medium' | 'small' | 'mini';
907
- columns: number;
908
908
  selectEmptyWarningTips: string;
909
909
  disabled: boolean;
910
910
  itemWidth: number;
@@ -55,8 +55,8 @@ import {
55
55
  onMounted,
56
56
  ref
57
57
  } from 'vue-demi'
58
- import { NfSearchFormItemOption } from 'packages/nf-search-form/lib/types'
59
- import { set as cachedSet } from 'idb-keyval'
58
+ import { NfSearchFormItemOption } from './types'
59
+ import { CachedManager } from '@94ai/common-utils'
60
60
 
61
61
  const props = withDefaults(defineProps<{
62
62
  storageKey?: string
@@ -154,7 +154,7 @@ onMounted(() => {
154
154
  })
155
155
  const instance = getCurrentInstance()?.proxy
156
156
 
157
- const submit = async () => {
157
+ const submit = () => {
158
158
  visible.value = false
159
159
  const columnState = {}
160
160
  props.tableColumns.map((i, index) => {
@@ -166,7 +166,7 @@ const submit = async () => {
166
166
  })
167
167
  emit('save', tableData.value)
168
168
  if (props.columnEdit) {
169
- await cachedSet(props.storageKey, columnState)
169
+ CachedManager.syncCachedSet(props.storageKey, columnState)
170
170
  }
171
171
  }
172
172
 
@@ -140,7 +140,7 @@ import {
140
140
  getCurrentInstance,
141
141
  } from 'vue-demi'
142
142
  import { deepClone } from '@94ai/common-utils'
143
- import { set as cachedSet } from 'idb-keyval'
143
+ import { CachedManager } from '@94ai/common-utils'
144
144
 
145
145
  const instance = getCurrentInstance()?.proxy
146
146
 
@@ -347,7 +347,7 @@ const handleFixed = (v, prop) => {
347
347
  /**
348
348
  * 确定
349
349
  */
350
- const syncTableColumnsToCookies = async () => {
350
+ const syncTableColumnsToCookies = () => {
351
351
  const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value]
352
352
  if (newTableColumns.filter(item => !item.initHidden).length === 0) {
353
353
  // @ts-ignore
@@ -369,7 +369,7 @@ const syncTableColumnsToCookies = async () => {
369
369
  obj[i.prop] = !columnState[i.prop].initHidden
370
370
  })
371
371
  if (props.columnEdit) {
372
- await cachedSet(props.storageKey, columnState)
372
+ CachedManager.syncCachedSet(props.storageKey, columnState)
373
373
  }
374
374
  return obj
375
375
  }
@@ -292,10 +292,8 @@ import {
292
292
  } from '@94ai/nf-table/lib/types'
293
293
  import { set } from 'vue'
294
294
  import {
295
- del,
296
- get as cachedGet,
297
- set as cachedSet
298
- } from 'idb-keyval'
295
+ CachedManager,
296
+ } from '@94ai/common-utils'
299
297
 
300
298
 
301
299
  const props = withDefaults(defineProps<{
@@ -609,17 +607,21 @@ const nfSearchFormModel = ref<Record<string, any>>({})
609
607
  /**
610
608
  * 同步用户参数
611
609
  */
612
- const initLocalShow = () => {
613
- props.formOptions._skip = true
610
+ const initLocalShow = (init = false) => {
611
+ if (!init) {
612
+ props.formOptions._skip = true
613
+ }
614
614
  const result = props.formOptions.filter(item => {
615
615
  if (props.showItems?.includes(item.prop!)) {
616
616
  item.initHidden = false
617
617
  }
618
618
  return !item.initHidden
619
619
  }).map(item => item.prop!)
620
- nextTick(() => {
621
- props.formOptions._skip = false
622
- })
620
+ if (!init) {
621
+ nextTick(() => {
622
+ props.formOptions._skip = false
623
+ })
624
+ }
623
625
  if (result.length) {
624
626
  return result
625
627
  }
@@ -637,7 +639,7 @@ watch(() => localShowItems.value?.length, async () => {
637
639
  }, {
638
640
  immediate: true
639
641
  })
640
- const syncLocalShowColumnToCookies = async () => {
642
+ const syncLocalShowColumnToCookies = () => {
641
643
  if (props.columnEdit) {
642
644
  const columnState = {}
643
645
  props.formOptions.map((i, index) => {
@@ -648,14 +650,17 @@ const syncLocalShowColumnToCookies = async () => {
648
650
  index
649
651
  }
650
652
  })
651
- await cachedSet(props.storageKey, columnState)
653
+ CachedManager.syncCachedSet(props.storageKey, columnState)
652
654
  }
653
655
  }
654
656
 
655
657
  const syncCookiesToLocalShowColumn = async () => {
656
658
  if (props.columnEdit) {
657
659
  try {
658
- let columnState: string | NfTableColumnAttributes | undefined = await cachedGet(props.storageKey)
660
+ let columnState: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(props.storageKey)
661
+ if (!columnState) {
662
+ columnState = await CachedManager.asyncCachedGet(props.storageKey)
663
+ }
659
664
  if (columnState) {
660
665
  if (typeof columnState === 'string') {
661
666
  columnState = JSON.parse(columnState)
@@ -670,7 +675,6 @@ const syncCookiesToLocalShowColumn = async () => {
670
675
  }
671
676
  } catch (e) {
672
677
  console.log(e)
673
- await del(props.storageKey)
674
678
  }
675
679
  }
676
680
  }
@@ -691,16 +695,15 @@ const syncShowItemToInitHidden = () => {
691
695
  const initCachedData = async () => {
692
696
  if (props.columnEdit) {
693
697
  // 同步缓存参数
694
- try {
695
- const cached = await cachedGet(props.storageKey)
696
- const cachedPriority = props.priority === 'cached'
697
- if (cachedPriority ? cached : localShowItems.value?.length) {
698
- cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies()
699
- } else if (cachedPriority ? localShowItems.value?.length : cached) {
700
- cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn()
701
- }
702
- } catch (e) {
703
- await del(props.storageKey)
698
+ let cached: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(props.storageKey)
699
+ if (!cached) {
700
+ cached = await CachedManager.asyncCachedGet(props.storageKey)
701
+ }
702
+ const cachedPriority = props.priority === 'cached'
703
+ if (cachedPriority ? cached : localShowItems.value?.length) {
704
+ cachedPriority ? await syncCookiesToLocalShowColumn() : syncLocalShowColumnToCookies()
705
+ } else if (cachedPriority ? localShowItems.value?.length : cached) {
706
+ cachedPriority ? syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn()
704
707
  }
705
708
  }
706
709
  }
@@ -728,6 +731,7 @@ const isShowBtnBoxSlot = computed(() => {
728
731
  */
729
732
  const renderSearchFormItemOptions = ref<NfSearchFormItemOption[]>([])
730
733
  const syncCookiesToSearchFormItemOptions = async (readCached = true) => {
734
+ renderSearchFormItemOptions.value = []
731
735
  props.formOptions._skip = true
732
736
  const columns = props.formOptions!.map((item, index) => {
733
737
  item.key = item.key || createUniqueString()
@@ -740,7 +744,11 @@ const syncCookiesToSearchFormItemOptions = async (readCached = true) => {
740
744
  if (readCached && props.columnEdit) {
741
745
  // 读取缓存 Column 配置
742
746
  try {
743
- let columnState: string | NfTableColumnAttributes | undefined = await cachedGet(props.storageKey)
747
+ // 同步缓存参数
748
+ let columnState: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(props.storageKey)
749
+ if (!columnState) {
750
+ columnState = await CachedManager.asyncCachedGet(props.storageKey)
751
+ }
744
752
  props.formOptions._skip = true
745
753
  if (columnState) {
746
754
  if (typeof columnState === 'string') {
@@ -762,9 +770,9 @@ const syncCookiesToSearchFormItemOptions = async (readCached = true) => {
762
770
  console.log(e)
763
771
  }
764
772
  }
773
+ renderSearchFormItemOptions.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
765
774
  await nextTick()
766
775
  props.formOptions._skip = false
767
- renderSearchFormItemOptions.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
768
776
  }
769
777
  syncCookiesToSearchFormItemOptions()
770
778
 
@@ -834,7 +842,7 @@ onBeforeMount(() => {
834
842
  })
835
843
 
836
844
 
837
- const refreshNfSearchFormModel = async (outEmit = true, init = false) => {
845
+ const refreshNfSearchFormModel = (outEmit = true, init = false) => {
838
846
  const obj: Record<string, any> = {}
839
847
  props.formOptions.filter(item => !item.destory).forEach(v => {
840
848
  if (localShowItems.value.includes(v.prop)) {
@@ -853,8 +861,9 @@ const refreshNfSearchFormModel = async (outEmit = true, init = false) => {
853
861
  nfSearchFormModel.value = obj
854
862
  if (outEmit) {
855
863
  emit('onChange', nfSearchFormModel.value)
856
- await nextTick()
857
- emit('itemsChange', localShowItems.value)
864
+ nextTick(() => {
865
+ emit('itemsChange', localShowItems.value)
866
+ })
858
867
  }
859
868
  }
860
869
  }
@@ -976,7 +985,7 @@ const hiddenNfSearchFormItemOptionField = async (prop) => {
976
985
  localShowItems.value = prop.formOptions.filter(item => !item.initHidden).map(item => item.prop)
977
986
  await syncLocalShowColumnToCookies()
978
987
  await syncCookiesToSearchFormItemOptions()
979
- await refreshNfSearchFormModel()
988
+ refreshNfSearchFormModel()
980
989
  await nextTick()
981
990
  refreshLabel()
982
991
  }
@@ -1000,7 +1009,7 @@ const columnCheckConfirm = async (cb, error) => {
1000
1009
  columnCheckConfirmFeedback(value)
1001
1010
  await syncCookiesToLocalShowColumn()
1002
1011
  await syncCookiesToSearchFormItemOptions()
1003
- await refreshNfSearchFormModel()
1012
+ refreshNfSearchFormModel()
1004
1013
  await nextTick()
1005
1014
  refreshLabel()
1006
1015
  cb()
@@ -1017,7 +1026,7 @@ const nfSearchFormItemOptionFieldsSave = async (value) => {
1017
1026
  columnCheckConfirmFeedback(value)
1018
1027
  await syncCookiesToLocalShowColumn()
1019
1028
  await syncCookiesToSearchFormItemOptions()
1020
- await refreshNfSearchFormModel()
1029
+ refreshNfSearchFormModel()
1021
1030
  await nextTick()
1022
1031
  refreshLabel()
1023
1032
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-search-form",
3
- "version": "100.1.15",
3
+ "version": "100.1.19",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,21 +14,21 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-utils": "^100.1.15",
18
- "@94ai/nf-action": "^100.1.15",
19
- "@94ai/nf-double-half-year": "^100.1.15",
20
- "@94ai/nf-double-quarter": "^100.1.15",
21
- "@94ai/nf-double-week": "^100.1.15",
22
- "@94ai/nf-double-year": "^100.1.15",
23
- "@94ai/nf-drawer": "^100.1.15",
24
- "@94ai/nf-form": "^100.1.15",
25
- "@94ai/nf-form-item": "^100.1.15",
26
- "@94ai/nf-half-year-picker": "^100.1.15",
27
- "@94ai/nf-message": "^100.1.15",
28
- "@94ai/nf-quarter-picker": "^100.1.15",
29
- "@94ai/nf-select-transfer": "^100.1.15",
30
- "@94ai/nf-theme-chalk": "^100.1.15",
31
- "@94ai/nf-virtual-select": "^100.1.15",
17
+ "@94ai/common-utils": "^100.1.19",
18
+ "@94ai/nf-action": "^100.1.19",
19
+ "@94ai/nf-double-half-year": "^100.1.19",
20
+ "@94ai/nf-double-quarter": "^100.1.19",
21
+ "@94ai/nf-double-week": "^100.1.19",
22
+ "@94ai/nf-double-year": "^100.1.19",
23
+ "@94ai/nf-drawer": "^100.1.19",
24
+ "@94ai/nf-form": "^100.1.19",
25
+ "@94ai/nf-form-item": "^100.1.19",
26
+ "@94ai/nf-half-year-picker": "^100.1.19",
27
+ "@94ai/nf-message": "^100.1.19",
28
+ "@94ai/nf-quarter-picker": "^100.1.19",
29
+ "@94ai/nf-select-transfer": "^100.1.19",
30
+ "@94ai/nf-theme-chalk": "^100.1.19",
31
+ "@94ai/nf-virtual-select": "^100.1.19",
32
32
  "idb-keyval": "^6.2.1",
33
33
  "resize-observer-polyfill": "^1.5.1",
34
34
  "vue-demi": "^0.14.5",