@rebasepro/cms 0.24.0 → 0.24.1-canary.gcb918fc
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/README.md +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +4 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-CcFSXvkK.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +42 -59
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-DjQoRrIU.js → data_import/import/ImportCollectionAction.js} +53 -43
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +7 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3147
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +24 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +2 -1
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +4 -2
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3867
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +2 -1
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +93 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +4 -3
- package/dist/{util-D7ebttKT.js → preview/util.js} +8 -5
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +5 -0
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-p5-I-Apu.js +0 -3669
- package/dist/CollectionEditorDialog-p5-I-Apu.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-DDB_X-00.js +0 -3837
- package/dist/PropertyEditView-DDB_X-00.js.map +0 -1
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js +0 -212
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js.map +0 -1
- package/dist/SchemaChangeDialog-CcFSXvkK.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-DCHuPD1a.js +0 -520
- package/dist/export-DCHuPD1a.js.map +0 -1
- package/dist/history-CBd6SBRs.js +0 -314
- package/dist/history-CBd6SBRs.js.map +0 -1
- package/dist/import-DjQoRrIU.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-BRvKFMLa.js +0 -27773
- package/dist/util-BRvKFMLa.js.map +0 -1
- package/dist/util-D7ebttKT.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch_export_data.js","names":[],"sources":["../../../src/data_export/export/fetch_export_data.ts"],"sourcesContent":["import { Entity, FindParams, MAX_LIST_LIMIT } from \"@rebasepro/types\";\nimport { EntityPageAccessor, forEachEntityPage, walkEntityPages } from \"../../util/entity_pages\";\n\n/**\n * Rows asked for per request: the server's `MAX_LIST_LIMIT`, the largest page a\n * read will serve — it *refuses* anything larger. (It used to clamp silently,\n * and asking for 100 000 while receiving 1 000 looked exactly like a collection\n * with 1 000 rows in it.) The walk still never trusts the page size it asked\n * for: it advances by the rows it was actually handed. It was 500, which made a\n * 100 000-row export 200 sequential requests, each with its own count.\n */\nexport const EXPORT_PAGE_SIZE = MAX_LIST_LIMIT;\n\n/**\n * Most rows one browser-side export will materialise.\n *\n * Everything here is built in memory and handed to a Blob, so there is a\n * ceiling whether or not it is named. Naming it means going over it **throws**\n * instead of writing a short file that reads like the whole collection.\n */\nexport const MAX_EXPORT_ROWS = 100_000;\n\nexport interface FetchAllForExportParams<M extends Record<string, unknown>> {\n /** The collection accessor to read through — `dataClient.collection(path)`. */\n accessor: EntityPageAccessor<M>;\n /** Query to export. The window (`limit` / `offset` / `page`) is owned by the walk. */\n params?: Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\">;\n pageSize?: number;\n maxRows?: number;\n /** Called after every page with the rows so far, and the total when the server reports one. */\n onProgress?: (loaded: number, total: number | undefined) => void;\n}\n\n/**\n * Read **every** row matching a query, for an export file.\n *\n * The export used to hand back the 50 rows an unwindowed `find({})` resolves to\n * as `<collection>.csv`, with nothing saying it was a sample, next to a dialog\n * warning that the collection had 100 000 documents. The walk is in\n * {@link walkEntityPages}; what belongs to export is the ceiling — an export is\n * built in memory and handed to a Blob — and what to say on hitting it.\n *\n * @throws When more than `maxRows` rows match.\n */\nexport async function fetchAllEntitiesForExport<M extends Record<string, unknown>>({\n accessor,\n params,\n pageSize = EXPORT_PAGE_SIZE,\n maxRows = MAX_EXPORT_ROWS,\n onProgress\n}: FetchAllForExportParams<M>): Promise<Entity<M>[]> {\n return walkEntityPages<M>({\n accessor,\n params,\n pageSize,\n maxRows,\n onProgress,\n onCeiling: exportCeilingMessage\n });\n}\n\n/**\n * {@link fetchAllEntitiesForExport}, handing each page to `onPage` as it is\n * read instead of collecting every row: for an export that writes its file as\n * it goes (CSV), so that what it holds is the file and one page, not every\n * entity in it.\n *\n * @throws When more than `maxRows` rows match.\n */\nexport async function forEachEntityPageForExport<M extends Record<string, unknown>>({\n accessor,\n params,\n pageSize = EXPORT_PAGE_SIZE,\n maxRows = MAX_EXPORT_ROWS,\n onProgress,\n onPage\n}: FetchAllForExportParams<M> & {\n onPage: (page: Entity<M>[]) => void | Promise<void>;\n}): Promise<void> {\n return forEachEntityPage<M>({\n accessor,\n params,\n pageSize,\n maxRows,\n onProgress,\n onPage,\n onCeiling: exportCeilingMessage\n });\n}\n\nfunction exportCeilingMessage(max: number): string {\n return `This export would contain more than ${max.toLocaleString()} rows, which is more than the ` +\n \"browser can build in one file. Filter the collection down, or export it from the server.\";\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,mBAAmB;;;;;;;;AAShC,IAAa,kBAAkB;;;;;;;;;;;;AAwB/B,eAAsB,0BAA6D,EAC/E,UACA,QACA,WAAW,kBACX,UAAU,iBACV,cACiD;CACjD,OAAO,gBAAmB;EACtB;EACA;EACA;EACA;EACA;EACA,WAAW;CACf,CAAC;AACL;;;;;;;;;AAUA,eAAsB,2BAA8D,EAChF,UACA,QACA,WAAW,kBACX,UAAU,iBACV,YACA,UAGc;CACd,OAAO,kBAAqB;EACxB;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;CACf,CAAC;AACL;AAEA,SAAS,qBAAqB,KAAqB;CAC/C,OAAO,uCAAuC,IAAI,eAAe,EAAE;AAEvE"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { downloadEntitiesExport, getEntityCSVExportableData, getEntityJsonExportableData, escapeCsvFormula, unescapeCsvFormula, entryToCSVRow, downloadBlob, downloadDataAsCsv } from "./export.js";
|
|
2
|
+
export type { DownloadEntitiesExportParams } from "./export.js";
|
|
3
|
+
export { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport } from "./fetch_export_data.js";
|
|
4
|
+
export type { FetchAllForExportParams } from "./fetch_export_data.js";
|
|
3
5
|
export * from "./BasicExportAction.js";
|
|
4
6
|
export * from "./ExportCollectionAction.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula } from "./export.js";
|
|
2
|
+
import { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport } from "./fetch_export_data.js";
|
|
3
|
+
import { BasicExportAction } from "./BasicExportAction.js";
|
|
4
|
+
import { ExportCollectionAction } from "./ExportCollectionAction.js";
|
|
5
|
+
export { BasicExportAction, EXPORT_PAGE_SIZE, ExportCollectionAction, MAX_EXPORT_ROWS, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, fetchAllEntitiesForExport, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { getPropertyInPath as getPropertyInPath$1 } from "../../util/property_utils.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { BooleanSwitchWithLabel, ChevronRightIcon, DateTimeField, ExpandablePanel, Select, SelectItem, Table, TableBody, TableCell, TableHeader, TableRow, TextField, Typography } from "@rebasepro/ui";
|
|
4
|
+
import { useTranslation } from "@rebasepro/app";
|
|
5
|
+
import { getIn, setIn } from "@rebasepro/forms";
|
|
6
|
+
//#region src/data_import/components/DataNewPropertiesMapping.tsx
|
|
7
|
+
function DataNewPropertiesMapping({ importConfig, destinationProperties, buildPropertyView }) {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const headersMapping = importConfig.headersMapping;
|
|
10
|
+
const headingsOrder = importConfig.headingsOrder;
|
|
11
|
+
const idColumn = importConfig.idColumn;
|
|
12
|
+
const originProperties = importConfig.originProperties;
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(IdSelectField, {
|
|
15
|
+
idColumn,
|
|
16
|
+
headersMapping,
|
|
17
|
+
onChange: (value) => importConfig.setIdColumn(value ?? void 0)
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("div", { className: "h-4" }),
|
|
20
|
+
/* @__PURE__ */ jsxs(Table, {
|
|
21
|
+
style: { tableLayout: "fixed" },
|
|
22
|
+
children: [/* @__PURE__ */ jsxs(TableHeader, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
24
|
+
header: true,
|
|
25
|
+
style: { width: "20%" },
|
|
26
|
+
children: "Column in file"
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ jsx(TableCell, { header: true }),
|
|
29
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
30
|
+
header: true,
|
|
31
|
+
style: { width: "75%" },
|
|
32
|
+
children: "Map to Property"
|
|
33
|
+
})
|
|
34
|
+
] }), /* @__PURE__ */ jsx(TableBody, { children: destinationProperties && headingsOrder.map((importKey) => {
|
|
35
|
+
const mappedKey = headersMapping[importKey];
|
|
36
|
+
const propertyKey = headersMapping[importKey];
|
|
37
|
+
const property = mappedKey ? getPropertyInPath$1(destinationProperties, mappedKey) : null;
|
|
38
|
+
const originProperty = getPropertyInPath$1(originProperties, importKey);
|
|
39
|
+
const origintype = originProperty ? originProperty.type === "array" && typeof originProperty.of === "object" ? `${originProperty.type} - ${originProperty.of.type}` : originProperty.type : void 0;
|
|
40
|
+
return /* @__PURE__ */ jsxs(TableRow, {
|
|
41
|
+
style: { height: "90px" },
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(TableCell, {
|
|
44
|
+
style: { width: "20%" },
|
|
45
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
46
|
+
variant: "body2",
|
|
47
|
+
children: importKey
|
|
48
|
+
}), originProperty && /* @__PURE__ */ jsx(Typography, {
|
|
49
|
+
variant: "caption",
|
|
50
|
+
color: "secondary",
|
|
51
|
+
children: origintype
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) }),
|
|
55
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
56
|
+
className: importKey === idColumn ? "text-center" : void 0,
|
|
57
|
+
style: { width: "75%" },
|
|
58
|
+
children: buildPropertyView?.({
|
|
59
|
+
isIdColumn: importKey === idColumn,
|
|
60
|
+
property,
|
|
61
|
+
propertyKey,
|
|
62
|
+
importKey
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}, importKey);
|
|
67
|
+
}) })]
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsxs(ExpandablePanel, {
|
|
70
|
+
title: "Default values",
|
|
71
|
+
initiallyExpanded: false,
|
|
72
|
+
innerClassName: "p-4 mt-4",
|
|
73
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
74
|
+
className: "text-sm text-surface-accent-500 dark:text-surface-accent-300 font-medium ml-3.5 mb-1",
|
|
75
|
+
children: "You can select a default value for unmapped columns and empty values:"
|
|
76
|
+
}), /* @__PURE__ */ jsxs(Table, {
|
|
77
|
+
style: { tableLayout: "fixed" },
|
|
78
|
+
children: [/* @__PURE__ */ jsxs(TableHeader, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
80
|
+
header: true,
|
|
81
|
+
style: { width: "30%" },
|
|
82
|
+
children: "Property"
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx(TableCell, { header: true }),
|
|
85
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
86
|
+
header: true,
|
|
87
|
+
style: { width: "65%" },
|
|
88
|
+
children: t("default_value")
|
|
89
|
+
})
|
|
90
|
+
] }), /* @__PURE__ */ jsx(TableBody, { children: destinationProperties && getAllPropertyKeys(destinationProperties).map((key) => {
|
|
91
|
+
const property = getPropertyInPath$1(destinationProperties, key);
|
|
92
|
+
if (typeof property !== "object" || property === null) return null;
|
|
93
|
+
if (![
|
|
94
|
+
"number",
|
|
95
|
+
"string",
|
|
96
|
+
"boolean",
|
|
97
|
+
"map"
|
|
98
|
+
].includes(property.type)) return null;
|
|
99
|
+
return /* @__PURE__ */ jsxs(TableRow, {
|
|
100
|
+
style: { height: "70px" },
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
103
|
+
style: { width: "20%" },
|
|
104
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
105
|
+
variant: "body2",
|
|
106
|
+
children: key
|
|
107
|
+
})
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) }),
|
|
110
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
111
|
+
className: key === idColumn ? "text-center" : void 0,
|
|
112
|
+
style: { width: "75%" },
|
|
113
|
+
children: /* @__PURE__ */ jsx(DefaultValuesField, {
|
|
114
|
+
property,
|
|
115
|
+
defaultValue: getIn(importConfig.defaultValues, key),
|
|
116
|
+
onValueChange: (value) => {
|
|
117
|
+
const newValues = setIn(importConfig.defaultValues, key, value);
|
|
118
|
+
importConfig.setDefaultValues(newValues);
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
}, key);
|
|
124
|
+
}) })]
|
|
125
|
+
})]
|
|
126
|
+
})
|
|
127
|
+
] });
|
|
128
|
+
}
|
|
129
|
+
function getAllPropertyKeys(properties, currentKey) {
|
|
130
|
+
return Object.entries(properties).reduce((acc, [key, property]) => {
|
|
131
|
+
const accumulatedKey = currentKey ? `${currentKey}.${key}` : key;
|
|
132
|
+
if (typeof property !== "function" && property.type === "map" && property.properties) {
|
|
133
|
+
const childProperties = getAllPropertyKeys(property.properties, accumulatedKey);
|
|
134
|
+
return [...acc, ...childProperties];
|
|
135
|
+
}
|
|
136
|
+
return [...acc, accumulatedKey];
|
|
137
|
+
}, []);
|
|
138
|
+
}
|
|
139
|
+
function IdSelectField({ idColumn, headersMapping, onChange }) {
|
|
140
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Select, {
|
|
141
|
+
size: "medium",
|
|
142
|
+
value: idColumn ?? "",
|
|
143
|
+
fullWidth: true,
|
|
144
|
+
onChange: (event) => {
|
|
145
|
+
const value = event.target.value;
|
|
146
|
+
onChange(value === "__none__" ? null : value);
|
|
147
|
+
},
|
|
148
|
+
placeholder: "Autogenerate ID",
|
|
149
|
+
renderValue: (value) => {
|
|
150
|
+
return /* @__PURE__ */ jsx(Typography, {
|
|
151
|
+
variant: "body2",
|
|
152
|
+
children: value !== "__none__" ? value : "Autogenerate ID"
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
label: "Column that will be used as ID for each document",
|
|
156
|
+
children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
157
|
+
value: "__none__",
|
|
158
|
+
children: "Autogenerate ID"
|
|
159
|
+
}), Object.entries(headersMapping).map(([key, value]) => {
|
|
160
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
161
|
+
value: key,
|
|
162
|
+
children: key
|
|
163
|
+
}, key);
|
|
164
|
+
})]
|
|
165
|
+
}) });
|
|
166
|
+
}
|
|
167
|
+
function DefaultValuesField({ property, onValueChange, defaultValue }) {
|
|
168
|
+
const { t } = useTranslation();
|
|
169
|
+
const defaultValueLabel = t("default_value");
|
|
170
|
+
const ariaLabel = property.name ? `${defaultValueLabel}: ${property.name}` : defaultValueLabel;
|
|
171
|
+
if (property.type === "string") return /* @__PURE__ */ jsx(TextField, {
|
|
172
|
+
size: "medium",
|
|
173
|
+
"aria-label": ariaLabel,
|
|
174
|
+
placeholder: defaultValueLabel,
|
|
175
|
+
value: defaultValue ?? "",
|
|
176
|
+
onChange: (event) => onValueChange(event.target.value)
|
|
177
|
+
});
|
|
178
|
+
else if (property.type === "number") return /* @__PURE__ */ jsx(TextField, {
|
|
179
|
+
size: "medium",
|
|
180
|
+
type: "number",
|
|
181
|
+
"aria-label": ariaLabel,
|
|
182
|
+
value: defaultValue ?? "",
|
|
183
|
+
placeholder: defaultValueLabel,
|
|
184
|
+
onChange: (event) => onValueChange(event.target.value)
|
|
185
|
+
});
|
|
186
|
+
else if (property.type === "boolean") return /* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
|
|
187
|
+
value: defaultValue ?? null,
|
|
188
|
+
allowIndeterminate: true,
|
|
189
|
+
size: "small",
|
|
190
|
+
onValueChange: (v) => onValueChange(v === null ? void 0 : v),
|
|
191
|
+
label: defaultValue === void 0 ? "Do not set value" : defaultValue === true ? "Set value to true" : "Set value to false"
|
|
192
|
+
});
|
|
193
|
+
else if (property.type === "date") return /* @__PURE__ */ jsx(DateTimeField, {
|
|
194
|
+
mode: property.mode ?? "date",
|
|
195
|
+
size: "medium",
|
|
196
|
+
value: defaultValue ?? void 0,
|
|
197
|
+
onChange: (dateValue) => {
|
|
198
|
+
onValueChange(dateValue);
|
|
199
|
+
},
|
|
200
|
+
clearable: true
|
|
201
|
+
});
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { DataNewPropertiesMapping };
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=DataNewPropertiesMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataNewPropertiesMapping.js","names":[],"sources":["../../../src/data_import/components/DataNewPropertiesMapping.tsx"],"sourcesContent":["\nimport { getPropertyInPath } from \"../../util\";\nimport { Properties, Property } from \"@rebasepro/types\";\nimport {\n BooleanSwitchWithLabel,\n ChevronRightIcon,\n DateTimeField,\n ExpandablePanel,\n Select,\n SelectItem,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n TextField,\n Typography\n} from \"@rebasepro/ui\";\nimport { getIn, setIn } from \"@rebasepro/forms\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport { ImportConfig } from \"../types\";\n\nexport interface DataPropertyMappingProps {\n importConfig: ImportConfig;\n destinationProperties: Record<string, Property>;\n buildPropertyView?: (props: {\n isIdColumn: boolean,\n property: Property | null,\n propertyKey: string | null,\n importKey: string\n }) => any;\n}\n\nexport function DataNewPropertiesMapping({\n importConfig,\n destinationProperties,\n buildPropertyView\n}: DataPropertyMappingProps) {\n\n const { t } = useTranslation();\n const headersMapping = importConfig.headersMapping;\n const headingsOrder = importConfig.headingsOrder;\n const idColumn = importConfig.idColumn;\n const originProperties = importConfig.originProperties;\n\n return (\n <>\n\n <IdSelectField idColumn={idColumn}\n headersMapping={headersMapping}\n onChange={(value) => importConfig.setIdColumn(value ?? undefined)}/>\n\n <div className={\"h-4\"}/>\n\n <Table style={{\n tableLayout: \"fixed\"\n }}>\n <TableHeader>\n <TableCell header={true} style={{ width: \"20%\" }}>\n Column in file\n </TableCell>\n <TableCell header={true}>\n </TableCell>\n <TableCell header={true} style={{ width: \"75%\" }}>\n Map to Property\n </TableCell>\n </TableHeader>\n <TableBody>\n {destinationProperties &&\n headingsOrder.map((importKey) => {\n const mappedKey = headersMapping[importKey];\n const propertyKey = headersMapping[importKey];\n const property = mappedKey ? getPropertyInPath(destinationProperties, mappedKey) as Property : null;\n\n const originProperty = getPropertyInPath(originProperties, importKey) as Property | undefined;\n const origintype = originProperty\n ? (originProperty.type === \"array\" && typeof originProperty.of === \"object\"\n ? `${originProperty.type} - ${(originProperty.of as Property).type}`\n : originProperty.type)\n : undefined;\n return <TableRow key={importKey} style={{ height: \"90px\" }}>\n <TableCell style={{ width: \"20%\" }}>\n <Typography variant={\"body2\"}>{importKey}</Typography>\n {originProperty && <Typography\n variant={\"caption\"}\n color={\"secondary\"}\n >{origintype}</Typography>}\n </TableCell>\n <TableCell>\n <ChevronRightIcon/>\n </TableCell>\n <TableCell className={importKey === idColumn ? \"text-center\" : undefined}\n style={{ width: \"75%\" }}>\n {buildPropertyView?.({\n isIdColumn: importKey === idColumn,\n property,\n propertyKey,\n importKey\n })}\n </TableCell>\n </TableRow>;\n }\n )}\n </TableBody>\n </Table>\n\n <ExpandablePanel title=\"Default values\" initiallyExpanded={false} innerClassName={\"p-4 mt-4\"}>\n\n <div className={\"text-sm text-surface-accent-500 dark:text-surface-accent-300 font-medium ml-3.5 mb-1\"}>\n You can select a default value for unmapped columns and empty values:\n </div>\n <Table style={{\n tableLayout: \"fixed\"\n }}>\n <TableHeader>\n <TableCell header={true} style={{ width: \"30%\" }}>\n Property\n </TableCell>\n <TableCell header={true}>\n </TableCell>\n <TableCell header={true} style={{ width: \"65%\" }}>\n {t(\"default_value\")}\n </TableCell>\n </TableHeader>\n <TableBody>\n {destinationProperties &&\n getAllPropertyKeys(destinationProperties).map((key) => {\n const property = getPropertyInPath(destinationProperties, key);\n if (typeof property !== \"object\" || property === null) {\n return null;\n }\n if (![\"number\", \"string\", \"boolean\", \"map\"].includes(property.type)) {\n return null;\n }\n return <TableRow key={key} style={{ height: \"70px\" }}>\n <TableCell style={{ width: \"20%\" }}>\n <Typography variant={\"body2\"}>{key}</Typography>\n </TableCell>\n <TableCell>\n <ChevronRightIcon/>\n </TableCell>\n <TableCell className={key === idColumn ? \"text-center\" : undefined}\n style={{ width: \"75%\" }}>\n <DefaultValuesField property={property}\n defaultValue={getIn(importConfig.defaultValues, key)}\n onValueChange={(value) => {\n const newValues = setIn(importConfig.defaultValues, key, value);\n importConfig.setDefaultValues(newValues as Record<string, any>);\n }}/>\n </TableCell>\n </TableRow>;\n }\n )}\n </TableBody>\n </Table>\n </ExpandablePanel>\n </>\n );\n}\n\nfunction getAllPropertyKeys(properties: Properties, currentKey?: string): string[] {\n return Object.entries(properties).reduce((acc, [key, property]) => {\n const accumulatedKey = currentKey ? `${currentKey}.${key}` : key;\n if (typeof property !== \"function\" && property.type === \"map\" && property.properties) {\n const childProperties = getAllPropertyKeys(property.properties, accumulatedKey);\n return [...acc, ...childProperties];\n }\n return [...acc, accumulatedKey];\n }, [] as string[]);\n}\n\nfunction IdSelectField({\n idColumn,\n headersMapping,\n onChange\n}: {\n idColumn?: string,\n headersMapping: Record<string, string | null>;\n onChange: (value: string | null) => void\n}) {\n return <div>\n <Select\n size={\"medium\"}\n value={idColumn ?? \"\"}\n fullWidth={true}\n onChange={(event) => {\n const value = event.target.value;\n onChange(value === \"__none__\" ? null : value);\n }}\n placeholder={\"Autogenerate ID\"}\n renderValue={(value) => {\n return <Typography variant={\"body2\"}>\n {value !== \"__none__\" ? value : \"Autogenerate ID\"}\n </Typography>;\n }}\n label={\"Column that will be used as ID for each document\"}>\n <SelectItem value={\"__none__\"}>Autogenerate ID</SelectItem>\n {Object.entries(headersMapping).map(([key, value]) => {\n return <SelectItem key={key} value={key}>{key}</SelectItem>;\n })}\n </Select>\n </div>;\n}\n\nfunction DefaultValuesField({\n property,\n onValueChange,\n defaultValue\n}: { property: Property, onValueChange: (value: any) => void, defaultValue?: any }) {\n const { t } = useTranslation();\n const defaultValueLabel = t(\"default_value\");\n // Named fields stay distinguishable from each other — several of these sit\n // in one table, and an aria-label repeated verbatim tells a screen reader\n // nothing about which row it is on.\n //\n // Composed with a separator rather than a phrase: there is no key for the\n // possessive form, and `t` returns the key itself for one that does not\n // exist, so inventing `default_value_for` here would read out the literal\n // string \"default_value_for\" in every locale, English included.\n const ariaLabel = property.name\n ? `${defaultValueLabel}: ${property.name}`\n : defaultValueLabel;\n if (property.type === \"string\") {\n return <TextField size={\"medium\"}\n aria-label={ariaLabel}\n placeholder={defaultValueLabel}\n value={defaultValue ?? \"\"}\n onChange={(event) => onValueChange(event.target.value)}/>;\n } else if (property.type === \"number\") {\n return <TextField size={\"medium\"}\n type={\"number\"}\n aria-label={ariaLabel}\n value={defaultValue ?? \"\"}\n placeholder={defaultValueLabel}\n onChange={(event) => onValueChange(event.target.value)}/>;\n } else if (property.type === \"boolean\") {\n return <BooleanSwitchWithLabel\n value={defaultValue ?? null}\n allowIndeterminate={true}\n size={\"small\"}\n onValueChange={(v: boolean | null) => onValueChange(v === null ? undefined : v)}\n label={defaultValue === undefined\n ? \"Do not set value\"\n : defaultValue === true\n ? \"Set value to true\"\n : \"Set value to false\"}\n />\n } else if (property.type === \"date\") {\n return <DateTimeField\n mode={property.mode ?? \"date\"}\n size={\"medium\"}\n value={defaultValue ?? undefined}\n onChange={(dateValue: Date | null) => {\n onValueChange(dateValue);\n }}\n clearable={true}\n />\n }\n\n return null;\n}\n"],"mappings":";;;;;;AAiCA,SAAgB,yBAAyB,EACrC,cACA,uBACA,qBACyB;CAEzB,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,iBAAiB,aAAa;CACpC,MAAM,gBAAgB,aAAa;CACnC,MAAM,WAAW,aAAa;CAC9B,MAAM,mBAAmB,aAAa;CAEtC,OACI,qBAAA,UAAA,EAAA,UAAA;EAEI,oBAAC,eAAD;GAAyB;GACL;GAChB,WAAW,UAAU,aAAa,YAAY,SAAS,KAAA,CAAS;EAAG,CAAA;EAEvE,oBAAC,OAAD,EAAK,WAAW,MAAO,CAAA;EAEvB,qBAAC,OAAD;GAAO,OAAO,EACV,aAAa,QACjB;aAFA,CAGI,qBAAC,aAAD,EAAA,UAAA;IACI,oBAAC,WAAD;KAAW,QAAQ;KAAM,OAAO,EAAE,OAAO,MAAM;eAAG;IAEvC,CAAA;IACX,oBAAC,WAAD,EAAW,QAAQ,KACR,CAAA;IACX,oBAAC,WAAD;KAAW,QAAQ;KAAM,OAAO,EAAE,OAAO,MAAM;eAAG;IAEvC,CAAA;GACF,EAAA,CAAA,GACb,oBAAC,WAAD,EAAA,UACK,yBACG,cAAc,KAAK,cAAc;IAC7B,MAAM,YAAY,eAAe;IACjC,MAAM,cAAc,eAAe;IACnC,MAAM,WAAW,YAAY,oBAAkB,uBAAuB,SAAS,IAAgB;IAE/F,MAAM,iBAAiB,oBAAkB,kBAAkB,SAAS;IACpE,MAAM,aAAa,iBACZ,eAAe,SAAS,WAAW,OAAO,eAAe,OAAO,WAC7D,GAAG,eAAe,KAAK,KAAM,eAAe,GAAgB,SAC5D,eAAe,OACnB,KAAA;IACN,OAAO,qBAAC,UAAD;KAA0B,OAAO,EAAE,QAAQ,OAAO;eAAlD;MACH,qBAAC,WAAD;OAAW,OAAO,EAAE,OAAO,MAAM;iBAAjC,CACI,oBAAC,YAAD;QAAY,SAAS;kBAAU;OAAsB,CAAA,GACpD,kBAAkB,oBAAC,YAAD;QACf,SAAS;QACT,OAAO;kBACT;OAAuB,CAAA,CAClB;;MACX,oBAAC,WAAD,EAAA,UACI,oBAAC,kBAAD,CAAkB,CAAA,EACX,CAAA;MACX,oBAAC,WAAD;OAAW,WAAW,cAAc,WAAW,gBAAgB,KAAA;OAC3D,OAAO,EAAE,OAAO,MAAM;iBACrB,oBAAoB;QACjB,YAAY,cAAc;QAC1B;QACA;QACA;OACJ,CAAC;MACM,CAAA;KACL;OApBY,SAoBZ;GACd,CACA,EACG,CAAA,CACR;;EAEP,qBAAC,iBAAD;GAAiB,OAAM;GAAiB,mBAAmB;GAAO,gBAAgB;aAAlF,CAEI,oBAAC,OAAD;IAAK,WAAW;cAAwF;GAEnG,CAAA,GACL,qBAAC,OAAD;IAAO,OAAO,EACV,aAAa,QACjB;cAFA,CAGI,qBAAC,aAAD,EAAA,UAAA;KACI,oBAAC,WAAD;MAAW,QAAQ;MAAM,OAAO,EAAE,OAAO,MAAM;gBAAG;KAEvC,CAAA;KACX,oBAAC,WAAD,EAAW,QAAQ,KACR,CAAA;KACX,oBAAC,WAAD;MAAW,QAAQ;MAAM,OAAO,EAAE,OAAO,MAAM;gBAC1C,EAAE,eAAe;KACX,CAAA;IACF,EAAA,CAAA,GACb,oBAAC,WAAD,EAAA,UACK,yBACG,mBAAmB,qBAAqB,CAAC,CAAC,KAAK,QAAQ;KACnD,MAAM,WAAW,oBAAkB,uBAAuB,GAAG;KAC7D,IAAI,OAAO,aAAa,YAAY,aAAa,MAC7C,OAAO;KAEX,IAAI,CAAC;MAAC;MAAU;MAAU;MAAW;KAAK,CAAC,CAAC,SAAS,SAAS,IAAI,GAC9D,OAAO;KAEX,OAAO,qBAAC,UAAD;MAAoB,OAAO,EAAE,QAAQ,OAAO;gBAA5C;OACH,oBAAC,WAAD;QAAW,OAAO,EAAE,OAAO,MAAM;kBAC7B,oBAAC,YAAD;SAAY,SAAS;mBAAU;QAAgB,CAAA;OACxC,CAAA;OACX,oBAAC,WAAD,EAAA,UACI,oBAAC,kBAAD,CAAkB,CAAA,EACX,CAAA;OACX,oBAAC,WAAD;QAAW,WAAW,QAAQ,WAAW,gBAAgB,KAAA;QACrD,OAAO,EAAE,OAAO,MAAM;kBACtB,oBAAC,oBAAD;SAA8B;SAC1B,cAAc,MAAM,aAAa,eAAe,GAAG;SACnD,gBAAgB,UAAU;UACtB,MAAM,YAAY,MAAM,aAAa,eAAe,KAAK,KAAK;UAC9D,aAAa,iBAAiB,SAAgC;SAClE;QAAG,CAAA;OACA,CAAA;MACL;QAhBY,GAgBZ;IACd,CACA,EACG,CAAA,CACR;KACM;;CACnB,EAAA,CAAA;AAEV;AAEA,SAAS,mBAAmB,YAAwB,YAA+B;CAC/E,OAAO,OAAO,QAAQ,UAAU,CAAC,CAAC,QAAQ,KAAK,CAAC,KAAK,cAAc;EAC/D,MAAM,iBAAiB,aAAa,GAAG,WAAW,GAAG,QAAQ;EAC7D,IAAI,OAAO,aAAa,cAAc,SAAS,SAAS,SAAS,SAAS,YAAY;GAClF,MAAM,kBAAkB,mBAAmB,SAAS,YAAY,cAAc;GAC9E,OAAO,CAAC,GAAG,KAAK,GAAG,eAAe;EACtC;EACA,OAAO,CAAC,GAAG,KAAK,cAAc;CAClC,GAAG,CAAC,CAAa;AACrB;AAEA,SAAS,cAAc,EACnB,UACA,gBACA,YAKD;CACC,OAAO,oBAAC,OAAD,EAAA,UACH,qBAAC,QAAD;EACI,MAAM;EACN,OAAO,YAAY;EACnB,WAAW;EACX,WAAW,UAAU;GACjB,MAAM,QAAQ,MAAM,OAAO;GAC3B,SAAS,UAAU,aAAa,OAAO,KAAK;EAChD;EACA,aAAa;EACb,cAAc,UAAU;GACpB,OAAO,oBAAC,YAAD;IAAY,SAAS;cACvB,UAAU,aAAa,QAAQ;GACxB,CAAA;EAChB;EACA,OAAO;YAdX,CAeI,oBAAC,YAAD;GAAY,OAAO;aAAY;EAA2B,CAAA,GACzD,OAAO,QAAQ,cAAc,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW;GAClD,OAAO,oBAAC,YAAD;IAAsB,OAAO;cAAM;GAAgB,GAAlC,GAAkC;EAC9D,CAAC,CACG;IACP,CAAA;AACT;AAEA,SAAS,mBAAmB,EACxB,UACA,eACA,gBACgF;CAChF,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,oBAAoB,EAAE,eAAe;CAS3C,MAAM,YAAY,SAAS,OACrB,GAAG,kBAAkB,IAAI,SAAS,SAClC;CACN,IAAI,SAAS,SAAS,UAClB,OAAO,oBAAC,WAAD;EAAW,MAAM;EACpB,cAAY;EACZ,aAAa;EACb,OAAO,gBAAgB;EACvB,WAAW,UAAU,cAAc,MAAM,OAAO,KAAK;CAAG,CAAA;MACzD,IAAI,SAAS,SAAS,UACzB,OAAO,oBAAC,WAAD;EAAW,MAAM;EACpB,MAAM;EACN,cAAY;EACZ,OAAO,gBAAgB;EACvB,aAAa;EACb,WAAW,UAAU,cAAc,MAAM,OAAO,KAAK;CAAG,CAAA;MACzD,IAAI,SAAS,SAAS,WACzB,OAAO,oBAAC,wBAAD;EACH,OAAO,gBAAgB;EACvB,oBAAoB;EACpB,MAAM;EACN,gBAAgB,MAAsB,cAAc,MAAM,OAAO,KAAA,IAAY,CAAC;EAC9E,OAAO,iBAAiB,KAAA,IAClB,qBACA,iBAAiB,OACb,sBACA;CACb,CAAA;MACE,IAAI,SAAS,SAAS,QACzB,OAAO,oBAAC,eAAD;EACH,MAAM,SAAS,QAAQ;EACvB,MAAM;EACN,OAAO,gBAAgB,KAAA;EACvB,WAAW,cAA2B;GAClC,cAAc,SAAS;EAC3B;EACA,WAAW;CACd,CAAA;CAGL,OAAO;AACX"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Alert, Typography } from "@rebasepro/ui";
|
|
4
|
+
import { useTranslation } from "@rebasepro/app";
|
|
5
|
+
//#region src/data_import/components/ImportConversionProblems.tsx
|
|
6
|
+
/** How many failing cells each column shows as examples. */
|
|
7
|
+
var EXAMPLES_PER_COLUMN = 3;
|
|
8
|
+
function groupByColumn(problems) {
|
|
9
|
+
const groups = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const problem of problems) {
|
|
11
|
+
const group = groups.get(problem.column) ?? {
|
|
12
|
+
column: problem.column,
|
|
13
|
+
property: problem.property,
|
|
14
|
+
expected: problem.expected,
|
|
15
|
+
problems: []
|
|
16
|
+
};
|
|
17
|
+
group.problems.push(problem);
|
|
18
|
+
groups.set(problem.column, group);
|
|
19
|
+
}
|
|
20
|
+
return Array.from(groups.values());
|
|
21
|
+
}
|
|
22
|
+
function cellText(value) {
|
|
23
|
+
if (typeof value === "string") return value;
|
|
24
|
+
if (value instanceof Date) return value.toISOString();
|
|
25
|
+
return JSON.stringify(value) ?? String(value);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The cells of an import that do not convert to the type of the field they
|
|
29
|
+
* map to — per column, how many, and the first few with their row — shown in
|
|
30
|
+
* the preview, before anything is written. Those cells are left out of the
|
|
31
|
+
* rows; nothing is turned into `null`, `0` or `false` without saying so.
|
|
32
|
+
*/
|
|
33
|
+
function ImportConversionProblems({ problems }) {
|
|
34
|
+
const { t } = useTranslation();
|
|
35
|
+
if (problems.length === 0) return null;
|
|
36
|
+
return /* @__PURE__ */ jsxs(Alert, {
|
|
37
|
+
color: "warning",
|
|
38
|
+
outerClassName: "mx-4 mt-2",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
41
|
+
variant: "body2",
|
|
42
|
+
className: "font-medium",
|
|
43
|
+
children: t("import_problems_title", { count: problems.length })
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
46
|
+
variant: "caption",
|
|
47
|
+
component: "p",
|
|
48
|
+
className: "mb-2",
|
|
49
|
+
children: t("import_problems_description")
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx("ul", {
|
|
52
|
+
className: "flex flex-col gap-1",
|
|
53
|
+
children: groupByColumn(problems).map((group) => /* @__PURE__ */ jsxs("li", { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
55
|
+
variant: "caption",
|
|
56
|
+
component: "p",
|
|
57
|
+
className: "font-medium",
|
|
58
|
+
children: t("import_problems_column", {
|
|
59
|
+
column: group.column,
|
|
60
|
+
property: group.property,
|
|
61
|
+
type: group.expected,
|
|
62
|
+
count: group.problems.length
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
65
|
+
group.problems.slice(0, EXAMPLES_PER_COLUMN).map((problem) => /* @__PURE__ */ jsx(Typography, {
|
|
66
|
+
variant: "caption",
|
|
67
|
+
component: "p",
|
|
68
|
+
className: "pl-4",
|
|
69
|
+
children: t("import_problems_example", {
|
|
70
|
+
row: problem.row + 1,
|
|
71
|
+
value: cellText(problem.value),
|
|
72
|
+
reason: t(`import_problem_${problem.reason}`)
|
|
73
|
+
})
|
|
74
|
+
}, problem.row)),
|
|
75
|
+
group.problems.length > EXAMPLES_PER_COLUMN && /* @__PURE__ */ jsx(Typography, {
|
|
76
|
+
variant: "caption",
|
|
77
|
+
component: "p",
|
|
78
|
+
className: "pl-4",
|
|
79
|
+
children: t("import_problems_more", { count: group.problems.length - EXAMPLES_PER_COLUMN })
|
|
80
|
+
})
|
|
81
|
+
] }, group.column))
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { ImportConversionProblems };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=ImportConversionProblems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportConversionProblems.js","names":[],"sources":["../../../src/data_import/components/ImportConversionProblems.tsx"],"sourcesContent":["import React from \"react\";\nimport { Alert, Typography } from \"@rebasepro/ui\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport { ImportConversionProblem } from \"../utils/data\";\n\n/** How many failing cells each column shows as examples. */\nconst EXAMPLES_PER_COLUMN = 3;\n\ntype ColumnProblems = {\n column: string;\n property: string;\n expected: string;\n problems: ImportConversionProblem[];\n};\n\nfunction groupByColumn(problems: ImportConversionProblem[]): ColumnProblems[] {\n const groups = new Map<string, ColumnProblems>();\n for (const problem of problems) {\n const group = groups.get(problem.column)\n ?? { column: problem.column, property: problem.property, expected: problem.expected, problems: [] };\n group.problems.push(problem);\n groups.set(problem.column, group);\n }\n return Array.from(groups.values());\n}\n\nfunction cellText(value: unknown): string {\n if (typeof value === \"string\") return value;\n if (value instanceof Date) return value.toISOString();\n return JSON.stringify(value) ?? String(value);\n}\n\n/**\n * The cells of an import that do not convert to the type of the field they\n * map to — per column, how many, and the first few with their row — shown in\n * the preview, before anything is written. Those cells are left out of the\n * rows; nothing is turned into `null`, `0` or `false` without saying so.\n */\nexport function ImportConversionProblems({ problems }: { problems: ImportConversionProblem[] }) {\n const { t } = useTranslation();\n if (problems.length === 0) return null;\n return <Alert color=\"warning\" outerClassName=\"mx-4 mt-2\">\n <Typography variant=\"body2\" className=\"font-medium\">\n {t(\"import_problems_title\", { count: problems.length })}\n </Typography>\n <Typography variant=\"caption\" component=\"p\" className=\"mb-2\">\n {t(\"import_problems_description\")}\n </Typography>\n <ul className=\"flex flex-col gap-1\">\n {groupByColumn(problems).map(group => <li key={group.column}>\n <Typography variant=\"caption\" component=\"p\" className=\"font-medium\">\n {t(\"import_problems_column\", {\n column: group.column,\n property: group.property,\n type: group.expected,\n count: group.problems.length\n })}\n </Typography>\n {group.problems.slice(0, EXAMPLES_PER_COLUMN).map(problem =>\n <Typography key={problem.row} variant=\"caption\" component=\"p\" className=\"pl-4\">\n {t(\"import_problems_example\", {\n row: problem.row + 1,\n value: cellText(problem.value),\n reason: t(`import_problem_${problem.reason}`)\n })}\n </Typography>)}\n {group.problems.length > EXAMPLES_PER_COLUMN &&\n <Typography variant=\"caption\" component=\"p\" className=\"pl-4\">\n {t(\"import_problems_more\", { count: group.problems.length - EXAMPLES_PER_COLUMN })}\n </Typography>}\n </li>)}\n </ul>\n </Alert>;\n}\n"],"mappings":";;;;;;AAMA,IAAM,sBAAsB;AAS5B,SAAS,cAAc,UAAuD;CAC1E,MAAM,yBAAS,IAAI,IAA4B;CAC/C,KAAK,MAAM,WAAW,UAAU;EAC5B,MAAM,QAAQ,OAAO,IAAI,QAAQ,MAAM,KAChC;GAAE,QAAQ,QAAQ;GAAQ,UAAU,QAAQ;GAAU,UAAU,QAAQ;GAAU,UAAU,CAAC;EAAE;EACtG,MAAM,SAAS,KAAK,OAAO;EAC3B,OAAO,IAAI,QAAQ,QAAQ,KAAK;CACpC;CACA,OAAO,MAAM,KAAK,OAAO,OAAO,CAAC;AACrC;AAEA,SAAS,SAAS,OAAwB;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,iBAAiB,MAAM,OAAO,MAAM,YAAY;CACpD,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;AAChD;;;;;;;AAQA,SAAgB,yBAAyB,EAAE,YAAqD;CAC5F,MAAM,EAAE,MAAM,eAAe;CAC7B,IAAI,SAAS,WAAW,GAAG,OAAO;CAClC,OAAO,qBAAC,OAAD;EAAO,OAAM;EAAU,gBAAe;YAAtC;GACH,oBAAC,YAAD;IAAY,SAAQ;IAAQ,WAAU;cACjC,EAAE,yBAAyB,EAAE,OAAO,SAAS,OAAO,CAAC;GAC9C,CAAA;GACZ,oBAAC,YAAD;IAAY,SAAQ;IAAU,WAAU;IAAI,WAAU;cACjD,EAAE,6BAA6B;GACxB,CAAA;GACZ,oBAAC,MAAD;IAAI,WAAU;cACT,cAAc,QAAQ,CAAC,CAAC,KAAI,UAAS,qBAAC,MAAD,EAAA,UAAA;KAClC,oBAAC,YAAD;MAAY,SAAQ;MAAU,WAAU;MAAI,WAAU;gBACjD,EAAE,0BAA0B;OACzB,QAAQ,MAAM;OACd,UAAU,MAAM;OAChB,MAAM,MAAM;OACZ,OAAO,MAAM,SAAS;MAC1B,CAAC;KACO,CAAA;KACX,MAAM,SAAS,MAAM,GAAG,mBAAmB,CAAC,CAAC,KAAI,YAC9C,oBAAC,YAAD;MAA8B,SAAQ;MAAU,WAAU;MAAI,WAAU;gBACnE,EAAE,2BAA2B;OAC1B,KAAK,QAAQ,MAAM;OACnB,OAAO,SAAS,QAAQ,KAAK;OAC7B,QAAQ,EAAE,kBAAkB,QAAQ,QAAQ;MAChD,CAAC;KACO,GANK,QAAQ,GAMb,CAAC;KAChB,MAAM,SAAS,SAAS,uBACrB,oBAAC,YAAD;MAAY,SAAQ;MAAU,WAAU;MAAI,WAAU;gBACjD,EAAE,wBAAwB,EAAE,OAAO,MAAM,SAAS,SAAS,oBAAoB,CAAC;KACzE,CAAA;IAChB,EAAA,GArB2C,MAAM,MAqBjD,CAAC;GACL,CAAA;EACD;;AACX"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { convertFileToJson } from "../utils/file_to_json.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FileUpload, UploadIcon } from "@rebasepro/ui";
|
|
4
|
+
import { useSnackbarController } from "@rebasepro/app";
|
|
5
|
+
//#region src/data_import/components/ImportFileUpload.tsx
|
|
6
|
+
function ImportFileUpload({ onDataAdded }) {
|
|
7
|
+
const snackbarController = useSnackbarController();
|
|
8
|
+
return /* @__PURE__ */ jsx(FileUpload, {
|
|
9
|
+
accept: {
|
|
10
|
+
"text/*": [
|
|
11
|
+
".csv",
|
|
12
|
+
".xls",
|
|
13
|
+
".xlsx"
|
|
14
|
+
],
|
|
15
|
+
"application/vnd.ms-excel": [".xls", ".xlsx"],
|
|
16
|
+
"application/msexcel": [".xls", ".xlsx"],
|
|
17
|
+
"application/vnd.ms-office": [".xls", ".xlsx"],
|
|
18
|
+
"application/xls": [".xls", ".xlsx"],
|
|
19
|
+
"application/x-xls": [".xls", ".xlsx"],
|
|
20
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xls", ".xlsx"],
|
|
21
|
+
"application/json": [".json"]
|
|
22
|
+
},
|
|
23
|
+
preventDropOnDocument: true,
|
|
24
|
+
size: "small",
|
|
25
|
+
maxFiles: 1,
|
|
26
|
+
uploadDescription: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(UploadIcon, {}), "Drag and drop a file here or click to upload"] }),
|
|
27
|
+
onFilesAdded: (files) => {
|
|
28
|
+
if (files.length > 0) convertFileToJson(files[0]).then(({ data, propertiesOrder }) => {
|
|
29
|
+
onDataAdded(data, propertiesOrder);
|
|
30
|
+
}).catch((error) => {
|
|
31
|
+
console.error("Error parsing file", error);
|
|
32
|
+
snackbarController.open({
|
|
33
|
+
type: "error",
|
|
34
|
+
message: error.message
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ImportFileUpload };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=ImportFileUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportFileUpload.js","names":[],"sources":["../../../src/data_import/components/ImportFileUpload.tsx"],"sourcesContent":["import { FileUpload, UploadIcon } from \"@rebasepro/ui\";\nimport { convertFileToJson } from \"../utils/file_to_json\";\nimport { useSnackbarController } from \"@rebasepro/app\";\n\nexport function ImportFileUpload({ onDataAdded }: {\n onDataAdded: (data: object[], propertiesOrder?: string[]) => void\n}) {\n const snackbarController = useSnackbarController();\n return <FileUpload\n accept={{\n \"text/*\": [\".csv\", \".xls\", \".xlsx\"],\n \"application/vnd.ms-excel\": [\".xls\", \".xlsx\"],\n \"application/msexcel\": [\".xls\", \".xlsx\"],\n \"application/vnd.ms-office\": [\".xls\", \".xlsx\"],\n \"application/xls\": [\".xls\", \".xlsx\"],\n \"application/x-xls\": [\".xls\", \".xlsx\"],\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": [\".xls\", \".xlsx\"],\n \"application/json\": [\".json\"]\n }}\n preventDropOnDocument={true}\n size={\"small\"}\n maxFiles={1}\n uploadDescription={<><UploadIcon/>Drag and drop a file here or click to upload</>}\n onFilesAdded={(files: File[]) => {\n if (files.length > 0) {\n convertFileToJson(files[0])\n .then(({\n data,\n propertiesOrder\n }) => {\n onDataAdded(data, propertiesOrder);\n })\n .catch((error) => {\n console.error(\"Error parsing file\", error);\n snackbarController.open({\n type: \"error\",\n message: error.message\n });\n });\n }\n }}/>\n}\n"],"mappings":";;;;;AAIA,SAAgB,iBAAiB,EAAE,eAEhC;CACC,MAAM,qBAAqB,sBAAsB;CACjD,OAAO,oBAAC,YAAD;EACH,QAAQ;GACJ,UAAU;IAAC;IAAQ;IAAQ;GAAO;GAClC,4BAA4B,CAAC,QAAQ,OAAO;GAC5C,uBAAuB,CAAC,QAAQ,OAAO;GACvC,6BAA6B,CAAC,QAAQ,OAAO;GAC7C,mBAAmB,CAAC,QAAQ,OAAO;GACnC,qBAAqB,CAAC,QAAQ,OAAO;GACrC,qEAAqE,CAAC,QAAQ,OAAO;GACrF,oBAAoB,CAAC,OAAO;EAChC;EACA,uBAAuB;EACvB,MAAM;EACN,UAAU;EACV,mBAAmB,qBAAA,UAAA,EAAA,UAAA,CAAE,oBAAC,YAAD,CAAY,CAAA,GAAC,8CAA8C,EAAA,CAAA;EAChF,eAAe,UAAkB;GAC7B,IAAI,MAAM,SAAS,GACf,kBAAkB,MAAM,EAAE,CAAC,CACtB,MAAM,EACH,MACA,sBACE;IACF,YAAY,MAAM,eAAe;GACrC,CAAC,CAAC,CACD,OAAO,UAAU;IACd,QAAQ,MAAM,sBAAsB,KAAK;IACzC,mBAAmB,KAAK;KACpB,MAAM;KACN,SAAS,MAAM;IACnB,CAAC;GACL,CAAC;EAEb;CAAG,CAAA;AACX"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getFieldConfig } from "../../components/field_configs.js";
|
|
2
|
+
import { PropertyConfigBadge } from "../../components/PropertyConfigBadge.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ErrorBoundary, IconButton, PencilIcon, TextField } from "@rebasepro/ui";
|
|
6
|
+
import { useCustomizationController, useTranslation } from "@rebasepro/app";
|
|
7
|
+
//#region src/data_import/components/ImportNewPropertyFieldPreview.tsx
|
|
8
|
+
function ImportNewPropertyFieldPreview({ propertyKey, property, onEditClick, includeName = true, onPropertyNameChanged, propertyTypeView }) {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const { propertyConfigs } = useCustomizationController();
|
|
11
|
+
const widget = property ? getFieldConfig(property, propertyConfigs) : null;
|
|
12
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: "flex flex-row w-full items-center",
|
|
14
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: "mx-4",
|
|
16
|
+
children: propertyTypeView ?? /* @__PURE__ */ jsx(PropertyConfigBadge, { propertyConfig: widget ?? void 0 })
|
|
17
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: "w-full flex flex-col grow",
|
|
19
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: "flex flex-row items-center gap-2",
|
|
21
|
+
children: [includeName && /* @__PURE__ */ jsx(TextField, {
|
|
22
|
+
size: "medium",
|
|
23
|
+
"aria-label": propertyKey ? `Name of property ${propertyKey}` : "Property name",
|
|
24
|
+
className: "text-base grow",
|
|
25
|
+
value: property?.name ?? "",
|
|
26
|
+
onChange: (e) => {
|
|
27
|
+
if (onPropertyNameChanged && propertyKey) onPropertyNameChanged(propertyKey, e.target.value);
|
|
28
|
+
}
|
|
29
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
30
|
+
"aria-label": t("edit"),
|
|
31
|
+
onClick: onEditClick,
|
|
32
|
+
size: "small",
|
|
33
|
+
children: /* @__PURE__ */ jsx(PencilIcon, {})
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
})]
|
|
37
|
+
}) });
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ImportNewPropertyFieldPreview };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=ImportNewPropertyFieldPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportNewPropertyFieldPreview.js","names":[],"sources":["../../../src/data_import/components/ImportNewPropertyFieldPreview.tsx"],"sourcesContent":["import React from \"react\";\nimport { useCustomizationController, useTranslation } from \"@rebasepro/app\";\nimport { Property } from \"@rebasepro/types\";\nimport { getFieldConfig } from \"../../components/field_configs\";\nimport { PropertyConfigBadge } from \"../../components/PropertyConfigBadge\";\nimport { ErrorBoundary, IconButton, PencilIcon, TextField } from \"@rebasepro/ui\";\n\nexport function ImportNewPropertyFieldPreview({\n propertyKey,\n property,\n onEditClick,\n includeName = true,\n onPropertyNameChanged,\n propertyTypeView\n}: {\n propertyKey: string | null,\n property: Property | null\n includeName?: boolean,\n onEditClick?: () => void,\n onPropertyNameChanged?: (propertyKey: string, value: string) => void,\n propertyTypeView?: any\n}) {\n const { t } = useTranslation();\n\n const { propertyConfigs } = useCustomizationController();\n const widget = property ? getFieldConfig(property, propertyConfigs) : null;\n\n return <ErrorBoundary>\n <div\n className=\"flex flex-row w-full items-center\">\n\n <div className={\"mx-4\"}>\n {propertyTypeView ?? <PropertyConfigBadge propertyConfig={widget ?? undefined}/>}\n </div>\n\n <div className=\"w-full flex flex-col grow\">\n\n <div className={\"flex flex-row items-center gap-2\"}>\n {includeName &&\n <TextField\n size={\"medium\"}\n aria-label={propertyKey ? `Name of property ${propertyKey}` : \"Property name\"}\n className={\"text-base grow\"}\n value={property?.name ?? \"\"}\n onChange={(e) => {\n if (onPropertyNameChanged && propertyKey)\n onPropertyNameChanged(propertyKey, e.target.value);\n }}/>}\n\n <IconButton aria-label={t(\"edit\")} onClick={onEditClick} size={\"small\"}>\n <PencilIcon/>\n </IconButton>\n </div>\n\n </div>\n\n </div>\n </ErrorBoundary>\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,8BAA8B,EAC1C,aACA,UACA,aACA,cAAc,MACd,uBACA,oBAQD;CACC,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,EAAE,oBAAoB,2BAA2B;CACvD,MAAM,SAAS,WAAW,eAAe,UAAU,eAAe,IAAI;CAEtE,OAAO,oBAAC,eAAD,EAAA,UACH,qBAAC,OAAD;EACI,WAAU;YADd,CAGI,oBAAC,OAAD;GAAK,WAAW;aACX,oBAAoB,oBAAC,qBAAD,EAAqB,gBAAgB,UAAU,KAAA,EAAW,CAAA;EAC9E,CAAA,GAEL,oBAAC,OAAD;GAAK,WAAU;aAEX,qBAAC,OAAD;IAAK,WAAW;cAAhB,CACK,eACG,oBAAC,WAAD;KACI,MAAM;KACN,cAAY,cAAc,oBAAoB,gBAAgB;KAC9D,WAAW;KACX,OAAO,UAAU,QAAQ;KACzB,WAAW,MAAM;MACb,IAAI,yBAAyB,aACzB,sBAAsB,aAAa,EAAE,OAAO,KAAK;KACzD;IAAG,CAAA,GAEX,oBAAC,YAAD;KAAY,cAAY,EAAE,MAAM;KAAG,SAAS;KAAa,MAAM;eAC3D,oBAAC,YAAD,CAAY,CAAA;IACJ,CAAA,CACX;;EAEJ,CAAA,CAEJ;IACM,CAAA;AACnB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { saveImportedEntities } from "../utils/save_entities.js";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Button, CenteredView, CircularProgress, Typography } from "@rebasepro/ui";
|
|
5
|
+
import { useData } from "@rebasepro/app";
|
|
6
|
+
//#region src/data_import/components/ImportSaveInProgress.tsx
|
|
7
|
+
function ImportSaveInProgress({ path, importConfig, collection, onImportSuccess }) {
|
|
8
|
+
const [errorSaving, setErrorSaving] = useState(void 0);
|
|
9
|
+
const dataClient = useData();
|
|
10
|
+
const savingRef = useRef(false);
|
|
11
|
+
const committedRef = useRef(0);
|
|
12
|
+
const bulkUnsupportedRef = useRef({ current: false });
|
|
13
|
+
const [processedEntities, setProcessedEntities] = useState(0);
|
|
14
|
+
function save() {
|
|
15
|
+
if (savingRef.current) return;
|
|
16
|
+
savingRef.current = true;
|
|
17
|
+
setErrorSaving(void 0);
|
|
18
|
+
saveImportedEntities(dataClient, path, importConfig.entities, {
|
|
19
|
+
offset: committedRef.current,
|
|
20
|
+
batchSize: 500,
|
|
21
|
+
onBatchCommitted: (written) => {
|
|
22
|
+
committedRef.current = written;
|
|
23
|
+
setProcessedEntities(written);
|
|
24
|
+
},
|
|
25
|
+
bulkUnsupported: bulkUnsupportedRef.current,
|
|
26
|
+
collection
|
|
27
|
+
}).then(() => {
|
|
28
|
+
onImportSuccess(collection);
|
|
29
|
+
savingRef.current = false;
|
|
30
|
+
}).catch((e) => {
|
|
31
|
+
const error = e;
|
|
32
|
+
committedRef.current = error.committed ?? committedRef.current;
|
|
33
|
+
setProcessedEntities(committedRef.current);
|
|
34
|
+
setErrorSaving(error);
|
|
35
|
+
savingRef.current = false;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
save();
|
|
40
|
+
}, []);
|
|
41
|
+
if (errorSaving) {
|
|
42
|
+
const total = importConfig.entities.length;
|
|
43
|
+
const failedRows = errorSaving.failedTo - errorSaving.failedFrom > 1 ? `rows ${errorSaving.failedFrom + 1}–${errorSaving.failedTo}` : `row ${errorSaving.failedFrom + 1}`;
|
|
44
|
+
const causeRow = errorSaving.failedRow !== void 0 ? ` Row ${errorSaving.failedRow + 1} is the one that failed.` : "";
|
|
45
|
+
return /* @__PURE__ */ jsxs(CenteredView, {
|
|
46
|
+
className: "flex flex-col gap-4 items-center",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
49
|
+
variant: "h6",
|
|
50
|
+
children: "Error saving data"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
53
|
+
variant: "body2",
|
|
54
|
+
color: "error",
|
|
55
|
+
children: errorSaving.message
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsxs(Typography, {
|
|
58
|
+
variant: "body2",
|
|
59
|
+
children: [
|
|
60
|
+
errorSaving.committed,
|
|
61
|
+
" of ",
|
|
62
|
+
total,
|
|
63
|
+
" rows were imported. The import stopped on ",
|
|
64
|
+
failedRows,
|
|
65
|
+
", which ",
|
|
66
|
+
errorSaving.failedTo - errorSaving.failedFrom > 1 ? "were" : "was",
|
|
67
|
+
" not written.",
|
|
68
|
+
causeRow
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ jsx(Button, {
|
|
72
|
+
onClick: save,
|
|
73
|
+
children: errorSaving.committed > 0 ? `Retry from row ${errorSaving.committed + 1}` : "Retry"
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
79
|
+
className: "flex flex-col gap-4 items-center",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx(CircularProgress, {}),
|
|
82
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
83
|
+
variant: "h6",
|
|
84
|
+
children: "Saving data"
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ jsxs(Typography, {
|
|
87
|
+
variant: "body2",
|
|
88
|
+
children: [
|
|
89
|
+
processedEntities,
|
|
90
|
+
"/",
|
|
91
|
+
importConfig.entities.length,
|
|
92
|
+
" entities saved"
|
|
93
|
+
]
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
96
|
+
variant: "caption",
|
|
97
|
+
children: "Do not close this tab or the import will be interrupted."
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { ImportSaveInProgress };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=ImportSaveInProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportSaveInProgress.js","names":[],"sources":["../../../src/data_import/components/ImportSaveInProgress.tsx"],"sourcesContent":["import { useData } from \"@rebasepro/app\";\nimport { Button, CenteredView, CircularProgress, Typography } from \"@rebasepro/ui\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { ImportConfig } from \"../types\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { IMPORT_BATCH_SIZE, ImportSaveError, saveImportedEntities } from \"../utils/save_entities\";\n\nexport function ImportSaveInProgress<C extends AdminCollection<any>>\n ({\n path,\n importConfig,\n collection,\n onImportSuccess\n }:\n {\n path: string,\n importConfig: ImportConfig,\n collection: C,\n onImportSuccess: (collection: C) => void\n }) {\n\n const [errorSaving, setErrorSaving] = useState<ImportSaveError | undefined>(undefined);\n const dataClient = useData();\n\n const savingRef = useRef<boolean>(false);\n\n // Rows confirmed as written. A retry resumes here rather than re-sending\n // rows that now exist and conflicting on its first batch, forever.\n const committedRef = useRef<number>(0);\n const bulkUnsupportedRef = useRef<{ current: boolean }>({ current: false });\n\n const [processedEntities, setProcessedEntities] = useState<number>(0);\n\n function save() {\n\n if (savingRef.current)\n return;\n\n savingRef.current = true;\n setErrorSaving(undefined);\n\n saveImportedEntities(\n dataClient,\n path,\n importConfig.entities,\n {\n offset: committedRef.current,\n batchSize: IMPORT_BATCH_SIZE,\n onBatchCommitted: (written) => {\n committedRef.current = written;\n setProcessedEntities(written);\n },\n bulkUnsupported: bulkUnsupportedRef.current,\n collection\n }\n ).then(() => {\n onImportSuccess(collection);\n savingRef.current = false;\n }).catch((e) => {\n const error = e as ImportSaveError;\n committedRef.current = error.committed ?? committedRef.current;\n setProcessedEntities(committedRef.current);\n setErrorSaving(error);\n savingRef.current = false;\n });\n }\n\n useEffect(() => {\n save();\n }, []);\n\n if (errorSaving) {\n const total = importConfig.entities.length;\n const failedRows = errorSaving.failedTo - errorSaving.failedFrom > 1\n ? `rows ${errorSaving.failedFrom + 1}–${errorSaving.failedTo}`\n : `row ${errorSaving.failedFrom + 1}`;\n // A batch is written whole or not at all, so the server's naming of\n // the one row that failed is what says what to fix.\n const causeRow = errorSaving.failedRow !== undefined\n ? ` Row ${errorSaving.failedRow + 1} is the one that failed.`\n : \"\";\n return (\n <CenteredView className={\"flex flex-col gap-4 items-center\"}>\n <Typography variant={\"h6\"}>\n Error saving data\n </Typography>\n\n <Typography variant={\"body2\"} color={\"error\"}>\n {errorSaving.message}\n </Typography>\n\n <Typography variant={\"body2\"}>\n {errorSaving.committed} of {total} rows were imported.\n The import stopped on {failedRows}, which {errorSaving.failedTo - errorSaving.failedFrom > 1 ? \"were\" : \"was\"} not written.{causeRow}\n </Typography>\n\n <Button\n onClick={save}\n >\n {errorSaving.committed > 0\n ? `Retry from row ${errorSaving.committed + 1}`\n : \"Retry\"}\n </Button>\n </CenteredView>\n );\n }\n\n return (\n <div className={\"flex flex-col gap-4 items-center\"}>\n <CircularProgress/>\n\n <Typography variant={\"h6\"}>\n Saving data\n </Typography>\n\n <Typography variant={\"body2\"}>\n {processedEntities}/{importConfig.entities.length} entities saved\n </Typography>\n\n <Typography variant={\"caption\"}>\n Do not close this tab or the import will be interrupted.\n </Typography>\n\n </div>\n );\n\n}\n"],"mappings":";;;;;;AAOA,SAAgB,qBACX,EACG,MACA,cACA,YACA,mBAOG;CAEP,MAAM,CAAC,aAAa,kBAAkB,SAAsC,KAAA,CAAS;CACrF,MAAM,aAAa,QAAQ;CAE3B,MAAM,YAAY,OAAgB,KAAK;CAIvC,MAAM,eAAe,OAAe,CAAC;CACrC,MAAM,qBAAqB,OAA6B,EAAE,SAAS,MAAM,CAAC;CAE1E,MAAM,CAAC,mBAAmB,wBAAwB,SAAiB,CAAC;CAEpE,SAAS,OAAO;EAEZ,IAAI,UAAU,SACV;EAEJ,UAAU,UAAU;EACpB,eAAe,KAAA,CAAS;EAExB,qBACI,YACA,MACA,aAAa,UACb;GACI,QAAQ,aAAa;GACrB,WAAA;GACA,mBAAmB,YAAY;IAC3B,aAAa,UAAU;IACvB,qBAAqB,OAAO;GAChC;GACA,iBAAiB,mBAAmB;GACpC;EACJ,CACJ,CAAC,CAAC,WAAW;GACT,gBAAgB,UAAU;GAC1B,UAAU,UAAU;EACxB,CAAC,CAAC,CAAC,OAAO,MAAM;GACZ,MAAM,QAAQ;GACd,aAAa,UAAU,MAAM,aAAa,aAAa;GACvD,qBAAqB,aAAa,OAAO;GACzC,eAAe,KAAK;GACpB,UAAU,UAAU;EACxB,CAAC;CACL;CAEA,gBAAgB;EACZ,KAAK;CACT,GAAG,CAAC,CAAC;CAEL,IAAI,aAAa;EACb,MAAM,QAAQ,aAAa,SAAS;EACpC,MAAM,aAAa,YAAY,WAAW,YAAY,aAAa,IAC7D,QAAQ,YAAY,aAAa,EAAE,GAAG,YAAY,aAClD,OAAO,YAAY,aAAa;EAGtC,MAAM,WAAW,YAAY,cAAc,KAAA,IACrC,QAAQ,YAAY,YAAY,EAAE,4BAClC;EACN,OACI,qBAAC,cAAD;GAAc,WAAW;aAAzB;IACI,oBAAC,YAAD;KAAY,SAAS;eAAM;IAEf,CAAA;IAEZ,oBAAC,YAAD;KAAY,SAAS;KAAS,OAAO;eAChC,YAAY;IACL,CAAA;IAEZ,qBAAC,YAAD;KAAY,SAAS;eAArB;MACK,YAAY;MAAU;MAAK;MAAM;MACX;MAAW;MAAS,YAAY,WAAW,YAAY,aAAa,IAAI,SAAS;MAAM;MAAc;KACpH;;IAEZ,oBAAC,QAAD;KACI,SAAS;eAER,YAAY,YAAY,IACnB,kBAAkB,YAAY,YAAY,MAC1C;IACF,CAAA;GACE;;CAEtB;CAEA,OACI,qBAAC,OAAD;EAAK,WAAW;YAAhB;GACI,oBAAC,kBAAD,CAAkB,CAAA;GAElB,oBAAC,YAAD;IAAY,SAAS;cAAM;GAEf,CAAA;GAEZ,qBAAC,YAAD;IAAY,SAAS;cAArB;KACK;KAAkB;KAAE,aAAa,SAAS;KAAO;IAC1C;;GAEZ,oBAAC,YAAD;IAAY,SAAS;cAAW;GAEpB,CAAA;EAEX;;AAGb"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
//#region src/data_import/hooks/useImportConfig.tsx
|
|
3
|
+
var useImportConfig = () => {
|
|
4
|
+
const [inUse, setInUse] = useState(false);
|
|
5
|
+
const [defaultValues, setDefaultValues] = useState({});
|
|
6
|
+
const [idColumn, setIdColumn] = useState();
|
|
7
|
+
const [importData, setImportData] = useState([]);
|
|
8
|
+
const [entities, setEntities] = useState([]);
|
|
9
|
+
const [headersMapping, setHeadersMapping] = useState({});
|
|
10
|
+
const [headingsOrder, setHeadingsOrder] = useState([]);
|
|
11
|
+
const [originProperties, setOriginProperties] = useState({});
|
|
12
|
+
return {
|
|
13
|
+
inUse,
|
|
14
|
+
setInUse,
|
|
15
|
+
idColumn,
|
|
16
|
+
setIdColumn,
|
|
17
|
+
entities,
|
|
18
|
+
setEntities,
|
|
19
|
+
importData,
|
|
20
|
+
setImportData,
|
|
21
|
+
headingsOrder: (headingsOrder ?? []).length > 0 ? headingsOrder : Object.keys(headersMapping),
|
|
22
|
+
setHeadingsOrder,
|
|
23
|
+
headersMapping,
|
|
24
|
+
setHeadersMapping,
|
|
25
|
+
originProperties,
|
|
26
|
+
setOriginProperties,
|
|
27
|
+
defaultValues,
|
|
28
|
+
setDefaultValues
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useImportConfig };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=useImportConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImportConfig.js","names":[],"sources":["../../../src/data_import/hooks/useImportConfig.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Entity, Property } from \"@rebasepro/types\";\nimport { ImportConfig } from \"../types\";\n\nexport const useImportConfig = (): ImportConfig => {\n\n const [inUse, setInUse] = useState<boolean>(false);\n const [defaultValues, setDefaultValues] = useState<Record<string, any>>({});\n const [idColumn, setIdColumn] = useState<string | undefined>();\n const [importData, setImportData] = useState<object[]>([]);\n const [entities, setEntities] = useState<Entity<any>[]>([]);\n const [headersMapping, setHeadersMapping] = useState<Record<string, string | null>>({});\n const [headingsOrder, setHeadingsOrder] = useState<string[]>([]);\n const [originProperties, setOriginProperties] = useState<Record<string, Property>>({});\n\n return {\n inUse,\n setInUse,\n idColumn,\n setIdColumn,\n entities,\n setEntities,\n importData,\n setImportData,\n headingsOrder: (headingsOrder ?? []).length > 0 ? headingsOrder : Object.keys(headersMapping),\n setHeadingsOrder,\n headersMapping,\n setHeadersMapping,\n originProperties,\n setOriginProperties,\n defaultValues,\n setDefaultValues\n };\n};\n"],"mappings":";;AAIA,IAAa,wBAAsC;CAE/C,MAAM,CAAC,OAAO,YAAY,SAAkB,KAAK;CACjD,MAAM,CAAC,eAAe,oBAAoB,SAA8B,CAAC,CAAC;CAC1E,MAAM,CAAC,UAAU,eAAe,SAA6B;CAC7D,MAAM,CAAC,YAAY,iBAAiB,SAAmB,CAAC,CAAC;CACzD,MAAM,CAAC,UAAU,eAAe,SAAwB,CAAC,CAAC;CAC1D,MAAM,CAAC,gBAAgB,qBAAqB,SAAwC,CAAC,CAAC;CACtF,MAAM,CAAC,eAAe,oBAAoB,SAAmB,CAAC,CAAC;CAC/D,MAAM,CAAC,kBAAkB,uBAAuB,SAAmC,CAAC,CAAC;CAErF,OAAO;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,gBAAgB,iBAAiB,CAAC,EAAA,CAAG,SAAS,IAAI,gBAAgB,OAAO,KAAK,cAAc;EAC5F;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;AACJ"}
|