@elliemae/ds-shared 3.2.1-rc.3 → 3.2.1-rc.6
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,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import {
|
|
35
4
|
cloneDeep,
|
|
@@ -52,20 +21,14 @@ import {
|
|
|
52
21
|
import { VolatileRowsListener } from "./VolatileRowsListener";
|
|
53
22
|
import { isInternetExplorer } from "../utils";
|
|
54
23
|
const IS_INTERNET_EXPLORER = isInternetExplorer();
|
|
55
|
-
const useDataGrid = (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"uuid",
|
|
64
|
-
"plugins",
|
|
65
|
-
"rows",
|
|
66
|
-
"columns",
|
|
67
|
-
"renderers"
|
|
68
|
-
]);
|
|
24
|
+
const useDataGrid = ({
|
|
25
|
+
uuid: uuidProp,
|
|
26
|
+
plugins: pluginsFromProps,
|
|
27
|
+
rows,
|
|
28
|
+
columns,
|
|
29
|
+
renderers = {},
|
|
30
|
+
...props
|
|
31
|
+
}) => {
|
|
69
32
|
const plugins = pluginsFromProps;
|
|
70
33
|
const instance = useRef();
|
|
71
34
|
const tableRef = useRef();
|
|
@@ -149,18 +112,30 @@ const useDataGrid = (_a) => {
|
|
|
149
112
|
plugins.forEach((plugin) => nextDecorators = plugin(nextDecorators));
|
|
150
113
|
return nextDecorators;
|
|
151
114
|
}, [plugins]);
|
|
152
|
-
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) =>
|
|
115
|
+
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => ({
|
|
116
|
+
...nextInstance,
|
|
117
|
+
...decorator(instance.current)
|
|
118
|
+
}), instance.current);
|
|
153
119
|
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
154
120
|
const { state, actions } = decorator(instance.current);
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
121
|
+
return {
|
|
122
|
+
...nextInstance,
|
|
123
|
+
state: {
|
|
124
|
+
...nextInstance.state,
|
|
125
|
+
...state
|
|
126
|
+
},
|
|
127
|
+
actions: {
|
|
128
|
+
...nextInstance.actions,
|
|
129
|
+
...actions
|
|
130
|
+
}
|
|
131
|
+
};
|
|
159
132
|
}, instance.current);
|
|
160
|
-
const reduceHotKey = (nextInstance, { key, handler, options }) =>
|
|
161
|
-
|
|
133
|
+
const reduceHotKey = (nextInstance, { key, handler, options }) => ({
|
|
134
|
+
...nextInstance,
|
|
135
|
+
hotKeys: {
|
|
136
|
+
...nextInstance.hotKeys,
|
|
162
137
|
[key]: { handler, options }
|
|
163
|
-
}
|
|
138
|
+
}
|
|
164
139
|
});
|
|
165
140
|
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
166
141
|
const hotKeys = decorator(nextInstance);
|
|
@@ -190,9 +165,10 @@ const useDataGrid = (_a) => {
|
|
|
190
165
|
}
|
|
191
166
|
if (props.instanceRef)
|
|
192
167
|
setRef(props.instanceRef, instance.current);
|
|
193
|
-
return
|
|
168
|
+
return {
|
|
169
|
+
...instance.current,
|
|
194
170
|
decorators
|
|
195
|
-
}
|
|
171
|
+
};
|
|
196
172
|
};
|
|
197
173
|
var useDataGrid_default = useDataGrid;
|
|
198
174
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/useDataGrid/useDataGrid.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAKA;AACA;AAEA,MAAM,uBAAuB,mBAAmB;AAKzC,MAAM,cAAc,CAAC;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,YAAY,CAAC;AAAA,KACV;AAAA,MACC;AACJ,QAAM,UAAU;AAChB,QAAM,WAAW,OAAO;AACxB,QAAM,WAAW,OAAO;AACxB,QAAM,YAAY,OAAO;AACzB,QAAM,UAAU,OAAO;AACvB,QAAM,eAAe,OAAO;AAC5B,QAAM,CAAC,QAAQ,SAAS,YAAa,OAAM,OAAO,EAAE;AACpD,QAAM,CAAC,WAAW,gBA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AC,QACxC,WACA,SAAS,QAAQ,KACnB;AAAA,EACF;AAEA,MAAI,MAAM;AAAa,WAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO;AAAA,IACL,GAAG,SAAS;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import { useMemo, useRef } from "react";
|
|
35
4
|
import { setRef } from "@elliemae/ds-utilities";
|
|
@@ -46,34 +15,30 @@ const listRenderers = {
|
|
|
46
15
|
list: "ul",
|
|
47
16
|
item: "li"
|
|
48
17
|
};
|
|
49
|
-
const useDataList = (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"data",
|
|
58
|
-
"plugins",
|
|
59
|
-
"renderers",
|
|
60
|
-
"itemRenderer",
|
|
61
|
-
"customDecorators"
|
|
62
|
-
]);
|
|
18
|
+
const useDataList = ({
|
|
19
|
+
data = [],
|
|
20
|
+
plugins = [],
|
|
21
|
+
renderers = listRenderers,
|
|
22
|
+
itemRenderer = [],
|
|
23
|
+
customDecorators,
|
|
24
|
+
...props
|
|
25
|
+
}) => {
|
|
63
26
|
const listRef = useRef();
|
|
64
|
-
const { instance, decorators } = createDataInstanceRef(
|
|
27
|
+
const { instance, decorators } = createDataInstanceRef({
|
|
65
28
|
data,
|
|
66
29
|
renderers,
|
|
67
30
|
plugins,
|
|
68
|
-
customDecorators:
|
|
31
|
+
customDecorators: {
|
|
32
|
+
...customDecorators,
|
|
69
33
|
recordIterator,
|
|
70
34
|
getListProps: [],
|
|
71
35
|
getItemProps: [],
|
|
72
36
|
itemRenderer: [...itemRenderer],
|
|
73
37
|
record: [],
|
|
74
38
|
records: []
|
|
75
|
-
}
|
|
76
|
-
|
|
39
|
+
},
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
77
42
|
instance.current.getListRef = () => listRef;
|
|
78
43
|
instance.current.setListRef = (ref) => {
|
|
79
44
|
listRef.current = ref;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/useDataList/useDataList.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport get from 'lodash/get';\nimport {\n composeFormatters,\n reducePropsGetter,\n} from '../createDataInstance/utils';\nimport { recordIterator } from './recordIterator';\nimport { createDataInstanceRef } from '../createDataInstance/createInstanceRef';\n\nexport const getItemLabel = (record, nameKey = 'name') =>\n get(record, ['data', nameKey]);\nexport const getItemChildren = (record, childrenKey = 'children') =>\n 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) =>\n getItemLabel(record, props.nameKey);\n instance.current.getItemChildren = (record) =>\n getItemChildren(record, props.childrenKey);\n\n instance.current.decorators = decorators;\n instance.current.getListProps = reducePropsGetter(\n decorators.getListProps,\n instance.current,\n );\n instance.current.getItemProps = reducePropsGetter(\n decorators.getItemProps,\n instance.current,\n );\n instance.current.itemRenderer = composeFormatters(\n instance.current.decorators.itemRenderer,\n instance.current,\n );\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(\n (nextRows, getter) => getter(nextRows, instance.current),\n nextRecords,\n );\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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAIA;AACA;AAEO,MAAM,eAAe,CAAC,QAAQ,UAAU,WAC7C,IAAI,QAAQ,CAAC,QAAQ,OAAO,CAAC;AACxB,MAAM,kBAAkB,CAAC,QAAQ,cAAc,eACpD,IAAI,QAAQ,CAAC,QAAQ,WAAW,CAAC;AAEnC,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,KACG;AAAA,MACC;AACJ,QAAM,UAAU,OAAO;AACvB,QAAM,EAAE,UAAU,eAAe,sBAAsB;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,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,WAC/B,aAAa,QAAQ,MAAM,OAAO;AACpC,WAAS,QAAQ,kBAAkB,CAAC,WAClC,gBAAgB,QAAQ,MAAM,WAAW;AAE3C,WAAS,QAAQ,aAAa;AAC9B,WAAS,QAAQ,eAAe,kBAC9B,WAAW,cACX,SAAS,OACX;AACA,WAAS,QAAQ,eAAe,kBAC9B,WAAW,cACX,SAAS,OACX;AACA,WAAS,QAAQ,eAAe,kBAC9B,SAAS,QAAQ,WAAW,cAC5B,SAAS,OACX;AAEA,WAAS,QAAQ,UAAU,QAAQ,MAAM;AAEvC,QAAI,cAAc,eAChB,MACA,SAAS,QAAQ,WAAW,gBAC5B,WAAW,QACX,SAAS,OACX;AAGA,kBAAc,WAAW,QAAQ,OAC/B,CAAC,UAAU,WAAW,OAAO,UAAU,SAAS,OAAO,GACvD,WACF;AAEA,WAAO;AAAA,EACT,CAAC;AAED,MAAI,MAAM;AAAa,WAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO,SAAS;AAClB;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
const objectType = (obj) => Object.prototype.toString.call(obj).slice(8, -1);
|
|
23
4
|
const isDefined = (param) => typeof param !== "undefined";
|
|
@@ -59,7 +40,8 @@ const getTotalScroll = (elem) => {
|
|
|
59
40
|
const getTransformProps = (x, y) => ({
|
|
60
41
|
transform: `translate(${x}px, ${y}px)`
|
|
61
42
|
});
|
|
62
|
-
const listWithChildren = (list, childrenProp) => list.map((item) =>
|
|
43
|
+
const listWithChildren = (list, childrenProp) => list.map((item) => ({
|
|
44
|
+
...item,
|
|
63
45
|
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
64
46
|
}));
|
|
65
47
|
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-cond-assign */\nexport const objectType = (obj) =>\n 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))\n 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 =\n window.pageYOffset || documentElement.scrollTop || body.scrollTop;\n const scrollLeft =\n 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]\n ? listWithChildren(item[childrenProp], childrenProp)\n : [],\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(\n getAllNonEmptyNodesIds(item[childrenProp], childrenProp),\n );\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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCO,MAAM,aAAa,CAAC,QACzB,OAAO,UAAU,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE;AAC1C,MAAM,YAAY,CAAC,UAAU,OAAO,UAAU;AAC9C,MAAM,cAAc,CAAC,UAAU,OAAO,UAAU;AAChD,MAAM,aAAa,CAAC,UAAU,OAAO,UAAU;AAC/C,MAAM,WAAW,WAAS,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK;AACnE,MAA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AAO,iBAAiB;AAC7D,MAAI,cAAc,CAAC;AACnB,QAAM,MAAM,MACT,OAAO,CAAC,SAAS,KAAK,cAAc,MAAM,EAC1C,IAAI,CAAC,SAAS;AACb,kBAAc,YAAY,OACxB,uBAAuB,KAAK,eAAe,YAAY,CACzD;AACA,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,66 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2, { forwardRef, useRef } from "react";
|
|
35
4
|
import { FixedSizeList as List } from "react-window";
|
|
36
5
|
import { cx, useWindowScrollerList, mergeRefs } from "@elliemae/ds-utilities";
|
|
37
|
-
const AutoHeightList = forwardRef((
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"itemCount",
|
|
49
|
-
"className",
|
|
50
|
-
"innerRef",
|
|
51
|
-
"itemData",
|
|
52
|
-
"itemKey",
|
|
53
|
-
"itemSize",
|
|
54
|
-
"outerRef",
|
|
55
|
-
"component"
|
|
56
|
-
]);
|
|
6
|
+
const AutoHeightList = forwardRef(({
|
|
7
|
+
itemCount,
|
|
8
|
+
className,
|
|
9
|
+
innerRef,
|
|
10
|
+
itemData,
|
|
11
|
+
itemKey,
|
|
12
|
+
itemSize,
|
|
13
|
+
outerRef,
|
|
14
|
+
component: ListComponent = List,
|
|
15
|
+
...otherProps
|
|
16
|
+
}, ref) => {
|
|
57
17
|
const listRef = useRef();
|
|
58
18
|
const outerListRef = useRef();
|
|
59
19
|
useWindowScrollerList({
|
|
60
20
|
listInstance: listRef,
|
|
61
21
|
outerListRef
|
|
62
22
|
});
|
|
63
|
-
return /* @__PURE__ */ React2.createElement(ListComponent,
|
|
23
|
+
return /* @__PURE__ */ React2.createElement(ListComponent, {
|
|
24
|
+
...otherProps,
|
|
64
25
|
ref: mergeRefs(ref, listRef),
|
|
65
26
|
className: cx(className, "window-scroller-override"),
|
|
66
27
|
height: window.innerHeight,
|
|
@@ -72,7 +33,7 @@ const AutoHeightList = forwardRef((_a, ref) => {
|
|
|
72
33
|
outerRef: mergeRefs(outerListRef, outerRef),
|
|
73
34
|
overscanCount: 10,
|
|
74
35
|
useIsScrolling: true
|
|
75
|
-
})
|
|
36
|
+
});
|
|
76
37
|
});
|
|
77
38
|
export {
|
|
78
39
|
AutoHeightList
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/virtualization/AutoHeightList.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { forwardRef, useRef } from 'react';\nimport { FixedSizeList as List } from 'react-window';\nimport { cx, useWindowScrollerList, mergeRefs } from '@elliemae/ds-utilities';\n\nexport const AutoHeightList = forwardRef(\n (\n {\n itemCount,\n className,\n innerRef,\n itemData,\n itemKey,\n itemSize,\n outerRef,\n component: ListComponent = List,\n ...otherProps\n },\n ref,\n ) => {\n const listRef = useRef();\n const outerListRef = useRef();\n\n useWindowScrollerList({\n listInstance: listRef,\n outerListRef,\n });\n\n return (\n <ListComponent\n {...otherProps}\n ref={mergeRefs(ref, listRef)}\n className={cx(className, 'window-scroller-override')}\n height={window.innerHeight}\n innerRef={innerRef}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={itemKey}\n itemSize={itemSize}\n outerRef={mergeRefs(outerListRef, outerRef)}\n overscanCount={10}\n useIsScrolling\n />\n );\n },\n);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAEO,MAAM,iBAAiB,WAC5B,CACE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,gBAAgB;AAAA,KACxB;AAAA,GAEL,QACG;AACH,QAAM,UAAU,OAAO;AACvB,QAAM,eAAe,OAAO;AAE5B,wBAAsB;AAAA,IACpB,cAAc;AAAA,IACd;AAAA,EACF,CAAC;AAED,SACE,qCAAC;AAAA,IACE,GAAG;AAAA,IACJ,KAAK,UAAU,KAAK,OAAO;AAAA,IAC3B,WAAW,GAAG,WAAW,0BAA0B;AAAA,IACnD,QAAQ,OAAO;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,UAAU,cAAc,QAAQ;AAAA,IAC1C,eAAe;AAAA,IACf,gBAAc;AAAA,GAChB;AAEJ,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,47 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2, { forwardRef } from "react";
|
|
35
4
|
import AutoSizer from "react-virtualized-auto-sizer";
|
|
36
|
-
const FluidHeightList = forwardRef((
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})));
|
|
44
|
-
});
|
|
5
|
+
const FluidHeightList = forwardRef(({ component: Component, ...props }, ref) => /* @__PURE__ */ React2.createElement(AutoSizer, {
|
|
6
|
+
disableWidth: true
|
|
7
|
+
}, ({ height: fluidHeight }) => /* @__PURE__ */ React2.createElement(Component, {
|
|
8
|
+
...props,
|
|
9
|
+
ref,
|
|
10
|
+
height: fluidHeight - 32
|
|
11
|
+
})));
|
|
45
12
|
export {
|
|
46
13
|
FluidHeightList
|
|
47
14
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/virtualization/FluidHeightList.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { forwardRef } from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nexport const FluidHeightList = forwardRef(\n ({ component: Component, ...props }, ref) => (\n <AutoSizer disableWidth>\n {({ height: fluidHeight }) => (\n <Component\n {...props}\n ref={ref}\n height={fluidHeight - 32} // taking in count the margins of the list\n />\n )}\n </AutoSizer>\n ),\n);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AAEO,MAAM,kBAAkB,WAC7B,CAAC,EAAE,WAAW,cAAc,SAAS,QACnC,qCAAC;AAAA,EAAU,cAAY;AAAA,GACpB,CAAC,EAAE,QAAQ,kBACV,qCAAC;AAAA,EACE,GAAG;AAAA,EACJ;AAAA,EACA,QAAQ,cAAc;AAAA,CACxB,CAEJ,CAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-shared",
|
|
3
|
-
"version": "3.2.1-rc.
|
|
3
|
+
"version": "3.2.1-rc.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Shared components and utilities",
|
|
6
6
|
"files": [
|
|
@@ -215,8 +215,8 @@
|
|
|
215
215
|
"typeSafety": false
|
|
216
216
|
},
|
|
217
217
|
"dependencies": {
|
|
218
|
-
"@elliemae/ds-popover": "3.2.1-rc.
|
|
219
|
-
"@elliemae/ds-utilities": "3.2.1-rc.
|
|
218
|
+
"@elliemae/ds-popover": "3.2.1-rc.6",
|
|
219
|
+
"@elliemae/ds-utilities": "3.2.1-rc.6",
|
|
220
220
|
"hoist-non-react-statics": "~3.3.2",
|
|
221
221
|
"hotkeys-js": "~3.9.3",
|
|
222
222
|
"prop-types": "~15.8.1",
|