import type { Component, h, VNode } from 'vue'; import { type Checkbox, type Form, type Input, type Radio, type Select, type Switcher } from 'bkui-vue'; export type BaseShortcutComponent = OldShortcut & { formItemProps?: InstanceType['$props']; key: string; props?: ShortcutComponentProps[T]; type: T; }; export interface CheckboxGroupShortcutComponent extends BaseShortcutComponent<'checkboxGroup'> { props: InstanceType['$props'] & { options: InstanceType['$props'][]; }; } export type InputShortcutComponent = BaseShortcutComponent<'input'>; export type NumberShortcutComponent = BaseShortcutComponent<'number'>; export interface OldShortcut { default?: string; fillBack?: boolean; fillRegx?: RegExp; key?: string; max?: 100; min?: 1; name?: string; options?: { label: string; value: string; }[]; placeholder?: string; required?: boolean; rows?: number; } export interface RadioGroupShortcutComponent extends BaseShortcutComponent<'radioGroup'> { props: InstanceType['$props'] & { options: InstanceType['$props'][]; }; } export interface SelectShortcutComponent extends BaseShortcutComponent<'select'> { props?: InstanceType['$props'] & { options: InstanceType['$props'][]; }; } export interface Shortcut { alias?: string; components?: ShortcutComponent[]; description?: string; formModel?: Record; icon?: ((c: typeof h) => Component | VNode) | string | VNode; id: string; key?: string; name: string; } export type ShortcutComponent = CheckboxGroupShortcutComponent | InputShortcutComponent | NumberShortcutComponent | RadioGroupShortcutComponent | SelectShortcutComponent | SwitcherShortcutComponent | TextareaShortcutComponent | TextShortcutComponent; export type ShortcutComponentProps = { checkboxGroup: InstanceType['$props']; input: InstanceType['$props']; number: InstanceType['$props']; radioGroup: InstanceType['$props']; select: InstanceType['$props']; switcher: InstanceType['$props']; text: InstanceType['$props']; textarea: InstanceType['$props']; }; export type SwitcherShortcutComponent = BaseShortcutComponent<'switcher'>; export type TextareaShortcutComponent = BaseShortcutComponent<'textarea'>; export type TextShortcutComponent = BaseShortcutComponent<'text'>;