From de21b8602da810231f536fc58e4a1649fc2ca6f2 Mon Sep 17 00:00:00 2001 From: Ihor Korenets Date: Fri, 22 Mar 2024 14:08:16 +0200 Subject: [PATCH 01/25] [PickerTogglerTag]: made to use in PickerToggler renderItem by default or independently. --- uui-components/src/i18n.tsx | 2 +- uui-components/src/pickers/PickerToggler.tsx | 44 ++++++++------ .../src/pickers/hooks/usePickerInput.ts | 8 +++ uui/components/pickers/PickerToggler.tsx | 60 +++++-------------- uui/components/pickers/PickerTogglerTag.tsx | 45 ++++++++++++++ 5 files changed, 93 insertions(+), 66 deletions(-) create mode 100644 uui/components/pickers/PickerTogglerTag.tsx diff --git a/uui-components/src/i18n.tsx b/uui-components/src/i18n.tsx index b394d9d542..9368d41917 100644 --- a/uui-components/src/i18n.tsx +++ b/uui-components/src/i18n.tsx @@ -10,7 +10,7 @@ export const i18n = { showAll: 'SHOW ALL', }, pickerToggler: { - createItemValue: (length: number, entityName: string) => `${length} ${entityName} selected`, + createCollapsedName: (length: number, entityName: string) => `+ ${length} ${entityName} selected`, }, pickerInput: { defaultPlaceholder: (entity: string) => `Please select ${entity}`, diff --git a/uui-components/src/pickers/PickerToggler.tsx b/uui-components/src/pickers/PickerToggler.tsx index 66e0bc1d83..e057ef045a 100644 --- a/uui-components/src/pickers/PickerToggler.tsx +++ b/uui-components/src/pickers/PickerToggler.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; -import { IPickerToggler, IHasIcon, IHasCX, ICanBeReadonly, Icon, uuiMod, uuiElement, uuiMarkers, DataRowProps, cx, IHasRawProps, ICanFocus, isEventTargetInsideClickable } from '@epam/uui-core'; +import { IPickerToggler, IHasIcon, IHasCX, ICanBeReadonly, Icon, uuiMod, uuiElement, uuiMarkers, cx, IHasRawProps, ICanFocus, isEventTargetInsideClickable, DataRowProps } from '@epam/uui-core'; import { IconContainer } from '../layout'; import css from './PickerToggler.module.scss'; import { i18n } from '../i18n'; -import { useCallback } from 'react'; import { getMaxItems } from './helpers'; export interface PickerTogglerProps @@ -27,6 +26,7 @@ export interface PickerTogglerProps * HTML ID attribute for the toggler input */ id?: string; + collapsedNames?: string[]; } function PickerTogglerComponent(props: PickerTogglerProps, ref: React.ForwardedRef) { @@ -37,7 +37,7 @@ function PickerTogglerComponent(props: PickerTogglerProps toggleContainer.current, [toggleContainer.current]); - const handleClick = useCallback( + const handleClick = React.useCallback( (event: Event) => { if (props.isInteractedOutside(event) && inFocus) { blur(); @@ -104,26 +104,32 @@ function PickerTogglerComponent(props: PickerTogglerProps { const maxItems = getMaxItems(props.maxItems); - if (props.selectedRowsCount > maxItems) { - return props.renderItem?.({ - value: i18n.pickerToggler.createItemValue(props.selectedRowsCount, props.entityName || ''), - onCheck: () => { - props.onClear?.(); + + const multiItems = props.selection?.map((row) => { + const newMultiItems = { ...row, + caption: props.getName(row.value), + isCollapsed: false, + isDisabled: row.isDisabled, + onClear: () => { + row.onCheck?.(row); // When we delete item it disappears from the DOM and focus is passed to the Body. So in this case we have to return focus on the toggleContainer by hand. toggleContainer.current?.focus(); - }, + } }; + return props.renderItem?.(newMultiItems); + }); + + if (props.selectedRowsCount > maxItems) { + const collapsedItem = props.renderItem?.({ + caption: i18n.pickerToggler.createCollapsedName(props.selectedRowsCount - maxItems, props.entityName || ''), + isCollapsed: true, + onClear: null, + isDisabled: false, + id: 'collapsed', } as any); - } else { - return props.selection?.map((row) => { - const newRow = { ...row, - onCheck: () => { - row.onCheck?.(row); - // When we delete item it disappears from the DOM and focus is passed to the Body. So in this case we have to return focus on the toggleContainer by hand. - toggleContainer.current?.focus(); - } }; - return props.renderItem?.(newRow); - }); + multiItems.push(collapsedItem); } + + return multiItems; }; const renderInput = () => { diff --git a/uui-components/src/pickers/hooks/usePickerInput.ts b/uui-components/src/pickers/hooks/usePickerInput.ts index 3c8baaa204..5f6f96925f 100644 --- a/uui-components/src/pickers/hooks/usePickerInput.ts +++ b/uui-components/src/pickers/hooks/usePickerInput.ts @@ -268,11 +268,18 @@ export function usePickerInput(props: UsePickerInputProps[], selectedRows: DataRowProps[]) => { + return [...allSelectedRow.filter((a) => !selectedRows.some((b) => a.id === b.id))] + .map((row: { value: { name?: string } }) => row?.value?.name); + }; + const getTogglerProps = (): PickerTogglerProps => { const selectedRowsCount = view.getSelectedRowsCount(); const allowedMaxItems = getMaxItems(props.maxItems); const itemsToTake = selectedRowsCount > allowedMaxItems ? allowedMaxItems : selectedRowsCount; const selectedRows = getSelectedRows(itemsToTake); + const allSelectedRow = getSelectedRows(); + const collapsedNames = getCollapsedNames(allSelectedRow, selectedRows); const { isDisabled, autoFocus, @@ -312,6 +319,7 @@ export function usePickerInput(props: UsePickerInputProps getName(i), entityName: getEntityName(selectedRowsCount), diff --git a/uui/components/pickers/PickerToggler.tsx b/uui/components/pickers/PickerToggler.tsx index cffcb45096..9eec68d221 100644 --- a/uui/components/pickers/PickerToggler.tsx +++ b/uui/components/pickers/PickerToggler.tsx @@ -1,21 +1,19 @@ import * as React from 'react'; -import { DataRowProps } from '@epam/uui-core'; -import { PickerToggler as UuiPickerToggler, PickerTogglerProps } from '@epam/uui-components'; -import { TextPlaceholder } from '../typography'; -import { systemIcons } from '../../icons/icons'; -import { Tag } from '../widgets'; import * as types from '../types'; -import { getMaxItems } from './helpers'; +import { PickerToggler as UuiPickerToggler, PickerTogglerProps } from '@epam/uui-components'; +import { DataRowProps } from '@epam/uui-core'; +import { PickerTogglerTag, PickerTogglerTagProps } from './PickerTogglerTag'; import css from './PickerToggler.module.scss'; +import { systemIcons } from '../../icons/icons'; const defaultSize = '36'; const defaultMode = types.EditMode.FORM; export interface PickerTogglerMods extends types.IHasEditMode { /** - * Defines component size - * @default 36 - */ + * Defines component size + * @default 36 + */ size?: '24' | '30' | '36' | '42' | '48'; } @@ -28,43 +26,13 @@ function applyPickerTogglerMods(mods: PickerTogglerMods) { } function PickerTogglerComponent(props: PickerTogglerProps & PickerTogglerMods, ref: React.ForwardedRef) { - const getPickerTogglerButtonSize = (propSize: types.ControlSize) => { - switch (propSize) { - case '48': - return '42'; - case '42': - return '36'; - case '36': - return '30'; - case '30': - return '24'; - case '24': - return '18'; - } - }; - - const getCaption = (row: DataRowProps) => { - const maxItems = getMaxItems(props.maxItems); - - if (row.isLoading) { - return ; - } else if (!props.getName || props.selectedRowsCount > maxItems) { - return row.value; - } else { - return props.getName(row.value); - } - }; - - const renderItem = (row: DataRowProps) => ( - { - row.onCheck?.(row); - } } - isDisabled={ props.isDisabled || props.isReadonly || row?.checkbox?.isDisabled } + const renderItem = (itemProps: DataRowProps & PickerTogglerTagProps) => ( + ); diff --git a/uui/components/pickers/PickerTogglerTag.tsx b/uui/components/pickers/PickerTogglerTag.tsx new file mode 100644 index 0000000000..aa98884a3e --- /dev/null +++ b/uui/components/pickers/PickerTogglerTag.tsx @@ -0,0 +1,45 @@ +import * as React from 'react'; +import * as types from '../types'; +import { Tag, TagProps } from '../widgets'; +import { Tooltip } from '../overlays'; + +export interface PickerTogglerTagProps extends TagProps { + size?: types.ControlSize; + collapsedNames?: string; + isCollapsed?: boolean; +} + +const getPickerTogglerButtonSize = (propSize?: types.ControlSize):TagProps['size'] => { + switch (propSize) { + case '48': + return '42'; + case '42': + return '36'; + case '36': + return '30'; + case '30': + return '24'; + case '24': + return '18'; + default: + return '30'; + } +}; + +export function PickerTogglerTag(props: PickerTogglerTagProps) { + const tagProps = { + ...props, + tabIndex: -1, + size: getPickerTogglerButtonSize(props.size), + }; + + if (props.isCollapsed && props.collapsedNames?.length) { + return ( + + + + ); + } + + return ; +} From 0f206028390c4a3307a6eb10217cc1b3d987d3d4 Mon Sep 17 00:00:00 2001 From: Ihor Korenets Date: Sat, 23 Mar 2024 08:50:12 +0200 Subject: [PATCH 02/25] [PickerTogglerTag]: PickerTogglerProps in progress --- app/src/sandbox/SandboxPage.tsx | 2 + .../pickerTogglerTag/PickerTogglerTagDemo.tsx | 58 +++++++++++++++++++ uui-components/src/pickers/PickerToggler.tsx | 5 +- .../src/pickers/hooks/usePickerInput.ts | 8 --- uui/components/pickers/PickerInput.tsx | 4 +- uui/components/pickers/PickerToggler.tsx | 7 +-- uui/components/pickers/PickerTogglerTag.tsx | 25 ++++---- 7 files changed, 83 insertions(+), 26 deletions(-) create mode 100644 app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx diff --git a/app/src/sandbox/SandboxPage.tsx b/app/src/sandbox/SandboxPage.tsx index 458dd8877d..b9f530f2cb 100644 --- a/app/src/sandbox/SandboxPage.tsx +++ b/app/src/sandbox/SandboxPage.tsx @@ -23,6 +23,7 @@ import { ProjectTasksDemo } from './tasks/ProjectTasksDemo'; import { RichTextEditorDemo } from './RTE/rteDemo'; import { TableColumnConfigModalTest } from './tableColConfigModal/TableColumnConfigModalTest'; import { PalettePage } from './tokens/palette/palettePage'; +import { PickerTogglerTagDemo } from './pickerTogglerTag/PickerTogglerTagDemo'; export function SandboxPage() { const items = useMemo( @@ -46,6 +47,7 @@ export function SandboxPage() { { id: 'tagInput', name: 'Tag Input', component: TagInputDemo }, { id: 'tokens', name: 'Tokens' }, { parentId: 'tokens', id: 'tokensPalette', name: 'Palette', component: PalettePage }, + { id: 'pickerTogglerTag', name: 'PickerTogglerTag', component: PickerTogglerTagDemo }, ], [], ); diff --git a/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx b/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx new file mode 100644 index 0000000000..aad39154ff --- /dev/null +++ b/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx @@ -0,0 +1,58 @@ +import React, { useState } from 'react'; +import { DataQueryFilter, useLazyDataSource, useUuiContext } from '@epam/uui-core'; +import { FlexCell, FlexRow, LabeledInput, NumericInput, PickerInput } from '@epam/uui'; +import { Location } from '@epam/uui-docs'; + +const cascadeSelectionModes: Array<{ id: 'explicit' | 'implicit'; caption: string }> = [ + { + id: 'explicit', + caption: 'Explicit cascade selection', + }, { + id: 'implicit', + caption: 'Implicit cascade selection', + }, +]; + +export function PickerTogglerTagDemo() { + const svc = useUuiContext(); + const [maxItems, setMaxItems] = useState(null); + const [value, onValueChange] = useState(); + const [cascadeSelection] = useState(cascadeSelectionModes[0].id); + + const dataSource = useLazyDataSource>( + { + api: (request, ctx) => { + const { search } = request; + // and since parentId is meaningful value, it is required to exclude it from the filter. + const filter = search ? {} : { parentId: ctx?.parentId }; + return svc.api.demo.locations({ ...request, search, filter }); + }, + getId: (i) => i.id, + getParentId: (i) => i.parentId, + getChildCount: (l) => l.childCount, + }, + [], + ); + + return ( + + + + + + + + + + + ); +} diff --git a/uui-components/src/pickers/PickerToggler.tsx b/uui-components/src/pickers/PickerToggler.tsx index e057ef045a..80618149f4 100644 --- a/uui-components/src/pickers/PickerToggler.tsx +++ b/uui-components/src/pickers/PickerToggler.tsx @@ -26,7 +26,6 @@ export interface PickerTogglerProps * HTML ID attribute for the toggler input */ id?: string; - collapsedNames?: string[]; } function PickerTogglerComponent(props: PickerTogglerProps, ref: React.ForwardedRef) { @@ -106,7 +105,9 @@ function PickerTogglerComponent(props: PickerTogglerProps { - const newMultiItems = { ...row, + const newMultiItems = { + ...row, + rowProps: row, caption: props.getName(row.value), isCollapsed: false, isDisabled: row.isDisabled, diff --git a/uui-components/src/pickers/hooks/usePickerInput.ts b/uui-components/src/pickers/hooks/usePickerInput.ts index 5f6f96925f..3c8baaa204 100644 --- a/uui-components/src/pickers/hooks/usePickerInput.ts +++ b/uui-components/src/pickers/hooks/usePickerInput.ts @@ -268,18 +268,11 @@ export function usePickerInput(props: UsePickerInputProps[], selectedRows: DataRowProps[]) => { - return [...allSelectedRow.filter((a) => !selectedRows.some((b) => a.id === b.id))] - .map((row: { value: { name?: string } }) => row?.value?.name); - }; - const getTogglerProps = (): PickerTogglerProps => { const selectedRowsCount = view.getSelectedRowsCount(); const allowedMaxItems = getMaxItems(props.maxItems); const itemsToTake = selectedRowsCount > allowedMaxItems ? allowedMaxItems : selectedRowsCount; const selectedRows = getSelectedRows(itemsToTake); - const allSelectedRow = getSelectedRows(); - const collapsedNames = getCollapsedNames(allSelectedRow, selectedRows); const { isDisabled, autoFocus, @@ -319,7 +312,6 @@ export function usePickerInput(props: UsePickerInputProps getName(i), entityName: getEntityName(selectedRowsCount), diff --git a/uui/components/pickers/PickerInput.tsx b/uui/components/pickers/PickerInput.tsx index 19712831c3..04b093fa90 100644 --- a/uui/components/pickers/PickerInput.tsx +++ b/uui/components/pickers/PickerInput.tsx @@ -14,7 +14,9 @@ import { PickerItem } from './PickerItem'; const pickerHeight = 300; const pickerWidth = 360; -export type PickerInputProps = SizeMod & IHasEditMode & PickerInputBaseProps; +export type PickerInputProps = SizeMod & IHasEditMode & PickerInputBaseProps & { + renderTag?: (props: DataRowProps) => React.ReactNode; +}; function PickerInputComponent({ highlightSearchMatches = true, ...props }: PickerInputProps, ref: React.ForwardedRef) { const toggleModalOpening = () => { diff --git a/uui/components/pickers/PickerToggler.tsx b/uui/components/pickers/PickerToggler.tsx index 9eec68d221..baf0dc579a 100644 --- a/uui/components/pickers/PickerToggler.tsx +++ b/uui/components/pickers/PickerToggler.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import * as types from '../types'; import { PickerToggler as UuiPickerToggler, PickerTogglerProps } from '@epam/uui-components'; -import { DataRowProps } from '@epam/uui-core'; import { PickerTogglerTag, PickerTogglerTagProps } from './PickerTogglerTag'; import css from './PickerToggler.module.scss'; import { systemIcons } from '../../icons/icons'; @@ -26,12 +25,12 @@ function applyPickerTogglerMods(mods: PickerTogglerMods) { } function PickerTogglerComponent(props: PickerTogglerProps & PickerTogglerMods, ref: React.ForwardedRef) { - const renderItem = (itemProps: DataRowProps & PickerTogglerTagProps) => ( + const renderItem = (itemProps: PickerTogglerTagProps) => ( ); diff --git a/uui/components/pickers/PickerTogglerTag.tsx b/uui/components/pickers/PickerTogglerTag.tsx index aa98884a3e..3940d61b0e 100644 --- a/uui/components/pickers/PickerTogglerTag.tsx +++ b/uui/components/pickers/PickerTogglerTag.tsx @@ -2,12 +2,17 @@ import * as React from 'react'; import * as types from '../types'; import { Tag, TagProps } from '../widgets'; import { Tooltip } from '../overlays'; +import { DataRowProps } from '@epam/uui-core'; -export interface PickerTogglerTagProps extends TagProps { +export type PickerTogglerTagProps = TagProps & DataRowProps& { + /** Defines component size */ size?: types.ControlSize; - collapsedNames?: string; + /** If this is true, then the PickerTogglerTag will be an additional tag with the number of collapsed elements in the caption. */ isCollapsed?: boolean; -} + withTooltip?: boolean; + tooltipInfo?: string; + rowProps?: DataRowProps, +}; const getPickerTogglerButtonSize = (propSize?: types.ControlSize):TagProps['size'] => { switch (propSize) { @@ -26,20 +31,18 @@ const getPickerTogglerButtonSize = (propSize?: types.ControlSize):TagProps['size } }; -export function PickerTogglerTag(props: PickerTogglerTagProps) { +export function PickerTogglerTag(props: PickerTogglerTagProps) { const tagProps = { ...props, tabIndex: -1, size: getPickerTogglerButtonSize(props.size), }; - if (props.isCollapsed && props.collapsedNames?.length) { - return ( - + return props.withTooltip && !props.isCollapsed + ? ( + - ); - } - - return ; + ) + : ; } From 0cd6d1a54aa2a12b4aab77eb06c58f3d80c76f14 Mon Sep 17 00:00:00 2001 From: IhorKorenets Date: Sat, 23 Mar 2024 18:44:52 +0200 Subject: [PATCH 03/25] [PickerInput]: added renderTag property --- .../pickerTogglerTag/PickerTogglerTagDemo.tsx | 12 +++++++++++- uui-components/src/pickers/PickerToggler.tsx | 3 +-- uui/components/pickers/PickerInput.tsx | 14 ++++++++++---- uui/components/pickers/PickerToggler.tsx | 4 ++-- uui/components/pickers/PickerTogglerTag.tsx | 15 ++++++++------- uui/components/pickers/index.ts | 1 + 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx b/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx index aad39154ff..af33c913c1 100644 --- a/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx +++ b/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx @@ -1,7 +1,8 @@ import React, { useState } from 'react'; import { DataQueryFilter, useLazyDataSource, useUuiContext } from '@epam/uui-core'; -import { FlexCell, FlexRow, LabeledInput, NumericInput, PickerInput } from '@epam/uui'; +import { FlexCell, FlexRow, LabeledInput, NumericInput, PickerInput, PickerTogglerTag } from '@epam/uui'; import { Location } from '@epam/uui-docs'; +import { ReactComponent as myIcon } from '@epam/assets/icons/action-account-fill.svg'; const cascadeSelectionModes: Array<{ id: 'explicit' | 'implicit'; caption: string }> = [ { @@ -51,6 +52,15 @@ export function PickerTogglerTagDemo() { valueType="id" cascadeSelection={ cascadeSelection } maxItems={ maxItems } + renderTag={ (props) => ( + i.value.name).join('/')}/${props.caption}` } + icon={ !props.isCollapsed && myIcon } + /> + ) } /> diff --git a/uui-components/src/pickers/PickerToggler.tsx b/uui-components/src/pickers/PickerToggler.tsx index 80618149f4..7dbc7db2c8 100644 --- a/uui-components/src/pickers/PickerToggler.tsx +++ b/uui-components/src/pickers/PickerToggler.tsx @@ -123,9 +123,8 @@ function PickerTogglerComponent(props: PickerTogglerProps = SizeMod & IHasEditMode & PickerInputBaseProps & { - renderTag?: (props: DataRowProps) => React.ReactNode; + renderTag?: (props: PickerTogglerTagProps) => JSX.Element; }; function PickerInputComponent({ highlightSearchMatches = true, ...props }: PickerInputProps, ref: React.ForwardedRef) { @@ -68,7 +69,12 @@ function PickerInputComponent({ highlightSearchMatches = true, ...pr }; const renderTarget = (targetProps: IDropdownToggler & PickerTogglerProps) => { - const renderTargetFn = props.renderToggler || ((props) => ); + const renderTargetFn = props.renderToggler || ((pickerTogglerProps) => ( + props.renderTag(renderItemProps) : null } + /> + )); return ( ({ highlightSearchMatches = true, ...pr .join(' / '); }; - const renderItem = (item: TItem, rowProps: DataRowProps, dsState: DataSourceState) => { + const renderRowItem = (item: TItem, rowProps: DataRowProps, dsState: DataSourceState) => { const { flattenSearchResults } = view.getConfig(); return ( @@ -132,7 +138,7 @@ function PickerInputComponent({ highlightSearchMatches = true, ...pr key={ rowProps.rowKey } size={ getRowSize() } padding={ props.editMode === 'modal' ? '24' : '12' } - renderItem={ (item, itemProps) => renderItem(item, itemProps, dsState) } + renderItem={ (item, itemProps) => renderRowItem(item, itemProps, dsState) } /> ); }; diff --git a/uui/components/pickers/PickerToggler.tsx b/uui/components/pickers/PickerToggler.tsx index baf0dc579a..936c987512 100644 --- a/uui/components/pickers/PickerToggler.tsx +++ b/uui/components/pickers/PickerToggler.tsx @@ -24,12 +24,12 @@ function applyPickerTogglerMods(mods: PickerTogglerMods) { ]; } -function PickerTogglerComponent(props: PickerTogglerProps & PickerTogglerMods, ref: React.ForwardedRef) { +function PickerTogglerComponent(props: PickerTogglerProps & PickerTogglerMods, ref: React.ForwardedRef): JSX.Element { const renderItem = (itemProps: PickerTogglerTagProps) => ( diff --git a/uui/components/pickers/PickerTogglerTag.tsx b/uui/components/pickers/PickerTogglerTag.tsx index 3940d61b0e..60df9f4e56 100644 --- a/uui/components/pickers/PickerTogglerTag.tsx +++ b/uui/components/pickers/PickerTogglerTag.tsx @@ -4,14 +4,15 @@ import { Tag, TagProps } from '../widgets'; import { Tooltip } from '../overlays'; import { DataRowProps } from '@epam/uui-core'; -export type PickerTogglerTagProps = TagProps & DataRowProps& { +export type PickerTogglerTagProps = TagProps & { /** Defines component size */ size?: types.ControlSize; /** If this is true, then the PickerTogglerTag will be an additional tag with the number of collapsed elements in the caption. */ isCollapsed?: boolean; - withTooltip?: boolean; - tooltipInfo?: string; - rowProps?: DataRowProps, + /** Defines content for tooltip */ + tooltipContent?: string; + /** Defines row props (see more: uui-components/src/pickers/PickerToggler.tsx PickerTogglerProps) */ + rowProps?: DataRowProps; }; const getPickerTogglerButtonSize = (propSize?: types.ControlSize):TagProps['size'] => { @@ -31,16 +32,16 @@ const getPickerTogglerButtonSize = (propSize?: types.ControlSize):TagProps['size } }; -export function PickerTogglerTag(props: PickerTogglerTagProps) { +export function PickerTogglerTag(props: PickerTogglerTagProps): JSX.Element { const tagProps = { ...props, tabIndex: -1, size: getPickerTogglerButtonSize(props.size), }; - return props.withTooltip && !props.isCollapsed + return (props.tooltipContent) ? ( - + ) diff --git a/uui/components/pickers/index.ts b/uui/components/pickers/index.ts index 6f6073a0b8..056b83e2ea 100644 --- a/uui/components/pickers/index.ts +++ b/uui/components/pickers/index.ts @@ -9,4 +9,5 @@ export * from './PickerList'; export * from './PickerListItem'; export * from './PickerModal'; export * from './PickerToggler'; +export * from './PickerTogglerTag'; export * from './highlight'; From e82dff966b57dda37cc7a1a23c26d30e2b8bf57c Mon Sep 17 00:00:00 2001 From: Ihor Korenets Date: Mon, 25 Mar 2024 16:00:27 +0200 Subject: [PATCH 04/25] [PickerTogglerTag]: fixed test for new realisation of maxItems prop --- .../pickerTogglerTag/PickerTogglerTagDemo.tsx | 42 +- public/docs/docsGenOutput/docsGenOutput.d.ts | 1 + public/docs/docsGenOutput/docsGenOutput.json | 538 +++++++++++++++++- .../pickers/__tests__/PickerInput.test.tsx | 7 +- 4 files changed, 566 insertions(+), 22 deletions(-) diff --git a/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx b/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx index af33c913c1..3278754710 100644 --- a/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx +++ b/app/src/sandbox/pickerTogglerTag/PickerTogglerTagDemo.tsx @@ -52,15 +52,39 @@ export function PickerTogglerTagDemo() { valueType="id" cascadeSelection={ cascadeSelection } maxItems={ maxItems } - renderTag={ (props) => ( - i.value.name).join('/')}/${props.caption}` } - icon={ !props.isCollapsed && myIcon } - /> - ) } + renderTag={ (props) => { + return ( + i.value.name).join('/')}/${props.caption}` } + icon={ !props.isCollapsed && myIcon } + /> + ); + + // if (props.isCollapsed) { + // return ( + //