From 6fb049c6010eaba3e4a83a6fd5800cd47c5547b8 Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Mon, 11 Mar 2024 15:56:46 +0300 Subject: [PATCH 1/8] chore: fix gulp clean task (#1416) --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index d64ac72aaa..2b87f3a05c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,7 +11,7 @@ const BUILD_DIR = path.resolve('build'); task('clean', (done) => { rimrafSync(BUILD_DIR); - rimrafSync('styles/**/*.css'); + rimrafSync('styles/**/*.css', {glob: true}); done(); }); From 67c0568a539e2d44f0ee8790089af98c0b26de21 Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Mon, 11 Mar 2024 19:09:10 +0300 Subject: [PATCH 2/8] chore: move Toc stories to "Navigation" section (#1418) --- src/components/Toc/__stories__/Toc.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Toc/__stories__/Toc.stories.tsx b/src/components/Toc/__stories__/Toc.stories.tsx index b65f04d842..5775c92cda 100644 --- a/src/components/Toc/__stories__/Toc.stories.tsx +++ b/src/components/Toc/__stories__/Toc.stories.tsx @@ -11,7 +11,7 @@ import './Toc.stories.scss'; const b = block('toc-stories'); export default { - title: 'Components/Data Display/Toc', + title: 'Components/Navigation/Toc', component: Toc, argTypes: {}, } as Meta; From 309320cabf3eff70a5c7480c67d428dd5b76f61b Mon Sep 17 00:00:00 2001 From: Egor Mostovoy Date: Tue, 12 Mar 2024 12:12:14 +0100 Subject: [PATCH 3/8] test(Playwright): added beforeMont for providers (#1419) --- playwright/playwright/index.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/playwright/playwright/index.tsx b/playwright/playwright/index.tsx index 67aac616fc..2cee79a79e 100644 --- a/playwright/playwright/index.tsx +++ b/playwright/playwright/index.tsx @@ -1 +1,18 @@ +import React from 'react'; + +import {beforeMount} from '@playwright/experimental-ct-react/hooks'; + +import {MobileProvider} from '../../src/components/mobile/MobileProvider'; +import {ThemeProvider} from '../../src/components/theme/ThemeProvider'; + import './index.scss'; + +beforeMount(async ({App}) => { + return ( + + + + + + ); +}); From 78d67734dd9f0c815c4920984bf3a9ea2c2f98e5 Mon Sep 17 00:00:00 2001 From: ma-efremoff <64027148+ma-efremoff@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:27:08 +0300 Subject: [PATCH 4/8] chore(release.yaml): add branch pattern 'release/v*' (#1420) --- .github/workflows/release.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7830c19f1..762e18dd5a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,14 +2,19 @@ name: Release on: push: - branches: [main] + branches: + - main + - release/v* jobs: release: runs-on: ubuntu-latest steps: - - uses: gravity-ui/release-action@v1 - with: - github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} - npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }} - node-version: 18 + - name: Release from ${{ github.ref_name }} + uses: gravity-ui/release-action@v1 + with: + github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} + npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }} + node-version: 18 + default-branch: ${{ github.ref_name != 'main' && github.ref_name || null }} + npm-dist-tag: ${{ github.ref_name != 'main' && 'untagged' || 'latest' }} \ No newline at end of file From 4dbfdf9a6ebe9ee75df64695bcda6b8d48d5dd24 Mon Sep 17 00:00:00 2001 From: "Mr.Dr.Professor Patrick" Date: Tue, 12 Mar 2024 13:49:15 +0100 Subject: [PATCH 5/8] chore: move theme code to core maintainers (#1421) --- CODEOWNERS | 1 - 1 file changed, 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 5cc3e475e0..4117511b0b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -46,7 +46,6 @@ /src/components/controls/TextInput @korvin89 /src/components/Toaster @ogonkov /src/components/Tooltip @amje -/src/components/theme @resure /src/hooks/useActionHandlers @ogonkov /src/hooks/useFileInput @korvin89 From e29cde168077652d217585cd30bae10ee7e2747e Mon Sep 17 00:00:00 2001 From: Vladimirluk88 <86942878+Vladimirluk88@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:26:39 +0500 Subject: [PATCH 6/8] fix: adding new classes in rootClassName before removing (#1411) --- src/components/theme/dom-helpers.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/theme/dom-helpers.ts b/src/components/theme/dom-helpers.ts index 2fe808a7a2..adab86e45d 100644 --- a/src/components/theme/dom-helpers.ts +++ b/src/components/theme/dom-helpers.ts @@ -23,15 +23,6 @@ export function updateBodyClassName({ bodyEl.classList.add(rootClassName); } - if (className) { - const parsedCustomRootClassNames = className.split(' '); - parsedCustomRootClassNames.forEach((cls) => { - if (cls && !bodyEl.classList.contains(cls)) { - bodyEl.classList.add(cls); - } - }); - } - if (prevClassName) { const parsedPrevCustomRootClassNames = prevClassName.split(' '); parsedPrevCustomRootClassNames.forEach((cls) => { @@ -41,6 +32,15 @@ export function updateBodyClassName({ }); } + if (className) { + const parsedCustomRootClassNames = className.split(' '); + parsedCustomRootClassNames.forEach((cls) => { + if (cls && !bodyEl.classList.contains(cls)) { + bodyEl.classList.add(cls); + } + }); + } + [...bodyEl.classList].forEach((cls) => { if (cls.startsWith(modsClassName(b({theme: true})))) { bodyEl.classList.remove(cls); From d2e9d411fd268d6628b2eef2bd3f8abd5f3da7b0 Mon Sep 17 00:00:00 2001 From: Olga Polikashina Date: Wed, 13 Mar 2024 15:02:49 +0300 Subject: [PATCH 7/8] fix: prevent event bubbling for table item action (#1399) Co-authored-by: Hellen --- .../Table/__stories__/Table.stories.tsx | 3 ++ .../Table/__tests__/Table.hocs.test.ts | 36 ++++++++++++++++++- .../hoc/withTableActions/withTableActions.tsx | 5 ++- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/components/Table/__stories__/Table.stories.tsx b/src/components/Table/__stories__/Table.stories.tsx index 98e03a89ee..eb80ae30ae 100644 --- a/src/components/Table/__stories__/Table.stories.tsx +++ b/src/components/Table/__stories__/Table.stories.tsx @@ -150,6 +150,9 @@ const WithTableActionsTemplate: StoryFn> = (args) => { ); }; export const HOCWithTableActions = WithTableActionsTemplate.bind({}); +HOCWithTableActions.args = { + onRowClick: () => action('default')('click'), +}; // --------------------------------- const columnsWithCopy = _cloneDeep(columns); diff --git a/src/components/Table/__tests__/Table.hocs.test.ts b/src/components/Table/__tests__/Table.hocs.test.ts index 83ed5f2496..551d964331 100644 --- a/src/components/Table/__tests__/Table.hocs.test.ts +++ b/src/components/Table/__tests__/Table.hocs.test.ts @@ -1,6 +1,8 @@ import React from 'react'; -import {render} from '../../../../test-utils/utils'; +import userEvent from '@testing-library/user-event'; + +import {render, screen, within} from '../../../../test-utils/utils'; import type {TableProps} from '../Table'; import {Table} from '../Table'; import type { @@ -47,6 +49,38 @@ describe('Table HOCs tests', () => { expect(getTextContent(container1.outerHTML)).toEqual(getTextContent(container2.outerHTML)); }); + it('using withTableActions with onRowClick should not click on row when clicking on menu item', async () => { + const TableWithActions = withTableActions(Table); + + type Props = TableProps & WithTableActionsProps; + const user = userEvent.setup(); + const onRowClick = jest.fn(); + const onMenuItemClick = jest.fn(); + const props: Props = { + data: [{disabled: false}], + columns: [{id: 'name'}], + onRowClick, + getRowActions: () => [ + { + text: 'event', + handler: onMenuItemClick, + }, + ], + }; + + render(React.createElement(TableWithActions, props)); + + const table = screen.getByRole('table'); + const menuButton = within(table).getAllByRole('button'); + await user.click(menuButton[0]); + const menuItem = screen.getByRole('menuitem'); + expect(menuItem).toBeInTheDocument(); + await user.click(menuItem); + + expect(onMenuItemClick).toHaveBeenCalledTimes(props.data.length); + expect(onRowClick).toHaveBeenCalledTimes(0); + }); + it('using withTableActions and withTableSorting should not depend of order', () => { const Table1 = withTableActions(withTableSorting(Table)); const Table2 = withTableSorting(withTableActions(Table)); diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx index 646ec1394f..9d10e961dc 100644 --- a/src/components/Table/hoc/withTableActions/withTableActions.tsx +++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx @@ -131,7 +131,10 @@ const DefaultRowActions = ({ return ( handler(item, index, event)} + onClick={(event) => { + event.stopPropagation(); + handler(item, index, event); + }} iconStart={icon} className={menuItemCn} {...restProps} From 1e8ff11b3cecce709f151817a419aae17947ef23 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 13 Mar 2024 19:23:16 +0500 Subject: [PATCH 8/8] chore: add export getConfig (#1422) --- src/components/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/index.ts b/src/components/index.ts index 893ecc47ad..9d4e235702 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -54,6 +54,6 @@ export * from './utils/event-broker'; export {getComponentName} from './utils/getComponentName'; export * from './utils/withEventBrokerDomHandlers'; export * from './utils/layer-manager'; -export {Lang, configure} from './utils/configure'; +export {Lang, configure, getConfig} from './utils/configure'; export * from './utils/xpath'; export {getUniqId} from './utils/common';