@94ai/nf-table 8.0.26 → 8.1.3
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 +87 -0
- package/lib/nf-table.cjs.js +3539 -323
- package/lib/nf-table.esm-bundler.js +3536 -320
- package/lib/nf-table.vue.d.ts +24 -0
- package/package/nf-table.vue +187 -4
- package/package.json +9 -9
package/lib/nf-table.vue.d.ts
CHANGED
|
@@ -75,6 +75,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
75
75
|
alwaysShowPage?: boolean | undefined;
|
|
76
76
|
operationPropKey?: string | undefined;
|
|
77
77
|
drawerProps?: Record<string, any> | undefined;
|
|
78
|
+
virtualized?: boolean | undefined;
|
|
79
|
+
virtualTableData?: Record<string, any>[] | undefined;
|
|
80
|
+
virtualProps?: Record<string, any> | undefined;
|
|
78
81
|
}>, {
|
|
79
82
|
dragCached: boolean;
|
|
80
83
|
emptyImageSize: number;
|
|
@@ -148,6 +151,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
148
151
|
columnCheckGetCheckedLengthDesc: (length: any) => (length: any) => string;
|
|
149
152
|
columnCheckGetAllCheckDesc: (length: any) => (length: any) => string;
|
|
150
153
|
drawerProps: () => {};
|
|
154
|
+
virtualized: boolean;
|
|
155
|
+
virtualTableData: () => never[];
|
|
156
|
+
virtualProps: () => {};
|
|
151
157
|
}>, {
|
|
152
158
|
clearFilter: () => void;
|
|
153
159
|
sort: (prop: any, order: any) => void;
|
|
@@ -329,6 +335,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
329
335
|
alwaysShowPage?: boolean | undefined;
|
|
330
336
|
operationPropKey?: string | undefined;
|
|
331
337
|
drawerProps?: Record<string, any> | undefined;
|
|
338
|
+
virtualized?: boolean | undefined;
|
|
339
|
+
virtualTableData?: Record<string, any>[] | undefined;
|
|
340
|
+
virtualProps?: Record<string, any> | undefined;
|
|
332
341
|
}>, {
|
|
333
342
|
dragCached: boolean;
|
|
334
343
|
emptyImageSize: number;
|
|
@@ -402,6 +411,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
402
411
|
columnCheckGetCheckedLengthDesc: (length: any) => (length: any) => string;
|
|
403
412
|
columnCheckGetAllCheckDesc: (length: any) => (length: any) => string;
|
|
404
413
|
drawerProps: () => {};
|
|
414
|
+
virtualized: boolean;
|
|
415
|
+
virtualTableData: () => never[];
|
|
416
|
+
virtualProps: () => {};
|
|
405
417
|
}>>>, {
|
|
406
418
|
background: string;
|
|
407
419
|
columns: NfTableColumnAttributes[] | any;
|
|
@@ -475,6 +487,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
475
487
|
spinner: string;
|
|
476
488
|
alwaysShowPage: boolean;
|
|
477
489
|
drawerProps: Record<string, any>;
|
|
490
|
+
virtualized: boolean;
|
|
491
|
+
virtualTableData: Record<string, any>[];
|
|
492
|
+
virtualProps: Record<string, any>;
|
|
478
493
|
}>, Partial<Record<any, (_: {
|
|
479
494
|
slot: any;
|
|
480
495
|
}) => any>> & Partial<Record<any, (_: {
|
|
@@ -509,6 +524,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
509
524
|
}) => any>> & Partial<Record<any, (_: {
|
|
510
525
|
row: any;
|
|
511
526
|
index: any;
|
|
527
|
+
}) => any>> & Partial<Record<any, (_: {
|
|
528
|
+
row: any;
|
|
529
|
+
index: any;
|
|
530
|
+
}) => any>> & Partial<Record<any, (_: {}) => any>> & Partial<Record<any, (_: {
|
|
531
|
+
$index: any;
|
|
532
|
+
column: any;
|
|
533
|
+
}) => any>> & Partial<Record<any, (_: {
|
|
534
|
+
row: any;
|
|
535
|
+
index: any;
|
|
512
536
|
}) => any>> & Partial<Record<string, (_: {
|
|
513
537
|
slot: string;
|
|
514
538
|
}) => any>> & Partial<Record<string, (_: {
|
package/package/nf-table.vue
CHANGED
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
{{ columnDisplayBtnText }}
|
|
45
45
|
</nf-button>
|
|
46
46
|
</slot>
|
|
47
|
+
<!-- 非虚拟 -->
|
|
47
48
|
<el-table
|
|
49
|
+
v-if="!virtualized"
|
|
48
50
|
ref="elTableRef"
|
|
49
51
|
:class="{'nf-table-container': true, 'nf-default-table-border': !nfTableBorder && !tableAttrs?.border }"
|
|
50
52
|
:data="showData"
|
|
@@ -193,6 +195,167 @@
|
|
|
193
195
|
<nf-empty slot="empty" :image-size="emptyImageSize" :description="emptyText"></nf-empty>
|
|
194
196
|
</slot>
|
|
195
197
|
</el-table>
|
|
198
|
+
<!-- 虚拟 -->
|
|
199
|
+
<virtual-scroll v-else v-bind="{...wrapperProps}" @change="handleVirtualChange">
|
|
200
|
+
<el-table
|
|
201
|
+
ref="elTableRef"
|
|
202
|
+
:class="{'nf-table-container': true, 'nf-default-table-border': !nfTableBorder && !tableAttrs?.border }"
|
|
203
|
+
:data="tableData"
|
|
204
|
+
:fit="tableAttrer?.fit ?? true"
|
|
205
|
+
:height="elTableHeight"
|
|
206
|
+
v-bind="tableAttrer"
|
|
207
|
+
v-on="tableEventer"
|
|
208
|
+
:key="cStorageKey"
|
|
209
|
+
>
|
|
210
|
+
<template v-for="column in tableColumns">
|
|
211
|
+
<!-- 特殊类型,如selection -->
|
|
212
|
+
<template v-if="column.type && isShow(column)">
|
|
213
|
+
<virtual-column
|
|
214
|
+
v-if="column.type === 'selection'"
|
|
215
|
+
:key="column.key || column.prop || column.type"
|
|
216
|
+
type="selection"
|
|
217
|
+
:prop="column.prop"
|
|
218
|
+
:label="resolveValue(column.label)"
|
|
219
|
+
v-bind="column.attr"
|
|
220
|
+
>
|
|
221
|
+
</virtual-column>
|
|
222
|
+
<el-table-column
|
|
223
|
+
v-else-if="column.type!=='expand'"
|
|
224
|
+
:key="column.key || column.prop || column.type"
|
|
225
|
+
:type="column.type"
|
|
226
|
+
:prop="column.prop"
|
|
227
|
+
:label="resolveValue(column.label)"
|
|
228
|
+
v-bind="column.attr"
|
|
229
|
+
>
|
|
230
|
+
</el-table-column>
|
|
231
|
+
<el-table-column
|
|
232
|
+
v-else
|
|
233
|
+
:key="column.key || column.prop || column.type"
|
|
234
|
+
:type="column.type"
|
|
235
|
+
:prop="column.prop"
|
|
236
|
+
:label="resolveValue(column.label)"
|
|
237
|
+
v-bind="column.attr"
|
|
238
|
+
>
|
|
239
|
+
<template slot-scope="scope" v-if="column.slot">
|
|
240
|
+
<slot :name="column.slot" :row="scope.row" :index="scope.$index" />
|
|
241
|
+
</template>
|
|
242
|
+
</el-table-column>
|
|
243
|
+
</template>
|
|
244
|
+
<el-table-column
|
|
245
|
+
v-else-if="!column.type && isShow(column)"
|
|
246
|
+
:key="column.key || column.prop || column.type"
|
|
247
|
+
:type="column.type"
|
|
248
|
+
:prop="column.prop"
|
|
249
|
+
:label="resolveValue(column.label)"
|
|
250
|
+
v-bind="column.attr"
|
|
251
|
+
>
|
|
252
|
+
<!-- column套column -->
|
|
253
|
+
<slot v-if="column.singleHeadMutiColSlot" :name="column.singleHeadMutiColSlot" />
|
|
254
|
+
<!-- -------------- header区域 -------------- -->
|
|
255
|
+
<template slot="header" slot-scope="scope">
|
|
256
|
+
<!-- 操作 -->
|
|
257
|
+
<slot
|
|
258
|
+
v-if="
|
|
259
|
+
columnEdit &&
|
|
260
|
+
column.prop === operationPropKey &&
|
|
261
|
+
columnPosition === 'embed'
|
|
262
|
+
"
|
|
263
|
+
name="operationIconColumnCheck"
|
|
264
|
+
:column="column"
|
|
265
|
+
>
|
|
266
|
+
<span style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
267
|
+
<el-tooltip
|
|
268
|
+
popper-class="actionTooltipRef"
|
|
269
|
+
placement="top"
|
|
270
|
+
effect="dark"
|
|
271
|
+
:content="columnDisplayBtnText">
|
|
272
|
+
<i class="iconfont icon-liebiao_xianshiliemu operation-icon-column-check"
|
|
273
|
+
@click="nfColumCheckDialogVisible = true"
|
|
274
|
+
/>
|
|
275
|
+
</el-tooltip>
|
|
276
|
+
</slot>
|
|
277
|
+
<!-- labelTooltip -->
|
|
278
|
+
<template v-else-if="column.labelTooltip">
|
|
279
|
+
<el-tooltip :placement="column.labelTooltipPlacement || 'right'" effect="dark">
|
|
280
|
+
<div slot="content">{{ column.labelTooltip }}</div>
|
|
281
|
+
<span class="bottom-line" style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
282
|
+
</el-tooltip>
|
|
283
|
+
</template>
|
|
284
|
+
<!-- 头部插槽 -->
|
|
285
|
+
<template v-else-if="column.headerSlot">
|
|
286
|
+
<slot :name="column.headerSlot" :$index="scope.$index" :column="scope.column" />
|
|
287
|
+
</template>
|
|
288
|
+
<!-- 默认 -->
|
|
289
|
+
<span v-else>
|
|
290
|
+
{{ resolveValue(column.label) }}
|
|
291
|
+
</span>
|
|
292
|
+
</template>
|
|
293
|
+
<!-- -------------- 内容区域 -------------- -->
|
|
294
|
+
<template slot-scope="scope">
|
|
295
|
+
<!-- 插槽 -->
|
|
296
|
+
<slot
|
|
297
|
+
v-if="column.slot"
|
|
298
|
+
:name="column.slot"
|
|
299
|
+
:row="scope.row"
|
|
300
|
+
:index="scope.$index"
|
|
301
|
+
/>
|
|
302
|
+
<!-- render -->
|
|
303
|
+
<render-component
|
|
304
|
+
v-else-if="column.render"
|
|
305
|
+
:render="column.render"
|
|
306
|
+
:row="scope.row"
|
|
307
|
+
/>
|
|
308
|
+
<!-- 操作 -->
|
|
309
|
+
<nf-action
|
|
310
|
+
v-else-if="column.prop === operationPropKey && !hasOperationSlot"
|
|
311
|
+
:span="column.operationSpan || 0"
|
|
312
|
+
:unique="scope.index"
|
|
313
|
+
>
|
|
314
|
+
<template v-for="(item, index) in getOperationListLocal(column, scope)">
|
|
315
|
+
<nf-button
|
|
316
|
+
v-if="!resolveValue(item.destroy, scope.row, scope)"
|
|
317
|
+
:size="resolveValue(item.size || 'mini', scope.row, scope)"
|
|
318
|
+
:type="resolveValue(item.type || 'primary', scope.row, scope, scope.row, scope)"
|
|
319
|
+
:text="resolveValue(item.text === undefined ? true : item.text, scope.row, scope)"
|
|
320
|
+
:disabled="resolveValue(item.disabled, scope.row, scope)"
|
|
321
|
+
:loading="resolveValue(item.loading, scope.row, scope)"
|
|
322
|
+
:class="resolveValue(item.class, scope.row, scope)"
|
|
323
|
+
:plain="resolveValue(item.plain, scope.row, scope)"
|
|
324
|
+
:icon="resolveValue(item.icon, scope.row, scope)"
|
|
325
|
+
:round="resolveValue(item.round, scope.row, scope)"
|
|
326
|
+
:circle="resolveValue(item.circle, scope.row, scope)"
|
|
327
|
+
:style="resolveValue(item.style, scope.row, scope)"
|
|
328
|
+
v-on="eventsOperationListBtns(item, scope)"
|
|
329
|
+
:key="item.key || index"
|
|
330
|
+
>{{ resolveValue(item.name, scope.row, scope) }}
|
|
331
|
+
</nf-button>
|
|
332
|
+
</template>
|
|
333
|
+
</nf-action>
|
|
334
|
+
<span v-else-if="column.attr?.formatter">
|
|
335
|
+
{{ column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index) }}
|
|
336
|
+
</span>
|
|
337
|
+
<template v-else-if="column.optionsEnum">
|
|
338
|
+
<nf-tag
|
|
339
|
+
v-if="column.optionsTag[scope.row[column.prop]]"
|
|
340
|
+
:type='column.optionsTag[scope.row[column.prop]]'
|
|
341
|
+
:value="column.optionsEnum[scope.row[column.prop]]"
|
|
342
|
+
/>
|
|
343
|
+
<span v-else>
|
|
344
|
+
{{ column.optionsEnum[scope.row[column.prop]] }}
|
|
345
|
+
</span>
|
|
346
|
+
</template>
|
|
347
|
+
<span v-else>
|
|
348
|
+
{{ scope.row[column.prop] }}{{ column.unit }}
|
|
349
|
+
</span>
|
|
350
|
+
</template>
|
|
351
|
+
</el-table-column>
|
|
352
|
+
</template>
|
|
353
|
+
<slot name="append" slot="append"></slot>
|
|
354
|
+
<slot name="empty" slot="empty">
|
|
355
|
+
<nf-empty slot="empty" :image-size="emptyImageSize" :description="emptyText"></nf-empty>
|
|
356
|
+
</slot>
|
|
357
|
+
</el-table>
|
|
358
|
+
</virtual-scroll>
|
|
196
359
|
<div ref="nfTableActionContainerRef" class="nf-action-box nf-clearfix">
|
|
197
360
|
<slot name="actionBar" ref="nfTableActionBarRef">
|
|
198
361
|
<template v-if="actionBarOptList?.length && !hasActionBarSlot">
|
|
@@ -631,6 +794,7 @@ import {
|
|
|
631
794
|
import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
632
795
|
import { CachedManager, resolveValue } from '@94ai/common-utils'
|
|
633
796
|
import { useRoute } from 'vue-router/composables'
|
|
797
|
+
import VirtualScroll, { VirtualColumn } from 'el-table-virtual-scroll'
|
|
634
798
|
|
|
635
799
|
const props = withDefaults(defineProps<{
|
|
636
800
|
data?: Record<string, any>[],
|
|
@@ -746,8 +910,11 @@ const props = withDefaults(defineProps<{
|
|
|
746
910
|
/**
|
|
747
911
|
* 操作列属性key
|
|
748
912
|
*/
|
|
749
|
-
operationPropKey?: string
|
|
750
|
-
drawerProps?: Record<string, any
|
|
913
|
+
operationPropKey?: string,
|
|
914
|
+
drawerProps?: Record<string, any>,
|
|
915
|
+
virtualized?: boolean,
|
|
916
|
+
virtualTableData?: Record<string, any>[],
|
|
917
|
+
virtualProps?: Record<string, any>,
|
|
751
918
|
}>(), {
|
|
752
919
|
dragCached: true,
|
|
753
920
|
emptyImageSize: 145,
|
|
@@ -820,7 +987,10 @@ const props = withDefaults(defineProps<{
|
|
|
820
987
|
columnCheckBasicFieldDesc: '基础字段',
|
|
821
988
|
columnCheckGetCheckedLengthDesc: (length) => (length) => '已选(' + length + ')',
|
|
822
989
|
columnCheckGetAllCheckDesc: (length) => (length) => '全选(' + length + ')',
|
|
823
|
-
drawerProps: () => ({})
|
|
990
|
+
drawerProps: () => ({}),
|
|
991
|
+
virtualized: false,
|
|
992
|
+
virtualTableData: () => [],
|
|
993
|
+
virtualProps: () => ({}),
|
|
824
994
|
})
|
|
825
995
|
|
|
826
996
|
const emit = defineEmits<{
|
|
@@ -1448,7 +1618,7 @@ const resizeTable = () => {
|
|
|
1448
1618
|
}
|
|
1449
1619
|
if (hasRightFixed) {
|
|
1450
1620
|
/** 右侧固定table */
|
|
1451
|
-
const eleChildrenFixRight = childrenEle[4].children[1].children[0].children[1].children
|
|
1621
|
+
const eleChildrenFixRight = childrenEle[hasLeftFixed ? 4 : 3].children[1].children[0].children[1].children
|
|
1452
1622
|
eleChildrenFixRight[i].style.height = offsetHeight
|
|
1453
1623
|
}
|
|
1454
1624
|
}
|
|
@@ -1463,6 +1633,19 @@ const resizeTable = () => {
|
|
|
1463
1633
|
}
|
|
1464
1634
|
}
|
|
1465
1635
|
|
|
1636
|
+
// 动态绑定包裹组件属性
|
|
1637
|
+
const wrapperProps = computed(() => {
|
|
1638
|
+
return {
|
|
1639
|
+
data: props.virtualTableData,
|
|
1640
|
+
...props.virtualProps
|
|
1641
|
+
}
|
|
1642
|
+
})
|
|
1643
|
+
|
|
1644
|
+
const tableData = ref([])
|
|
1645
|
+
const handleVirtualChange = (scrollData) => {
|
|
1646
|
+
tableData.value = scrollData
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1466
1649
|
onMounted(() => {
|
|
1467
1650
|
calcTableHeight()
|
|
1468
1651
|
props.columns.forEach(i => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-table",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.3",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^8.
|
|
18
|
-
"@94ai/nf-button": "^8.
|
|
19
|
-
"@94ai/nf-drawer": "^8.
|
|
20
|
-
"@94ai/nf-message": "^8.
|
|
21
|
-
"@94ai/nf-search-form": "^8.
|
|
22
|
-
"@94ai/nf-tag": "^8.
|
|
23
|
-
"@94ai/nf-theme-chalk": "^8.
|
|
17
|
+
"@94ai/common-utils": "^8.1.3",
|
|
18
|
+
"@94ai/nf-button": "^8.1.3",
|
|
19
|
+
"@94ai/nf-drawer": "^8.1.3",
|
|
20
|
+
"@94ai/nf-message": "^8.1.3",
|
|
21
|
+
"@94ai/nf-search-form": "^8.1.3",
|
|
22
|
+
"@94ai/nf-tag": "^8.1.3",
|
|
23
|
+
"@94ai/nf-theme-chalk": "^8.1.3",
|
|
24
24
|
"idb-keyval": "^6.2.1",
|
|
25
25
|
"vue-demi": "^0.14.5",
|
|
26
26
|
"vue-router": "3.6.4",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"types": "lib/index.d.ts",
|
|
40
40
|
"main": "lib/nf-table.cjs.js",
|
|
41
41
|
"module": "lib/nf-table.esm-bundler.js",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "08b324ed6423437b6c6280137ce6bef1c11a441a"
|
|
43
43
|
}
|