@zhangqingcq/vgce 0.0.13 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +16 -2
- package/dist/style.css +1 -1
- package/dist/vgce.js +28 -34
- package/dist/vgce.umd.cjs +5 -5
- package/package.json +3 -2
- package/src/App.vue +11 -0
- package/src/assets/base.less +49 -0
- package/src/assets/icons/add.svg +1 -0
- package/src/assets/icons/delete.svg +12 -0
- package/src/assets/icons/export.svg +1 -0
- package/src/assets/icons/group.svg +13 -0
- package/src/assets/icons/import.svg +1 -0
- package/src/assets/icons/lock.svg +7 -0
- package/src/assets/icons/menu-fold.svg +9 -0
- package/src/assets/icons/menu-unfold.svg +9 -0
- package/src/assets/icons/preview.svg +6 -0
- package/src/assets/icons/redo.svg +8 -0
- package/src/assets/icons/return.svg +8 -0
- package/src/assets/icons/rotate.svg +1 -0
- package/src/assets/icons/save.svg +9 -0
- package/src/assets/icons/setting.svg +6 -0
- package/src/assets/icons/undo.svg +7 -0
- package/src/assets/icons/ungroup.svg +16 -0
- package/src/assets/icons/unlock.svg +7 -0
- package/src/assets/main.less +6 -0
- package/src/assets/svgs/alternator.svg +8 -0
- package/src/assets/svgs/bot-12.svg +1 -0
- package/src/assets/svgs/bot-2.svg +1 -0
- package/src/assets/svgs/bot-3.svg +1 -0
- package/src/assets/svgs/bot-7.svg +1 -0
- package/src/assets/svgs/bot-9.svg +94 -0
- package/src/assets/svgs/car.svg +1 -0
- package/src/assets/svgs/circuit-breaker.svg +11 -0
- package/src/assets/svgs/clock-a.svg +23 -0
- package/src/assets/svgs/common-table.svg +7 -0
- package/src/assets/svgs/el-button.svg +10 -0
- package/src/assets/svgs/el-tag.svg +13 -0
- package/src/assets/svgs/hospital.svg +1 -0
- package/src/assets/svgs/house.svg +1 -0
- package/src/assets/svgs/light.svg +24 -0
- package/src/assets/svgs/now-time.svg +9 -0
- package/src/assets/svgs/package.svg +1 -0
- package/src/assets/svgs/pie-charts.svg +10 -0
- package/src/assets/svgs/progress-a.svg +1 -0
- package/src/assets/svgs/reservoir.svg +10 -0
- package/src/assets/svgs/svg-text.svg +5 -0
- package/src/assets/svgs/switch-a.svg +5 -0
- package/src/assets/svgs/traction-transformer.svg +11 -0
- package/src/components/ace-edit/index.ts +27 -0
- package/src/components/config/index.ts +450 -0
- package/src/components/config/types.ts +25 -0
- package/src/components/svg-analysis/index.vue +11 -0
- package/src/components/svg-editor/center-panel/index.vue +867 -0
- package/src/components/svg-editor/center-panel/types.ts +11 -0
- package/src/components/svg-editor/component-tree/index.vue +33 -0
- package/src/components/svg-editor/connection-line/index.vue +125 -0
- package/src/components/svg-editor/connection-panel/index.vue +198 -0
- package/src/components/svg-editor/export-json/index.vue +37 -0
- package/src/components/svg-editor/handle-panel/index.vue +342 -0
- package/src/components/svg-editor/import-json/index.vue +37 -0
- package/src/components/svg-editor/index.vue +280 -0
- package/src/components/svg-editor/left-panel/index.vue +83 -0
- package/src/components/svg-editor/right-panel/code-edit-modal.vue +50 -0
- package/src/components/svg-editor/right-panel/common-animate.vue +96 -0
- package/src/components/svg-editor/right-panel/condition.vue +101 -0
- package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +97 -0
- package/src/components/svg-editor/right-panel/index.vue +304 -0
- package/src/components/svg-editor/right-panel/list.vue +86 -0
- package/src/components/svg-editor/top-panel/index.vue +139 -0
- package/src/components/svg-editor/types.ts +22 -0
- package/src/components/svg-viewer/index.vue +340 -0
- package/src/components/vue3-ruler-tool/index.vue +506 -0
- package/src/config/files/clock-a.vue +66 -0
- package/src/config/files/common-table.vue +49 -0
- package/src/config/files/light-a.vue +72 -0
- package/src/config/files/now-time.vue +53 -0
- package/src/config/files/pie-charts.vue +72 -0
- package/src/config/files/progress.vue +40 -0
- package/src/config/files/svg-text.vue +39 -0
- package/src/config/files/switch-a.vue +45 -0
- package/src/config/index.ts +28 -0
- package/src/config/svg/animation/index.ts +8 -0
- package/src/config/svg/animation/reservoir.ts +32 -0
- package/src/config/svg/custom/clock-a.ts +23 -0
- package/src/config/svg/custom/index.ts +11 -0
- package/src/config/svg/custom/light.ts +29 -0
- package/src/config/svg/custom/svg-text.ts +54 -0
- package/src/config/svg/custom/switch-a.ts +29 -0
- package/src/config/svg/index.ts +12 -0
- package/src/config/svg/stateful/circuit-breaker.ts +38 -0
- package/src/config/svg/stateful/index.ts +8 -0
- package/src/config/svg/stateless/alternator.ts +28 -0
- package/src/config/svg/stateless/bot-12.ts +22 -0
- package/src/config/svg/stateless/bot-2.ts +22 -0
- package/src/config/svg/stateless/bot-3.ts +22 -0
- package/src/config/svg/stateless/bot-7.ts +22 -0
- package/src/config/svg/stateless/bot-9.ts +22 -0
- package/src/config/svg/stateless/car.ts +22 -0
- package/src/config/svg/stateless/hospital.ts +22 -0
- package/src/config/svg/stateless/house.ts +22 -0
- package/src/config/svg/stateless/index.ts +30 -0
- package/src/config/svg/stateless/package.ts +22 -0
- package/src/config/svg/stateless/traction-transformer.ts +28 -0
- package/src/config/types.ts +126 -0
- package/src/config/vue/component/button.ts +57 -0
- package/src/config/vue/component/common-table.ts +124 -0
- package/src/config/vue/component/index.ts +13 -0
- package/src/config/vue/component/now-time.ts +29 -0
- package/src/config/vue/component/progress.ts +29 -0
- package/src/config/vue/component/tag.ts +46 -0
- package/src/config/vue/echarts/index.ts +8 -0
- package/src/config/vue/echarts/pie-charts.ts +60 -0
- package/src/config/vue/index.ts +5 -0
- package/src/hooks.ts +47 -0
- package/src/index.ts +14 -0
- package/src/main.ts +15 -0
- package/src/router.ts +24 -0
- package/src/stores/config/index.ts +44 -0
- package/src/stores/config/types.ts +27 -0
- package/src/stores/global/index.ts +109 -0
- package/src/stores/global/types.ts +115 -0
- package/src/stores/main.ts +10 -0
- package/src/stores/svg-edit-layout/index.ts +17 -0
- package/src/stores/svg-edit-layout/types.ts +8 -0
- package/src/stores/system/index.ts +174 -0
- package/src/stores/system/types.ts +43 -0
- package/src/utils/fetch.ts +351 -0
- package/src/utils/file-read-write.ts +26 -0
- package/src/utils/index.ts +397 -0
- package/src/utils/mqtt-net.ts +48 -0
- package/src/utils/proxy.ts +7 -0
- package/src/utils/scale-core.ts +214 -0
- package/src/utils/types.ts +13 -0
- package/src/views/EditorS.vue +18 -0
- package/src/views/Preview.vue +12 -0
@@ -0,0 +1,506 @@
|
|
1
|
+
<script lang="ts">
|
2
|
+
import { computed, defineComponent, onBeforeUnmount, onMounted, ref } from 'vue'
|
3
|
+
import { pinia } from '@/hooks'
|
4
|
+
import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
|
5
|
+
|
6
|
+
export default defineComponent({
|
7
|
+
name: 'V3RulerComponent',
|
8
|
+
props: {
|
9
|
+
position: {
|
10
|
+
type: String,
|
11
|
+
default: 'relative',
|
12
|
+
validator: (val: string) => {
|
13
|
+
return ['absolute', 'fixed', 'relative', 'static', 'inherit'].indexOf(val) !== -1
|
14
|
+
}
|
15
|
+
}, // 规定元素的定位类型
|
16
|
+
isHotKey: {
|
17
|
+
type: Boolean,
|
18
|
+
default: true
|
19
|
+
}, // 热键开关
|
20
|
+
isScaleRevise: {
|
21
|
+
type: Boolean,
|
22
|
+
default: false
|
23
|
+
}, // 刻度修正(根据content进行刻度重置)
|
24
|
+
value: {
|
25
|
+
type: Array,
|
26
|
+
default: () => {
|
27
|
+
return [
|
28
|
+
{
|
29
|
+
type: 'h',
|
30
|
+
site: 50
|
31
|
+
},
|
32
|
+
{
|
33
|
+
type: 'v',
|
34
|
+
site: 180
|
35
|
+
}
|
36
|
+
] //
|
37
|
+
}
|
38
|
+
}, // 预置参考线
|
39
|
+
contentLayout: {
|
40
|
+
type: Object,
|
41
|
+
default: () => {
|
42
|
+
return {
|
43
|
+
top: 0,
|
44
|
+
left: 0
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}, // 内容部分布局
|
48
|
+
parent: {
|
49
|
+
type: Boolean,
|
50
|
+
default: false
|
51
|
+
},
|
52
|
+
visible: {
|
53
|
+
type: Boolean,
|
54
|
+
default: true
|
55
|
+
},
|
56
|
+
stepLength: {
|
57
|
+
type: Number,
|
58
|
+
default: 50,
|
59
|
+
validator: (val: number) => val % 10 === 0
|
60
|
+
} // 步长
|
61
|
+
},
|
62
|
+
emits: ['input', 'update:visible'],
|
63
|
+
setup(props, context) {
|
64
|
+
const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
|
65
|
+
/**
|
66
|
+
* @description 绑定事件 on(element, event, handler)
|
67
|
+
*/
|
68
|
+
const on = (function () {
|
69
|
+
return function (element: any, event: any, handler: any) {
|
70
|
+
if (element && event && handler) {
|
71
|
+
element.addEventListener(event, handler, false)
|
72
|
+
}
|
73
|
+
}
|
74
|
+
})()
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @description 解绑事件 off(element, event, handler)
|
78
|
+
*/
|
79
|
+
const off = (function () {
|
80
|
+
return function (element: any, event: any, handler: any) {
|
81
|
+
if (element && event) {
|
82
|
+
element.removeEventListener(event, handler, false)
|
83
|
+
}
|
84
|
+
}
|
85
|
+
})()
|
86
|
+
const size = 17
|
87
|
+
let left_top = 18 // 内容左上填充
|
88
|
+
let windowWidth = ref(0) // 窗口宽度
|
89
|
+
let windowHeight = ref(0) // 窗口高度
|
90
|
+
let xScale = ref<[{ id: number }]>([{ id: 0 }]) // 水平刻度
|
91
|
+
let yScale = ref<[{ id: number }]>([{ id: 0 }]) // 垂直刻度
|
92
|
+
let topSpacing = 0 // 标尺与窗口上间距
|
93
|
+
let leftSpacing = 0 // 标尺与窗口左间距
|
94
|
+
let isDrag = ref(false)
|
95
|
+
let dragFlag = '' // 拖动开始标记,可能值x(从水平标尺开始拖动);y(从垂直标尺开始拖动)
|
96
|
+
let horizontalDottedLeft = ref(-999) // 水平虚线位置
|
97
|
+
let verticalDottedTop = ref(-999) // 垂直虚线位置
|
98
|
+
let rulerWidth = 0 // 垂直标尺的宽度
|
99
|
+
let rulerHeight = 0 // 水平标尺的高度
|
100
|
+
let dragLineId = '' // 被移动线的ID
|
101
|
+
//ref
|
102
|
+
const content = ref(null)
|
103
|
+
const el = ref(null)
|
104
|
+
const verticalRuler = ref(null)
|
105
|
+
const horizontalRuler = ref(null)
|
106
|
+
const wrapperStyle: any = computed(() => {
|
107
|
+
return {
|
108
|
+
width: windowWidth.value + 'px',
|
109
|
+
height: windowHeight.value + 'px',
|
110
|
+
position: props.position
|
111
|
+
}
|
112
|
+
})
|
113
|
+
const contentStyle = computed(() => {
|
114
|
+
return {
|
115
|
+
left: props.contentLayout.left + 'px',
|
116
|
+
top: props.contentLayout.top + 'px',
|
117
|
+
padding: left_top + 'px 0px 0px ' + left_top + 'px'
|
118
|
+
}
|
119
|
+
})
|
120
|
+
const lineList = computed(() => {
|
121
|
+
let hCount = 0
|
122
|
+
let vCount = 0
|
123
|
+
return props.value.map((item: any) => {
|
124
|
+
const isH = item.type === 'h'
|
125
|
+
return {
|
126
|
+
id: `${item.type}_${isH ? hCount++ : vCount++}`,
|
127
|
+
type: item.type,
|
128
|
+
title: item.site.toFixed(2) + 'px',
|
129
|
+
[isH ? 'top' : 'left']: item.site / (props.stepLength / 50) + size
|
130
|
+
}
|
131
|
+
})
|
132
|
+
})
|
133
|
+
|
134
|
+
svgEditLayoutStore.$subscribe((mutation) => {
|
135
|
+
if (mutation.storeId === 'svg-edit-layout-store') {
|
136
|
+
window.setTimeout(init, 420)
|
137
|
+
}
|
138
|
+
})
|
139
|
+
|
140
|
+
onMounted(() => {
|
141
|
+
on(document, 'mousemove', dottedLineMove)
|
142
|
+
on(document, 'mouseup', dottedLineUp)
|
143
|
+
init()
|
144
|
+
on(window, 'resize', windowResize)
|
145
|
+
})
|
146
|
+
onBeforeUnmount(() => {
|
147
|
+
off(document, 'mousemove', dottedLineMove)
|
148
|
+
off(document, 'mouseup', dottedLineUp)
|
149
|
+
off(window, 'resize', windowResize)
|
150
|
+
})
|
151
|
+
//function
|
152
|
+
const init = () => {
|
153
|
+
box()
|
154
|
+
scaleCalc()
|
155
|
+
}
|
156
|
+
|
157
|
+
const windowResize = () => {
|
158
|
+
xScale.value = [{ id: 0 }]
|
159
|
+
yScale.value = [{ id: 0 }]
|
160
|
+
init()
|
161
|
+
}
|
162
|
+
const getLineStyle = ({ type, top, left }: any) => {
|
163
|
+
return type === 'h' ? { top: top + 'px' } : { left: left + 'px' }
|
164
|
+
}
|
165
|
+
const handleDragLine = ({ type, id }: any) => {
|
166
|
+
return type === 'h' ? dragHorizontalLine(id) : dragVerticalLine(id)
|
167
|
+
}
|
168
|
+
//获取窗口宽与高
|
169
|
+
const box = () => {
|
170
|
+
if (props.isScaleRevise) {
|
171
|
+
// 根据内容部分进行刻度修正
|
172
|
+
const contentLeft = (content.value as any).offsetLeft
|
173
|
+
const contentTop = (content.value as any).offsetTop
|
174
|
+
getCalcRevise(xScale.value, contentLeft)
|
175
|
+
getCalcRevise(yScale.value, contentTop)
|
176
|
+
}
|
177
|
+
if (props.parent) {
|
178
|
+
const style = window.getComputedStyle((el.value as any).parentNode, null)
|
179
|
+
windowWidth.value = parseInt(style.getPropertyValue('width'), 10)
|
180
|
+
windowHeight.value = parseInt(style.getPropertyValue('height'), 10)
|
181
|
+
} else {
|
182
|
+
windowWidth.value = document.documentElement.clientWidth - leftSpacing
|
183
|
+
windowHeight.value = document.documentElement.clientHeight - topSpacing
|
184
|
+
}
|
185
|
+
rulerWidth = (verticalRuler.value as any).clientWidth
|
186
|
+
rulerHeight = (horizontalRuler.value as any).clientHeight
|
187
|
+
setSpacing()
|
188
|
+
}
|
189
|
+
const setSpacing = () => {
|
190
|
+
topSpacing = (horizontalRuler.value as any).getBoundingClientRect().y //.offsetParent.offsetTop
|
191
|
+
leftSpacing = (verticalRuler.value as any).getBoundingClientRect().x // .offsetParent.offsetLeft
|
192
|
+
}
|
193
|
+
// 计算刻度
|
194
|
+
const scaleCalc = () => {
|
195
|
+
getCalc(xScale.value, windowWidth.value)
|
196
|
+
getCalc(yScale.value, windowHeight.value)
|
197
|
+
}
|
198
|
+
|
199
|
+
//获取刻度
|
200
|
+
const getCalc = (array: [{ id: number }], length: any) => {
|
201
|
+
for (let i = 0; i < (length * props.stepLength) / 50; i += props.stepLength) {
|
202
|
+
if (i % props.stepLength === 0 && i != 0) {
|
203
|
+
array.push({ id: i })
|
204
|
+
}
|
205
|
+
}
|
206
|
+
// console.log(array, 225);
|
207
|
+
}
|
208
|
+
// 获取矫正刻度方法
|
209
|
+
const getCalcRevise = (array: [{ id: number }], length: any) => {
|
210
|
+
for (let i = 0; i < length; i += 1) {
|
211
|
+
if (i % props.stepLength === 0 && i + props.stepLength <= length) {
|
212
|
+
array.push({ id: i })
|
213
|
+
}
|
214
|
+
}
|
215
|
+
// console.log(array, 233);
|
216
|
+
}
|
217
|
+
//生成一个参考线
|
218
|
+
const newLine = (val: any) => {
|
219
|
+
isDrag.value = true
|
220
|
+
dragFlag = val
|
221
|
+
}
|
222
|
+
//虚线移动
|
223
|
+
const dottedLineMove = ($event: any) => {
|
224
|
+
setSpacing()
|
225
|
+
switch (dragFlag) {
|
226
|
+
case 'x':
|
227
|
+
if (isDrag.value) {
|
228
|
+
verticalDottedTop.value = $event.pageY - topSpacing
|
229
|
+
}
|
230
|
+
break
|
231
|
+
case 'y':
|
232
|
+
if (isDrag.value) {
|
233
|
+
horizontalDottedLeft.value = $event.pageX - leftSpacing
|
234
|
+
}
|
235
|
+
break
|
236
|
+
case 'h':
|
237
|
+
if (isDrag.value) {
|
238
|
+
verticalDottedTop.value = $event.pageY - topSpacing
|
239
|
+
}
|
240
|
+
break
|
241
|
+
case 'v':
|
242
|
+
if (isDrag.value) {
|
243
|
+
horizontalDottedLeft.value = $event.pageX - leftSpacing
|
244
|
+
}
|
245
|
+
break
|
246
|
+
default:
|
247
|
+
break
|
248
|
+
}
|
249
|
+
}
|
250
|
+
//虚线松开
|
251
|
+
const dottedLineUp = ($event: any) => {
|
252
|
+
setSpacing()
|
253
|
+
if (isDrag.value) {
|
254
|
+
isDrag.value = false
|
255
|
+
const cloneList = JSON.parse(JSON.stringify(props.value))
|
256
|
+
switch (dragFlag) {
|
257
|
+
case 'x':
|
258
|
+
cloneList.push({
|
259
|
+
type: 'h',
|
260
|
+
site: ($event.pageY - topSpacing - size) * (props.stepLength / 50)
|
261
|
+
})
|
262
|
+
context.emit('input', cloneList)
|
263
|
+
break
|
264
|
+
case 'y':
|
265
|
+
cloneList.push({
|
266
|
+
type: 'v',
|
267
|
+
site: ($event.pageX - leftSpacing - size) * (props.stepLength / 50)
|
268
|
+
})
|
269
|
+
context.emit('input', cloneList)
|
270
|
+
break
|
271
|
+
case 'h':
|
272
|
+
dragCalc(cloneList, $event.pageY, topSpacing, rulerHeight, 'h')
|
273
|
+
context.emit('input', cloneList)
|
274
|
+
break
|
275
|
+
case 'v':
|
276
|
+
dragCalc(cloneList, $event.pageX, leftSpacing, rulerWidth, 'v')
|
277
|
+
context.emit('input', cloneList)
|
278
|
+
break
|
279
|
+
default:
|
280
|
+
break
|
281
|
+
}
|
282
|
+
verticalDottedTop.value = horizontalDottedLeft.value = -10
|
283
|
+
}
|
284
|
+
}
|
285
|
+
const dragCalc = (list: any, page: any, spacing: any, ruler: any, type: any) => {
|
286
|
+
if (page - spacing < ruler) {
|
287
|
+
let Index
|
288
|
+
lineList.value.forEach((item: any, index: any) => {
|
289
|
+
if (item.id === dragLineId) {
|
290
|
+
Index = index
|
291
|
+
}
|
292
|
+
})
|
293
|
+
list.splice(Index, 1, {
|
294
|
+
type: type,
|
295
|
+
site: -600
|
296
|
+
})
|
297
|
+
} else {
|
298
|
+
let Index
|
299
|
+
lineList.value.forEach((item, index) => {
|
300
|
+
if (item.id === dragLineId) {
|
301
|
+
Index = index
|
302
|
+
}
|
303
|
+
})
|
304
|
+
list.splice(Index, 1, {
|
305
|
+
type: type,
|
306
|
+
site: (page - spacing - size) * (props.stepLength / 50)
|
307
|
+
})
|
308
|
+
}
|
309
|
+
}
|
310
|
+
//水平标尺按下鼠标
|
311
|
+
const horizontalDragRuler = () => {
|
312
|
+
newLine('x')
|
313
|
+
}
|
314
|
+
//垂直标尺按下鼠标
|
315
|
+
const verticalDragRuler = () => {
|
316
|
+
newLine('y')
|
317
|
+
}
|
318
|
+
// 水平线处按下鼠标
|
319
|
+
const dragHorizontalLine = (id: any) => {
|
320
|
+
isDrag.value = true
|
321
|
+
dragFlag = 'h'
|
322
|
+
dragLineId = id
|
323
|
+
}
|
324
|
+
// 垂直线处按下鼠标
|
325
|
+
const dragVerticalLine = (id: any) => {
|
326
|
+
isDrag.value = true
|
327
|
+
dragFlag = 'v'
|
328
|
+
dragLineId = id
|
329
|
+
}
|
330
|
+
return {
|
331
|
+
wrapperStyle,
|
332
|
+
horizontalDragRuler,
|
333
|
+
xScale,
|
334
|
+
verticalDragRuler,
|
335
|
+
yScale,
|
336
|
+
verticalDottedTop,
|
337
|
+
horizontalDottedLeft,
|
338
|
+
lineList,
|
339
|
+
getLineStyle,
|
340
|
+
handleDragLine,
|
341
|
+
contentStyle,
|
342
|
+
isDrag,
|
343
|
+
content,
|
344
|
+
el,
|
345
|
+
verticalRuler,
|
346
|
+
horizontalRuler
|
347
|
+
}
|
348
|
+
}
|
349
|
+
})
|
350
|
+
</script>
|
351
|
+
|
352
|
+
<template>
|
353
|
+
<div :style="wrapperStyle" class="vue-ruler-wrapper" onselectStart="return false;" ref="el">
|
354
|
+
<section v-show="$props.visible">
|
355
|
+
<div ref="horizontalRuler" class="vue-ruler-h" @mousedown.stop="horizontalDragRuler">
|
356
|
+
<span v-for="(item, index) in xScale" :key="index" :style="{ left: index * 50 + 2 + 'px' }" class="n">{{
|
357
|
+
item.id
|
358
|
+
}}</span>
|
359
|
+
</div>
|
360
|
+
<div ref="verticalRuler" class="vue-ruler-v" @mousedown.stop="verticalDragRuler">
|
361
|
+
<span v-for="(item, index) in yScale" :key="index" :style="{ top: index * 50 + 2 + 'px' }" class="n">{{
|
362
|
+
item.id
|
363
|
+
}}</span>
|
364
|
+
</div>
|
365
|
+
<div :style="{ top: verticalDottedTop + 'px' }" class="vue-ruler-ref-dot-h" />
|
366
|
+
<div :style="{ left: horizontalDottedLeft + 'px' }" class="vue-ruler-ref-dot-v" />
|
367
|
+
<div
|
368
|
+
v-for="item in lineList"
|
369
|
+
:title="item.title"
|
370
|
+
:style="getLineStyle(item)"
|
371
|
+
:key="item.id"
|
372
|
+
:class="`vue-ruler-ref-line-${item.type}`"
|
373
|
+
@mousedown="handleDragLine(item)"
|
374
|
+
></div>
|
375
|
+
</section>
|
376
|
+
<div ref="content" class="vue-ruler-content" :style="contentStyle">
|
377
|
+
<slot />
|
378
|
+
</div>
|
379
|
+
<div v-show="isDrag" class="vue-ruler-content-mask"></div>
|
380
|
+
</div>
|
381
|
+
</template>
|
382
|
+
|
383
|
+
<style lang="less">
|
384
|
+
.vue-ruler-wrapper {
|
385
|
+
left: 0;
|
386
|
+
top: 0;
|
387
|
+
z-index: 999;
|
388
|
+
user-select: none;
|
389
|
+
}
|
390
|
+
|
391
|
+
.vue-ruler-h,
|
392
|
+
.vue-ruler-v,
|
393
|
+
.vue-ruler-ref-line-v,
|
394
|
+
.vue-ruler-ref-line-h,
|
395
|
+
.vue-ruler-ref-dot-h,
|
396
|
+
.vue-ruler-ref-dot-v {
|
397
|
+
position: absolute;
|
398
|
+
left: 0;
|
399
|
+
top: 0;
|
400
|
+
overflow: hidden;
|
401
|
+
z-index: 999;
|
402
|
+
}
|
403
|
+
|
404
|
+
.vue-ruler-h {
|
405
|
+
width: calc(100% - 18px);
|
406
|
+
height: 18px;
|
407
|
+
left: 18px;
|
408
|
+
opacity: 0.6;
|
409
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAASCAMAAAAuTX21AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRFMzMzAAAA////BqjYlAAAACNJREFUeNpiYCAdMDKRCka1jGoBA2JZZGshiaCXFpIBQIABAAplBkCmQpujAAAAAElFTkSuQmCC)
|
410
|
+
repeat-x;
|
411
|
+
/*./image/ruler_h.png*/
|
412
|
+
}
|
413
|
+
|
414
|
+
.vue-ruler-v {
|
415
|
+
width: 18px;
|
416
|
+
height: calc(100% - 18px);
|
417
|
+
top: 18px;
|
418
|
+
opacity: 0.6;
|
419
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAyCAMAAABmvHtTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRFMzMzAAAA////BqjYlAAAACBJREFUeNpiYGBEBwwMTGiAakI0NX7U9aOuHyGuBwgwAH6bBkAR6jkzAAAAAElFTkSuQmCC)
|
420
|
+
repeat-y;
|
421
|
+
/*./image/ruler_v.png*/
|
422
|
+
}
|
423
|
+
|
424
|
+
.vue-ruler-v .n,
|
425
|
+
.vue-ruler-h .n {
|
426
|
+
position: absolute;
|
427
|
+
font:
|
428
|
+
10px/1 Arial,
|
429
|
+
sans-serif;
|
430
|
+
color: #333;
|
431
|
+
cursor: default;
|
432
|
+
top: 1px;
|
433
|
+
}
|
434
|
+
|
435
|
+
.vue-ruler-v .n {
|
436
|
+
width: 8px;
|
437
|
+
left: 3px;
|
438
|
+
word-wrap: break-word;
|
439
|
+
}
|
440
|
+
|
441
|
+
.vue-ruler-ref-line-v,
|
442
|
+
.vue-ruler-ref-line-h,
|
443
|
+
.vue-ruler-ref-dot-h,
|
444
|
+
.vue-ruler-ref-dot-v {
|
445
|
+
z-index: 998;
|
446
|
+
}
|
447
|
+
|
448
|
+
.vue-ruler-ref-line-h {
|
449
|
+
width: 100%;
|
450
|
+
height: 3px;
|
451
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAABCAMAAADU3h9xAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFSv//AAAAH8VRuAAAAA5JREFUeNpiYIACgAADAAAJAAE0lmO3AAAAAElFTkSuQmCC)
|
452
|
+
repeat-x left center;
|
453
|
+
/*./image/line_h.png*/
|
454
|
+
cursor: n-resize;
|
455
|
+
/*url(./image/cur_move_h.cur), move*/
|
456
|
+
}
|
457
|
+
|
458
|
+
.vue-ruler-ref-line-v {
|
459
|
+
width: 3px;
|
460
|
+
height: 100%;
|
461
|
+
_height: 9999px;
|
462
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAICAMAAAAPxGVzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFSv//AAAAH8VRuAAAAA5JREFUeNpiYEAFAAEGAAAQAAGePof9AAAAAElFTkSuQmCC)
|
463
|
+
repeat-y center top;
|
464
|
+
/*./image/line_v.png*/
|
465
|
+
cursor: w-resize;
|
466
|
+
/*url(./image/cur_move_v.cur), move*/
|
467
|
+
}
|
468
|
+
|
469
|
+
.vue-ruler-ref-dot-h {
|
470
|
+
width: 100%;
|
471
|
+
height: 3px;
|
472
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAMAAABFaP0WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFf39/////F3PnHQAAAAJ0Uk5T/wDltzBKAAAAEElEQVR42mJgYGRgZAQIMAAADQAExkizYQAAAABJRU5ErkJggg==)
|
473
|
+
repeat-x left 1px;
|
474
|
+
/*./image/line_dot.png*/
|
475
|
+
cursor: n-resize;
|
476
|
+
/*url(./image/cur_move_h.cur), move*/
|
477
|
+
top: -10px;
|
478
|
+
}
|
479
|
+
|
480
|
+
.vue-ruler-ref-dot-v {
|
481
|
+
width: 3px;
|
482
|
+
height: 100%;
|
483
|
+
_height: 9999px;
|
484
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAMAAABFaP0WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFf39/////F3PnHQAAAAJ0Uk5T/wDltzBKAAAAEElEQVR42mJgYGRgZAQIMAAADQAExkizYQAAAABJRU5ErkJggg==)
|
485
|
+
repeat-y 1px top;
|
486
|
+
/*./image/line_dot.png*/
|
487
|
+
cursor: w-resize;
|
488
|
+
/*url(./image/cur_move_v.cur), move*/
|
489
|
+
left: -10px;
|
490
|
+
}
|
491
|
+
|
492
|
+
.vue-ruler-content {
|
493
|
+
position: absolute;
|
494
|
+
z-index: 997;
|
495
|
+
width: 100%;
|
496
|
+
height: 100%;
|
497
|
+
}
|
498
|
+
|
499
|
+
.vue-ruler-content-mask {
|
500
|
+
position: absolute;
|
501
|
+
width: 100%;
|
502
|
+
height: 100%;
|
503
|
+
background: transparent;
|
504
|
+
z-index: 998;
|
505
|
+
}
|
506
|
+
</style>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { ref } from 'vue'
|
3
|
+
|
4
|
+
const props = withDefaults(defineProps<{ id: string }>(), { id: '' })
|
5
|
+
const nowTime = ref(new Date())
|
6
|
+
const s = nowTime.value.getSeconds()
|
7
|
+
const m = nowTime.value.getMinutes()
|
8
|
+
const h = Math.floor((nowTime.value.getHours() + (m + s / 60) / 60) * 30)
|
9
|
+
</script>
|
10
|
+
<template>
|
11
|
+
<g :id="props.id">
|
12
|
+
<symbol :id="`${props.id}clock-a-n`" viewBox="0 0 1024 1024">
|
13
|
+
<path d="M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z" fill="#429BCF" />
|
14
|
+
<path d="M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z" fill="#FFFFFF" />
|
15
|
+
<path
|
16
|
+
d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z"
|
17
|
+
fill="#2D416C"
|
18
|
+
>
|
19
|
+
<animateTransform
|
20
|
+
attributeName="transform"
|
21
|
+
attributeType="XML"
|
22
|
+
type="rotate"
|
23
|
+
:from="`${-45 + h} 512.3 506.3`"
|
24
|
+
:to="`${315 + h} 512.3 506.3`"
|
25
|
+
dur="43200s"
|
26
|
+
repeatCount="indefinite"
|
27
|
+
/>
|
28
|
+
</path>
|
29
|
+
<path
|
30
|
+
d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z"
|
31
|
+
fill="#365087"
|
32
|
+
>
|
33
|
+
<animateTransform
|
34
|
+
attributeName="transform"
|
35
|
+
attributeType="XML"
|
36
|
+
type="rotate"
|
37
|
+
:from="`${45 + m * 6} 512.3 506.3`"
|
38
|
+
:to="`${405 + m * 6} 512.3 506.3`"
|
39
|
+
dur="3600s"
|
40
|
+
repeatCount="indefinite"
|
41
|
+
/>
|
42
|
+
</path>
|
43
|
+
<path d="M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z" fill="#365087" />
|
44
|
+
<path
|
45
|
+
d="M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z"
|
46
|
+
fill="#2D416C"
|
47
|
+
/>
|
48
|
+
<path
|
49
|
+
d="M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z"
|
50
|
+
fill="#C11B16"
|
51
|
+
>
|
52
|
+
<animateTransform
|
53
|
+
attributeName="transform"
|
54
|
+
attributeType="XML"
|
55
|
+
type="rotate"
|
56
|
+
:from="`${135.5 + s * 6} 512.3 506.3`"
|
57
|
+
:to="`${495.5 + s * 6} 512.3 506.3`"
|
58
|
+
dur="60s"
|
59
|
+
repeatCount="indefinite"
|
60
|
+
/>
|
61
|
+
</path>
|
62
|
+
<path d="M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z" fill="#fff" />
|
63
|
+
</symbol>
|
64
|
+
<use :xlink:href="`#${props.id}clock-a-n`" width="200" height="200" />
|
65
|
+
</g>
|
66
|
+
</template>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<template>
|
2
|
+
<el-table v-bind="table_props">
|
3
|
+
<el-table-column v-for="item in props.colConfig" :key="item.prop" v-bind="item"></el-table-column>
|
4
|
+
</el-table>
|
5
|
+
</template>
|
6
|
+
<script setup lang="ts">
|
7
|
+
import { ref, watchEffect } from 'vue'
|
8
|
+
import { ElTable, ElTableColumn } from 'element-plus'
|
9
|
+
|
10
|
+
const props = withDefaults(
|
11
|
+
defineProps<{
|
12
|
+
colConfig: ICol[]
|
13
|
+
data: any[]
|
14
|
+
height: number
|
15
|
+
maxHeight: number
|
16
|
+
stripe: boolean
|
17
|
+
border: boolean
|
18
|
+
size: string
|
19
|
+
fit: boolean
|
20
|
+
operateDisplay: boolean
|
21
|
+
selectionData: any[]
|
22
|
+
}>(),
|
23
|
+
{
|
24
|
+
colConfig: () => [],
|
25
|
+
data: () => [],
|
26
|
+
stripe: false,
|
27
|
+
border: false,
|
28
|
+
fit: false,
|
29
|
+
operateDisplay: false,
|
30
|
+
selectionData: () => []
|
31
|
+
}
|
32
|
+
)
|
33
|
+
const table_props = ref({})
|
34
|
+
watchEffect(() => {
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
36
|
+
const { colConfig, ...temp_props } = props
|
37
|
+
table_props.value = temp_props
|
38
|
+
})
|
39
|
+
|
40
|
+
interface ICol {
|
41
|
+
prop: string
|
42
|
+
label: string
|
43
|
+
width: string
|
44
|
+
fixed: string | boolean
|
45
|
+
sortable: boolean
|
46
|
+
'show-overflow-tooltip': boolean
|
47
|
+
}
|
48
|
+
</script>
|
49
|
+
<style scoped lang="scss"></style>
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { watch } from 'vue'
|
3
|
+
|
4
|
+
const props = withDefaults(defineProps<{ id: string; isOpen: boolean }>(), {
|
5
|
+
id: '',
|
6
|
+
isOpen: false
|
7
|
+
})
|
8
|
+
|
9
|
+
const emit = defineEmits(['onChange'])
|
10
|
+
|
11
|
+
watch(
|
12
|
+
() => props.isOpen,
|
13
|
+
() => {
|
14
|
+
emit('onChange')
|
15
|
+
}
|
16
|
+
)
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<template>
|
20
|
+
<g :id="props.id" style="cursor: pointer">
|
21
|
+
<symbol :id="`${props.id}light-121`" viewBox="0 0 1024 1024">
|
22
|
+
<path
|
23
|
+
d="M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z"
|
24
|
+
:fill="props.isOpen ? '#FDB813' : '#cccccc'"
|
25
|
+
/>
|
26
|
+
<path
|
27
|
+
d="M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z"
|
28
|
+
:fill="props.isOpen ? '#FD9B13' : '#bbbbbb'"
|
29
|
+
/>
|
30
|
+
<path
|
31
|
+
d="M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z"
|
32
|
+
:fill="props.isOpen ? '#F12A3F' : '#666666'"
|
33
|
+
/>
|
34
|
+
<path
|
35
|
+
d="M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z"
|
36
|
+
fill="#2D4375"
|
37
|
+
/>
|
38
|
+
<path
|
39
|
+
d="M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z"
|
40
|
+
fill="#1E2D4F"
|
41
|
+
/>
|
42
|
+
<path
|
43
|
+
d="M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z"
|
44
|
+
fill="#FDB813"
|
45
|
+
:fill-opacity="props.isOpen ? 1 : 0"
|
46
|
+
/>
|
47
|
+
<path
|
48
|
+
d="M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z"
|
49
|
+
fill="#FDB813"
|
50
|
+
:fill-opacity="props.isOpen ? 1 : 0"
|
51
|
+
/>
|
52
|
+
<path
|
53
|
+
d="M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z"
|
54
|
+
fill="#FDB813"
|
55
|
+
:fill-opacity="props.isOpen ? 1 : 0"
|
56
|
+
/>
|
57
|
+
<path
|
58
|
+
d="M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z"
|
59
|
+
fill="#CEEFF6"
|
60
|
+
/>
|
61
|
+
<path
|
62
|
+
d="M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z"
|
63
|
+
fill="#FFFFFF"
|
64
|
+
/>
|
65
|
+
<path
|
66
|
+
d="M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z"
|
67
|
+
fill="#CEEFF6"
|
68
|
+
/>
|
69
|
+
</symbol>
|
70
|
+
<use :xlink:href="`#${props.id}light-121`" width="100" height="100" />
|
71
|
+
</g>
|
72
|
+
</template>
|