@operato/board 0.2.49 → 0.3.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 +54 -0
- package/assets/images/components/audio.png +0 -0
- package/assets/images/components/both-arrow.png +0 -0
- package/assets/images/components/color-image.png +0 -0
- package/assets/images/components/container.png +0 -0
- package/assets/images/components/dash.png +0 -0
- package/assets/images/components/donut.png +0 -0
- package/assets/images/components/ellipse.png +0 -0
- package/assets/images/components/forklift.png +0 -0
- package/assets/images/components/gif-image.png +0 -0
- package/assets/images/components/global-reference.png +0 -0
- package/assets/images/components/gray-image.png +0 -0
- package/assets/images/components/humidity-sensor.png +0 -0
- package/assets/images/components/info-window.png +0 -0
- package/assets/images/components/line.png +0 -0
- package/assets/images/components/local-reference.png +0 -0
- package/assets/images/components/person.png +0 -0
- package/assets/images/components/polygon.png +0 -0
- package/assets/images/components/polyline.png +0 -0
- package/assets/images/components/popup.png +0 -0
- package/assets/images/components/rect.png +0 -0
- package/assets/images/components/single-arrow.png +0 -0
- package/assets/images/components/star.png +0 -0
- package/assets/images/components/text.png +0 -0
- package/assets/images/components/triangle.png +0 -0
- package/assets/images/icon-vtoolbar.png +0 -0
- package/custom-elements.json +2665 -1411
- package/dist/src/component/3d.d.ts +2 -0
- package/dist/src/component/3d.js +27 -0
- package/dist/src/component/3d.js.map +1 -0
- package/dist/src/component/chart-and-gauge.d.ts +2 -0
- package/dist/src/component/chart-and-gauge.js +26 -0
- package/dist/src/component/chart-and-gauge.js.map +1 -0
- package/dist/src/component/container.d.ts +2 -0
- package/dist/src/component/container.js +60 -0
- package/dist/src/component/container.js.map +1 -0
- package/dist/src/component/data-source.d.ts +2 -0
- package/dist/src/component/data-source.js +28 -0
- package/dist/src/component/data-source.js.map +1 -0
- package/dist/src/component/etc.d.ts +2 -0
- package/dist/src/component/etc.js +82 -0
- package/dist/src/component/etc.js.map +1 -0
- package/dist/src/component/form.d.ts +2 -0
- package/dist/src/component/form.js +40 -0
- package/dist/src/component/form.js.map +1 -0
- package/dist/src/component/index.d.ts +12 -0
- package/dist/src/component/index.js +13 -0
- package/dist/src/component/index.js.map +1 -0
- package/dist/src/component/iot.d.ts +2 -0
- package/dist/src/component/iot.js +50 -0
- package/dist/src/component/iot.js.map +1 -0
- package/dist/src/component/line.d.ts +2 -0
- package/dist/src/component/line.js +130 -0
- package/dist/src/component/line.js.map +1 -0
- package/dist/src/component/register-default-groups.d.ts +1 -0
- package/dist/src/component/register-default-groups.js +28 -0
- package/dist/src/component/register-default-groups.js.map +1 -0
- package/dist/src/component/shape.d.ts +2 -0
- package/dist/src/component/shape.js +152 -0
- package/dist/src/component/shape.js.map +1 -0
- package/dist/src/component/table.d.ts +2 -0
- package/dist/src/component/table.js +26 -0
- package/dist/src/component/table.js.map +1 -0
- package/dist/src/component/text-and-media.d.ts +2 -0
- package/dist/src/component/text-and-media.js +122 -0
- package/dist/src/component/text-and-media.js.map +1 -0
- package/dist/src/component/warehouse.d.ts +2 -0
- package/dist/src/component/warehouse.js +24 -0
- package/dist/src/component/warehouse.js.map +1 -0
- package/dist/src/graphql/board.d.ts +6 -0
- package/dist/src/graphql/board.js +130 -0
- package/dist/src/graphql/board.js.map +1 -0
- package/dist/src/graphql/favorite-board.d.ts +1 -0
- package/dist/src/graphql/favorite-board.js +23 -0
- package/dist/src/graphql/favorite-board.js.map +1 -0
- package/dist/src/graphql/group.d.ts +7 -0
- package/dist/src/graphql/group.js +125 -0
- package/dist/src/graphql/group.js.map +1 -0
- package/dist/src/graphql/index.d.ts +4 -0
- package/dist/src/graphql/index.js +5 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/graphql/play-group.d.ts +8 -0
- package/dist/src/graphql/play-group.js +173 -0
- package/dist/src/graphql/play-group.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/modeller/component-toolbar/component-toolbar.js +56 -61
- package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -1
- package/dist/src/modeller/component-toolbar/mode-icons.d.ts +2 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js +86 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js.map +1 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +2 -2
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +4 -5
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.d.ts +2 -2
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +3 -3
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/effects.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animation.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animation.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-animation.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animations.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-animations.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +3 -3
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +3 -3
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -1
- package/dist/src/modeller/property-sidebar/inspector/inspector.js +1 -1
- package/dist/src/modeller/property-sidebar/inspector/inspector.js.map +1 -1
- package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +2 -2
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +3 -3
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -1
- package/dist/src/ox-board-list.d.ts +2 -0
- package/dist/src/ox-board-list.js +427 -0
- package/dist/src/ox-board-list.js.map +1 -0
- package/dist/src/ox-board-modeller.d.ts +5 -0
- package/dist/src/ox-board-modeller.js +32 -0
- package/dist/src/ox-board-modeller.js.map +1 -1
- package/dist/src/types.d.ts +30 -0
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -10
- package/src/component/3d.ts +29 -0
- package/src/component/chart-and-gauge.ts +28 -0
- package/src/component/container.ts +62 -0
- package/src/component/data-source.ts +30 -0
- package/src/component/etc.ts +87 -0
- package/src/component/form.ts +42 -0
- package/src/component/index.ts +12 -0
- package/src/component/iot.ts +52 -0
- package/src/component/line.ts +132 -0
- package/src/component/register-default-groups.ts +28 -0
- package/src/component/shape.ts +154 -0
- package/src/component/table.ts +28 -0
- package/src/component/text-and-media.ts +124 -0
- package/src/component/warehouse.ts +26 -0
- package/src/graphql/board.ts +144 -0
- package/src/graphql/favorite-board.ts +25 -0
- package/src/graphql/group.ts +138 -0
- package/src/graphql/index.ts +4 -0
- package/src/graphql/play-group.ts +189 -0
- package/src/index.ts +5 -0
- package/src/modeller/component-toolbar/component-toolbar.ts +70 -63
- package/src/modeller/component-toolbar/mode-icons.ts +86 -0
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +5 -5
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +5 -4
- package/src/modeller/property-sidebar/effects/effects.ts +2 -3
- package/src/modeller/property-sidebar/effects/property-animation.ts +2 -2
- package/src/modeller/property-sidebar/effects/property-animations.ts +2 -3
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +4 -3
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +4 -3
- package/src/modeller/property-sidebar/effects/property-event.ts +2 -3
- package/src/modeller/property-sidebar/effects/property-shadow.ts +2 -3
- package/src/modeller/property-sidebar/inspector/inspector.ts +1 -1
- package/src/modeller/property-sidebar/shapes/shapes.ts +3 -3
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +1 -1
- package/src/ox-board-list.ts +459 -0
- package/src/ox-board-modeller.ts +40 -0
- package/src/types.ts +48 -0
- package/tsconfig.json +1 -0
- package/web-dev-server.config.mjs +2 -0
- package/yarn-error.log +18355 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import '@operato/popup/ox-popup.js'
|
|
2
|
+
import '@operato/data-grist'
|
|
3
|
+
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { ColumnConfig, DataGrist, GristData, GristRecord, SortersConfig } from '@operato/data-grist'
|
|
8
|
+
import { OxPopup } from '@operato/popup'
|
|
9
|
+
|
|
10
|
+
import { createBoard, fetchBoardList } from './graphql/board'
|
|
11
|
+
import { fetchFavoriteBoardList } from './graphql/favorite-board'
|
|
12
|
+
import { fetchGroupList } from './graphql/group'
|
|
13
|
+
import { Board } from './types'
|
|
14
|
+
|
|
15
|
+
@customElement('ox-board-list')
|
|
16
|
+
class BoardList extends LitElement {
|
|
17
|
+
static styles = css`
|
|
18
|
+
:host {
|
|
19
|
+
display: flex;
|
|
20
|
+
|
|
21
|
+
width: 100%;
|
|
22
|
+
|
|
23
|
+
--grid-record-emphasized-background-color: red;
|
|
24
|
+
--grid-record-emphasized-color: yellow;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ox-grist {
|
|
28
|
+
flex: 1;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
|
|
31
|
+
--grid-record-emphasized-background-color: red;
|
|
32
|
+
--grid-record-emphasized-color: yellow;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#headroom {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding: var(--padding-default) var(--padding-wide);
|
|
40
|
+
border-top: 2px solid rgba(0, 0, 0, 0.2);
|
|
41
|
+
background-color: var(--theme-white-color);
|
|
42
|
+
box-shadow: var(--box-shadow);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#filters {
|
|
46
|
+
flex: 1;
|
|
47
|
+
--mdc-icon-size: 20px;
|
|
48
|
+
}
|
|
49
|
+
#mode {
|
|
50
|
+
width: 100px;
|
|
51
|
+
}
|
|
52
|
+
#add {
|
|
53
|
+
width: 50px;
|
|
54
|
+
text-align: right;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#modes > * {
|
|
58
|
+
padding: var(--padding-narrow);
|
|
59
|
+
font-size: 1em;
|
|
60
|
+
opacity: 0.5;
|
|
61
|
+
color: var(--primary-text-color);
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#modes > mwc-icon[active] {
|
|
66
|
+
border-radius: 9px;
|
|
67
|
+
background-color: rgba(var(--primary-color-rgb), 0.05);
|
|
68
|
+
opacity: 1;
|
|
69
|
+
color: var(--secondary-text-color);
|
|
70
|
+
cursor: default;
|
|
71
|
+
}
|
|
72
|
+
#modes > mwc-icon:hover {
|
|
73
|
+
opacity: 1;
|
|
74
|
+
color: var(--secondary-text-color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#add button {
|
|
78
|
+
background-color: var(--status-success-color);
|
|
79
|
+
border: 0;
|
|
80
|
+
border-radius: 50%;
|
|
81
|
+
padding: 5px;
|
|
82
|
+
width: 36px;
|
|
83
|
+
height: 36px;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
#add button:hover {
|
|
87
|
+
background-color: var(--focus-background-color);
|
|
88
|
+
box-shadow: var(--box-shadow);
|
|
89
|
+
}
|
|
90
|
+
#add button mwc-icon {
|
|
91
|
+
font-size: 2em;
|
|
92
|
+
color: var(--theme-white-color);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#filters {
|
|
96
|
+
position: relative;
|
|
97
|
+
}
|
|
98
|
+
#filters [type='text'] {
|
|
99
|
+
background-color: transparent;
|
|
100
|
+
border: 0;
|
|
101
|
+
border-bottom: var(--border-dark-color);
|
|
102
|
+
padding: var(--padding-narrow) var(--padding-narrow) 7px 25px;
|
|
103
|
+
font-size: var(--fontsize-large);
|
|
104
|
+
}
|
|
105
|
+
#filters [type='text']:focus {
|
|
106
|
+
outline: none;
|
|
107
|
+
}
|
|
108
|
+
#filters mwc-icon {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 3px;
|
|
111
|
+
color: var(--secondary-color);
|
|
112
|
+
}
|
|
113
|
+
#filters * {
|
|
114
|
+
margin-right: var(--margin-default);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
oops-spinner {
|
|
118
|
+
display: none;
|
|
119
|
+
position: absolute;
|
|
120
|
+
left: 50%;
|
|
121
|
+
top: 50%;
|
|
122
|
+
transform: translate(-50%, -50%);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
oops-spinner[show] {
|
|
126
|
+
display: block;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media only screen and (max-width: 460px) {
|
|
130
|
+
#modes {
|
|
131
|
+
display: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`
|
|
135
|
+
|
|
136
|
+
@property({ type: Boolean }) creatable: boolean = false
|
|
137
|
+
@property({ type: Object }) config: any
|
|
138
|
+
@property({ type: Object }) data: any
|
|
139
|
+
@property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = 'CARD'
|
|
140
|
+
@property({ type: String }) groupId?: string
|
|
141
|
+
@property({ type: Array }) groups: any[] = []
|
|
142
|
+
@property({ type: Array }) favorites: any[] = []
|
|
143
|
+
|
|
144
|
+
@state() _showSpinner: boolean = false
|
|
145
|
+
|
|
146
|
+
@query('ox-grist') grist!: DataGrist
|
|
147
|
+
|
|
148
|
+
render() {
|
|
149
|
+
const mode = this.mode || 'CARD'
|
|
150
|
+
|
|
151
|
+
return html`
|
|
152
|
+
<ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
153
|
+
<div slot="headroom" id="headroom">
|
|
154
|
+
<div id="filters">
|
|
155
|
+
<mwc-icon>search</mwc-icon>
|
|
156
|
+
<input type="text" />
|
|
157
|
+
|
|
158
|
+
<select
|
|
159
|
+
@change=${(e: Event) => {
|
|
160
|
+
this.groupId = (e.currentTarget as HTMLInputElement).value
|
|
161
|
+
this.requestUpdate()
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
<option value="">*</option>
|
|
165
|
+
${this.groups.map(
|
|
166
|
+
group =>
|
|
167
|
+
html` <option value=${group.id} ?selected=${group.id === this.groupId}>${group.description}</option> `
|
|
168
|
+
)}
|
|
169
|
+
</select>
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<div id="modes">
|
|
173
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
174
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
175
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
${this.creatable
|
|
179
|
+
? html`
|
|
180
|
+
<div id="add">
|
|
181
|
+
<button><mwc-icon @click=${() => this.onCreateBoard()}>add</mwc-icon></button>
|
|
182
|
+
</div>
|
|
183
|
+
`
|
|
184
|
+
: undefined}
|
|
185
|
+
</div>
|
|
186
|
+
</ox-grist>
|
|
187
|
+
|
|
188
|
+
<oops-spinner ?show=${this._showSpinner}></oops-spinner>
|
|
189
|
+
`
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async fetchHandler({ page, limit, sorters = [] }: { page: number; limit: number; sorters: SortersConfig }) {
|
|
193
|
+
this._showSpinner = true
|
|
194
|
+
|
|
195
|
+
const { items: records, total } = await this.getBoards({ page, limit, sorters })
|
|
196
|
+
|
|
197
|
+
this._showSpinner = false
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
total,
|
|
201
|
+
records
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
get gristConfig() {
|
|
206
|
+
return {
|
|
207
|
+
list: {
|
|
208
|
+
thumbnail: function (record: GristRecord, rowIndex: number) {
|
|
209
|
+
return html` <img src=${record.thumbnail} style="width: 100%; height: 100%;" /> `
|
|
210
|
+
},
|
|
211
|
+
fields: ['name', 'description'],
|
|
212
|
+
details: ['updatedAt']
|
|
213
|
+
},
|
|
214
|
+
columns: [
|
|
215
|
+
{
|
|
216
|
+
type: 'gutter',
|
|
217
|
+
gutterName: 'dirty'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
type: 'gutter',
|
|
221
|
+
gutterName: 'sequence'
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
type: 'gutter',
|
|
225
|
+
gutterName: 'button',
|
|
226
|
+
icon: 'star_border',
|
|
227
|
+
handlers: {
|
|
228
|
+
click: (
|
|
229
|
+
columns: ColumnConfig[],
|
|
230
|
+
data: GristData,
|
|
231
|
+
column: ColumnConfig,
|
|
232
|
+
record: GristRecord,
|
|
233
|
+
rowIndex: number
|
|
234
|
+
): void => {}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: 'gutter',
|
|
239
|
+
gutterName: 'button',
|
|
240
|
+
icon: 'drive_file_rename_outline',
|
|
241
|
+
handlers: {
|
|
242
|
+
click: (
|
|
243
|
+
columns: ColumnConfig[],
|
|
244
|
+
data: GristData,
|
|
245
|
+
column: ColumnConfig,
|
|
246
|
+
record: GristRecord,
|
|
247
|
+
rowIndex: number
|
|
248
|
+
): void => {}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
type: 'string',
|
|
253
|
+
name: 'id',
|
|
254
|
+
hidden: true
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
type: 'string',
|
|
258
|
+
name: 'name',
|
|
259
|
+
header: 'name',
|
|
260
|
+
record: {
|
|
261
|
+
editable: true,
|
|
262
|
+
align: 'left'
|
|
263
|
+
},
|
|
264
|
+
width: 200,
|
|
265
|
+
sortable: true
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
type: 'string',
|
|
269
|
+
name: 'description',
|
|
270
|
+
header: 'description',
|
|
271
|
+
record: {
|
|
272
|
+
editable: true,
|
|
273
|
+
align: 'left'
|
|
274
|
+
},
|
|
275
|
+
width: 200,
|
|
276
|
+
handlers: {
|
|
277
|
+
dblclick: (
|
|
278
|
+
columns: ColumnConfig[],
|
|
279
|
+
data: GristData,
|
|
280
|
+
column: ColumnConfig,
|
|
281
|
+
record: GristRecord,
|
|
282
|
+
rowIndex: number
|
|
283
|
+
): void => {
|
|
284
|
+
alert(`${column.name} ${record[column.name]}, row : ${rowIndex}`)
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
type: 'boolean',
|
|
290
|
+
name: 'active',
|
|
291
|
+
header: 'active',
|
|
292
|
+
record: {
|
|
293
|
+
editable: true
|
|
294
|
+
},
|
|
295
|
+
sortable: true,
|
|
296
|
+
width: 60
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
type: 'datetime',
|
|
300
|
+
name: 'updatedAt',
|
|
301
|
+
header: 'updated at',
|
|
302
|
+
record: {
|
|
303
|
+
editable: true
|
|
304
|
+
},
|
|
305
|
+
sortable: true,
|
|
306
|
+
width: 180
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
type: 'datetime',
|
|
310
|
+
name: 'createdAt',
|
|
311
|
+
header: 'created at',
|
|
312
|
+
record: {
|
|
313
|
+
editable: true
|
|
314
|
+
},
|
|
315
|
+
sortable: true,
|
|
316
|
+
width: 180
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
rows: {
|
|
320
|
+
selectable: {
|
|
321
|
+
multiple: true
|
|
322
|
+
},
|
|
323
|
+
handlers: {},
|
|
324
|
+
classifier: function (
|
|
325
|
+
record: GristRecord,
|
|
326
|
+
rowIndex: number
|
|
327
|
+
): { emphasized?: boolean | string | string[]; [key: string]: any } | void {}
|
|
328
|
+
},
|
|
329
|
+
sorters: [
|
|
330
|
+
{
|
|
331
|
+
name: 'name',
|
|
332
|
+
desc: false
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
pagination: {
|
|
336
|
+
pages: [20, 30, 50, 100, 200]
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
async refresh() {
|
|
342
|
+
this.groups = (await fetchGroupList()).groups.items
|
|
343
|
+
|
|
344
|
+
if (this.groups) {
|
|
345
|
+
await this.refreshBoards()
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
async getBoards({
|
|
350
|
+
page = 1,
|
|
351
|
+
limit = 30,
|
|
352
|
+
sorters = []
|
|
353
|
+
}: { page?: number; limit?: number; sorters?: SortersConfig } = {}) {
|
|
354
|
+
if (this.groupId && this.groupId == 'favor')
|
|
355
|
+
return await this.getFavoriteBoards({
|
|
356
|
+
page,
|
|
357
|
+
limit
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
var listParam = {
|
|
361
|
+
filters: this.groupId
|
|
362
|
+
? [
|
|
363
|
+
{
|
|
364
|
+
name: 'group_id',
|
|
365
|
+
operator: 'eq',
|
|
366
|
+
value: this.groupId
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
: [],
|
|
370
|
+
sortings: sorters,
|
|
371
|
+
pagination: {
|
|
372
|
+
page,
|
|
373
|
+
limit
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return (await fetchBoardList(listParam)).boards
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
async getFavoriteBoards({ page = 1, limit = 30 } = {}) {
|
|
381
|
+
var listParam = {
|
|
382
|
+
pagination: {
|
|
383
|
+
page,
|
|
384
|
+
limit
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return (await fetchFavoriteBoardList(listParam)).favoriteBoards
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async refreshBoards() {
|
|
392
|
+
if (!this.groups) {
|
|
393
|
+
await this.refresh()
|
|
394
|
+
return
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
this.grist.fetch()
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
async onCreateBoard() {
|
|
401
|
+
/*
|
|
402
|
+
* 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
|
403
|
+
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
|
404
|
+
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
405
|
+
*/
|
|
406
|
+
var template = html`
|
|
407
|
+
<process-creation-popup
|
|
408
|
+
.defaultGroup=${this.groupId}
|
|
409
|
+
.groups=${this.groups}
|
|
410
|
+
@create-process=${async (e: CustomEvent) => {
|
|
411
|
+
try {
|
|
412
|
+
var { name, description, groupId } = e.detail
|
|
413
|
+
var board: Board = {
|
|
414
|
+
name,
|
|
415
|
+
description,
|
|
416
|
+
groupId,
|
|
417
|
+
model: {
|
|
418
|
+
width: 1200,
|
|
419
|
+
height: 800
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const { createBoard: created } = await createBoard(board)
|
|
424
|
+
|
|
425
|
+
// this.popup && this.popup.close()
|
|
426
|
+
|
|
427
|
+
// await sleep(100)
|
|
428
|
+
|
|
429
|
+
this.notify('info', 'new process created')
|
|
430
|
+
} catch (ex: Error | any) {
|
|
431
|
+
console.error(ex)
|
|
432
|
+
this.notify('error', ex, ex)
|
|
433
|
+
}
|
|
434
|
+
}}
|
|
435
|
+
></process-creation-popup>
|
|
436
|
+
`
|
|
437
|
+
|
|
438
|
+
OxPopup.open({
|
|
439
|
+
template,
|
|
440
|
+
parent: this.renderRoot as Element
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
requestAnimationFrame(() => {
|
|
444
|
+
dispatchEvent(new Event('resize'))
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
notify(level: 'warn' | 'error' | 'info', message: any, ex?: Error) {
|
|
449
|
+
document.dispatchEvent(
|
|
450
|
+
new CustomEvent('notify', {
|
|
451
|
+
detail: {
|
|
452
|
+
level,
|
|
453
|
+
message,
|
|
454
|
+
ex
|
|
455
|
+
}
|
|
456
|
+
})
|
|
457
|
+
)
|
|
458
|
+
}
|
|
459
|
+
}
|
package/src/ox-board-modeller.ts
CHANGED
|
@@ -14,10 +14,13 @@ import { Scene, SCENE_MODE } from '@hatiolab/things-scene'
|
|
|
14
14
|
import { OxPopup } from '@operato/popup'
|
|
15
15
|
|
|
16
16
|
import { EditToolbar } from './modeller/edit-toolbar'
|
|
17
|
+
import { ComponentGroup, ComponentTemplate } from './types'
|
|
17
18
|
import { togglefullscreen } from './utils/fullscreen'
|
|
18
19
|
|
|
19
20
|
const isMacOS = navigator.userAgent.indexOf('Mac') != -1
|
|
20
21
|
|
|
22
|
+
var Registry: ComponentGroup[] = []
|
|
23
|
+
|
|
21
24
|
@customElement('ox-board-modeller')
|
|
22
25
|
export class BoardModeller extends LitElement {
|
|
23
26
|
static styles = [
|
|
@@ -93,6 +96,43 @@ export class BoardModeller extends LitElement {
|
|
|
93
96
|
`
|
|
94
97
|
]
|
|
95
98
|
|
|
99
|
+
static registerGroup(group: ComponentGroup) {
|
|
100
|
+
var found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name)
|
|
101
|
+
|
|
102
|
+
if (found) {
|
|
103
|
+
found = {
|
|
104
|
+
...found,
|
|
105
|
+
...group
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
Registry.push(group)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static registerTemplate(templates: ComponentTemplate[]): void {
|
|
113
|
+
templates &&
|
|
114
|
+
templates.forEach(template => {
|
|
115
|
+
var group = Registry.find(group => group.name == template.group)
|
|
116
|
+
|
|
117
|
+
if (!group) {
|
|
118
|
+
console.warn('Invalid group', group, template)
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {
|
|
123
|
+
group.templates.push(template)
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static get groups(): ComponentGroup[] {
|
|
129
|
+
return Registry
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static getGroup(name: string) {
|
|
133
|
+
return Registry.find(group => group.name === name)
|
|
134
|
+
}
|
|
135
|
+
|
|
96
136
|
@property({ type: String }) boardName: string = ''
|
|
97
137
|
@property({ type: Object }) model: any = null
|
|
98
138
|
@property({ type: String }) baseUrl: string = ''
|
package/src/types.ts
CHANGED
|
@@ -24,3 +24,51 @@ export interface Pallet {
|
|
|
24
24
|
name: string
|
|
25
25
|
templates: PalletItem[]
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
export type ComponentTemplate = {
|
|
29
|
+
type: string
|
|
30
|
+
description: string
|
|
31
|
+
group:
|
|
32
|
+
| 'line'
|
|
33
|
+
| 'shape'
|
|
34
|
+
| 'textAndMedia'
|
|
35
|
+
| 'chartAndGauge'
|
|
36
|
+
| 'table'
|
|
37
|
+
| 'container'
|
|
38
|
+
| 'dataSource'
|
|
39
|
+
| 'IoT'
|
|
40
|
+
| '3D'
|
|
41
|
+
| 'warehouse'
|
|
42
|
+
| 'form'
|
|
43
|
+
| 'etc'
|
|
44
|
+
| string
|
|
45
|
+
icon: any
|
|
46
|
+
model: Model
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type ComponentGroup = {
|
|
50
|
+
name: string
|
|
51
|
+
description: string
|
|
52
|
+
icon: string
|
|
53
|
+
templates: ComponentTemplate[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type Board = {
|
|
57
|
+
id?: string
|
|
58
|
+
name?: string
|
|
59
|
+
description?: string
|
|
60
|
+
model?: any
|
|
61
|
+
groupId?: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type BoardGroup = {
|
|
65
|
+
id?: string
|
|
66
|
+
name?: string
|
|
67
|
+
description?: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type PlayGroup = {
|
|
71
|
+
id?: string
|
|
72
|
+
name?: string
|
|
73
|
+
description?: string
|
|
74
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
+
import image from '@rollup/plugin-image'
|
|
2
3
|
|
|
3
4
|
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
5
|
const hmr = process.argv.includes('--hmr')
|
|
@@ -20,6 +21,7 @@ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
|
20
21
|
// },
|
|
21
22
|
|
|
22
23
|
plugins: [
|
|
24
|
+
image()
|
|
23
25
|
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
26
|
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
27
|
]
|