-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
454 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/products/tdesign-react/src/anchor/defaultProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdAnchorProps, TdAnchorItemProps, TdAnchorTargetProps } from './type'; | ||
|
||
export const anchorDefaultProps: TdAnchorProps = { | ||
bounds: 5, | ||
container: '() => (() => window)', | ||
size: 'medium', | ||
targetOffset: 0, | ||
}; | ||
|
||
export const anchorItemDefaultProps: TdAnchorItemProps = { customScroll: false, target: '_self', title: '' }; | ||
|
||
export const anchorTargetDefaultProps: TdAnchorTargetProps = { tag: 'div' }; |
33 changes: 33 additions & 0 deletions
33
packages/products/tdesign-vue-next/src/anchor/anchor-item-props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdAnchorItemProps } from '../anchor/type'; | ||
import { PropType } from 'vue'; | ||
|
||
export default { | ||
/** 自定义滚动效果,为true时点击锚点链接后不会使用js动画平滑滚动到锚点目标元素 */ | ||
customScroll: Boolean, | ||
/** 锚点链接, 如果是 hash 模式需要加上当前 path */ | ||
href: { | ||
type: String, | ||
default: '', | ||
required: true, | ||
}, | ||
/** 锚点文本 */ | ||
target: { | ||
type: String as PropType<TdAnchorItemProps['target']>, | ||
default: '_self' as TdAnchorItemProps['target'], | ||
validator(val: TdAnchorItemProps['target']): boolean { | ||
if (!val) return true; | ||
return ['_self', '_blank', '_parent', '_top'].includes(val); | ||
}, | ||
}, | ||
/** 锚点文本 */ | ||
title: { | ||
type: [String, Function] as PropType<TdAnchorItemProps['title']>, | ||
default: '' as TdAnchorItemProps['title'], | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/products/tdesign-vue-next/src/anchor/anchor-target-props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
export default { | ||
/** 目标内容 id */ | ||
id: { | ||
type: String, | ||
default: '', | ||
required: true, | ||
}, | ||
/** 渲染的标签 */ | ||
tag: { | ||
type: String, | ||
default: 'div', | ||
}, | ||
}; |
43 changes: 43 additions & 0 deletions
43
packages/products/tdesign-vue-next/src/anchor/anchor.en-US.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
|
||
### Anchor Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
affixProps | Object | - | Typescript:`AffixProps`,[Affix API Documents](./affix?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/anchor/type.ts) | N | ||
bounds | Number | 5 | \- | N | ||
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
cursor | Slot / Function | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
getCurrentAnchor | Function | - | Custom Highlighted Anchor Points。Typescript:`(activeLink: string) => string` | N | ||
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
targetOffset | Number | 0 | \- | N | ||
onChange | Function | | Typescript:`(currentLink: string, prevLink: string) => void`<br/> | N | ||
onClick | Function | | Typescript:`(link: { href: string; title: string; e: MouseEvent }) => void`<br/> | N | ||
|
||
### Anchor Events | ||
|
||
name | params | description | ||
-- | -- | -- | ||
change | `(currentLink: string, prevLink: string)` | \- | ||
click | `(link: { href: string; title: string; e: MouseEvent })` | \- | ||
|
||
|
||
### AnchorItem Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
customScroll | Boolean | false | custom scroll effect, when set to true, clicking on an anchor link will not use JavaScript animation to smoothly scroll to the anchor target element. | N | ||
href | String | - | required | Y | ||
target | String | _self | options: _self/_blank/_parent/_top | N | ||
title | String / Slot / Function | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
|
||
|
||
### AnchorTarget Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
id | String | - | required | Y | ||
tag | String | div | \- | N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
|
||
### Anchor Props | ||
|
||
名称 | 类型 | 默认值 | 描述 | 必传 | ||
-- | -- | -- | -- | -- | ||
affixProps | Object | - | 透传 Affix 组件属性,即让 Anchor 组件支持所有 Affix 组件特性。TS 类型:`AffixProps`,[Affix API Documents](./affix?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/anchor/type.ts) | N | ||
bounds | Number | 5 | 锚点区域边界 | N | ||
container | String / Function | () => (() => window) | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
cursor | Slot / Function | - | 用于自定义选中项左侧游标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
getCurrentAnchor | Function | - | 自定义高亮的锚点 。TS 类型:`(activeLink: string) => string` | N | ||
size | String | medium | 组件尺寸,small(120px),medium(200px),large(320px)。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
targetOffset | Number | 0 | 锚点滚动偏移量 | N | ||
onChange | Function | | TS 类型:`(currentLink: string, prevLink: string) => void`<br/>锚点改变时触发 | N | ||
onClick | Function | | TS 类型:`(link: { href: string; title: string; e: MouseEvent }) => void`<br/>锚点被点击时触发 | N | ||
|
||
### Anchor Events | ||
|
||
名称 | 参数 | 描述 | ||
-- | -- | -- | ||
change | `(currentLink: string, prevLink: string)` | 锚点改变时触发 | ||
click | `(link: { href: string; title: string; e: MouseEvent })` | 锚点被点击时触发 | ||
|
||
|
||
### AnchorItem Props | ||
|
||
名称 | 类型 | 默认值 | 描述 | 必传 | ||
-- | -- | -- | -- | -- | ||
customScroll | Boolean | false | 自定义滚动效果,为true时点击锚点链接后不会使用js动画平滑滚动到锚点目标元素 | N | ||
href | String | - | 必需。锚点链接, 如果是 hash 模式需要加上当前 path | Y | ||
target | String | _self | 锚点文本。可选项:_self/_blank/_parent/_top | N | ||
title | String / Slot / Function | '' | 锚点文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N | ||
|
||
|
||
### AnchorTarget Props | ||
|
||
名称 | 类型 | 默认值 | 描述 | 必传 | ||
-- | -- | -- | -- | -- | ||
id | String | - | 必需。目标内容 id | Y | ||
tag | String | div | 渲染的标签 | N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdAnchorProps } from './type'; | ||
import { PropType } from 'vue'; | ||
|
||
export default { | ||
/** 透传 Affix 组件属性,即让 Anchor 组件支持所有 Affix 组件特性 */ | ||
affixProps: { | ||
type: Object as PropType<TdAnchorProps['affixProps']>, | ||
}, | ||
/** 锚点区域边界 */ | ||
bounds: { | ||
type: Number, | ||
default: 5, | ||
}, | ||
/** 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body */ | ||
container: { | ||
type: [String, Function] as PropType<TdAnchorProps['container']>, | ||
default: () => (() => window) as TdAnchorProps['container'], | ||
}, | ||
/** 用于自定义选中项左侧游标 */ | ||
cursor: { | ||
type: Function as PropType<TdAnchorProps['cursor']>, | ||
}, | ||
/** 自定义高亮的锚点 */ | ||
getCurrentAnchor: { | ||
type: Function as PropType<TdAnchorProps['getCurrentAnchor']>, | ||
}, | ||
/** 组件尺寸,small(120px),medium(200px),large(320px) */ | ||
size: { | ||
type: String as PropType<TdAnchorProps['size']>, | ||
default: 'medium' as TdAnchorProps['size'], | ||
validator(val: TdAnchorProps['size']): boolean { | ||
if (!val) return true; | ||
return ['small', 'medium', 'large'].includes(val); | ||
}, | ||
}, | ||
/** 锚点滚动偏移量 */ | ||
targetOffset: { | ||
type: Number, | ||
default: 0, | ||
}, | ||
/** 锚点改变时触发 */ | ||
onChange: Function as PropType<TdAnchorProps['onChange']>, | ||
/** 锚点被点击时触发 */ | ||
onClick: Function as PropType<TdAnchorProps['onClick']>, | ||
}; |
33 changes: 33 additions & 0 deletions
33
packages/products/tdesign-vue/src/anchor/anchor-item-props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdAnchorItemProps } from '../anchor/type'; | ||
import { PropType } from 'vue'; | ||
|
||
export default { | ||
/** 自定义滚动效果,为true时点击锚点链接后不会使用js动画平滑滚动到锚点目标元素 */ | ||
customScroll: Boolean, | ||
/** 锚点链接, 如果是 hash 模式需要加上当前 path */ | ||
href: { | ||
type: String, | ||
default: '', | ||
required: true, | ||
}, | ||
/** 锚点文本 */ | ||
target: { | ||
type: String as PropType<TdAnchorItemProps['target']>, | ||
default: '_self' as TdAnchorItemProps['target'], | ||
validator(val: TdAnchorItemProps['target']): boolean { | ||
if (!val) return true; | ||
return ['_self', '_blank', '_parent', '_top'].includes(val); | ||
}, | ||
}, | ||
/** 锚点文本 */ | ||
title: { | ||
type: [String, Function] as PropType<TdAnchorItemProps['title']>, | ||
default: '', | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/products/tdesign-vue/src/anchor/anchor-target-props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
export default { | ||
/** 目标内容 id */ | ||
id: { | ||
type: String, | ||
default: '', | ||
required: true, | ||
}, | ||
/** 渲染的标签 */ | ||
tag: { | ||
type: String, | ||
default: 'div', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
|
||
### Anchor Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
affixProps | Object | - | Typescript:`AffixProps`,[Affix API Documents](./affix?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/anchor/type.ts) | N | ||
bounds | Number | 5 | \- | N | ||
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N | ||
cursor | Slot / Function | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N | ||
getCurrentAnchor | Function | - | Custom Highlighted Anchor Points。Typescript:`(activeLink: string) => string` | N | ||
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N | ||
targetOffset | Number | 0 | \- | N | ||
onChange | Function | | Typescript:`(currentLink: string, prevLink: string) => void`<br/> | N | ||
onClick | Function | | Typescript:`(link: { href: string; title: string; e: MouseEvent }) => void`<br/> | N | ||
|
||
### Anchor Events | ||
|
||
name | params | description | ||
-- | -- | -- | ||
change | `(currentLink: string, prevLink: string)` | \- | ||
click | `(link: { href: string; title: string; e: MouseEvent })` | \- | ||
|
||
|
||
### AnchorItem Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
customScroll | Boolean | false | custom scroll effect, when set to true, clicking on an anchor link will not use JavaScript animation to smoothly scroll to the anchor target element. | N | ||
href | String | - | required | Y | ||
target | String | _self | options: _self/_blank/_parent/_top | N | ||
title | String / Slot / Function | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N | ||
|
||
|
||
### AnchorTarget Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
id | String | - | required | Y | ||
tag | String | div | \- | N |
Oops, something went wrong.