@operato/board 7.1.30 → 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 +18 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/.storybook/main.js +0 -3
- package/.storybook/server.mjs +0 -8
- package/demo/index-modeller.html +0 -112
- package/demo/index-player.html +0 -112
- package/demo/index-viewer.html +0 -112
- package/demo/index.html +0 -112
- 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,263 +0,0 @@
|
|
1
|
-
import './confidential-overlay'
|
2
|
-
import './ox-scene-layer'
|
3
|
-
import './ox-scene-handler'
|
4
|
-
|
5
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
6
|
-
import { customElement, property } from 'lit/decorators.js'
|
7
|
-
|
8
|
-
import { Component, create as createScene, FITMODE, Model, Properties, Scene, SCENE_MODE } from '@hatiolab/things-scene'
|
9
|
-
|
10
|
-
import OxSceneLayer from './ox-scene-layer'
|
11
|
-
|
12
|
-
@customElement('ox-scene-viewer')
|
13
|
-
export default class OxSceneViewer extends LitElement {
|
14
|
-
static styles = css`
|
15
|
-
:host {
|
16
|
-
outline: none;
|
17
|
-
}
|
18
|
-
`
|
19
|
-
|
20
|
-
@property({ type: Object }) scene: Scene | null = null
|
21
|
-
@property({ type: Object }) model?: Model
|
22
|
-
/* Scene Mode - mode 0 : view mode, mode 1 : edit mode, mode 2 : shift mode */
|
23
|
-
@property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.VIEW
|
24
|
-
@property({ type: Number }) screenSize: number = 13.3
|
25
|
-
@property({ type: Object }) variables: Properties = {}
|
26
|
-
@property({ type: Object }) data: any
|
27
|
-
/*
|
28
|
-
* 캔바스에 모델을 어떻게 적절하게 보여줄 것인지를 설정한다.
|
29
|
-
*
|
30
|
-
* @none 가로, 세로 스케일을 1로 고정하고, {0, 0}좌표로 translate시킨다.
|
31
|
-
* @both 캔바스에 모델을 꼭 채우도록 가로, 세로 스케일을 조정하고, {0, 0}좌표로 translate시킨다.
|
32
|
-
* @width 캔바스의 폭에 모델의 폭을 일치하도록 가로, 세로 스케일을 동일하게 조정하고, {0, 0}좌표로 translate시킨다.
|
33
|
-
* @height 캔바스의 높이에 모델의 높이를 일치하도록 가로, 세로 스케일을 동일하게 조정하고, {0, 0}좌표로 translate시킨다.
|
34
|
-
* @center 가로, 세로 스케일을 1로 고정하고 모델이 화면의 중앙에 위치하도록 translate시킨다.
|
35
|
-
* @ratio 모델의 모든 부분이 캔바스에 최대 크기로 표현될 수 있도록 가로, 세로 동일한 스케일로 조정하고, {0, 0}좌표로 translate시킨다.
|
36
|
-
*/
|
37
|
-
@property({ type: String }) fit: FITMODE = 'none'
|
38
|
-
@property({ type: Array }) selected: Component[] = []
|
39
|
-
@property({ type: Boolean }) disposeWhenDetached: boolean = false
|
40
|
-
@property({ type: String }) baseUrl: string = ''
|
41
|
-
@property({ type: Object }) provider: any
|
42
|
-
@property({ type: String }) name: string = 'noname'
|
43
|
-
@property({ type: Boolean }) enableInspector: boolean = true
|
44
|
-
@property({ type: Boolean }) showInspector: boolean = false
|
45
|
-
|
46
|
-
private lastOffsetWidth?: number
|
47
|
-
|
48
|
-
disconnectedCallback() {
|
49
|
-
super.disconnectedCallback()
|
50
|
-
|
51
|
-
if (this.scene && this.disposeWhenDetached) {
|
52
|
-
this._disposeScene()
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
render() {
|
57
|
-
return html` <slot></slot> `
|
58
|
-
}
|
59
|
-
|
60
|
-
updated(change: PropertyValues<this>) {
|
61
|
-
change.has('model') && this._onModelChanged(this.model)
|
62
|
-
change.has('mode') && this._onModeChanged(this.mode)
|
63
|
-
change.has('screenSize') && this._onDisplayChanged(this.screenSize)
|
64
|
-
change.has('data') && this._onDataChanged(this.data)
|
65
|
-
change.has('baseUrl') && this._onBaseUrlChanged(this.baseUrl)
|
66
|
-
}
|
67
|
-
|
68
|
-
_setScene(scene: Scene | null) {
|
69
|
-
this.scene = scene
|
70
|
-
this.dispatchEvent(
|
71
|
-
new CustomEvent('scene-changed', {
|
72
|
-
bubbles: true,
|
73
|
-
composed: true,
|
74
|
-
detail: { value: scene }
|
75
|
-
})
|
76
|
-
)
|
77
|
-
}
|
78
|
-
|
79
|
-
_setMode(mode: SCENE_MODE) {
|
80
|
-
this.mode = mode
|
81
|
-
this.dispatchEvent(
|
82
|
-
new CustomEvent('mode-changed', {
|
83
|
-
bubbles: true,
|
84
|
-
composed: true,
|
85
|
-
detail: { value: mode }
|
86
|
-
})
|
87
|
-
)
|
88
|
-
}
|
89
|
-
|
90
|
-
_setVariables(variables: Properties) {
|
91
|
-
this.variables = variables
|
92
|
-
this.dispatchEvent(
|
93
|
-
new CustomEvent('variables-changed', {
|
94
|
-
bubbles: true,
|
95
|
-
composed: true,
|
96
|
-
detail: { value: variables }
|
97
|
-
})
|
98
|
-
)
|
99
|
-
}
|
100
|
-
|
101
|
-
_setSelected(selected: Component[]) {
|
102
|
-
this.selected = selected
|
103
|
-
this.dispatchEvent(
|
104
|
-
new CustomEvent('selected-changed', {
|
105
|
-
bubbles: true,
|
106
|
-
composed: true,
|
107
|
-
detail: { value: selected }
|
108
|
-
})
|
109
|
-
)
|
110
|
-
}
|
111
|
-
|
112
|
-
_disposeScene() {
|
113
|
-
if (this.scene) {
|
114
|
-
this.scene.off('selected', this._onSelectedChanged, this)
|
115
|
-
this.scene.off('mode', this._onSceneModeChanged, this)
|
116
|
-
|
117
|
-
if (this.provider) {
|
118
|
-
this.scene.release && this.scene.release()
|
119
|
-
} else {
|
120
|
-
this.scene.dispose()
|
121
|
-
}
|
122
|
-
|
123
|
-
this._setScene(null)
|
124
|
-
this._setSelected([])
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
resize(force: boolean) {
|
129
|
-
if (typeof this.scene == 'object') {
|
130
|
-
if (force || this.fit === 'both' || Math.abs(this.offsetWidth - (this.lastOffsetWidth || 0)) >= 1) {
|
131
|
-
requestAnimationFrame(() => {
|
132
|
-
if (this.scene) {
|
133
|
-
this.scene.resize()
|
134
|
-
this.scene.fit(this.fit)
|
135
|
-
}
|
136
|
-
})
|
137
|
-
}
|
138
|
-
|
139
|
-
this.lastOffsetWidth = this.offsetWidth
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
_onModelChanged(model?: Model) {
|
144
|
-
this._disposeScene()
|
145
|
-
|
146
|
-
if (!model) {
|
147
|
-
return
|
148
|
-
}
|
149
|
-
|
150
|
-
const layers = Array.from(this.querySelectorAll('ox-scene-layer')).map(layer => (layer as OxSceneLayer).getModel())
|
151
|
-
|
152
|
-
const handlers = Array.from(this.querySelectorAll('ox-scene-handler')).map(handler => handler.getAttribute('type'))
|
153
|
-
|
154
|
-
this._setScene(
|
155
|
-
createScene({
|
156
|
-
target: this,
|
157
|
-
model: JSON.parse(JSON.stringify(model)),
|
158
|
-
layers,
|
159
|
-
handlers,
|
160
|
-
mode: this.mode,
|
161
|
-
refProvider: this.provider
|
162
|
-
})
|
163
|
-
)
|
164
|
-
|
165
|
-
if (this.provider) {
|
166
|
-
this.provider.add(this.name, this.scene)
|
167
|
-
}
|
168
|
-
|
169
|
-
this.scene!.screen = this.screenSize
|
170
|
-
|
171
|
-
/* 이 컴포넌트의 폭이 값을 가지고 있으면 - 화면상에 자리를 잡고 보여지고 있음을 의미한다.
|
172
|
-
* 이 때는 정상적으로 그려주고,
|
173
|
-
* 그렇지 않으면, 다음 Resize Handling시에 처리하도록 한다.
|
174
|
-
*/
|
175
|
-
this.resize(true)
|
176
|
-
|
177
|
-
this._setVariables(model.variables || this.scene!.variables)
|
178
|
-
|
179
|
-
this.scene!.on('selected', this._onSelectedChanged, this)
|
180
|
-
this.scene!.on('mode', this._onSceneModeChanged, this)
|
181
|
-
|
182
|
-
this._onModeChanged(this.mode)
|
183
|
-
this._onDisplayChanged(this.screenSize)
|
184
|
-
this._onBaseUrlChanged(this.baseUrl)
|
185
|
-
|
186
|
-
this.focus()
|
187
|
-
}
|
188
|
-
|
189
|
-
_onDisplayChanged(screenSize: string | number) {
|
190
|
-
if (!this.scene) {
|
191
|
-
return
|
192
|
-
}
|
193
|
-
|
194
|
-
if (screenSize) {
|
195
|
-
this.scene.screen = parseFloat(String(screenSize))
|
196
|
-
}
|
197
|
-
}
|
198
|
-
|
199
|
-
_onModeChanged(mode: SCENE_MODE) {
|
200
|
-
if (!this.scene) {
|
201
|
-
return
|
202
|
-
}
|
203
|
-
this.scene.mode = Number(mode)
|
204
|
-
}
|
205
|
-
|
206
|
-
_onDataChanged(data: any) {
|
207
|
-
if (!this.scene || !data) {
|
208
|
-
return
|
209
|
-
}
|
210
|
-
|
211
|
-
this.scene.data = data
|
212
|
-
}
|
213
|
-
|
214
|
-
_onSelectedChanged(after: Component[]) {
|
215
|
-
/*
|
216
|
-
scene 컴포넌트의 속성을 속성 에디터(input box등)에서 변경하다가,
|
217
|
-
scene의 다른 컴포넌트를 클릭해서 포커스(선택) 컴포넌트를 변경하게되면,
|
218
|
-
속성 에디터(input box등)의 value change 이벤트의 처리와 충돌(레이스)하게된다.
|
219
|
-
|
220
|
-
기대하는 순서는 먼저 속성 에디터의 value change 이벤트를 처리한 후에,
|
221
|
-
selected 이벤트를 처리할 수 있도록 requestAnimationFrame으로 한 프레임을 지연하도록 하였다.
|
222
|
-
*/
|
223
|
-
requestAnimationFrame(() => {
|
224
|
-
this._setSelected(after)
|
225
|
-
})
|
226
|
-
}
|
227
|
-
|
228
|
-
_onSceneModeChanged(after: SCENE_MODE) {
|
229
|
-
if (!this.scene) {
|
230
|
-
return
|
231
|
-
}
|
232
|
-
|
233
|
-
if (this.mode !== after) {
|
234
|
-
this._setMode(after)
|
235
|
-
}
|
236
|
-
|
237
|
-
switch (after) {
|
238
|
-
case 1:
|
239
|
-
this.style.cursor = 'default'
|
240
|
-
break
|
241
|
-
case 2:
|
242
|
-
this.style.cursor = 'all-scroll'
|
243
|
-
break
|
244
|
-
case 3:
|
245
|
-
this.style.cursor = 'crosshair'
|
246
|
-
break
|
247
|
-
case 4:
|
248
|
-
this.style.cursor = 'copy'
|
249
|
-
break
|
250
|
-
case 5:
|
251
|
-
this.style.cursor = 'context-menu'
|
252
|
-
break
|
253
|
-
}
|
254
|
-
}
|
255
|
-
|
256
|
-
_onBaseUrlChanged(after: string) {
|
257
|
-
if (!this.scene) {
|
258
|
-
return
|
259
|
-
}
|
260
|
-
|
261
|
-
this.scene.baseUrl = after
|
262
|
-
}
|
263
|
-
}
|
@@ -1,236 +0,0 @@
|
|
1
|
-
import '@material/web/icon/icon.js'
|
2
|
-
import '@operato/property-editor/ox-properties-dynamic-view.js'
|
3
|
-
import '@operato/markdown'
|
4
|
-
|
5
|
-
import { css, html, LitElement, nothing } from 'lit'
|
6
|
-
import { customElement, property } from 'lit/decorators.js'
|
7
|
-
import * as XLSX from 'xlsx'
|
8
|
-
|
9
|
-
import { ScrollbarStyles } from '@operato/styles'
|
10
|
-
import { i18next } from '@operato/i18n'
|
11
|
-
|
12
|
-
const ICON_EXCEL_EXPORT = new URL('../../icons/icon-excel-export.png', import.meta.url).href
|
13
|
-
|
14
|
-
@customElement('ox-board-component-info')
|
15
|
-
export class BoardComponentInfo extends LitElement {
|
16
|
-
static styles = [
|
17
|
-
ScrollbarStyles,
|
18
|
-
css`
|
19
|
-
:host {
|
20
|
-
background-color: var(--md-sys-color-surface);
|
21
|
-
font-size: 12px;
|
22
|
-
box-sizing: border-box;
|
23
|
-
display: flex;
|
24
|
-
flex-direction: column;
|
25
|
-
border: 2px solid var(--md-sys-color-on-primary-container);
|
26
|
-
border-radius: 3px;
|
27
|
-
|
28
|
-
--md-icon-size: 12px;
|
29
|
-
}
|
30
|
-
|
31
|
-
[header] {
|
32
|
-
background-color: var(--md-sys-color-on-primary-container);
|
33
|
-
user-select: none;
|
34
|
-
align-items: center;
|
35
|
-
color: #eee;
|
36
|
-
padding: 0 2px;
|
37
|
-
|
38
|
-
display: flex;
|
39
|
-
}
|
40
|
-
|
41
|
-
[header] md-icon {
|
42
|
-
margin-left: auto;
|
43
|
-
align-self: center;
|
44
|
-
}
|
45
|
-
|
46
|
-
[content] {
|
47
|
-
overflow: auto;
|
48
|
-
}
|
49
|
-
|
50
|
-
table {
|
51
|
-
border-collapse: collapse;
|
52
|
-
background-color: var(--md-sys-color-surface);
|
53
|
-
width: 100%;
|
54
|
-
margin: auto;
|
55
|
-
table-layout: fixed;
|
56
|
-
}
|
57
|
-
|
58
|
-
tr {
|
59
|
-
border-bottom: var(--border-dim-color);
|
60
|
-
}
|
61
|
-
|
62
|
-
td {
|
63
|
-
padding: var(--spacing-small);
|
64
|
-
border-right: var(--border-dim-color);
|
65
|
-
font-size: 0.8em;
|
66
|
-
}
|
67
|
-
|
68
|
-
[subTh] {
|
69
|
-
text-align: center !important;
|
70
|
-
font-weight: bold;
|
71
|
-
width: 40px;
|
72
|
-
text-transform: capitalize;
|
73
|
-
background-color: rgba(0, 0, 0, 0.05);
|
74
|
-
}
|
75
|
-
|
76
|
-
span.export {
|
77
|
-
position: absolute;
|
78
|
-
width: 20px;
|
79
|
-
height: 20px;
|
80
|
-
top: 4px;
|
81
|
-
right: 4px;
|
82
|
-
background: var(--url-icon-excel-export) no-repeat;
|
83
|
-
}
|
84
|
-
|
85
|
-
a {
|
86
|
-
text-decoration: none;
|
87
|
-
}
|
88
|
-
`
|
89
|
-
]
|
90
|
-
|
91
|
-
@property({ type: Object }) component?: any
|
92
|
-
|
93
|
-
private dragEndHandler = this.onDragEnd.bind(this) as EventListener
|
94
|
-
private dragMoveHandler = this.onDragMove.bind(this) as EventListener
|
95
|
-
|
96
|
-
connectedCallback(): void {
|
97
|
-
super.connectedCallback()
|
98
|
-
|
99
|
-
this.style.setProperty('--url-icon-excel-export', `url(${ICON_EXCEL_EXPORT})`)
|
100
|
-
|
101
|
-
document.addEventListener('mouseup', this.dragEndHandler)
|
102
|
-
document.addEventListener('mousemove', this.dragMoveHandler)
|
103
|
-
}
|
104
|
-
|
105
|
-
disconnectedCallback(): void {
|
106
|
-
super.disconnectedCallback()
|
107
|
-
|
108
|
-
document.removeEventListener('mouseup', this.dragEndHandler)
|
109
|
-
document.removeEventListener('mousemove', this.dragMoveHandler)
|
110
|
-
}
|
111
|
-
|
112
|
-
render() {
|
113
|
-
const { state, data, value } = this.component || {}
|
114
|
-
const { id, type } = state || {}
|
115
|
-
|
116
|
-
return html`
|
117
|
-
<div header @mousedown=${this.onDragStart.bind(this)} draggable="false">
|
118
|
-
Component Inspection<md-icon @click=${(e: MouseEvent) => this.dispatchEvent(new CustomEvent('close'))}
|
119
|
-
>close</md-icon
|
120
|
-
>
|
121
|
-
</div>
|
122
|
-
<div content @wheel=${(e: WheelEvent) => this.onWheel(e)}>
|
123
|
-
<table>
|
124
|
-
<tr>
|
125
|
-
<td subTh>${i18next.t('label.id')}</td>
|
126
|
-
<td>
|
127
|
-
<a
|
128
|
-
@click=${(e: MouseEvent) => {
|
129
|
-
this.component.trigger('reactionreset')
|
130
|
-
this.component.trigger('reaction')
|
131
|
-
return false
|
132
|
-
}}
|
133
|
-
>${id}</a
|
134
|
-
>
|
135
|
-
</td>
|
136
|
-
</tr>
|
137
|
-
<tr>
|
138
|
-
<td subTh>${i18next.t('label.type')}</td>
|
139
|
-
<td>${type}</td>
|
140
|
-
</tr>
|
141
|
-
<tr>
|
142
|
-
<td subTh>${i18next.t('label.value')}</td>
|
143
|
-
<td>${value === data ? 'equal to data' : html`<pre>${JSON.stringify(value, null, 2)}</pre>`}</td>
|
144
|
-
</tr>
|
145
|
-
|
146
|
-
<tr>
|
147
|
-
<td colspan="2" style="position: relative;">
|
148
|
-
<pre>${JSON.stringify(data, null, 2)}</pre>
|
149
|
-
${data && Array.isArray(data)
|
150
|
-
? html`<span class="export" @tap=${() => this.exportData()}></span>`
|
151
|
-
: nothing}
|
152
|
-
</td>
|
153
|
-
</tr>
|
154
|
-
</table>
|
155
|
-
</div>
|
156
|
-
`
|
157
|
-
}
|
158
|
-
|
159
|
-
private dragStart?: { x: number; y: number }
|
160
|
-
|
161
|
-
onWheel(e: WheelEvent) {
|
162
|
-
const scrollableDiv = e.currentTarget! as HTMLElement
|
163
|
-
const contentDiv = scrollableDiv.querySelector('table')!
|
164
|
-
|
165
|
-
// 컨텐츠의 높이와 div의 높이를 비교하여 수평 스크롤을 동작시키거나 수직 스크롤을 동작시킴
|
166
|
-
if (contentDiv.offsetHeight > scrollableDiv.offsetHeight) {
|
167
|
-
// 수직 스크롤 가능한 경우
|
168
|
-
scrollableDiv.scrollTop += e.deltaY
|
169
|
-
} else {
|
170
|
-
// 수직 스크롤이 없는 경우
|
171
|
-
scrollableDiv.scrollLeft += e.deltaY
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
onDragStart(e: MouseEvent) {
|
176
|
-
e.stopPropagation()
|
177
|
-
|
178
|
-
if (e.button == 0) {
|
179
|
-
this.dragStart = {
|
180
|
-
x: e.clientX,
|
181
|
-
y: e.clientY
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
return false
|
186
|
-
}
|
187
|
-
|
188
|
-
onDragMove(e: Event) {
|
189
|
-
if (!this.dragStart) {
|
190
|
-
return false
|
191
|
-
}
|
192
|
-
|
193
|
-
e.stopPropagation()
|
194
|
-
e.preventDefault()
|
195
|
-
|
196
|
-
var x = (e as MouseEvent).clientX,
|
197
|
-
y = (e as MouseEvent).clientY
|
198
|
-
|
199
|
-
const dragStart = { x, y }
|
200
|
-
|
201
|
-
x -= this.dragStart.x
|
202
|
-
y -= this.dragStart.y
|
203
|
-
|
204
|
-
this.dragStart = dragStart
|
205
|
-
|
206
|
-
this.style.left =
|
207
|
-
Math.min(this.parentElement!.offsetWidth - this.offsetWidth, Math.max(0, this.offsetLeft + x)) + 'px'
|
208
|
-
this.style.top =
|
209
|
-
Math.min(this.parentElement!.offsetHeight - this.offsetHeight, Math.max(0, this.offsetTop + y)) + 'px'
|
210
|
-
|
211
|
-
return false
|
212
|
-
}
|
213
|
-
|
214
|
-
onDragEnd(e: Event) {
|
215
|
-
if (this.dragStart) {
|
216
|
-
e.stopPropagation()
|
217
|
-
e.preventDefault()
|
218
|
-
|
219
|
-
delete this.dragStart
|
220
|
-
}
|
221
|
-
}
|
222
|
-
|
223
|
-
async exportData() {
|
224
|
-
try {
|
225
|
-
const { id = 'board-component', data } = this.component || {}
|
226
|
-
const filename = `${id}.xlsx`
|
227
|
-
|
228
|
-
const worksheet = XLSX.utils.json_to_sheet(data)
|
229
|
-
const workbook = XLSX.utils.book_new()
|
230
|
-
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
|
231
|
-
XLSX.writeFile(workbook, filename)
|
232
|
-
} catch (e) {
|
233
|
-
console.error(e)
|
234
|
-
}
|
235
|
-
}
|
236
|
-
}
|