@operato/process 8.0.0-alpha.5 → 8.0.0-alpha.50
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 +235 -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 +26 -22
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,241 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.0.0-alpha.50](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.49...v8.0.0-alpha.50) (2024-11-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @operato/process
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.0.0-alpha.49](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.48...v8.0.0-alpha.49) (2024-11-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @operato/process
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [8.0.0-alpha.48](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.47...v8.0.0-alpha.48) (2024-11-13)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @operato/process
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [8.0.0-alpha.46](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.45...v8.0.0-alpha.46) (2024-10-23)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @operato/process
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [8.0.0-alpha.45](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.44...v8.0.0-alpha.45) (2024-10-23)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @operato/process
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [8.0.0-alpha.44](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.43...v8.0.0-alpha.44) (2024-10-23)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @operato/process
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [8.0.0-alpha.43](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.42...v8.0.0-alpha.43) (2024-10-22)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @operato/process
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## [8.0.0-alpha.42](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.41...v8.0.0-alpha.42) (2024-10-21)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @operato/process
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## [8.0.0-alpha.41](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.40...v8.0.0-alpha.41) (2024-10-21)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @operato/process
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## [8.0.0-alpha.37](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.36...v8.0.0-alpha.37) (2024-10-20)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### :bug: Bug Fix
|
|
82
|
+
|
|
83
|
+
* update dev-dependencies version ([d6fe342](https://github.com/heartyoh/ioperato/commit/d6fe342de738c6bad3528550a862b5a1d2573161))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## [8.0.0-alpha.34](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.33...v8.0.0-alpha.34) (2024-10-15)
|
|
88
|
+
|
|
89
|
+
**Note:** Version bump only for package @operato/process
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## [8.0.0-alpha.33](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.32...v8.0.0-alpha.33) (2024-10-14)
|
|
96
|
+
|
|
97
|
+
**Note:** Version bump only for package @operato/process
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## [8.0.0-alpha.30](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.29...v8.0.0-alpha.30) (2024-10-11)
|
|
104
|
+
|
|
105
|
+
**Note:** Version bump only for package @operato/process
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## [8.0.0-alpha.29](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.28...v8.0.0-alpha.29) (2024-10-10)
|
|
112
|
+
|
|
113
|
+
**Note:** Version bump only for package @operato/process
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## [8.0.0-alpha.27](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.26...v8.0.0-alpha.27) (2024-10-06)
|
|
120
|
+
|
|
121
|
+
**Note:** Version bump only for package @operato/process
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## [8.0.0-alpha.26](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.25...v8.0.0-alpha.26) (2024-10-06)
|
|
128
|
+
|
|
129
|
+
**Note:** Version bump only for package @operato/process
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## [8.0.0-alpha.21](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.20...v8.0.0-alpha.21) (2024-10-05)
|
|
136
|
+
|
|
137
|
+
**Note:** Version bump only for package @operato/process
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## [8.0.0-alpha.20](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.19...v8.0.0-alpha.20) (2024-10-04)
|
|
144
|
+
|
|
145
|
+
**Note:** Version bump only for package @operato/process
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## [8.0.0-alpha.19](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.18...v8.0.0-alpha.19) (2024-10-04)
|
|
152
|
+
|
|
153
|
+
**Note:** Version bump only for package @operato/process
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## [8.0.0-alpha.16](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.15...v8.0.0-alpha.16) (2024-10-03)
|
|
160
|
+
|
|
161
|
+
**Note:** Version bump only for package @operato/process
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
## [8.0.0-alpha.15](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.14...v8.0.0-alpha.15) (2024-10-03)
|
|
168
|
+
|
|
169
|
+
**Note:** Version bump only for package @operato/process
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## [8.0.0-alpha.14](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.13...v8.0.0-alpha.14) (2024-10-02)
|
|
176
|
+
|
|
177
|
+
**Note:** Version bump only for package @operato/process
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
## [8.0.0-alpha.12](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.11...v8.0.0-alpha.12) (2024-09-23)
|
|
184
|
+
|
|
185
|
+
**Note:** Version bump only for package @operato/process
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## [8.0.0-alpha.11](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.10...v8.0.0-alpha.11) (2024-09-21)
|
|
192
|
+
|
|
193
|
+
**Note:** Version bump only for package @operato/process
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
## [8.0.0-alpha.10](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.9...v8.0.0-alpha.10) (2024-09-18)
|
|
200
|
+
|
|
201
|
+
**Note:** Version bump only for package @operato/process
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
## [8.0.0-alpha.9](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.8...v8.0.0-alpha.9) (2024-09-15)
|
|
208
|
+
|
|
209
|
+
**Note:** Version bump only for package @operato/process
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## [8.0.0-alpha.8](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.7...v8.0.0-alpha.8) (2024-09-15)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
### :bug: Bug Fix
|
|
219
|
+
|
|
220
|
+
* synchronize ox-process-creation-popup with ox-board-creation-popup ([eb4d739](https://github.com/heartyoh/ioperato/commit/eb4d739c0ac04c2475b32b2a3423b29b6404b223))
|
|
221
|
+
* template viewer for board and process ([535433c](https://github.com/heartyoh/ioperato/commit/535433c7227190714a14cc0d1089a99e1075a381))
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
## [8.0.0-alpha.7](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.6...v8.0.0-alpha.7) (2024-09-14)
|
|
226
|
+
|
|
227
|
+
**Note:** Version bump only for package @operato/process
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
## [8.0.0-alpha.6](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.5...v8.0.0-alpha.6) (2024-09-14)
|
|
234
|
+
|
|
235
|
+
**Note:** Version bump only for package @operato/process
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
6
241
|
## [8.0.0-alpha.5](https://github.com/heartyoh/ioperato/compare/v8.0.0-alpha.4...v8.0.0-alpha.5) (2024-09-12)
|
|
7
242
|
|
|
8
243
|
**Note:** Version bump only for package @operato/process
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { DataStorage } from './data-storage/data-storage.js';
|
|
|
3
3
|
export * from './ox-process-viewer.js';
|
|
4
4
|
export * from './ox-process-modeller.js';
|
|
5
5
|
export * from './ox-process-list.js';
|
|
6
|
+
export * from './ox-process-template-viewer.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAE5D,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA","sourcesContent":["export * from './types.js'\n\nexport { DataStorage } from './data-storage/data-storage.js'\n\nexport * from './ox-process-viewer.js'\nexport * from './ox-process-modeller.js'\nexport * from './ox-process-list.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAE5D,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA","sourcesContent":["export * from './types.js'\n\nexport { DataStorage } from './data-storage/data-storage.js'\n\nexport * from './ox-process-viewer.js'\nexport * from './ox-process-modeller.js'\nexport * from './ox-process-list.js'\nexport * from './ox-process-template-viewer.js'\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
2
|
+
import '@material/web/fab/fab.js';
|
|
3
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
4
|
+
export declare class ProcessTemplateViewer extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
processTemplate: any;
|
|
7
|
+
_scene: any;
|
|
8
|
+
_target: HTMLElement;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
private resizeHandler;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
updated(changes: PropertyValues<this>): void;
|
|
14
|
+
initScene(): void;
|
|
15
|
+
closeScene(): void;
|
|
16
|
+
releaseScene(): void;
|
|
17
|
+
setupScene({ id, scene }: {
|
|
18
|
+
id: string;
|
|
19
|
+
scene: any;
|
|
20
|
+
}): void;
|
|
21
|
+
getSceneImageData(base64?: boolean): Promise<{
|
|
22
|
+
width: any;
|
|
23
|
+
height: any;
|
|
24
|
+
data: string | Uint8ClampedArray;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
printTrick(image: string): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@material/web/fab/fab.js';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
6
|
+
import { create, SCENE_MODE } from '@hatiolab/things-scene';
|
|
7
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
8
|
+
let ProcessTemplateViewer = class ProcessTemplateViewer extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.processTemplate = {};
|
|
12
|
+
this._scene = null;
|
|
13
|
+
this.resizeHandler = () => {
|
|
14
|
+
this._scene && this._scene.fit();
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return html ` <div id="target"></div> `;
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback();
|
|
22
|
+
window.addEventListener('resize', this.resizeHandler);
|
|
23
|
+
window.addEventListener('orientationchange', this.resizeHandler);
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
window.removeEventListener('resize', this.resizeHandler);
|
|
27
|
+
window.removeEventListener('orientationchange', this.resizeHandler);
|
|
28
|
+
super.disconnectedCallback();
|
|
29
|
+
this.closeScene();
|
|
30
|
+
}
|
|
31
|
+
updated(changes) {
|
|
32
|
+
if (changes.has('processTemplate')) {
|
|
33
|
+
this.closeScene();
|
|
34
|
+
if (this.processTemplate && this.processTemplate.id) {
|
|
35
|
+
this.initScene();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
initScene() {
|
|
40
|
+
if (!this.processTemplate || !this.processTemplate.id)
|
|
41
|
+
return;
|
|
42
|
+
this._scene = create({
|
|
43
|
+
model: {
|
|
44
|
+
...this.processTemplate.model
|
|
45
|
+
},
|
|
46
|
+
mode: SCENE_MODE.VIEW
|
|
47
|
+
});
|
|
48
|
+
this.setupScene({ id: this.processTemplate.id, scene: this._scene });
|
|
49
|
+
}
|
|
50
|
+
closeScene() {
|
|
51
|
+
if (this._scene) {
|
|
52
|
+
this._scene.target = null;
|
|
53
|
+
this._scene.release && this._scene.release();
|
|
54
|
+
this._scene = null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
releaseScene() {
|
|
58
|
+
this.closeScene();
|
|
59
|
+
}
|
|
60
|
+
setupScene({ id, scene }) {
|
|
61
|
+
var _a;
|
|
62
|
+
this._scene = scene;
|
|
63
|
+
const backgroundColor = (_a = this._scene) === null || _a === void 0 ? void 0 : _a.root.state.fillStyle;
|
|
64
|
+
if (typeof backgroundColor === 'string') {
|
|
65
|
+
this.style.backgroundColor = backgroundColor;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.style.backgroundColor = 'initial';
|
|
69
|
+
}
|
|
70
|
+
/* scene의 기존 target을 보관한다. */
|
|
71
|
+
this._scene.fit(this._scene.fitMode);
|
|
72
|
+
this._scene.target = this._target;
|
|
73
|
+
}
|
|
74
|
+
/* event handlers */
|
|
75
|
+
async getSceneImageData(base64 = false) {
|
|
76
|
+
if (!this._scene) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var { width, height } = this._scene.model;
|
|
80
|
+
var pixelRatio = window.devicePixelRatio;
|
|
81
|
+
// 1. Scene의 바운드에 근거하여, 오프스크린 캔바스를 만든다.
|
|
82
|
+
var canvas = document.createElement('canvas');
|
|
83
|
+
canvas.width = Number(width);
|
|
84
|
+
canvas.height = Number(height);
|
|
85
|
+
var root = this._scene.root;
|
|
86
|
+
// 2. 모델레이어의 원래 위치와 스케일을 저장한다.
|
|
87
|
+
var translate = root.get('translate');
|
|
88
|
+
var scale = root.get('scale');
|
|
89
|
+
// 3. 위치와 스케일 기본 설정.
|
|
90
|
+
root.set('translate', { x: 0, y: 0 });
|
|
91
|
+
root.set('scale', { x: 1 / pixelRatio, y: 1 / pixelRatio });
|
|
92
|
+
// 4. 오프스크린 캔바스의 Context2D를 구한뒤, 모델레이어를 그 위에 그린다.
|
|
93
|
+
var context = canvas.getContext('2d');
|
|
94
|
+
root.draw(context);
|
|
95
|
+
root.set('translate', translate);
|
|
96
|
+
root.set('scale', scale);
|
|
97
|
+
var data = base64 ? canvas.toDataURL() : context.getImageData(0, 0, width, height).data;
|
|
98
|
+
return {
|
|
99
|
+
width,
|
|
100
|
+
height,
|
|
101
|
+
data
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
async printTrick(image) {
|
|
105
|
+
var _a;
|
|
106
|
+
var viewTarget = null;
|
|
107
|
+
var printTarget = null;
|
|
108
|
+
if (!image) {
|
|
109
|
+
image = (_a = (await this.getSceneImageData(true))) === null || _a === void 0 ? void 0 : _a.data;
|
|
110
|
+
}
|
|
111
|
+
printTarget = document.createElement('img');
|
|
112
|
+
printTarget.id = 'target';
|
|
113
|
+
printTarget.src = image;
|
|
114
|
+
printTarget.style.width = '100%';
|
|
115
|
+
printTarget.style.height = '100%';
|
|
116
|
+
const x = (mql) => {
|
|
117
|
+
if (mql.matches) {
|
|
118
|
+
if (!viewTarget) {
|
|
119
|
+
viewTarget = this.renderRoot.getElementById('target');
|
|
120
|
+
this.renderRoot.replaceChild(printTarget, viewTarget);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.renderRoot.replaceChild(viewTarget, printTarget);
|
|
125
|
+
printTarget.remove();
|
|
126
|
+
mediaQueryList.removeEventListener('change', x);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
if (window.matchMedia) {
|
|
130
|
+
var mediaQueryList = window.matchMedia('print');
|
|
131
|
+
mediaQueryList.addEventListener('change', x);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
ProcessTemplateViewer.styles = [
|
|
136
|
+
ScrollbarStyles,
|
|
137
|
+
css `
|
|
138
|
+
:host {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
|
|
142
|
+
position: relative;
|
|
143
|
+
|
|
144
|
+
width: 100%; /* 전체화면보기를 위해서 필요함. */
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#target {
|
|
149
|
+
flex: 1;
|
|
150
|
+
|
|
151
|
+
width: 100%; /* 전체화면보기를 위해서 필요함. */
|
|
152
|
+
height: 100%;
|
|
153
|
+
|
|
154
|
+
outline: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@media print {
|
|
158
|
+
md-fab,
|
|
159
|
+
md-icon {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`
|
|
164
|
+
];
|
|
165
|
+
__decorate([
|
|
166
|
+
property({ type: Object })
|
|
167
|
+
], ProcessTemplateViewer.prototype, "processTemplate", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
state()
|
|
170
|
+
], ProcessTemplateViewer.prototype, "_scene", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
query('#target')
|
|
173
|
+
], ProcessTemplateViewer.prototype, "_target", void 0);
|
|
174
|
+
ProcessTemplateViewer = __decorate([
|
|
175
|
+
customElement('ox-process-template-viewer')
|
|
176
|
+
], ProcessTemplateViewer);
|
|
177
|
+
export { ProcessTemplateViewer };
|
|
178
|
+
//# sourceMappingURL=ox-process-template-viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-process-template-viewer.js","sourceRoot":"","sources":["../../src/ox-process-template-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,E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,EAAE,CAAC,CAAC,CAAA;YACjD,CAAC;QACH,CAAC,CAAA;QAED,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;YAC/C,cAAc,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;;AAzLM,4BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BF;CACF,AA7BY,CA6BZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAA0B;AAE5C;IAAR,KAAK,EAAE;qDAAmB;AAET;IAAjB,KAAK,CAAC,SAAS,CAAC;sDAAsB;AApC5B,qBAAqB;IADjC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,qBAAqB,CA2LjC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/fab/fab.js'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { create, SCENE_MODE } from '@hatiolab/things-scene'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-process-template-viewer')\nexport class ProcessTemplateViewer extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n overflow: hidden;\n }\n\n #target {\n flex: 1;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n height: 100%;\n\n outline: 0;\n }\n\n @media print {\n md-fab,\n md-icon {\n display: none;\n }\n }\n `\n ]\n\n @property({ type: Object }) processTemplate: any = {}\n\n @state() _scene: any = null\n\n @query('#target') _target!: HTMLElement\n\n render() {\n return html` <div id=\"target\"></div> `\n }\n\n private resizeHandler = () => {\n this._scene && this._scene.fit()\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n window.addEventListener('resize', this.resizeHandler)\n\n window.addEventListener('orientationchange', this.resizeHandler)\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.resizeHandler)\n window.removeEventListener('orientationchange', this.resizeHandler)\n\n super.disconnectedCallback()\n\n this.closeScene()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('processTemplate')) {\n this.closeScene()\n\n if (this.processTemplate && this.processTemplate.id) {\n this.initScene()\n }\n }\n }\n\n initScene() {\n if (!this.processTemplate || !this.processTemplate.id) return\n\n this._scene = create({\n model: {\n ...this.processTemplate.model\n },\n mode: SCENE_MODE.VIEW\n })\n\n this.setupScene({ id: this.processTemplate.id, scene: this._scene })\n }\n\n closeScene() {\n if (this._scene) {\n this._scene.target = null\n this._scene.release && this._scene.release()\n\n this._scene = null\n }\n }\n\n releaseScene() {\n this.closeScene()\n }\n\n setupScene({ id, scene }: { id: string; scene: any }) {\n this._scene = scene\n\n const backgroundColor = this._scene?.root.state.fillStyle\n if (typeof backgroundColor === 'string') {\n this.style.backgroundColor = backgroundColor\n } else {\n this.style.backgroundColor = 'initial'\n }\n\n /* scene의 기존 target을 보관한다. */\n\n this._scene.fit(this._scene.fitMode)\n this._scene.target = this._target\n }\n\n /* event handlers */\n async getSceneImageData(base64 = false) {\n if (!this._scene) {\n return\n }\n\n var { width, height } = this._scene.model\n var pixelRatio = window.devicePixelRatio\n\n // 1. Scene의 바운드에 근거하여, 오프스크린 캔바스를 만든다.\n var canvas = document.createElement('canvas')\n canvas.width = Number(width)\n canvas.height = Number(height)\n\n var root = this._scene.root\n // 2. 모델레이어의 원래 위치와 스케일을 저장한다.\n var translate = root.get('translate')\n var scale = root.get('scale')\n\n // 3. 위치와 스케일 기본 설정.\n root.set('translate', { x: 0, y: 0 })\n root.set('scale', { x: 1 / pixelRatio, y: 1 / pixelRatio })\n\n // 4. 오프스크린 캔바스의 Context2D를 구한뒤, 모델레이어를 그 위에 그린다.\n var context = canvas.getContext('2d')\n\n root.draw(context)\n\n root.set('translate', translate)\n root.set('scale', scale)\n\n var data = base64 ? canvas.toDataURL() : context!.getImageData(0, 0, width, height).data\n\n return {\n width,\n height,\n data\n }\n }\n\n async printTrick(image: string) {\n var viewTarget: HTMLElement | null = null\n var printTarget: HTMLImageElement | null = null\n\n if (!image) {\n image = (await this.getSceneImageData(true))?.data as string\n }\n\n printTarget = document.createElement('img')\n printTarget.id = 'target'\n printTarget.src = image\n printTarget.style.width = '100%'\n printTarget.style.height = '100%'\n\n const x = (mql: MediaQueryListEvent) => {\n if (mql.matches) {\n if (!viewTarget) {\n viewTarget = (this.renderRoot as ShadowRoot)!.getElementById('target')\n this.renderRoot.replaceChild(printTarget!, viewTarget!)\n }\n } else {\n this.renderRoot.replaceChild(viewTarget!, printTarget!)\n printTarget!.remove()\n mediaQueryList.removeEventListener('change', x)\n }\n }\n\n if (window.matchMedia) {\n var mediaQueryList = window.matchMedia('print')\n mediaQueryList.addEventListener('change', x)\n }\n }\n}\n"]}
|
|
@@ -56,6 +56,11 @@ let ProcessCreationPopup = class ProcessCreationPopup extends localize(i18next)(
|
|
|
56
56
|
flex: 1;
|
|
57
57
|
overflow: hidden;
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
md-text-button {
|
|
61
|
+
--_container-color: var(--md-sys-color-primary);
|
|
62
|
+
--_label-text-color: var(--md-sys-color-on-primary);
|
|
63
|
+
}
|
|
59
64
|
`
|
|
60
65
|
];
|
|
61
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-creation-popup.js","sourceRoot":"","sources":["../../../src/selector/process-creation-popup.ts"],"names":[],"mappings":";AAAA,OAAO,8CAA8C,CAAA;AACrD,OAAO,qCAAqC,CAAA;AAC5C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,6BAA6B,CAAA;AAEpC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,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AAQ,CAAE,SAAS;aAC/B;SACF,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AA/E6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAsB;AACtB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAwC;AAE/B;IAAlC,KAAK,CAAC,0BAA0B,CAAC;iEAA4C;AA7DnE,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAyIhC","sourcesContent":["import '@material/web/textfield/filled-text-field.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/select/filled-select.js'\nimport '@material/web/select/select-option.js'\nimport '../ox-process-template-list'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { OxProcessTemplateList } from '../ox-process-template-list'\n\n@customElement('process-creation-popup')\nexport class ProcessCreationPopup extends localize(i18next)(LitElement) {\n static get styles() {\n return [\n css`\n :host {\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 10px;\n\n background-color: var(--md-sys-color-surface);\n }\n\n [body] {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n\n overflow: hidden;\n }\n\n [content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n gap: 10px;\n\n overflow: auto;\n }\n\n [content] > md-filled-text-field[type='textarea'] {\n flex: 1;\n resize: none;\n }\n\n [templates] {\n flex: 2;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n [templates] > ox-process-template-list {\n flex: 1;\n overflow: hidden;\n }\n\n md-text-button {\n --_container-color: var(--md-sys-color-primary);\n --_label-text-color: var(--md-sys-color-on-primary);\n }\n `\n ]\n }\n\n @property({ type: String }) defaultGroup?: string\n @property({ type: Array }) groups?: { id: string; name: string }[]\n\n @query('ox-process-template-list') processTemplateList!: OxProcessTemplateList\n\n render() {\n var groups = this.groups || []\n\n return html`\n <div body>\n <div content>\n <md-filled-text-field\n label=${String(i18next.t('label.name'))}\n name=\"name\"\n required\n field-name\n ></md-filled-text-field>\n <md-filled-text-field\n type=\"textarea\"\n label=${String(i18next.t('label.description'))}\n name=\"description\"\n field-description\n ></md-filled-text-field>\n <md-filled-select\n label=${String(i18next.t('label.group'))}\n field-group\n helper=\"If there is no group to choose, you can leave it empty.\"\n >\n ${groups.map(\n group => html`\n <md-select-option value=${group.id} ?selected=${this.defaultGroup == group.id}\n >${group.name}</md-select-option\n >\n `\n )}\n </md-filled-select>\n </div>\n\n <div templates>\n <div>${i18next.t('label.process-template')}</div>\n <ox-process-template-list></ox-process-template-list>\n </div>\n </div>\n\n <md-text-button @click=${(e: MouseEvent) => this.onClickSubmit()}\n >${String(i18next.t('button.create'))}</md-text-button\n >\n `\n }\n\n firstUpdated() {\n setTimeout(() => {\n ;(this.renderRoot.querySelector('md-filled-text-field') as any)?.focus()\n }, 100)\n }\n\n async onClickSubmit() {\n var [name, description, groupId] = ['name', 'description', 'group'].map(attr => {\n return (this.renderRoot.querySelector(`[field-${attr}]`) as any)?.value\n })\n\n if (!name) {\n return\n }\n\n const template = await this.processTemplateList.getSelected()\n\n this.dispatchEvent(\n new CustomEvent('create-process', {\n detail: {\n name,\n description,\n groupId,\n model: template?.model,\n thumbnail: template?.thumbnail\n }\n })\n )\n }\n}\n"]}
|