@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,147 @@
|
|
|
1
|
+
import { reactive, nextTick, ref, computed, watch } from 'vue';
|
|
2
|
+
import type { FormInstance } from '@jt/jtui';
|
|
3
|
+
import { ProjectMetaNavMenu } from '@cicctencent/low-code-core';
|
|
4
|
+
interface IMenuForm extends Omit<ProjectMetaNavMenu, 'children'> {
|
|
5
|
+
content: 'pageId' | 'url';
|
|
6
|
+
}
|
|
7
|
+
export default function (props, emits) {
|
|
8
|
+
// 配置菜单的对话框配置
|
|
9
|
+
const editModalOptions = reactive({
|
|
10
|
+
title: '',
|
|
11
|
+
visible: false,
|
|
12
|
+
hasClose: false,
|
|
13
|
+
hasFooter: true,
|
|
14
|
+
width: '604px',
|
|
15
|
+
});
|
|
16
|
+
// 配置菜单的表单对象
|
|
17
|
+
const menuForm = reactive<IMenuForm>({
|
|
18
|
+
content: 'pageId',
|
|
19
|
+
name: '',
|
|
20
|
+
icon: '',
|
|
21
|
+
target: '_blank',
|
|
22
|
+
url: '',
|
|
23
|
+
pageId: 0,
|
|
24
|
+
});
|
|
25
|
+
const menuFormRef = ref<FormInstance>();
|
|
26
|
+
// 渲染在表格的菜单数组
|
|
27
|
+
const menuTree = ref<ProjectMetaNavMenu[]>([]);
|
|
28
|
+
|
|
29
|
+
// key为页面id value为页面名称
|
|
30
|
+
const pageNameMap = computed(() =>
|
|
31
|
+
props.project.pages.reduce(
|
|
32
|
+
(pre, cur) => ({ ...pre, [cur.id]: cur.title }),
|
|
33
|
+
{}
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
watch(
|
|
38
|
+
() => props.modelValue,
|
|
39
|
+
val => {
|
|
40
|
+
menuTree.value = val;
|
|
41
|
+
},
|
|
42
|
+
{ deep: true, immediate: true }
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// 当前点击行的菜单数据
|
|
46
|
+
let currentRow;
|
|
47
|
+
|
|
48
|
+
/* 处理菜单表格中的四个操作 */
|
|
49
|
+
const operateMenu = (
|
|
50
|
+
menuTree: ProjectMetaNavMenu[],
|
|
51
|
+
row: ProjectMetaNavMenu,
|
|
52
|
+
menu?: ProjectMetaNavMenu
|
|
53
|
+
) => {
|
|
54
|
+
let stop = false;
|
|
55
|
+
for (const i in menuTree) {
|
|
56
|
+
if (menuTree[i] === row) {
|
|
57
|
+
if (editModalOptions.title === '添加同级') {
|
|
58
|
+
menuTree.splice(+i + 1, 0, menu);
|
|
59
|
+
} else if (editModalOptions.title === '添加下级') {
|
|
60
|
+
menuTree[i].children.push(menu);
|
|
61
|
+
} else if (editModalOptions.title === '') {
|
|
62
|
+
menuTree.splice(+i, 1);
|
|
63
|
+
} else {
|
|
64
|
+
menuTree[i] = { ...menu, children: menuTree[i].children };
|
|
65
|
+
}
|
|
66
|
+
stop = true;
|
|
67
|
+
} else if (menuTree[i].children.length) {
|
|
68
|
+
stop = operateMenu(menuTree[i].children, row, menu);
|
|
69
|
+
}
|
|
70
|
+
if (stop) break;
|
|
71
|
+
}
|
|
72
|
+
return stop;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/* 点击编辑对话框确认按钮触发 */
|
|
76
|
+
const confirm = () => {
|
|
77
|
+
const { name, icon, pageId, url, target, content } = menuForm;
|
|
78
|
+
const finalMenu = {
|
|
79
|
+
pageId: pageId
|
|
80
|
+
? { name, icon, pageId, children: [] }
|
|
81
|
+
: { name, icon, children: [] },
|
|
82
|
+
url: { name, icon, url, target, children: [] },
|
|
83
|
+
};
|
|
84
|
+
operateMenu(menuTree.value, currentRow, finalMenu[content]);
|
|
85
|
+
emits('update:modelValue', menuTree.value);
|
|
86
|
+
editModalOptions.visible = false;
|
|
87
|
+
editModalOptions.title = '';
|
|
88
|
+
menuFormRef.value.resetFields();
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/* 点击编辑对话框取消按钮触发 */
|
|
92
|
+
const cancel = () => {
|
|
93
|
+
editModalOptions.visible = false;
|
|
94
|
+
editModalOptions.title = '';
|
|
95
|
+
menuFormRef.value.resetFields();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// 点击表格添加同级按钮
|
|
99
|
+
const addPeer = (index, row) => {
|
|
100
|
+
editModalOptions.title = '添加同级';
|
|
101
|
+
editModalOptions.visible = true;
|
|
102
|
+
currentRow = row;
|
|
103
|
+
};
|
|
104
|
+
// 点击表格添加下级按钮
|
|
105
|
+
const addSubordinate = (index, row) => {
|
|
106
|
+
editModalOptions.title = '添加下级';
|
|
107
|
+
editModalOptions.visible = true;
|
|
108
|
+
currentRow = row;
|
|
109
|
+
};
|
|
110
|
+
// 点击表格编辑按钮
|
|
111
|
+
const handleEdit = (index, row) => {
|
|
112
|
+
editModalOptions.title = row.name;
|
|
113
|
+
editModalOptions.visible = true;
|
|
114
|
+
currentRow = row;
|
|
115
|
+
nextTick(() => {
|
|
116
|
+
menuForm.name = row.name;
|
|
117
|
+
menuForm.icon = row.icon;
|
|
118
|
+
if (row.url) {
|
|
119
|
+
menuForm.content = 'url';
|
|
120
|
+
menuForm.url = row.url;
|
|
121
|
+
menuForm.target = row.target;
|
|
122
|
+
} else if (row.pageId) {
|
|
123
|
+
menuForm.content = 'pageId';
|
|
124
|
+
menuForm.pageId = row.pageId;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
// 点击表格删除按钮
|
|
129
|
+
const handleDelete = (index, row) => {
|
|
130
|
+
operateMenu(menuTree.value, row);
|
|
131
|
+
emits('update:modelValue', menuTree.value);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
editModalOptions,
|
|
136
|
+
menuForm,
|
|
137
|
+
menuFormRef,
|
|
138
|
+
menuTree,
|
|
139
|
+
pageNameMap,
|
|
140
|
+
confirm,
|
|
141
|
+
cancel,
|
|
142
|
+
addPeer,
|
|
143
|
+
addSubordinate,
|
|
144
|
+
handleEdit,
|
|
145
|
+
handleDelete,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { connect, mapProps } from '@formily/vue';
|
|
2
|
+
import { transformComponent } from '@jt/formily';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import JtNavTree from '../../NavTree/index.vue';
|
|
5
|
+
|
|
6
|
+
export type JtNavTreeProps = typeof JtNavTree;
|
|
7
|
+
|
|
8
|
+
const TransformJtNavTree = transformComponent<JtNavTreeProps>(JtNavTree, {
|
|
9
|
+
change: 'update:modelValue',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const ActivityBar = connect(
|
|
13
|
+
TransformJtNavTree,
|
|
14
|
+
mapProps({
|
|
15
|
+
value: 'modelValue',
|
|
16
|
+
readOnly: 'readonly',
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default ActivityBar;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { connect, mapProps } from '@formily/vue';
|
|
2
|
+
import { transformComponent } from '@jt/formily';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import JtSidebarPane from './index.vue';
|
|
5
|
+
|
|
6
|
+
export type JtSidebarPaneProps = typeof JtSidebarPane;
|
|
7
|
+
|
|
8
|
+
const TransformJtSidebarPane = transformComponent<JtSidebarPaneProps>(
|
|
9
|
+
JtSidebarPane,
|
|
10
|
+
{
|
|
11
|
+
change: 'update:modelValue',
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const ActivityBar = connect(
|
|
16
|
+
TransformJtSidebarPane,
|
|
17
|
+
mapProps({
|
|
18
|
+
value: 'modelValue',
|
|
19
|
+
readOnly: 'readonly',
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default ActivityBar;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['float-pane', currentType === 'float' ? 'visible' : '']">
|
|
3
|
+
<div class="titled-panel">
|
|
4
|
+
<template v-if="showHeader">
|
|
5
|
+
<button class="icon-float" @click="currentType = 'fixed'">
|
|
6
|
+
<svg
|
|
7
|
+
fill="currentColor"
|
|
8
|
+
preserveAspectRatio="xMidYMid meet"
|
|
9
|
+
width="16"
|
|
10
|
+
height="16"
|
|
11
|
+
viewBox="0 0 1024 1024"
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M160.256 816.64C116.224 872.448 102.4 921.6 102.4 921.6s49.152-13.824 104.96-57.856c22.016-17.408 128-112.64 200.704-174.08l-73.728-73.728c-61.44 72.704-157.184 178.688-174.08 200.704zM648.704 209.408L442.368 355.328l226.304 226.304 145.92-206.336 15.872 15.872c20.992 20.992 54.784 20.992 75.776 0s20.992-54.784 0-75.776l-197.12-197.12c-20.992-20.992-54.784-20.992-75.776 0-20.992 20.992-20.992 54.784 0 75.776l15.36 15.36zM247.808 334.848c-9.728 2.048-18.944 6.656-26.624 14.336-20.992 20.992-20.992 54.784 0 75.776l377.856 377.856c20.992 20.992 54.784 20.992 75.776 0 7.68-7.68 12.288-16.896 14.336-26.624L247.808 334.848z"
|
|
15
|
+
></path>
|
|
16
|
+
<path
|
|
17
|
+
d="M840.704 879.104c-9.728 0-19.456-3.584-27.136-11.264L155.648 210.432c-14.848-14.848-14.848-39.424 0-54.272 14.848-14.848 39.424-14.848 54.272 0L867.84 814.08c14.848 14.848 14.848 39.424 0 54.272-7.168 7.168-16.896 10.752-27.136 10.752z"
|
|
18
|
+
></path>
|
|
19
|
+
</svg>
|
|
20
|
+
</button>
|
|
21
|
+
<button class="icon-close" @click="currentType = 'none'">
|
|
22
|
+
<el-icon :size="16"><Close /></el-icon>
|
|
23
|
+
</button>
|
|
24
|
+
<div class="panel-title">
|
|
25
|
+
<span>{{ name }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<div class="panel-body" :style="{ top: showHeader ? '48px' : 0 }">
|
|
29
|
+
<slot></slot>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div :class="['fixed-pane', currentType === 'fixed' ? 'visible' : '']">
|
|
34
|
+
<div class="titled-panel">
|
|
35
|
+
<template v-if="showHeader">
|
|
36
|
+
<button class="icon-fixed" @click="currentType = 'float'">
|
|
37
|
+
<svg
|
|
38
|
+
fill="currentColor"
|
|
39
|
+
preserveAspectRatio="xMidYMid meet"
|
|
40
|
+
width="16"
|
|
41
|
+
height="16"
|
|
42
|
+
viewBox="0 0 1024 1024"
|
|
43
|
+
>
|
|
44
|
+
<path
|
|
45
|
+
d="M750.848 28.928l245.248 242.944a66.048 66.048 0 1 1-93.184 93.184l-25.6-19.456-249.6 353.792 78.336 78.336a66.048 66.048 0 0 1-93.184 92.672l-460.8-464.64a66.048 66.048 0 0 1 93.184-93.184l76.8 78.336 354.048-249.856-18.176-18.944a66.048 66.048 0 1 1 93.184-93.184zM380.672 732.416l-91.904-90.88c-74.24 89.6-191.488 219.904-212.736 247.04a419.84 419.84 0 0 0-70.656 128 419.84 419.84 0 0 0 128-70.144c27.136-21.248 157.44-138.496 246.528-214.016z"
|
|
46
|
+
></path>
|
|
47
|
+
</svg>
|
|
48
|
+
</button>
|
|
49
|
+
<button class="icon-close" @click="currentType = 'none'">
|
|
50
|
+
<el-icon :size="16"><Close /></el-icon>
|
|
51
|
+
</button>
|
|
52
|
+
<div class="panel-title">
|
|
53
|
+
<span>{{ name }}</span>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
<div class="panel-body" :style="{ top: showHeader ? '48px' : 0 }">
|
|
57
|
+
<slot></slot>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script lang="ts" setup>
|
|
64
|
+
// @ts-nocheck
|
|
65
|
+
import { Close } from '@cicctencent/icons-vue';
|
|
66
|
+
import { ref, watch, withDefaults, defineProps } from 'vue';
|
|
67
|
+
const props = withDefaults(
|
|
68
|
+
defineProps<{
|
|
69
|
+
type: 'float' | 'fixed' | 'none';
|
|
70
|
+
name: string;
|
|
71
|
+
showHeader: boolean;
|
|
72
|
+
}>(),
|
|
73
|
+
{
|
|
74
|
+
type: 'float',
|
|
75
|
+
name: '默认标题',
|
|
76
|
+
showHeader: true,
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const currentType = ref('');
|
|
80
|
+
watch(
|
|
81
|
+
() => props.type,
|
|
82
|
+
val => {
|
|
83
|
+
currentType.value = val;
|
|
84
|
+
},
|
|
85
|
+
{ immediate: true }
|
|
86
|
+
);
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style lang="scss" scoped>
|
|
90
|
+
.float-pane {
|
|
91
|
+
position: absolute;
|
|
92
|
+
width: 300px;
|
|
93
|
+
top: 0;
|
|
94
|
+
bottom: 0;
|
|
95
|
+
left: 46px;
|
|
96
|
+
z-index: 820;
|
|
97
|
+
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
98
|
+
box-shadow: 4px 6px 6px 0 rgba(31, 50, 88, 0.08);
|
|
99
|
+
background-color: #fff;
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
.fixed-pane {
|
|
103
|
+
position: relative;
|
|
104
|
+
margin-left: 1px;
|
|
105
|
+
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
106
|
+
height: 100%;
|
|
107
|
+
width: 300px;
|
|
108
|
+
flex-shrink: 0;
|
|
109
|
+
background-color: #fff;
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
.float-pane .titled-panel,
|
|
113
|
+
.fixed-pane .titled-panel {
|
|
114
|
+
position: relative;
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
.icon-float,
|
|
118
|
+
.icon-fixed {
|
|
119
|
+
position: absolute;
|
|
120
|
+
right: 38px;
|
|
121
|
+
top: 14px;
|
|
122
|
+
height: auto;
|
|
123
|
+
z-index: 2;
|
|
124
|
+
background: transparent;
|
|
125
|
+
border-color: transparent;
|
|
126
|
+
border-radius: 0;
|
|
127
|
+
padding: 0;
|
|
128
|
+
height: 20px;
|
|
129
|
+
font-size: 14px;
|
|
130
|
+
border-width: 0;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
}
|
|
133
|
+
.icon-close {
|
|
134
|
+
position: absolute;
|
|
135
|
+
right: 16px;
|
|
136
|
+
top: 14px;
|
|
137
|
+
height: auto;
|
|
138
|
+
z-index: 2;
|
|
139
|
+
background: transparent;
|
|
140
|
+
border-color: transparent;
|
|
141
|
+
border-radius: 0;
|
|
142
|
+
padding: 0;
|
|
143
|
+
height: 20px;
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
border-width: 0;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
}
|
|
151
|
+
.panel-title {
|
|
152
|
+
height: 48px;
|
|
153
|
+
font-size: 16px;
|
|
154
|
+
padding: 0 15px;
|
|
155
|
+
color: #0f1726;
|
|
156
|
+
font-weight: 700;
|
|
157
|
+
display: flex;
|
|
158
|
+
justify-content: flex-start;
|
|
159
|
+
align-items: center;
|
|
160
|
+
}
|
|
161
|
+
.panel-body {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: 0;
|
|
164
|
+
bottom: 0;
|
|
165
|
+
left: 0;
|
|
166
|
+
right: 0;
|
|
167
|
+
overflow: visible;
|
|
168
|
+
border-top: 1px solid rgba(31, 56, 88, 0.1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
.visible {
|
|
172
|
+
display: block;
|
|
173
|
+
}
|
|
174
|
+
</style>
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import { App } from 'vue';
|
|
3
|
+
import Editor from './editor.vue';
|
|
4
|
+
import EditorDomain from './domain/EditorDomain';
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
JT_VERSION: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const EditorComponent = Editor as any;
|
|
11
|
+
|
|
12
|
+
EditorComponent.install = (app: App) => {
|
|
13
|
+
app.component('VcEditor', Editor);
|
|
14
|
+
};
|
|
15
|
+
import formilyComponents from './formily';
|
|
16
|
+
export default EditorComponent;
|
|
17
|
+
|
|
18
|
+
import ComponentTreeFavorites from './components/ComponentTreeFavorites/index.vue'
|
|
19
|
+
|
|
20
|
+
export { formilyComponents, Editor, EditorDomain, ComponentTreeFavorites };
|
|
21
|
+
|
|
22
|
+
window.JT_VERSION = Object.assign(
|
|
23
|
+
{
|
|
24
|
+
'__rollup__name__@__rollup__version__': '__rollup__date__',
|
|
25
|
+
},
|
|
26
|
+
window.JT_VERSION
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare module "*.vue" {
|
|
2
|
+
import type { DefineComponent } from "vue";
|
|
3
|
+
const component: DefineComponent<{}, {}, any>;
|
|
4
|
+
export default component;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module "*.png" {
|
|
8
|
+
export default any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module "*.svg" {
|
|
12
|
+
export default any;
|
|
13
|
+
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tz9NIS95tuvt1HdGB8itACLNeOBKZeWF5XsLuh5mVYhfTY8p1H17RnDQ7AgDB8LZe5TmrAUoNfcay9Ub6ZR26ugdISps2JAEqLCMz1q2Q4CoWAk212HvpGx82YxAG0GuG7+wJ0eT13S7MqarTpvbySQstSC4/1LUOpHHs4X3y/ScmAlj0nrQtK5M85W6OPHbibIioUQT1R5jhfSWzlKwr9hd5u3clRmxiw/5cPP//qbzyf15fSjEf0c9HS0tXVLGlMtXNOOz+lnsqP2z6bRiw553AlWlSRNuKErbUe7DKiAVPbZHiR4MfALy/oRVH3O2FrjYf/UmjAeuFCOy6N+Pt+R2/b4ZTexqTLYshgE4ocuq6heLQ24oUrY/b9BkFZx0tD8CXTv7nv9d0GB4sxoizCpSpIm3FCN7AZvYRYLcAHDNBI8qXWRX4nxvyaK7kdAsn1+jHh3IuCdZx9wDiLNg0VmfITV+eIzmNfNLRIa225/nkgFdgwAAAA==`
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare interface SelectItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: any;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
type PlainObject<T = any> = { [key: string]: T };
|
|
7
|
+
export const changeEnum2Array = (param: PlainObject): SelectItem[] => {
|
|
8
|
+
const arr: SelectItem[] = [];
|
|
9
|
+
let keys = Object.keys(param);
|
|
10
|
+
// 反向映射 值为数字
|
|
11
|
+
if (param[param[keys[0]]] !== undefined) {
|
|
12
|
+
keys = keys.slice(keys.length / 2);
|
|
13
|
+
}
|
|
14
|
+
keys.forEach((key) => {
|
|
15
|
+
arr.push({
|
|
16
|
+
label: key,
|
|
17
|
+
value: param[key],
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
return arr;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* style图片背景渲染
|
|
25
|
+
* @param img
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export function imageStyle(img: string) {
|
|
29
|
+
return {
|
|
30
|
+
width: "100%",
|
|
31
|
+
height: "100%",
|
|
32
|
+
backgroundImage: `url(${img})`,
|
|
33
|
+
backgroundSize: "cover",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 过滤收藏
|
|
39
|
+
* @param tree
|
|
40
|
+
* @param favorites
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export function favoriteRebuild(tree, favorites) {
|
|
44
|
+
if (!tree) return tree;
|
|
45
|
+
const newTree = [];
|
|
46
|
+
for (const item of tree) {
|
|
47
|
+
if (item.list) {
|
|
48
|
+
item.list = favoriteRebuild(item.list, favorites);
|
|
49
|
+
if (item.list?.length) {
|
|
50
|
+
newTree.push(item);
|
|
51
|
+
}
|
|
52
|
+
} else if (favorites.includes(item.name)) {
|
|
53
|
+
newTree.push(item);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return newTree;
|
|
57
|
+
};
|
package/test/case.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const case1 = [
|
|
2
|
+
{
|
|
3
|
+
title: "基础组件",
|
|
4
|
+
list: [
|
|
5
|
+
{
|
|
6
|
+
title: "普通容器",
|
|
7
|
+
list: [
|
|
8
|
+
{
|
|
9
|
+
title: "普通容器",
|
|
10
|
+
icon: "https://jtcospublic.ciccten.com/low-code/files/4c27q5/snipaste_2022-08-01_10-40-301659321679266.png",
|
|
11
|
+
name: "PlainContainer",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
title: "TAB(内容切换)",
|
|
15
|
+
icon: "https://jtcospublic.ciccten.com/low-code/files/4c27q5/snipaste_2022-08-01_10-40-301659321679266.png",
|
|
16
|
+
name: "TabContainer",
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: "图片",
|
|
22
|
+
list: [
|
|
23
|
+
{
|
|
24
|
+
title: "单图片",
|
|
25
|
+
icon: "http://jtcospublic.ciccten.com/config-server/1632374118739563199/picture.png",
|
|
26
|
+
name: "ComponentImage",
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "富文本",
|
|
32
|
+
list: [
|
|
33
|
+
{
|
|
34
|
+
title: "富文本",
|
|
35
|
+
icon: "http://jtcospublic.ciccten.com/config-server/1632374135943751700/rich-text.png",
|
|
36
|
+
name: "ComponentRich",
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: "吸底按钮",
|
|
42
|
+
list: [
|
|
43
|
+
{
|
|
44
|
+
title: "吸底按钮",
|
|
45
|
+
icon: "http:////jtcospublic.ciccten.com/config-server/1638512519326572833/bottom-potocol.png",
|
|
46
|
+
name: "BottomButton",
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: "模块组件",
|
|
54
|
+
list: [
|
|
55
|
+
{
|
|
56
|
+
title: "纯文本",
|
|
57
|
+
list: [
|
|
58
|
+
{
|
|
59
|
+
title: "纯文本",
|
|
60
|
+
icon: "http://jtcospublic.ciccten.com/config-server/1632374102992225549/text.png",
|
|
61
|
+
name: "ComponentText",
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { test, expect } from 'vitest'
|
|
2
|
+
import { favoriteRebuild } from '../../src/utils/index'
|
|
3
|
+
import { case1 } from '../case'
|
|
4
|
+
test('adds 1 + 2 to equal 3', () => {
|
|
5
|
+
expect(1 + 2).toBe(3)
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
test('favoriteRebuild', () => {
|
|
9
|
+
const res = favoriteRebuild(case1, ['ComponentImage'])
|
|
10
|
+
expect(res).toEqual([
|
|
11
|
+
{
|
|
12
|
+
title: "基础组件",
|
|
13
|
+
list: [
|
|
14
|
+
{
|
|
15
|
+
title: "图片",
|
|
16
|
+
list: [
|
|
17
|
+
{
|
|
18
|
+
title: "单图片",
|
|
19
|
+
icon: "http://jtcospublic.ciccten.com/config-server/1632374118739563199/picture.png",
|
|
20
|
+
name: "ComponentImage",
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
])
|
|
27
|
+
})
|