This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import InputNumber from './src/input-number.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElInputNumber: SFCWithInstall<typeof InputNumber>;
export default ElInputNumber;
export * from './src/input-number';

View File

@@ -0,0 +1,15 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var inputNumber$1 = require('./src/input-number2.js');
var inputNumber = require('./src/input-number.js');
var install = require('../../utils/vue/install.js');
const ElInputNumber = install.withInstall(inputNumber$1["default"]);
exports.inputNumberEmits = inputNumber.inputNumberEmits;
exports.inputNumberProps = inputNumber.inputNumberProps;
exports.ElInputNumber = ElInputNumber;
exports["default"] = ElInputNumber;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/components/input-number/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport InputNumber from './src/input-number.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElInputNumber: SFCWithInstall<typeof InputNumber> =\n withInstall(InputNumber)\n\nexport default ElInputNumber\nexport * from './src/input-number'\n"],"names":["withInstall","InputNumber"],"mappings":";;;;;;;;AAEY,MAAC,aAAa,GAAGA,mBAAW,CAACC,wBAAW;;;;;;;"}

View File

@@ -0,0 +1,50 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type InputNumber from './input-number.vue';
export declare const inputNumberProps: {
readonly inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
readonly align: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right") | ((new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right"))[], unknown, unknown, "center", boolean>;
readonly disabledScientific: BooleanConstructor;
readonly ariaLabel: StringConstructor;
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
readonly step: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly stepStrictly: BooleanConstructor;
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
readonly min: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
readonly modelValue: {
readonly type: import("vue").PropType<any>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly readonly: BooleanConstructor;
readonly disabled: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly controls: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly controlsPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "right", unknown, "", boolean>;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor, null], unknown, unknown, null, boolean>;
readonly name: StringConstructor;
readonly placeholder: StringConstructor;
readonly precision: {
readonly type: import("vue").PropType<number>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
};
export type InputNumberProps = ExtractPropTypes<typeof inputNumberProps>;
export type InputNumberPropsPublic = __ExtractPublicPropTypes<typeof inputNumberProps>;
export declare const inputNumberEmits: {
change: (cur: number | undefined, prev: number | undefined) => boolean;
blur: (e: FocusEvent) => boolean;
focus: (e: FocusEvent) => boolean;
input: (val: number | null | undefined) => boolean;
"update:modelValue": (val: number | undefined) => boolean;
};
export type InputNumberEmits = typeof inputNumberEmits;
export type InputNumberInstance = InstanceType<typeof InputNumber> & unknown;

View File

