UNPKG

smart-webcomponents-angular

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

6 lines (4 loc) 247 kB
/* Smart UI v20.0.2 (2024-09-06) Copyright (c) 2011-2024 jQWidgets. License: https://htmlelements.com/license/ */ // Smart("smart-gantt-chart",class extends Smart.ScrollViewer{static get properties(){return{adjustToNonworkingTime:{value:!1,type:"boolean"},autoSchedule:{value:!1,type:"boolean"},autoScheduleStrictMode:{value:!1,type:"boolean"},autoScrollStep:{value:5,type:"number"},columnMenu:{value:!1,type:"boolean"},columnMinWidth:{value:"50px",type:"any"},columnResize:{value:!1,type:"boolean"},columnResizeFeedback:{value:!1,type:"boolean"},currentTime:{value:new Date,type:"any",validator:"_dateValidator"},currentTimeIndicator:{value:!1,type:"boolean"},currentTimeIndicatorInterval:{value:1,validator:"_currentTimeIndicatorIntervalValidator",type:"number"},dataExport:{value:{exportFiltered:{value:!1,type:"boolean"},itemType:{value:"task",type:"string"},fileName:{value:"smartGanttChart",type:"string?"}},type:"object"},dataSource:{value:[],type:"any",reflectToAttribute:!1},dateEnd:{value:"",type:"any",validator:"_dateValidator"},dateStart:{value:"",type:"any",validator:"_dateValidator"},dateMarkers:{value:[],reflectToAttribute:!1,type:"array"},dayFormat:{value:"short",allowedValues:["2-digit","numeric","long","short","narrow"],type:"string"},dayScale:{value:"hour",allowedValues:["hour","halfHour","quarterHour"],type:"string"},disableAutoScroll:{value:!1,type:"boolean"},disableTaskDrag:{value:!1,type:"boolean"},disableTaskProgressChange:{value:!1,type:"boolean"},disableTaskResize:{value:!1,type:"boolean"},disableSelection:{value:!1,type:"boolean"},disableSegmentDrag:{value:!1,type:"boolean"},disableSegmentResize:{value:!1,type:"boolean"},disableWindowEditor:{value:!1,type:"boolean"},durationUnit:{value:"milisecond",allowedValues:["day","week","hour","minute","second","milisecond"],type:"string"},filterRow:{value:!1,type:"boolean"},firstDayOfWeek:{value:-1,type:"number"},groupByResources:{value:!1,type:"boolean"},headerTemplate:{value:null,type:"any"},hourFormat:{value:"default",allowedValues:["default","2-digit","numeric"],type:"string"},hideDateMarkers:{value:!1,type:"boolean"},hideTimelineHeaderDetails:{value:!1,type:"boolean"},hideTimelineSecondHeaderDetails:{value:!0,type:"boolean"},hideTimelineHeader:{value:!1,type:"boolean"},hideResourcePanel:{value:!1,type:"boolean"},showSelectionColumn:{value:!1,type:"boolean"},infiniteTimeline:{value:!1,type:"boolean"},infiniteTimelineStep:{value:5,type:"number"},inverted:{value:!1,type:"boolean"},keyboardNavigation:{value:!1,type:"boolean"},messages:{extend:!0,value:{en:{duplicateIds:"{{elementType}}: DataSource contains duplicate ids. Tasks should have unique ids. The following ids are duplicating: {{duplicates}}.",invalidNonworkingRange:"{{elementType}}: Invalid {{property}} value. {{property}} should not contain all possible days/hours because it will result in an endless timeline. The value has been validated by removing the last item from the new value range.",invalidValue:"{{elementType}}: Invalid {{property}} value. {{property}} should be of type {{typeOne}} or {{typeTwo}}.",incorrectArgument:"{{elementType}}: Incorrect argument {{argumentName}} in method {{methodName}}.",outOfBounds:"{{elementType}}: Out of bounds argument {{argumentName}} in method {{methodName}}.",missingReference:"{{elementType}}: Missing reference to {{file}} in method {{methodName}}.",alreadyExists:"{{elementType}}: The item already exists when calling the {{methodName}} method.",notExisting:"{{elementType}}: The item does not exists when calling the {{methodName}} method.",notAProject:"{{elementType}}: The {{argumentName}} argument in {{methodName}} method does not reference an item of type 'project'.",noId:"smartGanttChart requires an id in order to save/load/clear a state.",ok:"Ok",add:"Add",remove:"Remove",cancel:"Cancel",delete:"Delete",confirm:"{{componentName}} will be deleted permanently, <b>are you sure? </b>",taskColumnLabel:"Task Name",resourceColumnLabel:"Resource Name",deleteLink:"Delete link",unassigned:"Unassigned",generalTab:"General",dependencyTab:"Dependency",segmentsTab:"Segments",segment:"Segment",dependencyValidation:"*The Task cannot be connected to itself.",segmentsCountValidation:"*Segmented Tasks must have at least 2 segments. ",segmentConflictError:'*The Segment "{{label}}" is in conflict, because it starts on/before and ends on/after the {{dateConflict}} of Segment "{{conflictLabel}}." ',segmentStartError:'*The Segment "{{label}}" cannot start before it ends and cannot end before it starts.',segmentEndError:'*The Segment "{{label}}" cannot start when it ends.',segmentRangeError:'*The Segment "{{label}}" is out of Task date range. The first segment must start when the task starts and the last segment must end when the task ends.',label:"Label",duration:"Duration",dateStart:"Date Start",dateEnd:"Date End",id:"Id",name:"Name",type:"Type",lag:"Lag",startToStart:"Start-To-Start",endToStart:"End-To-Start",endToEnd:"End-To-End",startToEnd:"Start-To-End",overdue:"Overdue",weeks:"week(s)",days:"day(s)",hours:"hour(s)",minutes:"minute(s)",seconds:"second(s)",miliseconds:"milisecond(s)",task:"Task",resource:"Resource",assignments:"Assignments",startTask:"Task Start",endTask:"Task End",deadline:"Deadline",quarter:"Quarter",quarterShort:"Q"}},type:"object"},monthFormat:{value:"short",allowedValues:["2-digit","numeric","long","short","narrow"],type:"string"},monthScale:{value:"week",allowedValues:["day","week"],type:"string"},max:{value:new Date(2100,0,1),type:"any",validator:"_dateValidator"},min:{value:new Date(1900,0,1),type:"any",validator:"_dateValidator"},nonworkingDays:{value:[],type:"array",validator:"_nonworkingDayValidator"},nonworkingHours:{value:[],type:"array",validator:"_nonworkingTimeValidator"},onTaskRender:{value:null,reflectToAttribute:!1,type:"function?"},popupWindowCustomizationFunction:{value:null,reflectToAttribute:!1,type:"function?"},popupWindowTabs:{value:["general","dependency","segments"],reflectToAttribute:!1,type:"array"},progressLabelFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},resizeHandlesVisibility:{allowedValues:["auto","hidden","visible"],value:"auto",type:"string"},quarterFormat:{value:"short",allowedValues:["long","short","numeric"],type:"string"},resourceColumns:{value:[{label:"resourceColumnLabel",value:"label"}],type:"array",reflectToAttribute:!1},resourceFiltering:{value:!1,type:"boolean"},resourceGroupFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},resourcePanelHeaderTemplate:{value:null,type:"any"},resourcePanelMin:{value:100,type:"any"},resourcePanelSize:{value:"",type:"any"},resourcePanelRefreshRate:{value:0,reflectToAttribute:!1,type:"number"},resourceTimelineFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},resourceTimelineMode:{allowedValues:["diagram","histogram","custom"],value:"diagram",type:"string"},resourceTimelineView:{allowedValues:["hours","tasks","custom"],value:"hours",type:"string"},selectionMode:{value:"many",type:"string",allowedValues:["one","many","extended"]},selectedTaskIds:{value:[],type:"array"},selectedResourceIds:{value:[],type:"array"},shadeUntilCurrentTime:{value:!1,type:"boolean"},showBaseline:{value:!1,type:"boolean"},showProgressLabel:{value:!1,type:"boolean"},snapToNearest:{value:!1,type:"boolean"},sortFunction:{value:null,type:"function?",reflectToAttribute:!1},sortMode:{value:"none",allowedValues:["none","one","many"],type:"string"},taskColumns:{value:[{label:"taskColumnLabel",value:"label"}],type:"array",reflectToAttribute:!1},taskFiltering:{value:!1,type:"boolean"},taskPanelMin:{value:200,type:"any"},taskPanelSize:{value:"",type:"any"},timelineHeaderFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},timelineMin:{value:200,type:"any"},treeMin:{value:100,type:"any"},treeSize:{value:"20%",type:"any"},tooltip:{value:{enabled:{value:!1,type:"boolean"},arrow:{value:!1,type:"boolean"},delay:{value:50,type:"number"},offset:{value:[0,5],type:"array"}},type:"object"},taskFormatFunction:{type:"any",value:null},tooltipFormatFunction:{value:null,type:"any"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},view:{value:"year",allowedValues:["day","week","month","quarter","year"],type:"any"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"},weekFormat:{value:"long",allowedValues:["long","numeric"],type:"string"}}}template(){return'<div id="container" role="presentation">\n <smart-splitter id="mainSplitter" auto-fit-mode="end" keep-proportions-on-resize right-to-left="[[rightToLeft]]" animation="[[animation]]" orientation="horizontal">\n <smart-splitter-item id="taskSplitterItem" class="smart-task-splitter-item">\n <div id="taskSplitterItemHeader" class="smart-task-panel-header"></div>\n <smart-splitter id="taskSplitter" class="smart-task-splitter" auto-fit-mode="end">\n <smart-splitter-item id="tableSplitterItem">\n <smart-table right-to-left="[[rightToLeft]]" wait id="taskTable" class="smart-task-table" virtualization animation="none" deferred-scroll-delay="0" ></smart-table>\n </smart-splitter-item>\n <smart-splitter-item id="timelineSplitterItem" class="smart-timeline-splitter-item">\n <div id="timeline" class="smart-timeline">\n <div id="timelineHeader" class="smart-timeline-header" role="rowgroup">\n <div id="timelineHeaderContent" class="smart-timeline-header-content">\n <div class="smart-timeline-view-details" id="timelineViewDetails" role="row"></div>\n <div class="smart-timeline-view-details smart-hidden" id="timelineViewSubDetails" role="row"></div>\n <div class="smart-timeline-view-cells" id="timelineViewCells" role="row"></div>\n </div>\n </div>\n <div id="taskTimelineContainer" class="smart-timeline-content-container">\n <div id="timelineContent" class="smart-timeline-content">\n <div id="taskTimelineCellsContainer" class="smart-timeline-cells-container" aria-hidden="true"></div>\n <div id="taskIndicatorsContainer" class="smart-timeline-indicators-container" role="group"></div>\n <div id="timelineConnectionsContainer" class="smart-timeline-connections-container" role="group"></div>\n <div id="timelineBaselinesContainer" class="smart-timeline-baselines-container" role="group"></div>\n <div id="timelineTasksContainer" class="smart-timeline-tasks-container" role="group"></div>\n <div id="timelineMarkers" class="smart-timeline-markers-container" role="group"></div>\n <div id="timelineDeadlines" class="smart-timeline-deadlines-container" role="group"></div>\n </div>\n </div>\n </div>\n <smart-scroll-bar id="verticalScrollBar" class="smart-timeline-scroll-bar" orientation="vertical"\n right-to-left="[[rightToLeft]]" aria-controls="[[id]]">\n </smart-scroll-bar>\n </smart-splitter-item>\n </smart-splitter>\n </smart-splitter-item>\n </smart-splitter>\n <smart-scroll-bar wait id="horizontalScrollBar" class="smart-timeline-scroll-bar"></smart-scroll-bar>\n </div>'}static get listeners(){return{down:"_downHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.dragstart":"_dragStartHandler","container.wheel":"_mouseWheelHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","verticalScrollBar.change":"_verticalScrollbarHandler","resourceVerticalScrollBar.change":"_verticalScrollbarHandler","mainSplitter.resizeEnd":"_resizeEventHandler","mainSplitter.resize":"_resizeEventHandler",move:"_moveHandler","mainSplitter.change":"_tableChangeHandler","mainSplitter.filter":"_tableSortFilterHandler","mainSplitter.sort":"_tableSortFilterHandler","mainSplitter.columnResize":"_tableColumnResizeHandler","taskTable.group":"_taskTableGroupEventHandler","taskTable.collapse":"_taskTableExpandHandler","taskTable.expand":"_taskTableExpandHandler","taskTable.keydown":"_taskTableKeyDownHandler"}}static get styleUrls(){return["smart.ganttchart.css"]}attached(){const e=this;if(super.attached(),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.taskSplitterItem,e.$.horizontalScrollBar,e.$.verticalScrollBar)),!e._resourceScrollView&&e.$.mainSplitter.contains(e.$.resourceSplitter)&&(e._resourceScrollView=new Smart.Utilities.Scroll(e.$.resourceSplitterItem,e.$.horizontalScrollBar,e.$.resourceVerticalScrollBar)),e.scrollLeft){const t=e._getScrollLeft(e.scrollLeft);e.$.timelineHeader.scrollLeft=e.$.taskTimelineContainer.scrollLeft=t,e.$.mainSplitter.contains(e.$.resourceTimelineHeader)&&(e.$.resourceTimelineHeader.scrollLeft=e.$.resourceTimelineContent.scrollLeft=t)}if(e.scrollTop){const t=e.scrollTop;e.$.taskTimelineContainer.scrollTop=t,e.$.timelineContent.scrollTop=t,e.$.mainSplitter.contains(e.$.resourceTimelineHeader)&&(e.$.resourceTimelineContent.scrollTop=t)}const t=["taskPopupWindow","connectionPopupWindow","confirmPopupWindow"];for(let i=0;i<t.length;i++){const a=t[i];if(e.$[a]&&e.$[a].opened){const t=e["$"+a];e._handleModal(!0),t.listen("close",e._popupWindowCloseHandler.bind(e)),t.listen("closing",e._popupWindowClosingHandler.bind(e)),t.listen("open",e._popupWindowOpenHandler.bind(e)),t.listen("click",e._popupWindowClickHandler.bind(e)),t.listen("change",e._popupWindowChangeHandler.bind(e)),t.listen("transitionend",e._popupWindowTransitionendHandler.bind(e)),e.getShadowRootOrBody().appendChild(e.$[a])}}e._handleTooltipEvents(!0),e._currentTimeIndicatorInterval||!e.currentTimeIndicator&&!e.shadeUntilCurrentTime||e._setCurrentTimeIndicators()}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._resourceScrollView&&(e._resourceScrollView.unlisten(),delete e._resourceScrollView);const t=["taskPopupWindow","connectionPopupWindow","confirmPopupWindow"];e._handleModal();for(let i=0;i<t.length;i++){const a=t[i],n=e["$"+a];e.$[a]&&e.$[a].remove(),n&&(n.unlisten("open"),n.unlisten("close"),n.unlisten("closing"),n.unlisten("click"),n.unlisten("change"),n.unlisten("transitionend"))}e.$.tooltip&&(e.$.tooltip.remove(),delete e.$.tooltip),e._handleTooltipEvents(),clearInterval(e._currentTimeIndicatorInterval),delete e._currentTimeIndicatorInterval}propertyChangedHandler(e,t,i){const a=this;switch(e){case"adjustToNonworkingTime":for(let e=0;e<a._tasks.length;e++){const t=a._tasks[e],i=t.$.project;a._validateTaskDates(t,i),a._validateTaskSegments(t),a._synchronizeProjectDates(t,i),a._refreshTableColumnsData(t,["dateEnd","duration"])}a._refreshTimeline();break;case"animation":break;case"autoSchedule":i?a._autoSchedule():a._autoScheduleRestore();break;case"autoScheduleStrictMode":i&&(a._autoSchedule(),a._refreshTimeline());break;case"columnMinWidth":case"columnResizeFeedback":case"columnResize":{const t=a.$.taskTable,n=a.$.resourceTable;t[e]=i,n&&(n[e]=i);break}case"currentTimeIndicator":case"shadeUntilCurrentTime":a._setCurrentTimeIndicators();break;case"dataSource":if(a.scrollLeft=a.scrollTop=0,a._createTasks(),a._refreshTableDataSource(),a._createTimeline(),a._createResourceTimeline(),a._setAriaControls(),a.snapToNearest){for(let e=0;e<a._tasks.length;e++){const t=a._tasks[e],i=t.$.project;a._validateTaskDates(t,i),a._validateTaskSegments(t),a._synchronizeProjectDates(t,i),a._refreshTableColumnsData(t,["dateEnd","duration"])}a._refreshTimeline()}break;case"dateMarkers":a._createDateMarkers();break;case"hideDateMarkers":a._recycleDateMarkers();break;case"selectionMode":{const e=a.$.taskTable,t=a.$.resourceTable;e&&(e.selectionMode=a.selectionMode),t&&(t.selectionMode=a.selectionMode);break}case"disableSelection":{const e=a.$.taskTable,t=a.$.resourceTable;e&&(e.selection=!a.disableSelection),t&&(t.selection=!a.disableSelection);break}case"durationUnit":for(let e=0;e<a._tasks.length;e++){const t=a._tasks[e],i=t.$.project;a._validateTaskDuration(t),a._validateTaskDates(t,i),a._validateTaskSegments(t),a._synchronizeProjectDates(t,i)}a._createTimelineCells(),a._insertTimelineTasks(),a.taskColumns.some((e=>(e.value+"").toLowerCase().indexOf("duration")>-1))&&a._refreshTableDataSource();break;case"filterRow":a.$.taskTable[e]=i;break;case"groupByResources":a._setTable(a.$.taskTable),a._createTimelineContent(),a._recycleTimelineTasks(),a._refresh();break;case"infiniteTimeline":i?a._scrollView.hScrollBar.value===a._scrollView.hScrollBar.max&&a._handleInfiniteTimeline():a.set("dateEnd","");break;case"keyboardNavigation":a.$.taskTable[e]=i,a.$.resourceTable&&(a.$.resourceTable[e]=i);break;case"popupWindowTabs":case"popupWindowCustomizationFunction":{const e=a.$.taskPopupWindow;e&&(e.opened&&(e.close(),delete e._target),e.clear());break}case"taskFiltering":a.$.taskTable.filtering=i,a._refresh();break;case"resourceFiltering":{const e=a.$.resourceTable;e&&(e.filtering=i,a._refresh());break}case"tooltip_enabled":{const e=a.$.tooltip;e&&(i||e.remove(),a._handleTooltipEvents(i));break}case"tooltip_arrow":case"tooltip_delay":case"tooltip_offset":{const t=a.$.tooltip;t&&(t[e.replace("tooltip_","")]=i);break}case"headerTemplate":a._handleHeaderTemplate();break;case"inverted":if(a._handleInverted(),a.scrollLeft){const e=a._getScrollLeft(a.scrollLeft);a.$.timelineHeader.scrollLeft=a.$.taskTimelineContainer.scrollLeft=e,a.$.mainSplitter.contains(a.$.resourceTimelineHeader)&&(a.$.resourceTimelineHeader.scrollLeft=a.$.resourceTimelineContent.scrollLeft=e)}break;case"rightToLeft":Array.from(a.querySelectorAll("smart-splitter, smart-table, smart-scroll-bar")).forEach((t=>t[e]=i)),a.closeWindow(),a._handleInverted(),a._refreshTimeline();break;case"firstDayOfWeek":case"dateStart":case"dateEnd":a._refreshTimeline();break;case"messages":case"locale":case"dayFormat":case"hourFormat":case"timelineHeaderFormatFunction":case"monthFormat":case"yearFormat":a._refreshHeaderDate(!0),a._refreshColumnsHeaders(),a._recycleResourceHeaderCells();break;case"hideResourcePanel":a._createResourceTimeline(),a._refreshTimeline();break;case"nonworkingDays":case"nonworkingHours":a._refreshAfterWorkingTimeChange();break;case"selectedTaskIds":a.$.taskTable.selected=a._getSelection("task",i);break;case"selectedResourceIds":a.$.resourceTable&&(a.$.resourceTable.selected=a._getSelection("resource",i));break;case"resourceColumns":a._setTable(a.$.resourceTable),a._highlightAssignedItem("task",a._getSelection("task",a.selectedTaskIds));break;case"resourcePanelHeaderTemplate":a._handleHeaderTemplate("resource");break;case"resourceTimelineView":case"resourceTimelineMode":case"resourceTimelineFormatFunction":a.$.mainSplitter.contains(a.$.resourceSplitter)&&a._resources.forEach((e=>a._refreshResourceTimelineContent(e)));break;case"showProgressLabel":case"progressLabelFormatFunction":a._tasks.forEach((e=>a._setTaskBarProgress(e)));break;case"sortFunction":a.$.taskTable.sort=i,a.$.resourceTable&&(a.$.resourceTable.sort=i);break;case"showSelectionColumn":a.$.taskTable.hideSelectionColumn=!i,a.$.resourceTable&&(a.$.resourceTable.hideSelectionColumn=!i);break;case"columnMenu":case"hideSelectionColumn":case"sortMode":a.$.taskTable[e]=i,a.$.resourceTable&&(a.$.resourceTable[e]=i);break;case"taskColumns":a._setTable(a.$.taskTable);break;case"timelineMin":a.$.timelineSplitterItem.min=i,a.$.taskSplitter.refresh(),a.$.mainSplitter.contains(a.$.resourceSplitter)&&a._synchronizeSplitters(a.$.taskSplitter,a.$.resourceSplitter);break;case"treeMin":case"treeSize":{const t=e.toLowerCase().indexOf("size")>-1?"size":"min";a.$.tableSplitterItem[t]=i,a.$.taskSplitter.refresh(),a.$.mainSplitter.contains(a.$.resourceSplitter)&&a._synchronizeSplitters(a.$.taskSplitter,a.$.resourceSplitter);break}case"taskPanelMin":case"taskPanelSize":case"resourcePanelSize":case"resourcePanelMin":{const t=e.indexOf("Min")>-1?"min":"size",n=e.indexOf("resource")>-1?"resource":"task";a.$.mainSplitter.contains(a.$.resourceSplitter)&&(a.$[`${n}SplitterItem`][t]=i,a.$.taskSplitterItem._setSize("size",a.taskPanelSize),a.refresh());break}case"unfocusable":a._setFocusable();break;case"monthScale":case"dayScale":case"view":a._refreshTimeline(t);break;default:super.propertyChangedHandler(e,t,i)}}_predefPropertyGetter(e){const t=this;Object.defineProperty(t,e,{get:function(){switch(e){case"dataSource":{if(t.context===t)return t.properties[e].value;const i=function(e){if(!e.length)return e;for(let a=0;a<e.length;a++){const n=e[a];let s=t._getProjectTasks(n);s&&Array.isArray(s)&&(s=i(s.filter((e=>e.$&&e.$.project===n)))),e[a]=t._cloneObject(n),s&&s.length?e[a].tasks=s:delete e[a].tasks}return e},a=t.properties[e].value;return a instanceof Smart.DataAdapter?a:i(a.slice(0))}case"dateStart":case"dateEnd":{const i=t._timelineCells;if(i.length){const a=t._getCellDateRange({_date:i["dateStart"===e?0:i.length-1].date});return new Date(a[e])}return t.properties[e].value}default:return t.properties[e].value}},set(i){t.updateProperty(t,t._properties[e],i)}})}ready(){this._customScrollView=!0,super.ready()}render(){const e=this,t=window.getComputedStyle(e),i=Smart.Utilities.Core;e._isMobile=i.isMobile,e._isFirefox=i.Firefox,e._taskBarMinWidth=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-task-min-width"))||0,e._taskDefaultHeight=parseFloat(t.getPropertyValue("--smart-gantt-chart-task-default-height"))||30,e._timelineCellSize=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-cell-size"))||0,e._timelineCellMinSize=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-cell-min-size"))||0,e._taskConnectionWidth=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-task-connection-width"))||1,e._baselineProportion=parseFloat(t.getPropertyValue("--smart-gantt-chart-baseline-proportion"))||0,e._predefPropertyGetter("dataSource"),e._predefPropertyGetter("dateStart"),e._predefPropertyGetter("dateEnd"),e.$.tableSplitterItem.size=e.treeSize,e.$.tableSplitterItem.min=e.treeMin,e.$.timelineSplitterItem.min=e.timelineMin,e._setScrollBars(),e._handleHeaderTemplate(),e._handleInverted(!0),e._createTasks(),e._setTable(),e._createTimeline(),e._createResourceTimeline(),e._setAriaControls(),e._setFocusable(),e.checkLicense(),(e.shadowRoot||e._isFirefox)&&requestAnimationFrame((()=>e.refresh())),super.render()}refresh(e){const t=this;if(e)return t._refreshTimeline(),t._setTable(t.$.taskTable),void t._createResourceTimeline();t.isRendered&&t._resizeEventHandler()}addFilter(e,t){const i=this;if(!i.taskFiltering&&!i.resourceFiltering||!(t instanceof Smart.Utilities.FilterGroup))return;Array.isArray(e)||(e="object"==typeof e?[e]:[]);const a=i.taskColumns,n=i.resourceColumns,s=i.$.taskTable,r=i.$.resourceTable;for(let i=0;i<e.length;i++){const o=e[i],l=o.type,[d,c]="resource"===l||n.includes(o)?[r,n]:[s,a],m=c.find((e=>o.value&&e.value===o.value));m&&d.addFilter(m.value,t)}}clearSelection(){this._unselectAll("task"),this._unselectAll("resource")}static get requires(){return{"Smart.Splitter":"smart.splitter.js","Smart.Tree":"smart.tree.js","Smart.Window":"smart.window.js"}}ensureVisible(e,t="task"){const i=this,a=i._getValidItemAndIndex(e,t);(e=a?a.item:void 0)&&(i._ensureVisible(e,t),i._scrollTo(e.dateStart,!0))}removeAllConnections(){const e=this;e.isCompleted&&(e.$.timelineConnectionsContainer.innerHTML="",e._connections=[],e._tasks.map((e=>e.connections=[])))}removeConnection(){const e=this,t=Array.from(arguments).filter((e=>void 0!==e));if(!e.isCompleted)return;let i;if(1===t.length){if("string"==typeof t[0]){const e=document.getElementById(t[0]);e&&(i=e.getAttribute("connection-id"))}i||(i=(t[0]+"").split("-"),i=e._getValidConnectionId(i[0],i[1],i[2],"removeConnection"))}else 3===t.length&&(i=e._getValidConnectionId(t[0],t[1],t[2],"removeConnection"));i&&(e._removeConnection(i),e.$.fireEvent("itemRemove",{type:"connection",id:`${i[0]}-${i[1]}-${i[2]}`,item:{source:i[0],target:i[1],type:i[2]}}))}removeTaskConnection(e,t){const i=this;if(!i.isCompleted)return;if((e+="").indexOf("-")>-1&&!t){const i=e.split("-");t=i[1],e=i[0]}const a=i._getValidItemAndIndex(e),n=i._getValidItemAndIndex(t);e=a?a.index:void 0,t=n?n.index:void 0,isNaN(e)?i.error(i.localize("incorrectArgument",{elementType:i.nodeName.toLowerCase(),methodName:"removeTaskConnection",argumentName:"taskEndIndex"})):i._removeConnection(""+e+(isNaN(t)?"":t))}beginUpdate(){this._isUpdating={started:!0,type:{}},this.$.fireEvent("beginUpdate")}endUpdate(){const e=this;function t(){e._refreshTableDataSource(),e._createTimelineContent(),e._recycleTimelineTasks(),e._setAriaControls();const t=e._resources;for(let i=0;i<t.length;i++)e._refreshTableColumnsData(t[i],void 0,"resource")}function i(){if(e.hideResourcePanel)return;e._refreshTableDataSource("resource"),e._recycleResourceHeaderCells(),e._createResourceTimelineContent(),e._refresh();const t=e._tasks;for(let i=0;i<t.length;i++)e._refreshTableColumnsData(t[i])}if(!e._isUpdating)return;const a=1===Object.keys(e._isUpdating.type).length?Object.keys(e._isUpdating.type)[0]:void 0;let n,s;switch(e._selected&&({task:n,resource:s}=e._selected),delete e._isUpdating,a){case"task":t();break;case"resource":i();break;default:t(),i()}n&&(e._refreshSelectedItems("task",n),e.$.taskTable.selected=e._getSelection("task",e.selectedTaskIds)),s&&(e._refreshSelectedItems("resource",s),e.$.resourceTable.selected=e._getSelection("resource",e.selectedResourceIds)),e.$.fireEvent("endUpdate")}clearFilters(e){this._resetFromAction(e,"clearFilters")}clearSort(e){const t=this;"task"!==e&&"resource"!==e?(t._resetFromAction("task","clearSort"),t._resetFromAction("resource","clearSort")):t._resetFromAction(e,"clearSort")}clearTasks(){this._clearTasks()}_clearTasks(){const e=this;e._selected&&delete e._selected.task,e.set("selectedTaskIds",[]),e._tasks=[],e._timelineCells=[],e._timelineVCells=[],e._timelineHeaderCells=[],e.$.timelineContent.style.width="",e.$.container.style.removeProperty("--smart-gantt-chart-task-timeline-content-height"),e.$.timelineViewDetails.innerHTML="",e.$.timelineViewCells.innerHTML="",e.$.taskTimelineCellsContainer.innerHTML="",e.$.timelineConnectionsContainer.innerHTML="",e.$.timelineTasksContainer.innerHTML="",e.$.taskIndicatorsContainer.innerHTML="",e.$.timelineContent.style.height="",delete e._hoveredItem,e.$.taskTable.dataSource=[],e._closeTooltip(),e.closeWindow(),e._refresh()}clearResources(){const e=this;e._unselectAll("resource"),e._resources=[],e.$.resourceTable&&(e.$.resourceTable.dataSource=[]),e.$.resourceTimelineCellsContainer.innerHTML="",e._tasks.forEach((t=>{t.resources=[],e._refreshTableColumnsData(t,["resources"])})),e._refreshTimeline(),e._createResourceTimeline()}createConnection(){const e=this,t=e._tasks;let i,a=Array.from(arguments).filter((e=>void 0!==e));if(!e.isCompleted||0===t.length)return;if(i=1===a.length?(a[0]+"").split("-"):a,!e._getValidConnectionId(i[0],i[1],i[2],"createConnection"))return;const n=parseInt(i[3]);e._connectTask([i[0],i[1],i[2],isNaN(n)?0:n]),e._recycleConnections(),e.$.fireEvent("itemInsert",{type:"connection",item:{source:i[0],target:i[1],type:i[2],lag:n}})}collapse(e){this._handleCollapseExpandMethods(e,"collapse")}expand(e){this._handleCollapseExpandMethods(e,"expand")}exportData(e,t){const i=this;if(!Smart.Utilities.DataExporter)return void i.error(i.localize("missingReference",{elementType:i.nodeName.toLowerCase(),methodName:"exportData",file:"smart.export.js"}));try{new JSZip}catch(e){return void i.error(i.localize("missingReference",{elementType:i.nodeName.toLowerCase(),methodName:"exportData",file:"jszip.min.js"}))}if("pdf"===e&!window.pdfMake)return void i.error(i.localize("missingReference",{elementType:i.nodeName.toLowerCase(),methodName:"exportData",file:"pdfMake.min.js"}));const a="task"===i.dataExport.itemType?i.$.taskTable:i.$.resourceTable;return a?a.exportData(e,i.dataExport.fileName,i.dataExport.exportFiltered,t):void 0}print(){const e=this,t=e.dataExport.fileName;e.dataExport.fileName=null;const i=e.exportData("html"),a=window.open("","","width=800,height=500"),n=a.document.open(),s='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+t+"</title></head><body>"+i+"</body></html>";try{n.write(s),n.close(),setTimeout((function(){a.print(),a.close()}),100)}catch(e){}e.dataExport.fileName=t}getConnectionDetails(e){const t=this;if("string"!=typeof e)return;const i=t._getConnectionObjById(e);if(!i)return;const a=i.startTask,n=i.endTask,s={startTask:t._cloneObject(i.startTask),endTask:t._cloneObject(i.endTask),startTaskId:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,endTaskId:"string"==typeof n.id||"number"==typeof n.id?n.id:n.$.id,type:i.type};return void 0!==i.lag&&(s.lag=i.lag),s}getConnections(){const e=this;return e._connections.map((t=>{const i=t.startTask,a=t.endTask;return{id:t.startIndex+"-"+t.endIndex+"-"+t.type,startTask:e._cloneObject(i),endTask:e._cloneObject(a),startIndex:t.startIndex,startTaskId:"string"==typeof i.id||"number"==typeof i.id?i.id:i.$.id,endTaskId:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,endIndex:t.endIndex,type:t.type,lag:t.lag}}))}getState(){const e=this,t=e._getTasksJSON(!0)||[];return{tasks:JSON.parse(JSON.stringify(t)),selectedTaskIds:e.selectedTaskIds.slice(0),resources:JSON.parse(JSON.stringify(e._resources.slice(0))),scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}get tasks(){return this.isReady?this.getTasks():[]}get resources(){return this.isReady?this.getResources():[]}getTask(e){const t=this,i=t._getValidItemAndIndex(e);if(i.item)return t._cloneObject(i.item)}getTasks(){const e=this,t=e._tasks;return e.isReady&&t&&t.length?t.map((t=>e._cloneObject(t))):[]}getResource(e){const t=this,i=t._getValidItemAndIndex(e,"resource");if(i.item)return t._cloneObject(i.item)}getResources(){const e=this,t=e._resources;return e.isReady&&t&&t.length?t.map((t=>e._cloneObject(t))):[]}getItemPath(e){if(!e||void 0===e.type)return;const t="string"==typeof e.type?"task":"resource",i=this._getValidItemAndIndex(e,t);return i.item?i.item.$.id:void 0}getTaskIndex(e){const t=this;return"string"==typeof e?t._getTaskIndexById(e):t._getItemIndex(e,"task")}getTaskProject(e){const t=this;if((e=t._tasks[t._getItemIndex(e,"task")])&&e.$&&e.$.project)return t._cloneObject(e.$.project)}getTaskConnections(e){const t=this._getValidItemAndIndex(e,"task");return t&&t.item?this._getTaskConnections(t.item).taskConnections.map((e=>({target:e.endIndex,type:e.type,lag:e.lag}))):[]}getResourceIndex(e){return this._getItemIndex(e,"resource")}getResourceTasks(e){const t=this._getValidItemAndIndex(e,"resource");if(e=t?t.item:void 0)return this._getTasksAssigned(e)}getSelectedIds(){const e=this,t=e.selectedTaskIds,i=e.selectedResourceIds;return e.disableSelection||!t.length&&!i.length?null:{task:t.slice(),resources:i.slice()}}getSelectedTasks(){return this._getSelectedItems("task")}getSelectedResources(){return this._getSelectedItems("resource")}getWorkingHours(){const e=this.nonworkingHours;let t=[];for(let i=0,a=23;i<a;i+=1)e.indexOf(i)<0&&t.push(i);return t}isWorkingDay(e){return e=new Date(e),!isNaN(e.getTime())&&this.nonworkingDays.indexOf(e.getDay())<0}clearState(){const e=this;e.id?window.localStorage.removeItem("smartGanttChart"+e.id):e.warn(e.localize("noId"))}loadState(e){const t=this;if(!e){if(!t.id)return;e=JSON.parse(window.localStorage.getItem("smartGanttChart"+t.id))}if(!e)return;let i=JSON.stringify(e.tasks),a=JSON.stringify(e.selectedTaskIds),n=JSON.stringify(e.resources);if(i&&(i=JSON.parse(i)),a&&(a=JSON.parse(a)),n&&(n=JSON.parse(n)),t._noChangeEvent=!0,Array.isArray(i)&&(t._createTasks(i),t.set("dataSource",i)),Array.isArray(n)){let e=n;for(let i=0;i<e.length;i++){const e=n[i];let a=t._resources.find((t=>t.id&&t.id.toString()===e.id.toString()))||{};t._setResource(a,e),Object.values(a).length&&!t._resources.includes(a)&&t._resources.push(a)}t._refreshItemIds("resource")}"number"==typeof e.scrollLeft&&(t.scrollLeft=e.scrollLeft),"number"==typeof e.scrollTop&&(t.scrollTop=e.scrollTop),t._setTable(t.$.taskTable),t._createTimeline(),t._createResourceTimeline(),Array.isArray(a)&&(t.$.taskTable.selected=t._getSelection("task",a)),delete t._noChangeEvent}saveState(){const e=this;e.id?window.localStorage.setItem("smartGanttChart"+e.id,JSON.stringify(e.getState())):e.warn(e.localize("noId"))}insertTask(e,t,i){const a=this;if("object"!=typeof e)return void a.error(a.localize("incorrectArgument",{elementType:a.nodeName.toLowerCase(),methodName:"insertTask",argumentName:"newTask"}));const n=a._tasks;if(n.indexOf(e)>-1)return void a.error(a.localize("alreadyExists",{elementType:a.nodeName.toLowerCase(),methodName:"insertTask"}));const s=a._createTasks([e],!0);if(!n)return;let r,o,l;const d=a._getSelection("task",a.selectedTaskIds);if("string"==typeof i&&i.indexOf(!1)){const e=i.split(".");i=parseInt(e.slice(-1)),null==t&&(t=e.slice(0,-1).join("."))}if("string"==typeof t?(r=n.find((e=>e.id&&e.id.toString()===t)),r||(r=a._getItemByTableId("task",t))):"number"==typeof t&&(r=n[t]),r){if("project"!==r.type)return void a.error(a.localize("notAProject",{elementType:a.nodeName.toLowerCase(),argumentName:"project",methodName:"insertTask"}));s[0].$.project=r}return a._synchronizeProjectVisibility(s[0].$.project,s[0]),a._insertTasks(s,r,i),a._refreshItemIds(),a._refreshConnectionIds(),a._isUpdating?(a._isUpdating.type.task=!0,void(a._isUpdating.type.resource=!0)):(a._selected&&a._selected.task&&a._setSelection("task",l=a._selected.task.map((e=>e.$.id))),a._refreshTableDataSource(),a._refreshTimeline(),l&&d.toString()!==l.toString()&&(a.$.taskTable.selected=l.slice(0)),a._refreshTaskResources(o),a._ensureVisible(o),a.$.fireEvent("itemInsert",{type:"task",item:a._cloneObject(s[0])}),s[0].id||s[0].$.id+"")}openWindow(e){const t=this;if(t.disableWindowEditor)return;if("string"==typeof e){if(e.indexOf(".")>-1){const i=t._getVCellById("task",e),a=i?i.task:void 0;return void(a&&t._openPopupWindow(a))}if(e.indexOf("-")>-1){let e=(arguments[0]+"").split("-");if(e=t._getValidConnectionId(e[0],e[1],e[2],"openEditor"),e)return void t._openPopupWindow(e)}}const i=t._getValidItemAndIndex(e);i&&t._openPopupWindow(i.item)}closeWindow(){const e=this,t=["confirm","task","connection"];for(let i=0;i<t.length;i++){const a=e.$[t[i]+"PopupWindow"];a&&(a.close(),delete a._target)}}updateTask(e,t){const i=this,a=i._getValidItemAndIndex(e),n=a?a.item:void 0;"object"==typeof n?"object"==typeof t?i._updateTask(n,t):i.error(i.localize("incorrectArgument",{elementType:i.nodeName.toLowerCase(),methodName:"updateTask",argumentName:"taskDetails"})):i.error(i.localize("notExisting",{elementType:i.nodeName.toLowerCase(),methodName:"updateTask",argumentName:"newTask"}))}removeTask(e){const t=this,i=t._tasks,a=t._getValidItemAndIndex(e),n=a?a.item:void 0;i&&i.length&&("object"==typeof n?t._removeTask(n):t.error(t.localize("notExisting",{elementType:t.nodeName.toLowerCase(),methodName:"removeTask",argumentName:"index"})))}setWorkTime(e){this._setWorkTime(e,(function(e,t){for(let i=0,a=e.length;i<a;i+=1){const a=parseInt(e[i]),n=t.indexOf(a);n>-1&&t.splice(n,1)}return t}))}selectTask(e){this._handleItemSelection(e,"task")}selectResource(e){const t=this;t.$.mainSplitter.contains(t.$.resourceTable)&&t._handleItemSelection(e,"resource")}sort(e){const t=this;if("none"===t.sortMode)return;Array.isArray(e)||(e="object"==typeof e?[e]:[]);const i=t.taskColumns,a=t.resourceColumns,n=t.$.taskTable,s=t.$.resourceTable;for(let t=0;t<e.length;t++){const r=e[t],o="desc"===r.sortOrder?"desc":"asc",[l,d]="resource"===r.type||a.includes(r)?[s,a]:[n,i],c=d.find((e=>r.value&&e.value===r.value));c&&l.sortBy(c.value,o)}}unselectTask(e){this._handleItemSelection(e,"task",!0)}unselectResource(e){const t=this;t.$.mainSplitter.contains(t.$.resourceTable)&&t._handleItemSelection(e,"resource",!0)}unsetWorkTime(e){this._setWorkTime(e,(function(e,t){for(let i=0,a=e.length;i<a;i+=1){const a=parseInt(e[i]);t.indexOf(a)<0&&t.push(a)}return t}),!0)}hideTooltip(){this._closeTooltip()}showTooltip(e,t){this._openTooltip(e,void 0,t)}_getSelectedItems(e="task"){const t=this,i=t[`_${e}s`],a=t._getSelection(e,"task"===e?t.selectedTaskIds:t.selectedResourceIds);if(!a.length)return[];let n=[];for(let e=0,s=i.length;e<s;e+=1){const s=i[e];a.indexOf(s.$.id)>-1&&n.push(t._cloneObject(s))}return n}_getTasksAssigned(e){const t=this,i=t._tasks||[];let a=[];for(let n=0;n<i.length;n++){const s=i[n];!s.disableResources&&s.resources.find((t=>t===e.id))&&a.push(t._cloneObject(s))}return a}_getItemIndex(e,t){t||(t="task");const i=this[`_${t}s`];if(e instanceof HTMLElement&&e.classList.contains("smart-timeline-task"))return i.indexOf(e._cellObj[`_${t}`]);const a="resource"===t?["id","label","value","progress"]:["id","label","type","class","dateStart","dateEnd","resources","connections"];if("object"==typeof e)for(let t=0;t<i.length;t++)if(a.every((a=>Array.isArray(e[a])?JSON.stringify(e[a])===JSON.stringify(i[t][a]):a.indexOf("date")>-1?new Date(e[a]).getTime()===new Date(i[t][a]).getTime():e[a]===i[t][a])))return i.indexOf(i[t]);return-1}_handleItemSelection(e,t="task",i){const a=this,n=a._getValidItemAndIndex(e,t);if(n.item){const s=n.item,r=a._getSelection(t,"task"===t?a.selectedTaskIds:a.selectedResourceIds);if(e=s.$.id,i){const i=r.indexOf(e);i>-1&&(r.splice(i,1),a.$[`${t}Table`].selected=r)}else r.indexOf(e)<0&&(r.push(e),a.$[`${t}Table`].selected=r);return"string"==typeof s.id||"number"==typeof s.id?s.id:s.$.id}}_refreshAfterWorkingTimeChange(){const e=this;if(e.adjustToNonworkingTime)for(let t=0;t<e._tasks.length;t++){const i=e._tasks[t],a=i.$.project;e._validateTaskDates(i,a),e._synchronizeProjectDates(i,a),e._refreshTableColumnsData(i,["dateEnd","duration"])}e._refreshTimeline()}_refreshItemIds(e="task"){const t=this[`_${e}s`];if(!t)return;let i={},a=0;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],s=n.$.project;if(void 0!==s){const e=s.$.id;i[e]||(i[e]=0),n.$.id=e+"."+i[e],i[e]++}else n.$.id=a+"",a++}}_refreshConnectionIds(){const e=this._tasks,t=this._connections;if(t&&t.length)for(let i=0,a=t.length;i<a;i+=1){const n=t[i],s=e.indexOf(n.startTask),r=e.indexOf(n.endTask);(s<0||r<0)&&(t.splice(i,1),a--),n.startIndex=s,n.endIndex=r}}_refreshSelectedItems(e="task",t){const i=this,a=i[`_${e}s`];if(a&&(!t&&i._selected&&i._selected[e]&&(t=i._selected[e]),t)){for(let e=0,i=t.length;e<i;e+=1){const n=t[e];(a.indexOf(n)<0||n.hidden)&&(t.splice(e,1),e-=1,i--)}i._setSelection(e,t.map((e=>e.$.id)))}}_resetFromAction(e="task",t="clearSort"){const i=this;function a(){i.$.taskTable[t](),i._createTimelineContent(),i._recycleTimelineTasks()}function n(){const e=i.$.resourceTable;e&&(e[t](),i._createResourceTimelineVCells(),i._recycleResourceContent())}"resource"===e?n():"task"===e?a():(a(),n())}_setWorkTime(e,t,i){const a=this;if("object"!=typeof e)return;let n,s=e.days,r=e.hours;null!=s&&(Array.isArray(s)||(s=[s]),s=a._nonworkingDayValidator(void 0,s),n=t(s,i?a.nonworkingDays:[0,1,2,3,4,5,6]),a.set("nonworkingDays",7===n.length?[]:n),a._refreshAfterWorkingTimeChange()),null!=r&&(Array.isArray(r)||(r=[r]),r=a._nonworkingTimeValidator(void 0,r),n=t(r,i?a.nonworkingHours:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),a.set("nonworkingHours",24===n.length?[]:n),a._refreshAfterWorkingTimeChange())}_getValidConnectionId(e,t,i,a){const n=this,s=n._tasks,r=0===a.indexOf("_");let o;if("string"==typeof e&&(o=n._getTaskIndexById(e),o>=0&&(e=o)),"string"==typeof t&&(o=n._getTaskIndexById(t),o>=0&&(t=o)),e=parseInt(e),t=parseInt(t),i=parseInt(i),isNaN(e)||isNaN(t)||e===t)r||n.error(n.localize("incorrectArgument",{elementType:n.nodeName.toLowerCase(),methodName:a,argumentName:"taskIndex"}));else if(e>=s.length||e<0||t>=s.length||t<0)r||n.error(n.localize("outOfBounds",{elementType:n.nodeName.toLowerCase(),methodName:a,argumentName:"taskIndex"}));else{if(!(isNaN(i)||i<0||i>3))return r?[e,t,i]:e+"-"+t+"-"+i;r||n.error(n.localize("incorrectArgument",{elementType:n.nodeName.toLowerCase(),methodName:a,argumentName:"connectionType"}))}}_autoSchedule(e){const t=this,i=t._tasks;if(t.autoSchedule){e?Array.isArray(e)||(e=[e]):e=i;for(let i=0;i<e.length;i++){const a=e[i];"project"===a.type&&a.synchronized||(a.minDateStart=a.minDateEnd=void 0,t._autoScheduleTasks(a))}t._isUpdateRequired&&(t._createTimelineCells(),t._recycleTimelineTasks(!0),delete t._isUpdateRequired)}}_getTaskConnections(e){const t=this._tasks,i=this._connections;let a=[],n=[];if(t&&t.length&&i&&i.length){const s=t.indexOf(e);for(let e=0;e<i.length;e+=1){const t=i[e];t.startIndex===s?a.push(t):t.endIndex===s&&n.push(t)}}return{taskConnections:a,connectedTasks:n}}_autoScheduleTasks(e){const t=this,i=t._tasks,a=t._getTaskConnections(e),n=a.taskConnections,s=a.connectedTasks;let r,o,l;for(let a=0;a<n.length;a++)t._isAutoScheduled(e,i[n[a].endIndex],!0);for(let a=0;a<s.length;a++){const n=s[a],d=i[n.startIndex],c=n.type,m=n.lag,u=e.$.project;d&&"project"===d.type&&d.synchronized||(0===c||1===c?(l=new Date((0===c?d.dateStart:d.dateEnd).getTime()+m),e.minDateStart=new Date(e.minDateStart?Math.max(e.minDateStart.getTime(),l.getTime()):l),o=e.minDateStart.getTime()-e.dateStart.getTime(),r=new Date(e.dateEnd.getTime()+(t.autoScheduleStrictMode?o:Math.max(0,o))),r.getTime()!==e.dateEnd.getTime()&&(e.dateEnd=r,t._isUpdateRequired=!0),t.autoScheduleStrictMode&&e.minDateStart.getTime()!==e.dateStart.getTime()&&(e.dateStart=e.minDateStart,t._isUpdateRequired=!0)):(l=new Date((2===c?d.dateEnd:d.dateStart).getTime()+m),e.minDateEnd=new Date(e.minDateEnd?Math.min(e.minDateEnd.getTime(),l.getTime()):l),o=e.minDateEnd.getTime()-e.dateEnd.getTime(),r=new Date(e.dateStart.getTime()+(t.autoScheduleStrictMode?o:Math.max(0,o))),r.getTime()!==e.dateStart.getTime()&&(e.dateStart=r,t._isUpdateRequired=!0),t.autoScheduleStrictMode&&e.minDateEnd.getTime()!==e.dateEnd.getTime()&&(e.dateEnd=e.minDateEnd,t._isUpdateRequired=!0)),t._validateTaskDates(e,u),t._synchronizeProjectDates(e,u))}for(let e=0;e<n.length;e++){const a=i[n[e].endIndex];!a||"project"===a.type&&a.synchronized||(a.minDateStart=a.minDateEnd=void 0,t._autoScheduleTasks(a))}}_autoScheduleRestore(e,t){const i=this._tasks;e||(e=i),Array.isArray(e)||(e=[e]);for(let a=0;a<e.length;a++){const n=e[a];i.indexOf(e[a])>-1&&(t?0===t||1===t?n.minDateStart=void 0:n.minDateEnd=void 0:n.minDateStart=n.minDateEnd=void 0)}}_autoScroll(e){const t=this,i=t.hasAttribute("dragged"),a=t.hasAttribute("resized");function n(n,s){if(!t._dragDetails)return clearInterval(t._scrollInterval),t._scrollInterval=void 0,void delete t._autoScrolling;t._autoScrolling=!0,s?i||(t.scrollTop-=t.autoScrollStep*n,t._dragDetails.coordinates.y+=t.autoScrollStep*n):(t.scrollLeft-=(t.rightToLeft?-1:1)*t.autoScrollStep*n,t._dragDetails.coordinates.x+=t.autoScrollStep*n),i?t._handleTaskBarDrag(e):a&&t._handleTaskBarResize(e)}if(t.disableAutoScroll||!e||!i&&!a&&!t.hasAttribute("connecting-task"))return;const s=t.$.timeline.getBoundingClientRect();t._scrollInterval&&clearInterval(t._scrollInterval),t._scrollInterval=setInterval((function(){(t.scrollLeft||t.rightToLeft)&&e.clientX<=s.left+20?n(1):t.scrollLeft!==(t.rightToLeft?0:t.scrollWidth)&&e.clientX>=s.left+s.width-20?n(-1):t.scrollTop&&e.clientY<=s.top+20?n(1,!0):t.scrollTop!==t.scrollHeight&&e.clientY>=s.top+s.height-20?n(-1,!0):(clearInterval(t._scrollInterval),t._scrollInterval=void 0,delete t._autoScrolling)}),1)}_checkTaskBarResizability(e){const t=this;let i=e.originalEvent.target;t.shadowRoot&&i===t&&(i=e.originalEvent.composedPath()[0]);const a=t.$.timeline;if(!i.closest)return void a.removeAttribute("task-bar-hovered");let n,s=i.closest(".smart-timeline-row")||i.closest(".smart-timeline-task");if(t.disabled||t.disableTaskResize||!s||!a.contains(s))return void a.removeAttribute("task-bar-hovered");const r=s._cellObj.task,o=t._getTaskDOMIndex(r);if(s.classList.contains("smart-timeline-row")?n=t.$.timelineTasksContainer.children[o]:s.classList.contains("smart-timeline-task")&&(n=s,s=t.$.taskTimelineCellsContainer.children[o]),!n||n.classList.contains("milestone")||r.synchronized||r.disableResize)return;const l=i.closest(".smart-task-segment"),d=r.segments?r.segments.length:1;if(i.classList&&i.classList.contains("smart-task-connection-point")||l&&(d>1&&t.disableSegmentResize||l._segmentObj&&l._segmentObj.disableResize))return void a.removeAttribute("task-bar-hovered");const c=e.pageX-window.pageXOffset,m="visible"===t.resizeHandlesVisibility||t._isMobile?20:5,u=(l||n).getBoundingClientRect(),h=s.getBoundingClientRect(),g=Math.min(m,c-h.left),f=Math.min(m,h.left+h.width-c);Math.round(u.left)+g>=c&&Math.round(u.left)-g<=c?a.setAttribute("task-bar-hovered","left"):Math.round(u.left+u.width)+f>=c&&Math.round(u.left+u.width)-f<=c?a.setAttribute("task-bar-hovered","right"):a.removeAttribute("task-bar-hovered")}_onShadowDomLoaded(e,t,i){requestAnimationFrame((function a(){const n=(e.shadowRoot||e.getRootNode()).querySelectorAll("link");for(let e=0;e<n.length;e++)if(-1!==n[e].href.indexOf(t))return void i();requestAnimationFrame(a)}))}_getConnectionObjById(e){const t=this._connections;if(!e||!t||!t.length)return;const i=e.split("-"),a=parseInt(i[0]),n=parseInt(i[1]),s=parseInt(i[2]);for(let e=0,i=t.length;e<i;e+=1){const i=t[e];if(i.startIndex===a&&i.endIndex===n&&i.type===s)return i}}_positionWindow(){const e=this,t=e.getShadowRootOrBody(),i=[e.$.taskPopupWindow,e.$.connectionPopupWindow,e.$.confirmPopupWindow];for(let a=0;a<i.length;a++){const n=i[a];if(!n||!t.contains(n))continue;const s=e.getBoundingClientRect();n.opened||(n.style.left=n.style.top=""),e._isMobile?(n.setAttribute("mobile",""),n.style.left=s.left+window.pageXOffset+"px",n.style.top=s.top+window.pageYOffset+"px",n.style.width=s.width+"px",n.style.height=s.height+"px"):(n.style.left=Math.max(s.left+window.pageXOffset,s.left+window.pageXOffset+s.width/2-n.offsetWidth/2)+"px",n.style.top=Math.max(s.top+window.pageYOffset,s.top+window.pageYOffset+s.height/2-n.offsetHeight/2)+"px")}}_openPopupWindow(e,t){const i=this;function a(){function t(){i._positionWindow(),s.opened?(s.bringToFront(),s._onOpenCallback?s._onOpenCallback():s._handleActiveState()):s.open()}if(i.popupWindowCustomizationFunction?i.popupWindowCustomizationFunction(s,n,"connection"===n?e.startIndex+"-"+e.endIndex+"-"+e.type:i._cloneObject(e)):s._onOpenCallback=()=>{const e=(s.shadowRoot||s).querySelectorAll(".smart-gantt-chart-popup-window-editor .smart-input, .smart-popup-window-button");(e[0]||e[1]||s).focus({preventScroll:!0}),s._handleActiveState()},i._setPopupWindowTemplate("header",n,e),i._setPopupWindowTemplate("footer",n,e),i._setPopupWindowTemplate("content",n,e),!i._popupWindow[n+"PopupWindow"]){const e=i["$"+n+"PopupWindow"];e.unlisten("transitionend"),e.unlisten("open"),e.unlisten("close"),e.unlisten("closing"),e.unlisten("click"),e.unlisten("change"),e.listen("transitionend",i._popupWindowTransitionendHandler.bind(i)),e.listen("open",i._popupWindowOpenHandler.bind(i)),e.listen("close",i._popupWindowCloseHandler.bind(i)),e.listen("closing",i._popupWindowClosingHandler.bind(i)),e.listen("click",i._popupWindowClickHandler.bind(i)),e.listen("change",i._popupWindowChangeHandler.bind(i))}s.shadowRoot?(s.importStyle(Smart.Utilities.Core.getScriptLocation()+Smart.StyleBaseUrl.replace("/scoped/","/smart.textbox.css")),i._onShadowDomLoaded(s,"smart.window.css",t)):t();const a=(i.getAttribute("aria-owns")||"")+" "+s.id;i.setAttribute("aria-owns",a.trim()),i._popupWindow[n+"PopupWindow"]=s}if(e&&e.classList)if(e.classList.contains("smart-task-connection"))e=i._getConnectionObjById(e.getAttribute("connection-id"));else if("TR"===e.nodeType){const t=e?"task":"resource",a=i._getVCellById(t,e.getAttribute("row-id"));e=a?a[t]:void 0}else e=e._cellObj.task;if(!e||e.isGroup)return;const n=t?"confirm":"string"==typeof e.type?"task":"connection",s=i._createPopupWindow(n);!t&&i.$.fireEvent("opening",{target:s,type:n}).defaultPrevented||(i._closeTooltip(),s._target=e,i._popupWindow||(i._popupWindow={}),s.parentElement||i.getShadowRootOrBody().appendChild(s),s.isCompleted?a():s.whenReady((()=>a())))}_createPopupWindow(e){const t=this,i=e+"PopupWindow";if(t.$[i])return t.$[i];const a=document.createElement("smart-window");return a.classList.add("smart-"+e+"-popup-window"),a.classList.add("smart-gantt-chart-popup-window"),a.setAttribute("smart-id",i),t.$[i]=a,t["$"+i]=Smart.Utilities.Extend(a),a.rightToLeft=t.rightToLeft,a.theme=t.theme,a.animation=t.animation,a.disableSnap=!0,a.headerButtons=["close"],a}_popupWindowOpenHandler(e){const t=this,i=t["$"+e.target.getAttribute("smart-id")];if(i){const a=e.target.classList.contains("smart-confirm-popup-window")?"confirm":e.target.classList.contains("smart-connection-popup-window")?"connection":"task";t._handleModal(!0),t.$.fireEvent(e.type,Object.assign({type:a,target:e.target},e.detail)),i.unlisten("open")}}_popupWindowClosingHandler(e){const t=this["$"+e.target.getAttribute("smart-id")];if(!t)return;const i=e.target.classList.contains("smart-confirm-popup-window