@tmagic/editor 1.0.0-beta.12 → 1.0.0-beta.15
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/coverage/clover.xml +1540 -0
- package/coverage/coverage-final.json +35 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +206 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/Editor.vue.html +787 -0
- package/coverage/lcov-report/src/components/ContentMenu.vue.html +406 -0
- package/coverage/lcov-report/src/components/Icon.vue.html +172 -0
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +283 -0
- package/coverage/lcov-report/src/components/ToolButton.vue.html +772 -0
- package/coverage/lcov-report/src/components/index.html +161 -0
- package/coverage/lcov-report/src/index.html +131 -0
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +214 -0
- package/coverage/lcov-report/src/layouts/Framework.vue.html +304 -0
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +208 -0
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +316 -0
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +268 -0
- package/coverage/lcov-report/src/layouts/index.html +176 -0
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +358 -0
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +421 -0
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +775 -0
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +343 -0
- package/coverage/lcov-report/src/layouts/sidebar/index.html +161 -0
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +718 -0
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +757 -0
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +532 -0
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +586 -0
- package/coverage/lcov-report/src/layouts/workspace/index.html +161 -0
- package/coverage/lcov-report/src/services/BaseService.ts.html +643 -0
- package/coverage/lcov-report/src/services/componentList.ts.html +229 -0
- package/coverage/lcov-report/src/services/editor.ts.html +2077 -0
- package/coverage/lcov-report/src/services/events.ts.html +331 -0
- package/coverage/lcov-report/src/services/history.ts.html +478 -0
- package/coverage/lcov-report/src/services/index.html +206 -0
- package/coverage/lcov-report/src/services/props.ts.html +415 -0
- package/coverage/lcov-report/src/services/ui.ts.html +514 -0
- package/coverage/lcov-report/src/type.ts.html +844 -0
- package/coverage/lcov-report/src/utils/compose.ts.html +184 -0
- package/coverage/lcov-report/src/utils/config.ts.html +172 -0
- package/coverage/lcov-report/src/utils/editor.ts.html +838 -0
- package/coverage/lcov-report/src/utils/index.html +221 -0
- package/coverage/lcov-report/src/utils/index.ts.html +151 -0
- package/coverage/lcov-report/src/utils/logger.ts.html +226 -0
- package/coverage/lcov-report/src/utils/props.ts.html +796 -0
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +733 -0
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +313 -0
- package/coverage/lcov-report/undo-redo.ts.html +313 -0
- package/coverage/lcov.info +3676 -0
- package/dist/style.css +47 -22
- package/dist/tmagic-editor.es.js +921 -603
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +920 -602
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/Editor.vue.d.ts +1 -1
- package/dist/types/src/components/ToolButton.vue.d.ts +12 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -0
- package/dist/types/src/layouts/workspace/PageBar.vue.d.ts +2 -0
- package/dist/types/src/services/editor.d.ts +5 -2
- package/dist/types/src/services/history.d.ts +1 -0
- package/dist/types/src/services/props.d.ts +2 -2
- package/dist/types/src/services/ui.d.ts +1 -0
- package/dist/types/src/type.d.ts +6 -8
- package/dist/types/src/utils/editor.d.ts +2 -2
- package/dist/types/src/utils/polyfills.d.ts +0 -0
- package/package.json +26 -12
- package/src/components/ContentMenu.vue +107 -0
- package/src/components/ScrollViewer.vue +1 -1
- package/src/components/ToolButton.vue +69 -30
- package/src/index.ts +2 -0
- package/src/layouts/Framework.vue +6 -6
- package/src/layouts/sidebar/ComponentListPanel.vue +23 -1
- package/src/layouts/sidebar/LayerMenu.vue +91 -72
- package/src/layouts/sidebar/LayerPanel.vue +23 -49
- package/src/layouts/workspace/PageBar.vue +35 -6
- package/src/layouts/workspace/Stage.vue +41 -44
- package/src/layouts/workspace/ViewerMenu.vue +104 -67
- package/src/layouts/workspace/Workspace.vue +74 -16
- package/src/services/BaseService.ts +1 -1
- package/src/services/editor.ts +97 -10
- package/src/services/history.ts +7 -0
- package/src/services/props.ts +2 -3
- package/src/services/ui.ts +5 -0
- package/src/theme/common/var.scss +1 -0
- package/src/theme/component-list-panel.scss +2 -0
- package/src/theme/content-menu.scss +33 -26
- package/src/theme/layer-panel.scss +2 -1
- package/src/theme/nav-menu.scss +6 -2
- package/src/theme/page-bar.scss +22 -1
- package/src/type.ts +6 -8
- package/src/utils/editor.ts +7 -3
- package/{vite.config.ts → src/utils/polyfills.ts} +4 -12
- package/src/utils/props.ts +19 -0
- package/dist/types/src/layouts/sidebar/LayerPanel.vue.d.ts +0 -980
- package/dist/types/src/layouts/workspace/Stage.vue.d.ts +0 -188
- package/dist/types/src/layouts/workspace/ViewerMenu.vue.d.ts +0 -18
- package/tsconfig.json +0 -9
|
@@ -2,38 +2,45 @@
|
|
|
2
2
|
position: fixed;
|
|
3
3
|
font-size: 12px;
|
|
4
4
|
background: #fff;
|
|
5
|
-
color: #333;
|
|
6
5
|
box-shadow: 0 2px 8px 2px rgba(68, 73, 77, 0.16);
|
|
7
6
|
z-index: 9999;
|
|
8
7
|
transform-origin: 0% 0%;
|
|
9
8
|
font-weight: 600;
|
|
10
9
|
padding: 4px 0px;
|
|
10
|
+
overflow: auto;
|
|
11
|
+
max-height: 100%;
|
|
11
12
|
|
|
12
|
-
.
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 0;
|
|
15
|
-
border-color: rgba(155, 155, 155, 0.1);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.subMenu {
|
|
19
|
-
position: absolute;
|
|
20
|
-
right: 0;
|
|
21
|
-
transform: translate(100%, 0);
|
|
22
|
-
background-color: #fff;
|
|
13
|
+
.menu-item {
|
|
23
14
|
color: #333;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
display: flex;
|
|
16
|
+
-webkit-box-align: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
min-width: 140px;
|
|
20
|
+
transition: all 0.2s ease 0s;
|
|
21
|
+
padding: 5px 14px;
|
|
22
|
+
border-left: 2px solid transparent;
|
|
23
|
+
|
|
24
|
+
.el-button {
|
|
25
|
+
width: 100%;
|
|
26
|
+
justify-content: flex-start;
|
|
27
|
+
}
|
|
29
28
|
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
.el-button--text,
|
|
30
|
+
i {
|
|
31
|
+
color: $--font-color;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.divider {
|
|
35
|
+
padding: 0 14px;
|
|
36
|
+
|
|
37
|
+
.el-divider {
|
|
38
|
+
margin: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:hover {
|
|
43
|
+
background-color: $--hover-color;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
39
46
|
}
|
package/src/theme/nav-menu.scss
CHANGED
|
@@ -43,13 +43,17 @@
|
|
|
43
43
|
display: flex !important;
|
|
44
44
|
transition: all 0.3s ease 0s;
|
|
45
45
|
border-bottom: 2px solid transparent;
|
|
46
|
-
margin: 0
|
|
46
|
+
margin: 0;
|
|
47
47
|
|
|
48
48
|
.is-disabled {
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.
|
|
52
|
+
.is-text {
|
|
53
|
+
padding: 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.is-text,
|
|
53
57
|
i {
|
|
54
58
|
color: $--font-color;
|
|
55
59
|
}
|
package/src/theme/page-bar.scss
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
z-index: 1;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
&-title {
|
|
44
44
|
max-width: 150px;
|
|
45
45
|
text-overflow: ellipsis;
|
|
46
46
|
white-space: nowrap;
|
|
@@ -48,3 +48,24 @@
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
.page-bar-popover {
|
|
53
|
+
&.el-popper.el-popover {
|
|
54
|
+
padding: 10px 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.menu-item {
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: all 0.2s ease 0s;
|
|
60
|
+
padding: 5px 14px;
|
|
61
|
+
|
|
62
|
+
.el-button--text,
|
|
63
|
+
i {
|
|
64
|
+
color: $--font-color;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
background-color: $--hover-color;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/type.ts
CHANGED
|
@@ -53,6 +53,7 @@ export interface StoreState {
|
|
|
53
53
|
highlightNode: MNode | null;
|
|
54
54
|
stage: StageCore | null;
|
|
55
55
|
modifiedNodeIds: Map<Id, Id>;
|
|
56
|
+
pageLength: number;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export interface PropsState {
|
|
@@ -125,6 +126,8 @@ export interface MenuButton {
|
|
|
125
126
|
* zoom: 放大缩小
|
|
126
127
|
*/
|
|
127
128
|
type: 'button' | 'dropdown' | 'text' | 'divider' | 'zoom';
|
|
129
|
+
/** 当type为divider时有效,分割线方向, 默认vertical */
|
|
130
|
+
direction?: 'horizontal' | 'vertical';
|
|
128
131
|
/** 展示的文案 */
|
|
129
132
|
text?: string;
|
|
130
133
|
/** 鼠标悬浮是显示的气泡中的文案 */
|
|
@@ -136,14 +139,9 @@ export interface MenuButton {
|
|
|
136
139
|
/** 是否显示,默认为true */
|
|
137
140
|
display?: boolean | ((data?: Services) => boolean);
|
|
138
141
|
/** type为button/dropdown时点击运行的方法 */
|
|
139
|
-
handler?: (data
|
|
140
|
-
/** type为dropdown
|
|
141
|
-
items?:
|
|
142
|
-
/** 展示的文案 */
|
|
143
|
-
text: string;
|
|
144
|
-
/** 点击运行的方法 */
|
|
145
|
-
handler(data: Services): any;
|
|
146
|
-
}[];
|
|
142
|
+
handler?: (data: Services, event: MouseEvent) => Promise<any> | any;
|
|
143
|
+
/** type为dropdown时,下拉的菜单列表, 或者有子菜单时 */
|
|
144
|
+
items?: MenuButton[];
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
export interface MenuComponent {
|
package/src/utils/editor.ts
CHANGED
|
@@ -125,7 +125,7 @@ export const setNewItemId = (config: MNode, parent?: MPage) => {
|
|
|
125
125
|
*/
|
|
126
126
|
export const isFixed = (node: MNode): boolean => node.style?.position === 'fixed';
|
|
127
127
|
|
|
128
|
-
export const getNodeIndex = (node: MNode, parent: MContainer): number => {
|
|
128
|
+
export const getNodeIndex = (node: MNode, parent: MContainer | MApp): number => {
|
|
129
129
|
const items = parent?.items || [];
|
|
130
130
|
return items.findIndex((item: MNode) => `${item.id}` === `${node.id}`);
|
|
131
131
|
};
|
|
@@ -144,7 +144,7 @@ const setTop2Middle = (node: MNode, parentNode: MNode, stage: StageCore) => {
|
|
|
144
144
|
const style = node.style || {};
|
|
145
145
|
const height = style.height || 0;
|
|
146
146
|
|
|
147
|
-
if (!stage || style.top || !parentNode.style || !isNumber(height)) return style;
|
|
147
|
+
if (!stage || typeof style.top !== 'undefined' || !parentNode.style || !isNumber(height)) return style;
|
|
148
148
|
|
|
149
149
|
const { height: parentHeight } = parentNode.style;
|
|
150
150
|
|
|
@@ -213,7 +213,11 @@ export const change2Fixed = (node: MNode, root: MApp) => {
|
|
|
213
213
|
return node;
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
-
export const Fixed2Other = async (
|
|
216
|
+
export const Fixed2Other = async (
|
|
217
|
+
node: MNode,
|
|
218
|
+
root: MApp,
|
|
219
|
+
getLayout: (parent: MNode, node?: MNode) => Promise<Layout>,
|
|
220
|
+
) => {
|
|
217
221
|
const path = getNodePath(node.id, root.items);
|
|
218
222
|
const cur = path.pop();
|
|
219
223
|
const offset = {
|
|
@@ -16,15 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import { getBaseConfig } from '../vite-config';
|
|
24
|
-
|
|
25
|
-
import pkg from './package.json';
|
|
26
|
-
|
|
27
|
-
const deps = Object.keys(pkg.dependencies);
|
|
28
|
-
const alias = [{ find: /@editor/, replacement: path.join(__dirname, './src') }];
|
|
29
|
-
|
|
30
|
-
export default defineConfig(getBaseConfig(deps, 'TMagicEditor', alias));
|
|
19
|
+
// serialize-javascript 依赖的 randombytes 依赖全局的 global 对象,因此此处需添加 global polyfill
|
|
20
|
+
if (typeof (window as any).global === 'undefined') {
|
|
21
|
+
(window as any).global = window;
|
|
22
|
+
}
|
package/src/utils/props.ts
CHANGED
|
@@ -142,6 +142,25 @@ export const fillConfig = (config: FormConfig = []) => [
|
|
|
142
142
|
},
|
|
143
143
|
],
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
type: 'fieldset',
|
|
147
|
+
legend: '字体',
|
|
148
|
+
items: [
|
|
149
|
+
{
|
|
150
|
+
name: 'color',
|
|
151
|
+
text: '颜色',
|
|
152
|
+
type: 'colorPicker',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'fontSize',
|
|
156
|
+
text: '大小',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'fontWeight',
|
|
160
|
+
text: '粗细',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
145
164
|
],
|
|
146
165
|
},
|
|
147
166
|
],
|