@vertesia/ui 0.78.0 → 0.79.1
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/lib/esm/core/components/Panel.js +8 -0
- package/lib/esm/core/components/Panel.js.map +1 -0
- package/lib/esm/core/components/SelectBox.js +1 -1
- package/lib/esm/core/components/SelectBox.js.map +1 -1
- package/lib/esm/core/components/SelectList.js +18 -13
- package/lib/esm/core/components/SelectList.js.map +1 -1
- package/lib/esm/core/components/SidePanel.js +2 -2
- package/lib/esm/core/components/SidePanel.js.map +1 -1
- package/lib/esm/core/components/index.js +1 -1
- package/lib/esm/core/components/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/breadcrumb.js +29 -8
- package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -1
- package/lib/esm/core/components/shadcn/button.js +3 -2
- package/lib/esm/core/components/shadcn/button.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/filterBar.js +41 -14
- package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
- package/lib/esm/core/components/shadcn/index.js +2 -0
- package/lib/esm/core/components/shadcn/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/input.js +4 -1
- package/lib/esm/core/components/shadcn/input.js.map +1 -1
- package/lib/esm/core/components/shadcn/resizeable.js +15 -0
- package/lib/esm/core/components/shadcn/resizeable.js.map +1 -0
- package/lib/esm/core/components/shadcn/selectBox.js +15 -9
- package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/esm/core/components/shadcn/tabs.js +20 -8
- package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
- package/lib/esm/core/components/shadcn/textarea.js +7 -0
- package/lib/esm/core/components/shadcn/textarea.js.map +1 -0
- package/lib/esm/core/components/table/index.js +1 -1
- package/lib/esm/core/components/table/index.js.map +1 -1
- package/lib/esm/core/hooks/CompositeState.js +139 -1
- package/lib/esm/core/hooks/CompositeState.js.map +1 -1
- package/lib/esm/core/hooks/index.js +1 -0
- package/lib/esm/core/hooks/index.js.map +1 -1
- package/lib/esm/core/hooks/useScrollableSearch.js +92 -0
- package/lib/esm/core/hooks/useScrollableSearch.js.map +1 -0
- package/lib/esm/env/index.js +1 -1
- package/lib/esm/env/index.js.map +1 -1
- package/lib/esm/features/agent/PayloadBuilder.js +80 -55
- package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentConversation.js +22 -24
- package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +2 -3
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +2 -2
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +15 -20
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +1 -0
- package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +3 -3
- package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +6 -6
- package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
- package/lib/esm/features/facets/CollectionsFacetsNav.js +85 -0
- package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -0
- package/lib/esm/features/facets/DocumentsFacetsNav.js +19 -7
- package/lib/esm/features/facets/DocumentsFacetsNav.js.map +1 -1
- package/lib/esm/features/facets/EnvironmentFacet.js +1 -1
- package/lib/esm/features/facets/EnvironmentFacet.js.map +1 -1
- package/lib/esm/features/facets/InteractionsFacetsNav.js +88 -0
- package/lib/esm/features/facets/InteractionsFacetsNav.js.map +1 -0
- package/lib/esm/features/facets/PromptsFacetsNav.js +80 -0
- package/lib/esm/features/facets/PromptsFacetsNav.js.map +1 -0
- package/lib/esm/features/facets/RunsFacetsNav.js +28 -6
- package/lib/esm/features/facets/RunsFacetsNav.js.map +1 -1
- package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js +7 -5
- package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js.map +1 -1
- package/lib/esm/features/facets/index.js +10 -8
- package/lib/esm/features/facets/index.js.map +1 -1
- package/lib/esm/features/facets/utils/SearchInterface.js +2 -0
- package/lib/esm/features/facets/utils/SearchInterface.js.map +1 -0
- package/lib/esm/features/facets/utils/StringFacet.js.map +1 -0
- package/lib/esm/features/facets/utils/StringListFacet.js.map +1 -0
- package/lib/esm/features/facets/utils/TypeFacet.js.map +1 -0
- package/lib/esm/features/facets/utils/VEnvironmentFacet.js.map +1 -0
- package/lib/esm/features/facets/utils/VInteractionFacet.js.map +1 -0
- package/lib/esm/features/facets/utils/VStringFacet.js.map +1 -0
- package/lib/esm/features/facets/{VTypeFacet.js → utils/VTypeFacet.js} +9 -4
- package/lib/esm/features/facets/utils/VTypeFacet.js.map +1 -0
- package/lib/esm/features/facets/{VUserFacet.js → utils/VUserFacet.js} +1 -1
- package/lib/esm/features/facets/utils/VUserFacet.js.map +1 -0
- package/lib/esm/features/facets/utils/utils.js.map +1 -0
- package/lib/esm/features/layout/GenericPageNavHeader.js +58 -5
- package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
- package/lib/esm/features/store/collections/BrowseCollectionView.js +3 -0
- package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -1
- package/lib/esm/features/store/collections/CreateCollection.js +2 -2
- package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
- package/lib/esm/features/store/collections/EditCollectionView.js +43 -31
- package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
- package/lib/esm/features/store/collections/SelectCollection.js +46 -16
- package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
- package/lib/esm/features/store/objects/DocumentSearchResults.js +43 -13
- package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/esm/features/store/objects/DocumentTable.js +6 -6
- package/lib/esm/features/store/objects/DocumentTable.js.map +1 -1
- package/lib/esm/features/store/objects/components/ContentOverview.js +225 -87
- package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/esm/features/store/objects/components/DocumentIcon.js +11 -3
- package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -1
- package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +11 -2
- package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -1
- package/lib/esm/features/store/objects/components/useDownloadObject.js +2 -2
- package/lib/esm/features/store/objects/components/useDownloadObject.js.map +1 -1
- package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +13 -1
- package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -1
- package/lib/esm/features/store/objects/layout/documentLayout.js +7 -8
- package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -1
- package/lib/esm/features/store/objects/layout/renderers.js +28 -12
- package/lib/esm/features/store/objects/layout/renderers.js.map +1 -1
- package/lib/esm/features/store/objects/search/DocumentSearchContext.js +5 -1
- package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +1 -1
- package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -1
- package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +3 -2
- package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +1 -1
- package/lib/esm/features/store/objects/selection/SelectionActions.js +2 -0
- package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +12 -4
- package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +20 -2
- package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
- package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +16 -8
- package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
- package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +1 -1
- package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -1
- package/lib/esm/features/store/types/ObjectSchemaEditor.js +1 -1
- package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
- package/lib/esm/features/user/UserInfo.js +35 -1
- package/lib/esm/features/user/UserInfo.js.map +1 -1
- package/lib/esm/router/HistoryNavigator.js +25 -2
- package/lib/esm/router/HistoryNavigator.js.map +1 -1
- package/lib/esm/router/Nav.js +3 -3
- package/lib/esm/router/Nav.js.map +1 -1
- package/lib/esm/session/UserSession.js +1 -0
- package/lib/esm/session/UserSession.js.map +1 -1
- package/lib/esm/session/UserSessionProvider.js +9 -2
- package/lib/esm/session/UserSessionProvider.js.map +1 -1
- package/lib/esm/session/auth/composable.js +66 -67
- package/lib/esm/session/auth/composable.js.map +1 -1
- package/lib/esm/shell/login/UserInfo.js +1 -1
- package/lib/esm/shell/login/UserInfo.js.map +1 -1
- package/lib/esm/widgets/form/Form.js +17 -30
- package/lib/esm/widgets/form/Form.js.map +1 -1
- package/lib/esm/widgets/form/FormContext.js +4 -2
- package/lib/esm/widgets/form/FormContext.js.map +1 -1
- package/lib/esm/widgets/form/ManagedObject.js +4 -0
- package/lib/esm/widgets/form/ManagedObject.js.map +1 -1
- package/lib/esm/widgets/form/fields.js +4 -3
- package/lib/esm/widgets/form/fields.js.map +1 -1
- package/lib/esm/widgets/form/inputs.js +2 -0
- package/lib/esm/widgets/form/inputs.js.map +1 -1
- package/lib/esm/widgets/schema-editor/index.js +0 -1
- package/lib/esm/widgets/schema-editor/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/components/Panel.d.ts +11 -0
- package/lib/types/core/components/Panel.d.ts.map +1 -0
- package/lib/types/core/components/SelectList.d.ts +2 -1
- package/lib/types/core/components/SelectList.d.ts.map +1 -1
- package/lib/types/core/components/SidePanel.d.ts.map +1 -1
- package/lib/types/core/components/index.d.ts +1 -1
- package/lib/types/core/components/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/breadcrumb.d.ts +3 -2
- package/lib/types/core/components/shadcn/breadcrumb.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/index.d.ts +2 -0
- package/lib/types/core/components/shadcn/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/input.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/resizeable.d.ts +9 -0
- package/lib/types/core/components/shadcn/resizeable.d.ts.map +1 -0
- package/lib/types/core/components/shadcn/selectBox.d.ts +3 -2
- package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/tabs.d.ts +2 -1
- package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/textarea.d.ts +4 -0
- package/lib/types/core/components/shadcn/textarea.d.ts.map +1 -0
- package/lib/types/core/hooks/CompositeState.d.ts +115 -6
- package/lib/types/core/hooks/CompositeState.d.ts.map +1 -1
- package/lib/types/core/hooks/index.d.ts +1 -0
- package/lib/types/core/hooks/index.d.ts.map +1 -1
- package/lib/types/core/hooks/useScrollableSearch.d.ts +82 -0
- package/lib/types/core/hooks/useScrollableSearch.d.ts.map +1 -0
- package/lib/types/env/index.d.ts +3 -1
- package/lib/types/env/index.d.ts.map +1 -1
- package/lib/types/features/agent/PayloadBuilder.d.ts +11 -19
- package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +1 -1
- package/lib/types/features/facets/CollectionsFacetsNav.d.ts +14 -0
- package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -0
- package/lib/types/features/facets/DocumentsFacetsNav.d.ts +1 -1
- package/lib/types/features/facets/DocumentsFacetsNav.d.ts.map +1 -1
- package/lib/types/features/facets/InteractionsFacetsNav.d.ts +14 -0
- package/lib/types/features/facets/InteractionsFacetsNav.d.ts.map +1 -0
- package/lib/types/features/facets/PromptsFacetsNav.d.ts +15 -0
- package/lib/types/features/facets/PromptsFacetsNav.d.ts.map +1 -0
- package/lib/types/features/facets/RunsFacetsNav.d.ts +1 -1
- package/lib/types/features/facets/RunsFacetsNav.d.ts.map +1 -1
- package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts +1 -1
- package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts.map +1 -1
- package/lib/types/features/facets/index.d.ts +10 -8
- package/lib/types/features/facets/index.d.ts.map +1 -1
- package/lib/types/features/facets/utils/SearchInterface.d.ts +14 -0
- package/lib/types/features/facets/utils/SearchInterface.d.ts.map +1 -0
- package/lib/types/features/facets/utils/StringFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/StringListFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/TypeFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/VEnvironmentFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/VInteractionFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/VStringFacet.d.ts.map +1 -0
- package/lib/types/features/facets/{VTypeFacet.d.ts → utils/VTypeFacet.d.ts} +2 -1
- package/lib/types/features/facets/utils/VTypeFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/VUserFacet.d.ts.map +1 -0
- package/lib/types/features/facets/utils/utils.d.ts.map +1 -0
- package/lib/types/features/layout/GenericPageNavHeader.d.ts +2 -1
- package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
- package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +1 -1
- package/lib/types/features/store/collections/CreateCollection.d.ts.map +1 -1
- package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
- package/lib/types/features/store/collections/SelectCollection.d.ts +12 -8
- package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -1
- package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/types/features/store/objects/DocumentTable.d.ts +4 -0
- package/lib/types/features/store/objects/DocumentTable.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/DocumentIcon.d.ts +7 -1
- package/lib/types/features/store/objects/components/DocumentIcon.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/useDownloadObject.d.ts +1 -1
- package/lib/types/features/store/objects/components/useDownloadObject.d.ts.map +1 -1
- package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts +2 -1
- package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts.map +1 -1
- package/lib/types/features/store/objects/layout/documentLayout.d.ts +4 -2
- package/lib/types/features/store/objects/layout/documentLayout.d.ts.map +1 -1
- package/lib/types/features/store/objects/layout/renderers.d.ts +1 -1
- package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -1
- package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +2 -3
- package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +1 -0
- package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
- package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -1
- package/lib/types/features/user/UserInfo.d.ts +12 -1
- package/lib/types/features/user/UserInfo.d.ts.map +1 -1
- package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/types/router/Nav.d.ts +2 -1
- package/lib/types/router/Nav.d.ts.map +1 -1
- package/lib/types/session/UserSession.d.ts.map +1 -1
- package/lib/types/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/types/session/auth/composable.d.ts.map +1 -1
- package/lib/types/widgets/form/Form.d.ts +2 -1
- package/lib/types/widgets/form/Form.d.ts.map +1 -1
- package/lib/types/widgets/form/FormContext.d.ts +5 -2
- package/lib/types/widgets/form/FormContext.d.ts.map +1 -1
- package/lib/types/widgets/form/ManagedObject.d.ts.map +1 -1
- package/lib/types/widgets/form/fields.d.ts +2 -2
- package/lib/types/widgets/form/fields.d.ts.map +1 -1
- package/lib/types/widgets/form/inputs.d.ts.map +1 -1
- package/lib/types/widgets/schema-editor/index.d.ts +0 -1
- package/lib/types/widgets/schema-editor/index.d.ts.map +1 -1
- package/lib/vertesia-ui-core.js +1 -1
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +1 -1
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +1 -1
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +166 -165
- package/src/core/components/Panel.tsx +34 -0
- package/src/core/components/SelectList.tsx +11 -1
- package/src/core/components/SidePanel.tsx +18 -13
- package/src/core/components/index.ts +1 -1
- package/src/core/components/shadcn/breadcrumb.tsx +49 -30
- package/src/core/components/shadcn/button.tsx +3 -2
- package/src/core/components/shadcn/filters/filterBar.tsx +49 -23
- package/src/core/components/shadcn/index.ts +2 -0
- package/src/core/components/shadcn/input.tsx +10 -7
- package/src/core/components/shadcn/resizeable.tsx +54 -0
- package/src/core/components/shadcn/selectBox.tsx +87 -67
- package/src/core/components/shadcn/tabs.tsx +25 -8
- package/src/core/components/shadcn/textarea.tsx +21 -0
- package/src/core/components/table/index.tsx +1 -1
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/useScrollableSearch.tsx +193 -0
- package/src/features/agent/chat/ModernAgentConversation.tsx +109 -118
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +2 -22
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +1 -9
- package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +39 -55
- package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +1 -0
- package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +8 -8
- package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +8 -8
- package/src/features/facets/CollectionsFacetsNav.tsx +115 -0
- package/src/features/facets/DocumentsFacetsNav.tsx +22 -11
- package/src/features/facets/EnvironmentFacet.tsx +1 -1
- package/src/features/facets/InteractionsFacetsNav.tsx +121 -0
- package/src/features/facets/PromptsFacetsNav.tsx +110 -0
- package/src/features/facets/RunsFacetsNav.tsx +40 -9
- package/src/features/facets/WorkflowExecutionsFacetsNav.tsx +10 -8
- package/src/features/facets/index.ts +11 -9
- package/src/features/facets/utils/SearchInterface.tsx +12 -0
- package/src/features/facets/{VTypeFacet.tsx → utils/VTypeFacet.tsx} +12 -5
- package/src/features/facets/{VUserFacet.tsx → utils/VUserFacet.tsx} +1 -1
- package/src/features/layout/GenericPageNavHeader.tsx +73 -10
- package/src/features/store/collections/BrowseCollectionView.tsx +4 -0
- package/src/features/store/collections/CreateCollection.tsx +3 -4
- package/src/features/store/collections/EditCollectionView.tsx +104 -85
- package/src/features/store/collections/SelectCollection.tsx +214 -29
- package/src/features/store/objects/DocumentSearchResults.tsx +98 -27
- package/src/features/store/objects/DocumentTable.tsx +14 -4
- package/src/features/store/objects/components/ContentOverview.tsx +536 -267
- package/src/features/store/objects/components/DocumentIcon.tsx +42 -13
- package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +12 -2
- package/src/features/store/objects/layout/DocumentTableColumn.tsx +16 -1
- package/src/features/store/objects/layout/documentLayout.tsx +10 -12
- package/src/features/store/objects/layout/knowledge.md +10 -10
- package/src/features/store/objects/layout/renderers.tsx +39 -18
- package/src/features/store/objects/search/DocumentSearchContext.ts +6 -1
- package/src/features/store/objects/search/DocumentSearchProvider.tsx +1 -1
- package/src/features/store/objects/selection/ObjectsActionContext.tsx +3 -2
- package/src/features/store/objects/selection/SelectionActions.tsx +2 -0
- package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +23 -10
- package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +22 -2
- package/src/features/store/objects/upload/DocumentUploadModal.tsx +23 -15
- package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +10 -7
- package/src/features/store/types/CreateOrUpdateTypeModal.tsx +1 -1
- package/src/features/store/types/ObjectSchemaEditor.tsx +1 -1
- package/src/features/user/UserInfo.tsx +66 -3
- package/src/router/HistoryNavigator.ts +33 -2
- package/src/router/Nav.tsx +4 -3
- package/src/shell/login/UserInfo.tsx +1 -1
- package/src/widgets/form/Form.tsx +19 -43
- package/src/widgets/form/FormContext.ts +5 -2
- package/src/widgets/form/fields.tsx +8 -6
- package/src/widgets/form/inputs.tsx +1 -0
- package/src/widgets/schema-editor/index.ts +0 -1
- package/lib/esm/core/components/Textarea.js +0 -15
- package/lib/esm/core/components/Textarea.js.map +0 -1
- package/lib/esm/features/facets/FacetsNav.js +0 -8
- package/lib/esm/features/facets/FacetsNav.js.map +0 -1
- package/lib/esm/features/facets/StringFacet.js.map +0 -1
- package/lib/esm/features/facets/StringListFacet.js.map +0 -1
- package/lib/esm/features/facets/TypeFacet.js.map +0 -1
- package/lib/esm/features/facets/VEnvironmentFacet.js.map +0 -1
- package/lib/esm/features/facets/VFacetsNav.js +0 -48
- package/lib/esm/features/facets/VFacetsNav.js.map +0 -1
- package/lib/esm/features/facets/VInteractionFacet.js.map +0 -1
- package/lib/esm/features/facets/VStringFacet.js.map +0 -1
- package/lib/esm/features/facets/VTypeFacet.js.map +0 -1
- package/lib/esm/features/facets/VUserFacet.js.map +0 -1
- package/lib/esm/features/facets/utils.js.map +0 -1
- package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js +0 -49
- package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js.map +0 -1
- package/lib/types/core/components/Textarea.d.ts +0 -8
- package/lib/types/core/components/Textarea.d.ts.map +0 -1
- package/lib/types/features/facets/FacetsNav.d.ts +0 -7
- package/lib/types/features/facets/FacetsNav.d.ts.map +0 -1
- package/lib/types/features/facets/StringFacet.d.ts.map +0 -1
- package/lib/types/features/facets/StringListFacet.d.ts.map +0 -1
- package/lib/types/features/facets/TypeFacet.d.ts.map +0 -1
- package/lib/types/features/facets/VEnvironmentFacet.d.ts.map +0 -1
- package/lib/types/features/facets/VFacetsNav.d.ts +0 -16
- package/lib/types/features/facets/VFacetsNav.d.ts.map +0 -1
- package/lib/types/features/facets/VInteractionFacet.d.ts.map +0 -1
- package/lib/types/features/facets/VStringFacet.d.ts.map +0 -1
- package/lib/types/features/facets/VTypeFacet.d.ts.map +0 -1
- package/lib/types/features/facets/VUserFacet.d.ts.map +0 -1
- package/lib/types/features/facets/utils.d.ts.map +0 -1
- package/lib/types/widgets/schema-editor/JSONSchemaEditorModal.d.ts +0 -10
- package/lib/types/widgets/schema-editor/JSONSchemaEditorModal.d.ts.map +0 -1
- package/src/core/components/Textarea.tsx +0 -25
- package/src/features/facets/FacetsNav.tsx +0 -19
- package/src/features/facets/VFacetsNav.tsx +0 -81
- package/src/widgets/schema-editor/JSONSchemaEditorModal.tsx +0 -67
- /package/lib/esm/features/facets/{StringFacet.js → utils/StringFacet.js} +0 -0
- /package/lib/esm/features/facets/{StringListFacet.js → utils/StringListFacet.js} +0 -0
- /package/lib/esm/features/facets/{TypeFacet.js → utils/TypeFacet.js} +0 -0
- /package/lib/esm/features/facets/{VEnvironmentFacet.js → utils/VEnvironmentFacet.js} +0 -0
- /package/lib/esm/features/facets/{VInteractionFacet.js → utils/VInteractionFacet.js} +0 -0
- /package/lib/esm/features/facets/{VStringFacet.js → utils/VStringFacet.js} +0 -0
- /package/lib/esm/features/facets/{utils.js → utils/utils.js} +0 -0
- /package/lib/types/features/facets/{StringFacet.d.ts → utils/StringFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{StringListFacet.d.ts → utils/StringListFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{TypeFacet.d.ts → utils/TypeFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{VEnvironmentFacet.d.ts → utils/VEnvironmentFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{VInteractionFacet.d.ts → utils/VInteractionFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{VStringFacet.d.ts → utils/VStringFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{VUserFacet.d.ts → utils/VUserFacet.d.ts} +0 -0
- /package/lib/types/features/facets/{utils.d.ts → utils/utils.d.ts} +0 -0
- /package/src/features/facets/{StringFacet.tsx → utils/StringFacet.tsx} +0 -0
- /package/src/features/facets/{StringListFacet.tsx → utils/StringListFacet.tsx} +0 -0
- /package/src/features/facets/{TypeFacet.tsx → utils/TypeFacet.tsx} +0 -0
- /package/src/features/facets/{VEnvironmentFacet.tsx → utils/VEnvironmentFacet.tsx} +0 -0
- /package/src/features/facets/{VInteractionFacet.tsx → utils/VInteractionFacet.tsx} +0 -0
- /package/src/features/facets/{VStringFacet.tsx → utils/VStringFacet.tsx} +0 -0
- /package/src/features/facets/{utils.tsx → utils/utils.tsx} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { json } from "@codemirror/lang-json";
|
|
2
|
-
import
|
|
3
|
-
import { Button, ErrorBox, FormItem, Input, Styles, useFetch, useToast } from "@vertesia/ui/core";
|
|
4
|
-
import { useUserSession } from "@vertesia/ui/session";
|
|
5
|
-
import { CodeMirrorEditor, EditorApi, GeneratedForm, ManagedObject } from "@vertesia/ui/widgets";
|
|
2
|
+
import dayjs from "dayjs";
|
|
6
3
|
import { basicSetup } from "codemirror";
|
|
7
4
|
import { useMemo, useRef, useState } from "react";
|
|
5
|
+
import { UserInfo } from "@vertesia/ui/features";
|
|
6
|
+
import { useUserSession } from "@vertesia/ui/session";
|
|
7
|
+
import { Collection, CreateCollectionPayload } from "@vertesia/common";
|
|
8
|
+
import { CodeMirrorEditor, EditorApi, GeneratedForm, ManagedObject } from "@vertesia/ui/widgets";
|
|
9
|
+
import { Button, ErrorBox, FormItem, Input, Styles, Textarea, useFetch, useToast, Panel } from "@vertesia/ui/core";
|
|
8
10
|
import { SelectContentType, stringifyTableLayout } from "../types";
|
|
9
11
|
|
|
10
12
|
const extensions = [basicSetup, json()];
|
|
@@ -42,7 +44,19 @@ export function EditCollectionView({ refetch, collection }: EditCollectionViewPr
|
|
|
42
44
|
}, [collection.table_layout]);
|
|
43
45
|
|
|
44
46
|
const onSubmit = () => {
|
|
45
|
-
|
|
47
|
+
let query: any = undefined;
|
|
48
|
+
try {
|
|
49
|
+
query = metadata.query ? JSON.parse(metadata.query) : undefined;
|
|
50
|
+
} catch (err: any) {
|
|
51
|
+
toast({
|
|
52
|
+
title: "Invalid Query JSON",
|
|
53
|
+
description: err.message,
|
|
54
|
+
status: "error",
|
|
55
|
+
duration: 5000,
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
const payload: Partial<CreateCollectionPayload> = {
|
|
47
61
|
name: metadata.name,
|
|
48
62
|
description: metadata.description,
|
|
@@ -65,6 +79,7 @@ export function EditCollectionView({ refetch, collection }: EditCollectionViewPr
|
|
|
65
79
|
status: "error",
|
|
66
80
|
duration: 5000,
|
|
67
81
|
});
|
|
82
|
+
return;
|
|
68
83
|
}
|
|
69
84
|
if (tableLayoutRef.current) {
|
|
70
85
|
const layout = tableLayoutRef.current.getValue();
|
|
@@ -118,61 +133,82 @@ export function EditCollectionView({ refetch, collection }: EditCollectionViewPr
|
|
|
118
133
|
|
|
119
134
|
return (
|
|
120
135
|
<div className="flex flex-col gap-4 py-2">
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
<Panel title="Configuration"
|
|
137
|
+
action={
|
|
138
|
+
<Button size="lg" isDisabled={isUpdating} onClick={onSubmit}>
|
|
139
|
+
Save
|
|
140
|
+
</Button>
|
|
141
|
+
}>
|
|
142
|
+
<div className="flex justify-between mb-2">
|
|
143
|
+
<div className="w-1/2 gap-2 flex flex-col">
|
|
144
|
+
<div className="text-sm font-medium mb-1">Created By</div>
|
|
145
|
+
<div className="gap-2 flex items-center">
|
|
146
|
+
<UserInfo userRef={collection.created_by} showTitle />
|
|
147
|
+
<span>at {dayjs(collection.created_at).format("YYYY-MM-DD HH:mm:ss")}</span>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div className="w-1/2 gap-2 flex flex-col">
|
|
151
|
+
<div className="text-sm font-medium mb-1">Updated By</div>
|
|
152
|
+
<div className="gap-2 flex items-center">
|
|
153
|
+
<UserInfo userRef={collection.updated_by} showTitle />
|
|
154
|
+
<span>at {dayjs(collection.updated_at).format("YYYY-MM-DD HH:mm:ss")}</span>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
<FormItem label="Name" required>
|
|
159
|
+
<Input value={metadata.name} onChange={(v) => setField("name", v)} />
|
|
160
|
+
</FormItem>
|
|
161
|
+
<FormItem label="Description">
|
|
162
|
+
<Textarea
|
|
163
|
+
value={metadata.description}
|
|
164
|
+
onChange={(e) => setField("description", e)}
|
|
165
|
+
/>
|
|
166
|
+
</FormItem>
|
|
167
|
+
{
|
|
168
|
+
!collection.dynamic &&
|
|
169
|
+
<FormItem label="Allowed Content Types" description="Select which content types can be added to the collection. If not set, then all content types are allowed.">
|
|
170
|
+
<SelectContentType
|
|
171
|
+
defaultValue={metadata.allowed_types || null}
|
|
172
|
+
onChange={(v) => {
|
|
173
|
+
if (Array.isArray(v)) {
|
|
174
|
+
setField("allowed_types", v.map(type => type.id));
|
|
175
|
+
} else {
|
|
176
|
+
setField("allowed_types", v ? [v.id] : []);
|
|
177
|
+
}
|
|
178
|
+
}}
|
|
179
|
+
isClearable multiple
|
|
180
|
+
/>
|
|
181
|
+
</FormItem>
|
|
182
|
+
}
|
|
183
|
+
{
|
|
184
|
+
collection.dynamic && (
|
|
185
|
+
<FormItem label="Query" description="Define the query to dynamically fetch content for the collection.">
|
|
186
|
+
<Textarea
|
|
187
|
+
className={Styles.INPUT}
|
|
188
|
+
value={metadata.query}
|
|
189
|
+
onChange={(e) => setField("query", e)}
|
|
190
|
+
/>
|
|
191
|
+
</FormItem>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
<FormItem label="Table Layout" description="Define a custom layout for displaying the collection in tables.">
|
|
195
|
+
<CodeMirrorEditor className="border-1 rounded-md border-border"
|
|
196
|
+
value={tableLayoutValue} extensions={extensions} editorRef={tableLayoutRef} />
|
|
197
|
+
</FormItem>
|
|
198
|
+
<FormItem label="Type" description="Select a content type to assign custom properties and data to the collection.">
|
|
134
199
|
<SelectContentType
|
|
135
|
-
defaultValue={metadata.
|
|
200
|
+
defaultValue={metadata.type || null}
|
|
136
201
|
onChange={(v) => {
|
|
137
202
|
if (Array.isArray(v)) {
|
|
138
|
-
setField("
|
|
203
|
+
setField("type", v.length > 0 ? v[0].id : null);
|
|
139
204
|
} else {
|
|
140
|
-
setField("
|
|
205
|
+
setField("type", v?.id || null);
|
|
141
206
|
}
|
|
142
207
|
}}
|
|
143
|
-
isClearable
|
|
144
|
-
/>
|
|
145
|
-
</FormItem>
|
|
146
|
-
}
|
|
147
|
-
{collection.dynamic && (
|
|
148
|
-
<FormItem label="Query" description="Define the query to dynamically fetch content for the collection.">
|
|
149
|
-
<textarea
|
|
150
|
-
className={Styles.INPUT}
|
|
151
|
-
value={metadata.query}
|
|
152
|
-
onChange={(e) => setField("query", e.target.value)}
|
|
208
|
+
isClearable
|
|
153
209
|
/>
|
|
154
210
|
</FormItem>
|
|
155
|
-
|
|
156
|
-
<FormItem label="Table Layout" description="Define a custom layout for displaying the collection in tables.">
|
|
157
|
-
<CodeMirrorEditor className="border-1 rounded-md border-border"
|
|
158
|
-
value={tableLayoutValue} extensions={extensions} editorRef={tableLayoutRef} />
|
|
159
|
-
</FormItem>
|
|
160
|
-
<FormItem label="Type" description="Select a content type to assign custom properties and data to the collection.">
|
|
161
|
-
<SelectContentType
|
|
162
|
-
defaultValue={metadata.type || null}
|
|
163
|
-
onChange={(v) => {
|
|
164
|
-
if (Array.isArray(v)) {
|
|
165
|
-
setField("type", v.length > 0 ? v[0].id : null);
|
|
166
|
-
} else {
|
|
167
|
-
setField("type", v?.id || null);
|
|
168
|
-
}
|
|
169
|
-
}}
|
|
170
|
-
isClearable
|
|
171
|
-
/>
|
|
172
|
-
</FormItem>
|
|
173
|
-
<Button size="lg" className="w-min my-4" isDisabled={isUpdating} onClick={onSubmit}>
|
|
174
|
-
Save Metadata
|
|
175
|
-
</Button>
|
|
211
|
+
</Panel>
|
|
176
212
|
|
|
177
213
|
{typeId && <PropertiesEditor typeId={typeId} collection={collection} />}
|
|
178
214
|
</div>
|
|
@@ -184,28 +220,22 @@ interface PropertiesEditorProps {
|
|
|
184
220
|
collection: Collection;
|
|
185
221
|
}
|
|
186
222
|
function PropertiesEditor({ typeId, collection }: PropertiesEditorProps) {
|
|
223
|
+
const toast = useToast();
|
|
187
224
|
const { client } = useUserSession();
|
|
225
|
+
const [isUpdating, setIsUpdating] = useState(false);
|
|
226
|
+
|
|
188
227
|
const { data: type, error } = useFetch(() => client.store.types.retrieve(typeId), [typeId]);
|
|
228
|
+
const schema = type?.object_schema || {};
|
|
229
|
+
const object = useMemo(() => new ManagedObject(schema, collection.properties || {}), [schema, collection.properties]);
|
|
230
|
+
|
|
189
231
|
if (error) {
|
|
190
232
|
return <ErrorBox title="Failed to load type">{error.message}</ErrorBox>;
|
|
191
233
|
}
|
|
192
234
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
</Section>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
235
|
+
if (!type) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
199
238
|
|
|
200
|
-
interface PropertiesFormProps {
|
|
201
|
-
schema: any;
|
|
202
|
-
collection: Collection;
|
|
203
|
-
}
|
|
204
|
-
function PropertiesForm({ schema = {}, collection }: PropertiesFormProps) {
|
|
205
|
-
const { client } = useUserSession();
|
|
206
|
-
const toast = useToast();
|
|
207
|
-
const object = useMemo(() => new ManagedObject(schema, collection.properties || {}), [schema, collection]);
|
|
208
|
-
const [isUpdating, setIsUpdating] = useState(false);
|
|
209
239
|
|
|
210
240
|
const _onSave = (data: any) => {
|
|
211
241
|
const payload = { properties: data || {} };
|
|
@@ -234,23 +264,12 @@ function PropertiesForm({ schema = {}, collection }: PropertiesFormProps) {
|
|
|
234
264
|
};
|
|
235
265
|
|
|
236
266
|
return (
|
|
237
|
-
<
|
|
238
|
-
<Button size="lg" isLoading={isUpdating}
|
|
239
|
-
Save
|
|
240
|
-
</Button>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
interface SectionProps {
|
|
246
|
-
children: React.ReactNode;
|
|
247
|
-
title: string;
|
|
248
|
-
}
|
|
249
|
-
function Section({ children, title }: SectionProps) {
|
|
250
|
-
return (
|
|
251
|
-
<div className="my-4">
|
|
252
|
-
<div className="text-lg text-gray-700 font-semibold border-b border-b-gray-300 py-2 mb-4">{title}</div>
|
|
253
|
-
{children}
|
|
254
|
-
</div>
|
|
267
|
+
<Panel title="Properties" action={
|
|
268
|
+
<Button size="lg" isLoading={isUpdating} type="submit">
|
|
269
|
+
Save
|
|
270
|
+
</Button>}
|
|
271
|
+
>
|
|
272
|
+
<GeneratedForm object={object} onSubmit={_onSave} />
|
|
273
|
+
</Panel>
|
|
255
274
|
);
|
|
256
275
|
}
|
|
@@ -1,46 +1,231 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Check, ChevronsUpDown } from "lucide-react";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
import { CollectionItem } from "@vertesia/common";
|
|
5
|
+
import {
|
|
6
|
+
Button, cn, ErrorBox, useDebounce, useFetch,
|
|
7
|
+
Popover, PopoverContent, PopoverTrigger,
|
|
8
|
+
Command, CommandEmpty, CommandGroup, CommandItem, CommandInput
|
|
9
|
+
} from "@vertesia/ui/core";
|
|
10
|
+
import { useUserSession } from "@vertesia/ui/session";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* A component to select a collection from a list of collections.
|
|
13
14
|
* It fetches the collections from the store and displays them in a dropdown.
|
|
14
15
|
* @param props - The properties for the component.
|
|
15
16
|
* @returns A dropdown to select a collection.
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
**/
|
|
18
|
+
interface SelectCollectionProps {
|
|
19
|
+
value?: string | string[];
|
|
20
|
+
onChange: (collectionId: string | string[] | undefined, collection?: CollectionItem | CollectionItem[]) => void;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
searchPlaceholder?: string;
|
|
24
|
+
filterOut?: string[]; // collection IDs to filter out from the list
|
|
25
|
+
allowDynamic?: boolean;
|
|
26
|
+
multiple?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function SelectCollection({ onChange, value, disabled = false, placeholder = "Select a collection", searchPlaceholder = "Search collections", filterOut, allowDynamic = true, multiple = false }: SelectCollectionProps) {
|
|
18
30
|
const { client } = useUserSession();
|
|
19
|
-
const { data: collections, error } = useFetch(() => client.store.collections.search({ dynamic: false }), []);
|
|
20
31
|
|
|
32
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
33
|
+
const [isSearching, setIsSearching] = useState(false);
|
|
34
|
+
const [useServerSearch, setUseServerSearch] = useState(false);
|
|
35
|
+
|
|
36
|
+
// Debounce the search query to avoid excessive API calls (only used for server-side search)
|
|
37
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
38
|
+
|
|
39
|
+
// Memoize the search function to prevent unnecessary re-renders
|
|
40
|
+
const searchCollections = useCallback(async (query: string) => {
|
|
41
|
+
setIsSearching(true);
|
|
42
|
+
const trimmedQuery = query.trim();
|
|
43
|
+
|
|
44
|
+
const collections = await client.store.collections.search({
|
|
45
|
+
dynamic: allowDynamic ? undefined : false,
|
|
46
|
+
name: useServerSearch ? (trimmedQuery || undefined) : undefined
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
setIsSearching(false);
|
|
50
|
+
|
|
51
|
+
// Check if we hit the maximum limit (1000 collections) - if so, enable server-side search
|
|
52
|
+
if (!useServerSearch && collections.length >= 1000) {
|
|
53
|
+
setUseServerSearch(true);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Filter out collections if filterOut is provided
|
|
57
|
+
if (filterOut && filterOut.length > 0) {
|
|
58
|
+
return collections.filter(col => !filterOut.includes(col.id));
|
|
59
|
+
}
|
|
60
|
+
return collections;
|
|
61
|
+
}, [client, allowDynamic, filterOut, useServerSearch]);
|
|
62
|
+
|
|
63
|
+
// Fetch collections based on search mode
|
|
64
|
+
const { data: collections, error } = useFetch(
|
|
65
|
+
() => searchCollections(useServerSearch ? debouncedSearchQuery : ''),
|
|
66
|
+
[useServerSearch ? debouncedSearchQuery : '', searchCollections]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// Memoize the selected collection(s)
|
|
70
|
+
const selectedCollection = useMemo(() => {
|
|
71
|
+
if (!collections) return multiple ? [] : undefined;
|
|
72
|
+
|
|
73
|
+
if (multiple && Array.isArray(value)) {
|
|
74
|
+
return collections.filter((collection: CollectionItem) => value.includes(collection.id));
|
|
75
|
+
} else if (!multiple && typeof value === 'string') {
|
|
76
|
+
return collections.find((collection: CollectionItem) => collection.id === value);
|
|
77
|
+
}
|
|
78
|
+
return multiple ? [] : undefined;
|
|
79
|
+
}, [collections, value, multiple]);
|
|
80
|
+
|
|
81
|
+
// Handle collection selection
|
|
82
|
+
const handleSelect = useCallback((collection: CollectionItem) => {
|
|
83
|
+
if (multiple) {
|
|
84
|
+
const currentValues = Array.isArray(value) ? value : [];
|
|
85
|
+
const isSelected = currentValues.includes(collection.id);
|
|
86
|
+
|
|
87
|
+
if (isSelected) {
|
|
88
|
+
// Remove from selection
|
|
89
|
+
const newValues = currentValues.filter(id => id !== collection.id);
|
|
90
|
+
const newCollections = collections?.filter(c => newValues.includes(c.id)) || [];
|
|
91
|
+
onChange(newValues, newCollections);
|
|
92
|
+
} else {
|
|
93
|
+
// Add to selection
|
|
94
|
+
const newValues = [...currentValues, collection.id];
|
|
95
|
+
const newCollections = collections?.filter(c => newValues.includes(c.id)) || [];
|
|
96
|
+
onChange(newValues, newCollections);
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
onChange(collection.id, collection);
|
|
100
|
+
}
|
|
101
|
+
}, [onChange, value, collections, multiple]);
|
|
102
|
+
|
|
103
|
+
// Handle clear selection
|
|
104
|
+
const handleClear = useCallback(() => {
|
|
105
|
+
onChange(undefined, undefined);
|
|
106
|
+
}, [onChange]);
|
|
107
|
+
|
|
108
|
+
// Handle search input change
|
|
109
|
+
const handleSearchChange = useCallback((query: string) => {
|
|
110
|
+
setSearchQuery(query);
|
|
111
|
+
}, []);
|
|
112
|
+
|
|
113
|
+
const hasSearchQuery = searchQuery.trim().length > 0;
|
|
114
|
+
|
|
115
|
+
// Client-side filtering when not using server search
|
|
116
|
+
const filteredCollections = useMemo(() => {
|
|
117
|
+
if (!collections) return [];
|
|
118
|
+
|
|
119
|
+
// If using server search, collections are already filtered by the server
|
|
120
|
+
if (useServerSearch) return collections;
|
|
121
|
+
|
|
122
|
+
// Otherwise, do client-side filtering
|
|
123
|
+
if (!hasSearchQuery) return collections;
|
|
124
|
+
|
|
125
|
+
const queryLower = searchQuery.toLowerCase();
|
|
126
|
+
return collections.filter(col => col.name.toLowerCase().includes(queryLower));
|
|
127
|
+
}, [collections, useServerSearch, hasSearchQuery, searchQuery]);
|
|
128
|
+
|
|
129
|
+
const showClearOption = selectedCollection && hasSearchQuery;
|
|
130
|
+
|
|
131
|
+
// Show error state
|
|
21
132
|
if (error) {
|
|
22
|
-
return
|
|
133
|
+
return (
|
|
134
|
+
<ErrorBox title="Collection fetch failed">
|
|
135
|
+
{error.message}
|
|
136
|
+
</ErrorBox>
|
|
137
|
+
);
|
|
23
138
|
}
|
|
24
139
|
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
140
|
+
// Get display text for the button
|
|
141
|
+
const getDisplayText = () => {
|
|
142
|
+
if (multiple && Array.isArray(selectedCollection) && selectedCollection.length > 0) {
|
|
143
|
+
if (selectedCollection.length === 1) {
|
|
144
|
+
return selectedCollection[0].name;
|
|
145
|
+
}
|
|
146
|
+
return `${selectedCollection.length} collections selected`;
|
|
147
|
+
} else if (!multiple && selectedCollection && !Array.isArray(selectedCollection)) {
|
|
148
|
+
return selectedCollection.name;
|
|
149
|
+
}
|
|
150
|
+
return placeholder;
|
|
31
151
|
};
|
|
32
152
|
|
|
33
153
|
return (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
154
|
+
<Popover>
|
|
155
|
+
<PopoverTrigger asChild>
|
|
156
|
+
<Button
|
|
157
|
+
variant="outline"
|
|
158
|
+
role="combobox"
|
|
159
|
+
aria-haspopup="listbox"
|
|
160
|
+
className={cn("w-full justify-between min-w-0")}
|
|
161
|
+
disabled={disabled}
|
|
162
|
+
>
|
|
163
|
+
<span className="truncate flex-1 text-left min-w-0">
|
|
164
|
+
{getDisplayText()}
|
|
165
|
+
</span>
|
|
166
|
+
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
167
|
+
</Button>
|
|
168
|
+
</PopoverTrigger>
|
|
169
|
+
<PopoverContent className="mt-2 mb-2 w-[var(--radix-popover-trigger-width)] p-0" align="start">
|
|
170
|
+
<Command shouldFilter={false}>
|
|
171
|
+
<div className="flex justify-between items-center border-b px-3" cmdk-input-wrapper="">
|
|
172
|
+
<CommandInput
|
|
173
|
+
placeholder={searchPlaceholder}
|
|
174
|
+
value={searchQuery}
|
|
175
|
+
onValueChange={handleSearchChange}
|
|
176
|
+
className="flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50"
|
|
177
|
+
/>
|
|
178
|
+
{
|
|
179
|
+
isSearching && (
|
|
180
|
+
<div className="mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
</div>
|
|
184
|
+
<CommandEmpty>
|
|
185
|
+
{
|
|
186
|
+
isSearching
|
|
187
|
+
? "Searching..."
|
|
188
|
+
: hasSearchQuery
|
|
189
|
+
? "No collections found."
|
|
190
|
+
: "No collections available."
|
|
191
|
+
}
|
|
192
|
+
</CommandEmpty>
|
|
193
|
+
<CommandGroup className="max-h-[300px] overflow-auto">
|
|
194
|
+
{
|
|
195
|
+
showClearOption && !multiple && (
|
|
196
|
+
<CommandItem
|
|
197
|
+
value="__clear__"
|
|
198
|
+
onSelect={handleClear}
|
|
199
|
+
className="text-muted-foreground"
|
|
200
|
+
>
|
|
201
|
+
Clear selection
|
|
202
|
+
</CommandItem>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
{
|
|
206
|
+
filteredCollections.map((collection: CollectionItem) => {
|
|
207
|
+
const isSelected = multiple && Array.isArray(value)
|
|
208
|
+
? value.includes(collection.id)
|
|
209
|
+
: value === collection.id;
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<CommandItem
|
|
213
|
+
key={collection.id}
|
|
214
|
+
value={collection.id}
|
|
215
|
+
onSelect={() => handleSelect(collection)}
|
|
216
|
+
className="flex items-center justify-between"
|
|
217
|
+
>
|
|
218
|
+
<span className="truncate">{collection.name}</span>
|
|
219
|
+
{isSelected && (
|
|
220
|
+
<Check className="ml-2 h-4 w-4 shrink-0" />
|
|
221
|
+
)}
|
|
222
|
+
</CommandItem>
|
|
223
|
+
);
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
</CommandGroup>
|
|
227
|
+
</Command>
|
|
228
|
+
</PopoverContent>
|
|
229
|
+
</Popover>
|
|
45
230
|
);
|
|
46
231
|
}
|