@elliemae/ds-shared 1.61.12 → 1.61.13
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.map +1 -1
- package/cjs/Animations/Grow.js.map +1 -1
- package/cjs/Animations/GrowRight.js.map +1 -1
- package/cjs/CheckableGroup.js.map +1 -1
- package/cjs/DeferRenderAfterComputation.js.map +1 -1
- package/cjs/FocusGroup/FocusGrid.js.map +1 -1
- package/cjs/FocusGroup/FocusGroup.js.map +1 -1
- package/cjs/FocusGroup/FocusGroupManager.js.map +1 -1
- package/cjs/FocusGroup/focusGroupManagerHoc.js.map +1 -1
- package/cjs/FocusGroup/useFocusGroupItem.js.map +1 -1
- package/cjs/FocusGroup/utils/getNextCellPosition.js.map +1 -1
- package/cjs/GroupContext/Group.js.map +1 -1
- package/cjs/GroupContext/GroupItem.js.map +1 -1
- package/cjs/ScrollSync/ScrollSync.js.map +1 -1
- package/cjs/ScrollSync/ScrollSyncPane.js.map +1 -1
- package/cjs/ScrollSync/ScrollSyncProvider.js.map +1 -1
- package/cjs/ScrollSync/useScrollSync.js.map +1 -1
- package/cjs/createDataInstance/createInstancePlugin.js.map +1 -1
- package/cjs/createDataInstance/createInstanceRef.js.map +1 -1
- package/cjs/createDataInstance/utils.js.map +1 -1
- package/cjs/defer-render-hoc/index.js.map +1 -1
- package/cjs/toolbar/ToolbarProvider.js.map +1 -1
- package/cjs/useDataGrid/VolatileRowsListener.js.map +1 -1
- package/cjs/useDataGrid/initColumnDefinition.js.map +1 -1
- package/cjs/useDataGrid/useDataGrid.js.map +1 -1
- package/cjs/useDataList/recordIterator.js.map +1 -1
- package/cjs/useDataList/useDataList.js.map +1 -1
- package/cjs/utils.js.map +1 -1
- package/cjs/virtualization/AutoHeightList.js.map +1 -1
- package/cjs/virtualization/FluidHeightList.js.map +1 -1
- package/cjs/virtualization/index.js.map +1 -1
- package/esm/Animations/BaseAnimation.js.map +1 -1
- package/esm/Animations/Grow.js.map +1 -1
- package/esm/Animations/GrowRight.js.map +1 -1
- package/esm/CheckableGroup.js.map +1 -1
- package/esm/DeferRenderAfterComputation.js.map +1 -1
- package/esm/FocusGroup/FocusGrid.js.map +1 -1
- package/esm/FocusGroup/FocusGroup.js.map +1 -1
- package/esm/FocusGroup/FocusGroupManager.js.map +1 -1
- package/esm/FocusGroup/focusGroupManagerHoc.js.map +1 -1
- package/esm/FocusGroup/useFocusGroupItem.js.map +1 -1
- package/esm/FocusGroup/utils/getNextCellPosition.js.map +1 -1
- package/esm/GroupContext/Group.js.map +1 -1
- package/esm/GroupContext/GroupItem.js.map +1 -1
- package/esm/ScrollSync/ScrollSync.js.map +1 -1
- package/esm/ScrollSync/ScrollSyncPane.js.map +1 -1
- package/esm/ScrollSync/ScrollSyncProvider.js.map +1 -1
- package/esm/ScrollSync/useScrollSync.js.map +1 -1
- package/esm/createDataInstance/createInstancePlugin.js.map +1 -1
- package/esm/createDataInstance/createInstanceRef.js.map +1 -1
- package/esm/createDataInstance/utils.js.map +1 -1
- package/esm/defer-render-hoc/index.js.map +1 -1
- package/esm/toolbar/ToolbarProvider.js.map +1 -1
- package/esm/useDataGrid/VolatileRowsListener.js.map +1 -1
- package/esm/useDataGrid/initColumnDefinition.js.map +1 -1
- package/esm/useDataGrid/useDataGrid.js.map +1 -1
- package/esm/useDataList/recordIterator.js.map +1 -1
- package/esm/useDataList/useDataList.js.map +1 -1
- package/esm/utils.js.map +1 -1
- package/esm/virtualization/AutoHeightList.js.map +1 -1
- package/esm/virtualization/FluidHeightList.js.map +1 -1
- package/esm/virtualization/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusGroupManagerHoc.js","sources":["../../../src/FocusGroup/focusGroupManagerHoc.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport FocusGroupManager from './FocusGroupManager';\n\nexport default function FocusGroupHoc(WrappedComponent, options = {}) {\n return ({\n onExitFocusGroup,\n onFocusPrevGroup,\n focusKeyBindings,\n ...props\n }) => (\n <FocusGroupManager\n keyBindings={focusKeyBindings}\n onExitFocusGroup={onExitFocusGroup}\n onFocusPrevGroup={onFocusPrevGroup}\n {...options}\n >\n <WrappedComponent {...props} {...options} />\n </FocusGroupManager>\n );\n}\n"],"names":["FocusGroupHoc","WrappedComponent","options","onExitFocusGroup","onFocusPrevGroup","focusKeyBindings","props","FocusGroupManager"],"mappings":";;;;;;;;;;;;;;;;;AAIe,SAASA,aAAT,CAAuBC,gBAAvB,EAAuD;
|
|
1
|
+
{"version":3,"file":"focusGroupManagerHoc.js","sources":["../../../src/FocusGroup/focusGroupManagerHoc.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport FocusGroupManager from './FocusGroupManager';\n\nexport default function FocusGroupHoc(WrappedComponent, options = {}) {\n return ({\n onExitFocusGroup,\n onFocusPrevGroup,\n focusKeyBindings,\n ...props\n }) => (\n <FocusGroupManager\n keyBindings={focusKeyBindings}\n onExitFocusGroup={onExitFocusGroup}\n onFocusPrevGroup={onFocusPrevGroup}\n {...options}\n >\n <WrappedComponent {...props} {...options} />\n </FocusGroupManager>\n );\n}\n"],"names":["FocusGroupHoc","WrappedComponent","options","onExitFocusGroup","onFocusPrevGroup","focusKeyBindings","props","FocusGroupManager"],"mappings":";;;;;;;;;;;;;;;;;AAIe,SAASA,aAAT,CAAuBC,gBAAvB,EAAuD;EAAA,IAAdC,OAAc,uEAAJ,EAAI;EACpE,OAAO;IAAA,IACLC,gBADK,QACLA,gBADK;QAELC,gBAFK,QAELA,gBAFK;QAGLC,gBAHK,QAGLA,gBAHK;QAIFC,KAJE;;IAAA,oBAML,oBAACC,kBAAD;MACE,WAAW,EAAEF,gBADf;MAEE,gBAAgB,EAAEF,gBAFpB;MAGE,gBAAgB,EAAEC;OACdF,OAJN,gBAME,oBAAC,gBAAD,eAAsBI,KAAtB,EAAiCJ,OAAjC,EANF,CANK;GAAP;AAeD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusGroupItem.js","sources":["../../../src/FocusGroup/useFocusGroupItem.tsx"],"sourcesContent":["import { useContext, useEffect } from 'react';\nimport FocusGroupContext from './FocusGroupContext';\n\nexport default function useFocusGroupItem(ref = {}, props) {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref.current && register) register(ref.current, props);\n return () => {\n if (ref.current && unregister) unregister(ref.current);\n };\n });\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n}\n\nexport const useFocusGroupWithState = (ref = {}, props) => {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref && register) register(ref, props);\n return () => {\n if (ref && unregister) unregister(ref);\n };\n }, [ref]);\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n};\n"],"names":["useFocusGroupItem","ref","props","useContext","FocusGroupContext","register","unregister","otherActions","useEffect","current","useFocusGroupWithState"],"mappings":";;;;;;AAGe,SAASA,iBAAT,GAA4C;
|
|
1
|
+
{"version":3,"file":"useFocusGroupItem.js","sources":["../../../src/FocusGroup/useFocusGroupItem.tsx"],"sourcesContent":["import { useContext, useEffect } from 'react';\nimport FocusGroupContext from './FocusGroupContext';\n\nexport default function useFocusGroupItem(ref = {}, props) {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref.current && register) register(ref.current, props);\n return () => {\n if (ref.current && unregister) unregister(ref.current);\n };\n });\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n}\n\nexport const useFocusGroupWithState = (ref = {}, props) => {\n const { register, unregister, ...otherActions } =\n useContext(FocusGroupContext) || {};\n\n useEffect(() => {\n if (ref && register) register(ref, props);\n return () => {\n if (ref && unregister) unregister(ref);\n };\n }, [ref]);\n\n // if the focus item is not wrapped with the focus provider then return null\n if (!register) return {};\n return otherActions;\n};\n"],"names":["useFocusGroupItem","ref","props","useContext","FocusGroupContext","register","unregister","otherActions","useEffect","current","useFocusGroupWithState"],"mappings":";;;;;;AAGe,SAASA,iBAAT,GAA4C;EAAA,IAAjBC,GAAiB,uEAAX,EAAW;EAAA,IAAPC,KAAO;;EACzD,WACEC,UAAU,CAACC,iBAAD,CAAV,IAAiC,EADnC;MAAQC,QAAR,QAAQA,QAAR;MAAkBC,UAAlB,QAAkBA,UAAlB;MAAiCC,YAAjC;;EAGAC,SAAS,CAAC,YAAM;IACd,IAAIP,GAAG,CAACQ,OAAJ,IAAeJ,QAAnB,EAA6BA,QAAQ,CAACJ,GAAG,CAACQ,OAAL,EAAcP,KAAd,CAAR;IAC7B,OAAO,YAAM;MACX,IAAID,GAAG,CAACQ,OAAJ,IAAeH,UAAnB,EAA+BA,UAAU,CAACL,GAAG,CAACQ,OAAL,CAAV;KADjC;GAFO,CAAT,CAJyD;;EAYzD,IAAI,CAACJ,QAAL,EAAe,OAAO,EAAP;EACf,OAAOE,YAAP;AACD;IAEYG,sBAAsB,GAAG,SAAzBA,sBAAyB,GAAqB;EAAA,IAApBT,GAAoB,uEAAd,EAAc;EAAA,IAAVC,KAAU;;EACzD,YACEC,UAAU,CAACC,iBAAD,CAAV,IAAiC,EADnC;MAAQC,QAAR,SAAQA,QAAR;MAAkBC,UAAlB,SAAkBA,UAAlB;MAAiCC,YAAjC;;EAGAC,SAAS,CAAC,YAAM;IACd,IAAIP,GAAG,IAAII,QAAX,EAAqBA,QAAQ,CAACJ,GAAD,EAAMC,KAAN,CAAR;IACrB,OAAO,YAAM;MACX,IAAID,GAAG,IAAIK,UAAX,EAAuBA,UAAU,CAACL,GAAD,CAAV;KADzB;GAFO,EAKN,CAACA,GAAD,CALM,CAAT,CAJyD;;EAYzD,IAAI,CAACI,QAAL,EAAe,OAAO,EAAP;EACf,OAAOE,YAAP;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNextCellPosition.js","sources":["../../../../src/FocusGroup/utils/getNextCellPosition.tsx"],"sourcesContent":["// eslint-disable-next-line max-statements\nexport default function getNextCellPosition({\n grid,\n currentRow = 0,\n currentCell = 0,\n directionY,\n directionX,\n shouldWrapCells,\n shouldWrapRows,\n}) {\n let nextRow = currentRow + directionY;\n let nextCell = currentCell + directionX;\n const rowCount = grid.length;\n const isLeftRight = directionX !== 0;\n\n if (!rowCount) {\n return false;\n }\n\n const cellsLength = grid[0].length;\n\n // moving horizontally\n if (shouldWrapCells && isLeftRight) {\n // to left\n if (nextCell < 0) {\n nextCell = cellsLength - 1;\n nextRow -= 1;\n }\n\n if (nextCell >= cellsLength) {\n nextCell = 0;\n nextRow += 1;\n }\n }\n\n // moving vertically\n if (shouldWrapRows && !isLeftRight) {\n // to top\n if (nextRow < 0) {\n nextCell -= 1;\n nextRow = rowCount - 1;\n if (grid[nextRow] && nextCell >= 0 && !grid[nextRow][nextCell]) {\n nextRow -= 1;\n }\n } else if (nextRow >= rowCount || !grid[nextRow][nextCell]) {\n nextRow = 0;\n nextCell += 1;\n }\n }\n\n return {\n cellIndex: nextCell,\n rowIndex: nextRow,\n };\n}\n"],"names":["getNextCellPosition","grid","currentRow","currentCell","directionY","directionX","shouldWrapCells","shouldWrapRows","nextRow","nextCell","rowCount","length","isLeftRight","cellsLength","cellIndex","rowIndex"],"mappings":"AAAA;AACe,SAASA,mBAAT,OAQZ;
|
|
1
|
+
{"version":3,"file":"getNextCellPosition.js","sources":["../../../../src/FocusGroup/utils/getNextCellPosition.tsx"],"sourcesContent":["// eslint-disable-next-line max-statements\nexport default function getNextCellPosition({\n grid,\n currentRow = 0,\n currentCell = 0,\n directionY,\n directionX,\n shouldWrapCells,\n shouldWrapRows,\n}) {\n let nextRow = currentRow + directionY;\n let nextCell = currentCell + directionX;\n const rowCount = grid.length;\n const isLeftRight = directionX !== 0;\n\n if (!rowCount) {\n return false;\n }\n\n const cellsLength = grid[0].length;\n\n // moving horizontally\n if (shouldWrapCells && isLeftRight) {\n // to left\n if (nextCell < 0) {\n nextCell = cellsLength - 1;\n nextRow -= 1;\n }\n\n if (nextCell >= cellsLength) {\n nextCell = 0;\n nextRow += 1;\n }\n }\n\n // moving vertically\n if (shouldWrapRows && !isLeftRight) {\n // to top\n if (nextRow < 0) {\n nextCell -= 1;\n nextRow = rowCount - 1;\n if (grid[nextRow] && nextCell >= 0 && !grid[nextRow][nextCell]) {\n nextRow -= 1;\n }\n } else if (nextRow >= rowCount || !grid[nextRow][nextCell]) {\n nextRow = 0;\n nextCell += 1;\n }\n }\n\n return {\n cellIndex: nextCell,\n rowIndex: nextRow,\n };\n}\n"],"names":["getNextCellPosition","grid","currentRow","currentCell","directionY","directionX","shouldWrapCells","shouldWrapRows","nextRow","nextCell","rowCount","length","isLeftRight","cellsLength","cellIndex","rowIndex"],"mappings":"AAAA;AACe,SAASA,mBAAT,OAQZ;EAAA,IAPDC,IAOC,QAPDA,IAOC;6BANDC,UAMC;MANDA,UAMC,gCANY,CAMZ;8BALDC,WAKC;MALDA,WAKC,iCALa,CAKb;MAJDC,UAIC,QAJDA,UAIC;MAHDC,UAGC,QAHDA,UAGC;MAFDC,eAEC,QAFDA,eAEC;MADDC,cACC,QADDA,cACC;EACD,IAAIC,OAAO,GAAGN,UAAU,GAAGE,UAA3B;EACA,IAAIK,QAAQ,GAAGN,WAAW,GAAGE,UAA7B;EACA,IAAMK,QAAQ,GAAGT,IAAI,CAACU,MAAtB;EACA,IAAMC,WAAW,GAAGP,UAAU,KAAK,CAAnC;;EAEA,IAAI,CAACK,QAAL,EAAe;IACb,OAAO,KAAP;;;EAGF,IAAMG,WAAW,GAAGZ,IAAI,CAAC,CAAD,CAAJ,CAAQU,MAA5B,CAVC;;EAaD,IAAIL,eAAe,IAAIM,WAAvB,EAAoC;;IAElC,IAAIH,QAAQ,GAAG,CAAf,EAAkB;MAChBA,QAAQ,GAAGI,WAAW,GAAG,CAAzB;MACAL,OAAO,IAAI,CAAX;;;IAGF,IAAIC,QAAQ,IAAII,WAAhB,EAA6B;MAC3BJ,QAAQ,GAAG,CAAX;MACAD,OAAO,IAAI,CAAX;;GAtBH;;;EA2BD,IAAID,cAAc,IAAI,CAACK,WAAvB,EAAoC;;IAElC,IAAIJ,OAAO,GAAG,CAAd,EAAiB;MACfC,QAAQ,IAAI,CAAZ;MACAD,OAAO,GAAGE,QAAQ,GAAG,CAArB;;MACA,IAAIT,IAAI,CAACO,OAAD,CAAJ,IAAiBC,QAAQ,IAAI,CAA7B,IAAkC,CAACR,IAAI,CAACO,OAAD,CAAJ,CAAcC,QAAd,CAAvC,EAAgE;QAC9DD,OAAO,IAAI,CAAX;;KAJJ,MAMO,IAAIA,OAAO,IAAIE,QAAX,IAAuB,CAACT,IAAI,CAACO,OAAD,CAAJ,CAAcC,QAAd,CAA5B,EAAqD;MAC1DD,OAAO,GAAG,CAAV;MACAC,QAAQ,IAAI,CAAZ;;;;EAIJ,OAAO;IACLK,SAAS,EAAEL,QADN;IAELM,QAAQ,EAAEP;GAFZ;AAID;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.js","sources":["../../../src/GroupContext/Group.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-state */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { GroupContext } from './GroupContext';\n\nconst getValueItem = (e) => {\n const { target, currentTarget } = e;\n if (target) {\n const { value } = target;\n return value;\n }\n if (currentTarget) {\n const { value } = currentTarget;\n return value;\n }\n return e;\n};\n\nconst toggleItemValue = (array, e) => {\n const newvalue = getValueItem(e);\n const res = array;\n const index = array.indexOf(newvalue);\n\n if (index === -1) {\n res.push(newvalue);\n } else {\n res.splice(index, 1);\n }\n\n return res;\n};\n\nconst { Provider } = GroupContext;\n/** deprecated use CheckableGroup instead */\nclass Group extends Component {\n constructor(props) {\n super(props);\n const { activeValue, disabled } = props;\n this.state = {\n activeValue,\n disabled,\n prevValue: null,\n onChange: this.handleChange.bind(this),\n };\n }\n\n static getDerivedStateFromProps(nextProps, { prevValue }) {\n if (nextProps.activeValue === prevValue) return null;\n return {\n activeValue: nextProps.activeValue,\n prevValue: nextProps.activeValue,\n };\n }\n\n handleChange(e, ...rest) {\n const { multiple, onChange } = this.props;\n const { activeValue } = this.state;\n const value = getValueItem(e);\n let newValue;\n if (multiple) {\n newValue = toggleItemValue(activeValue || [], value);\n } else if (activeValue !== value) {\n // default behaviour it will be toggle the active value\n newValue = value;\n }\n\n this.setState({\n activeValue: newValue,\n });\n\n if (onChange) onChange(newValue, ...rest);\n }\n\n render() {\n const { children } = this.props;\n return <Provider value={this.state}>{children}</Provider>;\n }\n}\n\nGroup.defaultProps = {\n multiple: false,\n};\n\nGroup.propTypes = {\n children: PropTypes.array,\n multiple: PropTypes.bool,\n onChange: PropTypes.func,\n activeValue: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),\n disabled: PropTypes.bool,\n};\n\nexport default Group;\n"],"names":["getValueItem","e","target","currentTarget","value","toggleItemValue","array","newvalue","res","index","indexOf","push","splice","Provider","GroupContext","Group","props","activeValue","disabled","state","prevValue","onChange","handleChange","bind","multiple","newValue","setState","rest","children","nextProps","Component","defaultProps","propTypes","PropTypes","bool","func","oneOfType","number"],"mappings":";;;;;;;;;;;;;;AAKA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,CAAD,EAAO;
|
|
1
|
+
{"version":3,"file":"Group.js","sources":["../../../src/GroupContext/Group.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-state */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { GroupContext } from './GroupContext';\n\nconst getValueItem = (e) => {\n const { target, currentTarget } = e;\n if (target) {\n const { value } = target;\n return value;\n }\n if (currentTarget) {\n const { value } = currentTarget;\n return value;\n }\n return e;\n};\n\nconst toggleItemValue = (array, e) => {\n const newvalue = getValueItem(e);\n const res = array;\n const index = array.indexOf(newvalue);\n\n if (index === -1) {\n res.push(newvalue);\n } else {\n res.splice(index, 1);\n }\n\n return res;\n};\n\nconst { Provider } = GroupContext;\n/** deprecated use CheckableGroup instead */\nclass Group extends Component {\n constructor(props) {\n super(props);\n const { activeValue, disabled } = props;\n this.state = {\n activeValue,\n disabled,\n prevValue: null,\n onChange: this.handleChange.bind(this),\n };\n }\n\n static getDerivedStateFromProps(nextProps, { prevValue }) {\n if (nextProps.activeValue === prevValue) return null;\n return {\n activeValue: nextProps.activeValue,\n prevValue: nextProps.activeValue,\n };\n }\n\n handleChange(e, ...rest) {\n const { multiple, onChange } = this.props;\n const { activeValue } = this.state;\n const value = getValueItem(e);\n let newValue;\n if (multiple) {\n newValue = toggleItemValue(activeValue || [], value);\n } else if (activeValue !== value) {\n // default behaviour it will be toggle the active value\n newValue = value;\n }\n\n this.setState({\n activeValue: newValue,\n });\n\n if (onChange) onChange(newValue, ...rest);\n }\n\n render() {\n const { children } = this.props;\n return <Provider value={this.state}>{children}</Provider>;\n }\n}\n\nGroup.defaultProps = {\n multiple: false,\n};\n\nGroup.propTypes = {\n children: PropTypes.array,\n multiple: PropTypes.bool,\n onChange: PropTypes.func,\n activeValue: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),\n disabled: PropTypes.bool,\n};\n\nexport default Group;\n"],"names":["getValueItem","e","target","currentTarget","value","toggleItemValue","array","newvalue","res","index","indexOf","push","splice","Provider","GroupContext","Group","props","activeValue","disabled","state","prevValue","onChange","handleChange","bind","multiple","newValue","setState","rest","children","nextProps","Component","defaultProps","propTypes","PropTypes","bool","func","oneOfType","number"],"mappings":";;;;;;;;;;;;;;AAKA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,CAAD,EAAO;EAC1B,IAAQC,MAAR,GAAkCD,CAAlC,CAAQC,MAAR;MAAgBC,aAAhB,GAAkCF,CAAlC,CAAgBE,aAAhB;;EACA,IAAID,MAAJ,EAAY;IACV,IAAQE,KAAR,GAAkBF,MAAlB,CAAQE,KAAR;IACA,OAAOA,KAAP;;;EAEF,IA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Bb,KAApB,CAA1B;OADF,MAEO,IAAIa,WAAW,KAAKb,KAApB,EAA2B;;QAEhCqB,QAAQ,GAAGrB,KAAX;;;MAGF,KAAKsB,QAAL,CAAc;QACZT,WAAW,EAAEQ;OADf;;MAZuB,kCAANE,IAAM;QAANA,IAAM;;;MAgBvB,IAAIN,QAAJ,EAAcA,QAAQ,MAAR,UAASI,QAAT,SAAsBE,IAAtB;;;;WAGhB,kBAAS;MACP,IAAQC,QAAR,GAAqB,KAAKZ,KAA1B,CAAQY,QAAR;MACA,oBAAO,oBAAC,QAAD;QAAU,KAAK,EAAE,KAAKT;SAAQS,QAA9B,CAAP;;;;WA7BF,kCAAgCC,SAAhC,QAA0D;MAAA,IAAbT,SAAa,QAAbA,SAAa;MACxD,IAAIS,SAAS,CAACZ,WAAV,KAA0BG,SAA9B,EAAyC,OAAO,IAAP;MACzC,OAAO;QACLH,WAAW,EAAEY,SAAS,CAACZ,WADlB;QAELG,SAAS,EAAES,SAAS,CAACZ;OAFvB;;;;;EAdgBa;;AA6CpBf,KAAK,CAACgB,YAAN,GAAqB;EACnBP,QAAQ,EAAE;AADS,CAArB;AAIAT,KAAK,CAACiB,SAAN,GAAkB;EAChBJ,QAAQ,EAAEK,SAAS,CAAC3B,KADJ;EAEhBkB,QAAQ,EAAES,SAAS,CAACC,IAFJ;EAGhBb,QAAQ,EAAEY,SAAS,CAACE,IAHJ;EAIhBlB,WAAW,EAAEgB,SAAS,CAACG,SAAV,CAAoB,CAACH,SAAS,CAAC3B,KAAX,EAAkB2B,SAAS,CAACI,MAA5B,CAApB,CAJG;EAKhBnB,QAAQ,EAAEe,SAAS,CAACC;AALJ,CAAlB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupItem.js","sources":["../../../src/GroupContext/GroupItem.tsx"],"sourcesContent":["import React from 'react';\nimport { GroupContext } from './GroupContext';\n\nconst { Consumer } = GroupContext;\n\nconst GroupItem = ({ render }) => (\n <Consumer>{context => render(context)}</Consumer>\n);\n\nexport default GroupItem;\n"],"names":["Consumer","GroupContext","GroupItem","render","context"],"mappings":";;;AAGA,IAAQA,QAAR,GAAqBC,YAArB,CAAQD,QAAR;;IAEME,SAAS,GAAG,SAAZA,SAAY;
|
|
1
|
+
{"version":3,"file":"GroupItem.js","sources":["../../../src/GroupContext/GroupItem.tsx"],"sourcesContent":["import React from 'react';\nimport { GroupContext } from './GroupContext';\n\nconst { Consumer } = GroupContext;\n\nconst GroupItem = ({ render }) => (\n <Consumer>{context => render(context)}</Consumer>\n);\n\nexport default GroupItem;\n"],"names":["Consumer","GroupContext","GroupItem","render","context"],"mappings":";;;AAGA,IAAQA,QAAR,GAAqBC,YAArB,CAAQD,QAAR;;IAEME,SAAS,GAAG,SAAZA,SAAY;EAAA,IAAGC,MAAH,QAAGA,MAAH;EAAA,oBAChB,oBAAC,QAAD,QAAW,UAAAC,OAAO;IAAA,OAAID,MAAM,CAACC,OAAD,CAAV;GAAlB,CADgB;AAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollSync.js","sources":["../../../src/ScrollSync/ScrollSync.tsx"],"sourcesContent":["import React, { Component } from 'react';\n\nexport const ScrollSyncContext = React.createContext();\n\nconst { Provider } = ScrollSyncContext;\n\nexport default class ScrollSync extends Component {\n panes = {};\n\n static defaultProps = {\n proportional: true,\n vertical: true,\n horizontal: true,\n enabled: true,\n };\n\n constructor(props) {\n super(props);\n this.syncContext = {\n registerPane: this.registerPane,\n unregisterPane: this.unregisterPane,\n };\n }\n\n registerPane = (node, groups) => {\n groups.forEach((group) => {\n if (!this.panes[group]) {\n this.panes[group] = [];\n }\n\n if (this.panes[group].length > 0) {\n this.syncScrollPosition(this.panes[group][0], node);\n }\n this.panes[group].push(node);\n });\n this.addEvents(node, groups);\n };\n\n unregisterPane = (node, groups) => {\n groups.forEach((group) => {\n if (this.findPane(node, group)) {\n this.removeEvents(node);\n this.panes[group].splice(this.panes[group].indexOf(node), 1);\n }\n });\n };\n\n addEvents = (node, groups) => {\n /* For some reason element.addEventListener doesnt work with document.body */\n node.onscroll = this.handlePaneScroll.bind(this, node, groups); // eslint-disable-line\n };\n\n removeEvents = (node) => {\n /* For some reason element.removeEventListener doesnt work with document.body */\n node.onscroll = null; // eslint-disable-line\n };\n\n findPane = (node, group) => {\n if (!this.panes[group]) {\n return false;\n }\n\n return this.panes[group].find((pane) => pane === node);\n };\n\n handlePaneScroll = (node, groups, e) => {\n const { enabled } = this.props;\n if (this.props.onScroll) this.props.onScroll(e);\n\n if (!enabled) return;\n\n window.requestAnimationFrame(() => {\n this.syncScrollPositions(node, groups);\n });\n };\n\n syncScrollPositions = (scrolledPane, groups) => {\n groups.forEach((group) => {\n this.panes[group].forEach((pane) => {\n /* For all panes beside the currently scrolling one */\n if (scrolledPane !== pane) {\n /* Remove event listeners from the node that we'll manipulate */\n this.removeEvents(pane, group);\n this.syncScrollPosition(scrolledPane, pane);\n /* Re-attach event listeners after we're done scrolling */\n window.requestAnimationFrame(() => {\n this.addEvents(pane, groups);\n });\n }\n });\n });\n };\n\n syncScrollPosition(scrolledPane, pane) {\n const {\n scrollTop,\n scrollHeight,\n clientHeight,\n scrollLeft,\n scrollWidth,\n clientWidth,\n } = scrolledPane;\n\n const scrollTopOffset = scrollHeight - clientHeight;\n const scrollLeftOffset = scrollWidth - clientWidth;\n\n const { proportional, vertical, horizontal } = this.props;\n\n /* Calculate the actual pane height */\n const paneHeight = pane.scrollHeight - clientHeight;\n const paneWidth = pane.scrollWidth - clientWidth;\n /* Adjust the scrollTop position of it accordingly */\n if (vertical && scrollTopOffset > 0) {\n pane.scrollTop = proportional\n ? (paneHeight * scrollTop) / scrollTopOffset\n : scrollTop; // eslint-disable-line\n }\n if (horizontal && scrollLeftOffset > 0) {\n pane.scrollLeft = proportional\n ? (paneWidth * scrollLeft) / scrollLeftOffset\n : scrollLeft; // eslint-disable-line\n }\n }\n\n render() {\n const { children } = this.props;\n return (\n <Provider value={this.syncContext}>\n {React.Children.only(children)}\n </Provider>\n );\n }\n}\n"],"names":["ScrollSyncContext","React","createContext","Provider","ScrollSync","props","panes","registerPane","node","groups","forEach","group","length","syncScrollPosition","push","addEvents","unregisterPane","findPane","removeEvents","splice","indexOf","onscroll","handlePaneScroll","bind","find","pane","e","enabled","onScroll","window","requestAnimationFrame","syncScrollPositions","scrolledPane","syncContext","scrollTop","scrollHeight","clientHeight","scrollLeft","scrollWidth","clientWidth","scrollTopOffset","scrollLeftOffset","proportional","vertical","horizontal","paneHeight","paneWidth","children","Children","only","Component","defaultProps"],"mappings":";;;;;;;;;;;IAEaA,iBAAiB,gBAAGC,KAAK,CAACC,aAAN;AAEjC,IAAQC,QAAR,GAAqBH,iBAArB,CAAQG,QAAR;;IAEqBC;;;;;
|
|
1
|
+
{"version":3,"file":"ScrollSync.js","sources":["../../../src/ScrollSync/ScrollSync.tsx"],"sourcesContent":["import React, { Component } from 'react';\n\nexport const ScrollSyncContext = React.createContext();\n\nconst { Provider } = ScrollSyncContext;\n\nexport default class ScrollSync extends Component {\n panes = {};\n\n static defaultProps = {\n proportional: true,\n vertical: true,\n horizontal: true,\n enabled: true,\n };\n\n constructor(props) {\n super(props);\n this.syncContext = {\n registerPane: this.registerPane,\n unregisterPane: this.unregisterPane,\n };\n }\n\n registerPane = (node, groups) => {\n groups.forEach((group) => {\n if (!this.panes[group]) {\n this.panes[group] = [];\n }\n\n if (this.panes[group].length > 0) {\n this.syncScrollPosition(this.panes[group][0], node);\n }\n this.panes[group].push(node);\n });\n this.addEvents(node, groups);\n };\n\n unregisterPane = (node, groups) => {\n groups.forEach((group) => {\n if (this.findPane(node, group)) {\n this.removeEvents(node);\n this.panes[group].splice(this.panes[group].indexOf(node), 1);\n }\n });\n };\n\n addEvents = (node, groups) => {\n /* For some reason element.addEventListener doesnt work with document.body */\n node.onscroll = this.handlePaneScroll.bind(this, node, groups); // eslint-disable-line\n };\n\n removeEvents = (node) => {\n /* For some reason element.removeEventListener doesnt work with document.body */\n node.onscroll = null; // eslint-disable-line\n };\n\n findPane = (node, group) => {\n if (!this.panes[group]) {\n return false;\n }\n\n return this.panes[group].find((pane) => pane === node);\n };\n\n handlePaneScroll = (node, groups, e) => {\n const { enabled } = this.props;\n if (this.props.onScroll) this.props.onScroll(e);\n\n if (!enabled) return;\n\n window.requestAnimationFrame(() => {\n this.syncScrollPositions(node, groups);\n });\n };\n\n syncScrollPositions = (scrolledPane, groups) => {\n groups.forEach((group) => {\n this.panes[group].forEach((pane) => {\n /* For all panes beside the currently scrolling one */\n if (scrolledPane !== pane) {\n /* Remove event listeners from the node that we'll manipulate */\n this.removeEvents(pane, group);\n this.syncScrollPosition(scrolledPane, pane);\n /* Re-attach event listeners after we're done scrolling */\n window.requestAnimationFrame(() => {\n this.addEvents(pane, groups);\n });\n }\n });\n });\n };\n\n syncScrollPosition(scrolledPane, pane) {\n const {\n scrollTop,\n scrollHeight,\n clientHeight,\n scrollLeft,\n scrollWidth,\n clientWidth,\n } = scrolledPane;\n\n const scrollTopOffset = scrollHeight - clientHeight;\n const scrollLeftOffset = scrollWidth - clientWidth;\n\n const { proportional, vertical, horizontal } = this.props;\n\n /* Calculate the actual pane height */\n const paneHeight = pane.scrollHeight - clientHeight;\n const paneWidth = pane.scrollWidth - clientWidth;\n /* Adjust the scrollTop position of it accordingly */\n if (vertical && scrollTopOffset > 0) {\n pane.scrollTop = proportional\n ? (paneHeight * scrollTop) / scrollTopOffset\n : scrollTop; // eslint-disable-line\n }\n if (horizontal && scrollLeftOffset > 0) {\n pane.scrollLeft = proportional\n ? (paneWidth * scrollLeft) / scrollLeftOffset\n : scrollLeft; // eslint-disable-line\n }\n }\n\n render() {\n const { children } = this.props;\n return (\n <Provider value={this.syncContext}>\n {React.Children.only(children)}\n </Provider>\n );\n }\n}\n"],"names":["ScrollSyncContext","React","createContext","Provider","ScrollSync","props","panes","registerPane","node","groups","forEach","group","length","syncScrollPosition","push","addEvents","unregisterPane","findPane","removeEvents","splice","indexOf","onscroll","handlePaneScroll","bind","find","pane","e","enabled","onScroll","window","requestAnimationFrame","syncScrollPositions","scrolledPane","syncContext","scrollTop","scrollHeight","clientHeight","scrollLeft","scrollWidth","clientWidth","scrollTopOffset","scrollLeftOffset","proportional","vertical","horizontal","paneHeight","paneWidth","children","Children","only","Component","defaultProps"],"mappings":";;;;;;;;;;;IAEaA,iBAAiB,gBAAGC,KAAK,CAACC,aAAN;AAEjC,IAAQC,QAAR,GAAqBH,iBAArB,CAAQG,QAAR;;IAEqBC;;;;;EAUnB,oBAAYC,KAAZ,EAAmB;IAAA;;IAAA;;IACjB,0BAAMA,KAAN;IADiB,MATnBC,KASmB,GATX,EASW;;IAAA,MAQnBC,YARmB,GAQJ,UAACC,IAAD,EAAOC,MAAP,EAAkB;MAC/BA,MAAM,CAACC,OAAP,CAAe,UAACC,KAAD,EAAW;QACxB,IAAI,CAAC,MAAKL,KAAL,CAAWK,KAAX,CAAL,EAAwB;UACtB,MAAKL,KAAL,CAAWK,KAAX,IAAoB,EAApB;;;QAGF,IAAI,MAAKL,KAAL,CAAWK,KAAX,EAAkBC,MAAlB,GAA2B,CAA/B,EAAkC;UAChC,MAAKC,kBAAL,CAAwB,MAAKP,KAAL,CAAWK,KAAX,EAAkB,CAAlB,CAAxB,EAA8CH,IAA9C;;;QAEF,MAAKF,KAAL,CAAWK,KAAX,EAAkBG,IAAlB,CAAuBN,IAAvB;OARF;;MAUA,MAAKO,SAAL,CAAeP,IAAf,EAAqBC,MAArB;KAnBiB;;IAAA,MAsBnBO,cAtBmB,GAsBF,UAACR,IAAD,EAAOC,MAAP,EAAkB;MACjCA,MAAM,CAACC,OAAP,CAAe,UAACC,KAAD,EAAW;QACxB,IAAI,MAAKM,QAAL,CAAcT,IAAd,EAAoBG,KAApB,CAAJ,EAAgC;UAC9B,MAAKO,YAAL,CAAkBV,IAAlB;;UACA,MAAKF,KAAL,CAAWK,KAAX,EAAkBQ,MAAlB,CAAyB,MAAKb,KAAL,CAAWK,KAAX,EAAkBS,O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,GAA2BI,gBADD,GAE1BJ,UAFJ,CADsC;;;;;WAO1C,kBAAS;MACP,IAAQU,QAAR,GAAqB,KAAK1C,KAA1B,CAAQ0C,QAAR;MACA,oBACE,oBAAC,QAAD;QAAU,KAAK,EAAE,KAAKd;SACnBhC,KAAK,CAAC+C,QAAN,CAAeC,IAAf,CAAoBF,QAApB,CADH,CADF;;;;;EAxHoCG;;AAAnB9C,WAGZ+C,eAAe;EACpBT,YAAY,EAAE,IADM;EAEpBC,QAAQ,EAAE,IAFU;EAGpBC,UAAU,EAAE,IAHQ;EAIpBjB,OAAO,EAAE;AAJW;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollSyncPane.js","sources":["../../../src/ScrollSync/ScrollSyncPane.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React, { Component } from 'react';\nimport { ScrollSyncContext } from './ScrollSync';\n\n/**\n * MODIFIED FROM react-scroll-sync\n *\n * ScrollSyncPane Component\n *\n * Wrap your content in it to keep its scroll position in sync with other panes\n *\n * @param groups\n * @example ./example.md\n */\nclass ScrollSyncPane extends Component {\n static defaultProps = {\n group: 'default',\n enabled: true,\n };\n\n componentWillUnmount() {\n const { enabled, group, syncContext } = this.props;\n const { unregisterPane } = syncContext;\n\n if (enabled) unregisterPane(this.node, this.toArray(group));\n }\n\n toArray = groups => [].concat(groups);\n\n render() {\n const { children, group, syncContext, notPaginated } = this.props;\n const { registerPane } = syncContext;\n\n return children({\n registerPane: node => {\n if (notPaginated) {\n const virtualizedBody = node.querySelector(\n '.virtualized-body-wrapper',\n );\n if (virtualizedBody) {\n registerPane(virtualizedBody, this.toArray(group));\n }\n }\n return registerPane(node, this.toArray(group));\n },\n });\n }\n}\n\nexport default props => (\n <ScrollSyncContext.Consumer>\n {context => <ScrollSyncPane {...props} syncContext={context} />}\n </ScrollSyncContext.Consumer>\n);\n"],"names":["ScrollSyncPane","toArray","groups","concat","props","enabled","group","syncContext","unregisterPane","node","children","notPaginated","registerPane","virtualizedBody","querySelector","Component","defaultProps","context"],"mappings":";;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMA;;;;;;;;;;;;;;;;UAaJC,UAAU,UAAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"ScrollSyncPane.js","sources":["../../../src/ScrollSync/ScrollSyncPane.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React, { Component } from 'react';\nimport { ScrollSyncContext } from './ScrollSync';\n\n/**\n * MODIFIED FROM react-scroll-sync\n *\n * ScrollSyncPane Component\n *\n * Wrap your content in it to keep its scroll position in sync with other panes\n *\n * @param groups\n * @example ./example.md\n */\nclass ScrollSyncPane extends Component {\n static defaultProps = {\n group: 'default',\n enabled: true,\n };\n\n componentWillUnmount() {\n const { enabled, group, syncContext } = this.props;\n const { unregisterPane } = syncContext;\n\n if (enabled) unregisterPane(this.node, this.toArray(group));\n }\n\n toArray = groups => [].concat(groups);\n\n render() {\n const { children, group, syncContext, notPaginated } = this.props;\n const { registerPane } = syncContext;\n\n return children({\n registerPane: node => {\n if (notPaginated) {\n const virtualizedBody = node.querySelector(\n '.virtualized-body-wrapper',\n );\n if (virtualizedBody) {\n registerPane(virtualizedBody, this.toArray(group));\n }\n }\n return registerPane(node, this.toArray(group));\n },\n });\n }\n}\n\nexport default props => (\n <ScrollSyncContext.Consumer>\n {context => <ScrollSyncPane {...props} syncContext={context} />}\n </ScrollSyncContext.Consumer>\n);\n"],"names":["ScrollSyncPane","toArray","groups","concat","props","enabled","group","syncContext","unregisterPane","node","children","notPaginated","registerPane","virtualizedBody","querySelector","Component","defaultProps","context"],"mappings":";;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMA;;;;;;;;;;;;;;;;UAaJC,UAAU,UAAAC,MAAM;MAAA,OAAI,GAAGC,MAAH,CAAUD,MAAV,CAAJ;;;;;;;;WAPhB,gCAAuB;MACrB,kBAAwC,K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nimport raf from 'raf';\nimport PropTypes from 'prop-types';\n\nconst ScrollSyncContext = React.createContext();\n\nconst { Provider } = ScrollSyncContext;\n\nfunction ScrollSyncProvider({ enabled, horizontal, vertical, children }) {\n const panes = useRef();\n\n const registerPane = (node, groups) => {\n groups.forEach(group => {\n if (!this.panes[group]) {\n this.panes[group] = [];\n }\n\n if (!this.findPane(node, group)) {\n if (this.panes[group].length > 0) {\n this.syncScrollPosition(this.panes[group][0], node);\n }\n this.panes[group].push(node);\n }\n });\n this.addEvents(node, groups);\n };\n const unregisterPane = (node, groups) => {\n groups.forEach(group => {\n if (this.findPane(node, group)) {\n this.removeEvents(node);\n this.panes[group].splice(this.panes[group].indexOf(node), 1);\n }\n });\n };\n const addEvents = (node, groups) => {\n /* For some reason element.addEventListener doesnt work with document.body */\n node.onscroll = this.handlePaneScroll.bind(this, node, groups); // eslint-disable-line\n };\n const removeEvents = node => {\n /* For some reason element.removeEventListener doesnt work with document.body */\n node.onscroll = null; // eslint-disable-line\n };\n const findPane = (node, group) => {\n if (!this.panes[group]) {\n return false;\n }\n\n return this.panes[group].find(pane => pane === node);\n };\n const handlePaneScroll = (node, groups) => {\n if (!enabled) return;\n\n window.requestAnimationFrame(() => {\n this.syncScrollPositions(node, groups);\n });\n };\n const syncScrollPositions = (scrolledPane, groups) => {\n groups.forEach(group => {\n this.panes[group].forEach(pane => {\n /* For all panes beside the currently scrolling one */\n if (scrolledPane !== pane) {\n /* Remove event listeners from the node that we'll manipulate */\n this.removeEvents(pane, group);\n this.syncScrollPosition(scrolledPane, pane);\n /* Re-attach event listeners after we're done scrolling */\n window.requestAnimationFrame(() => {\n this.addEvents(pane, groups);\n });\n }\n });\n });\n };\n const syncScrollPosition = raf((scrolledPane, pane) => {\n const {\n scrollTop,\n scrollHeight,\n clientHeight,\n scrollLeft,\n scrollWidth,\n clientWidth,\n } = scrolledPane;\n\n const scrollTopOffset = scrollHeight - clientHeight;\n const scrollLeftOffset = scrollWidth - clientWidth;\n\n const { proportional, vertical, horizontal } = this.props;\n\n /* Calculate the actual pane height */\n const paneHeight = pane.scrollHeight - clientHeight;\n const paneWidth = pane.scrollWidth - clientWidth;\n /* Adjust the scrollTop position of it accordingly */\n if (vertical && scrollTopOffset > 0) {\n pane.scrollTop = proportional\n ? (paneHeight * scrollTop) / scrollTopOffset\n : scrollTop; // eslint-disable-line\n }\n if (horizontal && scrollLeftOffset > 0) {\n pane.scrollLeft = proportional\n ? (paneWidth * scrollLeft) / scrollLeftOffset\n : scrollLeft; // eslint-disable-line\n }\n });\n\n return <Provider>{children}</Provider>;\n}\n\nScrollSyncProvider.propTypes = {};\nScrollSyncProvider.defaultProps = {};\n\nexport default ScrollSyncProvider;\n"],"names":["ScrollSyncContext","React","createContext","Provider","ScrollSyncProvider","enabled","horizontal","vertical","children","useRef","raf","scrolledPane","pane","scrollTop","scrollHeight","clientHeight","scrollLeft","scrollWidth","clientWidth","scrollTopOffset","scrollLeftOffset","props","proportional","paneHeight","paneWidth","propTypes","defaultProps"],"mappings":";;;AAIA,IAAMA,iBAAiB,gBAAGC,KAAK,CAACC,aAAN,EAA1B;AAEA,IAAQC,QAAR,GAAqBH,iBAArB,CAAQG,QAAR;;AAEA,SAASC,kBAAT,OAAyE;
|
|
1
|
+
{"version":3,"file":"ScrollSyncProvider.js","sources":["../../../src/ScrollSync/ScrollSyncProvider.tsx"],"sourcesContent":["import React from 'react';\nimport raf from 'raf';\nimport PropTypes from 'prop-types';\n\nconst ScrollSyncContext = React.createContext();\n\nconst { Provider } = ScrollSyncContext;\n\nfunction ScrollSyncProvider({ enabled, horizontal, vertical, children }) {\n const panes = useRef();\n\n const registerPane = (node, groups) => {\n groups.forEach(group => {\n if (!this.panes[group]) {\n this.panes[group] = [];\n }\n\n if (!this.findPane(node, group)) {\n if (this.panes[group].length > 0) {\n this.syncScrollPosition(this.panes[group][0], node);\n }\n this.panes[group].push(node);\n }\n });\n this.addEvents(node, groups);\n };\n const unregisterPane = (node, groups) => {\n groups.forEach(group => {\n if (this.findPane(node, group)) {\n this.removeEvents(node);\n this.panes[group].splice(this.panes[group].indexOf(node), 1);\n }\n });\n };\n const addEvents = (node, groups) => {\n /* For some reason element.addEventListener doesnt work with document.body */\n node.onscroll = this.handlePaneScroll.bind(this, node, groups); // eslint-disable-line\n };\n const removeEvents = node => {\n /* For some reason element.removeEventListener doesnt work with document.body */\n node.onscroll = null; // eslint-disable-line\n };\n const findPane = (node, group) => {\n if (!this.panes[group]) {\n return false;\n }\n\n return this.panes[group].find(pane => pane === node);\n };\n const handlePaneScroll = (node, groups) => {\n if (!enabled) return;\n\n window.requestAnimationFrame(() => {\n this.syncScrollPositions(node, groups);\n });\n };\n const syncScrollPositions = (scrolledPane, groups) => {\n groups.forEach(group => {\n this.panes[group].forEach(pane => {\n /* For all panes beside the currently scrolling one */\n if (scrolledPane !== pane) {\n /* Remove event listeners from the node that we'll manipulate */\n this.removeEvents(pane, group);\n this.syncScrollPosition(scrolledPane, pane);\n /* Re-attach event listeners after we're done scrolling */\n window.requestAnimationFrame(() => {\n this.addEvents(pane, groups);\n });\n }\n });\n });\n };\n const syncScrollPosition = raf((scrolledPane, pane) => {\n const {\n scrollTop,\n scrollHeight,\n clientHeight,\n scrollLeft,\n scrollWidth,\n clientWidth,\n } = scrolledPane;\n\n const scrollTopOffset = scrollHeight - clientHeight;\n const scrollLeftOffset = scrollWidth - clientWidth;\n\n const { proportional, vertical, horizontal } = this.props;\n\n /* Calculate the actual pane height */\n const paneHeight = pane.scrollHeight - clientHeight;\n const paneWidth = pane.scrollWidth - clientWidth;\n /* Adjust the scrollTop position of it accordingly */\n if (vertical && scrollTopOffset > 0) {\n pane.scrollTop = proportional\n ? (paneHeight * scrollTop) / scrollTopOffset\n : scrollTop; // eslint-disable-line\n }\n if (horizontal && scrollLeftOffset > 0) {\n pane.scrollLeft = proportional\n ? (paneWidth * scrollLeft) / scrollLeftOffset\n : scrollLeft; // eslint-disable-line\n }\n });\n\n return <Provider>{children}</Provider>;\n}\n\nScrollSyncProvider.propTypes = {};\nScrollSyncProvider.defaultProps = {};\n\nexport default ScrollSyncProvider;\n"],"names":["ScrollSyncContext","React","createContext","Provider","ScrollSyncProvider","enabled","horizontal","vertical","children","useRef","raf","scrolledPane","pane","scrollTop","scrollHeight","clientHeight","scrollLeft","scrollWidth","clientWidth","scrollTopOffset","scrollLeftOffset","props","proportional","paneHeight","paneWidth","propTypes","defaultProps"],"mappings":";;;AAIA,IAAMA,iBAAiB,gBAAGC,KAAK,CAACC,aAAN,EAA1B;AAEA,IAAQC,QAAR,GAAqBH,iBAArB,CAAQG,QAAR;;AAEA,SAASC,kBAAT,OAAyE;EAAA;;OAA3CC,OAA2C;WAAlCC,UAAkC;WAAtBC,QAAsB;UAAZC,QAAY,QAAZA;EAC7CC,MAAM;;EA+DOC,GAAG,CAAC,UAACC,YAAD,EAAeC,IAAf,EAAwB;IACrD,IACEC,SADF,GAOIF,YAPJ,CACEE,SADF;QAEEC,YAFF,GAOIH,YAPJ,CAEEG,YAFF;QAGEC,YAHF,GAOIJ,YAPJ,CAGEI,YAHF;QAIEC,UAJF,GAOIL,YAPJ,CAIEK,UAJF;QAKEC,WALF,GAOIN,YAPJ,CAKEM,WALF;QAMEC,WANF,GAOIP,YAPJ,CAMEO,WANF;IASA,IAAMC,eAAe,GAAGL,YAAY,GAAGC,YAAvC;IACA,IAAMK,gBAAgB,GAAGH,WAAW,GAAGC,WAAvC;IAEA,kBAA+C,KAAI,CAACG,KAApD;QAAQC,YAAR,eAAQA,YAAR;QAAsBf,QAAtB,eAAsBA,QAAtB;QAAgCD,UAAhC,eAAgCA,UAAhC;;;IAGA,IAAMiB,UAAU,GAAGX,IAAI,CAACE,YAAL,GAAoBC,YAAvC;IACA,IAAMS,SAAS,GAAGZ,IAAI,CAACK,WAAL,GAAmBC,WAArC;;;IAEA,IAAIX,QAAQ,IAAIY,eAAe,GAAG,CAAlC,EAAqC;MACnCP,IAAI,CAACC,SAAL,GAAiBS,YAAY,GACxBC,UAAU,GAAGV,SAAd,GAA2BM,eADF,GAEzBN,SAFJ,CADmC;;;IAKrC,IAAIP,UAAU,IAAIc,gBAAgB,GAAG,CAArC,EAAwC;MACtCR,IAAI,CAACI,UAAL,GAAkBM,YAAY,GACzBE,SAAS,GAAGR,UAAb,GAA2BI,gBADD,GAE1BJ,UAFJ,CADsC;;GAxBZ;EA+B9B,oBAAO,oBAAC,QAAD,QAAWR,QAAX,CAAP;AACD;;AAEDJ,kBAAkB,CAACqB,SAAnB,GAA+B,EAA/B;AACArB,kBAAkB,CAACsB,YAAnB,GAAkC,EAAlC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollSync.js","sources":["../../../src/ScrollSync/useScrollSync.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction useScrollSync(props) {\n return {};\n}\n\nuseScrollSync.propTypes = {};\nuseScrollSync.defaultProps = {};\n\nexport default useScrollSync;\n"],"names":["useScrollSync","props","propTypes","defaultProps"],"mappings":"AAGA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;
|
|
1
|
+
{"version":3,"file":"useScrollSync.js","sources":["../../../src/ScrollSync/useScrollSync.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction useScrollSync(props) {\n return {};\n}\n\nuseScrollSync.propTypes = {};\nuseScrollSync.defaultProps = {};\n\nexport default useScrollSync;\n"],"names":["useScrollSync","props","propTypes","defaultProps"],"mappings":"AAGA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;EAC5B,OAAO,EAAP;AACD;;AAEDD,aAAa,CAACE,SAAd,GAA0B,EAA1B;AACAF,aAAa,CAACG,YAAd,GAA6B,EAA7B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInstancePlugin.js","sources":["../../../src/createDataInstance/createInstancePlugin.tsx"],"sourcesContent":["function getDecoratorsFromHooks(hooks, decorators) {\n const nextDecorators = { ...decorators };\n\n Object.keys(hooks).forEach(decorator => {\n if (Array.isArray(decorators[decorator])) {\n nextDecorators[decorator] = [...decorators[decorator], hooks[decorator]];\n } else {\n nextDecorators[decorator] = hooks[decorator];\n }\n });\n\n return nextDecorators;\n}\n\nexport default function createInstancePlugin(name, hooks) {\n return decorators => getDecoratorsFromHooks(hooks, decorators);\n}\n"],"names":["getDecoratorsFromHooks","hooks","decorators","nextDecorators","Object","keys","forEach","decorator","Array","isArray","createInstancePlugin","name"],"mappings":";;;;;;;AAAA,SAASA,sBAAT,CAAgCC,KAAhC,EAAuCC,UAAvC,EAAmD;
|
|
1
|
+
{"version":3,"file":"createInstancePlugin.js","sources":["../../../src/createDataInstance/createInstancePlugin.tsx"],"sourcesContent":["function getDecoratorsFromHooks(hooks, decorators) {\n const nextDecorators = { ...decorators };\n\n Object.keys(hooks).forEach(decorator => {\n if (Array.isArray(decorators[decorator])) {\n nextDecorators[decorator] = [...decorators[decorator], hooks[decorator]];\n } else {\n nextDecorators[decorator] = hooks[decorator];\n }\n });\n\n return nextDecorators;\n}\n\nexport default function createInstancePlugin(name, hooks) {\n return decorators => getDecoratorsFromHooks(hooks, decorators);\n}\n"],"names":["getDecoratorsFromHooks","hooks","decorators","nextDecorators","Object","keys","forEach","decorator","Array","isArray","createInstancePlugin","name"],"mappings":";;;;;;;AAAA,SAASA,sBAAT,CAAgCC,KAAhC,EAAuCC,UAAvC,EAAmD;EACjD,IAAMC,cAAc,qBAAQD,UAAR,CAApB;;EAEAE,MAAM,CAACC,IAAP,CAAYJ,KAAZ,EAAmBK,OAAnB,CAA2B,UAAAC,SAAS,EAAI;IACtC,IAAIC,KAAK,CAACC,OAAN,CAAcP,UAAU,CAACK,SAAD,CAAxB,CAAJ,EAA0C;MACxCJ,cAAc,CAACI,SAAD,CAAd,gCAAgCL,UAAU,CAACK,SAAD,CAA1C,IAAuDN,KAAK,CAACM,SAAD,CAA5D;KADF,MAEO;MACLJ,cAAc,CAACI,SAAD,CAAd,GAA4BN,KAAK,CAACM,SAAD,CAAjC;;GAJJ;EAQA,OAAOJ,cAAP;AACD;;AAEc,SAASO,oBAAT,CAA8BC,IAA9B,EAAoCV,KAApC,EAA2C;EACxD,OAAO,UAAAC,UAAU;IAAA,OAAIF,sBAAsB,CAACC,KAAD,EAAQC,UAAR,CAA1B;GAAjB;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInstanceRef.js","sources":["../../../src/createDataInstance/createInstanceRef.tsx"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid';\nimport { useMemo, useRef, useState } from 'react';\nimport { orderBy } from 'lodash';\nimport {\n mergeInstance,\n registerHotKeysHookToInstance,\n registerStateHookToInstance,\n} from './utils';\n\nconst defaultDecorators = {\n instance: [],\n state: [],\n hotKeys: [],\n renderers: [],\n composeData: [],\n};\n\nexport default function createDataInstanceRef({\n uuid: uuidProp,\n data,\n renderers,\n plugins,\n customDecorators,\n ...props\n}) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const instance = useRef();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [uuid] = useState(uuidProp || (() => uuidv4()));\n\n instance.current = {\n uuid,\n state: {},\n actions: {},\n hotKeys: {}, // keyboard hotkeys to run specific actions\n originalData: data,\n records: [], // item abstraction with meta data for originalData\n renderers,\n ref(key) {\n // eslint-disable-next-line no-return-assign\n return (node) => (instance.current.refs[key] = node);\n },\n getInstance() {\n return instance.current;\n },\n props,\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const decorators = useMemo(() => {\n let nextDecorators = { ...defaultDecorators, ...customDecorators };\n\n plugins.forEach((plugin) => {\n if (!plugin) return;\n nextDecorators = plugin(nextDecorators);\n });\n\n Object.keys(nextDecorators).forEach((key) => {\n if (Array.isArray(nextDecorators[key]))\n nextDecorators[key] = orderBy(\n nextDecorators[key],\n (item) => item.order,\n );\n });\n\n return nextDecorators;\n }, []); // the plugins are defined on creation, but not changed at runtime\n\n // todo: test if getting the hooks without registering them\n // here would be beneficial to memoize instance and squeeze performance\n instance.current = decorators.instance.reduce(\n mergeInstance,\n instance.current,\n );\n instance.current = decorators.state.reduce(\n registerStateHookToInstance,\n instance.current,\n );\n instance.current = decorators.hotKeys.reduce(\n registerHotKeysHookToInstance,\n instance.current,\n );\n instance.current.renderers = decorators.renderers.reduce(\n (result, decorator) => decorator(result, instance.current),\n renderers,\n );\n\n return { instance, decorators };\n}\n"],"names":["defaultDecorators","instance","state","hotKeys","renderers","composeData","createDataInstanceRef","uuidProp","uuid","data","plugins","customDecorators","props","useRef","useState","uuidv4","current","actions","originalData","records","ref","key","node","refs","getInstance","decorators","useMemo","nextDecorators","forEach","plugin","Object","keys","Array","isArray","orderBy","item","order","reduce","mergeInstance","registerStateHookToInstance","registerHotKeysHookToInstance","result","decorator"],"mappings":";;;;;;;;;;;;;AASA,IAAMA,iBAAiB,GAAG;
|
|
1
|
+
{"version":3,"file":"createInstanceRef.js","sources":["../../../src/createDataInstance/createInstanceRef.tsx"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid';\nimport { useMemo, useRef, useState } from 'react';\nimport { orderBy } from 'lodash';\nimport {\n mergeInstance,\n registerHotKeysHookToInstance,\n registerStateHookToInstance,\n} from './utils';\n\nconst defaultDecorators = {\n instance: [],\n state: [],\n hotKeys: [],\n renderers: [],\n composeData: [],\n};\n\nexport default function createDataInstanceRef({\n uuid: uuidProp,\n data,\n renderers,\n plugins,\n customDecorators,\n ...props\n}) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const instance = useRef();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [uuid] = useState(uuidProp || (() => uuidv4()));\n\n instance.current = {\n uuid,\n state: {},\n actions: {},\n hotKeys: {}, // keyboard hotkeys to run specific actions\n originalData: data,\n records: [], // item abstraction with meta data for originalData\n renderers,\n ref(key) {\n // eslint-disable-next-line no-return-assign\n return (node) => (instance.current.refs[key] = node);\n },\n getInstance() {\n return instance.current;\n },\n props,\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const decorators = useMemo(() => {\n let nextDecorators = { ...defaultDecorators, ...customDecorators };\n\n plugins.forEach((plugin) => {\n if (!plugin) return;\n nextDecorators = plugin(nextDecorators);\n });\n\n Object.keys(nextDecorators).forEach((key) => {\n if (Array.isArray(nextDecorators[key]))\n nextDecorators[key] = orderBy(\n nextDecorators[key],\n (item) => item.order,\n );\n });\n\n return nextDecorators;\n }, []); // the plugins are defined on creation, but not changed at runtime\n\n // todo: test if getting the hooks without registering them\n // here would be beneficial to memoize instance and squeeze performance\n instance.current = decorators.instance.reduce(\n mergeInstance,\n instance.current,\n );\n instance.current = decorators.state.reduce(\n registerStateHookToInstance,\n instance.current,\n );\n instance.current = decorators.hotKeys.reduce(\n registerHotKeysHookToInstance,\n instance.current,\n );\n instance.current.renderers = decorators.renderers.reduce(\n (result, decorator) => decorator(result, instance.current),\n renderers,\n );\n\n return { instance, decorators };\n}\n"],"names":["defaultDecorators","instance","state","hotKeys","renderers","composeData","createDataInstanceRef","uuidProp","uuid","data","plugins","customDecorators","props","useRef","useState","uuidv4","current","actions","originalData","records","ref","key","node","refs","getInstance","decorators","useMemo","nextDecorators","forEach","plugin","Object","keys","Array","isArray","orderBy","item","order","reduce","mergeInstance","registerStateHookToInstance","registerHotKeysHookToInstance","result","decorator"],"mappings":";;;;;;;;;;;;;AASA,IAAMA,iBAAiB,GAAG;EACxBC,QAAQ,EAAE,EADc;EAExBC,KAAK,EAAE,EAFiB;EAGxBC,OAAO,EAAE,EAHe;EAIxBC,SAAS,EAAE,EAJa;EAKxBC,WAAW,EAAE;AALW,CAA1B;AAQe,SAASC,qBAAT,OAOZ;EAAA,IANKC,QAML,QANDC,IAMC;MALDC,IAKC,QALDA,IAKC;MAJDL,SAIC,QAJDA,SAIC;MAHDM,OAGC,QAHDA,OAGC;MAFDC,gBAEC,QAFDA,gBAEC;MADEC,KACF;;;EAED,IAAMX,QAAQ,GAAGY,MAAM,EAAvB,CAFC;;EAID,gBAAeC,QAAQ,CA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aADiB,EAEjBrC,QAAQ,CAACe,OAFQ,CAAnB;EAIAf,QAAQ,CAACe,OAAT,GAAmBS,UAAU,CAACvB,KAAX,CAAiBmC,MAAjB,CACjBE,2BADiB,EAEjBtC,QAAQ,CAACe,OAFQ,CAAnB;EAIAf,QAAQ,CAACe,OAAT,GAAmBS,UAAU,CAACtB,OAAX,CAAmBkC,MAAnB,CACjBG,6BADiB,EAEjBvC,QAAQ,CAACe,OAFQ,CAAnB;EAIAf,QAAQ,CAACe,OAAT,CAAiBZ,SAAjB,GAA6BqB,UAAU,CAACrB,SAAX,CAAqBiC,MAArB,CAC3B,UAACI,MAAD,EAASC,SAAT;IAAA,OAAuBA,SAAS,CAACD,MAAD,EAASxC,QAAQ,CAACe,OAAlB,CAAhC;GAD2B,EAE3BZ,SAF2B,CAA7B;EAKA,OAAO;IAAEH,QAAQ,EAARA,QAAF;IAAYwB,UAAU,EAAVA;GAAnB;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/createDataInstance/utils.tsx"],"sourcesContent":["export const reducePropsGetter = (decorators = [], grid) => (\n props = {},\n extraParams,\n) => {\n let nextProps = props;\n decorators.forEach((decorator) => {\n nextProps = decorator(nextProps, grid, extraParams);\n });\n return nextProps;\n};\n\n/* eslint-disable-next-line max-params */\nexport function evaluateTransforms(\n transforms,\n value,\n extraParams = {},\n props = {},\n grid,\n) {\n let nextProps = props;\n transforms.forEach((transform) => {\n nextProps = transform(value, extraParams, nextProps, grid);\n });\n return nextProps;\n}\n\n/* eslint-disable-next-line max-params */\nexport function evaluateFormatters(formatters, value, extraParams = {}, grid) {\n return formatters.reduce(\n (result, formatter) => formatter(result, extraParams, grid),\n value,\n );\n}\n\nexport function composeFormatters(\n formatters,\n instance,\n getItemValue = (record) => record.data.name,\n) {\n // todo: make the formatters subscribe to the item props instead of getting the whole instance\n // todo: addd should formatter update to memoize specific ones\n return (props) =>\n formatters.reduce(\n (result, formatter) => formatter(result, props, instance),\n getItemValue(props.record),\n );\n}\n\nexport const applyDecorators = (subject, decorators = [], ...args) =>\n decorators.reduce(\n (nextSubject, decorator) => decorator(nextSubject, ...args),\n subject,\n );\n\nexport const decorateColumns = (columns, decorators, grid) => {\n const nextColumns = applyDecorators(\n columns,\n decorators.decorateColumns,\n grid,\n );\n return nextColumns.map((column, index) =>\n applyDecorators(column, decorators.decorateColumn, grid, index),\n );\n};\n\nexport const mergeInstance = (instance, instanceHook) => ({\n ...instance,\n ...instanceHook(instance),\n});\n\nexport const registerStateHookToInstance = (instance, stateHook) => {\n const { state, actions } = stateHook(instance);\n return {\n ...instance,\n state: {\n ...instance.state,\n ...state,\n },\n actions: {\n ...instance.actions,\n ...actions,\n },\n };\n};\n\nconst reduceHotKey = (\n instance,\n { key, handler, options, allowDocumentHandler },\n) => ({\n ...instance,\n hotKeys: {\n ...instance.hotKeys,\n [key]: { handler, options, allowDocumentHandler },\n },\n});\n\nexport const registerHotKeysHookToInstance = (instance, hotKeysHook) => {\n const hotKeys = hotKeysHook(instance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, instance);\n }\n return reduceHotKey(instance, hotKeys);\n};\n"],"names":["reducePropsGetter","decorators","grid","props","extraParams","nextProps","forEach","decorator","evaluateTransforms","transforms","value","transform","evaluateFormatters","formatters","reduce","result","formatter","composeFormatters","instance","getItemValue","record","data","name","applyDecorators","subject","args","nextSubject","decorateColumns","columns","nextColumns","map","column","index","decorateColumn","mergeInstance","instanceHook","registerStateHookToInstance","stateHook","state","actions","reduceHotKey","key","handler","options","allowDocumentHandler","hotKeys","registerHotKeysHookToInstance","hotKeysHook","Array","isArray"],"mappings":";;;;;;IAAaA,iBAAiB,GAAG,SAApBA,iBAAoB;
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/createDataInstance/utils.tsx"],"sourcesContent":["export const reducePropsGetter = (decorators = [], grid) => (\n props = {},\n extraParams,\n) => {\n let nextProps = props;\n decorators.forEach((decorator) => {\n nextProps = decorator(nextProps, grid, extraParams);\n });\n return nextProps;\n};\n\n/* eslint-disable-next-line max-params */\nexport function evaluateTransforms(\n transforms,\n value,\n extraParams = {},\n props = {},\n grid,\n) {\n let nextProps = props;\n transforms.forEach((transform) => {\n nextProps = transform(value, extraParams, nextProps, grid);\n });\n return nextProps;\n}\n\n/* eslint-disable-next-line max-params */\nexport function evaluateFormatters(formatters, value, extraParams = {}, grid) {\n return formatters.reduce(\n (result, formatter) => formatter(result, extraParams, grid),\n value,\n );\n}\n\nexport function composeFormatters(\n formatters,\n instance,\n getItemValue = (record) => record.data.name,\n) {\n // todo: make the formatters subscribe to the item props instead of getting the whole instance\n // todo: addd should formatter update to memoize specific ones\n return (props) =>\n formatters.reduce(\n (result, formatter) => formatter(result, props, instance),\n getItemValue(props.record),\n );\n}\n\nexport const applyDecorators = (subject, decorators = [], ...args) =>\n decorators.reduce(\n (nextSubject, decorator) => decorator(nextSubject, ...args),\n subject,\n );\n\nexport const decorateColumns = (columns, decorators, grid) => {\n const nextColumns = applyDecorators(\n columns,\n decorators.decorateColumns,\n grid,\n );\n return nextColumns.map((column, index) =>\n applyDecorators(column, decorators.decorateColumn, grid, index),\n );\n};\n\nexport const mergeInstance = (instance, instanceHook) => ({\n ...instance,\n ...instanceHook(instance),\n});\n\nexport const registerStateHookToInstance = (instance, stateHook) => {\n const { state, actions } = stateHook(instance);\n return {\n ...instance,\n state: {\n ...instance.state,\n ...state,\n },\n actions: {\n ...instance.actions,\n ...actions,\n },\n };\n};\n\nconst reduceHotKey = (\n instance,\n { key, handler, options, allowDocumentHandler },\n) => ({\n ...instance,\n hotKeys: {\n ...instance.hotKeys,\n [key]: { handler, options, allowDocumentHandler },\n },\n});\n\nexport const registerHotKeysHookToInstance = (instance, hotKeysHook) => {\n const hotKeys = hotKeysHook(instance);\n if (Array.isArray(hotKeys)) {\n return hotKeys.reduce(reduceHotKey, instance);\n }\n return reduceHotKey(instance, hotKeys);\n};\n"],"names":["reducePropsGetter","decorators","grid","props","extraParams","nextProps","forEach","decorator","evaluateTransforms","transforms","value","transform","evaluateFormatters","formatters","reduce","result","formatter","composeFormatters","instance","getItemValue","record","data","name","applyDecorators","subject","args","nextSubject","decorateColumns","columns","nextColumns","map","column","index","decorateColumn","mergeInstance","instanceHook","registerStateHookToInstance","stateHook","state","actions","reduceHotKey","key","handler","options","allowDocumentHandler","hotKeys","registerHotKeysHookToInstance","hotKeysHook","Array","isArray"],"mappings":";;;;;;IAAaA,iBAAiB,GAAG,SAApBA,iBAAoB;EAAA,IAACC,UAAD,uEAAc,EAAd;EAAA,IAAkBC,IAAlB;EAAA,OAA2B,YAGvD;IAAA,IAFHC,KAEG,uEAFK,EAEL;IAAA,IADHC,WACG;IACH,IAAIC,SAAS,GAAGF,KAAhB;IACAF,UAAU,CAACK,OAAX,CAAmB,UAACC,SAAD,EAAe;MAChCF,SAAS,GAAGE,SAAS,CAACF,SAAD,EAAYH,IAAZ,EAAkBE,WAAlB,CAArB;KADF;IAGA,OAAOC,SAAP;GAR+B;AAAA;AAWjC;;AACO,SAASG,kBAAT,CACLC,UADK,EAELC,KAFK,EAML;EAAA,IAHAN,WAGA,uEAHc,EAGd;EAAA,IAFAD,KAEA,uEAFQ,EAER;EAAA,IADAD,IACA;EACA,IAAIG,SAAS,GAAGF,KAAhB;EACAM,UAAU,CAACH,OAAX,CAAmB,UAACK,SAAD,EAAe;IAChCN,SAAS,GAAGM,SAAS,CAACD,KAAD,EAAQN,WAAR,EAAqBC,SAArB,EAAgCH,IAAhC,CAArB;GADF;EAGA,OAAOG,SAAP;AACD;AAED;;AACO,SAASO,kBAAT,CAA4BC,UAA5B,EAAwCH,KAAxC,EAAuE;EAAA,IAAxBN,WAAwB,uEAAV,EAAU;EAAA,IAANF,IAAM;EAC5E,OAAOW,UAAU,CAACC,MAAX,CACL,UAACC,MAAD,EAASC,SAAT;IAAA,OAAuBA,SAAS,CAACD,MAAD,EAASX,WAAT,EAAsBF,IAAtB,CAAhC;GAD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EAAyB;EAClE,iBAA2BA,SAAS,CAACnB,QAAD,CAApC;MAAQoB,KAAR,cAAQA,KAAR;MAAeC,OAAf,cAAeA,OAAf;;EACA,uCACKrB,QADL;IAEEoB,KAAK,kCACApB,QAAQ,CAACoB,KADT,GAEAA,KAFA,CAFP;IAMEC,OAAO,kCACFrB,QAAQ,CAACqB,OADP,GAEFA,OAFE;;AAKV;;AAED,IAAMC,YAAY,GAAG,SAAfA,YAAe,CACnBtB,QADmB;EAAA,IAEjBuB,GAFiB,QAEjBA,GAFiB;MAEZC,OAFY,QAEZA,OAFY;MAEHC,OAFG,QAEHA,OAFG;MAEMC,oBAFN,QAEMA,oBAFN;EAAA,uCAIhB1B,QAJgB;IAKnB2B,OAAO,kCACF3B,QAAQ,CAAC2B,OADP,2BAEJJ,GAFI,EAEE;MAAEC,OAAO,EAAPA,OAAF;MAAWC,OAAO,EAAPA,OAAX;MAAoBC,oBAAoB,EAApBA;KAFtB;;AALY,CAArB;;IAWaE,6BAA6B,GAAG,SAAhCA,6BAAgC,CAAC5B,QAAD,EAAW6B,WAAX,EAA2B;EACtE,IAAMF,OAAO,GAAGE,WAAW,CAAC7B,QAAD,CAA3B;;EACA,IAAI8B,KAAK,CAACC,OAAN,CAAcJ,OAAd,CAAJ,EAA4B;IAC1B,OAAOA,OAAO,CAAC/B,MAAR,CAAe0B,YAAf,EAA6BtB,QAA7B,CAAP;;;EAEF,OAAOsB,YAAY,CAACtB,QAAD,EAAW2B,OAAX,CAAnB;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/defer-render-hoc/index.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport raf from 'raf';\nimport hoistNonReactStatic from 'hoist-non-react-statics';\n\n/**\n * Allows two animation frames to complete to allow other components to update\n * and re-render before mounting and rendering an expensive `WrappedComponent`.\n *\n * @param WrappedComponent\n * @param fallback\n */\nexport default function deferComponentRender(WrappedComponent, fallback) {\n class DeferredRenderWrapper extends PureComponent {\n state = { shouldRender: false };\n\n componentDidMount() {\n raf(() => raf(() => this.setState({ shouldRender: true })));\n }\n\n render() {\n // eslint-disable-next-line react/destructuring-assignment\n return this.state.shouldRender ? (\n <WrappedComponent {...this.props} />\n ) : (\n fallback\n );\n }\n }\n\n return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);\n}\n"],"names":["deferComponentRender","WrappedComponent","fallback","DeferredRenderWrapper","state","shouldRender","raf","setState","props","PureComponent","hoistNonReactStatic"],"mappings":";;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASA,oBAAT,CAA8BC,gBAA9B,EAAgDC,QAAhD,EAA0D;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/defer-render-hoc/index.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport raf from 'raf';\nimport hoistNonReactStatic from 'hoist-non-react-statics';\n\n/**\n * Allows two animation frames to complete to allow other components to update\n * and re-render before mounting and rendering an expensive `WrappedComponent`.\n *\n * @param WrappedComponent\n * @param fallback\n */\nexport default function deferComponentRender(WrappedComponent, fallback) {\n class DeferredRenderWrapper extends PureComponent {\n state = { shouldRender: false };\n\n componentDidMount() {\n raf(() => raf(() => this.setState({ shouldRender: true })));\n }\n\n render() {\n // eslint-disable-next-line react/destructuring-assignment\n return this.state.shouldRender ? (\n <WrappedComponent {...this.props} />\n ) : (\n fallback\n );\n }\n }\n\n return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);\n}\n"],"names":["deferComponentRender","WrappedComponent","fallback","DeferredRenderWrapper","state","shouldRender","raf","setState","props","PureComponent","hoistNonReactStatic"],"mappings":";;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASA,oBAAT,CAA8BC,gBAA9B,EAAgDC,QAAhD,EAA0D;EAAA,IACjEC,qBADiE;IAAA;;IAAA;;IAAA;MAAA;;MAAA;;MAAA;QAAA;;;MAAA;MAAA,MAErEC,KAFqE,GAE7D;QAAEC,YAAY,EAAE;OAF6C;MAAA;;;IAAA;MAAA;MAAA,OAIrE,6BAAoB;QAAA;;QAClBC,GAAG,CAAC;UAAA,OAAMA,GAAG,CAAC;YAAA,OAAM,MAAI,CAACC,QAAL,CAAc;cAAEF,YAAY,EAAE;aAA9B,CAAN;WAAD,CAAT;SAAD,CAAH;;;MALmE;MAAA,OAQrE,kBAAS;;QAEP,OAAO,KAAKD,KAAL,CAAWC,YAAX,gBACL,oBAAC,gBAAD,EAAsB,KAAKG,KAA3B,CADK,GAGLN,QAHF;;;;IAVmE;IACnCO,aADmC;;EAkBvE,OAAOC,mBAAmB,CAACP,qBAAD,EAAwBF,gBAAxB,CAA1B;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarProvider.js","sources":["../../../src/toolbar/ToolbarProvider.tsx"],"sourcesContent":["import React, { useMemo, useRef, useState, useEffect } from 'react';\nimport DSPopover from '@elliemae/ds-popper';\nimport { useOnClickOutside } from '@elliemae/ds-utilities';\n\nexport const ToolbarContext = React.createContext();\n\nconst { Provider } = ToolbarContext;\n\nconst useScrollListener = (callback, dependencies) => {\n useEffect(() => {\n window.addEventListener('scroll', callback, true);\n return () => {\n window.removeEventListener('scroll', callback, true);\n };\n }, [dependencies]);\n};\n\nconst noop = () => null;\nfunction ToolbarProvider({ delay = 200, children, onHide = noop, onShow = noop }) {\n const showTimer = useRef();\n const hideTimer = useRef();\n const toolbarRef = useRef();\n const [tooltipState, setTooltipState] = useState({});\n\n const show = (state) => {\n if (state.reference === tooltipState.reference) clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(\n () =>\n setTooltipState({\n ...state,\n visible: true,\n }),\n delay,\n );\n onShow();\n };\n\n const hide = (e, force) => {\n if (!force) clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(\n () =>\n setTooltipState((prevState) => ({\n ...prevState,\n visible: false,\n })),\n 100,\n );\n onHide(tooltipState, e);\n };\n\n useScrollListener((e) => hide(e, true), tooltipState.visible);\n useOnClickOutside(toolbarRef, () => hide());\n\n const keyDownHandler = (e) => {\n if (e.key === 'Escape') {\n hide(e);\n }\n };\n\n useEffect(() => {\n window.addEventListener('keydown', keyDownHandler);\n return () => {\n window.removeEventListener('keydown', keyDownHandler);\n };\n });\n\n const value = useMemo(\n () => ({\n state: tooltipState,\n show,\n hide,\n }),\n [tooltipState.reference],\n );\n\n return (\n <Provider value={value}>\n {children}\n <DSPopover\n boundaries=\"scrollParent\"\n {...(tooltipState.options || {})}\n content={tooltipState.renderer}\n placement=\"left\"\n referenceEl={tooltipState.reference}\n renderer={({ as: Component, style, children: Content }) => (\n <div ref={toolbarRef} onMouseEnter={(e) => show(tooltipState, e)} onMouseLeave={hide}>\n <Component style={style}>{Content}</Component>\n </div>\n )}\n style={tooltipState.style}\n visible={tooltipState.visible}\n />\n </Provider>\n );\n}\n\nexport default React.memo(ToolbarProvider);\n"],"names":["ToolbarContext","React","createContext","Provider","useScrollListener","callback","dependencies","useEffect","window","addEventListener","removeEventListener","noop","ToolbarProvider","delay","children","onHide","onShow","showTimer","useRef","hideTimer","toolbarRef","useState","tooltipState","setTooltipState","show","state","reference","clearTimeout","current","setTimeout","visible","hide","e","force","prevState","useOnClickOutside","keyDownHandler","key","value","useMemo","options","renderer","Component","as","style","Content","memo"],"mappings":";;;;;;;;;;IAIaA,cAAc,gBAAGC,KAAK,CAACC,aAAN;AAE9B,IAAQC,QAAR,GAAqBH,cAArB,CAAQG,QAAR;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAWC,YAAX,EAA4B;
|
|
1
|
+
{"version":3,"file":"ToolbarProvider.js","sources":["../../../src/toolbar/ToolbarProvider.tsx"],"sourcesContent":["import React, { useMemo, useRef, useState, useEffect } from 'react';\nimport DSPopover from '@elliemae/ds-popper';\nimport { useOnClickOutside } from '@elliemae/ds-utilities';\n\nexport const ToolbarContext = React.createContext();\n\nconst { Provider } = ToolbarContext;\n\nconst useScrollListener = (callback, dependencies) => {\n useEffect(() => {\n window.addEventListener('scroll', callback, true);\n return () => {\n window.removeEventListener('scroll', callback, true);\n };\n }, [dependencies]);\n};\n\nconst noop = () => null;\nfunction ToolbarProvider({ delay = 200, children, onHide = noop, onShow = noop }) {\n const showTimer = useRef();\n const hideTimer = useRef();\n const toolbarRef = useRef();\n const [tooltipState, setTooltipState] = useState({});\n\n const show = (state) => {\n if (state.reference === tooltipState.reference) clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(\n () =>\n setTooltipState({\n ...state,\n visible: true,\n }),\n delay,\n );\n onShow();\n };\n\n const hide = (e, force) => {\n if (!force) clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(\n () =>\n setTooltipState((prevState) => ({\n ...prevState,\n visible: false,\n })),\n 100,\n );\n onHide(tooltipState, e);\n };\n\n useScrollListener((e) => hide(e, true), tooltipState.visible);\n useOnClickOutside(toolbarRef, () => hide());\n\n const keyDownHandler = (e) => {\n if (e.key === 'Escape') {\n hide(e);\n }\n };\n\n useEffect(() => {\n window.addEventListener('keydown', keyDownHandler);\n return () => {\n window.removeEventListener('keydown', keyDownHandler);\n };\n });\n\n const value = useMemo(\n () => ({\n state: tooltipState,\n show,\n hide,\n }),\n [tooltipState.reference],\n );\n\n return (\n <Provider value={value}>\n {children}\n <DSPopover\n boundaries=\"scrollParent\"\n {...(tooltipState.options || {})}\n content={tooltipState.renderer}\n placement=\"left\"\n referenceEl={tooltipState.reference}\n renderer={({ as: Component, style, children: Content }) => (\n <div ref={toolbarRef} onMouseEnter={(e) => show(tooltipState, e)} onMouseLeave={hide}>\n <Component style={style}>{Content}</Component>\n </div>\n )}\n style={tooltipState.style}\n visible={tooltipState.visible}\n />\n </Provider>\n );\n}\n\nexport default React.memo(ToolbarProvider);\n"],"names":["ToolbarContext","React","createContext","Provider","useScrollListener","callback","dependencies","useEffect","window","addEventListener","removeEventListener","noop","ToolbarProvider","delay","children","onHide","onShow","showTimer","useRef","hideTimer","toolbarRef","useState","tooltipState","setTooltipState","show","state","reference","clearTimeout","current","setTimeout","visible","hide","e","force","prevState","useOnClickOutside","keyDownHandler","key","value","useMemo","options","renderer","Component","as","style","Content","memo"],"mappings":";;;;;;;;;;IAIaA,cAAc,gBAAGC,KAAK,CAACC,aAAN;AAE9B,IAAQC,QAAR,GAAqBH,cAArB,CAAQG,QAAR;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAWC,YAAX,EAA4B;EACpDC,SAAS,CAAC,YAAM;IACdC,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCJ,QAAlC,EAA4C,IAA5C;IACA,OAAO,YAAM;MACXG,MAAM,CAACE,mBAAP,CAA2B,QAA3B,EAAqCL,QAArC,EAA+C,IAA/C;KADF;GAFO,EAKN,CAACC,YAAD,CALM,CAAT;AAMD,CAPD;;AASA,IAAMK,IAAI,GAAG,SAAPA,IAAO;EAAA,OAAM,IAAN;AAAA,CAAb;;AACA,SAASC,eAAT,OAAkF;EAAA,sBAAvDC,KAAuD;MAAvDA,KAAuD,2BAA/C,GAA+C;MAA1CC,QAA0C,QAA1CA,QAA0C;yBAAhCC,MAAgC;MAAhCA,MAAgC,4BAAvBJ,IAAuB;yBAAjBK,MAAiB;MAAjBA,MAAiB,4BAARL,IAAQ;EAChF,IAAMM,SAAS,GAAGC,MAAM,EAAxB;EACA,IAAMC,SAAS,GAAGD,MAAM,EAAxB;EACA,IAAME,UAAU,GAAGF,MAAM,EAAzB;;EACA,gBAAwCG,QAAQ,CAAC,EAAD,CAAhD;;MAAOC,YAAP;MAAqBC,eAArB;;EAEA,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAACC,KAAD,EAAW;IACtB,IAAIA,KAAK,CAACC,SAAN,KAAoBJ,YAAY,CAACI,SAArC,EAAgDC,YAAY,CAACR,SAAS,CAACS,OAAX,CAAZ;IAChDX,SAAS,CAACW,OAAV,GAAoBC,UAAU,CAC5B;MAAA,OACEN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,UAAU,EAAC;KACNQ,YAAY,CAACkB,OAAb,IAAwB,EAF/B;IAGE,OAAO,EAAElB,YAAY,CAACmB,QAHxB;IAIE,SAAS,EAAC,MAJZ;IAKE,WAAW,EAAEnB,YAAY,CAACI,SAL5B;IAME,QAAQ,EAAE;MAAA,IAAOgB,SAAP,SAAGC,EAAH;UAAkBC,KAAlB,SAAkBA,KAAlB;UAAmCC,OAAnC,SAAyB/B,QAAzB;MAAA,oBACR;QAAK,GAAG,EAAEM,UAAV;QAAsB,YAAY,EAAE,sBAACY,CAAD;UAAA,OAAOR,IAAI,CAACF,YAAD,CAAX;SAApC;QAAkE,YAAY,EAAES;sBAC9E,oBAAC,SAAD;QAAW,KAAK,EAAEa;SAAQC,OAA1B,CADF,CADQ;KANZ;IAWE,KAAK,EAAEvB,YAAY,CAACsB,KAXtB;IAYE,OAAO,EAAEtB,YAAY,CAACQ;KAd1B,CADF;AAmBD;;AAED,qCAAe7B,KAAK,CAAC6C,IAAN,CAAWlC,eAAX,CAAf;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolatileRowsListener.js","sources":["../../../src/useDataGrid/VolatileRowsListener.tsx"],"sourcesContent":["import { safeCall } from '@elliemae/ds-utilities';\n\nexport default class VolatileRowsListener {\n observers = [];\n\n observe(listener) {\n this.observers.push(listener);\n }\n\n notify(nextRows) {\n this.observers.forEach(observer => safeCall(observer, nextRows));\n this.observers = [];\n }\n}\n"],"names":["VolatileRowsListener","observers","listener","push","nextRows","forEach","observer","safeCall"],"mappings":";;;;IAEqBA;;;;SACnBC,YAAY;;;;;WAEZ,iBAAQC,QAAR,EAAkB;
|
|
1
|
+
{"version":3,"file":"VolatileRowsListener.js","sources":["../../../src/useDataGrid/VolatileRowsListener.tsx"],"sourcesContent":["import { safeCall } from '@elliemae/ds-utilities';\n\nexport default class VolatileRowsListener {\n observers = [];\n\n observe(listener) {\n this.observers.push(listener);\n }\n\n notify(nextRows) {\n this.observers.forEach(observer => safeCall(observer, nextRows));\n this.observers = [];\n }\n}\n"],"names":["VolatileRowsListener","observers","listener","push","nextRows","forEach","observer","safeCall"],"mappings":";;;;IAEqBA;;;;SACnBC,YAAY;;;;;WAEZ,iBAAQC,QAAR,EAAkB;MAChB,KAAKD,SAAL,CAAeE,IAAf,CAAoBD,QAApB;;;;WAGF,gBAAOE,QAAP,EAAiB;MACf,KAAKH,SAAL,CAAeI,OAAf,CAAuB,UAAAC,QAAQ;QAAA,OAAIC,QAAQ,CAACD,QAAD,EAAWF,QAAX,CAAZ;OAA/B;MACA,KAAKH,SAAL,GAAiB,EAAjB;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initColumnDefinition.js","sources":["../../../src/useDataGrid/initColumnDefinition.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n get,\n curry,\n set,\n cloneDeep,\n isFunction,\n} from '@elliemae/ds-utilities';\n\n// TODO: use lenses to access nested fields\n\nexport const appendHeaderFormatter = curry((formatter, column) => ({\n ...column,\n header: {\n ...column.header,\n formatters: [...get(column, 'header.formatters', []), formatter],\n },\n}));\n\nexport const appendCellFormatter = curry(\n (formatter, column, path = 'formatters') => {\n const nextColumn = cloneDeep(column);\n const formatters = get(nextColumn, ['cell', path], []);\n const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);\n if (Array.isArray(formatter)) {\n if (formatter[1]) scrollingFormatters.push(formatter[1]);\n formatters.push(formatter[0]);\n } else {\n formatters.push(formatter);\n scrollingFormatters.push(formatter);\n }\n set(nextColumn, ['cell', path], formatters);\n set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);\n return nextColumn;\n },\n);\n\nconst defaultColumnDefinitionOptions = {\n normalize: false,\n useTextTruncation: true,\n isUserColumn: true,\n visible: true,\n};\n\nexport const mergeClassNameToColumnHeader = curry((className, column) => {\n const headerProps = get(column, ['header', 'props'], {});\n const headerClassName = headerProps.className || '';\n return {\n ...column,\n header: {\n ...column.header,\n props: {\n ...headerProps,\n className: `${headerClassName} ${className}`,\n },\n },\n };\n});\n\nexport default function initColumnDefinition(options = {}) {\n // eslint-disable-next-line complexity\n return (column) => {\n // todo: clean this\n if (column.type === 'number') {\n // eslint-disable-next-line no-param-reassign\n column.cellStyle = {\n textAlign: 'right',\n };\n }\n const { useTextTruncation = true, isUserColumn, visible, normalize } = {\n ...defaultColumnDefinitionOptions,\n ...options,\n };\n\n if (normalize) {\n // eslint-disable-next-line no-param-reassign\n column.originalProperty = column.property;\n // eslint-disable-next-line no-param-reassign\n column.property = column.property.replace(/\\s+/g, '');\n }\n\n // eslint-disable-next-line no-param-reassign\n column.props = {\n ...column.props,\n style: {},\n };\n // eslint-disable-next-line no-param-reassign\n column.header = {\n ...column.header,\n label: column.label,\n formatters: [...get(column, ['header', 'formatters'], [])],\n props: {\n style: column.headerStyle || {},\n },\n };\n if (\n useTextTruncation &&\n !(\n isFunction(column.customHeaderRenderer) ||\n column.header.formatters.length\n )\n ) {\n column.header.formatters.push((value) => (\n <span className=\"cell-value\">{value}</span>\n ));\n }\n\n // eslint-disable-next-line no-param-reassign\n column.cell = {\n ...column.cell,\n transforms: [],\n formatters: [...get(column, ['cell', 'formatters'], [])],\n scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],\n props: {\n style: column.cellStyle || {},\n },\n };\n\n if (\n useTextTruncation &&\n !(isFunction(column.customRenderer) || column.cell.formatters.length)\n ) {\n column.cell.formatters.push((value) => (\n <span\n className=\"cell-value\"\n style={{\n justifyContent:\n column.type === 'number' ? 'flex-end' : 'flex-start',\n }}\n >\n {value}\n </span>\n ));\n }\n // eslint-disable-next-line no-param-reassign\n column.uuid = column.uuid || uuidv4();\n // eslint-disable-next-line no-param-reassign\n column.visible = column.visible === undefined ? visible : column.visible;\n // eslint-disable-next-line no-param-reassign, max-lines\n column.isUserColumn = column.isUserColumn || isUserColumn;\n // eslint-disable-next-line no-param-reassign\n column.headerHookEffects = [];\n return column;\n };\n}\n"],"names":["appendHeaderFormatter","curry","formatter","column","header","formatters","get","appendCellFormatter","path","nextColumn","cloneDeep","scrollingFormatters","Array","isArray","push","set","defaultColumnDefinitionOptions","normalize","useTextTruncation","isUserColumn","visible","mergeClassNameToColumnHeader","className","headerProps","headerClassName","props","initColumnDefinition","options","type","cellStyle","textAlign","originalProperty","property","replace","style","label","headerStyle","isFunction","customHeaderRenderer","length","value","cell","transforms","customRenderer","justifyContent","uuid","uuidv4","undefined","headerHookEffects"],"mappings":";;;;;;;;;;IAcaA,qBAAqB,GAAGC,KAAK,CAAC,UAACC,SAAD,EAAYC,MAAZ;
|
|
1
|
+
{"version":3,"file":"initColumnDefinition.js","sources":["../../../src/useDataGrid/initColumnDefinition.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n get,\n curry,\n set,\n cloneDeep,\n isFunction,\n} from '@elliemae/ds-utilities';\n\n// TODO: use lenses to access nested fields\n\nexport const appendHeaderFormatter = curry((formatter, column) => ({\n ...column,\n header: {\n ...column.header,\n formatters: [...get(column, 'header.formatters', []), formatter],\n },\n}));\n\nexport const appendCellFormatter = curry(\n (formatter, column, path = 'formatters') => {\n const nextColumn = cloneDeep(column);\n const formatters = get(nextColumn, ['cell', path], []);\n const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);\n if (Array.isArray(formatter)) {\n if (formatter[1]) scrollingFormatters.push(formatter[1]);\n formatters.push(formatter[0]);\n } else {\n formatters.push(formatter);\n scrollingFormatters.push(formatter);\n }\n set(nextColumn, ['cell', path], formatters);\n set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);\n return nextColumn;\n },\n);\n\nconst defaultColumnDefinitionOptions = {\n normalize: false,\n useTextTruncation: true,\n isUserColumn: true,\n visible: true,\n};\n\nexport const mergeClassNameToColumnHeader = curry((className, column) => {\n const headerProps = get(column, ['header', 'props'], {});\n const headerClassName = headerProps.className || '';\n return {\n ...column,\n header: {\n ...column.header,\n props: {\n ...headerProps,\n className: `${headerClassName} ${className}`,\n },\n },\n };\n});\n\nexport default function initColumnDefinition(options = {}) {\n // eslint-disable-next-line complexity\n return (column) => {\n // todo: clean this\n if (column.type === 'number') {\n // eslint-disable-next-line no-param-reassign\n column.cellStyle = {\n textAlign: 'right',\n };\n }\n const { useTextTruncation = true, isUserColumn, visible, normalize } = {\n ...defaultColumnDefinitionOptions,\n ...options,\n };\n\n if (normalize) {\n // eslint-disable-next-line no-param-reassign\n column.originalProperty = column.property;\n // eslint-disable-next-line no-param-reassign\n column.property = column.property.replace(/\\s+/g, '');\n }\n\n // eslint-disable-next-line no-param-reassign\n column.props = {\n ...column.props,\n style: {},\n };\n // eslint-disable-next-line no-param-reassign\n column.header = {\n ...column.header,\n label: column.label,\n formatters: [...get(column, ['header', 'formatters'], [])],\n props: {\n style: column.headerStyle || {},\n },\n };\n if (\n useTextTruncation &&\n !(\n isFunction(column.customHeaderRenderer) ||\n column.header.formatters.length\n )\n ) {\n column.header.formatters.push((value) => (\n <span className=\"cell-value\">{value}</span>\n ));\n }\n\n // eslint-disable-next-line no-param-reassign\n column.cell = {\n ...column.cell,\n transforms: [],\n formatters: [...get(column, ['cell', 'formatters'], [])],\n scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],\n props: {\n style: column.cellStyle || {},\n },\n };\n\n if (\n useTextTruncation &&\n !(isFunction(column.customRenderer) || column.cell.formatters.length)\n ) {\n column.cell.formatters.push((value) => (\n <span\n className=\"cell-value\"\n style={{\n justifyContent:\n column.type === 'number' ? 'flex-end' : 'flex-start',\n }}\n >\n {value}\n </span>\n ));\n }\n // eslint-disable-next-line no-param-reassign\n column.uuid = column.uuid || uuidv4();\n // eslint-disable-next-line no-param-reassign\n column.visible = column.visible === undefined ? visible : column.visible;\n // eslint-disable-next-line no-param-reassign, max-lines\n column.isUserColumn = column.isUserColumn || isUserColumn;\n // eslint-disable-next-line no-param-reassign\n column.headerHookEffects = [];\n return column;\n };\n}\n"],"names":["appendHeaderFormatter","curry","formatter","column","header","formatters","get","appendCellFormatter","path","nextColumn","cloneDeep","scrollingFormatters","Array","isArray","push","set","defaultColumnDefinitionOptions","normalize","useTextTruncation","isUserColumn","visible","mergeClassNameToColumnHeader","className","headerProps","headerClassName","props","initColumnDefinition","options","type","cellStyle","textAlign","originalProperty","property","replace","style","label","headerStyle","isFunction","customHeaderRenderer","length","value","cell","transforms","customRenderer","justifyContent","uuid","uuidv4","undefined","headerHookEffects"],"mappings":";;;;;;;;;;IAcaA,qBAAqB,GAAGC,KAAK,CAAC,UAACC,SAAD,EAAYC,MAAZ;EAAA,uCACtCA,MADsC;IAEzCC,MAAM,kCACDD,MAAM,CAACC,MADN;MAEJC,UAAU,+BAAMC,GAAG,CAACH,MAAD,EAAS,mBAAT,EAA8B,EAA9B,CAAT,IAA4CD,SAA5C;;;AAJ6B,CAAD;IAQ7BK,mBAAmB,GAAGN,KAAK,CACtC,UAACC,SAAD,EAAYC,MAAZ,EAA4C;EAAA,IAAxBK,IAAwB,uEAAjB,YAAiB;EAC1C,IAAMC,UAAU,GAAGC,SAAS,CAACP,MAAD,CAA5B;EACA,IAAME,UAAU,GAAGC,GAAG,CAACG,UAAD,EAAa,CAAC,MAAD,EAASD,IAAT,CAAb,EAA6B,EAA7B,CAAtB;EACA,IAAMG,mBAAmB,GAAGL,GAAG,CAACG,UAAD,EAAa,0BAAb,EAAyC,EAAzC,CAA/B;;EACA,IAAIG,KAAK,CAACC,OAAN,CAAcX,SAAd,CAAJ,EAA8B;IAC5B,IAAIA,SAAS,CAAC,CAAD,CAAb,EAAkBS,mBAAmB,CAACG,IAApB,CAAyBZ,SAAS,CAAC,CAAD,CAAlC;IAClBG,UAAU,CAACS,IAAX,CAAgBZ,SAAS,CAAC,CAAD,CAAzB;GAFF,MAGO;IACLG,UAAU,CAACS,IAAX,CAAgBZ,SAAhB;IACAS,mBAAmB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AZ,CAAuBkC,MAA9D,CAFF,EAGE;MACApC,MAAM,CAACsC,IAAP,CAAYpC,UAAZ,CAAuBS,IAAvB,CAA4B,UAAC0B,KAAD;QAAA,oBAC1B;UACE,SAAS,EAAC,YADZ;UAEE,KAAK,EAAE;YACLI,cAAc,EACZzC,MAAM,CAACyB,IAAP,KAAgB,QAAhB,GAA2B,UAA3B,GAAwC;;WAG3CY,KAPH,CAD0B;OAA5B;KA7De;;;IA0EjBrC,MAAM,CAAC0C,IAAP,GAAc1C,MAAM,CAAC0C,IAAP,IAAeC,EAAM,EAAnC,CA1EiB;;IA4EjB3C,MAAM,CAACiB,OAAP,GAAiBjB,MAAM,CAACiB,OAAP,KAAmB2B,SAAnB,GAA+B3B,OAA/B,GAAyCjB,MAAM,CAACiB,OAAjE,CA5EiB;;IA8EjBjB,MAAM,CAACgB,YAAP,GAAsBhB,MAAM,CAACgB,YAAP,IAAuBA,YAA7C,CA9EiB;;IAgFjBhB,MAAM,CAAC6C,iBAAP,GAA2B,EAA3B;IACA,OAAO7C,MAAP;GAjFF;AAmFD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataGrid.js","sources":["../../../src/useDataGrid/useDataGrid.tsx"],"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 default function 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"],"names":["IS_INTERNET_EXPLORER","isInternetExplorer","useDataGrid","uuidProp","uuid","pluginsFromProps","plugins","rows","columns","renderers","props","instance","useRef","tableRef","headerRef","bodyRef","bodyInnerRef","useState","uuidv4","hasScroll","setHasScroll","isRowDragging","setIsRowDragging","isScrolling","shouldRefocus","VolatileRowsListener","RowsObserver","useDerivedStateFromProps","onUpdate","resolve","method","extra","compose","byFunction","nested","updateOnStateChange","originalRows","updateRows","current","decoratedRenderers","cloneDeep","decoratedColumns","composedRows","getRowProps","getHeaderRowProps","getBodyProps","getTableProps","effects","refs","table","body","header","innerBody","state","actions","enableEvents","document","style","pointerEvents","disableEvents","observeRows","observer","observe","hotKeys","getState","getInstance","defaultDecorators","decorateGrid","registerStateHook","registerHotKeys","decorateColumn","decorateColumns","cols","map","col","initColumnDefinition","useTextTruncation","wrapText","normalize","normalizeDataKeys","decorateRenderers","getHeaderProps","composeRows","decorators","useMemo","nextDecorators","forEach","plugin","reduce","nextInstance","decorator","reduceHotKey","key","handler","options","Array","isArray","applyDecorators","visibleColumns","filter","column","visible","length","reducePropsGetter","nextRows","getter","notify","currentShouldRefocus","prevState","usePrevious","isObject","forced","value","isEqual","instanceRef","setRef"],"mappings":";;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Bd,aAAjB,CAA+Bc,OAA5D;AACA,MAAMsE,SAAS,GAAGC,WAAW,CAAClG,QAAQ,CAAC2B,OAAT,CAAiBe,KAAlB,CAA7B;;AACA,MAAIyD,QAAQ,CAACH,oBAAD,CAAR,IAAkCA,oBAAoB,CAACI,MAA3D,EAAmE;AACjEpG,IAAAA,QAAQ,CAAC2B,OAAT,CAAiBd,aAAjB,CAA+Bc,OAA/B,GAAyCqE,oBAAoB,CAACK,KAA9D;AACD,GAFD,MAEO;AACLrG,IAAAA,QAAQ,CAAC2B,OAAT,CAAiBd,aAAjB,CAA+Bc,OAA/B,GAAyC,CAAC2E,OAAO,CAC/CL,SAD+C,EAE/CjG,QAAQ,CAAC2B,OAAT,CAAiBe,KAF8B,CAAjD;AAID;;AAED,MAAI3C,KAAK,CAACwG,WAAV,EAAuBC,MAAM,CAACzG,KAAK,CAACwG,WAAP,EAAoBvG,QAAQ,CAAC2B,OAA7B,CAAN;AAEvB,yCACK3B,QAAQ,CAAC2B,OADd;AAEE6C,IAAAA,UAAU,EAAVA;AAFF;AAID;;;;"}
|
|
1
|
+
{"version":3,"file":"useDataGrid.js","sources":["../../../src/useDataGrid/useDataGrid.tsx"],"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 default function 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"],"names":["IS_INTERNET_EXPLORER","isInternetExplorer","useDataGrid","uuidProp","uuid","pluginsFromProps","plugins","rows","columns","renderers","props","instance","useRef","tableRef","headerRef","bodyRef","bodyInnerRef","useState","uuidv4","hasScroll","setHasScroll","isRowDragging","setIsRowDragging","isScrolling","shouldRefocus","VolatileRowsListener","RowsObserver","useDerivedStateFromProps","onUpdate","resolve","method","extra","compose","byFunction","nested","updateOnStateChange","originalRows","updateRows","current","decoratedRenderers","cloneDeep","decoratedColumns","composedRows","getRowProps","getHeaderRowProps","getBodyProps","getTableProps","effects","refs","table","body","header","innerBody","state","actions","enableEvents","document","style","pointerEvents","disableEvents","observeRows","observer","observe","hotKeys","getState","getInstance","defaultDecorators","decorateGrid","registerStateHook","registerHotKeys","decorateColumn","decorateColumns","cols","map","col","initColumnDefinition","useTextTruncation","wrapText","normalize","normalizeDataKeys","decorateRenderers","getHeaderProps","composeRows","decorators","useMemo","nextDecorators","forEach","plugin","reduce","nextInstance","decorator","reduceHotKey","key","handler","options","Array","isArray","applyDecorators","visibleColumns","filter","column","visible","length","reducePropsGetter","nextRows","getter","notify","currentShouldRefocus","prevState","usePrevious","isObject","forced","value","isEqual","instanceRef","setRef"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA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OAAT,CAAiBI,YAAjB,GAAgCyC,UAAU,CAACD,WAAX,CAAuBM,MAAvB,CAC9B,UAACgB,QAAD,EAAWC,MAAX;IAAA,OAAsBA,MAAM,CAACD,QAAD,EAAW7F,QAAQ,CAAC2B,OAApB,CAA5B;GAD8B,EAE9B3B,QAAQ,CAAC2B,OAAT,CAAiBI,YAFa,CAAhC;EAKAhB,YAAY,CAACgF,MAAb,CAAoB/F,QAAQ,CAAC2B,OAAT,CAAiBI,YAArC;EAEA,IAAMiE,oBAAoB,GAAGhG,QAAQ,CAAC2B,OAAT,CAAiBd,aAAjB,CAA+Bc,OAA5D;EACA,IAAMsE,SAAS,GAAGC,WAAW,CAAClG,QAAQ,CAAC2B,OAAT,CAAiBe,KAAlB,CAA7B;;EACA,IAAIyD,QAAQ,CAACH,oBAAD,CAAR,IAAkCA,oBAAoB,CAACI,MAA3D,EAAmE;IACjEpG,QAAQ,CAAC2B,OAAT,CAAiBd,aAAjB,CAA+Bc,OAA/B,GAAyCqE,oBAAoB,CAACK,KAA9D;GADF,MAEO;IACLrG,QAAQ,CAAC2B,OAAT,CAAiBd,aAAjB,CAA+Bc,OAA/B,GAAyC,CAAC2E,OAAO,CAC/CL,SAD+C,EAE/CjG,QAAQ,CAAC2B,OAAT,CAAiBe,KAF8B,CAAjD;;;EAMF,IAAI3C,KAAK,CAACwG,WAAV,EAAuBC,MAAM,CAACzG,KAAK,CAACwG,WAAP,EAAoBvG,QAAQ,CAAC2B,OAA7B,CAAN;EAEvB,uCACK3B,QAAQ,CAAC2B,OADd;IAEE6C,UAAU,EAAVA;;AAEH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordIterator.js","sources":["../../../src/useDataList/recordIterator.tsx"],"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"],"names":["defaultStrategy","Error","recordIterator","records","strategy","decorators","instance","nextRows","data","cb","row","nextRow","i","length","push"],"mappings":"AAAA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,GAAM;
|
|
1
|
+
{"version":3,"file":"recordIterator.js","sources":["../../../src/useDataList/recordIterator.tsx"],"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"],"names":["defaultStrategy","Error","recordIterator","records","strategy","decorators","instance","nextRows","data","cb","row","nextRow","i","length","push"],"mappings":"AAAA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,GAAM;EAC5B,MAAMC,KAAK,CAAC,oDAAD,CAAX;AACD,CAFD;;AAIO,SAASC,cAAT,CACLC,OADK,EAKL;EAAA,IAHAC,QAGA,uEAHWJ,eAGX;EAAA,IAFAK,UAEA,uEAFa,EAEb;EAAA,IADAC,QACA;EACA,IAAMC,QAAQ,GAAG,EAAjB;EAEAH,QAAQ,CAAC;IACPI,IAAI,EAAEL,OADC;IAEPM,EAAE,EAAE,YAAAC,GAAG,EAAI;MACT,IAAIC,OAAO,GAAGD,GAAd,CADS;;MAIT,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGP,UAAU,CAACQ,MAA/B,EAAuCD,CAAC,EAAxC,EAA4C;QAC1CD,OAAO,GAAGN,UAAU,CAACO,CAAD,CAAV,CAAcD,OAAd,EAAuBL,QAAvB,CAAV;QACA,IAAI,CAACK,OAAL,EAAc;;;MAGhB,IAAIA,OAAJ,EAAaJ,QAAQ,CAACO,IAAT,CAAcH,OAAd;KAXR;IAaPL,QAAQ,EAARA;GAbM,CAAR;EAgBA,OAAOC,QAAP;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataList.js","sources":["../../../src/useDataList/useDataList.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport get from 'lodash/get';\nimport {\n composeFormatters,\n reducePropsGetter,\n} from '../createDataInstance/utils';\nimport { recordIterator } from './recordIterator';\nimport createInstanceRef from '../createDataInstance/createInstanceRef';\n\nexport const getItemLabel = (record, nameKey = 'name') =>\n get(record, ['data', nameKey]);\nexport const getItemChildren = (record, childrenKey = 'children') =>\n get(record, ['data', childrenKey]);\n\nconst listRenderers = {\n list: 'ul',\n item: 'li',\n};\n\n// todo: check if a plugin is a LIST plugin rather than GRID\nexport default function useDataList({\n data = [],\n plugins = [],\n renderers = listRenderers,\n itemRenderer = [],\n customDecorators,\n ...props\n}) {\n const listRef = useRef();\n const { instance, decorators } = createInstanceRef({\n data,\n renderers,\n plugins,\n customDecorators: {\n ...customDecorators,\n recordIterator,\n getListProps: [],\n getItemProps: [],\n itemRenderer: [...itemRenderer], // components reduce to compose item content\n record: [],\n records: [],\n },\n ...props,\n });\n instance.current.getListRef = () => listRef;\n instance.current.setListRef = (ref) => {\n listRef.current = ref;\n };\n instance.current.getItemLabel = (record) =>\n getItemLabel(record, props.nameKey);\n instance.current.getItemChildren = (record) =>\n getItemChildren(record, props.childrenKey);\n\n instance.current.decorators = decorators;\n instance.current.getListProps = reducePropsGetter(\n decorators.getListProps,\n instance.current,\n );\n instance.current.getItemProps = reducePropsGetter(\n decorators.getItemProps,\n instance.current,\n );\n instance.current.itemRenderer = composeFormatters(\n instance.current.decorators.itemRenderer,\n instance.current,\n );\n\n instance.current.records = useMemo(() => {\n // record iterator TREE / Simple\n let nextRecords = recordIterator(\n data,\n instance.current.decorators.recordIterator,\n decorators.record,\n instance.current,\n );\n\n // compose all records\n nextRecords = decorators.records.reduce(\n (nextRows, getter) => getter(nextRows, instance.current),\n nextRecords,\n );\n\n return nextRecords;\n });\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return instance.current;\n}\n"],"names":["getItemLabel","record","nameKey","get","getItemChildren","childrenKey","listRenderers","list","item","useDataList","data","plugins","renderers","itemRenderer","customDecorators","props","listRef","useRef","createInstanceRef","recordIterator","getListProps","getItemProps","records","instance","decorators","current","getListRef","setListRef","ref","reducePropsGetter","composeFormatters","useMemo","nextRecords","reduce","nextRows","getter","instanceRef","setRef"],"mappings":";;;;;;;;;;;;;;;;;;IAUaA,YAAY,GAAG,SAAfA,YAAe,CAACC,MAAD;
|
|
1
|
+
{"version":3,"file":"useDataList.js","sources":["../../../src/useDataList/useDataList.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { setRef } from '@elliemae/ds-utilities';\nimport get from 'lodash/get';\nimport {\n composeFormatters,\n reducePropsGetter,\n} from '../createDataInstance/utils';\nimport { recordIterator } from './recordIterator';\nimport createInstanceRef from '../createDataInstance/createInstanceRef';\n\nexport const getItemLabel = (record, nameKey = 'name') =>\n get(record, ['data', nameKey]);\nexport const getItemChildren = (record, childrenKey = 'children') =>\n get(record, ['data', childrenKey]);\n\nconst listRenderers = {\n list: 'ul',\n item: 'li',\n};\n\n// todo: check if a plugin is a LIST plugin rather than GRID\nexport default function useDataList({\n data = [],\n plugins = [],\n renderers = listRenderers,\n itemRenderer = [],\n customDecorators,\n ...props\n}) {\n const listRef = useRef();\n const { instance, decorators } = createInstanceRef({\n data,\n renderers,\n plugins,\n customDecorators: {\n ...customDecorators,\n recordIterator,\n getListProps: [],\n getItemProps: [],\n itemRenderer: [...itemRenderer], // components reduce to compose item content\n record: [],\n records: [],\n },\n ...props,\n });\n instance.current.getListRef = () => listRef;\n instance.current.setListRef = (ref) => {\n listRef.current = ref;\n };\n instance.current.getItemLabel = (record) =>\n getItemLabel(record, props.nameKey);\n instance.current.getItemChildren = (record) =>\n getItemChildren(record, props.childrenKey);\n\n instance.current.decorators = decorators;\n instance.current.getListProps = reducePropsGetter(\n decorators.getListProps,\n instance.current,\n );\n instance.current.getItemProps = reducePropsGetter(\n decorators.getItemProps,\n instance.current,\n );\n instance.current.itemRenderer = composeFormatters(\n instance.current.decorators.itemRenderer,\n instance.current,\n );\n\n instance.current.records = useMemo(() => {\n // record iterator TREE / Simple\n let nextRecords = recordIterator(\n data,\n instance.current.decorators.recordIterator,\n decorators.record,\n instance.current,\n );\n\n // compose all records\n nextRecords = decorators.records.reduce(\n (nextRows, getter) => getter(nextRows, instance.current),\n nextRecords,\n );\n\n return nextRecords;\n });\n\n if (props.instanceRef) setRef(props.instanceRef, instance.current);\n\n return instance.current;\n}\n"],"names":["getItemLabel","record","nameKey","get","getItemChildren","childrenKey","listRenderers","list","item","useDataList","data","plugins","renderers","itemRenderer","customDecorators","props","listRef","useRef","createInstanceRef","recordIterator","getListProps","getItemProps","records","instance","decorators","current","getListRef","setListRef","ref","reducePropsGetter","composeFormatters","useMemo","nextRecords","reduce","nextRows","getter","instanceRef","setRef"],"mappings":";;;;;;;;;;;;;;;;;;IAUaA,YAAY,GAAG,SAAfA,YAAe,CAACC,MAAD;EAAA,IAASC,OAAT,uEAAmB,MAAnB;EAAA,OAC1BC,GAAG,CAACF,MAAD,EAAS,CAAC,MAAD,EAASC,OAAT,CAAT,CADuB;AAAA;IAEfE,eAAe,GAAG,SAAlBA,eAAkB,CAACH,MAAD;EAAA,IAASI,WAAT,uEAAuB,UAAvB;EAAA,OAC7BF,GAAG,CAACF,MAAD,EAAS,CAAC,MAAD,EAASI,WAAT,CAAT,CAD0B;AAAA;AAG/B,IAAMC,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B;EACAD,QAAQ,CAACE,OAAT,CAAiBL,YAAjB,GAAgCS,iBAAiB,CAC/CL,UAAU,CAACJ,YADoC,EAE/CG,QAAQ,CAACE,OAFsC,CAAjD;EAIAF,QAAQ,CAACE,OAAT,CAAiBJ,YAAjB,GAAgCQ,iBAAiB,CAC/CL,UAAU,CAACH,YADoC,EAE/CE,QAAQ,CAACE,OAFsC,CAAjD;EAIAF,QAAQ,CAACE,OAAT,CAAiBZ,YAAjB,GAAgCiB,iBAAiB,CAC/CP,QAAQ,CAACE,OAAT,CAAiBD,UAAjB,CAA4BX,YADmB,EAE/CU,QAAQ,CAACE,OAFsC,CAAjD;EAKAF,QAAQ,CAACE,OAAT,CAAiBH,OAAjB,GAA2BS,OAAO,CAAC,YAAM;;IAEvC,IAAIC,WAAW,GAAGb,cAAc,CAC9BT,IAD8B,EAE9Ba,QAAQ,CAACE,OAAT,CAAiBD,UAAjB,CAA4BL,cAFE,EAG9BK,UAAU,CAACvB,MAHmB,EAI9BsB,QAAQ,CAACE,OAJqB,CAAhC,CAFuC;;IAUvCO,WAAW,GAAGR,UAAU,CAACF,OAAX,CAAmBW,MAAnB,CACZ,UAACC,QAAD,EAAWC,MAAX;MAAA,OAAsBA,MAAM,CAACD,QAAD,EAAWX,QAAQ,CAACE,OAApB,CAA5B;KADY,EAEZO,WAFY,CAAd;IAKA,OAAOA,WAAP;GAfgC,CAAlC;EAkBA,IAAIjB,KAAK,CAACqB,WAAV,EAAuBC,MAAM,CAACtB,KAAK,CAACqB,WAAP,EAAoBb,QAAQ,CAACE,OAA7B,CAAN;EAEvB,OAAOF,QAAQ,CAACE,OAAhB;AACD;;;;"}
|
package/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.tsx"],"sourcesContent":["/* eslint-disable no-cond-assign */\nexport const objectType = (obj) =>\n Object.prototype.toString.call(obj).slice(8, -1);\nexport const isDefined = (param) => typeof param !== 'undefined';\nexport const isUndefined = (param) => typeof param === 'undefined';\nexport const isFunction = (param) => typeof param === 'function';\nexport const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line\nexport const isString = (str) => objectType(str) === 'String';\nexport const isArray = (arr) => objectType(arr) === 'Array';\n\nexport const closest = (target, selector) => {\n // closest(e.target, '.field')\n while (target) {\n // eslint-disable-line\n if (target.matches && target.matches(selector)) return target;\n if (target.msMatchesSelector && target.msMatchesSelector(selector))\n return target;\n // eslint-disable-next-line no-param-reassign\n target = target.parentNode;\n }\n return null;\n};\n\nexport const getOffsetRect = (elem) => {\n // (1)\n const box = elem.getBoundingClientRect();\n\n const { body, documentElement } = document;\n\n // (2)\n const scrollTop =\n window.pageYOffset || documentElement.scrollTop || body.scrollTop;\n const scrollLeft =\n window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;\n\n // (3)\n const clientTop = documentElement.clientTop || body.clientTop || 0;\n const clientLeft = documentElement.clientLeft || body.clientLeft || 0;\n\n // (4)\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return { top: Math.round(top), left: Math.round(left) };\n};\n\nexport const getTotalScroll = (elem) => {\n let top = 0;\n let left = 0;\n\n // eslint-disable-next-line no-param-reassign\n while ((elem = elem.parentNode)) {\n top += elem.scrollTop || 0;\n left += elem.scrollLeft || 0;\n }\n\n return { top, left };\n};\n\nexport const getTransformProps = (x, y) => ({\n transform: `translate(${x}px, ${y}px)`,\n});\n\nexport const listWithChildren = (list, childrenProp) =>\n list.map((item) => ({\n ...item,\n [childrenProp]: item[childrenProp]\n ? listWithChildren(item[childrenProp], childrenProp)\n : [],\n }));\n\nexport const getAllNonEmptyNodesIds = (items, childrenProp) => {\n let childrenIds = [];\n const ids = items\n .filter((item) => item[childrenProp].length)\n .map((item) => {\n childrenIds = childrenIds.concat(\n getAllNonEmptyNodesIds(item[childrenProp], childrenProp),\n );\n return item.id;\n });\n\n return ids.concat(childrenIds);\n};\n\nexport const isInternetExplorer = () => {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf('MSIE ');\n // If Internet Explorer, return version number\n if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\\./)) {\n return true;\n }\n return false;\n};\n"],"names":["objectType","obj","Object","prototype","toString","call","slice","isDefined","param","isUndefined","isFunction","isNumber","isNaN","isString","str","isArray","arr","closest","target","selector","matches","msMatchesSelector","parentNode","getOffsetRect","elem","box","getBoundingClientRect","document","body","documentElement","scrollTop","window","pageYOffset","scrollLeft","pageXOffset","clientTop","clientLeft","top","left","Math","round","getTotalScroll","getTransformProps","x","y","transform","listWithChildren","list","childrenProp","map","item","getAllNonEmptyNodesIds","items","childrenIds","ids","filter","length","concat","id","isInternetExplorer","ua","navigator","userAgent","msie","indexOf","match"],"mappings":";;;;;;AAAA;IACaA,UAAU,GAAG,SAAbA,UAAa,CAACC,GAAD;
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.tsx"],"sourcesContent":["/* eslint-disable no-cond-assign */\nexport const objectType = (obj) =>\n Object.prototype.toString.call(obj).slice(8, -1);\nexport const isDefined = (param) => typeof param !== 'undefined';\nexport const isUndefined = (param) => typeof param === 'undefined';\nexport const isFunction = (param) => typeof param === 'function';\nexport const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line\nexport const isString = (str) => objectType(str) === 'String';\nexport const isArray = (arr) => objectType(arr) === 'Array';\n\nexport const closest = (target, selector) => {\n // closest(e.target, '.field')\n while (target) {\n // eslint-disable-line\n if (target.matches && target.matches(selector)) return target;\n if (target.msMatchesSelector && target.msMatchesSelector(selector))\n return target;\n // eslint-disable-next-line no-param-reassign\n target = target.parentNode;\n }\n return null;\n};\n\nexport const getOffsetRect = (elem) => {\n // (1)\n const box = elem.getBoundingClientRect();\n\n const { body, documentElement } = document;\n\n // (2)\n const scrollTop =\n window.pageYOffset || documentElement.scrollTop || body.scrollTop;\n const scrollLeft =\n window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;\n\n // (3)\n const clientTop = documentElement.clientTop || body.clientTop || 0;\n const clientLeft = documentElement.clientLeft || body.clientLeft || 0;\n\n // (4)\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return { top: Math.round(top), left: Math.round(left) };\n};\n\nexport const getTotalScroll = (elem) => {\n let top = 0;\n let left = 0;\n\n // eslint-disable-next-line no-param-reassign\n while ((elem = elem.parentNode)) {\n top += elem.scrollTop || 0;\n left += elem.scrollLeft || 0;\n }\n\n return { top, left };\n};\n\nexport const getTransformProps = (x, y) => ({\n transform: `translate(${x}px, ${y}px)`,\n});\n\nexport const listWithChildren = (list, childrenProp) =>\n list.map((item) => ({\n ...item,\n [childrenProp]: item[childrenProp]\n ? listWithChildren(item[childrenProp], childrenProp)\n : [],\n }));\n\nexport const getAllNonEmptyNodesIds = (items, childrenProp) => {\n let childrenIds = [];\n const ids = items\n .filter((item) => item[childrenProp].length)\n .map((item) => {\n childrenIds = childrenIds.concat(\n getAllNonEmptyNodesIds(item[childrenProp], childrenProp),\n );\n return item.id;\n });\n\n return ids.concat(childrenIds);\n};\n\nexport const isInternetExplorer = () => {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf('MSIE ');\n // If Internet Explorer, return version number\n if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\\./)) {\n return true;\n }\n return false;\n};\n"],"names":["objectType","obj","Object","prototype","toString","call","slice","isDefined","param","isUndefined","isFunction","isNumber","isNaN","isString","str","isArray","arr","closest","target","selector","matches","msMatchesSelector","parentNode","getOffsetRect","elem","box","getBoundingClientRect","document","body","documentElement","scrollTop","window","pageYOffset","scrollLeft","pageXOffset","clientTop","clientLeft","top","left","Math","round","getTotalScroll","getTransformProps","x","y","transform","listWithChildren","list","childrenProp","map","item","getAllNonEmptyNodesIds","items","childrenIds","ids","filter","length","concat","id","isInternetExplorer","ua","navigator","userAgent","msie","indexOf","match"],"mappings":";;;;;;AAAA;IACaA,UAAU,GAAG,SAAbA,UAAa,CAACC,GAAD;EA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