source: node_modules/recharts/es6/zIndex/zIndexSelectors.js@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import { createSelector } from 'reselect';
2import { arrayContentsAreEqualCheck } from '../state/selectors/arrayEqualityCheck';
3import { DefaultZIndexes } from './DefaultZIndexes';
4
5/**
6 * Given a zIndex, returns the corresponding portal element reference.
7 * If no zIndex is provided or if the zIndex is not registered, returns undefined.
8 *
9 * It also returns undefined in case the z-index portal has not been rendered yet.
10 */
11export var selectZIndexPortalElement = createSelector(state => state.zIndex.zIndexMap, (_, zIndex) => zIndex, (_, _zIndex, isPanorama) => isPanorama, (zIndexMap, zIndex, isPanorama) => {
12 if (zIndex == null) {
13 return undefined;
14 }
15 var entry = zIndexMap[zIndex];
16 if (entry == null) {
17 return undefined;
18 }
19 if (isPanorama) {
20 return entry.panoramaElement;
21 }
22 return entry.element;
23});
24export var selectAllRegisteredZIndexes = createSelector(state => state.zIndex.zIndexMap, zIndexMap => {
25 var allNumbers = Object.keys(zIndexMap).map(zIndexStr => parseInt(zIndexStr, 10)).concat(Object.values(DefaultZIndexes));
26 var uniqueNumbers = Array.from(new Set(allNumbers));
27 return uniqueNumbers.sort((a, b) => a - b);
28}, {
29 memoizeOptions: {
30 resultEqualityCheck: arrayContentsAreEqualCheck
31 }
32});
Note: See TracBrowser for help on using the repository browser.