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

34 lines (33 loc) 1.27 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)) { var parentGroup = getParentGroup(item); if (parentGroup) { if (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++ }); } } else { testIndexMap.set(item, { throughIndex: throughIndex++ }); } } else if (item.type === 'parent') { testIndexMap.set(item, { groupIndex: groupIndex }); } }); };