@operato/process 7.1.31 → 7.1.32
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 +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/demo/index-modeller.html +0 -112
- package/demo/index-viewer.html +0 -112
- package/demo/index.html +0 -112
- package/src/data-storage/data-storage.ts +0 -47
- package/src/graphql/data-subscription.ts +0 -30
- package/src/graphql/favorite-process.ts +0 -25
- package/src/graphql/index.ts +0 -3
- package/src/graphql/process-group.ts +0 -138
- package/src/graphql/process.ts +0 -141
- package/src/graphql/scenario.ts +0 -79
- package/src/index.ts +0 -8
- package/src/modeller/component-toolbar/component-detail.ts +0 -58
- package/src/modeller/component-toolbar/component-menu.ts +0 -193
- package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
- package/src/modeller/component-toolbar/mode-icons.ts +0 -88
- package/src/modeller/edit-toolbar-style.ts +0 -229
- package/src/modeller/edit-toolbar.ts +0 -576
- package/src/modeller/property-sidebar/abstract-property.ts +0 -69
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -479
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
- package/src/modeller/property-sidebar/effects/effects.ts +0 -52
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -201
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -212
- package/src/modeller/property-sidebar/effects/property-event.ts +0 -76
- package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
- package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
- package/src/modeller/property-sidebar/inspector/inspector.ts +0 -408
- package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
- package/src/modeller/property-sidebar/property-sidebar.ts +0 -342
- package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
- package/src/modeller/property-sidebar/shapes/shapes.ts +0 -410
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -147
- package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
- package/src/modeller/property-sidebar/styles/styles.ts +0 -577
- package/src/ox-editor-process-selector.ts +0 -91
- package/src/ox-process-list.ts +0 -401
- package/src/ox-process-modeller.ts +0 -432
- package/src/ox-process-template-list.ts +0 -272
- package/src/ox-process-template-viewer.ts +0 -198
- package/src/ox-process-viewer.ts +0 -575
- package/src/ox-property-editor-process-selector.ts +0 -23
- package/src/selector/ox-process-creation-card.ts +0 -95
- package/src/selector/ox-process-selector.ts +0 -324
- package/src/selector/process-creation-popup.ts +0 -151
- package/src/selector/process-thumbnail-card.ts +0 -175
- package/src/types.ts +0 -57
- package/stories/index.stories.ts +0 -54
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -30
- package/web-test-runner.config.mjs +0 -29
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
import '@material/web/fab/fab.js'
|
|
3
|
-
|
|
4
|
-
import '@operato/board/ox-scene-handler.js'
|
|
5
|
-
import '@operato/board/ox-scene-layer.js'
|
|
6
|
-
import '@operato/board/ox-scene-property.js'
|
|
7
|
-
import '@operato/board/ox-scene-viewer.js'
|
|
8
|
-
import '@hatiolab/things-scene'
|
|
9
|
-
import './ox-process-viewer'
|
|
10
|
-
|
|
11
|
-
import { saveAs } from 'file-saver'
|
|
12
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
13
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
14
|
-
|
|
15
|
-
import { Scene, SCENE_MODE } from '@hatiolab/things-scene'
|
|
16
|
-
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
17
|
-
import { OxPopup } from '@operato/popup'
|
|
18
|
-
import { isMacOS, togglefullscreen } from '@operato/utils'
|
|
19
|
-
|
|
20
|
-
import { ComponentToolbar } from './modeller/component-toolbar/component-toolbar'
|
|
21
|
-
import { EditToolbar } from './modeller/edit-toolbar'
|
|
22
|
-
import { PropertySidebar } from './modeller/property-sidebar/property-sidebar'
|
|
23
|
-
import { ComponentGroup, ComponentTemplate } from './types'
|
|
24
|
-
|
|
25
|
-
const MACOS = isMacOS()
|
|
26
|
-
|
|
27
|
-
const ICON_PROPERTIES = new URL('../../icons/icon-properties.png', import.meta.url).href
|
|
28
|
-
const ICON_PROPERTIES_LINE_TYPE = new URL('../../icons/icon-properties-line-type.png', import.meta.url).href
|
|
29
|
-
const ICON_PROPERTIES_ARROW_TYPE = new URL('../../icons/icon-properties-arrow-type.png', import.meta.url).href
|
|
30
|
-
const ICON_PROPERTIES_LABEL = new URL('../../icons/icon-properties-label.png', import.meta.url).href
|
|
31
|
-
const ICON_PROPERTIES_PADDING = new URL('../../icons/icon-properties-padding.png', import.meta.url).href
|
|
32
|
-
|
|
33
|
-
const ICON_HTOOLBAR = new URL('../../icons/icon-htoolbar.png', import.meta.url).href
|
|
34
|
-
const ICON_FULLSCREEN = new URL('../../icons/icon-fullscreen.png', import.meta.url).href
|
|
35
|
-
const ICON_COLLAPSE = new URL('../../icons/icon-collapse.png', import.meta.url).href
|
|
36
|
-
const ICON_COLLAPSE_ACTIVE = new URL('../../icons/icon-collapse-active.png', import.meta.url).href
|
|
37
|
-
|
|
38
|
-
const ICON_SHELL_INSPECTOR = new URL('../../icons/icon-shell-inspector.png', import.meta.url).href
|
|
39
|
-
|
|
40
|
-
var Registry: ComponentGroup[] = []
|
|
41
|
-
|
|
42
|
-
@customElement('ox-process-modeller')
|
|
43
|
-
export class OxProcessModeller extends ScopedElementsMixin(LitElement) {
|
|
44
|
-
static styles = [
|
|
45
|
-
css`
|
|
46
|
-
:host {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
|
|
50
|
-
height: 100%;
|
|
51
|
-
overflow: hidden;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
process-edit-toolbar {
|
|
55
|
-
flex: 45px;
|
|
56
|
-
max-height: 45px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
div[content] {
|
|
60
|
-
flex: 1;
|
|
61
|
-
max-height: calc(100% - 45px);
|
|
62
|
-
|
|
63
|
-
display: flex;
|
|
64
|
-
flex-direction: row;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process-component-toolbar {
|
|
68
|
-
max-height: 100%;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
process-property-sidebar {
|
|
72
|
-
overflow: hidden;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
#scene-wrap {
|
|
76
|
-
position: relative;
|
|
77
|
-
|
|
78
|
-
flex: 1;
|
|
79
|
-
display: flex;
|
|
80
|
-
flex-direction: row;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
ox-scene-viewer {
|
|
84
|
-
flex: 1;
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: 100%;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
md-fab {
|
|
90
|
-
position: absolute;
|
|
91
|
-
right: 15px;
|
|
92
|
-
bottom: 15px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
ox-popup {
|
|
96
|
-
width: 90%;
|
|
97
|
-
height: 90%;
|
|
98
|
-
left: 50%;
|
|
99
|
-
top: 50%;
|
|
100
|
-
transform: translateX(-50%) translateY(-50%);
|
|
101
|
-
background: var(--md-sys-color-on-secondary-container, black);
|
|
102
|
-
|
|
103
|
-
display: flex;
|
|
104
|
-
justify-content: center;
|
|
105
|
-
flex-direction: column;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
ox-process-viewer {
|
|
109
|
-
width: 98%;
|
|
110
|
-
height: 98%;
|
|
111
|
-
margin: auto;
|
|
112
|
-
padding: 0;
|
|
113
|
-
}
|
|
114
|
-
`
|
|
115
|
-
]
|
|
116
|
-
|
|
117
|
-
static registerGroup(group: ComponentGroup) {
|
|
118
|
-
var found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name)
|
|
119
|
-
|
|
120
|
-
if (found) {
|
|
121
|
-
found = {
|
|
122
|
-
...found,
|
|
123
|
-
...group
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
Registry.push(group)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static registerTemplate(templates: ComponentTemplate[]): void {
|
|
131
|
-
templates &&
|
|
132
|
-
templates.forEach(template => {
|
|
133
|
-
var groups: string[] = typeof template.group == 'string' ? [template.group] : template.group
|
|
134
|
-
|
|
135
|
-
Registry.filter(group => groups.includes(group.name)).forEach(group => {
|
|
136
|
-
if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {
|
|
137
|
-
group.templates.push(template)
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
static get groups(): ComponentGroup[] {
|
|
144
|
-
return Registry
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
static getGroup(name: string) {
|
|
148
|
-
return Registry.find(group => group.name === name)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
@property({ type: String }) processName: string = ''
|
|
152
|
-
@property({ type: Object }) model: any = null
|
|
153
|
-
@property({ type: String }) baseUrl: string = ''
|
|
154
|
-
@property({ type: Array }) selected: any[] = []
|
|
155
|
-
@property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.EDIT
|
|
156
|
-
@property({ type: Object }) provider: any = null
|
|
157
|
-
@property({ type: Boolean }) hideProperty: boolean = false
|
|
158
|
-
@property({ type: String }) overlay: string = ''
|
|
159
|
-
@property({ type: Object }) scene?: Scene
|
|
160
|
-
@property({ type: Array }) componentGroupList: any[] = []
|
|
161
|
-
@property({ type: Array }) fonts: any[] = []
|
|
162
|
-
@property({ type: Array }) propertyEditor: any[] = []
|
|
163
|
-
|
|
164
|
-
@property({ type: Boolean, attribute: 'hide-data-binding' }) hideDataBinding: boolean = false
|
|
165
|
-
@property({ type: Boolean, attribute: 'hide-effect' }) hideEffect: boolean = false
|
|
166
|
-
@property({ type: Boolean, attribute: 'hide-inspector' }) hideInspector: boolean = false
|
|
167
|
-
@property({ type: Boolean, attribute: 'hide-shape' }) hideShape: boolean = false
|
|
168
|
-
@property({ type: Boolean, attribute: 'hide-style' }) hideStyle: boolean = false
|
|
169
|
-
@property({ type: Boolean, attribute: 'hide-specific' }) hideSpecific: boolean = false
|
|
170
|
-
|
|
171
|
-
@query('process-edit-toolbar') private editToolbar!: EditToolbar
|
|
172
|
-
|
|
173
|
-
private group: string = ''
|
|
174
|
-
private shortcutHandler?: (e: KeyboardEvent) => void
|
|
175
|
-
|
|
176
|
-
constructor() {
|
|
177
|
-
super()
|
|
178
|
-
|
|
179
|
-
document.addEventListener('get-all-scene-component-ids', (e: Event) => {
|
|
180
|
-
var { component, callback } = (e as CustomEvent).detail
|
|
181
|
-
|
|
182
|
-
if (!this.scene) return
|
|
183
|
-
|
|
184
|
-
var ids
|
|
185
|
-
if (component) {
|
|
186
|
-
ids = this.scene.findAll(component).map(c => c.model.id)
|
|
187
|
-
} else {
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
ids = this.scene.ids.map(({ key }) => key)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
ids = ids.filter(Boolean).sort()
|
|
193
|
-
callback(ids)
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
this.style.setProperty('--url-icon-properties', `url(${ICON_PROPERTIES})`)
|
|
197
|
-
this.style.setProperty('--url-icon-properties-label', `url(${ICON_PROPERTIES_LABEL})`)
|
|
198
|
-
this.style.setProperty('--url-icon-properties-padding', `url(${ICON_PROPERTIES_PADDING})`)
|
|
199
|
-
this.style.setProperty('--url-icon-properties-line-type', `url(${ICON_PROPERTIES_LINE_TYPE})`)
|
|
200
|
-
this.style.setProperty('--url-icon-properties-arrow-type', `url(${ICON_PROPERTIES_ARROW_TYPE})`)
|
|
201
|
-
|
|
202
|
-
this.style.setProperty('--url-icon-htoolbar', `url(${ICON_HTOOLBAR})`)
|
|
203
|
-
this.style.setProperty('--url-icon-fullscreen', `url(${ICON_FULLSCREEN})`)
|
|
204
|
-
this.style.setProperty('--url-icon-collapse', `url(${ICON_COLLAPSE})`)
|
|
205
|
-
this.style.setProperty('--url-icon-collapse-active', `url(${ICON_COLLAPSE_ACTIVE})`)
|
|
206
|
-
|
|
207
|
-
this.style.setProperty('--url-icon-shell-inspector', `url(${ICON_SHELL_INSPECTOR})`)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
static get scopedElements() {
|
|
211
|
-
return {
|
|
212
|
-
'process-edit-toolbar': EditToolbar,
|
|
213
|
-
'process-property-sidebar': PropertySidebar,
|
|
214
|
-
'process-component-toolbar': ComponentToolbar
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
render() {
|
|
219
|
-
return html`
|
|
220
|
-
<process-edit-toolbar
|
|
221
|
-
.scene=${this.scene}
|
|
222
|
-
.selected=${this.selected}
|
|
223
|
-
@hide-property-changed=${(e: CustomEvent) => (this.hideProperty = e.detail.value)}
|
|
224
|
-
@open-preview=${() => this.preview()}
|
|
225
|
-
@download-model=${() => this.downloadModel()}
|
|
226
|
-
@modeller-fullscreen=${() => togglefullscreen(this)}
|
|
227
|
-
>
|
|
228
|
-
${this.renderBrandingZone()}
|
|
229
|
-
</process-edit-toolbar>
|
|
230
|
-
|
|
231
|
-
<div content>
|
|
232
|
-
<process-component-toolbar
|
|
233
|
-
.scene=${this.scene}
|
|
234
|
-
.mode=${this.mode}
|
|
235
|
-
@mode-changed=${(e: CustomEvent) => {
|
|
236
|
-
this.mode = e.detail.value
|
|
237
|
-
}}
|
|
238
|
-
.componentGroupList=${this.componentGroupList}
|
|
239
|
-
.group=${this.group}
|
|
240
|
-
>
|
|
241
|
-
</process-component-toolbar>
|
|
242
|
-
|
|
243
|
-
<div id="scene-wrap">
|
|
244
|
-
<ox-scene-viewer
|
|
245
|
-
id="scene"
|
|
246
|
-
.scene=${this.scene}
|
|
247
|
-
@scene-changed=${(e: CustomEvent) => {
|
|
248
|
-
this.scene = e.detail.value
|
|
249
|
-
}}
|
|
250
|
-
.model=${this.model}
|
|
251
|
-
.selected=${this.selected}
|
|
252
|
-
@selected-changed=${(e: CustomEvent) => {
|
|
253
|
-
this.selected = e.detail.value
|
|
254
|
-
}}
|
|
255
|
-
.mode=${this.mode}
|
|
256
|
-
@mode-changed=${(e: CustomEvent) => {
|
|
257
|
-
this.mode = e.detail.value
|
|
258
|
-
}}
|
|
259
|
-
fit="ratio"
|
|
260
|
-
.baseUrl=${this.baseUrl}
|
|
261
|
-
@contextmenu=${() => this.onContextMenu()}
|
|
262
|
-
.provider=${this.provider}
|
|
263
|
-
name="modeller"
|
|
264
|
-
>
|
|
265
|
-
<ox-scene-layer type="selection-layer"></ox-scene-layer>
|
|
266
|
-
<ox-scene-layer type="modeling-layer"></ox-scene-layer>
|
|
267
|
-
<ox-scene-layer type="add-layer"> </ox-scene-layer>
|
|
268
|
-
<ox-scene-layer type="guide-layer">
|
|
269
|
-
<ox-scene-property name="ruler" value="disabled"></ox-scene-property>
|
|
270
|
-
</ox-scene-layer>
|
|
271
|
-
<ox-scene-layer type="shift-layer">
|
|
272
|
-
<ox-scene-property name="text" value="${this.overlay}"></ox-scene-property>
|
|
273
|
-
<ox-scene-property name="alpha" value="0.3"></ox-scene-property>
|
|
274
|
-
<ox-scene-property name="fontFamily" value="arial"></ox-scene-property>
|
|
275
|
-
<ox-scene-property name="fontSize" value="30" type="number"></ox-scene-property>
|
|
276
|
-
<ox-scene-property name="fontColor" value="navy"></ox-scene-property>
|
|
277
|
-
<ox-scene-property name="textBaseline" value="top"></ox-scene-property>
|
|
278
|
-
<ox-scene-property name="textAlign" value="left"></ox-scene-property>
|
|
279
|
-
<ox-scene-property name="paddingTop" value="50" type="number"></ox-scene-property>
|
|
280
|
-
<ox-scene-property name="paddingLeft" value="50" type="number"></ox-scene-property>
|
|
281
|
-
</ox-scene-layer>
|
|
282
|
-
<ox-scene-layer type="decotag-layer"></ox-scene-layer>
|
|
283
|
-
<ox-scene-handler type="text-editor"></ox-scene-handler>
|
|
284
|
-
<ox-scene-handler type="move-handler"></ox-scene-handler>
|
|
285
|
-
</ox-scene-viewer>
|
|
286
|
-
|
|
287
|
-
<md-fab @click=${() => this.onTapSave()} title="save">
|
|
288
|
-
<md-icon slot="icon">save</md-icon>
|
|
289
|
-
</md-fab>
|
|
290
|
-
</div>
|
|
291
|
-
|
|
292
|
-
<process-property-sidebar
|
|
293
|
-
.scene=${this.scene}
|
|
294
|
-
.selected=${this.selected}
|
|
295
|
-
.collapsed=${this.hideProperty}
|
|
296
|
-
.fonts=${this.fonts}
|
|
297
|
-
.propertyEditor=${this.propertyEditor}
|
|
298
|
-
?hide-data-binding=${this.hideDataBinding}
|
|
299
|
-
?hide-effect=${this.hideEffect}
|
|
300
|
-
?hide-inspector=${this.hideInspector}
|
|
301
|
-
?hide-shape=${this.hideShape}
|
|
302
|
-
?hide-style=${this.hideStyle}
|
|
303
|
-
?hide-specific=${this.hideSpecific}
|
|
304
|
-
>
|
|
305
|
-
</process-property-sidebar>
|
|
306
|
-
</div>
|
|
307
|
-
`
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
connectedCallback(): void {
|
|
311
|
-
super.connectedCallback()
|
|
312
|
-
this.bindShortcutEvent()
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
disconnectedCallback(): void {
|
|
316
|
-
super.disconnectedCallback()
|
|
317
|
-
this.unbindShortcutEvent()
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
updated(changes: PropertyValues<this>): void {
|
|
321
|
-
if (changes.has('scene')) {
|
|
322
|
-
if (this.scene) {
|
|
323
|
-
this.scene.anchorStarterTemplate = {
|
|
324
|
-
type: 'streamline',
|
|
325
|
-
lineWidth: 2,
|
|
326
|
-
strokeStyle: 'black',
|
|
327
|
-
begin: 'oval',
|
|
328
|
-
beginSize: 'size9',
|
|
329
|
-
end: 'arrow',
|
|
330
|
-
endSize: 'size9',
|
|
331
|
-
round: 10
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
close() {
|
|
338
|
-
this.model = null
|
|
339
|
-
this.requestUpdate()
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
onShortcut(e: KeyboardEvent) {
|
|
343
|
-
if (MACOS) var ctrlKey = e.metaKey
|
|
344
|
-
else var ctrlKey = e.ctrlKey
|
|
345
|
-
|
|
346
|
-
switch (e.code) {
|
|
347
|
-
case 'KeyS':
|
|
348
|
-
if (ctrlKey) {
|
|
349
|
-
this.onTapSave()
|
|
350
|
-
e.preventDefault()
|
|
351
|
-
}
|
|
352
|
-
break
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
preview() {
|
|
357
|
-
const process = {
|
|
358
|
-
id: 'preview',
|
|
359
|
-
model: this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
OxPopup.open({
|
|
363
|
-
template: html`
|
|
364
|
-
<ox-process-viewer style="flex: 1;" .provider=${this.provider} .process=${process}></ox-process-viewer>
|
|
365
|
-
`,
|
|
366
|
-
style: 'width: 80vw; height: 80vh;',
|
|
367
|
-
backdrop: true
|
|
368
|
-
})
|
|
369
|
-
|
|
370
|
-
requestAnimationFrame(() => {
|
|
371
|
-
dispatchEvent(new Event('resize'))
|
|
372
|
-
})
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
downloadModel() {
|
|
376
|
-
if (!this.scene) return
|
|
377
|
-
|
|
378
|
-
var model = JSON.stringify(this.model, null, 2)
|
|
379
|
-
var filename = (this.processName || 'NONAME') + '-' + Date.now() + '.json'
|
|
380
|
-
saveAs(new Blob([model], { type: 'application/octet-stream' }), filename)
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
renderBrandingZone() {
|
|
384
|
-
return html``
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
onTapSave() {
|
|
388
|
-
this.dispatchEvent(new CustomEvent('save-model', { bubbles: true, composed: true, detail: { model: this.model } }))
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
bindShortcutEvent() {
|
|
392
|
-
// TODO: Global Hotkey에 대한 정의를 process-edit-toolbar에서 가져올 수 있도록 수정해야 함.
|
|
393
|
-
const GLOBAL_HOTKEYS = ['Digit1', 'Digit2', 'F11', 'KeyD', 'KeyP', 'KeyS']
|
|
394
|
-
|
|
395
|
-
this.shortcutHandler = (e: KeyboardEvent) => {
|
|
396
|
-
const target = e.composedPath()[0] as HTMLElement
|
|
397
|
-
var tagName = target.tagName
|
|
398
|
-
var isInput = target.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'
|
|
399
|
-
var isGlobalHotkey = GLOBAL_HOTKEYS.includes(e.code)
|
|
400
|
-
|
|
401
|
-
if (!isGlobalHotkey && isInput) return
|
|
402
|
-
if (!this.editToolbar.onShortcut(e)) this.onShortcut(e)
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
document.addEventListener('keydown', this.shortcutHandler)
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
unbindShortcutEvent() {
|
|
409
|
-
if (this.shortcutHandler) {
|
|
410
|
-
document.removeEventListener('keydown', this.shortcutHandler)
|
|
411
|
-
delete this.shortcutHandler
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
undoable(): boolean {
|
|
416
|
-
return !!this.scene?.undoable()
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
redoable(): boolean {
|
|
420
|
-
return !!this.scene?.redoable()
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
preserve(): void {
|
|
424
|
-
this.scene?.preserve()
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
hasUnpreservedChanges(): boolean {
|
|
428
|
-
return !!this.scene?.hasUnpreservedChanges()
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
onContextMenu() {}
|
|
432
|
-
}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import '@operato/data-grist'
|
|
2
|
-
import '@operato/input/ox-input-file.js'
|
|
3
|
-
|
|
4
|
-
import gql from 'graphql-tag'
|
|
5
|
-
import { css, html, LitElement } from 'lit'
|
|
6
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
-
|
|
8
|
-
import { DataGrist, FetchOption, FilterValue, PaginationConfig, SortersConfig } from '@operato/data-grist'
|
|
9
|
-
import { buildArgs, client } from '@operato/graphql'
|
|
10
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
11
|
-
import { i18next } from '@operato/i18n'
|
|
12
|
-
|
|
13
|
-
const FETCH_PROCESS_TEMPLATE_LIST_GQL = (listParam: any) => {
|
|
14
|
-
return gql`
|
|
15
|
-
{
|
|
16
|
-
processTemplates(${buildArgs(listParam)}) {
|
|
17
|
-
items {
|
|
18
|
-
id
|
|
19
|
-
name
|
|
20
|
-
description
|
|
21
|
-
visibility
|
|
22
|
-
thumbnail
|
|
23
|
-
}
|
|
24
|
-
total
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const FETCH_PROCESS_TEMPLATE_GQL = (id: string) => {
|
|
31
|
-
return gql`
|
|
32
|
-
{
|
|
33
|
-
processTemplate(id: "${id}") {
|
|
34
|
-
id
|
|
35
|
-
name
|
|
36
|
-
description
|
|
37
|
-
visibility
|
|
38
|
-
model
|
|
39
|
-
thumbnail
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@customElement('ox-process-template-list')
|
|
46
|
-
export class OxProcessTemplateList extends LitElement {
|
|
47
|
-
static styles = [
|
|
48
|
-
ScrollbarStyles,
|
|
49
|
-
css`
|
|
50
|
-
:host {
|
|
51
|
-
display: flex;
|
|
52
|
-
|
|
53
|
-
width: 100%;
|
|
54
|
-
|
|
55
|
-
--grid-record-emphasized-background-color: red;
|
|
56
|
-
--grid-record-emphasized-color: yellow;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
ox-grist {
|
|
60
|
-
flex: 1;
|
|
61
|
-
overflow-y: auto;
|
|
62
|
-
|
|
63
|
-
--grid-record-emphasized-background-color: red;
|
|
64
|
-
--grid-record-emphasized-color: yellow;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
#headroom {
|
|
68
|
-
align-items: center;
|
|
69
|
-
padding: var(--padding-default) var(--spacing-large);
|
|
70
|
-
border-top: 2px solid rgba(0, 0, 0, 0.2);
|
|
71
|
-
background-color: var(--md-sys-color-surface);
|
|
72
|
-
box-shadow: var(--box-shadow);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
#filters {
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-direction: row;
|
|
78
|
-
place-content: space-between;
|
|
79
|
-
margin: var(--margin-default) 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
select {
|
|
83
|
-
border: 0;
|
|
84
|
-
outline: none;
|
|
85
|
-
text-align: right;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
@media only screen and (max-width: 460px) {
|
|
89
|
-
#filters {
|
|
90
|
-
flex-direction: column;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
`
|
|
94
|
-
]
|
|
95
|
-
|
|
96
|
-
@property({ type: Boolean, attribute: 'without-search' }) withoutSearch: boolean = false
|
|
97
|
-
|
|
98
|
-
@query('ox-grist') grist!: DataGrist
|
|
99
|
-
|
|
100
|
-
render() {
|
|
101
|
-
return html`
|
|
102
|
-
<ox-grist .config=${this.gristConfig} .mode=${'CARD'} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
103
|
-
<div slot="headroom" id="headroom">
|
|
104
|
-
<div id="filters">
|
|
105
|
-
<ox-filters-form autofocus .withoutSearch=${this.withoutSearch}></ox-filters-form>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</ox-grist>
|
|
109
|
-
`
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
113
|
-
const { items: records, total } = await this.getProcessTemplates({ page, limit, filters, sortings })
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
total,
|
|
117
|
-
records
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get gristConfig() {
|
|
122
|
-
const PRIVATE = i18next.t('label.visibility-private')
|
|
123
|
-
const DOMAIN = i18next.t('label.visibility-domain')
|
|
124
|
-
const PUBLIC = i18next.t('label.visibility-public')
|
|
125
|
-
|
|
126
|
-
const visibilities = window.location.pathname.startsWith('/domain/')
|
|
127
|
-
? [
|
|
128
|
-
{ display: PRIVATE, value: 'private' },
|
|
129
|
-
{ display: DOMAIN, value: 'domain' },
|
|
130
|
-
{ display: PUBLIC, value: 'public' }
|
|
131
|
-
]
|
|
132
|
-
: [
|
|
133
|
-
{ display: PRIVATE, value: 'private' },
|
|
134
|
-
{ display: PUBLIC, value: 'public' }
|
|
135
|
-
]
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
list: {
|
|
139
|
-
thumbnail: 'thumbnail',
|
|
140
|
-
fields: ['name'],
|
|
141
|
-
details: ['description']
|
|
142
|
-
},
|
|
143
|
-
columns: [
|
|
144
|
-
{
|
|
145
|
-
type: 'string',
|
|
146
|
-
name: 'id',
|
|
147
|
-
hidden: true
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
type: 'string',
|
|
151
|
-
name: 'name',
|
|
152
|
-
header: 'name',
|
|
153
|
-
record: {
|
|
154
|
-
editable: true,
|
|
155
|
-
align: 'left'
|
|
156
|
-
},
|
|
157
|
-
width: 200,
|
|
158
|
-
filter: 'search',
|
|
159
|
-
sortable: true
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
type: 'string',
|
|
163
|
-
name: 'description',
|
|
164
|
-
header: 'description',
|
|
165
|
-
record: {
|
|
166
|
-
editable: true,
|
|
167
|
-
align: 'left'
|
|
168
|
-
},
|
|
169
|
-
width: 200,
|
|
170
|
-
filter: 'search'
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
type: 'select-buttons',
|
|
174
|
-
name: 'visibility',
|
|
175
|
-
header: 'visibility',
|
|
176
|
-
record: {
|
|
177
|
-
editable: false
|
|
178
|
-
},
|
|
179
|
-
hidden: true,
|
|
180
|
-
filter: {
|
|
181
|
-
operator: 'in',
|
|
182
|
-
options: visibilities,
|
|
183
|
-
label: ''
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
type: 'image',
|
|
188
|
-
name: 'thumbnail',
|
|
189
|
-
hidden: true,
|
|
190
|
-
record: {
|
|
191
|
-
editable: false
|
|
192
|
-
},
|
|
193
|
-
width: 120
|
|
194
|
-
}
|
|
195
|
-
],
|
|
196
|
-
rows: {
|
|
197
|
-
appendable: false,
|
|
198
|
-
selectable: {
|
|
199
|
-
multiple: false
|
|
200
|
-
},
|
|
201
|
-
handlers: {
|
|
202
|
-
click: 'select-row-toggle'
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
sorters: [
|
|
206
|
-
{
|
|
207
|
-
name: 'name',
|
|
208
|
-
desc: false
|
|
209
|
-
}
|
|
210
|
-
],
|
|
211
|
-
pagination: {
|
|
212
|
-
pages: [20, 30, 50, 100, 200]
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
async firstUpdated() {
|
|
218
|
-
this.refreshProcessTemplates()
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
async getSelected() {
|
|
222
|
-
const selected = this.grist.selected
|
|
223
|
-
const templateId = selected && selected[0]?.id
|
|
224
|
-
|
|
225
|
-
if (!templateId) {
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
var processTemplateResponse = await client.query({
|
|
230
|
-
query: FETCH_PROCESS_TEMPLATE_GQL(templateId)
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
var template = processTemplateResponse.data?.processTemplate
|
|
234
|
-
|
|
235
|
-
if (template) {
|
|
236
|
-
template = {
|
|
237
|
-
...template,
|
|
238
|
-
model: JSON.parse(template.model)
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return template
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
async refreshProcessTemplates() {
|
|
246
|
-
this.grist.fetch()
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
async getProcessTemplates({
|
|
250
|
-
page = 1,
|
|
251
|
-
limit = 30,
|
|
252
|
-
filters = [],
|
|
253
|
-
sortings = []
|
|
254
|
-
}: { page?: number; limit?: number; filters?: FilterValue[]; sortings?: SortersConfig } = {}) {
|
|
255
|
-
var pagination: PaginationConfig = {
|
|
256
|
-
limit,
|
|
257
|
-
page
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
var params = {
|
|
261
|
-
filters,
|
|
262
|
-
sortings,
|
|
263
|
-
pagination
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
var processTemplateListResponse = await client.query({
|
|
267
|
-
query: FETCH_PROCESS_TEMPLATE_LIST_GQL(params)
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
return processTemplateListResponse?.data?.processTemplates || {}
|
|
271
|
-
}
|
|
272
|
-
}
|