element-plus/packages/tokens/form.ts

45 lines
1.3 KiB
TypeScript
Raw Normal View History

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
Feat/remove mitt (#3356) * 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
2021-09-16 21:19:27 +08:00
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
2020-10-30 23:26:33 +08:00
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
Feat/remove mitt (#3356) * 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
2021-09-16 21:19:27 +08:00
evaluateValidationEnabled(): void
resetField(): void
clearValidate(): void
}
Feat/remove mitt (#3356) * 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
2021-09-16 21:19:27 +08:00
export const elFormKey: InjectionKey<ElFormContext> = Symbol('elForm')
export const elFormItemKey: InjectionKey<ElFormItemContext> =
Feat/remove mitt (#3356) * 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
2021-09-16 21:19:27 +08:00
Symbol('elFormItem')