UNPKG

@progress/kendo-vue-inputs

Version:
92 lines (91 loc) 2.25 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ let n = /* @__PURE__ */ function(e) { return e.start = "start", e.end = "end", e.min = "min", e.max = "max", e.increase = "increase", e.decrease = "decrease", e; }({}); const f = (e, r) => { let d, m; switch (r.type) { case n.start: if (r.payload === void 0) return e; d = { start: r.payload > e.end ? e.end : Math.max(r.payload, r.min), end: e.end }; break; case n.end: if (r.payload === void 0) return e; d = { start: e.start, end: r.payload < e.start ? e.start : Math.min(r.payload, r.max) }; break; case n.min: r.key === "start" ? d = { ...e, start: r.min } : d = { ...e, end: Math.max(r.min, e.start) }; break; case n.max: r.key === "start" ? d = { ...e, start: Math.min(r.max, e.end) } : d = { ...e, end: r.max }; break; case n.increase: if (r.step === void 0 || r.key === void 0) return e; m = e[r.key] + r.step, r.key === "start" ? m < r.min ? d = { ...e, start: r.min } : d = { ...e, start: Math.min(m, e.end) } : m > r.max ? d = { ...e, end: r.max } : d = { ...e, end: Math.max(m, e.start) }; break; case n.decrease: if (r.step === void 0 || r.key === void 0) return e; m = e[r.key] - r.step, r.key === "start" ? m < r.min ? d = { ...e, start: r.min } : d = { ...e, start: Math.min(m, e.end) } : m > r.max ? d = { ...e, end: r.max } : d = { ...e, end: Math.max(m, e.start) }; break; default: d = e; break; } return d; }; export { n as RANGE_ACTION, f as rangeReducer };