Skip to content

Commit ae5ec91

Browse files
liweijie0812uyarn
andauthored
fix(Descriptions): fix helper (#5182)
* fix(Descriptions): fix helper * chore: fix lint * chore: fix lint * chore: fix lint * chore: remove color-picker event * Remove 'align' and 'clear' attributes. --------- Co-authored-by: wū yāng <[email protected]>
1 parent 010efea commit ae5ec91

File tree

15 files changed

+117
-145
lines changed

15 files changed

+117
-145
lines changed

packages/components/descriptions/description-item-props.ts renamed to packages/components/descriptions/descriptions-item-props.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
55
* */
66

7-
import { TdDescriptionItemProps } from '../descriptions/type';
7+
import { TdDescriptionsItemProps } from '../descriptions/type';
88
import { PropType } from 'vue';
99

1010
export default {
1111
/** 描述项内容 */
1212
content: {
13-
type: [String, Function] as PropType<TdDescriptionItemProps['content']>,
13+
type: [String, Function] as PropType<TdDescriptionsItemProps['content']>,
1414
},
1515
/** 描述项内容,同 `content` */
1616
default: {
17-
type: [String, Function] as PropType<TdDescriptionItemProps['default']>,
17+
type: [String, Function] as PropType<TdDescriptionsItemProps['default']>,
1818
},
1919
/** 描述项标签 */
2020
label: {
21-
type: [String, Function] as PropType<TdDescriptionItemProps['label']>,
21+
type: [String, Function] as PropType<TdDescriptionsItemProps['label']>,
2222
},
2323
/** 占用的宽度数量 */
2424
span: {

packages/components/descriptions/descriptions-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineComponent } from 'vue';
2-
import props from './description-item-props';
2+
import props from './descriptions-item-props';
33

44
export default defineComponent({
55
name: 'TDescriptionsItem',

packages/components/descriptions/descriptions-row.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { computed, defineComponent, inject, PropType } from 'vue';
22
import { useConfig, usePrefixClass } from '../hooks/useConfig';
33
import { descriptionsKey } from './consts';
4-
import { ItemsType, TdDescriptionItem } from './types';
4+
import { ItemsType, TdDescriptionsItem } from './types';
55
import { renderVNodeTNode, itemTypeIsProps } from './utils';
66

77
export default defineComponent({
88
name: 'TDescriptionsRow',
99
props: {
10-
row: Array as PropType<TdDescriptionItem[]>,
10+
row: Array as PropType<TdDescriptionsItem[]>,
1111
itemType: String as PropType<ItemsType>,
1212
},
1313
setup(props) {
@@ -17,7 +17,7 @@ export default defineComponent({
1717
const layoutIsHorizontal = computed(() => descriptionsProps.layout === 'horizontal');
1818
const itemLayoutIsHorizontal = computed(() => descriptionsProps.itemLayout === 'horizontal');
1919

20-
const label = (node: TdDescriptionItem) => {
20+
const label = (node: TdDescriptionsItem) => {
2121
const labelClass = [`${COMPONENT_NAME.value}__label`];
2222

2323
let label = null;
@@ -39,7 +39,7 @@ export default defineComponent({
3939
);
4040
};
4141

42-
const content = (node: TdDescriptionItem) => {
42+
const content = (node: TdDescriptionsItem) => {
4343
const contentClass = [`${COMPONENT_NAME.value}__content`];
4444

4545
let content = null;

packages/components/descriptions/descriptions.en-US.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ name | type | default | description | required
88
-- | -- | -- | -- | --
99
bordered | Boolean | false | set description list with grey border | N
1010
colon | Boolean | - | set label with ":" on the right | N
11-
column | Number | 2 | count of DescriptionItem in one row | N
11+
column | Number | 2 | count of DescriptionsItem in one row | N
1212
contentStyle | Object | - | style of description content。Typescript:`Styles`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
1313
itemLayout | String | horizontal | layout direction of description item。options: horizontal/vertical | N
14-
items | Array | - | list of descriptions items。Typescript:`Array<TdDescriptionItemProps>` | N
14+
items | Array | - | list of descriptions items。Typescript:`Array<TdDescriptionsItemProps>` | N
1515
labelStyle | Object | - | style of description item, which takes effect when `tableLayout` is `auto`。Typescript:`Styles`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
1616
layout | String | horizontal | layout direction。options: horizontal/vertical | N
1717
size | String | medium | a descriptions has three size。options: small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
1818
tableLayout | String | fixed | Sets the algorithm used to layout `table` cells, rows, and columns, exactly the same as the native table-layout css property. `fixed`: uses fixed layout algorithm; `auto`: uses automatic layout algorithm. For more details, see [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout)。options: fixed/auto | N
1919
title | String / Slot / Function | - | title of descriptions。Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
2020

21-
### DescriptionItem Props
21+
22+
### DescriptionsItem Props
2223

2324
name | type | default | description | required
2425
-- | -- | -- | -- | --

packages/components/descriptions/descriptions.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
-- | -- | -- | -- | --
99
bordered | Boolean | false | 是否带边框 | N
1010
colon | Boolean | - | 字段名右侧是否携带冒号“:” | N
11-
column | Number | 2 | 一行 `DescriptionItem` 的数量 | N
11+
column | Number | 2 | 一行 `DescriptionsItem` 的数量 | N
1212
contentStyle | Object | - | 自定义描述项内容的样式。TS 类型:`Styles`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
1313
itemLayout | String | horizontal | 描述项的排列方向。可选项:horizontal/vertical | N
14-
items | Array | - | 描述项的列表。TS 类型:`Array<TdDescriptionItemProps>` | N
14+
items | Array | - | 描述项的列表。TS 类型:`Array<TdDescriptionsItemProps>` | N
1515
labelStyle | Object | - | 自定义描述项标签的样式,需要配合 `tableLayout``auto` 才可以生效。TS 类型:`Styles`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
1616
layout | String | horizontal | 排列方向。可选项:horizontal/vertical | N
1717
size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
1818
tableLayout | String | fixed | 用于设置底层 `table` 单元格、行和列的布局算法,与原生 table-layout css 属性完全一致。`fixed`:采用固定布局算法;`auto`:采用自动布局算法。详情可参考 [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout)。可选项:fixed/auto | N
1919
title | String / Slot / Function | - | 描述列表的标题。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
2020

21-
### DescriptionItem Props
21+
22+
### DescriptionsItem Props
2223

2324
名称 | 类型 | 默认值 | 描述 | 必传
2425
-- | -- | -- | -- | --

packages/components/descriptions/descriptions.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { descriptionsKey } from './consts';
1111
import { TdDescriptionsProps } from './type';
1212
import DescriptionsRow from './descriptions-row';
1313
import { renderCustomNode, itemTypeIsProps } from './utils';
14-
import { ItemsType, TdDescriptionItem } from './types';
14+
import { ItemsType, TdDescriptionsItem } from './types';
1515

1616
/**
1717
* 实现思路
@@ -47,7 +47,7 @@ export default defineComponent({
4747
*/
4848
const { column, layout } = props;
4949

50-
let items: TdDescriptionItem[] = [];
50+
let items: TdDescriptionsItem[] = [];
5151

5252
if (isArray(props.items)) {
5353
/**
@@ -76,11 +76,11 @@ export default defineComponent({
7676
}
7777

7878
// 3. 布局为 HORIZONTAL 时,需要计算每一行的 item 个数
79-
let temp: TdDescriptionItem[] = [];
79+
let temp: TdDescriptionsItem[] = [];
8080
let reset = column;
8181

8282
// 4. 记录结果
83-
const res: TdDescriptionItem[][] = [];
83+
const res: TdDescriptionsItem[][] = [];
8484
items.forEach((item, index) => {
8585
let span = 1;
8686
if (itemTypeIsProps(itemsType.value, item)) {

packages/components/descriptions/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import _Descriptions from './descriptions';
22
import _DescriptionsItem from './descriptions-item';
33
import withInstall from '../utils/withInstall';
4-
import { TdDescriptionsProps, TdDescriptionItemProps } from './type';
4+
import { TdDescriptionsProps, TdDescriptionsItemProps } from './type';
55

66
import './style';
77

88
export * from './type';
99
export type DescriptionsProps = TdDescriptionsProps;
10-
export type DescriptionsItemProps = TdDescriptionItemProps;
10+
export type DescriptionsItemProps = TdDescriptionsItemProps;
1111

1212
export const Descriptions = withInstall(_Descriptions);
1313
export const DescriptionsItem = withInstall(_DescriptionsItem);

packages/components/descriptions/props.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
bordered: Boolean,
1313
/** 字段名右侧是否携带冒号“:” */
1414
colon: Boolean,
15-
/** 一行 `DescriptionItem` 的数量 */
15+
/** 一行 `DescriptionsItem` 的数量 */
1616
column: {
1717
type: Number,
1818
default: 2,
@@ -34,7 +34,7 @@ export default {
3434
items: {
3535
type: Array as PropType<TdDescriptionsProps['items']>,
3636
},
37-
/** 自定义描述项标签的样式 */
37+
/** 自定义描述项标签的样式,需要配合 `tableLayout` 为 `auto` 才可以生效 */
3838
labelStyle: {
3939
type: Object as PropType<TdDescriptionsProps['labelStyle']>,
4040
},

packages/components/descriptions/type.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface TdDescriptionsProps {
1717
*/
1818
colon?: boolean;
1919
/**
20-
* 一行 `DescriptionItem` 的数量
20+
* 一行 `DescriptionsItem` 的数量
2121
* @default 2
2222
*/
2323
column?: number;
@@ -33,9 +33,9 @@ export interface TdDescriptionsProps {
3333
/**
3434
* 描述项的列表
3535
*/
36-
items?: Array<TdDescriptionItemProps>;
36+
items?: Array<TdDescriptionsItemProps>;
3737
/**
38-
* 自定义描述项标签的样式
38+
* 自定义描述项标签的样式,需要配合 `tableLayout` 为 `auto` 才可以生效
3939
*/
4040
labelStyle?: Styles;
4141
/**
@@ -59,7 +59,7 @@ export interface TdDescriptionsProps {
5959
title?: string | TNode;
6060
}
6161

62-
export interface TdDescriptionItemProps {
62+
export interface TdDescriptionsItemProps {
6363
/**
6464
* 描述项内容
6565
*/
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { VNode } from 'vue';
2-
import { TdDescriptionItemProps } from './type';
2+
import { TdDescriptionsItemProps } from './type';
33

44
export enum ItemsType {
55
props = 'props',
66
slots = 'slots',
77
}
88

9-
export type TdDescriptionItem = TdDescriptionItemProps | VNode;
9+
export type TdDescriptionsItem = TdDescriptionsItemProps | VNode;

0 commit comments

Comments
 (0)