From 44f78ca4659ed5c1f64060d38d61d590c7f1bbe0 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 17 Oct 2024 13:59:55 +0200 Subject: [PATCH 1/4] [Text]: fixed bug when passed rawProps override Text internal styles --- changelog.md | 5 ++++ .../__snapshots__/filtersPanel.test.tsx.snap | 6 +++++ .../__snapshots__/PickerModal.test.tsx.snap | 13 ++++++++++ .../ColumnsConfigurationModal.test.tsx.snap | 3 +++ uui/components/typography/Text.tsx | 25 ++++++++----------- .../typography/__tests__/Text.test.tsx | 4 +-- .../__snapshots__/Text.test.tsx.snap | 4 ++- 7 files changed, 43 insertions(+), 17 deletions(-) diff --git a/changelog.md b/changelog.md index 974c7b9244..4f725ddedf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# 5.10.2 - xx.xx.2024 + +**What's Fixed** +* [Text]: fixed bug when passed rawProps override Text internal styles + # 5.10.1 - 16.10.2024 **What's Fixed** diff --git a/uui/components/filters/__tests__/__snapshots__/filtersPanel.test.tsx.snap b/uui/components/filters/__tests__/__snapshots__/filtersPanel.test.tsx.snap index e7db29225a..8e586f5850 100644 --- a/uui/components/filters/__tests__/__snapshots__/filtersPanel.test.tsx.snap +++ b/uui/components/filters/__tests__/__snapshots__/filtersPanel.test.tsx.snap @@ -40,6 +40,7 @@ Array [ >
Status:
@@ -48,6 +49,7 @@ Array [ >
Unknown
@@ -101,6 +103,7 @@ Array [ >
Position
@@ -153,6 +156,7 @@ Array [ >
Age
@@ -205,6 +209,7 @@ Array [ >
Hire Date
@@ -257,6 +262,7 @@ Array [ >
Exit Date
diff --git a/uui/components/pickers/__tests__/__snapshots__/PickerModal.test.tsx.snap b/uui/components/pickers/__tests__/__snapshots__/PickerModal.test.tsx.snap index 54ddfc948a..07716d5cf5 100644 --- a/uui/components/pickers/__tests__/__snapshots__/PickerModal.test.tsx.snap +++ b/uui/components/pickers/__tests__/__snapshots__/PickerModal.test.tsx.snap @@ -261,6 +261,7 @@ exports[`PickerModal should be rendered correctly 1`] = ` >
Elementary
@@ -346,6 +347,7 @@ exports[`PickerModal should be rendered correctly 1`] = ` >
Elementary+
@@ -746,6 +748,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
C2
@@ -846,6 +849,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
C1+
@@ -946,6 +950,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
C1
@@ -1046,6 +1051,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
B2+
@@ -1146,6 +1152,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
B2
@@ -1246,6 +1253,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
B1+
@@ -1346,6 +1354,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
B1
@@ -1446,6 +1455,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
A2+
@@ -1546,6 +1556,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
A2
@@ -1646,6 +1657,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
A1+
@@ -1746,6 +1758,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = ` >
A1
diff --git a/uui/components/tables/columnsConfigurationModal/__tests__/__snapshots__/ColumnsConfigurationModal.test.tsx.snap b/uui/components/tables/columnsConfigurationModal/__tests__/__snapshots__/ColumnsConfigurationModal.test.tsx.snap index afc59ce5c2..685ee8ff1f 100644 --- a/uui/components/tables/columnsConfigurationModal/__tests__/__snapshots__/ColumnsConfigurationModal.test.tsx.snap +++ b/uui/components/tables/columnsConfigurationModal/__tests__/__snapshots__/ColumnsConfigurationModal.test.tsx.snap @@ -174,6 +174,7 @@ exports[`ColumnsConfigurationModal should be rendered correctly 1`] = ` >
Displayed in table
@@ -220,6 +221,7 @@ exports[`ColumnsConfigurationModal should be rendered correctly 1`] = `
Pinned to the left
@@ -370,6 +372,7 @@ exports[`ColumnsConfigurationModal should be rendered correctly 1`] = `
Not pinned
diff --git a/uui/components/typography/Text.tsx b/uui/components/typography/Text.tsx index 3b459aab30..55eb45a94a 100644 --- a/uui/components/typography/Text.tsx +++ b/uui/components/typography/Text.tsx @@ -60,19 +60,16 @@ export const Text = withMods( uuiComponents.Text, applyTextMods, (props) => { - if (props.fontSize || props.lineHeight) { - const style: any = {}; - props.fontSize && (style['--uui-text-font-size'] = `${props.fontSize}px`); - props.lineHeight && (style['--uui-text-line-height'] = `${props.lineHeight}px`); - return { - rawProps: { - style: { - ...style, - ...props?.rawProps?.style, - }, - ...props?.rawProps, - }, - }; - } + const style: any = props?.rawProps?.style || {}; + + props.fontSize && (style['--uui-text-font-size'] = `${props.fontSize}px`); + props.lineHeight && (style['--uui-text-line-height'] = `${props.lineHeight}px`); + + return { + rawProps: { + ...props?.rawProps, + style: style, + }, + }; }, ); diff --git a/uui/components/typography/__tests__/Text.test.tsx b/uui/components/typography/__tests__/Text.test.tsx index a711290301..3eba53f015 100644 --- a/uui/components/typography/__tests__/Text.test.tsx +++ b/uui/components/typography/__tests__/Text.test.tsx @@ -8,10 +8,10 @@ describe('Text', () => { expect(tree).toMatchSnapshot(); }); - it('should be rendered correctly', () => { + it('should be rendered correctly with props', () => { const tree = renderer .create( - + Test , ) diff --git a/uui/components/typography/__tests__/__snapshots__/Text.test.tsx.snap b/uui/components/typography/__tests__/__snapshots__/Text.test.tsx.snap index 6b51ffea79..691debeb30 100644 --- a/uui/components/typography/__tests__/__snapshots__/Text.test.tsx.snap +++ b/uui/components/typography/__tests__/__snapshots__/Text.test.tsx.snap @@ -3,12 +3,13 @@ exports[`Text should be rendered correctly 1`] = `
Test
`; -exports[`Text should be rendered correctly 2`] = ` +exports[`Text should be rendered correctly with props 1`] = `
From 059d789996a4fea11458a48bba4abfab856d1348 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 17 Oct 2024 15:48:13 +0200 Subject: [PATCH 2/4] fix apiDefinitions --- app/src/data/apiDefinition.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/data/apiDefinition.ts b/app/src/data/apiDefinition.ts index 22edb0af64..2a3991bc4f 100644 --- a/app/src/data/apiDefinition.ts +++ b/app/src/data/apiDefinition.ts @@ -41,16 +41,16 @@ export function getApi({ form: { validateForm: (formState: FormState) => processRequestLocal( - origin.concat('api/form/validate-form'), + origin.concat('/api/form/validate-form'), 'POST', formState, ), }, errors: { - status: (status: number) => processRequestLocal(origin.concat(`api/error/status/${status}`), 'POST'), - setServerStatus: (status: number) => processRequestLocal(origin.concat(`api//error/set-server-status/${status}`), "'POST'"), - mock: () => processRequestLocal(origin.concat('api/error/mock'), 'GET'), - authLost: () => processRequestLocal(origin.concat('api/error/auth-lost'), 'POST'), + status: (status: number) => processRequestLocal(origin.concat(`/api/error/status/${status}`), 'POST'), + setServerStatus: (status: number) => processRequestLocal(origin.concat(`/api//error/set-server-status/${status}`), "'POST'"), + mock: () => processRequestLocal(origin.concat('/api/error/mock'), 'GET'), + authLost: () => processRequestLocal(origin.concat('/api/error/auth-lost'), 'POST'), }, getChangelog() { return processRequestLocal(origin.concat('/api/get-changelog'), 'GET'); From 63a81b8712291e121c38c1bf5a20d6301805df17 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 17 Oct 2024 17:06:16 +0200 Subject: [PATCH 3/4] [PickerInput]: hide clear button from footer in case props.disableClear === true. --- uui/components/pickers/DataPickerFooter.tsx | 25 ++++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/uui/components/pickers/DataPickerFooter.tsx b/uui/components/pickers/DataPickerFooter.tsx index 698417b595..43019faaa8 100644 --- a/uui/components/pickers/DataPickerFooter.tsx +++ b/uui/components/pickers/DataPickerFooter.tsx @@ -31,7 +31,6 @@ function DataPickerFooterImpl(props: PropsWithChildren 0; const rowsCount = view.getListProps().rowsCount; - const isEmptyRowsAndHasNoSelection = (rowsCount === 0 && !hasSelection); const isSinglePicker = selectionMode === 'single'; @@ -39,9 +38,10 @@ function DataPickerFooterImpl(props: PropsWithChildren @@ -58,26 +58,19 @@ function DataPickerFooterImpl(props: PropsWithChildren - {view.selectAll && ( + {view.selectAll && !hasSelection && ( view.selectAll.onValueChange(true) } - rawProps={ { - 'aria-label': hasSelection ? clearAllText : selectAllText, - } } - isDisabled={ isEmptyRowsAndHasNoSelection } + caption={ selectAllText } + onClick={ () => view.selectAll.onValueChange(true) } /> )} - {!view.selectAll && ( + { showClear && ( )} From e40589939e4d38e85c5a07ca9a1dad4484047a35 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Fri, 18 Oct 2024 12:02:21 +0200 Subject: [PATCH 4/4] update tests --- .../pickers/__tests__/__snapshots__/PickerInput.test.tsx.snap | 1 - 1 file changed, 1 deletion(-) diff --git a/uui/components/pickers/__tests__/__snapshots__/PickerInput.test.tsx.snap b/uui/components/pickers/__tests__/__snapshots__/PickerInput.test.tsx.snap index 8804cd7424..501a2e09ea 100644 --- a/uui/components/pickers/__tests__/__snapshots__/PickerInput.test.tsx.snap +++ b/uui/components/pickers/__tests__/__snapshots__/PickerInput.test.tsx.snap @@ -215,7 +215,6 @@ exports[`PickerInput should open body 1`] = ` >