@94ai/nf-search-form 8.3.23 → 10.0.0
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 +2922 -0
- package/lib/nf-column-check-dialog.vue.d.ts +3 -3
- package/lib/nf-search-form.cjs.js +139 -185
- package/lib/nf-search-form.esm-bundler.js +140 -186
- package/lib/nf-search-form.vue.d.ts +648 -0
- package/lib/nf-time-range.vue.d.ts +4 -10
- package/lib/types.d.ts +17 -0
- package/package/nf-column-check-drawer.vue +9 -38
- package/package/nf-number-range.vue +1 -5
- package/package/nf-search-form-item.vue +25 -24
- package/package/nf-search-form.vue +112 -151
- package/package/nf-time-range.vue +8 -8
- package/package/types.ts +18 -0
- package/package.json +24 -24
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
:down-icon="downIcon"
|
|
30
30
|
:show-btn="showBtn"
|
|
31
31
|
:is-collapse="isCollapse"
|
|
32
|
-
:expand-btn-tooltip-desc="expandBtnTooltipDesc"
|
|
33
|
-
:shrink-btn-tooltip-desc="shrinkBtnTooltipDesc"
|
|
32
|
+
:expand-btn-tooltip-desc="localeText.expandBtnTooltipDesc"
|
|
33
|
+
:shrink-btn-tooltip-desc="localeText.shrinkBtnTooltipDesc"
|
|
34
34
|
@isCollapseChange="isCollapseChange"
|
|
35
35
|
>
|
|
36
36
|
<template
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
onNfSearchFormSearch(true);
|
|
106
106
|
onNfSearchFormClick(item);
|
|
107
107
|
}"
|
|
108
|
-
>{{ resolveValue(item.name || queryBtnText, nfSearchFormModel) }}
|
|
108
|
+
>{{ resolveValue(item.name || localeText.queryBtnText, nfSearchFormModel) }}
|
|
109
109
|
</nf-button>
|
|
110
110
|
<nf-button
|
|
111
111
|
v-else-if="item.btnType?.includes('export')"
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
onNfSearchFormExport();
|
|
124
124
|
onNfSearchFormClick(item);
|
|
125
125
|
}"
|
|
126
|
-
>{{ resolveValue(item.name || exportBtnText, nfSearchFormModel) }}
|
|
126
|
+
>{{ resolveValue(item.name || localeText.exportBtnText, nfSearchFormModel) }}
|
|
127
127
|
</nf-button>
|
|
128
128
|
<nf-button
|
|
129
129
|
v-else-if="item.btnType?.includes('reset')"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
:disabled="resolveValue(resetBtnDisabled, nfSearchFormModel)"
|
|
139
139
|
:class="(resolveValue(resetBtnClass, nfSearchFormModel) || '') + ' nf-btn-reset'"
|
|
140
140
|
@click="resetNfSearchFormModel"
|
|
141
|
-
>{{ resolveValue(item.name || resetBtnText, nfSearchFormModel) }}
|
|
141
|
+
>{{ resolveValue(item.name || localeText.resetBtnText, nfSearchFormModel) }}
|
|
142
142
|
</nf-button>
|
|
143
143
|
<nf-button
|
|
144
144
|
v-else-if="btnIsShow(item)"
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
v-if="columnEdit"
|
|
170
170
|
@click="configNfSearchItemVisibleDialog = true"
|
|
171
171
|
>
|
|
172
|
-
<el-tooltip :content="moreDialogTitle" placement="top">
|
|
172
|
+
<el-tooltip :content="localeText.moreDialogTitle" placement="top">
|
|
173
173
|
<span class="icon-wrap"><i class="iconfont icon-shaixuan1 nf-fs12"></i></span>
|
|
174
174
|
</el-tooltip>
|
|
175
175
|
</nf-button>
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
:disabled="resolveValue(queryBtnDisabled, nfSearchFormModel)"
|
|
194
194
|
:class="(resolveValue(queryBtnClass, nfSearchFormModel) || '') + ' nf-btn-search'"
|
|
195
195
|
@click="onNfSearchFormSearch(true)"
|
|
196
|
-
>{{ resolveValue(queryBtnText, nfSearchFormModel) }}
|
|
196
|
+
>{{ resolveValue(localeText.queryBtnText, nfSearchFormModel) }}
|
|
197
197
|
</nf-button>
|
|
198
198
|
<nf-button
|
|
199
199
|
v-else-if="item.btnType?.includes('export')"
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
:disabled="resolveValue(exportBtnDisabled, nfSearchFormModel)"
|
|
209
209
|
:class="(resolveValue(exportBtnClass, nfSearchFormModel) || '') + ' nf-btn-export'"
|
|
210
210
|
@click="onNfSearchFormExport"
|
|
211
|
-
>{{ resolveValue(exportBtnText, nfSearchFormModel) }}
|
|
211
|
+
>{{ resolveValue(localeText.exportBtnText, nfSearchFormModel) }}
|
|
212
212
|
</nf-button>
|
|
213
213
|
<nf-button
|
|
214
214
|
v-else-if="item.btnType?.includes('reset')"
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
:disabled="resolveValue(resetBtnDisabled, nfSearchFormModel)"
|
|
224
224
|
:class="(resolveValue(resetBtnClass, nfSearchFormModel) || '') + ' nf-btn-reset'"
|
|
225
225
|
@click="resetNfSearchFormModel"
|
|
226
|
-
>{{ resolveValue(resetBtnText, nfSearchFormModel) }}
|
|
226
|
+
>{{ resolveValue(localeText.resetBtnText, nfSearchFormModel) }}
|
|
227
227
|
</nf-button>
|
|
228
228
|
<nf-button
|
|
229
229
|
v-else-if="btnIsShow(item)"
|
|
@@ -252,17 +252,17 @@
|
|
|
252
252
|
@click="configNfSearchItemVisibleDialog = true"
|
|
253
253
|
:class="(checkBtnClass || '') + ' nf-btn-check'"
|
|
254
254
|
>
|
|
255
|
-
<el-tooltip :content="moreDialogTitle" placement="top" v-if="columnEdit">
|
|
255
|
+
<el-tooltip :content="localeText.moreDialogTitle" placement="top" v-if="columnEdit">
|
|
256
256
|
<span class="icon-wrap"><i class="iconfont icon-shaixuan1 nf-fs12"></i></span>
|
|
257
257
|
</el-tooltip>
|
|
258
258
|
</nf-button>
|
|
259
259
|
<slot v-if="isShowBtnBoxSlot && reverseBtnSlot" name="btnBox" />
|
|
260
260
|
</div>
|
|
261
261
|
<column-check-dialog
|
|
262
|
-
:title="moreDialogTitle"
|
|
263
|
-
:cancel-text="columnCheckCancelButtonText"
|
|
264
|
-
:confirm-text="columnCheckConfirmButtonText"
|
|
265
|
-
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
262
|
+
:title="localeText.moreDialogTitle"
|
|
263
|
+
:cancel-text="localeText.columnCheckCancelButtonText"
|
|
264
|
+
:confirm-text="localeText.columnCheckConfirmButtonText"
|
|
265
|
+
:basic-field-desc="localeText.columnCheckBasicFieldDesc"
|
|
266
266
|
|
|
267
267
|
ref="columnCheckDialog"
|
|
268
268
|
v-if="columnEdit && configNfSearchItemVisibleDialog && checkMode === 'dialog'"
|
|
@@ -293,9 +293,9 @@
|
|
|
293
293
|
<slot slot="footer" name="dialogFooter"></slot>
|
|
294
294
|
</column-check-dialog>
|
|
295
295
|
<nf-drawer
|
|
296
|
-
:title="moreDialogTitle"
|
|
297
|
-
:cancel-button-text="columnCheckCancelButtonText"
|
|
298
|
-
:confirm-button-text="columnCheckConfirmButtonText"
|
|
296
|
+
:title="localeText.moreDialogTitle"
|
|
297
|
+
:cancel-button-text="localeText.columnCheckCancelButtonText"
|
|
298
|
+
:confirm-button-text="localeText.columnCheckConfirmButtonText"
|
|
299
299
|
|
|
300
300
|
ref="columnCheckNfDrawer"
|
|
301
301
|
size="680px"
|
|
@@ -311,14 +311,14 @@
|
|
|
311
311
|
<slot slot="title" name="columCheckTitle" />
|
|
312
312
|
<slot slot="footer" name="columCheckFooter" />
|
|
313
313
|
<column-check-drawer
|
|
314
|
-
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
315
|
-
:search-placeholder="columnCheckSearchPlaceholder"
|
|
316
|
-
:fixed-left-desc="columnCheckFixedLeftDesc"
|
|
317
|
-
:clear-desc="columnCheckClearDesc"
|
|
318
|
-
:no-fixed-desc="columnCheckNoFixedDesc"
|
|
319
|
-
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
320
|
-
:get-checked-length-desc="columnCheckGetCheckedLengthDesc"
|
|
321
|
-
:get-all-check-desc="columnCheckGetAllCheckDesc"
|
|
314
|
+
:basic-field-desc="localeText.columnCheckBasicFieldDesc"
|
|
315
|
+
:search-placeholder="localeText.columnCheckSearchPlaceholder"
|
|
316
|
+
:fixed-left-desc="localeText.columnCheckFixedLeftDesc"
|
|
317
|
+
:clear-desc="localeText.columnCheckClearDesc"
|
|
318
|
+
:no-fixed-desc="localeText.columnCheckNoFixedDesc"
|
|
319
|
+
:select-empty-warning-tips="localeText.selectEmptyWarningTips"
|
|
320
|
+
:get-checked-length-desc="localeText.columnCheckGetCheckedLengthDesc"
|
|
321
|
+
:get-all-check-desc="localeText.columnCheckGetAllCheckDesc"
|
|
322
322
|
|
|
323
323
|
ref="columnCheckDrawer"
|
|
324
324
|
:storage-key="cStorageKey"
|
|
@@ -343,7 +343,7 @@ import SearchFormItem from './nf-search-form-item.vue'
|
|
|
343
343
|
import ColumnCheckDialog from './nf-column-check-dialog.vue'
|
|
344
344
|
import ColumnCheckDrawer from './nf-column-check-drawer.vue'
|
|
345
345
|
import ResizeObserver from 'resize-observer-polyfill'
|
|
346
|
-
import { NfSearchFormItemOption } from './types'
|
|
346
|
+
import { IBtnItems, NfSearchFormItemOption } from './types'
|
|
347
347
|
import {
|
|
348
348
|
ref,
|
|
349
349
|
computed,
|
|
@@ -364,32 +364,13 @@ import {
|
|
|
364
364
|
createUniqueString,
|
|
365
365
|
validate as useValidate,
|
|
366
366
|
mapDispose,
|
|
367
|
-
resolveValue
|
|
367
|
+
resolveValue,
|
|
368
|
+
useLocale
|
|
368
369
|
} from '@94ai/common-utils'
|
|
369
|
-
import {
|
|
370
|
-
throttle
|
|
371
|
-
} from 'lodash-es'
|
|
372
370
|
import { useRoute } from 'vue-router/composables'
|
|
373
371
|
import { ELEMENT_LABEL_TYPE_DEFAULT_VALUE, EXCHANGE_KEY_TYPE } from '@94ai/common-constants'
|
|
374
372
|
import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
375
373
|
|
|
376
|
-
interface IBtnItems {
|
|
377
|
-
btnType?: 'search' | 'export' | 'reset'
|
|
378
|
-
name?: string,
|
|
379
|
-
type?: string,
|
|
380
|
-
icon?: string,
|
|
381
|
-
plain?: boolean,
|
|
382
|
-
size?: string,
|
|
383
|
-
round?: boolean,
|
|
384
|
-
circle?: boolean,
|
|
385
|
-
loading?: boolean,
|
|
386
|
-
disabled?: boolean,
|
|
387
|
-
class?: string,
|
|
388
|
-
validate?: boolean,
|
|
389
|
-
onClick?: (formData: Record<string, any>) => void,
|
|
390
|
-
show?: boolean | ((formData: Record<string, any>) => boolean),
|
|
391
|
-
[key: string]: any,
|
|
392
|
-
}
|
|
393
374
|
|
|
394
375
|
const props = withDefaults(defineProps<{
|
|
395
376
|
viewIdentity?: string,
|
|
@@ -646,23 +627,7 @@ const props = withDefaults(defineProps<{
|
|
|
646
627
|
beforeClose: undefined,
|
|
647
628
|
center: false,
|
|
648
629
|
destroyOnClose: false,
|
|
649
|
-
|
|
650
|
-
shrinkBtnTooltipDesc: '收起',
|
|
651
|
-
exportBtnText: '导出',
|
|
652
|
-
resetBtnText: '重置',
|
|
653
|
-
queryBtnText: '查询',
|
|
654
|
-
selectEmptyWarningTips: '请选择至少一个选项',
|
|
655
|
-
columnCheckCancelButtonText: '取消',
|
|
656
|
-
columnCheckConfirmButtonText: '确定',
|
|
657
|
-
moreDialogTitle: '设置显示查询框',
|
|
658
|
-
columnDisplayBtnText: '添加筛选条件',
|
|
659
|
-
columnCheckSearchPlaceholder: '搜索',
|
|
660
|
-
columnCheckFixedLeftDesc: '固定在左侧',
|
|
661
|
-
columnCheckClearDesc: '清除',
|
|
662
|
-
columnCheckNoFixedDesc: '不固定',
|
|
663
|
-
columnCheckBasicFieldDesc: '基础字段',
|
|
664
|
-
columnCheckGetCheckedLengthDesc: (length) => (length) => '已选(' + length + ')',
|
|
665
|
-
columnCheckGetAllCheckDesc: (length) => (length) => '全选(' + length + ')'
|
|
630
|
+
columnDisplayBtnText: '添加筛选条件'
|
|
666
631
|
})
|
|
667
632
|
|
|
668
633
|
const emit = defineEmits<{
|
|
@@ -709,6 +674,27 @@ const emit = defineEmits<{
|
|
|
709
674
|
}>()
|
|
710
675
|
const routeName = computed(() => useRoute().name)
|
|
711
676
|
const instance = getCurrentInstance()?.proxy
|
|
677
|
+
|
|
678
|
+
// 文案:显式传入的 prop 优先,否则取内置语言包(跟随 vue-i18n 语言或 locale.use 指定的语言)
|
|
679
|
+
const { t } = useLocale()
|
|
680
|
+
const localeText = computed(() => ({
|
|
681
|
+
expandBtnTooltipDesc: props.expandBtnTooltipDesc || t('nf.common.expand'),
|
|
682
|
+
shrinkBtnTooltipDesc: props.shrinkBtnTooltipDesc || t('nf.common.collapse'),
|
|
683
|
+
exportBtnText: props.exportBtnText || t('nf.searchForm.export'),
|
|
684
|
+
resetBtnText: props.resetBtnText || t('nf.searchForm.reset'),
|
|
685
|
+
queryBtnText: props.queryBtnText || t('nf.searchForm.query'),
|
|
686
|
+
selectEmptyWarningTips: props.selectEmptyWarningTips || t('nf.table.selectEmptyWarning'),
|
|
687
|
+
columnCheckCancelButtonText: props.columnCheckCancelButtonText || t('nf.common.cancel'),
|
|
688
|
+
columnCheckConfirmButtonText: props.columnCheckConfirmButtonText || t('nf.common.confirm'),
|
|
689
|
+
moreDialogTitle: props.moreDialogTitle || t('nf.searchForm.moreDialogTitle'),
|
|
690
|
+
columnCheckSearchPlaceholder: props.columnCheckSearchPlaceholder || t('nf.table.searchPlaceholder'),
|
|
691
|
+
columnCheckFixedLeftDesc: props.columnCheckFixedLeftDesc || t('nf.table.fixedLeft'),
|
|
692
|
+
columnCheckClearDesc: props.columnCheckClearDesc || t('nf.table.clear'),
|
|
693
|
+
columnCheckNoFixedDesc: props.columnCheckNoFixedDesc || t('nf.table.noFixed'),
|
|
694
|
+
columnCheckBasicFieldDesc: props.columnCheckBasicFieldDesc || t('nf.table.basicField'),
|
|
695
|
+
columnCheckGetCheckedLengthDesc: props.columnCheckGetCheckedLengthDesc || ((length) => t('nf.table.checkedLength', { length })),
|
|
696
|
+
columnCheckGetAllCheckDesc: props.columnCheckGetAllCheckDesc || ((length) => t('nf.table.allCheck', { length }))
|
|
697
|
+
}))
|
|
712
698
|
const defaultButtonSlot = ref()
|
|
713
699
|
const nfSearchFormRef = ref()
|
|
714
700
|
const columnCheckNfDrawer = ref()
|
|
@@ -729,9 +715,6 @@ const cStorageKey = computed(() => {
|
|
|
729
715
|
return key
|
|
730
716
|
})
|
|
731
717
|
|
|
732
|
-
const cStorageKeyViewIdentity = computed(() => {
|
|
733
|
-
return 'nf-search-form-view-identity'
|
|
734
|
-
})
|
|
735
718
|
|
|
736
719
|
|
|
737
720
|
const processedColumns = computed(() => {
|
|
@@ -746,48 +729,48 @@ const processedColumns = computed(() => {
|
|
|
746
729
|
})
|
|
747
730
|
|
|
748
731
|
const checkViewIdentityChange = async () => {
|
|
749
|
-
const userId = (window as any).userId
|
|
750
|
-
const viewField = (window as any).viewField
|
|
751
|
-
if (props.viewIdentity && userId && viewField) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
732
|
+
// const userId = (window as any).userId
|
|
733
|
+
// const viewField = (window as any).viewField
|
|
734
|
+
// if (props.viewIdentity && userId && viewField) {
|
|
735
|
+
// let viewIdentity = CachedManager.syncCachedGet(cStorageKeyViewIdentity.value)
|
|
736
|
+
// if (!viewIdentity) {
|
|
737
|
+
// viewIdentity = await CachedManager.asyncCachedGet(cStorageKeyViewIdentity.value)
|
|
738
|
+
// }
|
|
739
|
+
// if (!viewIdentity) {
|
|
740
|
+
// await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewField)
|
|
741
|
+
// } else {
|
|
742
|
+
// const newViewIdentity = viewField.find(item => item.viewIdentity === props.viewIdentity)
|
|
743
|
+
// const oldViewIdentity = viewIdentity.find(item => item.viewIdentity === props.viewIdentity)
|
|
744
|
+
// if ((newViewIdentity && !oldViewIdentity) || (!newViewIdentity && oldViewIdentity)) {
|
|
745
|
+
// await clearColumnEditCached()
|
|
746
|
+
// await clearDragCached()
|
|
747
|
+
// } else if (newViewIdentity && oldViewIdentity) {
|
|
748
|
+
// let change = false
|
|
749
|
+
// newViewIdentity.fieldList.every(item => {
|
|
750
|
+
// if (!oldViewIdentity.fieldList.includes(item)) {
|
|
751
|
+
// change = true
|
|
752
|
+
// return
|
|
753
|
+
// }
|
|
754
|
+
// return true
|
|
755
|
+
// })
|
|
756
|
+
// if (!change) {
|
|
757
|
+
// oldViewIdentity.fieldList.every(item => {
|
|
758
|
+
// if (!newViewIdentity.fieldList.includes(item)) {
|
|
759
|
+
// change = true
|
|
760
|
+
// return
|
|
761
|
+
// }
|
|
762
|
+
// return true
|
|
763
|
+
// })
|
|
764
|
+
// }
|
|
765
|
+
// if (change) {
|
|
766
|
+
// await clearColumnEditCached()
|
|
767
|
+
// await clearDragCached()
|
|
768
|
+
// oldViewIdentity.fieldList = newViewIdentity.fieldList
|
|
769
|
+
// await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewIdentity)
|
|
770
|
+
// }
|
|
771
|
+
// }
|
|
772
|
+
// }
|
|
773
|
+
// }
|
|
791
774
|
}
|
|
792
775
|
|
|
793
776
|
/**
|
|
@@ -795,11 +778,6 @@ const checkViewIdentityChange = async () => {
|
|
|
795
778
|
*/
|
|
796
779
|
const nfSearchFormModel = ref<Record<string, any>>(deepClone(props.defaultFormData))
|
|
797
780
|
|
|
798
|
-
// 获取value
|
|
799
|
-
const getValue = (item) => {
|
|
800
|
-
return mapDispose.getValue(nfSearchFormModel.value, item.prop)
|
|
801
|
-
}
|
|
802
|
-
|
|
803
781
|
// 设置值
|
|
804
782
|
const setValue = (item, val) => {
|
|
805
783
|
mapDispose.setValue(nfSearchFormModel.value, item.prop, val)
|
|
@@ -866,9 +844,7 @@ const btnItemsInit = () => {
|
|
|
866
844
|
let list = deepClone(props.btnItems)
|
|
867
845
|
// string类型
|
|
868
846
|
if (useValidate.isString(props.btnItems)) {
|
|
869
|
-
list = [
|
|
870
|
-
...(props.btnItems ? [{ btnType: props.btnItems }] : [])
|
|
871
|
-
]
|
|
847
|
+
list = [{ btnType: props.btnItems }]
|
|
872
848
|
}
|
|
873
849
|
list = list.map(item => {
|
|
874
850
|
if (useValidate.isString(item)) {
|
|
@@ -1061,17 +1037,28 @@ const handleColumnsInitHideAndSort = async(columns: any[]) => {
|
|
|
1061
1037
|
if (typeof columnState === 'string') {
|
|
1062
1038
|
columnState = JSON.parse(columnState)
|
|
1063
1039
|
}
|
|
1040
|
+
let maxIndex = 0
|
|
1064
1041
|
for (const key in columnState as NfTableColumnAttributes) {
|
|
1065
1042
|
const state = columnState![key]
|
|
1066
1043
|
columns.every(i => {
|
|
1067
1044
|
if (i.prop === key) {
|
|
1068
1045
|
i.initHidden = state.initHidden
|
|
1069
1046
|
i._index = state.index
|
|
1047
|
+
if (maxIndex < state.index) {
|
|
1048
|
+
maxIndex = state.index
|
|
1049
|
+
}
|
|
1070
1050
|
return false
|
|
1071
1051
|
}
|
|
1072
1052
|
return true
|
|
1073
1053
|
})
|
|
1074
1054
|
}
|
|
1055
|
+
const columnStateKeys = Object.keys(columnState)
|
|
1056
|
+
columns.forEach(item => {
|
|
1057
|
+
if (!columnStateKeys.includes(item.prop)) {
|
|
1058
|
+
maxIndex++
|
|
1059
|
+
item._index = maxIndex
|
|
1060
|
+
}
|
|
1061
|
+
})
|
|
1075
1062
|
}
|
|
1076
1063
|
} catch (e) {
|
|
1077
1064
|
console.log(e)
|
|
@@ -1181,10 +1168,10 @@ onBeforeMount(() => {
|
|
|
1181
1168
|
* 剔除隐藏筛选项字段 | 刷新表单数据
|
|
1182
1169
|
* @description 未勾选的筛选项,给予undefined;已勾选的若初次展示,设置默认值
|
|
1183
1170
|
*/
|
|
1184
|
-
|
|
1171
|
+
function refreshNfSearchFormModel() {
|
|
1185
1172
|
processedColumns.value.filter(item => !resolveValue(item.destory, nfSearchFormModel.value)).forEach(v => {
|
|
1186
1173
|
if (!localShowItems.value.includes(v.prop)) {
|
|
1187
|
-
mapDispose.setValue(nfSearchFormModel.value, v.
|
|
1174
|
+
mapDispose.setValue(nfSearchFormModel.value, v.prop, undefined)
|
|
1188
1175
|
} else if (nfSearchFormModel.value[v.prop] === undefined) {
|
|
1189
1176
|
setDefaultVal(v)
|
|
1190
1177
|
}
|
|
@@ -1210,7 +1197,6 @@ const isCollapseChange = async (val: boolean) => {
|
|
|
1210
1197
|
refreshLabel()
|
|
1211
1198
|
}
|
|
1212
1199
|
|
|
1213
|
-
const domWidth = ref()
|
|
1214
1200
|
const topDom = ref()
|
|
1215
1201
|
const refreshLabel = () => {
|
|
1216
1202
|
if (props.btnModel === 'inline' && !props.btnBoxLabel && props.labelPosition === 'top') {
|
|
@@ -1246,25 +1232,14 @@ const calcColumns = () => {
|
|
|
1246
1232
|
newColumns.value = count
|
|
1247
1233
|
}
|
|
1248
1234
|
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
const onResize = async (params: Record<string, any> = {}) => {
|
|
1252
|
-
const {
|
|
1253
|
-
width
|
|
1254
|
-
} = (params?.[0]?.contentRect) || {}
|
|
1255
|
-
if (width && domWidth.value && width === domWidth.value) {
|
|
1256
|
-
return
|
|
1257
|
-
}
|
|
1258
|
-
if (domWidth.value) {
|
|
1259
|
-
await nextTick()
|
|
1260
|
-
domWidth.value = topDom.value.offsetWidth
|
|
1261
|
-
}
|
|
1235
|
+
const onResize = async (_params?: Record<string, any>) => {
|
|
1262
1236
|
refreshLabel()
|
|
1263
1237
|
}
|
|
1264
1238
|
|
|
1265
1239
|
const observer = ref()
|
|
1266
1240
|
onMounted(async () => {
|
|
1267
1241
|
await nextTick()
|
|
1242
|
+
if (!topDom.value) return
|
|
1268
1243
|
observer.value = new ResizeObserver(onResize)
|
|
1269
1244
|
observer.value.observe(topDom.value, { box: 'border-box' })
|
|
1270
1245
|
})
|
|
@@ -1323,11 +1298,11 @@ const onNfSearchFormClick = (item) => {
|
|
|
1323
1298
|
}
|
|
1324
1299
|
|
|
1325
1300
|
/**
|
|
1326
|
-
* 把该item
|
|
1301
|
+
* 把该item暂时隐藏
|
|
1327
1302
|
* @param prop
|
|
1328
1303
|
*/
|
|
1329
1304
|
const hiddenNfSearchFormItemOptionField = async (prop) => {
|
|
1330
|
-
|
|
1305
|
+
props.formOptions._skip = true
|
|
1331
1306
|
processedColumns.value.every(item => {
|
|
1332
1307
|
if (item.prop === prop) {
|
|
1333
1308
|
item.initHidden = true
|
|
@@ -1346,23 +1321,10 @@ const hiddenNfSearchFormItemOptionField = async (prop) => {
|
|
|
1346
1321
|
refreshLabel()
|
|
1347
1322
|
}
|
|
1348
1323
|
|
|
1349
|
-
const columnCheckConfirmFeedback = (value: Record<string, any>) => {
|
|
1350
|
-
if (!props.columnEdit) {
|
|
1351
|
-
const itemsList: string[] = []
|
|
1352
|
-
for (const key in value) {
|
|
1353
|
-
if (value[key]) {
|
|
1354
|
-
itemsList.push(key)
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
setLocalShowItems(itemsList, true)
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
1324
|
// 抽屉确定
|
|
1362
1325
|
const columnCheckConfirm = async (cb, error) => {
|
|
1363
1326
|
try {
|
|
1364
|
-
|
|
1365
|
-
columnCheckConfirmFeedback(value)
|
|
1327
|
+
columnCheckDrawer.value.syncTableColumnsToCookies()
|
|
1366
1328
|
await syncCookiesToLocalShowColumn(true)
|
|
1367
1329
|
await syncCookiesToSearchFormItemOptions()
|
|
1368
1330
|
await nextTick()
|
|
@@ -1386,8 +1348,7 @@ async function clearColumnEditCached() {
|
|
|
1386
1348
|
/**
|
|
1387
1349
|
* 保存表单显示的字段
|
|
1388
1350
|
*/
|
|
1389
|
-
const nfSearchFormItemOptionFieldsSave = async (
|
|
1390
|
-
columnCheckConfirmFeedback(value)
|
|
1351
|
+
const nfSearchFormItemOptionFieldsSave = async () => {
|
|
1391
1352
|
await syncCookiesToLocalShowColumn(true)
|
|
1392
1353
|
await syncCookiesToSearchFormItemOptions()
|
|
1393
1354
|
await nextTick()
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<el-time-select
|
|
4
4
|
v-model="startTime"
|
|
5
5
|
v-bind="inputAttrStart"
|
|
6
|
-
:placeholder="startPlaceholder"
|
|
6
|
+
:placeholder="startPlaceholder || t('nf.common.startTime')"
|
|
7
7
|
class="nf-time-range-el-time-select"
|
|
8
8
|
v-on="inputlistens"
|
|
9
9
|
/>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<el-time-select
|
|
12
12
|
v-model="endTime"
|
|
13
13
|
v-bind="inputAttrEnd"
|
|
14
|
-
:placeholder="endPlaceholder"
|
|
14
|
+
:placeholder="endPlaceholder || t('nf.common.endTime')"
|
|
15
15
|
class="nf-time-range-el-time-select"
|
|
16
16
|
v-on="inputlistens"
|
|
17
17
|
/>
|
|
@@ -35,15 +35,15 @@ import {
|
|
|
35
35
|
ref,
|
|
36
36
|
watch
|
|
37
37
|
} from 'vue-demi'
|
|
38
|
+
import { useLocale } from '@94ai/common-utils'
|
|
38
39
|
|
|
40
|
+
const { t } = useLocale()
|
|
39
41
|
const props = withDefaults(defineProps<{
|
|
40
42
|
value?: string[],
|
|
41
|
-
endPlaceholder
|
|
42
|
-
startPlaceholder
|
|
43
|
+
endPlaceholder?: string
|
|
44
|
+
startPlaceholder?: string
|
|
43
45
|
}>(), {
|
|
44
|
-
value: () => []
|
|
45
|
-
endPlaceholder: '结束时间',
|
|
46
|
-
startPlaceholder: '开始时间'
|
|
46
|
+
value: () => []
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
const emit = defineEmits<{
|
|
@@ -73,7 +73,7 @@ const inputAttrStart = computed(() => {
|
|
|
73
73
|
delete attrs?.type
|
|
74
74
|
const pickerOptions = attrs?.['picker-options'] || {}
|
|
75
75
|
return {
|
|
76
|
-
...
|
|
76
|
+
...attrs,
|
|
77
77
|
'picker-options': {
|
|
78
78
|
...pickerOptions
|
|
79
79
|
}
|
package/package/types.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export interface IBtnItems {
|
|
2
|
+
btnType?: 'search' | 'export' | 'reset'
|
|
3
|
+
name?: string,
|
|
4
|
+
type?: string,
|
|
5
|
+
icon?: string,
|
|
6
|
+
plain?: boolean,
|
|
7
|
+
size?: string,
|
|
8
|
+
round?: boolean,
|
|
9
|
+
circle?: boolean,
|
|
10
|
+
loading?: boolean,
|
|
11
|
+
disabled?: boolean,
|
|
12
|
+
class?: string,
|
|
13
|
+
validate?: boolean,
|
|
14
|
+
onClick?: (formData: Record<string, any>) => void,
|
|
15
|
+
show?: boolean | ((formData: Record<string, any>) => boolean),
|
|
16
|
+
[key: string]: any,
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
interface IExchangeKey {
|
|
2
20
|
type: number,
|
|
3
21
|
value?: any
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-search-form",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -11,31 +11,32 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "http://94ai.
|
|
14
|
+
"url": "http://gitlab.94ai.pro/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-constants": "^
|
|
18
|
-
"@94ai/common-utils": "^
|
|
19
|
-
"@94ai/nf-button": "^
|
|
20
|
-
"@94ai/nf-double-half-year": "^
|
|
21
|
-
"@94ai/nf-double-quarter": "^
|
|
22
|
-
"@94ai/nf-double-week": "^
|
|
23
|
-
"@94ai/nf-double-year": "^
|
|
24
|
-
"@94ai/nf-drawer": "^
|
|
25
|
-
"@94ai/nf-form": "^
|
|
26
|
-
"@94ai/nf-form-item": "^
|
|
27
|
-
"@94ai/nf-half-year-picker": "^
|
|
28
|
-
"@94ai/nf-lazy-select": "^
|
|
29
|
-
"@94ai/nf-message": "^
|
|
30
|
-
"@94ai/nf-quarter-picker": "^
|
|
31
|
-
"@94ai/nf-theme-chalk": "^
|
|
32
|
-
"@94ai/nf-transfer-select": "^
|
|
33
|
-
"@94ai/nf-virtual-select": "^
|
|
17
|
+
"@94ai/common-constants": "^10.0.0",
|
|
18
|
+
"@94ai/common-utils": "^10.0.0",
|
|
19
|
+
"@94ai/nf-button": "^10.0.0",
|
|
20
|
+
"@94ai/nf-double-half-year": "^10.0.0",
|
|
21
|
+
"@94ai/nf-double-quarter": "^10.0.0",
|
|
22
|
+
"@94ai/nf-double-week": "^10.0.0",
|
|
23
|
+
"@94ai/nf-double-year": "^10.0.0",
|
|
24
|
+
"@94ai/nf-drawer": "^10.0.0",
|
|
25
|
+
"@94ai/nf-form": "^10.0.0",
|
|
26
|
+
"@94ai/nf-form-item": "^10.0.0",
|
|
27
|
+
"@94ai/nf-half-year-picker": "^10.0.0",
|
|
28
|
+
"@94ai/nf-lazy-select": "^10.0.0",
|
|
29
|
+
"@94ai/nf-message": "^10.0.0",
|
|
30
|
+
"@94ai/nf-quarter-picker": "^10.0.0",
|
|
31
|
+
"@94ai/nf-theme-chalk": "^10.0.0",
|
|
32
|
+
"@94ai/nf-transfer-select": "^10.0.0",
|
|
33
|
+
"@94ai/nf-virtual-select": "^10.0.0",
|
|
34
34
|
"idb-keyval": "^6.2.1",
|
|
35
35
|
"resize-observer-polyfill": "^1.5.1",
|
|
36
36
|
"vue-demi": "^0.14.5",
|
|
37
37
|
"vue-router": "3.6.4",
|
|
38
|
-
"vuedraggable": "^2.24.3"
|
|
38
|
+
"vuedraggable": "^2.24.3",
|
|
39
|
+
"@94ai/vue2-runtime-helpers": "1.0.1"
|
|
39
40
|
},
|
|
40
41
|
"peerDependenciesMeta": {
|
|
41
42
|
"@vue/composition-api": {
|
|
@@ -44,11 +45,10 @@
|
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@vue/composition-api": "^1.0.0-rc.1",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
48
|
+
"vue": "^2.0.0 || >=3.0.0",
|
|
49
|
+
"element-ui": ">=2.13.2"
|
|
49
50
|
},
|
|
50
51
|
"types": "lib/index.d.ts",
|
|
51
52
|
"main": "lib/nf-search-form.cjs.js",
|
|
52
|
-
"module": "lib/nf-search-form.esm-bundler.js"
|
|
53
|
-
"gitHead": "74e871c7972dc4576480bee02b1dc61a3eafc6ba"
|
|
53
|
+
"module": "lib/nf-search-form.esm-bundler.js"
|
|
54
54
|
}
|