@elliemae/ds-treeview 1.61.10 → 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.
Files changed (93) hide show
  1. package/cjs/TreeView.js.map +1 -1
  2. package/cjs/TreeViewContext.js.map +1 -1
  3. package/cjs/deprecated/TreeView.js.map +1 -1
  4. package/cjs/deprecated/__testUtils__/utils.js.map +1 -1
  5. package/cjs/deprecated/plugins/dnd/TreeDndPlugin.js.map +1 -1
  6. package/cjs/deprecated/plugins/dnd/renderers/DraggableItem.js.map +1 -1
  7. package/cjs/deprecated/plugins/dnd/renderers/DroppableList.js.map +1 -1
  8. package/cjs/deprecated/plugins/dnd/utils.js.map +1 -1
  9. package/cjs/deprecated/plugins/roving/TreeRovingPlugin.js.map +1 -1
  10. package/cjs/deprecated/plugins/searchable/SearchableTreePlugin.js.map +1 -1
  11. package/cjs/deprecated/plugins/selectable/SelectablePluginTree.js.map +1 -1
  12. package/cjs/deprecated/plugins/selectable/utils.js.map +1 -1
  13. package/cjs/deprecated/plugins/toolbar/TreeToolbarPlugin.js.map +1 -1
  14. package/cjs/deprecated/plugins/tree/TreeDataPlugin.js.map +1 -1
  15. package/cjs/deprecated/plugins/tree/useExpandTreeState.js.map +1 -1
  16. package/cjs/deprecated/plugins/tree/utils.js.map +1 -1
  17. package/cjs/deprecated/plugins/tree/walkTreeStrategy.js.map +1 -1
  18. package/cjs/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js.map +1 -1
  19. package/cjs/deprecated/renderers.js.map +1 -1
  20. package/cjs/index-69815fd3.js.map +1 -1
  21. package/cjs/index.js.map +1 -1
  22. package/cjs/parts/CheckboxSelectable.js.map +1 -1
  23. package/cjs/parts/ChildrenCountDisplayer.js.map +1 -1
  24. package/cjs/parts/ExpandCaret.js.map +1 -1
  25. package/cjs/parts/Icon.js.map +1 -1
  26. package/cjs/parts/NestingSpace.js.map +1 -1
  27. package/cjs/parts/RadioSelectable.js.map +1 -1
  28. package/cjs/parts/TreeItem.js.map +1 -1
  29. package/cjs/parts/TreeItemText.js.map +1 -1
  30. package/cjs/parts/TreeList.js.map +1 -1
  31. package/cjs/plugins/dnd/TreeDndPlugin.js.map +1 -1
  32. package/cjs/prop-types.js.map +1 -1
  33. package/cjs/react-desc-prop-types.js.map +1 -1
  34. package/cjs/related-components/TreeViewSearchBar.js.map +1 -1
  35. package/cjs/utils/array-helpers.js.map +1 -1
  36. package/cjs/utils/dnd-helpers.js.map +1 -1
  37. package/cjs/utils/group-expands-helpers.js.map +1 -1
  38. package/cjs/utils/keyboard-helpers.js.map +1 -1
  39. package/cjs/utils/object-helpers.js.map +1 -1
  40. package/cjs/utils/refs-helpers.js.map +1 -1
  41. package/cjs/utils/selectable-helper.js.map +1 -1
  42. package/cjs/utils/string-helpers.js.map +1 -1
  43. package/cjs/utils/tree-helpers.js.map +1 -1
  44. package/cjs/utils/useDnDHelpers.js.map +1 -1
  45. package/cjs/utils/useInstanceRefActions.js.map +1 -1
  46. package/cjs/utils/useTree.js.map +1 -1
  47. package/esm/TreeView.js.map +1 -1
  48. package/esm/TreeViewContext.js.map +1 -1
  49. package/esm/deprecated/TreeView.js.map +1 -1
  50. package/esm/deprecated/__testUtils__/utils.js.map +1 -1
  51. package/esm/deprecated/plugins/dnd/TreeDndPlugin.js.map +1 -1
  52. package/esm/deprecated/plugins/dnd/renderers/DraggableItem.js.map +1 -1
  53. package/esm/deprecated/plugins/dnd/renderers/DroppableList.js.map +1 -1
  54. package/esm/deprecated/plugins/dnd/utils.js.map +1 -1
  55. package/esm/deprecated/plugins/roving/TreeRovingPlugin.js.map +1 -1
  56. package/esm/deprecated/plugins/searchable/SearchableTreePlugin.js.map +1 -1
  57. package/esm/deprecated/plugins/selectable/SelectablePluginTree.js.map +1 -1
  58. package/esm/deprecated/plugins/selectable/utils.js.map +1 -1
  59. package/esm/deprecated/plugins/toolbar/TreeToolbarPlugin.js.map +1 -1
  60. package/esm/deprecated/plugins/tree/TreeDataPlugin.js.map +1 -1
  61. package/esm/deprecated/plugins/tree/useExpandTreeState.js.map +1 -1
  62. package/esm/deprecated/plugins/tree/utils.js.map +1 -1
  63. package/esm/deprecated/plugins/tree/walkTreeStrategy.js.map +1 -1
  64. package/esm/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js.map +1 -1
  65. package/esm/deprecated/renderers.js.map +1 -1
  66. package/esm/index-f9def0ea.js.map +1 -1
  67. package/esm/index.js.map +1 -1
  68. package/esm/parts/CheckboxSelectable.js.map +1 -1
  69. package/esm/parts/ChildrenCountDisplayer.js.map +1 -1
  70. package/esm/parts/ExpandCaret.js.map +1 -1
  71. package/esm/parts/Icon.js.map +1 -1
  72. package/esm/parts/NestingSpace.js.map +1 -1
  73. package/esm/parts/RadioSelectable.js.map +1 -1
  74. package/esm/parts/TreeItem.js.map +1 -1
  75. package/esm/parts/TreeItemText.js.map +1 -1
  76. package/esm/parts/TreeList.js.map +1 -1
  77. package/esm/plugins/dnd/TreeDndPlugin.js.map +1 -1
  78. package/esm/prop-types.js.map +1 -1
  79. package/esm/react-desc-prop-types.js.map +1 -1
  80. package/esm/related-components/TreeViewSearchBar.js.map +1 -1
  81. package/esm/utils/array-helpers.js.map +1 -1
  82. package/esm/utils/dnd-helpers.js.map +1 -1
  83. package/esm/utils/group-expands-helpers.js.map +1 -1
  84. package/esm/utils/keyboard-helpers.js.map +1 -1
  85. package/esm/utils/object-helpers.js.map +1 -1
  86. package/esm/utils/refs-helpers.js.map +1 -1
  87. package/esm/utils/selectable-helper.js.map +1 -1
  88. package/esm/utils/string-helpers.js.map +1 -1
  89. package/esm/utils/tree-helpers.js.map +1 -1
  90. package/esm/utils/useDnDHelpers.js.map +1 -1
  91. package/esm/utils/useInstanceRefActions.js.map +1 -1
  92. package/esm/utils/useTree.js.map +1 -1
  93. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"TreeViewContext.js","sources":["../../src/TreeViewContext.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport { createContext, createRef } from 'react';\n// import Folder from '@elliemae/ds-icons/Folder';\n// import FilePdf from '@elliemae/ds-icons/FilePdf';\n\nexport const defaultProps = {\n plugins: [],\n selection: {}, // { [id]:[state] } -> e.g. {1:true, 2:'mixed'}\n instanceRef: createRef(),\n disableGroups: false,\n disableLeafs: false,\n disableIcons: false,\n fluid: false,\n isMultiSelect: false,\n isSingleSelect: false,\n restrictDragAndDrop: false,\n showChildrenAmount: false,\n sortable: false,\n isLoading: false,\n highlightOnlyQuery: false,\n onInstanceRefInitialized: (istanceRef) => {},\n onItemClick: (item, e) => {},\n onItemFocus: (params) => {}, // { itemIndex: number, scrollToItem: func }\n onVisibleItemsChange: (newVisibleItems) => {},\n onOrderChange: (newData, oldData, draggedItem) => {},\n onSelectionChange: (selectionHasmap, item, indexAndScrollTo) => {}, // indexAndScrollTo = { scrollToItem: ()=>{}, itemIndex :number }\n onExpandChange: (expandedHashmap, itemToggled) => {}, // expandedHashmap -> {[id]:true, ...[id]:true} itemToggled -> item that caused the change for being toggled\n rowSize: 'normal', // ['normal', 'compact']\n labelOverflow: 'wrap', // ['wrap', 'wrap-all', 'truncate']\n noItemsPlaceholder: 'No items found',\n nameKey: 'name', // use to retrieve the label text inside ever data item\n width: '100%',\n height: '100%',\n groupIcon: null, // <Folder />,\n itemIcon: null, // <FilePdf />,\n searchQuery: '',\n};\n\nexport const defaultRelativeMouseCoord = {\n isBefore: false,\n isAfter: false,\n isValid: true,\n item: null,\n x: null,\n y: null,\n relativeElementDOMRect: null,\n relativeElementIndex: null,\n};\n\n/** Context for cross component communication */\nconst TreeViewContext = createContext({\n props: defaultProps,\n visibleItems: [],\n withRadioChecks: false,\n withCheckboxChecks: false,\n withDragAndDrop: false,\n relativeMouseCord: defaultRelativeMouseCoord,\n setRelativeMouseCord: () => {},\n labelRenderer: (value) => value,\n triggerTreeRerender: () => {},\n tree: {},\n virtualListHelpers: {},\n virtualListRef: {},\n treeRoot: {},\n isDragging: false,\n setIsDragging: () => {},\n isKeyboardDragging: false,\n setIsKeyboardDragging: () => {},\n draggedItem: null, // item\n setDraggedItem: () => {},\n uniqueTreeViewUUID: '',\n selectedItem: null, // item\n setSelectedItem: () => {},\n focusedItem: null, // item\n setFocusedItem: () => {},\n selectedCheckboxes: {}, // { [id]:[state] } -> e.g. {1:true, 2:'mixed'}\n setSelectedCheckboxes: () => {},\n expandedGroups: {}, // { [id]:true } -> e.g. {1:true, 2:true} // false are not listed\n setExpandedGroups: () => {},\n latestToggledItem: null, // item -> if toggle all -> should be undefined\n setLatestToggledItem: () => {},\n hoverItem: null, // item\n setHoverItem: () => {},\n});\n\nexport default TreeViewContext;\n"],"names":["defaultProps","plugins","selection","instanceRef","createRef","disableGroups","disableLeafs","disableIcons","fluid","isMultiSelect","isSingleSelect","restrictDragAndDrop","showChildrenAmount","sortable","isLoading","highlightOnlyQuery","onInstanceRefInitialized","istanceRef","onItemClick","item","e","onItemFocus","params","onVisibleItemsChange","newVisibleItems","onOrderChange","newData","oldData","draggedItem","onSelectionChange","selectionHasmap","indexAndScrollTo","onExpandChange","expandedHashmap","itemToggled","rowSize","labelOverflow","noItemsPlaceholder","nameKey","width","height","groupIcon","itemIcon","searchQuery","defaultRelativeMouseCoord","isBefore","isAfter","isValid","x","y","relativeElementDOMRect","relativeElementIndex","TreeViewContext","createContext","props","visibleItems","withRadioChecks","withCheckboxChecks","withDragAndDrop","relativeMouseCord","setRelativeMouseCord","labelRenderer","value","triggerTreeRerender","tree","virtualListHelpers","virtualListRef","treeRoot","isDragging","setIsDragging","isKeyboardDragging","setIsKeyboardDragging","setDraggedItem","uniqueTreeViewUUID","selectedItem","setSelectedItem","focusedItem","setFocusedItem","selectedCheckboxes","setSelectedCheckboxes","expandedGroups","setExpandedGroups","latestToggledItem","setLatestToggledItem","hoverItem","setHoverItem"],"mappings":";;AAAA;AAGA;;IAEaA,YAAY,GAAG;AAC1BC,EAAAA,OAAO,EAAE,EADiB;AAE1BC,EAAAA,SAAS,EAAE,EA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YAAY,EAAE,IArBsB;AAqBhB;AACpBC,EAAAA,eAAe,EAAE,2BAAM,EAtBa;AAuBpCC,EAAAA,WAAW,EAAE,IAvBuB;AAuBjB;AACnBC,EAAAA,cAAc,EAAE,0BAAM,EAxBc;AAyBpCC,EAAAA,kBAAkB,EAAE,EAzBgB;AAyBZ;AACxBC,EAAAA,qBAAqB,EAAE,iCAAM,EA1BO;AA2BpCC,EAAAA,cAAc,EAAE,EA3BoB;AA2BhB;AACpBC,EAAAA,iBAAiB,EAAE,6BAAM,EA5BW;AA6BpCC,EAAAA,iBAAiB,EAAE,IA7BiB;AA6BX;AACzBC,EAAAA,oBAAoB,EAAE,gCAAM,EA9BQ;AA+BpCC,EAAAA,SAAS,EAAE,IA/ByB;AA+BnB;AACjBC,EAAAA,YAAY,EAAE,wBAAM;AAhCgB,CAAD;;;;"}
