devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
32 lines (31 loc) • 2.23 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/options_validator/common/validator_rules.js)
* Version: 23.2.6
* Build date: Wed May 01 2024
*
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mustBeLessThan = exports.mustBeInteger = exports.mustBeInRange = exports.mustBeGreaterThan = exports.mustBeDivisibleBy = void 0;
var _index = require("../core/index");
var _validation_functions = require("./validation_functions");
const mustBeInteger = (0, _index.createValidatorRule)("mustBeInteger", value => (0, _validation_functions.isInteger)(value) || "".concat(value, " must be an integer."));
exports.mustBeInteger = mustBeInteger;
const mustBeGreaterThan = function(minimalValue) {
let strict = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : true;
return (0, _index.createValidatorRule)("mustBeGreaterThan", value => (0, _validation_functions.greaterThan)(value, minimalValue, strict) || "".concat(value, " must be ").concat(strict ? ">" : ">=", " than ").concat(minimalValue, "."))
};
exports.mustBeGreaterThan = mustBeGreaterThan;
const mustBeLessThan = function(maximalValue) {
let strict = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : true;
return (0, _index.createValidatorRule)("mustBeLessThan", value => (0, _validation_functions.lessThan)(value, maximalValue, strict) || "".concat(value, " must be ").concat(strict ? "<" : "<=", " than ").concat(maximalValue, "."))
};
exports.mustBeLessThan = mustBeLessThan;
const mustBeInRange = range => (0, _index.createValidatorRule)("mustBeInRange", value => (0, _validation_functions.inRange)(value, range) || "".concat(value, " must be in range [").concat(range[0], ", ").concat(range[1], "]."));
exports.mustBeInRange = mustBeInRange;
const mustBeDivisibleBy = divider => (0, _index.createValidatorRule)("mustBeDivisibleBy", value => (0, _validation_functions.divisibleBy)(value, divider) || "".concat(value, " must be divisible by ").concat(divider, "."));
exports.mustBeDivisibleBy = mustBeDivisibleBy;