choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
80 lines (67 loc) • 2.76 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _tslib = require("tslib");
var _mobx = require("mobx");
var Validity = /*#__PURE__*/function () {
function Validity(props) {
(0, _classCallCheck2["default"])(this, Validity);
this.init(props);
}
(0, _createClass2["default"])(Validity, [{
key: "valid",
get: function get() {
var _this = this;
return Object.keys(this).filter(function (key) {
return key !== 'valid';
}).every(function (key) {
return !_this[key];
});
}
}, {
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) {
(0, _extends2["default"])(this, props);
}
}
}]);
return Validity;
}();
exports["default"] = Validity;
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "badInput", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "customError", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "patternMismatch", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "rangeOverflow", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "rangeUnderflow", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "stepMismatch", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "tooLong", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "tooShort", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "typeMismatch", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "valueMissing", void 0);
(0, _tslib.__decorate)([_mobx.observable], Validity.prototype, "uniqueError", void 0);
(0, _tslib.__decorate)([_mobx.computed], Validity.prototype, "valid", null);
(0, _tslib.__decorate)([_mobx.action], Validity.prototype, "init", null);
//# sourceMappingURL=Validity.js.map
;