@wavemaker/app-runtime-wm-build 11.4.1-next.25742 → 11.4.1-next.29753

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.
@@ -124,7 +124,7 @@
124
124
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
125
125
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
126
126
  PERFORMANCE OF THIS SOFTWARE.
127
- ***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(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 l(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 c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},d="plus-minus",u=function(e){function t(t,n){var o=e.call(this,t,p)||this;return o.bindnodeid=n,o.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var a=this;0===t?e.map((function(e){var r=a.getChildren(e);if(r&&a.setNodeData(r,t,n,i,o),e.icon&&"icon"==a.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=a.nodelabel)return;e[o]=e.name}})):e.map((function(e){var r=a.getChildren(e);return r&&n>1&&(t===n&&(i=e),a.setNodeData(r,t,n-1,i,o)),1===n&&("name"===o?a.nodelabel.includes("label")||a.nodelabel.includes("name"):a.nodeicon.includes("label")||a.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?a.nodelabel.includes("icon"):a.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var a=this.getChildren(n);null==a||a.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||d),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||d)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var a=0;a<e.length;a++){var r=e[a];t===n&&(i=e[a]);var s=this.getChildren(r);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var a=r(i),s=a.next();!s.done;s=a.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||d),this.postRenderTree()},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=this.getPath(t,"");this.selecteditem=o.getClonedObject(t)||{},this.selecteditem.path=n;var i={$event:e,$item:t,$path:n};this.invokeEventCallback("select",i)}},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||d)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||d),e.datavalue&&!e.selecteditem){var t=e.treeObj.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.treeObj.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t=this,n=this.treeObj.transformToArray(this.treeObj.getNodes()).find((function(n){return e===i.getEvaluatedData(n,{field:t.nodeid,bindExpression:t.bindnodeid},t.viewParent)}));n&&(this.treeObj.selectNode(n,!1),this.selectNode(void 0,n))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);u.initializeProps=c(),u.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(u)],encapsulation:t.ViewEncapsulation.None}]}],u.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var h=[u],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=u,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,a,r){"use strict";
127
+ ***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function r(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 s(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 l=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},c={widgetType:"wm-tree",hostClass:"app-tree"},p="plus-minus",d=function(e){function t(t,n,o,a,r,s){var l=e.call(this,t,c)||this;return l.binddatavalue=n,l.bindnodelabel=o,l.bindnodeicon=a,l.bindnodechildren=r,l.bindnodeid=s,l.setting={data:{simpleData:{enable:!1}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(l.nativeElement,l,i.APPLY_STYLES_TYPE.CONTAINER),l.setting.view.nodeClasses=l.setNodeClasses,l.setting.callback.onClick=l.onClick.bind(l),l.setting.callback.onExpand=l.onExpand.bind(l),l.setting.callback.onCollapse=l.onCollapse.bind(l),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.renderTree();break;case"levels":this.level=n,this.renderTree();break;case"nodeicon":this.nodeicon=n,this.renderTree();break;case"nodelabel":this.nodelabel=n,this.renderTree();break;case"nodechildren":this.nodechildren=n,this.renderTree();break;case"orderby":this.orderby=n,this.renderTree();break;case"treeicons":this.treeicons=n,this.renderTree();break;case"class":this.treeClass=n,this.setTreeTemplate(this.treeClass),this.renderTree();default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=t.children;o&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){var t=e.split(" ");t.includes("Classic")?this.setting.check.enable=!1:t.includes("Checkbox")?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):t.includes("Radio")&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeClasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e.name+t:this.getPath(e.getParentNode(),t)+"/"+e.name},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.zTree.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,a=this.getPath(n,""),r={$event:e,$item:o.getClonedObject(n.data),$path:a};this.invokeEventCallback("expand",r);var s=n.children;null==s||s.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicons||p),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicons||p)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i=this.getPath(n,""),a={$event:e,$item:o.getClonedObject(n.data),$path:i};this.invokeEventCallback("collapse",a)},t.prototype.constructZTreeData=function(e,t){var n=this;e.forEach((function(e){var a={},r=i.getEvaluatedData(e,{field:n.nodelabel,bindExpression:n.bindnodelabel},n.viewParent)||e.label,s=i.getEvaluatedData(e,{field:n.nodeicon,bindExpression:n.bindnodeicon},n.viewParent)||e.icon,l=i.getEvaluatedData(e,{field:n.nodeid,bindExpression:n.bindnodeid},n.viewParent),c=i.getEvaluatedData(e,{field:n.nodechildren,bindExpression:n.bindnodechildren},n.viewParent)||e.children;a.name=r,a.icon=s,a.nodeId=l,a.data=o.getClonedObject(e),_.isArray(c)&&c.length&&(a.children=[],n.constructZTreeData(c,a.children)),t.push(a)}))},t.prototype.renderTree=function(){var e;this.zTreeNodes=[],(null===(e=this.nodes)||void 0===e?void 0:e.length)&&(this.nativeElement.setAttribute("id",this.name),this.constructZTreeData(this.nodes,this.zTreeNodes),this.level>0&&this.expandTree(this.level,this.zTreeNodes,0)),this.zTree=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.zTreeNodes),$.fn.zTreeKeyboardNavigation(this.zTree,$('ul[name="'+this.name+'"]'),null,this.treeicons||p),this.postRenderTree()},t.prototype.setChecked=function(e,t){var n=this;t.checked=e.checked;var o=i.getEvaluatedData(t,{field:this.nodechildren,bindExpression:this.bindnodechildren},this.viewParent)||t.children;(null==o?void 0:o.length)&&o.forEach((function(t,i){n.setChecked(e.children[i],t)}))},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=(this.treeClass||"").split(" ");(n.includes("Checkbox")||n.includes("Radio"))&&this.setChecked(t,t.data);var i=this.getPath(t,"");this.selecteditem=o.getClonedObject(t.data)||{},this.selecteditem.path=i;var a={$event:e,$item:o.getClonedObject(t.data),$path:i},r=t.data[this.nodeaction||"action"];r&&o.$parseEvent(r)(this),this.invokeEventCallback("select",a)}},t.prototype.expandNode=function(e,t,n){this.zTree.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicons||p)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicons||p),e.datavalue&&!e.selecteditem){var t=e.zTree.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.zTree.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t,n=null===(t=this.zTree)||void 0===t?void 0:t.transformToArray(this.zTree.getNodes()),i=null==n?void 0:n.find((function(t){return e===t.nodeId}));i&&(this.zTree.selectNode(i,!1),this.selectNode(void 0,i))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);d.initializeProps=l(),d.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(d)],encapsulation:t.ViewEncapsulation.None}]}],d.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["datavalue.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodelabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodeicon.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodechildren.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var u=[d],h=function(){};h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:s([],r(u)),exports:s([],r(u)),entryComponents:[]}]}],e.TreeComponent=d,e.TreeModule=h,e["\u0275a"]=l,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,a,r){"use strict";
128
128
  /*! *****************************************************************************
129
129
  Copyright (c) Microsoft Corporation.
130
130
 
@@ -250,7 +250,7 @@
250
250
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
251
251
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
252
252
  PERFORMANCE OF THIS SOFTWARE.
253
- ***************************************************************************** */var r=function(e,t){return(r=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)};Object.create;function s(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 l(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 c=function(){i.register("wm-chart",new Map([["aggregation",Object.assign({value:"none"},i.PROP_STRING)],["aggregationcolumn",i.PROP_STRING],["areaviewtype",Object.assign({value:"stack"},i.PROP_STRING)],["barspacing",Object.assign({value:"medium"},i.PROP_STRING)],["bubblesize",i.PROP_STRING],["centerlabel",i.PROP_STRING],["class",i.PROP_STRING],["customcolors",i.PROP_ANY],["dataset",i.PROP_ANY],["datasource",i.PROP_STRING],["donutratio",Object.assign({value:"medium"},i.PROP_STRING)],["formattype",{value:"",PROP_STRING:i.PROP_STRING}],["groupby",i.PROP_STRING],["height",{value:"210px",PROP_STRING:i.PROP_STRING}],["highlightpoints",i.PROP_BOOLEAN],["iconclass",i.PROP_STRING],["interpolation",Object.assign({value:"linear"},i.PROP_STRING)],["labelthreshold",Object.assign({value:.01},i.PROP_NUMBER)],["labeltype",Object.assign({value:"percent"},i.PROP_STRING)],["legendtype",Object.assign({value:"furious"},i.PROP_STRING)],["linethickness",i.PROP_STRING],["loadingdatamsg",Object.assign({value:"Loading..."},i.PROP_STRING)],["name",i.PROP_STRING],["nodatamessage",Object.assign({value:"No Data Available."},i.PROP_STRING)],["offset",i.PROP_STRING],["offsetbottom",Object.assign({value:55},i.PROP_NUMBER)],["offsetleft",Object.assign({value:75},i.PROP_NUMBER)],["offsetright",Object.assign({value:25},i.PROP_NUMBER)],["offsettop",Object.assign({value:25},i.PROP_NUMBER)],["orderby",i.PROP_STRING],["reducexticks",Object.assign({value:!0},i.PROP_BOOLEAN)],["shape",Object.assign({value:"circle"},i.PROP_STRING)],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showlabels",Object.assign({value:"outside"},i.PROP_STRING)],["showlabelsoutside",Object.assign({value:!0},i.PROP_BOOLEAN)],["showlegend",Object.assign({value:"top"},i.PROP_STRING)],["showvalues",Object.assign({value:!1},i.PROP_BOOLEAN)],["showxaxis",Object.assign({value:!0},i.PROP_BOOLEAN)],["showxdistance",Object.assign({value:!1},i.PROP_BOOLEAN)],["showyaxis",Object.assign({value:!0},i.PROP_BOOLEAN)],["showydistance",Object.assign({value:!1},i.PROP_BOOLEAN)],["staggerlabels",Object.assign({value:!1},i.PROP_BOOLEAN)],["subheading",i.PROP_STRING],["theme",i.PROP_STRING],["title",i.PROP_STRING],["tooltips",Object.assign({value:!0},i.PROP_BOOLEAN)],["type",i.PROP_STRING],["viewtype",Object.assign({value:"Grouped"},i.PROP_STRING)],["xaxisdatakey",i.PROP_STRING],["xaxislabel",i.PROP_STRING],["xaxislabeldistance",Object.assign({value:12},i.PROP_NUMBER)],["xdateformat",i.PROP_STRING],["xdomain",Object.assign({value:"Default"},i.PROP_STRING)],["xnumberformat",i.PROP_STRING],["xunits",i.PROP_STRING],["yaxisdatakey",i.PROP_STRING],["yaxislabel",i.PROP_STRING],["yaxislabeldistance",Object.assign({value:12},i.PROP_NUMBER)],["ydomain",Object.assign({value:"Default"},i.PROP_STRING)],["ynumberformat",i.PROP_STRING],["yunits",i.PROP_STRING]]))},p=["Column","Line","Area","Cumulative Line","Bar","Pie","Donut","Bubble"],d=["circle","square","diamond","cross","triangle-up","triangle-down"],u=["01/01/2001","01/01/2002","01/01/2003"],h={Terrestrial:{colors:["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],tooltip:{backgroundColor:"#de7d28",textColor:"#FFFFFF"}},Annabelle:{colors:["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],tooltip:{backgroundColor:"#2e306f",textColor:"#FFFFFF"}},Azure:{colors:["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"],tooltip:{backgroundColor:"#3182bd",textColor:"#FFFFFF"}},Retro:{colors:["#0ca7a1","#ffa615","#334957","#acc5c2","#988f90","#8accc9","#515151","#f27861","#36c9fd","#794668","#0f709d","#0d2738","#44be78","#4a1839","#6a393f","#557d8b","#6c331c","#1c1c1c","#861500","#09562a"],tooltip:{backgroundColor:"#80513a",textColor:"#FFFFFF"}},Mellow:{colors:["#f0dcbf","#88c877","#aeb918","#2e2c23","#ddddd2","#dfe956","#4c963b","#5d3801","#e1eec3","#cd8472","#fcfab3","#9a4635","#9295ad","#2e3f12","#565677","#557d8b","#4f4d02","#0c0c1b","#833324","#24120e"],tooltip:{backgroundColor:"#7c9e73",textColor:"#FFFFFF"}},Orient:{colors:["#a80000","#cc6c3c","#f0e400","#000084","#fccc6c","#009c6c","#cc309c","#78cc00","#fc84e4","#48e4fc","#4878d8","#186c0c","#606060","#a8a8a8","#000000","#d7d7d7","#75a06e","#190d0b","#888888","#694b84"],tooltip:{backgroundColor:"#c14242",textColor:"#FFFFFF"}},GrayScale:{colors:["#141414","#353535","#5b5b5b","#848484","#a8a8a8","#c3c3c3","#e0e0e0","#c8c8c8","#a5a5a5","#878787","#656565","#4e4e4e","#303030","#1c1c1c","#4f4f4f","#3b3b3b","#757575","#606060","#868686","#c1c1c1"],tooltip:{backgroundColor:"#575757",textColor:"#FFFFFF"}},Flyer:{colors:["#3f454c","#5a646e","#848778","#cededf","#74c4dd","#0946ed","#380bb1","#000ff0","#f54a23","#1db262","#bca3aa","#ffa500","#a86b32","#63a18c","#56795e","#934343","#b75f5f","#752d2d","#4e1111","#920606"],tooltip:{backgroundColor:"#47637c",textColor:"#FFFFFF"}},Luminosity:{colors:["#FFFFFF","#e4e4e4","#00bcd4","#f0dd2f","#00aabf","#018376","#e91e63","#39e5d4","#ff6d6d","#00ff76","#ff9800","#969696","#ff4200","#e00000","#95cbe5","#5331ff","#fff4a7","#e7a800","#0061e4","#d5e7ff"],tooltip:{backgroundColor:"#47637c",textColor:"#FFFFFF"}}},m=["xaxislabel","yaxislabel","xunits","yunits","xnumberformat","xdateformat","ynumberformat","showvalues","showlabels","viewtype","areaviewtype","staggerlabels","reducexticks","offsettop","offsetbottom","offsetright","offsetleft","barspacing","xaxislabeldistance","yaxislabeldistance","theme","labeltype","donutratio","showlabelsoutside","showxdistance","showydistance","shape","nodatamessage","captions","showxaxis","showyaxis","centerlabel","customcolors","showlegend","legendtype","xdomain","ydomain","tooltips","linethickness","highlightpoints","interpolation","labelthreshold"],f={small:.3,medium:.5,large:.8},g={small:.3,medium:.6,large:.7},v=_.invert(f),y=_.invert(g),b={Thousand:{prefix:"K",divider:1e3},Million:{prefix:"M",divider:1e6},Billion:{prefix:"B",divider:1e9}},w="#preview-chart",P=["Column","Line","Pie","Bar","Donut","Bubble"],O=["Line","Area","Cumulative Line"],E=["Cumulative Line","Area"],R="Europe",A="Asia",T="America",S="Australia",C=function(e){return"Bar"===e},I=function(e){return"Donut"===e},D=function(e){return"Bubble"===e},x=function(e){return"Area"===e},N=function(e){return function(e){return"Pie"===e}(e)||I(e)},k=function(e){return _.includes(P,e)||!_.includes(p,e)},M=function(e){return _.includes(O,e)},L=function(e,t){return"value"===t?f[e]:"key"===t?v[e]:void 0},F=function(e,t){return"value"===t?g[e]:"key"===t?y[e]:void 0},j=function(e){return function(e,t,n){var i=[],o=[],a=[],r=[],s=[],l=[],c=[],p=[],u=[],h=[];switch(e){case"jsonFormat":i=[{x:"01/01/2001",y:4e6},{x:"01/01/2002",y:1e6},{x:"01/01/2003",y:5e6}],o=[{x:"01/01/2001",y:3e6},{x:"01/01/2002",y:4e6},{x:"01/01/2003",y:7e6}],a=[{x:"01/01/2001",y:2e6},{x:"01/01/2002",y:8e6},{x:"01/01/2003",y:6e6}],h[0]={values:i,key:R},t>=2&&(h[1]={values:o,key:A}),t>=3&&(h[2]={values:a,key:T});break;case"lineChartFormat":i=[{x:1,y:4e6},{x:2,y:1e6},{x:3,y:5e6}],o=[{x:1,y:3e6},{x:2,y:4e6},{x:3,y:7e6}],a=[{x:1,y:2e6},{x:2,y:8e6},{x:3,y:6e6}],h[0]={values:i,key:R},t>=2&&(h[1]={values:o,key:A}),t>=3&&(h[2]={values:a,key:T});break;case"arrayFormat":r=[[1,4e6],[2,1e6],[3,5e6]],s=[[1,3e6],[2,4e6],[3,7e6]],l=[[1,2e6],[2,8e6],[3,6e6]],h[0]={values:r,key:R},t>=2&&(h[1]={values:s,key:A}),t>=3&&(h[2]={values:l,key:T});break;case"bubbleFormat":c=[{x:80.66,y:33739900,size:78,shape:n="random"===n?d[Math.floor(Math.random()*d.length)]:n},{x:79.84,y:81902300,size:90,shape:n},{x:78.6,y:5523100,size:45,shape:n}],p=[{x:72.73,y:79716200,size:98,shape:n},{x:80.05,y:61801600,size:20,shape:n},{x:72.49,y:73137200,size:34,shape:n}],u=[{x:68.09,y:33739900,size:45,shape:n},{x:81.55,y:7485600,size:78,shape:n},{x:68.6,y:14185e4,size:56,shape:n}],h[0]={values:c,key:R},t>=2&&(h[1]={values:p,key:A}),t>=3&&(h[2]={values:u,key:T});break;case"pieChartFormat":h=[{x:R,y:1e6},{x:A,y:2e6},{x:T,y:3e6},{x:S,y:4e6}]}return h}(function(e){var t=e.type;return function(e){return"Line"===e}(t)?"lineChartFormat":N(t)?"pieChartFormat":D(t)?"bubbleFormat":k(t)?"jsonFormat":"arrayFormat"}(e),_.split(e.yaxisdatakey,",").length,e.shape)},B=function(e,t){return!("Min"!==e[t+"domain"]||(n=e.type,!function(e){return"Column"===e}(n)&&!x(n)));var n},G=function(e){return!(!_.isFinite(e.min)||!_.isFinite(e.max))},V=function(e){var t=Math.floor(e);return Math.abs(e)-t>0?e-.1:t-1},W=function(e,t){return isNaN(parseInt(e,10))?t(e,"value"):e},U=function(e,t){return e=e||"%x",d3.time.format(e)(new Date(moment(moment(t).format()).valueOf()))},q=function(e,t){var n,i,o;return n=d3.format(e)(t),e?(i=b[e]&&b[e].divider||0,(o=b[e]&&b[e].prefix)&&0!==i&&(n=d3.format(".2f")(t/i)+o)):n=t>=1e3?d3.format(".1s")(t):t,n},z=function(e){return"false"!==e&&!1!==e&&("true"===e||!0===e||"hide"!==e)},H=function(e,t,n,i){e.tooltip.contentGenerator((function(e){var o,a=e.data.x;return o=q(t.ynumberformat,e.data.y),N(n.type)&&(i=e.data.x,a=""),'<table><tbody><tr class="value"><b>'+a+'</b></tr><tr><td class="legend-color-guide"><div style="background-color:'+e.color+';"></div></td><td class="key">'+i+'</td><td class="value">'+o+"</td></tr></tbody></table>"}))},Y=function(e,t,n,i,o){i=function(e,t){return t&&!a.isEmptyObject(t)||(t={}),_.forEach(m,(function(n){_.isUndefined(t[n])&&(t[n]=e[n])})),t}(e,i);var r,s,l,c,d,v,y,b,w,P=[],O={},E={};switch(e.type){case"Column":v=W(i.barspacing,L)||f.medium,r=nv.models.multiBarChart().x((function(e){return e.x})).y((function(e){return e.y})).reduceXTicks(i.reducexticks).rotateLabels(0).showControls(!1).stacked("Stacked"===i.viewtype).groupSpacing(v);break;case"Cumulative Line":r=nv.models.cumulativeLineChart().x((function(e){return e[0]})).y((function(e){return e[1]})).showControls(!1).useInteractiveGuideline(i.tooltips).interpolate(i.interpolation);break;case"Line":r=nv.models.lineChart().useInteractiveGuideline(i.tooltips).interpolate(i.interpolation);break;case"Area":r=nv.models.stackedAreaChart().x((function(e){return e[0]})).y((function(e){return e[1]})).clipEdge(!0).showControls(!1).style(i.areaviewtype).useInteractiveGuideline(i.tooltips).interpolate(i.interpolation);break;case"Bar":v=W(i.barspacing,L)||f.medium,r=nv.models.multiBarHorizontalChart().x((function(e){return e.x})).y((function(e){return e.y})).showControls(!1).stacked("Stacked"===i.viewtype).showValues(i.showvalues).groupSpacing(v);break;case"Pie":case"Donut":c=function(e,t,n){var i={};switch(e){case"hide":i.showlabels=!1;break;case"inside":i.showlabels=!0,i.showlabelsoutside=!1;break;case"outside":i.showlabels=!0,i.showlabelsoutside=!0}return i}(i.showlabels,i.showlabelsoutside),d=W(i.donutratio,F)||g.medium,r=nv.models.pieChart().x((function(e){return e.x})).y((function(e){return e.y})).showLabels(c.showlabels).labelType(i.labeltype).valueFormat(d3.format("%")).title(i.centerlabel).labelThreshold(i.labelthreshold||.01).labelsOutside(c.showlabelsoutside),I(e.type)&&r.donut(!0).donutRatio(d),"key-value"===i.labeltype&&r.labelType((function(e){return e.data.x+" "+e.data.y}));break;case"Bubble":r=nv.models.scatterChart().x((function(e){return e.x})).y((function(e){return e.y})).showDistX(i.showxdistance).showDistY(i.showydistance)}return t&&(O.min=t.min.x||t.min[0],O.max=t.max.x||t.max[0],G(O)&&(O.min=V(O.min),r.xDomain([O.min,O.max]))),n&&(E.min=n.min.y||n.min[1],E.max=n.max.y||n.max[1],G(E)&&(E.min=V(E.min),r.yDomain([E.min,E.max]))),r.legend.vers(i.legendtype&&i.legendtype.toLowerCase()||"furious"),_.includes(p,e.type)||(r=nv.models.multiBarChart().x((function(e){return e.x})).y((function(e){return e.y}))),N(e.type)?("percent"===i.labeltype?r.valueFormat(d3.format("%")):r.valueFormat((function(e){return q(i.ynumberformat,e)})),H(r,i,e)):(r.showXAxis(i.showxaxis).showYAxis(i.showyaxis),s=i.xaxislabel||a.prettifyLabels(e.xaxisdatakey)||"x caption",l=i.yaxislabel||a.prettifyLabels(e.yaxisdatakey)||"y caption",e.yaxisdatakey&&e.yaxisdatakey.split(",").length>1&&(w=!0),w||D(e.type)||H(r,i,e,l),s+=i.xunits?"("+i.xunits+")":"",l+=i.yunits?"("+i.yunits+")":"",r.xAxis.axisLabel(s).axisLabelDistance(i.xaxislabeldistance).staggerLabels(i.staggerlabels),i.xdateformat||o&&!D(e.type)?M(e.type)?r.xAxis.tickFormat((function(t){return b=o?u[t-1]:e.xDataKeyArr[t],U(i.xdateformat,b)})):r.xAxis.tickFormat((function(e){return U(i.xdateformat,e)})):i.xnumberformat?r.xAxis.tickFormat((function(e){return q(i.xnumberformat,e)})):M(e.type)&&r.xAxis.tickFormat((function(t){return e.xDataKeyArr[t]})),r.yAxis.axisLabel(l).axisLabelDistance(i.yaxislabeldistance).staggerLabels(i.staggerlabels).tickFormat((function(e){return q(i.ynumberformat,e)})),C(e.type)&&r.valueFormat((function(e){return q(i.ynumberformat,e)}))),_.isString(i.customcolors)&&i.customcolors&&(P=_.split(i.customcolors,",")),_.isArray(i.customcolors)&&(P=i.customcolors),y=z(i.showlegend),r.showLegend(y).margin({top:i.offsettop,right:i.offsetright,bottom:i.offsetbottom,left:i.offsetleft}).color(P.length?P:h[i.theme].colors),r.tooltip.enabled(i.tooltips),e.message=i.nodatamessage||"No data found",r.noData(e.message),M(e.type)&&e.highlightpoints&&r.dispatch.on("stateChange",(function(){setTimeout((function(){return K(e)}),100)})),!e.showlegend||"Donut"!==e.type&&"Pie"!==e.type||"right"===e.showlegend&&r.legendPosition("right"),r},K=function(e,t){var n=t?null:e.$id;M(e.type)&&(function(e,t){t=t||1.5,(e?d3.select("#wmChart"+e+" svg"):d3.select(w+" svg")).selectAll(".nv-line").style({"stroke-width":t})}(n,e.linethickness),function(e,t){var n=e?d3.select("#wmChart"+e+" svg"):d3.select(w+" svg");t?n.selectAll(".nv-point").style({"stroke-width":"6px","fill-opacity":".95","stroke-opacity":".95"}):n.selectAll(".nv-point").style({"stroke-width":"0px","fill-opacity":"0"})}(n,e.highlightpoints)),e.showlegend&&function(e,t,n){var i,o=z(e.showlegend),a=n?"#wmChart"+n:w,r=d3.select(a+" .nv-legendWrap");if(o&&r[0][0]&&"bottom"===t){var s=r[0][0].getBoundingClientRect().height,l=d3.select(a+" .nv-wrap"),c=l&&l.attr("transform")?l.attr("transform").replace(/, /g,","):"",p=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(c);r.attr("transform","translate(0 , "+(0===(i=$(a+" svg>.nvd3.nv-wrap")[0].getBoundingClientRect().height)&&(i=$(a+" svg")[0].getBoundingClientRect().height-(s+15)),i-s-5+")")),p&&l.attr("transform","translate("+p[1]+",5)")}}(e,e.showlegend,n)},Q={widgetType:"wm-chart",hostClass:"app-chart"},Z="none",J=["aggregation","aggregationcolumn","groupby","orderby"],X={Column:"rect.nv-bar",Bar:"g.nv-bar",Area:".nv-stackedarea .nv-point","Cumulative Line":".nv-cumulativeLine .nv-scatterWrap path.nv-point",Line:".nv-lineChart .nv-scatterWrap path.nv-point",Pie:".nv-pieChart .nv-slice path",Donut:".nv-pieChart .nv-slice path",Bubble:".nv-scatterChart .nv-point-paths path"},ee={fontunit:"font-size",fontsize:"font-size",color:"fill",fontfamily:"font-family",fontweight:"font-weight",fontstyle:"font-style",textdecoration:"text-decoration"},te={average:"AVG",count:"COUNT",maximum:"MAX",minimum:"MIN",sum:"SUM"},ne=function(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&e},ie=ne,oe=function(e){var t,n=[],i=[];return _.forEach(_.split(e,","),(function(e){t=_.split(e,":"),n.push(t[0]),i.push(t[1])})),{columns:n,orders:i}},ae=oe,re=function(e){return e?e.replace(/\./g,"$"):null},se=re,le=function(e,t){d3.select("#wmChart"+t+" svg").selectAll("text").style(e)},ce=le,pe=function(e){var t=90*(e.startAngle+e.endAngle)/Math.PI-90;return t>90?t-180:t},de=pe,ue=function(e){function t(t,n){var o=e.call(this,t,Q)||this;return o.app=n,o.iconclass="",o.nonPrimaryColumns=[],o.xDataKeyArr=[],o.chartData=[],o._processedData=[],o._subsciptions=[],o._plotChartProxy=_.debounce(o.plotChartProxy.bind(o),100),o.redraw=o._plotChartProxy.bind(o),i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER,["fontsize","fontunit","color","fontfamily","fontweight","fontstyle","textdecoration"]),o.$id=o.widgetId||Math.random(),a.removeAttr(o.nativeElement,"title"),o.chartReady=!1,o.binddataset=o.nativeElement.getAttribute("dataset.bind"),o._subsciptions.push(o.app.subscribe("toggle-variable-state",o.handleLoading.bind(o))),o._subsciptions.push(o.app.subscribe("iscroll-start",(function(){o.hideTooltip()}))),o}return function(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.isGroupByEnabled=function(){return!(!this.groupby||this.groupby===Z)},t.prototype.isValidAxis=function(){return!this.binddataset||this.xaxisdatakey&&this.yaxisdatakey},t.prototype.isAggregationEnabled=function(){return!(!this.isGroupByEnabled()||this.aggregation===Z||!this.aggregationcolumn)},t.prototype.isDataFilteringEnabled=function(){return this.isAggregationEnabled()||!this.isVisuallyGrouped&&this.orderby},t.prototype.getxAxisVal=function(e,t,n){var i=_.get(e,t);return M(this.type)&&!a.isNumberType(this.xAxisDataType)?(this.xDataKeyArr.push(i),i):i},t.prototype.getXMinMaxValues=function(e){if(e){var t={};return t.min=_.minBy(e.values,(function(e){return e.x||e[0]})),t.max=_.maxBy(e.values,(function(e){return e.x||e[0]})),t}},t.prototype.getYMinMaxValues=function(e){var t={},n=[],i=[];if(e)return _.forEach(e,(function(e){n.push(_.minBy(e.values,(function(e){return e.y||e[1]}))),i.push(_.maxBy(e.values,(function(e){return e.y||e[1]})))})),t.min=_.minBy(n,(function(e){return e.y||e[1]})),t.max=_.maxBy(i,(function(e){return e.y||e[1]})),t},t.prototype.getValidData=function(e){return 1===e.length&&void 0===e[0]?[]:e},t.prototype.valueFinder=function(e,t,n,i,o){var a,r=this.getxAxisVal(e,t,i),s=_.get(e,n),l=parseFloat(s)||s,c=parseFloat(e[this.bubblesize])||2,p={};return k(this.type)?(p.x=r,p.y=l,D(this.type)&&(p.size=c,p.shape=o||"circle")):(a=this.type,_.includes(E,a)&&(p=[r,l])),p._dataObj=e,p},t.prototype.setErrMsg=function(e){this.showNoDataMsg&&(this.showContentLoadError=!0,this.invalidConfig=!0,this.errMsg="")},t.prototype.processChartData=function(){var e=this;if(this.sampleData=j(this),this.xDataKeyArr=[],!this.binddataset)return this.xDataKeyArr=u,this.sampleData;if(!this.chartData||!this.chartData.length)return[];var t,n=[],i=[],o=[],r=this.xaxisdatakey,s=this.yaxisdatakey?this.yaxisdatakey.split(","):[],l=this.chartData;return _.isArray(l)&&(N(this.type)?(t=s[0],n=_.map(l,(function(n,i){if(!a.isEmptyObject(l[i]))return e.valueFinder(l[i],r,t)})),n=this.getValidData(n)):(D(this.type)&&(i="random"===this.shape?d:this.shape),s.forEach((function(t,s){o=_.map(l,(function(n,o){if(!a.isEmptyObject(l[o]))return e.valueFinder(l[o],r,t,o,_.isArray(i)&&i[s]||e.shape)})),o=e.getValidData(o),n.push({values:o,key:a.prettifyLabels(t)})})))),n},t.prototype.setChartData=function(e){e&&(this._processedData=e)},t.prototype.getChartData=function(){return this._processedData},t.prototype.getVisuallyGroupedData=function(e,t){var n,i,o=this,a={},r=[],s=[],l=x(this.type),c=_.first(_.split(this.yaxisdatakey,","));return this.xDataKeyArr=[],e=_.orderBy(e,_.split(this.groupby,",")),this.orderby&&(n=oe(this.orderby),e=_.orderBy(e,n.columns,n.orders)),e=_.groupBy(e,t),l&&(i=_.max(_.map(e,(function(e){return e.length})))),_.forEach(e,(function(e,t){r=x?_.fill(new Array(i),[0,0]):[],_.forEachRight(e,(function(e,t){r[t]=o.valueFinder(e,o.xaxisdatakey,c,t)})),a={key:t,values:r},s.push(a)})),s},t.prototype.getGroupingDetails=function(){var e=this;if(this.isGroupByEnabled()&&!this.isAggregationEnabled()){var t,n,i,o=!1,a=[],r=this.groupby&&this.groupby!==Z?this.groupby.split(","):[],s=this.yaxisdatakey?this.yaxisdatakey.split(","):[];return r.length>1&&(r.every((function(n,a){return e.xaxisdatakey===n||-1!==$.inArray(n,s)||(o=!0,t=n,i=a,r.splice(i,1),!1)})),t&&a.push(t),r.length&&(a=_.concat(a,r))),this.xaxisdatakey!==this.aggregationcolumn&&a.push(this.xaxisdatakey),_.forEach(s,(function(t){t!==e.aggregationcolumn&&a.push(t)})),n=a.join(","),this.isVisuallyGrouped=o,{expression:n,isVisuallyGrouped:o,visualGroupingColumn:t}}return{expression:"",isVisuallyGrouped:!1,visualGroupingColumn:""}},t.prototype.getAggregatedData=function(e){var t,n,i,o=this,r=this.datasource,s=this.yaxisdatakey?this.yaxisdatakey.split(","):[],l={},c=[],p=[];r&&(this.isGroupByEnabled()&&(p=_.split(this.groupby,",")),this.orderby&&(t=_.replace(this.orderby,/:/g," "),c=_.uniq(_.concat(c,p,[this.aggregationcolumn])),i=oe(this.orderby).columns,_.forEach(_.intersection(c,i),(function(e){n=re(e),t=_.replace(t,e,n)}))),this.isAggregationEnabled()&&(l.groupByFields=p,l.aggregations=[{field:this.aggregationcolumn,type:te[this.aggregation],alias:re(this.aggregationcolumn)}]),r.execute("getAggregatedData",{aggregations:l,sort:t}).then((function(t){var n=[],i=re(o.aggregationcolumn),r=re(o.xaxisdatakey),l=[];s.forEach((function(e){return l.push(re(e))})),_.forEach(t.body.content,(function(e){var t={};o.isAggregationEnabled()&&(t[o.aggregationcolumn]=e[i],t[o.aggregationcolumn]=_.get(e,i)||_.get(e,o.aggregationcolumn)),t[o.xaxisdatakey]=_.get(e,r)||_.get(e,o.xaxisdatakey),s.forEach((function(n,i){t[n]=e[l[i]],t[n]=_.get(e,l[i])||_.get(e,n)})),n.push(t)})),o.chartData=n,a.triggerFn(e)}),(function(){o.chartData=[],o.setErrMsg("MESSAGE_ERROR_FETCH_DATA"),a.triggerFn(e)})))},t.prototype.setLabelsMaxWidth=function(){var e,t,n,i,o,a,r,s,l,c,p,d,u=parseInt(this.fontsize,10)||12,h=C(this.type);(e=$("#wmChart"+this.$id+" svg").find("g.nv-x").find("g.tick").find("text")).each((function(){var e,n,a=$(this);if(a.text()&&"1"===a.css("opacity"))return e=a.parent().attr("transform").split(","),i=parseFloat(e[0].substr(10)),o=parseFloat(e[1]||"0"),!h&&i>0?n=i:o>0&&(n=o),t?(t=n-t,!1):(t=n,!0)})),h?(c=$("#wmChart"+this.$id+" svg>g.nv-wrap>g>g.nv-barsWrap")[0],p=$("#wmChart"+this.$id+" svg>g.nv-wrap>g>g.nv-y")[0],d=$("#wmChart"+this.$id+" svg")[0],a=c?c.getBoundingClientRect().height:0,l=p?d.getBoundingClientRect().width-p.getBoundingClientRect().width:d.getBoundingClientRect().width,n=Math.round(l/u),t<u&&(r=a/u,s=Math.ceil(this.chartData.length/r),d3.select("#wmChart"+this.$id+" svg").select("g.nv-x").selectAll("g.tick").select("text").each((function(e,t){t%s!=0&&d3.select(this).attr("opacity",0)})))):n=Math.round(t/u),n=Math.abs(n),e.each((function(){this.textContent.length>n&&(this.textContent=this.textContent.substr(0,n)+"...")}))},t.prototype.getDefaultColumns=function(){var e,t,n,i,o=[],r=this.datasource.execute(a.DataSource.Operation.GET_PROPERTIES_MAP)||[];for(n=0;n<r.length&&o.length<=2;n+=1)e=r[n].type,!r[n].isRelated&&a.isNumberType(e)?o.push(r[n].fieldName):"string"!==e||t||(t=r[n].fieldName);return t&&o.length>0&&!D(this.type)&&(i=o[0],o[0]=t,o[1]=i),o},t.prototype.attachClickEvent=function(){var e,t=this;d3.select("#wmChart"+this.$id+" svg").selectAll(X[this.type]).style("pointer-events","all").on("click",(function(n,i){switch(t.type){case"Column":case"Bar":e=n._dataObj;break;case"Pie":case"Donut":e=n.data._dataObj;break;case"Area":case"Cumulative Line":case"Line":e=n[0]._dataObj;break;case"Bubble":e=n.data.point[4]._dataObj}t.selecteditem=e,t.invokeEventCallback("select",{$event:d3.event,selectedChartItem:n,selectedItem:t.selecteditem})}))},t.prototype.postPlotProcess=function(e){var t,n,i,o,r=this,s={},l=this.$element;K(this),N(this.type)?this.showlabelsoutside||(n=(t=d3.select("#wmChart"+this.$id+" svg")).select(".nv-pieLabels").selectAll(".nv-label"),i=t.select(".nv-pie").selectAll(".nv-slice"),o=[],i&&i.length&&(i.each((function(){d3.select(this).attr("transform",(function(e){o.push(pe(e))}))})),n.each((function(e,t){var n=d3.select(this);$(n[0][0]).find("text").attr("transform","rotate("+o[t]+")")})))):this.setLabelsMaxWidth(),_.forEach(ee,(function(e,t){s[e]="fontsize"===t||"fontunit"===t?r.fontsize+r.fontunit:r[t]})),le(s,this.$id),a.triggerFn(this._resizeFn&&this._resizeFn.clear),this._resizeFn=nv.utils.windowResize((function(){l[0].getBoundingClientRect().height&&(e.update(),K(r),N(r.type)||r.setLabelsMaxWidth())}))},t.prototype.configureChart=function(){var e,t,n,i;if(this._processedData.length>0&&(B(this,"x")&&(e=this.binddataset?this.getXMinMaxValues(this._processedData[0]):{min:{x:1},max:{x:5}}),B(this,"y")&&(t=this.binddataset?this.getYMinMaxValues(this._processedData):{min:{y:1},max:{y:5}})),!N(this.type)||this.binddataset&&this.scopedataset||(this._processedData=a.getClonedObject(this.scopedataset||this._processedData)),n=Y(this,e,t,null,!this.binddataset),_.isArray(this._processedData)){var o=$("#wmChart"+this.$id+" svg").find("g.nv-x").find("g.tick");return o&&o.length&&o.remove(),(i=this.invokeEventCallback("beforerender",{chartInstance:n}))&&(n=i),this.chart=n,d3.select("#wmChart"+this.$id+" svg").datum(this._processedData).call(this.chart),this.postPlotProcess(n),n}},t.prototype.plotChart=function(){var e=this,t=this.$element;this.chartData=this.invokeEventCallback("transform")||this.chartData,this.isVisuallyGrouped&&!N(this.type)?this._processedData=this.chartData:this._processedData=this.processChartData(),t[0].getBoundingClientRect().height&&(this.clearCanvas&&(t.find("svg").replaceWith("<svg></svg>"),this.clearCanvas=!1),this.isValidAxis()||(this._processedData=[]),nv.addGraph((function(){return e.configureChart()}),(function(){setTimeout((function(){e.attachClickEvent()}),600)})),this.isLoadInProgress=!1)},Object.defineProperty(t.prototype,"isLiveVariable",{get:function(){var e=this.datasource;return e&&"wm.LiveVariable"===e.category},enumerable:!1,configurable:!0}),t.prototype.plotChartProxy=function(){var e=this;this.showContentLoadError=!1,this.invalidConfig=!1,this.isLoadInProgress=!0;var t=this.getGroupingDetails();this.binddataset&&this.isLiveVariable&&(this.filterFields||this.isDataFilteringEnabled())?this.getAggregatedData((function(){return e.plotChart()})):(this.dataset&&this.isLiveVariable&&(this.chartData=this.dataset,this.isGroupByEnabled()&&t.isVisuallyGrouped&&(this.chartData=this.getVisuallyGroupedData(this.chartData,t.visualGroupingColumn))),this.plotChart())},t.prototype.setDefaultAxisOptions=function(){var e=this.getDefaultColumns();this.xaxisdatakey=e[0]||null,this.yaxisdatakey=e[1]||null},t.prototype.getCutomizedOptions=function(e,t){var n,i=_.split(this.groupby,","),o=_.split(this.aggregationcolumn,",");if(!this.binddataset)return t;switch(this.axisoptions||(this.axisoptions=t),e){case"xaxisdatakey":this.isGroupByEnabled()&&(n=i);break;case"yaxisdatakey":this.isAggregationEnabled()?n=o:this.isLiveVariable&&(n=this.numericColumns);break;case"groupby":this.isLiveVariable&&this.nonPrimaryColumns&&this.nonPrimaryColumns.length&&(n=this.nonPrimaryColumns);break;case"aggregationcolumn":this.isLiveVariable&&this.isAggregationEnabled()&&"count"!==this.aggregation&&(n=this.numericColumns);break;case"orderby":this.isLiveVariable&&this.isAggregationEnabled()&&(n=_.uniq(_.concat(i,o)));break;case"bubblesize":this.numericColumns&&this.numericColumns.length&&(n=this.numericColumns)}return n||t||this.axisoptions},t.prototype.setNumericandNonPrimaryColumns=function(){var e,t,n=this,i=this.datasource.execute(a.DataSource.Operation.GET_PROPERTIES_MAP);this.numericColumns=[],this.nonPrimaryColumns=[],this.dataset&&!_.isEmpty(i)&&(e=[]),e&&(_.forEach(Object.keys(e),(function(i){t=e[i].type,a.isNumberType(t)&&n.numericColumns.push(i),"true"!==e[i].isRelatedPk&&e[i].isPrimaryKey||n.nonPrimaryColumns.push(i)})),this.numericColumns=this.numericColumns.sort(),this.nonPrimaryColumns=this.nonPrimaryColumns.sort())},t.prototype.handleDataSet=function(e){this.errMsg="",e||this.binddataset||(this.isVisuallyGrouped=!1,this.axisoptions=null),this.chartData=this.isLiveVariable?e||"":e&&""===e.dataValue&&1===_.keys(e).length?"":e,!_.isArray(this.chartData)&&_.isObject(this.chartData)&&(this.chartData=[this.chartData]),e&&e.filterFields&&(this.filterFields=e.filterFields),this.chartData&&this._plotChartProxy()},t.prototype.setDonutCenterLabel=function(e){var t;(t=d3.select("#wmChart"+this.$id+" svg").select(".nv-wrap.nv-pie").select(".nv-pie")).text(""),t.append("text").attr("dy",".35em").attr("text-anchor","middle").attr("class","nv-pie-title").text(e).each((function(e){var t=d3.select(this),n=d3.select(this.parentElement),i=Number(n.node().getBoundingClientRect().width)-30,o=this.getComputedTextLength();t.attr("data-scale",i/o)})).style("font-size",(function(){var e=16*d3.select(this).attr("data-scale");return e>24?24:e+"px"}))},t.prototype.onPropertyChange=function(t,n,i){switch(e.prototype.onPropertyChange.call(this,t,n,i),t){case"dataset":this.handleDataSet(n);break;case"centerlabel":this.chart&&(this.chart.title(n),this.setDonutCenterLabel(n));break;case"type":N(this.type)?(this.offsettop=20,this.offsetright=0,this.offsetbottom=0,this.offsetleft=0):"Pie"!==i&&"Donut"!==i||(this.offsettop=25,this.offsetright=25,this.offsetbottom=55,this.offsetleft=75),i!==n&&(this.clearCanvas=!0),this._plotChartProxy();break;default:this._plotChartProxy()}_.includes(J,t)&&this._plotChartProxy()},t.prototype.handleLoading=function(e){var t=this.datasource;t&&t.execute(a.DataSource.Operation.IS_API_AWARE)&&a.isDataSourceEqual(e.variable,t)&&(this.variableInflight=e.active,this.isLoadInProgress=e.active)},t.prototype.hideTooltip=function(){d3.selectAll(".nvtooltip").style("opacity",0)},t.prototype.onStyleChange=function(t,n,i){var o={};switch(e.prototype.onStyleChange.call(this,t,n,i),t){case"fontsize":case"fontunit":case"color":case"fontfamily":case"fontweight":case"fontstyle":case"textdecoration":o[ee[t]]="fontsize"===t||"fontunit"===t?this.fontsize+this.fontunit:n,le(o,this.$id)}},t.prototype.ngAfterViewInit=function(){e.prototype.ngAfterViewInit.call(this),_.includes(["outside","inside","hide"],this.showlabels)||(this.showlabels=ne(this.showlabels),this.showlabelsoutside=ne(this.showlabelsoutside),this.showlabels=this.showlabels?this.showlabelsoutside?"outside":"inside":"hide"),this.theme||(this.theme=N(this.type)?"Azure":"Terrestrial"),this.nativeElement.setAttribute("id","wmChart"+this.$id),this.binddataset||this.nativeElement.getAttribute("scopedataset")||this._plotChartProxy()},t.prototype.ngOnDestroy=function(){this.hideTooltip(),this._subsciptions.forEach((function(e){e()})),e.prototype.ngOnDestroy.call(this)},t}(i.StylableComponent);ue.initializeProps=c(),ue.decorators=[{type:t.Component,args:[{selector:"div[wmChart]",template:'<div class="panel-heading" *ngIf="title">\n <h3 class="panel-title">\n <div class="pull-left"><i class="app-icon panel-icon {{iconclass}}" [class.ng-hide]="!iconclass"></i></div>\n <div class="heading" [innerHTML]="title"></div>\n <div class="description" *ngIf="subheading" [innerHTML]="subheading"></div>\n </h3>\n</div>\n<div class="app-chart-inner" [ngClass]="{\'loading\':isLoadInProgress, \'panel-body\': title}">\n <svg></svg>\n <div class="wm-content-info readonly-wrapper" *ngIf="showContentLoadError && showNoDataMsg">\n <p class="wm-message" [title]="hintMsg" [ngClass]="{\'error\': invalidConfig}" [innerText]="errMsg"></p>\n </div>\n <div wmSpinner show.bind="isLoadInProgress" caption.bind="loadingdatamsg"></div>\n</div>\n',providers:[i.provideAsWidgetRef(ue)],encapsulation:t.ViewEncapsulation.None,styles:[".nvd3 .nv-axis line,.nvd3 .nv-axis path{fill:none;shape-rendering:crispEdges}.nv-brush .extent,.nvd3 .background path,.nvd3 .nv-axis line,.nvd3 .nv-axis path{shape-rendering:crispEdges}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue{pointer-events:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-axis path{stroke:#000;stroke-opacity:.75}.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{stroke:#e5e5e5}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero{stroke-opacity:.75}.nvd3 .nv-axis .nv-axisMaxMin text{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-bars rect{fill-opacity:.75;transition:fill-opacity .25s linear}.nvd3 .nv-bars rect.hover{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:transparent}.nvd3 .nv-bars .hover text{fill:#000}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;transition:fill-opacity .25s linear}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick,.with-transitions .nvd3 .nv-groups .nv-point{transition:stroke-width .25s linear,stroke-opacity .25s linear}.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover{fill-opacity:1}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:#000;stroke:transparent}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover{fill-opacity:1}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-measure:hover{fill-opacity:1}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-markerLine{stroke:#000;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect{stroke:#d62728;fill:#d62728}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nv-force-node{stroke:#fff;stroke-width:1.5px}.nv-force-link{stroke:#999;stroke-opacity:.6}.nv-force-node text{stroke-width:0}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3.nv-linePlusBar .nv-bar rect:hover{fill-opacity:1}.nvd3 .nv-groups path.nv-line{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point{fill-opacity:0;stroke-opacity:0}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-moz-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{box-shadow:0 5px 10px #0003;border-radius:5px}.nvd3 text{font:400 12px Arial,sans-serif}.nvd3 .title{font:700 14px Arial,sans-serif}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .extent{fill-opacity:.125}.nv-brush .resize path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .extent{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}@media print{.nvd3 text{stroke-width:0;fill-opacity:1}}.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#eee;stroke-opacity:.4}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .extent{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:#13c4f996}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3.nv-pie path{transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3 .nv-scatter .nv-point.hover{fill-opacity:1}.nvd3.nv-sparkline path{fill:none}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3 .nv-interactiveGuideLine,.nvtooltip{pointer-events:none}.nvd3 .nv-hoverArea{fill-opacity:0;stroke-opacity:0}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;transition:fill-opacity .25s linear,stroke-opacity .25s linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;color:#000;padding:1px;z-index:10000;display:block;font-family:Arial,sans-serif;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.5);border-radius:4px}.nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nvtooltip.with-transitions,.with-transitions .nvtooltip{transition:opacity 50ms linear;transition-delay:.2s}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:#f7f7f7bf;color:#000;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.key.total{font-weight:700}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table td.percent{color:#a9a9a9}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}\n"]}]}],ue.ctorParameters=function(){return[{type:t.Injector},{type:a.App}]},ue.propDecorators={title:[{type:t.HostBinding,args:["class.panel"]}]};var he=[ue],me=function(){};me.decorators=[{type:t.NgModule,args:[{imports:[o.BasicModule,n.CommonModule,i.WmComponentsModule],declarations:l([],s(he)),exports:l([],s(he)),entryComponents:[]}]}],e.ChartComponent=ue,e.ChartModule=me,e["\u02750"]=ie,e["\u02751"]=ae,e["\u02752"]=se,e["\u02753"]=ce,e["\u02754"]=de,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("ngx-bootstrap/dropdown"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/input"),require("@angular/router"),require("@wm/core")):"function"==typeof define&&define.amd?define("@wm/components/navigation/menu",["exports","@angular/core","@angular/common","ngx-bootstrap/dropdown","@wm/components/base","@wm/components/basic","@wm/components/input","@angular/router","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.navigation=e.wm.components.navigation||{},e.wm.components.navigation.menu={}),e.ng.core,e.ng.common,e["ngx-bootstrap"].dropdown,e.wm.components.base,e.wm.components.basic,e.wm.components.input,e.ng.router,e.wm.core)}(this,(function(e,t,n,i,o,a,r,s,l){"use strict";
253
+ ***************************************************************************** */var r=function(e,t){return(r=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)};Object.create;function s(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 l(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 c=function(){i.register("wm-chart",new Map([["aggregation",Object.assign({value:"none"},i.PROP_STRING)],["aggregationcolumn",i.PROP_STRING],["areaviewtype",Object.assign({value:"stack"},i.PROP_STRING)],["barspacing",Object.assign({value:"medium"},i.PROP_STRING)],["bubblesize",i.PROP_STRING],["centerlabel",i.PROP_STRING],["class",i.PROP_STRING],["customcolors",i.PROP_ANY],["dataset",i.PROP_ANY],["datasource",i.PROP_STRING],["donutratio",Object.assign({value:"medium"},i.PROP_STRING)],["formattype",{value:"",PROP_STRING:i.PROP_STRING}],["groupby",i.PROP_STRING],["height",{value:"210px",PROP_STRING:i.PROP_STRING}],["highlightpoints",i.PROP_BOOLEAN],["iconclass",i.PROP_STRING],["interpolation",Object.assign({value:"linear"},i.PROP_STRING)],["labelthreshold",Object.assign({value:.01},i.PROP_NUMBER)],["labeltype",Object.assign({value:"percent"},i.PROP_STRING)],["legendtype",Object.assign({value:"furious"},i.PROP_STRING)],["linethickness",i.PROP_STRING],["loadingdatamsg",Object.assign({value:"Loading..."},i.PROP_STRING)],["name",i.PROP_STRING],["nodatamessage",Object.assign({value:"No Data Available."},i.PROP_STRING)],["offset",i.PROP_STRING],["offsetbottom",Object.assign({value:55},i.PROP_NUMBER)],["offsetleft",Object.assign({value:75},i.PROP_NUMBER)],["offsetright",Object.assign({value:25},i.PROP_NUMBER)],["offsettop",Object.assign({value:25},i.PROP_NUMBER)],["orderby",i.PROP_STRING],["reducexticks",Object.assign({value:!0},i.PROP_BOOLEAN)],["shape",Object.assign({value:"circle"},i.PROP_STRING)],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showlabels",Object.assign({value:"outside"},i.PROP_STRING)],["showlabelsoutside",Object.assign({value:!0},i.PROP_BOOLEAN)],["showlegend",Object.assign({value:"top"},i.PROP_STRING)],["showvalues",Object.assign({value:!1},i.PROP_BOOLEAN)],["showxaxis",Object.assign({value:!0},i.PROP_BOOLEAN)],["showxdistance",Object.assign({value:!1},i.PROP_BOOLEAN)],["showyaxis",Object.assign({value:!0},i.PROP_BOOLEAN)],["showydistance",Object.assign({value:!1},i.PROP_BOOLEAN)],["staggerlabels",Object.assign({value:!1},i.PROP_BOOLEAN)],["subheading",i.PROP_STRING],["theme",i.PROP_STRING],["title",i.PROP_STRING],["tooltips",Object.assign({value:!0},i.PROP_BOOLEAN)],["type",i.PROP_STRING],["viewtype",Object.assign({value:"Grouped"},i.PROP_STRING)],["xaxisdatakey",i.PROP_STRING],["xaxislabel",i.PROP_STRING],["xaxislabeldistance",Object.assign({value:12},i.PROP_NUMBER)],["xdateformat",i.PROP_STRING],["xdomain",Object.assign({value:"Default"},i.PROP_STRING)],["xnumberformat",i.PROP_STRING],["xunits",i.PROP_STRING],["yaxisdatakey",i.PROP_STRING],["yaxislabel",i.PROP_STRING],["yaxislabeldistance",Object.assign({value:12},i.PROP_NUMBER)],["ydomain",Object.assign({value:"Default"},i.PROP_STRING)],["ynumberformat",i.PROP_STRING],["yunits",i.PROP_STRING]]))},p=["Column","Line","Area","Cumulative Line","Bar","Pie","Donut","Bubble"],d=["circle","square","diamond","cross","triangle-up","triangle-down"],u=["01/01/2001","01/01/2002","01/01/2003"],h={Terrestrial:{colors:["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],tooltip:{backgroundColor:"#de7d28",textColor:"#FFFFFF"}},Annabelle:{colors:["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],tooltip:{backgroundColor:"#2e306f",textColor:"#FFFFFF"}},Azure:{colors:["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"],tooltip:{backgroundColor:"#3182bd",textColor:"#FFFFFF"}},Retro:{colors:["#0ca7a1","#ffa615","#334957","#acc5c2","#988f90","#8accc9","#515151","#f27861","#36c9fd","#794668","#0f709d","#0d2738","#44be78","#4a1839","#6a393f","#557d8b","#6c331c","#1c1c1c","#861500","#09562a"],tooltip:{backgroundColor:"#80513a",textColor:"#FFFFFF"}},Mellow:{colors:["#f0dcbf","#88c877","#aeb918","#2e2c23","#ddddd2","#dfe956","#4c963b","#5d3801","#e1eec3","#cd8472","#fcfab3","#9a4635","#9295ad","#2e3f12","#565677","#557d8b","#4f4d02","#0c0c1b","#833324","#24120e"],tooltip:{backgroundColor:"#7c9e73",textColor:"#FFFFFF"}},Orient:{colors:["#a80000","#cc6c3c","#f0e400","#000084","#fccc6c","#009c6c","#cc309c","#78cc00","#fc84e4","#48e4fc","#4878d8","#186c0c","#606060","#a8a8a8","#000000","#d7d7d7","#75a06e","#190d0b","#888888","#694b84"],tooltip:{backgroundColor:"#c14242",textColor:"#FFFFFF"}},GrayScale:{colors:["#141414","#353535","#5b5b5b","#848484","#a8a8a8","#c3c3c3","#e0e0e0","#c8c8c8","#a5a5a5","#878787","#656565","#4e4e4e","#303030","#1c1c1c","#4f4f4f","#3b3b3b","#757575","#606060","#868686","#c1c1c1"],tooltip:{backgroundColor:"#575757",textColor:"#FFFFFF"}},Flyer:{colors:["#3f454c","#5a646e","#848778","#cededf","#74c4dd","#0946ed","#380bb1","#000ff0","#f54a23","#1db262","#bca3aa","#ffa500","#a86b32","#63a18c","#56795e","#934343","#b75f5f","#752d2d","#4e1111","#920606"],tooltip:{backgroundColor:"#47637c",textColor:"#FFFFFF"}},Luminosity:{colors:["#FFFFFF","#e4e4e4","#00bcd4","#f0dd2f","#00aabf","#018376","#e91e63","#39e5d4","#ff6d6d","#00ff76","#ff9800","#969696","#ff4200","#e00000","#95cbe5","#5331ff","#fff4a7","#e7a800","#0061e4","#d5e7ff"],tooltip:{backgroundColor:"#47637c",textColor:"#FFFFFF"}}},m=["xaxislabel","yaxislabel","xunits","yunits","xnumberformat","xdateformat","ynumberformat","showvalues","showlabels","viewtype","areaviewtype","staggerlabels","reducexticks","offsettop","offsetbottom","offsetright","offsetleft","barspacing","xaxislabeldistance","yaxislabeldistance","theme","labeltype","donutratio","showlabelsoutside","showxdistance","showydistance","shape","nodatamessage","captions","showxaxis","showyaxis","centerlabel","customcolors","showlegend","legendtype","xdomain","ydomain","tooltips","linethickness","highlightpoints","interpolation","labelthreshold"],f={small:.3,medium:.5,large:.8},g={small:.3,medium:.6,large:.7},v=_.invert(f),y=_.invert(g),b={Thousand:{prefix:"K",divider:1e3},Million:{prefix:"M",divider:1e6},Billion:{prefix:"B",divider:1e9}},w="#preview-chart",P=["Column","Line","Pie","Bar","Donut","Bubble"],O=["Line","Area","Cumulative Line"],E=["Cumulative Line","Area"],R="Europe",A="Asia",T="America",S="Australia",C=function(e){return"Bar"===e},I=function(e){return"Donut"===e},D=function(e){return"Bubble"===e},x=function(e){return"Area"===e},N=function(e){return function(e){return"Pie"===e}(e)||I(e)},k=function(e){return _.includes(P,e)||!_.includes(p,e)},M=function(e){return _.includes(O,e)},L=function(e,t){return"value"===t?f[e]:"key"===t?v[e]:void 0},F=function(e,t){return"value"===t?g[e]:"key"===t?y[e]:void 0},j=function(e){return function(e,t,n){var i=[],o=[],a=[],r=[],s=[],l=[],c=[],p=[],u=[],h=[];switch(e){case"jsonFormat":i=[{x:"01/01/2001",y:4e6},{x:"01/01/2002",y:1e6},{x:"01/01/2003",y:5e6}],o=[{x:"01/01/2001",y:3e6},{x:"01/01/2002",y:4e6},{x:"01/01/2003",y:7e6}],a=[{x:"01/01/2001",y:2e6},{x:"01/01/2002",y:8e6},{x:"01/01/2003",y:6e6}],h[0]={values:i,key:R},t>=2&&(h[1]={values:o,key:A}),t>=3&&(h[2]={values:a,key:T});break;case"lineChartFormat":i=[{x:1,y:4e6},{x:2,y:1e6},{x:3,y:5e6}],o=[{x:1,y:3e6},{x:2,y:4e6},{x:3,y:7e6}],a=[{x:1,y:2e6},{x:2,y:8e6},{x:3,y:6e6}],h[0]={values:i,key:R},t>=2&&(h[1]={values:o,key:A}),t>=3&&(h[2]={values:a,key:T});break;case"arrayFormat":r=[[1,4e6],[2,1e6],[3,5e6]],s=[[1,3e6],[2,4e6],[3,7e6]],l=[[1,2e6],[2,8e6],[3,6e6]],h[0]={values:r,key:R},t>=2&&(h[1]={values:s,key:A}),t>=3&&(h[2]={values:l,key:T});break;case"bubbleFormat":c=[{x:80.66,y:33739900,size:78,shape:n="random"===n?d[Math.floor(Math.random()*d.length)]:n},{x:79.84,y:81902300,size:90,shape:n},{x:78.6,y:5523100,size:45,shape:n}],p=[{x:72.73,y:79716200,size:98,shape:n},{x:80.05,y:61801600,size:20,shape:n},{x:72.49,y:73137200,size:34,shape:n}],u=[{x:68.09,y:33739900,size:45,shape:n},{x:81.55,y:7485600,size:78,shape:n},{x:68.6,y:14185e4,size:56,shape:n}],h[0]={values:c,key:R},t>=2&&(h[1]={values:p,key:A}),t>=3&&(h[2]={values:u,key:T});break;case"pieChartFormat":h=[{x:R,y:1e6},{x:A,y:2e6},{x:T,y:3e6},{x:S,y:4e6}]}return h}(function(e){var t=e.type;return function(e){return"Line"===e}(t)?"lineChartFormat":N(t)?"pieChartFormat":D(t)?"bubbleFormat":k(t)?"jsonFormat":"arrayFormat"}(e),_.split(e.yaxisdatakey,",").length,e.shape)},B=function(e,t){return!("Min"!==e[t+"domain"]||(n=e.type,!function(e){return"Column"===e}(n)&&!x(n)));var n},G=function(e){return!(!_.isFinite(e.min)||!_.isFinite(e.max))},V=function(e){var t=Math.floor(e);return Math.abs(e)-t>0?e-.1:t-1},W=function(e,t){return isNaN(parseInt(e,10))?t(e,"value"):e},U=function(e,t){return e=e||"%x",d3.time.format(e)(new Date(moment(moment(t).format()).valueOf()))},q=function(e,t){var n,i,o;return n=d3.format(e)(t),e?(i=b[e]&&b[e].divider||0,(o=b[e]&&b[e].prefix)&&0!==i&&(n=d3.format(".2f")(t/i)+o)):n=t>=1e3?d3.format(".1s")(t):t,n},z=function(e){return"false"!==e&&!1!==e&&("true"===e||!0===e||"hide"!==e)},H=function(e,t,n,i){e.tooltip.contentGenerator((function(e){var o,a=e.data.x;return o=q(t.ynumberformat,e.data.y),N(n.type)&&(i=e.data.x,a=""),'<table><tbody><tr class="value"><b>'+a+'</b></tr><tr><td class="legend-color-guide"><div style="background-color:'+e.color+';"></div></td><td class="key">'+i+'</td><td class="value">'+o+"</td></tr></tbody></table>"}))},Y=function(e,t,n,i,o){i=function(e,t){return t&&!a.isEmptyObject(t)||(t={}),_.forEach(m,(function(n){_.isUndefined(t[n])&&(t[n]=e[n])})),t}(e,i);var r,s,l,c,d,v,y,b,w,P=[],O={},E={};switch(e.type){case"Column":v=W(i.barspacing,L)||f.medium,r=nv.models.multiBarChart().x((function(e){return e.x})).y((function(e){return e.y})).reduceXTicks(i.reducexticks).rotateLabels(0).showControls(!1).stacked("Stacked"===i.viewtype).groupSpacing(v);break;case"Cumulative Line":r=nv.models.cumulativeLineChart().x((function(e){return e[0]})).y((function(e){return e[1]})).showControls(!1).useInteractiveGuideline(i.tooltips).interpolate(i.interpolation);break;case"Line":r=nv.models.lineChart().useInteractiveGuideline(i.tooltips).interpolate(i.interpolation);break;case"Area":r=nv.models.stackedAreaChart().x((function(e){return e[0]})).y((function(e){return e[1]})).clipEdge(!0).showControls(!1).style(i.areaviewtype).useInteractiveGuideline(i.tooltips).interpolate(i.interpolation);break;case"Bar":v=W(i.barspacing,L)||f.medium,r=nv.models.multiBarHorizontalChart().x((function(e){return e.x})).y((function(e){return e.y})).showControls(!1).stacked("Stacked"===i.viewtype).showValues(i.showvalues).groupSpacing(v);break;case"Pie":case"Donut":c=function(e,t,n){var i={};switch(e){case"hide":i.showlabels=!1;break;case"inside":i.showlabels=!0,i.showlabelsoutside=!1;break;case"outside":i.showlabels=!0,i.showlabelsoutside=!0}return i}(i.showlabels,i.showlabelsoutside),d=W(i.donutratio,F)||g.medium,r=nv.models.pieChart().x((function(e){return e.x})).y((function(e){return e.y})).showLabels(c.showlabels).labelType(i.labeltype).valueFormat(d3.format("%")).title(i.centerlabel).labelThreshold(i.labelthreshold||.01).labelsOutside(c.showlabelsoutside),I(e.type)&&r.donut(!0).donutRatio(d),"key-value"===i.labeltype&&r.labelType((function(e){return e.data.x+" "+e.data.y}));break;case"Bubble":r=nv.models.scatterChart().x((function(e){return e.x})).y((function(e){return e.y})).showDistX(i.showxdistance).showDistY(i.showydistance)}return t&&(O.min=t.min.x||t.min[0],O.max=t.max.x||t.max[0],G(O)&&(O.min=V(O.min),r.xDomain([O.min,O.max]))),n&&(E.min=n.min.y||n.min[1],E.max=n.max.y||n.max[1],G(E)&&(E.min=V(E.min),r.yDomain([E.min,E.max]))),r.legend.vers(i.legendtype&&i.legendtype.toLowerCase()||"furious"),_.includes(p,e.type)||(r=nv.models.multiBarChart().x((function(e){return e.x})).y((function(e){return e.y}))),N(e.type)?("percent"===i.labeltype?r.valueFormat(d3.format("%")):r.valueFormat((function(e){return q(i.ynumberformat,e)})),H(r,i,e)):(r.showXAxis(i.showxaxis).showYAxis(i.showyaxis),s=i.xaxislabel||a.prettifyLabels(e.xaxisdatakey)||"x caption",l=i.yaxislabel||a.prettifyLabels(e.yaxisdatakey)||"y caption",e.yaxisdatakey&&e.yaxisdatakey.split(",").length>1&&(w=!0),w||D(e.type)||H(r,i,e,l),s+=i.xunits?"("+i.xunits+")":"",l+=i.yunits?"("+i.yunits+")":"",r.xAxis.axisLabel(s).axisLabelDistance(i.xaxislabeldistance).staggerLabels(i.staggerlabels),i.xdateformat||o&&!D(e.type)?M(e.type)?r.xAxis.tickFormat((function(t){return b=o?u[t-1]:e.xDataKeyArr[t],U(i.xdateformat,b)})):r.xAxis.tickFormat((function(e){return U(i.xdateformat,e)})):i.xnumberformat?r.xAxis.tickFormat((function(e){return q(i.xnumberformat,e)})):M(e.type)&&r.xAxis.tickFormat((function(t){return e.xDataKeyArr[t]})),r.yAxis.axisLabel(l).axisLabelDistance(i.yaxislabeldistance).staggerLabels(i.staggerlabels).tickFormat((function(e){return q(i.ynumberformat,e)})),C(e.type)&&r.valueFormat((function(e){return q(i.ynumberformat,e)}))),_.isString(i.customcolors)&&i.customcolors&&(P=_.split(i.customcolors,",")),_.isArray(i.customcolors)&&(P=i.customcolors),y=z(i.showlegend),r.showLegend(y).margin({top:i.offsettop,right:i.offsetright,bottom:i.offsetbottom,left:i.offsetleft}).color(P.length?P:h[i.theme].colors),r.tooltip.enabled(i.tooltips),e.message=i.nodatamessage||"No data found",r.noData(e.message),M(e.type)&&e.highlightpoints&&r.dispatch.on("stateChange",(function(){setTimeout((function(){return K(e)}),100)})),!e.showlegend||"Donut"!==e.type&&"Pie"!==e.type||"right"===e.showlegend&&r.legendPosition("right"),r},K=function(e,t){var n=t?null:e.$id;M(e.type)&&(function(e,t){t=t||1.5,(e?d3.select("#wmChart"+e+" svg"):d3.select(w+" svg")).selectAll(".nv-line").style({"stroke-width":t})}(n,e.linethickness),function(e,t){var n=e?d3.select("#wmChart"+e+" svg"):d3.select(w+" svg");t?n.selectAll(".nv-point").style({"stroke-width":"6px","fill-opacity":".95","stroke-opacity":".95"}):n.selectAll(".nv-point").style({"stroke-width":"0px","fill-opacity":"0"})}(n,e.highlightpoints)),e.showlegend&&function(e,t,n){var i,o=z(e.showlegend),a=n?"#wmChart"+n:w,r=d3.select(a+" .nv-legendWrap");if(o&&r[0][0]&&"bottom"===t){var s=r[0][0].getBoundingClientRect().height,l=d3.select(a+" .nv-wrap"),c=l&&l.attr("transform")?l.attr("transform").replace(/, /g,","):"",p=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(c);r.attr("transform","translate(0 , "+(0===(i=$(a+" svg>.nvd3.nv-wrap")[0].getBoundingClientRect().height)&&(i=$(a+" svg")[0].getBoundingClientRect().height-(s+15)),i-s-5+")")),p&&l.attr("transform","translate("+p[1]+",5)")}}(e,e.showlegend,n)},Q={widgetType:"wm-chart",hostClass:"app-chart"},Z="none",J=["aggregation","aggregationcolumn","groupby","orderby"],X={Column:"rect.nv-bar",Bar:"g.nv-bar",Area:".nv-stackedarea .nv-point","Cumulative Line":".nv-cumulativeLine .nv-scatterWrap path.nv-point",Line:".nv-lineChart .nv-scatterWrap path.nv-point",Pie:".nv-pieChart .nv-slice path",Donut:".nv-pieChart .nv-slice path",Bubble:".nv-scatterChart .nv-point-paths path"},ee={fontunit:"font-size",fontsize:"font-size",color:"fill",fontfamily:"font-family",fontweight:"font-weight",fontstyle:"font-style",textdecoration:"text-decoration"},te={average:"AVG",count:"COUNT",maximum:"MAX",minimum:"MIN",sum:"SUM"},ne=function(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&e},ie=ne,oe=function(e){var t,n=[],i=[];return _.forEach(_.split(e,","),(function(e){t=_.split(e,":"),n.push(t[0]),i.push(t[1])})),{columns:n,orders:i}},ae=oe,re=function(e){return e?e.replace(/\./g,"$"):null},se=re,le=function(e,t){d3.select("#wmChart"+t+" svg").selectAll("text").style(e)},ce=le,pe=function(e){var t=90*(e.startAngle+e.endAngle)/Math.PI-90;return t>90?t-180:t},de=pe,ue=function(e){function t(t,n){var o=e.call(this,t,Q)||this;return o.app=n,o.iconclass="",o.nonPrimaryColumns=[],o.xDataKeyArr=[],o.chartData=[],o._processedData=[],o._subsciptions=[],o._plotChartProxy=_.debounce(o.plotChartProxy.bind(o),100),o.redraw=o._plotChartProxy.bind(o),i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER,["fontsize","fontunit","color","fontfamily","fontweight","fontstyle","textdecoration"]),o.$id=o.widgetId||Math.random(),a.removeAttr(o.nativeElement,"title"),o.chartReady=!1,o.binddataset=o.nativeElement.getAttribute("dataset.bind"),o._subsciptions.push(o.app.subscribe("toggle-variable-state",o.handleLoading.bind(o))),o._subsciptions.push(o.app.subscribe("iscroll-start",(function(){o.hideTooltip()}))),o}return function(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.isGroupByEnabled=function(){return!(!this.groupby||this.groupby===Z)},t.prototype.isValidAxis=function(){return!this.binddataset||this.xaxisdatakey&&this.yaxisdatakey},t.prototype.isAggregationEnabled=function(){return!(!this.isGroupByEnabled()||this.aggregation===Z||!this.aggregationcolumn)},t.prototype.isDataFilteringEnabled=function(){return this.isAggregationEnabled()||!this.isVisuallyGrouped&&this.orderby},t.prototype.getxAxisVal=function(e,t,n){var i=_.get(e,t);return M(this.type)&&!a.isNumberType(this.xAxisDataType)?(this.xDataKeyArr.push(i),i instanceof Date?i:n):i},t.prototype.getXMinMaxValues=function(e){if(e){var t={};return t.min=_.minBy(e.values,(function(e){return e.x||e[0]})),t.max=_.maxBy(e.values,(function(e){return e.x||e[0]})),t}},t.prototype.getYMinMaxValues=function(e){var t={},n=[],i=[];if(e)return _.forEach(e,(function(e){n.push(_.minBy(e.values,(function(e){return e.y||e[1]}))),i.push(_.maxBy(e.values,(function(e){return e.y||e[1]})))})),t.min=_.minBy(n,(function(e){return e.y||e[1]})),t.max=_.maxBy(i,(function(e){return e.y||e[1]})),t},t.prototype.getValidData=function(e){return 1===e.length&&void 0===e[0]?[]:e},t.prototype.valueFinder=function(e,t,n,i,o){var a,r=this.getxAxisVal(e,t,i),s=_.get(e,n),l=parseFloat(s)||s,c=parseFloat(e[this.bubblesize])||2,p={};return k(this.type)?(p.x=r,p.y=l,D(this.type)&&(p.size=c,p.shape=o||"circle")):(a=this.type,_.includes(E,a)&&(p=[r,l])),p._dataObj=e,p},t.prototype.setErrMsg=function(e){this.showNoDataMsg&&(this.showContentLoadError=!0,this.invalidConfig=!0,this.errMsg="")},t.prototype.processChartData=function(){var e=this;if(this.sampleData=j(this),this.xDataKeyArr=[],!this.binddataset)return this.xDataKeyArr=u,this.sampleData;if(!this.chartData||!this.chartData.length)return[];var t,n=[],i=[],o=[],r=this.xaxisdatakey,s=this.yaxisdatakey?this.yaxisdatakey.split(","):[],l=this.chartData;return _.isArray(l)&&(N(this.type)?(t=s[0],n=_.map(l,(function(n,i){if(!a.isEmptyObject(l[i]))return e.valueFinder(l[i],r,t)})),n=this.getValidData(n)):(D(this.type)&&(i="random"===this.shape?d:this.shape),s.forEach((function(t,s){o=_.map(l,(function(n,o){if(!a.isEmptyObject(l[o]))return e.valueFinder(l[o],r,t,o,_.isArray(i)&&i[s]||e.shape)})),o=e.getValidData(o),n.push({values:o,key:a.prettifyLabels(t)})})))),n},t.prototype.setChartData=function(e){e&&(this._processedData=e)},t.prototype.getChartData=function(){return this._processedData},t.prototype.getVisuallyGroupedData=function(e,t){var n,i,o=this,a={},r=[],s=[],l=x(this.type),c=_.first(_.split(this.yaxisdatakey,","));return this.xDataKeyArr=[],e=_.orderBy(e,_.split(this.groupby,",")),this.orderby&&(n=oe(this.orderby),e=_.orderBy(e,n.columns,n.orders)),e=_.groupBy(e,t),l&&(i=_.max(_.map(e,(function(e){return e.length})))),_.forEach(e,(function(e,t){r=x?_.fill(new Array(i),[0,0]):[],_.forEachRight(e,(function(e,t){r[t]=o.valueFinder(e,o.xaxisdatakey,c,t)})),a={key:t,values:r},s.push(a)})),s},t.prototype.getGroupingDetails=function(){var e=this;if(this.isGroupByEnabled()&&!this.isAggregationEnabled()){var t,n,i,o=!1,a=[],r=this.groupby&&this.groupby!==Z?this.groupby.split(","):[],s=this.yaxisdatakey?this.yaxisdatakey.split(","):[];return r.length>1&&(r.every((function(n,a){return e.xaxisdatakey===n||-1!==$.inArray(n,s)||(o=!0,t=n,i=a,r.splice(i,1),!1)})),t&&a.push(t),r.length&&(a=_.concat(a,r))),this.xaxisdatakey!==this.aggregationcolumn&&a.push(this.xaxisdatakey),_.forEach(s,(function(t){t!==e.aggregationcolumn&&a.push(t)})),n=a.join(","),this.isVisuallyGrouped=o,{expression:n,isVisuallyGrouped:o,visualGroupingColumn:t}}return{expression:"",isVisuallyGrouped:!1,visualGroupingColumn:""}},t.prototype.getAggregatedData=function(e){var t,n,i,o=this,r=this.datasource,s=this.yaxisdatakey?this.yaxisdatakey.split(","):[],l={},c=[],p=[];r&&(this.isGroupByEnabled()&&(p=_.split(this.groupby,",")),this.orderby&&(t=_.replace(this.orderby,/:/g," "),c=_.uniq(_.concat(c,p,[this.aggregationcolumn])),i=oe(this.orderby).columns,_.forEach(_.intersection(c,i),(function(e){n=re(e),t=_.replace(t,e,n)}))),this.isAggregationEnabled()&&(l.groupByFields=p,l.aggregations=[{field:this.aggregationcolumn,type:te[this.aggregation],alias:re(this.aggregationcolumn)}]),r.execute("getAggregatedData",{aggregations:l,sort:t}).then((function(t){var n=[],i=re(o.aggregationcolumn),r=re(o.xaxisdatakey),l=[];s.forEach((function(e){return l.push(re(e))})),_.forEach(t.body.content,(function(e){var t={};o.isAggregationEnabled()&&(t[o.aggregationcolumn]=e[i],t[o.aggregationcolumn]=_.get(e,i)||_.get(e,o.aggregationcolumn)),t[o.xaxisdatakey]=_.get(e,r)||_.get(e,o.xaxisdatakey),s.forEach((function(n,i){t[n]=e[l[i]],t[n]=_.get(e,l[i])||_.get(e,n)})),n.push(t)})),o.chartData=n,a.triggerFn(e)}),(function(){o.chartData=[],o.setErrMsg("MESSAGE_ERROR_FETCH_DATA"),a.triggerFn(e)})))},t.prototype.setLabelsMaxWidth=function(){var e,t,n,i,o,a,r,s,l,c,p,d,u=parseInt(this.fontsize,10)||12,h=C(this.type);(e=$("#wmChart"+this.$id+" svg").find("g.nv-x").find("g.tick").find("text")).each((function(){var e,n,a=$(this);if(a.text()&&"1"===a.css("opacity"))return e=a.parent().attr("transform").split(","),i=parseFloat(e[0].substr(10)),o=parseFloat(e[1]||"0"),!h&&i>0?n=i:o>0&&(n=o),t?(t=n-t,!1):(t=n,!0)})),h?(c=$("#wmChart"+this.$id+" svg>g.nv-wrap>g>g.nv-barsWrap")[0],p=$("#wmChart"+this.$id+" svg>g.nv-wrap>g>g.nv-y")[0],d=$("#wmChart"+this.$id+" svg")[0],a=c?c.getBoundingClientRect().height:0,l=p?d.getBoundingClientRect().width-p.getBoundingClientRect().width:d.getBoundingClientRect().width,n=Math.round(l/u),t<u&&(r=a/u,s=Math.ceil(this.chartData.length/r),d3.select("#wmChart"+this.$id+" svg").select("g.nv-x").selectAll("g.tick").select("text").each((function(e,t){t%s!=0&&d3.select(this).attr("opacity",0)})))):n=Math.round(t/u),n=Math.abs(n),e.each((function(){this.textContent.length>n&&(this.textContent=this.textContent.substr(0,n)+"...")}))},t.prototype.getDefaultColumns=function(){var e,t,n,i,o=[],r=this.datasource.execute(a.DataSource.Operation.GET_PROPERTIES_MAP)||[];for(n=0;n<r.length&&o.length<=2;n+=1)e=r[n].type,!r[n].isRelated&&a.isNumberType(e)?o.push(r[n].fieldName):"string"!==e||t||(t=r[n].fieldName);return t&&o.length>0&&!D(this.type)&&(i=o[0],o[0]=t,o[1]=i),o},t.prototype.attachClickEvent=function(){var e,t=this;d3.select("#wmChart"+this.$id+" svg").selectAll(X[this.type]).style("pointer-events","all").on("click",(function(n,i){switch(t.type){case"Column":case"Bar":e=n._dataObj;break;case"Pie":case"Donut":e=n.data._dataObj;break;case"Area":case"Cumulative Line":case"Line":e=n[0]._dataObj;break;case"Bubble":e=n.data.point[4]._dataObj}t.selecteditem=e,t.invokeEventCallback("select",{$event:d3.event,selectedChartItem:n,selectedItem:t.selecteditem})}))},t.prototype.postPlotProcess=function(e){var t,n,i,o,r=this,s={},l=this.$element;K(this),N(this.type)?this.showlabelsoutside||(n=(t=d3.select("#wmChart"+this.$id+" svg")).select(".nv-pieLabels").selectAll(".nv-label"),i=t.select(".nv-pie").selectAll(".nv-slice"),o=[],i&&i.length&&(i.each((function(){d3.select(this).attr("transform",(function(e){o.push(pe(e))}))})),n.each((function(e,t){var n=d3.select(this);$(n[0][0]).find("text").attr("transform","rotate("+o[t]+")")})))):this.setLabelsMaxWidth(),_.forEach(ee,(function(e,t){s[e]="fontsize"===t||"fontunit"===t?r.fontsize+r.fontunit:r[t]})),le(s,this.$id),a.triggerFn(this._resizeFn&&this._resizeFn.clear),this._resizeFn=nv.utils.windowResize((function(){l[0].getBoundingClientRect().height&&(e.update(),K(r),N(r.type)||r.setLabelsMaxWidth())}))},t.prototype.configureChart=function(){var e,t,n,i;if(this._processedData.length>0&&(B(this,"x")&&(e=this.binddataset?this.getXMinMaxValues(this._processedData[0]):{min:{x:1},max:{x:5}}),B(this,"y")&&(t=this.binddataset?this.getYMinMaxValues(this._processedData):{min:{y:1},max:{y:5}})),!N(this.type)||this.binddataset&&this.scopedataset||(this._processedData=a.getClonedObject(this.scopedataset||this._processedData)),n=Y(this,e,t,null,!this.binddataset),_.isArray(this._processedData)){var o=$("#wmChart"+this.$id+" svg").find("g.nv-x").find("g.tick");return o&&o.length&&o.remove(),(i=this.invokeEventCallback("beforerender",{chartInstance:n}))&&(n=i),this.chart=n,d3.select("#wmChart"+this.$id+" svg").datum(this._processedData).call(this.chart),this.postPlotProcess(n),n}},t.prototype.plotChart=function(){var e=this,t=this.$element;this.chartData=this.invokeEventCallback("transform")||this.chartData,this.isVisuallyGrouped&&!N(this.type)?this._processedData=this.chartData:this._processedData=this.processChartData(),t[0].getBoundingClientRect().height&&(this.clearCanvas&&(t.find("svg").replaceWith("<svg></svg>"),this.clearCanvas=!1),this.isValidAxis()||(this._processedData=[]),nv.addGraph((function(){return e.configureChart()}),(function(){setTimeout((function(){e.attachClickEvent()}),600)})),this.isLoadInProgress=!1)},Object.defineProperty(t.prototype,"isLiveVariable",{get:function(){var e=this.datasource;return e&&"wm.LiveVariable"===e.category},enumerable:!1,configurable:!0}),t.prototype.plotChartProxy=function(){var e=this;this.showContentLoadError=!1,this.invalidConfig=!1,this.isLoadInProgress=!0;var t=this.getGroupingDetails();this.binddataset&&this.isLiveVariable&&(this.filterFields||this.isDataFilteringEnabled())?this.getAggregatedData((function(){return e.plotChart()})):(this.dataset&&this.isLiveVariable&&(this.chartData=this.dataset,this.isGroupByEnabled()&&t.isVisuallyGrouped&&(this.chartData=this.getVisuallyGroupedData(this.chartData,t.visualGroupingColumn))),this.plotChart())},t.prototype.setDefaultAxisOptions=function(){var e=this.getDefaultColumns();this.xaxisdatakey=e[0]||null,this.yaxisdatakey=e[1]||null},t.prototype.getCutomizedOptions=function(e,t){var n,i=_.split(this.groupby,","),o=_.split(this.aggregationcolumn,",");if(!this.binddataset)return t;switch(this.axisoptions||(this.axisoptions=t),e){case"xaxisdatakey":this.isGroupByEnabled()&&(n=i);break;case"yaxisdatakey":this.isAggregationEnabled()?n=o:this.isLiveVariable&&(n=this.numericColumns);break;case"groupby":this.isLiveVariable&&this.nonPrimaryColumns&&this.nonPrimaryColumns.length&&(n=this.nonPrimaryColumns);break;case"aggregationcolumn":this.isLiveVariable&&this.isAggregationEnabled()&&"count"!==this.aggregation&&(n=this.numericColumns);break;case"orderby":this.isLiveVariable&&this.isAggregationEnabled()&&(n=_.uniq(_.concat(i,o)));break;case"bubblesize":this.numericColumns&&this.numericColumns.length&&(n=this.numericColumns)}return n||t||this.axisoptions},t.prototype.setNumericandNonPrimaryColumns=function(){var e,t,n=this,i=this.datasource.execute(a.DataSource.Operation.GET_PROPERTIES_MAP);this.numericColumns=[],this.nonPrimaryColumns=[],this.dataset&&!_.isEmpty(i)&&(e=[]),e&&(_.forEach(Object.keys(e),(function(i){t=e[i].type,a.isNumberType(t)&&n.numericColumns.push(i),"true"!==e[i].isRelatedPk&&e[i].isPrimaryKey||n.nonPrimaryColumns.push(i)})),this.numericColumns=this.numericColumns.sort(),this.nonPrimaryColumns=this.nonPrimaryColumns.sort())},t.prototype.handleDataSet=function(e){this.errMsg="",e||this.binddataset||(this.isVisuallyGrouped=!1,this.axisoptions=null),this.chartData=this.isLiveVariable?e||"":e&&""===e.dataValue&&1===_.keys(e).length?"":e,!_.isArray(this.chartData)&&_.isObject(this.chartData)&&(this.chartData=[this.chartData]),e&&e.filterFields&&(this.filterFields=e.filterFields),this.chartData&&this._plotChartProxy()},t.prototype.setDonutCenterLabel=function(e){var t;(t=d3.select("#wmChart"+this.$id+" svg").select(".nv-wrap.nv-pie").select(".nv-pie")).text(""),t.append("text").attr("dy",".35em").attr("text-anchor","middle").attr("class","nv-pie-title").text(e).each((function(e){var t=d3.select(this),n=d3.select(this.parentElement),i=Number(n.node().getBoundingClientRect().width)-30,o=this.getComputedTextLength();t.attr("data-scale",i/o)})).style("font-size",(function(){var e=16*d3.select(this).attr("data-scale");return e>24?24:e+"px"}))},t.prototype.onPropertyChange=function(t,n,i){switch(e.prototype.onPropertyChange.call(this,t,n,i),t){case"dataset":this.handleDataSet(n);break;case"centerlabel":this.chart&&(this.chart.title(n),this.setDonutCenterLabel(n));break;case"type":N(this.type)?(this.offsettop=20,this.offsetright=0,this.offsetbottom=0,this.offsetleft=0):"Pie"!==i&&"Donut"!==i||(this.offsettop=25,this.offsetright=25,this.offsetbottom=55,this.offsetleft=75),i!==n&&(this.clearCanvas=!0),this._plotChartProxy();break;default:this._plotChartProxy()}_.includes(J,t)&&this._plotChartProxy()},t.prototype.handleLoading=function(e){var t=this.datasource;t&&t.execute(a.DataSource.Operation.IS_API_AWARE)&&a.isDataSourceEqual(e.variable,t)&&(this.variableInflight=e.active,this.isLoadInProgress=e.active)},t.prototype.hideTooltip=function(){d3.selectAll(".nvtooltip").style("opacity",0)},t.prototype.onStyleChange=function(t,n,i){var o={};switch(e.prototype.onStyleChange.call(this,t,n,i),t){case"fontsize":case"fontunit":case"color":case"fontfamily":case"fontweight":case"fontstyle":case"textdecoration":o[ee[t]]="fontsize"===t||"fontunit"===t?this.fontsize+this.fontunit:n,le(o,this.$id)}},t.prototype.ngAfterViewInit=function(){e.prototype.ngAfterViewInit.call(this),_.includes(["outside","inside","hide"],this.showlabels)||(this.showlabels=ne(this.showlabels),this.showlabelsoutside=ne(this.showlabelsoutside),this.showlabels=this.showlabels?this.showlabelsoutside?"outside":"inside":"hide"),this.theme||(this.theme=N(this.type)?"Azure":"Terrestrial"),this.nativeElement.setAttribute("id","wmChart"+this.$id),this.binddataset||this.nativeElement.getAttribute("scopedataset")||this._plotChartProxy()},t.prototype.ngOnDestroy=function(){this.hideTooltip(),this._subsciptions.forEach((function(e){e()})),e.prototype.ngOnDestroy.call(this)},t}(i.StylableComponent);ue.initializeProps=c(),ue.decorators=[{type:t.Component,args:[{selector:"div[wmChart]",template:'<div class="panel-heading" *ngIf="title">\n <h3 class="panel-title">\n <div class="pull-left"><i class="app-icon panel-icon {{iconclass}}" [class.ng-hide]="!iconclass"></i></div>\n <div class="heading" [innerHTML]="title"></div>\n <div class="description" *ngIf="subheading" [innerHTML]="subheading"></div>\n </h3>\n</div>\n<div class="app-chart-inner" [ngClass]="{\'loading\':isLoadInProgress, \'panel-body\': title}">\n <svg></svg>\n <div class="wm-content-info readonly-wrapper" *ngIf="showContentLoadError && showNoDataMsg">\n <p class="wm-message" [title]="hintMsg" [ngClass]="{\'error\': invalidConfig}" [innerText]="errMsg"></p>\n </div>\n <div wmSpinner show.bind="isLoadInProgress" caption.bind="loadingdatamsg"></div>\n</div>\n',providers:[i.provideAsWidgetRef(ue)],encapsulation:t.ViewEncapsulation.None,styles:[".nvd3 .nv-axis line,.nvd3 .nv-axis path{fill:none;shape-rendering:crispEdges}.nv-brush .extent,.nvd3 .background path,.nvd3 .nv-axis line,.nvd3 .nv-axis path{shape-rendering:crispEdges}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue{pointer-events:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-axis path{stroke:#000;stroke-opacity:.75}.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{stroke:#e5e5e5}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero{stroke-opacity:.75}.nvd3 .nv-axis .nv-axisMaxMin text{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-bars rect{fill-opacity:.75;transition:fill-opacity .25s linear}.nvd3 .nv-bars rect.hover{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:transparent}.nvd3 .nv-bars .hover text{fill:#000}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;transition:fill-opacity .25s linear}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick,.with-transitions .nvd3 .nv-groups .nv-point{transition:stroke-width .25s linear,stroke-opacity .25s linear}.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover{fill-opacity:1}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:#000;stroke:transparent}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover{fill-opacity:1}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-measure:hover{fill-opacity:1}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-markerLine{stroke:#000;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect{stroke:#d62728;fill:#d62728}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nv-force-node{stroke:#fff;stroke-width:1.5px}.nv-force-link{stroke:#999;stroke-opacity:.6}.nv-force-node text{stroke-width:0}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3.nv-linePlusBar .nv-bar rect:hover{fill-opacity:1}.nvd3 .nv-groups path.nv-line{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point{fill-opacity:0;stroke-opacity:0}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-moz-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{box-shadow:0 5px 10px #0003;border-radius:5px}.nvd3 text{font:400 12px Arial,sans-serif}.nvd3 .title{font:700 14px Arial,sans-serif}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .extent{fill-opacity:.125}.nv-brush .resize path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .extent{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}@media print{.nvd3 text{stroke-width:0;fill-opacity:1}}.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#eee;stroke-opacity:.4}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .extent{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:#13c4f996}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3.nv-pie path{transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3 .nv-scatter .nv-point.hover{fill-opacity:1}.nvd3.nv-sparkline path{fill:none}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3 .nv-interactiveGuideLine,.nvtooltip{pointer-events:none}.nvd3 .nv-hoverArea{fill-opacity:0;stroke-opacity:0}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;transition:fill-opacity .25s linear,stroke-opacity .25s linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;color:#000;padding:1px;z-index:10000;display:block;font-family:Arial,sans-serif;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.5);border-radius:4px}.nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nvtooltip.with-transitions,.with-transitions .nvtooltip{transition:opacity 50ms linear;transition-delay:.2s}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:#f7f7f7bf;color:#000;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.key.total{font-weight:700}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table td.percent{color:#a9a9a9}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}\n"]}]}],ue.ctorParameters=function(){return[{type:t.Injector},{type:a.App}]},ue.propDecorators={title:[{type:t.HostBinding,args:["class.panel"]}]};var he=[ue],me=function(){};me.decorators=[{type:t.NgModule,args:[{imports:[o.BasicModule,n.CommonModule,i.WmComponentsModule],declarations:l([],s(he)),exports:l([],s(he)),entryComponents:[]}]}],e.ChartComponent=ue,e.ChartModule=me,e["\u02750"]=ie,e["\u02751"]=ae,e["\u02752"]=se,e["\u02753"]=ce,e["\u02754"]=de,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("ngx-bootstrap/dropdown"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/input"),require("@angular/router"),require("@wm/core")):"function"==typeof define&&define.amd?define("@wm/components/navigation/menu",["exports","@angular/core","@angular/common","ngx-bootstrap/dropdown","@wm/components/base","@wm/components/basic","@wm/components/input","@angular/router","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.navigation=e.wm.components.navigation||{},e.wm.components.navigation.menu={}),e.ng.core,e.ng.common,e["ngx-bootstrap"].dropdown,e.wm.components.base,e.wm.components.basic,e.wm.components.input,e.ng.router,e.wm.core)}(this,(function(e,t,n,i,o,a,r,s,l){"use strict";
254
254
  /*! *****************************************************************************
255
255
  Copyright (c) Microsoft Corporation.
256
256
 
@@ -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[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