@rebasepro/admin 0.2.3 → 0.2.4
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/{CollectionEditorDialog-CmGXXSY9.js → CollectionEditorDialog-D0VqpLPO.js} +70 -77
- package/dist/CollectionEditorDialog-D0VqpLPO.js.map +1 -0
- package/dist/{CollectionsStudioView-DcLHT5bU.js → CollectionsStudioView-Bc3Rxxc2.js} +5 -4
- package/dist/{CollectionsStudioView-DcLHT5bU.js.map → CollectionsStudioView-Bc3Rxxc2.js.map} +1 -1
- package/dist/{ExportCollectionAction-BfN34eWX.js → ExportCollectionAction-Ckc-09BQ.js} +4 -3
- package/dist/ExportCollectionAction-Ckc-09BQ.js.map +1 -0
- package/dist/{ImportCollectionAction-SZrInjhx.js → ImportCollectionAction-BqjIrC3Z.js} +3 -2
- package/dist/{ImportCollectionAction-SZrInjhx.js.map → ImportCollectionAction-BqjIrC3Z.js.map} +1 -1
- package/dist/{PropertyEditView-Cvryrb3B.js → PropertyEditView-CvRSV-A2.js} +128 -121
- package/dist/PropertyEditView-CvRSV-A2.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.d.ts +0 -5
- package/dist/collection_editor/index.d.ts +0 -1
- package/dist/collection_editor/types/collection_editor_controller.d.ts +0 -2
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +3 -3
- package/dist/collection_editor_ui.js +3 -3
- package/dist/components/ArrayContainer.d.ts +2 -2
- package/dist/components/DefaultAppBar.d.ts +18 -1
- package/dist/components/DefaultDrawer.d.ts +51 -3
- package/dist/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/table_bindings.d.ts +4 -3
- package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +4 -3
- package/dist/components/EntityEditView.d.ts +2 -1
- package/dist/components/HomePage/HomePageDnD.d.ts +3 -3
- package/dist/components/PropertyCollectionView.d.ts +1 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +4 -1
- package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +2 -2
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -2
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +2 -2
- package/dist/components/admin/RolesView.d.ts +3 -3
- package/dist/components/admin/UsersView.d.ts +3 -3
- package/dist/components/app/Drawer.d.ts +8 -1
- package/dist/data_export/export/export.d.ts +3 -3
- package/dist/editor/components/editor-bubble.d.ts +5 -1
- package/dist/editor/components/image-bubble.d.ts +5 -1
- package/dist/editor/components/index.d.ts +3 -3
- package/dist/editor/components/table-bubble.d.ts +5 -1
- package/dist/editor/nodeViews/ReactNodeView.d.ts +4 -1
- package/dist/editor/useProseMirror.d.ts +2 -2
- package/dist/editor/utils/remove_classes.d.ts +1 -1
- package/dist/editor.js +15 -14
- package/dist/editor.js.map +1 -1
- package/dist/form/EntityForm.d.ts +2 -2
- package/dist/form/components/StorageUploadProgress.d.ts +2 -2
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
- package/dist/form/validation.d.ts +3 -3
- package/dist/hooks/navigation/useResolvedCollections.d.ts +6 -0
- package/dist/hooks/navigation/useResolvedViews.d.ts +3 -4
- package/dist/{index-PLIQXpTt.js → index-BCcLwgfe.js} +3 -2
- package/dist/{index-PLIQXpTt.js.map → index-BCcLwgfe.js.map} +1 -1
- package/dist/{index-DjduZG1T.js → index-DY2k5TtG.js} +3 -3
- package/dist/index-DY2k5TtG.js.map +1 -0
- package/dist/{index-MKPc70-v.js → index-UQOMHwt1.js} +3 -3
- package/dist/index-UQOMHwt1.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2813 -372
- package/dist/index.js.map +1 -1
- package/dist/{markdown-z2Ir7Cgo.js → markdown-DD2JDU1X.js} +2 -2
- package/dist/markdown-DD2JDU1X.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/EntityFormProps.d.ts +2 -2
- package/dist/types/fields.d.ts +1 -1
- package/dist/{util-DbWax_sV.js → util-ZM9gQuCv.js} +2031 -2078
- package/dist/util-ZM9gQuCv.js.map +1 -0
- package/package.json +8 -8
- package/src/collection_editor/ConfigControllerProvider.tsx +3 -13
- package/src/collection_editor/index.ts +1 -3
- package/src/collection_editor/types/collection_editor_controller.tsx +0 -3
- package/src/collection_editor/ui/EditorCollectionAction.tsx +1 -6
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +1 -6
- package/src/collection_editor/ui/EditorEntityAction.tsx +1 -6
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +7 -14
- package/src/collection_editor/ui/NewCollectionCard.tsx +1 -5
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +3 -8
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +8 -12
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +21 -21
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/EnumForm.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +8 -8
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +8 -8
- package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +4 -7
- package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +4 -4
- package/src/components/ArrayContainer.tsx +3 -3
- package/src/components/DefaultAppBar.tsx +52 -31
- package/src/components/DefaultDrawer.tsx +279 -66
- package/src/components/DrawerNavigationItem.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +6 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +9 -7
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -5
- package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +12 -9
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +1 -1
- package/src/components/EntityCollectionTable/table_bindings.tsx +5 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +6 -4
- package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
- package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +7 -6
- package/src/components/EntityDetailView.tsx +46 -24
- package/src/components/EntityEditView.tsx +51 -28
- package/src/components/EntityEditViewFormActions.tsx +4 -4
- package/src/components/EntityPreview.tsx +9 -4
- package/src/components/HomePage/HomePageDnD.tsx +3 -2
- package/src/components/PropertyCollectionView.tsx +1 -1
- package/src/components/PropertyIdCopyTooltip.tsx +1 -1
- package/src/components/RebaseLayout.tsx +5 -1
- package/src/components/RebaseNavigation.tsx +2 -2
- package/src/components/RebaseRouteDefs.tsx +4 -7
- package/src/components/RebaseShell.tsx +16 -13
- package/src/components/SearchIconsView.tsx +1 -8
- package/src/components/SelectableTable/SelectableTable.tsx +8 -11
- package/src/components/SelectableTable/SelectionStore.ts +1 -1
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +3 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +3 -3
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +5 -5
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +3 -3
- package/src/components/SideEntityProvider.tsx +2 -1
- package/src/components/admin/RolesView.tsx +7 -2
- package/src/components/admin/UsersView.tsx +12 -6
- package/src/components/app/Drawer.tsx +9 -1
- package/src/components/app/Scaffold.tsx +5 -1
- package/src/data_export/export/export.ts +17 -17
- package/src/data_import/components/DataNewPropertiesMapping.tsx +1 -1
- package/src/editor/components/editor-bubble.tsx +32 -9
- package/src/editor/components/image-bubble.tsx +27 -11
- package/src/editor/components/index.ts +3 -3
- package/src/editor/components/table-bubble.tsx +79 -17
- package/src/editor/extensions/HighlightDecorationExtension.ts +3 -2
- package/src/editor/nodeViews/ReactNodeView.tsx +1 -1
- package/src/editor/nodeViews/TaskItemComponent.tsx +9 -8
- package/src/editor/schema.ts +135 -59
- package/src/editor/selectors/link-selector.tsx +8 -5
- package/src/editor/useProseMirror.ts +2 -2
- package/src/editor/utils/remove_classes.ts +6 -5
- package/src/form/EntityForm.tsx +15 -15
- package/src/form/EntityFormActions.tsx +2 -2
- package/src/form/PropertyFieldBinding.tsx +64 -64
- package/src/form/components/FieldHelperText.tsx +4 -4
- package/src/form/components/StorageUploadProgress.tsx +2 -2
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +1 -1
- package/src/form/field_bindings/BlockFieldBinding.tsx +54 -53
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +290 -289
- package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +8 -6
- package/src/form/field_bindings/RelationFieldBinding.tsx +4 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
- package/src/form/field_bindings/SelectFieldBinding.tsx +1 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +84 -84
- package/src/form/field_bindings/SwitchFieldBinding.tsx +16 -16
- package/src/form/field_bindings/TextFieldBinding.tsx +77 -73
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +17 -17
- package/src/form/validation.ts +43 -43
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +3 -5
- package/src/hooks/navigation/useResolvedCollections.ts +27 -7
- package/src/hooks/navigation/useResolvedViews.tsx +24 -44
- package/src/index.ts +2 -0
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +2 -1
- package/src/preview/components/UrlComponentPreview.tsx +11 -2
- package/src/preview/components/UserPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -4
- package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +3 -3
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +3 -3
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +3 -2
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +6 -8
- package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +4 -3
- package/src/preview/property_previews/NumberPropertyPreview.tsx +5 -3
- package/src/preview/property_previews/StringPropertyPreview.tsx +10 -8
- package/src/types/components/EntityFormActionsProps.tsx +1 -1
- package/src/types/components/EntityFormProps.tsx +2 -2
- package/src/types/fields.tsx +2 -2
- package/dist/CollectionEditorDialog-CmGXXSY9.js.map +0 -1
- package/dist/ContentHomePage-C7vFqKSe.js +0 -1784
- package/dist/ContentHomePage-C7vFqKSe.js.map +0 -1
- package/dist/ExportCollectionAction-BfN34eWX.js.map +0 -1
- package/dist/PropertyEditView-Cvryrb3B.js.map +0 -1
- package/dist/RoleChip-QtUFXeTp.js +0 -67
- package/dist/RoleChip-QtUFXeTp.js.map +0 -1
- package/dist/RolesView-BCb7qwWs.js +0 -437
- package/dist/RolesView-BCb7qwWs.js.map +0 -1
- package/dist/UsersView-Cex24r8H.js +0 -408
- package/dist/UsersView-Cex24r8H.js.map +0 -1
- package/dist/collection_editor/types/config_permissions.d.ts +0 -19
- package/dist/index-DjduZG1T.js.map +0 -1
- package/dist/index-MKPc70-v.js.map +0 -1
- package/dist/markdown-z2Ir7Cgo.js.map +0 -1
- package/dist/util-DbWax_sV.js.map +0 -1
- package/src/collection_editor/types/config_permissions.ts +0 -20
|
@@ -5,8 +5,8 @@ import { useTranslation } from "@rebasepro/core";
|
|
|
5
5
|
|
|
6
6
|
interface BooleanFieldProps {
|
|
7
7
|
name: string,
|
|
8
|
-
value?: [op: VirtualTableWhereFilterOp, fieldValue:
|
|
9
|
-
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue:
|
|
8
|
+
value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];
|
|
9
|
+
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue: unknown]) => void;
|
|
10
10
|
title?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ export function BooleanFilterField({
|
|
|
37
37
|
<div className="w-full">
|
|
38
38
|
<BooleanSwitchWithLabel
|
|
39
39
|
size={"medium"}
|
|
40
|
-
value={valueSetToTrue}
|
|
40
|
+
value={valueSetToTrue as boolean | null}
|
|
41
41
|
allowIndeterminate={true}
|
|
42
42
|
onValueChange={(v: boolean | null) => updateFilter(v === null ? undefined : v)}
|
|
43
43
|
label={!valueSet
|
|
@@ -6,8 +6,8 @@ import { useCustomizationController } from "@rebasepro/core";
|
|
|
6
6
|
interface DateTimeFilterFieldProps {
|
|
7
7
|
name: string,
|
|
8
8
|
mode?: "date" | "date_time",
|
|
9
|
-
value?: [op: VirtualTableWhereFilterOp, fieldValue:
|
|
10
|
-
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue:
|
|
9
|
+
value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];
|
|
10
|
+
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue: unknown]) => void;
|
|
11
11
|
isArray?: boolean;
|
|
12
12
|
title?: string;
|
|
13
13
|
timezone?: string;
|
|
@@ -46,7 +46,7 @@ export function DateTimeFilterField({
|
|
|
46
46
|
|
|
47
47
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
48
48
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp | "is-null">(fieldOperation === "==" && fieldValue === null ? "is-null" : fieldOperation);
|
|
49
|
-
const [internalValue, setInternalValue] = useState<Date | null | undefined>(fieldValue);
|
|
49
|
+
const [internalValue, setInternalValue] = useState<Date | null | undefined>(fieldValue as Date | null | undefined);
|
|
50
50
|
|
|
51
51
|
const isNullOperation = operation === "is-null";
|
|
52
52
|
|
|
@@ -11,8 +11,8 @@ import { useCollectionRegistryController } from "../../../index";
|
|
|
11
11
|
|
|
12
12
|
interface ReferenceFilterFieldProps {
|
|
13
13
|
name: string,
|
|
14
|
-
value?: [op: VirtualTableWhereFilterOp, fieldValue:
|
|
15
|
-
setValue: (filterValue?: [VirtualTableWhereFilterOp,
|
|
14
|
+
value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];
|
|
15
|
+
setValue: (filterValue?: [VirtualTableWhereFilterOp, unknown]) => void;
|
|
16
16
|
isArray?: boolean;
|
|
17
17
|
path?: string;
|
|
18
18
|
title?: string;
|
|
@@ -60,7 +60,7 @@ export function ReferenceFilterField({
|
|
|
60
60
|
|
|
61
61
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
62
62
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
63
|
-
const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined | null>(fieldValue);
|
|
63
|
+
const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined | null>(fieldValue as EntityReference | EntityReference[] | undefined | null);
|
|
64
64
|
|
|
65
65
|
const selectedEntityIds = internalValue
|
|
66
66
|
? (Array.isArray(internalValue) ? internalValue.map((ref) => {
|
|
@@ -104,11 +104,11 @@ export function ReferenceFilterField({
|
|
|
104
104
|
return path ? collectionRegistryController.getCollection(path) : undefined;
|
|
105
105
|
}, [path]);
|
|
106
106
|
|
|
107
|
-
const onSingleEntitySelected = (entity: Entity<
|
|
107
|
+
const onSingleEntitySelected = (entity: Entity<Record<string, unknown>>) => {
|
|
108
108
|
updateFilter(operation, getReferenceFrom(entity));
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
const onMultipleEntitiesSelected = (entities: Entity<
|
|
111
|
+
const onMultipleEntitiesSelected = (entities: Entity<Record<string, unknown>>[]) => {
|
|
112
112
|
updateFilter(operation, entities.map(e => getReferenceFrom(e)));
|
|
113
113
|
};
|
|
114
114
|
|
|
@@ -9,8 +9,8 @@ import { useTranslation } from "@rebasepro/core";
|
|
|
9
9
|
interface StringNumberFilterFieldProps {
|
|
10
10
|
name: string,
|
|
11
11
|
type: "string" | "number";
|
|
12
|
-
value?: [op: VirtualTableWhereFilterOp, fieldValue:
|
|
13
|
-
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue:
|
|
12
|
+
value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];
|
|
13
|
+
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue: unknown]) => void;
|
|
14
14
|
isArray?: boolean;
|
|
15
15
|
enumValues?: EnumValueConfig[];
|
|
16
16
|
title?: string;
|
|
@@ -57,7 +57,7 @@ export function StringNumberFilterField({
|
|
|
57
57
|
|
|
58
58
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
59
59
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp | "is-null">(fieldOperation === "==" && fieldValue === null ? "is-null" : fieldOperation);
|
|
60
|
-
const [internalValue, setInternalValue] = useState<string | number | string[] | number[] | null | undefined>(fieldValue);
|
|
60
|
+
const [internalValue, setInternalValue] = useState<string | number | string[] | number[] | null | undefined>(fieldValue as string | number | string[] | number[] | null | undefined);
|
|
61
61
|
|
|
62
62
|
const isNullOperation = operation === "is-null";
|
|
63
63
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SideEntityController } from "@rebasepro/types";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { useBuildSideEntityController } from "../hooks/useBuildSideEntityController";
|
|
3
4
|
import { useBuildSideDialogsController } from "../hooks/useBuildSideDialogsController";
|
|
@@ -68,7 +69,7 @@ export function SideEntityProvider({ children }: { children: React.ReactNode })
|
|
|
68
69
|
* Internal component that auto-registers side entity and breadcrumbs
|
|
69
70
|
* into the Studio bridge. Must be a child of BreadcrumbsProvider.
|
|
70
71
|
*/
|
|
71
|
-
function BridgeAutoRegistrar({ sideEntityController }: { sideEntityController:
|
|
72
|
+
function BridgeAutoRegistrar({ sideEntityController }: { sideEntityController: SideEntityController }) {
|
|
72
73
|
const breadcrumbs = useBreadcrumbsController();
|
|
73
74
|
useBridgeRegistration("sideEntityController", sideEntityController);
|
|
74
75
|
useBridgeRegistration("breadcrumbs", breadcrumbs);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { useCollectionRegistryController } from "../../index";
|
|
4
|
-
import { useSnackbarController, useTranslation } from "@rebasepro/core";
|
|
4
|
+
import { useSnackbarController, useTranslation, useInternalUserManagementController } from "@rebasepro/core";
|
|
5
5
|
import { getDataSourceCapabilities, Role, SecurityRule, UserManagementDelegate } from "@rebasepro/types";
|
|
6
6
|
import { useBreadcrumbsController } from "../../index";
|
|
7
7
|
import {
|
|
@@ -38,7 +38,12 @@ import { ConfirmationDialog } from "@rebasepro/core";
|
|
|
38
38
|
// ============================================
|
|
39
39
|
// RolesView Component
|
|
40
40
|
// ============================================
|
|
41
|
-
export function RolesView({ userManagement }: { userManagement
|
|
41
|
+
export function RolesView({ userManagement: userManagementProp }: { userManagement?: UserManagementDelegate }) {
|
|
42
|
+
const userManagementContext = useInternalUserManagementController();
|
|
43
|
+
const userManagement = userManagementProp ?? userManagementContext;
|
|
44
|
+
if (!userManagement) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
42
47
|
const { roles, saveRole, deleteRole, loading, allowDefaultRolesCreation, rolesError } = userManagement;
|
|
43
48
|
const snackbarController = useSnackbarController();
|
|
44
49
|
const { t } = useTranslation();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import React, { useState, useEffect, useCallback, useRef } from "react";
|
|
3
3
|
import { User } from "@rebasepro/types";
|
|
4
|
-
import { useSnackbarController, useAuthController, useTranslation } from "@rebasepro/core";
|
|
4
|
+
import { useSnackbarController, useAuthController, useTranslation, useInternalUserManagementController } from "@rebasepro/core";
|
|
5
5
|
import { useBreadcrumbsController } from "../../index";
|
|
6
6
|
import {
|
|
7
7
|
Alert,
|
|
@@ -50,9 +50,14 @@ const PAGE_SIZE = 25;
|
|
|
50
50
|
// ============================================
|
|
51
51
|
// UsersView Component
|
|
52
52
|
// ============================================
|
|
53
|
-
export function UsersView({ userManagement }: {
|
|
54
|
-
userManagement
|
|
53
|
+
export function UsersView({ userManagement: userManagementProp }: {
|
|
54
|
+
userManagement?: UserManagementDelegate;
|
|
55
55
|
}) {
|
|
56
|
+
const userManagementContext = useInternalUserManagementController();
|
|
57
|
+
const userManagement = userManagementProp ?? userManagementContext;
|
|
58
|
+
if (!userManagement) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
56
61
|
const { roles, saveUser, createUser, deleteUser, resetPassword, loading: delegateLoading, bootstrapAdmin, usersError } = userManagement;
|
|
57
62
|
const snackbarController = useSnackbarController();
|
|
58
63
|
const { user: loggedInUser } = useAuthController();
|
|
@@ -212,8 +217,8 @@ message: error instanceof Error ? error.message : "Failed to load users" });
|
|
|
212
217
|
|
|
213
218
|
const totalPages = Math.max(1, Math.ceil(displayTotal / PAGE_SIZE));
|
|
214
219
|
|
|
215
|
-
// Check if any admin exists
|
|
216
|
-
const hasAdmin = allUsers.some(u => u.roles?.includes("admin"));
|
|
220
|
+
// Check if any admin exists (use dedicated flag from delegate, or fallback to array scan)
|
|
221
|
+
const hasAdmin = userManagement.hasAdminUsers ?? allUsers.some(u => u.roles?.includes("admin"));
|
|
217
222
|
|
|
218
223
|
const handleBootstrap = async () => {
|
|
219
224
|
if (!bootstrapAdmin) return;
|
|
@@ -394,9 +399,10 @@ roles: ["w-16", "w-16"] }
|
|
|
394
399
|
</Tooltip>
|
|
395
400
|
)}
|
|
396
401
|
{deleteUser && (
|
|
397
|
-
<Tooltip asChild title={t("delete_this_user")}>
|
|
402
|
+
<Tooltip asChild title={loggedInUser?.uid === user.uid ? (t("cannot_delete_own_account") || "Cannot delete your own account") : t("delete_this_user")}>
|
|
398
403
|
<IconButton
|
|
399
404
|
size="small"
|
|
405
|
+
disabled={loggedInUser?.uid === user.uid}
|
|
400
406
|
onClick={(e) => {
|
|
401
407
|
e.stopPropagation();
|
|
402
408
|
setUserToDelete(user);
|
|
@@ -13,6 +13,7 @@ export function Drawer({
|
|
|
13
13
|
title,
|
|
14
14
|
logo,
|
|
15
15
|
logoDestination,
|
|
16
|
+
footerActions,
|
|
16
17
|
className,
|
|
17
18
|
style
|
|
18
19
|
}: {
|
|
@@ -20,10 +21,17 @@ export function Drawer({
|
|
|
20
21
|
title?: React.ReactNode,
|
|
21
22
|
logo?: string,
|
|
22
23
|
logoDestination?: string,
|
|
24
|
+
/**
|
|
25
|
+
* Custom content for the drawer footer actions area (language, theme, user menu).
|
|
26
|
+
* - `undefined` — renders the default `DrawerFooterActions`.
|
|
27
|
+
* - `null` — renders nothing (hides the footer actions).
|
|
28
|
+
* - `ReactNode` — renders the provided custom content.
|
|
29
|
+
*/
|
|
30
|
+
footerActions?: React.ReactNode | null,
|
|
23
31
|
className?: string,
|
|
24
32
|
style?: React.CSSProperties
|
|
25
33
|
}) {
|
|
26
|
-
const usedChildren = children ?? <DefaultDrawer title={title} logo={logo} logoDestination={logoDestination} className={className} style={style}/>;
|
|
34
|
+
const usedChildren = children ?? <DefaultDrawer title={title} logo={logo} logoDestination={logoDestination} footerActions={footerActions} className={className} style={style}/>;
|
|
27
35
|
return <>{usedChildren}</>;
|
|
28
36
|
}
|
|
29
37
|
|
|
@@ -74,7 +74,11 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
74
74
|
const [onHover, setOnHover] = React.useState(false);
|
|
75
75
|
|
|
76
76
|
const setOnHoverTrue = useCallback(() => setOnHover(true), []);
|
|
77
|
-
const setOnHoverFalse = useCallback(() =>
|
|
77
|
+
const setOnHoverFalse = useCallback(() => {
|
|
78
|
+
// Don't collapse the drawer while a popover/dropdown is open
|
|
79
|
+
if (document.querySelector("[data-radix-popper-content-wrapper]")) return;
|
|
80
|
+
setOnHover(false);
|
|
81
|
+
}, []);
|
|
78
82
|
|
|
79
83
|
const handleDrawerOpen = useCallback(() => {
|
|
80
84
|
setDrawerOpen(true);
|
|
@@ -8,7 +8,7 @@ interface Header {
|
|
|
8
8
|
|
|
9
9
|
export interface DownloadEntitiesExportParams<M extends Record<string, unknown>> {
|
|
10
10
|
data: Entity<M>[];
|
|
11
|
-
additionalData: Record<string,
|
|
11
|
+
additionalData: Record<string, unknown>[] | undefined;
|
|
12
12
|
properties: Properties;
|
|
13
13
|
propertiesOrder: string[] | undefined;
|
|
14
14
|
name: string;
|
|
@@ -52,14 +52,14 @@ export function downloadEntitiesExport<M extends Record<string, unknown>>({
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export function getEntityCSVExportableData(data: Entity<
|
|
56
|
-
additionalData: Record<string,
|
|
55
|
+
export function getEntityCSVExportableData(data: Entity<Record<string, unknown>>[],
|
|
56
|
+
additionalData: Record<string, unknown>[] | undefined,
|
|
57
57
|
properties: Properties,
|
|
58
58
|
headers: Header[],
|
|
59
59
|
dateExportType: "timestamp" | "string"
|
|
60
60
|
) {
|
|
61
61
|
|
|
62
|
-
const mergedData:
|
|
62
|
+
const mergedData: Record<string, unknown>[] = data.map(e => ({
|
|
63
63
|
id: e.id,
|
|
64
64
|
...processValuesForExport(e.values, properties, "csv", dateExportType)
|
|
65
65
|
}));
|
|
@@ -76,13 +76,13 @@ export function getEntityCSVExportableData(data: Entity<any>[],
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export function getEntityJsonExportableData(data: Entity<
|
|
80
|
-
additionalData: Record<string,
|
|
79
|
+
export function getEntityJsonExportableData(data: Entity<Record<string, unknown>>[],
|
|
80
|
+
additionalData: Record<string, unknown>[] | undefined,
|
|
81
81
|
properties: Properties,
|
|
82
82
|
dateExportType: "timestamp" | "string"
|
|
83
83
|
) {
|
|
84
84
|
|
|
85
|
-
const mergedData:
|
|
85
|
+
const mergedData: Record<string, unknown>[] = data.map(e => ({
|
|
86
86
|
id: e.id,
|
|
87
87
|
...processValuesForExport(e.values, properties, "json", dateExportType)
|
|
88
88
|
}));
|
|
@@ -154,15 +154,15 @@ function getHeaders(property: Property, propertyKey: string, prefix = ""): Heade
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
function processValueForExport(inputValue:
|
|
157
|
+
function processValueForExport(inputValue: unknown,
|
|
158
158
|
property: Property,
|
|
159
159
|
exportType: "csv" | "json",
|
|
160
160
|
dateExportType: "timestamp" | "string"
|
|
161
|
-
):
|
|
161
|
+
): unknown {
|
|
162
162
|
|
|
163
|
-
let value;
|
|
163
|
+
let value: unknown;
|
|
164
164
|
if (property.type === "map" && property.properties) {
|
|
165
|
-
value = processValuesForExport(inputValue, property.properties as Properties, exportType, dateExportType);
|
|
165
|
+
value = processValuesForExport(inputValue as Record<string, unknown>, property.properties as Properties, exportType, dateExportType);
|
|
166
166
|
} else if (property.type === "array") {
|
|
167
167
|
if (property.of && Array.isArray(inputValue)) {
|
|
168
168
|
if (Array.isArray(property.of)) {
|
|
@@ -178,7 +178,7 @@ function processValueForExport(inputValue: any,
|
|
|
178
178
|
} else {
|
|
179
179
|
value = inputValue;
|
|
180
180
|
}
|
|
181
|
-
} else if (property.type === "reference" && inputValue && inputValue.isEntityReference && inputValue.isEntityReference()) {
|
|
181
|
+
} else if (property.type === "reference" && inputValue && typeof inputValue === "object" && "isEntityReference" in inputValue && typeof (inputValue as EntityReference).isEntityReference === "function" && (inputValue as EntityReference).isEntityReference()) {
|
|
182
182
|
const ref = inputValue ? inputValue as EntityReference : undefined;
|
|
183
183
|
value = ref ? ref.fullPath : null;
|
|
184
184
|
} else if (property.type === "date" && inputValue instanceof Date) {
|
|
@@ -191,11 +191,11 @@ function processValueForExport(inputValue: any,
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
function processValuesForExport<M extends Record<string, unknown>>
|
|
194
|
-
(inputValues: Record<
|
|
194
|
+
(inputValues: Record<string, unknown>,
|
|
195
195
|
properties: Properties,
|
|
196
196
|
exportType: "csv" | "json",
|
|
197
197
|
dateExportType: "timestamp" | "string"
|
|
198
|
-
): Record<
|
|
198
|
+
): Record<string, unknown> {
|
|
199
199
|
const updatedValues = Object.entries(properties)
|
|
200
200
|
.map(([key, property]) => {
|
|
201
201
|
const inputValue = inputValues && (inputValues)[key];
|
|
@@ -204,14 +204,14 @@ function processValuesForExport<M extends Record<string, unknown>>
|
|
|
204
204
|
return ({ [key]: updatedValue });
|
|
205
205
|
})
|
|
206
206
|
.reduce((a, b) => ({ ...a,
|
|
207
|
-
...b }), {}) as Record<
|
|
207
|
+
...b }), {}) as Record<string, unknown>;
|
|
208
208
|
return { ...inputValues,
|
|
209
209
|
...updatedValues };
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
function entryToCSVRow(entry:
|
|
212
|
+
function entryToCSVRow(entry: unknown[]) {
|
|
213
213
|
return entry
|
|
214
|
-
.map((v:
|
|
214
|
+
.map((v: unknown) => {
|
|
215
215
|
if (v === null || v === undefined) return "";
|
|
216
216
|
if (Array.isArray(v))
|
|
217
217
|
return "\"" + JSON.stringify(v).replaceAll("\"", "\"\"") + "\"";
|
|
@@ -143,7 +143,7 @@ export function DataNewPropertiesMapping({
|
|
|
143
143
|
defaultValue={getIn(importConfig.defaultValues, key)}
|
|
144
144
|
onValueChange={(value) => {
|
|
145
145
|
const newValues = setIn(importConfig.defaultValues, key, value);
|
|
146
|
-
importConfig.setDefaultValues(newValues);
|
|
146
|
+
importConfig.setDefaultValues(newValues as Record<string, any>);
|
|
147
147
|
}}/>
|
|
148
148
|
</TableCell>
|
|
149
149
|
</TableRow>;
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { useProseMirrorContext } from "../hooks/useProseMirrorContext";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
autoUpdate,
|
|
5
|
+
computePosition,
|
|
6
|
+
flip,
|
|
7
|
+
offset,
|
|
8
|
+
shift,
|
|
9
|
+
type VirtualElement,
|
|
10
|
+
type Placement
|
|
11
|
+
} from "@floating-ui/dom";
|
|
4
12
|
import { NodeSelection } from "prosemirror-state";
|
|
5
13
|
|
|
6
14
|
export interface EditorBubbleProps {
|
|
7
15
|
children: ReactNode;
|
|
8
|
-
options?:
|
|
16
|
+
options?: { placement?: Placement; offset?: number };
|
|
9
17
|
className?: string;
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
export const EditorBubble = forwardRef<HTMLDivElement, EditorBubbleProps>(
|
|
13
|
-
({
|
|
14
|
-
|
|
21
|
+
({
|
|
22
|
+
children,
|
|
23
|
+
options,
|
|
24
|
+
className
|
|
25
|
+
}, ref) => {
|
|
26
|
+
const {
|
|
27
|
+
view,
|
|
28
|
+
state
|
|
29
|
+
} = useProseMirrorContext();
|
|
15
30
|
const menuRef = useRef<HTMLDivElement>(null);
|
|
16
31
|
const [show, setShow] = useState(false);
|
|
17
32
|
|
|
@@ -43,7 +58,10 @@ export const EditorBubble = forwardRef<HTMLDivElement, EditorBubbleProps>(
|
|
|
43
58
|
useEffect(() => {
|
|
44
59
|
if (!show || !view || !state || !menuRef.current) return;
|
|
45
60
|
|
|
46
|
-
const {
|
|
61
|
+
const {
|
|
62
|
+
from,
|
|
63
|
+
to
|
|
64
|
+
} = state.selection;
|
|
47
65
|
|
|
48
66
|
// Fallback for end selection coords
|
|
49
67
|
let start = view.coordsAtPos(from);
|
|
@@ -83,7 +101,10 @@ export const EditorBubble = forwardRef<HTMLDivElement, EditorBubbleProps>(
|
|
|
83
101
|
placement: options?.placement || "top",
|
|
84
102
|
middleware: [offset(options?.offset || 8), flip(), shift()],
|
|
85
103
|
strategy: "fixed"
|
|
86
|
-
}).then(({
|
|
104
|
+
}).then(({
|
|
105
|
+
x,
|
|
106
|
+
y
|
|
107
|
+
}) => {
|
|
87
108
|
if (menuRef.current) {
|
|
88
109
|
Object.assign(menuRef.current.style, {
|
|
89
110
|
left: `${x}px`,
|
|
@@ -102,9 +123,11 @@ export const EditorBubble = forwardRef<HTMLDivElement, EditorBubbleProps>(
|
|
|
102
123
|
<div
|
|
103
124
|
ref={menuRef}
|
|
104
125
|
className={className}
|
|
105
|
-
style={{
|
|
106
|
-
|
|
107
|
-
|
|
126
|
+
style={{
|
|
127
|
+
position: "fixed",
|
|
128
|
+
zIndex: 9999,
|
|
129
|
+
visibility: "hidden"
|
|
130
|
+
}}
|
|
108
131
|
onMouseDown={(e) => {
|
|
109
132
|
e.preventDefault(); // Don't lose focus inside ProseMirror
|
|
110
133
|
}}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { useProseMirrorContext } from "../hooks/useProseMirrorContext";
|
|
3
|
-
import { autoUpdate, computePosition, flip, offset, shift, type VirtualElement } from "@floating-ui/dom";
|
|
3
|
+
import { autoUpdate, computePosition, flip, offset, shift, type VirtualElement, type Placement } from "@floating-ui/dom";
|
|
4
4
|
import { NodeSelection } from "prosemirror-state";
|
|
5
5
|
import { TextField, defaultBorderMixin, Typography, cls } from "@rebasepro/ui";
|
|
6
6
|
import { useTranslation } from "@rebasepro/core";
|
|
7
7
|
|
|
8
8
|
export interface ImageBubbleProps {
|
|
9
|
-
options?:
|
|
9
|
+
options?: { placement?: Placement; offset?: number };
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const ImageBubble = forwardRef<HTMLDivElement, ImageBubbleProps>(
|
|
14
|
-
({
|
|
15
|
-
|
|
14
|
+
({
|
|
15
|
+
options,
|
|
16
|
+
className
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const {
|
|
19
|
+
view,
|
|
20
|
+
state
|
|
21
|
+
} = useProseMirrorContext();
|
|
16
22
|
const { t } = useTranslation();
|
|
17
23
|
const menuRef = useRef<HTMLDivElement>(null);
|
|
18
24
|
const [show, setShow] = useState(false);
|
|
@@ -23,8 +29,10 @@ export const ImageBubble = forwardRef<HTMLDivElement, ImageBubbleProps>(
|
|
|
23
29
|
useEffect(() => {
|
|
24
30
|
if (!view) return;
|
|
25
31
|
const handleContextMenu = (e: MouseEvent) => {
|
|
26
|
-
const posInfo = view.posAtCoords({
|
|
27
|
-
|
|
32
|
+
const posInfo = view.posAtCoords({
|
|
33
|
+
left: e.clientX,
|
|
34
|
+
top: e.clientY
|
|
35
|
+
});
|
|
28
36
|
if (posInfo && posInfo.inside >= 0) {
|
|
29
37
|
const node = view.state.doc.nodeAt(posInfo.inside);
|
|
30
38
|
if (node && node.type.name === "image") {
|
|
@@ -56,7 +64,10 @@ top: e.clientY });
|
|
|
56
64
|
useEffect(() => {
|
|
57
65
|
if (!show || !view || !state || !menuRef.current) return;
|
|
58
66
|
|
|
59
|
-
const {
|
|
67
|
+
const {
|
|
68
|
+
from,
|
|
69
|
+
to
|
|
70
|
+
} = state.selection;
|
|
60
71
|
let start = view.coordsAtPos(from);
|
|
61
72
|
let end = view.coordsAtPos(to);
|
|
62
73
|
|
|
@@ -92,7 +103,10 @@ top: e.clientY });
|
|
|
92
103
|
placement: options?.placement || "bottom",
|
|
93
104
|
middleware: [offset(options?.offset || 8), flip(), shift()],
|
|
94
105
|
strategy: "fixed"
|
|
95
|
-
}).then(({
|
|
106
|
+
}).then(({
|
|
107
|
+
x,
|
|
108
|
+
y
|
|
109
|
+
}) => {
|
|
96
110
|
if (menuRef.current) {
|
|
97
111
|
Object.assign(menuRef.current.style, {
|
|
98
112
|
left: `${x}px`,
|
|
@@ -126,9 +140,11 @@ top: e.clientY });
|
|
|
126
140
|
return (
|
|
127
141
|
<div
|
|
128
142
|
ref={menuRef}
|
|
129
|
-
style={{
|
|
130
|
-
|
|
131
|
-
|
|
143
|
+
style={{
|
|
144
|
+
visibility: "hidden",
|
|
145
|
+
position: "fixed",
|
|
146
|
+
zIndex: 50
|
|
147
|
+
}}
|
|
132
148
|
className={cls("flex flex-col gap-1.5 p-2 w-56 max-w-[90vw] rounded-lg border bg-white dark:bg-surface-800 shadow-lg", defaultBorderMixin, className)}
|
|
133
149
|
onMouseDown={(e) => {
|
|
134
150
|
// Prevent mousedown from stealing focus from inputs
|
|
@@ -6,9 +6,9 @@ export { TableBubble } from "./table-bubble";
|
|
|
6
6
|
|
|
7
7
|
export type JSONContent = {
|
|
8
8
|
type?: string;
|
|
9
|
-
attrs?: Record<string,
|
|
9
|
+
attrs?: Record<string, unknown>;
|
|
10
10
|
content?: JSONContent[];
|
|
11
|
-
marks?: { type: string; attrs?: Record<string,
|
|
11
|
+
marks?: { type: string; attrs?: Record<string, unknown> }[];
|
|
12
12
|
text?: string;
|
|
13
|
-
[key: string]:
|
|
13
|
+
[key: string]: unknown;
|
|
14
14
|
};
|