@elliemae/ds-treeview 2.3.0-next.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/TreeView.js +50 -0
- package/dist/cjs/TreeView.js.map +7 -0
- package/dist/cjs/TreeViewContext.js +116 -0
- package/dist/cjs/TreeViewContext.js.map +7 -0
- package/dist/cjs/config/cssClassesConstants.js +41 -0
- package/dist/cjs/config/cssClassesConstants.js.map +7 -0
- package/dist/cjs/config/useTreeview.js +151 -0
- package/dist/cjs/config/useTreeview.js.map +7 -0
- package/dist/cjs/hoc/DnDTreeContext.js +45 -0
- package/dist/cjs/hoc/DnDTreeContext.js.map +7 -0
- package/dist/cjs/hoc/SortableItemContext.js +46 -0
- package/dist/cjs/hoc/SortableItemContext.js.map +7 -0
- package/dist/cjs/hoc/WithConditionalDnDContext.js +128 -0
- package/dist/cjs/hoc/WithConditionalDnDContext.js.map +7 -0
- package/dist/cjs/hoc/WithDnDSortableItemContext.js +69 -0
- package/dist/cjs/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/parts/CheckboxSelectable.js +97 -0
- package/dist/cjs/parts/CheckboxSelectable.js.map +7 -0
- package/dist/cjs/parts/ChildrenCountDisplayer.js +47 -0
- package/dist/cjs/parts/ChildrenCountDisplayer.js.map +7 -0
- package/dist/cjs/parts/DnDHandle.js +57 -0
- package/dist/cjs/parts/DnDHandle.js.map +7 -0
- package/dist/cjs/parts/DropIndicator.js +80 -0
- package/dist/cjs/parts/DropIndicator.js.map +7 -0
- package/dist/cjs/parts/ExpandCaret.js +96 -0
- package/dist/cjs/parts/ExpandCaret.js.map +7 -0
- package/dist/cjs/parts/Icon.js +52 -0
- package/dist/cjs/parts/Icon.js.map +7 -0
- package/dist/cjs/parts/NestingSpace.js +55 -0
- package/dist/cjs/parts/NestingSpace.js.map +7 -0
- package/dist/cjs/parts/RadioSelectable.js +74 -0
- package/dist/cjs/parts/RadioSelectable.js.map +7 -0
- package/dist/cjs/parts/TreeItem.js +166 -0
- package/dist/cjs/parts/TreeItem.js.map +7 -0
- package/dist/cjs/parts/TreeItemText.js +101 -0
- package/dist/cjs/parts/TreeItemText.js.map +7 -0
- package/dist/cjs/parts/TreeList.js +123 -0
- package/dist/cjs/parts/TreeList.js.map +7 -0
- package/dist/cjs/plugins/dnd/TreeDndPlugin.js +35 -0
- package/dist/cjs/plugins/dnd/TreeDndPlugin.js.map +7 -0
- package/dist/cjs/plugins/dnd/index.js +28 -0
- package/dist/cjs/plugins/dnd/index.js.map +7 -0
- package/dist/cjs/plugins/index.js +34 -0
- package/dist/cjs/plugins/index.js.map +7 -0
- package/dist/cjs/plugins/roving/TreeRovingPlugin.js +35 -0
- package/dist/cjs/plugins/roving/TreeRovingPlugin.js.map +7 -0
- package/dist/cjs/plugins/roving/index.js +28 -0
- package/dist/cjs/plugins/roving/index.js.map +7 -0
- package/dist/cjs/plugins/searchable/SearchableTreePlugin.js +35 -0
- package/dist/cjs/plugins/searchable/SearchableTreePlugin.js.map +7 -0
- package/dist/cjs/plugins/searchable/index.js +28 -0
- package/dist/cjs/plugins/searchable/index.js.map +7 -0
- package/dist/cjs/plugins/selectable/SelectablePluginTree.js +35 -0
- package/dist/cjs/plugins/selectable/SelectablePluginTree.js.map +7 -0
- package/dist/cjs/plugins/selectable/index.js +28 -0
- package/dist/cjs/plugins/selectable/index.js.map +7 -0
- package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js +35 -0
- package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
- package/dist/cjs/plugins/toolbar/index.js +28 -0
- package/dist/cjs/plugins/toolbar/index.js.map +7 -0
- package/dist/cjs/plugins/tree/TreeDataPlugin.js +35 -0
- package/dist/cjs/plugins/tree/TreeDataPlugin.js.map +7 -0
- package/dist/cjs/plugins/tree/index.js +28 -0
- package/dist/cjs/plugins/tree/index.js.map +7 -0
- package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +35 -0
- package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
- package/dist/cjs/plugins/virtualization/index.js +28 -0
- package/dist/cjs/plugins/virtualization/index.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +85 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/related-components/TreeViewSearchBar.js +50 -0
- package/dist/cjs/related-components/TreeViewSearchBar.js.map +7 -0
- package/dist/cjs/sharedTypes.js +27 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/cjs/utils/array-helpers.js +48 -0
- package/dist/cjs/utils/array-helpers.js.map +7 -0
- package/dist/cjs/utils/group-expands-helpers.js +138 -0
- package/dist/cjs/utils/group-expands-helpers.js.map +7 -0
- package/dist/cjs/utils/keyboard-helpers.js +170 -0
- package/dist/cjs/utils/keyboard-helpers.js.map +7 -0
- package/dist/cjs/utils/object-helpers.js +76 -0
- package/dist/cjs/utils/object-helpers.js.map +7 -0
- package/dist/cjs/utils/refs-helpers.js +52 -0
- package/dist/cjs/utils/refs-helpers.js.map +7 -0
- package/dist/cjs/utils/selectable-helper.js +88 -0
- package/dist/cjs/utils/selectable-helper.js.map +7 -0
- package/dist/cjs/utils/string-helpers.js +35 -0
- package/dist/cjs/utils/string-helpers.js.map +7 -0
- package/dist/cjs/utils/tree-helpers.js +184 -0
- package/dist/cjs/utils/tree-helpers.js.map +7 -0
- package/dist/cjs/utils/useInstanceRefActions.js +98 -0
- package/dist/cjs/utils/useInstanceRefActions.js.map +7 -0
- package/dist/cjs/utils/useTree.js +106 -0
- package/dist/cjs/utils/useTree.js.map +7 -0
- package/dist/esm/TreeView.js +21 -0
- package/dist/esm/TreeView.js.map +7 -0
- package/{esm → dist/esm}/TreeViewContext.js +24 -29
- package/dist/esm/TreeViewContext.js.map +7 -0
- package/dist/esm/config/cssClassesConstants.js +12 -0
- package/dist/esm/config/cssClassesConstants.js.map +7 -0
- package/dist/esm/config/useTreeview.js +122 -0
- package/dist/esm/config/useTreeview.js.map +7 -0
- package/dist/esm/hoc/DnDTreeContext.js +16 -0
- package/dist/esm/hoc/DnDTreeContext.js.map +7 -0
- package/dist/esm/hoc/SortableItemContext.js +17 -0
- package/dist/esm/hoc/SortableItemContext.js.map +7 -0
- package/dist/esm/hoc/WithConditionalDnDContext.js +99 -0
- package/dist/esm/hoc/WithConditionalDnDContext.js.map +7 -0
- package/dist/esm/hoc/WithDnDSortableItemContext.js +40 -0
- package/dist/esm/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parts/CheckboxSelectable.js +68 -0
- package/dist/esm/parts/CheckboxSelectable.js.map +7 -0
- package/dist/esm/parts/ChildrenCountDisplayer.js +18 -0
- package/dist/esm/parts/ChildrenCountDisplayer.js.map +7 -0
- package/dist/esm/parts/DnDHandle.js +28 -0
- package/dist/esm/parts/DnDHandle.js.map +7 -0
- package/dist/esm/parts/DropIndicator.js +51 -0
- package/dist/esm/parts/DropIndicator.js.map +7 -0
- package/dist/esm/parts/ExpandCaret.js +67 -0
- package/dist/esm/parts/ExpandCaret.js.map +7 -0
- package/dist/esm/parts/Icon.js +23 -0
- package/dist/esm/parts/Icon.js.map +7 -0
- package/dist/esm/parts/NestingSpace.js +26 -0
- package/dist/esm/parts/NestingSpace.js.map +7 -0
- package/dist/esm/parts/RadioSelectable.js +45 -0
- package/dist/esm/parts/RadioSelectable.js.map +7 -0
- package/dist/esm/parts/TreeItem.js +137 -0
- package/dist/esm/parts/TreeItem.js.map +7 -0
- package/dist/esm/parts/TreeItemText.js +72 -0
- package/dist/esm/parts/TreeItemText.js.map +7 -0
- package/dist/esm/parts/TreeList.js +94 -0
- package/dist/esm/parts/TreeList.js.map +7 -0
- package/dist/esm/plugins/dnd/TreeDndPlugin.js +6 -0
- package/dist/esm/plugins/dnd/TreeDndPlugin.js.map +7 -0
- package/dist/esm/plugins/dnd/index.js +3 -0
- package/dist/esm/plugins/dnd/index.js.map +7 -0
- package/dist/esm/plugins/index.js +9 -0
- package/dist/esm/plugins/index.js.map +7 -0
- package/dist/esm/plugins/roving/TreeRovingPlugin.js +6 -0
- package/dist/esm/plugins/roving/TreeRovingPlugin.js.map +7 -0
- package/dist/esm/plugins/roving/index.js +3 -0
- package/dist/esm/plugins/roving/index.js.map +7 -0
- package/dist/esm/plugins/searchable/SearchableTreePlugin.js +6 -0
- package/dist/esm/plugins/searchable/SearchableTreePlugin.js.map +7 -0
- package/dist/esm/plugins/searchable/index.js +3 -0
- package/dist/esm/plugins/searchable/index.js.map +7 -0
- package/dist/esm/plugins/selectable/SelectablePluginTree.js +6 -0
- package/dist/esm/plugins/selectable/SelectablePluginTree.js.map +7 -0
- package/dist/esm/plugins/selectable/index.js +3 -0
- package/dist/esm/plugins/selectable/index.js.map +7 -0
- package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js +6 -0
- package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
- package/dist/esm/plugins/toolbar/index.js +3 -0
- package/dist/esm/plugins/toolbar/index.js.map +7 -0
- package/dist/esm/plugins/tree/TreeDataPlugin.js +6 -0
- package/dist/esm/plugins/tree/TreeDataPlugin.js.map +7 -0
- package/dist/esm/plugins/tree/index.js +3 -0
- package/dist/esm/plugins/tree/index.js.map +7 -0
- package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js +6 -0
- package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
- package/dist/esm/plugins/virtualization/index.js +3 -0
- package/dist/esm/plugins/virtualization/index.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +56 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/related-components/TreeViewSearchBar.js +21 -0
- package/dist/esm/related-components/TreeViewSearchBar.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/sharedTypes.js.map +7 -0
- package/{esm → dist/esm}/utils/array-helpers.js +6 -6
- package/dist/esm/utils/array-helpers.js.map +7 -0
- package/dist/esm/utils/group-expands-helpers.js +109 -0
- package/dist/esm/utils/group-expands-helpers.js.map +7 -0
- package/{esm → dist/esm}/utils/keyboard-helpers.js +43 -71
- package/dist/esm/utils/keyboard-helpers.js.map +7 -0
- package/dist/esm/utils/object-helpers.js +47 -0
- package/dist/esm/utils/object-helpers.js.map +7 -0
- package/dist/esm/utils/refs-helpers.js +23 -0
- package/dist/esm/utils/refs-helpers.js.map +7 -0
- package/dist/esm/utils/selectable-helper.js +59 -0
- package/dist/esm/utils/selectable-helper.js.map +7 -0
- package/dist/esm/utils/string-helpers.js +6 -0
- package/dist/esm/utils/string-helpers.js.map +7 -0
- package/dist/esm/utils/tree-helpers.js +155 -0
- package/dist/esm/utils/tree-helpers.js.map +7 -0
- package/{esm → dist/esm}/utils/useInstanceRefActions.js +21 -35
- package/dist/esm/utils/useInstanceRefActions.js.map +7 -0
- package/dist/esm/utils/useTree.js +77 -0
- package/dist/esm/utils/useTree.js.map +7 -0
- package/{types → dist/types}/TreeView.d.ts +0 -0
- package/{types → dist/types}/TreeViewContext.d.ts +0 -0
- package/{types → dist/types}/config/cssClassesConstants.d.ts +0 -0
- package/{types → dist/types}/config/useTreeview.d.ts +0 -0
- package/{types → dist/types}/hoc/DnDTreeContext.d.ts +0 -0
- package/{types → dist/types}/hoc/SortableItemContext.d.ts +0 -0
- package/{types → dist/types}/hoc/WithConditionalDnDContext.d.ts +0 -0
- package/{types → dist/types}/hoc/WithDnDSortableItemContext.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/parts/CheckboxSelectable.d.ts +0 -0
- package/{types → dist/types}/parts/ChildrenCountDisplayer.d.ts +0 -0
- package/{types → dist/types}/parts/DnDHandle.d.ts +0 -0
- package/{types → dist/types}/parts/DropIndicator.d.ts +0 -0
- package/{types → dist/types}/parts/ExpandCaret.d.ts +0 -0
- package/{types → dist/types}/parts/Icon.d.ts +0 -0
- package/{types → dist/types}/parts/NestingSpace.d.ts +0 -0
- package/{types → dist/types}/parts/RadioSelectable.d.ts +0 -0
- package/{types → dist/types}/parts/TreeItem.d.ts +0 -0
- package/{types → dist/types}/parts/TreeItemText.d.ts +0 -0
- package/{types → dist/types}/parts/TreeList.d.ts +0 -0
- package/{types → dist/types}/plugins/dnd/TreeDndPlugin.d.ts +0 -0
- package/{types → dist/types}/plugins/dnd/index.d.ts +0 -0
- package/{types → dist/types}/plugins/index.d.ts +0 -0
- package/{types → dist/types}/plugins/roving/TreeRovingPlugin.d.ts +0 -0
- package/{types → dist/types}/plugins/roving/index.d.ts +0 -0
- package/{types → dist/types}/plugins/searchable/SearchableTreePlugin.d.ts +0 -0
- package/{types → dist/types}/plugins/searchable/index.d.ts +0 -0
- package/{types → dist/types}/plugins/selectable/SelectablePluginTree.d.ts +0 -0
- package/{types → dist/types}/plugins/selectable/index.d.ts +0 -0
- package/{types → dist/types}/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -0
- package/{types → dist/types}/plugins/toolbar/index.d.ts +0 -0
- package/{types → dist/types}/plugins/tree/TreeDataPlugin.d.ts +0 -0
- package/{types → dist/types}/plugins/tree/index.d.ts +0 -0
- package/{types → dist/types}/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -0
- package/{types → dist/types}/plugins/virtualization/index.d.ts +0 -0
- package/{types → dist/types}/react-desc-prop-types.d.ts +0 -0
- package/{types → dist/types}/related-components/TreeViewSearchBar.d.ts +0 -0
- package/{types → dist/types}/sharedTypes.d.ts +0 -0
- package/{types → dist/types}/utils/array-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/group-expands-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/keyboard-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/object-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/refs-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/selectable-helper.d.ts +0 -0
- package/{types → dist/types}/utils/string-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/tree-helpers.d.ts +0 -0
- package/{types → dist/types}/utils/useInstanceRefActions.d.ts +0 -0
- package/{types → dist/types}/utils/useTree.d.ts +0 -0
- package/package.json +129 -120
- package/cjs/TreeView.js +0 -30
- package/cjs/TreeViewContext.js +0 -98
- package/cjs/config/cssClassesConstants.js +0 -13
- package/cjs/config/useTreeview.js +0 -127
- package/cjs/hoc/DnDTreeContext.js +0 -18
- package/cjs/hoc/SortableItemContext.js +0 -21
- package/cjs/hoc/WithConditionalDnDContext.js +0 -138
- package/cjs/hoc/WithDnDSortableItemContext.js +0 -70
- package/cjs/index.js +0 -26
- package/cjs/parts/CheckboxSelectable.js +0 -86
- package/cjs/parts/ChildrenCountDisplayer.js +0 -30
- package/cjs/parts/DnDHandle.js +0 -46
- package/cjs/parts/DropIndicator.js +0 -75
- package/cjs/parts/ExpandCaret.js +0 -94
- package/cjs/parts/Icon.js +0 -37
- package/cjs/parts/NestingSpace.js +0 -47
- package/cjs/parts/RadioSelectable.js +0 -59
- package/cjs/parts/TreeItem.js +0 -185
- package/cjs/parts/TreeItemText.js +0 -108
- package/cjs/parts/TreeList.js +0 -139
- package/cjs/plugins/dnd/TreeDndPlugin.js +0 -7
- package/cjs/plugins/dnd/index.js +0 -9
- package/cjs/plugins/index.js +0 -21
- package/cjs/plugins/roving/TreeRovingPlugin.js +0 -7
- package/cjs/plugins/roving/index.js +0 -9
- package/cjs/plugins/searchable/SearchableTreePlugin.js +0 -7
- package/cjs/plugins/searchable/index.js +0 -9
- package/cjs/plugins/selectable/SelectablePluginTree.js +0 -7
- package/cjs/plugins/selectable/index.js +0 -9
- package/cjs/plugins/toolbar/TreeToolbarPlugin.js +0 -7
- package/cjs/plugins/toolbar/index.js +0 -9
- package/cjs/plugins/tree/TreeDataPlugin.js +0 -7
- package/cjs/plugins/tree/index.js +0 -9
- package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +0 -7
- package/cjs/plugins/virtualization/index.js +0 -9
- package/cjs/react-desc-prop-types.js +0 -56
- package/cjs/related-components/TreeViewSearchBar.js +0 -48
- package/cjs/sharedTypes.js +0 -2
- package/cjs/utils/array-helpers.js +0 -24
- package/cjs/utils/group-expands-helpers.js +0 -111
- package/cjs/utils/keyboard-helpers.js +0 -175
- package/cjs/utils/object-helpers.js +0 -69
- package/cjs/utils/refs-helpers.js +0 -31
- package/cjs/utils/selectable-helper.js +0 -80
- package/cjs/utils/string-helpers.js +0 -7
- package/cjs/utils/tree-helpers.js +0 -220
- package/cjs/utils/useInstanceRefActions.js +0 -87
- package/cjs/utils/useTree.js +0 -108
- package/esm/TreeView.js +0 -21
- package/esm/config/cssClassesConstants.js +0 -6
- package/esm/config/useTreeview.js +0 -119
- package/esm/hoc/DnDTreeContext.js +0 -14
- package/esm/hoc/SortableItemContext.js +0 -17
- package/esm/hoc/WithConditionalDnDContext.js +0 -128
- package/esm/hoc/WithDnDSortableItemContext.js +0 -61
- package/esm/index.js +0 -9
- package/esm/parts/CheckboxSelectable.js +0 -78
- package/esm/parts/ChildrenCountDisplayer.js +0 -22
- package/esm/parts/DnDHandle.js +0 -38
- package/esm/parts/DropIndicator.js +0 -68
- package/esm/parts/ExpandCaret.js +0 -85
- package/esm/parts/Icon.js +0 -29
- package/esm/parts/NestingSpace.js +0 -39
- package/esm/parts/RadioSelectable.js +0 -53
- package/esm/parts/TreeItem.js +0 -173
- package/esm/parts/TreeItemText.js +0 -99
- package/esm/parts/TreeList.js +0 -127
- package/esm/plugins/dnd/TreeDndPlugin.js +0 -3
- package/esm/plugins/dnd/index.js +0 -1
- package/esm/plugins/index.js +0 -7
- package/esm/plugins/roving/TreeRovingPlugin.js +0 -3
- package/esm/plugins/roving/index.js +0 -1
- package/esm/plugins/searchable/SearchableTreePlugin.js +0 -3
- package/esm/plugins/searchable/index.js +0 -1
- package/esm/plugins/selectable/SelectablePluginTree.js +0 -3
- package/esm/plugins/selectable/index.js +0 -1
- package/esm/plugins/toolbar/TreeToolbarPlugin.js +0 -3
- package/esm/plugins/toolbar/index.js +0 -1
- package/esm/plugins/tree/TreeDataPlugin.js +0 -3
- package/esm/plugins/tree/index.js +0 -1
- package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +0 -3
- package/esm/plugins/virtualization/index.js +0 -1
- package/esm/react-desc-prop-types.js +0 -52
- package/esm/related-components/TreeViewSearchBar.js +0 -40
- package/esm/sharedTypes.js +0 -1
- package/esm/utils/group-expands-helpers.js +0 -99
- package/esm/utils/object-helpers.js +0 -64
- package/esm/utils/refs-helpers.js +0 -27
- package/esm/utils/selectable-helper.js +0 -70
- package/esm/utils/string-helpers.js +0 -3
- package/esm/utils/tree-helpers.js +0 -205
- package/esm/utils/useTree.js +0 -99
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hoc/WithConditionalDnDContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useContext, useMemo } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { SortableContext } from '@dnd-kit/sortable';\nimport { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { DSTreeviewT } from '../react-desc-prop-types';\nimport TreeViewContext from '../TreeViewContext';\nimport { TreeItem } from '../parts/TreeItem';\nimport { DnDTreeContext } from './DnDTreeContext';\n\ntype FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;\n\nconst ensure = <T,>(argument: T | undefined | null, message = 'This should never happen'): T => {\n if (argument === undefined || argument === null) {\n throw new TypeError(message);\n }\n\n return argument;\n};\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const [lastActiveId, setLastActiveId] = React.useState('');\n\n const {\n props: { data, onOrderChange, getIsDropValid },\n flattenedItems,\n visibleItems: flattenedVisibleTree,\n withDragAndDrop,\n } = useContext(TreeViewContext);\n\n const flattenedVisibleTreeForDnD = useMemo(\n () =>\n flattenedVisibleTree.map((item, index) => ({\n uid: item.id.toString(),\n depth: (item.treeDepth ?? 1) - 1,\n realIndex: index,\n childrenCount: item.children?.length ?? 0,\n parentId: item.node.parent?.model?.id?.toString() ?? null,\n original: item,\n })),\n [flattenedVisibleTree],\n );\n\n const onReorder = useCallback(\n (tree: DSTreeviewT.DndItem[], indexes: { targetIndex: number; fromIndex: number }) => {\n // Pull the row's original data into an object\n const nodes: Record<DSTreeviewT.StringOrNum, DSTreeviewT.SimpleItem> = {};\n tree.forEach((item) => {\n const originalItem = item.original;\n originalItem.children = [];\n nodes[item.uid] = item.original;\n });\n\n const newUserTree: DSTreeviewT.SimpleItem[] = [];\n tree.forEach((item) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (item.parentId !== null && item.parentId !== undefined && item.parentId !== '__ds_tree_root') {\n const parentNode = nodes[item.parentId];\n parentNode.children?.push(item.original);\n } else if (item.uid !== '__ds_tree_root') newUserTree.push(item.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);\n },\n [onOrderChange, data, flattenedItems],\n );\n\n const {\n dndContextProps,\n sortableContextProps,\n activeId,\n activeIndex,\n depth,\n dropIndicatorPosition,\n visibleItems,\n isDropValid,\n } = useTreeDndkitConfig({\n flattenedItems,\n visibleItems: flattenedVisibleTreeForDnD,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n getIsDropValid,\n maxDragAndDropLevel: Infinity,\n });\n\n if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);\n\n if (withDragAndDrop)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider\n value={{\n activeIndex,\n depth,\n visibleItems: visibleItems.map((item) => item.original) as DSTreeviewT.Item[],\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n }}\n >\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n <DragOverlay style={{ width: 'auto' }}>\n {activeId ? (\n <TreeItem\n itemIndex={activeIndex}\n item={ensure(flattenedVisibleTree.find((item) => item.id.toString() === activeId))}\n isDragOverlay\n />\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n return <Component {...props} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwD;AACxD,kBAAwC;AACxC,sBAAgC;AAChC,8BAAoC;AAEpC,6BAA4B;AAC5B,sBAAyB;AACzB,4BAA+B;AAI/B,MAAM,SAAS,CAAK,UAAgC,UAAU,+BAAkC;AAC9F,MAAI,aAAa,UAAa,aAAa,MAAM;AAC/C,UAAM,IAAI,UAAU;AAAA;AAGtB,SAAO;AAAA;AAIF,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM,CAAC,cAAc,mBAAmB,qBAAM,SAAS;AAEvD,QAAM;AAAA,IACJ,OAAO,EAAE,MAAM,eAAe;AAAA,IAC9B;AAAA,IACA,cAAc;AAAA,IACd;AAAA,MACE,6BAAW;AAEf,QAAM,6BAA6B,0BACjC,MACE,qBAAqB,IAAI,CAAC,MAAM,UAAW;AAAA,IACzC,KAAK,KAAK,GAAG;AAAA,IACb,OAAQ,MAAK,aAAa,KAAK;AAAA,IAC/B,WAAW;AAAA,IACX,eAAe,KAAK,UAAU,UAAU;AAAA,IACxC,UAAU,KAAK,KAAK,QAAQ,OAAO,IAAI,cAAc;AAAA,IACrD,UAAU;AAAA,OAEd,CAAC;AAGH,QAAM,YAAY,8BAChB,CAAC,MAA6B,YAAwD;AAEpF,UAAM,QAAiE;AACvE,SAAK,QAAQ,CAAC,SAAS;AACrB,YAAM,eAAe,KAAK;AAC1B,mBAAa,WAAW;AACxB,YAAM,KAAK,OAAO,KAAK;AAAA;AAGzB,UAAM,cAAwC;AAC9C,SAAK,QAAQ,CAAC,SAAS;AAGrB,UAAI,KAAK,aAAa,QAAQ,KAAK,aAAa,UAAa,KAAK,aAAa,kBAAkB;AAC/F,cAAM,aAAa,MAAM,KAAK;AAC9B,mBAAW,UAAU,KAAK,KAAK;AAAA,iBACtB,KAAK,QAAQ;AAAkB,oBAAY,KAAK,KAAK;AAAA;AAGlE,kBAAc,aAAa,MAAM,eAAe,QAAQ;AAAA,KAE1D,CAAC,eAAe,MAAM;AAGxB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,iDAAoB;AAAA,IACtB;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA;AAGvB,MAAI,iBAAiB,YAAY;AAAU,oBAAgB;AAE3D,MAAI;AACF,WACE,mDAAC,wBAAD;AAAA,SAAgB;AAAA,OACd,mDAAC,iCAAD;AAAA,SAAqB;AAAA,OACnB,mDAAC,qCAAe,UAAhB;AAAA,MACE,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,cAAc,aAAa,IAAI,CAAC,SAAS,KAAK;AAAA,QAC9C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,OAGF,mDAAC,WAAD;AAAA,SAAe;AAAA,UAGnB,mDAAC,yBAAD;AAAA,MAAa,OAAO,EAAE,OAAO;AAAA,OAC1B,WACC,mDAAC,0BAAD;AAAA,MACE,WAAW;AAAA,MACX,MAAM,OAAO,qBAAqB,KAAK,CAAC,SAAS,KAAK,GAAG,eAAe;AAAA,MACxE,eAAa;AAAA,SAEb;AAIZ,SAAO,mDAAC,WAAD;AAAA,OAAe;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var WithDnDSortableItemContext_exports = {};
|
|
29
|
+
__export(WithDnDSortableItemContext_exports, {
|
|
30
|
+
withDnDSortableItemContext: () => withDnDSortableItemContext
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
35
|
+
var import_SortableItemContext = require("./SortableItemContext");
|
|
36
|
+
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
37
|
+
var import_DnDTreeContext = require("./DnDTreeContext");
|
|
38
|
+
const withDnDSortableItemContext = (Component) => (props) => {
|
|
39
|
+
const { withDragAndDrop } = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
40
|
+
const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = (0, import_react.useContext)(import_DnDTreeContext.DnDTreeContext);
|
|
41
|
+
const id = props.item.id.toString();
|
|
42
|
+
const draggableOptions = (0, import_react.useMemo)(() => ({
|
|
43
|
+
id
|
|
44
|
+
}), [id]);
|
|
45
|
+
const useSortableHelpers = (0, import_sortable.useSortable)(draggableOptions);
|
|
46
|
+
const draggableProps = (0, import_react.useMemo)(() => {
|
|
47
|
+
if (!withDragAndDrop)
|
|
48
|
+
return false;
|
|
49
|
+
const { index, overIndex } = useSortableHelpers;
|
|
50
|
+
return {
|
|
51
|
+
...useSortableHelpers,
|
|
52
|
+
shouldShowDropIndicatorPosition: overIndex === index,
|
|
53
|
+
dropIndicatorPosition,
|
|
54
|
+
lastActiveId,
|
|
55
|
+
setLastActiveId,
|
|
56
|
+
isDropValid
|
|
57
|
+
};
|
|
58
|
+
}, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]);
|
|
59
|
+
const ctx = (0, import_react.useMemo)(() => ({
|
|
60
|
+
draggableProps
|
|
61
|
+
}), [draggableProps]);
|
|
62
|
+
return /* @__PURE__ */ import_react.default.createElement(import_SortableItemContext.SortableItemContext.Provider, {
|
|
63
|
+
value: ctx
|
|
64
|
+
}, /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
65
|
+
...props
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
module.exports = __toCommonJS(WithDnDSortableItemContext_exports);
|
|
69
|
+
//# sourceMappingURL=WithDnDSortableItemContext.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hoc/WithDnDSortableItemContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { SortableItemContext, SortableItemContextType } from './SortableItemContext';\nimport TreeViewContext from '../TreeViewContext';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport { DSTreeviewT } from '../react-desc-prop-types';\n\ntype FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;\n\nexport const withDnDSortableItemContext: FunctionalHOC = (Component) => (props: any) => {\n const { withDragAndDrop } = useContext(TreeViewContext);\n const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = useContext(DnDTreeContext);\n\n const id = (props as { item: DSTreeviewT.Item }).item.id.toString();\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id,\n }),\n [id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!withDragAndDrop) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n };\n }, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA2C;AAC3C,sBAA4B;AAC5B,iCAA6D;AAC7D,6BAA4B;AAC5B,4BAA+B;AAKxB,MAAM,6BAA4C,CAAC,cAAc,CAAC,UAAe;AACtF,QAAM,EAAE,oBAAoB,6BAAW;AACvC,QAAM,EAAE,uBAAuB,cAAc,iBAAiB,gBAAgB,6BAAW;AAEzF,QAAM,KAAM,MAAqC,KAAK,GAAG;AAGzD,QAAM,mBAAmB,0BACvB,MAAO;AAAA,IACL;AAAA,MAEF,CAAC;AAGH,QAAM,qBAAqB,iCAAY;AAGvC,QAAM,iBAAiB,0BAAQ,MAAM;AACnC,QAAI,CAAC;AAAiB,aAAO;AAE7B,UAAM,EAAE,OAAO,cAAc;AAE7B,WAAO;AAAA,SACF;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,KAED,CAAC,iBAAiB,oBAAoB,uBAAuB,cAAc,iBAAiB;AAK/F,QAAM,MAA+B,0BACnC,MAAO;AAAA,IACL;AAAA,MAEF,CAAC;AAGH,SACE,mDAAC,+CAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KACnC,mDAAC,WAAD;AAAA,OAAe;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
TreeViewSearchBar: () => import_TreeViewSearchBar.TreeViewSearchBar
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
__reExport(src_exports, require("./TreeView"));
|
|
34
|
+
__reExport(src_exports, require("./plugins"));
|
|
35
|
+
var import_TreeViewSearchBar = require("./related-components/TreeViewSearchBar");
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './TreeView';\nexport * from './plugins';\n\nexport { TreeViewSearchBar } from './related-components/TreeViewSearchBar';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AAEd,+BAAkC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var CheckboxSelectable_exports = {};
|
|
29
|
+
__export(CheckboxSelectable_exports, {
|
|
30
|
+
default: () => CheckboxSelectable_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
35
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
36
|
+
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
37
|
+
var import_selectable_helper = require("../utils/selectable-helper");
|
|
38
|
+
var import_object_helpers = require("../utils/object-helpers");
|
|
39
|
+
const StyledCheckboxWrapper = import_styled_components.default.span`
|
|
40
|
+
padding-top: 3px;
|
|
41
|
+
`;
|
|
42
|
+
function CheckboxSelectable(props) {
|
|
43
|
+
const { item, itemIndex } = props;
|
|
44
|
+
const { id } = item;
|
|
45
|
+
const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
46
|
+
const {
|
|
47
|
+
props: { onSelectionChange, isItemDisabled },
|
|
48
|
+
virtualListHelpers: { scrollToIndex },
|
|
49
|
+
triggerTreeRerender,
|
|
50
|
+
selectedCheckboxes,
|
|
51
|
+
setSelectedCheckboxes
|
|
52
|
+
} = ctx;
|
|
53
|
+
const onCheckboxChange = (0, import_react.useCallback)(() => {
|
|
54
|
+
const newSelections = (0, import_selectable_helper.toggleCheckboxItem)(item);
|
|
55
|
+
const newSelectionHasmap = (0, import_object_helpers.filterObject)({ ...selectedCheckboxes, ...newSelections }, (value) => value !== false);
|
|
56
|
+
setSelectedCheckboxes(newSelectionHasmap);
|
|
57
|
+
triggerTreeRerender();
|
|
58
|
+
const indexAndScrollTo = {
|
|
59
|
+
scrollToItem: () => {
|
|
60
|
+
if (typeof item.virtualIndex === "number")
|
|
61
|
+
scrollToIndex(item.virtualIndex);
|
|
62
|
+
},
|
|
63
|
+
itemIndex
|
|
64
|
+
};
|
|
65
|
+
if (onSelectionChange)
|
|
66
|
+
onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
67
|
+
}, [
|
|
68
|
+
item,
|
|
69
|
+
triggerTreeRerender,
|
|
70
|
+
onSelectionChange,
|
|
71
|
+
itemIndex,
|
|
72
|
+
scrollToIndex,
|
|
73
|
+
selectedCheckboxes,
|
|
74
|
+
setSelectedCheckboxes
|
|
75
|
+
]);
|
|
76
|
+
const isChecked = (0, import_react.useMemo)(() => {
|
|
77
|
+
if (selectedCheckboxes[id] === "mixed") {
|
|
78
|
+
return "mixed";
|
|
79
|
+
}
|
|
80
|
+
if (selectedCheckboxes[id] === true) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}, [selectedCheckboxes, id]);
|
|
85
|
+
const isDisabled = (0, import_react.useMemo)(() => isItemDisabled(item), [item, isItemDisabled]);
|
|
86
|
+
return /* @__PURE__ */ import_react.default.createElement(StyledCheckboxWrapper, null, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSCheckbox, {
|
|
87
|
+
checked: isChecked,
|
|
88
|
+
disabled: isDisabled,
|
|
89
|
+
className: "em-ds-tree-item-checkbox",
|
|
90
|
+
"data-testid": "tree-item-checkbox",
|
|
91
|
+
onChange: onCheckboxChange,
|
|
92
|
+
tabIndex: "0"
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
var CheckboxSelectable_default = CheckboxSelectable;
|
|
96
|
+
module.exports = __toCommonJS(CheckboxSelectable_exports);
|
|
97
|
+
//# sourceMappingURL=CheckboxSelectable.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/CheckboxSelectable.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback, useMemo } from 'react';\nimport { DSCheckbox } from '@elliemae/ds-form';\nimport styled from 'styled-components';\nimport TreeViewContext from '../TreeViewContext';\nimport { toggleCheckboxItem } from '../utils/selectable-helper';\nimport { filterObject } from '../utils/object-helpers';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nconst StyledCheckboxWrapper = styled.span`\n padding-top: 3px;\n`;\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n}\nfunction CheckboxSelectable(props: PropsT): JSX.Element | null {\n const { item, itemIndex } = props;\n const { id } = item;\n\n const ctx = useContext(TreeViewContext);\n const {\n props: { onSelectionChange, isItemDisabled },\n virtualListHelpers: { scrollToIndex },\n triggerTreeRerender,\n selectedCheckboxes,\n setSelectedCheckboxes,\n } = ctx;\n\n const onCheckboxChange = useCallback(() => {\n const newSelections = toggleCheckboxItem(item);\n const newSelectionHasmap = filterObject<DSTreeviewT.SelectionState>(\n { ...selectedCheckboxes, ...newSelections },\n (value) => value !== false,\n );\n setSelectedCheckboxes(newSelectionHasmap);\n triggerTreeRerender();\n\n const indexAndScrollTo = {\n scrollToItem: () => {\n if (typeof item.virtualIndex === 'number') scrollToIndex(item.virtualIndex);\n },\n itemIndex,\n };\n if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);\n }, [\n item,\n triggerTreeRerender,\n onSelectionChange,\n itemIndex,\n scrollToIndex,\n selectedCheckboxes,\n setSelectedCheckboxes,\n ]);\n const isChecked = useMemo(() => {\n if (selectedCheckboxes[id] === 'mixed') {\n return 'mixed' as const;\n }\n if (selectedCheckboxes[id] === true) {\n return true;\n }\n return false;\n }, [selectedCheckboxes, id]);\n\n const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);\n\n return (\n <StyledCheckboxWrapper>\n <DSCheckbox\n checked={isChecked}\n disabled={isDisabled}\n className=\"em-ds-tree-item-checkbox\"\n data-testid=\"tree-item-checkbox\"\n onChange={onCheckboxChange}\n tabIndex=\"0\"\n />\n </StyledCheckboxWrapper>\n );\n}\n\nexport default CheckboxSelectable;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwD;AACxD,qBAA2B;AAC3B,+BAAmB;AACnB,6BAA4B;AAC5B,+BAAmC;AACnC,4BAA6B;AAE7B,MAAM,wBAAwB,iCAAO;AAAA;AAAA;AAOrC,4BAA4B,OAAmC;AAC7D,QAAM,EAAE,MAAM,cAAc;AAC5B,QAAM,EAAE,OAAO;AAEf,QAAM,MAAM,6BAAW;AACvB,QAAM;AAAA,IACJ,OAAO,EAAE,mBAAmB;AAAA,IAC5B,oBAAoB,EAAE;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,QAAM,mBAAmB,8BAAY,MAAM;AACzC,UAAM,gBAAgB,iDAAmB;AACzC,UAAM,qBAAqB,wCACzB,KAAK,uBAAuB,iBAC5B,CAAC,UAAU,UAAU;AAEvB,0BAAsB;AACtB;AAEA,UAAM,mBAAmB;AAAA,MACvB,cAAc,MAAM;AAClB,YAAI,OAAO,KAAK,iBAAiB;AAAU,wBAAc,KAAK;AAAA;AAAA,MAEhE;AAAA;AAEF,QAAI;AAAmB,wBAAkB,oBAAoB,MAAM;AAAA,KAClE;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAEF,QAAM,YAAY,0BAAQ,MAAM;AAC9B,QAAI,mBAAmB,QAAQ,SAAS;AACtC,aAAO;AAAA;AAET,QAAI,mBAAmB,QAAQ,MAAM;AACnC,aAAO;AAAA;AAET,WAAO;AAAA,KACN,CAAC,oBAAoB;AAExB,QAAM,aAAa,0BAAQ,MAAM,eAAe,OAAO,CAAC,MAAM;AAE9D,SACE,mDAAC,uBAAD,MACE,mDAAC,2BAAD;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,UAAU;AAAA,IACV,UAAS;AAAA;AAAA;AAMjB,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var ChildrenCountDisplayer_exports = {};
|
|
29
|
+
__export(ChildrenCountDisplayer_exports, {
|
|
30
|
+
ChildrenCountDisplayer: () => ChildrenCountDisplayer
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_cssClassesConstants = require("../config/cssClassesConstants");
|
|
35
|
+
const className = `${import_cssClassesConstants.DSTreeViewPrefix}-${import_cssClassesConstants.treeItemBlockName}-children-count-displayer`;
|
|
36
|
+
const ChildrenCountDisplayer = (props) => {
|
|
37
|
+
const { item } = props;
|
|
38
|
+
const { isGroup, children } = item;
|
|
39
|
+
if (!isGroup)
|
|
40
|
+
return null;
|
|
41
|
+
return /* @__PURE__ */ import_react.default.createElement("span", {
|
|
42
|
+
"data-testid": "tree-item-children-count-displayer",
|
|
43
|
+
className
|
|
44
|
+
}, ` | ${children.length} Items`);
|
|
45
|
+
};
|
|
46
|
+
module.exports = __toCommonJS(ChildrenCountDisplayer_exports);
|
|
47
|
+
//# sourceMappingURL=ChildrenCountDisplayer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/ChildrenCountDisplayer.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\n\nconst className = `${DSTreeViewPrefix}-${treeItemBlockName}-children-count-displayer`;\n\ninterface PropsT {\n item: DSTreeviewT.Item;\n}\n\nexport const ChildrenCountDisplayer = (props: PropsT): JSX.Element | null => {\n const { item } = props;\n const { isGroup, children } = item;\n\n if (!isGroup) return null;\n // return ` | ${children.length} Items`;\n return (\n <span data-testid=\"tree-item-children-count-displayer\" className={className}>{` | ${children.length} Items`}</span>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,iCAAoD;AAGpD,MAAM,YAAY,GAAG,+CAAoB;AAMlC,MAAM,yBAAyB,CAAC,UAAsC;AAC3E,QAAM,EAAE,SAAS;AACjB,QAAM,EAAE,SAAS,aAAa;AAE9B,MAAI,CAAC;AAAS,WAAO;AAErB,SACE,mDAAC,QAAD;AAAA,IAAM,eAAY;AAAA,IAAqC;AAAA,KAAuB,MAAM,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var DnDHandle_exports = {};
|
|
29
|
+
__export(DnDHandle_exports, {
|
|
30
|
+
DnDHandle: () => DnDHandle
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
35
|
+
var import_SortableItemContext = require("../hoc/SortableItemContext");
|
|
36
|
+
const DnDHandle = ({ id, isDragOverlay }) => {
|
|
37
|
+
const { draggableProps } = (0, import_react.useContext)(import_SortableItemContext.SortableItemContext);
|
|
38
|
+
const isDragging = draggableProps && draggableProps.isDragging;
|
|
39
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.GripperVertical, {
|
|
40
|
+
role: "button",
|
|
41
|
+
...draggableProps && {
|
|
42
|
+
...draggableProps.listeners,
|
|
43
|
+
...draggableProps.attributes
|
|
44
|
+
},
|
|
45
|
+
"data-testid": "drag-handle",
|
|
46
|
+
"data-isactive": draggableProps && !!draggableProps.active,
|
|
47
|
+
"data-isdragoverlay": isDragOverlay,
|
|
48
|
+
id: `${id}-drag-handle`,
|
|
49
|
+
key: `${id}-drag-handle`,
|
|
50
|
+
className: `drag-handle ${isDragging ? "" : "focuseable"}`,
|
|
51
|
+
color: ["brand-primary", "800"],
|
|
52
|
+
size: "s",
|
|
53
|
+
tabIndex: 0
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
module.exports = __toCommonJS(DnDHandle_exports);
|
|
57
|
+
//# sourceMappingURL=DnDHandle.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/DnDHandle.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { GripperVertical } from '@elliemae/ds-icons';\nimport { SortableItemContext } from '../hoc/SortableItemContext';\nimport { DSTreeviewT } from '../react-desc-prop-types';\n\nexport const DnDHandle = ({ id, isDragOverlay }: { id: DSTreeviewT.StringOrNum; isDragOverlay: boolean }) => {\n const { draggableProps } = useContext(SortableItemContext);\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n return (\n <GripperVertical\n role=\"button\"\n {...(draggableProps && {\n ...draggableProps.listeners,\n ...draggableProps.attributes,\n })}\n data-testid=\"drag-handle\"\n data-isactive={draggableProps && !!draggableProps.active}\n data-isdragoverlay={isDragOverlay}\n id={`${id}-drag-handle`}\n key={`${id}-drag-handle`}\n className={`drag-handle ${isDragging ? '' : 'focuseable'}`}\n color={['brand-primary', '800']}\n size=\"s\"\n tabIndex={0}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,sBAAgC;AAChC,iCAAoC;AAG7B,MAAM,YAAY,CAAC,EAAE,IAAI,oBAA6E;AAC3G,QAAM,EAAE,mBAAmB,6BAAW;AAEtC,QAAM,aAAa,kBAAkB,eAAe;AAEpD,SACE,mDAAC,iCAAD;AAAA,IACE,MAAK;AAAA,OACA,kBAAkB;AAAA,SAClB,eAAe;AAAA,SACf,eAAe;AAAA;AAAA,IAEpB,eAAY;AAAA,IACZ,iBAAe,kBAAkB,CAAC,CAAC,eAAe;AAAA,IAClD,sBAAoB;AAAA,IACpB,IAAI,GAAG;AAAA,IACP,KAAK,GAAG;AAAA,IACR,WAAW,eAAe,aAAa,KAAK;AAAA,IAC5C,OAAO,CAAC,iBAAiB;AAAA,IACzB,MAAK;AAAA,IACL,UAAU;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var DropIndicator_exports = {};
|
|
29
|
+
__export(DropIndicator_exports, {
|
|
30
|
+
default: () => DropIndicator_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
35
|
+
var import_SortableItemContext = require("../hoc/SortableItemContext");
|
|
36
|
+
const getPositionStyles = ({ dropIndicatorPosition }) => `
|
|
37
|
+
top: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "0" : "unset"};
|
|
38
|
+
bottom: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "0" : "unset"};
|
|
39
|
+
left: -2px;
|
|
40
|
+
`;
|
|
41
|
+
const getCircleStyles = ({ dropIndicatorPosition }) => ({
|
|
42
|
+
position: "absolute",
|
|
43
|
+
zIndex: 20,
|
|
44
|
+
top: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "unset" : "-2px",
|
|
45
|
+
bottom: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "unset" : "-2px",
|
|
46
|
+
left: "0px",
|
|
47
|
+
opacity: 1
|
|
48
|
+
});
|
|
49
|
+
const StyledIndicator = import_styled_components.default.div`
|
|
50
|
+
position: absolute;
|
|
51
|
+
${getPositionStyles}
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
width: ${(props) => props.vertical ? "2px" : "100%"};
|
|
54
|
+
height: ${(props) => props.vertical ? "100%" : "2px"};
|
|
55
|
+
background-color: ${({ isDropValid, theme }) => isDropValid ? theme.colors.brand[600] : theme.colors.danger[900]};
|
|
56
|
+
z-index: 20;
|
|
57
|
+
`;
|
|
58
|
+
const CircleIndicator = (style, isDropValid) => /* @__PURE__ */ import_react.default.createElement("svg", {
|
|
59
|
+
height: "6",
|
|
60
|
+
width: "6",
|
|
61
|
+
style
|
|
62
|
+
}, /* @__PURE__ */ import_react.default.createElement("circle", {
|
|
63
|
+
cx: "3",
|
|
64
|
+
cy: "3",
|
|
65
|
+
r: "3",
|
|
66
|
+
strokeWidth: "0",
|
|
67
|
+
fill: isDropValid ? "#1E79C2" : "#C64252"
|
|
68
|
+
}));
|
|
69
|
+
const DropIndicator = ({ dropIndicatorPosition, isLast, isDropValid }) => {
|
|
70
|
+
if (![import_SortableItemContext.DropIndicatorPosition.After, import_SortableItemContext.DropIndicatorPosition.Before].includes(dropIndicatorPosition))
|
|
71
|
+
return null;
|
|
72
|
+
const safeDropIndicatorPosition = isLast ? import_SortableItemContext.DropIndicatorPosition.Before : dropIndicatorPosition;
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid), /* @__PURE__ */ import_react.default.createElement(StyledIndicator, {
|
|
74
|
+
dropIndicatorPosition: safeDropIndicatorPosition,
|
|
75
|
+
isDropValid
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
var DropIndicator_default = DropIndicator;
|
|
79
|
+
module.exports = __toCommonJS(DropIndicator_exports);
|
|
80
|
+
//# sourceMappingURL=DropIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/DropIndicator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport styled from 'styled-components';\nimport { DropIndicatorPosition } from '../hoc/SortableItemContext';\n\ninterface DropIndicatorProps {\n vertical?: boolean;\n dropIndicatorPosition: DropIndicatorPosition | false;\n isLast?: boolean;\n isDropValid?: boolean;\n}\n\nconst getPositionStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => `\n top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n left: -2px;\n `;\n\nconst getCircleStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => ({\n position: 'absolute',\n zIndex: 20,\n top: dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n left: '0px',\n opacity: 1,\n});\n\nconst StyledIndicator = styled.div<DropIndicatorProps>`\n position: absolute;\n ${getPositionStyles}\n box-sizing: border-box;\n width: ${(props) => (props.vertical ? '2px' : '100%')};\n height: ${(props) => (props.vertical ? '100%' : '2px')};\n background-color: ${({ isDropValid, theme }) => (isDropValid ? theme.colors.brand[600] : theme.colors.danger[900])};\n z-index: 20;\n`;\n\nconst CircleIndicator = (style: Record<string, unknown>, isDropValid: boolean | null | undefined) => (\n <svg height=\"6\" width=\"6\" style={style}>\n <circle cx=\"3\" cy=\"3\" r=\"3\" strokeWidth=\"0\" fill={isDropValid ? '#1E79C2' : '#C64252'} />\n </svg>\n);\n\nconst DropIndicator: React.ComponentType<DropIndicatorProps> = ({ dropIndicatorPosition, isLast, isDropValid }) => {\n if (\n ![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(\n dropIndicatorPosition as DropIndicatorPosition,\n )\n )\n return null;\n\n const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;\n\n return (\n <>\n {CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid)}\n <StyledIndicator dropIndicatorPosition={safeDropIndicatorPosition} isDropValid={isDropValid} />\n </>\n );\n};\n\nexport default DropIndicator;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,+BAAmB;AACnB,iCAAsC;AAStC,MAAM,oBAAoB,CAAC,EAAE,4BAAgD;AAAA,aAChE,0BAA0B,iDAAsB,SAAS,MAAM;AAAA,gBAC5D,0BAA0B,iDAAsB,QAAQ,MAAM;AAAA;AAAA;AAI9E,MAAM,kBAAkB,CAAC,EAAE,4BAAiD;AAAA,EAC1E,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,KAAK,0BAA0B,iDAAsB,QAAQ,UAAU;AAAA,EACvE,QAAQ,0BAA0B,iDAAsB,SAAS,UAAU;AAAA,EAC3E,MAAM;AAAA,EACN,SAAS;AAAA;AAGX,MAAM,kBAAkB,iCAAO;AAAA;AAAA,IAE3B;AAAA;AAAA,WAEO,CAAC,UAAW,MAAM,WAAW,QAAQ;AAAA,YACpC,CAAC,UAAW,MAAM,WAAW,SAAS;AAAA,sBAC5B,CAAC,EAAE,aAAa,YAAa,cAAc,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,OAAO;AAAA;AAAA;AAI/G,MAAM,kBAAkB,CAAC,OAAgC,gBACvD,mDAAC,OAAD;AAAA,EAAK,QAAO;AAAA,EAAI,OAAM;AAAA,EAAI;AAAA,GACxB,mDAAC,UAAD;AAAA,EAAQ,IAAG;AAAA,EAAI,IAAG;AAAA,EAAI,GAAE;AAAA,EAAI,aAAY;AAAA,EAAI,MAAM,cAAc,YAAY;AAAA;AAIhF,MAAM,gBAAyD,CAAC,EAAE,uBAAuB,QAAQ,kBAAkB;AACjH,MACE,CAAC,CAAC,iDAAsB,OAAO,iDAAsB,QAAQ,SAC3D;AAGF,WAAO;AAET,QAAM,4BAA4B,SAAS,iDAAsB,SAAS;AAE1E,SACE,wFACG,gBAAgB,gBAAgB,EAAE,uBAAuB,8BAA8B,cACxF,mDAAC,iBAAD;AAAA,IAAiB,uBAAuB;AAAA,IAA2B;AAAA;AAAA;AAKzE,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var ExpandCaret_exports = {};
|
|
29
|
+
__export(ExpandCaret_exports, {
|
|
30
|
+
ExpandCaret: () => ExpandCaret
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_button = __toESM(require("@elliemae/ds-button"));
|
|
35
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
36
|
+
var import_group_expands_helpers = require("../utils/group-expands-helpers");
|
|
37
|
+
var import_tree_helpers = require("../utils/tree-helpers");
|
|
38
|
+
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
39
|
+
const ExpandCaret = (props) => {
|
|
40
|
+
const defaultHandleExpandGroup = (0, import_react.useCallback)(import_group_expands_helpers.toggleItemExpand, []);
|
|
41
|
+
const { item } = props;
|
|
42
|
+
const { id, isExpanded, isGroup, children } = item;
|
|
43
|
+
const isGroupOrHasChildrens = isGroup || Array.isArray(children) && children.length > 0;
|
|
44
|
+
const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
45
|
+
const {
|
|
46
|
+
props: { onItemFocus },
|
|
47
|
+
handleExpandGroup = defaultHandleExpandGroup,
|
|
48
|
+
triggerTreeRerender,
|
|
49
|
+
updateUserExpandedState,
|
|
50
|
+
setLatestToggledItem,
|
|
51
|
+
setFocusedItem,
|
|
52
|
+
virtualListHelpers: { scrollToIndex }
|
|
53
|
+
} = ctx;
|
|
54
|
+
if (isGroupOrHasChildrens)
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
|
|
56
|
+
buttonType: "text",
|
|
57
|
+
className: "expandable-arrow",
|
|
58
|
+
"data-testid": "tree-item-expand-toggle",
|
|
59
|
+
key: `${id}-expand-addon`,
|
|
60
|
+
icon: isExpanded ? /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ArrowheadDown, {
|
|
61
|
+
size: "s",
|
|
62
|
+
"data-testid": "ic-arrow-head-down"
|
|
63
|
+
}) : /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ArrowheadRight, {
|
|
64
|
+
size: "s",
|
|
65
|
+
"data-testid": "ic-arrow-head-right"
|
|
66
|
+
}),
|
|
67
|
+
onMouseDown: (e) => {
|
|
68
|
+
if (e) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
if (e)
|
|
75
|
+
handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);
|
|
76
|
+
setLatestToggledItem(item);
|
|
77
|
+
const itemVitualIndex = item.virtualIndex;
|
|
78
|
+
if (typeof itemVitualIndex === "number") {
|
|
79
|
+
onItemFocus({
|
|
80
|
+
itemIndex: itemVitualIndex,
|
|
81
|
+
scrollToItem: (opts = { align: "start" }) => scrollToIndex(itemVitualIndex, opts),
|
|
82
|
+
item
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
setFocusedItem(item);
|
|
86
|
+
(0, import_tree_helpers.focusItem)(item);
|
|
87
|
+
},
|
|
88
|
+
size: "s",
|
|
89
|
+
tabIndex: -1
|
|
90
|
+
});
|
|
91
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
92
|
+
style: { width: "24px" }
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
module.exports = __toCommonJS(ExpandCaret_exports);
|
|
96
|
+
//# sourceMappingURL=ExpandCaret.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/ExpandCaret.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback } from 'react';\nimport Button from '@elliemae/ds-button';\nimport { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';\nimport { toggleItemExpand } from '../utils/group-expands-helpers';\nimport { focusItem } from '../utils/tree-helpers';\nimport TreeViewContext from '../TreeViewContext';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\n\ninterface PropsT {\n item: DSTreeviewT.Item;\n}\n\nexport const ExpandCaret = (props: PropsT): JSX.Element | null => {\n const defaultHandleExpandGroup = useCallback(toggleItemExpand, []);\n const { item } = props;\n const { id, isExpanded, isGroup, children } = item;\n const isGroupOrHasChildrens = isGroup || (Array.isArray(children) && children.length > 0);\n const ctx = useContext(TreeViewContext);\n const {\n props: { onItemFocus },\n handleExpandGroup = defaultHandleExpandGroup,\n triggerTreeRerender,\n updateUserExpandedState,\n setLatestToggledItem,\n setFocusedItem,\n virtualListHelpers: { scrollToIndex },\n } = ctx;\n\n if (isGroupOrHasChildrens)\n return (\n <Button\n buttonType=\"text\"\n className=\"expandable-arrow\"\n data-testid=\"tree-item-expand-toggle\"\n key={`${id}-expand-addon`}\n icon={\n isExpanded ? (\n <ArrowheadDown size=\"s\" data-testid=\"ic-arrow-head-down\" />\n ) : (\n <ArrowheadRight size=\"s\" data-testid=\"ic-arrow-head-right\" />\n )\n }\n onMouseDown={(e: React.MouseEvent) => {\n // prevent focusing the caret\n if (e) {\n e.preventDefault();\n }\n }}\n onClick={(e) => {\n e.stopPropagation();\n if (e) handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);\n setLatestToggledItem(item);\n const itemVitualIndex = item.virtualIndex;\n if (typeof itemVitualIndex === 'number') {\n onItemFocus({\n itemIndex: itemVitualIndex,\n scrollToItem: (opts = { align: 'start' }) => scrollToIndex(itemVitualIndex, opts),\n item,\n });\n }\n setFocusedItem(item);\n focusItem(item);\n }}\n size=\"s\"\n tabIndex={-1}\n />\n );\n return <div style={{ width: '24px' }} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAC/C,uBAAmB;AACnB,sBAA8C;AAC9C,mCAAiC;AACjC,0BAA0B;AAC1B,6BAA4B;AAOrB,MAAM,cAAc,CAAC,UAAsC;AAChE,QAAM,2BAA2B,8BAAY,+CAAkB;AAC/D,QAAM,EAAE,SAAS;AACjB,QAAM,EAAE,IAAI,YAAY,SAAS,aAAa;AAC9C,QAAM,wBAAwB,WAAY,MAAM,QAAQ,aAAa,SAAS,SAAS;AACvF,QAAM,MAAM,6BAAW;AACvB,QAAM;AAAA,IACJ,OAAO,EAAE;AAAA,IACT,oBAAoB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,EAAE;AAAA,MACpB;AAEJ,MAAI;AACF,WACE,mDAAC,0BAAD;AAAA,MACE,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,KAAK,GAAG;AAAA,MACR,MACE,aACE,mDAAC,+BAAD;AAAA,QAAe,MAAK;AAAA,QAAI,eAAY;AAAA,WAEpC,mDAAC,gCAAD;AAAA,QAAgB,MAAK;AAAA,QAAI,eAAY;AAAA;AAAA,MAGzC,aAAa,CAAC,MAAwB;AAEpC,YAAI,GAAG;AACL,YAAE;AAAA;AAAA;AAAA,MAGN,SAAS,CAAC,MAAM;AACd,UAAE;AACF,YAAI;AAAG,4BAAkB,MAAM,qBAAqB,yBAAyB,eAAe;AAC5F,6BAAqB;AACrB,cAAM,kBAAkB,KAAK;AAC7B,YAAI,OAAO,oBAAoB,UAAU;AACvC,sBAAY;AAAA,YACV,WAAW;AAAA,YACX,cAAc,CAAC,OAAO,EAAE,OAAO,cAAc,cAAc,iBAAiB;AAAA,YAC5E;AAAA;AAAA;AAGJ,uBAAe;AACf,2CAAU;AAAA;AAAA,MAEZ,MAAK;AAAA,MACL,UAAU;AAAA;AAGhB,SAAO,mDAAC,OAAD;AAAA,IAAK,OAAO,EAAE,OAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|