@elliemae/ds-treeview 3.13.1-rc.1 → 3.13.1

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 (41) hide show
  1. package/dist/types/TreeView.d.ts +7 -0
  2. package/dist/types/TreeViewContext.d.ts +17 -0
  3. package/dist/types/config/cssClassesConstants.d.ts +4 -0
  4. package/dist/types/config/useTreeview.d.ts +7 -0
  5. package/dist/types/hoc/DnDTreeContext.d.ts +12 -0
  6. package/dist/types/hoc/SortableItemContext.d.ts +17 -0
  7. package/dist/types/hoc/WithConditionalDnDContext.d.ts +4 -0
  8. package/dist/types/hoc/WithDnDSortableItemContext.d.ts +4 -0
  9. package/dist/types/index.d.ts +3 -0
  10. package/dist/types/parts/CheckboxSelectable.d.ts +7 -0
  11. package/dist/types/parts/ChildrenCountDisplayer.d.ts +7 -0
  12. package/dist/types/parts/DnDHandle.d.ts +7 -0
  13. package/dist/types/parts/DropIndicator.d.ts +10 -0
  14. package/dist/types/parts/ExpandCaret.d.ts +6 -0
  15. package/dist/types/parts/Icon.d.ts +6 -0
  16. package/dist/types/parts/NestingSpace.d.ts +7 -0
  17. package/dist/types/parts/RadioSelectable.d.ts +7 -0
  18. package/dist/types/parts/TreeItem.d.ts +17 -0
  19. package/dist/types/parts/TreeItemText.d.ts +6 -0
  20. package/dist/types/parts/TreeList.d.ts +20 -0
  21. package/dist/types/plugins/dnd/TreeDndPlugin.d.ts +1 -0
  22. package/dist/types/plugins/dnd/index.d.ts +1 -0
  23. package/dist/types/plugins/index.d.ts +1 -0
  24. package/dist/types/react-desc-prop-types.d.ts +101 -0
  25. package/dist/types/related-components/TreeViewSearchBar.d.ts +15 -0
  26. package/dist/types/sharedTypes.d.ts +47 -0
  27. package/dist/types/tests/Callbacks/TreeViewMultiSelection.test.d.ts +1 -0
  28. package/dist/types/tests/Callbacks/TreeViewSingleSelection.test.d.ts +1 -0
  29. package/dist/types/tests/Callbacks/TreeViewTestExpandable.test.d.ts +1 -0
  30. package/dist/types/tests/Render/TreeViewBasicTests.test.d.ts +1 -0
  31. package/dist/types/utils/array-helpers.d.ts +2 -0
  32. package/dist/types/utils/group-expands-helpers.d.ts +14 -0
  33. package/dist/types/utils/keyboard-helpers.d.ts +6 -0
  34. package/dist/types/utils/object-helpers.d.ts +6 -0
  35. package/dist/types/utils/refs-helpers.d.ts +4 -0
  36. package/dist/types/utils/selectable-helper.d.ts +7 -0
  37. package/dist/types/utils/string-helpers.d.ts +1 -0
  38. package/dist/types/utils/tree-helpers.d.ts +28 -0
  39. package/dist/types/utils/useInstanceRefActions.d.ts +3 -0
  40. package/dist/types/utils/useTree.d.ts +14 -0
  41. package/package.json +10 -10
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from './react-desc-prop-types';
2
+ export declare const TreeView: {
3
+ (props: DSTreeviewT.Props): JSX.Element;
4
+ displayName: string;
5
+ };
6
+ declare const TreeViewWithSchema: import("@elliemae/ds-utilities/dist/types/props-helpers/propTypes/types").DocumentedReactComponent<DSTreeviewT.Props>;
7
+ export { TreeViewWithSchema };
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import type { DSTreeviewT } from './react-desc-prop-types';
3
+ import type { DSTreeviewInternalsT } from './sharedTypes';
4
+ export declare const defaultProps: DSTreeviewT.Props;
5
+ export declare const defaultRelativeMouseCoord: {
6
+ isBefore: boolean;
7
+ isAfter: boolean;
8
+ isValid: boolean;
9
+ item: null;
10
+ x: null;
11
+ y: null;
12
+ relativeElementDOMRect: null;
13
+ relativeElementIndex: null;
14
+ };
15
+ /** Context for cross component communication */
16
+ declare const TreeViewContext: import("react").Context<DSTreeviewInternalsT.CTX>;
17
+ export default TreeViewContext;
@@ -0,0 +1,4 @@
1
+ export declare const DSTreeViewPrefix = "em-ds";
2
+ export declare const treeItemBlockName = "tree-item";
3
+ export declare const treeListBlockName = "tree-list";
4
+ export declare const treeListNoItemsBn: string;
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ import type { DSTreeviewInternalsT } from '../sharedTypes';
3
+ type UseTreeviewT = (props: DSTreeviewT.Props) => {
4
+ ctx: DSTreeviewInternalsT.CTX;
5
+ };
6
+ export declare const useTreeview: UseTreeviewT;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { DSTreeviewT } from '../react-desc-prop-types';
3
+ import { DropIndicatorPosition } from './SortableItemContext';
4
+ type DnDTreeContextType = {
5
+ depth: number | undefined;
6
+ activeIndex: number | undefined;
7
+ visibleItems: DSTreeviewT.Item[] | undefined;
8
+ dropIndicatorPosition: DropIndicatorPosition;
9
+ isDropValid: boolean;
10
+ };
11
+ export declare const DnDTreeContext: import("react").Context<DnDTreeContextType>;
12
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import type { useSortable } from '@elliemae/ds-drag-and-drop';
3
+ export declare enum DropIndicatorPosition {
4
+ None = 0,
5
+ Before = 1,
6
+ After = 2,
7
+ Inside = 3
8
+ }
9
+ export type SortableItemContextType = {
10
+ draggableProps: false | (ReturnType<typeof useSortable> & {
11
+ dropIndicatorPosition: DropIndicatorPosition;
12
+ shouldShowDropIndicatorPosition: boolean;
13
+ isDropValid: boolean;
14
+ });
15
+ };
16
+ /** Context for cross component communication */
17
+ export declare const SortableItemContext: import("react").Context<SortableItemContextType>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ type FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;
3
+ export declare const withConditionalDnDRowContext: FunctionalHOC;
4
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ type FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;
3
+ export declare const withDnDSortableItemContext: FunctionalHOC;
4
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './TreeView';
2
+ export * from './plugins';
3
+ export { TreeViewSearchBar } from './related-components/TreeViewSearchBar';
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ interface PropsT {
3
+ item: DSTreeviewT.Item;
4
+ itemIndex: number;
5
+ }
6
+ declare const CheckboxSelectable: (props: PropsT) => JSX.Element | null;
7
+ export default CheckboxSelectable;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { DSTreeviewT } from '../react-desc-prop-types';
3
+ interface PropsT {
4
+ item: DSTreeviewT.Item;
5
+ }
6
+ export declare const ChildrenCountDisplayer: React.ComponentType<PropsT>;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ interface DnDHandleProps {
3
+ id: DSTreeviewT.StringOrNum;
4
+ isDragOverlay: boolean;
5
+ }
6
+ export declare const DnDHandle: ({ id, isDragOverlay }: DnDHandleProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { DropIndicatorPosition } from '../hoc/SortableItemContext';
3
+ interface DropIndicatorProps {
4
+ vertical?: boolean;
5
+ dropIndicatorPosition: DropIndicatorPosition | false;
6
+ isLast?: boolean;
7
+ isDropValid?: boolean;
8
+ }
9
+ declare const DropIndicator: React.ComponentType<DropIndicatorProps>;
10
+ export default DropIndicator;
@@ -0,0 +1,6 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ interface PropsT {
3
+ item: DSTreeviewT.Item;
4
+ }
5
+ export declare const ExpandCaret: (props: PropsT) => JSX.Element | null;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ interface PropsT {
3
+ item: DSTreeviewT.Item;
4
+ }
5
+ export declare const Icon: (props: PropsT) => JSX.Element | null;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ type NestingSpacePropsType = {
3
+ item: DSTreeviewT.Item;
4
+ spaceForNestingLevel: number;
5
+ };
6
+ export declare const NestingSpace: (props: NestingSpacePropsType) => JSX.Element | null;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ interface PropsT {
3
+ item: DSTreeviewT.Item;
4
+ itemIndex: number;
5
+ }
6
+ declare const RadioSelectable: (props: PropsT) => JSX.Element;
7
+ export default RadioSelectable;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { DSTreeviewT } from '../react-desc-prop-types';
3
+ export declare const TreeListItem: React.ComponentType<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
4
+ export declare const TreeListItemAddonsWrapper: React.ComponentType<{}>;
5
+ interface PropsT {
6
+ item: DSTreeviewT.Item;
7
+ itemIndex: number;
8
+ isDragOverlay?: boolean;
9
+ virtualItemRef?: React.RefObject<HTMLLIElement>;
10
+ itemWrapperStyle?: {
11
+ [key: string]: unknown;
12
+ };
13
+ spaceForNestingLevel?: number;
14
+ }
15
+ export declare const TreeItem: (props: PropsT) => JSX.Element;
16
+ declare const _default: (props: PropsT) => JSX.Element;
17
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ interface PropsT {
3
+ item: DSTreeviewT.Item;
4
+ }
5
+ export declare const TreeItemText: (props: PropsT) => JSX.Element;
6
+ export {};
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import React from 'react';
3
+ import type { DSTreeviewT } from '../react-desc-prop-types';
4
+ export declare const treeListNoItemsBn: string;
5
+ export declare const TreeListNoItems: React.ComponentType<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
6
+ interface UlProps extends Omit<React.ComponentProps<'ul'>, 'ref'> {
7
+ ref: React.MutableRefObject<HTMLUListElement | undefined> | undefined;
8
+ }
9
+ export declare const TreeListWrapper: React.ComponentType<UlProps>;
10
+ interface PropsT {
11
+ onMouseDragOverItem?: (opts: {
12
+ event: React.MouseEvent<HTMLLIElement>;
13
+ item: DSTreeviewT.Item;
14
+ itemIndex: number;
15
+ setIsDraggingOverThis: React.Dispatch<React.SetStateAction<boolean>>;
16
+ openFolderOnHoverTimeout: React.MutableRefObject<NodeJS.Timeout | null>;
17
+ }) => void;
18
+ }
19
+ export declare const TreeList: (props: PropsT) => JSX.Element;
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare const TreeDndPlugin = "tree-dnd";
@@ -0,0 +1 @@
1
+ export * from './TreeDndPlugin';
@@ -0,0 +1 @@
1
+ export * from './dnd';
@@ -0,0 +1,101 @@
1
+ import type { WeakValidationMap } from 'react';
2
+ import type React from 'react';
3
+ import type TreeModel from 'tree-model';
4
+ import type { useVirtual } from 'react-virtual';
5
+ export declare namespace DSTreeviewT {
6
+ type StringOrNum = string | number;
7
+ type SelectionState = boolean | 'mixed';
8
+ type SelectionItems = Record<StringOrNum, SelectionState>;
9
+ type ScrollToFunc = ReturnType<typeof useVirtual>['scrollToIndex'];
10
+ type ScrollToItemOptions = Parameters<ReturnType<typeof useVirtual>['scrollToIndex']>[1];
11
+ type ScrollToItemFunc = (options: ScrollToItemOptions) => void;
12
+ type ExpandedItems = Record<StringOrNum, true>;
13
+ interface SimpleItem {
14
+ [key: string]: unknown;
15
+ name: string;
16
+ children?: SimpleItem[];
17
+ id: StringOrNum;
18
+ }
19
+ interface Item extends SimpleItem {
20
+ children: Item[];
21
+ treeDepth?: number;
22
+ virtualIndex?: number;
23
+ isChecked?: boolean | 'mixed';
24
+ isGroup?: boolean;
25
+ isExpanded?: boolean;
26
+ childrenMatchesSearchQuery?: boolean;
27
+ matchesSearchQuery?: boolean;
28
+ nodeItemRef?: React.RefObject<HTMLLIElement>;
29
+ model: TreeModel.Node<Item>['model'];
30
+ node: TreeModel.Node<Item> & {
31
+ parent?: TreeModel.Node<Item>;
32
+ };
33
+ nodePath: TreeModel.Node<Item>[];
34
+ }
35
+ interface DndItem {
36
+ uid: string;
37
+ depth: number;
38
+ realIndex: number;
39
+ childrenCount: number;
40
+ parentId: string | null;
41
+ original: DSTreeviewT.Item;
42
+ }
43
+ interface Actions {
44
+ toggleExpandAll: (isExpand: boolean) => Promise<DSTreeviewT.Item[]>;
45
+ scrollTo: DSTreeviewT.ScrollToFunc;
46
+ setSelectedItemByVirtualIndex: (index: number) => void;
47
+ setFocusedItemByVirtualIndex: (index: number, scrollOpts: DSTreeviewT.ScrollToItemOptions & {
48
+ withScroll?: boolean;
49
+ }) => void;
50
+ }
51
+ interface InstanceRef {
52
+ actions: Actions;
53
+ }
54
+ interface DefaultProps {
55
+ plugins: string[];
56
+ selection: SelectionItems;
57
+ instanceRef: React.MutableRefObject<InstanceRef>;
58
+ isItemDisabled: (item: Item) => boolean;
59
+ disableIcons: boolean;
60
+ isMultiSelect: boolean;
61
+ isSingleSelect: boolean;
62
+ getIsDropValid: (active: DndItem, over: DndItem, dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside') => boolean;
63
+ showChildrenAmount: boolean;
64
+ isLoading: boolean;
65
+ highlightOnlyQuery: boolean;
66
+ onItemClick: (item: Item, e: React.MouseEvent<HTMLLIElement>) => void;
67
+ onItemActivate: (item: Item, e?: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
68
+ onItemFocus: (meta: {
69
+ scrollToItem: ScrollToItemFunc;
70
+ itemIndex: number;
71
+ item: Item;
72
+ }) => void;
73
+ onVisibleItemsChange: (newVisibleItems: Item[]) => void;
74
+ onOrderChange: (newData: SimpleItem[], oldData: SimpleItem[], draggedItem: DndItem) => void;
75
+ onSelectionChange: (selection: SelectionItems, item: Item, meta: {
76
+ scrollToItem: ScrollToItemFunc;
77
+ itemIndex: number;
78
+ }) => void;
79
+ onExpandChange: (expandedHashmap: ExpandedItems, itemToggled: Item | null | undefined) => void;
80
+ onInstanceRefInitialized: (instanceRef: React.MutableRefObject<InstanceRef>) => void;
81
+ rowSize: 'normal' | 'compact';
82
+ labelOverflow: 'wrap' | 'wrap-all' | 'truncate';
83
+ noItemsPlaceholder: string;
84
+ nameKey: string;
85
+ width: StringOrNum;
86
+ height: StringOrNum;
87
+ groupIcon: JSX.Element | null;
88
+ itemIcon: JSX.Element | null;
89
+ searchQuery: string;
90
+ }
91
+ interface PropsOptional {
92
+ expanded: ExpandedItems;
93
+ rightAddons: ((item: Item) => React.ReactNode | React.ReactNode[]) | JSX.Element;
94
+ }
95
+ interface PropsRequired {
96
+ data: Item[];
97
+ }
98
+ interface Props extends DefaultProps, PropsOptional, PropsRequired {
99
+ }
100
+ }
101
+ export declare const TreeViewPropTypes: WeakValidationMap<unknown>;
@@ -0,0 +1,15 @@
1
+ interface PropsT {
2
+ handleChange: (opt: {
3
+ target: {
4
+ value: string;
5
+ };
6
+ }) => void;
7
+ onNext: () => void;
8
+ onPrevious: () => void;
9
+ onClear: () => void;
10
+ currentResultIndex: number;
11
+ totalResults: number;
12
+ value: string;
13
+ }
14
+ export declare const TreeViewSearchBar: (props: PropsT) => JSX.Element;
15
+ export {};
@@ -0,0 +1,47 @@
1
+ import type TreeModel from 'tree-model';
2
+ import type { useVirtual } from 'react-virtual';
3
+ import type { SetStateAction } from 'react';
4
+ import type { DSTreeviewT } from './react-desc-prop-types';
5
+ export declare namespace DSTreeviewInternalsT {
6
+ type GenericFunc<T extends unknown[]> = (..._args: T) => void;
7
+ type DnDMovementDirectionT = 'topToBottom' | 'bottomToTop';
8
+ interface MouseCoord {
9
+ isBefore: boolean;
10
+ isAfter: boolean;
11
+ isValid: boolean;
12
+ item: DSTreeviewT.Item | null;
13
+ x: number | null;
14
+ y: number | null;
15
+ relativeElementDOMRect: DOMRect | null;
16
+ relativeElementIndex: number | null;
17
+ }
18
+ type StateSetter<T = unknown> = React.Dispatch<SetStateAction<T>>;
19
+ interface CTX {
20
+ props: DSTreeviewT.Props;
21
+ visibleItems: DSTreeviewT.Item[];
22
+ flattenedItems: DSTreeviewT.DndItem[];
23
+ withRadioChecks: boolean;
24
+ withCheckboxChecks: boolean;
25
+ withDragAndDrop: boolean;
26
+ triggerTreeRerender: () => void;
27
+ tree?: TreeModel;
28
+ treeRoot?: TreeModel.Node<DSTreeviewT.Item>;
29
+ virtualListHelpers: ReturnType<typeof useVirtual>;
30
+ virtualListRef?: React.MutableRefObject<HTMLUListElement | undefined>;
31
+ uniqueTreeViewUUID: string;
32
+ selectedItem: DSTreeviewT.Item | null;
33
+ setSelectedItem: StateSetter<DSTreeviewT.Item | null>;
34
+ focusedItem: DSTreeviewT.Item | null;
35
+ setFocusedItem: StateSetter<DSTreeviewT.Item | null>;
36
+ selectedCheckboxes: DSTreeviewT.SelectionItems;
37
+ setSelectedCheckboxes: StateSetter<DSTreeviewT.SelectionItems>;
38
+ expandedGroups: DSTreeviewT.ExpandedItems;
39
+ setExpandedGroups: StateSetter<DSTreeviewT.ExpandedItems>;
40
+ latestToggledItem?: DSTreeviewT.Item | null | undefined;
41
+ setLatestToggledItem: StateSetter<DSTreeviewT.Item | null>;
42
+ hoverItem: DSTreeviewT.Item | null;
43
+ setHoverItem: StateSetter<DSTreeviewT.Item | null>;
44
+ handleExpandGroup: (itemToToggle: DSTreeviewT.Item, triggerTreeRerender: () => void, updateUserExpandedState: () => void, scrollTo?: DSTreeviewT.ScrollToFunc, e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
45
+ updateUserExpandedState: () => void;
46
+ }
47
+ }
@@ -0,0 +1,2 @@
1
+ export declare const arrayMoveMutate: (array: unknown[], from: number, to: number) => void;
2
+ export declare const arrayMove: (array: unknown[], from: number, to: number) => unknown[];
@@ -0,0 +1,14 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ import type { DSTreeviewInternalsT } from '../sharedTypes';
3
+ export declare const updateExpandedState: (treeRoot: DSTreeviewT.Item['node'], onExpandChange: DSTreeviewT.Props['onExpandChange'] | null | undefined) => void;
4
+ export declare const toggleItemExpand: (itemToToggle: DSTreeviewT.Item, triggerTreeRerender: () => void, updateUserExpandedState: DSTreeviewInternalsT.CTX['updateUserExpandedState'], scrollTo?: DSTreeviewT.ScrollToFunc) => void;
5
+ export declare const expandItemModel: (modelToExpand: DSTreeviewT.Item['model']) => void;
6
+ export declare const collapseItemModel: (modelToCollapse: DSTreeviewT.Item['model']) => void;
7
+ export declare const expandAll: (treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void) => void;
8
+ export declare const collapseAll: (treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void) => void;
9
+ export declare const getToggleExpandShouldExpand: (treeRoot: DSTreeviewT.Item['node']) => boolean;
10
+ export declare const toggleExpandAllHelper: (isExpand: boolean | 'toggle', treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void, setLatestToggledItem: DSTreeviewInternalsT.CTX['setLatestToggledItem'], updateUserExpandedState: DSTreeviewInternalsT.CTX['updateUserExpandedState']) => void;
11
+ export declare const useNotifyExpandedChange: (propsWithDefaults: DSTreeviewT.Props, { latestToggledItem, expandedGroups, }: {
12
+ latestToggledItem?: DSTreeviewInternalsT.CTX['latestToggledItem'];
13
+ expandedGroups?: DSTreeviewT.ExpandedItems | undefined;
14
+ }) => void;
@@ -0,0 +1,6 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ import type { DSTreeviewInternalsT } from '../sharedTypes';
3
+ import type { SortableItemContextType } from '../hoc/SortableItemContext';
4
+ export declare const useOnItemKeyDown: (item: DSTreeviewT.Item, draggableProps: SortableItemContextType['draggableProps']) => (e: React.KeyboardEvent<HTMLLIElement>) => void;
5
+ export declare const useGlobalKeyboardListener: (func: (e: KeyboardEvent) => void) => void;
6
+ export declare const useGlobalToggleAllExpandShortcut: (treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void, setLatestToggledItem: DSTreeviewInternalsT.CTX['setLatestToggledItem'], updateUserExpandedState: DSTreeviewInternalsT.CTX['updateUserExpandedState']) => void;
@@ -0,0 +1,6 @@
1
+ export declare const unfreeze: (o: string | number | unknown[] | Date | null | undefined | Record<string, unknown>) => string | number | unknown[] | Date | Record<string, unknown> | null | undefined;
2
+ type GenericItemT<T = unknown> = {
3
+ [key: string]: T;
4
+ };
5
+ export declare function filterObject<T = unknown>(obj: GenericItemT<T>, predicate: (val: T) => boolean): GenericItemT<T>;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ type GenericMergeableRef = null | undefined | React.MutableRefObject<unknown> | ((ref: HTMLElement) => void) | false;
3
+ export declare const setMultipleRefs: (...refs: GenericMergeableRef[]) => (ref: HTMLElement) => void;
4
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ export declare const getGroupCheckState: (node: DSTreeviewT.Item['node']) => boolean | "mixed";
3
+ export declare const selectCheckboxItemModelParentsTillRoot: (modelToCheck: DSTreeviewT.Item, triggerTreeRerender?: (() => void) | null) => DSTreeviewT.SelectionItems;
4
+ export declare const toggleCheckboxItem: (itemToSelect: DSTreeviewT.Item, triggerTreeRerender?: (() => void) | null) => {
5
+ [x: string]: DSTreeviewT.SelectionState;
6
+ [x: number]: DSTreeviewT.SelectionState;
7
+ };
@@ -0,0 +1 @@
1
+ export declare const standardizeSearchQueryString: (input: string) => string;
@@ -0,0 +1,28 @@
1
+ import type TreeModel from 'tree-model';
2
+ import type { DSTreeviewT } from '../react-desc-prop-types';
3
+ export declare const walkVisibles: (node: DSTreeviewT.Item['node'], callback: (node: DSTreeviewT.Item['node']) => void, skipRoot?: boolean, highlightOnlyQuery?: boolean) => void;
4
+ export declare const walkParents: (nodePath: DSTreeviewT.Item['nodePath'], callback: (currParent: DSTreeviewT.Item['node']) => void, skipRoot?: boolean) => void;
5
+ type RecursiveCallbackT = (childNode: DSTreeviewT.Item['node'], cb?: RecursiveCallbackT, isFirst?: boolean) => void;
6
+ export declare const walkAllNodeChildren: (node: DSTreeviewT.Item['node'], callback: RecursiveCallbackT, isFirst?: boolean) => void;
7
+ export declare const getNodeById: (treeRoot: DSTreeviewT.Item['node'], id: DSTreeviewT.StringOrNum) => TreeModel.Node<DSTreeviewT.Item>;
8
+ export declare const cloneNode: (tree: TreeModel, node: DSTreeviewT.Item) => TreeModel.Node<DSTreeviewT.Item>;
9
+ export declare const itemsShareSameParent: (items?: DSTreeviewT.Item[]) => boolean;
10
+ export declare const getItemsParentNode: (items?: DSTreeviewT.Item[], skipSameParentCheck?: boolean) => TreeModel.Node<DSTreeviewT.Item> & {
11
+ parent?: TreeModel.Node<DSTreeviewT.Item> | undefined;
12
+ };
13
+ export declare const getNodeMatchesSearchQuery: (node: DSTreeviewT.Item['node'], searchQuery?: string) => boolean;
14
+ export declare const getChildrenMatchesSearchQuery: (parentNode: DSTreeviewT.Item['node'], searchQuery?: string) => boolean;
15
+ /**
16
+ * Mutate in place a node from tree-model normalizing object properties like "isGroup" even if user didn't specify it explicitly,
17
+ * after execution the node will have "nodePath" "treeDepth" "nodeItemRef" "isGroup" "isExpanded"
18
+ * (optionally, based on the provided arguments) "matchesSearchQuery" "childrenMatchesSearchQuery" "isChecked"
19
+ *
20
+ * @param {object} node - node (based on 'tree-model' lib) that you wish to mutate with extra props
21
+ * @param {string} [searchQuery=''] - optional string used to parse "matchesSearchQuery"/"childrenMatchesSearchQuery" properties
22
+ * @param {object} [selection=null] - optional selection hashmap used to parse "isChecked" properties
23
+ * @param {object} [expanded=null] - optional expanded hashmap used to parse "isExpanded" properties
24
+ */
25
+ export declare const enrichNodeModelInPlace: (node: TreeModel.Node<DSTreeviewT.SimpleItem>, searchQuery?: string, selection?: DSTreeviewT.SelectionItems | null, expanded?: DSTreeviewT.ExpandedItems | null) => void;
26
+ export declare const focusItem: (item: DSTreeviewT.Item | null) => void;
27
+ export declare const flattenTreeForDnD: (data: TreeModel.Node<DSTreeviewT.Item>, shouldDescend?: (datum: TreeModel.Node<DSTreeviewT.Item>) => boolean) => DSTreeviewT.DndItem[];
28
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { DSTreeviewT } from '../react-desc-prop-types';
2
+ import type { DSTreeviewInternalsT } from '../sharedTypes';
3
+ export declare const useInstanceRefActions: ({ actions }: DSTreeviewT.InstanceRef, ctx: DSTreeviewInternalsT.CTX) => DSTreeviewT.Actions;
@@ -0,0 +1,14 @@
1
+ import TreeModel from 'tree-model';
2
+ import type { DSTreeviewT } from '../react-desc-prop-types';
3
+ import type { DSTreeviewInternalsT } from '../sharedTypes';
4
+ export declare const useTree: (data: DSTreeviewT.SimpleItem[], props: DSTreeviewT.Props, states: {
5
+ setExpandedGroups: DSTreeviewInternalsT.StateSetter<DSTreeviewT.ExpandedItems>;
6
+ }) => {
7
+ visibleItems: DSTreeviewT.Item[];
8
+ flattenedItems: DSTreeviewT.DndItem[];
9
+ tree: TreeModel;
10
+ treeRoot: TreeModel.Node<DSTreeviewT.Item>;
11
+ rerenderItems: {};
12
+ triggerTreeRerender: () => void;
13
+ updateUserExpandedState: () => void;
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-treeview",
3
- "version": "3.13.1-rc.1",
3
+ "version": "3.13.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Tree View",
6
6
  "files": [
@@ -231,15 +231,15 @@
231
231
  "react-virtual": "~2.10.4",
232
232
  "tree-model": "~1.0.7",
233
233
  "uid": "~2.0.1",
234
- "@elliemae/ds-button": "3.13.1-rc.1",
235
- "@elliemae/ds-circular-progress-indicator": "3.13.1-rc.1",
236
- "@elliemae/ds-classnames": "3.13.1-rc.1",
237
- "@elliemae/ds-drag-and-drop": "3.13.1-rc.1",
238
- "@elliemae/ds-form": "3.13.1-rc.1",
239
- "@elliemae/ds-icons": "3.13.1-rc.1",
240
- "@elliemae/ds-system": "3.13.1-rc.1",
241
- "@elliemae/ds-truncated-tooltip-text": "3.13.1-rc.1",
242
- "@elliemae/ds-utilities": "3.13.1-rc.1"
234
+ "@elliemae/ds-button": "3.13.1",
235
+ "@elliemae/ds-circular-progress-indicator": "3.13.1",
236
+ "@elliemae/ds-classnames": "3.13.1",
237
+ "@elliemae/ds-form": "3.13.1",
238
+ "@elliemae/ds-icons": "3.13.1",
239
+ "@elliemae/ds-system": "3.13.1",
240
+ "@elliemae/ds-truncated-tooltip-text": "3.13.1",
241
+ "@elliemae/ds-utilities": "3.13.1",
242
+ "@elliemae/ds-drag-and-drop": "3.13.1"
243
243
  },
244
244
  "devDependencies": {
245
245
  "@testing-library/jest-dom": "~5.16.4",