aldehyde 0.2.493 → 0.2.495
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +63 -63
- package/lib/draw-canvas-edit/components/asset-bar/index.less +35 -35
- package/lib/draw-canvas-edit/components/main-header/index.less +23 -23
- package/lib/layout2/page.d.ts +2 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +19 -8
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout2/type/layout-type.d.ts +1 -0
- package/lib/layout2/type/layout-type.d.ts.map +1 -1
- package/lib/lowcode-components/base-table/index.less +61 -61
- package/lib/lowcode-components/base-text/index.less +19 -19
- package/lib/lowcode-components/column-chart/index.js +2 -2
- package/lib/lowcode-components/column-chart/index.js.map +1 -1
- package/lib/lowcode-components/data-number/index.less +10 -10
- package/lib/lowcode-components/date-time/index.less +4 -4
- package/lib/lowcode-components/four-angle-glow-border/index.less +49 -49
- package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.js +6 -2
- package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-chart/index.js +6 -2
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/font/FontGlobal.css +26 -26
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.less +13 -13
- package/lib/lowcode-components/text-scroller/index.less +28 -28
- package/lib/module/ltmpl-table.d.ts +7 -0
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +12 -16
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/routable/dtmpl-route.d.ts.map +1 -1
- package/lib/routable/dtmpl-route.js +8 -2
- package/lib/routable/dtmpl-route.js.map +1 -1
- package/lib/routable/import-route.d.ts.map +1 -1
- package/lib/routable/import-route.js +9 -1
- package/lib/routable/import-route.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +13 -6
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/splitview-ltmpl-route.d.ts.map +1 -1
- package/lib/routable/splitview-ltmpl-route.js +11 -10
- package/lib/routable/splitview-ltmpl-route.js.map +1 -1
- package/lib/routable/ttmpl-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-route.js +9 -2
- package/lib/routable/ttmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +1 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +31 -9
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/page-chart.js +1 -1
- package/lib/table/page-chart.js.map +1 -1
- package/lib/table/row-table.d.ts +6 -0
- package/lib/table/row-table.d.ts.map +1 -1
- package/lib/table/row-table.js +21 -6
- package/lib/table/row-table.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tree/act-tree.d.ts +1 -0
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/act-tree.js +6 -7
- package/lib/tree/act-tree.js.map +1 -1
- package/lib/tree/tree-utils.d.ts +1 -1
- package/lib/tree/tree-utils.d.ts.map +1 -1
- package/lib/tree/tree-utils.js +4 -4
- package/lib/tree/tree-utils.js.map +1 -1
- package/lib/units/index.d.ts +4 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +10 -3
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +63 -63
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.json +93 -93
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.less +35 -35
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.tsx +110 -110
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.less +23 -23
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.tsx +263 -263
- package/src/aldehyde/draw-canvas-edit/components/render/draws/index.ts +7 -7
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/base-graph.ts +241 -241
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/circle.ts +699 -699
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/curve.ts +500 -500
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/index.ts +5 -5
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/line.ts +493 -493
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/rect.ts +680 -680
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/drag-handlers.ts +68 -68
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/graph-handlers.ts +113 -113
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/index.ts +9 -9
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/key-move-handlers.ts +49 -49
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/link-handlers.ts +45 -45
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/shutcut-handlers.ts +45 -45
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/text-handlers.ts +81 -81
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/zoom-handlers.ts +59 -59
- package/src/aldehyde/draw-canvas-edit/components/render/tools/align-tool.ts +89 -89
- package/src/aldehyde/draw-canvas-edit/components/render/tools/asset-tool.ts +154 -154
- package/src/aldehyde/draw-canvas-edit/components/render/tools/link-tool.ts +222 -222
- package/src/aldehyde/draw-canvas-edit/components/render/tools/z-index-tool.ts +224 -224
- package/src/aldehyde/draw-canvas-edit/components/render/utils/a-star.ts +116 -116
- package/src/aldehyde/draw-canvas-edit/components/render/utils/bezier-scene-func.ts +72 -72
- package/src/aldehyde/draw-canvas-edit/components/setting-form/imag-upload.tsx +119 -119
- package/src/aldehyde/layout2/page.tsx +17 -9
- package/src/aldehyde/layout2/type/layout-type.ts +1 -0
- package/src/aldehyde/layout4/imgs/user.svg +26 -26
- package/src/aldehyde/lowcode-components/base-color-block/index.tsx +31 -31
- package/src/aldehyde/lowcode-components/base-table/index.less +61 -61
- package/src/aldehyde/lowcode-components/base-text/index.less +19 -19
- package/src/aldehyde/lowcode-components/column-chart/index.tsx +2 -2
- package/src/aldehyde/lowcode-components/data-number/index.less +10 -10
- package/src/aldehyde/lowcode-components/date-time/index.less +4 -4
- package/src/aldehyde/lowcode-components/date-time/index.tsx +64 -64
- package/src/aldehyde/lowcode-components/four-angle-glow-border/index.less +49 -49
- package/src/aldehyde/lowcode-components/four-angle-glow-border/index.tsx +53 -53
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +5 -2
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +5 -2
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-controller.ts +64 -64
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-definition.ts +77 -77
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-loader.ts +36 -36
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +91 -91
- package/src/aldehyde/lowcode-components/lowcode-view/component/font/FontGlobal.css +26 -26
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/controller.ts +36 -36
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/definition.ts +53 -53
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/index.tsx +15 -15
- package/src/aldehyde/lowcode-components/lowcode-view/component/layer-builder.tsx +98 -98
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.less +13 -13
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +121 -121
- package/src/aldehyde/lowcode-components/placeholder-component/index.tsx +81 -81
- package/src/aldehyde/lowcode-components/text-scroller/index.less +28 -28
- package/src/aldehyde/lowcode-components/text-scroller/index.tsx +173 -173
- package/src/aldehyde/module/ltmpl-table.tsx +14 -15
- package/src/aldehyde/routable/dtmpl-route.tsx +14 -8
- package/src/aldehyde/routable/import-route.tsx +12 -5
- package/src/aldehyde/routable/ltmpl-route.tsx +14 -9
- package/src/aldehyde/routable/splitview-ltmpl-route.tsx +11 -8
- package/src/aldehyde/routable/ttmpl-route.tsx +13 -8
- package/src/aldehyde/table/act-table.tsx +28 -9
- package/src/aldehyde/table/page-chart.tsx +1 -1
- package/src/aldehyde/table/row-table.tsx +29 -6
- package/src/aldehyde/tmpl/interface.tsx +1 -0
- package/src/aldehyde/tree/act-tree.tsx +8 -6
- package/src/aldehyde/tree/tree-utils.tsx +4 -4
- package/src/aldehyde/units/index.tsx +11 -3
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
export interface UpdateOptions {
|
|
2
|
-
reRender: boolean;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 设计器自定义组件控制器的顶级抽象接口,用于控制自定义组件的整个生命周期
|
|
7
|
-
* @param I 组件实例类型,若组件为React的class组件,则I=class的实例化对象。
|
|
8
|
-
* 若组件为React的函数式组件,则I=forwardRef钩子传递出的ref引用(当然你也可以有其他自定义的实现)
|
|
9
|
-
* 若组件为纯Js实现的组件,则I=组件实例化对象(可参考Echarts活G2创建实例后的返回值)
|
|
10
|
-
* @param C 组件配置类型,即组件的完整属性类型
|
|
11
|
-
*/
|
|
12
|
-
abstract class AbstractController<I = any, C = any> {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 组件实例引用
|
|
16
|
-
* @protected
|
|
17
|
-
*/
|
|
18
|
-
protected instance: I | null = null;
|
|
19
|
-
/**
|
|
20
|
-
* 组件配置(包括组件数据)
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
public config: C | null = null;
|
|
24
|
-
/**
|
|
25
|
-
* 组件所处容器的dom元素
|
|
26
|
-
* @protected
|
|
27
|
-
*/
|
|
28
|
-
public container: HTMLElement | null = null;
|
|
29
|
-
|
|
30
|
-
/******************生命周期******************/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 创建组件并将组件挂载到指定的容器中
|
|
34
|
-
* @param container 容器
|
|
35
|
-
* @param config 组件配置
|
|
36
|
-
*/
|
|
37
|
-
public abstract create(container: HTMLElement, config: C): Promise<void>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 更新组件配置,并触发组件重新渲染
|
|
41
|
-
* @param config 组件属性(参数)
|
|
42
|
-
* @param upOp 操作类型
|
|
43
|
-
*/
|
|
44
|
-
public abstract update(config: C, upOp?: UpdateOptions): void;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 销毁组件
|
|
48
|
-
*/
|
|
49
|
-
public destroy(): void {
|
|
50
|
-
this.instance = null;
|
|
51
|
-
this.config = null;
|
|
52
|
-
this.container = null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/******************普通方法******************/
|
|
57
|
-
/**
|
|
58
|
-
* 获取组件配置数据
|
|
59
|
-
*/
|
|
60
|
-
public abstract getConfig(): C | null;
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default AbstractController;
|
|
1
|
+
export interface UpdateOptions {
|
|
2
|
+
reRender: boolean;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 设计器自定义组件控制器的顶级抽象接口,用于控制自定义组件的整个生命周期
|
|
7
|
+
* @param I 组件实例类型,若组件为React的class组件,则I=class的实例化对象。
|
|
8
|
+
* 若组件为React的函数式组件,则I=forwardRef钩子传递出的ref引用(当然你也可以有其他自定义的实现)
|
|
9
|
+
* 若组件为纯Js实现的组件,则I=组件实例化对象(可参考Echarts活G2创建实例后的返回值)
|
|
10
|
+
* @param C 组件配置类型,即组件的完整属性类型
|
|
11
|
+
*/
|
|
12
|
+
abstract class AbstractController<I = any, C = any> {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 组件实例引用
|
|
16
|
+
* @protected
|
|
17
|
+
*/
|
|
18
|
+
protected instance: I | null = null;
|
|
19
|
+
/**
|
|
20
|
+
* 组件配置(包括组件数据)
|
|
21
|
+
* @protected
|
|
22
|
+
*/
|
|
23
|
+
public config: C | null = null;
|
|
24
|
+
/**
|
|
25
|
+
* 组件所处容器的dom元素
|
|
26
|
+
* @protected
|
|
27
|
+
*/
|
|
28
|
+
public container: HTMLElement | null = null;
|
|
29
|
+
|
|
30
|
+
/******************生命周期******************/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 创建组件并将组件挂载到指定的容器中
|
|
34
|
+
* @param container 容器
|
|
35
|
+
* @param config 组件配置
|
|
36
|
+
*/
|
|
37
|
+
public abstract create(container: HTMLElement, config: C): Promise<void>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 更新组件配置,并触发组件重新渲染
|
|
41
|
+
* @param config 组件属性(参数)
|
|
42
|
+
* @param upOp 操作类型
|
|
43
|
+
*/
|
|
44
|
+
public abstract update(config: C, upOp?: UpdateOptions): void;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 销毁组件
|
|
48
|
+
*/
|
|
49
|
+
public destroy(): void {
|
|
50
|
+
this.instance = null;
|
|
51
|
+
this.config = null;
|
|
52
|
+
this.container = null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/******************普通方法******************/
|
|
57
|
+
/**
|
|
58
|
+
* 获取组件配置数据
|
|
59
|
+
*/
|
|
60
|
+
public abstract getConfig(): C | null;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default AbstractController;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import AbstractController from "./abstract-controller";
|
|
2
|
-
import React, { ComponentType } from "react";
|
|
3
|
-
import ComponentController from "./component-controller";
|
|
4
|
-
|
|
5
|
-
export type ClazzTemplate<C> = new () => C | null;
|
|
6
|
-
|
|
7
|
-
export interface ActionInfo {
|
|
8
|
-
name: string;
|
|
9
|
-
id: string;
|
|
10
|
-
handler: (controller: ComponentController, params?: any) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ICategorize {
|
|
14
|
-
key: string;
|
|
15
|
-
name: string;
|
|
16
|
-
icon?: ComponentType;
|
|
17
|
-
parentKey?: string;
|
|
18
|
-
iconType?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 组件基础信息
|
|
23
|
-
*/
|
|
24
|
-
export interface BaseInfoType {
|
|
25
|
-
/**
|
|
26
|
-
* 组件显示名称
|
|
27
|
-
*/
|
|
28
|
-
compName: string;
|
|
29
|
-
/**
|
|
30
|
-
* 组件标识
|
|
31
|
-
*/
|
|
32
|
-
compKey: string;
|
|
33
|
-
/**
|
|
34
|
-
* 主分类
|
|
35
|
-
*/
|
|
36
|
-
categorize?: string;
|
|
37
|
-
/**
|
|
38
|
-
* 子分类
|
|
39
|
-
*/
|
|
40
|
-
subCategorize?: string;
|
|
41
|
-
/**
|
|
42
|
-
* 版本
|
|
43
|
-
*/
|
|
44
|
-
version?: string;
|
|
45
|
-
/**
|
|
46
|
-
* 初始宽度
|
|
47
|
-
*/
|
|
48
|
-
width?: number;
|
|
49
|
-
/**
|
|
50
|
-
* 初始高度
|
|
51
|
-
*/
|
|
52
|
-
height?: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 自动扫描抽象组件定义核心类。
|
|
57
|
-
* 对于所有继承并实现了该抽象类的子类,都会被自动扫描到并注册到设计器中。
|
|
58
|
-
* 因此,所有要接入设计器的react组件都应该按照该类的约定实现其所有的方法。
|
|
59
|
-
*
|
|
60
|
-
* 泛型说明:
|
|
61
|
-
* C: 组件控制器类,用于指定当前组件定义对应的控制器类
|
|
62
|
-
* P: 组件配置类型,用于指定当前组件的配置数据(config属性的类型)
|
|
63
|
-
*/
|
|
64
|
-
export abstract class AbstractDefinition<C extends AbstractController = AbstractController, P = any> {
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* 返回组件基础信息,用于在组件列表中展示
|
|
68
|
-
*/
|
|
69
|
-
abstract getBaseInfo(): BaseInfoType;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 返回React组件Controller控制器的类模板,在画布中创建组件实例时会根据该方法的返回值实例化组件控制器并保存。
|
|
73
|
-
* 后续将通过该控制器的实例对象来控制组件的生命周期
|
|
74
|
-
*/
|
|
75
|
-
abstract getController(): ClazzTemplate<C> | null;
|
|
76
|
-
}
|
|
77
|
-
|
|
1
|
+
import AbstractController from "./abstract-controller";
|
|
2
|
+
import React, { ComponentType } from "react";
|
|
3
|
+
import ComponentController from "./component-controller";
|
|
4
|
+
|
|
5
|
+
export type ClazzTemplate<C> = new () => C | null;
|
|
6
|
+
|
|
7
|
+
export interface ActionInfo {
|
|
8
|
+
name: string;
|
|
9
|
+
id: string;
|
|
10
|
+
handler: (controller: ComponentController, params?: any) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ICategorize {
|
|
14
|
+
key: string;
|
|
15
|
+
name: string;
|
|
16
|
+
icon?: ComponentType;
|
|
17
|
+
parentKey?: string;
|
|
18
|
+
iconType?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 组件基础信息
|
|
23
|
+
*/
|
|
24
|
+
export interface BaseInfoType {
|
|
25
|
+
/**
|
|
26
|
+
* 组件显示名称
|
|
27
|
+
*/
|
|
28
|
+
compName: string;
|
|
29
|
+
/**
|
|
30
|
+
* 组件标识
|
|
31
|
+
*/
|
|
32
|
+
compKey: string;
|
|
33
|
+
/**
|
|
34
|
+
* 主分类
|
|
35
|
+
*/
|
|
36
|
+
categorize?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 子分类
|
|
39
|
+
*/
|
|
40
|
+
subCategorize?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 版本
|
|
43
|
+
*/
|
|
44
|
+
version?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 初始宽度
|
|
47
|
+
*/
|
|
48
|
+
width?: number;
|
|
49
|
+
/**
|
|
50
|
+
* 初始高度
|
|
51
|
+
*/
|
|
52
|
+
height?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 自动扫描抽象组件定义核心类。
|
|
57
|
+
* 对于所有继承并实现了该抽象类的子类,都会被自动扫描到并注册到设计器中。
|
|
58
|
+
* 因此,所有要接入设计器的react组件都应该按照该类的约定实现其所有的方法。
|
|
59
|
+
*
|
|
60
|
+
* 泛型说明:
|
|
61
|
+
* C: 组件控制器类,用于指定当前组件定义对应的控制器类
|
|
62
|
+
* P: 组件配置类型,用于指定当前组件的配置数据(config属性的类型)
|
|
63
|
+
*/
|
|
64
|
+
export abstract class AbstractDefinition<C extends AbstractController = AbstractController, P = any> {
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 返回组件基础信息,用于在组件列表中展示
|
|
68
|
+
*/
|
|
69
|
+
abstract getBaseInfo(): BaseInfoType;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 返回React组件Controller控制器的类模板,在画布中创建组件实例时会根据该方法的返回值实例化组件控制器并保存。
|
|
73
|
+
* 后续将通过该控制器的实例对象来控制组件的生命周期
|
|
74
|
+
*/
|
|
75
|
+
abstract getController(): ClazzTemplate<C> | null;
|
|
76
|
+
}
|
|
77
|
+
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { AbstractDefinition } from "./abstract-definition";
|
|
2
|
-
import { compsConfig } from "./assets";
|
|
3
|
-
import ComponentDefinition from "./component-definition";
|
|
4
|
-
import GroupDefinition from "./group-layer/definition";
|
|
5
|
-
|
|
6
|
-
class AbstractDesignerLoader {
|
|
7
|
-
|
|
8
|
-
//自定义组件信息映射
|
|
9
|
-
public definitionMap: Record<string, AbstractDefinition> = {};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 加载设计器
|
|
13
|
-
*/
|
|
14
|
-
public load(): void {
|
|
15
|
-
//扫描组件
|
|
16
|
-
this.scanComponents();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 组件挂载
|
|
21
|
-
*/
|
|
22
|
-
protected scanComponents(): void {
|
|
23
|
-
Object.keys(compsConfig || {}).forEach((key) => {
|
|
24
|
-
const definition: AbstractDefinition = new ComponentDefinition({ componentType: key, componentNode: compsConfig[key].componentNode });
|
|
25
|
-
const compKey = definition.getBaseInfo()?.compKey;
|
|
26
|
-
if (compKey) {
|
|
27
|
-
this.definitionMap[compKey] = definition;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
// 编组组件信息挂载
|
|
31
|
-
this.definitionMap["group"] = new GroupDefinition();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const abstractDesignerLoader = new AbstractDesignerLoader();
|
|
1
|
+
import { AbstractDefinition } from "./abstract-definition";
|
|
2
|
+
import { compsConfig } from "./assets";
|
|
3
|
+
import ComponentDefinition from "./component-definition";
|
|
4
|
+
import GroupDefinition from "./group-layer/definition";
|
|
5
|
+
|
|
6
|
+
class AbstractDesignerLoader {
|
|
7
|
+
|
|
8
|
+
//自定义组件信息映射
|
|
9
|
+
public definitionMap: Record<string, AbstractDefinition> = {};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 加载设计器
|
|
13
|
+
*/
|
|
14
|
+
public load(): void {
|
|
15
|
+
//扫描组件
|
|
16
|
+
this.scanComponents();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 组件挂载
|
|
21
|
+
*/
|
|
22
|
+
protected scanComponents(): void {
|
|
23
|
+
Object.keys(compsConfig || {}).forEach((key) => {
|
|
24
|
+
const definition: AbstractDefinition = new ComponentDefinition({ componentType: key, componentNode: compsConfig[key].componentNode });
|
|
25
|
+
const compKey = definition.getBaseInfo()?.compKey;
|
|
26
|
+
if (compKey) {
|
|
27
|
+
this.definitionMap[compKey] = definition;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
// 编组组件信息挂载
|
|
31
|
+
this.definitionMap["group"] = new GroupDefinition();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const abstractDesignerLoader = new AbstractDesignerLoader();
|
|
37
37
|
export default abstractDesignerLoader;
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import React, { memo, Suspense, useEffect, useRef, useState, useContext } from "react";
|
|
2
|
-
import Loading from "./loading";
|
|
3
|
-
import { ILayerItem, LayerManagerDataType } from "../interface";
|
|
4
|
-
import ComponentController from "./component-controller";
|
|
5
|
-
import abstractDesignerLoader from "./abstract-designer-loader";
|
|
6
|
-
import { useNavigate } from "react-router-dom";
|
|
7
|
-
import { ControllerContext } from "../index";
|
|
8
|
-
|
|
9
|
-
const registerProxy = (compId: string, controller: ComponentController) => {
|
|
10
|
-
controller.changeData = new Proxy(controller.changeData, {
|
|
11
|
-
apply(target, thisArg, argus) {
|
|
12
|
-
return target.apply(thisArg, argus as any);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ComponentContainerProps {
|
|
18
|
-
layer: ILayerItem;
|
|
19
|
-
layerManager: LayerManagerDataType;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
23
|
-
const { layer, layerManager } = props;
|
|
24
|
-
const ref = useRef(null);
|
|
25
|
-
const [compController, setCompController] = useState<{ [key: string]: ComponentController }>({});
|
|
26
|
-
const navigate = useNavigate();
|
|
27
|
-
const { setControllers, setSearchParams } = useContext(ControllerContext);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
//通过ref创建组件,并将组件实例存入Map中。后续通过Map匹配到具体实例,调用实例的对象方法进行组件的更新操作
|
|
31
|
-
const { elemConfigs } = layerManager;
|
|
32
|
-
const componentDefine = abstractDesignerLoader.definitionMap[layer.type];
|
|
33
|
-
const Controller = componentDefine?.getController() as any;
|
|
34
|
-
if (Controller) {
|
|
35
|
-
let config;
|
|
36
|
-
if (layer.id! in compController!) {
|
|
37
|
-
//重新编组后,被编组组件会重新渲染,需从之前的实例中获取原有数据
|
|
38
|
-
config = compController![layer.id!].getConfig();
|
|
39
|
-
} else if (layer.id! in elemConfigs!) {
|
|
40
|
-
config = elemConfigs![layer.id!];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 此处注意,执行顺序尤为重要!!!
|
|
44
|
-
* 第一步:动态代理绑定在前,
|
|
45
|
-
* 第二步:赋值controller在后,
|
|
46
|
-
* 第三步:最后才是执行create方法。
|
|
47
|
-
*/
|
|
48
|
-
//todo 此处逻辑应该使用设计模式优化,而非写死
|
|
49
|
-
registerProxy(layer.id!, Controller);
|
|
50
|
-
setCompController(val => ({ ...val, [layer.id]: Controller }));
|
|
51
|
-
Controller.create(ref.current!, { ...config, navigate, setSearchParams }).then(() => {
|
|
52
|
-
//设置组件滤镜效果(todo 考虑是否应该在此处设置?)
|
|
53
|
-
Controller.updateFilter(Controller.getConfig()?.filter);
|
|
54
|
-
//存储Controller,用于后续操作(初始化更新数据)
|
|
55
|
-
setControllers(val => ({ ...val, [layer.id]: Controller }));
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return () => {
|
|
59
|
-
Controller.destroy();
|
|
60
|
-
setControllers(val => ({ ...val, [layer.id]: null }));
|
|
61
|
-
}
|
|
62
|
-
}, []);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Suspense fallback={<Loading />}>
|
|
66
|
-
<div
|
|
67
|
-
id={layer.id}
|
|
68
|
-
data-type={layer.type}
|
|
69
|
-
data-lock={layer.lock}
|
|
70
|
-
data-hide={layer.hide}
|
|
71
|
-
key={layer.id + ''}
|
|
72
|
-
style={{
|
|
73
|
-
width: layer.width,
|
|
74
|
-
height: layer.height,
|
|
75
|
-
transform: layer.transform || `translate(${layer.x!}px, ${layer.y!}px)`,
|
|
76
|
-
position: 'absolute',
|
|
77
|
-
visibility: layer.hide ? "hidden" : "visible",
|
|
78
|
-
border: 'none'
|
|
79
|
-
}} className={"lc-comp-item"}>
|
|
80
|
-
<div ref={ref} style={{
|
|
81
|
-
width: '100%',
|
|
82
|
-
height: '100%',
|
|
83
|
-
pointerEvents: 'auto',
|
|
84
|
-
position: 'relative'
|
|
85
|
-
}} />
|
|
86
|
-
</div>
|
|
87
|
-
</Suspense>
|
|
88
|
-
)
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
import React, { memo, Suspense, useEffect, useRef, useState, useContext } from "react";
|
|
2
|
+
import Loading from "./loading";
|
|
3
|
+
import { ILayerItem, LayerManagerDataType } from "../interface";
|
|
4
|
+
import ComponentController from "./component-controller";
|
|
5
|
+
import abstractDesignerLoader from "./abstract-designer-loader";
|
|
6
|
+
import { useNavigate } from "react-router-dom";
|
|
7
|
+
import { ControllerContext } from "../index";
|
|
8
|
+
|
|
9
|
+
const registerProxy = (compId: string, controller: ComponentController) => {
|
|
10
|
+
controller.changeData = new Proxy(controller.changeData, {
|
|
11
|
+
apply(target, thisArg, argus) {
|
|
12
|
+
return target.apply(thisArg, argus as any);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ComponentContainerProps {
|
|
18
|
+
layer: ILayerItem;
|
|
19
|
+
layerManager: LayerManagerDataType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
23
|
+
const { layer, layerManager } = props;
|
|
24
|
+
const ref = useRef(null);
|
|
25
|
+
const [compController, setCompController] = useState<{ [key: string]: ComponentController }>({});
|
|
26
|
+
const navigate = useNavigate();
|
|
27
|
+
const { setControllers, setSearchParams } = useContext(ControllerContext);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
//通过ref创建组件,并将组件实例存入Map中。后续通过Map匹配到具体实例,调用实例的对象方法进行组件的更新操作
|
|
31
|
+
const { elemConfigs } = layerManager;
|
|
32
|
+
const componentDefine = abstractDesignerLoader.definitionMap[layer.type];
|
|
33
|
+
const Controller = componentDefine?.getController() as any;
|
|
34
|
+
if (Controller) {
|
|
35
|
+
let config;
|
|
36
|
+
if (layer.id! in compController!) {
|
|
37
|
+
//重新编组后,被编组组件会重新渲染,需从之前的实例中获取原有数据
|
|
38
|
+
config = compController![layer.id!].getConfig();
|
|
39
|
+
} else if (layer.id! in elemConfigs!) {
|
|
40
|
+
config = elemConfigs![layer.id!];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 此处注意,执行顺序尤为重要!!!
|
|
44
|
+
* 第一步:动态代理绑定在前,
|
|
45
|
+
* 第二步:赋值controller在后,
|
|
46
|
+
* 第三步:最后才是执行create方法。
|
|
47
|
+
*/
|
|
48
|
+
//todo 此处逻辑应该使用设计模式优化,而非写死
|
|
49
|
+
registerProxy(layer.id!, Controller);
|
|
50
|
+
setCompController(val => ({ ...val, [layer.id]: Controller }));
|
|
51
|
+
Controller.create(ref.current!, { ...config, navigate, setSearchParams }).then(() => {
|
|
52
|
+
//设置组件滤镜效果(todo 考虑是否应该在此处设置?)
|
|
53
|
+
Controller.updateFilter(Controller.getConfig()?.filter);
|
|
54
|
+
//存储Controller,用于后续操作(初始化更新数据)
|
|
55
|
+
setControllers(val => ({ ...val, [layer.id]: Controller }));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return () => {
|
|
59
|
+
Controller.destroy();
|
|
60
|
+
setControllers(val => ({ ...val, [layer.id]: null }));
|
|
61
|
+
}
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Suspense fallback={<Loading />}>
|
|
66
|
+
<div
|
|
67
|
+
id={layer.id}
|
|
68
|
+
data-type={layer.type}
|
|
69
|
+
data-lock={layer.lock}
|
|
70
|
+
data-hide={layer.hide}
|
|
71
|
+
key={layer.id + ''}
|
|
72
|
+
style={{
|
|
73
|
+
width: layer.width,
|
|
74
|
+
height: layer.height,
|
|
75
|
+
transform: layer.transform || `translate(${layer.x!}px, ${layer.y!}px)`,
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
visibility: layer.hide ? "hidden" : "visible",
|
|
78
|
+
border: 'none'
|
|
79
|
+
}} className={"lc-comp-item"}>
|
|
80
|
+
<div ref={ref} style={{
|
|
81
|
+
width: '100%',
|
|
82
|
+
height: '100%',
|
|
83
|
+
pointerEvents: 'auto',
|
|
84
|
+
position: 'relative'
|
|
85
|
+
}} />
|
|
86
|
+
</div>
|
|
87
|
+
</Suspense>
|
|
88
|
+
)
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
|
|
92
92
|
export default ComponentContainer;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: "DingTalk JinBuTi";
|
|
3
|
-
src: url('./DingTalk-JinBuTi.woff2');
|
|
4
|
-
font-weight: normal;
|
|
5
|
-
font-style: normal;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@font-face {
|
|
9
|
-
font-family: "DouyinSansBold";
|
|
10
|
-
src: url('./DouyinSansBold.woff');
|
|
11
|
-
font-weight: normal;
|
|
12
|
-
font-style: normal;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@font-face {
|
|
16
|
-
font-family: "优设标题黑";
|
|
17
|
-
src: url('./YouSheBiaoTiHei.woff2');
|
|
18
|
-
font-weight: normal;
|
|
19
|
-
font-style: normal;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@font-face {
|
|
23
|
-
font-family: "庞门正道标题体免费版";
|
|
24
|
-
src: url('./PangMenZhengDaoBiaoTiTiMianFeiBan.woff2');
|
|
25
|
-
font-weight: normal;
|
|
26
|
-
font-style: normal;
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "DingTalk JinBuTi";
|
|
3
|
+
src: url('./DingTalk-JinBuTi.woff2');
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: "DouyinSansBold";
|
|
10
|
+
src: url('./DouyinSansBold.woff');
|
|
11
|
+
font-weight: normal;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: "优设标题黑";
|
|
17
|
+
src: url('./YouSheBiaoTiHei.woff2');
|
|
18
|
+
font-weight: normal;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@font-face {
|
|
23
|
+
font-family: "庞门正道标题体免费版";
|
|
24
|
+
src: url('./PangMenZhengDaoBiaoTiTiMianFeiBan.woff2');
|
|
25
|
+
font-weight: normal;
|
|
26
|
+
font-style: normal;
|
|
27
27
|
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { ComponentInfoType } from "../../interface";
|
|
2
|
-
import GroupLayer from "./index";
|
|
3
|
-
import AbstractDesignerController from "../abstract-controller";
|
|
4
|
-
|
|
5
|
-
export interface GroupLayerProps {
|
|
6
|
-
base: ComponentInfoType;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default class GroupLayerController extends AbstractDesignerController<GroupLayer, GroupLayerProps> {
|
|
10
|
-
|
|
11
|
-
constructor(container: HTMLElement, config: GroupLayerProps, instance: GroupLayer) {
|
|
12
|
-
super();
|
|
13
|
-
this.container = container;
|
|
14
|
-
this.config = config;
|
|
15
|
-
this.instance = instance;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async create(container: HTMLElement, config: GroupLayerProps): Promise<void> {
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public getConfig(): GroupLayerProps | null {
|
|
22
|
-
return this.config;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public update(): void {
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public show(): void {
|
|
29
|
-
this.instance?.setState({ load: true })
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public hide(): void {
|
|
33
|
-
this.instance?.setState({ load: false })
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import { ComponentInfoType } from "../../interface";
|
|
2
|
+
import GroupLayer from "./index";
|
|
3
|
+
import AbstractDesignerController from "../abstract-controller";
|
|
4
|
+
|
|
5
|
+
export interface GroupLayerProps {
|
|
6
|
+
base: ComponentInfoType;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default class GroupLayerController extends AbstractDesignerController<GroupLayer, GroupLayerProps> {
|
|
10
|
+
|
|
11
|
+
constructor(container: HTMLElement, config: GroupLayerProps, instance: GroupLayer) {
|
|
12
|
+
super();
|
|
13
|
+
this.container = container;
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.instance = instance;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async create(container: HTMLElement, config: GroupLayerProps): Promise<void> {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public getConfig(): GroupLayerProps | null {
|
|
22
|
+
return this.config;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public update(): void {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public show(): void {
|
|
29
|
+
this.instance?.setState({ load: true })
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public hide(): void {
|
|
33
|
+
this.instance?.setState({ load: false })
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
37
|
}
|