完全跑通1.0版本
This commit is contained in:
8
frontend/node_modules/element-plus/es/components/input-number/index.d.ts
generated
vendored
Normal file
8
frontend/node_modules/element-plus/es/components/input-number/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SFCWithInstall } from "../../utils/vue/typescript.js";
|
||||
import { InputNumberEmits, InputNumberInstance, InputNumberProps, InputNumberPropsPublic, inputNumberEmits, inputNumberProps } from "./src/input-number.js";
|
||||
import _default from "./src/input-number.vue.js";
|
||||
|
||||
//#region ../../packages/components/input-number/index.d.ts
|
||||
declare const ElInputNumber: SFCWithInstall<typeof _default>;
|
||||
//#endregion
|
||||
export { ElInputNumber, ElInputNumber as default, InputNumberEmits, InputNumberInstance, InputNumberProps, InputNumberPropsPublic, inputNumberEmits, inputNumberProps };
|
||||
9
frontend/node_modules/element-plus/es/components/input-number/index.mjs
generated
vendored
Normal file
9
frontend/node_modules/element-plus/es/components/input-number/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { withInstall } from "../../utils/vue/install.mjs";
|
||||
import { inputNumberEmits, inputNumberProps } from "./src/input-number.mjs";
|
||||
import input_number_default from "./src/input-number2.mjs";
|
||||
//#region ../../packages/components/input-number/index.ts
|
||||
const ElInputNumber = withInstall(input_number_default);
|
||||
//#endregion
|
||||
export { ElInputNumber, ElInputNumber as default, inputNumberEmits, inputNumberProps };
|
||||
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/input-number/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/input-number/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","names":["InputNumber"],"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"],"mappings":";;;;AAKA,MAAa,gBACX,YAAYA,qBAAY"}
|
||||
172
frontend/node_modules/element-plus/es/components/input-number/src/input-number.d.ts
generated
vendored
Normal file
172
frontend/node_modules/element-plus/es/components/input-number/src/input-number.d.ts
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
|
||||
import { ComponentSize } from "../../../constants/size.js";
|
||||
import _default from "./input-number.vue.js";
|
||||
import * as _$vue from "vue";
|
||||
import { ExtractPublicPropTypes, HTMLAttributes } from "vue";
|
||||
|
||||
//#region ../../packages/components/input-number/src/input-number.d.ts
|
||||
/**
|
||||
* @description input-number component props
|
||||
*/
|
||||
interface InputNumberProps {
|
||||
/**
|
||||
* @description same as `id` in native input
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* @description incremental step
|
||||
*/
|
||||
step?: number;
|
||||
/**
|
||||
* @description whether input value can only be multiple of step
|
||||
*/
|
||||
stepStrictly?: boolean;
|
||||
/**
|
||||
* @description the maximum allowed value
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* @description the minimum allowed value
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* @description binding value
|
||||
*/
|
||||
modelValue?: number | null;
|
||||
/**
|
||||
* @description same as `readonly` in native input
|
||||
*/
|
||||
readonly?: boolean;
|
||||
/**
|
||||
* @description whether the component is disabled
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* @description size of the component
|
||||
*/
|
||||
size?: ComponentSize;
|
||||
/**
|
||||
* @description whether to enable the control buttons
|
||||
*/
|
||||
controls?: boolean;
|
||||
/**
|
||||
* @description position of the control buttons
|
||||
*/
|
||||
controlsPosition?: '' | 'right';
|
||||
/**
|
||||
* @description value should be set when input box is cleared
|
||||
*/
|
||||
valueOnClear?: 'min' | 'max' | number | null;
|
||||
/**
|
||||
* @description same as `name` in native input
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* @description same as `placeholder` in native input
|
||||
*/
|
||||
placeholder?: string;
|
||||
/**
|
||||
* @description precision of input value
|
||||
*/
|
||||
precision?: number;
|
||||
/**
|
||||
* @description whether to trigger form validation
|
||||
*/
|
||||
validateEvent?: boolean;
|
||||
/**
|
||||
* @description native aria-label attribute
|
||||
*/
|
||||
ariaLabel?: string;
|
||||
/**
|
||||
* @description native input mode for virtual keyboards
|
||||
*/
|
||||
inputmode?: HTMLAttributes['inputmode'];
|
||||
/**
|
||||
* @description alignment for the inner input text
|
||||
*/
|
||||
align?: 'left' | 'right' | 'center';
|
||||
/**
|
||||
* @description whether to disable scientific notation input (e.g. 'e', 'E')
|
||||
*/
|
||||
disabledScientific?: boolean;
|
||||
/**
|
||||
* @description specifies the format of the value presented in the input
|
||||
*/
|
||||
formatter?: (value: string) => string;
|
||||
/**
|
||||
* @description specifies the value extracted from the formatted input
|
||||
*/
|
||||
parser?: (value: string) => string;
|
||||
/**
|
||||
* @description same as `tabindex` in native input
|
||||
*/
|
||||
tabindex?: string | number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.
|
||||
*/
|
||||
declare const inputNumberProps: {
|
||||
readonly inputmode: EpPropFinalized<(new (...args: any[]) => "text" | "email" | "search" | "tel" | "url" | "none" | "numeric" | "decimal") | (() => "text" | "email" | "search" | "tel" | "url" | "none" | "numeric" | "decimal" | undefined) | (((new (...args: any[]) => "text" | "email" | "search" | "tel" | "url" | "none" | "numeric" | "decimal") | (() => "text" | "email" | "search" | "tel" | "url" | "none" | "numeric" | "decimal" | undefined)) | null)[], unknown, unknown, undefined, boolean>;
|
||||
readonly align: EpPropFinalized<(new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right") | (((new (...args: any[]) => "center" | "left" | "right") | (() => "center" | "left" | "right")) | null)[], unknown, unknown, "center", boolean>;
|
||||
readonly disabledScientific: BooleanConstructor;
|
||||
readonly formatter: {
|
||||
readonly type: _$vue.PropType<Function>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly parser: {
|
||||
readonly type: _$vue.PropType<Function>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly tabindex: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 0, boolean>;
|
||||
readonly ariaLabel: StringConstructor;
|
||||
readonly id: EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
||||
readonly step: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
||||
readonly stepStrictly: BooleanConstructor;
|
||||
readonly max: EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
||||
readonly min: EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
||||
readonly modelValue: {
|
||||
readonly type: _$vue.PropType<EpPropMergeType<readonly [NumberConstructor, null], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly readonly: BooleanConstructor;
|
||||
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
||||
readonly size: {
|
||||
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly controls: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
||||
readonly controlsPosition: EpPropFinalized<StringConstructor, "" | "right", unknown, "", boolean>;
|
||||
readonly valueOnClear: EpPropFinalized<(new (...args: any[]) => number | "max" | "min") | (() => number | "max" | "min" | null) | (((new (...args: any[]) => number | "max" | "min") | (() => number | "max" | "min" | null)) | null)[], unknown, unknown, null, boolean>;
|
||||
readonly name: StringConstructor;
|
||||
readonly placeholder: StringConstructor;
|
||||
readonly precision: {
|
||||
readonly type: _$vue.PropType<number>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly validateEvent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
||||
};
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.
|
||||
*/
|
||||
type InputNumberPropsPublic = ExtractPublicPropTypes<typeof inputNumberProps>;
|
||||
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;
|
||||
};
|
||||
type InputNumberEmits = typeof inputNumberEmits;
|
||||
type InputNumberInstance = InstanceType<typeof _default> & unknown;
|
||||
//#endregion
|
||||
export { InputNumberEmits, InputNumberInstance, InputNumberProps, InputNumberPropsPublic, inputNumberEmits, inputNumberProps };
|
||||
157
frontend/node_modules/element-plus/es/components/input-number/src/input-number.mjs
generated
vendored
Normal file
157
frontend/node_modules/element-plus/es/components/input-number/src/input-number.mjs
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
|
||||
import { isNumber } from "../../../utils/types.mjs";
|
||||
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
|
||||
import { useSizeProp } from "../../../hooks/use-size/index.mjs";
|
||||
import { useAriaProps } from "../../../hooks/use-aria/index.mjs";
|
||||
import { isNil } from "lodash-unified";
|
||||
//#region ../../packages/components/input-number/src/input-number.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.
|
||||
*/
|
||||
const inputNumberProps = buildProps({
|
||||
/**
|
||||
* @description same as `id` in native input
|
||||
*/
|
||||
id: {
|
||||
type: String,
|
||||
default: void 0
|
||||
},
|
||||
/**
|
||||
* @description incremental step
|
||||
*/
|
||||
step: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
/**
|
||||
* @description whether input value can only be multiple of step
|
||||
*/
|
||||
stepStrictly: Boolean,
|
||||
/**
|
||||
* @description the maximum allowed value
|
||||
*/
|
||||
max: {
|
||||
type: Number,
|
||||
default: Number.MAX_SAFE_INTEGER
|
||||
},
|
||||
/**
|
||||
* @description the minimum allowed value
|
||||
*/
|
||||
min: {
|
||||
type: Number,
|
||||
default: Number.MIN_SAFE_INTEGER
|
||||
},
|
||||
/**
|
||||
* @description binding value
|
||||
*/
|
||||
modelValue: { type: [Number, null] },
|
||||
/**
|
||||
* @description same as `readonly` in native input
|
||||
*/
|
||||
readonly: Boolean,
|
||||
/**
|
||||
* @description whether the component is disabled
|
||||
*/
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: void 0
|
||||
},
|
||||
/**
|
||||
* @description size of the component
|
||||
*/
|
||||
size: useSizeProp,
|
||||
/**
|
||||
* @description whether to enable the control buttons
|
||||
*/
|
||||
controls: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* @description position of the control buttons
|
||||
*/
|
||||
controlsPosition: {
|
||||
type: String,
|
||||
default: "",
|
||||
values: ["", "right"]
|
||||
},
|
||||
/**
|
||||
* @description value should be set when input box is cleared
|
||||
*/
|
||||
valueOnClear: {
|
||||
type: definePropType([
|
||||
String,
|
||||
Number,
|
||||
null
|
||||
]),
|
||||
validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
|
||||
default: null
|
||||
},
|
||||
/**
|
||||
* @description same as `name` in native input
|
||||
*/
|
||||
name: String,
|
||||
/**
|
||||
* @description same as `placeholder` in native input
|
||||
*/
|
||||
placeholder: String,
|
||||
/**
|
||||
* @description precision of input value
|
||||
*/
|
||||
precision: {
|
||||
type: Number,
|
||||
validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
|
||||
},
|
||||
/**
|
||||
* @description whether to trigger form validation
|
||||
*/
|
||||
validateEvent: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
...useAriaProps(["ariaLabel"]),
|
||||
/**
|
||||
* @description native input mode for virtual keyboards
|
||||
*/
|
||||
inputmode: {
|
||||
type: definePropType(String),
|
||||
default: void 0
|
||||
},
|
||||
/**
|
||||
* @description alignment for the inner input text
|
||||
*/
|
||||
align: {
|
||||
type: definePropType(String),
|
||||
default: "center"
|
||||
},
|
||||
/**
|
||||
* @description whether to disable scientific notation input (e.g. 'e', 'E')
|
||||
*/
|
||||
disabledScientific: Boolean,
|
||||
/**
|
||||
* @description specifies the format of the value presented in the input
|
||||
*/
|
||||
formatter: { type: Function },
|
||||
/**
|
||||
* @description specifies the value extracted from the formatted input
|
||||
*/
|
||||
parser: { type: Function },
|
||||
/**
|
||||
* @description same as `tabindex` in native input
|
||||
*/
|
||||
tabindex: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
}
|
||||
});
|
||||
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)
|
||||
};
|
||||
//#endregion
|
||||
export { inputNumberEmits, inputNumberProps };
|
||||
|
||||
//# sourceMappingURL=input-number.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/input-number/src/input-number.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/input-number/src/input-number.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
54
frontend/node_modules/element-plus/es/components/input-number/src/input-number.vue.d.ts
generated
vendored
Normal file
54
frontend/node_modules/element-plus/es/components/input-number/src/input-number.vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { InputNumberProps } from "./input-number.js";
|
||||
import * as _$vue from "vue";
|
||||
|
||||
//#region ../../packages/components/input-number/src/input-number.vue.d.ts
|
||||
declare var __VLS_1: {}, __VLS_19: {}, __VLS_52: {}, __VLS_55: {};
|
||||
type __VLS_Slots = {} & {
|
||||
'decrease-icon'?: (props: typeof __VLS_1) => any;
|
||||
} & {
|
||||
'increase-icon'?: (props: typeof __VLS_19) => any;
|
||||
} & {
|
||||
prefix?: (props: typeof __VLS_52) => any;
|
||||
} & {
|
||||
suffix?: (props: typeof __VLS_55) => any;
|
||||
};
|
||||
declare const __VLS_base: _$vue.DefineComponent<InputNumberProps, {
|
||||
/** @description get focus the input component */focus: () => void; /** @description remove focus the input component */
|
||||
blur: () => void;
|
||||
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
||||
change: (cur: number | undefined, prev: number | undefined) => void;
|
||||
"update:modelValue": (val: number | undefined) => void;
|
||||
input: (val: number | null | undefined) => void;
|
||||
focus: (e: FocusEvent) => void;
|
||||
blur: (e: FocusEvent) => void;
|
||||
}, string, _$vue.PublicProps, Readonly<InputNumberProps> & Readonly<{
|
||||
"onUpdate:modelValue"?: ((val: number | undefined) => any) | undefined;
|
||||
onChange?: ((cur: number | undefined, prev: number | undefined) => any) | undefined;
|
||||
onInput?: ((val: number | null | undefined) => any) | undefined;
|
||||
onFocus?: ((e: FocusEvent) => any) | undefined;
|
||||
onBlur?: ((e: FocusEvent) => any) | undefined;
|
||||
}>, {
|
||||
disabled: boolean;
|
||||
id: string;
|
||||
readonly: boolean;
|
||||
tabindex: string | number;
|
||||
validateEvent: boolean;
|
||||
inputmode: "text" | "email" | "search" | "tel" | "url" | "none" | "numeric" | "decimal";
|
||||
max: number;
|
||||
min: number;
|
||||
align: "left" | "right" | "center";
|
||||
valueOnClear: "min" | "max" | number | null;
|
||||
step: number;
|
||||
stepStrictly: boolean;
|
||||
controls: boolean;
|
||||
controlsPosition: "" | "right";
|
||||
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
|
||||
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
||||
declare const _default: typeof __VLS_export;
|
||||
type __VLS_WithSlots<T, S> = T & {
|
||||
new (): {
|
||||
$slots: S;
|
||||
};
|
||||
};
|
||||
//#endregion
|
||||
export { _default as default };
|
||||
315
frontend/node_modules/element-plus/es/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
315
frontend/node_modules/element-plus/es/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
import { EVENT_CODE } from "../../../constants/aria.mjs";
|
||||
import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
|
||||
import { getEventCode, getEventKey } from "../../../utils/dom/event.mjs";
|
||||
import { isNumber, isString, isUndefined as isUndefined$1 } from "../../../utils/types.mjs";
|
||||
import { debugWarn, throwError } from "../../../utils/error.mjs";
|
||||
import { NOOP } from "../../../utils/functions.mjs";
|
||||
import { useLocale } from "../../../hooks/use-locale/index.mjs";
|
||||
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
|
||||
import { ElIcon } from "../../icon/index.mjs";
|
||||
import { useFormDisabled, useFormSize } from "../../form/src/hooks/use-form-common-props.mjs";
|
||||
import { useFormItem } from "../../form/src/hooks/use-form-item.mjs";
|
||||
import { ElInput } from "../../input/index.mjs";
|
||||
import { vRepeatClick } from "../../../directives/repeat-click/index.mjs";
|
||||
import { inputNumberEmits, inputNumberProps } from "./input-number.mjs";
|
||||
import { isNil } from "lodash-unified";
|
||||
import { ArrowDown, ArrowUp, Minus, Plus } from "@element-plus/icons-vue";
|
||||
import { computed, createBlock, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, normalizeClass, onMounted, onUpdated, openBlock, reactive, ref, renderSlot, unref, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
||||
//#region ../../packages/components/input-number/src/input-number.vue?vue&type=script&setup=true&lang.ts
|
||||
const _hoisted_1 = ["aria-label"];
|
||||
const _hoisted_2 = ["aria-label"];
|
||||
var input_number_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
||||
name: "ElInputNumber",
|
||||
__name: "input-number",
|
||||
props: inputNumberProps,
|
||||
emits: inputNumberEmits,
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const { t } = useLocale();
|
||||
const ns = useNamespace("input-number");
|
||||
const input = ref();
|
||||
const data = reactive({
|
||||
currentValue: props.modelValue,
|
||||
userInput: null
|
||||
});
|
||||
const { formItem } = useFormItem();
|
||||
const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
|
||||
const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
|
||||
const numPrecision = computed(() => {
|
||||
const stepPrecision = getPrecision(props.step);
|
||||
if (!isUndefined$1(props.precision)) {
|
||||
if (stepPrecision > props.precision) debugWarn("InputNumber", "precision should not be less than the decimal places of step");
|
||||
return props.precision;
|
||||
} else return Math.max(getPrecision(props.modelValue), stepPrecision);
|
||||
});
|
||||
const controlsAtRight = computed(() => {
|
||||
return props.controls && props.controlsPosition === "right";
|
||||
});
|
||||
const inputNumberSize = useFormSize();
|
||||
const inputNumberDisabled = useFormDisabled();
|
||||
const displayValue = computed(() => {
|
||||
if (data.userInput !== null) return data.userInput;
|
||||
let currentValue = data.currentValue;
|
||||
if (isNil(currentValue)) return "";
|
||||
if (isNumber(currentValue)) {
|
||||
if (Number.isNaN(currentValue)) return "";
|
||||
if (!isUndefined$1(props.precision)) currentValue = currentValue.toFixed(props.precision);
|
||||
}
|
||||
return currentValue;
|
||||
});
|
||||
const toPrecision = (num, pre) => {
|
||||
if (isUndefined$1(pre)) pre = numPrecision.value;
|
||||
if (pre === 0) return Math.round(num);
|
||||
let snum = String(num);
|
||||
const pointPos = snum.indexOf(".");
|
||||
if (pointPos === -1) return num;
|
||||
if (!snum.replace(".", "").split("")[pointPos + pre]) 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 (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 (!isNumber(val)) return data.currentValue;
|
||||
if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
|
||||
debugWarn("InputNumber", "The value has reached the maximum safe integer limit.");
|
||||
return val;
|
||||
} else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
|
||||
debugWarn("InputNumber", "The value has reached the minimum safe integer limit.");
|
||||
return val;
|
||||
}
|
||||
return toPrecision(val + props.step * coefficient);
|
||||
};
|
||||
const handleKeydown = (event) => {
|
||||
const code = getEventCode(event);
|
||||
const key = getEventKey(event);
|
||||
if (props.disabledScientific && ["e", "E"].includes(key)) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
switch (code) {
|
||||
case EVENT_CODE.up:
|
||||
event.preventDefault();
|
||||
increase();
|
||||
break;
|
||||
case EVENT_CODE.down:
|
||||
event.preventDefault();
|
||||
decrease();
|
||||
break;
|
||||
}
|
||||
};
|
||||
const increase = () => {
|
||||
if (props.readonly || inputNumberDisabled.value || maxDisabled.value) return;
|
||||
setCurrentValue(ensurePrecision(Number(displayValue.value) || 0));
|
||||
emit(INPUT_EVENT, data.currentValue);
|
||||
setCurrentValueToModelValue();
|
||||
};
|
||||
const decrease = () => {
|
||||
if (props.readonly || inputNumberDisabled.value || minDisabled.value) return;
|
||||
setCurrentValue(ensurePrecision(Number(displayValue.value) || 0, -1));
|
||||
emit(INPUT_EVENT, data.currentValue);
|
||||
setCurrentValueToModelValue();
|
||||
};
|
||||
const verifyValue = (value, update) => {
|
||||
const { max, min, step, precision, stepStrictly, valueOnClear } = props;
|
||||
if (max < min) throwError("InputNumber", "min should not be greater than max.");
|
||||
let newVal = !value ? Number(value) : Number.parseFloat(String(value));
|
||||
if (isNil(value) || Number.isNaN(newVal)) return null;
|
||||
if (value === "") {
|
||||
if (valueOnClear === null) return null;
|
||||
newVal = isString(valueOnClear) ? {
|
||||
min,
|
||||
max
|
||||
}[valueOnClear] : valueOnClear;
|
||||
}
|
||||
if (stepStrictly) {
|
||||
newVal = toPrecision(Math.round(toPrecision(newVal / step)) * step, precision);
|
||||
if (newVal !== value) update && emit("update:modelValue", newVal);
|
||||
}
|
||||
if (!isUndefined$1(precision)) newVal = toPrecision(newVal, precision);
|
||||
if (newVal > max || newVal < min) {
|
||||
newVal = newVal > max ? max : min;
|
||||
update && emit("update:modelValue", newVal);
|
||||
}
|
||||
return newVal;
|
||||
};
|
||||
const setCurrentValue = (value, emitChange = true) => {
|
||||
const oldVal = data.currentValue;
|
||||
const newVal = verifyValue(value);
|
||||
if (!emitChange) {
|
||||
emit(UPDATE_MODEL_EVENT, newVal);
|
||||
return;
|
||||
}
|
||||
data.userInput = null;
|
||||
if (oldVal === newVal && value) return;
|
||||
emit(UPDATE_MODEL_EVENT, newVal);
|
||||
if (oldVal !== newVal) emit(CHANGE_EVENT, newVal, oldVal);
|
||||
if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
|
||||
data.currentValue = newVal;
|
||||
};
|
||||
const handleInput = (value) => {
|
||||
data.userInput = value;
|
||||
let newVal = value === "" ? null : Number.parseFloat(value);
|
||||
if (Number.isNaN(newVal)) newVal = null;
|
||||
emit(INPUT_EVENT, newVal);
|
||||
setCurrentValue(newVal, false);
|
||||
};
|
||||
const handleInputChange = (value) => {
|
||||
const newVal = value !== "" ? Number.parseFloat(value) : "";
|
||||
if (isNumber(newVal) && !Number.isNaN(newVal) || props.formatter && Number.isNaN(newVal) || newVal === "") setCurrentValue(newVal);
|
||||
setCurrentValueToModelValue();
|
||||
data.userInput = null;
|
||||
};
|
||||
const focus = () => {
|
||||
input.value?.focus?.();
|
||||
};
|
||||
const blur = () => {
|
||||
input.value?.blur?.();
|
||||
};
|
||||
const handleFocus = (event) => {
|
||||
emit("focus", event);
|
||||
};
|
||||
const handleBlur = (event) => {
|
||||
data.userInput = null;
|
||||
if (data.currentValue === null && input.value?.input) input.value.input.value = props.formatter?.("") ?? "";
|
||||
emit("blur", event);
|
||||
if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
|
||||
};
|
||||
const setCurrentValueToModelValue = () => {
|
||||
if (data.currentValue !== props.modelValue) data.currentValue = props.modelValue;
|
||||
};
|
||||
const handleWheel = (e) => {
|
||||
if (document.activeElement === e.target) e.preventDefault();
|
||||
};
|
||||
watch(() => props.modelValue, (value, oldValue) => {
|
||||
const newValue = verifyValue(value, true);
|
||||
if (data.userInput === null && newValue !== oldValue) data.currentValue = newValue;
|
||||
}, { immediate: true });
|
||||
watch(() => props.precision, () => {
|
||||
data.currentValue = verifyValue(props.modelValue);
|
||||
});
|
||||
onMounted(() => {
|
||||
const { min, max, modelValue } = props;
|
||||
const innerInput = input.value?.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 (!isNumber(modelValue) && modelValue != null) {
|
||||
let val = Number(modelValue);
|
||||
if (Number.isNaN(val)) val = null;
|
||||
emit(UPDATE_MODEL_EVENT, val);
|
||||
}
|
||||
innerInput.addEventListener("wheel", handleWheel, { passive: false });
|
||||
});
|
||||
onUpdated(() => {
|
||||
(input.value?.input)?.setAttribute("aria-valuenow", `${data.currentValue ?? ""}`);
|
||||
});
|
||||
__expose({
|
||||
/** @description get focus the input component */
|
||||
focus,
|
||||
/** @description remove focus the input component */
|
||||
blur
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass([
|
||||
unref(ns).b(),
|
||||
unref(ns).m(unref(inputNumberSize)),
|
||||
unref(ns).is("disabled", unref(inputNumberDisabled)),
|
||||
unref(ns).is("without-controls", !__props.controls),
|
||||
unref(ns).is("controls-right", controlsAtRight.value),
|
||||
unref(ns).is(__props.align, !!__props.align)
|
||||
]),
|
||||
onDragstart: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
|
||||
}, [
|
||||
__props.controls ? withDirectives((openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
role: "button",
|
||||
"aria-label": unref(t)("el.inputNumber.decrease"),
|
||||
class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", minDisabled.value)]),
|
||||
onKeydown: withKeys(decrease, ["enter"])
|
||||
}, [renderSlot(_ctx.$slots, "decrease-icon", {}, () => [createVNode(unref(ElIcon), null, {
|
||||
default: withCtx(() => [controlsAtRight.value ? (openBlock(), createBlock(unref(ArrowDown), { key: 0 })) : (openBlock(), createBlock(unref(Minus), { key: 1 }))]),
|
||||
_: 1
|
||||
})])], 42, _hoisted_1)), [[unref(vRepeatClick), decrease]]) : createCommentVNode("v-if", true),
|
||||
__props.controls ? withDirectives((openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
role: "button",
|
||||
"aria-label": unref(t)("el.inputNumber.increase"),
|
||||
class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", maxDisabled.value)]),
|
||||
onKeydown: withKeys(increase, ["enter"])
|
||||
}, [renderSlot(_ctx.$slots, "increase-icon", {}, () => [createVNode(unref(ElIcon), null, {
|
||||
default: withCtx(() => [controlsAtRight.value ? (openBlock(), createBlock(unref(ArrowUp), { key: 0 })) : (openBlock(), createBlock(unref(Plus), { key: 1 }))]),
|
||||
_: 1
|
||||
})])], 42, _hoisted_2)), [[unref(vRepeatClick), increase]]) : createCommentVNode("v-if", true),
|
||||
createVNode(unref(ElInput), {
|
||||
id: __props.id,
|
||||
ref_key: "input",
|
||||
ref: input,
|
||||
type: __props.formatter ? "text" : "number",
|
||||
step: __props.step,
|
||||
"model-value": displayValue.value,
|
||||
placeholder: __props.placeholder,
|
||||
readonly: __props.readonly,
|
||||
disabled: unref(inputNumberDisabled),
|
||||
size: unref(inputNumberSize),
|
||||
max: __props.max,
|
||||
min: __props.min,
|
||||
name: __props.name,
|
||||
"aria-label": __props.ariaLabel,
|
||||
"validate-event": false,
|
||||
inputmode: __props.inputmode,
|
||||
formatter: __props.formatter,
|
||||
parser: __props.parser,
|
||||
tabindex: __props.tabindex,
|
||||
onKeydown: handleKeydown,
|
||||
onBlur: handleBlur,
|
||||
onFocus: handleFocus,
|
||||
onInput: handleInput,
|
||||
onChange: handleInputChange
|
||||
}, createSlots({ _: 2 }, [_ctx.$slots.prefix ? {
|
||||
name: "prefix",
|
||||
fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
|
||||
key: "0"
|
||||
} : void 0, _ctx.$slots.suffix ? {
|
||||
name: "suffix",
|
||||
fn: withCtx(() => [renderSlot(_ctx.$slots, "suffix")]),
|
||||
key: "1"
|
||||
} : void 0]), 1032, [
|
||||
"id",
|
||||
"type",
|
||||
"step",
|
||||
"model-value",
|
||||
"placeholder",
|
||||
"readonly",
|
||||
"disabled",
|
||||
"size",
|
||||
"max",
|
||||
"min",
|
||||
"name",
|
||||
"aria-label",
|
||||
"inputmode",
|
||||
"formatter",
|
||||
"parser",
|
||||
"tabindex"
|
||||
])
|
||||
], 34);
|
||||
};
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
export { input_number_vue_vue_type_script_setup_true_lang_default as default };
|
||||
|
||||
//# sourceMappingURL=input-number.vue_vue_type_script_setup_true_lang.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
frontend/node_modules/element-plus/es/components/input-number/src/input-number2.mjs
generated
vendored
Normal file
7
frontend/node_modules/element-plus/es/components/input-number/src/input-number2.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import input_number_vue_vue_type_script_setup_true_lang_default from "./input-number.vue_vue_type_script_setup_true_lang.mjs";
|
||||
//#region ../../packages/components/input-number/src/input-number.vue
|
||||
var input_number_default = input_number_vue_vue_type_script_setup_true_lang_default;
|
||||
//#endregion
|
||||
export { input_number_default as default };
|
||||
|
||||
//# sourceMappingURL=input-number2.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/input-number/src/input-number2.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/input-number/src/input-number2.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/node_modules/element-plus/es/components/input-number/style/css.mjs
generated
vendored
Normal file
3
frontend/node_modules/element-plus/es/components/input-number/style/css.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import "../../base/style/css.mjs";
|
||||
import "../../input/style/css.mjs";
|
||||
import "element-plus/theme-chalk/el-input-number.css";
|
||||
3
frontend/node_modules/element-plus/es/components/input-number/style/index.mjs
generated
vendored
Normal file
3
frontend/node_modules/element-plus/es/components/input-number/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import "../../base/style/index.mjs";
|
||||
import "../../input/style/index.mjs";
|
||||
import "element-plus/theme-chalk/src/input-number.scss";
|
||||
Reference in New Issue
Block a user