@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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/admin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"description": "Rebase CMS — content management views, forms, and routing",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -84,13 +84,13 @@
|
|
|
84
84
|
"react-dropzone": "^14.4.1",
|
|
85
85
|
"react-use-measure": "^2.1.7",
|
|
86
86
|
"zod": "^3.25.76",
|
|
87
|
-
"@rebasepro/common": "0.2.
|
|
88
|
-
"@rebasepro/formex": "0.2.
|
|
89
|
-
"@rebasepro/core": "0.2.
|
|
90
|
-
"@rebasepro/schema-inference": "0.2.
|
|
91
|
-
"@rebasepro/
|
|
92
|
-
"@rebasepro/utils": "0.2.
|
|
93
|
-
"@rebasepro/
|
|
87
|
+
"@rebasepro/common": "0.2.4",
|
|
88
|
+
"@rebasepro/formex": "0.2.4",
|
|
89
|
+
"@rebasepro/core": "0.2.4",
|
|
90
|
+
"@rebasepro/schema-inference": "0.2.4",
|
|
91
|
+
"@rebasepro/types": "0.2.4",
|
|
92
|
+
"@rebasepro/utils": "0.2.4",
|
|
93
|
+
"@rebasepro/ui": "0.2.4"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"react": ">=19.0.0",
|
|
@@ -8,7 +8,6 @@ import { useCustomizationController, useRebaseContext, useAuthController, useSna
|
|
|
8
8
|
import { getTableName } from "@rebasepro/common";
|
|
9
9
|
import { useNavigate } from "react-router-dom";
|
|
10
10
|
import { CollectionEditorController } from "./types/collection_editor_controller";
|
|
11
|
-
import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
|
|
12
11
|
import { CollectionInference } from "./types/collection_inference";
|
|
13
12
|
import { CollectionGenerationCallback } from "./api/generateCollectionApi";
|
|
14
13
|
import { CollectionEditorDialogsContext, CollectionEditorDialogsState } from "./CollectionEditorDialogsContext";
|
|
@@ -27,10 +26,7 @@ export interface ConfigControllerProviderProps {
|
|
|
27
26
|
*/
|
|
28
27
|
collectionInference?: CollectionInference;
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
* Use this builder to define the permissions for the configuration per user.
|
|
32
|
-
*/
|
|
33
|
-
configPermissions?: CollectionEditorPermissionsBuilder;
|
|
29
|
+
|
|
34
30
|
|
|
35
31
|
extraView?: {
|
|
36
32
|
View: React.ComponentType<{
|
|
@@ -59,7 +55,6 @@ export const ConfigControllerProvider = React.memo(
|
|
|
59
55
|
function ConfigControllerProvider({
|
|
60
56
|
children,
|
|
61
57
|
collectionConfigController,
|
|
62
|
-
configPermissions,
|
|
63
58
|
collectionInference,
|
|
64
59
|
extraView,
|
|
65
60
|
getUser,
|
|
@@ -123,11 +118,7 @@ export const ConfigControllerProvider = React.memo(
|
|
|
123
118
|
collection?: EntityCollection;
|
|
124
119
|
}>();
|
|
125
120
|
|
|
126
|
-
|
|
127
|
-
createCollections: true,
|
|
128
|
-
editCollections: true,
|
|
129
|
-
deleteCollections: true
|
|
130
|
-
}), []);
|
|
121
|
+
|
|
131
122
|
|
|
132
123
|
const editCollection = useCallback(({
|
|
133
124
|
id,
|
|
@@ -381,10 +372,9 @@ export const ConfigControllerProvider = React.memo(
|
|
|
381
372
|
editCollection,
|
|
382
373
|
createCollection,
|
|
383
374
|
editProperty,
|
|
384
|
-
configPermissions: configPermissions ?? defaultConfigPermissions,
|
|
385
375
|
pathSuggestions,
|
|
386
376
|
configController: collectionConfigController
|
|
387
|
-
}), [editCollection, createCollection, editProperty,
|
|
377
|
+
}), [editCollection, createCollection, editProperty, pathSuggestions, collectionConfigController]);
|
|
388
378
|
|
|
389
379
|
return (
|
|
390
380
|
<ConfigControllerContext.Provider value={collectionConfigController}>
|
|
@@ -30,9 +30,7 @@ export type {
|
|
|
30
30
|
export type {
|
|
31
31
|
CollectionEditorController
|
|
32
32
|
} from "./types/collection_editor_controller";
|
|
33
|
-
|
|
34
|
-
CollectionEditorPermissions, CollectionEditorPermissionsBuilder
|
|
35
|
-
} from "./types/config_permissions";
|
|
33
|
+
|
|
36
34
|
export type {
|
|
37
35
|
CollectionInference
|
|
38
36
|
} from "./types/collection_inference";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
1
|
import { CollectionsConfigController } from "./config_controller";
|
|
3
2
|
import { Entity, EntityCollection, Property } from "@rebasepro/types";
|
|
4
3
|
|
|
@@ -57,8 +56,6 @@ export interface CollectionEditorController {
|
|
|
57
56
|
*/
|
|
58
57
|
configController: CollectionsConfigController;
|
|
59
58
|
|
|
60
|
-
configPermissions: CollectionEditorPermissionsBuilder;
|
|
61
|
-
|
|
62
59
|
pathSuggestions: string[] | undefined;
|
|
63
60
|
|
|
64
61
|
}
|
|
@@ -19,12 +19,7 @@ export function EditorCollectionAction({
|
|
|
19
19
|
|
|
20
20
|
const parentCollection = parentCollectionSlugs.length > 0 ? collectionRegistry.getCollection(parentCollectionSlugs[parentCollectionSlugs.length - 1]) : undefined;
|
|
21
21
|
|
|
22
|
-
const canEditCollection = !collectionEditorController.configController?.readOnly
|
|
23
|
-
? collectionEditorController.configPermissions({
|
|
24
|
-
user: authController.user,
|
|
25
|
-
collection
|
|
26
|
-
}).editCollections
|
|
27
|
-
: true);
|
|
22
|
+
const canEditCollection = !collectionEditorController.configController?.readOnly;
|
|
28
23
|
|
|
29
24
|
const tooltipTitle = collectionEditorController.configController?.readOnly
|
|
30
25
|
? (collectionEditorController.configController.readOnlyReason || t("studio_editor_collection_disabled"))
|
|
@@ -25,12 +25,7 @@ export function EditorCollectionActionStart({
|
|
|
25
25
|
const snackbarController = useSnackbarController();
|
|
26
26
|
const { t } = useTranslation();
|
|
27
27
|
|
|
28
|
-
const canEditCollection =
|
|
29
|
-
? collectionEditorController.configPermissions({
|
|
30
|
-
user: authController.user,
|
|
31
|
-
collection
|
|
32
|
-
}).editCollections
|
|
33
|
-
: true;
|
|
28
|
+
const canEditCollection = !configController.readOnly;
|
|
34
29
|
|
|
35
30
|
let saveDefaultFilterButton = null;
|
|
36
31
|
if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.defaultFilter)) ||
|
|
@@ -19,12 +19,7 @@ export function EditorEntityAction({
|
|
|
19
19
|
|
|
20
20
|
const parentCollection = parentCollectionSlugs.length > 0 ? collectionRegistry.getCollection(parentCollectionSlugs[parentCollectionSlugs.length - 1]) : undefined;
|
|
21
21
|
|
|
22
|
-
const canEditCollection = collectionEditorController.
|
|
23
|
-
? collectionEditorController.configPermissions({
|
|
24
|
-
user: authController.user,
|
|
25
|
-
collection
|
|
26
|
-
}).editCollections
|
|
27
|
-
: true;
|
|
22
|
+
const canEditCollection = !collectionEditorController.configController?.readOnly;
|
|
28
23
|
|
|
29
24
|
const isDirty = formContext?.formex.dirty ?? false;
|
|
30
25
|
|
|
@@ -21,16 +21,9 @@ export function HomePageEditorCollectionAction({
|
|
|
21
21
|
const collectionEditorController = useCollectionEditorController();
|
|
22
22
|
const { t } = useTranslation();
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
collection
|
|
28
|
-
})
|
|
29
|
-
: {
|
|
30
|
-
createCollections: false,
|
|
31
|
-
editCollections: false,
|
|
32
|
-
deleteCollections: false
|
|
33
|
-
};
|
|
24
|
+
const canCreateCollections = !configController.readOnly;
|
|
25
|
+
const canEditCollections = !configController.readOnly;
|
|
26
|
+
const canDeleteCollections = !configController.readOnly;
|
|
34
27
|
|
|
35
28
|
const onEditCollectionClicked = () => {
|
|
36
29
|
collectionEditorController?.editCollection({
|
|
@@ -67,13 +60,13 @@ export function HomePageEditorCollectionAction({
|
|
|
67
60
|
return <>
|
|
68
61
|
|
|
69
62
|
<div>
|
|
70
|
-
{
|
|
63
|
+
{canDeleteCollections &&
|
|
71
64
|
<Menu
|
|
72
65
|
trigger={<IconButton size={"small"}>
|
|
73
66
|
<MoreVerticalIcon/>
|
|
74
67
|
</IconButton>}
|
|
75
68
|
>
|
|
76
|
-
{
|
|
69
|
+
{canCreateCollections &&
|
|
77
70
|
<MenuItem
|
|
78
71
|
dense={true}
|
|
79
72
|
onClick={(event: React.MouseEvent) => {
|
|
@@ -100,11 +93,11 @@ export function HomePageEditorCollectionAction({
|
|
|
100
93
|
|
|
101
94
|
}
|
|
102
95
|
|
|
103
|
-
{
|
|
96
|
+
{canEditCollections &&
|
|
104
97
|
<IconButton
|
|
105
98
|
size={"small"}
|
|
106
99
|
onClick={(event: React.MouseEvent) => {
|
|
107
|
-
|
|
100
|
+
onEditCollectionClicked();
|
|
108
101
|
}}>
|
|
109
102
|
<SettingsIcon/>
|
|
110
103
|
</IconButton>}
|
|
@@ -17,11 +17,7 @@ export function NewCollectionCard({
|
|
|
17
17
|
|
|
18
18
|
if (!context.navigationStateController?.topLevelNavigation)
|
|
19
19
|
return null;
|
|
20
|
-
const canCreateCollections = collectionEditorController
|
|
21
|
-
? collectionEditorController.configPermissions({
|
|
22
|
-
user: authController.user
|
|
23
|
-
}).createCollections
|
|
24
|
-
: true;
|
|
20
|
+
const canCreateCollections = !collectionEditorController?.configController?.readOnly;
|
|
25
21
|
|
|
26
22
|
return (
|
|
27
23
|
<Card className={cls("h-full p-4 min-h-[124px]")}
|
|
@@ -22,12 +22,7 @@ export function PropertyAddColumnComponent({
|
|
|
22
22
|
const authController = useAuthController();
|
|
23
23
|
const collectionEditorController = useCollectionEditorController();
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
-
const canEditCollection = collectionEditorController.
|
|
26
|
-
? collectionEditorController.configPermissions({
|
|
27
|
-
user: authController.user,
|
|
28
|
-
collection
|
|
29
|
-
}).editCollections
|
|
30
|
-
: true;
|
|
25
|
+
const canEditCollection = !collectionEditorController.configController?.readOnly;
|
|
31
26
|
|
|
32
27
|
return (
|
|
33
28
|
<Tooltip
|
|
@@ -36,7 +31,7 @@ export function PropertyAddColumnComponent({
|
|
|
36
31
|
<div
|
|
37
32
|
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-surface-100/40 bg-surface-100/40 hover:bg-surface-100 dark:bg-surface-900 dark:bg-opacity-40 dark:bg-surface-900/40 dark:hover:bg-surface-800"}
|
|
38
33
|
// className={onHover ? "bg-white dark:bg-surface-900" : undefined}
|
|
39
|
-
onClick={() => {
|
|
34
|
+
onClick={canEditCollection ? () => {
|
|
40
35
|
collectionEditorController.editProperty({
|
|
41
36
|
editedCollectionId: collection.slug,
|
|
42
37
|
parentCollectionSlugs, parentEntityIds,
|
|
@@ -44,7 +39,7 @@ export function PropertyAddColumnComponent({
|
|
|
44
39
|
collection,
|
|
45
40
|
existingEntities: tableController.data
|
|
46
41
|
});
|
|
47
|
-
}}>
|
|
42
|
+
} : undefined}>
|
|
48
43
|
<PlusIcon/>
|
|
49
44
|
</div>
|
|
50
45
|
</Tooltip>
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
DialogContent,
|
|
11
11
|
DialogTitle,
|
|
12
12
|
iconSize,
|
|
13
|
+
TextField,
|
|
13
14
|
Typography
|
|
14
15
|
} from "@rebasepro/ui";
|
|
15
16
|
import { EntityCollection } from "@rebasepro/types";
|
|
@@ -52,7 +53,7 @@ export function CollectionJsonImportDialog({
|
|
|
52
53
|
const [errors, setErrors] = useState<CollectionValidationError[]>([]);
|
|
53
54
|
const [touched, setTouched] = useState(false);
|
|
54
55
|
|
|
55
|
-
const handleJsonChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
56
|
+
const handleJsonChange = useCallback((e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
56
57
|
const value = e.target.value;
|
|
57
58
|
setJsonValue(value);
|
|
58
59
|
setTouched(true);
|
|
@@ -105,20 +106,15 @@ export function CollectionJsonImportDialog({
|
|
|
105
106
|
<code className="bg-surface-200 dark:bg-surface-700 px-1 rounded">properties</code>.
|
|
106
107
|
</Typography>
|
|
107
108
|
|
|
108
|
-
<
|
|
109
|
+
<TextField
|
|
110
|
+
multiline
|
|
111
|
+
minRows={12}
|
|
109
112
|
value={jsonValue}
|
|
110
113
|
onChange={handleJsonChange}
|
|
111
114
|
placeholder={EXAMPLE_JSON}
|
|
112
|
-
|
|
113
|
-
className=
|
|
114
|
-
|
|
115
|
-
"bg-surface-50 dark:bg-surface-800",
|
|
116
|
-
"focus:outline-none focus:ring-2 focus:ring-primary",
|
|
117
|
-
"h-[300px]",
|
|
118
|
-
errors.length > 0 && touched
|
|
119
|
-
? "border-red-500 dark:border-red-400"
|
|
120
|
-
: "border-surface-300 dark:border-surface-600"
|
|
121
|
-
)}
|
|
115
|
+
error={errors.length > 0 && touched}
|
|
116
|
+
className="w-full"
|
|
117
|
+
inputClassName="font-mono text-sm resize-none overflow-y-auto h-[300px]"
|
|
122
118
|
/>
|
|
123
119
|
|
|
124
120
|
{errors.length > 0 && touched && (
|
|
@@ -30,15 +30,15 @@ import { GetCodeDialog } from "./GetCodeDialog";
|
|
|
30
30
|
import { useAIModifiedPaths } from "./AIModifiedPathsContext";
|
|
31
31
|
import { useCollectionsConfigController } from "../../useCollectionsConfigController";
|
|
32
32
|
|
|
33
|
-
type PropertyOrBuilder = Property |
|
|
33
|
+
type PropertyOrBuilder = Property | Record<string, unknown>;
|
|
34
34
|
|
|
35
35
|
type CollectionEditorFormProps = {
|
|
36
36
|
showErrors: boolean;
|
|
37
37
|
isNewCollection: boolean;
|
|
38
|
-
propertyErrorsRef?: React.MutableRefObject<
|
|
39
|
-
onPropertyError: (propertyKey: string, namespace: string | undefined, error?: Record<string,
|
|
38
|
+
propertyErrorsRef?: React.MutableRefObject<Record<string, unknown> | undefined>;
|
|
39
|
+
onPropertyError: (propertyKey: string, namespace: string | undefined, error?: Record<string, unknown>) => void;
|
|
40
40
|
setDirty?: (dirty: boolean) => void;
|
|
41
|
-
extraIcon: React.ReactNode
|
|
41
|
+
extraIcon: React.ReactNode;
|
|
42
42
|
getUser?: (uid: string) => User | null;
|
|
43
43
|
getData?: () => Promise<object[]>;
|
|
44
44
|
doCollectionInference?: (collection: EntityCollection) => Promise<Partial<EntityCollection> | null> | undefined;
|
|
@@ -138,16 +138,16 @@ export function CollectionPropertiesEditorForm({
|
|
|
138
138
|
} else if (
|
|
139
139
|
typeof newProp === "object" &&
|
|
140
140
|
"type" in newProp &&
|
|
141
|
-
newProp.
|
|
142
|
-
newProp.properties
|
|
141
|
+
(newProp as MapProperty).type === "map" &&
|
|
142
|
+
(newProp as MapProperty).properties
|
|
143
143
|
) {
|
|
144
144
|
// This is a map property, check for new nested properties
|
|
145
145
|
const existingMapProps = typeof existingProp === "object" &&
|
|
146
146
|
"type" in existingProp &&
|
|
147
|
-
existingProp.
|
|
147
|
+
(existingProp as MapProperty).type === "map"
|
|
148
148
|
? (existingProp as MapProperty).properties
|
|
149
149
|
: undefined;
|
|
150
|
-
keys.push(...findNewPropertyKeys(existingMapProps, newProp.properties as Record<string, PropertyOrBuilder>, fullKey));
|
|
150
|
+
keys.push(...findNewPropertyKeys(existingMapProps, (newProp as MapProperty).properties as Record<string, PropertyOrBuilder>, fullKey));
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
return keys;
|
|
@@ -174,11 +174,11 @@ export function CollectionPropertiesEditorForm({
|
|
|
174
174
|
} else if (
|
|
175
175
|
typeof existingProp === "object" &&
|
|
176
176
|
"type" in existingProp &&
|
|
177
|
-
existingProp.
|
|
177
|
+
(existingProp as MapProperty).type === "map" &&
|
|
178
178
|
typeof newProp === "object" &&
|
|
179
179
|
"type" in newProp &&
|
|
180
|
-
newProp.
|
|
181
|
-
newProp.properties
|
|
180
|
+
(newProp as MapProperty).type === "map" &&
|
|
181
|
+
(newProp as MapProperty).properties
|
|
182
182
|
) {
|
|
183
183
|
// Both are map properties, recursively add new nested properties
|
|
184
184
|
// Only if the existing map has properties, merge them; otherwise keep existing as-is
|
|
@@ -188,9 +188,9 @@ export function CollectionPropertiesEditorForm({
|
|
|
188
188
|
...existingProp,
|
|
189
189
|
properties: addNewPropertiesOnly(
|
|
190
190
|
existingMapProps,
|
|
191
|
-
newProp.properties as Record<string, PropertyOrBuilder>
|
|
192
|
-
)
|
|
193
|
-
};
|
|
191
|
+
(newProp as MapProperty).properties as Record<string, PropertyOrBuilder>
|
|
192
|
+
) as Properties
|
|
193
|
+
} as MapProperty;
|
|
194
194
|
}
|
|
195
195
|
// If existingProp doesn't have properties, keep it as-is (don't overwrite with inferred)
|
|
196
196
|
}
|
|
@@ -354,7 +354,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
354
354
|
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
-
const onPropertyErrorInternal = (id: string, namespace?: string, error?: Record<string,
|
|
357
|
+
const onPropertyErrorInternal = (id: string, namespace?: string, error?: Record<string, unknown>) => {
|
|
358
358
|
const propertyPath = id ? getFullId(id, namespace) : undefined;
|
|
359
359
|
console.debug("onPropertyErrorInternal", {
|
|
360
360
|
id,
|
|
@@ -374,7 +374,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
374
374
|
setSelectedPropertyKey(undefined);
|
|
375
375
|
};
|
|
376
376
|
|
|
377
|
-
const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? propertyErrorsRef.current.properties[selectedPropertyKey] : undefined;
|
|
377
|
+
const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? (propertyErrorsRef.current.properties as Record<string, unknown>)[selectedPropertyKey] as Record<string, any> | undefined : undefined;
|
|
378
378
|
|
|
379
379
|
const emptyCollection = (values?.propertiesOrder === undefined || values.propertiesOrder.length === 0)
|
|
380
380
|
&& (!values?.properties || Object.keys(values.properties).length === 0);
|
|
@@ -496,8 +496,8 @@ export function CollectionPropertiesEditorForm({
|
|
|
496
496
|
className="sticky top-8 min-h-full w-full flex flex-col justify-center">
|
|
497
497
|
|
|
498
498
|
{selectedPropertyFullId &&
|
|
499
|
-
selectedProperty &&
|
|
500
|
-
!isPropertyBuilder(selectedProperty) &&
|
|
499
|
+
!!selectedProperty &&
|
|
500
|
+
!isPropertyBuilder(selectedProperty as Property) &&
|
|
501
501
|
<PropertyForm
|
|
502
502
|
inArray={false}
|
|
503
503
|
key={`edit_view_${selectedPropertyIndex}_${generationCounter}`}
|
|
@@ -507,7 +507,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
507
507
|
autoOpenTypeSelect={false}
|
|
508
508
|
propertyKey={selectedPropertyKey}
|
|
509
509
|
propertyNamespace={selectedPropertyNamespace}
|
|
510
|
-
property={selectedProperty}
|
|
510
|
+
property={selectedProperty as Property}
|
|
511
511
|
onPropertyChanged={onPropertyChanged}
|
|
512
512
|
onDelete={deleteProperty}
|
|
513
513
|
onError={onPropertyErrorInternal}
|
|
@@ -534,7 +534,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
534
534
|
</Button>
|
|
535
535
|
</div>}
|
|
536
536
|
|
|
537
|
-
{selectedProperty && isPropertyBuilder(selectedProperty) &&
|
|
537
|
+
{!!selectedProperty && isPropertyBuilder(selectedProperty as Property) &&
|
|
538
538
|
<Typography variant={"label"} className="flex items-center justify-center">
|
|
539
539
|
{"This property is defined as a property builder in code"}
|
|
540
540
|
</Typography>}
|
|
@@ -551,7 +551,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
551
551
|
autoOpenTypeSelect={false}
|
|
552
552
|
propertyKey={selectedPropertyKey}
|
|
553
553
|
propertyNamespace={selectedPropertyNamespace}
|
|
554
|
-
property={selectedProperty}
|
|
554
|
+
property={selectedProperty as Property | undefined}
|
|
555
555
|
onPropertyChanged={onPropertyChanged}
|
|
556
556
|
onDelete={deleteProperty}
|
|
557
557
|
onError={onPropertyErrorInternal}
|
|
@@ -102,7 +102,7 @@ export function CollectionRLSTab() {
|
|
|
102
102
|
return [];
|
|
103
103
|
};
|
|
104
104
|
const pRows = extractRows(result);
|
|
105
|
-
const policies: PostgresPolicy[] = pRows.map((p:
|
|
105
|
+
const policies: PostgresPolicy[] = pRows.map((p: Record<string, unknown>) => {
|
|
106
106
|
let parsedRoles: string[] = [];
|
|
107
107
|
const r = p.roles || p.ROLES;
|
|
108
108
|
if (Array.isArray(r)) {
|
|
@@ -313,7 +313,7 @@ function InlinePolicyEditor({
|
|
|
313
313
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
314
314
|
<div className="flex flex-col gap-1.5">
|
|
315
315
|
<Typography variant="caption" className="uppercase tracking-wider text-text-secondary">Policy Name</Typography>
|
|
316
|
-
<TextField value={name} onChange={(e:
|
|
316
|
+
<TextField value={name} onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setName(e.target.value)} placeholder="e.g. allow_read_all"/>
|
|
317
317
|
</div>
|
|
318
318
|
<div className="flex flex-col gap-1.5">
|
|
319
319
|
<Typography variant="caption" className="uppercase tracking-wider text-text-secondary">Behavior</Typography>
|
|
@@ -342,13 +342,13 @@ function InlinePolicyEditor({
|
|
|
342
342
|
{command !== "INSERT" && (
|
|
343
343
|
<div className="flex flex-col gap-1.5">
|
|
344
344
|
<Typography variant="caption" className="uppercase tracking-wider text-text-secondary">USING expression</Typography>
|
|
345
|
-
<TextField value={usingExpr} onChange={(e:
|
|
345
|
+
<TextField value={usingExpr} onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setUsingExpr(e.target.value)} placeholder="e.g. auth.uid() = user_id"/>
|
|
346
346
|
</div>
|
|
347
347
|
)}
|
|
348
348
|
{showCheck && (
|
|
349
349
|
<div className="flex flex-col gap-1.5">
|
|
350
350
|
<Typography variant="caption" className="uppercase tracking-wider text-text-secondary">WITH CHECK expression</Typography>
|
|
351
|
-
<TextField value={checkExpr} onChange={(e:
|
|
351
|
+
<TextField value={checkExpr} onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setCheckExpr(e.target.value)} placeholder="e.g. auth.uid() = user_id"/>
|
|
352
352
|
</div>
|
|
353
353
|
)}
|
|
354
354
|
</Paper>
|
|
@@ -335,7 +335,7 @@ function EnumEntryDialog({
|
|
|
335
335
|
errors
|
|
336
336
|
} = useFormex<EnumValues>();
|
|
337
337
|
|
|
338
|
-
const idError = index !== undefined ? getIn(errors, `${enumValuesPath}[${index}].id`) : undefined;
|
|
338
|
+
const idError = index !== undefined ? getIn(errors, `${enumValuesPath}[${index}].id`) as string | undefined : undefined;
|
|
339
339
|
return <Dialog
|
|
340
340
|
maxWidth="md"
|
|
341
341
|
aria-labelledby="enum-edit-dialog"
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
namespaceToPropertiesPath
|
|
11
11
|
} from "../util";
|
|
12
12
|
import { PropertyTree } from "../PropertyTree";
|
|
13
|
-
import { ArrayProperty, PropertyConfig } from "@rebasepro/types";
|
|
13
|
+
import { ArrayProperty, PropertyConfig, Property } from "@rebasepro/types";
|
|
14
14
|
|
|
15
15
|
export function BlockPropertyField({
|
|
16
16
|
disabled,
|
|
@@ -59,7 +59,7 @@ export function BlockPropertyField({
|
|
|
59
59
|
|
|
60
60
|
setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, undefined, false);
|
|
61
61
|
const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;
|
|
62
|
-
const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));
|
|
62
|
+
const currentPropertiesOrder: string[] = (getIn(values, propertiesOrderPath) as string[] | undefined) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)) as object ?? {});
|
|
63
63
|
setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);
|
|
64
64
|
|
|
65
65
|
setPropertyDialogOpen(false);
|
|
@@ -134,7 +134,7 @@ export function BlockPropertyField({
|
|
|
134
134
|
onDelete={deleteProperty}
|
|
135
135
|
propertyKey={selectedPropertyKey}
|
|
136
136
|
propertyNamespace={selectedPropertyNamespace}
|
|
137
|
-
property={selectedProperty}
|
|
137
|
+
property={selectedProperty as Property | undefined}
|
|
138
138
|
existingProperty={Boolean(selectedPropertyKey)}
|
|
139
139
|
autoUpdateId={!selectedPropertyKey}
|
|
140
140
|
autoOpenTypeSelect={!selectedPropertyKey}
|
|
@@ -35,13 +35,13 @@ export const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPrope
|
|
|
35
35
|
const { t } = useTranslation();
|
|
36
36
|
|
|
37
37
|
const name = "name";
|
|
38
|
-
const nameError = showErrors && getIn(errors, name);
|
|
38
|
+
const nameError = showErrors && (getIn(errors, name) as string | undefined);
|
|
39
39
|
|
|
40
40
|
const id = "id";
|
|
41
|
-
const idError = showErrors && getIn(errors, id);
|
|
41
|
+
const idError = showErrors && (getIn(errors, id) as string | undefined);
|
|
42
42
|
|
|
43
43
|
const description = "description";
|
|
44
|
-
const descriptionError = showErrors && getIn(errors, description);
|
|
44
|
+
const descriptionError = showErrors && (getIn(errors, description) as string | undefined);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<div className={"flex flex-col gap-2 col-span-12"}>
|
|
@@ -117,20 +117,20 @@ export function DateTimePropertyField({ disabled }: {
|
|
|
117
117
|
const { t } = useTranslation();
|
|
118
118
|
|
|
119
119
|
const modePath = "mode";
|
|
120
|
-
const modeValue: string | undefined = getIn(values, modePath);
|
|
121
|
-
const modeError: string | undefined = getIn(touched, modePath) && getIn(errors, modePath);
|
|
120
|
+
const modeValue: string | undefined = getIn(values, modePath) as string | undefined;
|
|
121
|
+
const modeError: string | undefined = (getIn(touched, modePath) && getIn(errors, modePath)) as string | undefined;
|
|
122
122
|
|
|
123
123
|
const autoValuePath = "autoValue";
|
|
124
|
-
const autoValueValue: string | undefined = getIn(values, autoValuePath);
|
|
125
|
-
const autoValueError: string | undefined = getIn(touched, autoValuePath) && getIn(errors, autoValuePath);
|
|
124
|
+
const autoValueValue: string | undefined = getIn(values, autoValuePath) as string | undefined;
|
|
125
|
+
const autoValueError: string | undefined = (getIn(touched, autoValuePath) && getIn(errors, autoValuePath)) as string | undefined;
|
|
126
126
|
|
|
127
127
|
const timezonePath = "timezone";
|
|
128
|
-
const timezoneValue: string | undefined = getIn(values, timezonePath);
|
|
129
|
-
const timezoneError: string | undefined = getIn(touched, timezonePath) && getIn(errors, timezonePath);
|
|
128
|
+
const timezoneValue: string | undefined = getIn(values, timezonePath) as string | undefined;
|
|
129
|
+
const timezoneError: string | undefined = (getIn(touched, timezonePath) && getIn(errors, timezonePath)) as string | undefined;
|
|
130
130
|
|
|
131
131
|
const columnTypePath = "columnType";
|
|
132
|
-
const columnTypeValue: string | undefined = getIn(values, columnTypePath);
|
|
133
|
-
const columnTypeError: string | undefined = getIn(touched, columnTypePath) && getIn(errors, columnTypePath);
|
|
132
|
+
const columnTypeValue: string | undefined = getIn(values, columnTypePath) as string | undefined;
|
|
133
|
+
const columnTypeError: string | undefined = (getIn(touched, columnTypePath) && getIn(errors, columnTypePath)) as string | undefined;
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
136
|
<>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { getIn, useFormex } from "@rebasepro/formex";
|
|
3
3
|
import { useSnackbarController, useTranslation } from "@rebasepro/core";
|
|
4
|
-
import { EnumValueConfig } from "@rebasepro/types";
|
|
4
|
+
import { EnumValueConfig, EnumValues } from "@rebasepro/types";
|
|
5
5
|
import { resolveEnumValues } from "@rebasepro/common";
|
|
6
6
|
import { Select, SelectItem } from "@rebasepro/ui";
|
|
7
7
|
import { EnumForm } from "../EnumForm";
|
|
@@ -39,9 +39,9 @@ export function EnumPropertyField({
|
|
|
39
39
|
|
|
40
40
|
const enumValuesPath = multiselect ? "of.enum" : "enum";
|
|
41
41
|
|
|
42
|
-
const defaultValue = getIn(values, "defaultValue");
|
|
42
|
+
const defaultValue = getIn(values, "defaultValue") as string | number | undefined;
|
|
43
43
|
|
|
44
|
-
const valuesEnumValues = getIn(values, enumValuesPath);
|
|
44
|
+
const valuesEnumValues = getIn(values, enumValuesPath) as EnumValues | undefined;
|
|
45
45
|
const enumValues: EnumValueConfig[] = useMemo(() => {
|
|
46
46
|
if (!valuesEnumValues || typeof valuesEnumValues === "boolean")
|
|
47
47
|
return [] as EnumValueConfig[];
|
|
@@ -81,7 +81,7 @@ export function EnumPropertyField({
|
|
|
81
81
|
}}
|
|
82
82
|
getData={getData && fullPropertyPath
|
|
83
83
|
? () => getData()
|
|
84
|
-
.then(res => res.map(entry => getIn(entry, fullPropertyPath)).filter(Boolean))
|
|
84
|
+
.then(res => res.map(entry => getIn(entry, fullPropertyPath) as string).filter(Boolean))
|
|
85
85
|
: undefined}
|
|
86
86
|
onValuesChanged={onValuesChanged}/>
|
|
87
87
|
</div>
|
|
@@ -108,7 +108,7 @@ export function EnumPropertyField({
|
|
|
108
108
|
setFieldValue("defaultValue", value);
|
|
109
109
|
}}
|
|
110
110
|
label={t("default_value")}
|
|
111
|
-
value={defaultValue ?? ""}>
|
|
111
|
+
value={defaultValue?.toString() ?? ""}>
|
|
112
112
|
{enumValues
|
|
113
113
|
.filter((enumValue) => Boolean(enumValue?.id))
|
|
114
114
|
.map((enumValue) => (
|
|
@@ -53,7 +53,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
|
|
|
53
53
|
const propertiesPath = idToPropertiesPath(fullId);
|
|
54
54
|
const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);
|
|
55
55
|
|
|
56
|
-
const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));
|
|
56
|
+
const currentPropertiesOrder: string[] = (getIn(values, propertiesOrderPath) as string[] | undefined) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)) as object ?? {});
|
|
57
57
|
|
|
58
58
|
setFieldValue(propertiesPath, undefined, false);
|
|
59
59
|
setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);
|
|
@@ -139,7 +139,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
|
|
|
139
139
|
onDelete={deleteProperty}
|
|
140
140
|
propertyKey={selectedPropertyKey}
|
|
141
141
|
propertyNamespace={selectedPropertyNamespace}
|
|
142
|
-
property={selectedProperty}
|
|
142
|
+
property={selectedProperty as Property | undefined}
|
|
143
143
|
existingProperty={Boolean(selectedPropertyKey)}
|
|
144
144
|
autoUpdateId={!selectedPropertyKey}
|
|
145
145
|
autoOpenTypeSelect={!selectedPropertyKey}
|
|
@@ -41,15 +41,15 @@ export function MarkdownPropertyField({
|
|
|
41
41
|
const htmlPath = `${baseMarkdownPath}.html`;
|
|
42
42
|
const transformPastedTextPath = `${baseMarkdownPath}.transformPastedText`;
|
|
43
43
|
|
|
44
|
-
const fileNameValue = getIn(values, fileName) ?? "{rand}_{file}";
|
|
45
|
-
const storagePathValue = getIn(values, storagePath) ?? "/";
|
|
44
|
+
const fileNameValue = (getIn(values, fileName) as string | undefined) ?? "{rand}_{file}";
|
|
45
|
+
const storagePathValue = (getIn(values, storagePath) as string | undefined) ?? "/";
|
|
46
46
|
const maxSizeValue = getIn(values, maxSize);
|
|
47
47
|
|
|
48
48
|
// Markdown config values - check if markdown is an object or boolean
|
|
49
49
|
const markdownValue = getIn(values, "markdown");
|
|
50
50
|
const isMarkdownObject = typeof markdownValue === "object" && markdownValue !== null;
|
|
51
|
-
const htmlValue = isMarkdownObject ? (markdownValue.html ?? true) : true;
|
|
52
|
-
const transformPastedTextValue = isMarkdownObject ? (markdownValue.transformPastedText ?? false) : false;
|
|
51
|
+
const htmlValue = isMarkdownObject ? (((markdownValue as Record<string, unknown>).html as boolean | undefined) ?? true) : true;
|
|
52
|
+
const transformPastedTextValue = isMarkdownObject ? (((markdownValue as Record<string, unknown>).transformPastedText as boolean | undefined) ?? false) : false;
|
|
53
53
|
|
|
54
54
|
const hasFilenameCallback = typeof fileNameValue === "function";
|
|
55
55
|
const hasStoragePathCallback = typeof storagePathValue === "function";
|
|
@@ -209,7 +209,7 @@ export function MarkdownPropertyField({
|
|
|
209
209
|
setFieldValue("defaultValue", e.target.value === "" ? undefined : e.target.value);
|
|
210
210
|
}}
|
|
211
211
|
label={t("default_value")}
|
|
212
|
-
value={getIn(values, "defaultValue") ?? ""}/>
|
|
212
|
+
value={(getIn(values, "defaultValue") as string | undefined) ?? ""}/>
|
|
213
213
|
|
|
214
214
|
</div>
|
|
215
215
|
</>
|