@wavemaker/app-runtime-wm-build 11.4.2-next.25744 → 11.4.2-next.25745
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.
|
@@ -51187,6 +51187,9 @@
|
|
|
51187
51187
|
}));
|
|
51188
51188
|
} else {
|
|
51189
51189
|
var element = self.$element.find('[wmformfield][key="' + fieldName + '"]');
|
|
51190
|
+
if (!element.length) {
|
|
51191
|
+
element = self.$element.find('[wmformfield][name="' + fieldName + '"]');
|
|
51192
|
+
}
|
|
51190
51193
|
if (element.length) {
|
|
51191
51194
|
element[0].setAttribute("__errormsg", element[0].getAttribute("__validationId"));
|
|
51192
51195
|
(_a = element[0].querySelector("input")) === null || _a === void 0 ? void 0 : _a.setAttribute("aria-invalid", ngForm.invalid);
|
|
@@ -545,7 +545,7 @@ var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
545
545
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
546
546
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
547
547
|
PERFORMANCE OF THIS SOFTWARE.
|
|
548
|
-
***************************************************************************** */var m=function(e,t){return(m=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])})(e,t)};function f(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}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function g(e,t,n,i){return new(n||(n=Promise))((function(o,a){function r(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((i=i.apply(e,t||[])).next())}))}function v(e,t){var n,i,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}Object.create;function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function b(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var w=new Map([["autocomplete",Object.assign({value:!1},i.PROP_BOOLEAN)],["captionalign",Object.assign({value:"left"},i.PROP_STRING)],["captionposition",Object.assign({value:"left"},i.PROP_STRING)],["captionsize",i.PROP_STRING],["captionwidth",Object.assign({value:"xs-12 sm-3 md-3 lg-3"},i.PROP_STRING)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dataset",i.PROP_ANY],["datasource",i.PROP_STRING],["expanded",Object.assign({value:!0},i.PROP_BOOLEAN)],["formdatasource",i.PROP_STRING],["name",i.PROP_STRING],["numberOfFields",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showindevice",Object.assign({displayType:"inline-block",value:"all"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]),P=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("action",i.PROP_STRING),e.set("defaultmode",Object.assign({value:"Edit"},i.PROP_STRING)),e.set("metadata",i.PROP_STRING),e.set("method",i.PROP_STRING),e.set("postmessage",Object.assign({value:"Data posted successfully"},i.PROP_STRING)),e.set("target",i.PROP_STRING),e.set("enctype",i.PROP_STRING),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Inline"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-form",e)},O=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("defaultmode",Object.assign({value:"View"},i.PROP_STRING)),e.set("formlayout",Object.assign({value:"inline"},i.PROP_STRING)),e.set("insertmessage",Object.assign({value:"Record added successfully"},i.PROP_STRING)),e.set("updatemessage",Object.assign({value:"Record updated successfully"},i.PROP_STRING)),e.set("deletemessage",Object.assign({value:"Record deleted successfully"},i.PROP_STRING)),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Toaster"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-liveform",e)},E=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("autoupdate",i.PROP_BOOLEAN),e.set("enableemptyfilter",Object.assign({value:" "},i.PROP_STRING)),e.set("pagesize",Object.assign({value:20},i.PROP_NUMBER)),e.set("iconclass",Object.assign({value:"wi wi-filter-list"},i.PROP_STRING)),i.register("wm-livefilter",e)},R={widgetType:"wm-form",hostClass:"panel app-panel app-form"},A={widgetType:"wm-form",hostClass:"app-form app-login-form"},T={widgetType:"wm-liveform",hostClass:"panel app-panel app-liveform liveform-inline"},S={widgetType:"wm-livefilter",hostClass:"panel app-panel app-livefilter clearfix liveform-inline"},C=function(e,t,n){var i=R;return null!==e?i=T:null!==t?i=S:"app-login"===n&&(i=A),i},I=function(e,t){var n="";return _.forEach(e,(function(e,t){n=n+" "+t+'="'+e+'"'})),'<wm-gridcolumn columnwidth="'+t+'">\n <wm-form-field '+n+"></wm-form-field>\n </wm-gridcolumn>"},D=function(e,t){var n=e.find("form.ng-invalid:visible, [formControlName].ng-invalid:visible").first(),i=t;return n.is("form")&&(i=t&&t.controls[n.attr("formControlName")||n.attr("name")])?D(n,i):{ngForm:i,$ele:n}},x=function(e,t,n){var i,o;if(!t.valid)if(t.controls)_.forEach(t.controls,(function(t,n){x(e,t,n)}));else{var a=e.$element.find('[wmformfield][key="'+n+'"]');a.length&&(a[0].setAttribute("__errormsg",a[0].getAttribute("__validationId")),null===(i=a[0].querySelector("input"))||void 0===i||i.setAttribute("aria-invalid",t.invalid),null===(o=a[0].querySelector("input"))||void 0===o||o.setAttribute("aria-describedby",a[0].getAttribute("__validationId"))),t.markAsTouched()}},N=function(e){function t(t,n,o,a,r,s,c,p,d,u,h,m,f,g,v,y,b,w,P,O){var E=e.call(this,t,C(y,b,w))||this;E.fb=n,E.app=o,E.dialogService=a,E.dynamicComponentProvider=r,E.ngZone=s,E.parentList=c,E.parentForm=p,E.parentPrefab=d,E.parentPartial=u,E.onBeforeSubmitEvt=h,E.onSubmitEvt=m,E.onBeforeRenderEvt=f,E.binddataset=g,E.bindformdata=v,E._widgetClass="",E._captionClass="",E.formFields=[],E.formfields={},E.formWidgets={},E.filterWidgets={},E.buttonArray=[],E.dataoutput={},E.formdata={},E.statusMessage={caption:"",type:""},E.primaryKey=[],E._debouncedUpdateFieldSource=_.debounce(E.updateFieldSource,350),E.validationMessages=[],E._debouncedSubmitForm=l.debounce((function(e){E.ngZone.run((function(){E.submitForm(e)}))}),250),i.styler(E.nativeElement,E),l.removeAttr(E.nativeElement,"title"),E.isUpdateMode=!0,E.dialogId=E.nativeElement.getAttribute("dialogId"),E.ngform=n.group({}),E.bindingValue=P||O;var R=E.ngform.valueChanges.subscribe(E.updateDataOutput.bind(E));return E.registerDestroyListener((function(){return R.unsubscribe()})),E.elScope=E,E.addEventsToContext(E.context),E}return f(t,e),Object.defineProperty(t.prototype,"isLayoutDialog",{get:function(){return this._isLayoutDialog},set:function(e){e&&l.removeClass(this.nativeElement,"panel app-panel liveform-inline"),this._isLayoutDialog=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUpdateMode",{get:function(){return this._isUpdateMode},set:function(e){this._isUpdateMode=e,this.formFields.forEach((function(t){t.setReadOnlyState(e)}))},enumerable:!1,configurable:!0}),t.prototype.submit=function(e){this._debouncedSubmitForm(e)},t.prototype.onReset=function(){this.reset()},t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},Object.defineProperty(t.prototype,"parentFormArray",{get:function(){return this.parentForm&&this.isParentList&&this.parentForm.ngform.get(this.parentList.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isParentList",{get:function(){if(this.parentList&&this.parentForm&&!l.isDefined(this._formIsInList)){var e=this.$element.closest('.app-livelist[name="'+this.parentList.name+'"]');e.length&&(this._formIsInList=!e.find('form[widget-id="'+this.parentForm.widgetId+'"]').length)}return l.isDefined(this._formIsInList)?this._formIsInList:this.parentList},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;setTimeout((function(){e.componentRefs.forEach((function(t){t.name&&(e.formWidgets[t.name]=t)}))}),250)},t.prototype.ngAfterViewInit=function(){this.parentForm&&this.parentForm.ngform&&this.isParentList&&(_.get(this.parentForm.ngform.controls,this.parentList.name)||this.parentForm.ngform.setControl(this.parentList.name,new s.FormArray([])),this.parentFormArray.push(this.ngform),this.formArrayIndex=this.parentFormArray.length-1),this.addInnerNgFormToForm(this.bindingValue)},t.prototype.findOperationType=function(){},t.prototype.addInnerNgFormToForm=function(e){if(this.parentForm&&this.parentForm.ngform){if(this.isParentList)return;var t=this.parentPrefab||this.parentPartial;if(t){var n=(this.parentPrefab?t.$element.find("[wmprefabcontainer]"):t.$element).find("form").first();_.get(n[0],"widget.widgetId")===this.widgetId&&(n.isParentList||n.siblings("form").length||(e=_.get(t,"name")))}for(var i=1,o=e;this.parentForm.ngform.controls.hasOwnProperty(o);)o=e+"_"+i,i++;this.formGroupName=o,this.parentForm.ngform.addControl(o,this.ngform)}},t.prototype.addEventsToContext=function(e){var t=this;e.cancel=function(){return t.cancel()},e.reset=function(){return t.reset()},e.save=function(e){return t.save(e)},e.saveAndNew=function(){return t.saveAndNew()},e.saveAndView=function(){return t.saveAndView()},e.delete=function(){return t.delete()},e.new=function(){return t.new()},e.edit=function(){return t.edit()},e.highlightInvalidFields=function(){return t.highlightInvalidFields()},e.filter=function(){return t.filter()},e.clearFilter=function(){return t.clearFilter()},e.submit=function(e){return t.submit(e)}},t.prototype.setValidationOnInnerForms=function(e){var t=this,n=this.getNativeElement().querySelectorAll(".app-form");_.forEach(n,(function(n){var i=n.widget,o=_.get(i,"formGroupName")||i.name;l.isDefined(i.formArrayIndex)&&(o=o+"["+i.formArrayIndex+"]");for(var a=i;_.get(a,"parentForm");){var r=a.parentForm.formGroupName||a.parentForm.name;a.parentForm.parentFormArray&&(r=r+"["+a.parentForm.formArrayIndex+"]"),o=r+"."+o,a=a.parentForm}t.setValidationOnFields(i,o,e)}))},t.prototype.setValidationOnFields=function(e,t,n){var i=this,o=e.ngform.controls,a=e.formFields;a&&_.forEach(o,(function(o,r){var s,l=a.find((function(e){return e.key===r}));!l||n&&!o.touched||(null===(s=l.nativeElement.querySelector("input"))||void 0===s||s.setAttribute("aria-invalid",o.invalid),i.prepareValidationObj(o,r,l,t),i.prepareValidationObj.call(e,o,r,l,t))}))},t.prototype.prepareValidationObj=function(e,t,n,i){var o=this.validationMessages.findIndex((function(e){return e.field===t&&e.fullyQualifiedFormName===i}));e.invalid?-1===o?this.validationMessages.push({field:t,value:n.value,errorType:_.keys(e.errors),message:n.validationmessage||"",getElement:function(){return n.$element.find("[focus-target]")},formName:_.last(i.split(".")),fullyQualifiedFormName:i}):(this.validationMessages[o].value=n.value,this.validationMessages[o].errorType=_.keys(e.errors)):e.valid&&o>-1&&this.validationMessages.splice(o,1)},t.prototype.setValidationMsgs=function(e){!this.formFields.length&&_.isEmpty(this.ngform.controls)||(this.setValidationOnFields(this,this.name,e),this.setValidationOnInnerForms(e))},t.prototype.handleEvent=function(t,n,i,o){"submit"!==n&&e.prototype.handleEvent.call(this,this.nativeElement,n,i,o)},t.prototype.updateFieldSource=function(){var e=this;this.formdatasource&&this.formdatasource.execute(l.DataSource.Operation.IS_API_AWARE)||this.formdatasource&&!this.formdatasource.twoWayBinding||this.formFields.forEach((function(t){t.setFormWidget("datavaluesource",e.formdatasource),t.setFormWidget("binddatavalue",e.bindformdata+"."+t.key)}))},t.prototype.highlightInvalidFields=function(){x(this,this.ngform,"")},t.prototype.validateFieldsOnSubmit=function(){if(this.setValidationMsgs(),"delete"!==this.operationType&&("html"===this.validationtype||"default"===this.validationtype)&&this.ngform&&this.ngform.invalid){if(this.ngform.invalid){"default"===this.validationtype&&this.highlightInvalidFields();var e=D(this.$element,this.ngform),t=e.ngForm,n=e.$ele;if((n=n.parent().find("[focus-target]")).length){n.hasClass("app-search-input")||n.focus();var i=t&&t.controls[n.attr("formControlName")||n.attr("name")];return i&&i.markAsTouched&&i.markAsTouched(),l.$appDigest(),!0}return!0}return!1}return!1},t.prototype.onPropertyChange=function(t,n,i){switch(t){case"captionalign":this.captionAlignClass="align-"+n;break;case"captionposition":case"captionwidth":this.setLayoutConfig();break;case"captionsize":this.captionsize=n;break;case"novalidate":this.widget.validationtype=!0===n||"true"===n?"none":"default";break;case"formdata":if(_.isEqual(n,i))break;_.isArray(n)?this.setFormData(_.last(n)):this.setFormData(n),!this.isDataSourceUpdated&&this.datasource&&this.onDataSourceChange();break;case"defaultmode":this.isLayoutDialog||(this.updateMode=!(!n||"Edit"!==n),this.isUpdateMode=this.updateMode);break;case"datasource":this.onDataSourceChange();break;case"formdatasource":this.onFormDataSourceChange();break;case"metadata":this.generateFormFields();break;case"dataset":this.getFormFields().forEach((function(e){!e.isDataSetBound&&_.get(e.formWidget,"dataset$")&&e.formWidget.dataset$.next()}));break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onResultCb=function(e,t,n){var i={$event:n,$data:e,$operation:this.operationType};this.invokeEventCallback("result",i),t?this.invokeEventCallback("success",i):this.invokeEventCallback("error",i)},t.prototype.toggleMessage=function(e,t,n,i){var o;e&&t?(o="error"===n&&this.errormessage?this.errormessage:t,"Inline"===this.messagelayout?(o=this.checkAppServiceErrorMsg(n)||o,this.statusMessage={caption:o||"",type:n},this.messageRef&&this.messageRef.showMessage(this.statusMessage.caption,this.statusMessage.type),l.isElementInViewport(this.$element[0])||l.scrollToElement(this.$element[0])):this.app.notifyApp(o,n,i)):this.statusMessage.caption=""},t.prototype.checkAppServiceErrorMsg=function(e){var t=_.get(this.app,"Actions.appNotification");if(t&&"error"===e)return t.getMessage()},t.prototype.clearMessage=function(){this.toggleMessage(!1)},t.prototype.setLayoutConfig=function(){var e;e=i.getFieldLayoutConfig(this.captionwidth,this.captionposition,_.get(this.app.selectedViewPort,"os")),this._widgetClass=e.widgetCls,this._captionClass=e.captionCls,l.$appDigest()},t.prototype.registerFormWidget=function(e){var t=e.name||e.key;this.formWidgets[t]=e},t.prototype.registerFormFields=function(e){var t=this.formFields.push(e);this.formfields[e.key]=e,this.registerFormWidget(e),this._debouncedUpdateFieldSource(),this.parentForm&&(this.parentForm.formFields.push(e),this.parentForm.formfields[e.key]=e,this.parentForm.setFormData(this.parentForm.formdata,this.formFields,this.formdata||{})),t!==this.numberOfFields||_.isEmpty(this.formdata)||(this.onDataSourceChange(),_.isArray(this.formdata)?this.setFormData(_.last(this.formdata)):this.setFormData(this.formdata))},t.prototype.registerActions=function(e){this.buttonArray.push(e)},t.prototype.updateFormDataOutput=function(e){var t=this;_.forEach(this.ngform.value,(function(n,i){_.find(t.formFields,{key:i})||(e[i]=n)})),this.dataoutput=e},t.prototype.constructDataObject=function(){var e=this,t={};return this.getFormFields().forEach((function(n){var i,o;if(o=null===(o=n.datavalue||n._control.value)||""===o?void 0:o,"file"===n.type&&(o=l.getFiles(e.name,n.key+"_formWidget",n.multiple)),i=n.key||n.target||n.name,n.form.widgetId!==e.widgetId&&n.form.formGroupName)(a=_.get(t,n.form.formGroupName,{}))[i]=o,_.set(t,n.form.formGroupName,a);else if(n.form.isParentList){var a;(a=_.get(t,n.form.parentList.name,[]))[n.form.formArrayIndex]=a[n.form.formArrayIndex]||{},a[n.form.formArrayIndex][i]=o,_.set(t,n.form.parentList.name,a)}else _.set(t,i,o)})),this.updateFormDataOutput(t),this.dataoutput},t.prototype.updateDataOutput=function(){this.constructDataObject(),this.ngform.touched&&this.setValidationMsgs(!0)},t.prototype.getFormFields=function(){var e=this;return _.filter(this.formFields,(function(t){return t.form.name===e.name}))},t.prototype.setFieldValue=function(e,t,n){var i=e.key||e.name,o=n||t;o&&((o.hasOwnProperty(i)||_.includes(i,".")&&o.hasOwnProperty(_.split(i,".")[0]))&&(e.value=_.get(o,i)),this.dirty&&!this._triggeredByUser&&this.markAsPristine());var a=e.form.formGroupName;a&&_.get(t,a)&&this.setFormData.call(e.form,t[a]),_.get(e.form,"parentFormArray")&&this.setFormDataFromParentFormData.call(e.form,t)},t.prototype.setFormData=function(e,t,n){var i=this;(t||this.formFields).forEach((function(t){i.setFieldValue(t,e,n),t.fieldValidations&&t.fieldValidations.setCustomValidationMessage()})),this.constructDataObject()},t.prototype.resetFormState=function(){this.validationMessages.length&&(this.validationMessages=[]),this.ngform&&(this.ngform.markAsUntouched(),this.ngform.markAsPristine())},t.prototype.reset=function(){var e=this;this.resetFormState(),this.formFields.forEach((function(t){var n;t.value="","upload"!==t.widgettype&&t.type!==l.DataType.BLOB||e.resetFileUploadWidget(t,!0),null===(n=t.nativeElement.querySelector("input"))||void 0===n||n.removeAttribute("aria-invalid")})),this.constructDataObject(),this.clearMessage()},t.prototype.savePrevformFields=function(){this.prevformFields=l.getClonedObject(this.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},t.prototype.savePrevDataValues=function(){this.prevDataValues=this.formFields.map((function(e){return{key:e.key,value:e.value}}))},t.prototype.setReadonlyFields=function(){this.formFields.forEach((function(e){e.setReadOnlyState()}))},t.prototype.resetFileUploadWidget=function(e,t){this.$element.find('[name="'+e.key+'_formWidget"]').val(""),e._control.reset(),t||(e.href="",e.value=null)},t.prototype.emptyDataModel=function(){var e=this;this.formFields.forEach((function(t){l.isDefined(t)&&(t.type===l.DataType.BLOB?e.resetFileUploadWidget(t):t.datavalue="")}))},t.prototype.setDefaultValues=function(){var e=this;this.formFields.forEach((function(t){e.onFieldDefaultValueChange(t,t.defaultvalue)}))},t.prototype.setOperationType=function(e){this.operationType=e||"insert"},t.prototype.new=function(){var e=this;this.resetFormState(),this.operationType=i.Live_Operations.INSERT,this.clearMessage(),this.isSelected&&this.savePrevformFields(),this.emptyDataModel(),setTimeout((function(){e.setDefaultValues(),e.savePrevDataValues(),e.constructDataObject()})),this.isUpdateMode=!0},t.prototype.edit=function(){this.resetFormState(),this.clearMessage(),this.operationType=i.Live_Operations.UPDATE,this.isSelected&&(this.savePrevformFields(),this.savePrevDataValues()),this.prevDataObject=l.getClonedObject(this.formdata||{}),this.setReadonlyFields(),this.isUpdateMode=!0,l.$appDigest()},t.prototype.triggerWMEvent=function(e){var t=this.nativeElement.getAttribute("dependson");t&&(l.$invokeWatchers(!0),this.app.notify("wm-event",{eventName:e,widgetName:t}))},t.prototype.submitForm=function(e){var t,n,o,a=this,r=this.datasource;if(!this.validateFieldsOnSubmit()){n=l.getClonedObject(this.constructDataObject());var s=function(){return{$event:e,$formData:n,$data:n}};if(this.onBeforeSubmitEvt){if(!1===this.invokeEventCallback("beforesubmit",s()))return;this.resetFormState()}else this.resetFormState();if(this.onSubmitEvt||r)if(r){var c=r.pagination&&r.pagination.number+1,p=this.operationType?this.operationType:"insert";i.performDataOperation(r,n,{operationType:p}).then((function(e){return"wm.CrudVariable"===r.category&&(a.triggerWMEvent("resetEditMode"),a.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list",page:c,preventMissingOpMsg:!0}),a.dialogId&&a.closeDialog()),l.isDefined(e.body)?(o=l.getValidJSON(e.body),o=l.isDefined(o)?o:e.body):o=e,{result:o,status:!0,message:a.postmessage,type:"success"}}),(function(e){return t=a.errormessage||e.error||e,l.$appDigest(),{result:_.get(e,"error")||e,status:!1,message:t,type:"error"}})).then((function(t){("error"===t.type&&!a.onError||"success"===t.type&&!a.onSuccess)&&a.toggleMessage(!0,t.message,t.type),a.invokeEventCallback("submit",s()),a.onResultCb(t.result,t.status,e)}))}else this.invokeEventCallback("submit",s()),this.onResultCb({},!0,e);else this.onResultCb({},!0,e)}},t.prototype.closeDialog=function(){this.dialogService.close(this.dialogId)},t.prototype.showButtons=function(e){var t=this;return _.some(this.buttonArray,(function(n){return _.includes(n.position,e)&&n.updateMode===t.isUpdateMode}))},t.prototype.expandCollapsePanel=function(){this.collapsible&&(this.expanded=!this.expanded)},t.prototype.onDataSourceUpdate=function(e,t,n){t?this.new():(this.setFormData(e),this.closeDialog()),this.isUpdateMode=!l.isDefined(n)||n},t.prototype.getNearestParentFormData=function(e){return e.parentForm?e.bindformdata||!_.get(e.parentForm,"formdata")||_.isEmpty(e.parentForm.formdata)?this.getNearestParentFormData(e.parentForm):e.parentForm.formdata:{}},t.prototype.setFormDataFromParentFormData=function(e){if(_.isEmpty(this.formdata)&&this.parentForm&&e)if(this.parentFormArray){var t=_.get(e,this.parentList.name);if(t)_.isArray(t)||(t=[t]),this.parentFormArray.patchValue(t),this.bindformdata||(this.formdata=t[this.formArrayIndex]),this.setFormData(this.formdata);else if(this.isParentList&&this.parentForm.formGroupName){var n=_.get(e,this.parentForm.formGroupName);this.setFormDataFromParentFormData(n)}}else this.setFormData(e)},t.prototype.onDataSourceChange=function(){if(_.get(this.formFields,"length")&&!this.bindformdata){this.isDataSourceUpdated=!0;var e=this.getNearestParentFormData(this);this.setFormDataFromParentFormData(e)}},t.prototype.onFormDataSourceChange=function(){this.updateFieldSource()},t.prototype.onFieldDefaultValueChange=function(e,t){e.value=i.parseValueByType(t,void 0,e.widgettype,e.trailingzero),this.dirty&&!this._triggeredByUser&&this.markAsPristine()},t.prototype.onFieldValueChange=function(){},t.prototype.generateFormFields=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,o,a,r,s,c,p,d;return v(this,(function(u){switch(u.label){case 0:if(_.isUndefined(this._isGridLayoutPresent)&&(this._isGridLayoutPresent=this.$element.find(".panel-body [wmlayoutgrid]").length>0),this._isGridLayoutPresent?(t=this.$element.find(".form-elements [wmlayoutgrid]").first(),e=Number(t.attr("columns"))||1):((t=this.$element.find(".form-elements .dynamic-form-container")).length||(this.$element.find(".form-elements").prepend('<div class="dynamic-form-container"></div>'),t=this.$element.find(".form-elements .dynamic-form-container")),e=1),n=12/e,i="",o=0,s=this.metadata?this.metadata.data||this.metadata:[],this.formFields=[],_.isEmpty(s))return[2];if(this.onBeforeRenderEvt&&(r=this.invokeEventCallback("beforerender",{$metadata:s}))&&(s=r),!_.isArray(s))return[2];for(;s[o];){for(c="",a=0;a<e;a++)s[o]&&(c+=I(s[o],n)),o++;i+="<wm-gridrow>"+c+"</wm-gridrow>"}return this._isGridLayoutPresent||(i="<wm-layoutgrid>"+i+"</wm-layoutgrid>"),this.dynamicFormRef.clear(),this._dynamicContext||(this._dynamicContext=Object.create(this.viewParent),this._dynamicContext.form=this),[4,this.dynamicComponentProvider.getComponentFactoryRef("app-form-dynamic-"+this.widgetId,i,{noCache:!0,transpile:!0})];case 1:return p=u.sent(),d=this.dynamicFormRef.createComponent(p,0,this.inj),l.extendProto(d.instance,this._dynamicContext),t[0].appendChild(d.location.nativeElement),this.setFormData(this.formdata),[2]}}))}))},Object.defineProperty(t.prototype,"mode",{get:function(){return this.operationType||this.findOperationType()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.ngform&&this.ngform.dirty},enumerable:!1,configurable:!0}),t.prototype.markAsPristine=function(e){void 0===e&&(e=!1),this.ngform.markAsPristine({onlySelf:e})},t.prototype.markAsDirty=function(e){void 0===e&&(e=!1),this.ngform.markAsDirty({onlySelf:e})},Object.defineProperty(t.prototype,"invalid",{get:function(){return this.ngform&&this.ngform.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"touched",{get:function(){return this.ngform&&this.ngform.touched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.ngform&&this.ngform.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pristine",{get:function(){return this.ngform&&this.ngform.pristine},enumerable:!1,configurable:!0}),t.prototype.markAsTouched=function(e){void 0===e&&(e=!1),this.ngform.markAsTouched({onlySelf:e})},t.prototype.markAsUntouched=function(e){void 0===e&&(e=!1),this.ngform.markAsUntouched({onlySelf:e})},t.prototype.invokeActionEvent=function(e,t){l.$parseEvent(t)(this.viewParent,Object.assign(this.context,{$event:e}))},t.prototype.ngOnDestroy=function(){var t=this.parentForm&&_.get(this.parentForm,"ngform.controls");t&&(_.get(this.parentList,"name")&&t.hasOwnProperty(this.parentList.name)&&this.parentForm.ngform.removeControl(this.parentList.name),this.formGroupName&&t.hasOwnProperty(this.formGroupName)?this.parentForm.ngform.removeControl(this.formGroupName):this.parentForm.ngform.removeControl(this.name)),e.prototype.ngOnDestroy.call(this)},t}(i.StylableComponent);N.initializeProps=P(),N.decorators=[{type:t.Component,args:[{selector:"form[wmForm]",template:'<ng-template #content><ng-content></ng-content></ng-template>\n\n<ng-container *ngIf="formlayout === \'page\'; then pageLayoutTemplate else defaultTemplate">\n</ng-container>\n\n<ng-template #defaultTemplate>\n <div class="panel-heading" *ngIf="!isLayoutDialog && (title || subheading || iconclass || showButtons(\'header\'))">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon" aria-hidden="true" [ngClass]="iconclass" *ngIf="iconclass"></i>\n </div>\n <div class="pull-left">\n <div class="heading" [innerHTML]="title"></div>\n <div class="description" [innerHTML]="subheading"></div>\n </div>\n <div class="form-action panel-actions basic-btn-grp">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'header\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n <button type="button" class="app-icon wi panel-action" *ngIf="collapsible" title="Collapse/Expand"\n [ngClass]="expanded ? \'wi-minus\': \'wi-plus\'" (click)="expandCollapsePanel();"></button>\n </div>\n </h3>\n </div>\n <div class="panel-body" [ngClass]="{\'form-elements\': isLayoutDialog, \'form-body\': !isLayoutDialog}" [class.hidden]="!expanded">\n <p wmMessage [hidden]="!statusMessage.caption.toString()" [attr.aria-hidden]="!statusMessage.caption" [attr.aria-label]="statusMessage.caption" caption.bind="statusMessage.caption" type.bind="statusMessage.type"></p>\n <div [ngClass]="{\'form-elements\': !isLayoutDialog, \'form-content\': isLayoutDialog}">\n <ng-container *ngTemplateOutlet="content"></ng-container>\n </div>\n <div class="basic-btn-grp form-action panel-footer clearfix" [ngClass]="{\'modal-footer\': isLayoutDialog}" [class.hidden]="!expanded || !showButtons(\'footer\')">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'footer\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #pageLayoutTemplate>\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</ng-template>\n\n<ng-template #buttonRef let-btn="btn">\n <button wmButton name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" type.bind="btn.type" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey" disabled.bind="ngform.status === \'PENDING\' || btn.disabled"\n tabindex.bind="btn.tabindex" [attr.aria-label]="btn.displayName" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></button>\n</ng-template>\n\n<ng-template #anchorRef let-btn="btn">\n <a wmAnchor name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey"\n hyperlink.bind="btn.hyperlink" target.bind="btn.target"\n tabindex.bind="btn.tabindex" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></a>\n</ng-template>\n\n<ng-container #dynamicForm></ng-container>\n',providers:[i.provideAsWidgetRef(N)]}]}],N.ctorParameters=function(){return[{type:t.Injector},{type:s.FormBuilder},{type:l.App},{type:l.AbstractDialogService},{type:l.DynamicComponentRefProvider},{type:t.NgZone},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:N,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:c.PrefabDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:i.PartialDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforesubmit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["submit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforerender.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["formdata.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveForm"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveFilter"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["data-role"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]}]},N.propDecorators={dynamicFormRef:[{type:t.ViewChild,args:["dynamicForm",{static:!0,read:t.ViewContainerRef}]}],messageRef:[{type:t.ViewChild,args:[i.MessageComponent]}],componentRefs:[{type:t.ContentChildren,args:[i.WidgetRef,{descendants:!0}]}],action:[{type:t.HostBinding,args:["action"]}],submit:[{type:t.HostListener,args:["submit",["$event"]]}],onReset:[{type:t.HostListener,args:["reset"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var k=function(){function e(e,t,n,i,o,a){var r=this;this.componentInstance=n,this.name=o,this.key=a,this.fb=i,this.parent=e||t,this.ngform=this.parent.ngform,this.componentInstance.registerPropertyChangeListener((function(e,t){"datavalue"===e&&r._control?r._control.setValue(t):"name"!==e||r._control||r.addControl(r.key||t)}))}return Object.defineProperty(e.prototype,"_control",{get:function(){var e=this.key||this.name;if(e)return this.ngform&&this.ngform.controls[e]},enumerable:!1,configurable:!0}),e.prototype.addControl=function(e){this.ngform.addControl(e,this.createControl())},e.prototype.createControl=function(){return this.fb.control(this.componentInstance.datavalue)},e.prototype.ngOnInit=function(){var e=this.key||this.name;e&&!this._control&&(this.addControl(e),this.parent.registerFormWidget(this.componentInstance))},e}();k.decorators=[{type:t.Directive,args:[{selector:"[wmFormWidget]"}]}],k.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[N]}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[d.TableComponent]}]},{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[i.WidgetRef]}]},{type:s.FormBuilder},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]}]};var M=function(){i.register("wm-form-action",new Map([["accessroles",i.PROP_STRING],["action",i.PROP_STRING],["class",i.PROP_STRING],["binding",i.PROP_STRING],["disabled",i.PROP_BOOLEAN],["display-name",i.PROP_STRING],["hyperlink",i.PROP_STRING],["iconclass",i.PROP_STRING],["iconname",i.PROP_STRING],["key",i.PROP_STRING],["position",Object.assign({value:"footer"},i.PROP_STRING)],["shortcutkey",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["target",i.PROP_STRING],["title",i.PROP_STRING],["type",Object.assign({value:"button"},i.PROP_STRING)],["update-mode",Object.assign({value:!0},i.PROP_BOOLEAN)],["widget-type",Object.assign({value:"button"},i.PROP_STRING)]]))},L={widgetType:"wm-form-action",hostClass:""},F=function(e){function t(t,n){var i=e.call(this,t,L)||this;return i.form=n,i}return f(t,e),t.prototype.populateAction=function(){this.buttonDef={key:this.key||this.binding,displayName:this["display-name"],show:this.show,class:this.class?this.class:"button"===this["widget-type"]?"btn-secondary":"",iconclass:this.iconclass||"",title:_.isUndefined(this.title)?this["display-name"]||"":this.title,action:this.action,accessroles:this.accessroles,shortcutkey:this.shortcutkey,disabled:this.disabled,tabindex:this.tabindex,iconname:this.iconname,type:this.type,updateMode:this["update-mode"],position:this.position,widgetType:this["widget-type"],hyperlink:this.hyperlink,target:this.target},this._propsInitialized=!0},t.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.populateAction(),this.form.registerActions(this.buttonDef)},t.prototype.onPropertyChange=function(e,t,n){if(this._propsInitialized)switch(e){case"display-name":this.buttonDef.displayName=t;default:this.buttonDef[e]=t}},t}(i.BaseComponent);F.initializeProps=M(),F.decorators=[{type:t.Directive,args:[{selector:"[wmFormAction]",providers:[i.provideAsWidgetRef(F)]}]}],F.ctorParameters=function(){return[{type:t.Injector},{type:N,decorators:[{type:t.Optional}]}]};var j=function(){var e=new Map([["dataentrymode",Object.assign({value:"default"},i.PROP_STRING)],["debouncetime",Object.assign({value:250},i.PROP_NUMBER)],["defaultvalue",i.PROP_STRING],["displayname",i.PROP_STRING],["display-name",i.PROP_STRING],["field",i.PROP_STRING],["filterexpressions",i.PROP_STRING],["filter-on",i.PROP_STRING],["generator",i.PROP_STRING],["hint",i.PROP_STRING],["inputtype",i.PROP_STRING],["is-primary-key",i.PROP_BOOLEAN],["is-range",i.PROP_BOOLEAN],["is-related",i.PROP_BOOLEAN],["isformfield",{value:!0}],["key",i.PROP_STRING],["limit",i.PROP_NUMBER],["lookup-type",i.PROP_STRING],["lookup-field",i.PROP_STRING],["name",i.PROP_STRING],["matchmode",i.PROP_STRING],["maxdefaultvalue",i.PROP_STRING],["maxplaceholder",i.PROP_STRING],["mobile-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["period",i.PROP_BOOLEAN],["pc-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["placeholder",i.PROP_STRING],["primary-key",i.PROP_BOOLEAN],["related-entity-name",i.PROP_STRING],["required",i.PROP_BOOLEAN],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tablet-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["type",i.PROP_STRING],["validationmessage",i.PROP_STRING],["viewmodewidget",i.PROP_STRING],["widgettype",i.PROP_STRING]]),t=function(t){var n="wm-form-field-"+l.FormWidgetType[t],o=i.getWidgetPropsByType(n);e.forEach((function(e,t){null==o.get(t)&&o.set(t,e)}))};for(var n in l.FormWidgetType)t(n)},B=function(){return{custom:!0}},G={image:"image/*",video:"video/*",audio:"audio/*"},V=function(e){function t(t,n,i,o,a,r,s,c,p,d,u,h,m,f,g,v,y,b,w){var P=this,_={widgetType:"wm-form-field",hostClass:"",widgetSubType:"wm-form-field-"+(u||l.FormWidgetType.TEXT).trim()},O=l.noop;return(P=e.call(this,t,_,new Promise((function(e){return O=e})))||this)._initPropsRes=O,P.app=a,P.fieldDefConfig={},P.class="",P.binddataset=c,P.binddisplayimagesrc=m,P.binddisplayexpression=p,P.bindChipclass=s,P.binddisplaylabel=d,P.form=n,P.fb=i,P.viewport=o,P._fieldName=f||h,P.isRange=g,P.excludeProps=new Set(["type","name"]),P.widgettype=u,P.parentList=r,P.notifyForFields=[],(P.binddataset||P.$element.attr("dataset"))&&(P.isDataSetBound=!0),w[0]._onFocusField=P._onFocusField.bind(P),w[0]._onBlurField=P._onBlurField.bind(P),P._debounceSetUpValidators=l.debounce((function(){return P.setUpValidators()}),500),P}return f(t,e),t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},t.prototype.handleClick=function(e){this._clicktriggeredByUser=!0},t.prototype._onFocusField=function(e){this._activeField=!0,$(e.target).closest(".live-field").addClass("active")},t.prototype._onBlurField=function(e){var t,n,i,o;$(e.target).closest(".live-field").removeClass("active");this.nativeElement.querySelector("p.text-danger");this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",""+this.ngform.controls[this._fieldName].invalid),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this._activeField=!1,this._triggeredByUser=!1,this._clicktriggeredByUser=!1},t.prototype.evaluateExpr=function(e,t,n){if(n&&t||(t=Object.keys(e)[0]))return i.getEvaluatedData(e,{field:t,expression:n},this.viewParent)},t.prototype.getDisplayExpr=function(){var e=this,t=[],n=this.value,i=this.displayfield||this.displaylabel,o=this.displayexpression;return _.isObject(n)?(_.isArray(n)?_.forEach(n,(function(n){_.isObject(n)&&t.push(e.evaluateExpr(n,i,o))})):t.push(this.evaluateExpr(n,i,o)),_.join(t,",")):null==n?"":this.value},t.prototype.getCaption=function(){return void 0===this.value||null===this.value?_.get(this.form.dataoutput,this._fieldName)||"":this.value},t.prototype.notifyChanges=function(){_.forEach(this.notifyForFields,(function(e){e.fieldValidations.validate()}))},t.prototype.observeOn=function(e){this.fieldValidations.observeOn(e,"formfields")},t.prototype.setUpValidators=function(e){this.fieldValidations.setUpValidators(e)},t.prototype.setAsyncValidators=function(e){this.fieldValidations.setAsyncValidators(e)},t.prototype.setValidators=function(e){this.fieldValidations.setValidators(e)},t.prototype.setFormWidget=function(e,t){this.formWidget&&this.formWidget.widget&&(this.formWidget.widget[e]=t)},t.prototype.boundFn=function(e){return e()},t.prototype.setMaxFormWidget=function(e,t){this.formWidgetMax&&(this.formWidgetMax.widget[e]=t)},t.prototype.onPropertyChange=function(t,n,i){var o=this.form.dirty;if("tabindex"!==t&&e.prototype.onPropertyChange.call(this,t,n,i),!this.excludeProps.has(t)){if(this.widgettype===l.FormWidgetType.UPLOAD)return"required"===t&&this._debounceSetUpValidators(),void e.prototype.onPropertyChange.call(this,t,n,i);switch(this.setFormWidget(t,n),"placeholder"!==t&&this.setMaxFormWidget(t,n),t){case"defaultvalue":this.form.onFieldDefaultValueChange(this,n);break;case"maxdefaultvalue":this.maxValue=n,this.setMaxFormWidget("datavalue",n),this.form.onMaxDefaultValueChange();break;case"maxplaceholder":this.setMaxFormWidget("placeholder",n);break;case"required":o!==this.form.dirty&&this.form.markAsPristine();case"maxchars":case"minvalue":case"maxvalue":case"regexp":case"show":this._debounceSetUpValidators();break;case"primary-key":n&&this.form.setPrimaryKey(this._fieldName);break;case"display-name":this.displayname=n;break;case"readonly":this.setReadOnlyState()}}},t.prototype.onStyleChange=function(t,n,i){this.setFormWidget(t,n),this.setMaxFormWidget(t,n),e.prototype.onStyleChange.call(this,t,n,i)},Object.defineProperty(t.prototype,"datavalue",{get:function(){return this.formWidget&&this.formWidget.datavalue},set:function(e){this._control&&this.widgettype!==l.FormWidgetType.UPLOAD&&this._control.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.datavalue},set:function(e){this.datavalue=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.formWidgetMax&&this.formWidgetMax.datavalue},set:function(e){this._maxControl&&this._maxControl.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minValue",{get:function(){return this.value},set:function(e){this.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_control",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_maxControl",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName+"_max"]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){return this.formWidget&&this.formWidget.displayValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timestamp",{get:function(){return this.formWidget&&this.formWidget.timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"charlength",{get:function(){return this.formWidget&&this.formWidget.charlength},enumerable:!1,configurable:!0}),t.prototype.createControl=function(){return this.fb.control(void 0,{validators:this._validators})},t.prototype.onValueChange=function(e){var t,n,i,o;if(!this.isDestroyed){var a=$(this.nativeElement).find(".caption-floating");if(a.length>0){var r=l.isDefined(e)&&""!==e&&null!==e||a.find("input").val()||a.find("input:-webkit-autofill").length;this.app.notify("captionPositionAnimate",{displayVal:r,nativeEl:a,isSelectMultiple:this.formWidget&&this.formWidget.multiple,isFocused:this._activeField})}this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",this._triggeredByUser&&this.ngform.controls[this._fieldName].invalid?"true":"false"),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this.form.onFieldValueChange(this,e),this.notifyChanges(),(this.$element.find(".active").length>0||this.form.touched)&&((this._triggeredByUser||l.isMobile()&&this._clicktriggeredByUser&&l.isDateTimeType(this.widgettype))&&this.ngform.controls[this._fieldName].markAsTouched(),this.fieldValidations.setCustomValidationMessage())}},t.prototype.onStatusChange=function(e){this.isDestroyed||(this.showPendingSpinner="PENDING"===e,"PENDING"===e?this.formWidget.disabled=!0:this.formWidget.disabled!==this.disabled&&(this.formWidget.disabled=this.disabled))},t.prototype.setValidationMessage=function(e){var t=this;setTimeout((function(){t.validationmessage=e,t.setUpValidators(B)}))},t.prototype.setReadOnlyState=function(){var e;e=!this.form.isUpdateMode||(!this["primary-key"]||this["is-related"]||this.period?this.readonly:!("assigned"===this.generator&&"update"!==this.form.operationType)),this.setFormWidget("readonly",e)},t.prototype.resetDisplayInput=function(){l.isDefined(this.value)&&""!==this.value||this.formWidget&&this.formWidget.resetDisplayInput&&this.formWidget.resetDisplayInput()},t.prototype.triggerUploadEvent=function(e,t){var n={$event:e};"change"===t&&(n.newVal=e.target.files,n.oldVal=this._oldUploadVal,this._oldUploadVal=n.newVal),this.invokeEventCallback(t,n)},t.prototype.registerFormField=function(){var e=this._fieldName;if(this.parentList&&this.form.parentList!==this.parentList){for(var t=1,n=e;this.ngform.controls.hasOwnProperty(n);)n=e+"_"+t,t++;this.ngform.addControl(n,this.createControl()),this._fieldName=n}else this.ngform.addControl(e,this.createControl());var i=this._control.valueChanges.pipe(u.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return i.unsubscribe()}));var o=this._control.statusChanges.pipe(u.debounceTime(100)).subscribe(this.onStatusChange.bind(this));if(this.registerDestroyListener((function(){return o.unsubscribe()})),"true"===this.isRange){this.ngform.addControl(e+"_max",this.createControl());var a=this._maxControl.valueChanges.pipe(u.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return a.unsubscribe()}))}this.value=_.get(this.form.formdata,this._fieldName)},t.prototype.ngOnInit=function(){this.ngform=this.form.ngform,this.registerFormField(),this.fieldValidations=new i.BaseFieldValidations(this,this.formWidget,this.widgettype,this._control,this.form),e.prototype.ngOnInit.call(this)},t.prototype.ngAfterContentInit=function(){var t=this;e.prototype.ngAfterContentInit.call(this),this.formWidget&&(this._initPropsRes(),this.setFormWidget("binddisplaylabel",this.binddisplaylabel),this.setFormWidget("binddisplayexpression",this.binddisplayexpression),this.setFormWidget("binddisplayimagesrc",this.binddisplayimagesrc),this.setFormWidget("bindChipclass",this.bindChipclass),this.setFormWidget("binddataset",this.binddataset)),this.registerReadyStateListener((function(){if(t.key=t._fieldName||t.target||t.binding,t.viewmodewidget=t.viewmodewidget||i.getDefaultViewModeWidget(t.widgettype),t.widgettype===l.FormWidgetType.UPLOAD){var e;e=t.filetype?G[t.filetype]:"",t.permitted=e+(t.extensions?(e?",":"")+t.extensions:"")}l.isMobile()&&t.viewport.isMobileType?t["mobile-display"]||(t.widget.show=!1):t.viewport.isTabletType?t["tablet-display"]||(t.widget.show=!1):t["pc-display"]||(t.widget.show=!1),t.fieldDefConfig.displaname=t.displayname,t.fieldDefConfig.show=t.show,t.fieldDefConfig.isRelated=t["is-related"],t.fieldDefConfig.inputtype=t.inputtype,t.fieldDefConfig.generator=t.generator,t.fieldDefConfig.placeholder=t.placeholder,t.fieldDefConfig.primaryKey=t["primary-key"],t.fieldDefConfig.required=t.required,t.fieldDefConfig._readonly=t.readonly,t.fieldDefConfig.regexp=t.regexp,t.fieldDefConfig.type=t.type,t.fieldDefConfig.key=t.key,t.fieldDefConfig.mobileDisplay=t["mobile-display"],t.fieldDefConfig.name=t.name,t.fieldDefConfig.pcDisplay=t["pc-display"],t.fieldDefConfig.tabletDisplay=t["tablet-display"],t.fieldDefConfig.validationmessage=t.validationmessage,t.fieldDefConfig.viewmodewidget=t.viewmodewidget,t.fieldDefConfig.widget=t.widgettype,t.form.registerFormFields(t.widget),l.addForIdAttributes(t.nativeElement),t.setReadOnlyState()}))},t}(i.StylableComponent);V.initializeProps=j(),V.decorators=[{type:t.Directive,args:[{selector:"[wmFormField]",exportAs:"wmFormField",providers:[i.provideAsWidgetRef(V),i.provideAs(V,s.NG_VALUE_ACCESSOR,!0),{provide:i.Context,useValue:{},multi:!0}]}]}],V.ctorParameters=function(){return[{type:t.Injector},{type:N},{type:s.FormBuilder},{type:l.Viewport},{type:l.App},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:String,decorators:[{type:t.Attribute,args:["chipclass.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayexpression.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displaylabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["widgettype"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayimagesrc.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["is-range"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["pc-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["mobile-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["tablet-display"]}]},{type:Array,decorators:[{type:t.Self},{type:t.Inject,args:[i.Context]}]}]},V.propDecorators={formWidget:[{type:t.ContentChild,args:["formWidget",{static:!0}]}],formWidgetMax:[{type:t.ContentChild,args:["formWidgetMax"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}],handleClick:[{type:t.HostListener,args:["click",["$event"]]}]};var W=function(){function e(e,t,n){this.subscribedWidget=e,this.app=t,this.dialogService=n,e.addRow=this.addRow.bind(this),e.updateRow=this.updateRow.bind(this),e.deleteRow=this.deleteRow.bind(this),e.call=this.call.bind(this)}return e.prototype.addRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.INSERT,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.updateRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.UPDATE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.deleteRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.DELETE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.successHandler=function(e,t){l.triggerFn(e.success,t)},e.prototype.errorHandler=function(e,t){this.app.notifyApp(t,"error","ERROR"),l.triggerFn(e.error,t)},e.prototype.getRecords=function(e,t){var n,o,a=this;"None"!==this.subscribedWidget.navigation&&this.subscribedWidget.dataNavigator?(o=this.subscribedWidget.dataNavigator,t===i.Live_Operations.DELETE?(o.dataSize-=1,o.calculatePagingValues(),n=o.pageCount<o.dn.currentPage?"prev":void 0):("last"===(n=t===i.Live_Operations.INSERT?"last":"current")&&(o.dataSize+=1),o.calculatePagingValues()),o.navigatePage(n,null,!0,(function(t){a.successHandler(e,t)}))):this.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(t){a.successHandler(e,t)}),(function(t){a.errorHandler(e,t)}))},e.prototype.performCUDOperation=function(e,t,n){var o=this;i.performDataOperation(this.subscribedWidget.datasource,e,{operationType:t}).then((function(e){e.error?o.errorHandler(n,e.error):("wm.CrudVariable"===o.subscribedWidget.datasource.category&&"delete"===t?o.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(e){o.successHandler(n,e)}),(function(e){o.errorHandler(n,e)})):o.getRecords(n,t),"delete"===t&&o.app.notifyApp(o.app.appLocale.MESSAGE_DELETE_RECORD_SUCCESS,"success"))}),(function(e){o.errorHandler(n,e)}))},e.prototype.insertRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.updateRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.deleteRecord=function(e,t,n){var i=this;this.dialogService.showAppConfirmDialog({title:this.app.appLocale.MESSAGE_DELETE_RECORD||"Delete Record",iconclass:"wi wi-delete fa-lg",message:this.subscribedWidget.confirmdelete||"Are you sure you want to delete this?",oktext:this.subscribedWidget.deleteoktext||"Ok",canceltext:this.subscribedWidget.deletecanceltext||"Cancel",onOk:function(){i.performCUDOperation(e,t,n),i.dialogService.closeAppConfirmDialog()},onCancel:function(){l.triggerFn(n.cancelDeleteCallback),i.dialogService.closeAppConfirmDialog()}})},e.prototype.performOperation=function(e,t){var n={row:t.row,prevData:{},rowData:{},transform:!0,skipNotification:!0};switch(e===i.Live_Operations.UPDATE&&(n.rowData=t.rowData,n.prevData=t.prevData),e){case i.Live_Operations.INSERT:this.insertRecord(n,e,t);break;case i.Live_Operations.UPDATE:this.updateRecord(n,e,t);break;case i.Live_Operations.DELETE:this.deleteRecord(n,e,t);break;case i.Live_Operations.READ:this.getRecords(t,e)}},e.prototype.call=function(e,t,n,i){t.success=n,t.error=i,this.performOperation(e,t)},e}();W.decorators=[{type:t.Directive,args:[{selector:"[wmLiveActions]"}]}],W.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[p.ListComponent]}]},{type:l.App},{type:l.AbstractDialogService}]};var U=function(){function e(e,t,n,i){this.dialogService=n,this.app=i,e&&(this.isLayoutDialog=!0,this.dialogId=e),this.dependson=t,this.eventSubscription=this.app.subscribe("wm-event",this.handleEvent.bind(this))}return e.prototype.openFormDialog=function(){this.dialogService.open(this.dialogId)},e.prototype.onUpdate=function(e,t,n){this.editMode=n||this.editMode,this.form.operationType=i.Live_Operations.UPDATE,this.form.isSelected=!0;var o=this.currentFormData;e&&t&&(o=t.multiselect?e[0]:e[e.length-1]),this.form.setFormData(o),this.form.edit(),this.editMode||(this.form.isUpdateMode=!1)},e.prototype.onInsert=function(){this.form.operationType=i.Live_Operations.INSERT,this.form.isSelected=!0,this.form.setFormData({}),this.form.new()},e.prototype.handleEvent=function(e){if(this.dependson===e.widgetName)switch(this.currentOp=e.eventName,e.eventName){case i.Live_Operations.UPDATE:this.currentFormData=e.row,this.isLayoutDialog?this.openFormDialog():this.onUpdate(void 0,void 0,!0);break;case i.Live_Operations.INSERT:this.isLayoutDialog?this.openFormDialog():this.onInsert();break;case i.Live_Operations.DELETE:this.app.Widgets[this.dependson].call("delete",{row:e.row});break;case i.Live_Operations.READ:this.isLayoutDialog||(this.form.isUpdateMode=!1);break;case"rerender":e.dataSource&&e.dataSource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list"});break;case"selectedItemChange":e.table&&this.onUpdate(e.row,e.table);break;case"resetEditMode":this.editMode=!1}},e.prototype.onFormRender=function(){var e=this;this.form&&this.isLayoutDialog&&(this.form.isLayoutDialog=!0,setTimeout((function(){e.currentOp===i.Live_Operations.UPDATE?e.onUpdate(void 0,void 0,!0):e.currentOp===i.Live_Operations.INSERT&&e.onInsert()}),250))},e.prototype.ngAfterContentInit=function(){var e=this;this.formChildren.first?this.form=this.formChildren.first:this.formSubscription=this.formChildren.changes.subscribe((function(t){e.form=t.first,e.onFormRender()})),this.app.notify("setup-cud-listener",this.dependson)},e.prototype.ngOnDestroy=function(){this.formSubscription&&this.formSubscription.unsubscribe(),this.eventSubscription&&this.eventSubscription()},e}();U.decorators=[{type:t.Directive,args:[{selector:"[dependson]"}]}],U.ctorParameters=function(){return[{type:String,decorators:[{type:t.Attribute,args:["dialogid"]}]},{type:String,decorators:[{type:t.Attribute,args:["dependson"]}]},{type:l.AbstractDialogService},{type:l.App}]},U.propDecorators={formChildren:[{type:t.ContentChildren,args:[N,{descendants:!0}]}]};var q="EMPTY_NULL_FILTER",z=function(){function e(e){var t=this;this.form=e,this._filter=l.debounce((function(e){t.filter(e)}),250),e.clearFilter=this.clearFilter.bind(this),e.applyFilter=this.applyFilter.bind(this),e.filter=this.filter.bind(this),e.filterOnDefault=this.filterOnDefault.bind(this),e.execute=this.execute.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onMaxDefaultValueChange=this.onMaxDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.registerFormWidget=this.registerFormWidget.bind(this)}return e.prototype.execute=function(e,t){return e===l.DataSource.Operation.LIST_RECORDS||e===l.DataSource.Operation.DOWNLOAD?this.applyFilter(t):e===l.DataSource.Operation.GET_OPTIONS?this._options||{}:e===l.DataSource.Operation.GET_PAGING_OPTIONS?this.form.pagination:this.form.datasource?e===l.DataSource.Operation.FETCH_DISTINCT_VALUES?i.fetchDistinctValues(this.form.datasource,this.form.formFields,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter,EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}):this.form.datasource.execute(e,t):{}},e.prototype.onFieldDefaultValueChange=function(e,t){e.minValue=t,e.value=t,this.filterOnDefault()},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t,{EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}),this.form.autoupdate&&l.isDefined(t)&&this._filter()},e.prototype.onMaxDefaultValueChange=function(){var e=this;setTimeout((function(){e.filterOnDefault()}))},e.prototype.onDataSourceChange=function(){var e=this,t=this.form.datasource;t&&(this.form.formFields.forEach((function(n){i.isDataSetWidget(n.widgettype)&&(i.getDistinctValuesForField(t,n.widget,{widget:"widgettype",enableemptyfilter:e.form.enableemptyfilter,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}),i.applyFilterOnField(t,n.widget,e.form.formFields,n.value,{isFirst:!0,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}))})),this._filter(this._options))},e.prototype.clearFilter=function(){var e=this;this.form.resetFormState(),this.form.formFields.forEach((function(t){!t.readonly&&t.show&&(t.widgettype!==l.FormWidgetType.AUTOCOMPLETE&&t.widgettype!==l.FormWidgetType.TYPEAHEAD||e.form.$element.find("div[name="+t.name+"] input").val(""),t["is-range"]?(t.minValue="",t.maxValue=""):(t.value="",t.resetDisplayInput()))})),setTimeout((function(){e._filter()}))},e.prototype.submitForm=function(){this.filter()},e.prototype.applyFilter=function(e){return(e=e?e.data||e:{}).page=e.page||1,e.orderBy=l.isDefined(e.orderBy)?e.orderBy:this.orderBy,this.filter(e)},e.prototype.filter=function(e){var t=this;if(this.form.datasource){var n,o,a={},r={},s=1;s=(e=e||{}).page||s,n=l.isDefined(e.orderBy)?e.orderBy:this.orderBy||"",this.orderBy=n,this.form.formFields.forEach((function(e){var n,i="div[name="+e.name+"] input",o=t.form.$element;if((e.widgettype===l.FormWidgetType.AUTOCOMPLETE||e.widgettype===l.FormWidgetType.TYPEAHEAD)&&o)return n=o.find(i),void(e["is-range"]?r[e.field]={minValue:l.isDefined(e.minValue)?e.minValue:n.first().val(),maxValue:l.isDefined(e.maxValue)?e.maxValue:n.last().val()}:r[e.field]={value:l.isDefined(e.value)?e.value:n.val()});e["is-range"]?r[e.field]={minValue:e.minValue,maxValue:e.maxValue}:r[e.field]={value:e.value}}));try{if(!1===(o=this.form.invokeEventCallback("beforeservicecall",{$data:r})))return;if(o&&o.error)return void this.form.toggleMessage(!0,o.error,"error","ERROR");this.form.formFields.forEach((function(e){e["is-range"]?(e._minValue=r[e.field].minValue,e._maxValue=r[e.field].maxValue):e._value=r[e.field].value}))}catch(e){if("Abort"===e.message)return}return this.form.formFields.forEach((function(e){var n,o,r=e.field,s=e._minValue,c=e._maxValue;if(e["is-related"]&&(r+="."+e["lookup-field"]),e["is-range"])n=i.getRangeFieldValue(s,c),o=i.getRangeMatchMode(s,c),l.isDefined(n)&&(a[r]={value:n,matchMode:o,logicalOp:"AND"});else{switch(e.widgettype){case l.FormWidgetType.SELECT:case l.FormWidgetType.RADIOSET:i.getEnableEmptyFilter(t.form.enableemptyfilter)&&e._value===q?(o=i.getEmptyMatchMode(t.form.enableemptyfilter),n=e._value):e.type===l.DataType.BOOLEAN?l.isDefined(e._value)&&""!==e._value&&(n=JSON.parse(e._value)):n=e._value;break;case l.FormWidgetType.CHECKBOXSET:case l.FormWidgetType.CHIPS:e._value&&e._value.length&&(n=e._value);break;case l.FormWidgetType.CHECKBOX:case l.FormWidgetType.TOGGLE:l.isDefined(e._value)&&""!==e._value&&(n=e.type===l.DataType.BOOLEAN?JSON.parse(e._value):e._value);break;default:n=e._value}l.isDefined(n)&&""!==n&&null!==n&&(a[r]={},o?(a[r].matchMode=o,n=void 0):(e.type===l.DataType.STRING||e.isRelated)&&(a[r].matchMode=o||e.matchmode||t.form.datasource.execute(l.DataSource.Operation.GET_MATCH_MODE)),a[r].value=n,a[r].logicalOp="AND",a[r].type=e.type)}})),e.exportType?this.form.datasource.execute(l.DataSource.Operation.DOWNLOAD,{data:{matchMode:"anywhereignorecase",filterFields:a,orderBy:n,exportType:e.exportType,logicalOp:"AND",exportSize:e.exportSize,fields:e.fields,fileName:e.fileName}}):this.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{filterFields:a,orderBy:n,page:s,pagesize:this.form.pagesize||20,skipDataSetUpdate:!0,inFlightBehavior:"executeAll"}).then((function(e){var i=e.data;return t.form.pagination=e.pagination,i.error?(t.form.toggleMessage(!0,i.error,"error","ERROR"),t.form.onResultCb(i,!1)):(t._options={page:s,orderBy:n},t.form.result=l.getClonedObject(i),t.form.onResultCb(i,!0)),l.$appDigest(),t.form.result}),(function(e){return t.form.toggleMessage(!0,e,"error","ERROR"),t.form.onResultCb(e,!1),e}))}},e.prototype.filterOnDefault=function(){_.find(this.form.formFields,(function(e){return l.isDefined(e.value)||l.isDefined(e.minValue)||l.isDefined(e.maxValue)}))&&this._filter(this._options)},e.prototype.registerFormWidget=function(e){var t=e.key||e.name;this.form.filterWidgets[t]=e},e}();z.initializeProps=E(),z.decorators=[{type:t.Directive,args:[{selector:"[wmLiveFilter]"}]}],z.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[N]}]}]};var H=function(e){return e.widgettype===l.DataType.TIME||e.type===l.DataType.TIME&&!e.widgettype},Y=H,K=function(e){if(e){var t=(new Date).toDateString();return new Date(t+" "+e).getTime()}},Q=K,Z=function(){function e(e,t,n,i,o){var a=this;this.form=e,this.datePipe=n,this.dialogService=i,this._debouncedSavePrevDataValues=l.debounce((function(){a.savePrevDataValues()}),250),t&&!this.form.parentForm?(this.form._liveTableParent=t,this.form.isLayoutDialog=t.isLayoutDialog,t.onFormReady(this.form)):this.form.isLayoutDialog="dialog"===o,e.cancel=this.cancel.bind(this),e.reset=this.reset.bind(this),e.delete=this.delete.bind(this),e.save=this.save.bind(this),e.saveAndNew=this.saveAndNew.bind(this),e.saveAndView=this.saveAndView.bind(this),e.setPrimaryKey=this.setPrimaryKey.bind(this),e.constructDataObject=this.constructDataObject.bind(this),e.changeDataObject=this.setFormData.bind(this),e.setFormData=this.setFormData.bind(this),e.findOperationType=this.findOperationType.bind(this),e.clearData=this.clearData.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.form_registerFormFields=e.registerFormFields,e.registerFormFields=this.registerFormFields.bind(this)}return e.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},e.prototype.registerFormFields=function(e){var t=this.form.getFormFields();this.form.form_registerFormFields(e),this.form.isDataSourceUpdated&&this._updateFieldOnDataSourceChange(e,t)},e.prototype._updateFieldOnDataSourceChange=function(e,t){!e.isDataSetBound&&i.isDataSetWidget(e.widgettype)&&(e["is-related"]?(e.isDataSetBound=!0,i.fetchRelatedFieldData(this.form.datasource,e.widget,{relatedField:e.key,datafield:i.ALLFIELDS,widget:"widgettype"})):(i.getDistinctValuesForField(this.form.datasource,e.widget,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter}),i.applyFilterOnField(this.form.datasource,e.widget,t,e.value,{isFirst:!0})))},e.prototype.onDataSourceChange=function(){var e=this;_.get(this.form.formFields,"length")&&(this.form.isDataSourceUpdated=!0);var t=this.form.getFormFields();t.forEach((function(n){e._updateFieldOnDataSourceChange(n,t)}))},e.prototype.onFieldDefaultValueChange=function(e,t){"update"!==this.form.operationType&&(l.isDefined(t)&&null!==t&&""!==t&&"null"!==t?e.value=i.parseValueByType(t,e.type,e.widgettype,e.trailingzero):e.value=void 0,this.form.dirty&&!this._triggeredByUser&&this.form.markAsPristine(),this._debouncedSavePrevDataValues())},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t)},e.prototype.getBlobURL=function(e,t,n){var i,o="";return null!=n&&this.form.datasource?(i=e[(this.form.datasource.execute(l.DataSource.Operation.GET_PRIMARY_KEY)||[])[0]],o+=this.form.datasource.execute(l.DataSource.Operation.GET_BLOB_URL,{primaryValue:i,columnName:t}),o+="?"+Math.random()):o},e.prototype.setFormData=function(e,t){var n=this;e&&((t=t||this.form.formFields).forEach((function(t){var i=_.get(e,t.key||t.name);H(t)?t.value=K(i):t.type===l.DataType.BLOB?(n.form.resetFileUploadWidget(t,!0),t.href=n.getBlobURL(e,t.key,i),t.value=_.isString(i)?"":i):n.form.setFieldValue(t,e)})),this.savePrevDataValues(),this.form.constructDataObject())},e.prototype.onDataSourceUpdate=function(e,t,n){t?this.form.new():(this.form.setFormData(e),this.closeDialog()),this.form.isUpdateMode=!l.isDefined(n)||n},e.prototype.savePrevformFields=function(){this.form.prevformFields=l.getClonedObject(this.form.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},e.prototype.getPrevformFields=function(){var e=this;this.form.formFields.map((function(t){var n=e.form.prevformFields.find((function(e){return e.key===t.key}));t.value=n.value}))},e.prototype.getDataObject=function(){return this.form.operationType===i.Live_Operations.INSERT?{}:l.isDefined(this.form.prevDataObject)&&!l.isEmptyObject(this.form.prevDataObject)?l.getClonedObject(this.form.prevDataObject):l.getClonedObject(this.form.formdata||{})},e.prototype.constructDataObject=function(e){var t=this,n=this.getDataObject(),i=this.form.name;return(e?this.form.prevformFields:this.form.getFormFields()).forEach((function(e){var o,a,r=_.split(e.key,"."),s=r[0]||e.key;e.widgettype&&l.isDateTimeType(e.widgettype)||l.isDateTimeType(e.type)?e.value?(o=l.getValidDateObject(e.value),a=e.outputformat===l.DataType.TIMESTAMP||e.type===l.DataType.TIMESTAMP?e.value?o:null:e.outputformat?t.datePipe.transform(o,e.outputformat):e.value):a=void 0:a=e.type===l.DataType.BLOB?l.getFiles(i,s+"_formWidget",e.multiple):e.type===l.DataType.LIST?e.value||void 0:null===e.value||""===e.value?void 0:e.value,1===r.length?n[s]=a:(n[s]=n[s]||{},n[s][r[1]]=a)})),e?n:(this.form.updateFormDataOutput(n),this.form.dataoutput)},e.prototype.setPrimaryKey=function(e){this.form.primaryKey=this.form.primaryKey||[],-1===this.form.primaryKey.indexOf(e)&&this.form.primaryKey.push(e)},e.prototype.findOperationType=function(){var e,t=this,n=!1,o=this.form.datasource&&this.form.datasource.execute(l.DataSource.Operation.GET_OPERATION_TYPE);return o&&"read"!==o?o:(this.form.primaryKey&&!_.isEmpty(this.form.formdata)&&(1===this.form.primaryKey.length?this.form.formdata[this.form.primaryKey[0]]&&(e=i.Live_Operations.UPDATE):0===this.form.primaryKey.length?(_.forEach(this.form.formdata,(function(e){e&&(n=!0)})),n&&(e=i.Live_Operations.UPDATE)):(n=_.some(this.form.primaryKey,(function(e){if(t.form.formdata[e])return!0})))&&(e=i.Live_Operations.UPDATE)),e||i.Live_Operations.INSERT)},e.prototype.getPrevDataValues=function(){var e=_.fromPairs(_.map(this.form.prevDataValues,(function(e){return[e.key,e.value]})));return this.form.formFields.forEach((function(t){t.value=e[t.key]||"",t.resetDisplayInput()})),e},e.prototype.savePrevDataValues=function(){this.form.prevDataValues=this.form.formFields.map((function(e){return{key:e.key,value:e.value}}))},e.prototype.clearData=function(){this.form.toggleMessage(!1),this.form.emptyDataModel()},e.prototype.setReadonlyFields=function(){this.form.formFields.forEach((function(e){e.setReadOnlyState()}))},e.prototype.reset=function(){var e,t=this;this.form.resetFormState(),e=this.getPrevDataValues(),this.form.formFields.forEach((function(n){var i;n.type!==l.DataType.BLOB&&"upload"!==n.widgettype||(t.form.resetFileUploadWidget(n,!0),n.href=t.getBlobURL(e,n.key,n.value)),null===(i=n.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid")})),this.form.constructDataObject()},e.prototype.closeDialog=function(){this.form.isLayoutDialog&&this.dialogService.close(this.form.dialogId)},e.prototype.cancel=function(){this.form.clearMessage(),this.form.isUpdateMode=!1,this.form.reset(),this.form.isSelected&&this.getPrevformFields(),this.form.isUpdateMode=!1,this.form._liveTableParent?this.form._liveTableParent.onCancel():this.closeDialog(),l.$appDigest()},e.prototype.delete=function(e){this.form.resetFormState(),this.form.operationType=i.Live_Operations.DELETE,this.form.prevDataObject=l.getClonedObject(this.form.formdata||{}),this.form.save(void 0,void 0,void 0,e)},e.prototype.saveAndNew=function(){this.save(void 0,!0,!0)},e.prototype.saveAndView=function(){this.save(void 0,!1)},e.prototype.submitForm=function(e){this.save(e)},e.prototype.save=function(e,t,n){var o=this;if(this.form.datasource){var a,r,s,c,p={};if(s=this.form.operationType=this.form.operationType||this.findOperationType(),!this.form.validateFieldsOnSubmit()){a=l.getClonedObject(this.form.constructDataObject()),r=this.form.prevformFields?this.form.constructDataObject(!0):a;try{if(!1===(c=this.form.invokeEventCallback("beforeservicecall",{$event:e,$operation:this.form.operationType,$data:a,options:p})))return;if(c&&c.error)return void this.form.toggleMessage(!0,c.error,"error")}catch(e){if("Abort"===e.message)return}if(this.form.operationType===i.Live_Operations.UPDATE&&this.form.ngform&&this.form.ngform.pristine&&this.form.isSelected&&_.isEqual(a,r))return this.form.toggleMessage(!0,this.form.appLocale.MESSAGE_NO_CHANGES,"info",""),void l.$appDigest();p.row=a,p.transform=!0,p.skipNotification=!0,s===i.Live_Operations.UPDATE&&(p.rowData=this.form.formdata,p.prevData=r),i.performDataOperation(this.form.datasource,p,{operationType:s}).then((function(e){var a,r=s===i.Live_Operations.INSERT?o.form.insertmessage:s===i.Live_Operations.UPDATE?o.form.updatemessage:o.form.deletemessage;return s===i.Live_Operations.DELETE?(a=p.row,o.form.emptyDataModel(),o.form.prevDataValues=[],o.form.isSelected=!1):a=e,o.form.onSuccess||o.form.toggleMessage(!0,r,"success"),o.form._liveTableParent?o.form._liveTableParent.onResult(s,e,n,t):(o.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}),o.onDataSourceUpdate(e,n,t)),{result:a,status:!0}}),(function(e){return o.form.onError||o.form.toggleMessage(!0,e,"error"),l.$appDigest(),{result:e,status:!1}})).then((function(t){o.form.resetFormState(),o.form.onResultCb(t.result,t.status,e)}))}}},e}();Z.initializeProps=O(),Z.decorators=[{type:t.Directive,args:[{selector:"[wmLiveForm]"}]}],Z.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[N]}]},{type:h.LiveTableComponent,decorators:[{type:t.Optional}]},{type:i.ToDatePipe},{type:l.AbstractDialogService},{type:String,decorators:[{type:t.Attribute,args:["formlayout"]}]}]},Z.propDecorators={onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var J=[N,k,F,V,W,U,z,Z],X=function(){};X.decorators=[{type:t.NgModule,args:[{imports:[o.BasicModule,n.CommonModule,r.DesignDialogModule,a.InputModule,i.WmComponentsModule],declarations:b([],y(J)),exports:b([],y(J)),entryComponents:[]}]}],e.DependsonDirective=U,e.FormActionDirective=F,e.FormComponent=N,e.FormFieldDirective=V,e.FormModule=X,e.FormWidgetDirective=k,e.LiveActionsDirective=W,e.LiveFilterDirective=z,e.LiveFormDirective=Z,e["\u02750"]=Y,e["\u02751"]=Q,e["\u0275a"]=P,e["\u0275b"]=O,e["\u0275c"]=E,e["\u0275d"]=M,e["\u0275e"]=j,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/dialogs"),require("@wm/components/input"),require("@wm/core")):"function"==typeof define&&define.amd?define("@wm/components/dialogs/iframe-dialog",["exports","@angular/core","@angular/common","@wm/components/base","@wm/components/basic","@wm/components/dialogs","@wm/components/input","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.dialogs=e.wm.components.dialogs||{},e.wm.components.dialogs.iframedialog={}),e.ng.core,e.ng.common,e.wm.components.base,e.wm.components.basic,e.wm.components.dialogs,e.wm.components.input,e.wm.core)}(this,(function(e,t,n,i,o,a,r,s){"use strict";
|
|
548
|
+
***************************************************************************** */var m=function(e,t){return(m=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])})(e,t)};function f(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}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function g(e,t,n,i){return new(n||(n=Promise))((function(o,a){function r(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((i=i.apply(e,t||[])).next())}))}function v(e,t){var n,i,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}Object.create;function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function b(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var w=new Map([["autocomplete",Object.assign({value:!1},i.PROP_BOOLEAN)],["captionalign",Object.assign({value:"left"},i.PROP_STRING)],["captionposition",Object.assign({value:"left"},i.PROP_STRING)],["captionsize",i.PROP_STRING],["captionwidth",Object.assign({value:"xs-12 sm-3 md-3 lg-3"},i.PROP_STRING)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dataset",i.PROP_ANY],["datasource",i.PROP_STRING],["expanded",Object.assign({value:!0},i.PROP_BOOLEAN)],["formdatasource",i.PROP_STRING],["name",i.PROP_STRING],["numberOfFields",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showindevice",Object.assign({displayType:"inline-block",value:"all"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]),P=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("action",i.PROP_STRING),e.set("defaultmode",Object.assign({value:"Edit"},i.PROP_STRING)),e.set("metadata",i.PROP_STRING),e.set("method",i.PROP_STRING),e.set("postmessage",Object.assign({value:"Data posted successfully"},i.PROP_STRING)),e.set("target",i.PROP_STRING),e.set("enctype",i.PROP_STRING),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Inline"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-form",e)},O=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("defaultmode",Object.assign({value:"View"},i.PROP_STRING)),e.set("formlayout",Object.assign({value:"inline"},i.PROP_STRING)),e.set("insertmessage",Object.assign({value:"Record added successfully"},i.PROP_STRING)),e.set("updatemessage",Object.assign({value:"Record updated successfully"},i.PROP_STRING)),e.set("deletemessage",Object.assign({value:"Record deleted successfully"},i.PROP_STRING)),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Toaster"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-liveform",e)},E=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("autoupdate",i.PROP_BOOLEAN),e.set("enableemptyfilter",Object.assign({value:" "},i.PROP_STRING)),e.set("pagesize",Object.assign({value:20},i.PROP_NUMBER)),e.set("iconclass",Object.assign({value:"wi wi-filter-list"},i.PROP_STRING)),i.register("wm-livefilter",e)},R={widgetType:"wm-form",hostClass:"panel app-panel app-form"},A={widgetType:"wm-form",hostClass:"app-form app-login-form"},T={widgetType:"wm-liveform",hostClass:"panel app-panel app-liveform liveform-inline"},S={widgetType:"wm-livefilter",hostClass:"panel app-panel app-livefilter clearfix liveform-inline"},C=function(e,t,n){var i=R;return null!==e?i=T:null!==t?i=S:"app-login"===n&&(i=A),i},I=function(e,t){var n="";return _.forEach(e,(function(e,t){n=n+" "+t+'="'+e+'"'})),'<wm-gridcolumn columnwidth="'+t+'">\n <wm-form-field '+n+"></wm-form-field>\n </wm-gridcolumn>"},D=function(e,t){var n=e.find("form.ng-invalid:visible, [formControlName].ng-invalid:visible").first(),i=t;return n.is("form")&&(i=t&&t.controls[n.attr("formControlName")||n.attr("name")])?D(n,i):{ngForm:i,$ele:n}},x=function(e,t,n){var i,o;if(!t.valid)if(t.controls)_.forEach(t.controls,(function(t,n){x(e,t,n)}));else{var a=e.$element.find('[wmformfield][key="'+n+'"]');a.length||(a=e.$element.find('[wmformfield][name="'+n+'"]')),a.length&&(a[0].setAttribute("__errormsg",a[0].getAttribute("__validationId")),null===(i=a[0].querySelector("input"))||void 0===i||i.setAttribute("aria-invalid",t.invalid),null===(o=a[0].querySelector("input"))||void 0===o||o.setAttribute("aria-describedby",a[0].getAttribute("__validationId"))),t.markAsTouched()}},N=function(e){function t(t,n,o,a,r,s,c,p,d,u,h,m,f,g,v,y,b,w,P,O){var E=e.call(this,t,C(y,b,w))||this;E.fb=n,E.app=o,E.dialogService=a,E.dynamicComponentProvider=r,E.ngZone=s,E.parentList=c,E.parentForm=p,E.parentPrefab=d,E.parentPartial=u,E.onBeforeSubmitEvt=h,E.onSubmitEvt=m,E.onBeforeRenderEvt=f,E.binddataset=g,E.bindformdata=v,E._widgetClass="",E._captionClass="",E.formFields=[],E.formfields={},E.formWidgets={},E.filterWidgets={},E.buttonArray=[],E.dataoutput={},E.formdata={},E.statusMessage={caption:"",type:""},E.primaryKey=[],E._debouncedUpdateFieldSource=_.debounce(E.updateFieldSource,350),E.validationMessages=[],E._debouncedSubmitForm=l.debounce((function(e){E.ngZone.run((function(){E.submitForm(e)}))}),250),i.styler(E.nativeElement,E),l.removeAttr(E.nativeElement,"title"),E.isUpdateMode=!0,E.dialogId=E.nativeElement.getAttribute("dialogId"),E.ngform=n.group({}),E.bindingValue=P||O;var R=E.ngform.valueChanges.subscribe(E.updateDataOutput.bind(E));return E.registerDestroyListener((function(){return R.unsubscribe()})),E.elScope=E,E.addEventsToContext(E.context),E}return f(t,e),Object.defineProperty(t.prototype,"isLayoutDialog",{get:function(){return this._isLayoutDialog},set:function(e){e&&l.removeClass(this.nativeElement,"panel app-panel liveform-inline"),this._isLayoutDialog=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUpdateMode",{get:function(){return this._isUpdateMode},set:function(e){this._isUpdateMode=e,this.formFields.forEach((function(t){t.setReadOnlyState(e)}))},enumerable:!1,configurable:!0}),t.prototype.submit=function(e){this._debouncedSubmitForm(e)},t.prototype.onReset=function(){this.reset()},t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},Object.defineProperty(t.prototype,"parentFormArray",{get:function(){return this.parentForm&&this.isParentList&&this.parentForm.ngform.get(this.parentList.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isParentList",{get:function(){if(this.parentList&&this.parentForm&&!l.isDefined(this._formIsInList)){var e=this.$element.closest('.app-livelist[name="'+this.parentList.name+'"]');e.length&&(this._formIsInList=!e.find('form[widget-id="'+this.parentForm.widgetId+'"]').length)}return l.isDefined(this._formIsInList)?this._formIsInList:this.parentList},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;setTimeout((function(){e.componentRefs.forEach((function(t){t.name&&(e.formWidgets[t.name]=t)}))}),250)},t.prototype.ngAfterViewInit=function(){this.parentForm&&this.parentForm.ngform&&this.isParentList&&(_.get(this.parentForm.ngform.controls,this.parentList.name)||this.parentForm.ngform.setControl(this.parentList.name,new s.FormArray([])),this.parentFormArray.push(this.ngform),this.formArrayIndex=this.parentFormArray.length-1),this.addInnerNgFormToForm(this.bindingValue)},t.prototype.findOperationType=function(){},t.prototype.addInnerNgFormToForm=function(e){if(this.parentForm&&this.parentForm.ngform){if(this.isParentList)return;var t=this.parentPrefab||this.parentPartial;if(t){var n=(this.parentPrefab?t.$element.find("[wmprefabcontainer]"):t.$element).find("form").first();_.get(n[0],"widget.widgetId")===this.widgetId&&(n.isParentList||n.siblings("form").length||(e=_.get(t,"name")))}for(var i=1,o=e;this.parentForm.ngform.controls.hasOwnProperty(o);)o=e+"_"+i,i++;this.formGroupName=o,this.parentForm.ngform.addControl(o,this.ngform)}},t.prototype.addEventsToContext=function(e){var t=this;e.cancel=function(){return t.cancel()},e.reset=function(){return t.reset()},e.save=function(e){return t.save(e)},e.saveAndNew=function(){return t.saveAndNew()},e.saveAndView=function(){return t.saveAndView()},e.delete=function(){return t.delete()},e.new=function(){return t.new()},e.edit=function(){return t.edit()},e.highlightInvalidFields=function(){return t.highlightInvalidFields()},e.filter=function(){return t.filter()},e.clearFilter=function(){return t.clearFilter()},e.submit=function(e){return t.submit(e)}},t.prototype.setValidationOnInnerForms=function(e){var t=this,n=this.getNativeElement().querySelectorAll(".app-form");_.forEach(n,(function(n){var i=n.widget,o=_.get(i,"formGroupName")||i.name;l.isDefined(i.formArrayIndex)&&(o=o+"["+i.formArrayIndex+"]");for(var a=i;_.get(a,"parentForm");){var r=a.parentForm.formGroupName||a.parentForm.name;a.parentForm.parentFormArray&&(r=r+"["+a.parentForm.formArrayIndex+"]"),o=r+"."+o,a=a.parentForm}t.setValidationOnFields(i,o,e)}))},t.prototype.setValidationOnFields=function(e,t,n){var i=this,o=e.ngform.controls,a=e.formFields;a&&_.forEach(o,(function(o,r){var s,l=a.find((function(e){return e.key===r}));!l||n&&!o.touched||(null===(s=l.nativeElement.querySelector("input"))||void 0===s||s.setAttribute("aria-invalid",o.invalid),i.prepareValidationObj(o,r,l,t),i.prepareValidationObj.call(e,o,r,l,t))}))},t.prototype.prepareValidationObj=function(e,t,n,i){var o=this.validationMessages.findIndex((function(e){return e.field===t&&e.fullyQualifiedFormName===i}));e.invalid?-1===o?this.validationMessages.push({field:t,value:n.value,errorType:_.keys(e.errors),message:n.validationmessage||"",getElement:function(){return n.$element.find("[focus-target]")},formName:_.last(i.split(".")),fullyQualifiedFormName:i}):(this.validationMessages[o].value=n.value,this.validationMessages[o].errorType=_.keys(e.errors)):e.valid&&o>-1&&this.validationMessages.splice(o,1)},t.prototype.setValidationMsgs=function(e){!this.formFields.length&&_.isEmpty(this.ngform.controls)||(this.setValidationOnFields(this,this.name,e),this.setValidationOnInnerForms(e))},t.prototype.handleEvent=function(t,n,i,o){"submit"!==n&&e.prototype.handleEvent.call(this,this.nativeElement,n,i,o)},t.prototype.updateFieldSource=function(){var e=this;this.formdatasource&&this.formdatasource.execute(l.DataSource.Operation.IS_API_AWARE)||this.formdatasource&&!this.formdatasource.twoWayBinding||this.formFields.forEach((function(t){t.setFormWidget("datavaluesource",e.formdatasource),t.setFormWidget("binddatavalue",e.bindformdata+"."+t.key)}))},t.prototype.highlightInvalidFields=function(){x(this,this.ngform,"")},t.prototype.validateFieldsOnSubmit=function(){if(this.setValidationMsgs(),"delete"!==this.operationType&&("html"===this.validationtype||"default"===this.validationtype)&&this.ngform&&this.ngform.invalid){if(this.ngform.invalid){"default"===this.validationtype&&this.highlightInvalidFields();var e=D(this.$element,this.ngform),t=e.ngForm,n=e.$ele;if((n=n.parent().find("[focus-target]")).length){n.hasClass("app-search-input")||n.focus();var i=t&&t.controls[n.attr("formControlName")||n.attr("name")];return i&&i.markAsTouched&&i.markAsTouched(),l.$appDigest(),!0}return!0}return!1}return!1},t.prototype.onPropertyChange=function(t,n,i){switch(t){case"captionalign":this.captionAlignClass="align-"+n;break;case"captionposition":case"captionwidth":this.setLayoutConfig();break;case"captionsize":this.captionsize=n;break;case"novalidate":this.widget.validationtype=!0===n||"true"===n?"none":"default";break;case"formdata":if(_.isEqual(n,i))break;_.isArray(n)?this.setFormData(_.last(n)):this.setFormData(n),!this.isDataSourceUpdated&&this.datasource&&this.onDataSourceChange();break;case"defaultmode":this.isLayoutDialog||(this.updateMode=!(!n||"Edit"!==n),this.isUpdateMode=this.updateMode);break;case"datasource":this.onDataSourceChange();break;case"formdatasource":this.onFormDataSourceChange();break;case"metadata":this.generateFormFields();break;case"dataset":this.getFormFields().forEach((function(e){!e.isDataSetBound&&_.get(e.formWidget,"dataset$")&&e.formWidget.dataset$.next()}));break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onResultCb=function(e,t,n){var i={$event:n,$data:e,$operation:this.operationType};this.invokeEventCallback("result",i),t?this.invokeEventCallback("success",i):this.invokeEventCallback("error",i)},t.prototype.toggleMessage=function(e,t,n,i){var o;e&&t?(o="error"===n&&this.errormessage?this.errormessage:t,"Inline"===this.messagelayout?(o=this.checkAppServiceErrorMsg(n)||o,this.statusMessage={caption:o||"",type:n},this.messageRef&&this.messageRef.showMessage(this.statusMessage.caption,this.statusMessage.type),l.isElementInViewport(this.$element[0])||l.scrollToElement(this.$element[0])):this.app.notifyApp(o,n,i)):this.statusMessage.caption=""},t.prototype.checkAppServiceErrorMsg=function(e){var t=_.get(this.app,"Actions.appNotification");if(t&&"error"===e)return t.getMessage()},t.prototype.clearMessage=function(){this.toggleMessage(!1)},t.prototype.setLayoutConfig=function(){var e;e=i.getFieldLayoutConfig(this.captionwidth,this.captionposition,_.get(this.app.selectedViewPort,"os")),this._widgetClass=e.widgetCls,this._captionClass=e.captionCls,l.$appDigest()},t.prototype.registerFormWidget=function(e){var t=e.name||e.key;this.formWidgets[t]=e},t.prototype.registerFormFields=function(e){var t=this.formFields.push(e);this.formfields[e.key]=e,this.registerFormWidget(e),this._debouncedUpdateFieldSource(),this.parentForm&&(this.parentForm.formFields.push(e),this.parentForm.formfields[e.key]=e,this.parentForm.setFormData(this.parentForm.formdata,this.formFields,this.formdata||{})),t!==this.numberOfFields||_.isEmpty(this.formdata)||(this.onDataSourceChange(),_.isArray(this.formdata)?this.setFormData(_.last(this.formdata)):this.setFormData(this.formdata))},t.prototype.registerActions=function(e){this.buttonArray.push(e)},t.prototype.updateFormDataOutput=function(e){var t=this;_.forEach(this.ngform.value,(function(n,i){_.find(t.formFields,{key:i})||(e[i]=n)})),this.dataoutput=e},t.prototype.constructDataObject=function(){var e=this,t={};return this.getFormFields().forEach((function(n){var i,o;if(o=null===(o=n.datavalue||n._control.value)||""===o?void 0:o,"file"===n.type&&(o=l.getFiles(e.name,n.key+"_formWidget",n.multiple)),i=n.key||n.target||n.name,n.form.widgetId!==e.widgetId&&n.form.formGroupName)(a=_.get(t,n.form.formGroupName,{}))[i]=o,_.set(t,n.form.formGroupName,a);else if(n.form.isParentList){var a;(a=_.get(t,n.form.parentList.name,[]))[n.form.formArrayIndex]=a[n.form.formArrayIndex]||{},a[n.form.formArrayIndex][i]=o,_.set(t,n.form.parentList.name,a)}else _.set(t,i,o)})),this.updateFormDataOutput(t),this.dataoutput},t.prototype.updateDataOutput=function(){this.constructDataObject(),this.ngform.touched&&this.setValidationMsgs(!0)},t.prototype.getFormFields=function(){var e=this;return _.filter(this.formFields,(function(t){return t.form.name===e.name}))},t.prototype.setFieldValue=function(e,t,n){var i=e.key||e.name,o=n||t;o&&((o.hasOwnProperty(i)||_.includes(i,".")&&o.hasOwnProperty(_.split(i,".")[0]))&&(e.value=_.get(o,i)),this.dirty&&!this._triggeredByUser&&this.markAsPristine());var a=e.form.formGroupName;a&&_.get(t,a)&&this.setFormData.call(e.form,t[a]),_.get(e.form,"parentFormArray")&&this.setFormDataFromParentFormData.call(e.form,t)},t.prototype.setFormData=function(e,t,n){var i=this;(t||this.formFields).forEach((function(t){i.setFieldValue(t,e,n),t.fieldValidations&&t.fieldValidations.setCustomValidationMessage()})),this.constructDataObject()},t.prototype.resetFormState=function(){this.validationMessages.length&&(this.validationMessages=[]),this.ngform&&(this.ngform.markAsUntouched(),this.ngform.markAsPristine())},t.prototype.reset=function(){var e=this;this.resetFormState(),this.formFields.forEach((function(t){var n;t.value="","upload"!==t.widgettype&&t.type!==l.DataType.BLOB||e.resetFileUploadWidget(t,!0),null===(n=t.nativeElement.querySelector("input"))||void 0===n||n.removeAttribute("aria-invalid")})),this.constructDataObject(),this.clearMessage()},t.prototype.savePrevformFields=function(){this.prevformFields=l.getClonedObject(this.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},t.prototype.savePrevDataValues=function(){this.prevDataValues=this.formFields.map((function(e){return{key:e.key,value:e.value}}))},t.prototype.setReadonlyFields=function(){this.formFields.forEach((function(e){e.setReadOnlyState()}))},t.prototype.resetFileUploadWidget=function(e,t){this.$element.find('[name="'+e.key+'_formWidget"]').val(""),e._control.reset(),t||(e.href="",e.value=null)},t.prototype.emptyDataModel=function(){var e=this;this.formFields.forEach((function(t){l.isDefined(t)&&(t.type===l.DataType.BLOB?e.resetFileUploadWidget(t):t.datavalue="")}))},t.prototype.setDefaultValues=function(){var e=this;this.formFields.forEach((function(t){e.onFieldDefaultValueChange(t,t.defaultvalue)}))},t.prototype.setOperationType=function(e){this.operationType=e||"insert"},t.prototype.new=function(){var e=this;this.resetFormState(),this.operationType=i.Live_Operations.INSERT,this.clearMessage(),this.isSelected&&this.savePrevformFields(),this.emptyDataModel(),setTimeout((function(){e.setDefaultValues(),e.savePrevDataValues(),e.constructDataObject()})),this.isUpdateMode=!0},t.prototype.edit=function(){this.resetFormState(),this.clearMessage(),this.operationType=i.Live_Operations.UPDATE,this.isSelected&&(this.savePrevformFields(),this.savePrevDataValues()),this.prevDataObject=l.getClonedObject(this.formdata||{}),this.setReadonlyFields(),this.isUpdateMode=!0,l.$appDigest()},t.prototype.triggerWMEvent=function(e){var t=this.nativeElement.getAttribute("dependson");t&&(l.$invokeWatchers(!0),this.app.notify("wm-event",{eventName:e,widgetName:t}))},t.prototype.submitForm=function(e){var t,n,o,a=this,r=this.datasource;if(!this.validateFieldsOnSubmit()){n=l.getClonedObject(this.constructDataObject());var s=function(){return{$event:e,$formData:n,$data:n}};if(this.onBeforeSubmitEvt){if(!1===this.invokeEventCallback("beforesubmit",s()))return;this.resetFormState()}else this.resetFormState();if(this.onSubmitEvt||r)if(r){var c=r.pagination&&r.pagination.number+1,p=this.operationType?this.operationType:"insert";i.performDataOperation(r,n,{operationType:p}).then((function(e){return"wm.CrudVariable"===r.category&&(a.triggerWMEvent("resetEditMode"),a.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list",page:c,preventMissingOpMsg:!0}),a.dialogId&&a.closeDialog()),l.isDefined(e.body)?(o=l.getValidJSON(e.body),o=l.isDefined(o)?o:e.body):o=e,{result:o,status:!0,message:a.postmessage,type:"success"}}),(function(e){return t=a.errormessage||e.error||e,l.$appDigest(),{result:_.get(e,"error")||e,status:!1,message:t,type:"error"}})).then((function(t){("error"===t.type&&!a.onError||"success"===t.type&&!a.onSuccess)&&a.toggleMessage(!0,t.message,t.type),a.invokeEventCallback("submit",s()),a.onResultCb(t.result,t.status,e)}))}else this.invokeEventCallback("submit",s()),this.onResultCb({},!0,e);else this.onResultCb({},!0,e)}},t.prototype.closeDialog=function(){this.dialogService.close(this.dialogId)},t.prototype.showButtons=function(e){var t=this;return _.some(this.buttonArray,(function(n){return _.includes(n.position,e)&&n.updateMode===t.isUpdateMode}))},t.prototype.expandCollapsePanel=function(){this.collapsible&&(this.expanded=!this.expanded)},t.prototype.onDataSourceUpdate=function(e,t,n){t?this.new():(this.setFormData(e),this.closeDialog()),this.isUpdateMode=!l.isDefined(n)||n},t.prototype.getNearestParentFormData=function(e){return e.parentForm?e.bindformdata||!_.get(e.parentForm,"formdata")||_.isEmpty(e.parentForm.formdata)?this.getNearestParentFormData(e.parentForm):e.parentForm.formdata:{}},t.prototype.setFormDataFromParentFormData=function(e){if(_.isEmpty(this.formdata)&&this.parentForm&&e)if(this.parentFormArray){var t=_.get(e,this.parentList.name);if(t)_.isArray(t)||(t=[t]),this.parentFormArray.patchValue(t),this.bindformdata||(this.formdata=t[this.formArrayIndex]),this.setFormData(this.formdata);else if(this.isParentList&&this.parentForm.formGroupName){var n=_.get(e,this.parentForm.formGroupName);this.setFormDataFromParentFormData(n)}}else this.setFormData(e)},t.prototype.onDataSourceChange=function(){if(_.get(this.formFields,"length")&&!this.bindformdata){this.isDataSourceUpdated=!0;var e=this.getNearestParentFormData(this);this.setFormDataFromParentFormData(e)}},t.prototype.onFormDataSourceChange=function(){this.updateFieldSource()},t.prototype.onFieldDefaultValueChange=function(e,t){e.value=i.parseValueByType(t,void 0,e.widgettype,e.trailingzero),this.dirty&&!this._triggeredByUser&&this.markAsPristine()},t.prototype.onFieldValueChange=function(){},t.prototype.generateFormFields=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,o,a,r,s,c,p,d;return v(this,(function(u){switch(u.label){case 0:if(_.isUndefined(this._isGridLayoutPresent)&&(this._isGridLayoutPresent=this.$element.find(".panel-body [wmlayoutgrid]").length>0),this._isGridLayoutPresent?(t=this.$element.find(".form-elements [wmlayoutgrid]").first(),e=Number(t.attr("columns"))||1):((t=this.$element.find(".form-elements .dynamic-form-container")).length||(this.$element.find(".form-elements").prepend('<div class="dynamic-form-container"></div>'),t=this.$element.find(".form-elements .dynamic-form-container")),e=1),n=12/e,i="",o=0,s=this.metadata?this.metadata.data||this.metadata:[],this.formFields=[],_.isEmpty(s))return[2];if(this.onBeforeRenderEvt&&(r=this.invokeEventCallback("beforerender",{$metadata:s}))&&(s=r),!_.isArray(s))return[2];for(;s[o];){for(c="",a=0;a<e;a++)s[o]&&(c+=I(s[o],n)),o++;i+="<wm-gridrow>"+c+"</wm-gridrow>"}return this._isGridLayoutPresent||(i="<wm-layoutgrid>"+i+"</wm-layoutgrid>"),this.dynamicFormRef.clear(),this._dynamicContext||(this._dynamicContext=Object.create(this.viewParent),this._dynamicContext.form=this),[4,this.dynamicComponentProvider.getComponentFactoryRef("app-form-dynamic-"+this.widgetId,i,{noCache:!0,transpile:!0})];case 1:return p=u.sent(),d=this.dynamicFormRef.createComponent(p,0,this.inj),l.extendProto(d.instance,this._dynamicContext),t[0].appendChild(d.location.nativeElement),this.setFormData(this.formdata),[2]}}))}))},Object.defineProperty(t.prototype,"mode",{get:function(){return this.operationType||this.findOperationType()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.ngform&&this.ngform.dirty},enumerable:!1,configurable:!0}),t.prototype.markAsPristine=function(e){void 0===e&&(e=!1),this.ngform.markAsPristine({onlySelf:e})},t.prototype.markAsDirty=function(e){void 0===e&&(e=!1),this.ngform.markAsDirty({onlySelf:e})},Object.defineProperty(t.prototype,"invalid",{get:function(){return this.ngform&&this.ngform.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"touched",{get:function(){return this.ngform&&this.ngform.touched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.ngform&&this.ngform.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pristine",{get:function(){return this.ngform&&this.ngform.pristine},enumerable:!1,configurable:!0}),t.prototype.markAsTouched=function(e){void 0===e&&(e=!1),this.ngform.markAsTouched({onlySelf:e})},t.prototype.markAsUntouched=function(e){void 0===e&&(e=!1),this.ngform.markAsUntouched({onlySelf:e})},t.prototype.invokeActionEvent=function(e,t){l.$parseEvent(t)(this.viewParent,Object.assign(this.context,{$event:e}))},t.prototype.ngOnDestroy=function(){var t=this.parentForm&&_.get(this.parentForm,"ngform.controls");t&&(_.get(this.parentList,"name")&&t.hasOwnProperty(this.parentList.name)&&this.parentForm.ngform.removeControl(this.parentList.name),this.formGroupName&&t.hasOwnProperty(this.formGroupName)?this.parentForm.ngform.removeControl(this.formGroupName):this.parentForm.ngform.removeControl(this.name)),e.prototype.ngOnDestroy.call(this)},t}(i.StylableComponent);N.initializeProps=P(),N.decorators=[{type:t.Component,args:[{selector:"form[wmForm]",template:'<ng-template #content><ng-content></ng-content></ng-template>\n\n<ng-container *ngIf="formlayout === \'page\'; then pageLayoutTemplate else defaultTemplate">\n</ng-container>\n\n<ng-template #defaultTemplate>\n <div class="panel-heading" *ngIf="!isLayoutDialog && (title || subheading || iconclass || showButtons(\'header\'))">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon" aria-hidden="true" [ngClass]="iconclass" *ngIf="iconclass"></i>\n </div>\n <div class="pull-left">\n <div class="heading" [innerHTML]="title"></div>\n <div class="description" [innerHTML]="subheading"></div>\n </div>\n <div class="form-action panel-actions basic-btn-grp">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'header\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n <button type="button" class="app-icon wi panel-action" *ngIf="collapsible" title="Collapse/Expand"\n [ngClass]="expanded ? \'wi-minus\': \'wi-plus\'" (click)="expandCollapsePanel();"></button>\n </div>\n </h3>\n </div>\n <div class="panel-body" [ngClass]="{\'form-elements\': isLayoutDialog, \'form-body\': !isLayoutDialog}" [class.hidden]="!expanded">\n <p wmMessage [hidden]="!statusMessage.caption.toString()" [attr.aria-hidden]="!statusMessage.caption" [attr.aria-label]="statusMessage.caption" caption.bind="statusMessage.caption" type.bind="statusMessage.type"></p>\n <div [ngClass]="{\'form-elements\': !isLayoutDialog, \'form-content\': isLayoutDialog}">\n <ng-container *ngTemplateOutlet="content"></ng-container>\n </div>\n <div class="basic-btn-grp form-action panel-footer clearfix" [ngClass]="{\'modal-footer\': isLayoutDialog}" [class.hidden]="!expanded || !showButtons(\'footer\')">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'footer\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #pageLayoutTemplate>\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</ng-template>\n\n<ng-template #buttonRef let-btn="btn">\n <button wmButton name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" type.bind="btn.type" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey" disabled.bind="ngform.status === \'PENDING\' || btn.disabled"\n tabindex.bind="btn.tabindex" [attr.aria-label]="btn.displayName" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></button>\n</ng-template>\n\n<ng-template #anchorRef let-btn="btn">\n <a wmAnchor name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey"\n hyperlink.bind="btn.hyperlink" target.bind="btn.target"\n tabindex.bind="btn.tabindex" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></a>\n</ng-template>\n\n<ng-container #dynamicForm></ng-container>\n',providers:[i.provideAsWidgetRef(N)]}]}],N.ctorParameters=function(){return[{type:t.Injector},{type:s.FormBuilder},{type:l.App},{type:l.AbstractDialogService},{type:l.DynamicComponentRefProvider},{type:t.NgZone},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:N,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:c.PrefabDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:i.PartialDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforesubmit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["submit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforerender.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["formdata.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveForm"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveFilter"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["data-role"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]}]},N.propDecorators={dynamicFormRef:[{type:t.ViewChild,args:["dynamicForm",{static:!0,read:t.ViewContainerRef}]}],messageRef:[{type:t.ViewChild,args:[i.MessageComponent]}],componentRefs:[{type:t.ContentChildren,args:[i.WidgetRef,{descendants:!0}]}],action:[{type:t.HostBinding,args:["action"]}],submit:[{type:t.HostListener,args:["submit",["$event"]]}],onReset:[{type:t.HostListener,args:["reset"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var k=function(){function e(e,t,n,i,o,a){var r=this;this.componentInstance=n,this.name=o,this.key=a,this.fb=i,this.parent=e||t,this.ngform=this.parent.ngform,this.componentInstance.registerPropertyChangeListener((function(e,t){"datavalue"===e&&r._control?r._control.setValue(t):"name"!==e||r._control||r.addControl(r.key||t)}))}return Object.defineProperty(e.prototype,"_control",{get:function(){var e=this.key||this.name;if(e)return this.ngform&&this.ngform.controls[e]},enumerable:!1,configurable:!0}),e.prototype.addControl=function(e){this.ngform.addControl(e,this.createControl())},e.prototype.createControl=function(){return this.fb.control(this.componentInstance.datavalue)},e.prototype.ngOnInit=function(){var e=this.key||this.name;e&&!this._control&&(this.addControl(e),this.parent.registerFormWidget(this.componentInstance))},e}();k.decorators=[{type:t.Directive,args:[{selector:"[wmFormWidget]"}]}],k.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[N]}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[d.TableComponent]}]},{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[i.WidgetRef]}]},{type:s.FormBuilder},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]}]};var M=function(){i.register("wm-form-action",new Map([["accessroles",i.PROP_STRING],["action",i.PROP_STRING],["class",i.PROP_STRING],["binding",i.PROP_STRING],["disabled",i.PROP_BOOLEAN],["display-name",i.PROP_STRING],["hyperlink",i.PROP_STRING],["iconclass",i.PROP_STRING],["iconname",i.PROP_STRING],["key",i.PROP_STRING],["position",Object.assign({value:"footer"},i.PROP_STRING)],["shortcutkey",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["target",i.PROP_STRING],["title",i.PROP_STRING],["type",Object.assign({value:"button"},i.PROP_STRING)],["update-mode",Object.assign({value:!0},i.PROP_BOOLEAN)],["widget-type",Object.assign({value:"button"},i.PROP_STRING)]]))},L={widgetType:"wm-form-action",hostClass:""},F=function(e){function t(t,n){var i=e.call(this,t,L)||this;return i.form=n,i}return f(t,e),t.prototype.populateAction=function(){this.buttonDef={key:this.key||this.binding,displayName:this["display-name"],show:this.show,class:this.class?this.class:"button"===this["widget-type"]?"btn-secondary":"",iconclass:this.iconclass||"",title:_.isUndefined(this.title)?this["display-name"]||"":this.title,action:this.action,accessroles:this.accessroles,shortcutkey:this.shortcutkey,disabled:this.disabled,tabindex:this.tabindex,iconname:this.iconname,type:this.type,updateMode:this["update-mode"],position:this.position,widgetType:this["widget-type"],hyperlink:this.hyperlink,target:this.target},this._propsInitialized=!0},t.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.populateAction(),this.form.registerActions(this.buttonDef)},t.prototype.onPropertyChange=function(e,t,n){if(this._propsInitialized)switch(e){case"display-name":this.buttonDef.displayName=t;default:this.buttonDef[e]=t}},t}(i.BaseComponent);F.initializeProps=M(),F.decorators=[{type:t.Directive,args:[{selector:"[wmFormAction]",providers:[i.provideAsWidgetRef(F)]}]}],F.ctorParameters=function(){return[{type:t.Injector},{type:N,decorators:[{type:t.Optional}]}]};var j=function(){var e=new Map([["dataentrymode",Object.assign({value:"default"},i.PROP_STRING)],["debouncetime",Object.assign({value:250},i.PROP_NUMBER)],["defaultvalue",i.PROP_STRING],["displayname",i.PROP_STRING],["display-name",i.PROP_STRING],["field",i.PROP_STRING],["filterexpressions",i.PROP_STRING],["filter-on",i.PROP_STRING],["generator",i.PROP_STRING],["hint",i.PROP_STRING],["inputtype",i.PROP_STRING],["is-primary-key",i.PROP_BOOLEAN],["is-range",i.PROP_BOOLEAN],["is-related",i.PROP_BOOLEAN],["isformfield",{value:!0}],["key",i.PROP_STRING],["limit",i.PROP_NUMBER],["lookup-type",i.PROP_STRING],["lookup-field",i.PROP_STRING],["name",i.PROP_STRING],["matchmode",i.PROP_STRING],["maxdefaultvalue",i.PROP_STRING],["maxplaceholder",i.PROP_STRING],["mobile-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["period",i.PROP_BOOLEAN],["pc-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["placeholder",i.PROP_STRING],["primary-key",i.PROP_BOOLEAN],["related-entity-name",i.PROP_STRING],["required",i.PROP_BOOLEAN],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tablet-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["type",i.PROP_STRING],["validationmessage",i.PROP_STRING],["viewmodewidget",i.PROP_STRING],["widgettype",i.PROP_STRING]]),t=function(t){var n="wm-form-field-"+l.FormWidgetType[t],o=i.getWidgetPropsByType(n);e.forEach((function(e,t){null==o.get(t)&&o.set(t,e)}))};for(var n in l.FormWidgetType)t(n)},B=function(){return{custom:!0}},G={image:"image/*",video:"video/*",audio:"audio/*"},V=function(e){function t(t,n,i,o,a,r,s,c,p,d,u,h,m,f,g,v,y,b,w){var P=this,_={widgetType:"wm-form-field",hostClass:"",widgetSubType:"wm-form-field-"+(u||l.FormWidgetType.TEXT).trim()},O=l.noop;return(P=e.call(this,t,_,new Promise((function(e){return O=e})))||this)._initPropsRes=O,P.app=a,P.fieldDefConfig={},P.class="",P.binddataset=c,P.binddisplayimagesrc=m,P.binddisplayexpression=p,P.bindChipclass=s,P.binddisplaylabel=d,P.form=n,P.fb=i,P.viewport=o,P._fieldName=f||h,P.isRange=g,P.excludeProps=new Set(["type","name"]),P.widgettype=u,P.parentList=r,P.notifyForFields=[],(P.binddataset||P.$element.attr("dataset"))&&(P.isDataSetBound=!0),w[0]._onFocusField=P._onFocusField.bind(P),w[0]._onBlurField=P._onBlurField.bind(P),P._debounceSetUpValidators=l.debounce((function(){return P.setUpValidators()}),500),P}return f(t,e),t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},t.prototype.handleClick=function(e){this._clicktriggeredByUser=!0},t.prototype._onFocusField=function(e){this._activeField=!0,$(e.target).closest(".live-field").addClass("active")},t.prototype._onBlurField=function(e){var t,n,i,o;$(e.target).closest(".live-field").removeClass("active");this.nativeElement.querySelector("p.text-danger");this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",""+this.ngform.controls[this._fieldName].invalid),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this._activeField=!1,this._triggeredByUser=!1,this._clicktriggeredByUser=!1},t.prototype.evaluateExpr=function(e,t,n){if(n&&t||(t=Object.keys(e)[0]))return i.getEvaluatedData(e,{field:t,expression:n},this.viewParent)},t.prototype.getDisplayExpr=function(){var e=this,t=[],n=this.value,i=this.displayfield||this.displaylabel,o=this.displayexpression;return _.isObject(n)?(_.isArray(n)?_.forEach(n,(function(n){_.isObject(n)&&t.push(e.evaluateExpr(n,i,o))})):t.push(this.evaluateExpr(n,i,o)),_.join(t,",")):null==n?"":this.value},t.prototype.getCaption=function(){return void 0===this.value||null===this.value?_.get(this.form.dataoutput,this._fieldName)||"":this.value},t.prototype.notifyChanges=function(){_.forEach(this.notifyForFields,(function(e){e.fieldValidations.validate()}))},t.prototype.observeOn=function(e){this.fieldValidations.observeOn(e,"formfields")},t.prototype.setUpValidators=function(e){this.fieldValidations.setUpValidators(e)},t.prototype.setAsyncValidators=function(e){this.fieldValidations.setAsyncValidators(e)},t.prototype.setValidators=function(e){this.fieldValidations.setValidators(e)},t.prototype.setFormWidget=function(e,t){this.formWidget&&this.formWidget.widget&&(this.formWidget.widget[e]=t)},t.prototype.boundFn=function(e){return e()},t.prototype.setMaxFormWidget=function(e,t){this.formWidgetMax&&(this.formWidgetMax.widget[e]=t)},t.prototype.onPropertyChange=function(t,n,i){var o=this.form.dirty;if("tabindex"!==t&&e.prototype.onPropertyChange.call(this,t,n,i),!this.excludeProps.has(t)){if(this.widgettype===l.FormWidgetType.UPLOAD)return"required"===t&&this._debounceSetUpValidators(),void e.prototype.onPropertyChange.call(this,t,n,i);switch(this.setFormWidget(t,n),"placeholder"!==t&&this.setMaxFormWidget(t,n),t){case"defaultvalue":this.form.onFieldDefaultValueChange(this,n);break;case"maxdefaultvalue":this.maxValue=n,this.setMaxFormWidget("datavalue",n),this.form.onMaxDefaultValueChange();break;case"maxplaceholder":this.setMaxFormWidget("placeholder",n);break;case"required":o!==this.form.dirty&&this.form.markAsPristine();case"maxchars":case"minvalue":case"maxvalue":case"regexp":case"show":this._debounceSetUpValidators();break;case"primary-key":n&&this.form.setPrimaryKey(this._fieldName);break;case"display-name":this.displayname=n;break;case"readonly":this.setReadOnlyState()}}},t.prototype.onStyleChange=function(t,n,i){this.setFormWidget(t,n),this.setMaxFormWidget(t,n),e.prototype.onStyleChange.call(this,t,n,i)},Object.defineProperty(t.prototype,"datavalue",{get:function(){return this.formWidget&&this.formWidget.datavalue},set:function(e){this._control&&this.widgettype!==l.FormWidgetType.UPLOAD&&this._control.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.datavalue},set:function(e){this.datavalue=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.formWidgetMax&&this.formWidgetMax.datavalue},set:function(e){this._maxControl&&this._maxControl.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minValue",{get:function(){return this.value},set:function(e){this.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_control",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_maxControl",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName+"_max"]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){return this.formWidget&&this.formWidget.displayValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timestamp",{get:function(){return this.formWidget&&this.formWidget.timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"charlength",{get:function(){return this.formWidget&&this.formWidget.charlength},enumerable:!1,configurable:!0}),t.prototype.createControl=function(){return this.fb.control(void 0,{validators:this._validators})},t.prototype.onValueChange=function(e){var t,n,i,o;if(!this.isDestroyed){var a=$(this.nativeElement).find(".caption-floating");if(a.length>0){var r=l.isDefined(e)&&""!==e&&null!==e||a.find("input").val()||a.find("input:-webkit-autofill").length;this.app.notify("captionPositionAnimate",{displayVal:r,nativeEl:a,isSelectMultiple:this.formWidget&&this.formWidget.multiple,isFocused:this._activeField})}this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",this._triggeredByUser&&this.ngform.controls[this._fieldName].invalid?"true":"false"),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this.form.onFieldValueChange(this,e),this.notifyChanges(),(this.$element.find(".active").length>0||this.form.touched)&&((this._triggeredByUser||l.isMobile()&&this._clicktriggeredByUser&&l.isDateTimeType(this.widgettype))&&this.ngform.controls[this._fieldName].markAsTouched(),this.fieldValidations.setCustomValidationMessage())}},t.prototype.onStatusChange=function(e){this.isDestroyed||(this.showPendingSpinner="PENDING"===e,"PENDING"===e?this.formWidget.disabled=!0:this.formWidget.disabled!==this.disabled&&(this.formWidget.disabled=this.disabled))},t.prototype.setValidationMessage=function(e){var t=this;setTimeout((function(){t.validationmessage=e,t.setUpValidators(B)}))},t.prototype.setReadOnlyState=function(){var e;e=!this.form.isUpdateMode||(!this["primary-key"]||this["is-related"]||this.period?this.readonly:!("assigned"===this.generator&&"update"!==this.form.operationType)),this.setFormWidget("readonly",e)},t.prototype.resetDisplayInput=function(){l.isDefined(this.value)&&""!==this.value||this.formWidget&&this.formWidget.resetDisplayInput&&this.formWidget.resetDisplayInput()},t.prototype.triggerUploadEvent=function(e,t){var n={$event:e};"change"===t&&(n.newVal=e.target.files,n.oldVal=this._oldUploadVal,this._oldUploadVal=n.newVal),this.invokeEventCallback(t,n)},t.prototype.registerFormField=function(){var e=this._fieldName;if(this.parentList&&this.form.parentList!==this.parentList){for(var t=1,n=e;this.ngform.controls.hasOwnProperty(n);)n=e+"_"+t,t++;this.ngform.addControl(n,this.createControl()),this._fieldName=n}else this.ngform.addControl(e,this.createControl());var i=this._control.valueChanges.pipe(u.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return i.unsubscribe()}));var o=this._control.statusChanges.pipe(u.debounceTime(100)).subscribe(this.onStatusChange.bind(this));if(this.registerDestroyListener((function(){return o.unsubscribe()})),"true"===this.isRange){this.ngform.addControl(e+"_max",this.createControl());var a=this._maxControl.valueChanges.pipe(u.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return a.unsubscribe()}))}this.value=_.get(this.form.formdata,this._fieldName)},t.prototype.ngOnInit=function(){this.ngform=this.form.ngform,this.registerFormField(),this.fieldValidations=new i.BaseFieldValidations(this,this.formWidget,this.widgettype,this._control,this.form),e.prototype.ngOnInit.call(this)},t.prototype.ngAfterContentInit=function(){var t=this;e.prototype.ngAfterContentInit.call(this),this.formWidget&&(this._initPropsRes(),this.setFormWidget("binddisplaylabel",this.binddisplaylabel),this.setFormWidget("binddisplayexpression",this.binddisplayexpression),this.setFormWidget("binddisplayimagesrc",this.binddisplayimagesrc),this.setFormWidget("bindChipclass",this.bindChipclass),this.setFormWidget("binddataset",this.binddataset)),this.registerReadyStateListener((function(){if(t.key=t._fieldName||t.target||t.binding,t.viewmodewidget=t.viewmodewidget||i.getDefaultViewModeWidget(t.widgettype),t.widgettype===l.FormWidgetType.UPLOAD){var e;e=t.filetype?G[t.filetype]:"",t.permitted=e+(t.extensions?(e?",":"")+t.extensions:"")}l.isMobile()&&t.viewport.isMobileType?t["mobile-display"]||(t.widget.show=!1):t.viewport.isTabletType?t["tablet-display"]||(t.widget.show=!1):t["pc-display"]||(t.widget.show=!1),t.fieldDefConfig.displaname=t.displayname,t.fieldDefConfig.show=t.show,t.fieldDefConfig.isRelated=t["is-related"],t.fieldDefConfig.inputtype=t.inputtype,t.fieldDefConfig.generator=t.generator,t.fieldDefConfig.placeholder=t.placeholder,t.fieldDefConfig.primaryKey=t["primary-key"],t.fieldDefConfig.required=t.required,t.fieldDefConfig._readonly=t.readonly,t.fieldDefConfig.regexp=t.regexp,t.fieldDefConfig.type=t.type,t.fieldDefConfig.key=t.key,t.fieldDefConfig.mobileDisplay=t["mobile-display"],t.fieldDefConfig.name=t.name,t.fieldDefConfig.pcDisplay=t["pc-display"],t.fieldDefConfig.tabletDisplay=t["tablet-display"],t.fieldDefConfig.validationmessage=t.validationmessage,t.fieldDefConfig.viewmodewidget=t.viewmodewidget,t.fieldDefConfig.widget=t.widgettype,t.form.registerFormFields(t.widget),l.addForIdAttributes(t.nativeElement),t.setReadOnlyState()}))},t}(i.StylableComponent);V.initializeProps=j(),V.decorators=[{type:t.Directive,args:[{selector:"[wmFormField]",exportAs:"wmFormField",providers:[i.provideAsWidgetRef(V),i.provideAs(V,s.NG_VALUE_ACCESSOR,!0),{provide:i.Context,useValue:{},multi:!0}]}]}],V.ctorParameters=function(){return[{type:t.Injector},{type:N},{type:s.FormBuilder},{type:l.Viewport},{type:l.App},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:String,decorators:[{type:t.Attribute,args:["chipclass.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayexpression.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displaylabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["widgettype"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayimagesrc.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["is-range"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["pc-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["mobile-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["tablet-display"]}]},{type:Array,decorators:[{type:t.Self},{type:t.Inject,args:[i.Context]}]}]},V.propDecorators={formWidget:[{type:t.ContentChild,args:["formWidget",{static:!0}]}],formWidgetMax:[{type:t.ContentChild,args:["formWidgetMax"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}],handleClick:[{type:t.HostListener,args:["click",["$event"]]}]};var W=function(){function e(e,t,n){this.subscribedWidget=e,this.app=t,this.dialogService=n,e.addRow=this.addRow.bind(this),e.updateRow=this.updateRow.bind(this),e.deleteRow=this.deleteRow.bind(this),e.call=this.call.bind(this)}return e.prototype.addRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.INSERT,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.updateRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.UPDATE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.deleteRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.DELETE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.successHandler=function(e,t){l.triggerFn(e.success,t)},e.prototype.errorHandler=function(e,t){this.app.notifyApp(t,"error","ERROR"),l.triggerFn(e.error,t)},e.prototype.getRecords=function(e,t){var n,o,a=this;"None"!==this.subscribedWidget.navigation&&this.subscribedWidget.dataNavigator?(o=this.subscribedWidget.dataNavigator,t===i.Live_Operations.DELETE?(o.dataSize-=1,o.calculatePagingValues(),n=o.pageCount<o.dn.currentPage?"prev":void 0):("last"===(n=t===i.Live_Operations.INSERT?"last":"current")&&(o.dataSize+=1),o.calculatePagingValues()),o.navigatePage(n,null,!0,(function(t){a.successHandler(e,t)}))):this.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(t){a.successHandler(e,t)}),(function(t){a.errorHandler(e,t)}))},e.prototype.performCUDOperation=function(e,t,n){var o=this;i.performDataOperation(this.subscribedWidget.datasource,e,{operationType:t}).then((function(e){e.error?o.errorHandler(n,e.error):("wm.CrudVariable"===o.subscribedWidget.datasource.category&&"delete"===t?o.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(e){o.successHandler(n,e)}),(function(e){o.errorHandler(n,e)})):o.getRecords(n,t),"delete"===t&&o.app.notifyApp(o.app.appLocale.MESSAGE_DELETE_RECORD_SUCCESS,"success"))}),(function(e){o.errorHandler(n,e)}))},e.prototype.insertRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.updateRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.deleteRecord=function(e,t,n){var i=this;this.dialogService.showAppConfirmDialog({title:this.app.appLocale.MESSAGE_DELETE_RECORD||"Delete Record",iconclass:"wi wi-delete fa-lg",message:this.subscribedWidget.confirmdelete||"Are you sure you want to delete this?",oktext:this.subscribedWidget.deleteoktext||"Ok",canceltext:this.subscribedWidget.deletecanceltext||"Cancel",onOk:function(){i.performCUDOperation(e,t,n),i.dialogService.closeAppConfirmDialog()},onCancel:function(){l.triggerFn(n.cancelDeleteCallback),i.dialogService.closeAppConfirmDialog()}})},e.prototype.performOperation=function(e,t){var n={row:t.row,prevData:{},rowData:{},transform:!0,skipNotification:!0};switch(e===i.Live_Operations.UPDATE&&(n.rowData=t.rowData,n.prevData=t.prevData),e){case i.Live_Operations.INSERT:this.insertRecord(n,e,t);break;case i.Live_Operations.UPDATE:this.updateRecord(n,e,t);break;case i.Live_Operations.DELETE:this.deleteRecord(n,e,t);break;case i.Live_Operations.READ:this.getRecords(t,e)}},e.prototype.call=function(e,t,n,i){t.success=n,t.error=i,this.performOperation(e,t)},e}();W.decorators=[{type:t.Directive,args:[{selector:"[wmLiveActions]"}]}],W.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[p.ListComponent]}]},{type:l.App},{type:l.AbstractDialogService}]};var U=function(){function e(e,t,n,i){this.dialogService=n,this.app=i,e&&(this.isLayoutDialog=!0,this.dialogId=e),this.dependson=t,this.eventSubscription=this.app.subscribe("wm-event",this.handleEvent.bind(this))}return e.prototype.openFormDialog=function(){this.dialogService.open(this.dialogId)},e.prototype.onUpdate=function(e,t,n){this.editMode=n||this.editMode,this.form.operationType=i.Live_Operations.UPDATE,this.form.isSelected=!0;var o=this.currentFormData;e&&t&&(o=t.multiselect?e[0]:e[e.length-1]),this.form.setFormData(o),this.form.edit(),this.editMode||(this.form.isUpdateMode=!1)},e.prototype.onInsert=function(){this.form.operationType=i.Live_Operations.INSERT,this.form.isSelected=!0,this.form.setFormData({}),this.form.new()},e.prototype.handleEvent=function(e){if(this.dependson===e.widgetName)switch(this.currentOp=e.eventName,e.eventName){case i.Live_Operations.UPDATE:this.currentFormData=e.row,this.isLayoutDialog?this.openFormDialog():this.onUpdate(void 0,void 0,!0);break;case i.Live_Operations.INSERT:this.isLayoutDialog?this.openFormDialog():this.onInsert();break;case i.Live_Operations.DELETE:this.app.Widgets[this.dependson].call("delete",{row:e.row});break;case i.Live_Operations.READ:this.isLayoutDialog||(this.form.isUpdateMode=!1);break;case"rerender":e.dataSource&&e.dataSource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list"});break;case"selectedItemChange":e.table&&this.onUpdate(e.row,e.table);break;case"resetEditMode":this.editMode=!1}},e.prototype.onFormRender=function(){var e=this;this.form&&this.isLayoutDialog&&(this.form.isLayoutDialog=!0,setTimeout((function(){e.currentOp===i.Live_Operations.UPDATE?e.onUpdate(void 0,void 0,!0):e.currentOp===i.Live_Operations.INSERT&&e.onInsert()}),250))},e.prototype.ngAfterContentInit=function(){var e=this;this.formChildren.first?this.form=this.formChildren.first:this.formSubscription=this.formChildren.changes.subscribe((function(t){e.form=t.first,e.onFormRender()})),this.app.notify("setup-cud-listener",this.dependson)},e.prototype.ngOnDestroy=function(){this.formSubscription&&this.formSubscription.unsubscribe(),this.eventSubscription&&this.eventSubscription()},e}();U.decorators=[{type:t.Directive,args:[{selector:"[dependson]"}]}],U.ctorParameters=function(){return[{type:String,decorators:[{type:t.Attribute,args:["dialogid"]}]},{type:String,decorators:[{type:t.Attribute,args:["dependson"]}]},{type:l.AbstractDialogService},{type:l.App}]},U.propDecorators={formChildren:[{type:t.ContentChildren,args:[N,{descendants:!0}]}]};var q="EMPTY_NULL_FILTER",z=function(){function e(e){var t=this;this.form=e,this._filter=l.debounce((function(e){t.filter(e)}),250),e.clearFilter=this.clearFilter.bind(this),e.applyFilter=this.applyFilter.bind(this),e.filter=this.filter.bind(this),e.filterOnDefault=this.filterOnDefault.bind(this),e.execute=this.execute.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onMaxDefaultValueChange=this.onMaxDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.registerFormWidget=this.registerFormWidget.bind(this)}return e.prototype.execute=function(e,t){return e===l.DataSource.Operation.LIST_RECORDS||e===l.DataSource.Operation.DOWNLOAD?this.applyFilter(t):e===l.DataSource.Operation.GET_OPTIONS?this._options||{}:e===l.DataSource.Operation.GET_PAGING_OPTIONS?this.form.pagination:this.form.datasource?e===l.DataSource.Operation.FETCH_DISTINCT_VALUES?i.fetchDistinctValues(this.form.datasource,this.form.formFields,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter,EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}):this.form.datasource.execute(e,t):{}},e.prototype.onFieldDefaultValueChange=function(e,t){e.minValue=t,e.value=t,this.filterOnDefault()},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t,{EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}),this.form.autoupdate&&l.isDefined(t)&&this._filter()},e.prototype.onMaxDefaultValueChange=function(){var e=this;setTimeout((function(){e.filterOnDefault()}))},e.prototype.onDataSourceChange=function(){var e=this,t=this.form.datasource;t&&(this.form.formFields.forEach((function(n){i.isDataSetWidget(n.widgettype)&&(i.getDistinctValuesForField(t,n.widget,{widget:"widgettype",enableemptyfilter:e.form.enableemptyfilter,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}),i.applyFilterOnField(t,n.widget,e.form.formFields,n.value,{isFirst:!0,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}))})),this._filter(this._options))},e.prototype.clearFilter=function(){var e=this;this.form.resetFormState(),this.form.formFields.forEach((function(t){!t.readonly&&t.show&&(t.widgettype!==l.FormWidgetType.AUTOCOMPLETE&&t.widgettype!==l.FormWidgetType.TYPEAHEAD||e.form.$element.find("div[name="+t.name+"] input").val(""),t["is-range"]?(t.minValue="",t.maxValue=""):(t.value="",t.resetDisplayInput()))})),setTimeout((function(){e._filter()}))},e.prototype.submitForm=function(){this.filter()},e.prototype.applyFilter=function(e){return(e=e?e.data||e:{}).page=e.page||1,e.orderBy=l.isDefined(e.orderBy)?e.orderBy:this.orderBy,this.filter(e)},e.prototype.filter=function(e){var t=this;if(this.form.datasource){var n,o,a={},r={},s=1;s=(e=e||{}).page||s,n=l.isDefined(e.orderBy)?e.orderBy:this.orderBy||"",this.orderBy=n,this.form.formFields.forEach((function(e){var n,i="div[name="+e.name+"] input",o=t.form.$element;if((e.widgettype===l.FormWidgetType.AUTOCOMPLETE||e.widgettype===l.FormWidgetType.TYPEAHEAD)&&o)return n=o.find(i),void(e["is-range"]?r[e.field]={minValue:l.isDefined(e.minValue)?e.minValue:n.first().val(),maxValue:l.isDefined(e.maxValue)?e.maxValue:n.last().val()}:r[e.field]={value:l.isDefined(e.value)?e.value:n.val()});e["is-range"]?r[e.field]={minValue:e.minValue,maxValue:e.maxValue}:r[e.field]={value:e.value}}));try{if(!1===(o=this.form.invokeEventCallback("beforeservicecall",{$data:r})))return;if(o&&o.error)return void this.form.toggleMessage(!0,o.error,"error","ERROR");this.form.formFields.forEach((function(e){e["is-range"]?(e._minValue=r[e.field].minValue,e._maxValue=r[e.field].maxValue):e._value=r[e.field].value}))}catch(e){if("Abort"===e.message)return}return this.form.formFields.forEach((function(e){var n,o,r=e.field,s=e._minValue,c=e._maxValue;if(e["is-related"]&&(r+="."+e["lookup-field"]),e["is-range"])n=i.getRangeFieldValue(s,c),o=i.getRangeMatchMode(s,c),l.isDefined(n)&&(a[r]={value:n,matchMode:o,logicalOp:"AND"});else{switch(e.widgettype){case l.FormWidgetType.SELECT:case l.FormWidgetType.RADIOSET:i.getEnableEmptyFilter(t.form.enableemptyfilter)&&e._value===q?(o=i.getEmptyMatchMode(t.form.enableemptyfilter),n=e._value):e.type===l.DataType.BOOLEAN?l.isDefined(e._value)&&""!==e._value&&(n=JSON.parse(e._value)):n=e._value;break;case l.FormWidgetType.CHECKBOXSET:case l.FormWidgetType.CHIPS:e._value&&e._value.length&&(n=e._value);break;case l.FormWidgetType.CHECKBOX:case l.FormWidgetType.TOGGLE:l.isDefined(e._value)&&""!==e._value&&(n=e.type===l.DataType.BOOLEAN?JSON.parse(e._value):e._value);break;default:n=e._value}l.isDefined(n)&&""!==n&&null!==n&&(a[r]={},o?(a[r].matchMode=o,n=void 0):(e.type===l.DataType.STRING||e.isRelated)&&(a[r].matchMode=o||e.matchmode||t.form.datasource.execute(l.DataSource.Operation.GET_MATCH_MODE)),a[r].value=n,a[r].logicalOp="AND",a[r].type=e.type)}})),e.exportType?this.form.datasource.execute(l.DataSource.Operation.DOWNLOAD,{data:{matchMode:"anywhereignorecase",filterFields:a,orderBy:n,exportType:e.exportType,logicalOp:"AND",exportSize:e.exportSize,fields:e.fields,fileName:e.fileName}}):this.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{filterFields:a,orderBy:n,page:s,pagesize:this.form.pagesize||20,skipDataSetUpdate:!0,inFlightBehavior:"executeAll"}).then((function(e){var i=e.data;return t.form.pagination=e.pagination,i.error?(t.form.toggleMessage(!0,i.error,"error","ERROR"),t.form.onResultCb(i,!1)):(t._options={page:s,orderBy:n},t.form.result=l.getClonedObject(i),t.form.onResultCb(i,!0)),l.$appDigest(),t.form.result}),(function(e){return t.form.toggleMessage(!0,e,"error","ERROR"),t.form.onResultCb(e,!1),e}))}},e.prototype.filterOnDefault=function(){_.find(this.form.formFields,(function(e){return l.isDefined(e.value)||l.isDefined(e.minValue)||l.isDefined(e.maxValue)}))&&this._filter(this._options)},e.prototype.registerFormWidget=function(e){var t=e.key||e.name;this.form.filterWidgets[t]=e},e}();z.initializeProps=E(),z.decorators=[{type:t.Directive,args:[{selector:"[wmLiveFilter]"}]}],z.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[N]}]}]};var H=function(e){return e.widgettype===l.DataType.TIME||e.type===l.DataType.TIME&&!e.widgettype},Y=H,K=function(e){if(e){var t=(new Date).toDateString();return new Date(t+" "+e).getTime()}},Q=K,Z=function(){function e(e,t,n,i,o){var a=this;this.form=e,this.datePipe=n,this.dialogService=i,this._debouncedSavePrevDataValues=l.debounce((function(){a.savePrevDataValues()}),250),t&&!this.form.parentForm?(this.form._liveTableParent=t,this.form.isLayoutDialog=t.isLayoutDialog,t.onFormReady(this.form)):this.form.isLayoutDialog="dialog"===o,e.cancel=this.cancel.bind(this),e.reset=this.reset.bind(this),e.delete=this.delete.bind(this),e.save=this.save.bind(this),e.saveAndNew=this.saveAndNew.bind(this),e.saveAndView=this.saveAndView.bind(this),e.setPrimaryKey=this.setPrimaryKey.bind(this),e.constructDataObject=this.constructDataObject.bind(this),e.changeDataObject=this.setFormData.bind(this),e.setFormData=this.setFormData.bind(this),e.findOperationType=this.findOperationType.bind(this),e.clearData=this.clearData.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.form_registerFormFields=e.registerFormFields,e.registerFormFields=this.registerFormFields.bind(this)}return e.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},e.prototype.registerFormFields=function(e){var t=this.form.getFormFields();this.form.form_registerFormFields(e),this.form.isDataSourceUpdated&&this._updateFieldOnDataSourceChange(e,t)},e.prototype._updateFieldOnDataSourceChange=function(e,t){!e.isDataSetBound&&i.isDataSetWidget(e.widgettype)&&(e["is-related"]?(e.isDataSetBound=!0,i.fetchRelatedFieldData(this.form.datasource,e.widget,{relatedField:e.key,datafield:i.ALLFIELDS,widget:"widgettype"})):(i.getDistinctValuesForField(this.form.datasource,e.widget,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter}),i.applyFilterOnField(this.form.datasource,e.widget,t,e.value,{isFirst:!0})))},e.prototype.onDataSourceChange=function(){var e=this;_.get(this.form.formFields,"length")&&(this.form.isDataSourceUpdated=!0);var t=this.form.getFormFields();t.forEach((function(n){e._updateFieldOnDataSourceChange(n,t)}))},e.prototype.onFieldDefaultValueChange=function(e,t){"update"!==this.form.operationType&&(l.isDefined(t)&&null!==t&&""!==t&&"null"!==t?e.value=i.parseValueByType(t,e.type,e.widgettype,e.trailingzero):e.value=void 0,this.form.dirty&&!this._triggeredByUser&&this.form.markAsPristine(),this._debouncedSavePrevDataValues())},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t)},e.prototype.getBlobURL=function(e,t,n){var i,o="";return null!=n&&this.form.datasource?(i=e[(this.form.datasource.execute(l.DataSource.Operation.GET_PRIMARY_KEY)||[])[0]],o+=this.form.datasource.execute(l.DataSource.Operation.GET_BLOB_URL,{primaryValue:i,columnName:t}),o+="?"+Math.random()):o},e.prototype.setFormData=function(e,t){var n=this;e&&((t=t||this.form.formFields).forEach((function(t){var i=_.get(e,t.key||t.name);H(t)?t.value=K(i):t.type===l.DataType.BLOB?(n.form.resetFileUploadWidget(t,!0),t.href=n.getBlobURL(e,t.key,i),t.value=_.isString(i)?"":i):n.form.setFieldValue(t,e)})),this.savePrevDataValues(),this.form.constructDataObject())},e.prototype.onDataSourceUpdate=function(e,t,n){t?this.form.new():(this.form.setFormData(e),this.closeDialog()),this.form.isUpdateMode=!l.isDefined(n)||n},e.prototype.savePrevformFields=function(){this.form.prevformFields=l.getClonedObject(this.form.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},e.prototype.getPrevformFields=function(){var e=this;this.form.formFields.map((function(t){var n=e.form.prevformFields.find((function(e){return e.key===t.key}));t.value=n.value}))},e.prototype.getDataObject=function(){return this.form.operationType===i.Live_Operations.INSERT?{}:l.isDefined(this.form.prevDataObject)&&!l.isEmptyObject(this.form.prevDataObject)?l.getClonedObject(this.form.prevDataObject):l.getClonedObject(this.form.formdata||{})},e.prototype.constructDataObject=function(e){var t=this,n=this.getDataObject(),i=this.form.name;return(e?this.form.prevformFields:this.form.getFormFields()).forEach((function(e){var o,a,r=_.split(e.key,"."),s=r[0]||e.key;e.widgettype&&l.isDateTimeType(e.widgettype)||l.isDateTimeType(e.type)?e.value?(o=l.getValidDateObject(e.value),a=e.outputformat===l.DataType.TIMESTAMP||e.type===l.DataType.TIMESTAMP?e.value?o:null:e.outputformat?t.datePipe.transform(o,e.outputformat):e.value):a=void 0:a=e.type===l.DataType.BLOB?l.getFiles(i,s+"_formWidget",e.multiple):e.type===l.DataType.LIST?e.value||void 0:null===e.value||""===e.value?void 0:e.value,1===r.length?n[s]=a:(n[s]=n[s]||{},n[s][r[1]]=a)})),e?n:(this.form.updateFormDataOutput(n),this.form.dataoutput)},e.prototype.setPrimaryKey=function(e){this.form.primaryKey=this.form.primaryKey||[],-1===this.form.primaryKey.indexOf(e)&&this.form.primaryKey.push(e)},e.prototype.findOperationType=function(){var e,t=this,n=!1,o=this.form.datasource&&this.form.datasource.execute(l.DataSource.Operation.GET_OPERATION_TYPE);return o&&"read"!==o?o:(this.form.primaryKey&&!_.isEmpty(this.form.formdata)&&(1===this.form.primaryKey.length?this.form.formdata[this.form.primaryKey[0]]&&(e=i.Live_Operations.UPDATE):0===this.form.primaryKey.length?(_.forEach(this.form.formdata,(function(e){e&&(n=!0)})),n&&(e=i.Live_Operations.UPDATE)):(n=_.some(this.form.primaryKey,(function(e){if(t.form.formdata[e])return!0})))&&(e=i.Live_Operations.UPDATE)),e||i.Live_Operations.INSERT)},e.prototype.getPrevDataValues=function(){var e=_.fromPairs(_.map(this.form.prevDataValues,(function(e){return[e.key,e.value]})));return this.form.formFields.forEach((function(t){t.value=e[t.key]||"",t.resetDisplayInput()})),e},e.prototype.savePrevDataValues=function(){this.form.prevDataValues=this.form.formFields.map((function(e){return{key:e.key,value:e.value}}))},e.prototype.clearData=function(){this.form.toggleMessage(!1),this.form.emptyDataModel()},e.prototype.setReadonlyFields=function(){this.form.formFields.forEach((function(e){e.setReadOnlyState()}))},e.prototype.reset=function(){var e,t=this;this.form.resetFormState(),e=this.getPrevDataValues(),this.form.formFields.forEach((function(n){var i;n.type!==l.DataType.BLOB&&"upload"!==n.widgettype||(t.form.resetFileUploadWidget(n,!0),n.href=t.getBlobURL(e,n.key,n.value)),null===(i=n.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid")})),this.form.constructDataObject()},e.prototype.closeDialog=function(){this.form.isLayoutDialog&&this.dialogService.close(this.form.dialogId)},e.prototype.cancel=function(){this.form.clearMessage(),this.form.isUpdateMode=!1,this.form.reset(),this.form.isSelected&&this.getPrevformFields(),this.form.isUpdateMode=!1,this.form._liveTableParent?this.form._liveTableParent.onCancel():this.closeDialog(),l.$appDigest()},e.prototype.delete=function(e){this.form.resetFormState(),this.form.operationType=i.Live_Operations.DELETE,this.form.prevDataObject=l.getClonedObject(this.form.formdata||{}),this.form.save(void 0,void 0,void 0,e)},e.prototype.saveAndNew=function(){this.save(void 0,!0,!0)},e.prototype.saveAndView=function(){this.save(void 0,!1)},e.prototype.submitForm=function(e){this.save(e)},e.prototype.save=function(e,t,n){var o=this;if(this.form.datasource){var a,r,s,c,p={};if(s=this.form.operationType=this.form.operationType||this.findOperationType(),!this.form.validateFieldsOnSubmit()){a=l.getClonedObject(this.form.constructDataObject()),r=this.form.prevformFields?this.form.constructDataObject(!0):a;try{if(!1===(c=this.form.invokeEventCallback("beforeservicecall",{$event:e,$operation:this.form.operationType,$data:a,options:p})))return;if(c&&c.error)return void this.form.toggleMessage(!0,c.error,"error")}catch(e){if("Abort"===e.message)return}if(this.form.operationType===i.Live_Operations.UPDATE&&this.form.ngform&&this.form.ngform.pristine&&this.form.isSelected&&_.isEqual(a,r))return this.form.toggleMessage(!0,this.form.appLocale.MESSAGE_NO_CHANGES,"info",""),void l.$appDigest();p.row=a,p.transform=!0,p.skipNotification=!0,s===i.Live_Operations.UPDATE&&(p.rowData=this.form.formdata,p.prevData=r),i.performDataOperation(this.form.datasource,p,{operationType:s}).then((function(e){var a,r=s===i.Live_Operations.INSERT?o.form.insertmessage:s===i.Live_Operations.UPDATE?o.form.updatemessage:o.form.deletemessage;return s===i.Live_Operations.DELETE?(a=p.row,o.form.emptyDataModel(),o.form.prevDataValues=[],o.form.isSelected=!1):a=e,o.form.onSuccess||o.form.toggleMessage(!0,r,"success"),o.form._liveTableParent?o.form._liveTableParent.onResult(s,e,n,t):(o.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}),o.onDataSourceUpdate(e,n,t)),{result:a,status:!0}}),(function(e){return o.form.onError||o.form.toggleMessage(!0,e,"error"),l.$appDigest(),{result:e,status:!1}})).then((function(t){o.form.resetFormState(),o.form.onResultCb(t.result,t.status,e)}))}}},e}();Z.initializeProps=O(),Z.decorators=[{type:t.Directive,args:[{selector:"[wmLiveForm]"}]}],Z.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[N]}]},{type:h.LiveTableComponent,decorators:[{type:t.Optional}]},{type:i.ToDatePipe},{type:l.AbstractDialogService},{type:String,decorators:[{type:t.Attribute,args:["formlayout"]}]}]},Z.propDecorators={onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var J=[N,k,F,V,W,U,z,Z],X=function(){};X.decorators=[{type:t.NgModule,args:[{imports:[o.BasicModule,n.CommonModule,r.DesignDialogModule,a.InputModule,i.WmComponentsModule],declarations:b([],y(J)),exports:b([],y(J)),entryComponents:[]}]}],e.DependsonDirective=U,e.FormActionDirective=F,e.FormComponent=N,e.FormFieldDirective=V,e.FormModule=X,e.FormWidgetDirective=k,e.LiveActionsDirective=W,e.LiveFilterDirective=z,e.LiveFormDirective=Z,e["\u02750"]=Y,e["\u02751"]=Q,e["\u0275a"]=P,e["\u0275b"]=O,e["\u0275c"]=E,e["\u0275d"]=M,e["\u0275e"]=j,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/dialogs"),require("@wm/components/input"),require("@wm/core")):"function"==typeof define&&define.amd?define("@wm/components/dialogs/iframe-dialog",["exports","@angular/core","@angular/common","@wm/components/base","@wm/components/basic","@wm/components/dialogs","@wm/components/input","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.dialogs=e.wm.components.dialogs||{},e.wm.components.dialogs.iframedialog={}),e.ng.core,e.ng.common,e.wm.components.base,e.wm.components.basic,e.wm.components.dialogs,e.wm.components.input,e.wm.core)}(this,(function(e,t,n,i,o,a,r,s){"use strict";
|
|
549
549
|
/*! *****************************************************************************
|
|
550
550
|
Copyright (c) Microsoft Corporation.
|
|
551
551
|
|
|
@@ -51187,6 +51187,9 @@
|
|
|
51187
51187
|
}));
|
|
51188
51188
|
} else {
|
|
51189
51189
|
var element = self.$element.find('[wmformfield][key="' + fieldName + '"]');
|
|
51190
|
+
if (!element.length) {
|
|
51191
|
+
element = self.$element.find('[wmformfield][name="' + fieldName + '"]');
|
|
51192
|
+
}
|
|
51190
51193
|
if (element.length) {
|
|
51191
51194
|
element[0].setAttribute("__errormsg", element[0].getAttribute("__validationId"));
|
|
51192
51195
|
(_a = element[0].querySelector("input")) === null || _a === void 0 ? void 0 : _a.setAttribute("aria-invalid", ngForm.invalid);
|
|
@@ -545,7 +545,7 @@ var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
545
545
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
546
546
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
547
547
|
PERFORMANCE OF THIS SOFTWARE.
|
|
548
|
-
***************************************************************************** */var m=function(e,t){return(m=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])})(e,t)};function f(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}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function g(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function v(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function b(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var w=new Map([["autocomplete",Object.assign({value:!1},i.PROP_BOOLEAN)],["captionalign",Object.assign({value:"left"},i.PROP_STRING)],["captionposition",Object.assign({value:"left"},i.PROP_STRING)],["captionsize",i.PROP_STRING],["captionwidth",Object.assign({value:"xs-12 sm-3 md-3 lg-3"},i.PROP_STRING)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dataset",i.PROP_ANY],["datasource",i.PROP_STRING],["expanded",Object.assign({value:!0},i.PROP_BOOLEAN)],["formdatasource",i.PROP_STRING],["name",i.PROP_STRING],["numberOfFields",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showindevice",Object.assign({displayType:"inline-block",value:"all"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]),P=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("action",i.PROP_STRING),e.set("defaultmode",Object.assign({value:"Edit"},i.PROP_STRING)),e.set("metadata",i.PROP_STRING),e.set("method",i.PROP_STRING),e.set("postmessage",Object.assign({value:"Data posted successfully"},i.PROP_STRING)),e.set("target",i.PROP_STRING),e.set("enctype",i.PROP_STRING),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Inline"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-form",e)},O=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("defaultmode",Object.assign({value:"View"},i.PROP_STRING)),e.set("formlayout",Object.assign({value:"inline"},i.PROP_STRING)),e.set("insertmessage",Object.assign({value:"Record added successfully"},i.PROP_STRING)),e.set("updatemessage",Object.assign({value:"Record updated successfully"},i.PROP_STRING)),e.set("deletemessage",Object.assign({value:"Record deleted successfully"},i.PROP_STRING)),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Toaster"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-liveform",e)},S=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("autoupdate",i.PROP_BOOLEAN),e.set("enableemptyfilter",Object.assign({value:" "},i.PROP_STRING)),e.set("pagesize",Object.assign({value:20},i.PROP_NUMBER)),e.set("iconclass",Object.assign({value:"wi wi-filter-list"},i.PROP_STRING)),i.register("wm-livefilter",e)},E={widgetType:"wm-form",hostClass:"panel app-panel app-form"},T={widgetType:"wm-form",hostClass:"app-form app-login-form"},R={widgetType:"wm-liveform",hostClass:"panel app-panel app-liveform liveform-inline"},A={widgetType:"wm-livefilter",hostClass:"panel app-panel app-livefilter clearfix liveform-inline"},C=function(e,t,n){var i=E;return null!==e?i=R:null!==t?i=A:"app-login"===n&&(i=T),i},I=function(e,t){var n="";return _.forEach(e,(function(e,t){n=n+" "+t+'="'+e+'"'})),'<wm-gridcolumn columnwidth="'+t+'">\n <wm-form-field '+n+"></wm-form-field>\n </wm-gridcolumn>"},D=function(e,t){var n=e.find("form.ng-invalid:visible, [formControlName].ng-invalid:visible").first(),i=t;return n.is("form")&&(i=t&&t.controls[n.attr("formControlName")||n.attr("name")])?D(n,i):{ngForm:i,$ele:n}},N=function(e,t,n){var i,o;if(!t.valid)if(t.controls)_.forEach(t.controls,(function(t,n){N(e,t,n)}));else{var r=e.$element.find('[wmformfield][key="'+n+'"]');r.length&&(r[0].setAttribute("__errormsg",r[0].getAttribute("__validationId")),null===(i=r[0].querySelector("input"))||void 0===i||i.setAttribute("aria-invalid",t.invalid),null===(o=r[0].querySelector("input"))||void 0===o||o.setAttribute("aria-describedby",r[0].getAttribute("__validationId"))),t.markAsTouched()}},x=function(e){function t(t,n,o,r,a,s,c,p,u,d,h,m,f,g,v,y,b,w,P,O){var S=e.call(this,t,C(y,b,w))||this;S.fb=n,S.app=o,S.dialogService=r,S.dynamicComponentProvider=a,S.ngZone=s,S.parentList=c,S.parentForm=p,S.parentPrefab=u,S.parentPartial=d,S.onBeforeSubmitEvt=h,S.onSubmitEvt=m,S.onBeforeRenderEvt=f,S.binddataset=g,S.bindformdata=v,S._widgetClass="",S._captionClass="",S.formFields=[],S.formfields={},S.formWidgets={},S.filterWidgets={},S.buttonArray=[],S.dataoutput={},S.formdata={},S.statusMessage={caption:"",type:""},S.primaryKey=[],S._debouncedUpdateFieldSource=_.debounce(S.updateFieldSource,350),S.validationMessages=[],S._debouncedSubmitForm=l.debounce((function(e){S.ngZone.run((function(){S.submitForm(e)}))}),250),i.styler(S.nativeElement,S),l.removeAttr(S.nativeElement,"title"),S.isUpdateMode=!0,S.dialogId=S.nativeElement.getAttribute("dialogId"),S.ngform=n.group({}),S.bindingValue=P||O;var E=S.ngform.valueChanges.subscribe(S.updateDataOutput.bind(S));return S.registerDestroyListener((function(){return E.unsubscribe()})),S.elScope=S,S.addEventsToContext(S.context),S}return f(t,e),Object.defineProperty(t.prototype,"isLayoutDialog",{get:function(){return this._isLayoutDialog},set:function(e){e&&l.removeClass(this.nativeElement,"panel app-panel liveform-inline"),this._isLayoutDialog=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUpdateMode",{get:function(){return this._isUpdateMode},set:function(e){this._isUpdateMode=e,this.formFields.forEach((function(t){t.setReadOnlyState(e)}))},enumerable:!1,configurable:!0}),t.prototype.submit=function(e){this._debouncedSubmitForm(e)},t.prototype.onReset=function(){this.reset()},t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},Object.defineProperty(t.prototype,"parentFormArray",{get:function(){return this.parentForm&&this.isParentList&&this.parentForm.ngform.get(this.parentList.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isParentList",{get:function(){if(this.parentList&&this.parentForm&&!l.isDefined(this._formIsInList)){var e=this.$element.closest('.app-livelist[name="'+this.parentList.name+'"]');e.length&&(this._formIsInList=!e.find('form[widget-id="'+this.parentForm.widgetId+'"]').length)}return l.isDefined(this._formIsInList)?this._formIsInList:this.parentList},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;setTimeout((function(){e.componentRefs.forEach((function(t){t.name&&(e.formWidgets[t.name]=t)}))}),250)},t.prototype.ngAfterViewInit=function(){this.parentForm&&this.parentForm.ngform&&this.isParentList&&(_.get(this.parentForm.ngform.controls,this.parentList.name)||this.parentForm.ngform.setControl(this.parentList.name,new s.FormArray([])),this.parentFormArray.push(this.ngform),this.formArrayIndex=this.parentFormArray.length-1),this.addInnerNgFormToForm(this.bindingValue)},t.prototype.findOperationType=function(){},t.prototype.addInnerNgFormToForm=function(e){if(this.parentForm&&this.parentForm.ngform){if(this.isParentList)return;var t=this.parentPrefab||this.parentPartial;if(t){var n=(this.parentPrefab?t.$element.find("[wmprefabcontainer]"):t.$element).find("form").first();_.get(n[0],"widget.widgetId")===this.widgetId&&(n.isParentList||n.siblings("form").length||(e=_.get(t,"name")))}for(var i=1,o=e;this.parentForm.ngform.controls.hasOwnProperty(o);)o=e+"_"+i,i++;this.formGroupName=o,this.parentForm.ngform.addControl(o,this.ngform)}},t.prototype.addEventsToContext=function(e){var t=this;e.cancel=function(){return t.cancel()},e.reset=function(){return t.reset()},e.save=function(e){return t.save(e)},e.saveAndNew=function(){return t.saveAndNew()},e.saveAndView=function(){return t.saveAndView()},e.delete=function(){return t.delete()},e.new=function(){return t.new()},e.edit=function(){return t.edit()},e.highlightInvalidFields=function(){return t.highlightInvalidFields()},e.filter=function(){return t.filter()},e.clearFilter=function(){return t.clearFilter()},e.submit=function(e){return t.submit(e)}},t.prototype.setValidationOnInnerForms=function(e){var t=this,n=this.getNativeElement().querySelectorAll(".app-form");_.forEach(n,(function(n){var i=n.widget,o=_.get(i,"formGroupName")||i.name;l.isDefined(i.formArrayIndex)&&(o=o+"["+i.formArrayIndex+"]");for(var r=i;_.get(r,"parentForm");){var a=r.parentForm.formGroupName||r.parentForm.name;r.parentForm.parentFormArray&&(a=a+"["+r.parentForm.formArrayIndex+"]"),o=a+"."+o,r=r.parentForm}t.setValidationOnFields(i,o,e)}))},t.prototype.setValidationOnFields=function(e,t,n){var i=this,o=e.ngform.controls,r=e.formFields;r&&_.forEach(o,(function(o,a){var s,l=r.find((function(e){return e.key===a}));!l||n&&!o.touched||(null===(s=l.nativeElement.querySelector("input"))||void 0===s||s.setAttribute("aria-invalid",o.invalid),i.prepareValidationObj(o,a,l,t),i.prepareValidationObj.call(e,o,a,l,t))}))},t.prototype.prepareValidationObj=function(e,t,n,i){var o=this.validationMessages.findIndex((function(e){return e.field===t&&e.fullyQualifiedFormName===i}));e.invalid?-1===o?this.validationMessages.push({field:t,value:n.value,errorType:_.keys(e.errors),message:n.validationmessage||"",getElement:function(){return n.$element.find("[focus-target]")},formName:_.last(i.split(".")),fullyQualifiedFormName:i}):(this.validationMessages[o].value=n.value,this.validationMessages[o].errorType=_.keys(e.errors)):e.valid&&o>-1&&this.validationMessages.splice(o,1)},t.prototype.setValidationMsgs=function(e){!this.formFields.length&&_.isEmpty(this.ngform.controls)||(this.setValidationOnFields(this,this.name,e),this.setValidationOnInnerForms(e))},t.prototype.handleEvent=function(t,n,i,o){"submit"!==n&&e.prototype.handleEvent.call(this,this.nativeElement,n,i,o)},t.prototype.updateFieldSource=function(){var e=this;this.formdatasource&&this.formdatasource.execute(l.DataSource.Operation.IS_API_AWARE)||this.formdatasource&&!this.formdatasource.twoWayBinding||this.formFields.forEach((function(t){t.setFormWidget("datavaluesource",e.formdatasource),t.setFormWidget("binddatavalue",e.bindformdata+"."+t.key)}))},t.prototype.highlightInvalidFields=function(){N(this,this.ngform,"")},t.prototype.validateFieldsOnSubmit=function(){if(this.setValidationMsgs(),"delete"!==this.operationType&&("html"===this.validationtype||"default"===this.validationtype)&&this.ngform&&this.ngform.invalid){if(this.ngform.invalid){"default"===this.validationtype&&this.highlightInvalidFields();var e=D(this.$element,this.ngform),t=e.ngForm,n=e.$ele;if((n=n.parent().find("[focus-target]")).length){n.hasClass("app-search-input")||n.focus();var i=t&&t.controls[n.attr("formControlName")||n.attr("name")];return i&&i.markAsTouched&&i.markAsTouched(),l.$appDigest(),!0}return!0}return!1}return!1},t.prototype.onPropertyChange=function(t,n,i){switch(t){case"captionalign":this.captionAlignClass="align-"+n;break;case"captionposition":case"captionwidth":this.setLayoutConfig();break;case"captionsize":this.captionsize=n;break;case"novalidate":this.widget.validationtype=!0===n||"true"===n?"none":"default";break;case"formdata":if(_.isEqual(n,i))break;_.isArray(n)?this.setFormData(_.last(n)):this.setFormData(n),!this.isDataSourceUpdated&&this.datasource&&this.onDataSourceChange();break;case"defaultmode":this.isLayoutDialog||(this.updateMode=!(!n||"Edit"!==n),this.isUpdateMode=this.updateMode);break;case"datasource":this.onDataSourceChange();break;case"formdatasource":this.onFormDataSourceChange();break;case"metadata":this.generateFormFields();break;case"dataset":this.getFormFields().forEach((function(e){!e.isDataSetBound&&_.get(e.formWidget,"dataset$")&&e.formWidget.dataset$.next()}));break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onResultCb=function(e,t,n){var i={$event:n,$data:e,$operation:this.operationType};this.invokeEventCallback("result",i),t?this.invokeEventCallback("success",i):this.invokeEventCallback("error",i)},t.prototype.toggleMessage=function(e,t,n,i){var o;e&&t?(o="error"===n&&this.errormessage?this.errormessage:t,"Inline"===this.messagelayout?(o=this.checkAppServiceErrorMsg(n)||o,this.statusMessage={caption:o||"",type:n},this.messageRef&&this.messageRef.showMessage(this.statusMessage.caption,this.statusMessage.type),l.isElementInViewport(this.$element[0])||l.scrollToElement(this.$element[0])):this.app.notifyApp(o,n,i)):this.statusMessage.caption=""},t.prototype.checkAppServiceErrorMsg=function(e){var t=_.get(this.app,"Actions.appNotification");if(t&&"error"===e)return t.getMessage()},t.prototype.clearMessage=function(){this.toggleMessage(!1)},t.prototype.setLayoutConfig=function(){var e;e=i.getFieldLayoutConfig(this.captionwidth,this.captionposition,_.get(this.app.selectedViewPort,"os")),this._widgetClass=e.widgetCls,this._captionClass=e.captionCls,l.$appDigest()},t.prototype.registerFormWidget=function(e){var t=e.name||e.key;this.formWidgets[t]=e},t.prototype.registerFormFields=function(e){var t=this.formFields.push(e);this.formfields[e.key]=e,this.registerFormWidget(e),this._debouncedUpdateFieldSource(),this.parentForm&&(this.parentForm.formFields.push(e),this.parentForm.formfields[e.key]=e,this.parentForm.setFormData(this.parentForm.formdata,this.formFields,this.formdata||{})),t!==this.numberOfFields||_.isEmpty(this.formdata)||(this.onDataSourceChange(),_.isArray(this.formdata)?this.setFormData(_.last(this.formdata)):this.setFormData(this.formdata))},t.prototype.registerActions=function(e){this.buttonArray.push(e)},t.prototype.updateFormDataOutput=function(e){var t=this;_.forEach(this.ngform.value,(function(n,i){_.find(t.formFields,{key:i})||(e[i]=n)})),this.dataoutput=e},t.prototype.constructDataObject=function(){var e=this,t={};return this.getFormFields().forEach((function(n){var i,o;if(o=null===(o=n.datavalue||n._control.value)||""===o?void 0:o,"file"===n.type&&(o=l.getFiles(e.name,n.key+"_formWidget",n.multiple)),i=n.key||n.target||n.name,n.form.widgetId!==e.widgetId&&n.form.formGroupName)(r=_.get(t,n.form.formGroupName,{}))[i]=o,_.set(t,n.form.formGroupName,r);else if(n.form.isParentList){var r;(r=_.get(t,n.form.parentList.name,[]))[n.form.formArrayIndex]=r[n.form.formArrayIndex]||{},r[n.form.formArrayIndex][i]=o,_.set(t,n.form.parentList.name,r)}else _.set(t,i,o)})),this.updateFormDataOutput(t),this.dataoutput},t.prototype.updateDataOutput=function(){this.constructDataObject(),this.ngform.touched&&this.setValidationMsgs(!0)},t.prototype.getFormFields=function(){var e=this;return _.filter(this.formFields,(function(t){return t.form.name===e.name}))},t.prototype.setFieldValue=function(e,t,n){var i=e.key||e.name,o=n||t;o&&((o.hasOwnProperty(i)||_.includes(i,".")&&o.hasOwnProperty(_.split(i,".")[0]))&&(e.value=_.get(o,i)),this.dirty&&!this._triggeredByUser&&this.markAsPristine());var r=e.form.formGroupName;r&&_.get(t,r)&&this.setFormData.call(e.form,t[r]),_.get(e.form,"parentFormArray")&&this.setFormDataFromParentFormData.call(e.form,t)},t.prototype.setFormData=function(e,t,n){var i=this;(t||this.formFields).forEach((function(t){i.setFieldValue(t,e,n),t.fieldValidations&&t.fieldValidations.setCustomValidationMessage()})),this.constructDataObject()},t.prototype.resetFormState=function(){this.validationMessages.length&&(this.validationMessages=[]),this.ngform&&(this.ngform.markAsUntouched(),this.ngform.markAsPristine())},t.prototype.reset=function(){var e=this;this.resetFormState(),this.formFields.forEach((function(t){var n;t.value="","upload"!==t.widgettype&&t.type!==l.DataType.BLOB||e.resetFileUploadWidget(t,!0),null===(n=t.nativeElement.querySelector("input"))||void 0===n||n.removeAttribute("aria-invalid")})),this.constructDataObject(),this.clearMessage()},t.prototype.savePrevformFields=function(){this.prevformFields=l.getClonedObject(this.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},t.prototype.savePrevDataValues=function(){this.prevDataValues=this.formFields.map((function(e){return{key:e.key,value:e.value}}))},t.prototype.setReadonlyFields=function(){this.formFields.forEach((function(e){e.setReadOnlyState()}))},t.prototype.resetFileUploadWidget=function(e,t){this.$element.find('[name="'+e.key+'_formWidget"]').val(""),e._control.reset(),t||(e.href="",e.value=null)},t.prototype.emptyDataModel=function(){var e=this;this.formFields.forEach((function(t){l.isDefined(t)&&(t.type===l.DataType.BLOB?e.resetFileUploadWidget(t):t.datavalue="")}))},t.prototype.setDefaultValues=function(){var e=this;this.formFields.forEach((function(t){e.onFieldDefaultValueChange(t,t.defaultvalue)}))},t.prototype.setOperationType=function(e){this.operationType=e||"insert"},t.prototype.new=function(){var e=this;this.resetFormState(),this.operationType=i.Live_Operations.INSERT,this.clearMessage(),this.isSelected&&this.savePrevformFields(),this.emptyDataModel(),setTimeout((function(){e.setDefaultValues(),e.savePrevDataValues(),e.constructDataObject()})),this.isUpdateMode=!0},t.prototype.edit=function(){this.resetFormState(),this.clearMessage(),this.operationType=i.Live_Operations.UPDATE,this.isSelected&&(this.savePrevformFields(),this.savePrevDataValues()),this.prevDataObject=l.getClonedObject(this.formdata||{}),this.setReadonlyFields(),this.isUpdateMode=!0,l.$appDigest()},t.prototype.triggerWMEvent=function(e){var t=this.nativeElement.getAttribute("dependson");t&&(l.$invokeWatchers(!0),this.app.notify("wm-event",{eventName:e,widgetName:t}))},t.prototype.submitForm=function(e){var t,n,o,r=this,a=this.datasource;if(!this.validateFieldsOnSubmit()){n=l.getClonedObject(this.constructDataObject());var s=function(){return{$event:e,$formData:n,$data:n}};if(this.onBeforeSubmitEvt){if(!1===this.invokeEventCallback("beforesubmit",s()))return;this.resetFormState()}else this.resetFormState();if(this.onSubmitEvt||a)if(a){var c=a.pagination&&a.pagination.number+1,p=this.operationType?this.operationType:"insert";i.performDataOperation(a,n,{operationType:p}).then((function(e){return"wm.CrudVariable"===a.category&&(r.triggerWMEvent("resetEditMode"),r.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list",page:c,preventMissingOpMsg:!0}),r.dialogId&&r.closeDialog()),l.isDefined(e.body)?(o=l.getValidJSON(e.body),o=l.isDefined(o)?o:e.body):o=e,{result:o,status:!0,message:r.postmessage,type:"success"}}),(function(e){return t=r.errormessage||e.error||e,l.$appDigest(),{result:_.get(e,"error")||e,status:!1,message:t,type:"error"}})).then((function(t){("error"===t.type&&!r.onError||"success"===t.type&&!r.onSuccess)&&r.toggleMessage(!0,t.message,t.type),r.invokeEventCallback("submit",s()),r.onResultCb(t.result,t.status,e)}))}else this.invokeEventCallback("submit",s()),this.onResultCb({},!0,e);else this.onResultCb({},!0,e)}},t.prototype.closeDialog=function(){this.dialogService.close(this.dialogId)},t.prototype.showButtons=function(e){var t=this;return _.some(this.buttonArray,(function(n){return _.includes(n.position,e)&&n.updateMode===t.isUpdateMode}))},t.prototype.expandCollapsePanel=function(){this.collapsible&&(this.expanded=!this.expanded)},t.prototype.onDataSourceUpdate=function(e,t,n){t?this.new():(this.setFormData(e),this.closeDialog()),this.isUpdateMode=!l.isDefined(n)||n},t.prototype.getNearestParentFormData=function(e){return e.parentForm?e.bindformdata||!_.get(e.parentForm,"formdata")||_.isEmpty(e.parentForm.formdata)?this.getNearestParentFormData(e.parentForm):e.parentForm.formdata:{}},t.prototype.setFormDataFromParentFormData=function(e){if(_.isEmpty(this.formdata)&&this.parentForm&&e)if(this.parentFormArray){var t=_.get(e,this.parentList.name);if(t)_.isArray(t)||(t=[t]),this.parentFormArray.patchValue(t),this.bindformdata||(this.formdata=t[this.formArrayIndex]),this.setFormData(this.formdata);else if(this.isParentList&&this.parentForm.formGroupName){var n=_.get(e,this.parentForm.formGroupName);this.setFormDataFromParentFormData(n)}}else this.setFormData(e)},t.prototype.onDataSourceChange=function(){if(_.get(this.formFields,"length")&&!this.bindformdata){this.isDataSourceUpdated=!0;var e=this.getNearestParentFormData(this);this.setFormDataFromParentFormData(e)}},t.prototype.onFormDataSourceChange=function(){this.updateFieldSource()},t.prototype.onFieldDefaultValueChange=function(e,t){e.value=i.parseValueByType(t,void 0,e.widgettype,e.trailingzero),this.dirty&&!this._triggeredByUser&&this.markAsPristine()},t.prototype.onFieldValueChange=function(){},t.prototype.generateFormFields=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,o,r,a,s,c,p,u;return v(this,(function(d){switch(d.label){case 0:if(_.isUndefined(this._isGridLayoutPresent)&&(this._isGridLayoutPresent=this.$element.find(".panel-body [wmlayoutgrid]").length>0),this._isGridLayoutPresent?(t=this.$element.find(".form-elements [wmlayoutgrid]").first(),e=Number(t.attr("columns"))||1):((t=this.$element.find(".form-elements .dynamic-form-container")).length||(this.$element.find(".form-elements").prepend('<div class="dynamic-form-container"></div>'),t=this.$element.find(".form-elements .dynamic-form-container")),e=1),n=12/e,i="",o=0,s=this.metadata?this.metadata.data||this.metadata:[],this.formFields=[],_.isEmpty(s))return[2];if(this.onBeforeRenderEvt&&(a=this.invokeEventCallback("beforerender",{$metadata:s}))&&(s=a),!_.isArray(s))return[2];for(;s[o];){for(c="",r=0;r<e;r++)s[o]&&(c+=I(s[o],n)),o++;i+="<wm-gridrow>"+c+"</wm-gridrow>"}return this._isGridLayoutPresent||(i="<wm-layoutgrid>"+i+"</wm-layoutgrid>"),this.dynamicFormRef.clear(),this._dynamicContext||(this._dynamicContext=Object.create(this.viewParent),this._dynamicContext.form=this),[4,this.dynamicComponentProvider.getComponentFactoryRef("app-form-dynamic-"+this.widgetId,i,{noCache:!0,transpile:!0})];case 1:return p=d.sent(),u=this.dynamicFormRef.createComponent(p,0,this.inj),l.extendProto(u.instance,this._dynamicContext),t[0].appendChild(u.location.nativeElement),this.setFormData(this.formdata),[2]}}))}))},Object.defineProperty(t.prototype,"mode",{get:function(){return this.operationType||this.findOperationType()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.ngform&&this.ngform.dirty},enumerable:!1,configurable:!0}),t.prototype.markAsPristine=function(e){void 0===e&&(e=!1),this.ngform.markAsPristine({onlySelf:e})},t.prototype.markAsDirty=function(e){void 0===e&&(e=!1),this.ngform.markAsDirty({onlySelf:e})},Object.defineProperty(t.prototype,"invalid",{get:function(){return this.ngform&&this.ngform.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"touched",{get:function(){return this.ngform&&this.ngform.touched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.ngform&&this.ngform.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pristine",{get:function(){return this.ngform&&this.ngform.pristine},enumerable:!1,configurable:!0}),t.prototype.markAsTouched=function(e){void 0===e&&(e=!1),this.ngform.markAsTouched({onlySelf:e})},t.prototype.markAsUntouched=function(e){void 0===e&&(e=!1),this.ngform.markAsUntouched({onlySelf:e})},t.prototype.invokeActionEvent=function(e,t){l.$parseEvent(t)(this.viewParent,Object.assign(this.context,{$event:e}))},t.prototype.ngOnDestroy=function(){var t=this.parentForm&&_.get(this.parentForm,"ngform.controls");t&&(_.get(this.parentList,"name")&&t.hasOwnProperty(this.parentList.name)&&this.parentForm.ngform.removeControl(this.parentList.name),this.formGroupName&&t.hasOwnProperty(this.formGroupName)?this.parentForm.ngform.removeControl(this.formGroupName):this.parentForm.ngform.removeControl(this.name)),e.prototype.ngOnDestroy.call(this)},t}(i.StylableComponent);x.initializeProps=P(),x.decorators=[{type:t.Component,args:[{selector:"form[wmForm]",template:'<ng-template #content><ng-content></ng-content></ng-template>\n\n<ng-container *ngIf="formlayout === \'page\'; then pageLayoutTemplate else defaultTemplate">\n</ng-container>\n\n<ng-template #defaultTemplate>\n <div class="panel-heading" *ngIf="!isLayoutDialog && (title || subheading || iconclass || showButtons(\'header\'))">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon" aria-hidden="true" [ngClass]="iconclass" *ngIf="iconclass"></i>\n </div>\n <div class="pull-left">\n <div class="heading" [innerHTML]="title"></div>\n <div class="description" [innerHTML]="subheading"></div>\n </div>\n <div class="form-action panel-actions basic-btn-grp">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'header\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n <button type="button" class="app-icon wi panel-action" *ngIf="collapsible" title="Collapse/Expand"\n [ngClass]="expanded ? \'wi-minus\': \'wi-plus\'" (click)="expandCollapsePanel();"></button>\n </div>\n </h3>\n </div>\n <div class="panel-body" [ngClass]="{\'form-elements\': isLayoutDialog, \'form-body\': !isLayoutDialog}" [class.hidden]="!expanded">\n <p wmMessage [hidden]="!statusMessage.caption.toString()" [attr.aria-hidden]="!statusMessage.caption" [attr.aria-label]="statusMessage.caption" caption.bind="statusMessage.caption" type.bind="statusMessage.type"></p>\n <div [ngClass]="{\'form-elements\': !isLayoutDialog, \'form-content\': isLayoutDialog}">\n <ng-container *ngTemplateOutlet="content"></ng-container>\n </div>\n <div class="basic-btn-grp form-action panel-footer clearfix" [ngClass]="{\'modal-footer\': isLayoutDialog}" [class.hidden]="!expanded || !showButtons(\'footer\')">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'footer\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #pageLayoutTemplate>\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</ng-template>\n\n<ng-template #buttonRef let-btn="btn">\n <button wmButton name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" type.bind="btn.type" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey" disabled.bind="ngform.status === \'PENDING\' || btn.disabled"\n tabindex.bind="btn.tabindex" [attr.aria-label]="btn.displayName" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></button>\n</ng-template>\n\n<ng-template #anchorRef let-btn="btn">\n <a wmAnchor name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey"\n hyperlink.bind="btn.hyperlink" target.bind="btn.target"\n tabindex.bind="btn.tabindex" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></a>\n</ng-template>\n\n<ng-container #dynamicForm></ng-container>\n',providers:[i.provideAsWidgetRef(x)]}]}],x.ctorParameters=function(){return[{type:t.Injector},{type:s.FormBuilder},{type:l.App},{type:l.AbstractDialogService},{type:l.DynamicComponentRefProvider},{type:t.NgZone},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:x,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:c.PrefabDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:i.PartialDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforesubmit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["submit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforerender.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["formdata.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveForm"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveFilter"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["data-role"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]}]},x.propDecorators={dynamicFormRef:[{type:t.ViewChild,args:["dynamicForm",{static:!0,read:t.ViewContainerRef}]}],messageRef:[{type:t.ViewChild,args:[i.MessageComponent]}],componentRefs:[{type:t.ContentChildren,args:[i.WidgetRef,{descendants:!0}]}],action:[{type:t.HostBinding,args:["action"]}],submit:[{type:t.HostListener,args:["submit",["$event"]]}],onReset:[{type:t.HostListener,args:["reset"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var k=function(){function e(e,t,n,i,o,r){var a=this;this.componentInstance=n,this.name=o,this.key=r,this.fb=i,this.parent=e||t,this.ngform=this.parent.ngform,this.componentInstance.registerPropertyChangeListener((function(e,t){"datavalue"===e&&a._control?a._control.setValue(t):"name"!==e||a._control||a.addControl(a.key||t)}))}return Object.defineProperty(e.prototype,"_control",{get:function(){var e=this.key||this.name;if(e)return this.ngform&&this.ngform.controls[e]},enumerable:!1,configurable:!0}),e.prototype.addControl=function(e){this.ngform.addControl(e,this.createControl())},e.prototype.createControl=function(){return this.fb.control(this.componentInstance.datavalue)},e.prototype.ngOnInit=function(){var e=this.key||this.name;e&&!this._control&&(this.addControl(e),this.parent.registerFormWidget(this.componentInstance))},e}();k.decorators=[{type:t.Directive,args:[{selector:"[wmFormWidget]"}]}],k.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[x]}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[u.TableComponent]}]},{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[i.WidgetRef]}]},{type:s.FormBuilder},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]}]};var M=function(){i.register("wm-form-action",new Map([["accessroles",i.PROP_STRING],["action",i.PROP_STRING],["class",i.PROP_STRING],["binding",i.PROP_STRING],["disabled",i.PROP_BOOLEAN],["display-name",i.PROP_STRING],["hyperlink",i.PROP_STRING],["iconclass",i.PROP_STRING],["iconname",i.PROP_STRING],["key",i.PROP_STRING],["position",Object.assign({value:"footer"},i.PROP_STRING)],["shortcutkey",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["target",i.PROP_STRING],["title",i.PROP_STRING],["type",Object.assign({value:"button"},i.PROP_STRING)],["update-mode",Object.assign({value:!0},i.PROP_BOOLEAN)],["widget-type",Object.assign({value:"button"},i.PROP_STRING)]]))},L={widgetType:"wm-form-action",hostClass:""},F=function(e){function t(t,n){var i=e.call(this,t,L)||this;return i.form=n,i}return f(t,e),t.prototype.populateAction=function(){this.buttonDef={key:this.key||this.binding,displayName:this["display-name"],show:this.show,class:this.class?this.class:"button"===this["widget-type"]?"btn-secondary":"",iconclass:this.iconclass||"",title:_.isUndefined(this.title)?this["display-name"]||"":this.title,action:this.action,accessroles:this.accessroles,shortcutkey:this.shortcutkey,disabled:this.disabled,tabindex:this.tabindex,iconname:this.iconname,type:this.type,updateMode:this["update-mode"],position:this.position,widgetType:this["widget-type"],hyperlink:this.hyperlink,target:this.target},this._propsInitialized=!0},t.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.populateAction(),this.form.registerActions(this.buttonDef)},t.prototype.onPropertyChange=function(e,t,n){if(this._propsInitialized)switch(e){case"display-name":this.buttonDef.displayName=t;default:this.buttonDef[e]=t}},t}(i.BaseComponent);F.initializeProps=M(),F.decorators=[{type:t.Directive,args:[{selector:"[wmFormAction]",providers:[i.provideAsWidgetRef(F)]}]}],F.ctorParameters=function(){return[{type:t.Injector},{type:x,decorators:[{type:t.Optional}]}]};var j=function(){var e=new Map([["dataentrymode",Object.assign({value:"default"},i.PROP_STRING)],["debouncetime",Object.assign({value:250},i.PROP_NUMBER)],["defaultvalue",i.PROP_STRING],["displayname",i.PROP_STRING],["display-name",i.PROP_STRING],["field",i.PROP_STRING],["filterexpressions",i.PROP_STRING],["filter-on",i.PROP_STRING],["generator",i.PROP_STRING],["hint",i.PROP_STRING],["inputtype",i.PROP_STRING],["is-primary-key",i.PROP_BOOLEAN],["is-range",i.PROP_BOOLEAN],["is-related",i.PROP_BOOLEAN],["isformfield",{value:!0}],["key",i.PROP_STRING],["limit",i.PROP_NUMBER],["lookup-type",i.PROP_STRING],["lookup-field",i.PROP_STRING],["name",i.PROP_STRING],["matchmode",i.PROP_STRING],["maxdefaultvalue",i.PROP_STRING],["maxplaceholder",i.PROP_STRING],["mobile-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["period",i.PROP_BOOLEAN],["pc-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["placeholder",i.PROP_STRING],["primary-key",i.PROP_BOOLEAN],["related-entity-name",i.PROP_STRING],["required",i.PROP_BOOLEAN],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tablet-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["type",i.PROP_STRING],["validationmessage",i.PROP_STRING],["viewmodewidget",i.PROP_STRING],["widgettype",i.PROP_STRING]]),t=function(t){var n="wm-form-field-"+l.FormWidgetType[t],o=i.getWidgetPropsByType(n);e.forEach((function(e,t){null==o.get(t)&&o.set(t,e)}))};for(var n in l.FormWidgetType)t(n)},B=function(){return{custom:!0}},G={image:"image/*",video:"video/*",audio:"audio/*"},V=function(e){function t(t,n,i,o,r,a,s,c,p,u,d,h,m,f,g,v,y,b,w){var P=this,_={widgetType:"wm-form-field",hostClass:"",widgetSubType:"wm-form-field-"+(d||l.FormWidgetType.TEXT).trim()},O=l.noop;return(P=e.call(this,t,_,new Promise((function(e){return O=e})))||this)._initPropsRes=O,P.app=r,P.fieldDefConfig={},P.class="",P.binddataset=c,P.binddisplayimagesrc=m,P.binddisplayexpression=p,P.bindChipclass=s,P.binddisplaylabel=u,P.form=n,P.fb=i,P.viewport=o,P._fieldName=f||h,P.isRange=g,P.excludeProps=new Set(["type","name"]),P.widgettype=d,P.parentList=a,P.notifyForFields=[],(P.binddataset||P.$element.attr("dataset"))&&(P.isDataSetBound=!0),w[0]._onFocusField=P._onFocusField.bind(P),w[0]._onBlurField=P._onBlurField.bind(P),P._debounceSetUpValidators=l.debounce((function(){return P.setUpValidators()}),500),P}return f(t,e),t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},t.prototype.handleClick=function(e){this._clicktriggeredByUser=!0},t.prototype._onFocusField=function(e){this._activeField=!0,$(e.target).closest(".live-field").addClass("active")},t.prototype._onBlurField=function(e){var t,n,i,o;$(e.target).closest(".live-field").removeClass("active");this.nativeElement.querySelector("p.text-danger");this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",""+this.ngform.controls[this._fieldName].invalid),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this._activeField=!1,this._triggeredByUser=!1,this._clicktriggeredByUser=!1},t.prototype.evaluateExpr=function(e,t,n){if(n&&t||(t=Object.keys(e)[0]))return i.getEvaluatedData(e,{field:t,expression:n},this.viewParent)},t.prototype.getDisplayExpr=function(){var e=this,t=[],n=this.value,i=this.displayfield||this.displaylabel,o=this.displayexpression;return _.isObject(n)?(_.isArray(n)?_.forEach(n,(function(n){_.isObject(n)&&t.push(e.evaluateExpr(n,i,o))})):t.push(this.evaluateExpr(n,i,o)),_.join(t,",")):null==n?"":this.value},t.prototype.getCaption=function(){return void 0===this.value||null===this.value?_.get(this.form.dataoutput,this._fieldName)||"":this.value},t.prototype.notifyChanges=function(){_.forEach(this.notifyForFields,(function(e){e.fieldValidations.validate()}))},t.prototype.observeOn=function(e){this.fieldValidations.observeOn(e,"formfields")},t.prototype.setUpValidators=function(e){this.fieldValidations.setUpValidators(e)},t.prototype.setAsyncValidators=function(e){this.fieldValidations.setAsyncValidators(e)},t.prototype.setValidators=function(e){this.fieldValidations.setValidators(e)},t.prototype.setFormWidget=function(e,t){this.formWidget&&this.formWidget.widget&&(this.formWidget.widget[e]=t)},t.prototype.boundFn=function(e){return e()},t.prototype.setMaxFormWidget=function(e,t){this.formWidgetMax&&(this.formWidgetMax.widget[e]=t)},t.prototype.onPropertyChange=function(t,n,i){var o=this.form.dirty;if("tabindex"!==t&&e.prototype.onPropertyChange.call(this,t,n,i),!this.excludeProps.has(t)){if(this.widgettype===l.FormWidgetType.UPLOAD)return"required"===t&&this._debounceSetUpValidators(),void e.prototype.onPropertyChange.call(this,t,n,i);switch(this.setFormWidget(t,n),"placeholder"!==t&&this.setMaxFormWidget(t,n),t){case"defaultvalue":this.form.onFieldDefaultValueChange(this,n);break;case"maxdefaultvalue":this.maxValue=n,this.setMaxFormWidget("datavalue",n),this.form.onMaxDefaultValueChange();break;case"maxplaceholder":this.setMaxFormWidget("placeholder",n);break;case"required":o!==this.form.dirty&&this.form.markAsPristine();case"maxchars":case"minvalue":case"maxvalue":case"regexp":case"show":this._debounceSetUpValidators();break;case"primary-key":n&&this.form.setPrimaryKey(this._fieldName);break;case"display-name":this.displayname=n;break;case"readonly":this.setReadOnlyState()}}},t.prototype.onStyleChange=function(t,n,i){this.setFormWidget(t,n),this.setMaxFormWidget(t,n),e.prototype.onStyleChange.call(this,t,n,i)},Object.defineProperty(t.prototype,"datavalue",{get:function(){return this.formWidget&&this.formWidget.datavalue},set:function(e){this._control&&this.widgettype!==l.FormWidgetType.UPLOAD&&this._control.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.datavalue},set:function(e){this.datavalue=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.formWidgetMax&&this.formWidgetMax.datavalue},set:function(e){this._maxControl&&this._maxControl.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minValue",{get:function(){return this.value},set:function(e){this.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_control",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_maxControl",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName+"_max"]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){return this.formWidget&&this.formWidget.displayValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timestamp",{get:function(){return this.formWidget&&this.formWidget.timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"charlength",{get:function(){return this.formWidget&&this.formWidget.charlength},enumerable:!1,configurable:!0}),t.prototype.createControl=function(){return this.fb.control(void 0,{validators:this._validators})},t.prototype.onValueChange=function(e){var t,n,i,o;if(!this.isDestroyed){var r=$(this.nativeElement).find(".caption-floating");if(r.length>0){var a=l.isDefined(e)&&""!==e&&null!==e||r.find("input").val()||r.find("input:-webkit-autofill").length;this.app.notify("captionPositionAnimate",{displayVal:a,nativeEl:r,isSelectMultiple:this.formWidget&&this.formWidget.multiple,isFocused:this._activeField})}this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",this._triggeredByUser&&this.ngform.controls[this._fieldName].invalid?"true":"false"),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this.form.onFieldValueChange(this,e),this.notifyChanges(),(this.$element.find(".active").length>0||this.form.touched)&&((this._triggeredByUser||l.isMobile()&&this._clicktriggeredByUser&&l.isDateTimeType(this.widgettype))&&this.ngform.controls[this._fieldName].markAsTouched(),this.fieldValidations.setCustomValidationMessage())}},t.prototype.onStatusChange=function(e){this.isDestroyed||(this.showPendingSpinner="PENDING"===e,"PENDING"===e?this.formWidget.disabled=!0:this.formWidget.disabled!==this.disabled&&(this.formWidget.disabled=this.disabled))},t.prototype.setValidationMessage=function(e){var t=this;setTimeout((function(){t.validationmessage=e,t.setUpValidators(B)}))},t.prototype.setReadOnlyState=function(){var e;e=!this.form.isUpdateMode||(!this["primary-key"]||this["is-related"]||this.period?this.readonly:!("assigned"===this.generator&&"update"!==this.form.operationType)),this.setFormWidget("readonly",e)},t.prototype.resetDisplayInput=function(){l.isDefined(this.value)&&""!==this.value||this.formWidget&&this.formWidget.resetDisplayInput&&this.formWidget.resetDisplayInput()},t.prototype.triggerUploadEvent=function(e,t){var n={$event:e};"change"===t&&(n.newVal=e.target.files,n.oldVal=this._oldUploadVal,this._oldUploadVal=n.newVal),this.invokeEventCallback(t,n)},t.prototype.registerFormField=function(){var e=this._fieldName;if(this.parentList&&this.form.parentList!==this.parentList){for(var t=1,n=e;this.ngform.controls.hasOwnProperty(n);)n=e+"_"+t,t++;this.ngform.addControl(n,this.createControl()),this._fieldName=n}else this.ngform.addControl(e,this.createControl());var i=this._control.valueChanges.pipe(d.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return i.unsubscribe()}));var o=this._control.statusChanges.pipe(d.debounceTime(100)).subscribe(this.onStatusChange.bind(this));if(this.registerDestroyListener((function(){return o.unsubscribe()})),"true"===this.isRange){this.ngform.addControl(e+"_max",this.createControl());var r=this._maxControl.valueChanges.pipe(d.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return r.unsubscribe()}))}this.value=_.get(this.form.formdata,this._fieldName)},t.prototype.ngOnInit=function(){this.ngform=this.form.ngform,this.registerFormField(),this.fieldValidations=new i.BaseFieldValidations(this,this.formWidget,this.widgettype,this._control,this.form),e.prototype.ngOnInit.call(this)},t.prototype.ngAfterContentInit=function(){var t=this;e.prototype.ngAfterContentInit.call(this),this.formWidget&&(this._initPropsRes(),this.setFormWidget("binddisplaylabel",this.binddisplaylabel),this.setFormWidget("binddisplayexpression",this.binddisplayexpression),this.setFormWidget("binddisplayimagesrc",this.binddisplayimagesrc),this.setFormWidget("bindChipclass",this.bindChipclass),this.setFormWidget("binddataset",this.binddataset)),this.registerReadyStateListener((function(){if(t.key=t._fieldName||t.target||t.binding,t.viewmodewidget=t.viewmodewidget||i.getDefaultViewModeWidget(t.widgettype),t.widgettype===l.FormWidgetType.UPLOAD){var e;e=t.filetype?G[t.filetype]:"",t.permitted=e+(t.extensions?(e?",":"")+t.extensions:"")}l.isMobile()&&t.viewport.isMobileType?t["mobile-display"]||(t.widget.show=!1):t.viewport.isTabletType?t["tablet-display"]||(t.widget.show=!1):t["pc-display"]||(t.widget.show=!1),t.fieldDefConfig.displaname=t.displayname,t.fieldDefConfig.show=t.show,t.fieldDefConfig.isRelated=t["is-related"],t.fieldDefConfig.inputtype=t.inputtype,t.fieldDefConfig.generator=t.generator,t.fieldDefConfig.placeholder=t.placeholder,t.fieldDefConfig.primaryKey=t["primary-key"],t.fieldDefConfig.required=t.required,t.fieldDefConfig._readonly=t.readonly,t.fieldDefConfig.regexp=t.regexp,t.fieldDefConfig.type=t.type,t.fieldDefConfig.key=t.key,t.fieldDefConfig.mobileDisplay=t["mobile-display"],t.fieldDefConfig.name=t.name,t.fieldDefConfig.pcDisplay=t["pc-display"],t.fieldDefConfig.tabletDisplay=t["tablet-display"],t.fieldDefConfig.validationmessage=t.validationmessage,t.fieldDefConfig.viewmodewidget=t.viewmodewidget,t.fieldDefConfig.widget=t.widgettype,t.form.registerFormFields(t.widget),l.addForIdAttributes(t.nativeElement),t.setReadOnlyState()}))},t}(i.StylableComponent);V.initializeProps=j(),V.decorators=[{type:t.Directive,args:[{selector:"[wmFormField]",exportAs:"wmFormField",providers:[i.provideAsWidgetRef(V),i.provideAs(V,s.NG_VALUE_ACCESSOR,!0),{provide:i.Context,useValue:{},multi:!0}]}]}],V.ctorParameters=function(){return[{type:t.Injector},{type:x},{type:s.FormBuilder},{type:l.Viewport},{type:l.App},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:String,decorators:[{type:t.Attribute,args:["chipclass.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayexpression.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displaylabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["widgettype"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayimagesrc.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["is-range"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["pc-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["mobile-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["tablet-display"]}]},{type:Array,decorators:[{type:t.Self},{type:t.Inject,args:[i.Context]}]}]},V.propDecorators={formWidget:[{type:t.ContentChild,args:["formWidget",{static:!0}]}],formWidgetMax:[{type:t.ContentChild,args:["formWidgetMax"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}],handleClick:[{type:t.HostListener,args:["click",["$event"]]}]};var U=function(){function e(e,t,n){this.subscribedWidget=e,this.app=t,this.dialogService=n,e.addRow=this.addRow.bind(this),e.updateRow=this.updateRow.bind(this),e.deleteRow=this.deleteRow.bind(this),e.call=this.call.bind(this)}return e.prototype.addRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.INSERT,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.updateRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.UPDATE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.deleteRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.DELETE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.successHandler=function(e,t){l.triggerFn(e.success,t)},e.prototype.errorHandler=function(e,t){this.app.notifyApp(t,"error","ERROR"),l.triggerFn(e.error,t)},e.prototype.getRecords=function(e,t){var n,o,r=this;"None"!==this.subscribedWidget.navigation&&this.subscribedWidget.dataNavigator?(o=this.subscribedWidget.dataNavigator,t===i.Live_Operations.DELETE?(o.dataSize-=1,o.calculatePagingValues(),n=o.pageCount<o.dn.currentPage?"prev":void 0):("last"===(n=t===i.Live_Operations.INSERT?"last":"current")&&(o.dataSize+=1),o.calculatePagingValues()),o.navigatePage(n,null,!0,(function(t){r.successHandler(e,t)}))):this.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(t){r.successHandler(e,t)}),(function(t){r.errorHandler(e,t)}))},e.prototype.performCUDOperation=function(e,t,n){var o=this;i.performDataOperation(this.subscribedWidget.datasource,e,{operationType:t}).then((function(e){e.error?o.errorHandler(n,e.error):("wm.CrudVariable"===o.subscribedWidget.datasource.category&&"delete"===t?o.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(e){o.successHandler(n,e)}),(function(e){o.errorHandler(n,e)})):o.getRecords(n,t),"delete"===t&&o.app.notifyApp(o.app.appLocale.MESSAGE_DELETE_RECORD_SUCCESS,"success"))}),(function(e){o.errorHandler(n,e)}))},e.prototype.insertRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.updateRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.deleteRecord=function(e,t,n){var i=this;this.dialogService.showAppConfirmDialog({title:this.app.appLocale.MESSAGE_DELETE_RECORD||"Delete Record",iconclass:"wi wi-delete fa-lg",message:this.subscribedWidget.confirmdelete||"Are you sure you want to delete this?",oktext:this.subscribedWidget.deleteoktext||"Ok",canceltext:this.subscribedWidget.deletecanceltext||"Cancel",onOk:function(){i.performCUDOperation(e,t,n),i.dialogService.closeAppConfirmDialog()},onCancel:function(){l.triggerFn(n.cancelDeleteCallback),i.dialogService.closeAppConfirmDialog()}})},e.prototype.performOperation=function(e,t){var n={row:t.row,prevData:{},rowData:{},transform:!0,skipNotification:!0};switch(e===i.Live_Operations.UPDATE&&(n.rowData=t.rowData,n.prevData=t.prevData),e){case i.Live_Operations.INSERT:this.insertRecord(n,e,t);break;case i.Live_Operations.UPDATE:this.updateRecord(n,e,t);break;case i.Live_Operations.DELETE:this.deleteRecord(n,e,t);break;case i.Live_Operations.READ:this.getRecords(t,e)}},e.prototype.call=function(e,t,n,i){t.success=n,t.error=i,this.performOperation(e,t)},e}();U.decorators=[{type:t.Directive,args:[{selector:"[wmLiveActions]"}]}],U.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[p.ListComponent]}]},{type:l.App},{type:l.AbstractDialogService}]};var W=function(){function e(e,t,n,i){this.dialogService=n,this.app=i,e&&(this.isLayoutDialog=!0,this.dialogId=e),this.dependson=t,this.eventSubscription=this.app.subscribe("wm-event",this.handleEvent.bind(this))}return e.prototype.openFormDialog=function(){this.dialogService.open(this.dialogId)},e.prototype.onUpdate=function(e,t,n){this.editMode=n||this.editMode,this.form.operationType=i.Live_Operations.UPDATE,this.form.isSelected=!0;var o=this.currentFormData;e&&t&&(o=t.multiselect?e[0]:e[e.length-1]),this.form.setFormData(o),this.form.edit(),this.editMode||(this.form.isUpdateMode=!1)},e.prototype.onInsert=function(){this.form.operationType=i.Live_Operations.INSERT,this.form.isSelected=!0,this.form.setFormData({}),this.form.new()},e.prototype.handleEvent=function(e){if(this.dependson===e.widgetName)switch(this.currentOp=e.eventName,e.eventName){case i.Live_Operations.UPDATE:this.currentFormData=e.row,this.isLayoutDialog?this.openFormDialog():this.onUpdate(void 0,void 0,!0);break;case i.Live_Operations.INSERT:this.isLayoutDialog?this.openFormDialog():this.onInsert();break;case i.Live_Operations.DELETE:this.app.Widgets[this.dependson].call("delete",{row:e.row});break;case i.Live_Operations.READ:this.isLayoutDialog||(this.form.isUpdateMode=!1);break;case"rerender":e.dataSource&&e.dataSource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list"});break;case"selectedItemChange":e.table&&this.onUpdate(e.row,e.table);break;case"resetEditMode":this.editMode=!1}},e.prototype.onFormRender=function(){var e=this;this.form&&this.isLayoutDialog&&(this.form.isLayoutDialog=!0,setTimeout((function(){e.currentOp===i.Live_Operations.UPDATE?e.onUpdate(void 0,void 0,!0):e.currentOp===i.Live_Operations.INSERT&&e.onInsert()}),250))},e.prototype.ngAfterContentInit=function(){var e=this;this.formChildren.first?this.form=this.formChildren.first:this.formSubscription=this.formChildren.changes.subscribe((function(t){e.form=t.first,e.onFormRender()})),this.app.notify("setup-cud-listener",this.dependson)},e.prototype.ngOnDestroy=function(){this.formSubscription&&this.formSubscription.unsubscribe(),this.eventSubscription&&this.eventSubscription()},e}();W.decorators=[{type:t.Directive,args:[{selector:"[dependson]"}]}],W.ctorParameters=function(){return[{type:String,decorators:[{type:t.Attribute,args:["dialogid"]}]},{type:String,decorators:[{type:t.Attribute,args:["dependson"]}]},{type:l.AbstractDialogService},{type:l.App}]},W.propDecorators={formChildren:[{type:t.ContentChildren,args:[x,{descendants:!0}]}]};var q="EMPTY_NULL_FILTER",z=function(){function e(e){var t=this;this.form=e,this._filter=l.debounce((function(e){t.filter(e)}),250),e.clearFilter=this.clearFilter.bind(this),e.applyFilter=this.applyFilter.bind(this),e.filter=this.filter.bind(this),e.filterOnDefault=this.filterOnDefault.bind(this),e.execute=this.execute.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onMaxDefaultValueChange=this.onMaxDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.registerFormWidget=this.registerFormWidget.bind(this)}return e.prototype.execute=function(e,t){return e===l.DataSource.Operation.LIST_RECORDS||e===l.DataSource.Operation.DOWNLOAD?this.applyFilter(t):e===l.DataSource.Operation.GET_OPTIONS?this._options||{}:e===l.DataSource.Operation.GET_PAGING_OPTIONS?this.form.pagination:this.form.datasource?e===l.DataSource.Operation.FETCH_DISTINCT_VALUES?i.fetchDistinctValues(this.form.datasource,this.form.formFields,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter,EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}):this.form.datasource.execute(e,t):{}},e.prototype.onFieldDefaultValueChange=function(e,t){e.minValue=t,e.value=t,this.filterOnDefault()},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t,{EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}),this.form.autoupdate&&l.isDefined(t)&&this._filter()},e.prototype.onMaxDefaultValueChange=function(){var e=this;setTimeout((function(){e.filterOnDefault()}))},e.prototype.onDataSourceChange=function(){var e=this,t=this.form.datasource;t&&(this.form.formFields.forEach((function(n){i.isDataSetWidget(n.widgettype)&&(i.getDistinctValuesForField(t,n.widget,{widget:"widgettype",enableemptyfilter:e.form.enableemptyfilter,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}),i.applyFilterOnField(t,n.widget,e.form.formFields,n.value,{isFirst:!0,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}))})),this._filter(this._options))},e.prototype.clearFilter=function(){var e=this;this.form.resetFormState(),this.form.formFields.forEach((function(t){!t.readonly&&t.show&&(t.widgettype!==l.FormWidgetType.AUTOCOMPLETE&&t.widgettype!==l.FormWidgetType.TYPEAHEAD||e.form.$element.find("div[name="+t.name+"] input").val(""),t["is-range"]?(t.minValue="",t.maxValue=""):(t.value="",t.resetDisplayInput()))})),setTimeout((function(){e._filter()}))},e.prototype.submitForm=function(){this.filter()},e.prototype.applyFilter=function(e){return(e=e?e.data||e:{}).page=e.page||1,e.orderBy=l.isDefined(e.orderBy)?e.orderBy:this.orderBy,this.filter(e)},e.prototype.filter=function(e){var t=this;if(this.form.datasource){var n,o,r={},a={},s=1;s=(e=e||{}).page||s,n=l.isDefined(e.orderBy)?e.orderBy:this.orderBy||"",this.orderBy=n,this.form.formFields.forEach((function(e){var n,i="div[name="+e.name+"] input",o=t.form.$element;if((e.widgettype===l.FormWidgetType.AUTOCOMPLETE||e.widgettype===l.FormWidgetType.TYPEAHEAD)&&o)return n=o.find(i),void(e["is-range"]?a[e.field]={minValue:l.isDefined(e.minValue)?e.minValue:n.first().val(),maxValue:l.isDefined(e.maxValue)?e.maxValue:n.last().val()}:a[e.field]={value:l.isDefined(e.value)?e.value:n.val()});e["is-range"]?a[e.field]={minValue:e.minValue,maxValue:e.maxValue}:a[e.field]={value:e.value}}));try{if(!1===(o=this.form.invokeEventCallback("beforeservicecall",{$data:a})))return;if(o&&o.error)return void this.form.toggleMessage(!0,o.error,"error","ERROR");this.form.formFields.forEach((function(e){e["is-range"]?(e._minValue=a[e.field].minValue,e._maxValue=a[e.field].maxValue):e._value=a[e.field].value}))}catch(e){if("Abort"===e.message)return}return this.form.formFields.forEach((function(e){var n,o,a=e.field,s=e._minValue,c=e._maxValue;if(e["is-related"]&&(a+="."+e["lookup-field"]),e["is-range"])n=i.getRangeFieldValue(s,c),o=i.getRangeMatchMode(s,c),l.isDefined(n)&&(r[a]={value:n,matchMode:o,logicalOp:"AND"});else{switch(e.widgettype){case l.FormWidgetType.SELECT:case l.FormWidgetType.RADIOSET:i.getEnableEmptyFilter(t.form.enableemptyfilter)&&e._value===q?(o=i.getEmptyMatchMode(t.form.enableemptyfilter),n=e._value):e.type===l.DataType.BOOLEAN?l.isDefined(e._value)&&""!==e._value&&(n=JSON.parse(e._value)):n=e._value;break;case l.FormWidgetType.CHECKBOXSET:case l.FormWidgetType.CHIPS:e._value&&e._value.length&&(n=e._value);break;case l.FormWidgetType.CHECKBOX:case l.FormWidgetType.TOGGLE:l.isDefined(e._value)&&""!==e._value&&(n=e.type===l.DataType.BOOLEAN?JSON.parse(e._value):e._value);break;default:n=e._value}l.isDefined(n)&&""!==n&&null!==n&&(r[a]={},o?(r[a].matchMode=o,n=void 0):(e.type===l.DataType.STRING||e.isRelated)&&(r[a].matchMode=o||e.matchmode||t.form.datasource.execute(l.DataSource.Operation.GET_MATCH_MODE)),r[a].value=n,r[a].logicalOp="AND",r[a].type=e.type)}})),e.exportType?this.form.datasource.execute(l.DataSource.Operation.DOWNLOAD,{data:{matchMode:"anywhereignorecase",filterFields:r,orderBy:n,exportType:e.exportType,logicalOp:"AND",exportSize:e.exportSize,fields:e.fields,fileName:e.fileName}}):this.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{filterFields:r,orderBy:n,page:s,pagesize:this.form.pagesize||20,skipDataSetUpdate:!0,inFlightBehavior:"executeAll"}).then((function(e){var i=e.data;return t.form.pagination=e.pagination,i.error?(t.form.toggleMessage(!0,i.error,"error","ERROR"),t.form.onResultCb(i,!1)):(t._options={page:s,orderBy:n},t.form.result=l.getClonedObject(i),t.form.onResultCb(i,!0)),l.$appDigest(),t.form.result}),(function(e){return t.form.toggleMessage(!0,e,"error","ERROR"),t.form.onResultCb(e,!1),e}))}},e.prototype.filterOnDefault=function(){_.find(this.form.formFields,(function(e){return l.isDefined(e.value)||l.isDefined(e.minValue)||l.isDefined(e.maxValue)}))&&this._filter(this._options)},e.prototype.registerFormWidget=function(e){var t=e.key||e.name;this.form.filterWidgets[t]=e},e}();z.initializeProps=S(),z.decorators=[{type:t.Directive,args:[{selector:"[wmLiveFilter]"}]}],z.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[x]}]}]};var H=function(e){return e.widgettype===l.DataType.TIME||e.type===l.DataType.TIME&&!e.widgettype},Y=H,K=function(e){if(e){var t=(new Date).toDateString();return new Date(t+" "+e).getTime()}},Q=K,X=function(){function e(e,t,n,i,o){var r=this;this.form=e,this.datePipe=n,this.dialogService=i,this._debouncedSavePrevDataValues=l.debounce((function(){r.savePrevDataValues()}),250),t&&!this.form.parentForm?(this.form._liveTableParent=t,this.form.isLayoutDialog=t.isLayoutDialog,t.onFormReady(this.form)):this.form.isLayoutDialog="dialog"===o,e.cancel=this.cancel.bind(this),e.reset=this.reset.bind(this),e.delete=this.delete.bind(this),e.save=this.save.bind(this),e.saveAndNew=this.saveAndNew.bind(this),e.saveAndView=this.saveAndView.bind(this),e.setPrimaryKey=this.setPrimaryKey.bind(this),e.constructDataObject=this.constructDataObject.bind(this),e.changeDataObject=this.setFormData.bind(this),e.setFormData=this.setFormData.bind(this),e.findOperationType=this.findOperationType.bind(this),e.clearData=this.clearData.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.form_registerFormFields=e.registerFormFields,e.registerFormFields=this.registerFormFields.bind(this)}return e.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},e.prototype.registerFormFields=function(e){var t=this.form.getFormFields();this.form.form_registerFormFields(e),this.form.isDataSourceUpdated&&this._updateFieldOnDataSourceChange(e,t)},e.prototype._updateFieldOnDataSourceChange=function(e,t){!e.isDataSetBound&&i.isDataSetWidget(e.widgettype)&&(e["is-related"]?(e.isDataSetBound=!0,i.fetchRelatedFieldData(this.form.datasource,e.widget,{relatedField:e.key,datafield:i.ALLFIELDS,widget:"widgettype"})):(i.getDistinctValuesForField(this.form.datasource,e.widget,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter}),i.applyFilterOnField(this.form.datasource,e.widget,t,e.value,{isFirst:!0})))},e.prototype.onDataSourceChange=function(){var e=this;_.get(this.form.formFields,"length")&&(this.form.isDataSourceUpdated=!0);var t=this.form.getFormFields();t.forEach((function(n){e._updateFieldOnDataSourceChange(n,t)}))},e.prototype.onFieldDefaultValueChange=function(e,t){"update"!==this.form.operationType&&(l.isDefined(t)&&null!==t&&""!==t&&"null"!==t?e.value=i.parseValueByType(t,e.type,e.widgettype,e.trailingzero):e.value=void 0,this.form.dirty&&!this._triggeredByUser&&this.form.markAsPristine(),this._debouncedSavePrevDataValues())},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t)},e.prototype.getBlobURL=function(e,t,n){var i,o="";return null!=n&&this.form.datasource?(i=e[(this.form.datasource.execute(l.DataSource.Operation.GET_PRIMARY_KEY)||[])[0]],o+=this.form.datasource.execute(l.DataSource.Operation.GET_BLOB_URL,{primaryValue:i,columnName:t}),o+="?"+Math.random()):o},e.prototype.setFormData=function(e,t){var n=this;e&&((t=t||this.form.formFields).forEach((function(t){var i=_.get(e,t.key||t.name);H(t)?t.value=K(i):t.type===l.DataType.BLOB?(n.form.resetFileUploadWidget(t,!0),t.href=n.getBlobURL(e,t.key,i),t.value=_.isString(i)?"":i):n.form.setFieldValue(t,e)})),this.savePrevDataValues(),this.form.constructDataObject())},e.prototype.onDataSourceUpdate=function(e,t,n){t?this.form.new():(this.form.setFormData(e),this.closeDialog()),this.form.isUpdateMode=!l.isDefined(n)||n},e.prototype.savePrevformFields=function(){this.form.prevformFields=l.getClonedObject(this.form.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},e.prototype.getPrevformFields=function(){var e=this;this.form.formFields.map((function(t){var n=e.form.prevformFields.find((function(e){return e.key===t.key}));t.value=n.value}))},e.prototype.getDataObject=function(){return this.form.operationType===i.Live_Operations.INSERT?{}:l.isDefined(this.form.prevDataObject)&&!l.isEmptyObject(this.form.prevDataObject)?l.getClonedObject(this.form.prevDataObject):l.getClonedObject(this.form.formdata||{})},e.prototype.constructDataObject=function(e){var t=this,n=this.getDataObject(),i=this.form.name;return(e?this.form.prevformFields:this.form.getFormFields()).forEach((function(e){var o,r,a=_.split(e.key,"."),s=a[0]||e.key;e.widgettype&&l.isDateTimeType(e.widgettype)||l.isDateTimeType(e.type)?e.value?(o=l.getValidDateObject(e.value),r=e.outputformat===l.DataType.TIMESTAMP||e.type===l.DataType.TIMESTAMP?e.value?o:null:e.outputformat?t.datePipe.transform(o,e.outputformat):e.value):r=void 0:r=e.type===l.DataType.BLOB?l.getFiles(i,s+"_formWidget",e.multiple):e.type===l.DataType.LIST?e.value||void 0:null===e.value||""===e.value?void 0:e.value,1===a.length?n[s]=r:(n[s]=n[s]||{},n[s][a[1]]=r)})),e?n:(this.form.updateFormDataOutput(n),this.form.dataoutput)},e.prototype.setPrimaryKey=function(e){this.form.primaryKey=this.form.primaryKey||[],-1===this.form.primaryKey.indexOf(e)&&this.form.primaryKey.push(e)},e.prototype.findOperationType=function(){var e,t=this,n=!1,o=this.form.datasource&&this.form.datasource.execute(l.DataSource.Operation.GET_OPERATION_TYPE);return o&&"read"!==o?o:(this.form.primaryKey&&!_.isEmpty(this.form.formdata)&&(1===this.form.primaryKey.length?this.form.formdata[this.form.primaryKey[0]]&&(e=i.Live_Operations.UPDATE):0===this.form.primaryKey.length?(_.forEach(this.form.formdata,(function(e){e&&(n=!0)})),n&&(e=i.Live_Operations.UPDATE)):(n=_.some(this.form.primaryKey,(function(e){if(t.form.formdata[e])return!0})))&&(e=i.Live_Operations.UPDATE)),e||i.Live_Operations.INSERT)},e.prototype.getPrevDataValues=function(){var e=_.fromPairs(_.map(this.form.prevDataValues,(function(e){return[e.key,e.value]})));return this.form.formFields.forEach((function(t){t.value=e[t.key]||"",t.resetDisplayInput()})),e},e.prototype.savePrevDataValues=function(){this.form.prevDataValues=this.form.formFields.map((function(e){return{key:e.key,value:e.value}}))},e.prototype.clearData=function(){this.form.toggleMessage(!1),this.form.emptyDataModel()},e.prototype.setReadonlyFields=function(){this.form.formFields.forEach((function(e){e.setReadOnlyState()}))},e.prototype.reset=function(){var e,t=this;this.form.resetFormState(),e=this.getPrevDataValues(),this.form.formFields.forEach((function(n){var i;n.type!==l.DataType.BLOB&&"upload"!==n.widgettype||(t.form.resetFileUploadWidget(n,!0),n.href=t.getBlobURL(e,n.key,n.value)),null===(i=n.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid")})),this.form.constructDataObject()},e.prototype.closeDialog=function(){this.form.isLayoutDialog&&this.dialogService.close(this.form.dialogId)},e.prototype.cancel=function(){this.form.clearMessage(),this.form.isUpdateMode=!1,this.form.reset(),this.form.isSelected&&this.getPrevformFields(),this.form.isUpdateMode=!1,this.form._liveTableParent?this.form._liveTableParent.onCancel():this.closeDialog(),l.$appDigest()},e.prototype.delete=function(e){this.form.resetFormState(),this.form.operationType=i.Live_Operations.DELETE,this.form.prevDataObject=l.getClonedObject(this.form.formdata||{}),this.form.save(void 0,void 0,void 0,e)},e.prototype.saveAndNew=function(){this.save(void 0,!0,!0)},e.prototype.saveAndView=function(){this.save(void 0,!1)},e.prototype.submitForm=function(e){this.save(e)},e.prototype.save=function(e,t,n){var o=this;if(this.form.datasource){var r,a,s,c,p={};if(s=this.form.operationType=this.form.operationType||this.findOperationType(),!this.form.validateFieldsOnSubmit()){r=l.getClonedObject(this.form.constructDataObject()),a=this.form.prevformFields?this.form.constructDataObject(!0):r;try{if(!1===(c=this.form.invokeEventCallback("beforeservicecall",{$event:e,$operation:this.form.operationType,$data:r,options:p})))return;if(c&&c.error)return void this.form.toggleMessage(!0,c.error,"error")}catch(e){if("Abort"===e.message)return}if(this.form.operationType===i.Live_Operations.UPDATE&&this.form.ngform&&this.form.ngform.pristine&&this.form.isSelected&&_.isEqual(r,a))return this.form.toggleMessage(!0,this.form.appLocale.MESSAGE_NO_CHANGES,"info",""),void l.$appDigest();p.row=r,p.transform=!0,p.skipNotification=!0,s===i.Live_Operations.UPDATE&&(p.rowData=this.form.formdata,p.prevData=a),i.performDataOperation(this.form.datasource,p,{operationType:s}).then((function(e){var r,a=s===i.Live_Operations.INSERT?o.form.insertmessage:s===i.Live_Operations.UPDATE?o.form.updatemessage:o.form.deletemessage;return s===i.Live_Operations.DELETE?(r=p.row,o.form.emptyDataModel(),o.form.prevDataValues=[],o.form.isSelected=!1):r=e,o.form.onSuccess||o.form.toggleMessage(!0,a,"success"),o.form._liveTableParent?o.form._liveTableParent.onResult(s,e,n,t):(o.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}),o.onDataSourceUpdate(e,n,t)),{result:r,status:!0}}),(function(e){return o.form.onError||o.form.toggleMessage(!0,e,"error"),l.$appDigest(),{result:e,status:!1}})).then((function(t){o.form.resetFormState(),o.form.onResultCb(t.result,t.status,e)}))}}},e}();X.initializeProps=O(),X.decorators=[{type:t.Directive,args:[{selector:"[wmLiveForm]"}]}],X.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[x]}]},{type:h.LiveTableComponent,decorators:[{type:t.Optional}]},{type:i.ToDatePipe},{type:l.AbstractDialogService},{type:String,decorators:[{type:t.Attribute,args:["formlayout"]}]}]},X.propDecorators={onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var J=[x,k,F,V,U,W,z,X],Z=function(){};Z.decorators=[{type:t.NgModule,args:[{imports:[o.BasicModule,n.CommonModule,a.DesignDialogModule,r.InputModule,i.WmComponentsModule],declarations:b([],y(J)),exports:b([],y(J)),entryComponents:[]}]}],e.DependsonDirective=W,e.FormActionDirective=F,e.FormComponent=x,e.FormFieldDirective=V,e.FormModule=Z,e.FormWidgetDirective=k,e.LiveActionsDirective=U,e.LiveFilterDirective=z,e.LiveFormDirective=X,e["\u02750"]=Y,e["\u02751"]=Q,e["\u0275a"]=P,e["\u0275b"]=O,e["\u0275c"]=S,e["\u0275d"]=M,e["\u0275e"]=j,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/dialogs"),require("@wm/components/input"),require("@wm/core")):"function"==typeof define&&define.amd?define("@wm/components/dialogs/iframe-dialog",["exports","@angular/core","@angular/common","@wm/components/base","@wm/components/basic","@wm/components/dialogs","@wm/components/input","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.dialogs=e.wm.components.dialogs||{},e.wm.components.dialogs.iframedialog={}),e.ng.core,e.ng.common,e.wm.components.base,e.wm.components.basic,e.wm.components.dialogs,e.wm.components.input,e.wm.core)}(this,(function(e,t,n,i,o,r,a,s){"use strict";
|
|
548
|
+
***************************************************************************** */var m=function(e,t){return(m=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])})(e,t)};function f(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}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function g(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function v(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function b(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var w=new Map([["autocomplete",Object.assign({value:!1},i.PROP_BOOLEAN)],["captionalign",Object.assign({value:"left"},i.PROP_STRING)],["captionposition",Object.assign({value:"left"},i.PROP_STRING)],["captionsize",i.PROP_STRING],["captionwidth",Object.assign({value:"xs-12 sm-3 md-3 lg-3"},i.PROP_STRING)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dataset",i.PROP_ANY],["datasource",i.PROP_STRING],["expanded",Object.assign({value:!0},i.PROP_BOOLEAN)],["formdatasource",i.PROP_STRING],["name",i.PROP_STRING],["numberOfFields",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showindevice",Object.assign({displayType:"inline-block",value:"all"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]),P=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("action",i.PROP_STRING),e.set("defaultmode",Object.assign({value:"Edit"},i.PROP_STRING)),e.set("metadata",i.PROP_STRING),e.set("method",i.PROP_STRING),e.set("postmessage",Object.assign({value:"Data posted successfully"},i.PROP_STRING)),e.set("target",i.PROP_STRING),e.set("enctype",i.PROP_STRING),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Inline"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-form",e)},O=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("defaultmode",Object.assign({value:"View"},i.PROP_STRING)),e.set("formlayout",Object.assign({value:"inline"},i.PROP_STRING)),e.set("insertmessage",Object.assign({value:"Record added successfully"},i.PROP_STRING)),e.set("updatemessage",Object.assign({value:"Record updated successfully"},i.PROP_STRING)),e.set("deletemessage",Object.assign({value:"Record deleted successfully"},i.PROP_STRING)),e.set("errormessage",Object.assign({value:"An error occured. Please try again!"},i.PROP_STRING)),e.set("messagelayout",Object.assign({value:"Toaster"},i.PROP_STRING)),e.set("formdata",i.PROP_STRING),e.set("novalidate",i.PROP_BOOLEAN),e.set("validationtype",Object.assign({value:"default"},i.PROP_STRING)),e.set("iconclass",i.PROP_STRING),i.register("wm-liveform",e)},S=function(){l.isMobileApp()&&w.set("captionwidth",Object.assign({value:"xs-4 sm-4 md-4 lg-4"},i.PROP_STRING));var e=new Map(w);e.set("autoupdate",i.PROP_BOOLEAN),e.set("enableemptyfilter",Object.assign({value:" "},i.PROP_STRING)),e.set("pagesize",Object.assign({value:20},i.PROP_NUMBER)),e.set("iconclass",Object.assign({value:"wi wi-filter-list"},i.PROP_STRING)),i.register("wm-livefilter",e)},E={widgetType:"wm-form",hostClass:"panel app-panel app-form"},T={widgetType:"wm-form",hostClass:"app-form app-login-form"},R={widgetType:"wm-liveform",hostClass:"panel app-panel app-liveform liveform-inline"},A={widgetType:"wm-livefilter",hostClass:"panel app-panel app-livefilter clearfix liveform-inline"},C=function(e,t,n){var i=E;return null!==e?i=R:null!==t?i=A:"app-login"===n&&(i=T),i},I=function(e,t){var n="";return _.forEach(e,(function(e,t){n=n+" "+t+'="'+e+'"'})),'<wm-gridcolumn columnwidth="'+t+'">\n <wm-form-field '+n+"></wm-form-field>\n </wm-gridcolumn>"},D=function(e,t){var n=e.find("form.ng-invalid:visible, [formControlName].ng-invalid:visible").first(),i=t;return n.is("form")&&(i=t&&t.controls[n.attr("formControlName")||n.attr("name")])?D(n,i):{ngForm:i,$ele:n}},N=function(e,t,n){var i,o;if(!t.valid)if(t.controls)_.forEach(t.controls,(function(t,n){N(e,t,n)}));else{var r=e.$element.find('[wmformfield][key="'+n+'"]');r.length||(r=e.$element.find('[wmformfield][name="'+n+'"]')),r.length&&(r[0].setAttribute("__errormsg",r[0].getAttribute("__validationId")),null===(i=r[0].querySelector("input"))||void 0===i||i.setAttribute("aria-invalid",t.invalid),null===(o=r[0].querySelector("input"))||void 0===o||o.setAttribute("aria-describedby",r[0].getAttribute("__validationId"))),t.markAsTouched()}},x=function(e){function t(t,n,o,r,a,s,c,p,u,d,h,m,f,g,v,y,b,w,P,O){var S=e.call(this,t,C(y,b,w))||this;S.fb=n,S.app=o,S.dialogService=r,S.dynamicComponentProvider=a,S.ngZone=s,S.parentList=c,S.parentForm=p,S.parentPrefab=u,S.parentPartial=d,S.onBeforeSubmitEvt=h,S.onSubmitEvt=m,S.onBeforeRenderEvt=f,S.binddataset=g,S.bindformdata=v,S._widgetClass="",S._captionClass="",S.formFields=[],S.formfields={},S.formWidgets={},S.filterWidgets={},S.buttonArray=[],S.dataoutput={},S.formdata={},S.statusMessage={caption:"",type:""},S.primaryKey=[],S._debouncedUpdateFieldSource=_.debounce(S.updateFieldSource,350),S.validationMessages=[],S._debouncedSubmitForm=l.debounce((function(e){S.ngZone.run((function(){S.submitForm(e)}))}),250),i.styler(S.nativeElement,S),l.removeAttr(S.nativeElement,"title"),S.isUpdateMode=!0,S.dialogId=S.nativeElement.getAttribute("dialogId"),S.ngform=n.group({}),S.bindingValue=P||O;var E=S.ngform.valueChanges.subscribe(S.updateDataOutput.bind(S));return S.registerDestroyListener((function(){return E.unsubscribe()})),S.elScope=S,S.addEventsToContext(S.context),S}return f(t,e),Object.defineProperty(t.prototype,"isLayoutDialog",{get:function(){return this._isLayoutDialog},set:function(e){e&&l.removeClass(this.nativeElement,"panel app-panel liveform-inline"),this._isLayoutDialog=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUpdateMode",{get:function(){return this._isUpdateMode},set:function(e){this._isUpdateMode=e,this.formFields.forEach((function(t){t.setReadOnlyState(e)}))},enumerable:!1,configurable:!0}),t.prototype.submit=function(e){this._debouncedSubmitForm(e)},t.prototype.onReset=function(){this.reset()},t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},Object.defineProperty(t.prototype,"parentFormArray",{get:function(){return this.parentForm&&this.isParentList&&this.parentForm.ngform.get(this.parentList.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isParentList",{get:function(){if(this.parentList&&this.parentForm&&!l.isDefined(this._formIsInList)){var e=this.$element.closest('.app-livelist[name="'+this.parentList.name+'"]');e.length&&(this._formIsInList=!e.find('form[widget-id="'+this.parentForm.widgetId+'"]').length)}return l.isDefined(this._formIsInList)?this._formIsInList:this.parentList},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;setTimeout((function(){e.componentRefs.forEach((function(t){t.name&&(e.formWidgets[t.name]=t)}))}),250)},t.prototype.ngAfterViewInit=function(){this.parentForm&&this.parentForm.ngform&&this.isParentList&&(_.get(this.parentForm.ngform.controls,this.parentList.name)||this.parentForm.ngform.setControl(this.parentList.name,new s.FormArray([])),this.parentFormArray.push(this.ngform),this.formArrayIndex=this.parentFormArray.length-1),this.addInnerNgFormToForm(this.bindingValue)},t.prototype.findOperationType=function(){},t.prototype.addInnerNgFormToForm=function(e){if(this.parentForm&&this.parentForm.ngform){if(this.isParentList)return;var t=this.parentPrefab||this.parentPartial;if(t){var n=(this.parentPrefab?t.$element.find("[wmprefabcontainer]"):t.$element).find("form").first();_.get(n[0],"widget.widgetId")===this.widgetId&&(n.isParentList||n.siblings("form").length||(e=_.get(t,"name")))}for(var i=1,o=e;this.parentForm.ngform.controls.hasOwnProperty(o);)o=e+"_"+i,i++;this.formGroupName=o,this.parentForm.ngform.addControl(o,this.ngform)}},t.prototype.addEventsToContext=function(e){var t=this;e.cancel=function(){return t.cancel()},e.reset=function(){return t.reset()},e.save=function(e){return t.save(e)},e.saveAndNew=function(){return t.saveAndNew()},e.saveAndView=function(){return t.saveAndView()},e.delete=function(){return t.delete()},e.new=function(){return t.new()},e.edit=function(){return t.edit()},e.highlightInvalidFields=function(){return t.highlightInvalidFields()},e.filter=function(){return t.filter()},e.clearFilter=function(){return t.clearFilter()},e.submit=function(e){return t.submit(e)}},t.prototype.setValidationOnInnerForms=function(e){var t=this,n=this.getNativeElement().querySelectorAll(".app-form");_.forEach(n,(function(n){var i=n.widget,o=_.get(i,"formGroupName")||i.name;l.isDefined(i.formArrayIndex)&&(o=o+"["+i.formArrayIndex+"]");for(var r=i;_.get(r,"parentForm");){var a=r.parentForm.formGroupName||r.parentForm.name;r.parentForm.parentFormArray&&(a=a+"["+r.parentForm.formArrayIndex+"]"),o=a+"."+o,r=r.parentForm}t.setValidationOnFields(i,o,e)}))},t.prototype.setValidationOnFields=function(e,t,n){var i=this,o=e.ngform.controls,r=e.formFields;r&&_.forEach(o,(function(o,a){var s,l=r.find((function(e){return e.key===a}));!l||n&&!o.touched||(null===(s=l.nativeElement.querySelector("input"))||void 0===s||s.setAttribute("aria-invalid",o.invalid),i.prepareValidationObj(o,a,l,t),i.prepareValidationObj.call(e,o,a,l,t))}))},t.prototype.prepareValidationObj=function(e,t,n,i){var o=this.validationMessages.findIndex((function(e){return e.field===t&&e.fullyQualifiedFormName===i}));e.invalid?-1===o?this.validationMessages.push({field:t,value:n.value,errorType:_.keys(e.errors),message:n.validationmessage||"",getElement:function(){return n.$element.find("[focus-target]")},formName:_.last(i.split(".")),fullyQualifiedFormName:i}):(this.validationMessages[o].value=n.value,this.validationMessages[o].errorType=_.keys(e.errors)):e.valid&&o>-1&&this.validationMessages.splice(o,1)},t.prototype.setValidationMsgs=function(e){!this.formFields.length&&_.isEmpty(this.ngform.controls)||(this.setValidationOnFields(this,this.name,e),this.setValidationOnInnerForms(e))},t.prototype.handleEvent=function(t,n,i,o){"submit"!==n&&e.prototype.handleEvent.call(this,this.nativeElement,n,i,o)},t.prototype.updateFieldSource=function(){var e=this;this.formdatasource&&this.formdatasource.execute(l.DataSource.Operation.IS_API_AWARE)||this.formdatasource&&!this.formdatasource.twoWayBinding||this.formFields.forEach((function(t){t.setFormWidget("datavaluesource",e.formdatasource),t.setFormWidget("binddatavalue",e.bindformdata+"."+t.key)}))},t.prototype.highlightInvalidFields=function(){N(this,this.ngform,"")},t.prototype.validateFieldsOnSubmit=function(){if(this.setValidationMsgs(),"delete"!==this.operationType&&("html"===this.validationtype||"default"===this.validationtype)&&this.ngform&&this.ngform.invalid){if(this.ngform.invalid){"default"===this.validationtype&&this.highlightInvalidFields();var e=D(this.$element,this.ngform),t=e.ngForm,n=e.$ele;if((n=n.parent().find("[focus-target]")).length){n.hasClass("app-search-input")||n.focus();var i=t&&t.controls[n.attr("formControlName")||n.attr("name")];return i&&i.markAsTouched&&i.markAsTouched(),l.$appDigest(),!0}return!0}return!1}return!1},t.prototype.onPropertyChange=function(t,n,i){switch(t){case"captionalign":this.captionAlignClass="align-"+n;break;case"captionposition":case"captionwidth":this.setLayoutConfig();break;case"captionsize":this.captionsize=n;break;case"novalidate":this.widget.validationtype=!0===n||"true"===n?"none":"default";break;case"formdata":if(_.isEqual(n,i))break;_.isArray(n)?this.setFormData(_.last(n)):this.setFormData(n),!this.isDataSourceUpdated&&this.datasource&&this.onDataSourceChange();break;case"defaultmode":this.isLayoutDialog||(this.updateMode=!(!n||"Edit"!==n),this.isUpdateMode=this.updateMode);break;case"datasource":this.onDataSourceChange();break;case"formdatasource":this.onFormDataSourceChange();break;case"metadata":this.generateFormFields();break;case"dataset":this.getFormFields().forEach((function(e){!e.isDataSetBound&&_.get(e.formWidget,"dataset$")&&e.formWidget.dataset$.next()}));break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onResultCb=function(e,t,n){var i={$event:n,$data:e,$operation:this.operationType};this.invokeEventCallback("result",i),t?this.invokeEventCallback("success",i):this.invokeEventCallback("error",i)},t.prototype.toggleMessage=function(e,t,n,i){var o;e&&t?(o="error"===n&&this.errormessage?this.errormessage:t,"Inline"===this.messagelayout?(o=this.checkAppServiceErrorMsg(n)||o,this.statusMessage={caption:o||"",type:n},this.messageRef&&this.messageRef.showMessage(this.statusMessage.caption,this.statusMessage.type),l.isElementInViewport(this.$element[0])||l.scrollToElement(this.$element[0])):this.app.notifyApp(o,n,i)):this.statusMessage.caption=""},t.prototype.checkAppServiceErrorMsg=function(e){var t=_.get(this.app,"Actions.appNotification");if(t&&"error"===e)return t.getMessage()},t.prototype.clearMessage=function(){this.toggleMessage(!1)},t.prototype.setLayoutConfig=function(){var e;e=i.getFieldLayoutConfig(this.captionwidth,this.captionposition,_.get(this.app.selectedViewPort,"os")),this._widgetClass=e.widgetCls,this._captionClass=e.captionCls,l.$appDigest()},t.prototype.registerFormWidget=function(e){var t=e.name||e.key;this.formWidgets[t]=e},t.prototype.registerFormFields=function(e){var t=this.formFields.push(e);this.formfields[e.key]=e,this.registerFormWidget(e),this._debouncedUpdateFieldSource(),this.parentForm&&(this.parentForm.formFields.push(e),this.parentForm.formfields[e.key]=e,this.parentForm.setFormData(this.parentForm.formdata,this.formFields,this.formdata||{})),t!==this.numberOfFields||_.isEmpty(this.formdata)||(this.onDataSourceChange(),_.isArray(this.formdata)?this.setFormData(_.last(this.formdata)):this.setFormData(this.formdata))},t.prototype.registerActions=function(e){this.buttonArray.push(e)},t.prototype.updateFormDataOutput=function(e){var t=this;_.forEach(this.ngform.value,(function(n,i){_.find(t.formFields,{key:i})||(e[i]=n)})),this.dataoutput=e},t.prototype.constructDataObject=function(){var e=this,t={};return this.getFormFields().forEach((function(n){var i,o;if(o=null===(o=n.datavalue||n._control.value)||""===o?void 0:o,"file"===n.type&&(o=l.getFiles(e.name,n.key+"_formWidget",n.multiple)),i=n.key||n.target||n.name,n.form.widgetId!==e.widgetId&&n.form.formGroupName)(r=_.get(t,n.form.formGroupName,{}))[i]=o,_.set(t,n.form.formGroupName,r);else if(n.form.isParentList){var r;(r=_.get(t,n.form.parentList.name,[]))[n.form.formArrayIndex]=r[n.form.formArrayIndex]||{},r[n.form.formArrayIndex][i]=o,_.set(t,n.form.parentList.name,r)}else _.set(t,i,o)})),this.updateFormDataOutput(t),this.dataoutput},t.prototype.updateDataOutput=function(){this.constructDataObject(),this.ngform.touched&&this.setValidationMsgs(!0)},t.prototype.getFormFields=function(){var e=this;return _.filter(this.formFields,(function(t){return t.form.name===e.name}))},t.prototype.setFieldValue=function(e,t,n){var i=e.key||e.name,o=n||t;o&&((o.hasOwnProperty(i)||_.includes(i,".")&&o.hasOwnProperty(_.split(i,".")[0]))&&(e.value=_.get(o,i)),this.dirty&&!this._triggeredByUser&&this.markAsPristine());var r=e.form.formGroupName;r&&_.get(t,r)&&this.setFormData.call(e.form,t[r]),_.get(e.form,"parentFormArray")&&this.setFormDataFromParentFormData.call(e.form,t)},t.prototype.setFormData=function(e,t,n){var i=this;(t||this.formFields).forEach((function(t){i.setFieldValue(t,e,n),t.fieldValidations&&t.fieldValidations.setCustomValidationMessage()})),this.constructDataObject()},t.prototype.resetFormState=function(){this.validationMessages.length&&(this.validationMessages=[]),this.ngform&&(this.ngform.markAsUntouched(),this.ngform.markAsPristine())},t.prototype.reset=function(){var e=this;this.resetFormState(),this.formFields.forEach((function(t){var n;t.value="","upload"!==t.widgettype&&t.type!==l.DataType.BLOB||e.resetFileUploadWidget(t,!0),null===(n=t.nativeElement.querySelector("input"))||void 0===n||n.removeAttribute("aria-invalid")})),this.constructDataObject(),this.clearMessage()},t.prototype.savePrevformFields=function(){this.prevformFields=l.getClonedObject(this.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},t.prototype.savePrevDataValues=function(){this.prevDataValues=this.formFields.map((function(e){return{key:e.key,value:e.value}}))},t.prototype.setReadonlyFields=function(){this.formFields.forEach((function(e){e.setReadOnlyState()}))},t.prototype.resetFileUploadWidget=function(e,t){this.$element.find('[name="'+e.key+'_formWidget"]').val(""),e._control.reset(),t||(e.href="",e.value=null)},t.prototype.emptyDataModel=function(){var e=this;this.formFields.forEach((function(t){l.isDefined(t)&&(t.type===l.DataType.BLOB?e.resetFileUploadWidget(t):t.datavalue="")}))},t.prototype.setDefaultValues=function(){var e=this;this.formFields.forEach((function(t){e.onFieldDefaultValueChange(t,t.defaultvalue)}))},t.prototype.setOperationType=function(e){this.operationType=e||"insert"},t.prototype.new=function(){var e=this;this.resetFormState(),this.operationType=i.Live_Operations.INSERT,this.clearMessage(),this.isSelected&&this.savePrevformFields(),this.emptyDataModel(),setTimeout((function(){e.setDefaultValues(),e.savePrevDataValues(),e.constructDataObject()})),this.isUpdateMode=!0},t.prototype.edit=function(){this.resetFormState(),this.clearMessage(),this.operationType=i.Live_Operations.UPDATE,this.isSelected&&(this.savePrevformFields(),this.savePrevDataValues()),this.prevDataObject=l.getClonedObject(this.formdata||{}),this.setReadonlyFields(),this.isUpdateMode=!0,l.$appDigest()},t.prototype.triggerWMEvent=function(e){var t=this.nativeElement.getAttribute("dependson");t&&(l.$invokeWatchers(!0),this.app.notify("wm-event",{eventName:e,widgetName:t}))},t.prototype.submitForm=function(e){var t,n,o,r=this,a=this.datasource;if(!this.validateFieldsOnSubmit()){n=l.getClonedObject(this.constructDataObject());var s=function(){return{$event:e,$formData:n,$data:n}};if(this.onBeforeSubmitEvt){if(!1===this.invokeEventCallback("beforesubmit",s()))return;this.resetFormState()}else this.resetFormState();if(this.onSubmitEvt||a)if(a){var c=a.pagination&&a.pagination.number+1,p=this.operationType?this.operationType:"insert";i.performDataOperation(a,n,{operationType:p}).then((function(e){return"wm.CrudVariable"===a.category&&(r.triggerWMEvent("resetEditMode"),r.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list",page:c,preventMissingOpMsg:!0}),r.dialogId&&r.closeDialog()),l.isDefined(e.body)?(o=l.getValidJSON(e.body),o=l.isDefined(o)?o:e.body):o=e,{result:o,status:!0,message:r.postmessage,type:"success"}}),(function(e){return t=r.errormessage||e.error||e,l.$appDigest(),{result:_.get(e,"error")||e,status:!1,message:t,type:"error"}})).then((function(t){("error"===t.type&&!r.onError||"success"===t.type&&!r.onSuccess)&&r.toggleMessage(!0,t.message,t.type),r.invokeEventCallback("submit",s()),r.onResultCb(t.result,t.status,e)}))}else this.invokeEventCallback("submit",s()),this.onResultCb({},!0,e);else this.onResultCb({},!0,e)}},t.prototype.closeDialog=function(){this.dialogService.close(this.dialogId)},t.prototype.showButtons=function(e){var t=this;return _.some(this.buttonArray,(function(n){return _.includes(n.position,e)&&n.updateMode===t.isUpdateMode}))},t.prototype.expandCollapsePanel=function(){this.collapsible&&(this.expanded=!this.expanded)},t.prototype.onDataSourceUpdate=function(e,t,n){t?this.new():(this.setFormData(e),this.closeDialog()),this.isUpdateMode=!l.isDefined(n)||n},t.prototype.getNearestParentFormData=function(e){return e.parentForm?e.bindformdata||!_.get(e.parentForm,"formdata")||_.isEmpty(e.parentForm.formdata)?this.getNearestParentFormData(e.parentForm):e.parentForm.formdata:{}},t.prototype.setFormDataFromParentFormData=function(e){if(_.isEmpty(this.formdata)&&this.parentForm&&e)if(this.parentFormArray){var t=_.get(e,this.parentList.name);if(t)_.isArray(t)||(t=[t]),this.parentFormArray.patchValue(t),this.bindformdata||(this.formdata=t[this.formArrayIndex]),this.setFormData(this.formdata);else if(this.isParentList&&this.parentForm.formGroupName){var n=_.get(e,this.parentForm.formGroupName);this.setFormDataFromParentFormData(n)}}else this.setFormData(e)},t.prototype.onDataSourceChange=function(){if(_.get(this.formFields,"length")&&!this.bindformdata){this.isDataSourceUpdated=!0;var e=this.getNearestParentFormData(this);this.setFormDataFromParentFormData(e)}},t.prototype.onFormDataSourceChange=function(){this.updateFieldSource()},t.prototype.onFieldDefaultValueChange=function(e,t){e.value=i.parseValueByType(t,void 0,e.widgettype,e.trailingzero),this.dirty&&!this._triggeredByUser&&this.markAsPristine()},t.prototype.onFieldValueChange=function(){},t.prototype.generateFormFields=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,o,r,a,s,c,p,u;return v(this,(function(d){switch(d.label){case 0:if(_.isUndefined(this._isGridLayoutPresent)&&(this._isGridLayoutPresent=this.$element.find(".panel-body [wmlayoutgrid]").length>0),this._isGridLayoutPresent?(t=this.$element.find(".form-elements [wmlayoutgrid]").first(),e=Number(t.attr("columns"))||1):((t=this.$element.find(".form-elements .dynamic-form-container")).length||(this.$element.find(".form-elements").prepend('<div class="dynamic-form-container"></div>'),t=this.$element.find(".form-elements .dynamic-form-container")),e=1),n=12/e,i="",o=0,s=this.metadata?this.metadata.data||this.metadata:[],this.formFields=[],_.isEmpty(s))return[2];if(this.onBeforeRenderEvt&&(a=this.invokeEventCallback("beforerender",{$metadata:s}))&&(s=a),!_.isArray(s))return[2];for(;s[o];){for(c="",r=0;r<e;r++)s[o]&&(c+=I(s[o],n)),o++;i+="<wm-gridrow>"+c+"</wm-gridrow>"}return this._isGridLayoutPresent||(i="<wm-layoutgrid>"+i+"</wm-layoutgrid>"),this.dynamicFormRef.clear(),this._dynamicContext||(this._dynamicContext=Object.create(this.viewParent),this._dynamicContext.form=this),[4,this.dynamicComponentProvider.getComponentFactoryRef("app-form-dynamic-"+this.widgetId,i,{noCache:!0,transpile:!0})];case 1:return p=d.sent(),u=this.dynamicFormRef.createComponent(p,0,this.inj),l.extendProto(u.instance,this._dynamicContext),t[0].appendChild(u.location.nativeElement),this.setFormData(this.formdata),[2]}}))}))},Object.defineProperty(t.prototype,"mode",{get:function(){return this.operationType||this.findOperationType()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.ngform&&this.ngform.dirty},enumerable:!1,configurable:!0}),t.prototype.markAsPristine=function(e){void 0===e&&(e=!1),this.ngform.markAsPristine({onlySelf:e})},t.prototype.markAsDirty=function(e){void 0===e&&(e=!1),this.ngform.markAsDirty({onlySelf:e})},Object.defineProperty(t.prototype,"invalid",{get:function(){return this.ngform&&this.ngform.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"touched",{get:function(){return this.ngform&&this.ngform.touched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.ngform&&this.ngform.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pristine",{get:function(){return this.ngform&&this.ngform.pristine},enumerable:!1,configurable:!0}),t.prototype.markAsTouched=function(e){void 0===e&&(e=!1),this.ngform.markAsTouched({onlySelf:e})},t.prototype.markAsUntouched=function(e){void 0===e&&(e=!1),this.ngform.markAsUntouched({onlySelf:e})},t.prototype.invokeActionEvent=function(e,t){l.$parseEvent(t)(this.viewParent,Object.assign(this.context,{$event:e}))},t.prototype.ngOnDestroy=function(){var t=this.parentForm&&_.get(this.parentForm,"ngform.controls");t&&(_.get(this.parentList,"name")&&t.hasOwnProperty(this.parentList.name)&&this.parentForm.ngform.removeControl(this.parentList.name),this.formGroupName&&t.hasOwnProperty(this.formGroupName)?this.parentForm.ngform.removeControl(this.formGroupName):this.parentForm.ngform.removeControl(this.name)),e.prototype.ngOnDestroy.call(this)},t}(i.StylableComponent);x.initializeProps=P(),x.decorators=[{type:t.Component,args:[{selector:"form[wmForm]",template:'<ng-template #content><ng-content></ng-content></ng-template>\n\n<ng-container *ngIf="formlayout === \'page\'; then pageLayoutTemplate else defaultTemplate">\n</ng-container>\n\n<ng-template #defaultTemplate>\n <div class="panel-heading" *ngIf="!isLayoutDialog && (title || subheading || iconclass || showButtons(\'header\'))">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon" aria-hidden="true" [ngClass]="iconclass" *ngIf="iconclass"></i>\n </div>\n <div class="pull-left">\n <div class="heading" [innerHTML]="title"></div>\n <div class="description" [innerHTML]="subheading"></div>\n </div>\n <div class="form-action panel-actions basic-btn-grp">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'header\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n <button type="button" class="app-icon wi panel-action" *ngIf="collapsible" title="Collapse/Expand"\n [ngClass]="expanded ? \'wi-minus\': \'wi-plus\'" (click)="expandCollapsePanel();"></button>\n </div>\n </h3>\n </div>\n <div class="panel-body" [ngClass]="{\'form-elements\': isLayoutDialog, \'form-body\': !isLayoutDialog}" [class.hidden]="!expanded">\n <p wmMessage [hidden]="!statusMessage.caption.toString()" [attr.aria-hidden]="!statusMessage.caption" [attr.aria-label]="statusMessage.caption" caption.bind="statusMessage.caption" type.bind="statusMessage.type"></p>\n <div [ngClass]="{\'form-elements\': !isLayoutDialog, \'form-content\': isLayoutDialog}">\n <ng-container *ngTemplateOutlet="content"></ng-container>\n </div>\n <div class="basic-btn-grp form-action panel-footer clearfix" [ngClass]="{\'modal-footer\': isLayoutDialog}" [class.hidden]="!expanded || !showButtons(\'footer\')">\n <ng-container *ngFor="let btn of buttonArray | filter : \'position\' : \'footer\'"\n [ngTemplateOutlet]="btn.widgetType === \'button\' ? buttonRef : anchorRef" [ngTemplateOutletContext]="{btn:btn}">\n </ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #pageLayoutTemplate>\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</ng-template>\n\n<ng-template #buttonRef let-btn="btn">\n <button wmButton name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" type.bind="btn.type" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey" disabled.bind="ngform.status === \'PENDING\' || btn.disabled"\n tabindex.bind="btn.tabindex" [attr.aria-label]="btn.displayName" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></button>\n</ng-template>\n\n<ng-template #anchorRef let-btn="btn">\n <a wmAnchor name="{{btn.key}}" caption.bind="btn.displayName" class.bind="btn.class" iconclass.bind="btn.iconclass" show.bind="btn.show"\n (click)="invokeActionEvent($event, btn.action)" hint.bind="btn.title" shortcutkey.bind="btn.shortcutkey"\n hyperlink.bind="btn.hyperlink" target.bind="btn.target"\n tabindex.bind="btn.tabindex" [class.hidden]="btn.updateMode ? !isUpdateMode : isUpdateMode"></a>\n</ng-template>\n\n<ng-container #dynamicForm></ng-container>\n',providers:[i.provideAsWidgetRef(x)]}]}],x.ctorParameters=function(){return[{type:t.Injector},{type:s.FormBuilder},{type:l.App},{type:l.AbstractDialogService},{type:l.DynamicComponentRefProvider},{type:t.NgZone},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:x,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:c.PrefabDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:i.PartialDirective,decorators:[{type:t.SkipSelf},{type:t.Optional}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforesubmit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["submit.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["beforerender.event"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["formdata.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveForm"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["wmLiveFilter"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["data-role"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]}]},x.propDecorators={dynamicFormRef:[{type:t.ViewChild,args:["dynamicForm",{static:!0,read:t.ViewContainerRef}]}],messageRef:[{type:t.ViewChild,args:[i.MessageComponent]}],componentRefs:[{type:t.ContentChildren,args:[i.WidgetRef,{descendants:!0}]}],action:[{type:t.HostBinding,args:["action"]}],submit:[{type:t.HostListener,args:["submit",["$event"]]}],onReset:[{type:t.HostListener,args:["reset"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var k=function(){function e(e,t,n,i,o,r){var a=this;this.componentInstance=n,this.name=o,this.key=r,this.fb=i,this.parent=e||t,this.ngform=this.parent.ngform,this.componentInstance.registerPropertyChangeListener((function(e,t){"datavalue"===e&&a._control?a._control.setValue(t):"name"!==e||a._control||a.addControl(a.key||t)}))}return Object.defineProperty(e.prototype,"_control",{get:function(){var e=this.key||this.name;if(e)return this.ngform&&this.ngform.controls[e]},enumerable:!1,configurable:!0}),e.prototype.addControl=function(e){this.ngform.addControl(e,this.createControl())},e.prototype.createControl=function(){return this.fb.control(this.componentInstance.datavalue)},e.prototype.ngOnInit=function(){var e=this.key||this.name;e&&!this._control&&(this.addControl(e),this.parent.registerFormWidget(this.componentInstance))},e}();k.decorators=[{type:t.Directive,args:[{selector:"[wmFormWidget]"}]}],k.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[x]}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[u.TableComponent]}]},{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[i.WidgetRef]}]},{type:s.FormBuilder},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]}]};var M=function(){i.register("wm-form-action",new Map([["accessroles",i.PROP_STRING],["action",i.PROP_STRING],["class",i.PROP_STRING],["binding",i.PROP_STRING],["disabled",i.PROP_BOOLEAN],["display-name",i.PROP_STRING],["hyperlink",i.PROP_STRING],["iconclass",i.PROP_STRING],["iconname",i.PROP_STRING],["key",i.PROP_STRING],["position",Object.assign({value:"footer"},i.PROP_STRING)],["shortcutkey",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["target",i.PROP_STRING],["title",i.PROP_STRING],["type",Object.assign({value:"button"},i.PROP_STRING)],["update-mode",Object.assign({value:!0},i.PROP_BOOLEAN)],["widget-type",Object.assign({value:"button"},i.PROP_STRING)]]))},L={widgetType:"wm-form-action",hostClass:""},F=function(e){function t(t,n){var i=e.call(this,t,L)||this;return i.form=n,i}return f(t,e),t.prototype.populateAction=function(){this.buttonDef={key:this.key||this.binding,displayName:this["display-name"],show:this.show,class:this.class?this.class:"button"===this["widget-type"]?"btn-secondary":"",iconclass:this.iconclass||"",title:_.isUndefined(this.title)?this["display-name"]||"":this.title,action:this.action,accessroles:this.accessroles,shortcutkey:this.shortcutkey,disabled:this.disabled,tabindex:this.tabindex,iconname:this.iconname,type:this.type,updateMode:this["update-mode"],position:this.position,widgetType:this["widget-type"],hyperlink:this.hyperlink,target:this.target},this._propsInitialized=!0},t.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.populateAction(),this.form.registerActions(this.buttonDef)},t.prototype.onPropertyChange=function(e,t,n){if(this._propsInitialized)switch(e){case"display-name":this.buttonDef.displayName=t;default:this.buttonDef[e]=t}},t}(i.BaseComponent);F.initializeProps=M(),F.decorators=[{type:t.Directive,args:[{selector:"[wmFormAction]",providers:[i.provideAsWidgetRef(F)]}]}],F.ctorParameters=function(){return[{type:t.Injector},{type:x,decorators:[{type:t.Optional}]}]};var j=function(){var e=new Map([["dataentrymode",Object.assign({value:"default"},i.PROP_STRING)],["debouncetime",Object.assign({value:250},i.PROP_NUMBER)],["defaultvalue",i.PROP_STRING],["displayname",i.PROP_STRING],["display-name",i.PROP_STRING],["field",i.PROP_STRING],["filterexpressions",i.PROP_STRING],["filter-on",i.PROP_STRING],["generator",i.PROP_STRING],["hint",i.PROP_STRING],["inputtype",i.PROP_STRING],["is-primary-key",i.PROP_BOOLEAN],["is-range",i.PROP_BOOLEAN],["is-related",i.PROP_BOOLEAN],["isformfield",{value:!0}],["key",i.PROP_STRING],["limit",i.PROP_NUMBER],["lookup-type",i.PROP_STRING],["lookup-field",i.PROP_STRING],["name",i.PROP_STRING],["matchmode",i.PROP_STRING],["maxdefaultvalue",i.PROP_STRING],["maxplaceholder",i.PROP_STRING],["mobile-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["period",i.PROP_BOOLEAN],["pc-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["placeholder",i.PROP_STRING],["primary-key",i.PROP_BOOLEAN],["related-entity-name",i.PROP_STRING],["required",i.PROP_BOOLEAN],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tablet-display",Object.assign({value:!0},i.PROP_BOOLEAN)],["type",i.PROP_STRING],["validationmessage",i.PROP_STRING],["viewmodewidget",i.PROP_STRING],["widgettype",i.PROP_STRING]]),t=function(t){var n="wm-form-field-"+l.FormWidgetType[t],o=i.getWidgetPropsByType(n);e.forEach((function(e,t){null==o.get(t)&&o.set(t,e)}))};for(var n in l.FormWidgetType)t(n)},B=function(){return{custom:!0}},G={image:"image/*",video:"video/*",audio:"audio/*"},V=function(e){function t(t,n,i,o,r,a,s,c,p,u,d,h,m,f,g,v,y,b,w){var P=this,_={widgetType:"wm-form-field",hostClass:"",widgetSubType:"wm-form-field-"+(d||l.FormWidgetType.TEXT).trim()},O=l.noop;return(P=e.call(this,t,_,new Promise((function(e){return O=e})))||this)._initPropsRes=O,P.app=r,P.fieldDefConfig={},P.class="",P.binddataset=c,P.binddisplayimagesrc=m,P.binddisplayexpression=p,P.bindChipclass=s,P.binddisplaylabel=u,P.form=n,P.fb=i,P.viewport=o,P._fieldName=f||h,P.isRange=g,P.excludeProps=new Set(["type","name"]),P.widgettype=d,P.parentList=a,P.notifyForFields=[],(P.binddataset||P.$element.attr("dataset"))&&(P.isDataSetBound=!0),w[0]._onFocusField=P._onFocusField.bind(P),w[0]._onBlurField=P._onBlurField.bind(P),P._debounceSetUpValidators=l.debounce((function(){return P.setUpValidators()}),500),P}return f(t,e),t.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},t.prototype.handleClick=function(e){this._clicktriggeredByUser=!0},t.prototype._onFocusField=function(e){this._activeField=!0,$(e.target).closest(".live-field").addClass("active")},t.prototype._onBlurField=function(e){var t,n,i,o;$(e.target).closest(".live-field").removeClass("active");this.nativeElement.querySelector("p.text-danger");this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",""+this.ngform.controls[this._fieldName].invalid),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this._activeField=!1,this._triggeredByUser=!1,this._clicktriggeredByUser=!1},t.prototype.evaluateExpr=function(e,t,n){if(n&&t||(t=Object.keys(e)[0]))return i.getEvaluatedData(e,{field:t,expression:n},this.viewParent)},t.prototype.getDisplayExpr=function(){var e=this,t=[],n=this.value,i=this.displayfield||this.displaylabel,o=this.displayexpression;return _.isObject(n)?(_.isArray(n)?_.forEach(n,(function(n){_.isObject(n)&&t.push(e.evaluateExpr(n,i,o))})):t.push(this.evaluateExpr(n,i,o)),_.join(t,",")):null==n?"":this.value},t.prototype.getCaption=function(){return void 0===this.value||null===this.value?_.get(this.form.dataoutput,this._fieldName)||"":this.value},t.prototype.notifyChanges=function(){_.forEach(this.notifyForFields,(function(e){e.fieldValidations.validate()}))},t.prototype.observeOn=function(e){this.fieldValidations.observeOn(e,"formfields")},t.prototype.setUpValidators=function(e){this.fieldValidations.setUpValidators(e)},t.prototype.setAsyncValidators=function(e){this.fieldValidations.setAsyncValidators(e)},t.prototype.setValidators=function(e){this.fieldValidations.setValidators(e)},t.prototype.setFormWidget=function(e,t){this.formWidget&&this.formWidget.widget&&(this.formWidget.widget[e]=t)},t.prototype.boundFn=function(e){return e()},t.prototype.setMaxFormWidget=function(e,t){this.formWidgetMax&&(this.formWidgetMax.widget[e]=t)},t.prototype.onPropertyChange=function(t,n,i){var o=this.form.dirty;if("tabindex"!==t&&e.prototype.onPropertyChange.call(this,t,n,i),!this.excludeProps.has(t)){if(this.widgettype===l.FormWidgetType.UPLOAD)return"required"===t&&this._debounceSetUpValidators(),void e.prototype.onPropertyChange.call(this,t,n,i);switch(this.setFormWidget(t,n),"placeholder"!==t&&this.setMaxFormWidget(t,n),t){case"defaultvalue":this.form.onFieldDefaultValueChange(this,n);break;case"maxdefaultvalue":this.maxValue=n,this.setMaxFormWidget("datavalue",n),this.form.onMaxDefaultValueChange();break;case"maxplaceholder":this.setMaxFormWidget("placeholder",n);break;case"required":o!==this.form.dirty&&this.form.markAsPristine();case"maxchars":case"minvalue":case"maxvalue":case"regexp":case"show":this._debounceSetUpValidators();break;case"primary-key":n&&this.form.setPrimaryKey(this._fieldName);break;case"display-name":this.displayname=n;break;case"readonly":this.setReadOnlyState()}}},t.prototype.onStyleChange=function(t,n,i){this.setFormWidget(t,n),this.setMaxFormWidget(t,n),e.prototype.onStyleChange.call(this,t,n,i)},Object.defineProperty(t.prototype,"datavalue",{get:function(){return this.formWidget&&this.formWidget.datavalue},set:function(e){this._control&&this.widgettype!==l.FormWidgetType.UPLOAD&&this._control.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.datavalue},set:function(e){this.datavalue=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.formWidgetMax&&this.formWidgetMax.datavalue},set:function(e){this._maxControl&&this._maxControl.setValue(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minValue",{get:function(){return this.value},set:function(e){this.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_control",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_maxControl",{get:function(){return this.ngform&&this.ngform.controls[this._fieldName+"_max"]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){return this.formWidget&&this.formWidget.displayValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timestamp",{get:function(){return this.formWidget&&this.formWidget.timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"charlength",{get:function(){return this.formWidget&&this.formWidget.charlength},enumerable:!1,configurable:!0}),t.prototype.createControl=function(){return this.fb.control(void 0,{validators:this._validators})},t.prototype.onValueChange=function(e){var t,n,i,o;if(!this.isDestroyed){var r=$(this.nativeElement).find(".caption-floating");if(r.length>0){var a=l.isDefined(e)&&""!==e&&null!==e||r.find("input").val()||r.find("input:-webkit-autofill").length;this.app.notify("captionPositionAnimate",{displayVal:a,nativeEl:r,isSelectMultiple:this.formWidget&&this.formWidget.multiple,isFocused:this._activeField})}this.ngform.controls[this._fieldName].invalid&&this.ngform.controls[this._fieldName].touched&&this.form.isUpdateMode?(this.nativeElement.setAttribute("__errormsg",""+this.nativeElement.getAttribute("__validationId")),null===(t=this.nativeElement.querySelector("input"))||void 0===t||t.setAttribute("aria-invalid",this._triggeredByUser&&this.ngform.controls[this._fieldName].invalid?"true":"false"),null===(n=this.nativeElement.querySelector("input"))||void 0===n||n.setAttribute("aria-describedby",""+this.nativeElement.getAttribute("__validationId"))):(this.nativeElement.removeAttribute("__errormsg"),null===(i=this.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid"),null===(o=this.nativeElement.querySelector("input"))||void 0===o||o.removeAttribute("aria-describedby")),this.form.onFieldValueChange(this,e),this.notifyChanges(),(this.$element.find(".active").length>0||this.form.touched)&&((this._triggeredByUser||l.isMobile()&&this._clicktriggeredByUser&&l.isDateTimeType(this.widgettype))&&this.ngform.controls[this._fieldName].markAsTouched(),this.fieldValidations.setCustomValidationMessage())}},t.prototype.onStatusChange=function(e){this.isDestroyed||(this.showPendingSpinner="PENDING"===e,"PENDING"===e?this.formWidget.disabled=!0:this.formWidget.disabled!==this.disabled&&(this.formWidget.disabled=this.disabled))},t.prototype.setValidationMessage=function(e){var t=this;setTimeout((function(){t.validationmessage=e,t.setUpValidators(B)}))},t.prototype.setReadOnlyState=function(){var e;e=!this.form.isUpdateMode||(!this["primary-key"]||this["is-related"]||this.period?this.readonly:!("assigned"===this.generator&&"update"!==this.form.operationType)),this.setFormWidget("readonly",e)},t.prototype.resetDisplayInput=function(){l.isDefined(this.value)&&""!==this.value||this.formWidget&&this.formWidget.resetDisplayInput&&this.formWidget.resetDisplayInput()},t.prototype.triggerUploadEvent=function(e,t){var n={$event:e};"change"===t&&(n.newVal=e.target.files,n.oldVal=this._oldUploadVal,this._oldUploadVal=n.newVal),this.invokeEventCallback(t,n)},t.prototype.registerFormField=function(){var e=this._fieldName;if(this.parentList&&this.form.parentList!==this.parentList){for(var t=1,n=e;this.ngform.controls.hasOwnProperty(n);)n=e+"_"+t,t++;this.ngform.addControl(n,this.createControl()),this._fieldName=n}else this.ngform.addControl(e,this.createControl());var i=this._control.valueChanges.pipe(d.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return i.unsubscribe()}));var o=this._control.statusChanges.pipe(d.debounceTime(100)).subscribe(this.onStatusChange.bind(this));if(this.registerDestroyListener((function(){return o.unsubscribe()})),"true"===this.isRange){this.ngform.addControl(e+"_max",this.createControl());var r=this._maxControl.valueChanges.pipe(d.debounceTime(200)).subscribe(this.onValueChange.bind(this));this.registerDestroyListener((function(){return r.unsubscribe()}))}this.value=_.get(this.form.formdata,this._fieldName)},t.prototype.ngOnInit=function(){this.ngform=this.form.ngform,this.registerFormField(),this.fieldValidations=new i.BaseFieldValidations(this,this.formWidget,this.widgettype,this._control,this.form),e.prototype.ngOnInit.call(this)},t.prototype.ngAfterContentInit=function(){var t=this;e.prototype.ngAfterContentInit.call(this),this.formWidget&&(this._initPropsRes(),this.setFormWidget("binddisplaylabel",this.binddisplaylabel),this.setFormWidget("binddisplayexpression",this.binddisplayexpression),this.setFormWidget("binddisplayimagesrc",this.binddisplayimagesrc),this.setFormWidget("bindChipclass",this.bindChipclass),this.setFormWidget("binddataset",this.binddataset)),this.registerReadyStateListener((function(){if(t.key=t._fieldName||t.target||t.binding,t.viewmodewidget=t.viewmodewidget||i.getDefaultViewModeWidget(t.widgettype),t.widgettype===l.FormWidgetType.UPLOAD){var e;e=t.filetype?G[t.filetype]:"",t.permitted=e+(t.extensions?(e?",":"")+t.extensions:"")}l.isMobile()&&t.viewport.isMobileType?t["mobile-display"]||(t.widget.show=!1):t.viewport.isTabletType?t["tablet-display"]||(t.widget.show=!1):t["pc-display"]||(t.widget.show=!1),t.fieldDefConfig.displaname=t.displayname,t.fieldDefConfig.show=t.show,t.fieldDefConfig.isRelated=t["is-related"],t.fieldDefConfig.inputtype=t.inputtype,t.fieldDefConfig.generator=t.generator,t.fieldDefConfig.placeholder=t.placeholder,t.fieldDefConfig.primaryKey=t["primary-key"],t.fieldDefConfig.required=t.required,t.fieldDefConfig._readonly=t.readonly,t.fieldDefConfig.regexp=t.regexp,t.fieldDefConfig.type=t.type,t.fieldDefConfig.key=t.key,t.fieldDefConfig.mobileDisplay=t["mobile-display"],t.fieldDefConfig.name=t.name,t.fieldDefConfig.pcDisplay=t["pc-display"],t.fieldDefConfig.tabletDisplay=t["tablet-display"],t.fieldDefConfig.validationmessage=t.validationmessage,t.fieldDefConfig.viewmodewidget=t.viewmodewidget,t.fieldDefConfig.widget=t.widgettype,t.form.registerFormFields(t.widget),l.addForIdAttributes(t.nativeElement),t.setReadOnlyState()}))},t}(i.StylableComponent);V.initializeProps=j(),V.decorators=[{type:t.Directive,args:[{selector:"[wmFormField]",exportAs:"wmFormField",providers:[i.provideAsWidgetRef(V),i.provideAs(V,s.NG_VALUE_ACCESSOR,!0),{provide:i.Context,useValue:{},multi:!0}]}]}],V.ctorParameters=function(){return[{type:t.Injector},{type:x},{type:s.FormBuilder},{type:l.Viewport},{type:l.App},{type:p.ListComponent,decorators:[{type:t.Optional}]},{type:String,decorators:[{type:t.Attribute,args:["chipclass.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayexpression.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["displaylabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["widgettype"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["name"]}]},{type:String,decorators:[{type:t.Attribute,args:["displayimagesrc.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["key"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["is-range"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["pc-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["mobile-display"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["tablet-display"]}]},{type:Array,decorators:[{type:t.Self},{type:t.Inject,args:[i.Context]}]}]},V.propDecorators={formWidget:[{type:t.ContentChild,args:["formWidget",{static:!0}]}],formWidgetMax:[{type:t.ContentChild,args:["formWidgetMax"]}],onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}],handleClick:[{type:t.HostListener,args:["click",["$event"]]}]};var U=function(){function e(e,t,n){this.subscribedWidget=e,this.app=t,this.dialogService=n,e.addRow=this.addRow.bind(this),e.updateRow=this.updateRow.bind(this),e.deleteRow=this.deleteRow.bind(this),e.call=this.call.bind(this)}return e.prototype.addRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.INSERT,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.updateRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.UPDATE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.deleteRow=function(){this.app.notify("wm-event",{eventName:i.Live_Operations.DELETE,widgetName:this.subscribedWidget.name,row:this.subscribedWidget.selecteditem})},e.prototype.successHandler=function(e,t){l.triggerFn(e.success,t)},e.prototype.errorHandler=function(e,t){this.app.notifyApp(t,"error","ERROR"),l.triggerFn(e.error,t)},e.prototype.getRecords=function(e,t){var n,o,r=this;"None"!==this.subscribedWidget.navigation&&this.subscribedWidget.dataNavigator?(o=this.subscribedWidget.dataNavigator,t===i.Live_Operations.DELETE?(o.dataSize-=1,o.calculatePagingValues(),n=o.pageCount<o.dn.currentPage?"prev":void 0):("last"===(n=t===i.Live_Operations.INSERT?"last":"current")&&(o.dataSize+=1),o.calculatePagingValues()),o.navigatePage(n,null,!0,(function(t){r.successHandler(e,t)}))):this.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(t){r.successHandler(e,t)}),(function(t){r.errorHandler(e,t)}))},e.prototype.performCUDOperation=function(e,t,n){var o=this;i.performDataOperation(this.subscribedWidget.datasource,e,{operationType:t}).then((function(e){e.error?o.errorHandler(n,e.error):("wm.CrudVariable"===o.subscribedWidget.datasource.category&&"delete"===t?o.subscribedWidget.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}).then((function(e){o.successHandler(n,e)}),(function(e){o.errorHandler(n,e)})):o.getRecords(n,t),"delete"===t&&o.app.notifyApp(o.app.appLocale.MESSAGE_DELETE_RECORD_SUCCESS,"success"))}),(function(e){o.errorHandler(n,e)}))},e.prototype.insertRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.updateRecord=function(e,t,n){this.performCUDOperation(e,t,n)},e.prototype.deleteRecord=function(e,t,n){var i=this;this.dialogService.showAppConfirmDialog({title:this.app.appLocale.MESSAGE_DELETE_RECORD||"Delete Record",iconclass:"wi wi-delete fa-lg",message:this.subscribedWidget.confirmdelete||"Are you sure you want to delete this?",oktext:this.subscribedWidget.deleteoktext||"Ok",canceltext:this.subscribedWidget.deletecanceltext||"Cancel",onOk:function(){i.performCUDOperation(e,t,n),i.dialogService.closeAppConfirmDialog()},onCancel:function(){l.triggerFn(n.cancelDeleteCallback),i.dialogService.closeAppConfirmDialog()}})},e.prototype.performOperation=function(e,t){var n={row:t.row,prevData:{},rowData:{},transform:!0,skipNotification:!0};switch(e===i.Live_Operations.UPDATE&&(n.rowData=t.rowData,n.prevData=t.prevData),e){case i.Live_Operations.INSERT:this.insertRecord(n,e,t);break;case i.Live_Operations.UPDATE:this.updateRecord(n,e,t);break;case i.Live_Operations.DELETE:this.deleteRecord(n,e,t);break;case i.Live_Operations.READ:this.getRecords(t,e)}},e.prototype.call=function(e,t,n,i){t.success=n,t.error=i,this.performOperation(e,t)},e}();U.decorators=[{type:t.Directive,args:[{selector:"[wmLiveActions]"}]}],U.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[p.ListComponent]}]},{type:l.App},{type:l.AbstractDialogService}]};var W=function(){function e(e,t,n,i){this.dialogService=n,this.app=i,e&&(this.isLayoutDialog=!0,this.dialogId=e),this.dependson=t,this.eventSubscription=this.app.subscribe("wm-event",this.handleEvent.bind(this))}return e.prototype.openFormDialog=function(){this.dialogService.open(this.dialogId)},e.prototype.onUpdate=function(e,t,n){this.editMode=n||this.editMode,this.form.operationType=i.Live_Operations.UPDATE,this.form.isSelected=!0;var o=this.currentFormData;e&&t&&(o=t.multiselect?e[0]:e[e.length-1]),this.form.setFormData(o),this.form.edit(),this.editMode||(this.form.isUpdateMode=!1)},e.prototype.onInsert=function(){this.form.operationType=i.Live_Operations.INSERT,this.form.isSelected=!0,this.form.setFormData({}),this.form.new()},e.prototype.handleEvent=function(e){if(this.dependson===e.widgetName)switch(this.currentOp=e.eventName,e.eventName){case i.Live_Operations.UPDATE:this.currentFormData=e.row,this.isLayoutDialog?this.openFormDialog():this.onUpdate(void 0,void 0,!0);break;case i.Live_Operations.INSERT:this.isLayoutDialog?this.openFormDialog():this.onInsert();break;case i.Live_Operations.DELETE:this.app.Widgets[this.dependson].call("delete",{row:e.row});break;case i.Live_Operations.READ:this.isLayoutDialog||(this.form.isUpdateMode=!1);break;case"rerender":e.dataSource&&e.dataSource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0,operation:"list"});break;case"selectedItemChange":e.table&&this.onUpdate(e.row,e.table);break;case"resetEditMode":this.editMode=!1}},e.prototype.onFormRender=function(){var e=this;this.form&&this.isLayoutDialog&&(this.form.isLayoutDialog=!0,setTimeout((function(){e.currentOp===i.Live_Operations.UPDATE?e.onUpdate(void 0,void 0,!0):e.currentOp===i.Live_Operations.INSERT&&e.onInsert()}),250))},e.prototype.ngAfterContentInit=function(){var e=this;this.formChildren.first?this.form=this.formChildren.first:this.formSubscription=this.formChildren.changes.subscribe((function(t){e.form=t.first,e.onFormRender()})),this.app.notify("setup-cud-listener",this.dependson)},e.prototype.ngOnDestroy=function(){this.formSubscription&&this.formSubscription.unsubscribe(),this.eventSubscription&&this.eventSubscription()},e}();W.decorators=[{type:t.Directive,args:[{selector:"[dependson]"}]}],W.ctorParameters=function(){return[{type:String,decorators:[{type:t.Attribute,args:["dialogid"]}]},{type:String,decorators:[{type:t.Attribute,args:["dependson"]}]},{type:l.AbstractDialogService},{type:l.App}]},W.propDecorators={formChildren:[{type:t.ContentChildren,args:[x,{descendants:!0}]}]};var q="EMPTY_NULL_FILTER",z=function(){function e(e){var t=this;this.form=e,this._filter=l.debounce((function(e){t.filter(e)}),250),e.clearFilter=this.clearFilter.bind(this),e.applyFilter=this.applyFilter.bind(this),e.filter=this.filter.bind(this),e.filterOnDefault=this.filterOnDefault.bind(this),e.execute=this.execute.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onMaxDefaultValueChange=this.onMaxDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.registerFormWidget=this.registerFormWidget.bind(this)}return e.prototype.execute=function(e,t){return e===l.DataSource.Operation.LIST_RECORDS||e===l.DataSource.Operation.DOWNLOAD?this.applyFilter(t):e===l.DataSource.Operation.GET_OPTIONS?this._options||{}:e===l.DataSource.Operation.GET_PAGING_OPTIONS?this.form.pagination:this.form.datasource?e===l.DataSource.Operation.FETCH_DISTINCT_VALUES?i.fetchDistinctValues(this.form.datasource,this.form.formFields,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter,EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}):this.form.datasource.execute(e,t):{}},e.prototype.onFieldDefaultValueChange=function(e,t){e.minValue=t,e.value=t,this.filterOnDefault()},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t,{EMPTY_VALUE:this.form.appLocale.LABEL_NO_VALUE}),this.form.autoupdate&&l.isDefined(t)&&this._filter()},e.prototype.onMaxDefaultValueChange=function(){var e=this;setTimeout((function(){e.filterOnDefault()}))},e.prototype.onDataSourceChange=function(){var e=this,t=this.form.datasource;t&&(this.form.formFields.forEach((function(n){i.isDataSetWidget(n.widgettype)&&(i.getDistinctValuesForField(t,n.widget,{widget:"widgettype",enableemptyfilter:e.form.enableemptyfilter,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}),i.applyFilterOnField(t,n.widget,e.form.formFields,n.value,{isFirst:!0,EMPTY_VALUE:e.form.appLocale.LABEL_NO_VALUE}))})),this._filter(this._options))},e.prototype.clearFilter=function(){var e=this;this.form.resetFormState(),this.form.formFields.forEach((function(t){!t.readonly&&t.show&&(t.widgettype!==l.FormWidgetType.AUTOCOMPLETE&&t.widgettype!==l.FormWidgetType.TYPEAHEAD||e.form.$element.find("div[name="+t.name+"] input").val(""),t["is-range"]?(t.minValue="",t.maxValue=""):(t.value="",t.resetDisplayInput()))})),setTimeout((function(){e._filter()}))},e.prototype.submitForm=function(){this.filter()},e.prototype.applyFilter=function(e){return(e=e?e.data||e:{}).page=e.page||1,e.orderBy=l.isDefined(e.orderBy)?e.orderBy:this.orderBy,this.filter(e)},e.prototype.filter=function(e){var t=this;if(this.form.datasource){var n,o,r={},a={},s=1;s=(e=e||{}).page||s,n=l.isDefined(e.orderBy)?e.orderBy:this.orderBy||"",this.orderBy=n,this.form.formFields.forEach((function(e){var n,i="div[name="+e.name+"] input",o=t.form.$element;if((e.widgettype===l.FormWidgetType.AUTOCOMPLETE||e.widgettype===l.FormWidgetType.TYPEAHEAD)&&o)return n=o.find(i),void(e["is-range"]?a[e.field]={minValue:l.isDefined(e.minValue)?e.minValue:n.first().val(),maxValue:l.isDefined(e.maxValue)?e.maxValue:n.last().val()}:a[e.field]={value:l.isDefined(e.value)?e.value:n.val()});e["is-range"]?a[e.field]={minValue:e.minValue,maxValue:e.maxValue}:a[e.field]={value:e.value}}));try{if(!1===(o=this.form.invokeEventCallback("beforeservicecall",{$data:a})))return;if(o&&o.error)return void this.form.toggleMessage(!0,o.error,"error","ERROR");this.form.formFields.forEach((function(e){e["is-range"]?(e._minValue=a[e.field].minValue,e._maxValue=a[e.field].maxValue):e._value=a[e.field].value}))}catch(e){if("Abort"===e.message)return}return this.form.formFields.forEach((function(e){var n,o,a=e.field,s=e._minValue,c=e._maxValue;if(e["is-related"]&&(a+="."+e["lookup-field"]),e["is-range"])n=i.getRangeFieldValue(s,c),o=i.getRangeMatchMode(s,c),l.isDefined(n)&&(r[a]={value:n,matchMode:o,logicalOp:"AND"});else{switch(e.widgettype){case l.FormWidgetType.SELECT:case l.FormWidgetType.RADIOSET:i.getEnableEmptyFilter(t.form.enableemptyfilter)&&e._value===q?(o=i.getEmptyMatchMode(t.form.enableemptyfilter),n=e._value):e.type===l.DataType.BOOLEAN?l.isDefined(e._value)&&""!==e._value&&(n=JSON.parse(e._value)):n=e._value;break;case l.FormWidgetType.CHECKBOXSET:case l.FormWidgetType.CHIPS:e._value&&e._value.length&&(n=e._value);break;case l.FormWidgetType.CHECKBOX:case l.FormWidgetType.TOGGLE:l.isDefined(e._value)&&""!==e._value&&(n=e.type===l.DataType.BOOLEAN?JSON.parse(e._value):e._value);break;default:n=e._value}l.isDefined(n)&&""!==n&&null!==n&&(r[a]={},o?(r[a].matchMode=o,n=void 0):(e.type===l.DataType.STRING||e.isRelated)&&(r[a].matchMode=o||e.matchmode||t.form.datasource.execute(l.DataSource.Operation.GET_MATCH_MODE)),r[a].value=n,r[a].logicalOp="AND",r[a].type=e.type)}})),e.exportType?this.form.datasource.execute(l.DataSource.Operation.DOWNLOAD,{data:{matchMode:"anywhereignorecase",filterFields:r,orderBy:n,exportType:e.exportType,logicalOp:"AND",exportSize:e.exportSize,fields:e.fields,fileName:e.fileName}}):this.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{filterFields:r,orderBy:n,page:s,pagesize:this.form.pagesize||20,skipDataSetUpdate:!0,inFlightBehavior:"executeAll"}).then((function(e){var i=e.data;return t.form.pagination=e.pagination,i.error?(t.form.toggleMessage(!0,i.error,"error","ERROR"),t.form.onResultCb(i,!1)):(t._options={page:s,orderBy:n},t.form.result=l.getClonedObject(i),t.form.onResultCb(i,!0)),l.$appDigest(),t.form.result}),(function(e){return t.form.toggleMessage(!0,e,"error","ERROR"),t.form.onResultCb(e,!1),e}))}},e.prototype.filterOnDefault=function(){_.find(this.form.formFields,(function(e){return l.isDefined(e.value)||l.isDefined(e.minValue)||l.isDefined(e.maxValue)}))&&this._filter(this._options)},e.prototype.registerFormWidget=function(e){var t=e.key||e.name;this.form.filterWidgets[t]=e},e}();z.initializeProps=S(),z.decorators=[{type:t.Directive,args:[{selector:"[wmLiveFilter]"}]}],z.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[x]}]}]};var H=function(e){return e.widgettype===l.DataType.TIME||e.type===l.DataType.TIME&&!e.widgettype},Y=H,K=function(e){if(e){var t=(new Date).toDateString();return new Date(t+" "+e).getTime()}},Q=K,X=function(){function e(e,t,n,i,o){var r=this;this.form=e,this.datePipe=n,this.dialogService=i,this._debouncedSavePrevDataValues=l.debounce((function(){r.savePrevDataValues()}),250),t&&!this.form.parentForm?(this.form._liveTableParent=t,this.form.isLayoutDialog=t.isLayoutDialog,t.onFormReady(this.form)):this.form.isLayoutDialog="dialog"===o,e.cancel=this.cancel.bind(this),e.reset=this.reset.bind(this),e.delete=this.delete.bind(this),e.save=this.save.bind(this),e.saveAndNew=this.saveAndNew.bind(this),e.saveAndView=this.saveAndView.bind(this),e.setPrimaryKey=this.setPrimaryKey.bind(this),e.constructDataObject=this.constructDataObject.bind(this),e.changeDataObject=this.setFormData.bind(this),e.setFormData=this.setFormData.bind(this),e.findOperationType=this.findOperationType.bind(this),e.clearData=this.clearData.bind(this),e.onFieldDefaultValueChange=this.onFieldDefaultValueChange.bind(this),e.onDataSourceChange=this.onDataSourceChange.bind(this),e.onFieldValueChange=this.onFieldValueChange.bind(this),e.submitForm=this.submitForm.bind(this),e.form_registerFormFields=e.registerFormFields,e.registerFormFields=this.registerFormFields.bind(this)}return e.prototype.onKeydownHandler=function(e){this._triggeredByUser=!0},e.prototype.registerFormFields=function(e){var t=this.form.getFormFields();this.form.form_registerFormFields(e),this.form.isDataSourceUpdated&&this._updateFieldOnDataSourceChange(e,t)},e.prototype._updateFieldOnDataSourceChange=function(e,t){!e.isDataSetBound&&i.isDataSetWidget(e.widgettype)&&(e["is-related"]?(e.isDataSetBound=!0,i.fetchRelatedFieldData(this.form.datasource,e.widget,{relatedField:e.key,datafield:i.ALLFIELDS,widget:"widgettype"})):(i.getDistinctValuesForField(this.form.datasource,e.widget,{widget:"widgettype",enableemptyfilter:this.form.enableemptyfilter}),i.applyFilterOnField(this.form.datasource,e.widget,t,e.value,{isFirst:!0})))},e.prototype.onDataSourceChange=function(){var e=this;_.get(this.form.formFields,"length")&&(this.form.isDataSourceUpdated=!0);var t=this.form.getFormFields();t.forEach((function(n){e._updateFieldOnDataSourceChange(n,t)}))},e.prototype.onFieldDefaultValueChange=function(e,t){"update"!==this.form.operationType&&(l.isDefined(t)&&null!==t&&""!==t&&"null"!==t?e.value=i.parseValueByType(t,e.type,e.widgettype,e.trailingzero):e.value=void 0,this.form.dirty&&!this._triggeredByUser&&this.form.markAsPristine(),this._debouncedSavePrevDataValues())},e.prototype.onFieldValueChange=function(e,t){i.applyFilterOnField(this.form.datasource,e.widget,this.form.formFields,t)},e.prototype.getBlobURL=function(e,t,n){var i,o="";return null!=n&&this.form.datasource?(i=e[(this.form.datasource.execute(l.DataSource.Operation.GET_PRIMARY_KEY)||[])[0]],o+=this.form.datasource.execute(l.DataSource.Operation.GET_BLOB_URL,{primaryValue:i,columnName:t}),o+="?"+Math.random()):o},e.prototype.setFormData=function(e,t){var n=this;e&&((t=t||this.form.formFields).forEach((function(t){var i=_.get(e,t.key||t.name);H(t)?t.value=K(i):t.type===l.DataType.BLOB?(n.form.resetFileUploadWidget(t,!0),t.href=n.getBlobURL(e,t.key,i),t.value=_.isString(i)?"":i):n.form.setFieldValue(t,e)})),this.savePrevDataValues(),this.form.constructDataObject())},e.prototype.onDataSourceUpdate=function(e,t,n){t?this.form.new():(this.form.setFormData(e),this.closeDialog()),this.form.isUpdateMode=!l.isDefined(n)||n},e.prototype.savePrevformFields=function(){this.form.prevformFields=l.getClonedObject(this.form.formFields.map((function(e){return{key:e.key,type:e.type,widgettype:e.widgettype,outputformat:e.outputformat,value:e.value}})))},e.prototype.getPrevformFields=function(){var e=this;this.form.formFields.map((function(t){var n=e.form.prevformFields.find((function(e){return e.key===t.key}));t.value=n.value}))},e.prototype.getDataObject=function(){return this.form.operationType===i.Live_Operations.INSERT?{}:l.isDefined(this.form.prevDataObject)&&!l.isEmptyObject(this.form.prevDataObject)?l.getClonedObject(this.form.prevDataObject):l.getClonedObject(this.form.formdata||{})},e.prototype.constructDataObject=function(e){var t=this,n=this.getDataObject(),i=this.form.name;return(e?this.form.prevformFields:this.form.getFormFields()).forEach((function(e){var o,r,a=_.split(e.key,"."),s=a[0]||e.key;e.widgettype&&l.isDateTimeType(e.widgettype)||l.isDateTimeType(e.type)?e.value?(o=l.getValidDateObject(e.value),r=e.outputformat===l.DataType.TIMESTAMP||e.type===l.DataType.TIMESTAMP?e.value?o:null:e.outputformat?t.datePipe.transform(o,e.outputformat):e.value):r=void 0:r=e.type===l.DataType.BLOB?l.getFiles(i,s+"_formWidget",e.multiple):e.type===l.DataType.LIST?e.value||void 0:null===e.value||""===e.value?void 0:e.value,1===a.length?n[s]=r:(n[s]=n[s]||{},n[s][a[1]]=r)})),e?n:(this.form.updateFormDataOutput(n),this.form.dataoutput)},e.prototype.setPrimaryKey=function(e){this.form.primaryKey=this.form.primaryKey||[],-1===this.form.primaryKey.indexOf(e)&&this.form.primaryKey.push(e)},e.prototype.findOperationType=function(){var e,t=this,n=!1,o=this.form.datasource&&this.form.datasource.execute(l.DataSource.Operation.GET_OPERATION_TYPE);return o&&"read"!==o?o:(this.form.primaryKey&&!_.isEmpty(this.form.formdata)&&(1===this.form.primaryKey.length?this.form.formdata[this.form.primaryKey[0]]&&(e=i.Live_Operations.UPDATE):0===this.form.primaryKey.length?(_.forEach(this.form.formdata,(function(e){e&&(n=!0)})),n&&(e=i.Live_Operations.UPDATE)):(n=_.some(this.form.primaryKey,(function(e){if(t.form.formdata[e])return!0})))&&(e=i.Live_Operations.UPDATE)),e||i.Live_Operations.INSERT)},e.prototype.getPrevDataValues=function(){var e=_.fromPairs(_.map(this.form.prevDataValues,(function(e){return[e.key,e.value]})));return this.form.formFields.forEach((function(t){t.value=e[t.key]||"",t.resetDisplayInput()})),e},e.prototype.savePrevDataValues=function(){this.form.prevDataValues=this.form.formFields.map((function(e){return{key:e.key,value:e.value}}))},e.prototype.clearData=function(){this.form.toggleMessage(!1),this.form.emptyDataModel()},e.prototype.setReadonlyFields=function(){this.form.formFields.forEach((function(e){e.setReadOnlyState()}))},e.prototype.reset=function(){var e,t=this;this.form.resetFormState(),e=this.getPrevDataValues(),this.form.formFields.forEach((function(n){var i;n.type!==l.DataType.BLOB&&"upload"!==n.widgettype||(t.form.resetFileUploadWidget(n,!0),n.href=t.getBlobURL(e,n.key,n.value)),null===(i=n.nativeElement.querySelector("input"))||void 0===i||i.removeAttribute("aria-invalid")})),this.form.constructDataObject()},e.prototype.closeDialog=function(){this.form.isLayoutDialog&&this.dialogService.close(this.form.dialogId)},e.prototype.cancel=function(){this.form.clearMessage(),this.form.isUpdateMode=!1,this.form.reset(),this.form.isSelected&&this.getPrevformFields(),this.form.isUpdateMode=!1,this.form._liveTableParent?this.form._liveTableParent.onCancel():this.closeDialog(),l.$appDigest()},e.prototype.delete=function(e){this.form.resetFormState(),this.form.operationType=i.Live_Operations.DELETE,this.form.prevDataObject=l.getClonedObject(this.form.formdata||{}),this.form.save(void 0,void 0,void 0,e)},e.prototype.saveAndNew=function(){this.save(void 0,!0,!0)},e.prototype.saveAndView=function(){this.save(void 0,!1)},e.prototype.submitForm=function(e){this.save(e)},e.prototype.save=function(e,t,n){var o=this;if(this.form.datasource){var r,a,s,c,p={};if(s=this.form.operationType=this.form.operationType||this.findOperationType(),!this.form.validateFieldsOnSubmit()){r=l.getClonedObject(this.form.constructDataObject()),a=this.form.prevformFields?this.form.constructDataObject(!0):r;try{if(!1===(c=this.form.invokeEventCallback("beforeservicecall",{$event:e,$operation:this.form.operationType,$data:r,options:p})))return;if(c&&c.error)return void this.form.toggleMessage(!0,c.error,"error")}catch(e){if("Abort"===e.message)return}if(this.form.operationType===i.Live_Operations.UPDATE&&this.form.ngform&&this.form.ngform.pristine&&this.form.isSelected&&_.isEqual(r,a))return this.form.toggleMessage(!0,this.form.appLocale.MESSAGE_NO_CHANGES,"info",""),void l.$appDigest();p.row=r,p.transform=!0,p.skipNotification=!0,s===i.Live_Operations.UPDATE&&(p.rowData=this.form.formdata,p.prevData=a),i.performDataOperation(this.form.datasource,p,{operationType:s}).then((function(e){var r,a=s===i.Live_Operations.INSERT?o.form.insertmessage:s===i.Live_Operations.UPDATE?o.form.updatemessage:o.form.deletemessage;return s===i.Live_Operations.DELETE?(r=p.row,o.form.emptyDataModel(),o.form.prevDataValues=[],o.form.isSelected=!1):r=e,o.form.onSuccess||o.form.toggleMessage(!0,a,"success"),o.form._liveTableParent?o.form._liveTableParent.onResult(s,e,n,t):(o.form.datasource.execute(l.DataSource.Operation.LIST_RECORDS,{skipToggleState:!0}),o.onDataSourceUpdate(e,n,t)),{result:r,status:!0}}),(function(e){return o.form.onError||o.form.toggleMessage(!0,e,"error"),l.$appDigest(),{result:e,status:!1}})).then((function(t){o.form.resetFormState(),o.form.onResultCb(t.result,t.status,e)}))}}},e}();X.initializeProps=O(),X.decorators=[{type:t.Directive,args:[{selector:"[wmLiveForm]"}]}],X.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[x]}]},{type:h.LiveTableComponent,decorators:[{type:t.Optional}]},{type:i.ToDatePipe},{type:l.AbstractDialogService},{type:String,decorators:[{type:t.Attribute,args:["formlayout"]}]}]},X.propDecorators={onKeydownHandler:[{type:t.HostListener,args:["keydown",["$event"]]}]};var J=[x,k,F,V,U,W,z,X],Z=function(){};Z.decorators=[{type:t.NgModule,args:[{imports:[o.BasicModule,n.CommonModule,a.DesignDialogModule,r.InputModule,i.WmComponentsModule],declarations:b([],y(J)),exports:b([],y(J)),entryComponents:[]}]}],e.DependsonDirective=W,e.FormActionDirective=F,e.FormComponent=x,e.FormFieldDirective=V,e.FormModule=Z,e.FormWidgetDirective=k,e.LiveActionsDirective=U,e.LiveFilterDirective=z,e.LiveFormDirective=X,e["\u02750"]=Y,e["\u02751"]=Q,e["\u0275a"]=P,e["\u0275b"]=O,e["\u0275c"]=S,e["\u0275d"]=M,e["\u0275e"]=j,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/dialogs"),require("@wm/components/input"),require("@wm/core")):"function"==typeof define&&define.amd?define("@wm/components/dialogs/iframe-dialog",["exports","@angular/core","@angular/common","@wm/components/base","@wm/components/basic","@wm/components/dialogs","@wm/components/input","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.dialogs=e.wm.components.dialogs||{},e.wm.components.dialogs.iframedialog={}),e.ng.core,e.ng.common,e.wm.components.base,e.wm.components.basic,e.wm.components.dialogs,e.wm.components.input,e.wm.core)}(this,(function(e,t,n,i,o,r,a,s){"use strict";
|
|
549
549
|
/*! *****************************************************************************
|
|
550
550
|
Copyright (c) Microsoft Corporation.
|
|
551
551
|
|