@stemy/ngx-dynamic-form 10.2.27 → 10.2.28

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.
Files changed (26) hide show
  1. package/bundles/stemy-ngx-dynamic-form.umd.js +141 -18
  2. package/bundles/stemy-ngx-dynamic-form.umd.js.map +1 -1
  3. package/bundles/stemy-ngx-dynamic-form.umd.min.js +1 -1
  4. package/bundles/stemy-ngx-dynamic-form.umd.min.js.map +1 -1
  5. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-array.component.js +53 -0
  6. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-control-container.component.js +13 -2
  7. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-group.component.js +53 -0
  8. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form.component.js +12 -2
  9. package/esm2015/ngx-dynamic-form/ngx-dynamic-form.module.js +8 -10
  10. package/esm2015/ngx-dynamic-form/utils/misc.js +15 -1
  11. package/esm2015/public_api.js +3 -1
  12. package/esm2015/stemy-ngx-dynamic-form.js +1 -2
  13. package/fesm2015/stemy-ngx-dynamic-form.js +138 -17
  14. package/fesm2015/stemy-ngx-dynamic-form.js.map +1 -1
  15. package/ngx-dynamic-form/components/base/dynamic-base-form-array.component.d.ts +20 -0
  16. package/ngx-dynamic-form/components/base/dynamic-base-form-control-container.component.d.ts +1 -0
  17. package/ngx-dynamic-form/components/base/dynamic-base-form-group.component.d.ts +20 -0
  18. package/ngx-dynamic-form/components/base/dynamic-base-form.component.d.ts +2 -1
  19. package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +3 -1
  20. package/ngx-dynamic-form/utils/misc.d.ts +2 -0
  21. package/package.json +1 -1
  22. package/public_api.d.ts +2 -0
  23. package/stemy-ngx-dynamic-form.d.ts +0 -1
  24. package/stemy-ngx-dynamic-form.metadata.json +1 -1
  25. package/esm2015/ngx-dynamic-form/services/dynamic-form-validation.service.js +0 -11
  26. package/ngx-dynamic-form/services/dynamic-form-validation.service.d.ts +0 -5
