@elliemae/ds-shared 3.3.0-next.2 → 3.3.0-next.5
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/dist/cjs/CheckableGroup.js +3 -19
- package/dist/cjs/CheckableGroup.js.map +1 -1
- package/dist/cjs/FocusGroup/FocusGrid.js +5 -18
- package/dist/cjs/FocusGroup/FocusGrid.js.map +1 -1
- package/dist/cjs/FocusGroup/FocusGroup.js +6 -19
- package/dist/cjs/FocusGroup/FocusGroup.js.map +1 -1
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js +14 -42
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js.map +1 -1
- package/dist/cjs/FocusGroup/useFocusGroupItem.js +2 -16
- package/dist/cjs/FocusGroup/useFocusGroupItem.js.map +1 -1
- package/dist/cjs/ScrollSync/ScrollSyncPane.js +3 -19
- package/dist/cjs/ScrollSync/ScrollSyncPane.js.map +1 -1
- package/dist/cjs/createDataInstance/createInstancePlugin.js +1 -15
- package/dist/cjs/createDataInstance/createInstancePlugin.js.map +1 -1
- package/dist/cjs/createDataInstance/createInstanceRef.js +9 -41
- package/dist/cjs/createDataInstance/createInstanceRef.js.map +1 -1
- package/dist/cjs/createDataInstance/utils.js +20 -25
- package/dist/cjs/createDataInstance/utils.js.map +1 -1
- package/dist/cjs/defer-render-hoc/index.js +3 -15
- package/dist/cjs/defer-render-hoc/index.js.map +1 -1
- package/dist/cjs/toolbar/ToolbarProvider.js +9 -24
- package/dist/cjs/toolbar/ToolbarProvider.js.map +1 -1
- package/dist/cjs/useDataGrid/initColumnDefinition.js +27 -33
- package/dist/cjs/useDataGrid/initColumnDefinition.js.map +1 -1
- package/dist/cjs/useDataGrid/useDataGrid.js +31 -53
- package/dist/cjs/useDataGrid/useDataGrid.js.map +1 -1
- package/dist/cjs/useDataList/useDataList.js +14 -47
- package/dist/cjs/useDataList/useDataList.js.map +1 -1
- package/dist/cjs/utils.js +2 -18
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/virtualization/AutoHeightList.js +14 -51
- package/dist/cjs/virtualization/AutoHeightList.js.map +1 -1
- package/dist/cjs/virtualization/FluidHeightList.js +7 -38
- package/dist/cjs/virtualization/FluidHeightList.js.map +1 -1
- package/dist/esm/CheckableGroup.js +3 -21
- package/dist/esm/CheckableGroup.js.map +1 -1
- package/dist/esm/FocusGroup/FocusGrid.js +5 -20
- package/dist/esm/FocusGroup/FocusGrid.js.map +1 -1
- package/dist/esm/FocusGroup/FocusGroup.js +6 -21
- package/dist/esm/FocusGroup/FocusGroup.js.map +1 -1
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js +14 -44
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js.map +1 -1
- package/dist/esm/FocusGroup/useFocusGroupItem.js +2 -17
- package/dist/esm/FocusGroup/useFocusGroupItem.js.map +1 -1
- package/dist/esm/ScrollSync/ScrollSyncPane.js +3 -21
- package/dist/esm/ScrollSync/ScrollSyncPane.js.map +1 -1
- package/dist/esm/createDataInstance/createInstancePlugin.js +1 -17
- package/dist/esm/createDataInstance/createInstancePlugin.js.map +1 -1
- package/dist/esm/createDataInstance/createInstanceRef.js +9 -43
- package/dist/esm/createDataInstance/createInstanceRef.js.map +1 -1
- package/dist/esm/createDataInstance/utils.js +20 -27
- package/dist/esm/createDataInstance/utils.js.map +1 -1
- package/dist/esm/defer-render-hoc/index.js +3 -17
- package/dist/esm/defer-render-hoc/index.js.map +1 -1
- package/dist/esm/toolbar/ToolbarProvider.js +9 -26
- package/dist/esm/toolbar/ToolbarProvider.js.map +1 -1
- package/dist/esm/useDataGrid/initColumnDefinition.js +27 -35
- package/dist/esm/useDataGrid/initColumnDefinition.js.map +1 -1
- package/dist/esm/useDataGrid/useDataGrid.js +31 -55
- package/dist/esm/useDataGrid/useDataGrid.js.map +1 -1
- package/dist/esm/useDataList/useDataList.js +14 -49
- package/dist/esm/useDataList/useDataList.js.map +1 -1
- package/dist/esm/utils.js +2 -20
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/virtualization/AutoHeightList.js +14 -53
- package/dist/esm/virtualization/AutoHeightList.js.map +1 -1
- package/dist/esm/virtualization/FluidHeightList.js +7 -40
- package/dist/esm/virtualization/FluidHeightList.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -75,18 +58,30 @@ const decorateColumns = (columns, decorators, grid) => {
|
|
|
75
58
|
const nextColumns = applyDecorators(columns, decorators.decorateColumns, grid);
|
|
76
59
|
return nextColumns.map((column, index) => applyDecorators(column, decorators.decorateColumn, grid, index));
|
|
77
60
|
};
|
|
78
|
-
const mergeInstance = (instance, instanceHook) =>
|
|
61
|
+
const mergeInstance = (instance, instanceHook) => ({
|
|
62
|
+
...instance,
|
|
63
|
+
...instanceHook(instance)
|
|
64
|
+
});
|
|
79
65
|
const registerStateHookToInstance = (instance, stateHook) => {
|
|
80
66
|
const { state, actions } = stateHook(instance);
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
return {
|
|
68
|
+
...instance,
|
|
69
|
+
state: {
|
|
70
|
+
...instance.state,
|
|
71
|
+
...state
|
|
72
|
+
},
|
|
73
|
+
actions: {
|
|
74
|
+
...instance.actions,
|
|
75
|
+
...actions
|
|
76
|
+
}
|
|
77
|
+
};
|
|
85
78
|
};
|
|
86
|
-
const reduceHotKey = (instance, { key, handler, options, allowDocumentHandler }) =>
|
|
87
|
-
|
|
79
|
+
const reduceHotKey = (instance, { key, handler, options, allowDocumentHandler }) => ({
|
|
80
|
+
...instance,
|
|
81
|
+
hotKeys: {
|
|
82
|
+
...instance.hotKeys,
|
|
88
83
|
[key]: { handler, options, allowDocumentHandler }
|
|
89
|
-
}
|
|
84
|
+
}
|
|
90
85
|
});
|
|
91
86
|
const registerHotKeysHookToInstance = (instance, hotKeysHook) => {
|
|
92
87
|
const hotKeys = hotKeysHook(instance);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/createDataInstance/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export const reducePropsGetter = (decorators = [], grid) => (\n props = {},\n extraParams,\n) => {\n let nextProps = props;\n decorators.forEach((decorator) => {\n nextProps = decorator(nextProps, grid, extraParams);\n });\n return nextProps;\n};\n\n/* eslint-disable-next-line max-params */\nexport function evaluateTransforms(\n transforms,\n value,\n extraParams = {},\n props = {},\n grid,\n) {\n let nextProps = props;\n transforms.forEach((transform) => {\n nextProps = transform(value, extraParams, nextProps, grid);\n });\n return nextProps;\n}\n\n/* eslint-disable-next-line max-params */\nexport function evaluateFormatters(formatters, value, extraParams = {}, grid) {\n return formatters.reduce(\n (result, formatter) => formatter(result, extraParams, grid),\n value,\n );\n}\n\nexport function composeFormatters(\n formatters,\n instance,\n getItemValue = (record) => record.data.name,\n) {\n // todo: make the formatters subscribe to the item props instead of getting the whole instance\n // todo: addd should formatter update to memoize specific ones\n return (props) =>\n formatters.reduce(\n (result, formatter) => formatter(result, props, instance),\n getItemValue(props.record),\n );\n}\n\nexport const applyDecorators = (subject, decorators = [], ...args) =>\n decorators.reduce(\n (nextSubject, decorator) => decorator(nextSubject, ...args),\n subject,\n );\n\nexport const decorateColumns = (columns, decorators, grid) => {\n const nextColumns = applyDecorators(\n columns,\n decorators.decorateColumns,\n grid,\n );\n return nextColumns.map((column, index) =>\n applyDecorators(column, decorators.decorateColumn, grid, index),\n );\n};\n\nexport const mergeInstance = (instance, instanceHook) => ({\n ...instance,\n ...instanceHook(instance),\n});\n\nexport const registerStateHookToInstance = (instance, stateHook) => {\n const { state, actions } = stateHook(instance);\n return {\n ...instance,\n state: {\n ...instance.state,\n ...state,\n },\n actions: {\n ...instance.actions,\n ...actions,\n },\n };\n};\n\nconst reduceHotKey = (\n instance,\n { key, handler, options, allowDocumentHandler },\n) => ({\n ...instance,\n hotKeys: {\n ...instance.hotKeys,\n [key]: { handler, options, allowDocumentHandler },\n },\n});\n\nexport const registerHotKeysHookToInstance = (instance, hotKeysHook) => {\n const hotKeys = hotKeysHook(instance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, instance);\n }\n return reduceHotKey(instance, hotKeys);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;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U,cAAc;AAClE,QAAM,EAAE,OAAO,YAAY,UAAU,QAAQ;AAC7C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,SAAS;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,SAAS;AAAA,MACP,GAAG,SAAS;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,EACF;AACF;AAEA,MAAM,eAAe,CACnB,UACA,EAAE,KAAK,SAAS,SAAS,2BACrB;AAAA,EACJ,GAAG;AAAA,EACH,SAAS;AAAA,IACP,GAAG,SAAS;AAAA,IACZ,CAAC,MAAM,EAAE,SAAS,SAAS,qBAAqB;AAAA,EAClD;AACF;AAEO,MAAM,gCAAgC,CAAC,UAAU,gBAAgB;AACtE,QAAM,UAAU,YAAY,QAAQ;AACpC,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAO,QAAQ,OAAO,cAAc,QAAQ;AAAA,EAC9C;AACA,SAAO,aAAa,UAAU,OAAO;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,22 +3,8 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
8
|
var __export = (target, all) => {
|
|
23
9
|
for (var name in all)
|
|
24
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -53,7 +39,9 @@ const deferComponentRender = (WrappedComponent, fallback) => {
|
|
|
53
39
|
(0, import_raf.default)(() => (0, import_raf.default)(() => this.setState({ shouldRender: true })));
|
|
54
40
|
}
|
|
55
41
|
render() {
|
|
56
|
-
return this.state.shouldRender ? /* @__PURE__ */ import_react.default.createElement(WrappedComponent,
|
|
42
|
+
return this.state.shouldRender ? /* @__PURE__ */ import_react.default.createElement(WrappedComponent, {
|
|
43
|
+
...this.props
|
|
44
|
+
}) : fallback;
|
|
57
45
|
}
|
|
58
46
|
}
|
|
59
47
|
return (0, import_hoist_non_react_statics.default)(DeferredRenderWrapper, WrappedComponent);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/defer-render-hoc/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { PureComponent } from 'react';\nimport raf from 'raf';\nimport hoistNonReactStatic from 'hoist-non-react-statics';\n\n/**\n * Allows two animation frames to complete to allow other components to update\n * and re-render before mounting and rendering an expensive `WrappedComponent`.\n *\n * @param WrappedComponent\n * @param fallback\n */\nexport const deferComponentRender = (WrappedComponent, fallback) => {\n class DeferredRenderWrapper extends PureComponent {\n state = { shouldRender: false };\n\n componentDidMount() {\n raf(() => raf(() => this.setState({ shouldRender: true })));\n }\n\n render() {\n // eslint-disable-next-line react/destructuring-assignment\n return this.state.shouldRender ? (\n <WrappedComponent {...this.props} />\n ) : (\n fallback\n );\n }\n }\n\n return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);\n};\n\nexport default deferComponentRender;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AACrC,iBAAgB;AAChB,qCAAgC;AASzB,MAAM,uBAAuB,CAAC,kBAAkB,aAAa;AAClE,QAAM,8BAA8B,2BAAc;AAAA,IAAlD;AAAA;AACE,mBAAQ,EAAE,cAAc,MAAM;AAAA;AAAA,IAE9B,oBAAoB;AAClB,8BAAI,MAAM,wBAAI,MAAM,KAAK,SAAS,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC;AAAA,IAC5D;AAAA,IAEA,SAAS;AAEP,aAAO,KAAK,MAAM,eAChB,mDAAC;AAAA,QAAkB,GAAG,KAAK;AAAA,OAAO,IAElC;AAAA,IAEJ;AAAA,EACF;AAEA,SAAO,4CAAoB,uBAAuB,gBAAgB;AACpE;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -66,15 +49,17 @@ const ToolbarProvider = (0, import_react.memo)(({ delay = 200, children, onHide
|
|
|
66
49
|
const show = (state) => {
|
|
67
50
|
if (state.reference === tooltipState.reference)
|
|
68
51
|
clearTimeout(hideTimer.current);
|
|
69
|
-
showTimer.current = setTimeout(() => setTooltipState(
|
|
52
|
+
showTimer.current = setTimeout(() => setTooltipState({
|
|
53
|
+
...state,
|
|
70
54
|
visible: true
|
|
71
|
-
})
|
|
55
|
+
}), delay);
|
|
72
56
|
onShow();
|
|
73
57
|
};
|
|
74
58
|
const hide = (e, force) => {
|
|
75
59
|
if (!force)
|
|
76
60
|
clearTimeout(showTimer.current);
|
|
77
|
-
hideTimer.current = setTimeout(() => setTooltipState((prevState) =>
|
|
61
|
+
hideTimer.current = setTimeout(() => setTooltipState((prevState) => ({
|
|
62
|
+
...prevState,
|
|
78
63
|
visible: false
|
|
79
64
|
})), 100);
|
|
80
65
|
onHide(tooltipState, e);
|
|
@@ -99,9 +84,9 @@ const ToolbarProvider = (0, import_react.memo)(({ delay = 200, children, onHide
|
|
|
99
84
|
}), [tooltipState.reference]);
|
|
100
85
|
return /* @__PURE__ */ import_react.default.createElement(Provider, {
|
|
101
86
|
value
|
|
102
|
-
}, children, /* @__PURE__ */ import_react.default.createElement(import_ds_popover.DSPopover,
|
|
103
|
-
boundaries: "scrollParent"
|
|
104
|
-
|
|
87
|
+
}, children, /* @__PURE__ */ import_react.default.createElement(import_ds_popover.DSPopover, {
|
|
88
|
+
boundaries: "scrollParent",
|
|
89
|
+
...tooltipState.options || {},
|
|
105
90
|
content: tooltipState.renderer,
|
|
106
91
|
placement: "left",
|
|
107
92
|
referenceEl: tooltipState.reference,
|
|
@@ -114,7 +99,7 @@ const ToolbarProvider = (0, import_react.memo)(({ delay = 200, children, onHide
|
|
|
114
99
|
}, Content)),
|
|
115
100
|
style: tooltipState.style,
|
|
116
101
|
visible: tooltipState.visible
|
|
117
|
-
}))
|
|
102
|
+
}));
|
|
118
103
|
});
|
|
119
104
|
var ToolbarProvider_default = ToolbarProvider;
|
|
120
105
|
//# sourceMappingURL=ToolbarProvider.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/toolbar/ToolbarProvider.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useMemo, useRef, useState, useEffect, memo } from 'react';\nimport { DSPopover } from '@elliemae/ds-popover';\nimport { useOnClickOutside } from '@elliemae/ds-utilities';\n\nexport const ToolbarContext = React.createContext();\n\nconst { Provider } = ToolbarContext;\n\nconst useScrollListener = (callback, dependencies) => {\n useEffect(() => {\n window.addEventListener('scroll', callback, true);\n return () => {\n window.removeEventListener('scroll', callback, true);\n };\n }, [dependencies]);\n};\n\nconst noop = () => null;\nconst ToolbarProvider = memo(({ delay = 200, children, onHide = noop, onShow = noop }) => {\n const showTimer = useRef();\n const hideTimer = useRef();\n const toolbarRef = useRef();\n const [tooltipState, setTooltipState] = useState({});\n\n const show = (state) => {\n if (state.reference === tooltipState.reference) clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(\n () =>\n setTooltipState({\n ...state,\n visible: true,\n }),\n delay,\n );\n onShow();\n };\n\n const hide = (e, force) => {\n if (!force) clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(\n () =>\n setTooltipState((prevState) => ({\n ...prevState,\n visible: false,\n })),\n 100,\n );\n onHide(tooltipState, e);\n };\n\n useScrollListener((e) => hide(e, true), tooltipState.visible);\n useOnClickOutside(toolbarRef, () => hide());\n\n const keyDownHandler = (e) => {\n if (e.key === 'Escape') {\n hide(e);\n }\n };\n\n useEffect(() => {\n window.addEventListener('keydown', keyDownHandler);\n return () => {\n window.removeEventListener('keydown', keyDownHandler);\n };\n });\n\n const value = useMemo(\n () => ({\n state: tooltipState,\n show,\n hide,\n }),\n [tooltipState.reference],\n );\n\n return (\n <Provider value={value}>\n {children}\n <DSPopover\n boundaries=\"scrollParent\"\n {...(tooltipState.options || {})}\n content={tooltipState.renderer}\n placement=\"left\"\n referenceEl={tooltipState.reference}\n renderer={({ as: Component, style, children: Content }) => (\n <div ref={toolbarRef} onMouseEnter={(e) => show(tooltipState, e)} onMouseLeave={hide}>\n <Component style={style}>{Content}</Component>\n </div>\n )}\n style={tooltipState.style}\n visible={tooltipState.visible}\n />\n </Provider>\n );\n});\n\nexport { ToolbarProvider };\nexport default ToolbarProvider;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkE;AAClE,wBAA0B;AAC1B,0BAAkC;AAE3B,MAAM,iBAAiB,qBAAM,cAAc;AAElD,MAAM,EAAE,aAAa;AAErB,MAAM,oBAAoB,CAAC,UAAU,iBAAiB;AACpD,8BAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,UAAU,IAAI;AAChD,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,UAAU,IAAI;AAAA,IACrD;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AACnB;AAEA,MAAM,OAAO,MAAM;AACnB,MAAM,kBAAkB,uBAAK,C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Aa;AAAA,IAC1B,UAAU,CAAC,EAAE,IAAI,WAAW,OAAO,UAAU,cAC3C,mDAAC;AAAA,MAAI,KAAK;AAAA,MAAY,cAAc,CAAC,MAAM,KAAK,cAAc,CAAC;AAAA,MAAG,cAAc;AAAA,OAC9E,mDAAC;AAAA,MAAU;AAAA,OAAe,OAAQ,CACpC;AAAA,IAEF,OAAO,aAAa;AAAA,IACpB,SAAS,aAAa;AAAA,GACxB,CACF;AAEJ,CAAC;AAGD,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -49,10 +32,12 @@ var React = __toESM(require("react"));
|
|
|
49
32
|
var import_react = __toESM(require("react"));
|
|
50
33
|
var import_uuid = require("uuid");
|
|
51
34
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
52
|
-
const appendHeaderFormatter = (0, import_ds_utilities.curry)((formatter, column) =>
|
|
53
|
-
|
|
35
|
+
const appendHeaderFormatter = (0, import_ds_utilities.curry)((formatter, column) => ({
|
|
36
|
+
...column,
|
|
37
|
+
header: {
|
|
38
|
+
...column.header,
|
|
54
39
|
formatters: [...(0, import_ds_utilities.get)(column, "header.formatters", []), formatter]
|
|
55
|
-
}
|
|
40
|
+
}
|
|
56
41
|
}));
|
|
57
42
|
const appendCellFormatter = (0, import_ds_utilities.curry)((formatter, column, path = "formatters") => {
|
|
58
43
|
const nextColumn = (0, import_ds_utilities.cloneDeep)(column);
|
|
@@ -79,13 +64,16 @@ const defaultColumnDefinitionOptions = {
|
|
|
79
64
|
const mergeClassNameToColumnHeader = (0, import_ds_utilities.curry)((className, column) => {
|
|
80
65
|
const headerProps = (0, import_ds_utilities.get)(column, ["header", "props"], {});
|
|
81
66
|
const headerClassName = headerProps.className || "";
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
return {
|
|
68
|
+
...column,
|
|
69
|
+
header: {
|
|
70
|
+
...column.header,
|
|
71
|
+
props: {
|
|
72
|
+
...headerProps,
|
|
85
73
|
className: `${headerClassName} ${className}`
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
89
77
|
});
|
|
90
78
|
const initColumnDefinition = (options = {}) => {
|
|
91
79
|
return (column) => {
|
|
@@ -94,34 +82,40 @@ const initColumnDefinition = (options = {}) => {
|
|
|
94
82
|
textAlign: "right"
|
|
95
83
|
};
|
|
96
84
|
}
|
|
97
|
-
const { useTextTruncation = true, isUserColumn, visible, normalize } =
|
|
85
|
+
const { useTextTruncation = true, isUserColumn, visible, normalize } = {
|
|
86
|
+
...defaultColumnDefinitionOptions,
|
|
87
|
+
...options
|
|
88
|
+
};
|
|
98
89
|
if (normalize) {
|
|
99
90
|
column.originalProperty = column.property;
|
|
100
91
|
column.property = column.property.replace(/\s+/g, "");
|
|
101
92
|
}
|
|
102
|
-
column.props =
|
|
93
|
+
column.props = {
|
|
94
|
+
...column.props,
|
|
103
95
|
style: {}
|
|
104
|
-
}
|
|
105
|
-
column.header =
|
|
96
|
+
};
|
|
97
|
+
column.header = {
|
|
98
|
+
...column.header,
|
|
106
99
|
label: column.label,
|
|
107
100
|
formatters: [...(0, import_ds_utilities.get)(column, ["header", "formatters"], [])],
|
|
108
101
|
props: {
|
|
109
102
|
style: column.headerStyle || {}
|
|
110
103
|
}
|
|
111
|
-
}
|
|
104
|
+
};
|
|
112
105
|
if (useTextTruncation && !((0, import_ds_utilities.isFunction)(column.customHeaderRenderer) || column.header.formatters.length)) {
|
|
113
106
|
column.header.formatters.push((value) => /* @__PURE__ */ import_react.default.createElement("span", {
|
|
114
107
|
className: "cell-value"
|
|
115
108
|
}, value));
|
|
116
109
|
}
|
|
117
|
-
column.cell =
|
|
110
|
+
column.cell = {
|
|
111
|
+
...column.cell,
|
|
118
112
|
transforms: [],
|
|
119
113
|
formatters: [...(0, import_ds_utilities.get)(column, ["cell", "formatters"], [])],
|
|
120
114
|
scrollingFormatters: [...(0, import_ds_utilities.get)(column, ["cell", "formatters"], [])],
|
|
121
115
|
props: {
|
|
122
116
|
style: column.cellStyle || {}
|
|
123
117
|
}
|
|
124
|
-
}
|
|
118
|
+
};
|
|
125
119
|
if (useTextTruncation && !((0, import_ds_utilities.isFunction)(column.customRenderer) || column.cell.formatters.length)) {
|
|
126
120
|
column.cell.formatters.push((value) => /* @__PURE__ */ import_react.default.createElement("span", {
|
|
127
121
|
className: "cell-value",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/useDataGrid/initColumnDefinition.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n get,\n curry,\n set,\n cloneDeep,\n isFunction,\n} from '@elliemae/ds-utilities';\n\n// TODO: use lenses to access nested fields\n\nexport const appendHeaderFormatter = curry((formatter, column) => ({\n ...column,\n header: {\n ...column.header,\n formatters: [...get(column, 'header.formatters', []), formatter],\n },\n}));\n\nexport const appendCellFormatter = curry(\n (formatter, column, path = 'formatters') => {\n const nextColumn = cloneDeep(column);\n const formatters = get(nextColumn, ['cell', path], []);\n const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);\n if (Array.isArray(formatter)) {\n if (formatter[1]) scrollingFormatters.push(formatter[1]);\n formatters.push(formatter[0]);\n } else {\n formatters.push(formatter);\n scrollingFormatters.push(formatter);\n }\n set(nextColumn, ['cell', path], formatters);\n set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);\n return nextColumn;\n },\n);\n\nconst defaultColumnDefinitionOptions = {\n normalize: false,\n useTextTruncation: true,\n isUserColumn: true,\n visible: true,\n};\n\nexport const mergeClassNameToColumnHeader = curry((className, column) => {\n const headerProps = get(column, ['header', 'props'], {});\n const headerClassName = headerProps.className || '';\n return {\n ...column,\n header: {\n ...column.header,\n props: {\n ...headerProps,\n className: `${headerClassName} ${className}`,\n },\n },\n };\n});\n\nexport const initColumnDefinition = (options = {}) => {\n // eslint-disable-next-line complexity\n return (column) => {\n // todo: clean this\n if (column.type === 'number') {\n // eslint-disable-next-line no-param-reassign\n column.cellStyle = {\n textAlign: 'right',\n };\n }\n const { useTextTruncation = true, isUserColumn, visible, normalize } = {\n ...defaultColumnDefinitionOptions,\n ...options,\n };\n\n if (normalize) {\n // eslint-disable-next-line no-param-reassign\n column.originalProperty = column.property;\n // eslint-disable-next-line no-param-reassign\n column.property = column.property.replace(/\\s+/g, '');\n }\n\n // eslint-disable-next-line no-param-reassign\n column.props = {\n ...column.props,\n style: {},\n };\n // eslint-disable-next-line no-param-reassign\n column.header = {\n ...column.header,\n label: column.label,\n formatters: [...get(column, ['header', 'formatters'], [])],\n props: {\n style: column.headerStyle || {},\n },\n };\n if (\n useTextTruncation &&\n !(\n isFunction(column.customHeaderRenderer) ||\n column.header.formatters.length\n )\n ) {\n column.header.formatters.push((value) => (\n <span className=\"cell-value\">{value}</span>\n ));\n }\n\n // eslint-disable-next-line no-param-reassign\n column.cell = {\n ...column.cell,\n transforms: [],\n formatters: [...get(column, ['cell', 'formatters'], [])],\n scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],\n props: {\n style: column.cellStyle || {},\n },\n };\n\n if (\n useTextTruncation &&\n !(isFunction(column.customRenderer) || column.cell.formatters.length)\n ) {\n column.cell.formatters.push((value) => (\n <span\n className=\"cell-value\"\n style={{\n justifyContent:\n column.type === 'number' ? 'flex-end' : 'flex-start',\n }}\n >\n {value}\n </span>\n ));\n }\n // eslint-disable-next-line no-param-reassign\n column.uuid = column.uuid || uuidv4();\n // eslint-disable-next-line no-param-reassign\n column.visible = column.visible === undefined ? visible : column.visible;\n // eslint-disable-next-line no-param-reassign, max-lines\n column.isUserColumn = column.isUserColumn || isUserColumn;\n // eslint-disable-next-line no-param-reassign\n column.headerHookEffects = [];\n return column;\n };\n};\n\nexport default initColumnDefinition;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAClB,kBAA6B;AAC7B,0BAMO;AAIA,MAAM,wBAAwB,+BAAM,CAAC,WAAW,WAA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a;AAAA,QAC5C;AAAA,SAEC,KACH,CACD;AAAA,IACH;AAEA,WAAO,OAAO,OAAO,QAAQ,oBAAO;AAEpC,WAAO,UAAU,OAAO,YAAY,SAAY,UAAU,OAAO;AAEjE,WAAO,eAAe,OAAO,gBAAgB;AAE7C,WAAO,oBAAoB,CAAC;AAC5B,WAAO;AAAA,EACT;AACF;AAEA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -64,20 +35,14 @@ var import_utils = require("../createDataInstance/utils");
|
|
|
64
35
|
var import_VolatileRowsListener = require("./VolatileRowsListener");
|
|
65
36
|
var import_utils2 = require("../utils");
|
|
66
37
|
const IS_INTERNET_EXPLORER = (0, import_utils2.isInternetExplorer)();
|
|
67
|
-
const useDataGrid = (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"uuid",
|
|
76
|
-
"plugins",
|
|
77
|
-
"rows",
|
|
78
|
-
"columns",
|
|
79
|
-
"renderers"
|
|
80
|
-
]);
|
|
38
|
+
const useDataGrid = ({
|
|
39
|
+
uuid: uuidProp,
|
|
40
|
+
plugins: pluginsFromProps,
|
|
41
|
+
rows,
|
|
42
|
+
columns,
|
|
43
|
+
renderers = {},
|
|
44
|
+
...props
|
|
45
|
+
}) => {
|
|
81
46
|
const plugins = pluginsFromProps;
|
|
82
47
|
const instance = (0, import_react.useRef)();
|
|
83
48
|
const tableRef = (0, import_react.useRef)();
|
|
@@ -161,18 +126,30 @@ const useDataGrid = (_a) => {
|
|
|
161
126
|
plugins.forEach((plugin) => nextDecorators = plugin(nextDecorators));
|
|
162
127
|
return nextDecorators;
|
|
163
128
|
}, [plugins]);
|
|
164
|
-
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) =>
|
|
129
|
+
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => ({
|
|
130
|
+
...nextInstance,
|
|
131
|
+
...decorator(instance.current)
|
|
132
|
+
}), instance.current);
|
|
165
133
|
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
166
134
|
const { state, actions } = decorator(instance.current);
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
135
|
+
return {
|
|
136
|
+
...nextInstance,
|
|
137
|
+
state: {
|
|
138
|
+
...nextInstance.state,
|
|
139
|
+
...state
|
|
140
|
+
},
|
|
141
|
+
actions: {
|
|
142
|
+
...nextInstance.actions,
|
|
143
|
+
...actions
|
|
144
|
+
}
|
|
145
|
+
};
|
|
171
146
|
}, instance.current);
|
|
172
|
-
const reduceHotKey = (nextInstance, { key, handler, options }) =>
|
|
173
|
-
|
|
147
|
+
const reduceHotKey = (nextInstance, { key, handler, options }) => ({
|
|
148
|
+
...nextInstance,
|
|
149
|
+
hotKeys: {
|
|
150
|
+
...nextInstance.hotKeys,
|
|
174
151
|
[key]: { handler, options }
|
|
175
|
-
}
|
|
152
|
+
}
|
|
176
153
|
});
|
|
177
154
|
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
178
155
|
const hotKeys = decorator(nextInstance);
|
|
@@ -202,9 +179,10 @@ const useDataGrid = (_a) => {
|
|
|
202
179
|
}
|
|
203
180
|
if (props.instanceRef)
|
|
204
181
|
(0, import_ds_utilities.setRef)(props.instanceRef, instance.current);
|
|
205
|
-
return
|
|
182
|
+
return {
|
|
183
|
+
...instance.current,
|
|
206
184
|
decorators
|
|
207
|
-
}
|
|
185
|
+
};
|
|
208
186
|
};
|
|
209
187
|
var useDataGrid_default = useDataGrid;
|
|
210
188
|
//# sourceMappingURL=useDataGrid.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/useDataGrid/useDataGrid.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport {\n cloneDeep,\n compose,\n isEqual,\n isObject,\n setRef, \n usePrevious, \n useDerivedStateFromProps \n} from '@elliemae/ds-utilities';\nimport { useMemo, useRef, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport * as resolve from 'table-resolver';\nimport { initColumnDefinition } from './initColumnDefinition';\nimport {\n applyDecorators,\n decorateColumns,\n reducePropsGetter,\n} from '../createDataInstance/utils';\nimport { VolatileRowsListener } from './VolatileRowsListener';\nimport { isInternetExplorer } from '../utils';\n\nconst IS_INTERNET_EXPLORER = isInternetExplorer();\n\n// TODO: Reuse createDataInstance for the grid the same\n// way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js\n// eslint-disable-next-line max-statements\nexport const useDataGrid = ({\n uuid: uuidProp,\n plugins: pluginsFromProps,\n rows,\n columns,\n renderers = {},\n ...props\n}) => {\n const plugins = pluginsFromProps;\n const instance = useRef();\n const tableRef = useRef();\n const headerRef = useRef();\n const bodyRef = useRef();\n const bodyInnerRef = useRef();\n const [uuid] = useState(uuidProp || (() => uuidv4()));\n const [hasScroll, setHasScroll] = useState(false);\n const [isRowDragging, setIsRowDragging] = useState(false);\n const isScrolling = useRef();\n const shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff\n const [RowsObserver] = useState(() => new VolatileRowsListener());\n\n // todo move this with rows composition\n const [originalRows, updateRows] = useDerivedStateFromProps(rows, {\n onUpdate: resolve.resolve({\n columns,\n method: (extra) =>\n compose(\n resolve.byFunction('valueTransformation')(extra),\n resolve.nested(extra),\n ),\n }),\n updateOnStateChange: true,\n });\n\n instance.current = {\n decoratedRenderers: cloneDeep(renderers),\n decoratedColumns: columns,\n columns,\n rows,\n composedRows: originalRows,\n getRowProps: [],\n getHeaderRowProps: [],\n getBodyProps: [],\n getTableProps: [],\n effects: [],\n uuid,\n props,\n refs: {\n table: tableRef,\n body: bodyRef,\n header: headerRef,\n innerBody: bodyInnerRef,\n },\n state: {\n hasScroll,\n },\n actions: {\n updateRows,\n },\n updateRows,\n // eslint-disable-next-line no-return-assign\n enableEvents: () =>\n (document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null),\n // eslint-disable-next-line no-return-assign\n disableEvents: () => (document.body.style.pointerEvents = 'none'),\n observeRows: (observer) => RowsObserver.observe(observer),\n hotKeys: {},\n shouldRefocus,\n isScrolling,\n setHasScroll,\n setIsRowDragging,\n isRowDragging,\n plugins,\n };\n instance.current.getState = () => instance.current.state;\n instance.current.getInstance = () => instance.current;\n\n const defaultDecorators = {\n decorateGrid: [],\n registerStateHook: [],\n registerHotKeys: [],\n decorateColumn: [],\n decorateColumns: [\n (cols) =>\n cols.map((col) =>\n initColumnDefinition({\n useTextTruncation: col.useTextTruncation,\n wrapText: props.wrapText,\n normalize: props.normalizeDataKeys,\n })(col),\n ),\n ],\n decorateRenderers: [],\n getRowProps: [],\n getHeaderRowProps: [],\n getBodyProps: [],\n getTableProps: [],\n getHeaderProps: [],\n composeRows: [],\n };\n\n const decorators = useMemo(() => {\n let nextDecorators = defaultDecorators;\n // eslint-disable-next-line no-return-assign\n plugins.forEach((plugin) => (nextDecorators = plugin(nextDecorators)));\n return nextDecorators;\n }, [plugins]);\n\n instance.current = decorators.decorateGrid.reduce(\n (nextInstance, decorator) => ({\n ...nextInstance,\n ...decorator(instance.current),\n }),\n instance.current,\n );\n\n instance.current = decorators.registerStateHook.reduce(\n (nextInstance, decorator) => {\n const { state, actions } = decorator(instance.current);\n return {\n ...nextInstance,\n state: {\n ...nextInstance.state,\n ...state,\n },\n actions: {\n ...nextInstance.actions,\n ...actions,\n },\n };\n },\n instance.current,\n );\n\n const reduceHotKey = (nextInstance, { key, handler, options }) => ({\n ...nextInstance,\n hotKeys: {\n ...nextInstance.hotKeys,\n [key]: { handler, options },\n },\n });\n instance.current = decorators.registerHotKeys.reduce(\n (nextInstance, decorator) => {\n const hotKeys = decorator(nextInstance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, nextInstance);\n }\n return reduceHotKey(nextInstance, hotKeys);\n },\n instance.current,\n );\n\n instance.current.decoratedRenderers = applyDecorators(\n instance.current.decoratedRenderers,\n decorators.decorateRenderers,\n instance.current,\n );\n\n instance.current.decoratedColumns = useMemo(() => {\n const visibleColumns = cloneDeep(columns).filter(\n (column) => typeof column.visible === 'undefined' || column.visible,\n );\n return visibleColumns.length\n ? decorateColumns(visibleColumns, decorators, instance.current)\n : [];\n }, [columns]);\n\n instance.current.getBodyProps = reducePropsGetter(\n decorators.getBodyProps,\n instance.current,\n );\n instance.current.getHeaderProps = reducePropsGetter(\n decorators.getHeaderProps,\n instance.current,\n );\n instance.current.getRowProps = reducePropsGetter(\n decorators.getRowProps,\n instance.current,\n );\n instance.current.getHeaderRowProps = reducePropsGetter(\n decorators.getHeaderRowProps,\n instance.current,\n );\n instance.current.getTableProps = reducePropsGetter(\n decorators.getTableProps,\n instance.current,\n );\n\n instance.current.composedRows = decorators.composeRows.reduce(\n (nextRows, getter) => getter(nextRows, instance.current),\n instance.current.composedRows,\n );\n\n RowsObserver.notify(instance.current.composedRows);\n\n const currentShouldRefocus = instance.current.shouldRefocus.current;\n const prevState = usePrevious(instance.current.state);\n if (isObject(currentShouldRefocus) && currentShouldRefocus.forced) {\n instance.current.shouldRefocus.current = currentShouldRefocus.value;\n } else {\n instance.current.shouldRefocus.current = !isEqual(\n prevState,\n instance.current.state,\n );\n }\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return {\n ...instance.current,\n decorators,\n };\n};\n\nexport default useDataGrid;\n\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAQO;AACP,mBAA0C;AAC1C,kBAA6B;AAC7B,cAAyB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CACnC,WAAW,mBACX,SAAS,OACX;AACA,WAAS,QAAQ,gBAAgB,oCAC/B,WAAW,eACX,SAAS,OACX;AAEA,WAAS,QAAQ,eAAe,WAAW,YAAY,OACrD,CAAC,UAAU,WAAW,OAAO,UAAU,SAAS,OAAO,GACvD,SAAS,QAAQ,YACnB;AAEA,eAAa,OAAO,SAAS,QAAQ,YAAY;AAEjD,QAAM,uBAAuB,SAAS,QAAQ,cAAc;AAC5D,QAAM,YAAY,qCAAY,SAAS,QAAQ,KAAK;AACpD,MAAI,kCAAS,oBAAoB,KAAK,qBAAqB,QAAQ;AACjE,aAAS,QAAQ,cAAc,UAAU,qBAAqB;AAAA,EAChE,OAAO;AACL,aAAS,QAAQ,cAAc,UAAU,CAAC,iCACxC,WACA,SAAS,QAAQ,KACnB;AAAA,EACF;AAEA,MAAI,MAAM;AAAa,oCAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO;AAAA,IACL,GAAG,SAAS;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -69,34 +40,30 @@ const listRenderers = {
|
|
|
69
40
|
list: "ul",
|
|
70
41
|
item: "li"
|
|
71
42
|
};
|
|
72
|
-
const useDataList = (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"data",
|
|
81
|
-
"plugins",
|
|
82
|
-
"renderers",
|
|
83
|
-
"itemRenderer",
|
|
84
|
-
"customDecorators"
|
|
85
|
-
]);
|
|
43
|
+
const useDataList = ({
|
|
44
|
+
data = [],
|
|
45
|
+
plugins = [],
|
|
46
|
+
renderers = listRenderers,
|
|
47
|
+
itemRenderer = [],
|
|
48
|
+
customDecorators,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
86
51
|
const listRef = (0, import_react.useRef)();
|
|
87
|
-
const { instance, decorators } = (0, import_createInstanceRef.createDataInstanceRef)(
|
|
52
|
+
const { instance, decorators } = (0, import_createInstanceRef.createDataInstanceRef)({
|
|
88
53
|
data,
|
|
89
54
|
renderers,
|
|
90
55
|
plugins,
|
|
91
|
-
customDecorators:
|
|
56
|
+
customDecorators: {
|
|
57
|
+
...customDecorators,
|
|
92
58
|
recordIterator: import_recordIterator.recordIterator,
|
|
93
59
|
getListProps: [],
|
|
94
60
|
getItemProps: [],
|
|
95
61
|
itemRenderer: [...itemRenderer],
|
|
96
62
|
record: [],
|
|
97
63
|
records: []
|
|
98
|
-
}
|
|
99
|
-
|
|
64
|
+
},
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
100
67
|
instance.current.getListRef = () => listRef;
|
|
101
68
|
instance.current.setListRef = (ref) => {
|
|
102
69
|
listRef.current = ref;
|