UNPKG

vuestic-ui

Version:
31 lines (30 loc) 1.18 kB
import { w as warn } from "../../utils/console.mjs"; import { i as isDividable } from "../../utils/to-float.mjs"; const validateSlider = (value, step, min, max, range) => { if (Array.isArray(value) && !range || !Array.isArray(value) && range) { warn(`The type "${Array.isArray(value) ? "array" : typeof value}" of prop "model-value" does not match prop "range = ${range}".`); } if (max < min) { warn(`The maximum value (${max}) can not be less than the minimum value (${min}).`); } if (!isDividable(max - min, step)) { warn(`Step ${step} is illegal. Slider is non-divisible (Min:Max ${min}:${max}).`); } const inRange = (v) => { if (v < min) { warn(`The value of the slider is ${v}, the minimum value is ${min}, the value of this slider can not be less than the minimum value`); } else if (v > max) { warn(`The value of the slider is ${v}, the maximum value is ${max}, the value of this slider can not be greater than the maximum value`); } }; if (Array.isArray(value)) { value.map(inRange); } else { inRange(value); } return true; }; export { validateSlider as v }; //# sourceMappingURL=validateSlider.mjs.map