zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
{"version":3,"file":"input.mjs","sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import { isString } from '@vue/shared'\nimport {\n  buildProps,\n  definePropType,\n  iconPropType,\n  mutable,\n} from '@element-plus/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useSizeProp } from '@element-plus/hooks'\nimport type Input from './input.vue'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\n\nexport type InputAutoSize = { minRows?: number; maxRows?: number } | boolean\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: Boolean,\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 type of input\n   */\n  type: {\n    type: 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: 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: {\n    type: Boolean,\n    default: false,\n  },\n  /**\n   * @description native input readonly\n   */\n  clearable: {\n    type: Boolean,\n    default: false,\n  },\n  /**\n   * @description toggleable password input\n   */\n  showPassword: {\n    type: Boolean,\n    default: false,\n  },\n  /**\n   * @description word count\n   */\n  showWordLimit: {\n    type: Boolean,\n    default: false,\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 native input aria-label\n   */\n  label: {\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 texearea element style\n   */\n  inputStyle: {\n    type: definePropType<StyleValue>([Object, Array, String]),\n    default: () => mutable({} as const),\n  },\n} as const)\nexport type InputProps = ExtractPropTypes<typeof inputProps>\n\nexport const inputEmits = {\n  [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n  input: (value: string) => isString(value),\n  change: (value: string) => isString(value),\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\nexport type InputInstance = InstanceType<typeof Input>\n"],"names":[],"mappings":";;;;;;;;;;AASY,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,EAAE,EAAE;AACN,IAA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