@operato/scene-gantt 2.0.0-beta.0 → 2.0.0-beta.2

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/db.sqlite +0 -0
  3. package/dist/editors/index.d.ts +6 -0
  4. package/dist/editors/index.js +8 -0
  5. package/dist/editors/index.js.map +1 -0
  6. package/dist/gantt.d.ts +61 -0
  7. package/dist/gantt.js +224 -0
  8. package/dist/gantt.js.map +1 -0
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/templates/gantt.d.ts +14 -0
  13. package/dist/templates/gantt.js +16 -0
  14. package/dist/templates/gantt.js.map +1 -0
  15. package/dist/templates/index.js +2 -2
  16. package/dist/templates/index.js.map +1 -1
  17. package/icons/gantt.png +0 -0
  18. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +71 -6
  19. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +80 -15
  20. package/logs/application-2024-06-10-00.log +6 -0
  21. package/logs/application-2024-06-10-12.log +6 -0
  22. package/logs/application-2024-06-10-13.log +18 -0
  23. package/logs/application-2024-06-10-22.log +10 -0
  24. package/logs/application-2024-06-11-00.log +6 -0
  25. package/logs/application-2024-06-11-01.log +7 -0
  26. package/logs/application-2024-06-11-02.log +12 -0
  27. package/logs/application-2024-06-11-03.log +12 -0
  28. package/logs/application-2024-06-11-04.log +12 -0
  29. package/logs/application-2024-06-11-14.log +6 -0
  30. package/logs/application-2024-06-11-15.log +6 -0
  31. package/logs/application-2024-06-11-16.log +6 -0
  32. package/logs/application-2024-06-11-17.log +24 -0
  33. package/logs/application-2024-06-11-19.log +36 -0
  34. package/logs/application-2024-06-11-20.log +6 -0
  35. package/logs/connections-2024-06-04-11.log +50 -0
  36. package/logs/connections-2024-06-04-12.log +0 -0
  37. package/logs/connections-2024-06-04-13.log +50 -0
  38. package/logs/connections-2024-06-10-00.log +50 -0
  39. package/logs/connections-2024-06-10-12.log +50 -0
  40. package/logs/connections-2024-06-10-13.log +150 -0
  41. package/logs/connections-2024-06-10-22.log +50 -0
  42. package/logs/connections-2024-06-11-00.log +50 -0
  43. package/logs/connections-2024-06-11-01.log +50 -0
  44. package/logs/connections-2024-06-11-02.log +100 -0
  45. package/logs/connections-2024-06-11-03.log +100 -0
  46. package/logs/connections-2024-06-11-04.log +100 -0
  47. package/logs/connections-2024-06-11-14.log +50 -0
  48. package/logs/connections-2024-06-11-15.log +50 -0
  49. package/logs/connections-2024-06-11-16.log +50 -0
  50. package/logs/connections-2024-06-11-17.log +200 -0
  51. package/logs/connections-2024-06-11-19.log +300 -0
  52. package/logs/connections-2024-06-11-20.log +50 -0
  53. package/package.json +3 -3
  54. package/src/editors/index.ts +8 -0
  55. package/src/gantt.ts +261 -0
  56. package/src/index.ts +1 -1
  57. package/src/templates/{wellstek-gantt.ts → gantt.ts} +4 -4
  58. package/src/templates/index.ts +2 -2
  59. package/things-scene.config.js +3 -1
  60. package/translations/en.json +15 -10
  61. package/translations/ja.json +15 -10
  62. package/translations/ko.json +15 -11
  63. package/translations/ms.json +15 -10
  64. package/translations/zh.json +15 -11
  65. package/tsconfig.tsbuildinfo +1 -1
  66. package/cache/translations/system/en.json +0 -1
  67. package/cache/translations/system/ko.json +0 -1
  68. package/logs/application-2024-05-27-14.log +0 -6
  69. package/logs/application-2024-05-27-17.log +0 -6
  70. package/logs/connections-2024-05-20-22.log +0 -50
  71. package/logs/connections-2024-05-21-00.log +0 -100
  72. package/logs/connections-2024-05-21-01.log +0 -50
  73. package/logs/connections-2024-05-27-14.log +0 -50
  74. package/logs/connections-2024-05-27-17.log +0 -50
  75. /package/src/{wellstek-gantt.ts → wellstek-gantt.ts.backup} +0 -0
