@elliemae/ds-shared 2.2.0 → 2.3.0-alpha.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/cjs/Animations/BaseAnimation.js +55 -35
- package/cjs/Animations/BaseAnimation.js.map +7 -0
- package/cjs/Animations/Grow.js +54 -41
- package/cjs/Animations/Grow.js.map +7 -0
- package/cjs/Animations/GrowRight.js +63 -41
- package/cjs/Animations/GrowRight.js.map +7 -0
- package/cjs/Animations/GrowVertical.js +47 -7
- package/cjs/Animations/GrowVertical.js.map +7 -0
- package/cjs/CheckableGroup.js +67 -65
- package/cjs/CheckableGroup.js.map +7 -0
- package/cjs/DeferRenderAfterComputation.js +48 -24
- package/cjs/DeferRenderAfterComputation.js.map +7 -0
- package/cjs/FocusGroup/FocusGrid.js +108 -143
- package/cjs/FocusGroup/FocusGrid.js.map +7 -0
- package/cjs/FocusGroup/FocusGroup.js +88 -147
- package/cjs/FocusGroup/FocusGroup.js.map +7 -0
- package/cjs/FocusGroup/FocusGroupContext.js +38 -11
- package/cjs/FocusGroup/FocusGroupContext.js.map +7 -0
- package/cjs/FocusGroup/FocusGroupManager.js +56 -47
- package/cjs/FocusGroup/FocusGroupManager.js.map +7 -0
- package/cjs/FocusGroup/focusGroupManagerHoc.js +52 -42
- package/cjs/FocusGroup/focusGroupManagerHoc.js.map +7 -0
- package/cjs/FocusGroup/index.js +47 -21
- package/cjs/FocusGroup/index.js.map +7 -0
- package/cjs/FocusGroup/useFocusGroupItem.js +59 -51
- package/cjs/FocusGroup/useFocusGroupItem.js.map +7 -0
- package/cjs/FocusGroup/utils/getNextCellPosition.js +47 -27
- package/cjs/FocusGroup/utils/getNextCellPosition.js.map +7 -0
- package/cjs/GroupContext/Group.js +64 -73
- package/cjs/GroupContext/Group.js.map +7 -0
- package/cjs/GroupContext/GroupContext.js +36 -13
- package/cjs/GroupContext/GroupContext.js.map +7 -0
- package/cjs/GroupContext/GroupItem.js +39 -21
- package/cjs/GroupContext/GroupItem.js.map +7 -0
- package/cjs/GroupContext/index.js +39 -13
- package/cjs/GroupContext/index.js.map +7 -0
- package/cjs/ScrollSync/ScrollSync.js +60 -75
- package/cjs/ScrollSync/ScrollSync.js.map +7 -0
- package/cjs/ScrollSync/ScrollSyncPane.js +52 -60
- package/cjs/ScrollSync/ScrollSyncPane.js.map +7 -0
- package/cjs/ScrollSync/ScrollSyncProvider.js +103 -50
- package/cjs/ScrollSync/ScrollSyncProvider.js.map +7 -0
- package/cjs/ScrollSync/index.js +37 -11
- package/cjs/ScrollSync/index.js.map +7 -0
- package/cjs/ScrollSync/useScrollSync.js +38 -7
- package/cjs/ScrollSync/useScrollSync.js.map +7 -0
- package/cjs/constants.js +65 -46
- package/cjs/constants.js.map +7 -0
- package/cjs/createDataInstance/createInstancePlugin.js +41 -29
- package/cjs/createDataInstance/createInstancePlugin.js.map +7 -0
- package/cjs/createDataInstance/createInstanceRef.js +66 -71
- package/cjs/createDataInstance/createInstanceRef.js.map +7 -0
- package/cjs/createDataInstance/utils.js +76 -100
- package/cjs/createDataInstance/utils.js.map +7 -0
- package/cjs/defer-render-hoc/index.js +48 -41
- package/cjs/defer-render-hoc/index.js.map +7 -0
- package/cjs/dimsum.config.js +38 -6
- package/cjs/dimsum.config.js.map +7 -0
- package/cjs/index.js +40 -17
- package/cjs/index.js.map +7 -0
- package/cjs/prop-types.js +106 -49
- package/cjs/prop-types.js.map +7 -0
- package/cjs/react-spring/index.js +28 -14
- package/cjs/react-spring/index.js.map +7 -0
- package/cjs/react-spring/renderprops.js +28 -14
- package/cjs/react-spring/renderprops.js.map +7 -0
- package/cjs/toolbar/ToolbarProvider.js +82 -94
- package/cjs/toolbar/ToolbarProvider.js.map +7 -0
- package/cjs/useDataGrid/VolatileRowsListener.js +38 -13
- package/cjs/useDataGrid/VolatileRowsListener.js.map +7 -0
- package/cjs/useDataGrid/index.js +36 -7
- package/cjs/useDataGrid/index.js.map +7 -0
- package/cjs/useDataGrid/initColumnDefinition.js +105 -110
- package/cjs/useDataGrid/initColumnDefinition.js.map +7 -0
- package/cjs/useDataGrid/useDataGrid.js +122 -148
- package/cjs/useDataGrid/useDataGrid.js.map +7 -0
- package/cjs/useDataList/index.js +36 -7
- package/cjs/useDataList/index.js.map +7 -0
- package/cjs/useDataList/recordIterator.js +42 -18
- package/cjs/useDataList/recordIterator.js.map +7 -0
- package/cjs/useDataList/useDataList.js +74 -83
- package/cjs/useDataList/useDataList.js.map +7 -0
- package/cjs/utils.js +71 -80
- package/cjs/utils.js.map +7 -0
- package/cjs/virtualization/AutoHeightList.js +62 -54
- package/cjs/virtualization/AutoHeightList.js.map +7 -0
- package/cjs/virtualization/FluidHeightList.js +42 -48
- package/cjs/virtualization/FluidHeightList.js.map +7 -0
- package/cjs/virtualization/index.js +48 -20
- package/cjs/virtualization/index.js.map +7 -0
- package/esm/Animations/BaseAnimation.js +26 -29
- package/esm/Animations/BaseAnimation.js.map +7 -0
- package/esm/Animations/Grow.js +25 -35
- package/esm/Animations/Grow.js.map +7 -0
- package/esm/Animations/GrowRight.js +34 -35
- package/esm/Animations/GrowRight.js.map +7 -0
- package/esm/Animations/GrowVertical.js +29 -4
- package/esm/Animations/GrowVertical.js.map +7 -0
- package/esm/CheckableGroup.js +35 -52
- package/esm/CheckableGroup.js.map +7 -0
- package/esm/DeferRenderAfterComputation.js +16 -15
- package/esm/DeferRenderAfterComputation.js.map +7 -0
- package/esm/FocusGroup/FocusGrid.js +64 -117
- package/esm/FocusGroup/FocusGrid.js.map +7 -0
- package/esm/FocusGroup/FocusGroup.js +56 -137
- package/esm/FocusGroup/FocusGroup.js.map +7 -0
- package/esm/FocusGroup/FocusGroupContext.js +9 -5
- package/esm/FocusGroup/FocusGroupContext.js.map +7 -0
- package/esm/FocusGroup/FocusGroupManager.js +24 -38
- package/esm/FocusGroup/FocusGroupManager.js.map +7 -0
- package/esm/FocusGroup/focusGroupManagerHoc.js +24 -36
- package/esm/FocusGroup/focusGroupManagerHoc.js.map +7 -0
- package/esm/FocusGroup/index.js +18 -6
- package/esm/FocusGroup/index.js.map +7 -0
- package/esm/FocusGroup/useFocusGroupItem.js +28 -40
- package/esm/FocusGroup/useFocusGroupItem.js.map +7 -0
- package/esm/FocusGroup/utils/getNextCellPosition.js +18 -25
- package/esm/FocusGroup/utils/getNextCellPosition.js.map +7 -0
- package/esm/GroupContext/Group.js +34 -66
- package/esm/GroupContext/Group.js.map +7 -0
- package/esm/GroupContext/GroupContext.js +7 -5
- package/esm/GroupContext/GroupContext.js.map +7 -0
- package/esm/GroupContext/GroupItem.js +10 -15
- package/esm/GroupContext/GroupItem.js.map +7 -0
- package/esm/GroupContext/index.js +10 -3
- package/esm/GroupContext/index.js.map +7 -0
- package/esm/ScrollSync/ScrollSync.js +30 -64
- package/esm/ScrollSync/ScrollSync.js.map +7 -0
- package/esm/ScrollSync/ScrollSyncPane.js +22 -52
- package/esm/ScrollSync/ScrollSyncPane.js.map +7 -0
- package/esm/ScrollSync/ScrollSyncProvider.js +74 -42
- package/esm/ScrollSync/ScrollSyncProvider.js.map +7 -0
- package/esm/ScrollSync/index.js +8 -2
- package/esm/ScrollSync/index.js.map +7 -0
- package/esm/ScrollSync/useScrollSync.js +9 -5
- package/esm/ScrollSync/useScrollSync.js.map +7 -0
- package/esm/constants.js +37 -28
- package/esm/constants.js.map +7 -0
- package/esm/createDataInstance/createInstancePlugin.js +12 -23
- package/esm/createDataInstance/createInstancePlugin.js.map +7 -0
- package/esm/createDataInstance/createInstanceRef.js +36 -59
- package/esm/createDataInstance/createInstanceRef.js.map +7 -0
- package/esm/createDataInstance/utils.js +48 -85
- package/esm/createDataInstance/utils.js.map +7 -0
- package/esm/defer-render-hoc/index.js +17 -31
- package/esm/defer-render-hoc/index.js.map +7 -0
- package/esm/dimsum.config.js +9 -4
- package/esm/dimsum.config.js.map +7 -0
- package/esm/index.js +11 -5
- package/esm/index.js.map +7 -0
- package/esm/prop-types.js +75 -31
- package/esm/prop-types.js.map +7 -0
- package/esm/react-spring/index.js +3 -1
- package/esm/react-spring/index.js.map +7 -0
- package/esm/react-spring/renderprops.js +3 -1
- package/esm/react-spring/renderprops.js.map +7 -0
- package/esm/toolbar/ToolbarProvider.js +45 -74
- package/esm/toolbar/ToolbarProvider.js.map +7 -0
- package/esm/useDataGrid/VolatileRowsListener.js +9 -11
- package/esm/useDataGrid/VolatileRowsListener.js.map +7 -0
- package/esm/useDataGrid/index.js +7 -1
- package/esm/useDataGrid/index.js.map +7 -0
- package/esm/useDataGrid/initColumnDefinition.js +78 -94
- package/esm/useDataGrid/initColumnDefinition.js.map +7 -0
- package/esm/useDataGrid/useDataGrid.js +82 -99
- package/esm/useDataGrid/useDataGrid.js.map +7 -0
- package/esm/useDataList/index.js +7 -1
- package/esm/useDataList/index.js.map +7 -0
- package/esm/useDataList/recordIterator.js +13 -14
- package/esm/useDataList/recordIterator.js.map +7 -0
- package/esm/useDataList/useDataList.js +44 -67
- package/esm/useDataList/useDataList.js.map +7 -0
- package/esm/utils.js +42 -59
- package/esm/utils.js.map +7 -0
- package/esm/virtualization/AutoHeightList.js +28 -40
- package/esm/virtualization/AutoHeightList.js.map +7 -0
- package/esm/virtualization/FluidHeightList.js +14 -38
- package/esm/virtualization/FluidHeightList.js.map +7 -0
- package/esm/virtualization/index.js +19 -16
- package/esm/virtualization/index.js.map +7 -0
- package/package.json +3 -3
- package/types/Animations/BaseAnimation.d.ts +1 -0
- package/types/Animations/Grow.d.ts +1 -0
- package/types/Animations/GrowRight.d.ts +1 -0
- package/types/CheckableGroup.d.ts +1 -0
- package/types/DeferRenderAfterComputation.d.ts +3 -2
- package/types/FocusGroup/FocusGrid.d.ts +5 -3
- package/types/FocusGroup/FocusGroup.d.ts +3 -1
- package/types/FocusGroup/FocusGroupContext.d.ts +3 -2
- package/types/FocusGroup/FocusGroupManager.d.ts +3 -1
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +3 -1
- package/types/FocusGroup/index.d.ts +6 -6
- package/types/FocusGroup/useFocusGroupItem.d.ts +3 -1
- package/types/FocusGroup/utils/getNextCellPosition.d.ts +3 -1
- package/types/GroupContext/Group.d.ts +1 -0
- package/types/GroupContext/GroupItem.d.ts +1 -0
- package/types/GroupContext/index.d.ts +3 -3
- package/types/ScrollSync/ScrollSync.d.ts +4 -2
- package/types/ScrollSync/ScrollSyncPane.d.ts +2 -2
- package/types/ScrollSync/index.d.ts +2 -2
- package/types/ScrollSync/useScrollSync.d.ts +6 -5
- package/types/createDataInstance/createInstancePlugin.d.ts +2 -1
- package/types/createDataInstance/createInstanceRef.d.ts +3 -1
- package/types/dimsum.config.d.ts +3 -2
- package/types/index.d.ts +2 -2
- package/types/toolbar/ToolbarProvider.d.ts +3 -8
- package/types/useDataGrid/VolatileRowsListener.d.ts +3 -1
- package/types/useDataGrid/index.d.ts +1 -1
- package/types/useDataGrid/initColumnDefinition.d.ts +2 -1
- package/types/useDataGrid/useDataGrid.d.ts +3 -2
- package/types/useDataList/index.d.ts +1 -1
- package/types/useDataList/useDataList.d.ts +3 -2
|
@@ -1,92 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var uuid = require('uuid');
|
|
18
|
-
var resolve = require('table-resolver');
|
|
19
|
-
var initColumnDefinition = require('./initColumnDefinition.js');
|
|
20
|
-
var utils$1 = require('../createDataInstance/utils.js');
|
|
21
|
-
var VolatileRowsListener = require('./VolatileRowsListener.js');
|
|
22
|
-
var utils = require('../utils.js');
|
|
23
|
-
|
|
24
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
-
|
|
26
|
-
function _interopNamespace(e) {
|
|
27
|
-
if (e && e.__esModule) return e;
|
|
28
|
-
var n = Object.create(null);
|
|
29
|
-
if (e) {
|
|
30
|
-
Object.keys(e).forEach(function (k) {
|
|
31
|
-
if (k !== 'default') {
|
|
32
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () { return e[k]; }
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
39
17
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useDataGrid_exports = {};
|
|
29
|
+
__export(useDataGrid_exports, {
|
|
30
|
+
default: () => useDataGrid_default,
|
|
31
|
+
useDataGrid: () => useDataGrid
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_uuid = require("uuid");
|
|
37
|
+
var resolve = __toESM(require("table-resolver"));
|
|
38
|
+
var import_initColumnDefinition = require("./initColumnDefinition");
|
|
39
|
+
var import_utils = require("../createDataInstance/utils");
|
|
40
|
+
var import_VolatileRowsListener = require("./VolatileRowsListener");
|
|
41
|
+
var import_utils2 = require("../utils");
|
|
42
|
+
const IS_INTERNET_EXPLORER = (0, import_utils2.isInternetExplorer)();
|
|
43
|
+
const useDataGrid = ({
|
|
44
|
+
uuid: uuidProp,
|
|
45
|
+
plugins: pluginsFromProps,
|
|
46
|
+
rows,
|
|
47
|
+
columns,
|
|
48
|
+
renderers = {},
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
67
51
|
const plugins = pluginsFromProps;
|
|
68
|
-
const instance =
|
|
69
|
-
const tableRef =
|
|
70
|
-
const headerRef =
|
|
71
|
-
const bodyRef =
|
|
72
|
-
const bodyInnerRef =
|
|
73
|
-
const [uuid
|
|
74
|
-
const [hasScroll, setHasScroll] =
|
|
75
|
-
const [isRowDragging, setIsRowDragging] =
|
|
76
|
-
const isScrolling =
|
|
77
|
-
const shouldRefocus =
|
|
78
|
-
|
|
79
|
-
const [
|
|
80
|
-
|
|
81
|
-
const [originalRows, updateRows] = dsUtilities.useDerivedStateFromProps(rows, {
|
|
82
|
-
onUpdate: resolve__namespace.resolve({
|
|
52
|
+
const instance = (0, import_react.useRef)();
|
|
53
|
+
const tableRef = (0, import_react.useRef)();
|
|
54
|
+
const headerRef = (0, import_react.useRef)();
|
|
55
|
+
const bodyRef = (0, import_react.useRef)();
|
|
56
|
+
const bodyInnerRef = (0, import_react.useRef)();
|
|
57
|
+
const [uuid] = (0, import_react.useState)(uuidProp || (() => (0, import_uuid.v4)()));
|
|
58
|
+
const [hasScroll, setHasScroll] = (0, import_react.useState)(false);
|
|
59
|
+
const [isRowDragging, setIsRowDragging] = (0, import_react.useState)(false);
|
|
60
|
+
const isScrolling = (0, import_react.useRef)();
|
|
61
|
+
const shouldRefocus = (0, import_react.useRef)();
|
|
62
|
+
const [RowsObserver] = (0, import_react.useState)(() => new import_VolatileRowsListener.VolatileRowsListener());
|
|
63
|
+
const [originalRows, updateRows] = (0, import_ds_utilities.useDerivedStateFromProps)(rows, {
|
|
64
|
+
onUpdate: resolve.resolve({
|
|
83
65
|
columns,
|
|
84
|
-
method: extra =>
|
|
66
|
+
method: (extra) => (0, import_ds_utilities.compose)(resolve.byFunction("valueTransformation")(extra), resolve.nested(extra))
|
|
85
67
|
}),
|
|
86
68
|
updateOnStateChange: true
|
|
87
69
|
});
|
|
88
70
|
instance.current = {
|
|
89
|
-
decoratedRenderers:
|
|
71
|
+
decoratedRenderers: (0, import_ds_utilities.cloneDeep)(renderers),
|
|
90
72
|
decoratedColumns: columns,
|
|
91
73
|
columns,
|
|
92
74
|
rows,
|
|
@@ -96,7 +78,7 @@ function useDataGrid(_ref) {
|
|
|
96
78
|
getBodyProps: [],
|
|
97
79
|
getTableProps: [],
|
|
98
80
|
effects: [],
|
|
99
|
-
uuid
|
|
81
|
+
uuid,
|
|
100
82
|
props,
|
|
101
83
|
refs: {
|
|
102
84
|
table: tableRef,
|
|
@@ -111,11 +93,9 @@ function useDataGrid(_ref) {
|
|
|
111
93
|
updateRows
|
|
112
94
|
},
|
|
113
95
|
updateRows,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
disableEvents: () => document.body.style.pointerEvents = 'none',
|
|
118
|
-
observeRows: observer => RowsObserver.observe(observer),
|
|
96
|
+
enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? "" : null,
|
|
97
|
+
disableEvents: () => document.body.style.pointerEvents = "none",
|
|
98
|
+
observeRows: (observer) => RowsObserver.observe(observer),
|
|
119
99
|
hotKeys: {},
|
|
120
100
|
shouldRefocus,
|
|
121
101
|
isScrolling,
|
|
@@ -124,21 +104,20 @@ function useDataGrid(_ref) {
|
|
|
124
104
|
isRowDragging,
|
|
125
105
|
plugins
|
|
126
106
|
};
|
|
127
|
-
|
|
128
107
|
instance.current.getState = () => instance.current.state;
|
|
129
|
-
|
|
130
108
|
instance.current.getInstance = () => instance.current;
|
|
131
|
-
|
|
132
109
|
const defaultDecorators = {
|
|
133
110
|
decorateGrid: [],
|
|
134
111
|
registerStateHook: [],
|
|
135
112
|
registerHotKeys: [],
|
|
136
113
|
decorateColumn: [],
|
|
137
|
-
decorateColumns: [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
114
|
+
decorateColumns: [
|
|
115
|
+
(cols) => cols.map((col) => (0, import_initColumnDefinition.initColumnDefinition)({
|
|
116
|
+
useTextTruncation: col.useTextTruncation,
|
|
117
|
+
wrapText: props.wrapText,
|
|
118
|
+
normalize: props.normalizeDataKeys
|
|
119
|
+
})(col))
|
|
120
|
+
],
|
|
142
121
|
decorateRenderers: [],
|
|
143
122
|
getRowProps: [],
|
|
144
123
|
getHeaderRowProps: [],
|
|
@@ -147,74 +126,69 @@ function useDataGrid(_ref) {
|
|
|
147
126
|
getHeaderProps: [],
|
|
148
127
|
composeRows: []
|
|
149
128
|
};
|
|
150
|
-
const decorators =
|
|
151
|
-
let nextDecorators = defaultDecorators;
|
|
152
|
-
|
|
153
|
-
plugins.forEach(plugin => nextDecorators = plugin(nextDecorators));
|
|
129
|
+
const decorators = (0, import_react.useMemo)(() => {
|
|
130
|
+
let nextDecorators = defaultDecorators;
|
|
131
|
+
plugins.forEach((plugin) => nextDecorators = plugin(nextDecorators));
|
|
154
132
|
return nextDecorators;
|
|
155
133
|
}, [plugins]);
|
|
156
|
-
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) =>
|
|
134
|
+
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => ({
|
|
135
|
+
...nextInstance,
|
|
136
|
+
...decorator(instance.current)
|
|
137
|
+
}), instance.current);
|
|
157
138
|
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
158
|
-
const {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
139
|
+
const { state, actions } = decorator(instance.current);
|
|
140
|
+
return {
|
|
141
|
+
...nextInstance,
|
|
142
|
+
state: {
|
|
143
|
+
...nextInstance.state,
|
|
144
|
+
...state
|
|
145
|
+
},
|
|
146
|
+
actions: {
|
|
147
|
+
...nextInstance.actions,
|
|
148
|
+
...actions
|
|
149
|
+
}
|
|
150
|
+
};
|
|
166
151
|
}, instance.current);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
handler,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
175
|
-
hotKeys: _objectSpread(_objectSpread({}, nextInstance.hotKeys), {}, {
|
|
176
|
-
[key]: {
|
|
177
|
-
handler,
|
|
178
|
-
options
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
|
|
152
|
+
const reduceHotKey = (nextInstance, { key, handler, options }) => ({
|
|
153
|
+
...nextInstance,
|
|
154
|
+
hotKeys: {
|
|
155
|
+
...nextInstance.hotKeys,
|
|
156
|
+
[key]: { handler, options }
|
|
157
|
+
}
|
|
158
|
+
});
|
|
184
159
|
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
185
160
|
const hotKeys = decorator(nextInstance);
|
|
186
|
-
|
|
187
161
|
if (Array.isArray(hotKeys)) {
|
|
188
162
|
return hotKeys.reduce(reduceHotKey, nextInstance);
|
|
189
163
|
}
|
|
190
|
-
|
|
191
164
|
return reduceHotKey(nextInstance, hotKeys);
|
|
192
165
|
}, instance.current);
|
|
193
|
-
instance.current.decoratedRenderers =
|
|
194
|
-
instance.current.decoratedColumns =
|
|
195
|
-
const visibleColumns =
|
|
196
|
-
return visibleColumns.length ?
|
|
166
|
+
instance.current.decoratedRenderers = (0, import_utils.applyDecorators)(instance.current.decoratedRenderers, decorators.decorateRenderers, instance.current);
|
|
167
|
+
instance.current.decoratedColumns = (0, import_react.useMemo)(() => {
|
|
168
|
+
const visibleColumns = (0, import_ds_utilities.cloneDeep)(columns).filter((column) => typeof column.visible === "undefined" || column.visible);
|
|
169
|
+
return visibleColumns.length ? (0, import_utils.decorateColumns)(visibleColumns, decorators, instance.current) : [];
|
|
197
170
|
}, [columns]);
|
|
198
|
-
instance.current.getBodyProps =
|
|
199
|
-
instance.current.getHeaderProps =
|
|
200
|
-
instance.current.getRowProps =
|
|
201
|
-
instance.current.getHeaderRowProps =
|
|
202
|
-
instance.current.getTableProps =
|
|
171
|
+
instance.current.getBodyProps = (0, import_utils.reducePropsGetter)(decorators.getBodyProps, instance.current);
|
|
172
|
+
instance.current.getHeaderProps = (0, import_utils.reducePropsGetter)(decorators.getHeaderProps, instance.current);
|
|
173
|
+
instance.current.getRowProps = (0, import_utils.reducePropsGetter)(decorators.getRowProps, instance.current);
|
|
174
|
+
instance.current.getHeaderRowProps = (0, import_utils.reducePropsGetter)(decorators.getHeaderRowProps, instance.current);
|
|
175
|
+
instance.current.getTableProps = (0, import_utils.reducePropsGetter)(decorators.getTableProps, instance.current);
|
|
203
176
|
instance.current.composedRows = decorators.composeRows.reduce((nextRows, getter) => getter(nextRows, instance.current), instance.current.composedRows);
|
|
204
177
|
RowsObserver.notify(instance.current.composedRows);
|
|
205
178
|
const currentShouldRefocus = instance.current.shouldRefocus.current;
|
|
206
|
-
const prevState =
|
|
207
|
-
|
|
208
|
-
if (dsUtilities.isObject(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
179
|
+
const prevState = (0, import_ds_utilities.usePrevious)(instance.current.state);
|
|
180
|
+
if ((0, import_ds_utilities.isObject)(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
209
181
|
instance.current.shouldRefocus.current = currentShouldRefocus.value;
|
|
210
182
|
} else {
|
|
211
|
-
instance.current.shouldRefocus.current = !
|
|
183
|
+
instance.current.shouldRefocus.current = !(0, import_ds_utilities.isEqual)(prevState, instance.current.state);
|
|
212
184
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return
|
|
185
|
+
if (props.instanceRef)
|
|
186
|
+
(0, import_ds_utilities.setRef)(props.instanceRef, instance.current);
|
|
187
|
+
return {
|
|
188
|
+
...instance.current,
|
|
216
189
|
decorators
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
module.exports =
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
var useDataGrid_default = useDataGrid;
|
|
193
|
+
module.exports = __toCommonJS(useDataGrid_exports);
|
|
194
|
+
//# sourceMappingURL=useDataGrid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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';\nimport {\n applyDecorators,\n decorateColumns,\n reducePropsGetter,\n} from '../createDataInstance/utils';\nimport { VolatileRowsListener } from './VolatileRowsListener';\nimport { isInternetExplorer } from '../utils';\n\nconst IS_INTERNET_EXPLORER = isInternetExplorer();\n\n// TODO: Reuse createDataInstance for the grid the same\n// way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js\n// eslint-disable-next-line max-statements\nexport const useDataGrid = ({\n uuid: uuidProp,\n plugins: pluginsFromProps,\n rows,\n columns,\n renderers = {},\n ...props\n}) => {\n const plugins = pluginsFromProps;\n const instance = useRef();\n const tableRef = useRef();\n const headerRef = useRef();\n const bodyRef = useRef();\n const bodyInnerRef = useRef();\n const [uuid] = useState(uuidProp || (() => uuidv4()));\n const [hasScroll, setHasScroll] = useState(false);\n const [isRowDragging, setIsRowDragging] = useState(false);\n const isScrolling = useRef();\n const shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff\n const [RowsObserver] = useState(() => new VolatileRowsListener());\n\n // todo move this with rows composition\n const [originalRows, updateRows] = useDerivedStateFromProps(rows, {\n onUpdate: resolve.resolve({\n columns,\n method: (extra) =>\n compose(\n resolve.byFunction('valueTransformation')(extra),\n resolve.nested(extra),\n ),\n }),\n updateOnStateChange: true,\n });\n\n instance.current = {\n decoratedRenderers: cloneDeep(renderers),\n decoratedColumns: columns,\n columns,\n rows,\n composedRows: originalRows,\n getRowProps: [],\n getHeaderRowProps: [],\n getBodyProps: [],\n getTableProps: [],\n effects: [],\n uuid,\n props,\n refs: {\n table: tableRef,\n body: bodyRef,\n header: headerRef,\n innerBody: bodyInnerRef,\n },\n state: {\n hasScroll,\n },\n actions: {\n updateRows,\n },\n updateRows,\n // eslint-disable-next-line no-return-assign\n enableEvents: () =>\n (document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null),\n // eslint-disable-next-line no-return-assign\n disableEvents: () => (document.body.style.pointerEvents = 'none'),\n observeRows: (observer) => RowsObserver.observe(observer),\n hotKeys: {},\n shouldRefocus,\n isScrolling,\n setHasScroll,\n setIsRowDragging,\n isRowDragging,\n plugins,\n };\n instance.current.getState = () => instance.current.state;\n instance.current.getInstance = () => instance.current;\n\n const defaultDecorators = {\n decorateGrid: [],\n registerStateHook: [],\n registerHotKeys: [],\n decorateColumn: [],\n decorateColumns: [\n (cols) =>\n cols.map((col) =>\n initColumnDefinition({\n useTextTruncation: col.useTextTruncation,\n wrapText: props.wrapText,\n normalize: props.normalizeDataKeys,\n })(col),\n ),\n ],\n decorateRenderers: [],\n getRowProps: [],\n getHeaderRowProps: [],\n getBodyProps: [],\n getTableProps: [],\n getHeaderProps: [],\n composeRows: [],\n };\n\n const decorators = useMemo(() => {\n let nextDecorators = defaultDecorators;\n // eslint-disable-next-line no-return-assign\n plugins.forEach((plugin) => (nextDecorators = plugin(nextDecorators)));\n return nextDecorators;\n }, [plugins]);\n\n instance.current = decorators.decorateGrid.reduce(\n (nextInstance, decorator) => ({\n ...nextInstance,\n ...decorator(instance.current),\n }),\n instance.current,\n );\n\n instance.current = decorators.registerStateHook.reduce(\n (nextInstance, decorator) => {\n const { state, actions } = decorator(instance.current);\n return {\n ...nextInstance,\n state: {\n ...nextInstance.state,\n ...state,\n },\n actions: {\n ...nextInstance.actions,\n ...actions,\n },\n };\n },\n instance.current,\n );\n\n const reduceHotKey = (nextInstance, { key, handler, options }) => ({\n ...nextInstance,\n hotKeys: {\n ...nextInstance.hotKeys,\n [key]: { handler, options },\n },\n });\n instance.current = decorators.registerHotKeys.reduce(\n (nextInstance, decorator) => {\n const hotKeys = decorator(nextInstance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, nextInstance);\n }\n return reduceHotKey(nextInstance, hotKeys);\n },\n instance.current,\n );\n\n instance.current.decoratedRenderers = applyDecorators(\n instance.current.decoratedRenderers,\n decorators.decorateRenderers,\n instance.current,\n );\n\n instance.current.decoratedColumns = useMemo(() => {\n const visibleColumns = cloneDeep(columns).filter(\n (column) => typeof column.visible === 'undefined' || column.visible,\n );\n return visibleColumns.length\n ? decorateColumns(visibleColumns, decorators, instance.current)\n : [];\n }, [columns]);\n\n instance.current.getBodyProps = reducePropsGetter(\n decorators.getBodyProps,\n instance.current,\n );\n instance.current.getHeaderProps = reducePropsGetter(\n decorators.getHeaderProps,\n instance.current,\n );\n instance.current.getRowProps = reducePropsGetter(\n decorators.getRowProps,\n instance.current,\n );\n instance.current.getHeaderRowProps = reducePropsGetter(\n decorators.getHeaderRowProps,\n instance.current,\n );\n instance.current.getTableProps = reducePropsGetter(\n decorators.getTableProps,\n instance.current,\n );\n\n instance.current.composedRows = decorators.composeRows.reduce(\n (nextRows, getter) => getter(nextRows, instance.current),\n instance.current.composedRows,\n );\n\n RowsObserver.notify(instance.current.composedRows);\n\n const currentShouldRefocus = instance.current.shouldRefocus.current;\n const prevState = usePrevious(instance.current.state);\n if (isObject(currentShouldRefocus) && currentShouldRefocus.forced) {\n instance.current.shouldRefocus.current = currentShouldRefocus.value;\n } else {\n instance.current.shouldRefocus.current = !isEqual(\n prevState,\n instance.current.state,\n );\n }\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return {\n ...instance.current,\n decorators,\n };\n};\n\nexport default useDataGrid;\n\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAQO;AACP,mBAA0C;AAC1C,kBAA6B;AAC7B,cAAyB;AACzB,kCAAqC;AACrC,mBAIO;AACP,kCAAqC;AACrC,oBAAmC;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/cjs/useDataList/index.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useDataList_exports = {};
|
|
29
|
+
__export(useDataList_exports, {
|
|
30
|
+
default: () => import_useDataList.default,
|
|
31
|
+
useDataList: () => import_useDataList.default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_useDataList = __toESM(require("./useDataList"));
|
|
35
|
+
module.exports = __toCommonJS(useDataList_exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/useDataList/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { default, default as useDataList } from './useDataList';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAgD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var recordIterator_exports = {};
|
|
29
|
+
__export(recordIterator_exports, {
|
|
30
|
+
recordIterator: () => recordIterator
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
5
33
|
const defaultStrategy = () => {
|
|
6
|
-
throw Error(
|
|
34
|
+
throw Error("Implement an iterator strategy for record iterator");
|
|
7
35
|
};
|
|
8
|
-
|
|
9
|
-
function recordIterator(records) {
|
|
10
|
-
let strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
|
|
11
|
-
let decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
12
|
-
let instance = arguments.length > 3 ? arguments[3] : undefined;
|
|
36
|
+
function recordIterator(records, strategy = defaultStrategy, decorators = [], instance) {
|
|
13
37
|
const nextRows = [];
|
|
14
38
|
strategy({
|
|
15
39
|
data: records,
|
|
16
|
-
cb: row => {
|
|
17
|
-
let nextRow = row;
|
|
18
|
-
|
|
40
|
+
cb: (row) => {
|
|
41
|
+
let nextRow = row;
|
|
19
42
|
for (let i = 0; i < decorators.length; i++) {
|
|
20
43
|
nextRow = decorators[i](nextRow, instance);
|
|
21
|
-
if (!nextRow)
|
|
44
|
+
if (!nextRow)
|
|
45
|
+
break;
|
|
22
46
|
}
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
if (nextRow)
|
|
48
|
+
nextRows.push(nextRow);
|
|
25
49
|
},
|
|
26
50
|
instance
|
|
27
51
|
});
|
|
28
52
|
return nextRows;
|
|
29
53
|
}
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
module.exports = __toCommonJS(recordIterator_exports);
|
|
55
|
+
//# sourceMappingURL=recordIterator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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(\n records,\n strategy = defaultStrategy,\n decorators = [],\n instance,\n) {\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;ACAA,YAAuB;ADAvB,MAAM,kBAAkB,MAAM;AAC5B,QAAM,MAAM;AAAA;AAGP,wBACL,SACA,WAAW,iBACX,aAAa,IACb,UACA;AACA,QAAM,WAAW;AAEjB,WAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI,SAAO;AACT,UAAI,UAAU;AAGd,eAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC1C,kBAAU,WAAW,GAAG,SAAS;AACjC,YAAI,CAAC;AAAS;AAAA;AAGhB,UAAI;AAAS,iBAAS,KAAK;AAAA;AAAA,IAE7B;AAAA;AAGF,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|