Skip to content

Commit db45527

Browse files
authored
Merge branch 'develop' into patch-1
2 parents f15c33c + 1d572cc commit db45527

File tree

30 files changed

+271
-899
lines changed

30 files changed

+271
-899
lines changed

docs/docs/api/model/node.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,4 +657,22 @@ setConditionalVisible(): void;
657657
*/
658658
getDOMNode(): HTMLElement;
659659

660+
```
661+
662+
### getRGL
663+
664+
获取磁贴相关信息
665+
666+
```typescript
667+
/**
668+
* 获取磁贴相关信息
669+
*/
670+
getRGL(): {
671+
isContainerNode: boolean;
672+
isEmptyNode: boolean;
673+
isRGLContainerNode: boolean;
674+
isRGLNode: boolean;
675+
isRGL: boolean;
676+
rglNode: Node | null;
677+
}
660678
```

packages/designer/src/component-actions.ts

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IPublicTypeComponentAction, IPublicTypeMetadataTransducer } from '@alilc/lowcode-types';
1+
import { IPublicModelNode, IPublicTypeComponentAction, IPublicTypeMetadataTransducer } from '@alilc/lowcode-types';
22
import { engineConfig } from '@alilc/lowcode-editor-core';
33
import { intlNode } from './locale';
44
import {
@@ -8,18 +8,19 @@ import {
88
IconClone,
99
IconHidden,
1010
} from './icons';
11-
import { Node } from './document';
1211
import { componentDefaults, legacyIssues } from './transducers';
1312

1413
export class ComponentActions {
14+
private metadataTransducers: IPublicTypeMetadataTransducer[] = [];
15+
1516
actions: IPublicTypeComponentAction[] = [
1617
{
1718
name: 'remove',
1819
content: {
1920
icon: IconRemove,
2021
title: intlNode('remove'),
2122
/* istanbul ignore next */
22-
action(node: Node) {
23+
action(node: IPublicModelNode) {
2324
node.remove();
2425
},
2526
},
@@ -31,13 +32,13 @@ export class ComponentActions {
3132
icon: IconHidden,
3233
title: intlNode('hide'),
3334
/* istanbul ignore next */
34-
action(node: Node) {
35-
node.setVisible(false);
35+
action(node: IPublicModelNode) {
36+
node.visible = false;
3637
},
3738
},
3839
/* istanbul ignore next */
39-
condition: (node: Node) => {
40-
return node.componentMeta.isModal;
40+
condition: (node: IPublicModelNode) => {
41+
return node.componentMeta?.isModal;
4142
},
4243
important: true,
4344
},
@@ -47,25 +48,25 @@ export class ComponentActions {
4748
icon: IconClone,
4849
title: intlNode('copy'),
4950
/* istanbul ignore next */
50-
action(node: Node) {
51+
action(node: IPublicModelNode) {
5152
// node.remove();
5253
const { document: doc, parent, index } = node;
5354
if (parent) {
54-
const newNode = doc.insertNode(parent, node, index + 1, true);
55-
newNode.select();
56-
const { isRGL, rglNode } = node.getRGL();
55+
const newNode = doc?.insertNode(parent, node, (index ?? 0) + 1, true);
56+
newNode?.select();
57+
const { isRGL, rglNode } = node?.getRGL();
5758
if (isRGL) {
5859
// 复制 layout 信息
59-
const layout = rglNode.getPropValue('layout') || [];
60-
const curLayout = layout.filter((item) => item.i === node.getPropValue('fieldId'));
60+
const layout: any = rglNode?.getPropValue('layout') || [];
61+
const curLayout = layout.filter((item: any) => item.i === node.getPropValue('fieldId'));
6162
if (curLayout && curLayout[0]) {
6263
layout.push({
6364
...curLayout[0],
64-
i: newNode.getPropValue('fieldId'),
65+
i: newNode?.getPropValue('fieldId'),
6566
});
66-
rglNode.setPropValue('layout', layout);
67+
rglNode?.setPropValue('layout', layout);
6768
// 如果是磁贴块复制,则需要滚动到影响位置
68-
setTimeout(() => newNode.document.simulator?.scrollToNode(newNode), 10);
69+
setTimeout(() => newNode?.document?.project?.simulatorHost?.scrollToNode(newNode), 10);
6970
}
7071
}
7172
}
@@ -79,13 +80,13 @@ export class ComponentActions {
7980
icon: IconLock, // 锁定 icon
8081
title: intlNode('lock'),
8182
/* istanbul ignore next */
82-
action(node: Node) {
83+
action(node: IPublicModelNode) {
8384
node.lock();
8485
},
8586
},
8687
/* istanbul ignore next */
87-
condition: (node: Node) => {
88-
return engineConfig.get('enableCanvasLock', false) && node.isContainer() && !node.isLocked;
88+
condition: (node: IPublicModelNode) => {
89+
return engineConfig.get('enableCanvasLock', false) && node.isContainerNode && !node.isLocked;
8990
},
9091
important: true,
9192
},
@@ -95,13 +96,13 @@ export class ComponentActions {
9596
icon: IconUnlock, // 解锁 icon
9697
title: intlNode('unlock'),
9798
/* istanbul ignore next */
98-
action(node: Node) {
99+
action(node: IPublicModelNode) {
99100
node.lock(false);
100101
},
101102
},
102103
/* istanbul ignore next */
103-
condition: (node: Node) => {
104-
return engineConfig.get('enableCanvasLock', false) && node.isContainer() && node.isLocked;
104+
condition: (node: IPublicModelNode) => {
105+
return engineConfig.get('enableCanvasLock', false) && node.isContainerNode && node.isLocked;
105106
},
106107
important: true,
107108
},
@@ -132,8 +133,6 @@ export class ComponentActions {
132133
}
133134
}
134135

135-
private metadataTransducers: IPublicTypeMetadataTransducer[] = [];
136-
137136
registerMetadataTransducer(
138137
transducer: IPublicTypeMetadataTransducer,
139138
level = 100,

packages/designer/src/document/node/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
12251225
const isRGLContainerNode = this.isRGLContainer;
12261226
const isRGLNode = this.getParent()?.isRGLContainer;
12271227
const isRGL = isRGLContainerNode || (isRGLNode && (!isContainerNode || !isEmptyNode));
1228-
let rglNode = isRGLContainerNode ? this : isRGL ? this?.getParent() : {};
1228+
let rglNode = isRGLContainerNode ? this : isRGL ? this?.getParent() : null;
12291229
return { isContainerNode, isEmptyNode, isRGLContainerNode, isRGLNode, isRGL, rglNode };
12301230
}
12311231

packages/designer/src/project/project.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515

1616
.lc-simulator {
17-
background: rgb(237, 239, 243);
17+
background-color: var(--color-background, rgb(237, 239, 243));
1818
}
1919

2020
.lc-simulator-shell {

packages/editor-core/src/widgets/tip/style.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
z-index: 2;
148148
position: fixed;
149149
box-sizing: border-box;
150-
background: rgba(0, 0, 0, 0.7);
150+
background: var(--color-layer-tooltip-background);
151151
max-height: 400px;
152152
color: var(--color-text-reverse, rgba(255, 255, 255, 0.8));
153153
left: 0;

packages/editor-skeleton/src/components/settings/style.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
.lc-outline-pane {
144144
position: absolute;
145145
z-index: 100;
146-
background-color: white;
147146
top: 0;
148147
bottom: 0;
149148
display: none;

packages/editor-skeleton/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * from './components/popup';
88
export * from './context';
99
export * from './register-defaults';
1010
export * from './widget';
11+
export * from './layouts';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export { default as LeftArea } from './left-area';
2+
export { default as LeftFloatPane } from './left-float-pane';
3+
export { default as LeftFixedPane } from './left-fixed-pane';
4+
export { default as MainArea } from './main-area';
5+
export { default as BottomArea } from './bottom-area';
6+
export { default as TopArea } from './top-area';
7+
export { default as SubTopArea } from './sub-top-area';

packages/editor-skeleton/src/layouts/left-area.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { observer } from '@alilc/lowcode-editor-core';
44
import { Area } from '../area';
55

66
@observer
7-
export default class LeftArea extends Component<{ area: Area }> {
7+
export default class LeftArea extends Component<{ area: Area; className?: string }> {
88
render() {
9-
const { area } = this.props;
9+
const { area, className = 'lc-left-area' } = this.props;
1010
if (area.isEmpty()) {
1111
return null;
1212
}
1313
return (
14-
<div className={classNames('lc-left-area', {
14+
<div className={classNames(className, {
1515
'lc-area-visible': area.visible,
1616
})}
1717
>
@@ -21,7 +21,6 @@ export default class LeftArea extends Component<{ area: Area }> {
2121
}
2222
}
2323

24-
2524
@observer
2625
class Contents extends Component<{ area: Area }> {
2726
render() {
File renamed without changes.

0 commit comments

Comments
 (0)