Skip to content

Commit

Permalink
fix(form): fix baseColProps not work
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Nov 17, 2020
1 parent cd35d3e commit c8ef82b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

- 修复表单 inputNumber 校验错误
- 修复表单默认值设置错误
- 修复菜单折叠按钮隐藏时占位问题
- 修复表单 baseColProps 不生效

## 2.0.0-rc.10 (2020-11-13)

Expand Down
6 changes: 5 additions & 1 deletion src/components/Form/src/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export default defineComponent({
function getShow() {
const { show, ifShow } = props.schema;
const { showAdvancedButton } = props.formProps;
const itemIsAdvanced = showAdvancedButton ? !!props.schema.isAdvanced : true;
const itemIsAdvanced = showAdvancedButton
? isBoolean(props.schema.isAdvanced)
? props.schema.isAdvanced
: true
: true;
let isShow = true;
let isIfShow = true;

Expand Down
9 changes: 7 additions & 2 deletions src/components/Form/src/hooks/useAdvanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export default function ({
function updateAdvanced() {
let itemColSum = 0;
let realItemColSum = 0;
const { baseColProps = {} } = unref(getProps);

for (const schema of unref(getSchema)) {
const { show, colProps } = schema;
let isShow = true;
Expand All @@ -152,8 +154,11 @@ export default function ({
});
}

if (isShow && colProps) {
const { itemColSum: sum, isAdvanced } = getAdvanced(colProps, itemColSum);
if (isShow && (colProps || baseColProps)) {
const { itemColSum: sum, isAdvanced } = getAdvanced(
{ ...baseColProps, ...colProps },
itemColSum
);

itemColSum = sum || 0;
if (isAdvanced) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/src/BasicTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
}"
>
<BasicForm
:submitOnReset="true"
v-bind="getFormProps"
v-if="getBindValues.useSearchForm"
:submitOnReset="true"
:submitButtonOptions="{ loading }"
:tableAction="tableAction"
@register="registerForm"
Expand Down

0 comments on commit c8ef82b

Please sign in to comment.