@elliemae/ds-shared 1.57.1-rc.0 → 2.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Animations/BaseAnimation.js +25 -36
- package/cjs/Animations/Grow.js +31 -39
- package/cjs/Animations/GrowRight.js +31 -40
- package/cjs/Animations/GrowVertical.js +3 -2
- package/cjs/CheckableGroup.js +36 -50
- package/cjs/DeferRenderAfterComputation.js +12 -22
- package/cjs/FocusGroup/FocusGrid.js +94 -102
- package/cjs/FocusGroup/FocusGroup.js +215 -270
- package/cjs/FocusGroup/FocusGroupContext.js +1 -2
- package/cjs/FocusGroup/FocusGroupManager.js +88 -124
- package/cjs/FocusGroup/focusGroupManagerHoc.js +24 -29
- package/cjs/FocusGroup/index.js +14 -28
- package/cjs/FocusGroup/useFocusGroupItem.js +24 -27
- package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -16
- package/cjs/GroupContext/Group.js +76 -104
- package/cjs/GroupContext/GroupContext.js +1 -2
- package/cjs/GroupContext/GroupItem.js +10 -11
- package/cjs/GroupContext/index.js +6 -15
- package/cjs/ScrollSync/ScrollSync.js +86 -112
- package/cjs/ScrollSync/ScrollSyncPane.js +49 -92
- package/cjs/ScrollSync/ScrollSyncProvider.js +32 -28
- package/cjs/ScrollSync/index.js +4 -14
- package/cjs/ScrollSync/useScrollSync.js +0 -1
- package/cjs/constants.js +43 -4
- package/cjs/createDataInstance/createInstancePlugin.js +6 -10
- package/cjs/createDataInstance/createInstanceRef.js +34 -42
- package/cjs/createDataInstance/utils.js +42 -76
- package/cjs/defer-render-hoc/index.js +19 -64
- package/cjs/dimsum.config.js +7 -0
- package/cjs/index.js +10 -21
- package/cjs/prop-types.js +59 -0
- package/cjs/react-spring/index.js +3 -6
- package/cjs/react-spring/renderprops.js +3 -6
- package/cjs/toolbar/ToolbarProvider.js +60 -81
- package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
- package/cjs/useDataGrid/index.js +2 -17
- package/cjs/useDataGrid/initColumnDefinition.js +45 -53
- package/cjs/useDataGrid/useDataGrid.js +105 -152
- package/cjs/useDataList/index.js +2 -15
- package/cjs/useDataList/recordIterator.js +7 -11
- package/cjs/useDataList/useDataList.js +42 -63
- package/cjs/utils.js +39 -59
- package/cjs/virtualization/AutoHeightList.js +34 -27
- package/cjs/virtualization/FluidHeightList.js +23 -17
- package/cjs/virtualization/index.js +12 -18
- package/esm/Animations/BaseAnimation.js +24 -35
- package/esm/Animations/Grow.js +29 -37
- package/esm/Animations/GrowRight.js +29 -38
- package/esm/Animations/GrowVertical.js +3 -2
- package/esm/CheckableGroup.js +33 -46
- package/esm/DeferRenderAfterComputation.js +12 -21
- package/esm/FocusGroup/FocusGrid.js +86 -96
- package/esm/FocusGroup/FocusGroup.js +210 -263
- package/esm/FocusGroup/FocusGroupContext.js +0 -1
- package/esm/FocusGroup/FocusGroupManager.js +85 -115
- package/esm/FocusGroup/focusGroupManagerHoc.js +19 -23
- package/esm/FocusGroup/index.js +0 -14
- package/esm/FocusGroup/useFocusGroupItem.js +22 -25
- package/esm/FocusGroup/utils/getNextCellPosition.js +14 -16
- package/esm/GroupContext/Group.js +75 -96
- package/esm/GroupContext/GroupContext.js +1 -2
- package/esm/GroupContext/GroupItem.js +8 -9
- package/esm/GroupContext/index.js +0 -9
- package/esm/ScrollSync/ScrollSync.js +83 -104
- package/esm/ScrollSync/ScrollSyncPane.js +47 -83
- package/esm/ScrollSync/ScrollSyncProvider.js +31 -28
- package/esm/ScrollSync/index.js +0 -10
- package/esm/ScrollSync/useScrollSync.js +0 -1
- package/esm/constants.js +31 -5
- package/esm/createDataInstance/createInstancePlugin.js +5 -8
- package/esm/createDataInstance/createInstanceRef.js +29 -36
- package/esm/createDataInstance/utils.js +40 -74
- package/esm/defer-render-hoc/index.js +19 -57
- package/esm/dimsum.config.js +5 -0
- package/esm/index.js +0 -11
- package/esm/prop-types.js +43 -0
- package/esm/react-spring/index.js +1 -2
- package/esm/react-spring/renderprops.js +1 -2
- package/esm/toolbar/ToolbarProvider.js +55 -75
- package/esm/useDataGrid/VolatileRowsListener.js +12 -24
- package/esm/useDataGrid/index.js +0 -15
- package/esm/useDataGrid/initColumnDefinition.js +38 -45
- package/esm/useDataGrid/useDataGrid.js +85 -131
- package/esm/useDataList/index.js +0 -13
- package/esm/useDataList/recordIterator.js +7 -11
- package/esm/useDataList/useDataList.js +31 -51
- package/esm/utils.js +37 -57
- package/esm/virtualization/AutoHeightList.js +26 -19
- package/esm/virtualization/FluidHeightList.js +20 -14
- package/esm/virtualization/index.js +6 -12
- package/package.json +202 -13
- package/types/Animations/BaseAnimation.d.ts +12 -0
- package/types/Animations/Grow.d.ts +11 -0
- package/types/Animations/GrowRight.d.ts +11 -0
- package/types/Animations/GrowVertical.d.ts +1 -0
- package/types/CheckableGroup.d.ts +20 -0
- package/types/DeferRenderAfterComputation.d.ts +6 -0
- package/types/FocusGroup/FocusGrid.d.ts +10 -0
- package/types/FocusGroup/FocusGroup.d.ts +36 -0
- package/types/FocusGroup/FocusGroupContext.d.ts +3 -0
- package/types/FocusGroup/FocusGroupManager.d.ts +24 -0
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +7 -0
- package/types/FocusGroup/index.d.ts +6 -0
- package/types/FocusGroup/useFocusGroupItem.d.ts +2 -0
- package/types/FocusGroup/utils/getNextCellPosition.d.ts +12 -0
- package/types/GroupContext/Group.d.ts +14 -0
- package/types/GroupContext/GroupContext.d.ts +2 -0
- package/types/GroupContext/GroupItem.d.ts +5 -0
- package/types/GroupContext/index.d.ts +3 -0
- package/types/ScrollSync/ScrollSync.d.ts +21 -0
- package/types/ScrollSync/ScrollSyncPane.d.ts +3 -0
- package/types/ScrollSync/ScrollSyncProvider.d.ts +12 -0
- package/types/ScrollSync/index.d.ts +2 -0
- package/types/ScrollSync/useScrollSync.d.ts +6 -0
- package/types/constants.d.ts +30 -0
- package/types/createDataInstance/createInstancePlugin.d.ts +1 -0
- package/types/createDataInstance/createInstanceRef.d.ts +12 -0
- package/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
- package/types/createDataInstance/utils.d.ts +9 -0
- package/types/dimsum.config.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/types/prop-types.d.ts +41 -0
- package/types/react-spring/index.d.ts +1 -0
- package/types/react-spring/renderprops.d.ts +1 -0
- package/types/toolbar/ToolbarProvider.d.ts +10 -0
- package/types/useDataGrid/VolatileRowsListener.d.ts +5 -0
- package/types/useDataGrid/index.d.ts +1 -0
- package/types/useDataGrid/initColumnDefinition.d.ts +4 -0
- package/types/useDataGrid/useDataGrid.d.ts +8 -0
- package/types/useDataList/index.d.ts +1 -0
- package/types/useDataList/recordIterator.d.ts +1 -0
- package/types/useDataList/useDataList.d.ts +13 -0
- package/types/utils.d.ts +22 -0
- package/types/virtualization/AutoHeightList.d.ts +2 -0
- package/types/virtualization/FluidHeightList.d.ts +2 -0
- package/types/virtualization/index.d.ts +9 -0
- package/Animations/BaseAnimation/package.json +0 -10
- package/Animations/Grow/package.json +0 -10
- package/Animations/GrowRight/package.json +0 -10
- package/Animations/GrowVertical/package.json +0 -10
- package/CheckableGroup/package.json +0 -10
- package/DeferRenderAfterComputation/package.json +0 -10
- package/FocusGroup/FocusGrid/package.json +0 -10
- package/FocusGroup/FocusGroup/package.json +0 -10
- package/FocusGroup/FocusGroupContext/package.json +0 -10
- package/FocusGroup/FocusGroupManager/package.json +0 -10
- package/FocusGroup/focusGroupManagerHoc/package.json +0 -10
- package/FocusGroup/package.json +0 -10
- package/FocusGroup/useFocusGroupItem/package.json +0 -10
- package/FocusGroup/utils/getNextCellPosition/package.json +0 -10
- package/GroupContext/Group/package.json +0 -10
- package/GroupContext/GroupContext/package.json +0 -10
- package/GroupContext/GroupItem/package.json +0 -10
- package/GroupContext/package.json +0 -10
- package/ScrollSync/ScrollSync/package.json +0 -10
- package/ScrollSync/ScrollSyncPane/package.json +0 -10
- package/ScrollSync/ScrollSyncProvider/package.json +0 -10
- package/ScrollSync/package.json +0 -10
- package/ScrollSync/useScrollSync/package.json +0 -10
- package/cjs/Animations/BaseAnimation.js.map +0 -1
- package/cjs/Animations/Grow.js.map +0 -1
- package/cjs/Animations/GrowRight.js.map +0 -1
- package/cjs/Animations/GrowVertical.js.map +0 -1
- package/cjs/CheckableGroup.js.map +0 -1
- package/cjs/DeferRenderAfterComputation.js.map +0 -1
- package/cjs/FocusGroup/FocusGrid.js.map +0 -1
- package/cjs/FocusGroup/FocusGroup.js.map +0 -1
- package/cjs/FocusGroup/FocusGroupContext.js.map +0 -1
- package/cjs/FocusGroup/FocusGroupManager.js.map +0 -1
- package/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -1
- package/cjs/FocusGroup/index.js.map +0 -1
- package/cjs/FocusGroup/useFocusGroupItem.js.map +0 -1
- package/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -1
- package/cjs/GroupContext/Group.js.map +0 -1
- package/cjs/GroupContext/GroupContext.js.map +0 -1
- package/cjs/GroupContext/GroupItem.js.map +0 -1
- package/cjs/GroupContext/index.js.map +0 -1
- package/cjs/ScrollSync/ScrollSync.js.map +0 -1
- package/cjs/ScrollSync/ScrollSyncPane.js.map +0 -1
- package/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -1
- package/cjs/ScrollSync/index.js.map +0 -1
- package/cjs/ScrollSync/useScrollSync.js.map +0 -1
- package/cjs/constants.js.map +0 -1
- package/cjs/createDataInstance/createInstancePlugin.js.map +0 -1
- package/cjs/createDataInstance/createInstanceRef.js.map +0 -1
- package/cjs/createDataInstance/utils.js.map +0 -1
- package/cjs/defer-render-hoc/index.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/react-spring/index.js.map +0 -1
- package/cjs/react-spring/renderprops.js.map +0 -1
- package/cjs/toolbar/ToolbarProvider.js.map +0 -1
- package/cjs/useDataGrid/VolatileRowsListener.js.map +0 -1
- package/cjs/useDataGrid/index.js.map +0 -1
- package/cjs/useDataGrid/initColumnDefinition.js.map +0 -1
- package/cjs/useDataGrid/useDataGrid.js.map +0 -1
- package/cjs/useDataList/index.js.map +0 -1
- package/cjs/useDataList/recordIterator.js.map +0 -1
- package/cjs/useDataList/useDataList.js.map +0 -1
- package/cjs/utils.js.map +0 -1
- package/cjs/virtualization/AutoHeightList.js.map +0 -1
- package/cjs/virtualization/FluidHeightList.js.map +0 -1
- package/cjs/virtualization/index.js.map +0 -1
- package/constants/package.json +0 -10
- package/createDataInstance/createInstancePlugin/package.json +0 -10
- package/createDataInstance/createInstanceRef/package.json +0 -10
- package/createDataInstance/utils/package.json +0 -10
- package/defer-render-hoc/package.json +0 -10
- package/esm/Animations/BaseAnimation.js.map +0 -1
- package/esm/Animations/Grow.js.map +0 -1
- package/esm/Animations/GrowRight.js.map +0 -1
- package/esm/Animations/GrowVertical.js.map +0 -1
- package/esm/CheckableGroup.js.map +0 -1
- package/esm/DeferRenderAfterComputation.js.map +0 -1
- package/esm/FocusGroup/FocusGrid.js.map +0 -1
- package/esm/FocusGroup/FocusGroup.js.map +0 -1
- package/esm/FocusGroup/FocusGroupContext.js.map +0 -1
- package/esm/FocusGroup/FocusGroupManager.js.map +0 -1
- package/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -1
- package/esm/FocusGroup/index.js.map +0 -1
- package/esm/FocusGroup/useFocusGroupItem.js.map +0 -1
- package/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -1
- package/esm/GroupContext/Group.js.map +0 -1
- package/esm/GroupContext/GroupContext.js.map +0 -1
- package/esm/GroupContext/GroupItem.js.map +0 -1
- package/esm/GroupContext/index.js.map +0 -1
- package/esm/ScrollSync/ScrollSync.js.map +0 -1
- package/esm/ScrollSync/ScrollSyncPane.js.map +0 -1
- package/esm/ScrollSync/ScrollSyncProvider.js.map +0 -1
- package/esm/ScrollSync/index.js.map +0 -1
- package/esm/ScrollSync/useScrollSync.js.map +0 -1
- package/esm/constants.js.map +0 -1
- package/esm/createDataInstance/createInstancePlugin.js.map +0 -1
- package/esm/createDataInstance/createInstanceRef.js.map +0 -1
- package/esm/createDataInstance/utils.js.map +0 -1
- package/esm/defer-render-hoc/index.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/react-spring/index.js.map +0 -1
- package/esm/react-spring/renderprops.js.map +0 -1
- package/esm/toolbar/ToolbarProvider.js.map +0 -1
- package/esm/useDataGrid/VolatileRowsListener.js.map +0 -1
- package/esm/useDataGrid/index.js.map +0 -1
- package/esm/useDataGrid/initColumnDefinition.js.map +0 -1
- package/esm/useDataGrid/useDataGrid.js.map +0 -1
- package/esm/useDataList/index.js.map +0 -1
- package/esm/useDataList/recordIterator.js.map +0 -1
- package/esm/useDataList/useDataList.js.map +0 -1
- package/esm/utils.js.map +0 -1
- package/esm/virtualization/AutoHeightList.js.map +0 -1
- package/esm/virtualization/FluidHeightList.js.map +0 -1
- package/esm/virtualization/index.js.map +0 -1
- package/react-spring/package.json +0 -10
- package/react-spring/renderprops/package.json +0 -10
- package/toolbar/ToolbarProvider/package.json +0 -10
- package/useDataGrid/VolatileRowsListener/package.json +0 -10
- package/useDataGrid/initColumnDefinition/package.json +0 -10
- package/useDataGrid/package.json +0 -10
- package/useDataGrid/useDataGrid/package.json +0 -10
- package/useDataList/package.json +0 -10
- package/useDataList/recordIterator/package.json +0 -10
- package/useDataList/useDataList/package.json +0 -10
- package/utils/package.json +0 -10
- package/virtualization/AutoHeightList/package.json +0 -10
- package/virtualization/FluidHeightList/package.json +0 -10
- package/virtualization/package.json +0 -10
package/esm/Animations/Grow.js
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'react';
|
|
2
4
|
import BaseAnimation from './BaseAnimation.js';
|
|
3
|
-
import 'react-spring/renderprops.cjs';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
keys: keys,
|
|
32
|
-
leave: {
|
|
33
|
-
opacity: 0,
|
|
34
|
-
transform: "scale(".concat(from, ")")
|
|
35
|
-
},
|
|
36
|
-
onRest: onRest
|
|
37
|
-
}, children);
|
|
38
|
-
};
|
|
6
|
+
const Grow = ({
|
|
7
|
+
keys = undefined,
|
|
8
|
+
duration,
|
|
9
|
+
items = undefined,
|
|
10
|
+
from = 0,
|
|
11
|
+
to = 1,
|
|
12
|
+
children,
|
|
13
|
+
onRest = () => null
|
|
14
|
+
}) => /*#__PURE__*/_jsx(BaseAnimation, {
|
|
15
|
+
duration: duration,
|
|
16
|
+
enter: {
|
|
17
|
+
opacity: 1,
|
|
18
|
+
transform: "scale(".concat(to, ")")
|
|
19
|
+
},
|
|
20
|
+
from: {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
transform: "scale(".concat(from, ")")
|
|
23
|
+
},
|
|
24
|
+
items: items,
|
|
25
|
+
keys: keys,
|
|
26
|
+
leave: {
|
|
27
|
+
opacity: 0,
|
|
28
|
+
transform: "scale(".concat(from, ")")
|
|
29
|
+
},
|
|
30
|
+
onRest: onRest
|
|
31
|
+
}, void 0, children);
|
|
39
32
|
|
|
40
33
|
export { Grow as default };
|
|
41
|
-
//# sourceMappingURL=Grow.js.map
|
|
@@ -1,42 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'react';
|
|
2
4
|
import BaseAnimation from './BaseAnimation.js';
|
|
3
|
-
import 'react-spring/renderprops.cjs';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
items: items,
|
|
32
|
-
keys: keys,
|
|
33
|
-
leave: {
|
|
34
|
-
opacity: "".concat(from),
|
|
35
|
-
transform: 'translateX(100%)'
|
|
36
|
-
},
|
|
37
|
-
onRest: onRest
|
|
38
|
-
}, children);
|
|
39
|
-
};
|
|
6
|
+
const GrowRight = ({
|
|
7
|
+
keys = undefined,
|
|
8
|
+
items = undefined,
|
|
9
|
+
duration = 200,
|
|
10
|
+
from = 0,
|
|
11
|
+
to = 1,
|
|
12
|
+
children,
|
|
13
|
+
onRest = () => null
|
|
14
|
+
}) => /*#__PURE__*/_jsx(BaseAnimation, {
|
|
15
|
+
duration: duration,
|
|
16
|
+
enter: {
|
|
17
|
+
opacity: "".concat(to),
|
|
18
|
+
transform: 'translateX(0px)'
|
|
19
|
+
},
|
|
20
|
+
from: {
|
|
21
|
+
opacity: "".concat(from),
|
|
22
|
+
transform: 'translateX(100%)'
|
|
23
|
+
},
|
|
24
|
+
items: items,
|
|
25
|
+
keys: keys,
|
|
26
|
+
leave: {
|
|
27
|
+
opacity: "".concat(from),
|
|
28
|
+
transform: 'translateX(100%)'
|
|
29
|
+
},
|
|
30
|
+
onRest: onRest
|
|
31
|
+
}, void 0, children);
|
|
40
32
|
|
|
41
33
|
export { GrowRight as default };
|
|
42
|
-
//# sourceMappingURL=GrowRight.js.map
|
package/esm/CheckableGroup.js
CHANGED
|
@@ -1,68 +1,55 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
3
|
import React, { cloneElement } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { runAll, addOrRemove } from '@elliemae/ds-utilities/utils';
|
|
5
|
+
import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
|
-
function useCheckableGroup(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var value = _ref2.target.value;
|
|
26
|
-
setActive(function (prevActive) {
|
|
27
|
-
var nextActive = multi ? addOrRemove(prevActive, value) : value;
|
|
10
|
+
function useCheckableGroup({
|
|
11
|
+
children,
|
|
12
|
+
active: activeProp,
|
|
13
|
+
multi,
|
|
14
|
+
onCheck = () => null
|
|
15
|
+
}) {
|
|
16
|
+
const [active, setActive] = useDerivedStateFromProps(activeProp);
|
|
17
|
+
|
|
18
|
+
const handleCheck = ({
|
|
19
|
+
target: {
|
|
20
|
+
value
|
|
21
|
+
}
|
|
22
|
+
}, item) => {
|
|
23
|
+
setActive(prevActive => {
|
|
24
|
+
const nextActive = multi ? addOrRemove(prevActive, value) : value;
|
|
28
25
|
onCheck(nextActive, item);
|
|
29
26
|
return nextActive;
|
|
30
27
|
});
|
|
31
28
|
};
|
|
32
29
|
|
|
33
|
-
return React.Children.map(children,
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
return React.Children.map(children, child => {
|
|
31
|
+
const {
|
|
32
|
+
props
|
|
33
|
+
} = child;
|
|
34
|
+
const checked = Array.isArray(active) ? active.indexOf(props.name) !== -1 : active === props.name;
|
|
36
35
|
return /*#__PURE__*/cloneElement(child, _objectSpread(_objectSpread({}, props), {}, {
|
|
37
|
-
checked
|
|
36
|
+
checked,
|
|
38
37
|
onClick: runAll(handleCheck, props.onClick)
|
|
39
38
|
}));
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
function CheckableGroup(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
function CheckableGroup({
|
|
43
|
+
active = [],
|
|
44
|
+
multi = false,
|
|
45
|
+
// checkbox or radio
|
|
46
|
+
children
|
|
47
|
+
}) {
|
|
49
48
|
return useCheckableGroup({
|
|
50
|
-
active
|
|
51
|
-
multi
|
|
52
|
-
children
|
|
49
|
+
active,
|
|
50
|
+
multi,
|
|
51
|
+
children
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
CheckableGroup.propTypes = {
|
|
57
|
-
/* The item (if multi false) or items (if multi true) selected */
|
|
58
|
-
active: PropTypes.arrayOf(PropTypes.string),
|
|
59
|
-
|
|
60
|
-
/* Whether is multi select or not */
|
|
61
|
-
multi: PropTypes.bool,
|
|
62
|
-
|
|
63
|
-
/* Handler when a user checks an item */
|
|
64
|
-
onCheck: PropTypes.func
|
|
65
|
-
};
|
|
66
|
-
|
|
67
55
|
export { CheckableGroup as default, useCheckableGroup };
|
|
68
|
-
//# sourceMappingURL=CheckableGroup.js.map
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import raf from 'raf';
|
|
4
4
|
|
|
5
|
-
function DeferRenderAfterComputation(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
shouldRender = _useState2[0],
|
|
14
|
-
setShouldRender = _useState2[1];
|
|
15
|
-
|
|
16
|
-
useEffect(function () {
|
|
5
|
+
function DeferRenderAfterComputation({
|
|
6
|
+
children,
|
|
7
|
+
resolve,
|
|
8
|
+
fallback,
|
|
9
|
+
timeout = 2000
|
|
10
|
+
}) {
|
|
11
|
+
const [shouldRender, setShouldRender] = useState(false);
|
|
12
|
+
useEffect(() => {
|
|
17
13
|
// eslint-disable-next-line max-nested-callbacks
|
|
18
|
-
raf(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
setShouldRender(true);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|
|
14
|
+
raf(() => raf(() => resolve().then(() => {
|
|
15
|
+
setShouldRender(true);
|
|
16
|
+
})));
|
|
25
17
|
}, []);
|
|
26
18
|
return shouldRender ? children : fallback;
|
|
27
19
|
}
|
|
28
20
|
|
|
29
21
|
export { DeferRenderAfterComputation as default };
|
|
30
|
-
//# sourceMappingURL=DeferRenderAfterComputation.js.map
|
|
@@ -1,67 +1,68 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
1
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
3
|
import React, { useRef, useEffect, useMemo, createContext } from 'react';
|
|
3
|
-
import {
|
|
4
|
+
import { get, runAll, isFunction } from '@elliemae/ds-utilities/utils';
|
|
5
|
+
import useHotkeys from '@elliemae/ds-utilities/hooks/useHotkeys';
|
|
6
|
+
import { mergeRefs } from '@elliemae/ds-utilities/system';
|
|
4
7
|
import getNextCellPosition from './utils/getNextCellPosition.js';
|
|
5
8
|
|
|
6
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
10
|
|
|
8
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function registerHotKeysHooks(hotKeys,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const FocusGridContext = /*#__PURE__*/createContext();
|
|
13
|
+
const {
|
|
14
|
+
Provider
|
|
15
|
+
} = FocusGridContext;
|
|
16
|
+
|
|
17
|
+
const preventDefault = e => e.preventDefault();
|
|
18
|
+
|
|
19
|
+
function registerHotKeysHooks(hotKeys, {
|
|
20
|
+
focusedRow,
|
|
21
|
+
focusedCell
|
|
22
|
+
}) {
|
|
23
|
+
Object.keys(hotKeys).forEach(key => {
|
|
24
|
+
const {
|
|
25
|
+
handler,
|
|
26
|
+
options
|
|
27
|
+
} = hotKeys[key];
|
|
23
28
|
useHotkeys({
|
|
24
29
|
keys: key,
|
|
25
|
-
handler:
|
|
30
|
+
handler: e => {
|
|
26
31
|
e.preventDefault();
|
|
27
|
-
|
|
28
|
-
_handler({
|
|
32
|
+
handler({
|
|
29
33
|
rowIndex: focusedRow.current,
|
|
30
34
|
cellIndex: focusedCell.current
|
|
31
35
|
});
|
|
32
36
|
},
|
|
33
|
-
options
|
|
37
|
+
options
|
|
34
38
|
});
|
|
35
39
|
});
|
|
36
40
|
} // eslint-disable-next-line max-statements
|
|
37
41
|
|
|
38
42
|
|
|
39
|
-
function FocusGridProvider(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var child = React.Children.only(children);
|
|
54
|
-
var decoratedChild = /*#__PURE__*/React.cloneElement(child, {
|
|
43
|
+
function FocusGridProvider({
|
|
44
|
+
shouldWrapRows = false,
|
|
45
|
+
shouldWrapCells = false,
|
|
46
|
+
shouldRefocus = true,
|
|
47
|
+
children,
|
|
48
|
+
keyBindings,
|
|
49
|
+
hotKeys
|
|
50
|
+
}) {
|
|
51
|
+
const focusedRow = useRef();
|
|
52
|
+
const focusedCell = useRef();
|
|
53
|
+
const grid = useRef([]);
|
|
54
|
+
const containerRef = useRef(document);
|
|
55
|
+
const child = React.Children.only(children);
|
|
56
|
+
const decoratedChild = /*#__PURE__*/React.cloneElement(child, {
|
|
55
57
|
innerRef: mergeRefs(child.props.innerRef, containerRef)
|
|
56
58
|
});
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
60
|
+
const getNode = ({
|
|
61
|
+
rowIndex,
|
|
62
|
+
cellIndex
|
|
63
|
+
}) => get(grid.current, [rowIndex, cellIndex]);
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
const register = (node, rowIndex, columnIndex) => {
|
|
65
66
|
if (!node) return;
|
|
66
67
|
|
|
67
68
|
if (!Array.isArray(grid.current[rowIndex])) {
|
|
@@ -74,8 +75,8 @@ function FocusGridProvider(_ref2) {
|
|
|
74
75
|
node.setAttribute('tabindex', -1);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
node.onfocus =
|
|
78
|
-
|
|
78
|
+
node.onfocus = () => {
|
|
79
|
+
const prevNode = getNode({
|
|
79
80
|
rowIndex: focusedRow.current,
|
|
80
81
|
cellIndex: focusedCell.current
|
|
81
82
|
});
|
|
@@ -88,31 +89,31 @@ function FocusGridProvider(_ref2) {
|
|
|
88
89
|
grid.current[rowIndex][columnIndex] = node;
|
|
89
90
|
};
|
|
90
91
|
|
|
91
|
-
useEffect(
|
|
92
|
+
useEffect(() => {
|
|
92
93
|
if (shouldRefocus) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const rowIndex = focusedRow.current;
|
|
95
|
+
const cellIndex = focusedCell.current;
|
|
96
|
+
const node = get(grid.current, [rowIndex, cellIndex]);
|
|
96
97
|
if (node) node.focus();
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
const focusNextCell = (directionY, directionX, position) => {
|
|
102
|
+
const {
|
|
103
|
+
rowIndex,
|
|
104
|
+
cellIndex
|
|
105
|
+
} = position || getNextCellPosition({
|
|
102
106
|
grid: grid.current,
|
|
103
107
|
currentCell: focusedCell.current,
|
|
104
108
|
currentRow: focusedRow.current,
|
|
105
|
-
directionX
|
|
106
|
-
directionY
|
|
107
|
-
shouldWrapCells
|
|
108
|
-
shouldWrapRows
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var node = getNode({
|
|
114
|
-
rowIndex: rowIndex,
|
|
115
|
-
cellIndex: cellIndex
|
|
109
|
+
directionX,
|
|
110
|
+
directionY,
|
|
111
|
+
shouldWrapCells,
|
|
112
|
+
shouldWrapRows
|
|
113
|
+
});
|
|
114
|
+
const node = getNode({
|
|
115
|
+
rowIndex,
|
|
116
|
+
cellIndex
|
|
116
117
|
}); // can focus
|
|
117
118
|
|
|
118
119
|
if (node) {
|
|
@@ -123,84 +124,73 @@ function FocusGridProvider(_ref2) {
|
|
|
123
124
|
};
|
|
124
125
|
|
|
125
126
|
registerHotKeysHooks(hotKeys, {
|
|
126
|
-
focusedCell
|
|
127
|
-
focusedRow
|
|
127
|
+
focusedCell,
|
|
128
|
+
focusedRow
|
|
128
129
|
});
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
ArrowUp: runAll(preventDefault,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ArrowDown: runAll(preventDefault, function () {
|
|
138
|
-
return focusNextCell(1, 0);
|
|
139
|
-
}),
|
|
140
|
-
ArrowLeft: runAll(preventDefault, function () {
|
|
141
|
-
return focusNextCell(0, -1);
|
|
142
|
-
}),
|
|
143
|
-
Home: runAll(preventDefault, function (e) {
|
|
144
|
-
var rowIndex = focusedRow.current;
|
|
131
|
+
const defaultKeyBindings = _objectSpread({
|
|
132
|
+
ArrowUp: runAll(preventDefault, () => focusNextCell(-1, 0)),
|
|
133
|
+
ArrowRight: runAll(preventDefault, () => focusNextCell(0, 1)),
|
|
134
|
+
ArrowDown: runAll(preventDefault, () => focusNextCell(1, 0)),
|
|
135
|
+
ArrowLeft: runAll(preventDefault, () => focusNextCell(0, -1)),
|
|
136
|
+
Home: runAll(preventDefault, e => {
|
|
137
|
+
let rowIndex = focusedRow.current;
|
|
145
138
|
|
|
146
139
|
if (e.ctrlKey) {
|
|
147
140
|
rowIndex = 0;
|
|
148
141
|
}
|
|
149
142
|
|
|
150
143
|
focusNextCell(0, 0, {
|
|
151
|
-
rowIndex
|
|
144
|
+
rowIndex,
|
|
152
145
|
cellIndex: 0
|
|
153
146
|
});
|
|
154
147
|
}),
|
|
155
|
-
End: runAll(preventDefault,
|
|
156
|
-
|
|
148
|
+
End: runAll(preventDefault, e => {
|
|
149
|
+
let rowIndex = focusedRow.current;
|
|
157
150
|
|
|
158
151
|
if (e.ctrlKey) {
|
|
159
152
|
rowIndex = grid.current.length - 1;
|
|
160
153
|
}
|
|
161
154
|
|
|
162
155
|
focusNextCell(0, 0, {
|
|
163
|
-
rowIndex
|
|
156
|
+
rowIndex,
|
|
164
157
|
cellIndex: grid.current[0].length - 1
|
|
165
158
|
});
|
|
166
159
|
})
|
|
167
160
|
}, keyBindings);
|
|
168
161
|
|
|
169
|
-
|
|
162
|
+
const nextKeyBindings = isFunction(keyBindings) ? keyBindings({
|
|
170
163
|
defaultBindings: defaultKeyBindings,
|
|
171
164
|
rowIndex: focusedRow.current,
|
|
172
165
|
cellIndex: focusedCell.current
|
|
173
166
|
}) : _objectSpread(_objectSpread({}, defaultKeyBindings), keyBindings);
|
|
174
167
|
|
|
175
|
-
|
|
168
|
+
const onKeyDown = e => {
|
|
176
169
|
if (e.target.tagName.toLowerCase() === 'input') return;
|
|
177
|
-
|
|
170
|
+
const action = nextKeyBindings[e.key];
|
|
178
171
|
if (isFunction(action)) action(e);
|
|
179
172
|
};
|
|
180
173
|
|
|
181
|
-
|
|
174
|
+
const activate = container => {
|
|
182
175
|
container.addEventListener('keydown', onKeyDown, true);
|
|
183
176
|
};
|
|
184
177
|
|
|
185
|
-
|
|
178
|
+
const deactivate = container => {
|
|
186
179
|
container.removeEventListener('keydown', onKeyDown, true);
|
|
187
180
|
};
|
|
188
181
|
|
|
189
|
-
useEffect(
|
|
182
|
+
useEffect(() => {
|
|
190
183
|
activate(containerRef.current);
|
|
191
|
-
return
|
|
184
|
+
return () => {
|
|
192
185
|
deactivate(containerRef.current);
|
|
193
186
|
};
|
|
194
187
|
}, []);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}, []);
|
|
200
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
188
|
+
const valueProvider = useMemo(() => ({
|
|
189
|
+
register
|
|
190
|
+
}), []);
|
|
191
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
201
192
|
value: valueProvider
|
|
202
|
-
}, decoratedChild);
|
|
193
|
+
}, void 0, decoratedChild);
|
|
203
194
|
}
|
|
204
195
|
|
|
205
196
|
export { FocusGridContext, FocusGridProvider as default };
|
|
206
|
-
//# sourceMappingURL=FocusGrid.js.map
|