UNPKG

plus-pro-components

Version:

Page level components developed based on Element Plus.

523 lines (521 loc) 25.3 kB
import { TimeSelectProps } from 'element-plus/es/components/time-select/src/time-select'; import { EpPropMergeType } from 'element-plus/es/utils'; import { PlusFormProps, PlusRadioProps, PlusDatePickerProps, PlusInputTagProps } from 'plus-pro-components'; import { FormChangeCallBackParams } from './type'; import { TableColumnCtx, ElTooltipProps, FormItemProps, ProgressFn, CascaderNode, InputAutoSize, AutocompleteProps, CheckboxGroupProps, ColorPickerProps, DatePickerProps, InputProps, InputNumberProps, RadioGroupProps, RateProps, ISelectProps, SliderProps, SwitchProps, TimePickerDefaultProps, TextProps, ImageProps, LinkProps, TagProps, ProgressProps, ColProps } from 'element-plus'; import { Ref, DefineComponent, ComponentInternalInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType, Slot, ComponentPublicInstance, ComponentOptionsBase, ComputedRef, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, CSSProperties, PublicProps } from 'vue'; import { PlusColumn, RecordType, FieldValueType, TableValueType, FormItemValueType, OptionsType, OptionsRow, RenderTypes, PropsItemType, Mutable, OmitTypes, CascaderProps } from 'plus-pro-components/es/types'; export interface PlusTableColumnProps { columns?: PlusColumn[]; editable?: boolean | 'click' | 'dblclick'; tableDataLength?: number; } export interface PlusTableColumnEmits { (e: 'formChange', data: FormChangeCallBackParams): void; } declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PlusTableColumnProps>, { columns: () => never[]; tableDataLength: number; editable: boolean; }>, { plusDisplayItemInstance: Ref<({ $: ComponentInternalInstance; $data: {}; $props: Partial<{ index: number; formProps: PlusFormProps; rest: RecordType; column: PlusColumn; editable: boolean | "click" | "dblclick"; row: RecordType; }> & Omit<{ readonly index: number; readonly formProps: PlusFormProps; readonly rest: RecordType; readonly column: PlusColumn; readonly editable: boolean | "click" | "dblclick"; readonly row: RecordType; onChange?: ((data: { value: FieldValueType; prop: string; row: RecordType; }) => any) | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{ index: { type: PropType<number>; default: number; }; formProps: { type: PropType<PlusFormProps>; default: () => {}; }; rest: { type: PropType<RecordType>; default: () => {}; }; column: { type: PropType<PlusColumn>; required: true; default: () => { prop: string; label: string; }; }; editable: { type: PropType<boolean | "click" | "dblclick">; default: boolean; }; row: { type: PropType<RecordType>; required: true; default: () => {}; }; }>> & { onChange?: ((data: { value: FieldValueType; prop: string; row: RecordType; }) => any) | undefined; }, "index" | "formProps" | "rest" | "column" | "editable" | "row">; $attrs: { [x: string]: unknown; }; $refs: { [x: string]: unknown; }; $slots: Readonly<{ [name: string]: Slot<any> | undefined; }>; $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null; $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null; $emit: (event: "change", data: { value: FieldValueType; prop: string; row: RecordType; }) => void; $el: any; $options: ComponentOptionsBase<Readonly< ExtractPropTypes<{ index: { type: PropType<number>; default: number; }; formProps: { type: PropType<PlusFormProps>; default: () => {}; }; rest: { type: PropType<RecordType>; default: () => {}; }; column: { type: PropType<PlusColumn>; required: true; default: () => { prop: string; label: string; }; }; editable: { type: PropType<boolean | "click" | "dblclick">; default: boolean; }; row: { type: PropType<RecordType>; required: true; default: () => {}; }; }>> & { onChange?: ((data: { value: FieldValueType; prop: string; row: RecordType; }) => any) | undefined; }, { startCellEdit: () => void; stopCellEdit: () => void; getDisplayItemInstance: () => { isEdit: Ref<boolean>; index: number; rowIndex: number; cellIndex: any; prop: string; formInstance: ComputedRef<any>; }; }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, { change: (data: { value: FieldValueType; prop: string; row: RecordType; }) => void; }, string, { index: number; formProps: PlusFormProps; rest: RecordType; column: PlusColumn; editable: boolean | "click" | "dblclick"; row: RecordType; }, {}, string, {}> & { beforeCreate?: ((() => void) | (() => void)[]) | undefined; created?: ((() => void) | (() => void)[]) | undefined; beforeMount?: ((() => void) | (() => void)[]) | undefined; mounted?: ((() => void) | (() => void)[]) | undefined; beforeUpdate?: ((() => void) | (() => void)[]) | undefined; updated?: ((() => void) | (() => void)[]) | undefined; activated?: ((() => void) | (() => void)[]) | undefined; deactivated?: ((() => void) | (() => void)[]) | undefined; beforeDestroy?: ((() => void) | (() => void)[]) | undefined; beforeUnmount?: ((() => void) | (() => void)[]) | undefined; destroyed?: ((() => void) | (() => void)[]) | undefined; unmounted?: ((() => void) | (() => void)[]) | undefined; renderTracked?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined; renderTriggered?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined; errorCaptured?: (((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void)[]) | undefined; }; $forceUpdate: () => void; $nextTick: nextTick; $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: WatchOptions<boolean> | undefined): WatchStopHandle; } & Omit<Readonly< ExtractPropTypes<{ index: { type: PropType<number>; default: number; }; formProps: { type: PropType<PlusFormProps>; default: () => {}; }; rest: { type: PropType<RecordType>; default: () => {}; }; column: { type: PropType<PlusColumn>; required: true; default: () => { prop: string; label: string; }; }; editable: { type: PropType<boolean | "click" | "dblclick">; default: boolean; }; row: { type: PropType<RecordType>; required: true; default: () => {}; }; }>> & { onChange?: ((data: { value: FieldValueType; prop: string; row: RecordType; }) => any) | undefined; }, "startCellEdit" | "stopCellEdit" | "getDisplayItemInstance"> & ShallowUnwrapRef<{ startCellEdit: () => void; stopCellEdit: () => void; getDisplayItemInstance: () => { isEdit: Ref<boolean>; index: number; rowIndex: number; cellIndex: any; prop: string; formInstance: ComputedRef<any>; }; }> & {} & ComponentCustomProperties & {} & { $slots: Partial<Record<string, (_: { [x: string]: any; label?: string | ComputedRef<string> | undefined; prop: string; width?: string | number | undefined; minWidth?: string | number | undefined; editable?: boolean | undefined; valueType?: TableValueType | FormItemValueType; hideInDescriptions?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; hideInForm?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; hideInTable?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; hideInSearch?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; descriptionsItemProps?: RecordType | undefined; options?: OptionsType | undefined; optionsMap?: { label?: string | undefined; value?: string | undefined; } | undefined; customGetStatus?: ((data: { options: OptionsRow<undefined>[]; value: string | number; row: RecordType; }) => OptionsRow<undefined>) | undefined; tooltip?: string | Partial< ElTooltipProps> | ComputedRef<string> | ComputedRef<Partial< ElTooltipProps>> | undefined; render?: ((value: any, data: { row: RecordType; column: PlusColumn; index: number; }) => RenderTypes) | undefined; renderHTML?: ((value: any, data: { row: RecordType; column: PlusColumn; index: number; }) => string) | undefined; renderHeader?: ((label: string, props: PlusColumn) => RenderTypes) | undefined; renderDescriptionsItem?: ((data: { value: string; column: PlusColumn; row: RecordType; }) => RenderTypes) | undefined; renderDescriptionsLabel?: ((data: { label: string; column: PlusColumn; row: RecordType; }) => RenderTypes) | undefined; order?: number | ComputedRef<number> | undefined; children?: PlusColumn[] | undefined; headerFilter?: boolean | undefined; disabledHeaderFilter?: boolean | undefined; headerIsChecked?: boolean | undefined; tableColumnProps?: Partial<Omit<TableColumnCtx<any>, "label " | "prop" | "width" | "minWidth"> & { [key: string]: any; }> | undefined; preview?: boolean | undefined; linkText?: string | undefined; formatter?: ((value: any, data: { row: RecordType; column: PlusColumn; index: number; }) => string | number) | undefined; formProps?: Partial< PlusFormProps> | ComputedRef<Partial< PlusFormProps>> | ((value: FieldValueType, data: { row: Record<string, any>; index: number; }) => Partial< PlusFormProps>) | undefined; formItemProps?: PropsItemType< Mutable<FormItemProps> & { [key: string]: any; style?: CSSProperties | undefined; }> | undefined; fieldProps?: PropsItemType<Partial<{ [key: string]: any; style: CSSProperties; rows: number; autocomplete: string; type: "" | "number" | "default" | "search" | "checkbox" | "radio" | "textarea" | "text" | "circle" | "color" | "button" | "success" | "warning" | "info" | "primary" | "danger" | "reset" | "submit" | "time" | "image" | "line" | "date" | "year" | "years" | "month" | "dates" | "week" | "datetime" | "datetimerange" | "daterange" | "monthrange" | "range" | "dashboard" | "hidden" | "datetime-local" | "email" | "file" | "password" | "tel" | "url"; loading: EpPropMergeType<BooleanConstructor, unknown, unknown> | EpPropMergeType<StringConstructor, "lazy" | "eager", unknown> | undefined; step: string | number; format: string | ProgressFn | undefined; /** * 表单发生变化 * @param data * @param index * @param column * @param item */ filterMethod: Function | ((node: CascaderNode, keyword: string) => boolean) | undefined; id: string | [string, string]; effect: string; height: string | number; autosize: InputAutoSize; } & Mutable<Omit< AutocompleteProps, OmitTypes> & Omit< CascaderProps, OmitTypes> & Omit< CheckboxGroupProps, OmitTypes> & Omit< ColorPickerProps, OmitTypes> & Omit< DatePickerProps, OmitTypes> & Omit< InputProps, OmitTypes> & Omit< InputNumberProps, OmitTypes> & Omit< RadioGroupProps, OmitTypes> & Omit< RateProps, OmitTypes> & Omit< ISelectProps, OmitTypes> & Omit< SliderProps, OmitTypes> & Omit< SwitchProps, OmitTypes> & Omit< TimePickerDefaultProps, OmitTypes> & Omit< TimeSelectProps, OmitTypes> & Omit< PlusRadioProps, OmitTypes> & Omit< PlusDatePickerProps, OmitTypes> & Omit< PlusInputTagProps, OmitTypes> & Omit< TextProps, OmitTypes> & Omit< ImageProps, OmitTypes> & Omit< LinkProps, OmitTypes> & Omit< TagProps, OmitTypes> & Omit< ProgressProps, OmitTypes>>>> | undefined; renderField?: ((value: FieldValueType, onChange: (value: FieldValueType) => void, props: PlusColumn) => RenderTypes) | undefined; colProps?: Partial< Mutable<ColProps> & { [key: string]: any; style?: CSSProperties | undefined; }> | undefined; hasLabel?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; renderLabel?: ((label: string, props: PlusColumn) => RenderTypes) | undefined; renderExtra?: ((column: PlusColumn) => RenderTypes) | undefined; fieldSlots?: { [slotName: string]: (data?: any) => RenderTypes; } | undefined; fieldChildrenSlot?: ((option?: OptionsRow<undefined> | undefined) => RenderTypes) | undefined; renderErrorMessage?: ((props: PlusColumn & { value?: FieldValueType; error?: string | undefined; label?: string | undefined; }) => RenderTypes) | undefined; }) => any>> & Partial<Record<string, (_: { [x: string]: any; label?: string | ComputedRef<string> | undefined; prop: string; width?: string | number | undefined; minWidth?: string | number | undefined; editable?: boolean | undefined; valueType?: TableValueType | FormItemValueType; hideInDescriptions?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; hideInForm?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; hideInTable?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; hideInSearch?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; descriptionsItemProps?: RecordType | undefined; options?: OptionsType | undefined; optionsMap?: { label?: string | undefined; value?: string | undefined; } | undefined; customGetStatus?: ((data: { options: OptionsRow<undefined>[]; value: string | number; row: RecordType; }) => OptionsRow<undefined>) | undefined; tooltip?: string | Partial< ElTooltipProps> | ComputedRef<string> | ComputedRef<Partial< ElTooltipProps>> | undefined; render?: ((value: any, data: { row: RecordType; column: PlusColumn; index: number; }) => RenderTypes) | undefined; renderHTML?: ((value: any, data: { row: RecordType; column: PlusColumn; index: number; }) => string) | undefined; renderHeader?: ((label: string, props: PlusColumn) => RenderTypes) | undefined; renderDescriptionsItem?: ((data: { value: string; column: PlusColumn; row: RecordType; }) => RenderTypes) | undefined; renderDescriptionsLabel?: ((data: { label: string; column: PlusColumn; row: RecordType; }) => RenderTypes) | undefined; order?: number | ComputedRef<number> | undefined; children?: PlusColumn[] | undefined; headerFilter?: boolean | undefined; disabledHeaderFilter?: boolean | undefined; headerIsChecked?: boolean | undefined; tableColumnProps?: Partial<Omit<TableColumnCtx<any>, "label " | "prop" | "width" | "minWidth"> & { [key: string]: any; }> | undefined; preview?: boolean | undefined; linkText?: string | undefined; formatter?: ((value: any, data: { row: RecordType; column: PlusColumn; index: number; }) => string | number) | undefined; formProps?: Partial< PlusFormProps> | ComputedRef<Partial< PlusFormProps>> | ((value: FieldValueType, data: { row: Record<string, any>; index: number; }) => Partial< PlusFormProps>) | undefined; formItemProps?: PropsItemType< Mutable<FormItemProps> & { [key: string]: any; style?: CSSProperties | undefined; }> | undefined; fieldProps?: PropsItemType<Partial<{ [key: string]: any; style: CSSProperties; rows: number; autocomplete: string; type: "" | "number" | "default" | "search" | "checkbox" | "radio" | "textarea" | "text" | "circle" | "color" | "button" | "success" | "warning" | "info" | "primary" | "danger" | "reset" | "submit" | "time" | "image" | "line" | "date" | "year" | "years" | "month" | "dates" | "week" | "datetime" | "datetimerange" | "daterange" | "monthrange" | "range" | "dashboard" | "hidden" | "datetime-local" | "email" | "file" | "password" | "tel" | "url"; loading: EpPropMergeType<BooleanConstructor, unknown, unknown> | EpPropMergeType<StringConstructor, "lazy" | "eager", unknown> | undefined; step: string | number; format: string | ProgressFn | undefined; /** * 表单发生变化 * @param data * @param index * @param column * @param item */ filterMethod: Function | ((node: CascaderNode, keyword: string) => boolean) | undefined; id: string | [string, string]; effect: string; height: string | number; autosize: InputAutoSize; } & Mutable<Omit< AutocompleteProps, OmitTypes> & Omit< CascaderProps, OmitTypes> & Omit< CheckboxGroupProps, OmitTypes> & Omit< ColorPickerProps, OmitTypes> & Omit< DatePickerProps, OmitTypes> & Omit< InputProps, OmitTypes> & Omit< InputNumberProps, OmitTypes> & Omit< RadioGroupProps, OmitTypes> & Omit< RateProps, OmitTypes> & Omit< ISelectProps, OmitTypes> & Omit< SliderProps, OmitTypes> & Omit< SwitchProps, OmitTypes> & Omit< TimePickerDefaultProps, OmitTypes> & Omit< TimeSelectProps, OmitTypes> & Omit< PlusRadioProps, OmitTypes> & Omit< PlusDatePickerProps, OmitTypes> & Omit< PlusInputTagProps, OmitTypes> & Omit< TextProps, OmitTypes> & Omit< ImageProps, OmitTypes> & Omit< LinkProps, OmitTypes> & Omit< TagProps, OmitTypes> & Omit< ProgressProps, OmitTypes>>>> | undefined; renderField?: ((value: FieldValueType, onChange: (value: FieldValueType) => void, props: PlusColumn) => RenderTypes) | undefined; colProps?: Partial< Mutable<ColProps> & { [key: string]: any; style?: CSSProperties | undefined; }> | undefined; hasLabel?: boolean | Ref<boolean> | ComputedRef<boolean> | undefined; renderLabel?: ((label: string, props: PlusColumn) => RenderTypes) | undefined; renderExtra?: ((column: PlusColumn) => RenderTypes) | undefined; fieldSlots?: { [slotName: string]: (data?: any) => RenderTypes; } | undefined; fieldChildrenSlot?: ((option?: OptionsRow<undefined> | undefined) => RenderTypes) | undefined; renderErrorMessage?: ((props: PlusColumn & { value?: FieldValueType; error?: string | undefined; label?: string | undefined; }) => RenderTypes) | undefined; }) => any>> & Partial<Record<string, (_: { column: any; prop: string; valueType: TableValueType | FormItemValueType; row: RecordType; index: number; rowIndex: number; fieldProps: RecordType; options: OptionsRow<undefined>[]; value: any; }) => any>> & { "edit-icon"?(_: {}): any; }; })[] | null | undefined>; }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, { formChange: (data: FormChangeCallBackParams) => void; }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PlusTableColumnProps>, { columns: () => never[]; tableDataLength: number; editable: boolean; }>>> & { onFormChange?: ((data: FormChangeCallBackParams) => any) | undefined; }, { columns: PlusColumn[]; editable: boolean | "click" | "dblclick"; tableDataLength: number; }, {}>, Partial<Record<string, (_: any) => any>> & Partial<Record<NonNullable<string | number>, (_: any) => any>> & Partial<Record<string, (_: { column: any; prop: string; valueType: TableValueType | FormItemValueType; row: RecordType; index: number; rowIndex: number; fieldProps: RecordType; options: OptionsRow<undefined>[]; value: any; }) => any>> & Partial<Record<string, (_: { column: any; prop: string; valueType: TableValueType | FormItemValueType; row: RecordType; index: number; rowIndex: number; fieldProps: RecordType; options: OptionsRow<undefined>[]; value: any; }) => any>> & Partial<Record<string, (_: { column: any; prop: string; valueType: TableValueType | FormItemValueType; row: RecordType; index: number; rowIndex: number; fieldProps: RecordType; options: OptionsRow<undefined>[]; value: any; }) => any>> & { "tooltip-icon"?(_: {}): any; "edit-icon"?(_: {}): any; }>; export default _default; type __VLS_NonUndefinedable<T> = T extends undefined ? never : T; type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: PropType<__VLS_NonUndefinedable<T[K]>>; } : { type: PropType<T[K]>; required: true; }; }; type __VLS_WithDefaults<P, D> = { [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & { default: D[K]; }> : P[K]; }; type __VLS_Prettify<T> = { [K in keyof T]: T[K]; } & {}; type __VLS_WithTemplateSlots<T, S> = T & { new (): { $slots: S; }; };