From 4e44f8f4e30bc7501dae9379d113c1e3698fb36b Mon Sep 17 00:00:00 2001 From: haohao_peng Date: Thu, 7 Nov 2024 19:16:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[pagination]=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=8C=89=E9=92=AE=E7=9A=84=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E5=8A=9F=E8=83=BD=20fix=20#932?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/locale/en-US.tsx | 124 ++++++++++++++++++ components/locale/zh-CN.tsx | 1 + .../__snapshots__/index.test.tsx.snap | 2 +- .../pagination/__tests__/index.test.tsx | 11 +- components/pagination/index.md | 1 + components/pagination/pagination.tsx | 2 +- components/pagination/style/index.less | 2 +- components/pagination/style/token.less | 1 + 8 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 components/locale/en-US.tsx diff --git a/components/locale/en-US.tsx b/components/locale/en-US.tsx new file mode 100644 index 00000000..fd2db4bb --- /dev/null +++ b/components/locale/en-US.tsx @@ -0,0 +1,124 @@ +const locale = { + locale: 'en-US', + 'DatePicker.placeholder': 'select date', + 'DatePicker.yearPlaceholder': 'select year', + 'DatePicker.quarterPlaceholder': 'select quarter', + 'DatePicker.monthPlaceholder': 'select month', + 'DatePicker.weekPlaceholder': 'select week', + 'DatePicker.timePlaceholder': 'select time', + 'DatePicker.now': 'Now', + 'DatePicker.confrim': 'Ok', + 'DatePicker.today': 'Today', + 'DatePicker.month': 'Month', + 'DatePicker.year': '', + 'DatePicker.weekTitle': ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], + 'DatePicker.monthTitle': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'DatePicker.rangePlaceholder': ['Start date', 'End date'], + 'DatePicker.rangeYearPlaceholder': ['Start year', 'End year'], + 'DatePicker.rangeMonthPlaceholder': ['Start month', 'End month'], + 'DatePicker.rangeWeekPlaceholder': ['Start week', 'End week'], + 'DatePicker.rangeQuarterPlaceholder': ['Start quarter', 'End quarter'], + 'DatePicker.rangeTimePlaceholder': ['Start time', 'End time'], + 'global.selectholder': 'Please select', + 'global.placeholder': 'Please enter search content', + 'global.cancel': 'Cancel', + 'global.confirm': 'Ok', + 'global.emptyText': 'No data', + 'Button.text': 'Button', + 'Progress.circleLoadingDesc': 'Loading...', + 'Progress.loading': 'Loading...', + 'Progress.fail': 'Load failed', + 'Progress.success': 'Load successful', + 'Pagination.prevPage': 'Previous', + 'Pagination.nextPage': 'Next', + 'Pagination.total': 'Total {page} pages {row} items', + 'Pagination.page': 'Total {page} pages', + 'Pagination.row': 'Total {row} items', + 'Pagination.first': 'First page', + 'Pagination.last': 'Last page', + 'Pagination.perPage': '{size} /page', + 'Pagination.order': 'Page {order}', + 'Pagination.forward': 'Forward 5 pages', + 'Pagination.backward': 'Backward 5 pages', + 'Pagination.confirm': 'GO', + 'Transfer.selectAll': 'Select all', + 'Transfer.searchPlaceholder': ['Please enter search content', 'Please enter search content'], + 'Transfer.leftTitle': 'Available list', + 'Transfer.rightTitle': 'Selected list', + 'Transfer.emptyTip': 'No data', + 'Modal.okText': 'Ok', + 'Modal.cancelText': 'Cancel', + 'Modal.iknowText': 'I know', + 'Empty.emptyText': 'No data', + 'Empty.searchEmptyText': 'No results found', + 'QuickSearch.placeholder': 'Please enter search content', + 'QuickSearch.desc': ["Space means 'or', Enter means 'and'"], + 'QuickSearch.nplDesc': 'Smart search', + 'QuickSearch.emptyTip': 'No data', + 'QuickSearch.or': 'Or', + 'CityPicker.domestic': 'Domestic', + 'CityPicker.common': 'Common', + 'CityPicker.emptyText': 'No data', + 'CityPicker.commonEmptyText': 'No common cities', + 'CityPicker.tabsDomestic': 'Domestic', + 'CityPicker.tabsInternation': 'International/China HK-MO-TW', + 'CityPicker.title': 'City', + 'ColorPicker.followFunctionalColor': 'Follow theme color', + 'Search.placeholder': 'Please enter search content', + 'Search.desc': ["Space means 'or', Enter means 'and'"], + 'Search.nplDesc': 'Smart search', + 'Search.emptyTip': 'No data', + 'Search.viewMoreResult': "See more results for '{inputValue}'", + 'Search.range': 'scope', + 'Search.or': 'Or', + 'Filter.filterCondition': 'Filter condition', + 'Filter.commonCondition': 'Common conditions', + 'Filter.schemeQuery': 'Scheme query', + 'Filter.spread': 'Expand', + 'Filter.packup': 'Collapse', + 'Filter.filter': '', + 'Filter.scheme': 'Scheme', + 'Filter.unlimited': 'Unlimited', + 'Filter.commonScheme': 'Common schemes', + 'Filter.advancedQuery': 'Advanced query', + 'Filter.schemeName': 'Scheme name', + 'Filter.addCondition': 'Add condition', + 'Filter.saveScheme': 'Save scheme', + 'Filter.query': 'Query', + 'Filter.and': 'And', + 'Filter.settings': 'Settings', + 'Filter.schemeNamePlaceholder': 'Please enter scheme name', + 'Form.requiredMessage': 'Please enter your ', + 'Table.contain': 'Contain', + 'Table.notContain': 'Do not contain', + 'Table.equal': 'Equal', + 'Table.notEqual': 'Not equal', + 'Table.isNull': 'Is null', + 'Table.notIsNull': 'Is not null', + 'Table.resetFilter': 'Reset', + 'Table.confirmFilter': 'Ok', + 'Select.selectAll': 'Select all', + 'Select.seleted': 'Selected {size} items', + 'Select.total': 'Total {total} items', + 'Signature.clickToSign': 'Click to sign', + 'Signature.pleaseWriteHere': 'Please write your signature horizontally here', + 'Signature.okText': 'Ok', + 'Signature.cancelText': 'Cancel', + 'Signature.handwrittenSignature': 'Handwritten Signature', + 'QRCode.qrCodeExpired': 'QR code expired', + 'QRCode.clickRefresh': 'Refresh', + 'Cascader.total': 'Total {total} items', + 'BaseData.total': 'Total {total} items', + 'BaseData.history': 'History', + 'BaseData.favorites': 'Favorites', + 'Image.close': 'Close', + 'Upload.reUpload': 'Re-upload', + 'Upload.uploading': 'Uploading', + 'Upload.fail': 'Upload failed', + 'Upload.delete': 'Delete', + 'Notification.title': 'System Notification', + 'TreeSelect.total': 'Total {total} items', + 'ImageCropper.okText': 'Confirm Crop', +} + +export default locale diff --git a/components/locale/zh-CN.tsx b/components/locale/zh-CN.tsx index a191209e..6f99c4ad 100644 --- a/components/locale/zh-CN.tsx +++ b/components/locale/zh-CN.tsx @@ -23,6 +23,7 @@ const locale = { 'Pagination.order': '第 {order} 页', 'Pagination.forward': '向前 5 页', 'Pagination.backward': '向后 5 页', + 'Pagination.confirm': '确定', 'Transfer.selectAll': '全选', 'Transfer.searchPlaceholder': ['请输入需要搜索的内容', '请输入需要搜索的内容'], 'Transfer.leftTitle': '可选列表', diff --git a/components/pagination/__tests__/__snapshots__/index.test.tsx.snap b/components/pagination/__tests__/__snapshots__/index.test.tsx.snap index 2e3f2f8a..b4fd9e47 100644 --- a/components/pagination/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/pagination/__tests__/__snapshots__/index.test.tsx.snap @@ -417,7 +417,7 @@ exports[`Pagination 2.render test renders correctly 6`] = ` diff --git a/components/pagination/__tests__/index.test.tsx b/components/pagination/__tests__/index.test.tsx index 10b95396..8bd9668d 100644 --- a/components/pagination/__tests__/index.test.tsx +++ b/components/pagination/__tests__/index.test.tsx @@ -81,13 +81,20 @@ describe('Pagination', () => { current: 3, }, }, + localeConfig: { + locale: 'zh-CN', + localeData: { + 'Pagination.confirm': 'GO', + }, + }, } const wrapper = mount( - + , ) - expect(wrapper.find(`.kd-pagination-current-input`).at(0).prop('value')).toEqual(3) + expect(wrapper.find(`.kd-pagination-pages-item.active`).at(0).text()).toEqual('3') + expect(wrapper.find(`.kd-pagination-jumper-button`).at(0).text()).toEqual('GO') }) }) // 9.API test diff --git a/components/pagination/index.md b/components/pagination/index.md index c5b5d06e..4ed76ddf 100644 --- a/components/pagination/index.md +++ b/components/pagination/index.md @@ -65,3 +65,4 @@ subtitle: 分页 | | --kd-c-pagination-sizing-border-width | - | 1px | | spacing | --kd-c-pagination-button-spacing | - | 4px | | | --kd-c-pagination-dropdown-item-spacing-padding-horizontal | - | 24px | +| | --kd-c-pagination-jumper-spacing-padding-horizontal | - | 4px | diff --git a/components/pagination/pagination.tsx b/components/pagination/pagination.tsx index 45556347..17fcc115 100644 --- a/components/pagination/pagination.tsx +++ b/components/pagination/pagination.tsx @@ -433,7 +433,7 @@ const Pagination: React.FC = (props) => { value={inputPage === undefined ? '' : inputPage} /> )} diff --git a/components/pagination/style/index.less b/components/pagination/style/index.less index 01a43f00..228db1fe 100644 --- a/components/pagination/style/index.less +++ b/components/pagination/style/index.less @@ -506,7 +506,7 @@ .@{pagination-jumper-prefix-cls}-button { .reset-component; - width: @pagination-size; + padding: 0 @pagination-jumper-spacing; height: @pagination-size; margin-left: @pagination-button-spacing; display: inline-flex; diff --git a/components/pagination/style/token.less b/components/pagination/style/token.less index d2cd567e..35c5c3ce 100644 --- a/components/pagination/style/token.less +++ b/components/pagination/style/token.less @@ -24,6 +24,7 @@ // spacing @pagination-button-spacing: var(~'@{pagination-custom-prefix}-button-spacing', 4px); @pagination-dropdown-item-spacing-horizontal: var(~'@{pagination-custom-prefix}-dropdown-item-spacing-padding-horizontal', 24px); +@pagination-jumper-spacing: var(~'@{pagination-custom-prefix}-jumper-spacing-padding-horizontal', 4px);