@ui-grid/tree-base
Advanced tools
Comparing version 4.12.4 to 4.12.7
@@ -6,2 +6,21 @@ # Change Log | ||
## [4.12.7](https://github.com/angular-ui/ui-grid/compare/v4.12.6...v4.12.7) (2024-04-12) | ||
### Bug Fixes | ||
* **core:** remove upper limit for AngularJs ([5517031](https://github.com/angular-ui/ui-grid/commit/5517031a433630dc3f2f70df444e265d6f1af520)) | ||
## [4.12.5](https://github.com/angular-ui/ui-grid/compare/v4.12.4...v4.12.5) (2024-04-11) | ||
**Note:** Version bump only for package @ui-grid/tree-base | ||
## [4.12.4](https://github.com/angular-ui/ui-grid/compare/v4.12.3...v4.12.4) (2023-08-17) | ||
@@ -8,0 +27,0 @@ |
/*! | ||
* ui-grid - v4.12.4 - 2023-08-17 | ||
* ui-grid - v4.12.7 - 2024-04-12 | ||
* http://ui-grid.info/ | ||
* Copyright (c) 2023 ; License: MIT | ||
* Copyright (c) 2024 ; License: MIT | ||
*/ | ||
!function(){"use strict";var e=angular.module("ui.grid.treeBase",["ui.grid"]);e.constant("uiGridTreeBaseConstants",{featureName:"treeBase",rowHeaderColName:"treeBaseRowHeaderCol",EXPANDED:"expanded",COLLAPSED:"collapsed",aggregation:{COUNT:"count",SUM:"sum",MAX:"max",MIN:"min",AVG:"avg"}}),e.service("uiGridTreeBaseService",["$q","uiGridTreeBaseConstants","gridUtil","GridRow","gridClassFactory","i18nService","uiGridConstants","rowSorter",function(e,l,t,r,n,o,a,i){var g={initializeGrid:function(r){r.treeBase={},r.treeBase.numberLevels=0,r.treeBase.expandAll=!1,r.treeBase.tree=[],g.defaultGridOptions(r.options),r.registerRowsProcessor(g.treeRows,410),r.registerColumnBuilder(g.treeBaseColumnBuilder),g.createRowHeader(r);var e={treeBase:{rowExpanded:{},rowCollapsed:{}}},t={treeBase:{expandAllRows:function(){g.expandAllRows(r)},collapseAllRows:function(){g.collapseAllRows(r)},toggleRowTreeState:function(e){g.toggleRowTreeState(r,e)},expandRow:function(e,t){g.expandRow(r,e,t)},expandRowChildren:function(e){g.expandRowChildren(r,e)},collapseRow:function(e){g.collapseRow(r,e)},collapseRowChildren:function(e){g.collapseRowChildren(r,e)},getTreeExpandedState:function(){return{expandedState:g.getTreeState(r)}},setTreeState:function(e){g.setTreeState(r,e)},getRowChildren:function(e){return e.treeNode.children.map(function(e){return e.row})}}};r.api.registerEventsFromObject(e),r.api.registerMethodsFromObject(t)},defaultGridOptions:function(e){e.treeRowHeaderBaseWidth=e.treeRowHeaderBaseWidth||30,e.treeIndent=null!=e.treeIndent?e.treeIndent:10,e.showTreeRowHeader=!1!==e.showTreeRowHeader,e.showTreeExpandNoChildren=!1!==e.showTreeExpandNoChildren,e.treeRowHeaderAlwaysVisible=!1!==e.treeRowHeaderAlwaysVisible,e.treeCustomAggregations=e.treeCustomAggregations||{},e.enableExpandAll=!1!==e.enableExpandAll},treeBaseColumnBuilder:function(e,t,r){void 0!==e.customTreeAggregationFn&&(t.treeAggregationFn=e.customTreeAggregationFn),void 0!==e.treeAggregationType&&(t.treeAggregation={type:e.treeAggregationType},void 0!==r.treeCustomAggregations[e.treeAggregationType]?(t.treeAggregationFn=r.treeCustomAggregations[e.treeAggregationType].aggregationFn,t.treeAggregationFinalizerFn=r.treeCustomAggregations[e.treeAggregationType].finalizerFn,t.treeAggregation.label=r.treeCustomAggregations[e.treeAggregationType].label):void 0!==g.nativeAggregations()[e.treeAggregationType]&&(t.treeAggregationFn=g.nativeAggregations()[e.treeAggregationType].aggregationFn,t.treeAggregation.label=g.nativeAggregations()[e.treeAggregationType].label)),void 0!==e.treeAggregationLabel&&(void 0===t.treeAggregation&&(t.treeAggregation={}),t.treeAggregation.label=e.treeAggregationLabel),t.treeAggregationUpdateEntity=!1!==e.treeAggregationUpdateEntity,void 0===t.customTreeAggregationFinalizerFn&&(t.customTreeAggregationFinalizerFn=e.customTreeAggregationFinalizerFn)},createRowHeader:function(e){var t={name:l.rowHeaderColName,displayName:"",width:e.options.treeRowHeaderBaseWidth,minWidth:10,cellTemplate:"ui-grid/treeBaseRowHeader",headerCellTemplate:"ui-grid/treeBaseHeaderCell",enableColumnResizing:!1,enableColumnMenu:!1,exporterSuppressExport:!0,allowCellFocus:!0};t.visible=e.options.treeRowHeaderAlwaysVisible,e.addRowHeaderColumn(t,-100)},expandAllRows:function(t){t.treeBase.tree.forEach(function(e){g.setAllNodes(t,e,l.EXPANDED)}),t.treeBase.expandAll=!0,t.queueGridRefresh()},collapseAllRows:function(t){t.treeBase.tree.forEach(function(e){g.setAllNodes(t,e,l.COLLAPSED)}),t.treeBase.expandAll=!1,t.queueGridRefresh()},setAllNodes:function(t,e,r){void 0!==e.state&&e.state!==r&&((e.state=r)===l.EXPANDED?t.api.treeBase.raise.rowExpanded(e.row):t.api.treeBase.raise.rowCollapsed(e.row)),e.children&&e.children.forEach(function(e){g.setAllNodes(t,e,r)})},toggleRowTreeState:function(e,t){void 0===t.treeLevel||null===t.treeLevel||t.treeLevel<0||(t.treeNode.state===l.EXPANDED?g.collapseRow(e,t):g.expandRow(e,t,!1),e.queueGridRefresh())},expandRow:function(e,t,r){if(r){for(var n=[];t&&void 0!==t.treeLevel&&null!==t.treeLevel&&0<=t.treeLevel&&t.treeNode.state!==l.EXPANDED;)n.push(t),t=t.treeNode.parentRow;if(0<n.length){for(t=n.pop();t;)t.treeNode.state=l.EXPANDED,e.api.treeBase.raise.rowExpanded(t),t=n.pop();e.treeBase.expandAll=g.allExpanded(e.treeBase.tree),e.queueGridRefresh()}}else void 0===t.treeLevel||null===t.treeLevel||t.treeLevel<0||t.treeNode.state!==l.EXPANDED&&(t.treeNode.state=l.EXPANDED,e.api.treeBase.raise.rowExpanded(t),e.treeBase.expandAll=g.allExpanded(e.treeBase.tree),e.queueGridRefresh())},expandRowChildren:function(e,t){void 0===t.treeLevel||null===t.treeLevel||t.treeLevel<0||(g.setAllNodes(e,t.treeNode,l.EXPANDED),e.treeBase.expandAll=g.allExpanded(e.treeBase.tree),e.queueGridRefresh())},collapseRow:function(e,t){void 0===t.treeLevel||null===t.treeLevel||t.treeLevel<0||t.treeNode.state!==l.COLLAPSED&&(t.treeNode.state=l.COLLAPSED,e.treeBase.expandAll=!1,e.api.treeBase.raise.rowCollapsed(t),e.queueGridRefresh())},collapseRowChildren:function(e,t){void 0===t.treeLevel||null===t.treeLevel||t.treeLevel<0||(g.setAllNodes(e,t.treeNode,l.COLLAPSED),e.treeBase.expandAll=!1,e.queueGridRefresh())},allExpanded:function(e){var t=!0;return e.forEach(function(e){g.allExpandedInternal(e)||(t=!1)}),t},allExpandedInternal:function(e){var t;return!(e.children&&0<e.children.length)||e.state!==l.COLLAPSED&&(t=!0,e.children.forEach(function(e){g.allExpandedInternal(e)||(t=!1)}),t)},treeRows:function(e){var t=this;return 0===e.length?(g.updateRowHeaderWidth(t),e):(t.treeBase.tree=g.createTree(t,e),g.updateRowHeaderWidth(t),g.sortTree(t),g.fixFilter(t),g.renderTree(t.treeBase.tree))},updateRowHeaderWidth:function(e){var t=e.getColumn(l.rowHeaderColName),r=e.options.treeRowHeaderBaseWidth+e.options.treeIndent*Math.max(e.treeBase.numberLevels-1,0),r=(t&&r!==t.width&&(t.width=r,e.queueRefresh()),!0);!1===e.options.showTreeRowHeader&&(r=!1),!1===e.options.treeRowHeaderAlwaysVisible&&e.treeBase.numberLevels<=0&&(r=!1),t&&t.visible!==r&&(t.visible=r,t.colDef.visible=r,e.queueGridRefresh())},renderTree:function(e){var t=[];return e.forEach(function(e){e.row.visible&&t.push(e.row),e.state===l.EXPANDED&&e.children&&0<e.children.length&&(t=t.concat(g.renderTree(e.children)))}),t},createTree:function(r,e){var n=-1,o={},a=[],i=(r.treeBase.tree=[],r.treeBase.numberLevels=0,g.getAggregations(r));for(e.forEach(function(e){if(e.internalRow||e.treeLevel===e.entity.$$treeLevel||(e.treeLevel=e.entity.$$treeLevel),e.treeLevel<=n){for(;e.treeLevel<=n;){var t=a.pop();g.finaliseAggregations(t),n--}0<a.length?g.setCurrentState(a):l.EXPANDED}void 0!==e.treeLevel&&null!==e.treeLevel&&0<=e.treeLevel&&o.hasOwnProperty(e.uid)&&a.push(o[e.uid]),(void 0===e.treeLevel||null===e.treeLevel||e.treeLevel<0)&&e.visible&&g.aggregate(r,e,a),o.hasOwnProperty(e.uid)||g.addOrUseNode(r,e,a,i),void 0!==e.treeLevel&&null!==e.treeLevel&&0<=e.treeLevel&&(o.hasOwnProperty(e.uid)||(o[e.uid]=e,a.push(e)),n++,g.setCurrentState(a)),r.treeBase.numberLevels<e.treeLevel+1&&(r.treeBase.numberLevels=e.treeLevel+1)});0<a.length;){var t=a.pop();g.finaliseAggregations(t)}return r.treeBase.tree},addOrUseNode:function(e,t,r,n){var o=[],n=(n.forEach(function(e){o.push(g.buildAggregationObject(e.col))}),{state:l.COLLAPSED,row:t,parentRow:null,aggregations:o,children:[]});t.treeNode&&(n.state=t.treeNode.state),0<r.length&&(n.parentRow=r[r.length-1]),t.treeNode=n,(0===r.length?e.treeBase.tree:r[r.length-1].treeNode.children).push(n)},setCurrentState:function(e){var t=l.EXPANDED;return e.forEach(function(e){e.treeNode.state===l.COLLAPSED&&(t=l.COLLAPSED)}),t},sortTree:function(e){e.columns.forEach(function(e){e.sort&&e.sort.ignoreSort&&delete e.sort.ignoreSort}),e.treeBase.tree=g.sortInternal(e,e.treeBase.tree)},sortInternal:function(t,e){e=e.map(function(e){return e.row}),e=(e=i.sort(t,e,t.columns)).map(function(e){return e.treeNode});return e.forEach(function(e){e.state===l.EXPANDED&&e.children&&0<e.children.length&&(e.children=g.sortInternal(t,e.children))}),e},fixFilter:function(e){var t;e.treeBase.tree.forEach(function(e){e.children&&0<e.children.length&&(t=e.row.visible,g.fixFilterInternal(e.children,t))})},fixFilterInternal:function(e,t){return e.forEach(function(e){e.row.visible&&!t&&(g.setParentsVisible(e),t=!0),e.children&&0<e.children.length&&g.fixFilterInternal(e.children,t&&e.row.visible)&&(t=!0)}),t},setParentsVisible:function(e){for(;e.parentRow;)e.parentRow.visible=!0,e=e.parentRow.treeNode},buildAggregationObject:function(e){var t={col:e};return e.treeAggregation&&e.treeAggregation.type&&(t.type=e.treeAggregation.type),e.treeAggregation&&e.treeAggregation.label&&(t.label=e.treeAggregation.label),t},getAggregations:function(t){var r=[];return t.columns.forEach(function(e){void 0!==e.treeAggregationFn&&(r.push(g.buildAggregationObject(e)),t.options.showColumnFooter)&&void 0===e.colDef.aggregationType&&e.treeAggregation&&(e.treeFooterAggregation=g.buildAggregationObject(e),e.aggregationType=g.treeFooterAggregationType)}),r},aggregate:function(o,a,e){0===e.length&&a.treeNode&&a.treeNode.aggregations&&a.treeNode.aggregations.forEach(function(e){var t,r;void 0!==e.col.treeFooterAggregation&&(t=o.getCellValue(a,e.col),r=Number(t),e.col.treeAggregationFn?e.col.treeAggregationFn(e.col.treeFooterAggregation,t,r,a):e.col.treeFooterAggregation.value=void 0)}),e.forEach(function(e,n){e.treeNode.aggregations&&e.treeNode.aggregations.forEach(function(e){var t=o.getCellValue(a,e.col),r=Number(t);e.col.treeAggregationFn(e,t,r,a),0===n&&void 0!==e.col.treeFooterAggregation&&(e.col.treeAggregationFn?e.col.treeAggregationFn(e.col.treeFooterAggregation,t,r,a):e.col.treeFooterAggregation.value=void 0)})})},nativeAggregations:function(){return{count:{label:o.get().aggregation.count,menuTitle:o.get().grouping.aggregate_count,aggregationFn:function(e,t,r){void 0===e.value?e.value=1:e.value++}},sum:{label:o.get().aggregation.sum,menuTitle:o.get().grouping.aggregate_sum,aggregationFn:function(e,t,r){isNaN(r)||(void 0===e.value?e.value=r:e.value+=r)}},min:{label:o.get().aggregation.min,menuTitle:o.get().grouping.aggregate_min,aggregationFn:function(e,t,r){(void 0===e.value||null!=t&&(t<e.value||null===e.value))&&(e.value=t)}},max:{label:o.get().aggregation.max,menuTitle:o.get().grouping.aggregate_max,aggregationFn:function(e,t,r){(void 0===e.value||null!=t&&(t>e.value||null===e.value))&&(e.value=t)}},avg:{label:o.get().aggregation.avg,menuTitle:o.get().grouping.aggregate_avg,aggregationFn:function(e,t,r){void 0===e.count?e.count=1:e.count++,isNaN(r)||(void 0===e.value||void 0===e.sum?(e.value=r,e.sum=r):(e.sum+=r,e.value=e.sum/e.count))}}}},finaliseAggregation:function(e,t){t.col.treeAggregationUpdateEntity&&void 0!==e&&void 0!==e.entity["$$"+t.col.uid]&&angular.extend(t,e.entity["$$"+t.col.uid]),"function"==typeof t.col.treeAggregationFinalizerFn&&t.col.treeAggregationFinalizerFn(t),"function"==typeof t.col.customTreeAggregationFinalizerFn&&t.col.customTreeAggregationFinalizerFn(t),void 0===t.rendered&&(t.rendered=t.label?t.label+t.value:t.value)},finaliseAggregations:function(e){null!=e&&void 0!==e.treeNode.aggregations&&e.treeNode.aggregations.forEach(function(r){var n;g.finaliseAggregation(e,r),r.col.treeAggregationUpdateEntity&&(n={},angular.forEach(r,function(e,t){r.hasOwnProperty(t)&&"col"!==t&&(n[t]=e)}),e.entity["$$"+r.col.uid]=n)})},treeFooterAggregationType:function(e,t){return g.finaliseAggregation(void 0,t.treeFooterAggregation),void 0===t.treeFooterAggregation.value||null===t.treeFooterAggregation.rendered?"":t.treeFooterAggregation.rendered}};return g}]),e.directive("uiGridTreeBaseRowHeaderButtons",["$templateCache","uiGridTreeBaseService",function(e,a){return{replace:!0,restrict:"E",template:e.get("ui-grid/treeBaseRowHeaderButtons"),scope:!0,require:"^uiGrid",link:function(r,e,t,n){var o=n.grid;r.treeButtonClass=function(e){if(o.options.showTreeExpandNoChildren&&-1<e.treeLevel||e.treeNode.children&&0<e.treeNode.children.length)return"expanded"===e.treeNode.state?"ui-grid-icon-minus-squared":"collapsed"===e.treeNode.state?"ui-grid-icon-plus-squared":void 0},r.treeButtonClick=function(e,t){t.stopPropagation(),a.toggleRowTreeState(o,e,t)},r.treeButtonKeyDown=function(e,t){32!==t.keyCode&&13!==t.keyCode||r.treeButtonClick(e,t)}}}}]),e.directive("uiGridTreeBaseExpandAllButtons",["$templateCache","uiGridTreeBaseService",function(e,n){return{replace:!0,restrict:"E",template:e.get("ui-grid/treeBaseExpandAllButtons"),scope:!1,link:function(t){var r=t.col.grid;t.headerButtonClass=function(){return 0<r.treeBase.numberLevels&&r.treeBase.expandAll?"ui-grid-icon-minus-squared":0<r.treeBase.numberLevels&&!r.treeBase.expandAll?"ui-grid-icon-plus-squared":void 0},t.headerButtonClick=function(e,t){r.treeBase.expandAll?n.collapseAllRows(r,t):n.expandAllRows(r,t)},t.headerButtonKeyDown=function(e){32!==e.keyCode&&13!==e.keyCode||t.headerButtonClick(r,e)}}}}]),e.directive("uiGridViewport",function(){return{priority:-200,scope:!1,compile:function(e){var e=angular.element(e.children().children()[0]),t=e.attr("ng-class"),r="",r=t?t.slice(0,-1)+",'ui-grid-tree-header-row': row.treeLevel > -1}":"{'ui-grid-tree-header-row': row.treeLevel > -1}";return e.attr("ng-class",r),{pre:function(e,t,r,n){},post:function(e,t,r,n){}}}}})}(),angular.module("ui.grid.treeBase").run(["$templateCache",function(e){"use strict";e.put("ui-grid/treeBaseExpandAllButtons",'<div class="ui-grid-tree-base-row-header-buttons" tabindex="0" ng-class="headerButtonClass()" ng-click="headerButtonClick($event)" ng-keydown="headerButtonKeyDown($event)"></div>'),e.put("ui-grid/treeBaseHeaderCell",'<div><div class="ui-grid-cell-contents" col-index="renderIndex"><ui-grid-tree-base-expand-all-buttons ng-if="grid.options.enableExpandAll"></ui-grid-tree-base-expand-all-buttons></div></div>'),e.put("ui-grid/treeBaseRowHeader",'<div class="ui-grid-cell-contents"><ui-grid-tree-base-row-header-buttons></ui-grid-tree-base-row-header-buttons></div>'),e.put("ui-grid/treeBaseRowHeaderButtons",'<div class="ui-grid-tree-base-row-header-buttons" ng-class="{\'ui-grid-tree-base-header\': row.treeLevel > -1 }" tabindex="0" ng-keydown="treeButtonKeyDown(row, $event)" ng-click="treeButtonClick(row, $event)"><i ng-class="treeButtonClass(row)" ng-style="{\'padding-left\': grid.options.treeIndent * row.treeLevel + \'px\'}"></i> </div>')}]); |
{ | ||
"name": "@ui-grid/tree-base", | ||
"version": "4.12.4", | ||
"version": "4.12.7", | ||
"description": "This ui-grid module provides a tree view of the data, with nodes and leaves", | ||
@@ -10,4 +10,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@ui-grid/core": "^4.12.4", | ||
"angular": ">=1.4.0 1.8.x" | ||
"@ui-grid/core": "^4.12.7", | ||
"angular": ">=1.4.0" | ||
}, | ||
@@ -43,3 +43,3 @@ "publishConfig": { | ||
"license": "MIT", | ||
"gitHead": "8892f1d178669530a8db19c7a269fd00f88adb85" | ||
"gitHead": "3a8c05512953d3e52a254ee3a11ca79b3bda6901" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
279742
24
5534
0
1
80
Updated@ui-grid/core@^4.12.7
Updatedangular@>=1.4.0