fix: show pagination bar with data in the table (#5480)

* fix: show pagination bar with data in the table

* refactor: local improve

* fix: bug

* fix: test

* fix: test
This commit is contained in:
Katherine 2024-10-22 20:36:51 +08:00 committed by GitHub
parent 475e219943
commit 2f9ad6b2a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 56 additions and 61 deletions

View File

@ -50,7 +50,7 @@ test.describe('association form block', () => {
await mockRecord('general');
await expect(page.getByLabel('block-item-CardItem-general-')).toBeVisible();
// 1. 打开关系字段弹窗
await page.getByLabel('block-item-CardItem-general-').locator('a').click();
await page.getByLabel('block-item-CardItem-general-').locator('a').first().click();
await page.getByLabel('block-item-CardItem-roles-').click();
// 2. 提交后Table 会显示新增的数据

View File

@ -92,7 +92,7 @@ const InternalList = (props) => {
<AntdList
{...props}
pagination={
!meta || meta.count <= meta.pageSize
!meta || !field.value?.length
? false
: {
onChange: onPaginationChange,

View File

@ -228,7 +228,9 @@ describe('List', () => {
await waitFor(() => {
expect(screen.queryByText('ID')).toBeInTheDocument();
expect(screen.queryByText('1')).toBeInTheDocument();
const spanElements = screen.getAllByText('1');
const firstSpanElement = spanElements.find((el) => el.tagName === 'SPAN');
expect(firstSpanElement).toBeInTheDocument();
});
expect(screen.queryByText('Nickname')).toBeInTheDocument();

View File

@ -333,7 +333,7 @@ const usePaginationProps = (pagination1, pagination2) => {
if (!pagination2 && pagination1 === false) {
return false;
}
return result.total <= result.pageSize ? false : result;
return field.value?.length > 0 ? result : false;
};
const headerClass = css`

View File

@ -0,0 +1,50 @@
{
"Configure calendar": "配置日历",
"Title field": "标题字段",
"Custom title": "自定义标题",
"Show lunar": "展示农历",
"Start date field": "开始日期字段",
"End date field": "结束日期字段",
"Work week": "工作日",
"Today": "今天",
"Day": "天",
"Agenda": "列表",
"Date": "日期",
"Time": "时间",
"Event": "事件",
"None": "无",
"Calendar": "日历",
"Delete events": "删除日程",
"This event": "此日程",
"This and following events": "此日程及后续日程",
"All events": "所有日程",
"Delete this event?": "是否删除这个日程?",
"Delete Event": "删除日程",
"Calendar collection": "日历数据表",
"Create calendar block": "创建日历区块",
"Filter": "筛选",
"Configure actions": "配置操作",
"Enable actions": "启用操作",
"Turn pages": "翻页",
"Select view": "切换视图",
"Add new": "添加",
"View record": "查看数据",
"Details": "详情",
"Customize": "自定义",
"Update record": "更新数据",
"Popup": "弹窗",
"Updated successfully": "更新成功",
"Custom request": "自定义请求",
"Edit": "编辑",
"Delete": "删除",
"Print": "打印",
"Daily": "每天",
"Weekly": "每周",
"Monthly": "每月",
"Yearly": "每年",
"Repeats": "重复",
"Title": "标题",
"Month": "月",
"Week": "周",
"{{count}} more items": "{{count}} 更多事项"
}

View File

@ -1,57 +0,0 @@
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
export default {
'Configure calendar': '配置日历',
'Title field': '标题字段',
'Custom title': '自定义标题',
'Show lunar': '展示农历',
'Start date field': '开始日期字段',
'End date field': '结束日期字段',
'Work week': '工作日',
Today: '今天',
Day: '天',
Agenda: '列表',
Date: '日期',
Time: '时间',
Event: '事件',
None: '无',
Calendar: '日历',
'Delete events': '删除日程',
'This event': '此日程',
'This and following events': '此日程及后续日程',
'All events': '所有日程',
'Delete this event?': '是否删除这个日程?',
'Delete Event': '删除日程',
'Calendar collection': '日历数据表',
'Create calendar block': '创建日历区块',
Filter: '筛选',
'Configure actions': '配置操作',
'Enable actions': '启用操作',
'Turn pages': '翻页',
'Select view': '切换视图',
'Add new': '添加',
'View record': '查看数据',
'Details': '详情',
Customize: '自定义',
'Update record': '更新数据',
'Popup': '弹窗',
"Updated successfully": "更新成功",
'Custom request': '自定义请求',
'Edit': '编辑',
Delete: '删除',
Print: '打印',
Daily: '每天',
Weekly: '每周',
Monthly: '每月',
Yearly: '每年',
Repeats: '重复',
"Title":"标题",
"{{count}} more items":"{{count}} 更多事项"
};