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

feat: drawer-list #1557

Merged
merged 2 commits into from
Aug 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .turbo/cookies/29.cookie
Empty file.
Empty file removed .turbo/cookies/30.cookie
Empty file.
Empty file removed .turbo/cookies/31.cookie
Empty file.
Empty file removed .turbo/cookies/32.cookie
Empty file.
6 changes: 6 additions & 0 deletions .turbo/daemon/ae401ef4dd981f33-turbo.log.2024-08-26
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
2024-08-26T15:23:25.560565Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/form-render/package.json")}
2024-08-26T15:23:25.560588Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("form-render"), path: AnchoredSystemPathBuf("packages/form-render") }}))
2024-08-26T15:24:27.958664Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/form-render/CHANGELOG.md")}
2024-08-26T15:24:27.958679Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("form-render"), path: AnchoredSystemPathBuf("packages/form-render") }}))
2024-08-26T15:26:43.157922Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/form-render/CHANGELOG.md")}
2024-08-26T15:26:43.157934Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("form-render"), path: AnchoredSystemPathBuf("packages/form-render") }}))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"babel-plugin-no-debugger": "^0.0.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"cross-env": "^7.0.3",
"dumi": "^2.0.2",
"dumi": "2.2.16",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.6.2",
Expand Down
9 changes: 9 additions & 0 deletions packages/form-render/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# 更新日志
### 2.4.8
- [!] 修复 drawerList 组件,编辑时打开弹窗,表单数据一直是最后一条

### 2.4.7
- [+] 兼容 safari 浏览器 ?. 正则表达式不全逻辑

### 2.4.6
- [1!] 函数表达式为了兼容性考虑会替换成 ?. 但是需要剔除数字场景

### 2.4.5
- [+] 函数表达式兼容,formData.x['y'] 语法
- [+] 适配,formData.x.y, formData.x undefined 时,表达式解析异常
Expand Down
2 changes: 1 addition & 1 deletion packages/form-render/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-render",
"version": "2.4.7",
"version": "2.4.8",
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
"keywords": [
"Form",
Expand Down
8 changes: 4 additions & 4 deletions packages/form-render/src/widgets/listDrawer/drawerForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import { Button, Drawer, Space, ConfigProvider } from 'antd';
import { translation } from '../utils';

const DrawerForm = (props: any) => {
const { children, onConfirm, onClose, DrawerProps } = props;
const { children, onConfirm, onClose, ...ret } = props;

const configCtx = useContext(ConfigProvider.ConfigContext);
const t = translation(configCtx);

let drawerProps: any = { ...DrawerProps, open: true };
let extraProps: any = { ...ret, open: true };
if ((window as any).antdVersion === 'v4') {
drawerProps = { ...DrawerProps, visible: true };
extraProps = { ...ret, visible: true };
}

return (
<Drawer
width={600}
title={t('operate')}
{...drawerProps}
{...extraProps}
onClose={onClose}
extra={
<Space>
Expand Down
6 changes: 4 additions & 2 deletions packages/form-render/src/widgets/listDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ const TableList: React.FC<Props> = (props: any) => {
});
}

const drawerIndex = indexRef.current ?? (fields.length - 1);

return (
<div className='fr-list-drawer'>
<Table
Expand All @@ -257,15 +259,15 @@ const TableList: React.FC<Props> = (props: any) => {
)}
{visible && (
<FormDrawer
{...drawerProps}
schema={schema}
data={itemData}
widgets={widgets}
configContext={configContext}
onClose={handleRepeal}
onConfirm={hanldeConfirm}
DrawerProps={drawerProps}
>
{renderCore({ schema: schema.items, parentPath: [fields.length - 1], rootPath: [...rootPath, fields.length - 1] })}
{renderCore({ schema: schema.items, parentPath: [drawerIndex], rootPath: [...rootPath, drawerIndex] })}
</FormDrawer>
)}
</div>
Expand Down
Loading