yc-design-vue 1.2.0 → 1.2.1
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.
- package/es/Badge/index.vue.js +1 -1
- package/es/Slider/hooks/useContext.js +10 -9
- package/es/style.css +1 -1
- package/lib/Badge/index.vue.js +1 -1
- package/lib/Slider/hooks/useContext.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
package/es/Badge/index.vue.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import _sfc_main from "./index.vue2.js";
|
2
2
|
/* empty css */
|
3
3
|
import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
|
4
|
-
const _Badge = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
4
|
+
const _Badge = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-03650e28"]]);
|
5
5
|
export {
|
6
6
|
_Badge as default
|
7
7
|
};
|
@@ -84,17 +84,18 @@ const useContext = () => {
|
|
84
84
|
return decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
|
85
85
|
}
|
86
86
|
function normalizeValue(value) {
|
87
|
-
|
88
|
-
const
|
89
|
-
|
90
|
-
return Math.round(normalized);
|
87
|
+
if (max.value - min.value === 0) return 0;
|
88
|
+
const normalized = (value - min.value) / (max.value - min.value) * 100;
|
89
|
+
return normalized;
|
91
90
|
}
|
92
|
-
function denormalizeValue(
|
93
|
-
const
|
94
|
-
const
|
95
|
-
const
|
91
|
+
function denormalizeValue(percent) {
|
92
|
+
const estimatedValue = min.value + percent / 100 * (max.value - min.value);
|
93
|
+
const steps = (estimatedValue - min.value) / step.value;
|
94
|
+
const closestStep = Math.round(steps);
|
95
|
+
const finalValue = min.value + closestStep * step.value;
|
96
96
|
const digit = getDecimalPlaces(step.value);
|
97
|
-
|
97
|
+
const clampedValue = Math.max(min.value, Math.min(finalValue, max.value));
|
98
|
+
return +clampedValue.toFixed(digit);
|
98
99
|
}
|
99
100
|
provide(SLIDER_CONTEXT_KEY, {
|
100
101
|
startValue,
|