@elliemae/ds-shared 3.16.0-next.2 → 3.16.0-next.21
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/Animations/BaseAnimation.js +5 -13
- package/dist/cjs/Animations/BaseAnimation.js.map +2 -2
- package/dist/cjs/Animations/Grow.js +6 -10
- package/dist/cjs/Animations/Grow.js.map +2 -2
- package/dist/cjs/Animations/GrowRight.js +5 -1
- package/dist/cjs/Animations/GrowRight.js.map +2 -2
- package/dist/cjs/Animations/GrowVertical.js +5 -1
- package/dist/cjs/Animations/GrowVertical.js.map +2 -2
- package/dist/cjs/Animations/index.js +8 -4
- package/dist/cjs/Animations/index.js.map +2 -2
- package/dist/cjs/CheckableGroup.js +10 -4
- package/dist/cjs/CheckableGroup.js.map +2 -2
- package/dist/cjs/DeferRenderAfterComputation.js +5 -6
- package/dist/cjs/DeferRenderAfterComputation.js.map +2 -2
- package/dist/cjs/FocusGroup/FocusGrid.js +5 -1
- package/dist/cjs/FocusGroup/FocusGrid.js.map +2 -2
- package/dist/cjs/FocusGroup/FocusGroup.js +4 -0
- package/dist/cjs/FocusGroup/FocusGroup.js.map +1 -1
- package/dist/cjs/FocusGroup/FocusGroupContext.js +4 -0
- package/dist/cjs/FocusGroup/FocusGroupContext.js.map +1 -1
- package/dist/cjs/FocusGroup/FocusGroupManager.js +6 -2
- package/dist/cjs/FocusGroup/FocusGroupManager.js.map +2 -2
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js +17 -16
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js.map +2 -2
- package/dist/cjs/FocusGroup/index.js +11 -7
- package/dist/cjs/FocusGroup/index.js.map +2 -2
- package/dist/cjs/FocusGroup/useFocusGroupItem.js +5 -1
- package/dist/cjs/FocusGroup/useFocusGroupItem.js.map +2 -2
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js +4 -0
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js.map +2 -2
- package/dist/cjs/GroupContext/Group.js +5 -1
- package/dist/cjs/GroupContext/Group.js.map +2 -2
- package/dist/cjs/GroupContext/GroupContext.js +4 -0
- package/dist/cjs/GroupContext/GroupContext.js.map +1 -1
- package/dist/cjs/GroupContext/GroupItem.js +5 -1
- package/dist/cjs/GroupContext/GroupItem.js.map +2 -2
- package/dist/cjs/GroupContext/index.js +7 -3
- package/dist/cjs/GroupContext/index.js.map +2 -2
- package/dist/cjs/ScrollSync/ScrollSync.js +4 -0
- package/dist/cjs/ScrollSync/ScrollSync.js.map +1 -1
- package/dist/cjs/ScrollSync/ScrollSyncPane.js +6 -4
- package/dist/cjs/ScrollSync/ScrollSyncPane.js.map +2 -2
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js +25 -21
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js.map +2 -2
- package/dist/cjs/ScrollSync/index.js +8 -4
- package/dist/cjs/ScrollSync/index.js.map +2 -2
- package/dist/cjs/ScrollSync/useScrollSync.js +5 -3
- package/dist/cjs/ScrollSync/useScrollSync.js.map +2 -2
- package/dist/cjs/constants.js +4 -0
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/createDataInstance/createInstancePlugin.js +4 -0
- package/dist/cjs/createDataInstance/createInstancePlugin.js.map +1 -1
- package/dist/cjs/createDataInstance/createInstanceRef.js +12 -25
- package/dist/cjs/createDataInstance/createInstanceRef.js.map +2 -2
- package/dist/cjs/createDataInstance/index.js +7 -3
- package/dist/cjs/createDataInstance/index.js.map +2 -2
- package/dist/cjs/createDataInstance/utils.js +9 -20
- package/dist/cjs/createDataInstance/utils.js.map +2 -2
- package/dist/cjs/defer-render-hoc/index.js +4 -0
- package/dist/cjs/defer-render-hoc/index.js.map +2 -2
- package/dist/cjs/dimsum.config.js +4 -0
- package/dist/cjs/dimsum.config.js.map +1 -1
- package/dist/cjs/index.js +20 -16
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/prop-types.js +4 -0
- package/dist/cjs/prop-types.js.map +1 -1
- package/dist/cjs/react-spring/index.js +4 -0
- package/dist/cjs/react-spring/index.js.map +1 -1
- package/dist/cjs/react-spring/renderprops.js +4 -0
- package/dist/cjs/react-spring/renderprops.js.map +1 -1
- package/dist/cjs/toolbar/ToolbarProvider.js +4 -0
- package/dist/cjs/toolbar/ToolbarProvider.js.map +1 -1
- package/dist/cjs/useDataGrid/VolatileRowsListener.js +4 -0
- package/dist/cjs/useDataGrid/VolatileRowsListener.js.map +2 -2
- package/dist/cjs/useDataGrid/index.js +7 -3
- package/dist/cjs/useDataGrid/index.js.map +2 -2
- package/dist/cjs/useDataGrid/initColumnDefinition.js +30 -22
- package/dist/cjs/useDataGrid/initColumnDefinition.js.map +2 -2
- package/dist/cjs/useDataGrid/useDataGrid.js +39 -67
- package/dist/cjs/useDataGrid/useDataGrid.js.map +2 -2
- package/dist/cjs/useDataList/index.js +6 -2
- package/dist/cjs/useDataList/index.js.map +2 -2
- package/dist/cjs/useDataList/recordIterator.js +4 -0
- package/dist/cjs/useDataList/recordIterator.js.map +2 -2
- package/dist/cjs/useDataList/useDataList.js +15 -22
- package/dist/cjs/useDataList/useDataList.js.map +3 -3
- package/dist/cjs/utils.js +5 -3
- package/dist/cjs/utils.js.map +2 -2
- package/dist/cjs/virtualization/AutoHeightList.js +4 -0
- package/dist/cjs/virtualization/AutoHeightList.js.map +1 -1
- package/dist/cjs/virtualization/FluidHeightList.js +12 -10
- package/dist/cjs/virtualization/FluidHeightList.js.map +2 -2
- package/dist/cjs/virtualization/index.js +6 -2
- package/dist/cjs/virtualization/index.js.map +2 -2
- package/dist/esm/Animations/BaseAnimation.js +1 -13
- package/dist/esm/Animations/BaseAnimation.js.map +2 -2
- package/dist/esm/Animations/Grow.js +2 -10
- package/dist/esm/Animations/Grow.js.map +2 -2
- package/dist/esm/Animations/GrowRight.js +1 -1
- package/dist/esm/Animations/GrowRight.js.map +1 -1
- package/dist/esm/Animations/GrowVertical.js +1 -1
- package/dist/esm/Animations/GrowVertical.js.map +1 -1
- package/dist/esm/Animations/index.js +4 -4
- package/dist/esm/Animations/index.js.map +1 -1
- package/dist/esm/CheckableGroup.js +6 -4
- package/dist/esm/CheckableGroup.js.map +2 -2
- package/dist/esm/DeferRenderAfterComputation.js +1 -6
- package/dist/esm/DeferRenderAfterComputation.js.map +2 -2
- package/dist/esm/FocusGroup/FocusGrid.js +1 -1
- package/dist/esm/FocusGroup/FocusGrid.js.map +2 -2
- package/dist/esm/FocusGroup/FocusGroup.js.map +1 -1
- package/dist/esm/FocusGroup/FocusGroupManager.js +2 -2
- package/dist/esm/FocusGroup/FocusGroupManager.js.map +2 -2
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js +13 -16
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js.map +2 -2
- package/dist/esm/FocusGroup/index.js +7 -7
- package/dist/esm/FocusGroup/index.js.map +1 -1
- package/dist/esm/FocusGroup/useFocusGroupItem.js +1 -1
- package/dist/esm/FocusGroup/useFocusGroupItem.js.map +2 -2
- package/dist/esm/FocusGroup/utils/getNextCellPosition.js.map +2 -2
- package/dist/esm/GroupContext/Group.js +1 -1
- package/dist/esm/GroupContext/Group.js.map +1 -1
- package/dist/esm/GroupContext/GroupItem.js +1 -1
- package/dist/esm/GroupContext/GroupItem.js.map +2 -2
- package/dist/esm/GroupContext/index.js +3 -3
- package/dist/esm/GroupContext/index.js.map +1 -1
- package/dist/esm/ScrollSync/ScrollSync.js.map +1 -1
- package/dist/esm/ScrollSync/ScrollSyncPane.js +2 -4
- package/dist/esm/ScrollSync/ScrollSyncPane.js.map +2 -2
- package/dist/esm/ScrollSync/ScrollSyncProvider.js +21 -21
- package/dist/esm/ScrollSync/ScrollSyncProvider.js.map +2 -2
- package/dist/esm/ScrollSync/index.js +4 -4
- package/dist/esm/ScrollSync/index.js.map +1 -1
- package/dist/esm/ScrollSync/useScrollSync.js +1 -3
- package/dist/esm/ScrollSync/useScrollSync.js.map +2 -2
- package/dist/esm/createDataInstance/createInstancePlugin.js.map +1 -1
- package/dist/esm/createDataInstance/createInstanceRef.js +8 -29
- package/dist/esm/createDataInstance/createInstanceRef.js.map +2 -2
- package/dist/esm/createDataInstance/index.js +3 -3
- package/dist/esm/createDataInstance/index.js.map +1 -1
- package/dist/esm/createDataInstance/utils.js +5 -20
- package/dist/esm/createDataInstance/utils.js.map +2 -2
- package/dist/esm/defer-render-hoc/index.js.map +2 -2
- package/dist/esm/index.js +16 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +7 -0
- package/dist/esm/useDataGrid/VolatileRowsListener.js.map +2 -2
- package/dist/esm/useDataGrid/index.js +3 -3
- package/dist/esm/useDataGrid/index.js.map +1 -1
- package/dist/esm/useDataGrid/initColumnDefinition.js +27 -29
- package/dist/esm/useDataGrid/initColumnDefinition.js.map +2 -2
- package/dist/esm/useDataGrid/useDataGrid.js +35 -71
- package/dist/esm/useDataGrid/useDataGrid.js.map +2 -2
- package/dist/esm/useDataList/index.js +2 -2
- package/dist/esm/useDataList/index.js.map +1 -1
- package/dist/esm/useDataList/recordIterator.js.map +2 -2
- package/dist/esm/useDataList/useDataList.js +9 -23
- package/dist/esm/useDataList/useDataList.js.map +2 -2
- package/dist/esm/utils.js +1 -3
- package/dist/esm/utils.js.map +2 -2
- package/dist/esm/virtualization/AutoHeightList.js.map +1 -1
- package/dist/esm/virtualization/FluidHeightList.js +8 -10
- package/dist/esm/virtualization/FluidHeightList.js.map +2 -2
- package/dist/esm/virtualization/index.js +2 -2
- package/dist/esm/virtualization/index.js.map +1 -1
- package/dist/types/Animations/BaseAnimation.d.ts +1 -0
- package/dist/types/Animations/Grow.d.ts +2 -1
- package/dist/types/Animations/GrowRight.d.ts +1 -0
- package/dist/types/Animations/GrowVertical.d.ts +1 -0
- package/dist/types/Animations/index.d.ts +4 -4
- package/dist/types/CheckableGroup.d.ts +8 -9
- package/dist/types/DeferRenderAfterComputation.d.ts +1 -1
- package/dist/types/FocusGroup/focusGroupManagerHoc.d.ts +1 -0
- package/dist/types/FocusGroup/index.d.ts +7 -7
- package/dist/types/GroupContext/GroupItem.d.ts +1 -0
- package/dist/types/GroupContext/index.d.ts +3 -3
- package/dist/types/ScrollSync/ScrollSyncPane.d.ts +1 -0
- package/dist/types/ScrollSync/ScrollSyncProvider.d.ts +11 -10
- package/dist/types/ScrollSync/index.d.ts +4 -4
- package/dist/types/createDataInstance/index.d.ts +3 -3
- package/dist/types/index.d.ts +16 -16
- package/dist/types/useDataGrid/index.d.ts +3 -3
- package/dist/types/useDataList/index.d.ts +2 -2
- package/dist/types/virtualization/index.d.ts +2 -2
- package/package.json +8 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/useDataGrid/initColumnDefinition.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { get, curry, set, cloneDeep, isFunction } 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((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\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 =\n (options = {}) =>\n // eslint-disable-next-line complexity\n (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 {\n useTextTruncation = true,\n isUserColumn,\n visible,\n normalize,\n } = {\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 (useTextTruncation && !(isFunction(column.customHeaderRenderer) || column.header.formatters.length)) {\n column.header.formatters.push((value) => <span className=\"cell-value\">{value}</span>);\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 (useTextTruncation && !(isFunction(column.customRenderer) || column.cell.formatters.length)) {\n column.cell.formatters.push((value) => (\n <span\n className=\"cell-value\"\n style={{\n justifyContent: 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\nexport default initColumnDefinition;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiGwB;AA9F/C,kBAA6B;AAC7B,0BAAuD;AAIhD,MAAM,4BAAwB,2BAAM,CAAC,WAAW,YAAY;AAAA,EACjE,GAAG;AAAA,EACH,QAAQ;AAAA,IACN,GAAG,OAAO;AAAA,IACV,YAAY,CAAC,OAAG,yBAAI,QAAQ,qBAAqB,CAAC,CAAC,GAAG,SAAS;AAAA,EACjE;AACF,EAAE;AAEK,MAAM,0BAAsB,2BAAM,CAAC,WAAW,QAAQ,OAAO,iBAAiB;AACnF,QAAM,iBAAa,+BAAU,MAAM;AACnC,QAAM,iBAAa,yBAAI,YAAY,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;AACrD,QAAM,0BAAsB,yBAAI,YAAY,4BAA4B,CAAC,CAAC;AAC1E,MAAI,MAAM,QAAQ,SAAS,GAAG;AAC5B,QAAI,UAAU,CAAC;AAAG,0BAAoB,KAAK,UAAU,CAAC,CAAC;AACvD,eAAW,KAAK,UAAU,CAAC,CAAC;AAAA,EAC9B,OAAO;AACL,eAAW,KAAK,SAAS;AACzB,wBAAoB,KAAK,SAAS;AAAA,EACpC;AACA,+BAAI,YAAY,CAAC,QAAQ,IAAI,GAAG,UAAU;AAC1C,+BAAI,YAAY,4BAA4B,mBAAmB;AAC/D,SAAO;AACT,CAAC;AAED,MAAM,iCAAiC;AAAA,EACrC,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,S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G,OAAO;AAAA,MACV,YAAY,CAAC;AAAA,MACb,YAAY,CAAC,OAAG,yBAAI,QAAQ,CAAC,QAAQ,YAAY,GAAG,CAAC,CAAC,CAAC;AAAA,MACvD,qBAAqB,CAAC,OAAG,yBAAI,QAAQ,CAAC,QAAQ,YAAY,GAAG,CAAC,CAAC,CAAC;AAAA,MAChE,OAAO;AAAA,QACL,OAAO,OAAO,aAAa,CAAC;AAAA,MAC9B;AAAA,IACF;AAEA,QAAI,qBAAqB,MAAE,gCAAW,OAAO,cAAc,KAAK,OAAO,KAAK,WAAW,SAAS;AAC9F,aAAO,KAAK,WAAW,KAAK,CAAC,UAC3B;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO;AAAA,YACL,gBAAgB,OAAO,SAAS,WAAW,aAAa;AAAA,UAC1D;AAAA,UAEC;AAAA;AAAA,MACH,CACD;AAAA,IACH;AAEA,WAAO,OAAO,OAAO,YAAQ,YAAAA,IAAO;AAEpC,WAAO,UAAU,OAAO,YAAY,SAAY,UAAU,OAAO;AAEjE,WAAO,eAAe,OAAO,gBAAgB;AAE7C,WAAO,oBAAoB,CAAC;AAC5B,WAAO;AAAA,EACT;AAAA;AAEF,IAAO,+BAAQ;",
|
|
6
6
|
"names": ["uuidv4"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -33,19 +37,12 @@ var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
|
33
37
|
var import_react = require("react");
|
|
34
38
|
var import_uuid = require("uuid");
|
|
35
39
|
var resolve = __toESM(require("table-resolver"));
|
|
36
|
-
var import_initColumnDefinition = require("./initColumnDefinition");
|
|
37
|
-
var import_utils = require("../createDataInstance/utils");
|
|
38
|
-
var import_VolatileRowsListener = require("./VolatileRowsListener");
|
|
39
|
-
var import_utils2 = require("../utils");
|
|
40
|
+
var import_initColumnDefinition = require("./initColumnDefinition.js");
|
|
41
|
+
var import_utils = require("../createDataInstance/utils.js");
|
|
42
|
+
var import_VolatileRowsListener = require("./VolatileRowsListener.js");
|
|
43
|
+
var import_utils2 = require("../utils.js");
|
|
40
44
|
const IS_INTERNET_EXPLORER = (0, import_utils2.isInternetExplorer)();
|
|
41
|
-
const useDataGrid = ({
|
|
42
|
-
uuid: uuidProp,
|
|
43
|
-
plugins: pluginsFromProps,
|
|
44
|
-
rows,
|
|
45
|
-
columns,
|
|
46
|
-
renderers = {},
|
|
47
|
-
...props
|
|
48
|
-
}) => {
|
|
45
|
+
const useDataGrid = ({ uuid: uuidProp, plugins: pluginsFromProps, rows, columns, renderers = {}, ...props }) => {
|
|
49
46
|
const plugins = pluginsFromProps;
|
|
50
47
|
const instance = (0, import_react.useRef)();
|
|
51
48
|
const tableRef = (0, import_react.useRef)();
|
|
@@ -61,10 +58,7 @@ const useDataGrid = ({
|
|
|
61
58
|
const [originalRows, updateRows] = (0, import_ds_utilities.useDerivedStateFromProps)(rows, {
|
|
62
59
|
onUpdate: resolve.resolve({
|
|
63
60
|
columns,
|
|
64
|
-
method: (extra) => (0, import_ds_utilities.compose)(
|
|
65
|
-
resolve.byFunction("valueTransformation")(extra),
|
|
66
|
-
resolve.nested(extra)
|
|
67
|
-
)
|
|
61
|
+
method: (extra) => (0, import_ds_utilities.compose)(resolve.byFunction("valueTransformation")(extra), resolve.nested(extra))
|
|
68
62
|
}),
|
|
69
63
|
updateOnStateChange: true
|
|
70
64
|
});
|
|
@@ -94,7 +88,9 @@ const useDataGrid = ({
|
|
|
94
88
|
updateRows
|
|
95
89
|
},
|
|
96
90
|
updateRows,
|
|
91
|
+
// eslint-disable-next-line no-return-assign
|
|
97
92
|
enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? "" : null,
|
|
93
|
+
// eslint-disable-next-line no-return-assign
|
|
98
94
|
disableEvents: () => document.body.style.pointerEvents = "none",
|
|
99
95
|
observeRows: (observer) => RowsObserver.observe(observer),
|
|
100
96
|
hotKeys: {},
|
|
@@ -141,23 +137,20 @@ const useDataGrid = ({
|
|
|
141
137
|
}),
|
|
142
138
|
instance.current
|
|
143
139
|
);
|
|
144
|
-
instance.current = decorators.registerStateHook.reduce(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
state
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
actions
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
instance.current
|
|
160
|
-
);
|
|
140
|
+
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
141
|
+
const { state, actions } = decorator(instance.current);
|
|
142
|
+
return {
|
|
143
|
+
...nextInstance,
|
|
144
|
+
state: {
|
|
145
|
+
...nextInstance.state,
|
|
146
|
+
...state
|
|
147
|
+
},
|
|
148
|
+
actions: {
|
|
149
|
+
...nextInstance.actions,
|
|
150
|
+
...actions
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}, instance.current);
|
|
161
154
|
const reduceHotKey = (nextInstance, { key, handler, options }) => ({
|
|
162
155
|
...nextInstance,
|
|
163
156
|
hotKeys: {
|
|
@@ -165,16 +158,13 @@ const useDataGrid = ({
|
|
|
165
158
|
[key]: { handler, options }
|
|
166
159
|
}
|
|
167
160
|
});
|
|
168
|
-
instance.current = decorators.registerHotKeys.reduce(
|
|
169
|
-
(nextInstance
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
instance.current
|
|
177
|
-
);
|
|
161
|
+
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
162
|
+
const hotKeys = decorator(nextInstance);
|
|
163
|
+
if (Array.isArray(hotKeys)) {
|
|
164
|
+
return hotKeys.reduce(reduceHotKey, nextInstance);
|
|
165
|
+
}
|
|
166
|
+
return reduceHotKey(nextInstance, hotKeys);
|
|
167
|
+
}, instance.current);
|
|
178
168
|
instance.current.decoratedRenderers = (0, import_utils.applyDecorators)(
|
|
179
169
|
instance.current.decoratedRenderers,
|
|
180
170
|
decorators.decorateRenderers,
|
|
@@ -186,26 +176,11 @@ const useDataGrid = ({
|
|
|
186
176
|
);
|
|
187
177
|
return visibleColumns.length ? (0, import_utils.decorateColumns)(visibleColumns, decorators, instance.current) : [];
|
|
188
178
|
}, [columns]);
|
|
189
|
-
instance.current.getBodyProps = (0, import_utils.reducePropsGetter)(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
);
|
|
193
|
-
instance.current.
|
|
194
|
-
decorators.getHeaderProps,
|
|
195
|
-
instance.current
|
|
196
|
-
);
|
|
197
|
-
instance.current.getRowProps = (0, import_utils.reducePropsGetter)(
|
|
198
|
-
decorators.getRowProps,
|
|
199
|
-
instance.current
|
|
200
|
-
);
|
|
201
|
-
instance.current.getHeaderRowProps = (0, import_utils.reducePropsGetter)(
|
|
202
|
-
decorators.getHeaderRowProps,
|
|
203
|
-
instance.current
|
|
204
|
-
);
|
|
205
|
-
instance.current.getTableProps = (0, import_utils.reducePropsGetter)(
|
|
206
|
-
decorators.getTableProps,
|
|
207
|
-
instance.current
|
|
208
|
-
);
|
|
179
|
+
instance.current.getBodyProps = (0, import_utils.reducePropsGetter)(decorators.getBodyProps, instance.current);
|
|
180
|
+
instance.current.getHeaderProps = (0, import_utils.reducePropsGetter)(decorators.getHeaderProps, instance.current);
|
|
181
|
+
instance.current.getRowProps = (0, import_utils.reducePropsGetter)(decorators.getRowProps, instance.current);
|
|
182
|
+
instance.current.getHeaderRowProps = (0, import_utils.reducePropsGetter)(decorators.getHeaderRowProps, instance.current);
|
|
183
|
+
instance.current.getTableProps = (0, import_utils.reducePropsGetter)(decorators.getTableProps, instance.current);
|
|
209
184
|
instance.current.composedRows = decorators.composeRows.reduce(
|
|
210
185
|
(nextRows, getter) => getter(nextRows, instance.current),
|
|
211
186
|
instance.current.composedRows
|
|
@@ -216,10 +191,7 @@ const useDataGrid = ({
|
|
|
216
191
|
if ((0, import_ds_utilities.isObject)(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
217
192
|
instance.current.shouldRefocus.current = currentShouldRefocus.value;
|
|
218
193
|
} else {
|
|
219
|
-
instance.current.shouldRefocus.current = !(0, import_ds_utilities.isEqual)(
|
|
220
|
-
prevState,
|
|
221
|
-
instance.current.state
|
|
222
|
-
);
|
|
194
|
+
instance.current.shouldRefocus.current = !(0, import_ds_utilities.isEqual)(prevState, instance.current.state);
|
|
223
195
|
}
|
|
224
196
|
if (props.instanceRef)
|
|
225
197
|
(0, import_ds_utilities.setRef)(props.instanceRef, instance.current);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport {\n cloneDeep,\n compose,\n isEqual,\n isObject,\n setRef,\n usePrevious,\n useDerivedStateFromProps,\n} from '@elliemae/ds-utilities';\nimport { useMemo, useRef, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport * as resolve from 'table-resolver';\nimport { initColumnDefinition } from './initColumnDefinition.js';\nimport { applyDecorators, decorateColumns, reducePropsGetter } from '../createDataInstance/utils.js';\nimport { VolatileRowsListener } from './VolatileRowsListener.js';\nimport { isInternetExplorer } from '../utils.js';\n\nconst IS_INTERNET_EXPLORER = isInternetExplorer();\n\n// TODO: Reuse createDataInstance for the grid the same\n// way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js\n// eslint-disable-next-line max-statements\nexport const useDataGrid = ({ uuid: uuidProp, plugins: pluginsFromProps, rows, columns, renderers = {}, ...props }) => {\n const plugins = pluginsFromProps;\n const instance = useRef();\n const tableRef = useRef();\n const headerRef = useRef();\n const bodyRef = useRef();\n const bodyInnerRef = useRef();\n const [uuid] = useState(uuidProp || (() => uuidv4()));\n const [hasScroll, setHasScroll] = useState(false);\n const [isRowDragging, setIsRowDragging] = useState(false);\n const isScrolling = useRef();\n const shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff\n const [RowsObserver] = useState(() => new VolatileRowsListener());\n\n // todo move this with rows composition\n const [originalRows, updateRows] = useDerivedStateFromProps(rows, {\n onUpdate: resolve.resolve({\n columns,\n method: (extra) => compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra)),\n }),\n updateOnStateChange: true,\n });\n\n instance.current = {\n decoratedRenderers: cloneDeep(renderers),\n decoratedColumns: columns,\n columns,\n rows,\n composedRows: originalRows,\n getRowProps: [],\n getHeaderRowProps: [],\n getBodyProps: [],\n getTableProps: [],\n effects: [],\n uuid,\n props,\n refs: {\n table: tableRef,\n body: bodyRef,\n header: headerRef,\n innerBody: bodyInnerRef,\n },\n state: {\n hasScroll,\n },\n actions: {\n updateRows,\n },\n updateRows,\n // eslint-disable-next-line no-return-assign\n enableEvents: () => (document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null),\n // eslint-disable-next-line no-return-assign\n disableEvents: () => (document.body.style.pointerEvents = 'none'),\n observeRows: (observer) => RowsObserver.observe(observer),\n hotKeys: {},\n shouldRefocus,\n isScrolling,\n setHasScroll,\n setIsRowDragging,\n isRowDragging,\n plugins,\n };\n instance.current.getState = () => instance.current.state;\n instance.current.getInstance = () => instance.current;\n\n const defaultDecorators = {\n decorateGrid: [],\n registerStateHook: [],\n registerHotKeys: [],\n decorateColumn: [],\n decorateColumns: [\n (cols) =>\n cols.map((col) =>\n initColumnDefinition({\n useTextTruncation: col.useTextTruncation,\n wrapText: props.wrapText,\n normalize: props.normalizeDataKeys,\n })(col),\n ),\n ],\n decorateRenderers: [],\n getRowProps: [],\n getHeaderRowProps: [],\n getBodyProps: [],\n getTableProps: [],\n getHeaderProps: [],\n composeRows: [],\n };\n\n const decorators = useMemo(() => {\n let nextDecorators = defaultDecorators;\n // eslint-disable-next-line no-return-assign\n plugins.forEach((plugin) => (nextDecorators = plugin(nextDecorators)));\n return nextDecorators;\n }, [plugins]);\n\n instance.current = decorators.decorateGrid.reduce(\n (nextInstance, decorator) => ({\n ...nextInstance,\n ...decorator(instance.current),\n }),\n instance.current,\n );\n\n instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {\n const { state, actions } = decorator(instance.current);\n return {\n ...nextInstance,\n state: {\n ...nextInstance.state,\n ...state,\n },\n actions: {\n ...nextInstance.actions,\n ...actions,\n },\n };\n }, instance.current);\n\n const reduceHotKey = (nextInstance, { key, handler, options }) => ({\n ...nextInstance,\n hotKeys: {\n ...nextInstance.hotKeys,\n [key]: { handler, options },\n },\n });\n instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {\n const hotKeys = decorator(nextInstance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, nextInstance);\n }\n return reduceHotKey(nextInstance, hotKeys);\n }, instance.current);\n\n instance.current.decoratedRenderers = applyDecorators(\n instance.current.decoratedRenderers,\n decorators.decorateRenderers,\n instance.current,\n );\n\n instance.current.decoratedColumns = useMemo(() => {\n const visibleColumns = cloneDeep(columns).filter(\n (column) => typeof column.visible === 'undefined' || column.visible,\n );\n return visibleColumns.length ? decorateColumns(visibleColumns, decorators, instance.current) : [];\n }, [columns]);\n\n instance.current.getBodyProps = reducePropsGetter(decorators.getBodyProps, instance.current);\n instance.current.getHeaderProps = reducePropsGetter(decorators.getHeaderProps, instance.current);\n instance.current.getRowProps = reducePropsGetter(decorators.getRowProps, instance.current);\n instance.current.getHeaderRowProps = reducePropsGetter(decorators.getHeaderRowProps, instance.current);\n instance.current.getTableProps = reducePropsGetter(decorators.getTableProps, instance.current);\n\n instance.current.composedRows = decorators.composeRows.reduce(\n (nextRows, getter) => getter(nextRows, instance.current),\n instance.current.composedRows,\n );\n\n RowsObserver.notify(instance.current.composedRows);\n\n const currentShouldRefocus = instance.current.shouldRefocus.current;\n const prevState = usePrevious(instance.current.state);\n if (isObject(currentShouldRefocus) && currentShouldRefocus.forced) {\n instance.current.shouldRefocus.current = currentShouldRefocus.value;\n } else {\n instance.current.shouldRefocus.current = !isEqual(prevState, instance.current.state);\n }\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return {\n ...instance.current,\n decorators,\n };\n};\n\nexport default useDataGrid;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAQO;AACP,mBAA0C;AAC1C,kBAA6B;AAC7B,cAAyB;AACzB,kCAAqC;AACrC,mBAAoE;AACpE,kCAAqC;AACrC,IAAAA,gBAAmC;AAEnC,MAAM,2BAAuB,kCAAmB;AAKzC,MAAM,cAAc,CAAC,EAAE,MAAM,UAAU,SAAS,kBAAkB,MAAM,SAAS,YAAY,CAAC,GAAG,GAAG,MAAM,MAAM;AACrH,QAAM,UAAU;AAChB,QAAM,eAAW,qBAAO;AACxB,QAAM,eAAW,qBAAO;AACxB,QAAM,gBAAY,qBAAO;AACzB,QAAM,cAAU,qBAAO;AACvB,QAAM,mBAAe,qBAAO;AAC5B,QAAM,CAAC,IAAI,QAAI,uBAAS,aAAa,UAA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AAY;AAEjD,QAAM,uBAAuB,SAAS,QAAQ,cAAc;AAC5D,QAAM,gBAAY,iCAAY,SAAS,QAAQ,KAAK;AACpD,UAAI,8BAAS,oBAAoB,KAAK,qBAAqB,QAAQ;AACjE,aAAS,QAAQ,cAAc,UAAU,qBAAqB;AAAA,EAChE,OAAO;AACL,aAAS,QAAQ,cAAc,UAAU,KAAC,6BAAQ,WAAW,SAAS,QAAQ,KAAK;AAAA,EACrF;AAEA,MAAI,MAAM;AAAa,oCAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO;AAAA,IACL,GAAG,SAAS;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["import_utils", "uuidv4"]
|
|
7
7
|
}
|
|
@@ -15,6 +15,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
};
|
|
16
16
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
17
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
18
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
19
23
|
mod
|
|
20
24
|
));
|
|
@@ -22,6 +26,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
26
|
var useDataList_exports = {};
|
|
23
27
|
module.exports = __toCommonJS(useDataList_exports);
|
|
24
28
|
var React = __toESM(require("react"));
|
|
25
|
-
__reExport(useDataList_exports, require("./useDataList"), module.exports);
|
|
26
|
-
__reExport(useDataList_exports, require("./recordIterator"), module.exports);
|
|
29
|
+
__reExport(useDataList_exports, require("./useDataList.js"), module.exports);
|
|
30
|
+
__reExport(useDataList_exports, require("./recordIterator.js"), module.exports);
|
|
27
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/useDataList/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './useDataList';\nexport * from './recordIterator';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export * from './useDataList.js';\nexport * from './recordIterator.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,6BAAd;AACA,gCAAc,gCADd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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(
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["const defaultStrategy = () => {\n throw Error('Implement an iterator strategy for record iterator');\n};\n\nexport function recordIterator(records, strategy = defaultStrategy, decorators = [], instance) {\n const nextRows = [];\n\n strategy({\n data: records,\n cb: (row) => {\n let nextRow = row;\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let i = 0; i < decorators.length; i++) {\n nextRow = decorators[i](nextRow, instance);\n if (!nextRow) break;\n }\n\n if (nextRow) nextRows.push(nextRow);\n },\n instance,\n });\n\n return nextRows;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,MAAM,kBAAkB,MAAM;AAC5B,QAAM,MAAM,oDAAoD;AAClE;AAEO,SAAS,eAAe,SAAS,WAAW,iBAAiB,aAAa,CAAC,GAAG,UAAU;AAC7F,QAAM,WAAW,CAAC;AAElB,WAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI,CAAC,QAAQ;AACX,UAAI,UAAU;AAGd,eAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC1C,kBAAU,WAAW,CAAC,EAAE,SAAS,QAAQ;AACzC,YAAI,CAAC;AAAS;AAAA,MAChB;AAEA,UAAI;AAAS,iBAAS,KAAK,OAAO;AAAA,IACpC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -33,12 +37,12 @@ module.exports = __toCommonJS(useDataList_exports);
|
|
|
33
37
|
var React = __toESM(require("react"));
|
|
34
38
|
var import_react = require("react");
|
|
35
39
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
36
|
-
var
|
|
37
|
-
var import_utils = require("../createDataInstance/utils");
|
|
38
|
-
var import_recordIterator = require("./recordIterator");
|
|
39
|
-
var import_createInstanceRef = require("../createDataInstance/createInstanceRef");
|
|
40
|
-
const getItemLabel = (record, nameKey = "name") => (0,
|
|
41
|
-
const getItemChildren = (record, childrenKey = "children") => (0,
|
|
40
|
+
var import_lodash = require("lodash");
|
|
41
|
+
var import_utils = require("../createDataInstance/utils.js");
|
|
42
|
+
var import_recordIterator = require("./recordIterator.js");
|
|
43
|
+
var import_createInstanceRef = require("../createDataInstance/createInstanceRef.js");
|
|
44
|
+
const getItemLabel = (record, nameKey = "name") => (0, import_lodash.get)(record, ["data", nameKey]);
|
|
45
|
+
const getItemChildren = (record, childrenKey = "children") => (0, import_lodash.get)(record, ["data", childrenKey]);
|
|
42
46
|
const listRenderers = {
|
|
43
47
|
list: "ul",
|
|
44
48
|
item: "li"
|
|
@@ -62,6 +66,7 @@ const useDataList = ({
|
|
|
62
66
|
getListProps: [],
|
|
63
67
|
getItemProps: [],
|
|
64
68
|
itemRenderer: [...itemRenderer],
|
|
69
|
+
// components reduce to compose item content
|
|
65
70
|
record: [],
|
|
66
71
|
records: []
|
|
67
72
|
},
|
|
@@ -74,18 +79,9 @@ const useDataList = ({
|
|
|
74
79
|
instance.current.getItemLabel = (record) => getItemLabel(record, props.nameKey);
|
|
75
80
|
instance.current.getItemChildren = (record) => getItemChildren(record, props.childrenKey);
|
|
76
81
|
instance.current.decorators = decorators;
|
|
77
|
-
instance.current.getListProps = (0, import_utils.reducePropsGetter)(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
);
|
|
81
|
-
instance.current.getItemProps = (0, import_utils.reducePropsGetter)(
|
|
82
|
-
decorators.getItemProps,
|
|
83
|
-
instance.current
|
|
84
|
-
);
|
|
85
|
-
instance.current.itemRenderer = (0, import_utils.composeFormatters)(
|
|
86
|
-
instance.current.decorators.itemRenderer,
|
|
87
|
-
instance.current
|
|
88
|
-
);
|
|
82
|
+
instance.current.getListProps = (0, import_utils.reducePropsGetter)(decorators.getListProps, instance.current);
|
|
83
|
+
instance.current.getItemProps = (0, import_utils.reducePropsGetter)(decorators.getItemProps, instance.current);
|
|
84
|
+
instance.current.itemRenderer = (0, import_utils.composeFormatters)(instance.current.decorators.itemRenderer, instance.current);
|
|
89
85
|
instance.current.records = (0, import_react.useMemo)(() => {
|
|
90
86
|
let nextRecords = (0, import_recordIterator.recordIterator)(
|
|
91
87
|
data,
|
|
@@ -93,10 +89,7 @@ const useDataList = ({
|
|
|
93
89
|
decorators.record,
|
|
94
90
|
instance.current
|
|
95
91
|
);
|
|
96
|
-
nextRecords = decorators.records.reduce(
|
|
97
|
-
(nextRows, getter) => getter(nextRows, instance.current),
|
|
98
|
-
nextRecords
|
|
99
|
-
);
|
|
92
|
+
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
100
93
|
return nextRecords;
|
|
101
94
|
});
|
|
102
95
|
if (props.instanceRef)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/useDataList/useDataList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport get from 'lodash
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport { get } from 'lodash';\nimport { composeFormatters, reducePropsGetter } from '../createDataInstance/utils.js';\nimport { recordIterator } from './recordIterator.js';\nimport { createDataInstanceRef } from '../createDataInstance/createInstanceRef.js';\n\nexport const getItemLabel = (record, nameKey = 'name') => get(record, ['data', nameKey]);\nexport const getItemChildren = (record, childrenKey = 'children') => get(record, ['data', childrenKey]);\n\nconst listRenderers = {\n list: 'ul',\n item: 'li',\n};\n\n// todo: check if a plugin is a LIST plugin rather than GRID\nexport const useDataList = ({\n data = [],\n plugins = [],\n renderers = listRenderers,\n itemRenderer = [],\n customDecorators,\n ...props\n}) => {\n const listRef = useRef();\n const { instance, decorators } = createDataInstanceRef({\n data,\n renderers,\n plugins,\n customDecorators: {\n ...customDecorators,\n recordIterator,\n getListProps: [],\n getItemProps: [],\n itemRenderer: [...itemRenderer], // components reduce to compose item content\n record: [],\n records: [],\n },\n ...props,\n });\n instance.current.getListRef = () => listRef;\n instance.current.setListRef = (ref) => {\n listRef.current = ref;\n };\n instance.current.getItemLabel = (record) => getItemLabel(record, props.nameKey);\n instance.current.getItemChildren = (record) => getItemChildren(record, props.childrenKey);\n\n instance.current.decorators = decorators;\n instance.current.getListProps = reducePropsGetter(decorators.getListProps, instance.current);\n instance.current.getItemProps = reducePropsGetter(decorators.getItemProps, instance.current);\n instance.current.itemRenderer = composeFormatters(instance.current.decorators.itemRenderer, instance.current);\n\n instance.current.records = useMemo(() => {\n // record iterator TREE / Simple\n let nextRecords = recordIterator(\n data,\n instance.current.decorators.recordIterator,\n decorators.record,\n instance.current,\n );\n\n // compose all records\n nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);\n\n return nextRecords;\n });\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return instance.current;\n};\n\nexport default useDataList;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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OAAO;AAC3F,WAAS,QAAQ,mBAAe,gCAAkB,SAAS,QAAQ,WAAW,cAAc,SAAS,OAAO;AAE5G,WAAS,QAAQ,cAAU,sBAAQ,MAAM;AAEvC,QAAI,kBAAc;AAAA,MAChB;AAAA,MACA,SAAS,QAAQ,WAAW;AAAA,MAC5B,WAAW;AAAA,MACX,SAAS;AAAA,IACX;AAGA,kBAAc,WAAW,QAAQ,OAAO,CAAC,UAAU,WAAW,OAAO,UAAU,SAAS,OAAO,GAAG,WAAW;AAE7G,WAAO;AAAA,EACT,CAAC;AAED,MAAI,MAAM;AAAa,oCAAO,MAAM,aAAa,SAAS,OAAO;AAEjE,SAAO,SAAS;AAClB;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/cjs/utils.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -88,9 +92,7 @@ const listWithChildren = (list, childrenProp) => list.map((item) => ({
|
|
|
88
92
|
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
89
93
|
let childrenIds = [];
|
|
90
94
|
const ids = items.filter((item) => item[childrenProp].length).map((item) => {
|
|
91
|
-
childrenIds = childrenIds.concat(
|
|
92
|
-
getAllNonEmptyNodesIds(item[childrenProp], childrenProp)
|
|
93
|
-
);
|
|
95
|
+
childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
|
|
94
96
|
return item.id;
|
|
95
97
|
});
|
|
96
98
|
return ids.concat(childrenIds);
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-cond-assign */\nexport const objectType = (obj)
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-cond-assign */\nexport const objectType = (obj) => Object.prototype.toString.call(obj).slice(8, -1);\nexport const isDefined = (param) => typeof param !== 'undefined';\nexport const isUndefined = (param) => typeof param === 'undefined';\nexport const isFunction = (param) => typeof param === 'function';\nexport const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line\nexport const isString = (str) => objectType(str) === 'String';\nexport const isArray = (arr) => objectType(arr) === 'Array';\n\nexport const closest = (target, selector) => {\n // closest(e.target, '.field')\n while (target) {\n // eslint-disable-line\n if (target.matches && target.matches(selector)) return target;\n if (target.msMatchesSelector && target.msMatchesSelector(selector)) return target;\n // eslint-disable-next-line no-param-reassign\n target = target.parentNode;\n }\n return null;\n};\n\nexport const getOffsetRect = (elem) => {\n // (1)\n const box = elem.getBoundingClientRect();\n\n const { body, documentElement } = document;\n\n // (2)\n const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;\n const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;\n\n // (3)\n const clientTop = documentElement.clientTop || body.clientTop || 0;\n const clientLeft = documentElement.clientLeft || body.clientLeft || 0;\n\n // (4)\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return { top: Math.round(top), left: Math.round(left) };\n};\n\nexport const getTotalScroll = (elem) => {\n let top = 0;\n let left = 0;\n\n // eslint-disable-next-line no-param-reassign\n while ((elem = elem.parentNode)) {\n top += elem.scrollTop || 0;\n left += elem.scrollLeft || 0;\n }\n\n return { top, left };\n};\n\nexport const getTransformProps = (x, y) => ({\n transform: `translate(${x}px, ${y}px)`,\n});\n\nexport const listWithChildren = (list, childrenProp) =>\n list.map((item) => ({\n ...item,\n [childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : [],\n }));\n\nexport const getAllNonEmptyNodesIds = (items, childrenProp) => {\n let childrenIds = [];\n const ids = items\n .filter((item) => item[childrenProp].length)\n .map((item) => {\n childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));\n return item.id;\n });\n\n return ids.concat(childrenIds);\n};\n\nexport const isInternetExplorer = () => {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf('MSIE ');\n // If Internet Explorer, return version number\n if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\\./)) {\n return true;\n }\n return false;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADChB,MAAM,aAAa,CAAC,QAAQ,OAAO,UAAU,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE;AAC3E,MAAM,YAAY,CAAC,UAAU,OAAO,UAAU;AAC9C,MAAM,cAAc,CAAC,UAAU,OAAO,UAAU;AAChD,MAAM,aAAa,CAAC,UAAU,OAAO,UAAU;AAC/C,MAAM,WAAW,WAAS,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK;AACnE,MAAM,WAAW,CAAC,QAAQ,WAAW,GAAG,MAAM;AAC9C,MAAM,UAAU,CAAC,QAAQ,WAAW,GAAG,MAAM;AAE7C,MAAM,UAAU,CAAC,QAAQ,aAAa;AAE3C,SAAO,QAAQ;AAEb,QAAI,OAAO,WAAW,OAAO,QA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AAuB,KAAK,YAAY,GAAG,YAAY,CAAC;AACzF,WAAO,KAAK;AAAA,EACd,CAAC;AAEH,SAAO,IAAI,OAAO,WAAW;AAC/B;AAEO,MAAM,qBAAqB,MAAM;AACtC,QAAM,KAAK,OAAO,UAAU;AAC5B,QAAM,OAAO,GAAG,QAAQ,OAAO;AAE/B,MAAI,OAAO,KAAK,CAAC,CAAC,UAAU,UAAU,MAAM,kBAAkB,GAAG;AAC/D,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/virtualization/AutoHeightList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4BjB;AA5BN,mBAA0C;AAC1C,0BAAsC;AACtC,0BAAqD;AAE9C,MAAM,qBAAiB;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,gBAAgB,oBAAAA;AAAA,IAC3B,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,cAAU,qBAAO;AACvB,UAAM,mBAAe,qBAAO;AAE5B,mDAAsB;AAAA,MACpB,cAAc;AAAA,MACd;AAAA,IACF,CAAC;AAED,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAK,+BAAU,KAAK,OAAO;AAAA,QAC3B,eAAW,wBAAG,WAAW,0BAA0B;AAAA,QACnD,QAAQ,OAAO;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAU,+BAAU,cAAc,QAAQ;AAAA,QAC1C,eAAe;AAAA,QACf,gBAAc;AAAA;AAAA,IAChB;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["List"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -31,14 +35,12 @@ var React = __toESM(require("react"));
|
|
|
31
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
36
|
var import_react = require("react");
|
|
33
37
|
var import_react_virtualized_auto_sizer = __toESM(require("react-virtualized-auto-sizer"));
|
|
34
|
-
const FluidHeightList = (0, import_react.forwardRef)(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
) })
|
|
43
|
-
);
|
|
38
|
+
const FluidHeightList = (0, import_react.forwardRef)(({ component: Component, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_virtualized_auto_sizer.default, { disableWidth: true, children: ({ height: fluidHeight }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
39
|
+
Component,
|
|
40
|
+
{
|
|
41
|
+
...props,
|
|
42
|
+
ref,
|
|
43
|
+
height: fluidHeight - 32
|
|
44
|
+
}
|
|
45
|
+
) }));
|
|
44
46
|
//# sourceMappingURL=FluidHeightList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/virtualization/FluidHeightList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { forwardRef } from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nexport const FluidHeightList = forwardRef(
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React, { forwardRef } from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nexport const FluidHeightList = forwardRef(({ 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMjB;AANN,mBAAkC;AAClC,0CAAsB;AAEf,MAAM,sBAAkB,yBAAW,CAAC,EAAE,WAAW,WAAW,GAAG,MAAM,GAAG,QAC7E,4CAAC,oCAAAA,SAAA,EAAU,cAAY,MACpB,WAAC,EAAE,QAAQ,YAAY,MACtB;AAAA,EAAC;AAAA;AAAA,IACE,GAAG;AAAA,IACJ;AAAA,IACA,QAAQ,cAAc;AAAA;AACxB,GAEJ,CACD;",
|
|
6
6
|
"names": ["AutoSizer"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -30,8 +34,8 @@ __export(virtualization_exports, {
|
|
|
30
34
|
});
|
|
31
35
|
module.exports = __toCommonJS(virtualization_exports);
|
|
32
36
|
var React = __toESM(require("react"));
|
|
33
|
-
var import_FluidHeightList = require("./FluidHeightList");
|
|
34
|
-
var import_AutoHeightList = require("./AutoHeightList");
|
|
37
|
+
var import_FluidHeightList = require("./FluidHeightList.js");
|
|
38
|
+
var import_AutoHeightList = require("./AutoHeightList.js");
|
|
35
39
|
function getVirtualListComponent({ component: Component, fluid, height, autoHeight }) {
|
|
36
40
|
if (autoHeight)
|
|
37
41
|
return import_AutoHeightList.AutoHeightList;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/virtualization/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { FluidHeightList } from './FluidHeightList';\nimport { AutoHeightList } from './AutoHeightList';\n\nexport { FluidHeightList, AutoHeightList };\n\nexport function getVirtualListComponent({ component: Component, fluid, height, autoHeight }) {\n if (autoHeight) return AutoHeightList;\n if (fluid) return FluidHeightList;\n return Component;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { FluidHeightList } from './FluidHeightList.js';\nimport { AutoHeightList } from './AutoHeightList.js';\n\nexport { FluidHeightList, AutoHeightList };\n\nexport function getVirtualListComponent({ component: Component, fluid, height, autoHeight }) {\n if (autoHeight) return AutoHeightList;\n if (fluid) return FluidHeightList;\n return Component;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,6BAAgC;AAChC,4BAA+B;AAIxB,SAAS,wBAAwB,EAAE,WAAW,WAAW,OAAO,QAAQ,WAAW,GAAG;AAC3F,MAAI;AAAY,WAAO;AACvB,MAAI;AAAO,WAAO;AAClB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|