@stemy/ngx-dynamic-form 10.2.31 → 10.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@stemy/ngx-utils"),require("rxjs"),require("@angular/core"),require("@angular/forms"),require("@ng-dynamic-forms/core"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@stemy/ngx-dynamic-form",["exports","@stemy/ngx-utils","rxjs","@angular/core","@angular/forms","@ng-dynamic-forms/core","rxjs/operators","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).stemy=e.stemy||{},e.stemy["ngx-dynamic-form"]={}),e.ngxUtils,e.rxjs,e.ng.core,e.ng.forms,e.core,e.rxjs.operators,e.ng.common)}(this,(function(e,t,n,r,o,i,a,s){"use strict";function u(e,t){var n=t.get(e);return n?n.value:null}function c(e,n,r){t.ReflectUtils.defineMetadata("dynamicFormControl",r,e,n)}function l(e,n,r){return(r=r||{id:e}).id=e,r.label=t.ObjectUtils.isNullOrUndefined(r.label)?e:r.label,r.disabled=r.disabled||!1,r.hidden=r.hidden||!1,{id:e,type:n,config:r}}function p(e,t,n){void 0===n&&(n="text");var r=l(e,"input",t);return(t=r.config).inputType=t.inputType||n,t.placeholder=t.placeholder||("mask"==t.inputType?"_":""),t.step=t.step||1,t.mask=t.mask||[/\w*/gi],r}function m(e,t){var n=l(e,"select",t);return(t=n.config).options=t.options||[],n}function f(e,t){return l(e,"static",t)}function h(e,t){var n=l(e,"group",t);return(t=n.config).name=t.name||"",n}function y(e){var t=e.value;if(!t)return null;try{return JSON.parse(t),null}catch(e){return{json:!0}}}function d(e){var t=e.value;return t&&0!=t.length&&t.findIndex((function(e){return("de"==e.lang||"en"==e.lang)&&!e.translation}))<0?null:{requiredTranslation:!0}}function g(e){var t=e.value;if(!t)return Promise.resolve(null);return/^(?:\d){10,12}$/.test(t)?null:{phone:!0}}function v(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"string"==typeof t&&t.length>=e}))?null:{itemsMinLength:e}}}function b(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"string"==typeof t&&t.length<=e}))?null:{itemsMaxLength:e}}}function C(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"number"==typeof t&&t>=e}))?null:{itemsMinValue:e}}}function S(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"number"==typeof t&&t<=e}))?null:{itemsMaxValue:e}}}var F=function(e,t){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},F(e,t)};function D(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function O(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function A(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}Object.create;function w(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function x(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(E(arguments[t]));return e}Object.create;var M=function(e){function t(t){var n=e.call(this)||this;return n.notifyCallback=t,n}return D(t,e),t.prototype.handleNotifiedValue=function(e,t,n){var r=this;n.then((function(e){return r.next(e)}))},t.prototype.notify=function(e,t){for(var n=e;n&&isNaN(n.index);)n=n.parent;var r=this.notifyCallback(e,t,null==n?void 0:n.index);r instanceof Promise||(r=Promise.resolve(r)),this.handleNotifiedValue(e,t,r)},t}(n.Subject),j=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return D(t,e),t.prototype.handleNotifiedValue=function(e,t,n){var r=this;n.then((function(n){var o,i;if(r.next(n),0!=n.length){var a=t.value;if(e.multiple){var s=(a||[]).filter((function(e){return n.findIndex((function(t){return t.value==e}))>=0}));s.length!==(null==a?void 0:a.length)&&t.setValue(s,{onlySelf:!0,emitEvent:!1})}else{n.find((function(e){return e.value==a}))||t.setValue(null!==(i=null===(o=n[0])||void 0===o?void 0:o.value)&&void 0!==i?i:null,{onlySelf:!0,emitEvent:!1})}}}))},t}(M);function I(e){return"string"==typeof e&&e.length>0}function N(e,t){if(!e||!t(e))return[];for(var n=[],r=e;r;){var o=t(r);o&&n.unshift(o),r=r.parent}return n}var R=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.additional=t.additional||{},r}return D(t,e),t}(i.DynamicFormArrayModel),V=function(e){function a(t,n,o,i){var a=e.call(this,t,n)||this;return a.openApi=o,a.injector=i,a.onDetectChanges=new r.EventEmitter,a}return D(a,e),Object.defineProperty(a.prototype,"api",{get:function(){return this.openApi.api},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"language",{get:function(){return this.api.language},enumerable:!1,configurable:!0}),a.prototype.patchGroup=function(e,n,r){this.patchValueRecursive(e,n,r),this.detectChanges(),r.patchValue(t.ObjectUtils.copy(e))},a.prototype.patchForm=function(e,t){this.patchValueRecursive(e,t.model,t.group),this.detectChanges(t),t.group.patchValue(e)},a.prototype.serialize=function(e,t){return this.serializeRecursive(e,t)},a.prototype.notifyChanges=function(e,t){this.notifyChangesRecursive(e,t)},a.prototype.updateSelectOptions=function(e,t){if(e instanceof i.DynamicSelectModel){var r=e.options$;if(r instanceof M)return void r.notify(e,t);for(;r instanceof n.Subject&&r.source;)(r=r.source)instanceof M&&r.notify(e,t)}},a.prototype.showErrors=function(e){this.showErrorsForGroup(e.group),this.detectChanges(e)},a.prototype.detectChanges=function(t){e.prototype.detectChanges.call(this,t),this.onDetectChanges.emit(t)},a.prototype.patchValueRecursive=function(e,n,r){var o=this;Object.keys(e).forEach((function(a){var s=o.findModelById(a,n),u=e[a];if(s){var c=o.findControlByModel(s,r);if(s instanceof i.DynamicSelectModel&&t.ObjectUtils.isObject(u))e[a]=u.id||u._id||u;else if(s instanceof i.DynamicFormArrayModel){for(var l=Array.isArray(u)?u.length:0,p=c;s.size>l;)o.removeFormArrayGroup(0,p,s);for(;s.size<l;)o.insertFormArrayGroup(s.size,p,s);for(var m=0;m<l;m++){var f=s.get(m);o.patchValueRecursive(u[m],f.group,p.at(m))}}else s instanceof i.DynamicFormGroupModel&&o.patchValueRecursive(u,s.group,c)}}))},a.prototype.serializeRecursive=function(e,n){var r,o;return O(this,void 0,void 0,(function(){var a,s,u,c,l,p,m,f,h,y,d,g,v,b,C,S,F,D,O;return A(this,(function(A){switch(A.label){case 0:if(a={},!e||!n||!n.value)return[2,a];for(u in s=[],e)s.push(u);c=0,A.label=1;case 1:return c<s.length?(l=s[c],p=e[l],m=this.findControlByModel(p,n),f=null===(r=p.additional)||void 0===r?void 0:r.serializer,t.ObjectUtils.isFunction(f)?(h=a,y=p.id,[4,f(p,m)]):[3,3]):[3,12];case 2:return h[y]=A.sent(),[3,11];case 3:if(!(p instanceof i.DynamicFormArrayModel))return[3,8];d=Array.isArray(m.value)?m.value.length:0,g=m,v=[],b=0,A.label=4;case 4:return b<d?(C=p.get(b),F=(S=v).push,[4,this.serializeRecursive(C.group,g.at(b))]):[3,7];case 5:F.apply(S,[A.sent()]),A.label=6;case 6:return b++,[3,4];case 7:return a[p.id]=v,[3,11];case 8:return p instanceof i.DynamicFormGroupModel?(D=a,O=p.id,[4,this.serializeRecursive(p.group,m)]):[3,10];case 9:return D[O]=A.sent(),[3,11];case 10:if(p instanceof i.DynamicInputModel&&!t.ObjectUtils.isNullOrUndefined(m.value))return a[p.id]="number"==p.inputType?null!==(o=parseFloat((""+m.value||"0").replace(/,/gi,".")))&&void 0!==o?o:null:m.value,[3,11];a[p.id]=m.value,A.label=11;case 11:return c++,[3,1];case 12:return[2,a]}}))}))},a.prototype.notifyChangesRecursive=function(e,t){if(e&&t)for(var n in e){var r=e[n],o=this.findControlByModel(r,t);if(r instanceof i.DynamicFormArrayModel)for(var a=Array.isArray(o.value)?o.value.length:0,s=o,u=0;u<a;u++){var c=r.get(u);this.notifyChangesRecursive(c.group,s.at(u))}else r instanceof i.DynamicFormGroupModel?this.notifyChangesRecursive(r.group,o):this.updateSelectOptions(r,o)}},a.prototype.showErrorsForGroup=function(e){if(e){e.markAsTouched({onlySelf:!0});var t=Object.keys(e.controls).map((function(t){return e.controls[t]}));this.showErrorsForControls(t)}},a.prototype.showErrorsForControls=function(e){var t=this;e.forEach((function(e){e instanceof o.FormGroup?t.showErrorsForGroup(e):(e.markAsTouched({onlySelf:!0}),e instanceof o.FormArray&&t.showErrorsForControls(e.controls))}))},a.prototype.getFormModelForSchema=function(e,n){return O(this,void 0,void 0,(function(){var r,o,i=this;return A(this,(function(a){switch(a.label){case 0:return this.api.cache={},r=this,[4,this.openApi.getSchemas()];case 1:return r.schemas=a.sent(),o=function(e,r,o,a){var s=new o(a);if(!t.ObjectUtils.isFunction(n))return[s];var u=n(e,r,s,a,i.injector);return Array.isArray(u)?u:[u]},[2,this.getFormModelForSchemaDef(this.schemas[e],o)]}}))}))},a.prototype.getFormModelForSchemaDef=function(e,t){var n,r;if(!e)return[];var o=Object.keys(e.properties||{}),i=[];try{for(var a=w(o),s=a.next();!s.done;s=a.next()){var u=s.value,c=e.properties[u];i.push.apply(i,x(this.getFormControlModels(c,e,t)))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i.filter((function(e){return null!==e}))},a.prototype.getFormControlModels=function(e,t,n){var r,o,a=(null===(r=e.items)||void 0===r?void 0:r.enum)||e.enum;if(Array.isArray(a)||I(e.optionsPath)||I(e.endpoint))return n(e,t,i.DynamicSelectModel,this.getFormSelectConfig(e,t));switch(e.type){case"string":case"number":case"integer":return n(e,t,i.DynamicInputModel,this.getFormInputConfig(e,t));case"textarea":return n(e,t,i.DynamicTextAreaModel,this.getFormTextareaConfig(e,t));case"boolean":return n(e,t,i.DynamicCheckboxModel,this.getFormCheckboxConfig(e,t));case"array":return(null===(o=e.items)||void 0===o?void 0:o.$ref)||e.$ref?n(e,t,R,this.getFormArrayConfig(e,t,n)):n(e,t,i.DynamicInputModel,this.getFormInputConfig(e,t));case"file":return n(e,t,i.DynamicFileUploadModel,this.getFormUploadConfig(e,t))}return e.$ref?n(e,t,i.DynamicFormGroupModel,this.getFormGroupConfig(e,t,n)):[]},a.prototype.getFormControlConfig=function(e,n){var r=this.getValidators(e,n),o=Object.keys(r).reduce((function(e,t){return e[t]="error."+t,e}),{});return{id:e.id,label:t.ObjectUtils.isString(e.label)?e.label:e.id,hidden:e.hidden,disabled:e.disabled,validators:r,errorMessages:o,additional:Object.assign({},e)}},a.prototype.getFormArrayConfig=function(e,t,n){var r,o=this,i=(null===(r=e.items)||void 0===r?void 0:r.$ref)||e.$ref||"",a=this.schemas[i.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{groupFactory:function(){return o.getFormModelForSchemaDef(a,n)}})},a.prototype.getFormGroupConfig=function(e,t,n){var r=e.$ref||"",o=this.schemas[r.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{group:this.getFormModelForSchemaDef(o,n)})},a.prototype.getFormInputConfig=function(e,n){var r,o=t.StringUtils.has(e.id,"password","Password")?"password":(null===(r=e.items)||void 0===r?void 0:r.type)||e.type;switch(o){case"boolean":o="checkbox";break;case"textarea":o="textarea";break;case"integer":o="number"}var i="array"==e.type&&e.items||e;return Object.assign(this.getFormControlConfig(e,n),{inputType:o,autoComplete:e.autoComplete||"off",multiple:"array"==e.type,accept:t.ObjectUtils.isString(e.accept)?e.accept:null,mask:t.ObjectUtils.isString(e.mask)?e.mask:null,pattern:t.ObjectUtils.isString(e.pattern)?e.pattern:null,step:isNaN(i.step)?isNaN(e.step)?1:e.step:i.step,min:isNaN(i.minimum)?Number.MIN_SAFE_INTEGER:i.minimum,max:isNaN(i.maximum)?Number.MAX_SAFE_INTEGER:i.maximum,minLength:isNaN(i.minLength)?Number.MIN_SAFE_INTEGER:i.minLength,maxLength:isNaN(i.maxLength)?Number.MAX_SAFE_INTEGER:i.maxLength})},a.prototype.getFormTextareaConfig=function(e,t){return Object.assign(this.getFormControlConfig(e,t),{cols:e.cols||null,rows:e.rows||10,wrap:e.wrap||!1,autoComplete:e.autoComplete||"off",multiple:"array"==e.type})},a.prototype.getFormSelectConfig=function(e,t){return Object.assign(this.getFormControlConfig(e,t),{options:this.getFormSelectOptions(e,t),multiple:"array"==e.type})},a.prototype.getFormCheckboxConfig=function(e,t){return Object.assign(this.getFormControlConfig(e,t),{indeterminate:!0===e.indeterminate})},a.prototype.translateOptions=function(e){return O(this,void 0,void 0,(function(){var t,n,r,o,i,a,s;return A(this,(function(u){switch(u.label){case 0:if(!e)return[2,[]];u.label=1;case 1:u.trys.push([1,6,7,8]),t=w(e),n=t.next(),u.label=2;case 2:return n.done?[3,5]:(r=n.value,o=r,[4,this.language.getTranslation(r.label)]);case 3:o.label=u.sent(),u.label=4;case 4:return n=t.next(),[3,2];case 5:return[3,8];case 6:return i=u.sent(),a={error:i},[3,8];case 7:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 8:return[2,e]}}))}))},a.prototype.getFormSelectOptions=function(e,n){var r,o=this,i=(null===(r=e.items)||void 0===r?void 0:r.enum)||e.enum;return Array.isArray(i)?new j((function(){var t=i.map((function(t){return{value:t,label:e.translatable?e.id+"."+t:""+t}}));return o.translateOptions(t)})):I(e.optionsPath)?new j((function(n,r,i){var a=e.optionsPath,s=r;if(a.startsWith("$root"))for(a=a.substr(5);s.parent;)s=s.parent;for(;a.startsWith(".");)a=a.substr(1),s.parent&&(s=s.parent);var u=t.ObjectUtils.getValue(s.value,a.replace(/\$ix/gi,i)),c=(t.ObjectUtils.isArray(u)?u:[]).map((function(e){return{value:e,label:e}}));return o.translateOptions(c)})):new j((function(){return O(o,void 0,void 0,(function(){var t;return A(this,(function(n){switch(n.label){case 0:return this.api.cache[e.endpoint]=this.api.cache[e.endpoint]||this.api.list(e.endpoint,this.api.makeListParams(1,-1)).then((function(t){return t.items.map((function(t){return{value:t.id||t._id,label:t[e.labelField]||t.label||t.id||t._id}}))})),[4,this.api.cache[e.endpoint]];case 1:return t=n.sent().map((function(e){return Object.assign({},e)})),[2,this.translateOptions(t)]}}))}))}))},a.prototype.getFormUploadConfig=function(e,t){var n=this.api.url(e.url||"assets"),r=e.accept,o=e.autoUpload,i=e.maxSize,a=e.minSize,s=e.removeUrl,u=e.showFileList;return Object.assign(this.getFormControlConfig(e,t),{url:n,accept:r,autoUpload:o,maxSize:i,minSize:a,removeUrl:s,showFileList:u})},a.prototype.getValidators=function(e,n){var r={};return t.ObjectUtils.isArray(n.required)&&n.required.indexOf(e.id)>=0&&(r.required=null),this.addPropertyValidators(r,e),this.addItemsValidators(r,e.items),r},a.prototype.addPropertyValidators=function(e,t){if(t&&(isNaN(t.minLength)||(e.minLength=t.minLength),isNaN(t.maxLength)||(e.maxLength=t.maxLength),isNaN(t.minimum)||(e.min=t.minimum),isNaN(t.maximum)||(e.max=t.maximum),"email"===t.format))e.email=null},a.prototype.addItemsValidators=function(e,t){t&&(isNaN(t.minLength)||(e.itemsMinLength=t.minLength),isNaN(t.maxLength)||(e.itemsMaxLength=t.maxLength),isNaN(t.minimum)||(e.itemsMinValue=t.minimum),isNaN(t.maximum)||(e.itemsMaxValue=t.maximum))},a}(i.DynamicFormService);V.decorators=[{type:r.Injectable}],V.ctorParameters=function(){return[{type:i.DynamicFormComponentService},{type:i.DynamicFormValidationService},{type:t.OpenApiService,decorators:[{type:r.Inject,args:[t.OpenApiService]}]},{type:r.Injector,decorators:[{type:r.Inject,args:[r.Injector]}]}]};var T=function(){function e(e,t,n,o){this.toaster=e,this.cdr=t,this.elem=n,this.renderer=o,this.onSuccess=new r.EventEmitter,this.onError=new r.EventEmitter,"BUTTON"===n.nativeElement.tagName&&o.setAttribute(n.nativeElement,"type","button")}return Object.defineProperty(e.prototype,"isDisabled",{get:function(){return this.disabled},set:function(e){this.disabled=e,e?this.renderer.setAttribute(this.elem.nativeElement,"disabled","disabled"):this.renderer.removeAttribute(this.elem.nativeElement,"disabled")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this.loading},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.form&&(this.isDisabled="VALID"!==this.form.status,this.cdr.detectChanges(),this.onStatusChange=this.form.onStatusChange.subscribe((function(){e.isDisabled="VALID"!==e.form.status,e.cdr.detectChanges(),e.callback&&"PENDING"!=e.form.status&&(e.disabled||e.callback(),e.callback=null)})),this.onSubmit=this.form.onSubmit.subscribe((function(){return e.callMethod()})))},e.prototype.ngOnDestroy=function(){this.onStatusChange&&this.onStatusChange.unsubscribe(),this.onSubmit&&this.onSubmit.unsubscribe()},e.prototype.click=function(){var e=this;this.callback=function(){return e.callMethod()},"VALID"!==this.form.status&&"INVALID"!==this.form.status||(this.callback(),this.callback=null)},e.prototype.callMethod=function(){var e=this;this.loading||(this.loading=!0,this.method(this.form,this.context).then((function(t){e.loading=!1,t&&(e.onSuccess.emit(t),e.toaster.success(t.message,t.context))}),(function(t){if(!t||!t.message)throw new Error("Reason must implement IAsyncMessage interface");e.loading=!1,e.onError.emit(t),e.toaster.error(t.message,t.context)})))},e}();T.decorators=[{type:r.Directive,args:[{selector:"[async-submit]",exportAs:"async-submit"}]}],T.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[t.TOASTER_SERVICE]}]},{type:r.ChangeDetectorRef},{type:r.ElementRef},{type:r.Renderer2}]},T.propDecorators={method:[{type:r.Input,args:["async-submit"]}],form:[{type:r.Input}],context:[{type:r.Input}],onSuccess:[{type:r.Output}],onError:[{type:r.Output}],isDisabled:[{type:r.HostBinding,args:["class.disabled"]}],isLoading:[{type:r.HostBinding,args:["class.loading"]}],click:[{type:r.HostListener,args:["click"]}]};var L=function(e){function o(t,o,i,a){var s=e.call(this,i,a)||this;return s.formService=t,s.events=o,s.blur=new r.EventEmitter,s.change=new r.EventEmitter,s.focus=new r.EventEmitter,s.onStatusChange=new r.EventEmitter,s.onValueChange=new r.EventEmitter,s.onSubmit=new r.EventEmitter,s.templates=new r.QueryList,s.subscription=new n.Subscription,s.groupSubscription=new n.Subscription,s.labelPrefix="label",s}return D(o,e),Object.defineProperty(o.prototype,"status",{get:function(){return this.group?this.group.status:null},enumerable:!1,configurable:!0}),o.prototype.ngOnChanges=function(e){var n=this;this.groupSubscription.unsubscribe(),this.group&&(this.groupSubscription=t.ObservableUtils.multiSubscription(this.group.statusChanges.subscribe((function(){n.onStatusChange.emit(n)})),this.group.valueChanges.subscribe((function(){n.onValueChange.emit(n),n.formService.notifyChanges(n.model,n.group)}))))},o.prototype.ngAfterViewInit=function(){var e=this;this.subscription=t.ObservableUtils.multiSubscription(t.ObservableUtils.subscribe({subjects:[this.contentTemplates.changes,this.viewTemplates.changes],cb:function(){var t=e.contentTemplates.toArray().concat(e.viewTemplates.toArray());e.templates.reset(t)}}),this.events.languageChanged.subscribe((function(){e.formService.detectChanges(e)})),this.ngForm.ngSubmit.subscribe((function(){e.onSubmit.emit(e)})))},o.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.subscription.unsubscribe(),this.groupSubscription.unsubscribe()},o.prototype.insertFormArrayGroup=function(e,t,n){this.formService.insertFormArrayGroup(e,t,n),this.changeDetectorRef.detectChanges()},o.prototype.removeFormArrayGroup=function(e,t,n){this.formService.removeFormArrayGroup(e,t,n),this.changeDetectorRef.detectChanges()},o.prototype.moveFormArrayGroup=function(e,t,n,r){this.formService.moveFormArrayGroup(e,t,n,r),this.changeDetectorRef.detectChanges()},o.prototype.clearFormArray=function(e,t){this.formService.clearFormArray(e,t),this.changeDetectorRef.detectChanges()},o.prototype.getClass=function(e){var t=N(e,(function(e){return e.id}));return 0==t.length?"":e instanceof i.DynamicFormGroupModel?"form-group-"+t.join("-"):"form-control-"+t.join("-")},o.prototype.validate=function(e){var t=this;return void 0===e&&(e=!0),this.group?new Promise((function(n,r){t.group.statusChanges.pipe(a.first((function(e){return"VALID"==e||"INVALID"==e}))).subscribe((function(o){e&&t.formService.showErrors(t),"VALID"!=o?r(null):n(null)})),t.group.updateValueAndValidity()})):Promise.resolve()},o.prototype.serialize=function(e){return O(this,void 0,void 0,(function(){return A(this,(function(t){switch(t.label){case 0:return this.group?e?[4,this.validate()]:[3,2]:[2,null];case 1:t.sent(),t.label=2;case 2:return[4,this.formService.serialize(this.model,this.group)];case 3:return[2,t.sent()]}}))}))},o}(i.DynamicFormComponent);L.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form",template:"",changeDetection:r.ChangeDetectionStrategy.Default}]}],L.ctorParameters=function(){return[{type:V,decorators:[{type:r.Inject,args:[V]}]},{type:t.EventsService,decorators:[{type:r.Inject,args:[t.EventsService]}]},{type:r.ChangeDetectorRef},{type:i.DynamicFormComponentService}]},L.propDecorators={group:[{type:r.Input}],model:[{type:r.Input}],layout:[{type:r.Input}],labelPrefix:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],focus:[{type:r.Output}],contentTemplates:[{type:r.ContentChildren,args:[i.DynamicTemplateDirective]}],viewTemplates:[{type:r.ViewChildren,args:[i.DynamicTemplateDirective]}],onStatusChange:[{type:r.Output}],onValueChange:[{type:r.Output}],onSubmit:[{type:r.Output}],ngForm:[{type:r.ViewChild,args:[o.NgForm]}]};var P=function(e){function t(t,n){var o=e.call(this,t,n)||this;return o.layoutService=t,o.validationService=n,o.blur=new r.EventEmitter,o.change=new r.EventEmitter,o.customEvent=new r.EventEmitter,o.focus=new r.EventEmitter,o}return D(t,e),t.prototype.getClass=function(t,n,r){return["element"==t?this.getModelClass(r):null,e.prototype.getClass.call(this,t,n,r)].filter((function(e){return!!e})).join(" ")},t.prototype.getModelClass=function(e){var t=N(e,(function(e){return e.id}));return 0==t.length?"":e instanceof i.DynamicFormGroupModel?"form-group-"+t.join("-"):"form-control-"+t.join("-")},t}(i.DynamicFormArrayComponent);P.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-array",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],P.ctorParameters=function(){return[{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService}]},P.propDecorators={formLayout:[{type:r.Input}],group:[{type:r.Input}],layout:[{type:r.Input}],model:[{type:r.Input}],templates:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],customEvent:[{type:r.Output}],focus:[{type:r.Output}],components:[{type:r.ViewChildren,args:[r.forwardRef((function(){return i.DynamicFormControlContainerComponent}))]}]};var _=function(e){function n(t,n,o,i,a,s,u){var c=e.call(this,n,o,i,a,s,u)||this;return c.form=t,c.changeDetectorRef=n,c.componentFactoryResolver=o,c.layoutService=i,c.validationService=a,c.componentService=s,c.relationService=u,c.context=null,c.blur=new r.EventEmitter,c.change=new r.EventEmitter,c.focus=new r.EventEmitter,c}return D(n,e),Object.defineProperty(n.prototype,"componentType",{get:function(){var e;return null!==(e=this.componentService.getCustomComponentType(this.model))&&void 0!==e?e:this.getComponentType(this.model)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"startTemplate",{get:function(){return this.model.type==i.DYNAMIC_FORM_CONTROL_TYPE_ARRAY?this.layoutService.getAlignedTemplate(this.model,this.templates,"ARRAY_START"):this.layoutService.getStartTemplate(this.model,this.templates)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"endTemplate",{get:function(){return this.model.type==i.DYNAMIC_FORM_CONTROL_TYPE_ARRAY?this.layoutService.getAlignedTemplate(this.model,this.templates,"ARRAY_END"):this.layoutService.getEndTemplate(this.model,this.templates)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"formService",{get:function(){return this.form.formService},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var e=this;this.onDetectChanges=this.formService.onDetectChanges.subscribe((function(t){t===e.form&&(e.changeDetectorRef.detectChanges(),e.formService.updateSelectOptions(e.model,e.control))}))},n.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.onDetectChanges.unsubscribe()},n.prototype.getLabel=function(){var e,t=N(this.model,(function(e){return e.label}));return 0==t.length?"":((null===(e=this.form)||void 0===e?void 0:e.labelPrefix)&&t.unshift(this.form.labelPrefix),t.join("."))},n.prototype.createFormControlComponent=function(){var n;e.prototype.createFormControlComponent.call(this);var r=null===(n=this.componentRef)||void 0===n?void 0:n.instance;r&&t.ObjectUtils.isFunction(r.onCreated)&&r.onCreated()},n.prototype.getComponentType=function(e){return null},n}(i.DynamicFormControlContainerComponent);_.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-control",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],_.ctorParameters=function(){return[{type:L},{type:r.ChangeDetectorRef},{type:r.ComponentFactoryResolver},{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService},{type:i.DynamicFormComponentService},{type:i.DynamicFormRelationService}]},_.propDecorators={contentTemplateList:[{type:r.ContentChildren,args:[i.DynamicTemplateDirective]}],klass:[{type:r.HostBinding,args:["class"]}],context:[{type:r.Input}],group:[{type:r.Input}],hostClass:[{type:r.Input}],inputTemplateList:[{type:r.Input,args:["templates"]}],layout:[{type:r.Input}],model:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],focus:[{type:r.Output}],componentViewContainerRef:[{type:r.ViewChild,args:["componentViewContainer",{read:r.ViewContainerRef,static:!0}]}]};var k=function(e){function t(t,n){var o=e.call(this,t,n)||this;return o.layoutService=t,o.validationService=n,o.blur=new r.EventEmitter,o.change=new r.EventEmitter,o.customEvent=new r.EventEmitter,o.focus=new r.EventEmitter,o}return D(t,e),t.prototype.getClass=function(t,n,r){return["element"==t?this.getModelClass(r):null,e.prototype.getClass.call(this,t,n,r)].filter((function(e){return!!e})).join(" ")},t.prototype.getModelClass=function(e){var t=N(e,(function(e){return e.id}));return 0==t.length?"":e instanceof i.DynamicFormGroupModel?"form-group-"+t.join("-"):"form-control-"+t.join("-")},t}(i.DynamicFormGroupComponent);k.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-group",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],k.ctorParameters=function(){return[{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService}]},k.propDecorators={formLayout:[{type:r.Input}],group:[{type:r.Input}],layout:[{type:r.Input}],model:[{type:r.Input}],templates:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],customEvent:[{type:r.Output}],focus:[{type:r.Output}],components:[{type:r.ViewChildren,args:[r.forwardRef((function(){return i.DynamicFormControlContainerComponent}))]}]};var U=[L,P,_,k],G=[T],z=[],q=y,B=d,$=v,Y=b,H=C,J=S,W=new Map([["json",y],["requiredTranslation",d],["phone",g],["itemsMinLength",v],["itemsMaxLength",b],["itemsMinValue",C],["itemsMaxValue",S]]),X=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[V,{provide:i.DynamicFormService,useExisting:V}]}},e}();X.decorators=[{type:r.NgModule,args:[{declarations:x(U,G,z),imports:[s.CommonModule,o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule],exports:x(U,G,z,[o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule]),entryComponents:U,providers:x(z,[{provide:o.NG_VALIDATORS,useValue:q,multi:!0},{provide:o.NG_VALIDATORS,useValue:B,multi:!0},{provide:o.NG_VALIDATORS,useValue:$,multi:!0},{provide:o.NG_VALIDATORS,useValue:Y,multi:!0},{provide:o.NG_VALIDATORS,useValue:H,multi:!0},{provide:o.NG_VALIDATORS,useValue:J,multi:!0},{provide:i.DYNAMIC_VALIDATORS,useValue:W}])}]}],e.AsyncSubmitDirective=T,e.DynamicBaseFormArrayComponent=P,e.DynamicBaseFormComponent=L,e.DynamicBaseFormControlContainerComponent=_,e.DynamicBaseFormGroupComponent=k,e.DynamicFormService=V,e.FormFile=function(e){return function(n,r){c(n,r,function(e,n){var r=l(e,"file",n);return(n=r.config).accept=n.accept||["jpg","jpeg","png"],n.multiple=n.multiple||!1,n.url=t.ObjectUtils.isString(n.url)?n.url:"assets",r}(r,e))}},e.FormInput=function(e){return function(n,r){var o=t.ReflectUtils.getOwnMetadata("design:type",n,r),i=o?o.name:"",a=r.indexOf("password")<0?"text":"password";switch(i){case"Number":a="number";break;case"Boolean":a="checkbox"}c(n,r,p(r,e,a))}},e.FormModel=function(e){return function(t,n){c(t,n,h(n,e))}},e.FormSelect=function(e){return function(t,n){c(t,n,m(n,e))}},e.FormSelectSubject=j,e.FormSerializable=function(e){return function(n,r){t.ReflectUtils.defineMetadata("dynamicFormSerializer",e||u,n,r)}},e.FormStatic=function(e){return function(t,n){c(t,n,f(n,e))}},e.FormSubject=M,e.NgxDynamicFormModule=X,e.createFormControl=l,e.createFormInput=p,e.createFormModel=h,e.createFormSelect=m,e.createFormStatic=f,e.defaultSerializer=u,e.defineFormControl=c,e.getFormControl=function(e,n){return t.ReflectUtils.getMetadata("dynamicFormControl",e,n)},e.getFormSerializer=function(e,n){return t.ReflectUtils.getMetadata("dynamicFormSerializer",e,n)},e.validateItemsMaxLength=b,e.validateItemsMaxValue=S,e.validateItemsMinLength=v,e.validateItemsMinValue=C,e.validateJSON=y,e.validatePhone=g,e.validateRequiredTranslation=d,e.ɵa=U,e.ɵb=G,e.ɵc=z,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@stemy/ngx-utils"),require("rxjs"),require("@angular/core"),require("@angular/forms"),require("@ng-dynamic-forms/core"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@stemy/ngx-dynamic-form",["exports","@stemy/ngx-utils","rxjs","@angular/core","@angular/forms","@ng-dynamic-forms/core","rxjs/operators","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).stemy=e.stemy||{},e.stemy["ngx-dynamic-form"]={}),e.ngxUtils,e.rxjs,e.ng.core,e.ng.forms,e.core,e.rxjs.operators,e.ng.common)}(this,(function(e,t,n,r,o,i,a,s){"use strict";function u(e,t){var n=t.get(e);return n?n.value:null}function c(e,n,r){t.ReflectUtils.defineMetadata("dynamicFormControl",r,e,n)}function l(e,n,r){return(r=r||{id:e}).id=e,r.label=t.ObjectUtils.isNullOrUndefined(r.label)?e:r.label,r.disabled=r.disabled||!1,r.hidden=r.hidden||!1,{id:e,type:n,config:r}}function p(e,t,n){void 0===n&&(n="text");var r=l(e,"input",t);return(t=r.config).inputType=t.inputType||n,t.placeholder=t.placeholder||("mask"==t.inputType?"_":""),t.step=t.step||1,t.mask=t.mask||[/\w*/gi],r}function m(e,t){var n=l(e,"select",t);return(t=n.config).options=t.options||[],n}function f(e,t){return l(e,"static",t)}function h(e,t){var n=l(e,"group",t);return(t=n.config).name=t.name||"",n}function y(e){var t=e.value;if(!t)return null;try{return JSON.parse(t),null}catch(e){return{json:!0}}}function d(e){var t=e.value;return t&&0!=t.length&&t.findIndex((function(e){return("de"==e.lang||"en"==e.lang)&&!e.translation}))<0?null:{requiredTranslation:!0}}function g(e){var t=e.value;if(!t)return Promise.resolve(null);return/^(?:\d){10,12}$/.test(t)?null:{phone:!0}}function v(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"string"==typeof t&&t.length>=e}))?null:{itemsMinLength:e}}}function b(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"string"==typeof t&&t.length<=e}))?null:{itemsMaxLength:e}}}function C(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"number"==typeof t&&t>=e}))?null:{itemsMinValue:e}}}function S(e){return function(t){var n=t.value;return Array.isArray(n)&&n.every((function(t){return"number"==typeof t&&t<=e}))?null:{itemsMaxValue:e}}}var F=function(e,t){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},F(e,t)};function D(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function O(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function A(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}Object.create;function w(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function x(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(E(arguments[t]));return e}Object.create;var M=function(e){function t(t){var n=e.call(this)||this;return n.notifyCallback=t,n}return D(t,e),t.prototype.handleNotifiedValue=function(e,t,n){var r=this;n.then((function(e){return r.next(e)}))},t.prototype.notify=function(e,t){for(var n=e;n&&isNaN(n.index);)n=n.parent;var r=this.notifyCallback(e,t,null==n?void 0:n.index);r instanceof Promise||(r=Promise.resolve(r)),this.handleNotifiedValue(e,t,r)},t}(n.Subject),j=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return D(t,e),t.prototype.handleNotifiedValue=function(e,t,n){var r=this;n.then((function(n){var o,i;if(r.next(n),0!=n.length){var a=t.value;if(e.multiple){var s=(a||[]).filter((function(e){return n.findIndex((function(t){return t.value==e}))>=0}));s.length!==(null==a?void 0:a.length)&&t.setValue(s,{onlySelf:!0,emitEvent:!1})}else{n.find((function(e){return e.value==a}))||t.setValue(null!==(i=null===(o=n[0])||void 0===o?void 0:o.value)&&void 0!==i?i:null,{onlySelf:!0,emitEvent:!1})}}}))},t}(M);function I(e){return"string"==typeof e&&e.length>0}function N(e,t){if(!e||!t(e))return[];for(var n=[],r=e;r;){var o=t(r);o&&n.unshift(o),r=r.parent}return n}var R=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.additional=t.additional||{},r}return D(t,e),t}(i.DynamicFormArrayModel),V=function(e){function a(t,n,o,i){var a=e.call(this,t,n)||this;return a.openApi=o,a.injector=i,a.onDetectChanges=new r.EventEmitter,a}return D(a,e),Object.defineProperty(a.prototype,"api",{get:function(){return this.openApi.api},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"language",{get:function(){return this.api.language},enumerable:!1,configurable:!0}),a.prototype.patchGroup=function(e,n,r){this.patchValueRecursive(e,n,r),this.detectChanges(),r.patchValue(t.ObjectUtils.copy(e))},a.prototype.patchForm=function(e,t){this.patchValueRecursive(e,t.model,t.group),this.detectChanges(t),t.group.patchValue(e)},a.prototype.serialize=function(e,t){return this.serializeRecursive(e,t)},a.prototype.notifyChanges=function(e,t){this.notifyChangesRecursive(e,t)},a.prototype.updateSelectOptions=function(e,t){if(e instanceof i.DynamicSelectModel){var r=e.options$;if(r instanceof M)return void r.notify(e,t);for(;r instanceof n.Subject&&r.source;)(r=r.source)instanceof M&&r.notify(e,t)}},a.prototype.showErrors=function(e){this.showErrorsForGroup(e.group),this.detectChanges(e)},a.prototype.detectChanges=function(t){e.prototype.detectChanges.call(this,t),this.onDetectChanges.emit(t)},a.prototype.patchValueRecursive=function(e,n,r){var o=this;Object.keys(e).forEach((function(a){var s=o.findModelById(a,n),u=e[a];if(s){var c=o.findControlByModel(s,r);if(s instanceof i.DynamicSelectModel&&t.ObjectUtils.isObject(u))e[a]=u.id||u._id||u;else if(s instanceof i.DynamicFormArrayModel){for(var l=Array.isArray(u)?u.length:0,p=c;s.size>l;)o.removeFormArrayGroup(0,p,s);for(;s.size<l;)o.insertFormArrayGroup(s.size,p,s);for(var m=0;m<l;m++){var f=s.get(m);o.patchValueRecursive(u[m],f.group,p.at(m))}}else s instanceof i.DynamicFormGroupModel&&o.patchValueRecursive(u,s.group,c)}}))},a.prototype.serializeRecursive=function(e,n){var r,o;return O(this,void 0,void 0,(function(){var a,s,u,c,l,p,m,f,h,y,d,g,v,b,C,S,F,D,O;return A(this,(function(A){switch(A.label){case 0:if(a={},!e||!n||!n.value)return[2,a];for(u in s=[],e)s.push(u);c=0,A.label=1;case 1:return c<s.length?(l=s[c],p=e[l],m=this.findControlByModel(p,n),f=null===(r=p.additional)||void 0===r?void 0:r.serializer,t.ObjectUtils.isFunction(f)?(h=a,y=p.id,[4,f(p,m)]):[3,3]):[3,12];case 2:return h[y]=A.sent(),[3,11];case 3:if(!(p instanceof i.DynamicFormArrayModel))return[3,8];d=Array.isArray(m.value)?m.value.length:0,g=m,v=[],b=0,A.label=4;case 4:return b<d?(C=p.get(b),F=(S=v).push,[4,this.serializeRecursive(C.group,g.at(b))]):[3,7];case 5:F.apply(S,[A.sent()]),A.label=6;case 6:return b++,[3,4];case 7:return a[p.id]=v,[3,11];case 8:return p instanceof i.DynamicFormGroupModel?(D=a,O=p.id,[4,this.serializeRecursive(p.group,m)]):[3,10];case 9:return D[O]=A.sent(),[3,11];case 10:if(p instanceof i.DynamicInputModel&&!t.ObjectUtils.isNullOrUndefined(m.value))return a[p.id]="number"==p.inputType?null!==(o=parseFloat((""+m.value||"0").replace(/,/gi,".")))&&void 0!==o?o:null:m.value,[3,11];a[p.id]=m.value,A.label=11;case 11:return c++,[3,1];case 12:return[2,a]}}))}))},a.prototype.notifyChangesRecursive=function(e,t){if(e&&t)for(var n in e){var r=e[n],o=this.findControlByModel(r,t);if(r instanceof i.DynamicFormArrayModel)for(var a=Array.isArray(o.value)?o.value.length:0,s=o,u=0;u<a;u++){var c=r.get(u);this.notifyChangesRecursive(c.group,s.at(u))}else r instanceof i.DynamicFormGroupModel?this.notifyChangesRecursive(r.group,o):this.updateSelectOptions(r,o)}},a.prototype.showErrorsForGroup=function(e){if(e){e.markAsTouched({onlySelf:!0});var t=Object.keys(e.controls).map((function(t){return e.controls[t]}));this.showErrorsForControls(t)}},a.prototype.showErrorsForControls=function(e){var t=this;e.forEach((function(e){e instanceof o.FormGroup?t.showErrorsForGroup(e):(e.markAsTouched({onlySelf:!0}),e instanceof o.FormArray&&t.showErrorsForControls(e.controls))}))},a.prototype.getFormModelForSchema=function(e,n){return O(this,void 0,void 0,(function(){var r,o,i=this;return A(this,(function(a){switch(a.label){case 0:return this.api.cache={},r=this,[4,this.openApi.getSchemas()];case 1:return r.schemas=a.sent(),o=function(e,r,o,a){var s=new o(a);if(!t.ObjectUtils.isFunction(n))return[s];var u=n(e,r,s,a,i.injector);return Array.isArray(u)?u:[u]},[2,this.getFormModelForSchemaDef(this.schemas[e],o)]}}))}))},a.prototype.getFormModelForSchemaDef=function(e,t){var n,r;if(!e)return[];var o=Object.keys(e.properties||{}),i=[];try{for(var a=w(o),s=a.next();!s.done;s=a.next()){var u=s.value,c=e.properties[u];i.push.apply(i,x(this.getFormControlModels(c,e,t)))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i.filter((function(e){return null!==e}))},a.prototype.getFormControlModels=function(e,t,n){var r,o,a=(null===(r=e.items)||void 0===r?void 0:r.enum)||e.enum;if(Array.isArray(a)||I(e.optionsPath)||I(e.endpoint))return n(e,t,i.DynamicSelectModel,this.getFormSelectConfig(e,t));switch(e.type){case"string":case"number":case"integer":return n(e,t,i.DynamicInputModel,this.getFormInputConfig(e,t));case"textarea":return n(e,t,i.DynamicTextAreaModel,this.getFormTextareaConfig(e,t));case"boolean":return n(e,t,i.DynamicCheckboxModel,this.getFormCheckboxConfig(e,t));case"array":return(null===(o=e.items)||void 0===o?void 0:o.$ref)||e.$ref?n(e,t,R,this.getFormArrayConfig(e,t,n)):n(e,t,i.DynamicInputModel,this.getFormInputConfig(e,t));case"file":return n(e,t,i.DynamicFileUploadModel,this.getFormUploadConfig(e,t))}return e.$ref?n(e,t,i.DynamicFormGroupModel,this.getFormGroupConfig(e,t,n)):[]},a.prototype.getFormControlConfig=function(e,n){var r=this.getValidators(e,n),o=Object.keys(r).reduce((function(e,t){return e[t]="error."+t,e}),{});return{id:e.id,label:t.ObjectUtils.isString(e.label)?e.label:e.id,hidden:e.hidden,disabled:e.disabled,validators:r,errorMessages:o,additional:Object.assign({},e)}},a.prototype.getFormArrayConfig=function(e,t,n){var r,o=this,i=(null===(r=e.items)||void 0===r?void 0:r.$ref)||e.$ref||"",a=this.schemas[i.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{groupFactory:function(){return o.getFormModelForSchemaDef(a,n)}})},a.prototype.getFormGroupConfig=function(e,t,n){var r=e.$ref||"",o=this.schemas[r.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{group:this.getFormModelForSchemaDef(o,n)})},a.prototype.getFormInputConfig=function(e,n){var r,o=t.StringUtils.has(e.id,"password","Password")?"password":e.format||(null===(r=e.items)||void 0===r?void 0:r.type)||e.type;switch(o){case"boolean":o="checkbox";break;case"textarea":o="textarea";break;case"integer":o="number"}var i="array"==e.type&&e.items||e;return Object.assign(this.getFormControlConfig(e,n),{inputType:o,autoComplete:e.autoComplete||"off",multiple:"array"==e.type,accept:t.ObjectUtils.isString(e.accept)?e.accept:null,mask:t.ObjectUtils.isString(e.mask)?e.mask:null,pattern:t.ObjectUtils.isString(e.pattern)?e.pattern:null,step:isNaN(i.step)?isNaN(e.step)?1:e.step:i.step,min:isNaN(i.minimum)?Number.MIN_SAFE_INTEGER:i.minimum,max:isNaN(i.maximum)?Number.MAX_SAFE_INTEGER:i.maximum,minLength:isNaN(i.minLength)?Number.MIN_SAFE_INTEGER:i.minLength,maxLength:isNaN(i.maxLength)?Number.MAX_SAFE_INTEGER:i.maxLength,placeholder:e.placeholder||""})},a.prototype.getFormTextareaConfig=function(e,t){return Object.assign(this.getFormControlConfig(e,t),{cols:e.cols||null,rows:e.rows||10,wrap:e.wrap||!1,autoComplete:e.autoComplete||"off",multiple:"array"==e.type})},a.prototype.getFormSelectConfig=function(e,t){return Object.assign(this.getFormControlConfig(e,t),{options:this.getFormSelectOptions(e,t),multiple:"array"==e.type})},a.prototype.getFormCheckboxConfig=function(e,t){return Object.assign(this.getFormControlConfig(e,t),{indeterminate:!0===e.indeterminate})},a.prototype.translateOptions=function(e){return O(this,void 0,void 0,(function(){var t,n,r,o,i,a,s;return A(this,(function(u){switch(u.label){case 0:if(!e)return[2,[]];u.label=1;case 1:u.trys.push([1,6,7,8]),t=w(e),n=t.next(),u.label=2;case 2:return n.done?[3,5]:(r=n.value,o=r,[4,this.language.getTranslation(r.label)]);case 3:o.label=u.sent(),u.label=4;case 4:return n=t.next(),[3,2];case 5:return[3,8];case 6:return i=u.sent(),a={error:i},[3,8];case 7:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 8:return[2,e]}}))}))},a.prototype.getFormSelectOptions=function(e,n){var r,o=this,i=(null===(r=e.items)||void 0===r?void 0:r.enum)||e.enum;return Array.isArray(i)?new j((function(){var t=i.map((function(t){return{value:t,label:e.translatable?e.id+"."+t:""+t}}));return o.translateOptions(t)})):I(e.optionsPath)?new j((function(n,r,i){var a=e.optionsPath,s=r;if(a.startsWith("$root"))for(a=a.substr(5);s.parent;)s=s.parent;for(;a.startsWith(".");)a=a.substr(1),s.parent&&(s=s.parent);var u=t.ObjectUtils.getValue(s.value,a.replace(/\$ix/gi,i)),c=(t.ObjectUtils.isArray(u)?u:[]).map((function(e){return{value:e,label:e}}));return o.translateOptions(c)})):new j((function(){return O(o,void 0,void 0,(function(){var t;return A(this,(function(n){switch(n.label){case 0:return this.api.cache[e.endpoint]=this.api.cache[e.endpoint]||this.api.list(e.endpoint,this.api.makeListParams(1,-1)).then((function(t){return t.items.map((function(t){return{value:t.id||t._id,label:t[e.labelField]||t.label||t.id||t._id}}))})),[4,this.api.cache[e.endpoint]];case 1:return t=n.sent().map((function(e){return Object.assign({},e)})),[2,this.translateOptions(t)]}}))}))}))},a.prototype.getFormUploadConfig=function(e,t){var n=this.api.url(e.url||"assets"),r=e.accept,o=e.autoUpload,i=e.maxSize,a=e.minSize,s=e.removeUrl,u=e.showFileList;return Object.assign(this.getFormControlConfig(e,t),{url:n,accept:r,autoUpload:o,maxSize:i,minSize:a,removeUrl:s,showFileList:u})},a.prototype.getValidators=function(e,n){var r={};return t.ObjectUtils.isArray(n.required)&&n.required.indexOf(e.id)>=0&&(r.required=null),this.addPropertyValidators(r,e),this.addItemsValidators(r,e.items),r},a.prototype.addPropertyValidators=function(e,t){if(t&&(isNaN(t.minLength)||(e.minLength=t.minLength),isNaN(t.maxLength)||(e.maxLength=t.maxLength),isNaN(t.minimum)||(e.min=t.minimum),isNaN(t.maximum)||(e.max=t.maximum),"email"===t.format))e.email=null},a.prototype.addItemsValidators=function(e,t){t&&(isNaN(t.minLength)||(e.itemsMinLength=t.minLength),isNaN(t.maxLength)||(e.itemsMaxLength=t.maxLength),isNaN(t.minimum)||(e.itemsMinValue=t.minimum),isNaN(t.maximum)||(e.itemsMaxValue=t.maximum))},a}(i.DynamicFormService);V.decorators=[{type:r.Injectable}],V.ctorParameters=function(){return[{type:i.DynamicFormComponentService},{type:i.DynamicFormValidationService},{type:t.OpenApiService,decorators:[{type:r.Inject,args:[t.OpenApiService]}]},{type:r.Injector,decorators:[{type:r.Inject,args:[r.Injector]}]}]};var T=function(){function e(e,t,n,o){this.toaster=e,this.cdr=t,this.elem=n,this.renderer=o,this.onSuccess=new r.EventEmitter,this.onError=new r.EventEmitter,"BUTTON"===n.nativeElement.tagName&&o.setAttribute(n.nativeElement,"type","button")}return Object.defineProperty(e.prototype,"isDisabled",{get:function(){return this.disabled},set:function(e){this.disabled=e,e?this.renderer.setAttribute(this.elem.nativeElement,"disabled","disabled"):this.renderer.removeAttribute(this.elem.nativeElement,"disabled")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this.loading},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.form&&(this.isDisabled="VALID"!==this.form.status,this.cdr.detectChanges(),this.onStatusChange=this.form.onStatusChange.subscribe((function(){e.isDisabled="VALID"!==e.form.status,e.cdr.detectChanges(),e.callback&&"PENDING"!=e.form.status&&(e.disabled||e.callback(),e.callback=null)})),this.onSubmit=this.form.onSubmit.subscribe((function(){return e.callMethod()})))},e.prototype.ngOnDestroy=function(){this.onStatusChange&&this.onStatusChange.unsubscribe(),this.onSubmit&&this.onSubmit.unsubscribe()},e.prototype.click=function(){var e=this;this.callback=function(){return e.callMethod()},"VALID"!==this.form.status&&"INVALID"!==this.form.status||(this.callback(),this.callback=null)},e.prototype.callMethod=function(){var e=this;this.loading||(this.loading=!0,this.method(this.form,this.context).then((function(t){e.loading=!1,t&&(e.onSuccess.emit(t),e.toaster.success(t.message,t.context))}),(function(t){if(!t||!t.message)throw new Error("Reason must implement IAsyncMessage interface");e.loading=!1,e.onError.emit(t),e.toaster.error(t.message,t.context)})))},e}();T.decorators=[{type:r.Directive,args:[{selector:"[async-submit]",exportAs:"async-submit"}]}],T.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[t.TOASTER_SERVICE]}]},{type:r.ChangeDetectorRef},{type:r.ElementRef},{type:r.Renderer2}]},T.propDecorators={method:[{type:r.Input,args:["async-submit"]}],form:[{type:r.Input}],context:[{type:r.Input}],onSuccess:[{type:r.Output}],onError:[{type:r.Output}],isDisabled:[{type:r.HostBinding,args:["class.disabled"]}],isLoading:[{type:r.HostBinding,args:["class.loading"]}],click:[{type:r.HostListener,args:["click"]}]};var L=function(e){function o(t,o,i,a){var s=e.call(this,i,a)||this;return s.formService=t,s.events=o,s.blur=new r.EventEmitter,s.change=new r.EventEmitter,s.focus=new r.EventEmitter,s.onStatusChange=new r.EventEmitter,s.onValueChange=new r.EventEmitter,s.onSubmit=new r.EventEmitter,s.templates=new r.QueryList,s.subscription=new n.Subscription,s.groupSubscription=new n.Subscription,s.labelPrefix="label",s}return D(o,e),Object.defineProperty(o.prototype,"status",{get:function(){return this.group?this.group.status:null},enumerable:!1,configurable:!0}),o.prototype.ngOnChanges=function(e){var n=this;this.groupSubscription.unsubscribe(),this.group&&(this.groupSubscription=t.ObservableUtils.multiSubscription(this.group.statusChanges.subscribe((function(){n.onStatusChange.emit(n)})),this.group.valueChanges.subscribe((function(){n.onValueChange.emit(n),n.formService.notifyChanges(n.model,n.group)}))))},o.prototype.ngAfterViewInit=function(){var e=this;this.subscription=t.ObservableUtils.multiSubscription(t.ObservableUtils.subscribe({subjects:[this.contentTemplates.changes,this.viewTemplates.changes],cb:function(){var t=e.contentTemplates.toArray().concat(e.viewTemplates.toArray());e.templates.reset(t)}}),this.events.languageChanged.subscribe((function(){e.formService.detectChanges(e)})),this.ngForm.ngSubmit.subscribe((function(){e.onSubmit.emit(e)})))},o.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.subscription.unsubscribe(),this.groupSubscription.unsubscribe()},o.prototype.insertFormArrayGroup=function(e,t,n){this.formService.insertFormArrayGroup(e,t,n),this.changeDetectorRef.detectChanges()},o.prototype.removeFormArrayGroup=function(e,t,n){this.formService.removeFormArrayGroup(e,t,n),this.changeDetectorRef.detectChanges()},o.prototype.moveFormArrayGroup=function(e,t,n,r){this.formService.moveFormArrayGroup(e,t,n,r),this.changeDetectorRef.detectChanges()},o.prototype.clearFormArray=function(e,t){this.formService.clearFormArray(e,t),this.changeDetectorRef.detectChanges()},o.prototype.getClass=function(e){var t=N(e,(function(e){return e.id}));return 0==t.length?"":e instanceof i.DynamicFormGroupModel?"form-group-"+t.join("-"):"form-control-"+t.join("-")},o.prototype.validate=function(e){var t=this;return void 0===e&&(e=!0),this.group?new Promise((function(n,r){t.group.statusChanges.pipe(a.first((function(e){return"VALID"==e||"INVALID"==e}))).subscribe((function(o){e&&t.formService.showErrors(t),"VALID"!=o?r(null):n(null)})),t.group.updateValueAndValidity()})):Promise.resolve()},o.prototype.serialize=function(e){return O(this,void 0,void 0,(function(){return A(this,(function(t){switch(t.label){case 0:return this.group?e?[4,this.validate()]:[3,2]:[2,null];case 1:t.sent(),t.label=2;case 2:return[4,this.formService.serialize(this.model,this.group)];case 3:return[2,t.sent()]}}))}))},o}(i.DynamicFormComponent);L.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form",template:"",changeDetection:r.ChangeDetectionStrategy.Default}]}],L.ctorParameters=function(){return[{type:V,decorators:[{type:r.Inject,args:[V]}]},{type:t.EventsService,decorators:[{type:r.Inject,args:[t.EventsService]}]},{type:r.ChangeDetectorRef},{type:i.DynamicFormComponentService}]},L.propDecorators={group:[{type:r.Input}],model:[{type:r.Input}],layout:[{type:r.Input}],labelPrefix:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],focus:[{type:r.Output}],contentTemplates:[{type:r.ContentChildren,args:[i.DynamicTemplateDirective]}],viewTemplates:[{type:r.ViewChildren,args:[i.DynamicTemplateDirective]}],onStatusChange:[{type:r.Output}],onValueChange:[{type:r.Output}],onSubmit:[{type:r.Output}],ngForm:[{type:r.ViewChild,args:[o.NgForm]}]};var P=function(e){function t(t,n){var o=e.call(this,t,n)||this;return o.layoutService=t,o.validationService=n,o.blur=new r.EventEmitter,o.change=new r.EventEmitter,o.customEvent=new r.EventEmitter,o.focus=new r.EventEmitter,o}return D(t,e),t.prototype.getClass=function(t,n,r){return["element"==t?this.getModelClass(r):null,e.prototype.getClass.call(this,t,n,r)].filter((function(e){return!!e})).join(" ")},t.prototype.getModelClass=function(e){var t=N(e,(function(e){return e.id}));return 0==t.length?"":e instanceof i.DynamicFormGroupModel?"form-group-"+t.join("-"):"form-control-"+t.join("-")},t}(i.DynamicFormArrayComponent);P.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-array",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],P.ctorParameters=function(){return[{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService}]},P.propDecorators={formLayout:[{type:r.Input}],group:[{type:r.Input}],layout:[{type:r.Input}],model:[{type:r.Input}],templates:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],customEvent:[{type:r.Output}],focus:[{type:r.Output}],components:[{type:r.ViewChildren,args:[r.forwardRef((function(){return i.DynamicFormControlContainerComponent}))]}]};var _=function(e){function n(t,n,o,i,a,s,u){var c=e.call(this,n,o,i,a,s,u)||this;return c.form=t,c.changeDetectorRef=n,c.componentFactoryResolver=o,c.layoutService=i,c.validationService=a,c.componentService=s,c.relationService=u,c.context=null,c.blur=new r.EventEmitter,c.change=new r.EventEmitter,c.focus=new r.EventEmitter,c}return D(n,e),Object.defineProperty(n.prototype,"componentType",{get:function(){var e;return null!==(e=this.componentService.getCustomComponentType(this.model))&&void 0!==e?e:this.getComponentType(this.model)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"startTemplate",{get:function(){return this.model.type==i.DYNAMIC_FORM_CONTROL_TYPE_ARRAY?this.layoutService.getAlignedTemplate(this.model,this.templates,"ARRAY_START"):this.layoutService.getStartTemplate(this.model,this.templates)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"endTemplate",{get:function(){return this.model.type==i.DYNAMIC_FORM_CONTROL_TYPE_ARRAY?this.layoutService.getAlignedTemplate(this.model,this.templates,"ARRAY_END"):this.layoutService.getEndTemplate(this.model,this.templates)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"formService",{get:function(){return this.form.formService},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var e=this;this.onDetectChanges=this.formService.onDetectChanges.subscribe((function(t){t===e.form&&(e.changeDetectorRef.detectChanges(),e.formService.updateSelectOptions(e.model,e.control))}))},n.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.onDetectChanges.unsubscribe()},n.prototype.getLabel=function(){var e,t=N(this.model,(function(e){return e.label}));return 0==t.length?"":((null===(e=this.form)||void 0===e?void 0:e.labelPrefix)&&t.unshift(this.form.labelPrefix),t.join("."))},n.prototype.createFormControlComponent=function(){var n;e.prototype.createFormControlComponent.call(this);var r=null===(n=this.componentRef)||void 0===n?void 0:n.instance;r&&t.ObjectUtils.isFunction(r.onCreated)&&r.onCreated()},n.prototype.getComponentType=function(e){return null},n}(i.DynamicFormControlContainerComponent);_.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-control",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],_.ctorParameters=function(){return[{type:L},{type:r.ChangeDetectorRef},{type:r.ComponentFactoryResolver},{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService},{type:i.DynamicFormComponentService},{type:i.DynamicFormRelationService}]},_.propDecorators={contentTemplateList:[{type:r.ContentChildren,args:[i.DynamicTemplateDirective]}],klass:[{type:r.HostBinding,args:["class"]}],context:[{type:r.Input}],group:[{type:r.Input}],hostClass:[{type:r.Input}],inputTemplateList:[{type:r.Input,args:["templates"]}],layout:[{type:r.Input}],model:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],focus:[{type:r.Output}],componentViewContainerRef:[{type:r.ViewChild,args:["componentViewContainer",{read:r.ViewContainerRef,static:!0}]}]};var k=function(e){function t(t,n){var o=e.call(this,t,n)||this;return o.layoutService=t,o.validationService=n,o.blur=new r.EventEmitter,o.change=new r.EventEmitter,o.customEvent=new r.EventEmitter,o.focus=new r.EventEmitter,o}return D(t,e),t.prototype.getClass=function(t,n,r){return["element"==t?this.getModelClass(r):null,e.prototype.getClass.call(this,t,n,r)].filter((function(e){return!!e})).join(" ")},t.prototype.getModelClass=function(e){var t=N(e,(function(e){return e.id}));return 0==t.length?"":e instanceof i.DynamicFormGroupModel?"form-group-"+t.join("-"):"form-control-"+t.join("-")},t}(i.DynamicFormGroupComponent);k.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-group",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],k.ctorParameters=function(){return[{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService}]},k.propDecorators={formLayout:[{type:r.Input}],group:[{type:r.Input}],layout:[{type:r.Input}],model:[{type:r.Input}],templates:[{type:r.Input}],blur:[{type:r.Output}],change:[{type:r.Output}],customEvent:[{type:r.Output}],focus:[{type:r.Output}],components:[{type:r.ViewChildren,args:[r.forwardRef((function(){return i.DynamicFormControlContainerComponent}))]}]};var U=[L,P,_,k],G=[T],z=[],q=y,B=d,$=v,Y=b,H=C,J=S,W=new Map([["json",y],["requiredTranslation",d],["phone",g],["itemsMinLength",v],["itemsMaxLength",b],["itemsMinValue",C],["itemsMaxValue",S]]),X=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[V,{provide:i.DynamicFormService,useExisting:V}]}},e}();X.decorators=[{type:r.NgModule,args:[{declarations:x(U,G,z),imports:[s.CommonModule,o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule],exports:x(U,G,z,[o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule]),entryComponents:U,providers:x(z,[{provide:o.NG_VALIDATORS,useValue:q,multi:!0},{provide:o.NG_VALIDATORS,useValue:B,multi:!0},{provide:o.NG_VALIDATORS,useValue:$,multi:!0},{provide:o.NG_VALIDATORS,useValue:Y,multi:!0},{provide:o.NG_VALIDATORS,useValue:H,multi:!0},{provide:o.NG_VALIDATORS,useValue:J,multi:!0},{provide:i.DYNAMIC_VALIDATORS,useValue:W}])}]}],e.AsyncSubmitDirective=T,e.DynamicBaseFormArrayComponent=P,e.DynamicBaseFormComponent=L,e.DynamicBaseFormControlContainerComponent=_,e.DynamicBaseFormGroupComponent=k,e.DynamicFormService=V,e.FormFile=function(e){return function(n,r){c(n,r,function(e,n){var r=l(e,"file",n);return(n=r.config).accept=n.accept||["jpg","jpeg","png"],n.multiple=n.multiple||!1,n.url=t.ObjectUtils.isString(n.url)?n.url:"assets",r}(r,e))}},e.FormInput=function(e){return function(n,r){var o=t.ReflectUtils.getOwnMetadata("design:type",n,r),i=o?o.name:"",a=r.indexOf("password")<0?"text":"password";switch(i){case"Number":a="number";break;case"Boolean":a="checkbox"}c(n,r,p(r,e,a))}},e.FormModel=function(e){return function(t,n){c(t,n,h(n,e))}},e.FormSelect=function(e){return function(t,n){c(t,n,m(n,e))}},e.FormSelectSubject=j,e.FormSerializable=function(e){return function(n,r){t.ReflectUtils.defineMetadata("dynamicFormSerializer",e||u,n,r)}},e.FormStatic=function(e){return function(t,n){c(t,n,f(n,e))}},e.FormSubject=M,e.NgxDynamicFormModule=X,e.createFormControl=l,e.createFormInput=p,e.createFormModel=h,e.createFormSelect=m,e.createFormStatic=f,e.defaultSerializer=u,e.defineFormControl=c,e.getFormControl=function(e,n){return t.ReflectUtils.getMetadata("dynamicFormControl",e,n)},e.getFormSerializer=function(e,n){return t.ReflectUtils.getMetadata("dynamicFormSerializer",e,n)},e.validateItemsMaxLength=b,e.validateItemsMaxValue=S,e.validateItemsMinLength=v,e.validateItemsMinValue=C,e.validateJSON=y,e.validatePhone=g,e.validateRequiredTranslation=d,e.ɵa=U,e.ɵb=G,e.ɵc=z,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=stemy-ngx-dynamic-form.umd.min.js.map