Skip to content

fix(sender): fix sender define type err #271

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 16 additions & 3 deletions src/sender/interface.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { ButtonProps, TextAreaProps } from "ant-design-vue";
import { Input } from "ant-design-vue";
import type { ChangeEvent, ClipboardEventHandler, KeyboardEventHandler } from "ant-design-vue/es/_util/EventInterface";
import type { ConfigProviderProps } from "ant-design-vue";
import type { CSSProperties, VNode } from "vue";
import type { AllowSpeech } from "./useSpeech";
import type { InputRef } from "ant-design-vue/es/vc-input/inputProps";
import type { AvoidValidation } from '../type-utility';
import SendButton from "./components/SendButton.vue";
import ClearButton from "./components/ClearButton.vue";
Expand All @@ -13,6 +11,16 @@ import SpeechButton from "./components/SpeechButton/index.vue";

export type SubmitType = 'enter' | 'shiftEnter' | false;

export type KeyboardEventHandler = (e: KeyboardEvent) => void;

export type ClipboardEventHandler = (e: ClipboardEvent) => void;

export type ChangeEvent = Event & {
target: {
value?: string | undefined;
};
}

export interface SenderComponents {
input?: typeof Input.TextArea;
}
Expand Down Expand Up @@ -80,9 +88,14 @@ export interface SenderProps {
autoSize?: AvoidValidation<boolean | { minRows?: number; maxRows?: number }>;
}

export interface InputFocusOptions extends FocusOptions {
cursor?: 'start' | 'end' | 'all';
}
export type SenderRef = {
nativeElement: HTMLDivElement;
} & Pick<InputRef, 'focus' | 'blur'>;
focus: (options?: InputFocusOptions) => void;
blur: () => void;
};

export interface SenderHeaderContextProps {
prefixCls?: ConfigProviderProps['prefixCls'];
Expand Down