Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SideBar): mobile-react 创建SideBar组件 #391

Merged
merged 12 commits into from
Aug 27, 2024
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ name | type | default | description | required
-- | -- | -- | -- | --
style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
default-value | String / Number | undefined | \- | N
value | String / Number | - | \- | N
default-value | String / Number | undefined | uncontrolled property | N

### SideBar Events

Expand All @@ -25,7 +25,7 @@ name | type | default | description | required
-- | -- | -- | -- | --
style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
badge-props | Object | - | \- | N
badge-props | Object | - | Typescript:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/side-bar/type.ts) | N
disabled | Boolean | false | \- | N
icon | String / Object | - | \- | N
label | String | - | \- | N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
default-value | String / Number | undefined | 选项值。非受控属性 | N
value | String / Number | - | 选项值 | N
default-value | String / Number | undefined | 选项值。非受控属性 | N

### SideBar Events

Expand All @@ -25,7 +25,7 @@ click | `(value: number \| string, label: string)` | 点击选项时触发
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
badge-props | Object | - | 透传至 Badge 组件 | N
badge-props | Object | - | 透传至 Badge 组件。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/side-bar/type.ts) | N
disabled | Boolean | false | 是否禁用 | N
icon | String / Object | - | `1.0.0-rc.1`。图标,传对象则透传至 Icon | N
label | String | - | 展示的标签 | N
Expand Down
20 changes: 20 additions & 0 deletions packages/products/tdesign-miniprogram/src/side-bar/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdSideBarProps } from './type';
const props: TdSideBarProps = {
/** 选项值 */
value: {
type: null,
value: null,
},
/** 选项值,非受控属性 */
defaultValue: {
type: null,
},
};

export default props;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdSideBarItemProps } from './type';
const props: TdSideBarItemProps = {
/** 透传至 Badge 组件 */
badgeProps: {
type: Object,
},
/** 是否禁用 */
disabled: {
type: Boolean,
value: false,
},
/** `1.0.0-rc.1`。图标,传对象则透传至 Icon */
icon: {
type: null,
},
/** 展示的标签 */
label: {
type: String,
value: '',
},
/** 当前选项的值 */
value: {
type: null,
},
};

export default props;
64 changes: 64 additions & 0 deletions packages/products/tdesign-miniprogram/src/side-bar/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { BadgeProps } from '../badge/index';

export interface TdSideBarProps {
/**
* 选项值
*/
value?: {
type: null;
value?: string | number;
};
/**
* 选项值,非受控属性
*/
defaultValue?: {
type: null;
value?: string | number;
};
}

export interface TdSideBarItemProps {
/**
* 透传至 Badge 组件
*/
badgeProps?: {
type: ObjectConstructor;
value?: BadgeProps;
};
/**
* 是否禁用
* @default false
*/
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* `1.0.0-rc.1`。图标,传对象则透传至 Icon
*/
icon?: {
type: null;
value?: string | object;
};
/**
* 展示的标签
* @default ''
*/
label?: {
type: StringConstructor;
value?: string;
};
/**
* 当前选项的值
*/
value?: {
type: null;
value?: string | number;
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdSideBarItemProps } from './type';

export const sideBarItemDefaultProps: TdSideBarItemProps = { disabled: false };
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:: BASE_DOC ::

## API

### SideBar Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
children | TNode | - | children。Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
value | String / Number | - | \- | N
defaultValue | String / Number | - | uncontrolled property | N
onChange | Function | | Typescript:`(value: number \| string) => void`<br/> | N
onClick | Function | | Typescript:`(value: number \| string, label: string) => void`<br/> | N


### SideBarItem Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
badgeProps | Object | - | Typescript:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/side-bar/type.ts) | N
disabled | Boolean | false | \- | N
icon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
label | String | - | \- | N
value | String / Number | - | \- | N
28 changes: 28 additions & 0 deletions packages/products/tdesign-mobile-react/src/side-bar/side-bar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:: BASE_DOC ::