1
+ {"version":3,"file":"TreeViewContext.js","sources":["../../src/TreeViewContext.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport { createContext, createRef } from 'react';\n// import Folder from '@elliemae/ds-icons/Folder';\n// import FilePdf from '@elliemae/ds-icons/FilePdf';\n\nexport const defaultProps = {\n plugins: [],\n selection: {}, // { [id]:[state] } -> e.g. {1:true, 2:'mixed'}\n instanceRef: createRef(),\n disableGroups: false,\n disableLeafs: false,\n disableIcons: false,\n fluid: false,\n isMultiSelect: false,\n isSingleSelect: false,\n restrictDragAndDrop: false,\n showChildrenAmount: false,\n sortable: false,\n isLoading: false,\n highlightOnlyQuery: false,\n onInstanceRefInitialized: (istanceRef) => {},\n onItemClick: (item, e) => {},\n onItemFocus: (params) => {}, // { itemIndex: number, scrollToItem: func }\n onVisibleItemsChange: (newVisibleItems) => {},\n onOrderChange: (newData, oldData, draggedItem) => {},\n onSelectionChange: (selectionHasmap, item, indexAndScrollTo) => {}, // indexAndScrollTo = { scrollToItem: ()=>{}, itemIndex :number }\n onExpandChange: (expandedHashmap, itemToggled) => {}, // expandedHashmap -> {[id]:true, ...[id]:true} itemToggled -> item that caused the change for being toggled\n rowSize: 'normal', // ['normal', 'compact']\n labelOverflow: 'wrap', // ['wrap', 'wrap-all', 'truncate']\n noItemsPlaceholder: 'No items found',\n nameKey: 'name', // use to retrieve the label text inside ever data item\n width: '100%',\n height: '100%',\n groupIcon: null, // <Folder />,\n itemIcon: null, // <FilePdf />,\n searchQuery: '',\n};\n\nexport const defaultRelativeMouseCoord = {\n isBefore: false,\n isAfter: false,\n isValid: true,\n item: null,\n x: null,\n y: null,\n relativeElementDOMRect: null,\n relativeElementIndex: null,\n};\n\n/** Context for cross component communication */\nconst TreeViewContext = createContext({\n props: defaultProps,\n visibleItems: [],\n withRadioChecks: false,\n withCheckboxChecks: false,\n withDragAndDrop: false,\n relativeMouseCord: defaultRelativeMouseCoord,\n setRelativeMouseCord: () => {},\n labelRenderer: (value) => value,\n triggerTreeRerender: () => {},\n tree: {},\n virtualListHelpers: {},\n virtualListRef: {},\n treeRoot: {},\n isDragging: false,\n setIsDragging: () => {},\n isKeyboardDragging: false,\n setIsKeyboardDragging: () => {},\n draggedItem: null, // item\n setDraggedItem: () => {},\n uniqueTreeViewUUID: '',\n selectedItem: null, // item\n setSelectedItem: () => {},\n focusedItem: null, // item\n setFocusedItem: () => {},\n selectedCheckboxes: {}, // { [id]:[state] } -> e.g. {1:true, 2:'mixed'}\n setSelectedCheckboxes: () => {},\n expandedGroups: {}, // { [id]:true } -> e.g. {1:true, 2:true} // false are not listed\n setExpandedGroups: () => {},\n latestToggledItem: null, // item -> if toggle all -> should be undefined\n setLatestToggledItem: () => {},\n hoverItem: null, // item\n setHoverItem: () => {},\n});\n\nexport default TreeViewContext;\n"],"names":["defaultProps","plugins","selection","instanceRef","createRef","disableGroups","disableLeafs","disableIcons","fluid","isMultiSelect","isSingleSelect","restrictDragAndDrop","showChildrenAmount","sortable","isLoading","highlightOnlyQuery","onInstanceRefInitialized","istanceRef","onItemClick","item","e","onItemFocus","params","onVisibleItemsChange","newVisibleItems","onOrderChange","newData","oldData","draggedItem","onSelectionChange","selectionHasmap","indexAndScrollTo","onExpandChange","expandedHashmap","itemToggled","rowSize","labelOverflow","noItemsPlaceholder","nameKey","width","height","groupIcon","itemIcon","searchQuery","defaultRelativeMouseCoord","isBefore","isAfter","isValid","x","y","relativeElementDOMRect","relativeElementIndex","TreeViewContext","createContext","props","visibleItems","withRadioChecks","withCheckboxChecks","withDragAndDrop","relativeMouseCord","setRelativeMouseCord","labelRenderer","value","triggerTreeRerender","tree","virtualListHelpers","virtualListRef","treeRoot","isDragging","setIsDragging","isKeyboardDragging","setIsKeyboardDragging","setDraggedItem","uniqueTreeViewUUID","selectedItem","setSelectedItem","focusedItem","setFocusedItem","selectedCheckboxes","setSelectedCheckboxes","expandedGroups","setExpandedGroups","latestToggledItem","setLatestToggledItem","hoverItem","setHoverItem"],"mappings":";;AAAA;AAGA;;IAEaA,YAAY,GAAG;EAC1BC,OAAO,EAAE,EADiB;EAE1BC,SAAS,EAAE,EAFe;;EAG1BC,WAAW,eAAEC,SAAS,EAHI;EAI1BC,aAAa,EAAE,KAJW;EAK1BC,YAAY,EAAE,KALY;EAM1BC,YAAY,EAAE,KANY;EAO1BC,KAAK,EAAE,KAPmB;EAQ1BC,aAAa,EAAE,KARW;EAS1BC,cAAc,EAAE,KATU;EAU1BC,mBAAmB,EAAE,KAVK;EAW1BC,kBAAkB,EAAE,KAXM;EAY1BC,QAAQ,EAAE,KAZgB;EAa1BC,SAAS,EAAE,KAbe;EAc1BC,kBAAkB,EAAE,KAdM;EAe1BC,wBAAwB,EAAE,kCAACC,UAAD,EAAgB,EAfhB;EAgB1BC,WAAW,EAAE,qBAACC,IAAD,EAAOC,CAAP,EAAa,EAhBA;EAiB1BC,WAAW,EAAE,qBAACC,MAAD,EAAY,EAjBC;;EAkB1BC,oBAAoB,EAAE,8BAACC,eAAD,EAAqB,EAlBjB;EAmB1BC,aAAa,EAAE,uBAACC,OAAD,EAAUC,OAAV,EAAmBC,WAAnB,EAAmC,EAnBxB;EAoB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qBAAqB,EAAE,iCAAM,EAjBO;EAkBpC3C,WAAW,EAAE,IAlBuB;;EAmBpC4C,cAAc,EAAE,0BAAM,EAnBc;EAoBpCC,kBAAkB,EAAE,EApBgB;EAqBpCC,YAAY,EAAE,IArBsB;;EAsBpCC,eAAe,EAAE,2BAAM,EAtBa;EAuBpCC,WAAW,EAAE,IAvBuB;;EAwBpCC,cAAc,EAAE,0BAAM,EAxBc;EAyBpCC,kBAAkB,EAAE,EAzBgB;;EA0BpCC,qBAAqB,EAAE,iCAAM,EA1BO;EA2BpCC,cAAc,EAAE,EA3BoB;;EA4BpCC,iBAAiB,EAAE,6BAAM,EA5BW;EA6BpCC,iBAAiB,EAAE,IA7BiB;;EA8BpCC,oBAAoB,EAAE,gCAAM,EA9BQ;EA+BpCC,SAAS,EAAE,IA/ByB;;EAgCpCC,YAAY,EAAE,wBAAM;AAhCgB,CAAD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.js","sources":["../../../src/deprecated/TreeView.tsx"],"sourcesContent":["import React from 'react';\nimport useDataList from '@elliemae/ds-shared/useDataList';\nimport { TreeRenderers } from './renderers';\nimport { TreePluginList } from './plugins/tree';\nimport { TreeVirtualizationPlugin } from './plugins/virtualization/TreeVirtualizationPlugin';\nimport { TreeRovingPlugin } from './plugins/roving';\n\nconst wrapComponentIfExists = (Wrapper, children) =>\n Wrapper ? <Wrapper>{children}</Wrapper> : children;\n\nexport function TreeView({\n data,\n plugins = [],\n children,\n roving = true,\n rowSize = 'normal',\n ...props\n}) {\n const instance = useDataList({\n data,\n plugins: [\n TreePluginList,\n TreeVirtualizationPlugin,\n roving && TreeRovingPlugin,\n ...plugins,\n ],\n customDecorators: { shouldWalkChildren: [] }, // adds a new decorator to the useDataList specific for trees\n renderers: TreeRenderers,\n ...props,\n rowSize,\n });\n\n const { list: ListComponent, listWrapper: Wrapper } = instance.renderers;\n const { getListProps } = instance;\n\n return wrapComponentIfExists(\n Wrapper,\n <ListComponent\n records={instance.records}\n {...getListProps()}\n className={`em-ds-tv-row-size-${rowSize}`}\n />,\n );\n}\n"],"names":["wrapComponentIfExists","Wrapper","children","TreeView","data","plugins","roving","rowSize","props","instance","useDataList","TreePluginList","TreeVirtualizationPlugin","TreeRovingPlugin","customDecorators","shouldWalkChildren","renderers","TreeRenderers","ListComponent","list","listWrapper","getListProps","records"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,OAAD,EAAUC,QAAV;AAAA,SAC5BD,OAAO,gBAAG,oBAAC,OAAD,QAAUC,QAAV,CAAH,GAAmCA,QADd;AAAA,CAA9B;;AAGO,SAASC,QAAT,OAOJ;AAAA,MANDC,IAMC,QANDA,IAMC;AAAA,0BALDC,OAKC;AAAA,MALDA,OAKC,6BALS,EAKT;AAAA,WAJDH,QAIC;AAAA,6BAHDI,MAGC;AAAA,MAHDA,MAGC,4BAHQ,IAGR;AAAA,0BAFDC,OAEC;AAAA,MAFDA,OAEC,6BAFS,QAET;AAAA,MADEC,KACF;;AACD,MAAMC,QAAQ,GAAGC,WAAW;AAC1BN,IAAAA,IAAI,EAAJA,IAD0B;AAE1BC,IAAAA,OAAO,GACLM,cADK,EAELC,wBAFK,EAGLN,MAAM,IAAIO,gBAHL,4BAIFR,OAJE,EAFmB;AAQ1BS,IAAAA,gBAAgB,EAAE;AAAEC,MAAAA,kBAAkB,EAAE;AAAtB,KARQ;AAQoB;AAC9CC,IAAAA,SAAS,EAAEC;AATe,KAUvBT,KAVuB;AAW1BD,IAAAA,OAAO,EAAPA;AAX0B,KAA5B;AAcA,4BAAsDE,QAAQ,CAACO,SAA/D;AAAA,MAAcE,aAAd,uBAAQC,IAAR;AAAA,MAA0ClB,OAA1C,uBAA6BmB,WAA7B;AACA,MAAQC,YAAR,GAAyBZ,QAAzB,CAAQY,YAAR;AAEA,SAAOrB,qBAAqB,CAC1BC,OAD0B,eAE1B,oBAAC,aAAD;AACE,IAAA,OAAO,EAAEQ,QAAQ,CAACa;AADpB,KAEMD,YAAY,EAFlB;AAGE,IAAA,SAAS,8BAAuBd,OAAvB;AAHX,KAF0B,CAA5B;AAQD;;;;"}
1
+ {"version":3,"file":"TreeView.js","sources":["../../../src/deprecated/TreeView.tsx"],"sourcesContent":["import React from 'react';\nimport useDataList from '@elliemae/ds-shared/useDataList';\nimport { TreeRenderers } from './renderers';\nimport { TreePluginList } from './plugins/tree';\nimport { TreeVirtualizationPlugin } from './plugins/virtualization/TreeVirtualizationPlugin';\nimport { TreeRovingPlugin } from './plugins/roving';\n\nconst wrapComponentIfExists = (Wrapper, children) =>\n Wrapper ? <Wrapper>{children}</Wrapper> : children;\n\nexport function TreeView({\n data,\n plugins = [],\n children,\n roving = true,\n rowSize = 'normal',\n ...props\n}) {\n const instance = useDataList({\n data,\n plugins: [\n TreePluginList,\n TreeVirtualizationPlugin,\n roving && TreeRovingPlugin,\n ...plugins,\n ],\n customDecorators: { shouldWalkChildren: [] }, // adds a new decorator to the useDataList specific for trees\n renderers: TreeRenderers,\n ...props,\n rowSize,\n });\n\n const { list: ListComponent, listWrapper: Wrapper } = instance.renderers;\n const { getListProps } = instance;\n\n return wrapComponentIfExists(\n Wrapper,\n <ListComponent\n records={instance.records}\n {...getListProps()}\n className={`em-ds-tv-row-size-${rowSize}`}\n />,\n );\n}\n"],"names":["wrapComponentIfExists","Wrapper","children","TreeView","data","plugins","roving","rowSize","props","instance","useDataList","TreePluginList","TreeVirtualizationPlugin","TreeRovingPlugin","customDecorators","shouldWalkChildren","renderers","TreeRenderers","ListComponent","list","listWrapper","getListProps","records"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,OAAD,EAAUC,QAAV;EAAA,OAC5BD,OAAO,gBAAG,oBAAC,OAAD,QAAUC,QAAV,CAAH,GAAmCA,QADd;AAAA,CAA9B;;AAGO,SAASC,QAAT,OAOJ;MANDC,IAMC,QANDA,IAMC;0BALDC,OAKC;MALDA,OAKC,6BALS,EAKT;WAJDH,QAIC;6BAHDI,MAGC;MAHDA,MAGC,4BAHQ,IAGR;0BAFDC,OAEC;MAFDA,OAEC,6BAFS,QAET;MADEC,KACF;;EACD,IAAMC,QAAQ,GAAGC,WAAW;IAC1BN,IAAI,EAAJA,IAD0B;IAE1BC,OAAO,GACLM,cADK,EAELC,wBAFK,EAGLN,MAAM,IAAIO,gBAHL,4BAIFR,OAJE,EAFmB;IAQ1BS,gBAAgB,EAAE;MAAEC,kBAAkB,EAAE;KARd;;IAS1BC,SAAS,EAAEC;KACRT,KAVuB;IAW1BD,OAAO,EAAPA;KAXF;EAcA,0BAAsDE,QAAQ,CAACO,SAA/D;MAAcE,aAAd,uBAAQC,IAAR;MAA0ClB,OAA1C,uBAA6BmB,WAA7B;EACA,IAAQC,YAAR,GAAyBZ,QAAzB,CAAQY,YAAR;EAEA,OAAOrB,qBAAqB,CAC1BC,OAD0B,eAE1B,oBAAC,aAAD;IACE,OAAO,EAAEQ,QAAQ,CAACa;KACdD,YAAY,EAFlB;IAGE,SAAS,8BAAuBd,OAAvB;KALe,CAA5B;AAQD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/deprecated/__testUtils__/utils.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from '@testing-library/react';\nimport { treeItemBlockName } from '../renderers';\nimport { TreeView } from '../TreeView';\n\nexport const treeItemsToMap = (items) => {\n const itemsMap = new Map();\n items.forEach((item) =>\n itemsMap.set(\n item.textContent.replace(/\\(.*?\\)/, '').replace(' ', ''),\n item,\n ),\n );\n return itemsMap;\n};\n\n/**\n * Returns items and itemMap with itemText as keys\n *\n * @param root0\n * @param root0.data\n * @param root0.plugins\n * @param key\n */\nexport function getTreeItemsFromRender(\n { data, plugins, ...props },\n key = treeItemBlockName,\n) {\n const { getAllByTestId, ...testingLibraryApi } = render(\n <TreeView\n {...props}\n data={data}\n height={1000}\n plugins={plugins}\n width={300}\n />,\n );\n\n const items = getAllByTestId(key);\n const itemsMap = treeItemsToMap(items);\n\n return {\n items,\n itemsMap,\n getAllByTestId,\n ...testingLibraryApi,\n };\n}\n"],"names":["treeItemsToMap","items","itemsMap","Map","forEach","item","set","textContent","replace","getTreeItemsFromRender","key","treeItemBlockName","data","plugins","props","render","getAllByTestId","testingLibraryApi"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKaA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD,EAAW;AACvC,MAAMC,QAAQ,GAAG,IAAIC,GAAJ,EAAjB;AACAF,EAAAA,KAAK,CAACG,OAAN,CAAc,UAACC,IAAD;AAAA,WACZH,QAAQ,CAACI,GAAT,CACED,IAAI,CAACE,WAAL,CAAiBC,OAAjB,CAAyB,SAAzB,EAAoC,EAApC,EAAwCA,OAAxC,CAAgD,GAAhD,EAAqD,EAArD,CADF,EAEEH,IAFF,CADY;AAAA,GAAd;AAMA,SAAOH,QAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASO,sBAAT,OAGL;AAAA,MADAC,GACA,uEADMC,iBACN;;AAAA,MAFEC,IAEF,QAFEA,IAEF;AAAA,MAFQC,OAER,QAFQA,OAER;AAAA,MAFoBC,KAEpB;;AACA,gBAAiDC,MAAM,eACrD,oBAAC,QAAD,eACMD,KADN;AAEE,IAAA,IAAI,EAAEF,IAFR;AAGE,IAAA,MAAM,EAAE,IAHV;AAIE,IAAA,OAAO,EAAEC,OAJX;AAKE,IAAA,KAAK,EAAE;AALT,KADqD,CAAvD;AAAA,MAAQG,cAAR,WAAQA,cAAR;AAAA,MAA2BC,iBAA3B;;AAUA,MAAMhB,KAAK,GAAGe,cAAc,CAACN,GAAD,CAA5B;AACA,MAAMR,QAAQ,GAAGF,cAAc,CAACC,KAAD,CAA/B;AAEA;AACEA,IAAAA,KAAK,EAALA,KADF;AAEEC,IAAAA,QAAQ,EAARA,QAFF;AAGEc,IAAAA,cAAc,EAAdA;AAHF,KAIKC,iBAJL;AAMD;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/deprecated/__testUtils__/utils.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from '@testing-library/react';\nimport { treeItemBlockName } from '../renderers';\nimport { TreeView } from '../TreeView';\n\nexport const treeItemsToMap = (items) => {\n const itemsMap = new Map();\n items.forEach((item) =>\n itemsMap.set(\n item.textContent.replace(/\\(.*?\\)/, '').replace(' ', ''),\n item,\n ),\n );\n return itemsMap;\n};\n\n/**\n * Returns items and itemMap with itemText as keys\n *\n * @param root0\n * @param root0.data\n * @param root0.plugins\n * @param key\n */\nexport function getTreeItemsFromRender(\n { data, plugins, ...props },\n key = treeItemBlockName,\n) {\n const { getAllByTestId, ...testingLibraryApi } = render(\n <TreeView\n {...props}\n data={data}\n height={1000}\n plugins={plugins}\n width={300}\n />,\n );\n\n const items = getAllByTestId(key);\n const itemsMap = treeItemsToMap(items);\n\n return {\n items,\n itemsMap,\n getAllByTestId,\n ...testingLibraryApi,\n };\n}\n"],"names":["treeItemsToMap","items","itemsMap","Map","forEach","item","set","textContent","replace","getTreeItemsFromRender","key","treeItemBlockName","data","plugins","props","render","getAllByTestId","testingLibraryApi"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKaA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD,EAAW;EACvC,IAAMC,QAAQ,GAAG,IAAIC,GAAJ,EAAjB;EACAF,KAAK,CAACG,OAAN,CAAc,UAACC,IAAD;IAAA,OACZH,QAAQ,CAACI,GAAT,CACED,IAAI,CAACE,WAAL,CAAiBC,OAAjB,CAAyB,SAAzB,EAAoC,EAApC,EAAwCA,OAAxC,CAAgD,GAAhD,EAAqD,EAArD,CADF,EAEEH,IAFF,CADY;GAAd;EAMA,OAAOH,QAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASO,sBAAT,OAGL;EAAA,IADAC,GACA,uEADMC,iBACN;;EAAA,IAFEC,IAEF,QAFEA,IAEF;MAFQC,OAER,QAFQA,OAER;MAFoBC,KAEpB;;EACA,cAAiDC,MAAM,eACrD,oBAAC,QAAD,eACMD,KADN;IAEE,IAAI,EAAEF,IAFR;IAGE,MAAM,EAAE,IAHV;IAIE,OAAO,EAAEC,OAJX;IAKE,KAAK,EAAE;KAN4C,CAAvD;MAAQG,cAAR,WAAQA,cAAR;MAA2BC,iBAA3B;;EAUA,IAAMhB,KAAK,GAAGe,cAAc,CAACN,GAAD,CAA5B;EACA,IAAMR,QAAQ,GAAGF,cAAc,CAACC,KAAD,CAA/B;EAEA;IACEA,KAAK,EAALA,KADF;IAEEC,QAAQ,EAARA,QAFF;IAGEc,cAAc,EAAdA;KACGC,iBAJL;AAMD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeDndPlugin.js","sources":["../../../../../src/deprecated/plugins/dnd/TreeDndPlugin.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport { isEqual } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport DraggableItem from './renderers/DraggableItem';\nimport DroppableList from './renderers/DroppableList';\nimport {\n changePositionBetweenDifferentArrays,\n changePositionSameArray,\n getTreePosition,\n} from './utils';\n\nexport const TreeDndPlugin = createInstancePlugin('tree-dnd', {\n state(instance) {\n const {\n originalData,\n props: { childrenKey = 'children', onOrderChange = () => null },\n } = instance;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [draggedRecord, setDraggedRecord] = useState(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const changeRecordsPosition = useCallback(\n ({ sourceRecord, targetRecord, combineWith, down }) => {\n let nextTreeData;\n\n const sourceTreePosition = getTreePosition(sourceRecord.path);\n let targetTreePosition = {};\n\n if (combineWith) {\n targetTreePosition = { parentPath: combineWith.path };\n } else if (targetRecord) {\n targetTreePosition = getTreePosition(targetRecord.path);\n } else {\n // there is no reordering\n // Reason: outside tree / outside drop target\n return originalData;\n }\n // if we are not combining elements we change the same array\n // if we combine elements, we change a different array (the children of the target)\n const changingSameArray =\n !combineWith &&\n isEqual(sourceTreePosition.parentPath, targetTreePosition.parentPath);\n\n if (changingSameArray) {\n nextTreeData = changePositionSameArray({\n sourceRecord,\n targetRecord,\n sourceTreePosition,\n targetTreePosition,\n data: originalData,\n });\n } else {\n nextTreeData = changePositionBetweenDifferentArrays({\n sourceRecord,\n targetRecord: combineWith || targetRecord,\n combineWith,\n sourceTreePosition,\n targetTreePosition,\n data: originalData,\n down,\n });\n }\n\n onOrderChange(nextTreeData, sourceRecord);\n // console.log('nextTreeData :>> ', nextTreeData);\n // console.log(\n // `${sourceRecord?.data?.name} --> ${\n // combineWith?.data?.name || targetRecord?.data?.name\n // }`,\n // );\n return nextTreeData;\n },\n [originalData, childrenKey],\n );\n\n return {\n state: { draggedRecord },\n actions: { setDraggedRecord, changeRecordsPosition },\n };\n },\n renderers(renderers, instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const item = useMemo(() => DraggableItem(renderers, instance), []);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const list = useMemo(() => DroppableList(renderers, instance), []);\n return { ...renderers, item, list };\n },\n});\n"],"names":["TreeDndPlugin","createInstancePlugin","state","instance","originalData","props","childrenKey","onOrderChange","useState","draggedRecord","setDraggedRecord","changeRecordsPosition","useCallback","sourceRecord","targetRecord","combineWith","down","nextTreeData","sourceTreePosition","getTreePosition","path","targetTreePosition","parentPath","changingSameArray","isEqual","changePositionSameArray","data","changePositionBetweenDifferentArrays","actions","renderers","item","useMemo","DraggableItem","list","DroppableList"],"mappings":";;;;;;;;;;;;;;;;;;;;IAWaA,aAAa,GAAGC,oBAAoB,CAAC,UAAD,EAAa;AAC5DC,EAAAA,KAD4D,iBACtDC,QADsD,EAC5C;AACd,QACEC,YADF,GAGID,QAHJ,CACEC,YADF;AAAA,0BAGID,QAHJ,CAE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dnd/TreeDndPlugin.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport { isEqual } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport DraggableItem from './renderers/DraggableItem';\nimport DroppableList from './renderers/DroppableList';\nimport {\n changePositionBetweenDifferentArrays,\n changePositionSameArray,\n getTreePosition,\n} from './utils';\n\nexport const TreeDndPlugin = createInstancePlugin('tree-dnd', {\n state(instance) {\n const {\n originalData,\n props: { childrenKey = 'children', onOrderChange = () => null },\n } = instance;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [draggedRecord, setDraggedRecord] = useState(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const changeRecordsPosition = useCallback(\n ({ sourceRecord, targetRecord, combineWith, down }) => {\n let nextTreeData;\n\n const sourceTreePosition = getTreePosition(sourceRecord.path);\n let targetTreePosition = {};\n\n if (combineWith) {\n targetTreePosition = { parentPath: combineWith.path };\n } else if (targetRecord) {\n targetTreePosition = getTreePosition(targetRecord.path);\n } else {\n // there is no reordering\n // Reason: outside tree / outside drop target\n return originalData;\n }\n // if we are not combining elements we change the same array\n // if we combine elements, we change a different array (the children of the target)\n const changingSameArray =\n !combineWith &&\n isEqual(sourceTreePosition.parentPath, targetTreePosition.parentPath);\n\n if (changingSameArray) {\n nextTreeData = changePositionSameArray({\n sourceRecord,\n targetRecord,\n sourceTreePosition,\n targetTreePosition,\n data: originalData,\n });\n } else {\n nextTreeData = changePositionBetweenDifferentArrays({\n sourceRecord,\n targetRecord: combineWith || targetRecord,\n combineWith,\n sourceTreePosition,\n targetTreePosition,\n data: originalData,\n down,\n });\n }\n\n onOrderChange(nextTreeData, sourceRecord);\n // console.log('nextTreeData :>> ', nextTreeData);\n // console.log(\n // `${sourceRecord?.data?.name} --> ${\n // combineWith?.data?.name || targetRecord?.data?.name\n // }`,\n // );\n return nextTreeData;\n },\n [originalData, childrenKey],\n );\n\n return {\n state: { draggedRecord },\n actions: { setDraggedRecord, changeRecordsPosition },\n };\n },\n renderers(renderers, instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const item = useMemo(() => DraggableItem(renderers, instance), []);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const list = useMemo(() => DroppableList(renderers, instance), []);\n return { ...renderers, item, list };\n },\n});\n"],"names":["TreeDndPlugin","createInstancePlugin","state","instance","originalData","props","childrenKey","onOrderChange","useState","draggedRecord","setDraggedRecord","changeRecordsPosition","useCallback","sourceRecord","targetRecord","combineWith","down","nextTreeData","sourceTreePosition","getTreePosition","path","targetTreePosition","parentPath","changingSameArray","isEqual","changePositionSameArray","data","changePositionBetweenDifferentArrays","actions","renderers","item","useMemo","DraggableItem","list","DroppableList"],"mappings":";;;;;;;;;;;;;;;;;;;;IAWaA,aAAa,GAAGC,oBAAoB,CAAC,UAAD,EAAa;EAC5DC,KAD4D,iBACtDC,QADsD,EAC5C;IACd,IACEC,YADF,GAGID,QAHJ,CACEC,YADF;0BAGID,QAHJ,CAEEE,KAFF;gDAEWC,WAFX;QAEWA,WAFX,sCAEyB,UAFzB;gDAEqCC,aAFrC;QAEqCA,aAFrC,sCAEqD;MAAA,OAAM,IAAN;KAFrD,yBADc;;IAOd,gBAA0CC,QAAQ,CAAC,IAAD,CAAlD;;QAAOC,aAAP;QAAsBC,gBAAtB,iBAPc;;;IAUd,IAAMC,qBAAqB,GAAGC,WAAW,CACvC,gBAAuD;MAAA,IAApDC,YAAoD,QAApDA,YAAoD;UAAtCC,YAAsC,QAAtCA,YAAsC;UAAxBC,WAAwB,QAAxBA,WAAwB;UAAXC,IAAW,QAAXA,IAAW;MACrD,IAAIC,YAAJ;MAEA,IAAMC,kBAAkB,GAAGC,eAAe,CAACN,YAAY,CAACO,IAAd,CAA1C;MACA,IAAIC,kBAAkB,GAAG,EAAzB;;MAEA,IAAIN,WAAJ,EAAiB;QACfM,kBAAkB,GAAG;UAAEC,UAAU,EAAEP,WAAW,CAACK;SAA/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7B,IAAMI,IAAI,GAAGF,OAAO,CAAC;MAAA,OAAMG,aAAa,CAACL,UAAD,EAAY1B,QAAZ,CAAnB;KAAD,EAA2C,EAA3C,CAApB;IACA,uCAAY0B,UAAZ;MAAuBC,IAAI,EAAJA,IAAvB;MAA6BG,IAAI,EAAJA;;;AA3E6B,CAAb;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DraggableItem.js","sources":["../../../../../../src/deprecated/plugins/dnd/renderers/DraggableItem.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { Draggable } from 'react-beautiful-dnd';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { getDraggableProps } from '../utils';\n\n// eslint-disable-next-line react/display-name\nconst DraggableItem =\n (\n renderers,\n // , instance\n ) =>\n (props) => {\n const { record, index, isItemFocused } = props;\n const ItemComponent = renderers.item;\n const isDragDisabled = record?.parentNode?.data?.disableDragChildren || record?.data?.disableDrag || false;\n // const { draggedRecord } = instance.getInstance().state;\n\n // const isDragging = record.id === draggedRecord?.id;\n return (\n <Draggable\n isDragDisabled={isDragDisabled}\n key={`${record.id}-draggable`}\n draggableId={String(record.id)}\n index={index}\n >\n {(provided, snapshot) => {\n const { key, ...draggableProps } = getDraggableProps(props, provided, snapshot);\n\n return (\n <ItemComponent\n key={key}\n {...draggableProps}\n // isDragging={isDragging}\n leftAddons={[\n <GripperVertical\n data-testid=\"drag-handle\"\n key={`${record.id}-drag-handle`}\n {...provided.dragHandleProps}\n className=\"drag-handle\"\n tabIndex={isItemFocused ? 0 : -1}\n />,\n ...(props.leftAddons || []),\n ]}\n >\n {props.children}\n </ItemComponent>\n );\n }}\n </Draggable>\n );\n };\n\nexport default DraggableItem;\n"],"names":["DraggableItem","renderers","props","record","index","isItemFocused","ItemComponent","item","isDragDisabled","parentNode","data","disableDragChildren","disableDrag","id","String","provided","snapshot","getDraggableProps","key","draggableProps","dragHandleProps","leftAddons","children"],"mappings":";;;;;;;;;;;;IAOMA,aAAa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K,CAACoB,QAfT,CADF;AAmBD,KA5BH,CADF;AAgCD,GA3CD;AAAA;;;;"}
1
+ {"version":3,"file":"DraggableItem.js","sources":["../../../../../../src/deprecated/plugins/dnd/renderers/DraggableItem.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { Draggable } from 'react-beautiful-dnd';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { getDraggableProps } from '../utils';\n\n// eslint-disable-next-line react/display-name\nconst DraggableItem =\n (\n renderers,\n // , instance\n ) =>\n (props) => {\n const { record, index, isItemFocused } = props;\n const ItemComponent = renderers.item;\n const isDragDisabled = record?.parentNode?.data?.disableDragChildren || record?.data?.disableDrag || false;\n // const { draggedRecord } = instance.getInstance().state;\n\n // const isDragging = record.id === draggedRecord?.id;\n return (\n <Draggable\n isDragDisabled={isDragDisabled}\n key={`${record.id}-draggable`}\n draggableId={String(record.id)}\n index={index}\n >\n {(provided, snapshot) => {\n const { key, ...draggableProps } = getDraggableProps(props, provided, snapshot);\n\n return (\n <ItemComponent\n key={key}\n {...draggableProps}\n // isDragging={isDragging}\n leftAddons={[\n <GripperVertical\n data-testid=\"drag-handle\"\n key={`${record.id}-drag-handle`}\n {...provided.dragHandleProps}\n className=\"drag-handle\"\n tabIndex={isItemFocused ? 0 : -1}\n />,\n ...(props.leftAddons || []),\n ]}\n >\n {props.children}\n </ItemComponent>\n );\n }}\n </Draggable>\n );\n };\n\nexport default DraggableItem;\n"],"names":["DraggableItem","renderers","props","record","index","isItemFocused","ItemComponent","item","isDragDisabled","parentNode","data","disableDragChildren","disableDrag","id","String","provided","snapshot","getDraggableProps","key","draggableProps","dragHandleProps","leftAddons","children"],"mappings":";;;;;;;;;;;;IAOMA,aAAa,GACjB,SADIA,aACJ,CACEC,SADF;AAAA;EAAA,OAIA,UAACC,KAAD,EAAW;IAAA;;IACT,IAAQC,MAAR,GAAyCD,KAAzC,CAAQC,MAAR;QAAgBC,KAAhB,GAAyCF,KAAzC,CAAgBE,KAAhB;QAAuBC,aAAvB,GAAyCH,KAAzC,CAAuBG,aAAvB;IACA,IAAMC,aAAa,GAAGL,SAAS,CAACM,IAAhC;IACA,IAAMC,cAAc,GAAG,CAAAL,MAAM,SAAN,IAAAA,MAAM,WAAN,kCAAAA,MAAM,CAAEM,UAAR,mGAAoBC,IAApB,gFAA0BC,mBAA1B,MAAiDR,MAAjD,aAAiDA,MAAjD,uCAAiDA,MAAM,CAAEO,IAAzD,iDAAiD,aAAcE,WAA/D,KAA8E,KAArG,CAHS;;;IAOT,oBACE,oBAAC,SAAD;MACE,cAAc,EAAEJ,cADlB;MAEE,GAAG,YAAKL,MAAM,CAACU,EAAZ,eAFL;MAGE,WAAW,EAAEC,MAAM,CAACX,MAAM,CAACU,EAAR,CAHrB;MAIE,KAAK,EAAET;OAEN,UAACW,QAAD,EAAWC,QAAX,EAAwB;MACvB,yBAAmCC,iBAAiB,CAACf,KAAD,EAAQa,QAAR,EAAkBC,QAAlB,CAApD;UAAQE,GAAR,sBAAQA,GAAR;UAAgBC,cAAhB;;MAEA,oBACE,oBAAC,aAAD;QACE,GAAG,EAAED;SACDC,cAFN;;QAIE,UAAU,gBACR,oBAAC,eAAD;UACE,eAAY,aADd;UAEE,GAAG,YAAKhB,MAAM,CAACU,EAAZ;WACCE,QAAQ,CAACK,eAHf;UAIE,SAAS,EAAC,aAJZ;UAKE,QAAQ,EAAEf,aAAa,GAAG,CAAH,GAAO,CAAC;WANzB,4BAQJH,KAAK,CAACmB,UAAN,IAAoB,EARhB;UAWTnB,KAAK,CAACoB,QAfT,CADF;KATJ,CADF;GAXF;AAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DroppableList.js","sources":["../../../../../../src/deprecated/plugins/dnd/renderers/DroppableList.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\n/* eslint max-lines: [\"error\", 300] */\n/* eslint-disable react-hooks/rules-of-hooks */\nimport React, {\n useCallback,\n useContext,\n useRef,\n useState,\n // useMemo,\n} from 'react';\nimport { DragDropContext, Droppable } from 'react-beautiful-dnd';\nimport { cx } from '@elliemae/ds-utilities';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport FocusGroupContext from '@elliemae/ds-shared/FocusGroup/FocusGroupContext';\nimport { findItemById, findItemOnDocument } from '../../tree/utils';\nimport { getDraggableProps } from '../utils';\n\nconst DroppableList =\n (renderers, instance) =>\n ({ records, ...rest }) => {\n const {\n props: { expandTimerDelay = 1000, restrictDragAndDrop },\n actions: { setDraggedRecord, changeRecordsPosition, toggleExpand },\n state: { draggedRecord },\n itemRenderer,\n } = instance.getInstance();\n\n const focusContext = useContext(FocusGroupContext);\n const [focusedItemWasDragged, setFocusedItemWasDragged] = useState(false);\n const preDragFocusedNode = useRef();\n const expandTimerRef = useRef();\n const draggedRecordShouldExpand = useRef(false);\n const currTargetRef = useRef({});\n\n const onDragUpdate = useCallback(\n (data) => {\n const { destination, combine } = data;\n clearTimeout(expandTimerRef.current);\n\n if (combine) {\n const { draggableId } = combine;\n const targetRecord = findItemById(records, draggableId);\n\n if (targetRecord && targetRecord.isGroup && !targetRecord.expanded) {\n expandTimerRef.current = setTimeout(() => toggleExpand(targetRecord), expandTimerDelay);\n }\n }\n currTargetRef.current = destination || currTargetRef.current;\n },\n [records],\n );\n\n const onDragStart = useCallback(\n ({ source }) => {\n preDragFocusedNode.current = document.activeElement;\n // when we move the currently focused item, preDragFocusedNode is the body of the doc\n setFocusedItemWasDragged(preDragFocusedNode.current.tagName === 'BODY');\n\n const draggingRecord = records[source.index];\n\n if (draggingRecord.expanded) {\n draggedRecordShouldExpand.current = true;\n toggleExpand(draggingRecord);\n }\n\n setDraggedRecord(draggingRecord);\n },\n [records],\n );\n\n const onDragEnd = useCallback(\n // eslint-disable-next-line complexity\n // eslint-disable-next-line max-statements\n ({ destination, source, combine }) => {\n clearTimeout(expandTimerRef.current);\n const sourceIndex = source.index;\n const destinationIndex = destination && destination.index;\n\n if (sourceIndex === destinationIndex) return;\n\n const sourceRecord = records[sourceIndex];\n const targetRecord = destination && records[destinationIndex];\n const combineWith = combine && findItemById(records, combine.draggableId);\n\n const down = sourceIndex < destinationIndex;\n\n if (restrictDragAndDrop && sourceRecord?.parentNode?.id !== targetRecord?.parentNode?.id) return;\n\n // TODO check if we can change the records Immutable, this makes the DOM inconsistent on first renderers\n changeRecordsPosition({\n sourceRecord,\n targetRecord,\n combineWith,\n down,\n });\n\n if (draggedRecordShouldExpand.current) {\n draggedRecordShouldExpand.current = false;\n toggleExpand(sourceRecord);\n }\n\n if (focusContext) {\n // TODO if we fix the mutable/immutable records handling this work-around should not be required anymore\n setTimeout(() => {\n const postDragFocusedNode = focusedItemWasDragged\n ? findItemOnDocument(sourceRecord.id)\n : findItemOnDocument(preDragFocusedNode.current.dataset.id);\n\n focusContext.focusItemByNode(postDragFocusedNode);\n }, 0);\n }\n\n currTargetRef.current = null;\n setDraggedRecord(null);\n },\n [records, focusedItemWasDragged],\n );\n\n const { item: ItemComponent, list: ListComponent } = renderers;\n const renderClone = useCallback(\n (provided, snapshot, rubric) => {\n const targetRecord = (currTargetRef.current && records[currTargetRef.current.index]) || {};\n const record = records[rubric.source.index];\n return (\n <ItemComponent\n {...provided.draggableProps}\n key={rubric.source.index}\n record={record}\n {...getDraggableProps(\n {\n className: 'item-cloned',\n },\n provided,\n snapshot,\n )}\n >\n <GripperVertical {...provided.dragHandleProps} className=\"drag-handle\" />\n {itemRenderer({\n record,\n nestingLevel: targetRecord.nestingLevel,\n })}\n </ItemComponent>\n );\n },\n [currTargetRef, records, itemRenderer],\n );\n\n return (\n <DragDropContext onDragEnd={onDragEnd} onDragStart={onDragStart} onDragUpdate={onDragUpdate}>\n <Droppable droppableId=\"droppableId\" isCombineEnabled mode=\"virtual\" renderClone={renderClone}>\n {(droppableProvided, snapshot) => {\n // Add an extra item to our list to make space for a dragging item\n // work in a virtual list\n const itemCount = snapshot.isUsingPlaceholder ? records.length + 1 : records.length;\n\n return (\n <ListComponent\n {...rest}\n className={cx(rest.className, draggedRecord && 'dragging')}\n innerRef={mergeRefs(droppableProvided.innerRef, rest.innerRef, rest.ref)}\n itemCount={itemCount}\n records={records}\n />\n );\n }}\n </Droppable>\n </DragDropContext>\n );\n };\n\nexport default DroppableList;\n"],"names":["DroppableList","renderers","instance","records","rest","getInstance","props","expandTimerDelay","restrictDragAndDrop","actions","setDraggedRecord","changeRecordsPosition","toggleExpand","draggedRecord","state","itemRenderer","focusContext","useContext","FocusGroupContext","useState","focusedItemWasDragged","setFocusedItemWasDragged","preDragFocusedNode","useRef","expandTimerRef","draggedRecordShouldExpand","currTargetRef","onDragUpdate","useCallback","data","destination","combine","clearTimeout","current","draggableId","targetRecord","findItemById","isGroup","expanded","setTimeout","onDragStart","source","document","activeElement","tagName","draggingRecord","index","onDragEnd","sourceIndex","destinationIndex","sourceRecord","combineWith","down","parentNode","id","postDragFocusedNode","findItemOnDocument","dataset","focusItemByNode","ItemComponent","item","ListComponent","list","renderClone","provided","snapshot","rubric","record","draggableProps","getDraggableProps","className","dragHandleProps","nestingLevel","droppableProvided","itemCount","isUsingPlaceholder","length","cx","mergeRefs","innerRef","ref"],"mappings":";;;;;;;;;;;;;;;;IAkBMA,aAAa,GACjB,SADIA,aACJ,CAACC,SAAD,EAAYC,QAAZ;AAAA,SACA,gBAA0B;AAAA,QAAvBC,OAAuB,QAAvBA,OAAuB;AAAA,QAAXC,IAAW;;AACxB,gCAKIF,QAAQ,CAACG,WAAT,EALJ;AAAA,uDACEC,KADF;AAAA,wDACWC,gBADX;AAAA,QACWA,gBADX,uCAC8B,IAD9B;AAAA,QACoCC,mBADpC,0BACoCA,mBADpC;AAAA,uDAEEC,OAFF;AAAA,QAEaC,gBAFb,0BAEaA,gBAFb;AAAA,QAE+BC,qBAF/B,0BAE+BA,qBAF/B;AAAA,QAEsDC,YAFtD,0BAEsDA,YAFtD;AAAA,QAGWC,aAHX,yBAGEC,KAHF,CAGWD,aAHX;AAAA,QAIEE,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KE,QAAA,OAAO,EAAEvE;AALX,SADF;AASD,KAfH,CADF,CADF;AAqBD,GAtJD;AAAA;;;;"}
1
+ {"version":3,"file":"DroppableList.js","sources":["../../../../../../src/deprecated/plugins/dnd/renderers/DroppableList.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\n/* eslint max-lines: [\"error\", 300] */\n/* eslint-disable react-hooks/rules-of-hooks */\nimport React, {\n useCallback,\n useContext,\n useRef,\n useState,\n // useMemo,\n} from 'react';\nimport { DragDropContext, Droppable } from 'react-beautiful-dnd';\nimport { cx } from '@elliemae/ds-utilities';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport FocusGroupContext from '@elliemae/ds-shared/FocusGroup/FocusGroupContext';\nimport { findItemById, findItemOnDocument } from '../../tree/utils';\nimport { getDraggableProps } from '../utils';\n\nconst DroppableList =\n (renderers, instance) =>\n ({ records, ...rest }) => {\n const {\n props: { expandTimerDelay = 1000, restrictDragAndDrop },\n actions: { setDraggedRecord, changeRecordsPosition, toggleExpand },\n state: { draggedRecord },\n itemRenderer,\n } = instance.getInstance();\n\n const focusContext = useContext(FocusGroupContext);\n const [focusedItemWasDragged, setFocusedItemWasDragged] = useState(false);\n const preDragFocusedNode = useRef();\n const expandTimerRef = useRef();\n const draggedRecordShouldExpand = useRef(false);\n const currTargetRef = useRef({});\n\n const onDragUpdate = useCallback(\n (data) => {\n const { destination, combine } = data;\n clearTimeout(expandTimerRef.current);\n\n if (combine) {\n const { draggableId } = combine;\n const targetRecord = findItemById(records, draggableId);\n\n if (targetRecord && targetRecord.isGroup && !targetRecord.expanded) {\n expandTimerRef.current = setTimeout(() => toggleExpand(targetRecord), expandTimerDelay);\n }\n }\n currTargetRef.current = destination || currTargetRef.current;\n },\n [records],\n );\n\n const onDragStart = useCallback(\n ({ source }) => {\n preDragFocusedNode.current = document.activeElement;\n // when we move the currently focused item, preDragFocusedNode is the body of the doc\n setFocusedItemWasDragged(preDragFocusedNode.current.tagName === 'BODY');\n\n const draggingRecord = records[source.index];\n\n if (draggingRecord.expanded) {\n draggedRecordShouldExpand.current = true;\n toggleExpand(draggingRecord);\n }\n\n setDraggedRecord(draggingRecord);\n },\n [records],\n );\n\n const onDragEnd = useCallback(\n // eslint-disable-next-line complexity\n // eslint-disable-next-line max-statements\n ({ destination, source, combine }) => {\n clearTimeout(expandTimerRef.current);\n const sourceIndex = source.index;\n const destinationIndex = destination && destination.index;\n\n if (sourceIndex === destinationIndex) return;\n\n const sourceRecord = records[sourceIndex];\n const targetRecord = destination && records[destinationIndex];\n const combineWith = combine && findItemById(records, combine.draggableId);\n\n const down = sourceIndex < destinationIndex;\n\n if (restrictDragAndDrop && sourceRecord?.parentNode?.id !== targetRecord?.parentNode?.id) return;\n\n // TODO check if we can change the records Immutable, this makes the DOM inconsistent on first renderers\n changeRecordsPosition({\n sourceRecord,\n targetRecord,\n combineWith,\n down,\n });\n\n if (draggedRecordShouldExpand.current) {\n draggedRecordShouldExpand.current = false;\n toggleExpand(sourceRecord);\n }\n\n if (focusContext) {\n // TODO if we fix the mutable/immutable records handling this work-around should not be required anymore\n setTimeout(() => {\n const postDragFocusedNode = focusedItemWasDragged\n ? findItemOnDocument(sourceRecord.id)\n : findItemOnDocument(preDragFocusedNode.current.dataset.id);\n\n focusContext.focusItemByNode(postDragFocusedNode);\n }, 0);\n }\n\n currTargetRef.current = null;\n setDraggedRecord(null);\n },\n [records, focusedItemWasDragged],\n );\n\n const { item: ItemComponent, list: ListComponent } = renderers;\n const renderClone = useCallback(\n (provided, snapshot, rubric) => {\n const targetRecord = (currTargetRef.current && records[currTargetRef.current.index]) || {};\n const record = records[rubric.source.index];\n return (\n <ItemComponent\n {...provided.draggableProps}\n key={rubric.source.index}\n record={record}\n {...getDraggableProps(\n {\n className: 'item-cloned',\n },\n provided,\n snapshot,\n )}\n >\n <GripperVertical {...provided.dragHandleProps} className=\"drag-handle\" />\n {itemRenderer({\n record,\n nestingLevel: targetRecord.nestingLevel,\n })}\n </ItemComponent>\n );\n },\n [currTargetRef, records, itemRenderer],\n );\n\n return (\n <DragDropContext onDragEnd={onDragEnd} onDragStart={onDragStart} onDragUpdate={onDragUpdate}>\n <Droppable droppableId=\"droppableId\" isCombineEnabled mode=\"virtual\" renderClone={renderClone}>\n {(droppableProvided, snapshot) => {\n // Add an extra item to our list to make space for a dragging item\n // work in a virtual list\n const itemCount = snapshot.isUsingPlaceholder ? records.length + 1 : records.length;\n\n return (\n <ListComponent\n {...rest}\n className={cx(rest.className, draggedRecord && 'dragging')}\n innerRef={mergeRefs(droppableProvided.innerRef, rest.innerRef, rest.ref)}\n itemCount={itemCount}\n records={records}\n />\n );\n }}\n </Droppable>\n </DragDropContext>\n );\n };\n\nexport default DroppableList;\n"],"names":["DroppableList","renderers","instance","records","rest","getInstance","props","expandTimerDelay","restrictDragAndDrop","actions","setDraggedRecord","changeRecordsPosition","toggleExpand","draggedRecord","state","itemRenderer","focusContext","useContext","FocusGroupContext","useState","focusedItemWasDragged","setFocusedItemWasDragged","preDragFocusedNode","useRef","expandTimerRef","draggedRecordShouldExpand","currTargetRef","onDragUpdate","useCallback","data","destination","combine","clearTimeout","current","draggableId","targetRecord","findItemById","isGroup","expanded","setTimeout","onDragStart","source","document","activeElement","tagName","draggingRecord","index","onDragEnd","sourceIndex","destinationIndex","sourceRecord","combineWith","down","parentNode","id","postDragFocusedNode","findItemOnDocument","dataset","focusItemByNode","ItemComponent","item","ListComponent","list","renderClone","provided","snapshot","rubric","record","draggableProps","getDraggableProps","className","dragHandleProps","nestingLevel","droppableProvided","itemCount","isUsingPlaceholder","length","cx","mergeRefs","innerRef","ref"],"mappings":";;;;;;;;;;;;;;;;IAkBMA,aAAa,GACjB,SADIA,aACJ,CAACC,SAAD,EAAYC,QAAZ;EAAA,OACA,gBAA0B;IAAA,IAAvBC,OAAuB,QAAvBA,OAAuB;QAAXC,IAAW;;IACxB,4BAKIF,QAAQ,CAACG,WAAT,EALJ;uDACEC,KADF;wD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complexity */\n/* eslint-disable no-continue */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable max-lines */\nimport {\n arrayMove,\n cx,\n get,\n set,\n cloneDeep,\n} from '@elliemae/ds-utilities';\nimport { mergeRefs } from '@elliemae/ds-utilities';\n\nexport function getStyle(provided, style) {\n if (!style) {\n return provided.draggableProps.style;\n }\n return {\n ...provided.draggableProps.style,\n ...style,\n };\n}\n\nexport function getDraggableProps(props, provided, snapshot) {\n const isGroupedOver = Boolean(snapshot.combineTargetFor);\n return {\n ...props,\n ...provided.draggableProps,\n className: cx(props.className, isGroupedOver && 'can-group-over'),\n // provided,\n innerRef: mergeRefs(provided.innerRef, props.innerRef, props.ref),\n 'data-index': props.index,\n style: getStyle(provided, { ...props.style, display: 'flex' }),\n };\n}\n\nexport const setTreeArrayInPath = (treeData, path, data) => {\n const nextTreeData = [...treeData];\n if (path.length) {\n set(nextTreeData, path, data);\n return nextTreeData;\n }\n return data;\n};\n\n// check if at the earliest possible different nest level the source is before the target or not\nexport const isSourceBeforeTarget = (sourcePath, targetPath) => {\n let sourceIsBeforeTarget = false;\n if (sourcePath.length <= targetPath.length) {\n // we increase by 2 beacuse every other position is 'children'\n for (let i = 0; i < sourcePath.length; i += 2) {\n const source = sourcePath[i];\n const target = targetPath[i];\n // since we skip by 2 source/target can be out of bounds\n // if source/target are the same we are at same nest level\n if (\n !Number.isInteger(source) || // check to see if it's a number because 0 == false in javascript\n !Number.isInteger(target) ||\n source === target\n )\n continue;\n // the nest level differs, as such we check if source if before or after\n sourceIsBeforeTarget = source < target;\n break;\n }\n }\n\n return sourceIsBeforeTarget;\n};\n\nexport const updateTargetPath = (sourcePath, targetPath, incr = -1) => {\n const nextTargetPath = [...targetPath];\n\n const posToUpdate = sourcePath.length ? sourcePath.length - 1 : 0;\n nextTargetPath.splice(posToUpdate, 1, targetPath[posToUpdate] + incr);\n\n return nextTargetPath;\n};\n\nexport const getParentPath = (path) => path.slice(0, -1);\nexport const getParentChildrenByPath = (treeData, path) =>\n path && path.length ? get(treeData, path) : treeData;\n\nexport const getTreePosition = (recordPath) => ({\n parentPath: getParentPath(recordPath),\n index: recordPath.slice(-1)[0],\n});\n\nexport const changePositionBetweenDifferentArrays = ({\n sourceTreePosition, // already extracted sourceRecord.path\n targetTreePosition, // already extracted targetRecord.path\n // combineWith the element we want to append to the children of (this is null when the drag doesn't result in adding children)\n combineWith,\n sourceRecord, // what we are dragging\n targetRecord, // what we are dropping on top of\n down, // ???\n data, // tree before dragEnd changes\n childrenKey = 'children', // constant -> 'children'\n}) => {\n let nextTreeData = cloneDeep(data);\n\n if (!sourceRecord || !sourceRecord.data)\n throw new Error('error while dragging, no dragged item received');\n\n const sourceTreeChildren = getParentChildrenByPath(\n nextTreeData,\n sourceTreePosition.parentPath,\n );\n\n // When moving an item we remove the item from it's former parent children array\n sourceTreeChildren.splice(sourceTreePosition.index, 1);\n nextTreeData = setTreeArrayInPath(\n nextTreeData,\n sourceTreePosition.parentPath,\n sourceTreeChildren,\n );\n\n // if source is at previous position than the target children\n // then the index should decrease\n const shouldUpdateTarget = isSourceBeforeTarget(\n sourceRecord.path,\n targetRecord.path,\n );\n const nextTargetPosition = shouldUpdateTarget\n ? combineWith\n ? {\n parentPath: updateTargetPath(sourceRecord.path, combineWith.path),\n }\n : getTreePosition(updateTargetPath(sourceRecord.path, targetRecord.path))\n : targetTreePosition;\n\n // add to target\n const { parentPath } = nextTargetPosition;\n const targetTreeChildren =\n getParentChildrenByPath(nextTreeData, parentPath) ||\n combineWith?.data ||\n targetRecord?.data;\n if (combineWith && targetTreeChildren) {\n const targetChildrensArray = targetTreeChildren[childrenKey];\n targetChildrensArray.push(sourceRecord.data);\n } else if (targetTreeChildren) {\n targetTreeChildren.splice(\n targetTreePosition.index + (down ? 1 : 0),\n 0,\n sourceRecord.data,\n );\n }\n\n nextTreeData = setTreeArrayInPath(\n nextTreeData,\n parentPath,\n targetTreeChildren,\n );\n\n return nextTreeData;\n};\n\nexport const combineWithTarget = () => {};\n\nexport const changePositionSameArray = ({\n targetTreePosition,\n sourceRecord,\n targetRecord,\n data,\n}) => {\n let nextTreeData = cloneDeep(data);\n\n const targetTreeChildren = getParentChildrenByPath(\n nextTreeData,\n targetTreePosition.parentPath,\n );\n const nextChildren = arrayMove(\n targetTreeChildren,\n sourceRecord.index,\n targetRecord.index,\n );\n\n // mutates the tree. That's the reason of the clone above\n nextTreeData = setTreeArrayInPath(\n nextTreeData,\n targetTreePosition.parentPath,\n nextChildren,\n );\n\n return nextTreeData;\n};\n"],"names":["getStyle","provided","style","draggableProps","getDraggableProps","props","snapshot","isGroupedOver","Boolean","combineTargetFor","className","cx","innerRef","mergeRefs","ref","index","display","setTreeArrayInPath","treeData","path","data","nextTreeData","length","set","isSourceBeforeTarget","sourcePath","targetPath","sourceIsBeforeTarget","i","source","target","Number","isInteger","updateTargetPath","incr","nextTargetPath","posToUpdate","splice","getParentPath","slice","getParentChildrenByPath","get","getTreePosition","recordPath","parentPath","changePositionBetweenDifferentArrays","sourceTreePosition","targetTreePosition","combineWith","sourceRecord","targetRecord","down","childrenKey","cloneDeep","Error","sourceTreeChildren","shouldUpdateTarget","nextTargetPosition","targetTreeChildren","targetChildrensArray","push","combineWithTarget","changePositionSameArray","nextChildren","arrayMove"],"mappings":";;;;;;;AAeO,SAASA,QAAT,CAAkBC,QAAlB,EAA4BC,KAA5B,EAAmC;AACxC,MAAI,CAACA,KAAL,EAAY;AACV,WAAOD,QAAQ,CAACE,cAAT,CAAwBD,KAA/B;AACD;;AACD,yCACKD,QAAQ,CAACE,cAAT,CAAwBD,KAD7B,GAEKA,KAFL;AAID;AAEM,SAASE,iBAAT,CAA2BC,KAA3B,EAAkCJ,QAAlC,EAA4CK,QAA5C,EAAsD;AAC3D,MAAMC,aAAa,GAAGC,OAAO,CAACF,QAAQ,CAACG,gBAAV,CAA7B;AACA,uDACKJ,KADL,GAEKJ,QAAQ,CAACE,cAFd;AAGEO,IAAAA,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CAA/C;AACAO,IAAAA,oBAAoB,CAACC,IAArB,CAA0BX,YAAY,CAAC7B,IAAvC;AACD,GAHD,MAGO,IAAIsC,kBAAJ,EAAwB;AAC7BA,IAAAA,kBAAkB,CAACrB,MAAnB,CACEU,kBAAkB,CAAChC,KAAnB,IAA4BoC,IAAI,GAAG,CAAH,GAAO,CAAvC,CADF,EAEE,CAFF,EAGEF,YAAY,CAAC7B,IAHf;AAKD;;AAEDC,EAAAA,YAAY,GAAGJ,kBAAkB,CAC/BI,YAD+B,EAE/BuB,UAF+B,EAG/Bc,kBAH+B,CAAjC;AAMA,SAAOrC,YAAP;AACD;IAEYwC,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;IAE1BC,uBAAuB,GAAG,SAA1BA,uBAA0B,QAKjC;AAAA,MAJJf,kBAII,SAJJA,kBAII;AAAA,MAHJE,YAGI,SAHJA,YAGI;AAAA,MAFJC,YAEI,SAFJA,YAEI;AAAA,MADJ9B,IACI,SADJA,IACI;AACJ,MAAIC,YAAY,GAAGgC,SAAS,CAACjC,IAAD,CAA5B;AAEA,MAAMsC,kBAAkB,GAAGlB,uBAAuB,CAChDnB,YADgD,EAEhD0B,kBAAkB,CAACH,UAF6B,CAAlD;AAIA,MAAMmB,YAAY,GAAGC,SAAS,CAC5BN,kBAD4B,EAE5BT,YAAY,CAAClC,KAFe,EAG5BmC,YAAY,CAACnC,KAHe,CAA9B,CAPI;;AAcJM,EAAAA,YAAY,GAAGJ,kBAAkB,CAC/BI,YAD+B,EAE/B0B,kBAAkB,CAACH,UAFY,EAG/BmB,YAH+B,CAAjC;AAMA,SAAO1C,YAAP;AACD;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/deprecated/plugins/dnd/utils.tsx"],"sourcesContent":["/* eslint-disable complexity */\n/* eslint-disable no-continue */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable max-lines */\nimport {\n arrayMove,\n cx,\n get,\n set,\n cloneDeep,\n} from '@elliemae/ds-utilities';\nimport { mergeRefs } from '@elliemae/ds-utilities';\n\nexport function getStyle(provided, style) {\n if (!style) {\n return provided.draggableProps.style;\n }\n return {\n ...provided.draggableProps.style,\n ...style,\n };\n}\n\nexport function getDraggableProps(props, provided, snapshot) {\n const isGroupedOver = Boolean(snapshot.combineTargetFor);\n return {\n ...props,\n ...provided.draggableProps,\n className: cx(props.className, isGroupedOver && 'can-group-over'),\n // provided,\n innerRef: mergeRefs(provided.innerRef, props.innerRef, props.ref),\n 'data-index': props.index,\n style: getStyle(provided, { ...props.style, display: 'flex' }),\n };\n}\n\nexport const setTreeArrayInPath = (treeData, path, data) => {\n const nextTreeData = [...treeData];\n if (path.length) {\n set(nextTreeData, path, data);\n return nextTreeData;\n }\n return data;\n};\n\n// check if at the earliest possible different nest level the source is before the target or not\nexport const isSourceBeforeTarget = (sourcePath, targetPath) => {\n let sourceIsBeforeTarget = false;\n if (sourcePath.length <= targetPath.length) {\n // we increase by 2 beacuse every other position is 'children'\n for (let i = 0; i < sourcePath.length; i += 2) {\n const source = sourcePath[i];\n const target = targetPath[i];\n // since we skip by 2 source/target can be out of bounds\n // if source/target are the same we are at same nest level\n if (\n !Number.isInteger(source) || // check to see if it's a number because 0 == false in javascript\n !Number.isInteger(target) ||\n source === target\n )\n continue;\n // the nest level differs, as such we check if source if before or after\n sourceIsBeforeTarget = source < target;\n break;\n }\n }\n\n return sourceIsBeforeTarget;\n};\n\nexport const updateTargetPath = (sourcePath, targetPath, incr = -1) => {\n const nextTargetPath = [...targetPath];\n\n const posToUpdate = sourcePath.length ? sourcePath.length - 1 : 0;\n nextTargetPath.splice(posToUpdate, 1, targetPath[posToUpdate] + incr);\n\n return nextTargetPath;\n};\n\nexport const getParentPath = (path) => path.slice(0, -1);\nexport const getParentChildrenByPath = (treeData, path) =>\n path && path.length ? get(treeData, path) : treeData;\n\nexport const getTreePosition = (recordPath) => ({\n parentPath: getParentPath(recordPath),\n index: recordPath.slice(-1)[0],\n});\n\nexport const changePositionBetweenDifferentArrays = ({\n sourceTreePosition, // already extracted sourceRecord.path\n targetTreePosition, // already extracted targetRecord.path\n // combineWith the element we want to append to the children of (this is null when the drag doesn't result in adding children)\n combineWith,\n sourceRecord, // what we are dragging\n targetRecord, // what we are dropping on top of\n down, // ???\n data, // tree before dragEnd changes\n childrenKey = 'children', // constant -> 'children'\n}) => {\n let nextTreeData = cloneDeep(data);\n\n if (!sourceRecord || !sourceRecord.data)\n throw new Error('error while dragging, no dragged item received');\n\n const sourceTreeChildren = getParentChildrenByPath(\n nextTreeData,\n sourceTreePosition.parentPath,\n );\n\n // When moving an item we remove the item from it's former parent children array\n sourceTreeChildren.splice(sourceTreePosition.index, 1);\n nextTreeData = setTreeArrayInPath(\n nextTreeData,\n sourceTreePosition.parentPath,\n sourceTreeChildren,\n );\n\n // if source is at previous position than the target children\n // then the index should decrease\n const shouldUpdateTarget = isSourceBeforeTarget(\n sourceRecord.path,\n targetRecord.path,\n );\n const nextTargetPosition = shouldUpdateTarget\n ? combineWith\n ? {\n parentPath: updateTargetPath(sourceRecord.path, combineWith.path),\n }\n : getTreePosition(updateTargetPath(sourceRecord.path, targetRecord.path))\n : targetTreePosition;\n\n // add to target\n const { parentPath } = nextTargetPosition;\n const targetTreeChildren =\n getParentChildrenByPath(nextTreeData, parentPath) ||\n combineWith?.data ||\n targetRecord?.data;\n if (combineWith && targetTreeChildren) {\n const targetChildrensArray = targetTreeChildren[childrenKey];\n targetChildrensArray.push(sourceRecord.data);\n } else if (targetTreeChildren) {\n targetTreeChildren.splice(\n targetTreePosition.index + (down ? 1 : 0),\n 0,\n sourceRecord.data,\n );\n }\n\n nextTreeData = setTreeArrayInPath(\n nextTreeData,\n parentPath,\n targetTreeChildren,\n );\n\n return nextTreeData;\n};\n\nexport const combineWithTarget = () => {};\n\nexport const changePositionSameArray = ({\n targetTreePosition,\n sourceRecord,\n targetRecord,\n data,\n}) => {\n let nextTreeData = cloneDeep(data);\n\n const targetTreeChildren = getParentChildrenByPath(\n nextTreeData,\n targetTreePosition.parentPath,\n );\n const nextChildren = arrayMove(\n targetTreeChildren,\n sourceRecord.index,\n targetRecord.index,\n );\n\n // mutates the tree. That's the reason of the clone above\n nextTreeData = setTreeArrayInPath(\n nextTreeData,\n targetTreePosition.parentPath,\n nextChildren,\n );\n\n return nextTreeData;\n};\n"],"names":["getStyle","provided","style","draggableProps","getDraggableProps","props","snapshot","isGroupedOver","Boolean","combineTargetFor","className","cx","innerRef","mergeRefs","ref","index","display","setTreeArrayInPath","treeData","path","data","nextTreeData","length","set","isSourceBeforeTarget","sourcePath","targetPath","sourceIsBeforeTarget","i","source","target","Number","isInteger","updateTargetPath","incr","nextTargetPath","posToUpdate","splice","getParentPath","slice","getParentChildrenByPath","get","getTreePosition","recordPath","parentPath","changePositionBetweenDifferentArrays","sourceTreePosition","targetTreePosition","combineWith","sourceRecord","targetRecord","down","childrenKey","cloneDeep","Error","sourceTreeChildren","shouldUpdateTarget","nextTargetPosition","targetTreeChildren","targetChildrensArray","push","combineWithTarget","changePositionSameArray","nextChildren","arrayMove"],"mappings":";;;;;;;AAeO,SAASA,QAAT,CAAkBC,QAAlB,EAA4BC,KAA5B,EAAmC;EACxC,IAAI,CAACA,KAAL,EAAY;IACV,OAAOD,QAAQ,CAACE,cAAT,CAAwBD,KAA/B;;;EAEF,uCACKD,QAAQ,CAACE,cAAT,CAAwBD,KAD7B,GAEKA,KAFL;AAID;AAEM,SAASE,iBAAT,CAA2BC,KAA3B,EAAkCJ,QAAlC,EAA4CK,QAA5C,EAAsD;EAC3D,IAAMC,aAAa,GAAGC,OAAO,CAACF,QAAQ,CAACG,gBAAV,CAA7B;EACA,qDACKJ,KADL,GAEKJ,QAAQ,CAACE,cAFd;IAGEO,SAAS,EAAEC,EAAE,CAACN,KAAK,CAACK,SAAP,EAAkBH,aAAa,IAAI,gBAAnC,CAHf;;IAKEK,QAAQ,EAAEC,SAAS,CAACZ,QAAQ,CAACW,QAAV,EAAoBP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/Bc,kBAH+B,CAAjC;EAMA,OAAOrC,YAAP;AACD;IAEYwC,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;IAE1BC,uBAAuB,GAAG,SAA1BA,uBAA0B,QAKjC;EAAA,IAJJf,kBAII,SAJJA,kBAII;MAHJE,YAGI,SAHJA,YAGI;MAFJC,YAEI,SAFJA,YAEI;MADJ9B,IACI,SADJA,IACI;EACJ,IAAIC,YAAY,GAAGgC,SAAS,CAACjC,IAAD,CAA5B;EAEA,IAAMsC,kBAAkB,GAAGlB,uBAAuB,CAChDnB,YADgD,EAEhD0B,kBAAkB,CAACH,UAF6B,CAAlD;EAIA,IAAMmB,YAAY,GAAGC,SAAS,CAC5BN,kBAD4B,EAE5BT,YAAY,CAAClC,KAFe,EAG5BmC,YAAY,CAACnC,KAHe,CAA9B,CAPI;;EAcJM,YAAY,GAAGJ,kBAAkB,CAC/BI,YAD+B,EAE/B0B,kBAAkB,CAACH,UAFY,EAG/BmB,YAH+B,CAAjC;EAMA,OAAO1C,YAAP;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeRovingPlugin.js","sources":["../../../../../src/deprecated/plugins/roving/TreeRovingPlugin.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\n/* eslint-disable react-hooks/rules-of-hooks */\nimport React, { useMemo, useRef, useState } from 'react';\nimport FocusGroupProvider from '@elliemae/ds-shared/FocusGroup/FocusGroupManager';\nimport useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\n\n// eslint-disable-next-line react/display-name\nconst TreeListRovingHoc = (instance) => (props) => {\n const { hotKeys } = instance.getInstance();\n return (\n <FocusGroupProvider hotKeys={hotKeys}>{props.children}</FocusGroupProvider>\n );\n};\n\n// eslint-disable-next-line react/display-name\nconst TreeItemRovingHoc = (Component) => ({\n innerRef,\n onFocus,\n onBlur,\n ...props\n}) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const ref = useRef(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusGroupItem(ref, {\n onFocus,\n onBlur,\n });\n return <Component {...props} innerRef={mergeRefs(ref, innerRef)} />;\n};\n\nexport const TreeRovingPlugin = createInstancePlugin('tree-data', {\n getItemProps(props, instance) {\n const [isItemFocused, setIsItemFocused] = useState(false);\n return {\n ...props,\n onBlur: () => setIsItemFocused(false),\n // eslint-disable-next-line no-unused-vars\n onFocus: (e) => {\n setIsItemFocused(true);\n if (instance?.props?.onItemFocus) {\n instance.props.onItemFocus({\n scrollToItem: (...args) =>\n props?.listRef?.current?.scrollToItem(args),\n itemIndex: props?.index,\n });\n }\n },\n isItemFocused,\n 'data-index': props.index,\n };\n },\n renderers(renderers, instance) {\n const ListWrapper = useMemo(() => TreeListRovingHoc(instance), []);\n const Item = useMemo(() => TreeItemRovingHoc(renderers.item, instance), []);\n\n return {\n ...renderers,\n listWrapper: ListWrapper,\n item: Item,\n };\n },\n});\n\nTreeRovingPlugin.order = 0;\n"],"names":["TreeListRovingHoc","instance","props","getInstance","hotKeys","children","TreeItemRovingHoc","Component","innerRef","onFocus","onBlur","ref","useRef","useFocusGroupItem","mergeRefs","TreeRovingPlugin","createInstancePlugin","getItemProps","useState","isItemFocused","setIsItemFocused","e","onItemFocus","scrollToItem","args","listRef","current","itemIndex","index","renderers","ListWrapper","useMemo","Item","item","listWrapper","order"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD;AAAA,SAAc,UAACC,KAAD,EAAW;AACjD,gCAAoBD,QAAQ,CAACE,WAAT,EAApB;AAAA,QAAQC,OAAR,yBAAQA,OAAR;;AACA,wBACE,oBAAC,kBAAD;AAAoB,MAAA,OAAO,EAAEA;AAA7B,OAAuCF,KAAK,CAACG,QAA7C,CADF;AAGD,GALyB;AAAA,CAA1B;;;AAQA,IAAMC,i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zB,CAAsCC,IAAtC,CADY;AAAA,aADW;AAGzBG,YAAAA,SAAS,EAAEzB,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAE0B;AAHO,WAA3B;AAKD;AACF,OAbH;AAcET,MAAAA,aAAa,EAAbA,aAdF;AAeE,oBAAcjB,KAAK,CAAC0B;AAftB;AAiBD,GApB+D;AAqBhEC,EAAAA,SArBgE,qBAqBtDA,UArBsD,EAqB3C5B,QArB2C,EAqBjC;AAC7B,QAAM6B,WAAW,GAAGC,OAAO,CAAC;AAAA,aAAM/B,iBAAiB,CAACC,QAAD,CAAvB;AAAA,KAAD,EAAoC,EAApC,CAA3B;AACA,QAAM+B,IAAI,GAAGD,OAAO,CAAC;AAAA,aAAMzB,iBAAiB,CAACuB,UAAS,CAACI,IAAX,CAAvB;AAAA,KAAD,EAAoD,EAApD,CAApB;AAEA,2CACKJ,UADL;AAEEK,MAAAA,WAAW,EAAEJ,WAFf;AAGEG,MAAAA,IAAI,EAAED;AAHR;AAKD;AA9B+D,CAAd;AAiCpDjB,gBAAgB,CAACoB,KAAjB,GAAyB,CAAzB;;;;"}
1
+ {"version":3,"file":"TreeRovingPlugin.js","sources":["../../../../../src/deprecated/plugins/roving/TreeRovingPlugin.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\n/* eslint-disable react-hooks/rules-of-hooks */\nimport React, { useMemo, useRef, useState } from 'react';\nimport FocusGroupProvider from '@elliemae/ds-shared/FocusGroup/FocusGroupManager';\nimport useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\n\n// eslint-disable-next-line react/display-name\nconst TreeListRovingHoc = (instance) => (props) => {\n const { hotKeys } = instance.getInstance();\n return (\n <FocusGroupProvider hotKeys={hotKeys}>{props.children}</FocusGroupProvider>\n );\n};\n\n// eslint-disable-next-line react/display-name\nconst TreeItemRovingHoc = (Component) => ({\n innerRef,\n onFocus,\n onBlur,\n ...props\n}) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const ref = useRef(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusGroupItem(ref, {\n onFocus,\n onBlur,\n });\n return <Component {...props} innerRef={mergeRefs(ref, innerRef)} />;\n};\n\nexport const TreeRovingPlugin = createInstancePlugin('tree-data', {\n getItemProps(props, instance) {\n const [isItemFocused, setIsItemFocused] = useState(false);\n return {\n ...props,\n onBlur: () => setIsItemFocused(false),\n // eslint-disable-next-line no-unused-vars\n onFocus: (e) => {\n setIsItemFocused(true);\n if (instance?.props?.onItemFocus) {\n instance.props.onItemFocus({\n scrollToItem: (...args) =>\n props?.listRef?.current?.scrollToItem(args),\n itemIndex: props?.index,\n });\n }\n },\n isItemFocused,\n 'data-index': props.index,\n };\n },\n renderers(renderers, instance) {\n const ListWrapper = useMemo(() => TreeListRovingHoc(instance), []);\n const Item = useMemo(() => TreeItemRovingHoc(renderers.item, instance), []);\n\n return {\n ...renderers,\n listWrapper: ListWrapper,\n item: Item,\n };\n },\n});\n\nTreeRovingPlugin.order = 0;\n"],"names":["TreeListRovingHoc","instance","props","getInstance","hotKeys","children","TreeItemRovingHoc","Component","innerRef","onFocus","onBlur","ref","useRef","useFocusGroupItem","mergeRefs","TreeRovingPlugin","createInstancePlugin","getItemProps","useState","isItemFocused","setIsItemFocused","e","onItemFocus","scrollToItem","args","listRef","current","itemIndex","index","renderers","ListWrapper","useMemo","Item","item","listWrapper","order"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD;EAAA,OAAc,UAACC,KAAD,EAAW;IACjD,4BAAoBD,QAAQ,CAACE,WAAT,EAApB;QAAQC,OAAR,yBAAQA,OAAR;;IACA,oBACE,oBAAC,kBAAD;MAAoB,OAAO,EAAEA;OAAUF,KAAK,CAACG,QAA7C,CADF;GAFwB;AAAA,CAA1B;;;AAQA,IAA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jB,KAAK,CAAC0B;;GAlBwC;EAqBhEC,SArBgE,qBAqBtDA,UArBsD,EAqB3C5B,QArB2C,EAqBjC;IAC7B,IAAM6B,WAAW,GAAGC,OAAO,CAAC;MAAA,OAAM/B,iBAAiB,CAACC,QAAD,CAAvB;KAAD,EAAoC,EAApC,CAA3B;IACA,IAAM+B,IAAI,GAAGD,OAAO,CAAC;MAAA,OAAMzB,iBAAiB,CAACuB,UAAS,CAACI,IAAX,CAAvB;KAAD,EAAoD,EAApD,CAApB;IAEA,uCACKJ,UADL;MAEEK,WAAW,EAAEJ,WAFf;MAGEG,IAAI,EAAED;;;AA5BsD,CAAd;AAiCpDjB,gBAAgB,CAACoB,KAAjB,GAAyB,CAAzB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchableTreePlugin.js","sources":["../../../../../src/deprecated/plugins/searchable/SearchableTreePlugin.tsx"],"sourcesContent":["import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport Highlighter from 'react-highlight-words';\nimport React from 'react';\nimport { usePrevious } from '@elliemae/ds-utilities';\n\nconst markParentsAsChildMatch = (record) => {\n let currRecord = record;\n\n while (currRecord.parentNode) {\n currRecord.parentNode.childMatch = true;\n currRecord = currRecord.parentNode;\n }\n};\n\nfunction transformRecords(records, instance) {\n // gets the ul with overflow: auto\n const list = instance.getListRef()?.current?.parentElement;\n const {\n props: { searchQuery },\n } = instance.getInstance();\n if (!searchQuery) return records;\n // Scroll the list to the top once the search is triggered\n list?.scrollTo(0, 0);\n return records.filter((record) => record.selfMatch || record.childMatch);\n}\ntransformRecords.order = 0;\n\nfunction transformRecord(record, instance) {\n const {\n props: { searchQuery },\n getItemLabel,\n } = instance.getInstance();\n if (\n searchQuery &&\n getItemLabel(record).toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1\n ) {\n markParentsAsChildMatch(record);\n // eslint-disable-next-line no-param-reassign\n record.selfMatch = true;\n }\n return record;\n}\ntransformRecord.order = 0;\n\nconst itemRenderer = (value, itemProps, instance) => {\n const {\n props: { searchQuery, showHighlight = true },\n } = instance.getInstance();\n if (!showHighlight || !searchQuery) return value;\n return (\n <Highlighter\n autoEscape\n highlightClassName=\"tree-text-highlight\"\n searchWords={[searchQuery]}\n textToHighlight={value}\n />\n );\n};\nitemRenderer.order = 0;\n\nexport const SearchableTreePlugin = createInstancePlugin('searchable-tree', {\n instance: (instance) => {\n const {\n props: { searchQuery },\n } = instance;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const prevSearchQuery = usePrevious(searchQuery);\n return {\n prevSearchQuery,\n };\n },\n shouldWalkChildren: (record, instance) => {\n const {\n props: { searchQuery },\n } = instance.getInstance();\n return !!searchQuery;\n },\n record: transformRecord,\n records: transformRecords,\n itemRenderer,\n});\n"],"names":["markParentsAsChildMatch","record","currRecord","parentNode","childMatch","transformRecords","records","instance","list","getListRef","current","parentElement","getInstance","searchQuery","props","scrollTo","filter","selfMatch","order","transformRecord","getItemLabel","toLowerCase","indexOf","itemRenderer","value","itemProps","showHighlight","SearchableTreePlugin","createInstancePlugin","prevSearchQuery","usePrevious","shouldWalkChildren"],"mappings":";;;;;AAKA,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CAACC,MAAD,EAAY;AAC1C,MAAIC,UAAU,GAAGD,MAAjB;;AAEA,SAAOC,UAAU,CAACC,UAAlB,EAA8B;AAC5BD,IAAAA,UAAU,CAACC,UAAX,CAAsBC,UAAtB,GAAmC,IAAnC;AACAF,IAAAA,UAAU,GAAGA,UAAU,CAACC,UAAxB;AACD;AACF,CAPD;;AASA,SAASE,gBAAT,CAA0BC,OAA1B,EAAmCC,QAAnC,EAA6C;AAAA;;AAC3C;AACA,MAAMC,IAAI,2BAAGD,QAAQ,CAACE,UAAT,EAAH,kFAAG,qBAAuBC,OAA1B,0DAAG,sBAAgCC,aAA7C;;AACA,8BAEIJ,QAAQ,CAACK,WAAT,EAFJ;AAAA,MACWC,WADX,yBACEC,KADF,CACWD,WADX;;AAGA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;AAIE,IAAA,eAAe,EAAEW;AAJnB,IADF;AAQD,CAbD;;AAcAD,YAAY,CAACL,KAAb,GAAqB,CAArB;IAEaS,oBAAoB,GAAGC,oBAAoB,CAAC,iBAAD,EAAoB;AAC1ErB,EAAAA,QAAQ,EAAE,kBAACA,SAAD,EAAc;AACtB,QACWM,WADX,GAEIN,SAFJ,CACEO,KADF,CACWD,WADX,CADsB;;AAKtB,QAAMgB,eAAe,GAAGC,WAAW,CAACjB,WAAD,CAAnC;AACA,WAAO;AACLgB,MAAAA,eAAe,EAAfA;AADK,KAAP;AAGD,GAVyE;AAW1EE,EAAAA,kBAAkB,EAAE,4BAAC9B,MAAD,EAASM,QAAT,EAAsB;AACxC,iCAEIA,QAAQ,CAACK,WAAT,EAFJ;AAAA,QACWC,WADX,0BACEC,KADF,CACWD,WADX;;AAGA,WAAO,CAAC,CAACA,WAAT;AACD,GAhByE;AAiB1EZ,EAAAA,MAAM,EAAEkB,eAjBkE;AAkB1Eb,EAAAA,OAAO,EAAED,gBAlBiE;AAmB1EkB,EAAAA,YAAY,EAAZA;AAnB0E,CAApB;;;;"}
1
+ {"version":3,"file":"SearchableTreePlugin.js","sources":["../../../../../src/deprecated/plugins/searchable/SearchableTreePlugin.tsx"],"sourcesContent":["import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport Highlighter from 'react-highlight-words';\nimport React from 'react';\nimport { usePrevious } from '@elliemae/ds-utilities';\n\nconst markParentsAsChildMatch = (record) => {\n let currRecord = record;\n\n while (currRecord.parentNode) {\n currRecord.parentNode.childMatch = true;\n currRecord = currRecord.parentNode;\n }\n};\n\nfunction transformRecords(records, instance) {\n // gets the ul with overflow: auto\n const list = instance.getListRef()?.current?.parentElement;\n const {\n props: { searchQuery },\n } = instance.getInstance();\n if (!searchQuery) return records;\n // Scroll the list to the top once the search is triggered\n list?.scrollTo(0, 0);\n return records.filter((record) => record.selfMatch || record.childMatch);\n}\ntransformRecords.order = 0;\n\nfunction transformRecord(record, instance) {\n const {\n props: { searchQuery },\n getItemLabel,\n } = instance.getInstance();\n if (\n searchQuery &&\n getItemLabel(record).toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1\n ) {\n markParentsAsChildMatch(record);\n // eslint-disable-next-line no-param-reassign\n record.selfMatch = true;\n }\n return record;\n}\ntransformRecord.order = 0;\n\nconst itemRenderer = (value, itemProps, instance) => {\n const {\n props: { searchQuery, showHighlight = true },\n } = instance.getInstance();\n if (!showHighlight || !searchQuery) return value;\n return (\n <Highlighter\n autoEscape\n highlightClassName=\"tree-text-highlight\"\n searchWords={[searchQuery]}\n textToHighlight={value}\n />\n );\n};\nitemRenderer.order = 0;\n\nexport const SearchableTreePlugin = createInstancePlugin('searchable-tree', {\n instance: (instance) => {\n const {\n props: { searchQuery },\n } = instance;\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const prevSearchQuery = usePrevious(searchQuery);\n return {\n prevSearchQuery,\n };\n },\n shouldWalkChildren: (record, instance) => {\n const {\n props: { searchQuery },\n } = instance.getInstance();\n return !!searchQuery;\n },\n record: transformRecord,\n records: transformRecords,\n itemRenderer,\n});\n"],"names":["markParentsAsChildMatch","record","currRecord","parentNode","childMatch","transformRecords","records","instance","list","getListRef","current","parentElement","getInstance","searchQuery","props","scrollTo","filter","selfMatch","order","transformRecord","getItemLabel","toLowerCase","indexOf","itemRenderer","value","itemProps","showHighlight","SearchableTreePlugin","createInstancePlugin","prevSearchQuery","usePrevious","shouldWalkChildren"],"mappings":";;;;;AAKA,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CAACC,MAAD,EAAY;EAC1C,IAAIC,UAAU,GAAGD,MAAjB;;EAEA,OAAOC,UAAU,CAACC,UAAlB,EAA8B;IAC5BD,UAAU,CAACC,UAAX,CAAsBC,UAAtB,GAAmC,IAAnC;IACAF,UAAU,GAAGA,UAAU,CAACC,UAAxB;;AAEH,CAPD;;AASA,SAASE,gBAAT,CAA0BC,OAA1B,EAAmCC,QAAnC,EAA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KAAP;EACpC,oBACE,oBAAC,WAAD;IACE,UAAU,MADZ;IAEE,kBAAkB,EAAC,qBAFrB;IAGE,WAAW,EAAE,CAACX,WAAD,CAHf;IAIE,eAAe,EAAEW;IALrB;AAQD,CAbD;;AAcAD,YAAY,CAACL,KAAb,GAAqB,CAArB;IAEaS,oBAAoB,GAAGC,oBAAoB,CAAC,iBAAD,EAAoB;EAC1ErB,QAAQ,EAAE,kBAACA,SAAD,EAAc;IACtB,IACWM,WADX,GAEIN,SAFJ,CACEO,KADF,CACWD,WADX,CADsB;;IAKtB,IAAMgB,eAAe,GAAGC,WAAW,CAACjB,WAAD,CAAnC;IACA,OAAO;MACLgB,eAAe,EAAfA;KADF;GAPwE;EAW1EE,kBAAkB,EAAE,4BAAC9B,MAAD,EAASM,QAAT,EAAsB;IACxC,6BAEIA,QAAQ,CAACK,WAAT,EAFJ;QACWC,WADX,0BACEC,KADF,CACWD,WADX;;IAGA,OAAO,CAAC,CAACA,WAAT;GAfwE;EAiB1EZ,MAAM,EAAEkB,eAjBkE;EAkB1Eb,OAAO,EAAED,gBAlBiE;EAmB1EkB,YAAY,EAAZA;AAnB0E,CAApB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectablePluginTree.js","sources":["../../../../../src/deprecated/plugins/selectable/SelectablePluginTree.tsx"],"sourcesContent":["/* eslint no-param-reassign: [2, { \"props\": false }] */\n/* eslint max-lines: [\"error\", 300] */\nimport React, { useCallback, useMemo } from 'react';\nimport { DSCheckbox, DSRadio } from '@elliemae/ds-form';\nimport { cx, isFunction, useDerivedStateFromProps } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport { walkTreeStrategy } from '../tree/walkTreeStrategy';\nimport { getParentChildren, getParentId } from '../tree/utils';\nimport { checkParentState } from './utils';\n\nconst updateParentState = ({ node, checked, selectionState, isCurrentParentChildren = true }) => {\n const { parentNode } = node;\n\n if (parentNode) {\n let nextSelectedChildrenAmount;\n // increase or decrease the amount\n if (checked === true && isCurrentParentChildren) nextSelectedChildrenAmount = parentNode.selectedChildren.length;\n if (checked === true && !isCurrentParentChildren)\n nextSelectedChildrenAmount = parentNode.selectedChildren.length + 1;\n if (checked === false) nextSelectedChildrenAmount = parentNode.selectedChildren.length - 1;\n\n const parentChildren = getParentChildren(node);\n const parentChildrenLength = parentChildren && parentChildren.length;\n\n // check parent state\n const parentState = checkParentState(nextSelectedChildrenAmount, parentChildrenLength, checked);\n\n selectionState[parentNode.id || 'all'] = parentState;\n\n updateParentState({\n node: parentNode,\n checked: parentState,\n selectionState,\n isCurrentParentChildren: false,\n });\n }\n};\n\nconst useSelectableTreeState = (instance) => {\n const {\n originalData,\n idKey = 'id',\n props: {\n onSelect = () => null,\n selection: selectionProp = {},\n onSelectionChange = () => null,\n isMultiSelect = false,\n isSingleSelect = false,\n },\n } = instance;\n const [selection, setSelection] = useDerivedStateFromProps(selectionProp);\n\n const isAllSelected = useMemo(() => {\n if (!isMultiSelect) return false;\n const amountSelected = originalData.reduce(\n (result, item) => (selection[item[idKey]] === true ? result + 1 : result),\n 0,\n );\n\n if (amountSelected === originalData.length) {\n return true;\n }\n if (amountSelected === 0) {\n return false;\n }\n return 'mixed';\n }, [selection]);\n\n const select = useCallback((record, additionalActions = {}) => {\n if (isFunction(onSelect)) {\n onSelect(record.data, {\n scrollToItem: (...args) => {\n if (additionalActions.scrollToItem) additionalActions.scrollToItem(args);\n },\n itemIndex: additionalActions?.itemIndex,\n });\n }\n setSelection((prevSelection) => {\n const nextSelectionState = isMultiSelect ? { ...prevSelection } : {};\n const nextState = isMultiSelect ? !prevSelection[record.id] : {};\n\n nextSelectionState[record.id] = nextState;\n\n if (isMultiSelect || isSingleSelect) {\n // if node group then select all its leafs\n if (record.isGroup && isMultiSelect) {\n if (record.parentNode && nextState) record.parentNode.selectedChildren.push(record.id);\n if (!nextState) record.selectedChildren = [];\n // get all children\n walkTreeStrategy({\n data: record.data.children,\n parentNode: record,\n cb: (node) => {\n const parentId = getParentId(node);\n // if direct child and truthy next state\n if (nextState && parentId === record.id) {\n record.selectedChildren.push(node.id);\n }\n nextSelectionState[node.id] = nextState;\n },\n });\n }\n // mutates the cloned selection state\n updateParentState({\n node: record,\n checked: nextState,\n selectionState: nextSelectionState,\n });\n }\n\n onSelectionChange(nextSelectionState, record.data, {\n scrollToItem: (...args) => {\n if (additionalActions.scrollToItem) additionalActions.scrollToItem(args);\n },\n itemIndex: additionalActions?.itemIndex,\n });\n return nextSelectionState;\n });\n }, []);\n\n return {\n state: { selection, isAllSelected },\n actions: { select },\n };\n};\n\nconst updateParentInternalState = (record, checked) => {\n const { parentNode } = record;\n if (!parentNode) return;\n\n // if next state is checked\n if (checked === true) {\n parentNode.selectedChildren.push(record.id);\n } else {\n parentNode.selectedChildren = parentNode.selectedChildren.filter((id) => id !== record.id);\n }\n};\n\nconst SelectionFormatter = (value, { record }, instance) => {\n const {\n actions: { select },\n props: { isMultiSelect },\n } = instance.getInstance();\n const handleSelect = () => select(record);\n\n return (\n <>\n {isMultiSelect && (\n <DSCheckbox\n checked={record.checked}\n className=\"tree-item-checkbox\"\n data-testid=\"tree-item-checkbox\"\n onChange={handleSelect}\n tabIndex={-1}\n />\n )}\n {value}\n </>\n );\n};\nSelectionFormatter.order = 300;\n\nexport const SelectablePluginTree = createInstancePlugin('selectable', {\n state: useSelectableTreeState,\n // itemRenderer: SelectionFormatter,\n record: (record, instance) => {\n const {\n state: { selection },\n props: { isMultiSelect, isSingleSelect },\n } = instance.getInstance();\n\n record.checked = selection[record.id];\n\n if (isMultiSelect || isSingleSelect) {\n // if it's the root of the tree declare the selectedChildren array\n if (!record.parentNode.id && record.parentNode.selectedChildren === undefined) {\n record.parentNode.selectedChildren = [];\n }\n if (record.isGroup && record.selectedChildren === undefined) {\n record.selectedChildren = [];\n }\n updateParentInternalState(record, record.checked);\n }\n\n return record;\n },\n getItemProps(props, instance, { record }) {\n const {\n actions: { select },\n props: { isMultiSelect, isSingleSelect, disableLeafs, disableGroups },\n } = instance.getInstance();\n const handleSelect = () =>\n select(record, {\n scrollToItem: (...args) => props?.listRef?.current?.scrollToItem(args),\n itemIndex: props?.index,\n });\n const checkboxAddon = isMultiSelect && (\n <DSCheckbox\n checked={record.checked}\n disabled={record.isGroup ? disableGroups : disableLeafs}\n className=\"tree-item-checkbox\"\n data-testid=\"tree-item-checkbox\"\n onChange={handleSelect}\n tabIndex={-1}\n />\n );\n\n const radioAddon = isSingleSelect && !isMultiSelect && (\n <DSRadio\n checked={!!record.checked}\n disabled={record.isGroup ? disableGroups : disableLeafs}\n className=\"tree-item-radio\"\n data-testid=\"tree-item-radio\"\n onChange={handleSelect}\n tabIndex={-1}\n />\n );\n\n if (isMultiSelect || isSingleSelect) {\n return {\n ...props,\n leftAddons: [checkboxAddon, radioAddon, ...(props.leftAddons || [])],\n 'aria-selected': !!record.checked,\n };\n }\n\n return {\n ...props,\n onClick: handleSelect,\n className: cx(props.className, record.checked && 'selected'),\n 'aria-selected': !!record.checked,\n };\n },\n\n hotKeys(grid) {\n return {\n key: 'space',\n handler: ({ index }) => {\n const {\n records,\n actions: { select },\n } = grid.getInstance();\n select(records[index]);\n },\n };\n },\n});\n"],"names":["updateParentState","node","checked","selectionState","isCurrentParentChildren","parentNode","nextSelectedChildrenAmount","selectedChildren","length","parentChildren","getParentChildren","parentChildrenLength","parentState","checkParentState","id","useSelectableTreeState","instance","originalData","idKey","props","onSelect","selection","selectionProp","onSelectionChange","isMultiSelect","isSingleSelect","useDerivedStateFromProps","setSelection","isAllSelected","useMemo","amountSelected","reduce","result","item","select","useCallback","record","additionalActions","isFunction","data","scrollToItem","args","itemIndex","prevSelection","nextSelectionState","nextState","isGroup","push","walkTreeStrategy","children","cb","parentId","getParentId","state","actions","updateParentInternalState","filter","SelectablePluginTree","createInstancePlugin","getInstance","undefined","getItemProps","disableLeafs","disableGroups","handleSelect","listRef","current","index","checkboxAddon","radioAddon","leftAddons","onClick","className","cx","hotKeys","grid","key","handler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AAC,iBAHZ;AAIE,qBAAY,iBAJd;AAKE,MAAA,QAAQ,EAAEE,YALZ;AAME,MAAA,QAAQ,EAAE,CAAC;AANb,MADF;;AAWA,QAAIxC,aAAa,IAAIC,cAArB,EAAqC;AACnC,6CACKN,KADL;AAEEmD,QAAAA,UAAU,GAAGF,aAAH,EAAkBC,UAAlB,4BAAkClD,KAAK,CAACmD,UAAN,IAAoB,EAAtD,EAFZ;AAGE,yBAAiB,CAAC,CAAClC,MAAM,CAAClC;AAH5B;AAKD;;AAED,2CACKiB,KADL;AAEEoD,MAAAA,OAAO,EAAEP,YAFX;AAGEQ,MAAAA,SAAS,EAAEC,EAAE,CAACtD,KAAK,CAACqD,SAAP,EAAkBpC,MAAM,CAAClC,OAAP,IAAkB,UAApC,CAHf;AAIE,uBAAiB,CAAC,CAACkC,MAAM,CAAClC;AAJ5B;AAMD,GAtEoE;AAwErEwE,EAAAA,OAxEqE,mBAwE7DC,IAxE6D,EAwEvD;AACZ,WAAO;AACLC,MAAAA,GAAG,EAAE,OADA;AAELC,MAAAA,OAAO,EAAE,wBAAe;AAAA,YAAZV,KAAY,SAAZA,KAAY;;AACtB,gCAGIQ,IAAI,CAAChB,WAAL,EAHJ;AAAA,YACEmB,OADF,qBACEA,OADF;AAAA,YAEa5C,MAFb,qBAEEoB,OAFF,CAEapB,MAFb;;AAIAA,QAAAA,MAAM,CAAC4C,OAAO,CAACX,KAAD,CAAR,CAAN;AACD;AARI,KAAP;AAUD;AAnFoE,CAAf;;;;"}
1
+ {"version":3,"file":"SelectablePluginTree.js","sources":["../../../../../src/deprecated/plugins/selectable/SelectablePluginTree.tsx"],"sourcesContent":["/* eslint no-param-reassign: [2, { \"props\": false }] */\n/* eslint max-lines: [\"error\", 300] */\nimport React, { useCallback, useMemo } from 'react';\nimport { DSCheckbox, DSRadio } from '@elliemae/ds-form';\nimport { cx, isFunction, useDerivedStateFromProps } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport { walkTreeStrategy } from '../tree/walkTreeStrategy';\nimport { getParentChildren, getParentId } from '../tree/utils';\nimport { checkParentState } from './utils';\n\nconst updateParentState = ({ node, checked, selectionState, isCurrentParentChildren = true }) => {\n const { parentNode } = node;\n\n if (parentNode) {\n let nextSelectedChildrenAmount;\n // increase or decrease the amount\n if (checked === true && isCurrentParentChildren) nextSelectedChildrenAmount = parentNode.selectedChildren.length;\n if (checked === true && !isCurrentParentChildren)\n nextSelectedChildrenAmount = parentNode.selectedChildren.length + 1;\n if (checked === false) nextSelectedChildrenAmount = parentNode.selectedChildren.length - 1;\n\n const parentChildren = getParentChildren(node);\n const parentChildrenLength = parentChildren && parentChildren.length;\n\n // check parent state\n const parentState = checkParentState(nextSelectedChildrenAmount, parentChildrenLength, checked);\n\n selectionState[parentNode.id || 'all'] = parentState;\n\n updateParentState({\n node: parentNode,\n checked: parentState,\n selectionState,\n isCurrentParentChildren: false,\n });\n }\n};\n\nconst useSelectableTreeState = (instance) => {\n const {\n originalData,\n idKey = 'id',\n props: {\n onSelect = () => null,\n selection: selectionProp = {},\n onSelectionChange = () => null,\n isMultiSelect = false,\n isSingleSelect = false,\n },\n } = instance;\n const [selection, setSelection] = useDerivedStateFromProps(selectionProp);\n\n const isAllSelected = useMemo(() => {\n if (!isMultiSelect) return false;\n const amountSelected = originalData.reduce(\n (result, item) => (selection[item[idKey]] === true ? result + 1 : result),\n 0,\n );\n\n if (amountSelected === originalData.length) {\n return true;\n }\n if (amountSelected === 0) {\n return false;\n }\n return 'mixed';\n }, [selection]);\n\n const select = useCallback((record, additionalActions = {}) => {\n if (isFunction(onSelect)) {\n onSelect(record.data, {\n scrollToItem: (...args) => {\n if (additionalActions.scrollToItem) additionalActions.scrollToItem(args);\n },\n itemIndex: additionalActions?.itemIndex,\n });\n }\n setSelection((prevSelection) => {\n const nextSelectionState = isMultiSelect ? { ...prevSelection } : {};\n const nextState = isMultiSelect ? !prevSelection[record.id] : {};\n\n nextSelectionState[record.id] = nextState;\n\n if (isMultiSelect || isSingleSelect) {\n // if node group then select all its leafs\n if (record.isGroup && isMultiSelect) {\n if (record.parentNode && nextState) record.parentNode.selectedChildren.push(record.id);\n if (!nextState) record.selectedChildren = [];\n // get all children\n walkTreeStrategy({\n data: record.data.children,\n parentNode: record,\n cb: (node) => {\n const parentId = getParentId(node);\n // if direct child and truthy next state\n if (nextState && parentId === record.id) {\n record.selectedChildren.push(node.id);\n }\n nextSelectionState[node.id] = nextState;\n },\n });\n }\n // mutates the cloned selection state\n updateParentState({\n node: record,\n checked: nextState,\n selectionState: nextSelectionState,\n });\n }\n\n onSelectionChange(nextSelectionState, record.data, {\n scrollToItem: (...args) => {\n if (additionalActions.scrollToItem) additionalActions.scrollToItem(args);\n },\n itemIndex: additionalActions?.itemIndex,\n });\n return nextSelectionState;\n });\n }, []);\n\n return {\n state: { selection, isAllSelected },\n actions: { select },\n };\n};\n\nconst updateParentInternalState = (record, checked) => {\n const { parentNode } = record;\n if (!parentNode) return;\n\n // if next state is checked\n if (checked === true) {\n parentNode.selectedChildren.push(record.id);\n } else {\n parentNode.selectedChildren = parentNode.selectedChildren.filter((id) => id !== record.id);\n }\n};\n\nconst SelectionFormatter = (value, { record }, instance) => {\n const {\n actions: { select },\n props: { isMultiSelect },\n } = instance.getInstance();\n const handleSelect = () => select(record);\n\n return (\n <>\n {isMultiSelect && (\n <DSCheckbox\n checked={record.checked}\n className=\"tree-item-checkbox\"\n data-testid=\"tree-item-checkbox\"\n onChange={handleSelect}\n tabIndex={-1}\n />\n )}\n {value}\n </>\n );\n};\nSelectionFormatter.order = 300;\n\nexport const SelectablePluginTree = createInstancePlugin('selectable', {\n state: useSelectableTreeState,\n // itemRenderer: SelectionFormatter,\n record: (record, instance) => {\n const {\n state: { selection },\n props: { isMultiSelect, isSingleSelect },\n } = instance.getInstance();\n\n record.checked = selection[record.id];\n\n if (isMultiSelect || isSingleSelect) {\n // if it's the root of the tree declare the selectedChildren array\n if (!record.parentNode.id && record.parentNode.selectedChildren === undefined) {\n record.parentNode.selectedChildren = [];\n }\n if (record.isGroup && record.selectedChildren === undefined) {\n record.selectedChildren = [];\n }\n updateParentInternalState(record, record.checked);\n }\n\n return record;\n },\n getItemProps(props, instance, { record }) {\n const {\n actions: { select },\n props: { isMultiSelect, isSingleSelect, disableLeafs, disableGroups },\n } = instance.getInstance();\n const handleSelect = () =>\n select(record, {\n scrollToItem: (...args) => props?.listRef?.current?.scrollToItem(args),\n itemIndex: props?.index,\n });\n const checkboxAddon = isMultiSelect && (\n <DSCheckbox\n checked={record.checked}\n disabled={record.isGroup ? disableGroups : disableLeafs}\n className=\"tree-item-checkbox\"\n data-testid=\"tree-item-checkbox\"\n onChange={handleSelect}\n tabIndex={-1}\n />\n );\n\n const radioAddon = isSingleSelect && !isMultiSelect && (\n <DSRadio\n checked={!!record.checked}\n disabled={record.isGroup ? disableGroups : disableLeafs}\n className=\"tree-item-radio\"\n data-testid=\"tree-item-radio\"\n onChange={handleSelect}\n tabIndex={-1}\n />\n );\n\n if (isMultiSelect || isSingleSelect) {\n return {\n ...props,\n leftAddons: [checkboxAddon, radioAddon, ...(props.leftAddons || [])],\n 'aria-selected': !!record.checked,\n };\n }\n\n return {\n ...props,\n onClick: handleSelect,\n className: cx(props.className, record.checked && 'selected'),\n 'aria-selected': !!record.checked,\n };\n },\n\n hotKeys(grid) {\n return {\n key: 'space',\n handler: ({ index }) => {\n const {\n records,\n actions: { select },\n } = grid.getInstance();\n select(records[index]);\n },\n };\n },\n});\n"],"names":["updateParentState","node","checked","selectionState","isCurrentParentChildren","parentNode","nextSelectedChildrenAmount","selectedChildren","length","parentChildren","getParentChildren","parentChildrenLength","parentState","checkParentState","id","useSelectableTreeState","instance","originalData","idKey","props","onSelect","selection","selectionProp","onSelectionChange","isMultiSelect","isSingleSelect","useDerivedStateFromProps","setSelection","isAllSelected","useMemo","amountSelected","reduce","result","item","select","useCallback","record","additionalActions","isFunction","data","scrollToItem","args","itemIndex","prevSelection","nextSelectionState","nextState","isGroup","push","walkTreeStrategy","children","cb","parentId","getParentId","state","actions","updateParentInternalState","filter","SelectablePluginTree","createInstancePlugin","getInstance","undefined","getItemProps","disableLeafs","disableGroups","handleSelect","listRef","current","index","checkboxAddon","radioAddon","leftAddons","onClick","className","cx","hotKeys","grid","key","handler","records"],"mappings":";;;;;;;;;;;;;;;;AAUA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,OAAuE;EAAA,IAApEC,IAAoE,QAApEA,IAAoE;MAA9DC,OAA8D,QAA9DA,OAA8D;MAArDC,cAAqD,QAArDA,cAAqD;mCAArCC,uBAAqC;MAArCA,uBAAqC,sCAAX,IAAW;EAC/F,IAAQC,UAAR,GAAuBJ,IAAvB,CAAQI,UAAR;;EAEA,IAAIA,UAAJ,EAAgB;IACd,IAAIC,0BAAJ,CADc;;IAGd,IAAIJ,OAAO,KAAK,IAAZ,IAAoBE,uBAAxB,EAAiDE,0BAA0B,GAAGD,UAAU,CAACE,gBAAX,CAA4BC,MAAzD;IACjD,IAAIN,OAAO,KAAK,IAAZ,IAAoB,CAACE,uBAAzB,EACEE,0BAA0B,GAAGD,UAAU,CAACE,gBAAX,CAA4BC,MAA5B,GAAqC,CAAlE;IACF,IAAIN,OAAO,KAAK,KAAhB,EAAuBI,0BAA0B,GAAGD,UAAU,CAACE,gBAAX,CAA4BC,MAA5B,GAAqC,CAAlE;IAEvB,IAAMC,cAAc,GAAGC,iBAAiB,CAACT,IAAD,CAAxC;IACA,IAAMU,oBAAoB,GAAGF,cAAc,IAAIA,cAAc,CAACD,MAA9D,CATc;;IAYd,IAAMI,WAAW,GAAGC,gBAAgB,CAACP,0BAAD,EAA6BK,oBAA7B,EAAmDT,OAAnD,CAApC;IAEAC,cAAc,CAACE,UAAU,CAACS,EAAX,IAAiB,KAAlB,CAAd,GAAyCF,WAAzC;IAEAZ,iBAAiB,CAAC;MAChBC,IAAI,EAAEI,UADU;MAEhBH,OAAO,EAAEU,WAFO;MAGhBT,cAA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C,GAAG,EAAE,OADA;MAELC,OAAO,EAAE,wBAAe;QAAA,IAAZV,KAAY,SAAZA,KAAY;;QACtB,wBAGIQ,IAAI,CAAChB,WAAL,EAHJ;YACEmB,OADF,qBACEA,OADF;YAEa5C,MAFb,qBAEEoB,OAFF,CAEapB,MAFb;;QAIAA,MAAM,CAAC4C,OAAO,CAACX,KAAD,CAAR,CAAN;;KAPJ;;AAzEmE,CAAf;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/deprecated/plugins/selectable/utils.tsx"],"sourcesContent":["export const checkParentState = (\n nextSelectedChildrenAmount,\n parentChildrenLength,\n checked,\n) => {\n let parentState = false;\n if (nextSelectedChildrenAmount === parentChildrenLength) {\n parentState = true;\n } else if (\n nextSelectedChildrenAmount > 0 &&\n nextSelectedChildrenAmount < parentChildrenLength\n ) {\n parentState = 'mixed';\n } else if (parentChildrenLength && checked === 'mixed') {\n parentState = 'mixed';\n }\n\n return parentState;\n};\n"],"names":["checkParentState","nextSelectedChildrenAmount","parentChildrenLength","checked","parentState"],"mappings":"IAAaA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAC9BC,0BAD8B,EAE9BC,oBAF8B,EAG9BC,OAH8B,EAI3B;AACH,MAAIC,WAAW,GAAG,KAAlB;;AACA,MAAIH,0BAA0B,KAAKC,oBAAnC,EAAyD;AACvDE,IAAAA,WAAW,GAAG,IAAd;AACD,GAFD,MAEO,IACLH,0BAA0B,GAAG,CAA7B,IACAA,0BAA0B,GAAGC,oBAFxB,EAGL;AACAE,IAAAA,WAAW,GAAG,OAAd;AACD,GALM,MAKA,IAAIF,oBAAoB,IAAIC,OAAO,KAAK,OAAxC,EAAiD;AACtDC,IAAAA,WAAW,GAAG,OAAd;AACD;;AAED,SAAOA,WAAP;AACD;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/deprecated/plugins/selectable/utils.tsx"],"sourcesContent":["export const checkParentState = (\n nextSelectedChildrenAmount,\n parentChildrenLength,\n checked,\n) => {\n let parentState = false;\n if (nextSelectedChildrenAmount === parentChildrenLength) {\n parentState = true;\n } else if (\n nextSelectedChildrenAmount > 0 &&\n nextSelectedChildrenAmount < parentChildrenLength\n ) {\n parentState = 'mixed';\n } else if (parentChildrenLength && checked === 'mixed') {\n parentState = 'mixed';\n }\n\n return parentState;\n};\n"],"names":["checkParentState","nextSelectedChildrenAmount","parentChildrenLength","checked","parentState"],"mappings":"IAAaA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAC9BC,0BAD8B,EAE9BC,oBAF8B,EAG9BC,OAH8B,EAI3B;EACH,IAAIC,WAAW,GAAG,KAAlB;;EACA,IAAIH,0BAA0B,KAAKC,oBAAnC,EAAyD;IACvDE,WAAW,GAAG,IAAd;GADF,MAEO,IACLH,0BAA0B,GAAG,CAA7B,IACAA,0BAA0B,GAAGC,oBAFxB,EAGL;IACAE,WAAW,GAAG,OAAd;GAJK,MAKA,IAAIF,oBAAoB,IAAIC,OAAO,KAAK,OAAxC,EAAiD;IACtDC,WAAW,GAAG,OAAd;;;EAGF,OAAOA,WAAP;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeToolbarPlugin.js","sources":["../../../../../src/deprecated/plugins/toolbar/TreeToolbarPlugin.tsx"],"sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\n/* eslint-disable react/prop-types */\nimport React, { useContext, useMemo, useRef } from 'react';\nimport { MoreOptionsVert } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport { runAll } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport ToolbarProvider, { ToolbarContext } from '@elliemae/ds-shared/toolbar/ToolbarProvider';\nimport FocusGroupContext from '@elliemae/ds-shared/FocusGroup/FocusGroupContext';\n\nconst ToolbarDisclosure = (props) => {\n const {\n onMouseEnter,\n onMouseLeave,\n extraParams,\n renderToolbar,\n isItemFocused,\n icon = <MoreOptionsVert color={['brand-primary', 800]} />,\n rowSize,\n ...rest\n } = props;\n\n const toolbarContext = useContext(ToolbarContext);\n const ref = useRef(null);\n const show = () => {\n if (ref.current) {\n const toolbar = renderToolbar({\n onCloseToolbar: toolbarContext.hide,\n ...extraParams,\n size: rowSize,\n });\n toolbarContext.show({\n reference: ref.current,\n renderer: toolbar,\n });\n }\n };\n\n const hide = (e) => {\n toolbarContext.hide(e);\n };\n\n return (\n <DSButton\n {...rest}\n buttonType=\"text\"\n className=\"toolbar-trigger\"\n icon={icon}\n innerRef={ref}\n onClick={show}\n onMouseEnter={runAll(show, onMouseEnter)}\n onMouseLeave={runAll(hide, onMouseLeave)}\n tabIndex={isItemFocused ? 0 : -1}\n />\n );\n};\n\nconst TriggerFormatter = (value, extraParams, instance) => {\n const {\n props: { onShowToolbar, onCloseToolbar, renderToolbar, rowSize },\n } = instance.getInstance();\n\n return (\n <>\n {value}\n <ToolbarDisclosure\n isItemFocused={extraParams.isItemFocused}\n onClose={onCloseToolbar}\n onShow={onShowToolbar}\n renderToolbar={renderToolbar}\n rowSize={rowSize}\n />\n </>\n );\n};\n\nexport const TreeToolbarPlugin = createInstancePlugin('tree-toolbar', {\n itemRenderer: TriggerFormatter,\n renderers(renderers) {\n const List = useMemo(() => {\n const Component = renderers.list;\n // eslint-disable-next-line react/display-name\n return (props) => {\n const focusContext = useContext(FocusGroupContext);\n return (\n <ToolbarProvider\n onHide={(state, e) => {\n if (e && e.type === 'keydown' && focusContext) focusContext.focus();\n }}\n >\n <Component {...props} />\n </ToolbarProvider>\n );\n };\n }, []);\n return {\n ...renderers,\n list: List,\n };\n },\n});\n"],"names":["ToolbarDisclosure","props","onMouseEnter","onMouseLeave","extraParams","renderToolbar","isItemFocused","icon","rowSize","rest","toolbarContext","useContext","ToolbarContext","ref","useRef","show","current","toolbar","onCloseToolbar","hide","size","reference","renderer","e","DSButton","runAll","TriggerFormatter","value","instance","getInstance","onShowToolbar","TreeToolbarPlugin","createInstancePlugin","itemRenderer","renderers","List","useMemo","Component","list","focusContext","FocusGroupContext","state","type","focus"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAW;AACnC,MACEC,YADF,GASID,KATJ,CACEC,YADF;AAAA,MAEEC,YAFF,GASIF,KATJ,CAEEE,YAFF;AAAA,MAGEC,WAHF,GASIH,KATJ,CAGEG,WAHF;AAAA,MAIEC,aAJF,GASIJ,KATJ,CAIEI,aAJF;AAAA,MAKEC,aALF,GASIL,KATJ,CAKEK,aALF;AAAA,oBASIL,KATJ,CAMEM,IANF;AAAA,MAMEA,IANF,yCAMS,oBAAC,eAAD;AAAiB,IAAA,KAAK,EAAE,CAAC,eAAD,EAAkB,GAAlB;AAAxB,IANT;AAAA,MAOEC,OAPF,GASIP,KATJ,CAOEO,OAPF;AAAA,MAQKC,IARL,4BASIR,KATJ;;AAWA,MAAMS,cAAc,GAAGC,UAAU,CAACC,cAAD,CAAjC;AACA,MAAMC,GAAG,GAAGC,MAAM,CAAC,IAAD,CAAlB;;AACA,MAAMC,IAAI,GAAG,SAAPA,IAAO,GAAM;AACjB,QAAIF,GAAG,CAACG,OAAR,EAAiB;AACf,UAAMC,OAAO,GAAGZ,aAAa;AAC3Ba,QAAAA,cAAc,EAAER,cAAc,CAACS;AADJ,SAExBf,WAFwB;AAG3BgB,QAAAA,IAAI,EAAEZ;AAHqB,SAA7B;AAKAE,MAAAA,cAAc,CAACK,IAAf,CAAoB;AAClBM,QAAAA,SAAS,EAAER,GAAG,CAACG,OADG;AAElBM,QAAAA,QAAQ,EAAEL;AAFQ,OAApB;AAID;AACF,GAZD;;AAcA,MAAME,IAAI,GAAG,SAAPA,IAAO,CAACI,CAAD,EAAO;AAClBb,IAAAA,cAAc,CAACS,IAAf,CAAoBI,CAApB;AACD,GAFD;;AAIA,sBACE,oBAACC,MAAD,eACMf,IADN;AAEE,IAAA,UAAU,EAAC,MAFb;AAGE,IAAA,SAAS,EAAC,iB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,EAAQlB,CAAR,EAAc;AACpB,gBAAIA,CAAC,IAAIA,CAAC,CAACmB,IAAF,KAAW,SAAhB,IAA6BH,YAAjC,EAA+CA,YAAY,CAACI,KAAb;AAChD;AAHH,wBAKE,oBAAC,SAAD,EAAe1C,KAAf,CALF,CADF;AASD,OAXD;AAYD,KAfmB,EAejB,EAfiB,CAApB;AAgBA,2CACKiC,UADL;AAEEI,MAAAA,IAAI,EAAEH;AAFR;AAID;AAvBmE,CAAjB;;;;"}
1
+ {"version":3,"file":"TreeToolbarPlugin.js","sources":["../../../../../src/deprecated/plugins/toolbar/TreeToolbarPlugin.tsx"],"sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\n/* eslint-disable react/prop-types */\nimport React, { useContext, useMemo, useRef } from 'react';\nimport { MoreOptionsVert } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport { runAll } from '@elliemae/ds-utilities';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport ToolbarProvider, { ToolbarContext } from '@elliemae/ds-shared/toolbar/ToolbarProvider';\nimport FocusGroupContext from '@elliemae/ds-shared/FocusGroup/FocusGroupContext';\n\nconst ToolbarDisclosure = (props) => {\n const {\n onMouseEnter,\n onMouseLeave,\n extraParams,\n renderToolbar,\n isItemFocused,\n icon = <MoreOptionsVert color={['brand-primary', 800]} />,\n rowSize,\n ...rest\n } = props;\n\n const toolbarContext = useContext(ToolbarContext);\n const ref = useRef(null);\n const show = () => {\n if (ref.current) {\n const toolbar = renderToolbar({\n onCloseToolbar: toolbarContext.hide,\n ...extraParams,\n size: rowSize,\n });\n toolbarContext.show({\n reference: ref.current,\n renderer: toolbar,\n });\n }\n };\n\n const hide = (e) => {\n toolbarContext.hide(e);\n };\n\n return (\n <DSButton\n {...rest}\n buttonType=\"text\"\n className=\"toolbar-trigger\"\n icon={icon}\n innerRef={ref}\n onClick={show}\n onMouseEnter={runAll(show, onMouseEnter)}\n onMouseLeave={runAll(hide, onMouseLeave)}\n tabIndex={isItemFocused ? 0 : -1}\n />\n );\n};\n\nconst TriggerFormatter = (value, extraParams, instance) => {\n const {\n props: { onShowToolbar, onCloseToolbar, renderToolbar, rowSize },\n } = instance.getInstance();\n\n return (\n <>\n {value}\n <ToolbarDisclosure\n isItemFocused={extraParams.isItemFocused}\n onClose={onCloseToolbar}\n onShow={onShowToolbar}\n renderToolbar={renderToolbar}\n rowSize={rowSize}\n />\n </>\n );\n};\n\nexport const TreeToolbarPlugin = createInstancePlugin('tree-toolbar', {\n itemRenderer: TriggerFormatter,\n renderers(renderers) {\n const List = useMemo(() => {\n const Component = renderers.list;\n // eslint-disable-next-line react/display-name\n return (props) => {\n const focusContext = useContext(FocusGroupContext);\n return (\n <ToolbarProvider\n onHide={(state, e) => {\n if (e && e.type === 'keydown' && focusContext) focusContext.focus();\n }}\n >\n <Component {...props} />\n </ToolbarProvider>\n );\n };\n }, []);\n return {\n ...renderers,\n list: List,\n };\n },\n});\n"],"names":["ToolbarDisclosure","props","onMouseEnter","onMouseLeave","extraParams","renderToolbar","isItemFocused","icon","rowSize","rest","toolbarContext","useContext","ToolbarContext","ref","useRef","show","current","toolbar","onCloseToolbar","hide","size","reference","renderer","e","DSButton","runAll","TriggerFormatter","value","instance","getInstance","onShowToolbar","TreeToolbarPlugin","createInstancePlugin","itemRenderer","renderers","List","useMemo","Component","list","focusContext","FocusGroupContext","state","type","focus"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAW;EACnC,IACEC,YADF,GASID,KATJ,CACEC,YADF;MAEEC,YAFF,GASIF,KATJ,CAEEE,YAFF;MAGEC,WAHF,GASIH,KATJ,CAGEG,WAHF;MAIEC,aAJF,GASIJ,KATJ,CAIEI,aAJF;MAKEC,aALF,GASIL,KATJ,CAKEK,aALF;oBASIL,KATJ,CAMEM,IANF;MAMEA,IANF,yCAMS,oBAAC,eAAD;IAAiB,KAAK,EAAE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BACE,0CACGmB,KADH,eAEE,oBAAC,iBAAD;IACE,aAAa,EAAEvB,WAAW,CAACE,aAD7B;IAEE,OAAO,EAAEY,cAFX;IAGE,MAAM,EAAEY,aAHV;IAIE,aAAa,EAAEzB,aAJjB;IAKE,OAAO,EAAEG;IAPb,CADF;AAYD,CAjBD;;IAmBauB,iBAAiB,GAAGC,oBAAoB,CAAC,cAAD,EAAiB;EACpEC,YAAY,EAAEP,gBADsD;EAEpEQ,SAFoE,qBAE1DA,UAF0D,EAE/C;IACnB,IAAMC,IAAI,GAAGC,OAAO,CAAC,YAAM;MACzB,IAAMC,SAAS,GAAGH,UAAS,CAACI,IAA5B,CADyB;;MAGzB,OAAO,UAACrC,KAAD,EAAW;QAChB,IAAMsC,YAAY,GAAG5B,UAAU,CAAC6B,iBAAD,CAA/B;QACA,oBACE,oBAAC,eAAD;UACE,MAAM,EAAE,gBAACC,KAAD,EAAQlB,CAAR,EAAc;YACpB,IAAIA,CAAC,IAAIA,CAAC,CAACmB,IAAF,KAAW,SAAhB,IAA6BH,YAAjC,EAA+CA,YAAY,CAACI,KAAb;;wBAGjD,oBAAC,SAAD,EAAe1C,KAAf,CALF,CADF;OAFF;KAHkB,EAejB,EAfiB,CAApB;IAgBA,uCACKiC,UADL;MAEEI,IAAI,EAAEH;;;AArB0D,CAAjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeDataPlugin.js","sources":["../../../../../src/deprecated/plugins/tree/TreeDataPlugin.tsx"],"sourcesContent":["/* eslint max-lines: [\"error\", 300] */\nimport React, { useCallback } from 'react';\nimport { cx, isFunction } from '@elliemae/ds-utilities';\nimport Button from '@elliemae/ds-button';\nimport { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport { walkTreeStrategy } from './walkTreeStrategy';\nimport { getItemChildrenLength, getParentId, findItemOnDocument, getListFromDocument } from './utils';\nimport { treeItemBlockName } from '../../renderers';\nimport { useExpandTreeState } from './useExpandTreeState';\n\nconst ItemContent = aggregatedClasses('div')(`${treeItemBlockName}-content`);\nconst ItemValue = aggregatedClasses('span')(treeItemBlockName, 'value');\n\nconst noop = () => null;\n\nconst getItemNestingLeftPadding = (level, opts) => {\n const { spaceForNestingLevel, isChild } = {\n spaceForNestingLevel: 1.5,\n ...opts,\n };\n const groupLeftPadding = spaceForNestingLevel * (level - 1);\n return isChild ? `${groupLeftPadding + spaceForNestingLevel - 0.1}em` : `${groupLeftPadding}em`;\n};\nconst itemRenderer = (value, itemProps, instance) => {\n const { record } = itemProps;\n const {\n props: { showChildrenAmount = false, labelRenderer, onItemClick = noop },\n } = instance.getInstance();\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const handleItemClick = useCallback(\n (e) => {\n onItemClick(record.data, e);\n },\n [record.data, onItemClick],\n );\n\n const amountChildren = Number(getItemChildrenLength(record));\n\n const renderedLabel = (isFunction(labelRenderer) && labelRenderer(value, itemProps)) || value;\n\n return (\n <ItemContent data-testid={`${treeItemBlockName}-content`} onClick={handleItemClick}>\n <ItemValue>\n {renderedLabel}\n {showChildrenAmount && record.isGroup && ` (${amountChildren})`}\n </ItemValue>\n </ItemContent>\n );\n};\nitemRenderer.order = 100;\n\nexport const TreePluginList = createInstancePlugin('tree-data', {\n state: useExpandTreeState,\n\n recordIterator: (opts) => {\n const shouldWalkChildren = (record) => {\n const {\n state: { expandedAll },\n decorators,\n } = opts.instance.getInstance();\n\n const shouldWalk = decorators.shouldWalkChildren.some((decorator) => decorator(record, opts.instance));\n if (shouldWalk) return true;\n if (expandedAll === true) return true;\n return !record.parentNode.id || record.parentNode.expanded;\n };\n walkTreeStrategy({ ...opts, shouldWalkChildren });\n },\n\n getItemProps(props, instance, { record }) {\n const { nestingLevel } = record;\n const {\n actions: { _toggleExpand },\n props: { itemIcon, groupIcon, spaceForNestingLevel = 1.5 },\n } = instance.getInstance();\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const handleExpandRow = useCallback(() => _toggleExpand(record.data), [record.data]);\n const icon = record.isGroup ? groupIcon : itemIcon;\n\n const itemNestingLeftPadding = getItemNestingLeftPadding(nestingLevel || record.nestingLevel, {\n isChild: !record.isGroup,\n spaceForNestingLevel,\n });\n\n const expandAddon = record.isGroup && (\n <Button\n buttonType=\"text\"\n className=\"expandable-arrow\"\n data-testid=\"tree-item-expand-toggle\"\n key={`${record.id}-expand-addon`}\n icon={\n record.expanded ? (\n <ArrowheadDown data-testid=\"ic-arrow-head-down\" />\n ) : (\n <ArrowheadRight data-testid=\"ic-arrow-head-right\" />\n )\n }\n onClick={(e) => {\n // Avoid item selection on caret click (just expand/hide)\n e.stopPropagation();\n handleExpandRow(e);\n }}\n size=\"s\"\n tabIndex={-1}\n // eslint-disable-next-line max-lines\n />\n );\n\n const iconAddon =\n icon &&\n React.cloneElement(icon, {\n 'data-testid': record.isGroup ? 'tree-item-group-icon' : 'tree-item-icon',\n className: cx(icon.props.className, 'tree-item-icon'),\n });\n\n const spaceAddon = (\n <div\n data-testid=\"tree-item-nested-space\"\n style={{ width: itemNestingLeftPadding }}\n key={`${record.id}-space-addon`}\n />\n );\n\n return {\n ...props,\n 'data-id': record.id,\n 'data-parentid': getParentId(record),\n 'aria-expanded': !!record.expanded,\n leftAddons: [...(props.leftAddons || []), spaceAddon, expandAddon, iconAddon],\n };\n },\n\n record: (record, instance) => {\n const {\n state: { expanded, expandedAll },\n } = instance.getInstance();\n\n const isParentExpanded = !record.parentNode.id || record.parentNode.expanded;\n\n // eslint-disable-next-line no-param-reassign\n if (expandedAll === true) record.expanded = true;\n // eslint-disable-next-line no-param-reassign\n else if (expandedAll === false) record.expanded = false;\n // eslint-disable-next-line no-param-reassign\n else record.expanded = isParentExpanded && !!expanded[record.id];\n\n return isParentExpanded && record;\n },\n\n hotKeys(instance) {\n function handleExpand({ index }) {\n const {\n records,\n actions: { _toggleExpand },\n } = instance.getInstance();\n const record = records[index];\n if (record && record.data.children.length > 0) _toggleExpand(record.data);\n }\n\n function handleCollapse({ index }) {\n const {\n records,\n actions: { collapse },\n } = instance.getInstance();\n const record = records[index];\n if (record && record.expanded) {\n collapse(record);\n }\n }\n\n function handleExpandAll() {\n const {\n actions: { toggleExpandAll },\n } = instance.getInstance();\n const active = document.activeElement;\n\n toggleExpandAll().then(() => {\n const { records } = instance.getInstance();\n const itemToFocus = records.find(\n // eslint-disable-next-line eqeqeq\n (record) => record.id == active.dataset.id,\n );\n if (itemToFocus) {\n // eslint-disable-next-line no-unused-expressions\n // eslint-disable-next-line mdx/no-unused-expressions\n findItemOnDocument(itemToFocus.id)\n ? findItemOnDocument(itemToFocus.id).focus()\n : findItemOnDocument(records[0].id).focus();\n } else {\n getListFromDocument().scrollTo(0, 0);\n setTimeout(() => {\n findItemOnDocument(records[0].id).focus();\n }, 200);\n }\n });\n }\n\n return [\n {\n key: 'right',\n handler: handleExpand,\n },\n {\n key: 'shift+=',\n handler: handleExpand,\n },\n {\n key: '-',\n handler: handleCollapse,\n },\n {\n key: 'enter',\n handler: ({ index }) => {\n const {\n records,\n actions: { select },\n } = instance.getInstance();\n const record = records[index];\n select(record);\n },\n },\n {\n key: 'left',\n handler: handleCollapse,\n },\n {\n key: '/',\n handler: handleCollapse,\n },\n {\n key: 'shift+8',\n allowDocumentHandler: true,\n handler: handleExpandAll,\n },\n ];\n },\n itemRenderer,\n});\n"],"names":["ItemContent","aggregatedClasses","treeItemBlockName","ItemValue","noop","getItemNestingLeftPadding","level","opts","spaceForNestingLevel","isChild","groupLeftPadding","itemRenderer","value","itemProps","instance","record","getInstance","props","showChildrenAmount","labelRenderer","onItemClick","handleItemClick","useCallback","e","data","amountChildren","Number","getItemChildrenLength","renderedLabel","isFunction","isGroup","order","TreePluginList","createInstancePlugin","state","useExpandTreeState","recordIterator","shouldWalkChildren","expandedAll","decorators","shouldWalk","some","decorator","parentNode","id","expanded","walkTreeStrategy","getItemProps","nestingLevel","_toggleExpand","actions","itemIcon","groupIcon","handleExpandRow","icon","itemNestingLeftPadding","expandAddon","stopPropagation","iconAddon","React","cloneElement","className","cx","spaceAddon","width","getParentId","leftAddons","isParentExpanded","hotKeys","handleExpand","index","records","children","length","handleCollapse","collapse","handleExpandAll","toggleExpandAll","active","document","activeElement","then","itemToFocus","find","dataset","findItemOnDocument","focus","getListFromDocument","scrollTo","setTimeout","key","handler","select","allowDocumentHandler"],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,IAAMA,WAAW,GAAGC,iBAAiB,CAAC,KAAD,CAAjB,WAA4BC,iBAA5B,cAApB;AACA,IAAMC,SAAS,GAAGF,iBAAiB,CAAC,MAAD,CAAjB,CAA0BC,iBAA1B,EAA6C,OAA7C,CAAlB;;AAEA,IAAME,IAAI,GAAG,SAAPA,IAAO;AAAA,SAAM,IAAN;AAAA,CAAb;;AAEA,IAAMC,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACjD;AACEC,IAAAA,oBAAoB,EAAE;AADxB,KAEKD,IAFL;AAAA,MAAQC,oBAAR,yBAAQA,oBAAR;AAAA,MAA8BC,OAA9B,yBAA8BA,OAA9B;;AAIA,MAAMC,gBAAgB,GAAGF,oBAAoB,IAAIF,KAAK,GAAG,CAAZ,CAA7C;AACA,SAAOG,OAAO,aAAMC,gBAAgB,GAAGF,oBAAnB,GAA0C,GAAhD,oBAA6DE,gBAA7D,OAAd;AACD,CAPD;;AAQA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,EAAgC;AACnD,MAAQC,MAAR,GAAmBF,SAAnB,CAAQE,MAAR;;AACA,8BAEID,QAAQ,CAACE,WAAT,EAFJ;AAAA,qDACEC,KADF;AAAA,sDACWC,kBADX;AAAA,MACWA,kBADX,uCACgC,KADhC;AAAA,MACuCC,aADvC,0BACuCA,aADvC;AAAA,sDACsDC,WADtD;AAAA,MACsDA,WADtD,uCACoE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jB;AAFX,KATK,EAaL;AACEgB,MAAAA,GAAG,EAAE,OADP;AAEEC,MAAAA,OAAO,EAAE,wBAAe;AAAA,YAAZrB,KAAY,SAAZA,KAAY;;AACtB,sCAGIxD,QAAQ,CAACE,WAAT,EAHJ;AAAA,YACEuD,OADF,2BACEA,OADF;AAAA,YAEaqB,MAFb,2BAEE1C,OAFF,CAEa0C,MAFb;;AAIA,YAAM7E,MAAM,GAAGwD,OAAO,CAACD,KAAD,CAAtB;AACAsB,QAAAA,MAAM,CAAC7E,MAAD,CAAN;AACD;AATH,KAbK,EAwBL;AACE2E,MAAAA,GAAG,EAAE,MADP;AAEEC,MAAAA,OAAO,EAAEjB;AAFX,KAxBK,EA4BL;AACEgB,MAAAA,GAAG,EAAE,GADP;AAEEC,MAAAA,OAAO,EAAEjB;AAFX,KA5BK,EAgCL;AACEgB,MAAAA,GAAG,EAAE,SADP;AAEEG,MAAAA,oBAAoB,EAAE,IAFxB;AAGEF,MAAAA,OAAO,EAAEf;AAHX,KAhCK,CAAP;AAsCD,GAzL6D;AA0L9DjE,EAAAA,YAAY,EAAZA;AA1L8D,CAAd;;;;"}
1
+ {"version":3,"file":"TreeDataPlugin.js","sources":["../../../../../src/deprecated/plugins/tree/TreeDataPlugin.tsx"],"sourcesContent":["/* eslint max-lines: [\"error\", 300] */\nimport React, { useCallback } from 'react';\nimport { cx, isFunction } from '@elliemae/ds-utilities';\nimport Button from '@elliemae/ds-button';\nimport { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport { walkTreeStrategy } from './walkTreeStrategy';\nimport { getItemChildrenLength, getParentId, findItemOnDocument, getListFromDocument } from './utils';\nimport { treeItemBlockName } from '../../renderers';\nimport { useExpandTreeState } from './useExpandTreeState';\n\nconst ItemContent = aggregatedClasses('div')(`${treeItemBlockName}-content`);\nconst ItemValue = aggregatedClasses('span')(treeItemBlockName, 'value');\n\nconst noop = () => null;\n\nconst getItemNestingLeftPadding = (level, opts) => {\n const { spaceForNestingLevel, isChild } = {\n spaceForNestingLevel: 1.5,\n ...opts,\n };\n const groupLeftPadding = spaceForNestingLevel * (level - 1);\n return isChild ? `${groupLeftPadding + spaceForNestingLevel - 0.1}em` : `${groupLeftPadding}em`;\n};\nconst itemRenderer = (value, itemProps, instance) => {\n const { record } = itemProps;\n const {\n props: { showChildrenAmount = false, labelRenderer, onItemClick = noop },\n } = instance.getInstance();\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const handleItemClick = useCallback(\n (e) => {\n onItemClick(record.data, e);\n },\n [record.data, onItemClick],\n );\n\n const amountChildren = Number(getItemChildrenLength(record));\n\n const renderedLabel = (isFunction(labelRenderer) && labelRenderer(value, itemProps)) || value;\n\n return (\n <ItemContent data-testid={`${treeItemBlockName}-content`} onClick={handleItemClick}>\n <ItemValue>\n {renderedLabel}\n {showChildrenAmount && record.isGroup && ` (${amountChildren})`}\n </ItemValue>\n </ItemContent>\n );\n};\nitemRenderer.order = 100;\n\nexport const TreePluginList = createInstancePlugin('tree-data', {\n state: useExpandTreeState,\n\n recordIterator: (opts) => {\n const shouldWalkChildren = (record) => {\n const {\n state: { expandedAll },\n decorators,\n } = opts.instance.getInstance();\n\n const shouldWalk = decorators.shouldWalkChildren.some((decorator) => decorator(record, opts.instance));\n if (shouldWalk) return true;\n if (expandedAll === true) return true;\n return !record.parentNode.id || record.parentNode.expanded;\n };\n walkTreeStrategy({ ...opts, shouldWalkChildren });\n },\n\n getItemProps(props, instance, { record }) {\n const { nestingLevel } = record;\n const {\n actions: { _toggleExpand },\n props: { itemIcon, groupIcon, spaceForNestingLevel = 1.5 },\n } = instance.getInstance();\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const handleExpandRow = useCallback(() => _toggleExpand(record.data), [record.data]);\n const icon = record.isGroup ? groupIcon : itemIcon;\n\n const itemNestingLeftPadding = getItemNestingLeftPadding(nestingLevel || record.nestingLevel, {\n isChild: !record.isGroup,\n spaceForNestingLevel,\n });\n\n const expandAddon = record.isGroup && (\n <Button\n buttonType=\"text\"\n className=\"expandable-arrow\"\n data-testid=\"tree-item-expand-toggle\"\n key={`${record.id}-expand-addon`}\n icon={\n record.expanded ? (\n <ArrowheadDown data-testid=\"ic-arrow-head-down\" />\n ) : (\n <ArrowheadRight data-testid=\"ic-arrow-head-right\" />\n )\n }\n onClick={(e) => {\n // Avoid item selection on caret click (just expand/hide)\n e.stopPropagation();\n handleExpandRow(e);\n }}\n size=\"s\"\n tabIndex={-1}\n // eslint-disable-next-line max-lines\n />\n );\n\n const iconAddon =\n icon &&\n React.cloneElement(icon, {\n 'data-testid': record.isGroup ? 'tree-item-group-icon' : 'tree-item-icon',\n className: cx(icon.props.className, 'tree-item-icon'),\n });\n\n const spaceAddon = (\n <div\n data-testid=\"tree-item-nested-space\"\n style={{ width: itemNestingLeftPadding }}\n key={`${record.id}-space-addon`}\n />\n );\n\n return {\n ...props,\n 'data-id': record.id,\n 'data-parentid': getParentId(record),\n 'aria-expanded': !!record.expanded,\n leftAddons: [...(props.leftAddons || []), spaceAddon, expandAddon, iconAddon],\n };\n },\n\n record: (record, instance) => {\n const {\n state: { expanded, expandedAll },\n } = instance.getInstance();\n\n const isParentExpanded = !record.parentNode.id || record.parentNode.expanded;\n\n // eslint-disable-next-line no-param-reassign\n if (expandedAll === true) record.expanded = true;\n // eslint-disable-next-line no-param-reassign\n else if (expandedAll === false) record.expanded = false;\n // eslint-disable-next-line no-param-reassign\n else record.expanded = isParentExpanded && !!expanded[record.id];\n\n return isParentExpanded && record;\n },\n\n hotKeys(instance) {\n function handleExpand({ index }) {\n const {\n records,\n actions: { _toggleExpand },\n } = instance.getInstance();\n const record = records[index];\n if (record && record.data.children.length > 0) _toggleExpand(record.data);\n }\n\n function handleCollapse({ index }) {\n const {\n records,\n actions: { collapse },\n } = instance.getInstance();\n const record = records[index];\n if (record && record.expanded) {\n collapse(record);\n }\n }\n\n function handleExpandAll() {\n const {\n actions: { toggleExpandAll },\n } = instance.getInstance();\n const active = document.activeElement;\n\n toggleExpandAll().then(() => {\n const { records } = instance.getInstance();\n const itemToFocus = records.find(\n // eslint-disable-next-line eqeqeq\n (record) => record.id == active.dataset.id,\n );\n if (itemToFocus) {\n // eslint-disable-next-line no-unused-expressions\n // eslint-disable-next-line mdx/no-unused-expressions\n findItemOnDocument(itemToFocus.id)\n ? findItemOnDocument(itemToFocus.id).focus()\n : findItemOnDocument(records[0].id).focus();\n } else {\n getListFromDocument().scrollTo(0, 0);\n setTimeout(() => {\n findItemOnDocument(records[0].id).focus();\n }, 200);\n }\n });\n }\n\n return [\n {\n key: 'right',\n handler: handleExpand,\n },\n {\n key: 'shift+=',\n handler: handleExpand,\n },\n {\n key: '-',\n handler: handleCollapse,\n },\n {\n key: 'enter',\n handler: ({ index }) => {\n const {\n records,\n actions: { select },\n } = instance.getInstance();\n const record = records[index];\n select(record);\n },\n },\n {\n key: 'left',\n handler: handleCollapse,\n },\n {\n key: '/',\n handler: handleCollapse,\n },\n {\n key: 'shift+8',\n allowDocumentHandler: true,\n handler: handleExpandAll,\n },\n ];\n },\n itemRenderer,\n});\n"],"names":["ItemContent","aggregatedClasses","treeItemBlockName","ItemValue","noop","getItemNestingLeftPadding","level","opts","spaceForNestingLevel","isChild","groupLeftPadding","itemRenderer","value","itemProps","instance","record","getInstance","props","showChildrenAmount","labelRenderer","onItemClick","handleItemClick","useCallback","e","data","amountChildren","Number","getItemChildrenLength","renderedLabel","isFunction","isGroup","order","TreePluginList","createInstancePlugin","state","useExpandTreeState","recordIterator","shouldWalkChildren","expandedAll","decorators","shouldWalk","some","decorator","parentNode","id","expanded","walkTreeStrategy","getItemProps","nestingLevel","_toggleExpand","actions","itemIcon","groupIcon","handleExpandRow","icon","itemNestingLeftPadding","expandAddon","stopPropagation","iconAddon","React","cloneElement","className","cx","spaceAddon","width","getParentId","leftAddons","isParentExpanded","hotKeys","handleExpand","index","records","children","length","handleCollapse","collapse","handleExpandAll","toggleExpandAll","active","document","activeElement","then","itemToFocus","find","dataset","findItemOnDocument","focus","getListFromDocument","scrollTo","setTimeout","key","handler","select","allowDocumentHandler"],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,IAAMA,WAAW,GAAGC,iBAAiB,CAAC,KAAD,CAAjB,WAA4BC,iBAA5B,cAApB;AACA,IAAMC,SAAS,GAAGF,iBAAiB,CAAC,MAAD,CAAjB,CAA0BC,iBAA1B,EAA6C,OAA7C,CAAlB;;AAEA,IAAME,IAAI,GAAG,SAAPA,IAAO;EAAA,OAAM,IAAN;AAAA,CAAb;;AAEA,IAAMC,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,KAAD,EAAQC,IAAR,EAAiB;EACjD;IACEC,oBAAoB,EAAE;KACnBD,IAFL;MAAQC,oBAAR,yBAAQA,oBAAR;MAA8BC,OAA9B,yBAA8BA,OAA9B;;EAIA,IAAMC,gBAAgB,GAAGF,oBAAoB,IAAIF,KAAK,GAAG,CAAZ,CAA7C;EACA,OAAOG,OAAO,aAAMC,gBAAgB,GAAGF,oBAAnB,GAA0C,GAAhD,oBAA6DE,gBAA7D,OAAd;AACD,CAPD;;AAQA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,EAAgC;EACnD,IAAQC,MAAR,GAAmBF,SAAnB,CAAQE,MAAR;;EACA,4BAEID,QAAQ,CAACE,WAAT,EAFJ;qDACEC,KADF;sDACWC,kBADX;MACWA,kBADX,uCACgC,KADhC;MACuCC,aADvC,0BACuCA,aADvC;sDACsDC,WADtD;MACsDA,WADtD,uCACoEhB,IADpE,0BAFmD;;;EAOnD,IAAMiB,eAAe,GAAGC,WAAW,CACjC,UAACC,CAAD,EAAO;IACLH,WAAW,CAACL,MAAM,CAACS,IAAR,EAAcD,CAAd,CAAX;GAF+B,EAIjC,CAACR,MAAM,CAACS,IAAR,EAAcJ,WAAd,CAJiC,C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