@tplc/wot 0.1.55 → 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -73,7 +73,7 @@ watch(
|
|
|
73
73
|
watch(
|
|
74
74
|
[() => props.max, () => props.min],
|
|
75
75
|
() => {
|
|
76
|
-
updateBoundary()
|
|
76
|
+
updateBoundary(true)
|
|
77
77
|
},
|
|
78
78
|
{ immediate: true, deep: true },
|
|
79
79
|
)
|
|
@@ -87,11 +87,11 @@ watch(
|
|
|
87
87
|
{ immediate: true, deep: true },
|
|
88
88
|
)
|
|
89
89
|
|
|
90
|
-
function updateBoundary() {
|
|
90
|
+
function updateBoundary(formMaxMinDiff = false) {
|
|
91
91
|
debounce(() => {
|
|
92
92
|
const value = formatValue(inputValue.value)
|
|
93
93
|
if (!isEqual(inputValue.value, value)) {
|
|
94
|
-
setValue(value)
|
|
94
|
+
setValue(value, true, formMaxMinDiff)
|
|
95
95
|
}
|
|
96
96
|
splitDisabled(value)
|
|
97
97
|
}, 30)()
|
|
@@ -128,9 +128,9 @@ function toStrictlyStep(value: number | string) {
|
|
|
128
128
|
return (Math.round(Number(value) / props.step) * precisionFactory * props.step) / precisionFactory
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
function setValue(value: string | number, change: boolean = true) {
|
|
131
|
+
function setValue(value: string | number, change: boolean = true, formMaxMinDiff = false) {
|
|
132
132
|
if (props.allowNull && (!isDef(value) || value === '')) {
|
|
133
|
-
dispatchChangeEvent(value, change)
|
|
133
|
+
dispatchChangeEvent(value, change, formMaxMinDiff)
|
|
134
134
|
return
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -142,8 +142,7 @@ function setValue(value: string | number, change: boolean = true) {
|
|
|
142
142
|
}
|
|
143
143
|
if (Number(value) > props.max) value = toPrecision(props.max)
|
|
144
144
|
if (Number(value) < props.min) value = toPrecision(props.min)
|
|
145
|
-
|
|
146
|
-
dispatchChangeEvent(value, change)
|
|
145
|
+
dispatchChangeEvent(value, change, formMaxMinDiff)
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
function changeStep(val: string | number, step: number) {
|
|
@@ -190,14 +189,18 @@ function handleBlur() {
|
|
|
190
189
|
})
|
|
191
190
|
}
|
|
192
191
|
|
|
193
|
-
function dispatchChangeEvent(
|
|
192
|
+
function dispatchChangeEvent(
|
|
193
|
+
value: string | number,
|
|
194
|
+
change: boolean = true,
|
|
195
|
+
formMaxMinDiff = false,
|
|
196
|
+
) {
|
|
194
197
|
if (isEqual(inputValue.value, value)) {
|
|
195
198
|
return
|
|
196
199
|
}
|
|
197
200
|
const mode = inputValue.value > value ? 'sub' : 'add'
|
|
198
201
|
inputValue.value = value
|
|
199
202
|
change && emit('update:modelValue', inputValue.value)
|
|
200
|
-
change && emit('change', { value, mode })
|
|
203
|
+
change && !formMaxMinDiff && emit('change', { value, mode })
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
function formatValue(value: string | number) {
|