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

feat:UI specification adjustment #938

Merged
merged 20 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
2 changes: 2 additions & 0 deletions packages/builtinComponent/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { default as CanvasCol } from './src/components/CanvasCol.vue'
export { default as CanvasRow } from './src/components/CanvasRow.vue'
export { default as CanvasRowColContainer } from './src/components/CanvasRowColContainer.vue'
export { default as CanvasFlexBox } from './src/components/CanvasFlexBox.vue'
export { default as CanvasSection } from './src/components/CanvasSection.vue'
export { default as meta } from './src/meta'
55 changes: 55 additions & 0 deletions packages/builtinComponent/src/components/CanvasFlexBox.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<div class="canvas-flex-box">
<slot> </slot>
</div>
</template>

<script setup>
import { computed, defineProps } from 'vue'
import { getStyleValue } from './helper'

const props = defineProps({
flexDirection: {
type: String,
default: 'row'
},
gap: {
type: [String, Number],
default: '8px'
},
padding: {
type: [String, Number],
default: '8px'
},
alignItems: {
type: String,
default: 'center'
},
justifyContent: {
type: String,
default: 'flex-start'
}
})
lichunn marked this conversation as resolved.
Show resolved Hide resolved

const styles = computed(() => ({
flexDirection: props.flexDirection,
gap: getStyleValue(props.gap),
padding: getStyleValue(props.padding),
alignItems: props.alignItems,
justifyContent: props.justifyContent
}))
</script>
<style lang="less" scoped>
.canvas-flex-box {
display: flex;
flex: 1 1 0px;
flex-direction: v-bind('styles.flexDirection');
gap: v-bind('styles.gap');
padding: v-bind('styles.padding');
align-items: v-bind('styles.alignItems');
justify-content: v-bind('styles.justifyContent');
:deep(.canvas-container) {
width: 100%;
}
}
</style>
15 changes: 15 additions & 0 deletions packages/builtinComponent/src/components/CanvasSection.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div class="canvas-section">
<slot> </slot>
</div>
</template>

