-
Notifications
You must be signed in to change notification settings - Fork 0
Enh/nxt 4296 Component search #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
542baae
86f8bc2
4958bcd
5ea9854
72ddf2c
cece9e2
cf2d489
88e14aa
9ba8901
f2ed3a0
b811725
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1212,6 +1212,118 @@ export interface ComponentPortDescription { | |||||
| } | ||||||
|
|
||||||
|
|
||||||
| /** | ||||||
| * ... | ||||||
| * @export | ||||||
| * @interface ComponentSearchItem | ||||||
| */ | ||||||
| export interface ComponentSearchItem { | ||||||
|
|
||||||
| /** | ||||||
| * Space item ID of this component | ||||||
| * @type {string} | ||||||
| * @memberof ComponentSearchItem | ||||||
| */ | ||||||
| id: string; | ||||||
| /** | ||||||
| * The name of the component as given by the component creator | ||||||
| * @type {string} | ||||||
| * @memberof ComponentSearchItem | ||||||
| */ | ||||||
| name: string; | ||||||
| /** | ||||||
| * The description of the component as given by the component creator | ||||||
| * @type {string} | ||||||
| * @memberof ComponentSearchItem | ||||||
| */ | ||||||
| description?: string; | ||||||
| /** | ||||||
| * serialised data of component icon | ||||||
| * @type {string} | ||||||
| * @memberof ComponentSearchItem | ||||||
| */ | ||||||
| icon?: string; | ||||||
| /** | ||||||
| * The type (a.k.a. \"kind\") of the component | ||||||
| * @type {string} | ||||||
| * @memberof ComponentSearchItem | ||||||
| */ | ||||||
| type: ComponentSearchItem.TypeEnum; | ||||||
| /** | ||||||
| * The components's input ports. | ||||||
| * @type {Array<ComponentSearchItemPort>} | ||||||
| * @memberof ComponentSearchItem | ||||||
| */ | ||||||
| inPorts?: Array<ComponentSearchItemPort>; | ||||||
| /** | ||||||
| * The node's output ports. | ||||||
|
||||||
| * The node's output ports. | |
| * The component's output ports. |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says 'The description of the component' but this field is in ComponentSearchItemPort and should refer to the port description, not the component description. It should say 'The description of the port as given by the component creator.'
| * The description of the component as given by the component creator. | |
| * The description of the port as given by the component creator. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| <script setup lang="ts"> | ||
| import { nextTick, ref, toRefs, useTemplateRef, watch } from "vue"; | ||
|
|
||
| import ScrollViewContainer from "@/components/common/ScrollViewContainer/ScrollViewContainer.vue"; | ||
| import { createStaggeredLoader } from "@/util/createStaggeredLoader"; | ||
|
|
||
| type Props = { | ||
| isLoading: boolean; | ||
| fetchMore: () => Promise<any>; | ||
| }; | ||
| const props = defineProps<Props>(); | ||
|
|
||
| const searchScrollPosition = defineModel<number>({ default: 0 }); | ||
|
|
||
| const { isLoading } = toRefs(props); | ||
|
|
||
| const isLoadingNextPage = ref(false); | ||
|
|
||
| /** | ||
| * State used to mirror the loading state but with a small | ||
| * time offset, so as not to immediately show the loading state | ||
| * if the results arrive quickly | ||
| * */ | ||
| const isLoadingDeferred = ref(false); | ||
|
|
||
| const setIsLoadingNextPage = createStaggeredLoader({ | ||
| firstStageCallback: () => { | ||
| isLoadingNextPage.value = true; | ||
| }, | ||
| resetCallback: () => { | ||
| isLoadingNextPage.value = false; | ||
| }, | ||
| }); | ||
|
|
||
| const setIsLoadingDeferred = createStaggeredLoader({ | ||
| firstStageCallback: () => { | ||
| isLoadingDeferred.value = true; | ||
| }, | ||
| resetCallback: () => { | ||
| isLoadingDeferred.value = false; | ||
| }, | ||
| }); | ||
|
|
||
| watch( | ||
| isLoading, | ||
| (value) => { | ||
| setIsLoadingDeferred(value); | ||
| }, | ||
| { immediate: true }, | ||
| ); | ||
|
|
||
| const onSaveScrollPosition = (position: number) => { | ||
| searchScrollPosition.value = position; | ||
| }; | ||
|
|
||
| const scroller = useTemplateRef("scroller"); | ||
| const scrollToTop = async () => { | ||
| // wait for new content to be displayed, then scroll to top | ||
| await nextTick(); | ||
| if (scroller.value) { | ||
| scroller.value.$el.scrollTop = 0; | ||
| } | ||
| }; | ||
|
|
||
| const loadMoreSearchResults = async () => { | ||
| setIsLoadingNextPage(true); | ||
| await props.fetchMore(); | ||
| setIsLoadingNextPage(false); | ||
| }; | ||
|
|
||
| defineExpose({ scrollToTop }); | ||
| </script> | ||
|
|
||
| <template> | ||
| <ScrollViewContainer | ||
| ref="scroller" | ||
| class="results" | ||
| :initial-position="searchScrollPosition" | ||
| @save-position="onSaveScrollPosition" | ||
| @scroll-bottom="loadMoreSearchResults" | ||
| > | ||
| <div class="content"> | ||
| <slot | ||
| :is-loading-next-page="isLoadingNextPage" | ||
| :is-loading-deferred="isLoadingDeferred" | ||
| /> | ||
| </div> | ||
| </ScrollViewContainer> | ||
| </template> | ||
|
|
||
| <style lang="postcss" scoped> | ||
| .results { | ||
| & .content { | ||
| padding: 0 var(--space-16) var(--space-16); | ||
|
|
||
| & .node-list { | ||
| margin-bottom: -11px; | ||
| } | ||
|
|
||
| & .node-list-skeleton { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| align-items: center; | ||
| justify-content: flex-start; | ||
| } | ||
| } | ||
| } | ||
| </style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc comment for ComponentSearchItem contains only '...' as a description. Please provide a meaningful description explaining what a ComponentSearchItem represents, such as 'Represents a component in search results with metadata including name, type, ports, and visual information.'