amis2/scss/components/_json-schema.scss
liaoxuezhi e9f2e3a67f
feat: 添加 json-schema 渲染器 (#4269)
* feat: 添加 json-schema 渲染器

* draft: 组件层添加 form 逻辑

* 补充组件form相关逻辑

* json-schema-editor 组件内部实现调整

* 添加 json-schema 渲染器

* 补充外部 value 变化更新成员的逻辑

* 补充外部 value 变化更新成员的逻辑

* 优化 json-schema 交互

* 修改 snapshot

* 可能死循环

* 补充文档

* 优化逻辑

* 具备远程获取能力

* 固定值优化
2022-05-10 23:35:56 +08:00

125 lines
2.4 KiB
SCSS

.#{$ns}JSONSchemaMember {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
gap: var(--gap-sm);
&-key {
min-width: 80px;
max-width: 150px;
flex: 1;
& > span {
display: flex;
background: var(--Form-input-bg);
border: var(--Form-input-borderWidth) solid var(--Form-input-borderColor);
border-radius: var(--Form-input-borderRadius);
// height: var(--Form-input-height);
line-height: var(--Form-input-lineHeight);
padding: var(--Form-input-paddingY) var(--Form-input-paddingX);
font-size: var(--Form-input-fontSize);
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
color: var(--Form-input-color);
}
}
&-value {
flex: 1;
margin-left: auto;
display: flex;
gap: var(--gap-sm);
> a {
display: inline-block;
}
> div {
flex: 1;
flex-wrap: nowrap;
}
}
& + & {
margin-top: var(--gap-sm);
}
}
.#{$ns}JSONSchemaObject {
&-caret {
display: inline-block;
height: px2rem(24px);
text-align: center;
line-height: px2rem(24px);
vertical-align: middle;
cursor: pointer;
transform: rotate(0deg);
transition: transform var(--animation-duration);
color: var(--icon-color);
margin-top: calc((var(--Form-input-height) - var(--Switch-height)) / 2);
> svg {
width: 10px;
height: 10px;
top: 0;
}
}
&-caret.is-collapsed {
transform: rotate(-90deg);
}
&.is-expanded {
position: relative;
margin-left: px2rem(20px);
&:before {
width: 1px;
content: '';
display: block;
position: absolute;
top: 30px;
bottom: 10px;
left: -33px;
border-left: dashed 1px var(--icon-color);
}
& .#{$ns}JSONSchemaMember {
position: relative;
}
& .#{$ns}JSONSchemaMember:before {
height: 1px;
content: '';
display: block;
position: absolute;
top: 17px;
width: 25px;
left: -33px;
border-top: dashed 1px var(--icon-color);
}
& .#{$ns}JSONSchemaMember:first-child:before {
left: -20px;
width: 12px;
}
& > button {
position: relative;
&:before {
height: 1px;
content: '';
display: block;
position: absolute;
top: 10px;
width: 25px;
left: -33px;
border-top: dashed 1px var(--icon-color);
}
}
}
}