@cicctencent/low-code-editor 0.0.0-stage → 1.1.9-beta.6
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 +2 -2
- package/api-extractor.json +36 -0
- package/dist/ActivityBar/index.vue.d.ts +29 -0
- package/dist/ComponentTree/components/List.vue.d.ts +29 -0
- package/dist/ComponentTree/index.vue.d.ts +32 -0
- package/dist/DataSource/index.vue.d.ts +34 -0
- package/dist/HeaderBar/components/BarTooltip.vue.d.ts +37 -0
- package/dist/HeaderBar/index.vue.d.ts +49 -0
- package/dist/NavTree/index.vue.d.ts +48 -0
- package/dist/SchemaConfig/index.vue.d.ts +36 -0
- package/dist/SidebarPane/index.vue.d.ts +38 -0
- package/dist/components/ComponentTreeFavorites/components/List.vue.d.ts +41 -0
- package/dist/components/ComponentTreeFavorites/components/Tips.vue.d.ts +16 -0
- package/dist/components/ComponentTreeFavorites/index.vue.d.ts +44 -0
- package/dist/components/ImageGuide/index.vue.d.ts +45 -0
- package/dist/components.d.ts +7 -0
- package/dist/composables/useComponentTree.d.ts +13 -0
- package/dist/config/ace.config.d.ts +3 -0
- package/dist/domain/EditorDomain.d.ts +89 -0
- package/dist/editor.d.ts +466 -0
- package/dist/editor.vue.d.ts +104 -0
- package/dist/formily/ActivityBar/index.d.ts +4 -0
- package/dist/formily/ComponentTree/index.d.ts +4 -0
- package/dist/formily/DataBinding/index.d.ts +4 -0
- package/dist/formily/DataBinding/index.vue.d.ts +26 -0
- package/dist/formily/DataSource/index.d.ts +4 -0
- package/dist/formily/MenuTable/PageList.vue.d.ts +28 -0
- package/dist/formily/MenuTable/index.d.ts +4 -0
- package/dist/formily/MenuTable/index.vue.d.ts +30 -0
- package/dist/formily/MenuTable/useMenuTable.d.ts +2 -0
- package/dist/formily/NavTree/index.d.ts +4 -0
- package/dist/formily/SidebarPane/index.d.ts +4 -0
- package/dist/formily/index.d.ts +2 -0
- package/dist/index.css +1167 -0
- package/dist/index.d.ts +250 -0
- package/dist/index.js +42688 -0
- package/dist/utils/base64.d.ts +4 -0
- package/dist/utils/index.d.ts +27 -0
- package/package.json +62 -4
- package/rollup.config.js +3 -0
- package/src/ActivityBar/index.vue +71 -0
- package/src/ComponentTree/components/List.vue +310 -0
- package/src/ComponentTree/index.vue +77 -0
- package/src/DataSource/index.vue +640 -0
- package/src/HeaderBar/components/BarDialog.vue +43 -0
- package/src/HeaderBar/components/BarTooltip.vue +33 -0
- package/src/HeaderBar/index.vue +513 -0
- package/src/NavTree/index.vue +345 -0
- package/src/SchemaConfig/index.vue +150 -0
- package/src/SidebarPane/index.vue +199 -0
- package/src/SynBarComponent/index.vue +31 -0
- package/src/assets/font/NotoSansSC.ttf +0 -0
- package/src/assets/img/header/edit.png +0 -0
- package/src/assets/img/header/link.png +0 -0
- package/src/assets/img/header/link.svg +9 -0
- package/src/assets/img/header/preview.png +0 -0
- package/src/assets/img/header/preview.svg +9 -0
- package/src/assets/img/header/redo.svg +1 -0
- package/src/assets/img/header/undo.svg +1 -0
- package/src/assets/img/tool/all-select.svg +9 -0
- package/src/assets/img/tool/all.svg +9 -0
- package/src/assets/img/tool/collect.svg +6 -0
- package/src/assets/img/tool/collection-select.svg +3 -0
- package/src/assets/img/tool/collection-tag.svg +5 -0
- package/src/assets/img/tool/info.svg +4 -0
- package/src/assets/img/tool/union.svg +4 -0
- package/src/components/ComponentTreeFavorites/components/List.vue +452 -0
- package/src/components/ComponentTreeFavorites/components/Tips.vue +108 -0
- package/src/components/ComponentTreeFavorites/index.vue +180 -0
- package/src/components/ImageGuide/index.vue +100 -0
- package/src/components.ts +23 -0
- package/src/composables/useComponentTree.ts +38 -0
- package/src/config/ace.config.ts +22 -0
- package/src/domain/EditorDomain.ts +265 -0
- package/src/editor.ts +645 -0
- package/src/editor.vue +380 -0
- package/src/formily/ActivityBar/index.ts +23 -0
- package/src/formily/ActivityBar/index.vue +121 -0
- package/src/formily/ComponentTree/index.ts +22 -0
- package/src/formily/DataBinding/index.ts +22 -0
- package/src/formily/DataBinding/index.vue +285 -0
- package/src/formily/DataSource/index.ts +22 -0
- package/src/formily/MenuTable/PageList.vue +132 -0
- package/src/formily/MenuTable/index.ts +19 -0
- package/src/formily/MenuTable/index.vue +218 -0
- package/src/formily/MenuTable/useMenuTable.ts +147 -0
- package/src/formily/NavTree/index.ts +20 -0
- package/src/formily/SidebarPane/index.ts +23 -0
- package/src/formily/SidebarPane/index.vue +174 -0
- package/src/formily/index.ts +12 -0
- package/src/index.ts +29 -0
- package/src/typings/vue-shim.d.ts +13 -0
- package/src/utils/base64.ts +5 -0
- package/src/utils/index.ts +57 -0
- package/test/case.ts +67 -0
- package/test/utils/index.test.ts +27 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** 提示图标 */
|
|
2
|
+
export declare const tipIcon = "data:image/webp;base64,UklGRnoPAABXRUJQVlA4WAoAAAAQAAAAxwAAxwAAQUxQSGgIAAABoMX+v+q2OcVt1phviimkewI3b0Mre0shKnihQpZxoDDK2HdSuXW0wh3zUvCCY0ZLi+JqaS2lVaS0sqwuMMibPd7+w/M/5/z/5/htigiJkm2FbbPXHpRx1OrZjgwI/4D4v8/MqXg4kUylBzMj47lff82Nj2QG06lk4uGKOe40JdL8TG8ONJLrfaY5MsV1vCWbk2Aoyc1LPFcprgsOg+EcDurmuMeyth+AJD8dqjzNJa54bAAIczJ+jSNMXPs6kCd5l2e/05uOAIsM+5ZvnHPXcfg7zt+4+IETwCrDMUs3zvRPAbsM+2daaHUaWCa92jZXd4OJfPvpu10Hng92bdq0K3j+QNe7n34LJtJ9tVXdnriBfYOGyEVCIRdFGgIDu8Y9azRmQMvRoHqm7nHPrA6OglYyjXYoagON9LVGp5s6+unR1j7QSFuRBco1uj7Z3WWmSyjbnVWvYaCcvQeVC/45UROiqCJUk/hZuZAHmY8J2tU/cAg7/nP8YdVa2os5DwqGeHZlPOWNoWVs1et1yHhu1DO1EZTkuXQrPT+vVtVGlnx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PpchAT/qR1UhkNucnZMGbIQKXO2pDeuR6I655q7OEJ1g4swAD+/4vB4NbxAnAOVNzMD/hbHDxHSvWxHR7KzjBs6zWZylqBCMsoZxaHAcQDqyIdLACSKv/Tu//6oz/+qxP/+qQWjZylk4c6b0bQZK2MRGi7jHjPa/8n2ksu/g8i0Dt+UmlpTsI72tJrKdAO0/B0u+8NeweBxmlgxH7igfIrkvTPiQLb7E6v1yN9yAjLffl/IuVooppaCCurnVQclOEQk6NzKSVzGm43B4hSjklRb2kMpu6eSplSCqFrf4AHBmThCZScBIfhyunhMLvJGkRIvzQdZHrh/inKo/bAtiD33QXMaekMl0hxoYlb1VJE7GJ8l1YGoO+SkM/G8pQkT7tPYWLMtz9NIS95tuvt1HdGB8itACLNeOBKZeWF5XsLuh5mVYhfTY8p1H17RnDQ7AgDB8LZe5TmrAUoNfcay9Ub6ZR26ugdISps2JAEqLCMz1q2Q4CoWAk212HvpGx82YxAG0GuG7+wJ0eT13S7MqarTpvbySQstSC4/1LUOpHHs4X3y/ScmAlj0nrQtK5M85W6OPHbibIioUQT1R5jhfSWzlKwr9hd5u3clRmxiw/5cPP//qbzyf15fSjEf0c9HS0tXVLGlMtXNOOz+lnsqP2z6bRiw553AlWlSRNuKErbUe7DKiAVPbZHiR4MfALy/oRVH3O2FrjYf/UmjAeuFCOy6N+Pt+R2/b4ZTexqTLYshgE4ocuq6heLQ24oUrY/b9BkFZx0tD8CXTv7nv9d0GB4sxoizCpSpIm3FCN7AZvYRYLcAHDNBI8qXWRX4nxvyaK7kdAsn1+jHh3IuCdZx9wDiLNg0VmfITV+eIzmNfNLRIa225/nkgFdgwAAAA==";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare interface SelectItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: any;
|
|
4
|
+
}
|
|
5
|
+
declare type PlainObject<T = any> = {
|
|
6
|
+
[key: string]: T;
|
|
7
|
+
};
|
|
8
|
+
export declare const changeEnum2Array: (param: PlainObject) => SelectItem[];
|
|
9
|
+
/**
|
|
10
|
+
* style图片背景渲染
|
|
11
|
+
* @param img
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function imageStyle(img: string): {
|
|
15
|
+
width: string;
|
|
16
|
+
height: string;
|
|
17
|
+
backgroundImage: string;
|
|
18
|
+
backgroundSize: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 过滤收藏
|
|
22
|
+
* @param tree
|
|
23
|
+
* @param favorites
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
export declare function favoriteRebuild(tree: any, favorites: any): any;
|
|
27
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cicctencent/low-code-editor",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.9-beta.6",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rollup --config && rollup --config ../../scripts/rollup.dts.config.js --bundleConfigAsCjs && node ../../scripts/replace.js"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"@jt/formily": ">= 0.0.78",
|
|
12
|
+
"v-contextmenu": ">= 3.0.0",
|
|
13
|
+
"vue": ">= 3.0.0"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@jt/ark-util": ">=0.0.30",
|
|
17
|
+
"@jt/formily": ">= 0.0.78",
|
|
18
|
+
"@jt/jtui": ">=2.2.11-beta.14",
|
|
19
|
+
"@cicctencent/low-code-core": "1.1.9-beta.5",
|
|
20
|
+
"@cicctencent/low-code-validate": "1.1.9-beta.5",
|
|
21
|
+
"@jt/postmessage-channel": ">=0.1.10",
|
|
22
|
+
"jm-jsruntime": "^1.0.3",
|
|
23
|
+
"pinyin-match": "1.2.4",
|
|
24
|
+
"v-contextmenu": ">= 3.0.0",
|
|
25
|
+
"vue": ">= 3.0.0",
|
|
26
|
+
"vuedraggable": "^4.1.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@formily/grid": "^2.2.29",
|
|
30
|
+
"@cicctencent/icons-vue": "^0.2.8",
|
|
31
|
+
"@rollup/plugin-commonjs": "^17.0.0",
|
|
32
|
+
"@rollup/plugin-image": "^2.1.1",
|
|
33
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
34
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
35
|
+
"@vue/compiler-sfc": "^3.3.4",
|
|
36
|
+
"@vueuse/core": "9.13.0",
|
|
37
|
+
"ace-builds": "^1.23.4",
|
|
38
|
+
"dayjs": "1.8.35",
|
|
39
|
+
"html2canvas": "^1.4.1",
|
|
40
|
+
"is-reference": "^3.0.1",
|
|
41
|
+
"jest-worker": "^29.6.4",
|
|
42
|
+
"postcss": "^8.4.23",
|
|
43
|
+
"rollup": "^2.37.1",
|
|
44
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
45
|
+
"rollup-plugin-external-globals": "^0.6.1",
|
|
46
|
+
"rollup-plugin-inject-process-env": "^1.3.1",
|
|
47
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
48
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
49
|
+
"rollup-plugin-scss": "^3.0.0",
|
|
50
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
51
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
52
|
+
"rollup-plugin-vue": "^6.0.0",
|
|
53
|
+
"sass": "^1.66.1",
|
|
54
|
+
"typescript": "~4.5.5",
|
|
55
|
+
"vue3-ace-editor": "2.2.3"
|
|
56
|
+
},
|
|
57
|
+
"keywords": [],
|
|
58
|
+
"author": "",
|
|
59
|
+
"license": "ISC",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public",
|
|
62
|
+
"registry": "https://registry.npmjs.org/"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sidebar">
|
|
3
|
+
<div v-for="bar in barList" :key="bar.name">
|
|
4
|
+
<el-tooltip :content="bar.title" placement="right">
|
|
5
|
+
<span
|
|
6
|
+
:class="['title', modelValue === bar.name ? 'activated' : '']"
|
|
7
|
+
@click.stop="emits('update:modelValue', bar.name)"
|
|
8
|
+
>
|
|
9
|
+
<b class="title-icon">
|
|
10
|
+
<el-icon :size="20">
|
|
11
|
+
<component :is="ElIcons[bar.icon]" />
|
|
12
|
+
</el-icon>
|
|
13
|
+
</b>
|
|
14
|
+
</span>
|
|
15
|
+
</el-tooltip>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
//@ts-nocheck
|
|
22
|
+
import { PropType } from 'vue';
|
|
23
|
+
import * as ElIcons from '@cicctencent/icons-vue';
|
|
24
|
+
import { ActivityBarType } from '@cicctencent/low-code-core';
|
|
25
|
+
import { defineProps, defineEmits } from 'vue';
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: '',
|
|
30
|
+
},
|
|
31
|
+
barList: {
|
|
32
|
+
type: Array as PropType<ActivityBarType[]>,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const emits = defineEmits(['update:modelValue']);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="scss" scoped>
|
|
40
|
+
.sidebar {
|
|
41
|
+
padding-top: 12px;
|
|
42
|
+
height: 100%;
|
|
43
|
+
width: 48px;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
.title {
|
|
49
|
+
width: 46px;
|
|
50
|
+
height: 46px;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
.title-icon {
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
margin: 0;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
.el-icon:deep(svg > path) {
|
|
63
|
+
fill: currentColor;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.activated {
|
|
68
|
+
color: #f0dcc4;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="component-list">
|
|
3
|
+
<template v-if="componentTree.length">
|
|
4
|
+
<el-collapse v-model="activeNames">
|
|
5
|
+
<template v-for="item in componentTree" :key="item.title">
|
|
6
|
+
<el-collapse-item :name="item.title" v-if="calc(item)">
|
|
7
|
+
<template #title>
|
|
8
|
+
{{ item.title }}
|
|
9
|
+
<el-icon color="#999999" :size="16">
|
|
10
|
+
<CaretBottom v-if="activeNames.includes(item.title)" />
|
|
11
|
+
<CaretRight v-else />
|
|
12
|
+
</el-icon>
|
|
13
|
+
</template>
|
|
14
|
+
<template
|
|
15
|
+
v-for="subItem in (item.list as ComponentTree[])"
|
|
16
|
+
:key="subItem.title"
|
|
17
|
+
>
|
|
18
|
+
<el-collapse-item
|
|
19
|
+
class="nested-list"
|
|
20
|
+
:name="subItem.title"
|
|
21
|
+
v-if="calc(subItem)"
|
|
22
|
+
>
|
|
23
|
+
<template #title>
|
|
24
|
+
{{ subItem.title }}
|
|
25
|
+
<el-icon color="#999999" :size="16">
|
|
26
|
+
<CaretBottom v-if="activeNames.includes(subItem.title)" />
|
|
27
|
+
<CaretRight v-else />
|
|
28
|
+
</el-icon>
|
|
29
|
+
</template>
|
|
30
|
+
<div v-if="subItem.list">
|
|
31
|
+
<template
|
|
32
|
+
v-for="element in (subItem.list as ComponentTreeItem[])"
|
|
33
|
+
:key="element.name"
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
class="component-item"
|
|
37
|
+
:style="{
|
|
38
|
+
'pointer-events': readOnly ? 'none' : 'auto',
|
|
39
|
+
}"
|
|
40
|
+
@mousedown="e => onMousedown(e, element)"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="component-img"
|
|
44
|
+
:ref="el => imgRefMap.set(element.name, el)"
|
|
45
|
+
>
|
|
46
|
+
<img :src="element.icon" alt="" />
|
|
47
|
+
</div>
|
|
48
|
+
<!-- 当前正在移动的组件副本 -->
|
|
49
|
+
<div
|
|
50
|
+
v-if="element.name === movingComponent.name"
|
|
51
|
+
class="component-img-copy"
|
|
52
|
+
:style="{
|
|
53
|
+
top: `${movingComponent.top}px`,
|
|
54
|
+
left: `${movingComponent.left}px`,
|
|
55
|
+
cursor: movingComponent.cursor,
|
|
56
|
+
}"
|
|
57
|
+
>
|
|
58
|
+
<img :src="element.icon" alt="" />
|
|
59
|
+
</div>
|
|
60
|
+
<div class="component-name">
|
|
61
|
+
{{ element.title }}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
</div>
|
|
66
|
+
</el-collapse-item>
|
|
67
|
+
</template>
|
|
68
|
+
</el-collapse-item>
|
|
69
|
+
</template>
|
|
70
|
+
</el-collapse>
|
|
71
|
+
</template>
|
|
72
|
+
<template v-else>
|
|
73
|
+
<div class="notice">组件库为空</div>
|
|
74
|
+
</template>
|
|
75
|
+
</div>
|
|
76
|
+
<div :class="['drop-area', coverIframe ? 'cover-iframe' : '']"></div>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script lang="ts" setup>
|
|
80
|
+
import {
|
|
81
|
+
ref,
|
|
82
|
+
watch,
|
|
83
|
+
reactive,
|
|
84
|
+
inject,
|
|
85
|
+
Ref,
|
|
86
|
+
} from 'vue';
|
|
87
|
+
import { ComponentTreeItem, ComponentTree } from '@cicctencent/low-code-core';
|
|
88
|
+
import { CaretBottom, CaretRight } from '@cicctencent/icons-vue';
|
|
89
|
+
const props = withDefaults(
|
|
90
|
+
defineProps<{
|
|
91
|
+
componentTree?: ComponentTree[];
|
|
92
|
+
readOnly?: boolean;
|
|
93
|
+
}>(),
|
|
94
|
+
{
|
|
95
|
+
readOnly: false,
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const emits = defineEmits(['dragEnd', 'clickItem']);
|
|
100
|
+
// 默认全部展开
|
|
101
|
+
const activeNames = ref([]);
|
|
102
|
+
// 是否覆盖iframe 为了解决组件拖拽到iframe出现的位置偏差问题
|
|
103
|
+
const coverIframe = ref(false);
|
|
104
|
+
// 组件图片的ref集合
|
|
105
|
+
const imgRefMap = ref(new Map());
|
|
106
|
+
// 当前正在移动的组件位置
|
|
107
|
+
const movingComponent = reactive({
|
|
108
|
+
name: '',
|
|
109
|
+
top: 0,
|
|
110
|
+
left: 0,
|
|
111
|
+
cursor: 'pointer',
|
|
112
|
+
});
|
|
113
|
+
const iframe = inject<Ref<HTMLIFrameElement>>('iframe');
|
|
114
|
+
watch(
|
|
115
|
+
() => props.componentTree,
|
|
116
|
+
list => {
|
|
117
|
+
const value = [];
|
|
118
|
+
(list || []).forEach(v => {
|
|
119
|
+
value.push(v.title);
|
|
120
|
+
v.list &&
|
|
121
|
+
v.list.forEach(lv => {
|
|
122
|
+
value.push(lv.title);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
activeNames.value = value;
|
|
126
|
+
},
|
|
127
|
+
{ deep: true, immediate: true }
|
|
128
|
+
);
|
|
129
|
+
/* 计算该分类下有多少个组件 */
|
|
130
|
+
const calc = (tree: ComponentTree): number => {
|
|
131
|
+
if (tree.list.length) {
|
|
132
|
+
// 不是最后一级分类
|
|
133
|
+
if ((tree.list[0] as ComponentTree)?.list) {
|
|
134
|
+
return (tree.list as ComponentTree[])
|
|
135
|
+
.map(v => calc(v))
|
|
136
|
+
.reduce((p, c) => p + c);
|
|
137
|
+
}
|
|
138
|
+
// 是最后一级分类
|
|
139
|
+
return tree.list.length;
|
|
140
|
+
}
|
|
141
|
+
return 0;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* 由于在跨域的iframe上无法触发drag和drop事件 而仅能触发的dragend事件计算的坐标有误差 因此使用mouse事件替代拖拽事件
|
|
145
|
+
*/
|
|
146
|
+
// 记录鼠标是否移动
|
|
147
|
+
let isMoved = false;
|
|
148
|
+
// 记录鼠标长按是否超过0.5s
|
|
149
|
+
let isLongPress = false;
|
|
150
|
+
// 偏移距离
|
|
151
|
+
const offsetLength = 10;
|
|
152
|
+
// 按下鼠标触发的事件
|
|
153
|
+
const onMousedown = (e: MouseEvent, element: ComponentTreeItem) => {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
const rect = iframe?.value?.getBoundingClientRect?.();
|
|
156
|
+
// 提高蒙层的层级 盖住iframe
|
|
157
|
+
coverIframe.value = true;
|
|
158
|
+
const img = imgRefMap.value.get(element.name);
|
|
159
|
+
// 长按鼠标超过0.5s则副本自动移出当前位置 向上向下各偏移offsetLength 以提示用户可以拖动组件
|
|
160
|
+
const timer = setTimeout(() => {
|
|
161
|
+
isLongPress = true;
|
|
162
|
+
movingComponent.name = element.name;
|
|
163
|
+
movingComponent.left = e.clientX - img.offsetWidth / 2 + offsetLength;
|
|
164
|
+
movingComponent.top = e.clientY - img.offsetHeight / 2 - offsetLength;
|
|
165
|
+
}, 500);
|
|
166
|
+
// 移动鼠标触发的事件
|
|
167
|
+
const move = (ev: MouseEvent) => {
|
|
168
|
+
isMoved = true;
|
|
169
|
+
if (!isLongPress) clearTimeout(timer);
|
|
170
|
+
// 展示组件副本 鼠标移动时让副本组件跟随鼠标
|
|
171
|
+
movingComponent.name = element.name;
|
|
172
|
+
movingComponent.left =
|
|
173
|
+
ev.clientX - img.offsetWidth / 2 + (isLongPress ? offsetLength : 0);
|
|
174
|
+
movingComponent.top =
|
|
175
|
+
ev.clientY - img.offsetHeight / 2 - (isLongPress ? offsetLength : 0);
|
|
176
|
+
// 根据设置鼠标样式
|
|
177
|
+
if (rect) {
|
|
178
|
+
if (
|
|
179
|
+
ev.clientX > rect.left &&
|
|
180
|
+
ev.clientX < rect.left + rect.width &&
|
|
181
|
+
ev.clientY > rect.top &&
|
|
182
|
+
ev.clientY < rect.top + rect.height
|
|
183
|
+
) {
|
|
184
|
+
movingComponent.cursor = 'copy';
|
|
185
|
+
} else {
|
|
186
|
+
movingComponent.cursor = 'no-drop';
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
// 抬起鼠标触发的事件
|
|
191
|
+
const up = (ev: MouseEvent) => {
|
|
192
|
+
if (!isLongPress) clearTimeout(timer);
|
|
193
|
+
// 恢复层级
|
|
194
|
+
coverIframe.value = false;
|
|
195
|
+
// 鼠标未移动且没有长按为点击事件
|
|
196
|
+
if (!isMoved && !isLongPress) {
|
|
197
|
+
emits('clickItem', { key: element.key, value: element });
|
|
198
|
+
} else {
|
|
199
|
+
isMoved = false;
|
|
200
|
+
isLongPress = false;
|
|
201
|
+
// 恢复默认值
|
|
202
|
+
movingComponent.name = '';
|
|
203
|
+
movingComponent.left = 0;
|
|
204
|
+
movingComponent.top = 0;
|
|
205
|
+
movingComponent.cursor = 'pointer';
|
|
206
|
+
const { key, name } = element;
|
|
207
|
+
const { clientX: x, clientY: y } = ev;
|
|
208
|
+
emits('dragEnd', { key, value: { x, y, name } }, ev.view === self);
|
|
209
|
+
}
|
|
210
|
+
document.removeEventListener('mousemove', move);
|
|
211
|
+
document.removeEventListener('mouseup', up);
|
|
212
|
+
};
|
|
213
|
+
document.addEventListener('mousemove', move);
|
|
214
|
+
document.addEventListener('mouseup', up);
|
|
215
|
+
};
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<style lang="scss" scoped>
|
|
219
|
+
.component-list {
|
|
220
|
+
display: flex;
|
|
221
|
+
flex-basis: 100px;
|
|
222
|
+
flex-grow: 1;
|
|
223
|
+
height: 100%;
|
|
224
|
+
overflow-y: auto;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
|
|
227
|
+
.notice {
|
|
228
|
+
text-align: center;
|
|
229
|
+
font-size: 14px;
|
|
230
|
+
color: rgba(0, 0, 0, 0.6);
|
|
231
|
+
padding: 50px 15px 0;
|
|
232
|
+
}
|
|
233
|
+
.component-item {
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
margin-bottom: 12px;
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
.component-img {
|
|
239
|
+
box-sizing: border-box;
|
|
240
|
+
width: 100px;
|
|
241
|
+
min-width: 100px;
|
|
242
|
+
height: 52px;
|
|
243
|
+
background-color: rgba(#212121, 0.1);
|
|
244
|
+
border-radius: 4px;
|
|
245
|
+
margin-right: 24px;
|
|
246
|
+
padding: 8px 9px;
|
|
247
|
+
img {
|
|
248
|
+
height: 100%;
|
|
249
|
+
width: 100%;
|
|
250
|
+
object-fit: contain;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
.component-img-copy {
|
|
254
|
+
@extend .component-img;
|
|
255
|
+
/* 由于设置为absolute会被该组件外的其他组件遮盖 因此设置为fixed */
|
|
256
|
+
position: fixed;
|
|
257
|
+
z-index: 999;
|
|
258
|
+
transition: all ease;
|
|
259
|
+
}
|
|
260
|
+
.component-name {
|
|
261
|
+
font-size: 14px;
|
|
262
|
+
line-height: 24px;
|
|
263
|
+
color: #4b515e;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
.drop-area {
|
|
268
|
+
background: transparent;
|
|
269
|
+
}
|
|
270
|
+
// 显示在最高层
|
|
271
|
+
.cover-iframe {
|
|
272
|
+
position: fixed;
|
|
273
|
+
inset: 0;
|
|
274
|
+
z-index: 99;
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
277
|
+
<style lang="scss">
|
|
278
|
+
.component-list {
|
|
279
|
+
.el-collapse {
|
|
280
|
+
border-top: none;
|
|
281
|
+
.el-collapse-item__arrow {
|
|
282
|
+
display: none;
|
|
283
|
+
}
|
|
284
|
+
.el-collapse-item__header {
|
|
285
|
+
border-bottom: none;
|
|
286
|
+
font-size: 14px;
|
|
287
|
+
font-weight: 400;
|
|
288
|
+
line-height: 24px;
|
|
289
|
+
color: #020202;
|
|
290
|
+
}
|
|
291
|
+
.el-collapse-item__wrap {
|
|
292
|
+
border-bottom: none;
|
|
293
|
+
.el-collapse-item__content {
|
|
294
|
+
padding-bottom: 0px;
|
|
295
|
+
padding-left: 10px;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
.nested-list {
|
|
300
|
+
.el-collapse-item__header {
|
|
301
|
+
font-size: 12px;
|
|
302
|
+
line-height: 24px;
|
|
303
|
+
color: #4b515e;
|
|
304
|
+
}
|
|
305
|
+
.el-collapse-item__content {
|
|
306
|
+
padding-left: 0px !important;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="component-tree">
|
|
3
|
+
<!-- <div class="component-tree__title">组件库</div> -->
|
|
4
|
+
<el-input
|
|
5
|
+
v-model="keyword"
|
|
6
|
+
class="search-input"
|
|
7
|
+
placeholder="请输入组件名称/组件分类名称"
|
|
8
|
+
:prefix-icon="Search"
|
|
9
|
+
/>
|
|
10
|
+
<List
|
|
11
|
+
:componentTree="activeComponentTree"
|
|
12
|
+
:readOnly="readOnly"
|
|
13
|
+
@click-item="onClickItem"
|
|
14
|
+
@drag-end="onDragEnd"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { defineProps, withDefaults, defineEmits, computed } from 'vue';
|
|
21
|
+
import { Search } from '@cicctencent/icons-vue';
|
|
22
|
+
import List from './components/List.vue';
|
|
23
|
+
import { ComponentTreeData, LowCodeKey } from '@cicctencent/low-code-core';
|
|
24
|
+
import useComponentTree from '../composables/useComponentTree';
|
|
25
|
+
// 如果直接传对象,会频繁更新DOM,这里传JSON会好很多。在vue内部判断是否需要更新是用:
|
|
26
|
+
// nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)
|
|
27
|
+
const props = withDefaults(
|
|
28
|
+
defineProps<{
|
|
29
|
+
componentTreeData?: {
|
|
30
|
+
key: LowCodeKey;
|
|
31
|
+
value: ComponentTreeData;
|
|
32
|
+
};
|
|
33
|
+
readOnly?: boolean;
|
|
34
|
+
}>(),
|
|
35
|
+
{
|
|
36
|
+
componentTreeData: null,
|
|
37
|
+
readOnly: false,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const emits = defineEmits(['addItem', 'dragEnd']);
|
|
42
|
+
const { rebuild, onClickItem, onDragEnd, keyword } = useComponentTree(
|
|
43
|
+
props,
|
|
44
|
+
emits
|
|
45
|
+
);
|
|
46
|
+
// 当前显示的可选择的组件
|
|
47
|
+
const activeComponentTree = computed(() => {
|
|
48
|
+
if (!props.componentTreeData) return [];
|
|
49
|
+
if (!keyword.value) return props.componentTreeData.value;
|
|
50
|
+
else {
|
|
51
|
+
// 返回输入关键字过滤后的组件库
|
|
52
|
+
return rebuild(props.componentTreeData.value, keyword.value);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<style lang="scss" scoped>
|
|
58
|
+
.component-tree {
|
|
59
|
+
flex-shrink: 1;
|
|
60
|
+
padding: 16px 17px;
|
|
61
|
+
position: relative;
|
|
62
|
+
height: 100%;
|
|
63
|
+
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
&__title {
|
|
67
|
+
margin-bottom: 19px;
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
font-size: 16px;
|
|
70
|
+
line-height: 24px;
|
|
71
|
+
}
|
|
72
|
+
.search-input {
|
|
73
|
+
margin-bottom: 9px;
|
|
74
|
+
flex-grow: 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</style>
|