@rebasepro/admin 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CollectionEditorDialog-HNXGxXdO.js → CollectionEditorDialog-iGgS4rLX.js} +233 -152
- package/dist/CollectionEditorDialog-iGgS4rLX.js.map +1 -0
- package/dist/{PropertyEditView-C2wp8kQ9.js → PropertyEditView-C9yhLyja.js} +129 -15
- package/dist/PropertyEditView-C9yhLyja.js.map +1 -0
- package/dist/{CollectionsStudioView-B1mN33GB.js → RouterCollectionsStudioView-Dqx27GD8.js} +61 -39
- package/dist/RouterCollectionsStudioView-Dqx27GD8.js.map +1 -0
- package/dist/collection_editor/extensibility_types.d.ts +135 -0
- package/dist/collection_editor/index.d.ts +6 -0
- package/dist/collection_editor/serializable_types.d.ts +374 -0
- package/dist/collection_editor/serializable_utils.d.ts +50 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +12 -1
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +13 -1
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +24 -2
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +4 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +12 -1
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +15 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +14 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +37 -0
- package/dist/collection_editor/useSafeSnackbarController.d.ts +2 -0
- package/dist/collection_editor_ui.d.ts +4 -0
- package/dist/collection_editor_ui.js +33 -4
- package/dist/collection_editor_ui.js.map +1 -0
- package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +3 -3
- package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +3 -3
- package/dist/components/EntityEditView.d.ts +3 -2
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/form/EntityForm.d.ts +10 -9
- package/dist/form/EntityFormBinding.d.ts +27 -0
- package/dist/form/form_utils.d.ts +8 -0
- package/dist/form/index.d.ts +5 -1
- package/dist/{history-BO6VT85a.js → history-ChHgyyvM.js} +2 -2
- package/dist/{history-BO6VT85a.js.map → history-ChHgyyvM.js.map} +1 -1
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
- package/dist/hooks/navigation/useAsyncResolver.d.ts +26 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -0
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -1
- package/dist/hooks/navigation/utils.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/routes/CustomViewRoute.d.ts +2 -1
- package/dist/{src-BYniefVu.js → src-DOX2nOyh.js} +1586 -1283
- package/dist/src-DOX2nOyh.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/EntityFormProps.d.ts +59 -0
- package/dist/types/fields.d.ts +6 -1
- package/dist/util/dataControllerAdapter.d.ts +30 -0
- package/dist/util/navigation_utils.d.ts +1 -1
- package/dist/util/propertyConfigMapper.d.ts +17 -0
- package/package.json +18 -18
- package/src/collection_editor/extensibility_types.ts +168 -0
- package/src/collection_editor/index.ts +46 -0
- package/src/collection_editor/serializable_types.ts +487 -0
- package/src/collection_editor/serializable_utils.ts +588 -0
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +134 -70
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +95 -78
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +23 -20
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +79 -27
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +9 -7
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +22 -5
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +155 -10
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -0
- package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +44 -0
- package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +41 -0
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +4 -3
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +286 -0
- package/src/collection_editor/useSafeSnackbarController.ts +9 -0
- package/src/collection_editor_ui.ts +6 -0
- package/src/components/DefaultDrawer.tsx +13 -3
- package/src/components/DrawerNavigationGroup.tsx +2 -2
- package/src/components/EntityCollectionView/EntityBoardCard.tsx +6 -6
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +12 -11
- package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +40 -190
- package/src/components/EntityCollectionView/EntityCollectionListView.tsx +54 -183
- package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +6 -6
- package/src/components/EntityEditView.tsx +5 -4
- package/src/components/EntityEditViewFormActions.tsx +32 -26
- package/src/components/HomePage/ContentHomePage.tsx +13 -4
- package/src/components/RebaseCMS.tsx +3 -2
- package/src/components/RebaseNavigation.tsx +71 -7
- package/src/components/SelectableTable/SelectableTable.tsx +2 -2
- package/src/components/SideDialogs.tsx +0 -7
- package/src/components/common/default_entity_actions.tsx +9 -9
- package/src/contexts/BreacrumbsContext.tsx +15 -6
- package/src/editor/selectors/ai-selector.tsx +0 -1
- package/src/form/EntityForm.tsx +191 -428
- package/src/form/EntityFormActions.tsx +33 -47
- package/src/form/EntityFormBinding.tsx +323 -0
- package/src/form/components/FormLayout.tsx +1 -1
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +7 -2
- package/src/form/form_utils.ts +163 -0
- package/src/form/index.tsx +14 -5
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
- package/src/hooks/navigation/contexts/NavigationStateContext.tsx +2 -2
- package/src/hooks/navigation/contexts/UrlContext.tsx +1 -2
- package/src/hooks/navigation/useAsyncResolver.ts +100 -0
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +15 -8
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +12 -8
- package/src/hooks/navigation/useNavigationResolution.ts +33 -0
- package/src/hooks/navigation/useResolvedCollections.ts +29 -71
- package/src/hooks/navigation/useResolvedViews.tsx +40 -70
- package/src/hooks/navigation/useTopLevelNavigation.ts +20 -16
- package/src/hooks/navigation/utils.ts +7 -4
- package/src/index.ts +5 -0
- package/src/routes/CustomViewRoute.tsx +14 -6
- package/src/types/components/EntityFormActionsProps.tsx +1 -1
- package/src/types/components/EntityFormProps.tsx +68 -0
- package/src/types/fields.tsx +7 -1
- package/src/util/dataControllerAdapter.ts +93 -0
- package/src/util/navigation_utils.ts +1 -1
- package/src/util/propertyConfigMapper.ts +134 -0
- package/LICENSE +0 -21
- package/dist/CollectionEditorDialog-HNXGxXdO.js.map +0 -1
- package/dist/CollectionsStudioView-B1mN33GB.js.map +0 -1
- package/dist/PropertyEditView-C2wp8kQ9.js.map +0 -1
- package/dist/components/EntityCollectionView/Board.d.ts +0 -3
- package/dist/components/EntityCollectionView/BoardColumn.d.ts +0 -42
- package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +0 -9
- package/dist/components/EntityCollectionView/BoardSortableList.d.ts +0 -14
- package/dist/components/EntityCollectionView/board_types.d.ts +0 -105
- package/dist/hooks/navigation/useNavigationRegistry.d.ts +0 -12
- package/dist/hooks/navigation/useNavigationURLs.d.ts +0 -11
- package/dist/src-BYniefVu.js.map +0 -1
- package/src/components/EntityCollectionView/Board.tsx +0 -475
- package/src/components/EntityCollectionView/BoardColumn.tsx +0 -165
- package/src/components/EntityCollectionView/BoardColumnTitle.tsx +0 -46
- package/src/components/EntityCollectionView/BoardSortableList.tsx +0 -177
- package/src/components/EntityCollectionView/board_types.ts +0 -113
- package/src/hooks/navigation/useNavigationRegistry.ts +0 -164
- package/src/hooks/navigation/useNavigationURLs.ts +0 -56
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { Ct as
|
|
3
|
-
import { a as updatePropertyFromWidget, c as useAIModifiedPaths, i as supportedFields, n as PropertyForm, o as PropertyTree, r as PropertyFormDialog, s as AIModifiedPathsProvider } from "./PropertyEditView-
|
|
2
|
+
import { At as useImportConfig, Bt as getFieldId, Ct as useCollectionEditorController, Et as convertDataToEntity, Ft as PropertyConfigBadge, Gn as useCollectionRegistryController, Mt as ImportFileUpload, Qn as EntityCollectionTable, Tt as DataNewPropertiesMapping, Un as useNavigationStateController, Vn as useUrlController, Zn as useSelectionController, fn as SearchIconsView, h as toSerializableCollection, i as namespaceToPropertiesOrderPath, jt as ImportSaveInProgress, kt as getInferenceType, n as getFullIdPath, pn as FieldCaption, r as idToPropertiesPath, s as CollectionGenerationApiError, t as getFullId, u as validateCollectionJson, v as useCollectionsConfigController, wt as ImportNewPropertyFieldPreview, zt as getFieldConfig } from "./src-DOX2nOyh.js";
|
|
3
|
+
import { a as updatePropertyFromWidget, c as useAIModifiedPaths, i as supportedFields, l as useSafeSnackbarController, n as PropertyForm, o as PropertyTree, r as PropertyFormDialog, s as AIModifiedPathsProvider } from "./PropertyEditView-C9yhLyja.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Alert, AppWindow, ArrowLeftIcon, BooleanSwitchWithLabel, Button, Card, CheckIcon, Chip, CircularProgress, CircularProgressCenter, CodeIcon, ColumnsIcon, Container, CopyIcon, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, FileIcon, FileSearchIcon, FileTextIcon, IconButton, KanbanIcon, KeyIcon, LayoutGridIcon, ListIcon, LoadingButton, Menu, MultiSelect, MultiSelectItem, PanelLeftIcon, Paper, PlusIcon, Select, SelectItem, ShoppingCartIcon, SquareIcon, Tab, TableIcon, Tabs, TextField, ToggleButtonGroup, Tooltip, Trash2Icon, Typography, UserIcon, XIcon, cls, coolIconKeys, defaultBorderMixin, iconSize } from "@rebasepro/ui";
|
|
7
7
|
import { getSubcollections, getTableName, isPropertyBuilder, removeInitialAndTrailingSlashes } from "@rebasepro/common";
|
|
8
|
-
import { AIIcon, ConfirmationDialog, ErrorView, IconForView, UnsavedChangesDialog, useAuthController, useCustomizationController, useLargeLayout, useRebaseContext,
|
|
8
|
+
import { AIIcon, ConfirmationDialog, ErrorView, IconForView, UnsavedChangesDialog, useAuthController, useCustomizationController, useLargeLayout, useRebaseContext, useUnsavedChangesDialog } from "@rebasepro/core";
|
|
9
9
|
import { Field, Formex, clone, getIn, useCreateFormex, useFormex } from "@rebasepro/formex";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { camelCase, isEmptyObject, mergeDeep, prettifyIdentifier, randomString, removeUndefined, singular, slugify, toSnakeCase, unslugify } from "@rebasepro/utils";
|
|
@@ -22,12 +22,11 @@ var CollectionEditorSchema = z.object({
|
|
|
22
22
|
});
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx
|
|
25
|
-
function GeneralSettingsForm({ isNewCollection, existingPaths, existingIds, parentCollection }) {
|
|
25
|
+
function GeneralSettingsForm({ isNewCollection, existingPaths, existingIds, parentCollection, renderExtraCollectionFields, standalone }) {
|
|
26
26
|
const { values, setFieldValue, handleChange, touched, errors, setFieldTouched, submitCount } = useFormex();
|
|
27
27
|
const [iconDialogOpen, setIconDialogOpen] = useState(false);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const configController = useCollectionsConfigController();
|
|
28
|
+
const configControllerFromContext = useCollectionsConfigController();
|
|
29
|
+
const configController = standalone ? { readOnly: false } : configControllerFromContext;
|
|
31
30
|
const updateDatabaseId = (databaseId) => {
|
|
32
31
|
setFieldValue("databaseId", databaseId ?? void 0);
|
|
33
32
|
};
|
|
@@ -176,6 +175,16 @@ function GeneralSettingsForm({ isNewCollection, existingPaths, existingIds, pare
|
|
|
176
175
|
}
|
|
177
176
|
})
|
|
178
177
|
})
|
|
178
|
+
}),
|
|
179
|
+
renderExtraCollectionFields && /* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: "mt-4",
|
|
181
|
+
children: renderExtraCollectionFields({
|
|
182
|
+
metadata: values.metadata ?? {},
|
|
183
|
+
onMetadataChange: (key, value) => {
|
|
184
|
+
setFieldValue(`metadata.${key}`, value);
|
|
185
|
+
},
|
|
186
|
+
collection: toSerializableCollection(values)
|
|
187
|
+
})
|
|
179
188
|
})
|
|
180
189
|
]
|
|
181
190
|
})
|
|
@@ -447,12 +456,12 @@ function KanbanConfigSection({ className, forceExpanded }) {
|
|
|
447
456
|
}
|
|
448
457
|
//#endregion
|
|
449
458
|
//#region src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx
|
|
450
|
-
function DisplaySettingsForm({ expandKanban }) {
|
|
459
|
+
function DisplaySettingsForm({ expandKanban, standalone }) {
|
|
451
460
|
const { values, setFieldValue, handleChange, submitCount } = useFormex();
|
|
452
461
|
const [orderPropertyDialogOpen, setOrderPropertyDialogOpen] = useState(false);
|
|
453
|
-
useAuthController();
|
|
454
462
|
const customizationController = useCustomizationController();
|
|
455
|
-
const
|
|
463
|
+
const configControllerFromContext = useCollectionsConfigController();
|
|
464
|
+
const configController = standalone ? { readOnly: false } : configControllerFromContext;
|
|
456
465
|
const textProperties = useMemo(() => {
|
|
457
466
|
const result = [];
|
|
458
467
|
if (!values.properties) return result;
|
|
@@ -520,7 +529,7 @@ function DisplaySettingsForm({ expandKanban }) {
|
|
|
520
529
|
if (!prop) return "Select a property";
|
|
521
530
|
return /* @__PURE__ */ jsxs("div", {
|
|
522
531
|
className: "flex items-center gap-2",
|
|
523
|
-
children: [/* @__PURE__ */ jsx(PropertyConfigBadge, { propertyConfig: getFieldConfig(prop.property, customizationController
|
|
532
|
+
children: [/* @__PURE__ */ jsx(PropertyConfigBadge, { propertyConfig: getFieldConfig(prop.property, customizationController?.propertyConfigs ?? {}) }), /* @__PURE__ */ jsx("span", { children: prop.label })]
|
|
524
533
|
});
|
|
525
534
|
},
|
|
526
535
|
endAdornment: values.orderProperty ? /* @__PURE__ */ jsx(IconButton, {
|
|
@@ -532,7 +541,7 @@ function DisplaySettingsForm({ expandKanban }) {
|
|
|
532
541
|
children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.smallest })
|
|
533
542
|
}) : void 0,
|
|
534
543
|
children: textProperties.map((prop) => {
|
|
535
|
-
const fieldConfig = getFieldConfig(prop.property, customizationController
|
|
544
|
+
const fieldConfig = getFieldConfig(prop.property, customizationController?.propertyConfigs ?? {});
|
|
536
545
|
return /* @__PURE__ */ jsx(SelectItem, {
|
|
537
546
|
value: prop.key,
|
|
538
547
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -582,7 +591,7 @@ function DisplaySettingsForm({ expandKanban }) {
|
|
|
582
591
|
autoUpdateId: false,
|
|
583
592
|
inArray: false,
|
|
584
593
|
allowDataInference: false,
|
|
585
|
-
propertyConfigs: customizationController
|
|
594
|
+
propertyConfigs: customizationController?.propertyConfigs ?? {},
|
|
586
595
|
existingPropertyKeys: Object.keys(values.properties ?? {}),
|
|
587
596
|
onPropertyChanged: ({ id, property }) => {
|
|
588
597
|
const newProperties = {
|
|
@@ -672,7 +681,7 @@ function DisplaySettingsForm({ expandKanban }) {
|
|
|
672
681
|
//#endregion
|
|
673
682
|
//#region src/collection_editor/ui/collection_editor/GetCodeDialog.tsx
|
|
674
683
|
function GetCodeDialog({ collection, onOpenChange, open }) {
|
|
675
|
-
const snackbarController =
|
|
684
|
+
const snackbarController = useSafeSnackbarController();
|
|
676
685
|
const code = collection ? "import { EntityCollection } from \"@rebasepro/core\";\n\nconst " + (collection?.name ? camelCase(collection.name) : "my") + "Collection:EntityCollection = " + JSON5.stringify(collectionToCode({ ...collection }), null, " ") : "No collection selected";
|
|
677
686
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
678
687
|
open,
|
|
@@ -714,7 +723,7 @@ function GetCodeDialog({ collection, onOpenChange, open }) {
|
|
|
714
723
|
onClick: (e) => {
|
|
715
724
|
e.stopPropagation();
|
|
716
725
|
e.preventDefault();
|
|
717
|
-
snackbarController
|
|
726
|
+
snackbarController?.open({
|
|
718
727
|
type: "success",
|
|
719
728
|
message: "Copied"
|
|
720
729
|
});
|
|
@@ -767,12 +776,13 @@ function collectionToCode(collection) {
|
|
|
767
776
|
}
|
|
768
777
|
//#endregion
|
|
769
778
|
//#region src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx
|
|
770
|
-
function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyErrorsRef, onPropertyError, setDirty, extraIcon, getUser, getData, doCollectionInference, propertyConfigs }) {
|
|
779
|
+
function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyErrorsRef, onPropertyError, setDirty, extraIcon, getUser, getData, doCollectionInference, propertyConfigs, propertyTypePresets, hiddenPropertyTypes, renderExtraPropertyFields, standalone }) {
|
|
771
780
|
const { values, setFieldValue, setFieldError, setFieldTouched, errors, dirty } = useFormex();
|
|
772
|
-
const snackbarController =
|
|
773
|
-
const
|
|
781
|
+
const snackbarController = useSafeSnackbarController();
|
|
782
|
+
const configControllerFromContext = useCollectionsConfigController();
|
|
783
|
+
const configController = standalone ? { readOnly: false } : configControllerFromContext;
|
|
774
784
|
const largeLayout = useLargeLayout();
|
|
775
|
-
const asDialog = !largeLayout;
|
|
785
|
+
const asDialog = standalone ? false : !largeLayout;
|
|
776
786
|
const [selectedPropertyIndex, setSelectedPropertyIndex] = useState();
|
|
777
787
|
const [selectedPropertyKey, setSelectedPropertyKey] = useState();
|
|
778
788
|
const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState();
|
|
@@ -798,7 +808,7 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
798
808
|
}
|
|
799
809
|
promise.then((newCollection) => {
|
|
800
810
|
if (!newCollection) {
|
|
801
|
-
snackbarController
|
|
811
|
+
snackbarController?.open?.({
|
|
802
812
|
type: "error",
|
|
803
813
|
message: "Could not infer properties from data"
|
|
804
814
|
});
|
|
@@ -841,7 +851,7 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
841
851
|
const allNewPropertyKeys = findNewPropertyKeys(values.properties, newCollection.properties);
|
|
842
852
|
const newTopLevelPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : []).filter((propertyKey) => !values.properties[propertyKey]);
|
|
843
853
|
if (allNewPropertyKeys.length === 0) {
|
|
844
|
-
snackbarController
|
|
854
|
+
snackbarController?.open?.({
|
|
845
855
|
type: "info",
|
|
846
856
|
message: "No new properties found in existing data"
|
|
847
857
|
});
|
|
@@ -852,7 +862,7 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
852
862
|
setFieldValue("properties", updatedProperties, false);
|
|
853
863
|
updatePropertiesOrder(updatedPropertiesOrder);
|
|
854
864
|
setInferredPropertyKeys(allNewPropertyKeys);
|
|
855
|
-
snackbarController
|
|
865
|
+
snackbarController?.open?.({
|
|
856
866
|
type: "success",
|
|
857
867
|
message: `Added ${allNewPropertyKeys.length} new ${allNewPropertyKeys.length === 1 ? "property" : "properties"}`
|
|
858
868
|
});
|
|
@@ -953,85 +963,90 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
953
963
|
};
|
|
954
964
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
955
965
|
/* @__PURE__ */ jsxs("div", {
|
|
956
|
-
className: "grid grid-cols-12
|
|
966
|
+
className: "grid grid-cols-12 h-full bg-surface-50 dark:bg-surface-800",
|
|
957
967
|
children: [
|
|
958
968
|
/* @__PURE__ */ jsxs("div", {
|
|
959
|
-
className: cls("
|
|
960
|
-
children: [
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
969
|
+
className: cls("col-span-12 lg:col-span-5 h-full flex flex-col bg-surface-50 dark:bg-surface-800", !asDialog && "border-r " + defaultBorderMixin),
|
|
970
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
971
|
+
className: cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px] shrink-0", defaultBorderMixin),
|
|
972
|
+
children: [
|
|
973
|
+
/* @__PURE__ */ jsx("div", {
|
|
974
|
+
className: "flex-grow min-w-0 pr-2",
|
|
975
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
976
|
+
name: "name",
|
|
977
|
+
as: DebouncedTextField,
|
|
978
|
+
invisible: true,
|
|
979
|
+
className: "-ml-1",
|
|
980
|
+
inputClassName: "text-sm font-semibold truncate bg-transparent border-0 outline-none focus:ring-0",
|
|
981
|
+
placeholder: "Collection name",
|
|
982
|
+
size: "small",
|
|
983
|
+
required: true,
|
|
984
|
+
error: Boolean(errors?.name)
|
|
985
|
+
})
|
|
986
|
+
}),
|
|
987
|
+
extraIcon && /* @__PURE__ */ jsx("div", {
|
|
988
|
+
className: "flex-shrink-0",
|
|
989
|
+
children: extraIcon
|
|
990
|
+
}),
|
|
991
|
+
/* @__PURE__ */ jsxs("div", {
|
|
992
|
+
className: "flex items-center gap-1.5 flex-shrink-0 ml-2",
|
|
993
|
+
children: [inferPropertiesFromData && /* @__PURE__ */ jsx(Tooltip, {
|
|
994
|
+
title: "Add new properties based on data",
|
|
995
|
+
asChild: true,
|
|
996
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
973
997
|
size: "small",
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
title: "Add new property",
|
|
1000
|
-
asChild: true,
|
|
1001
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
1002
|
-
disabled: configController?.readOnly,
|
|
1003
|
-
onClick: () => setNewPropertyDialogOpen(true),
|
|
1004
|
-
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
1005
|
-
})
|
|
1006
|
-
})]
|
|
998
|
+
disabled: inferringProperties,
|
|
999
|
+
onClick: inferPropertiesFromData,
|
|
1000
|
+
children: inferringProperties ? /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" }) : /* @__PURE__ */ jsx(FileSearchIcon, { size: iconSize.smallest })
|
|
1001
|
+
})
|
|
1002
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
1003
|
+
title: "Add new property",
|
|
1004
|
+
asChild: true,
|
|
1005
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1006
|
+
size: "small",
|
|
1007
|
+
disabled: configController?.readOnly,
|
|
1008
|
+
onClick: () => setNewPropertyDialogOpen(true),
|
|
1009
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { size: iconSize.smallest })
|
|
1010
|
+
})
|
|
1011
|
+
})]
|
|
1012
|
+
})
|
|
1013
|
+
]
|
|
1014
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1015
|
+
className: "flex-grow overflow-y-auto p-3 no-scrollbar space-y-3 bg-surface-50 dark:bg-surface-800",
|
|
1016
|
+
children: [
|
|
1017
|
+
owner && /* @__PURE__ */ jsx("div", {
|
|
1018
|
+
className: "px-1 py-0.5",
|
|
1019
|
+
children: /* @__PURE__ */ jsxs(Typography, {
|
|
1020
|
+
variant: "body2",
|
|
1021
|
+
color: "secondary",
|
|
1022
|
+
children: ["Created by ", owner.displayName]
|
|
1007
1023
|
})
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
]
|
|
1024
|
+
}),
|
|
1025
|
+
/* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyTree, {
|
|
1026
|
+
inferredPropertyKeys,
|
|
1027
|
+
selectedPropertyKey: selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : void 0,
|
|
1028
|
+
properties: values.properties,
|
|
1029
|
+
additionalFields: values.additionalFields,
|
|
1030
|
+
propertiesOrder: usedPropertiesOrder,
|
|
1031
|
+
onPropertyClick,
|
|
1032
|
+
onPropertyMove,
|
|
1033
|
+
onPropertyRemove: (isNewCollection || inferredPropertyKeys && inferredPropertyKeys.length > 0) && !configController?.readOnly ? deleteProperty : void 0,
|
|
1034
|
+
errors
|
|
1035
|
+
}) }),
|
|
1036
|
+
/* @__PURE__ */ jsx(Button, {
|
|
1037
|
+
className: "w-full",
|
|
1038
|
+
variant: "outlined",
|
|
1039
|
+
color: "neutral",
|
|
1040
|
+
disabled: configController?.readOnly,
|
|
1041
|
+
onClick: () => setNewPropertyDialogOpen(true),
|
|
1042
|
+
startIcon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
1043
|
+
children: "Add new property"
|
|
1044
|
+
})
|
|
1045
|
+
]
|
|
1046
|
+
})]
|
|
1032
1047
|
}),
|
|
1033
1048
|
!asDialog && /* @__PURE__ */ jsx("div", {
|
|
1034
|
-
className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto",
|
|
1049
|
+
className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto bg-surface-50 dark:bg-surface-800",
|
|
1035
1050
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1036
1051
|
className: "sticky top-8 min-h-full w-full flex flex-col justify-center",
|
|
1037
1052
|
children: [
|
|
@@ -1050,7 +1065,11 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
1050
1065
|
forceShowErrors: showErrors,
|
|
1051
1066
|
initialErrors,
|
|
1052
1067
|
getData,
|
|
1053
|
-
propertyConfigs
|
|
1068
|
+
propertyConfigs,
|
|
1069
|
+
propertyTypePresets,
|
|
1070
|
+
hiddenPropertyTypes,
|
|
1071
|
+
renderExtraPropertyFields,
|
|
1072
|
+
collectionValues: values
|
|
1054
1073
|
}, `edit_view_${selectedPropertyIndex}_${generationCounter}`),
|
|
1055
1074
|
!selectedProperty && /* @__PURE__ */ jsxs("div", {
|
|
1056
1075
|
className: "w-full flex flex-col items-center justify-center h-full gap-4",
|
|
@@ -1089,6 +1108,10 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
1089
1108
|
initialErrors,
|
|
1090
1109
|
getData,
|
|
1091
1110
|
propertyConfigs,
|
|
1111
|
+
propertyTypePresets,
|
|
1112
|
+
hiddenPropertyTypes,
|
|
1113
|
+
renderExtraPropertyFields,
|
|
1114
|
+
collectionValues: values,
|
|
1092
1115
|
onCancel: closePropertyDialog,
|
|
1093
1116
|
onOkClicked: asDialog ? closePropertyDialog : void 0
|
|
1094
1117
|
}, `edit_view_${selectedPropertyIndex}_${generationCounter}`)
|
|
@@ -1106,6 +1129,10 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
|
|
|
1106
1129
|
getData,
|
|
1107
1130
|
allowDataInference: !isNewCollection,
|
|
1108
1131
|
propertyConfigs,
|
|
1132
|
+
propertyTypePresets,
|
|
1133
|
+
hiddenPropertyTypes,
|
|
1134
|
+
renderExtraPropertyFields,
|
|
1135
|
+
collectionValues: values,
|
|
1109
1136
|
existingPropertyKeys: values.propertiesOrder
|
|
1110
1137
|
}),
|
|
1111
1138
|
/* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(GetCodeDialog, {
|
|
@@ -1693,7 +1720,7 @@ function AICollectionGeneratorPopover({ existingCollection, onGenerated, generat
|
|
|
1693
1720
|
const [error, setError] = useState(null);
|
|
1694
1721
|
const collectionRegistry = useCollectionRegistryController();
|
|
1695
1722
|
const configController = useCollectionsConfigController();
|
|
1696
|
-
const snackbarController =
|
|
1723
|
+
const snackbarController = useSafeSnackbarController();
|
|
1697
1724
|
const existingCollections = collectionRegistry.collections ?? [];
|
|
1698
1725
|
const handleGenerate = async () => {
|
|
1699
1726
|
if (!prompt.trim()) return;
|
|
@@ -1725,7 +1752,7 @@ function AICollectionGeneratorPopover({ existingCollection, onGenerated, generat
|
|
|
1725
1752
|
mode,
|
|
1726
1753
|
operationsCount: result.operations?.length
|
|
1727
1754
|
});
|
|
1728
|
-
snackbarController
|
|
1755
|
+
snackbarController?.open({
|
|
1729
1756
|
type: "success",
|
|
1730
1757
|
message: existingCollection ? "Collection updated with AI suggestions" : "Collection generated successfully"
|
|
1731
1758
|
});
|
|
@@ -1737,7 +1764,7 @@ function AICollectionGeneratorPopover({ existingCollection, onGenerated, generat
|
|
|
1737
1764
|
mode,
|
|
1738
1765
|
error: errorMessage
|
|
1739
1766
|
});
|
|
1740
|
-
snackbarController
|
|
1767
|
+
snackbarController?.open({
|
|
1741
1768
|
type: "error",
|
|
1742
1769
|
message: errorMessage
|
|
1743
1770
|
});
|
|
@@ -2961,6 +2988,7 @@ function CollectionEditorDialog(props) {
|
|
|
2961
2988
|
fullHeight: true,
|
|
2962
2989
|
scrollable: false,
|
|
2963
2990
|
maxWidth: "7xl",
|
|
2991
|
+
className: "bg-surface-50 dark:bg-surface-800",
|
|
2964
2992
|
onOpenChange: (open) => !open ? handleCancel() : void 0,
|
|
2965
2993
|
children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
2966
2994
|
hidden: true,
|
|
@@ -2973,12 +3001,14 @@ function CollectionEditorDialog(props) {
|
|
|
2973
3001
|
});
|
|
2974
3002
|
}
|
|
2975
3003
|
function CollectionEditor(props) {
|
|
2976
|
-
const {
|
|
3004
|
+
const { standalone } = props;
|
|
3005
|
+
const customizationController = useCustomizationController();
|
|
2977
3006
|
const navigationState = useNavigationStateController();
|
|
2978
3007
|
const collectionRegistry = useCollectionRegistryController();
|
|
2979
3008
|
const authController = useAuthController();
|
|
2980
|
-
const
|
|
2981
|
-
|
|
3009
|
+
const propertyConfigs = standalone ? customizationController?.propertyConfigs ?? {} : customizationController.propertyConfigs;
|
|
3010
|
+
standalone ? navigationState?.topLevelNavigation : navigationState.topLevelNavigation;
|
|
3011
|
+
const collections = standalone ? collectionRegistry?.collections ?? [] : collectionRegistry.collections;
|
|
2982
3012
|
const initialValuesProp = props.initialValues;
|
|
2983
3013
|
const copyFromProp = props.copyFrom;
|
|
2984
3014
|
const includeTemplates = !copyFromProp && !initialValuesProp?.slug && (props.parentCollectionSlugs ?? []).length === 0;
|
|
@@ -2989,10 +3019,14 @@ function CollectionEditor(props) {
|
|
|
2989
3019
|
const [initialLoadingCompleted, setInitialLoadingCompleted] = React$1.useState(false);
|
|
2990
3020
|
useEffect(() => {
|
|
2991
3021
|
try {
|
|
2992
|
-
|
|
3022
|
+
const initialised = (standalone ? true : collectionRegistry?.initialised ?? true) && !props.configController?.loading;
|
|
3023
|
+
const getRawCollection = standalone ? (() => void 0) : collectionRegistry.getRawCollection;
|
|
3024
|
+
if (initialised) {
|
|
2993
3025
|
if (props.editedCollectionId) {
|
|
2994
3026
|
const collectionPath = [...props.parentCollectionSlugs ?? [], props.editedCollectionId].reduce((acc, segment, i) => i === 0 ? segment : `${acc}/fake_id/${segment}`, "");
|
|
2995
|
-
|
|
3027
|
+
const registryCol = getRawCollection ? getRawCollection(collectionPath) : void 0;
|
|
3028
|
+
const configCol = props.configController?.collections?.find((c) => c.slug === props.editedCollectionId);
|
|
3029
|
+
setCollection(registryCol ?? configCol);
|
|
2996
3030
|
} else setCollection(void 0);
|
|
2997
3031
|
setInitialLoadingCompleted(true);
|
|
2998
3032
|
}
|
|
@@ -3003,31 +3037,49 @@ function CollectionEditor(props) {
|
|
|
3003
3037
|
props.editedCollectionId,
|
|
3004
3038
|
props.parentCollectionSlugs,
|
|
3005
3039
|
props.parentEntityIds,
|
|
3040
|
+
standalone,
|
|
3006
3041
|
collectionRegistry.initialised,
|
|
3007
|
-
collectionRegistry.getRawCollection
|
|
3042
|
+
collectionRegistry.getRawCollection,
|
|
3043
|
+
props.configController.collections,
|
|
3044
|
+
props.configController.loading,
|
|
3045
|
+
collections
|
|
3008
3046
|
]);
|
|
3009
|
-
const
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3047
|
+
const initialIcon = React$1.useMemo(() => coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)], []);
|
|
3048
|
+
const fallbackSlug = React$1.useMemo(() => randomString(16), []);
|
|
3049
|
+
const initialCollection = React$1.useMemo(() => {
|
|
3050
|
+
return collection ? {
|
|
3051
|
+
...collection,
|
|
3052
|
+
slug: collection.slug ?? fallbackSlug
|
|
3053
|
+
} : void 0;
|
|
3054
|
+
}, [collection, fallbackSlug]);
|
|
3055
|
+
const initialValues = React$1.useMemo(() => {
|
|
3056
|
+
return initialCollection ? applyPropertyConfigs(initialCollection, propertyConfigs) : copyFromProp ? (() => {
|
|
3057
|
+
const { subcollections: _sub, ...rest } = copyFromProp;
|
|
3058
|
+
return {
|
|
3059
|
+
...rest,
|
|
3060
|
+
name: "",
|
|
3061
|
+
ownerId: authController.user?.uid ?? ""
|
|
3062
|
+
};
|
|
3063
|
+
})() : {
|
|
3064
|
+
slug: initialValuesProp?.slug ?? fallbackSlug,
|
|
3065
|
+
table: initialValuesProp?.slug ?? "",
|
|
3066
|
+
name: initialValuesProp?.name ?? "",
|
|
3067
|
+
properties: {},
|
|
3068
|
+
propertiesOrder: [],
|
|
3069
|
+
icon: initialIcon,
|
|
3018
3070
|
ownerId: authController.user?.uid ?? ""
|
|
3019
3071
|
};
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3072
|
+
}, [
|
|
3073
|
+
initialCollection,
|
|
3074
|
+
propertyConfigs,
|
|
3075
|
+
copyFromProp,
|
|
3076
|
+
initialValuesProp,
|
|
3077
|
+
fallbackSlug,
|
|
3078
|
+
initialIcon,
|
|
3079
|
+
authController.user?.uid
|
|
3080
|
+
]);
|
|
3029
3081
|
if (!initialLoadingCompleted) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
3030
|
-
if (!props.isNewCollection && (!collectionRegistry
|
|
3082
|
+
if (!props.isNewCollection && (!(standalone ? true : collectionRegistry?.initialised ?? true) || !initialLoadingCompleted)) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
3031
3083
|
return /* @__PURE__ */ jsx(CollectionEditorInternal, {
|
|
3032
3084
|
...props,
|
|
3033
3085
|
initialValues,
|
|
@@ -3039,13 +3091,33 @@ function CollectionEditor(props) {
|
|
|
3039
3091
|
propertyConfigs
|
|
3040
3092
|
});
|
|
3041
3093
|
}
|
|
3042
|
-
function CollectionEditorInternal({ isNewCollection, configController, editedCollectionId, parentCollectionSlugs, parentEntityIds, path, collectionInference, handleClose, extraView, handleCancel, setFormDirty, getUser, parentCollection, getData, existingPaths, existingIds, includeTemplates, collection, setCollection, initialValues, propertyConfigs, existingEntities, initialView: initialViewProp, expandKanban, generateCollection, onAnalyticsEvent, fullScreen, unmappedTables, onFetchTableMetadata }) {
|
|
3043
|
-
const
|
|
3044
|
-
const
|
|
3045
|
-
const
|
|
3046
|
-
const
|
|
3094
|
+
function CollectionEditorInternal({ isNewCollection, configController, editedCollectionId, parentCollectionSlugs, parentEntityIds, path, collectionInference, handleClose, extraView, handleCancel, setFormDirty, getUser, parentCollection, getData, existingPaths, existingIds, includeTemplates, collection, setCollection, initialValues, propertyConfigs, existingEntities, initialView: initialViewProp, expandKanban, generateCollection, onAnalyticsEvent, fullScreen, unmappedTables, onFetchTableMetadata, propertyTypePresets, hiddenPropertyTypes, renderExtraPropertyFields, renderExtraCollectionFields, visibleTabs, standalone }) {
|
|
3095
|
+
const importConfigRaw = useImportConfig();
|
|
3096
|
+
const urlControllerRaw = useUrlController();
|
|
3097
|
+
const collectionRegistryRaw = useCollectionRegistryController();
|
|
3098
|
+
const snackbarControllerRaw = useSafeSnackbarController();
|
|
3099
|
+
const importConfig = standalone ? void 0 : importConfigRaw;
|
|
3100
|
+
const urlController = standalone ? {
|
|
3101
|
+
basePath: "/",
|
|
3102
|
+
baseCollectionPath: "/c",
|
|
3103
|
+
urlPathToDataPath: () => "",
|
|
3104
|
+
homeUrl: "/",
|
|
3105
|
+
isUrlCollectionPath: () => false,
|
|
3106
|
+
buildUrlCollectionPath: () => "",
|
|
3107
|
+
buildAppUrlPath: () => "",
|
|
3108
|
+
resolveDatabasePathsFrom: (p) => p,
|
|
3109
|
+
navigate: () => {}
|
|
3110
|
+
} : urlControllerRaw;
|
|
3111
|
+
const collectionRegistryInternal = standalone ? { convertIdsToPaths: (ids) => ids } : collectionRegistryRaw;
|
|
3112
|
+
const snackbarController = snackbarControllerRaw ?? {
|
|
3113
|
+
open: () => {},
|
|
3114
|
+
close: () => {}
|
|
3115
|
+
};
|
|
3047
3116
|
const propertyErrorsRef = useRef({});
|
|
3048
3117
|
const [currentView, setCurrentView] = useState(isNewCollection ? includeTemplates ? "welcome" : "general" : initialViewProp ?? "properties");
|
|
3118
|
+
useEffect(() => {
|
|
3119
|
+
if (visibleTabs && !visibleTabs.includes(currentView)) setCurrentView(visibleTabs[0] || "general");
|
|
3120
|
+
}, [visibleTabs, currentView]);
|
|
3049
3121
|
const [error, setError] = React$1.useState();
|
|
3050
3122
|
const saveCollection = (updatedCollection) => {
|
|
3051
3123
|
const id = updatedCollection.slug;
|
|
@@ -3068,7 +3140,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3068
3140
|
});
|
|
3069
3141
|
};
|
|
3070
3142
|
const setNextMode = () => {
|
|
3071
|
-
if (currentView === "general") if (importConfig
|
|
3143
|
+
if (currentView === "general") if (importConfig?.inUse) setCurrentView("import_data_saving");
|
|
3072
3144
|
else if (extraView) setCurrentView("extra_view");
|
|
3073
3145
|
else setCurrentView("properties");
|
|
3074
3146
|
else if (currentView === "welcome") setCurrentView("general");
|
|
@@ -3131,7 +3203,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3131
3203
|
if (currentView === "welcome") {
|
|
3132
3204
|
setNextMode();
|
|
3133
3205
|
formexController.resetForm({ values: newCollectionState });
|
|
3134
|
-
} else if (currentView === "general") if (extraView || importConfig
|
|
3206
|
+
} else if (currentView === "general") if (extraView || importConfig?.inUse) {
|
|
3135
3207
|
formexController.resetForm({ values: newCollectionState });
|
|
3136
3208
|
setNextMode();
|
|
3137
3209
|
} else if (isNewCollection) {
|
|
@@ -3204,7 +3276,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3204
3276
|
const { values, setFieldValue, isSubmitting, dirty, submitCount } = formController;
|
|
3205
3277
|
const usedPath = getTableName(values);
|
|
3206
3278
|
const pathError = validatePath(usedPath, isNewCollection, existingPaths, values.slug);
|
|
3207
|
-
const parentPaths = !pathError && parentCollectionSlugs ?
|
|
3279
|
+
const parentPaths = !pathError && parentCollectionSlugs ? collectionRegistryInternal.convertIdsToPaths(parentCollectionSlugs) : void 0;
|
|
3208
3280
|
const updatedFullPath = parentPaths && parentPaths.length > 0 ? [...parentPaths, usedPath].join("/fake_id/") : path?.includes("/") ? path.split("/").slice(0, -1).join("/") + "/" + usedPath : usedPath;
|
|
3209
3281
|
const resolvedPath = !pathError ? urlController.resolveDatabasePathsFrom(updatedFullPath) : void 0;
|
|
3210
3282
|
const getDataWithPath = resolvedPath && getData ? async () => {
|
|
@@ -3219,15 +3291,15 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3219
3291
|
setFormDirty(dirty);
|
|
3220
3292
|
}, [dirty]);
|
|
3221
3293
|
function onImportDataSet(data, propertiesOrder) {
|
|
3222
|
-
importConfig
|
|
3294
|
+
importConfig?.setInUse(true);
|
|
3223
3295
|
buildEntityPropertiesFromData(data, getInferenceType).then((properties) => {
|
|
3224
3296
|
const res = cleanPropertiesFromImport(properties);
|
|
3225
|
-
importConfig
|
|
3226
|
-
importConfig
|
|
3227
|
-
importConfig
|
|
3297
|
+
importConfig?.setIdColumn(res.idColumn);
|
|
3298
|
+
importConfig?.setImportData(data);
|
|
3299
|
+
importConfig?.setHeadersMapping(res.headersMapping);
|
|
3228
3300
|
const filteredHeadingsOrder = (propertiesOrder ?? []).filter((key) => res.headersMapping[key]) ?? Object.keys(res.properties);
|
|
3229
|
-
importConfig
|
|
3230
|
-
importConfig
|
|
3301
|
+
importConfig?.setHeadingsOrder(filteredHeadingsOrder);
|
|
3302
|
+
importConfig?.setOriginProperties(res.properties);
|
|
3231
3303
|
const mappedHeadings = (propertiesOrder ?? []).map((key) => res.headersMapping[key]).filter(Boolean) ?? Object.keys(res.properties);
|
|
3232
3304
|
setFieldValue("properties", res.properties);
|
|
3233
3305
|
setFieldValue("propertiesOrder", mappedHeadings);
|
|
@@ -3236,7 +3308,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3236
3308
|
const validValues = Boolean(values.name) && Boolean(values.slug);
|
|
3237
3309
|
const onImportMappingComplete = () => {
|
|
3238
3310
|
const updatedProperties = { ...values.properties };
|
|
3239
|
-
if (importConfig
|
|
3311
|
+
if (importConfig?.idColumn) delete updatedProperties[importConfig.idColumn];
|
|
3240
3312
|
setFieldValue("properties", updatedProperties);
|
|
3241
3313
|
setNextMode();
|
|
3242
3314
|
};
|
|
@@ -3264,11 +3336,11 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3264
3336
|
if (operations && aiModifiedPaths) aiModifiedPaths.addModifiedPaths(operations);
|
|
3265
3337
|
};
|
|
3266
3338
|
return /* @__PURE__ */ jsxs("div", {
|
|
3267
|
-
className: "h-full w-full flex flex-col bg-
|
|
3339
|
+
className: "h-full w-full flex flex-col bg-surface-50 dark:bg-surface-800",
|
|
3268
3340
|
children: [/* @__PURE__ */ jsx(Formex, {
|
|
3269
3341
|
value: formController,
|
|
3270
3342
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [!isNewCollection && /* @__PURE__ */ jsxs("div", {
|
|
3271
|
-
className: cls("px-4 py-2 w-full flex shrink-0 items-center justify-between gap-4 bg-surface-50 dark:bg-surface-
|
|
3343
|
+
className: cls("px-4 py-2 w-full flex shrink-0 items-center justify-between gap-4 bg-surface-50 dark:bg-surface-900 border-b", defaultBorderMixin),
|
|
3272
3344
|
children: [/* @__PURE__ */ jsx("div", {
|
|
3273
3345
|
className: "flex flex-1 items-center justify-end gap-4 min-w-0",
|
|
3274
3346
|
children: /* @__PURE__ */ jsxs(Tabs, {
|
|
@@ -3276,19 +3348,19 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3276
3348
|
className: "bg-transparent !w-fit max-w-full",
|
|
3277
3349
|
onValueChange: (v) => setCurrentView(v),
|
|
3278
3350
|
children: [
|
|
3279
|
-
/* @__PURE__ */ jsx(Tab, {
|
|
3351
|
+
(!visibleTabs || visibleTabs.includes("general")) && /* @__PURE__ */ jsx(Tab, {
|
|
3280
3352
|
value: "general",
|
|
3281
3353
|
children: "General"
|
|
3282
3354
|
}),
|
|
3283
|
-
/* @__PURE__ */ jsx(Tab, {
|
|
3355
|
+
(!visibleTabs || visibleTabs.includes("display")) && /* @__PURE__ */ jsx(Tab, {
|
|
3284
3356
|
value: "display",
|
|
3285
3357
|
children: "Display"
|
|
3286
3358
|
}),
|
|
3287
|
-
/* @__PURE__ */ jsx(Tab, {
|
|
3359
|
+
(!visibleTabs || visibleTabs.includes("properties")) && /* @__PURE__ */ jsx(Tab, {
|
|
3288
3360
|
value: "properties",
|
|
3289
3361
|
children: "Properties"
|
|
3290
3362
|
}),
|
|
3291
|
-
getDataSourceCapabilities(values.driver).supportsRLS && /* @__PURE__ */ jsx(Tab, {
|
|
3363
|
+
(!visibleTabs || visibleTabs.includes("rls")) && getDataSourceCapabilities(values.driver).supportsRLS && /* @__PURE__ */ jsx(Tab, {
|
|
3292
3364
|
value: "rls",
|
|
3293
3365
|
children: "RLS"
|
|
3294
3366
|
})
|
|
@@ -3319,7 +3391,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3319
3391
|
onSubmit: formController.handleSubmit,
|
|
3320
3392
|
className: "flex-grow flex flex-col min-h-0 relative",
|
|
3321
3393
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
3322
|
-
className: "flex-grow flex flex-col min-h-0
|
|
3394
|
+
className: "flex-grow flex flex-col min-h-0 no-scrollbar relative w-full h-full bg-surface-50 dark:bg-surface-800",
|
|
3323
3395
|
children: [
|
|
3324
3396
|
currentView === "loading" && /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
3325
3397
|
currentView === "extra_view" && usedPath && extraView?.View && /* @__PURE__ */ jsx(extraView.View, { path: usedPath }),
|
|
@@ -3373,12 +3445,17 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3373
3445
|
}
|
|
3374
3446
|
}),
|
|
3375
3447
|
currentView === "general" && /* @__PURE__ */ jsx(GeneralSettingsForm, {
|
|
3448
|
+
isNewCollection,
|
|
3376
3449
|
existingPaths,
|
|
3377
3450
|
existingIds,
|
|
3378
3451
|
parentCollection,
|
|
3379
|
-
|
|
3452
|
+
renderExtraCollectionFields,
|
|
3453
|
+
standalone
|
|
3454
|
+
}),
|
|
3455
|
+
currentView === "display" && /* @__PURE__ */ jsx(DisplaySettingsForm, {
|
|
3456
|
+
expandKanban,
|
|
3457
|
+
standalone
|
|
3380
3458
|
}),
|
|
3381
|
-
currentView === "display" && /* @__PURE__ */ jsx(DisplaySettingsForm, { expandKanban }),
|
|
3382
3459
|
currentView === "rls" && getDataSourceCapabilities(values.driver).supportsRLS && /* @__PURE__ */ jsx(CollectionRLSTab, {}),
|
|
3383
3460
|
currentView === "properties" && /* @__PURE__ */ jsx(CollectionPropertiesEditorForm, {
|
|
3384
3461
|
showErrors: submitCount > 0,
|
|
@@ -3394,22 +3471,26 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
3394
3471
|
getData: getDataWithPath,
|
|
3395
3472
|
doCollectionInference,
|
|
3396
3473
|
propertyConfigs,
|
|
3474
|
+
propertyTypePresets,
|
|
3475
|
+
hiddenPropertyTypes,
|
|
3476
|
+
renderExtraPropertyFields,
|
|
3397
3477
|
extraIcon: extraView?.icon && /* @__PURE__ */ jsx(IconButton, {
|
|
3398
3478
|
color: "primary",
|
|
3399
3479
|
onClick: () => setCurrentView("extra_view"),
|
|
3400
3480
|
children: extraView.icon
|
|
3401
|
-
})
|
|
3481
|
+
}),
|
|
3482
|
+
standalone
|
|
3402
3483
|
})
|
|
3403
3484
|
]
|
|
3404
3485
|
}), (!fullScreen || isNewCollection || !!error) && /* @__PURE__ */ jsxs("div", {
|
|
3405
|
-
className: "shrink-0 w-full p-4 sm:px-6 sm:py-4 border-t border-surface-200 dark:border-surface-900 flex items-center justify-between gap-4 bg-
|
|
3486
|
+
className: "shrink-0 w-full p-4 sm:px-6 sm:py-4 border-t border-surface-200 dark:border-surface-900 flex items-center justify-between gap-4 bg-surface-50 dark:bg-surface-900",
|
|
3406
3487
|
children: [
|
|
3407
3488
|
error && /* @__PURE__ */ jsx(ErrorView, { error }),
|
|
3408
3489
|
isNewCollection && includeTemplates && currentView === "import_data_mapping" && /* @__PURE__ */ jsx(Button, {
|
|
3409
3490
|
variant: "text",
|
|
3410
3491
|
type: "button",
|
|
3411
3492
|
onClick: () => {
|
|
3412
|
-
importConfig
|
|
3493
|
+
importConfig?.setInUse(false);
|
|
3413
3494
|
return setCurrentView("welcome");
|
|
3414
3495
|
},
|
|
3415
3496
|
children: "Back"
|
|
@@ -3546,4 +3627,4 @@ var validateId = (value, isNewCollection, existingPaths, existingIds) => {
|
|
|
3546
3627
|
//#endregion
|
|
3547
3628
|
export { CollectionEditorDialog as n, CollectionEditorDialog_exports as r, CollectionEditor as t };
|
|
3548
3629
|
|
|
3549
|
-
//# sourceMappingURL=CollectionEditorDialog-
|
|
3630
|
+
//# sourceMappingURL=CollectionEditorDialog-iGgS4rLX.js.map
|