@tdesign/uniapp 0.8.1 → 0.9.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/CHANGELOG.md +14 -0
- package/dist/badge/README.en-US.md +1 -0
- package/dist/badge/README.md +1 -0
- package/dist/badge/badge.css +1 -1
- package/dist/button/button.vue +5 -0
- package/dist/calendar/calendar.vue +6 -2
- package/dist/common/style/theme/index-light.css +282 -0
- package/dist/common/style/theme/index-light.less +9 -0
- package/dist/common/style/theme/raw/_components-light.less +8 -0
- package/dist/common/style/theme/raw/_light-only.less +181 -0
- package/dist/dropdown-item/dropdown-item.vue +2 -0
- package/dist/dropdown-menu/dropdown-menu.vue +1 -1
- package/dist/fab/fab.vue +2 -2
- package/dist/fab/props.ts +1 -1
- package/dist/fab/type.ts +1 -1
- package/dist/form-item/form-item.css +2 -2
- package/dist/form-item/form-item.vue +28 -21
- package/dist/indexes/computed.js +6 -2
- package/dist/indexes/indexes.css +7 -2
- package/dist/indexes/indexes.vue +1 -1
- package/dist/indexes/props.ts +5 -0
- package/dist/indexes/type.ts +5 -0
- package/dist/input/input.vue +8 -6
- package/dist/search/search.css +5 -0
- package/dist/search/search.vue +7 -12
- package/dist/segmented/README.en-US.md +42 -0
- package/dist/segmented/README.md +75 -0
- package/dist/segmented/props.ts +31 -0
- package/dist/segmented/segmented.css +66 -0
- package/dist/segmented/segmented.vue +174 -0
- package/dist/segmented/type.ts +41 -0
- package/dist/tab-bar-item/tab-bar-item.vue +4 -6
- package/dist/table/README.en-US.md +72 -0
- package/dist/table/README.md +117 -0
- package/dist/table/base-table-props.ts +105 -0
- package/dist/table/props.ts +94 -0
- package/dist/table/table.css +251 -0
- package/dist/table/table.vue +551 -0
- package/dist/table/type.ts +180 -0
- package/dist/tabs/tabs.css +4 -0
- package/dist/theme-light.css +282 -0
- package/dist/theme-light.css.d.ts +2 -0
- package/dist/theme-light.less +1 -0
- package/dist/theme-light.less.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/segmented.d.ts +7 -0
- package/dist/types/table.d.ts +7 -0
- package/global.d.ts +2 -0
- package/package.json +33 -9
- package/{dist/script → script}/postinstall.js +18 -2
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
:style="'' + tools._style([customStyle])"
|
|
4
|
-
:class="'' + tools.cls(classPrefix, [
|
|
5
|
-
['split', split],
|
|
6
|
-
['crowded', crowded], shape]
|
|
7
|
-
) + ' ' + tClass"
|
|
4
|
+
:class="'' + tools.cls(classPrefix, [['split', split], ['crowded', crowded], shape]) + ' ' + tClass"
|
|
8
5
|
>
|
|
9
6
|
<view
|
|
10
7
|
:class="'' + tools.cls(classPrefix + '__content', [['checked', isChecked], theme])"
|
|
@@ -23,10 +20,12 @@
|
|
|
23
20
|
>
|
|
24
21
|
<t-badge
|
|
25
22
|
v-if="badgeProps.dot || badgeProps.count"
|
|
23
|
+
:color="badgeProps.color || ''"
|
|
26
24
|
:count="badgeProps.count || 0"
|
|
27
25
|
:max-count="badgeProps.maxCount || 99"
|
|
28
26
|
:dot="badgeProps.dot || false"
|
|
29
27
|
:content="badgeProps.content || ''"
|
|
28
|
+
:shape="badgeProps.shape || 'circle'"
|
|
30
29
|
:size="badgeProps.size || 'medium'"
|
|
31
30
|
:visible="badgeProps.visible"
|
|
32
31
|
:offset="badgeProps.offset || [0, 0]"
|
|
@@ -86,7 +85,7 @@
|
|
|
86
85
|
:class="classPrefix + '__spread'"
|
|
87
86
|
>
|
|
88
87
|
<view
|
|
89
|
-
v-for="(child, index) in
|
|
88
|
+
v-for="(child, index) in subTabBar || []"
|
|
90
89
|
:key="index"
|
|
91
90
|
:class="classPrefix + '__spread-item'"
|
|
92
91
|
:hover-class="classPrefix + '__spread-item--active'"
|
|
@@ -122,7 +121,6 @@ import { ChildrenMixin, RELATION_MAP } from '../common/relation';
|
|
|
122
121
|
|
|
123
122
|
const classPrefix = `${prefix}-tab-bar-item`;
|
|
124
123
|
|
|
125
|
-
|
|
126
124
|
export default {
|
|
127
125
|
components: {
|
|
128
126
|
TIcon,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
:: BASE_DOC ::
|
|
2
|
+
|
|
3
|
+
## API
|
|
4
|
+
|
|
5
|
+
### BaseTable Props
|
|
6
|
+
|
|
7
|
+
name | type | default | description | required
|
|
8
|
+
-- | -- | -- | -- | --
|
|
9
|
+
custom-style | Object | - | CSS(Cascading Style Sheets) | N
|
|
10
|
+
bordered | Boolean | false | show table bordered | N
|
|
11
|
+
cell-empty-content | String | - | \- | N
|
|
12
|
+
columns | Array | [] | table column configs。Typescript: `Array<BaseTableCol<T>>` | N
|
|
13
|
+
data | Array | [] | table data。Typescript: `Array<T>` | N
|
|
14
|
+
empty | String | '' | empty text or empty element | N
|
|
15
|
+
fixed-rows | Array | - | Typescript: `Array<number>` | N
|
|
16
|
+
footer-summary | String | - | footer summary content | N
|
|
17
|
+
height | String / Number | - | table height | N
|
|
18
|
+
loading | Boolean | undefined | loading state table | N
|
|
19
|
+
loading-props | Object | - | Typescript: `Partial<LoadingProps>`,[Loading API Documents](./loading?tab=api)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
20
|
+
max-height | String / Number | - | table max height | N
|
|
21
|
+
row-key | String | 'id' | required。unique key for each row data | Y
|
|
22
|
+
rowspan-and-colspan | Function | - | rowspan and colspan。Typescript: `TableRowspanAndColspanFunc<T>` `type TableRowspanAndColspanFunc<T extends TableRowData = TableRowData> = (params: BaseTableCellParams<T>) => RowspanColspan` `interface RowspanColspan { colspan?: number; rowspan?: number }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
23
|
+
show-header | Boolean | true | show table header | N
|
|
24
|
+
stripe | Boolean | false | show stripe style | N
|
|
25
|
+
table-content-width | String | - | \- | N
|
|
26
|
+
table-layout | String | fixed | table-layout css properties, [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout). set value to be `fixed` on `resizable=true` please。options: auto/fixed | N
|
|
27
|
+
vertical-align | String | middle | vertical align。options: top/middle/bottom | N
|
|
28
|
+
|
|
29
|
+
### BaseTable Events
|
|
30
|
+
|
|
31
|
+
name | params | description
|
|
32
|
+
-- | -- | --
|
|
33
|
+
cell-click | `(context: BaseTableCellEventContext<T>)` | trigger on cell clicked。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts)。<br/>`interface BaseTableCellEventContext<T extends TableRowData = TableRowData> { row: T; col: BaseTableCol<T>; rowIndex: number; colIndex: number; e: MouseEvent }`<br/>
|
|
34
|
+
row-click | `(context: RowEventContext<T>)` | trigger on row click。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts)。<br/>`interface RowEventContext<T extends TableRowData = TableRowData> { row: T; index: number; e: MouseEvent }`<br/>
|
|
35
|
+
|
|
36
|
+
### BaseTable Slots
|
|
37
|
+
|
|
38
|
+
name | Description
|
|
39
|
+
-- | --
|
|
40
|
+
cell-empty-content | \-
|
|
41
|
+
empty | empty text or empty element
|
|
42
|
+
footer-summary | footer summary content
|
|
43
|
+
loading | loading state table
|
|
44
|
+
|
|
45
|
+
### BaseTableCol
|
|
46
|
+
|
|
47
|
+
name | type | default | description | required
|
|
48
|
+
-- | -- | -- | -- | --
|
|
49
|
+
align | String | left | align type。options: left/right/center | N
|
|
50
|
+
cell | String / Function | - | use cell to render table cell。Typescript: `string \| ((params: BaseTableCellParams<T>) => string)` `interface BaseTableCellParams<T extends TableRowData = TableRowData> { row: T; rowIndex: number; col: BaseTableCol<T>; colIndex: number }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
51
|
+
class-name | String / Object / Array / Function | - | cell classnames。Typescript: `TableColumnClassName<T> \| TableColumnClassName<T>[]` `type TableColumnClassName<T extends TableRowData = TableRowData> = ClassName \| ((context: CellData<T>) => ClassName)` `interface CellData<T extends TableRowData = TableRowData> extends BaseTableCellParams<T> { type: 'th' \| 'td' }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/common/common.ts)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
52
|
+
col-key | String | - | unique key for column | N
|
|
53
|
+
fixed | String | left | fixed current column to left or right。options: left/right | N
|
|
54
|
+
min-width | String / Number | - | add CSS property `min-width` to HTML Element `<col>`,Browsers with [TablesNG](https://docs.google.com/document/d/16PFD1GtMI9Zgwu0jtPaKZJ75Q2wyZ9EZnVbBacOfiNA/preview) support `minWidth` | N
|
|
55
|
+
width | String / Number | - | column width | N
|
|
56
|
+
|
|
57
|
+
### CSS Variables
|
|
58
|
+
|
|
59
|
+
The component provides the following CSS variables, which can be used to customize styles.
|
|
60
|
+
Name | Default Value | Description
|
|
61
|
+
-- | -- | --
|
|
62
|
+
--td-table-body-text-color | @text-color-primary | -
|
|
63
|
+
--td-table-border-color | @component-border | -
|
|
64
|
+
--td-table-fixed-cell-border-color | @component-border | -
|
|
65
|
+
--td-table-font-size | @font-body-medium | -
|
|
66
|
+
--td-table-header-bg-color | @bg-color-container | -
|
|
67
|
+
--td-table-header-text-color | @text-color-placeholder | -
|
|
68
|
+
--td-table-loading-bg-color | rgba(255, 255, 255, 0.55) | -
|
|
69
|
+
--td-table-row-height | 41px | -
|
|
70
|
+
--td-table-stripe-bg-color | @bg-color-secondarycontainer | -
|
|
71
|
+
--td-table-td-padding | 8px 12px | -
|
|
72
|
+
--td-table-th-padding | 8px 12px | -
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Table 表格
|
|
3
|
+
description: 表格常用于展示同类结构下的多种数据,易于组织、对比和分析等,并可对数据进行搜索、筛选、排序等操作。一般包括表头、数据行和表尾三部分。
|
|
4
|
+
spline: data
|
|
5
|
+
isComponent: true
|
|
6
|
+
toc: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<div style="background: #ecf2fe; display: flex; align-items: center; line-height: 20px; padding: 14px 24px; border-radius: 3px; color: #555a65">
|
|
10
|
+
<svg fill="none" viewBox="0 0 16 16" width="16px" height="16px" style="margin-right: 5px">
|
|
11
|
+
<path fill="#0052d9" d="M8 15A7 7 0 108 1a7 7 0 000 14zM7.4 4h1.2v1.2H7.4V4zm.1 2.5h1V12h-1V6.5z" fillOpacity="0.9"></path>
|
|
12
|
+
</svg>
|
|
13
|
+
该组件于 0.9.0 版本上线,请留意版本。
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## 引入
|
|
17
|
+
|
|
18
|
+
可在 `main.ts` 或在需要使用的页面或组件中引入。
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import TTable from '@tdesign/uniapp/table/table.vue';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 代码演示
|
|
25
|
+
|
|
26
|
+
### 组件类型
|
|
27
|
+
|
|
28
|
+
#### 基础表格
|
|
29
|
+
|
|
30
|
+
{{ base }}
|
|
31
|
+
|
|
32
|
+
#### 横向平铺可滚动表格
|
|
33
|
+
|
|
34
|
+
{{ scroll }}
|
|
35
|
+
|
|
36
|
+
#### 带斑马纹表格样式
|
|
37
|
+
|
|
38
|
+
{{ stripe }}
|
|
39
|
+
|
|
40
|
+
#### 带边框表格样式
|
|
41
|
+
|
|
42
|
+
{{ bordered }}
|
|
43
|
+
|
|
44
|
+
#### 带合并单元格的表格
|
|
45
|
+
|
|
46
|
+
{{ rowspan-colspan }}
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
### BaseTable Props
|
|
51
|
+
|
|
52
|
+
名称 | 类型 | 默认值 | 描述 | 必传
|
|
53
|
+
-- | -- | -- | -- | --
|
|
54
|
+
custom-style | Object | - | 自定义样式 | N
|
|
55
|
+
bordered | Boolean | false | 是否显示表格边框 | N
|
|
56
|
+
cell-empty-content | String | - | 单元格数据为空时呈现的内容 | N
|
|
57
|
+
columns | Array | [] | 列配置,泛型 T 指表格数据类型。TS 类型:`Array<BaseTableCol<T>>` | N
|
|
58
|
+
data | Array | [] | 数据源,泛型 T 指表格数据类型。TS 类型:`Array<T>` | N
|
|
59
|
+
empty | String | '' | 空表格呈现样式,支持全局配置 `GlobalConfigProvider` | N
|
|
60
|
+
fixed-rows | Array | - | 固定行(冻结行),示例:[M, N],表示冻结表头 M 行和表尾 N 行。M 和 N 值为 0 时,表示不冻结行。TS 类型:`Array<number>` | N
|
|
61
|
+
footer-summary | String | - | 表尾总结行 | N
|
|
62
|
+
height | String / Number | - | 表格高度,超出后会出现滚动条。示例:100, '30%', '300'。值为数字类型,会自动加上单位 px。如果不是绝对固定表格高度,建议使用 `maxHeight` | N
|
|
63
|
+
loading | Boolean | undefined | 加载中状态。值为 `true` 会显示默认加载中样式,可以通过 Function 和 插槽 自定义加载状态呈现内容和样式。值为 `false` 则会取消加载状态 | N
|
|
64
|
+
loading-props | Object | - | 透传加载组件全部属性。TS 类型:`Partial<LoadingProps>`,[Loading API Documents](./loading?tab=api)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
65
|
+
max-height | String / Number | - | 表格最大高度,超出后会出现滚动条。示例:100, '30%', '300'。值为数字类型,会自动加上单位 px | N
|
|
66
|
+
row-key | String | 'id' | 必需。唯一标识一行数据的字段名,来源于 `data` 中的字段。如果是字段嵌套多层,可以设置形如 `item.a.id` 的方法 | Y
|
|
67
|
+
rowspan-and-colspan | Function | - | 用于自定义合并单元格,泛型 T 指表格数据类型。示例:`({ row, col, rowIndex, colIndex }) => { rowspan: 2, colspan: 3 }`。TS 类型:`TableRowspanAndColspanFunc<T>` `type TableRowspanAndColspanFunc<T extends TableRowData = TableRowData> = (params: BaseTableCellParams<T>) => RowspanColspan` `interface RowspanColspan { colspan?: number; rowspan?: number }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
68
|
+
show-header | Boolean | true | 是否显示表头 | N
|
|
69
|
+
stripe | Boolean | false | 是否显示斑马纹 | N
|
|
70
|
+
table-content-width | String | - | 表格内容的总宽度,注意不是表格可见宽度。主要应用于 `table-layout: auto` 模式下的固定列显示。`tableContentWidth` 内容宽度的值必须大于表格可见宽度 | N
|
|
71
|
+
table-layout | String | fixed | 表格布局方式。可选项:auto/fixed | N
|
|
72
|
+
vertical-align | String | middle | 行内容上下方向对齐。可选项:top/middle/bottom | N
|
|
73
|
+
|
|
74
|
+
### BaseTable Events
|
|
75
|
+
|
|
76
|
+
名称 | 参数 | 描述
|
|
77
|
+
-- | -- | --
|
|
78
|
+
cell-click | `(context: BaseTableCellEventContext<T>)` | 单元格点击时触发。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts)。<br/>`interface BaseTableCellEventContext<T extends TableRowData = TableRowData> { row: T; col: BaseTableCol<T>; rowIndex: number; colIndex: number; e: MouseEvent }`<br/>
|
|
79
|
+
row-click | `(context: RowEventContext<T>)` | 行点击时触发,泛型 T 指表格数据类型。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts)。<br/>`interface RowEventContext<T extends TableRowData = TableRowData> { row: T; index: number; e: MouseEvent }`<br/>
|
|
80
|
+
|
|
81
|
+
### BaseTable Slots
|
|
82
|
+
|
|
83
|
+
名称 | 描述
|
|
84
|
+
-- | --
|
|
85
|
+
cell-empty-content | 自定义 `cell-empty-content` 显示内容
|
|
86
|
+
empty | 自定义 `empty` 显示内容
|
|
87
|
+
footer-summary | 自定义 `footer-summary` 显示内容
|
|
88
|
+
loading | 自定义 `loading` 显示内容
|
|
89
|
+
|
|
90
|
+
### BaseTableCol
|
|
91
|
+
|
|
92
|
+
名称 | 类型 | 默认值 | 描述 | 必传
|
|
93
|
+
-- | -- | -- | -- | --
|
|
94
|
+
align | String | left | 列横向对齐方式。可选项:left/right/center | N
|
|
95
|
+
cell | String / Function | - | 自定义单元格渲染。默认使用 `colKey` 的值作为自定义当前列的插槽名称。<br/>如果 `cell` 值类型为 Function 表示以函数形式渲染单元格。值类型为 string 表示使用插槽渲染,插槽名称为 cell 的值。优先级高于 `render`。泛型 T 指表格数据类型。TS 类型:`string \| ((params: BaseTableCellParams<T>) => string)` `interface BaseTableCellParams<T extends TableRowData = TableRowData> { row: T; rowIndex: number; col: BaseTableCol<T>; colIndex: number }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
96
|
+
class-name | String / Object / Array / Function | - | 列类名,值类型是 Function 使用返回值作为列类名;值类型不为 Function 时,值用于整列类名(含表头)。泛型 T 指表格数据类型。TS 类型:`TableColumnClassName<T> \| TableColumnClassName<T>[]` `type TableColumnClassName<T extends TableRowData = TableRowData> = ClassName \| ((context: CellData<T>) => ClassName)` `interface CellData<T extends TableRowData = TableRowData> extends BaseTableCellParams<T> { type: 'th' \| 'td' }`。[通用类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/common/common.ts)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/table/type.ts) | N
|
|
97
|
+
col-key | String | - | 渲染列所需字段,值为 `serial-number` 表示当前列为「序号」列 | N
|
|
98
|
+
fixed | String | left | 固定列显示位置。可选项:left/right | N
|
|
99
|
+
min-width | String / Number | - | 透传 CSS 属性 `min-width` 到 `<col>` 元素。⚠️ 仅少部分浏览器支持,如:使用 [TablesNG](https://docs.google.com/document/d/16PFD1GtMI9Zgwu0jtPaKZJ75Q2wyZ9EZnVbBacOfiNA/preview) 渲染的 Chrome 浏览器支持 `minWidth` | N
|
|
100
|
+
width | String / Number | - | 列宽,可以作为最小宽度使用。当列宽总和小于 `table` 元素时,浏览器根据宽度设置情况自动分配宽度;当列宽总和大于 `table` 元素,表现为定宽。可以同时调整 `table` 元素的宽度来达到自己想要的效果 | N
|
|
101
|
+
|
|
102
|
+
### CSS Variables
|
|
103
|
+
|
|
104
|
+
组件提供了下列 CSS 变量,可用于自定义样式。
|
|
105
|
+
名称 | 默认值 | 描述
|
|
106
|
+
-- | -- | --
|
|
107
|
+
--td-table-body-text-color | @text-color-primary | -
|
|
108
|
+
--td-table-border-color | @component-border | -
|
|
109
|
+
--td-table-fixed-cell-border-color | @component-border | -
|
|
110
|
+
--td-table-font-size | @font-body-medium | -
|
|
111
|
+
--td-table-header-bg-color | @bg-color-container | -
|
|
112
|
+
--td-table-header-text-color | @text-color-placeholder | -
|
|
113
|
+
--td-table-loading-bg-color | rgba(255, 255, 255, 0.55) | -
|
|
114
|
+
--td-table-row-height | 41px | -
|
|
115
|
+
--td-table-stripe-bg-color | @bg-color-secondarycontainer | -
|
|
116
|
+
--td-table-td-padding | 8px 12px | -
|
|
117
|
+
--td-table-th-padding | 8px 12px | -
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
|
5
|
+
* */
|
|
6
|
+
|
|
7
|
+
import type { TdBaseTableProps } from '../table/type';
|
|
8
|
+
export default {
|
|
9
|
+
/** 是否显示表格边框 */
|
|
10
|
+
bordered: Boolean,
|
|
11
|
+
/** 单元格数据为空时呈现的内容 */
|
|
12
|
+
cellEmptyContent: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
/** 列配置,泛型 T 指表格数据类型 */
|
|
16
|
+
columns: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: (): TdBaseTableProps['columns'] => [],
|
|
19
|
+
},
|
|
20
|
+
/** 数据源,泛型 T 指表格数据类型 */
|
|
21
|
+
data: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: (): TdBaseTableProps['data'] => [],
|
|
24
|
+
},
|
|
25
|
+
/** 空表格呈现样式,支持全局配置 `GlobalConfigProvider` */
|
|
26
|
+
empty: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '' as TdBaseTableProps['empty'],
|
|
29
|
+
},
|
|
30
|
+
/** 固定行(冻结行),示例:[M, N],表示冻结表头 M 行和表尾 N 行。M 和 N 值为 0 时,表示不冻结行 */
|
|
31
|
+
fixedRows: {
|
|
32
|
+
type: Array,
|
|
33
|
+
},
|
|
34
|
+
/** 表尾总结行 */
|
|
35
|
+
footerSummary: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
/** 表格高度,超出后会出现滚动条。示例:100, '30%', '300'。值为数字类型,会自动加上单位 px。如果不是绝对固定表格高度,建议使用 `maxHeight` */
|
|
39
|
+
height: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
},
|
|
42
|
+
/** 加载中状态。值为 `true` 会显示默认加载中样式,可以通过 Function 和 插槽 自定义加载状态呈现内容和样式。值为 `false` 则会取消加载状态 */
|
|
43
|
+
loading: {
|
|
44
|
+
type: [Boolean, null],
|
|
45
|
+
default: null as TdBaseTableProps['loading'],
|
|
46
|
+
},
|
|
47
|
+
/** 透传加载组件全部属性 */
|
|
48
|
+
loadingProps: {
|
|
49
|
+
type: Object,
|
|
50
|
+
},
|
|
51
|
+
/** 表格最大高度,超出后会出现滚动条。示例:100, '30%', '300'。值为数字类型,会自动加上单位 px */
|
|
52
|
+
maxHeight: {
|
|
53
|
+
type: [String, Number],
|
|
54
|
+
},
|
|
55
|
+
/** 唯一标识一行数据的字段名,来源于 `data` 中的字段。如果是字段嵌套多层,可以设置形如 `item.a.id` 的方法 */
|
|
56
|
+
rowKey: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'id',
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
/** 用于自定义合并单元格,泛型 T 指表格数据类型。示例:`({ row, col, rowIndex, colIndex }) => { rowspan: 2, colspan: 3 }` */
|
|
62
|
+
rowspanAndColspan: {
|
|
63
|
+
type: Function,
|
|
64
|
+
},
|
|
65
|
+
/** 是否显示表头 */
|
|
66
|
+
showHeader: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true,
|
|
69
|
+
},
|
|
70
|
+
/** 是否显示斑马纹 */
|
|
71
|
+
stripe: Boolean,
|
|
72
|
+
/** 表格内容的总宽度,注意不是表格可见宽度。主要应用于 `table-layout: auto` 模式下的固定列显示。`tableContentWidth` 内容宽度的值必须大于表格可见宽度 */
|
|
73
|
+
tableContentWidth: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '',
|
|
76
|
+
},
|
|
77
|
+
/** 表格布局方式 */
|
|
78
|
+
tableLayout: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: 'fixed' as TdBaseTableProps['tableLayout'],
|
|
81
|
+
validator(val: TdBaseTableProps['tableLayout']): boolean {
|
|
82
|
+
if (!val) return true;
|
|
83
|
+
return ['auto', 'fixed'].includes(val);
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
/** 行内容上下方向对齐 */
|
|
87
|
+
verticalAlign: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'middle' as TdBaseTableProps['verticalAlign'],
|
|
90
|
+
validator(val: TdBaseTableProps['verticalAlign']): boolean {
|
|
91
|
+
if (!val) return true;
|
|
92
|
+
return ['top', 'middle', 'bottom'].includes(val);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
/** 单元格点击时触发 */
|
|
96
|
+
onCellClick: {
|
|
97
|
+
type: Function,
|
|
98
|
+
default: () => ({}),
|
|
99
|
+
},
|
|
100
|
+
/** 行点击时触发,泛型 T 指表格数据类型 */
|
|
101
|
+
onRowClick: {
|
|
102
|
+
type: Function,
|
|
103
|
+
default: () => ({}),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
|
5
|
+
* */
|
|
6
|
+
|
|
7
|
+
import type { TdBaseTableProps } from '../table/type';
|
|
8
|
+
export default {
|
|
9
|
+
/** 是否显示表格边框 */
|
|
10
|
+
bordered: Boolean,
|
|
11
|
+
/** 单元格数据为空时呈现的内容 */
|
|
12
|
+
cellEmptyContent: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
/** 列配置,泛型 T 指表格数据类型 */
|
|
16
|
+
columns: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: (): TdBaseTableProps['columns'] => [],
|
|
19
|
+
},
|
|
20
|
+
/** 数据源,泛型 T 指表格数据类型 */
|
|
21
|
+
data: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: (): TdBaseTableProps['data'] => [],
|
|
24
|
+
},
|
|
25
|
+
/** 空表格呈现样式,支持全局配置 `GlobalConfigProvider` */
|
|
26
|
+
empty: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '' as TdBaseTableProps['empty'],
|
|
29
|
+
},
|
|
30
|
+
/** 固定行(冻结行),示例:[M, N],表示冻结表头 M 行和表尾 N 行。M 和 N 值为 0 时,表示不冻结行 */
|
|
31
|
+
fixedRows: {
|
|
32
|
+
type: Array,
|
|
33
|
+
},
|
|
34
|
+
/** 表尾总结行 */
|
|
35
|
+
footerSummary: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
/** 表格高度,超出后会出现滚动条。示例:100, '30%', '300'。值为数字类型,会自动加上单位 px。如果不是绝对固定表格高度,建议使用 `maxHeight` */
|
|
39
|
+
height: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
},
|
|
42
|
+
/** 加载中状态。值为 `true` 会显示默认加载中样式,可以通过 Function 和 插槽 自定义加载状态呈现内容和样式。值为 `false` 则会取消加载状态 */
|
|
43
|
+
loading: {
|
|
44
|
+
type: [Boolean, null],
|
|
45
|
+
default: null as TdBaseTableProps['loading'],
|
|
46
|
+
},
|
|
47
|
+
/** 透传加载组件全部属性 */
|
|
48
|
+
loadingProps: {
|
|
49
|
+
type: Object,
|
|
50
|
+
},
|
|
51
|
+
/** 表格最大高度,超出后会出现滚动条。示例:100, '30%', '300'。值为数字类型,会自动加上单位 px */
|
|
52
|
+
maxHeight: {
|
|
53
|
+
type: [String, Number],
|
|
54
|
+
},
|
|
55
|
+
/** 唯一标识一行数据的字段名,来源于 `data` 中的字段。如果是字段嵌套多层,可以设置形如 `item.a.id` 的方法 */
|
|
56
|
+
rowKey: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'id',
|
|
59
|
+
},
|
|
60
|
+
/** 用于自定义合并单元格,泛型 T 指表格数据类型。示例:`({ row, col, rowIndex, colIndex }) => { rowspan: 2, colspan: 3 }` */
|
|
61
|
+
rowspanAndColspan: {
|
|
62
|
+
type: Function,
|
|
63
|
+
},
|
|
64
|
+
/** 是否显示表头 */
|
|
65
|
+
showHeader: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true,
|
|
68
|
+
},
|
|
69
|
+
/** 是否显示斑马纹 */
|
|
70
|
+
stripe: Boolean,
|
|
71
|
+
/** 表格内容的总宽度,注意不是表格可见宽度。主要应用于 `table-layout: auto` 模式下的固定列显示。`tableContentWidth` 内容宽度的值必须大于表格可见宽度 */
|
|
72
|
+
tableContentWidth: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: '',
|
|
75
|
+
},
|
|
76
|
+
/** 表格布局方式 */
|
|
77
|
+
tableLayout: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'fixed' as TdBaseTableProps['tableLayout'],
|
|
80
|
+
validator(val: TdBaseTableProps['tableLayout']): boolean {
|
|
81
|
+
if (!val) return true;
|
|
82
|
+
return ['auto', 'fixed'].includes(val);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
/** 行内容上下方向对齐 */
|
|
86
|
+
verticalAlign: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'middle' as TdBaseTableProps['verticalAlign'],
|
|
89
|
+
validator(val: TdBaseTableProps['verticalAlign']): boolean {
|
|
90
|
+
if (!val) return true;
|
|
91
|
+
return ['top', 'middle', 'bottom'].includes(val);
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|