@yidun/antd-super-table 0.1.9 → 0.1.10
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/README.md +21 -13
- package/dist/index.js +736 -725
- package/dist/interface.d.ts +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/example/index.vue +51 -0
- package/example/tableColumns.ts +8 -0
- package/package.json +1 -1
package/dist/interface.d.ts
CHANGED
|
@@ -144,6 +144,9 @@ export interface SuperTableColumn {
|
|
|
144
144
|
/** 表格内容解析用到的组件对应的props */
|
|
145
145
|
props?: Record<string, any> | ((row: SuperTableDataItem, index: number) => Record<string, any>)
|
|
146
146
|
|
|
147
|
+
/** 自定义单元格插槽名,命中后优先使用具名插槽渲染 */
|
|
148
|
+
slotName?: string
|
|
149
|
+
|
|
147
150
|
/** 是否可复制 */
|
|
148
151
|
copyable?: boolean
|
|
149
152
|
|
|
@@ -428,6 +431,9 @@ export interface SuperTableSlots {
|
|
|
428
431
|
tableFoot?: () => any
|
|
429
432
|
/** 展开行内容插槽 */
|
|
430
433
|
expandedRowRender?: (props: { record: any }) => any
|
|
434
|
+
|
|
435
|
+
/** 自定义单元格具名插槽 */
|
|
436
|
+
[slotName: string]: ((props?: Record<string, any>) => any) | undefined
|
|
431
437
|
}
|
|
432
438
|
|
|
433
439
|
/**
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const initTableColumns: (columns: SuperTableColumn[]) => {
|
|
|
52
52
|
content?: string | ((row: import("..").SuperTableDataItem, index: number) => any);
|
|
53
53
|
tooltip?: string | boolean | ((row: import("..").SuperTableDataItem, index: number) => string);
|
|
54
54
|
props?: Record<string, any> | ((row: import("..").SuperTableDataItem, index: number) => Record<string, any>);
|
|
55
|
+
slotName?: string;
|
|
55
56
|
copyable?: boolean;
|
|
56
57
|
fixed?: import("..").SuperTableColumnFixedType;
|
|
57
58
|
sorter?: boolean | ((a: import("..").SuperTableDataItem, b: import("..").SuperTableDataItem) => number);
|
package/example/index.vue
CHANGED
|
@@ -443,6 +443,29 @@ onMounted(() => {
|
|
|
443
443
|
>
|
|
444
444
|
<div :class="$style.block">tableFoot</div>
|
|
445
445
|
</template>
|
|
446
|
+
<template #customBodyCell="{ record, index }">
|
|
447
|
+
<div :class="$style.customCellList">
|
|
448
|
+
<div :class="$style.customCellHeader">
|
|
449
|
+
<a-tag color="purple">插槽</a-tag>
|
|
450
|
+
<span :class="$style.customCellTitle">第 {{ index + 1 }} 行</span>
|
|
451
|
+
</div>
|
|
452
|
+
<div :class="$style.customCellItem">
|
|
453
|
+
<a-badge status="processing" />
|
|
454
|
+
<span :class="$style.customCellText">{{ record?.text || '-' }}</span>
|
|
455
|
+
<a-button
|
|
456
|
+
type="link"
|
|
457
|
+
size="small"
|
|
458
|
+
>
|
|
459
|
+
复制
|
|
460
|
+
</a-button>
|
|
461
|
+
</div>
|
|
462
|
+
<div :class="$style.customCellItem">
|
|
463
|
+
<a-badge status="success" />
|
|
464
|
+
<span :class="$style.customCellText">元素 B ⭐</span>
|
|
465
|
+
<a-tag color="green">生效</a-tag>
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
</template>
|
|
446
469
|
</super-table>
|
|
447
470
|
</div>
|
|
448
471
|
</template>
|
|
@@ -464,4 +487,32 @@ onMounted(() => {
|
|
|
464
487
|
.form {
|
|
465
488
|
padding: 16px;
|
|
466
489
|
}
|
|
490
|
+
|
|
491
|
+
.customCellList {
|
|
492
|
+
display: flex;
|
|
493
|
+
flex-direction: column;
|
|
494
|
+
gap: 6px;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.customCellHeader {
|
|
498
|
+
display: flex;
|
|
499
|
+
align-items: center;
|
|
500
|
+
gap: 8px;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.customCellTitle {
|
|
504
|
+
color: #595959;
|
|
505
|
+
font-size: 12px;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.customCellItem {
|
|
509
|
+
display: flex;
|
|
510
|
+
align-items: center;
|
|
511
|
+
gap: 8px;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.customCellText {
|
|
515
|
+
flex: 1;
|
|
516
|
+
color: #262626;
|
|
517
|
+
}
|
|
467
518
|
</style>
|
package/example/tableColumns.ts
CHANGED
|
@@ -135,6 +135,14 @@ export const createTableColumns = (options: {
|
|
|
135
135
|
},
|
|
136
136
|
},
|
|
137
137
|
},
|
|
138
|
+
{
|
|
139
|
+
key: 'customSlotCell',
|
|
140
|
+
title: '自定义插槽',
|
|
141
|
+
type: 'text',
|
|
142
|
+
content: 'text',
|
|
143
|
+
width: 180,
|
|
144
|
+
slotName: 'customBodyCell',
|
|
145
|
+
},
|
|
138
146
|
{
|
|
139
147
|
key: 'status',
|
|
140
148
|
title: '状态',
|