mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
c17161e21c
* feat(components): collapse use provide/inject instead of mitt events # Conflicts: # packages/components/collapse/src/collapse-item.vue # packages/components/collapse/src/collapse.vue * feat(components): menu use provide/inject instead of mitt events # Conflicts: # packages/components/menu/src/menu.ts * feat(components): form use provide/inject instead of mitt events # Conflicts: # packages/components/checkbox/src/checkbox-group.vue # packages/components/checkbox/src/useCheckbox.ts # packages/components/form/src/form-item.vue # packages/components/form/src/form.vue # packages/components/input/src/index.vue # packages/components/radio/src/radio-group.vue # packages/components/select/src/useSelect.ts # packages/components/slider/src/index.vue # packages/components/time-picker/src/common/picker.vue # packages/components/transfer/src/index.vue # packages/tokens/form.ts * feat(components): tree use provide/inject instead of mitt events # Conflicts: # packages/components/tree/src/model/useDragNode.ts # packages/components/tree/src/tree-node.vue * feat(components): select use provide/inject instead of mitt events # Conflicts: # packages/components/select/src/option-group.vue # packages/components/select/src/select.vue # packages/components/select/src/useOption.ts # packages/components/select/src/useSelect.ts * feat: remove mitt from packages dependencies # Conflicts: # packages/components/package.json # packages/element-plus/package.json # packages/tokens/package.json * feat: remove mitt from webpack.config.js * refactor: change imports order * refactor: import types separately * fix: revert removing mitt from webpack.config.js This config is not related to the build so no need to remove mitt here
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import type { InjectionKey } from 'vue'
|
|
import type { FieldErrorList } from 'async-validator'
|
|
import type { ComponentSize } from '@element-plus/utils/types'
|
|
|
|
export interface ElFormContext {
|
|
registerLabelWidth(width: number, oldWidth: number): void
|
|
deregisterLabelWidth(width: number): void
|
|
autoLabelWidth: string | undefined
|
|
emit: (evt: string, ...args: any[]) => void
|
|
addField: (field: ElFormItemContext) => void
|
|
removeField: (field: ElFormItemContext) => void
|
|
labelSuffix: string
|
|
inline?: boolean
|
|
inlineMessage?: boolean
|
|
model?: Record<string, unknown>
|
|
size?: string
|
|
showMessage?: boolean
|
|
labelPosition?: string
|
|
labelWidth?: string | number
|
|
rules?: Record<string, unknown>
|
|
statusIcon?: boolean
|
|
hideRequiredAsterisk?: boolean
|
|
disabled?: boolean
|
|
}
|
|
|
|
export interface ValidateFieldCallback {
|
|
(isValid?: string, invalidFields?: FieldErrorList): void
|
|
}
|
|
|
|
export interface ElFormItemContext {
|
|
prop?: string
|
|
size?: ComponentSize
|
|
validateState: string
|
|
$el: HTMLDivElement
|
|
validate(trigger: string, callback?: ValidateFieldCallback): void
|
|
updateComputedLabelWidth(width: number): void
|
|
evaluateValidationEnabled(): void
|
|
resetField(): void
|
|
clearValidate(): void
|
|
}
|
|
|
|
export const elFormKey: InjectionKey<ElFormContext> = Symbol('elForm')
|
|
export const elFormItemKey: InjectionKey<ElFormItemContext> =
|
|
Symbol('elFormItem')
|