@epxing/designer 5.3.0-beta.2 → 5.3.0-beta.4
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/API.md +160 -160
- package/README.md +46 -46
- package/dist/src/page-designer/PageDesigner.js +11 -0
- package/dist/src/page-designer/designer.js +21 -0
- package/dist/src/page-designer/previews/add-form/Preview.js +1 -1
- package/dist/src/page-designer/previews/add-form/Preview.vue.js +19 -8
- package/dist/src/page-designer/setting-panel/Setting.js +46 -10
- package/dist/src/visual/config-page/ComponentLibraryDialog.js +8 -2
- package/dist/src/visual/config-page/DashboardMobile.js +1 -1
- package/dist/style.css +116 -112
- package/package.json +8 -8
- package/src/index.js +27 -27
- package/src/page-designer/PageDesigner.vue +11 -0
- package/src/page-designer/designer.js +1322 -1299
- package/src/page-designer/previews/add-form/Preview.vue +43 -44
- package/src/page-designer/setting-panel/Setting.vue +24 -2
- package/src/page-designer/widget-preview/Mixin.js +285 -285
- package/src/page-designer/widget-preview/Preview.vue +322 -322
- package/src/page-designer/widget-preview/WidgetWrapper.vue +197 -197
- package/src/page-designer/widget-preview/directive.js +258 -258
- package/src/visual/CategoryList.vue +563 -563
- package/src/visual/ComponentList.vue +280 -280
- package/src/visual/CreatePage.vue +389 -389
- package/src/visual/EntityCardList.vue +449 -449
- package/src/visual/EntityList.vue +838 -838
- package/src/visual/config-page/ComponentLibraryDialog.vue +7 -1
- package/src/visual/config-page/DashboardMobile.vue +934 -934
- package/src/visual/widgets/ProcessFormItemVisual.vue +58 -58
- package/types/index.d.ts +22 -22
- package/types/page-designer.d.ts +3 -3
- package/types/visual-component.d.ts +1 -1
- package/types/visual-entity-list.d.ts +1 -1
- package/types/visual-entity-sub-list.d.ts +1 -1
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:ref="widgetRef"
|
|
4
|
-
:class="[
|
|
5
|
-
'epx-page-designer-widget-wrapper',
|
|
6
|
-
{'el-col': !parentWidget},
|
|
7
|
-
{[`el-col-${widget.span || 24}`]: !parentWidget},
|
|
8
|
-
{'is-hover': isHover && !templateInfo}
|
|
9
|
-
]"
|
|
10
|
-
:data-widget-id="widget.id"
|
|
11
|
-
@mouseenter="handleMouseEnter"
|
|
12
|
-
@mouseleave="handleMouseLeave"
|
|
13
|
-
@click="handleClick"
|
|
14
|
-
>
|
|
15
|
-
<!-- 模板 -->
|
|
16
|
-
<template v-if="widget.type === 'template'">
|
|
17
|
-
<template-preview
|
|
18
|
-
:widget="widget"
|
|
19
|
-
:designer="designer"
|
|
20
|
-
:key="widget.id"
|
|
21
|
-
:parent-widget="parentWidget"
|
|
22
|
-
:pageRelationList="pageRelationList"
|
|
23
|
-
></template-preview>
|
|
24
|
-
</template>
|
|
25
|
-
<!-- 普通组件 -->
|
|
26
|
-
<component
|
|
27
|
-
v-else
|
|
28
|
-
:is="widgetName"
|
|
29
|
-
:widget="widget"
|
|
30
|
-
:designer="designer"
|
|
31
|
-
:key="widget.id"
|
|
32
|
-
:parent-widget="parentWidget"
|
|
33
|
-
:templateInfo="templateInfo"
|
|
34
|
-
:pageRelationList="pageRelationList"
|
|
35
|
-
></component>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<script>
|
|
40
|
-
import TemplatePreview from './Template'
|
|
41
|
-
import PreviewMixin from './Mixin'
|
|
42
|
-
import util from '@epxing/core/src/runtime-utils/util'
|
|
43
|
-
import { resolvePreviewName } from './resolvePreviewName'
|
|
44
|
-
|
|
45
|
-
function appendCss (id, css) {
|
|
46
|
-
const formatCss = css.replace(/:current/g, '.css_' + id).replace(/url\s*\(([\w+-/.\s]+)\)/g, (str, $1) => {
|
|
47
|
-
return `url(${util.getFileUrl($1)})`
|
|
48
|
-
})
|
|
49
|
-
const element = document.getElementById('style_' + id)
|
|
50
|
-
if (element) {
|
|
51
|
-
element.textContent = formatCss
|
|
52
|
-
} else {
|
|
53
|
-
const style = document.createElement('style')
|
|
54
|
-
style.id = 'style_' + id
|
|
55
|
-
style.textContent = formatCss
|
|
56
|
-
style.setAttribute('type', 'text/css')
|
|
57
|
-
document.head.appendChild(style)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function removeCss (id) {
|
|
62
|
-
const element = document.getElementById('style_' + id)
|
|
63
|
-
if (element) document.head.removeChild(element)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
name: 'epx-page-designer-widget-wrapper',
|
|
68
|
-
mixins: [PreviewMixin],
|
|
69
|
-
components: {
|
|
70
|
-
TemplatePreview
|
|
71
|
-
},
|
|
72
|
-
inject: {
|
|
73
|
-
templateInfo: {
|
|
74
|
-
type: Object,
|
|
75
|
-
default: () => null
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
provide () {
|
|
79
|
-
return {
|
|
80
|
-
templateInfo: this.templateInfo
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
props: {
|
|
84
|
-
designer: {
|
|
85
|
-
type: Object,
|
|
86
|
-
required: true
|
|
87
|
-
},
|
|
88
|
-
parentWidget: {
|
|
89
|
-
type: Object,
|
|
90
|
-
default: null
|
|
91
|
-
},
|
|
92
|
-
widget: {
|
|
93
|
-
type: Object,
|
|
94
|
-
required: true
|
|
95
|
-
},
|
|
96
|
-
pageRelationList: {
|
|
97
|
-
type: Array,
|
|
98
|
-
default: () => []
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
data () {
|
|
102
|
-
return {
|
|
103
|
-
isHover: false,
|
|
104
|
-
widgetRef: `widget_${this.widget.id}`
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
computed: {
|
|
108
|
-
widgetInfo () {
|
|
109
|
-
return this.designer.getWidgetByType(this.widget.contentType, this.widget.type) || {}
|
|
110
|
-
},
|
|
111
|
-
isContainer () {
|
|
112
|
-
return this.widgetInfo.CONTAINER === '1'
|
|
113
|
-
},
|
|
114
|
-
// 预览组件名解析统一走 resolvePreviewName(命中项有缓存)
|
|
115
|
-
widgetName () {
|
|
116
|
-
return resolvePreviewName(this.designer, this.widget)
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
methods: {
|
|
120
|
-
handleMouseEnter (event) {
|
|
121
|
-
if (!this.templateInfo) {
|
|
122
|
-
this.isHover = true
|
|
123
|
-
event.stopPropagation()
|
|
124
|
-
// 触发 hover 事件,用于高亮显示
|
|
125
|
-
this.$emit('widget-hover', this.widget.id)
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
handleMouseLeave (event) {
|
|
129
|
-
if (!this.templateInfo) {
|
|
130
|
-
this.isHover = false
|
|
131
|
-
event.stopPropagation()
|
|
132
|
-
this.$emit('widget-hover', null)
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
handleClick (event) {
|
|
136
|
-
if (!this.templateInfo && this.widgetInfo.ID) {
|
|
137
|
-
this.designer.setSelected(this.widget)
|
|
138
|
-
// 触发点击事件,传递元素引用
|
|
139
|
-
this.$emit('widget-click', {
|
|
140
|
-
widget: this.widget,
|
|
141
|
-
element: this.$el,
|
|
142
|
-
parentWidget: this.parentWidget
|
|
143
|
-
})
|
|
144
|
-
event.stopPropagation()
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
// 获取组件 DOM 元素
|
|
148
|
-
getElement () {
|
|
149
|
-
return this.$el
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
mounted () {
|
|
153
|
-
// 应用组件的 CSS 样式
|
|
154
|
-
if (this.widget.css) {
|
|
155
|
-
appendCss(this.widget.id, this.widget.css)
|
|
156
|
-
}
|
|
157
|
-
// 添加 css_ 类名,用于样式作用域
|
|
158
|
-
if (this.$el) {
|
|
159
|
-
if (this.$el.classList) {
|
|
160
|
-
this.$el.classList.add('css_' + this.widget.id)
|
|
161
|
-
} else {
|
|
162
|
-
this.$el.className += ' css_' + this.widget.id
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
watch: {
|
|
167
|
-
'widget.css' (v) {
|
|
168
|
-
if (v) {
|
|
169
|
-
appendCss(this.widget.id, v)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
beforeUnmount () {
|
|
174
|
-
// 清理 CSS 样式
|
|
175
|
-
removeCss(this.widget.id)
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
</script>
|
|
179
|
-
|
|
180
|
-
<style lang="scss">
|
|
181
|
-
.epx-page-designer-widget-wrapper {
|
|
182
|
-
position: relative;
|
|
183
|
-
|
|
184
|
-
// 悬停时显示虚线边框(仅视觉提示,不影响布局)
|
|
185
|
-
&.is-hover::before {
|
|
186
|
-
content: '';
|
|
187
|
-
position: absolute;
|
|
188
|
-
top: 0;
|
|
189
|
-
left: 0;
|
|
190
|
-
right: 0;
|
|
191
|
-
bottom: 0;
|
|
192
|
-
border: 1px dashed var(--color-primary, #409EFF);
|
|
193
|
-
pointer-events: none;
|
|
194
|
-
z-index: 99;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:ref="widgetRef"
|
|
4
|
+
:class="[
|
|
5
|
+
'epx-page-designer-widget-wrapper',
|
|
6
|
+
{'el-col': !parentWidget},
|
|
7
|
+
{[`el-col-${widget.span || 24}`]: !parentWidget},
|
|
8
|
+
{'is-hover': isHover && !templateInfo}
|
|
9
|
+
]"
|
|
10
|
+
:data-widget-id="widget.id"
|
|
11
|
+
@mouseenter="handleMouseEnter"
|
|
12
|
+
@mouseleave="handleMouseLeave"
|
|
13
|
+
@click="handleClick"
|
|
14
|
+
>
|
|
15
|
+
<!-- 模板 -->
|
|
16
|
+
<template v-if="widget.type === 'template'">
|
|
17
|
+
<template-preview
|
|
18
|
+
:widget="widget"
|
|
19
|
+
:designer="designer"
|
|
20
|
+
:key="widget.id"
|
|
21
|
+
:parent-widget="parentWidget"
|
|
22
|
+
:pageRelationList="pageRelationList"
|
|
23
|
+
></template-preview>
|
|
24
|
+
</template>
|
|
25
|
+
<!-- 普通组件 -->
|
|
26
|
+
<component
|
|
27
|
+
v-else
|
|
28
|
+
:is="widgetName"
|
|
29
|
+
:widget="widget"
|
|
30
|
+
:designer="designer"
|
|
31
|
+
:key="widget.id"
|
|
32
|
+
:parent-widget="parentWidget"
|
|
33
|
+
:templateInfo="templateInfo"
|
|
34
|
+
:pageRelationList="pageRelationList"
|
|
35
|
+
></component>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import TemplatePreview from './Template'
|
|
41
|
+
import PreviewMixin from './Mixin'
|
|
42
|
+
import util from '@epxing/core/src/runtime-utils/util'
|
|
43
|
+
import { resolvePreviewName } from './resolvePreviewName'
|
|
44
|
+
|
|
45
|
+
function appendCss (id, css) {
|
|
46
|
+
const formatCss = css.replace(/:current/g, '.css_' + id).replace(/url\s*\(([\w+-/.\s]+)\)/g, (str, $1) => {
|
|
47
|
+
return `url(${util.getFileUrl($1)})`
|
|
48
|
+
})
|
|
49
|
+
const element = document.getElementById('style_' + id)
|
|
50
|
+
if (element) {
|
|
51
|
+
element.textContent = formatCss
|
|
52
|
+
} else {
|
|
53
|
+
const style = document.createElement('style')
|
|
54
|
+
style.id = 'style_' + id
|
|
55
|
+
style.textContent = formatCss
|
|
56
|
+
style.setAttribute('type', 'text/css')
|
|
57
|
+
document.head.appendChild(style)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function removeCss (id) {
|
|
62
|
+
const element = document.getElementById('style_' + id)
|
|
63
|
+
if (element) document.head.removeChild(element)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
name: 'epx-page-designer-widget-wrapper',
|
|
68
|
+
mixins: [PreviewMixin],
|
|
69
|
+
components: {
|
|
70
|
+
TemplatePreview
|
|
71
|
+
},
|
|
72
|
+
inject: {
|
|
73
|
+
templateInfo: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: () => null
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
provide () {
|
|
79
|
+
return {
|
|
80
|
+
templateInfo: this.templateInfo
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
designer: {
|
|
85
|
+
type: Object,
|
|
86
|
+
required: true
|
|
87
|
+
},
|
|
88
|
+
parentWidget: {
|
|
89
|
+
type: Object,
|
|
90
|
+
default: null
|
|
91
|
+
},
|
|
92
|
+
widget: {
|
|
93
|
+
type: Object,
|
|
94
|
+
required: true
|
|
95
|
+
},
|
|
96
|
+
pageRelationList: {
|
|
97
|
+
type: Array,
|
|
98
|
+
default: () => []
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
data () {
|
|
102
|
+
return {
|
|
103
|
+
isHover: false,
|
|
104
|
+
widgetRef: `widget_${this.widget.id}`
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
widgetInfo () {
|
|
109
|
+
return this.designer.getWidgetByType(this.widget.contentType, this.widget.type) || {}
|
|
110
|
+
},
|
|
111
|
+
isContainer () {
|
|
112
|
+
return this.widgetInfo.CONTAINER === '1'
|
|
113
|
+
},
|
|
114
|
+
// 预览组件名解析统一走 resolvePreviewName(命中项有缓存)
|
|
115
|
+
widgetName () {
|
|
116
|
+
return resolvePreviewName(this.designer, this.widget)
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
methods: {
|
|
120
|
+
handleMouseEnter (event) {
|
|
121
|
+
if (!this.templateInfo) {
|
|
122
|
+
this.isHover = true
|
|
123
|
+
event.stopPropagation()
|
|
124
|
+
// 触发 hover 事件,用于高亮显示
|
|
125
|
+
this.$emit('widget-hover', this.widget.id)
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
handleMouseLeave (event) {
|
|
129
|
+
if (!this.templateInfo) {
|
|
130
|
+
this.isHover = false
|
|
131
|
+
event.stopPropagation()
|
|
132
|
+
this.$emit('widget-hover', null)
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
handleClick (event) {
|
|
136
|
+
if (!this.templateInfo && this.widgetInfo.ID) {
|
|
137
|
+
this.designer.setSelected(this.widget)
|
|
138
|
+
// 触发点击事件,传递元素引用
|
|
139
|
+
this.$emit('widget-click', {
|
|
140
|
+
widget: this.widget,
|
|
141
|
+
element: this.$el,
|
|
142
|
+
parentWidget: this.parentWidget
|
|
143
|
+
})
|
|
144
|
+
event.stopPropagation()
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
// 获取组件 DOM 元素
|
|
148
|
+
getElement () {
|
|
149
|
+
return this.$el
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
mounted () {
|
|
153
|
+
// 应用组件的 CSS 样式
|
|
154
|
+
if (this.widget.css) {
|
|
155
|
+
appendCss(this.widget.id, this.widget.css)
|
|
156
|
+
}
|
|
157
|
+
// 添加 css_ 类名,用于样式作用域
|
|
158
|
+
if (this.$el) {
|
|
159
|
+
if (this.$el.classList) {
|
|
160
|
+
this.$el.classList.add('css_' + this.widget.id)
|
|
161
|
+
} else {
|
|
162
|
+
this.$el.className += ' css_' + this.widget.id
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
watch: {
|
|
167
|
+
'widget.css' (v) {
|
|
168
|
+
if (v) {
|
|
169
|
+
appendCss(this.widget.id, v)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
beforeUnmount () {
|
|
174
|
+
// 清理 CSS 样式
|
|
175
|
+
removeCss(this.widget.id)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<style lang="scss">
|
|
181
|
+
.epx-page-designer-widget-wrapper {
|
|
182
|
+
position: relative;
|
|
183
|
+
|
|
184
|
+
// 悬停时显示虚线边框(仅视觉提示,不影响布局)
|
|
185
|
+
&.is-hover::before {
|
|
186
|
+
content: '';
|
|
187
|
+
position: absolute;
|
|
188
|
+
top: 0;
|
|
189
|
+
left: 0;
|
|
190
|
+
right: 0;
|
|
191
|
+
bottom: 0;
|
|
192
|
+
border: 1px dashed var(--color-primary, #409EFF);
|
|
193
|
+
pointer-events: none;
|
|
194
|
+
z-index: 99;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
</style>
|