@elliemae/ds-shared 3.27.0-next.1 → 3.27.0-next.3
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/index.js +1 -16
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +1 -16
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +1 -16
- package/package.json +8 -194
- package/dist/cjs/Animations/BaseAnimation.js +0 -49
- package/dist/cjs/Animations/BaseAnimation.js.map +0 -7
- package/dist/cjs/Animations/Grow.js +0 -52
- package/dist/cjs/Animations/Grow.js.map +0 -7
- package/dist/cjs/Animations/GrowRight.js +0 -69
- package/dist/cjs/Animations/GrowRight.js.map +0 -7
- package/dist/cjs/Animations/GrowVertical.js +0 -68
- package/dist/cjs/Animations/GrowVertical.js.map +0 -7
- package/dist/cjs/Animations/index.js +0 -33
- package/dist/cjs/Animations/index.js.map +0 -7
- package/dist/cjs/CheckableGroup.js +0 -74
- package/dist/cjs/CheckableGroup.js.map +0 -7
- package/dist/cjs/DeferRenderAfterComputation.js +0 -52
- package/dist/cjs/DeferRenderAfterComputation.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGrid.js +0 -183
- package/dist/cjs/FocusGroup/FocusGrid.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGroup.js +0 -272
- package/dist/cjs/FocusGroup/FocusGroup.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGroupContext.js +0 -39
- package/dist/cjs/FocusGroup/FocusGroupContext.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGroupManager.js +0 -126
- package/dist/cjs/FocusGroup/FocusGroupManager.js.map +0 -7
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js +0 -53
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -7
- package/dist/cjs/FocusGroup/index.js +0 -45
- package/dist/cjs/FocusGroup/index.js.map +0 -7
- package/dist/cjs/FocusGroup/useFocusGroupItem.js +0 -68
- package/dist/cjs/FocusGroup/useFocusGroupItem.js.map +0 -7
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js +0 -81
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -7
- package/dist/cjs/GroupContext/Group.js +0 -115
- package/dist/cjs/GroupContext/Group.js.map +0 -7
- package/dist/cjs/GroupContext/GroupContext.js +0 -37
- package/dist/cjs/GroupContext/GroupContext.js.map +0 -7
- package/dist/cjs/GroupContext/GroupItem.js +0 -41
- package/dist/cjs/GroupContext/GroupItem.js.map +0 -7
- package/dist/cjs/GroupContext/index.js +0 -40
- package/dist/cjs/GroupContext/index.js.map +0 -7
- package/dist/cjs/ScrollSync/ScrollSync.js +0 -132
- package/dist/cjs/ScrollSync/ScrollSync.js.map +0 -7
- package/dist/cjs/ScrollSync/ScrollSyncPane.js +0 -72
- package/dist/cjs/ScrollSync/ScrollSyncPane.js.map +0 -7
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js +0 -116
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -7
- package/dist/cjs/ScrollSync/index.js +0 -41
- package/dist/cjs/ScrollSync/index.js.map +0 -7
- package/dist/cjs/ScrollSync/useScrollSync.js +0 -40
- package/dist/cjs/ScrollSync/useScrollSync.js.map +0 -7
- package/dist/cjs/constants.js +0 -71
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/createDataInstance/createInstancePlugin.js +0 -50
- package/dist/cjs/createDataInstance/createInstancePlugin.js.map +0 -7
- package/dist/cjs/createDataInstance/createInstanceRef.js +0 -91
- package/dist/cjs/createDataInstance/createInstanceRef.js.map +0 -7
- package/dist/cjs/createDataInstance/index.js +0 -32
- package/dist/cjs/createDataInstance/index.js.map +0 -7
- package/dist/cjs/createDataInstance/utils.js +0 -100
- package/dist/cjs/createDataInstance/utils.js.map +0 -7
- package/dist/cjs/defer-render-hoc/index.js +0 -56
- package/dist/cjs/defer-render-hoc/index.js.map +0 -7
- package/dist/cjs/dimsum.config.js +0 -40
- package/dist/cjs/dimsum.config.js.map +0 -7
- package/dist/cjs/prop-types.js +0 -117
- package/dist/cjs/prop-types.js.map +0 -7
- package/dist/cjs/react-spring/index.js +0 -30
- package/dist/cjs/react-spring/index.js.map +0 -7
- package/dist/cjs/react-spring/renderprops.js +0 -30
- package/dist/cjs/react-spring/renderprops.js.map +0 -7
- package/dist/cjs/toolbar/ToolbarProvider.js +0 -120
- package/dist/cjs/toolbar/ToolbarProvider.js.map +0 -7
- package/dist/cjs/useDataGrid/VolatileRowsListener.js +0 -50
- package/dist/cjs/useDataGrid/VolatileRowsListener.js.map +0 -7
- package/dist/cjs/useDataGrid/index.js +0 -32
- package/dist/cjs/useDataGrid/index.js.map +0 -7
- package/dist/cjs/useDataGrid/initColumnDefinition.js +0 -150
- package/dist/cjs/useDataGrid/initColumnDefinition.js.map +0 -7
- package/dist/cjs/useDataGrid/useDataGrid.js +0 -204
- package/dist/cjs/useDataGrid/useDataGrid.js.map +0 -7
- package/dist/cjs/useDataList/index.js +0 -31
- package/dist/cjs/useDataList/index.js.map +0 -7
- package/dist/cjs/useDataList/recordIterator.js +0 -56
- package/dist/cjs/useDataList/recordIterator.js.map +0 -7
- package/dist/cjs/useDataList/useDataList.js +0 -100
- package/dist/cjs/useDataList/useDataList.js.map +0 -7
- package/dist/cjs/utils.js +0 -108
- package/dist/cjs/utils.js.map +0 -7
- package/dist/cjs/virtualization/AutoHeightList.js +0 -76
- package/dist/cjs/virtualization/AutoHeightList.js.map +0 -7
- package/dist/cjs/virtualization/FluidHeightList.js +0 -46
- package/dist/cjs/virtualization/FluidHeightList.js.map +0 -7
- package/dist/cjs/virtualization/index.js +0 -46
- package/dist/cjs/virtualization/index.js.map +0 -7
- package/dist/esm/Animations/BaseAnimation.js +0 -19
- package/dist/esm/Animations/BaseAnimation.js.map +0 -7
- package/dist/esm/Animations/Grow.js +0 -22
- package/dist/esm/Animations/Grow.js.map +0 -7
- package/dist/esm/Animations/GrowRight.js +0 -39
- package/dist/esm/Animations/GrowRight.js.map +0 -7
- package/dist/esm/Animations/GrowVertical.js +0 -38
- package/dist/esm/Animations/GrowVertical.js.map +0 -7
- package/dist/esm/Animations/index.js +0 -6
- package/dist/esm/Animations/index.js.map +0 -7
- package/dist/esm/CheckableGroup.js +0 -44
- package/dist/esm/CheckableGroup.js.map +0 -7
- package/dist/esm/DeferRenderAfterComputation.js +0 -22
- package/dist/esm/DeferRenderAfterComputation.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGrid.js +0 -153
- package/dist/esm/FocusGroup/FocusGrid.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGroup.js +0 -242
- package/dist/esm/FocusGroup/FocusGroup.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGroupContext.js +0 -9
- package/dist/esm/FocusGroup/FocusGroupContext.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGroupManager.js +0 -96
- package/dist/esm/FocusGroup/FocusGroupManager.js.map +0 -7
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js +0 -23
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -7
- package/dist/esm/FocusGroup/index.js +0 -14
- package/dist/esm/FocusGroup/index.js.map +0 -7
- package/dist/esm/FocusGroup/useFocusGroupItem.js +0 -38
- package/dist/esm/FocusGroup/useFocusGroupItem.js.map +0 -7
- package/dist/esm/FocusGroup/utils/getNextCellPosition.js +0 -51
- package/dist/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -7
- package/dist/esm/GroupContext/Group.js +0 -85
- package/dist/esm/GroupContext/Group.js.map +0 -7
- package/dist/esm/GroupContext/GroupContext.js +0 -7
- package/dist/esm/GroupContext/GroupContext.js.map +0 -7
- package/dist/esm/GroupContext/GroupItem.js +0 -11
- package/dist/esm/GroupContext/GroupItem.js.map +0 -7
- package/dist/esm/GroupContext/index.js +0 -10
- package/dist/esm/GroupContext/index.js.map +0 -7
- package/dist/esm/ScrollSync/ScrollSync.js +0 -102
- package/dist/esm/ScrollSync/ScrollSync.js.map +0 -7
- package/dist/esm/ScrollSync/ScrollSyncPane.js +0 -42
- package/dist/esm/ScrollSync/ScrollSyncPane.js.map +0 -7
- package/dist/esm/ScrollSync/ScrollSyncProvider.js +0 -86
- package/dist/esm/ScrollSync/ScrollSyncProvider.js.map +0 -7
- package/dist/esm/ScrollSync/index.js +0 -10
- package/dist/esm/ScrollSync/index.js.map +0 -7
- package/dist/esm/ScrollSync/useScrollSync.js +0 -10
- package/dist/esm/ScrollSync/useScrollSync.js.map +0 -7
- package/dist/esm/constants.js +0 -41
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/createDataInstance/createInstancePlugin.js +0 -20
- package/dist/esm/createDataInstance/createInstancePlugin.js.map +0 -7
- package/dist/esm/createDataInstance/createInstanceRef.js +0 -61
- package/dist/esm/createDataInstance/createInstanceRef.js.map +0 -7
- package/dist/esm/createDataInstance/index.js +0 -5
- package/dist/esm/createDataInstance/index.js.map +0 -7
- package/dist/esm/createDataInstance/utils.js +0 -70
- package/dist/esm/createDataInstance/utils.js.map +0 -7
- package/dist/esm/defer-render-hoc/index.js +0 -26
- package/dist/esm/defer-render-hoc/index.js.map +0 -7
- package/dist/esm/dimsum.config.js +0 -10
- package/dist/esm/dimsum.config.js.map +0 -7
- package/dist/esm/prop-types.js +0 -87
- package/dist/esm/prop-types.js.map +0 -7
- package/dist/esm/react-spring/index.js +0 -3
- package/dist/esm/react-spring/index.js.map +0 -7
- package/dist/esm/react-spring/renderprops.js +0 -3
- package/dist/esm/react-spring/renderprops.js.map +0 -7
- package/dist/esm/toolbar/ToolbarProvider.js +0 -90
- package/dist/esm/toolbar/ToolbarProvider.js.map +0 -7
- package/dist/esm/useDataGrid/VolatileRowsListener.js +0 -20
- package/dist/esm/useDataGrid/VolatileRowsListener.js.map +0 -7
- package/dist/esm/useDataGrid/index.js +0 -5
- package/dist/esm/useDataGrid/index.js.map +0 -7
- package/dist/esm/useDataGrid/initColumnDefinition.js +0 -120
- package/dist/esm/useDataGrid/initColumnDefinition.js.map +0 -7
- package/dist/esm/useDataGrid/useDataGrid.js +0 -182
- package/dist/esm/useDataGrid/useDataGrid.js.map +0 -7
- package/dist/esm/useDataList/index.js +0 -4
- package/dist/esm/useDataList/index.js.map +0 -7
- package/dist/esm/useDataList/recordIterator.js +0 -26
- package/dist/esm/useDataList/recordIterator.js.map +0 -7
- package/dist/esm/useDataList/useDataList.js +0 -70
- package/dist/esm/useDataList/useDataList.js.map +0 -7
- package/dist/esm/utils.js +0 -78
- package/dist/esm/utils.js.map +0 -7
- package/dist/esm/virtualization/AutoHeightList.js +0 -46
- package/dist/esm/virtualization/AutoHeightList.js.map +0 -7
- package/dist/esm/virtualization/FluidHeightList.js +0 -16
- package/dist/esm/virtualization/FluidHeightList.js.map +0 -7
- package/dist/esm/virtualization/index.js +0 -16
- package/dist/esm/virtualization/index.js.map +0 -7
- package/dist/types/Animations/BaseAnimation.d.ts +0 -12
- package/dist/types/Animations/Grow.d.ts +0 -11
- package/dist/types/Animations/GrowRight.d.ts +0 -11
- package/dist/types/Animations/GrowVertical.d.ts +0 -11
- package/dist/types/Animations/index.d.ts +0 -4
- package/dist/types/CheckableGroup.d.ts +0 -19
- package/dist/types/DeferRenderAfterComputation.d.ts +0 -7
- package/dist/types/FocusGroup/FocusGrid.d.ts +0 -12
- package/dist/types/FocusGroup/FocusGroup.d.ts +0 -38
- package/dist/types/FocusGroup/FocusGroupContext.d.ts +0 -4
- package/dist/types/FocusGroup/FocusGroupManager.d.ts +0 -26
- package/dist/types/FocusGroup/focusGroupManagerHoc.d.ts +0 -8
- package/dist/types/FocusGroup/index.d.ts +0 -7
- package/dist/types/FocusGroup/useFocusGroupItem.d.ts +0 -4
- package/dist/types/FocusGroup/utils/getNextCellPosition.d.ts +0 -14
- package/dist/types/GroupContext/Group.d.ts +0 -15
- package/dist/types/GroupContext/GroupContext.d.ts +0 -2
- package/dist/types/GroupContext/GroupItem.d.ts +0 -5
- package/dist/types/GroupContext/index.d.ts +0 -3
- package/dist/types/ScrollSync/ScrollSync.d.ts +0 -23
- package/dist/types/ScrollSync/ScrollSyncPane.d.ts +0 -2
- package/dist/types/ScrollSync/ScrollSyncProvider.d.ts +0 -12
- package/dist/types/ScrollSync/index.d.ts +0 -4
- package/dist/types/ScrollSync/useScrollSync.d.ts +0 -7
- package/dist/types/constants.d.ts +0 -30
- package/dist/types/createDataInstance/createInstancePlugin.d.ts +0 -4
- package/dist/types/createDataInstance/createInstanceRef.d.ts +0 -14
- package/dist/types/createDataInstance/index.d.ts +0 -3
- package/dist/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
- package/dist/types/createDataInstance/utils.d.ts +0 -9
- package/dist/types/defer-render-hoc/index.d.ts +0 -63
- package/dist/types/dimsum.config.d.ts +0 -5
- package/dist/types/prop-types.d.ts +0 -41
- package/dist/types/react-spring/index.d.ts +0 -1
- package/dist/types/react-spring/renderprops.d.ts +0 -1
- package/dist/types/toolbar/ToolbarProvider.d.ts +0 -5
- package/dist/types/useDataGrid/VolatileRowsListener.d.ts +0 -7
- package/dist/types/useDataGrid/index.d.ts +0 -3
- package/dist/types/useDataGrid/initColumnDefinition.d.ts +0 -6
- package/dist/types/useDataGrid/useDataGrid.d.ts +0 -9
- package/dist/types/useDataList/index.d.ts +0 -2
- package/dist/types/useDataList/recordIterator.d.ts +0 -1
- package/dist/types/useDataList/useDataList.d.ts +0 -14
- package/dist/types/utils.d.ts +0 -22
- package/dist/types/virtualization/AutoHeightList.d.ts +0 -2
- package/dist/types/virtualization/FluidHeightList.d.ts +0 -2
- package/dist/types/virtualization/index.d.ts +0 -9
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var useDataGrid_exports = {};
|
|
30
|
-
__export(useDataGrid_exports, {
|
|
31
|
-
default: () => useDataGrid_default,
|
|
32
|
-
useDataGrid: () => useDataGrid
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(useDataGrid_exports);
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
37
|
-
var import_react = require("react");
|
|
38
|
-
var import_uuid = require("uuid");
|
|
39
|
-
var resolve = __toESM(require("table-resolver"));
|
|
40
|
-
var import_initColumnDefinition = require("./initColumnDefinition.js");
|
|
41
|
-
var import_utils = require("../createDataInstance/utils.js");
|
|
42
|
-
var import_VolatileRowsListener = require("./VolatileRowsListener.js");
|
|
43
|
-
var import_utils2 = require("../utils.js");
|
|
44
|
-
const IS_INTERNET_EXPLORER = (0, import_utils2.isInternetExplorer)();
|
|
45
|
-
const useDataGrid = ({ uuid: uuidProp, plugins: pluginsFromProps, rows, columns, renderers = {}, ...props }) => {
|
|
46
|
-
const plugins = pluginsFromProps;
|
|
47
|
-
const instance = (0, import_react.useRef)();
|
|
48
|
-
const tableRef = (0, import_react.useRef)();
|
|
49
|
-
const headerRef = (0, import_react.useRef)();
|
|
50
|
-
const bodyRef = (0, import_react.useRef)();
|
|
51
|
-
const bodyInnerRef = (0, import_react.useRef)();
|
|
52
|
-
const [uuid] = (0, import_react.useState)(uuidProp || (() => (0, import_uuid.v4)()));
|
|
53
|
-
const [hasScroll, setHasScroll] = (0, import_react.useState)(false);
|
|
54
|
-
const [isRowDragging, setIsRowDragging] = (0, import_react.useState)(false);
|
|
55
|
-
const isScrolling = (0, import_react.useRef)();
|
|
56
|
-
const shouldRefocus = (0, import_react.useRef)();
|
|
57
|
-
const [RowsObserver] = (0, import_react.useState)(() => new import_VolatileRowsListener.VolatileRowsListener());
|
|
58
|
-
const [originalRows, updateRows] = (0, import_ds_utilities.useDerivedStateFromProps)(rows, {
|
|
59
|
-
onUpdate: resolve.resolve({
|
|
60
|
-
columns,
|
|
61
|
-
method: (extra) => (0, import_ds_utilities.compose)(resolve.byFunction("valueTransformation")(extra), resolve.nested(extra))
|
|
62
|
-
}),
|
|
63
|
-
updateOnStateChange: true
|
|
64
|
-
});
|
|
65
|
-
instance.current = {
|
|
66
|
-
decoratedRenderers: (0, import_ds_utilities.cloneDeep)(renderers),
|
|
67
|
-
decoratedColumns: columns,
|
|
68
|
-
columns,
|
|
69
|
-
rows,
|
|
70
|
-
composedRows: originalRows,
|
|
71
|
-
getRowProps: [],
|
|
72
|
-
getHeaderRowProps: [],
|
|
73
|
-
getBodyProps: [],
|
|
74
|
-
getTableProps: [],
|
|
75
|
-
effects: [],
|
|
76
|
-
uuid,
|
|
77
|
-
props,
|
|
78
|
-
refs: {
|
|
79
|
-
table: tableRef,
|
|
80
|
-
body: bodyRef,
|
|
81
|
-
header: headerRef,
|
|
82
|
-
innerBody: bodyInnerRef
|
|
83
|
-
},
|
|
84
|
-
state: {
|
|
85
|
-
hasScroll
|
|
86
|
-
},
|
|
87
|
-
actions: {
|
|
88
|
-
updateRows
|
|
89
|
-
},
|
|
90
|
-
updateRows,
|
|
91
|
-
// eslint-disable-next-line no-return-assign
|
|
92
|
-
enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? "" : null,
|
|
93
|
-
// eslint-disable-next-line no-return-assign
|
|
94
|
-
disableEvents: () => document.body.style.pointerEvents = "none",
|
|
95
|
-
observeRows: (observer) => RowsObserver.observe(observer),
|
|
96
|
-
hotKeys: {},
|
|
97
|
-
shouldRefocus,
|
|
98
|
-
isScrolling,
|
|
99
|
-
setHasScroll,
|
|
100
|
-
setIsRowDragging,
|
|
101
|
-
isRowDragging,
|
|
102
|
-
plugins
|
|
103
|
-
};
|
|
104
|
-
instance.current.getState = () => instance.current.state;
|
|
105
|
-
instance.current.getInstance = () => instance.current;
|
|
106
|
-
const defaultDecorators = {
|
|
107
|
-
decorateGrid: [],
|
|
108
|
-
registerStateHook: [],
|
|
109
|
-
registerHotKeys: [],
|
|
110
|
-
decorateColumn: [],
|
|
111
|
-
decorateColumns: [
|
|
112
|
-
(cols) => cols.map(
|
|
113
|
-
(col) => (0, import_initColumnDefinition.initColumnDefinition)({
|
|
114
|
-
useTextTruncation: col.useTextTruncation,
|
|
115
|
-
wrapText: props.wrapText,
|
|
116
|
-
normalize: props.normalizeDataKeys
|
|
117
|
-
})(col)
|
|
118
|
-
)
|
|
119
|
-
],
|
|
120
|
-
decorateRenderers: [],
|
|
121
|
-
getRowProps: [],
|
|
122
|
-
getHeaderRowProps: [],
|
|
123
|
-
getBodyProps: [],
|
|
124
|
-
getTableProps: [],
|
|
125
|
-
getHeaderProps: [],
|
|
126
|
-
composeRows: []
|
|
127
|
-
};
|
|
128
|
-
const decorators = (0, import_react.useMemo)(() => {
|
|
129
|
-
let nextDecorators = defaultDecorators;
|
|
130
|
-
plugins.forEach((plugin) => nextDecorators = plugin(nextDecorators));
|
|
131
|
-
return nextDecorators;
|
|
132
|
-
}, [plugins]);
|
|
133
|
-
instance.current = decorators.decorateGrid.reduce(
|
|
134
|
-
(nextInstance, decorator) => ({
|
|
135
|
-
...nextInstance,
|
|
136
|
-
...decorator(instance.current)
|
|
137
|
-
}),
|
|
138
|
-
instance.current
|
|
139
|
-
);
|
|
140
|
-
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
141
|
-
const { state, actions } = decorator(instance.current);
|
|
142
|
-
return {
|
|
143
|
-
...nextInstance,
|
|
144
|
-
state: {
|
|
145
|
-
...nextInstance.state,
|
|
146
|
-
...state
|
|
147
|
-
},
|
|
148
|
-
actions: {
|
|
149
|
-
...nextInstance.actions,
|
|
150
|
-
...actions
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}, instance.current);
|
|
154
|
-
const reduceHotKey = (nextInstance, { key, handler, options }) => ({
|
|
155
|
-
...nextInstance,
|
|
156
|
-
hotKeys: {
|
|
157
|
-
...nextInstance.hotKeys,
|
|
158
|
-
[key]: { handler, options }
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
162
|
-
const hotKeys = decorator(nextInstance);
|
|
163
|
-
if (Array.isArray(hotKeys)) {
|
|
164
|
-
return hotKeys.reduce(reduceHotKey, nextInstance);
|
|
165
|
-
}
|
|
166
|
-
return reduceHotKey(nextInstance, hotKeys);
|
|
167
|
-
}, instance.current);
|
|
168
|
-
instance.current.decoratedRenderers = (0, import_utils.applyDecorators)(
|
|
169
|
-
instance.current.decoratedRenderers,
|
|
170
|
-
decorators.decorateRenderers,
|
|
171
|
-
instance.current
|
|
172
|
-
);
|
|
173
|
-
instance.current.decoratedColumns = (0, import_react.useMemo)(() => {
|
|
174
|
-
const visibleColumns = (0, import_ds_utilities.cloneDeep)(columns).filter(
|
|
175
|
-
(column) => typeof column.visible === "undefined" || column.visible
|
|
176
|
-
);
|
|
177
|
-
return visibleColumns.length ? (0, import_utils.decorateColumns)(visibleColumns, decorators, instance.current) : [];
|
|
178
|
-
}, [columns]);
|
|
179
|
-
instance.current.getBodyProps = (0, import_utils.reducePropsGetter)(decorators.getBodyProps, instance.current);
|
|
180
|
-
instance.current.getHeaderProps = (0, import_utils.reducePropsGetter)(decorators.getHeaderProps, instance.current);
|
|
181
|
-
instance.current.getRowProps = (0, import_utils.reducePropsGetter)(decorators.getRowProps, instance.current);
|
|
182
|
-
instance.current.getHeaderRowProps = (0, import_utils.reducePropsGetter)(decorators.getHeaderRowProps, instance.current);
|
|
183
|
-
instance.current.getTableProps = (0, import_utils.reducePropsGetter)(decorators.getTableProps, instance.current);
|
|
184
|
-
instance.current.composedRows = decorators.composeRows.reduce(
|
|
185
|
-
(nextRows, getter) => getter(nextRows, instance.current),
|
|
186
|
-
instance.current.composedRows
|
|
187
|
-
);
|
|
188
|
-
RowsObserver.notify(instance.current.composedRows);
|
|
189
|
-
const currentShouldRefocus = instance.current.shouldRefocus.current;
|
|
190
|
-
const prevState = (0, import_ds_utilities.usePrevious)(instance.current.state);
|
|
191
|
-
if ((0, import_ds_utilities.isObject)(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
192
|
-
instance.current.shouldRefocus.current = currentShouldRefocus.value;
|
|
193
|
-
} else {
|
|
194
|
-
instance.current.shouldRefocus.current = !(0, import_ds_utilities.isEqual)(prevState, instance.current.state);
|
|
195
|
-
}
|
|
196
|
-
if (props.instanceRef)
|
|
197
|
-
(0, import_ds_utilities.setRef)(props.instanceRef, instance.current);
|
|
198
|
-
return {
|
|
199
|
-
...instance.current,
|
|
200
|
-
decorators
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
var useDataGrid_default = useDataGrid;
|
|
204
|
-
//# sourceMappingURL=useDataGrid.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/useDataGrid/useDataGrid.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
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.js';\nimport { applyDecorators, decorateColumns, reducePropsGetter } from '../createDataInstance/utils.js';\nimport { VolatileRowsListener } from './VolatileRowsListener.js';\nimport { isInternetExplorer } from '../utils.js';\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 = ({ uuid: uuidProp, plugins: pluginsFromProps, rows, columns, renderers = {}, ...props }) => {\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) => compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra)),\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: () => (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((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 }, instance.current);\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((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 }, instance.current);\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 ? decorateColumns(visibleColumns, decorators, instance.current) : [];\n }, [columns]);\n\n instance.current.getBodyProps = reducePropsGetter(decorators.getBodyProps, instance.current);\n instance.current.getHeaderProps = reducePropsGetter(decorators.getHeaderProps, instance.current);\n instance.current.getRowProps = reducePropsGetter(decorators.getRowProps, instance.current);\n instance.current.getHeaderRowProps = reducePropsGetter(decorators.getHeaderRowProps, instance.current);\n instance.current.getTableProps = reducePropsGetter(decorators.getTableProps, instance.current);\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(prevState, instance.current.state);\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAQO;AACP,mBAA0C;A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Ac,SAAS,OAAO;AAC3F,WAAS,QAAQ,qBAAiB,gCAAkB,WAAW,gBAAgB,SAAS,OAAO;AAC/F,WAAS,QAAQ,kBAAc,gCAAkB,WAAW,aAAa,SAAS,OAAO;AACzF,WAAS,QAAQ,wBAAoB,gCAAkB,WAAW,mBAAmB,SAAS,OAAO;AACrG,WAAS,QAAQ,oBAAgB,gCAAkB,WAAW,eAAe,SAAS,OAAO;AAE7F,WAAS,QAAQ,eAAe,WAAW,YAAY;AAAA,IACrD,CAAC,UAAU,WAAW,OAAO,UAAU,SAAS,OAAO;AAAA,IACvD,SAAS,QAAQ;AAAA,EACnB;AAEA,eAAa,OAAO,SAAS,QAAQ,YAAY;AAEjD,QAAM,uBAAuB,SAAS,QAAQ,cAAc;AAC5D,QAAM,gBAAY,iCAAY,SAAS,QAAQ,KAAK;AACpD,UAAI,8BAAS,oBAAoB,KAAK,qBAAqB,QAAQ;AACjE,aAAS,QAAQ,cAAc,UAAU,qBAAqB;AAAA,EAChE,OAAO;AACL,aAAS,QAAQ,cAAc,UAAU,KAAC,6BAAQ,WAAW,SAAS,QAAQ,KAAK;AAAA,EACrF;AAEA,MAAI,MAAM;AAAa,oCAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO;AAAA,IACL,GAAG,SAAS;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;",
|
|
6
|
-
"names": ["import_utils", "uuidv4"]
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
-
var useDataList_exports = {};
|
|
27
|
-
module.exports = __toCommonJS(useDataList_exports);
|
|
28
|
-
var React = __toESM(require("react"));
|
|
29
|
-
__reExport(useDataList_exports, require("./useDataList.js"), module.exports);
|
|
30
|
-
__reExport(useDataList_exports, require("./recordIterator.js"), module.exports);
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/useDataList/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './useDataList.js';\nexport * from './recordIterator.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,6BAAd;AACA,gCAAc,gCADd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var recordIterator_exports = {};
|
|
30
|
-
__export(recordIterator_exports, {
|
|
31
|
-
recordIterator: () => recordIterator
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(recordIterator_exports);
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
const defaultStrategy = () => {
|
|
36
|
-
throw Error("Implement an iterator strategy for record iterator");
|
|
37
|
-
};
|
|
38
|
-
function recordIterator(records, strategy = defaultStrategy, decorators = [], instance) {
|
|
39
|
-
const nextRows = [];
|
|
40
|
-
strategy({
|
|
41
|
-
data: records,
|
|
42
|
-
cb: (row) => {
|
|
43
|
-
let nextRow = row;
|
|
44
|
-
for (let i = 0; i < decorators.length; i++) {
|
|
45
|
-
nextRow = decorators[i](nextRow, instance);
|
|
46
|
-
if (!nextRow)
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
if (nextRow)
|
|
50
|
-
nextRows.push(nextRow);
|
|
51
|
-
},
|
|
52
|
-
instance
|
|
53
|
-
});
|
|
54
|
-
return nextRows;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=recordIterator.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/useDataList/recordIterator.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["const defaultStrategy = () => {\n throw Error('Implement an iterator strategy for record iterator');\n};\n\nexport function recordIterator(records, strategy = defaultStrategy, decorators = [], instance) {\n const nextRows = [];\n\n strategy({\n data: records,\n cb: (row) => {\n let nextRow = row;\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let i = 0; i < decorators.length; i++) {\n nextRow = decorators[i](nextRow, instance);\n if (!nextRow) break;\n }\n\n if (nextRow) nextRows.push(nextRow);\n },\n instance,\n });\n\n return nextRows;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,MAAM,kBAAkB,MAAM;AAC5B,QAAM,MAAM,oDAAoD;AAClE;AAEO,SAAS,eAAe,SAAS,WAAW,iBAAiB,aAAa,CAAC,GAAG,UAAU;AAC7F,QAAM,WAAW,CAAC;AAElB,WAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI,CAAC,QAAQ;AACX,UAAI,UAAU;AAGd,eAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC1C,kBAAU,WAAW,CAAC,EAAE,SAAS,QAAQ;AACzC,YAAI,CAAC;AAAS;AAAA,MAChB;AAEA,UAAI;AAAS,iBAAS,KAAK,OAAO;AAAA,IACpC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var useDataList_exports = {};
|
|
30
|
-
__export(useDataList_exports, {
|
|
31
|
-
default: () => useDataList_default,
|
|
32
|
-
getItemChildren: () => getItemChildren,
|
|
33
|
-
getItemLabel: () => getItemLabel,
|
|
34
|
-
useDataList: () => useDataList
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(useDataList_exports);
|
|
37
|
-
var React = __toESM(require("react"));
|
|
38
|
-
var import_react = require("react");
|
|
39
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
40
|
-
var import_lodash = require("lodash");
|
|
41
|
-
var import_utils = require("../createDataInstance/utils.js");
|
|
42
|
-
var import_recordIterator = require("./recordIterator.js");
|
|
43
|
-
var import_createInstanceRef = require("../createDataInstance/createInstanceRef.js");
|
|
44
|
-
const getItemLabel = (record, nameKey = "name") => (0, import_lodash.get)(record, ["data", nameKey]);
|
|
45
|
-
const getItemChildren = (record, childrenKey = "children") => (0, import_lodash.get)(record, ["data", childrenKey]);
|
|
46
|
-
const listRenderers = {
|
|
47
|
-
list: "ul",
|
|
48
|
-
item: "li"
|
|
49
|
-
};
|
|
50
|
-
const useDataList = ({
|
|
51
|
-
data = [],
|
|
52
|
-
plugins = [],
|
|
53
|
-
renderers = listRenderers,
|
|
54
|
-
itemRenderer = [],
|
|
55
|
-
customDecorators,
|
|
56
|
-
...props
|
|
57
|
-
}) => {
|
|
58
|
-
const listRef = (0, import_react.useRef)();
|
|
59
|
-
const { instance, decorators } = (0, import_createInstanceRef.createDataInstanceRef)({
|
|
60
|
-
data,
|
|
61
|
-
renderers,
|
|
62
|
-
plugins,
|
|
63
|
-
customDecorators: {
|
|
64
|
-
...customDecorators,
|
|
65
|
-
recordIterator: import_recordIterator.recordIterator,
|
|
66
|
-
getListProps: [],
|
|
67
|
-
getItemProps: [],
|
|
68
|
-
itemRenderer: [...itemRenderer],
|
|
69
|
-
// components reduce to compose item content
|
|
70
|
-
record: [],
|
|
71
|
-
records: []
|
|
72
|
-
},
|
|
73
|
-
...props
|
|
74
|
-
});
|
|
75
|
-
instance.current.getListRef = () => listRef;
|
|
76
|
-
instance.current.setListRef = (ref) => {
|
|
77
|
-
listRef.current = ref;
|
|
78
|
-
};
|
|
79
|
-
instance.current.getItemLabel = (record) => getItemLabel(record, props.nameKey);
|
|
80
|
-
instance.current.getItemChildren = (record) => getItemChildren(record, props.childrenKey);
|
|
81
|
-
instance.current.decorators = decorators;
|
|
82
|
-
instance.current.getListProps = (0, import_utils.reducePropsGetter)(decorators.getListProps, instance.current);
|
|
83
|
-
instance.current.getItemProps = (0, import_utils.reducePropsGetter)(decorators.getItemProps, instance.current);
|
|
84
|
-
instance.current.itemRenderer = (0, import_utils.composeFormatters)(instance.current.decorators.itemRenderer, instance.current);
|
|
85
|
-
instance.current.records = (0, import_react.useMemo)(() => {
|
|
86
|
-
let nextRecords = (0, import_recordIterator.recordIterator)(
|
|
87
|
-
data,
|
|
88
|
-
instance.current.decorators.recordIterator,
|
|
89
|
-
decorators.record,
|
|
90
|
-
instance.current
|
|
91
|
-
);
|
|
92
|
-
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
93
|
-
return nextRecords;
|
|
94
|
-
});
|
|
95
|
-
if (props.instanceRef)
|
|
96
|
-
(0, import_ds_utilities.setRef)(props.instanceRef, instance.current);
|
|
97
|
-
return instance.current;
|
|
98
|
-
};
|
|
99
|
-
var useDataList_default = useDataList;
|
|
100
|
-
//# sourceMappingURL=useDataList.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/useDataList/useDataList.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport { get } from 'lodash';\nimport { composeFormatters, reducePropsGetter } from '../createDataInstance/utils.js';\nimport { recordIterator } from './recordIterator.js';\nimport { createDataInstanceRef } from '../createDataInstance/createInstanceRef.js';\n\nexport const getItemLabel = (record, nameKey = 'name') => get(record, ['data', nameKey]);\nexport const getItemChildren = (record, childrenKey = 'children') => get(record, ['data', childrenKey]);\n\nconst listRenderers = {\n list: 'ul',\n item: 'li',\n};\n\n// todo: check if a plugin is a LIST plugin rather than GRID\nexport const useDataList = ({\n data = [],\n plugins = [],\n renderers = listRenderers,\n itemRenderer = [],\n customDecorators,\n ...props\n}) => {\n const listRef = useRef();\n const { instance, decorators } = createDataInstanceRef({\n data,\n renderers,\n plugins,\n customDecorators: {\n ...customDecorators,\n recordIterator,\n getListProps: [],\n getItemProps: [],\n itemRenderer: [...itemRenderer], // components reduce to compose item content\n record: [],\n records: [],\n },\n ...props,\n });\n instance.current.getListRef = () => listRef;\n instance.current.setListRef = (ref) => {\n listRef.current = ref;\n };\n instance.current.getItemLabel = (record) => getItemLabel(record, props.nameKey);\n instance.current.getItemChildren = (record) => getItemChildren(record, props.childrenKey);\n\n instance.current.decorators = decorators;\n instance.current.getListProps = reducePropsGetter(decorators.getListProps, instance.current);\n instance.current.getItemProps = reducePropsGetter(decorators.getItemProps, instance.current);\n instance.current.itemRenderer = composeFormatters(instance.current.decorators.itemRenderer, instance.current);\n\n instance.current.records = useMemo(() => {\n // record iterator TREE / Simple\n let nextRecords = recordIterator(\n data,\n instance.current.decorators.recordIterator,\n decorators.record,\n instance.current,\n );\n\n // compose all records\n nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);\n\n return nextRecords;\n });\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return instance.current;\n};\n\nexport default useDataList;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAgC;AAChC,0BAAuB;AACvB,oBAAoB;AACpB,mBAAqD;AACrD,4BAA+B;AAC/B,+BAAsC;AAE/B,MAAM,eAAe,CAAC,QAAQ,UAAU,eAAW,mBAAI,QAAQ,CAAC,QAAQ,OAAO,CAAC;AAChF,MAAM,kBAAkB,CAAC,QAAQ,cAAc,mBAAe,mBAAI,QAAQ,CAAC,QAAQ,WAAW,CAAC;AAEtG,MAAM,gBAAgB;AAAA,EACpB,MAAM;AAAA,EACN,MAAM;AACR;AAGO,MAAM,cAAc,CAAC;AAAA,EAC1B,OAAO,CAAC;AAAA,EACR,UAAU,CAAC;AAAA,EACX,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAU,qBAAO;AACvB,QAAM,EAAE,UAAU,WAAW,QAAI,gDAAsB;AAAA,IACrD;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,MAChB,GAAG;AAAA,MACH;AAAA,MACA,cAAc,CAAC;AAAA,MACf,cAAc,CAAC;AAAA,MACf,cAAc,CAAC,GAAG,YAAY;AAAA;AAAA,MAC9B,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACD,WAAS,QAAQ,aAAa,MAAM;AACpC,WAAS,QAAQ,aAAa,CAAC,QAAQ;AACrC,YAAQ,UAAU;AAAA,EACpB;AACA,WAAS,QAAQ,eAAe,CAAC,WAAW,aAAa,QAAQ,MAAM,OAAO;AAC9E,WAAS,QAAQ,kBAAkB,CAAC,WAAW,gBAAgB,QAAQ,MAAM,WAAW;AAExF,WAAS,QAAQ,aAAa;AAC9B,WAAS,QAAQ,mBAAe,gCAAkB,WAAW,cAAc,SAAS,OAAO;AAC3F,WAAS,QAAQ,mBAAe,gCAAkB,WAAW,cAAc,SAAS,OAAO;AAC3F,WAAS,QAAQ,mBAAe,gCAAkB,SAAS,QAAQ,WAAW,cAAc,SAAS,OAAO;AAE5G,WAAS,QAAQ,cAAU,sBAAQ,MAAM;AAEvC,QAAI,kBAAc;AAAA,MAChB;AAAA,MACA,SAAS,QAAQ,WAAW;AAAA,MAC5B,WAAW;AAAA,MACX,SAAS;AAAA,IACX;AAGA,kBAAc,WAAW,QAAQ,OAAO,CAAC,UAAU,WAAW,OAAO,UAAU,SAAS,OAAO,GAAG,WAAW;AAE7G,WAAO;AAAA,EACT,CAAC;AAED,MAAI,MAAM;AAAa,oCAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO,SAAS;AAClB;AAEA,IAAO,sBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/utils.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var utils_exports = {};
|
|
30
|
-
__export(utils_exports, {
|
|
31
|
-
closest: () => closest,
|
|
32
|
-
getAllNonEmptyNodesIds: () => getAllNonEmptyNodesIds,
|
|
33
|
-
getOffsetRect: () => getOffsetRect,
|
|
34
|
-
getTotalScroll: () => getTotalScroll,
|
|
35
|
-
getTransformProps: () => getTransformProps,
|
|
36
|
-
isArray: () => isArray,
|
|
37
|
-
isDefined: () => isDefined,
|
|
38
|
-
isFunction: () => isFunction,
|
|
39
|
-
isInternetExplorer: () => isInternetExplorer,
|
|
40
|
-
isNumber: () => isNumber,
|
|
41
|
-
isString: () => isString,
|
|
42
|
-
isUndefined: () => isUndefined,
|
|
43
|
-
listWithChildren: () => listWithChildren,
|
|
44
|
-
objectType: () => objectType
|
|
45
|
-
});
|
|
46
|
-
module.exports = __toCommonJS(utils_exports);
|
|
47
|
-
var React = __toESM(require("react"));
|
|
48
|
-
const objectType = (obj) => Object.prototype.toString.call(obj).slice(8, -1);
|
|
49
|
-
const isDefined = (param) => typeof param !== "undefined";
|
|
50
|
-
const isUndefined = (param) => typeof param === "undefined";
|
|
51
|
-
const isFunction = (param) => typeof param === "function";
|
|
52
|
-
const isNumber = (param) => typeof param === "number" && !isNaN(param);
|
|
53
|
-
const isString = (str) => objectType(str) === "String";
|
|
54
|
-
const isArray = (arr) => objectType(arr) === "Array";
|
|
55
|
-
const closest = (target, selector) => {
|
|
56
|
-
while (target) {
|
|
57
|
-
if (target.matches && target.matches(selector))
|
|
58
|
-
return target;
|
|
59
|
-
if (target.msMatchesSelector && target.msMatchesSelector(selector))
|
|
60
|
-
return target;
|
|
61
|
-
target = target.parentNode;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
};
|
|
65
|
-
const getOffsetRect = (elem) => {
|
|
66
|
-
const box = elem.getBoundingClientRect();
|
|
67
|
-
const { body, documentElement } = document;
|
|
68
|
-
const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
|
|
69
|
-
const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;
|
|
70
|
-
const clientTop = documentElement.clientTop || body.clientTop || 0;
|
|
71
|
-
const clientLeft = documentElement.clientLeft || body.clientLeft || 0;
|
|
72
|
-
const top = box.top + scrollTop - clientTop;
|
|
73
|
-
const left = box.left + scrollLeft - clientLeft;
|
|
74
|
-
return { top: Math.round(top), left: Math.round(left) };
|
|
75
|
-
};
|
|
76
|
-
const getTotalScroll = (elem) => {
|
|
77
|
-
let top = 0;
|
|
78
|
-
let left = 0;
|
|
79
|
-
while (elem = elem.parentNode) {
|
|
80
|
-
top += elem.scrollTop || 0;
|
|
81
|
-
left += elem.scrollLeft || 0;
|
|
82
|
-
}
|
|
83
|
-
return { top, left };
|
|
84
|
-
};
|
|
85
|
-
const getTransformProps = (x, y) => ({
|
|
86
|
-
transform: `translate(${x}px, ${y}px)`
|
|
87
|
-
});
|
|
88
|
-
const listWithChildren = (list, childrenProp) => list.map((item) => ({
|
|
89
|
-
...item,
|
|
90
|
-
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
91
|
-
}));
|
|
92
|
-
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
93
|
-
let childrenIds = [];
|
|
94
|
-
const ids = items.filter((item) => item[childrenProp].length).map((item) => {
|
|
95
|
-
childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
|
|
96
|
-
return item.id;
|
|
97
|
-
});
|
|
98
|
-
return ids.concat(childrenIds);
|
|
99
|
-
};
|
|
100
|
-
const isInternetExplorer = () => {
|
|
101
|
-
const ua = window.navigator.userAgent;
|
|
102
|
-
const msie = ua.indexOf("MSIE ");
|
|
103
|
-
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./)) {
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/cjs/utils.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-cond-assign */\nexport const objectType = (obj) => Object.prototype.toString.call(obj).slice(8, -1);\nexport const isDefined = (param) => typeof param !== 'undefined';\nexport const isUndefined = (param) => typeof param === 'undefined';\nexport const isFunction = (param) => typeof param === 'function';\nexport const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line\nexport const isString = (str) => objectType(str) === 'String';\nexport const isArray = (arr) => objectType(arr) === 'Array';\n\nexport const closest = (target, selector) => {\n // closest(e.target, '.field')\n while (target) {\n // eslint-disable-line\n if (target.matches && target.matches(selector)) return target;\n if (target.msMatchesSelector && target.msMatchesSelector(selector)) return target;\n // eslint-disable-next-line no-param-reassign\n target = target.parentNode;\n }\n return null;\n};\n\nexport const getOffsetRect = (elem) => {\n // (1)\n const box = elem.getBoundingClientRect();\n\n const { body, documentElement } = document;\n\n // (2)\n const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;\n const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;\n\n // (3)\n const clientTop = documentElement.clientTop || body.clientTop || 0;\n const clientLeft = documentElement.clientLeft || body.clientLeft || 0;\n\n // (4)\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return { top: Math.round(top), left: Math.round(left) };\n};\n\nexport const getTotalScroll = (elem) => {\n let top = 0;\n let left = 0;\n\n // eslint-disable-next-line no-param-reassign\n while ((elem = elem.parentNode)) {\n top += elem.scrollTop || 0;\n left += elem.scrollLeft || 0;\n }\n\n return { top, left };\n};\n\nexport const getTransformProps = (x, y) => ({\n transform: `translate(${x}px, ${y}px)`,\n});\n\nexport const listWithChildren = (list, childrenProp) =>\n list.map((item) => ({\n ...item,\n [childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : [],\n }));\n\nexport const getAllNonEmptyNodesIds = (items, childrenProp) => {\n let childrenIds = [];\n const ids = items\n .filter((item) => item[childrenProp].length)\n .map((item) => {\n childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));\n return item.id;\n });\n\n return ids.concat(childrenIds);\n};\n\nexport const isInternetExplorer = () => {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf('MSIE ');\n // If Internet Explorer, return version number\n if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\\./)) {\n return true;\n }\n return false;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADChB,MAAM,aAAa,CAAC,QAAQ,OAAO,UAAU,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE;AAC3E,MAAM,YAAY,CAAC,UAAU,OAAO,UAAU;AAC9C,MAAM,cAAc,CAAC,UAAU,OAAO,UAAU;AAChD,MAAM,aAAa,CAAC,UAAU,OAAO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,KAAK,YAAY,IAAI,iBAAiB,KAAK,YAAY,GAAG,YAAY,IAAI,CAAC;AAC7F,EAAE;AAEG,MAAM,yBAAyB,CAAC,OAAO,iBAAiB;AAC7D,MAAI,cAAc,CAAC;AACnB,QAAM,MAAM,MACT,OAAO,CAAC,SAAS,KAAK,YAAY,EAAE,MAAM,EAC1C,IAAI,CAAC,SAAS;AACb,kBAAc,YAAY,OAAO,uBAAuB,KAAK,YAAY,GAAG,YAAY,CAAC;AACzF,WAAO,KAAK;AAAA,EACd,CAAC;AAEH,SAAO,IAAI,OAAO,WAAW;AAC/B;AAEO,MAAM,qBAAqB,MAAM;AACtC,QAAM,KAAK,OAAO,UAAU;AAC5B,QAAM,OAAO,GAAG,QAAQ,OAAO;AAE/B,MAAI,OAAO,KAAK,CAAC,CAAC,UAAU,UAAU,MAAM,kBAAkB,GAAG;AAC/D,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var AutoHeightList_exports = {};
|
|
30
|
-
__export(AutoHeightList_exports, {
|
|
31
|
-
AutoHeightList: () => AutoHeightList
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(AutoHeightList_exports);
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react = require("react");
|
|
37
|
-
var import_react_window = require("react-window");
|
|
38
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
39
|
-
const AutoHeightList = (0, import_react.forwardRef)(
|
|
40
|
-
({
|
|
41
|
-
itemCount,
|
|
42
|
-
className,
|
|
43
|
-
innerRef,
|
|
44
|
-
itemData,
|
|
45
|
-
itemKey,
|
|
46
|
-
itemSize,
|
|
47
|
-
outerRef,
|
|
48
|
-
component: ListComponent = import_react_window.FixedSizeList,
|
|
49
|
-
...otherProps
|
|
50
|
-
}, ref) => {
|
|
51
|
-
const listRef = (0, import_react.useRef)();
|
|
52
|
-
const outerListRef = (0, import_react.useRef)();
|
|
53
|
-
(0, import_ds_utilities.useWindowScrollerList)({
|
|
54
|
-
listInstance: listRef,
|
|
55
|
-
outerListRef
|
|
56
|
-
});
|
|
57
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
-
ListComponent,
|
|
59
|
-
{
|
|
60
|
-
...otherProps,
|
|
61
|
-
ref: (0, import_ds_utilities.mergeRefs)(ref, listRef),
|
|
62
|
-
className: (0, import_ds_utilities.cx)(className, "window-scroller-override"),
|
|
63
|
-
height: window.innerHeight,
|
|
64
|
-
innerRef,
|
|
65
|
-
itemCount,
|
|
66
|
-
itemData,
|
|
67
|
-
itemKey,
|
|
68
|
-
itemSize,
|
|
69
|
-
outerRef: (0, import_ds_utilities.mergeRefs)(outerListRef, outerRef),
|
|
70
|
-
overscanCount: 10,
|
|
71
|
-
useIsScrolling: true
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
//# sourceMappingURL=AutoHeightList.js.map
|