{"version":3,"file":"frappe-gantt.min.js","sources":["../src/date_utils.js","../src/svg_utils.js","../src/bar.js","../src/arrow.js","../src/popup.js","../src/table.js","../src/split.js","../src/index.js"],"sourcesContent":["const YEAR = 'year';\r\nconst MONTH = 'month';\r\nconst DAY = 'day';\r\nconst HOUR = 'hour';\r\nconst MINUTE = 'minute';\r\nconst SECOND = 'second';\r\nconst MILLISECOND = 'millisecond';\r\n\r\nexport default {\r\n parse(date, date_separator = '-', time_separator = /[.:]/) {\r\n if (date instanceof Date) {\r\n return date;\r\n }\r\n if (typeof date === 'string') {\r\n let date_parts, time_parts;\r\n const parts = date.split(' ');\r\n\r\n date_parts = parts[0]\r\n .split(date_separator)\r\n .map((val) => parseInt(val, 10));\r\n time_parts = parts[1] && parts[1].split(time_separator);\r\n\r\n // month is 0 indexed\r\n date_parts[1] = date_parts[1] - 1;\r\n\r\n let vals = date_parts;\r\n\r\n if (time_parts && time_parts.length) {\r\n if (time_parts.length == 4) {\r\n time_parts[3] = '0.' + time_parts[3];\r\n time_parts[3] = parseFloat(time_parts[3]) * 1000;\r\n }\r\n vals = vals.concat(time_parts);\r\n }\r\n\r\n return new Date(...vals);\r\n }\r\n },\r\n\r\n to_string(date, with_time = false) {\r\n if (!(date instanceof Date)) {\r\n throw new TypeError('Invalid argument type');\r\n }\r\n const vals = this.get_date_values(date).map((val, i) => {\r\n if (i === 1) {\r\n // add 1 for month\r\n val = val + 1;\r\n }\r\n\r\n if (i === 6) {\r\n return padStart(val + '', 3, '0');\r\n }\r\n\r\n return padStart(val + '', 2, '0');\r\n });\r\n const date_string = `${vals[0]}-${vals[1]}-${vals[2]}`;\r\n const time_string = `${vals[3]}:${vals[4]}:${vals[5]}.${vals[6]}`;\r\n\r\n return date_string + (with_time ? ' ' + time_string : '');\r\n },\r\n\r\n format(date, format_string = 'YYYY-MM-DD HH:mm:ss.SSS', lang = 'ko') {\r\n const dateTimeFormat = new Intl.DateTimeFormat(lang, {\r\n month: 'long'\r\n });\r\n const month_name = dateTimeFormat.format(date);\r\n const month_name_capitalized =\r\n month_name.charAt(0).toUpperCase() + month_name.slice(1);\r\n\r\n const values = this.get_date_values(date).map(d => padStart(d, 2, 0));\r\n const format_map = {\r\n YYYY: values[0],\r\n MM: padStart(+values[1] + 1, 2, 0),\r\n DD: values[2],\r\n HH: values[3],\r\n mm: values[4],\r\n ss: values[5],\r\n SSS: values[6],\r\n D: values[2],\r\n MMMM: month_name_capitalized,\r\n MMM: month_name_capitalized,\r\n };\r\n\r\n let str = format_string;\r\n const formatted_values = [];\r\n\r\n Object.keys(format_map)\r\n .sort((a, b) => b.length - a.length) // big string first\r\n .forEach((key) => {\r\n if (str.includes(key)) {\r\n str = str.replace(key, `$${formatted_values.length}`);\r\n formatted_values.push(format_map[key]);\r\n }\r\n });\r\n\r\n formatted_values.forEach((value, i) => {\r\n str = str.replace(`$${i}`, value);\r\n });\r\n\r\n return str;\r\n },\r\n\r\n diff(date_a, date_b, scale = DAY) {\r\n let milliseconds, seconds, hours, minutes, days, months, years;\r\n\r\n milliseconds = date_a - date_b;\r\n seconds = milliseconds / 1000;\r\n minutes = seconds / 60;\r\n hours = minutes / 60;\r\n days = hours / 24;\r\n months = days / 30;\r\n years = months / 12;\r\n\r\n if (!scale.endsWith('s')) {\r\n scale += 's';\r\n }\r\n\r\n return Math.floor(\r\n {\r\n milliseconds,\r\n seconds,\r\n minutes,\r\n hours,\r\n days,\r\n months,\r\n years,\r\n }[scale]\r\n );\r\n },\r\n\r\n today() {\r\n const vals = this.get_date_values(new Date()).slice(0, 3);\r\n return new Date(...vals);\r\n },\r\n\r\n now() {\r\n return new Date();\r\n },\r\n\r\n add(date, qty, scale) {\r\n qty = parseInt(qty, 10);\r\n const vals = [\r\n date.getFullYear() + (scale === YEAR ? qty : 0),\r\n date.getMonth() + (scale === MONTH ? qty : 0),\r\n date.getDate() + (scale === DAY ? qty : 0),\r\n date.getHours() + (scale === HOUR ? qty : 0),\r\n date.getMinutes() + (scale === MINUTE ? qty : 0),\r\n date.getSeconds() + (scale === SECOND ? qty : 0),\r\n date.getMilliseconds() + (scale === MILLISECOND ? qty : 0),\r\n ];\r\n return new Date(...vals);\r\n },\r\n\r\n start_of(date, scale) {\r\n const scores = {\r\n [YEAR]: 6,\r\n [MONTH]: 5,\r\n [DAY]: 4,\r\n [HOUR]: 3,\r\n [MINUTE]: 2,\r\n [SECOND]: 1,\r\n [MILLISECOND]: 0,\r\n };\r\n\r\n function should_reset(_scale) {\r\n const max_score = scores[scale];\r\n return scores[_scale] <= max_score;\r\n }\r\n\r\n const vals = [\r\n date.getFullYear(),\r\n should_reset(YEAR) ? 0 : date.getMonth(),\r\n should_reset(MONTH) ? 1 : date.getDate(),\r\n should_reset(DAY) ? 0 : date.getHours(),\r\n should_reset(HOUR) ? 0 : date.getMinutes(),\r\n should_reset(MINUTE) ? 0 : date.getSeconds(),\r\n should_reset(SECOND) ? 0 : date.getMilliseconds(),\r\n ];\r\n\r\n return new Date(...vals);\r\n },\r\n\r\n clone(date) {\r\n return new Date(...this.get_date_values(date));\r\n },\r\n\r\n get_date_values(date) {\r\n return [\r\n date.getFullYear(),\r\n date.getMonth(),\r\n date.getDate(),\r\n date.getHours(),\r\n date.getMinutes(),\r\n date.getSeconds(),\r\n date.getMilliseconds(),\r\n ];\r\n },\r\n\r\n get_days_in_month(date) {\r\n const no_of_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\r\n\r\n const month = date.getMonth();\r\n\r\n if (month !== 1) {\r\n return no_of_days[month];\r\n }\r\n\r\n // Feb\r\n const year = date.getFullYear();\r\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\r\n return 29;\r\n }\r\n return 28;\r\n },\r\n};\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart\r\nfunction padStart(str, targetLength, padString) {\r\n str = str + '';\r\n targetLength = targetLength >> 0;\r\n padString = String(typeof padString !== 'undefined' ? padString : ' ');\r\n if (str.length > targetLength) {\r\n return String(str);\r\n } else {\r\n targetLength = targetLength - str.length;\r\n if (targetLength > padString.length) {\r\n padString += padString.repeat(targetLength / padString.length);\r\n }\r\n return padString.slice(0, targetLength) + String(str);\r\n }\r\n}\r\n","export function $(expr, con) {\r\n return typeof expr === 'string'\r\n ? (con || document).querySelector(expr)\r\n : expr || null;\r\n}\r\n\r\nexport function createSVG(tag, attrs) {\r\n const elem = document.createElementNS('http://www.w3.org/2000/svg', tag);\r\n for (let attr in attrs) {\r\n if (attr === 'append_to') {\r\n const parent = attrs.append_to;\r\n parent.appendChild(elem);\r\n } else if (attr === 'innerHTML') {\r\n elem.innerHTML = attrs.innerHTML;\r\n } else {\r\n elem.setAttribute(attr, attrs[attr]);\r\n }\r\n }\r\n return elem;\r\n}\r\n\r\nexport function animateSVG(svgElement, attr, from, to) {\r\n const animatedSvgElement = getAnimationElement(svgElement, attr, from, to);\r\n\r\n if (animatedSvgElement === svgElement) {\r\n // triggered 2nd time programmatically\r\n // trigger artificial click event\r\n const event = document.createEvent('HTMLEvents');\r\n event.initEvent('click', true, true);\r\n event.eventName = 'click';\r\n animatedSvgElement.dispatchEvent(event);\r\n }\r\n}\r\n\r\nfunction getAnimationElement(\r\n svgElement,\r\n attr,\r\n from,\r\n to,\r\n dur = '0.4s',\r\n begin = '0.1s'\r\n) {\r\n const animEl = svgElement.querySelector('animate');\r\n if (animEl) {\r\n $.attr(animEl, {\r\n attributeName: attr,\r\n from,\r\n to,\r\n dur,\r\n begin: 'click + ' + begin, // artificial click\r\n });\r\n return svgElement;\r\n }\r\n\r\n const animateElement = createSVG('animate', {\r\n attributeName: attr,\r\n from,\r\n to,\r\n dur,\r\n begin,\r\n calcMode: 'spline',\r\n values: from + ';' + to,\r\n keyTimes: '0; 1',\r\n keySplines: cubic_bezier('ease-out'),\r\n });\r\n svgElement.appendChild(animateElement);\r\n\r\n return svgElement;\r\n}\r\n\r\nfunction cubic_bezier(name) {\r\n return {\r\n ease: '.25 .1 .25 1',\r\n linear: '0 0 1 1',\r\n 'ease-in': '.42 0 1 1',\r\n 'ease-out': '0 0 .58 1',\r\n 'ease-in-out': '.42 0 .58 1',\r\n }[name];\r\n}\r\n\r\n$.on = (element, event, selector, callback) => {\r\n if (!callback) {\r\n callback = selector;\r\n $.bind(element, event, callback);\r\n } else {\r\n $.delegate(element, event, selector, callback);\r\n }\r\n};\r\n\r\n$.off = (element, event, handler) => {\r\n element.removeEventListener(event, handler);\r\n};\r\n\r\n$.bind = (element, event, callback) => {\r\n event.split(/\\s+/).forEach(function (event) {\r\n element.addEventListener(event, callback);\r\n });\r\n};\r\n\r\n$.delegate = (element, event, selector, callback) => {\r\n element.addEventListener(event, function (e) {\r\n const delegatedTarget = e.target.closest(selector);\r\n if (delegatedTarget) {\r\n e.delegatedTarget = delegatedTarget;\r\n callback.call(this, e, delegatedTarget);\r\n }\r\n });\r\n};\r\n\r\n$.closest = (selector, element) => {\r\n if (!element) return null;\r\n\r\n if (element.matches(selector)) {\r\n return element;\r\n }\r\n\r\n return $.closest(selector, element.parentNode);\r\n};\r\n\r\n$.attr = (element, attr, value) => {\r\n if (!value && typeof attr === 'string') {\r\n return element.getAttribute(attr);\r\n }\r\n\r\n if (typeof attr === 'object') {\r\n for (let key in attr) {\r\n $.attr(element, key, attr[key]);\r\n }\r\n return;\r\n }\r\n\r\n element.setAttribute(attr, value);\r\n};\r\n\r\n$.style = (element, attr, value) => {\r\n if (!value && typeof attr === 'string') {\r\n return element.getAttribute(attr);\r\n }\r\n\r\n if (typeof attr === 'object') {\r\n for (let key in attr) {\r\n $.style(element, key, attr[key]);\r\n }\r\n return;\r\n }\r\n\r\n element.style[attr] = value;\r\n};\r\n","import date_utils from './date_utils';\r\nimport { $, createSVG, animateSVG } from './svg_utils';\r\n\r\nexport default class Bar {\r\n constructor(gantt, task) {\r\n this.set_defaults(gantt, task);\r\n this.prepare();\r\n this.draw();\r\n this.bind();\r\n }\r\n\r\n set_defaults(gantt, task) {\r\n this.action_completed = false;\r\n this.gantt = gantt;\r\n this.task = task;\r\n }\r\n\r\n prepare() {\r\n this.prepare_values();\r\n this.prepare_helpers();\r\n }\r\n\r\n prepare_values() {\r\n this.invalid = this.task.invalid;\r\n this.height = this.gantt.options.bar_height;\r\n this.x = this.compute_x();\r\n this.y = this.compute_y();\r\n this.corner_radius = this.gantt.options.bar_corner_radius;\r\n this.duration =\r\n date_utils.diff(this.task._end, this.task._start, 'hour') /\r\n this.gantt.options.step;\r\n this.width = this.gantt.options.column_width * this.duration;\r\n this.progress_width =\r\n this.gantt.options.column_width *\r\n this.duration *\r\n (this.task.progress / 100) || 0;\r\n this.group = createSVG('g', {\r\n class: 'bar-wrapper ' + (this.task.custom_class || ''),\r\n 'data-id': this.task.id,\r\n });\r\n this.bar_group = createSVG('g', {\r\n class: 'bar-group',\r\n append_to: this.group,\r\n });\r\n this.handle_group = createSVG('g', {\r\n class: 'handle-group',\r\n append_to: this.group,\r\n });\r\n }\r\n\r\n prepare_helpers() {\r\n SVGElement.prototype.getX = function () {\r\n return +this.getAttribute('x');\r\n };\r\n SVGElement.prototype.getY = function () {\r\n return +this.getAttribute('y');\r\n };\r\n SVGElement.prototype.getWidth = function () {\r\n return +this.getAttribute('width');\r\n };\r\n SVGElement.prototype.getHeight = function () {\r\n return +this.getAttribute('height');\r\n };\r\n SVGElement.prototype.getEndX = function () {\r\n return this.getX() + this.getWidth();\r\n };\r\n }\r\n\r\n draw() {\r\n this.draw_bar();\r\n this.draw_progress_bar();\r\n this.draw_label();\r\n this.draw_resize_handles();\r\n }\r\n\r\n draw_bar() {\r\n this.$bar = createSVG('rect', {\r\n x: this.x,\r\n y: this.y,\r\n width: this.width,\r\n height: this.height,\r\n rx: this.corner_radius,\r\n ry: this.corner_radius,\r\n class: 'bar',\r\n append_to: this.bar_group,\r\n });\r\n\r\n animateSVG(this.$bar, 'width', 0, this.width);\r\n\r\n if (this.invalid) {\r\n this.$bar.classList.add('bar-invalid');\r\n }\r\n }\r\n\r\n draw_progress_bar() {\r\n if (this.invalid) return;\r\n this.$bar_progress = createSVG('rect', {\r\n x: this.x,\r\n y: this.y,\r\n width: this.progress_width,\r\n height: this.height,\r\n rx: this.corner_radius,\r\n ry: this.corner_radius,\r\n class: 'bar-progress',\r\n append_to: this.bar_group,\r\n });\r\n\r\n animateSVG(this.$bar_progress, 'width', 0, this.progress_width);\r\n }\r\n\r\n draw_label() {\r\n createSVG('text', {\r\n x: this.x + this.width / 2,\r\n y: this.y + this.height / 2,\r\n innerHTML: this.task.name,\r\n class: 'bar-label',\r\n append_to: this.bar_group,\r\n });\r\n // labels get BBox in the next tick\r\n requestAnimationFrame(() => this.update_label_position());\r\n }\r\n\r\n draw_resize_handles() {\r\n if (this.invalid) return;\r\n\r\n const bar = this.$bar;\r\n const handle_width = 8;\r\n\r\n createSVG('rect', {\r\n x: bar.getX() + bar.getWidth() - 9,\r\n y: bar.getY() + 1,\r\n width: handle_width,\r\n height: this.height - 2,\r\n rx: this.corner_radius,\r\n ry: this.corner_radius,\r\n class: 'handle right',\r\n append_to: this.handle_group,\r\n });\r\n\r\n createSVG('rect', {\r\n x: bar.getX() + 1,\r\n y: bar.getY() + 1,\r\n width: handle_width,\r\n height: this.height - 2,\r\n rx: this.corner_radius,\r\n ry: this.corner_radius,\r\n class: 'handle left',\r\n append_to: this.handle_group,\r\n });\r\n\r\n if (this.task.progress && this.task.progress < 100) {\r\n this.$handle_progress = createSVG('polygon', {\r\n points: this.get_progress_polygon_points().join(','),\r\n class: 'handle progress',\r\n append_to: this.handle_group,\r\n });\r\n }\r\n }\r\n\r\n get_progress_polygon_points() {\r\n const bar_progress = this.$bar_progress;\r\n return [\r\n bar_progress.getEndX() - 5,\r\n bar_progress.getY() + bar_progress.getHeight(),\r\n bar_progress.getEndX() + 5,\r\n bar_progress.getY() + bar_progress.getHeight(),\r\n bar_progress.getEndX(),\r\n bar_progress.getY() + bar_progress.getHeight() - 8.66,\r\n ];\r\n }\r\n\r\n bind() {\r\n if (this.invalid) return;\r\n this.setup_click_event();\r\n }\r\n\r\n setup_click_event() {\r\n $.on(this.group, 'focus ' + this.gantt.options.popup_trigger, (e) => {\r\n if (this.action_completed) {\r\n // just finished a move action, wait for a few seconds\r\n return;\r\n }\r\n\r\n this.show_popup();\r\n this.gantt.unselect_all();\r\n this.group.classList.add('active');\r\n });\r\n\r\n $.on(this.group, 'dblclick', (e) => {\r\n if (this.action_completed) {\r\n // just finished a move action, wait for a few seconds\r\n return;\r\n }\r\n\r\n this.gantt.trigger_event('click', [this.task]);\r\n });\r\n }\r\n\r\n show_popup() {\r\n if (this.gantt.bar_being_dragged) return;\r\n\r\n const start_date = date_utils.format(\r\n this.task._start,\r\n 'MMM D',\r\n this.gantt.options.language\r\n );\r\n const end_date = date_utils.format(\r\n date_utils.add(this.task._end, -1, 'second'),\r\n 'MMM D',\r\n this.gantt.options.language\r\n );\r\n const subtitle = start_date + ' - ' + end_date;\r\n\r\n this.gantt.show_popup({\r\n target_element: this.$bar,\r\n title: this.task.name,\r\n subtitle: subtitle,\r\n task: this.task,\r\n });\r\n this.gantt.handle_selected(this.task);\r\n }\r\n\r\n update_bar_position({ x = null, width = null }) {\r\n const bar = this.$bar;\r\n if (x) {\r\n // // get all x values of parent task\r\n // const xs = this.task.dependencies.map((dep) => {\r\n // return this.gantt.get_bar(dep).$bar.getX();\r\n // });\r\n // // child task must not go before parent\r\n // const valid_x = xs.reduce((prev, curr) => {\r\n // return x >= curr;\r\n // }, x);\r\n // if (!valid_x) {\r\n // width = null;\r\n // return;\r\n // }\r\n this.update_attr(bar, 'x', x);\r\n }\r\n if (width && width >= this.gantt.options.column_width) {\r\n this.update_attr(bar, 'width', width);\r\n }\r\n this.update_label_position();\r\n this.update_handle_position();\r\n this.update_progressbar_position();\r\n this.update_arrow_position();\r\n }\r\n\r\n date_changed() {\r\n let changed = false;\r\n const { new_start_date, new_end_date } = this.compute_start_end_date();\r\n\r\n if (Number(this.task._start) !== Number(new_start_date)) {\r\n changed = true;\r\n this.task._start = new_start_date;\r\n }\r\n\r\n if (Number(this.task._end) !== Number(new_end_date)) {\r\n changed = true;\r\n this.task._end = new_end_date;\r\n }\r\n\r\n if (!changed) return;\r\n\r\n this.gantt.trigger_event('date_change', [\r\n this.task,\r\n new_start_date,\r\n date_utils.add(new_end_date, -1, 'second'),\r\n ]);\r\n }\r\n\r\n progress_changed() {\r\n const new_progress = this.compute_progress();\r\n this.task.progress = new_progress;\r\n this.gantt.trigger_event('progress_change', [this.task, new_progress]);\r\n }\r\n\r\n set_action_completed() {\r\n this.action_completed = true;\r\n setTimeout(() => (this.action_completed = false), 1000);\r\n }\r\n\r\n compute_start_end_date() {\r\n const bar = this.$bar;\r\n const x_in_units = bar.getX() / this.gantt.options.column_width;\r\n const new_start_date = date_utils.add(\r\n this.gantt.gantt_start,\r\n x_in_units * this.gantt.options.step,\r\n 'hour'\r\n );\r\n const width_in_units = bar.getWidth() / this.gantt.options.column_width;\r\n const new_end_date = date_utils.add(\r\n new_start_date,\r\n width_in_units * this.gantt.options.step,\r\n 'hour'\r\n );\r\n\r\n return { new_start_date, new_end_date };\r\n }\r\n\r\n compute_progress() {\r\n const progress =\r\n (this.$bar_progress.getWidth() / this.$bar.getWidth()) * 100;\r\n return parseInt(progress, 10);\r\n }\r\n\r\n compute_x() {\r\n const { step, column_width } = this.gantt.options;\r\n const task_start = this.task._start;\r\n const gantt_start = this.gantt.gantt_start;\r\n\r\n const diff = date_utils.diff(task_start, gantt_start, 'hour');\r\n let x = (diff / step) * column_width;\r\n\r\n if (this.gantt.view_is('Month')) {\r\n const diff = date_utils.diff(task_start, gantt_start, 'day');\r\n x = (diff * column_width) / 30;\r\n }\r\n return x;\r\n }\r\n\r\n compute_y() {\r\n return (\r\n this.gantt.options.header_height +\r\n this.gantt.options.padding +\r\n this.task._index * (this.height + this.gantt.options.padding)\r\n );\r\n }\r\n\r\n get_snap_position(dx) {\r\n let odx = dx,\r\n rem,\r\n position;\r\n\r\n if (this.gantt.view_is('Week')) {\r\n rem = dx % (this.gantt.options.column_width / 7);\r\n position =\r\n odx -\r\n rem +\r\n (rem < this.gantt.options.column_width / 14\r\n ? 0\r\n : this.gantt.options.column_width / 7);\r\n } else if (this.gantt.view_is('Month')) {\r\n rem = dx % (this.gantt.options.column_width / 30);\r\n position =\r\n odx -\r\n rem +\r\n (rem < this.gantt.options.column_width / 60\r\n ? 0\r\n : this.gantt.options.column_width / 30);\r\n } else {\r\n rem = dx % this.gantt.options.column_width;\r\n position =\r\n odx -\r\n rem +\r\n (rem < this.gantt.options.column_width / 2\r\n ? 0\r\n : this.gantt.options.column_width);\r\n }\r\n return position;\r\n }\r\n\r\n update_attr(element, attr, value) {\r\n value = +value;\r\n if (!isNaN(value)) {\r\n element.setAttribute(attr, value);\r\n }\r\n return element;\r\n }\r\n\r\n update_progressbar_position() {\r\n if (this.invalid) return;\r\n this.$bar_progress.setAttribute('x', this.$bar.getX());\r\n this.$bar_progress.setAttribute(\r\n 'width',\r\n this.$bar.getWidth() * (this.task.progress / 100)\r\n );\r\n }\r\n\r\n update_label_position() {\r\n const bar = this.$bar,\r\n label = this.group.querySelector('.bar-label');\r\n\r\n if (label.getBBox().width > bar.getWidth()) {\r\n label.classList.add('big');\r\n label.setAttribute('x', bar.getX() + bar.getWidth() + 5);\r\n } else {\r\n label.classList.remove('big');\r\n label.setAttribute('x', bar.getX() + bar.getWidth() / 2);\r\n }\r\n }\r\n\r\n update_handle_position() {\r\n if (this.invalid) return;\r\n const bar = this.$bar;\r\n this.handle_group\r\n .querySelector('.handle.left')\r\n .setAttribute('x', bar.getX() + 1);\r\n this.handle_group\r\n .querySelector('.handle.right')\r\n .setAttribute('x', bar.getEndX() - 9);\r\n const handle = this.group.querySelector('.handle.progress');\r\n handle &&\r\n handle.setAttribute('points', this.get_progress_polygon_points());\r\n }\r\n\r\n update_arrow_position() {\r\n this.arrows = this.arrows || [];\r\n for (let arrow of this.arrows) {\r\n arrow.update();\r\n }\r\n }\r\n}\r\n\r\nfunction isFunction(functionToCheck) {\r\n var getType = {};\r\n return (\r\n functionToCheck &&\r\n getType.toString.call(functionToCheck) === '[object Function]'\r\n );\r\n}\r\n","import { createSVG } from './svg_utils';\r\n\r\nexport default class Arrow {\r\n constructor(gantt, from_task, to_task) {\r\n this.gantt = gantt;\r\n this.from_task = from_task;\r\n this.to_task = to_task;\r\n\r\n this.calculate_path();\r\n this.draw();\r\n }\r\n\r\n calculate_path() {\r\n let start_x =\r\n this.from_task.$bar.getX() + this.from_task.$bar.getWidth() / 2;\r\n\r\n const condition = () =>\r\n this.to_task.$bar.getX() < start_x + this.gantt.options.padding &&\r\n start_x > this.from_task.$bar.getX() + this.gantt.options.padding;\r\n\r\n while (condition()) {\r\n start_x -= 10;\r\n }\r\n\r\n const start_y =\r\n this.gantt.options.header_height +\r\n this.gantt.options.bar_height +\r\n (this.gantt.options.padding + this.gantt.options.bar_height) *\r\n this.from_task.task._index +\r\n this.gantt.options.padding;\r\n\r\n const end_x = this.to_task.$bar.getX() - this.gantt.options.padding / 2;\r\n const end_y =\r\n this.gantt.options.header_height +\r\n this.gantt.options.bar_height / 2 +\r\n (this.gantt.options.padding + this.gantt.options.bar_height) *\r\n this.to_task.task._index +\r\n this.gantt.options.padding;\r\n\r\n const from_is_below_to =\r\n this.from_task.task._index > this.to_task.task._index;\r\n const curve = this.gantt.options.arrow_curve;\r\n const clockwise = from_is_below_to ? 1 : 0;\r\n const curve_y = from_is_below_to ? -curve : curve;\r\n const offset = from_is_below_to\r\n ? end_y + this.gantt.options.arrow_curve\r\n : end_y - this.gantt.options.arrow_curve;\r\n\r\n this.path = `\r\n M ${start_x} ${start_y}\r\n V ${offset}\r\n a ${curve} ${curve} 0 0 ${clockwise} ${curve} ${curve_y}\r\n L ${end_x} ${end_y}\r\n m -5 -5\r\n l 5 5\r\n l -5 5`;\r\n\r\n if (\r\n this.to_task.$bar.getX() <\r\n this.from_task.$bar.getX() + this.gantt.options.padding\r\n ) {\r\n const down_1 = this.gantt.options.padding / 2 - curve;\r\n const down_2 =\r\n this.to_task.$bar.getY() +\r\n this.to_task.$bar.getHeight() / 2 -\r\n curve_y;\r\n const left = this.to_task.$bar.getX() - this.gantt.options.padding;\r\n\r\n this.path = `\r\n M ${start_x} ${start_y}\r\n v ${down_1}\r\n a ${curve} ${curve} 0 0 1 -${curve} ${curve}\r\n H ${left}\r\n a ${curve} ${curve} 0 0 ${clockwise} -${curve} ${curve_y}\r\n V ${down_2}\r\n a ${curve} ${curve} 0 0 ${clockwise} ${curve} ${curve_y}\r\n L ${end_x} ${end_y}\r\n m -5 -5\r\n l 5 5\r\n l -5 5`;\r\n }\r\n }\r\n\r\n draw() {\r\n this.element = createSVG('path', {\r\n d: this.path,\r\n 'data-from': this.from_task.task.id,\r\n 'data-to': this.to_task.task.id,\r\n });\r\n }\r\n\r\n update() {\r\n this.calculate_path();\r\n this.element.setAttribute('d', this.path);\r\n }\r\n}\r\n","export default class Popup {\r\n constructor(parent, custom_html) {\r\n this.parent = parent;\r\n this.custom_html = custom_html;\r\n this.make();\r\n }\r\n\r\n make() {\r\n this.parent.innerHTML = `\r\n
\r\n \r\n \r\n `;\r\n\r\n this.hide();\r\n\r\n this.title = this.parent.querySelector('.title');\r\n this.subtitle = this.parent.querySelector('.subtitle');\r\n this.pointer = this.parent.querySelector('.pointer');\r\n }\r\n\r\n show(options) {\r\n if (!options.target_element) {\r\n throw new Error('target_element is required to show popup');\r\n }\r\n if (!options.position) {\r\n options.position = 'left';\r\n }\r\n const target_element = options.target_element;\r\n\r\n if (this.custom_html) {\r\n let html = this.custom_html(options.task);\r\n html += '';\r\n this.parent.innerHTML = html;\r\n this.pointer = this.parent.querySelector('.pointer');\r\n } else {\r\n // set data\r\n this.title.innerHTML = options.title;\r\n this.subtitle.innerHTML = options.subtitle;\r\n this.parent.style.width = this.parent.clientWidth + 'px';\r\n }\r\n\r\n // set position\r\n let position_meta;\r\n if (target_element instanceof HTMLElement) {\r\n position_meta = target_element.getBoundingClientRect();\r\n } else if (target_element instanceof SVGElement) {\r\n position_meta = options.target_element.getBBox();\r\n }\r\n\r\n if (options.position === 'left') {\r\n this.parent.style.left =\r\n position_meta.x + (position_meta.width + 10) + 'px';\r\n this.parent.style.top = position_meta.y + 'px';\r\n\r\n this.pointer.style.transform = 'rotateZ(90deg)';\r\n this.pointer.style.left = '-7px';\r\n this.pointer.style.top = '2px';\r\n }\r\n\r\n // show\r\n this.parent.style.opacity = 1;\r\n }\r\n\r\n hide() {\r\n this.parent.style.opacity = 0;\r\n this.parent.style.left = 0;\r\n }\r\n}\r\n","import { $ } from './svg_utils';\r\n\r\nexport default class Table {\r\n dragStartY = 0;\r\n constructor(gantt, columns) {\r\n\r\n console.log(\"[Table :: constructor]\");\r\n console.table(gantt);\r\n console.table(columns);\r\n\r\n this.set_defaults(gantt, columns);\r\n }\r\n\r\n set_defaults(gantt, columns) {\r\n\r\n console.log(\"[Table :: set_defaults]\");\r\n console.table(gantt);\r\n console.table(columns);\r\n\r\n this.gantt = gantt;\r\n this.columns = columns;\r\n }\r\n\r\n draw_table_header() {\r\n\r\n console.log(\"[Table :: draw_table_header]\");\r\n\r\n const $thead = document.createElement('thead');\r\n const $tr = document.createElement('tr');\r\n\r\n this.columns.forEach((column) => {\r\n const $th = document.createElement('th');\r\n $th.textContent = column.title;\r\n\r\n $tr.appendChild($th);\r\n });\r\n\r\n $thead.appendChild($tr);\r\n $thead.classList.add('table-header');\r\n\r\n $.style($tr, 'height', this.gantt.options.header_height + 9 + 'px');\r\n\r\n return $thead;\r\n }\r\n\r\n get_parentNode(tag, target) {\r\n\r\n console.log(\"[Table :: get_parentNode]\");\r\n console.table(tag);\r\n console.table(target);\r\n\r\n if (target.tagName === tag.toUpperCase()) return target;\r\n return this.get_parentNode(tag, target.parentNode);\r\n }\r\n\r\n draw_table_body(tasks) {\r\n\r\n console.log(\"[Table :: draw_table_body]\");\r\n console.table(tasks);\r\n\r\n this.tasks = this.gantt.setGroupPosition(tasks);\r\n\r\n const $tbody = document.createElement('tbody');\r\n $tbody.classList.add('table-body');\r\n\r\n this.make_table_row().forEach((row) => $tbody.append(row));\r\n\r\n $tbody.addEventListener('mousedown', (e) => {\r\n const $td = this.get_parentNode('td', e.target);\r\n\r\n $td.classList.contains('draggable-item') &&\r\n this.bind_draggable_event($tbody);\r\n });\r\n\r\n return $tbody;\r\n }\r\n\r\n isRowLine(id) {\r\n\r\n console.log(\"[Table :: isRowLine]\");\r\n console.table(id);\r\n\r\n if (id <= 2) return false;\r\n const target = this.tasks.find((t) => t.id === `${id}`);\r\n\r\n return !target.groupPosition.includes('last');\r\n }\r\n\r\n make_table_row() {\r\n\r\n console.log(\"[Table :: make_table_row]\");\r\n\r\n return this.tasks.map((task, index) => {\r\n const deps = task.level - 1;\r\n const $tr = document.createElement('tr');\r\n $tr.setAttribute('draggable', 'true');\r\n $tr.setAttribute('data-id', task.id);\r\n $.style($tr, {\r\n height:\r\n this.gantt.options.bar_height +\r\n this.gantt.options.padding +\r\n 'px',\r\n });\r\n\r\n if (deps === 1 && task.groupPosition.includes('last')) {\r\n $tr.classList.add('root-last');\r\n }\r\n\r\n this.columns.forEach((column) => {\r\n const $td = document.createElement('td');\r\n const { data, render } = column;\r\n\r\n if (data === 'drag') {\r\n $td.innerHTML = ``;\r\n $td.className = 'draggable-item';\r\n $tr.append($td);\r\n return;\r\n }\r\n\r\n if (data === 'wbs') {\r\n $td.className = data;\r\n }\r\n\r\n if (data === 'name' && task.level > 1) {\r\n $td.setAttribute('rel', task.type);\r\n $td.className = `work-name indent-${deps} indent-${deps}-${task.groupPosition[0]}`;\r\n\r\n if (task.groupPosition[1]) {\r\n $td.classList.add(\r\n `indent-${deps}-${task.groupPosition[1]}`\r\n );\r\n }\r\n\r\n if (task.type !== 'default') {\r\n $td.classList.add(task.closed ? 'closed' : 'opened');\r\n }\r\n\r\n for (let i = 0; i < deps; i++) {\r\n const $ins = document.createElement('ins');\r\n $ins.textContent = '';\r\n\r\n this.isRowLine(task.parentId) &&\r\n $ins.classList.add('row-line');\r\n\r\n if (deps === 1 || i === deps - 2) {\r\n $ins.classList.add('marker');\r\n\r\n deps > 1 && $ins.classList.add('row-line');\r\n\r\n $td.append($ins);\r\n break;\r\n }\r\n\r\n $td.append($ins);\r\n }\r\n }\r\n\r\n if (render) {\r\n const child_node = render(task[data], task);\r\n $td.append(child_node);\r\n } else {\r\n const text = document.createTextNode(task[data] ?? '');\r\n $td.append(text);\r\n }\r\n\r\n $tr.append($td);\r\n });\r\n\r\n $tr.addEventListener('mousedown', (e) => {\r\n const $td = this.get_parentNode('td', e.target);\r\n\r\n if ($td.classList.contains('draggable-item')) {\r\n $tr.addEventListener('dragstart', (e) => {\r\n e.target.classList.add('dragging');\r\n });\r\n\r\n $tr.addEventListener('dragend', (e) => {\r\n e.target.classList.remove('dragging');\r\n });\r\n }\r\n });\r\n\r\n return $tr;\r\n });\r\n }\r\n\r\n get_drag_after_element(container, y) {\r\n\r\n console.log(\"[Table :: get_drag_after_element]\");\r\n console.table(container);\r\n console.table(y);\r\n\r\n const draggableElements = [\r\n ...container.querySelectorAll('tr:not(.dragging)'),\r\n ];\r\n\r\n return draggableElements.reduce(\r\n (closest, child) => {\r\n const box = child.getBoundingClientRect();\r\n const offset = y - box.top - box.height / 2;\r\n if (offset < 0 && offset > closest.offset) {\r\n return { offset: offset, element: child };\r\n } else {\r\n return closest;\r\n }\r\n },\r\n { offset: Number.NEGATIVE_INFINITY }\r\n ).element;\r\n }\r\n\r\n find_task_item(id) {\r\n\r\n console.log(\"[Table :: find_task_item]\");\r\n console.table(id);\r\n\r\n return this.tasks.find((t) => t.id === id);\r\n }\r\n\r\n bind_draggable_event($tbody) {\r\n\r\n console.log(\"[Table :: bind_draggable_event]\");\r\n console.table($tbody);\r\n\r\n $tbody.addEventListener('dragover', (e) => {\r\n e.preventDefault();\r\n if (!this.dragStartY) this.dragStartY = e.clientY;\r\n\r\n this.draggableEl = document.querySelector('.dragging');\r\n this.afterElement = this.get_drag_after_element($tbody, e.clientY);\r\n\r\n $tbody.insertBefore(this.draggableEl, this.afterElement);\r\n });\r\n\r\n $tbody.addEventListener('drop', async (e) => {\r\n e.preventDefault();\r\n const targetItem = this.find_task_item(\r\n this.get_parentNode('tr', e.target).getAttribute('data-id')\r\n );\r\n const dragItem = this.find_task_item(\r\n this.draggableEl.getAttribute('data-id')\r\n );\r\n const afterItem = this.find_task_item(\r\n this.afterElement.getAttribute('data-id')\r\n );\r\n\r\n const params = {\r\n c_id: dragItem.id,\r\n ref: afterItem.parentId,\r\n c_position:\r\n e.clientY > this.dragStartY\r\n ? afterItem.position - 1\r\n : afterItem.position,\r\n level: afterItem.level,\r\n p_position: dragItem.position,\r\n p_parentId: dragItem.parentId,\r\n };\r\n\r\n if (targetItem.type !== 'default') {\r\n const arr = this.tasks.filter(\r\n (t) => t.parentId === Number(targetItem.id)\r\n ).length;\r\n params.ref = targetItem.id;\r\n params.level = targetItem.level + 1;\r\n params.c_position = arr ? arr : 0;\r\n }\r\n\r\n this.dragStartY = 0;\r\n this.gantt.draggble_rerender(params);\r\n this.gantt.trigger_event('drag_row', [params]);\r\n });\r\n }\r\n}\r\n","import { $ } from './svg_utils';\r\n\r\nexport default class Split {\r\n constructor(wrapper) {\r\n this.draw_split_bar(wrapper);\r\n }\r\n\r\n draw_split_bar(elem) {\r\n const $split_bar = document.createElement('div');\r\n $split_bar.classList.add('split-bar');\r\n\r\n let x = 0;\r\n\r\n const mouseDownHandler = function (e) {\r\n x = e.clientX;\r\n\r\n document.addEventListener('mousemove', mouseMoveHandler);\r\n document.addEventListener('mouseup', mouseUpHandler);\r\n };\r\n\r\n const mouseMoveHandler = function (e) {\r\n const $table = $split_bar.previousElementSibling;\r\n const $gantt = $split_bar.nextSibling;\r\n\r\n const dx = e.clientX - x;\r\n const left =\r\n (Math.max(\r\n 0,\r\n Math.min($split_bar.offsetLeft + dx, elem.clientWidth)\r\n ) /\r\n elem.clientWidth) *\r\n 100;\r\n\r\n $.style($split_bar, { left: `${left}%` });\r\n $.style($table, { 'flex-basis': `${left}%` });\r\n $.style($gantt, { 'flex-basis': `${100 - left}%` });\r\n $.style($table, { 'overflow-x': 'hidden' });\r\n $.style($gantt, { 'overflow-x': 'hidden' });\r\n\r\n x = e.clientX;\r\n };\r\n\r\n const mouseUpHandler = function () {\r\n const $table = $split_bar.previousElementSibling;\r\n const $gantt = $split_bar.nextSibling;\r\n\r\n document.removeEventListener('mousemove', mouseMoveHandler);\r\n document.removeEventListener('mouseup', mouseUpHandler);\r\n\r\n $.style($table, { 'overflow-x': 'auto' });\r\n $.style($gantt, { 'overflow-x': 'auto' });\r\n };\r\n\r\n $split_bar.addEventListener('mousedown', mouseDownHandler);\r\n elem.prepend($split_bar);\r\n }\r\n}\r\n","import date_utils from './date_utils';\r\nimport { $, createSVG } from './svg_utils';\r\nimport Bar from './bar';\r\nimport Arrow from './arrow';\r\nimport Popup from './popup';\r\nimport Table from './table';\r\nimport Split from './split';\r\n\r\nimport './gantt.scss';\r\n\r\nconst VIEW_MODE = {\r\n QUARTER_DAY: 'Quarter Day',\r\n HALF_DAY: 'Half Day',\r\n DAY: 'Day',\r\n WEEK: 'Week',\r\n MONTH: 'Month',\r\n YEAR: 'Year',\r\n};\r\n\r\nexport default class Gantt {\r\n constructor(wrapper, tasks, options, contents) {\r\n this.originTasks = tasks;\r\n\r\n this.setup_options(options);\r\n this.setup_tasks(tasks);\r\n\r\n this.setup_wrapper(wrapper);\r\n\r\n // initialize with default view mode\r\n this.change_view_mode();\r\n this.setup_split_bar();\r\n this.setup_table(contents);\r\n\r\n this.bind_events();\r\n }\r\n\r\n setup_wrapper(element) {\r\n let svg_element;\r\n let wrapper_element;\r\n\r\n // CSS Selector is passed\r\n if (typeof element === 'string') {\r\n element = document.querySelector(element);\r\n }\r\n\r\n // get the SVGElement\r\n if (element instanceof HTMLElement) {\r\n wrapper_element = element;\r\n svg_element = element.querySelector('svg');\r\n } else if (element instanceof SVGElement) {\r\n svg_element = element;\r\n } else {\r\n throw new TypeError(\r\n 'Frappé Gantt only supports usage of a string CSS selector,' +\r\n \" HTML DOM element or SVG DOM element for the 'element' parameter\"\r\n );\r\n }\r\n\r\n // svg element\r\n if (!svg_element) {\r\n // create it\r\n this.$svg = createSVG('svg', {\r\n append_to: wrapper_element,\r\n class: 'gantt',\r\n });\r\n } else {\r\n this.$svg = svg_element;\r\n this.$svg.classList.add('gantt');\r\n }\r\n\r\n this.$wrapper = document.createElement('div');\r\n this.$wrapper.classList.add('wrapper');\r\n\r\n // wrapper element\r\n this.$container = document.createElement('div');\r\n this.$container.classList.add('gantt-container');\r\n\r\n const parent_element = this.$svg.parentElement;\r\n element.appendChild(this.setup_mode_handler());\r\n parent_element.appendChild(this.$wrapper);\r\n this.$wrapper.appendChild(this.$container);\r\n this.$container.appendChild(this.$svg);\r\n\r\n // popup wrapper\r\n this.popup_wrapper = document.createElement('div');\r\n this.popup_wrapper.classList.add('popup-wrapper');\r\n this.$container.appendChild(this.popup_wrapper);\r\n }\r\n\r\n setup_mode_handler() {\r\n const wrapper = document.createElement('div');\r\n const excel_export = document.createElement('button');\r\n const btn_group = document.createElement('div');\r\n\r\n wrapper.className = 'mt well well-sm clearfix';\r\n excel_export.className = 'btn btn-default btn-sm mr-xs';\r\n\r\n excel_export.innerText = 'Excel';\r\n\r\n $.style(btn_group, { float: 'right' });\r\n\r\n Object.keys(VIEW_MODE).forEach((key) => {\r\n const btn = document.createElement('button');\r\n btn.className = `btn btn-default btn-sm mr-xs ${\r\n VIEW_MODE[key] === this.options.view_mode ? 'active' : ''\r\n }`;\r\n btn.innerText = VIEW_MODE[key];\r\n btn.addEventListener('click', (e) => {\r\n e.target.classList.add('active');\r\n e.target.parentNode.childNodes.forEach((b) =>\r\n b.classList.remove('active')\r\n );\r\n\r\n this.change_view_mode(VIEW_MODE[key]);\r\n });\r\n\r\n btn_group.appendChild(btn);\r\n });\r\n\r\n wrapper.append(excel_export);\r\n wrapper.append(btn_group);\r\n\r\n return wrapper;\r\n }\r\n\r\n setup_options(options) {\r\n const default_options = {\r\n header_height: 50,\r\n column_width: 30,\r\n step: 24,\r\n view_modes: [...Object.values(VIEW_MODE)],\r\n bar_height: 20,\r\n bar_corner_radius: 3,\r\n arrow_curve: 5,\r\n padding: 18,\r\n view_mode: 'Day',\r\n date_format: 'YYYY-MM-DD',\r\n popup_trigger: 'click',\r\n custom_popup_html: null,\r\n language: 'ko',\r\n };\r\n this.options = Object.assign({}, default_options, options);\r\n }\r\n\r\n setup_tasks(tasks) {\r\n // prepare tasks\r\n this.tasks = this.sort_tasks(tasks).map((task, i) => {\r\n // convert to Date objects\r\n task._start = date_utils.parse(task.start);\r\n task._end = date_utils.parse(task.end);\r\n\r\n // make task invalid if duration too large\r\n if (date_utils.diff(task._end, task._start, 'year') > 10) {\r\n task.end = null;\r\n }\r\n\r\n // cache index\r\n task._index = i;\r\n\r\n // invalid dates\r\n if (!task.start && !task.end) {\r\n const today = date_utils.today();\r\n task._start = today;\r\n task._end = date_utils.add(today, 2, 'day');\r\n }\r\n\r\n if (!task.start && task.end) {\r\n task._start = date_utils.add(task._end, -2, 'day');\r\n }\r\n\r\n if (task.start && !task.end) {\r\n task._end = date_utils.add(task._start, 2, 'day');\r\n }\r\n\r\n // if hours is not set, assume the last day is full day\r\n // e.g: 2018-09-09 becomes 2018-09-09 23:59:59\r\n const task_end_values = date_utils.get_date_values(task._end);\r\n if (task_end_values.slice(3).every((d) => d === 0)) {\r\n task._end = date_utils.add(task._end, 24, 'hour');\r\n }\r\n\r\n // invalid flag\r\n if (!task.start || !task.end) {\r\n task.invalid = true;\r\n }\r\n\r\n // dependencies\r\n if (typeof task.dependencies === 'string' || !task.dependencies) {\r\n let deps = [];\r\n if (task.dependencies) {\r\n deps = task.dependencies\r\n .split(',')\r\n .map((d) => d.trim())\r\n .filter((d) => d);\r\n }\r\n task.dependencies = deps;\r\n }\r\n\r\n // uids\r\n if (!task.id) {\r\n task.id = generate_id(task);\r\n }\r\n\r\n return task;\r\n });\r\n\r\n this.setup_dependencies();\r\n }\r\n\r\n setup_dependencies() {\r\n this.dependency_map = {};\r\n for (let t of this.tasks) {\r\n for (let d of t.dependencies) {\r\n this.dependency_map[d] = this.dependency_map[d] || [];\r\n this.dependency_map[d].push(t.id);\r\n }\r\n }\r\n }\r\n\r\n refresh(tasks) {\r\n this.setup_tasks(tasks);\r\n this.change_view_mode();\r\n this.rerender_table();\r\n this.originTasks = tasks;\r\n }\r\n\r\n change_view_mode(mode = this.options.view_mode) {\r\n this.update_view_scale(mode);\r\n this.setup_dates();\r\n this.render();\r\n // fire viewmode_change event\r\n this.trigger_event('view_change', [mode]);\r\n }\r\n\r\n update_view_scale(view_mode) {\r\n this.options.view_mode = view_mode;\r\n\r\n if (view_mode === VIEW_MODE.DAY) {\r\n this.options.step = 24;\r\n this.options.column_width = 38;\r\n } else if (view_mode === VIEW_MODE.HALF_DAY) {\r\n this.options.step = 24 / 2;\r\n this.options.column_width = 38;\r\n } else if (view_mode === VIEW_MODE.QUARTER_DAY) {\r\n this.options.step = 24 / 4;\r\n this.options.column_width = 38;\r\n } else if (view_mode === VIEW_MODE.WEEK) {\r\n this.options.step = 24 * 7;\r\n this.options.column_width = 140;\r\n } else if (view_mode === VIEW_MODE.MONTH) {\r\n this.options.step = 24 * 30;\r\n this.options.column_width = 120;\r\n } else if (view_mode === VIEW_MODE.YEAR) {\r\n this.options.step = 24 * 365;\r\n this.options.column_width = 120;\r\n }\r\n }\r\n\r\n setup_dates() {\r\n this.setup_gantt_dates();\r\n this.setup_date_values();\r\n }\r\n\r\n setup_gantt_dates() {\r\n this.gantt_start = this.gantt_end = null;\r\n\r\n for (let task of this.tasks) {\r\n // set global start and end date\r\n if (!this.gantt_start || task._start < this.gantt_start) {\r\n this.gantt_start = task._start;\r\n }\r\n if (!this.gantt_end || task._end > this.gantt_end) {\r\n this.gantt_end = task._end;\r\n }\r\n }\r\n\r\n this.gantt_start = date_utils.start_of(this.gantt_start, 'day');\r\n this.gantt_end = date_utils.start_of(this.gantt_end, 'day');\r\n\r\n // add date padding on both sides\r\n if (this.view_is([VIEW_MODE.QUARTER_DAY, VIEW_MODE.HALF_DAY])) {\r\n this.gantt_start = date_utils.add(this.gantt_start, -7, 'day');\r\n this.gantt_end = date_utils.add(this.gantt_end, 7, 'day');\r\n } else if (this.view_is(VIEW_MODE.MONTH)) {\r\n this.gantt_start = date_utils.start_of(this.gantt_start, 'year');\r\n this.gantt_end = date_utils.add(this.gantt_end, 1, 'year');\r\n } else if (this.view_is(VIEW_MODE.YEAR)) {\r\n this.gantt_start = date_utils.add(this.gantt_start, -2, 'year');\r\n this.gantt_end = date_utils.add(this.gantt_end, 2, 'year');\r\n } else {\r\n this.gantt_start = date_utils.add(this.gantt_start, -1, 'month');\r\n this.gantt_end = date_utils.add(this.gantt_end, 1, 'month');\r\n }\r\n }\r\n\r\n setup_date_values() {\r\n this.dates = [];\r\n let cur_date = null;\r\n\r\n while (cur_date === null || cur_date < this.gantt_end) {\r\n if (!cur_date) {\r\n cur_date = date_utils.clone(this.gantt_start);\r\n } else {\r\n if (this.view_is(VIEW_MODE.YEAR)) {\r\n cur_date = date_utils.add(cur_date, 1, 'year');\r\n } else if (this.view_is(VIEW_MODE.MONTH)) {\r\n cur_date = date_utils.add(cur_date, 1, 'month');\r\n } else {\r\n cur_date = date_utils.add(\r\n cur_date,\r\n this.options.step,\r\n 'hour'\r\n );\r\n }\r\n }\r\n this.dates.push(cur_date);\r\n }\r\n }\r\n\r\n bind_events() {\r\n this.bind_grid_click();\r\n this.bind_bar_events();\r\n this.bind_scroll_event();\r\n }\r\n\r\n render() {\r\n this.clear();\r\n this.setup_layers();\r\n this.make_grid();\r\n this.make_grid_header();\r\n this.make_dates();\r\n this.make_bars();\r\n this.make_arrows();\r\n this.map_arrows_on_bars();\r\n this.set_width();\r\n this.set_scroll_position();\r\n }\r\n\r\n rerender_table() {\r\n document.querySelector('.table-body')?.remove();\r\n\r\n const $table_body = this.table.draw_table_body(this.tasks, {\r\n height: this.options.bar_height + this.options.padding + 'px',\r\n });\r\n\r\n document\r\n .querySelector('.table-container table')\r\n .appendChild($table_body);\r\n\r\n $table_body.addEventListener('click', (event) =>\r\n this.bind_table_event(event)\r\n );\r\n }\r\n\r\n draggble_rerender(item) {\r\n this.update_origin_tasks(item);\r\n this.render();\r\n this.rerender_table();\r\n }\r\n\r\n sort_tasks(tasks) {\r\n const sorted_tasks = [...tasks];\r\n const children_idx_info = {};\r\n\r\n sorted_tasks\r\n .sort((a, b) => a.level - b.level || a.position - b.position)\r\n .forEach((task, taskIdx) => {\r\n if (task.parentId !== 2) {\r\n if (children_idx_info.hasOwnProperty(task.parentId)) {\r\n children_idx_info[task.parentId].push(taskIdx);\r\n } else {\r\n children_idx_info[task.parentId] = [taskIdx];\r\n }\r\n\r\n const parentIdx = sorted_tasks.findIndex(\r\n (item) => +item.id === task.parentId\r\n );\r\n\r\n sorted_tasks.splice(taskIdx, 1);\r\n sorted_tasks.splice(\r\n parentIdx + children_idx_info[task.parentId].length,\r\n 0,\r\n task\r\n );\r\n }\r\n }, []);\r\n\r\n return sorted_tasks;\r\n }\r\n\r\n setGroupPosition(data) {\r\n return data.reduce((acc, cur) => {\r\n const group = data.filter((t) => t.parentId === cur.parentId);\r\n\r\n cur.groupPosition = [];\r\n\r\n if (group[0].id === cur.id) {\r\n cur.groupPosition.push('first');\r\n }\r\n if (group[group.length - 1].id === cur.id) {\r\n cur.groupPosition.push('last');\r\n }\r\n if (!cur.groupPosition.length) {\r\n cur.groupPosition.push('middle');\r\n }\r\n\r\n acc.push(cur);\r\n return acc;\r\n }, []);\r\n }\r\n\r\n update_dependecies(id) {\r\n if (id === 2) return [];\r\n\r\n const dependencies = this.tasks.find(\r\n (task) => task.id === id\r\n ).dependencies;\r\n\r\n if (!dependencies.length) return [id];\r\n return [...dependencies, id];\r\n }\r\n\r\n update_origin_tasks(item) {\r\n let tasks = this.tasks.reduce((acc, cur) => {\r\n if (cur.id === item.c_id) {\r\n const dependencies = this.update_dependecies(item.ref);\r\n\r\n cur = {\r\n ...cur,\r\n parentId: Number(item.ref),\r\n dependencies,\r\n position: item.c_position,\r\n level: item.level,\r\n wbs: dependencies.length\r\n ? `${dependencies.join('-')}-${item.c_id}`\r\n : `${item.c_id}`,\r\n };\r\n } else {\r\n if (\r\n cur.parentId === Number(item.ref) &&\r\n item.c_position === item.p_position\r\n ) {\r\n acc.push(cur);\r\n return acc;\r\n }\r\n\r\n if (cur.parentId === Number(item.ref)) {\r\n cur.position =\r\n item.c_position > item.p_position\r\n ? cur.position < item.p_position\r\n ? cur.position\r\n : cur.position <= item.c_position\r\n ? cur.position - 1\r\n : cur.position\r\n : cur.position > item.p_position\r\n ? cur.position\r\n : cur.position >= item.c_position\r\n ? cur.position + 1\r\n : cur.position;\r\n } else {\r\n if (cur.parentId === item.p_parentId) {\r\n cur.position =\r\n cur.position < item.p_position\r\n ? cur.position\r\n : cur.position - 1;\r\n }\r\n }\r\n }\r\n\r\n acc.push(cur);\r\n return acc;\r\n }, []);\r\n\r\n tasks = this.setGroupPosition(tasks);\r\n\r\n this.setup_tasks(tasks);\r\n this.originTasks = tasks;\r\n }\r\n\r\n setup_layers() {\r\n this.layers = {};\r\n const layers = [\r\n 'grid',\r\n 'arrow',\r\n 'progress',\r\n 'bar',\r\n 'details',\r\n 'header',\r\n 'date',\r\n ];\r\n // make group layers\r\n for (let layer of layers) {\r\n this.layers[layer] = createSVG('g', {\r\n class: layer,\r\n append_to: this.$svg,\r\n });\r\n }\r\n }\r\n\r\n setup_split_bar() {\r\n this.split = new Split(this.$wrapper);\r\n }\r\n\r\n setup_table(contents, handler) {\r\n this.table = new Table(this, contents, handler);\r\n this.make_table();\r\n }\r\n\r\n bind_table_event(event) {\r\n const $tr = event.target.closest('tr');\r\n const id = $tr.dataset.id;\r\n\r\n if (\r\n event.target.tagName !== 'INS' &&\r\n !event.target.classList.contains('marker')\r\n ) {\r\n const task = this.get_task(id);\r\n\r\n this.handle_selected(task);\r\n\r\n return;\r\n }\r\n\r\n const $target = event.target.closest('td');\r\n\r\n if (\r\n $target.getAttribute('rel') === 'folder' ||\r\n $target.getAttribute('rel') === 'drive'\r\n ) {\r\n let tasks = [...this.tasks];\r\n\r\n if ($target.classList.contains('closed')) {\r\n this.originTasks.forEach((task) => {\r\n if (task.id === id) {\r\n delete task.closed;\r\n return tasks.splice(task._index, 1, task);\r\n }\r\n\r\n if (task.dependencies.includes(id))\r\n tasks.splice(task._index, 0, task);\r\n });\r\n } else {\r\n tasks = this.tasks.reduce((acc, task) => {\r\n if (task.id === id) {\r\n return [...acc, { ...task, closed: true }];\r\n }\r\n\r\n if (!task.dependencies.includes(id)) {\r\n return [...acc, task];\r\n }\r\n\r\n return acc;\r\n }, []);\r\n }\r\n\r\n this.setup_tasks(tasks);\r\n this.render();\r\n this.rerender_table();\r\n }\r\n }\r\n\r\n make_table() {\r\n const $table_container = document.createElement('div');\r\n const $table = document.createElement('table');\r\n\r\n $table_container.className = 'table-container';\r\n\r\n const $table_header = this.table.draw_table_header();\r\n const $table_body = this.table.draw_table_body(this.tasks);\r\n\r\n $table.append($table_header);\r\n $table.append($table_body);\r\n\r\n $table_body.addEventListener('click', (event) =>\r\n this.bind_table_event(event)\r\n );\r\n\r\n $table_container.append($table);\r\n\r\n this.$wrapper.prepend($table_container);\r\n }\r\n\r\n make_grid() {\r\n this.make_grid_background();\r\n this.make_grid_rows();\r\n this.make_grid_ticks();\r\n this.make_grid_highlights();\r\n }\r\n\r\n handle_selected(task) {\r\n const $tr = this.$wrapper.querySelectorAll('tr')[task._index + 1];\r\n const $grid_row =\r\n this.$wrapper.querySelectorAll('.grid-row')[task._index];\r\n\r\n if (!$tr.classList.contains('selected')) {\r\n Array.prototype.forEach.call(\r\n this.$wrapper.querySelectorAll('.selected'),\r\n (elem) => elem.classList.remove('selected')\r\n );\r\n }\r\n\r\n $tr?.classList.toggle('selected');\r\n $grid_row?.classList.toggle('selected');\r\n }\r\n\r\n make_grid_background() {\r\n const grid_width = this.dates.length * this.options.column_width;\r\n const grid_height =\r\n this.options.header_height +\r\n this.options.padding +\r\n (this.options.bar_height + this.options.padding) *\r\n this.tasks.length;\r\n\r\n createSVG('rect', {\r\n x: 0,\r\n y: 0,\r\n width: grid_width,\r\n height: grid_height,\r\n class: 'grid-background',\r\n append_to: this.layers.grid,\r\n });\r\n\r\n $.attr(this.$svg, {\r\n height: grid_height,\r\n width: '100%',\r\n });\r\n }\r\n\r\n make_grid_rows() {\r\n const rows_layer = createSVG('g', { append_to: this.layers.grid });\r\n // const lines_layer = createSVG('g', { append_to: this.layers.grid });\r\n\r\n const row_width = this.dates.length * this.options.column_width;\r\n const row_height = this.options.bar_height + this.options.padding;\r\n\r\n let row_y = this.options.header_height + this.options.padding / 2;\r\n\r\n for (let task of this.tasks) {\r\n createSVG('rect', {\r\n x: 0,\r\n y: row_y,\r\n width: row_width,\r\n height: row_height,\r\n class: 'grid-row',\r\n append_to: rows_layer,\r\n });\r\n\r\n // createSVG('line', {\r\n // x1: 0,\r\n // y1: row_y + row_height,\r\n // x2: row_width,\r\n // y2: row_y + row_height,\r\n // class: 'row-line',\r\n // append_to: lines_layer,\r\n // });\r\n\r\n row_y += this.options.bar_height + this.options.padding;\r\n }\r\n }\r\n\r\n make_grid_header() {\r\n const header_width = this.dates.length * this.options.column_width;\r\n const header_height = this.options.header_height + 10;\r\n\r\n const pageScroll = window.scrollY;\r\n const originOffset =\r\n pageScroll + this.$wrapper.getBoundingClientRect().top;\r\n\r\n if (originOffset <= pageScroll) {\r\n this.layers.header.style.transform = `translate(0px, ${Math.floor(\r\n window.scrollY - originOffset\r\n )}px)`;\r\n }\r\n\r\n createSVG('rect', {\r\n x: 0,\r\n y: 0,\r\n width: header_width,\r\n height: header_height,\r\n class: 'grid-header',\r\n append_to: this.layers.header,\r\n });\r\n }\r\n\r\n make_grid_ticks() {\r\n let tick_x = 0;\r\n let tick_y = this.options.header_height + this.options.padding / 2;\r\n let tick_height =\r\n (this.options.bar_height + this.options.padding) *\r\n this.tasks.length;\r\n\r\n for (let date of this.dates) {\r\n let tick_class = 'tick';\r\n // thick tick for monday\r\n if (this.view_is(VIEW_MODE.DAY) && date.getDate() === 1) {\r\n tick_class += ' thick';\r\n }\r\n // thick tick for first week\r\n if (\r\n this.view_is(VIEW_MODE.WEEK) &&\r\n date.getDate() >= 1 &&\r\n date.getDate() < 8\r\n ) {\r\n tick_class += ' thick';\r\n }\r\n // thick ticks for quarters\r\n if (this.view_is(VIEW_MODE.MONTH) && date.getMonth() % 3 === 0) {\r\n tick_class += ' thick';\r\n }\r\n\r\n createSVG('path', {\r\n d: `M ${tick_x} ${tick_y} v ${tick_height}`,\r\n class: tick_class,\r\n append_to: this.layers.grid,\r\n });\r\n\r\n if (this.view_is(VIEW_MODE.MONTH)) {\r\n tick_x +=\r\n (date_utils.get_days_in_month(date) *\r\n this.options.column_width) /\r\n 30;\r\n } else {\r\n tick_x += this.options.column_width;\r\n }\r\n }\r\n }\r\n\r\n make_grid_highlights() {\r\n // highlight today's date\r\n if (this.view_is(VIEW_MODE.DAY)) {\r\n const x =\r\n (date_utils.diff(date_utils.today(), this.gantt_start, 'hour') /\r\n this.options.step) *\r\n this.options.column_width;\r\n const y = 0;\r\n\r\n const width = this.options.column_width;\r\n const height =\r\n (this.options.bar_height + this.options.padding) *\r\n this.tasks.length +\r\n this.options.header_height +\r\n this.options.padding / 2;\r\n\r\n createSVG('rect', {\r\n x,\r\n y,\r\n width,\r\n height,\r\n class: 'today-highlight',\r\n append_to: this.layers.grid,\r\n });\r\n }\r\n }\r\n\r\n make_dates() {\r\n const pageScroll = window.scrollY;\r\n const originOffset =\r\n pageScroll + this.$wrapper.getBoundingClientRect().top;\r\n\r\n if (originOffset <= pageScroll) {\r\n this.layers.date.style.transform = `translate(0px, ${Math.floor(\r\n window.scrollY - originOffset\r\n )}px)`;\r\n }\r\n\r\n for (let date of this.get_dates_to_draw()) {\r\n createSVG('text', {\r\n x: date.lower_x,\r\n y: date.lower_y,\r\n innerHTML: date.lower_text,\r\n class: 'lower-text',\r\n append_to: this.layers.date,\r\n });\r\n\r\n if (date.upper_text) {\r\n const $upper_text = createSVG('text', {\r\n x: date.upper_x,\r\n y: date.upper_y,\r\n innerHTML: date.upper_text,\r\n class: 'upper-text',\r\n append_to: this.layers.date,\r\n });\r\n\r\n // remove out-of-bound dates\r\n if (\r\n $upper_text.getBBox().x2 > this.layers.grid.getBBox().width\r\n ) {\r\n $upper_text.remove();\r\n }\r\n }\r\n }\r\n }\r\n\r\n get_dates_to_draw() {\r\n let last_date = null;\r\n const dates = this.dates.map((date, i) => {\r\n const d = this.get_date_info(date, last_date, i);\r\n last_date = date;\r\n return d;\r\n });\r\n return dates;\r\n }\r\n\r\n get_date_info(date, last_date, i) {\r\n if (!last_date) {\r\n last_date = date_utils.add(date, 1, 'year');\r\n }\r\n const date_text = {\r\n 'Quarter Day_lower': date_utils.format(\r\n date,\r\n 'HH',\r\n this.options.language\r\n ),\r\n 'Half Day_lower': date_utils.format(\r\n date,\r\n 'HH',\r\n this.options.language\r\n ),\r\n Day_lower:\r\n date.getDate() !== last_date.getDate()\r\n ? date_utils.format(date, 'D', this.options.language)\r\n : '',\r\n Week_lower:\r\n date.getMonth() !== last_date.getMonth()\r\n ? date_utils.format(date, 'D MMM', this.options.language)\r\n : date_utils.format(date, 'D', this.options.language),\r\n Month_lower: date_utils.format(date, 'MMMM', this.options.language),\r\n Year_lower: date_utils.format(date, 'YYYY', this.options.language),\r\n 'Quarter Day_upper':\r\n date.getDate() !== last_date.getDate()\r\n ? date_utils.format(date, 'D MMM', this.options.language)\r\n : '',\r\n 'Half Day_upper':\r\n date.getDate() !== last_date.getDate()\r\n ? date.getMonth() !== last_date.getMonth()\r\n ? date_utils.format(\r\n date,\r\n 'D MMM',\r\n this.options.language\r\n )\r\n : date_utils.format(date, 'D', this.options.language)\r\n : '',\r\n Day_upper:\r\n date.getMonth() !== last_date.getMonth()\r\n ? date_utils.format(date, 'MMMM', this.options.language)\r\n : '',\r\n Week_upper:\r\n date.getMonth() !== last_date.getMonth()\r\n ? date_utils.format(date, 'MMMM', this.options.language)\r\n : '',\r\n Month_upper:\r\n date.getFullYear() !== last_date.getFullYear()\r\n ? date_utils.format(date, 'YYYY', this.options.language)\r\n : '',\r\n Year_upper:\r\n date.getFullYear() !== last_date.getFullYear()\r\n ? date_utils.format(date, 'YYYY', this.options.language)\r\n : '',\r\n };\r\n\r\n const base_pos = {\r\n x: i * this.options.column_width,\r\n lower_y: this.options.header_height,\r\n upper_y: this.options.header_height - 25,\r\n };\r\n\r\n const x_pos = {\r\n 'Quarter Day_lower': (this.options.column_width * 4) / 2,\r\n 'Quarter Day_upper': 0,\r\n 'Half Day_lower': (this.options.column_width * 2) / 2,\r\n 'Half Day_upper': 0,\r\n Day_lower: this.options.column_width / 2,\r\n Day_upper: (this.options.column_width * 30) / 2,\r\n Week_lower: 0,\r\n Week_upper: (this.options.column_width * 4) / 2,\r\n Month_lower: this.options.column_width / 2,\r\n Month_upper: (this.options.column_width * 12) / 2,\r\n Year_lower: this.options.column_width / 2,\r\n Year_upper: (this.options.column_width * 30) / 2,\r\n };\r\n\r\n return {\r\n upper_text: date_text[`${this.options.view_mode}_upper`],\r\n lower_text: date_text[`${this.options.view_mode}_lower`],\r\n upper_x: base_pos.x + x_pos[`${this.options.view_mode}_upper`],\r\n upper_y: base_pos.upper_y,\r\n lower_x: base_pos.x + x_pos[`${this.options.view_mode}_lower`],\r\n lower_y: base_pos.lower_y,\r\n };\r\n }\r\n\r\n make_bars() {\r\n this.bars = this.tasks.map((task) => {\r\n const bar = new Bar(this, task);\r\n this.layers.bar.appendChild(bar.group);\r\n return bar;\r\n });\r\n }\r\n\r\n make_arrows() {\r\n this.arrows = [];\r\n for (let task of this.tasks) {\r\n let arrows = [];\r\n arrows = task.dependencies\r\n .map((task_id) => {\r\n const dependency = this.get_task(task_id);\r\n if (!dependency) return;\r\n const arrow = new Arrow(\r\n this,\r\n this.bars[dependency._index], // from_task\r\n this.bars[task._index] // to_task\r\n );\r\n this.layers.arrow.appendChild(arrow.element);\r\n return arrow;\r\n })\r\n .filter(Boolean); // filter falsy values\r\n this.arrows = this.arrows.concat(arrows);\r\n }\r\n }\r\n\r\n map_arrows_on_bars() {\r\n for (let bar of this.bars) {\r\n bar.arrows = this.arrows.filter((arrow) => {\r\n return (\r\n arrow.from_task.task.id === bar.task.id ||\r\n arrow.to_task.task.id === bar.task.id\r\n );\r\n });\r\n }\r\n }\r\n\r\n set_width() {\r\n const cur_width = this.$svg.getBoundingClientRect().width;\r\n const actual_width = this.$svg\r\n .querySelector('.grid .grid-row')\r\n .getAttribute('width');\r\n if (cur_width < actual_width) {\r\n this.$svg.setAttribute('width', actual_width);\r\n }\r\n }\r\n\r\n set_scroll_position() {\r\n const parent_element = this.$svg.parentElement;\r\n if (!parent_element) return;\r\n\r\n const hours_before_first_task = date_utils.diff(\r\n this.get_oldest_starting_date(),\r\n this.gantt_start,\r\n 'hour'\r\n );\r\n\r\n const scroll_pos =\r\n (hours_before_first_task / this.options.step) *\r\n this.options.column_width -\r\n this.options.column_width;\r\n\r\n parent_element.scrollLeft = scroll_pos;\r\n }\r\n\r\n bind_scroll_event() {\r\n const originOffset =\r\n window.scrollY + this.$wrapper.getBoundingClientRect().top;\r\n const $table_header = $('.table-header');\r\n let ticking = false;\r\n\r\n $.bind(\r\n window,\r\n 'scroll',\r\n () => {\r\n const pageScroll = window.scrollY;\r\n\r\n if (ticking) return;\r\n\r\n ticking = true;\r\n window.requestAnimationFrame(() => {\r\n if (originOffset <= pageScroll) {\r\n $table_header.style.top = `${Math.floor(\r\n pageScroll - originOffset\r\n )}px`;\r\n this.layers.header.style.transform = `translate(0px, ${Math.floor(\r\n pageScroll - originOffset\r\n )}px)`;\r\n this.layers.date.style.transform = `translate(0px, ${Math.floor(\r\n pageScroll - originOffset\r\n )}px)`;\r\n } else {\r\n $table_header.style.top = '0px';\r\n this.layers.header.style.transform =\r\n 'translate(0px, 0px)';\r\n this.layers.date.style.transform =\r\n 'translate(0px, 0px)';\r\n }\r\n\r\n ticking = false;\r\n });\r\n },\r\n { passive: true }\r\n );\r\n }\r\n\r\n bind_grid_click() {\r\n $.on(\r\n this.$svg,\r\n this.options.popup_trigger,\r\n '.grid-row, .grid-header',\r\n () => {\r\n this.unselect_all();\r\n this.hide_popup();\r\n }\r\n );\r\n }\r\n\r\n bind_bar_events() {\r\n let is_dragging = false;\r\n let x_on_start = 0;\r\n let y_on_start = 0;\r\n let is_resizing_left = false;\r\n let is_resizing_right = false;\r\n let parent_bar_id = null;\r\n let bars = []; // instanceof Bar\r\n this.bar_being_dragged = null;\r\n\r\n function action_in_progress() {\r\n return is_dragging || is_resizing_left || is_resizing_right;\r\n }\r\n\r\n $.on(this.$svg, 'mousedown', '.bar-wrapper, .handle', (e, element) => {\r\n\r\n console.log ( \"[gantt-0.6.1 :: mousedown]\");\r\n\r\n const bar_wrapper = $.closest('.bar-wrapper', element);\r\n\r\n if (element.classList.contains('left')) {\r\n is_resizing_left = true;\r\n } else if (element.classList.contains('right')) {\r\n is_resizing_right = true;\r\n } else if (element.classList.contains('bar-wrapper')) {\r\n is_dragging = true;\r\n }\r\n\r\n bar_wrapper.classList.add('active');\r\n\r\n x_on_start = e.offsetX;\r\n y_on_start = e.offsetY;\r\n\r\n parent_bar_id = bar_wrapper.getAttribute('data-id');\r\n // const ids = [\r\n // parent_bar_id,\r\n // ...this.get_all_dependent_tasks(parent_bar_id),\r\n // ];\r\n const ids = [\r\n parent_bar_id\r\n ];\r\n bars = ids.map((id) => this.get_bar(id));\r\n\r\n this.bar_being_dragged = parent_bar_id;\r\n\r\n bars.forEach((bar) => {\r\n const $bar = bar.$bar;\r\n $bar.ox = $bar.getX();\r\n $bar.oy = $bar.getY();\r\n $bar.owidth = $bar.getWidth();\r\n $bar.finaldx = 0;\r\n });\r\n });\r\n\r\n $.on(this.$svg, 'mousemove', (e) => {\r\n\r\n console.log ( \"[gantt-0.6.1 :: mousemove]\");\r\n\r\n if (!action_in_progress()) return;\r\n const dx = e.offsetX - x_on_start;\r\n const dy = e.offsetY - y_on_start;\r\n\r\n bars.forEach((bar) => {\r\n const $bar = bar.$bar;\r\n $bar.finaldx = this.get_snap_position(dx);\r\n this.hide_popup();\r\n if (is_resizing_left) {\r\n if (parent_bar_id === bar.task.id) {\r\n bar.update_bar_position({\r\n x: $bar.ox + $bar.finaldx,\r\n width: $bar.owidth - $bar.finaldx,\r\n });\r\n } else {\r\n bar.update_bar_position({\r\n x: $bar.ox + $bar.finaldx,\r\n });\r\n }\r\n } else if (is_resizing_right) {\r\n if (parent_bar_id === bar.task.id) {\r\n bar.update_bar_position({\r\n width: $bar.owidth + $bar.finaldx,\r\n });\r\n }\r\n } else if (is_dragging) {\r\n bar.update_bar_position({ x: $bar.ox + $bar.finaldx });\r\n }\r\n });\r\n });\r\n\r\n document.addEventListener('mouseup', (e) => {\r\n if (is_dragging || is_resizing_left || is_resizing_right) {\r\n bars.forEach((bar) => bar.group.classList.remove('active'));\r\n }\r\n\r\n is_dragging = false;\r\n is_resizing_left = false;\r\n is_resizing_right = false;\r\n });\r\n\r\n $.on(this.$svg, 'mouseup', (e) => {\r\n this.bar_being_dragged = null;\r\n bars.forEach((bar) => {\r\n const $bar = bar.$bar;\r\n if (!$bar.finaldx) return;\r\n bar.date_changed();\r\n bar.set_action_completed();\r\n });\r\n });\r\n\r\n this.bind_bar_progress();\r\n }\r\n\r\n bind_bar_progress() {\r\n let x_on_start = 0;\r\n let y_on_start = 0;\r\n let is_resizing = null;\r\n let bar = null;\r\n let $bar_progress = null;\r\n let $bar = null;\r\n\r\n $.on(this.$svg, 'mousedown', '.handle.progress', (e, handle) => {\r\n is_resizing = true;\r\n x_on_start = e.offsetX;\r\n y_on_start = e.offsetY;\r\n\r\n const $bar_wrapper = $.closest('.bar-wrapper', handle);\r\n const id = $bar_wrapper.getAttribute('data-id');\r\n bar = this.get_bar(id);\r\n\r\n $bar_progress = bar.$bar_progress;\r\n $bar = bar.$bar;\r\n\r\n $bar_progress.finaldx = 0;\r\n $bar_progress.owidth = $bar_progress.getWidth();\r\n $bar_progress.min_dx = -$bar_progress.getWidth();\r\n $bar_progress.max_dx = $bar.getWidth() - $bar_progress.getWidth();\r\n });\r\n\r\n $.on(this.$svg, 'mousemove', (e) => {\r\n if (!is_resizing) return;\r\n let dx = e.offsetX - x_on_start;\r\n let dy = e.offsetY - y_on_start;\r\n\r\n if (dx > $bar_progress.max_dx) {\r\n dx = $bar_progress.max_dx;\r\n }\r\n if (dx < $bar_progress.min_dx) {\r\n dx = $bar_progress.min_dx;\r\n }\r\n\r\n const $handle = bar.$handle_progress;\r\n $.attr($bar_progress, 'width', $bar_progress.owidth + dx);\r\n $.attr($handle, 'points', bar.get_progress_polygon_points());\r\n $bar_progress.finaldx = dx;\r\n });\r\n\r\n $.on(this.$svg, 'mouseup', () => {\r\n is_resizing = false;\r\n if (!($bar_progress && $bar_progress.finaldx)) return;\r\n bar.progress_changed();\r\n bar.set_action_completed();\r\n });\r\n }\r\n\r\n get_all_dependent_tasks(task_id) {\r\n let out = [];\r\n let to_process = [task_id];\r\n while (to_process.length) {\r\n const deps = to_process.reduce((acc, curr) => {\r\n acc = acc.concat(this.dependency_map[curr]);\r\n return acc;\r\n }, []);\r\n\r\n out = out.concat(deps);\r\n to_process = deps.filter((d) => !to_process.includes(d));\r\n }\r\n\r\n return out.filter(Boolean);\r\n }\r\n\r\n get_snap_position(dx) {\r\n let odx = dx,\r\n rem,\r\n position;\r\n\r\n if (this.view_is(VIEW_MODE.WEEK)) {\r\n rem = dx % (this.options.column_width / 7);\r\n position =\r\n odx -\r\n rem +\r\n (rem < this.options.column_width / 14\r\n ? 0\r\n : this.options.column_width / 7);\r\n } else if (this.view_is(VIEW_MODE.MONTH)) {\r\n rem = dx % (this.options.column_width / 30);\r\n position =\r\n odx -\r\n rem +\r\n (rem < this.options.column_width / 60\r\n ? 0\r\n : this.options.column_width / 30);\r\n } else {\r\n rem = dx % this.options.column_width;\r\n position =\r\n odx -\r\n rem +\r\n (rem < this.options.column_width / 2\r\n ? 0\r\n : this.options.column_width);\r\n }\r\n return position;\r\n }\r\n\r\n unselect_all() {\r\n [...this.$svg.querySelectorAll('.bar-wrapper')].forEach((el) => {\r\n el.classList.remove('active');\r\n });\r\n }\r\n\r\n view_is(modes) {\r\n if (typeof modes === 'string') {\r\n return this.options.view_mode === modes;\r\n }\r\n\r\n if (Array.isArray(modes)) {\r\n return modes.some((mode) => this.options.view_mode === mode);\r\n }\r\n\r\n return false;\r\n }\r\n\r\n get_task(id) {\r\n return this.tasks.find((task) => {\r\n return task.id === id;\r\n });\r\n }\r\n\r\n get_bar(id) {\r\n return this.bars.find((bar) => {\r\n return bar.task.id === id;\r\n });\r\n }\r\n\r\n show_popup(options) {\r\n if (!this.popup) {\r\n this.popup = new Popup(\r\n this.popup_wrapper,\r\n this.options.custom_popup_html\r\n );\r\n }\r\n this.popup.show(options);\r\n }\r\n\r\n hide_popup() {\r\n this.popup && this.popup.hide();\r\n }\r\n\r\n trigger_event(event, args) {\r\n if (this.options['on_' + event]) {\r\n this.options['on_' + event].apply(null, args);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the oldest starting date from the list of tasks\r\n *\r\n * @returns Date\r\n * @memberof Gantt\r\n */\r\n get_oldest_starting_date() {\r\n return this.tasks\r\n .map((task) => task._start)\r\n .reduce((prev_date, cur_date) =>\r\n cur_date <= prev_date ? cur_date : prev_date\r\n );\r\n }\r\n\r\n /**\r\n * Clear all elements from the parent svg element\r\n *\r\n * @memberof Gantt\r\n */\r\n clear() {\r\n this.$svg.innerHTML = '';\r\n }\r\n}\r\n\r\nGantt.VIEW_MODE = VIEW_MODE;\r\n\r\nfunction generate_id(task) {\r\n return task.name + '_' + Math.random().toString(36).slice(2, 12);\r\n}\r\n"],"names":["YEAR","MONTH","DAY","HOUR","MINUTE","SECOND","MILLISECOND","date_utils","parse","date","date_separator","time_separator","Date","date_parts","time_parts","parts","split","map","val","parseInt","vals","length","parseFloat","concat","to_string","with_time","TypeError","this","get_date_values","i","padStart","date_string","time_string","format","format_string","lang","month_name","Intl","DateTimeFormat","month","month_name_capitalized","charAt","toUpperCase","slice","values","d","format_map","YYYY","MM","DD","HH","mm","ss","SSS","D","MMMM","MMM","str","formatted_values","Object","keys","sort","a","b","forEach","key","includes","replace","push","value","diff","date_a","date_b","scale","milliseconds","seconds","hours","minutes","days","months","years","endsWith","Math","floor","today","now","add","qty","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","start_of","scores","should_reset","_scale","clone","get_days_in_month","no_of_days","year","targetLength","padString","String","repeat","$","expr","con","document","querySelector","createSVG","tag","attrs","elem","createElementNS","attr","append_to","appendChild","innerHTML","setAttribute","animateSVG","svgElement","from","to","animatedSvgElement","dur","begin","animEl","attributeName","animateElement","calcMode","keyTimes","keySplines","cubic_bezier","getAnimationElement","event","createEvent","initEvent","eventName","dispatchEvent","name","ease","linear","on","element","selector","callback","delegate","bind","off","handler","removeEventListener","addEventListener","e","delegatedTarget","target","closest","call","matches","parentNode","getAttribute","style","Bar","constructor","gantt","task","set_defaults","prepare","draw","action_completed","prepare_values","prepare_helpers","invalid","height","options","bar_height","x","compute_x","y","compute_y","corner_radius","bar_corner_radius","duration","_end","_start","step","width","column_width","progress_width","progress","group","class","custom_class","id","bar_group","handle_group","SVGElement","prototype","getX","getY","getWidth","getHeight","getEndX","draw_bar","draw_progress_bar","draw_label","draw_resize_handles","$bar","rx","ry","classList","$bar_progress","requestAnimationFrame","update_label_position","bar","$handle_progress","points","get_progress_polygon_points","join","bar_progress","setup_click_event","popup_trigger","show_popup","unselect_all","trigger_event","bar_being_dragged","subtitle","language","target_element","title","handle_selected","update_bar_position","update_attr","update_handle_position","update_progressbar_position","update_arrow_position","date_changed","changed","new_start_date","new_end_date","compute_start_end_date","Number","progress_changed","new_progress","compute_progress","set_action_completed","setTimeout","x_in_units","gantt_start","width_in_units","task_start","view_is","header_height","padding","_index","get_snap_position","dx","rem","position","odx","isNaN","label","getBBox","remove","handle","arrows","arrow","update","Arrow","from_task","to_task","calculate_path","start_x","condition","start_y","end_x","end_y","from_is_below_to","curve","arrow_curve","clockwise","curve_y","offset","path","down_1","down_2","left","Popup","parent","custom_html","make","hide","pointer","show","Error","html","clientWidth","position_meta","HTMLElement","getBoundingClientRect","top","transform","opacity","Table","dragStartY","columns","console","log","table","draw_table_header","$thead","createElement","$tr","column","$th","textContent","get_parentNode","tagName","draw_table_body","tasks","setGroupPosition","$tbody","make_table_row","row","append","contains","bind_draggable_event","isRowLine","find","t","groupPosition","index","deps","level","$td","data","render","className","type","closed","$ins","parentId","child_node","text","createTextNode","get_drag_after_element","container","querySelectorAll","reduce","child","box","NEGATIVE_INFINITY","find_task_item","preventDefault","clientY","draggableEl","afterElement","insertBefore","async","targetItem","dragItem","afterItem","params","c_id","ref","c_position","p_position","p_parentId","arr","filter","draggble_rerender","Split","wrapper","draw_split_bar","$split_bar","mouseMoveHandler","$table","previousElementSibling","$gantt","nextSibling","clientX","max","min","offsetLeft","mouseUpHandler","prepend","VIEW_MODE","QUARTER_DAY","HALF_DAY","WEEK","Gantt","contents","originTasks","setup_options","setup_tasks","setup_wrapper","change_view_mode","setup_split_bar","setup_table","bind_events","svg_element","wrapper_element","$svg","$wrapper","$container","parent_element","parentElement","setup_mode_handler","popup_wrapper","excel_export","btn_group","innerText","float","btn","view_mode","childNodes","default_options","view_modes","date_format","custom_popup_html","assign","sort_tasks","start","end","every","dependencies","trim","random","toString","generate_id","setup_dependencies","dependency_map","refresh","rerender_table","mode","update_view_scale","setup_dates","setup_gantt_dates","setup_date_values","gantt_end","dates","cur_date","bind_grid_click","bind_bar_events","bind_scroll_event","clear","setup_layers","make_grid","make_grid_header","make_dates","make_bars","make_arrows","map_arrows_on_bars","set_width","set_scroll_position","$table_body","bind_table_event","item","update_origin_tasks","sorted_tasks","children_idx_info","taskIdx","hasOwnProperty","parentIdx","findIndex","splice","acc","cur","update_dependecies","wbs","layers","layer","make_table","dataset","get_task","$target","$table_container","$table_header","make_grid_background","make_grid_rows","make_grid_ticks","make_grid_highlights","$grid_row","Array","toggle","grid_width","grid_height","grid","rows_layer","row_width","row_height","row_y","header_width","pageScroll","window","scrollY","originOffset","header","tick_x","tick_y","tick_height","tick_class","get_dates_to_draw","lower_x","lower_y","lower_text","upper_text","$upper_text","upper_x","upper_y","x2","last_date","get_date_info","date_text","Day_lower","Week_lower","Month_lower","Year_lower","Day_upper","Week_upper","Month_upper","Year_upper","base_pos","x_pos","bars","task_id","dependency","Boolean","cur_width","actual_width","scroll_pos","get_oldest_starting_date","scrollLeft","ticking","passive","hide_popup","is_dragging","x_on_start","y_on_start","is_resizing_left","is_resizing_right","parent_bar_id","bar_wrapper","offsetX","offsetY","get_bar","ox","oy","owidth","finaldx","bind_bar_progress","is_resizing","min_dx","max_dx","$handle","get_all_dependent_tasks","out","to_process","curr","el","modes","isArray","some","popup","args","apply","prev_date"],"mappings":"kCAAA,MAAMA,EAAO,OACPC,EAAQ,QACRC,EAAM,MACNC,EAAO,OACPC,EAAS,SACTC,EAAS,SACTC,EAAc,cAEL,IAAAC,EAAA,CACX,KAAAC,CAAMC,EAAMC,EAAiB,IAAKC,EAAiB,QAC/C,GAAIF,aAAgBG,KAChB,OAAOH,EAEX,GAAoB,iBAATA,EAAmB,CAC1B,IAAII,EAAYC,EAChB,MAAMC,EAAQN,EAAKO,MAAM,KAEzBH,EAAaE,EAAM,GACdC,MAAMN,GACNO,KAAKC,GAAQC,SAASD,EAAK,MAChCJ,EAAaC,EAAM,IAAMA,EAAM,GAAGC,MAAML,GAGxCE,EAAW,GAAKA,EAAW,GAAK,EAEhC,IAAIO,EAAOP,EAUX,OARIC,GAAcA,EAAWO,SACA,GAArBP,EAAWO,SACXP,EAAW,GAAK,KAAOA,EAAW,GAClCA,EAAW,GAAiC,IAA5BQ,WAAWR,EAAW,KAE1CM,EAAOA,EAAKG,OAAOT,IAGhB,IAAIF,QAAQQ,EACtB,CACJ,EAED,SAAAI,CAAUf,EAAMgB,GAAY,GACxB,KAAMhB,aAAgBG,MAClB,MAAM,IA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