Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
siyi98 committed Mar 22, 2022
2 parents 1ee3d37 + e49d933 commit 8322ef7
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: siyi98

---

---<!--
<!---
1. 提问前务必先搜索issue,查看是否已有类似问题。
1. try searching for similar issues before reporting yours
2. 非bug or feature类问题,欢迎加入我们的开源社区钉钉群进行讨论。
Expand All @@ -17,6 +17,7 @@ assignees: siyi98

- react:
- form-render:
- table-render:
- antd:

**2.问题描述(Bug description)**
Expand Down
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,47 @@
width="160"
/>
</td>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i4/O1CN01BJ26gA1cYLKkfiaCG_!!6000000003612-2-tps-287-176.png"
width="160"
/>
</td>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i3/O1CN017E63ji1W3InNkUvJE_!!6000000002732-2-tps-1000-500.png"
width="160"
/>
</td>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i2/O1CN01Zu5QsE1OJm7GYKH06_!!6000000001685-2-tps-363-139.png"
width="160"
/>
</td>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i1/O1CN01RqiiQ81j0dUdUfoIN_!!6000000004486-2-tps-280-66.png"
width="160"
/>
</td>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i1/O1CN01B0UOM61lnIoMVJU6f_!!6000000004863-2-tps-500-397.png"
/>
</td>
</tr>
<tr>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i2/O1CN01DiuhTS1u3o0WsTsNb_!!6000000005982-2-tps-367-137.png"
/>
</td>
<td width="160" align="center">
<img
src="https://img.alicdn.com/imgextra/i3/O1CN01Vj8xN329If5dlvb50_!!6000000008045-2-tps-495-405.png"
/>
</td>
</tr>
</table>

Expand All @@ -134,6 +175,8 @@

想贡献代码、解 BUG 或者提高文档可读性?非常欢迎一起参与进来,在提交 PR 前阅读一下 [Contributing Guide](https://github.com/alibaba/form-render/blob/master/CONTRIBUTING.md)

![Alt](https://repobeats.axiom.co/api/embed/2b2e9f5fdcdddeea164ef615d55816d8c2d2dc66.svg "Repobeats analytics image")

感谢给 XRender 贡献代码的你们:

<a href="https://github.com/alibaba/form-render/graphs/contributors">
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const MyWidget = props => {
```jsx
import React, { useState } from 'react';
import { Input, Button } from 'antd';
import { updateSchemaToNewVersion } from 'form-render/src/utils.js';
import { updateSchemaToNewVersion } from 'form-render/src/form-render-core/src/utils.js';

const TextArea = Input.TextArea;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { useRef } from 'react';
import Core from '../../index';
import { useSet } from '../../../hooks';
import { useSet, useTools } from '../../../hooks';
import { getDataPath, getKeyFromPath, getDisplayValue } from '../../../utils';
import { Button, Table, Drawer, Popconfirm } from 'antd';
// import ArrowDown from '../../../components/ArrowDown';
Expand All @@ -25,6 +25,7 @@ const DrawerList = ({
changeList,
listData,
}) => {
const { widgets } = useTools();
const { props = {}, itemProps = {} } = schema;
const { buttons, ...columnProps } = itemProps;
const { pagination = {}, ...rest } = props;
Expand Down Expand Up @@ -66,9 +67,16 @@ const DrawerList = ({
const childPath = getDataPath(child, [record.$idx]);
const errorObj = errorFields.find(item => item.name == childPath) || {};
//TODO: 万一error在更深的层,这个办法是find不到的,会展示那一行没有提示。可以整一行加一个红线的方式处理
const Widget = widgets[schema.readOnlyWidget];
return (
<div>
<div>{getDisplayValue(value, schema)}</div>
<div>
{Widget ? (
<Widget value={value} schema={schema} />
) : (
getDisplayValue(value, schema)
)}
</div>
{errorObj.error && (
<ErrorMessage message={errorObj.error} schema={schema} />
)}
Expand Down
5 changes: 4 additions & 1 deletion packages/form-render/src/form-render-core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,10 @@ export const getDisplayValue = (value, schema) => {
return value;
}
}
return JSON.stringify(value);
if (typeof value === 'object') {
return JSON.stringify(value);
}
return value;
};

// 去掉数组里的空元素 {a: [null, {x:1}]} => {a: [{x:1}]}
Expand Down
1 change: 1 addition & 0 deletions packages/form-render/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface SchemaBase {
displayType: 'row' | 'column';
width: string;
labelWidth: number | string;
column: number;
className: string;
widget: string;
readOnlyWidget: string;
Expand Down
1 change: 1 addition & 0 deletions packages/form-render/src/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface SchemaBase {
displayType: 'row' | 'column';
width: string;
labelWidth: number | string;
column: number;
className: string;
widget: string;
readOnlyWidget: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/table-render/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export interface TableState<RecordType> {
}

// TODO这里FR的props应该去FR里写,这里继承就好了
export interface SearchProps<RecordType> extends FRProps {
export interface SearchProps<RecordType> extends Omit<FRProps, 'form'> {
debug?: boolean;
searchBtnStyle?: React.CSSProperties;
searchBtnClassName?: string;
Expand Down

0 comments on commit 8322ef7

Please sign in to comment.