hongluan-ui
Version:
Hongluan Component Library for Vue 3
101 lines (98 loc) • 2.27 kB
JavaScript
import { isNil } from 'lodash-unified';
import '../../../utils/index.mjs';
import '../../../constants/index.mjs';
import '../../group/index.mjs';
import '../../../hooks/index.mjs';
import { isValidComponentSize } from '../../../utils/vue/validator.mjs';
import { isNumber } from '../../../utils/types.mjs';
import { groupProps } from '../../group/src/group-props.mjs';
import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
const inputNumberProps = {
id: {
type: String,
default: void 0
},
modelValue: {
type: Number
},
step: {
type: Number,
default: 1
},
stepStrictly: {
type: Boolean,
default: false
},
max: {
type: Number,
default: Number.POSITIVE_INFINITY
},
min: {
type: Number,
default: Number.NEGATIVE_INFINITY
},
disabled: {
type: Boolean,
default: false
},
size: {
type: String,
validator: isValidComponentSize
},
controls: {
type: Boolean,
default: true
},
controlsPosition: {
type: String,
default: "initial"
},
valueOnClear: {
type: [String, Number, null],
validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
default: null
},
name: String,
label: String,
placeholder: String,
readonly: Boolean,
precision: {
type: Number,
validator: (val) => val >= 0 && val === Number.parseInt(val + "", 10)
},
validateEvent: {
type: Boolean,
default: true
},
merge: {
type: Boolean,
default: false
},
deepMerge: {
type: Boolean,
default: false
},
indent: {
type: [Boolean, String],
default: false
},
gap: {
type: [Boolean, String],
default: false
},
round: Boolean,
fill: Boolean,
block: Boolean,
dir: groupProps.dir,
...useAriaProps(["ariaLabel"])
};
const inputNumberEmits = {
[CHANGE_EVENT]: (cur, prev) => prev !== cur,
blur: (e) => e instanceof FocusEvent,
focus: (e) => e instanceof FocusEvent,
[INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
[UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
};
export { inputNumberEmits, inputNumberProps };
//# sourceMappingURL=input-number.mjs.map