@rebasepro/admin 0.1.2 → 0.2.3
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 -6
- package/dist/{CollectionEditorDialog-ywdxhs1L.js → CollectionEditorDialog-CmGXXSY9.js} +42 -209
- package/dist/CollectionEditorDialog-CmGXXSY9.js.map +1 -0
- package/dist/{CollectionsStudioView-BDzMFzqH.js → CollectionsStudioView-DcLHT5bU.js} +6 -8
- package/dist/CollectionsStudioView-DcLHT5bU.js.map +1 -0
- package/dist/{ContentHomePage-0tHuEIm_.js → ContentHomePage-C7vFqKSe.js} +5 -7
- package/dist/ContentHomePage-C7vFqKSe.js.map +1 -0
- package/dist/{ExportCollectionAction-BIrq92To.js → ExportCollectionAction-BfN34eWX.js} +36 -38
- package/dist/ExportCollectionAction-BfN34eWX.js.map +1 -0
- package/dist/{ImportCollectionAction-h8yg_To8.js → ImportCollectionAction-SZrInjhx.js} +5 -7
- package/dist/ImportCollectionAction-SZrInjhx.js.map +1 -0
- package/dist/{PropertyEditView-BuZrNnBN.js → PropertyEditView-Cvryrb3B.js} +563 -489
- package/dist/PropertyEditView-Cvryrb3B.js.map +1 -0
- package/dist/{RolesView-CMPsaIXo.js → RolesView-BCb7qwWs.js} +22 -11
- package/dist/RolesView-BCb7qwWs.js.map +1 -0
- package/dist/{UsersView-BkeblMVT.js → UsersView-Cex24r8H.js} +7 -71
- package/dist/UsersView-Cex24r8H.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +1 -7
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.d.ts +3 -0
- package/dist/collection_editor_ui.js +5 -5
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
- package/dist/components/EntityCollectionView/EntityCollectionListView.d.ts +18 -2
- package/dist/components/EntityCollectionView/FilterPresetsButton.d.ts +21 -0
- package/dist/components/EntityDetailView.d.ts +31 -0
- package/dist/components/EntityEditView.d.ts +3 -2
- package/dist/components/ReferenceTable/EntitySelectionTable.d.ts +1 -1
- package/dist/components/admin/CreationResultDialog.d.ts +5 -0
- package/dist/components/admin/RolesFilterSelect.d.ts +2 -0
- package/dist/components/admin/UserRolesSelectField.d.ts +2 -0
- package/dist/components/common/default_entity_actions.d.ts +7 -1
- package/dist/components/field_configs.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/data_import/utils/data.d.ts +1 -1
- package/dist/data_import/utils/file_headers.d.ts +6 -1
- package/dist/data_import/utils/file_to_json.d.ts +1 -11
- package/dist/data_import/utils/transforms.d.ts +11 -0
- package/dist/editor.js +2 -4
- package/dist/editor.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.d.ts +11 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/hooks/navigation/useResolvedViews.d.ts +2 -1
- package/dist/{index-eRJbMvHi.js → index-DjduZG1T.js} +3 -3
- package/dist/index-DjduZG1T.js.map +1 -0
- package/dist/{index-BuZaHcyc.js → index-MKPc70-v.js} +3 -3
- package/dist/index-MKPc70-v.js.map +1 -0
- package/dist/{index-CS6uJ7oW.js → index-PLIQXpTt.js} +4 -6
- package/dist/index-PLIQXpTt.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +352 -148
- package/dist/index.js.map +1 -1
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/EntityFormProps.d.ts +2 -1
- package/dist/types/fields.d.ts +3 -3
- package/dist/util/navigation_utils.d.ts +1 -1
- package/dist/{util-zfU1zOCX.js → util-DbWax_sV.js} +5453 -2641
- package/dist/util-DbWax_sV.js.map +1 -0
- package/package.json +46 -39
- package/src/collection_editor/ConfigControllerProvider.tsx +1 -1
- package/src/collection_editor/ui/AddKanbanColumnAction.tsx +12 -2
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +1 -2
- package/src/collection_editor/ui/EditorCollectionAction.tsx +1 -2
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +1 -2
- package/src/collection_editor/ui/EditorEntityAction.tsx +1 -2
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +1 -2
- package/src/collection_editor/ui/NewCollectionButton.tsx +1 -2
- package/src/collection_editor/ui/NewCollectionCard.tsx +4 -6
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +10 -2
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +18 -2
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +23 -17
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +16 -2
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +19 -9
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +13 -2
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +24 -2
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +22 -3
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +11 -2
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +12 -2
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +16 -3
- package/src/collection_editor/ui/collection_editor/EnumForm.tsx +17 -2
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +18 -2
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/LayoutModeSwitch.tsx +17 -5
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +32 -6
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +7 -7
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +14 -2
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +16 -2
- package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +9 -2
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +9 -2
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +37 -57
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +11 -2
- package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +34 -0
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +15 -7
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +1 -2
- package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +15 -3
- package/src/collection_editor/ui/collection_editor/properties/conditions/property_paths.ts +1 -1
- package/src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -2
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +0 -2
- package/src/collection_editor/validateCollectionJson.ts +97 -10
- package/src/components/AdminModeSyncer.tsx +1 -1
- package/src/components/ArrayContainer.tsx +19 -15
- package/src/components/ClearFilterSortButton.tsx +1 -2
- package/src/components/CollectionEditorDialogs.tsx +1 -1
- package/src/components/DefaultAppBar.tsx +15 -3
- package/src/components/DefaultDrawer.tsx +3 -3
- package/src/components/DrawerNavigationGroup.tsx +1 -2
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +14 -6
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
- package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +1 -2
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -2
- package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +1 -2
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +1 -2
- package/src/components/EntityCollectionTable/fields/VirtualTableSelect.tsx +0 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +15 -27
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +1 -2
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -5
- package/src/components/EntityCollectionTable/table_bindings.tsx +51 -45
- package/src/components/EntityCollectionView/Board.tsx +1 -2
- package/src/components/EntityCollectionView/BoardColumn.tsx +9 -2
- package/src/components/EntityCollectionView/BoardColumnTitle.tsx +5 -4
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +18 -16
- package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +16 -17
- package/src/components/EntityCollectionView/EntityCollectionListView.tsx +87 -18
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +20 -11
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +6 -7
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +14 -5
- package/src/components/EntityCollectionView/FilterPresetsButton.tsx +292 -0
- package/src/components/EntityCollectionView/FiltersDialog.tsx +1 -2
- package/src/components/EntityCollectionView/SplitListView.tsx +76 -25
- package/src/components/EntityCollectionView/ViewModeToggle.tsx +20 -7
- package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +1 -1
- package/src/components/EntityCollectionView/useBoardDataController.tsx +74 -6
- package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +1 -1
- package/src/components/EntityDetailView.tsx +619 -0
- package/src/components/EntityEditView.tsx +29 -10
- package/src/components/EntityEditViewFormActions.tsx +20 -7
- package/src/components/EntityPreview.tsx +14 -5
- package/src/components/EntitySidePanel.tsx +116 -62
- package/src/components/EntityView.tsx +1 -2
- package/src/components/HomePage/ContentHomePage.tsx +1 -1
- package/src/components/HomePage/FavouritesView.tsx +1 -2
- package/src/components/HomePage/NavigationCard.tsx +1 -2
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -2
- package/src/components/HomePage/NavigationGroup.tsx +1 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
- package/src/components/PropertyIdCopyTooltip.tsx +1 -2
- package/src/components/RebaseAuthGate.tsx +2 -2
- package/src/components/RebaseNavigation.tsx +9 -7
- package/src/components/ReferenceTable/EntitySelectionTable.tsx +12 -8
- package/src/components/RelationSelector.tsx +34 -6
- package/src/components/SearchIconsView.tsx +10 -2
- package/src/components/SelectableTable/SelectableTable.tsx +2 -2
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -2
- package/src/components/SideDialogs.tsx +63 -38
- package/src/components/UserSelector.tsx +30 -6
- package/src/components/admin/CreationResultDialog.tsx +135 -0
- package/src/components/admin/RolesFilterSelect.tsx +45 -0
- package/src/components/admin/RolesView.tsx +53 -14
- package/src/components/admin/UserRolesSelectField.tsx +50 -0
- package/src/components/admin/UsersView.tsx +41 -124
- package/src/components/app/Scaffold.tsx +1 -2
- package/src/components/common/default_entity_actions.tsx +119 -12
- package/src/components/field_configs.tsx +39 -3
- package/src/components/history/EntityHistoryEntry.tsx +1 -2
- package/src/components/history/EntityHistoryView.tsx +1 -2
- package/src/components/index.ts +2 -0
- package/src/data_export/export/BasicExportAction.tsx +35 -38
- package/src/data_export/export/ExportCollectionAction.tsx +39 -40
- package/src/data_import/components/DataNewPropertiesMapping.tsx +15 -2
- package/src/data_import/components/ImportFileUpload.tsx +1 -2
- package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -2
- package/src/data_import/import/ImportCollectionAction.tsx +21 -8
- package/src/data_import/utils/data.ts +23 -5
- package/src/data_import/utils/file_headers.ts +13 -89
- package/src/data_import/utils/file_to_json.ts +43 -68
- package/src/data_import/utils/transforms.ts +47 -0
- package/src/editor/components/SlashCommandMenu.tsx +17 -2
- package/src/editor/components/editor-bubble-item.tsx +1 -1
- package/src/editor/extensions/Image/index.ts +1 -1
- package/src/editor/extensions/Image.ts +1 -1
- package/src/editor/selectors/color-selector.tsx +1 -2
- package/src/editor/selectors/link-selector.tsx +1 -2
- package/src/editor/selectors/node-selector.tsx +16 -2
- package/src/editor/selectors/text-buttons.tsx +1 -2
- package/src/editor/utils/prosemirror-utils.ts +1 -1
- package/src/form/EntityForm.tsx +16 -6
- package/src/form/EntityFormActions.tsx +11 -3
- package/src/form/PropertyFieldBinding.tsx +5 -12
- package/src/form/components/FieldHelperText.tsx +1 -2
- package/src/form/components/LocalChangesMenu.tsx +17 -2
- package/src/form/components/StorageItemPreview.tsx +1 -2
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +1 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +17 -2
- package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +10 -3
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -2
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +1 -2
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +7 -7
- package/src/form/field_bindings/RelationFieldBinding.tsx +150 -147
- package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
- package/src/form/field_bindings/SelectFieldBinding.tsx +1 -2
- package/src/form/field_bindings/TextFieldBinding.tsx +10 -2
- package/src/form/field_bindings/VectorFieldBinding.tsx +202 -0
- package/src/form/index.tsx +1 -0
- package/src/form/validation.ts +54 -2
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +2 -1
- package/src/hooks/navigation/useResolvedViews.tsx +30 -15
- package/src/hooks/navigation/useTopLevelNavigation.ts +1 -1
- package/src/index.ts +6 -0
- package/src/preview/PropertyPreview.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +1 -1
- package/src/preview/components/UrlComponentPreview.tsx +1 -2
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -2
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +23 -24
- package/src/routes/RebaseRoute.tsx +64 -35
- package/src/types/components/EntityFormActionsProps.tsx +1 -1
- package/src/types/components/EntityFormProps.tsx +3 -1
- package/src/types/fields.tsx +4 -3
- package/src/util/navigation_utils.ts +4 -3
- package/src/util/previews.ts +1 -1
- package/src/util/property_utils.tsx +22 -6
- package/src/util/resolutions.ts +2 -2
- package/dist/CollectionEditorDialog-ywdxhs1L.js.map +0 -1
- package/dist/CollectionsStudioView-BDzMFzqH.js.map +0 -1
- package/dist/ContentHomePage-0tHuEIm_.js.map +0 -1
- package/dist/ExportCollectionAction-BIrq92To.js.map +0 -1
- package/dist/ImportCollectionAction-h8yg_To8.js.map +0 -1
- package/dist/PropertyEditView-BuZrNnBN.js.map +0 -1
- package/dist/RolesView-CMPsaIXo.js.map +0 -1
- package/dist/UsersView-BkeblMVT.js.map +0 -1
- package/dist/index-BuZaHcyc.js.map +0 -1
- package/dist/index-CS6uJ7oW.js.map +0 -1
- package/dist/index-eRJbMvHi.js.map +0 -1
- package/dist/util-zfU1zOCX.js.map +0 -1
|
@@ -5,8 +5,18 @@ import { useAuthController, useCustomizationController } from "@rebasepro/core";
|
|
|
5
5
|
import { getFieldConfig } from "../../../components/field_configs";
|
|
6
6
|
import { PropertyConfigBadge } from "../../../components/PropertyConfigBadge";
|
|
7
7
|
import { EntityCollection, Property } from "@rebasepro/types";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BooleanSwitchWithLabel,
|
|
10
|
+
Button,
|
|
11
|
+
Container,
|
|
12
|
+
IconButton,
|
|
13
|
+
iconSize,
|
|
14
|
+
Select,
|
|
15
|
+
SelectItem,
|
|
16
|
+
TextField,
|
|
17
|
+
Typography,
|
|
18
|
+
XIcon
|
|
19
|
+
} from "@rebasepro/ui";
|
|
10
20
|
|
|
11
21
|
import { useFormex } from "@rebasepro/formex";
|
|
12
22
|
import { LayoutModeSwitch } from "./LayoutModeSwitch";
|
|
@@ -7,8 +7,22 @@ import {
|
|
|
7
7
|
import { resolveEntityAction } from "../../_cms_internals";
|
|
8
8
|
import { type EntityCollection } from "@rebasepro/types";
|
|
9
9
|
import { EntityAction } from "@rebasepro/types";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
Alert,
|
|
12
|
+
Button,
|
|
13
|
+
Container,
|
|
14
|
+
IconButton,
|
|
15
|
+
iconSize,
|
|
16
|
+
Paper,
|
|
17
|
+
PlusIcon,
|
|
18
|
+
Table,
|
|
19
|
+
TableBody,
|
|
20
|
+
TableCell,
|
|
21
|
+
TableRow,
|
|
22
|
+
Tooltip,
|
|
23
|
+
Trash2Icon,
|
|
24
|
+
Typography
|
|
25
|
+
} from "@rebasepro/ui";
|
|
12
26
|
import { useFormex } from "@rebasepro/formex";
|
|
13
27
|
import { EntityActionsSelectDialog } from "./EntityActionsSelectDialog";
|
|
14
28
|
|
|
@@ -137,7 +151,6 @@ export function EntityActionsEditTab({
|
|
|
137
151
|
open={addEntityActionDialogOpen}
|
|
138
152
|
onClose={(selectedActionKey) => {
|
|
139
153
|
if (selectedActionKey) {
|
|
140
|
-
console.log("Selected action key:", selectedActionKey);
|
|
141
154
|
const value = [...(values.entityActions ?? []), selectedActionKey]
|
|
142
155
|
// only actions that are defined in the registry
|
|
143
156
|
.filter((e: string | EntityAction<any>): e is string => typeof e === "string" && (contextEntityActions ?? []).some(action => action.key === e));
|
|
@@ -6,8 +6,23 @@ import { deepEqual as equal } from "fast-equals"
|
|
|
6
6
|
;
|
|
7
7
|
import { EnumValueConfig, EnumValues } from "@rebasepro/types";
|
|
8
8
|
import { ArrayContainer, ArrayEntryParams } from "../../_cms_internals";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
Badge,
|
|
11
|
+
Button,
|
|
12
|
+
CircularProgress,
|
|
13
|
+
DebouncedTextField,
|
|
14
|
+
Dialog,
|
|
15
|
+
DialogActions,
|
|
16
|
+
DialogContent,
|
|
17
|
+
DialogTitle,
|
|
18
|
+
IconButton,
|
|
19
|
+
iconSize,
|
|
20
|
+
ListIcon,
|
|
21
|
+
Paper,
|
|
22
|
+
RefreshCcwIcon,
|
|
23
|
+
SettingsIcon,
|
|
24
|
+
Typography
|
|
25
|
+
} from "@rebasepro/ui";
|
|
11
26
|
import { extractEnumFromValues } from "@rebasepro/schema-inference";
|
|
12
27
|
import { Field, Formex, getIn, useCreateFormex, useFormex } from "@rebasepro/formex";
|
|
13
28
|
|
|
@@ -5,8 +5,24 @@ import React, { useState } from "react";
|
|
|
5
5
|
import { useAuthController, useCustomizationController } from "@rebasepro/core";
|
|
6
6
|
import { SearchIconsView } from "../../_cms_internals";
|
|
7
7
|
import type { EntityCollection, PostgresCollection } from "@rebasepro/types";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BooleanSwitchWithLabel,
|
|
10
|
+
Chip,
|
|
11
|
+
cls,
|
|
12
|
+
Container,
|
|
13
|
+
DebouncedTextField,
|
|
14
|
+
Dialog,
|
|
15
|
+
ExpandablePanel,
|
|
16
|
+
HistoryIcon,
|
|
17
|
+
IconButton,
|
|
18
|
+
iconSize,
|
|
19
|
+
SearchIcon,
|
|
20
|
+
Select,
|
|
21
|
+
SelectItem,
|
|
22
|
+
TextField,
|
|
23
|
+
Tooltip,
|
|
24
|
+
Typography
|
|
25
|
+
} from "@rebasepro/ui";
|
|
10
26
|
import { Field, getIn, useFormex } from "@rebasepro/formex";
|
|
11
27
|
import { useCollectionsConfigController } from "../../useCollectionsConfigController";
|
|
12
28
|
import { singular, toSnakeCase } from "@rebasepro/utils";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useSnackbarController } from "@rebasepro/core";
|
|
2
2
|
import { EntityCollection } from "@rebasepro/types";
|
|
3
|
-
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from "@rebasepro/ui";
|
|
4
|
-
import { CopyIcon } from "lucide-react";
|
|
3
|
+
import { Button, CopyIcon, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from "@rebasepro/ui";
|
|
5
4
|
import React from "react";
|
|
6
5
|
import JSON5 from "json5";
|
|
7
6
|
import { Highlight, themes } from "prism-react-renderer"
|
|
@@ -5,8 +5,7 @@ import { useAuthController, useCustomizationController } from "@rebasepro/core";
|
|
|
5
5
|
import { EntityCollection, Property } from "@rebasepro/types";
|
|
6
6
|
import { PropertyConfigBadge } from "../../../components/PropertyConfigBadge";
|
|
7
7
|
import { getFieldConfig } from "../../../components/field_configs";
|
|
8
|
-
import { IconButton, Select, SelectItem, Typography,
|
|
9
|
-
import { XIcon } from "lucide-react";
|
|
8
|
+
import { Button, IconButton, iconSize, Select, SelectItem, Typography, XIcon } from "@rebasepro/ui";
|
|
10
9
|
import { useFormex } from "@rebasepro/formex";
|
|
11
10
|
import { PropertyFormDialog } from "./PropertyEditView";
|
|
12
11
|
import { unslugify } from "@rebasepro/utils";
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
AppWindow,
|
|
3
|
+
cls,
|
|
4
|
+
ColumnsIcon,
|
|
5
|
+
PanelLeftIcon,
|
|
6
|
+
SquareIcon,
|
|
7
|
+
ToggleButtonGroup,
|
|
8
|
+
Typography
|
|
9
|
+
} from "@rebasepro/ui";
|
|
3
10
|
|
|
4
11
|
export function LayoutModeSwitch({
|
|
5
12
|
value,
|
|
6
13
|
onChange,
|
|
7
14
|
className
|
|
8
15
|
}: {
|
|
9
|
-
value: "side_panel" | "full_screen" | "split";
|
|
10
|
-
onChange: (value: "side_panel" | "full_screen" | "split") => void;
|
|
16
|
+
value: "side_panel" | "full_screen" | "split" | "dialog";
|
|
17
|
+
onChange: (value: "side_panel" | "full_screen" | "split" | "dialog") => void;
|
|
11
18
|
className?: string;
|
|
12
19
|
}) {
|
|
13
20
|
|
|
@@ -32,10 +39,15 @@ export function LayoutModeSwitch({
|
|
|
32
39
|
value: "split",
|
|
33
40
|
label: "Split view",
|
|
34
41
|
icon: <PanelLeftIcon/>
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: "dialog",
|
|
45
|
+
label: "Centered dialog",
|
|
46
|
+
icon: <AppWindow/>
|
|
35
47
|
}
|
|
36
48
|
]}
|
|
37
49
|
/>
|
|
38
50
|
</div>
|
|
39
|
-
<Typography variant={"caption"} color={"secondary"} className={"ml-3.5"}>Should documents be opened full screen
|
|
51
|
+
<Typography variant={"caption"} color={"secondary"} className={"ml-3.5"}>Should documents be opened full screen, inline side dialog, or centered dialog</Typography>
|
|
40
52
|
</div>
|
|
41
53
|
}
|
|
@@ -8,8 +8,25 @@ import { DEFAULT_FIELD_CONFIGS, getFieldConfig, getFieldId } from "../../../comp
|
|
|
8
8
|
import { PropertyConfigBadge } from "../../../components/PropertyConfigBadge";
|
|
9
9
|
import { Property, PropertyConfig, PropertyConfigId } from "@rebasepro/types";
|
|
10
10
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
AlertTriangleIcon,
|
|
13
|
+
Button,
|
|
14
|
+
Card,
|
|
15
|
+
cls,
|
|
16
|
+
Dialog,
|
|
17
|
+
DialogActions,
|
|
18
|
+
DialogContent,
|
|
19
|
+
DialogTitle,
|
|
20
|
+
fieldBackgroundDisabledMixin,
|
|
21
|
+
fieldBackgroundHoverMixin,
|
|
22
|
+
fieldBackgroundMixin,
|
|
23
|
+
IconButton,
|
|
24
|
+
iconSize,
|
|
25
|
+
InfoLabel,
|
|
26
|
+
Tooltip,
|
|
27
|
+
Trash2Icon,
|
|
28
|
+
Typography
|
|
29
|
+
} from "@rebasepro/ui";
|
|
13
30
|
import { EnumPropertyField } from "./properties/EnumPropertyField";
|
|
14
31
|
import { StoragePropertyField } from "./properties/StoragePropertyField";
|
|
15
32
|
import { MapPropertyField } from "./properties/MapPropertyField";
|
|
@@ -22,6 +39,7 @@ import { NumberPropertyField } from "./properties/NumberPropertyField";
|
|
|
22
39
|
import { ReferencePropertyField } from "./properties/ReferencePropertyField";
|
|
23
40
|
import { DateTimePropertyField } from "./properties/DateTimePropertyField";
|
|
24
41
|
import { AdvancedPropertyValidation } from "./properties/advanced/AdvancedPropertyValidation";
|
|
42
|
+
import { VectorPropertyField } from "./properties/VectorPropertyField";
|
|
25
43
|
|
|
26
44
|
import { KeyValuePropertyField } from "./properties/KeyValuePropertyField";
|
|
27
45
|
import { RelationPropertyField } from "./properties/RelationPropertyField";
|
|
@@ -169,6 +187,9 @@ export const PropertyForm = React.memo(
|
|
|
169
187
|
if (values.type === "reference" && !values.path) {
|
|
170
188
|
errors.slug = "You must specify a target collection for the field";
|
|
171
189
|
}
|
|
190
|
+
if (values.type === "vector" && (!values.dimensions || isNaN(Number(values.dimensions)) || Number(values.dimensions) <= 0)) {
|
|
191
|
+
errors.dimensions = "Vector dimensions must be a positive number";
|
|
192
|
+
}
|
|
172
193
|
if (values.propertyConfig === "repeat") {
|
|
173
194
|
if (!("of" in values) || !values.of) {
|
|
174
195
|
errors.of = "You need to specify a repeat field";
|
|
@@ -463,6 +484,10 @@ function PropertyEditFormFields({
|
|
|
463
484
|
<RelationPropertyField
|
|
464
485
|
showErrors={showErrors}
|
|
465
486
|
disabled={disabled}/>;
|
|
487
|
+
} else if (selectedFieldConfigId === "vector_input") {
|
|
488
|
+
childComponent =
|
|
489
|
+
<VectorPropertyField
|
|
490
|
+
disabled={disabled}/>;
|
|
466
491
|
} else {
|
|
467
492
|
childComponent = null;
|
|
468
493
|
}
|
|
@@ -477,7 +502,7 @@ function PropertyEditFormFields({
|
|
|
477
502
|
</Typography>
|
|
478
503
|
</InfoLabel>}
|
|
479
504
|
|
|
480
|
-
<div className="flex mt-2 justify-between">
|
|
505
|
+
<div className="flex mt-2 items-start justify-between">
|
|
481
506
|
<div className={"w-full flex flex-col gap-2"}>
|
|
482
507
|
<WidgetSelectView
|
|
483
508
|
initialProperty={values}
|
|
@@ -509,10 +534,10 @@ function PropertyEditFormFields({
|
|
|
509
534
|
{onDelete && values?.id &&
|
|
510
535
|
<IconButton
|
|
511
536
|
variant={"ghost"}
|
|
512
|
-
className="
|
|
537
|
+
className="mt-1 shrink-0"
|
|
513
538
|
disabled={disabled}
|
|
514
539
|
onClick={() => setDeleteDialogOpen(true)}>
|
|
515
|
-
<Trash2Icon/>
|
|
540
|
+
<Trash2Icon size={iconSize.small}/>
|
|
516
541
|
</IconButton>}
|
|
517
542
|
</div>
|
|
518
543
|
|
|
@@ -596,7 +621,8 @@ const WIDGET_TYPE_MAP: Record<PropertyConfigId, string> = {
|
|
|
596
621
|
key_value: "Group",
|
|
597
622
|
repeat: "Array",
|
|
598
623
|
custom_array: "Array",
|
|
599
|
-
block: "Group"
|
|
624
|
+
block: "Group",
|
|
625
|
+
vector_input: "Number"
|
|
600
626
|
};
|
|
601
627
|
|
|
602
628
|
function WidgetSelectView({
|
|
@@ -5,8 +5,7 @@ import { ErrorBoundary } from "@rebasepro/ui";
|
|
|
5
5
|
import { Property } from "@rebasepro/types";
|
|
6
6
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
7
7
|
import { cls, Paper, Typography } from "@rebasepro/ui";
|
|
8
|
-
import {
|
|
9
|
-
import { iconSize } from "@rebasepro/ui";
|
|
8
|
+
import { FunctionSquareIcon, iconSize, MinusCircleIcon } from "@rebasepro/ui";
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
export function PropertyFieldPreview({
|
|
@@ -39,10 +38,11 @@ export function PropertyFieldPreview({
|
|
|
39
38
|
<div onClick={onClick} className={onClick ? "cursor-pointer" : ""}>
|
|
40
39
|
<Paper
|
|
41
40
|
className={cls(
|
|
42
|
-
"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-white dark:bg-surface-800
|
|
41
|
+
"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-white dark:bg-surface-800 shadow-xs",
|
|
42
|
+
borderColorClass || "border-surface-200 dark:border-surface-700",
|
|
43
43
|
selected
|
|
44
|
-
? "bg-primary/
|
|
45
|
-
: "hover:bg-surface-50 dark:hover:bg-surface-
|
|
44
|
+
? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30"
|
|
45
|
+
: "hover:bg-surface-50 dark:hover:bg-surface-700"
|
|
46
46
|
)}
|
|
47
47
|
>
|
|
48
48
|
<PropertyConfigBadge propertyConfig={propertyConfig} size="small"/>
|
|
@@ -107,8 +107,8 @@ export function NonEditablePropertyPreview({
|
|
|
107
107
|
className={cls(
|
|
108
108
|
"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-white dark:bg-surface-800 border-surface-200 dark:border-surface-700 shadow-xs",
|
|
109
109
|
selected
|
|
110
|
-
? "bg-primary/
|
|
111
|
-
: "hover:bg-surface-50 dark:hover:bg-surface-
|
|
110
|
+
? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30"
|
|
111
|
+
: "hover:bg-surface-50 dark:hover:bg-surface-700"
|
|
112
112
|
)}
|
|
113
113
|
>
|
|
114
114
|
<div className={"relative shrink-0"}>
|
|
@@ -5,8 +5,20 @@ import { deepEqual as equal } from "fast-equals"
|
|
|
5
5
|
import { AIModifiedIndicator } from "@rebasepro/core";
|
|
6
6
|
import { AdditionalFieldDelegate, Properties, Property } from "@rebasepro/types";
|
|
7
7
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
ArrowDownToLineIcon,
|
|
10
|
+
ArrowUpToLineIcon,
|
|
11
|
+
cls,
|
|
12
|
+
defaultBorderMixin,
|
|
13
|
+
FileSearchIcon,
|
|
14
|
+
IconButton,
|
|
15
|
+
iconSize,
|
|
16
|
+
Menu,
|
|
17
|
+
MenuItem,
|
|
18
|
+
MoreVerticalIcon,
|
|
19
|
+
Tooltip,
|
|
20
|
+
Trash2Icon
|
|
21
|
+
} from "@rebasepro/ui";
|
|
10
22
|
import { NonEditablePropertyPreview, PropertyFieldPreview } from "./PropertyFieldPreview";
|
|
11
23
|
import {
|
|
12
24
|
closestCenter,
|
|
@@ -7,8 +7,22 @@ import {
|
|
|
7
7
|
import { resolveEntityView } from "../../_cms_internals";
|
|
8
8
|
import { EntityCollection, EntityCustomView, User } from "@rebasepro/types";
|
|
9
9
|
import { getSubcollections } from "@rebasepro/common";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
Alert,
|
|
12
|
+
Button,
|
|
13
|
+
Container,
|
|
14
|
+
IconButton,
|
|
15
|
+
iconSize,
|
|
16
|
+
Paper,
|
|
17
|
+
PlusIcon,
|
|
18
|
+
Table,
|
|
19
|
+
TableBody,
|
|
20
|
+
TableCell,
|
|
21
|
+
TableRow,
|
|
22
|
+
Tooltip,
|
|
23
|
+
Trash2Icon,
|
|
24
|
+
Typography
|
|
25
|
+
} from "@rebasepro/ui";
|
|
12
26
|
import { CollectionEditorDialog } from "./CollectionEditorDialog";
|
|
13
27
|
import { CollectionsConfigController } from "../../types/config_controller";
|
|
14
28
|
import { CollectionInference } from "../../types/collection_inference";
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { ViewMode } from "@rebasepro/types";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
cls,
|
|
4
|
+
KanbanIcon,
|
|
5
|
+
LayoutGridIcon,
|
|
6
|
+
ListIcon,
|
|
7
|
+
TableIcon,
|
|
8
|
+
ToggleButtonGroup,
|
|
9
|
+
Typography
|
|
10
|
+
} from "@rebasepro/ui";
|
|
4
11
|
|
|
5
12
|
export function ViewModeSwitch({
|
|
6
13
|
value,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Button, Paper, Typography } from "@rebasepro/ui";
|
|
3
|
-
import { PlusIcon } from "lucide-react";
|
|
2
|
+
import { Button, Paper, PlusIcon, Typography } from "@rebasepro/ui";
|
|
4
3
|
import { getIn, useFormex } from "@rebasepro/formex";
|
|
5
4
|
import { OnPropertyChangedParams, PropertyFormDialog } from "../PropertyEditView";
|
|
6
5
|
import {
|
|
@@ -2,8 +2,7 @@ import { FieldCaption } from "../../../_cms_internals";
|
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
;
|
|
4
4
|
import { MapProperty, Property, PropertyConfig } from "@rebasepro/types";
|
|
5
|
-
import { BooleanSwitchWithLabel, Button, Paper, Typography } from "@rebasepro/ui";
|
|
6
|
-
import { PlusIcon } from "lucide-react";
|
|
5
|
+
import { BooleanSwitchWithLabel, Button, Paper, PlusIcon, Typography } from "@rebasepro/ui";
|
|
7
6
|
import { PropertyFormDialog } from "../PropertyEditView";
|
|
8
7
|
import { getIn, useFormex } from "@rebasepro/formex";
|
|
9
8
|
import { useTranslation } from "@rebasepro/core";
|
|
@@ -5,8 +5,15 @@ import { ValidationPanel } from "./validation/ValidationPanel";
|
|
|
5
5
|
import { Field, getIn, useFormex } from "@rebasepro/formex";
|
|
6
6
|
import { useTranslation } from "@rebasepro/core";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BooleanSwitchWithLabel,
|
|
10
|
+
DebouncedTextField,
|
|
11
|
+
ExpandablePanel,
|
|
12
|
+
SettingsIcon,
|
|
13
|
+
TextField,
|
|
14
|
+
Typography,
|
|
15
|
+
UploadCloudIcon
|
|
16
|
+
} from "@rebasepro/ui";
|
|
10
17
|
|
|
11
18
|
export function MarkdownPropertyField({
|
|
12
19
|
disabled,
|
|
@@ -14,16 +14,25 @@ import { CollectionsSelect } from "./ReferencePropertyField";
|
|
|
14
14
|
|
|
15
15
|
const ON_ACTION_OPTIONS: OnAction[] = ["cascade", "restrict", "no action", "set null", "set default"];
|
|
16
16
|
|
|
17
|
+
function getTargetSlug(target?: string | (() => string | { slug: string } | Record<string, unknown>)): string {
|
|
18
|
+
if (!target) return "";
|
|
19
|
+
if (typeof target === "string") return target;
|
|
20
|
+
try {
|
|
21
|
+
const resolved = target();
|
|
22
|
+
if (typeof resolved === "string") return resolved;
|
|
23
|
+
if (resolved && typeof resolved === "object" && "slug" in resolved && typeof resolved.slug === "string") {
|
|
24
|
+
return resolved.slug;
|
|
25
|
+
}
|
|
26
|
+
return "";
|
|
27
|
+
} catch {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
/**
|
|
18
33
|
* Property editor form for `type: "relation"` properties.
|
|
19
34
|
*
|
|
20
|
-
* This component edits
|
|
21
|
-
* 1. The `RelationProperty` fields on the property itself (relationName, etc.)
|
|
22
|
-
* 2. The matching `Relation` entry in `collection.relations[]`
|
|
23
|
-
*
|
|
24
|
-
* When a user configures a relation property, we sync the relation config
|
|
25
|
-
* back to the parent collection's `relations` array so saving the collection
|
|
26
|
-
* persists everything in one go.
|
|
35
|
+
* This component edits the `RelationProperty` fields on the property itself (target, relationName, etc.)
|
|
27
36
|
*/
|
|
28
37
|
export function RelationPropertyField({
|
|
29
38
|
disabled,
|
|
@@ -36,37 +45,22 @@ export function RelationPropertyField({
|
|
|
36
45
|
values,
|
|
37
46
|
errors,
|
|
38
47
|
setFieldValue
|
|
39
|
-
} = useFormex<RelationProperty & { id?: string
|
|
48
|
+
} = useFormex<RelationProperty & { id?: string }>();
|
|
40
49
|
|
|
41
50
|
const collectionRegistry = useCollectionRegistryController();
|
|
42
51
|
|
|
43
|
-
// ─── Read the parent collection form to sync `relations[]` ───
|
|
44
|
-
// The PropertyForm is nested inside a parent Formex for the whole collection.
|
|
45
|
-
// We reach it via a second useFormex keyed to the parent context.
|
|
46
|
-
// However, the PropertyForm uses its own isolated Formex, so we can't
|
|
47
|
-
// directly access the parent. Instead, we store the relation config
|
|
48
|
-
// on the property itself and let the save logic merge it.
|
|
49
|
-
//
|
|
50
|
-
// We store the full relation config on a transient `_relationConfig` key
|
|
51
|
-
// so the consumer (CollectionPropertiesEditorForm / save logic) can
|
|
52
|
-
// extract it and place it in `collection.relations[]`.
|
|
53
|
-
|
|
54
52
|
const relationName = values.relationName ?? "";
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const direction = (relationConfig.direction as string) ?? "owning";
|
|
62
|
-
const localKey = (relationConfig.localKey as string) ?? "";
|
|
63
|
-
const foreignKeyOnTarget = (relationConfig.foreignKeyOnTarget as string) ?? "";
|
|
64
|
-
const through = relationConfig.through as Record<string, string> | undefined;
|
|
53
|
+
const targetSlug = getTargetSlug(values.target);
|
|
54
|
+
const cardinality = values.cardinality ?? "one";
|
|
55
|
+
const direction = values.direction ?? "owning";
|
|
56
|
+
const localKey = values.localKey ?? "";
|
|
57
|
+
const foreignKeyOnTarget = values.foreignKeyOnTarget ?? "";
|
|
58
|
+
const through = values.through;
|
|
65
59
|
const throughTable = through?.table ?? "";
|
|
66
60
|
const throughSourceColumn = through?.sourceColumn ?? "";
|
|
67
61
|
const throughTargetColumn = through?.targetColumn ?? "";
|
|
68
|
-
const onUpdate =
|
|
69
|
-
const onDelete =
|
|
62
|
+
const onUpdate = values.onUpdate ?? "no action";
|
|
63
|
+
const onDelete = values.onDelete ?? "no action";
|
|
70
64
|
|
|
71
65
|
// Whether to show the junction table section
|
|
72
66
|
const showThrough = cardinality === "many" && direction === "owning";
|
|
@@ -75,26 +69,12 @@ export function RelationPropertyField({
|
|
|
75
69
|
// Whether to show the foreign key on target field
|
|
76
70
|
const showForeignKey = direction === "inverse";
|
|
77
71
|
|
|
78
|
-
const updateRelationConfig = useCallback(
|
|
79
|
-
(patch: Record<string, unknown>) => {
|
|
80
|
-
const current = (values._relationConfig as Record<string, unknown>) ?? {};
|
|
81
|
-
setFieldValue("_relationConfig" as keyof (RelationProperty & { _relationConfig?: unknown }), { ...current,
|
|
82
|
-
...patch });
|
|
83
|
-
},
|
|
84
|
-
[values, setFieldValue]
|
|
85
|
-
);
|
|
86
|
-
|
|
87
72
|
const updateThrough = useCallback(
|
|
88
73
|
(patch: Record<string, unknown>) => {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
setFieldValue("_relationConfig" as keyof (RelationProperty & { _relationConfig?: unknown }), {
|
|
92
|
-
...current,
|
|
93
|
-
through: { ...currentThrough,
|
|
94
|
-
...patch }
|
|
95
|
-
});
|
|
74
|
+
const currentThrough = values.through ?? { table: "", sourceColumn: "", targetColumn: "" };
|
|
75
|
+
setFieldValue("through", { ...currentThrough, ...patch });
|
|
96
76
|
},
|
|
97
|
-
[values, setFieldValue]
|
|
77
|
+
[values.through, setFieldValue]
|
|
98
78
|
);
|
|
99
79
|
|
|
100
80
|
// Auto-generate relationName from target collection slug
|
|
@@ -102,7 +82,7 @@ export function RelationPropertyField({
|
|
|
102
82
|
if (targetSlug && !relationName) {
|
|
103
83
|
setFieldValue("relationName", targetSlug);
|
|
104
84
|
}
|
|
105
|
-
}, [targetSlug]);
|
|
85
|
+
}, [targetSlug, relationName, setFieldValue]);
|
|
106
86
|
|
|
107
87
|
const collections: EntityCollection[] = collectionRegistry?.collections ?? [];
|
|
108
88
|
|
|
@@ -112,10 +92,10 @@ export function RelationPropertyField({
|
|
|
112
92
|
<div className={"col-span-12"}>
|
|
113
93
|
<CollectionsSelect
|
|
114
94
|
disabled={disabled}
|
|
115
|
-
pathPath={"
|
|
95
|
+
pathPath={"target"}
|
|
116
96
|
value={targetSlug}
|
|
117
97
|
setFieldValue={(_, value) => {
|
|
118
|
-
|
|
98
|
+
setFieldValue("target", value);
|
|
119
99
|
// Auto-generate relation name from target
|
|
120
100
|
if (!relationName || relationName === targetSlug) {
|
|
121
101
|
setFieldValue("relationName", value);
|
|
@@ -152,7 +132,7 @@ export function RelationPropertyField({
|
|
|
152
132
|
<div className={"col-span-12 sm:col-span-6"}>
|
|
153
133
|
<Select
|
|
154
134
|
value={cardinality}
|
|
155
|
-
onValueChange={(v) =>
|
|
135
|
+
onValueChange={(v) => setFieldValue("cardinality", v as "one" | "many")}
|
|
156
136
|
label={"Cardinality"}
|
|
157
137
|
disabled={disabled}
|
|
158
138
|
fullWidth
|
|
@@ -184,7 +164,7 @@ export function RelationPropertyField({
|
|
|
184
164
|
<div className={"col-span-12 sm:col-span-6"}>
|
|
185
165
|
<Select
|
|
186
166
|
value={direction}
|
|
187
|
-
onValueChange={(v) =>
|
|
167
|
+
onValueChange={(v) => setFieldValue("direction", v as "owning" | "inverse")}
|
|
188
168
|
label={"Direction"}
|
|
189
169
|
disabled={disabled}
|
|
190
170
|
fullWidth
|
|
@@ -218,7 +198,7 @@ export function RelationPropertyField({
|
|
|
218
198
|
<TextField
|
|
219
199
|
value={localKey}
|
|
220
200
|
onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>
|
|
221
|
-
|
|
201
|
+
setFieldValue("localKey", e.target.value)
|
|
222
202
|
}
|
|
223
203
|
label={"Local key (foreign key column on this table)"}
|
|
224
204
|
disabled={disabled}
|
|
@@ -236,7 +216,7 @@ export function RelationPropertyField({
|
|
|
236
216
|
<TextField
|
|
237
217
|
value={foreignKeyOnTarget}
|
|
238
218
|
onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>
|
|
239
|
-
|
|
219
|
+
setFieldValue("foreignKeyOnTarget", e.target.value)
|
|
240
220
|
}
|
|
241
221
|
label={"Foreign key on target table"}
|
|
242
222
|
disabled={disabled}
|
|
@@ -305,7 +285,7 @@ export function RelationPropertyField({
|
|
|
305
285
|
<div className={"col-span-12 sm:col-span-6"}>
|
|
306
286
|
<Select
|
|
307
287
|
value={onUpdate}
|
|
308
|
-
onValueChange={(v) =>
|
|
288
|
+
onValueChange={(v) => setFieldValue("onUpdate", v as OnAction)}
|
|
309
289
|
label={"On update"}
|
|
310
290
|
disabled={disabled}
|
|
311
291
|
fullWidth
|
|
@@ -325,7 +305,7 @@ export function RelationPropertyField({
|
|
|
325
305
|
<div className={"col-span-12 sm:col-span-6"}>
|
|
326
306
|
<Select
|
|
327
307
|
value={onDelete}
|
|
328
|
-
onValueChange={(v) =>
|
|
308
|
+
onValueChange={(v) => setFieldValue("onDelete", v as OnAction)}
|
|
329
309
|
label={"On delete"}
|
|
330
310
|
disabled={disabled}
|
|
331
311
|
fullWidth
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
DebouncedTextField,
|
|
6
|
+
ExpandablePanel,
|
|
7
|
+
MultiSelect,
|
|
8
|
+
MultiSelectItem,
|
|
9
|
+
Select,
|
|
10
|
+
SelectItem,
|
|
11
|
+
Typography,
|
|
12
|
+
UploadCloudIcon
|
|
13
|
+
} from "@rebasepro/ui";
|
|
5
14
|
|
|
6
15
|
import { Field, FormexFieldProps, getIn, useFormex } from "@rebasepro/formex";
|
|
7
16
|
import { useTranslation } from "@rebasepro/core";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FieldCaption } from "../../../_cms_internals";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TextField } from "@rebasepro/ui";
|
|
4
|
+
import { getIn, useFormex } from "@rebasepro/formex";
|
|
5
|
+
|
|
6
|
+
export function VectorPropertyField({ disabled }: {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}) {
|
|
9
|
+
const { values, setFieldValue, touched, errors } = useFormex();
|
|
10
|
+
|
|
11
|
+
const dimensionsPath = "dimensions";
|
|
12
|
+
const dimensionsValue = getIn(values, dimensionsPath);
|
|
13
|
+
const dimensionsError = getIn(touched, dimensionsPath) && getIn(errors, dimensionsPath);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className={"col-span-12"}>
|
|
17
|
+
<TextField
|
|
18
|
+
name={dimensionsPath}
|
|
19
|
+
disabled={disabled}
|
|
20
|
+
type={"number"}
|
|
21
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
22
|
+
const parsedVal = parseInt(e.target.value);
|
|
23
|
+
setFieldValue(dimensionsPath, isNaN(parsedVal) ? undefined : parsedVal);
|
|
24
|
+
}}
|
|
25
|
+
label={"Vector Dimensions"}
|
|
26
|
+
value={dimensionsValue ?? ""}
|
|
27
|
+
error={Boolean(dimensionsError)}
|
|
28
|
+
/>
|
|
29
|
+
<FieldCaption error={Boolean(dimensionsError)}>
|
|
30
|
+
{dimensionsError ?? "The dimension size of the vector embeddings (e.g., 1536 for OpenAI text-embedding-3-small)."}
|
|
31
|
+
</FieldCaption>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|