UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

29 lines (28 loc) 1.09 kB
var testIndexMap = new WeakMap(); export var getTestOptionIndexes = function (item) { return testIndexMap.get(item); }; export var generateTestIndexes = function (filteredItems, getParentGroup) { var throughIndex = 1; var groupIndex = 0; var inGroupIndex = 1; var currentGroup = null; filteredItems.forEach(function (item) { if (!('type' in item)) { testIndexMap.set(item, { throughIndex: throughIndex++ }); } else if (item.type === 'child') { var parentGroup = getParentGroup(item); if (parentGroup && parentGroup !== currentGroup) { currentGroup = parentGroup; inGroupIndex = 1; testIndexMap.set(item, { throughIndex: throughIndex++, groupIndex: ++groupIndex, inGroupIndex: inGroupIndex++ }); } else { testIndexMap.set(item, { throughIndex: throughIndex++, groupIndex: groupIndex, inGroupIndex: inGroupIndex++ }); } } }); };