types: add SwipeInstance type (#9158)

This commit is contained in:
neverland
2021-07-30 14:25:14 +08:00
committed by GitHub
parent 44fb849a5f
commit 32e77d71ab
17 changed files with 155 additions and 98 deletions
+7 -24
View File
@@ -4,7 +4,6 @@ import {
InjectionKey,
defineComponent,
ExtractPropTypes,
ComponentPublicInstance,
} from 'vue';
// Utils
@@ -16,7 +15,12 @@ import { useExpose } from '../composables/use-expose';
import { useLinkField } from '../composables/use-link-field';
// Types
import { CheckerParent, CheckerDirection } from '../checkbox/Checker';
import type { CheckerDirection } from '../checkbox/Checker';
import type {
CheckboxGroupExpose,
CheckboxGroupProvide,
CheckboxGroupToggleAllOptions,
} from './types';
const [name, bem] = createNamespace('checkbox-group');
@@ -32,28 +36,7 @@ const props = {
},
};
export type CheckboxGroupToggleAllOptions =
| boolean
| {
checked?: boolean;
skipDisabled?: boolean;
};
type CheckboxGroupProps = ExtractPropTypes<typeof props>;
type CheckboxGroupExpose = {
toggleAll: (options?: CheckboxGroupToggleAllOptions) => void;
};
export type CheckboxGroupInstance = ComponentPublicInstance<
CheckboxGroupProps,
CheckboxGroupExpose
>;
export type CheckboxGroupProvide = CheckerParent & {
props: CheckboxGroupProps;
updateValue: (value: unknown[]) => void;
};
export type CheckboxGroupProps = ExtractPropTypes<typeof props>;
export const CHECKBOX_GROUP_KEY: InjectionKey<CheckboxGroupProvide> = Symbol(
name
+1 -1
View File
@@ -8,4 +8,4 @@ export { CheckboxGroup };
export type {
CheckboxGroupInstance,
CheckboxGroupToggleAllOptions,
} from './CheckboxGroup';
} from './types';
+24
View File
@@ -0,0 +1,24 @@
import type { ComponentPublicInstance } from 'vue';
import type { CheckboxGroupProps } from './CheckboxGroup';
import type { CheckerParent } from '../checkbox/Checker';
export type CheckboxGroupToggleAllOptions =
| boolean
| {
checked?: boolean;
skipDisabled?: boolean;
};
export type CheckboxGroupExpose = {
toggleAll: (options?: CheckboxGroupToggleAllOptions) => void;
};
export type CheckboxGroupInstance = ComponentPublicInstance<
CheckboxGroupProps,
CheckboxGroupExpose
>;
export type CheckboxGroupProvide = CheckerParent & {
props: CheckboxGroupProps;
updateValue: (value: unknown[]) => void;
};