package/src/gantt.ts ADDED
@@ -0,0 +1,261 @@
1
+ import { i18next } from '@operato/i18n'
2
+
3
+ /*
4
+ * Copyright © HatioLab Inc. All rights reserved.
5
+ */
6
+
7
+ const NATURE = {
8
+ mutable: false,
9
+ resizable: true,
10
+ rotatable: true,
11
+ properties: [
12
+ {
13
+ type: 'date',
14
+ label: 'gantt-from-date',
15
+ name: 'fromDate',
16
+ defaultValue: () =>
17
+ new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */
18
+ },
19
+ {
20
+ type: 'date',
21
+ label: 'gantt-to-date',
22
+ name: 'toDate',
23
+ defaultValue: () => new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */
24
+ },
25
+ {
26
+ type: 'boolean',
27
+ label: 'gantt-gridline',
28
+ name: 'gridline',
29
+ defaultValue: true
30
+ },
31
+ {
32
+ type: 'select',
33
+ label: 'gantt-time-scale',
34
+ name: 'timeScale',
35
+ property: {
36
+ options: [
37
+ {
38
+ display: 'week-day',
39
+ value: 'week-day'
40
+ },
41
+ {
42
+ display: 'month-week',
43
+ value: 'month-week'
44
+ },
45
+ {
46
+ display: 'quarter-week',
47
+ value: 'quarter-week'
48
+ },
49
+ {
50
+ display: 'year-quarter',
51
+ value: 'year-quarter'
52
+ }
53
+ ]
54
+ },
55
+ defaultValue: 'week-day'
56
+ },
57
+ {
58
+ type: 'column-config',
59
+ label: 'gantt-column-config',
60
+ name: 'columnConfig',
61
+ defaultValue: () => [
62
+ { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: '50px', order: 1 },
63
+ {
64
+ name: 'section',
65
+ label: i18next.t('label.gantt-task-section') || 'section',
66
+ visible: true,
67
+ width: '100px',
68
+ order: 2
69
+ },
70
+ {
71
+ name: 'title',
72
+ label: i18next.t('label.gantt-task-title') || 'title',
73
+ visible: true,
74
+ width: '150px',
75
+ order: 3
76
+ },
77
+ { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: '100px', order: 4 },
78
+ {
79
+ name: 'startDate',
80
+ label: i18next.t('label.gantt-task-start-date') || 'start date',
81
+ visible: true,
82
+ width: '100px',
83
+ order: 5
84
+ },
85
+ {
86
+ name: 'endDate',
87
+ label: i18next.t('label.gantt-task-end-date') || 'end date',
88
+ visible: true,
89
+ width: '100px',
90
+ order: 6
91
+ },
92
+ { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: '100px', order: 7 },
93
+ {
94
+ name: 'progress',
95
+ label: i18next.t('label.gantt-task-progress') || 'progress',
96
+ visible: true,
97
+ width: '100px',
98
+ order: 8
99
+ },
100
+ {
101
+ name: 'dependsOn',
102
+ label: i18next.t('label.gantt-task-previous') || 'previous',
103
+ visible: true,
104
+ width: '100px',
105
+ order: 9
106
+ }
107
+ ]
108
+ }
109
+ ],
110
+ 'value-property': 'tasks'
111
+ }
112
+
113
+ import '@operato/gantt/ox-gantt.js'
114
+
115
+ import { OxGantt } from '@operato/gantt/dist/src/ox-gantt.js'
116
+ import { Task } from '@operato/gantt/dist/src/types.js'
117
+
118
+ import { Component, HTMLOverlayContainer, Properties, error } from '@hatiolab/things-scene'
119
+
120
+ function getGlobalScale(component: GanttScene) {
121
+ var scale = { x: 1, y: 1 }
122
+ var parent: Component = component
123
+
124
+ while (parent) {
125
+ let { x, y } = parent.get('scale') || { x: 1, y: 1 }
126
+ scale.x *= x || 1
127
+ scale.y *= y || 1
128
+
129
+ parent = parent.parent
130
+ }
131
+ return scale
132
+ }
133
+
134
+ export default class GanttScene extends HTMLOverlayContainer {
135
+ static get nature() {
136
+ return NATURE
137
+ }
138
+
139
+ private _tasks: Task[] = []
140
+
141
+ private listenTo?: Component
142
+ private listener? = function (this: GanttScene, after: any) {
143
+ after.scale && this.rescale()
144
+ }.bind(this)
145
+
146
+ private gantt!: OxGantt
147
+
148
+ createElement() {
149
+ super.createElement()
150
+
151
+ this.gantt = document.createElement('ox-gantt') as OxGantt
152
+ this.gantt.style.width = 'inherit'
153
+ this.gantt.style.height = 'inherit'
154
+
155
+ this.element.appendChild(this.gantt)
156
+
157
+ this.rescale()
158
+
159
+ const { fromDate, toDate, gridline, columnConfig, timeScale = 'week-day' } = this.state
160
+
161
+ this.gantt.fromDate = fromDate
162
+ this.gantt.toDate = toDate
163
+ this.gantt.extendGridLines = gridline
164
+ this.gantt.columnConfig = columnConfig
165
+ this.gantt.timeScale = timeScale
166
+ }
167
+
168
+ dispose() {
169
+ super.dispose()
170
+ }
171
+
172
+ /*
173
+ * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,
174
+ * 그에 따른 html element의 반영이 필요한 부분을 구현한다.
175
+ *
176
+ * ThingsComponent state => HTML element properties
177
+ */
178
+
179
+ setElementProperties(div: HTMLDivElement) {
180
+ this.rescale()
181
+ }
182
+
183
+ /*
184
+ * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.
185
+ * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.
186
+ */
187
+ reposition() {
188
+ super.reposition()
189
+ }
190
+
191
+ get tagName() {
192
+ return 'div'
193
+ }
194
+
195
+ get tasks() {
196
+ return this.get('tasks')
197
+ }
198
+
199
+ set tasks(tasks) {
200
+ this.set('tasks', tasks)
201
+ ;(this.gantt as OxGantt).tasks = tasks
202
+ }
203
+
204
+ ready() {
205
+ super.ready()
206
+
207
+ if (this.rootModel) {
208
+ this.listenTo = this.rootModel
209
+ this.rootModel.on('change', this.listener!)
210
+ }
211
+ }
212
+
213
+ removed() {
214
+ if (this.listenTo) {
215
+ this.listenTo.off('change', this.listener!)
216
+
217
+ delete this.listenTo
218
+ delete this.listener
219
+ }
220
+ }
221
+
222
+ /*
223
+ * gantt은 scale된 상태에서 마우스/터치 포지션을 정확히 매핑하지 못하므로, 타임 범위를 정상적으로 지정하지 못한다.
224
+ * 따라서, gantt의 경우에는 부모의 스케일의 역으로 transform해서, scale을 1로 맞추어야 한다.
225
+ */
226
+ rescale() {
227
+ var scale = getGlobalScale(this)
228
+
229
+ var sx = 1 / scale.x
230
+ var sy = 1 / scale.y
231
+
232
+ var transform = `scale(${sx}, ${sy})`
233
+
234
+ ;['-webkit-', '-moz-', '-ms-', '-o-', ''].forEach(prefix => {
235
+ this.gantt!.style[(prefix + 'transform') as any] = transform
236
+ this.gantt!.style[(prefix + 'transform-origin') as any] = '0px 0px'
237
+ })
238
+
239
+ var { width, height } = this.state
240
+ this.gantt!.style.width = width * scale.x + 'px'
241
+ this.gantt!.style.height = height * scale.y + 'px'
242
+
243
+ this.gantt.requestUpdate()
244
+ }
245
+
246
+ onchange(props: Properties) {
247
+ ;['fromDate', 'toDate', 'timeScale', 'columnConfig'].forEach(prop => {
248
+ if (prop in props) {
249
+ ;(this.gantt as any)[prop] = this.state[prop]
250
+ }
251
+ })
252
+
253
+ if ('gridline' in props) {
254
+ ;(this.gantt as OxGantt).extendGridLines = this.state['gridline']
255
+ }
256
+
257
+ this.rescale()
258
+ }
259
+ }
260
+
261
+ Component.register('gantt', GanttScene)
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export { default as WellstekGanttScene } from './wellstek-gantt'
1
+ export { default as GanttScene } from './gantt'
@@ -1,13 +1,13 @@
1
- const icon = new URL('../../icons/wellstek-gantt.png', import.meta.url).href
1
+ const icon = new URL('../../icons/gantt.png', import.meta.url).href
2
2
 
