@payloadcms/ui 4.0.0-internal.af6aad0 → 4.0.0-internal.b8e7c89
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/AddNewRelation/index.css +4 -0
- package/dist/elements/AddNewRelation/index.js +2 -2
- package/dist/elements/AddNewRelation/index.js.map +1 -1
- package/dist/elements/AppHeader/index.css +0 -4
- package/dist/elements/AppHeader/index.d.ts +8 -1
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +14 -5
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +2 -3
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +2 -3
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/Button/index.css +0 -23
- package/dist/elements/Button/types.d.ts +1 -1
- package/dist/elements/Button/types.d.ts.map +1 -1
- package/dist/elements/Button/types.js.map +1 -1
- package/dist/elements/CopyLocaleData/index.d.ts.map +1 -1
- package/dist/elements/CopyLocaleData/index.js +8 -9
- package/dist/elements/CopyLocaleData/index.js.map +1 -1
- package/dist/elements/DefaultListViewTabs/index.css +0 -1
- package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
- package/dist/elements/DefaultListViewTabs/index.js +62 -84
- package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +2 -3
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/types.d.ts +1 -1
- package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/types.js.map +1 -1
- package/dist/elements/Drawer/types.d.ts +2 -2
- package/dist/elements/Drawer/types.d.ts.map +1 -1
- package/dist/elements/Drawer/types.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +2 -3
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/EditMany/DrawerContent.js +2 -3
- package/dist/elements/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +4 -22
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +49 -68
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +15 -100
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js +137 -97
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.js +23 -51
- package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +3 -26
- package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.js +1 -6
- package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.server.js +3 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -1
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +36 -0
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +13 -0
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +141 -0
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +1 -0
- package/dist/elements/Hierarchy/Field/index.client.d.ts +0 -5
- package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Field/index.client.js +95 -120
- package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
- package/dist/elements/Hierarchy/Field/index.css +34 -3
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +4 -18
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +24 -88
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
- package/dist/elements/Hierarchy/Modal/index.css +53 -4
- package/dist/elements/Hierarchy/Modal/index.d.ts +2 -5
- package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Modal/index.js +99 -136
- package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
- package/dist/elements/Hierarchy/Modal/types.d.ts +0 -15
- package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
- package/dist/elements/Hierarchy/MoveMany/index.d.ts +3 -7
- package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/MoveMany/index.js +171 -45
- package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
- package/dist/elements/Hierarchy/Search/index.css +9 -2
- package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Search/index.js +73 -6
- package/dist/elements/Hierarchy/Search/index.js.map +1 -1
- package/dist/elements/Hierarchy/Search/types.d.ts +6 -2
- package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Search/types.js.map +1 -1
- package/dist/elements/Hierarchy/Search/useHierarchySearch.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Search/useHierarchySearch.js +2 -3
- package/dist/elements/Hierarchy/Search/useHierarchySearch.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts +4 -0
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +186 -101
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +21 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/LoadMore/index.css +3 -3
- package/dist/elements/Hierarchy/Tree/TreeNode/index.css +29 -59
- package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js +10 -54
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/index.css +9 -8
- package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/index.js +47 -29
- package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/types.d.ts +1 -9
- package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/types.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/useChildren.js +1 -11
- package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +2 -3
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListControls/types.d.ts +0 -4
- package/dist/elements/ListControls/types.d.ts.map +1 -1
- package/dist/elements/ListControls/types.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +2 -3
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
- package/dist/elements/LivePreview/Window/index.js +1 -1
- package/dist/elements/LivePreview/Window/index.js.map +1 -1
- package/dist/elements/Localizer/index.js +1 -1
- package/dist/elements/Localizer/index.js.map +1 -1
- package/dist/elements/Nav/NavSidebarToggle/index.js +1 -1
- package/dist/elements/Nav/NavSidebarToggle/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.d.ts +0 -1
- package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +18 -12
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.css +2 -1
- package/dist/elements/Nav/context.d.ts +1 -0
- package/dist/elements/Nav/context.d.ts.map +1 -1
- package/dist/elements/Nav/context.js +67 -92
- package/dist/elements/Nav/context.js.map +1 -1
- package/dist/elements/Nav/index.css +42 -47
- package/dist/elements/Nav/index.d.ts +0 -4
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +1 -16
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/elements/NavGroup/index.css +15 -29
- package/dist/elements/Popup/PopupButtonList/index.css +16 -32
- package/dist/elements/Popup/index.css +0 -6
- package/dist/elements/Popup/index.d.ts +0 -10
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +5 -12
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js +8 -30
- package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
- package/dist/elements/PublishButton/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/index.js +5 -6
- package/dist/elements/PublishButton/index.js.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.js +2 -3
- package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +0 -5
- package/dist/elements/ReactSelect/types.d.ts.map +1 -1
- package/dist/elements/ReactSelect/types.js.map +1 -1
- package/dist/elements/RestoreMany/index.d.ts.map +1 -1
- package/dist/elements/RestoreMany/index.js +2 -3
- package/dist/elements/RestoreMany/index.js.map +1 -1
- package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
- package/dist/elements/SaveDraftButton/index.js +2 -3
- package/dist/elements/SaveDraftButton/index.js.map +1 -1
- package/dist/elements/SelectAll/index.d.ts.map +1 -1
- package/dist/elements/SelectAll/index.js +2 -1
- package/dist/elements/SelectAll/index.js.map +1 -1
- package/dist/elements/SelectRow/index.d.ts.map +1 -1
- package/dist/elements/SelectRow/index.js +2 -1
- package/dist/elements/SelectRow/index.js.map +1 -1
- package/dist/elements/SidebarRow/index.css +5 -1
- package/dist/elements/SidebarToggle/index.css +1 -3
- package/dist/elements/Status/index.d.ts.map +1 -1
- package/dist/elements/Status/index.js +2 -3
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StepNav/index.d.ts.map +1 -1
- package/dist/elements/StepNav/index.js +10 -14
- package/dist/elements/StepNav/index.js.map +1 -1
- package/dist/elements/StepNav/types.d.ts +0 -6
- package/dist/elements/StepNav/types.d.ts.map +1 -1
- package/dist/elements/StepNav/types.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +7 -5
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +3 -14
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
- package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
- package/dist/elements/Table/OrderableTable.js +2 -3
- package/dist/elements/Table/OrderableTable.js.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.js +2 -3
- package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
- package/dist/elements/UnpublishButton/index.d.ts.map +1 -1
- package/dist/elements/UnpublishButton/index.js +3 -4
- package/dist/elements/UnpublishButton/index.js.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.js +2 -3
- package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.js +39 -83
- package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.js +21 -57
- package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.js +39 -83
- package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/index.css +2 -32
- package/dist/elements/UserMenu/index.d.ts +0 -1
- package/dist/elements/UserMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/index.js +51 -77
- package/dist/elements/UserMenu/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
- package/dist/exports/client/index.d.ts +0 -4
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +1 -1
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +2 -3
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +2 -3
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts +2 -2
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js +152 -134
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/index.css +155 -168
- package/dist/fields/FieldLabel/index.d.ts.map +1 -1
- package/dist/fields/FieldLabel/index.js +4 -5
- package/dist/fields/FieldLabel/index.js.map +1 -1
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +8 -27
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
- package/dist/fields/Relationship/optionsReducer.js +0 -2
- package/dist/fields/Relationship/optionsReducer.js.map +1 -1
- package/dist/fields/Relationship/types.d.ts +0 -24
- package/dist/fields/Relationship/types.d.ts.map +1 -1
- package/dist/fields/Relationship/types.js.map +1 -1
- package/dist/fields/Slug/index.d.ts.map +1 -1
- package/dist/fields/Slug/index.js +2 -3
- package/dist/fields/Slug/index.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +2 -3
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/Input.spec.js +2 -1
- package/dist/fields/Upload/Input.spec.js.map +1 -1
- package/dist/fields/shared/index.d.ts +1 -1
- package/dist/fields/shared/index.d.ts.map +1 -1
- package/dist/fields/shared/index.js.map +1 -1
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +2 -3
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/NullifyField/index.d.ts.map +1 -1
- package/dist/forms/NullifyField/index.js +2 -3
- package/dist/forms/NullifyField/index.js.map +1 -1
- package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
- package/dist/hooks/usePayloadAPI.js +2 -3
- package/dist/hooks/usePayloadAPI.js.map +1 -1
- package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/index.js +2 -3
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/Hierarchy/index.d.ts.map +1 -1
- package/dist/providers/Hierarchy/index.js +24 -53
- package/dist/providers/Hierarchy/index.js.map +1 -1
- package/dist/providers/Hierarchy/types.d.ts +0 -2
- package/dist/providers/Hierarchy/types.d.ts.map +1 -1
- package/dist/providers/Hierarchy/types.js.map +1 -1
- package/dist/providers/LivePreview/index.d.ts.map +1 -1
- package/dist/providers/LivePreview/index.js +13 -6
- package/dist/providers/LivePreview/index.js.map +1 -1
- package/dist/providers/Locale/index.d.ts +1 -5
- package/dist/providers/Locale/index.d.ts.map +1 -1
- package/dist/providers/Locale/index.js +61 -139
- package/dist/providers/Locale/index.js.map +1 -1
- package/dist/providers/Selection/index.d.ts.map +1 -1
- package/dist/providers/Selection/index.js +2 -3
- package/dist/providers/Selection/index.js.map +1 -1
- package/dist/providers/ServerFunctions/index.d.ts +5 -1
- package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
- package/dist/providers/ServerFunctions/index.js +15 -0
- package/dist/providers/ServerFunctions/index.js.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/index.d.ts.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/index.js +0 -1
- package/dist/providers/TableColumns/buildColumnState/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/templates/Default/Wrapper/index.css +1 -2
- package/dist/templates/Default/Wrapper/index.d.ts +0 -2
- package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +6 -12
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.css +1 -3
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +15 -17
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
- package/dist/utilities/formatAbsoluteURL.js +18 -8
- package/dist/utilities/formatAbsoluteURL.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.spec.js +27 -0
- package/dist/utilities/formatAbsoluteURL.spec.js.map +1 -0
- package/dist/utilities/getHasScheduledPublish.d.ts +2 -3
- package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -1
- package/dist/utilities/getHasScheduledPublish.js +2 -5
- package/dist/utilities/getHasScheduledPublish.js.map +1 -1
- package/dist/utilities/isAbsoluteURL.d.ts +3 -0
- package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
- package/dist/utilities/isAbsoluteURL.js +15 -0
- package/dist/utilities/isAbsoluteURL.js.map +1 -0
- package/dist/utilities/isAbsoluteURL.spec.js +11 -0
- package/dist/utilities/isAbsoluteURL.spec.js.map +1 -0
- package/dist/utilities/isHttpURL.d.ts +3 -0
- package/dist/utilities/isHttpURL.d.ts.map +1 -0
- package/dist/utilities/isHttpURL.js +12 -0
- package/dist/utilities/isHttpURL.js.map +1 -0
- package/dist/utilities/isHttpURL.spec.js +25 -0
- package/dist/utilities/isHttpURL.spec.js.map +1 -0
- package/dist/utilities/schedulePublishHandler.d.ts +8 -1
- package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
- package/dist/utilities/schedulePublishHandler.js +68 -4
- package/dist/utilities/schedulePublishHandler.js.map +1 -1
- package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -1
- package/dist/utilities/serverFunctionRegistry.js +2 -1
- package/dist/utilities/serverFunctionRegistry.js.map +1 -1
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/slugify.js +2 -0
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/views/API/index.client.d.ts.map +1 -1
- package/dist/views/API/index.client.js +2 -3
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +1 -2
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.js +105 -100
- package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts +1 -6
- package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyListHeader/index.js +8 -10
- package/dist/views/HierarchyList/HierarchyListHeader/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js +10 -11
- package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.js +6 -3
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.css +0 -51
- package/dist/views/HierarchyList/HierarchyTable/index.d.ts +1 -13
- package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.js +38 -156
- package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/types.d.ts +0 -6
- package/dist/views/HierarchyList/HierarchyTable/types.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/types.js.map +1 -1
- package/dist/views/HierarchyList/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/index.js +20 -103
- package/dist/views/HierarchyList/index.js.map +1 -1
- package/dist/views/List/ListSelection/index.d.ts.map +1 -1
- package/dist/views/List/ListSelection/index.js +122 -138
- package/dist/views/List/ListSelection/index.js.map +1 -1
- package/dist/views/List/handleHierarchy.d.ts +1 -6
- package/dist/views/List/handleHierarchy.d.ts.map +1 -1
- package/dist/views/List/handleHierarchy.js +3 -34
- package/dist/views/List/handleHierarchy.js.map +1 -1
- package/dist/views/List/index.client.d.ts.map +1 -1
- package/dist/views/List/index.client.js +5 -129
- package/dist/views/List/index.client.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +16 -27
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Root/getRouteData.d.ts.map +1 -1
- package/dist/views/Root/getRouteData.js +2 -8
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +10 -13
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +12 -13
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +1 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +56 -50
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +41 -27
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.spec.js +258 -0
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.spec.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +10 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +33 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +56 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +8 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +17 -19
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +3 -13
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
- package/dist/views/Versions/VersionPillLabel/VersionPillLabel.d.ts.map +1 -1
- package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js +2 -3
- package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js.map +1 -1
- package/package.json +6 -5
- package/dist/elements/Hierarchy/CreateNewButton/index.css +0 -9
- package/dist/elements/Hierarchy/CreateNewButton/index.d.ts +0 -9
- package/dist/elements/Hierarchy/CreateNewButton/index.d.ts.map +0 -1
- package/dist/elements/Hierarchy/CreateNewButton/index.js +0 -111
- package/dist/elements/Hierarchy/CreateNewButton/index.js.map +0 -1
- package/dist/elements/Hierarchy/Modal/Footer/index.css +0 -45
- package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +0 -28
- package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +0 -1
- package/dist/elements/Hierarchy/Modal/Footer/index.js +0 -166
- package/dist/elements/Hierarchy/Modal/Footer/index.js.map +0 -1
- package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts +0 -22
- package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts.map +0 -1
- package/dist/elements/Hierarchy/getFolderHierarchySlug.js +0 -17
- package/dist/elements/Hierarchy/getFolderHierarchySlug.js.map +0 -1
- package/dist/elements/Hierarchy/move/moveDocuments.d.ts +0 -34
- package/dist/elements/Hierarchy/move/moveDocuments.d.ts.map +0 -1
- package/dist/elements/Hierarchy/move/moveDocuments.js +0 -94
- package/dist/elements/Hierarchy/move/moveDocuments.js.map +0 -1
- package/dist/elements/SegmentedControl/index.css +0 -58
- package/dist/elements/SegmentedControl/index.d.ts +0 -19
- package/dist/elements/SegmentedControl/index.d.ts.map +0 -1
- package/dist/elements/SegmentedControl/index.js +0 -104
- package/dist/elements/SegmentedControl/index.js.map +0 -1
- package/dist/elements/StepNav/DropTarget/index.css +0 -20
- package/dist/elements/StepNav/DropTarget/index.d.ts +0 -16
- package/dist/elements/StepNav/DropTarget/index.d.ts.map +0 -1
- package/dist/elements/StepNav/DropTarget/index.js +0 -71
- package/dist/elements/StepNav/DropTarget/index.js.map +0 -1
- package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts +0 -18
- package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts.map +0 -1
- package/dist/elements/UserMenu/HoverSubmenuGroup.js +0 -38
- package/dist/elements/UserMenu/HoverSubmenuGroup.js.map +0 -1
- package/dist/elements/UserMenu/useHoverSubmenu.d.ts +0 -21
- package/dist/elements/UserMenu/useHoverSubmenu.d.ts.map +0 -1
- package/dist/elements/UserMenu/useHoverSubmenu.js +0 -260
- package/dist/elements/UserMenu/useHoverSubmenu.js.map +0 -1
- package/dist/elements/ViewModeToggle/index.d.ts +0 -8
- package/dist/elements/ViewModeToggle/index.d.ts.map +0 -1
- package/dist/elements/ViewModeToggle/index.js +0 -29
- package/dist/elements/ViewModeToggle/index.js.map +0 -1
- package/dist/icons/CollapseLayers/index.css +0 -5
- package/dist/icons/CollapseLayers/index.d.ts +0 -7
- package/dist/icons/CollapseLayers/index.d.ts.map +0 -1
- package/dist/icons/CollapseLayers/index.js +0 -23
- package/dist/icons/CollapseLayers/index.js.map +0 -1
- package/dist/icons/Table/index.css +0 -5
- package/dist/icons/Table/index.d.ts +0 -7
- package/dist/icons/Table/index.d.ts.map +0 -1
- package/dist/icons/Table/index.js +0 -25
- package/dist/icons/Table/index.js.map +0 -1
- package/dist/providers/HierarchyDnd/index.css +0 -51
- package/dist/providers/HierarchyDnd/index.d.ts +0 -21
- package/dist/providers/HierarchyDnd/index.d.ts.map +0 -1
- package/dist/providers/HierarchyDnd/index.js +0 -163
- package/dist/providers/HierarchyDnd/index.js.map +0 -1
- package/dist/providers/HierarchyDnd/types.d.ts +0 -56
- package/dist/providers/HierarchyDnd/types.d.ts.map +0 -1
- package/dist/providers/HierarchyDnd/types.js +0 -21
- package/dist/providers/HierarchyDnd/types.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.css +0 -216
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts +0 -20
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js +0 -182
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.css +0 -38
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts +0 -15
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js +0 -85
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.css +0 -98
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts +0 -27
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js +0 -84
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts +0 -19
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js +0 -100
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts +0 -53
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js +0 -145
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts +0 -8
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js +0 -21
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/index.css +0 -115
- package/dist/views/HierarchyList/HierarchyCards/index.d.ts +0 -80
- package/dist/views/HierarchyList/HierarchyCards/index.d.ts.map +0 -1
- package/dist/views/HierarchyList/HierarchyCards/index.js +0 -457
- package/dist/views/HierarchyList/HierarchyCards/index.js.map +0 -1
|
@@ -105,27 +105,13 @@ export const HierarchyProvider = ({
|
|
|
105
105
|
} else {
|
|
106
106
|
const existingDocIds = new Set(existingEntry.docs.map(doc_0 => doc_0.id));
|
|
107
107
|
const newDocs = treeData.docs.filter(doc_1 => !existingDocIds.has(doc_1.id));
|
|
108
|
-
// Reconcile loadedCount/totalDocs against the deduped merge rather than
|
|
109
|
-
// blindly overwriting: a shallower fetch (e.g. fewer pages walked) must not
|
|
110
|
-
// regress loadedCount below what's already accumulated in docs, or downstream
|
|
111
|
-
// page-number math in Tree will refetch and duplicate an already-shown page.
|
|
112
|
-
const mergedLoadedParents = {
|
|
113
|
-
...existingEntry.loadedParents
|
|
114
|
-
};
|
|
115
|
-
for (const [parentKey, meta] of Object.entries(treeData.loadedParents)) {
|
|
116
|
-
const existingMeta = existingEntry.loadedParents[parentKey];
|
|
117
|
-
const loadedCount = Math.max(existingMeta?.loadedCount ?? 0, meta.loadedCount ?? 0);
|
|
118
|
-
const totalDocs = Math.max(existingMeta?.totalDocs ?? 0, meta.totalDocs ?? 0);
|
|
119
|
-
mergedLoadedParents[parentKey] = {
|
|
120
|
-
hasMore: loadedCount < totalDocs,
|
|
121
|
-
loadedCount,
|
|
122
|
-
totalDocs
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
108
|
newCache.set(slug, {
|
|
126
109
|
baseFilter: existingEntry.baseFilter,
|
|
127
110
|
docs: [...existingEntry.docs, ...newDocs],
|
|
128
|
-
loadedParents:
|
|
111
|
+
loadedParents: {
|
|
112
|
+
...existingEntry.loadedParents,
|
|
113
|
+
...treeData.loadedParents
|
|
114
|
+
}
|
|
129
115
|
});
|
|
130
116
|
}
|
|
131
117
|
return newCache;
|
|
@@ -174,42 +160,29 @@ export const HierarchyProvider = ({
|
|
|
174
160
|
return newMap_1;
|
|
175
161
|
});
|
|
176
162
|
}, [savePreferencesDebounced]);
|
|
177
|
-
const collapseAllForCollection = useCallback(slug_2 => {
|
|
178
|
-
setExpandedNodesByCollection(prev_3 => {
|
|
179
|
-
// Always produce a new Map, even when the collection's set is already empty. The tree
|
|
180
|
-
// may still be rendering server-provided nodes that only this state change can clear.
|
|
181
|
-
const newMap_2 = new Map(prev_3);
|
|
182
|
-
const newExpanded_0 = new Set();
|
|
183
|
-
newMap_2.set(slug_2, newExpanded_0);
|
|
184
|
-
savePreferencesDebounced(slug_2, {
|
|
185
|
-
expanded: newExpanded_0
|
|
186
|
-
});
|
|
187
|
-
return newMap_2;
|
|
188
|
-
});
|
|
189
|
-
}, [savePreferencesDebounced]);
|
|
190
163
|
const toggleNode = useCallback(id_0 => {
|
|
191
164
|
if (!collectionSlug) {
|
|
192
165
|
return;
|
|
193
166
|
}
|
|
194
167
|
toggleNodeForCollection(collectionSlug, id_0);
|
|
195
168
|
}, [collectionSlug, toggleNodeForCollection]);
|
|
196
|
-
const getExpandedNodesForCollection = useCallback(
|
|
197
|
-
return expandedNodesByCollection.get(
|
|
169
|
+
const getExpandedNodesForCollection = useCallback(slug_2 => {
|
|
170
|
+
return expandedNodesByCollection.get(slug_2) || new Set();
|
|
198
171
|
}, [expandedNodesByCollection]);
|
|
199
|
-
const getTreeDataForCollection = useCallback(
|
|
200
|
-
return treeCache.get(
|
|
172
|
+
const getTreeDataForCollection = useCallback(slug_3 => {
|
|
173
|
+
return treeCache.get(slug_3) || null;
|
|
201
174
|
}, [treeCache]);
|
|
202
175
|
const setSelectedFilters = useCallback(filters => {
|
|
203
176
|
if (!collectionSlug) {
|
|
204
177
|
return;
|
|
205
178
|
}
|
|
206
|
-
setSelectedFiltersByCollection(
|
|
207
|
-
const
|
|
208
|
-
|
|
179
|
+
setSelectedFiltersByCollection(prev_3 => {
|
|
180
|
+
const newMap_2 = new Map(prev_3);
|
|
181
|
+
newMap_2.set(collectionSlug, filters);
|
|
209
182
|
savePreferencesDebounced(collectionSlug, {
|
|
210
183
|
filters
|
|
211
184
|
});
|
|
212
|
-
return
|
|
185
|
+
return newMap_2;
|
|
213
186
|
});
|
|
214
187
|
}, [collectionSlug, savePreferencesDebounced]);
|
|
215
188
|
const selectParent = useCallback(id_1 => {
|
|
@@ -232,8 +205,8 @@ export const HierarchyProvider = ({
|
|
|
232
205
|
if (!cache_0) {
|
|
233
206
|
return;
|
|
234
207
|
}
|
|
235
|
-
const
|
|
236
|
-
const parentMeta = cache_0.loadedParents[
|
|
208
|
+
const parentKey = parentId_0 === null ? 'root' : String(parentId_0);
|
|
209
|
+
const parentMeta = cache_0.loadedParents[parentKey];
|
|
237
210
|
if (!parentMeta || !parentMeta.hasMore) {
|
|
238
211
|
return;
|
|
239
212
|
}
|
|
@@ -284,8 +257,8 @@ export const HierarchyProvider = ({
|
|
|
284
257
|
}
|
|
285
258
|
const data_1 = await response.json();
|
|
286
259
|
const newDocs_0 = data_1.docs || [];
|
|
287
|
-
setTreeCache(
|
|
288
|
-
const newCache_0 = new Map(
|
|
260
|
+
setTreeCache(prev_4 => {
|
|
261
|
+
const newCache_0 = new Map(prev_4);
|
|
289
262
|
const existingEntry_0 = newCache_0.get(collectionSlug);
|
|
290
263
|
if (existingEntry_0) {
|
|
291
264
|
const existingDocIds_0 = new Set(existingEntry_0.docs.map(doc_3 => doc_3.id));
|
|
@@ -294,9 +267,8 @@ export const HierarchyProvider = ({
|
|
|
294
267
|
docs: [...existingEntry_0.docs, ...uniqueNewDocs],
|
|
295
268
|
loadedParents: {
|
|
296
269
|
...existingEntry_0.loadedParents,
|
|
297
|
-
[
|
|
270
|
+
[parentKey]: {
|
|
298
271
|
hasMore: data_1.hasNextPage || false,
|
|
299
|
-
loadedCount: currentChildren.length + uniqueNewDocs.length,
|
|
300
272
|
totalDocs: data_1.totalDocs || 0
|
|
301
273
|
}
|
|
302
274
|
}
|
|
@@ -325,15 +297,15 @@ export const HierarchyProvider = ({
|
|
|
325
297
|
setIsLoadingMore(false);
|
|
326
298
|
setLoadingNodeId(null);
|
|
327
299
|
}, []);
|
|
328
|
-
const refreshTree = useCallback(
|
|
329
|
-
setTreeCache(
|
|
330
|
-
const next = new Map(
|
|
331
|
-
next.delete(
|
|
300
|
+
const refreshTree = useCallback(slug_4 => {
|
|
301
|
+
setTreeCache(prev_5 => {
|
|
302
|
+
const next = new Map(prev_5);
|
|
303
|
+
next.delete(slug_4);
|
|
332
304
|
return next;
|
|
333
305
|
});
|
|
334
|
-
setTreeRefreshKeys(
|
|
335
|
-
const next_0 = new Map(
|
|
336
|
-
next_0.set(
|
|
306
|
+
setTreeRefreshKeys(prev_6 => {
|
|
307
|
+
const next_0 = new Map(prev_6);
|
|
308
|
+
next_0.set(slug_4, (next_0.get(slug_4) ?? 0) + 1);
|
|
337
309
|
return next_0;
|
|
338
310
|
});
|
|
339
311
|
}, []);
|
|
@@ -342,7 +314,6 @@ export const HierarchyProvider = ({
|
|
|
342
314
|
const value = {
|
|
343
315
|
allowedCollections,
|
|
344
316
|
baseFilter,
|
|
345
|
-
collapseAllForCollection,
|
|
346
317
|
collectionSlug,
|
|
347
318
|
expandedNodes,
|
|
348
319
|
getExpandedNodesForCollection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","useRouter","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKeys","setTreeRefreshKeys","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","mergedLoadedParents","loadedParents","parentKey","meta","Object","entries","existingMeta","loadedCount","Math","max","totalDocs","hasMore","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","collapseAllForCollection","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","queryParam","url","path","push","refresh","loadMoreChildren","parentMeta","currentChildren","nextPage","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","reset","refreshTree","next","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\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'\nimport { useRouter } from '../RouterAdapter/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 [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 [treeRefreshKeys, setTreeRefreshKeys] = useState<Map<string, number>>(() => new Map())\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 } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\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 // Reconcile loadedCount/totalDocs against the deduped merge rather than\n // blindly overwriting: a shallower fetch (e.g. fewer pages walked) must not\n // regress loadedCount below what's already accumulated in docs, or downstream\n // page-number math in Tree will refetch and duplicate an already-shown page.\n const mergedLoadedParents = { ...existingEntry.loadedParents }\n for (const [parentKey, meta] of Object.entries(treeData.loadedParents)) {\n const existingMeta = existingEntry.loadedParents[parentKey]\n const loadedCount = Math.max(existingMeta?.loadedCount ?? 0, meta.loadedCount ?? 0)\n const totalDocs = Math.max(existingMeta?.totalDocs ?? 0, meta.totalDocs ?? 0)\n mergedLoadedParents[parentKey] = {\n hasMore: loadedCount < totalDocs,\n loadedCount,\n totalDocs,\n }\n }\n\n newCache.set(slug, {\n baseFilter: existingEntry.baseFilter,\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: mergedLoadedParents,\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 collapseAllForCollection = useCallback(\n (slug: string) => {\n setExpandedNodesByCollection((prev) => {\n // Always produce a new Map, even when the collection's set is already empty. The tree\n // may still be rendering server-provided nodes that only this state change can clear.\n const newMap = new Map(prev)\n const newExpanded = new Set<number | string>()\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 queryParam = parentFieldName || 'parent'\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?${queryParam}=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, parentFieldName, 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 loadedCount: currentChildren.length + uniqueNewDocs.length,\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 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((slug: string) => {\n setTreeCache((prev) => {\n const next = new Map(prev)\n next.delete(slug)\n return next\n })\n setTreeRefreshKeys((prev) => {\n const next = new Map(prev)\n next.set(slug, (next.get(slug) ?? 0) + 1)\n return next\n })\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 collapseAllForCollection,\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 treeRefreshKeys,\n typeFieldName,\n useAsTitle,\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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AAOA,KAAA;cAAQ3I;;AAC1C;AAEA,OAAO,MAAM6I,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUxJ,GAAA,CAAIO,gBAAA;EACpB,IAAI,CAACiJ,OAAA,EAAS;IACZ,MAAM,IAAIV,KAAA,CAAM;EAClB;EACA,OAAOU,OAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","useRouter","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKeys","setTreeRefreshKeys","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","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","queryParam","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","next","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\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'\nimport { useRouter } from '../RouterAdapter/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 [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 [treeRefreshKeys, setTreeRefreshKeys] = useState<Map<string, number>>(() => new Map())\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 } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\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 queryParam = parentFieldName || 'parent'\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?${queryParam}=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, parentFieldName, 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 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((slug: string) => {\n setTreeCache((prev) => {\n const next = new Map(prev)\n next.delete(slug)\n return next\n })\n setTreeRefreshKeys((prev) => {\n const next = new Map(prev)\n next.set(slug, (next.get(slug) ?? 0) + 1)\n return next\n })\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 treeRefreshKeys,\n typeFieldName,\n useAsTitle,\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,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;AAC/B,SAASC,SAAS,QAAQ;AAE1B,MAAMC,gBAAA,gBAAmBR,aAAA,CAAiDS,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE,GAAGN,cAAA;EAC1B,MAAMO,MAAA,GAASN,SAAA;EACf,MAAM;IACJO,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,UAAU;QAAEC;MAAG,CAAE;MAClCC;IAAS;EACV,CACF,GAAGd,SAAA;EAEJ,MAAM,CAACe,UAAA,EAAYC,aAAA,CAAc,GAAGlB,QAAA,CAAuB;EAC3D,MAAM,CAACmB,cAAA,EAAgBC,iBAAA,CAAkB,GAAGpB,QAAA,CAAwB;EACpE,MAAM,CAACqB,MAAA,EAAQC,SAAA,CAAU,GAAGtB,QAAA,CAAwD;EACpF,MAAM,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2C,GAAG,CAAC5D,cAAA,IAC5CiB,yBAAA,CAA0Ba,GAAG,CAAC9B,cAAA,IAC9B,IAAIwD,GAAA;EAEV,MAAMX,eAAA,GACJ7C,cAAA,IAAkBmB,2BAAA,CAA4ByC,GAAG,CAAC5D,cAAA,IAC9CmB,2BAAA,CAA4BW,GAAG,CAAC9B,cAAA,IAChC,EAAE;EAER,MAAMwH,KAAA,GAA+B;IACnC5G,kBAAA;IACAd,UAAA;IACAE,cAAA;IACAyC,aAAA;IACAuC,6BAAA;IACArD,eAAA;IACAsD,wBAAA;IACA7C,OAAA;IACAf,aAAA;IACAE,aAAA;IACAkE,gBAAA;IACAvF,MAAA;IACAE,eAAA;IACAkH,WAAA;IACAD,KAAA;IACAxE,eAAA;IACAsC,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAJ,uBAAA;IACArE,SAAA;IACAmB,eAAA;IACAjB,aAAA;IACAE;EACF;EAEA,oBAAO+G,IAAA,CAACvI,gBAAA;IAAiBsI,KAAA,EAAOA,KAAA;cAAQnI;;AAC1C;AAEA,OAAO,MAAMqI,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUhJ,GAAA,CAAIO,gBAAA;EACpB,IAAI,CAACyI,OAAA,EAAS;IACZ,MAAM,IAAIX,KAAA,CAAM;EAClB;EACA,OAAOW,OAAA;AACT","ignoreList":[]}
|
|
@@ -45,8 +45,6 @@ export type HierarchyHydrateData = {
|
|
|
45
45
|
export type HierarchyContextValue = {
|
|
46
46
|
allowedCollections: AllowedCollection[] | null;
|
|
47
47
|
baseFilter: null | Where;
|
|
48
|
-
/** Collapse every expanded node for a specific collection (persists to preferences) */
|
|
49
|
-
collapseAllForCollection: (collectionSlug: string) => void;
|
|
50
48
|
collectionSlug: null | string;
|
|
51
49
|
expandedNodes: Set<number | string>;
|
|
52
50
|
/** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.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AM,EAAE,MAAM,CAAC,CAAA;IACpC,8EAA8E;IAC9E,aAAa,EAAE,IAAI,GAAG,MAAM,CAAA;IAC5B,UAAU,EAAE,IAAI,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,MAAM,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;CACpB,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 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}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n
|
|
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}\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 for a specific collection by clearing its cache and incrementing its key */\n refreshTree: (collectionSlug: string) => 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 /** Per-collection keys that change when refreshTree(slug) is called */\n treeRefreshKeys: Map<string, number>\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: 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}\n"],"mappings":"AA+EA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/LivePreview/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAsB,MAAM,SAAS,CAAA;AAG3F,OAAO,KAAmE,MAAM,OAAO,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/LivePreview/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAsB,MAAM,SAAS,CAAA;AAG3F,OAAO,KAAmE,MAAM,OAAO,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAW1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,gBAAgB,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,KAAK,CAAC,CAAA;AAEhE,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAgRlE,CAAA"}
|
|
@@ -7,6 +7,7 @@ import { usePopupWindow } from '../../hooks/usePopupWindow.js';
|
|
|
7
7
|
import { useDocumentInfo } from '../../providers/DocumentInfo/index.js';
|
|
8
8
|
import { usePreferences } from '../../providers/Preferences/index.js';
|
|
9
9
|
import { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js';
|
|
10
|
+
import { isHttpURL } from '../../utilities/isHttpURL.js';
|
|
10
11
|
import { customCollisionDetection } from './collisionDetection.js';
|
|
11
12
|
import { LivePreviewContext } from './context.js';
|
|
12
13
|
import { sizeReducer } from './sizeReducer.js';
|
|
@@ -39,7 +40,13 @@ export const LivePreviewProvider = ({
|
|
|
39
40
|
width: '100%'
|
|
40
41
|
}], [incomingBreakpoints]);
|
|
41
42
|
const [url, setURL] = useState('');
|
|
42
|
-
const [previewURL,
|
|
43
|
+
const [previewURL, _setPreviewURL] = useState();
|
|
44
|
+
const setPreviewURL = useCallback(incomingURL => {
|
|
45
|
+
_setPreviewURL(isHttpURL(incomingURL) ? incomingURL : undefined);
|
|
46
|
+
}, []);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
setPreviewURL(previewURLFromProps);
|
|
49
|
+
}, [previewURLFromProps, setPreviewURL]);
|
|
43
50
|
const {
|
|
44
51
|
isPopupOpen,
|
|
45
52
|
openPopupWindow,
|
|
@@ -84,16 +91,16 @@ export const LivePreviewProvider = ({
|
|
|
84
91
|
* - resets `appIsReady` to `false` while the new URL is loading
|
|
85
92
|
*/
|
|
86
93
|
const setLivePreviewURL = useCallback(_incomingURL => {
|
|
87
|
-
let
|
|
94
|
+
let incomingURL_0;
|
|
88
95
|
if (typeof _incomingURL === 'string') {
|
|
89
|
-
|
|
96
|
+
incomingURL_0 = formatAbsoluteURL(_incomingURL);
|
|
90
97
|
}
|
|
91
|
-
if (!
|
|
98
|
+
if (!incomingURL_0) {
|
|
92
99
|
setIsLivePreviewing(false);
|
|
93
100
|
}
|
|
94
|
-
if (
|
|
101
|
+
if (incomingURL_0 !== url) {
|
|
95
102
|
setAppIsReady(false);
|
|
96
|
-
setURL(
|
|
103
|
+
setURL(incomingURL_0);
|
|
97
104
|
}
|
|
98
105
|
}, [setIsLivePreviewing, url]);
|
|
99
106
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DndContext","React","useCallback","useEffect","useId","useMemo","useRef","useState","usePopupWindow","useDocumentInfo","usePreferences","formatAbsoluteURL","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","incomingBreakpoints","children","isLivePreviewEnabled","isLivePreviewing","incomingIsLivePreviewing","isPreviewEnabled","previewURL","previewURLFromProps","typeofLivePreviewURL","url","urlFromProps","_setIsLivePreviewing","shouldRenderIframe","setShouldRenderIframe","setIsLivePreviewing","livePreviewing","name","height","label","width","setURL","setPreviewURL","isPopupOpen","openPopupWindow","popupRef","eventType","appIsReady","setAppIsReady","lastReadyAt","setLastReadyAt","collectionSlug","globalSlug","isFirstRender","setPreference","iframeRef","isExpanded","setIsExpanded","loadedURL","setLoadedURL","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","setLivePreviewURL","_incomingURL","incomingURL","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","handleMessage","event","startsWith","origin","data","ready","Date","now","window","addEventListener","removeEventListener","current","editViewType","dndContextID","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../src/providers/LivePreview/index.tsx"],"sourcesContent":["'use client'\nimport type { CollectionPreferences, LivePreviewConfig, LivePreviewURLType } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nimport type { LivePreviewContextType } from './context.js'\n\nimport { usePopupWindow } from '../../hooks/usePopupWindow.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js'\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n isLivePreviewEnabled?: boolean\n isLivePreviewing: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n isPreviewEnabled?: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n previewURL?: string\n} & Pick<LivePreviewContextType, 'typeofLivePreviewURL' | 'url'>\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints: incomingBreakpoints,\n children,\n isLivePreviewEnabled,\n isLivePreviewing: incomingIsLivePreviewing,\n isPreviewEnabled,\n previewURL: previewURLFromProps,\n typeofLivePreviewURL,\n url: urlFromProps,\n}) => {\n const [isLivePreviewing, _setIsLivePreviewing] =\n useState<LivePreviewContextType['isLivePreviewing']>(incomingIsLivePreviewing)\n\n const [shouldRenderIframe, setShouldRenderIframe] =\n useState<LivePreviewContextType['shouldRenderIframe']>(isLivePreviewing)\n\n /**\n * Rendering the iframe is a one-way event, e.g. defer load and never unmount.\n * This way, subsequent toggles will appear to load instantly.\n */\n const setIsLivePreviewing = useCallback<LivePreviewContextType['setIsLivePreviewing']>(\n (livePreviewing) => {\n if (livePreviewing) {\n setShouldRenderIframe(true)\n }\n\n _setIsLivePreviewing(livePreviewing)\n },\n [],\n )\n\n const breakpoints: LivePreviewConfig['breakpoints'] = useMemo(\n () => [\n ...(incomingBreakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ],\n [incomingBreakpoints],\n )\n\n const [url, setURL] = useState<string>('')\n const [previewURL, setPreviewURL] = useState<string>(previewURLFromProps)\n\n const { isPopupOpen, openPopupWindow, popupRef } = usePopupWindow({\n eventType: 'payload-live-preview',\n url,\n })\n\n const [appIsReady, setAppIsReady] = useState(false)\n // Tracks when any preview (iframe or popup) signals it's ready\n // Used to trigger an initial sync to newly opened previews\n const [lastReadyAt, setLastReadyAt] = useState<number>(0)\n\n const { collectionSlug, globalSlug } = useDocumentInfo()\n\n const isFirstRender = useRef(true)\n\n const { setPreference } = usePreferences()\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [isExpanded, setIsExpanded] = useState(false)\n\n const [loadedURL, setLoadedURL] = useState<string>()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n /**\n * A \"middleware\" callback fn that does some additional work before `setURL`.\n * This is what we provide through context, bc it:\n * - ensures the URL is absolute\n * - resets `appIsReady` to `false` while the new URL is loading\n */\n const setLivePreviewURL = useCallback<LivePreviewContextType['setURL']>(\n (_incomingURL) => {\n let incomingURL: LivePreviewURLType\n\n if (typeof _incomingURL === 'string') {\n incomingURL = formatAbsoluteURL(_incomingURL)\n }\n\n if (!incomingURL) {\n setIsLivePreviewing(false)\n }\n\n if (incomingURL !== url) {\n setAppIsReady(false)\n setURL(incomingURL)\n }\n },\n [setIsLivePreviewing, url],\n )\n\n /**\n * `url` needs to be relative to the window, which cannot be done on initial render.\n */\n useEffect(() => {\n if (typeof urlFromProps === 'string') {\n setURL(formatAbsoluteURL(urlFromProps))\n }\n }, [urlFromProps])\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n /**\n * Receive the `ready` message from the popup window\n * This indicates that the app is ready to receive `window.postMessage` events\n * This is also the only cross-origin way of detecting when a popup window has loaded\n * Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n */\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n setLastReadyAt(Date.now())\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url])\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n\n void setPreference<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n {\n editViewType: isLivePreviewing ? 'live-preview' : 'default',\n },\n true,\n )\n }, [isLivePreviewing, setPreference, collectionSlug, globalSlug])\n\n const dndContextID = useId()\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n iframeRef,\n isExpanded,\n isLivePreviewEnabled,\n isLivePreviewing,\n isPopupOpen,\n isPreviewEnabled,\n lastReadyAt,\n loadedURL,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewURL,\n setBreakpoint,\n setHeight,\n setIsExpanded,\n setIsLivePreviewing,\n setLoadedURL,\n setMeasuredDeviceSize,\n setPreviewURL,\n setSize,\n setToolbarPosition: setPosition,\n setURL: setLivePreviewURL,\n setWidth,\n setZoom,\n shouldRenderIframe,\n size,\n toolbarPosition: position,\n typeofLivePreviewURL,\n url,\n zoom,\n }}\n >\n <DndContext\n collisionDetection={customCollisionDetection}\n // Provide stable ID to fix hydration issues: https://github.com/clauderic/dnd-kit/issues/926\n id={dndContextID}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAIhF,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,WAAW,QAAQ;AAsB5B,OAAO,MAAMC,mBAAA,GAA0DA,CAAC;EACtEC,WAAA,EAAaC,mBAAmB;EAChCC,QAAQ;EACRC,oBAAoB;EACpBC,gBAAA,EAAkBC,wBAAwB;EAC1CC,gBAAgB;EAChBC,UAAA,EAAYC,mBAAmB;EAC/BC,oBAAoB;EACpBC,GAAA,EAAKC;AAAY,CAClB;EACC,MAAM,CAACP,gBAAA,EAAkBQ,oBAAA,CAAqB,GAC5CrB,QAAA,CAAqDc,wBAAA;EAEvD,MAAM,CAACQ,kBAAA,EAAoBC,qBAAA,CAAsB,GAC/CvB,QAAA,CAAuDa,gBAAA;EAEzD;;;;EAIA,MAAMW,mBAAA,G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E,mBAAmB,CAAC,WAAWV,aAAA;IACxC;EACF,GAAG,CAAC3D,GAAA,CAAI;EAERvB,SAAA,CAAU;IACR,IAAI8C,aAAA,CAAc+C,OAAO,EAAE;MACzB/C,aAAA,CAAc+C,OAAO,GAAG;MACxB;IACF;IAEA,KAAK9C,aAAA,CACHH,cAAA,GAAiB,cAAcA,cAAA,EAAgB,GAAG,UAAUC,UAAA,EAAY,EACxE;MACEiD,YAAA,EAAc7E,gBAAA,GAAmB,iBAAiB;IACpD,GACA;EAEJ,GAAG,CAACA,gBAAA,EAAkB8B,aAAA,EAAeH,cAAA,EAAgBC,UAAA,CAAW;EAEhE,MAAMkD,YAAA,GAAe9F,KAAA;EAErB,oBACE+F,IAAA,CAACtF,kBAAA;IACCmE,KAAA,EAAO;MACLrC,UAAA;MACAwB,UAAA;MACAnD,WAAA;MACAmC,SAAA;MACAC,UAAA;MACAjC,oBAAA;MACAC,gBAAA;MACAmB,WAAA;MACAjB,gBAAA;MACAuB,WAAA;MACAS,SAAA;MACAW,kBAAA;MACAzB,eAAA;MACAC,QAAA;MACAlB,UAAA;MACA6C,aAAA;MACAa,SAAA;MACA5B,aAAA;MACAtB,mBAAA;MACAwB,YAAA;MACAW,qBAAA;MACA5B,aAAA;MACAyB,OAAA;MACAqC,kBAAA,EAAoBzC,WAAA;MACpBtB,MAAA,EAAQgC,iBAAA;MACRS,QAAA;MACArB,OAAA;MACA5B,kBAAA;MACAiC,IAAA;MACAuC,eAAA,EAAiB3C,QAAA;MACjBjC,oBAAA;MACAC,GAAA;MACA8B;IACF;cAEA,aAAA2C,IAAA,CAACnG,UAAA;MACCsG,kBAAA,EAAoB1F,wBAAA;MACpB;MACA+D,EAAA,EAAIuB,YAAA;MACJK,SAAA,EAAW/B,aAAA;gBAEVtD;;;AAIT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DndContext","React","useCallback","useEffect","useId","useMemo","useRef","useState","usePopupWindow","useDocumentInfo","usePreferences","formatAbsoluteURL","isHttpURL","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","incomingBreakpoints","children","isLivePreviewEnabled","isLivePreviewing","incomingIsLivePreviewing","isPreviewEnabled","previewURL","previewURLFromProps","typeofLivePreviewURL","url","urlFromProps","_setIsLivePreviewing","shouldRenderIframe","setShouldRenderIframe","setIsLivePreviewing","livePreviewing","name","height","label","width","setURL","_setPreviewURL","setPreviewURL","incomingURL","undefined","isPopupOpen","openPopupWindow","popupRef","eventType","appIsReady","setAppIsReady","lastReadyAt","setLastReadyAt","collectionSlug","globalSlug","isFirstRender","setPreference","iframeRef","isExpanded","setIsExpanded","loadedURL","setLoadedURL","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","setLivePreviewURL","_incomingURL","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","handleMessage","event","startsWith","origin","data","ready","Date","now","window","addEventListener","removeEventListener","current","editViewType","dndContextID","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../src/providers/LivePreview/index.tsx"],"sourcesContent":["'use client'\nimport type { CollectionPreferences, LivePreviewConfig, LivePreviewURLType } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nimport type { LivePreviewContextType } from './context.js'\n\nimport { usePopupWindow } from '../../hooks/usePopupWindow.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js'\nimport { isHttpURL } from '../../utilities/isHttpURL.js'\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n isLivePreviewEnabled?: boolean\n isLivePreviewing: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n isPreviewEnabled?: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n previewURL?: string\n} & Pick<LivePreviewContextType, 'typeofLivePreviewURL' | 'url'>\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints: incomingBreakpoints,\n children,\n isLivePreviewEnabled,\n isLivePreviewing: incomingIsLivePreviewing,\n isPreviewEnabled,\n previewURL: previewURLFromProps,\n typeofLivePreviewURL,\n url: urlFromProps,\n}) => {\n const [isLivePreviewing, _setIsLivePreviewing] =\n useState<LivePreviewContextType['isLivePreviewing']>(incomingIsLivePreviewing)\n\n const [shouldRenderIframe, setShouldRenderIframe] =\n useState<LivePreviewContextType['shouldRenderIframe']>(isLivePreviewing)\n\n /**\n * Rendering the iframe is a one-way event, e.g. defer load and never unmount.\n * This way, subsequent toggles will appear to load instantly.\n */\n const setIsLivePreviewing = useCallback<LivePreviewContextType['setIsLivePreviewing']>(\n (livePreviewing) => {\n if (livePreviewing) {\n setShouldRenderIframe(true)\n }\n\n _setIsLivePreviewing(livePreviewing)\n },\n [],\n )\n\n const breakpoints: LivePreviewConfig['breakpoints'] = useMemo(\n () => [\n ...(incomingBreakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ],\n [incomingBreakpoints],\n )\n\n const [url, setURL] = useState<string>('')\n const [previewURL, _setPreviewURL] = useState<string>()\n\n const setPreviewURL = useCallback<LivePreviewContextType['setPreviewURL']>((incomingURL) => {\n _setPreviewURL(isHttpURL(incomingURL) ? incomingURL : undefined)\n }, [])\n\n useEffect(() => {\n setPreviewURL(previewURLFromProps)\n }, [previewURLFromProps, setPreviewURL])\n\n const { isPopupOpen, openPopupWindow, popupRef } = usePopupWindow({\n eventType: 'payload-live-preview',\n url,\n })\n\n const [appIsReady, setAppIsReady] = useState(false)\n // Tracks when any preview (iframe or popup) signals it's ready\n // Used to trigger an initial sync to newly opened previews\n const [lastReadyAt, setLastReadyAt] = useState<number>(0)\n\n const { collectionSlug, globalSlug } = useDocumentInfo()\n\n const isFirstRender = useRef(true)\n\n const { setPreference } = usePreferences()\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [isExpanded, setIsExpanded] = useState(false)\n\n const [loadedURL, setLoadedURL] = useState<string>()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n /**\n * A \"middleware\" callback fn that does some additional work before `setURL`.\n * This is what we provide through context, bc it:\n * - ensures the URL is absolute\n * - resets `appIsReady` to `false` while the new URL is loading\n */\n const setLivePreviewURL = useCallback<LivePreviewContextType['setURL']>(\n (_incomingURL) => {\n let incomingURL: LivePreviewURLType\n\n if (typeof _incomingURL === 'string') {\n incomingURL = formatAbsoluteURL(_incomingURL)\n }\n\n if (!incomingURL) {\n setIsLivePreviewing(false)\n }\n\n if (incomingURL !== url) {\n setAppIsReady(false)\n setURL(incomingURL)\n }\n },\n [setIsLivePreviewing, url],\n )\n\n /**\n * `url` needs to be relative to the window, which cannot be done on initial render.\n */\n useEffect(() => {\n if (typeof urlFromProps === 'string') {\n setURL(formatAbsoluteURL(urlFromProps))\n }\n }, [urlFromProps])\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n /**\n * Receive the `ready` message from the popup window\n * This indicates that the app is ready to receive `window.postMessage` events\n * This is also the only cross-origin way of detecting when a popup window has loaded\n * Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n */\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n setLastReadyAt(Date.now())\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url])\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n\n void setPreference<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n {\n editViewType: isLivePreviewing ? 'live-preview' : 'default',\n },\n true,\n )\n }, [isLivePreviewing, setPreference, collectionSlug, globalSlug])\n\n const dndContextID = useId()\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n iframeRef,\n isExpanded,\n isLivePreviewEnabled,\n isLivePreviewing,\n isPopupOpen,\n isPreviewEnabled,\n lastReadyAt,\n loadedURL,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewURL,\n setBreakpoint,\n setHeight,\n setIsExpanded,\n setIsLivePreviewing,\n setLoadedURL,\n setMeasuredDeviceSize,\n setPreviewURL,\n setSize,\n setToolbarPosition: setPosition,\n setURL: setLivePreviewURL,\n setWidth,\n setZoom,\n shouldRenderIframe,\n size,\n toolbarPosition: position,\n typeofLivePreviewURL,\n url,\n zoom,\n }}\n >\n <DndContext\n collisionDetection={customCollisionDetection}\n // Provide stable ID to fix hydration issues: https://github.com/clauderic/dnd-kit/issues/926\n id={dndContextID}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAIhF,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAS,QAAQ;AAC1B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,WAAW,QAAQ;AAsB5B,OAAO,MAAMC,mBAAA,GAA0DA,CAAC;EACtEC,WAAA,EAAaC,mBAAmB;EAChCC,QAAQ;EACRC,oBAAoB;EACpBC,gBAAA,EAAkBC,wBAAwB;EAC1CC,gBAAgB;EAChBC,UAAA,EAAYC,mBAAmB;EAC/BC,oBAAoB;EACpBC,GAAA,EAAKC;AAAY,CAClB;EACC,MAAM,CAACP,gBAAA,EAAkBQ,oBAAA,CAAqB,GAC5CtB,QAAA,CAAqDe,wBAAA;EAEvD,MAAM,CAACQ,kBAAA,EAAoBC,qBAAA,CAAsB,GAC/CxB,QAAA,CAAuDc,gBAAA;EAEzD;;;;EAIA,MAAMW,mBAA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wBAAA;MACpB;MACAiE,EAAA,EAAIuB,YAAA;MACJK,SAAA,EAAW/B,aAAA;gBAEVxD;;;AAIT","ignoreList":[]}
|
|
@@ -12,9 +12,5 @@ export declare const useLocaleLoading: () => {
|
|
|
12
12
|
localeIsLoading: boolean;
|
|
13
13
|
setLocaleIsLoading: (_: boolean) => any;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
* TODO: V4
|
|
17
|
-
* The return type of the `useLocale` hook will change in v4. It will return `null | Locale` instead of `false | {} | Locale`.
|
|
18
|
-
*/
|
|
19
|
-
export declare const useLocale: () => Locale;
|
|
15
|
+
export declare const useLocale: () => Locale | null;
|
|
20
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Locale/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAA0D,MAAM,OAAO,CAAA;AAU9E,eAAO,MAAM,oBAAoB;;4BAEP,OAAO;EAC/B,CAAA;AAcF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Locale/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAA0D,MAAM,OAAO,CAAA;AAU9E,eAAO,MAAM,oBAAoB;;4BAEP,OAAO;EAC/B,CAAA;AAcF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;CAAE,CAsF5F,CAAA;AAED,eAAO,MAAM,gBAAgB;;4BAvGH,OAAO;CAuG8B,CAAA;AAE/D,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG,IAA0B,CAAA"}
|