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

chore: adjust export method for components #1461

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/action-sheet/action-sheet.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ theme | String | list | options:list/grid | N
visible | Boolean | false | required。`v-model` and `v-model:visible` is supported | Y
defaultVisible | Boolean | false | required。uncontrolled property | Y
onCancel | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onClose | Function | | Typescript:`(trigger: TriggerSource) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/> | N
onClose | Function | | Typescript:`(trigger: ActionSheetTriggerSource) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type ActionSheetTriggerSource = 'overlay' \| 'command' \| 'select' `<br/> | N
onSelected | Function | | Typescript:`(selected: ActionSheetItem \| string, index: number) => void`<br/> | N

### ActionSheet Events

name | params | description
-- | -- | --
cancel | `(context: { e: MouseEvent })` | \-
close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/>
close | `(trigger: ActionSheetTriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type ActionSheetTriggerSource = 'overlay' \| 'command' \| 'select' `<br/>
selected | `(selected: ActionSheetItem \| string, index: number)` | \-


Expand Down
4 changes: 2 additions & 2 deletions src/action-sheet/action-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ theme | String | list | 展示类型,列表和表格形式展示。可选项
visible | Boolean | false | 必需。显示与隐藏。支持语法糖 `v-model` 或 `v-model:visible` | Y
defaultVisible | Boolean | false | 必需。显示与隐藏。非受控属性 | Y
onCancel | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击取消按钮时触发 | N
onClose | Function | | TS 类型:`(trigger: TriggerSource) => void`<br/>关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/> | N
onClose | Function | | TS 类型:`(trigger: ActionSheetTriggerSource) => void`<br/>关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type ActionSheetTriggerSource = 'overlay' \| 'command' \| 'select' `<br/> | N
onSelected | Function | | TS 类型:`(selected: ActionSheetItem \| string, index: number) => void`<br/>选择菜单项时触发 | N

### ActionSheet Events

名称 | 参数 | 描述
-- | -- | --
cancel | `(context: { e: MouseEvent })` | 点击取消按钮时触发
close | `(trigger: TriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/>
close | `(trigger: ActionSheetTriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts)。<br/>`type ActionSheetTriggerSource = 'overlay' \| 'command' \| 'select' `<br/>
selected | `(selected: ActionSheetItem \| string, index: number)` | 选择菜单项时触发


Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/demos/align.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<script lang="ts" setup>
import { ref } from 'vue';
import { ActionSheetItem } from '../type';
import { ActionSheetItem } from 'tdesign-mobile-vue';

const items = ref([{ label: '选项1' }, { label: '选项2' }, { label: '选项3' }, { label: '选项4' }]);
const centerVisible = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/demos/grid-multiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<script lang="ts" setup>
import { ref, h } from 'vue';
import { ShareIcon, StarIcon, DownloadIcon, Edit1Icon, ImageIcon } from 'tdesign-icons-vue-next';
import { ActionSheetItem } from '../type';
import { ActionSheetItem } from 'tdesign-mobile-vue';

const items = ref([
{
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/demos/grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<script lang="ts" setup>
import { ref, h } from 'vue';
import { ShareIcon, StarIcon, DownloadIcon, Edit1Icon } from 'tdesign-icons-vue-next';
import { ActionSheetItem } from '../type';
import { ActionSheetItem } from 'tdesign-mobile-vue';
// const apIcon = () => h(AppIcon, { size: '24px' });
const items = ref([
{
Expand Down
3 changes: 1 addition & 2 deletions src/action-sheet/demos/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
<script lang="ts" setup>
import { ref, h } from 'vue';
import { AppIcon } from 'tdesign-icons-vue-next';
import { ActionSheet } from 'tdesign-mobile-vue';
import { ActionSheetItem } from '../type';
import { ActionSheet, ActionSheetItem } from 'tdesign-mobile-vue';

const apIcon = () => h(AppIcon, { size: '24px' });
const visible = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/demos/status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script lang="ts" setup>
import { ref, h } from 'vue';
import { AppIcon } from 'tdesign-icons-vue-next';
import { ActionSheetItem } from '../type';
import { ActionSheetItem } from 'tdesign-mobile-vue';

const apIcon = () => h(AppIcon, { size: '24px' });
const visible = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ type ActionSheetApi = {
close: () => void;
};

const _ActionSheet: WithInstallType<typeof ActionSheetVue> & ActionSheetApi = ActionSheet as any;
export const _ActionSheet: WithInstallType<typeof ActionSheetVue> & ActionSheetApi = ActionSheet as any;
export default _ActionSheet;
4 changes: 2 additions & 2 deletions src/action-sheet/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface TdActionSheetProps {
/**
* 关闭时触发
*/
onClose?: (trigger: TriggerSource) => void;
onClose?: (trigger: ActionSheetTriggerSource) => void;
/**
* 选择菜单项时触发
*/
Expand All @@ -77,4 +77,4 @@ export interface ActionSheetItem {
badge?: TdBadgeProps;
}

export type TriggerSource = 'overlay' | 'command' | 'select';
export type ActionSheetTriggerSource = 'overlay' | 'command' | 'select';
2 changes: 1 addition & 1 deletion src/avatar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export * from './type';
export type AvatarProps = TdAvatarProps;
export type AvatarGroupProps = TdAvatarGroupProps;

const Avatar: WithInstallType<typeof _Avatar> = withInstall(_Avatar);
export const Avatar: WithInstallType<typeof _Avatar> = withInstall(_Avatar);
export const AvatarGroup: WithInstallType<typeof _AvatarGroup> = withInstall(_AvatarGroup);
export default Avatar;
6 changes: 3 additions & 3 deletions src/back-top/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BackTop from './back-top';
import _BackTop from './back-top';
import { withInstall, WithInstallType } from '../shared';

import './style';
Expand All @@ -7,5 +7,5 @@ import { TdBackTopProps } from './type';
export * from './type';
export type BackTopProps = TdBackTopProps;

const _BackTop: WithInstallType<typeof BackTop> = withInstall(BackTop);
export default _BackTop;
export const BackTop: WithInstallType<typeof _BackTop> = withInstall(_BackTop);
export default BackTop;
6 changes: 3 additions & 3 deletions src/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Badge from './badge';
import _Badge from './badge';
import { withInstall, WithInstallType } from '../shared';
import { TdBadgeProps } from './type';

Expand All @@ -7,5 +7,5 @@ import './style';
export * from './type';
export type BadgeProps = TdBadgeProps;

const _Badge: WithInstallType<typeof Badge> = withInstall(Badge);
export default _Badge;
export const Badge: WithInstallType<typeof _Badge> = withInstall(_Badge);
export default Badge;
6 changes: 3 additions & 3 deletions src/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Button from './button';
import _Button from './button';
import { withInstall, WithInstallType } from '../shared';

import './style';
Expand All @@ -7,5 +7,5 @@ import { TdButtonProps } from './type';
export * from './type';
export type ButtonProps = TdButtonProps;

const _Button: WithInstallType<typeof Button> = withInstall(Button);
export default _Button;
export const Button: WithInstallType<typeof _Button> = withInstall(_Button);
export default Button;
6 changes: 3 additions & 3 deletions src/calendar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Calendar from './calendar';
import _Calendar from './calendar';
import { withInstall, WithInstallType } from '../shared';

import './style';
Expand All @@ -7,5 +7,5 @@ import { TdCalendarProps } from './type';
export * from './type';
export type CalendarProps = TdCalendarProps;

const _Calendar: WithInstallType<typeof Calendar> = withInstall(Calendar);
export default _Calendar;
export const Calendar: WithInstallType<typeof _Calendar> = withInstall(_Calendar);
export default Calendar;
4 changes: 2 additions & 2 deletions src/cascader/cascader.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ visible | Boolean | false | \- | N
checkStrictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
placeholder | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
onChange | Function | | Typescript:`(value: string \| number, selectedOptions: string[]) => void`<br/> | N
onClose | Function | | Typescript:`(trigger: TriggerSource) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/> | N
onClose | Function | | Typescript:`(trigger: CascaderTriggerSource) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/> | N
onPick | Function | | Typescript:`(context: { level: number; value: string | number; index: number }) => void`<br/> | N

### Cascader Events

name | params | description
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | \-
close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
close | `(trigger: CascaderTriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
pick | `(context: { level: number, value: string \| number, index: number })` | \-


Expand Down
4 changes: 2 additions & 2 deletions src/cascader/cascader.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ visible | Boolean | false | 是否展示 | N
checkStrictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
placeholder | String / Slot / Function | 选择选项 | 未选中时的提示文案。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
onChange | Function | | TS 类型:`(value: string \| number, selectedOptions: string[]) => void`<br/>值发生变更时触发 | N
onClose | Function | | TS 类型:`(trigger: TriggerSource) => void`<br/>关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/> | N
onClose | Function | | TS 类型:`(trigger: CascaderTriggerSource) => void`<br/>关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/> | N
onPick | Function | | TS 类型:`(context: { level: number, value: string \| number, index: number }) => void`<br/>选择后触发 | N

### Cascader Events

名称 | 参数 | 描述
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | 值发生变更时触发
close | `(trigger: TriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
close | `(trigger: CascaderTriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。<br/>`type CascaderTriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
pick | `(context: { level: number, value: string \| number, index: number })` | 选择后触发


Expand Down
6 changes: 3 additions & 3 deletions src/cascader/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Cascader from './cascader.vue';
import _Cascader from './cascader.vue';
import { withInstall, WithInstallType } from '../shared';

import './style';
Expand All @@ -7,5 +7,5 @@ import { TdCascaderProps } from './type';
export * from './type';
export type CascaderProps = TdCascaderProps;

const _Cascader: WithInstallType<typeof Cascader> = withInstall(Cascader);
export default _Cascader;
export const Cascader: WithInstallType<typeof _Cascader> = withInstall(_Cascader);
export default Cascader;
4 changes: 2 additions & 2 deletions src/cascader/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
/**
* 关闭时触发
*/
onClose?: (trigger: TriggerSource) => void;
onClose?: (trigger: CascaderTriggerSource) => void;
/**
* 选择后触发
*/
onPick?: (context: { level: number; value: string | number; index: number }) => void;
}

export type TriggerSource = 'overlay' | 'close-btn' | 'finish';
export type CascaderTriggerSource = 'overlay' | 'close-btn' | 'finish';
7 changes: 3 additions & 4 deletions src/cell/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Cell from './cell';
import _Cell from './cell';
import _CellGroup from './cell-group';
import { withInstall, WithInstallType } from '../shared';
import { TdCellProps, TdCellGroupProps } from './type';
Expand All @@ -9,7 +9,6 @@ export * from './type';
export type CellProps = TdCellProps;
export type CellGroupProps = TdCellGroupProps;

const _Cell: WithInstallType<typeof Cell> = withInstall(Cell);
export default _Cell;

export const Cell: WithInstallType<typeof _Cell> = withInstall(_Cell);
export const CellGroup: WithInstallType<typeof _CellGroup> = withInstall(_CellGroup);
export default Cell;
2 changes: 1 addition & 1 deletion src/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export * from './type';
export type CheckboxProps = TdCheckboxProps;
export type CheckboxGroupProps = TdCheckboxGroupProps;

const CheckBox: WithInstallType<typeof _CheckBox> = withInstall(_CheckBox);
export const CheckBox: WithInstallType<typeof _CheckBox> = withInstall(_CheckBox);
export const CheckboxGroup: WithInstallType<typeof _CheckBoxGroup> = withInstall(_CheckBoxGroup);
export default CheckBox;
15 changes: 11 additions & 4 deletions src/collapse/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import LocalCollapse from './collapse';
import LocalCollapsePanel from './collapse-panel';
import _Collapse from './collapse';
import _CollapsePanel from './collapse-panel';
import { withInstall, WithInstallType } from '../shared';

import './style';

export const Collapse: WithInstallType<typeof LocalCollapse> = withInstall(LocalCollapse);
export const CollapsePanel: WithInstallType<typeof LocalCollapsePanel> = withInstall(LocalCollapsePanel);
import { TdCollapseProps, TdCollapsePanelProps } from './type';

export * from './type';
export type CollapseProps = TdCollapseProps;
export type CollapsePanelProps = TdCollapsePanelProps;

export const Collapse: WithInstallType<typeof _Collapse> = withInstall(_Collapse);
export const CollapsePanel: WithInstallType<typeof _CollapsePanel> = withInstall(_CollapsePanel);
export default Collapse;
Loading
Loading