@rebasepro/core 0.0.1-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +19 -0
- package/dist/app/Scaffold.d.ts +34 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +17 -0
- package/dist/components/AIIcon.d.ts +16 -0
- package/dist/components/AdminModeSyncer.d.ts +17 -0
- package/dist/components/ArrayContainer.d.ts +59 -0
- package/dist/components/CircularProgressCenter.d.ts +11 -0
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/ConfirmationDialog.d.ts +9 -0
- package/dist/components/Debug/UIReferenceView.d.ts +1 -0
- package/dist/components/Debug/UIStyleGuide.d.ts +1 -0
- package/dist/components/DeleteEntityDialog.d.ts +12 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +37 -0
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +27 -0
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +128 -0
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +25 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +15 -0
- package/dist/components/EntityCollectionTable/fields/TableMultipleRelationField.d.ts +20 -0
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +21 -0
- package/dist/components/EntityCollectionTable/fields/TableRelationField.d.ts +21 -0
- package/dist/components/EntityCollectionTable/fields/TableRelationSelectorField.d.ts +20 -0
- package/dist/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +32 -0
- package/dist/components/EntityCollectionTable/index.d.ts +6 -0
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +16 -0
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +32 -0
- package/dist/components/EntityCollectionTable/internal/EntityTableCellActions.d.ts +9 -0
- package/dist/components/EntityCollectionTable/internal/common.d.ts +4 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +26 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +13 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/useWindowSize.d.ts +6 -0
- package/dist/components/EntityCollectionView/Board.d.ts +2 -0
- package/dist/components/EntityCollectionView/BoardColumn.d.ts +42 -0
- package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +9 -0
- package/dist/components/EntityCollectionView/BoardSortableList.d.ts +14 -0
- package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +26 -0
- package/dist/components/EntityCollectionView/EntityCard.d.ts +19 -0
- package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +20 -0
- package/dist/components/EntityCollectionView/EntityCollectionCardView.d.ts +31 -0
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +54 -0
- package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +14 -0
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +15 -0
- package/dist/components/EntityCollectionView/FiltersDialog.d.ts +14 -0
- package/dist/components/EntityCollectionView/ViewModeToggle.d.ts +44 -0
- package/dist/components/EntityCollectionView/board_types.d.ts +105 -0
- package/dist/components/EntityCollectionView/useBoardDataController.d.ts +60 -0
- package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
- package/dist/components/EntityCollectionView/utils.d.ts +3 -0
- package/dist/components/EntityJsonPreview.d.ts +3 -0
- package/dist/components/EntityPreview.d.ts +54 -0
- package/dist/components/EntityView.d.ts +11 -0
- package/dist/components/ErrorBoundary.d.ts +11 -0
- package/dist/components/ErrorTooltip.d.ts +2 -0
- package/dist/components/ErrorView.d.ts +21 -0
- package/dist/components/FieldCaption.d.ts +5 -0
- package/dist/components/HomePage/ContentHomePage.d.ts +11 -0
- package/dist/components/HomePage/FavouritesView.d.ts +3 -0
- package/dist/components/HomePage/HomePageDnD.d.ts +77 -0
- package/dist/components/HomePage/NavigationCard.d.ts +10 -0
- package/dist/components/HomePage/NavigationCardBinding.d.ts +18 -0
- package/dist/components/HomePage/NavigationGroup.d.ts +11 -0
- package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
- package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
- package/dist/components/HomePage/StudioHomePage.d.ts +9 -0
- package/dist/components/HomePage/index.d.ts +5 -0
- package/dist/components/NotFoundPage.d.ts +1 -0
- package/dist/components/PropertyCollectionView.d.ts +22 -0
- package/dist/components/PropertyConfigBadge.d.ts +6 -0
- package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
- package/dist/components/RebaseLogo.d.ts +7 -0
- package/dist/components/ReferenceTable/EntitySelectionTable.d.ts +58 -0
- package/dist/components/ReferenceWidget.d.ts +29 -0
- package/dist/components/RelationSelector.d.ts +32 -0
- package/dist/components/SearchIconsView.d.ts +5 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +89 -0
- package/dist/components/SelectableTable/SelectableTableContext.d.ts +4 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +9 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +12 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +15 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +12 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +13 -0
- package/dist/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/components/UserDisplay.d.ts +7 -0
- package/dist/components/UserSettingsView.d.ts +1 -0
- package/dist/components/VirtualTable/VirtualTable.d.ts +11 -0
- package/dist/components/VirtualTable/VirtualTableCell.d.ts +20 -0
- package/dist/components/VirtualTable/VirtualTableHeader.d.ts +29 -0
- package/dist/components/VirtualTable/VirtualTableHeaderRow.d.ts +2 -0
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +239 -0
- package/dist/components/VirtualTable/VirtualTableRow.d.ts +3 -0
- package/dist/components/VirtualTable/fields/VirtualTableDateField.d.ts +12 -0
- package/dist/components/VirtualTable/fields/VirtualTableInput.d.ts +9 -0
- package/dist/components/VirtualTable/fields/VirtualTableNumberInput.d.ts +8 -0
- package/dist/components/VirtualTable/fields/VirtualTableSelect.d.ts +15 -0
- package/dist/components/VirtualTable/fields/VirtualTableSwitch.d.ts +7 -0
- package/dist/components/VirtualTable/fields/VirtualTableUserSelect.d.ts +12 -0
- package/dist/components/VirtualTable/index.d.ts +3 -0
- package/dist/components/VirtualTable/types.d.ts +37 -0
- package/dist/components/admin/RoleChip.d.ts +4 -0
- package/dist/components/admin/RolesView.d.ts +4 -0
- package/dist/components/admin/UsersView.d.ts +4 -0
- package/dist/components/admin/index.d.ts +3 -0
- package/dist/components/common/default_entity_actions.d.ts +4 -0
- package/dist/components/common/index.d.ts +6 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +58 -0
- package/dist/components/common/useColumnsIds.d.ts +6 -0
- package/dist/components/common/useDataSourceTableController.d.ts +44 -0
- package/dist/components/common/useDebouncedCallback.d.ts +1 -0
- package/dist/components/common/useDebouncedData.d.ts +9 -0
- package/dist/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/components/common/useTableSearchHelper.d.ts +11 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/contexts/AdminModeController.d.ts +4 -0
- package/dist/contexts/AnalyticsContext.d.ts +3 -0
- package/dist/contexts/AuthControllerContext.d.ts +3 -0
- package/dist/contexts/BreacrumbsContext.d.ts +8 -0
- package/dist/contexts/CustomizationControllerContext.d.ts +3 -0
- package/dist/contexts/DataSourceContext.d.ts +3 -0
- package/dist/contexts/DialogsProvider.d.ts +4 -0
- package/dist/contexts/EffectiveRoleController.d.ts +4 -0
- package/dist/contexts/InternalUserManagementContext.d.ts +3 -0
- package/dist/contexts/ModeController.d.ts +4 -0
- package/dist/contexts/NavigationContext.d.ts +3 -0
- package/dist/contexts/SideDialogsControllerContext.d.ts +3 -0
- package/dist/contexts/SideEntityControllerContext.d.ts +3 -0
- package/dist/contexts/SnackbarProvider.d.ts +2 -0
- package/dist/contexts/StorageSourceContext.d.ts +3 -0
- package/dist/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
- package/dist/contexts/index.d.ts +15 -0
- package/dist/core/DefaultAppBar.d.ts +29 -0
- package/dist/core/DefaultDrawer.d.ts +29 -0
- package/dist/core/DrawerNavigationGroup.d.ts +45 -0
- package/dist/core/DrawerNavigationItem.d.ts +10 -0
- package/dist/core/EntityEditView.d.ts +47 -0
- package/dist/core/EntityEditViewFormActions.d.ts +2 -0
- package/dist/core/EntitySidePanel.d.ts +10 -0
- package/dist/core/Rebase.d.ts +13 -0
- package/dist/core/RebaseRouter.d.ts +4 -0
- package/dist/core/RebaseRoutes.d.ts +17 -0
- package/dist/core/SideDialogs.d.ts +25 -0
- package/dist/core/field_configs.d.ts +6 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/form/EntityForm.d.ts +7 -0
- package/dist/form/EntityFormActions.d.ts +2 -0
- package/dist/form/PropertyFieldBinding.d.ts +30 -0
- package/dist/form/components/ErrorFocus.d.ts +4 -0
- package/dist/form/components/FieldHelperText.d.ts +12 -0
- package/dist/form/components/FormEntry.d.ts +6 -0
- package/dist/form/components/FormLayout.d.ts +5 -0
- package/dist/form/components/LabelWithIcon.d.ts +14 -0
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/LocalChangesMenu.d.ts +11 -0
- package/dist/form/components/StorageItemPreview.d.ts +13 -0
- package/dist/form/components/StorageUploadProgress.d.ts +10 -0
- package/dist/form/components/index.d.ts +5 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +11 -0
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +10 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +11 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +7 -0
- package/dist/form/field_bindings/MapFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +10 -0
- package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/RelationFieldBinding.d.ts +2 -0
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +10 -0
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +10 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +19 -0
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/TextFieldBinding.d.ts +8 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +12 -0
- package/dist/form/index.d.ts +20 -0
- package/dist/form/useClearRestoreValue.d.ts +13 -0
- package/dist/form/validation.d.ts +26 -0
- package/dist/hooks/ApiConfigContext.d.ts +24 -0
- package/dist/hooks/data/delete.d.ts +33 -0
- package/dist/hooks/data/save.d.ts +37 -0
- package/dist/hooks/data/useCollectionFetch.d.ts +50 -0
- package/dist/hooks/data/useDataOrder.d.ts +12 -0
- package/dist/hooks/data/useDataSource.d.ts +6 -0
- package/dist/hooks/data/useEntityFetch.d.ts +29 -0
- package/dist/hooks/data/useRelationSelector.d.ts +45 -0
- package/dist/hooks/index.d.ts +41 -0
- package/dist/hooks/navigation/contexts/CMSUrlContext.d.ts +4 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +4 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.d.ts +4 -0
- package/dist/hooks/navigation/contexts/index.d.ts +3 -0
- package/dist/hooks/navigation/useBuildCMSUrlController.d.ts +6 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +7 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +32 -0
- package/dist/hooks/navigation/useNavigationRegistry.d.ts +10 -0
- package/dist/hooks/navigation/useNavigationResolution.d.ts +5 -0
- package/dist/hooks/navigation/useNavigationURLs.d.ts +11 -0
- package/dist/hooks/navigation/useResolvedCollections.d.ts +26 -0
- package/dist/hooks/navigation/useResolvedViews.d.ts +28 -0
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +26 -0
- package/dist/hooks/navigation/utils.d.ts +12 -0
- package/dist/hooks/useAdminModeController.d.ts +19 -0
- package/dist/hooks/useAnalyticsController.d.ts +5 -0
- package/dist/hooks/useAuthController.d.ts +11 -0
- package/dist/hooks/useBackendStorageSource.d.ts +30 -0
- package/dist/hooks/useBreadcrumbsController.d.ts +42 -0
- package/dist/hooks/useBrowserTitleAndIcon.d.ts +6 -0
- package/dist/hooks/useBuildAdminModeController.d.ts +6 -0
- package/dist/hooks/useBuildEffectiveRoleController.d.ts +8 -0
- package/dist/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
- package/dist/hooks/useBuildModeController.d.ts +6 -0
- package/dist/hooks/useBuildNavigationController.d.ts +16 -0
- package/dist/hooks/useClipboard.d.ts +57 -0
- package/dist/hooks/useCollapsedGroups.d.ts +12 -0
- package/dist/hooks/useCustomizationController.d.ts +11 -0
- package/dist/hooks/useDialogsController.d.ts +11 -0
- package/dist/hooks/useEffectiveRoleController.d.ts +7 -0
- package/dist/hooks/useEntitySelectionDialog.d.ts +18 -0
- package/dist/hooks/useInternalUserManagementController.d.ts +12 -0
- package/dist/hooks/useLargeLayout.d.ts +1 -0
- package/dist/hooks/useModeController.d.ts +19 -0
- package/dist/hooks/usePermissions.d.ts +11 -0
- package/dist/hooks/useRebaseContext.d.ts +11 -0
- package/dist/hooks/useResolvedNavigationFrom.d.ts +72 -0
- package/dist/hooks/useSideDialogsController.d.ts +18 -0
- package/dist/hooks/useSideEntityController.d.ts +12 -0
- package/dist/hooks/useSnackbarController.d.ts +20 -0
- package/dist/hooks/useStorageSource.d.ts +6 -0
- package/dist/hooks/useUnsavedChangesDialog.d.ts +12 -0
- package/dist/hooks/useUserConfigurationPersistence.d.ts +8 -0
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.es.js +34745 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +34751 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/internal/common.d.ts +3 -0
- package/dist/internal/useBuildDataSource.d.ts +12 -0
- package/dist/internal/useBuildSideDialogsController.d.ts +2 -0
- package/dist/internal/useBuildSideEntityController.d.ts +4 -0
- package/dist/internal/useRestoreScroll.d.ts +6 -0
- package/dist/preview/PropertyPreview.d.ts +6 -0
- package/dist/preview/components/ArrayEnumPreview.d.ts +10 -0
- package/dist/preview/components/AsyncPreviewComponent.d.ts +11 -0
- package/dist/preview/components/BooleanPreview.d.ts +10 -0
- package/dist/preview/components/DatePreview.d.ts +17 -0
- package/dist/preview/components/EmptyValue.d.ts +6 -0
- package/dist/preview/components/EnumValuesChip.d.ts +13 -0
- package/dist/preview/components/ImagePreview.d.ts +16 -0
- package/dist/preview/components/ReferencePreview.d.ts +16 -0
- package/dist/preview/components/RelationPreview.d.ts +16 -0
- package/dist/preview/components/StorageThumbnail.d.ts +15 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +13 -0
- package/dist/preview/components/UserPreview.d.ts +8 -0
- package/dist/preview/index.d.ts +24 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +5 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +5 -0
- package/dist/preview/property_previews/MapPropertyPreview.d.ts +8 -0
- package/dist/preview/property_previews/NumberPropertyPreview.d.ts +6 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +13 -0
- package/dist/preview/property_previews/StringPropertyPreview.d.ts +6 -0
- package/dist/preview/util.d.ts +6 -0
- package/dist/routes/CustomCMSRoute.d.ts +4 -0
- package/dist/routes/RebaseRoute.d.ts +1 -0
- package/dist/routes/index.d.ts +2 -0
- package/dist/util/createFormexStub.d.ts +2 -0
- package/dist/util/entity_cache.d.ts +27 -0
- package/dist/util/enums.d.ts +5 -0
- package/dist/util/icon_list.d.ts +5 -0
- package/dist/util/icon_synonyms.d.ts +1853 -0
- package/dist/util/icons.d.ts +16 -0
- package/dist/util/index.d.ts +11 -0
- package/dist/util/previews.d.ts +3 -0
- package/dist/util/property_utils.d.ts +23 -0
- package/dist/util/useDebouncedCallback.d.ts +1 -0
- package/dist/util/useStorageUploadController.d.ts +36 -0
- package/dist/util/useTraceUpdate.d.ts +2 -0
- package/dist/vitePlugin.d.ts +16 -0
- package/package.json +165 -0
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +30 -0
- package/src/app/Scaffold.tsx +238 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +36 -0
- package/src/components/AIIcon.tsx +39 -0
- package/src/components/AdminModeSyncer.tsx +47 -0
- package/src/components/ArrayContainer.tsx +549 -0
- package/src/components/CircularProgressCenter.tsx +26 -0
- package/src/components/ClearFilterSortButton.tsx +44 -0
- package/src/components/ConfirmationDialog.tsx +46 -0
- package/src/components/Debug/UIReferenceView.tsx +710 -0
- package/src/components/Debug/UIStyleGuide.tsx +164 -0
- package/src/components/DeleteEntityDialog.tsx +181 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +225 -0
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +383 -0
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +180 -0
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +561 -0
- package/src/components/EntityCollectionTable/column_utils.tsx +74 -0
- package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +122 -0
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +169 -0
- package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +177 -0
- package/src/components/EntityCollectionTable/fields/TableRelationSelectorField.tsx +42 -0
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +315 -0
- package/src/components/EntityCollectionTable/index.tsx +12 -0
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +90 -0
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +311 -0
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +82 -0
- package/src/components/EntityCollectionTable/internal/common.tsx +72 -0
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +425 -0
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +96 -0
- package/src/components/EntityCollectionTable/internal/popup_field/useWindowSize.tsx +20 -0
- package/src/components/EntityCollectionView/Board.tsx +324 -0
- package/src/components/EntityCollectionView/BoardColumn.tsx +158 -0
- package/src/components/EntityCollectionView/BoardColumnTitle.tsx +45 -0
- package/src/components/EntityCollectionView/BoardSortableList.tsx +172 -0
- package/src/components/EntityCollectionView/EntityBoardCard.tsx +200 -0
- package/src/components/EntityCollectionView/EntityCard.tsx +225 -0
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +746 -0
- package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +254 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1220 -0
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +142 -0
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +131 -0
- package/src/components/EntityCollectionView/FiltersDialog.tsx +249 -0
- package/src/components/EntityCollectionView/ViewModeToggle.tsx +194 -0
- package/src/components/EntityCollectionView/board_types.ts +113 -0
- package/src/components/EntityCollectionView/useBoardDataController.tsx +490 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +43 -0
- package/src/components/EntityCollectionView/utils.ts +19 -0
- package/src/components/EntityJsonPreview.tsx +66 -0
- package/src/components/EntityPreview.tsx +367 -0
- package/src/components/EntityView.tsx +66 -0
- package/src/components/ErrorBoundary.tsx +40 -0
- package/src/components/ErrorTooltip.tsx +12 -0
- package/src/components/ErrorView.tsx +69 -0
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/HomePage/ContentHomePage.tsx +634 -0
- package/src/components/HomePage/FavouritesView.tsx +59 -0
- package/src/components/HomePage/HomePageDnD.tsx +702 -0
- package/src/components/HomePage/NavigationCard.tsx +80 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +111 -0
- package/src/components/HomePage/NavigationGroup.tsx +154 -0
- package/src/components/HomePage/RenameGroupDialog.tsx +121 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
- package/src/components/HomePage/StudioHomePage.tsx +231 -0
- package/src/components/HomePage/index.tsx +6 -0
- package/src/components/NotFoundPage.tsx +25 -0
- package/src/components/PropertyCollectionView.tsx +333 -0
- package/src/components/PropertyConfigBadge.tsx +27 -0
- package/src/components/PropertyIdCopyTooltip.tsx +47 -0
- package/src/components/RebaseLogo.tsx +29 -0
- package/src/components/ReferenceTable/EntitySelectionTable.tsx +371 -0
- package/src/components/ReferenceWidget.tsx +152 -0
- package/src/components/RelationSelector.tsx +518 -0
- package/src/components/SearchIconsView.tsx +78 -0
- package/src/components/SelectableTable/SelectableTable.tsx +344 -0
- package/src/components/SelectableTable/SelectableTableContext.tsx +6 -0
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +49 -0
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +126 -0
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +203 -0
- package/src/components/SelectableTable/filters/RelationFilterField.tsx +138 -0
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +217 -0
- package/src/components/UnsavedChangesDialog.tsx +45 -0
- package/src/components/UserDisplay.tsx +55 -0
- package/src/components/UserSettingsView.tsx +220 -0
- package/src/components/VirtualTable/VirtualTable.performance.test.tsx +386 -0
- package/src/components/VirtualTable/VirtualTable.tsx +625 -0
- package/src/components/VirtualTable/VirtualTableCell.tsx +58 -0
- package/src/components/VirtualTable/VirtualTableHeader.tsx +275 -0
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +249 -0
- package/src/components/VirtualTable/VirtualTableProps.tsx +298 -0
- package/src/components/VirtualTable/VirtualTableRow.tsx +52 -0
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +39 -0
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +93 -0
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +83 -0
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +133 -0
- package/src/components/VirtualTable/fields/VirtualTableSwitch.tsx +32 -0
- package/src/components/VirtualTable/fields/VirtualTableUserSelect.tsx +111 -0
- package/src/components/VirtualTable/index.tsx +3 -0
- package/src/components/VirtualTable/types.tsx +46 -0
- package/src/components/admin/RoleChip.tsx +23 -0
- package/src/components/admin/RolesView.tsx +408 -0
- package/src/components/admin/UsersView.tsx +353 -0
- package/src/components/admin/index.ts +3 -0
- package/src/components/common/default_entity_actions.tsx +144 -0
- package/src/components/common/index.ts +6 -0
- package/src/components/common/table_height.tsx +21 -0
- package/src/components/common/types.tsx +61 -0
- package/src/components/common/useColumnsIds.tsx +210 -0
- package/src/components/common/useDataSourceTableController.tsx +480 -0
- package/src/components/common/useDebouncedCallback.tsx +20 -0
- package/src/components/common/useDebouncedData.ts +49 -0
- package/src/components/common/useScrollRestoration.tsx +68 -0
- package/src/components/common/useTableSearchHelper.ts +75 -0
- package/src/components/index.tsx +49 -0
- package/src/contexts/AdminModeController.tsx +11 -0
- package/src/contexts/AnalyticsContext.tsx +4 -0
- package/src/contexts/AuthControllerContext.tsx +4 -0
- package/src/contexts/BreacrumbsContext.tsx +45 -0
- package/src/contexts/CustomizationControllerContext.tsx +4 -0
- package/src/contexts/DataSourceContext.tsx +4 -0
- package/src/contexts/DialogsProvider.tsx +53 -0
- package/src/contexts/EffectiveRoleController.tsx +11 -0
- package/src/contexts/InternalUserManagementContext.tsx +4 -0
- package/src/contexts/ModeController.tsx +11 -0
- package/src/contexts/NavigationContext.tsx +4 -0
- package/src/contexts/SideDialogsControllerContext.tsx +4 -0
- package/src/contexts/SideEntityControllerContext.tsx +4 -0
- package/src/contexts/SnackbarProvider.tsx +14 -0
- package/src/contexts/StorageSourceContext.tsx +4 -0
- package/src/contexts/UserConfigurationPersistenceContext.tsx +4 -0
- package/src/contexts/index.ts +15 -0
- package/src/core/DefaultAppBar.tsx +274 -0
- package/src/core/DefaultDrawer.tsx +267 -0
- package/src/core/DrawerNavigationGroup.tsx +117 -0
- package/src/core/DrawerNavigationItem.tsx +65 -0
- package/src/core/EntityEditView.tsx +590 -0
- package/src/core/EntityEditViewFormActions.tsx +343 -0
- package/src/core/EntitySidePanel.tsx +173 -0
- package/src/core/Rebase.tsx +229 -0
- package/src/core/RebaseRouter.tsx +17 -0
- package/src/core/RebaseRoutes.tsx +47 -0
- package/src/core/SideDialogs.tsx +200 -0
- package/src/core/field_configs.tsx +443 -0
- package/src/core/index.tsx +14 -0
- package/src/form/EntityForm.tsx +820 -0
- package/src/form/EntityFormActions.tsx +201 -0
- package/src/form/PropertyFieldBinding.tsx +348 -0
- package/src/form/components/ErrorFocus.tsx +44 -0
- package/src/form/components/FieldHelperText.tsx +45 -0
- package/src/form/components/FormEntry.tsx +22 -0
- package/src/form/components/FormLayout.tsx +16 -0
- package/src/form/components/LabelWithIcon.tsx +43 -0
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/LocalChangesMenu.tsx +144 -0
- package/src/form/components/StorageItemPreview.tsx +79 -0
- package/src/form/components/StorageUploadProgress.tsx +105 -0
- package/src/form/components/index.tsx +5 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +105 -0
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +163 -0
- package/src/form/field_bindings/BlockFieldBinding.tsx +268 -0
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +70 -0
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +567 -0
- package/src/form/field_bindings/MapFieldBinding.tsx +156 -0
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +146 -0
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +120 -0
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +151 -0
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +64 -0
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +135 -0
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +134 -0
- package/src/form/field_bindings/RelationFieldBinding.tsx +176 -0
- package/src/form/field_bindings/RepeatFieldBinding.tsx +136 -0
- package/src/form/field_bindings/SelectFieldBinding.tsx +107 -0
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +490 -0
- package/src/form/field_bindings/SwitchFieldBinding.tsx +64 -0
- package/src/form/field_bindings/TextFieldBinding.tsx +153 -0
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +96 -0
- package/src/form/index.tsx +27 -0
- package/src/form/useClearRestoreValue.tsx +35 -0
- package/src/form/validation.ts +532 -0
- package/src/hooks/ApiConfigContext.tsx +40 -0
- package/src/hooks/data/delete.ts +77 -0
- package/src/hooks/data/save.ts +75 -0
- package/src/hooks/data/useCollectionFetch.tsx +148 -0
- package/src/hooks/data/useDataOrder.ts +26 -0
- package/src/hooks/data/useDataSource.tsx +22 -0
- package/src/hooks/data/useEntityFetch.tsx +121 -0
- package/src/hooks/data/useRelationSelector.tsx +205 -0
- package/src/hooks/index.tsx +51 -0
- package/src/hooks/navigation/contexts/CMSUrlContext.tsx +24 -0
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +19 -0
- package/src/hooks/navigation/contexts/NavigationStateContext.tsx +15 -0
- package/src/hooks/navigation/contexts/index.ts +14 -0
- package/src/hooks/navigation/useBuildCMSUrlController.tsx +68 -0
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +150 -0
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +135 -0
- package/src/hooks/navigation/useNavigationRegistry.ts +142 -0
- package/src/hooks/navigation/useNavigationResolution.ts +98 -0
- package/src/hooks/navigation/useNavigationURLs.ts +56 -0
- package/src/hooks/navigation/useResolvedCollections.ts +139 -0
- package/src/hooks/navigation/useResolvedViews.tsx +204 -0
- package/src/hooks/navigation/useTopLevelNavigation.ts +265 -0
- package/src/hooks/navigation/utils.ts +177 -0
- package/src/hooks/useAdminModeController.tsx +23 -0
- package/src/hooks/useAnalyticsController.tsx +8 -0
- package/src/hooks/useAuthController.tsx +14 -0
- package/src/hooks/useBackendStorageSource.ts +276 -0
- package/src/hooks/useBreadcrumbsController.tsx +49 -0
- package/src/hooks/useBrowserTitleAndIcon.tsx +25 -0
- package/src/hooks/useBuildAdminModeController.tsx +24 -0
- package/src/hooks/useBuildEffectiveRoleController.tsx +30 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +65 -0
- package/src/hooks/useBuildModeController.tsx +71 -0
- package/src/hooks/useBuildNavigationController.tsx +341 -0
- package/src/hooks/useClipboard.tsx +158 -0
- package/src/hooks/useCollapsedGroups.ts +72 -0
- package/src/hooks/useCustomizationController.tsx +14 -0
- package/src/hooks/useDialogsController.tsx +14 -0
- package/src/hooks/useEffectiveRoleController.tsx +10 -0
- package/src/hooks/useEntitySelectionDialog.tsx +56 -0
- package/src/hooks/useInternalUserManagementController.tsx +17 -0
- package/src/hooks/useLargeLayout.tsx +65 -0
- package/src/hooks/useModeController.tsx +23 -0
- package/src/hooks/usePermissions.ts +43 -0
- package/src/hooks/useRebaseContext.tsx +86 -0
- package/src/hooks/useResolvedNavigationFrom.tsx +158 -0
- package/src/hooks/useSideDialogsController.tsx +21 -0
- package/src/hooks/useSideEntityController.tsx +15 -0
- package/src/hooks/useSnackbarController.tsx +52 -0
- package/src/hooks/useStorageSource.tsx +14 -0
- package/src/hooks/useUnsavedChangesDialog.tsx +62 -0
- package/src/hooks/useUserConfigurationPersistence.tsx +11 -0
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +17 -0
- package/src/internal/common.tsx +5 -0
- package/src/internal/useBuildDataSource.ts +380 -0
- package/src/internal/useBuildSideDialogsController.tsx +135 -0
- package/src/internal/useBuildSideEntityController.tsx +309 -0
- package/src/internal/useRestoreScroll.tsx +60 -0
- package/src/preview/PropertyPreview.tsx +308 -0
- package/src/preview/components/ArrayEnumPreview.tsx +38 -0
- package/src/preview/components/AsyncPreviewComponent.tsx +47 -0
- package/src/preview/components/BooleanPreview.tsx +25 -0
- package/src/preview/components/DatePreview.tsx +94 -0
- package/src/preview/components/EmptyValue.tsx +10 -0
- package/src/preview/components/EnumValuesChip.tsx +39 -0
- package/src/preview/components/ImagePreview.tsx +111 -0
- package/src/preview/components/ReferencePreview.tsx +162 -0
- package/src/preview/components/RelationPreview.tsx +153 -0
- package/src/preview/components/StorageThumbnail.tsx +91 -0
- package/src/preview/components/UrlComponentPreview.tsx +113 -0
- package/src/preview/components/UserPreview.tsx +27 -0
- package/src/preview/index.ts +26 -0
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +72 -0
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +43 -0
- package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +52 -0
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +49 -0
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +44 -0
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +67 -0
- package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +34 -0
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +69 -0
- package/src/preview/property_previews/MapPropertyPreview.tsx +145 -0
- package/src/preview/property_previews/NumberPropertyPreview.tsx +28 -0
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +275 -0
- package/src/preview/property_previews/StringPropertyPreview.tsx +57 -0
- package/src/preview/util.ts +30 -0
- package/src/routes/CustomCMSRoute.tsx +21 -0
- package/src/routes/RebaseRoute.tsx +255 -0
- package/src/routes/index.ts +2 -0
- package/src/util/createFormexStub.tsx +66 -0
- package/src/util/entity_cache.ts +267 -0
- package/src/util/enums.ts +32 -0
- package/src/util/icon_list.ts +23 -0
- package/src/util/icon_synonyms.ts +1853 -0
- package/src/util/icons.tsx +87 -0
- package/src/util/index.ts +11 -0
- package/src/util/previews.ts +50 -0
- package/src/util/property_utils.tsx +152 -0
- package/src/util/useDebouncedCallback.ts +25 -0
- package/src/util/useStorageUploadController.tsx +342 -0
- package/src/util/useTraceUpdate.tsx +24 -0
- package/src/vitePlugin.ts +47 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export function RebaseLogo({
|
|
4
|
+
width,
|
|
5
|
+
height,
|
|
6
|
+
className,
|
|
7
|
+
style
|
|
8
|
+
}: {
|
|
9
|
+
width?: string,
|
|
10
|
+
height?: string,
|
|
11
|
+
className?: string,
|
|
12
|
+
style?: React.CSSProperties
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
width={width ?? "100%"} height={height ?? "100%"}
|
|
17
|
+
version="1.1"
|
|
18
|
+
style={style}
|
|
19
|
+
className={className}
|
|
20
|
+
viewBox="0 0 583 583" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
21
|
+
<circle cx="291.5" cy="291.5" r="291.5" fill="#0070F4" />
|
|
22
|
+
<ellipse cx="292" cy="291.5" rx="173" ry="173.5" fill="#FF3773" />
|
|
23
|
+
<path
|
|
24
|
+
d="M465 291.5C465 268.847 460.525 246.416 451.831 225.487C443.137 204.558 430.394 185.542 414.329 169.524C398.265 153.506 379.194 140.8 358.204 132.131C337.215 123.462 314.719 119 292 119C269.281 119 246.785 123.462 225.796 132.131C204.806 140.8 185.735 153.506 169.671 169.524C153.606 185.542 140.863 204.558 132.169 225.487C123.475 246.416 119 268.847 119 291.5L292 291.5H465Z"
|
|
25
|
+
fill="#FFA400" />
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import React, { MouseEventHandler, useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { CollectionSize, Entity, EntityCollection, FilterValues } from "@rebasepro/types";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
EntityCollectionRowActions,
|
|
6
|
+
EntityCollectionTable,
|
|
7
|
+
useDataSourceTableController
|
|
8
|
+
} from "../EntityCollectionTable";
|
|
9
|
+
import {
|
|
10
|
+
useAuthController,
|
|
11
|
+
useCustomizationController,
|
|
12
|
+
useDataSource,
|
|
13
|
+
useLargeLayout,
|
|
14
|
+
useCMSUrlController,
|
|
15
|
+
useSideEntityController,
|
|
16
|
+
usePermissions
|
|
17
|
+
} from "../../hooks";
|
|
18
|
+
import { ErrorView } from "../ErrorView";
|
|
19
|
+
import { AddIcon, Button, DialogActions, Typography } from "@rebasepro/ui";
|
|
20
|
+
import { IconForView } from "../../util";
|
|
21
|
+
import { useSelectionController } from "../EntityCollectionView/useSelectionController";
|
|
22
|
+
import { useColumnIds, useTableSearchHelper } from "../common";
|
|
23
|
+
import { useSideDialogContext } from "../../core";
|
|
24
|
+
import { useAnalyticsController } from "../../hooks/useAnalyticsController";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @group Components
|
|
28
|
+
*/
|
|
29
|
+
export interface EntitySelectionProps<M extends Record<string, any>> {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Allow multiple selection of values
|
|
33
|
+
*/
|
|
34
|
+
multiselect?: boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Entity collection config
|
|
38
|
+
*/
|
|
39
|
+
collection?: EntityCollection<M>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Absolute path of the collection.
|
|
43
|
+
* May be not set if this hook is being used in a component and the path is
|
|
44
|
+
* dynamic. If not set, the dialog won't open.
|
|
45
|
+
*/
|
|
46
|
+
path: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* If you are opening the dialog for the first time, you can select some
|
|
50
|
+
* entity ids to be displayed first.
|
|
51
|
+
*/
|
|
52
|
+
selectedEntityIds?: (string | number)[];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* If `multiselect` is set to `false`, you will get the selected entity
|
|
56
|
+
* in this callback.
|
|
57
|
+
* @param entity
|
|
58
|
+
* @callback
|
|
59
|
+
*/
|
|
60
|
+
onSingleEntitySelected?(entity: Entity<any> | null): void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* If `multiselect` is set to `true`, you will get the selected entities
|
|
64
|
+
* in this callback.
|
|
65
|
+
* @param entities
|
|
66
|
+
* @callback
|
|
67
|
+
*/
|
|
68
|
+
onMultipleEntitiesSelected?(entities: Entity<any>[]): void;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Allow selection of entities that pass the given filter only.
|
|
72
|
+
*/
|
|
73
|
+
forceFilter?: FilterValues<string>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Use this description to indicate the user what to do in this dialog.
|
|
77
|
+
*/
|
|
78
|
+
description?: React.ReactNode;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Maximum number of entities that can be selected.
|
|
82
|
+
*/
|
|
83
|
+
maxSelection?: number;
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* This component allows to select entities from a given collection.
|
|
89
|
+
* You probably want to open this dialog as a side view using {@link useEntitySelectionTable}
|
|
90
|
+
* @group Components
|
|
91
|
+
*/
|
|
92
|
+
export function EntitySelectionTable<M extends Record<string, any>>(
|
|
93
|
+
{
|
|
94
|
+
onSingleEntitySelected,
|
|
95
|
+
onMultipleEntitiesSelected,
|
|
96
|
+
multiselect,
|
|
97
|
+
collection,
|
|
98
|
+
path: pathInput,
|
|
99
|
+
selectedEntityIds: selectedEntityIdsProp,
|
|
100
|
+
description,
|
|
101
|
+
forceFilter,
|
|
102
|
+
maxSelection,
|
|
103
|
+
}: EntitySelectionProps<M>) {
|
|
104
|
+
|
|
105
|
+
const sideDialogContext = useSideDialogContext();
|
|
106
|
+
const sideEntityController = useSideEntityController();
|
|
107
|
+
const cmsUrlController = useCMSUrlController();
|
|
108
|
+
const analyticsController = useAnalyticsController();
|
|
109
|
+
|
|
110
|
+
const path = cmsUrlController.resolveDatabasePathsFrom(pathInput);
|
|
111
|
+
|
|
112
|
+
const dataSource = useDataSource(collection);
|
|
113
|
+
|
|
114
|
+
const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState<Entity<any>[]>([]);
|
|
115
|
+
|
|
116
|
+
const toggleEntitySelection = (entity: Entity<any>) => {
|
|
117
|
+
let newValue;
|
|
118
|
+
const selectedEntities = selectionController.selectedEntities;
|
|
119
|
+
|
|
120
|
+
analyticsController.onAnalyticsEvent?.("reference_selection_toggle", {
|
|
121
|
+
path,
|
|
122
|
+
entityId: entity.id
|
|
123
|
+
});
|
|
124
|
+
if (selectedEntities) {
|
|
125
|
+
|
|
126
|
+
if (selectedEntities.map((e) => e.id).indexOf(entity.id) > -1) {
|
|
127
|
+
newValue = selectedEntities.filter((item: Entity<any>) => item.id !== entity.id);
|
|
128
|
+
} else {
|
|
129
|
+
if (maxSelection && selectedEntities.length >= maxSelection)
|
|
130
|
+
return;
|
|
131
|
+
newValue = [...selectedEntities, entity];
|
|
132
|
+
}
|
|
133
|
+
selectionController.setSelectedEntities(newValue);
|
|
134
|
+
|
|
135
|
+
if (onMultipleEntitiesSelected)
|
|
136
|
+
onMultipleEntitiesSelected(newValue);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const selectionController = useSelectionController(toggleEntitySelection);
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Fetch initially selected ids
|
|
144
|
+
*/
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
let unmounted = false;
|
|
147
|
+
const selectedEntityIds = selectedEntityIdsProp?.map(id => id?.toString()).filter(Boolean);
|
|
148
|
+
if (selectedEntityIds && collection) {
|
|
149
|
+
Promise.all(
|
|
150
|
+
selectedEntityIds.map((entityId) =>
|
|
151
|
+
dataSource.fetchEntity({
|
|
152
|
+
path,
|
|
153
|
+
entityId,
|
|
154
|
+
collection
|
|
155
|
+
})))
|
|
156
|
+
.then((entities) => {
|
|
157
|
+
if (!unmounted) {
|
|
158
|
+
const result = entities.filter(e => e !== undefined) as Entity<any>[];
|
|
159
|
+
selectionController.setSelectedEntities(result);
|
|
160
|
+
setEntitiesDisplayedFirst(result);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
selectionController.setSelectedEntities([]);
|
|
165
|
+
setEntitiesDisplayedFirst([]);
|
|
166
|
+
}
|
|
167
|
+
return () => {
|
|
168
|
+
unmounted = true;
|
|
169
|
+
};
|
|
170
|
+
}, [dataSource, path, selectedEntityIdsProp, collection, selectionController.setSelectedEntities]);
|
|
171
|
+
|
|
172
|
+
const onClear = () => {
|
|
173
|
+
analyticsController.onAnalyticsEvent?.("reference_selection_clear", {
|
|
174
|
+
path
|
|
175
|
+
});
|
|
176
|
+
selectionController.setSelectedEntities([]);
|
|
177
|
+
if (!multiselect && onSingleEntitySelected) {
|
|
178
|
+
onSingleEntitySelected(null);
|
|
179
|
+
} else if (onMultipleEntitiesSelected) {
|
|
180
|
+
onMultipleEntitiesSelected([]);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const onEntityClick = (entity: Entity<any>) => {
|
|
185
|
+
if (!multiselect && onSingleEntitySelected) {
|
|
186
|
+
analyticsController.onAnalyticsEvent?.("reference_selected_single", {
|
|
187
|
+
path,
|
|
188
|
+
entityId: entity.id
|
|
189
|
+
});
|
|
190
|
+
onSingleEntitySelected(entity);
|
|
191
|
+
sideDialogContext.close(false);
|
|
192
|
+
} else {
|
|
193
|
+
toggleEntitySelection(entity);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// create a new entity from within the reference dialog
|
|
198
|
+
const onNewClick = () => {
|
|
199
|
+
analyticsController.onAnalyticsEvent?.("reference_selection_new_entity", {
|
|
200
|
+
path
|
|
201
|
+
});
|
|
202
|
+
sideEntityController.open({
|
|
203
|
+
path: path,
|
|
204
|
+
collection,
|
|
205
|
+
updateUrl: true,
|
|
206
|
+
onUpdate: ({ entity }) => {
|
|
207
|
+
setEntitiesDisplayedFirst([entity, ...entitiesDisplayedFirst]);
|
|
208
|
+
onEntityClick(entity);
|
|
209
|
+
},
|
|
210
|
+
closeOnSave: true
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const tableRowActionsBuilder = ({
|
|
215
|
+
entity,
|
|
216
|
+
size,
|
|
217
|
+
width,
|
|
218
|
+
frozen
|
|
219
|
+
}: {
|
|
220
|
+
entity: Entity<any>,
|
|
221
|
+
size: CollectionSize,
|
|
222
|
+
width: number,
|
|
223
|
+
frozen?: boolean
|
|
224
|
+
}) => {
|
|
225
|
+
const selectedEntities = selectionController.selectedEntities;
|
|
226
|
+
const isSelected = selectedEntities && selectedEntities.map(e => e.id).indexOf(entity.id) > -1;
|
|
227
|
+
return <EntityCollectionRowActions
|
|
228
|
+
width={width}
|
|
229
|
+
frozen={frozen}
|
|
230
|
+
entity={entity}
|
|
231
|
+
size={size}
|
|
232
|
+
isSelected={isSelected}
|
|
233
|
+
selectionEnabled={multiselect}
|
|
234
|
+
hideId={collection?.hideIdFromCollection}
|
|
235
|
+
path={path}
|
|
236
|
+
selectionController={selectionController}
|
|
237
|
+
openEntityMode={"side_panel"}
|
|
238
|
+
/>;
|
|
239
|
+
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const onDone = useCallback((event: React.SyntheticEvent) => {
|
|
243
|
+
event.stopPropagation();
|
|
244
|
+
sideDialogContext.close(false);
|
|
245
|
+
}, [sideDialogContext]);
|
|
246
|
+
|
|
247
|
+
if (!collection) {
|
|
248
|
+
return <ErrorView
|
|
249
|
+
error={"Could not find collection with id " + collection} />
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const displayedColumnIds = useColumnIds(collection, false);
|
|
253
|
+
|
|
254
|
+
const tableController = useDataSourceTableController<M>({
|
|
255
|
+
path,
|
|
256
|
+
collection,
|
|
257
|
+
entitiesDisplayedFirst,
|
|
258
|
+
forceFilter,
|
|
259
|
+
updateUrl: false,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
const {
|
|
263
|
+
textSearchLoading,
|
|
264
|
+
textSearchInitialised,
|
|
265
|
+
onTextSearchClick
|
|
266
|
+
} =
|
|
267
|
+
useTableSearchHelper({
|
|
268
|
+
collection,
|
|
269
|
+
path,
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
|
|
274
|
+
<div className="flex flex-col h-full">
|
|
275
|
+
|
|
276
|
+
<div className="grow">
|
|
277
|
+
{entitiesDisplayedFirst &&
|
|
278
|
+
<EntityCollectionTable
|
|
279
|
+
textSearchLoading={textSearchLoading}
|
|
280
|
+
onTextSearchClick={!textSearchInitialised ? onTextSearchClick : undefined}
|
|
281
|
+
additionalFields={collection.additionalFields}
|
|
282
|
+
displayedColumnIds={displayedColumnIds}
|
|
283
|
+
onEntityClick={onEntityClick}
|
|
284
|
+
tableController={tableController}
|
|
285
|
+
enablePopupIcon={false}
|
|
286
|
+
tableRowActionsBuilder={tableRowActionsBuilder}
|
|
287
|
+
openEntityMode={"side_panel"}
|
|
288
|
+
title={<Typography variant={"subtitle2"} className={"flex flex-row gap-2"}>
|
|
289
|
+
<IconForView
|
|
290
|
+
size={"small"}
|
|
291
|
+
collectionOrView={collection}
|
|
292
|
+
className={"text-surface-300 dark:text-surface-600"} />
|
|
293
|
+
{collection.singularName
|
|
294
|
+
? `Select ${collection.singularName}`
|
|
295
|
+
: `Select from ${collection.name}`}
|
|
296
|
+
</Typography>}
|
|
297
|
+
defaultSize={collection.defaultSize}
|
|
298
|
+
properties={collection.properties}
|
|
299
|
+
forceFilter={forceFilter}
|
|
300
|
+
inlineEditing={false}
|
|
301
|
+
selectionController={selectionController}
|
|
302
|
+
actions={<EntitySelectionDialogActions
|
|
303
|
+
collection={collection}
|
|
304
|
+
path={path}
|
|
305
|
+
onNewClick={onNewClick}
|
|
306
|
+
onClear={onClear} />
|
|
307
|
+
}
|
|
308
|
+
/>}
|
|
309
|
+
</div>
|
|
310
|
+
<DialogActions translucent={false}>
|
|
311
|
+
{description &&
|
|
312
|
+
<Typography variant={"body2"}
|
|
313
|
+
className="grow text-left">
|
|
314
|
+
{description}
|
|
315
|
+
</Typography>}
|
|
316
|
+
<Button
|
|
317
|
+
onClick={onDone}
|
|
318
|
+
variant="filled">
|
|
319
|
+
Done
|
|
320
|
+
</Button>
|
|
321
|
+
</DialogActions>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function EntitySelectionDialogActions({
|
|
329
|
+
collection,
|
|
330
|
+
path,
|
|
331
|
+
onClear,
|
|
332
|
+
onNewClick
|
|
333
|
+
}: {
|
|
334
|
+
collection: EntityCollection<any>,
|
|
335
|
+
path: string,
|
|
336
|
+
onClear: () => void,
|
|
337
|
+
onNewClick: () => void
|
|
338
|
+
}) {
|
|
339
|
+
|
|
340
|
+
const { canCreate } = usePermissions();
|
|
341
|
+
|
|
342
|
+
const largeLayout = useLargeLayout();
|
|
343
|
+
|
|
344
|
+
const onClick: MouseEventHandler<HTMLButtonElement> | undefined = onNewClick
|
|
345
|
+
? (e) => {
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
onNewClick();
|
|
348
|
+
}
|
|
349
|
+
: undefined;
|
|
350
|
+
const addButton = canCreate(collection, path) &&
|
|
351
|
+
onClick && (largeLayout
|
|
352
|
+
? <Button
|
|
353
|
+
onClick={onClick}
|
|
354
|
+
startIcon={<AddIcon />}>
|
|
355
|
+
Add {collection.singularName ?? collection.name}
|
|
356
|
+
</Button>
|
|
357
|
+
: <Button
|
|
358
|
+
onClick={onClick}>
|
|
359
|
+
<AddIcon />
|
|
360
|
+
</Button>);
|
|
361
|
+
|
|
362
|
+
return (
|
|
363
|
+
<>
|
|
364
|
+
<Button onClick={onClear}
|
|
365
|
+
variant={"text"}>
|
|
366
|
+
Clear
|
|
367
|
+
</Button>
|
|
368
|
+
{addButton}
|
|
369
|
+
</>
|
|
370
|
+
);
|
|
371
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { Entity, EntityCollection, EntityReference, FilterValues, PreviewSize } from "@rebasepro/types";
|
|
4
|
+
import { getReferenceFrom } from "@rebasepro/common";
|
|
5
|
+
import { ReferencePreview } from "../preview";
|
|
6
|
+
import { useCollectionRegistryController, useEntitySelectionDialog } from "../hooks";
|
|
7
|
+
import { Button, cls } from "@rebasepro/ui";
|
|
8
|
+
|
|
9
|
+
export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
10
|
+
name?: string,
|
|
11
|
+
multiselect?: boolean,
|
|
12
|
+
value: EntityReference | EntityReference[] | null,
|
|
13
|
+
onReferenceSelected?: (params: {
|
|
14
|
+
reference: EntityReference | null,
|
|
15
|
+
entity: Entity<M> | null
|
|
16
|
+
}) => void,
|
|
17
|
+
onMultipleReferenceSelected?: (params: {
|
|
18
|
+
references: EntityReference[] | null,
|
|
19
|
+
entities: Entity<M>[] | null
|
|
20
|
+
}) => void,
|
|
21
|
+
path: string,
|
|
22
|
+
disabled?: boolean,
|
|
23
|
+
previewProperties?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Allow selection of entities that pass the given filter only.
|
|
26
|
+
*/
|
|
27
|
+
forceFilter?: FilterValues<string>;
|
|
28
|
+
size: PreviewSize;
|
|
29
|
+
className?: string;
|
|
30
|
+
includeId?: boolean;
|
|
31
|
+
includeEntityLink?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This field allows selecting reference/s.
|
|
36
|
+
*/
|
|
37
|
+
export function ReferenceWidget<M extends Record<string, any>>({
|
|
38
|
+
name,
|
|
39
|
+
multiselect = false,
|
|
40
|
+
path,
|
|
41
|
+
disabled,
|
|
42
|
+
value,
|
|
43
|
+
onReferenceSelected,
|
|
44
|
+
onMultipleReferenceSelected,
|
|
45
|
+
previewProperties,
|
|
46
|
+
forceFilter,
|
|
47
|
+
size,
|
|
48
|
+
className,
|
|
49
|
+
includeId,
|
|
50
|
+
includeEntityLink
|
|
51
|
+
}: ReferenceWidgetProps<M>) {
|
|
52
|
+
|
|
53
|
+
const navigationController = useCollectionRegistryController();
|
|
54
|
+
|
|
55
|
+
const collection: EntityCollection | undefined = useMemo(() => {
|
|
56
|
+
return navigationController.getCollection(path);
|
|
57
|
+
}, [path, navigationController.getCollection]);
|
|
58
|
+
|
|
59
|
+
const onSingleEntitySelected = useCallback((entity: Entity<M> | null) => {
|
|
60
|
+
if (disabled)
|
|
61
|
+
return;
|
|
62
|
+
if (onReferenceSelected) {
|
|
63
|
+
const reference = entity ? getReferenceFrom(entity) : null;
|
|
64
|
+
onReferenceSelected?.({
|
|
65
|
+
reference,
|
|
66
|
+
entity
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}, [disabled, onReferenceSelected]);
|
|
70
|
+
|
|
71
|
+
const onMultipleEntitiesSelected = useCallback((entities: Entity<M>[]) => {
|
|
72
|
+
if (disabled)
|
|
73
|
+
return;
|
|
74
|
+
if (onMultipleReferenceSelected) {
|
|
75
|
+
const references = entities ? entities.map(e => getReferenceFrom(e)) : null;
|
|
76
|
+
onMultipleReferenceSelected({
|
|
77
|
+
references,
|
|
78
|
+
entities
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [disabled, onReferenceSelected]);
|
|
82
|
+
|
|
83
|
+
const referenceDialogController = useEntitySelectionDialog({
|
|
84
|
+
multiselect,
|
|
85
|
+
path,
|
|
86
|
+
collection,
|
|
87
|
+
onSingleEntitySelected,
|
|
88
|
+
onMultipleEntitiesSelected,
|
|
89
|
+
forceFilter
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const clearValue = useCallback((e: React.MouseEvent) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
if (multiselect) {
|
|
96
|
+
onMultipleEntitiesSelected([]);
|
|
97
|
+
} else {
|
|
98
|
+
onSingleEntitySelected(null);
|
|
99
|
+
}
|
|
100
|
+
}, [onReferenceSelected]);
|
|
101
|
+
|
|
102
|
+
let child: React.ReactNode;
|
|
103
|
+
|
|
104
|
+
const onEntryClick = () => {
|
|
105
|
+
if (disabled)
|
|
106
|
+
return;
|
|
107
|
+
referenceDialogController.open();
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
if (Array.isArray(value)) {
|
|
111
|
+
child = <div className={"flex flex-col gap-4"}>
|
|
112
|
+
{value.map((ref, index) => {
|
|
113
|
+
return <ReferencePreview
|
|
114
|
+
key={`reference_preview_${index}`}
|
|
115
|
+
onClick={onEntryClick}
|
|
116
|
+
reference={ref}
|
|
117
|
+
disabled={disabled}
|
|
118
|
+
previewProperties={previewProperties}
|
|
119
|
+
size={size}
|
|
120
|
+
includeId={includeId}
|
|
121
|
+
includeEntityLink={includeEntityLink} />
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
} else if (value?.isEntityReference && value?.isEntityReference()) {
|
|
125
|
+
child = <ReferencePreview
|
|
126
|
+
reference={value}
|
|
127
|
+
onClick={onEntryClick}
|
|
128
|
+
disabled={disabled}
|
|
129
|
+
previewProperties={previewProperties}
|
|
130
|
+
size={size}
|
|
131
|
+
includeId={includeId}
|
|
132
|
+
includeEntityLink={includeEntityLink} />
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
return <div className={cls("text-sm font-medium",
|
|
136
|
+
"min-w-80 flex flex-col gap-4",
|
|
137
|
+
"relative transition-colors duration-200 ease-in rounded-xs font-medium",
|
|
138
|
+
disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
|
|
139
|
+
"dark:text-white/50 text-text-primary/50 dark:text-text-primary-dark/50 dark:text-white/50",
|
|
140
|
+
className
|
|
141
|
+
)}>
|
|
142
|
+
|
|
143
|
+
{child}
|
|
144
|
+
{!value && <div className="justify-center text-left">
|
|
145
|
+
<Button disabled={disabled}
|
|
146
|
+
onClick={onEntryClick}>
|
|
147
|
+
Edit {name}
|
|
148
|
+
</Button>
|
|
149
|
+
</div>}
|
|
150
|
+
|
|
151
|
+
</div>;
|
|
152
|
+
}
|