Skip to content

Commit

Permalink
chore: 布局容器优化
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao07 committed Mar 8, 2024
1 parent 37f298d commit 13299b7
Show file tree
Hide file tree
Showing 11 changed files with 712 additions and 92 deletions.
1 change: 1 addition & 0 deletions packages/amis-editor-core/scss/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
@import './style-control/size';
@import './style-control/style-common';
@import './style-control/theme-css-code';
@import './style-control/flex-layout';

/* 组件样式 */
@import './components/button';
Expand Down
29 changes: 29 additions & 0 deletions packages/amis-editor-core/scss/style-control/_flex-layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.ae-FlexLayout {
&-wrap {
display: grid;
grid-row-gap: 10px;
grid-column-gap: 10px;
grid-template-columns: repeat(4, auto);
margin-bottom: 10px;
}

&-item {
display: flex;
flex-direction: row;
gap: 2px;
height: 36px;
border: 1px solid rgba(0, 0, 0, 0.2);
padding: 4px;
border-radius: 4px;
cursor: pointer;

&.active {
border-color: #528eff;
}
}

&-itemColumn {
height: 100%;
background-color: #999;
}
}
8 changes: 6 additions & 2 deletions packages/amis-editor-core/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,11 @@ export class EditorManager {
* @param rendererIdOrSchema
* 备注:可以根据渲染器ID添加新元素,也可以根据现有schema片段添加新元素
*/
async addElem(rendererIdOrSchema: string | any, reGenerateId?: boolean) {
async addElem(
rendererIdOrSchema: string | any,
reGenerateId?: boolean,
activeChild: boolean = true
) {
if (!rendererIdOrSchema) {
return;
}
Expand Down Expand Up @@ -1029,7 +1033,7 @@ export class EditorManager {
},
reGenerateId
);
if (child) {
if (child && activeChild) {
// mobx 修改数据是异步的
setTimeout(() => {
store.setActiveId(child.$$id);
Expand Down
1 change: 1 addition & 0 deletions packages/amis-editor/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import './renderer/style-control/BoxShadow';
import './renderer/style-control/Background';
import './renderer/style-control/Display';
import './renderer/style-control/InsetBoxModel';
import './renderer/style-control/FlexLayout';
import './renderer/RangePartsControl';
import './renderer/DataBindingControl';
import './renderer/DataMappingControl';
Expand Down

0 comments on commit 13299b7

Please sign in to comment.