@94ai/nf-table 3.2.48 → 3.2.51
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 +136 -134
- package/lib/nf-column-check-dialog.vue.d.ts +36 -27
- package/lib/nf-column-check-drawer.vue.d.ts +36 -28
- package/lib/nf-table.cjs.js +1029 -6133
- package/lib/nf-table.esm-bundler.js +1030 -6134
- package/lib/nf-table.vue.d.ts +50 -49
- package/package/index.ts +0 -7
- package/package/nf-column-check-dialog.vue +31 -10
- package/package/nf-column-check-drawer.vue +11 -6
- package/package/nf-table.vue +119 -62
- package/package.json +8 -7
- package/lib/utils.d.ts +0 -1
- package/package/utils.ts +0 -15
package/lib/nf-table.vue.d.ts
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { NfTableColumnAttributes, ElTableAttributes, ElTableEventKey, ElPaginationEventKey, ElPaginationAttributes, NfSearchFormAttributes, NfSearchFormEventKey, NfTableActionBtnAttributes } from './types';
|
|
2
2
|
import { ITabItem } from '@94ai/nf-drawer/lib/types';
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<{
|
|
4
|
+
background: {
|
|
5
|
+
type: import("vue-demi").PropType<string>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
columns: {
|
|
9
|
+
type: import("vue-demi").PropType<any>;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
4
12
|
data: {
|
|
5
13
|
type: import("vue-demi").PropType<Record<string, any>[]>;
|
|
6
14
|
default: () => never[];
|
|
7
15
|
};
|
|
8
|
-
|
|
16
|
+
columnEdit: {
|
|
17
|
+
type: import("vue-demi").PropType<boolean>;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
operationPropKey: {
|
|
9
21
|
type: import("vue-demi").PropType<string>;
|
|
10
22
|
default: string;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
type: import("vue-demi").PropType<string
|
|
14
|
-
default:
|
|
24
|
+
storageKey: {
|
|
25
|
+
type: import("vue-demi").PropType<string>;
|
|
26
|
+
default: string;
|
|
15
27
|
};
|
|
16
28
|
fullscreen: {
|
|
17
29
|
type: import("vue-demi").PropType<boolean>;
|
|
@@ -33,13 +45,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
33
45
|
type: import("vue-demi").PropType<string>;
|
|
34
46
|
default: string;
|
|
35
47
|
};
|
|
36
|
-
|
|
37
|
-
type: import("vue-demi").PropType<string>;
|
|
38
|
-
default:
|
|
39
|
-
};
|
|
40
|
-
columns: {
|
|
41
|
-
type: import("vue-demi").PropType<any>;
|
|
42
|
-
default: () => never[];
|
|
48
|
+
showColumn: {
|
|
49
|
+
type: import("vue-demi").PropType<string[]>;
|
|
50
|
+
default: undefined;
|
|
43
51
|
};
|
|
44
52
|
searchFormAttrs: {
|
|
45
53
|
type: import("vue-demi").PropType<NfSearchFormAttributes>;
|
|
@@ -73,10 +81,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
73
81
|
type: import("vue-demi").PropType<boolean>;
|
|
74
82
|
default: boolean;
|
|
75
83
|
};
|
|
76
|
-
columnEdit: {
|
|
77
|
-
type: import("vue-demi").PropType<boolean>;
|
|
78
|
-
default: boolean;
|
|
79
|
-
};
|
|
80
84
|
columnPosition: {
|
|
81
85
|
type: import("vue-demi").PropType<"embed" | "free">;
|
|
82
86
|
default: string;
|
|
@@ -255,10 +259,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
255
259
|
type: import("vue-demi").PropType<string>;
|
|
256
260
|
default: undefined;
|
|
257
261
|
};
|
|
258
|
-
background: {
|
|
259
|
-
type: import("vue-demi").PropType<string>;
|
|
260
|
-
default: undefined;
|
|
261
|
-
};
|
|
262
262
|
alwaysShowPage: {
|
|
263
263
|
type: import("vue-demi").PropType<boolean>;
|
|
264
264
|
default: boolean;
|
|
@@ -320,7 +320,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
320
320
|
resizable?: boolean | undefined;
|
|
321
321
|
formatter?: Function | undefined;
|
|
322
322
|
'show-overflow-tooltip'?: boolean | undefined;
|
|
323
|
-
align?: "
|
|
323
|
+
align?: "left" | "right" | "center" | undefined;
|
|
324
324
|
'class-name'?: string | undefined;
|
|
325
325
|
'label-class-name'?: string | undefined;
|
|
326
326
|
selectable?: Function | undefined;
|
|
@@ -329,30 +329,43 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
329
329
|
text?: string | number | undefined;
|
|
330
330
|
value?: string | number | undefined;
|
|
331
331
|
}[] | undefined;
|
|
332
|
-
'filter-placement'?: "
|
|
332
|
+
'filter-placement'?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
|
|
333
333
|
'filter-multiple'?: boolean | undefined;
|
|
334
334
|
'filter-method'?: Function | undefined;
|
|
335
335
|
'filtered-value'?: string[] | undefined;
|
|
336
336
|
} | undefined;
|
|
337
337
|
}[]>;
|
|
338
|
+
calcTableHeight: () => void;
|
|
338
339
|
syncLocalShowColumnToCookies: () => void;
|
|
339
|
-
syncCookiesToLocalShowColumn: () => void
|
|
340
|
-
syncCookiesToTableColumn: (readCached?: boolean) => void
|
|
340
|
+
syncCookiesToLocalShowColumn: () => Promise<void>;
|
|
341
|
+
syncCookiesToTableColumn: (readCached?: boolean) => Promise<void>;
|
|
341
342
|
}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
342
343
|
fieldsChange: (event: string[]) => void;
|
|
343
344
|
"update:showColumn": (event: string[] | undefined) => void;
|
|
344
345
|
}, string, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
346
|
+
background: {
|
|
347
|
+
type: import("vue-demi").PropType<string>;
|
|
348
|
+
default: undefined;
|
|
349
|
+
};
|
|
350
|
+
columns: {
|
|
351
|
+
type: import("vue-demi").PropType<any>;
|
|
352
|
+
default: () => never[];
|
|
353
|
+
};
|
|
345
354
|
data: {
|
|
346
355
|
type: import("vue-demi").PropType<Record<string, any>[]>;
|
|
347
356
|
default: () => never[];
|
|
348
357
|
};
|
|
349
|
-
|
|
358
|
+
columnEdit: {
|
|
359
|
+
type: import("vue-demi").PropType<boolean>;
|
|
360
|
+
default: boolean;
|
|
361
|
+
};
|
|
362
|
+
operationPropKey: {
|
|
350
363
|
type: import("vue-demi").PropType<string>;
|
|
351
364
|
default: string;
|
|
352
365
|
};
|
|
353
|
-
|
|
354
|
-
type: import("vue-demi").PropType<string
|
|
355
|
-
default:
|
|
366
|
+
storageKey: {
|
|
367
|
+
type: import("vue-demi").PropType<string>;
|
|
368
|
+
default: string;
|
|
356
369
|
};
|
|
357
370
|
fullscreen: {
|
|
358
371
|
type: import("vue-demi").PropType<boolean>;
|
|
@@ -374,13 +387,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
374
387
|
type: import("vue-demi").PropType<string>;
|
|
375
388
|
default: string;
|
|
376
389
|
};
|
|
377
|
-
|
|
378
|
-
type: import("vue-demi").PropType<string>;
|
|
379
|
-
default:
|
|
380
|
-
};
|
|
381
|
-
columns: {
|
|
382
|
-
type: import("vue-demi").PropType<any>;
|
|
383
|
-
default: () => never[];
|
|
390
|
+
showColumn: {
|
|
391
|
+
type: import("vue-demi").PropType<string[]>;
|
|
392
|
+
default: undefined;
|
|
384
393
|
};
|
|
385
394
|
searchFormAttrs: {
|
|
386
395
|
type: import("vue-demi").PropType<NfSearchFormAttributes>;
|
|
@@ -414,10 +423,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
414
423
|
type: import("vue-demi").PropType<boolean>;
|
|
415
424
|
default: boolean;
|
|
416
425
|
};
|
|
417
|
-
columnEdit: {
|
|
418
|
-
type: import("vue-demi").PropType<boolean>;
|
|
419
|
-
default: boolean;
|
|
420
|
-
};
|
|
421
426
|
columnPosition: {
|
|
422
427
|
type: import("vue-demi").PropType<"embed" | "free">;
|
|
423
428
|
default: string;
|
|
@@ -596,25 +601,23 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
596
601
|
type: import("vue-demi").PropType<string>;
|
|
597
602
|
default: undefined;
|
|
598
603
|
};
|
|
599
|
-
background: {
|
|
600
|
-
type: import("vue-demi").PropType<string>;
|
|
601
|
-
default: undefined;
|
|
602
|
-
};
|
|
603
604
|
alwaysShowPage: {
|
|
604
605
|
type: import("vue-demi").PropType<boolean>;
|
|
605
606
|
default: boolean;
|
|
606
607
|
};
|
|
607
608
|
}>>, {
|
|
609
|
+
background: string;
|
|
610
|
+
columns: NfTableColumnAttributes[] | any;
|
|
608
611
|
data: Record<string, any>[];
|
|
612
|
+
columnEdit: boolean;
|
|
613
|
+
operationPropKey: string;
|
|
609
614
|
storageKey: string;
|
|
610
|
-
showColumn: string[];
|
|
611
615
|
fullscreen: boolean;
|
|
612
616
|
customClass: string;
|
|
613
617
|
body: boolean;
|
|
614
618
|
text: string;
|
|
615
619
|
selectEmptyWarningTips: string;
|
|
616
|
-
|
|
617
|
-
columns: NfTableColumnAttributes[] | any;
|
|
620
|
+
showColumn: string[];
|
|
618
621
|
searchFormAttrs: NfSearchFormAttributes;
|
|
619
622
|
searchFormEvents: Partial<Record<NfSearchFormEventKey, Function>>;
|
|
620
623
|
tableAttrs: ElTableAttributes;
|
|
@@ -623,7 +626,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
623
626
|
pageEvents: Partial<Record<ElPaginationEventKey, Function>>;
|
|
624
627
|
actionBarOptList: NfTableActionBtnAttributes[];
|
|
625
628
|
calHeight: boolean;
|
|
626
|
-
columnEdit: boolean;
|
|
627
629
|
columnPosition: 'free' | 'embed';
|
|
628
630
|
checkMode: 'dialog' | 'drawer';
|
|
629
631
|
priority: 'cached' | 'value';
|
|
@@ -667,7 +669,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
667
669
|
target: HTMLElement;
|
|
668
670
|
lock: boolean;
|
|
669
671
|
spinner: string;
|
|
670
|
-
background: string;
|
|
671
672
|
alwaysShowPage: boolean;
|
|
672
673
|
}>, Partial<Record<any, (_: {
|
|
673
674
|
slot: any;
|
|
@@ -745,7 +746,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
745
746
|
resizable?: boolean | undefined;
|
|
746
747
|
formatter?: Function | undefined;
|
|
747
748
|
'show-overflow-tooltip'?: boolean | undefined;
|
|
748
|
-
align?: "
|
|
749
|
+
align?: "left" | "right" | "center" | undefined;
|
|
749
750
|
'class-name'?: string | undefined;
|
|
750
751
|
'label-class-name'?: string | undefined;
|
|
751
752
|
selectable?: Function | undefined;
|
|
@@ -754,7 +755,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
754
755
|
text?: string | number | undefined;
|
|
755
756
|
value?: string | number | undefined;
|
|
756
757
|
}[] | undefined;
|
|
757
|
-
'filter-placement'?: "
|
|
758
|
+
'filter-placement'?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
|
|
758
759
|
'filter-multiple'?: boolean | undefined;
|
|
759
760
|
'filter-method'?: Function | undefined;
|
|
760
761
|
'filtered-value'?: string[] | undefined;
|
package/package/index.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import NfTable from './nf-table.vue'
|
|
2
2
|
import { Vue2, PluginObject } from 'vue-demi'
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import VueCookies from 'vue-cookies'
|
|
5
3
|
import NfMessage from '@94ai/nf-message'
|
|
6
4
|
|
|
7
5
|
NfTable.install = (app: typeof Vue2) => {
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
if (!app.$cookies) {
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
app.use(VueCookies)
|
|
12
|
-
}
|
|
13
6
|
// @ts-ignore
|
|
14
7
|
if (!app.$openMessage) {
|
|
15
8
|
// @ts-ignore
|
|
@@ -25,7 +25,14 @@
|
|
|
25
25
|
<div class="nf-table-nf-column-check-dialog-check-content">
|
|
26
26
|
<div v-for="(item,index) in fields" :key="index" class="nf-check-item">
|
|
27
27
|
<div class="nf-check-title">{{ item.name }}</div>
|
|
28
|
-
<el-checkbox
|
|
28
|
+
<el-checkbox
|
|
29
|
+
v-for="obj in item.list"
|
|
30
|
+
:key="obj.prop"
|
|
31
|
+
v-model="tableData[obj.prop]"
|
|
32
|
+
class="nf-check-box"
|
|
33
|
+
:label="obj.prop"
|
|
34
|
+
:disabled="unChangedColumn.includes(obj.prop)"
|
|
35
|
+
>{{ obj.label }}</el-checkbox>
|
|
29
36
|
</div>
|
|
30
37
|
</div>
|
|
31
38
|
<slot slot="footer" name="footer">
|
|
@@ -53,9 +60,14 @@ import {
|
|
|
53
60
|
onMounted,
|
|
54
61
|
ref
|
|
55
62
|
} from 'vue-demi'
|
|
56
|
-
import {
|
|
63
|
+
import { CachedManager } from '@94ai/common-utils'
|
|
57
64
|
|
|
58
65
|
const props = withDefaults(defineProps<{
|
|
66
|
+
/**
|
|
67
|
+
* 列编辑显示开关
|
|
68
|
+
*/
|
|
69
|
+
columnEdit?: boolean,
|
|
70
|
+
operationPropKey?: string
|
|
59
71
|
storageKey?: string
|
|
60
72
|
show?: boolean,
|
|
61
73
|
title?: string,
|
|
@@ -63,7 +75,6 @@ const props = withDefaults(defineProps<{
|
|
|
63
75
|
confirmText?: string
|
|
64
76
|
cancelText?: string
|
|
65
77
|
tableColumns?: Record<string, any>[],
|
|
66
|
-
showColumn?: string[]
|
|
67
78
|
modalAppendToBody?: boolean,
|
|
68
79
|
modal?: boolean,
|
|
69
80
|
fullscreen?: boolean,
|
|
@@ -78,6 +89,8 @@ const props = withDefaults(defineProps<{
|
|
|
78
89
|
center?: boolean,
|
|
79
90
|
destroyOnClose?: boolean,
|
|
80
91
|
}>(), {
|
|
92
|
+
columnEdit: false,
|
|
93
|
+
operationPropKey: 'operation',
|
|
81
94
|
storageKey: 'nf-table-columns-cached-key',
|
|
82
95
|
show: false,
|
|
83
96
|
width: '600px',
|
|
@@ -85,7 +98,6 @@ const props = withDefaults(defineProps<{
|
|
|
85
98
|
cancelText: '取 消',
|
|
86
99
|
confirmText: '保 存',
|
|
87
100
|
tableColumns: () => [],
|
|
88
|
-
showColumn: undefined,
|
|
89
101
|
modalAppendToBody: true,
|
|
90
102
|
modal: true,
|
|
91
103
|
fullscreen: false,
|
|
@@ -111,7 +123,8 @@ const emit = defineEmits<{
|
|
|
111
123
|
const instance = getCurrentInstance()?.proxy
|
|
112
124
|
|
|
113
125
|
const tableData = ref<Record<string, any>>({})
|
|
114
|
-
|
|
126
|
+
// 不可操作列
|
|
127
|
+
const unChangedColumn = ref<string[]>([])
|
|
115
128
|
|
|
116
129
|
const visible = computed({
|
|
117
130
|
get() {
|
|
@@ -124,7 +137,7 @@ const visible = computed({
|
|
|
124
137
|
|
|
125
138
|
const fields = computed(() => {
|
|
126
139
|
const obj: Record<string, any> = {}
|
|
127
|
-
|
|
140
|
+
props.tableColumns.filter(item => !item.destory).map(item => {
|
|
128
141
|
if (!item.type) {
|
|
129
142
|
const key = item.category || '基础字段'
|
|
130
143
|
if (!obj[key]) {
|
|
@@ -143,7 +156,7 @@ const fields = computed(() => {
|
|
|
143
156
|
return fields
|
|
144
157
|
})
|
|
145
158
|
|
|
146
|
-
const submit = ()
|
|
159
|
+
const submit = () => {
|
|
147
160
|
visible.value = false
|
|
148
161
|
const columnState = {}
|
|
149
162
|
props.tableColumns.map((i, index) => {
|
|
@@ -154,17 +167,25 @@ const submit = () =>{
|
|
|
154
167
|
index
|
|
155
168
|
}
|
|
156
169
|
})
|
|
157
|
-
instance?.$cookies?.remove(props.storageKey)
|
|
158
|
-
instance?.$cookies?.set(props.storageKey, JSON.stringify(columnState), -1, '/xxxx/xxxx/xxxx')
|
|
159
170
|
emit('save', tableData.value)
|
|
171
|
+
if (props.columnEdit) {
|
|
172
|
+
CachedManager.syncCachedSet(props.storageKey, columnState)
|
|
173
|
+
}
|
|
160
174
|
}
|
|
161
175
|
|
|
162
176
|
const addInitValue = () => {
|
|
163
177
|
const obj: Record<string, any> = {}
|
|
164
178
|
props.tableColumns.forEach(v => {
|
|
165
|
-
obj[v.prop] =
|
|
179
|
+
obj[v.prop] = !v.initHidden
|
|
166
180
|
})
|
|
167
181
|
tableData.value = obj
|
|
182
|
+
|
|
183
|
+
if (props.tableColumns.findIndex((item) => !!item.type) > -1) {
|
|
184
|
+
unChangedColumn.value.push('selection')
|
|
185
|
+
}
|
|
186
|
+
if (props.tableColumns.findIndex((item) => (item.prop || item.attr?.prop) === props.operationPropKey) > -1) {
|
|
187
|
+
unChangedColumn.value.push(props.operationPropKey)
|
|
188
|
+
}
|
|
168
189
|
}
|
|
169
190
|
|
|
170
191
|
onMounted(() => {
|
|
@@ -137,10 +137,9 @@ import {
|
|
|
137
137
|
computed,
|
|
138
138
|
onBeforeMount,
|
|
139
139
|
getCurrentInstance,
|
|
140
|
-
PropType,
|
|
141
|
-
onMounted
|
|
142
140
|
} from 'vue-demi'
|
|
143
|
-
import { deepClone } from '
|
|
141
|
+
import { deepClone } from '@94ai/common-utils'
|
|
142
|
+
import { CachedManager } from '@94ai/common-utils'
|
|
144
143
|
|
|
145
144
|
const instance = getCurrentInstance()?.proxy
|
|
146
145
|
|
|
@@ -151,6 +150,10 @@ const props = withDefaults(defineProps<{
|
|
|
151
150
|
tableColumns?: Record<string, any>[],
|
|
152
151
|
storageKey?: string
|
|
153
152
|
operationPropKey?: string
|
|
153
|
+
/**
|
|
154
|
+
* 列编辑显示开关
|
|
155
|
+
*/
|
|
156
|
+
columnEdit?: boolean,
|
|
154
157
|
searchPlaceholder?: string
|
|
155
158
|
fixedLeftDesc?: string
|
|
156
159
|
clearDesc?: string
|
|
@@ -158,6 +161,7 @@ const props = withDefaults(defineProps<{
|
|
|
158
161
|
getCheckedLengthDesc?: Function
|
|
159
162
|
getAllCheckDesc?: Function
|
|
160
163
|
}>(), {
|
|
164
|
+
columnEdit: false,
|
|
161
165
|
selectEmptyWarningTips: '请选择至少一个选项',
|
|
162
166
|
tableColumns: () => [],
|
|
163
167
|
storageKey: 'nf-table-columns-cached-key',
|
|
@@ -354,7 +358,7 @@ const syncTableColumnsToCookies = () => {
|
|
|
354
358
|
const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value]
|
|
355
359
|
if (newTableColumns.filter(item => !item.type && item.prop !== props.operationPropKey && !item.initHidden).length === 0) {
|
|
356
360
|
// @ts-ignore
|
|
357
|
-
instance?.$openMessage
|
|
361
|
+
instance?.$openMessage?.warning({
|
|
358
362
|
message: props.selectEmptyWarningTips,
|
|
359
363
|
duration: 2000,
|
|
360
364
|
})
|
|
@@ -380,8 +384,9 @@ const syncTableColumnsToCookies = () => {
|
|
|
380
384
|
}
|
|
381
385
|
obj[i.prop] = !columnState[i.prop].initHidden
|
|
382
386
|
})
|
|
383
|
-
|
|
384
|
-
|
|
387
|
+
if (props.columnEdit) {
|
|
388
|
+
CachedManager.syncCachedSet(props.storageKey, columnState)
|
|
389
|
+
}
|
|
385
390
|
return obj
|
|
386
391
|
}
|
|
387
392
|
|