@@ -0,0 +1,81 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var lodashUnified = require('lodash-unified');
var runtime = require('../../../utils/vue/props/runtime.js');
var index = require('../../../hooks/use-size/index.js');
var types = require('../../../utils/types.js');
var index$1 = require('../../../hooks/use-aria/index.js');
var event = require('../../../constants/event.js');
const inputNumberProps = runtime.buildProps({
id: {
type: String,
default: void 0
},
step: {
type: Number,
default: 1
},
stepStrictly: Boolean,
max: {
type: Number,
default: Number.MAX_SAFE_INTEGER
},
min: {
type: Number,
default: Number.MIN_SAFE_INTEGER
},
modelValue: {
type: [Number, null]
},
readonly: Boolean,
disabled: Boolean,
size: index.useSizeProp,
controls: {
type: Boolean,
default: true
},
controlsPosition: {
type: String,
default: "",
values: ["", "right"]
},
valueOnClear: {
type: [String, Number, null],
validator: (val) => val === null || types.isNumber(val) || ["min", "max"].includes(val),
default: null
},
name: String,
placeholder: String,
precision: {
type: Number,
validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
},
validateEvent: {
type: Boolean,
default: true
},
...index$1.useAriaProps(["ariaLabel"]),
inputmode: {
type: runtime.definePropType(String),
default: void 0
},
align: {
type: runtime.definePropType(String),
default: "center"
},
disabledScientific: Boolean
});
const inputNumberEmits = {
[event.CHANGE_EVENT]: (cur, prev) => prev !== cur,
blur: (e) => e instanceof FocusEvent,
focus: (e) => e instanceof FocusEvent,
[event.INPUT_EVENT]: (val) => types.isNumber(val) || lodashUnified.isNil(val),
[event.UPDATE_MODEL_EVENT]: (val) => types.isNumber(val) || lodashUnified.isNil(val)
};
exports.inputNumberEmits = inputNumberEmits;
exports.inputNumberProps = inputNumberProps;
//# sourceMappingURL=input-number.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,118 @@
declare function __VLS_template(): {
"decrease-icon"?(_: {}): any;
"increase-icon"?(_: {}): any;
prefix?(_: {}): any;
suffix?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
readonly align: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right") | ((new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right"))[], unknown, unknown, "center", boolean>;
readonly disabledScientific: BooleanConstructor;
readonly ariaLabel: StringConstructor;
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
readonly step: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly stepStrictly: BooleanConstructor;
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
readonly min: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
readonly modelValue: {
readonly type: import("vue").PropType<any>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly readonly: BooleanConstructor;
readonly disabled: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly controls: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly controlsPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "right", unknown, "", boolean>;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor, null], unknown, unknown, null, boolean>;
readonly name: StringConstructor;
readonly placeholder: StringConstructor;
readonly precision: {
readonly type: import("vue").PropType<number>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
}, {
/** @description get focus the input component */
focus: () => void;
/** @description remove focus the input component */
blur: () => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
focus: (e: FocusEvent) => void;
"update:modelValue": (val: number | undefined) => void;
change: (cur: number | undefined, prev: number | undefined) => void;
input: (val: number | null | undefined) => void;
blur: (e: FocusEvent) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
readonly align: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right") | ((new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right"))[], unknown, unknown, "center", boolean>;
readonly disabledScientific: BooleanConstructor;
readonly ariaLabel: StringConstructor;
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
readonly step: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly stepStrictly: BooleanConstructor;
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
readonly min: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
readonly modelValue: {
readonly type: import("vue").PropType<any>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly readonly: BooleanConstructor;
readonly disabled: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly controls: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly controlsPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "right", unknown, "", boolean>;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor, null], unknown, unknown, null, boolean>;
readonly name: StringConstructor;
readonly placeholder: StringConstructor;
readonly precision: {
readonly type: import("vue").PropType<number>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
}>> & {
"onUpdate:modelValue"?: ((val: number | undefined) => any) | undefined;
onChange?: ((cur: number | undefined, prev: number | undefined) => any) | undefined;
onFocus?: ((e: FocusEvent) => any) | undefined;
onBlur?: ((e: FocusEvent) => any) | undefined;
onInput?: ((val: number | null | undefined) => any) | undefined;
}, {
readonly disabled: boolean;
readonly id: string;
readonly valueOnClear: any;
readonly readonly: boolean;
readonly min: number;
readonly max: number;
readonly validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly inputmode: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
readonly align: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right") | ((new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right"))[], unknown, unknown>;
readonly step: number;
readonly controls: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly controlsPosition: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "right", unknown>;
readonly disabledScientific: boolean;
readonly stepStrictly: boolean;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,382 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var lodashUnified = require('lodash-unified');
var index$4 = require('../../input/index.js');
var index$2 = require('../../icon/index.js');
var iconsVue = require('@element-plus/icons-vue');
var inputNumber = require('./input-number.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var index$3 = require('../../../directives/repeat-click/index.js');
var index = require('../../../hooks/use-locale/index.js');
var index$1 = require('../../../hooks/use-namespace/index.js');
var useFormItem = require('../../form/src/hooks/use-form-item.js');
var types = require('../../../utils/types.js');
var useFormCommonProps = require('../../form/src/hooks/use-form-common-props.js');
var event = require('../../../constants/event.js');
var aria = require('../../../constants/aria.js');
var error = require('../../../utils/error.js');
var shared = require('@vue/shared');
const __default__ = vue.defineComponent({
name: "ElInputNumber"
});
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: inputNumber.inputNumberProps,
emits: inputNumber.inputNumberEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { t } = index.useLocale();
const ns = index$1.useNamespace("input-number");
const input = vue.ref();
const data = vue.reactive({
currentValue: props.modelValue,
userInput: null
});
const { formItem } = useFormItem.useFormItem();
const minDisabled = vue.computed(() => types.isNumber(props.modelValue) && props.modelValue <= props.min);
const maxDisabled = vue.computed(() => types.isNumber(props.modelValue) && props.modelValue >= props.max);
const numPrecision = vue.computed(() => {
const stepPrecision = getPrecision(props.step);
if (!types.isUndefined(props.precision)) {
if (stepPrecision > props.precision) ;
return props.precision;
} else {
return Math.max(getPrecision(props.modelValue), stepPrecision);
}
});
const controlsAtRight = vue.computed(() => {
return props.controls && props.controlsPosition === "right";
});
const inputNumberSize = useFormCommonProps.useFormSize();
const inputNumberDisabled = useFormCommonProps.useFormDisabled();
const displayValue = vue.computed(() => {
if (data.userInput !== null) {
return data.userInput;
}
let currentValue = data.currentValue;
if (lodashUnified.isNil(currentValue))
return "";
if (types.isNumber(currentValue)) {
if (Number.isNaN(currentValue))
return "";
if (!types.isUndefined(props.precision)) {
currentValue = currentValue.toFixed(props.precision);
}
}
return currentValue;
});
const toPrecision = (num, pre) => {
if (types.isUndefined(pre))
pre = numPrecision.value;
if (pre === 0)
return Math.round(num);
let snum = String(num);
const pointPos = snum.indexOf(".");
if (pointPos === -1)
return num;
const nums = snum.replace(".", "").split("");
const datum = nums[pointPos + pre];
if (!datum)
return num;
const length = snum.length;
if (snum.charAt(length - 1) === "5") {
snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
}
return Number.parseFloat(Number(snum).toFixed(pre));
};
const getPrecision = (value) => {
if (lodashUnified.isNil(value))
return 0;
const valueString = value.toString();
const dotPosition = valueString.indexOf(".");
let precision = 0;
if (dotPosition !== -1) {
precision = valueString.length - dotPosition - 1;
}
return precision;
};
const ensurePrecision = (val, coefficient = 1) => {
if (!types.isNumber(val))
return data.currentValue;
if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
return val;
} else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
return val;
}
return toPrecision(val + props.step * coefficient);
};
const handleKeydown = (event) => {
var _a;
const e = event;
if (props.disabledScientific && ["e", "E"].includes(e.key)) {
e.preventDefault();
return;
}
const keyHandlers = {
[aria.EVENT_CODE.up]: () => {
e.preventDefault();
increase();
},
[aria.EVENT_CODE.down]: () => {
e.preventDefault();
decrease();
}
};
(_a = keyHandlers[e.key]) == null ? void 0 : _a.call(keyHandlers);
};
const increase = () => {
if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
return;
const value = Number(displayValue.value) || 0;
const newVal = ensurePrecision(value);
setCurrentValue(newVal);
emit(event.INPUT_EVENT, data.currentValue);
setCurrentValueToModelValue();
};
const decrease = () => {
if (props.readonly || inputNumberDisabled.value || minDisabled.value)
return;
const value = Number(displayValue.value) || 0;
const newVal = ensurePrecision(value, -1);
setCurrentValue(newVal);
emit(event.INPUT_EVENT, data.currentValue);
setCurrentValueToModelValue();
};
const verifyValue = (value, update) => {
const { max, min, step, precision, stepStrictly, valueOnClear } = props;
if (max < min) {
error.throwError("InputNumber", "min should not be greater than max.");
}
let newVal = Number(value);
if (lodashUnified.isNil(value) || Number.isNaN(newVal)) {
return null;
}
if (value === "") {
if (valueOnClear === null) {
return null;
}
newVal = shared.isString(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
}
if (stepStrictly) {
newVal = toPrecision(Math.round(newVal / step) * step, precision);
if (newVal !== value) {
update && emit(event.UPDATE_MODEL_EVENT, newVal);
}
}
if (!types.isUndefined(precision)) {
newVal = toPrecision(newVal, precision);
}
if (newVal > max || newVal < min) {
newVal = newVal > max ? max : min;
update && emit(event.UPDATE_MODEL_EVENT, newVal);
}
return newVal;
};
const setCurrentValue = (value, emitChange = true) => {
var _a;
const oldVal = data.currentValue;
const newVal = verifyValue(value);
if (!emitChange) {
emit(event.UPDATE_MODEL_EVENT, newVal);
return;
}
if (oldVal === newVal && value)
return;
data.userInput = null;
emit(event.UPDATE_MODEL_EVENT, newVal);
if (oldVal !== newVal) {
emit(event.CHANGE_EVENT, newVal, oldVal);
}
if (props.validateEvent) {
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => error.debugWarn());
}
data.currentValue = newVal;
};
const handleInput = (value) => {
data.userInput = value;
const newVal = value === "" ? null : Number(value);
emit(event.INPUT_EVENT, newVal);
setCurrentValue(newVal, false);
};
const handleInputChange = (value) => {
const newVal = value !== "" ? Number(value) : "";
if (types.isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
setCurrentValue(newVal);
}
setCurrentValueToModelValue();
data.userInput = null;
};
const focus = () => {
var _a, _b;
(_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
};
const blur = () => {
var _a, _b;
(_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
};
const handleFocus = (event) => {
emit("focus", event);
};
const handleBlur = (event) => {
var _a, _b;
data.userInput = null;
if (data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
input.value.input.value = "";
}
emit("blur", event);
if (props.validateEvent) {
(_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => error.debugWarn());
}
};
const setCurrentValueToModelValue = () => {
if (data.currentValue !== props.modelValue) {
data.currentValue = props.modelValue;
}
};
const handleWheel = (e) => {
if (document.activeElement === e.target)
e.preventDefault();
};
vue.watch(() => props.modelValue, (value, oldValue) => {
const newValue = verifyValue(value, true);
if (data.userInput === null && newValue !== oldValue) {
data.currentValue = newValue;
}
}, { immediate: true });
vue.watch(() => props.precision, () => {
data.currentValue = verifyValue(props.modelValue);
});
vue.onMounted(() => {
var _a;
const { min, max, modelValue } = props;
const innerInput = (_a = input.value) == null ? void 0 : _a.input;
innerInput.setAttribute("role", "spinbutton");
if (Number.isFinite(max)) {
innerInput.setAttribute("aria-valuemax", String(max));
} else {
innerInput.removeAttribute("aria-valuemax");
}
if (Number.isFinite(min)) {
innerInput.setAttribute("aria-valuemin", String(min));
} else {
innerInput.removeAttribute("aria-valuemin");
}
innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
if (!types.isNumber(modelValue) && modelValue != null) {
let val = Number(modelValue);
if (Number.isNaN(val)) {
val = null;
}
emit(event.UPDATE_MODEL_EVENT, val);
}
innerInput.addEventListener("wheel", handleWheel, { passive: false });
});
vue.onUpdated(() => {
var _a, _b;
const innerInput = (_a = input.value) == null ? void 0 : _a.input;
innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
});
expose({
focus,
blur
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass([
vue.unref(ns).b(),
vue.unref(ns).m(vue.unref(inputNumberSize)),
vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
vue.unref(ns).is("without-controls", !_ctx.controls),
vue.unref(ns).is("controls-right", vue.unref(controlsAtRight)),
vue.unref(ns).is(_ctx.align, !!_ctx.align)
]),
onDragstart: vue.withModifiers(() => {
}, ["prevent"])
}, [
_ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
key: 0,
role: "button",
"aria-label": vue.unref(t)("el.inputNumber.decrease"),
class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
onKeydown: vue.withKeys(decrease, ["enter"])
}, [
vue.renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
vue.createVNode(vue.unref(index$2.ElIcon), null, {
default: vue.withCtx(() => [
vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.ArrowDown), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.Minus), { key: 1 }))
]),
_: 1
})
])
], 42, ["aria-label", "onKeydown"])), [
[vue.unref(index$3.vRepeatClick), decrease]
]) : vue.createCommentVNode("v-if", true),
_ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
key: 1,
role: "button",
"aria-label": vue.unref(t)("el.inputNumber.increase"),
class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
onKeydown: vue.withKeys(increase, ["enter"])
}, [
vue.renderSlot(_ctx.$slots, "increase-icon", {}, () => [
vue.createVNode(vue.unref(index$2.ElIcon), null, {
default: vue.withCtx(() => [
vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.ArrowUp), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.Plus), { key: 1 }))
]),
_: 1
})
])
], 42, ["aria-label", "onKeydown"])), [
[vue.unref(index$3.vRepeatClick), increase]
]) : vue.createCommentVNode("v-if", true),
vue.createVNode(vue.unref(index$4.ElInput), {
id: _ctx.id,
ref_key: "input",
ref: input,
type: "number",
step: _ctx.step,
"model-value": vue.unref(displayValue),
placeholder: _ctx.placeholder,
readonly: _ctx.readonly,
disabled: vue.unref(inputNumberDisabled),
size: vue.unref(inputNumberSize),
max: _ctx.max,
min: _ctx.min,
name: _ctx.name,
"aria-label": _ctx.ariaLabel,
"validate-event": false,
inputmode: _ctx.inputmode,
onKeydown: handleKeydown,
onBlur: handleBlur,
onFocus: handleFocus,
onInput: handleInput,
onChange: handleInputChange
}, vue.createSlots({
_: 2
}, [
_ctx.$slots.prefix ? {
name: "prefix",
fn: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "prefix")
])
} : void 0,
_ctx.$slots.suffix ? {
name: "suffix",
fn: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "suffix")
])
} : void 0
]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "inputmode"])
], 42, ["onDragstart"]);
};
}
});
var InputNumber = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "input-number.vue"]]);
exports["default"] = InputNumber;
//# sourceMappingURL=input-number2.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/es/components/input/style/css';
import 'element-plus/theme-chalk/el-input-number.css';

View File

@@ -0,0 +1,7 @@
'use strict';
require('../../base/style/css.js');
require('../../input/style/css.js');
require('element-plus/theme-chalk/el-input-number.css');
//# sourceMappingURL=css.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}

View File

@@ -0,0 +1,3 @@
import 'element-plus/es/components/base/style';
import 'element-plus/es/components/input/style';
import 'element-plus/theme-chalk/src/input-number.scss';

View File

@@ -0,0 +1,7 @@
'use strict';
require('../../base/style/index.js');
require('../../input/style/index.js');
require('element-plus/theme-chalk/src/input-number.scss');
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}