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

fix(form:array): fix invalid ui in ui schema #1657

Merged
merged 2 commits into from
Oct 17, 2023
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
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` | - |
Loading