@94ai/nf-search-form 3.2.43 → 3.2.45

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
@@ -1385,8 +1385,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1385
1385
  columnCheckDrawer: import("vue-demi").Ref<any>;
1386
1386
  configNfSearchItemVisibleDialog: import("vue-demi").Ref<boolean>;
1387
1387
  syncCookiesToSearchFormItemOptions: (readCached?: boolean) => void;
1388
- onResize: (params?: Record<string, any>) => void;
1389
- visibleChange: (params?: Record<string, any>) => void;
1388
+ onResize: (params?: Record<string, any>) => Promise<void>;
1389
+ visibleChange: () => void;
1390
1390
  }> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
1391
1391
  storageKey: {
1392
1392
  type: import("vue-demi").PropType<string>;
@@ -2264,8 +2264,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2264
2264
  columnCheckDrawer: import("vue-demi").Ref<any>;
2265
2265
  configNfSearchItemVisibleDialog: import("vue-demi").Ref<boolean>;
2266
2266
  syncCookiesToSearchFormItemOptions: (readCached?: boolean) => void;
2267
- onResize: (params?: Record<string, any>) => void;
2268
- visibleChange: (params?: Record<string, any>) => void;
2267
+ onResize: (params?: Record<string, any>) => Promise<void>;
2268
+ visibleChange: () => void;
2269
2269
  }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
2270
2270
  onChange: (event: Record<string, any>) => void;
2271
2271
  itemsChange: (event: string[]) => void;
@@ -276,34 +276,6 @@ const TimeRange = __component__$4.exports;
276
276
  function createUniqueString(randomLength = 36) {
277
277
  return Number(Math.random().toString().substr(3, randomLength) + Date.now()).toString(36);
278
278
  }