3
3
  export default {
4
- type: 'wellstek-gantt',
5
- description: 'wellstek-gantt',
4
+ type: 'gantt',
5
+ description: 'gantt',
6
6
  group: 'etc',
7
7
  /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
8
  icon,
9
9
  model: {
10
- type: 'wellstek-gantt',
10
+ type: 'gantt',
11
11
  left: 150,
12
12
  top: 150,
13
13
  width: 300,
@@ -1,3 +1,3 @@
1
- import WellstekGantt from './wellstek-gantt'
1
+ import Gantt from './gantt'
2
2
 
3
- export default [WellstekGantt]
3
+ export default [Gantt]
@@ -1,5 +1,7 @@
1
+ import editors from './dist/editors'
1
2
  import templates from './dist/templates'
2
3
 
3
4
  export default {
4
- templates
5
+ templates,
6
+ editors
5
7
  }
@@ -1,12 +1,17 @@
1
1
  {
2
- "label.row-height": "row height",
3
- "label.row-padding": "row padding",
4
- "label.column-offset": "column offset",
5
- "label.magnet-offset": "magnet offset",
6
- "label.table-width": "table width",
7
- "label.min-width": "min width",
8
- "label.column-unit": "column unit",
9
- "label.fit-width": "fit width",
10
- "label.from": "from",
11
- "label.to": "to"
2
+ "component.gantt": "gantt",
3
+ "label.gantt-task-id": "ID",
4
+ "label.gantt-task-section": "section",
5
+ "label.gantt-task-title": "title",
6
+ "label.gantt-task-type": "type",
7
+ "label.gantt-task-start-date": "start date",
8
+ "label.gantt-task-end-date": "end date",
9
+ "label.gantt-task-tags": "tags",
10
+ "label.gantt-task-progress": "progress",
11
+ "label.gantt-task-previous": "previous",
12
+ "label.gantt-gridline": "gridline",
13
+ "label.gantt-from-date": "from date",
14
+ "label.gantt-to-date": "to date",
15
+ "label.gantt-column-config": "column config.",
16
+ "label.gantt-time-scale": "time scale"
12
17
  }
@@ -1,12 +1,17 @@
1
1
  {
2
- "label.row-height": "row height",
3
- "label.row-padding": "row padding",
4
- "label.column-offset": "column offset",
5
- "label.magnet-offset": "magnet offset",
6
- "label.table-width": "table width",
7
- "label.min-width": "min width",
8
- "label.column-unit": "column unit",
9
- "label.fit-width": "fit width",
10
- "label.from": "from",
11
- "label.to": "to"
2
+ "component.gantt": "gantt",
3
+ "label.gantt-task-id": "ID",
4
+ "label.gantt-task-section": "セクション",
5
+ "label.gantt-task-title": "タイトル",
6
+ "label.gantt-task-type": "タイプ",
7
+ "label.gantt-task-start-date": "開始日",
8
+ "label.gantt-task-end-date": "終了日",
9
+ "label.gantt-task-tags": "タグ",
10
+ "label.gantt-task-progress": "進捗",
11
+ "label.gantt-task-previous": "",
12
+ "label.gantt-gridline": "グリッド線",
13
+ "label.gantt-from-date": "開始日",
14
+ "label.gantt-to-date": "終了日",
15
+ "label.gantt-column-config": "列設定.",
16
+ "label.gantt-time-scale": "時間軸スケール"
12
17
  }
@@ -1,13 +1,17 @@
1
1
  {
2
- "component.wellstek-gantt": "Wellstek Gantt",
3
- "label.row-height": "row height",
4
- "label.row-padding": "row padding",
5
- "label.column-offset": "column offset",
6
- "label.magnet-offset": "magnet offset",
7
- "label.table-width": "table width",
8
- "label.min-width": "min width",
9
- "label.column-unit": "column unit",
10
- "label.fit-width": "fit width",
11
- "label.from": "from",
12
- "label.to": "to"
2
+ "component.gantt": "간트차트",
3
+ "label.gantt-task-id": "아이디",
4
+ "label.gantt-task-section": "섹션",
5
+ "label.gantt-task-title": "제목",
6
+ "label.gantt-task-type": "유형",
7
+ "label.gantt-task-start-date": "시작 날짜",
8
+ "label.gantt-task-end-date": "종료 날짜",
9
+ "label.gantt-task-tags": "태그",
10
+ "label.gantt-task-progress": "진행 상황",
11
+ "label.gantt-task-previous": "이전",
12
+ "label.gantt-gridline": "그리드라인",
13
+ "label.gantt-from-date": "시작일",
14
+ "label.gantt-to-date": "완료일",
15
+ "label.gantt-column-config": "컬럼 설정",
16
+ "label.gantt-time-scale": "시간축 스케일"
13
17
  }
@@ -1,12 +1,17 @@
1
1
  {
2
- "label.row-height": "row height",
3
- "label.row-padding": "row padding",
4
- "label.column-offset": "column offset",
5
- "label.magnet-offset": "magnet offset",
6
- "label.table-width": "table width",
7
- "label.min-width": "min width",
8
- "label.column-unit": "column unit",
9
- "label.fit-width": "fit width",
10
- "label.from": "from",
11
- "label.to": "to"
2
+ "component.gantt": "gantt",
3
+ "label.gantt-task-id": "id",
4
+ "label.gantt-task-section": "seksyen",
5
+ "label.gantt-task-title": "tajuk",
6
+ "label.gantt-task-type": "jenis",
7
+ "label.gantt-task-start-date": "tarikh mula",
8
+ "label.gantt-task-end-date": "tarikh tamat",
9
+ "label.gantt-task-tags": "tag",
10
+ "label.gantt-task-progress": "kemajuan",
11
+ "label.gantt-task-previous": "sebelumnya",
12
+ "label.gantt-gridline": "garis grid",
13
+ "label.gantt-from-date": "tarikh mula",
14
+ "label.gantt-to-date": "tarikh tamat",
15
+ "label.gantt-column-config": "konfigurasi lajur.",
16
+ "label.gantt-time-scale": "skala masa"
12
17
  }
@@ -1,13 +1,17 @@
1
1
  {
2
- "component.wellstek-gantt": "Wellstek Gantt",
3
- "label.row-height": "row height",
4
- "label.row-padding": "row padding",
5
- "label.column-offset": "column offset",
6
- "label.magnet-offset": "magnet offset",
7
- "label.table-width": "table width",
8
- "label.min-width": "min width",
9
- "label.column-unit": "column unit",
10
- "label.fit-width": "fit width",
11
- "label.from": "from",
12
- "label.to": "to"
2
+ "component.gantt": "gantt",
3
+ "label.gantt-task-id": "ID",
4
+ "label.gantt-task-section": "部分",
5
+ "label.gantt-task-title": "标题",
6
+ "label.gantt-task-type": "类型",
7
+ "label.gantt-task-start-date": "开始日期",
8
+ "label.gantt-task-end-date": "结束日期",
9
+ "label.gantt-task-tags": "标签",
10
+ "label.gantt-task-progress": "进度",
11
+ "label.gantt-task-previous": "以前",
12
+ "label.gantt-gridline": "网格线",
13
+ "label.gantt-from-date": "起始日期",
14
+ "label.gantt-to-date": "结束日期",
15
+ "label.gantt-column-config": "列配置.",
16
+ "label.gantt-time-scale": "时间轴刻度"
13
17
  }