@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,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
|
import React2, { Component } from "react";
|
|
23
4
|
import { ScrollSyncContext } from "./ScrollSync";
|
|
@@ -52,9 +33,10 @@ ScrollSyncPane.defaultProps = {
|
|
|
52
33
|
group: "default",
|
|
53
34
|
enabled: true
|
|
54
35
|
};
|
|
55
|
-
const ScrollSyncPaneHOC = (props) => /* @__PURE__ */ React2.createElement(ScrollSyncContext.Consumer, null, (context) => /* @__PURE__ */ React2.createElement(ScrollSyncPane,
|
|
36
|
+
const ScrollSyncPaneHOC = (props) => /* @__PURE__ */ React2.createElement(ScrollSyncContext.Consumer, null, (context) => /* @__PURE__ */ React2.createElement(ScrollSyncPane, {
|
|
37
|
+
...props,
|
|
56
38
|
syncContext: context
|
|
57
|
-
}))
|
|
39
|
+
}));
|
|
58
40
|
var ScrollSyncPane_default = ScrollSyncPaneHOC;
|
|
59
41
|
export {
|
|
60
42
|
ScrollSyncPaneHOC,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/ScrollSync/ScrollSyncPane.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/display-name */\nimport React, { Component } from 'react';\nimport { ScrollSyncContext } from './ScrollSync';\n\n/**\n * MODIFIED FROM react-scroll-sync\n *\n * ScrollSyncPane Component\n *\n * Wrap your content in it to keep its scroll position in sync with other panes\n *\n * @param groups\n * @example ./example.md\n */\nclass ScrollSyncPane extends Component {\n static defaultProps = {\n group: 'default',\n enabled: true,\n };\n\n componentWillUnmount() {\n const { enabled, group, syncContext } = this.props;\n const { unregisterPane } = syncContext;\n\n if (enabled) unregisterPane(this.node, this.toArray(group));\n }\n\n toArray = groups => [].concat(groups);\n\n render() {\n const { children, group, syncContext, notPaginated } = this.props;\n const { registerPane } = syncContext;\n\n return children({\n registerPane: node => {\n if (notPaginated) {\n const virtualizedBody = node.querySelector(\n '.virtualized-body-wrapper',\n );\n if (virtualizedBody) {\n registerPane(virtualizedBody, this.toArray(group));\n }\n }\n return registerPane(node, this.toArray(group));\n },\n });\n }\n}\n\nexport const ScrollSyncPaneHOC = props => (\n <ScrollSyncContext.Consumer>\n {context => <ScrollSyncPane {...props} syncContext={context} />}\n </ScrollSyncContext.Consumer>\n);\n\nexport default ScrollSyncPaneHOC;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AACA;AAYA,MAAM,uBAAuB,UAAU;AAAA,EAAvC;AAAA;AAaE,mBAAU,YAAU,CAAC,EAAE,OAAO,MAAM;AAAA;AAAA,EAPpC,uBAAuB;AACrB,UAAM,EAAE,SAAS,OAAO,gBAAgB,KAAK;AAC7C,UAAM,EAAE,mBAAmB;AAE3B,QAAI;AAAS,qBAAe,KAAK,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,EAC5D;AAAA,EAIA,SAAS;AACP,UAAM,EAAE,UAAU,OAAO,aAAa,iBAAiB,KAAK;AAC5D,UAAM,EAAE,iBAAiB;AAEzB,WAAO,SAAS;AAAA,MACd,cAAc,UAAQ;AACpB,YAAI,cAAc;AAChB,gBAAM,kBAAkB,KAAK,cAC3B,2BACF;AACA,cAAI,iBAAiB;AACnB,yBAAa,iBAAiB,KAAK,QAAQ,KAAK,CAAC;AAAA,UACnD;AAAA,QACF;AACA,eAAO,aAAa,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,MAC/C;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAhCE,AADI,eACG,eAAe;AAAA,EACpB,OAAO;AAAA,EACP,SAAS;AACX;AA+BK,MAAM,oBAAoB,WAC/B,qCAAC,kBAAkB,UAAlB,MACE,aAAW,qCAAC;AAAA,EAAgB,GAAG;AAAA,EAAO,aAAa;AAAA,CAAS,CAC/D;AAGF,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
const getDecoratorsFromHooks = (hooks, decorators) => {
|
|
20
|
-
const nextDecorators =
|
|
4
|
+
const nextDecorators = { ...decorators };
|
|
21
5
|
Object.keys(hooks).forEach((decorator) => {
|
|
22
6
|
if (Array.isArray(decorators[decorator])) {
|
|
23
7
|
nextDecorators[decorator] = [...decorators[decorator], hooks[decorator]];
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/createDataInstance/createInstancePlugin.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "const getDecoratorsFromHooks = (hooks, decorators) => {\n const nextDecorators = { ...decorators };\n\n Object.keys(hooks).forEach((decorator) => {\n if (Array.isArray(decorators[decorator])) {\n nextDecorators[decorator] = [...decorators[decorator], hooks[decorator]];\n } else {\n nextDecorators[decorator] = hooks[decorator];\n }\n });\n\n return nextDecorators;\n};\n\nexport const createInstancePlugin = (name, hooks) => (decorators) => getDecoratorsFromHooks(hooks, decorators);\n\nexport default createInstancePlugin;\n\nexport { getDecoratorsFromHooks };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA,MAAM,yBAAyB,CAAC,OAAO,eAAe;AACpD,QAAM,iBAAiB,EAAE,GAAG,WAAW;AAEvC,SAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,cAAc;AACxC,QAAI,MAAM,QAAQ,WAAW,UAAU,GAAG;AACxC,qBAAe,aAAa,CAAC,GAAG,WAAW,YAAY,MAAM,UAAU;AAAA,IACzE,OAAO;AACL,qBAAe,aAAa,MAAM;AAAA,IACpC;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEO,MAAM,uBAAuB,CAAC,MAAM,UAAU,CAAC,eAAe,uBAAuB,OAAO,UAAU;AAE7G,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,32 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import { v4 as uuidv4 } from "uuid";
|
|
32
4
|
import { useMemo, useRef, useState } from "react";
|
|
@@ -43,20 +15,14 @@ const defaultDecorators = {
|
|
|
43
15
|
renderers: [],
|
|
44
16
|
composeData: []
|
|
45
17
|
};
|
|
46
|
-
function createDataInstanceRef(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"uuid",
|
|
55
|
-
"data",
|
|
56
|
-
"renderers",
|
|
57
|
-
"plugins",
|
|
58
|
-
"customDecorators"
|
|
59
|
-
]);
|
|
18
|
+
function createDataInstanceRef({
|
|
19
|
+
uuid: uuidProp,
|
|
20
|
+
data,
|
|
21
|
+
renderers,
|
|
22
|
+
plugins,
|
|
23
|
+
customDecorators,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
60
26
|
const instance = useRef();
|
|
61
27
|
const [uuid] = useState(uuidProp || (() => uuidv4()));
|
|
62
28
|
instance.current = {
|
|
@@ -76,7 +42,7 @@ function createDataInstanceRef(_a) {
|
|
|
76
42
|
props
|
|
77
43
|
};
|
|
78
44
|
const decorators = useMemo(() => {
|
|
79
|
-
let nextDecorators =
|
|
45
|
+
let nextDecorators = { ...defaultDecorators, ...customDecorators };
|
|
80
46
|
plugins.forEach((plugin) => {
|
|
81
47
|
if (!plugin)
|
|
82
48
|
return;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/createDataInstance/createInstanceRef.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { v4 as uuidv4 } from 'uuid';\nimport { useMemo, useRef, useState } from 'react';\nimport { orderBy } from 'lodash';\nimport {\n mergeInstance,\n registerHotKeysHookToInstance,\n registerStateHookToInstance,\n} from './utils';\n\nconst defaultDecorators = {\n instance: [],\n state: [],\n hotKeys: [],\n renderers: [],\n composeData: [],\n};\n\nfunction createDataInstanceRef({\n uuid: uuidProp,\n data,\n renderers,\n plugins,\n customDecorators,\n ...props\n}) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const instance = useRef();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [uuid] = useState(uuidProp || (() => uuidv4()));\n\n instance.current = {\n uuid,\n state: {},\n actions: {},\n hotKeys: {}, // keyboard hotkeys to run specific actions\n originalData: data,\n records: [], // item abstraction with meta data for originalData\n renderers,\n ref(key) {\n // eslint-disable-next-line no-return-assign\n return (node) => (instance.current.refs[key] = node);\n },\n getInstance() {\n return instance.current;\n },\n props,\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const decorators = useMemo(() => {\n let nextDecorators = { ...defaultDecorators, ...customDecorators };\n\n plugins.forEach((plugin) => {\n if (!plugin) return;\n nextDecorators = plugin(nextDecorators);\n });\n\n Object.keys(nextDecorators).forEach((key) => {\n if (Array.isArray(nextDecorators[key]))\n nextDecorators[key] = orderBy(\n nextDecorators[key],\n (item) => item.order,\n );\n });\n\n return nextDecorators;\n }, []); // the plugins are defined on creation, but not changed at runtime\n\n // todo: test if getting the hooks without registering them\n // here would be beneficial to memoize instance and squeeze performance\n instance.current = decorators.instance.reduce(\n mergeInstance,\n instance.current,\n );\n instance.current = decorators.state.reduce(\n registerStateHookToInstance,\n instance.current,\n );\n instance.current = decorators.hotKeys.reduce(\n registerHotKeysHookToInstance,\n instance.current,\n );\n instance.current.renderers = decorators.renderers.reduce(\n (result, decorator) => decorator(result, instance.current),\n renderers,\n );\n\n return { instance, decorators };\n}\n\nexport { createDataInstanceRef };\nexport default createDataInstanceRef;"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAMA,MAAM,oBAAoB;AAAA,EACxB,UAAU,CAAC;AAAA,EACX,O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AE,UAAU,WAAW;AAChC;AAGA,IAAO,4BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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 reducePropsGetter = (decorators = [], grid) => (props = {}, extraParams) => {
|
|
23
4
|
let nextProps = props;
|
|
@@ -44,18 +25,30 @@ const decorateColumns = (columns, decorators, grid) => {
|
|
|
44
25
|
const nextColumns = applyDecorators(columns, decorators.decorateColumns, grid);
|
|
45
26
|
return nextColumns.map((column, index) => applyDecorators(column, decorators.decorateColumn, grid, index));
|
|
46
27
|
};
|
|
47
|
-
const mergeInstance = (instance, instanceHook) =>
|
|
28
|
+
const mergeInstance = (instance, instanceHook) => ({
|
|
29
|
+
...instance,
|
|
30
|
+
...instanceHook(instance)
|
|
31
|
+
});
|
|
48
32
|
const registerStateHookToInstance = (instance, stateHook) => {
|
|
49
33
|
const { state, actions } = stateHook(instance);
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
return {
|
|
35
|
+
...instance,
|
|
36
|
+
state: {
|
|
37
|
+
...instance.state,
|
|
38
|
+
...state
|
|
39
|
+
},
|
|
40
|
+
actions: {
|
|
41
|
+
...instance.actions,
|
|
42
|
+
...actions
|
|
43
|
+
}
|
|
44
|
+
};
|
|
54
45
|
};
|
|
55
|
-
const reduceHotKey = (instance, { key, handler, options, allowDocumentHandler }) =>
|
|
56
|
-
|
|
46
|
+
const reduceHotKey = (instance, { key, handler, options, allowDocumentHandler }) => ({
|
|
47
|
+
...instance,
|
|
48
|
+
hotKeys: {
|
|
49
|
+
...instance.hotKeys,
|
|
57
50
|
[key]: { handler, options, allowDocumentHandler }
|
|
58
|
-
}
|
|
51
|
+
}
|
|
59
52
|
});
|
|
60
53
|
const registerHotKeysHookToInstance = (instance, hotKeysHook) => {
|
|
61
54
|
const hotKeys = hotKeysHook(instance);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/createDataInstance/utils.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const reducePropsGetter = (decorators = [], grid) => (\n props = {},\n extraParams,\n) => {\n let nextProps = props;\n decorators.forEach((decorator) => {\n nextProps = decorator(nextProps, grid, extraParams);\n });\n return nextProps;\n};\n\n/* eslint-disable-next-line max-params */\nexport function evaluateTransforms(\n transforms,\n value,\n extraParams = {},\n props = {},\n grid,\n) {\n let nextProps = props;\n transforms.forEach((transform) => {\n nextProps = transform(value, extraParams, nextProps, grid);\n });\n return nextProps;\n}\n\n/* eslint-disable-next-line max-params */\nexport function evaluateFormatters(formatters, value, extraParams = {}, grid) {\n return formatters.reduce(\n (result, formatter) => formatter(result, extraParams, grid),\n value,\n );\n}\n\nexport function composeFormatters(\n formatters,\n instance,\n getItemValue = (record) => record.data.name,\n) {\n // todo: make the formatters subscribe to the item props instead of getting the whole instance\n // todo: addd should formatter update to memoize specific ones\n return (props) =>\n formatters.reduce(\n (result, formatter) => formatter(result, props, instance),\n getItemValue(props.record),\n );\n}\n\nexport const applyDecorators = (subject, decorators = [], ...args) =>\n decorators.reduce(\n (nextSubject, decorator) => decorator(nextSubject, ...args),\n subject,\n );\n\nexport const decorateColumns = (columns, decorators, grid) => {\n const nextColumns = applyDecorators(\n columns,\n decorators.decorateColumns,\n grid,\n );\n return nextColumns.map((column, index) =>\n applyDecorators(column, decorators.decorateColumn, grid, index),\n );\n};\n\nexport const mergeInstance = (instance, instanceHook) => ({\n ...instance,\n ...instanceHook(instance),\n});\n\nexport const registerStateHookToInstance = (instance, stateHook) => {\n const { state, actions } = stateHook(instance);\n return {\n ...instance,\n state: {\n ...instance.state,\n ...state,\n },\n actions: {\n ...instance.actions,\n ...actions,\n },\n };\n};\n\nconst reduceHotKey = (\n instance,\n { key, handler, options, allowDocumentHandler },\n) => ({\n ...instance,\n hotKeys: {\n ...instance.hotKeys,\n [key]: { handler, options, allowDocumentHandler },\n },\n});\n\nexport const registerHotKeysHookToInstance = (instance, hotKeysHook) => {\n const hotKeys = hotKeysHook(instance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, instance);\n }\n return reduceHotKey(instance, hotKeys);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAO,MAAM,oBAAoB,CAAC,aAAa,CAAC,GAAG,SAAS,CAC1D,QAAQ,CAAC,GACT,gBACG;AACH,MAAI,YAAY;AAChB,aAAW,QAAQ,CAAC,cAAc;AAChC,gBAAY,UAAU,WAAW,MAAM,WAAW;AAAA,EACpD,CAAC;AACD,SAAO;AACT;AAGO,4BACL,YACA,OACA,cAAc,CAAC,GACf,QAAQ,CAAC,GACT,MACA;AAC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IACZ,CAAC,MAAM,EAAE,SAAS,SAAS,qBAAqB;AAAA,EAClD;AACF;AAEO,MAAM,gCAAgC,CAAC,UAAU,gBAAgB;AACtE,QAAM,UAAU,YAAY,QAAQ;AACpC,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAO,QAAQ,OAAO,cAAc,QAAQ;AAAA,EAC9C;AACA,SAAO,aAAa,UAAU,OAAO;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import React2, { PureComponent } from "react";
|
|
20
4
|
import raf from "raf";
|
|
@@ -29,7 +13,9 @@ const deferComponentRender = (WrappedComponent, fallback) => {
|
|
|
29
13
|
raf(() => raf(() => this.setState({ shouldRender: true })));
|
|
30
14
|
}
|
|
31
15
|
render() {
|
|
32
|
-
return this.state.shouldRender ? /* @__PURE__ */ React2.createElement(WrappedComponent,
|
|
16
|
+
return this.state.shouldRender ? /* @__PURE__ */ React2.createElement(WrappedComponent, {
|
|
17
|
+
...this.props
|
|
18
|
+
}) : fallback;
|
|
33
19
|
}
|
|
34
20
|
}
|
|
35
21
|
return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/defer-render-hoc/index.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { PureComponent } from 'react';\nimport raf from 'raf';\nimport hoistNonReactStatic from 'hoist-non-react-statics';\n\n/**\n * Allows two animation frames to complete to allow other components to update\n * and re-render before mounting and rendering an expensive `WrappedComponent`.\n *\n * @param WrappedComponent\n * @param fallback\n */\nexport const deferComponentRender = (WrappedComponent, fallback) => {\n class DeferredRenderWrapper extends PureComponent {\n state = { shouldRender: false };\n\n componentDidMount() {\n raf(() => raf(() => this.setState({ shouldRender: true })));\n }\n\n render() {\n // eslint-disable-next-line react/destructuring-assignment\n return this.state.shouldRender ? (\n <WrappedComponent {...this.props} />\n ) : (\n fallback\n );\n }\n }\n\n return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);\n};\n\nexport default deferComponentRender;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AASO,MAAM,uBAAuB,CAAC,kBAAkB,aAAa;AAClE,QAAM,8BAA8B,cAAc;AAAA,IAAlD;AAAA;AACE,mBAAQ,EAAE,cAAc,MAAM;AAAA;AAAA,IAE9B,oBAAoB;AAClB,UAAI,MAAM,IAAI,MAAM,KAAK,SAAS,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC;AAAA,IAC5D;AAAA,IAEA,SAAS;AAEP,aAAO,KAAK,MAAM,eAChB,qCAAC;AAAA,QAAkB,GAAG,KAAK;AAAA,OAAO,IAElC;AAAA,IAEJ;AAAA,EACF;AAEA,SAAO,oBAAoB,uBAAuB,gBAAgB;AACpE;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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
|
import React2, { useMemo, useRef, useState, useEffect, memo } from "react";
|
|
23
4
|
import { DSPopover } from "@elliemae/ds-popover";
|
|
@@ -41,15 +22,17 @@ const ToolbarProvider = memo(({ delay = 200, children, onHide = noop, onShow = n
|
|
|
41
22
|
const show = (state) => {
|
|
42
23
|
if (state.reference === tooltipState.reference)
|
|
43
24
|
clearTimeout(hideTimer.current);
|
|
44
|
-
showTimer.current = setTimeout(() => setTooltipState(
|
|
25
|
+
showTimer.current = setTimeout(() => setTooltipState({
|
|
26
|
+
...state,
|
|
45
27
|
visible: true
|
|
46
|
-
})
|
|
28
|
+
}), delay);
|
|
47
29
|
onShow();
|
|
48
30
|
};
|
|
49
31
|
const hide = (e, force) => {
|
|
50
32
|
if (!force)
|
|
51
33
|
clearTimeout(showTimer.current);
|
|
52
|
-
hideTimer.current = setTimeout(() => setTooltipState((prevState) =>
|
|
34
|
+
hideTimer.current = setTimeout(() => setTooltipState((prevState) => ({
|
|
35
|
+
...prevState,
|
|
53
36
|
visible: false
|
|
54
37
|
})), 100);
|
|
55
38
|
onHide(tooltipState, e);
|
|
@@ -74,9 +57,9 @@ const ToolbarProvider = memo(({ delay = 200, children, onHide = noop, onShow = n
|
|
|
74
57
|
}), [tooltipState.reference]);
|
|
75
58
|
return /* @__PURE__ */ React2.createElement(Provider, {
|
|
76
59
|
value
|
|
77
|
-
}, children, /* @__PURE__ */ React2.createElement(DSPopover,
|
|
78
|
-
boundaries: "scrollParent"
|
|
79
|
-
|
|
60
|
+
}, children, /* @__PURE__ */ React2.createElement(DSPopover, {
|
|
61
|
+
boundaries: "scrollParent",
|
|
62
|
+
...tooltipState.options || {},
|
|
80
63
|
content: tooltipState.renderer,
|
|
81
64
|
placement: "left",
|
|
82
65
|
referenceEl: tooltipState.reference,
|
|
@@ -89,7 +72,7 @@ const ToolbarProvider = memo(({ delay = 200, children, onHide = noop, onShow = n
|
|
|
89
72
|
}, Content)),
|
|
90
73
|
style: tooltipState.style,
|
|
91
74
|
visible: tooltipState.visible
|
|
92
|
-
}))
|
|
75
|
+
}));
|
|
93
76
|
});
|
|
94
77
|
var ToolbarProvider_default = ToolbarProvider;
|
|
95
78
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/toolbar/ToolbarProvider.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useRef, useState, useEffect, memo } from 'react';\nimport { DSPopover } from '@elliemae/ds-popover';\nimport { useOnClickOutside } from '@elliemae/ds-utilities';\n\nexport const ToolbarContext = React.createContext();\n\nconst { Provider } = ToolbarContext;\n\nconst useScrollListener = (callback, dependencies) => {\n useEffect(() => {\n window.addEventListener('scroll', callback, true);\n return () => {\n window.removeEventListener('scroll', callback, true);\n };\n }, [dependencies]);\n};\n\nconst noop = () => null;\nconst ToolbarProvider = memo(({ delay = 200, children, onHide = noop, onShow = noop }) => {\n const showTimer = useRef();\n const hideTimer = useRef();\n const toolbarRef = useRef();\n const [tooltipState, setTooltipState] = useState({});\n\n const show = (state) => {\n if (state.reference === tooltipState.reference) clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(\n () =>\n setTooltipState({\n ...state,\n visible: true,\n }),\n delay,\n );\n onShow();\n };\n\n const hide = (e, force) => {\n if (!force) clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(\n () =>\n setTooltipState((prevState) => ({\n ...prevState,\n visible: false,\n })),\n 100,\n );\n onHide(tooltipState, e);\n };\n\n useScrollListener((e) => hide(e, true), tooltipState.visible);\n useOnClickOutside(toolbarRef, () => hide());\n\n const keyDownHandler = (e) => {\n if (e.key === 'Escape') {\n hide(e);\n }\n };\n\n useEffect(() => {\n window.addEventListener('keydown', keyDownHandler);\n return () => {\n window.removeEventListener('keydown', keyDownHandler);\n };\n });\n\n const value = useMemo(\n () => ({\n state: tooltipState,\n show,\n hide,\n }),\n [tooltipState.reference],\n );\n\n return (\n <Provider value={value}>\n {children}\n <DSPopover\n boundaries=\"scrollParent\"\n {...(tooltipState.options || {})}\n content={tooltipState.renderer}\n placement=\"left\"\n referenceEl={tooltipState.reference}\n renderer={({ as: Component, style, children: Content }) => (\n <div ref={toolbarRef} onMouseEnter={(e) => show(tooltipState, e)} onMouseLeave={hide}>\n <Component style={style}>{Content}</Component>\n </div>\n )}\n style={tooltipState.style}\n visible={tooltipState.visible}\n />\n </Provider>\n );\n});\n\nexport { ToolbarProvider };\nexport default ToolbarProvider;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAE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AA,IACtD;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,QACZ,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EACF,IACA,CAAC,aAAa,SAAS,CACzB;AAEA,SACE,qCAAC;AAAA,IAAS;AAAA,KACP,UACD,qCAAC;AAAA,IACC,YAAW;AAAA,IACV,GAAI,aAAa,WAAW,CAAC;AAAA,IAC9B,SAAS,aAAa;AAAA,IACtB,WAAU;AAAA,IACV,aAAa,aAAa;AAAA,IAC1B,UAAU,CAAC,EAAE,IAAI,WAAW,OAAO,UAAU,cAC3C,qCAAC;AAAA,MAAI,KAAK;AAAA,MAAY,cAAc,CAAC,MAAM,KAAK,cAAc,CAAC;AAAA,MAAG,cAAc;AAAA,OAC9E,qCAAC;AAAA,MAAU;AAAA,OAAe,OAAQ,CACpC;AAAA,IAEF,OAAO,aAAa;AAAA,IACpB,SAAS,aAAa;AAAA,GACxB,CACF;AAEJ,CAAC;AAGD,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,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
|
import React2 from "react";
|
|
23
4
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -28,10 +9,12 @@ import {
|
|
|
28
9
|
cloneDeep,
|
|
29
10
|
isFunction
|
|
30
11
|
} from "@elliemae/ds-utilities";
|
|
31
|
-
const appendHeaderFormatter = curry((formatter, column) =>
|
|
32
|
-
|
|
12
|
+
const appendHeaderFormatter = curry((formatter, column) => ({
|
|
13
|
+
...column,
|
|
14
|
+
header: {
|
|
15
|
+
...column.header,
|
|
33
16
|
formatters: [...get(column, "header.formatters", []), formatter]
|
|
34
|
-
}
|
|
17
|
+
}
|
|
35
18
|
}));
|
|
36
19
|
const appendCellFormatter = curry((formatter, column, path = "formatters") => {
|
|
37
20
|
const nextColumn = cloneDeep(column);
|
|
@@ -58,13 +41,16 @@ const defaultColumnDefinitionOptions = {
|
|
|
58
41
|
const mergeClassNameToColumnHeader = curry((className, column) => {
|
|
59
42
|
const headerProps = get(column, ["header", "props"], {});
|
|
60
43
|
const headerClassName = headerProps.className || "";
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
return {
|
|
45
|
+
...column,
|
|
46
|
+
header: {
|
|
47
|
+
...column.header,
|
|
48
|
+
props: {
|
|
49
|
+
...headerProps,
|
|
64
50
|
className: `${headerClassName} ${className}`
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
68
54
|
});
|
|
69
55
|
const initColumnDefinition = (options = {}) => {
|
|
70
56
|
return (column) => {
|
|
@@ -73,34 +59,40 @@ const initColumnDefinition = (options = {}) => {
|
|
|
73
59
|
textAlign: "right"
|
|
74
60
|
};
|
|
75
61
|
}
|
|
76
|
-
const { useTextTruncation = true, isUserColumn, visible, normalize } =
|
|
62
|
+
const { useTextTruncation = true, isUserColumn, visible, normalize } = {
|
|
63
|
+
...defaultColumnDefinitionOptions,
|
|
64
|
+
...options
|
|
65
|
+
};
|
|
77
66
|
if (normalize) {
|
|
78
67
|
column.originalProperty = column.property;
|
|
79
68
|
column.property = column.property.replace(/\s+/g, "");
|
|
80
69
|
}
|
|
81
|
-
column.props =
|
|
70
|
+
column.props = {
|
|
71
|
+
...column.props,
|
|
82
72
|
style: {}
|
|
83
|
-
}
|
|
84
|
-
column.header =
|
|
73
|
+
};
|
|
74
|
+
column.header = {
|
|
75
|
+
...column.header,
|
|
85
76
|
label: column.label,
|
|
86
77
|
formatters: [...get(column, ["header", "formatters"], [])],
|
|
87
78
|
props: {
|
|
88
79
|
style: column.headerStyle || {}
|
|
89
80
|
}
|
|
90
|
-
}
|
|
81
|
+
};
|
|
91
82
|
if (useTextTruncation && !(isFunction(column.customHeaderRenderer) || column.header.formatters.length)) {
|
|
92
83
|
column.header.formatters.push((value) => /* @__PURE__ */ React2.createElement("span", {
|
|
93
84
|
className: "cell-value"
|
|
94
85
|
}, value));
|
|
95
86
|
}
|
|
96
|
-
column.cell =
|
|
87
|
+
column.cell = {
|
|
88
|
+
...column.cell,
|
|
97
89
|
transforms: [],
|
|
98
90
|
formatters: [...get(column, ["cell", "formatters"], [])],
|
|
99
91
|
scrollingFormatters: [...get(column, ["cell", "formatters"], [])],
|
|
100
92
|
props: {
|
|
101
93
|
style: column.cellStyle || {}
|
|
102
94
|
}
|
|
103
|
-
}
|
|
95
|
+
};
|
|
104
96
|
if (useTextTruncation && !(isFunction(column.customRenderer) || column.cell.formatters.length)) {
|
|
105
97
|
column.cell.formatters.push((value) => /* @__PURE__ */ React2.createElement("span", {
|
|
106
98
|
className: "cell-value",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/useDataGrid/initColumnDefinition.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n get,\n curry,\n set,\n cloneDeep,\n isFunction,\n} from '@elliemae/ds-utilities';\n\n// TODO: use lenses to access nested fields\n\nexport const appendHeaderFormatter = curry((formatter, column) => ({\n ...column,\n header: {\n ...column.header,\n formatters: [...get(column, 'header.formatters', []), formatter],\n },\n}));\n\nexport const appendCellFormatter = curry(\n (formatter, column, path = 'formatters') => {\n const nextColumn = cloneDeep(column);\n const formatters = get(nextColumn, ['cell', path], []);\n const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);\n if (Array.isArray(formatter)) {\n if (formatter[1]) scrollingFormatters.push(formatter[1]);\n formatters.push(formatter[0]);\n } else {\n formatters.push(formatter);\n scrollingFormatters.push(formatter);\n }\n set(nextColumn, ['cell', path], formatters);\n set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);\n return nextColumn;\n },\n);\n\nconst defaultColumnDefinitionOptions = {\n normalize: false,\n useTextTruncation: true,\n isUserColumn: true,\n visible: true,\n};\n\nexport const mergeClassNameToColumnHeader = curry((className, column) => {\n const headerProps = get(column, ['header', 'props'], {});\n const headerClassName = headerProps.className || '';\n return {\n ...column,\n header: {\n ...column.header,\n props: {\n ...headerProps,\n className: `${headerClassName} ${className}`,\n },\n },\n };\n});\n\nexport const initColumnDefinition = (options = {}) => {\n // eslint-disable-next-line complexity\n return (column) => {\n // todo: clean this\n if (column.type === 'number') {\n // eslint-disable-next-line no-param-reassign\n column.cellStyle = {\n textAlign: 'right',\n };\n }\n const { useTextTruncation = true, isUserColumn, visible, normalize } = {\n ...defaultColumnDefinitionOptions,\n ...options,\n };\n\n if (normalize) {\n // eslint-disable-next-line no-param-reassign\n column.originalProperty = column.property;\n // eslint-disable-next-line no-param-reassign\n column.property = column.property.replace(/\\s+/g, '');\n }\n\n // eslint-disable-next-line no-param-reassign\n column.props = {\n ...column.props,\n style: {},\n };\n // eslint-disable-next-line no-param-reassign\n column.header = {\n ...column.header,\n label: column.label,\n formatters: [...get(column, ['header', 'formatters'], [])],\n props: {\n style: column.headerStyle || {},\n },\n };\n if (\n useTextTruncation &&\n !(\n isFunction(column.customHeaderRenderer) ||\n column.header.formatters.length\n )\n ) {\n column.header.formatters.push((value) => (\n <span className=\"cell-value\">{value}</span>\n ));\n }\n\n // eslint-disable-next-line no-param-reassign\n column.cell = {\n ...column.cell,\n transforms: [],\n formatters: [...get(column, ['cell', 'formatters'], [])],\n scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],\n props: {\n style: column.cellStyle || {},\n },\n };\n\n if (\n useTextTruncation &&\n !(isFunction(column.customRenderer) || column.cell.formatters.length)\n ) {\n column.cell.formatters.push((value) => (\n <span\n className=\"cell-value\"\n style={{\n justifyContent:\n column.type === 'number' ? 'flex-end' : 'flex-start',\n }}\n >\n {value}\n </span>\n ));\n }\n // eslint-disable-next-line no-param-reassign\n column.uuid = column.uuid || uuidv4();\n // eslint-disable-next-line no-param-reassign\n column.visible = column.visible === undefined ? visible : column.visible;\n // eslint-disable-next-line no-param-reassign, max-lines\n column.isUserColumn = column.isUserColumn || isUserColumn;\n // eslint-disable-next-line no-param-reassign\n column.headerHookEffects = [];\n return column;\n };\n};\n\nexport default initColumnDefinition;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,wBAAwB,MAAM,CAAC,WAAW,WAAY;AAAA,EACjE,GAAG;AAAA,EACH,QAAQ;AAAA,IACN,GAAG,OAAO;AAAA,IACV,YAAY,CAAC,GAAG,IAAI,QAAQ,qBAAqB,CAAC,CAAC,GAAG,SAAS;AAAA,EACjE;AACF,EAAE;AAEK,MAAM,sBAA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