279
- function debounce(func, wait, immediate) {
280
- let timeout, args, context, timestamp, result;
281
- const later = function() {
282
- const last = +/* @__PURE__ */ new Date() - timestamp;
283
- if (last < wait && last > 0) {
284
- timeout = setTimeout(later, wait - last);
285
- } else {
286
- timeout = null;
287
- if (!immediate) {
288
- result = func.apply(context, args);
289
- if (!timeout)
290
- context = args = null;
291
- }
292
- }
293
- };
294
- return function(...args2) {
295
- context = this;
296
- timestamp = +/* @__PURE__ */ new Date();
297
- const callNow = immediate && !timeout;
298
- if (!timeout)
299
- timeout = setTimeout(later, wait);
300
- if (callNow) {
301
- result = func.apply(context, args2);
302
- context = args2 = null;
303
- }
304
- return result;
305
- };
306
- }
307
279
  function deepClone(source) {
308
280
  if (!source && typeof source !== "object") {
309
281
  throw new Error("error arguments shallowClone");
@@ -7727,18 +7699,11 @@ __sfc_main.setup = (__props, __ctx) => {
7727
7699
  const isCollapseChange = async (val) => {
7728
7700
  emit("isCollapseChange", val);
7729
7701
  await vueDemi.nextTick();
7730
- onResize();
7702
+ refreshLabel();
7731
7703
  };
7732
7704
  const domWidth = vueDemi.ref();
7733
7705
  const topDom = vueDemi.ref();
7734
- const onResize = (params = {}) => {
7735
- console.log(params, "resize");
7736
- const {
7737
- width
7738
- } = params || {};
7739
- if (width && domWidth.value && width === domWidth.value) {
7740
- return;
7741
- }
7706
+ const refreshLabel = () => {
7742
7707
  if (props.btnModel === "inline" && !props.btnBoxLabel && props.labelPosition === "top") {
7743
7708
  if (nfSearchFormRef.value.$el.getBoundingClientRect().left === defaultButtonSlot.value.$el.getBoundingClientRect().left) {
7744
7709
  showBtnBoxLabel.value = "";
@@ -7747,13 +7712,21 @@ __sfc_main.setup = (__props, __ctx) => {
7747
7712
  }
7748
7713
  }
7749
7714
  };
7750
- const calcColumns = (params = {}) => {
7715
+ const onResize = async (params = {}) => {
7716
+ var _a2;
7751
7717
  const {
7752
7718
  width
7753
- } = params || {};
7719
+ } = ((_a2 = params == null ? void 0 : params[0]) == null ? void 0 : _a2.contentRect) || {};
7754
7720
  if (width && domWidth.value && width === domWidth.value) {
7755
7721
  return;
7756
7722
  }
7723
+ if (domWidth.value) {
7724
+ await vueDemi.nextTick();
7725
+ domWidth.value = topDom.value.offsetWidth;
7726
+ }
7727
+ refreshLabel();
7728
+ };
7729
+ const calcColumns = () => {
7757
7730
  if (props.columns) {
7758
7731
  newColumns.value = props.columns;
7759
7732
  return;
@@ -7771,19 +7744,15 @@ __sfc_main.setup = (__props, __ctx) => {
7771
7744
  }, 0);
7772
7745
  newColumns.value = count;
7773
7746
  };
7774
- const resizeOpterate = (params) => {
7775
- onResize(params);
7776
- calcColumns(params);
7777
- };
7778
- const debounceResize = debounce(resizeOpterate, 100, false);
7779
7747
  const observer = vueDemi.ref();
7780
7748
  vueDemi.onMounted(async () => {
7781
7749
  await vueDemi.nextTick();
7782
- observer.value = new index(debounceResize);
7750
+ calcColumns();
7751
+ await vueDemi.nextTick();
7752
+ observer.value = new index(onResize);
7783
7753
  observer.value.observe(topDom.value, {
7784
7754
  box: "border-box"
7785
7755
  });
7786
- domWidth.value = topDom.value.offsetWidth;
7787
7756
  });
7788
7757
  vueDemi.onBeforeUnmount(() => {
7789
7758
  var _a2;
@@ -7820,7 +7789,7 @@ __sfc_main.setup = (__props, __ctx) => {
7820
7789
  syncCookiesToSearchFormItemOptions();
7821
7790
  refreshNfSearchFormModel();
7822
7791
  await vueDemi.nextTick();
7823
- onResize();
7792
+ refreshLabel();
7824
7793
  }
7825
7794
  };
7826
7795
  const refreshNfSearchFormModel = async () => {
@@ -7853,7 +7822,7 @@ __sfc_main.setup = (__props, __ctx) => {
7853
7822
  syncCookiesToSearchFormItemOptions();
7854
7823
  refreshNfSearchFormModel();
7855
7824
  await vueDemi.nextTick();
7856
- onResize();
7825
+ refreshLabel();
7857
7826
  cb();
7858
7827
  } catch (e) {
7859
7828
  error();
@@ -7866,7 +7835,7 @@ __sfc_main.setup = (__props, __ctx) => {
7866
7835
  syncCookiesToSearchFormItemOptions();
7867
7836
  refreshNfSearchFormModel();
7868
7837
  await vueDemi.nextTick();
7869
- onResize();
7838
+ refreshLabel();
7870
7839
  };
7871
7840
  return Object.assign({
7872
7841
  defaultButtonSlot,
@@ -7964,7 +7933,7 @@ __sfc_main.setup = (__props, __ctx) => {
7964
7933
  */
7965
7934
  syncCookiesToSearchFormItemOptions,
7966
7935
  onResize,
7967
- visibleChange: onResize
7936
+ visibleChange: refreshLabel
7968
7937
  });
7969
7938
  };
7970
7939
  __sfc_main.components = Object.assign({
@@ -274,34 +274,6 @@ const TimeRange = __component__$4.exports;
274
274
  function createUniqueString(randomLength = 36) {
275
275
  return Number(Math.random().toString().substr(3, randomLength) + Date.now()).toString(36);
276
276
  }
277
- function debounce(func, wait, immediate) {
278
- let timeout, args, context, timestamp, result;
279
- const later = function() {
280
- const last = +/* @__PURE__ */ new Date() - timestamp;
281
- if (last < wait && last > 0) {
282
- timeout = setTimeout(later, wait - last);
283
- } else {
284
- timeout = null;
285
- if (!immediate) {
286
- result = func.apply(context, args);
287
- if (!timeout)
288
- context = args = null;
289
- }
290
- }
291
- };
292
- return function(...args2) {
293
- context = this;
294
- timestamp = +/* @__PURE__ */ new Date();
295
- const callNow = immediate && !timeout;
296
- if (!timeout)
297
- timeout = setTimeout(later, wait);
298
- if (callNow) {
299
- result = func.apply(context, args2);
300
- context = args2 = null;
301
- }
302
- return result;
303
- };
304
- }
305
277
  function deepClone(source) {
306
278
  if (!source && typeof source !== "object") {
307
279
  throw new Error("error arguments shallowClone");
@@ -7725,18 +7697,11 @@ __sfc_main.setup = (__props, __ctx) => {
7725
7697
  const isCollapseChange = async (val) => {
7726
7698
  emit("isCollapseChange", val);
7727
7699
  await nextTick();
7728
- onResize();
7700
+ refreshLabel();
7729
7701
  };
7730
7702
  const domWidth = ref();
7731
7703
  const topDom = ref();
7732
- const onResize = (params = {}) => {
7733
- console.log(params, "resize");
7734
- const {
7735
- width
7736
- } = params || {};
7737
- if (width && domWidth.value && width === domWidth.value) {
7738
- return;
7739
- }
7704
+ const refreshLabel = () => {
7740
7705
  if (props.btnModel === "inline" && !props.btnBoxLabel && props.labelPosition === "top") {
7741
7706
  if (nfSearchFormRef.value.$el.getBoundingClientRect().left === defaultButtonSlot.value.$el.getBoundingClientRect().left) {
7742
7707
  showBtnBoxLabel.value = "";
@@ -7745,13 +7710,21 @@ __sfc_main.setup = (__props, __ctx) => {
7745
7710
  }
7746
7711
  }
7747
7712
  };
7748
- const calcColumns = (params = {}) => {
7713
+ const onResize = async (params = {}) => {
7714
+ var _a2;
7749
7715
  const {
7750
7716
  width
7751
- } = params || {};
7717
+ } = ((_a2 = params == null ? void 0 : params[0]) == null ? void 0 : _a2.contentRect) || {};
7752
7718
  if (width && domWidth.value && width === domWidth.value) {
7753
7719
  return;
7754
7720
  }
7721
+ if (domWidth.value) {
7722
+ await nextTick();
7723
+ domWidth.value = topDom.value.offsetWidth;
7724
+ }
7725
+ refreshLabel();
7726
+ };
7727
+ const calcColumns = () => {
7755
7728
  if (props.columns) {
7756
7729
  newColumns.value = props.columns;
7757
7730
  return;
@@ -7769,19 +7742,15 @@ __sfc_main.setup = (__props, __ctx) => {
7769
7742
  }, 0);
7770
7743
  newColumns.value = count;
7771
7744
  };
7772
- const resizeOpterate = (params) => {
7773
- onResize(params);
7774
- calcColumns(params);
7775
- };
7776
- const debounceResize = debounce(resizeOpterate, 100, false);
7777
7745
  const observer = ref();
7778
7746
  onMounted(async () => {
7779
7747
  await nextTick();
7780
- observer.value = new index(debounceResize);
7748
+ calcColumns();
7749
+ await nextTick();
7750
+ observer.value = new index(onResize);
7781
7751
  observer.value.observe(topDom.value, {
7782
7752
  box: "border-box"
7783
7753
  });
7784
- domWidth.value = topDom.value.offsetWidth;
7785
7754
  });
7786
7755
  onBeforeUnmount(() => {
7787
7756
  var _a2;
@@ -7818,7 +7787,7 @@ __sfc_main.setup = (__props, __ctx) => {
7818
7787
  syncCookiesToSearchFormItemOptions();
7819
7788
  refreshNfSearchFormModel();
7820
7789
  await nextTick();
7821
- onResize();
7790
+ refreshLabel();
7822
7791
  }
7823
7792
  };
7824
7793
  const refreshNfSearchFormModel = async () => {
@@ -7851,7 +7820,7 @@ __sfc_main.setup = (__props, __ctx) => {
7851
7820
  syncCookiesToSearchFormItemOptions();
7852
7821
  refreshNfSearchFormModel();
7853
7822
  await nextTick();
7854
- onResize();
7823
+ refreshLabel();
7855
7824
  cb();
7856
7825
  } catch (e) {
7857
7826
  error();
@@ -7864,7 +7833,7 @@ __sfc_main.setup = (__props, __ctx) => {
7864
7833
  syncCookiesToSearchFormItemOptions();
7865
7834
  refreshNfSearchFormModel();
7866
7835
  await nextTick();
7867
- onResize();
7836
+ refreshLabel();
7868
7837
  };
7869
7838
  return Object.assign({
7870
7839
  defaultButtonSlot,
@@ -7962,7 +7931,7 @@ __sfc_main.setup = (__props, __ctx) => {
7962
7931
  */
7963
7932
  syncCookiesToSearchFormItemOptions,
7964
7933
  onResize,
7965
- visibleChange: onResize
7934
+ visibleChange: refreshLabel
7966
7935
  });
7967
7936
  };
7968
7937
  __sfc_main.components = Object.assign({
@@ -472,8 +472,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
472
472
  columnCheckDrawer: import("vue-demi").Ref<any>;
473
473
  configNfSearchItemVisibleDialog: import("vue-demi").Ref<boolean>;
474
474
  syncCookiesToSearchFormItemOptions: (readCached?: boolean) => void;
475
- onResize: (params?: Record<string, any>) => void;
476
- visibleChange: (params?: Record<string, any>) => void;
475
+ onResize: (params?: Record<string, any>) => Promise<void>;
476
+ visibleChange: () => void;
477
477
  }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
478
478
  onChange: (event: Record<string, any>) => void;
479
479
  itemsChange: (event: string[]) => void;
@@ -816,18 +816,12 @@ onBeforeMount(() => {
816
816
  const isCollapseChange = async (val: boolean) => {
817
817
  emit('isCollapseChange', val)
818
818
  await nextTick()
819
- onResize()
819
+ refreshLabel()
820
820
  }
821
821
 
822
822
  const domWidth = ref()
823
823
  const topDom = ref()
824
-
825
- const onResize = (params: Record<string, any> = {}) => {
826
- console.log(params, 'resize')
827
- const { width } = (params || {})
828
- if (width && domWidth.value && width === domWidth.value) {
829
- return
830
- }
824
+ const refreshLabel = () => {
831
825
  if (props.btnModel === 'inline' && !props.btnBoxLabel && props.labelPosition === 'top') {
832
826
  if (nfSearchFormRef.value.$el.getBoundingClientRect().left === defaultButtonSlot.value.$el.getBoundingClientRect().left) {
833
827
  showBtnBoxLabel.value = ''
@@ -836,12 +830,21 @@ const onResize = (params: Record<string, any> = {}) => {
836
830
  }
837
831
  }
838
832
  }
839
-
840
- const calcColumns = (params: Record<string, any> = {}) => {
841
- const { width } = (params || {})
833
+ const onResize = async (params: Record<string, any> = {}) => {
834
+ const {
835
+ width
836
+ } = (params?.[0]?.contentRect) || {};
842
837
  if (width && domWidth.value && width === domWidth.value) {
843
- return
838
+ return;
844
839
  }
840
+ if (domWidth.value) {
841
+ await nextTick();
842
+ domWidth.value = topDom.value.offsetWidth;
843
+ }
844
+ refreshLabel();
845
+ }
846
+
847
+ const calcColumns = () => {
845
848
  if (props.columns) {
846
849
  newColumns.value = props.columns
847
850
  return
@@ -858,18 +861,14 @@ const calcColumns = (params: Record<string, any> = {}) => {
858
861
  }, 0)
859
862
  newColumns.value = count
860
863
  }
861
- const resizeOpterate = (params) => {
862
- onResize(params)
863
- calcColumns(params)
864
- }
865
864
 
866
- const debounceResize = debounce(resizeOpterate, 100, false)
867
865
  const observer = ref()
868
866
  onMounted(async () => {
869
867
  await nextTick()
870
- observer.value = new ResizeObserver(debounceResize)
868
+ calcColumns()
869
+ await nextTick()
870
+ observer.value = new ResizeObserver(onResize)
871
871
  observer.value.observe(topDom.value, { box: "border-box" });
872
- domWidth.value = topDom.value.offsetWidth;
873
872
  })
874
873
 
875
874
  onBeforeUnmount(() => {
@@ -925,7 +924,7 @@ const hiddenNfSearchFormItemOptionField = async (prop) => {
925
924
  syncCookiesToSearchFormItemOptions()
926
925
  refreshNfSearchFormModel()
927
926
  await nextTick()
928
- onResize()
927
+ refreshLabel()
929
928
  }
930
929
  }
931
930
 
@@ -966,7 +965,7 @@ const columnCheckConfirm = async (cb, error) => {
966
965
  syncCookiesToSearchFormItemOptions()
967
966
  refreshNfSearchFormModel()
968
967
  await nextTick()
969
- onResize()
968
+ refreshLabel()
970
969
  cb()
971
970
  } catch (e) {
972
971
  error()
@@ -983,7 +982,7 @@ const nfSearchFormItemOptionFieldsSave = async (value) => {
983
982
  syncCookiesToSearchFormItemOptions()
984
983
  refreshNfSearchFormModel()
985
984
  await nextTick()
986
- onResize()
985
+ refreshLabel()
987
986
  }
988
987
 
989
988
  defineExpose({
@@ -1060,7 +1059,7 @@ defineExpose({
1060
1059
  */
1061
1060
  syncCookiesToSearchFormItemOptions,
1062
1061
  onResize,
1063
- visibleChange: onResize
1062
+ visibleChange: refreshLabel
1064
1063
  })
1065
1064
 
1066
1065
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-search-form",
3
- "version": "3.2.43",
3
+ "version": "3.2.45",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,20 +14,20 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-action": "^3.2.43",
18
- "@94ai/nf-double-half-year": "^3.2.43",
19
- "@94ai/nf-double-quarter": "^3.2.43",
20
- "@94ai/nf-double-week": "^3.2.43",
21
- "@94ai/nf-double-year": "^3.2.43",
22
- "@94ai/nf-drawer": "^3.2.43",
23
- "@94ai/nf-form": "^3.2.43",
24
- "@94ai/nf-form-item": "^3.2.43",
25
- "@94ai/nf-half-year-picker": "^3.2.43",
26
- "@94ai/nf-message": "^3.2.43",
27
- "@94ai/nf-quarter-picker": "^3.2.43",
28
- "@94ai/nf-select-transfer": "^3.2.43",
29
- "@94ai/nf-theme-chalk": "^3.2.43",
30
- "@94ai/nf-virtual-select": "^3.2.43",
17
+ "@94ai/nf-action": "^3.2.45",
18
+ "@94ai/nf-double-half-year": "^3.2.45",
19
+ "@94ai/nf-double-quarter": "^3.2.45",
20
+ "@94ai/nf-double-week": "^3.2.45",
21
+ "@94ai/nf-double-year": "^3.2.45",
22
+ "@94ai/nf-drawer": "^3.2.45",
23
+ "@94ai/nf-form": "^3.2.45",
24
+ "@94ai/nf-form-item": "^3.2.45",
25
+ "@94ai/nf-half-year-picker": "^3.2.45",
26
+ "@94ai/nf-message": "^3.2.45",
27
+ "@94ai/nf-quarter-picker": "^3.2.45",
28
+ "@94ai/nf-select-transfer": "^3.2.45",
29
+ "@94ai/nf-theme-chalk": "^3.2.45",
30
+ "@94ai/nf-virtual-select": "^3.2.45",
31
31
  "resize-observer-polyfill": "^1.5.1",
32
32
  "vue-cookies": "^1.8.3",
33
33
  "vue-demi": "^0.14.5",
@@ -46,5 +46,5 @@
46
46
  "types": "lib/index.d.ts",
47
47
  "main": "lib/nf-search-form.cjs.js",
48
48
  "module": "lib/nf-search-form.esm-bundler.js",
49
- "gitHead": "97e367dab0bceb94fc5f16c5154a8b5bf744a38b"
49
+ "gitHead": "914d60b4c55cf392326228138bf051eda117ac38"
50
50
  }