Skip to content

Commit

Permalink
locale: rm PageHeader locale (#47163)
Browse files Browse the repository at this point in the history
* chore: rm PageHeader locale

* test: fix test case
  • Loading branch information
li-jia-nan authored and MadCcc committed Jan 29, 2024
1 parent e83f08c commit 5e54ec6
Show file tree
Hide file tree
Showing 59 changed files with 107 additions and 232 deletions.
4 changes: 1 addition & 3 deletions components/config-provider/__tests__/components.test.tsx
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
@@ -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
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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

0 comments on commit 5e54ec6

Please sign in to comment.