@elliemae/ds-shared 1.60.0 → 2.0.0-alpha.12
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 +19 -27
- package/cjs/Animations/Grow.js +17 -22
- package/cjs/Animations/GrowRight.js +17 -23
- package/cjs/Animations/GrowVertical.js +3 -2
- package/cjs/CheckableGroup.js +40 -46
- package/cjs/DeferRenderAfterComputation.js +12 -21
- package/cjs/FocusGroup/FocusGrid.js +91 -92
- package/cjs/FocusGroup/FocusGroup.js +225 -262
- package/cjs/FocusGroup/FocusGroupContext.js +1 -2
- package/cjs/FocusGroup/FocusGroupManager.js +88 -126
- package/cjs/FocusGroup/focusGroupManagerHoc.js +28 -27
- package/cjs/FocusGroup/index.js +14 -28
- package/cjs/FocusGroup/useFocusGroupItem.js +27 -24
- package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -15
- package/cjs/GroupContext/Group.js +81 -103
- package/cjs/GroupContext/GroupContext.js +1 -2
- package/cjs/GroupContext/GroupItem.js +12 -10
- package/cjs/GroupContext/index.js +6 -15
- package/cjs/ScrollSync/ScrollSync.js +90 -112
- package/cjs/ScrollSync/ScrollSyncPane.js +58 -90
- package/cjs/ScrollSync/ScrollSyncProvider.js +36 -26
- package/cjs/ScrollSync/index.js +4 -13
- package/cjs/ScrollSync/useScrollSync.js +0 -1
- package/cjs/constants.js +43 -4
- package/cjs/createDataInstance/createInstancePlugin.js +11 -10
- package/cjs/createDataInstance/createInstanceRef.js +41 -42
- package/cjs/createDataInstance/utils.js +56 -58
- package/cjs/defer-render-hoc/index.js +26 -61
- package/cjs/dimsum.config.js +7 -0
- package/cjs/index.js +10 -20
- 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 +65 -77
- package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
- package/cjs/useDataGrid/index.js +2 -17
- package/cjs/useDataGrid/initColumnDefinition.js +46 -47
- package/cjs/useDataGrid/useDataGrid.js +104 -144
- package/cjs/useDataList/index.js +2 -15
- package/cjs/useDataList/recordIterator.js +9 -10
- package/cjs/useDataList/useDataList.js +51 -59
- package/cjs/utils.js +46 -59
- package/cjs/virtualization/AutoHeightList.js +31 -22
- package/cjs/virtualization/FluidHeightList.js +26 -12
- package/cjs/virtualization/index.js +12 -17
- package/esm/Animations/BaseAnimation.js +18 -26
- package/esm/Animations/Grow.js +15 -20
- package/esm/Animations/GrowRight.js +15 -21
- package/esm/Animations/GrowVertical.js +3 -2
- package/esm/CheckableGroup.js +38 -42
- package/esm/DeferRenderAfterComputation.js +12 -20
- package/esm/FocusGroup/FocusGrid.js +87 -89
- package/esm/FocusGroup/FocusGroup.js +222 -257
- package/esm/FocusGroup/FocusGroupContext.js +0 -1
- package/esm/FocusGroup/FocusGroupManager.js +82 -114
- package/esm/FocusGroup/focusGroupManagerHoc.js +24 -22
- package/esm/FocusGroup/index.js +0 -14
- package/esm/FocusGroup/useFocusGroupItem.js +25 -22
- package/esm/FocusGroup/utils/getNextCellPosition.js +14 -15
- package/esm/GroupContext/Group.js +80 -95
- package/esm/GroupContext/GroupContext.js +1 -2
- package/esm/GroupContext/GroupItem.js +10 -8
- package/esm/GroupContext/index.js +0 -9
- package/esm/ScrollSync/ScrollSync.js +88 -105
- package/esm/ScrollSync/ScrollSyncPane.js +56 -83
- package/esm/ScrollSync/ScrollSyncProvider.js +35 -26
- package/esm/ScrollSync/index.js +0 -9
- package/esm/ScrollSync/useScrollSync.js +0 -1
- package/esm/constants.js +31 -5
- package/esm/createDataInstance/createInstancePlugin.js +10 -8
- package/esm/createDataInstance/createInstanceRef.js +36 -36
- package/esm/createDataInstance/utils.js +55 -57
- package/esm/defer-render-hoc/index.js +25 -55
- package/esm/dimsum.config.js +5 -0
- package/esm/index.js +0 -10
- 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 +60 -71
- package/esm/useDataGrid/VolatileRowsListener.js +14 -23
- package/esm/useDataGrid/index.js +0 -15
- package/esm/useDataGrid/initColumnDefinition.js +43 -43
- package/esm/useDataGrid/useDataGrid.js +90 -127
- package/esm/useDataList/index.js +0 -13
- package/esm/useDataList/recordIterator.js +9 -10
- package/esm/useDataList/useDataList.js +39 -46
- package/esm/utils.js +44 -57
- package/esm/virtualization/AutoHeightList.js +28 -18
- package/esm/virtualization/FluidHeightList.js +24 -10
- package/esm/virtualization/index.js +6 -11
- package/package.json +201 -8
- 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 +5 -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
|
@@ -1,17 +1,24 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
1
3
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
3
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
4
11
|
import { v4 } from 'uuid';
|
|
5
12
|
import { useRef, useState, useMemo } from 'react';
|
|
6
13
|
import { orderBy } from 'lodash';
|
|
7
14
|
import { mergeInstance, registerStateHookToInstance, registerHotKeysHookToInstance } from './utils.js';
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
const _excluded = ["uuid", "data", "renderers", "plugins", "customDecorators"];
|
|
10
17
|
|
|
11
18
|
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; }
|
|
12
19
|
|
|
13
20
|
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; }
|
|
14
|
-
|
|
21
|
+
const defaultDecorators = {
|
|
15
22
|
instance: [],
|
|
16
23
|
state: [],
|
|
17
24
|
hotKeys: [],
|
|
@@ -19,24 +26,21 @@ var defaultDecorators = {
|
|
|
19
26
|
composeData: []
|
|
20
27
|
};
|
|
21
28
|
function createDataInstanceRef(_ref) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
let {
|
|
30
|
+
uuid: uuidProp,
|
|
31
|
+
data,
|
|
32
|
+
renderers,
|
|
33
|
+
plugins,
|
|
34
|
+
customDecorators
|
|
35
|
+
} = _ref,
|
|
27
36
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
37
|
|
|
29
38
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _useState = useState(uuidProp || function () {
|
|
33
|
-
return v4();
|
|
34
|
-
}),
|
|
35
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
36
|
-
uuid = _useState2[0];
|
|
39
|
+
const instance = useRef(); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
40
|
|
|
41
|
+
const [uuid] = useState(uuidProp || (() => v4()));
|
|
38
42
|
instance.current = {
|
|
39
|
-
uuid
|
|
43
|
+
uuid,
|
|
40
44
|
state: {},
|
|
41
45
|
actions: {},
|
|
42
46
|
hotKeys: {},
|
|
@@ -44,30 +48,29 @@ function createDataInstanceRef(_ref) {
|
|
|
44
48
|
originalData: data,
|
|
45
49
|
records: [],
|
|
46
50
|
// item abstraction with meta data for originalData
|
|
47
|
-
renderers
|
|
48
|
-
|
|
51
|
+
renderers,
|
|
52
|
+
|
|
53
|
+
ref(key) {
|
|
49
54
|
// eslint-disable-next-line no-return-assign
|
|
50
|
-
return
|
|
51
|
-
return instance.current.refs[key] = node;
|
|
52
|
-
};
|
|
55
|
+
return node => instance.current.refs[key] = node;
|
|
53
56
|
},
|
|
54
|
-
|
|
57
|
+
|
|
58
|
+
getInstance() {
|
|
55
59
|
return instance.current;
|
|
56
60
|
},
|
|
57
|
-
|
|
61
|
+
|
|
62
|
+
props
|
|
58
63
|
}; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
const decorators = useMemo(() => {
|
|
66
|
+
let nextDecorators = _objectSpread(_objectSpread({}, defaultDecorators), customDecorators);
|
|
62
67
|
|
|
63
|
-
plugins.forEach(
|
|
68
|
+
plugins.forEach(plugin => {
|
|
64
69
|
if (!plugin) return;
|
|
65
70
|
nextDecorators = plugin(nextDecorators);
|
|
66
71
|
});
|
|
67
|
-
Object.keys(nextDecorators).forEach(
|
|
68
|
-
if (Array.isArray(nextDecorators[key])) nextDecorators[key] = orderBy(nextDecorators[key],
|
|
69
|
-
return item.order;
|
|
70
|
-
});
|
|
72
|
+
Object.keys(nextDecorators).forEach(key => {
|
|
73
|
+
if (Array.isArray(nextDecorators[key])) nextDecorators[key] = orderBy(nextDecorators[key], item => item.order);
|
|
71
74
|
});
|
|
72
75
|
return nextDecorators;
|
|
73
76
|
}, []); // the plugins are defined on creation, but not changed at runtime
|
|
@@ -77,14 +80,11 @@ function createDataInstanceRef(_ref) {
|
|
|
77
80
|
instance.current = decorators.instance.reduce(mergeInstance, instance.current);
|
|
78
81
|
instance.current = decorators.state.reduce(registerStateHookToInstance, instance.current);
|
|
79
82
|
instance.current = decorators.hotKeys.reduce(registerHotKeysHookToInstance, instance.current);
|
|
80
|
-
instance.current.renderers = decorators.renderers.reduce(
|
|
81
|
-
return decorator(result, instance.current);
|
|
82
|
-
}, renderers);
|
|
83
|
+
instance.current.renderers = decorators.renderers.reduce((result, decorator) => decorator(result, instance.current), renderers);
|
|
83
84
|
return {
|
|
84
|
-
instance
|
|
85
|
-
decorators
|
|
85
|
+
instance,
|
|
86
|
+
decorators
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
export { createDataInstanceRef as default };
|
|
90
|
-
//# sourceMappingURL=createInstanceRef.js.map
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
2
12
|
|
|
3
13
|
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; }
|
|
4
14
|
|
|
5
15
|
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; }
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var grid = arguments.length > 1 ? arguments[1] : undefined;
|
|
16
|
+
const reducePropsGetter = function () {
|
|
17
|
+
let decorators = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
18
|
+
let grid = arguments.length > 1 ? arguments[1] : undefined;
|
|
10
19
|
return function () {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
decorators.forEach(
|
|
20
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
+
let extraParams = arguments.length > 1 ? arguments[1] : undefined;
|
|
22
|
+
let nextProps = props;
|
|
23
|
+
decorators.forEach(decorator => {
|
|
15
24
|
nextProps = decorator(nextProps, grid, extraParams);
|
|
16
25
|
});
|
|
17
26
|
return nextProps;
|
|
@@ -20,11 +29,11 @@ var reducePropsGetter = function reducePropsGetter() {
|
|
|
20
29
|
/* eslint-disable-next-line max-params */
|
|
21
30
|
|
|
22
31
|
function evaluateTransforms(transforms, value) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
transforms.forEach(
|
|
32
|
+
let extraParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
33
|
+
let props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
34
|
+
let grid = arguments.length > 4 ? arguments[4] : undefined;
|
|
35
|
+
let nextProps = props;
|
|
36
|
+
transforms.forEach(transform => {
|
|
28
37
|
nextProps = transform(value, extraParams, nextProps, grid);
|
|
29
38
|
});
|
|
30
39
|
return nextProps;
|
|
@@ -32,71 +41,61 @@ function evaluateTransforms(transforms, value) {
|
|
|
32
41
|
/* eslint-disable-next-line max-params */
|
|
33
42
|
|
|
34
43
|
function evaluateFormatters(formatters, value) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return formatters.reduce(
|
|
38
|
-
return formatter(result, extraParams, grid);
|
|
39
|
-
}, value);
|
|
44
|
+
let extraParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
45
|
+
let grid = arguments.length > 3 ? arguments[3] : undefined;
|
|
46
|
+
return formatters.reduce((result, formatter) => formatter(result, extraParams, grid), value);
|
|
40
47
|
}
|
|
41
48
|
function composeFormatters(formatters, instance) {
|
|
42
|
-
|
|
43
|
-
return record.data.name;
|
|
44
|
-
};
|
|
49
|
+
let getItemValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : record => record.data.name;
|
|
45
50
|
// todo: make the formatters subscribe to the item props instead of getting the whole instance
|
|
46
51
|
// todo: addd should formatter update to memoize specific ones
|
|
47
|
-
return
|
|
48
|
-
return formatters.reduce(function (result, formatter) {
|
|
49
|
-
return formatter(result, props, instance);
|
|
50
|
-
}, getItemValue(props.record));
|
|
51
|
-
};
|
|
52
|
+
return props => formatters.reduce((result, formatter) => formatter(result, props, instance), getItemValue(props.record));
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const applyDecorators = function (subject) {
|
|
55
|
+
let decorators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
55
56
|
|
|
56
57
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
57
58
|
args[_key - 2] = arguments[_key];
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
return decorators.reduce(
|
|
61
|
-
return decorator.apply(void 0, [nextSubject].concat(args));
|
|
62
|
-
}, subject);
|
|
61
|
+
return decorators.reduce((nextSubject, decorator) => decorator(nextSubject, ...args), subject);
|
|
63
62
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return nextColumns.map(
|
|
67
|
-
return applyDecorators(column, decorators.decorateColumn, grid, index);
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
var mergeInstance = function mergeInstance(instance, instanceHook) {
|
|
71
|
-
return _objectSpread(_objectSpread({}, instance), instanceHook(instance));
|
|
63
|
+
const decorateColumns = (columns, decorators, grid) => {
|
|
64
|
+
const nextColumns = applyDecorators(columns, decorators.decorateColumns, grid);
|
|
65
|
+
return nextColumns.map((column, index) => applyDecorators(column, decorators.decorateColumn, grid, index));
|
|
72
66
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
const mergeInstance = (instance, instanceHook) => _objectSpread(_objectSpread({}, instance), instanceHook(instance));
|
|
68
|
+
const registerStateHookToInstance = (instance, stateHook) => {
|
|
69
|
+
const {
|
|
70
|
+
state,
|
|
71
|
+
actions
|
|
72
|
+
} = stateHook(instance);
|
|
78
73
|
return _objectSpread(_objectSpread({}, instance), {}, {
|
|
79
74
|
state: _objectSpread(_objectSpread({}, instance.state), state),
|
|
80
75
|
actions: _objectSpread(_objectSpread({}, instance.actions), actions)
|
|
81
76
|
});
|
|
82
77
|
};
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
const reduceHotKey = (instance, _ref) => {
|
|
80
|
+
let {
|
|
81
|
+
key,
|
|
82
|
+
handler,
|
|
83
|
+
options,
|
|
84
|
+
allowDocumentHandler
|
|
85
|
+
} = _ref;
|
|
89
86
|
return _objectSpread(_objectSpread({}, instance), {}, {
|
|
90
|
-
hotKeys: _objectSpread(_objectSpread({}, instance.hotKeys), {},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
hotKeys: _objectSpread(_objectSpread({}, instance.hotKeys), {}, {
|
|
88
|
+
[key]: {
|
|
89
|
+
handler,
|
|
90
|
+
options,
|
|
91
|
+
allowDocumentHandler
|
|
92
|
+
}
|
|
93
|
+
})
|
|
95
94
|
});
|
|
96
95
|
};
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const registerHotKeysHookToInstance = (instance, hotKeysHook) => {
|
|
98
|
+
const hotKeys = hotKeysHook(instance);
|
|
100
99
|
|
|
101
100
|
if (Array.isArray(hotKeys)) {
|
|
102
101
|
return hotKeys.reduce(reduceHotKey, instance);
|
|
@@ -106,4 +105,3 @@ var registerHotKeysHookToInstance = function registerHotKeysHookToInstance(insta
|
|
|
106
105
|
};
|
|
107
106
|
|
|
108
107
|
export { applyDecorators, composeFormatters, decorateColumns, evaluateFormatters, evaluateTransforms, mergeInstance, reducePropsGetter, registerHotKeysHookToInstance, registerStateHookToInstance };
|
|
109
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1,71 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import { PureComponent } from 'react';
|
|
7
9
|
import raf from 'raf';
|
|
8
10
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
12
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
/**
|
|
14
|
-
* Allows two animation frames to complete to allow other components to update
|
|
15
|
-
* and re-render before mounting and rendering an expensive `WrappedComponent`.
|
|
16
|
-
*
|
|
17
|
-
* @param WrappedComponent
|
|
18
|
-
* @param fallback
|
|
19
|
-
*/
|
|
13
|
+
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; }
|
|
20
14
|
|
|
15
|
+
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; }
|
|
21
16
|
function deferComponentRender(WrappedComponent, fallback) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function DeferredRenderWrapper() {
|
|
28
|
-
var _this;
|
|
29
|
-
|
|
30
|
-
_classCallCheck(this, DeferredRenderWrapper);
|
|
31
|
-
|
|
32
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
|
-
args[_key] = arguments[_key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
37
|
-
_this.state = {
|
|
17
|
+
class DeferredRenderWrapper extends PureComponent {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.state = {
|
|
38
21
|
shouldRender: false
|
|
39
22
|
};
|
|
40
|
-
return _this;
|
|
41
23
|
}
|
|
42
24
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
raf(() => raf(() => this.setState({
|
|
27
|
+
shouldRender: true
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "render",
|
|
58
|
-
value: function render() {
|
|
59
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
60
|
-
return this.state.shouldRender ? /*#__PURE__*/React.createElement(WrappedComponent, this.props) : fallback;
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
31
|
+
render() {
|
|
32
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
33
|
+
return this.state.shouldRender ? /*#__PURE__*/jsx(WrappedComponent, _objectSpread({}, this.props)) : fallback;
|
|
34
|
+
}
|
|
63
35
|
|
|
64
|
-
|
|
65
|
-
}(PureComponent);
|
|
36
|
+
}
|
|
66
37
|
|
|
67
38
|
return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);
|
|
68
39
|
}
|
|
69
40
|
|
|
70
41
|
export { deferComponentRender as default };
|
|
71
|
-
//# sourceMappingURL=index.js.map
|
package/esm/index.js
CHANGED
|
@@ -3,13 +3,3 @@ export { default as ScrollSyncPane } from './ScrollSync/ScrollSyncPane.js';
|
|
|
3
3
|
export { default as Group } from './GroupContext/Group.js';
|
|
4
4
|
export { GroupContext } from './GroupContext/GroupContext.js';
|
|
5
5
|
export { default as GroupItem } from './GroupContext/GroupItem.js';
|
|
6
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
7
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
8
|
-
import '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
9
|
-
import '@babel/runtime/helpers/esm/inherits';
|
|
10
|
-
import '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
11
|
-
import '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
12
|
-
import 'react';
|
|
13
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
14
|
-
import 'prop-types';
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const dsBasicSizes = ['s', 'm', 'l'];
|
|
2
|
+
const sizes = ['xsmall', 'small', 'medium', 'large', 'xlarge'];
|
|
3
|
+
const iconSizes = ['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl'];
|
|
4
|
+
const iconColors = [['neutral', '900'], ['neutral', '0'], ['danger', '900'], ['warning', '500'], ['success', '900'], ['brand-primary', '600']];
|
|
5
|
+
const CHECKBOX_VARIANT = {
|
|
6
|
+
DEFAULT: 'variant-default',
|
|
7
|
+
FOCUS: 'variant-focus',
|
|
8
|
+
ACTIVE: 'variant-active',
|
|
9
|
+
DISABLED: 'variant-disabled',
|
|
10
|
+
ERROR: 'variant-error'
|
|
11
|
+
};
|
|
12
|
+
const checkboxVariants = [CHECKBOX_VARIANT.DEFAULT, CHECKBOX_VARIANT.FOCUS, CHECKBOX_VARIANT.ACTIVE, CHECKBOX_VARIANT.DISABLED, CHECKBOX_VARIANT.ERROR];
|
|
13
|
+
const COMBOBOX_VARIANT = {
|
|
14
|
+
DEFAULT: 'variant-default',
|
|
15
|
+
FOCUS: 'variant-focus-input',
|
|
16
|
+
FOCUS_ICON: 'variant-focus-icon',
|
|
17
|
+
ACTIVE: 'variant-active-input',
|
|
18
|
+
ACTIVE_ICON: 'variant-active-icon',
|
|
19
|
+
DISABLED: 'variant-disabled',
|
|
20
|
+
ERROR: 'variant-error'
|
|
21
|
+
};
|
|
22
|
+
const comboBoxVariants = [COMBOBOX_VARIANT.DEFAULT, COMBOBOX_VARIANT.FOCUS, COMBOBOX_VARIANT.FOCUS_ICON, COMBOBOX_VARIANT.ACTIVE, COMBOBOX_VARIANT.ACTIVE_ICON, COMBOBOX_VARIANT.DISABLED, COMBOBOX_VARIANT.ERROR];
|
|
23
|
+
const sizeVariants = {
|
|
24
|
+
S: 's',
|
|
25
|
+
M: 'm',
|
|
26
|
+
L: 'l'
|
|
27
|
+
};
|
|
28
|
+
const position = {
|
|
29
|
+
LEFT: 'left',
|
|
30
|
+
RIGHT: 'right',
|
|
31
|
+
CENTER: 'center'
|
|
32
|
+
};
|
|
33
|
+
const fontColor = {
|
|
34
|
+
NEUTRAL500: 'neutral500',
|
|
35
|
+
NEUTRAL700: 'neutral700'
|
|
36
|
+
};
|
|
37
|
+
const orientation = ['horizontal', 'vertical'];
|
|
38
|
+
const orientationVariants = {
|
|
39
|
+
HORIZONTAL: 'horizontal',
|
|
40
|
+
VERTICAL: 'vertical'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { CHECKBOX_VARIANT, COMBOBOX_VARIANT, checkboxVariants, comboBoxVariants, dsBasicSizes, fontColor, iconColors, iconSizes, orientation, orientationVariants, position, sizeVariants, sizes };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from 'react-spring/web
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from 'react-spring/web';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from 'react-spring/renderprops
|
|
2
|
-
//# sourceMappingURL=renderprops.js.map
|
|
1
|
+
export * from 'react-spring/renderprops';
|
|
@@ -1,115 +1,105 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
9
|
import React, { useRef, useState, useEffect, useMemo } from 'react';
|
|
5
10
|
import DSPopover from '@elliemae/ds-popper';
|
|
6
11
|
import { useOnClickOutside } from '@elliemae/ds-utilities';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
13
|
|
|
8
14
|
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; }
|
|
9
15
|
|
|
10
16
|
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; }
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
const ToolbarContext = /*#__PURE__*/React.createContext();
|
|
18
|
+
const {
|
|
19
|
+
Provider
|
|
20
|
+
} = ToolbarContext;
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
useEffect(
|
|
22
|
+
const useScrollListener = (callback, dependencies) => {
|
|
23
|
+
useEffect(() => {
|
|
16
24
|
window.addEventListener('scroll', callback, true);
|
|
17
|
-
return
|
|
25
|
+
return () => {
|
|
18
26
|
window.removeEventListener('scroll', callback, true);
|
|
19
27
|
};
|
|
20
28
|
}, [dependencies]);
|
|
21
29
|
};
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
return null;
|
|
25
|
-
};
|
|
31
|
+
const noop = () => null;
|
|
26
32
|
|
|
27
33
|
function ToolbarProvider(_ref) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var _useState = useState({}),
|
|
40
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
-
tooltipState = _useState2[0],
|
|
42
|
-
setTooltipState = _useState2[1];
|
|
34
|
+
let {
|
|
35
|
+
delay = 200,
|
|
36
|
+
children,
|
|
37
|
+
onHide = noop,
|
|
38
|
+
onShow = noop
|
|
39
|
+
} = _ref;
|
|
40
|
+
const showTimer = useRef();
|
|
41
|
+
const hideTimer = useRef();
|
|
42
|
+
const toolbarRef = useRef();
|
|
43
|
+
const [tooltipState, setTooltipState] = useState({});
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
const show = state => {
|
|
45
46
|
if (state.reference === tooltipState.reference) clearTimeout(hideTimer.current);
|
|
46
|
-
showTimer.current = setTimeout(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}));
|
|
50
|
-
}, delay);
|
|
47
|
+
showTimer.current = setTimeout(() => setTooltipState(_objectSpread(_objectSpread({}, state), {}, {
|
|
48
|
+
visible: true
|
|
49
|
+
})), delay);
|
|
51
50
|
onShow();
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
const hide = (e, force) => {
|
|
55
54
|
if (!force) clearTimeout(showTimer.current);
|
|
56
|
-
hideTimer.current = setTimeout(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
visible: false
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}, 100);
|
|
55
|
+
hideTimer.current = setTimeout(() => setTooltipState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
|
|
56
|
+
visible: false
|
|
57
|
+
})), 100);
|
|
63
58
|
onHide(tooltipState, e);
|
|
64
59
|
};
|
|
65
60
|
|
|
66
|
-
useScrollListener(
|
|
67
|
-
|
|
68
|
-
}, tooltipState.visible);
|
|
69
|
-
useOnClickOutside(toolbarRef, function () {
|
|
70
|
-
return hide();
|
|
71
|
-
});
|
|
61
|
+
useScrollListener(e => hide(e, true), tooltipState.visible);
|
|
62
|
+
useOnClickOutside(toolbarRef, () => hide());
|
|
72
63
|
|
|
73
|
-
|
|
64
|
+
const keyDownHandler = e => {
|
|
74
65
|
if (e.key === 'Escape') {
|
|
75
66
|
hide(e);
|
|
76
67
|
}
|
|
77
68
|
};
|
|
78
69
|
|
|
79
|
-
useEffect(
|
|
70
|
+
useEffect(() => {
|
|
80
71
|
window.addEventListener('keydown', keyDownHandler);
|
|
81
|
-
return
|
|
72
|
+
return () => {
|
|
82
73
|
window.removeEventListener('keydown', keyDownHandler);
|
|
83
74
|
};
|
|
84
75
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}, [tooltipState.reference]);
|
|
92
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
76
|
+
const value = useMemo(() => ({
|
|
77
|
+
state: tooltipState,
|
|
78
|
+
show,
|
|
79
|
+
hide
|
|
80
|
+
}), [tooltipState.reference]);
|
|
81
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
93
82
|
value: value
|
|
94
|
-
}, children, /*#__PURE__*/
|
|
83
|
+
}, void 0, children, /*#__PURE__*/jsx(DSPopover, _objectSpread(_objectSpread({
|
|
95
84
|
boundaries: "scrollParent"
|
|
96
|
-
}, tooltipState.options || {}, {
|
|
85
|
+
}, tooltipState.options || {}), {}, {
|
|
97
86
|
content: tooltipState.renderer,
|
|
98
87
|
placement: "left",
|
|
99
88
|
referenceEl: tooltipState.reference,
|
|
100
|
-
renderer:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
89
|
+
renderer: _ref2 => {
|
|
90
|
+
let {
|
|
91
|
+
as: Component,
|
|
92
|
+
style,
|
|
93
|
+
children: Content
|
|
94
|
+
} = _ref2;
|
|
95
|
+
return /*#__PURE__*/jsx("div", {
|
|
105
96
|
ref: toolbarRef,
|
|
106
|
-
onMouseEnter:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}, Content));
|
|
97
|
+
onMouseEnter: e => show(tooltipState),
|
|
98
|
+
onMouseLeave: hide,
|
|
99
|
+
children: /*#__PURE__*/_jsx(Component, {
|
|
100
|
+
style: style
|
|
101
|
+
}, void 0, Content)
|
|
102
|
+
});
|
|
113
103
|
},
|
|
114
104
|
style: tooltipState.style,
|
|
115
105
|
visible: tooltipState.visible
|
|
@@ -119,4 +109,3 @@ function ToolbarProvider(_ref) {
|
|
|
119
109
|
var ToolbarProvider$1 = /*#__PURE__*/React.memo(ToolbarProvider);
|
|
120
110
|
|
|
121
111
|
export { ToolbarContext, ToolbarProvider$1 as default };
|
|
122
|
-
//# sourceMappingURL=ToolbarProvider.js.map
|