@operato/process 8.0.0-alpha.2 → 8.0.0-alpha.21
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/CHANGELOG.md +130 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-process-template-viewer.d.ts +27 -0
- package/dist/src/ox-process-template-viewer.js +178 -0
- package/dist/src/ox-process-template-viewer.js.map +1 -0
- package/dist/src/selector/process-creation-popup.js +5 -0
- package/dist/src/selector/process-creation-popup.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -11
- package/src/index.ts +1 -0
- package/src/ox-process-template-viewer.ts +198 -0
- package/src/selector/process-creation-popup.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/process",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.21",
|
|
4
4
|
"description": "Webcomponent for business process modeling following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"./package.json": "./package.json",
|
|
22
22
|
"./ox-process-list.js": "./dist/src/ox-process-list.js",
|
|
23
23
|
"./ox-process-viewer.js": "./dist/src/ox-process-viewer.js",
|
|
24
|
+
"./ox-process-template-viewer.js": "./dist/src/ox-process-template-viewer.js",
|
|
24
25
|
"./ox-process-modeller.js": "./dist/src/ox-process-modeller.js",
|
|
25
26
|
"./ox-editor-process-selector.js": "./dist/src/ox-editor-process-selector.js",
|
|
26
27
|
"./ox-property-editor-process-selector.js": "./dist/src/ox-property-editor-process-selector.js",
|
|
@@ -36,6 +37,9 @@
|
|
|
36
37
|
"ox-process-viewer.js": [
|
|
37
38
|
"./dist/src/ox-process-viewer.d.ts"
|
|
38
39
|
],
|
|
40
|
+
"ox-process-template-viewer.js": [
|
|
41
|
+
"./dist/src/ox-process-template-viewer.d.ts"
|
|
42
|
+
],
|
|
39
43
|
"ox-process-modeller.js": [
|
|
40
44
|
"./dist/src/ox-process-modeller.d.ts"
|
|
41
45
|
],
|
|
@@ -70,17 +74,17 @@
|
|
|
70
74
|
},
|
|
71
75
|
"dependencies": {
|
|
72
76
|
"@open-wc/scoped-elements": "^2.1.3",
|
|
73
|
-
"@operato/app": "^8.0.0-alpha.
|
|
74
|
-
"@operato/board": "^8.0.0-alpha.
|
|
75
|
-
"@operato/data-grist": "^8.0.0-alpha.
|
|
76
|
-
"@operato/font": "^8.0.0-alpha.
|
|
77
|
+
"@operato/app": "^8.0.0-alpha.21",
|
|
78
|
+
"@operato/board": "^8.0.0-alpha.21",
|
|
79
|
+
"@operato/data-grist": "^8.0.0-alpha.21",
|
|
80
|
+
"@operato/font": "^8.0.0-alpha.21",
|
|
77
81
|
"@operato/graphql": "^8.0.0-alpha.0",
|
|
78
82
|
"@operato/i18n": "^8.0.0-alpha.0",
|
|
79
|
-
"@operato/input": "^8.0.0-alpha.
|
|
80
|
-
"@operato/markdown": "^8.0.0-alpha.
|
|
81
|
-
"@operato/popup": "^8.0.0-alpha.
|
|
82
|
-
"@operato/property-editor": "^8.0.0-alpha.
|
|
83
|
-
"@operato/styles": "^8.0.0-alpha.
|
|
83
|
+
"@operato/input": "^8.0.0-alpha.21",
|
|
84
|
+
"@operato/markdown": "^8.0.0-alpha.4",
|
|
85
|
+
"@operato/popup": "^8.0.0-alpha.4",
|
|
86
|
+
"@operato/property-editor": "^8.0.0-alpha.21",
|
|
87
|
+
"@operato/styles": "^8.0.0-alpha.4",
|
|
84
88
|
"@operato/utils": "^8.0.0-alpha.0",
|
|
85
89
|
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
86
90
|
"@types/file-saver": "^2.0.4",
|
|
@@ -130,5 +134,5 @@
|
|
|
130
134
|
"prettier --write"
|
|
131
135
|
]
|
|
132
136
|
},
|
|
133
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "2a7eabbdab4073648f5d8bd49c02f2e62b7d3a8a"
|
|
134
138
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '@material/web/fab/fab.js'
|
|
3
|
+
|
|
4
|
+
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { create, SCENE_MODE } from '@hatiolab/things-scene'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-process-template-viewer')
|
|
11
|
+
export class ProcessTemplateViewer extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
width: 100%; /* 전체화면보기를 위해서 필요함. */
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#target {
|
|
26
|
+
flex: 1;
|
|
27
|
+
|
|
28
|
+
width: 100%; /* 전체화면보기를 위해서 필요함. */
|
|
29
|
+
height: 100%;
|
|
30
|
+
|
|
31
|
+
outline: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media print {
|
|
35
|
+
md-fab,
|
|
36
|
+
md-icon {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
@property({ type: Object }) processTemplate: any = {}
|
|
44
|
+
|
|
45
|
+
@state() _scene: any = null
|
|
46
|
+
|
|
47
|
+
@query('#target') _target!: HTMLElement
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
return html` <div id="target"></div> `
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private resizeHandler = () => {
|
|
54
|
+
this._scene && this._scene.fit()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
connectedCallback() {
|
|
58
|
+
super.connectedCallback()
|
|
59
|
+
|
|
60
|
+
window.addEventListener('resize', this.resizeHandler)
|
|
61
|
+
|
|
62
|
+
window.addEventListener('orientationchange', this.resizeHandler)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
disconnectedCallback() {
|
|
66
|
+
window.removeEventListener('resize', this.resizeHandler)
|
|
67
|
+
window.removeEventListener('orientationchange', this.resizeHandler)
|
|
68
|
+
|
|
69
|
+
super.disconnectedCallback()
|
|
70
|
+
|
|
71
|
+
this.closeScene()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
updated(changes: PropertyValues<this>) {
|
|
75
|
+
if (changes.has('processTemplate')) {
|
|
76
|
+
this.closeScene()
|
|
77
|
+
|
|
78
|
+
if (this.processTemplate && this.processTemplate.id) {
|
|
79
|
+
this.initScene()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
initScene() {
|
|
85
|
+
if (!this.processTemplate || !this.processTemplate.id) return
|
|
86
|
+
|
|
87
|
+
this._scene = create({
|
|
88
|
+
model: {
|
|
89
|
+
...this.processTemplate.model
|
|
90
|
+
},
|
|
91
|
+
mode: SCENE_MODE.VIEW
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
this.setupScene({ id: this.processTemplate.id, scene: this._scene })
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
closeScene() {
|
|
98
|
+
if (this._scene) {
|
|
99
|
+
this._scene.target = null
|
|
100
|
+
this._scene.release && this._scene.release()
|
|
101
|
+
|
|
102
|
+
this._scene = null
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
releaseScene() {
|
|
107
|
+
this.closeScene()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
setupScene({ id, scene }: { id: string; scene: any }) {
|
|
111
|
+
this._scene = scene
|
|
112
|
+
|
|
113
|
+
const backgroundColor = this._scene?.root.state.fillStyle
|
|
114
|
+
if (typeof backgroundColor === 'string') {
|
|
115
|
+
this.style.backgroundColor = backgroundColor
|
|
116
|
+
} else {
|
|
117
|
+
this.style.backgroundColor = 'initial'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* scene의 기존 target을 보관한다. */
|
|
121
|
+
|
|
122
|
+
this._scene.fit(this._scene.fitMode)
|
|
123
|
+
this._scene.target = this._target
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* event handlers */
|
|
127
|
+
async getSceneImageData(base64 = false) {
|
|
128
|
+
if (!this._scene) {
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
var { width, height } = this._scene.model
|
|
133
|
+
var pixelRatio = window.devicePixelRatio
|
|
134
|
+
|
|
135
|
+
// 1. Scene의 바운드에 근거하여, 오프스크린 캔바스를 만든다.
|
|
136
|
+
var canvas = document.createElement('canvas')
|
|
137
|
+
canvas.width = Number(width)
|
|
138
|
+
canvas.height = Number(height)
|
|
139
|
+
|
|
140
|
+
var root = this._scene.root
|
|
141
|
+
// 2. 모델레이어의 원래 위치와 스케일을 저장한다.
|
|
142
|
+
var translate = root.get('translate')
|
|
143
|
+
var scale = root.get('scale')
|
|
144
|
+
|
|
145
|
+
// 3. 위치와 스케일 기본 설정.
|
|
146
|
+
root.set('translate', { x: 0, y: 0 })
|
|
147
|
+
root.set('scale', { x: 1 / pixelRatio, y: 1 / pixelRatio })
|
|
148
|
+
|
|
149
|
+
// 4. 오프스크린 캔바스의 Context2D를 구한뒤, 모델레이어를 그 위에 그린다.
|
|
150
|
+
var context = canvas.getContext('2d')
|
|
151
|
+
|
|
152
|
+
root.draw(context)
|
|
153
|
+
|
|
154
|
+
root.set('translate', translate)
|
|
155
|
+
root.set('scale', scale)
|
|
156
|
+
|
|
157
|
+
var data = base64 ? canvas.toDataURL() : context!.getImageData(0, 0, width, height).data
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
data
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async printTrick(image: string) {
|
|
167
|
+
var viewTarget: HTMLElement | null = null
|
|
168
|
+
var printTarget: HTMLImageElement | null = null
|
|
169
|
+
|
|
170
|
+
if (!image) {
|
|
171
|
+
image = (await this.getSceneImageData(true))?.data as string
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
printTarget = document.createElement('img')
|
|
175
|
+
printTarget.id = 'target'
|
|
176
|
+
printTarget.src = image
|
|
177
|
+
printTarget.style.width = '100%'
|
|
178
|
+
printTarget.style.height = '100%'
|
|
179
|
+
|
|
180
|
+
const x = (mql: MediaQueryListEvent) => {
|
|
181
|
+
if (mql.matches) {
|
|
182
|
+
if (!viewTarget) {
|
|
183
|
+
viewTarget = (this.renderRoot as ShadowRoot)!.getElementById('target')
|
|
184
|
+
this.renderRoot.replaceChild(printTarget!, viewTarget!)
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
this.renderRoot.replaceChild(viewTarget!, printTarget!)
|
|
188
|
+
printTarget!.remove()
|
|
189
|
+
mediaQueryList.removeEventListener('change', x)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (window.matchMedia) {
|
|
194
|
+
var mediaQueryList = window.matchMedia('print')
|
|
195
|
+
mediaQueryList.addEventListener('change', x)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -60,6 +60,11 @@ export class ProcessCreationPopup extends localize(i18next)(LitElement) {
|
|
|
60
60
|
flex: 1;
|
|
61
61
|
overflow: hidden;
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
md-text-button {
|
|
65
|
+
--_container-color: var(--md-sys-color-primary);
|
|
66
|
+
--_label-text-color: var(--md-sys-color-on-primary);
|
|
67
|
+
}
|
|
63
68
|
`
|
|
64
69
|
]
|
|
65
70
|
}
|