@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,324 +0,0 @@
|
|
|
1
|
-
import './ox-process-creation-card'
|
|
2
|
-
|
|
3
|
-
import gql from 'graphql-tag'
|
|
4
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
5
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
6
|
-
|
|
7
|
-
import { buildArgs, client, gqlContext } from '@operato/graphql'
|
|
8
|
-
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
10
|
-
import InfiniteScrollable from '@operato/utils/mixins/infinite-scrollable.js'
|
|
11
|
-
|
|
12
|
-
const FETCH_PROCESS_LIST_GQL = (listParam: any) => {
|
|
13
|
-
return gql`
|
|
14
|
-
{
|
|
15
|
-
processes(${buildArgs(listParam)}) {
|
|
16
|
-
items {
|
|
17
|
-
id
|
|
18
|
-
name
|
|
19
|
-
description
|
|
20
|
-
thumbnail
|
|
21
|
-
}
|
|
22
|
-
total
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const FETCH_PROCESS_GROUP_LIST_GQL = gql`
|
|
29
|
-
{
|
|
30
|
-
processGroups {
|
|
31
|
-
items {
|
|
32
|
-
id
|
|
33
|
-
name
|
|
34
|
-
description
|
|
35
|
-
}
|
|
36
|
-
total
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
const CREATE_PROCESS_GQL = gql`
|
|
42
|
-
mutation CreateProcess($process: NewProcess!) {
|
|
43
|
-
createProcess(process: $process) {
|
|
44
|
-
id
|
|
45
|
-
name
|
|
46
|
-
description
|
|
47
|
-
model
|
|
48
|
-
createdAt
|
|
49
|
-
updatedAt
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`
|
|
53
|
-
|
|
54
|
-
@customElement('ox-process-selector')
|
|
55
|
-
export class ProcessSelector extends InfiniteScrollable(localize(i18next)(LitElement)) {
|
|
56
|
-
static get styles() {
|
|
57
|
-
return [
|
|
58
|
-
ScrollbarStyles,
|
|
59
|
-
css`
|
|
60
|
-
:host {
|
|
61
|
-
display: grid;
|
|
62
|
-
grid-template-rows: auto auto 1fr;
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
color: var(--popup-content-color);
|
|
65
|
-
background-color: var(--popup-content-background-color);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#main {
|
|
69
|
-
overflow: auto;
|
|
70
|
-
padding: var(--popup-content-padding);
|
|
71
|
-
display: grid;
|
|
72
|
-
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
73
|
-
grid-auto-rows: var(--card-list-rows-height);
|
|
74
|
-
grid-gap: 20px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.card {
|
|
78
|
-
display: flex;
|
|
79
|
-
flex-direction: column;
|
|
80
|
-
align-items: center;
|
|
81
|
-
overflow: hidden;
|
|
82
|
-
border-radius: var(--card-list-border-radius);
|
|
83
|
-
background-color: var(--card-list-background-color);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.card[selected] {
|
|
87
|
-
border: red solid;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.card.create {
|
|
91
|
-
overflow: visible;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.card:hover {
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.card > .name {
|
|
99
|
-
background-color: var(--board-renderer-name-background-color);
|
|
100
|
-
opacity: 0.8;
|
|
101
|
-
margin-top: -35px;
|
|
102
|
-
width: 100%;
|
|
103
|
-
color: #fff;
|
|
104
|
-
font-weight: bolder;
|
|
105
|
-
font-size: 13px;
|
|
106
|
-
text-indent: 7px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.card > .description {
|
|
110
|
-
background-color: rgba(0, 0, 0, 0.7);
|
|
111
|
-
width: 100%;
|
|
112
|
-
min-height: 15px;
|
|
113
|
-
font-size: 0.6rem;
|
|
114
|
-
color: #fff;
|
|
115
|
-
text-indent: 7px;
|
|
116
|
-
}
|
|
117
|
-
.card img {
|
|
118
|
-
max-height: 100%;
|
|
119
|
-
min-height: 100%;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
#filter {
|
|
123
|
-
padding: var(--popup-content-padding);
|
|
124
|
-
background-color: var(--md-sys-color-surface);
|
|
125
|
-
box-shadow: var(--box-shadow);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
#filter * {
|
|
129
|
-
font-size: 15px;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
select {
|
|
133
|
-
text-transform: capitalize;
|
|
134
|
-
float: right;
|
|
135
|
-
}
|
|
136
|
-
`
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
@property({ type: Array }) groups: { id: string; name: string; description: string }[] = []
|
|
141
|
-
@property({ type: Array }) processes: any[] = []
|
|
142
|
-
@property({ type: String }) group?: string
|
|
143
|
-
@property({ type: Boolean }) creatable: boolean = false
|
|
144
|
-
@property({ type: String }) value?: string
|
|
145
|
-
|
|
146
|
-
private _page: number = 1
|
|
147
|
-
private _total: number = 0
|
|
148
|
-
|
|
149
|
-
constructor() {
|
|
150
|
-
super()
|
|
151
|
-
|
|
152
|
-
this._infiniteScrollOptions.limit = 20
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
render() {
|
|
156
|
-
return html`
|
|
157
|
-
<div id="filter">
|
|
158
|
-
<select
|
|
159
|
-
@change=${(e: Event) => {
|
|
160
|
-
this.group = (e.currentTarget as any)?.value
|
|
161
|
-
this.requestUpdate()
|
|
162
|
-
}}
|
|
163
|
-
>
|
|
164
|
-
<option value="">${i18next.t('label.all')}</option>
|
|
165
|
-
${this.groups.map(group => html` <option value=${group.id}>${group.description}</option> `)}
|
|
166
|
-
</select>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<div
|
|
170
|
-
id="main"
|
|
171
|
-
@scroll=${(e: Event) => {
|
|
172
|
-
this.onScroll(e)
|
|
173
|
-
}}
|
|
174
|
-
>
|
|
175
|
-
${this.creatable
|
|
176
|
-
? html`
|
|
177
|
-
<ox-process-creation-card
|
|
178
|
-
class="card create"
|
|
179
|
-
.groups=${this.groups}
|
|
180
|
-
.defaultGroup=${this.group}
|
|
181
|
-
@create-process=${(e: CustomEvent) => this.onCreateProcess(e)}
|
|
182
|
-
></ox-process-creation-card>
|
|
183
|
-
`
|
|
184
|
-
: html``}
|
|
185
|
-
${this.processes.map(
|
|
186
|
-
process => html`
|
|
187
|
-
<div
|
|
188
|
-
class="card"
|
|
189
|
-
@click=${(e: Event) => this.onClickSelect(process)}
|
|
190
|
-
?selected=${this.value === process.id}
|
|
191
|
-
>
|
|
192
|
-
<img src=${process.thumbnail} />
|
|
193
|
-
<div class="name">${process.name}</div>
|
|
194
|
-
<div class="description">${process.description}</div>
|
|
195
|
-
</div>
|
|
196
|
-
`
|
|
197
|
-
)}
|
|
198
|
-
</div>
|
|
199
|
-
`
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
get scrollTargetEl(): HTMLElement | null {
|
|
203
|
-
return this.renderRoot.querySelector('#main') as HTMLElement
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
async scrollAction() {
|
|
207
|
-
return this.appendProcesses()
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
firstUpdated() {
|
|
211
|
-
this.refreshGroups()
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
async updated(changed: PropertyValues<this>) {
|
|
215
|
-
if (changed.has('group')) {
|
|
216
|
-
this.refreshProcesses()
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
onClickSelect(process: any) {
|
|
221
|
-
this.dispatchEvent(
|
|
222
|
-
new CustomEvent('process-selected', {
|
|
223
|
-
composed: true,
|
|
224
|
-
bubbles: true,
|
|
225
|
-
detail: {
|
|
226
|
-
process
|
|
227
|
-
}
|
|
228
|
-
})
|
|
229
|
-
)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
async onCreateProcess(e: CustomEvent) {
|
|
233
|
-
var { name, description, groupId, model, thumbnail } = e.detail
|
|
234
|
-
|
|
235
|
-
await this.createProcess(name, description, groupId, model, thumbnail)
|
|
236
|
-
this.refreshProcesses()
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
async refreshGroups() {
|
|
240
|
-
var groupListResponse = await client.query({
|
|
241
|
-
query: FETCH_PROCESS_GROUP_LIST_GQL,
|
|
242
|
-
context: gqlContext()
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
if (!groupListResponse || !groupListResponse.data) return
|
|
246
|
-
|
|
247
|
-
var groups = groupListResponse.data.processGroups.items
|
|
248
|
-
this.groups = [...groups]
|
|
249
|
-
|
|
250
|
-
this.group = groups.filter((group: { id: string }) => group.id == this.group).length > 0 ? this.group : ''
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
async refreshProcesses() {
|
|
254
|
-
var processes = await this.getProcesses()
|
|
255
|
-
this.processes = [...processes]
|
|
256
|
-
|
|
257
|
-
var creationCard = this.renderRoot.querySelector('ox-process-creation-card')
|
|
258
|
-
if (creationCard) {
|
|
259
|
-
;(creationCard as any).reset()
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async appendProcesses() {
|
|
264
|
-
var processes = await this.getProcesses({ page: this._page + 1 })
|
|
265
|
-
this.processes = [...this.processes, ...processes]
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
async getProcesses({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
|
|
269
|
-
var filters = []
|
|
270
|
-
var sortings = [] as any[]
|
|
271
|
-
var pagination = {
|
|
272
|
-
limit,
|
|
273
|
-
page
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if (this.group)
|
|
277
|
-
filters.push({
|
|
278
|
-
name: 'groupId',
|
|
279
|
-
operator: 'eq',
|
|
280
|
-
value: this.group
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
var params = {
|
|
284
|
-
filters,
|
|
285
|
-
sortings,
|
|
286
|
-
pagination
|
|
287
|
-
}
|
|
288
|
-
var processListResponse = await client.query({
|
|
289
|
-
query: FETCH_PROCESS_LIST_GQL(params),
|
|
290
|
-
context: gqlContext()
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
if (!processListResponse || !processListResponse.data) return []
|
|
294
|
-
this._total = processListResponse.data.processes.total
|
|
295
|
-
this._page = page
|
|
296
|
-
|
|
297
|
-
return processListResponse.data.processes.items
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
async createProcess(name: string, description: string, groupId: string, modelTemplate: any, thumbnail: string) {
|
|
301
|
-
var model = JSON.stringify(
|
|
302
|
-
modelTemplate || {
|
|
303
|
-
width: 1200,
|
|
304
|
-
height: 800,
|
|
305
|
-
fillStyle: 'white'
|
|
306
|
-
}
|
|
307
|
-
)
|
|
308
|
-
|
|
309
|
-
const response = await client.mutate({
|
|
310
|
-
mutation: CREATE_PROCESS_GQL,
|
|
311
|
-
variables: {
|
|
312
|
-
process: {
|
|
313
|
-
name,
|
|
314
|
-
description,
|
|
315
|
-
groupId,
|
|
316
|
-
model
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
context: gqlContext()
|
|
320
|
-
})
|
|
321
|
-
|
|
322
|
-
return response.data
|
|
323
|
-
}
|
|
324
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import '@material/web/textfield/filled-text-field.js'
|
|
2
|
-
import '@material/web/button/text-button.js'
|
|
3
|
-
import '@material/web/select/filled-select.js'
|
|
4
|
-
import '@material/web/select/select-option.js'
|
|
5
|
-
import '../ox-process-template-list'
|
|
6
|
-
|
|
7
|
-
import { css, html, LitElement } from 'lit'
|
|
8
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
9
|
-
|
|
10
|
-
import { i18next, localize } from '@operato/i18n'
|
|
11
|
-
import { OxProcessTemplateList } from '../ox-process-template-list'
|
|
12
|
-
|
|
13
|
-
@customElement('process-creation-popup')
|
|
14
|
-
export class ProcessCreationPopup extends localize(i18next)(LitElement) {
|
|
15
|
-
static get styles() {
|
|
16
|
-
return [
|
|
17
|
-
css`
|
|
18
|
-
:host {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
gap: 10px;
|
|
22
|
-
padding: 10px;
|
|
23
|
-
|
|
24
|
-
background-color: var(--md-sys-color-surface);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[body] {
|
|
28
|
-
flex: 1;
|
|
29
|
-
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: row;
|
|
32
|
-
gap: 10px;
|
|
33
|
-
|
|
34
|
-
overflow: hidden;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[content] {
|
|
38
|
-
flex: 1;
|
|
39
|
-
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
gap: 10px;
|
|
43
|
-
|
|
44
|
-
overflow: auto;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[content] > md-filled-text-field[type='textarea'] {
|
|
48
|
-
flex: 1;
|
|
49
|
-
resize: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
[templates] {
|
|
53
|
-
flex: 2;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[templates] > ox-process-template-list {
|
|
60
|
-
flex: 1;
|
|
61
|
-
overflow: hidden;
|
|
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
|
-
}
|
|
68
|
-
`
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@property({ type: String }) defaultGroup?: string
|
|
73
|
-
@property({ type: Array }) groups?: { id: string; name: string }[]
|
|
74
|
-
|
|
75
|
-
@query('ox-process-template-list') processTemplateList!: OxProcessTemplateList
|
|
76
|
-
|
|
77
|
-
render() {
|
|
78
|
-
var groups = this.groups || []
|
|
79
|
-
|
|
80
|
-
return html`
|
|
81
|
-
<div body>
|
|
82
|
-
<div content>
|
|
83
|
-
<md-filled-text-field
|
|
84
|
-
label=${String(i18next.t('label.name'))}
|
|
85
|
-
name="name"
|
|
86
|
-
required
|
|
87
|
-
field-name
|
|
88
|
-
></md-filled-text-field>
|
|
89
|
-
<md-filled-text-field
|
|
90
|
-
type="textarea"
|
|
91
|
-
label=${String(i18next.t('label.description'))}
|
|
92
|
-
name="description"
|
|
93
|
-
field-description
|
|
94
|
-
></md-filled-text-field>
|
|
95
|
-
<md-filled-select
|
|
96
|
-
label=${String(i18next.t('label.group'))}
|
|
97
|
-
field-group
|
|
98
|
-
helper="If there is no group to choose, you can leave it empty."
|
|
99
|
-
>
|
|
100
|
-
${groups.map(
|
|
101
|
-
group => html`
|
|
102
|
-
<md-select-option value=${group.id} ?selected=${this.defaultGroup == group.id}
|
|
103
|
-
>${group.name}</md-select-option
|
|
104
|
-
>
|
|
105
|
-
`
|
|
106
|
-
)}
|
|
107
|
-
</md-filled-select>
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
<div templates>
|
|
111
|
-
<div>${i18next.t('label.process-template')}</div>
|
|
112
|
-
<ox-process-template-list></ox-process-template-list>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<md-text-button @click=${(e: MouseEvent) => this.onClickSubmit()}
|
|
117
|
-
>${String(i18next.t('button.create'))}</md-text-button
|
|
118
|
-
>
|
|
119
|
-
`
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
firstUpdated() {
|
|
123
|
-
setTimeout(() => {
|
|
124
|
-
;(this.renderRoot.querySelector('md-filled-text-field') as any)?.focus()
|
|
125
|
-
}, 100)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
async onClickSubmit() {
|
|
129
|
-
var [name, description, groupId] = ['name', 'description', 'group'].map(attr => {
|
|
130
|
-
return (this.renderRoot.querySelector(`[field-${attr}]`) as any)?.value
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
if (!name) {
|
|
134
|
-
return
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const template = await this.processTemplateList.getSelected()
|
|
138
|
-
|
|
139
|
-
this.dispatchEvent(
|
|
140
|
-
new CustomEvent('create-process', {
|
|
141
|
-
detail: {
|
|
142
|
-
name,
|
|
143
|
-
description,
|
|
144
|
-
groupId,
|
|
145
|
-
model: template?.model,
|
|
146
|
-
thumbnail: template?.thumbnail
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
-
|
|
4
|
-
import { i18next, localize } from '@operato/i18n'
|
|
5
|
-
|
|
6
|
-
@customElement('process-thumbnail-card')
|
|
7
|
-
export class ProcessThumbnailCard extends localize(i18next)(LitElement) {
|
|
8
|
-
static get styles() {
|
|
9
|
-
return [
|
|
10
|
-
css`
|
|
11
|
-
:host {
|
|
12
|
-
position: relative;
|
|
13
|
-
|
|
14
|
-
padding: 0;
|
|
15
|
-
margin: 0;
|
|
16
|
-
height: 100%;
|
|
17
|
-
|
|
18
|
-
-webkit-transform-style: preserve-3d;
|
|
19
|
-
transform-style: preserve-3d;
|
|
20
|
-
-webkit-transition: all 0.5s ease-in-out;
|
|
21
|
-
transition: all 0.5s ease-in-out;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
:host(.flipped) {
|
|
25
|
-
-webkit-transform: var(--card-list-flip-transform);
|
|
26
|
-
transform: var(--card-list-flip-transform);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
[front],
|
|
30
|
-
[back] {
|
|
31
|
-
position: absolute;
|
|
32
|
-
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
|
-
margin: 0;
|
|
36
|
-
padding: 0;
|
|
37
|
-
|
|
38
|
-
border: var(--card-list-create-border);
|
|
39
|
-
border-radius: var(--card-list-create-border-radius);
|
|
40
|
-
|
|
41
|
-
background-color: var(--md-sys-color-surface);
|
|
42
|
-
|
|
43
|
-
-webkit-backface-visibility: hidden;
|
|
44
|
-
backface-visibility: hidden;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[front] {
|
|
48
|
-
text-align: center;
|
|
49
|
-
font-size: 0.8em;
|
|
50
|
-
color: var(--card-list-create-color);
|
|
51
|
-
text-transform: capitalize;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[front] md-icon {
|
|
55
|
-
margin-top: 15%;
|
|
56
|
-
display: block;
|
|
57
|
-
font-size: 3.5em;
|
|
58
|
-
color: var(--card-list-create-icon-color);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[back] {
|
|
62
|
-
-webkit-transform: var(--card-list-flip-transform);
|
|
63
|
-
transform: var(--card-list-flip-transform);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
[back] form {
|
|
67
|
-
padding: var(--card-list-create-form-padding);
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-flow: row wrap;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
[back] form label {
|
|
73
|
-
flex: 1 1 25%;
|
|
74
|
-
font: var(--card-list-create-label-font);
|
|
75
|
-
color: var(--card-list-create-label-color);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
[back] form input,
|
|
79
|
-
[back] form select {
|
|
80
|
-
flex: 1 1 60%;
|
|
81
|
-
width: 10px;
|
|
82
|
-
background-color: var(--md-sys-color-surface);
|
|
83
|
-
border: var(--card-list-create-input-border);
|
|
84
|
-
border-radius: var(--card-list-create-input-border-radius);
|
|
85
|
-
padding: var(--card-list-create-input-padding);
|
|
86
|
-
font: var(--card-list-create-input-font);
|
|
87
|
-
color: var(--card-list-create-input-color);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
form * {
|
|
91
|
-
margin: var(--card-list-create-margin);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
input[type='submit'] {
|
|
95
|
-
background-color: var(--button-background-color) !important;
|
|
96
|
-
margin: var(--button-margin);
|
|
97
|
-
font: var(--button-font);
|
|
98
|
-
color: var(--button-color) !important;
|
|
99
|
-
border-radius: var(--button-radius);
|
|
100
|
-
border: var(--button-border);
|
|
101
|
-
}
|
|
102
|
-
`
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@property({ type: String }) defaultGroup?: string
|
|
107
|
-
@property({ type: Array }) groups?: { id: string; name: string }[]
|
|
108
|
-
|
|
109
|
-
render() {
|
|
110
|
-
var groups = this.groups || []
|
|
111
|
-
|
|
112
|
-
return html`
|
|
113
|
-
<div @click=${(e: Event) => this.onClickFlip(e)} front><md-icon>add_circle_outline</md-icon>create process</div>
|
|
114
|
-
|
|
115
|
-
<div @click=${(e: Event) => this.onClickFlip(e)} back>
|
|
116
|
-
<form @submit=${(e: Event) => this.onClickSubmit(e)}>
|
|
117
|
-
<label>${i18next.t('label.name')}</label>
|
|
118
|
-
<input type="text" name="name" />
|
|
119
|
-
|
|
120
|
-
<label>${i18next.t('label.description')}</label>
|
|
121
|
-
<input type="text" name="description" />
|
|
122
|
-
|
|
123
|
-
<label>${i18next.t('label.group')}</label>
|
|
124
|
-
<select .value=${this.defaultGroup || ''} name="groupId">
|
|
125
|
-
${groups.map(
|
|
126
|
-
group => html`
|
|
127
|
-
<option value=${group.id} ?selected=${this.defaultGroup == group.id}>${group.name}</option>
|
|
128
|
-
`
|
|
129
|
-
)}
|
|
130
|
-
</select>
|
|
131
|
-
|
|
132
|
-
<input type="submit" value=${String(i18next.t('button.create'))} />
|
|
133
|
-
</form>
|
|
134
|
-
</div>
|
|
135
|
-
`
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
onClickFlip(e: Event) {
|
|
139
|
-
if ((e.currentTarget as any)?.hasAttribute('front') || (e.target as any)?.hasAttribute('back')) {
|
|
140
|
-
this.classList.toggle('flipped')
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
e.stopPropagation()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
onClickSubmit(e: Event) {
|
|
147
|
-
e.preventDefault()
|
|
148
|
-
e.stopPropagation()
|
|
149
|
-
|
|
150
|
-
var form = e.target as any
|
|
151
|
-
|
|
152
|
-
var name = form.elements['name'].value
|
|
153
|
-
var description = form.elements['description'].value
|
|
154
|
-
var groupId = form.elements['groupId'].value
|
|
155
|
-
|
|
156
|
-
this.dispatchEvent(
|
|
157
|
-
new CustomEvent('create-process', {
|
|
158
|
-
detail: {
|
|
159
|
-
name,
|
|
160
|
-
description,
|
|
161
|
-
groupId
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
reset() {
|
|
168
|
-
var form = this.shadowRoot?.querySelector('form')
|
|
169
|
-
if (form) {
|
|
170
|
-
form.reset()
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
this.classList.remove('flipped')
|
|
174
|
-
}
|
|
175
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Model } from '@hatiolab/things-scene'
|
|
2
|
-
|
|
3
|
-
export interface PalletItem {
|
|
4
|
-
type: string
|
|
5
|
-
description: string
|
|
6
|
-
icon: HTMLImageElement
|
|
7
|
-
group: string | string[]
|
|
8
|
-
model: Model
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface Pallet {
|
|
12
|
-
name: string
|
|
13
|
-
templates: PalletItem[]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ComponentTemplate = {
|
|
17
|
-
type: string
|
|
18
|
-
description: string
|
|
19
|
-
group:
|
|
20
|
-
| 'line'
|
|
21
|
-
| 'shape'
|
|
22
|
-
| 'textAndMedia'
|
|
23
|
-
| 'chartAndGauge'
|
|
24
|
-
| 'table'
|
|
25
|
-
| 'container'
|
|
26
|
-
| 'dataSource'
|
|
27
|
-
| 'IoT'
|
|
28
|
-
| '3D'
|
|
29
|
-
| 'warehouse'
|
|
30
|
-
| 'form'
|
|
31
|
-
| 'etc'
|
|
32
|
-
| string
|
|
33
|
-
icon: any
|
|
34
|
-
model: Model
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type ComponentGroup = {
|
|
38
|
-
name: string
|
|
39
|
-
description: string
|
|
40
|
-
icon: string
|
|
41
|
-
templates: ComponentTemplate[]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type Process = {
|
|
45
|
-
id?: string
|
|
46
|
-
name?: string
|
|
47
|
-
description?: string
|
|
48
|
-
model?: any
|
|
49
|
-
groupId?: string
|
|
50
|
-
thumbnail?: string
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type ProcessGroup = {
|
|
54
|
-
id?: string
|
|
55
|
-
name?: string
|
|
56
|
-
description?: string
|
|
57
|
-
}
|