@cicctencent/low-code-simulate-base 0.0.0-stage → 1.1.9-beta.5
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/README.md +1 -3
- package/__tests__/plugin.spec.ts +40 -0
- package/__tests__/utils.transform.test.ts +37 -0
- package/api-extractor.json +36 -0
- package/build/md.js +25 -0
- package/dist/VCComponent.d.ts +5 -0
- package/dist/VCComponent.js +91 -0
- package/dist/domain/BaseProjectDomain.d.ts +349 -0
- package/dist/domain/BaseProjectDomain.js +1305 -0
- package/dist/domain/ComponentManager.d.ts +78 -0
- package/dist/domain/ComponentManager.js +293 -0
- package/dist/domain/DataHistoryDomain.d.ts +53 -0
- package/dist/domain/DataHistoryDomain.js +110 -0
- package/dist/domain/PreviewDomain.d.ts +208 -0
- package/dist/domain/PreviewDomain.js +492 -0
- package/dist/domain/ProjectDomain.d.ts +209 -0
- package/dist/domain/ProjectDomain.js +138 -0
- package/dist/event/generateEventHandler.d.ts +21 -0
- package/dist/event/generateEventHandler.js +218 -0
- package/dist/event/generateEventSchema.d.ts +123 -0
- package/dist/event/generateEventSchema.js +342 -0
- package/dist/event/register.d.ts +56 -0
- package/dist/event/register.js +207 -0
- package/dist/index.d.ts +1330 -0
- package/dist/index.js +28 -0
- package/dist/plugin/onH5PageValidate.d.ts +7 -0
- package/dist/plugin/onH5PageValidate.js +178 -0
- package/dist/plugin/onPlaceholder.d.ts +6 -0
- package/dist/plugin/onPlaceholder.js +68 -0
- package/dist/plugin/subscribeInsertUploadList.d.ts +6 -0
- package/dist/plugin/subscribeInsertUploadList.js +49 -0
- package/dist/plugin/subscribeSetTitle.d.ts +6 -0
- package/dist/plugin/subscribeSetTitle.js +16 -0
- package/dist/plugin/subscribeTransformComponentMeta.d.ts +14 -0
- package/dist/plugin/subscribeTransformComponentMeta.js +31 -0
- package/dist/plugin/subscribeValidateField.d.ts +7 -0
- package/dist/plugin/subscribeValidateField.js +57 -0
- package/dist/plugin/subscribeValidateUpload.d.ts +6 -0
- package/dist/plugin/subscribeValidateUpload.js +92 -0
- package/dist/utils/base64.d.ts +14 -0
- package/dist/utils/base64.js +14 -0
- package/dist/utils/buildInVariable.d.ts +61 -0
- package/dist/utils/buildInVariable.js +216 -0
- package/dist/utils/dom.d.ts +14 -0
- package/dist/utils/dom.js +19 -0
- package/dist/utils/index.d.ts +55 -0
- package/dist/utils/index.js +201 -0
- package/dist/utils/transform.d.ts +39 -0
- package/dist/utils/transform.js +191 -0
- package/dist/utils/validate.d.ts +7 -0
- package/dist/utils/validate.js +18 -0
- package/docs/.api/low-code-simulate-base.api.json +8450 -0
- package/jest.config.ts +20 -0
- package/package.json +44 -4
- package/src/VCComponent.ts +118 -0
- package/src/domain/BaseProjectDomain.ts +1341 -0
- package/src/domain/ComponentManager.ts +241 -0
- package/src/domain/DataHistoryDomain.ts +102 -0
- package/src/domain/PreviewDomain.ts +424 -0
- package/src/domain/ProjectDomain.ts +244 -0
- package/src/event/generateEventHandler.ts +162 -0
- package/src/event/generateEventSchema.ts +371 -0
- package/src/event/register.ts +181 -0
- package/src/index.ts +61 -0
- package/src/plugin/onH5PageValidate.ts +179 -0
- package/src/plugin/onPlaceholder.ts +71 -0
- package/src/plugin/subscribeInsertUploadList.ts +51 -0
- package/src/plugin/subscribeSetTitle.ts +18 -0
- package/src/plugin/subscribeTransformComponentMeta.ts +38 -0
- package/src/plugin/subscribeValidateField.ts +65 -0
- package/src/plugin/subscribeValidateUpload.ts +116 -0
- package/src/utils/base64.ts +17 -0
- package/src/utils/buildInVariable.ts +157 -0
- package/src/utils/dom.ts +30 -0
- package/src/utils/index.ts +194 -0
- package/src/utils/transform.ts +171 -0
- package/src/utils/validate.ts +19 -0
- package/temp/low-code-simulate-base.api.md +597 -0
- package/test/plugin.test.ts +4 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +9 -0
- package/tsconfig.test.json +14 -0
package/README.md
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { findComponentById } from '../src/plugin/onH5PageValidate';
|
|
2
|
+
test('plugin/onH5PageValidate', () => {
|
|
3
|
+
const case1 = findComponentById([{ componentId: 1, title: '组件1' }], 1);
|
|
4
|
+
expect(case1).toEqual({ componentId: 1, title: '组件1' });
|
|
5
|
+
const case2 = findComponentById(
|
|
6
|
+
[
|
|
7
|
+
{ componentId: 1, title: '组件1' },
|
|
8
|
+
{
|
|
9
|
+
componentId: 2,
|
|
10
|
+
title: '分组1',
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
componentId: 3,
|
|
14
|
+
title: '组件2',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
componentId: 4,
|
|
18
|
+
title: '组件2',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
componentId: 5,
|
|
24
|
+
title: '分组2',
|
|
25
|
+
children: [
|
|
26
|
+
{
|
|
27
|
+
componentId: 6,
|
|
28
|
+
title: '组件3',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
componentId: 7,
|
|
32
|
+
title: '组件4',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
6
|
|
38
|
+
);
|
|
39
|
+
expect(case2).toEqual({ componentId: 6, title: '组件3' });
|
|
40
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getObjectPath } from '../src/utils/transform';
|
|
2
|
+
|
|
3
|
+
describe('getObjectPath', () => {
|
|
4
|
+
|
|
5
|
+
it('should handle basic objects', () => {
|
|
6
|
+
const obj = { a: 1, b: 2 };
|
|
7
|
+
const result = getObjectPath(obj);
|
|
8
|
+
expect(result).toEqual(['a', 'b']);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should handle nested objects', () => {
|
|
12
|
+
const obj = { a: { b: { c: 3 } } };
|
|
13
|
+
const result = getObjectPath(obj);
|
|
14
|
+
expect(result).toEqual(['a', 'a.b', 'a.b.c']);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should handle arrays', () => {
|
|
18
|
+
const obj = { a: [1, 2, 3] };
|
|
19
|
+
const result = getObjectPath(obj);
|
|
20
|
+
expect(result).toEqual(['a', 'a.0', 'a.1', 'a.2']);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should handle circular references', () => {
|
|
24
|
+
const obj = {} as any;
|
|
25
|
+
obj.self = obj;
|
|
26
|
+
const result = getObjectPath(obj);
|
|
27
|
+
expect(result).toEqual(['self']);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should handle non-object inputs', () => {
|
|
31
|
+
expect(getObjectPath(null)).toEqual([]);
|
|
32
|
+
expect(getObjectPath(123)).toEqual([]);
|
|
33
|
+
expect(getObjectPath('string')).toEqual([]);
|
|
34
|
+
expect(getObjectPath(undefined)).toEqual([]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"projectFolder": "./",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
|
|
5
|
+
"apiReport": {
|
|
6
|
+
"enabled": false
|
|
7
|
+
},
|
|
8
|
+
"docModel": {
|
|
9
|
+
"enabled": true,
|
|
10
|
+
"apiJsonFilePath": "./docs/.api/<unscopedPackageName>.api.json"
|
|
11
|
+
},
|
|
12
|
+
"dtsRollup": {
|
|
13
|
+
"enabled": false
|
|
14
|
+
},
|
|
15
|
+
"tsdocMetadata": {},
|
|
16
|
+
"messages": {
|
|
17
|
+
"compilerMessageReporting": {
|
|
18
|
+
"default": {
|
|
19
|
+
"logLevel": "warning"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"extractorMessageReporting": {
|
|
23
|
+
"default": {
|
|
24
|
+
"logLevel": "warning"
|
|
25
|
+
},
|
|
26
|
+
"ae-internal-missing-underscore": {
|
|
27
|
+
"logLevel": "none"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"tsdocMessageReporting": {
|
|
31
|
+
"default": {
|
|
32
|
+
"logLevel": "warning"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/build/md.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 避免vitepress构建报错,转换部分字符
|
|
6
|
+
* @param {*} dir
|
|
7
|
+
*/
|
|
8
|
+
function traverseDir(dir) {
|
|
9
|
+
fs.readdirSync(dir).forEach(file => {
|
|
10
|
+
const pathname = path.join(dir, file);
|
|
11
|
+
const stat = fs.statSync(pathname);
|
|
12
|
+
if (stat.isDirectory()) {
|
|
13
|
+
traverseDir(pathname);
|
|
14
|
+
} else if (stat.isFile() && path.extname(pathname) === '.md') {
|
|
15
|
+
let content = fs.readFileSync(pathname, 'utf-8');
|
|
16
|
+
content = content
|
|
17
|
+
.replace('Entity<T> EventEmitter', 'Entity\\<T\\> EventEmitter')
|
|
18
|
+
.replace(/[\{\}\<\>]/g, $0 => `\\${$0}`);
|
|
19
|
+
|
|
20
|
+
fs.writeFileSync(pathname, content, 'utf-8');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
traverseDir(path.resolve(__dirname, '../docs/api'));
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { h, getCurrentInstance, isVue3 } from 'vue-demi';
|
|
13
|
+
import * as Vue from 'vue-demi';
|
|
14
|
+
import { camelize } from '@jt/ark-util';
|
|
15
|
+
import { generateEventHandlers } from './event/generateEventHandler';
|
|
16
|
+
function renderVue3(item) {
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
var that = getCurrentInstance();
|
|
19
|
+
var name = item.name, componentId = item.componentId, _a = item.formData, style = _a.style, props = _a.props, _b = _a.event, event = _b === void 0 ? { list: [] } : _b;
|
|
20
|
+
var component;
|
|
21
|
+
if (isVue3) {
|
|
22
|
+
component = Vue.resolveComponent(name);
|
|
23
|
+
}
|
|
24
|
+
var _c = generateEventHandlers(
|
|
25
|
+
// this.$children[0],
|
|
26
|
+
that, event.list || []), on = _c.on, nativeOn = _c.nativeOn;
|
|
27
|
+
var eventObj = __assign(__assign({}, on), nativeOn);
|
|
28
|
+
var onEvent = {};
|
|
29
|
+
// 处理和过滤事件
|
|
30
|
+
Object.keys(eventObj).forEach(function (eventType) {
|
|
31
|
+
// 如果有生命周期的事件 不直接添加到组件上
|
|
32
|
+
if (['mounted'].includes(eventType))
|
|
33
|
+
return;
|
|
34
|
+
var eventKey = camelize("on-".concat(eventType));
|
|
35
|
+
onEvent[eventKey] = eventObj[eventType];
|
|
36
|
+
});
|
|
37
|
+
return h(component, __assign(__assign(__assign({ componentId: componentId }, props), { style: style, key: "".concat(name, "-").concat(componentId) }), onEvent), __assign({}, that.slots));
|
|
38
|
+
}
|
|
39
|
+
function renderVue2(item, c, thisArg) {
|
|
40
|
+
//@ts-ignore
|
|
41
|
+
var name = item.name, componentId = item.componentId, _a = item.formData, style = _a.style, props = _a.props, _b = _a.event, event = _b === void 0 ? { list: [] } : _b;
|
|
42
|
+
var _c = generateEventHandlers(
|
|
43
|
+
// this.$children[0],
|
|
44
|
+
thisArg, event.list || []), on = _c.on, nativeOn = _c.nativeOn;
|
|
45
|
+
// 获取所有的插槽(包括具名插槽和默认插槽)
|
|
46
|
+
var slots = __assign(__assign({}, thisArg.$slots), thisArg.$scopedSlots);
|
|
47
|
+
// 将插槽转换为函数对象
|
|
48
|
+
var scopedSlots = Object.keys(slots).reduce(function (acc, key) {
|
|
49
|
+
acc[key] = function (props) { return slots[key](props); };
|
|
50
|
+
return acc;
|
|
51
|
+
}, {});
|
|
52
|
+
return c(name, {
|
|
53
|
+
key: "".concat(name, "-").concat(componentId),
|
|
54
|
+
props: __assign({ componentId: componentId }, props),
|
|
55
|
+
style: style,
|
|
56
|
+
on: on,
|
|
57
|
+
nativeOn: nativeOn,
|
|
58
|
+
scopedSlots: scopedSlots
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export var VcComponent = {
|
|
65
|
+
name: 'VCComponent',
|
|
66
|
+
props: {
|
|
67
|
+
componentDescriptor: Object,
|
|
68
|
+
},
|
|
69
|
+
computed: {
|
|
70
|
+
eventObj: function () {
|
|
71
|
+
var _a = this.componentDescriptor.formData.event, event = _a === void 0 ? { list: [] } : _a;
|
|
72
|
+
var _b = generateEventHandlers(this, event.list || []), on = _b.on, nativeOn = _b.nativeOn;
|
|
73
|
+
return __assign(__assign({}, on), nativeOn);
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
mounted: function () {
|
|
77
|
+
if (Object.keys(this.eventObj).includes('mounted')) {
|
|
78
|
+
this.eventObj['mounted']();
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
render: function (c) {
|
|
82
|
+
var that = this;
|
|
83
|
+
return isVue3
|
|
84
|
+
? renderVue3(that.componentDescriptor)
|
|
85
|
+
: renderVue2(that.componentDescriptor, c, that);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
VcComponent.install = function (app) {
|
|
89
|
+
app.component('VcComponent', VcComponent);
|
|
90
|
+
};
|
|
91
|
+
export default VcComponent;
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import type { NavTreeData, SchemaData, Component, ComponentTreeData, ComponentItem, MenuData, Project, GroupTree, LowCodeKey, ProjectData, FunctionData, FunctionConfig, EditorConfig } from '@jt/low-code-core';
|
|
2
|
+
import ComponentManager from './ComponentManager';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface ProjectDomainState {
|
|
7
|
+
basePath?: string;
|
|
8
|
+
project: Project;
|
|
9
|
+
pageConfig: Record<string, any>;
|
|
10
|
+
componentConfigs: Component[];
|
|
11
|
+
groupConfig: GroupTree[];
|
|
12
|
+
functionConfig: FunctionConfig;
|
|
13
|
+
}
|
|
14
|
+
import ProjectDomain from '../domain/ProjectDomain';
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export default class BaseProjectDomain extends ProjectDomain {
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
* 获取配置
|
|
22
|
+
*/
|
|
23
|
+
get config(): EditorConfig;
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
staticPath: string;
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
currentPageIndex: number;
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
currentComponentPath: string;
|
|
36
|
+
/**
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
cManager: ComponentManager;
|
|
40
|
+
/**
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
get basePath(): string;
|
|
44
|
+
/**
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
constructor(state: ProjectDomainState);
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
private Id2ComponentPathMap;
|
|
52
|
+
/**
|
|
53
|
+
* 根据id在pages中找到组件 生成componentPath
|
|
54
|
+
* @param id - 组件ID
|
|
55
|
+
* @returns 组件路径
|
|
56
|
+
* @example
|
|
57
|
+
* const pages = [{components:[{list:[{componentId:1}]}]}];
|
|
58
|
+
* const componentId = 1;
|
|
59
|
+
* generateComponentPath(componentId)
|
|
60
|
+
* // => 0.components.0.list.0
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
generateComponentPath(id: number, pageIndex?: number): string;
|
|
66
|
+
/**
|
|
67
|
+
* @public
|
|
68
|
+
* 获取父组件数据
|
|
69
|
+
* @param childPath - 子组件路径
|
|
70
|
+
* @returns 父组件数据
|
|
71
|
+
*/
|
|
72
|
+
getParent(childPath?: string): number | null;
|
|
73
|
+
/**
|
|
74
|
+
* @public
|
|
75
|
+
* 更新数据
|
|
76
|
+
* @param oldProject - 旧Project
|
|
77
|
+
* @returns true 新增记录 false 更新记录
|
|
78
|
+
*/
|
|
79
|
+
needUpdateHistory(oldProject: any): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* @public
|
|
82
|
+
* 根据组件路径获取组件位置、组件所在列表路径、组件父组件路径以及组件数据
|
|
83
|
+
* @param path - 组件路径
|
|
84
|
+
* @returns
|
|
85
|
+
* @example
|
|
86
|
+
*/
|
|
87
|
+
getIndexByKey(path: string): {
|
|
88
|
+
index: number;
|
|
89
|
+
pageIndex: number;
|
|
90
|
+
componentListPath: string;
|
|
91
|
+
parentComponentPath: string;
|
|
92
|
+
component: ComponentItem;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @public
|
|
96
|
+
* 判断是否符合插入容器组件的条件
|
|
97
|
+
* @param child - 子容器组件配置
|
|
98
|
+
* @param container - 容器组件数据
|
|
99
|
+
* @returns
|
|
100
|
+
* @example
|
|
101
|
+
*/
|
|
102
|
+
canInsertContainer(child: Component, container: ComponentItem): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
* @param name - 组件名
|
|
106
|
+
* @param data - 数据
|
|
107
|
+
*/
|
|
108
|
+
action(name: string, data: any): void;
|
|
109
|
+
/**
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
get title(): string;
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
get isNoLogin(): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
get pages(): ProjectData;
|
|
121
|
+
/**
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
get components(): ComponentItem[];
|
|
125
|
+
/**
|
|
126
|
+
* @public
|
|
127
|
+
* 含包含config的数据
|
|
128
|
+
*/
|
|
129
|
+
get componentsWithConfig(): any[];
|
|
130
|
+
/**
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
get pageMeta(): {
|
|
134
|
+
props?: Record<string, any>;
|
|
135
|
+
style?: Record<string, any>;
|
|
136
|
+
plugin?: Record<string, any>;
|
|
137
|
+
event?: Record<string, any>;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
get currentComponent(): any;
|
|
143
|
+
/**
|
|
144
|
+
* @public
|
|
145
|
+
* 获取导航树数据
|
|
146
|
+
*/
|
|
147
|
+
get navTreeData(): NavTreeData[];
|
|
148
|
+
/**
|
|
149
|
+
* @public
|
|
150
|
+
* 获取当前配置表单数据
|
|
151
|
+
*/
|
|
152
|
+
get schemaData(): SchemaData;
|
|
153
|
+
/**
|
|
154
|
+
* @public
|
|
155
|
+
* 获取组件树数据
|
|
156
|
+
*/
|
|
157
|
+
get componentTreeData(): ComponentTreeData;
|
|
158
|
+
/**
|
|
159
|
+
* @public
|
|
160
|
+
* 获取右键菜单数据 没有考虑有容器组件的情况
|
|
161
|
+
*/
|
|
162
|
+
get menuData(): MenuData;
|
|
163
|
+
/**
|
|
164
|
+
* @public
|
|
165
|
+
* 生成占位词对应的真实数据
|
|
166
|
+
* @param index - 校验时需要传入的组件位置
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
getComponentSelectors(index?: number): {
|
|
170
|
+
label: string;
|
|
171
|
+
value: string;
|
|
172
|
+
}[];
|
|
173
|
+
/**
|
|
174
|
+
* @public
|
|
175
|
+
* 当前组件之后的选择器选项(不包括当前组件)
|
|
176
|
+
* @param index - 下标
|
|
177
|
+
* @returns
|
|
178
|
+
*/
|
|
179
|
+
getAfterComponentSelectors(index?: number): {
|
|
180
|
+
label: string;
|
|
181
|
+
value: string;
|
|
182
|
+
}[];
|
|
183
|
+
/**
|
|
184
|
+
* @public
|
|
185
|
+
* 占位词映射表
|
|
186
|
+
* @param index - 下标
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
getFlagWordMap(index?: number): {
|
|
190
|
+
$componentSelectors: {
|
|
191
|
+
label: string;
|
|
192
|
+
value: string;
|
|
193
|
+
}[];
|
|
194
|
+
$afterComponentSelectors: {
|
|
195
|
+
label: string;
|
|
196
|
+
value: string;
|
|
197
|
+
}[];
|
|
198
|
+
$componentId: any;
|
|
199
|
+
$componentName: any;
|
|
200
|
+
$components: ComponentItem[];
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* @public
|
|
204
|
+
* 激活导航树
|
|
205
|
+
* @param key - 组件LowCodeKey
|
|
206
|
+
*/
|
|
207
|
+
activate(key: LowCodeKey): void;
|
|
208
|
+
/**
|
|
209
|
+
* @public
|
|
210
|
+
* 生成编辑器删除操作二次确认弹出框所需的数据
|
|
211
|
+
* @param key - 组件LowCodeKey
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
214
|
+
componentDeleteWithConfirm(key: LowCodeKey): void;
|
|
215
|
+
/**
|
|
216
|
+
* @public
|
|
217
|
+
* 组件列表元素处理
|
|
218
|
+
* @param start - 组件插入的位置
|
|
219
|
+
* @param deleteNum - 删除的组件个数
|
|
220
|
+
* @param item - 组件数据
|
|
221
|
+
* @param componentListPath - 组件所在列表的路径
|
|
222
|
+
* @returns
|
|
223
|
+
* @example
|
|
224
|
+
*/
|
|
225
|
+
componentListSplice(start: number, deleteNum: number, item?: ComponentItem | Component, componentListPath?: string): any[];
|
|
226
|
+
/**
|
|
227
|
+
* @public
|
|
228
|
+
* 移动组件到某个位置
|
|
229
|
+
* @param originPath - 原路径
|
|
230
|
+
* @param newPath - 目标路径
|
|
231
|
+
* @example
|
|
232
|
+
* moveTo('0.components.0.list.0', '0.components.0.list.1')
|
|
233
|
+
**/
|
|
234
|
+
moveTo(originPath: any, newPath: any): void;
|
|
235
|
+
/**
|
|
236
|
+
* @public
|
|
237
|
+
* 删除组件
|
|
238
|
+
* @param key - 组件LowCodeKey
|
|
239
|
+
* @returns
|
|
240
|
+
*/
|
|
241
|
+
componentDelete(key: LowCodeKey): void;
|
|
242
|
+
/**
|
|
243
|
+
* @public
|
|
244
|
+
* 复制组件
|
|
245
|
+
* @param key - 组件LowCodeKey
|
|
246
|
+
* @returns
|
|
247
|
+
*/
|
|
248
|
+
componentCopy(key: LowCodeKey): void;
|
|
249
|
+
/**
|
|
250
|
+
* @public
|
|
251
|
+
* 拖动组件
|
|
252
|
+
* @param key - 组件LowCodeKey
|
|
253
|
+
* @param value - 数据
|
|
254
|
+
*/
|
|
255
|
+
componentDrag(key: LowCodeKey, value: {
|
|
256
|
+
x: number;
|
|
257
|
+
y: number;
|
|
258
|
+
name: string;
|
|
259
|
+
}): void;
|
|
260
|
+
/**
|
|
261
|
+
* @public
|
|
262
|
+
* 点击时插入组件 直接插到模拟器最后
|
|
263
|
+
* @param key - 组件LowCodeKey
|
|
264
|
+
* @returns
|
|
265
|
+
*/
|
|
266
|
+
componentInsert(key: LowCodeKey): void;
|
|
267
|
+
/**
|
|
268
|
+
* @public
|
|
269
|
+
* 组件上移
|
|
270
|
+
* @param key - 组件LowCodeKey
|
|
271
|
+
* @returns
|
|
272
|
+
*/
|
|
273
|
+
componentMoveUp(key: LowCodeKey): void;
|
|
274
|
+
/**
|
|
275
|
+
* @public
|
|
276
|
+
* 组件下移
|
|
277
|
+
* @param key - 组件LowCodeKey
|
|
278
|
+
* @returns
|
|
279
|
+
*/
|
|
280
|
+
componentMoveDown(key: LowCodeKey): void;
|
|
281
|
+
/**
|
|
282
|
+
* @public
|
|
283
|
+
* 打开图片上传
|
|
284
|
+
* @param key - 组件LowCodeKey
|
|
285
|
+
* @returns
|
|
286
|
+
*/
|
|
287
|
+
componentImageOpen(key: LowCodeKey): void;
|
|
288
|
+
/**
|
|
289
|
+
* @public
|
|
290
|
+
* 修改表单更新项目数据
|
|
291
|
+
* @param path - 路径
|
|
292
|
+
* @param value - 值
|
|
293
|
+
*/
|
|
294
|
+
setPathDataWithValidate(path: string, value: any): void;
|
|
295
|
+
/**
|
|
296
|
+
* @public
|
|
297
|
+
* 设置project数据 构造函数里和init时调用
|
|
298
|
+
* @param project - 项目数据
|
|
299
|
+
*/
|
|
300
|
+
setProject(project: any): void;
|
|
301
|
+
/**
|
|
302
|
+
* @public
|
|
303
|
+
* 替换project数据 undo,redo
|
|
304
|
+
* @param project - project数据
|
|
305
|
+
*/
|
|
306
|
+
replaceProject(project: any): void;
|
|
307
|
+
/**
|
|
308
|
+
* @public
|
|
309
|
+
* @param result - 模拟器校验二倍图的结果
|
|
310
|
+
* @param path - 图片地址的路径
|
|
311
|
+
* @returns
|
|
312
|
+
*/
|
|
313
|
+
validateImage(result: boolean, path: string, imgUrl: string): {
|
|
314
|
+
text?: undefined;
|
|
315
|
+
icon?: undefined;
|
|
316
|
+
guide?: undefined;
|
|
317
|
+
} | {
|
|
318
|
+
text: any;
|
|
319
|
+
icon: string;
|
|
320
|
+
guide: any;
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* @public
|
|
324
|
+
* todo: 挪走
|
|
325
|
+
* 二倍图校验失败需要返回的弹窗配置
|
|
326
|
+
* @returns
|
|
327
|
+
*/
|
|
328
|
+
validateImageFail(imgUrl: string): {
|
|
329
|
+
text?: undefined;
|
|
330
|
+
icon?: undefined;
|
|
331
|
+
guide?: undefined;
|
|
332
|
+
} | {
|
|
333
|
+
text: any;
|
|
334
|
+
icon: string;
|
|
335
|
+
guide: any;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* @public
|
|
339
|
+
* 获取功能数据
|
|
340
|
+
*/
|
|
341
|
+
get functionData(): FunctionData;
|
|
342
|
+
/**
|
|
343
|
+
* @public
|
|
344
|
+
* @param componentId - 组件id
|
|
345
|
+
* @param newValue - 新的值
|
|
346
|
+
* @param oldValue - 旧的值
|
|
347
|
+
*/
|
|
348
|
+
syncChildren(componentId: number, newValue?: any[], oldValue?: any[]): void;
|
|
349
|
+
}
|