@rebasepro/cms 0.23.0 → 0.24.1-canary.g19596ef
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/_cms_internals.d.ts +2 -1
- 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.d.ts +38 -18
- 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 +6 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/types/config_controller.d.ts +11 -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-BeP0A4MJ.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +73 -69
- 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.d.ts +5 -5
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +7 -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.d.ts +7 -1
- 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.d.ts +6 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +5 -2
- 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.d.ts +5 -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.d.ts +7 -1
- 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.d.ts +29 -4
- 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.d.ts +16 -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.d.ts +15 -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.d.ts +37 -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.d.ts +11 -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/components/index.d.ts +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-TCgkTVlS.js → data_import/import/ImportCollectionAction.js} +84 -92
- 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.d.ts +81 -4
- 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.d.ts +48 -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.d.ts +7 -1
- 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 +28 -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.d.ts +4 -1
- 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 -3085
- 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 +48 -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 +27 -0
- 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.d.ts +28 -6
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.d.ts +21 -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 +25 -0
- 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 -3793
- 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 +11 -0
- 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 +95 -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 +8 -3
- package/dist/{util-CC0ozHoD.js → preview/util.js} +13 -6
- 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.d.ts +15 -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 +42 -1
- 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.d.ts +20 -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-DLHCka00.js +0 -3630
- package/dist/CollectionEditorDialog-DLHCka00.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-_pu5hzZn.js +0 -3837
- package/dist/PropertyEditView-_pu5hzZn.js.map +0 -1
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js +0 -212
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js.map +0 -1
- package/dist/SchemaChangeDialog-BeP0A4MJ.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-4bJWdlDK.js +0 -520
- package/dist/export-4bJWdlDK.js.map +0 -1
- package/dist/history-BElrZ5Rw.js +0 -313
- package/dist/history-BElrZ5Rw.js.map +0 -1
- package/dist/import-TCgkTVlS.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-CC0ozHoD.js.map +0 -1
- package/dist/util-DybQBkug.js +0 -26390
- package/dist/util-DybQBkug.js.map +0 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, ChevronsUpDownIcon, FilterChip, Menu, MenuItem, Tooltip, cls } from "@rebasepro/ui";
|
|
4
|
+
import { normalizeOrderBy } from "@rebasepro/common";
|
|
5
|
+
import { useTranslation } from "@rebasepro/app";
|
|
6
|
+
//#region src/components/CollectionViewBinding/FilterPresetsButton.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of presets shown as inline toggle chips before the
|
|
9
|
+
* rest are collapsed into an overflow menu.
|
|
10
|
+
*/
|
|
11
|
+
var MAX_VISIBLE_PRESETS = 4;
|
|
12
|
+
/** Max characters for a chip label before truncation. */
|
|
13
|
+
var MAX_LABEL_LENGTH = 22;
|
|
14
|
+
/**
|
|
15
|
+
* Deep equality without JSON.stringify.
|
|
16
|
+
* Handles primitives, arrays, Dates, and plain objects recursively.
|
|
17
|
+
*/
|
|
18
|
+
function deepEqual(a, b) {
|
|
19
|
+
if (a === b) return true;
|
|
20
|
+
if (a == null || b == null) return false;
|
|
21
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
|
|
22
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
23
|
+
if (a.length !== b.length) return false;
|
|
24
|
+
return a.every((v, i) => deepEqual(v, b[i]));
|
|
25
|
+
}
|
|
26
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
27
|
+
const aKeys = Object.keys(a);
|
|
28
|
+
const bKeys = Object.keys(b);
|
|
29
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
30
|
+
return aKeys.every((k) => deepEqual(a[k], b[k]));
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if a preset's filters are a subset of the controller's
|
|
36
|
+
* current filter values (key-by-key deep comparison on the tuples).
|
|
37
|
+
*/
|
|
38
|
+
function isPresetActive(preset, controllerFilters) {
|
|
39
|
+
if (!controllerFilters) return false;
|
|
40
|
+
const entries = Object.entries(preset.filterValues);
|
|
41
|
+
if (entries.length === 0) return false;
|
|
42
|
+
for (const [key, presetTuple] of entries) {
|
|
43
|
+
const controllerTuple = controllerFilters[key];
|
|
44
|
+
if (!controllerTuple || !presetTuple) return false;
|
|
45
|
+
if (!deepEqual(presetTuple, controllerTuple)) return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generate a human-readable label from filter keys when no explicit label is provided.
|
|
51
|
+
*/
|
|
52
|
+
function generateLabel(filterValues, emptyLabel) {
|
|
53
|
+
const keys = Object.keys(filterValues);
|
|
54
|
+
if (keys.length === 0) return emptyLabel;
|
|
55
|
+
if (keys.length === 1) return keys[0].replace(/_/g, " ");
|
|
56
|
+
if (keys.length === 2) return keys.map((k) => k.replace(/_/g, " ")).join(" + ");
|
|
57
|
+
return `${keys[0].replace(/_/g, " ")} +${keys.length - 1}`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Truncate a label if it exceeds MAX_LABEL_LENGTH.
|
|
61
|
+
*/
|
|
62
|
+
function truncateLabel(label) {
|
|
63
|
+
if (label.length <= MAX_LABEL_LENGTH) return {
|
|
64
|
+
display: label,
|
|
65
|
+
truncated: false
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
display: label.slice(0, MAX_LABEL_LENGTH - 1) + "…",
|
|
69
|
+
truncated: true
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function OverflowMenu({ presets, activeSet, onToggle }) {
|
|
73
|
+
const { t } = useTranslation();
|
|
74
|
+
const activeCount = presets.filter((p) => activeSet.has(p.originalIndex)).length;
|
|
75
|
+
return /* @__PURE__ */ jsx(Menu, {
|
|
76
|
+
trigger: /* @__PURE__ */ jsxs(FilterChip, {
|
|
77
|
+
active: activeCount > 0,
|
|
78
|
+
icon: /* @__PURE__ */ jsx(ChevronsUpDownIcon, { size: 12 }),
|
|
79
|
+
children: ["+", presets.length]
|
|
80
|
+
}),
|
|
81
|
+
side: "bottom",
|
|
82
|
+
align: "start",
|
|
83
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
84
|
+
className: "min-w-[180px] max-w-[300px] max-h-[320px] overflow-y-auto",
|
|
85
|
+
children: presets.map(({ preset, originalIndex }) => {
|
|
86
|
+
const rawLabel = preset.label ?? generateLabel(preset.filterValues, t("filter"));
|
|
87
|
+
const active = activeSet.has(originalIndex);
|
|
88
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
89
|
+
dense: true,
|
|
90
|
+
onClick: () => onToggle(originalIndex),
|
|
91
|
+
className: cls(active && "bg-primary/10 dark:bg-primary/20"),
|
|
92
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
93
|
+
className: "flex items-center gap-2 w-full min-w-0",
|
|
94
|
+
children: [active && /* @__PURE__ */ jsx(CheckIcon, {
|
|
95
|
+
size: 14,
|
|
96
|
+
className: "text-primary shrink-0"
|
|
97
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: cls("truncate", active ? "text-primary font-medium" : ""),
|
|
99
|
+
children: rawLabel
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
}, originalIndex);
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Filter Presets — displayed as inline toggle chips in the collection toolbar.
|
|
109
|
+
*
|
|
110
|
+
* Active state is **derived** from the controller's actual filter values,
|
|
111
|
+
* not tracked locally. A chip is "active" when ALL of its filter entries
|
|
112
|
+
* match the current controller state (deep value comparison, no JSON.stringify).
|
|
113
|
+
*
|
|
114
|
+
* This means:
|
|
115
|
+
* - Toggling a preset on adds its filters to the controller.
|
|
116
|
+
* - Toggling it off removes its filter keys.
|
|
117
|
+
* - Changing filters via the dialog automatically deactivates unmatched chips.
|
|
118
|
+
* - Clearing all filters deactivates all chips.
|
|
119
|
+
* - Multiple presets can be active simultaneously.
|
|
120
|
+
*/
|
|
121
|
+
function FilterPresetsButton({ filterPresets, tableController, compact }) {
|
|
122
|
+
const { t } = useTranslation();
|
|
123
|
+
const activeSet = useMemo(() => {
|
|
124
|
+
const set = /* @__PURE__ */ new Set();
|
|
125
|
+
if (!filterPresets.length || !tableController.setFilterValues) return set;
|
|
126
|
+
for (let i = 0; i < filterPresets.length; i++) if (isPresetActive(filterPresets[i], tableController.filterValues)) set.add(i);
|
|
127
|
+
return set;
|
|
128
|
+
}, [
|
|
129
|
+
filterPresets,
|
|
130
|
+
tableController.filterValues,
|
|
131
|
+
tableController.setFilterValues
|
|
132
|
+
]);
|
|
133
|
+
const handleToggle = useCallback((index) => {
|
|
134
|
+
const preset = filterPresets[index];
|
|
135
|
+
const currentFilters = { ...tableController.filterValues ?? {} };
|
|
136
|
+
const wasActive = isPresetActive(preset, currentFilters);
|
|
137
|
+
if (wasActive) {
|
|
138
|
+
for (const key of Object.keys(preset.filterValues)) delete currentFilters[key];
|
|
139
|
+
for (let i = 0; i < filterPresets.length; i++) {
|
|
140
|
+
if (i === index) continue;
|
|
141
|
+
const other = filterPresets[i];
|
|
142
|
+
if (isPresetActive(other, currentFilters)) Object.assign(currentFilters, other.filterValues);
|
|
143
|
+
}
|
|
144
|
+
} else Object.assign(currentFilters, preset.filterValues);
|
|
145
|
+
if (Object.keys(currentFilters).length === 0) {
|
|
146
|
+
if (tableController.clearFilter) tableController.clearFilter();
|
|
147
|
+
else tableController.setFilterValues?.({});
|
|
148
|
+
tableController.setSortBy?.(void 0);
|
|
149
|
+
} else {
|
|
150
|
+
tableController.setFilterValues?.(currentFilters);
|
|
151
|
+
if (!wasActive && preset.sort) tableController.setSortBy?.(normalizeOrderBy(preset.sort));
|
|
152
|
+
else if (wasActive) {
|
|
153
|
+
let remainingSort;
|
|
154
|
+
for (let i = 0; i < filterPresets.length; i++) {
|
|
155
|
+
if (i === index) continue;
|
|
156
|
+
const other = filterPresets[i];
|
|
157
|
+
if (isPresetActive(other, currentFilters) && other.sort) remainingSort = normalizeOrderBy(other.sort);
|
|
158
|
+
}
|
|
159
|
+
tableController.setSortBy?.(remainingSort);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, [filterPresets, tableController]);
|
|
163
|
+
if (!filterPresets.length || !tableController.setFilterValues) return null;
|
|
164
|
+
const maxVisible = compact ? 2 : MAX_VISIBLE_PRESETS;
|
|
165
|
+
const needsOverflow = filterPresets.length > maxVisible;
|
|
166
|
+
const visibleCount = needsOverflow ? maxVisible - 1 : filterPresets.length;
|
|
167
|
+
const visiblePresets = filterPresets.slice(0, visibleCount);
|
|
168
|
+
const overflowPresets = needsOverflow ? filterPresets.slice(visibleCount).map((preset, i) => ({
|
|
169
|
+
preset,
|
|
170
|
+
originalIndex: visibleCount + i
|
|
171
|
+
})) : [];
|
|
172
|
+
const hasOverflow = overflowPresets.length > 0;
|
|
173
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
174
|
+
className: "flex items-center gap-1 min-w-0 overflow-hidden",
|
|
175
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
176
|
+
className: "flex items-center gap-1 min-w-0 overflow-x-auto py-0.5",
|
|
177
|
+
style: { scrollbarWidth: "none" },
|
|
178
|
+
children: visiblePresets.map((preset, index) => {
|
|
179
|
+
const rawLabel = preset.label ?? generateLabel(preset.filterValues, t("filter"));
|
|
180
|
+
const { display, truncated } = truncateLabel(rawLabel);
|
|
181
|
+
const chip = /* @__PURE__ */ jsx(FilterChip, {
|
|
182
|
+
active: activeSet.has(index),
|
|
183
|
+
onClick: () => handleToggle(index),
|
|
184
|
+
size: "small",
|
|
185
|
+
children: display
|
|
186
|
+
}, index);
|
|
187
|
+
if (truncated) return /* @__PURE__ */ jsx(Tooltip, {
|
|
188
|
+
title: rawLabel,
|
|
189
|
+
children: chip
|
|
190
|
+
}, index);
|
|
191
|
+
return chip;
|
|
192
|
+
})
|
|
193
|
+
}), hasOverflow && /* @__PURE__ */ jsx(OverflowMenu, {
|
|
194
|
+
presets: overflowPresets,
|
|
195
|
+
activeSet,
|
|
196
|
+
onToggle: handleToggle
|
|
197
|
+
})]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
export { FilterPresetsButton };
|
|
202
|
+
|
|
203
|
+
//# sourceMappingURL=FilterPresetsButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterPresetsButton.js","names":[],"sources":["../../../src/components/CollectionViewBinding/FilterPresetsButton.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { CheckIcon, ChevronsUpDownIcon, cls, FilterChip, Menu, MenuItem, Tooltip } from \"@rebasepro/ui\";\nimport type { FilterValues, FilterPreset, OrderByTuple } from \"@rebasepro/types\";\nimport { normalizeOrderBy } from \"@rebasepro/common\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport type { EntityTableController, PropertyPath } from \"@rebasepro/cms-types\";\n\nexport interface FilterPresetsButtonProps<M extends Record<string, unknown>> {\n // Matches `admin.filterPresets`, which is keyed by property path — the\n // component is fed straight from the collection.\n filterPresets: FilterPreset<PropertyPath<M>>[];\n tableController: EntityTableController<M>;\n compact?: boolean;\n}\n\n/**\n * Maximum number of presets shown as inline toggle chips before the\n * rest are collapsed into an overflow menu.\n */\nconst MAX_VISIBLE_PRESETS = 4;\n\n/** Max characters for a chip label before truncation. */\nconst MAX_LABEL_LENGTH = 22;\n\n// ─── Helpers ────────────────────────────────────────────────────────\n\n/**\n * Deep equality without JSON.stringify.\n * Handles primitives, arrays, Dates, and plain objects recursively.\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a == null || b == null) return false;\n if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((v, i) => deepEqual(v, b[i]));\n }\n if (typeof a === \"object\" && typeof b === \"object\") {\n const aKeys = Object.keys(a as Record<string, unknown>);\n const bKeys = Object.keys(b as Record<string, unknown>);\n if (aKeys.length !== bKeys.length) return false;\n return aKeys.every(k =>\n deepEqual(\n (a as Record<string, unknown>)[k],\n (b as Record<string, unknown>)[k]\n )\n );\n }\n return false;\n}\n\n/**\n * Check if a preset's filters are a subset of the controller's\n * current filter values (key-by-key deep comparison on the tuples).\n */\nfunction isPresetActive(\n preset: FilterPreset<string>,\n controllerFilters: Record<string, unknown> | undefined\n): boolean {\n if (!controllerFilters) return false;\n const entries = Object.entries(preset.filterValues);\n if (entries.length === 0) return false;\n for (const [key, presetTuple] of entries) {\n const controllerTuple = controllerFilters[key];\n if (!controllerTuple || !presetTuple) return false;\n if (!deepEqual(presetTuple, controllerTuple)) return false;\n }\n return true;\n}\n\n/**\n * Generate a human-readable label from filter keys when no explicit label is provided.\n */\nfunction generateLabel(filterValues: FilterValues<string>, emptyLabel: string): string {\n const keys = Object.keys(filterValues);\n if (keys.length === 0) return emptyLabel;\n if (keys.length === 1) return keys[0].replace(/_/g, \" \");\n if (keys.length === 2) return keys.map(k => k.replace(/_/g, \" \")).join(\" + \");\n return `${keys[0].replace(/_/g, \" \")} +${keys.length - 1}`;\n}\n\n/**\n * Truncate a label if it exceeds MAX_LABEL_LENGTH.\n */\nfunction truncateLabel(label: string): { display: string; truncated: boolean } {\n if (label.length <= MAX_LABEL_LENGTH) return { display: label,\ntruncated: false };\n return { display: label.slice(0, MAX_LABEL_LENGTH - 1) + \"…\",\ntruncated: true };\n}\n\n// ─── Overflow Menu ──────────────────────────────────────────────────\n\ninterface OverflowMenuProps {\n presets: { preset: FilterPreset<string>; originalIndex: number }[];\n activeSet: Set<number>;\n onToggle: (index: number) => void;\n}\n\nfunction OverflowMenu({ presets, activeSet, onToggle }: OverflowMenuProps) {\n const { t } = useTranslation();\n const activeCount = presets.filter(p => activeSet.has(p.originalIndex)).length;\n\n const trigger = (\n <FilterChip\n active={activeCount > 0}\n icon={<ChevronsUpDownIcon size={12} />}\n >\n +{presets.length}\n </FilterChip>\n );\n\n return (\n <Menu trigger={trigger} side=\"bottom\" align=\"start\">\n <div className=\"min-w-[180px] max-w-[300px] max-h-[320px] overflow-y-auto\">\n {presets.map(({ preset, originalIndex }) => {\n const rawLabel = preset.label ?? generateLabel(preset.filterValues as FilterValues<string>, t(\"filter\"));\n const active = activeSet.has(originalIndex);\n\n return (\n <MenuItem\n key={originalIndex}\n dense\n onClick={() => onToggle(originalIndex)}\n className={cls(active && \"bg-primary/10 dark:bg-primary/20\")}\n >\n <span className=\"flex items-center gap-2 w-full min-w-0\">\n {active && <CheckIcon size={14} className=\"text-primary shrink-0\" />}\n <span className={cls(\"truncate\", active ? \"text-primary font-medium\" : \"\")}>\n {rawLabel}\n </span>\n </span>\n </MenuItem>\n );\n })}\n </div>\n </Menu>\n );\n}\n\n// ─── Main Component ─────────────────────────────────────────────────\n\n/**\n * Filter Presets — displayed as inline toggle chips in the collection toolbar.\n *\n * Active state is **derived** from the controller's actual filter values,\n * not tracked locally. A chip is \"active\" when ALL of its filter entries\n * match the current controller state (deep value comparison, no JSON.stringify).\n *\n * This means:\n * - Toggling a preset on adds its filters to the controller.\n * - Toggling it off removes its filter keys.\n * - Changing filters via the dialog automatically deactivates unmatched chips.\n * - Clearing all filters deactivates all chips.\n * - Multiple presets can be active simultaneously.\n */\nexport function FilterPresetsButton<M extends Record<string, unknown>>({\n filterPresets,\n tableController,\n compact\n}: FilterPresetsButtonProps<M>) {\n const { t } = useTranslation();\n\n // ── Derive active state from controller ─────────────────────────\n const activeSet = useMemo(() => {\n const set = new Set<number>();\n if (!filterPresets.length || !tableController.setFilterValues) return set;\n for (let i = 0; i < filterPresets.length; i++) {\n if (isPresetActive(\n filterPresets[i] as FilterPreset<string>,\n tableController.filterValues as Record<string, unknown> | undefined\n )) {\n set.add(i);\n }\n }\n return set;\n }, [filterPresets, tableController.filterValues, tableController.setFilterValues]);\n\n // ── Toggle handler ──────────────────────────────────────────────\n const handleToggle = useCallback((index: number) => {\n const preset = filterPresets[index] as FilterPreset<string>;\n const currentFilters = { ...(tableController.filterValues ?? {}) } as Record<string, [string, unknown]>;\n const wasActive = isPresetActive(preset, currentFilters);\n\n if (wasActive) {\n // Toggle OFF: remove this preset's filter keys\n for (const key of Object.keys(preset.filterValues)) {\n delete currentFilters[key];\n }\n // Re-apply overlapping keys from other still-active presets\n for (let i = 0; i < filterPresets.length; i++) {\n if (i === index) continue;\n const other = filterPresets[i] as FilterPreset<string>;\n if (isPresetActive(other, currentFilters)) {\n Object.assign(currentFilters, other.filterValues);\n }\n }\n } else {\n // Toggle ON: merge this preset's filters on top\n Object.assign(currentFilters, preset.filterValues);\n }\n\n // Apply\n if (Object.keys(currentFilters).length === 0) {\n if (tableController.clearFilter) {\n tableController.clearFilter();\n } else {\n tableController.setFilterValues?.(\n {} as FilterValues<Extract<keyof M, string> | (string & {})>\n );\n }\n tableController.setSortBy?.(undefined);\n } else {\n tableController.setFilterValues?.(\n currentFilters as FilterValues<Extract<keyof M, string> | (string & {})>\n );\n\n // Resolve sort: use the toggled preset's sort if toggling on,\n // otherwise find sort from remaining active presets\n if (!wasActive && preset.sort) {\n tableController.setSortBy?.(\n normalizeOrderBy(preset.sort) as OrderByTuple<Extract<keyof M, string> | (string & {})>[]\n );\n } else if (wasActive) {\n let remainingSort: OrderByTuple[] | undefined;\n for (let i = 0; i < filterPresets.length; i++) {\n if (i === index) continue;\n const other = filterPresets[i] as FilterPreset<string>;\n if (isPresetActive(other, currentFilters) && other.sort) {\n remainingSort = normalizeOrderBy(other.sort);\n }\n }\n tableController.setSortBy?.(\n remainingSort as OrderByTuple<Extract<keyof M, string> | (string & {})>[] | undefined\n );\n }\n }\n }, [filterPresets, tableController]);\n\n // ── Guard (after hooks to preserve Rules of Hooks) ──────────────\n if (!filterPresets.length || !tableController.setFilterValues) return null;\n\n // ── Split visible vs overflow ───────────────────────────────────\n const maxVisible = compact ? 2 : MAX_VISIBLE_PRESETS;\n const needsOverflow = filterPresets.length > maxVisible;\n const visibleCount = needsOverflow ? maxVisible - 1 : filterPresets.length;\n\n const visiblePresets = filterPresets.slice(0, visibleCount);\n const overflowPresets = needsOverflow\n ? filterPresets.slice(visibleCount).map((preset, i) => ({\n preset: preset as FilterPreset<string>,\n originalIndex: visibleCount + i\n }))\n : [];\n\n const hasOverflow = overflowPresets.length > 0;\n\n return (\n <div className=\"flex items-center gap-1 min-w-0 overflow-hidden\">\n {/* Scrollable chip area — on narrow screens chips scroll,\n on desktop there's enough space so no scroll occurs.\n py-0.5 gives the inset shadow breathing room inside the clip area. */}\n <div\n className=\"flex items-center gap-1 min-w-0 overflow-x-auto py-0.5\"\n style={{ scrollbarWidth: \"none\" }}\n >\n {visiblePresets.map((preset, index) => {\n const rawLabel = preset.label ?? generateLabel(preset.filterValues as FilterValues<string>, t(\"filter\"));\n const { display, truncated } = truncateLabel(rawLabel);\n const active = activeSet.has(index);\n\n const chip = (\n <FilterChip\n key={index}\n active={active}\n onClick={() => handleToggle(index)}\n size=\"small\"\n >\n {display}\n </FilterChip>\n );\n\n if (truncated) {\n return <Tooltip key={index} title={rawLabel}>{chip}</Tooltip>;\n }\n return chip;\n })}\n </div>\n\n {/* Overflow button — always pinned outside the scroll area */}\n {hasOverflow && (\n <OverflowMenu\n presets={overflowPresets}\n activeSet={activeSet}\n onToggle={handleToggle}\n />\n )}\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Property } from "@rebasepro/types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FilterValues } from "@rebasepro/types";
|
|
4
|
+
/**
|
|
5
|
+
* The properties the dialog lists, each with a filter field: every property
|
|
6
|
+
* that can be filtered, bar the collection's fixed-filter fields.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFilterableProperties(properties: Record<string, Property>, fixedFilter?: FilterValues<string>, engine?: string): [string, Property][];
|
|
4
9
|
export interface FiltersDialogProps {
|
|
5
10
|
open: boolean;
|
|
6
11
|
onOpenChange: (open: boolean) => void;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FilterFieldBinding } from "../SelectableTable/filters/FilterFieldBinding.js";
|
|
2
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, Typography, cls, defaultBorderMixin } from "@rebasepro/ui";
|
|
5
|
+
import { isPropertyFilterable, useCollectionScope, useTranslation } from "@rebasepro/app";
|
|
6
|
+
//#region src/components/CollectionViewBinding/FiltersDialog.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The properties the dialog lists, each with a filter field: every property
|
|
9
|
+
* that can be filtered, bar the collection's fixed-filter fields.
|
|
10
|
+
*/
|
|
11
|
+
function getFilterableProperties(properties, fixedFilter, engine) {
|
|
12
|
+
return Object.entries(properties).filter(([key, property]) => {
|
|
13
|
+
if (!property) return false;
|
|
14
|
+
if (fixedFilter && key in fixedFilter) return false;
|
|
15
|
+
return isPropertyFilterable(property, engine);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Dialog that displays all filterable properties from a collection
|
|
20
|
+
* and allows setting filter values for each.
|
|
21
|
+
*/
|
|
22
|
+
function FiltersDialog({ open, onOpenChange, properties, filterValues, setFilterValues, fixedFilter }) {
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const engine = useCollectionScope()?.engine;
|
|
25
|
+
const [localFilters, setLocalFilters] = useState(filterValues ?? {});
|
|
26
|
+
const [hiddenFields, setHiddenFields] = useState({});
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (open) setLocalFilters(filterValues ?? {});
|
|
29
|
+
}, [open, filterValues]);
|
|
30
|
+
const filterableProperties = useMemo(() => getFilterableProperties(properties, fixedFilter, engine), [
|
|
31
|
+
properties,
|
|
32
|
+
fixedFilter,
|
|
33
|
+
engine
|
|
34
|
+
]);
|
|
35
|
+
const handleFilterChange = useCallback((propertyKey, value) => {
|
|
36
|
+
setLocalFilters((prev) => {
|
|
37
|
+
const newFilters = { ...prev };
|
|
38
|
+
if (value) newFilters[propertyKey] = value;
|
|
39
|
+
else delete newFilters[propertyKey];
|
|
40
|
+
return newFilters;
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
const handleApply = useCallback(() => {
|
|
44
|
+
setFilterValues(Object.keys(localFilters).length > 0 ? {
|
|
45
|
+
...localFilters,
|
|
46
|
+
...fixedFilter
|
|
47
|
+
} : fixedFilter || void 0);
|
|
48
|
+
onOpenChange(false);
|
|
49
|
+
}, [
|
|
50
|
+
localFilters,
|
|
51
|
+
setFilterValues,
|
|
52
|
+
fixedFilter,
|
|
53
|
+
onOpenChange
|
|
54
|
+
]);
|
|
55
|
+
const handleClearAll = useCallback(() => {
|
|
56
|
+
setLocalFilters({});
|
|
57
|
+
}, []);
|
|
58
|
+
const setHiddenForField = useCallback((propertyKey, hidden) => {
|
|
59
|
+
setHiddenFields((prev) => ({
|
|
60
|
+
...prev,
|
|
61
|
+
[propertyKey]: hidden
|
|
62
|
+
}));
|
|
63
|
+
}, []);
|
|
64
|
+
const isAnyFieldHidden = Object.values(hiddenFields).some((hidden) => hidden);
|
|
65
|
+
const activeFilterCount = Object.keys(localFilters).length;
|
|
66
|
+
const renderFilterField = useCallback((propertyKey, property) => {
|
|
67
|
+
const filterValue = localFilters[propertyKey];
|
|
68
|
+
const setValue = (value) => handleFilterChange(propertyKey, value);
|
|
69
|
+
return /* @__PURE__ */ jsx(FilterFieldBinding, {
|
|
70
|
+
propertyKey,
|
|
71
|
+
property,
|
|
72
|
+
engine,
|
|
73
|
+
value: filterValue,
|
|
74
|
+
setValue,
|
|
75
|
+
hidden: hiddenFields[propertyKey] ?? false,
|
|
76
|
+
setHidden: (hidden) => setHiddenForField(propertyKey, hidden)
|
|
77
|
+
});
|
|
78
|
+
}, [
|
|
79
|
+
localFilters,
|
|
80
|
+
handleFilterChange,
|
|
81
|
+
hiddenFields,
|
|
82
|
+
setHiddenForField,
|
|
83
|
+
engine
|
|
84
|
+
]);
|
|
85
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
86
|
+
open,
|
|
87
|
+
onOpenChange,
|
|
88
|
+
maxWidth: "3xl",
|
|
89
|
+
fullWidth: true,
|
|
90
|
+
containerClassName: isAnyFieldHidden ? "hidden" : void 0,
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsxs(DialogTitle, {
|
|
93
|
+
className: "flex items-center gap-2",
|
|
94
|
+
variant: "h6",
|
|
95
|
+
children: [t("filters"), activeFilterCount > 0 && /* @__PURE__ */ jsx(Chip, {
|
|
96
|
+
size: "small",
|
|
97
|
+
className: "ml-2",
|
|
98
|
+
children: activeFilterCount
|
|
99
|
+
})]
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(DialogContent, { children: filterableProperties.length === 0 ? /* @__PURE__ */ jsx(Typography, {
|
|
102
|
+
color: "secondary",
|
|
103
|
+
className: "py-8 text-center",
|
|
104
|
+
children: t("no_filterable_properties")
|
|
105
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "grid grid-cols-[160px_minmax(0,1fr)] items-center",
|
|
107
|
+
children: filterableProperties.map(([propertyKey, property], index) => {
|
|
108
|
+
const hasFilter = propertyKey in localFilters;
|
|
109
|
+
const rowBorder = index > 0 && cls("border-t", defaultBorderMixin);
|
|
110
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
111
|
+
className: cls("py-3 pr-4 self-stretch flex items-center", rowBorder),
|
|
112
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
113
|
+
variant: "body2",
|
|
114
|
+
className: cls("font-medium", hasFilter && "text-primary"),
|
|
115
|
+
children: property.name || propertyKey
|
|
116
|
+
})
|
|
117
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
118
|
+
className: cls("py-3", rowBorder),
|
|
119
|
+
children: renderFilterField(propertyKey, property)
|
|
120
|
+
})] }, propertyKey);
|
|
121
|
+
})
|
|
122
|
+
}) }),
|
|
123
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
124
|
+
/* @__PURE__ */ jsx(Button, {
|
|
125
|
+
variant: "text",
|
|
126
|
+
onClick: handleClearAll,
|
|
127
|
+
disabled: activeFilterCount === 0,
|
|
128
|
+
children: t("clear_all")
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ jsx("div", { className: "flex-grow" }),
|
|
131
|
+
/* @__PURE__ */ jsx(Button, {
|
|
132
|
+
variant: "text",
|
|
133
|
+
onClick: () => onOpenChange(false),
|
|
134
|
+
children: t("cancel")
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ jsx(Button, {
|
|
137
|
+
variant: "filled",
|
|
138
|
+
onClick: handleApply,
|
|
139
|
+
children: t("apply_filters")
|
|
140
|
+
})
|
|
141
|
+
] })
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { FiltersDialog, getFilterableProperties };
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=FiltersDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiltersDialog.js","names":[],"sources":["../../../src/components/CollectionViewBinding/FiltersDialog.tsx"],"sourcesContent":["\nimport type { Property } from \"@rebasepro/types\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport { FilterValues, WhereFilterOp } from \"@rebasepro/types\";\nimport { Button, Chip, cls, defaultBorderMixin, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from \"@rebasepro/ui\";\nimport { FilterIcon, VirtualTableWhereFilterOp } from \"@rebasepro/ui\";\nimport { isPropertyFilterable } from \"@rebasepro/app\";\nimport { useCollectionScope, useTranslation } from \"@rebasepro/app\";\nimport { FilterFieldBinding } from \"../SelectableTable/filters/FilterFieldBinding\";\n\n/**\n * `WhereFilterOp` is declared twice: once in `@rebasepro/types` as the canonical\n * operator set every driver translates, and once in `@rebasepro/ui` for the\n * table's own props. That is deliberate — `ui` is a standalone design system and\n * depends on no Rebase package, so it cannot import the canonical one (and a\n * type-only import would not help: `ui` emits declarations with `tsc`, which\n * references external types rather than inlining them, so its published `.d.ts`\n * would demand `@rebasepro/types` from every consumer).\n *\n * This file is where the two meet and get cast into each other, so it is where\n * their agreement is checked. Adding an operator to one and not the other stops\n * this line compiling instead of silently producing a filter the table can build\n * and no driver can run — or one a driver supports and the table cannot offer.\n */\ntype MutuallyAssignable<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never;\nconst _whereFilterOpDefinitionsAgree: MutuallyAssignable<WhereFilterOp, VirtualTableWhereFilterOp> = true;\nvoid _whereFilterOpDefinitionsAgree;\n\n/**\n * The properties the dialog lists, each with a filter field: every property\n * that can be filtered, bar the collection's fixed-filter fields.\n */\nexport function getFilterableProperties(\n properties: Record<string, Property>,\n fixedFilter?: FilterValues<string>,\n engine?: string\n): [string, Property][] {\n return Object.entries(properties).filter(([key, property]) => {\n if (!property) return false;\n // Force filter properties should not be editable\n if (fixedFilter && key in fixedFilter) return false;\n // The table header asks the same question, so the two cannot list\n // different properties.\n return isPropertyFilterable(property, engine);\n });\n}\n\nexport interface FiltersDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n properties: Record<string, Property>;\n filterValues: FilterValues<any> | undefined;\n setFilterValues: (filterValues?: FilterValues<any>) => void;\n fixedFilter?: FilterValues<any>;\n}\n\n/**\n * Dialog that displays all filterable properties from a collection\n * and allows setting filter values for each.\n */\nexport function FiltersDialog({\n open,\n onOpenChange,\n properties,\n filterValues,\n setFilterValues,\n fixedFilter\n}: FiltersDialogProps) {\n const { t } = useTranslation();\n // Engine of the collection this dialog filters — read from the\n // surrounding CollectionScopeProvider mounted by the collection view.\n const engine = useCollectionScope()?.engine;\n // Local state for filters being edited\n const [localFilters, setLocalFilters] = useState<FilterValues<any>>(filterValues ?? {});\n\n // Track hidden state for reference fields (when reference dialog is open)\n const [hiddenFields, setHiddenFields] = useState<Record<string, boolean>>({});\n\n // Reset local state when dialog opens\n React.useEffect(() => {\n if (open) {\n setLocalFilters(filterValues ?? {});\n }\n }, [open, filterValues]);\n\n // Get list of filterable properties\n const filterableProperties = useMemo(\n () => getFilterableProperties(properties, fixedFilter, engine),\n [properties, fixedFilter, engine]);\n\n const handleFilterChange = useCallback((propertyKey: string, value?: [VirtualTableWhereFilterOp, any]) => {\n setLocalFilters(prev => {\n const newFilters = { ...prev };\n if (value) {\n newFilters[propertyKey] = value as [WhereFilterOp, any];\n } else {\n delete newFilters[propertyKey];\n }\n return newFilters;\n });\n }, []);\n\n const handleApply = useCallback(() => {\n const hasFilters = Object.keys(localFilters).length > 0;\n setFilterValues(hasFilters ? { ...localFilters,\n...fixedFilter } : (fixedFilter || undefined));\n onOpenChange(false);\n }, [localFilters, setFilterValues, fixedFilter, onOpenChange]);\n\n const handleClearAll = useCallback(() => {\n setLocalFilters({});\n }, []);\n\n const setHiddenForField = useCallback((propertyKey: string, hidden: boolean) => {\n setHiddenFields(prev => ({\n ...prev,\n [propertyKey]: hidden\n }));\n }, []);\n\n // Check if any reference field's dialog is currently open (should hide this dialog)\n const isAnyFieldHidden = Object.values(hiddenFields).some(hidden => hidden);\n const activeFilterCount = Object.keys(localFilters).length;\n\n const renderFilterField = useCallback((propertyKey: string, property: Property) => {\n const filterValue = localFilters[propertyKey] as [WhereFilterOp, any] | undefined;\n const setValue = (value?: [WhereFilterOp, any]) => handleFilterChange(propertyKey, value as [VirtualTableWhereFilterOp, any] | undefined);\n\n return (\n <FilterFieldBinding\n propertyKey={propertyKey}\n property={property}\n engine={engine}\n value={filterValue}\n setValue={setValue}\n hidden={hiddenFields[propertyKey] ?? false}\n setHidden={(hidden) => setHiddenForField(propertyKey, hidden)}\n />\n );\n }, [localFilters, handleFilterChange, hiddenFields, setHiddenForField, engine]);\n\n return (\n <Dialog\n open={open}\n onOpenChange={onOpenChange}\n maxWidth=\"3xl\"\n fullWidth\n containerClassName={isAnyFieldHidden ? \"hidden\" : undefined}\n >\n <DialogTitle className=\"flex items-center gap-2\" variant=\"h6\">\n {t(\"filters\")}\n {activeFilterCount > 0 && (\n <Chip size=\"small\" className=\"ml-2\">\n {activeFilterCount}\n </Chip>\n )}\n </DialogTitle>\n\n <DialogContent >\n {filterableProperties.length === 0 ? (\n <Typography color=\"secondary\" className=\"py-8 text-center\">\n {t(\"no_filterable_properties\")}\n </Typography>\n ) : (\n <div className=\"grid grid-cols-[160px_minmax(0,1fr)] items-center\">\n {filterableProperties.map(([propertyKey, property], index) => {\n const hasFilter = propertyKey in localFilters;\n const rowBorder = index > 0 && cls(\"border-t\", defaultBorderMixin);\n return (\n <React.Fragment key={propertyKey}>\n {/* Property name on the left */}\n <div className={cls(\"py-3 pr-4 self-stretch flex items-center\", rowBorder)}>\n <Typography\n variant=\"body2\"\n className={cls(\n \"font-medium\",\n hasFilter && \"text-primary\"\n )}\n >\n {property.name || propertyKey}\n </Typography>\n </div>\n\n {/* The filter field on the right */}\n <div className={cls(\"py-3\", rowBorder)}>\n {renderFilterField(propertyKey, property)}\n </div>\n </React.Fragment>\n );\n })}\n </div>\n )}\n </DialogContent>\n\n <DialogActions>\n <Button\n variant=\"text\"\n onClick={handleClearAll}\n disabled={activeFilterCount === 0}\n >\n {t(\"clear_all\")}\n </Button>\n <div className=\"flex-grow\"/>\n <Button\n variant=\"text\"\n onClick={() => onOpenChange(false)}\n >\n {t(\"cancel\")}\n </Button>\n <Button\n variant=\"filled\"\n onClick={handleApply}\n >\n {t(\"apply_filters\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Snippet, localRowMatch, offSlotMatch, searchTerms } from "./SearchHighlight.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/CollectionViewBinding/SearchExplanation.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The one place a view asks "why is this row here?" and gets something to draw.
|
|
7
|
+
*
|
|
8
|
+
* List, cards and board all render the same title-and-subtitle slots over the
|
|
9
|
+
* same machinery. An explanation that shows up in one of them and not the others
|
|
10
|
+
* reads as randomness rather than as a feature, so the decision and the markup
|
|
11
|
+
* live here and each view calls them.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Terms to mark inside values the row already shows, plus the single match
|
|
15
|
+
* worth putting where the subtitle would go — or nothing, when the row is not
|
|
16
|
+
* the product of a search or the hit is already visible.
|
|
17
|
+
*
|
|
18
|
+
* Prefers the server's `_matches`, which knows the stemming the index used, and
|
|
19
|
+
* falls back to reading the row directly. That fallback is not belt-and-braces:
|
|
20
|
+
* rows reach the panel over REST, the realtime socket and the offline cache,
|
|
21
|
+
* and only one of those carries query metadata.
|
|
22
|
+
*/
|
|
23
|
+
function useSearchExplanation(entity, properties, shownKeys, searchString) {
|
|
24
|
+
const terms = useMemo(() => searchTerms(searchString), [searchString]);
|
|
25
|
+
const shownKey = shownKeys.map((k) => k ?? "").join("|");
|
|
26
|
+
return {
|
|
27
|
+
terms,
|
|
28
|
+
offSlot: useMemo(() => {
|
|
29
|
+
if (terms.length === 0) return void 0;
|
|
30
|
+
const shown = shownKey.split("|").map((k) => k || void 0);
|
|
31
|
+
return offSlotMatch(entity.searchMatches, shown) ?? localRowMatch(entity.values, properties, terms, shown);
|
|
32
|
+
}, [
|
|
33
|
+
entity.searchMatches,
|
|
34
|
+
entity.values,
|
|
35
|
+
properties,
|
|
36
|
+
shownKey,
|
|
37
|
+
terms
|
|
38
|
+
])
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Which field the hit was in, and the text around it.
|
|
43
|
+
*
|
|
44
|
+
* Sits where the subtitle would have gone. Deliberately quiet — a small amber
|
|
45
|
+
* caption and one line — because it is context for a result, not the result. It
|
|
46
|
+
* has to survive a narrow column, so it truncates rather than wraps.
|
|
47
|
+
*/
|
|
48
|
+
function MatchExplanation({ match, label }) {
|
|
49
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "mt-0.5 flex items-baseline gap-1.5 min-w-0",
|
|
51
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: "shrink-0 text-[10px] uppercase tracking-wide font-semibold text-amber-700 dark:text-amber-500/90",
|
|
53
|
+
title: match.field,
|
|
54
|
+
children: label
|
|
55
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "truncate text-xs text-surface-500 dark:text-surface-400 min-w-0",
|
|
57
|
+
children: /* @__PURE__ */ jsx(Snippet, { text: match.snippet })
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* What to call a matched field on screen.
|
|
63
|
+
*
|
|
64
|
+
* The path is what the config and the server speak — `questionnaire.
|
|
65
|
+
* certifications` — and is unreadable in a list. Resolve it to the property's
|
|
66
|
+
* declared `name`, walking into `map` properties for a dotted path, and fall
|
|
67
|
+
* back to the last segment humanised, so an unnamed field still reads as words
|
|
68
|
+
* rather than as a path.
|
|
69
|
+
*/
|
|
70
|
+
function fieldLabel(properties, path) {
|
|
71
|
+
const segments = path.split(".");
|
|
72
|
+
let node = properties;
|
|
73
|
+
let named;
|
|
74
|
+
for (const segment of segments) {
|
|
75
|
+
const property = node?.[segment];
|
|
76
|
+
if (!property) break;
|
|
77
|
+
named = property.name ?? named;
|
|
78
|
+
node = property.properties;
|
|
79
|
+
}
|
|
80
|
+
if (named) return named;
|
|
81
|
+
return (segments[segments.length - 1] ?? path).replace(/[_-]+/g, " ").replace(/^./, (c) => c.toUpperCase());
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { MatchExplanation, fieldLabel, useSearchExplanation };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=SearchExplanation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchExplanation.js","names":[],"sources":["../../../src/components/CollectionViewBinding/SearchExplanation.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport type { SearchMatch } from \"@rebasepro/types\";\nimport { Snippet, searchTerms, offSlotMatch, localRowMatch } from \"./SearchHighlight\";\n\n/**\n * The one place a view asks \"why is this row here?\" and gets something to draw.\n *\n * List, cards and board all render the same title-and-subtitle slots over the\n * same machinery. An explanation that shows up in one of them and not the others\n * reads as randomness rather than as a feature, so the decision and the markup\n * live here and each view calls them.\n */\n\n/**\n * Terms to mark inside values the row already shows, plus the single match\n * worth putting where the subtitle would go — or nothing, when the row is not\n * the product of a search or the hit is already visible.\n *\n * Prefers the server's `_matches`, which knows the stemming the index used, and\n * falls back to reading the row directly. That fallback is not belt-and-braces:\n * rows reach the panel over REST, the realtime socket and the offline cache,\n * and only one of those carries query metadata.\n */\nexport function useSearchExplanation(\n entity: { values?: Record<string, unknown>; searchMatches?: SearchMatch[] },\n properties: Record<string, unknown> | undefined,\n shownKeys: (string | undefined)[],\n searchString: string | undefined\n): { terms: string[]; offSlot: SearchMatch | undefined } {\n const terms = useMemo(() => searchTerms(searchString), [searchString]);\n\n // Joined so the memo compares by value: the caller builds this array inline,\n // so its identity changes every render and would defeat the memo entirely.\n //\n // `|` is the separator because a property path is identifiers and dots — it\n // cannot contain one, so the round trip is lossless. (A NUL would also be\n // unambiguous and is what this first used; a raw control byte in a source\n // file makes grep treat the whole file as binary, and the repo rejects it.)\n const shownKey = shownKeys.map(k => k ?? \"\").join(\"|\");\n\n const offSlot = useMemo(\n () => {\n if (terms.length === 0) return undefined;\n const shown = shownKey.split(\"|\").map(k => k || undefined);\n return offSlotMatch(entity.searchMatches, shown)\n ?? localRowMatch(entity.values, properties, terms, shown);\n },\n [entity.searchMatches, entity.values, properties, shownKey, terms]\n );\n\n return { terms, offSlot };\n}\n\n/**\n * Which field the hit was in, and the text around it.\n *\n * Sits where the subtitle would have gone. Deliberately quiet — a small amber\n * caption and one line — because it is context for a result, not the result. It\n * has to survive a narrow column, so it truncates rather than wraps.\n */\nexport function MatchExplanation({ match, label }: { match: SearchMatch; label: string }) {\n return (\n <div className=\"mt-0.5 flex items-baseline gap-1.5 min-w-0\">\n <span\n className=\"shrink-0 text-[10px] uppercase tracking-wide font-semibold text-amber-700 dark:text-amber-500/90\"\n title={match.field}\n >\n {label}\n </span>\n <span className=\"truncate text-xs text-surface-500 dark:text-surface-400 min-w-0\">\n <Snippet text={match.snippet}/>\n </span>\n </div>\n );\n}\n\n/**\n * What to call a matched field on screen.\n *\n * The path is what the config and the server speak — `questionnaire.\n * certifications` — and is unreadable in a list. Resolve it to the property's\n * declared `name`, walking into `map` properties for a dotted path, and fall\n * back to the last segment humanised, so an unnamed field still reads as words\n * rather than as a path.\n */\nexport function fieldLabel(properties: Record<string, unknown> | undefined, path: string): string {\n const segments = path.split(\".\");\n let node = properties;\n let named: string | undefined;\n\n for (const segment of segments) {\n const property = node?.[segment] as { name?: string; properties?: Record<string, unknown> } | undefined;\n // A path can run deeper than the schema describes — `content.value`,\n // where `content` is an array of blocks whose shape is not declared\n // property-by-property. Keep the last name that *was* declared rather\n // than discarding it: \"Content\" is the answer a reader wants, and\n // resetting to undefined here labelled that field \"Value\".\n if (!property) break;\n named = property.name ?? named;\n node = property.properties;\n }\n\n if (named) return named;\n const last = segments[segments.length - 1] ?? path;\n return last.replace(/[_-]+/g, \" \").replace(/^./, c => c.toUpperCase());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,qBACZ,QACA,YACA,WACA,cACqD;CACrD,MAAM,QAAQ,cAAc,YAAY,YAAY,GAAG,CAAC,YAAY,CAAC;CASrE,MAAM,WAAW,UAAU,KAAI,MAAK,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG;CAYrD,OAAO;EAAE;EAAO,SAVA,cACN;GACF,IAAI,MAAM,WAAW,GAAG,OAAO,KAAA;GAC/B,MAAM,QAAQ,SAAS,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,KAAK,KAAA,CAAS;GACzD,OAAO,aAAa,OAAO,eAAe,KAAK,KACxC,cAAc,OAAO,QAAQ,YAAY,OAAO,KAAK;EAChE,GACA;GAAC,OAAO;GAAe,OAAO;GAAQ;GAAY;GAAU;EAAK,CAGrD;CAAQ;AAC5B;;;;;;;;AASA,SAAgB,iBAAiB,EAAE,OAAO,SAAgD;CACtF,OACI,qBAAC,OAAD;EAAK,WAAU;YAAf,CACI,oBAAC,QAAD;GACI,WAAU;GACV,OAAO,MAAM;aAEZ;EACC,CAAA,GACN,oBAAC,QAAD;GAAM,WAAU;aACZ,oBAAC,SAAD,EAAS,MAAM,MAAM,QAAS,CAAA;EAC5B,CAAA,CACL;;AAEb;;;;;;;;;;AAWA,SAAgB,WAAW,YAAiD,MAAsB;CAC9F,MAAM,WAAW,KAAK,MAAM,GAAG;CAC/B,IAAI,OAAO;CACX,IAAI;CAEJ,KAAK,MAAM,WAAW,UAAU;EAC5B,MAAM,WAAW,OAAO;EAMxB,IAAI,CAAC,UAAU;EACf,QAAQ,SAAS,QAAQ;EACzB,OAAO,SAAS;CACpB;CAEA,IAAI,OAAO,OAAO;CAElB,QADa,SAAS,SAAS,SAAS,MAAM,KAAA,CAClC,QAAQ,UAAU,GAAG,CAAC,CAAC,QAAQ,OAAM,MAAK,EAAE,YAAY,CAAC;AACzE"}
|