GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: added workspace api to support registration of multiple resources · stantoxt/lowcode-engine@dae09e3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs/docs/api
    • model
      • window.md
    • workspace.md
  • packages
    • designer
      • src
        • component-actions.ts
        • component-meta.ts
        • designer
          • designer.ts
          • setting
            • setting-field.ts
        • project
          • project-view.tsx
          • project.ts
      • tests/main/meta
        • component-meta.test.ts
    • editor-skeleton/src
      • components/settings
        • settings-primary-pane.tsx
      • layouts
        • workbench.less
      • register-defaults.ts
      • skeleton.ts
    • engine/src
      • engine-core.ts
    • shell/src
      • api
        • material.ts
        • project.ts
        • workspace.ts
      • model
        • window.ts
      • symbols.ts
    • types/src/shell
      • api
        • workspace.ts
      • model
        • window.ts
      • type
        • resource-options.ts
        • widget-config-area.ts
    • workspace/src
      • base-context.ts
      • editor-view
        • context.ts
        • view.tsx
      • editor-window
        • context.ts
        • view.tsx
      • index.ts
      • layouts
        • left-area.tsx
        • sub-top-area.tsx
        • top-area.tsx
        • workbench.less
        • workbench.tsx
      • resource.ts
      • workspace.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/docs/api/model/window.md‎

Copy file name to clipboardExpand all lines: docs/docs/api/model/window.md
+31-5Lines changed: 31 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,41 @@ sidebar_position: 12
1111

1212
低代码设计器窗口模型
1313

14+
## 变量
15+
16+
### id
17+
18+
窗口唯一 id
19+
20+
### title
21+
22+
窗口标题
23+
24+
### resourceName
25+
26+
窗口资源名字
27+
1428
## 方法签名
1529

16-
### importSchema(schema: IPublicTypeNodeSchema)
17-
当前窗口导入 schema
30+
### importSchema
31+
当前窗口导入 schema, 会调用当前窗口对应资源的 import 钩子
32+
33+
```typescript
34+
function importSchema(schema: IPublicTypeNodeSchema): void
35+
```
1836

1937
相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts)
2038

21-
### changeViewType(viewName: string)
39+
### changeViewType
2240
修改当前窗口视图类型
2341

24-
### async save()
25-
调用当前窗口视图保存钩子
42+
```typescript
43+
function changeViewType(viewName: string): void
44+
```
45+
46+
### save
47+
当前窗口的保存方法,会调用当前窗口对应资源的 save 钩子
48+
49+
```typescript
50+
function save(): Promise(void)
51+
```
Collapse file

‎docs/docs/api/workspace.md‎

Copy file name to clipboardExpand all lines: docs/docs/api/workspace.md
+40Lines changed: 40 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@ sidebar_position: 12
2121

2222
当前设计器窗口模型
2323

24+
```typescript
25+
get window(): IPublicModelWindow
26+
```
27+
28+
关联模型 [IPublicModelWindow](./model/window)
29+
30+
### plugins
31+
32+
应用级别的插件注册
33+
34+
```typescript
35+
get plugins(): IPublicApiPlugins
36+
```
37+
38+
关联模型 [IPublicApiPlugins](./plugins)
39+
40+
### windows
41+
42+
当前设计器的编辑窗口
43+
44+
```typescript
45+
get window(): IPublicModelWindow[]
46+
```
47+
2448
关联模型 [IPublicModelWindow](./model/window)
2549

