@wavemaker/app-runtime-wm-build 11.3.5-next.25069 → 11.4.0-next.140410
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.
|
@@ -44707,7 +44707,7 @@
|
|
|
44707
44707
|
ListComponent.prototype.handleKeyDown = function($event, action) {
|
|
44708
44708
|
var _this = this;
|
|
44709
44709
|
$event.stopPropagation();
|
|
44710
|
-
if ($event.keyCode !== 13 && $event.keyCode !== 9 && !(
|
|
44710
|
+
if ($event.keyCode !== 13 && $event.keyCode !== 9 && !($event.target.classList.contains("form-control") && $event.keyCode === 32)) {
|
|
44711
44711
|
$event.preventDefault();
|
|
44712
44712
|
}
|
|
44713
44713
|
var listItems = this.listItems;
|
|
@@ -503,7 +503,7 @@ var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
503
503
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
504
504
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
505
505
|
PERFORMANCE OF THIS SOFTWARE.
|
|
506
|
-
***************************************************************************** */var c=function(e,t){return(c=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 p(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}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}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=function(){i.register("wm-list",new Map([["boundarylinks",Object.assign({value:!1},i.PROP_BOOLEAN)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dateformat",i.PROP_STRING],["dataset",i.PROP_ANY],["datasource",i.PROP_ANY],["direction",Object.assign({value:"vertical"},i.PROP_STRING)],["directionlinks",Object.assign({value:!0},i.PROP_BOOLEAN)],["disableitem",i.PROP_BOOLEAN],["enablereorder",i.PROP_BOOLEAN],["forceellipses",Object.assign({value:!0},i.PROP_BOOLEAN)],["groupby",i.PROP_STRING],["iconclass",i.PROP_STRING],["itemclass",Object.assign({value:""},i.PROP_STRING)],["itemsperrow",i.PROP_STRING],["listclass",Object.assign({value:"list-group"},i.PROP_STRING)],["multiselect",i.PROP_BOOLEAN],["loadingdatamsg",Object.assign({value:"Loading..."},i.PROP_STRING)],["loadingicon",Object.assign({value:"fa fa-circle-o-notch"},i.PROP_STRING)],["match",i.PROP_STRING],["maxsize",Object.assign({value:5},i.PROP_NUMBER)],["name",i.PROP_STRING],["navigation",i.PROP_STRING],["navigationalign",Object.assign({value:"left"},i.PROP_STRING)],["nodatamessage",Object.assign({value:"No data found"},i.PROP_STRING)],["ondemandmessage",Object.assign({value:"Load More"},i.PROP_STRING)],["orderby",i.PROP_STRING],["paginationclass",i.PROP_STRING],["pagesize",i.PROP_NUMBER],["pulltorefresh",Object.assign({value:a.isMobileApp()},i.PROP_BOOLEAN)],["selectfirstitem",i.PROP_BOOLEAN],["selectionlimit",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showcount",i.PROP_BOOLEAN],["showrecordcount",i.PROP_BOOLEAN],["statehandler",Object.assign({value:"none"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]))},m=function(){function e(e,t,n){this.inj=e,this.app=n,this.destroy=new s.Subject,this.destroy$=this.destroy.asObservable(),this.itemClass="",this._currentItemWidgets={},this.isActive=!1,this.disableItem=!1,this.nativeElement=t.nativeElement,this.listComponent=e.view.component,this.context=e.view.context,this.itemClassWatcher(this.listComponent),this.disableItemWatcher(this.listComponent),$(this.nativeElement).data("listItemContext",this)}return e.prototype.onFocus=function(){this.listComponent.lastSelectedItem=this},Object.defineProperty(e.prototype,"$index",{get:function(){return this.context.index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$even",{get:function(){return this.context.even},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$odd",{get:function(){return this.context.odd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$first",{get:function(){return this.context.first},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$last",{get:function(){return this.context.last},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentItemWidgets",{get:function(){var e=Array.from(this.nativeElement.querySelectorAll("[widget-id]"));return Object.assign(this._currentItemWidgets,e.reduce((function(e,t){return e[t.widget.name]=t.widget,e}),{}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wmListItem",{set:function(e){this.item=e},enumerable:!1,configurable:!0}),e.prototype.registerWatch=function(e,t){this.destroy$.subscribe(a.$watch(e,this.listComponent.viewParent,this,t))},e.prototype.itemClassWatcher=function(e){var t=this;e.binditemclass?this.registerWatch(e.binditemclass,(function(e){return t.itemClass=e||""})):this.itemClass=e.itemclass},e.prototype.disableItemWatcher=function(e){var t=this;e.binddisableitem?this.registerWatch(e.binddisableitem,(function(e){return t.disableItem=e||!1})):this.disableItem=e.disableitem||!1},e.prototype.setUpCUDHandlers=function(){var e=this,t=this.nativeElement.querySelector(".edit-list-item"),n=this.nativeElement.querySelector(".delete-list-item");t&&t.addEventListener("click",(function(t){e.listComponent.update()})),n&&n.addEventListener("click",(function(t){e.listComponent.delete()}))},e.prototype.ngOnInit=function(){var e=this;this.listComponent.mouseEnterCB&&this.nativeElement.addEventListener("mouseenter",(function(t){e.listComponent.invokeEventCallback("mouseenter",{widget:e,$event:t})})),this.listComponent.mouseLeaveCB&&this.nativeElement.addEventListener("mouseleave",(function(t){e.listComponent.invokeEventCallback("mouseleave",{widget:e,$event:t})})),$(this.nativeElement).attr("listitemindex",this.$index)},e.prototype.ngAfterViewInit=function(){this.setUpCUDHandlers()},e}();m.decorators=[{type:t.Directive,args:[{selector:"[wmListItem]",exportAs:"listItemRef"}]}],m.ctorParameters=function(){return[{type:t.Injector},{type:t.ElementRef},{type:a.App}]},m.propDecorators={isActive:[{type:t.HostBinding,args:["class.active"]}],disableItem:[{type:t.HostBinding,args:["class.disable-item"]}],onFocus:[{type:t.HostListener,args:["focus"]}],wmListItem:[{type:t.Input}]};var f=function(e){function t(t){var n=e.call(this)||this;return n.list=t,n.$el=$(n.list.getNativeElement()).find("ul.app-livelist-container").first(),n.leftChildrenCount=n.$el.find(">.app-list-item-left-action-panel > button:visible").length,n.rightChildrenCount=n.$el.find(">.app-list-item-right-action-panel > button:visible").length,n.leftChildrenCount||n.rightChildrenCount?(n.init(n.$el),n.$btnSubscription=n.list.btnComponents.changes.subscribe((function(e){return n.actionItems=e})),n):n}return p(t,e),t.prototype.createActionPanel=function(e,t){return t.css({width:e.outerWidth()+"px",height:e.outerHeight()+"px",marginBottom:-1*e.outerHeight()+"px",float:"left",padding:0}),t.insertBefore(e)},t.prototype.computeTotalChildrenWidth=function(e){return _.reduce(e.children(),(function(e,t){return e+$(t).outerWidth()}),0)},t.prototype.computeTransitionProportions=function(e){var t=this.computeTotalChildrenWidth(e),n="right"===this.position,i=0;return _.map(e.children(),(function(e){var o=(t-i)/t;return i+=$(e).outerWidth(),n?o:i/t}))},t.prototype.resetElement=function(e){e&&e.css({transform:"none",transition:"none"})},t.prototype.resetState=function(){this.resetElement(this.li),this.resetElement(this.actionPanel),this.actionPanel&&(this.actionPanel=null)},t.prototype.getChildActionElement=function(e){if(e.children().length)return"left"===this.position?e.children().first():e.children().last()},t.prototype.initActionPanel=function(e){this.actionPanel=this.createActionPanel(this.li,e),this.actionPanel.css({backgroundColor:this.getChildActionElement(this.actionPanel).css("background-color")}),this.limit=this.computeTotalChildrenWidth(this.actionPanel),this.transitionProportions=this.computeTransitionProportions(this.actionPanel)},t.prototype.bounds=function(e,t){var n=$(e.target).closest("li"),i={strictUpper:!0,strictLower:!0,lower:0,center:0,upper:0};if(!n.hasClass("app-list-item"))return i;if(this.li&&this.li[0]===n[0])"left"===this.position?i={strictUpper:!1,lower:-this.limit,center:this.limit}:"right"===this.position&&(i={center:-this.limit,upper:this.limit,strictLower:!1});else{var o=t>0?".app-list-item-left-action-panel":".app-list-item-right-action-panel",a=this.$el.find(">"+o);if(!a.length&&this.list.groupby&&(o="li > ul.list-group >"+o,a=this.$el.find(">"+o)),!a.length||!a.find("button:visible").length)return i;this.resetState(),this.li=n,this.position=a.attr("position"),this.initActionPanel(a),i=t>0?{strictUpper:!1,lower:0,center:0,upper:this.limit}:{strictLower:!1,lower:-this.limit,center:0,upper:0}}return i},t.prototype.context=function(){var e=this;return{computeActionTransition:function(t,n){var i=n>0?1:-1;return i*n>e.limit?n-i*e.limit+e.transitionProportions[t]*i*e.limit:e.transitionProportions[t]*n}}},t.prototype.animation=function(){var e=this;return[{target:function(){return e.li},css:{transform:"translate3d(${{$D + $d}}px, 0, 0)"}},{target:function(){return e.actionPanel&&e.actionPanel.children()},css:{transform:"translate3d(${{computeActionTransition($i, $D + $d)}}px, 0, 0)"}}]},t.prototype.invokeFullSwipeEvt=function(e){var t,n,i;"left"===this.position?(n=this.actionItems.filter((function(e){return"left"===e.getAttr("swipe-position")&&e.$element.is(":visible")})),i=0):i=(n=this.actionItems.filter((function(e){return"right"===e.getAttr("swipe-position")&&e.$element.is(":visible")}))).length-1,(t=n[i])&&t.hasEventCallback("tap")&&t.invokeEventCallback("tap",{$event:e}),this.resetState(),this.li=null},t.prototype.onAnimation=function(e,t){if(this.list.triggerListItemSelection(this.li,e),this.actionPanel&&"true"===this.actionPanel.attr("enablefullswipe")){var n=t>0?1:-1,i=this.getChildActionElement(this.actionPanel);if(i){var o="right"===this.position?this.rightChildrenCount-1:0;this.transitionProportions[o]*n*t*100/(this.li.outerWidth()-this.limit+i.width())>50&&this.invokeFullSwipeEvt(e)}}},t.prototype.onLower=function(){"left"===this.position&&(this.resetState(),this.li=null)},t.prototype.onUpper=function(){"right"===this.position&&(this.resetState(),this.li=null)},t.prototype.threshold=function(){return 10},t}(l.SwipeAnimation),g={widgetType:"wm-list",hostClass:"app-livelist app-panel"},v=function(e){function t(t,n,o,r,s,l,c,p,d,u,h,m,f,v){var y=this,b=a.noop,w=new Promise((function(e){return b=e}));return(y=e.call(this,t,g,w)||this).propsInitPromise=w,y.promiseResolverFn=b,i.styler(y.nativeElement,y,i.APPLY_STYLES_TYPE.SHELL),y.cdRef=n,y.ngZone=l,y.datePipe=o,y.statePersistence=f,y.paginationService=v,y._pageLoad=!0,y.binditemclass=c,y.binddisableitem=p,y.binddataset=d,y.mouseEnterCB=h,y.mouseLeaveCB=m,y.binddatasource=u,y.app=r,y.appDefaults=s,y.variableInflight=!1,y.noDataFound=!d,y.titleId="wmlist-"+a.generateGUId(),y._listenerDestroyers=[y.app.subscribe("check-state-persistence-options",(function(e){var t=_.get(y.datasource,"name");t||(t=i.extractDataSourceName(y.binddatasource)),_.get(e,"variable.name")===t&&y.handleStateParams(e)})),y.app.subscribe("toggle-variable-state",y.handleLoading.bind(y)),y.app.subscribe("setup-cud-listener",(function(e){y.nativeElement.getAttribute("name")===e&&(y._isDependent=!0)}))],y}return p(t,e),Object.defineProperty(t.prototype,"selecteditem",{get:function(){return this.multiselect?a.getClonedObject(this._items):_.isEmpty(this._items)?{}:a.getClonedObject(this._items[0])},set:function(e){var t=this;this._items.length=0,this.deselectListItems(),_.isArray(e)?e.forEach((function(e){return t.selectItem(e)})):this.selectItem(e),a.$appDigest()},enumerable:!1,configurable:!0}),t.prototype.getWidgets=function(e,t){var n,i=[];if(e)return a.isDefined(t)?(t=+t||0,(n=_.get(this.listItems.toArray(),t))?[_.get(n.currentItemWidgets,e)]:void 0):(_.forEach(this.listItems.toArray(),(function(t){(n=_.get(t.currentItemWidgets,e))&&i.push(n)})),i)},t.prototype.getItem=function(e){return this.getListItemByIndex(e)},t.prototype.getIndex=function(e){return e instanceof m?this.getListItemIndex(e):e?this.fieldDefs.findIndex((function(t){return _.isEqual(t,e)})):void 0},t.prototype.getConfiguredState=function(){var e=this.statePersistence.computeMode(this.statehandler);return e&&e.toLowerCase()},t.prototype.handleStateParams=function(e){if(this._pageLoad&&"none"!==this.getConfiguredState()){this._pageLoad=!1;var t=this.statePersistence.getWidgetState(this);_.get(t,"pagination")&&(e.options=e.options||{},e.options.page=t.pagination),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}},t.prototype.triggerWMEvent=function(e,t){a.$invokeWatchers(!0);var n=this.multiselect?_.last(this.selecteditem):this.selecteditem;t&&(n=t),this.app.notify("wm-event",{eventName:e,widgetName:this.name,row:n})},t.prototype.create=function(){this._isDependent&&this.triggerWMEvent("insert")},t.prototype.editRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("update",t)}},t.prototype.update=function(e){this.editRow(e)},t.prototype.deleteRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("delete",t)}},t.prototype.delete=function(e){this.deleteRow(e)},t.prototype.handleLoading=function(e){var t=this,n=this.datasource;n&&n.execute(a.DataSource.Operation.IS_API_AWARE)&&a.isDataSourceEqual(e.variable,n)&&this.ngZone.run((function(){var n,i,o;t.handleStateParams(e),t.variableInflight=e.active;var a=null===(i=null===(n=e.data)||void 0===n?void 0:n.pagination)||void 0===i?void 0:i.totalElements;_.isUndefined(a)?t.noDataFound=_.isEmpty(null===(o=e.data)||void 0===o?void 0:o.data):t.noDataFound=0===a}))},t.prototype.resetNavigation=function(){this.showNavigation=!1,this.navControls=void 0,this.infScroll=!1,this.onDemandLoad=!1},t.prototype.enableBasicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.BASIC,this.showNavigation=!0},t.prototype.enableInlineNavigation=function(){this.navControls=i.NAVIGATION_TYPE.INLINE},t.prototype.enableClassicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.CLASSIC,this.showNavigation=!0},t.prototype.enablePagerNavigation=function(){this.navControls=i.NAVIGATION_TYPE.PAGER,this.showNavigation=!0},t.prototype.setNavigationTypeNone=function(){this.navControls=i.NAVIGATION_TYPE.NONE,this.showNavigation=!1},t.prototype.enableInfiniteScroll=function(){this.infScroll=!0},t.prototype.enableOnDemandLoad=function(){this.onDemandLoad=!0,this.showNavigation=!0},t.prototype.onNavigationTypeChange=function(e){switch(this.resetNavigation(),e){case i.NAVIGATION_TYPE.BASIC:this.enableBasicNavigation();break;case i.NAVIGATION_TYPE.INLINE:this.enableInlineNavigation();break;case i.NAVIGATION_TYPE.ADVANCED:case i.NAVIGATION_TYPE.CLASSIC:this.enableClassicNavigation();break;case i.NAVIGATION_TYPE.PAGER:this.enablePagerNavigation();break;case i.NAVIGATION_TYPE.NONE:this.setNavigationTypeNone();break;case i.NAVIGATION_TYPE.SCROLL:this.enableInfiniteScroll();break;case i.NAVIGATION_TYPE.ONDEMAND:this.enableOnDemandLoad()}},t.prototype.updateFieldDefs=function(e){var t;this.infScroll||this.onDemandLoad?(t=d(this.paginationService.updateFieldsOnPagination(this,e),2),this.fieldDefs=t[0],this.currentPage=t[1]):this.fieldDefs=e,this.orderby&&(this.fieldDefs=i.getOrderedDataset(this.fieldDefs,this.orderby)),this.groupby&&(this.groupedData=i.groupData(this,this.fieldDefs,this.groupby,this.match,this.orderby,this.dateformat,this.datePipe,void 0,this.appDefaults)),this.fieldDefs.length||(this.noDataFound=!0,this.selecteditem=void 0),a.$appDigest(),this.listItems.setDirty()},t.prototype.onDataChange=function(e){_.isEmpty(e)?this.updateFieldDefs([]):(this.noDataFound=!1,this.isDataChanged=!0,this.datasource&&this.datasource.execute(a.DataSource.Operation.IS_API_AWARE)&&(e=_.cloneDeep(e)),a.isObject(e)&&!_.isArray(e)&&(e=_.isEmpty(e)?[]:[e]),_.isString(e)&&(e=e.split(",")),this.datasource&&"App"===this.datasource.owner&&(this.infScroll||this.onDemandLoad)&&!this.currentPage&&this.datasource.execute(a.DataSource.Operation.GET_PAGING_OPTIONS).number>0&&(e=this.datasource.execute(a.DataSource.Operation.LIST_RECORDS,{page:1})),_.isArray(e)&&(e.length&&this.invokeEventCallback("beforedatarender",{$data:e}),this.updateFieldDefs(e)))},t.prototype.setupDataSource=function(){var e=this,t=this.dataNavigator;t.options={maxResults:this.pagesize||20},this.dataNavigatorWatched=!0,this.navigatorResultWatch&&this.navigatorResultWatch.unsubscribe(),this.navigatorResultWatch=t.resultEmitter.subscribe((function(t){e.onDataChange(t)}),!0),this.navigatorMaxResultWatch&&this.navigatorMaxResultWatch.unsubscribe(),this.navigatorMaxResultWatch=t.maxResultsEmitter.subscribe((function(t){e.pagesize=t})),t.maxResults=this.pagesize||20,this.removePropertyBinding("dataset");var n=this.getAttr("datasetboundexpr");this.dataNavigator.setBindDataSet(this.binddataset,this.viewParent,n?this.context:this.datasource,this.dataset,this.binddatasource,n,this.statehandler)},t.prototype.onDataSetChange=function(e){if("wm.Variable"===_.get(this.datasource,"category")&&"none"!==this.getConfiguredState()&&this._pageLoad){var t=this.statePersistence.getWidgetState(this);this._pageLoad=!1,_.get(t,"pagination")&&this.dataNavigator.pageChanged({page:t.pagination},!0),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}this.dataNavigatorWatched?this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE&&this.dataNavigator.setDataSource(this.datasource):this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE?this.setupDataSource():this.onDataChange(e)},t.prototype.deselectListItems=function(){this.listItems.forEach((function(e){return e.isActive=!1}))},t.prototype.clearSelectedItems=function(){this.deselectListItems(),this._items.length=0,a.$appDigest()},t.prototype.getListItemByModel=function(e){var t=this;return this.listItems.find((function(n){var i=n.item;if(t.groupby&&!_.has(e,"_groupIndex")&&delete(i=_.clone(i))._groupIndex,_.isEqual(i,e))return!0}))||null},t.prototype.updateSelectedItemsWidgets=function(e){var t,n=this,o={},a=_.get(this.dataNavigator,"dn.currentPage")||1;"none"!==this.getConfiguredState()&&(t=this.statePersistence.getWidgetState(this)||{},_.get(t,"selectedItem")&&(this.multiselect&&1===this.selecteditem.length?t.selectedItem=[]:_.remove(t.selectedItem,(function(e){return e.page===a})))),this.multiselect&&(this.selectedItemWidgets.length=0),this.listItems.forEach((function(e,i){e.isActive&&(n.multiselect?n.selectedItemWidgets.push(e.currentItemWidgets):n.selectedItemWidgets=e.currentItemWidgets,o={page:a,index:i},_.get(t,"selectedItem")&&n.multiselect?_.some(t.selectedItem,o)||t.selectedItem.push(o):t.selectedItem=[o])})),"none"===this.getConfiguredState()||e||(i.unsupportedStatePersistenceTypes.indexOf(this.navigation)<0?(this.statePersistence.removeWidgetState(this,"selectedItem"),this.statePersistence.setWidgetState(this,{selectedItem:t.selectedItem})):console.warn("Retain State handling on Widget "+this.name+" is not supported for current pagination type."))},t.prototype.toggleListItemSelection=function(e,t){if(e&&!e.disableItem){var n=e.item;this.groupby&&_.has(n,"_groupIndex")&&delete(n=_.clone(n))._groupIndex,e.isActive?(this._items=_.pullAllWith(this._items,[n],_.isEqual),e.isActive=!1):(this.multiselect||this.clearSelectedItems(),this._items.push(n),this.invokeEventCallback("select",{widget:e,$data:n}),e.isActive=!0),this.updateSelectedItemsWidgets(t)}},t.prototype.onListRender=function(e){var t=this;if(this.isDataChanged&&(a.$invokeWatchers(!0),this.invokeEventCallback("render",{$data:this.fieldDefs})),this.isDataChanged&&"none"!==this.getConfiguredState()&&e.length&&this._selectedItemsExist){var n=this.statePersistence.getWidgetState(this);if(_.get(n,"selectedItem")){this._selectedItemsExist=!1;var o=_.isArray(this.selecteditem)?this.selecteditem.length:_.toNumber(!_.isEmpty(this.selecteditem)),r=_.get(this.dataNavigator,"dn.currentPage")||1;n.pagination=n.pagination||1,o!==n.selectedItem.length&&n.pagination===r&&n.selectedItem.forEach((function(e){e.page===r&&t.selectItem(e.index,!0)}))}}var s=_.isArray(this.selecteditem)?this.selecteditem:[this.selecteditem];if(this.firstSelectedItem=this.lastSelectedItem=null,!e.length||!this.selectfirstitem||this._items.length&&this.multiselect||!1===this._selectedItemsExist)this.deselectListItems(),s.forEach((function(e){var n=t.getListItemByModel(e);n&&(n.isActive=!0,t.lastSelectedItem=n,n.nativeElement.focus())}));else{var l=e.first;l.disableItem||!this.isDataChanged||(this.infScroll||this.onDemandLoad)&&this._items.length||(this.clearSelectedItems(),this.firstSelectedItem=this.lastSelectedItem=l,this.selectItem(0))}if(this.fieldDefs.length&&this.infScroll){var c=this.$element.closest("[wmsmoothscroll]");if(a.isMobileApp()&&c.length&&"true"===c.attr("wmsmoothscroll"))this.paginationService.bindIScrollEvt(this,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);else{var p=this.$element.closest(".modal-body"),d=this.$element.find("ul").height(),u=window.innerHeight-140;a.isMobile()&&p.length&&d>u&&this.$element.css("height",u+"px"),this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME)}}this.isDataChanged=!1},t.prototype.triggerListItemSelection=function(e,t){if(e&&e[0]){var n=e.data("listItemContext");n.listComponent===this&&this.onItemClick(t,n)}},t.prototype.setupHandlers=function(){var e=this;this.listItems.changes.subscribe((function(t){e.onListRender(t),e.cdRef.detectChanges()})),this.nativeElement.querySelector("ul.app-livelist-container").addEventListener("click",(function(t){for(var n=$(t.target).closest(".app-list-item");n.get(0)&&n.closest("ul.app-livelist-container").get(0)!==t.currentTarget;)n=n.parent().closest(".app-list-item");e.triggerListItemSelection(n,t)}),!0)},t.prototype.onReorderStart=function(e,t){t.placeholder.height(t.item.height()),this.$ulEle.data("oldIndex",t.item.index())},t.prototype.onSort=function(e,t){if(this.infScroll){var n=this.$ulEle.find("[listitemindex="+(this.fieldDefs.length-1)+"]").offset();n&&n.top<t.offset.top&&(this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME),this.debouncedFetchNextDatasetOnScroll())}},t.prototype.onUpdate=function(e,t){var n=this.fieldDefs,i=t.item.index(),o=this.$ulEle.data("oldIndex"),a=_.min([i,o]),r=_.max([i,o]),s=_.pullAt(n,o)[0];if(s){"none"!==this.getConfiguredState()&&this.statePersistence.removeWidgetState(this,"selectedItem"),this.reorderProps.minIndex=_.min([a,this.reorderProps.minIndex]),this.reorderProps.maxIndex=_.max([r,this.reorderProps.maxIndex]),n.splice(i,0,s),this.cdRef.markForCheck(),this.cdRef.detectChanges();var l={oldIndex:o,newIndex:i,item:n[i]};this.invokeEventCallback("reorder",{$event:e,$data:n,$changedItem:l}),this.$ulEle.removeData("oldIndex")}},t.prototype.configureDnD=function(){var e,t=$(document).find(".modal");e=this.getAttr("height")?"parent":t.length?t[t.length-1]:"body";var n=a.isMobileApp()?{}:{appendTo:e},o=$(this.nativeElement);this.$ulEle=o.find(".app-livelist-container"),i.configureDnD(this.$ulEle,n,this.onReorderStart.bind(this),this.onUpdate.bind(this),this.onSort.bind(this)),this.$ulEle.droppable({accept:".app-list-item"}),a.isMobileApp()&&(this.$ulEle.sortable("disable"),this.$ulEle.on("touchstart",(function(e){var t=this;t.touching||(t.touched&&clearTimeout(t.touched),setTimeout((function(){e.cancelable&&e.preventDefault()}),50),t.touched=setTimeout((function(){$(e.currentTarget).addClass("no-selection"),$(e.currentTarget).sortable("enable"),t.touching=!0,$(t).trigger(e)}),350))})).on("touchend",(function(e){this.touching=!1,$(e.currentTarget).removeClass("no-selection"),$(e.currentTarget).sortable("disable"),clearTimeout(this.touched)})).on("touchmove",(function(){clearTimeout(this.touched)})))},t.prototype.checkSelectionLimit=function(e){return!this.selectionlimit||e<this.selectionlimit},t.prototype.getListItemByIndex=function(e){return this.listItems.toArray()[e]},t.prototype.getListItemIndex=function(e){return this.listItems.toArray().indexOf(e)},t.prototype.execute=function(e,t){return![a.DataSource.Operation.IS_API_AWARE,a.DataSource.Operation.IS_PAGEABLE,a.DataSource.Operation.SUPPORTS_SERVER_FILTER].includes(e)&&this.datasource.execute(e,t)},t.prototype.handleKeyDown=function(e,t){var n=this;e.stopPropagation(),13===e.keyCode||9===e.keyCode||(e.target.classList.contains("form-control")||e.target.classList.contains("note-editable"))&&32===e.keyCode||e.preventDefault();var i=this.listItems,o=this.getListItemIndex(this.lastSelectedItem);if(this.multiselect){var a=this.getListItemIndex(this.firstSelectedItem),r=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0;"selectPrev"===t?o>0&&(o<=a&&this.checkSelectionLimit(r)?(this.lastSelectedItem=this.getListItemByIndex(o-1),this.toggleListItemSelection(this.lastSelectedItem)):o>a?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o-1)):this.invokeEventCallback("selectionlimitexceed",{$event:e})):"selectNext"===t&&o<i.length-1&&(o>=a&&this.checkSelectionLimit(r)?(this.lastSelectedItem=this.getListItemByIndex(o+1),this.toggleListItemSelection(this.lastSelectedItem)):o<a?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o+1)):this.invokeEventCallback("selectionlimitexceed",{$event:e}))}if("focusPrev"===t)if(this.isListElementMovable){var s;if(o=o<=0?0:o,this.lastSelectedItem=this.getListItemByIndex(o),0===o)return void(s=this.listItems.last);this.listItems.forEach((function(e,t){if(t===o){s.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),a=i[o];i[o]=i[o-1],i[o-1]=a,n.listItems.reset(i),n.currentIndex=o,n.ariaText="selected "}s=e}))}else o=o<=0?0:o-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("focusNext"===t)if(this.isListElementMovable){var l;if(o=o<i.length-1?o:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),o===this.listItems.length-1)return void(l=this.listItems.first);this.listItems.forEach((function(e,t){if(t===o+1){l.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),a=i[o+1];i[o+1]=i[o],i[o]=a,n.listItems.reset(i),n.currentIndex=t+1,n.ariaText="selected "}l=e}))}else o=o<i.length-1?o+1:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("select"===t){if(-1===o||!$(e.target).closest(this.lastSelectedItem.nativeElement)){var c=$(e.target).closest("li.app-list-item"),p=c.closest("ul.app-livelist-container");o=p.find("li.app-list-item").index(c)}this.onItemClick(e,this.getListItemByIndex(o))}else if("space"===t){if(!this.enablereorder)return;this.isListElementMovable=!this.isListElementMovable,this.onItemClick(e,this.getListItemByIndex(o)),this.currentIndex=o+1;var d=this.getListItemByIndex(o).item.name;this.isListElementMovable?this.ariaText=d+" grabbed, current position ":this.ariaText=d+" dropped, final position "}},t.prototype.onPropertyChange=function(t,n,i){var o=this;if("dataset"===t){if(!n&&this.binddatasource&&!this.datasource)return;this.onDataSetChange(n)}else if("datasource"===t)this.dataset&&this.onDataSetChange(this.dataset);else if("navigation"===t){if("Advanced"===n)return void(this.navigation="Classic");a.switchClass(this.nativeElement,n,i),this.onNavigationTypeChange(n),this.dataNavigator&&(this.dataNavigator.navigationClass=this.paginationclass)}else if("itemsperrow"===t)a.setListClass(this);else{if("tabindex"===t)return;"pulltorefresh"===t&&n?(this.app.notify("pullToRefresh:enable"),this.subscribeToPullToRefresh()):"paginationclass"===t?this.dataNavigator&&setTimeout((function(){return o.dataNavigator.navigationClass=n})):"pagesize"===t?(this.dataNavigator.options={maxResults:n},this.dataNavigator.widget.maxResults=n,this.dataNavigator.maxResults=n):"enablereorder"===t?n?(this.configureDnD(),this.$ulEle.sortable("enable")):this.$ulEle&&!n&&this.$ulEle.sortable("disable"):e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onItemClick=function(e,t){var n,i=this;if(!t.disableItem){if(this.firstSelectedItem=this.firstSelectedItem||t,n=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0,this.multiselect&&a.isMobile())this.checkSelectionLimit(n)||t.isActive?this.toggleListItemSelection(t):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if((e.ctrlKey||e.metaKey)&&this.multiselect)this.checkSelectionLimit(n)||t.isActive?(this.firstSelectedItem=this.lastSelectedItem=t,this.toggleListItemSelection(t)):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if(e.shiftKey&&this.multiselect){var o=t.context.index,r=this.firstSelectedItem.context.index;o>r&&(r=[o,o=r][0]),this.checkSelectionLimit(r-o)?(this.clearSelectedItems(),this.listItems.forEach((function(e){var t=e.context.index;t>=o&&t<=r&&i.toggleListItemSelection(e)})),this.lastSelectedItem=t):this.invokeEventCallback("selectionlimitexceed",{$event:e})}else(!t.isActive||n>1)&&(this.clearSelectedItems(),this.toggleListItemSelection(t),this.firstSelectedItem=this.lastSelectedItem=t);a.$appDigest()}},t.prototype.clear=function(){this.updateFieldDefs([])},t.prototype.getItemRefByIndexOrModel=function(e){return a.isNumber(e)?this.getListItemByIndex(e):this.getListItemByModel(e)},t.prototype.deselectItem=function(e){var t=this.getItemRefByIndexOrModel(e);t&&t.isActive&&this.toggleListItemSelection(t)},t.prototype.selectItem=function(e,t){var n=this.getItemRefByIndexOrModel(e);n&&(n.isActive||this.toggleListItemSelection(n,t),n.nativeElement.focus())},t.prototype.beforePaginationChange=function(e,t){this.invokeEventCallback("paginationchange",{$event:e,$index:t})},t.prototype.handleEvent=function(e,t,n,i){var o=this;_.includes(["click","tap","dblclick","doubletap"],t)&&this.eventManager.addEventListener(this.nativeElement,{tap:"click",doubletap:"dblclick"}[t]||t,(function(e){var n=$(e.target).closest(".app-list-item");if(n.length){var i=n.data("listItemContext");i.disableItem||o.invokeEventCallback(t,{widget:i,$event:e,item:i.item})}}))},t.prototype.subscribeToPullToRefresh=function(){var e=this;this._listenerDestroyers.push(this.app.subscribe("pulltorefresh",(function(){e.datasource&&e.datasource.listRecords&&e.datasource.listRecords()})))},t.prototype.ngOnInit=function(){var t=this;e.prototype.ngOnInit.call(this),this.handleHeaderClick=a.noop,setTimeout((function(){t.debouncedFetchNextDatasetOnScroll=t.paginationService.debouncedFetchNextDatasetOnScroll(t.dataNavigator,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME,t)}),0),this._items=[],this.fieldDefs=[],this.reorderProps={minIndex:null,maxIndex:null}},t.prototype.setUpCUDHandlers=function(){var e=this,t=document.getElementsByClassName("add-list-item")[0];t&&t.addEventListener("click",(function(t){e.create()}))},t.prototype.ngAfterViewInit=function(){var t=this;this.promiseResolverFn(),this.propsInitPromise.then((function(){e.prototype.ngAfterViewInit.call(t),t.setUpCUDHandlers(),t.selectedItemWidgets=t.multiselect?[]:{},t.enablereorder&&!t.groupby&&t.configureDnD(),t.groupby&&t.collapsible&&(t.handleHeaderClick=i.handleHeaderClick,t.toggleAllHeaders=i.toggleAllHeaders.bind(void 0,t)),a.setListClass(t)})),this.setupHandlers();var n=this.nativeElement.querySelector("ul.app-livelist-container");i.styler(n,this,i.APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER),a.isMobileApp()&&n.querySelector(".app-list-item-action-panel")&&(this._listAnimator=new f(this))},t.prototype.ngOnDestroy=function(){this._listAnimator&&this._listAnimator.$btnSubscription&&this._listAnimator.$btnSubscription.unsubscribe(),this._listenerDestroyers.forEach((function(e){return e&&e()})),e.prototype.ngOnDestroy.call(this)},t.prototype.ngOnDetach=function(){e.prototype.ngOnDetach.call(this),this._pageLoad=!0},t}(i.StylableComponent);v.initializeProps=h(),v.decorators=[{type:t.Component,args:[{selector:"div[wmList]",template:'<div class="panel-heading" *ngIf="title || subheading || iconclass">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon {{iconclass}}" aria-hidden="true" [hidden]="!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 </h3>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisablePrevious" aria-label="Page navigation" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="previous" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisablePrevious : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'prev\', $event)">\n <i class="wi wi-chevron-left" aria-hidden="true"></i>\n <span class="sr-only">Previous</span>\n </a>\n </li>\n </ul>\n</nav>\n<div *ngIf="navigation === \'Inline\' && !noDataFound" aria-live="polite" aria-atomic="true" class="sr-only"> {{\'Item \' + dataNavigator.dn.currentPage + \' of \' + dataNavigator.pageCount }}</div>\n\n<div>\n <div id={{titleId}} class="sr-only" >\n Press space bar to toggle drag drop mode, use arrow keys to move selected elements.\n </div>\n \n <div aria-live="assertive" *ngIf="listItems" class="sr-only" >\n {{ariaText + currentIndex + \' of \' + listItems.length}}\n </div> \n</div>\n\n<ul [attr.tabindex]="tabindex" [attr.aria-describedby] = "titleId" class="app-livelist-container clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}} {{listclass}}" role="list"\n (keydown.enter)="handleKeyDown($event, \'select\')"\n\n (keydown.space)="handleKeyDown($event, \'space\')"\n\n (keydown.arrowup)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowdown)="handleKeyDown($event, \'focusNext\')"\n (keydown.arrowleft)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowright)="handleKeyDown($event, \'focusNext\')"\n\n (keydown.shift.arrowup)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowdown)="handleKeyDown($event, \'selectNext\')"\n (keydown.shift.arrowleft)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowright)="handleKeyDown($event, \'selectNext\')"\n [hidden]="noDataFound && !variableInflight"\n>\n <ng-template [ngIf]="!groupby" [ngIfElse]="groupedListTemplate">\n <li *ngFor="let item of fieldDefs; index as $index; first as $first; last as $last;" class="app-list-item {{direction === \'horizontal\' ? \'\' : itemsPerRowClass}}" [ngClass]="listItemRef.itemClass"\n [wmListItem]="item"\n #listItemRef="listItemRef"\n [attr.tabindex]="tabindex"\n role="listitem">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ng-template>\n <ng-container [ngTemplateOutlet]="listLeftActionTemplate"></ng-container>\n <ng-container [ngTemplateOutlet]="listRightActionTemplate"></ng-container>\n</ul>\n\n<div class="no-data-msg" *ngIf="noDataFound && !variableInflight" [textContent]="nodatamessage"></div>\n\n<div class="loading-data-msg" *ngIf="variableInflight && !pulltorefresh">\n <span>\n <i class="app-icon panel-icon fa-spin" aria-hidden="true" [ngClass]="loadingicon"></i>\n <span class="sr-only">Loading</span>\n <span class="loading-text" [textContent]="loadingdatamsg"></span>\n </span>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisableNext" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="next" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisableNext : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'next\', $event)">\n <i class="wi wi-chevron-right" aria-hidden="true"></i>\n <span class="sr-only">Next</span>\n </a>\n </li>\n </ul>\n</nav>\n\n<div class="panel-footer" *ngIf="navigation !== \'None\'" [hidden]="!showNavigation || (onDemandLoad && dataNavigator.isDisableNext) || (dataNavigator.dataSize <= pagesize) || (!dataNavigator.dataSize && !dataNavigator.datasource?.pagination?.next)">\n <nav wmPagination\n navigationalign.bind="navigationalign"\n navigation.bind="navControls"\n showrecordcount.bind="showrecordcount"\n maxsize.bind="maxsize"\n boundarylinks.bind="boundarylinks"\n forceellipses.bind="forceellipses"\n directionlinks.bind="directionlinks"\n show.bind="!onDemandLoad"\n paginationchange.event="beforePaginationChange($event, $index)"\n ></nav>\n <a *ngIf="onDemandLoad" href="javascript:void(0);"\n (click)="dataNavigator.navigatePage(\'next\', $event)"\n class="app-button btn btn-block"\n [ngClass]="paginationclass"\n [textContent]="ondemandmessage"\n ></a>\n</div>\n\n\x3c!--This template will be displayed when groupby is specified--\x3e\n<ng-template #groupedListTemplate>\n <li *ngFor="let groupObj of groupedData" class="app-list-item-group clearfix">\n <ul [attr.tabindex]="tabindex" class="list-group item-group" [ngClass]="listclass">\n <li class="app-list-item-header list-item list-group-header" (click)="handleHeaderClick($event)" [ngClass]="{\'collapsible-content\': collapsible}">\n <h4>{{groupObj.key}}\n <div class="header-action">\n <i class="app-icon wi action wi-chevron-up" *ngIf="collapsible"></i>\n <span *ngIf="showcount" class="label label-default">{{groupObj.data.length}}</span>\n </div>\n </h4>\n </li>\n <ul class="list-group clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}}">\n <li *ngFor="let item of groupObj.data; index as $index; first as $first; last as $last;" [attr.tabindex]="tabindex"\n class="app-list-item group-list-item {{itemsPerRowClass}}"\n [ngClass]="listItemRef.itemClass"\n [wmListItem]="item" #listItemRef="listItemRef">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ul>\n </ul>\n </li>\n</ng-template>\n',providers:[i.provideAsWidgetRef(v)]}]}],v.ctorParameters=function(){return[{type:t.Injector},{type:t.ChangeDetectorRef},{type:i.ToDatePipe},{type:a.App},{type:a.AppDefaults},{type:t.NgZone},{type:String,decorators:[{type:t.Attribute,args:["itemclass.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["disableitem.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["datasource.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseenter.event"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseleave.event"]}]},{type:a.StatePersistence},{type:a.PaginationService}]},v.propDecorators={listTemplate:[{type:t.ContentChild,args:["listTemplate"]}],listLeftActionTemplate:[{type:t.ContentChild,args:["listLeftActionTemplate"]}],listRightActionTemplate:[{type:t.ContentChild,args:["listRightActionTemplate"]}],btnComponents:[{type:t.ContentChildren,args:[r.ButtonComponent]}],dataNavigator:[{type:t.ViewChild,args:[o.PaginationComponent]}],listItems:[{type:t.ViewChildren,args:[m]}]};var y=[v,m],b=function(){};b.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,o.PaginationModule,i.WmComponentsModule],declarations:u([],d(y)),exports:u([],d(y)),entryComponents:[]}]}],e.ListComponent=v,e.ListItemDirective=m,e.ListModule=b,e["\u0275a"]=h,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/tooltip"),require("ngx-bootstrap/dropdown"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/input"),require("@wm/components/navigation/menu"),require("@wm/components/data/list"),require("@wm/components/data/pagination"),require("@wm/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@wm/components/data/table",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/tooltip","ngx-bootstrap/dropdown","@wm/components/base","@wm/components/basic","@wm/components/input","@wm/components/navigation/menu","@wm/components/data/list","@wm/components/data/pagination","@wm/core","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.data=e.wm.components.data||{},e.wm.components.data.table={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].tooltip,e["ngx-bootstrap"].dropdown,e.wm.components.base,e.wm.components.basic,e.wm.components.input,e.wm.components.navigation.menu,e.wm.components.data.list,e.wm.components.data.pagination,e.wm.core,e.rxjs,e.rxjs.operators)}(this,(function(e,t,n,i,o,a,r,s,l,c,p,d,u,h,m){"use strict";
|
|
506
|
+
***************************************************************************** */var c=function(e,t){return(c=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 p(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}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}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=function(){i.register("wm-list",new Map([["boundarylinks",Object.assign({value:!1},i.PROP_BOOLEAN)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dateformat",i.PROP_STRING],["dataset",i.PROP_ANY],["datasource",i.PROP_ANY],["direction",Object.assign({value:"vertical"},i.PROP_STRING)],["directionlinks",Object.assign({value:!0},i.PROP_BOOLEAN)],["disableitem",i.PROP_BOOLEAN],["enablereorder",i.PROP_BOOLEAN],["forceellipses",Object.assign({value:!0},i.PROP_BOOLEAN)],["groupby",i.PROP_STRING],["iconclass",i.PROP_STRING],["itemclass",Object.assign({value:""},i.PROP_STRING)],["itemsperrow",i.PROP_STRING],["listclass",Object.assign({value:"list-group"},i.PROP_STRING)],["multiselect",i.PROP_BOOLEAN],["loadingdatamsg",Object.assign({value:"Loading..."},i.PROP_STRING)],["loadingicon",Object.assign({value:"fa fa-circle-o-notch"},i.PROP_STRING)],["match",i.PROP_STRING],["maxsize",Object.assign({value:5},i.PROP_NUMBER)],["name",i.PROP_STRING],["navigation",i.PROP_STRING],["navigationalign",Object.assign({value:"left"},i.PROP_STRING)],["nodatamessage",Object.assign({value:"No data found"},i.PROP_STRING)],["ondemandmessage",Object.assign({value:"Load More"},i.PROP_STRING)],["orderby",i.PROP_STRING],["paginationclass",i.PROP_STRING],["pagesize",i.PROP_NUMBER],["pulltorefresh",Object.assign({value:a.isMobileApp()},i.PROP_BOOLEAN)],["selectfirstitem",i.PROP_BOOLEAN],["selectionlimit",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showcount",i.PROP_BOOLEAN],["showrecordcount",i.PROP_BOOLEAN],["statehandler",Object.assign({value:"none"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]))},m=function(){function e(e,t,n){this.inj=e,this.app=n,this.destroy=new s.Subject,this.destroy$=this.destroy.asObservable(),this.itemClass="",this._currentItemWidgets={},this.isActive=!1,this.disableItem=!1,this.nativeElement=t.nativeElement,this.listComponent=e.view.component,this.context=e.view.context,this.itemClassWatcher(this.listComponent),this.disableItemWatcher(this.listComponent),$(this.nativeElement).data("listItemContext",this)}return e.prototype.onFocus=function(){this.listComponent.lastSelectedItem=this},Object.defineProperty(e.prototype,"$index",{get:function(){return this.context.index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$even",{get:function(){return this.context.even},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$odd",{get:function(){return this.context.odd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$first",{get:function(){return this.context.first},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$last",{get:function(){return this.context.last},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentItemWidgets",{get:function(){var e=Array.from(this.nativeElement.querySelectorAll("[widget-id]"));return Object.assign(this._currentItemWidgets,e.reduce((function(e,t){return e[t.widget.name]=t.widget,e}),{}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wmListItem",{set:function(e){this.item=e},enumerable:!1,configurable:!0}),e.prototype.registerWatch=function(e,t){this.destroy$.subscribe(a.$watch(e,this.listComponent.viewParent,this,t))},e.prototype.itemClassWatcher=function(e){var t=this;e.binditemclass?this.registerWatch(e.binditemclass,(function(e){return t.itemClass=e||""})):this.itemClass=e.itemclass},e.prototype.disableItemWatcher=function(e){var t=this;e.binddisableitem?this.registerWatch(e.binddisableitem,(function(e){return t.disableItem=e||!1})):this.disableItem=e.disableitem||!1},e.prototype.setUpCUDHandlers=function(){var e=this,t=this.nativeElement.querySelector(".edit-list-item"),n=this.nativeElement.querySelector(".delete-list-item");t&&t.addEventListener("click",(function(t){e.listComponent.update()})),n&&n.addEventListener("click",(function(t){e.listComponent.delete()}))},e.prototype.ngOnInit=function(){var e=this;this.listComponent.mouseEnterCB&&this.nativeElement.addEventListener("mouseenter",(function(t){e.listComponent.invokeEventCallback("mouseenter",{widget:e,$event:t})})),this.listComponent.mouseLeaveCB&&this.nativeElement.addEventListener("mouseleave",(function(t){e.listComponent.invokeEventCallback("mouseleave",{widget:e,$event:t})})),$(this.nativeElement).attr("listitemindex",this.$index)},e.prototype.ngAfterViewInit=function(){this.setUpCUDHandlers()},e}();m.decorators=[{type:t.Directive,args:[{selector:"[wmListItem]",exportAs:"listItemRef"}]}],m.ctorParameters=function(){return[{type:t.Injector},{type:t.ElementRef},{type:a.App}]},m.propDecorators={isActive:[{type:t.HostBinding,args:["class.active"]}],disableItem:[{type:t.HostBinding,args:["class.disable-item"]}],onFocus:[{type:t.HostListener,args:["focus"]}],wmListItem:[{type:t.Input}]};var f=function(e){function t(t){var n=e.call(this)||this;return n.list=t,n.$el=$(n.list.getNativeElement()).find("ul.app-livelist-container").first(),n.leftChildrenCount=n.$el.find(">.app-list-item-left-action-panel > button:visible").length,n.rightChildrenCount=n.$el.find(">.app-list-item-right-action-panel > button:visible").length,n.leftChildrenCount||n.rightChildrenCount?(n.init(n.$el),n.$btnSubscription=n.list.btnComponents.changes.subscribe((function(e){return n.actionItems=e})),n):n}return p(t,e),t.prototype.createActionPanel=function(e,t){return t.css({width:e.outerWidth()+"px",height:e.outerHeight()+"px",marginBottom:-1*e.outerHeight()+"px",float:"left",padding:0}),t.insertBefore(e)},t.prototype.computeTotalChildrenWidth=function(e){return _.reduce(e.children(),(function(e,t){return e+$(t).outerWidth()}),0)},t.prototype.computeTransitionProportions=function(e){var t=this.computeTotalChildrenWidth(e),n="right"===this.position,i=0;return _.map(e.children(),(function(e){var o=(t-i)/t;return i+=$(e).outerWidth(),n?o:i/t}))},t.prototype.resetElement=function(e){e&&e.css({transform:"none",transition:"none"})},t.prototype.resetState=function(){this.resetElement(this.li),this.resetElement(this.actionPanel),this.actionPanel&&(this.actionPanel=null)},t.prototype.getChildActionElement=function(e){if(e.children().length)return"left"===this.position?e.children().first():e.children().last()},t.prototype.initActionPanel=function(e){this.actionPanel=this.createActionPanel(this.li,e),this.actionPanel.css({backgroundColor:this.getChildActionElement(this.actionPanel).css("background-color")}),this.limit=this.computeTotalChildrenWidth(this.actionPanel),this.transitionProportions=this.computeTransitionProportions(this.actionPanel)},t.prototype.bounds=function(e,t){var n=$(e.target).closest("li"),i={strictUpper:!0,strictLower:!0,lower:0,center:0,upper:0};if(!n.hasClass("app-list-item"))return i;if(this.li&&this.li[0]===n[0])"left"===this.position?i={strictUpper:!1,lower:-this.limit,center:this.limit}:"right"===this.position&&(i={center:-this.limit,upper:this.limit,strictLower:!1});else{var o=t>0?".app-list-item-left-action-panel":".app-list-item-right-action-panel",a=this.$el.find(">"+o);if(!a.length&&this.list.groupby&&(o="li > ul.list-group >"+o,a=this.$el.find(">"+o)),!a.length||!a.find("button:visible").length)return i;this.resetState(),this.li=n,this.position=a.attr("position"),this.initActionPanel(a),i=t>0?{strictUpper:!1,lower:0,center:0,upper:this.limit}:{strictLower:!1,lower:-this.limit,center:0,upper:0}}return i},t.prototype.context=function(){var e=this;return{computeActionTransition:function(t,n){var i=n>0?1:-1;return i*n>e.limit?n-i*e.limit+e.transitionProportions[t]*i*e.limit:e.transitionProportions[t]*n}}},t.prototype.animation=function(){var e=this;return[{target:function(){return e.li},css:{transform:"translate3d(${{$D + $d}}px, 0, 0)"}},{target:function(){return e.actionPanel&&e.actionPanel.children()},css:{transform:"translate3d(${{computeActionTransition($i, $D + $d)}}px, 0, 0)"}}]},t.prototype.invokeFullSwipeEvt=function(e){var t,n,i;"left"===this.position?(n=this.actionItems.filter((function(e){return"left"===e.getAttr("swipe-position")&&e.$element.is(":visible")})),i=0):i=(n=this.actionItems.filter((function(e){return"right"===e.getAttr("swipe-position")&&e.$element.is(":visible")}))).length-1,(t=n[i])&&t.hasEventCallback("tap")&&t.invokeEventCallback("tap",{$event:e}),this.resetState(),this.li=null},t.prototype.onAnimation=function(e,t){if(this.list.triggerListItemSelection(this.li,e),this.actionPanel&&"true"===this.actionPanel.attr("enablefullswipe")){var n=t>0?1:-1,i=this.getChildActionElement(this.actionPanel);if(i){var o="right"===this.position?this.rightChildrenCount-1:0;this.transitionProportions[o]*n*t*100/(this.li.outerWidth()-this.limit+i.width())>50&&this.invokeFullSwipeEvt(e)}}},t.prototype.onLower=function(){"left"===this.position&&(this.resetState(),this.li=null)},t.prototype.onUpper=function(){"right"===this.position&&(this.resetState(),this.li=null)},t.prototype.threshold=function(){return 10},t}(l.SwipeAnimation),g={widgetType:"wm-list",hostClass:"app-livelist app-panel"},v=function(e){function t(t,n,o,r,s,l,c,p,d,u,h,m,f,v){var y=this,b=a.noop,w=new Promise((function(e){return b=e}));return(y=e.call(this,t,g,w)||this).propsInitPromise=w,y.promiseResolverFn=b,i.styler(y.nativeElement,y,i.APPLY_STYLES_TYPE.SHELL),y.cdRef=n,y.ngZone=l,y.datePipe=o,y.statePersistence=f,y.paginationService=v,y._pageLoad=!0,y.binditemclass=c,y.binddisableitem=p,y.binddataset=d,y.mouseEnterCB=h,y.mouseLeaveCB=m,y.binddatasource=u,y.app=r,y.appDefaults=s,y.variableInflight=!1,y.noDataFound=!d,y.titleId="wmlist-"+a.generateGUId(),y._listenerDestroyers=[y.app.subscribe("check-state-persistence-options",(function(e){var t=_.get(y.datasource,"name");t||(t=i.extractDataSourceName(y.binddatasource)),_.get(e,"variable.name")===t&&y.handleStateParams(e)})),y.app.subscribe("toggle-variable-state",y.handleLoading.bind(y)),y.app.subscribe("setup-cud-listener",(function(e){y.nativeElement.getAttribute("name")===e&&(y._isDependent=!0)}))],y}return p(t,e),Object.defineProperty(t.prototype,"selecteditem",{get:function(){return this.multiselect?a.getClonedObject(this._items):_.isEmpty(this._items)?{}:a.getClonedObject(this._items[0])},set:function(e){var t=this;this._items.length=0,this.deselectListItems(),_.isArray(e)?e.forEach((function(e){return t.selectItem(e)})):this.selectItem(e),a.$appDigest()},enumerable:!1,configurable:!0}),t.prototype.getWidgets=function(e,t){var n,i=[];if(e)return a.isDefined(t)?(t=+t||0,(n=_.get(this.listItems.toArray(),t))?[_.get(n.currentItemWidgets,e)]:void 0):(_.forEach(this.listItems.toArray(),(function(t){(n=_.get(t.currentItemWidgets,e))&&i.push(n)})),i)},t.prototype.getItem=function(e){return this.getListItemByIndex(e)},t.prototype.getIndex=function(e){return e instanceof m?this.getListItemIndex(e):e?this.fieldDefs.findIndex((function(t){return _.isEqual(t,e)})):void 0},t.prototype.getConfiguredState=function(){var e=this.statePersistence.computeMode(this.statehandler);return e&&e.toLowerCase()},t.prototype.handleStateParams=function(e){if(this._pageLoad&&"none"!==this.getConfiguredState()){this._pageLoad=!1;var t=this.statePersistence.getWidgetState(this);_.get(t,"pagination")&&(e.options=e.options||{},e.options.page=t.pagination),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}},t.prototype.triggerWMEvent=function(e,t){a.$invokeWatchers(!0);var n=this.multiselect?_.last(this.selecteditem):this.selecteditem;t&&(n=t),this.app.notify("wm-event",{eventName:e,widgetName:this.name,row:n})},t.prototype.create=function(){this._isDependent&&this.triggerWMEvent("insert")},t.prototype.editRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("update",t)}},t.prototype.update=function(e){this.editRow(e)},t.prototype.deleteRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("delete",t)}},t.prototype.delete=function(e){this.deleteRow(e)},t.prototype.handleLoading=function(e){var t=this,n=this.datasource;n&&n.execute(a.DataSource.Operation.IS_API_AWARE)&&a.isDataSourceEqual(e.variable,n)&&this.ngZone.run((function(){var n,i,o;t.handleStateParams(e),t.variableInflight=e.active;var a=null===(i=null===(n=e.data)||void 0===n?void 0:n.pagination)||void 0===i?void 0:i.totalElements;_.isUndefined(a)?t.noDataFound=_.isEmpty(null===(o=e.data)||void 0===o?void 0:o.data):t.noDataFound=0===a}))},t.prototype.resetNavigation=function(){this.showNavigation=!1,this.navControls=void 0,this.infScroll=!1,this.onDemandLoad=!1},t.prototype.enableBasicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.BASIC,this.showNavigation=!0},t.prototype.enableInlineNavigation=function(){this.navControls=i.NAVIGATION_TYPE.INLINE},t.prototype.enableClassicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.CLASSIC,this.showNavigation=!0},t.prototype.enablePagerNavigation=function(){this.navControls=i.NAVIGATION_TYPE.PAGER,this.showNavigation=!0},t.prototype.setNavigationTypeNone=function(){this.navControls=i.NAVIGATION_TYPE.NONE,this.showNavigation=!1},t.prototype.enableInfiniteScroll=function(){this.infScroll=!0},t.prototype.enableOnDemandLoad=function(){this.onDemandLoad=!0,this.showNavigation=!0},t.prototype.onNavigationTypeChange=function(e){switch(this.resetNavigation(),e){case i.NAVIGATION_TYPE.BASIC:this.enableBasicNavigation();break;case i.NAVIGATION_TYPE.INLINE:this.enableInlineNavigation();break;case i.NAVIGATION_TYPE.ADVANCED:case i.NAVIGATION_TYPE.CLASSIC:this.enableClassicNavigation();break;case i.NAVIGATION_TYPE.PAGER:this.enablePagerNavigation();break;case i.NAVIGATION_TYPE.NONE:this.setNavigationTypeNone();break;case i.NAVIGATION_TYPE.SCROLL:this.enableInfiniteScroll();break;case i.NAVIGATION_TYPE.ONDEMAND:this.enableOnDemandLoad()}},t.prototype.updateFieldDefs=function(e){var t;this.infScroll||this.onDemandLoad?(t=d(this.paginationService.updateFieldsOnPagination(this,e),2),this.fieldDefs=t[0],this.currentPage=t[1]):this.fieldDefs=e,this.orderby&&(this.fieldDefs=i.getOrderedDataset(this.fieldDefs,this.orderby)),this.groupby&&(this.groupedData=i.groupData(this,this.fieldDefs,this.groupby,this.match,this.orderby,this.dateformat,this.datePipe,void 0,this.appDefaults)),this.fieldDefs.length||(this.noDataFound=!0,this.selecteditem=void 0),a.$appDigest(),this.listItems.setDirty()},t.prototype.onDataChange=function(e){_.isEmpty(e)?this.updateFieldDefs([]):(this.noDataFound=!1,this.isDataChanged=!0,this.datasource&&this.datasource.execute(a.DataSource.Operation.IS_API_AWARE)&&(e=_.cloneDeep(e)),a.isObject(e)&&!_.isArray(e)&&(e=_.isEmpty(e)?[]:[e]),_.isString(e)&&(e=e.split(",")),this.datasource&&"App"===this.datasource.owner&&(this.infScroll||this.onDemandLoad)&&!this.currentPage&&this.datasource.execute(a.DataSource.Operation.GET_PAGING_OPTIONS).number>0&&(e=this.datasource.execute(a.DataSource.Operation.LIST_RECORDS,{page:1})),_.isArray(e)&&(e.length&&this.invokeEventCallback("beforedatarender",{$data:e}),this.updateFieldDefs(e)))},t.prototype.setupDataSource=function(){var e=this,t=this.dataNavigator;t.options={maxResults:this.pagesize||20},this.dataNavigatorWatched=!0,this.navigatorResultWatch&&this.navigatorResultWatch.unsubscribe(),this.navigatorResultWatch=t.resultEmitter.subscribe((function(t){e.onDataChange(t)}),!0),this.navigatorMaxResultWatch&&this.navigatorMaxResultWatch.unsubscribe(),this.navigatorMaxResultWatch=t.maxResultsEmitter.subscribe((function(t){e.pagesize=t})),t.maxResults=this.pagesize||20,this.removePropertyBinding("dataset");var n=this.getAttr("datasetboundexpr");this.dataNavigator.setBindDataSet(this.binddataset,this.viewParent,n?this.context:this.datasource,this.dataset,this.binddatasource,n,this.statehandler)},t.prototype.onDataSetChange=function(e){if("wm.Variable"===_.get(this.datasource,"category")&&"none"!==this.getConfiguredState()&&this._pageLoad){var t=this.statePersistence.getWidgetState(this);this._pageLoad=!1,_.get(t,"pagination")&&this.dataNavigator.pageChanged({page:t.pagination},!0),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}this.dataNavigatorWatched?this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE&&this.dataNavigator.setDataSource(this.datasource):this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE?this.setupDataSource():this.onDataChange(e)},t.prototype.deselectListItems=function(){this.listItems.forEach((function(e){return e.isActive=!1}))},t.prototype.clearSelectedItems=function(){this.deselectListItems(),this._items.length=0,a.$appDigest()},t.prototype.getListItemByModel=function(e){var t=this;return this.listItems.find((function(n){var i=n.item;if(t.groupby&&!_.has(e,"_groupIndex")&&delete(i=_.clone(i))._groupIndex,_.isEqual(i,e))return!0}))||null},t.prototype.updateSelectedItemsWidgets=function(e){var t,n=this,o={},a=_.get(this.dataNavigator,"dn.currentPage")||1;"none"!==this.getConfiguredState()&&(t=this.statePersistence.getWidgetState(this)||{},_.get(t,"selectedItem")&&(this.multiselect&&1===this.selecteditem.length?t.selectedItem=[]:_.remove(t.selectedItem,(function(e){return e.page===a})))),this.multiselect&&(this.selectedItemWidgets.length=0),this.listItems.forEach((function(e,i){e.isActive&&(n.multiselect?n.selectedItemWidgets.push(e.currentItemWidgets):n.selectedItemWidgets=e.currentItemWidgets,o={page:a,index:i},_.get(t,"selectedItem")&&n.multiselect?_.some(t.selectedItem,o)||t.selectedItem.push(o):t.selectedItem=[o])})),"none"===this.getConfiguredState()||e||(i.unsupportedStatePersistenceTypes.indexOf(this.navigation)<0?(this.statePersistence.removeWidgetState(this,"selectedItem"),this.statePersistence.setWidgetState(this,{selectedItem:t.selectedItem})):console.warn("Retain State handling on Widget "+this.name+" is not supported for current pagination type."))},t.prototype.toggleListItemSelection=function(e,t){if(e&&!e.disableItem){var n=e.item;this.groupby&&_.has(n,"_groupIndex")&&delete(n=_.clone(n))._groupIndex,e.isActive?(this._items=_.pullAllWith(this._items,[n],_.isEqual),e.isActive=!1):(this.multiselect||this.clearSelectedItems(),this._items.push(n),this.invokeEventCallback("select",{widget:e,$data:n}),e.isActive=!0),this.updateSelectedItemsWidgets(t)}},t.prototype.onListRender=function(e){var t=this;if(this.isDataChanged&&(a.$invokeWatchers(!0),this.invokeEventCallback("render",{$data:this.fieldDefs})),this.isDataChanged&&"none"!==this.getConfiguredState()&&e.length&&this._selectedItemsExist){var n=this.statePersistence.getWidgetState(this);if(_.get(n,"selectedItem")){this._selectedItemsExist=!1;var o=_.isArray(this.selecteditem)?this.selecteditem.length:_.toNumber(!_.isEmpty(this.selecteditem)),r=_.get(this.dataNavigator,"dn.currentPage")||1;n.pagination=n.pagination||1,o!==n.selectedItem.length&&n.pagination===r&&n.selectedItem.forEach((function(e){e.page===r&&t.selectItem(e.index,!0)}))}}var s=_.isArray(this.selecteditem)?this.selecteditem:[this.selecteditem];if(this.firstSelectedItem=this.lastSelectedItem=null,!e.length||!this.selectfirstitem||this._items.length&&this.multiselect||!1===this._selectedItemsExist)this.deselectListItems(),s.forEach((function(e){var n=t.getListItemByModel(e);n&&(n.isActive=!0,t.lastSelectedItem=n,n.nativeElement.focus())}));else{var l=e.first;l.disableItem||!this.isDataChanged||(this.infScroll||this.onDemandLoad)&&this._items.length||(this.clearSelectedItems(),this.firstSelectedItem=this.lastSelectedItem=l,this.selectItem(0))}if(this.fieldDefs.length&&this.infScroll){var c=this.$element.closest("[wmsmoothscroll]");if(a.isMobileApp()&&c.length&&"true"===c.attr("wmsmoothscroll"))this.paginationService.bindIScrollEvt(this,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);else{var p=this.$element.closest(".modal-body"),d=this.$element.find("ul").height(),u=window.innerHeight-140;a.isMobile()&&p.length&&d>u&&this.$element.css("height",u+"px"),this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME)}}this.isDataChanged=!1},t.prototype.triggerListItemSelection=function(e,t){if(e&&e[0]){var n=e.data("listItemContext");n.listComponent===this&&this.onItemClick(t,n)}},t.prototype.setupHandlers=function(){var e=this;this.listItems.changes.subscribe((function(t){e.onListRender(t),e.cdRef.detectChanges()})),this.nativeElement.querySelector("ul.app-livelist-container").addEventListener("click",(function(t){for(var n=$(t.target).closest(".app-list-item");n.get(0)&&n.closest("ul.app-livelist-container").get(0)!==t.currentTarget;)n=n.parent().closest(".app-list-item");e.triggerListItemSelection(n,t)}),!0)},t.prototype.onReorderStart=function(e,t){t.placeholder.height(t.item.height()),this.$ulEle.data("oldIndex",t.item.index())},t.prototype.onSort=function(e,t){if(this.infScroll){var n=this.$ulEle.find("[listitemindex="+(this.fieldDefs.length-1)+"]").offset();n&&n.top<t.offset.top&&(this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME),this.debouncedFetchNextDatasetOnScroll())}},t.prototype.onUpdate=function(e,t){var n=this.fieldDefs,i=t.item.index(),o=this.$ulEle.data("oldIndex"),a=_.min([i,o]),r=_.max([i,o]),s=_.pullAt(n,o)[0];if(s){"none"!==this.getConfiguredState()&&this.statePersistence.removeWidgetState(this,"selectedItem"),this.reorderProps.minIndex=_.min([a,this.reorderProps.minIndex]),this.reorderProps.maxIndex=_.max([r,this.reorderProps.maxIndex]),n.splice(i,0,s),this.cdRef.markForCheck(),this.cdRef.detectChanges();var l={oldIndex:o,newIndex:i,item:n[i]};this.invokeEventCallback("reorder",{$event:e,$data:n,$changedItem:l}),this.$ulEle.removeData("oldIndex")}},t.prototype.configureDnD=function(){var e,t=$(document).find(".modal");e=this.getAttr("height")?"parent":t.length?t[t.length-1]:"body";var n=a.isMobileApp()?{}:{appendTo:e},o=$(this.nativeElement);this.$ulEle=o.find(".app-livelist-container"),i.configureDnD(this.$ulEle,n,this.onReorderStart.bind(this),this.onUpdate.bind(this),this.onSort.bind(this)),this.$ulEle.droppable({accept:".app-list-item"}),a.isMobileApp()&&(this.$ulEle.sortable("disable"),this.$ulEle.on("touchstart",(function(e){var t=this;t.touching||(t.touched&&clearTimeout(t.touched),setTimeout((function(){e.cancelable&&e.preventDefault()}),50),t.touched=setTimeout((function(){$(e.currentTarget).addClass("no-selection"),$(e.currentTarget).sortable("enable"),t.touching=!0,$(t).trigger(e)}),350))})).on("touchend",(function(e){this.touching=!1,$(e.currentTarget).removeClass("no-selection"),$(e.currentTarget).sortable("disable"),clearTimeout(this.touched)})).on("touchmove",(function(){clearTimeout(this.touched)})))},t.prototype.checkSelectionLimit=function(e){return!this.selectionlimit||e<this.selectionlimit},t.prototype.getListItemByIndex=function(e){return this.listItems.toArray()[e]},t.prototype.getListItemIndex=function(e){return this.listItems.toArray().indexOf(e)},t.prototype.execute=function(e,t){return![a.DataSource.Operation.IS_API_AWARE,a.DataSource.Operation.IS_PAGEABLE,a.DataSource.Operation.SUPPORTS_SERVER_FILTER].includes(e)&&this.datasource.execute(e,t)},t.prototype.handleKeyDown=function(e,t){var n=this;e.stopPropagation(),13===e.keyCode||9===e.keyCode||e.target.classList.contains("form-control")&&32===e.keyCode||e.preventDefault();var i=this.listItems,o=this.getListItemIndex(this.lastSelectedItem);if(this.multiselect){var a=this.getListItemIndex(this.firstSelectedItem),r=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0;"selectPrev"===t?o>0&&(o<=a&&this.checkSelectionLimit(r)?(this.lastSelectedItem=this.getListItemByIndex(o-1),this.toggleListItemSelection(this.lastSelectedItem)):o>a?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o-1)):this.invokeEventCallback("selectionlimitexceed",{$event:e})):"selectNext"===t&&o<i.length-1&&(o>=a&&this.checkSelectionLimit(r)?(this.lastSelectedItem=this.getListItemByIndex(o+1),this.toggleListItemSelection(this.lastSelectedItem)):o<a?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o+1)):this.invokeEventCallback("selectionlimitexceed",{$event:e}))}if("focusPrev"===t)if(this.isListElementMovable){var s;if(o=o<=0?0:o,this.lastSelectedItem=this.getListItemByIndex(o),0===o)return void(s=this.listItems.last);this.listItems.forEach((function(e,t){if(t===o){s.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),a=i[o];i[o]=i[o-1],i[o-1]=a,n.listItems.reset(i),n.currentIndex=o,n.ariaText="selected "}s=e}))}else o=o<=0?0:o-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("focusNext"===t)if(this.isListElementMovable){var l;if(o=o<i.length-1?o:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),o===this.listItems.length-1)return void(l=this.listItems.first);this.listItems.forEach((function(e,t){if(t===o+1){l.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),a=i[o+1];i[o+1]=i[o],i[o]=a,n.listItems.reset(i),n.currentIndex=t+1,n.ariaText="selected "}l=e}))}else o=o<i.length-1?o+1:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("select"===t){if(-1===o||!$(e.target).closest(this.lastSelectedItem.nativeElement)){var c=$(e.target).closest("li.app-list-item"),p=c.closest("ul.app-livelist-container");o=p.find("li.app-list-item").index(c)}this.onItemClick(e,this.getListItemByIndex(o))}else if("space"===t){if(!this.enablereorder)return;this.isListElementMovable=!this.isListElementMovable,this.onItemClick(e,this.getListItemByIndex(o)),this.currentIndex=o+1;var d=this.getListItemByIndex(o).item.name;this.isListElementMovable?this.ariaText=d+" grabbed, current position ":this.ariaText=d+" dropped, final position "}},t.prototype.onPropertyChange=function(t,n,i){var o=this;if("dataset"===t){if(!n&&this.binddatasource&&!this.datasource)return;this.onDataSetChange(n)}else if("datasource"===t)this.dataset&&this.onDataSetChange(this.dataset);else if("navigation"===t){if("Advanced"===n)return void(this.navigation="Classic");a.switchClass(this.nativeElement,n,i),this.onNavigationTypeChange(n),this.dataNavigator&&(this.dataNavigator.navigationClass=this.paginationclass)}else if("itemsperrow"===t)a.setListClass(this);else{if("tabindex"===t)return;"pulltorefresh"===t&&n?(this.app.notify("pullToRefresh:enable"),this.subscribeToPullToRefresh()):"paginationclass"===t?this.dataNavigator&&setTimeout((function(){return o.dataNavigator.navigationClass=n})):"pagesize"===t?(this.dataNavigator.options={maxResults:n},this.dataNavigator.widget.maxResults=n,this.dataNavigator.maxResults=n):"enablereorder"===t?n?(this.configureDnD(),this.$ulEle.sortable("enable")):this.$ulEle&&!n&&this.$ulEle.sortable("disable"):e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onItemClick=function(e,t){var n,i=this;if(!t.disableItem){if(this.firstSelectedItem=this.firstSelectedItem||t,n=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0,this.multiselect&&a.isMobile())this.checkSelectionLimit(n)||t.isActive?this.toggleListItemSelection(t):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if((e.ctrlKey||e.metaKey)&&this.multiselect)this.checkSelectionLimit(n)||t.isActive?(this.firstSelectedItem=this.lastSelectedItem=t,this.toggleListItemSelection(t)):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if(e.shiftKey&&this.multiselect){var o=t.context.index,r=this.firstSelectedItem.context.index;o>r&&(r=[o,o=r][0]),this.checkSelectionLimit(r-o)?(this.clearSelectedItems(),this.listItems.forEach((function(e){var t=e.context.index;t>=o&&t<=r&&i.toggleListItemSelection(e)})),this.lastSelectedItem=t):this.invokeEventCallback("selectionlimitexceed",{$event:e})}else(!t.isActive||n>1)&&(this.clearSelectedItems(),this.toggleListItemSelection(t),this.firstSelectedItem=this.lastSelectedItem=t);a.$appDigest()}},t.prototype.clear=function(){this.updateFieldDefs([])},t.prototype.getItemRefByIndexOrModel=function(e){return a.isNumber(e)?this.getListItemByIndex(e):this.getListItemByModel(e)},t.prototype.deselectItem=function(e){var t=this.getItemRefByIndexOrModel(e);t&&t.isActive&&this.toggleListItemSelection(t)},t.prototype.selectItem=function(e,t){var n=this.getItemRefByIndexOrModel(e);n&&(n.isActive||this.toggleListItemSelection(n,t),n.nativeElement.focus())},t.prototype.beforePaginationChange=function(e,t){this.invokeEventCallback("paginationchange",{$event:e,$index:t})},t.prototype.handleEvent=function(e,t,n,i){var o=this;_.includes(["click","tap","dblclick","doubletap"],t)&&this.eventManager.addEventListener(this.nativeElement,{tap:"click",doubletap:"dblclick"}[t]||t,(function(e){var n=$(e.target).closest(".app-list-item");if(n.length){var i=n.data("listItemContext");i.disableItem||o.invokeEventCallback(t,{widget:i,$event:e,item:i.item})}}))},t.prototype.subscribeToPullToRefresh=function(){var e=this;this._listenerDestroyers.push(this.app.subscribe("pulltorefresh",(function(){e.datasource&&e.datasource.listRecords&&e.datasource.listRecords()})))},t.prototype.ngOnInit=function(){var t=this;e.prototype.ngOnInit.call(this),this.handleHeaderClick=a.noop,setTimeout((function(){t.debouncedFetchNextDatasetOnScroll=t.paginationService.debouncedFetchNextDatasetOnScroll(t.dataNavigator,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME,t)}),0),this._items=[],this.fieldDefs=[],this.reorderProps={minIndex:null,maxIndex:null}},t.prototype.setUpCUDHandlers=function(){var e=this,t=document.getElementsByClassName("add-list-item")[0];t&&t.addEventListener("click",(function(t){e.create()}))},t.prototype.ngAfterViewInit=function(){var t=this;this.promiseResolverFn(),this.propsInitPromise.then((function(){e.prototype.ngAfterViewInit.call(t),t.setUpCUDHandlers(),t.selectedItemWidgets=t.multiselect?[]:{},t.enablereorder&&!t.groupby&&t.configureDnD(),t.groupby&&t.collapsible&&(t.handleHeaderClick=i.handleHeaderClick,t.toggleAllHeaders=i.toggleAllHeaders.bind(void 0,t)),a.setListClass(t)})),this.setupHandlers();var n=this.nativeElement.querySelector("ul.app-livelist-container");i.styler(n,this,i.APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER),a.isMobileApp()&&n.querySelector(".app-list-item-action-panel")&&(this._listAnimator=new f(this))},t.prototype.ngOnDestroy=function(){this._listAnimator&&this._listAnimator.$btnSubscription&&this._listAnimator.$btnSubscription.unsubscribe(),this._listenerDestroyers.forEach((function(e){return e&&e()})),e.prototype.ngOnDestroy.call(this)},t.prototype.ngOnDetach=function(){e.prototype.ngOnDetach.call(this),this._pageLoad=!0},t}(i.StylableComponent);v.initializeProps=h(),v.decorators=[{type:t.Component,args:[{selector:"div[wmList]",template:'<div class="panel-heading" *ngIf="title || subheading || iconclass">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon {{iconclass}}" aria-hidden="true" [hidden]="!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 </h3>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisablePrevious" aria-label="Page navigation" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="previous" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisablePrevious : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'prev\', $event)">\n <i class="wi wi-chevron-left" aria-hidden="true"></i>\n <span class="sr-only">Previous</span>\n </a>\n </li>\n </ul>\n</nav>\n<div *ngIf="navigation === \'Inline\' && !noDataFound" aria-live="polite" aria-atomic="true" class="sr-only"> {{\'Item \' + dataNavigator.dn.currentPage + \' of \' + dataNavigator.pageCount }}</div>\n\n<div>\n <div id={{titleId}} class="sr-only" >\n Press space bar to toggle drag drop mode, use arrow keys to move selected elements.\n </div>\n \n <div aria-live="assertive" *ngIf="listItems" class="sr-only" >\n {{ariaText + currentIndex + \' of \' + listItems.length}}\n </div> \n</div>\n\n<ul [attr.tabindex]="tabindex" [attr.aria-describedby] = "titleId" class="app-livelist-container clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}} {{listclass}}" role="list"\n (keydown.enter)="handleKeyDown($event, \'select\')"\n\n (keydown.space)="handleKeyDown($event, \'space\')"\n\n (keydown.arrowup)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowdown)="handleKeyDown($event, \'focusNext\')"\n (keydown.arrowleft)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowright)="handleKeyDown($event, \'focusNext\')"\n\n (keydown.shift.arrowup)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowdown)="handleKeyDown($event, \'selectNext\')"\n (keydown.shift.arrowleft)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowright)="handleKeyDown($event, \'selectNext\')"\n [hidden]="noDataFound && !variableInflight"\n>\n <ng-template [ngIf]="!groupby" [ngIfElse]="groupedListTemplate">\n <li *ngFor="let item of fieldDefs; index as $index; first as $first; last as $last;" class="app-list-item {{direction === \'horizontal\' ? \'\' : itemsPerRowClass}}" [ngClass]="listItemRef.itemClass"\n [wmListItem]="item"\n #listItemRef="listItemRef"\n [attr.tabindex]="tabindex"\n role="listitem">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ng-template>\n <ng-container [ngTemplateOutlet]="listLeftActionTemplate"></ng-container>\n <ng-container [ngTemplateOutlet]="listRightActionTemplate"></ng-container>\n</ul>\n\n<div class="no-data-msg" *ngIf="noDataFound && !variableInflight" [textContent]="nodatamessage"></div>\n\n<div class="loading-data-msg" *ngIf="variableInflight && !pulltorefresh">\n <span>\n <i class="app-icon panel-icon fa-spin" aria-hidden="true" [ngClass]="loadingicon"></i>\n <span class="sr-only">Loading</span>\n <span class="loading-text" [textContent]="loadingdatamsg"></span>\n </span>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisableNext" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="next" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisableNext : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'next\', $event)">\n <i class="wi wi-chevron-right" aria-hidden="true"></i>\n <span class="sr-only">Next</span>\n </a>\n </li>\n </ul>\n</nav>\n\n<div class="panel-footer" *ngIf="navigation !== \'None\'" [hidden]="!showNavigation || (onDemandLoad && dataNavigator.isDisableNext) || (dataNavigator.dataSize <= pagesize) || (!dataNavigator.dataSize && !dataNavigator.datasource?.pagination?.next)">\n <nav wmPagination\n navigationalign.bind="navigationalign"\n navigation.bind="navControls"\n showrecordcount.bind="showrecordcount"\n maxsize.bind="maxsize"\n boundarylinks.bind="boundarylinks"\n forceellipses.bind="forceellipses"\n directionlinks.bind="directionlinks"\n show.bind="!onDemandLoad"\n paginationchange.event="beforePaginationChange($event, $index)"\n ></nav>\n <a *ngIf="onDemandLoad" href="javascript:void(0);"\n (click)="dataNavigator.navigatePage(\'next\', $event)"\n class="app-button btn btn-block"\n [ngClass]="paginationclass"\n [textContent]="ondemandmessage"\n ></a>\n</div>\n\n\x3c!--This template will be displayed when groupby is specified--\x3e\n<ng-template #groupedListTemplate>\n <li *ngFor="let groupObj of groupedData" class="app-list-item-group clearfix">\n <ul [attr.tabindex]="tabindex" class="list-group item-group" [ngClass]="listclass">\n <li class="app-list-item-header list-item list-group-header" (click)="handleHeaderClick($event)" [ngClass]="{\'collapsible-content\': collapsible}">\n <h4>{{groupObj.key}}\n <div class="header-action">\n <i class="app-icon wi action wi-chevron-up" *ngIf="collapsible"></i>\n <span *ngIf="showcount" class="label label-default">{{groupObj.data.length}}</span>\n </div>\n </h4>\n </li>\n <ul class="list-group clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}}">\n <li *ngFor="let item of groupObj.data; index as $index; first as $first; last as $last;" [attr.tabindex]="tabindex"\n class="app-list-item group-list-item {{itemsPerRowClass}}"\n [ngClass]="listItemRef.itemClass"\n [wmListItem]="item" #listItemRef="listItemRef">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ul>\n </ul>\n </li>\n</ng-template>\n',providers:[i.provideAsWidgetRef(v)]}]}],v.ctorParameters=function(){return[{type:t.Injector},{type:t.ChangeDetectorRef},{type:i.ToDatePipe},{type:a.App},{type:a.AppDefaults},{type:t.NgZone},{type:String,decorators:[{type:t.Attribute,args:["itemclass.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["disableitem.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["datasource.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseenter.event"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseleave.event"]}]},{type:a.StatePersistence},{type:a.PaginationService}]},v.propDecorators={listTemplate:[{type:t.ContentChild,args:["listTemplate"]}],listLeftActionTemplate:[{type:t.ContentChild,args:["listLeftActionTemplate"]}],listRightActionTemplate:[{type:t.ContentChild,args:["listRightActionTemplate"]}],btnComponents:[{type:t.ContentChildren,args:[r.ButtonComponent]}],dataNavigator:[{type:t.ViewChild,args:[o.PaginationComponent]}],listItems:[{type:t.ViewChildren,args:[m]}]};var y=[v,m],b=function(){};b.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,o.PaginationModule,i.WmComponentsModule],declarations:u([],d(y)),exports:u([],d(y)),entryComponents:[]}]}],e.ListComponent=v,e.ListItemDirective=m,e.ListModule=b,e["\u0275a"]=h,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/tooltip"),require("ngx-bootstrap/dropdown"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/input"),require("@wm/components/navigation/menu"),require("@wm/components/data/list"),require("@wm/components/data/pagination"),require("@wm/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@wm/components/data/table",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/tooltip","ngx-bootstrap/dropdown","@wm/components/base","@wm/components/basic","@wm/components/input","@wm/components/navigation/menu","@wm/components/data/list","@wm/components/data/pagination","@wm/core","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.data=e.wm.components.data||{},e.wm.components.data.table={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].tooltip,e["ngx-bootstrap"].dropdown,e.wm.components.base,e.wm.components.basic,e.wm.components.input,e.wm.components.navigation.menu,e.wm.components.data.list,e.wm.components.data.pagination,e.wm.core,e.rxjs,e.rxjs.operators)}(this,(function(e,t,n,i,o,a,r,s,l,c,p,d,u,h,m){"use strict";
|
|
507
507
|
/*! *****************************************************************************
|
|
508
508
|
Copyright (c) Microsoft Corporation.
|
|
509
509
|
|
|
@@ -44707,7 +44707,7 @@
|
|
|
44707
44707
|
ListComponent.prototype.handleKeyDown = function($event, action) {
|
|
44708
44708
|
var _this = this;
|
|
44709
44709
|
$event.stopPropagation();
|
|
44710
|
-
if ($event.keyCode !== 13 && $event.keyCode !== 9 && !(
|
|
44710
|
+
if ($event.keyCode !== 13 && $event.keyCode !== 9 && !($event.target.classList.contains("form-control") && $event.keyCode === 32)) {
|
|
44711
44711
|
$event.preventDefault();
|
|
44712
44712
|
}
|
|
44713
44713
|
var listItems = this.listItems;
|
|
@@ -503,7 +503,7 @@ var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
503
503
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
504
504
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
505
505
|
PERFORMANCE OF THIS SOFTWARE.
|
|
506
|
-
***************************************************************************** */var c=function(e,t){return(c=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 p(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}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var h=function(){i.register("wm-list",new Map([["boundarylinks",Object.assign({value:!1},i.PROP_BOOLEAN)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dateformat",i.PROP_STRING],["dataset",i.PROP_ANY],["datasource",i.PROP_ANY],["direction",Object.assign({value:"vertical"},i.PROP_STRING)],["directionlinks",Object.assign({value:!0},i.PROP_BOOLEAN)],["disableitem",i.PROP_BOOLEAN],["enablereorder",i.PROP_BOOLEAN],["forceellipses",Object.assign({value:!0},i.PROP_BOOLEAN)],["groupby",i.PROP_STRING],["iconclass",i.PROP_STRING],["itemclass",Object.assign({value:""},i.PROP_STRING)],["itemsperrow",i.PROP_STRING],["listclass",Object.assign({value:"list-group"},i.PROP_STRING)],["multiselect",i.PROP_BOOLEAN],["loadingdatamsg",Object.assign({value:"Loading..."},i.PROP_STRING)],["loadingicon",Object.assign({value:"fa fa-circle-o-notch"},i.PROP_STRING)],["match",i.PROP_STRING],["maxsize",Object.assign({value:5},i.PROP_NUMBER)],["name",i.PROP_STRING],["navigation",i.PROP_STRING],["navigationalign",Object.assign({value:"left"},i.PROP_STRING)],["nodatamessage",Object.assign({value:"No data found"},i.PROP_STRING)],["ondemandmessage",Object.assign({value:"Load More"},i.PROP_STRING)],["orderby",i.PROP_STRING],["paginationclass",i.PROP_STRING],["pagesize",i.PROP_NUMBER],["pulltorefresh",Object.assign({value:r.isMobileApp()},i.PROP_BOOLEAN)],["selectfirstitem",i.PROP_BOOLEAN],["selectionlimit",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showcount",i.PROP_BOOLEAN],["showrecordcount",i.PROP_BOOLEAN],["statehandler",Object.assign({value:"none"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]))},m=function(){function e(e,t,n){this.inj=e,this.app=n,this.destroy=new s.Subject,this.destroy$=this.destroy.asObservable(),this.itemClass="",this._currentItemWidgets={},this.isActive=!1,this.disableItem=!1,this.nativeElement=t.nativeElement,this.listComponent=e.view.component,this.context=e.view.context,this.itemClassWatcher(this.listComponent),this.disableItemWatcher(this.listComponent),$(this.nativeElement).data("listItemContext",this)}return e.prototype.onFocus=function(){this.listComponent.lastSelectedItem=this},Object.defineProperty(e.prototype,"$index",{get:function(){return this.context.index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$even",{get:function(){return this.context.even},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$odd",{get:function(){return this.context.odd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$first",{get:function(){return this.context.first},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$last",{get:function(){return this.context.last},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentItemWidgets",{get:function(){var e=Array.from(this.nativeElement.querySelectorAll("[widget-id]"));return Object.assign(this._currentItemWidgets,e.reduce((function(e,t){return e[t.widget.name]=t.widget,e}),{}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wmListItem",{set:function(e){this.item=e},enumerable:!1,configurable:!0}),e.prototype.registerWatch=function(e,t){this.destroy$.subscribe(r.$watch(e,this.listComponent.viewParent,this,t))},e.prototype.itemClassWatcher=function(e){var t=this;e.binditemclass?this.registerWatch(e.binditemclass,(function(e){return t.itemClass=e||""})):this.itemClass=e.itemclass},e.prototype.disableItemWatcher=function(e){var t=this;e.binddisableitem?this.registerWatch(e.binddisableitem,(function(e){return t.disableItem=e||!1})):this.disableItem=e.disableitem||!1},e.prototype.setUpCUDHandlers=function(){var e=this,t=this.nativeElement.querySelector(".edit-list-item"),n=this.nativeElement.querySelector(".delete-list-item");t&&t.addEventListener("click",(function(t){e.listComponent.update()})),n&&n.addEventListener("click",(function(t){e.listComponent.delete()}))},e.prototype.ngOnInit=function(){var e=this;this.listComponent.mouseEnterCB&&this.nativeElement.addEventListener("mouseenter",(function(t){e.listComponent.invokeEventCallback("mouseenter",{widget:e,$event:t})})),this.listComponent.mouseLeaveCB&&this.nativeElement.addEventListener("mouseleave",(function(t){e.listComponent.invokeEventCallback("mouseleave",{widget:e,$event:t})})),$(this.nativeElement).attr("listitemindex",this.$index)},e.prototype.ngAfterViewInit=function(){this.setUpCUDHandlers()},e}();m.decorators=[{type:t.Directive,args:[{selector:"[wmListItem]",exportAs:"listItemRef"}]}],m.ctorParameters=function(){return[{type:t.Injector},{type:t.ElementRef},{type:r.App}]},m.propDecorators={isActive:[{type:t.HostBinding,args:["class.active"]}],disableItem:[{type:t.HostBinding,args:["class.disable-item"]}],onFocus:[{type:t.HostListener,args:["focus"]}],wmListItem:[{type:t.Input}]};var f=function(e){function t(t){var n=e.call(this)||this;return n.list=t,n.$el=$(n.list.getNativeElement()).find("ul.app-livelist-container").first(),n.leftChildrenCount=n.$el.find(">.app-list-item-left-action-panel > button:visible").length,n.rightChildrenCount=n.$el.find(">.app-list-item-right-action-panel > button:visible").length,n.leftChildrenCount||n.rightChildrenCount?(n.init(n.$el),n.$btnSubscription=n.list.btnComponents.changes.subscribe((function(e){return n.actionItems=e})),n):n}return p(t,e),t.prototype.createActionPanel=function(e,t){return t.css({width:e.outerWidth()+"px",height:e.outerHeight()+"px",marginBottom:-1*e.outerHeight()+"px",float:"left",padding:0}),t.insertBefore(e)},t.prototype.computeTotalChildrenWidth=function(e){return _.reduce(e.children(),(function(e,t){return e+$(t).outerWidth()}),0)},t.prototype.computeTransitionProportions=function(e){var t=this.computeTotalChildrenWidth(e),n="right"===this.position,i=0;return _.map(e.children(),(function(e){var o=(t-i)/t;return i+=$(e).outerWidth(),n?o:i/t}))},t.prototype.resetElement=function(e){e&&e.css({transform:"none",transition:"none"})},t.prototype.resetState=function(){this.resetElement(this.li),this.resetElement(this.actionPanel),this.actionPanel&&(this.actionPanel=null)},t.prototype.getChildActionElement=function(e){if(e.children().length)return"left"===this.position?e.children().first():e.children().last()},t.prototype.initActionPanel=function(e){this.actionPanel=this.createActionPanel(this.li,e),this.actionPanel.css({backgroundColor:this.getChildActionElement(this.actionPanel).css("background-color")}),this.limit=this.computeTotalChildrenWidth(this.actionPanel),this.transitionProportions=this.computeTransitionProportions(this.actionPanel)},t.prototype.bounds=function(e,t){var n=$(e.target).closest("li"),i={strictUpper:!0,strictLower:!0,lower:0,center:0,upper:0};if(!n.hasClass("app-list-item"))return i;if(this.li&&this.li[0]===n[0])"left"===this.position?i={strictUpper:!1,lower:-this.limit,center:this.limit}:"right"===this.position&&(i={center:-this.limit,upper:this.limit,strictLower:!1});else{var o=t>0?".app-list-item-left-action-panel":".app-list-item-right-action-panel",r=this.$el.find(">"+o);if(!r.length&&this.list.groupby&&(o="li > ul.list-group >"+o,r=this.$el.find(">"+o)),!r.length||!r.find("button:visible").length)return i;this.resetState(),this.li=n,this.position=r.attr("position"),this.initActionPanel(r),i=t>0?{strictUpper:!1,lower:0,center:0,upper:this.limit}:{strictLower:!1,lower:-this.limit,center:0,upper:0}}return i},t.prototype.context=function(){var e=this;return{computeActionTransition:function(t,n){var i=n>0?1:-1;return i*n>e.limit?n-i*e.limit+e.transitionProportions[t]*i*e.limit:e.transitionProportions[t]*n}}},t.prototype.animation=function(){var e=this;return[{target:function(){return e.li},css:{transform:"translate3d(${{$D + $d}}px, 0, 0)"}},{target:function(){return e.actionPanel&&e.actionPanel.children()},css:{transform:"translate3d(${{computeActionTransition($i, $D + $d)}}px, 0, 0)"}}]},t.prototype.invokeFullSwipeEvt=function(e){var t,n,i;"left"===this.position?(n=this.actionItems.filter((function(e){return"left"===e.getAttr("swipe-position")&&e.$element.is(":visible")})),i=0):i=(n=this.actionItems.filter((function(e){return"right"===e.getAttr("swipe-position")&&e.$element.is(":visible")}))).length-1,(t=n[i])&&t.hasEventCallback("tap")&&t.invokeEventCallback("tap",{$event:e}),this.resetState(),this.li=null},t.prototype.onAnimation=function(e,t){if(this.list.triggerListItemSelection(this.li,e),this.actionPanel&&"true"===this.actionPanel.attr("enablefullswipe")){var n=t>0?1:-1,i=this.getChildActionElement(this.actionPanel);if(i){var o="right"===this.position?this.rightChildrenCount-1:0;this.transitionProportions[o]*n*t*100/(this.li.outerWidth()-this.limit+i.width())>50&&this.invokeFullSwipeEvt(e)}}},t.prototype.onLower=function(){"left"===this.position&&(this.resetState(),this.li=null)},t.prototype.onUpper=function(){"right"===this.position&&(this.resetState(),this.li=null)},t.prototype.threshold=function(){return 10},t}(l.SwipeAnimation),g={widgetType:"wm-list",hostClass:"app-livelist app-panel"},v=function(e){function t(t,n,o,a,s,l,c,p,u,d,h,m,f,v){var y=this,b=r.noop,w=new Promise((function(e){return b=e}));return(y=e.call(this,t,g,w)||this).propsInitPromise=w,y.promiseResolverFn=b,i.styler(y.nativeElement,y,i.APPLY_STYLES_TYPE.SHELL),y.cdRef=n,y.ngZone=l,y.datePipe=o,y.statePersistence=f,y.paginationService=v,y._pageLoad=!0,y.binditemclass=c,y.binddisableitem=p,y.binddataset=u,y.mouseEnterCB=h,y.mouseLeaveCB=m,y.binddatasource=d,y.app=a,y.appDefaults=s,y.variableInflight=!1,y.noDataFound=!u,y.titleId="wmlist-"+r.generateGUId(),y._listenerDestroyers=[y.app.subscribe("check-state-persistence-options",(function(e){var t=_.get(y.datasource,"name");t||(t=i.extractDataSourceName(y.binddatasource)),_.get(e,"variable.name")===t&&y.handleStateParams(e)})),y.app.subscribe("toggle-variable-state",y.handleLoading.bind(y)),y.app.subscribe("setup-cud-listener",(function(e){y.nativeElement.getAttribute("name")===e&&(y._isDependent=!0)}))],y}return p(t,e),Object.defineProperty(t.prototype,"selecteditem",{get:function(){return this.multiselect?r.getClonedObject(this._items):_.isEmpty(this._items)?{}:r.getClonedObject(this._items[0])},set:function(e){var t=this;this._items.length=0,this.deselectListItems(),_.isArray(e)?e.forEach((function(e){return t.selectItem(e)})):this.selectItem(e),r.$appDigest()},enumerable:!1,configurable:!0}),t.prototype.getWidgets=function(e,t){var n,i=[];if(e)return r.isDefined(t)?(t=+t||0,(n=_.get(this.listItems.toArray(),t))?[_.get(n.currentItemWidgets,e)]:void 0):(_.forEach(this.listItems.toArray(),(function(t){(n=_.get(t.currentItemWidgets,e))&&i.push(n)})),i)},t.prototype.getItem=function(e){return this.getListItemByIndex(e)},t.prototype.getIndex=function(e){return e instanceof m?this.getListItemIndex(e):e?this.fieldDefs.findIndex((function(t){return _.isEqual(t,e)})):void 0},t.prototype.getConfiguredState=function(){var e=this.statePersistence.computeMode(this.statehandler);return e&&e.toLowerCase()},t.prototype.handleStateParams=function(e){if(this._pageLoad&&"none"!==this.getConfiguredState()){this._pageLoad=!1;var t=this.statePersistence.getWidgetState(this);_.get(t,"pagination")&&(e.options=e.options||{},e.options.page=t.pagination),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}},t.prototype.triggerWMEvent=function(e,t){r.$invokeWatchers(!0);var n=this.multiselect?_.last(this.selecteditem):this.selecteditem;t&&(n=t),this.app.notify("wm-event",{eventName:e,widgetName:this.name,row:n})},t.prototype.create=function(){this._isDependent&&this.triggerWMEvent("insert")},t.prototype.editRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("update",t)}},t.prototype.update=function(e){this.editRow(e)},t.prototype.deleteRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("delete",t)}},t.prototype.delete=function(e){this.deleteRow(e)},t.prototype.handleLoading=function(e){var t=this,n=this.datasource;n&&n.execute(r.DataSource.Operation.IS_API_AWARE)&&r.isDataSourceEqual(e.variable,n)&&this.ngZone.run((function(){var n,i,o;t.handleStateParams(e),t.variableInflight=e.active;var r=null===(i=null===(n=e.data)||void 0===n?void 0:n.pagination)||void 0===i?void 0:i.totalElements;_.isUndefined(r)?t.noDataFound=_.isEmpty(null===(o=e.data)||void 0===o?void 0:o.data):t.noDataFound=0===r}))},t.prototype.resetNavigation=function(){this.showNavigation=!1,this.navControls=void 0,this.infScroll=!1,this.onDemandLoad=!1},t.prototype.enableBasicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.BASIC,this.showNavigation=!0},t.prototype.enableInlineNavigation=function(){this.navControls=i.NAVIGATION_TYPE.INLINE},t.prototype.enableClassicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.CLASSIC,this.showNavigation=!0},t.prototype.enablePagerNavigation=function(){this.navControls=i.NAVIGATION_TYPE.PAGER,this.showNavigation=!0},t.prototype.setNavigationTypeNone=function(){this.navControls=i.NAVIGATION_TYPE.NONE,this.showNavigation=!1},t.prototype.enableInfiniteScroll=function(){this.infScroll=!0},t.prototype.enableOnDemandLoad=function(){this.onDemandLoad=!0,this.showNavigation=!0},t.prototype.onNavigationTypeChange=function(e){switch(this.resetNavigation(),e){case i.NAVIGATION_TYPE.BASIC:this.enableBasicNavigation();break;case i.NAVIGATION_TYPE.INLINE:this.enableInlineNavigation();break;case i.NAVIGATION_TYPE.ADVANCED:case i.NAVIGATION_TYPE.CLASSIC:this.enableClassicNavigation();break;case i.NAVIGATION_TYPE.PAGER:this.enablePagerNavigation();break;case i.NAVIGATION_TYPE.NONE:this.setNavigationTypeNone();break;case i.NAVIGATION_TYPE.SCROLL:this.enableInfiniteScroll();break;case i.NAVIGATION_TYPE.ONDEMAND:this.enableOnDemandLoad()}},t.prototype.updateFieldDefs=function(e){var t;this.infScroll||this.onDemandLoad?(t=u(this.paginationService.updateFieldsOnPagination(this,e),2),this.fieldDefs=t[0],this.currentPage=t[1]):this.fieldDefs=e,this.orderby&&(this.fieldDefs=i.getOrderedDataset(this.fieldDefs,this.orderby)),this.groupby&&(this.groupedData=i.groupData(this,this.fieldDefs,this.groupby,this.match,this.orderby,this.dateformat,this.datePipe,void 0,this.appDefaults)),this.fieldDefs.length||(this.noDataFound=!0,this.selecteditem=void 0),r.$appDigest(),this.listItems.setDirty()},t.prototype.onDataChange=function(e){_.isEmpty(e)?this.updateFieldDefs([]):(this.noDataFound=!1,this.isDataChanged=!0,this.datasource&&this.datasource.execute(r.DataSource.Operation.IS_API_AWARE)&&(e=_.cloneDeep(e)),r.isObject(e)&&!_.isArray(e)&&(e=_.isEmpty(e)?[]:[e]),_.isString(e)&&(e=e.split(",")),this.datasource&&"App"===this.datasource.owner&&(this.infScroll||this.onDemandLoad)&&!this.currentPage&&this.datasource.execute(r.DataSource.Operation.GET_PAGING_OPTIONS).number>0&&(e=this.datasource.execute(r.DataSource.Operation.LIST_RECORDS,{page:1})),_.isArray(e)&&(e.length&&this.invokeEventCallback("beforedatarender",{$data:e}),this.updateFieldDefs(e)))},t.prototype.setupDataSource=function(){var e=this,t=this.dataNavigator;t.options={maxResults:this.pagesize||20},this.dataNavigatorWatched=!0,this.navigatorResultWatch&&this.navigatorResultWatch.unsubscribe(),this.navigatorResultWatch=t.resultEmitter.subscribe((function(t){e.onDataChange(t)}),!0),this.navigatorMaxResultWatch&&this.navigatorMaxResultWatch.unsubscribe(),this.navigatorMaxResultWatch=t.maxResultsEmitter.subscribe((function(t){e.pagesize=t})),t.maxResults=this.pagesize||20,this.removePropertyBinding("dataset");var n=this.getAttr("datasetboundexpr");this.dataNavigator.setBindDataSet(this.binddataset,this.viewParent,n?this.context:this.datasource,this.dataset,this.binddatasource,n,this.statehandler)},t.prototype.onDataSetChange=function(e){if("wm.Variable"===_.get(this.datasource,"category")&&"none"!==this.getConfiguredState()&&this._pageLoad){var t=this.statePersistence.getWidgetState(this);this._pageLoad=!1,_.get(t,"pagination")&&this.dataNavigator.pageChanged({page:t.pagination},!0),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}this.dataNavigatorWatched?this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE&&this.dataNavigator.setDataSource(this.datasource):this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE?this.setupDataSource():this.onDataChange(e)},t.prototype.deselectListItems=function(){this.listItems.forEach((function(e){return e.isActive=!1}))},t.prototype.clearSelectedItems=function(){this.deselectListItems(),this._items.length=0,r.$appDigest()},t.prototype.getListItemByModel=function(e){var t=this;return this.listItems.find((function(n){var i=n.item;if(t.groupby&&!_.has(e,"_groupIndex")&&delete(i=_.clone(i))._groupIndex,_.isEqual(i,e))return!0}))||null},t.prototype.updateSelectedItemsWidgets=function(e){var t,n=this,o={},r=_.get(this.dataNavigator,"dn.currentPage")||1;"none"!==this.getConfiguredState()&&(t=this.statePersistence.getWidgetState(this)||{},_.get(t,"selectedItem")&&(this.multiselect&&1===this.selecteditem.length?t.selectedItem=[]:_.remove(t.selectedItem,(function(e){return e.page===r})))),this.multiselect&&(this.selectedItemWidgets.length=0),this.listItems.forEach((function(e,i){e.isActive&&(n.multiselect?n.selectedItemWidgets.push(e.currentItemWidgets):n.selectedItemWidgets=e.currentItemWidgets,o={page:r,index:i},_.get(t,"selectedItem")&&n.multiselect?_.some(t.selectedItem,o)||t.selectedItem.push(o):t.selectedItem=[o])})),"none"===this.getConfiguredState()||e||(i.unsupportedStatePersistenceTypes.indexOf(this.navigation)<0?(this.statePersistence.removeWidgetState(this,"selectedItem"),this.statePersistence.setWidgetState(this,{selectedItem:t.selectedItem})):console.warn("Retain State handling on Widget "+this.name+" is not supported for current pagination type."))},t.prototype.toggleListItemSelection=function(e,t){if(e&&!e.disableItem){var n=e.item;this.groupby&&_.has(n,"_groupIndex")&&delete(n=_.clone(n))._groupIndex,e.isActive?(this._items=_.pullAllWith(this._items,[n],_.isEqual),e.isActive=!1):(this.multiselect||this.clearSelectedItems(),this._items.push(n),this.invokeEventCallback("select",{widget:e,$data:n}),e.isActive=!0),this.updateSelectedItemsWidgets(t)}},t.prototype.onListRender=function(e){var t=this;if(this.isDataChanged&&(r.$invokeWatchers(!0),this.invokeEventCallback("render",{$data:this.fieldDefs})),this.isDataChanged&&"none"!==this.getConfiguredState()&&e.length&&this._selectedItemsExist){var n=this.statePersistence.getWidgetState(this);if(_.get(n,"selectedItem")){this._selectedItemsExist=!1;var o=_.isArray(this.selecteditem)?this.selecteditem.length:_.toNumber(!_.isEmpty(this.selecteditem)),a=_.get(this.dataNavigator,"dn.currentPage")||1;n.pagination=n.pagination||1,o!==n.selectedItem.length&&n.pagination===a&&n.selectedItem.forEach((function(e){e.page===a&&t.selectItem(e.index,!0)}))}}var s=_.isArray(this.selecteditem)?this.selecteditem:[this.selecteditem];if(this.firstSelectedItem=this.lastSelectedItem=null,!e.length||!this.selectfirstitem||this._items.length&&this.multiselect||!1===this._selectedItemsExist)this.deselectListItems(),s.forEach((function(e){var n=t.getListItemByModel(e);n&&(n.isActive=!0,t.lastSelectedItem=n,n.nativeElement.focus())}));else{var l=e.first;l.disableItem||!this.isDataChanged||(this.infScroll||this.onDemandLoad)&&this._items.length||(this.clearSelectedItems(),this.firstSelectedItem=this.lastSelectedItem=l,this.selectItem(0))}if(this.fieldDefs.length&&this.infScroll){var c=this.$element.closest("[wmsmoothscroll]");if(r.isMobileApp()&&c.length&&"true"===c.attr("wmsmoothscroll"))this.paginationService.bindIScrollEvt(this,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);else{var p=this.$element.closest(".modal-body"),u=this.$element.find("ul").height(),d=window.innerHeight-140;r.isMobile()&&p.length&&u>d&&this.$element.css("height",d+"px"),this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME)}}this.isDataChanged=!1},t.prototype.triggerListItemSelection=function(e,t){if(e&&e[0]){var n=e.data("listItemContext");n.listComponent===this&&this.onItemClick(t,n)}},t.prototype.setupHandlers=function(){var e=this;this.listItems.changes.subscribe((function(t){e.onListRender(t),e.cdRef.detectChanges()})),this.nativeElement.querySelector("ul.app-livelist-container").addEventListener("click",(function(t){for(var n=$(t.target).closest(".app-list-item");n.get(0)&&n.closest("ul.app-livelist-container").get(0)!==t.currentTarget;)n=n.parent().closest(".app-list-item");e.triggerListItemSelection(n,t)}),!0)},t.prototype.onReorderStart=function(e,t){t.placeholder.height(t.item.height()),this.$ulEle.data("oldIndex",t.item.index())},t.prototype.onSort=function(e,t){if(this.infScroll){var n=this.$ulEle.find("[listitemindex="+(this.fieldDefs.length-1)+"]").offset();n&&n.top<t.offset.top&&(this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME),this.debouncedFetchNextDatasetOnScroll())}},t.prototype.onUpdate=function(e,t){var n=this.fieldDefs,i=t.item.index(),o=this.$ulEle.data("oldIndex"),r=_.min([i,o]),a=_.max([i,o]),s=_.pullAt(n,o)[0];if(s){"none"!==this.getConfiguredState()&&this.statePersistence.removeWidgetState(this,"selectedItem"),this.reorderProps.minIndex=_.min([r,this.reorderProps.minIndex]),this.reorderProps.maxIndex=_.max([a,this.reorderProps.maxIndex]),n.splice(i,0,s),this.cdRef.markForCheck(),this.cdRef.detectChanges();var l={oldIndex:o,newIndex:i,item:n[i]};this.invokeEventCallback("reorder",{$event:e,$data:n,$changedItem:l}),this.$ulEle.removeData("oldIndex")}},t.prototype.configureDnD=function(){var e,t=$(document).find(".modal");e=this.getAttr("height")?"parent":t.length?t[t.length-1]:"body";var n=r.isMobileApp()?{}:{appendTo:e},o=$(this.nativeElement);this.$ulEle=o.find(".app-livelist-container"),i.configureDnD(this.$ulEle,n,this.onReorderStart.bind(this),this.onUpdate.bind(this),this.onSort.bind(this)),this.$ulEle.droppable({accept:".app-list-item"}),r.isMobileApp()&&(this.$ulEle.sortable("disable"),this.$ulEle.on("touchstart",(function(e){var t=this;t.touching||(t.touched&&clearTimeout(t.touched),setTimeout((function(){e.cancelable&&e.preventDefault()}),50),t.touched=setTimeout((function(){$(e.currentTarget).addClass("no-selection"),$(e.currentTarget).sortable("enable"),t.touching=!0,$(t).trigger(e)}),350))})).on("touchend",(function(e){this.touching=!1,$(e.currentTarget).removeClass("no-selection"),$(e.currentTarget).sortable("disable"),clearTimeout(this.touched)})).on("touchmove",(function(){clearTimeout(this.touched)})))},t.prototype.checkSelectionLimit=function(e){return!this.selectionlimit||e<this.selectionlimit},t.prototype.getListItemByIndex=function(e){return this.listItems.toArray()[e]},t.prototype.getListItemIndex=function(e){return this.listItems.toArray().indexOf(e)},t.prototype.execute=function(e,t){return![r.DataSource.Operation.IS_API_AWARE,r.DataSource.Operation.IS_PAGEABLE,r.DataSource.Operation.SUPPORTS_SERVER_FILTER].includes(e)&&this.datasource.execute(e,t)},t.prototype.handleKeyDown=function(e,t){var n=this;e.stopPropagation(),13===e.keyCode||9===e.keyCode||(e.target.classList.contains("form-control")||e.target.classList.contains("note-editable"))&&32===e.keyCode||e.preventDefault();var i=this.listItems,o=this.getListItemIndex(this.lastSelectedItem);if(this.multiselect){var r=this.getListItemIndex(this.firstSelectedItem),a=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0;"selectPrev"===t?o>0&&(o<=r&&this.checkSelectionLimit(a)?(this.lastSelectedItem=this.getListItemByIndex(o-1),this.toggleListItemSelection(this.lastSelectedItem)):o>r?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o-1)):this.invokeEventCallback("selectionlimitexceed",{$event:e})):"selectNext"===t&&o<i.length-1&&(o>=r&&this.checkSelectionLimit(a)?(this.lastSelectedItem=this.getListItemByIndex(o+1),this.toggleListItemSelection(this.lastSelectedItem)):o<r?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o+1)):this.invokeEventCallback("selectionlimitexceed",{$event:e}))}if("focusPrev"===t)if(this.isListElementMovable){var s;if(o=o<=0?0:o,this.lastSelectedItem=this.getListItemByIndex(o),0===o)return void(s=this.listItems.last);this.listItems.forEach((function(e,t){if(t===o){s.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),r=i[o];i[o]=i[o-1],i[o-1]=r,n.listItems.reset(i),n.currentIndex=o,n.ariaText="selected "}s=e}))}else o=o<=0?0:o-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("focusNext"===t)if(this.isListElementMovable){var l;if(o=o<i.length-1?o:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),o===this.listItems.length-1)return void(l=this.listItems.first);this.listItems.forEach((function(e,t){if(t===o+1){l.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),r=i[o+1];i[o+1]=i[o],i[o]=r,n.listItems.reset(i),n.currentIndex=t+1,n.ariaText="selected "}l=e}))}else o=o<i.length-1?o+1:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("select"===t){if(-1===o||!$(e.target).closest(this.lastSelectedItem.nativeElement)){var c=$(e.target).closest("li.app-list-item"),p=c.closest("ul.app-livelist-container");o=p.find("li.app-list-item").index(c)}this.onItemClick(e,this.getListItemByIndex(o))}else if("space"===t){if(!this.enablereorder)return;this.isListElementMovable=!this.isListElementMovable,this.onItemClick(e,this.getListItemByIndex(o)),this.currentIndex=o+1;var u=this.getListItemByIndex(o).item.name;this.isListElementMovable?this.ariaText=u+" grabbed, current position ":this.ariaText=u+" dropped, final position "}},t.prototype.onPropertyChange=function(t,n,i){var o=this;if("dataset"===t){if(!n&&this.binddatasource&&!this.datasource)return;this.onDataSetChange(n)}else if("datasource"===t)this.dataset&&this.onDataSetChange(this.dataset);else if("navigation"===t){if("Advanced"===n)return void(this.navigation="Classic");r.switchClass(this.nativeElement,n,i),this.onNavigationTypeChange(n),this.dataNavigator&&(this.dataNavigator.navigationClass=this.paginationclass)}else if("itemsperrow"===t)r.setListClass(this);else{if("tabindex"===t)return;"pulltorefresh"===t&&n?(this.app.notify("pullToRefresh:enable"),this.subscribeToPullToRefresh()):"paginationclass"===t?this.dataNavigator&&setTimeout((function(){return o.dataNavigator.navigationClass=n})):"pagesize"===t?(this.dataNavigator.options={maxResults:n},this.dataNavigator.widget.maxResults=n,this.dataNavigator.maxResults=n):"enablereorder"===t?n?(this.configureDnD(),this.$ulEle.sortable("enable")):this.$ulEle&&!n&&this.$ulEle.sortable("disable"):e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onItemClick=function(e,t){var n,i=this;if(!t.disableItem){if(this.firstSelectedItem=this.firstSelectedItem||t,n=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0,this.multiselect&&r.isMobile())this.checkSelectionLimit(n)||t.isActive?this.toggleListItemSelection(t):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if((e.ctrlKey||e.metaKey)&&this.multiselect)this.checkSelectionLimit(n)||t.isActive?(this.firstSelectedItem=this.lastSelectedItem=t,this.toggleListItemSelection(t)):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if(e.shiftKey&&this.multiselect){var o=t.context.index,a=this.firstSelectedItem.context.index;o>a&&(a=[o,o=a][0]),this.checkSelectionLimit(a-o)?(this.clearSelectedItems(),this.listItems.forEach((function(e){var t=e.context.index;t>=o&&t<=a&&i.toggleListItemSelection(e)})),this.lastSelectedItem=t):this.invokeEventCallback("selectionlimitexceed",{$event:e})}else(!t.isActive||n>1)&&(this.clearSelectedItems(),this.toggleListItemSelection(t),this.firstSelectedItem=this.lastSelectedItem=t);r.$appDigest()}},t.prototype.clear=function(){this.updateFieldDefs([])},t.prototype.getItemRefByIndexOrModel=function(e){return r.isNumber(e)?this.getListItemByIndex(e):this.getListItemByModel(e)},t.prototype.deselectItem=function(e){var t=this.getItemRefByIndexOrModel(e);t&&t.isActive&&this.toggleListItemSelection(t)},t.prototype.selectItem=function(e,t){var n=this.getItemRefByIndexOrModel(e);n&&(n.isActive||this.toggleListItemSelection(n,t),n.nativeElement.focus())},t.prototype.beforePaginationChange=function(e,t){this.invokeEventCallback("paginationchange",{$event:e,$index:t})},t.prototype.handleEvent=function(e,t,n,i){var o=this;_.includes(["click","tap","dblclick","doubletap"],t)&&this.eventManager.addEventListener(this.nativeElement,{tap:"click",doubletap:"dblclick"}[t]||t,(function(e){var n=$(e.target).closest(".app-list-item");if(n.length){var i=n.data("listItemContext");i.disableItem||o.invokeEventCallback(t,{widget:i,$event:e,item:i.item})}}))},t.prototype.subscribeToPullToRefresh=function(){var e=this;this._listenerDestroyers.push(this.app.subscribe("pulltorefresh",(function(){e.datasource&&e.datasource.listRecords&&e.datasource.listRecords()})))},t.prototype.ngOnInit=function(){var t=this;e.prototype.ngOnInit.call(this),this.handleHeaderClick=r.noop,setTimeout((function(){t.debouncedFetchNextDatasetOnScroll=t.paginationService.debouncedFetchNextDatasetOnScroll(t.dataNavigator,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME,t)}),0),this._items=[],this.fieldDefs=[],this.reorderProps={minIndex:null,maxIndex:null}},t.prototype.setUpCUDHandlers=function(){var e=this,t=document.getElementsByClassName("add-list-item")[0];t&&t.addEventListener("click",(function(t){e.create()}))},t.prototype.ngAfterViewInit=function(){var t=this;this.promiseResolverFn(),this.propsInitPromise.then((function(){e.prototype.ngAfterViewInit.call(t),t.setUpCUDHandlers(),t.selectedItemWidgets=t.multiselect?[]:{},t.enablereorder&&!t.groupby&&t.configureDnD(),t.groupby&&t.collapsible&&(t.handleHeaderClick=i.handleHeaderClick,t.toggleAllHeaders=i.toggleAllHeaders.bind(void 0,t)),r.setListClass(t)})),this.setupHandlers();var n=this.nativeElement.querySelector("ul.app-livelist-container");i.styler(n,this,i.APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER),r.isMobileApp()&&n.querySelector(".app-list-item-action-panel")&&(this._listAnimator=new f(this))},t.prototype.ngOnDestroy=function(){this._listAnimator&&this._listAnimator.$btnSubscription&&this._listAnimator.$btnSubscription.unsubscribe(),this._listenerDestroyers.forEach((function(e){return e&&e()})),e.prototype.ngOnDestroy.call(this)},t.prototype.ngOnDetach=function(){e.prototype.ngOnDetach.call(this),this._pageLoad=!0},t}(i.StylableComponent);v.initializeProps=h(),v.decorators=[{type:t.Component,args:[{selector:"div[wmList]",template:'<div class="panel-heading" *ngIf="title || subheading || iconclass">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon {{iconclass}}" aria-hidden="true" [hidden]="!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 </h3>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisablePrevious" aria-label="Page navigation" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="previous" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisablePrevious : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'prev\', $event)">\n <i class="wi wi-chevron-left" aria-hidden="true"></i>\n <span class="sr-only">Previous</span>\n </a>\n </li>\n </ul>\n</nav>\n<div *ngIf="navigation === \'Inline\' && !noDataFound" aria-live="polite" aria-atomic="true" class="sr-only"> {{\'Item \' + dataNavigator.dn.currentPage + \' of \' + dataNavigator.pageCount }}</div>\n\n<div>\n <div id={{titleId}} class="sr-only" >\n Press space bar to toggle drag drop mode, use arrow keys to move selected elements.\n </div>\n \n <div aria-live="assertive" *ngIf="listItems" class="sr-only" >\n {{ariaText + currentIndex + \' of \' + listItems.length}}\n </div> \n</div>\n\n<ul [attr.tabindex]="tabindex" [attr.aria-describedby] = "titleId" class="app-livelist-container clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}} {{listclass}}" role="list"\n (keydown.enter)="handleKeyDown($event, \'select\')"\n\n (keydown.space)="handleKeyDown($event, \'space\')"\n\n (keydown.arrowup)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowdown)="handleKeyDown($event, \'focusNext\')"\n (keydown.arrowleft)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowright)="handleKeyDown($event, \'focusNext\')"\n\n (keydown.shift.arrowup)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowdown)="handleKeyDown($event, \'selectNext\')"\n (keydown.shift.arrowleft)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowright)="handleKeyDown($event, \'selectNext\')"\n [hidden]="noDataFound && !variableInflight"\n>\n <ng-template [ngIf]="!groupby" [ngIfElse]="groupedListTemplate">\n <li *ngFor="let item of fieldDefs; index as $index; first as $first; last as $last;" class="app-list-item {{direction === \'horizontal\' ? \'\' : itemsPerRowClass}}" [ngClass]="listItemRef.itemClass"\n [wmListItem]="item"\n #listItemRef="listItemRef"\n [attr.tabindex]="tabindex"\n role="listitem">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ng-template>\n <ng-container [ngTemplateOutlet]="listLeftActionTemplate"></ng-container>\n <ng-container [ngTemplateOutlet]="listRightActionTemplate"></ng-container>\n</ul>\n\n<div class="no-data-msg" *ngIf="noDataFound && !variableInflight" [textContent]="nodatamessage"></div>\n\n<div class="loading-data-msg" *ngIf="variableInflight && !pulltorefresh">\n <span>\n <i class="app-icon panel-icon fa-spin" aria-hidden="true" [ngClass]="loadingicon"></i>\n <span class="sr-only">Loading</span>\n <span class="loading-text" [textContent]="loadingdatamsg"></span>\n </span>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisableNext" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="next" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisableNext : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'next\', $event)">\n <i class="wi wi-chevron-right" aria-hidden="true"></i>\n <span class="sr-only">Next</span>\n </a>\n </li>\n </ul>\n</nav>\n\n<div class="panel-footer" *ngIf="navigation !== \'None\'" [hidden]="!showNavigation || (onDemandLoad && dataNavigator.isDisableNext) || (dataNavigator.dataSize <= pagesize) || (!dataNavigator.dataSize && !dataNavigator.datasource?.pagination?.next)">\n <nav wmPagination\n navigationalign.bind="navigationalign"\n navigation.bind="navControls"\n showrecordcount.bind="showrecordcount"\n maxsize.bind="maxsize"\n boundarylinks.bind="boundarylinks"\n forceellipses.bind="forceellipses"\n directionlinks.bind="directionlinks"\n show.bind="!onDemandLoad"\n paginationchange.event="beforePaginationChange($event, $index)"\n ></nav>\n <a *ngIf="onDemandLoad" href="javascript:void(0);"\n (click)="dataNavigator.navigatePage(\'next\', $event)"\n class="app-button btn btn-block"\n [ngClass]="paginationclass"\n [textContent]="ondemandmessage"\n ></a>\n</div>\n\n\x3c!--This template will be displayed when groupby is specified--\x3e\n<ng-template #groupedListTemplate>\n <li *ngFor="let groupObj of groupedData" class="app-list-item-group clearfix">\n <ul [attr.tabindex]="tabindex" class="list-group item-group" [ngClass]="listclass">\n <li class="app-list-item-header list-item list-group-header" (click)="handleHeaderClick($event)" [ngClass]="{\'collapsible-content\': collapsible}">\n <h4>{{groupObj.key}}\n <div class="header-action">\n <i class="app-icon wi action wi-chevron-up" *ngIf="collapsible"></i>\n <span *ngIf="showcount" class="label label-default">{{groupObj.data.length}}</span>\n </div>\n </h4>\n </li>\n <ul class="list-group clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}}">\n <li *ngFor="let item of groupObj.data; index as $index; first as $first; last as $last;" [attr.tabindex]="tabindex"\n class="app-list-item group-list-item {{itemsPerRowClass}}"\n [ngClass]="listItemRef.itemClass"\n [wmListItem]="item" #listItemRef="listItemRef">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ul>\n </ul>\n </li>\n</ng-template>\n',providers:[i.provideAsWidgetRef(v)]}]}],v.ctorParameters=function(){return[{type:t.Injector},{type:t.ChangeDetectorRef},{type:i.ToDatePipe},{type:r.App},{type:r.AppDefaults},{type:t.NgZone},{type:String,decorators:[{type:t.Attribute,args:["itemclass.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["disableitem.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["datasource.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseenter.event"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseleave.event"]}]},{type:r.StatePersistence},{type:r.PaginationService}]},v.propDecorators={listTemplate:[{type:t.ContentChild,args:["listTemplate"]}],listLeftActionTemplate:[{type:t.ContentChild,args:["listLeftActionTemplate"]}],listRightActionTemplate:[{type:t.ContentChild,args:["listRightActionTemplate"]}],btnComponents:[{type:t.ContentChildren,args:[a.ButtonComponent]}],dataNavigator:[{type:t.ViewChild,args:[o.PaginationComponent]}],listItems:[{type:t.ViewChildren,args:[m]}]};var y=[v,m],b=function(){};b.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,o.PaginationModule,i.WmComponentsModule],declarations:d([],u(y)),exports:d([],u(y)),entryComponents:[]}]}],e.ListComponent=v,e.ListItemDirective=m,e.ListModule=b,e["\u0275a"]=h,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/tooltip"),require("ngx-bootstrap/dropdown"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/input"),require("@wm/components/navigation/menu"),require("@wm/components/data/list"),require("@wm/components/data/pagination"),require("@wm/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@wm/components/data/table",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/tooltip","ngx-bootstrap/dropdown","@wm/components/base","@wm/components/basic","@wm/components/input","@wm/components/navigation/menu","@wm/components/data/list","@wm/components/data/pagination","@wm/core","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.data=e.wm.components.data||{},e.wm.components.data.table={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].tooltip,e["ngx-bootstrap"].dropdown,e.wm.components.base,e.wm.components.basic,e.wm.components.input,e.wm.components.navigation.menu,e.wm.components.data.list,e.wm.components.data.pagination,e.wm.core,e.rxjs,e.rxjs.operators)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m){"use strict";
|
|
506
|
+
***************************************************************************** */var c=function(e,t){return(c=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 p(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}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var h=function(){i.register("wm-list",new Map([["boundarylinks",Object.assign({value:!1},i.PROP_BOOLEAN)],["class",i.PROP_STRING],["collapsible",i.PROP_BOOLEAN],["dateformat",i.PROP_STRING],["dataset",i.PROP_ANY],["datasource",i.PROP_ANY],["direction",Object.assign({value:"vertical"},i.PROP_STRING)],["directionlinks",Object.assign({value:!0},i.PROP_BOOLEAN)],["disableitem",i.PROP_BOOLEAN],["enablereorder",i.PROP_BOOLEAN],["forceellipses",Object.assign({value:!0},i.PROP_BOOLEAN)],["groupby",i.PROP_STRING],["iconclass",i.PROP_STRING],["itemclass",Object.assign({value:""},i.PROP_STRING)],["itemsperrow",i.PROP_STRING],["listclass",Object.assign({value:"list-group"},i.PROP_STRING)],["multiselect",i.PROP_BOOLEAN],["loadingdatamsg",Object.assign({value:"Loading..."},i.PROP_STRING)],["loadingicon",Object.assign({value:"fa fa-circle-o-notch"},i.PROP_STRING)],["match",i.PROP_STRING],["maxsize",Object.assign({value:5},i.PROP_NUMBER)],["name",i.PROP_STRING],["navigation",i.PROP_STRING],["navigationalign",Object.assign({value:"left"},i.PROP_STRING)],["nodatamessage",Object.assign({value:"No data found"},i.PROP_STRING)],["ondemandmessage",Object.assign({value:"Load More"},i.PROP_STRING)],["orderby",i.PROP_STRING],["paginationclass",i.PROP_STRING],["pagesize",i.PROP_NUMBER],["pulltorefresh",Object.assign({value:r.isMobileApp()},i.PROP_BOOLEAN)],["selectfirstitem",i.PROP_BOOLEAN],["selectionlimit",i.PROP_NUMBER],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["showcount",i.PROP_BOOLEAN],["showrecordcount",i.PROP_BOOLEAN],["statehandler",Object.assign({value:"none"},i.PROP_STRING)],["subheading",i.PROP_STRING],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["title",i.PROP_STRING]]))},m=function(){function e(e,t,n){this.inj=e,this.app=n,this.destroy=new s.Subject,this.destroy$=this.destroy.asObservable(),this.itemClass="",this._currentItemWidgets={},this.isActive=!1,this.disableItem=!1,this.nativeElement=t.nativeElement,this.listComponent=e.view.component,this.context=e.view.context,this.itemClassWatcher(this.listComponent),this.disableItemWatcher(this.listComponent),$(this.nativeElement).data("listItemContext",this)}return e.prototype.onFocus=function(){this.listComponent.lastSelectedItem=this},Object.defineProperty(e.prototype,"$index",{get:function(){return this.context.index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$even",{get:function(){return this.context.even},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$odd",{get:function(){return this.context.odd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$first",{get:function(){return this.context.first},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$last",{get:function(){return this.context.last},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentItemWidgets",{get:function(){var e=Array.from(this.nativeElement.querySelectorAll("[widget-id]"));return Object.assign(this._currentItemWidgets,e.reduce((function(e,t){return e[t.widget.name]=t.widget,e}),{}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wmListItem",{set:function(e){this.item=e},enumerable:!1,configurable:!0}),e.prototype.registerWatch=function(e,t){this.destroy$.subscribe(r.$watch(e,this.listComponent.viewParent,this,t))},e.prototype.itemClassWatcher=function(e){var t=this;e.binditemclass?this.registerWatch(e.binditemclass,(function(e){return t.itemClass=e||""})):this.itemClass=e.itemclass},e.prototype.disableItemWatcher=function(e){var t=this;e.binddisableitem?this.registerWatch(e.binddisableitem,(function(e){return t.disableItem=e||!1})):this.disableItem=e.disableitem||!1},e.prototype.setUpCUDHandlers=function(){var e=this,t=this.nativeElement.querySelector(".edit-list-item"),n=this.nativeElement.querySelector(".delete-list-item");t&&t.addEventListener("click",(function(t){e.listComponent.update()})),n&&n.addEventListener("click",(function(t){e.listComponent.delete()}))},e.prototype.ngOnInit=function(){var e=this;this.listComponent.mouseEnterCB&&this.nativeElement.addEventListener("mouseenter",(function(t){e.listComponent.invokeEventCallback("mouseenter",{widget:e,$event:t})})),this.listComponent.mouseLeaveCB&&this.nativeElement.addEventListener("mouseleave",(function(t){e.listComponent.invokeEventCallback("mouseleave",{widget:e,$event:t})})),$(this.nativeElement).attr("listitemindex",this.$index)},e.prototype.ngAfterViewInit=function(){this.setUpCUDHandlers()},e}();m.decorators=[{type:t.Directive,args:[{selector:"[wmListItem]",exportAs:"listItemRef"}]}],m.ctorParameters=function(){return[{type:t.Injector},{type:t.ElementRef},{type:r.App}]},m.propDecorators={isActive:[{type:t.HostBinding,args:["class.active"]}],disableItem:[{type:t.HostBinding,args:["class.disable-item"]}],onFocus:[{type:t.HostListener,args:["focus"]}],wmListItem:[{type:t.Input}]};var f=function(e){function t(t){var n=e.call(this)||this;return n.list=t,n.$el=$(n.list.getNativeElement()).find("ul.app-livelist-container").first(),n.leftChildrenCount=n.$el.find(">.app-list-item-left-action-panel > button:visible").length,n.rightChildrenCount=n.$el.find(">.app-list-item-right-action-panel > button:visible").length,n.leftChildrenCount||n.rightChildrenCount?(n.init(n.$el),n.$btnSubscription=n.list.btnComponents.changes.subscribe((function(e){return n.actionItems=e})),n):n}return p(t,e),t.prototype.createActionPanel=function(e,t){return t.css({width:e.outerWidth()+"px",height:e.outerHeight()+"px",marginBottom:-1*e.outerHeight()+"px",float:"left",padding:0}),t.insertBefore(e)},t.prototype.computeTotalChildrenWidth=function(e){return _.reduce(e.children(),(function(e,t){return e+$(t).outerWidth()}),0)},t.prototype.computeTransitionProportions=function(e){var t=this.computeTotalChildrenWidth(e),n="right"===this.position,i=0;return _.map(e.children(),(function(e){var o=(t-i)/t;return i+=$(e).outerWidth(),n?o:i/t}))},t.prototype.resetElement=function(e){e&&e.css({transform:"none",transition:"none"})},t.prototype.resetState=function(){this.resetElement(this.li),this.resetElement(this.actionPanel),this.actionPanel&&(this.actionPanel=null)},t.prototype.getChildActionElement=function(e){if(e.children().length)return"left"===this.position?e.children().first():e.children().last()},t.prototype.initActionPanel=function(e){this.actionPanel=this.createActionPanel(this.li,e),this.actionPanel.css({backgroundColor:this.getChildActionElement(this.actionPanel).css("background-color")}),this.limit=this.computeTotalChildrenWidth(this.actionPanel),this.transitionProportions=this.computeTransitionProportions(this.actionPanel)},t.prototype.bounds=function(e,t){var n=$(e.target).closest("li"),i={strictUpper:!0,strictLower:!0,lower:0,center:0,upper:0};if(!n.hasClass("app-list-item"))return i;if(this.li&&this.li[0]===n[0])"left"===this.position?i={strictUpper:!1,lower:-this.limit,center:this.limit}:"right"===this.position&&(i={center:-this.limit,upper:this.limit,strictLower:!1});else{var o=t>0?".app-list-item-left-action-panel":".app-list-item-right-action-panel",r=this.$el.find(">"+o);if(!r.length&&this.list.groupby&&(o="li > ul.list-group >"+o,r=this.$el.find(">"+o)),!r.length||!r.find("button:visible").length)return i;this.resetState(),this.li=n,this.position=r.attr("position"),this.initActionPanel(r),i=t>0?{strictUpper:!1,lower:0,center:0,upper:this.limit}:{strictLower:!1,lower:-this.limit,center:0,upper:0}}return i},t.prototype.context=function(){var e=this;return{computeActionTransition:function(t,n){var i=n>0?1:-1;return i*n>e.limit?n-i*e.limit+e.transitionProportions[t]*i*e.limit:e.transitionProportions[t]*n}}},t.prototype.animation=function(){var e=this;return[{target:function(){return e.li},css:{transform:"translate3d(${{$D + $d}}px, 0, 0)"}},{target:function(){return e.actionPanel&&e.actionPanel.children()},css:{transform:"translate3d(${{computeActionTransition($i, $D + $d)}}px, 0, 0)"}}]},t.prototype.invokeFullSwipeEvt=function(e){var t,n,i;"left"===this.position?(n=this.actionItems.filter((function(e){return"left"===e.getAttr("swipe-position")&&e.$element.is(":visible")})),i=0):i=(n=this.actionItems.filter((function(e){return"right"===e.getAttr("swipe-position")&&e.$element.is(":visible")}))).length-1,(t=n[i])&&t.hasEventCallback("tap")&&t.invokeEventCallback("tap",{$event:e}),this.resetState(),this.li=null},t.prototype.onAnimation=function(e,t){if(this.list.triggerListItemSelection(this.li,e),this.actionPanel&&"true"===this.actionPanel.attr("enablefullswipe")){var n=t>0?1:-1,i=this.getChildActionElement(this.actionPanel);if(i){var o="right"===this.position?this.rightChildrenCount-1:0;this.transitionProportions[o]*n*t*100/(this.li.outerWidth()-this.limit+i.width())>50&&this.invokeFullSwipeEvt(e)}}},t.prototype.onLower=function(){"left"===this.position&&(this.resetState(),this.li=null)},t.prototype.onUpper=function(){"right"===this.position&&(this.resetState(),this.li=null)},t.prototype.threshold=function(){return 10},t}(l.SwipeAnimation),g={widgetType:"wm-list",hostClass:"app-livelist app-panel"},v=function(e){function t(t,n,o,a,s,l,c,p,u,d,h,m,f,v){var y=this,b=r.noop,w=new Promise((function(e){return b=e}));return(y=e.call(this,t,g,w)||this).propsInitPromise=w,y.promiseResolverFn=b,i.styler(y.nativeElement,y,i.APPLY_STYLES_TYPE.SHELL),y.cdRef=n,y.ngZone=l,y.datePipe=o,y.statePersistence=f,y.paginationService=v,y._pageLoad=!0,y.binditemclass=c,y.binddisableitem=p,y.binddataset=u,y.mouseEnterCB=h,y.mouseLeaveCB=m,y.binddatasource=d,y.app=a,y.appDefaults=s,y.variableInflight=!1,y.noDataFound=!u,y.titleId="wmlist-"+r.generateGUId(),y._listenerDestroyers=[y.app.subscribe("check-state-persistence-options",(function(e){var t=_.get(y.datasource,"name");t||(t=i.extractDataSourceName(y.binddatasource)),_.get(e,"variable.name")===t&&y.handleStateParams(e)})),y.app.subscribe("toggle-variable-state",y.handleLoading.bind(y)),y.app.subscribe("setup-cud-listener",(function(e){y.nativeElement.getAttribute("name")===e&&(y._isDependent=!0)}))],y}return p(t,e),Object.defineProperty(t.prototype,"selecteditem",{get:function(){return this.multiselect?r.getClonedObject(this._items):_.isEmpty(this._items)?{}:r.getClonedObject(this._items[0])},set:function(e){var t=this;this._items.length=0,this.deselectListItems(),_.isArray(e)?e.forEach((function(e){return t.selectItem(e)})):this.selectItem(e),r.$appDigest()},enumerable:!1,configurable:!0}),t.prototype.getWidgets=function(e,t){var n,i=[];if(e)return r.isDefined(t)?(t=+t||0,(n=_.get(this.listItems.toArray(),t))?[_.get(n.currentItemWidgets,e)]:void 0):(_.forEach(this.listItems.toArray(),(function(t){(n=_.get(t.currentItemWidgets,e))&&i.push(n)})),i)},t.prototype.getItem=function(e){return this.getListItemByIndex(e)},t.prototype.getIndex=function(e){return e instanceof m?this.getListItemIndex(e):e?this.fieldDefs.findIndex((function(t){return _.isEqual(t,e)})):void 0},t.prototype.getConfiguredState=function(){var e=this.statePersistence.computeMode(this.statehandler);return e&&e.toLowerCase()},t.prototype.handleStateParams=function(e){if(this._pageLoad&&"none"!==this.getConfiguredState()){this._pageLoad=!1;var t=this.statePersistence.getWidgetState(this);_.get(t,"pagination")&&(e.options=e.options||{},e.options.page=t.pagination),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}},t.prototype.triggerWMEvent=function(e,t){r.$invokeWatchers(!0);var n=this.multiselect?_.last(this.selecteditem):this.selecteditem;t&&(n=t),this.app.notify("wm-event",{eventName:e,widgetName:this.name,row:n})},t.prototype.create=function(){this._isDependent&&this.triggerWMEvent("insert")},t.prototype.editRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("update",t)}},t.prototype.update=function(e){this.editRow(e)},t.prototype.deleteRow=function(e){if(this._isDependent){var t=void 0;e&&(t=this.getItemRefByIndexOrModel(e).item),this.triggerWMEvent("delete",t)}},t.prototype.delete=function(e){this.deleteRow(e)},t.prototype.handleLoading=function(e){var t=this,n=this.datasource;n&&n.execute(r.DataSource.Operation.IS_API_AWARE)&&r.isDataSourceEqual(e.variable,n)&&this.ngZone.run((function(){var n,i,o;t.handleStateParams(e),t.variableInflight=e.active;var r=null===(i=null===(n=e.data)||void 0===n?void 0:n.pagination)||void 0===i?void 0:i.totalElements;_.isUndefined(r)?t.noDataFound=_.isEmpty(null===(o=e.data)||void 0===o?void 0:o.data):t.noDataFound=0===r}))},t.prototype.resetNavigation=function(){this.showNavigation=!1,this.navControls=void 0,this.infScroll=!1,this.onDemandLoad=!1},t.prototype.enableBasicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.BASIC,this.showNavigation=!0},t.prototype.enableInlineNavigation=function(){this.navControls=i.NAVIGATION_TYPE.INLINE},t.prototype.enableClassicNavigation=function(){this.navControls=i.NAVIGATION_TYPE.CLASSIC,this.showNavigation=!0},t.prototype.enablePagerNavigation=function(){this.navControls=i.NAVIGATION_TYPE.PAGER,this.showNavigation=!0},t.prototype.setNavigationTypeNone=function(){this.navControls=i.NAVIGATION_TYPE.NONE,this.showNavigation=!1},t.prototype.enableInfiniteScroll=function(){this.infScroll=!0},t.prototype.enableOnDemandLoad=function(){this.onDemandLoad=!0,this.showNavigation=!0},t.prototype.onNavigationTypeChange=function(e){switch(this.resetNavigation(),e){case i.NAVIGATION_TYPE.BASIC:this.enableBasicNavigation();break;case i.NAVIGATION_TYPE.INLINE:this.enableInlineNavigation();break;case i.NAVIGATION_TYPE.ADVANCED:case i.NAVIGATION_TYPE.CLASSIC:this.enableClassicNavigation();break;case i.NAVIGATION_TYPE.PAGER:this.enablePagerNavigation();break;case i.NAVIGATION_TYPE.NONE:this.setNavigationTypeNone();break;case i.NAVIGATION_TYPE.SCROLL:this.enableInfiniteScroll();break;case i.NAVIGATION_TYPE.ONDEMAND:this.enableOnDemandLoad()}},t.prototype.updateFieldDefs=function(e){var t;this.infScroll||this.onDemandLoad?(t=u(this.paginationService.updateFieldsOnPagination(this,e),2),this.fieldDefs=t[0],this.currentPage=t[1]):this.fieldDefs=e,this.orderby&&(this.fieldDefs=i.getOrderedDataset(this.fieldDefs,this.orderby)),this.groupby&&(this.groupedData=i.groupData(this,this.fieldDefs,this.groupby,this.match,this.orderby,this.dateformat,this.datePipe,void 0,this.appDefaults)),this.fieldDefs.length||(this.noDataFound=!0,this.selecteditem=void 0),r.$appDigest(),this.listItems.setDirty()},t.prototype.onDataChange=function(e){_.isEmpty(e)?this.updateFieldDefs([]):(this.noDataFound=!1,this.isDataChanged=!0,this.datasource&&this.datasource.execute(r.DataSource.Operation.IS_API_AWARE)&&(e=_.cloneDeep(e)),r.isObject(e)&&!_.isArray(e)&&(e=_.isEmpty(e)?[]:[e]),_.isString(e)&&(e=e.split(",")),this.datasource&&"App"===this.datasource.owner&&(this.infScroll||this.onDemandLoad)&&!this.currentPage&&this.datasource.execute(r.DataSource.Operation.GET_PAGING_OPTIONS).number>0&&(e=this.datasource.execute(r.DataSource.Operation.LIST_RECORDS,{page:1})),_.isArray(e)&&(e.length&&this.invokeEventCallback("beforedatarender",{$data:e}),this.updateFieldDefs(e)))},t.prototype.setupDataSource=function(){var e=this,t=this.dataNavigator;t.options={maxResults:this.pagesize||20},this.dataNavigatorWatched=!0,this.navigatorResultWatch&&this.navigatorResultWatch.unsubscribe(),this.navigatorResultWatch=t.resultEmitter.subscribe((function(t){e.onDataChange(t)}),!0),this.navigatorMaxResultWatch&&this.navigatorMaxResultWatch.unsubscribe(),this.navigatorMaxResultWatch=t.maxResultsEmitter.subscribe((function(t){e.pagesize=t})),t.maxResults=this.pagesize||20,this.removePropertyBinding("dataset");var n=this.getAttr("datasetboundexpr");this.dataNavigator.setBindDataSet(this.binddataset,this.viewParent,n?this.context:this.datasource,this.dataset,this.binddatasource,n,this.statehandler)},t.prototype.onDataSetChange=function(e){if("wm.Variable"===_.get(this.datasource,"category")&&"none"!==this.getConfiguredState()&&this._pageLoad){var t=this.statePersistence.getWidgetState(this);this._pageLoad=!1,_.get(t,"pagination")&&this.dataNavigator.pageChanged({page:t.pagination},!0),_.get(t,"selectedItem")&&(this._selectedItemsExist=!0)}this.dataNavigatorWatched?this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE&&this.dataNavigator.setDataSource(this.datasource):this.navigation&&this.navigation!==i.NAVIGATION_TYPE.NONE?this.setupDataSource():this.onDataChange(e)},t.prototype.deselectListItems=function(){this.listItems.forEach((function(e){return e.isActive=!1}))},t.prototype.clearSelectedItems=function(){this.deselectListItems(),this._items.length=0,r.$appDigest()},t.prototype.getListItemByModel=function(e){var t=this;return this.listItems.find((function(n){var i=n.item;if(t.groupby&&!_.has(e,"_groupIndex")&&delete(i=_.clone(i))._groupIndex,_.isEqual(i,e))return!0}))||null},t.prototype.updateSelectedItemsWidgets=function(e){var t,n=this,o={},r=_.get(this.dataNavigator,"dn.currentPage")||1;"none"!==this.getConfiguredState()&&(t=this.statePersistence.getWidgetState(this)||{},_.get(t,"selectedItem")&&(this.multiselect&&1===this.selecteditem.length?t.selectedItem=[]:_.remove(t.selectedItem,(function(e){return e.page===r})))),this.multiselect&&(this.selectedItemWidgets.length=0),this.listItems.forEach((function(e,i){e.isActive&&(n.multiselect?n.selectedItemWidgets.push(e.currentItemWidgets):n.selectedItemWidgets=e.currentItemWidgets,o={page:r,index:i},_.get(t,"selectedItem")&&n.multiselect?_.some(t.selectedItem,o)||t.selectedItem.push(o):t.selectedItem=[o])})),"none"===this.getConfiguredState()||e||(i.unsupportedStatePersistenceTypes.indexOf(this.navigation)<0?(this.statePersistence.removeWidgetState(this,"selectedItem"),this.statePersistence.setWidgetState(this,{selectedItem:t.selectedItem})):console.warn("Retain State handling on Widget "+this.name+" is not supported for current pagination type."))},t.prototype.toggleListItemSelection=function(e,t){if(e&&!e.disableItem){var n=e.item;this.groupby&&_.has(n,"_groupIndex")&&delete(n=_.clone(n))._groupIndex,e.isActive?(this._items=_.pullAllWith(this._items,[n],_.isEqual),e.isActive=!1):(this.multiselect||this.clearSelectedItems(),this._items.push(n),this.invokeEventCallback("select",{widget:e,$data:n}),e.isActive=!0),this.updateSelectedItemsWidgets(t)}},t.prototype.onListRender=function(e){var t=this;if(this.isDataChanged&&(r.$invokeWatchers(!0),this.invokeEventCallback("render",{$data:this.fieldDefs})),this.isDataChanged&&"none"!==this.getConfiguredState()&&e.length&&this._selectedItemsExist){var n=this.statePersistence.getWidgetState(this);if(_.get(n,"selectedItem")){this._selectedItemsExist=!1;var o=_.isArray(this.selecteditem)?this.selecteditem.length:_.toNumber(!_.isEmpty(this.selecteditem)),a=_.get(this.dataNavigator,"dn.currentPage")||1;n.pagination=n.pagination||1,o!==n.selectedItem.length&&n.pagination===a&&n.selectedItem.forEach((function(e){e.page===a&&t.selectItem(e.index,!0)}))}}var s=_.isArray(this.selecteditem)?this.selecteditem:[this.selecteditem];if(this.firstSelectedItem=this.lastSelectedItem=null,!e.length||!this.selectfirstitem||this._items.length&&this.multiselect||!1===this._selectedItemsExist)this.deselectListItems(),s.forEach((function(e){var n=t.getListItemByModel(e);n&&(n.isActive=!0,t.lastSelectedItem=n,n.nativeElement.focus())}));else{var l=e.first;l.disableItem||!this.isDataChanged||(this.infScroll||this.onDemandLoad)&&this._items.length||(this.clearSelectedItems(),this.firstSelectedItem=this.lastSelectedItem=l,this.selectItem(0))}if(this.fieldDefs.length&&this.infScroll){var c=this.$element.closest("[wmsmoothscroll]");if(r.isMobileApp()&&c.length&&"true"===c.attr("wmsmoothscroll"))this.paginationService.bindIScrollEvt(this,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);else{var p=this.$element.closest(".modal-body"),u=this.$element.find("ul").height(),d=window.innerHeight-140;r.isMobile()&&p.length&&u>d&&this.$element.css("height",d+"px"),this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME)}}this.isDataChanged=!1},t.prototype.triggerListItemSelection=function(e,t){if(e&&e[0]){var n=e.data("listItemContext");n.listComponent===this&&this.onItemClick(t,n)}},t.prototype.setupHandlers=function(){var e=this;this.listItems.changes.subscribe((function(t){e.onListRender(t),e.cdRef.detectChanges()})),this.nativeElement.querySelector("ul.app-livelist-container").addEventListener("click",(function(t){for(var n=$(t.target).closest(".app-list-item");n.get(0)&&n.closest("ul.app-livelist-container").get(0)!==t.currentTarget;)n=n.parent().closest(".app-list-item");e.triggerListItemSelection(n,t)}),!0)},t.prototype.onReorderStart=function(e,t){t.placeholder.height(t.item.height()),this.$ulEle.data("oldIndex",t.item.index())},t.prototype.onSort=function(e,t){if(this.infScroll){var n=this.$ulEle.find("[listitemindex="+(this.fieldDefs.length-1)+"]").offset();n&&n.top<t.offset.top&&(this.paginationService.bindScrollEvt(this,"> ul",i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME),this.debouncedFetchNextDatasetOnScroll())}},t.prototype.onUpdate=function(e,t){var n=this.fieldDefs,i=t.item.index(),o=this.$ulEle.data("oldIndex"),r=_.min([i,o]),a=_.max([i,o]),s=_.pullAt(n,o)[0];if(s){"none"!==this.getConfiguredState()&&this.statePersistence.removeWidgetState(this,"selectedItem"),this.reorderProps.minIndex=_.min([r,this.reorderProps.minIndex]),this.reorderProps.maxIndex=_.max([a,this.reorderProps.maxIndex]),n.splice(i,0,s),this.cdRef.markForCheck(),this.cdRef.detectChanges();var l={oldIndex:o,newIndex:i,item:n[i]};this.invokeEventCallback("reorder",{$event:e,$data:n,$changedItem:l}),this.$ulEle.removeData("oldIndex")}},t.prototype.configureDnD=function(){var e,t=$(document).find(".modal");e=this.getAttr("height")?"parent":t.length?t[t.length-1]:"body";var n=r.isMobileApp()?{}:{appendTo:e},o=$(this.nativeElement);this.$ulEle=o.find(".app-livelist-container"),i.configureDnD(this.$ulEle,n,this.onReorderStart.bind(this),this.onUpdate.bind(this),this.onSort.bind(this)),this.$ulEle.droppable({accept:".app-list-item"}),r.isMobileApp()&&(this.$ulEle.sortable("disable"),this.$ulEle.on("touchstart",(function(e){var t=this;t.touching||(t.touched&&clearTimeout(t.touched),setTimeout((function(){e.cancelable&&e.preventDefault()}),50),t.touched=setTimeout((function(){$(e.currentTarget).addClass("no-selection"),$(e.currentTarget).sortable("enable"),t.touching=!0,$(t).trigger(e)}),350))})).on("touchend",(function(e){this.touching=!1,$(e.currentTarget).removeClass("no-selection"),$(e.currentTarget).sortable("disable"),clearTimeout(this.touched)})).on("touchmove",(function(){clearTimeout(this.touched)})))},t.prototype.checkSelectionLimit=function(e){return!this.selectionlimit||e<this.selectionlimit},t.prototype.getListItemByIndex=function(e){return this.listItems.toArray()[e]},t.prototype.getListItemIndex=function(e){return this.listItems.toArray().indexOf(e)},t.prototype.execute=function(e,t){return![r.DataSource.Operation.IS_API_AWARE,r.DataSource.Operation.IS_PAGEABLE,r.DataSource.Operation.SUPPORTS_SERVER_FILTER].includes(e)&&this.datasource.execute(e,t)},t.prototype.handleKeyDown=function(e,t){var n=this;e.stopPropagation(),13===e.keyCode||9===e.keyCode||e.target.classList.contains("form-control")&&32===e.keyCode||e.preventDefault();var i=this.listItems,o=this.getListItemIndex(this.lastSelectedItem);if(this.multiselect){var r=this.getListItemIndex(this.firstSelectedItem),a=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0;"selectPrev"===t?o>0&&(o<=r&&this.checkSelectionLimit(a)?(this.lastSelectedItem=this.getListItemByIndex(o-1),this.toggleListItemSelection(this.lastSelectedItem)):o>r?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o-1)):this.invokeEventCallback("selectionlimitexceed",{$event:e})):"selectNext"===t&&o<i.length-1&&(o>=r&&this.checkSelectionLimit(a)?(this.lastSelectedItem=this.getListItemByIndex(o+1),this.toggleListItemSelection(this.lastSelectedItem)):o<r?(this.toggleListItemSelection(this.getListItemByIndex(o)),this.lastSelectedItem=this.getListItemByIndex(o+1)):this.invokeEventCallback("selectionlimitexceed",{$event:e}))}if("focusPrev"===t)if(this.isListElementMovable){var s;if(o=o<=0?0:o,this.lastSelectedItem=this.getListItemByIndex(o),0===o)return void(s=this.listItems.last);this.listItems.forEach((function(e,t){if(t===o){s.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),r=i[o];i[o]=i[o-1],i[o-1]=r,n.listItems.reset(i),n.currentIndex=o,n.ariaText="selected "}s=e}))}else o=o<=0?0:o-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("focusNext"===t)if(this.isListElementMovable){var l;if(o=o<i.length-1?o:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),o===this.listItems.length-1)return void(l=this.listItems.first);this.listItems.forEach((function(e,t){if(t===o+1){l.nativeElement.before(e.nativeElement),n.lastSelectedItem.nativeElement.focus();var i=n.listItems.toArray(),r=i[o+1];i[o+1]=i[o],i[o]=r,n.listItems.reset(i),n.currentIndex=t+1,n.ariaText="selected "}l=e}))}else o=o<i.length-1?o+1:i.length-1,this.lastSelectedItem=this.getListItemByIndex(o),this.lastSelectedItem.nativeElement.focus(),this.currentIndex=o+1,this.ariaText="selected ";else if("select"===t){if(-1===o||!$(e.target).closest(this.lastSelectedItem.nativeElement)){var c=$(e.target).closest("li.app-list-item"),p=c.closest("ul.app-livelist-container");o=p.find("li.app-list-item").index(c)}this.onItemClick(e,this.getListItemByIndex(o))}else if("space"===t){if(!this.enablereorder)return;this.isListElementMovable=!this.isListElementMovable,this.onItemClick(e,this.getListItemByIndex(o)),this.currentIndex=o+1;var u=this.getListItemByIndex(o).item.name;this.isListElementMovable?this.ariaText=u+" grabbed, current position ":this.ariaText=u+" dropped, final position "}},t.prototype.onPropertyChange=function(t,n,i){var o=this;if("dataset"===t){if(!n&&this.binddatasource&&!this.datasource)return;this.onDataSetChange(n)}else if("datasource"===t)this.dataset&&this.onDataSetChange(this.dataset);else if("navigation"===t){if("Advanced"===n)return void(this.navigation="Classic");r.switchClass(this.nativeElement,n,i),this.onNavigationTypeChange(n),this.dataNavigator&&(this.dataNavigator.navigationClass=this.paginationclass)}else if("itemsperrow"===t)r.setListClass(this);else{if("tabindex"===t)return;"pulltorefresh"===t&&n?(this.app.notify("pullToRefresh:enable"),this.subscribeToPullToRefresh()):"paginationclass"===t?this.dataNavigator&&setTimeout((function(){return o.dataNavigator.navigationClass=n})):"pagesize"===t?(this.dataNavigator.options={maxResults:n},this.dataNavigator.widget.maxResults=n,this.dataNavigator.maxResults=n):"enablereorder"===t?n?(this.configureDnD(),this.$ulEle.sortable("enable")):this.$ulEle&&!n&&this.$ulEle.sortable("disable"):e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.onItemClick=function(e,t){var n,i=this;if(!t.disableItem){if(this.firstSelectedItem=this.firstSelectedItem||t,n=_.isArray(this.selecteditem)?this.selecteditem.length:_.isObject(this.selecteditem)?1:0,this.multiselect&&r.isMobile())this.checkSelectionLimit(n)||t.isActive?this.toggleListItemSelection(t):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if((e.ctrlKey||e.metaKey)&&this.multiselect)this.checkSelectionLimit(n)||t.isActive?(this.firstSelectedItem=this.lastSelectedItem=t,this.toggleListItemSelection(t)):this.invokeEventCallback("selectionlimitexceed",{$event:e});else if(e.shiftKey&&this.multiselect){var o=t.context.index,a=this.firstSelectedItem.context.index;o>a&&(a=[o,o=a][0]),this.checkSelectionLimit(a-o)?(this.clearSelectedItems(),this.listItems.forEach((function(e){var t=e.context.index;t>=o&&t<=a&&i.toggleListItemSelection(e)})),this.lastSelectedItem=t):this.invokeEventCallback("selectionlimitexceed",{$event:e})}else(!t.isActive||n>1)&&(this.clearSelectedItems(),this.toggleListItemSelection(t),this.firstSelectedItem=this.lastSelectedItem=t);r.$appDigest()}},t.prototype.clear=function(){this.updateFieldDefs([])},t.prototype.getItemRefByIndexOrModel=function(e){return r.isNumber(e)?this.getListItemByIndex(e):this.getListItemByModel(e)},t.prototype.deselectItem=function(e){var t=this.getItemRefByIndexOrModel(e);t&&t.isActive&&this.toggleListItemSelection(t)},t.prototype.selectItem=function(e,t){var n=this.getItemRefByIndexOrModel(e);n&&(n.isActive||this.toggleListItemSelection(n,t),n.nativeElement.focus())},t.prototype.beforePaginationChange=function(e,t){this.invokeEventCallback("paginationchange",{$event:e,$index:t})},t.prototype.handleEvent=function(e,t,n,i){var o=this;_.includes(["click","tap","dblclick","doubletap"],t)&&this.eventManager.addEventListener(this.nativeElement,{tap:"click",doubletap:"dblclick"}[t]||t,(function(e){var n=$(e.target).closest(".app-list-item");if(n.length){var i=n.data("listItemContext");i.disableItem||o.invokeEventCallback(t,{widget:i,$event:e,item:i.item})}}))},t.prototype.subscribeToPullToRefresh=function(){var e=this;this._listenerDestroyers.push(this.app.subscribe("pulltorefresh",(function(){e.datasource&&e.datasource.listRecords&&e.datasource.listRecords()})))},t.prototype.ngOnInit=function(){var t=this;e.prototype.ngOnInit.call(this),this.handleHeaderClick=r.noop,setTimeout((function(){t.debouncedFetchNextDatasetOnScroll=t.paginationService.debouncedFetchNextDatasetOnScroll(t.dataNavigator,i.DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME,t)}),0),this._items=[],this.fieldDefs=[],this.reorderProps={minIndex:null,maxIndex:null}},t.prototype.setUpCUDHandlers=function(){var e=this,t=document.getElementsByClassName("add-list-item")[0];t&&t.addEventListener("click",(function(t){e.create()}))},t.prototype.ngAfterViewInit=function(){var t=this;this.promiseResolverFn(),this.propsInitPromise.then((function(){e.prototype.ngAfterViewInit.call(t),t.setUpCUDHandlers(),t.selectedItemWidgets=t.multiselect?[]:{},t.enablereorder&&!t.groupby&&t.configureDnD(),t.groupby&&t.collapsible&&(t.handleHeaderClick=i.handleHeaderClick,t.toggleAllHeaders=i.toggleAllHeaders.bind(void 0,t)),r.setListClass(t)})),this.setupHandlers();var n=this.nativeElement.querySelector("ul.app-livelist-container");i.styler(n,this,i.APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER),r.isMobileApp()&&n.querySelector(".app-list-item-action-panel")&&(this._listAnimator=new f(this))},t.prototype.ngOnDestroy=function(){this._listAnimator&&this._listAnimator.$btnSubscription&&this._listAnimator.$btnSubscription.unsubscribe(),this._listenerDestroyers.forEach((function(e){return e&&e()})),e.prototype.ngOnDestroy.call(this)},t.prototype.ngOnDetach=function(){e.prototype.ngOnDetach.call(this),this._pageLoad=!0},t}(i.StylableComponent);v.initializeProps=h(),v.decorators=[{type:t.Component,args:[{selector:"div[wmList]",template:'<div class="panel-heading" *ngIf="title || subheading || iconclass">\n <h3 class="panel-title">\n <div class="pull-left">\n <i class="app-icon panel-icon {{iconclass}}" aria-hidden="true" [hidden]="!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 </h3>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisablePrevious" aria-label="Page navigation" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="previous" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisablePrevious : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'prev\', $event)">\n <i class="wi wi-chevron-left" aria-hidden="true"></i>\n <span class="sr-only">Previous</span>\n </a>\n </li>\n </ul>\n</nav>\n<div *ngIf="navigation === \'Inline\' && !noDataFound" aria-live="polite" aria-atomic="true" class="sr-only"> {{\'Item \' + dataNavigator.dn.currentPage + \' of \' + dataNavigator.pageCount }}</div>\n\n<div>\n <div id={{titleId}} class="sr-only" >\n Press space bar to toggle drag drop mode, use arrow keys to move selected elements.\n </div>\n \n <div aria-live="assertive" *ngIf="listItems" class="sr-only" >\n {{ariaText + currentIndex + \' of \' + listItems.length}}\n </div> \n</div>\n\n<ul [attr.tabindex]="tabindex" [attr.aria-describedby] = "titleId" class="app-livelist-container clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}} {{listclass}}" role="list"\n (keydown.enter)="handleKeyDown($event, \'select\')"\n\n (keydown.space)="handleKeyDown($event, \'space\')"\n\n (keydown.arrowup)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowdown)="handleKeyDown($event, \'focusNext\')"\n (keydown.arrowleft)="handleKeyDown($event, \'focusPrev\')"\n (keydown.arrowright)="handleKeyDown($event, \'focusNext\')"\n\n (keydown.shift.arrowup)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowdown)="handleKeyDown($event, \'selectNext\')"\n (keydown.shift.arrowleft)="handleKeyDown($event, \'selectPrev\')"\n (keydown.shift.arrowright)="handleKeyDown($event, \'selectNext\')"\n [hidden]="noDataFound && !variableInflight"\n>\n <ng-template [ngIf]="!groupby" [ngIfElse]="groupedListTemplate">\n <li *ngFor="let item of fieldDefs; index as $index; first as $first; last as $last;" class="app-list-item {{direction === \'horizontal\' ? \'\' : itemsPerRowClass}}" [ngClass]="listItemRef.itemClass"\n [wmListItem]="item"\n #listItemRef="listItemRef"\n [attr.tabindex]="tabindex"\n role="listitem">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ng-template>\n <ng-container [ngTemplateOutlet]="listLeftActionTemplate"></ng-container>\n <ng-container [ngTemplateOutlet]="listRightActionTemplate"></ng-container>\n</ul>\n\n<div class="no-data-msg" *ngIf="noDataFound && !variableInflight" [textContent]="nodatamessage"></div>\n\n<div class="loading-data-msg" *ngIf="variableInflight && !pulltorefresh">\n <span>\n <i class="app-icon panel-icon fa-spin" aria-hidden="true" [ngClass]="loadingicon"></i>\n <span class="sr-only">Loading</span>\n <span class="loading-text" [textContent]="loadingdatamsg"></span>\n </span>\n</div>\n\n<nav class="app-datanavigator" [attr.aria-disabled]="dataNavigator.isDisableNext" *ngIf="navigation === \'Inline\' && !noDataFound">\n <ul class="pager">\n <li class="next" [ngClass]="{\'disabled\': (dataNavigator ? dataNavigator.isDisableNext : true)}">\n <a href="javascript:void(0);" (click)="dataNavigator.navigatePage(\'next\', $event)">\n <i class="wi wi-chevron-right" aria-hidden="true"></i>\n <span class="sr-only">Next</span>\n </a>\n </li>\n </ul>\n</nav>\n\n<div class="panel-footer" *ngIf="navigation !== \'None\'" [hidden]="!showNavigation || (onDemandLoad && dataNavigator.isDisableNext) || (dataNavigator.dataSize <= pagesize) || (!dataNavigator.dataSize && !dataNavigator.datasource?.pagination?.next)">\n <nav wmPagination\n navigationalign.bind="navigationalign"\n navigation.bind="navControls"\n showrecordcount.bind="showrecordcount"\n maxsize.bind="maxsize"\n boundarylinks.bind="boundarylinks"\n forceellipses.bind="forceellipses"\n directionlinks.bind="directionlinks"\n show.bind="!onDemandLoad"\n paginationchange.event="beforePaginationChange($event, $index)"\n ></nav>\n <a *ngIf="onDemandLoad" href="javascript:void(0);"\n (click)="dataNavigator.navigatePage(\'next\', $event)"\n class="app-button btn btn-block"\n [ngClass]="paginationclass"\n [textContent]="ondemandmessage"\n ></a>\n</div>\n\n\x3c!--This template will be displayed when groupby is specified--\x3e\n<ng-template #groupedListTemplate>\n <li *ngFor="let groupObj of groupedData" class="app-list-item-group clearfix">\n <ul [attr.tabindex]="tabindex" class="list-group item-group" [ngClass]="listclass">\n <li class="app-list-item-header list-item list-group-header" (click)="handleHeaderClick($event)" [ngClass]="{\'collapsible-content\': collapsible}">\n <h4>{{groupObj.key}}\n <div class="header-action">\n <i class="app-icon wi action wi-chevron-up" *ngIf="collapsible"></i>\n <span *ngIf="showcount" class="label label-default">{{groupObj.data.length}}</span>\n </div>\n </h4>\n </li>\n <ul class="list-group clearfix {{direction === \'horizontal\' ? \'app-horizontal-list\': \'\'}}">\n <li *ngFor="let item of groupObj.data; index as $index; first as $first; last as $last;" [attr.tabindex]="tabindex"\n class="app-list-item group-list-item {{itemsPerRowClass}}"\n [ngClass]="listItemRef.itemClass"\n [wmListItem]="item" #listItemRef="listItemRef">\n <ng-container [ngTemplateOutlet]="listTemplate" [ngTemplateOutletContext]="{item: item, $index: $index, itemRef: listItemRef, $first: $first, $last: $last, currentItemWidgets: listItemRef.currentItemWidgets}"></ng-container>\n </li>\n </ul>\n </ul>\n </li>\n</ng-template>\n',providers:[i.provideAsWidgetRef(v)]}]}],v.ctorParameters=function(){return[{type:t.Injector},{type:t.ChangeDetectorRef},{type:i.ToDatePipe},{type:r.App},{type:r.AppDefaults},{type:t.NgZone},{type:String,decorators:[{type:t.Attribute,args:["itemclass.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["disableitem.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["dataset.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["datasource.bind"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseenter.event"]}]},{type:String,decorators:[{type:t.Attribute,args:["mouseleave.event"]}]},{type:r.StatePersistence},{type:r.PaginationService}]},v.propDecorators={listTemplate:[{type:t.ContentChild,args:["listTemplate"]}],listLeftActionTemplate:[{type:t.ContentChild,args:["listLeftActionTemplate"]}],listRightActionTemplate:[{type:t.ContentChild,args:["listRightActionTemplate"]}],btnComponents:[{type:t.ContentChildren,args:[a.ButtonComponent]}],dataNavigator:[{type:t.ViewChild,args:[o.PaginationComponent]}],listItems:[{type:t.ViewChildren,args:[m]}]};var y=[v,m],b=function(){};b.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,o.PaginationModule,i.WmComponentsModule],declarations:d([],u(y)),exports:d([],u(y)),entryComponents:[]}]}],e.ListComponent=v,e.ListItemDirective=m,e.ListModule=b,e["\u0275a"]=h,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/tooltip"),require("ngx-bootstrap/dropdown"),require("@wm/components/base"),require("@wm/components/basic"),require("@wm/components/input"),require("@wm/components/navigation/menu"),require("@wm/components/data/list"),require("@wm/components/data/pagination"),require("@wm/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@wm/components/data/table",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/tooltip","ngx-bootstrap/dropdown","@wm/components/base","@wm/components/basic","@wm/components/input","@wm/components/navigation/menu","@wm/components/data/list","@wm/components/data/pagination","@wm/core","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.data=e.wm.components.data||{},e.wm.components.data.table={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].tooltip,e["ngx-bootstrap"].dropdown,e.wm.components.base,e.wm.components.basic,e.wm.components.input,e.wm.components.navigation.menu,e.wm.components.data.list,e.wm.components.data.pagination,e.wm.core,e.rxjs,e.rxjs.operators)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m){"use strict";
|
|
507
507
|
/*! *****************************************************************************
|
|
508
508
|
Copyright (c) Microsoft Corporation.
|
|
509
509
|
|