UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

84 lines (63 loc) 2.22 kB
import _extends from "@babel/runtime/helpers/extends"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import { __decorate } from "tslib"; import { action, computed, observable } from 'mobx'; var Validity = /*#__PURE__*/ function () { function Validity(props) { _classCallCheck(this, Validity); this.init(props); } _createClass(Validity, [{ key: "reset", value: function reset() { this.init(); } }, { key: "init", value: function init(props) { this.badInput = false; this.customError = false; this.patternMismatch = false; this.rangeOverflow = false; this.rangeUnderflow = false; this.stepMismatch = false; this.tooLong = false; this.tooShort = false; this.typeMismatch = false; this.valueMissing = false; this.uniqueError = false; if (props) { _extends(this, props); } } }, { key: "valid", get: function get() { var _this = this; return Object.keys(this).filter(function (key) { return key !== 'valid'; }).every(function (key) { return !_this[key]; }); } }]); return Validity; }(); export { Validity as default }; __decorate([observable], Validity.prototype, "badInput", void 0); __decorate([observable], Validity.prototype, "customError", void 0); __decorate([observable], Validity.prototype, "patternMismatch", void 0); __decorate([observable], Validity.prototype, "rangeOverflow", void 0); __decorate([observable], Validity.prototype, "rangeUnderflow", void 0); __decorate([observable], Validity.prototype, "stepMismatch", void 0); __decorate([observable], Validity.prototype, "tooLong", void 0); __decorate([observable], Validity.prototype, "tooShort", void 0); __decorate([observable], Validity.prototype, "typeMismatch", void 0); __decorate([observable], Validity.prototype, "valueMissing", void 0); __decorate([observable], Validity.prototype, "uniqueError", void 0); __decorate([computed], Validity.prototype, "valid", null); __decorate([action], Validity.prototype, "init", null); //# sourceMappingURL=Validity.js.map