Skip to content

Commit

Permalink
fix(form:array): fix invalid ui in ui schema (#1657)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Oct 17, 2023
1 parent c5b46ee commit 6b3c711
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions packages/form/src/sf.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,12 @@ export class SFComponent implements OnInit, OnChanges, OnDestroy {
}

if (property.items) {
const uiSchemaInArr = (uiSchema[uiKey] || {}).$items || {};
ui.$items = {
...(property.items.ui as SFUISchemaItem),
...uiSchemaInArr[uiKey],
...uiSchema[uiKey],
...ui.$items
};
inFn(property.items, property.items, uiSchemaInArr, ui.$items, ui.$items);
inFn(property.items, property.items, uiSchema[uiKey]?.$items ?? {}, ui.$items, ui.$items);
}

if (property.properties && Object.keys(property.properties).length) {
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/widgets/array/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ const ui = {
| `[removable]` | Whether includes remove button | `boolean` | `true` |
| `[removeTitle]` | Remove button title | `string` | `remove` |
| `[required]` | Add required style to current item | `boolean` | - |
| `[$items]` | UI description of array element | `SFUISchema` | `remove` |
| `[$items]` | UI description of array element | `SFUISchema` | - |
| `(add)` | Add callback,`property` indicates form property after add | `(property: FormProperty) => void` | - |
| `(remove)` | Remove callback | `(index: number) => void` | - |
2 changes: 1 addition & 1 deletion packages/form/src/widgets/array/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ const ui = {
| `[removable]` | 是否包含移除按钮 | `boolean` | `true` |
| `[removeTitle]` | 移除按钮文本 | `string` | `移除` |
| `[required]` | 当前项是否为必填,仅影响样式 | `boolean` | - |
| `[$items]` | 数组元素类型UI描述 | `SFUISchema` | `移除` |
| `[$items]` | 数组元素类型UI描述 | `SFUISchema` | - |
| `(add)` | 添加回调,`property` 表示添加后的表单属性 | `(property: FormProperty) => void` | - |
| `(remove)` | 移除回调 | `(index: number) => void` | - |

0 comments on commit 6b3c711

Please sign in to comment.