@payloadcms/ui 3.80.0-internal.8d9ec7c → 3.80.0-internal.cdd7ef7
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/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +4 -2
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +157 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -0
- package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/Column/index.js +5 -5
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -0
- package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/Column/index.scss +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -0
- package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/ColumnItem/index.js +3 -3
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -0
- package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/ColumnItem/index.scss +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -0
- package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/index.js +6 -6
- package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -0
- package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -0
- package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -0
- package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -0
- package/dist/elements/{HierarchyButton → Hierarchy/DocHeaderButton}/index.js +6 -6
- package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -0
- package/dist/elements/Hierarchy/DocHeaderButton/index.server.d.ts.map +1 -0
- package/dist/elements/{HierarchyButton → Hierarchy/DocHeaderButton}/index.server.js +3 -3
- package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -0
- package/dist/elements/Hierarchy/Drawer/fetchAncestorPath.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Drawer/fetchAncestorPath.js.map +1 -0
- package/dist/elements/{HierarchyDrawer → Hierarchy}/Drawer/index.d.ts +2 -2
- package/dist/elements/Hierarchy/Drawer/index.d.ts.map +1 -0
- package/dist/elements/{HierarchyDrawer → Hierarchy}/Drawer/index.js +2 -2
- package/dist/elements/Hierarchy/Drawer/index.js.map +1 -0
- package/dist/elements/{HierarchyDrawer → Hierarchy/Drawer}/types.d.ts +1 -1
- package/dist/elements/Hierarchy/Drawer/types.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Drawer/types.js.map +1 -0
- package/dist/elements/{HierarchyDrawer/index.d.ts → Hierarchy/Drawer/useHierarchyDrawer.d.ts} +1 -1
- package/dist/elements/Hierarchy/Drawer/useHierarchyDrawer.d.ts.map +1 -0
- package/dist/elements/{HierarchyDrawer/index.js → Hierarchy/Drawer/useHierarchyDrawer.js} +6 -6
- package/dist/elements/Hierarchy/Drawer/useHierarchyDrawer.js.map +1 -0
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +1 -0
- package/dist/elements/{HierarchyField → Hierarchy/Field}/SelectedHierarchies.js +7 -16
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +1 -0
- package/dist/elements/{HierarchyField → Hierarchy/Field}/SelectedHierarchies.scss +1 -1
- package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -0
- package/dist/elements/{HierarchyField → Hierarchy/Field}/index.client.js +17 -29
- package/dist/elements/Hierarchy/Field/index.client.js.map +1 -0
- package/dist/elements/{HierarchyField → Hierarchy/Field}/index.scss +1 -1
- package/dist/elements/Hierarchy/Field/index.server.d.ts.map +1 -0
- package/dist/elements/{HierarchyField → Hierarchy/Field}/index.server.js +2 -2
- package/dist/elements/Hierarchy/Field/index.server.js.map +1 -0
- package/dist/elements/Hierarchy/HydrateProvider/index.d.ts +4 -0
- package/dist/elements/Hierarchy/HydrateProvider/index.d.ts.map +1 -0
- package/dist/elements/{HydrateHierarchyProvider → Hierarchy/HydrateProvider}/index.js +1 -1
- package/dist/elements/Hierarchy/HydrateProvider/index.js.map +1 -0
- package/dist/elements/{MoveMany → Hierarchy/MoveMany}/index.d.ts +3 -3
- package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -0
- package/dist/elements/{MoveMany → Hierarchy/MoveMany}/index.js +10 -10
- package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -0
- package/dist/elements/{MoveMany → Hierarchy/MoveMany}/index.scss +1 -1
- package/dist/elements/Hierarchy/Search/HierarchySearchInput.d.ts.map +1 -0
- package/dist/elements/{HierarchySearch → Hierarchy/Search}/HierarchySearchInput.js +5 -5
- package/dist/elements/Hierarchy/Search/HierarchySearchInput.js.map +1 -0
- package/dist/elements/Hierarchy/Search/HierarchySearchResultItem.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Search/HierarchySearchResultItem.js.map +1 -0
- package/dist/elements/Hierarchy/Search/HierarchySearchResults.d.ts.map +1 -0
- package/dist/elements/{HierarchySearch → Hierarchy/Search}/HierarchySearchResults.js +2 -2
- package/dist/elements/Hierarchy/Search/HierarchySearchResults.js.map +1 -0
- package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -0
- package/dist/elements/{HierarchySearch → Hierarchy/Search}/index.js +2 -2
- package/dist/elements/Hierarchy/Search/index.js.map +1 -0
- package/dist/elements/{HierarchySearch → Hierarchy/Search}/index.scss +1 -1
- package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Search/types.js.map +1 -0
- package/dist/elements/Hierarchy/Search/useHierarchySearch.d.ts.map +1 -0
- package/dist/elements/{HierarchySearch → Hierarchy/Search}/useHierarchySearch.js +2 -2
- package/dist/elements/Hierarchy/Search/useHierarchySearch.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -0
- package/dist/elements/{HierarchyTree → Hierarchy/Tree}/HierarchySidebarTab.js +43 -48
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -0
- package/dist/elements/{HierarchyTree → Hierarchy/Tree}/HierarchySidebarTab.server.js +6 -5
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/LoadMore/LoadMoreButton.d.ts.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/LoadMore/LoadMoreButton.js +1 -1
- package/dist/elements/Hierarchy/Tree/LoadMore/LoadMoreButton.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/LoadMore/index.d.ts.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/LoadMore/index.js +1 -1
- package/dist/elements/Hierarchy/Tree/LoadMore/index.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/TreeConnector.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Tree/TreeConnector.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/TreeFocusContext.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Tree/TreeFocusContext.js.map +1 -0
- package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/TreeNode/index.js +8 -4
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/TreeNode/index.scss +1 -1
- package/dist/elements/{HierarchyTree → Hierarchy/Tree}/index.d.ts +1 -0
- package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/index.js +72 -72
- package/dist/elements/Hierarchy/Tree/index.js.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/index.scss +2 -5
- package/dist/elements/{Tree → Hierarchy/Tree}/types.d.ts +30 -24
- package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Tree/types.js.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/useChildren.d.ts +5 -1
- package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -0
- package/dist/elements/{Tree → Hierarchy/Tree}/useChildren.js +41 -25
- package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -0
- package/dist/elements/LoadMoreRow/index.js +1 -1
- package/dist/elements/LoadMoreRow/index.js.map +1 -1
- package/dist/elements/RelationshipTable/index.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/index.js +14 -9
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
- package/dist/exports/client/index.d.ts +11 -15
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +26 -26
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/rsc/index.d.ts +3 -3
- package/dist/exports/rsc/index.d.ts.map +1 -1
- package/dist/exports/rsc/index.js +3 -3
- package/dist/exports/rsc/index.js.map +1 -1
- package/dist/forms/Form/mergeServerFormState.d.ts.map +1 -1
- package/dist/forms/Form/mergeServerFormState.js +101 -24
- package/dist/forms/Form/mergeServerFormState.js.map +1 -1
- package/dist/icons/TableView/index.d.ts +3 -0
- package/dist/icons/TableView/index.d.ts.map +1 -0
- package/dist/icons/TableView/index.js +16 -0
- package/dist/icons/TableView/index.js.map +1 -0
- package/dist/providers/Hierarchy/index.d.ts.map +1 -1
- package/dist/providers/Hierarchy/index.js +5 -1
- package/dist/providers/Hierarchy/index.js.map +1 -1
- package/dist/providers/Hierarchy/types.d.ts +1 -0
- package/dist/providers/Hierarchy/types.d.ts.map +1 -1
- package/dist/providers/Hierarchy/types.js.map +1 -1
- package/dist/providers/SidebarTabs/index.d.ts +19 -0
- package/dist/providers/SidebarTabs/index.d.ts.map +1 -0
- package/dist/providers/SidebarTabs/index.js +24 -0
- package/dist/providers/SidebarTabs/index.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +11 -2
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.js +145 -86
- package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.d.ts +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/elements/HierarchyButton/index.d.ts.map +0 -1
- package/dist/elements/HierarchyButton/index.js.map +0 -1
- package/dist/elements/HierarchyButton/index.server.d.ts.map +0 -1
- package/dist/elements/HierarchyButton/index.server.js.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/Column/index.d.ts.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/Column/index.js.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/ColumnItem/index.d.ts.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/ColumnItem/index.js.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/index.d.ts.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/index.js.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/types.d.ts.map +0 -1
- package/dist/elements/HierarchyColumnBrowser/types.js.map +0 -1
- package/dist/elements/HierarchyDrawer/Drawer/index.d.ts.map +0 -1
- package/dist/elements/HierarchyDrawer/Drawer/index.js.map +0 -1
- package/dist/elements/HierarchyDrawer/fetchAncestorPath.d.ts.map +0 -1
- package/dist/elements/HierarchyDrawer/fetchAncestorPath.js.map +0 -1
- package/dist/elements/HierarchyDrawer/index.d.ts.map +0 -1
- package/dist/elements/HierarchyDrawer/index.js.map +0 -1
- package/dist/elements/HierarchyDrawer/types.d.ts.map +0 -1
- package/dist/elements/HierarchyDrawer/types.js.map +0 -1
- package/dist/elements/HierarchyField/SelectedHierarchies.d.ts.map +0 -1
- package/dist/elements/HierarchyField/SelectedHierarchies.js.map +0 -1
- package/dist/elements/HierarchyField/index.client.d.ts.map +0 -1
- package/dist/elements/HierarchyField/index.client.js.map +0 -1
- package/dist/elements/HierarchyField/index.server.d.ts.map +0 -1
- package/dist/elements/HierarchyField/index.server.js.map +0 -1
- package/dist/elements/HierarchySearch/HierarchySearchInput.d.ts.map +0 -1
- package/dist/elements/HierarchySearch/HierarchySearchInput.js.map +0 -1
- package/dist/elements/HierarchySearch/HierarchySearchResultItem.d.ts.map +0 -1
- package/dist/elements/HierarchySearch/HierarchySearchResultItem.js.map +0 -1
- package/dist/elements/HierarchySearch/HierarchySearchResults.d.ts.map +0 -1
- package/dist/elements/HierarchySearch/HierarchySearchResults.js.map +0 -1
- package/dist/elements/HierarchySearch/index.d.ts.map +0 -1
- package/dist/elements/HierarchySearch/index.js.map +0 -1
- package/dist/elements/HierarchySearch/types.d.ts.map +0 -1
- package/dist/elements/HierarchySearch/types.js.map +0 -1
- package/dist/elements/HierarchySearch/useHierarchySearch.d.ts.map +0 -1
- package/dist/elements/HierarchySearch/useHierarchySearch.js.map +0 -1
- package/dist/elements/HierarchyTree/HierarchySidebarTab.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/HierarchySidebarTab.js.map +0 -1
- package/dist/elements/HierarchyTree/HierarchySidebarTab.server.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/HierarchySidebarTab.server.js.map +0 -1
- package/dist/elements/HierarchyTree/LoadMore/LoadMoreButton.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/LoadMore/LoadMoreButton.js +0 -36
- package/dist/elements/HierarchyTree/LoadMore/LoadMoreButton.js.map +0 -1
- package/dist/elements/HierarchyTree/LoadMore/index.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/LoadMore/index.js +0 -29
- package/dist/elements/HierarchyTree/LoadMore/index.js.map +0 -1
- package/dist/elements/HierarchyTree/LoadMore/index.scss +0 -26
- package/dist/elements/HierarchyTree/TreeConnector.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/TreeConnector.js.map +0 -1
- package/dist/elements/HierarchyTree/TreeFocusContext.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/TreeFocusContext.js.map +0 -1
- package/dist/elements/HierarchyTree/TreeNode/index.d.ts +0 -5
- package/dist/elements/HierarchyTree/TreeNode/index.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/TreeNode/index.js +0 -201
- package/dist/elements/HierarchyTree/TreeNode/index.js.map +0 -1
- package/dist/elements/HierarchyTree/TreeNode/index.scss +0 -99
- package/dist/elements/HierarchyTree/index.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/index.js +0 -66
- package/dist/elements/HierarchyTree/index.js.map +0 -1
- package/dist/elements/HierarchyTree/index.scss +0 -42
- package/dist/elements/HierarchyTree/types.d.ts +0 -57
- package/dist/elements/HierarchyTree/types.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/types.js.map +0 -1
- package/dist/elements/HierarchyTree/useChildren.d.ts +0 -26
- package/dist/elements/HierarchyTree/useChildren.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/useChildren.js +0 -150
- package/dist/elements/HierarchyTree/useChildren.js.map +0 -1
- package/dist/elements/HierarchyTree/useTreeState.d.ts +0 -9
- package/dist/elements/HierarchyTree/useTreeState.d.ts.map +0 -1
- package/dist/elements/HierarchyTree/useTreeState.js +0 -50
- package/dist/elements/HierarchyTree/useTreeState.js.map +0 -1
- package/dist/elements/HydrateHierarchyProvider/index.d.ts +0 -4
- package/dist/elements/HydrateHierarchyProvider/index.d.ts.map +0 -1
- package/dist/elements/HydrateHierarchyProvider/index.js.map +0 -1
- package/dist/elements/MoveMany/index.d.ts.map +0 -1
- package/dist/elements/MoveMany/index.js.map +0 -1
- package/dist/elements/Tree/LoadMore/LoadMoreButton.d.ts +0 -8
- package/dist/elements/Tree/LoadMore/LoadMoreButton.d.ts.map +0 -1
- package/dist/elements/Tree/LoadMore/LoadMoreButton.js.map +0 -1
- package/dist/elements/Tree/LoadMore/index.d.ts +0 -12
- package/dist/elements/Tree/LoadMore/index.d.ts.map +0 -1
- package/dist/elements/Tree/LoadMore/index.js.map +0 -1
- package/dist/elements/Tree/TreeConnector.d.ts +0 -7
- package/dist/elements/Tree/TreeConnector.d.ts.map +0 -1
- package/dist/elements/Tree/TreeConnector.js +0 -23
- package/dist/elements/Tree/TreeConnector.js.map +0 -1
- package/dist/elements/Tree/TreeFocusContext.d.ts +0 -28
- package/dist/elements/Tree/TreeFocusContext.d.ts.map +0 -1
- package/dist/elements/Tree/TreeFocusContext.js +0 -140
- package/dist/elements/Tree/TreeFocusContext.js.map +0 -1
- package/dist/elements/Tree/TreeNode/index.d.ts.map +0 -1
- package/dist/elements/Tree/TreeNode/index.js.map +0 -1
- package/dist/elements/Tree/index.d.ts +0 -5
- package/dist/elements/Tree/index.d.ts.map +0 -1
- package/dist/elements/Tree/index.js.map +0 -1
- package/dist/elements/Tree/types.d.ts.map +0 -1
- package/dist/elements/Tree/types.js +0 -2
- package/dist/elements/Tree/types.js.map +0 -1
- package/dist/elements/Tree/useChildren.d.ts.map +0 -1
- package/dist/elements/Tree/useChildren.js.map +0 -1
- /package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/Column/index.d.ts +0 -0
- /package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/ColumnItem/index.d.ts +0 -0
- /package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/index.d.ts +0 -0
- /package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/index.scss +0 -0
- /package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/types.d.ts +0 -0
- /package/dist/elements/{HierarchyColumnBrowser → Hierarchy/ColumnBrowser}/types.js +0 -0
- /package/dist/elements/{HierarchyButton → Hierarchy/DocHeaderButton}/index.d.ts +0 -0
- /package/dist/elements/{HierarchyButton → Hierarchy/DocHeaderButton}/index.scss +0 -0
- /package/dist/elements/{HierarchyButton → Hierarchy/DocHeaderButton}/index.server.d.ts +0 -0
- /package/dist/elements/{HierarchyDrawer → Hierarchy/Drawer}/fetchAncestorPath.d.ts +0 -0
- /package/dist/elements/{HierarchyDrawer → Hierarchy/Drawer}/fetchAncestorPath.js +0 -0
- /package/dist/elements/{HierarchyDrawer → Hierarchy}/Drawer/index.scss +0 -0
- /package/dist/elements/{HierarchyDrawer → Hierarchy/Drawer}/types.js +0 -0
- /package/dist/elements/{HierarchyField → Hierarchy/Field}/SelectedHierarchies.d.ts +0 -0
- /package/dist/elements/{HierarchyField → Hierarchy/Field}/index.client.d.ts +0 -0
- /package/dist/elements/{HierarchyField → Hierarchy/Field}/index.server.d.ts +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/HierarchySearchInput.d.ts +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/HierarchySearchResultItem.d.ts +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/HierarchySearchResultItem.js +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/HierarchySearchResults.d.ts +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/index.d.ts +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/types.d.ts +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/types.js +0 -0
- /package/dist/elements/{HierarchySearch → Hierarchy/Search}/useHierarchySearch.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/HierarchySidebarTab.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/HierarchySidebarTab.server.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/LoadMore/LoadMoreButton.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/LoadMore/index.d.ts +0 -0
- /package/dist/elements/{Tree → Hierarchy/Tree}/LoadMore/index.scss +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/TreeConnector.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/TreeConnector.js +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/TreeFocusContext.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/TreeFocusContext.js +0 -0
- /package/dist/elements/{Tree → Hierarchy/Tree}/TreeNode/index.d.ts +0 -0
- /package/dist/elements/{HierarchyTree → Hierarchy/Tree}/types.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { FieldDiffContainer } from '../../elements/FieldDiffContainer/index.js';
|
|
2
2
|
export { FieldDiffLabel } from '../../elements/FieldDiffLabel/index.js';
|
|
3
|
-
export { HierarchyButton } from '../../elements/
|
|
4
|
-
export { HierarchyField } from '../../elements/
|
|
5
|
-
export { HierarchySidebarTabServer } from '../../elements/
|
|
3
|
+
export { HierarchyButton } from '../../elements/Hierarchy/DocHeaderButton/index.server.js';
|
|
4
|
+
export { HierarchyField } from '../../elements/Hierarchy/Field/index.server.js';
|
|
5
|
+
export { HierarchySidebarTabServer } from '../../elements/Hierarchy/Tree/HierarchySidebarTab.server.js';
|
|
6
6
|
export { escapeDiffHTML, getHTMLDiffComponents, unescapeDiffHTML, } from '../../elements/HTMLDiff/index.js';
|
|
7
7
|
export { _internal_renderFieldHandler } from '../../forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js';
|
|
8
8
|
export { File } from '../../graphics/File/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/rsc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/rsc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAA;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAA;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,4EAA4E,CAAA;AACzH,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { FieldDiffContainer } from '../../elements/FieldDiffContainer/index.js';
|
|
2
2
|
export { FieldDiffLabel } from '../../elements/FieldDiffLabel/index.js';
|
|
3
|
-
export { HierarchyButton } from '../../elements/
|
|
4
|
-
export { HierarchyField } from '../../elements/
|
|
5
|
-
export { HierarchySidebarTabServer } from '../../elements/
|
|
3
|
+
export { HierarchyButton } from '../../elements/Hierarchy/DocHeaderButton/index.server.js';
|
|
4
|
+
export { HierarchyField } from '../../elements/Hierarchy/Field/index.server.js';
|
|
5
|
+
export { HierarchySidebarTabServer } from '../../elements/Hierarchy/Tree/HierarchySidebarTab.server.js';
|
|
6
6
|
export { escapeDiffHTML, getHTMLDiffComponents, unescapeDiffHTML } from '../../elements/HTMLDiff/index.js';
|
|
7
7
|
export { _internal_renderFieldHandler } from '../../forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js';
|
|
8
8
|
export { File } from '../../graphics/File/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["FieldDiffContainer","FieldDiffLabel","HierarchyButton","HierarchyField","HierarchySidebarTabServer","escapeDiffHTML","getHTMLDiffComponents","unescapeDiffHTML","_internal_renderFieldHandler","File","CheckIcon","copyDataFromLocaleHandler","getColumns","handleLivePreview","handlePreview","renderFilters","renderTable","resolveFilterOptions","upsertPreferences","CollectionCards"],"sources":["../../../src/exports/rsc/index.ts"],"sourcesContent":["export { FieldDiffContainer } from '../../elements/FieldDiffContainer/index.js'\nexport { FieldDiffLabel } from '../../elements/FieldDiffLabel/index.js'\nexport { HierarchyButton } from '../../elements/
|
|
1
|
+
{"version":3,"file":"index.js","names":["FieldDiffContainer","FieldDiffLabel","HierarchyButton","HierarchyField","HierarchySidebarTabServer","escapeDiffHTML","getHTMLDiffComponents","unescapeDiffHTML","_internal_renderFieldHandler","File","CheckIcon","copyDataFromLocaleHandler","getColumns","handleLivePreview","handlePreview","renderFilters","renderTable","resolveFilterOptions","upsertPreferences","CollectionCards"],"sources":["../../../src/exports/rsc/index.ts"],"sourcesContent":["export { FieldDiffContainer } from '../../elements/FieldDiffContainer/index.js'\nexport { FieldDiffLabel } from '../../elements/FieldDiffLabel/index.js'\nexport { HierarchyButton } from '../../elements/Hierarchy/DocHeaderButton/index.server.js'\nexport { HierarchyField } from '../../elements/Hierarchy/Field/index.server.js'\nexport { HierarchySidebarTabServer } from '../../elements/Hierarchy/Tree/HierarchySidebarTab.server.js'\nexport {\n escapeDiffHTML,\n getHTMLDiffComponents,\n unescapeDiffHTML,\n} from '../../elements/HTMLDiff/index.js'\nexport { _internal_renderFieldHandler } from '../../forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js'\nexport { File } from '../../graphics/File/index.js'\nexport { CheckIcon } from '../../icons/Check/index.js'\nexport { copyDataFromLocaleHandler } from '../../utilities/copyDataFromLocale.js'\nexport { getColumns } from '../../utilities/getColumns.js'\nexport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nexport { handlePreview } from '../../utilities/handlePreview.js'\nexport { renderFilters, renderTable } from '../../utilities/renderTable.js'\nexport { resolveFilterOptions } from '../../utilities/resolveFilterOptions.js'\nexport { upsertPreferences } from '../../utilities/upsertPreferences.js'\nexport { CollectionCards } from '../../widgets/CollectionCards/index.js'\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ;AAC1C,SACEC,cAAc,EACdC,qBAAqB,EACrBC,gBAAgB,QACX;AACP,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,IAAI,QAAQ;AACrB,SAASC,SAAS,QAAQ;AAC1B,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,EAAEC,WAAW,QAAQ;AAC3C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeServerFormState.d.ts","sourceRoot":"","sources":["../../../src/forms/Form/mergeServerFormState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIxC;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB;IACE;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,GACD,OAAO,CAAA;AAEX,KAAK,IAAI,GAAG;IACV,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,aAAa,EAAE,SAAS,CAAA;CACzB,CAAA;
|
|
1
|
+
{"version":3,"file":"mergeServerFormState.d.ts","sourceRoot":"","sources":["../../../src/forms/Form/mergeServerFormState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIxC;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB;IACE;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,GACD,OAAO,CAAA;AAEX,KAAK,IAAI,GAAG;IACV,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,aAAa,EAAE,SAAS,CAAA;CACzB,CAAA;AA6CD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,mDAI9B,IAAI,KAAG,SAwJT,CAAA"}
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { dequal } from 'dequal/lite'; // lite: no need for Map and Set support
|
|
4
|
+
/**
|
|
5
|
+
* Parses an array field path to extract the array path, row index, and field path.
|
|
6
|
+
* Handles nested arrays by finding the deepest numeric index.
|
|
7
|
+
*
|
|
8
|
+
* @param path - The field path to parse (e.g., 'array.1.text' or 'blocks.0.items.1.title')
|
|
9
|
+
* @returns Object with arrayPath, rowIndex, and fieldPath, or null if not an array field
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* parseArrayFieldPath('array.1.text')
|
|
13
|
+
* // Returns: { arrayPath: 'array', rowIndex: 1, fieldPath: 'text' }
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* parseArrayFieldPath('blocks.0.items.1.title')
|
|
17
|
+
* // Returns: { arrayPath: 'blocks.0.items', rowIndex: 1, fieldPath: 'title' }
|
|
18
|
+
*/
|
|
19
|
+
function parseArrayFieldPath(path) {
|
|
20
|
+
const segments = path.split('.');
|
|
21
|
+
// Find the last numeric index (indicates array row)
|
|
22
|
+
let lastNumericIndex = -1;
|
|
23
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
24
|
+
if (/^\d+$/.test(segments[i])) {
|
|
25
|
+
lastNumericIndex = i;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Not an array field if no numeric index or nothing after it
|
|
30
|
+
if (lastNumericIndex === -1 || lastNumericIndex === segments.length - 1) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
arrayPath: segments.slice(0, lastNumericIndex).join('.'),
|
|
35
|
+
fieldPath: segments.slice(lastNumericIndex + 1).join('.'),
|
|
36
|
+
rowIndex: parseInt(segments[lastNumericIndex], 10)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
4
39
|
/**
|
|
5
40
|
* This function receives form state from the server and intelligently merges it into the client state.
|
|
6
41
|
* The server contains extra properties that the client may not have, e.g. custom components and error states.
|
|
@@ -31,9 +66,32 @@ export const mergeServerFormState = ({
|
|
|
31
66
|
* a. accept all values when explicitly requested, e.g. on submit
|
|
32
67
|
* b. only accept values for unmodified fields, e.g. on autosave
|
|
33
68
|
*/
|
|
34
|
-
|
|
69
|
+
let shouldAcceptValue = incomingField.addedByServer || acceptValues === true || typeof acceptValues === 'object' && acceptValues !== null &&
|
|
35
70
|
// Note: Must be explicitly `false`, allow `null` or `undefined` to mean true
|
|
36
71
|
acceptValues.overrideLocalChanges === false && !currentState[path]?.isModified;
|
|
72
|
+
/**
|
|
73
|
+
* For array row fields, verify the row IDs match at the given index before accepting
|
|
74
|
+
* server values. If rows were reordered or deleted while the request was in-flight,
|
|
75
|
+
* the same index may refer to different rows, and accepting the server value would
|
|
76
|
+
* overwrite the wrong row's data.
|
|
77
|
+
*
|
|
78
|
+
* This guard only applies during autosave. On explicit save (acceptValues === true),
|
|
79
|
+
* the server response is authoritative and this check is bypassed.
|
|
80
|
+
*/
|
|
81
|
+
if (shouldAcceptValue && !incomingField.addedByServer && acceptValues !== true) {
|
|
82
|
+
const parsed = parseArrayFieldPath(path);
|
|
83
|
+
if (parsed) {
|
|
84
|
+
const {
|
|
85
|
+
arrayPath,
|
|
86
|
+
rowIndex
|
|
87
|
+
} = parsed;
|
|
88
|
+
const clientRowId = currentState[arrayPath]?.rows?.[rowIndex]?.id;
|
|
89
|
+
const serverRowId = incomingState[arrayPath]?.rows?.[rowIndex]?.id;
|
|
90
|
+
if (clientRowId === undefined || serverRowId && clientRowId !== serverRowId) {
|
|
91
|
+
shouldAcceptValue = false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
37
95
|
let sanitizedIncomingField = incomingField;
|
|
38
96
|
if (!shouldAcceptValue) {
|
|
39
97
|
/**
|
|
@@ -60,32 +118,51 @@ export const mergeServerFormState = ({
|
|
|
60
118
|
* For example, the server response could come back with a row which has been deleted on the client
|
|
61
119
|
* Loop over the incoming rows, if it exists in client side form state, merge in any new properties from the server
|
|
62
120
|
* Note: read `currentState` and not `newState` here, as the `rows` property have already been merged above
|
|
121
|
+
*
|
|
122
|
+
* On explicit save (acceptValues === true), the server is authoritative - accept server row order.
|
|
123
|
+
* On autosave (acceptValues !== true), the client is source of truth - use ID-based matching.
|
|
63
124
|
*/
|
|
64
125
|
if (Array.isArray(incomingField.rows) && path in currentState) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
126
|
+
if (acceptValues === true) {
|
|
127
|
+
// Explicit save: server is authoritative, use index-based merging
|
|
128
|
+
newState[path].rows = incomingField.rows.map((serverRow, index) => ({
|
|
129
|
+
...(currentState[path]?.rows?.[index] || {}),
|
|
130
|
+
...serverRow
|
|
131
|
+
}));
|
|
132
|
+
} else {
|
|
133
|
+
// Autosave: client is source of truth, use ID-based matching
|
|
134
|
+
newState[path].rows = [...(currentState[path]?.rows || [])]; // shallow copy to avoid mutating the original array
|
|
135
|
+
incomingField.rows.forEach(row => {
|
|
136
|
+
const indexInCurrentState = currentState[path].rows?.findIndex(existingRow => existingRow.id === row.id);
|
|
137
|
+
if (indexInCurrentState > -1) {
|
|
138
|
+
newState[path].rows[indexInCurrentState] = {
|
|
139
|
+
...currentState[path].rows[indexInCurrentState],
|
|
140
|
+
...row
|
|
141
|
+
};
|
|
142
|
+
} else if (row.addedByServer) {
|
|
143
|
+
/**
|
|
144
|
+
* Note: This is a known limitation of computed array and block rows
|
|
145
|
+
* If a new row was added by the server, we append it to the _end_ of this array
|
|
146
|
+
* This is because the client is the source of truth, and it has arrays ordered in a certain position
|
|
147
|
+
* For example, the user may have re-ordered rows client-side while a long running request is processing
|
|
148
|
+
* This means that we _cannot_ slice a new row into the second position on the server, for example
|
|
149
|
+
* By the time it gets back to the client, its index is stale
|
|
150
|
+
*/
|
|
151
|
+
const newRow = {
|
|
152
|
+
...row
|
|
153
|
+
};
|
|
154
|
+
delete newRow.addedByServer;
|
|
155
|
+
newState[path].rows.push(newRow);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Sync the value field to match the actual row count after merging.
|
|
160
|
+
* Client is source of truth for row count when rows were added/removed during the request.
|
|
161
|
+
*/
|
|
162
|
+
if ('value' in incomingField && newState[path].rows.length !== incomingField.value) {
|
|
163
|
+
newState[path].value = newState[path].rows.length;
|
|
87
164
|
}
|
|
88
|
-
}
|
|
165
|
+
}
|
|
89
166
|
}
|
|
90
167
|
// If `valid` is `undefined`, mark it as `true`
|
|
91
168
|
if (incomingField.valid !== false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeServerFormState.js","names":["dequal","mergeServerFormState","acceptValues","currentState","incomingState","newState","path","incomingField","Object","entries","addedByServer","shouldAcceptValue","overrideLocalChanges","isModified","sanitizedIncomingField","initialValue","value","rest","errorPaths","Array","isArray","rows","forEach","row","indexInCurrentState","findIndex","existingRow","id","newRow","push","valid","passesCondition","blocksFilterOptions"],"sources":["../../../src/forms/Form/mergeServerFormState.ts"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { dequal } from 'dequal/lite' // lite: no need for Map and Set support\n\n/**\n * If true, will accept all values from the server, overriding any current values in local state.\n * Can also provide an options object for more granular control.\n */\nexport type AcceptValues =\n | {\n /**\n * When `false`, will accept the values from the server _UNLESS_ the value has been modified locally since the request was made.\n * This is useful for autosave, for example, where hooks may have modified the field's value on the server while you were still making changes.\n * @default undefined\n */\n overrideLocalChanges?: boolean\n }\n | boolean\n\ntype Args = {\n acceptValues?: AcceptValues\n currentState?: FormState\n incomingState: FormState\n}\n\n/**\n * This function receives form state from the server and intelligently merges it into the client state.\n * The server contains extra properties that the client may not have, e.g. custom components and error states.\n * We typically do not want to merge properties that rely on user input, however, such as values, unless explicitly requested.\n * Doing this would cause the client to lose any local changes to those fields.\n *\n * Note: Local state is the source of truth, not the new server state that is getting merged in. This is critical for array row\n * manipulation specifically, where the user may have added, removed, or reordered rows while a request was pending and is now stale.\n *\n * This function applies some defaults, as well as cleans up the server response in preparation for the client.\n * e.g. it will set `valid` and `passesCondition` to true if undefined, and remove `addedByServer` from the response.\n */\nexport const mergeServerFormState = ({\n acceptValues,\n currentState = {},\n incomingState,\n}: Args): FormState => {\n const newState = { ...currentState }\n\n for (const [path, incomingField] of Object.entries(incomingState || {})) {\n if (!(path in currentState) && !incomingField.addedByServer) {\n continue\n }\n\n /**\n * If it's a new field added by the server, always accept the value.\n * Otherwise:\n * a. accept all values when explicitly requested, e.g. on submit\n * b. only accept values for unmodified fields, e.g. on autosave\n */\n const shouldAcceptValue =\n incomingField.addedByServer ||\n acceptValues === true ||\n (typeof acceptValues === 'object' &&\n acceptValues !== null &&\n // Note: Must be explicitly `false`, allow `null` or `undefined` to mean true\n acceptValues.overrideLocalChanges === false &&\n !currentState[path]?.isModified)\n\n let sanitizedIncomingField = incomingField\n\n if (!shouldAcceptValue) {\n /**\n * Note: do not delete properties off `incomingField` as this will mutate the original object\n * Instead, omit them from the destructured object by excluding specific keys\n * This will also ensure we don't set `undefined` into the result unnecessarily\n */\n const { initialValue, value, ...rest } = incomingField\n sanitizedIncomingField = rest\n }\n\n newState[path] = {\n ...currentState[path],\n ...sanitizedIncomingField,\n }\n\n if (\n currentState[path] &&\n 'errorPaths' in currentState[path] &&\n !('errorPaths' in incomingField)\n ) {\n newState[path].errorPaths = []\n }\n\n /**\n * Deeply merge the rows array to ensure changes to local state are not lost while the request was pending\n * For example, the server response could come back with a row which has been deleted on the client\n * Loop over the incoming rows, if it exists in client side form state, merge in any new properties from the server\n * Note: read `currentState` and not `newState` here, as the `rows` property have already been merged above\n */\n if (Array.isArray(incomingField.rows) && path in currentState) {\n newState[path].rows = [...(currentState[path]?.rows || [])] // shallow copy to avoid mutating the original array\n\n incomingField.rows.forEach((row) => {\n const indexInCurrentState = currentState[path].rows?.findIndex(\n (existingRow) => existingRow.id === row.id,\n )\n\n if (indexInCurrentState > -1) {\n newState[path].rows[indexInCurrentState] = {\n ...currentState[path].rows[indexInCurrentState],\n ...row,\n }\n } else if (row.addedByServer) {\n /**\n * Note: This is a known limitation of computed array and block rows\n * If a new row was added by the server, we append it to the _end_ of this array\n * This is because the client is the source of truth, and it has arrays ordered in a certain position\n * For example, the user may have re-ordered rows client-side while a long running request is processing\n * This means that we _cannot_ slice a new row into the second position on the server, for example\n * By the time it gets back to the client, its index is stale\n */\n const newRow = { ...row }\n delete newRow.addedByServer\n newState[path].rows.push(newRow)\n }\n })\n }\n\n // If `valid` is `undefined`, mark it as `true`\n if (incomingField.valid !== false) {\n newState[path].valid = true\n }\n\n // If `passesCondition` is `undefined`, mark it as `true`\n if (incomingField.passesCondition !== false) {\n newState[path].passesCondition = true\n }\n\n /**\n * Undefined values for blocksFilterOptions coming back should be treated as \"all blocks allowed\" and\n * should always be merged in.\n * Without this, an undefined value coming back will incorrectly be ignored, and the previous filter will remain.\n */\n if (!incomingField.blocksFilterOptions) {\n delete newState[path].blocksFilterOptions\n }\n\n // Strip away the `addedByServer` property from the client\n // This will prevent it from being passed back to the server\n delete newState[path].addedByServer\n }\n\n // Return the original object reference if the state is unchanged\n // This will avoid unnecessary re-renders and dependency updates\n return dequal(newState, currentState) ? currentState : newState\n}\n"],"mappings":"AAAA;;AAGA,SAASA,MAAM,QAAQ,cAAa,CAAC;AAuBrC;;;;;;;;;;;;AAYA,OAAO,MAAMC,oBAAA,GAAuBA,CAAC;EACnCC,YAAY;EACZC,YAAA,GAAe,CAAC,CAAC;EACjBC;AAAa,CACR;EACL,MAAMC,QAAA,GAAW;IAAE,GAAGF;EAAa;EAEnC,KAAK,MAAM,CAACG,IAAA,EAAMC,aAAA,CAAc,IAAIC,MAAA,CAAOC,OAAO,CAACL,aAAA,IAAiB,CAAC,IAAI;IACvE,IAAI,EAAEE,IAAA,IAAQH,YAAW,KAAM,CAACI,aAAA,CAAcG,aAAa,EAAE;MAC3D;IACF;IAEA;;;;;;IAMA,MAAMC,iBAAA,GACJJ,aAAA,CAAcG,aAAa,IAC3BR,YAAA,KAAiB,QAChB,OAAOA,YAAA,KAAiB,YACvBA,YAAA,KA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UAC5B;;;;;;;;UAQA,MAAMkB,MAAA,GAAS;YAAE,GAAGL;UAAI;UACxB,OAAOK,MAAA,CAAOlB,aAAa;UAC3BL,QAAQ,CAACC,IAAA,CAAK,CAACe,IAAI,CAACQ,IAAI,CAACD,MAAA;QAC3B;MACF;IACF;IAEA;IACA,IAAIrB,aAAA,CAAcuB,KAAK,KAAK,OAAO;MACjCzB,QAAQ,CAACC,IAAA,CAAK,CAACwB,KAAK,GAAG;IACzB;IAEA;IACA,IAAIvB,aAAA,CAAcwB,eAAe,KAAK,OAAO;MAC3C1B,QAAQ,CAACC,IAAA,CAAK,CAACyB,eAAe,GAAG;IACnC;IAEA;;;;;IAKA,IAAI,CAACxB,aAAA,CAAcyB,mBAAmB,EAAE;MACtC,OAAO3B,QAAQ,CAACC,IAAA,CAAK,CAAC0B,mBAAmB;IAC3C;IAEA;IACA;IACA,OAAO3B,QAAQ,CAACC,IAAA,CAAK,CAACI,aAAa;EACrC;EAEA;EACA;EACA,OAAOV,MAAA,CAAOK,QAAA,EAAUF,YAAA,IAAgBA,YAAA,GAAeE,QAAA;AACzD","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"mergeServerFormState.js","names":["dequal","parseArrayFieldPath","path","segments","split","lastNumericIndex","i","length","test","arrayPath","slice","join","fieldPath","rowIndex","parseInt","mergeServerFormState","acceptValues","currentState","incomingState","newState","incomingField","Object","entries","addedByServer","shouldAcceptValue","overrideLocalChanges","isModified","parsed","clientRowId","rows","id","serverRowId","undefined","sanitizedIncomingField","initialValue","value","rest","errorPaths","Array","isArray","map","serverRow","index","forEach","row","indexInCurrentState","findIndex","existingRow","newRow","push","valid","passesCondition","blocksFilterOptions"],"sources":["../../../src/forms/Form/mergeServerFormState.ts"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { dequal } from 'dequal/lite' // lite: no need for Map and Set support\n\n/**\n * If true, will accept all values from the server, overriding any current values in local state.\n * Can also provide an options object for more granular control.\n */\nexport type AcceptValues =\n | {\n /**\n * When `false`, will accept the values from the server _UNLESS_ the value has been modified locally since the request was made.\n * This is useful for autosave, for example, where hooks may have modified the field's value on the server while you were still making changes.\n * @default undefined\n */\n overrideLocalChanges?: boolean\n }\n | boolean\n\ntype Args = {\n acceptValues?: AcceptValues\n currentState?: FormState\n incomingState: FormState\n}\n\n/**\n * Parses an array field path to extract the array path, row index, and field path.\n * Handles nested arrays by finding the deepest numeric index.\n *\n * @param path - The field path to parse (e.g., 'array.1.text' or 'blocks.0.items.1.title')\n * @returns Object with arrayPath, rowIndex, and fieldPath, or null if not an array field\n *\n * @example\n * parseArrayFieldPath('array.1.text')\n * // Returns: { arrayPath: 'array', rowIndex: 1, fieldPath: 'text' }\n *\n * @example\n * parseArrayFieldPath('blocks.0.items.1.title')\n * // Returns: { arrayPath: 'blocks.0.items', rowIndex: 1, fieldPath: 'title' }\n */\nfunction parseArrayFieldPath(path: string): {\n arrayPath: string\n fieldPath: string\n rowIndex: number\n} | null {\n const segments = path.split('.')\n\n // Find the last numeric index (indicates array row)\n let lastNumericIndex = -1\n for (let i = segments.length - 1; i >= 0; i--) {\n if (/^\\d+$/.test(segments[i])) {\n lastNumericIndex = i\n break\n }\n }\n\n // Not an array field if no numeric index or nothing after it\n if (lastNumericIndex === -1 || lastNumericIndex === segments.length - 1) {\n return null\n }\n\n return {\n arrayPath: segments.slice(0, lastNumericIndex).join('.'),\n fieldPath: segments.slice(lastNumericIndex + 1).join('.'),\n rowIndex: parseInt(segments[lastNumericIndex], 10),\n }\n}\n\n/**\n * This function receives form state from the server and intelligently merges it into the client state.\n * The server contains extra properties that the client may not have, e.g. custom components and error states.\n * We typically do not want to merge properties that rely on user input, however, such as values, unless explicitly requested.\n * Doing this would cause the client to lose any local changes to those fields.\n *\n * Note: Local state is the source of truth, not the new server state that is getting merged in. This is critical for array row\n * manipulation specifically, where the user may have added, removed, or reordered rows while a request was pending and is now stale.\n *\n * This function applies some defaults, as well as cleans up the server response in preparation for the client.\n * e.g. it will set `valid` and `passesCondition` to true if undefined, and remove `addedByServer` from the response.\n */\nexport const mergeServerFormState = ({\n acceptValues,\n currentState = {},\n incomingState,\n}: Args): FormState => {\n const newState = { ...currentState }\n\n for (const [path, incomingField] of Object.entries(incomingState || {})) {\n if (!(path in currentState) && !incomingField.addedByServer) {\n continue\n }\n\n /**\n * If it's a new field added by the server, always accept the value.\n * Otherwise:\n * a. accept all values when explicitly requested, e.g. on submit\n * b. only accept values for unmodified fields, e.g. on autosave\n */\n let shouldAcceptValue =\n incomingField.addedByServer ||\n acceptValues === true ||\n (typeof acceptValues === 'object' &&\n acceptValues !== null &&\n // Note: Must be explicitly `false`, allow `null` or `undefined` to mean true\n acceptValues.overrideLocalChanges === false &&\n !currentState[path]?.isModified)\n\n /**\n * For array row fields, verify the row IDs match at the given index before accepting\n * server values. If rows were reordered or deleted while the request was in-flight,\n * the same index may refer to different rows, and accepting the server value would\n * overwrite the wrong row's data.\n *\n * This guard only applies during autosave. On explicit save (acceptValues === true),\n * the server response is authoritative and this check is bypassed.\n */\n if (shouldAcceptValue && !incomingField.addedByServer && acceptValues !== true) {\n const parsed = parseArrayFieldPath(path)\n if (parsed) {\n const { arrayPath, rowIndex } = parsed\n const clientRowId = currentState[arrayPath]?.rows?.[rowIndex]?.id\n const serverRowId = incomingState[arrayPath]?.rows?.[rowIndex]?.id\n\n if (clientRowId === undefined || (serverRowId && clientRowId !== serverRowId)) {\n shouldAcceptValue = false\n }\n }\n }\n\n let sanitizedIncomingField = incomingField\n\n if (!shouldAcceptValue) {\n /**\n * Note: do not delete properties off `incomingField` as this will mutate the original object\n * Instead, omit them from the destructured object by excluding specific keys\n * This will also ensure we don't set `undefined` into the result unnecessarily\n */\n const { initialValue, value, ...rest } = incomingField\n sanitizedIncomingField = rest\n }\n\n newState[path] = {\n ...currentState[path],\n ...sanitizedIncomingField,\n }\n\n if (\n currentState[path] &&\n 'errorPaths' in currentState[path] &&\n !('errorPaths' in incomingField)\n ) {\n newState[path].errorPaths = []\n }\n\n /**\n * Deeply merge the rows array to ensure changes to local state are not lost while the request was pending\n * For example, the server response could come back with a row which has been deleted on the client\n * Loop over the incoming rows, if it exists in client side form state, merge in any new properties from the server\n * Note: read `currentState` and not `newState` here, as the `rows` property have already been merged above\n *\n * On explicit save (acceptValues === true), the server is authoritative - accept server row order.\n * On autosave (acceptValues !== true), the client is source of truth - use ID-based matching.\n */\n if (Array.isArray(incomingField.rows) && path in currentState) {\n if (acceptValues === true) {\n // Explicit save: server is authoritative, use index-based merging\n newState[path].rows = incomingField.rows.map((serverRow, index) => ({\n ...(currentState[path]?.rows?.[index] || {}),\n ...serverRow,\n }))\n } else {\n // Autosave: client is source of truth, use ID-based matching\n newState[path].rows = [...(currentState[path]?.rows || [])] // shallow copy to avoid mutating the original array\n\n incomingField.rows.forEach((row) => {\n const indexInCurrentState = currentState[path].rows?.findIndex(\n (existingRow) => existingRow.id === row.id,\n )\n\n if (indexInCurrentState > -1) {\n newState[path].rows[indexInCurrentState] = {\n ...currentState[path].rows[indexInCurrentState],\n ...row,\n }\n } else if (row.addedByServer) {\n /**\n * Note: This is a known limitation of computed array and block rows\n * If a new row was added by the server, we append it to the _end_ of this array\n * This is because the client is the source of truth, and it has arrays ordered in a certain position\n * For example, the user may have re-ordered rows client-side while a long running request is processing\n * This means that we _cannot_ slice a new row into the second position on the server, for example\n * By the time it gets back to the client, its index is stale\n */\n const newRow = { ...row }\n delete newRow.addedByServer\n newState[path].rows.push(newRow)\n }\n })\n\n /**\n * Sync the value field to match the actual row count after merging.\n * Client is source of truth for row count when rows were added/removed during the request.\n */\n if ('value' in incomingField && newState[path].rows.length !== incomingField.value) {\n newState[path].value = newState[path].rows.length\n }\n }\n }\n\n // If `valid` is `undefined`, mark it as `true`\n if (incomingField.valid !== false) {\n newState[path].valid = true\n }\n\n // If `passesCondition` is `undefined`, mark it as `true`\n if (incomingField.passesCondition !== false) {\n newState[path].passesCondition = true\n }\n\n /**\n * Undefined values for blocksFilterOptions coming back should be treated as \"all blocks allowed\" and\n * should always be merged in.\n * Without this, an undefined value coming back will incorrectly be ignored, and the previous filter will remain.\n */\n if (!incomingField.blocksFilterOptions) {\n delete newState[path].blocksFilterOptions\n }\n\n // Strip away the `addedByServer` property from the client\n // This will prevent it from being passed back to the server\n delete newState[path].addedByServer\n }\n\n // Return the original object reference if the state is unchanged\n // This will avoid unnecessary re-renders and dependency updates\n return dequal(newState, currentState) ? currentState : newState\n}\n"],"mappings":"AAAA;;AAGA,SAASA,MAAM,QAAQ,cAAa,CAAC;AAuBrC;;;;;;;;;;;;;;;AAeA,SAASC,oBAAoBC,IAAY;EAKvC,MAAMC,QAAA,GAAWD,IAAA,CAAKE,KAAK,CAAC;EAE5B;EACA,IAAIC,gBAAA,GAAmB,CAAC;EACxB,KAAK,IAAIC,CAAA,GAAIH,QAAA,CAASI,MAAM,GAAG,GAAGD,CAAA,IAAK,GAAGA,CAAA,IAAK;IAC7C,IAAI,QAAQE,IAAI,CAACL,QAAQ,CAACG,CAAA,CAAE,GAAG;MAC7BD,gBAAA,GAAmBC,CAAA;MACnB;IACF;EACF;EAEA;EACA,IAAID,gBAAA,KAAqB,CAAC,KAAKA,gBAAA,KAAqBF,QAAA,CAASI,MAAM,GAAG,GAAG;IACvE,OAAO;EACT;EAEA,OAAO;IACLE,SAAA,EAAWN,QAAA,CAASO,KAAK,CAAC,GAAGL,gBAAA,EAAkBM,IAAI,CAAC;IACpDC,SAAA,EAAWT,QAAA,CAASO,KAAK,CAACL,gBAAA,GAAmB,GAAGM,IAAI,CAAC;IACrDE,QAAA,EAAUC,QAAA,CAASX,QAAQ,CAACE,gBAAA,CAAiB,EAAE;EACjD;AACF;AAEA;;;;;;;;;;;;AAYA,OAAO,MAAMU,oBAAA,GAAuBA,CAAC;EACnCC,YAAY;EACZC,YAAA,GAAe,CAAC,CAAC;EACjBC;AAAa,CACR;EACL,MAAMC,QAAA,GAAW;IAAE,GAAGF;EAAa;EAEnC,KAAK,MAAM,CAACf,IAAA,EAAMkB,aAAA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zB,aAAa;YAC3BJ,QAAQ,CAACjB,IAAA,CAAK,CAAC2B,IAAI,CAACoB,IAAI,CAACD,MAAA;UAC3B;QACF;QAEA;;;;QAIA,IAAI,WAAW5B,aAAA,IAAiBD,QAAQ,CAACjB,IAAA,CAAK,CAAC2B,IAAI,CAACtB,MAAM,KAAKa,aAAA,CAAce,KAAK,EAAE;UAClFhB,QAAQ,CAACjB,IAAA,CAAK,CAACiC,KAAK,GAAGhB,QAAQ,CAACjB,IAAA,CAAK,CAAC2B,IAAI,CAACtB,MAAM;QACnD;MACF;IACF;IAEA;IACA,IAAIa,aAAA,CAAc8B,KAAK,KAAK,OAAO;MACjC/B,QAAQ,CAACjB,IAAA,CAAK,CAACgD,KAAK,GAAG;IACzB;IAEA;IACA,IAAI9B,aAAA,CAAc+B,eAAe,KAAK,OAAO;MAC3ChC,QAAQ,CAACjB,IAAA,CAAK,CAACiD,eAAe,GAAG;IACnC;IAEA;;;;;IAKA,IAAI,CAAC/B,aAAA,CAAcgC,mBAAmB,EAAE;MACtC,OAAOjC,QAAQ,CAACjB,IAAA,CAAK,CAACkD,mBAAmB;IAC3C;IAEA;IACA;IACA,OAAOjC,QAAQ,CAACjB,IAAA,CAAK,CAACqB,aAAa;EACrC;EAEA;EACA;EACA,OAAOvB,MAAA,CAAOmB,QAAA,EAAUF,YAAA,IAAgBA,YAAA,GAAeE,QAAA;AACzD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/TableView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,aAAa,yBAazB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export const TableViewIcon = () => {
|
|
4
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
5
|
+
className: "icon icon--table-view",
|
|
6
|
+
fill: "currentColor",
|
|
7
|
+
height: "20",
|
|
8
|
+
viewBox: "0 0 16 16",
|
|
9
|
+
width: "20",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
12
|
+
d: "M2 10.4078H5.27273V13H2.90874C2.30955 12.9998 2 12.6052 2 12.3207V10.4078ZM5.27273 9.29666H2V6.70334H5.27273V9.29666ZM14 9.29666H6.36364V6.70334H14V9.29666ZM14 12.3207C14 12.6052 13.6905 12.9998 13.0913 13H6.36364V10.4078H14V12.3207ZM2 3.67925C2 3.39484 2.30955 3.00016 2.90874 3H5.27273V5.59223H2V3.67925ZM14 5.59223H6.36364V3H13.0913C13.6905 3.00016 14 3.39484 14 3.67925V5.59223Z"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","TableViewIcon","_jsx","className","fill","height","viewBox","width","xmlns","d"],"sources":["../../../src/icons/TableView/index.tsx"],"sourcesContent":["import React from 'react'\n\nexport const TableViewIcon = () => {\n return (\n <svg\n className=\"icon icon--table-view\"\n fill=\"currentColor\"\n height=\"20\"\n viewBox=\"0 0 16 16\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M2 10.4078H5.27273V13H2.90874C2.30955 12.9998 2 12.6052 2 12.3207V10.4078ZM5.27273 9.29666H2V6.70334H5.27273V9.29666ZM14 9.29666H6.36364V6.70334H14V9.29666ZM14 12.3207C14 12.6052 13.6905 12.9998 13.0913 13H6.36364V10.4078H14V12.3207ZM2 3.67925C2 3.39484 2.30955 3.00016 2.90874 3H5.27273V5.59223H2V3.67925ZM14 5.59223H6.36364V3H13.0913C13.6905 3.00016 14 3.39484 14 3.67925V5.59223Z\" />\n </svg>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,OAAO,MAAMC,aAAA,GAAgBA,CAAA;EAC3B,oBACEC,IAAA,CAAC;IACCC,SAAA,EAAU;IACVC,IAAA,EAAK;IACLC,MAAA,EAAO;IACPC,OAAA,EAAQ;IACRC,KAAA,EAAM;IACNC,KAAA,EAAM;cAEN,aAAAN,IAAA,CAAC;MAAKO,CAAA,EAAE;;;AAGd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,KAAK,EAEV,qBAAqB,EAGrB,sBAAsB,EAEvB,MAAM,YAAY,CAAA;AAQnB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,KAAK,EAEV,qBAAqB,EAGrB,sBAAsB,EAEvB,MAAM,YAAY,CAAA;AAQnB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAkZ9D,CAAA;AAED,eAAO,MAAM,YAAY,QAAO,qBAM/B,CAAA"}
|
|
@@ -103,11 +103,15 @@ export const HierarchyProvider = ({
|
|
|
103
103
|
// If baseFilter is provided, replace cache entirely (tenant changed)
|
|
104
104
|
// Otherwise merge to support incremental loading
|
|
105
105
|
if (newBaseFilter !== undefined || !existingEntry) {
|
|
106
|
-
newCache.set(slug,
|
|
106
|
+
newCache.set(slug, {
|
|
107
|
+
...treeData,
|
|
108
|
+
baseFilter: newBaseFilter ?? null
|
|
109
|
+
});
|
|
107
110
|
} else {
|
|
108
111
|
const existingDocIds = new Set(existingEntry.docs.map(doc_0 => doc_0.id));
|
|
109
112
|
const newDocs = treeData.docs.filter(doc_1 => !existingDocIds.has(doc_1.id));
|
|
110
113
|
newCache.set(slug, {
|
|
114
|
+
baseFilter: existingEntry.baseFilter,
|
|
111
115
|
docs: [...existingEntry.docs, ...newDocs],
|
|
112
116
|
loadedParents: {
|
|
113
117
|
...existingEntry.loadedParents,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useRouter","DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","viewCollectionSlug","setViewCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKey","setTreeRefreshKey","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","newViewCollectionSlug","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","loadedParents","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","url","path","push","refresh","loadMoreChildren","parentKey","parentMeta","hasMore","currentChildren","nextPage","Math","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","totalDocs","reset","refreshTree","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\nimport { useRouter } from 'next/navigation.js'\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, formatAdminURL, PREFERENCE_KEYS } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useState } from 'react'\n\nimport type {\n AllowedCollection,\n HierarchyContextValue,\n HierarchyDocument,\n HierarchyHydrateData,\n HierarchyProviderProps,\n HierarchyTreeCacheEntry,\n} from './types.js'\n\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback.js'\nimport { useConfig } from '../Config/index.js'\nimport { usePreferences } from '../Preferences/index.js'\n\nconst HierarchyContext = createContext<HierarchyContextValue | undefined>(undefined)\n\nexport const HierarchyProvider: React.FC<HierarchyProviderProps> = ({ children }) => {\n const { setPreference } = usePreferences()\n const router = useRouter()\n const {\n config: {\n routes: { admin: adminRoute, api },\n serverURL,\n },\n } = useConfig()\n\n const [baseFilter, setBaseFilter] = useState<null | Where>(null)\n const [collectionSlug, setCollectionSlug] = useState<null | string>(null)\n const [viewCollectionSlug, setViewCollectionSlug] = useState<null | string>(null)\n const [parent, setParent] = useState<null | (Record<string, unknown> & TypeWithID)>(null)\n const [parentFieldName, setParentFieldName] = useState<string>('')\n const [treeLimit, setTreeLimit] = useState<number>(DEFAULT_HIERARCHY_TREE_LIMIT)\n const [typeFieldName, setTypeFieldName] = useState<null | string>(null)\n const [useAsTitle, setUseAsTitle] = useState<null | string>(null)\n const [allowedCollections, setAllowedCollections] = useState<AllowedCollection[] | null>(null)\n\n const [treeCache, setTreeCache] = useState<Map<string, HierarchyTreeCacheEntry>>(() => new Map())\n const [expandedNodesByCollection, setExpandedNodesByCollection] = useState<\n Map<string, Set<number | string>>\n >(() => new Map())\n const [selectedFiltersByCollection, setSelectedFiltersByCollection] = useState<\n Map<string, string[]>\n >(() => new Map())\n const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false)\n const [loadingNodeId, setLoadingNodeId] = useState<null | number | string>(null)\n const [treeRefreshKey, setTreeRefreshKey] = useState<number>(0)\n\n const getNodeChildren = useCallback(\n (parentId: null | number | string): HierarchyDocument[] => {\n if (!collectionSlug) {\n return []\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return []\n }\n\n return cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n },\n [collectionSlug, parentFieldName, treeCache],\n )\n\n const hydrate = useCallback((data: HierarchyHydrateData) => {\n const {\n allowedCollections: newAllowedCollections,\n baseFilter: newBaseFilter,\n collectionSlug: slug,\n expandedNodes: newExpandedNodes,\n parent: newParent,\n parentFieldName: newParentFieldName,\n selectedFilters: newSelectedFilters,\n treeData,\n treeLimit: newTreeLimit,\n typeFieldName: newTypeFieldName,\n useAsTitle: newUseAsTitle,\n viewCollectionSlug: newViewCollectionSlug,\n } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\n }\n\n if (newViewCollectionSlug) {\n setViewCollectionSlug(newViewCollectionSlug)\n }\n\n if (newAllowedCollections) {\n setAllowedCollections(newAllowedCollections)\n }\n\n if (newParentFieldName) {\n setParentFieldName(newParentFieldName)\n }\n\n if (newTreeLimit !== undefined) {\n setTreeLimit(newTreeLimit)\n }\n\n if (newTypeFieldName !== undefined) {\n setTypeFieldName(newTypeFieldName)\n }\n\n if (newParent !== undefined) {\n setParent(newParent)\n }\n\n if (newUseAsTitle !== undefined) {\n setUseAsTitle(newUseAsTitle)\n }\n\n if (treeData) {\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(slug)\n\n // If baseFilter is provided, replace cache entirely (tenant changed)\n // Otherwise merge to support incremental loading\n if (newBaseFilter !== undefined || !existingEntry) {\n newCache.set(slug, treeData)\n } else {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const newDocs = treeData.docs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(slug, {\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n ...treeData.loadedParents,\n },\n })\n }\n\n return newCache\n })\n }\n\n if (newExpandedNodes && newExpandedNodes.length > 0) {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const existingExpanded = newMap.get(slug) || new Set()\n const mergedExpanded = new Set([...existingExpanded, ...newExpandedNodes])\n newMap.set(slug, mergedExpanded)\n return newMap\n })\n }\n\n if (newSelectedFilters) {\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(slug, newSelectedFilters)\n return newMap\n })\n }\n }, [])\n\n const savePreferencesDebounced = useDebouncedCallback(\n async (slug: string, data: { expanded?: Set<number | string>; filters?: string[] }) => {\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${slug}`\n const currentExpanded = expandedNodesByCollection.get(slug) || new Set()\n const currentFilters = selectedFiltersByCollection.get(slug) || []\n\n await setPreference(preferenceKey, {\n expandedNodes: Array.from(data.expanded ?? currentExpanded),\n selectedFilters: data.filters ?? currentFilters,\n })\n },\n 500,\n )\n\n const toggleNodeForCollection = useCallback(\n (slug: string, id: number | string) => {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const currentExpanded = newMap.get(slug) || new Set()\n const newExpanded = new Set(currentExpanded)\n\n if (newExpanded.has(id)) {\n newExpanded.delete(id)\n } else {\n newExpanded.add(id)\n }\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const toggleNode = useCallback(\n (id: number | string) => {\n if (!collectionSlug) {\n return\n }\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n const getExpandedNodesForCollection = useCallback(\n (slug: string): Set<number | string> => {\n return expandedNodesByCollection.get(slug) || new Set()\n },\n [expandedNodesByCollection],\n )\n\n const getTreeDataForCollection = useCallback(\n (slug: string) => {\n return treeCache.get(slug) || null\n },\n [treeCache],\n )\n\n const setSelectedFilters = useCallback(\n (filters: string[]) => {\n if (!collectionSlug) {\n return\n }\n\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(collectionSlug, filters)\n savePreferencesDebounced(collectionSlug, { filters })\n return newMap\n })\n },\n [collectionSlug, savePreferencesDebounced],\n )\n\n const selectParent = useCallback(\n (id: null | number | string) => {\n if (!collectionSlug) {\n return\n }\n\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?parent=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, router],\n )\n\n const loadMoreChildren = useCallback(\n async (parentId: null | number | string): Promise<void> => {\n if (!collectionSlug || isLoadingMore) {\n return\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return\n }\n\n const parentKey = parentId === null ? 'root' : String(parentId)\n const parentMeta = cache.loadedParents[parentKey]\n if (!parentMeta || !parentMeta.hasMore) {\n return\n }\n\n setIsLoadingMore(true)\n setLoadingNodeId(parentId)\n\n try {\n const currentChildren = cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n\n const nextPage = Math.floor(currentChildren.length / treeLimit) + 1\n\n const where =\n parentId === null\n ? {\n or: [\n { [parentFieldName]: { exists: false } },\n { [parentFieldName]: { equals: null } },\n ],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n const queryString = qs.stringify(\n { limit: treeLimit, page: nextPage, sort: useAsTitle ?? 'id', where },\n { addQueryPrefix: true },\n )\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n const response = await fetch(url, {\n credentials: 'include',\n })\n\n if (!response.ok) {\n throw new Error('Failed to fetch more children')\n }\n\n const data = await response.json()\n const newDocs = data.docs || []\n\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(collectionSlug)\n\n if (existingEntry) {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const uniqueNewDocs = newDocs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(collectionSlug, {\n docs: [...existingEntry.docs, ...uniqueNewDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n [parentKey]: {\n hasMore: data.hasNextPage || false,\n totalDocs: data.totalDocs || 0,\n },\n },\n })\n }\n\n return newCache\n })\n } catch {\n // Failed to load more children - silently fail\n } finally {\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }\n },\n [\n api,\n collectionSlug,\n isLoadingMore,\n parentFieldName,\n serverURL,\n treeCache,\n treeLimit,\n useAsTitle,\n ],\n )\n\n const reset = useCallback(() => {\n setBaseFilter(null)\n setCollectionSlug(null)\n setViewCollectionSlug(null)\n setParent(null)\n setParentFieldName('')\n setTreeLimit(DEFAULT_HIERARCHY_TREE_LIMIT)\n setTypeFieldName(null)\n setUseAsTitle(null)\n setTreeCache(new Map())\n setExpandedNodesByCollection(new Map())\n setSelectedFiltersByCollection(new Map())\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }, [])\n\n const refreshTree = useCallback(() => {\n setTreeCache(new Map())\n setTreeRefreshKey((prev) => prev + 1)\n }, [])\n\n const expandedNodes =\n collectionSlug && expandedNodesByCollection.has(collectionSlug)\n ? expandedNodesByCollection.get(collectionSlug)\n : new Set<number | string>()\n\n const selectedFilters =\n collectionSlug && selectedFiltersByCollection.has(collectionSlug)\n ? selectedFiltersByCollection.get(collectionSlug)\n : []\n\n const value: HierarchyContextValue = {\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n getExpandedNodesForCollection,\n getNodeChildren,\n getTreeDataForCollection,\n hydrate,\n isLoadingMore,\n loadingNodeId,\n loadMoreChildren,\n parent,\n parentFieldName,\n refreshTree,\n reset,\n selectedFilters,\n selectParent,\n setSelectedFilters,\n toggleNode,\n toggleNodeForCollection,\n treeLimit,\n treeRefreshKey,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n }\n\n return <HierarchyContext value={value}>{children}</HierarchyContext>\n}\n\nexport const useHierarchy = (): HierarchyContextValue => {\n const context = use(HierarchyContext)\n if (!context) {\n throw new Error('useHierarchy must be used within HierarchyProvider')\n }\n return context\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,SAAS,QAAQ;AAC1B,SAASC,4BAA4B,EAAEC,cAAc,EAAEC,eAAe,QAAQ;AAC9E,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAWjE,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,gBAAA,gBAAmBP,aAAA,CAAiDQ,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE,GAAGL,cAAA;EAC1B,MAAMM,MAAA,GAASlB,SAAA;EACf,MAAM;IACJmB,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,UAAU;QAAEC;MAAG,CAAE;MAClCC;IAAS;EACV,CACF,GAAGb,SAAA;EAEJ,MAAM,CAACc,UAAA,EAAYC,aAAA,CAAc,GAAGjB,QAAA,CAAuB;EAC3D,MAAM,CAACkB,cAAA,EAAgBC,iBAAA,CAAkB,GAAGnB,QAAA,CAAwB;EACpE,MAAM,CAACoB,kBAAA,EAAoBC,qBAAA,CAAsB,GAAGrB,QAAA,CAAwB;EAC5E,MAAM,CAACsB,MAAA,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UAAA;IACAE,cAAA;IACA2C,aAAA;IACAwC,6BAAA;IACAtD,eAAA;IACAuD,wBAAA;IACA9C,OAAA;IACAf,aAAA;IACAE,aAAA;IACAkE,gBAAA;IACAvF,MAAA;IACAE,eAAA;IACAkH,WAAA;IACAD,KAAA;IACAxE,eAAA;IACAuC,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAJ,uBAAA;IACAtE,SAAA;IACAmB,cAAA;IACAjB,aAAA;IACAE,UAAA;IACAV;EACF;EAEA,oBAAOwH,IAAA,CAACxI,gBAAA;IAAiBuI,KAAA,EAAOA,KAAA;cAAQpI;;AAC1C;AAEA,OAAO,MAAMsI,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUhJ,GAAA,CAAIM,gBAAA;EACpB,IAAI,CAAC0I,OAAA,EAAS;IACZ,MAAM,IAAIV,KAAA,CAAM;EAClB;EACA,OAAOU,OAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useRouter","DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","viewCollectionSlug","setViewCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKey","setTreeRefreshKey","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","newViewCollectionSlug","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","loadedParents","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","url","path","push","refresh","loadMoreChildren","parentKey","parentMeta","hasMore","currentChildren","nextPage","Math","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","totalDocs","reset","refreshTree","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\nimport { useRouter } from 'next/navigation.js'\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, formatAdminURL, PREFERENCE_KEYS } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useState } from 'react'\n\nimport type {\n AllowedCollection,\n HierarchyContextValue,\n HierarchyDocument,\n HierarchyHydrateData,\n HierarchyProviderProps,\n HierarchyTreeCacheEntry,\n} from './types.js'\n\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback.js'\nimport { useConfig } from '../Config/index.js'\nimport { usePreferences } from '../Preferences/index.js'\n\nconst HierarchyContext = createContext<HierarchyContextValue | undefined>(undefined)\n\nexport const HierarchyProvider: React.FC<HierarchyProviderProps> = ({ children }) => {\n const { setPreference } = usePreferences()\n const router = useRouter()\n const {\n config: {\n routes: { admin: adminRoute, api },\n serverURL,\n },\n } = useConfig()\n\n const [baseFilter, setBaseFilter] = useState<null | Where>(null)\n const [collectionSlug, setCollectionSlug] = useState<null | string>(null)\n const [viewCollectionSlug, setViewCollectionSlug] = useState<null | string>(null)\n const [parent, setParent] = useState<null | (Record<string, unknown> & TypeWithID)>(null)\n const [parentFieldName, setParentFieldName] = useState<string>('')\n const [treeLimit, setTreeLimit] = useState<number>(DEFAULT_HIERARCHY_TREE_LIMIT)\n const [typeFieldName, setTypeFieldName] = useState<null | string>(null)\n const [useAsTitle, setUseAsTitle] = useState<null | string>(null)\n const [allowedCollections, setAllowedCollections] = useState<AllowedCollection[] | null>(null)\n\n const [treeCache, setTreeCache] = useState<Map<string, HierarchyTreeCacheEntry>>(() => new Map())\n const [expandedNodesByCollection, setExpandedNodesByCollection] = useState<\n Map<string, Set<number | string>>\n >(() => new Map())\n const [selectedFiltersByCollection, setSelectedFiltersByCollection] = useState<\n Map<string, string[]>\n >(() => new Map())\n const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false)\n const [loadingNodeId, setLoadingNodeId] = useState<null | number | string>(null)\n const [treeRefreshKey, setTreeRefreshKey] = useState<number>(0)\n\n const getNodeChildren = useCallback(\n (parentId: null | number | string): HierarchyDocument[] => {\n if (!collectionSlug) {\n return []\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return []\n }\n\n return cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n },\n [collectionSlug, parentFieldName, treeCache],\n )\n\n const hydrate = useCallback((data: HierarchyHydrateData) => {\n const {\n allowedCollections: newAllowedCollections,\n baseFilter: newBaseFilter,\n collectionSlug: slug,\n expandedNodes: newExpandedNodes,\n parent: newParent,\n parentFieldName: newParentFieldName,\n selectedFilters: newSelectedFilters,\n treeData,\n treeLimit: newTreeLimit,\n typeFieldName: newTypeFieldName,\n useAsTitle: newUseAsTitle,\n viewCollectionSlug: newViewCollectionSlug,\n } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\n }\n\n if (newViewCollectionSlug) {\n setViewCollectionSlug(newViewCollectionSlug)\n }\n\n if (newAllowedCollections) {\n setAllowedCollections(newAllowedCollections)\n }\n\n if (newParentFieldName) {\n setParentFieldName(newParentFieldName)\n }\n\n if (newTreeLimit !== undefined) {\n setTreeLimit(newTreeLimit)\n }\n\n if (newTypeFieldName !== undefined) {\n setTypeFieldName(newTypeFieldName)\n }\n\n if (newParent !== undefined) {\n setParent(newParent)\n }\n\n if (newUseAsTitle !== undefined) {\n setUseAsTitle(newUseAsTitle)\n }\n\n if (treeData) {\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(slug)\n\n // If baseFilter is provided, replace cache entirely (tenant changed)\n // Otherwise merge to support incremental loading\n if (newBaseFilter !== undefined || !existingEntry) {\n newCache.set(slug, { ...treeData, baseFilter: newBaseFilter ?? null })\n } else {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const newDocs = treeData.docs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(slug, {\n baseFilter: existingEntry.baseFilter,\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n ...treeData.loadedParents,\n },\n })\n }\n\n return newCache\n })\n }\n\n if (newExpandedNodes && newExpandedNodes.length > 0) {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const existingExpanded = newMap.get(slug) || new Set()\n const mergedExpanded = new Set([...existingExpanded, ...newExpandedNodes])\n newMap.set(slug, mergedExpanded)\n return newMap\n })\n }\n\n if (newSelectedFilters) {\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(slug, newSelectedFilters)\n return newMap\n })\n }\n }, [])\n\n const savePreferencesDebounced = useDebouncedCallback(\n async (slug: string, data: { expanded?: Set<number | string>; filters?: string[] }) => {\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${slug}`\n const currentExpanded = expandedNodesByCollection.get(slug) || new Set()\n const currentFilters = selectedFiltersByCollection.get(slug) || []\n\n await setPreference(preferenceKey, {\n expandedNodes: Array.from(data.expanded ?? currentExpanded),\n selectedFilters: data.filters ?? currentFilters,\n })\n },\n 500,\n )\n\n const toggleNodeForCollection = useCallback(\n (slug: string, id: number | string) => {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const currentExpanded = newMap.get(slug) || new Set()\n const newExpanded = new Set(currentExpanded)\n\n if (newExpanded.has(id)) {\n newExpanded.delete(id)\n } else {\n newExpanded.add(id)\n }\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const toggleNode = useCallback(\n (id: number | string) => {\n if (!collectionSlug) {\n return\n }\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n const getExpandedNodesForCollection = useCallback(\n (slug: string): Set<number | string> => {\n return expandedNodesByCollection.get(slug) || new Set()\n },\n [expandedNodesByCollection],\n )\n\n const getTreeDataForCollection = useCallback(\n (slug: string) => {\n return treeCache.get(slug) || null\n },\n [treeCache],\n )\n\n const setSelectedFilters = useCallback(\n (filters: string[]) => {\n if (!collectionSlug) {\n return\n }\n\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(collectionSlug, filters)\n savePreferencesDebounced(collectionSlug, { filters })\n return newMap\n })\n },\n [collectionSlug, savePreferencesDebounced],\n )\n\n const selectParent = useCallback(\n (id: null | number | string) => {\n if (!collectionSlug) {\n return\n }\n\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?parent=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, router],\n )\n\n const loadMoreChildren = useCallback(\n async (parentId: null | number | string): Promise<void> => {\n if (!collectionSlug || isLoadingMore) {\n return\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return\n }\n\n const parentKey = parentId === null ? 'root' : String(parentId)\n const parentMeta = cache.loadedParents[parentKey]\n if (!parentMeta || !parentMeta.hasMore) {\n return\n }\n\n setIsLoadingMore(true)\n setLoadingNodeId(parentId)\n\n try {\n const currentChildren = cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n\n const nextPage = Math.floor(currentChildren.length / treeLimit) + 1\n\n const where =\n parentId === null\n ? {\n or: [\n { [parentFieldName]: { exists: false } },\n { [parentFieldName]: { equals: null } },\n ],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n const queryString = qs.stringify(\n { limit: treeLimit, page: nextPage, sort: useAsTitle ?? 'id', where },\n { addQueryPrefix: true },\n )\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n const response = await fetch(url, {\n credentials: 'include',\n })\n\n if (!response.ok) {\n throw new Error('Failed to fetch more children')\n }\n\n const data = await response.json()\n const newDocs = data.docs || []\n\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(collectionSlug)\n\n if (existingEntry) {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const uniqueNewDocs = newDocs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(collectionSlug, {\n docs: [...existingEntry.docs, ...uniqueNewDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n [parentKey]: {\n hasMore: data.hasNextPage || false,\n totalDocs: data.totalDocs || 0,\n },\n },\n })\n }\n\n return newCache\n })\n } catch {\n // Failed to load more children - silently fail\n } finally {\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }\n },\n [\n api,\n collectionSlug,\n isLoadingMore,\n parentFieldName,\n serverURL,\n treeCache,\n treeLimit,\n useAsTitle,\n ],\n )\n\n const reset = useCallback(() => {\n setBaseFilter(null)\n setCollectionSlug(null)\n setViewCollectionSlug(null)\n setParent(null)\n setParentFieldName('')\n setTreeLimit(DEFAULT_HIERARCHY_TREE_LIMIT)\n setTypeFieldName(null)\n setUseAsTitle(null)\n setTreeCache(new Map())\n setExpandedNodesByCollection(new Map())\n setSelectedFiltersByCollection(new Map())\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }, [])\n\n const refreshTree = useCallback(() => {\n setTreeCache(new Map())\n setTreeRefreshKey((prev) => prev + 1)\n }, [])\n\n const expandedNodes =\n collectionSlug && expandedNodesByCollection.has(collectionSlug)\n ? expandedNodesByCollection.get(collectionSlug)\n : new Set<number | string>()\n\n const selectedFilters =\n collectionSlug && selectedFiltersByCollection.has(collectionSlug)\n ? selectedFiltersByCollection.get(collectionSlug)\n : []\n\n const value: HierarchyContextValue = {\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n getExpandedNodesForCollection,\n getNodeChildren,\n getTreeDataForCollection,\n hydrate,\n isLoadingMore,\n loadingNodeId,\n loadMoreChildren,\n parent,\n parentFieldName,\n refreshTree,\n reset,\n selectedFilters,\n selectParent,\n setSelectedFilters,\n toggleNode,\n toggleNodeForCollection,\n treeLimit,\n treeRefreshKey,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n }\n\n return <HierarchyContext value={value}>{children}</HierarchyContext>\n}\n\nexport const useHierarchy = (): HierarchyContextValue => {\n const context = use(HierarchyContext)\n if (!context) {\n throw new Error('useHierarchy must be used within HierarchyProvider')\n }\n return context\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,SAAS,QAAQ;AAC1B,SAASC,4BAA4B,EAAEC,cAAc,EAAEC,eAAe,QAAQ;AAC9E,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAWjE,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,gBAAA,gBAAmBP,aAAA,CAAiDQ,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE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ACjBE,gBAAA,CAAiB;EACnB,GAAG,EAAE;EAEL,MAAM8F,WAAA,GAAc3I,WAAA,CAAY;IAC9BoC,YAAA,CAAa,IAAIC,GAAA;IACjBU,iBAAA,CAAmB0B,MAAA,IAASA,MAAA,GAAO;EACrC,GAAG,EAAE;EAEL,MAAMX,aAAA,GACJ3C,cAAA,IAAkBmB,yBAAA,CAA0B4C,GAAG,CAAC/D,cAAA,IAC5CmB,yBAAA,CAA0Ba,GAAG,CAAChC,cAAA,IAC9B,IAAI2D,GAAA;EAEV,MAAMZ,eAAA,GACJ/C,cAAA,IAAkBqB,2BAAA,CAA4B0C,GAAG,CAAC/D,cAAA,IAC9CqB,2BAAA,CAA4BW,GAAG,CAAChC,cAAA,IAChC,EAAE;EAER,MAAMyH,KAAA,GAA+B;IACnC3G,kBAAA;IACAhB,UAAA;IACAE,cAAA;IACA2C,aAAA;IACAwC,6BAAA;IACAtD,eAAA;IACAuD,wBAAA;IACA9C,OAAA;IACAf,aAAA;IACAE,aAAA;IACAkE,gBAAA;IACAvF,MAAA;IACAE,eAAA;IACAkH,WAAA;IACAD,KAAA;IACAxE,eAAA;IACAuC,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAJ,uBAAA;IACAtE,SAAA;IACAmB,cAAA;IACAjB,aAAA;IACAE,UAAA;IACAV;EACF;EAEA,oBAAOwH,IAAA,CAACxI,gBAAA;IAAiBuI,KAAA,EAAOA,KAAA;cAAQpI;;AAC1C;AAEA,OAAO,MAAMsI,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUhJ,GAAA,CAAIM,gBAAA;EACpB,IAAI,CAAC0I,OAAA,EAAS;IACZ,MAAM,IAAIV,KAAA,CAAM;EAClB;EACA,OAAOU,OAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aA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AAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAA;IAC/C,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACnC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAA;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6GAA6G;IAC7G,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/Hierarchy/types.ts"],"sourcesContent":["import type { PaginatedDocs, TypeWithID, Where } from 'payload'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n _hasChildren?: boolean\n} & TypeWithID\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeCacheEntry = {\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type AllowedCollection = { label: string; slug: string }\n\nexport type HierarchyHydrateData = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n /** When set, updates the viewCollectionSlug in context (used by list view to indicate current collection) */\n viewCollectionSlug?: string\n}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n collectionSlug: null | string\n expandedNodes: Set<number | string>\n /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n getExpandedNodesForCollection: (collectionSlug: string) => Set<number | string>\n getNodeChildren: (parentId: null | number | string) => HierarchyDocument[]\n /** Get tree data for a specific collection (returns null if not hydrated or cleared by refresh) */\n getTreeDataForCollection: (collectionSlug: string) => HierarchyInitialData | null\n hydrate: (data: HierarchyHydrateData) => void\n isLoadingMore: boolean\n loadingNodeId: null | number | string\n loadMoreChildren: (parentId: null | number | string) => Promise<void>\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent: null | (Record<string, unknown> & TypeWithID)\n parentFieldName: string\n /** Refresh the tree by clearing cache and incrementing refreshKey to force remount */\n refreshTree: () => void\n reset: () => void\n /** Selected collection type filters for the sidebar tree */\n selectedFilters: string[]\n selectParent: (id: null | number | string) => void\n /** Update selected filters (persists to preferences) */\n setSelectedFilters: (filters: string[]) => void\n toggleNode: (id: number | string) => void\n /** Toggle node expansion for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n toggleNodeForCollection: (collectionSlug: string, id: number | string) => void\n treeLimit: number\n /** Key that changes when tree should remount (incremented by refreshTree) */\n treeRefreshKey: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: null | string\n /** The collection slug of the currently viewed list (set by list view, used by sidebar tabs) */\n viewCollectionSlug: null | string\n}\n\nexport type HierarchyProviderProps = {\n children: React.ReactNode\n}\n\nexport type HydrateHierarchyProviderProps = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n /** When set, updates the viewCollectionSlug in context (used by list view to indicate current collection) */\n viewCollectionSlug?: string\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/Hierarchy/types.ts"],"sourcesContent":["import type { PaginatedDocs, TypeWithID, Where } from 'payload'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n _hasChildren?: boolean\n} & TypeWithID\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeCacheEntry = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type AllowedCollection = { label: string; slug: string }\n\nexport type HierarchyHydrateData = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n /** When set, updates the viewCollectionSlug in context (used by list view to indicate current collection) */\n viewCollectionSlug?: string\n}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n collectionSlug: null | string\n expandedNodes: Set<number | string>\n /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n getExpandedNodesForCollection: (collectionSlug: string) => Set<number | string>\n getNodeChildren: (parentId: null | number | string) => HierarchyDocument[]\n /** Get tree data for a specific collection (returns null if not hydrated or cleared by refresh) */\n getTreeDataForCollection: (collectionSlug: string) => HierarchyInitialData | null\n hydrate: (data: HierarchyHydrateData) => void\n isLoadingMore: boolean\n loadingNodeId: null | number | string\n loadMoreChildren: (parentId: null | number | string) => Promise<void>\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent: null | (Record<string, unknown> & TypeWithID)\n parentFieldName: string\n /** Refresh the tree by clearing cache and incrementing refreshKey to force remount */\n refreshTree: () => void\n reset: () => void\n /** Selected collection type filters for the sidebar tree */\n selectedFilters: string[]\n selectParent: (id: null | number | string) => void\n /** Update selected filters (persists to preferences) */\n setSelectedFilters: (filters: string[]) => void\n toggleNode: (id: number | string) => void\n /** Toggle node expansion for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n toggleNodeForCollection: (collectionSlug: string, id: number | string) => void\n treeLimit: number\n /** Key that changes when tree should remount (incremented by refreshTree) */\n treeRefreshKey: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: null | string\n /** The collection slug of the currently viewed list (set by list view, used by sidebar tabs) */\n viewCollectionSlug: null | string\n}\n\nexport type HierarchyProviderProps = {\n children: React.ReactNode\n}\n\nexport type HydrateHierarchyProviderProps = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n /** When set, updates the viewCollectionSlug in context (used by list view to indicate current collection) */\n viewCollectionSlug?: string\n}\n"],"mappings":"AAmFA","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SidebarTabsContextType = {
|
|
3
|
+
/**
|
|
4
|
+
* Reload the content for a specific tab, bypassing the cache.
|
|
5
|
+
* Useful when the tab's data dependencies change.
|
|
6
|
+
*/
|
|
7
|
+
reloadTabContent: (tabSlug: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export type SidebarTabsProviderProps = {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
reloadTabContent: (tabSlug: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const SidebarTabsProvider: React.FC<SidebarTabsProviderProps>;
|
|
14
|
+
/**
|
|
15
|
+
* Hook to access sidebar tab controls.
|
|
16
|
+
* Returns null if used outside of a SidebarTabsProvider (e.g., when there's only one tab).
|
|
17
|
+
*/
|
|
18
|
+
export declare const useSidebarTabs: () => null | SidebarTabsContextType;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/SidebarTabs/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAA;AAEjD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C,CAAA;AAID,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAKlE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,IAAI,GAAG,sBAExC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import React, { createContext, use } from 'react';
|
|
5
|
+
const SidebarTabsContext = /*#__PURE__*/createContext(null);
|
|
6
|
+
export const SidebarTabsProvider = ({
|
|
7
|
+
children,
|
|
8
|
+
reloadTabContent
|
|
9
|
+
}) => {
|
|
10
|
+
return /*#__PURE__*/_jsx(SidebarTabsContext, {
|
|
11
|
+
value: {
|
|
12
|
+
reloadTabContent
|
|
13
|
+
},
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Hook to access sidebar tab controls.
|
|
19
|
+
* Returns null if used outside of a SidebarTabsProvider (e.g., when there's only one tab).
|
|
20
|
+
*/
|
|
21
|
+
export const useSidebarTabs = () => {
|
|
22
|
+
return use(SidebarTabsContext);
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","createContext","use","SidebarTabsContext","SidebarTabsProvider","children","reloadTabContent","_jsx","value","useSidebarTabs"],"sources":["../../../src/providers/SidebarTabs/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, use } from 'react'\n\nexport type SidebarTabsContextType = {\n /**\n * Reload the content for a specific tab, bypassing the cache.\n * Useful when the tab's data dependencies change.\n */\n reloadTabContent: (tabSlug: string) => void\n}\n\nconst SidebarTabsContext = createContext<null | SidebarTabsContextType>(null)\n\nexport type SidebarTabsProviderProps = {\n children: React.ReactNode\n reloadTabContent: (tabSlug: string) => void\n}\n\nexport const SidebarTabsProvider: React.FC<SidebarTabsProviderProps> = ({\n children,\n reloadTabContent,\n}) => {\n return <SidebarTabsContext value={{ reloadTabContent }}>{children}</SidebarTabsContext>\n}\n\n/**\n * Hook to access sidebar tab controls.\n * Returns null if used outside of a SidebarTabsProvider (e.g., when there's only one tab).\n */\nexport const useSidebarTabs = (): null | SidebarTabsContextType => {\n return use(SidebarTabsContext)\n}\n"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,IAASC,aAAa,EAAEC,GAAG,QAAQ;AAU1C,MAAMC,kBAAA,gBAAqBF,aAAA,CAA6C;AAOxE,OAAO,MAAMG,mBAAA,GAA0DA,CAAC;EACtEC,QAAQ;EACRC;AAAgB,CACjB;EACC,oBAAOC,IAAA,CAACJ,kBAAA;IAAmBK,KAAA,EAAO;MAAEF;IAAiB;cAAID;;AAC3D;AAEA;;;;AAIA,OAAO,MAAMI,cAAA,GAAiBA,CAAA;EAC5B,OAAOP,GAAA,CAAIC,kBAAA;AACb","ignoreList":[]}
|