@operato/board 8.0.0-beta.0 → 8.0.0-beta.1
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 +9 -0
- package/package.json +14 -14
- package/.storybook/main.js +0 -3
- package/.storybook/server.mjs +0 -8
- package/src/component/3d.ts +0 -29
- package/src/component/chart-and-gauge.ts +0 -28
- package/src/component/container.ts +0 -63
- package/src/component/data-source.ts +0 -30
- package/src/component/etc.ts +0 -88
- package/src/component/form.ts +0 -42
- package/src/component/index.ts +0 -12
- package/src/component/iot.ts +0 -52
- package/src/component/line.ts +0 -156
- package/src/component/register-default-groups.ts +0 -28
- package/src/component/shape.ts +0 -156
- package/src/component/table.ts +0 -28
- package/src/component/text-and-media.ts +0 -125
- package/src/component/warehouse.ts +0 -26
- package/src/data-storage/data-storage.ts +0 -76
- package/src/graphql/board.ts +0 -144
- package/src/graphql/data-subscription.ts +0 -30
- package/src/graphql/favorite-board.ts +0 -25
- package/src/graphql/group.ts +0 -138
- package/src/graphql/index.ts +0 -4
- package/src/graphql/play-group.ts +0 -225
- package/src/graphql/scenario.ts +0 -79
- package/src/index.ts +0 -10
- package/src/modeller/component-toolbar/component-detail.ts +0 -52
- package/src/modeller/component-toolbar/component-menu.ts +0 -196
- 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 -232
- package/src/modeller/edit-toolbar.ts +0 -587
- 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-value-map.ts +0 -19
- package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
- package/src/modeller/property-sidebar/effects/effects.ts +0 -69
- package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
- package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
- package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
- 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 -404
- package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
- package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
- package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
- package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
- package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
- package/src/modeller/property-sidebar/styles/styles.ts +0 -577
- package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
- package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
- package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
- package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
- package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
- package/src/ox-board-component-info.ts +0 -236
- package/src/ox-board-list.ts +0 -401
- package/src/ox-board-modeller.ts +0 -408
- package/src/ox-board-player-style.ts +0 -200
- package/src/ox-board-player.ts +0 -333
- package/src/ox-board-template-list.ts +0 -267
- package/src/ox-board-template-viewer.ts +0 -198
- package/src/ox-board-viewer.ts +0 -727
- package/src/ox-editor-board-selector.ts +0 -91
- package/src/ox-property-editor-board-selector.ts +0 -23
- package/src/player/ox-board-player-carousel.ts +0 -197
- package/src/player/ox-board-player-grid.ts +0 -78
- package/src/player/ox-board-wrapper.ts +0 -152
- package/src/selector/board-creation-popup.ts +0 -151
- package/src/selector/board-thumbnail-card.ts +0 -175
- package/src/selector/ox-board-creation-card.ts +0 -98
- package/src/selector/ox-board-selector.ts +0 -382
- package/src/types.ts +0 -63
- package/stories/property-data-binding.stories.ts +0 -34
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -30
- package/web-test-runner.config.mjs +0 -29
@@ -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('board-thumbnail-card')
|
7
|
-
export class BoardThumbnailCard 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 board</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-board', {
|
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
|
-
}
|
@@ -1,98 +0,0 @@
|
|
1
|
-
import '@material/web/icon/icon.js'
|
2
|
-
import './board-creation-popup'
|
3
|
-
|
4
|
-
import { css, html, LitElement } from 'lit'
|
5
|
-
import { customElement, property } from 'lit/decorators.js'
|
6
|
-
|
7
|
-
import { i18next, localize } from '@operato/i18n'
|
8
|
-
import { openPopup } from '@operato/layout'
|
9
|
-
|
10
|
-
@customElement('ox-board-creation-card')
|
11
|
-
export class BoardCreationCard extends localize(i18next)(LitElement) {
|
12
|
-
static get styles() {
|
13
|
-
return [
|
14
|
-
css`
|
15
|
-
:host {
|
16
|
-
display: flex;
|
17
|
-
border: var(--card-list-create-border);
|
18
|
-
border-radius: var(--card-list-create-border-radius);
|
19
|
-
|
20
|
-
background-color: var(--md-sys-color-surface);
|
21
|
-
|
22
|
-
align-content: center;
|
23
|
-
justify-content: center;
|
24
|
-
}
|
25
|
-
|
26
|
-
div {
|
27
|
-
display: flex;
|
28
|
-
flex-direction: column;
|
29
|
-
align-items: center;
|
30
|
-
text-align: center;
|
31
|
-
font-size: 0.8em;
|
32
|
-
color: var(--card-list-create-color);
|
33
|
-
text-transform: capitalize;
|
34
|
-
}
|
35
|
-
|
36
|
-
md-icon {
|
37
|
-
--md-icon-size: 42px;
|
38
|
-
display: block;
|
39
|
-
font-size: 3.5em;
|
40
|
-
color: var(--card-list-create-icon-color);
|
41
|
-
}
|
42
|
-
`
|
43
|
-
]
|
44
|
-
}
|
45
|
-
|
46
|
-
/* default group id */
|
47
|
-
@property({ type: String }) defaultGroup?: string
|
48
|
-
@property({ type: Array }) groups: any
|
49
|
-
|
50
|
-
private popup: any
|
51
|
-
|
52
|
-
render() {
|
53
|
-
return html`<div @click=${(e: Event) => this.onClick()}><md-icon>add_circle_outline</md-icon>create board</div> `
|
54
|
-
}
|
55
|
-
|
56
|
-
onClick() {
|
57
|
-
if (this.popup) {
|
58
|
-
delete this.popup
|
59
|
-
}
|
60
|
-
|
61
|
-
/*
|
62
|
-
* 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
63
|
-
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
64
|
-
* string인 경우에는 해당 보드의 id로 해석한다.
|
65
|
-
*/
|
66
|
-
var template = html`
|
67
|
-
<board-creation-popup
|
68
|
-
.defaultGroup=${this.defaultGroup}
|
69
|
-
.groups=${this.groups}
|
70
|
-
@create-board=${async (e: CustomEvent) => {
|
71
|
-
var { name, description, groupId, model, thumbnail } = e.detail
|
72
|
-
|
73
|
-
this.dispatchEvent(
|
74
|
-
new CustomEvent('create-board', {
|
75
|
-
detail: {
|
76
|
-
name,
|
77
|
-
description,
|
78
|
-
groupId,
|
79
|
-
model,
|
80
|
-
thumbnail
|
81
|
-
}
|
82
|
-
})
|
83
|
-
)
|
84
|
-
|
85
|
-
this.popup && this.popup.close()
|
86
|
-
}}
|
87
|
-
></board-creation-popup>
|
88
|
-
`
|
89
|
-
|
90
|
-
this.popup = openPopup(template, {
|
91
|
-
backdrop: true,
|
92
|
-
size: 'large',
|
93
|
-
title: i18next.t('title.create-board')
|
94
|
-
})
|
95
|
-
}
|
96
|
-
|
97
|
-
reset() {}
|
98
|
-
}
|
@@ -1,382 +0,0 @@
|
|
1
|
-
import '@operato/input/ox-input-search.js'
|
2
|
-
import './ox-board-creation-card'
|
3
|
-
|
4
|
-
import gql from 'graphql-tag'
|
5
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
6
|
-
import { customElement, property } from 'lit/decorators.js'
|
7
|
-
|
8
|
-
import { client, gqlContext } from '@operato/graphql'
|
9
|
-
import { i18next, localize } from '@operato/i18n'
|
10
|
-
import { ScrollbarStyles } from '@operato/styles'
|
11
|
-
import InfiniteScrollable from '@operato/utils/mixins/infinite-scrollable.js'
|
12
|
-
import { InheritedValueType } from '@operato/shell'
|
13
|
-
import { adjustFilters } from '@operato/utils'
|
14
|
-
|
15
|
-
const FETCH_BOARD_LIST_GQL = gql`
|
16
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $inherited: InheritedValueType) {
|
17
|
-
boards(filters: $filters, pagination: $pagination, sortings: $sortings, inherited: $inherited) {
|
18
|
-
items {
|
19
|
-
id
|
20
|
-
name
|
21
|
-
description
|
22
|
-
thumbnail
|
23
|
-
}
|
24
|
-
total
|
25
|
-
}
|
26
|
-
}
|
27
|
-
`
|
28
|
-
|
29
|
-
const FETCH_BOARD_GROUP_LIST_GQL = gql`
|
30
|
-
{
|
31
|
-
groups {
|
32
|
-
items {
|
33
|
-
id
|
34
|
-
name
|
35
|
-
description
|
36
|
-
}
|
37
|
-
total
|
38
|
-
}
|
39
|
-
}
|
40
|
-
`
|
41
|
-
|
42
|
-
const CREATE_BOARD_GQL = gql`
|
43
|
-
mutation CreateBoard($board: NewBoard!) {
|
44
|
-
createBoard(board: $board) {
|
45
|
-
id
|
46
|
-
name
|
47
|
-
description
|
48
|
-
model
|
49
|
-
createdAt
|
50
|
-
updatedAt
|
51
|
-
}
|
52
|
-
}
|
53
|
-
`
|
54
|
-
|
55
|
-
@customElement('ox-board-selector')
|
56
|
-
export class BoardSelector extends InfiniteScrollable(localize(i18next)(LitElement)) {
|
57
|
-
static get styles() {
|
58
|
-
return [
|
59
|
-
ScrollbarStyles,
|
60
|
-
css`
|
61
|
-
:host {
|
62
|
-
display: grid;
|
63
|
-
grid-template-rows: auto auto 1fr;
|
64
|
-
overflow: hidden;
|
65
|
-
color: var(--md-sys-color-on-surface);
|
66
|
-
background-color: var(--md-sys-color-surface);
|
67
|
-
}
|
68
|
-
|
69
|
-
#main {
|
70
|
-
overflow: auto;
|
71
|
-
padding: var(--popup-content-padding);
|
72
|
-
display: grid;
|
73
|
-
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
74
|
-
grid-auto-rows: var(--card-list-rows-height);
|
75
|
-
grid-gap: 20px;
|
76
|
-
}
|
77
|
-
|
78
|
-
.card {
|
79
|
-
display: flex;
|
80
|
-
flex-direction: column;
|
81
|
-
align-items: center;
|
82
|
-
overflow: hidden;
|
83
|
-
border-radius: var(--card-list-border-radius);
|
84
|
-
background-color: var(--card-list-background-color);
|
85
|
-
}
|
86
|
-
|
87
|
-
.card[selected] {
|
88
|
-
border: red solid;
|
89
|
-
}
|
90
|
-
|
91
|
-
.card.create {
|
92
|
-
overflow: visible;
|
93
|
-
}
|
94
|
-
|
95
|
-
.card:hover {
|
96
|
-
cursor: pointer;
|
97
|
-
}
|
98
|
-
|
99
|
-
.card > .name {
|
100
|
-
color: var(--md-sys-color-on-secondary);
|
101
|
-
background-color: var(--md-sys-color-secondary);
|
102
|
-
opacity: 0.9;
|
103
|
-
margin-top: -35px;
|
104
|
-
width: 100%;
|
105
|
-
font-weight: bolder;
|
106
|
-
font-size: 13px;
|
107
|
-
text-indent: 7px;
|
108
|
-
}
|
109
|
-
|
110
|
-
.card > .description {
|
111
|
-
color: var(--md-sys-color-on-secondary);
|
112
|
-
background-color: var(--md-sys-color-secondary);
|
113
|
-
width: 100%;
|
114
|
-
min-height: 16px;
|
115
|
-
font-size: 0.6rem;
|
116
|
-
text-indent: 7px;
|
117
|
-
}
|
118
|
-
.card img {
|
119
|
-
max-height: 100%;
|
120
|
-
min-height: 100%;
|
121
|
-
}
|
122
|
-
|
123
|
-
#filter {
|
124
|
-
display: flex;
|
125
|
-
align-items: center;
|
126
|
-
padding: var(--popup-content-padding);
|
127
|
-
color: var(--md-sys-color-on-surface-variant);
|
128
|
-
background-color: var(--md-sys-color-surface-variant);
|
129
|
-
box-shadow: var(--box-shadow);
|
130
|
-
}
|
131
|
-
|
132
|
-
#filter > ox-input-search {
|
133
|
-
margin-right: auto;
|
134
|
-
border: var(--md-sys-color-primary) 1px solid;
|
135
|
-
padding: var(--spacing-small) var(--spacing-small);
|
136
|
-
border-radius: 999px;
|
137
|
-
color: var(--md-sys-color-primary);
|
138
|
-
}
|
139
|
-
|
140
|
-
#filter > div {
|
141
|
-
float: right;
|
142
|
-
margin-left: 10px;
|
143
|
-
}
|
144
|
-
|
145
|
-
#filter * {
|
146
|
-
font-size: 15px;
|
147
|
-
}
|
148
|
-
|
149
|
-
select {
|
150
|
-
text-transform: capitalize;
|
151
|
-
}
|
152
|
-
`
|
153
|
-
]
|
154
|
-
}
|
155
|
-
|
156
|
-
@property({ type: Array }) groups: { id: string; name: string; description: string }[] = []
|
157
|
-
@property({ type: Array }) boards: any[] = []
|
158
|
-
@property({ type: String }) group?: string
|
159
|
-
@property({ type: String }) search?: string
|
160
|
-
@property({ type: String }) inherited?: InheritedValueType = InheritedValueType.Include
|
161
|
-
@property({ type: Boolean }) creatable: boolean = false
|
162
|
-
@property({ type: String }) value?: string
|
163
|
-
|
164
|
-
private _page: number = 1
|
165
|
-
private _total: number = 0
|
166
|
-
|
167
|
-
constructor() {
|
168
|
-
super()
|
169
|
-
|
170
|
-
this._infiniteScrollOptions.limit = 50
|
171
|
-
}
|
172
|
-
|
173
|
-
render() {
|
174
|
-
return html`
|
175
|
-
<div id="filter">
|
176
|
-
<ox-input-search
|
177
|
-
@change=${(e: Event) => {
|
178
|
-
this.search = (e.currentTarget as any)?.value
|
179
|
-
}}
|
180
|
-
></ox-input-search>
|
181
|
-
<div>
|
182
|
-
<label for="group">Group</label>
|
183
|
-
<select
|
184
|
-
id="group"
|
185
|
-
@change=${(e: Event) => {
|
186
|
-
this.group = (e.currentTarget as any)?.value
|
187
|
-
this.requestUpdate()
|
188
|
-
}}
|
189
|
-
>
|
190
|
-
<option value="">${i18next.t('label.all')}</option>
|
191
|
-
${this.groups.map(group => html` <option value=${group.id}>${group.description}</option> `)}
|
192
|
-
</select>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
<div>
|
196
|
-
<label for="inherited">Inherited</label>
|
197
|
-
<select
|
198
|
-
id="inherited"
|
199
|
-
@change=${(e: Event) => {
|
200
|
-
this.inherited = (e.currentTarget as any)?.value
|
201
|
-
this.requestUpdate()
|
202
|
-
}}
|
203
|
-
>
|
204
|
-
<option value="Include">Include</option>
|
205
|
-
<option value="Only">Only</option>
|
206
|
-
<option value="None">None</option>
|
207
|
-
</select>
|
208
|
-
</div>
|
209
|
-
</div>
|
210
|
-
|
211
|
-
<div
|
212
|
-
id="main"
|
213
|
-
@scroll=${(e: Event) => {
|
214
|
-
this.onScroll(e)
|
215
|
-
}}
|
216
|
-
>
|
217
|
-
${this.creatable
|
218
|
-
? html`
|
219
|
-
<ox-board-creation-card
|
220
|
-
class="card create"
|
221
|
-
.groups=${this.groups}
|
222
|
-
.defaultGroup=${this.group}
|
223
|
-
@create-board=${(e: CustomEvent) => this.onCreateBoard(e)}
|
224
|
-
></ox-board-creation-card>
|
225
|
-
`
|
226
|
-
: html``}
|
227
|
-
${this.boards.map(
|
228
|
-
board => html`
|
229
|
-
<div class="card" @click=${(e: Event) => this.onClickSelect(board)} ?selected=${this.value === board.id}>
|
230
|
-
<img src=${board.thumbnail} />
|
231
|
-
<div class="name">${board.name}</div>
|
232
|
-
<div class="description">${board.description}</div>
|
233
|
-
</div>
|
234
|
-
`
|
235
|
-
)}
|
236
|
-
</div>
|
237
|
-
`
|
238
|
-
}
|
239
|
-
|
240
|
-
get scrollTargetEl(): HTMLElement | null {
|
241
|
-
return this.renderRoot.querySelector('#main') as HTMLElement
|
242
|
-
}
|
243
|
-
|
244
|
-
async scrollAction() {
|
245
|
-
return this.appendBoards()
|
246
|
-
}
|
247
|
-
|
248
|
-
firstUpdated() {
|
249
|
-
this.refreshGroups()
|
250
|
-
}
|
251
|
-
|
252
|
-
async updated(changed: PropertyValues<this>) {
|
253
|
-
if (changed.has('group') || changed.has('inherited') || changed.has('search')) {
|
254
|
-
this.refreshBoards()
|
255
|
-
}
|
256
|
-
}
|
257
|
-
|
258
|
-
onClickSelect(board: any) {
|
259
|
-
this.dispatchEvent(
|
260
|
-
new CustomEvent('board-selected', {
|
261
|
-
composed: true,
|
262
|
-
bubbles: true,
|
263
|
-
detail: {
|
264
|
-
board
|
265
|
-
}
|
266
|
-
})
|
267
|
-
)
|
268
|
-
}
|
269
|
-
|
270
|
-
async onCreateBoard(e: CustomEvent) {
|
271
|
-
var { name, description, groupId, model, thumbnail } = e.detail
|
272
|
-
|
273
|
-
await this.createBoard(name, description, groupId, model, thumbnail)
|
274
|
-
this.refreshBoards()
|
275
|
-
}
|
276
|
-
|
277
|
-
async refreshGroups() {
|
278
|
-
var groupListResponse = await client.query({
|
279
|
-
query: FETCH_BOARD_GROUP_LIST_GQL,
|
280
|
-
context: gqlContext()
|
281
|
-
})
|
282
|
-
|
283
|
-
if (!groupListResponse || !groupListResponse.data) return
|
284
|
-
|
285
|
-
var groups = groupListResponse.data.groups.items
|
286
|
-
this.groups = [...groups]
|
287
|
-
|
288
|
-
this.group = groups.filter((group: { id: string }) => group.id == this.group).length > 0 ? this.group : ''
|
289
|
-
}
|
290
|
-
|
291
|
-
async refreshBoards() {
|
292
|
-
var boards = await this.getBoards()
|
293
|
-
this.boards = [...boards]
|
294
|
-
|
295
|
-
var creationCard = this.renderRoot.querySelector('ox-board-creation-card')
|
296
|
-
if (creationCard) {
|
297
|
-
;(creationCard as any).reset()
|
298
|
-
}
|
299
|
-
}
|
300
|
-
|
301
|
-
async appendBoards() {
|
302
|
-
var boards = await this.getBoards({ page: this._page + 1 })
|
303
|
-
this.boards = [...this.boards, ...boards]
|
304
|
-
}
|
305
|
-
|
306
|
-
async getBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
|
307
|
-
var filters = []
|
308
|
-
var sortings = [] as any[]
|
309
|
-
var pagination = {
|
310
|
-
limit,
|
311
|
-
page
|
312
|
-
}
|
313
|
-
|
314
|
-
if (this.group) {
|
315
|
-
filters.push({
|
316
|
-
name: 'groupId',
|
317
|
-
operator: 'eq',
|
318
|
-
value: this.group
|
319
|
-
})
|
320
|
-
}
|
321
|
-
|
322
|
-
if (this.search) {
|
323
|
-
const value = `%${this.search.trim()}%`
|
324
|
-
|
325
|
-
filters.push({
|
326
|
-
name: 'name',
|
327
|
-
operator: 'search',
|
328
|
-
value: this.search
|
329
|
-
})
|
330
|
-
|
331
|
-
filters.push({
|
332
|
-
name: 'description',
|
333
|
-
operator: 'search',
|
334
|
-
value: this.search
|
335
|
-
})
|
336
|
-
}
|
337
|
-
|
338
|
-
var variables = {
|
339
|
-
filters,
|
340
|
-
sortings,
|
341
|
-
pagination,
|
342
|
-
inherited: this.inherited || InheritedValueType.Include
|
343
|
-
}
|
344
|
-
|
345
|
-
var boardListResponse = await client.query({
|
346
|
-
query: FETCH_BOARD_LIST_GQL,
|
347
|
-
variables
|
348
|
-
})
|
349
|
-
|
350
|
-
if (!boardListResponse || !boardListResponse.data) return []
|
351
|
-
this._total = boardListResponse.data.boards.total
|
352
|
-
this._page = page
|
353
|
-
|
354
|
-
return boardListResponse.data.boards.items
|
355
|
-
}
|
356
|
-
|
357
|
-
async createBoard(name: string, description: string, groupId: string, modelTemplate: any, thumbnail: string) {
|
358
|
-
var model = JSON.stringify(
|
359
|
-
modelTemplate || {
|
360
|
-
width: 1200,
|
361
|
-
height: 800,
|
362
|
-
fillStyle: 'white'
|
363
|
-
}
|
364
|
-
)
|
365
|
-
|
366
|
-
const response = await client.mutate({
|
367
|
-
mutation: CREATE_BOARD_GQL,
|
368
|
-
variables: {
|
369
|
-
board: {
|
370
|
-
name,
|
371
|
-
description,
|
372
|
-
groupId,
|
373
|
-
model,
|
374
|
-
thumbnail
|
375
|
-
}
|
376
|
-
},
|
377
|
-
context: gqlContext()
|
378
|
-
})
|
379
|
-
|
380
|
-
return response.data
|
381
|
-
}
|
382
|
-
}
|
package/src/types.ts
DELETED
@@ -1,63 +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 Board = {
|
45
|
-
id?: string
|
46
|
-
name?: string
|
47
|
-
description?: string
|
48
|
-
model?: any
|
49
|
-
groupId?: string
|
50
|
-
thumbnail?: string
|
51
|
-
}
|
52
|
-
|
53
|
-
export type BoardGroup = {
|
54
|
-
id?: string
|
55
|
-
name?: string
|
56
|
-
description?: string
|
57
|
-
}
|
58
|
-
|
59
|
-
export type PlayGroup = {
|
60
|
-
id?: string
|
61
|
-
name?: string
|
62
|
-
description?: string
|
63
|
-
}
|