148 lines
4.6 KiB
TypeScript
148 lines
4.6 KiB
TypeScript
import * as vue from 'vue';
|
|
import { ComponentPropsOptions, ExtractPropTypes, VNodeChild, VNode, Ref } from 'vue';
|
|
|
|
type SlotsToProps<U extends RawSlots, T = MakeInternalSlots<U>> = {
|
|
$children?: (VNodeChild | (T extends {
|
|
default: infer V;
|
|
} ? V : {}) | {
|
|
[K in keyof T]?: T[K];
|
|
});
|
|
'v-slots'?: {
|
|
[K in keyof T]?: T[K] | false;
|
|
};
|
|
} & {
|
|
[K in keyof T as `v-slot:${K & string}`]?: T[K] | false;
|
|
};
|
|
type RawSlots = Record<string, unknown>;
|
|
type Slot<T> = [T] extends [never] ? () => VNodeChild : (arg: T) => VNodeChild;
|
|
type VueSlot<T> = [T] extends [never] ? () => VNode[] : (arg: T) => VNode[];
|
|
type MakeInternalSlots<T extends RawSlots> = {
|
|
[K in keyof T]: Slot<T[K]>;
|
|
};
|
|
type MakeSlots<T extends RawSlots> = {
|
|
[K in keyof T]: VueSlot<T[K]>;
|
|
};
|
|
type GenericProps<Props, Slots extends Record<string, unknown>> = {
|
|
$props: Props & SlotsToProps<Slots>;
|
|
$slots: MakeSlots<Slots>;
|
|
};
|
|
interface FilterPropsOptions<PropsOptions extends Readonly<ComponentPropsOptions>, Props = ExtractPropTypes<PropsOptions>> {
|
|
filterProps<T extends Partial<Props>, U extends Exclude<keyof Props, Exclude<keyof Props, keyof T>>>(props: T): Partial<Pick<T, U>>;
|
|
}
|
|
|
|
type VConfirmEditSlots<T> = {
|
|
default: {
|
|
model: Ref<T>;
|
|
get actions(): VNode;
|
|
};
|
|
};
|
|
declare const VConfirmEdit: {
|
|
new (...args: any[]): vue.CreateComponentPublicInstance<{
|
|
cancelText: string;
|
|
okText: string;
|
|
} & {
|
|
color?: string | undefined;
|
|
} & {
|
|
onCancel?: (() => any) | undefined;
|
|
}, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
|
|
cancel: () => true;
|
|
save: (value: any) => true;
|
|
'update:modelValue': (value: any) => true;
|
|
}, "$children" | "v-slot:default" | "v-slots" | "modelValue" | "update:modelValue" | "save">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
|
|
cancelText: string;
|
|
okText: string;
|
|
} & {
|
|
color?: string | undefined;
|
|
} & {
|
|
onCancel?: (() => any) | undefined;
|
|
}, {
|
|
cancelText: string;
|
|
okText: string;
|
|
}, true, {}, vue.SlotsType<Partial<{
|
|
default: (arg: {
|
|
model: Ref<unknown>;
|
|
readonly actions: VNode<vue.RendererNode, vue.RendererElement, {
|
|
[key: string]: any;
|
|
}>;
|
|
}) => VNode<vue.RendererNode, vue.RendererElement, {
|
|
[key: string]: any;
|
|
}>[];
|
|
}>>, {
|
|
P: {};
|
|
B: {};
|
|
D: {};
|
|
C: {};
|
|
M: {};
|
|
Defaults: {};
|
|
}, {
|
|
cancelText: string;
|
|
okText: string;
|
|
} & {
|
|
color?: string | undefined;
|
|
} & {
|
|
onCancel?: (() => any) | undefined;
|
|
}, {}, {}, {}, {}, {
|
|
cancelText: string;
|
|
okText: string;
|
|
}>;
|
|
__isFragment?: undefined;
|
|
__isTeleport?: undefined;
|
|
__isSuspense?: undefined;
|
|
} & vue.ComponentOptionsBase<{
|
|
cancelText: string;
|
|
okText: string;
|
|
} & {
|
|
color?: string | undefined;
|
|
} & {
|
|
onCancel?: (() => any) | undefined;
|
|
}, void, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
|
|
cancel: () => true;
|
|
save: (value: any) => true;
|
|
'update:modelValue': (value: any) => true;
|
|
}, "$children" | "v-slot:default" | "v-slots" | "modelValue" | "update:modelValue" | "save">, string, {
|
|
cancelText: string;
|
|
okText: string;
|
|
}, {}, string, vue.SlotsType<Partial<{
|
|
default: (arg: {
|
|
model: Ref<unknown>;
|
|
readonly actions: VNode<vue.RendererNode, vue.RendererElement, {
|
|
[key: string]: any;
|
|
}>;
|
|
}) => VNode<vue.RendererNode, vue.RendererElement, {
|
|
[key: string]: any;
|
|
}>[];
|
|
}>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new <T>(props: {
|
|
modelValue?: T | undefined;
|
|
'onUpdate:modelValue'?: ((value: T) => void) | undefined;
|
|
onSave?: ((value: T) => void) | undefined;
|
|
}, slots: VConfirmEditSlots<T>) => GenericProps<{
|
|
modelValue?: T | undefined;
|
|
'onUpdate:modelValue'?: ((value: T) => void) | undefined;
|
|
onSave?: ((value: T) => void) | undefined;
|
|
}, VConfirmEditSlots<T>>) & FilterPropsOptions<{
|
|
modelValue: null;
|
|
color: StringConstructor;
|
|
cancelText: {
|
|
type: StringConstructor;
|
|
default: string;
|
|
};
|
|
okText: {
|
|
type: StringConstructor;
|
|
default: string;
|
|
};
|
|
}, vue.ExtractPropTypes<{
|
|
modelValue: null;
|
|
color: StringConstructor;
|
|
cancelText: {
|
|
type: StringConstructor;
|
|
default: string;
|
|
};
|
|
okText: {
|
|
type: StringConstructor;
|
|
default: string;
|
|
};
|
|
}>>;
|
|
type VConfirmEdit = InstanceType<typeof VConfirmEdit>;
|
|
|
|
export { VConfirmEdit };
|