feat: update type

This commit is contained in:
tangjinzhou 2022-03-17 11:15:33 +08:00
parent f8cef206f3
commit 00cf241315
3 changed files with 18 additions and 33 deletions

View File

@ -37,7 +37,12 @@ export interface Locale {
global?: Record<string, any>;
PageHeader?: { back: string };
Icon?: Record<string, any>;
Text?: Record<string, any>;
Text?: {
edit?: any;
copy?: any;
copied?: any;
expand?: any;
};
}
export interface LocaleProviderProps {

View File

@ -48,6 +48,7 @@ function setMessageConfig(options: ConfigOptions) {
}
if (options.getContainer !== undefined) {
getContainer = options.getContainer;
messageInstance = null; // delete messageInstance for new getContainer
}
if (options.transitionName !== undefined) {
transitionName = options.transitionName;

View File

@ -1,4 +1,4 @@
import type { CSSProperties, HTMLAttributes, PropType } from 'vue';
import type { CSSProperties, ExtractPropTypes, HTMLAttributes, PropType } from 'vue';
import { computed, defineComponent, ref, watch } from 'vue';
import ResizeObserver from '../vc-resize-observer';
import classNames from '../_util/classNames';
@ -16,36 +16,8 @@ function defaultRenderRest<ItemType>(omittedItems: ItemType[]) {
return `+ ${omittedItems.length} ...`;
}
export interface OverflowProps<ItemType> extends HTMLAttributes {
prefixCls?: string;
data?: ItemType[];
itemKey?: Key;
/** Used for `responsive`. It will limit render node to avoid perf issue */
itemWidth?: number;
renderItem?: (item: ItemType) => VueNode;
/** @private Do not use in your production. Render raw node that need wrap Item by developer self */
renderRawItem?: (item: ItemType, index: number) => VueNode;
maxCount?: number | typeof RESPONSIVE | typeof INVALIDATE;
renderRest?: VueNode | ((omittedItems: ItemType[]) => VueNode);
/** @private Do not use in your production. Render raw node that need wrap Item by developer self */
renderRawRest?: (omittedItems: ItemType[]) => VueNode;
suffix?: VueNode;
component?: any;
itemComponent?: any;
/** @private This API may be refactor since not well design */
onVisibleChange?: (visibleCount: number) => void;
/** When set to `full`, ssr will render full items by default and remove at client side */
ssr?: 'full';
onMousedown?: MouseEventHandler;
}
const Overflow = defineComponent({
name: 'Overflow',
inheritAttrs: false,
props: {
const overflowProps = () => {
return {
id: String,
prefixCls: String,
data: Array,
@ -67,7 +39,14 @@ const Overflow = defineComponent({
/** When set to `full`, ssr will render full items by default and remove at client side */
ssr: String as PropType<'full'>,
onMousedown: Function as PropType<MouseEventHandler>,
},
};
};
type InterOverflowProps = Partial<ExtractPropTypes<ReturnType<typeof overflowProps>>>;
export type OverflowProps = HTMLAttributes & InterOverflowProps;
const Overflow = defineComponent<OverflowProps>({
name: 'Overflow',
inheritAttrs: false,
props: overflowProps() as any,
emits: ['visibleChange'],
setup(props, { attrs, emit }) {
const fullySSR = computed(() => props.ssr === 'full');