@94ai/nf-search-form 3.2.40 → 3.2.43
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 +4 -4
- package/lib/nf-search-form.cjs.js +554 -36
- package/lib/nf-search-form.esm-bundler.js +555 -37
- package/lib/nf-search-form.vue.d.ts +2 -2
- package/package/nf-search-form.vue +28 -14
- package/package.json +17 -16
|
@@ -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: () => void;
|
|
476
|
-
visibleChange: () => void;
|
|
475
|
+
onResize: (params?: Record<string, any>) => void;
|
|
476
|
+
visibleChange: (params?: Record<string, any>) => 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="nf-search-form">
|
|
2
|
+
<div class="nf-search-form" ref="topDom">
|
|
3
3
|
<nf-form ref="nfSearchFormRef"
|
|
4
4
|
:model="nfSearchFormModel"
|
|
5
5
|
:inline="inline"
|
|
@@ -273,6 +273,7 @@ export default defineComponent({
|
|
|
273
273
|
import SearchFormItem from './nf-search-form-item.vue'
|
|
274
274
|
import ColumnCheckDialog from './nf-column-check-dialog.vue'
|
|
275
275
|
import ColumnCheckDrawer from './nf-column-check-drawer.vue'
|
|
276
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
276
277
|
|
|
277
278
|
import {
|
|
278
279
|
createUniqueString,
|
|
@@ -286,6 +287,7 @@ import {
|
|
|
286
287
|
watch,
|
|
287
288
|
onBeforeMount,
|
|
288
289
|
onMounted,
|
|
290
|
+
onBeforeUnmount,
|
|
289
291
|
onUnmounted,
|
|
290
292
|
nextTick
|
|
291
293
|
} from 'vue-demi'
|
|
@@ -817,18 +819,29 @@ const isCollapseChange = async (val: boolean) => {
|
|
|
817
819
|
onResize()
|
|
818
820
|
}
|
|
819
821
|
|
|
822
|
+
const domWidth = ref()
|
|
823
|
+
const topDom = ref()
|
|
820
824
|
|
|
821
|
-
const onResize = () => {
|
|
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
|
+
}
|
|
822
831
|
if (props.btnModel === 'inline' && !props.btnBoxLabel && props.labelPosition === 'top') {
|
|
823
832
|
if (nfSearchFormRef.value.$el.getBoundingClientRect().left === defaultButtonSlot.value.$el.getBoundingClientRect().left) {
|
|
824
833
|
showBtnBoxLabel.value = ''
|
|
825
834
|
} else {
|
|
826
|
-
showBtnBoxLabel.value = '
|
|
835
|
+
showBtnBoxLabel.value = '.'
|
|
827
836
|
}
|
|
828
837
|
}
|
|
829
838
|
}
|
|
830
839
|
|
|
831
|
-
const calcColumns = () => {
|
|
840
|
+
const calcColumns = (params: Record<string, any> = {}) => {
|
|
841
|
+
const { width } = (params || {})
|
|
842
|
+
if (width && domWidth.value && width === domWidth.value) {
|
|
843
|
+
return
|
|
844
|
+
}
|
|
832
845
|
if (props.columns) {
|
|
833
846
|
newColumns.value = props.columns
|
|
834
847
|
return
|
|
@@ -845,21 +858,22 @@ const calcColumns = () => {
|
|
|
845
858
|
}, 0)
|
|
846
859
|
newColumns.value = count
|
|
847
860
|
}
|
|
861
|
+
const resizeOpterate = (params) => {
|
|
862
|
+
onResize(params)
|
|
863
|
+
calcColumns(params)
|
|
864
|
+
}
|
|
848
865
|
|
|
849
|
-
const debounceResize = debounce(
|
|
850
|
-
const
|
|
851
|
-
|
|
866
|
+
const debounceResize = debounce(resizeOpterate, 100, false)
|
|
867
|
+
const observer = ref()
|
|
852
868
|
onMounted(async () => {
|
|
853
|
-
window.addEventListener('resize', debounceResize)
|
|
854
|
-
window.addEventListener('resize', debounceCalcColumns)
|
|
855
869
|
await nextTick()
|
|
856
|
-
|
|
857
|
-
|
|
870
|
+
observer.value = new ResizeObserver(debounceResize)
|
|
871
|
+
observer.value.observe(topDom.value, { box: "border-box" });
|
|
872
|
+
domWidth.value = topDom.value.offsetWidth;
|
|
858
873
|
})
|
|
859
874
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
window.removeEventListener('resize', debounceCalcColumns)
|
|
875
|
+
onBeforeUnmount(() => {
|
|
876
|
+
observer.value?.unobserve(topDom.value)
|
|
863
877
|
})
|
|
864
878
|
|
|
865
879
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-search-form",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.43",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,20 +14,21 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-action": "^3.2.
|
|
18
|
-
"@94ai/nf-double-half-year": "^3.2.
|
|
19
|
-
"@94ai/nf-double-quarter": "^3.2.
|
|
20
|
-
"@94ai/nf-double-week": "^3.2.
|
|
21
|
-
"@94ai/nf-double-year": "^3.2.
|
|
22
|
-
"@94ai/nf-drawer": "^3.2.
|
|
23
|
-
"@94ai/nf-form": "^3.2.
|
|
24
|
-
"@94ai/nf-form-item": "^3.2.
|
|
25
|
-
"@94ai/nf-half-year-picker": "^3.2.
|
|
26
|
-
"@94ai/nf-message": "^3.2.
|
|
27
|
-
"@94ai/nf-quarter-picker": "^3.2.
|
|
28
|
-
"@94ai/nf-select-transfer": "^3.2.
|
|
29
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
30
|
-
"@94ai/nf-virtual-select": "^3.2.
|
|
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",
|
|
31
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
31
32
|
"vue-cookies": "^1.8.3",
|
|
32
33
|
"vue-demi": "^0.14.5",
|
|
33
34
|
"vuedraggable": "^2.24.3"
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"types": "lib/index.d.ts",
|
|
46
47
|
"main": "lib/nf-search-form.cjs.js",
|
|
47
48
|
"module": "lib/nf-search-form.esm-bundler.js",
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "97e367dab0bceb94fc5f16c5154a8b5bf744a38b"
|
|
49
50
|
}
|