## API

### SideBar Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
children | TNode | - | 侧边导航内容。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
value | String / Number | - | 选项值 | N
defaultValue | String / Number | - | 选项值。非受控属性 | N
onChange | Function | | TS 类型:`(value: number \| string) => void`<br/>选项值发生变化时触发 | N
onClick | Function | | TS 类型:`(value: number \| string, label: string) => void`<br/>点击选项时触发 | N


### SideBarItem Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
badgeProps | Object | - | 透传至 Badge 组件。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/side-bar/type.ts) | N
disabled | Boolean | false | 是否禁用 | N
icon | TElement | - | 图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
label | String | - | 展示的标签 | N
value | String / Number | - | 当前选项的值 | N
56 changes: 56 additions & 0 deletions packages/products/tdesign-mobile-react/src/side-bar/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { BadgeProps } from '../badge';
import { TNode, TElement } from '../common';

export interface TdSideBarProps {
/**
* 侧边导航内容
*/
children?: TNode;
/**
* 选项值
*/
value?: string | number;
/**
* 选项值,非受控属性
*/
defaultValue?: string | number;
/**
* 选项值发生变化时触发
*/
onChange?: (value: number | string) => void;
/**
* 点击选项时触发
*/
onClick?: (value: number | string, label: string) => void;
}

export interface TdSideBarItemProps {
/**
* 透传至 Badge 组件
*/
badgeProps?: BadgeProps;
/**
* 是否禁用
* @default false
*/
disabled?: boolean;
/**
* 图标
*/
icon?: TElement;
/**
* 展示的标签
* @default ''
*/
label?: string;
/**
* 当前选项的值
*/
value?: string | number;
}
28 changes: 28 additions & 0 deletions packages/products/tdesign-mobile-vue/src/side-bar/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdSideBarProps } from './type';
import { PropType } from 'vue';

export default {
/** 选项值 */
value: {
type: [String, Number] as PropType<TdSideBarProps['value']>,
default: undefined,
},
modelValue: {
type: [String, Number] as PropType<TdSideBarProps['value']>,
default: undefined,
},
/** 选项值,非受控属性 */
defaultValue: {
type: [String, Number] as PropType<TdSideBarProps['defaultValue']>,
},
/** 选项值发生变化时触发 */
onChange: Function as PropType<TdSideBarProps['onChange']>,
/** 点击选项时触发 */
onClick: Function as PropType<TdSideBarProps['onClick']>,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdSideBarItemProps } from '../side-bar/type';
import { PropType } from 'vue';

export default {
/** 透传至 Badge 组件 */
badgeProps: {
type: Object as PropType<TdSideBarItemProps['badgeProps']>,
},
/** 是否禁用 */
disabled: Boolean,
/** 图标 */
icon: {
type: Function as PropType<TdSideBarItemProps['icon']>,
},
/** 展示的标签 */
label: {
type: String,
default: '',
},
/** 当前选项的值 */
value: {
type: [String, Number] as PropType<TdSideBarItemProps['value']>,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ click | `(value: number \| string, label: string)` | \-

name | type | default | description | required
-- | -- | -- | -- | --
badgeProps | Object | - | \- | N
badgeProps | Object | - | Typescript:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/side-bar/type.ts) | N
disabled | Boolean | false | \- | N
icon | Slot / Function | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
label | String | - | \- | N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ click | `(value: number \| string, label: string)` | 点击选项时触发

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
badgeProps | Object | - | 透传至 Badge 组件 | N
badgeProps | Object | - | 透传至 Badge 组件。TS 类型:`BadgeProps`,[Badge API Documents](./badge?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/side-bar/type.ts) | N
disabled | Boolean | false | 是否禁用 | N
icon | Slot / Function | - | 图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
label | String | - | 展示的标签 | N
Expand Down
Loading
Loading