UNPKG

1.19 kBJavaScriptView Raw
1/**
2 * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
3 * @version v18.1.2
4 * @link http://www.ag-grid.com/
5 * @license MIT
6 */
7"use strict";
8Object.defineProperty(exports, "__esModule", { value: true });
9var utils_1 = require("./utils");
10function defaultGroupComparator(valueA, valueB, nodeA, nodeB, accentedCompare) {
11 if (accentedCompare === void 0) { accentedCompare = false; }
12 console.warn('ag-Grid: Since ag-grid 11.0.0 defaultGroupComparator is not necessary. You can remove this from your colDef');
13 var nodeAIsGroup = utils_1.Utils.exists(nodeA) && nodeA.group;
14 var nodeBIsGroup = utils_1.Utils.exists(nodeB) && nodeB.group;
15 var bothAreGroups = nodeAIsGroup && nodeBIsGroup;
16 var bothAreNormal = !nodeAIsGroup && !nodeBIsGroup;
17 if (bothAreGroups) {
18 return utils_1.Utils.defaultComparator(nodeA.key, nodeB.key, accentedCompare);
19 }
20 else if (bothAreNormal) {
21 return utils_1.Utils.defaultComparator(valueA, valueB, accentedCompare);
22 }
23 else if (nodeAIsGroup) {
24 return 1;
25 }
26 else {
27 return -1;
28 }
29}
30exports.defaultGroupComparator = defaultGroupComparator;