xdesign-vue-next
Version:
XDesign Component for vue-next
34 lines (26 loc) • 965 B
JavaScript
/**
* xdesign v1.0.6
* (c) 2023 xdesign
* @license MIT
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var dayjs = require('dayjs');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
function validateInputValue(value, format) {
return dayjs__default["default"](value, format).format(format) === value;
}
function formatInputValue(value, format) {
return dayjs__default["default"](value, format).format(format);
}
function closestLookup(availableArr, calcVal, step) {
if (step <= 1) return calcVal;
return availableArr.sort(function (a, b) {
return Math.abs(calcVal + 1 - a) - Math.abs(calcVal + 1 - b);
})[0];
}
exports.closestLookup = closestLookup;
exports.formatInputValue = formatInputValue;
exports.validateInputValue = validateInputValue;
//# sourceMappingURL=utils.js.map