<style lang="less" scoped>
.canvas-section {
width: 100%;
display: flex;
flex: 1 1 0;
align-items: center;
justify-content: center;
}
</style>
221 changes: 221 additions & 0 deletions packages/builtinComponent/src/meta/CanvasFlexBox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"component": {
"icon": "Box",
"name": {
"zh_CN": "弹性盒子容器"
},
"component": "CanvasFlexBox",
"schema": {
"slots": {},
"properties": [
{
"label": {
"zh_CN": "基础信息"
},
"description": {
"zh_CN": "基础信息"
},
"collapse": {
"number": 6,
"text": {
"zh_CN": "显示更多"
}
},
"content": [
{
"property": "flexDirection",
"type": "String",
"defaultValue": "row",
"bindState": true,
"label": {
"text": {
"zh_CN": "排列方向"
}
},
"cols": 12,
"rules": [],
"widget": {
"component": "SelectConfigurator",
"props": {
"options": [
lichunn marked this conversation as resolved.
Show resolved Hide resolved
{
"label": "row",
"value": "row"
},
{
"label": "row-reverse",
"value": "row-reverse"
},
{
"label": "column",
"value": "column"
},
{
"label": "column-reverse",
"value": "column-reverse"
}
]
}
}
},
{
"property": "gap",
"defaultValue": "8px",
"label": {
"text": {
"zh_CN": "间距"
}
},
"widget": {
"component": "InputConfigurator"
},
"description": {
"zh_CN": "控制容器内水平和垂直的间距"
},
"labelPosition": "left"
},
{
"property": "padding",
"defaultValue": "8px",
"label": {
"text": {
"zh_CN": "内边距"
}
},
"widget": {
"component": "InputConfigurator"
},
"labelPosition": "left"
},
{
"property": "justifyContent",
"type": "String",
"defaultValue": "flex-start",
"bindState": true,
"label": {
"text": {
"zh_CN": "水平对齐方式"
}
},
"cols": 12,
"rules": [],
"widget": {
"component": "SelectConfigurator",
"props": {
"options": [
{
"label": "flex-start",
"value": "flex-start"
},
{
"label": "flex-end",
"value": "flex-end"
},
{
"label": "center",
"value": "center"
},
{
"label": "space-between",
"value": "space-between"
},
{
"label": "space-around",
"value": "space-around"
}
]
}
}
},
{
"property": "alignItems",
"type": "String",
"defaultValue": "center",
"bindState": true,
"label": {
"text": {
"zh_CN": "垂直对齐方式"
}
},
"cols": 12,
"rules": [],
"widget": {
"component": "SelectConfigurator",
"props": {
"options": [
{
"label": "center",
"value": "center"
},
{
"label": "flex-end",
"value": "flex-end"
},
{
"label": "flex-start",
"value": "flex-start"
},
{
"label": "baseline",
"value": "baseline"
},
{
"label": "stretch",
"value": "stretch"
}
]
}
}
}
]
}
],
"events": {
"onClick": {
"label": {
"zh_CN": "点击事件"
},
"description": {
"zh_CN": "点击时触发的回调函数"
},
"type": "event",
"functionInfo": {
"params": [],
"returns": {}
},
"defaultValue": ""
}
},
"shortcuts": {
"properties": []
},
"contentMenu": {
"actions": []
}
},
"configure": {
"loop": true,
"isContainer": true,
"nestingRule": {
"childWhitelist": [],
"descendantBlacklist": []
}
}
},
"snippet": {
"name": {
"zh_CN": "弹性盒子容器"
},
"screenshot": "",
"snippetName": "CanvasFlexBox",
"icon": "Box",
"schema": {
"componentName": "CanvasFlexBox",
"props": {
"flexDirection": "row",
"gap": "8px",
"padding": "8px"
}
}
}
}
10 changes: 5 additions & 5 deletions packages/builtinComponent/src/meta/CanvasRowColContainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@
"schema": {
"componentName": "CanvasRowColContainer",
"props": {
"rowGap": "20px"
"rowGap": "16px"
lichunn marked this conversation as resolved.
Show resolved Hide resolved
},
"children": [
{
"componentName": "CanvasRow",
"props": {
"rowGap": "20px",
"colGap": "20px"
"rowGap": "16px",
"colGap": "16px"
},
"children": [
{
"componentName": "CanvasCol",
"props": {
"rowGap": "20px",
"colGap": "20px",
"rowGap": "16px",
"colGap": "16px",
"grow": true,
"shrink": true,
"widthType": "auto"
Expand Down
71 changes: 71 additions & 0 deletions packages/builtinComponent/src/meta/CanvasSection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"component": {
"icon": "Box",
"name": {
"zh_CN": "Section"
},
lichunn marked this conversation as resolved.
Show resolved Hide resolved
"component": "CanvasSection",
"schema": {
"slots": {},
"properties": [
{
"label": {
"zh_CN": "基础信息"
},
"description": {
"zh_CN": "基础信息"
},
"collapse": {
"number": 6,
"text": {
"zh_CN": "显示更多"
}
},
"content": []
}
lichunn marked this conversation as resolved.
Show resolved Hide resolved
],
"events": {
"onClick": {
"label": {
"zh_CN": "点击事件"
},
"description": {
"zh_CN": "点击时触发的回调函数"
},
"type": "event",
"functionInfo": {
"params": [],
"returns": {}
},
"defaultValue": ""
}
},
"shortcuts": {
"properties": []
},
"contentMenu": {
"actions": []
}
},
"configure": {
"loop": true,
"isContainer": true,
"nestingRule": {
"childWhitelist": [],
"descendantBlacklist": []
}
lichunn marked this conversation as resolved.
Show resolved Hide resolved
}
},
"snippet": {
"name": {
"zh_CN": "Section"
},
"screenshot": "",
"snippetName": "CanvasSection",
"icon": "Box",
"schema": {
"componentName": "CanvasSection",
"props": {}
}
}
}
Loading
Loading