@operato/scene-gantt 7.0.3 → 8.0.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,190 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- const NATURE = {
6
- mutable: false,
7
- resizable: true,
8
- rotatable: true,
9
- properties: [
10
- {
11
- type: 'number',
12
- label: 'row-height',
13
- name: 'rowHeight',
14
- defaultValue: 35
15
- },
16
- {
17
- type: 'number',
18
- label: 'row-padding',
19
- name: 'rowPadding',
20
- defaultValue: 5
21
- },
22
- {
23
- type: 'number',
24
- label: 'column-offset',
25
- name: 'columnOffset',
26
- defaultValue: 15
27
- },
28
- {
29
- type: 'number',
30
- label: 'magnet-offset',
31
- name: 'magnetOffset',
32
- defaultValue: 15
33
- },
34
- {
35
- type: 'number',
36
- label: 'table-width',
37
- name: 'tableWidth',
38
- defaultValue: 140
39
- },
40
- {
41
- type: 'number',
42
- label: 'min-width',
43
- name: 'minWidth',
44
- defaultValue: 1500
45
- },
46
- {
47
- type: 'string',
48
- label: 'column-unit',
49
- name: 'columnUnit',
50
- defaultValue: 'hour'
51
- },
52
- {
53
- type: 'boolean',
54
- label: 'fit-width',
55
- name: 'fitWidth',
56
- defaultValue: false
57
- },
58
- {
59
- type: 'date',
60
- label: 'from',
61
- name: 'from',
62
- defaultValue: '09/25/2023'
63
- },
64
- {
65
- type: 'date',
66
- label: 'to',
67
- name: 'to',
68
- defaultValue: '10/11/2023'
69
- }
70
- ]
71
- }
72
-
73
- import moment from 'moment'
74
- import 'wellstek-gantt'
75
- import { MomentWellstekGanttDateAdapter, WellstekGanttDependencies, WellstekGanttTable } from 'wellstek-gantt'
76
-
77
- import { data } from './data'
78
-
79
- import { Component, HTMLOverlayContainer, Properties, error } from '@hatiolab/things-scene'
80
-
81
- export default class WellstekGanttScene extends HTMLOverlayContainer {
82
- static get nature() {
83
- return NATURE
84
- }
85
-
86
- oncreate_element(element: HTMLElement) {
87
- element.style.width = '100%'
88
- element.style.height = '100%'
89
- }
90
-
91
- dispose() {
92
- super.dispose()
93
- }
94
-
95
- /*
96
- * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,
97
- * 그에 따른 html element의 반영이 필요한 부분을 구현한다.
98
- *
99
- * ThingsComponent state => HTML element properties
100
- */
101
- setElementProperties() {
102
- const element = this.element
103
-
104
- const {
105
- rowHeight = 35,
106
- rowPadding = 5,
107
- columnOffset = 15,
108
- magnetOffset = 15,
109
- tableWidth = 140,
110
- minWidth = 1500,
111
- columnUnit = 'hour',
112
- fitWidth = false,
113
- from,
114
- to
115
- } = this.state
116
-
117
- const options = {
118
- rows: data.rows,
119
- tasks: data.tasks
120
- }
121
-
122
- ;(element as any).dateAdapter = new MomentWellstekGanttDateAdapter(moment)
123
- ;(element as any).rows = options.rows
124
- ;(element as any).tasks = options.tasks
125
- ;(element as any).columnOffset = columnOffset
126
- ;(element as any).magnetOffset = magnetOffset
127
- ;(element as any).rowHeight = rowHeight
128
- ;(element as any).rowPadding = rowPadding
129
- ;(element as any).headers = [
130
- { unit: 'day', format: 'MM-DD' },
131
- { unit: 'hour', format: 'HH:mm', offset: 12 }
132
- ]
133
- ;(element as any).fitWidth = fitWidth
134
- ;(element as any).minWidth = minWidth
135
- ;(element as any).from = new Date(from).getTime()
136
- ;(element as any).to = new Date(to).getTime()
137
- ;(element as any).tableHeader = {
138
- // title: '테스트 라벨',
139
- // property: 'label',
140
- // isFilter: true
141
- // }
142
- // {
143
- title: 'Label9',
144
- property: 'label',
145
- width: 140,
146
- type: 'tree',
147
- isFilter: true
148
- }
149
- ;(element as any).tableWidth = tableWidth
150
- ;(element as any).ganttTableModules = [WellstekGanttTable]
151
- ;(element as any).ganttBodyModules = [WellstekGanttDependencies]
152
- ;(element as any).columnUnit = columnUnit
153
- }
154
-
155
- /*
156
- * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.
157
- * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.
158
- */
159
- reposition() {
160
- super.reposition()
161
- }
162
-
163
- get tagName() {
164
- return 'wellstek-gantt'
165
- }
166
-
167
- onchange(props: Properties) {
168
- ;[
169
- 'rowHeight',
170
- 'rowPadding',
171
- 'columnOffset',
172
- 'magnetOffset',
173
- 'tableWidth',
174
- 'minWidth',
175
- 'columnUnit',
176
- 'fitWidth'
177
- ].forEach(prop => {
178
- if (prop in props) {
179
- ;(this.element as any)[prop] = this.state[prop]
180
- }
181
- })
182
- ;['from', 'to'].forEach(prop => {
183
- if (prop in props) {
184
- ;(this.element as any)[prop] = new Date(this.state[prop]).getTime()
185
- }
186
- })
187
- }
188
- }
189
-
190
- Component.register('wellstek-gantt', WellstekGanttScene)