@94ai/nf-table 3.2.56 → 3.2.57
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 +68 -97
- package/lib/nf-column-check-dialog.vue.d.ts +9 -0
- package/lib/nf-column-check-drawer.vue.d.ts +12 -12
- package/lib/nf-table.cjs.js +98 -105
- package/lib/nf-table.esm-bundler.js +98 -105
- package/lib/nf-table.vue.d.ts +24 -36
- package/package/nf-column-check-dialog.vue +6 -1
- package/package/nf-column-check-drawer.vue +17 -14
- package/package/nf-table.vue +70 -57
- package/package.json +8 -8
package/lib/nf-table.vue.d.ts
CHANGED
|
@@ -49,10 +49,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
49
49
|
type: import("vue-demi").PropType<string[]>;
|
|
50
50
|
default: undefined;
|
|
51
51
|
};
|
|
52
|
-
emptyImageSize: {
|
|
53
|
-
type: import("vue-demi").PropType<number>;
|
|
54
|
-
default: number;
|
|
55
|
-
};
|
|
56
52
|
searchFormAttrs: {
|
|
57
53
|
type: import("vue-demi").PropType<NfSearchFormAttributes>;
|
|
58
54
|
default: () => {};
|
|
@@ -81,6 +77,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
81
77
|
type: import("vue-demi").PropType<NfTableActionBtnAttributes[]>;
|
|
82
78
|
default: () => never[];
|
|
83
79
|
};
|
|
80
|
+
dragCached: {
|
|
81
|
+
type: import("vue-demi").PropType<boolean>;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
emptyImageSize: {
|
|
85
|
+
type: import("vue-demi").PropType<number>;
|
|
86
|
+
default: number;
|
|
87
|
+
};
|
|
84
88
|
calHeight: {
|
|
85
89
|
type: import("vue-demi").PropType<boolean>;
|
|
86
90
|
default: boolean;
|
|
@@ -153,15 +157,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
153
157
|
type: import("vue-demi").PropType<string>;
|
|
154
158
|
default: string;
|
|
155
159
|
};
|
|
156
|
-
|
|
157
|
-
type: import("vue-demi").PropType<string>;
|
|
158
|
-
default: string;
|
|
159
|
-
};
|
|
160
|
-
columnCheckConfirmText: {
|
|
160
|
+
columnCheckBasicFieldDesc: {
|
|
161
161
|
type: import("vue-demi").PropType<string>;
|
|
162
162
|
default: string;
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
columnCheckWidth: {
|
|
165
165
|
type: import("vue-demi").PropType<string>;
|
|
166
166
|
default: string;
|
|
167
167
|
};
|
|
@@ -233,10 +233,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
233
233
|
type: import("vue-demi").PropType<string>;
|
|
234
234
|
default: string;
|
|
235
235
|
};
|
|
236
|
-
columnCheckBasicFieldDesc: {
|
|
237
|
-
type: import("vue-demi").PropType<string>;
|
|
238
|
-
default: string;
|
|
239
|
-
};
|
|
240
236
|
columnCheckGetCheckedLengthDesc: {
|
|
241
237
|
type: import("vue-demi").PropType<Function>;
|
|
242
238
|
default: (length: any) => string;
|
|
@@ -346,7 +342,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
346
342
|
calcTableHeight: () => void;
|
|
347
343
|
syncLocalShowColumnToCookies: () => void;
|
|
348
344
|
syncCookiesToLocalShowColumn: () => Promise<void>;
|
|
349
|
-
syncCookiesToTableColumn: (readCached?: boolean) => Promise<void>;
|
|
345
|
+
syncCookiesToTableColumn: (readCached?: boolean, init?: boolean) => Promise<void>;
|
|
350
346
|
elTableRefKey: import("vue-demi").Ref<number>;
|
|
351
347
|
}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
352
348
|
fieldsChange: (event: string[]) => void;
|
|
@@ -400,10 +396,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
400
396
|
type: import("vue-demi").PropType<string[]>;
|
|
401
397
|
default: undefined;
|
|
402
398
|
};
|
|
403
|
-
emptyImageSize: {
|
|
404
|
-
type: import("vue-demi").PropType<number>;
|
|
405
|
-
default: number;
|
|
406
|
-
};
|
|
407
399
|
searchFormAttrs: {
|
|
408
400
|
type: import("vue-demi").PropType<NfSearchFormAttributes>;
|
|
409
401
|
default: () => {};
|
|
@@ -432,6 +424,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
432
424
|
type: import("vue-demi").PropType<NfTableActionBtnAttributes[]>;
|
|
433
425
|
default: () => never[];
|
|
434
426
|
};
|
|
427
|
+
dragCached: {
|
|
428
|
+
type: import("vue-demi").PropType<boolean>;
|
|
429
|
+
default: boolean;
|
|
430
|
+
};
|
|
431
|
+
emptyImageSize: {
|
|
432
|
+
type: import("vue-demi").PropType<number>;
|
|
433
|
+
default: number;
|
|
434
|
+
};
|
|
435
435
|
calHeight: {
|
|
436
436
|
type: import("vue-demi").PropType<boolean>;
|
|
437
437
|
default: boolean;
|
|
@@ -504,15 +504,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
504
504
|
type: import("vue-demi").PropType<string>;
|
|
505
505
|
default: string;
|
|
506
506
|
};
|
|
507
|
-
|
|
508
|
-
type: import("vue-demi").PropType<string>;
|
|
509
|
-
default: string;
|
|
510
|
-
};
|
|
511
|
-
columnCheckConfirmText: {
|
|
507
|
+
columnCheckBasicFieldDesc: {
|
|
512
508
|
type: import("vue-demi").PropType<string>;
|
|
513
509
|
default: string;
|
|
514
510
|
};
|
|
515
|
-
|
|
511
|
+
columnCheckWidth: {
|
|
516
512
|
type: import("vue-demi").PropType<string>;
|
|
517
513
|
default: string;
|
|
518
514
|
};
|
|
@@ -584,10 +580,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
584
580
|
type: import("vue-demi").PropType<string>;
|
|
585
581
|
default: string;
|
|
586
582
|
};
|
|
587
|
-
columnCheckBasicFieldDesc: {
|
|
588
|
-
type: import("vue-demi").PropType<string>;
|
|
589
|
-
default: string;
|
|
590
|
-
};
|
|
591
583
|
columnCheckGetCheckedLengthDesc: {
|
|
592
584
|
type: import("vue-demi").PropType<Function>;
|
|
593
585
|
default: (length: any) => string;
|
|
@@ -635,7 +627,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
635
627
|
text: string;
|
|
636
628
|
selectEmptyWarningTips: string;
|
|
637
629
|
showColumn: string[];
|
|
638
|
-
emptyImageSize: number;
|
|
639
630
|
searchFormAttrs: NfSearchFormAttributes;
|
|
640
631
|
searchFormEvents: Partial<Record<NfSearchFormEventKey, Function>>;
|
|
641
632
|
tableAttrs: ElTableAttributes;
|
|
@@ -643,6 +634,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
643
634
|
pageAttrs: ElPaginationAttributes;
|
|
644
635
|
pageEvents: Partial<Record<ElPaginationEventKey, Function>>;
|
|
645
636
|
actionBarOptList: NfTableActionBtnAttributes[];
|
|
637
|
+
dragCached: boolean;
|
|
638
|
+
emptyImageSize: number;
|
|
646
639
|
calHeight: boolean;
|
|
647
640
|
columnPosition: 'free' | 'embed';
|
|
648
641
|
checkMode: 'dialog' | 'drawer';
|
|
@@ -661,9 +654,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
661
654
|
columnCheckTitle: string;
|
|
662
655
|
columnCheckCancelButtonText: string;
|
|
663
656
|
columnCheckConfirmButtonText: string;
|
|
657
|
+
columnCheckBasicFieldDesc: string;
|
|
664
658
|
columnCheckWidth: string;
|
|
665
|
-
columnCheckConfirmText: string;
|
|
666
|
-
columnCheckCancelText: string;
|
|
667
659
|
columnCheckModalAppendToBody: boolean;
|
|
668
660
|
columnCheckModal: boolean;
|
|
669
661
|
columnCheckFullscreen: boolean;
|
|
@@ -681,7 +673,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
681
673
|
columnCheckFixedLeftDesc: string;
|
|
682
674
|
columnCheckClearDesc: string;
|
|
683
675
|
columnCheckNoFixedDesc: string;
|
|
684
|
-
columnCheckBasicFieldDesc: string;
|
|
685
676
|
columnCheckGetCheckedLengthDesc: Function;
|
|
686
677
|
columnCheckGetAllCheckDesc: Function;
|
|
687
678
|
loading: boolean;
|
|
@@ -693,9 +684,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
693
684
|
slot: any;
|
|
694
685
|
}) => any>> & Partial<Record<any, (_: {
|
|
695
686
|
slot: any;
|
|
696
|
-
}) => any>> & Partial<Record<any, (_: {
|
|
697
|
-
row: any;
|
|
698
|
-
index: any;
|
|
699
687
|
}) => any>> & Partial<Record<any, (_: {}) => any>> & Partial<Record<any, (_: {
|
|
700
688
|
$index: any;
|
|
701
689
|
column: any;
|
|
@@ -74,6 +74,7 @@ const props = withDefaults(defineProps<{
|
|
|
74
74
|
width?: string,
|
|
75
75
|
confirmText?: string
|
|
76
76
|
cancelText?: string
|
|
77
|
+
basicFieldDesc?: string
|
|
77
78
|
tableColumns?: Record<string, any>[],
|
|
78
79
|
modalAppendToBody?: boolean,
|
|
79
80
|
modal?: boolean,
|
|
@@ -95,6 +96,10 @@ const props = withDefaults(defineProps<{
|
|
|
95
96
|
show: false,
|
|
96
97
|
width: '600px',
|
|
97
98
|
title: '设置显示字段',
|
|
99
|
+
/**
|
|
100
|
+
* 默认category分类标题
|
|
101
|
+
*/
|
|
102
|
+
basicFieldDesc: '基础字段',
|
|
98
103
|
cancelText: '取 消',
|
|
99
104
|
confirmText: '保 存',
|
|
100
105
|
tableColumns: () => [],
|
|
@@ -139,7 +144,7 @@ const fields = computed(() => {
|
|
|
139
144
|
const obj: Record<string, any> = {}
|
|
140
145
|
props.tableColumns.filter(item => !item.destory).map(item => {
|
|
141
146
|
if (!item.type) {
|
|
142
|
-
const key = item.category ||
|
|
147
|
+
const key = item.category || props.basicFieldDesc
|
|
143
148
|
if (!obj[key]) {
|
|
144
149
|
obj[key] = []
|
|
145
150
|
}
|
|
@@ -145,35 +145,38 @@ const instance = getCurrentInstance()?.proxy
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
const props = withDefaults(defineProps<{
|
|
148
|
-
selectEmptyWarningTips?: string,
|
|
149
|
-
// 源序列
|
|
150
|
-
tableColumns?: Record<string, any>[],
|
|
151
|
-
storageKey?: string
|
|
152
|
-
operationPropKey?: string
|
|
153
|
-
/**
|
|
154
|
-
* 列编辑显示开关
|
|
155
|
-
*/
|
|
156
|
-
columnEdit?: boolean,
|
|
157
148
|
searchPlaceholder?: string
|
|
158
149
|
fixedLeftDesc?: string
|
|
159
150
|
clearDesc?: string
|
|
160
151
|
noFixedDesc?: string
|
|
152
|
+
/**
|
|
153
|
+
* 默认category分类标题
|
|
154
|
+
*/
|
|
161
155
|
basicFieldDesc?: string
|
|
156
|
+
selectEmptyWarningTips?: string
|
|
162
157
|
getCheckedLengthDesc?: Function
|
|
163
158
|
getAllCheckDesc?: Function
|
|
159
|
+
/**
|
|
160
|
+
* 列编辑显示开关
|
|
161
|
+
*/
|
|
162
|
+
columnEdit?: boolean,
|
|
163
|
+
// 源序列
|
|
164
|
+
tableColumns?: Record<string, any>[],
|
|
165
|
+
storageKey?: string
|
|
166
|
+
operationPropKey?: string
|
|
164
167
|
}>(), {
|
|
165
|
-
columnEdit: false,
|
|
166
168
|
selectEmptyWarningTips: '请选择至少一个选项',
|
|
167
|
-
tableColumns: () => [],
|
|
168
|
-
storageKey: 'nf-table-columns-cached-key',
|
|
169
|
-
operationPropKey: 'operation',
|
|
170
169
|
searchPlaceholder: '搜索',
|
|
171
170
|
fixedLeftDesc: '固定在左侧',
|
|
172
171
|
clearDesc: '清除',
|
|
173
172
|
noFixedDesc: '不固定',
|
|
174
173
|
basicFieldDesc: '基础字段',
|
|
175
174
|
getCheckedLengthDesc: (length) => '已选(' + length + ')',
|
|
176
|
-
getAllCheckDesc: (length) => '全选(' + length + ')'
|
|
175
|
+
getAllCheckDesc: (length) => '全选(' + length + ')',
|
|
176
|
+
tableColumns: () => [],
|
|
177
|
+
columnEdit: false,
|
|
178
|
+
storageKey: 'nf-table-columns-cached-key',
|
|
179
|
+
operationPropKey: 'operation',
|
|
177
180
|
})
|
|
178
181
|
|
|
179
182
|
// 获取当前缓存中的动态数据列
|
package/package/nf-table.vue
CHANGED
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
ref="nfSearchFormRef"
|
|
6
6
|
v-bind="searchFormAttrs"
|
|
7
7
|
v-on="searchFormEvents"
|
|
8
|
-
:operation-prop-key="operationPropKey"
|
|
9
|
-
:storage-key="searchFormStorageKey"
|
|
10
|
-
:property="priority"
|
|
11
|
-
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
12
8
|
>
|
|
13
9
|
<template v-for="item in (nfSearchFormRef?.renderSearchFormItemOptions || [])">
|
|
14
10
|
<!-- 定制化SearchItem?提示-->
|
|
@@ -53,20 +49,13 @@
|
|
|
53
49
|
>
|
|
54
50
|
<template v-for="column in tableColumns">
|
|
55
51
|
<template v-if="isShow(column)">
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<span v-else>{{ scope.row[column.prop] }}</span>
|
|
64
|
-
</template>
|
|
65
|
-
</template>
|
|
66
|
-
</el-table-column>
|
|
67
|
-
<el-table-column :key="column.key || column.prop" :type="column.type" :label="column.label" v-bind="column.attr"
|
|
68
|
-
v-else />
|
|
69
|
-
</template>
|
|
52
|
+
<el-table-column
|
|
53
|
+
v-if="column.type"
|
|
54
|
+
:key="column.key || column.prop || column.type"
|
|
55
|
+
:type="column.type"
|
|
56
|
+
:label="column.label"
|
|
57
|
+
v-bind="column.attr"
|
|
58
|
+
/>
|
|
70
59
|
<template v-else>
|
|
71
60
|
<el-table-column
|
|
72
61
|
v-if="column.attr&&column.attr.formatter"
|
|
@@ -465,16 +454,16 @@
|
|
|
465
454
|
</div>
|
|
466
455
|
</div>
|
|
467
456
|
<column-check-dialog
|
|
468
|
-
|
|
457
|
+
:title="columnCheckTitle"
|
|
458
|
+
:confirm-text="columnCheckConfirmButtonText"
|
|
459
|
+
:cancel-text="columnCheckCancelButtonText"
|
|
460
|
+
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
461
|
+
|
|
469
462
|
:show.sync="nfColumCheckDialogVisible"
|
|
470
463
|
:table-columns="columns"
|
|
471
464
|
:column-edit="columnEdit"
|
|
472
465
|
:storage-key="storageKey"
|
|
473
|
-
@save="fieldsConfirm"
|
|
474
|
-
:title="columnCheckTitle"
|
|
475
466
|
:width="columnCheckWidth"
|
|
476
|
-
:confirm-text="columnCheckConfirmText"
|
|
477
|
-
:cancel-text="columnCheckCancelText"
|
|
478
467
|
:modal-append-to-body="columnCheckModalAppendToBody"
|
|
479
468
|
:modal="columnCheckModal"
|
|
480
469
|
:fullscreen="columnCheckFullscreen"
|
|
@@ -488,23 +477,28 @@
|
|
|
488
477
|
:before-close="columnCheckBeforeClose"
|
|
489
478
|
:center="columnCheckCenter"
|
|
490
479
|
:destroy-on-close="columnCheckDestroyOnClose"
|
|
491
|
-
ref="columnCheckDialog"
|
|
492
480
|
:operation-prop-key="operationPropKey"
|
|
481
|
+
|
|
482
|
+
v-if="nfColumCheckDialogVisible && checkMode === 'dialog'"
|
|
483
|
+
ref="columnCheckDialog"
|
|
484
|
+
@save="fieldsConfirm"
|
|
493
485
|
>
|
|
494
486
|
<slot slot="tableColumnEditDialogTitle" name="title"></slot>
|
|
495
487
|
<slot slot="tableColumnEditDialogFooter" name="footer"></slot>
|
|
496
488
|
</column-check-dialog>
|
|
497
489
|
<nf-drawer
|
|
498
|
-
ref="columnCheckNfDrawer"
|
|
499
|
-
size="680px"
|
|
500
|
-
v-if="checkMode === 'drawer'"
|
|
501
490
|
:title="columnCheckTitle"
|
|
502
491
|
:cancel-button-text="columnCheckCancelButtonText"
|
|
503
492
|
:confirm-button-text="columnCheckConfirmButtonText"
|
|
493
|
+
|
|
494
|
+
ref="columnCheckNfDrawer"
|
|
495
|
+
size="680px"
|
|
504
496
|
:visible.sync="nfColumCheckDialogVisible"
|
|
505
497
|
:tabs="columnCheckTabs"
|
|
506
498
|
:destroy-on-close="true"
|
|
507
499
|
:currentTab="columnCheckCurrentTab"
|
|
500
|
+
|
|
501
|
+
v-if="checkMode === 'drawer'"
|
|
508
502
|
@confirm="columnCheckConfirm"
|
|
509
503
|
@changeTab="(done) => $emit('changeTab', done)"
|
|
510
504
|
@cancel="(name) => $emit('cancel', name)"
|
|
@@ -517,14 +511,15 @@
|
|
|
517
511
|
:clear-desc="columnCheckClearDesc"
|
|
518
512
|
:no-fixed-desc="columnCheckNoFixedDesc"
|
|
519
513
|
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
520
|
-
:
|
|
514
|
+
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
521
515
|
:get-checked-length-desc="columnCheckGetCheckedLengthDesc"
|
|
522
516
|
:get-all-check-desc="columnCheckGetAllCheckDesc"
|
|
523
|
-
:operation-prop-key="operationPropKey"
|
|
524
517
|
ref="columnCheckDrawer"
|
|
518
|
+
|
|
519
|
+
:column-edit="columnEdit"
|
|
520
|
+
:operation-prop-key="operationPropKey"
|
|
525
521
|
:storage-key="storageKey"
|
|
526
522
|
:table-columns="columns"
|
|
527
|
-
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
528
523
|
/>
|
|
529
524
|
</nf-drawer>
|
|
530
525
|
</div>
|
|
@@ -568,7 +563,6 @@ import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
|
568
563
|
import { CachedManager } from '@94ai/common-utils'
|
|
569
564
|
|
|
570
565
|
const props = withDefaults(defineProps<{
|
|
571
|
-
emptyImageSize?: number,
|
|
572
566
|
data?: Record<string, any>[],
|
|
573
567
|
columns?: NfTableColumnAttributes[] | any,
|
|
574
568
|
searchFormAttrs?: NfSearchFormAttributes,
|
|
@@ -578,6 +572,14 @@ const props = withDefaults(defineProps<{
|
|
|
578
572
|
pageAttrs?: ElPaginationAttributes,
|
|
579
573
|
pageEvents?: Partial<Record<ElPaginationEventKey, Function>>,
|
|
580
574
|
actionBarOptList?: NfTableActionBtnAttributes[],
|
|
575
|
+
/**
|
|
576
|
+
* 开启表格列拖拽缓存记录
|
|
577
|
+
*/
|
|
578
|
+
dragCached?: boolean,
|
|
579
|
+
/**
|
|
580
|
+
* 表格空数据时空组件size
|
|
581
|
+
*/
|
|
582
|
+
emptyImageSize?: number,
|
|
581
583
|
/**
|
|
582
584
|
* 固定窗口满屏table自动计算table高度
|
|
583
585
|
*/
|
|
@@ -615,12 +617,11 @@ const props = withDefaults(defineProps<{
|
|
|
615
617
|
columnCheckTitle?: string,
|
|
616
618
|
columnCheckCancelButtonText?: string,
|
|
617
619
|
columnCheckConfirmButtonText?: string,
|
|
620
|
+
columnCheckBasicFieldDesc?: string
|
|
618
621
|
/**
|
|
619
622
|
* 列编辑dialog模式
|
|
620
623
|
*/
|
|
621
624
|
columnCheckWidth?: string,
|
|
622
|
-
columnCheckConfirmText?: string
|
|
623
|
-
columnCheckCancelText?: string
|
|
624
625
|
columnCheckModalAppendToBody?: boolean,
|
|
625
626
|
columnCheckModal?: boolean,
|
|
626
627
|
columnCheckFullscreen?: boolean,
|
|
@@ -641,7 +642,6 @@ const props = withDefaults(defineProps<{
|
|
|
641
642
|
columnCheckFixedLeftDesc?: string
|
|
642
643
|
columnCheckClearDesc?: string
|
|
643
644
|
columnCheckNoFixedDesc?: string
|
|
644
|
-
columnCheckBasicFieldDesc?: string
|
|
645
645
|
columnCheckGetCheckedLengthDesc?: Function
|
|
646
646
|
columnCheckGetAllCheckDesc?: Function
|
|
647
647
|
columnCheckTabs?: ITabItem[],
|
|
@@ -668,9 +668,10 @@ const props = withDefaults(defineProps<{
|
|
|
668
668
|
* 操作列属性key
|
|
669
669
|
*/
|
|
670
670
|
operationPropKey?: string
|
|
671
|
+
|
|
671
672
|
}>(), {
|
|
673
|
+
dragCached: true,
|
|
672
674
|
emptyImageSize: 145,
|
|
673
|
-
selectEmptyWarningTips: '请选择至少一个选项',
|
|
674
675
|
priority: 'cached',
|
|
675
676
|
storageKey: 'nf-table-columns-cached-key',
|
|
676
677
|
searchFormStorageKey: 'nf-search-form-columns-cached-key',
|
|
@@ -705,14 +706,10 @@ const props = withDefaults(defineProps<{
|
|
|
705
706
|
columnDisplayBtnCircle: false,
|
|
706
707
|
columnDisplayBtnLoading: false,
|
|
707
708
|
columnDisplayBtnDisabled: false,
|
|
708
|
-
columnDisplayBtnText: '设置列表字段',
|
|
709
709
|
columnDisplayBtnClass: '',
|
|
710
710
|
alwaysShowPage: true,
|
|
711
711
|
operationPropKey: 'operation',
|
|
712
|
-
columnCheckTitle: '设置显示字段',
|
|
713
712
|
columnCheckWidth: '600px',
|
|
714
|
-
columnCheckConfirmText: '保 存',
|
|
715
|
-
columnCheckCancelText: '取 消',
|
|
716
713
|
columnCheckModalAppendToBody: true,
|
|
717
714
|
columnCheckModal: true,
|
|
718
715
|
columnCheckFullscreen: false,
|
|
@@ -726,6 +723,9 @@ const props = withDefaults(defineProps<{
|
|
|
726
723
|
columnCheckBeforeClose: undefined,
|
|
727
724
|
columnCheckCenter: false,
|
|
728
725
|
columnCheckDestroyOnClose: false,
|
|
726
|
+
selectEmptyWarningTips: '请选择至少一个选项',
|
|
727
|
+
columnDisplayBtnText: '设置列表字段',
|
|
728
|
+
columnCheckTitle: '设置显示字段',
|
|
729
729
|
columnCheckCancelButtonText: '取消',
|
|
730
730
|
columnCheckConfirmButtonText: '确定',
|
|
731
731
|
columnCheckSearchPlaceholder: '搜索',
|
|
@@ -914,31 +914,38 @@ const initCachedData = async () => {
|
|
|
914
914
|
console.log(e)
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
+
if (props.dragCached) {
|
|
918
|
+
await CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`)
|
|
919
|
+
}
|
|
917
920
|
}
|
|
918
921
|
|
|
922
|
+
const getMinWidth = (column) => {
|
|
923
|
+
const fs = 14
|
|
924
|
+
const label = column.customLabel || column.label
|
|
925
|
+
const char = label.match(/[\u2E80-\u9FFF]/g)
|
|
926
|
+
const charLen = char ? char.length : 0
|
|
927
|
+
const num = label.match(/\d|\./g)
|
|
928
|
+
const numLen = num ? num.length : 0
|
|
929
|
+
const otherLen = label.length - charLen - numLen
|
|
930
|
+
return fs * (charLen * 1 + numLen * 0.7 + otherLen * 0.58) + 20 + (column.sortable ? 24 : 0)
|
|
931
|
+
}
|
|
919
932
|
|
|
920
933
|
const tableColumns = ref<NfTableColumnAttributes[]>([])
|
|
921
934
|
const elTableRefKey = ref(Date.now())
|
|
922
|
-
const syncCookiesToTableColumn = async (readCached = true) => {
|
|
935
|
+
const syncCookiesToTableColumn = async (readCached = true, init = false) => {
|
|
923
936
|
props.columns._skip = true
|
|
924
937
|
const columns = props.columns!.map((item, index) => {
|
|
925
|
-
const len = item.label?.length || 0
|
|
926
|
-
const fz = 15 // 每个字大小,其实是每个字的比例值,大概会比字体大小差不多大一点,
|
|
927
938
|
const attr = (item.attr || {}) as ElTableColumnAttributes
|
|
928
|
-
// const minWidth = fz * len + 32 + (attr.sortable ? 24 : 0)
|
|
929
|
-
// if (!attr['min-width'] || minWidth > parseFloat(attr['min-width'])) {
|
|
930
|
-
// attr['min-width'] = String(minWidth) + 'px' // 字大小乘个数即长度 ,注意不要加px像素,这里minWidth只是一个比例值,不是真正的长度,+32表示th左右两边的内边距
|
|
931
|
-
// }
|
|
932
939
|
// 区分中文、数字、其他字符
|
|
933
940
|
if (!attr['min-width'] && item.label) {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
941
|
+
attr['min-width'] = String(getMinWidth(item)) + 'px'
|
|
942
|
+
}
|
|
943
|
+
if (init && props.dragCached) {
|
|
944
|
+
const prop = item.prop || item.attr?.prop
|
|
945
|
+
let columnWidth = CachedManager.syncCachedGet(`${props.storageKey}$drag-column-width`) || {}
|
|
946
|
+
if (columnWidth[prop]) { // 读取缓存
|
|
947
|
+
attr.width = columnWidth[prop]
|
|
948
|
+
}
|
|
942
949
|
}
|
|
943
950
|
item.attr = {
|
|
944
951
|
...item.attr,
|
|
@@ -989,7 +996,7 @@ const syncCookiesToTableColumn = async (readCached = true) => {
|
|
|
989
996
|
}
|
|
990
997
|
const initColumn = async () => {
|
|
991
998
|
await initCachedData()
|
|
992
|
-
syncCookiesToTableColumn()
|
|
999
|
+
syncCookiesToTableColumn(true, true)
|
|
993
1000
|
}
|
|
994
1001
|
|
|
995
1002
|
initColumn()
|
|
@@ -1113,8 +1120,14 @@ const sort = (prop, order) => {
|
|
|
1113
1120
|
|
|
1114
1121
|
const headerDragend = async (newWidth, oldWidth, column, event) => {
|
|
1115
1122
|
await nextTick()
|
|
1116
|
-
|
|
1117
|
-
|
|
1123
|
+
const minWidth = getMinWidth(column)
|
|
1124
|
+
if (newWidth < minWidth) {
|
|
1125
|
+
column.width = minWidth
|
|
1126
|
+
}
|
|
1127
|
+
if (props.dragCached) { // 记录缓存
|
|
1128
|
+
const columnCachedData = await CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`) || {}
|
|
1129
|
+
columnCachedData[column.property] = column.width
|
|
1130
|
+
await CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, columnCachedData)
|
|
1118
1131
|
}
|
|
1119
1132
|
await props.tableEvents['header-dragend']?.(newWidth, oldWidth, column, event)
|
|
1120
1133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-table",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.57",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^3.2.
|
|
18
|
-
"@94ai/nf-button": "^3.2.
|
|
19
|
-
"@94ai/nf-drawer": "^3.2.
|
|
20
|
-
"@94ai/nf-message": "^3.2.
|
|
21
|
-
"@94ai/nf-search-form": "^3.2.
|
|
22
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
17
|
+
"@94ai/common-utils": "^3.2.57",
|
|
18
|
+
"@94ai/nf-button": "^3.2.57",
|
|
19
|
+
"@94ai/nf-drawer": "^3.2.57",
|
|
20
|
+
"@94ai/nf-message": "^3.2.57",
|
|
21
|
+
"@94ai/nf-search-form": "^3.2.57",
|
|
22
|
+
"@94ai/nf-theme-chalk": "^3.2.57",
|
|
23
23
|
"idb-keyval": "^6.2.1",
|
|
24
24
|
"vue-demi": "^0.14.5",
|
|
25
25
|
"vuedraggable": "^2.24.3"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"types": "lib/index.d.ts",
|
|
38
38
|
"main": "lib/nf-table.cjs.js",
|
|
39
39
|
"module": "lib/nf-table.esm-bundler.js",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "1f0681c27c513e0a6ac75b9bf70dbde9dfadace0"
|
|
41
41
|
}
|