@94ai/nf-search-form 100.1.8 → 100.1.15
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 +34 -34
- package/lib/nf-column-check-dialog.vue.d.ts +9 -9
- package/lib/nf-column-check-drawer.vue.d.ts +28 -20
- package/lib/nf-search-form.cjs.js +193 -122
- package/lib/nf-search-form.esm-bundler.js +187 -116
- package/lib/nf-search-form.vue.d.ts +13 -13
- package/package/index.ts +0 -6
- package/package/nf-column-check-dialog.vue +12 -8
- package/package/nf-column-check-drawer.vue +25 -18
- package/package/nf-search-form.vue +143 -100
- package/package.json +18 -18
- package/package/README.md +0 -137
|
@@ -56,16 +56,20 @@ import {
|
|
|
56
56
|
ref
|
|
57
57
|
} from 'vue-demi'
|
|
58
58
|
import { NfSearchFormItemOption } from 'packages/nf-search-form/lib/types'
|
|
59
|
+
import { set as cachedSet } from 'idb-keyval'
|
|
59
60
|
|
|
60
61
|
const props = withDefaults(defineProps<{
|
|
61
62
|
storageKey?: string
|
|
63
|
+
/**
|
|
64
|
+
* 列编辑,是否显示按钮配置表单项显示
|
|
65
|
+
*/
|
|
66
|
+
columnEdit?: boolean,
|
|
62
67
|
show?: boolean,
|
|
63
68
|
title?: string,
|
|
64
69
|
width?: string,
|
|
65
70
|
confirmText?: string
|
|
66
71
|
cancelText?: string
|
|
67
72
|
tableColumns?: NfSearchFormItemOption[],
|
|
68
|
-
showColumns?: string[],
|
|
69
73
|
modalAppendToBody?: boolean,
|
|
70
74
|
modal?: boolean,
|
|
71
75
|
fullscreen?: boolean,
|
|
@@ -80,6 +84,7 @@ const props = withDefaults(defineProps<{
|
|
|
80
84
|
center?: boolean,
|
|
81
85
|
destroyOnClose?: boolean,
|
|
82
86
|
}>(), {
|
|
87
|
+
columnEdit: false,
|
|
83
88
|
storageKey: 'nf-table-columns-cached-key',
|
|
84
89
|
show: false,
|
|
85
90
|
width: '600',
|
|
@@ -87,7 +92,6 @@ const props = withDefaults(defineProps<{
|
|
|
87
92
|
cancelText: '取 消',
|
|
88
93
|
confirmText: '保 存',
|
|
89
94
|
tableColumns: () => [],
|
|
90
|
-
showColumns: () => [],
|
|
91
95
|
modalAppendToBody: true,
|
|
92
96
|
modal: true,
|
|
93
97
|
fullscreen: false,
|
|
@@ -125,7 +129,7 @@ const visible = computed({
|
|
|
125
129
|
*/
|
|
126
130
|
const fields = computed(() => {
|
|
127
131
|
const obj: Record<string, any> = {}
|
|
128
|
-
props.tableColumns.map(item => {
|
|
132
|
+
props.tableColumns.filter(item => !item.destory).map(item => {
|
|
129
133
|
const key = item.category || '基础查询框'
|
|
130
134
|
if (!obj[key]) {
|
|
131
135
|
obj[key] = []
|
|
@@ -150,7 +154,7 @@ onMounted(() => {
|
|
|
150
154
|
})
|
|
151
155
|
const instance = getCurrentInstance()?.proxy
|
|
152
156
|
|
|
153
|
-
const submit = () => {
|
|
157
|
+
const submit = async () => {
|
|
154
158
|
visible.value = false
|
|
155
159
|
const columnState = {}
|
|
156
160
|
props.tableColumns.map((i, index) => {
|
|
@@ -160,16 +164,16 @@ const submit = () => {
|
|
|
160
164
|
index
|
|
161
165
|
}
|
|
162
166
|
})
|
|
163
|
-
|
|
164
|
-
instance?.$cookies?.remove(props.storageKey)
|
|
165
|
-
instance?.$cookies?.set(props.storageKey, JSON.stringify(columnState), -1, '/xxxx/xxxx/xxxx')
|
|
166
167
|
emit('save', tableData.value)
|
|
168
|
+
if (props.columnEdit) {
|
|
169
|
+
await cachedSet(props.storageKey, columnState)
|
|
170
|
+
}
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
const addInitValue = () => {
|
|
170
174
|
const obj: Record<string, any> = {}
|
|
171
175
|
props.tableColumns.forEach(v => {
|
|
172
|
-
obj[v.prop!] =
|
|
176
|
+
obj[v.prop!] = !v.initHidden
|
|
173
177
|
})
|
|
174
178
|
tableData.value = obj
|
|
175
179
|
}
|
|
@@ -138,10 +138,9 @@ import {
|
|
|
138
138
|
computed,
|
|
139
139
|
onBeforeMount,
|
|
140
140
|
getCurrentInstance,
|
|
141
|
-
PropType,
|
|
142
|
-
onMounted
|
|
143
141
|
} from 'vue-demi'
|
|
144
142
|
import { deepClone } from '@94ai/common-utils'
|
|
143
|
+
import { set as cachedSet } from 'idb-keyval'
|
|
145
144
|
|
|
146
145
|
const instance = getCurrentInstance()?.proxy
|
|
147
146
|
|
|
@@ -157,6 +156,10 @@ const props = withDefaults(defineProps<{
|
|
|
157
156
|
noFixedDesc?: string
|
|
158
157
|
getCheckedLengthDesc?: Function
|
|
159
158
|
getAllCheckDesc?: Function
|
|
159
|
+
/**
|
|
160
|
+
* 列编辑,是否显示按钮配置表单项显示
|
|
161
|
+
*/
|
|
162
|
+
columnEdit?: boolean,
|
|
160
163
|
}>(), {
|
|
161
164
|
selectEmptyWarningTips: '请选择至少一个选项',
|
|
162
165
|
tableColumns: () => [],
|
|
@@ -166,7 +169,8 @@ const props = withDefaults(defineProps<{
|
|
|
166
169
|
clearDesc: '清除',
|
|
167
170
|
noFixedDesc: '不固定',
|
|
168
171
|
getCheckedLengthDesc: (length) => '已选(' + length + ')',
|
|
169
|
-
getAllCheckDesc: (length) => '全选(' + length + ')'
|
|
172
|
+
getAllCheckDesc: (length) => '全选(' + length + ')',
|
|
173
|
+
columnEdit: false
|
|
170
174
|
})
|
|
171
175
|
|
|
172
176
|
// 获取当前缓存中的动态数据列
|
|
@@ -182,6 +186,7 @@ const unFixedColumn = ref<Record<string, any>[]>([])
|
|
|
182
186
|
|
|
183
187
|
|
|
184
188
|
onBeforeMount(() => {
|
|
189
|
+
// 混合缓存后数据
|
|
185
190
|
currentTable.value = deepClone(props.tableColumns.filter(item => !item.destory)).sort((a,b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0) as Record<string, any>[]
|
|
186
191
|
// 兼容处理
|
|
187
192
|
currentTable.value.map(i => {
|
|
@@ -189,6 +194,7 @@ onBeforeMount(() => {
|
|
|
189
194
|
i.attr = {}
|
|
190
195
|
}
|
|
191
196
|
})
|
|
197
|
+
// 原始数据
|
|
192
198
|
const list = props.tableColumns.filter(item => !item.destory)
|
|
193
199
|
// 可选列表 → 字段区分
|
|
194
200
|
setFields(list)
|
|
@@ -341,30 +347,31 @@ const handleFixed = (v, prop) => {
|
|
|
341
347
|
/**
|
|
342
348
|
* 确定
|
|
343
349
|
*/
|
|
344
|
-
const syncTableColumnsToCookies = () => {
|
|
350
|
+
const syncTableColumnsToCookies = async () => {
|
|
345
351
|
const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value]
|
|
346
352
|
if (newTableColumns.filter(item => !item.initHidden).length === 0) {
|
|
347
353
|
// @ts-ignore
|
|
348
|
-
instance?.$openMessage
|
|
354
|
+
instance?.$openMessage?.warning({
|
|
349
355
|
message: props.selectEmptyWarningTips,
|
|
350
356
|
duration: 2000,
|
|
351
357
|
})
|
|
352
358
|
throw new Error(props.selectEmptyWarningTips)
|
|
353
359
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
const columnState = {}
|
|
361
|
+
const obj: Record<string, any> = {}
|
|
362
|
+
newTableColumns.map((i, index) => {
|
|
363
|
+
columnState[i.prop] = {
|
|
364
|
+
initHidden: i.initHidden || false,
|
|
365
|
+
fixed: i.attr?.fixed || false,
|
|
366
|
+
prop: i.prop,
|
|
367
|
+
index
|
|
368
|
+
}
|
|
369
|
+
obj[i.prop] = !columnState[i.prop].initHidden
|
|
370
|
+
})
|
|
371
|
+
if (props.columnEdit) {
|
|
372
|
+
await cachedSet(props.storageKey, columnState)
|
|
362
373
|
}
|
|
363
|
-
obj
|
|
364
|
-
})
|
|
365
|
-
instance?.$cookies?.remove(props.storageKey)
|
|
366
|
-
instance?.$cookies?.set(props.storageKey, JSON.stringify(columnState), -1, '/xxxx/xxxx/xxxx')
|
|
367
|
-
return obj
|
|
374
|
+
return obj
|
|
368
375
|
}
|
|
369
376
|
|
|
370
377
|
/**
|
|
@@ -204,7 +204,6 @@
|
|
|
204
204
|
:table-columns="formOptions"
|
|
205
205
|
:title="moreDialogTitle"
|
|
206
206
|
:width="moreDialogWidth"
|
|
207
|
-
:show-columns="localShowItems"
|
|
208
207
|
:modal-append-to-body="modalAppendToBody"
|
|
209
208
|
:modal="modal"
|
|
210
209
|
:fullscreen="fullscreen"
|
|
@@ -245,6 +244,7 @@
|
|
|
245
244
|
<slot slot="title" name="columCheckTitle" />
|
|
246
245
|
<slot slot="footer" name="columCheckFooter" />
|
|
247
246
|
<column-check-drawer
|
|
247
|
+
:column-edit="columnEdit"
|
|
248
248
|
:search-placeholder="columnCheckSearchPlaceholder"
|
|
249
249
|
:fixed-left-desc="columnCheckFixedLeftDesc"
|
|
250
250
|
:clear-desc="columnCheckClearDesc"
|
|
@@ -290,6 +290,12 @@ import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
|
290
290
|
import {
|
|
291
291
|
NfTableColumnAttributes
|
|
292
292
|
} from '@94ai/nf-table/lib/types'
|
|
293
|
+
import { set } from 'vue'
|
|
294
|
+
import {
|
|
295
|
+
del,
|
|
296
|
+
get as cachedGet,
|
|
297
|
+
set as cachedSet
|
|
298
|
+
} from 'idb-keyval'
|
|
293
299
|
|
|
294
300
|
|
|
295
301
|
const props = withDefaults(defineProps<{
|
|
@@ -611,7 +617,9 @@ const initLocalShow = () => {
|
|
|
611
617
|
}
|
|
612
618
|
return !item.initHidden
|
|
613
619
|
}).map(item => item.prop!)
|
|
614
|
-
|
|
620
|
+
nextTick(() => {
|
|
621
|
+
props.formOptions._skip = false
|
|
622
|
+
})
|
|
615
623
|
if (result.length) {
|
|
616
624
|
return result
|
|
617
625
|
}
|
|
@@ -621,12 +629,15 @@ const initLocalShow = () => {
|
|
|
621
629
|
* 表单显示的item集合
|
|
622
630
|
*/
|
|
623
631
|
const localShowItems = ref<string[]>(initLocalShow())
|
|
624
|
-
watch(() => localShowItems.value?.length, () => {
|
|
632
|
+
watch(() => localShowItems.value?.length, async () => {
|
|
625
633
|
emit('update:showItems', localShowItems.value)
|
|
634
|
+
if (Object.keys(nfSearchFormModel.value).length) {
|
|
635
|
+
await refreshNfSearchFormModel(false)
|
|
636
|
+
}
|
|
626
637
|
}, {
|
|
627
638
|
immediate: true
|
|
628
639
|
})
|
|
629
|
-
const syncLocalShowColumnToCookies = () => {
|
|
640
|
+
const syncLocalShowColumnToCookies = async () => {
|
|
630
641
|
if (props.columnEdit) {
|
|
631
642
|
const columnState = {}
|
|
632
643
|
props.formOptions.map((i, index) => {
|
|
@@ -637,25 +648,29 @@ const syncLocalShowColumnToCookies = () => {
|
|
|
637
648
|
index
|
|
638
649
|
}
|
|
639
650
|
})
|
|
640
|
-
|
|
641
|
-
instance?.$cookies?.set(props.storageKey, JSON.stringify(columnState), -1, '/xxxx/xxxx/xxxx')
|
|
651
|
+
await cachedSet(props.storageKey, columnState)
|
|
642
652
|
}
|
|
643
653
|
}
|
|
644
|
-
|
|
654
|
+
|
|
655
|
+
const syncCookiesToLocalShowColumn = async () => {
|
|
645
656
|
if (props.columnEdit) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
if (
|
|
649
|
-
columnState
|
|
650
|
-
|
|
651
|
-
const showColumnItems: string[] = []
|
|
652
|
-
for (const key in columnState as NfTableColumnAttributes) {
|
|
653
|
-
if (!columnState![key].initHidden) {
|
|
654
|
-
showColumnItems.push(columnState![key].prop)
|
|
657
|
+
try {
|
|
658
|
+
let columnState: string | NfTableColumnAttributes | undefined = await cachedGet(props.storageKey)
|
|
659
|
+
if (columnState) {
|
|
660
|
+
if (typeof columnState === 'string') {
|
|
661
|
+
columnState = JSON.parse(columnState)
|
|
655
662
|
}
|
|
663
|
+
const showColumnItems: string[] = []
|
|
664
|
+
for (const key in columnState as NfTableColumnAttributes) {
|
|
665
|
+
if (!columnState![key].initHidden) {
|
|
666
|
+
showColumnItems.push(columnState![key].prop)
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
setLocalShowItems(showColumnItems, true)
|
|
656
670
|
}
|
|
657
|
-
|
|
658
|
-
|
|
671
|
+
} catch (e) {
|
|
672
|
+
console.log(e)
|
|
673
|
+
await del(props.storageKey)
|
|
659
674
|
}
|
|
660
675
|
}
|
|
661
676
|
}
|
|
@@ -669,19 +684,29 @@ const syncShowItemToInitHidden = () => {
|
|
|
669
684
|
item.initHidden = true
|
|
670
685
|
}
|
|
671
686
|
})
|
|
672
|
-
|
|
687
|
+
nextTick(() => {
|
|
688
|
+
props.formOptions._skip = false
|
|
689
|
+
})
|
|
673
690
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
691
|
+
const initCachedData = async () => {
|
|
692
|
+
if (props.columnEdit) {
|
|
693
|
+
// 同步缓存参数
|
|
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)
|
|
704
|
+
}
|
|
682
705
|
}
|
|
683
706
|
}
|
|
684
707
|
|
|
708
|
+
initCachedData()
|
|
709
|
+
|
|
685
710
|
/**
|
|
686
711
|
* 超过数量显示更多
|
|
687
712
|
*/
|
|
@@ -702,36 +727,44 @@ const isShowBtnBoxSlot = computed(() => {
|
|
|
702
727
|
* 转换成最终的表单项渲染数据
|
|
703
728
|
*/
|
|
704
729
|
const renderSearchFormItemOptions = ref<NfSearchFormItemOption[]>([])
|
|
705
|
-
const syncCookiesToSearchFormItemOptions = (readCached = true) => {
|
|
730
|
+
const syncCookiesToSearchFormItemOptions = async (readCached = true) => {
|
|
706
731
|
props.formOptions._skip = true
|
|
707
732
|
const columns = props.formOptions!.map((item, index) => {
|
|
708
733
|
item.key = item.key || createUniqueString()
|
|
709
|
-
item._index = index
|
|
710
|
-
item.__index = index
|
|
734
|
+
item._index = index // 混合缓存后的数据
|
|
735
|
+
item.__index = index // 原始顺序
|
|
736
|
+
set(item, 'initHidden', !!item.initHidden)
|
|
737
|
+
set(item, 'destory', !!item.destory)
|
|
711
738
|
return item
|
|
712
739
|
})
|
|
713
740
|
if (readCached && props.columnEdit) {
|
|
714
741
|
// 读取缓存 Column 配置
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
i.
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
742
|
+
try {
|
|
743
|
+
let columnState: string | NfTableColumnAttributes | undefined = await cachedGet(props.storageKey)
|
|
744
|
+
props.formOptions._skip = true
|
|
745
|
+
if (columnState) {
|
|
746
|
+
if (typeof columnState === 'string') {
|
|
747
|
+
columnState = JSON.parse(columnState)
|
|
748
|
+
}
|
|
749
|
+
for (const key in columnState as NfTableColumnAttributes) {
|
|
750
|
+
const state = columnState![key]
|
|
751
|
+
columns.every(i => {
|
|
752
|
+
if (i.prop === key) {
|
|
753
|
+
i.initHidden = state.initHidden
|
|
754
|
+
i._index = state.index
|
|
755
|
+
return false
|
|
756
|
+
}
|
|
757
|
+
return true
|
|
758
|
+
})
|
|
759
|
+
}
|
|
730
760
|
}
|
|
761
|
+
} catch (e) {
|
|
762
|
+
console.log(e)
|
|
731
763
|
}
|
|
732
764
|
}
|
|
733
|
-
|
|
765
|
+
await nextTick()
|
|
734
766
|
props.formOptions._skip = false
|
|
767
|
+
renderSearchFormItemOptions.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
|
|
735
768
|
}
|
|
736
769
|
syncCookiesToSearchFormItemOptions()
|
|
737
770
|
|
|
@@ -740,10 +773,7 @@ syncCookiesToSearchFormItemOptions()
|
|
|
740
773
|
* @param prop
|
|
741
774
|
*/
|
|
742
775
|
const itemIsShow = (item: NfSearchFormItemOption) => {
|
|
743
|
-
|
|
744
|
-
return !item.initHidden && !item.destory
|
|
745
|
-
}
|
|
746
|
-
return localShowItems.value.includes(item.prop!) && !item.initHidden && !item.destory
|
|
776
|
+
return !item.initHidden && !item.destory
|
|
747
777
|
}
|
|
748
778
|
|
|
749
779
|
|
|
@@ -768,6 +798,14 @@ watch(() => {
|
|
|
768
798
|
immediate: true
|
|
769
799
|
})
|
|
770
800
|
|
|
801
|
+
const setLocalShowItems = (list, syncToInitHidden = false) => {
|
|
802
|
+
if (JSON.stringify(list.sort()) !== JSON.stringify(localShowItems.value.sort())) {
|
|
803
|
+
localShowItems.value = list
|
|
804
|
+
if (syncToInitHidden) {
|
|
805
|
+
syncShowItemToInitHidden()
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
771
809
|
|
|
772
810
|
/**
|
|
773
811
|
* 初始化formData表单数据
|
|
@@ -783,29 +821,43 @@ onBeforeMount(() => {
|
|
|
783
821
|
*/
|
|
784
822
|
watch(() => {
|
|
785
823
|
return props.formOptions
|
|
786
|
-
}, () => {
|
|
824
|
+
}, async () => {
|
|
787
825
|
if (props.formOptions._skip) {
|
|
788
826
|
return
|
|
789
827
|
}
|
|
790
|
-
|
|
828
|
+
setLocalShowItems(initLocalShow())
|
|
829
|
+
await syncCookiesToSearchFormItemOptions(false)
|
|
791
830
|
}, {
|
|
792
831
|
deep: true
|
|
793
832
|
})
|
|
833
|
+
refreshNfSearchFormModel(false, true)
|
|
834
|
+
})
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
const refreshNfSearchFormModel = async (outEmit = true, init = false) => {
|
|
794
838
|
const obj: Record<string, any> = {}
|
|
795
|
-
props.formOptions.forEach(v => {
|
|
796
|
-
if (v.
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
839
|
+
props.formOptions.filter(item => !item.destory).forEach(v => {
|
|
840
|
+
if (localShowItems.value.includes(v.prop)) {
|
|
841
|
+
if (init) {
|
|
842
|
+
if (v.initValue !== undefined) {
|
|
843
|
+
obj[v.prop!] = v.initValue
|
|
844
|
+
} else {
|
|
845
|
+
obj[v.prop!] = undefined
|
|
846
|
+
}
|
|
847
|
+
} else {
|
|
848
|
+
obj[v.prop!] = nfSearchFormModel.value[v.prop]
|
|
849
|
+
}
|
|
800
850
|
}
|
|
801
851
|
})
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
852
|
+
if (JSON.stringify(nfSearchFormModel.value) !== JSON.stringify(obj)) {
|
|
853
|
+
nfSearchFormModel.value = obj
|
|
854
|
+
if (outEmit) {
|
|
855
|
+
emit('onChange', nfSearchFormModel.value)
|
|
856
|
+
await nextTick()
|
|
857
|
+
emit('itemsChange', localShowItems.value)
|
|
805
858
|
}
|
|
806
859
|
}
|
|
807
|
-
|
|
808
|
-
})
|
|
860
|
+
}
|
|
809
861
|
|
|
810
862
|
const isCollapseChange = async (val: boolean) => {
|
|
811
863
|
emit('isCollapseChange', val)
|
|
@@ -827,15 +879,15 @@ const refreshLabel = () => {
|
|
|
827
879
|
const onResize = async (params: Record<string, any> = {}) => {
|
|
828
880
|
const {
|
|
829
881
|
width
|
|
830
|
-
} = (params?.[0]?.contentRect) || {}
|
|
882
|
+
} = (params?.[0]?.contentRect) || {}
|
|
831
883
|
if (width && domWidth.value && width === domWidth.value) {
|
|
832
|
-
return
|
|
884
|
+
return
|
|
833
885
|
}
|
|
834
886
|
if (domWidth.value) {
|
|
835
|
-
await nextTick()
|
|
836
|
-
domWidth.value = topDom.value.offsetWidth
|
|
887
|
+
await nextTick()
|
|
888
|
+
domWidth.value = topDom.value.offsetWidth
|
|
837
889
|
}
|
|
838
|
-
refreshLabel()
|
|
890
|
+
refreshLabel()
|
|
839
891
|
}
|
|
840
892
|
|
|
841
893
|
const calcColumns = () => {
|
|
@@ -862,7 +914,7 @@ onMounted(async () => {
|
|
|
862
914
|
calcColumns()
|
|
863
915
|
await nextTick()
|
|
864
916
|
observer.value = new ResizeObserver(onResize)
|
|
865
|
-
observer.value.observe(topDom.value, { box:
|
|
917
|
+
observer.value.observe(topDom.value, { box: 'border-box' })
|
|
866
918
|
})
|
|
867
919
|
|
|
868
920
|
onBeforeUnmount(() => {
|
|
@@ -910,31 +962,23 @@ const onNfSearchFormExport = () => {
|
|
|
910
962
|
* @param prop
|
|
911
963
|
*/
|
|
912
964
|
const hiddenNfSearchFormItemOptionField = async (prop) => {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
syncCookiesToSearchFormItemOptions()
|
|
919
|
-
refreshNfSearchFormModel()
|
|
920
|
-
await nextTick()
|
|
921
|
-
refreshLabel()
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* 更新item对应的formData
|
|
927
|
-
* @param prop
|
|
928
|
-
*/
|
|
929
|
-
const refreshNfSearchFormModel = async () => {
|
|
930
|
-
for (const key in nfSearchFormModel.value) {
|
|
931
|
-
if (!localShowItems.value.includes(key)) {
|
|
932
|
-
delete nfSearchFormModel.value[key]
|
|
965
|
+
prop.formOptions._skip = true
|
|
966
|
+
prop.formOptions.every(item => {
|
|
967
|
+
if (item.prop === prop) {
|
|
968
|
+
item.initHidden = true
|
|
969
|
+
return false
|
|
933
970
|
}
|
|
934
|
-
|
|
935
|
-
|
|
971
|
+
return true
|
|
972
|
+
})
|
|
973
|
+
nextTick(() => {
|
|
974
|
+
props.formOptions._skip = false
|
|
975
|
+
})
|
|
976
|
+
localShowItems.value = prop.formOptions.filter(item => !item.initHidden).map(item => item.prop)
|
|
977
|
+
await syncLocalShowColumnToCookies()
|
|
978
|
+
await syncCookiesToSearchFormItemOptions()
|
|
979
|
+
await refreshNfSearchFormModel()
|
|
936
980
|
await nextTick()
|
|
937
|
-
|
|
981
|
+
refreshLabel()
|
|
938
982
|
}
|
|
939
983
|
|
|
940
984
|
const columnCheckConfirmFeedback = (value: Record<string, any>) => {
|
|
@@ -945,19 +989,18 @@ const columnCheckConfirmFeedback = (value: Record<string, any>) => {
|
|
|
945
989
|
itemsList.push(key)
|
|
946
990
|
}
|
|
947
991
|
}
|
|
948
|
-
|
|
949
|
-
syncShowItemToInitHidden()
|
|
992
|
+
setLocalShowItems(itemsList, true)
|
|
950
993
|
}
|
|
951
994
|
}
|
|
952
995
|
|
|
953
996
|
// 抽屉确定
|
|
954
997
|
const columnCheckConfirm = async (cb, error) => {
|
|
955
998
|
try {
|
|
956
|
-
const value = columnCheckDrawer.value.syncTableColumnsToCookies()
|
|
999
|
+
const value = await columnCheckDrawer.value.syncTableColumnsToCookies()
|
|
957
1000
|
columnCheckConfirmFeedback(value)
|
|
958
|
-
syncCookiesToLocalShowColumn()
|
|
959
|
-
syncCookiesToSearchFormItemOptions()
|
|
960
|
-
refreshNfSearchFormModel()
|
|
1001
|
+
await syncCookiesToLocalShowColumn()
|
|
1002
|
+
await syncCookiesToSearchFormItemOptions()
|
|
1003
|
+
await refreshNfSearchFormModel()
|
|
961
1004
|
await nextTick()
|
|
962
1005
|
refreshLabel()
|
|
963
1006
|
cb()
|
|
@@ -972,9 +1015,9 @@ const columnCheckConfirm = async (cb, error) => {
|
|
|
972
1015
|
*/
|
|
973
1016
|
const nfSearchFormItemOptionFieldsSave = async (value) => {
|
|
974
1017
|
columnCheckConfirmFeedback(value)
|
|
975
|
-
syncCookiesToLocalShowColumn()
|
|
976
|
-
syncCookiesToSearchFormItemOptions()
|
|
977
|
-
refreshNfSearchFormModel()
|
|
1018
|
+
await syncCookiesToLocalShowColumn()
|
|
1019
|
+
await syncCookiesToSearchFormItemOptions()
|
|
1020
|
+
await refreshNfSearchFormModel()
|
|
978
1021
|
await nextTick()
|
|
979
1022
|
refreshLabel()
|
|
980
1023
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-search-form",
|
|
3
|
-
"version": "100.1.
|
|
3
|
+
"version": "100.1.15",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^100.1.
|
|
18
|
-
"@94ai/nf-action": "^100.1.
|
|
19
|
-
"@94ai/nf-double-half-year": "^100.1.
|
|
20
|
-
"@94ai/nf-double-quarter": "^100.1.
|
|
21
|
-
"@94ai/nf-double-week": "^100.1.
|
|
22
|
-
"@94ai/nf-double-year": "^100.1.
|
|
23
|
-
"@94ai/nf-drawer": "^100.1.
|
|
24
|
-
"@94ai/nf-form": "^100.1.
|
|
25
|
-
"@94ai/nf-form-item": "^100.1.
|
|
26
|
-
"@94ai/nf-half-year-picker": "^100.1.
|
|
27
|
-
"@94ai/nf-message": "^100.1.
|
|
28
|
-
"@94ai/nf-quarter-picker": "^100.1.
|
|
29
|
-
"@94ai/nf-select-transfer": "^100.1.
|
|
30
|
-
"@94ai/nf-theme-chalk": "^100.1.
|
|
31
|
-
"@94ai/nf-virtual-select": "^100.1.
|
|
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",
|
|
32
|
+
"idb-keyval": "^6.2.1",
|
|
32
33
|
"resize-observer-polyfill": "^1.5.1",
|
|
33
|
-
"vue-cookies": "^1.8.3",
|
|
34
34
|
"vue-demi": "^0.14.5",
|
|
35
35
|
"vuedraggable": "^2.24.3"
|
|
36
36
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"types": "lib/index.d.ts",
|
|
48
48
|
"main": "lib/nf-search-form.cjs.js",
|
|
49
49
|
"module": "lib/nf-search-form.esm-bundler.js",
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "8cbd9254da4ec43f46b29198c0839bf2ba19132d"
|
|
51
51
|
}
|