@operato/scene-gantt 7.1.0 → 7.3.9

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.3.9](https://github.com/things-scene/operato-scene/compare/v7.3.8...v7.3.9) (2024-09-11)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * @hatiolab/things-scene version ([5260171](https://github.com/things-scene/operato-scene/commit/52601719115288709ca7e0eee0974cc4677f219e))
12
+
13
+
14
+
15
+ ## [7.3.8](https://github.com/things-scene/operato-scene/compare/v7.3.7...v7.3.8) (2024-09-11)
16
+
17
+ **Note:** Version bump only for package @operato/scene-gantt
18
+
19
+
20
+
21
+
22
+
6
23
  ## [7.1.0](https://github.com/things-scene/operato-scene/compare/v7.0.12...v7.1.0) (2024-07-28)
7
24
 
8
25
 
package/dist/gantt.js CHANGED
@@ -141,7 +141,7 @@ export default class GanttScene extends HTMLOverlayContainer {
141
141
  this.gantt.fromDate = fromDate;
142
142
  this.gantt.toDate = toDate;
143
143
  this.gantt.extendGridLines = gridline;
144
- this.gantt.columnConfig = columnConfig;
144
+ this.gantt.columnConfigProvider = () => columnConfig;
145
145
  this.gantt.timeScale = timeScale;
146
146
  }
147
147
  dispose() {
package/dist/gantt.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"gantt.js","sourceRoot":"","sources":["../src/gantt.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,UAAU;YAChB,sBAAsB;YACtB,sGAAsG;SACvG;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,eAAe;YACt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,CAAC,CAAC,GAAG,IAAI,CAAA;QAElD,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAA;IAC5B,CAAC;IAED,QAAQ,CAAC,KAAiB;QACxB,CAAC;QAAA,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAClE,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;gBAClB,CAAC;gBAAC,IAAI,CAAC,KAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC/C,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC;YACxB,CAAC;YAAC,IAAI,CAAC,KAAiB,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACnE,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAA;IAChB,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA","sourcesContent":["import { i18next } from '@operato/i18n'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'date',\n label: 'gantt-from-date',\n name: 'fromDate'\n // defaultValue: () =>\n // new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */\n },\n {\n type: 'date',\n label: 'gantt-to-date',\n name: 'toDate'\n // defaultValue: () => new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */\n },\n {\n type: 'boolean',\n label: 'gantt-gridline',\n name: 'gridline'\n // defaultValue: true\n },\n {\n type: 'select',\n label: 'gantt-time-scale',\n name: 'timeScale',\n property: {\n options: [\n {\n display: 'week-day',\n value: 'week-day'\n },\n {\n display: 'month-week',\n value: 'month-week'\n },\n {\n display: 'quarter-week',\n value: 'quarter-week'\n },\n {\n display: 'year-quarter',\n value: 'year-quarter'\n }\n ]\n }\n // defaultValue: 'week-day'\n },\n {\n type: 'column-config',\n label: 'gantt-column-config',\n name: 'columnConfig'\n // defaultValue: () => [\n // { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: '50', order: 1 },\n // {\n // name: 'section',\n // label: i18next.t('label.gantt-task-section') || 'section',\n // visible: true,\n // width: '100',\n // order: 2\n // },\n // {\n // name: 'title',\n // label: i18next.t('label.gantt-task-title') || 'title',\n // visible: true,\n // width: '150',\n // order: 3\n // },\n // { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: '100', order: 4 },\n // {\n // name: 'startDate',\n // label: i18next.t('label.gantt-task-start-date') || 'start date',\n // visible: true,\n // width: '100',\n // order: 5\n // },\n // {\n // name: 'endDate',\n // label: i18next.t('label.gantt-task-end-date') || 'end date',\n // visible: true,\n // width: '100',\n // order: 6\n // },\n // { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: '100', order: 7 },\n // {\n // name: 'progress',\n // label: i18next.t('label.gantt-task-progress') || 'progress',\n // visible: true,\n // width: '100',\n // order: 8\n // },\n // {\n // name: 'dependsOn',\n // label: i18next.t('label.gantt-task-previous') || 'previous',\n // visible: true,\n // width: '100',\n // order: 9\n // }\n // ]\n }\n ],\n 'value-property': 'tasks'\n}\n\nimport '@operato/gantt/ox-gantt.js'\n\nimport { OxGantt } from '@operato/gantt/dist/src/ox-gantt.js'\nimport { Task } from '@operato/gantt/dist/src/types.js'\n\nimport { Component, ComponentNature, HTMLOverlayContainer, Properties, error } from '@hatiolab/things-scene'\n\nfunction getGlobalScale(component: GanttScene) {\n var scale = { x: 1, y: 1 }\n var parent: Component = component\n\n while (parent) {\n let { x, y } = parent.get('scale') || { x: 1, y: 1 }\n scale.x *= x || 1\n scale.y *= y || 1\n\n parent = parent.parent\n }\n return scale\n}\n\nexport default class GanttScene extends HTMLOverlayContainer {\n static get nature() {\n return NATURE\n }\n\n private _tasks: Task[] = []\n\n private listenTo?: Component\n private listener? = function (this: GanttScene, after: any) {\n after.scale && this.rescale()\n }.bind(this)\n\n private gantt!: OxGantt\n\n createElement() {\n super.createElement()\n\n this.gantt = document.createElement('ox-gantt') as OxGantt\n this.gantt.style.width = 'inherit'\n this.gantt.style.height = 'inherit'\n\n this.element.appendChild(this.gantt)\n\n this.rescale()\n\n const { fromDate, toDate, gridline, columnConfig, timeScale = 'week-day' } = this.state\n\n this.gantt.fromDate = fromDate\n this.gantt.toDate = toDate\n this.gantt.extendGridLines = gridline\n this.gantt.columnConfig = columnConfig\n this.gantt.timeScale = timeScale\n }\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n\n setElementProperties(div: HTMLDivElement) {\n this.rescale()\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'div'\n }\n\n get tasks() {\n return this.get('tasks')\n }\n\n set tasks(tasks) {\n this.set('tasks', tasks)\n ;(this.gantt as OxGantt).tasks = tasks\n }\n\n ready() {\n super.ready()\n\n if (this.rootModel) {\n this.listenTo = this.rootModel\n this.rootModel.on('change', this.listener!)\n }\n }\n\n removed() {\n if (this.listenTo) {\n this.listenTo.off('change', this.listener!)\n\n delete this.listenTo\n delete this.listener\n }\n }\n\n /*\n * gantt은 scale된 상태에서 마우스/터치 포지션을 정확히 매핑하지 못하므로, 타임 범위를 정상적으로 지정하지 못한다.\n * 따라서, gantt의 경우에는 부모의 스케일의 역으로 transform해서, scale을 1로 맞추어야 한다.\n */\n rescale() {\n if (!this.gantt) {\n return\n }\n\n var scale = getGlobalScale(this)\n\n var sx = 1 / scale.x\n var sy = 1 / scale.y\n\n var transform = `scale(${sx}, ${sy})`\n\n ;['-webkit-', '-moz-', '-ms-', '-o-', ''].forEach(prefix => {\n this.gantt!.style[(prefix + 'transform') as any] = transform\n this.gantt!.style[(prefix + 'transform-origin') as any] = '0px 0px'\n })\n\n var { width, height } = this.state\n this.gantt!.style.width = width * scale.x + 'px'\n this.gantt!.style.height = height * scale.y + 'px'\n\n this.gantt.requestUpdate()\n }\n\n onchange(props: Properties) {\n ;['fromDate', 'toDate', 'timeScale', 'columnConfig'].forEach(prop => {\n if (prop in props) {\n ;(this.gantt as any)[prop] = this.state[prop]\n }\n })\n\n if ('gridline' in props) {\n ;(this.gantt as OxGantt).extendGridLines = this.state['gridline']\n }\n\n this.rescale()\n }\n}\n\nComponent.register('gantt', GanttScene)\n"]}
1
+ {"version":3,"file":"gantt.js","sourceRoot":"","sources":["../src/gantt.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,UAAU;YAChB,sBAAsB;YACtB,sGAAsG;SACvG;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,QAAQ;YACd,oHAAoH;SACrH;QACD;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,UAAU;YAChB,qBAAqB;SACtB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,kBAAkB;YACzB,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE;oBACP;wBACE,OAAO,EAAE,UAAU;wBACnB,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,OAAO,EAAE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,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC/C,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC;YACxB,CAAC;YAAC,IAAI,CAAC,KAAiB,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACnE,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAA;IAChB,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA","sourcesContent":["import { i18next } from '@operato/i18n'\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'date',\n label: 'gantt-from-date',\n name: 'fromDate'\n // defaultValue: () =>\n // new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */\n },\n {\n type: 'date',\n label: 'gantt-to-date',\n name: 'toDate'\n // defaultValue: () => new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */\n },\n {\n type: 'boolean',\n label: 'gantt-gridline',\n name: 'gridline'\n // defaultValue: true\n },\n {\n type: 'select',\n label: 'gantt-time-scale',\n name: 'timeScale',\n property: {\n options: [\n {\n display: 'week-day',\n value: 'week-day'\n },\n {\n display: 'month-week',\n value: 'month-week'\n },\n {\n display: 'quarter-week',\n value: 'quarter-week'\n },\n {\n display: 'year-quarter',\n value: 'year-quarter'\n }\n ]\n }\n // defaultValue: 'week-day'\n },\n {\n type: 'column-config',\n label: 'gantt-column-config',\n name: 'columnConfig'\n // defaultValue: () => [\n // { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: '50', order: 1 },\n // {\n // name: 'section',\n // label: i18next.t('label.gantt-task-section') || 'section',\n // visible: true,\n // width: '100',\n // order: 2\n // },\n // {\n // name: 'title',\n // label: i18next.t('label.gantt-task-title') || 'title',\n // visible: true,\n // width: '150',\n // order: 3\n // },\n // { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: '100', order: 4 },\n // {\n // name: 'startDate',\n // label: i18next.t('label.gantt-task-start-date') || 'start date',\n // visible: true,\n // width: '100',\n // order: 5\n // },\n // {\n // name: 'endDate',\n // label: i18next.t('label.gantt-task-end-date') || 'end date',\n // visible: true,\n // width: '100',\n // order: 6\n // },\n // { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: '100', order: 7 },\n // {\n // name: 'progress',\n // label: i18next.t('label.gantt-task-progress') || 'progress',\n // visible: true,\n // width: '100',\n // order: 8\n // },\n // {\n // name: 'dependsOn',\n // label: i18next.t('label.gantt-task-previous') || 'previous',\n // visible: true,\n // width: '100',\n // order: 9\n // }\n // ]\n }\n ],\n 'value-property': 'tasks'\n}\n\nimport '@operato/gantt/ox-gantt.js'\n\nimport { OxGantt } from '@operato/gantt/dist/src/ox-gantt.js'\nimport { Task } from '@operato/gantt/dist/src/types.js'\n\nimport { Component, ComponentNature, HTMLOverlayContainer, Properties, error } from '@hatiolab/things-scene'\n\nfunction getGlobalScale(component: GanttScene) {\n var scale = { x: 1, y: 1 }\n var parent: Component = component\n\n while (parent) {\n let { x, y } = parent.get('scale') || { x: 1, y: 1 }\n scale.x *= x || 1\n scale.y *= y || 1\n\n parent = parent.parent\n }\n return scale\n}\n\nexport default class GanttScene extends HTMLOverlayContainer {\n static get nature() {\n return NATURE\n }\n\n private _tasks: Task[] = []\n\n private listenTo?: Component\n private listener? = function (this: GanttScene, after: any) {\n after.scale && this.rescale()\n }.bind(this)\n\n private gantt!: OxGantt\n\n createElement() {\n super.createElement()\n\n this.gantt = document.createElement('ox-gantt') as OxGantt\n this.gantt.style.width = 'inherit'\n this.gantt.style.height = 'inherit'\n\n this.element.appendChild(this.gantt)\n\n this.rescale()\n\n const { fromDate, toDate, gridline, columnConfig, timeScale = 'week-day' } = this.state\n\n this.gantt.fromDate = fromDate\n this.gantt.toDate = toDate\n this.gantt.extendGridLines = gridline\n this.gantt.columnConfigProvider = () => columnConfig\n this.gantt.timeScale = timeScale\n }\n\n dispose() {\n super.dispose()\n }\n\n /*\n * 컴포넌트의 생성 또는 속성 변화 시에 호출되며,\n * 그에 따른 html element의 반영이 필요한 부분을 구현한다.\n *\n * ThingsComponent state => HTML element properties\n */\n\n setElementProperties(div: HTMLDivElement) {\n this.rescale()\n }\n\n /*\n * 컴포넌트가 ready 상태가 되거나, 컴포넌트의 속성이 변화될 시 setElementProperties 뒤에 호출된다.\n * 변화에 따른 기본적인 html 속성이 super.reposition()에서 진행되고, 그 밖의 작업이 필요할 때, 오버라이드 한다.\n */\n reposition() {\n super.reposition()\n }\n\n get tagName() {\n return 'div'\n }\n\n get tasks() {\n return this.get('tasks')\n }\n\n set tasks(tasks) {\n this.set('tasks', tasks)\n ;(this.gantt as OxGantt).tasks = tasks\n }\n\n ready() {\n super.ready()\n\n if (this.rootModel) {\n this.listenTo = this.rootModel\n this.rootModel.on('change', this.listener!)\n }\n }\n\n removed() {\n if (this.listenTo) {\n this.listenTo.off('change', this.listener!)\n\n delete this.listenTo\n delete this.listener\n }\n }\n\n /*\n * gantt은 scale된 상태에서 마우스/터치 포지션을 정확히 매핑하지 못하므로, 타임 범위를 정상적으로 지정하지 못한다.\n * 따라서, gantt의 경우에는 부모의 스케일의 역으로 transform해서, scale을 1로 맞추어야 한다.\n */\n rescale() {\n if (!this.gantt) {\n return\n }\n\n var scale = getGlobalScale(this)\n\n var sx = 1 / scale.x\n var sy = 1 / scale.y\n\n var transform = `scale(${sx}, ${sy})`\n\n ;['-webkit-', '-moz-', '-ms-', '-o-', ''].forEach(prefix => {\n this.gantt!.style[(prefix + 'transform') as any] = transform\n this.gantt!.style[(prefix + 'transform-origin') as any] = '0px 0px'\n })\n\n var { width, height } = this.state\n this.gantt!.style.width = width * scale.x + 'px'\n this.gantt!.style.height = height * scale.y + 'px'\n\n this.gantt.requestUpdate()\n }\n\n onchange(props: Properties) {\n ;['fromDate', 'toDate', 'timeScale', 'columnConfig'].forEach(prop => {\n if (prop in props) {\n ;(this.gantt as any)[prop] = this.state[prop]\n }\n })\n\n if ('gridline' in props) {\n ;(this.gantt as OxGantt).extendGridLines = this.state['gridline']\n }\n\n this.rescale()\n }\n}\n\nComponent.register('gantt', GanttScene)\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@operato/scene-gantt",
3
3
  "description": "Operato Scene Component for Gantt Chart",
4
- "version": "7.1.0",
4
+ "version": "7.3.9",
5
5
  "license": "MIT",
6
6
  "things-scene": true,
7
7
  "author": "heartyoh",
@@ -27,7 +27,7 @@
27
27
  "migration": "things-factory-migration"
28
28
  },
29
29
  "dependencies": {
30
- "@hatiolab/things-scene": "^3.2.0",
30
+ "@hatiolab/things-scene": "^3.4.0",
31
31
  "@operato/gantt": "^7.0.0"
32
32
  },
33
33
  "devDependencies": {
@@ -58,5 +58,5 @@
58
58
  "prettier --write"
59
59
  ]
60
60
  },
61
- "gitHead": "24c96f3d3e1fe38c2f6a3adc869e52a1a80f139d"
61
+ "gitHead": "32b46499c33be406e0fccc602746290a51e0f286"
62
62
  }
package/src/gantt.ts CHANGED
@@ -161,7 +161,7 @@ export default class GanttScene extends HTMLOverlayContainer {
161
161
  this.gantt.fromDate = fromDate
162
162
  this.gantt.toDate = toDate
163
163
  this.gantt.extendGridLines = gridline
164
- this.gantt.columnConfig = columnConfig
164
+ this.gantt.columnConfigProvider = () => columnConfig
165
165
  this.gantt.timeScale = timeScale
166
166
  }
167
167