@@ -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,r,n,o,i,a,s){"use strict";var u=[],l=function(){return Promise.resolve(!1)};function c(e,t){var r=t.get(e);return r?r.value:null}function p(e,r,n){t.ReflectUtils.defineMetadata("dynamicFormControl",n,e,r)}function m(e){return t.ReflectUtils.getMetadata("dynamicFormFieldSets",e)||{}}function f(e,r,n){return(n=n||{}).label=t.ObjectUtils.isNullOrUndefined(n.label)?e:n.label,n.labelAlign=n.labelAlign||"left",n.fieldSet=n.fieldSet||t.UniqueUtils.uuid(),n.classes=n.classes||"",n.readonly=n.readonly||l,n.hidden=n.hidden||l,n.validators=n.validators||u,{id:e,type:r,data:n}}function h(e,t,r){void 0===r&&(r="text");var n=f(e,"input",t);return(t=n.data).type=t.type||r,t.classes=t.classes?t.classes+" form-group-"+t.type:"form-group-"+t.type,t.placeholder=t.placeholder||("mask"==t.type?"_":""),t.step=t.step||1,t.mask=t.mask||[/\w*/gi],n}function d(e,t){var r=f(e,"select",t);(t=r.data).options=t.options||[],t.type=t.type||"select";var n="select"==t.type?"select":"select-"+t.type;return t.classes=t.classes?t.classes+" form-group-"+n:"form-group-"+n,r}function y(e,t){var r=f(e,"static",t);return(t=r.data).style=t.style||"table",r}function g(e,t){var r=f(e,"model",t);return(t=r.data).name=t.name||"",r}function v(e){var t=e.value;if(!t)return null;try{return JSON.parse(t),null}catch(e){return{json:!0}}}function b(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 S(e){var t=e.value;if(!t)return Promise.resolve(null);return/^(?:\d){10,12}$/.test(t)?null:{phone:!0}}function C(e){return function(t){var r=t.value;return Array.isArray(r)&&r.every((function(t){return"string"==typeof t&&t.length>=e}))?null:{itemsMinLength:e}}}function F(e){return function(t){var r=t.value;return Array.isArray(r)&&r.every((function(t){return"string"==typeof t&&t.length<=e}))?null:{itemsMaxLength:e}}}function O(e){return function(t){var r=t.value;return Array.isArray(r)&&r.every((function(t){return"number"==typeof t&&t>=e}))?null:{itemsMinValue:e}}}function A(e){return function(t){var r=t.value;return Array.isArray(r)&&r.every((function(t){return"number"==typeof t&&t<=e}))?null:{itemsMaxValue:e}}}var D=function(e,t){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},D(e,t)};function w(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}D(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function x(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function M(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}Object.create;function E(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function N(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function R(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(N(arguments[t]));return e}Object.create;var j=function(e){function t(t){var r=e.call(this)||this;return r.notifyCallback=t,r}return w(t,e),t.prototype.handleNotifiedValue=function(e,t,r){var n=this;r.then((function(e){return n.next(e)}))},t.prototype.notify=function(e,t){for(var r=e;r&&isNaN(r.index);)r=r.parent;var n=this.notifyCallback(e,t,null==r?void 0:r.index);n instanceof Promise||(n=Promise.resolve(n)),this.handleNotifiedValue(e,t,n)},t}(r.Subject),I=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t.prototype.handleNotifiedValue=function(e,t,r){var n=this;r.then((function(r){var o,i;n.next(r);var a=t.value;if(e.multiple){var s=(a||[]).filter((function(e){return r.findIndex((function(t){return t.value==e}))>=0}));s.length!==(null==a?void 0:a.length)&&t.setValue(s,{onlySelf:!0,emitEvent:!1})}else{r.find((function(e){return e.value==a}))||t.setValue(null!==(i=null===(o=r[0])||void 0===o?void 0:o.value)&&void 0!==i?i:null,{onlySelf:!0,emitEvent:!1})}}))},t}(j);function V(e){return"string"==typeof e&&e.length>0}var T=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.additional=t.additional||{},n}return w(t,e),t}(i.DynamicFormArrayModel),L=function(e){function a(t,r,o){var i=e.call(this,t,r)||this;return i.openApi=o,i.onDetectChanges=new n.EventEmitter,i}return w(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,r,n){this.patchValueRecursive(e,r,n),this.detectChanges(),n.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 n=e.options$;if(n instanceof j)return void n.notify(e,t);for(;n instanceof r.Subject&&n.source;)(n=n.source)instanceof j&&n.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,r,n){var o=this;Object.keys(e).forEach((function(a){var s=o.findModelById(a,r),u=e[a];if(s){var l=o.findControlByModel(s,n);if(s instanceof i.DynamicSelectModel&&t.ObjectUtils.isObject(u))e[a]=u.id||u._id||u;else if(s instanceof i.DynamicFormArrayModel){for(var c=Array.isArray(u)?u.length:0,p=l;s.size>c;)o.removeFormArrayGroup(0,p,s);for(;s.size<c;)o.insertFormArrayGroup(s.size,p,s);for(var m=0;m<c;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,l)}}))},a.prototype.serializeRecursive=function(e,r){var n,o;return x(this,void 0,void 0,(function(){var a,s,u,l,c,p,m,f,h,d,y,g,v,b,S,C,F,O,A;return M(this,(function(D){switch(D.label){case 0:if(a={},!e||!r||!r.value)return[2,a];for(u in s=[],e)s.push(u);l=0,D.label=1;case 1:return l<s.length?(c=s[l],p=e[c],m=this.findControlByModel(p,r),f=null===(n=p.additional)||void 0===n?void 0:n.serializer,t.ObjectUtils.isFunction(f)?(h=a,d=p.id,[4,f(p,m)]):[3,3]):[3,12];case 2:return h[d]=D.sent(),[3,11];case 3:if(!(p instanceof i.DynamicFormArrayModel))return[3,8];y=Array.isArray(m.value)?m.value.length:0,g=m,v=[],b=0,D.label=4;case 4:return b<y?(S=p.get(b),F=(C=v).push,[4,this.serializeRecursive(S.group,g.at(b))]):[3,7];case 5:F.apply(C,[D.sent()]),D.label=6;case 6:return b++,[3,4];case 7:return a[p.id]=v,[3,11];case 8:return p instanceof i.DynamicFormGroupModel?(O=a,A=p.id,[4,this.serializeRecursive(p.group,m)]):[3,10];case 9:return O[A]=D.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,D.label=11;case 11:return l++,[3,1];case 12:return[2,a]}}))}))},a.prototype.notifyChangesRecursive=function(e,t){if(e&&t)for(var r in e){var n=e[r],o=this.findControlByModel(n,t);if(n instanceof i.DynamicFormArrayModel)for(var a=Array.isArray(o.value)?o.value.length:0,s=o,u=0;u<a;u++){var l=n.get(u);this.notifyChangesRecursive(l.group,s.at(u))}else n instanceof i.DynamicFormGroupModel?this.notifyChangesRecursive(n.group,o):this.updateSelectOptions(n,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){return x(this,void 0,void 0,(function(){var t;return M(this,(function(r){switch(r.label){case 0:return this.api.cache={},t=this,[4,this.openApi.getSchemas()];case 1:return t.schemas=r.sent(),[2,this.getFormModelForSchemaDef(this.schemas[e])]}}))}))},a.prototype.getFormModelForSchemaDef=function(e){var t=this;return e?Object.keys(e.properties||{}).map((function(r){var n=e.properties[r];return t.getFormControlModel(n,e)})).filter((function(e){return null!==e})):[]},a.prototype.getFormControlModel=function(e,t){var r,n,o=(null===(r=e.items)||void 0===r?void 0:r.enum)||e.enum;if(Array.isArray(o)||V(e.optionsPath)||V(e.endpoint))return new i.DynamicSelectModel(this.getFormSelectConfig(e,t));switch(e.type){case"string":case"number":case"integer":return new i.DynamicInputModel(this.getFormInputConfig(e,t));case"textarea":return new i.DynamicTextAreaModel(this.getFormTextareaConfig(e,t));case"boolean":return new i.DynamicCheckboxModel(this.getFormCheckboxConfig(e,t));case"array":return(null===(n=e.items)||void 0===n?void 0:n.$ref)||e.$ref?new T(this.getFormArrayConfig(e,t)):new i.DynamicInputModel(this.getFormInputConfig(e,t));case"file":return new i.DynamicFileUploadModel(this.getFormUploadConfig(e,t))}return e.$ref?new i.DynamicFormGroupModel(this.getFormGroupConfig(e,t)):null},a.prototype.getFormControlConfig=function(e,r){var n=this.getValidators(e,r),o=Object.keys(n).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:n,errorMessages:o,additional:Object.assign({},e)}},a.prototype.getFormArrayConfig=function(e,t){var r,n=this,o=(null===(r=e.items)||void 0===r?void 0:r.$ref)||e.$ref||"",i=this.schemas[o.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{groupFactory:function(){return n.getFormModelForSchemaDef(i)}})},a.prototype.getFormGroupConfig=function(e,t){var r=e.$ref||"",n=this.schemas[r.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{group:this.getFormModelForSchemaDef(n)})},a.prototype.getFormInputConfig=function(e,r){var n,o=t.StringUtils.has(e.id,"password","Password")?"password":(null===(n=e.items)||void 0===n?void 0:n.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,r),{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 x(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return M(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=E(e),r=t.next(),u.label=2;case 2:return r.done?[3,5]:(n=r.value,o=n,[4,this.language.getTranslation(n.label)]);case 3:o.label=u.sent(),u.label=4;case 4:return r=t.next(),[3,2];case 5:return[3,8];case 6:return i=u.sent(),a={error:i},[3,8];case 7:try{r&&!r.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,r){var n,o=this,i=(null===(n=e.items)||void 0===n?void 0:n.enum)||e.enum;return Array.isArray(i)?new I((function(){var t=i.map((function(t){return{value:t,label:e.translatable?e.id+"."+t:t}}));return o.translateOptions(t)})):V(e.optionsPath)?new I((function(r,n,i){var a=e.optionsPath,s=n;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)),l=(t.ObjectUtils.isArray(u)?u:[]).map((function(e){return{value:e,label:e}}));return o.translateOptions(l)})):new I((function(){return x(o,void 0,void 0,(function(){var t;return M(this,(function(r){switch(r.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=r.sent().map((function(e){return Object.assign({},e)})),[2,this.translateOptions(t)]}}))}))}))},a.prototype.getFormUploadConfig=function(e,t){var r=this.api.url(e.url||"assets"),n=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:r,accept:n,autoUpload:o,maxSize:i,minSize:a,removeUrl:s,showFileList:u})},a.prototype.getValidators=function(e,r){var n={};return t.ObjectUtils.isArray(r.required)&&r.required.indexOf(e.id)>=0&&(n.required=null),this.addPropertyValidators(n,e),this.addItemsValidators(n,e.items),n},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);L.decorators=[{type:n.Injectable}],L.ctorParameters=function(){return[{type:i.DynamicFormComponentService},{type:i.DynamicFormValidationService},{type:t.OpenApiService}]};var U=function(){function e(e,t,r,o){this.toaster=e,this.cdr=t,this.elem=r,this.renderer=o,this.onSuccess=new n.EventEmitter,this.onError=new n.EventEmitter,"BUTTON"===r.nativeElement.tagName&&o.setAttribute(r.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}();U.decorators=[{type:n.Directive,args:[{selector:"[async-submit]",exportAs:"async-submit"}]}],U.ctorParameters=function(){return[{type:void 0,decorators:[{type:n.Inject,args:[t.TOASTER_SERVICE]}]},{type:n.ChangeDetectorRef},{type:n.ElementRef},{type:n.Renderer2}]},U.propDecorators={method:[{type:n.Input,args:["async-submit"]}],form:[{type:n.Input}],context:[{type:n.Input}],onSuccess:[{type:n.Output}],onError:[{type:n.Output}],isDisabled:[{type:n.HostBinding,args:["class.disabled"]}],isLoading:[{type:n.HostBinding,args:["class.loading"]}],click:[{type:n.HostListener,args:["click"]}]};var _=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 n.EventEmitter,s.change=new n.EventEmitter,s.focus=new n.EventEmitter,s.onStatusChange=new n.EventEmitter,s.onValueChange=new n.EventEmitter,s.onSubmit=new n.EventEmitter,s.templates=new n.QueryList,s.subscription=new r.Subscription,s.groupSubscription=new r.Subscription,s.labelPrefix="label",s}return w(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 r=this;this.groupSubscription.unsubscribe(),this.group&&(this.groupSubscription=t.ObservableUtils.multiSubscription(this.group.statusChanges.subscribe((function(){r.onStatusChange.emit(r)})),this.group.valueChanges.subscribe((function(){r.onValueChange.emit(r),r.formService.notifyChanges(r.model,r.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,r){this.formService.insertFormArrayGroup(e,t,r),this.changeDetectorRef.detectChanges()},o.prototype.removeFormArrayGroup=function(e,t,r){this.formService.removeFormArrayGroup(e,t,r),this.changeDetectorRef.detectChanges()},o.prototype.moveFormArrayGroup=function(e,t,r,n){this.formService.moveFormArrayGroup(e,t,r,n),this.changeDetectorRef.detectChanges()},o.prototype.clearFormArray=function(e,t){this.formService.clearFormArray(e,t),this.changeDetectorRef.detectChanges()},o.prototype.validate=function(e){var t=this;return void 0===e&&(e=!0),this.group?new Promise((function(r,n){t.group.statusChanges.pipe(a.first((function(e){return"VALID"==e||"INVALID"==e}))).subscribe((function(o){e&&t.formService.showErrors(t),"VALID"!=o?n(null):r(null)})),t.group.updateValueAndValidity()})):Promise.resolve()},o.prototype.serialize=function(e){return x(this,void 0,void 0,(function(){return M(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);_.decorators=[{type:n.Component,args:[{selector:"dynamic-base-form",template:"",changeDetection:n.ChangeDetectionStrategy.Default}]}],_.ctorParameters=function(){return[{type:L,decorators:[{type:n.Inject,args:[L]}]},{type:t.EventsService,decorators:[{type:n.Inject,args:[t.EventsService]}]},{type:n.ChangeDetectorRef},{type:i.DynamicFormComponentService}]},_.propDecorators={group:[{type:n.Input}],model:[{type:n.Input}],layout:[{type:n.Input}],labelPrefix:[{type:n.Input}],blur:[{type:n.Output}],change:[{type:n.Output}],focus:[{type:n.Output}],contentTemplates:[{type:n.ContentChildren,args:[i.DynamicTemplateDirective]}],viewTemplates:[{type:n.ViewChildren,args:[i.DynamicTemplateDirective]}],onStatusChange:[{type:n.Output}],onValueChange:[{type:n.Output}],onSubmit:[{type:n.Output}],ngForm:[{type:n.ViewChild,args:[o.NgForm]}]};var k=function(e){function r(t,r,o,i,a,s,u){var l=e.call(this,r,o,i,a,s,u)||this;return l.form=t,l.changeDetectorRef=r,l.componentFactoryResolver=o,l.layoutService=i,l.validationService=a,l.componentService=s,l.relationService=u,l.context=null,l.blur=new n.EventEmitter,l.change=new n.EventEmitter,l.focus=new n.EventEmitter,l}return w(r,e),Object.defineProperty(r.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(r.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(r.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(r.prototype,"formService",{get:function(){return this.form.formService},enumerable:!1,configurable:!0}),r.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))}))},r.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.onDetectChanges.unsubscribe()},r.prototype.createFormControlComponent=function(){var r;e.prototype.createFormControlComponent.call(this);var n=null===(r=this.componentRef)||void 0===r?void 0:r.instance;n&&t.ObjectUtils.isFunction(n.onCreated)&&n.onCreated()},r.prototype.getComponentType=function(e){return null},r}(i.DynamicFormControlContainerComponent);k.decorators=[{type:n.Component,args:[{selector:"dynamic-base-form-control",template:"",changeDetection:n.ChangeDetectionStrategy.OnPush}]}],k.ctorParameters=function(){return[{type:_},{type:n.ChangeDetectorRef},{type:n.ComponentFactoryResolver},{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService},{type:i.DynamicFormComponentService},{type:i.DynamicFormRelationService}]},k.propDecorators={contentTemplateList:[{type:n.ContentChildren,args:[i.DynamicTemplateDirective]}],klass:[{type:n.HostBinding,args:["class"]}],context:[{type:n.Input}],group:[{type:n.Input}],hostClass:[{type:n.Input}],inputTemplateList:[{type:n.Input,args:["templates"]}],layout:[{type:n.Input}],model:[{type:n.Input}],blur:[{type:n.Output}],change:[{type:n.Output}],focus:[{type:n.Output}],componentViewContainerRef:[{type:n.ViewChild,args:["componentViewContainer",{read:n.ViewContainerRef,static:!0}]}]};var P=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t.prototype.showErrorMessages=function(t,r,n){return e.prototype.showErrorMessages.call(this,t,r,n)},t}(i.DynamicFormValidationService);P.decorators=[{type:n.Injectable}];var G=[_,k],z=[U],q=[],B=v,$=b,Y=C,H=F,J=O,W=A,X=new Map([["json",v],["requiredTranslation",b],["phone",S],["itemsMinLength",C],["itemsMaxLength",F],["itemsMinValue",O],["itemsMaxValue",A]]),Q=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[L,P,{provide:i.DynamicFormService,useExisting:L},{provide:i.DynamicFormValidationService,useExisting:P}]}},e}();Q.decorators=[{type:n.NgModule,args:[{declarations:R(G,z,q),imports:[s.CommonModule,o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule],exports:R(G,z,q,[o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule]),entryComponents:G,providers:R(q,[{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:o.NG_VALIDATORS,useValue:W,multi:!0},{provide:i.DYNAMIC_VALIDATORS,useValue:X}])}]}],e.AsyncSubmitDirective=U,e.DynamicBaseFormComponent=_,e.DynamicBaseFormControlContainerComponent=k,e.DynamicFormService=L,e.FormFieldSet=function(e){return function(r){var n=m(r);e.classes=e.classes||"",n[e.id]=e,t.ReflectUtils.defineMetadata("dynamicFormFieldSets",n,r)}},e.FormFile=function(e){return function(r,n){p(r,n,function(e,r){var n=f(e,"file",r);return(r=n.data).accept=r.accept||".jpg,.jpeg,.png",r.multi=r.multi||!1,r.baseUrl=t.ObjectUtils.isString(r.baseUrl)?r.baseUrl:"assets/",r.uploadUrl=t.ObjectUtils.isString(r.uploadUrl)?r.uploadUrl:"assets",r.createUploadData=r.createUploadData||function(e){var t=new FormData;return t.append("file",e),t},n}(n,e))}},e.FormInput=function(e){return function(r,n){var o=t.ReflectUtils.getOwnMetadata("design:type",r,n),i=o?o.name:"",a=n.indexOf("password")<0?"text":"password";switch(i){case"Number":a="number";break;case"Boolean":a="checkbox"}p(r,n,h(n,e,a))}},e.FormModel=function(e){return function(t,r){p(t,r,g(r,e))}},e.FormSelect=function(e){return function(t,r){p(t,r,d(r,e))}},e.FormSelectSubject=I,e.FormSerializable=function(e){return function(r,n){t.ReflectUtils.defineMetadata("dynamicFormSerializer",e||c,r,n)}},e.FormStatic=function(e){return function(t,r){p(t,r,y(r,e))}},e.FormSubject=j,e.NgxDynamicFormModule=Q,e.createFormControl=f,e.createFormInput=h,e.createFormModel=g,e.createFormSelect=d,e.createFormStatic=y,e.defaultSerializer=c,e.defineFormControl=p,e.getFormControl=function(e,r){return t.ReflectUtils.getMetadata("dynamicFormControl",e,r)},e.getFormFieldSets=m,e.getFormSerializer=function(e,r){return t.ReflectUtils.getMetadata("dynamicFormSerializer",e,r)},e.validateItemsMaxLength=F,e.validateItemsMaxValue=A,e.validateItemsMinLength=C,e.validateItemsMinValue=O,e.validateJSON=v,e.validatePhone=S,e.validateRequiredTranslation=b,e.ɵa=G,e.ɵb=z,e.ɵc=q,e.ɵd=P,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";var u=[],c=function(){return Promise.resolve(!1)};function l(e,t){var n=t.get(e);return n?n.value:null}function p(e,n,r){t.ReflectUtils.defineMetadata("dynamicFormControl",r,e,n)}function m(e){return t.ReflectUtils.getMetadata("dynamicFormFieldSets",e)||{}}function f(e,n,r){return(r=r||{}).label=t.ObjectUtils.isNullOrUndefined(r.label)?e:r.label,r.labelAlign=r.labelAlign||"left",r.fieldSet=r.fieldSet||t.UniqueUtils.uuid(),r.classes=r.classes||"",r.readonly=r.readonly||c,r.hidden=r.hidden||c,r.validators=r.validators||u,{id:e,type:n,data:r}}function y(e,t,n){void 0===n&&(n="text");var r=f(e,"input",t);return(t=r.data).type=t.type||n,t.classes=t.classes?t.classes+" form-group-"+t.type:"form-group-"+t.type,t.placeholder=t.placeholder||("mask"==t.type?"_":""),t.step=t.step||1,t.mask=t.mask||[/\w*/gi],r}function h(e,t){var n=f(e,"select",t);(t=n.data).options=t.options||[],t.type=t.type||"select";var r="select"==t.type?"select":"select-"+t.type;return t.classes=t.classes?t.classes+" form-group-"+r:"form-group-"+r,n}function d(e,t){var n=f(e,"static",t);return(t=n.data).style=t.style||"table",n}function g(e,t){var n=f(e,"model",t);return(t=n.data).name=t.name||"",n}function v(e){var t=e.value;if(!t)return null;try{return JSON.parse(t),null}catch(e){return{json:!0}}}function b(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 C(e){var t=e.value;if(!t)return Promise.resolve(null);return/^(?:\d){10,12}$/.test(t)?null:{phone:!0}}function S(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 F(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 D(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 O(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 A=function(e,t){return A=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])},A(e,t)};function w(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}A(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function E(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 x(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 M(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 I(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 j(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(I(arguments[t]));return e}Object.create;var N=function(e){function t(t){var n=e.call(this)||this;return n.notifyCallback=t,n}return w(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),R=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t.prototype.handleNotifiedValue=function(e,t,n){var r=this;n.then((function(n){var o,i;r.next(n);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}(N);function V(e){return"string"==typeof e&&e.length>0}function T(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 L=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.additional=t.additional||{},r}return w(t,e),t}(i.DynamicFormArrayModel),U=function(e){function a(t,n,o){var i=e.call(this,t,n)||this;return i.openApi=o,i.onDetectChanges=new r.EventEmitter,i}return w(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 N)return void r.notify(e,t);for(;r instanceof n.Subject&&r.source;)(r=r.source)instanceof N&&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 E(this,void 0,void 0,(function(){var a,s,u,c,l,p,m,f,y,h,d,g,v,b,C,S,F,D,O;return x(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)?(y=a,h=p.id,[4,f(p,m)]):[3,3]):[3,12];case 2:return y[h]=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){return E(this,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return this.api.cache={},t=this,[4,this.openApi.getSchemas()];case 1:return t.schemas=n.sent(),[2,this.getFormModelForSchemaDef(this.schemas[e])]}}))}))},a.prototype.getFormModelForSchemaDef=function(e){var t=this;return e?Object.keys(e.properties||{}).map((function(n){var r=e.properties[n];return t.getFormControlModel(r,e)})).filter((function(e){return null!==e})):[]},a.prototype.getFormControlModel=function(e,t){var n,r,o=(null===(n=e.items)||void 0===n?void 0:n.enum)||e.enum;if(Array.isArray(o)||V(e.optionsPath)||V(e.endpoint))return new i.DynamicSelectModel(this.getFormSelectConfig(e,t));switch(e.type){case"string":case"number":case"integer":return new i.DynamicInputModel(this.getFormInputConfig(e,t));case"textarea":return new i.DynamicTextAreaModel(this.getFormTextareaConfig(e,t));case"boolean":return new i.DynamicCheckboxModel(this.getFormCheckboxConfig(e,t));case"array":return(null===(r=e.items)||void 0===r?void 0:r.$ref)||e.$ref?new L(this.getFormArrayConfig(e,t)):new i.DynamicInputModel(this.getFormInputConfig(e,t));case"file":return new i.DynamicFileUploadModel(this.getFormUploadConfig(e,t))}return e.$ref?new i.DynamicFormGroupModel(this.getFormGroupConfig(e,t)):null},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){var n,r=this,o=(null===(n=e.items)||void 0===n?void 0:n.$ref)||e.$ref||"",i=this.schemas[o.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{groupFactory:function(){return r.getFormModelForSchemaDef(i)}})},a.prototype.getFormGroupConfig=function(e,t){var n=e.$ref||"",r=this.schemas[n.split("/").pop()];return Object.assign(this.getFormControlConfig(e,t),{group:this.getFormModelForSchemaDef(r)})},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 E(this,void 0,void 0,(function(){var t,n,r,o,i,a,s;return x(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=M(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 R((function(){var t=i.map((function(t){return{value:t,label:e.translatable?e.id+"."+t:t}}));return o.translateOptions(t)})):V(e.optionsPath)?new R((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 R((function(){return E(o,void 0,void 0,(function(){var t;return x(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);U.decorators=[{type:r.Injectable}],U.ctorParameters=function(){return[{type:i.DynamicFormComponentService},{type:i.DynamicFormValidationService},{type:t.OpenApiService}]};var P=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}();P.decorators=[{type:r.Directive,args:[{selector:"[async-submit]",exportAs:"async-submit"}]}],P.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[t.TOASTER_SERVICE]}]},{type:r.ChangeDetectorRef},{type:r.ElementRef},{type:r.Renderer2}]},P.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 _=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 w(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=T(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 E(this,void 0,void 0,(function(){return x(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);_.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form",template:"",changeDetection:r.ChangeDetectionStrategy.Default}]}],_.ctorParameters=function(){return[{type:U,decorators:[{type:r.Inject,args:[U]}]},{type:t.EventsService,decorators:[{type:r.Inject,args:[t.EventsService]}]},{type:r.ChangeDetectorRef},{type:i.DynamicFormComponentService}]},_.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 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 w(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=T(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);k.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-array",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 G=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 w(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=T(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);G.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-control",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],G.ctorParameters=function(){return[{type:_},{type:r.ChangeDetectorRef},{type:r.ComponentFactoryResolver},{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService},{type:i.DynamicFormComponentService},{type:i.DynamicFormRelationService}]},G.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 z=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 w(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=T(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);z.decorators=[{type:r.Component,args:[{selector:"dynamic-base-form-group",template:"",changeDetection:r.ChangeDetectionStrategy.OnPush}]}],z.ctorParameters=function(){return[{type:i.DynamicFormLayoutService},{type:i.DynamicFormValidationService}]},z.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 q=[_,k,G,z],B=[P],$=[],Y=v,H=b,J=S,W=F,X=D,Q=O,K=new Map([["json",v],["requiredTranslation",b],["phone",C],["itemsMinLength",S],["itemsMaxLength",F],["itemsMinValue",D],["itemsMaxValue",O]]),Z=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[U,{provide:i.DynamicFormService,useExisting:U}]}},e}();Z.decorators=[{type:r.NgModule,args:[{declarations:j(q,B,$),imports:[s.CommonModule,o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule],exports:j(q,B,$,[o.FormsModule,o.ReactiveFormsModule,t.NgxUtilsModule]),entryComponents:q,providers:j($,[{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:o.NG_VALIDATORS,useValue:W,multi:!0},{provide:o.NG_VALIDATORS,useValue:X,multi:!0},{provide:o.NG_VALIDATORS,useValue:Q,multi:!0},{provide:i.DYNAMIC_VALIDATORS,useValue:K}])}]}],e.AsyncSubmitDirective=P,e.DynamicBaseFormArrayComponent=k,e.DynamicBaseFormComponent=_,e.DynamicBaseFormControlContainerComponent=G,e.DynamicBaseFormGroupComponent=z,e.DynamicFormService=U,e.FormFieldSet=function(e){return function(n){var r=m(n);e.classes=e.classes||"",r[e.id]=e,t.ReflectUtils.defineMetadata("dynamicFormFieldSets",r,n)}},e.FormFile=function(e){return function(n,r){p(n,r,function(e,n){var r=f(e,"file",n);return(n=r.data).accept=n.accept||".jpg,.jpeg,.png",n.multi=n.multi||!1,n.baseUrl=t.ObjectUtils.isString(n.baseUrl)?n.baseUrl:"assets/",n.uploadUrl=t.ObjectUtils.isString(n.uploadUrl)?n.uploadUrl:"assets",n.createUploadData=n.createUploadData||function(e){var t=new FormData;return t.append("file",e),t},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"}p(n,r,y(r,e,a))}},e.FormModel=function(e){return function(t,n){p(t,n,g(n,e))}},e.FormSelect=function(e){return function(t,n){p(t,n,h(n,e))}},e.FormSelectSubject=R,e.FormSerializable=function(e){return function(n,r){t.ReflectUtils.defineMetadata("dynamicFormSerializer",e||l,n,r)}},e.FormStatic=function(e){return function(t,n){p(t,n,d(n,e))}},e.FormSubject=N,e.NgxDynamicFormModule=Z,e.createFormControl=f,e.createFormInput=y,e.createFormModel=g,e.createFormSelect=h,e.createFormStatic=d,e.defaultSerializer=l,e.defineFormControl=p,e.getFormControl=function(e,n){return t.ReflectUtils.getMetadata("dynamicFormControl",e,n)},e.getFormFieldSets=m,e.getFormSerializer=function(e,n){return t.ReflectUtils.getMetadata("dynamicFormSerializer",e,n)},e.validateItemsMaxLength=F,e.validateItemsMaxValue=O,e.validateItemsMinLength=S,e.validateItemsMinValue=D,e.validateJSON=v,e.validatePhone=C,e.validateRequiredTranslation=b,e.ɵa=q,e.ɵb=B,e.ɵc=$,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=stemy-ngx-dynamic-form.umd.min.js.map