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