157 lines
7.3 KiB
TypeScript
157 lines
7.3 KiB
TypeScript
import type { ComponentSize } from 'element-plus/es/constants';
|
|
import type { Component, ExtractPublicPropTypes, PropType } from 'vue';
|
|
import type Switch from './switch.vue';
|
|
export interface SwitchProps {
|
|
/**
|
|
* @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type
|
|
*/
|
|
modelValue?: boolean | string | number;
|
|
/**
|
|
* @description whether Switch is disabled
|
|
*/
|
|
disabled?: boolean;
|
|
/**
|
|
* @description whether Switch is in loading state
|
|
*/
|
|
loading?: boolean;
|
|
/**
|
|
* @description size of Switch
|
|
*/
|
|
size?: ComponentSize;
|
|
/**
|
|
* @description width of Switch
|
|
*/
|
|
width?: string | number;
|
|
/**
|
|
* @description whether icon or text is displayed inside dot, only the first character will be rendered for text
|
|
*/
|
|
inlinePrompt?: boolean;
|
|
/**
|
|
* @description component of the icon displayed in action when in `off` state
|
|
*/
|
|
inactiveActionIcon?: string | Component;
|
|
/**
|
|
* @description component of the icon displayed in action when in `on` state
|
|
*/
|
|
activeActionIcon?: string | Component;
|
|
/**
|
|
* @description component of the icon displayed when in `on` state, overrides `active-text`
|
|
*/
|
|
activeIcon?: string | Component;
|
|
/**
|
|
* @description component of the icon displayed when in `off` state, overrides `inactive-text`
|
|
*/
|
|
inactiveIcon?: string | Component;
|
|
/**
|
|
* @description text displayed when in `on` state
|
|
*/
|
|
activeText?: string;
|
|
/**
|
|
* @description text displayed when in `off` state
|
|
*/
|
|
inactiveText?: string;
|
|
/**
|
|
* @description switch value when in `on` state
|
|
*/
|
|
activeValue?: boolean | string | number;
|
|
/**
|
|
* @description switch value when in `off` state
|
|
*/
|
|
inactiveValue?: boolean | string | number;
|
|
/**
|
|
* @description input name of Switch
|
|
*/
|
|
name?: string;
|
|
/**
|
|
* @description whether to trigger form validation
|
|
*/
|
|
validateEvent?: boolean;
|
|
/**
|
|
* @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching
|
|
*/
|
|
beforeChange?: () => Promise<boolean> | boolean;
|
|
/**
|
|
* @description id for input
|
|
*/
|
|
id?: string;
|
|
/**
|
|
* @description tabindex for input
|
|
*/
|
|
tabindex?: string | number;
|
|
/**
|
|
* @description native `aria-label` attribute
|
|
*/
|
|
ariaLabel?: string;
|
|
}
|
|
/**
|
|
* @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
|
|
*/
|
|
export declare const switchProps: {
|
|
readonly ariaLabel: StringConstructor;
|
|
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
|
|
readonly disabled: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
readonly loading: BooleanConstructor;
|
|
readonly size: {
|
|
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large") | ((new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large"))[], unknown, "" | "small" | "default" | "large">>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
readonly inlinePrompt: BooleanConstructor;
|
|
readonly inactiveActionIcon: {
|
|
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly activeActionIcon: {
|
|
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly activeIcon: {
|
|
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly inactiveIcon: {
|
|
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly activeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
readonly inactiveText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
readonly activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
|
|
readonly inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
|
|
readonly name: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
readonly beforeChange: {
|
|
readonly type: PropType<() => Promise<boolean> | boolean>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly id: StringConstructor;
|
|
readonly tabindex: {
|
|
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
};
|
|
/**
|
|
* @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
|
|
*/
|
|
export type SwitchPropsPublic = ExtractPublicPropTypes<typeof switchProps>;
|
|
export declare const switchEmits: {
|
|
"update:modelValue": (val: boolean | string | number) => boolean;
|
|
change: (val: boolean | string | number) => boolean;
|
|
input: (val: boolean | string | number) => boolean;
|
|
};
|
|
export type SwitchEmits = typeof switchEmits;
|
|
export type SwitchInstance = InstanceType<typeof Switch> & unknown;
|