JewelryMall/admin/node_modules/element-plus/es/components/input/src/input.mjs.map
2026-02-14 19:29:15 +08:00

1 line
13 KiB
Plaintext

{"version":3,"file":"input.mjs","sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import { markRaw } from 'vue'\nimport {\n buildProps,\n definePropType,\n iconPropType,\n isString,\n mutable,\n} from '@element-plus/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { CircleClose } from '@element-plus/icons-vue'\n\nimport type {\n Component,\n ExtractPublicPropTypes,\n HTMLAttributes,\n StyleValue,\n} from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\n\nexport type InputModelModifiers = {\n lazy?: true\n number?: true\n trim?: true\n}\nexport type InputAutoSize = { minRows?: number; maxRows?: number } | boolean\n// Some commonly used values for input type\nexport type InputType =\n | 'text'\n | 'textarea'\n | 'number'\n | 'password'\n | 'email'\n | 'search'\n | 'tel'\n | 'url'\n | (string & NonNullable<unknown>)\n\nexport interface InputProps {\n /**\n * @description native input id\n */\n id?: string\n /**\n * @description input box size\n */\n size?: ComponentSize\n /**\n * @description whether to disable\n */\n disabled?: boolean\n /**\n * @description binding value\n */\n modelValue?: string | number | null | undefined\n /**\n * @description v-model modifiers, reference [Vue modifiers](https://vuejs.org/guide/essentials/forms.html#modifiers)\n */\n modelModifiers?: InputModelModifiers\n /**\n * @description same as `maxlength` in native input\n */\n maxlength?: string | number\n /**\n * @description same as `minlength` in native input\n */\n minlength?: string | number\n /**\n * @description type of input, see more in [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)\n */\n type?: InputType\n /**\n * @description control the resizability\n */\n resize?: 'none' | 'both' | 'horizontal' | 'vertical'\n /**\n * @description whether textarea has an adaptive height\n */\n autosize?: InputAutoSize\n /**\n * @description native input autocomplete\n * - When the number of literal types in a union exceeds 315, the TS2590 error occurs. see: https://github.com/vuejs/core/issues/10514\n */\n autocomplete?: string // HTMLInputElement['autocomplete']\n /**\n * @description format content\n */\n formatter?: (value: string) => string\n /**\n * @description parse content\n */\n parser?: (value: string) => string\n /**\n * @description placeholder\n */\n placeholder?: string\n /**\n * @description native input form\n */\n form?: string\n /**\n * @description native input readonly\n */\n readonly?: boolean\n /**\n * @description whether to show clear button\n */\n clearable?: boolean\n /**\n * @description custom clear icon component\n */\n clearIcon?: string | Component\n /**\n * @description toggleable password input\n */\n showPassword?: boolean\n /**\n * @description word count\n */\n showWordLimit?: boolean\n /**\n * @description word count position, valid when `show-word-limit` is true\n */\n wordLimitPosition?: 'inside' | 'outside'\n /**\n * @description suffix icon\n */\n suffixIcon?: string | Component\n /**\n * @description prefix icon\n */\n prefixIcon?: string | Component\n /**\n * @description container role, internal properties provided for use by the picker component\n */\n containerRole?: string\n /**\n * @description input tabindex\n */\n tabindex?: string | number\n /**\n * @description whether to trigger form validation\n */\n validateEvent?: boolean\n /**\n * @description input or textarea element style\n */\n inputStyle?: StyleValue\n /**\n * @description native input autofocus\n */\n autofocus?: boolean\n /**\n * @description number of rows of textarea, only works when `type` is 'textarea'\n */\n rows?: number\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n /**\n * @description native input mode for virtual keyboards\n */\n inputmode?: HTMLAttributes['inputmode']\n /**\n * @description same as `name` in native input\n */\n name?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputProps` instead.\n */\nexport const inputProps = buildProps({\n /**\n * @description native input id\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description input box size\n */\n size: useSizeProp,\n /**\n * @description whether to disable\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType<string | number | null | undefined>([\n String,\n Number,\n Object,\n ]),\n default: '',\n },\n /**\n * @description v-model modifiers, reference [Vue modifiers](https://vuejs.org/guide/essentials/forms.html#modifiers)\n */\n modelModifiers: {\n type: definePropType<InputModelModifiers>(Object),\n default: () => ({}),\n },\n /**\n * @description same as `maxlength` in native input\n */\n maxlength: {\n type: [String, Number],\n },\n /**\n * @description same as `minlength` in native input\n */\n minlength: {\n type: [String, Number],\n },\n /**\n * @description type of input, see more in [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)\n */\n type: {\n type: definePropType<InputType>(String),\n default: 'text',\n },\n /**\n * @description control the resizability\n */\n resize: {\n type: String,\n values: ['none', 'both', 'horizontal', 'vertical'],\n },\n /**\n * @description whether textarea has an adaptive height\n */\n autosize: {\n type: definePropType<InputAutoSize>([Boolean, Object]),\n default: false,\n },\n /**\n * @description native input autocomplete\n */\n autocomplete: {\n type: definePropType<HTMLInputElement['autocomplete']>(String),\n default: 'off',\n },\n /**\n * @description format content\n */\n formatter: {\n type: Function,\n },\n /**\n * @description parse content\n */\n parser: {\n type: Function,\n },\n /**\n * @description placeholder\n */\n placeholder: {\n type: String,\n },\n /**\n * @description native input form\n */\n form: {\n type: String,\n },\n /**\n * @description native input readonly\n */\n readonly: Boolean,\n /**\n * @description whether to show clear button\n */\n clearable: Boolean,\n /**\n * @description custom clear icon component\n */\n clearIcon: {\n type: iconPropType,\n default: CircleClose,\n },\n /**\n * @description toggleable password input\n */\n showPassword: Boolean,\n /**\n * @description word count\n */\n showWordLimit: Boolean,\n /**\n * @description word count position, valid when `show-word-limit` is true\n */\n wordLimitPosition: {\n type: String,\n values: ['inside', 'outside'],\n default: 'inside',\n },\n /**\n * @description suffix icon\n */\n suffixIcon: {\n type: iconPropType,\n },\n /**\n * @description prefix icon\n */\n prefixIcon: {\n type: iconPropType,\n },\n /**\n * @description container role, internal properties provided for use by the picker component\n */\n containerRole: {\n type: String,\n default: undefined,\n },\n /**\n * @description input tabindex\n */\n tabindex: {\n type: [String, Number],\n default: 0,\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description input or textarea element style\n */\n inputStyle: {\n type: definePropType<StyleValue>([Object, Array, String]),\n default: () => mutable({} as const),\n },\n /**\n * @description native input autofocus\n */\n autofocus: Boolean,\n rows: {\n type: Number,\n default: 2,\n },\n ...useAriaProps(['ariaLabel']),\n /**\n * @description native input mode for virtual keyboards\n */\n inputmode: {\n type: definePropType<HTMLAttributes['inputmode']>(String),\n default: undefined,\n },\n /**\n * @description same as `name` in native input\n */\n name: String,\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputProps` instead.\n */\nexport type InputPropsPublic = ExtractPublicPropTypes<typeof inputProps>\n\nexport const inputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n input: (value: string) => isString(value),\n change: (value: string, evt?: Event) =>\n isString(value) && (evt instanceof Event || evt === undefined),\n focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n clear: () => true,\n mouseleave: (evt: MouseEvent) => evt instanceof MouseEvent,\n mouseenter: (evt: MouseEvent) => evt instanceof MouseEvent,\n // NOTE: when autofill by browser, the keydown event is instanceof Event, not KeyboardEvent\n // relative bug report https://github.com/element-plus/element-plus/issues/6665\n keydown: (evt: KeyboardEvent | Event) => evt instanceof Event,\n compositionstart: (evt: CompositionEvent) => evt instanceof CompositionEvent,\n compositionupdate: (evt: CompositionEvent) => evt instanceof CompositionEvent,\n compositionend: (evt: CompositionEvent) => evt instanceof CompositionEvent,\n}\nexport type InputEmits = typeof inputEmits\n\n/**\n * @description default values for InputProps, used in components that extend InputProps like Autocomplete\n */\nexport const inputPropsDefaults = {\n disabled: undefined,\n modelValue: '',\n modelModifiers: () => ({}),\n type: 'text' as InputType,\n autocomplete: 'off',\n clearIcon: markRaw(CircleClose),\n wordLimitPosition: 'inside',\n tabindex: 0,\n validateEvent: true,\n inputStyle: () => ({}),\n rows: 2,\n} as const\n"],"names":[],"mappings":";;;;;;;;;;AA6KO,MAAM,aAAa,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAInC,EAAA,EAAI;AAAA,IACF,IAAA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