You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
6.9 KiB

1 month ago
  1. {"ast":null,"code":"import { isNil } from 'lodash-unified';\nimport { buildProps } from '../../../utils/vue/props/runtime.mjs';\nimport { useSizeProp } from '../../../hooks/use-size/index.mjs';\nimport { isNumber } from '../../../utils/types.mjs';\nimport { useAriaProps } from '../../../hooks/use-aria/index.mjs';\nimport { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';\nconst inputNumberProps = buildProps({\n id: {\n type: String,\n default: void 0\n },\n step: {\n type: Number,\n default: 1\n },\n stepStrictly: Boolean,\n max: {\n type: Number,\n default: Number.POSITIVE_INFINITY\n },\n min: {\n type: Number,\n default: Number.NEGATIVE_INFINITY\n },\n modelValue: Number,\n readonly: Boolean,\n disabled: Boolean,\n size: useSizeProp,\n controls: {\n type: Boolean,\n default: true\n },\n controlsPosition: {\n type: String,\n default: \"\",\n values: [\"\", \"right\"]\n },\n valueOnClear: {\n type: [String, Number, null],\n validator: val => val === null || isNumber(val) || [\"min\", \"max\"].includes(val),\n default: null\n },\n name: String,\n placeholder: String,\n precision: {\n type: Number,\n validator: val => val >= 0 && val === Number.parseInt(`${val}`, 10)\n },\n validateEvent: {\n type: Boolean,\n default: true\n },\n ...useAriaProps([\"ariaLabel\"])\n});\nconst inputNumberEmits = {\n [CHANGE_EVENT]: (cur, prev) => prev !== cur,\n blur: e => e instanceof FocusEvent,\n focus: e => e instanceof FocusEvent,\n [INPUT_EVENT]: val => isNumber(val) || isNil(val),\n [UPDATE_MODEL_EVENT]: val => isNumber(val) || isNil(val)\n};\nexport { inputNumberEmits, inputNumberProps };","map":{"version":3,"names":["inputNumberProps","buildProps","id","type","String","default","step","Number","stepStrictly","Boolean","max","POSITIVE_INFINITY","min","NEGATIVE_INFINITY","modelValue","readonly","disabled","size","useSizeProp","controls","controlsPosition","values","valueOnClear","validator","val","isNumber","includes","name","placeholder","precision","parseInt","validateEvent","useAriaProps","inputNumberEmits","CHANGE_EVENT","cur","prev","blur","e","FocusEvent","focus","INPUT_EVENT","isNil","UPDATE_MODEL_EVENT"],"sources":["../../../../../../packages/components/input-number/src/input-number.ts"],"sourcesContent":["import { isNil } from 'lodash-unified'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { buildProps, isNumber } from '@element-plus/utils'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type InputNumber from './input-number.vue'\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.POSITIVE_INFINITY,\n },\n /**\n * @description the minimum allowed value\n */\n min: {\n type: Number,\n default: Number.NEGATIVE_INFINITY,\n },\n /**\n * @description binding value\n */\n modelValue: Number,\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: 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 t