Skip to content

Commit

Permalink
fix: 对象容器样式调整 & 数组|对象容器schema支持style参数 (#116)
Browse files Browse the repository at this point in the history
* fix: 对象容器样式调整 & 数组|对象容器schema支持style参数

* fix: 数组容器sidebar属性配置内下边距展示调整
  • Loading branch information
Henry129999 committed Jan 10, 2022
1 parent 347b31a commit 45f0f39
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/drip-form/src/container/ArrayContainer/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
.array-field--container
display flex
justify-content space-between
margin-bottom 20px

&.title
&-top
Expand Down
5 changes: 4 additions & 1 deletion packages/drip-form/src/container/ArrayContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-07 16:54:47
*/
import React, { useMemo, useState, useEffect, memo } from 'react'
import React, { useMemo, useState, useEffect, memo, CSSProperties } from 'react'
import cx from 'classnames'
import { typeCheck, number2Chinese } from '@jdfed/utils'
import { useArray, useContainer, useContainerStyle } from '@jdfed/hooks'
Expand Down Expand Up @@ -135,6 +135,7 @@ const ArrayContainer: FC<Props & RenderFnProps & ArrayProps> = ({
}),
display: 'flex',
margin: titleMargin.style,
lineHeight: '32px',
}}
>
{titleUi?.requiredIcon &&
Expand Down Expand Up @@ -177,6 +178,7 @@ const ArrayContainer: FC<Props & RenderFnProps & ArrayProps> = ({
titlePlacementCls(titlePlacement)
)}
style={{
...(uiProp?.style as CSSProperties),
...(newContainerStyle?.width && { width: newContainerStyle.width }),
}}
>
Expand All @@ -192,6 +194,7 @@ const ArrayContainer: FC<Props & RenderFnProps & ArrayProps> = ({
: titleUi?.width || 90
}px)`,
minWidth: '200px',
flexShrink: 0,
}}
>
{(formMode === 'generator' || isTuple ? [''] : fieldData).map(
Expand Down
5 changes: 4 additions & 1 deletion packages/drip-form/src/container/ObjectContainer/index.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.object-container
.object-container__collapse-custom
margin-bottom 20px

&__title
&--common
margin-bottom 20px
Expand All @@ -18,4 +21,4 @@
flex-direction column-reverse

&-right
flex-direction row-reverse
flex-direction row-reverse
8 changes: 6 additions & 2 deletions packages/drip-form/src/container/ObjectContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2021-12-24 14:53:47
*/
import React, { useMemo, memo, useState, useEffect } from 'react'
import React, { useMemo, memo, useState, useEffect, CSSProperties } from 'react'
import { useContainer, useContainerStyle } from '@jdfed/hooks'
import cx from 'classnames'
import renderCoreFn from '../../render'
Expand Down Expand Up @@ -115,11 +115,15 @@ const ObjectContainer: FC<Props & RenderFnProps & ObjectContainerProps> = ({
<div
className="object-container"
style={{
...(uiProp?.style as CSSProperties),
...(newContainerStyle?.width && { width: newContainerStyle.width }),
}}
>
{isCollapse ? (
<Collapse defaultActiveKey={defaultActiveKey}>
<Collapse
defaultActiveKey={defaultActiveKey}
className={cx('object-container__collapse-custom')}
>
<Panel
header={titleMemo}
key={fieldKey}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ const PropertyConfig = () => {

return (
<Fragment>
<div className={styles.panelConfig}>
<div className={`${styles.panelConfig} panelConfigGlobal`}>
{type !== 'root' && (
<>
<div className={cx(styles.propertyConfig)}>
Expand Down
13 changes: 13 additions & 0 deletions packages/generator/src/components/RightSideBar/index.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
:global {
.panelConfigGlobal {
.object-container {
.object-container__collapse-custom {
margin-bottom: 0
}
}
.array-field--container {
margin-bottom: 0
}
}
}

.container {
@apply w-1/4 p-3 h-full;
min-width: 350px;
Expand Down
3 changes: 3 additions & 0 deletions packages/generator/src/fields/container/array.field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ const config: Field = {
ui: {
type: 'object',
mode: 'collapse',
style: {
paddingBottom: '20px',
},
vcontrol: 'return props.formData.ui.showNo == true',
},
default: {
Expand Down
7 changes: 6 additions & 1 deletion packages/generator/src/fields/formItem/checkbox.field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ const config: Field = {
type: 'array',
title: '选项',
default: [],
ui: { type: 'array' },
ui: {
type: 'array',
style: {
marginBottom: '20px',
},
},
items: {
type: 'object',
title: '',
Expand Down

0 comments on commit 45f0f39

Please sign in to comment.