Skip to content
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

chore: rm PageHeader locale #47163

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions components/config-provider/__tests__/components.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ describe('ConfigProvider', () => {
// configProvider
it('configProvider', () => {
const { container } = render(
<ConfigProvider pageHeader={{ ghost: false }} prefixCls="config">
{renderComponent({})}
</ConfigProvider>,
<ConfigProvider prefixCls="config">{renderComponent({})}</ConfigProvider>,
);
expect(isArray ? container.children : container.firstChild).toMatchSnapshot();
});
Expand Down
29 changes: 10 additions & 19 deletions components/config-provider/__tests__/memo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import React from 'react';

import ConfigProvider from '..';
import { fireEvent, pureRender } from '../../../tests/utils';
import Tooltip from '../../tooltip';
Expand All @@ -24,19 +25,14 @@ describe('ConfigProvider', () => {
const MemoedSibling = React.memo(Sibling);
const spy = jest.fn();
const App: React.FC = () => {
const [pageHeader, setPageHeader] = useState({ ghost: true });
const [flex, setFlex] = React.useState({ vertical: true });
const [, forceRender] = React.useReducer((v) => v + 1, 1);

return (
<ConfigProvider pageHeader={pageHeader}>
<button type="button" className="render" onClick={() => forceRender()}>
<ConfigProvider flex={flex}>
<button type="button" className="render" onClick={forceRender}>
Force Render
</button>
<button
type="button"
className="setState"
onClick={() => setPageHeader({ ghost: false })}
>
<button type="button" className="setState" onClick={() => setFlex({ vertical: false })}>
Change Config
</button>
<MemoedSibling spy={spy} />
Expand All @@ -58,20 +54,15 @@ describe('ConfigProvider', () => {
const MemoedSibling = React.memo(Sibling);
const spy = jest.fn();
const App: React.FC = () => {
const [pageHeader, setPageHeader] = useState({ ghost: true });
const [flex, setFlex] = React.useState({ vertical: true });
const [, forceRender] = React.useReducer((v) => v + 1, 1);

return (
<ConfigProvider pageHeader={pageHeader}>
<ConfigProvider flex={flex}>
<ConfigProvider>
<button type="button" className="render" onClick={() => forceRender()}>
<button type="button" className="render" onClick={forceRender}>
Force Render
</button>
<button
type="button"
className="setState"
onClick={() => setPageHeader({ ghost: false })}
>
<button type="button" className="setState" onClick={() => setFlex({ vertical: false })}>
Change Config
</button>
<MemoedSibling spy={spy} />
Expand Down
1 change: 0 additions & 1 deletion components/config-provider/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export interface ConfigConsumerProps {
input?: ComponentStyleConfig & Pick<InputProps, 'autoComplete' | 'classNames' | 'styles'>;
pagination?: ComponentStyleConfig & Pick<PaginationProps, 'showSizeChanger'>;
locale?: Locale;
pageHeader?: Record<'ghost', boolean>;
direction?: DirectionType;
space?: Pick<SpaceProps, 'size' | 'className' | 'classNames' | 'style' | 'styles'>;
virtual?: boolean;
Expand Down
3 changes: 0 additions & 3 deletions components/config-provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const configConsumerProps = [
'csp',
'autoInsertSpaceInButton',
'locale',
'pageHeader',
];

// These props is used by `useContext` directly in sub component
Expand All @@ -96,7 +95,6 @@ const PASSED_PROPS: Exclude<
'getTargetContainer',
'getPopupContainer',
'renderEmpty',
'pageHeader',
'input',
'pagination',
'form',
Expand All @@ -119,7 +117,6 @@ export interface ConfigProviderProps {
select?: ComponentStyleConfig & Pick<SelectProps, 'showSearch'>;
pagination?: ComponentStyleConfig & Pick<PaginationProps, 'showSizeChanger'>;
locale?: Locale;
pageHeader?: Record<'ghost', boolean>;
componentSize?: SizeType;
componentDisabled?: boolean;
direction?: DirectionType;
Expand Down
6 changes: 2 additions & 4 deletions components/locale/ar_EG.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/ar_EG';

import type { Locale } from '.';
import Calendar from '../calendar/locale/ar_EG';
import DatePicker from '../date-picker/locale/ar_EG';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/ar_EG';

const typeTemplate = 'ليس ${label} من نوع ${type} صالحًا';
Expand Down Expand Up @@ -64,9 +65,6 @@ const localeValues: Locale = {
copied: 'نقل',
expand: 'وسع',
},
PageHeader: {
back: 'عودة',
},
Form: {
defaultValidateMessages: {
default: 'خطأ في حقل الإدخال ${label}',
Expand Down
6 changes: 2 additions & 4 deletions components/locale/bn_BD.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/bn_BD';

import type { Locale } from '.';
import Calendar from '../calendar/locale/bn_BD';
import DatePicker from '../date-picker/locale/bn_BD';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/bn_BD';

const typeTemplate = '${label} টি সঠিক ${type} নয়।';
Expand Down Expand Up @@ -73,9 +74,6 @@ const localeValues: Locale = {
copied: 'অনুলিপি হয়েছে',
expand: 'বিস্তৃত করা',
},
PageHeader: {
back: 'পেছনে',
},
Form: {
optional: '(ঐচ্ছিক)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/by_BY.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/by_BY';

import type { Locale } from '.';
import Calendar from '../calendar/locale/by_BY';
import DatePicker from '../date-picker/locale/by_BY';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/by_BY';

const typeTemplate: string = "${label} не з'яўляецца тыпам ${type}";
Expand Down Expand Up @@ -75,9 +76,6 @@ const localeValues: Locale = {
copied: 'Капіяванне завершана',
expand: 'Разгарнуць',
},
PageHeader: {
back: 'Назад',
},
Form: {
optional: '(не абавязкова)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/ca_ES.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/ca_ES';

import type { Locale } from '.';
import Calendar from '../calendar/locale/ca_ES';
import DatePicker from '../date-picker/locale/ca_ES';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/ca_ES';

const typeTemplate = '${label} no és un ${type} vàlid';
Expand Down Expand Up @@ -71,9 +72,6 @@ const localeValues: Locale = {
copied: 'Copiat',
expand: 'Ampliar',
},
PageHeader: {
back: 'Enrere',
},
Form: {
optional: '(opcional)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/cs_CZ.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/cs_CZ';

import type { Locale } from '.';
import Calendar from '../calendar/locale/cs_CZ';
import DatePicker from '../date-picker/locale/cs_CZ';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/cs_CZ';

const typeTemplate = '${label} není platný ${type}';
Expand Down Expand Up @@ -75,9 +76,6 @@ const localeValues: Locale = {
copied: 'Zkopírované',
expand: 'Zvětšit',
},
PageHeader: {
back: 'Zpět',
},
Form: {
optional: '(nepovinné)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/de_DE.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/de_DE';

import type { Locale } from '.';
import Calendar from '../calendar/locale/de_DE';
import DatePicker from '../date-picker/locale/de_DE';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/de_DE';

const typeTemplate = '${label} ist nicht gültig. ${type} erwartet';
Expand Down Expand Up @@ -76,9 +77,6 @@ const localeValues: Locale = {
copied: 'Kopiert',
expand: 'Erweitern',
},
PageHeader: {
back: 'Zurück',
},
Form: {
defaultValidateMessages: {
default: 'Feld-Validierungsfehler: ${label}',
Expand Down
6 changes: 2 additions & 4 deletions components/locale/en_GB.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/en_GB';

import type { Locale } from '.';
import Calendar from '../calendar/locale/en_GB';
import DatePicker from '../date-picker/locale/en_GB';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/en_GB';

const typeTemplate = '${label} is not a valid ${type}';
Expand Down Expand Up @@ -75,9 +76,6 @@ const localeValues: Locale = {
copied: 'Copied',
expand: 'Expand',
},
PageHeader: {
back: 'Back',
},
Form: {
optional: '(optional)',
defaultValidateMessages: {
Expand Down
3 changes: 0 additions & 3 deletions components/locale/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ const localeValues: Locale = {
copied: 'Copied',
expand: 'Expand',
},
PageHeader: {
back: 'Back',
},
Form: {
optional: '(optional)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/es_ES.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/es_ES';

import type { Locale } from '.';
import Calendar from '../calendar/locale/es_ES';
import DatePicker from '../date-picker/locale/es_ES';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/es_ES';

const typeTemplate = '${label} no es un ${type} válido';
Expand Down Expand Up @@ -75,9 +76,6 @@ const localeValues: Locale = {
copied: 'Copiado',
expand: 'Expandir',
},
PageHeader: {
back: 'Volver',
},
Form: {
optional: '(opcional)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/et_EE.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/et_EE';

import type { Locale } from '.';
import Calendar from '../calendar/locale/et_EE';
import DatePicker from '../date-picker/locale/et_EE';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/et_EE';

const typeTemplate = '${label} ei ole kehtiv ${type}';
Expand Down Expand Up @@ -75,9 +76,6 @@ const localeValues: Locale = {
copied: 'Kopeeritud',
expand: 'Laienda',
},
PageHeader: {
back: 'Tagasi',
},
Form: {
optional: '(valikuline)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/eu_ES.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/eu_ES';

import type { Locale } from '.';
import Calendar from '../calendar/locale/eu_ES';
import DatePicker from '../date-picker/locale/eu_ES';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/eu_ES';

const typeTemplate = '${label} ez da ${type} balioduna';
Expand Down Expand Up @@ -80,9 +81,6 @@ const localeValues: Locale = {
copied: 'Kopiatuta',
expand: 'Zabaldu',
},
PageHeader: {
back: 'Itzuli',
},
Form: {
optional: '(aukerakoa)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/fa_IR.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/fa_IR';

import type { Locale } from '.';
import Calendar from '../calendar/locale/fa_IR';
import DatePicker from '../date-picker/locale/fa_IR';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/fa_IR';

const typeTemplate = '${label} از نوع ${type} معتبر نیست';
Expand Down Expand Up @@ -80,9 +81,6 @@ const localeValues: Locale = {
copied: 'کپی شد',
expand: 'توسعه',
},
PageHeader: {
back: 'برگشت',
},
Form: {
optional: '(اختیاری)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/fr_BE.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/fr_BE';

import type { Locale } from '.';
import Calendar from '../calendar/locale/fr_BE';
import DatePicker from '../date-picker/locale/fr_BE';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/fr_BE';

const typeTemplate = "La valeur du champ ${label} n'est pas valide pour le type ${type}";
Expand Down Expand Up @@ -72,9 +73,6 @@ const localeValues: Locale = {
copied: 'Copie effectuée',
expand: 'Développer',
},
PageHeader: {
back: 'Retour',
},
Form: {
optional: '(optionnel)',
defaultValidateMessages: {
Expand Down
6 changes: 2 additions & 4 deletions components/locale/fr_CA.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/fr_CA';

import type { Locale } from '.';
import Calendar from '../calendar/locale/fr_CA';
import DatePicker from '../date-picker/locale/fr_CA';
import type { Locale } from '.';
import TimePicker from '../time-picker/locale/fr_CA';

const typeTemplate = "La valeur du champ ${label} n'est pas valide pour le type ${type}";
Expand Down Expand Up @@ -72,9 +73,6 @@ const localeValues: Locale = {
copied: 'Copie effectuée',
expand: 'Développer',
},
PageHeader: {
back: 'Retour',
},
Form: {
optional: '(optionnel)',
defaultValidateMessages: {
Expand Down
4 changes: 1 addition & 3 deletions components/locale/fr_FR.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/fr_FR';

import type { Locale } from '.';
import Calendar from '../calendar/locale/fr_FR';
import DatePicker from '../date-picker/locale/fr_FR';
Expand Down Expand Up @@ -77,9 +78,6 @@ const localeValues: Locale = {
copied: 'Copie effectuée',
expand: 'Développer',
},
PageHeader: {
back: 'Retour',
},
Form: {
optional: '(optionnel)',
defaultValidateMessages: {
Expand Down