UNPKG

69 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../../../node_modules/tslib/tslib.es6.js","ng://@eclat/form/lib/contracts/form-config.ts","ng://@eclat/form/lib/form-utility.ts","ng://@eclat/form/lib/abstract-control.ts","ng://@eclat/form/lib/form-models.ts","ng://@eclat/form/lib/directives/eclat-form.directive.ts","ng://@eclat/form/lib/directives/eclat-form-container.directive.ts","ng://@eclat/form/lib/directives/eclat-form-error.directive.ts","ng://@eclat/form/lib/directives/group/eclat-form-group.directive.ts","ng://@eclat/form/lib/directives/group/eclat-form-group-name.directive.ts","ng://@eclat/form/lib/directives/array/eclat-form-array-name.directive.ts","ng://@eclat/form/lib/directives/array/eclat-form-array.directive.ts","ng://@eclat/form/lib/directives/array/eclat-form-array-children.directive.ts","ng://@eclat/form/lib/directives/eclat-form-submit.directive.ts","ng://@eclat/form/lib/directives/array/eclat-form-array-add.directive.ts","ng://@eclat/form/lib/directives/eclat-form-value.directive.ts","ng://@eclat/form/lib/directives/binder/eclat-form-group-binder.directive.ts","ng://@eclat/form/lib/directives/binder/eclat-form-group-name-binder.directive.ts","ng://@eclat/form/lib/directives/binder/eclat-form-array-name-binder.directive.ts","ng://@eclat/form/lib/directives/array/eclat-form-array-remove.directive.ts","ng://@eclat/form/lib/form-module.ts"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","__read","o","n","m","Symbol","iterator","r","e","i","call","ar","next","done","push","value","error","EclatFormUtility","isEclatFormControlConfig","eclatForm","isArray","isEclatFormGroupConfig","controlsRules","isEclatFormArrayConfig","controlConfig","eclatRecursiveTransformer","data","path","recursivePathFinder","EclatRecursiveConfig","found_1","some","key","temp","toString","found_2","entries","_a","_b","Error","paths","split","latestPath","pop","reduce","acc","cur","AbstractEclatFormControl","rules","validators","asyncValidators","errorMapping","forEach","validator","asyncValidator","message","defineProperty","_this","control","errors","apply","arguments","length","concat","__spread","valid","valueChanges","disable","isDisabled","opts","enable","getEclatControl","config","EclatFormControl","EclatFormGroup","EclatFormArray","initialData","_super","FormControl","resetState","tslib_1.__extends","patchState","emitEvent","patchValue","reset","dfg","children","controls","keys","eclatControl","FormGroup","console","warn","undefined","getChild","addChild","addControl","removeChild","removeControl","dfa","FormArray","childConfig","index","splice","removeAt","$implicit","EclatFormOfDirective","templateRef","viewContainer","state","context","latestState","setContext","EclatFormContext","createEmbeddedView","Directive","args","selector","TemplateRef","ViewContainerRef","Input","EclatFormContainerDirective","_formControl","BehaviorSubject","onSubmit","EventEmitter","getValue","asObservable","submit","formControl","emit","Output","EclatFormErrorContext","errorMessages","EclatFormErrorDirective","parent","onDestroy$","Subject","errorMatcher","controlName","instance","latestControlName","eclatControlName","ngOnInit","formControl$","pipe","takeUntil","subscribe","eclatFormError","ngOnDestroy","valueChangesSub","unsubscribe","checkValidity","isAttached","remove","EclatFormGroupDirective","formGroup","providers","provide","useExisting","forwardRef","EclatFormGroupNameDirective","name","latestName","eclatFormGroupName","decorators","type","SkipSelf","EclatFormArrayNameDirective","eclatFormArrayName","EclatFormArrayDirective","formArray","EclatFormArrayChildrenDirective","latestChildren","valueChangeSubs","onChange","controlChildrenLength","c","lastIndex","findIndex","first","last","embeddedView","get","move","EclatFormSubmitDirective","onClick","HostListener","EclatFormArrayAddDirective","EclatFormValueContext","EclatFormValueDirective","eclatFormValue","EclatFormGroupBinderDirective","form","ngOnChanges","changes","eclatFormGroupChanges","eclatFormGroup","prevValue","previousValue","currentValue","firstChange","SimpleChange","ControlContainer","FormGroupDirective","EclatFormGroupNameBinderDirective","FormGroupName","EclatFormArrayNameBinderDirective","FormArrayName","EclatFormArrayRemoveDirective","EclatFormModule","NgModule","imports","CommonModule","ReactiveFormsModule","declarations","exports"],"mappings":"ifAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAU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AGjaC,EAxBA","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { EclatFormRule } from '../abstract-control';\r\n\r\nexport type ControlRuleConfig<T> =\r\n EclatFormControlConfig<T>\r\n | (T extends any[] ? EclatFormArrayConfig<T> : EclatFormGroupConfig<T>)\r\n\r\nexport type EclatFormControlConfig<T> = EclatFormRule<T>[];\r\n\r\nexport interface EclatFormGroupConfig<T> {\r\n controlsRules: { [P in keyof T]: ControlRuleConfig<T[P]> };\r\n rules?: EclatFormControlConfig<T>;\r\n}\r\n\r\nexport interface EclatFormArrayConfig<T extends any[]> {\r\n controlConfig: ControlRuleConfig<T[0]>;\r\n rules?: EclatFormControlConfig<T>;\r\n}\r\n\r\nexport class EclatRecursiveConfig {\r\n}\r\n\r\nexport type RecursiveControlRuleConfig<T> =\r\n EclatFormControlConfig<T>\r\n | (T extends any[] ? EclatRecursiveFormArrayConfig<T> : EclatRecursiveFormGroupConfig<T>)\r\n\r\nexport interface EclatRecursiveFormGroupConfig<T> {\r\n controlsRules: { [P in keyof T]: RecursiveControlRuleConfig<T[P]> };\r\n rules?: EclatFormControlConfig<T>;\r\n}\r\n\r\nexport interface EclatRecursiveFormArrayConfig<T extends any[]> {\r\n controlConfig: RecursiveControlRuleConfig<T[0]> | EclatRecursiveConfig;\r\n rules?: EclatFormControlConfig<T>;\r\n}\r\n","import {\r\n EclatFormArrayConfig,\r\n EclatFormControlConfig,\r\n EclatFormGroupConfig,\r\n EclatRecursiveConfig,\r\n EclatRecursiveFormGroupConfig,\r\n} from './contracts/form-config';\r\n\r\nexport namespace EclatFormUtility {\r\n export function isEclatFormControlConfig<T>(\r\n eclatForm: EclatFormControlConfig<T> | EclatFormGroupConfig<any> | EclatFormArrayConfig<any>,\r\n ): eclatForm is EclatFormControlConfig<T> {\r\n if (Array.isArray(eclatForm)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n export function isEclatFormGroupConfig<T>(\r\n eclatForm: EclatFormGroupConfig<T> | EclatFormControlConfig<any> | EclatFormArrayConfig<any>,\r\n ): eclatForm is EclatFormGroupConfig<T> {\r\n if ((<EclatFormGroupConfig<T>>eclatForm).controlsRules) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n export function isEclatFormArrayConfig<T extends any[]>(\r\n eclatForm: EclatFormGroupConfig<any> | EclatFormControlConfig<any> | EclatFormArrayConfig<T>,\r\n ): eclatForm is EclatFormArrayConfig<T> {\r\n if ((<EclatFormArrayConfig<T>>eclatForm).controlConfig) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n export function eclatRecursiveTransformer<T>(data: EclatRecursiveFormGroupConfig<T>): EclatFormGroupConfig<T> {\r\n const path = recursivePathFinder(data);\r\n if (!path) {\r\n throw Error();\r\n }\r\n const paths: string[] = path.split('.');\r\n const latestPath = <any>paths.pop();\r\n\r\n paths.reduce(\r\n (acc, cur) => {\r\n return acc[cur];\r\n },\r\n data as any,\r\n )[latestPath] = data;\r\n\r\n return <any>data;\r\n }\r\n}\r\n\r\nfunction recursivePathFinder(data: any, path: string | null = null): string | null {\r\n if (data instanceof EclatRecursiveConfig) {\r\n return '';\r\n }\r\n if (Array.isArray(data)) {\r\n let found: string | null = null;\r\n\r\n data.some(\r\n (value, key) => {\r\n const temp = recursivePathFinder(value, path);\r\n if (temp !== null) {\r\n if (temp) {\r\n found = key + '.' + temp;\r\n } else {\r\n found = key.toString();\r\n }\r\n }\r\n return !!found;\r\n },\r\n );\r\n\r\n return found;\r\n }\r\n if (data === Object(data)) {\r\n let found: string | null = null;\r\n\r\n Object.entries(data).some(\r\n ([key, value]) => {\r\n const temp = recursivePathFinder(value, path);\r\n if (temp !== null) {\r\n if (temp) {\r\n found = key + '.' + temp;\r\n } else {\r\n found = key;\r\n }\r\n }\r\n return !!found;\r\n },\r\n );\r\n return found;\r\n }\r\n\r\n return null;\r\n}\r\n","import { AbstractControl, AsyncValidatorFn, ValidatorFn } from '@angular/forms';\r\nimport { Observable } from 'rxjs';\r\n\r\nexport interface EclatErrorMapping<T> {\r\n [key: string]: string | string[] | ((control: AbstractEclatFormControl<T>) => string | string[]);\r\n}\r\n\r\nexport interface EclatFormRule<T> {\r\n key: string;\r\n message: string | string[] | ((control: AbstractEclatFormControl<T>) => string | string[]);\r\n validator?: ValidatorFn;\r\n asyncValidator?: AsyncValidatorFn;\r\n}\r\n\r\nexport abstract class AbstractEclatFormControl<T, C extends AbstractControl = AbstractControl> {\r\n public control: C;\r\n protected asyncValidators: AsyncValidatorFn[];\r\n protected validators: ValidatorFn[];\r\n private readonly rules: EclatErrorMapping<T>;\r\n\r\n constructor(rules?: EclatFormRule<T>[]) {\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n const errorMapping: EclatErrorMapping<T> = {};\r\n\r\n if (rules) {\r\n rules.forEach(({ validator, asyncValidator, key, message }) => {\r\n errorMapping[key] = message;\r\n if (validator) {\r\n validators.push(validator);\r\n }\r\n if (asyncValidator) {\r\n asyncValidators.push(asyncValidator);\r\n }\r\n });\r\n }\r\n\r\n this.rules = errorMapping;\r\n this.validators = validators;\r\n this.asyncValidators = asyncValidators;\r\n }\r\n\r\n get errorMessages(): string[] {\r\n if (!this.control.errors) {\r\n return [];\r\n }\r\n\r\n return Object.entries(this.control.errors).reduce(\r\n (acc, [key, value]) => {\r\n if (value) {\r\n const temp = this.rules[key];\r\n const errors = typeof temp === 'function' ? temp(this) : temp;\r\n\r\n if (Array.isArray(errors)) {\r\n acc.push(...errors);\r\n }\r\n else {\r\n acc.push(errors);\r\n }\r\n }\r\n\r\n return acc;\r\n },\r\n <string[]>[],\r\n );\r\n }\r\n\r\n get value(): T {\r\n return this.control.value;\r\n }\r\n\r\n get valid(): boolean {\r\n return this.control.valid;\r\n }\r\n\r\n get valueChanges(): Observable<T> {\r\n return this.control.valueChanges;\r\n }\r\n\r\n public disable(isDisabled: boolean = true, opts?: {\r\n onlySelf?: boolean;\r\n emitEvent?: boolean;\r\n }): void {\r\n if (isDisabled) {\r\n this.control.disable(opts);\r\n } else {\r\n this.control.enable(opts);\r\n }\r\n }\r\n\r\n public abstract patchState(data: T, emitEvent?: boolean): void;\r\n\r\n public abstract resetState(data: T, emitEvent?: boolean): void;\r\n}\r\n","import { FormArray, FormControl, FormGroup } from '@angular/forms';\r\nimport {\r\n ControlRuleConfig,\r\n EclatFormArrayConfig,\r\n EclatFormControlConfig,\r\n EclatFormGroupConfig,\r\n} from './contracts/form-config';\r\nimport { EclatFormUtility } from './form-utility';\r\nimport { AbstractEclatFormControl } from './abstract-control';\r\n\r\nexport type EclatFormChild<T> = T extends any[]\r\n ? EclatFormArray<T>\r\n : T extends Date | String | RegExp ? EclatFormControl<T>\r\n : T extends object ? EclatFormGroup<T> : EclatFormControl<T>;\r\n\r\nexport function getEclatControl(config: any, data?: any): AbstractEclatFormControl<any> | null {\r\n if (EclatFormUtility.isEclatFormControlConfig(config)) {\r\n return new EclatFormControl(config, data);\r\n }\r\n if (EclatFormUtility.isEclatFormGroupConfig(config)) {\r\n return new EclatFormGroup(config, data);\r\n }\r\n if (EclatFormUtility.isEclatFormArrayConfig(config)) {\r\n return new EclatFormArray(config, data);\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport class EclatFormControl<T> extends AbstractEclatFormControl<T,\r\n FormControl> {\r\n constructor(config: EclatFormControlConfig<T>, initialData?: T) {\r\n super(config);\r\n this.control = new FormControl(null, this.validators, this.asyncValidators);\r\n\r\n if (initialData) {\r\n this.resetState(initialData);\r\n }\r\n }\r\n\r\n public patchState(data: T, emitEvent: boolean = true): void {\r\n this.control.patchValue(data, { emitEvent });\r\n }\r\n\r\n public resetState(data: T, emitEvent: boolean = true): void {\r\n this.control.reset(data, { emitEvent });\r\n }\r\n}\r\n\r\nexport class EclatFormGroup<T> extends AbstractEclatFormControl<T, FormGroup> {\r\n public children: { [P in keyof T]: EclatFormChild<T[P]> };\r\n\r\n constructor(dfg: EclatFormGroupConfig<T>, initialData?: T) {\r\n super(dfg.rules);\r\n const children: any = {};\r\n const controls: any = {};\r\n\r\n Object.keys(dfg.controlsRules).forEach((key: string) => {\r\n const value: ControlRuleConfig<any> = dfg.controlsRules[<keyof T>key];\r\n const eclatControl = getEclatControl(value);\r\n\r\n if (eclatControl) {\r\n children[key] = eclatControl;\r\n controls[key] = eclatControl.control;\r\n }\r\n });\r\n\r\n this.control = new FormGroup(controls, this.validators, this.asyncValidators);\r\n this.children = children;\r\n\r\n if (initialData) {\r\n this.resetState(initialData);\r\n }\r\n }\r\n\r\n public patchState(data: T, emitEvent: boolean = true): void {\r\n if (!data) {\r\n console.warn(`Expect an object, but ${data} is given`);\r\n return;\r\n }\r\n\r\n Object.entries(data).forEach(([key, value]) => {\r\n if (this.children[key as keyof T]) {\r\n this.children[key as keyof T].patchState(value, false);\r\n }\r\n });\r\n this.control.patchValue({}, {emitEvent});\r\n }\r\n\r\n public resetState(data: T, emitEvent: boolean = true): void {\r\n if (!data) {\r\n console.warn(`Expect an object, but ${data} is given`);\r\n return;\r\n }\r\n\r\n Object.entries(data).forEach(([key, value]) => {\r\n if (this.children[key as keyof T]) {\r\n this.children[key as keyof T].resetState(value, false);\r\n }\r\n });\r\n this.control.reset(undefined, {emitEvent});\r\n }\r\n\r\n public getChild<P extends keyof T>(key: P): EclatFormChild<T[P]> {\r\n return this.children[key];\r\n }\r\n\r\n private addChild(\r\n key: keyof T & string,\r\n config: ControlRuleConfig<T>,\r\n data: T,\r\n ): void {\r\n const eclatControl = getEclatControl(config);\r\n\r\n if (eclatControl) {\r\n eclatControl.resetState(data);\r\n\r\n this.children[key] = eclatControl as EclatFormChild<T[typeof key]>;\r\n this.control.addControl(key, this.children[key].control);\r\n }\r\n }\r\n\r\n private removeChild(key: keyof T & string): void {\r\n delete this.children[key];\r\n this.control.removeControl(key);\r\n }\r\n}\r\n\r\nexport class EclatFormArray<T extends any[]> extends AbstractEclatFormControl<T,\r\n FormArray> {\r\n public children: EclatFormChild<T[0]>[];\r\n private childConfig: ControlRuleConfig<T[0]>;\r\n\r\n constructor(dfa: EclatFormArrayConfig<T>, initialData?: T) {\r\n super(dfa.rules);\r\n\r\n this.control = new FormArray([], this.validators, this.asyncValidators);\r\n this.childConfig = dfa.controlConfig;\r\n this.children = [];\r\n\r\n if (initialData) {\r\n this.resetState(initialData);\r\n }\r\n }\r\n\r\n public addChild(data?: Partial<T[0]>): void {\r\n const eclatControl = getEclatControl(this.childConfig);\r\n if (eclatControl) {\r\n eclatControl.resetState(data);\r\n\r\n this.children.push(eclatControl as EclatFormChild<T[0]>);\r\n this.control.push(eclatControl.control);\r\n }\r\n }\r\n\r\n public removeChild(index: number): void {\r\n this.children.splice(index, 1);\r\n this.control.removeAt(index);\r\n }\r\n\r\n public patchState(data: T, emitEvent: boolean = true): void {\r\n if (!data) {\r\n console.warn(`Expect an array, but ${data} is given`);\r\n return;\r\n }\r\n\r\n this.control.controls = [];\r\n this.children = [];\r\n\r\n data.forEach(d => {\r\n const eclatControl = getEclatControl(this.childConfig);\r\n if (eclatControl) {\r\n eclatControl.patchState(d, false);\r\n\r\n this.children.push(eclatControl as EclatFormChild<T[0]>);\r\n this.control.push(eclatControl.control);\r\n }\r\n });\r\n this.control.patchValue([], { emitEvent });\r\n }\r\n\r\n public resetState(data: T, emitEvent: boolean = true): void {\r\n if (!data) {\r\n console.warn(`Expect an array, but ${data} is given`);\r\n return;\r\n }\r\n\r\n this.control.controls = [];\r\n this.children = [];\r\n\r\n data.forEach(d => {\r\n const eclatControl = getEclatControl(this.childConfig);\r\n if (eclatControl) {\r\n eclatControl.resetState(d, false);\r\n\r\n this.children.push(eclatControl as EclatFormChild<T[0]>);\r\n this.control.push(eclatControl.control);\r\n }\r\n });\r\n this.control.reset(undefined, { emitEvent });\r\n }\r\n\r\n public getChild(index: number): EclatFormChild<T[0]> {\r\n return this.children[index];\r\n }\r\n}\r\n","import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';\r\nimport { EclatFormState } from '../contracts/form-state';\r\nimport { AbstractEclatFormControl } from '../abstract-control';\r\nimport { getEclatControl } from '../form-models';\r\n\r\nexport class EclatFormContext<T> {\r\n constructor(public $implicit: AbstractEclatFormControl<T>) {\r\n }\r\n}\r\n\r\n@Directive({ selector: '[eclatForm][eclatFormOf]' })\r\nexport class EclatFormOfDirective<T> {\r\n private context?: EclatFormContext<T>;\r\n private latestState?: EclatFormState<T>;\r\n\r\n constructor(\r\n private templateRef: TemplateRef<EclatFormContext<T>>,\r\n private viewContainer: ViewContainerRef) {\r\n }\r\n\r\n @Input() set eclatFormOf(state: EclatFormState<T>) {\r\n if (!this.context || !this.latestState || this.latestState.config !== state.config) {\r\n this.setContext(getEclatControl(state.config, state.data));\r\n }\r\n else if (this.latestState.data !== state.data) {\r\n this.context.$implicit.resetState(state.data);\r\n }\r\n\r\n this.latestState = state;\r\n }\r\n\r\n private setContext(control?: AbstractEclatFormControl<T> | null) {\r\n if (!control) {\r\n throw new Error('control not found');\r\n }\r\n\r\n if (!this.context) {\r\n this.context = new EclatFormContext<T>(control);\r\n this.viewContainer.createEmbeddedView(this.templateRef, this.context);\r\n }\r\n else {\r\n this.context.$implicit = control;\r\n }\r\n }\r\n}\r\n","import { BehaviorSubject, Observable } from 'rxjs';\r\nimport { AbstractEclatFormControl } from '../abstract-control';\r\nimport { EventEmitter, Output } from '@angular/core';\r\n\r\nexport abstract class EclatFormContainerDirective<T extends AbstractEclatFormControl<any>> {\r\n @Output()\r\n private onSubmit: EventEmitter<any>;\r\n\r\n protected constructor() {\r\n this._formControl = new BehaviorSubject<T | undefined>(undefined);\r\n this.onSubmit = new EventEmitter();\r\n }\r\n\r\n protected _formControl: BehaviorSubject<T | undefined>;\r\n\r\n get formControl(): T | undefined {\r\n return this._formControl.getValue();\r\n }\r\n\r\n get formControl$(): Observable<T | undefined> {\r\n return this._formControl.asObservable();\r\n }\r\n\r\n submit(): void {\r\n if (this.formControl) {\r\n this.onSubmit.emit(this.formControl.value);\r\n }\r\n }\r\n\r\n abstract getChild(key: any): AbstractEclatFormControl<any> | undefined;\r\n}\r\n","import { Directive, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\r\nimport { AbstractEclatFormControl } from '../abstract-control';\r\nimport { Subject, Subscription } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { EclatFormContainerDirective } from './eclat-form-container.directive';\r\n\r\nclass EclatFormErrorContext<T> {\r\n constructor(public control: AbstractEclatFormControl<T>) {\r\n }\r\n\r\n get $implicit(): string[] {\r\n return this.control.errorMessages;\r\n }\r\n}\r\n\r\n\r\n@Directive({ selector: '[eclatFormError]' })\r\nexport class EclatFormErrorDirective<T> implements OnInit, OnDestroy {\r\n @Input()\r\n errorMatcher: (control: AbstractEclatFormControl<T>) => boolean;\r\n private context?: EclatFormErrorContext<T>;\r\n private latestControlName: string;\r\n private onDestroy$: Subject<void>;\r\n private valueChangesSub?: Subscription;\r\n\r\n constructor(\r\n private templateRef: TemplateRef<EclatFormErrorContext<T>>,\r\n private viewContainer: ViewContainerRef,\r\n private parent: EclatFormContainerDirective<any>,\r\n ) {\r\n this.onDestroy$ = new Subject();\r\n this.errorMatcher = () => true;\r\n }\r\n\r\n @Input()\r\n set eclatControl(control: AbstractEclatFormControl<T>) {\r\n this.setContext(control);\r\n }\r\n\r\n @Input()\r\n set eclatControlName(controlName: keyof Record<any, T> | undefined) {\r\n if (!this.parent.formControl) {\r\n throw new Error('parent formControl not exist');\r\n }\r\n\r\n const instance = !controlName ? this.parent.formControl : this.parent.formControl.getChild(controlName);\r\n\r\n if (!instance) {\r\n throw new Error('control not found');\r\n return;\r\n }\r\n\r\n this.latestControlName = controlName;\r\n this.setContext(instance);\r\n }\r\n\r\n @Input() set eclatFormError(control: AbstractEclatFormControl<T> | keyof Record<any, T>) {\r\n if (control instanceof AbstractEclatFormControl) {\r\n this.setContext(control);\r\n }\r\n else {\r\n this.eclatControlName = control;\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n this.parent.formControl$.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n (formControl) => {\r\n if (formControl && this.latestControlName) {\r\n this.eclatFormError = formControl.getChild(this.latestControlName);\r\n }\r\n },\r\n );\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.onDestroy$.next();\r\n }\r\n\r\n private setContext(control: AbstractEclatFormControl<T>) {\r\n if (!this.context) {\r\n this.context = new EclatFormErrorContext<T>(control);\r\n this.viewContainer.createEmbeddedView(this.templateRef, this.context);\r\n }\r\n else if (this.context.control !== control) {\r\n this.context.control = control;\r\n }\r\n if (this.valueChangesSub) {\r\n this.valueChangesSub.unsubscribe();\r\n }\r\n\r\n this.checkValidity(control);\r\n this.valueChangesSub = control.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n () => {\r\n this.checkValidity(control);\r\n },\r\n );\r\n }\r\n\r\n private checkValidity(control: AbstractEclatFormControl<T>): void {\r\n const isAttached = !!this.viewContainer.length;\r\n\r\n if (!control.valid && this.errorMatcher(control)) {\r\n if (!isAttached) {\r\n this.viewContainer.createEmbeddedView(this.templateRef, this.context);\r\n }\r\n }\r\n else {\r\n if (isAttached) {\r\n this.viewContainer.remove();\r\n }\r\n }\r\n }\r\n}\r\n","import { Directive, forwardRef, Input } from '@angular/core';\r\nimport { EclatFormChild, EclatFormGroup } from '../../form-models';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\n\r\n@Directive({\r\n selector: '[eclatFormGroup]',\r\n providers: [{\r\n provide: EclatFormContainerDirective,\r\n useExisting: forwardRef(() => EclatFormGroupDirective),\r\n }],\r\n})\r\nexport class EclatFormGroupDirective<T> extends EclatFormContainerDirective<EclatFormGroup<T>> {\r\n constructor() {\r\n super();\r\n }\r\n\r\n @Input()\r\n set eclatFormGroup(formGroup: EclatFormGroup<T>) {\r\n this._formControl.next(formGroup);\r\n }\r\n\r\n getChild(key: keyof T): EclatFormChild<T[any]> | undefined {\r\n if (this.formControl) {\r\n return this.formControl.getChild(key);\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\n","import { Directive, forwardRef, Input, OnDestroy, OnInit, SkipSelf } from '@angular/core';\r\nimport { EclatFormChild, EclatFormGroup } from '../../form-models';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[eclatFormGroupName]',\r\n providers: [{\r\n provide: EclatFormContainerDirective,\r\n useExisting: forwardRef(() => EclatFormGroupNameDirective),\r\n }],\r\n})\r\nexport class EclatFormGroupNameDirective<T extends any[]> extends EclatFormContainerDirective<EclatFormGroup<T>> implements OnInit, OnDestroy {\r\n private onDestroy$: Subject<void>;\r\n private latestName: string;\r\n\r\n constructor(@SkipSelf() private parent: EclatFormContainerDirective<any>) {\r\n super();\r\n this.onDestroy$ = new Subject();\r\n }\r\n\r\n @Input()\r\n set eclatFormGroupName(name: string) {\r\n this.latestName = name;\r\n this._formControl.next(<EclatFormGroup<any>>this.parent.getChild(name));\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.onDestroy$.next();\r\n }\r\n\r\n ngOnInit(): void {\r\n this.parent.formControl$.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n () => {\r\n this.eclatFormGroupName = this.latestName;\r\n },\r\n );\r\n }\r\n\r\n getChild(key: number): EclatFormChild<T[any]> | undefined {\r\n if (this.formControl) {\r\n return this.formControl.getChild(key);\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\n","import { Directive, forwardRef, Input, OnDestroy, OnInit, SkipSelf } from '@angular/core';\r\nimport { EclatFormArray, EclatFormChild } from '../../form-models';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[eclatFormArrayName]',\r\n providers: [{\r\n provide: EclatFormContainerDirective,\r\n useExisting: forwardRef(() => EclatFormArrayNameDirective),\r\n }],\r\n})\r\nexport class EclatFormArrayNameDirective<T extends any[]> extends EclatFormContainerDirective<EclatFormArray<T>> implements OnInit, OnDestroy {\r\n private onDestroy$: Subject<void>;\r\n private latestName: string;\r\n\r\n constructor(@SkipSelf() private parent: EclatFormContainerDirective<any>) {\r\n super();\r\n this.onDestroy$ = new Subject();\r\n }\r\n\r\n @Input()\r\n set eclatFormArrayName(name: string) {\r\n this.latestName = name;\r\n this._formControl.next(<EclatFormArray<any>>this.parent.getChild(name));\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.onDestroy$.next();\r\n }\r\n\r\n ngOnInit(): void {\r\n this.parent.formControl$.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n () => {\r\n this.eclatFormArrayName = this.latestName;\r\n },\r\n );\r\n }\r\n\r\n getChild(key: number): EclatFormChild<T[any]> | undefined {\r\n if (this.formControl) {\r\n return this.formControl.getChild(key);\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\n","import { Directive, forwardRef, Input } from '@angular/core';\r\nimport { EclatFormArray, EclatFormChild } from '../../form-models';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\n\r\n@Directive({\r\n selector: '[eclatFormArray]',\r\n providers: [{\r\n provide: EclatFormContainerDirective,\r\n useExisting: forwardRef(() => EclatFormArrayDirective),\r\n }],\r\n})\r\nexport class EclatFormArrayDirective<T extends any[]> extends EclatFormContainerDirective<EclatFormArray<T>> {\r\n constructor() {\r\n super();\r\n }\r\n\r\n @Input()\r\n set eclatFormArray(formArray: EclatFormArray<T>) {\r\n this._formControl.next(formArray);\r\n }\r\n\r\n getChild(key: number): EclatFormChild<T[any]> | undefined {\r\n if (this.formControl) {\r\n return this.formControl.getChild(key);\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\n","import { Directive, EmbeddedViewRef, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\nimport { EclatFormArray, EclatFormChild } from '../../form-models';\r\nimport { Subject, Subscription } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[eclatFormArrayChildren]',\r\n})\r\nexport class EclatFormArrayChildrenDirective<T> implements OnInit, OnDestroy {\r\n private onDestroy$: Subject<void>;\r\n private latestChildren: EclatFormChild<any>[];\r\n private valueChangeSubs: Subscription | null;\r\n\r\n constructor(\r\n private templateRef: TemplateRef<any>,\r\n private viewContainer: ViewContainerRef,\r\n private parent: EclatFormContainerDirective<EclatFormArray<any>>,\r\n ) {\r\n this.onDestroy$ = new Subject();\r\n this.latestChildren = [];\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.onDestroy$.next();\r\n }\r\n\r\n ngOnInit(): void {\r\n this.parent.formControl$.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n (formControl) => {\r\n if (formControl) {\r\n if (this.valueChangeSubs) {\r\n this.valueChangeSubs.unsubscribe();\r\n }\r\n\r\n this.onChange(formControl);\r\n this.valueChangeSubs = formControl.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n () => {\r\n this.onChange(formControl);\r\n },\r\n );\r\n }\r\n },\r\n );\r\n }\r\n\r\n private onChange(control: EclatFormArray<any>): void {\r\n const children: EclatFormChild<any>[] = [];\r\n const controlChildrenLength: number = control.children.length;\r\n\r\n control.children.forEach(\r\n (c, index) => {\r\n const lastIndex = this.latestChildren.findIndex(o => o === c);\r\n const first: boolean = index === 0;\r\n const last: boolean = index === (controlChildrenLength - 1);\r\n\r\n if (lastIndex < 0) {\r\n this.viewContainer.createEmbeddedView(this.templateRef, { $implicit: index, last, first }, index);\r\n } else if (lastIndex !== index) {\r\n const embeddedView: EmbeddedViewRef<any> = <EmbeddedViewRef<any>>this.viewContainer.get(lastIndex)!;\r\n embeddedView.context.$implicit = index;\r\n embeddedView.context.last = last;\r\n embeddedView.context.first = first;\r\n\r\n this.viewContainer.move(embeddedView, index);\r\n }\r\n\r\n children.push(c);\r\n },\r\n );\r\n while (this.viewContainer.length > controlChildrenLength) {\r\n this.viewContainer.remove();\r\n }\r\n\r\n this.latestChildren = children;\r\n }\r\n}\r\n\r\n","import { Directive, HostListener } from '@angular/core';\r\nimport { EclatFormContainerDirective } from './eclat-form-container.directive';\r\n\r\n@Directive({ selector: '[eclatFormSubmit]' })\r\nexport class EclatFormSubmitDirective {\r\n constructor(private parent: EclatFormContainerDirective<any>) {\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n @HostListener('tap', ['$event'])\r\n onClick(): void {\r\n this.parent.submit();\r\n }\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\nimport { EclatFormArray } from '../../form-models';\r\n\r\n@Directive({\r\n selector: '[eclatFormAddChildren]',\r\n})\r\nexport class EclatFormArrayAddDirective<T> {\r\n @Input('eclatFormAddChildren')\r\n value: T;\r\n\r\n constructor(\r\n private parent: EclatFormContainerDirective<EclatFormArray<any>>,\r\n ) {\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n onClick(): void {\r\n const control = this.parent.formControl;\r\n\r\n if (control) {\r\n control.addChild(this.value);\r\n }\r\n }\r\n}\r\n\r\n","import { Directive, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\r\nimport { AbstractEclatFormControl } from '../abstract-control';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { EclatFormContainerDirective } from './eclat-form-container.directive';\r\n\r\nclass EclatFormValueContext<T> {\r\n constructor(public control: AbstractEclatFormControl<T>) {\r\n }\r\n\r\n get $implicit(): T {\r\n return this.control.value;\r\n }\r\n}\r\n\r\n\r\n@Directive({ selector: '[eclatFormValue]' })\r\nexport class EclatFormValueDirective<T> implements OnInit, OnDestroy {\r\n private context?: EclatFormValueContext<T>;\r\n private latestControlName: string;\r\n private onDestroy$: Subject<void>;\r\n\r\n constructor(\r\n private templateRef: TemplateRef<EclatFormValueContext<T>>,\r\n private viewContainer: ViewContainerRef,\r\n private parent: EclatFormContainerDirective<any>,\r\n ) {\r\n this.onDestroy$ = new Subject();\r\n }\r\n\r\n @Input()\r\n set eclatControl(control: AbstractEclatFormControl<T>) {\r\n this.setContext(control);\r\n }\r\n\r\n @Input()\r\n set eclatControlName(controlName: keyof Record<any, T>) {\r\n if (!this.parent.formControl) {\r\n throw new Error('parent formControl not exist');\r\n }\r\n\r\n const instance = this.parent.formControl.getChild(controlName);\r\n\r\n if (!instance) {\r\n throw new Error('control not found');\r\n return;\r\n }\r\n\r\n this.latestControlName = controlName;\r\n this.setContext(instance);\r\n }\r\n\r\n @Input() set eclatFormValue(control: AbstractEclatFormControl<T> | keyof Record<any, T>) {\r\n if (control instanceof AbstractEclatFormControl) {\r\n this.setContext(control);\r\n }\r\n else if (control || control === 0) {\r\n this.eclatControlName = control;\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n this.parent.formControl$.pipe(takeUntil(this.onDestroy$)).subscribe(\r\n (formControl) => {\r\n if (formControl && this.latestControlName) {\r\n this.eclatFormValue = formControl.getChild(this.latestControlName);\r\n }\r\n },\r\n );\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.onDestroy$.next();\r\n }\r\n\r\n private setContext(control: AbstractEclatFormControl<T>) {\r\n if (!this.context) {\r\n this.context = new EclatFormValueContext<T>(control);\r\n this.viewContainer.createEmbeddedView(this.templateRef, this.context);\r\n }\r\n else if (this.context.control !== control) {\r\n this.context.control = control;\r\n }\r\n }\r\n}\r\n","import { ControlContainer, FormGroupDirective } from '@angular/forms';\r\nimport { Directive, forwardRef, Input, OnChanges, SimpleChange, SimpleChanges } from '@angular/core';\r\nimport { EclatFormGroup } from '../../form-models';\r\n\r\n@Directive({\r\n selector: '[eclatFormGroup]',\r\n providers: [{\r\n provide: ControlContainer,\r\n useExisting: forwardRef(() => EclatFormGroupBinderDirective),\r\n }],\r\n})\r\nexport class EclatFormGroupBinderDirective<T> extends FormGroupDirective implements OnChanges {\r\n @Input()\r\n set eclatFormGroup(formGroup: EclatFormGroup<T>) {\r\n this.form = formGroup.control;\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n const eclatFormGroupChanges = changes.eclatFormGroup;\r\n\r\n if (eclatFormGroupChanges) {\r\n const prevValue = eclatFormGroupChanges.previousValue ? eclatFormGroupChanges.previousValue.control : undefined;\r\n const currentValue = eclatFormGroupChanges.currentValue.control;\r\n const firstChange = eclatFormGroupChanges.firstChange;\r\n super.ngOnChanges({ form: new SimpleChange(prevValue, currentValue, firstChange) });\r\n }\r\n }\r\n}\r\n","import { ControlContainer, FormGroupName } from '@angular/forms';\r\nimport { Directive, forwardRef, Input } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[eclatFormGroupName]',\r\n providers: [{\r\n provide: ControlContainer,\r\n useExisting: forwardRef(() => EclatFormGroupNameBinderDirective),\r\n }],\r\n})\r\nexport class EclatFormGroupNameBinderDirective<T> extends FormGroupName {\r\n @Input()\r\n set eclatFormGroupName(name: string) {\r\n this.name = name;\r\n }\r\n}\r\n","import { ControlContainer, FormArrayName } from '@angular/forms';\r\nimport { Directive, forwardRef, Input } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[eclatFormArrayName]',\r\n providers: [{\r\n provide: ControlContainer,\r\n useExisting: forwardRef(() => EclatFormArrayNameBinderDirective),\r\n }],\r\n})\r\nexport class EclatFormArrayNameBinderDirective<T> extends FormArrayName {\r\n @Input()\r\n set eclatFormArrayName(name: string) {\r\n this.name = name;\r\n }\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { EclatFormContainerDirective } from '../eclat-form-container.directive';\r\nimport { EclatFormArray } from '../../form-models';\r\n\r\n@Directive({\r\n selector: '[eclatFormRemoveChildren]',\r\n})\r\nexport class EclatFormArrayRemoveDirective<T> {\r\n @Input('eclatFormRemoveChildren')\r\n index: number;\r\n\r\n constructor(\r\n private parent: EclatFormContainerDirective<EclatFormArray<any>>,\r\n ) {\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n onClick(): void {\r\n const control = this.parent.formControl;\r\n\r\n if (control) {\r\n control.removeChild(this.index);\r\n }\r\n }\r\n}\r\n\r\n","import { NgModule } from '@angular/core';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\nimport { CommonModule } from '@angular/common';\r\nimport { EclatFormOfDirective } from './directives/eclat-form.directive';\r\nimport { EclatFormErrorDirective } from './directives/eclat-form-error.directive';\r\nimport { EclatFormGroupDirective } from './directives/group/eclat-form-group.directive';\r\nimport { EclatFormGroupNameDirective } from './directives/group/eclat-form-group-name.directive';\r\nimport { EclatFormArrayNameDirective } from './directives/array/eclat-form-array-name.directive';\r\nimport { EclatFormArrayDirective } from './directives/array/eclat-form-array.directive';\r\nimport { EclatFormArrayChildrenDirective } from './directives/array/eclat-form-array-children.directive';\r\nimport { EclatFormSubmitDirective } from './directives/eclat-form-submit.directive';\r\nimport { EclatFormArrayAddDirective } from './directives/array/eclat-form-array-add.directive';\r\nimport { EclatFormValueDirective } from './directives/eclat-form-value.directive';\r\nimport { EclatFormGroupBinderDirective } from './directives/binder/eclat-form-group-binder.directive';\r\nimport { EclatFormGroupNameBinderDirective } from './directives/binder/eclat-form-group-name-binder.directive';\r\nimport { EclatFormArrayNameBinderDirective } from './directives/binder/eclat-form-array-name-binder.directive';\r\nimport { EclatFormArrayRemoveDirective } from './directives/array/eclat-form-array-remove.directive';\r\n\r\n@NgModule({\r\n imports: [CommonModule, ReactiveFormsModule],\r\n declarations: [EclatFormOfDirective, EclatFormErrorDirective, EclatFormGroupDirective, EclatFormGroupNameDirective, EclatFormArrayDirective, EclatFormArrayNameDirective, EclatFormArrayChildrenDirective, EclatFormSubmitDirective, EclatFormArrayAddDirective, EclatFormValueDirective, EclatFormGroupBinderDirective, EclatFormGroupNameBinderDirective, EclatFormArrayNameBinderDirective, EclatFormArrayRemoveDirective],\r\n exports: [CommonModule, ReactiveFormsModule, EclatFormOfDirective, EclatFormErrorDirective, EclatFormGroupDirective, EclatFormGroupNameDirective, EclatFormArrayDirective, EclatFormArrayNameDirective, EclatFormArrayChildrenDirective, EclatFormSubmitDirective, EclatFormArrayAddDirective, EclatFormValueDirective, EclatFormGroupBinderDirective, EclatFormGroupNameBinderDirective, EclatFormArrayNameBinderDirective, EclatFormArrayRemoveDirective],\r\n})\r\nexport class EclatFormModule {\r\n}\r\n"]}
\No newline at end of file