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 | ;
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | // class returns unique instance id's for columns.
|
10 | // eg, the following calls (in this order) will result in:
|
11 | //
|
12 | // getInstanceIdForKey('country') => 0
|
13 | // getInstanceIdForKey('country') => 1
|
14 | // getInstanceIdForKey('country') => 2
|
15 | // getInstanceIdForKey('country') => 3
|
16 | // getInstanceIdForKey('age') => 0
|
17 | // getInstanceIdForKey('age') => 1
|
18 | // getInstanceIdForKey('country') => 4
|
19 | var GroupInstanceIdCreator = (function () {
|
20 | function GroupInstanceIdCreator() {
|
21 | // this map contains keys to numbers, so we remember what the last call was
|
22 | this.existingIds = {};
|
23 | }
|
24 | GroupInstanceIdCreator.prototype.getInstanceIdForKey = function (key) {
|
25 | var lastResult = this.existingIds[key];
|
26 | var result;
|
27 | if (typeof lastResult !== 'number') {
|
28 | // first time this key
|
29 | result = 0;
|
30 | }
|
31 | else {
|
32 | result = lastResult + 1;
|
33 | }
|
34 | this.existingIds[key] = result;
|
35 | return result;
|
36 | };
|
37 | return GroupInstanceIdCreator;
|
38 | }());
|
39 | exports.GroupInstanceIdCreator = GroupInstanceIdCreator;
|