typed-reactive-form
Version:
Allows creation of a ReactiveForm based on a class with its properties properly decorated.
16 lines (14 loc) • 2.6 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("reflect-metadata"),require("@angular/forms")):"function"==typeof define&&define.amd?define("typed-reactive-form",["exports","reflect-metadata","@angular/forms"],e):e((t=t||self)["typed-reactive-form"]={},null,t.ng.forms)}(this,(function(t,e,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function n(t){var e={defaultValue:null,validators:[]};return t&&Object.assign(e,t),e}var a=function(t){function e(e,r){return t.call(this,f(new e,r))||this}return function(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(r.FormGroup);function f(t,e){var o={};(function(t){return Reflect.getMetadata("formMember",t)})(t).forEach((function(n){var a=n.options;a.context&&0!==a.context.length&&!a.context.includes(e)||(o[n.property]=new r.FormControl(t[n.property],a.validators))}));var n=function(t){return Reflect.getMetadata("formGroup",t)}(t);return n&&n.forEach((function(t){o[t.property]=new a(t.constructor)})),o}t.FormGroup=function(t){return function(e,r){var o=Reflect.getMetadata("formGroup",e);o?o.push({property:r,constructor:t}):(o=[{property:r,constructor:t}],Reflect.defineMetadata("formGroup",o,e))}},t.FormMember=function(t){return function(e,r){var o=Reflect.getMetadata("formMember",e);o?o.push({property:r,options:n(t)}):(o=[{property:r,options:n(t)}],Reflect.defineMetadata("formMember",o,e))}},t.TypedReactiveForm=a,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=typed-reactive-form.umd.min.js.map