{"version":3,"file":"input-number.mjs","names":[],"sources":["../../../../../../packages/components/input-number/src/input-number.ts"],"sourcesContent":["import { isNil } from 'lodash-unified'\nimport { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport {\n  CHANGE_EVENT,\n  INPUT_EVENT,\n  UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes, HTMLAttributes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type InputNumber from './input-number.vue'\n\n/**\n * @description input-number component props\n */\nexport interface InputNumberProps {\n  /**\n   * @description same as `id` in native input\n   */\n  id?: string\n  /**\n   * @description incremental step\n   */\n  step?: number\n  /**\n   * @description whether input value can only be multiple of step\n   */\n  stepStrictly?: boolean\n  /**\n   * @description the maximum allowed value\n   */\n  max?: number\n  /**\n   * @description the minimum allowed value\n   */\n  min?: number\n  /**\n   * @description binding value\n   */\n  modelValue?: number | null\n  /**\n   * @description same as `readonly` in native input\n   */\n  readonly?: boolean\n  /**\n   * @description whether the component is disabled\n   */\n  disabled?: boolean\n  /**\n   * @description size of the component\n   */\n  size?: ComponentSize\n  /**\n   * @description whether to enable the control buttons\n   */\n  controls?: boolean\n  /**\n   * @description position of the control buttons\n   */\n  controlsPosition?: '' | 'right'\n  /**\n   * @description value should be set when input box is cleared\n   */\n  valueOnClear?: 'min' | 'max' | number | null\n  /**\n   * @description same as `name` in native input\n   */\n  name?: string\n  /**\n   * @description same as `placeholder` in native input\n   */\n  placeholder?: string\n  /**\n   * @description precision of input value\n   */\n  precision?: number\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent?: boolean\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 alignment for the inner input text\n   */\n  align?: 'left' | 'right' | 'center'\n  /**\n   * @description whether to disable scientific notation input (e.g. 'e', 'E')\n   */\n  disabledScientific?: boolean\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.\n */\nexport const inputNumberProps = buildProps({\n  /**\n   * @description same as `id` in native input\n   */\n  id: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description incremental step\n   */\n  step: {\n    type: Number,\n    default: 1,\n  },\n  /**\n   * @description whether input value can only be multiple of step\n   */\n  stepStrictly: Boolean,\n  /**\n   * @description the maximum allowed value\n   */\n  max: {\n    type: Number,\n    default: Number.MAX_SAFE_INTEGER,\n  },\n  /**\n   * @description the minimum allowed value\n   */\n  min: {\n    type: Number,\n    default: Number.MIN_SAFE_INTEGER,\n  },\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: [Number, null],\n  },\n  /**\n   * @description same as `readonly` in native input\n   */\n  readonly: Boolean,\n  /**\n   * @description whether the component is disabled\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description size of the component\n   */\n  size: useSizeProp,\n  /**\n   * @description whether to enable the control buttons\n   */\n  controls: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description position of the control buttons\n   */\n  controlsPosition: {\n    type: String,\n    default: '',\n    values: ['', 'right'],\n  },\n  /**\n   * @description value should be set when input box is cleared\n   */\n  valueOnClear: {\n    type: definePropType<'min' | 'max' | number | null>([String, Number, null]),\n    validator: (val: 'min' | 'max' | number | null) =>\n      val === null || isNumber(val) || ['min', 'max'].includes(val),\n    default: null,\n  },\n  /**\n   * @description same as `name` in native input\n   */\n  name: String,\n  /**\n   * @description same as `placeholder` in native input\n   */\n  placeholder: String,\n  /**\n   * @description precision of input value\n   */\n  precision: {\n    type: Number,\n    validator: (val: number) =>\n      val >= 0 && val === Number.parseInt(`${val}`, 10),\n  },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\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 alignment for the inner input text\n   */\n  align: {\n    type: definePropType<'left' | 'right' | 'center'>(String),\n    default: 'center',\n  },\n  /**\n   * @description whether to disable scientific notation input (e.g. 'e', 'E')\n   */\n  disabledScientific: Boolean,\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.\n */\nexport type InputNumberPropsPublic = ExtractPublicPropTypes<\n  typeof inputNumberProps\n>\n\nexport const inputNumberEmits = {\n  [CHANGE_EVENT]: (cur: number | undefined, prev: number | undefined) =>\n    prev !== cur,\n  blur: (e: FocusEvent) => e instanceof FocusEvent,\n  focus: (e: FocusEvent) => e instanceof FocusEvent,\n  [INPUT_EVENT]: (val: number | null | undefined) =>\n    isNumber(val) || isNil(val),\n  [UPDATE_MODEL_EVENT]: (val: number | undefined) =>\n    isNumber(val) || isNil(val),\n}\nexport type InputNumberEmits = typeof inputNumberEmits\n\nexport type InputNumberInstance = InstanceType<typeof InputNumber> & unknown\n"],"mappings":";;;;;;;;;;;AAsGA,MAAa,mBAAmB,WAAW;CAIzC,IAAI;EACF,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,cAAc;CAId,KAAK;EACH,MAAM;EACN,SAAS,OAAO;EACjB;CAID,KAAK;EACH,MAAM;EACN,SAAS,OAAO;EACjB;CAID,YAAY,EACV,MAAM,CAAC,QAAQ,KAAK,EACrB;CAID,UAAU;CAIV,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,MAAM;CAIN,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,kBAAkB;EAChB,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,IAAI,QAAQ;EACtB;CAID,cAAc;EACZ,MAAM,eAA8C;GAAC;GAAQ;GAAQ;GAAK,CAAC;EAC3E,YAAY,QACV,QAAQ,QAAQ,SAAS,IAAI,IAAI,CAAC,OAAO,MAAM,CAAC,SAAS,IAAI;EAC/D,SAAS;EACV;CAID,MAAM;CAIN,aAAa;CAIb,WAAW;EACT,MAAM;EACN,YAAY,QACV,OAAO,KAAK,QAAQ,OAAO,SAAS,GAAG,OAAO,GAAG;EACpD;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CACD,GAAG,aAAa,CAAC,YAAY,CAAC;CAI9B,WAAW;EACT,MAAM,eAA4C,OAAO;EACzD,SAAS;EACV;CAID,OAAO;EACL,MAAM,eAA4C,OAAO;EACzD,SAAS;EACV;CAID,oBAAoB;CACrB,CAAU;AASX,MAAa,mBAAmB;EAC7B,gBAAgB,KAAyB,SACxC,SAAS;CACX,OAAO,MAAkB,aAAa;CACtC,QAAQ,MAAkB,aAAa;EACtC,eAAe,QACd,SAAS,IAAI,IAAI,MAAM,IAAI;EAC5B,sBAAsB,QACrB,SAAS,IAAI,IAAI,MAAM,IAAI;CAC9B"}