2650
## 方法签名
@@ -34,3 +58,19 @@ registerResourceType(resourceName: string, resourceType: 'editor', options: IPub
3458
```
3559

3660
相关类型:[IPublicResourceOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts)
61+
62+
### onChangeWindows
63+
64+
窗口新增/删除的事件
65+
66+
```typescript
67+
function onChangeWindows(fn: () => void): void;
68+
```
69+
70+
### onChangeActiveWindow
71+
72+
active 窗口变更事件
73+
74+
```typescript
75+
function onChangeActiveWindow(fn: () => void): void;
76+
```
Collapse file

‎packages/designer/src/component-actions.ts‎

Copy file name to clipboard
+155Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import { IPublicTypeComponentAction, IPublicTypeMetadataTransducer } from '@alilc/lowcode-types';
2+
import { engineConfig } from '@alilc/lowcode-editor-core';
3+
import { intlNode } from './locale';
4+
import {
5+
IconLock,
6+
IconUnlock,
7+
IconRemove,
8+
IconClone,
9+
IconHidden,
10+
} from './icons';
11+
import { Node } from './document';
12+
import { componentDefaults, legacyIssues } from './transducers';
13+
14+
export class ComponentActions {
15+
actions: IPublicTypeComponentAction[] = [
16+
{
17+
name: 'remove',
18+
content: {
19+
icon: IconRemove,
20+
title: intlNode('remove'),
21+
/* istanbul ignore next */
22+
action(node: Node) {
23+
node.remove();
24+
},
25+
},
26+
important: true,
27+
},
28+
{
29+
name: 'hide',
30+
content: {
31+
icon: IconHidden,
32+
title: intlNode('hide'),
33+
/* istanbul ignore next */
34+
action(node: Node) {
35+
node.setVisible(false);
36+
},
37+
},
38+
/* istanbul ignore next */
39+
condition: (node: Node) => {
40+
return node.componentMeta.isModal;
41+
},
42+
important: true,
43+
},
44+
{
45+
name: 'copy',
46+
content: {
47+
icon: IconClone,
48+
title: intlNode('copy'),
49+
/* istanbul ignore next */
50+
action(node: Node) {
51+
// node.remove();
52+
const { document: doc, parent, index } = node;
53+
if (parent) {
54+
const newNode = doc.insertNode(parent, node, index + 1, true);
55+
newNode.select();
56+
const { isRGL, rglNode } = node.getRGL();
57+
if (isRGL) {
58+
// 复制 layout 信息
59+
let layout = rglNode.getPropValue('layout') || [];
60+
let curLayout = layout.filter((item) => item.i === node.getPropValue('fieldId'));
61+
if (curLayout && curLayout[0]) {
62+
layout.push({
63+
...curLayout[0],
64+
i: newNode.getPropValue('fieldId'),
65+
});
66+
rglNode.setPropValue('layout', layout);
67+
// 如果是磁贴块复制,则需要滚动到影响位置
68+
setTimeout(() => newNode.document.simulator?.scrollToNode(newNode), 10);
69+
}
70+
}
71+
}
72+
},
73+
},
74+
important: true,
75+
},
76+
{
77+
name: 'lock',
78+
content: {
79+
icon: IconLock, // 锁定 icon
80+
title: intlNode('lock'),
81+
/* istanbul ignore next */
82+
action(node: Node) {
83+
node.lock();
84+
},
85+
},
86+
/* istanbul ignore next */
87+
condition: (node: Node) => {
88+
return engineConfig.get('enableCanvasLock', false) && node.isContainer() && !node.isLocked;
89+
},
90+
important: true,
91+
},
92+
{
93+
name: 'unlock',
94+
content: {
95+
icon: IconUnlock, // 解锁 icon
96+
title: intlNode('unlock'),
97+
/* istanbul ignore next */
98+
action(node: Node) {
99+
node.lock(false);
100+
},
101+
},
102+
/* istanbul ignore next */
103+
condition: (node: Node) => {
104+
return engineConfig.get('enableCanvasLock', false) && node.isContainer() && node.isLocked;
105+
},
106+
important: true,
107+
},
108+
];
109+
110+
constructor() {
111+
this.registerMetadataTransducer(legacyIssues, 2, 'legacy-issues'); // should use a high level priority, eg: 2
112+
this.registerMetadataTransducer(componentDefaults, 100, 'component-defaults');
113+
}
114+
115+
removeBuiltinComponentAction(name: string) {
116+
const i = this.actions.findIndex((action) => action.name === name);
117+
if (i > -1) {
118+
this.actions.splice(i, 1);
119+
}
120+
}
121+
addBuiltinComponentAction(action: IPublicTypeComponentAction) {
122+
this.actions.push(action);
123+
}
124+
125+
modifyBuiltinComponentAction(
126+
actionName: string,
127+
handle: (action: IPublicTypeComponentAction) => void,
128+
) {
129+
const builtinAction = this.actions.find((action) => action.name === actionName);
130+
if (builtinAction) {
131+
handle(builtinAction);
132+
}
133+
}
134+
135+
private metadataTransducers: IPublicTypeMetadataTransducer[] = [];
136+
137+
registerMetadataTransducer(
138+
transducer: IPublicTypeMetadataTransducer,
139+
level = 100,
140+
id?: string,
141+
) {
142+
transducer.level = level;
143+
transducer.id = id;
144+
const i = this.metadataTransducers.findIndex((item) => item.level != null && item.level > level);
145+
if (i < 0) {
146+
this.metadataTransducers.push(transducer);
147+
} else {
148+
this.metadataTransducers.splice(i, 0, transducer);
149+
}
150+
}
151+
152+
getRegisteredMetadataTransducers(): IPublicTypeMetadataTransducer[] {
153+
return this.metadataTransducers;
154+
}
155+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.