angular-ui-grid
Version:
A data grid for Angular
2 lines • 7.61 kB
JavaScript
/*! For license information please see ui-grid.expandable.min.js.LICENSE.txt */
(()=>{var e={631:e=>{e.exports='<div\n ui-grid-expandable-row\n ng-if="expandableRow.shouldRenderExpand()"\n class="expandableRow"\n style="float:left; margin-top: 1px; margin-bottom: 1px"\n ng-style="{width: (grid.renderContainers.body.getCanvasWidth()) + \'px\', height: row.expandedRowHeight + \'px\'}">\n</div>\n'},845:e=>{e.exports='<div class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell">\n <div class="ui-grid-cell-contents">\n <i class="clickable"\n ng-if="!(row.groupHeader==true || row.entity.subGridOptions.disableRowExpandable)"\n ng-class="{ \'ui-grid-icon-plus-squared\' : !row.isExpanded, \'ui-grid-icon-minus-squared\' : row.isExpanded }"\n ng-click="grid.api.expandable.toggleRowExpansion(row.entity, $event)"\n aria-expanded="{{!!row.isExpanded}}">\n </i>\n </div>\n</div>\n'},36:e=>{e.exports="<div\n ng-if=\"expandableRow.shouldRenderFiller()\"\n ng-class=\"{scrollFiller: true, scrollFillerClass:(colContainer.name === 'body')}\"\n ng-style=\"{ width: (grid.getViewportWidth()) + 'px', height: row.expandedRowHeight + 2 + 'px', 'margin-left': grid.options.rowHeader.rowHeaderWidth + 'px' }\">\n \n</div>\n"},389:e=>{e.exports='<div class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell">\n <div class="ui-grid-cell-contents">\n <span class="ui-grid-cell-empty" ng-if="!grid.options.showExpandAllButton"></span>\n <button type="button" class="ui-grid-icon-button clickable"\n ng-if="grid.options.showExpandAllButton"\n ng-class="{ \'ui-grid-icon-plus-squared\' : !grid.expandable.expandedAll, \'ui-grid-icon-minus-squared\' : grid.expandable.expandedAll }"\n ng-click="grid.api.expandable.toggleAllRows()"\n aria-expanded="{{grid.expandable.expandedAll}}">\n </button>\n </div>\n</div>\n'},693:()=>{!function(){"use strict";var e=angular.module("ui.grid.expandable",["ui.grid"]);e.service("uiGridExpandableService",["gridUtil",function(e){var n={initializeGrid:function(i){i.expandable={},i.expandable.expandedAll=!1,i.options.enableOnDblClickExpand=!1!==i.options.enableOnDblClickExpand,i.options.enableExpandable=!1!==i.options.enableExpandable,i.options.showExpandAllButton=!1!==i.options.showExpandAllButton,i.options.expandableRowHeight=i.options.expandableRowHeight||150,i.options.expandableRowHeaderWidth=i.options.expandableRowHeaderWidth||40,i.options.enableExpandable&&!i.options.expandableRowTemplate&&(e.logError("You have not set the expandableRowTemplate, disabling expandable module"),i.options.enableExpandable=!1);var o={events:{expandable:{rowExpandedBeforeStateChanged:function(e,n,i){},rowExpandedStateChanged:function(e,n,i){},rowExpandedRendered:function(e,n,i){}}},methods:{expandable:{toggleRowExpansion:function(e,o){var a=i.getRow(e);null!==a&&n.toggleRowExpansion(i,a,o)},expandAllRows:function(){n.expandAllRows(i)},collapseAllRows:function(){n.collapseAllRows(i)},toggleAllRows:function(){n.toggleAllRows(i)},expandRow:function(e){var o=i.getRow(e);null===o||o.isExpanded||n.toggleRowExpansion(i,o)},collapseRow:function(e){var o=i.getRow(e);null!==o&&o.isExpanded&&n.toggleRowExpansion(i,o)},getExpandedRows:function(){return n.getExpandedRows(i).map((function(e){return e.entity}))}}}};i.api.registerEventsFromObject(o.events),i.api.registerMethodsFromObject(o.methods)},toggleRowExpansion:function(e,i,o){e.api.expandable.raise.rowExpandedBeforeStateChanged(i),i.isExpanded=!i.isExpanded,angular.isUndefined(i.expandedRowHeight)&&(i.expandedRowHeight=e.options.expandableRowHeight),i.isExpanded?(i.height=i.grid.options.rowHeight+i.expandedRowHeight,e.expandable.expandedAll=n.getExpandedRows(e).length===e.rows.length):(i.height=i.grid.options.rowHeight,e.expandable.expandedAll=!1),e.api.expandable.raise.rowExpandedStateChanged(i,o),function n(){i.expandedRendered?e.api.expandable.raise.rowExpandedRendered(i,o):window.setTimeout(n,100)}()},expandAllRows:function(e){e.renderContainers.body.visibleRowCache.forEach((function(i){i.isExpanded||i.entity.subGridOptions&&i.entity.subGridOptions.disableRowExpandable||n.toggleRowExpansion(e,i)})),e.expandable.expandedAll=!0,e.queueGridRefresh()},collapseAllRows:function(e){e.renderContainers.body.visibleRowCache.forEach((function(i){i.isExpanded&&n.toggleRowExpansion(e,i)})),e.expandable.expandedAll=!1,e.queueGridRefresh()},toggleAllRows:function(e){e.expandable.expandedAll?n.collapseAllRows(e):n.expandAllRows(e)},getExpandedRows:function(e){return e.rows.filter((function(e){return e.isExpanded}))}};return n}]),e.directive("uiGridExpandable",["uiGridExpandableService","$templateCache",function(e,n){return{replace:!0,priority:0,require:"^uiGrid",scope:!1,compile:function(){return{pre:function(i,o,a,d){if(e.initializeGrid(d.grid),d.grid.options.enableExpandable&&!1!==d.grid.options.enableExpandableRowHeader){var r={name:"expandableButtons",displayName:"",exporterSuppressExport:!0,enableColumnResizing:!1,enableColumnMenu:!1,width:d.grid.options.expandableRowHeaderWidth||30};r.cellTemplate=n.get("ui-grid/expandableRowHeader"),r.headerCellTemplate=n.get("ui-grid/expandableTopRowHeader"),d.grid.addRowHeaderColumn(r,-90)}},post:function(e,n,i,o){}}}}}]),e.directive("uiGrid",(function(){return{replace:!0,priority:599,require:"^uiGrid",scope:!1,compile:function(){return{pre:function(e,n,i,o){o.grid.api.core.on.renderingComplete(e,(function(){e.row&&e.row.grid&&e.row.grid.options&&e.row.grid.options.enableExpandable&&(o.grid.parentRow=e.row)}))},post:function(e,n,i,o){}}}}})),e.directive("uiGridExpandableRow",["uiGridExpandableService","$compile","uiGridConstants","gridUtil",function(e,n,i,o){return{replace:!1,priority:0,scope:!1,compile:function(){return{pre:function(e,i){o.getTemplate(e.grid.options.expandableRowTemplate).then((function(o){if(e.grid.options.expandableRowScope){var a=e.grid.options.expandableRowScope;for(var d in a)a.hasOwnProperty(d)&&(e[d]=a[d])}var r=angular.element(o);r=n(r)(e),i.append(r),e.row.element=i,e.row.expandedRendered=!0}))},post:function(e,n){e.row.element=n,e.$on("$destroy",(function(){e.row.expandedRendered=!1}))}}}}}]),e.directive("uiGridRow",(function(){return{priority:-200,scope:!1,compile:function(){return{pre:function(e,n){e.grid.options.enableExpandable&&(e.expandableRow={},e.expandableRow.shouldRenderExpand=function(){return"body"===e.colContainer.name&&!1!==e.grid.options.enableExpandable&&e.row.isExpanded&&(!e.grid.isScrollingVertically||e.row.expandedRendered)},e.expandableRow.shouldRenderFiller=function(){return e.row.isExpanded&&("body"!==e.colContainer.name||e.grid.isScrollingVertically&&!e.row.expandedRendered)},e.grid.options.enableOnDblClickExpand&&n.on("dblclick",(function(n){e.grid.api.expandable.toggleRowExpansion(e.row.entity,n)})))},post:function(e,n,i,o){}}}}})),e.directive("uiGridViewport",["$compile","gridUtil","$templateCache",function(e,n,i){return{priority:-200,scope:!1,compile:function(e){var n=angular.element(e.children().children()[0]),o=i.get("ui-grid/expandableScrollFiller"),a=i.get("ui-grid/expandableRow");return n.append(a),n.append(o),{pre:function(e,n,i,o){},post:function(e,n,i,o){}}}}}])}()},561:(e,n,i)=>{angular.module("ui.grid.expandable").run(["$templateCache",function(e){"use strict";e.put("ui-grid/expandableRow",i(631)),e.put("ui-grid/expandableRowHeader",i(845)),e.put("ui-grid/expandableScrollFiller",i(36)),e.put("ui-grid/expandableTopRowHeader",i(389))}])}},n={};function i(o){var a=n[o];if(void 0!==a)return a.exports;var d=n[o]={exports:{}};return e[o](d,d.exports,i),d.exports}i(693),i(561)})();