diff --git a/app/client/packages/design-system/ads/src/List/List.stories.tsx b/app/client/packages/design-system/ads/src/List/List.stories.tsx index b706996413..d7cacdcf00 100644 --- a/app/client/packages/design-system/ads/src/List/List.stories.tsx +++ b/app/client/packages/design-system/ads/src/List/List.stories.tsx @@ -211,20 +211,36 @@ export const ListItemInlineDescStory = ListItemTemplate.bind({}) as StoryObj; ListItemInlineDescStory.storyName = "List item inline description"; ListItemInlineDescStory.argTypes = ListItemArgTypes; ListItemInlineDescStory.args = { - title: "Action item 1", + title: + "Action_item_1_with_a_very_long_name_that_should_show_ellipsis_in_the_same_line", description: "inline", }; -export const ListItemBlockDescStory = ListItemTemplate.bind({}) as StoryObj; -ListItemBlockDescStory.storyName = "List item block description"; -ListItemBlockDescStory.argTypes = ListItemArgTypes; -ListItemBlockDescStory.args = { +export const ListItemBlockDescWithIconStory = ListItemTemplate.bind( + {}, +) as StoryObj; +ListItemBlockDescWithIconStory.storyName = + "List item block description with icon"; +ListItemBlockDescWithIconStory.argTypes = ListItemArgTypes; +ListItemBlockDescWithIconStory.args = { startIcon: , title: "Action item 1", description: "block", descriptionType: "block", }; +export const ListItemBlockDescWithoutIconStory = ListItemTemplate.bind( + {}, +) as StoryObj; +ListItemBlockDescWithoutIconStory.storyName = + "List item block description without icon"; +ListItemBlockDescWithoutIconStory.argTypes = ListItemArgTypes; +ListItemBlockDescWithoutIconStory.args = { + title: "Action item 1", + description: "Action item 1 block description", + descriptionType: "block", +}; + export const ListItemOverflowStory = ListItemTemplate.bind({}) as StoryObj; ListItemOverflowStory.storyName = "List item title overflow"; ListItemOverflowStory.argTypes = ListItemArgTypes; diff --git a/app/client/packages/design-system/ads/src/List/List.styles.tsx b/app/client/packages/design-system/ads/src/List/List.styles.tsx index f27e179b4c..27d4567e12 100644 --- a/app/client/packages/design-system/ads/src/List/List.styles.tsx +++ b/app/client/packages/design-system/ads/src/List/List.styles.tsx @@ -31,6 +31,10 @@ const Sizes = { export const TooltipTextWrapper = styled.div` display: flex; min-width: 0; + + &.${ListItemIDescClassName}-wrapper { + min-width: unset; + } `; export const RightControlWrapper = styled.div` @@ -54,8 +58,11 @@ export const TopContentWrapper = styled.div` `; export const BottomContentWrapper = styled.div` - padding-left: var(--ads-v2-spaces-7); padding-bottom: var(--ads-v2-spaces-2); + + &[data-isiconpresent="true"] { + padding-left: var(--ads-v2-spaces-7); + } `; export const InlineDescriptionWrapper = styled.div` @@ -91,8 +98,14 @@ export const StyledListItem = styled.div<{ gap: var(--ads-v2-spaces-1); flex-shrink: 0; flex-direction: column; + max-height: 32px; ${({ size }) => Sizes[size]} + + &[data-isblockdescription="true"] { + max-height: 54px; + } + &[data-rightcontrolvisibility="hover"] { ${RightControlWrapper} { display: none; @@ -128,6 +141,7 @@ export const StyledListItem = styled.div<{ white-space: nowrap; text-overflow: ellipsis; flex: 1; + padding-right: var(--ads-v2-spaces-2); } & .${ListItemTitleClassName} { diff --git a/app/client/packages/design-system/ads/src/List/List.tsx b/app/client/packages/design-system/ads/src/List/List.tsx index 18240c8a78..eb3c76d2ea 100644 --- a/app/client/packages/design-system/ads/src/List/List.tsx +++ b/app/client/packages/design-system/ads/src/List/List.tsx @@ -64,7 +64,10 @@ function TextWithTooltip(props: TextProps & { isMultiline?: boolean }) { return ( - + { e.stopPropagation(); @@ -114,6 +121,7 @@ function ListItem(props: ListItemProps) { {isBlockDescription && ( - + (props: EntityGroupProps) => { const { addConfig, className, groupTitle, items } = props; - return ; + return ( + + ); }; export const SingleGroupWithAddNLazyLoad = EntityGroupTemplate.bind( @@ -83,7 +88,7 @@ SingleGroupWithAddNLazyLoad.args = { const EntityGroupsListTemplate = (props: EntityGroupsListProps) => { const { groups } = props; - return ; + return ; }; export const MultipleGroupsWithAddNLazyLoad = EntityGroupsListTemplate.bind( diff --git a/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx b/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx index 9493867fa5..05ad78b69a 100644 --- a/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx +++ b/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import React, { useEffect, useMemo } from "react"; import { LoadMore } from "./EntityGroupsList.styles"; import type { EntityGroupProps, @@ -9,13 +9,13 @@ import { List, ListItem, type ListItemProps } from "../../../List"; import { Divider } from "../../../Divider"; const EntityGroupsList = (props: EntityGroupsListProps) => { - const { flexProps, groups, showDivider } = props; + const { flexProps, groups, showDivider, visibleItems } = props; return ( {groups.map((group, index) => ( - + {showDivider && index < groups.length - 1 && ( (props: EntityGroupsListProps) => { ); }; -const EntityGroup = ({ group }: { group: EntityGroupProps }) => { - const [visibleItemsCount, setVisibleItemsCount] = React.useState(5); +const EntityGroup = ({ + group, + visibleItems, +}: { + group: EntityGroupProps; + visibleItems?: number; +}) => { + const [visibleItemsCount, setVisibleItemsCount] = React.useState( + visibleItems || group.items.length, + ); + + useEffect(() => { + setVisibleItemsCount(visibleItems || group.items.length); + }, [group.items.length, visibleItems]); const lazyLoading = useMemo(() => { return { diff --git a/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.types.ts b/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.types.ts index 84fdad7103..b086483823 100644 --- a/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.types.ts +++ b/app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.types.ts @@ -16,4 +16,5 @@ export interface EntityGroupsListProps { groups: EntityGroupProps[]; flexProps?: FlexProps; showDivider?: boolean; + visibleItems?: number; } diff --git a/app/client/src/ce/selectors/entitiesSelector.ts b/app/client/src/ce/selectors/entitiesSelector.ts index a512b77ed0..df1c6d0a85 100644 --- a/app/client/src/ce/selectors/entitiesSelector.ts +++ b/app/client/src/ce/selectors/entitiesSelector.ts @@ -1670,7 +1670,7 @@ export const getQuerySegmentItems = createSelector( } return { - icon: ActionUrlIcon(iconUrl), + icon: ActionUrlIcon(iconUrl, "16", "16"), title: action.config.name, key: action.config.baseId, type: action.config.pluginType, diff --git a/app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx b/app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx index 6ef98d4043..831de87e2a 100644 --- a/app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx +++ b/app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx @@ -1,9 +1,8 @@ import React, { useState } from "react"; import ReactJson from "react-json-view"; import { + EntityGroupsList, Flex, - List, - ListItem, type ListItemProps, SearchInput, Text, @@ -51,33 +50,19 @@ export const StateInspector = () => { value={searchTerm} /> - - {filteredItemGroups.map((item) => ( - - - {item.group} - - - {item.items.map((eachItem) => ( - - ))} - - - ))} - + { + return { + groupTitle: item.group, + items: item.items, + className: "", + }; + })} + /> {selectedItem ? ( ; +export function ActionUrlIcon(url: string, height?: string, width?: string) { + return ; } export function DefaultModuleIcon() { diff --git a/app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx b/app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx index ccfb10b9c7..a15f59e6af 100644 --- a/app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx +++ b/app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx @@ -21,6 +21,7 @@ import { getIDEViewMode } from "selectors/ideSelectors"; import type { FlexProps } from "@appsmith/ads"; import { EditorViewMode } from "ee/entities/IDE/constants"; import { filterEntityGroupsBySearchTerm } from "IDE/utils"; +import { DEFAULT_GROUP_LIST_SIZE } from "../../constants"; const AddJS = () => { const dispatch = useDispatch(); @@ -98,7 +99,14 @@ const AddJS = () => { /> {filteredItemGroups.length > 0 ? ( - + ) : null} {filteredItemGroups.length === 0 && searchTerm !== "" ? ( { const [searchTerm, setSearchTerm] = useState(""); @@ -59,7 +60,14 @@ const AddQuery = () => { /> {filteredItemGroups.length > 0 ? ( - + ) : null} {filteredItemGroups.length === 0 && searchTerm !== "" ? ( { icon={"datasource-v3"} /> ) : null} - - {Object.entries(groupedDatasources).map(([key, value]) => ( - - - - {key} - - - - {value.map((data) => ( - goToDatasource(data.id)} - startIcon={ - - } - title={data.name} - /> - ))} - - - ))} - + { + return { + groupTitle: key, + items: value.map((data) => { + return { + id: data.id, + title: data.name, + startIcon: ( + + ), + description: get(dsUsageMap, data.id, ""), + descriptionType: "block", + className: "t--datasource", + isSelected: currentSelectedDatasource === data.id, + onClick: () => goToDatasource(data.id), + }; + }), + className: "", + }; + })} + /> ); diff --git a/app/client/src/pages/Editor/IDE/RightPane/components/CreateNewQueryModal.tsx b/app/client/src/pages/Editor/IDE/RightPane/components/CreateNewQueryModal.tsx index 78d09fdaa0..c197ab609c 100644 --- a/app/client/src/pages/Editor/IDE/RightPane/components/CreateNewQueryModal.tsx +++ b/app/client/src/pages/Editor/IDE/RightPane/components/CreateNewQueryModal.tsx @@ -12,6 +12,7 @@ import { CREATE_A_NEW_ITEM, createMessage } from "ee/constants/messages"; import { useGroupedAddQueryOperations } from "ee/pages/Editor/IDE/EditorPane/Query/hooks"; import { getShowCreateNewModal } from "selectors/ideSelectors"; import { setShowQueryCreateNewModal } from "actions/ideActions"; +import { DEFAULT_GROUP_LIST_SIZE } from "../../constants"; const CreateNewQueryModal: React.FC = () => { const dispatch = useDispatch(); @@ -36,7 +37,11 @@ const CreateNewQueryModal: React.FC = () => { {createMessage(CREATE_A_NEW_ITEM, "query")} - + diff --git a/app/client/src/pages/Editor/IDE/constants.ts b/app/client/src/pages/Editor/IDE/constants.ts new file mode 100644 index 0000000000..3f7096e37f --- /dev/null +++ b/app/client/src/pages/Editor/IDE/constants.ts @@ -0,0 +1 @@ +export const DEFAULT_GROUP_LIST_SIZE = 5;