-
Notifications
You must be signed in to change notification settings - Fork 3
Workflow detail mobile #781
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
Open
zzyangh
wants to merge
4
commits into
temporary/mobile-adaptation
Choose a base branch
from
workflow-detail-mobile
base: temporary/mobile-adaptation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
packages/dms-kit/src/components/ActiontechTable/demo/enableOnlyRenderMoreButtons.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| import React, { useMemo, useState } from 'react'; | ||
| import { ActiontechTable, ConfigProvider } from '@actiontech/dms-kit'; | ||
| import type { ActiontechTableColumn } from '@actiontech/dms-kit'; | ||
| import { Space, Switch, Tag, Typography, message } from 'antd'; | ||
| import { | ||
| EditOutlined, | ||
| DeleteOutlined, | ||
| EyeOutlined, | ||
| MoreOutlined | ||
| } from '@ant-design/icons'; | ||
|
|
||
| interface RecordItem { | ||
| id: number; | ||
| name: string; | ||
| status: 'enabled' | 'disabled'; | ||
| } | ||
|
|
||
| const mockData: RecordItem[] = [ | ||
| { id: 1, name: '示例数据 A', status: 'enabled' }, | ||
| { id: 2, name: '示例数据 B', status: 'disabled' }, | ||
| { id: 3, name: '示例数据 C', status: 'enabled' } | ||
| ]; | ||
|
|
||
| const EnableOnlyRenderMoreButtonsDemo: React.FC = () => { | ||
| const [enableOnlyRenderMoreButtons, setEnableOnlyRenderMoreButtons] = | ||
| useState(false); | ||
|
|
||
| const columns: ActiontechTableColumn< | ||
| RecordItem, | ||
| Record<string, any> | ||
| > = useMemo( | ||
| () => [ | ||
| { title: 'ID', dataIndex: 'id', width: 80 }, | ||
| { title: '名称', dataIndex: 'name', width: 200 }, | ||
| { | ||
| title: '状态', | ||
| dataIndex: 'status', | ||
| width: 120, | ||
| render: (status) => ( | ||
| <Tag color={status === 'enabled' ? 'green' : 'default'}> | ||
| {status === 'enabled' ? '启用' : '禁用'} | ||
| </Tag> | ||
| ) | ||
| } | ||
| ], | ||
| [] | ||
| ); | ||
|
|
||
| return ( | ||
| <ConfigProvider> | ||
| <Space direction="vertical" size="middle" style={{ width: '100%' }}> | ||
| <Space align="center"> | ||
| <Typography.Text strong>enableOnlyRenderMoreButtons</Typography.Text> | ||
| <Switch | ||
| checked={enableOnlyRenderMoreButtons} | ||
| onChange={setEnableOnlyRenderMoreButtons} | ||
| /> | ||
| <Typography.Text type="secondary"> | ||
| {enableOnlyRenderMoreButtons | ||
| ? '所有操作都在“更多”里(不自动外露按钮)' | ||
| : '当 buttons 为空时,会从 moreButtons 自动外露最多 2 个按钮'} | ||
| </Typography.Text> | ||
| </Space> | ||
|
|
||
| <ActiontechTable<RecordItem, Record<string, any>> | ||
| rowKey="id" | ||
| dataSource={mockData} | ||
| columns={columns} | ||
| pagination={false} | ||
| enableOnlyRenderMoreButtons={enableOnlyRenderMoreButtons} | ||
| actions={{ | ||
| title: '操作', | ||
| width: 220, | ||
| fixed: 'right', | ||
| // 关键点:buttons 为空数组 | ||
| buttons: [], | ||
| moreButtons: (record) => [ | ||
| { | ||
| key: 'view', | ||
| text: '查看', | ||
| icon: <EyeOutlined />, | ||
| onClick: () => message.info(`查看:${record.name}`) | ||
| }, | ||
| { | ||
| key: 'edit', | ||
| text: '编辑', | ||
| icon: <EditOutlined />, | ||
| onClick: () => message.info(`编辑:${record.name}`) | ||
| }, | ||
| { | ||
| key: 'more', | ||
| text: '更多信息', | ||
| icon: <MoreOutlined />, | ||
| onClick: () => message.info(`更多信息:${record.name}`) | ||
| }, | ||
| { | ||
| key: 'delete', | ||
| text: '删除', | ||
| icon: <DeleteOutlined />, | ||
| confirm: () => ({ | ||
| title: `确定删除 "${record.name}" 吗?`, | ||
| onConfirm: () => message.success(`已删除:${record.name}`) | ||
| }) | ||
| } | ||
| ] | ||
| }} | ||
| /> | ||
| </Space> | ||
| </ConfigProvider> | ||
| ); | ||
| }; | ||
|
|
||
| export default EnableOnlyRenderMoreButtonsDemo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| export { default as usePrompt } from './usePrompt'; | ||
| export { default as useBack } from './useBack'; | ||
| export { default as useNotificationContext } from './useNotificationContext'; | ||
| export { default as useMedia } from './useMedia'; | ||
| export { default as useViewport } from './useViewport'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { useMediaQuery, useTheme } from '@mui/material'; | ||
|
|
||
| const useMedia = () => { | ||
| const theme = useTheme(); | ||
| const isMobile = useMediaQuery(theme.breakpoints.down('md')); // 768px | ||
| const isSmallMobile = useMediaQuery(theme.breakpoints.down('sm')); // 480px | ||
|
|
||
| return { isMobile, isSmallMobile }; | ||
| }; | ||
|
|
||
| export default useMedia; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.