@wavemaker/app-runtime-wm-build 11.4.0-next.25708 → 11.4.0-next.25712

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/app-runtime-wm-build",
3
- "version": "11.4.0-next.25708",
3
+ "version": "11.4.0-next.25712",
4
4
  "description": "All modules required for a wavemaker application.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22781,10 +22781,10 @@
22781
22781
  }));
22782
22782
 
22783
22783
  (function(global, factory) {
22784
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@angular/core"), require("@angular/common"), require("@wm/components/base")) : typeof define === "function" && define.amd ? define("@wm/components/basic/tree", [ "exports", "@angular/core", "@angular/common", "@wm/components/base" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
22784
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@angular/core"), require("@angular/common"), require("@wm/components/base"), require("@wm/core")) : typeof define === "function" && define.amd ? define("@wm/components/basic/tree", [ "exports", "@angular/core", "@angular/common", "@wm/components/base", "@wm/core" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
22785
22785
  factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {},
22786
- global.wm.components.basic = global.wm.components.basic || {}, global.wm.components.basic.tree = {}), global.ng.core, global.ng.common, global.wm.components.base));
22787
- })(this, (function(exports, core, common, base) {
22786
+ global.wm.components.basic = global.wm.components.basic || {}, global.wm.components.basic.tree = {}), global.ng.core, global.ng.common, global.wm.components.base, global.wm.core));
22787
+ })(this, (function(exports, core$1, common, base, core) {
22788
22788
  "use strict";
22789
22789
  /*! *****************************************************************************
22790
22790
  Copyright (c) Microsoft Corporation.
@@ -23173,7 +23173,11 @@
23173
23173
  _this.setting = {
23174
23174
  data: {
23175
23175
  simpleData: {
23176
- enable: true
23176
+ enable: false
23177
+ },
23178
+ key: {
23179
+ children: "children",
23180
+ name: "label"
23177
23181
  }
23178
23182
  },
23179
23183
  view: {
@@ -23210,11 +23214,19 @@
23210
23214
  break;
23211
23215
 
23212
23216
  case "nodelabel":
23213
- this.nodelabel = nv;
23217
+ this.setting.data.key.name = this.labelKey;
23218
+ this.renderTree();
23214
23219
  break;
23215
23220
 
23216
- case "icon":
23217
- this.nodeicon = nv;
23221
+ case "nodechildren":
23222
+ this.setting.data.key.children = this.childrenKey;
23223
+ this.renderTree();
23224
+ break;
23225
+
23226
+ case "nodeicon":
23227
+ this.nodeicon = this.iconKey;
23228
+ this.renderTree();
23229
+ break;
23218
23230
 
23219
23231
  case "orderby":
23220
23232
  this.renderTree();
@@ -23232,9 +23244,10 @@
23232
23244
  TreeComponent.prototype.expandTree = function(level, node, childLevel) {
23233
23245
  var _this = this;
23234
23246
  node.map((function(childNode) {
23235
- if ("children" in childNode && !("open" in childNode) && childLevel < level) {
23247
+ var children = _this.getChildren(childNode);
23248
+ if (children && !("open" in childNode) && childLevel < level) {
23236
23249
  childNode["open"] = true;
23237
- _this.expandTree(level, childNode.children, childLevel + 1);
23250
+ _this.expandTree(level, children, childLevel + 1);
23238
23251
  } else {
23239
23252
  childLevel = 0;
23240
23253
  return;
@@ -23283,8 +23296,9 @@
23283
23296
  var _this = this;
23284
23297
  if (depth === 0) {
23285
23298
  nodes.map((function(node) {
23286
- if (node.children) {
23287
- _this.setNodeData(node.children, depth, level, parentNode, type);
23299
+ var children = _this.getChildren(node);
23300
+ if (children) {
23301
+ _this.setNodeData(children, depth, level, parentNode, type);
23288
23302
  }
23289
23303
  if (node.icon && _this.nodelabel == "icon") {
23290
23304
  node[type] = node.icon;
@@ -23296,11 +23310,12 @@
23296
23310
  }));
23297
23311
  } else {
23298
23312
  nodes.map((function(node) {
23299
- if (node.children && level > 1) {
23313
+ var children = _this.getChildren(node);
23314
+ if (children && level > 1) {
23300
23315
  if (depth === level) {
23301
23316
  parentNode = node;
23302
23317
  }
23303
- _this.setNodeData(node.children, depth, level - 1, parentNode, type);
23318
+ _this.setNodeData(children, depth, level - 1, parentNode, type);
23304
23319
  }
23305
23320
  if (level === 1 && (type === "name" ? _this.nodelabel.includes("label") || _this.nodelabel.includes("name") : _this.nodeicon.includes("label") || _this.nodeicon.includes("name"))) {
23306
23321
  parentNode[type] = node.name || node.label;
@@ -23327,20 +23342,26 @@
23327
23342
  };
23328
23343
  TreeComponent.prototype.getPath = function(treeNode, path) {
23329
23344
  if (treeNode.getParentNode() === null) {
23330
- path = "/" + treeNode.name + path;
23345
+ path = "/" + treeNode[this.labelKey] + path;
23331
23346
  } else {
23332
- path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.name;
23347
+ path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode[this.labelKey];
23333
23348
  }
23334
23349
  return path;
23335
23350
  };
23336
23351
  TreeComponent.prototype.onClick = function(event, treeId, treeNode, clickFlag) {
23337
- var treeObj = $.fn.zTree.getZTreeObj("" + this.name);
23352
+ if (this.nodeclick === "expand") {
23353
+ var nodes = this.treeObj.getSelectedNodes();
23354
+ if (nodes.length > 0) {
23355
+ this.expandNode(nodes[0], !nodes[0].open, true);
23356
+ }
23357
+ }
23338
23358
  var path = this.getPath(treeNode, "");
23339
23359
  var eventParams = {
23340
23360
  $event: event,
23341
23361
  $item: treeNode,
23342
23362
  $path: path
23343
23363
  };
23364
+ this.setSelectedItem(treeNode);
23344
23365
  this.invokeEventCallback("select", eventParams);
23345
23366
  };
23346
23367
  TreeComponent.prototype.onExpand = function(event, treeId, treeNode) {
@@ -23352,7 +23373,8 @@
23352
23373
  $path: path
23353
23374
  };
23354
23375
  this.invokeEventCallback("expand", eventParams);
23355
- treeNode.children ? treeNode.children.map((function(el) {
23376
+ var children = this.getChildren(treeNode);
23377
+ children === null || children === void 0 ? void 0 : children.map((function(el) {
23356
23378
  if (el.isParent) {
23357
23379
  var ele_1 = $("#" + el.tId + "_switch");
23358
23380
  $(ele_1).addClass(self.treeicon || defaultTreeIconClass);
@@ -23362,7 +23384,7 @@
23362
23384
  }), 0);
23363
23385
  }));
23364
23386
  }
23365
- })) : "";
23387
+ }));
23366
23388
  };
23367
23389
  TreeComponent.prototype.onCollapse = function(event, treeId, treeNode) {
23368
23390
  var path = this.getPath(treeNode, "");
@@ -23373,20 +23395,52 @@
23373
23395
  };
23374
23396
  this.invokeEventCallback("collapse", eventParams);
23375
23397
  };
23398
+ TreeComponent.prototype.getChildren = function(node) {
23399
+ return node[this.childrenKey];
23400
+ };
23401
+ Object.defineProperty(TreeComponent.prototype, "childrenKey", {
23402
+ get: function() {
23403
+ var depth = this.countDepth(this.nodechildren);
23404
+ return depth ? this.nodechildren.split(".").pop() : this.nodechildren || "children";
23405
+ },
23406
+ enumerable: false,
23407
+ configurable: true
23408
+ });
23409
+ Object.defineProperty(TreeComponent.prototype, "labelKey", {
23410
+ get: function() {
23411
+ var depth = this.countDepth(this.nodelabel);
23412
+ return depth ? this.nodelabel.split(".").pop() : this.nodelabel || "label";
23413
+ },
23414
+ enumerable: false,
23415
+ configurable: true
23416
+ });
23417
+ Object.defineProperty(TreeComponent.prototype, "iconKey", {
23418
+ get: function() {
23419
+ var depth = this.countDepth(this.nodeicon);
23420
+ return depth ? this.nodeicon.split(".").pop() : this.nodeicon || "icon";
23421
+ },
23422
+ enumerable: false,
23423
+ configurable: true
23424
+ });
23425
+ Object.defineProperty(TreeComponent.prototype, "treeObj", {
23426
+ get: function() {
23427
+ return $.fn.zTree.getZTreeObj("" + this.name);
23428
+ },
23429
+ enumerable: false,
23430
+ configurable: true
23431
+ });
23376
23432
  TreeComponent.prototype.modifyObjects = function(array) {
23377
23433
  var _this = this;
23378
23434
  array.forEach((function(obj) {
23379
- if (obj.label !== undefined) {
23380
- obj.name = obj.label;
23381
- delete obj.label;
23382
- }
23383
- if (obj.children !== undefined) {
23384
- _this.modifyObjects(obj.children);
23435
+ obj.icon = obj[_this.nodeicon];
23436
+ var children = _this.getChildren(obj);
23437
+ if (children === null || children === void 0 ? void 0 : children.length) {
23438
+ _this.modifyObjects(children);
23385
23439
  }
23386
23440
  }));
23387
- return array;
23388
23441
  };
23389
23442
  TreeComponent.prototype.setNodeChildren = function(nodes, depth, level, parentNode) {
23443
+ var _this = this;
23390
23444
  if (depth <= 0) {
23391
23445
  return nodes;
23392
23446
  }
@@ -23395,17 +23449,17 @@
23395
23449
  if (depth === level) {
23396
23450
  parentNode = nodes[i];
23397
23451
  }
23398
- if (node.children && node.children.length > 0) {
23452
+ var children = this.getChildren(node);
23453
+ if (children === null || children === void 0 ? void 0 : children.length) {
23399
23454
  if (level === 1) {
23400
- parentNode.children = node.children.map((function(child) {
23401
- return {
23402
- name: child.name,
23403
- children: child === null || child === void 0 ? void 0 : child.children
23404
- };
23455
+ parentNode[this.childrenKey] = children.map((function(child) {
23456
+ var _a;
23457
+ return _a = {}, _a[_this.labelKey] = child[_this.labelKey], _a[_this.childrenKey] = _this.getChildren(child),
23458
+ _a.icon = child[_this.iconKey], _a;
23405
23459
  }));
23406
23460
  return;
23407
23461
  } else {
23408
- this.setNodeChildren(node.children, depth, level - 1, parentNode);
23462
+ this.setNodeChildren(children, depth, level - 1, parentNode);
23409
23463
  }
23410
23464
  }
23411
23465
  }
@@ -23436,10 +23490,11 @@
23436
23490
  return count;
23437
23491
  };
23438
23492
  TreeComponent.prototype.renderTree = function() {
23439
- console.log(this.nodes, "this.nodes");
23440
23493
  if (this.nodes) {
23441
23494
  this.nativeElement.setAttribute("id", this.name);
23442
- this.nodes = this.modifyObjects(this.nodes);
23495
+ if (this.nodeicon && this.nodeicon !== "icon") {
23496
+ this.modifyObjects(this.nodes);
23497
+ }
23443
23498
  this.setTreeTemplate(this.treeClass);
23444
23499
  if (this.nodelabel) {
23445
23500
  var depth = 0;
@@ -23469,27 +23524,58 @@
23469
23524
  var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
23470
23525
  $.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
23471
23526
  };
23527
+ TreeComponent.prototype.setSelectedItem = function(treeNode) {
23528
+ debugger;
23529
+ this.selecteditem = core.getClonedObject(treeNode) || {};
23530
+ this.selecteditem.path = this.getPath(treeNode, "");
23531
+ var deSelectElm = $("li[treenode].selected");
23532
+ deSelectElm.removeClass("selected");
23533
+ var selectElm = $("#" + treeNode.tId + ":has(.curSelectedNode)");
23534
+ selectElm.addClass("selected");
23535
+ };
23536
+ TreeComponent.prototype.expandNode = function(node, expand, eventFlag) {
23537
+ this.treeObj.expandNode(node, expand, false, false, eventFlag);
23538
+ var el = $("#" + node.tId + "_switch");
23539
+ $(el).addClass(this.treeicon || defaultTreeIconClass);
23540
+ };
23472
23541
  TreeComponent.prototype.ngAfterViewInit = function() {
23473
23542
  var _this = this;
23474
23543
  setTimeout((function() {
23475
23544
  _this.changeTreeIcons(_this.treeicon || defaultTreeIconClass);
23545
+ if (_this.datavalue) {
23546
+ var nodes = _this.treeObj.getNodes();
23547
+ var selectNode = void 0;
23548
+ if (_this.datavalue === "FirstNode") {
23549
+ if (nodes.length) {
23550
+ selectNode = nodes[0];
23551
+ }
23552
+ }
23553
+ if (_this.datavalue === "LastNode") {
23554
+ if (nodes.length) {
23555
+ selectNode = nodes[nodes.length - 1];
23556
+ }
23557
+ }
23558
+ _this.treeObj.selectNode(selectNode, false);
23559
+ _this.setSelectedItem(selectNode);
23560
+ _this.expandNode(selectNode, true, false);
23561
+ }
23476
23562
  }), 200);
23477
23563
  };
23478
23564
  return TreeComponent;
23479
23565
  }(base.StylableComponent);
23480
23566
  TreeComponent.initializeProps = registerProps();
23481
23567
  TreeComponent.decorators = [ {
23482
- type: core.Component,
23568
+ type: core$1.Component,
23483
23569
  args: [ {
23484
23570
  selector: "ul[wmTree]",
23485
23571
  template: '<ul #wmTree class="ztree" id="ztree"></ul> ',
23486
23572
  providers: [ base.provideAsWidgetRef(TreeComponent) ],
23487
- encapsulation: core.ViewEncapsulation.None
23573
+ encapsulation: core$1.ViewEncapsulation.None
23488
23574
  } ]
23489
23575
  } ];
23490
23576
  TreeComponent.ctorParameters = function() {
23491
23577
  return [ {
23492
- type: core.Injector
23578
+ type: core$1.Injector
23493
23579
  } ];
23494
23580
  };
23495
23581
  var components = [ TreeComponent ];
@@ -23498,7 +23584,7 @@
23498
23584
  return TreeModule;
23499
23585
  }();
23500
23586
  TreeModule.decorators = [ {
23501
- type: core.NgModule,
23587
+ type: core$1.NgModule,
23502
23588
  args: [ {
23503
23589
  imports: [ common.CommonModule, base.WmComponentsModule ],
23504
23590
  declarations: __spreadArray([], __read(components)),
@@ -110,7 +110,7 @@
110
110
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
111
111
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
112
112
  PERFORMANCE OF THIS SOFTWARE.
113
- ***************************************************************************** */var p=function(e,t){return(p=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 d(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 u(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 h=new Map([["casesensitive",Object.assign({value:!1},a.PROP_BOOLEAN)],["class",a.PROP_STRING],["datacompletemsg",Object.assign({value:"No more data to load"},a.PROP_STRING)],["datafield",Object.assign({value:"All Fields"},a.PROP_STRING)],["dataoptions",a.PROP_ANY],["dataset",a.PROP_ANY],["datasource",a.PROP_ANY],["datavalue",a.PROP_STRING],["datavaluesource",a.PROP_ANY],["dateformat",a.PROP_STRING],["disabled",a.PROP_BOOLEAN],["displayimagesrc",a.PROP_STRING],["displaylabel",a.PROP_STRING],["displayexpression",a.PROP_STRING],["dropup",a.PROP_BOOLEAN],["groupby",a.PROP_STRING],["hint",a.PROP_STRING],["imagewidth",Object.assign({value:"16px"},a.PROP_STRING)],["limit",a.PROP_NUMBER],["loadingdatamsg",Object.assign({value:"Loading items..."},a.PROP_STRING)],["match",a.PROP_STRING],["matchmode",a.PROP_STRING],["minchars",a.PROP_NUMBER],["name",a.PROP_STRING],["navsearchbar",Object.assign({value:!1},a.PROP_BOOLEAN)],["orderby",a.PROP_STRING],["placeholder",Object.assign({value:"Search"},a.PROP_STRING)],["position",a.PROP_STRING],["query",a.PROP_STRING],["readonly",a.PROP_BOOLEAN],["required",a.PROP_BOOLEAN],["searchkey",a.PROP_STRING],["searchon",Object.assign({value:"typing"},a.PROP_STRING)],["shortcutkey",a.PROP_STRING],["show",Object.assign({value:!0},a.PROP_BOOLEAN)],["showclear",Object.assign({value:!1},a.PROP_BOOLEAN)],["showsearchicon",a.PROP_BOOLEAN],["tabindex",Object.assign({value:0},a.PROP_NUMBER)],["type",Object.assign({value:"search"},a.PROP_STRING)],["debouncetime",Object.assign({value:250},a.PROP_NUMBER)],["width",a.PROP_STRING]]),m=function(){a.register("wm-search",h),a.registerFormWidget(l.FormWidgetType.AUTOCOMPLETE,new Map(h)),a.registerFormWidget(l.FormWidgetType.TYPEAHEAD,new Map(h))},f=function(){function e(){}return e.prototype.applyFilter=function(e,t,n){return e=_.isNumber(e)?e.toString():e,_.includes(n,"start")?_.startsWith(e,t):_.includes(n,"end")?_.endsWith(e,t):_.includes(n,"exact")?_.isEqual(e,t):_.includes(e,t)},e.prototype.filter=function(e){var t=this,n=e.dataset,i=e.casesensitive,o=e.matchMode;o&&!_.includes(o,"ignorecase")&&(i=!0);var a,r=e.query;return new Promise((function(s,l){if(e.searchKey){var c=_.split(e.searchKey,",");a=_.filter(e.dataset,(function(e){return c.some((function(n){var a=_.get(e,n),s=r;return i||(a=_.toLower(_.toString(a)),s=_.toLower(_.toString(s))),t.applyFilter(a,s,o)}))}))}else a=_.isArray(n)&&_.isObject(n[0])?_.filter(n,(function(e){var n=_.values(e).join(" ");return i||(n=_.toLower(n),r=_.toLower(r)),t.applyFilter(n,r)})):_.filter(n,(function(e){return i||(e=_.toLower(e),r=_.toLower(r)),t.applyFilter(e,r,o)}));s({data:a,hasMoreData:!1,isLastPage:!0})}))},e}(),g=function(){function e(){}return e.prototype.filter=function(e){var t=this;return this.filterData(e).then((function(n){return t.onFilterSuccess(e,n)}),(function(){return t.onFilterFailure()}))},e.prototype.filterData=function(e){if(e.dataoptions){var t=e.dataoptions,n=e.datasource.execute(l.DataSource.Operation.GET_REQUEST_PARAMS,e);if(t.relatedField)return new Promise((function(i,o){a.interpolateBindExpressions(e.viewParent,t.filterExpr,(function(a){n.filterExpr=t.filterExpr=a,t.filterExpr=a,e.datasource.execute(l.DataSource.Operation.GET_RELATED_TABLE_DATA,_.assign({relatedField:t.relatedField},n)).then(i,o)}))}));if(t.distinctField)return e.datasource.execute(l.DataSource.Operation.GET_DISTINCT_DATA_BY_FIELDS,{pagesize:e.limit||e.pagesize,page:e.page,fields:t.distinctField,entityName:t.tableName,filterFields:_.assign(t.filterFields,n.filterFields),filterExpr:l.getClonedObject(t.filterExpr||{})})}return e.datasource.execute(l.DataSource.Operation.SEARCH_RECORDS,e)},e.prototype.isLast=function(e,t,n,i){return t===l.AppConstants.INT_MAX_VALUE?0!==i&&i<n:e===(t>n?Math.ceil(t/n):t<0?0:1)},e.prototype.getTransformedData=function(e,t){var n=e.operation+"Result",i=t[n];if(i){var o={};_.set(o,n,i),t=[o]}else t=[t];return t},e.prototype.onFilterFailure=function(){return[]},e.prototype.isLastPageForDistinctApi=function(e,t,n,i){return t>1&&!i&&_.isEmpty(e)&&n===l.AppConstants.INT_MAX_VALUE},e.prototype.onFilterSuccess=function(e,t){var n,i,o,a,r=this,s=t.data,c=_.split(e.binddataset,"."),p=_.slice(c,_.indexOf(c,"dataSet")+1).join(".");return new Promise((function(c,d){var u=t.pagination;if(e.datasource.execute(l.DataSource.Operation.IS_PAGEABLE)&&(o=u.number+1,i=r.isLast(o,e.limit>0&&e.limit||u.totalElements,u.size,u.numberOfElements),a=!0,r.isLastPageForDistinctApi(s,o,u.totalElements,i)))c({data:[],isLastPage:i=!0,hasMoreData:o>1,isPaginatedData:a,page:o});else{if(p){if(_.isArray(s)){var h=p.lastIndexOf("[$i]");if(h>-1){var m=p.substr(h+5);n=s.map((function(e){return l.findValueOf(e,m)}))}}else _.isObject(s)&&(n=_.get(s,p));s=n||s}_.isArray(s)||(s=r.getTransformedData(e.datasource,s)),s.length?c({data:s,isLastPage:i,hasMoreData:o>1,isPaginatedData:a,page:o}):c({data:[],isLastPage:i,hasMoreData:o>1,isPaginatedData:a,page:o})}}))},e}(),v=function(){function e(){}return e.prototype.filter=function(t){var n=this,i=t.datasource&&t.datasource.execute(l.DataSource.Operation.IS_UPDATE_REQUIRED,t.hasData);return(!t.isLocalFilter&&(t.dataoptions||t.datasource&&t.datasource.execute(l.DataSource.Operation.IS_API_AWARE)&&t.searchKey&&i)?e.remoteDataProvider.filter(t):e.localDataProvider.filter(t)).then((function(e){return n.updateDataset=t.datasource&&!t.datasource.execute(l.DataSource.Operation.SUPPORTS_CRUD)&&i,n.hasMoreData=e.hasMoreData,n.isLastPage=e.isLastPage,n.page=e.page,n.isPaginatedData=e.isPaginatedData,e}))},e}();v.remoteDataProvider=new g,v.localDataProvider=new f;var y={widgetType:"wm-search",hostClass:"input-group"},b=function(e){function t(t,n,i,o){var a=e.call(this,t,y)||this;a.binddatavalue=i,a.binddataset=o,a.query="",a.page=1,a.allowempty=!1,a.app=n,l.addClass(a.nativeElement,"app-search",!0),a.typeaheadDataSource=r.Observable.create((function(e){a.listenQuery&&(a._defaultQueryInvoked=!1,a._loadingItems=!0,e.next(a.query)),a.lastSelectedIndex&&(a.typeahead._container=void 0)})).pipe(s.filter((function(){return a._loadingItems=!1,0===a.minchars||a.query&&a.query.length>=a.minchars})),s.mergeMap((function(e){return a.getDataSourceAsObservable(e)}))),a.dataProvider=new v;var c=a.datavalue$.subscribe((function(e){var t=_.isArray(e)?e[0]:e;if(null===t||""===t)return a._modelByValue="",a.query=a.queryModel="",void(a._lastResult=void 0);a._unsubscribeDv||(a._defaultQueryInvoked=!1,_.isObject(e)||a.prevDatavalue===e||(a._modelByKey=void 0,a.query=a.queryModel=""),a.updateByDatavalue(e)),a.showClosebtn=""!==a.query}));a.registerDestroyListener((function(){return c.unsubscribe()}));var p=a.dataset$.subscribe((function(){a.startIndex=a.datasetItems.length,a._lastResult=void 0;var e=a.datavalue||a.toBeProcessedDatavalue;l.isDefined(e)&&a.updateByDataset(e)}));return a.registerDestroyListener((function(){return p.unsubscribe()})),a}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}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"datasource",{get:function(){return this._datasource},set:function(e){this._datasource=e;var t=this.datavalue||this.toBeProcessedDatavalue;this.updateByDatavalue(t)},enumerable:!1,configurable:!0}),t.prototype.clearSearch=function(e,t){this.query="",this.onInputChange(e),this.dataProvider.isLastPage=!1,this.listenQuery=!1,t&&(this.listenQuery=!0,this._unsubscribeDv=!1,this.loadMoreData()),this.invokeEventCallback("clearsearch"),this._loadingItems=!1,e&&this.$element.find(".app-search-input").focus()},t.prototype.clearText=function(){this.query="",this.showClosebtn=!1},t.prototype.closeSearch=function(){this._loadingItems=!1,this.page=1,this.insertAtIndex(this.elIndex),this.elIndex=void 0,this.parentEl=void 0,this.$element.removeClass("full-screen"),this._domUpdated&&(this._domUpdated=!1),this.listenQuery=!1,this._unsubscribeDv=!0,this.typeahead.hide()},t.prototype.renderMobileAutoComplete=function(){l.isDefined(this.elIndex)||(this.parentEl=this.$element.parent(),this.elIndex=this.parentEl.children().index(this.$element)),this.$element.hasClass("full-screen")||(this._domUpdated=!0,this.$element.addClass("full-screen"),"inline"===this.position&&this.$element.addClass(this.position)),this.$element.hasClass("full-screen")&&this.$element.find(".app-search-input").focus()},t.prototype.getDataSourceAsObservable=function(e){if(this._lastQuery===e&&!_.get(this.dataoptions,"filterFields")&&l.isDefined(this._lastResult))return this._loadingItems=!1,r.of(this._lastResult);if("autocomplete"===this.type&&this.searchkey&&this.query&&this.datavalue){var t=[],n=_.split(this.searchkey,","),i=void 0;if(this.binddisplaylabel&&1===(t=_.split(this.binddisplaylabel,"+")).length)if(_.includes(t[0],"|"))i=!0;else{i=/\[(.*?)\]/.exec(t[0])[1]}if(t.length>1||i&&!_.includes(n,i)||this.displayexpression&&!_.includes(n,this.displayexpression))return this._loadingItems=!1,r.of([])}return this._lastQuery=this.query,r.from(this.getDataSource(e))},t.prototype.handleEvent=function(t,n,i,o){_.includes(["blur","focus","select","submit","change"],n)||e.prototype.handleEvent.call(this,t,n,i,o)},t.prototype.highlight=function(e,t){if(this.typeaheadContainer)return e.value=e.item.label.toString(),this.typeaheadContainer.highlight(e,t)},t.prototype.insertAtIndex=function(e){0===e?this.parentEl.prepend(this.$element):this.parentEl.children().eq(e).length?this.$element.insertBefore(this.parentEl.children().eq(e)):this.$element.insertAfter(this.parentEl.children().eq(e-1))},t.prototype.isMobileAutoComplete=function(){return"autocomplete"===this.type&&l.isMobile()},t.prototype.isQueryEntered=function(){return this.showclear&&this.showClosebtn},t.prototype.loadMoreData=function(e){this.dataProvider.isLastPage||(this.page=e?this.page+1:this.page,this.isScrolled=!0,this._loadingItems=!0,e&&(this._lastQuery=void 0),this.typeahead.onInput({target:{value:_.trim(this.query)||"0"}}))},t.prototype.onFocusOut=function(){var e=this;this._unsubscribeDv=!1,this._loadingItems=!1,this.page=1,!this._domUpdated&&this._isOpen&&(this.listenQuery=!1,setTimeout((function(){e.typeahead._typeahead.isShown&&e.typeahead.hide()}),200)),this._isOpen=!1,this._domUpdated&&this.typeahead&&this.typeahead._container&&(this.typeahead._container.isFocused=!0)},t.prototype.onInputChange=function(e){this.result=[],this.page=1,this.listenQuery=this.isUpdateOnKeyPress(),this._modelByValue=void 0,""===this.query?(this.queryModel="",this._modelByValue="",this.updatePrevDatavalue(this._lastQuery),this.invokeOnChange(this._modelByValue,{},!0),this.invokeEventCallback("clear",{$event:e}),e&&9!==e.which&&this.invokeEventCallback("submit",{$event:e})):this.invokeEventCallback("change",{$event:e,newVal:this._modelByValue||this.query,oldVal:this.prevDatavalue}),this.showClosebtn=""!==this.query},t.prototype.handleEnterEvent=function(e){_.get(this.typeahead,"matches.length")||this.onSearchSelect(e)},t.prototype.onSearchSelect=function(e){var t,n,i,o=(null===(n=null===(t=this.typeaheadContainer)||void 0===t?void 0:t.active)||void 0===n?void 0:n.value)===this.query;if(this.typeaheadContainer&&this.typeaheadContainer.active&&o&&(i=this.typeaheadContainer.active.item),e=this.eventData(e,i||{}),!this.isUpdateOnKeyPress())return this.listenQuery=!0,void this.typeahead.onInput({target:{value:this.query}});this.typeaheadContainer&&this.liElements.length&&o?this.typeaheadContainer.selectActiveMatch():(this.queryModel=this.query,this.invokeEventCallback("submit",{$event:e}))},t.prototype.invokeOnBeforeServiceCall=function(e){this.invokeEventCallback("beforeservicecall",{inputData:e})},t.prototype.onDropdownOpen=function(){var e=this;if(this.clearData&&this.typeahead.hide(),_.debounce((function(){e._isOpen=!0,e.typeaheadContainer=e.typeahead._container||e.typeahead._typeahead.instance,e.typeaheadContainer.liElements=e.liElements,e.typeaheadContainer.ulElement=e.ulElement,l.adjustContainerPosition($("typeahead-container"),e.nativeElement,e.typeahead._typeahead,$("typeahead-container .dropdown-menu"))}))(),this.isMobileAutoComplete()){this.$element.hasClass("full-screen")||this.renderMobileAutoComplete();var t=this.dropdownEl.closest("typeahead-container");t.insertAfter(this.$element.find("input").first());var n=this.$element.closest(".app-content").height();t.css({position:"relative",top:0,height:n+"px"}),this.showClosebtn=this.query&&""!==this.query,_.isUndefined(this.dataProvider.isLastPage)||this.dataProvider.isLastPage||this.triggerSearch()}},t.prototype.selectNext=function(){var e=this.typeaheadContainer.matches;if(e){var t=e.indexOf(this.typeaheadContainer.active);!this._loadingItems&&!this.dataProvider.isLastPage&&t+1>e.length-1&&(this.lastSelectedIndex=t,this.loadMoreData(!0))}},t.prototype.setLastActiveMatchAsSelected=function(){this.lastSelectedIndex&&(this.typeaheadContainer._active=this.typeaheadContainer.matches[this.lastSelectedIndex],this.typeaheadContainer.nextActiveMatch(),this.lastSelectedIndex=void 0)},t.prototype.triggerSearch=function(){if(!this.dataProvider.isLastPage&&this.$element.hasClass("full-screen")){var e=this.dropdownEl,t=e.find("li").last();t.length&&e.length&&e.height()+e.position().top>t.height()+t.position().top&&this.loadMoreData(!0)}},t.prototype.isUpdateOnKeyPress=function(){return"typing"===this.searchon},t.prototype.debounceDefaultQuery=function(e){var t=this;this._defaultQueryInvoked=!0,this.getDataSource(e,!0).then((function(e){e.length?(t.queryModel=e,t._lastQuery=t.query=t.queryModel[0].label||"",t._modelByValue=t.queryModel[0].value,t._modelByKey=t.queryModel[0].key,t.showClosebtn=""!==t.query):(t._modelByValue=void 0,t.queryModel=void 0,t.query=""),t.clearData&&_.get(t.typeahead,"_typeahead.isShown")&&t.typeahead.hide()}))},t.prototype.updateByDatavalue=function(e){this.updateByDataset(e),this.updateByDataSource(e)},t.prototype.updateByDataSource=function(e){if(l.isDefined(e)&&!_.isObject(e)&&this.datasource&&!l.isDefined(this._modelByKey)&&this.datafield!==a.ALLFIELDS){if(l.isDefined(this.queryModel)&&!_.isEmpty(this.queryModel))return void this.updateDatavalueFromQueryModel();!this._defaultQueryInvoked&&this.datasource.execute(l.DataSource.Operation.SUPPORTS_CRUD)&&this.debounceDefaultQuery(e)}},t.prototype.updateDatavalueFromQueryModel=function(){l.isDefined(this.queryModel)&&(this._modelByValue=_.isArray(this.queryModel)?this.queryModel[0].value:this.queryModel,this._modelByKey=_.isArray(this.queryModel)?this.queryModel[0].key:this.queryModel,this.toBeProcessedDatavalue=void 0)},t.prototype.updateByDataset=function(e){if(!this._defaultQueryInvoked||!this.searchkey){var t=_.find(this.datasetItems,(function(t){return _.isObject(t.value)?_.isEqual(t.value,e):_.toString(t.value).toLowerCase()===_.toString(e).toLowerCase()}));if(t)this.queryModel=[t];else if(this.datafield===a.ALLFIELDS&&_.isObject(e))this.queryModel=this.getTransformedData(a.extractDataAsArray(e));else if(this.prevDatavalue!==e)return this.queryModel=void 0,void(this.query="");this.updateDatavalueFromQueryModel(),this._lastQuery=this.query=l.isDefined(this.queryModel)&&this.queryModel.length?_.get(this.queryModel[0],"label"):"",this.showClosebtn=""!==this.query}},t.prototype.handleFocus=function(e){"search"===this.type&&this.query===this._lastQuery&&this._lastResult&&this.typeahead.keyUpEventEmitter.emit(this.query)},t.prototype.notifySubscriber=function(){var e=$(this.nativeElement).closest(".app-composite-widget.caption-floating");e.length>0&&this.app.notify("captionPositionAnimate",{displayVal:!0,nativeEl:e})},t.prototype.getDataSource=function(e,t,n){var i=this;if(t&&this.datafield===a.ALLFIELDS)return this._loadingItems=!1,Promise.resolve([]);var o={dataset:this.dataset?a.convertDataToObject(this.dataset):void 0,binddataset:this.binddataset,datasource:this.datasource,datafield:this.datafield,hasData:this.dataset&&this.dataset.length,query:e,isLocalFilter:!this.searchkey,searchKey:t?this.datafield:this.searchkey,matchMode:t?"startignorecase":this.matchmode,casesensitive:this.casesensitive,isformfield:this.isformfield,orderby:this.orderby,limit:this.limit,pagesize:this.pagesize,page:this.page,onBeforeservicecall:this.invokeOnBeforeServiceCall.bind(this)};return this.dataoptions&&(o.dataoptions=this.dataoptions,o.viewParent=this.viewParent),this._loadingItems=!0,this.dataProvider.filter(o).then((function(e){e=e.data||e,l.isDefined(i.dataset)&&i.dataset.length||!i.dataProvider.updateDataset||(i.dataset=e),i.dataProvider.hasMoreData?i.formattedDataset=i.formattedDataset.concat(e):i.formattedDataset=e,i.formattedDataset.length>20&&!l.isDefined(i.limit)&&(i.typeahead.typeaheadOptionsLimit=i.formattedDataset.length),i._isOpen&&i.isMobileAutoComplete()&&!_.isUndefined(i.dataProvider.isLastPage)&&!i.dataProvider.isLastPage&&i.triggerSearch();var t=i.getTransformedData(i.formattedDataset,n);return i.result=_.map(t,"value"),t}),(function(e){return i._loadingItems=!1,[]})).then((function(t){return i.isScrolled&&(_.debounce((function(){i.setLastActiveMatchAsSelected()}),30)(),i.isScrolled=!1),t.length||(i._modelByValue=void 0,i.queryModel=e),i._unsubscribeDv&&(t=[]),i._loadingItems=!1,i._lastResult=t,t}))},t.prototype.getContext=function(e){return e&&_.get(e,"widget")?this.getContext(e.viewParent):e},t.prototype.getTransformedData=function(e,t,n){l.isDefined(t)&&t++;var i=a.transformFormData(this.getContext(this.viewParent),e,this.datafield,{displayField:this.displaylabel||this.displayfield,displayExpr:n?"":this.displayexpression,bindDisplayExpr:n?"":this.binddisplaylabel,bindDisplayImgSrc:this.binddisplayimagesrc,displayImgSrc:this.displayimagesrc},t,this);return a.getUniqObjsByDataField(i,this.datafield,this.displayfield||this.displaylabel,l.toBoolean(this.allowempty))},t.prototype.onScroll=function(e,t){var n=e.scrollHeight,i=e.clientHeight;!this._loadingItems&&!this.dataProvider.isLastPage&&e.scrollTop+i>=n&&this.loadMoreData(!0)},t.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),l.isDefined(this.minchars)||("autocomplete"===this.type?this.minchars=0:this.minchars=1),this.listenQuery=this.isUpdateOnKeyPress(),this.showsearchicon=l.isDefined(this.showsearchicon)?this.showsearchicon:"search"===this.type},t.prototype.ngAfterViewInit=function(){e.prototype.ngAfterViewInit.call(this),a.styler(this.nativeElement,this),this.containerTarget=a.getContainerTargetClass(this.nativeElement)},t.prototype.eventData=function(e,t){return e&&(e.data={item:t.dataObject,model:t.value,label:t.label,query:this.query}),e},t.prototype.typeaheadOnSelect=function(e,t){var n=e.item;this.queryModel=n,n.selected=!0,this.query=n.label,this.showClosebtn=""!==this.query,t=t||this.$typeaheadEvent,this._modelByKey=n.key,this._modelByValue=n.value,t=this.eventData(t,n),this.invokeOnTouched(),this.invokeOnChange(this.datavalue,t||{}),this.datavalue!==this.prevDatavalue&&this.updateBoundVariable(this.datavalue),this.$element.hasClass("full-screen")&&this.closeSearch(),this.invokeEventCallback("select",{$event:t,selectedValue:this.datavalue}),this.invokeEventCallback("submit",{$event:t}),this.updatePrevDatavalue(this.datavalue)},t.prototype.onPropertyChange=function(t,n,i){"tabindex"!==t&&("autocomplete"===this.type&&"displaylabel"===t&&this.displaylabel&&(!this.displayexpression||this.displayexpression&&!this.datasource)&&(this.displayexpression=this.displaylabel,this.displaylabel=void 0),"displaylabel"===t&&this.dataoptions&&null===this.binddisplaylabel&&(this.query=_.get(this._modelByValue,n)||this._modelByValue),"disabled"===t&&(!1===n?this.clearData=!1:(this.clearData=!0,_.get(this.typeahead,"_typeahead.isShown")&&this.typeahead.hide())),e.prototype.onPropertyChange.call(this,t,n,i))},t}(c.DatasetAwareFormComponent);b.initializeProps=m(),b.decorators=[{type:t.Component,args:[{selector:"[wmSearch]",template:'<ng-template #customItemTemplate let-model="item" let-index="index" let-query="query" let-match="match">\n \x3c!-- Default item template --\x3e\n <a *ngIf="!content">\n <img *ngIf="model.imgSrc" [src]="model.imgSrc" alt="Search" [style.width]="imagewidth">\n <span [title]="model.label" [innerHtml]="highlight(match, query) || model.label"></span>\n </a>\n \x3c!-- Custom partial template --\x3e\n <a *ngIf="content" [ngClass]="{customTemplate: content}" partialContainer [wmItemTemplate]="content" [userComponentParams]="match.item">\n <div partial-container-target></div>\n </a>\n</ng-template>\n\n<ng-template #customListTemplate let-matches="matches" let-itemTemplate="itemTemplate" let-query="query">\n <ul #ulElement class="app-search dropdown-menu" scrollable>\n <li #liElements *ngFor="let match of matches" [ngClass]="{active: typeaheadContainer && typeaheadContainer.isActive(match), \'list-group-header\': match && match.isHeader()}"\n (mouseenter)="typeaheadContainer.selectActive(match);"\n (click)="match && !match.isHeader() && typeaheadContainer.selectMatch(match, $event); $typeaheadEvent = $event; notifySubscriber();">\n \x3c!-- itemTemplate comes from the <input> --\x3e\n <h4 *ngIf="match.isHeader()" class="group-title">{{match.value}}</h4>\n <ng-container *ngIf="!match.isHeader()" [ngTemplateOutlet]="itemTemplate"\n [ngTemplateOutletContext]="{item: match.item, index: i, match: match, query: query}">\n </ng-container>\n </li>\n <div class="status" [hidden]="_loadingItems || !(datacompletemsg && dataProvider.isLastPage)">\n <span [textContent]="datacompletemsg"></span>\n </div>\n <div class="status" [hidden]="!_loadingItems">\n <i class="fa fa-circle-o-notch fa-spin"></i>\n <span [textContent]="loadingdatamsg"></span>\n </div>\n </ul>\n</ng-template>\n\n\x3c!--This template is for search inside mobile navbar.--\x3e\n<ng-container *ngIf="navsearchbar; else searchTemplate">\n <input [title]="query || \'\'" type="text" class="app-textbox form-control list-of-objs app-search-input" [placeholder]="placeholder || \'\'"\n focus-target\n container="body"\n [disabled]="disabled"\n autocomplete="off"\n [(ngModel)]="query"\n [readonly]="readonly"\n [disabled]="disabled"\n [typeahead]="typeaheadDataSource"\n [typeaheadWaitMs]="debouncetime"\n [typeaheadItemTemplate]="customItemTemplate"\n [optionsListTemplate]="customListTemplate"\n (input)="onInputChange($event)"\n (keydown)="listenQuery = true"\n (keydown.enter)="$typeaheadEvent = $event;handleEnterEvent($event)"\n (keydown.arrowdown)="selectNext($event)"\n (blur)="invokeOnTouched($event)"\n (click)="handleFocus($event);"\n (focus)="_unsubscribeDv = false; listenQuery = true; handleFocus($event); invokeOnFocus($event);"\n (focusout)="onFocusOut()"\n [typeaheadMinLength]="minchars"\n [typeaheadOptionsLimit]="limit"\n (typeaheadLoading)="_loadingItems"\n (typeaheadOnSelect)="typeaheadOnSelect($event)"\n typeaheadOptionField="label"\n [typeaheadGroupField]="groupby ? \'groupby\' : null"\n [typeaheadAsync]="true"\n [typeaheadScrollable]="true"\n [typeaheadOptionsInScrollableView]="optionslimitinscrollableview"\n [dropup]="dropup"\n [tabindex]="tabindex"\n [attr.name]="name"\n [attr.aria-label]="hint || \'Search field\'"/>\n <i class="btn-close wi wi-cancel" [hidden]="!showClosebtn" (click)="clearSearch($event);"></i>\n</ng-container>\n\x3c!--This template is for both web and fullscreen mode in mobile.--\x3e\n<ng-template #searchTemplate>\n <span class="wi wi-arrow-left form-control-feedback back-btn" aria-hidden="true" (click)="closeSearch()"></span>\n <span class="sr-only">Back button</span>\n <input [title]="query || \'\'" type="text" class="app-textbox form-control list-of-objs app-search-input" [placeholder]="placeholder || \'\'"\n focus-target\n [container]="containerTarget || \'body\'"\n [disabled]="disabled"\n autocomplete="off"\n [(ngModel)]="query"\n [readonly]="readonly"\n [typeahead]="typeaheadDataSource"\n [typeaheadWaitMs]="debouncetime"\n [typeaheadItemTemplate]="customItemTemplate"\n [optionsListTemplate]="customListTemplate"\n (input)="onInputChange($event)"\n (keydown)="listenQuery = true"\n (keydown.enter)="$typeaheadEvent = $event;handleEnterEvent($event)"\n (keydown.arrowdown)="selectNext($event)"\n (blur)="invokeOnTouched($event); onFocusOut()"\n (click)="handleFocus($event);"\n (focus)="_unsubscribeDv = false; listenQuery = true; handleFocus($event); invokeOnFocus($event)"\n [typeaheadMinLength]="minchars"\n [typeaheadOptionsLimit]="limit"\n (typeaheadLoading)="_loadingItems"\n (typeaheadOnSelect)="typeaheadOnSelect($event)"\n typeaheadOptionField="label"\n [typeaheadGroupField]="groupby ? \'groupby\' : null"\n [typeaheadAsync]="true"\n [typeaheadScrollable]="true"\n [typeaheadOptionsInScrollableView]="optionslimitinscrollableview"\n [tabindex]="tabindex"\n [dropup]="dropup"\n [attr.name]="name"\n [attr.aria-label]="hint || \'Search field\'">\n <input class="model-holder" ng-model="proxyModel" ng-required="required" tabindex="-1" aria-hidden="true">\n <span *ngIf="_loadingItems" aria-hidden="true" class="fa fa-circle-o-notch fa-spin form-control-feedback"></span>\n <span class="wi wi-close form-control-feedback clear-btn" [ngClass]="{\'show-btn\': isQueryEntered()}" (click)="clearSearch($event, true)"></span>\n <span class="sr-only">Clear button</span>\n <span *ngIf="showsearchicon" class="input-group-addon" aria-label="search icon" [ngClass]="{\'disabled\': disabled}">\n <form>\n <button title="Search" [disabled]="disabled" class="app-search-button wm-sl-l sl-search" type="submit"\n (click)="onSearchSelect($event)"></button>\n </form>\n </span>\n</ng-template>\n',providers:[a.provideAs(b,i.NG_VALUE_ACCESSOR,!0),a.provideAs(b,i.NG_VALIDATORS,!0),a.provideAsWidgetRef(b)]}]}],b.ctorParameters=function(){return[{type:t.Injector},{type:l.App},{type:void 0,decorators:[{type:t.Attribute,args:["datavalue.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]}]},b.propDecorators={typeahead:[{type:t.ViewChild,args:[o.TypeaheadDirective]}],ulElement:[{type:t.ViewChild,args:["ulElement"]}],liElements:[{type:t.ViewChildren,args:["liElements"]}]};var w=function(){function e(e,n){this.searchRef=n,this.elementRef=e.get(t.ElementRef)}return e.prototype.ngAfterContentInit=function(){this.elementRef.nativeElement.addEventListener("scroll",this.notifyParent.bind(this)),this.searchRef.dropdownEl=$(this.elementRef.nativeElement),this.searchRef.onDropdownOpen()},e.prototype.ngAfterViewInit=function(){if(!this.searchRef.isMobileAutoComplete()){var e=this.searchRef.$element.find("input").first();this.searchRef.dropdownEl.width(e.outerWidth())}},e.prototype.notifyParent=function(e){this.searchRef.onScroll(this.elementRef.nativeElement,e)},e}();w.decorators=[{type:t.Directive,args:[{selector:"[scrollable]"}]}],w.ctorParameters=function(){return[{type:t.Injector},{type:b}]};var P=[b,w],O=function(){};O.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.FormsModule,o.TypeaheadModule,a.WmComponentsModule],declarations:u([],d(P)),exports:u([],d(P)),entryComponents:[]}]}],e.ScrollableDirective=w,e.SearchComponent=b,e.SearchModule=O,e["\u0275a"]=m,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")):"function"==typeof define&&define.amd?define("@wm/components/basic/tree",["exports","@angular/core","@angular/common","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.basic=e.wm.components.basic||{},e.wm.components.basic.tree={}),e.ng.core,e.ng.common,e.wm.components.base)}(this,(function(e,t,n,i){"use strict";
113
+ ***************************************************************************** */var p=function(e,t){return(p=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 d(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 u(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 h=new Map([["casesensitive",Object.assign({value:!1},a.PROP_BOOLEAN)],["class",a.PROP_STRING],["datacompletemsg",Object.assign({value:"No more data to load"},a.PROP_STRING)],["datafield",Object.assign({value:"All Fields"},a.PROP_STRING)],["dataoptions",a.PROP_ANY],["dataset",a.PROP_ANY],["datasource",a.PROP_ANY],["datavalue",a.PROP_STRING],["datavaluesource",a.PROP_ANY],["dateformat",a.PROP_STRING],["disabled",a.PROP_BOOLEAN],["displayimagesrc",a.PROP_STRING],["displaylabel",a.PROP_STRING],["displayexpression",a.PROP_STRING],["dropup",a.PROP_BOOLEAN],["groupby",a.PROP_STRING],["hint",a.PROP_STRING],["imagewidth",Object.assign({value:"16px"},a.PROP_STRING)],["limit",a.PROP_NUMBER],["loadingdatamsg",Object.assign({value:"Loading items..."},a.PROP_STRING)],["match",a.PROP_STRING],["matchmode",a.PROP_STRING],["minchars",a.PROP_NUMBER],["name",a.PROP_STRING],["navsearchbar",Object.assign({value:!1},a.PROP_BOOLEAN)],["orderby",a.PROP_STRING],["placeholder",Object.assign({value:"Search"},a.PROP_STRING)],["position",a.PROP_STRING],["query",a.PROP_STRING],["readonly",a.PROP_BOOLEAN],["required",a.PROP_BOOLEAN],["searchkey",a.PROP_STRING],["searchon",Object.assign({value:"typing"},a.PROP_STRING)],["shortcutkey",a.PROP_STRING],["show",Object.assign({value:!0},a.PROP_BOOLEAN)],["showclear",Object.assign({value:!1},a.PROP_BOOLEAN)],["showsearchicon",a.PROP_BOOLEAN],["tabindex",Object.assign({value:0},a.PROP_NUMBER)],["type",Object.assign({value:"search"},a.PROP_STRING)],["debouncetime",Object.assign({value:250},a.PROP_NUMBER)],["width",a.PROP_STRING]]),m=function(){a.register("wm-search",h),a.registerFormWidget(l.FormWidgetType.AUTOCOMPLETE,new Map(h)),a.registerFormWidget(l.FormWidgetType.TYPEAHEAD,new Map(h))},f=function(){function e(){}return e.prototype.applyFilter=function(e,t,n){return e=_.isNumber(e)?e.toString():e,_.includes(n,"start")?_.startsWith(e,t):_.includes(n,"end")?_.endsWith(e,t):_.includes(n,"exact")?_.isEqual(e,t):_.includes(e,t)},e.prototype.filter=function(e){var t=this,n=e.dataset,i=e.casesensitive,o=e.matchMode;o&&!_.includes(o,"ignorecase")&&(i=!0);var a,r=e.query;return new Promise((function(s,l){if(e.searchKey){var c=_.split(e.searchKey,",");a=_.filter(e.dataset,(function(e){return c.some((function(n){var a=_.get(e,n),s=r;return i||(a=_.toLower(_.toString(a)),s=_.toLower(_.toString(s))),t.applyFilter(a,s,o)}))}))}else a=_.isArray(n)&&_.isObject(n[0])?_.filter(n,(function(e){var n=_.values(e).join(" ");return i||(n=_.toLower(n),r=_.toLower(r)),t.applyFilter(n,r)})):_.filter(n,(function(e){return i||(e=_.toLower(e),r=_.toLower(r)),t.applyFilter(e,r,o)}));s({data:a,hasMoreData:!1,isLastPage:!0})}))},e}(),g=function(){function e(){}return e.prototype.filter=function(e){var t=this;return this.filterData(e).then((function(n){return t.onFilterSuccess(e,n)}),(function(){return t.onFilterFailure()}))},e.prototype.filterData=function(e){if(e.dataoptions){var t=e.dataoptions,n=e.datasource.execute(l.DataSource.Operation.GET_REQUEST_PARAMS,e);if(t.relatedField)return new Promise((function(i,o){a.interpolateBindExpressions(e.viewParent,t.filterExpr,(function(a){n.filterExpr=t.filterExpr=a,t.filterExpr=a,e.datasource.execute(l.DataSource.Operation.GET_RELATED_TABLE_DATA,_.assign({relatedField:t.relatedField},n)).then(i,o)}))}));if(t.distinctField)return e.datasource.execute(l.DataSource.Operation.GET_DISTINCT_DATA_BY_FIELDS,{pagesize:e.limit||e.pagesize,page:e.page,fields:t.distinctField,entityName:t.tableName,filterFields:_.assign(t.filterFields,n.filterFields),filterExpr:l.getClonedObject(t.filterExpr||{})})}return e.datasource.execute(l.DataSource.Operation.SEARCH_RECORDS,e)},e.prototype.isLast=function(e,t,n,i){return t===l.AppConstants.INT_MAX_VALUE?0!==i&&i<n:e===(t>n?Math.ceil(t/n):t<0?0:1)},e.prototype.getTransformedData=function(e,t){var n=e.operation+"Result",i=t[n];if(i){var o={};_.set(o,n,i),t=[o]}else t=[t];return t},e.prototype.onFilterFailure=function(){return[]},e.prototype.isLastPageForDistinctApi=function(e,t,n,i){return t>1&&!i&&_.isEmpty(e)&&n===l.AppConstants.INT_MAX_VALUE},e.prototype.onFilterSuccess=function(e,t){var n,i,o,a,r=this,s=t.data,c=_.split(e.binddataset,"."),p=_.slice(c,_.indexOf(c,"dataSet")+1).join(".");return new Promise((function(c,d){var u=t.pagination;if(e.datasource.execute(l.DataSource.Operation.IS_PAGEABLE)&&(o=u.number+1,i=r.isLast(o,e.limit>0&&e.limit||u.totalElements,u.size,u.numberOfElements),a=!0,r.isLastPageForDistinctApi(s,o,u.totalElements,i)))c({data:[],isLastPage:i=!0,hasMoreData:o>1,isPaginatedData:a,page:o});else{if(p){if(_.isArray(s)){var h=p.lastIndexOf("[$i]");if(h>-1){var m=p.substr(h+5);n=s.map((function(e){return l.findValueOf(e,m)}))}}else _.isObject(s)&&(n=_.get(s,p));s=n||s}_.isArray(s)||(s=r.getTransformedData(e.datasource,s)),s.length?c({data:s,isLastPage:i,hasMoreData:o>1,isPaginatedData:a,page:o}):c({data:[],isLastPage:i,hasMoreData:o>1,isPaginatedData:a,page:o})}}))},e}(),v=function(){function e(){}return e.prototype.filter=function(t){var n=this,i=t.datasource&&t.datasource.execute(l.DataSource.Operation.IS_UPDATE_REQUIRED,t.hasData);return(!t.isLocalFilter&&(t.dataoptions||t.datasource&&t.datasource.execute(l.DataSource.Operation.IS_API_AWARE)&&t.searchKey&&i)?e.remoteDataProvider.filter(t):e.localDataProvider.filter(t)).then((function(e){return n.updateDataset=t.datasource&&!t.datasource.execute(l.DataSource.Operation.SUPPORTS_CRUD)&&i,n.hasMoreData=e.hasMoreData,n.isLastPage=e.isLastPage,n.page=e.page,n.isPaginatedData=e.isPaginatedData,e}))},e}();v.remoteDataProvider=new g,v.localDataProvider=new f;var y={widgetType:"wm-search",hostClass:"input-group"},b=function(e){function t(t,n,i,o){var a=e.call(this,t,y)||this;a.binddatavalue=i,a.binddataset=o,a.query="",a.page=1,a.allowempty=!1,a.app=n,l.addClass(a.nativeElement,"app-search",!0),a.typeaheadDataSource=r.Observable.create((function(e){a.listenQuery&&(a._defaultQueryInvoked=!1,a._loadingItems=!0,e.next(a.query)),a.lastSelectedIndex&&(a.typeahead._container=void 0)})).pipe(s.filter((function(){return a._loadingItems=!1,0===a.minchars||a.query&&a.query.length>=a.minchars})),s.mergeMap((function(e){return a.getDataSourceAsObservable(e)}))),a.dataProvider=new v;var c=a.datavalue$.subscribe((function(e){var t=_.isArray(e)?e[0]:e;if(null===t||""===t)return a._modelByValue="",a.query=a.queryModel="",void(a._lastResult=void 0);a._unsubscribeDv||(a._defaultQueryInvoked=!1,_.isObject(e)||a.prevDatavalue===e||(a._modelByKey=void 0,a.query=a.queryModel=""),a.updateByDatavalue(e)),a.showClosebtn=""!==a.query}));a.registerDestroyListener((function(){return c.unsubscribe()}));var p=a.dataset$.subscribe((function(){a.startIndex=a.datasetItems.length,a._lastResult=void 0;var e=a.datavalue||a.toBeProcessedDatavalue;l.isDefined(e)&&a.updateByDataset(e)}));return a.registerDestroyListener((function(){return p.unsubscribe()})),a}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}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"datasource",{get:function(){return this._datasource},set:function(e){this._datasource=e;var t=this.datavalue||this.toBeProcessedDatavalue;this.updateByDatavalue(t)},enumerable:!1,configurable:!0}),t.prototype.clearSearch=function(e,t){this.query="",this.onInputChange(e),this.dataProvider.isLastPage=!1,this.listenQuery=!1,t&&(this.listenQuery=!0,this._unsubscribeDv=!1,this.loadMoreData()),this.invokeEventCallback("clearsearch"),this._loadingItems=!1,e&&this.$element.find(".app-search-input").focus()},t.prototype.clearText=function(){this.query="",this.showClosebtn=!1},t.prototype.closeSearch=function(){this._loadingItems=!1,this.page=1,this.insertAtIndex(this.elIndex),this.elIndex=void 0,this.parentEl=void 0,this.$element.removeClass("full-screen"),this._domUpdated&&(this._domUpdated=!1),this.listenQuery=!1,this._unsubscribeDv=!0,this.typeahead.hide()},t.prototype.renderMobileAutoComplete=function(){l.isDefined(this.elIndex)||(this.parentEl=this.$element.parent(),this.elIndex=this.parentEl.children().index(this.$element)),this.$element.hasClass("full-screen")||(this._domUpdated=!0,this.$element.addClass("full-screen"),"inline"===this.position&&this.$element.addClass(this.position)),this.$element.hasClass("full-screen")&&this.$element.find(".app-search-input").focus()},t.prototype.getDataSourceAsObservable=function(e){if(this._lastQuery===e&&!_.get(this.dataoptions,"filterFields")&&l.isDefined(this._lastResult))return this._loadingItems=!1,r.of(this._lastResult);if("autocomplete"===this.type&&this.searchkey&&this.query&&this.datavalue){var t=[],n=_.split(this.searchkey,","),i=void 0;if(this.binddisplaylabel&&1===(t=_.split(this.binddisplaylabel,"+")).length)if(_.includes(t[0],"|"))i=!0;else{i=/\[(.*?)\]/.exec(t[0])[1]}if(t.length>1||i&&!_.includes(n,i)||this.displayexpression&&!_.includes(n,this.displayexpression))return this._loadingItems=!1,r.of([])}return this._lastQuery=this.query,r.from(this.getDataSource(e))},t.prototype.handleEvent=function(t,n,i,o){_.includes(["blur","focus","select","submit","change"],n)||e.prototype.handleEvent.call(this,t,n,i,o)},t.prototype.highlight=function(e,t){if(this.typeaheadContainer)return e.value=e.item.label.toString(),this.typeaheadContainer.highlight(e,t)},t.prototype.insertAtIndex=function(e){0===e?this.parentEl.prepend(this.$element):this.parentEl.children().eq(e).length?this.$element.insertBefore(this.parentEl.children().eq(e)):this.$element.insertAfter(this.parentEl.children().eq(e-1))},t.prototype.isMobileAutoComplete=function(){return"autocomplete"===this.type&&l.isMobile()},t.prototype.isQueryEntered=function(){return this.showclear&&this.showClosebtn},t.prototype.loadMoreData=function(e){this.dataProvider.isLastPage||(this.page=e?this.page+1:this.page,this.isScrolled=!0,this._loadingItems=!0,e&&(this._lastQuery=void 0),this.typeahead.onInput({target:{value:_.trim(this.query)||"0"}}))},t.prototype.onFocusOut=function(){var e=this;this._unsubscribeDv=!1,this._loadingItems=!1,this.page=1,!this._domUpdated&&this._isOpen&&(this.listenQuery=!1,setTimeout((function(){e.typeahead._typeahead.isShown&&e.typeahead.hide()}),200)),this._isOpen=!1,this._domUpdated&&this.typeahead&&this.typeahead._container&&(this.typeahead._container.isFocused=!0)},t.prototype.onInputChange=function(e){this.result=[],this.page=1,this.listenQuery=this.isUpdateOnKeyPress(),this._modelByValue=void 0,""===this.query?(this.queryModel="",this._modelByValue="",this.updatePrevDatavalue(this._lastQuery),this.invokeOnChange(this._modelByValue,{},!0),this.invokeEventCallback("clear",{$event:e}),e&&9!==e.which&&this.invokeEventCallback("submit",{$event:e})):this.invokeEventCallback("change",{$event:e,newVal:this._modelByValue||this.query,oldVal:this.prevDatavalue}),this.showClosebtn=""!==this.query},t.prototype.handleEnterEvent=function(e){_.get(this.typeahead,"matches.length")||this.onSearchSelect(e)},t.prototype.onSearchSelect=function(e){var t,n,i,o=(null===(n=null===(t=this.typeaheadContainer)||void 0===t?void 0:t.active)||void 0===n?void 0:n.value)===this.query;if(this.typeaheadContainer&&this.typeaheadContainer.active&&o&&(i=this.typeaheadContainer.active.item),e=this.eventData(e,i||{}),!this.isUpdateOnKeyPress())return this.listenQuery=!0,void this.typeahead.onInput({target:{value:this.query}});this.typeaheadContainer&&this.liElements.length&&o?this.typeaheadContainer.selectActiveMatch():(this.queryModel=this.query,this.invokeEventCallback("submit",{$event:e}))},t.prototype.invokeOnBeforeServiceCall=function(e){this.invokeEventCallback("beforeservicecall",{inputData:e})},t.prototype.onDropdownOpen=function(){var e=this;if(this.clearData&&this.typeahead.hide(),_.debounce((function(){e._isOpen=!0,e.typeaheadContainer=e.typeahead._container||e.typeahead._typeahead.instance,e.typeaheadContainer.liElements=e.liElements,e.typeaheadContainer.ulElement=e.ulElement,l.adjustContainerPosition($("typeahead-container"),e.nativeElement,e.typeahead._typeahead,$("typeahead-container .dropdown-menu"))}))(),this.isMobileAutoComplete()){this.$element.hasClass("full-screen")||this.renderMobileAutoComplete();var t=this.dropdownEl.closest("typeahead-container");t.insertAfter(this.$element.find("input").first());var n=this.$element.closest(".app-content").height();t.css({position:"relative",top:0,height:n+"px"}),this.showClosebtn=this.query&&""!==this.query,_.isUndefined(this.dataProvider.isLastPage)||this.dataProvider.isLastPage||this.triggerSearch()}},t.prototype.selectNext=function(){var e=this.typeaheadContainer.matches;if(e){var t=e.indexOf(this.typeaheadContainer.active);!this._loadingItems&&!this.dataProvider.isLastPage&&t+1>e.length-1&&(this.lastSelectedIndex=t,this.loadMoreData(!0))}},t.prototype.setLastActiveMatchAsSelected=function(){this.lastSelectedIndex&&(this.typeaheadContainer._active=this.typeaheadContainer.matches[this.lastSelectedIndex],this.typeaheadContainer.nextActiveMatch(),this.lastSelectedIndex=void 0)},t.prototype.triggerSearch=function(){if(!this.dataProvider.isLastPage&&this.$element.hasClass("full-screen")){var e=this.dropdownEl,t=e.find("li").last();t.length&&e.length&&e.height()+e.position().top>t.height()+t.position().top&&this.loadMoreData(!0)}},t.prototype.isUpdateOnKeyPress=function(){return"typing"===this.searchon},t.prototype.debounceDefaultQuery=function(e){var t=this;this._defaultQueryInvoked=!0,this.getDataSource(e,!0).then((function(e){e.length?(t.queryModel=e,t._lastQuery=t.query=t.queryModel[0].label||"",t._modelByValue=t.queryModel[0].value,t._modelByKey=t.queryModel[0].key,t.showClosebtn=""!==t.query):(t._modelByValue=void 0,t.queryModel=void 0,t.query=""),t.clearData&&_.get(t.typeahead,"_typeahead.isShown")&&t.typeahead.hide()}))},t.prototype.updateByDatavalue=function(e){this.updateByDataset(e),this.updateByDataSource(e)},t.prototype.updateByDataSource=function(e){if(l.isDefined(e)&&!_.isObject(e)&&this.datasource&&!l.isDefined(this._modelByKey)&&this.datafield!==a.ALLFIELDS){if(l.isDefined(this.queryModel)&&!_.isEmpty(this.queryModel))return void this.updateDatavalueFromQueryModel();!this._defaultQueryInvoked&&this.datasource.execute(l.DataSource.Operation.SUPPORTS_CRUD)&&this.debounceDefaultQuery(e)}},t.prototype.updateDatavalueFromQueryModel=function(){l.isDefined(this.queryModel)&&(this._modelByValue=_.isArray(this.queryModel)?this.queryModel[0].value:this.queryModel,this._modelByKey=_.isArray(this.queryModel)?this.queryModel[0].key:this.queryModel,this.toBeProcessedDatavalue=void 0)},t.prototype.updateByDataset=function(e){if(!this._defaultQueryInvoked||!this.searchkey){var t=_.find(this.datasetItems,(function(t){return _.isObject(t.value)?_.isEqual(t.value,e):_.toString(t.value).toLowerCase()===_.toString(e).toLowerCase()}));if(t)this.queryModel=[t];else if(this.datafield===a.ALLFIELDS&&_.isObject(e))this.queryModel=this.getTransformedData(a.extractDataAsArray(e));else if(this.prevDatavalue!==e)return this.queryModel=void 0,void(this.query="");this.updateDatavalueFromQueryModel(),this._lastQuery=this.query=l.isDefined(this.queryModel)&&this.queryModel.length?_.get(this.queryModel[0],"label"):"",this.showClosebtn=""!==this.query}},t.prototype.handleFocus=function(e){"search"===this.type&&this.query===this._lastQuery&&this._lastResult&&this.typeahead.keyUpEventEmitter.emit(this.query)},t.prototype.notifySubscriber=function(){var e=$(this.nativeElement).closest(".app-composite-widget.caption-floating");e.length>0&&this.app.notify("captionPositionAnimate",{displayVal:!0,nativeEl:e})},t.prototype.getDataSource=function(e,t,n){var i=this;if(t&&this.datafield===a.ALLFIELDS)return this._loadingItems=!1,Promise.resolve([]);var o={dataset:this.dataset?a.convertDataToObject(this.dataset):void 0,binddataset:this.binddataset,datasource:this.datasource,datafield:this.datafield,hasData:this.dataset&&this.dataset.length,query:e,isLocalFilter:!this.searchkey,searchKey:t?this.datafield:this.searchkey,matchMode:t?"startignorecase":this.matchmode,casesensitive:this.casesensitive,isformfield:this.isformfield,orderby:this.orderby,limit:this.limit,pagesize:this.pagesize,page:this.page,onBeforeservicecall:this.invokeOnBeforeServiceCall.bind(this)};return this.dataoptions&&(o.dataoptions=this.dataoptions,o.viewParent=this.viewParent),this._loadingItems=!0,this.dataProvider.filter(o).then((function(e){e=e.data||e,l.isDefined(i.dataset)&&i.dataset.length||!i.dataProvider.updateDataset||(i.dataset=e),i.dataProvider.hasMoreData?i.formattedDataset=i.formattedDataset.concat(e):i.formattedDataset=e,i.formattedDataset.length>20&&!l.isDefined(i.limit)&&(i.typeahead.typeaheadOptionsLimit=i.formattedDataset.length),i._isOpen&&i.isMobileAutoComplete()&&!_.isUndefined(i.dataProvider.isLastPage)&&!i.dataProvider.isLastPage&&i.triggerSearch();var t=i.getTransformedData(i.formattedDataset,n);return i.result=_.map(t,"value"),t}),(function(e){return i._loadingItems=!1,[]})).then((function(t){return i.isScrolled&&(_.debounce((function(){i.setLastActiveMatchAsSelected()}),30)(),i.isScrolled=!1),t.length||(i._modelByValue=void 0,i.queryModel=e),i._unsubscribeDv&&(t=[]),i._loadingItems=!1,i._lastResult=t,t}))},t.prototype.getContext=function(e){return e&&_.get(e,"widget")?this.getContext(e.viewParent):e},t.prototype.getTransformedData=function(e,t,n){l.isDefined(t)&&t++;var i=a.transformFormData(this.getContext(this.viewParent),e,this.datafield,{displayField:this.displaylabel||this.displayfield,displayExpr:n?"":this.displayexpression,bindDisplayExpr:n?"":this.binddisplaylabel,bindDisplayImgSrc:this.binddisplayimagesrc,displayImgSrc:this.displayimagesrc},t,this);return a.getUniqObjsByDataField(i,this.datafield,this.displayfield||this.displaylabel,l.toBoolean(this.allowempty))},t.prototype.onScroll=function(e,t){var n=e.scrollHeight,i=e.clientHeight;!this._loadingItems&&!this.dataProvider.isLastPage&&e.scrollTop+i>=n&&this.loadMoreData(!0)},t.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),l.isDefined(this.minchars)||("autocomplete"===this.type?this.minchars=0:this.minchars=1),this.listenQuery=this.isUpdateOnKeyPress(),this.showsearchicon=l.isDefined(this.showsearchicon)?this.showsearchicon:"search"===this.type},t.prototype.ngAfterViewInit=function(){e.prototype.ngAfterViewInit.call(this),a.styler(this.nativeElement,this),this.containerTarget=a.getContainerTargetClass(this.nativeElement)},t.prototype.eventData=function(e,t){return e&&(e.data={item:t.dataObject,model:t.value,label:t.label,query:this.query}),e},t.prototype.typeaheadOnSelect=function(e,t){var n=e.item;this.queryModel=n,n.selected=!0,this.query=n.label,this.showClosebtn=""!==this.query,t=t||this.$typeaheadEvent,this._modelByKey=n.key,this._modelByValue=n.value,t=this.eventData(t,n),this.invokeOnTouched(),this.invokeOnChange(this.datavalue,t||{}),this.datavalue!==this.prevDatavalue&&this.updateBoundVariable(this.datavalue),this.$element.hasClass("full-screen")&&this.closeSearch(),this.invokeEventCallback("select",{$event:t,selectedValue:this.datavalue}),this.invokeEventCallback("submit",{$event:t}),this.updatePrevDatavalue(this.datavalue)},t.prototype.onPropertyChange=function(t,n,i){"tabindex"!==t&&("autocomplete"===this.type&&"displaylabel"===t&&this.displaylabel&&(!this.displayexpression||this.displayexpression&&!this.datasource)&&(this.displayexpression=this.displaylabel,this.displaylabel=void 0),"displaylabel"===t&&this.dataoptions&&null===this.binddisplaylabel&&(this.query=_.get(this._modelByValue,n)||this._modelByValue),"disabled"===t&&(!1===n?this.clearData=!1:(this.clearData=!0,_.get(this.typeahead,"_typeahead.isShown")&&this.typeahead.hide())),e.prototype.onPropertyChange.call(this,t,n,i))},t}(c.DatasetAwareFormComponent);b.initializeProps=m(),b.decorators=[{type:t.Component,args:[{selector:"[wmSearch]",template:'<ng-template #customItemTemplate let-model="item" let-index="index" let-query="query" let-match="match">\n \x3c!-- Default item template --\x3e\n <a *ngIf="!content">\n <img *ngIf="model.imgSrc" [src]="model.imgSrc" alt="Search" [style.width]="imagewidth">\n <span [title]="model.label" [innerHtml]="highlight(match, query) || model.label"></span>\n </a>\n \x3c!-- Custom partial template --\x3e\n <a *ngIf="content" [ngClass]="{customTemplate: content}" partialContainer [wmItemTemplate]="content" [userComponentParams]="match.item">\n <div partial-container-target></div>\n </a>\n</ng-template>\n\n<ng-template #customListTemplate let-matches="matches" let-itemTemplate="itemTemplate" let-query="query">\n <ul #ulElement class="app-search dropdown-menu" scrollable>\n <li #liElements *ngFor="let match of matches" [ngClass]="{active: typeaheadContainer && typeaheadContainer.isActive(match), \'list-group-header\': match && match.isHeader()}"\n (mouseenter)="typeaheadContainer.selectActive(match);"\n (click)="match && !match.isHeader() && typeaheadContainer.selectMatch(match, $event); $typeaheadEvent = $event; notifySubscriber();">\n \x3c!-- itemTemplate comes from the <input> --\x3e\n <h4 *ngIf="match.isHeader()" class="group-title">{{match.value}}</h4>\n <ng-container *ngIf="!match.isHeader()" [ngTemplateOutlet]="itemTemplate"\n [ngTemplateOutletContext]="{item: match.item, index: i, match: match, query: query}">\n </ng-container>\n </li>\n <div class="status" [hidden]="_loadingItems || !(datacompletemsg && dataProvider.isLastPage)">\n <span [textContent]="datacompletemsg"></span>\n </div>\n <div class="status" [hidden]="!_loadingItems">\n <i class="fa fa-circle-o-notch fa-spin"></i>\n <span [textContent]="loadingdatamsg"></span>\n </div>\n </ul>\n</ng-template>\n\n\x3c!--This template is for search inside mobile navbar.--\x3e\n<ng-container *ngIf="navsearchbar; else searchTemplate">\n <input [title]="query || \'\'" type="text" class="app-textbox form-control list-of-objs app-search-input" [placeholder]="placeholder || \'\'"\n focus-target\n container="body"\n [disabled]="disabled"\n autocomplete="off"\n [(ngModel)]="query"\n [readonly]="readonly"\n [disabled]="disabled"\n [typeahead]="typeaheadDataSource"\n [typeaheadWaitMs]="debouncetime"\n [typeaheadItemTemplate]="customItemTemplate"\n [optionsListTemplate]="customListTemplate"\n (input)="onInputChange($event)"\n (keydown)="listenQuery = true"\n (keydown.enter)="$typeaheadEvent = $event;handleEnterEvent($event)"\n (keydown.arrowdown)="selectNext($event)"\n (blur)="invokeOnTouched($event)"\n (click)="handleFocus($event);"\n (focus)="_unsubscribeDv = false; listenQuery = true; handleFocus($event); invokeOnFocus($event);"\n (focusout)="onFocusOut()"\n [typeaheadMinLength]="minchars"\n [typeaheadOptionsLimit]="limit"\n (typeaheadLoading)="_loadingItems"\n (typeaheadOnSelect)="typeaheadOnSelect($event)"\n typeaheadOptionField="label"\n [typeaheadGroupField]="groupby ? \'groupby\' : null"\n [typeaheadAsync]="true"\n [typeaheadScrollable]="true"\n [typeaheadOptionsInScrollableView]="optionslimitinscrollableview"\n [dropup]="dropup"\n [tabindex]="tabindex"\n [attr.name]="name"\n [attr.aria-label]="hint || \'Search field\'"/>\n <i class="btn-close wi wi-cancel" [hidden]="!showClosebtn" (click)="clearSearch($event);"></i>\n</ng-container>\n\x3c!--This template is for both web and fullscreen mode in mobile.--\x3e\n<ng-template #searchTemplate>\n <span class="wi wi-arrow-left form-control-feedback back-btn" aria-hidden="true" (click)="closeSearch()"></span>\n <span class="sr-only">Back button</span>\n <input [title]="query || \'\'" type="text" class="app-textbox form-control list-of-objs app-search-input" [placeholder]="placeholder || \'\'"\n focus-target\n [container]="containerTarget || \'body\'"\n [disabled]="disabled"\n autocomplete="off"\n [(ngModel)]="query"\n [readonly]="readonly"\n [typeahead]="typeaheadDataSource"\n [typeaheadWaitMs]="debouncetime"\n [typeaheadItemTemplate]="customItemTemplate"\n [optionsListTemplate]="customListTemplate"\n (input)="onInputChange($event)"\n (keydown)="listenQuery = true"\n (keydown.enter)="$typeaheadEvent = $event;handleEnterEvent($event)"\n (keydown.arrowdown)="selectNext($event)"\n (blur)="invokeOnTouched($event); onFocusOut()"\n (click)="handleFocus($event);"\n (focus)="_unsubscribeDv = false; listenQuery = true; handleFocus($event); invokeOnFocus($event)"\n [typeaheadMinLength]="minchars"\n [typeaheadOptionsLimit]="limit"\n (typeaheadLoading)="_loadingItems"\n (typeaheadOnSelect)="typeaheadOnSelect($event)"\n typeaheadOptionField="label"\n [typeaheadGroupField]="groupby ? \'groupby\' : null"\n [typeaheadAsync]="true"\n [typeaheadScrollable]="true"\n [typeaheadOptionsInScrollableView]="optionslimitinscrollableview"\n [tabindex]="tabindex"\n [dropup]="dropup"\n [attr.name]="name"\n [attr.aria-label]="hint || \'Search field\'">\n <input class="model-holder" ng-model="proxyModel" ng-required="required" tabindex="-1" aria-hidden="true">\n <span *ngIf="_loadingItems" aria-hidden="true" class="fa fa-circle-o-notch fa-spin form-control-feedback"></span>\n <span class="wi wi-close form-control-feedback clear-btn" [ngClass]="{\'show-btn\': isQueryEntered()}" (click)="clearSearch($event, true)"></span>\n <span class="sr-only">Clear button</span>\n <span *ngIf="showsearchicon" class="input-group-addon" aria-label="search icon" [ngClass]="{\'disabled\': disabled}">\n <form>\n <button title="Search" [disabled]="disabled" class="app-search-button wm-sl-l sl-search" type="submit"\n (click)="onSearchSelect($event)"></button>\n </form>\n </span>\n</ng-template>\n',providers:[a.provideAs(b,i.NG_VALUE_ACCESSOR,!0),a.provideAs(b,i.NG_VALIDATORS,!0),a.provideAsWidgetRef(b)]}]}],b.ctorParameters=function(){return[{type:t.Injector},{type:l.App},{type:void 0,decorators:[{type:t.Attribute,args:["datavalue.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["dataset.bind"]}]}]},b.propDecorators={typeahead:[{type:t.ViewChild,args:[o.TypeaheadDirective]}],ulElement:[{type:t.ViewChild,args:["ulElement"]}],liElements:[{type:t.ViewChildren,args:["liElements"]}]};var w=function(){function e(e,n){this.searchRef=n,this.elementRef=e.get(t.ElementRef)}return e.prototype.ngAfterContentInit=function(){this.elementRef.nativeElement.addEventListener("scroll",this.notifyParent.bind(this)),this.searchRef.dropdownEl=$(this.elementRef.nativeElement),this.searchRef.onDropdownOpen()},e.prototype.ngAfterViewInit=function(){if(!this.searchRef.isMobileAutoComplete()){var e=this.searchRef.$element.find("input").first();this.searchRef.dropdownEl.width(e.outerWidth())}},e.prototype.notifyParent=function(e){this.searchRef.onScroll(this.elementRef.nativeElement,e)},e}();w.decorators=[{type:t.Directive,args:[{selector:"[scrollable]"}]}],w.ctorParameters=function(){return[{type:t.Injector},{type:b}]};var P=[b,w],O=function(){};O.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.FormsModule,o.TypeaheadModule,a.WmComponentsModule],declarations:u([],d(P)),exports:u([],d(P)),entryComponents:[]}]}],e.ScrollableDirective=w,e.SearchComponent=b,e.SearchModule=O,e["\u0275a"]=m,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/core")):"function"==typeof define&&define.amd?define("@wm/components/basic/tree",["exports","@angular/core","@angular/common","@wm/components/base","@wm/core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.basic=e.wm.components.basic||{},e.wm.components.basic.tree={}),e.ng.core,e.ng.common,e.wm.components.base,e.wm.core)}(this,(function(e,t,n,i,o){"use strict";
114
114
  /*! *****************************************************************************
115
115
  Copyright (c) Microsoft Corporation.
116
116
 
@@ -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 o=function(e,t){return(o=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 a(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 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){var n=e.call(this,t,c)||this;return n.setting={data:{simpleData:{enable:!0}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(n.nativeElement,n,i.APPLY_STYLES_TYPE.CONTAINER),n}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}o(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);break;case"treeicons":this.treeicon=n;break;case"nodelabel":this.nodelabel=n;break;case"icon":this.nodeicon=n;case"orderby":this.renderTree();break;case"class":this.treeClass=n;break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){"children"in t&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,t.children,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{name: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){if(e.children&&a.setNodeData(e.children,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){return e.children&&n>1&&(t===n&&(i=e),a.setNodeData(e.children,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.name+t:this.getPath(e.getParentNode(),t)+"/"+e.name},t.prototype.onClick=function(e,t,n,i){$.fn.zTree.getZTreeObj(""+this.name);var o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("select",o)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o),n.children&&n.children.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||p),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||p)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.modifyObjects=function(e){var t=this;return e.forEach((function(e){void 0!==e.label&&(e.name=e.label,delete e.label),void 0!==e.children&&t.modifyObjects(e.children)})),e},t.prototype.setNodeChildren=function(e,t,n,i){if(t<=0)return e;for(var o=0;o<e.length;o++){var a=e[o];if(t===n&&(i=e[o]),a.children&&a.children.length>0){if(1===n)return void(i.children=a.children.map((function(e){return{name:e.name,children:null==e?void 0:e.children}})));this.setNodeChildren(a.children,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 r=a(i),s=r.next();!s.done;s=r.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(console.log(this.nodes,"this.nodes"),this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodes=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||p)},t.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){e.changeTreeIcons(e.treeicon||p)}),200)},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}]};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";
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){var n=e.call(this,t,p)||this;return n.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(n.nativeElement,n,i.APPLY_STYLES_TYPE.CONTAINER),n}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);break;case"treeicons":this.treeicon=n;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;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{name: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)}var a={$event:e,$item:n,$path:this.getPath(n,"")};this.setSelectedItem(n),this.invokeEventCallback("select",a)},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.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren||"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel||"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return 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)},t.prototype.setSelectedItem=function(e){this.selecteditem=o.getClonedObject(e)||{},this.selecteditem.path=this.getPath(e,""),$("li[treenode].selected").removeClass("selected"),$("#"+e.tId+":has(.curSelectedNode)").addClass("selected")},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.ngAfterViewInit=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||d),e.datavalue){var t=e.treeObj.getNodes(),n=void 0;"FirstNode"===e.datavalue&&t.length&&(n=t[0]),"LastNode"===e.datavalue&&t.length&&(n=t[t.length-1]),e.treeObj.selectNode(n,!1),e.setSelectedItem(n),e.expandNode(n,!0,!1)}}),200)},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}]};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";
128
128
  /*! *****************************************************************************
129
129
  Copyright (c) Microsoft Corporation.
130
130