diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 7d9686acb..a6056e0b2 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -175,11 +175,11 @@ Public Class ClsOIEventos DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name - .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString(), HttpContext.Current.Request.QueryString.ToString()) .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output End With SqlAdapter.Fill(Data) - CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString().ToEntero() Catch ex As Exception OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try @@ -270,7 +270,21 @@ Public Class ClsOIEventos End Try Return retorno End Function - + Public Function GetTareaConHijos(cveEvento As Int32, CveEmpresa As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_GetTareaConHijos", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEvento", SqlDbType.Int).Value = cveEvento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Eventos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function Public Function AddEventoMinuta2(Asunto As String, Descripcion As String, Acuerdos As String, CveUsuarioDe As Integer, CveUsuarioPara As Integer, FechaInicio As DateTime, Archivo As String, Lmiembros As List(Of Integer), chkList As List(Of String), CveUsuarioIng As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -724,7 +738,7 @@ Public Class ClsOIEventos drow = ds.Tables(1).Rows(0) End If - CveEventoComentario = SqlAdapter.SelectCommand.Parameters("@CveEventoComentario").Value.ToString.ToEntero + CveEventoComentario = SqlAdapter.SelectCommand.Parameters("@CveEventoComentario").Value.ToString().ToEntero() Retorno = CveEventoComentario If DtResultados.Rows.Count > 0 Then For Each item As DataRow In DtResultados.Rows @@ -904,65 +918,65 @@ Public Class ClsOIEventos 'If CveEvento > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then If Data.Rows.Count > 0 Then - Me.CveEvento = Data.Rows(0)("CveEvento").ToString.ToEntero - Me.CveTipoEvento = Data.Rows(0)("CveTipoEvento").ToString.ToEntero - Me.Folio = Data.Rows(0)("Folio").ToString.ToEntero - Me.CveAgendaTipo = Data.Rows(0)("CveAgendaTipo").ToString.ToEntero - Me.TipoEvento = Data.Rows(0)("TipoEvento").ToString - Me.Asunto = Data.Rows(0)("Asunto").ToString - Me.Descripcion = Data.Rows(0)("Descripcion").ToString - Me.Prioridad = Data.Rows(0)("Prioridad").ToString - Me.CvePrioridad = Data.Rows(0)("CvePrioridad").ToString.ToEntero - Me.CveUsuarioDe = Data.Rows(0)("CveUsuarioDe").ToString.ToEntero - Me.CorreoDe = Data.Rows(0)("CorreoDe").ToString - Me.UsuarioDe = Data.Rows(0)("UsuarioDe").ToString - Me.CveUsuarioPara = Data.Rows(0)("CveUsuarioPara").ToString.ToEntero - Me.UsuarioPara = Data.Rows(0)("UsuarioPara").ToString - Me.CorreoPara = Data.Rows(0)("CorreoPara").ToString - Me.CveEventoEstatus = Data.Rows(0)("CveEventoEstatus").ToString.ToEntero - Me.EventoEstatus = Data.Rows(0)("EventoEstatus").ToString - Me.FechaInicio = Data.Rows(0)("FechaInicio").ToString.ToDate - Me.FechaFin = Data.Rows(0)("FechaFin").ToString.ToDate - Me.FechaRealTermino = Data.Rows(0)("FechaRealTermino").ToString.ToDate - Me.CveEventoPadre = Data.Rows(0)("CveEventoPadre").ToString.ToEntero - Me.Orden = Data.Rows(0)("Orden").ToString.ToDouble - Me.CveRevision = Data.Rows(0)("CveRevision").ToString.ToEntero - Me.Acuerdos = Data.Rows(0)("Acuerdos").ToString - Me.Revision = Data.Rows(0)("Revision").ToString - 'Me.TipoReferencia = Data.Rows(0)("TipoReferencia").ToString - 'Me.Referencia = Data.Rows(0)("Referencia").ToString - Me.Archivo = Data.Rows(0)("Archivo").ToString - 'Me.CveSeguimiento = Data.Rows(0)("CveSeguimiento").ToString.ToEntero - Me.CveOC = Data.Rows(0)("CveOC").ToString.ToEntero - Me.CveUsuarioIng = Data.Rows(0)("CveUsuarioIng").ToString.ToEntero - Me.UsuarioIng = Data.Rows(0)("UsuarioIng").ToString - Me.RolIngreso = Data.Rows(0)("RolIngreso").ToString.ToEntero - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero - Me.Modificada = CBool(Data.Rows(0)("Modificado").ToString) - Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero - Me.CveVenta = Data.Rows(0)("CveVenta").ToString.ToEntero + Me.CveEvento = Data.Rows(0)("CveEvento").ToString().ToEntero() + Me.CveTipoEvento = Data.Rows(0)("CveTipoEvento").ToString().ToEntero() + Me.Folio = Data.Rows(0)("Folio").ToString().ToEntero() + Me.CveAgendaTipo = Data.Rows(0)("CveAgendaTipo").ToString().ToEntero() + Me.TipoEvento = Data.Rows(0)("TipoEvento").ToString() + Me.Asunto = Data.Rows(0)("Asunto").ToString() + Me.Descripcion = Data.Rows(0)("Descripcion").ToString() + Me.Prioridad = Data.Rows(0)("Prioridad").ToString() + Me.CvePrioridad = Data.Rows(0)("CvePrioridad").ToString().ToEntero() + Me.CveUsuarioDe = Data.Rows(0)("CveUsuarioDe").ToString().ToEntero() + Me.CorreoDe = Data.Rows(0)("CorreoDe").ToString() + Me.UsuarioDe = Data.Rows(0)("UsuarioDe").ToString() + Me.CveUsuarioPara = Data.Rows(0)("CveUsuarioPara").ToString().ToEntero() + Me.UsuarioPara = Data.Rows(0)("UsuarioPara").ToString() + Me.CorreoPara = Data.Rows(0)("CorreoPara").ToString() + Me.CveEventoEstatus = Data.Rows(0)("CveEventoEstatus").ToString().ToEntero() + Me.EventoEstatus = Data.Rows(0)("EventoEstatus").ToString() + Me.FechaInicio = Data.Rows(0)("FechaInicio").ToString().ToDate + Me.FechaFin = Data.Rows(0)("FechaFin").ToString().ToDate + Me.FechaRealTermino = Data.Rows(0)("FechaRealTermino").ToString().ToDate + Me.CveEventoPadre = Data.Rows(0)("CveEventoPadre").ToString().ToEntero() + Me.Orden = Data.Rows(0)("Orden").ToString().ToDouble + Me.CveRevision = Data.Rows(0)("CveRevision").ToString().ToEntero() + Me.Acuerdos = Data.Rows(0)("Acuerdos").ToString() + Me.Revision = Data.Rows(0)("Revision").ToString() + 'Me.TipoReferencia = Data.Rows(0)("TipoReferencia").ToString() + 'Me.Referencia = Data.Rows(0)("Referencia").ToString() + Me.Archivo = Data.Rows(0)("Archivo").ToString() + 'Me.CveSeguimiento = Data.Rows(0)("CveSeguimiento").ToString().ToEntero() + Me.CveOC = Data.Rows(0)("CveOC").ToString().ToEntero() + Me.CveUsuarioIng = Data.Rows(0)("CveUsuarioIng").ToString().ToEntero() + Me.UsuarioIng = Data.Rows(0)("UsuarioIng").ToString() + Me.RolIngreso = Data.Rows(0)("RolIngreso").ToString().ToEntero() + Me.FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString().ToEntero() + Me.Modificada = CBool(Data.Rows(0)("Modificado").ToString()) + Me.CveCompra = Data.Rows(0)("CveCompra").ToString().ToEntero() + Me.CveVenta = Data.Rows(0)("CveVenta").ToString().ToEntero() - Me.CveUsuarioSop = Data.Rows(0)("CveUsuarioSop").ToString.ToEntero - Me.Persona = Data.Rows(0)("Persona").ToString - Me.Telefono = Data.Rows(0)("Telefono").ToString - Me.Extension = Data.Rows(0)("Extension").ToString - Me.Clasificacion = Data.Rows(0)("Clasificacion").ToString.ToEntero - Me.Email = Data.Rows(0)("Email").ToString - Me.EmpresaSop = Data.Rows(0)("EmpresaSop").ToString - Me.Modulo = Data.Rows(0)("Modulo").ToString - Me.Datos = Data.Rows(0)("Datos").ToString - If Data.Rows(0)("Desarrollo").ToString.Length > 0 Then - Me.Desarrollo = If(Boolean.Parse(Data.Rows(0)("Desarrollo").ToString), 1, 0) + Me.CveUsuarioSop = Data.Rows(0)("CveUsuarioSop").ToString().ToEntero() + Me.Persona = Data.Rows(0)("Persona").ToString() + Me.Telefono = Data.Rows(0)("Telefono").ToString() + Me.Extension = Data.Rows(0)("Extension").ToString() + Me.Clasificacion = Data.Rows(0)("Clasificacion").ToString().ToEntero() + Me.Email = Data.Rows(0)("Email").ToString() + Me.EmpresaSop = Data.Rows(0)("EmpresaSop").ToString() + Me.Modulo = Data.Rows(0)("Modulo").ToString() + Me.Datos = Data.Rows(0)("Datos").ToString() + If Data.Rows(0)("Desarrollo").ToString().Length > 0 Then + Me.Desarrollo = If(Boolean.Parse(Data.Rows(0)("Desarrollo").ToString()), 1, 0) Else Me.Desarrollo = 0 End If - Me.CveEmpresaSop = Data.Rows(0)("CveEmpresaSop").ToString.ToEntero - Me.CveModulo = Data.Rows(0)("CveModulo").ToString.ToEntero + Me.CveEmpresaSop = Data.Rows(0)("CveEmpresaSop").ToString().ToEntero() + Me.CveModulo = Data.Rows(0)("CveModulo").ToString().ToEntero() - Me.Importe = Data.Rows(0)("Importe").ToString.ToDouble + Me.Importe = Data.Rows(0)("Importe").ToString().ToDouble End If Retorno = True @@ -1058,7 +1072,7 @@ Public Class ClsOIEventos Try SqlAdapter.Fill(Data) - CveEvento = SqlAdapter.SelectCommand.Parameters("@CveEvento").Value.ToString.ToEntero + CveEvento = SqlAdapter.SelectCommand.Parameters("@CveEvento").Value.ToString().ToEntero() Retorno = True Catch ex As Exception OnError("Ocurrió un error al Guardar el Evento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) @@ -1326,12 +1340,12 @@ Public Class ClsOIEventos SqlAdapter.Fill(Data) If CveSeguimiento > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then - Me.CveSeguimiento = Data.Rows(0)("CveEventoComentario").ToString.ToEntero - Me.CveEvento = Data.Rows(0)("CveEvento").ToString.ToEntero - Me.Comentario = Data.Rows(0)("EventoComentario").ToString - Me.Archivo = Data.Rows(0)("Archivo").ToString - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.UsuarioDe = Data.Rows(0)("Usuario").ToString + Me.CveSeguimiento = Data.Rows(0)("CveEventoComentario").ToString().ToEntero() + Me.CveEvento = Data.Rows(0)("CveEvento").ToString().ToEntero() + Me.Comentario = Data.Rows(0)("EventoComentario").ToString() + Me.Archivo = Data.Rows(0)("Archivo").ToString() + Me.FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate + Me.UsuarioDe = Data.Rows(0)("Usuario").ToString() End If Retorno = True @@ -1359,7 +1373,7 @@ Public Class ClsOIEventos Try SqlAdapter.Fill(Data) - CveEventoComentario = SqlAdapter.SelectCommand.Parameters("@CveEventoComentario").Value.ToString.ToEntero + CveEventoComentario = SqlAdapter.SelectCommand.Parameters("@CveEventoComentario").Value.ToString().ToEntero() Retorno = CveEventoComentario Catch Ex1 As SqlException @@ -1596,36 +1610,36 @@ Public Class ClsOIEventos If Data.Rows.Count > 0 Then - Me.CveEvento = Data.Rows(0)("CveEvento").ToString.ToEntero - Me.CveTipoEvento = Data.Rows(0)("CveTipoEvento").ToString.ToEntero - 'Me.CveAgendaTipo = Data.Rows(0)("CveAgendaTipo").ToString.ToEntero - 'Me.TipoEvento = Data.Rows(0)("EventoTipo").ToString - Me.Asunto = Data.Rows(0)("Asunto").ToString - Me.Descripcion = Data.Rows(0)("Descripcion").ToString - Me.Prioridad = Data.Rows(0)("Prioridad").ToString - Me.CvePrioridad = Data.Rows(0)("CvePrioridad").ToString.ToEntero - Me.CveUsuarioDe = Data.Rows(0)("CveUsuarioDe").ToString.ToEntero - 'Me.CorreoDe = Data.Rows(0)("CorreoDe").ToString - Me.UsuarioDe = Data.Rows(0)("UsuarioDe").ToString - Me.CveUsuarioPara = Data.Rows(0)("CveUsuarioPara").ToString.ToEntero - Me.UsuarioPara = Data.Rows(0)("UsuarioPara").ToString - 'Me.CorreoPara = Data.Rows(0)("CorreoPara").ToString - Me.CveEventoEstatus = Data.Rows(0)("CveEventoEstatus").ToString.ToEntero - Me.EventoEstatus = Data.Rows(0)("EventoEstatus").ToString - Me.FechaInicio = Data.Rows(0)("FechaInicio").ToString.ToDate - Me.FechaFin = Data.Rows(0)("FechaFin").ToString.ToDate - Me.FechaRealTermino = Data.Rows(0)("FechaRealTermino").ToString.ToDate - Me.CveEventoPadre = Data.Rows(0)("CveEventoPadre").ToString.ToEntero - 'Me.Orden = Data.Rows(0)("Orden").ToString.ToEntero - Me.CveRevision = Data.Rows(0)("CveRevision").ToString.ToEntero - Me.Acuerdos = Data.Rows(0)("Acuerdos").ToString - 'Me.Revision = Data.Rows(0)("Revision").ToString - 'Me.TipoReferencia = Data.Rows(0)("TipoReferencia").ToString - 'Me.Referencia = Data.Rows(0)("Referencia").ToString - 'Me.Archivo = Data.Rows(0)("Archivo").ToString - 'Me.CveSeguimiento = Data.Rows(0)("CveSeguimiento").ToString.ToEntero - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + Me.CveEvento = Data.Rows(0)("CveEvento").ToString().ToEntero() + Me.CveTipoEvento = Data.Rows(0)("CveTipoEvento").ToString().ToEntero() + 'Me.CveAgendaTipo = Data.Rows(0)("CveAgendaTipo").ToString().ToEntero() + 'Me.TipoEvento = Data.Rows(0)("EventoTipo").ToString() + Me.Asunto = Data.Rows(0)("Asunto").ToString() + Me.Descripcion = Data.Rows(0)("Descripcion").ToString() + Me.Prioridad = Data.Rows(0)("Prioridad").ToString() + Me.CvePrioridad = Data.Rows(0)("CvePrioridad").ToString().ToEntero() + Me.CveUsuarioDe = Data.Rows(0)("CveUsuarioDe").ToString().ToEntero() + 'Me.CorreoDe = Data.Rows(0)("CorreoDe").ToString() + Me.UsuarioDe = Data.Rows(0)("UsuarioDe").ToString() + Me.CveUsuarioPara = Data.Rows(0)("CveUsuarioPara").ToString().ToEntero() + Me.UsuarioPara = Data.Rows(0)("UsuarioPara").ToString() + 'Me.CorreoPara = Data.Rows(0)("CorreoPara").ToString() + Me.CveEventoEstatus = Data.Rows(0)("CveEventoEstatus").ToString().ToEntero() + Me.EventoEstatus = Data.Rows(0)("EventoEstatus").ToString() + Me.FechaInicio = Data.Rows(0)("FechaInicio").ToString().ToDate + Me.FechaFin = Data.Rows(0)("FechaFin").ToString().ToDate + Me.FechaRealTermino = Data.Rows(0)("FechaRealTermino").ToString().ToDate + Me.CveEventoPadre = Data.Rows(0)("CveEventoPadre").ToString().ToEntero() + 'Me.Orden = Data.Rows(0)("Orden").ToString().ToEntero() + Me.CveRevision = Data.Rows(0)("CveRevision").ToString().ToEntero() + Me.Acuerdos = Data.Rows(0)("Acuerdos").ToString() + 'Me.Revision = Data.Rows(0)("Revision").ToString() + 'Me.TipoReferencia = Data.Rows(0)("TipoReferencia").ToString() + 'Me.Referencia = Data.Rows(0)("Referencia").ToString() + 'Me.Archivo = Data.Rows(0)("Archivo").ToString() + 'Me.CveSeguimiento = Data.Rows(0)("CveSeguimiento").ToString().ToEntero() + Me.FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString().ToEntero() End If @@ -1685,36 +1699,36 @@ Public Class ClsOIEventos 'If CveEvento > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then If Data.Rows.Count > 0 Then - Me.CveEvento = Data.Rows(0)("CveEvento").ToString.ToEntero - Me.CveTipoEvento = Data.Rows(0)("CveTipoEvento").ToString.ToEntero - Me.CveAgendaTipo = Data.Rows(0)("CveAgendaTipo").ToString.ToEntero - Me.TipoEvento = Data.Rows(0)("TipoEvento").ToString - Me.Asunto = Data.Rows(0)("Asunto").ToString - Me.Descripcion = Data.Rows(0)("Descripcion").ToString - Me.Prioridad = Data.Rows(0)("Prioridad").ToString - Me.CvePrioridad = Data.Rows(0)("CvePrioridad").ToString.ToEntero - Me.CveUsuarioDe = Data.Rows(0)("CveUsuarioDe").ToString.ToEntero - Me.CorreoDe = Data.Rows(0)("CorreoDe").ToString - Me.UsuarioDe = Data.Rows(0)("UsuarioDe").ToString - Me.CveUsuarioPara = Data.Rows(0)("CveUsuarioPara").ToString.ToEntero - Me.UsuarioPara = Data.Rows(0)("UsuarioPara").ToString - Me.CorreoPara = Data.Rows(0)("CorreoPara").ToString - Me.CveEventoEstatus = Data.Rows(0)("CveEventoEstatus").ToString.ToEntero - Me.EventoEstatus = Data.Rows(0)("EventoEstatus").ToString - Me.FechaInicio = Data.Rows(0)("FechaInicio").ToString.ToDate - Me.FechaFin = Data.Rows(0)("FechaFin").ToString.ToDate - Me.FechaRealTermino = Data.Rows(0)("FechaRealTermino").ToString.ToDate - Me.CveEventoPadre = Data.Rows(0)("CveEventoPadre").ToString.ToEntero - Me.Orden = Data.Rows(0)("Orden").ToString.ToEntero - Me.CveRevision = Data.Rows(0)("CveRevision").ToString.ToEntero - Me.Acuerdos = Data.Rows(0)("Acuerdos").ToString - Me.Revision = Data.Rows(0)("Revision").ToString - 'Me.TipoReferencia = Data.Rows(0)("TipoReferencia").ToString - 'Me.Referencia = Data.Rows(0)("Referencia").ToString - Me.Archivo = Data.Rows(0)("Archivo").ToString - 'Me.CveSeguimiento = Data.Rows(0)("CveSeguimiento").ToString.ToEntero - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + Me.CveEvento = Data.Rows(0)("CveEvento").ToString().ToEntero() + Me.CveTipoEvento = Data.Rows(0)("CveTipoEvento").ToString().ToEntero() + Me.CveAgendaTipo = Data.Rows(0)("CveAgendaTipo").ToString().ToEntero() + Me.TipoEvento = Data.Rows(0)("TipoEvento").ToString() + Me.Asunto = Data.Rows(0)("Asunto").ToString() + Me.Descripcion = Data.Rows(0)("Descripcion").ToString() + Me.Prioridad = Data.Rows(0)("Prioridad").ToString() + Me.CvePrioridad = Data.Rows(0)("CvePrioridad").ToString().ToEntero() + Me.CveUsuarioDe = Data.Rows(0)("CveUsuarioDe").ToString().ToEntero() + Me.CorreoDe = Data.Rows(0)("CorreoDe").ToString() + Me.UsuarioDe = Data.Rows(0)("UsuarioDe").ToString() + Me.CveUsuarioPara = Data.Rows(0)("CveUsuarioPara").ToString().ToEntero() + Me.UsuarioPara = Data.Rows(0)("UsuarioPara").ToString() + Me.CorreoPara = Data.Rows(0)("CorreoPara").ToString() + Me.CveEventoEstatus = Data.Rows(0)("CveEventoEstatus").ToString().ToEntero() + Me.EventoEstatus = Data.Rows(0)("EventoEstatus").ToString() + Me.FechaInicio = Data.Rows(0)("FechaInicio").ToString().ToDate + Me.FechaFin = Data.Rows(0)("FechaFin").ToString().ToDate + Me.FechaRealTermino = Data.Rows(0)("FechaRealTermino").ToString().ToDate + Me.CveEventoPadre = Data.Rows(0)("CveEventoPadre").ToString().ToEntero() + Me.Orden = Data.Rows(0)("Orden").ToString().ToEntero() + Me.CveRevision = Data.Rows(0)("CveRevision").ToString().ToEntero() + Me.Acuerdos = Data.Rows(0)("Acuerdos").ToString() + Me.Revision = Data.Rows(0)("Revision").ToString() + 'Me.TipoReferencia = Data.Rows(0)("TipoReferencia").ToString() + 'Me.Referencia = Data.Rows(0)("Referencia").ToString() + Me.Archivo = Data.Rows(0)("Archivo").ToString() + 'Me.CveSeguimiento = Data.Rows(0)("CveSeguimiento").ToString().ToEntero() + Me.FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString().ToEntero() End If Retorno = True @@ -1966,8 +1980,8 @@ Public Class ClsOIEventos Public Function GetCircular(CveEmpresa As Integer, Optional CveCircular As Integer = -1, Optional FechaI As String = "-1", Optional FechaF As String = "-1", Optional CveUsuario As Integer = -1) As Boolean - FechaI = If(FechaI = "-1", Today.AddYears(-1).ToString, FechaI) - FechaF = If(FechaF = "-1", Today.AddYears(1).ToString, FechaF) + FechaI = If(FechaI = "-1", Today.AddYears(-1).ToString(), FechaI) + FechaF = If(FechaF = "-1", Today.AddYears(1).ToString(), FechaF) Dim Retorno As Boolean = False @@ -2014,7 +2028,7 @@ Public Class ClsOIEventos Try SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@CveCircular").Value.ToString.ToEntero + Retorno = SqlAdapter.SelectCommand.Parameters("@CveCircular").Value.ToString().ToEntero() Catch ex As Exception OnError("Ocurrió un error al agregar el Circular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index e5f944455..0c2e6a30c 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3561,6 +3561,8 @@ Public Class ClsPaginas PaginaDict.Add("/Default2.aspx".ToUpper(), -1) PaginaDict.Add("/CargaCuentas.aspx".ToUpper(), -1) PaginaDict.Add("/OI/Tareas.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/RepProyectos.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/Proyecto.aspx".ToUpper(), -1) PaginaDict.Add("/AdSistemasTeam/ProcedimientosAlmacenados.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatOrdenesServiciosCaracteristicas.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatOSCaracteristicasOpciones.aspx".ToUpper(), -1) diff --git a/Metronic/assets/global/plugins/GantJS/jsgantt.css b/Metronic/assets/global/plugins/GantJS/jsgantt.css new file mode 100644 index 000000000..7ee316032 --- /dev/null +++ b/Metronic/assets/global/plugins/GantJS/jsgantt.css @@ -0,0 +1,973 @@ +/* Sample CSS for jsGanttImproved v1.8.0 */ + +div.gantt { + font-family: tahoma, arial, verdana, Sans-serif; + font-size: 10px; + color: #656565; +} + +.gantt table { + border-collapse: collapse; +} + +.gantt td { + padding: 0px; +} + +/* cell defaults */ +.headweekends div { + font-size: 8px; + width: 100% !important; + margin: 0; +} + +.gmajorheading, +.gminorheading, +.gminorheadingwkend, +.gtaskcell, +.gtaskcellwkend { + height: 19px; + font-size: 12px; + border: #efefef 1px solid; + text-align: center; + cursor: default +} + + +.gtasklist { + height: 19px; + min-width: 5px; + max-width: 5px; + width: 5px; + border: #efefef 1px solid; + border-right: none; +} + +/* all three width values set just to make sure - helps resizing code */ + +/* Additional values for some cell elements */ + +.gtaskheading, +.gmajorheading, +.gminorheading { + background-color: #ffffff; + font-weight: bold; + font-size: 9px; + white-space: nowrap; +} + +.gtaskcellwkend, +.gminorheadingwkend { + background-color: #f7f7f7; + font-weight: bold; + font-size: 9px; + white-space: nowrap; +} + +td.gtaskcell { + text-align: left +} + +td.gspanning { + border-left: none; + border-right: none; +} + +.gtaskcelldiv { + position: relative; +} + +/* Task list defaults */ + +.gtaskheading, +.gname, +.gtaskname, +.gresource, +.gduration, +.gpccomplete, +.gstartdate, +.gplanstartdate, +.gplanenddate, +.gcost, +.genddate { + height: 18px; + white-space: nowrap; + border: #efefef 1px solid; +} + +.gtaskheading div, +.gname div, +.gtaskname div, +.gresource div, +.gduration div, +.gpccomplete div, +.gstartdate div, +.gplanstartdate div, +.gplanenddate div, +.gcost div, +.genddate div { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.gtaskbarcontainer.gplan { + position: absolute !important; + top: 0px; + opacity: 0.3; + background: white; + z-index: 10000; + border: 1px solid black; +} + +/* Additional values for some task list elements */ + +/* needed for IE8 */ + +.gstartdate div, +.gplanstartdate, +.gplanenddate, +.gstartdate, +.genddate { + text-align: center; + min-width: 105px; + width: 105px; + max-width: 105px; + font-size: 10px; +} + +.gtaskheading { + text-align: center; +} + +.gtaskname div, +/* needed for IE8 */ + +.gtaskname { + min-width: 170px; + max-width: 170px; + width: 170px; + font-size: 9px; + border-left: none; +} + +.gtaskheading, +.gtaskname { + text-overflow: ellipsis; + overflow: hidden; +} + +.gtaskname.gtaskeditable div, +.gtaskname.gtaskeditable { + overflow: unset; +} + +.gselector { + text-align: left; + white-space: nowrap; + min-width: 170px; + max-width: 170px; + width: 170px; +} + +.gformlabel { + position: relative; + top: 0px; + cursor: pointer; + border: #ffffff 1px solid; + margin-left: 2px; + padding-left: 2px; + padding-right: 2px; +} + +span.gformlabel:hover, +span.gselected { + background-color: #dbecff; + border: #cccccc 1px solid; +} + +span.gfoldercollapse { + color: #000000; + cursor: pointer; + font-weight: bold; + font-size: 12px; + font-family: Courier, "Courier New", monospace; +} + +.gtasktableh, +.gtasktable { + border-right: #efefef 1px solid; + width: 100%; +} + +.gcharttableh, +.gtasktableh, +.gtasktable, +.gcharttable { + border-collapse: collapse; +} + +.gcharttable, +.gcharttableh { + table-layout: fixed; +} + +.gcharttable { + border: #efefef 1px solid; +} + +/* for some reason firefox needs this */ + +/* Differentiate Group, Milestone and Ordinary task items (applied to row) */ + +.ggroupitem { + background-color: #fbfbfb; + font-weight: bold; +} + +.gmileitem, +.glineitem { + background-color: #ffffff; +} + +/* highlight row (applied to row) */ + +.gitemhighlight td { + background-image: none; + background-color: #fffde5; +} + +/* task bar caption text styles */ + +.gmilecaption, +.ggroupcaption, +.gcaption { + font-weight: normal; + font-size: 9px; + text-align: left; + white-space: nowrap; + top: 1px; + position: absolute; + top: 2px; +} + +.ggroupcaption, +.gcaption { + right: -126px; +} + +/* Task complete %age bar shared attributes */ + +.gtaskcomplete { + float: left; + overflow: hidden; +} + +/* Task complete %age bar */ + +.gtaskcomplete { + height: 5px; + background-color: #000000; + margin-top: 4px; + opacity: 0.4; + filter: alpha(opacity=40); +} + +/* Milestones */ + +.gmilestone { + font-size: 14px; + position: absolute; + top: -2px; +} + +.gmdtop { + top: 2px; + overflow: hidden; + width: 0px; + height: 0px; + border-bottom: 5px solid black; + border-left: 5px solid transparent; + border-top: 5px solid transparent; + border-right: 5px solid transparent; +} + +.gmdbottom { + top: 2px; + overflow: hidden; + width: 0px; + height: 0px; + border-top: 5px solid black; + border-left: 5px solid transparent; + border-bottom: 5px solid transparent; + border-right: 5px solid transparent; +} + +/* Task bar shared attributes */ + +.ggroupblack, +.gtaskblue, +.gtaskred, +.gtaskgreen, +.gtaskyellow, +.gtaskpurple, +.gtaskpink { + height: 13px; + filter: alpha(opacity=90); + opacity: 0.9; + margin-top: 1px; +} + +/* Task bars - ggroupblack is set as the default class on the task if it is undefined */ + +.ggroupblack { + height: 7px; + background: #000000; + margin-top: 2px; +} + +.ggroupblackendpointleft { + overflow: hidden; + width: 0px; + height: 0px; + top: 2px; + border-top: 4px solid black; + border-left: 4px solid transparent; + border-bottom: 4px solid transparent; + border-right: 4px solid transparent; + float: left; +} + +.ggroupblackendpointright { + overflow: hidden; + width: 0px; + height: 0px; + top: 2px; + border-top: 4px solid black; + border-left: 4px solid transparent; + border-bottom: 4px solid transparent; + border-right: 4px solid transparent; + float: right; +} + +.ggroupblackcomplete { + float: left; + overflow: hidden; + height: 3px; + filter: alpha(opacity=80); + opacity: 0.8; + background-color: #777777; + margin-top: 2px; + margin-bottom: 2px; +} + +.gtaskblue { + background: rgb(58, 132, 195); + /* Old browsers */ + background: linear-gradient(to bottom, rgba(58, 132, 195, 1) 0%, rgba(65, 154, 214, 1) 20%, rgba(75, 184, 240, 1) 40%, rgba(58, 139, 194, 1) 70%, rgba(38, 85, 139, 1) 100%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4bb8f0', endColorstr='#3a84c3', GradientType=0); + /* IE6-9 */ +} + +.gtaskred { + background: rgb(196, 58, 58); + /* Old browsers */ + background: linear-gradient(to bottom, rgba(196, 58, 58, 1) 0%, rgba(211, 65, 65, 1) 20%, rgba(239, 76, 76, 1) 40%, rgba(196, 58, 58, 1) 70%, rgba(135, 37, 37, 1) 100%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ef4c4c', endColorstr='#c43a3a', GradientType=0); + /* IE6-9 */ +} + +.gtaskgreen { + background: rgb(80, 193, 58); + /* Old browsers */ + background: linear-gradient(to bottom, rgba(80, 193, 58, 1) 0%, rgba(88, 209, 64, 1) 20%, rgba(102, 237, 75, 1) 40%, rgba(80, 193, 58, 1) 70%, rgba(53, 132, 37, 1) 100%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#66ED4B', endColorstr='#50c13a', GradientType=0); + /* IE6-9 */ +} + +.gtaskyellow { + background: rgb(247, 228, 56); + /* Old browsers */ + background: linear-gradient(to bottom, rgba(247, 228, 56, 1) 0%, rgba(239, 239, 55, 1) 20%, rgba(255, 255, 58, 1) 40%, rgba(242, 236, 55, 1) 70%, rgba(241, 218, 54, 1) 100%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff3a', endColorstr='#f7e438', GradientType=0); + /* IE6-9 */ +} + +.gtaskpurple { + background: rgb(193, 58, 193); + /* Old browsers */ + background: linear-gradient(to bottom, rgba(193, 58, 193, 1) 0%, rgba(211, 65, 211, 1) 20%, rgba(239, 76, 239, 1) 40%, rgba(193, 58, 193, 1) 70%, rgba(137, 38, 137, 1) 100%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ef4cef', endColorstr='#892689', GradientType=0); + /* IE6-9 */ +} + +.gtaskpink { + background: rgb(249, 177, 245); + /* Old browsers */ + background: linear-gradient(to bottom, rgba(249, 177, 245, 1) 0%, rgba(247, 192, 243, 1) 20%, rgba(247, 202, 244, 1) 40%, rgba(249, 192, 246, 1) 70%, rgba(252, 174, 247, 1) 100%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7caf4', endColorstr='#fcaef7', GradientType=0); + /* IE6-9 */ +} + +.gtaskbluecomplete, +.gtaskredcomplete, +.gtaskgreencomplete, +.gtaskyellowcomplete, +.gtaskpurplecomplete, +.gtaskpinkcomplete { + float: left; + overflow: hidden; + height: 5px; + filter: alpha(opacity=40); + opacity: 0.4; + background-color: #000000; + margin-top: 4px; +} + +/* END Task bar styles */ + +.glinev { + border-left: 1px solid; + width: 0px; +} + +.glineh { + border-top: 1px solid; + height: 0px; +} + +.gDepFS, +.gDepSS, +.gDepSF, +.gDepFF { + border-color: #ff0000; +} + +.gDepFSArw, +.gDepSSArw { + overflow: hidden; + width: 0px; + height: 0px; + border-bottom: 4px solid transparent; + border-left: 4px solid #ff0000; + border-top: 4px solid transparent; + border-right: 4px solid transparent; +} + +.gDepFFArw, +.gDepSFArw { + overflow: hidden; + width: 0px; + height: 0px; + border-bottom: 4px solid transparent; + border-left: 4px solid transparent; + border-top: 4px solid transparent; + border-right: 4px solid #ff0000; +} + +.gCurDate { + border-color: #0000ff; +} + +div.gtaskbarcontainer { + z-index: 1; + position: absolute; + top: 0px +} + +.textbar { + word-break: break-all; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 40%; + display: inline-block; +} + +.JSGanttToolTip { + position: absolute; + display: block; + z-index: 2; +} + +.JSGanttToolTipcont { + font-family: tahoma, arial, verdana; + font-size: 10px; + display: block; + background: #ffffff; + color: #656565 +} + +.gTaskInfo { + background: #dbecff; + width: 400px; + border: #656565 1px solid; + border-radius: 10px; + padding: 4px 6px 4px 6px; + float: left; +} + +.gTtTitle { + display: block; + font-size: 12px; + font-weight: bold; + color: #404040; + margin-left: 4px; + margin-bottom: 1em; +} + +.gTaskLabel { + font-size: 11px; + font-weight: bold; + color: #656565; + margin-left: 4px; +} + +.gTaskText { + position: absolute; + left: 90px; + padding-top: 1px; + font-size: 10px; + font-weight: normal; + color: #656565; +} + +.gTaskNotes { + font-size: 11px; + font-weight: normal; + color: #323232; + padding: 0 15px; + display: block; +} + +.gTIn { + padding-top: 10px; +} + +.gantt { + min-width: 632px; + /* 2x LC width */ +} + +.gchartcontainer { + /* padding-left: 532px; LC width */ + line-height: 1; + /* Overrides inherited CSS (e.g. from Bootstrap) */ + display: flex; +} + +.gcontainercol { + position: relative; +} + +/* Add a max-height value here if wanted */ + +.glistgrid { + min-width: 132px; + /* LC width */ + float: left; + /* LC width */ + padding-right: 0px; + padding-left: 0px; + padding-bottom: 0px; + padding-top: 0px; + background-color: #ffffff; + overflow: hidden; +} + +.glistlbl { + min-width: 132px; + /* LC width */ + float: left; + /* LC width */ + padding-right: 0px; + padding-left: 0px; + padding-bottom: 0px; + padding-top: 0px; + background-color: #ffffff; + overflow: hidden; + flex: none; +} + +.glistlbl, +.gchartgrid { + display: flex; + flex-direction: column; +} + +.glabelfooter { + clear: both; +} + +.ggridfooter { + clear: both; +} + +.rhscrpad { + width: 150px; + position: absolute; + top: 0px; + height: 1px; +} + +.gchartgrid { + padding-right: 0px; + padding-left: 0px; + padding-bottom: 0px; + padding-top: 0px; + background-color: #ffffff; + position: relative; + /* overflow: auto; */ + overflow: unset; + overflow-y: auto; + min-height: 0%; +} + +.gchartlbl { + padding-right: 0px; + padding-left: 0px; + padding-bottom: 0px; + padding-top: 0px; + background-color: #ffffff; + position: relative; + overflow: hidden; + flex: none; +} + +/* Old Internet Explorer version hacks */ + +.gantt { + _height: 100% +} + +/* otherwise the chart disappears! */ + +div .gantt { + /* _width: 1064px; ie6 fixed width */ +} + +div.gchartlbl, +div.gchartgrid { + /* _width: 532px; */ +} + +/* ie6 fixed width */ + +div.glistlbl, +div.glistgrid { + *right: 0px; + /* ie7 pulls the content too far left with the negative margin */ + _right: 532px; + /* but ie6 fixed width needs this */ + _margin-left: -532px; + /* ie6 fixed width */ + float: left; +} + +div.gchartgrid { + *padding-bottom: 20px; + *overflow-y: hidden; +} + +/* variable height design, no need for vertical scroll */ + +td.gmajorheading div { + *overflow: hidden; +} + +/* stops resizing fixed width columns if the text is too wide */ + +td.gspanning div { + *overflow: hidden; +} + +/* stops resizing fixed width columns if the text is too wide */ + +/* border transparency tricks */ + +.ggroupblackendpointleft { + _border-top: 4px solid black; + _border-left: 4px solid pink; + _border-bottom: 4px solid pink; + _border-right: 4px solid pink; + _filter: chroma(color=pink); +} + +.ggroupblackendpointright { + _border-top: 4px solid black; + _border-left: 4px solid pink; + _border-bottom: 4px solid pink; + _border-right: 4px solid pink; + _filter: chroma(color=pink); +} + +.gmdtop { + _border-left: 5px solid pink; + _border-top: 5px solid pink; + _border-right: 5px solid pink; + _filter: chroma(color=pink); +} + +.gmdbottom { + _border-left: 5px solid pink; + _border-bottom: 5px solid pink; + _border-right: 5px solid pink; + _filter: chroma(color=pink); +} + +.gDepFSArw, +.gDepSSArw { + _border-bottom: 4px solid pink; + _border-top: 4px solid pink; + _border-right: 4px solid pink; + _filter: chroma(color=pink); +} + +.gDepFFArw, +.gDepSFArw { + _border-bottom: 4px solid pink; + _border-left: 4px solid pink; + _border-top: 4px solid pink; + _filter: chroma(color=pink); +} + +/* Workaround for odd bug in old versions of Opera - no other browser needs this */ + +.glinediv { + position: absolute; + top: 0px; + left: 0px; + z-index: 1px; +} + +.gantt-inputtable { + max-width: 100%; + max-height: 16px; +} + +.gadditional { + border: #efefef 1px solid; +} + +.gadditional, +.gresource, +.gduration, +.gpccomplete, +.gcost { + text-align: center; + width: 70px; + max-width: 70px; + min-width: 70px; + font-size: 10px; +} + +@media print { + + /* All your print styles go here */ + html, + .gchartgrid { + overflow: unset !important; + } + + .glistgrid { + float: none !important; + } +} + +/* if using setUseSingleCell(1) the following is a suggested set of CSS3 styles to recreate the table grid - won't work on old browsers +.ggrouphour td, +.gmilehour td, +.gitemhour td { background-size: 19px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px); width: 100%; height: 19px; } +.ggroupday td, +.gmileday td, +.gitemday td { background-size: 19px 1px, 133px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px), linear-gradient(to left, #f7f7f7 39px, transparent 1px, transparent 92px); width: 100%; height: 19px; } +.ggroupweek td, +.gmileweek td, +.gitemweek td { background-size: 37px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 36px); width: 100%; height: 19px; } +.ggroupmonth td, +.gmilemonth td, +.gitemmonth td { background-size: 37px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 36px); width: 100%; height: 19px; } +.ggroupquarter td, +.gmilequarter td, +.gitemquarter td { background-size: 19px 1px; background-image: linear-gradient(to left, #efefef, transparent 1px, transparent 18px); width: 100%; height: 19px; } +*/ + +.gmain { + height: 100%; + + display: flex; + flex-direction: column; +} + +.gmainright { + overflow: hidden; + flex: auto; +} + +.gmainleft { + overflow: hidden; + flex: 0 0 50%; +} + +.gtasktableh tr, +.gcharttable tr, +.gcharttableh tr, +.gtasktable tr { + height: 22px !important; +} + +.gtasktableouterwrapper { + overflow: hidden; +} + +.gtasktablewrapper { + overflow-y: scroll; + flex: auto; + height: 100%; +} + +.chartgrid { + overflow: auto; + flex: auto; +} + +/* .gtasktable { + margin-bottom: 14px; +} */ + +/* Printer friendly styles - we could use these all the time but they are not as pretty! */ + +/* note that "@media print" is not supported in IE6 or 7. Fully patched IE8 should be OK */ + +@media print { + .ggroupblack { + height: 0px; + border-top: 7px solid; + border-color: #000000; + } + + .gtaskblue { + height: 0px; + border-top: 13px solid; + border-color: rgb(58, 132, 195); + } + + .gtaskred { + height: 0px; + border-top: 13px solid; + border-color: rgb(196, 58, 58); + } + + .gtaskgreen { + height: 0px; + border-top: 13px solid; + border-color: rgb(80, 193, 58); + } + + .gtaskyellow { + height: 0px; + border-top: 13px solid; + border-color: rgb(247, 228, 56); + } + + .gtaskpurple { + height: 0px; + border-top: 13px solid; + border-color: rgb(193, 58, 193); + } + + .gtaskpink { + height: 0px; + border-top: 13px solid; + border-color: rgb(249, 177, 245); + } + + .gtaskbluecomplete, + .gtaskredcomplete, + .gtaskgreencomplete, + .gtaskyellowcomplete, + .gtaskpurplecomplete, + .gtaskpinkcomplete { + height: 0px; + filter: alpha(opacity=40); + opacity: 0.4; + margin-top: -9px; + border-top: 5px solid; + border-color: #000000; + } + + .ggroupblackcomplete { + height: 0px; + filter: alpha(opacity=80); + opacity: 0.8; + margin-top: -5px; + border-top: 3px solid; + border-color: #777777; + } + + .gmainright, + .gmainleft { + overflow: hidden; + width: auto; + } + + table { + page-break-after: auto + } + + tr { + page-break-inside: avoid; + page-break-after: auto + } + + td { + page-break-inside: avoid; + page-break-after: auto + } + + thead { + display: table-header-group + } + + tfoot { + display: table-footer-group + } +} + +/* Fix for OSx trackpad hiding the scroll bars*/ +.frame::-webkit-scrollbar { + -webkit-appearance: none; +} + +.frame::-webkit-scrollbar:vertical { + width: 11px; +} + +.frame::-webkit-scrollbar:horizontal { + height: 11px; +} + +.frame::-webkit-scrollbar-thumb { + border-radius: 8px; + border: 2px solid white; + /* should match background, can't be transparent */ + background-color: rgba(0, 0, 0, .5); +} + +.frame::-webkit-scrollbar-track { + background-color: #fff; + border-radius: 8px; +} + +.gscrollbar-calculation-container { + visibility: hidden; + overflow: scroll; + -ms-overflow-style: scrollbar; + display: block; +} \ No newline at end of file diff --git a/Metronic/assets/global/plugins/GantJS/jsgantt.js b/Metronic/assets/global/plugins/GantJS/jsgantt.js new file mode 100644 index 000000000..70ee6804d --- /dev/null +++ b/Metronic/assets/global/plugins/GantJS/jsgantt.js @@ -0,0 +1,5129 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSGantt = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0) { + // Process all tasks, reset parent date and completion % if task list has altered + if (this.vProcessNeeded) + task_1.processRows(this.vTaskList, 0, -1, 1, 1, this.getUseSort(), this.vDebug); + this.vProcessNeeded = false; + // get overall min/max dates plus padding + vMinDate = date_utils_1.getMinDate(this.vTaskList, this.vFormat, this.getMinDate() && date_utils_1.coerceDate(this.getMinDate())); + vMaxDate = date_utils_1.getMaxDate(this.vTaskList, this.vFormat, this.getMaxDate() && date_utils_1.coerceDate(this.getMaxDate())); + // Calculate chart width variables. + if (this.vFormat == 'day') + vColWidth = this.vDayColWidth; + else if (this.vFormat == 'week') + vColWidth = this.vWeekColWidth; + else if (this.vFormat == 'month') + vColWidth = this.vMonthColWidth; + else if (this.vFormat == 'quarter') + vColWidth = this.vQuarterColWidth; + else if (this.vFormat == 'hour') + vColWidth = this.vHourColWidth; + // DRAW the Left-side of the chart (names, resources, comp%) + var vLeftHeader = document.createDocumentFragment(); + /** + * LIST HEAD + * + * + * + * HEADINGS + */ + var vTmpDiv = draw_utils_1.newNode(vLeftHeader, 'div', this.vDivId + 'glisthead', 'glistlbl gcontainercol'); + var gListLbl = vTmpDiv; + this.setListBody(vTmpDiv); + var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', null, 'gtasktableh'); + var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody'); + var vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr'); + draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtasklist', '\u00A0'); + var vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gspanning gtaskname', null, null, null, null, this.getColumnOrder().length + 1); + vTmpCell.appendChild(this.drawSelector('top')); + vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr'); + draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtasklist', '\u00A0'); + draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtaskname', '\u00A0'); + this.getColumnOrder().forEach(function (column) { + if (_this[column] == 1 || column === 'vAdditionalHeaders') { + draw_columns_1.draw_task_headings(column, vTmpRow_1, _this.vLangs, _this.vLang, _this.vAdditionalHeaders); + } + }); + /** + * LIST BODY + * + * + */ + var vTmpDiv2 = void 0; + var vTmpContentTabOuterWrapper = draw_utils_1.newNode(vLeftHeader, 'div', null, 'gtasktableouterwrapper'); + var vTmpContentTabWrapper = draw_utils_1.newNode(vTmpContentTabOuterWrapper, 'div', null, 'gtasktablewrapper'); + vTmpContentTabWrapper.style.width = "calc(100% + " + general_utils_1.getScrollbarWidth() + "px)"; + var vTmpContentTab = draw_utils_1.newNode(vTmpContentTabWrapper, 'table', null, 'gtasktable'); + var vTmpContentTBody = draw_utils_1.newNode(vTmpContentTab, 'tbody'); + var _loop_1 = function (i_1) { + var vBGColor = void 0; + if (this_1.vTaskList[i_1].getGroup() == 1) + vBGColor = 'ggroupitem'; + else + vBGColor = 'glineitem'; + vID = this_1.vTaskList[i_1].getID(); + if ((!(this_1.vTaskList[i_1].getParItem() && this_1.vTaskList[i_1].getParItem().getGroup() == 2)) || this_1.vTaskList[i_1].getGroup() == 2) { + if (this_1.vTaskList[i_1].getVisible() == 0) + vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor, null, null, null, 'none'); + else + vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor); + this_1.vTaskList[i_1].setListChildRow(vTmpRow_1); + draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtasklist', '\u00A0'); + var editableClass = this_1.vEditable ? 'gtaskname gtaskeditable' : 'gtaskname'; + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, editableClass); + var vCellContents = ''; + for (var j_1 = 1; j_1 < this_1.vTaskList[i_1].getLevel(); j_1++) { + vCellContents += '\u00A0\u00A0\u00A0\u00A0'; + } + var task_2 = this_1.vTaskList[i_1]; + var vEventClickRow_1 = this_1.vEventClickRow; + events_1.addListener('click', function (e) { + if (e.target.classList.contains('gfoldercollapse') === false && + vEventClickRow_1 && typeof vEventClickRow_1 === "function") { + vEventClickRow_1(task_2); + } + }, vTmpRow_1); + if (this_1.vTaskList[i_1].getGroup() == 1) { + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, vCellContents); + var vTmpSpan = draw_utils_1.newNode(vTmpDiv, 'span', this_1.vDivId + 'group_' + vID, 'gfoldercollapse', (this_1.vTaskList[i_1].getOpen() == 1) ? '-' : '+'); + this_1.vTaskList[i_1].setGroupSpan(vTmpSpan); + events_1.addFolderListeners(this_1, vTmpSpan, vID); + var divTask = document.createElement('span'); + divTask.innerHTML = '\u00A0' + this_1.vTaskList[i_1].getName(); + vTmpDiv.appendChild(divTask); + // const text = makeInput(this.vTaskList[i].getName(), this.vEditable, 'text'); + // vTmpDiv.appendChild(document.createNode(text)); + var callback = function (task, e) { return task.setName(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, this_1.vEventsChange, callback, this_1.vTaskList[i_1], 'taskname', this_1.Draw.bind(this_1)); + events_1.addListenerClickCell(vTmpDiv, this_1.vEvents, this_1.vTaskList[i_1], 'taskname'); + } + else { + vCellContents += '\u00A0\u00A0\u00A0\u00A0'; + var text = draw_utils_1.makeInput(this_1.vTaskList[i_1].getName(), this_1.vEditable, 'text'); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, vCellContents + text); + var callback = function (task, e) { return task.setName(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, this_1.vEventsChange, callback, this_1.vTaskList[i_1], 'taskname', this_1.Draw.bind(this_1)); + events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i_1], 'taskname'); + } + this_1.getColumnOrder().forEach(function (column) { + if (_this[column] == 1 || column === 'vAdditionalHeaders') { + draw_columns_1.draw_header(column, i_1, vTmpRow_1, _this.vTaskList, _this.vEditable, _this.vEventsChange, _this.vEvents, _this.vDateTaskTableDisplayFormat, _this.vAdditionalHeaders, _this.vFormat, _this.vLangs, _this.vLang, _this.vResources, _this.Draw); + } + }); + vNumRows++; + } + }; + var this_1 = this; + for (var i_1 = 0; i_1 < this.vTaskList.length; i_1++) { + _loop_1(i_1); + } + // DRAW the date format selector at bottom left. + vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr'); + draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtasklist', '\u00A0'); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gspanning gtaskname'); + vTmpCell.appendChild(this.drawSelector('bottom')); + this.getColumnOrder().forEach(function (column) { + if (_this[column] == 1 || column === 'vAdditionalHeaders') { + draw_columns_1.draw_bottom(column, vTmpRow_1, _this.vAdditionalHeaders); + } + }); + // Add some white space so the vertical scroll distance should always be greater + // than for the right pane (keep to a minimum as it is seen in unconstrained height designs) + // newNode(vTmpDiv2, 'br'); + // newNode(vTmpDiv2, 'br'); + /** + * CHART HEAD + * + * + * HEADINGS + */ + var vRightHeader = document.createDocumentFragment(); + vTmpDiv = draw_utils_1.newNode(vRightHeader, 'div', this.vDivId + 'gcharthead', 'gchartlbl gcontainercol'); + var gChartLbl = vTmpDiv; + this.setChartHead(vTmpDiv); + vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', this.vDivId + 'chartTableh', 'gcharttableh'); + vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody'); + vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr'); + vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate()); + if (this.vFormat == 'hour') + vTmpDate.setHours(vMinDate.getHours()); + else + vTmpDate.setHours(0); + vTmpDate.setMinutes(0); + vTmpDate.setSeconds(0); + vTmpDate.setMilliseconds(0); + var vColSpan = 1; + // Major Date Header + while (vTmpDate.getTime() <= vMaxDate.getTime()) { + var vHeaderCellClass = 'gmajorheading'; + var vCellContents = ''; + if (this.vFormat == 'day') { + var colspan = 7; + if (!this.vShowWeekends) { + vHeaderCellClass += ' headweekends'; + colspan = 5; + } + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass, null, null, null, null, colspan); + vCellContents += date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]); + vTmpDate.setDate(vTmpDate.getDate() + 6); + if (this.vShowEndWeekDate == 1) + vCellContents += ' - ' + date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]); + draw_utils_1.newNode(vTmpCell, 'div', null, null, vCellContents, vColWidth * colspan); + vTmpDate.setDate(vTmpDate.getDate() + 1); + } + else if (this.vFormat == 'week') { + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass, null, vColWidth); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + vTmpDate.setDate(vTmpDate.getDate() + 7); + } + else if (this.vFormat == 'month') { + vColSpan = (12 - vTmpDate.getMonth()); + if (vTmpDate.getFullYear() == vMaxDate.getFullYear()) + vColSpan -= (11 - vMaxDate.getMonth()); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); + vTmpDate.setFullYear(vTmpDate.getFullYear() + 1, 0, 1); + } + else if (this.vFormat == 'quarter') { + vColSpan = (4 - Math.floor(vTmpDate.getMonth() / 3)); + if (vTmpDate.getFullYear() == vMaxDate.getFullYear()) + vColSpan -= (3 - Math.floor(vMaxDate.getMonth() / 3)); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); + vTmpDate.setFullYear(vTmpDate.getFullYear() + 1, 0, 1); + } + else if (this.vFormat == 'hour') { + vColSpan = (24 - vTmpDate.getHours()); + if (vTmpDate.getFullYear() == vMaxDate.getFullYear() && + vTmpDate.getMonth() == vMaxDate.getMonth() && + vTmpDate.getDate() == vMaxDate.getDate()) + vColSpan -= (23 - vMaxDate.getHours()); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); + vTmpDate.setHours(0); + vTmpDate.setDate(vTmpDate.getDate() + 1); + } + } + vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr'); + // Minor Date header and Cell Rows + vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate()); // , vMinDate.getHours() + if (this.vFormat == 'hour') + vTmpDate.setHours(vMinDate.getHours()); + vNumCols = 0; + while (vTmpDate.getTime() <= vMaxDate.getTime()) { + var vHeaderCellClass = 'gminorheading'; + if (this.vFormat == 'day') { + if (vTmpDate.getDay() % 6 == 0) { + if (!this.vShowWeekends) { + vTmpDate.setDate(vTmpDate.getDate() + 1); + continue; + } + vHeaderCellClass += 'wkend'; + } + if (vTmpDate <= vMaxDate) { + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vDayMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + vNumCols++; + } + vTmpDate.setDate(vTmpDate.getDate() + 1); + } + else if (this.vFormat == 'week') { + if (vTmpDate <= vMaxDate) { + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + vNumCols++; + } + vTmpDate.setDate(vTmpDate.getDate() + 7); + } + else if (this.vFormat == 'month') { + if (vTmpDate <= vMaxDate) { + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + vNumCols++; + } + vTmpDate.setDate(vTmpDate.getDate() + 1); + while (vTmpDate.getDate() > 1) { + vTmpDate.setDate(vTmpDate.getDate() + 1); + } + } + else if (this.vFormat == 'quarter') { + if (vTmpDate <= vMaxDate) { + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + vNumCols++; + } + vTmpDate.setDate(vTmpDate.getDate() + 81); + while (vTmpDate.getDate() > 1) + vTmpDate.setDate(vTmpDate.getDate() + 1); + } + else if (this.vFormat == 'hour') { + for (var i_2 = vTmpDate.getHours(); i_2 < 24; i_2++) { + vTmpDate.setHours(i_2); //works around daylight savings but may look a little odd on days where the clock goes forward + if (vTmpDate <= vMaxDate) { + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, vHeaderCellClass); + draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + vNumCols++; + } + } + vTmpDate.setHours(0); + vTmpDate.setDate(vTmpDate.getDate() + 1); + } + } + vDateRow = vTmpRow_1; + // Calculate size of grids : Plus 3 because 1 border left + 2 of paddings + vTaskLeftPx = (vNumCols * (vColWidth + 3)) + 1; + // Fix a small space at the end for day + if (this.vFormat === 'day') { + vTaskLeftPx += 2; + } + vTmpTab.style.width = vTaskLeftPx + 'px'; // Ensure that the headings has exactly the same width as the chart grid + vTaskPlanLeftPx = (vNumCols * (vColWidth + 3)) + 1; + if (this.vUseSingleCell != 0 && this.vUseSingleCell < (vNumCols * vNumRows)) + vSingleCell = true; + draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1); + vTmpDiv = draw_utils_1.newNode(vRightHeader, 'div', null, 'glabelfooter'); + /** + * CHART GRID + * + * + * + */ + var vRightTable = document.createDocumentFragment(); + vTmpDiv = draw_utils_1.newNode(vRightTable, 'div', this.vDivId + 'gchartbody', 'gchartgrid gcontainercol'); + this.setChartBody(vTmpDiv); + vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', this.vDivId + 'chartTable', 'gcharttable', null, vTaskLeftPx); + this.setChartTable(vTmpTab); + draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1); + vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody'); + events_1.syncScroll([vTmpContentTabWrapper, vTmpDiv], 'scrollTop'); + events_1.syncScroll([gChartLbl, vTmpDiv], 'scrollLeft'); + events_1.syncScroll([vTmpContentTabWrapper, gListLbl], 'scrollLeft'); + // Draw each row + var i = 0; + var j = 0; + var bd_1; + if (this.vDebug) { + bd_1 = new Date(); + console.log('before tasks loop', bd_1); + } + for (i = 0; i < this.vTaskList.length; i++) { + var curTaskStart = this.vTaskList[i].getStart() ? this.vTaskList[i].getStart() : this.vTaskList[i].getPlanStart(); + var curTaskEnd = this.vTaskList[i].getEnd() ? this.vTaskList[i].getEnd() : this.vTaskList[i].getPlanEnd(); + vTaskLeftPx = general_utils_1.getOffset(vMinDate, curTaskStart, vColWidth, this.vFormat, this.vShowWeekends); + vTaskRightPx = general_utils_1.getOffset(curTaskStart, curTaskEnd, vColWidth, this.vFormat, this.vShowWeekends); + var curTaskPlanStart = void 0, curTaskPlanEnd = void 0; + curTaskPlanStart = this.vTaskList[i].getPlanStart(); + curTaskPlanEnd = this.vTaskList[i].getPlanEnd(); + if (curTaskPlanStart && curTaskPlanEnd) { + vTaskPlanLeftPx = general_utils_1.getOffset(vMinDate, curTaskPlanStart, vColWidth, this.vFormat, this.vShowWeekends); + vTaskPlanRightPx = general_utils_1.getOffset(curTaskPlanStart, curTaskPlanEnd, vColWidth, this.vFormat, this.vShowWeekends); + } + else { + vTaskPlanLeftPx = vTaskPlanRightPx = 0; + } + vID = this.vTaskList[i].getID(); + var vComb = (this.vTaskList[i].getParItem() && this.vTaskList[i].getParItem().getGroup() == 2); + var vCellFormat = ''; + var vTmpItem = this.vTaskList[i]; + var vCaptClass = null; + // set cell width only for first row because of table-layout:fixed + var taskCellWidth = i === 0 ? vColWidth : null; + if (this.vTaskList[i].getMile() && !vComb) { + vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, 'gmileitem gmile' + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null)); + this.vTaskList[i].setChildRow(vTmpRow_1); + events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow_1); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtaskcell', null, taskCellWidth); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); + vTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx + vTaskRightPx - 6); + this.vTaskList[i].setBarDiv(vTmpDiv); + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, 12); + this.vTaskList[i].setTaskDiv(vTmpDiv2); + if (this.vTaskList[i].getCompVal() < 100) + vTmpDiv2.appendChild(document.createTextNode('\u25CA')); + else { + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmilediamond'); + draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmdtop'); + draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmdbottom'); + } + vCaptClass = 'gmilecaption'; + if (!vSingleCell && !vComb) { + vCellFormat = ''; + for (j = 0; j < vNumCols - 1; j++) { + if (this.vShowWeekends !== false && this.vFormat == 'day' && ((j % 7 == 4) || (j % 7 == 5))) + vCellFormat = 'gtaskcellwkend'; + else + vCellFormat = 'gtaskcell'; + draw_utils_1.newNode(vTmpRow_1, 'td', null, vCellFormat, '\u00A0\u00A0', taskCellWidth); + } + } + } + else { + vTaskWidth = vTaskRightPx; + // Draw Group Bar which has outer div with inner group div + // and several small divs to left and right to create angled-end indicators + if (this.vTaskList[i].getGroup()) { + vTaskWidth = (vTaskWidth > this.vMinGpLen && vTaskWidth < this.vMinGpLen * 2) ? this.vMinGpLen * 2 : vTaskWidth; // Expand to show two end points + vTaskWidth = (vTaskWidth < this.vMinGpLen) ? this.vMinGpLen : vTaskWidth; // expand to show one end point + vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, ((this.vTaskList[i].getGroup() == 2) ? 'glineitem gitem' : 'ggroupitem ggroup') + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null)); + this.vTaskList[i].setChildRow(vTmpRow_1); + events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow_1); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtaskcell', null, taskCellWidth); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); + this.vTaskList[i].setCellDiv(vTmpDiv); + if (this.vTaskList[i].getGroup() == 1) { + vTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, vTaskWidth, vTaskLeftPx); + this.vTaskList[i].setBarDiv(vTmpDiv); + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, vTaskWidth); + this.vTaskList[i].setTaskDiv(vTmpDiv2); + draw_utils_1.newNode(vTmpDiv2, 'div', this.vDivId + 'complete_' + vID, this.vTaskList[i].getClass() + 'complete', null, this.vTaskList[i].getCompStr()); + draw_utils_1.newNode(vTmpDiv, 'div', null, this.vTaskList[i].getClass() + 'endpointleft'); + if (vTaskWidth >= this.vMinGpLen * 2) + draw_utils_1.newNode(vTmpDiv, 'div', null, this.vTaskList[i].getClass() + 'endpointright'); + vCaptClass = 'ggroupcaption'; + } + if (!vSingleCell && !vComb) { + vCellFormat = ''; + for (j = 0; j < vNumCols - 1; j++) { + if (this.vShowWeekends !== false && this.vFormat == 'day' && ((j % 7 == 4) || (j % 7 == 5))) + vCellFormat = 'gtaskcellwkend'; + else + vCellFormat = 'gtaskcell'; + draw_utils_1.newNode(vTmpRow_1, 'td', null, vCellFormat, '\u00A0\u00A0', taskCellWidth); + } + } + } + else { + vTaskWidth = (vTaskWidth <= 0) ? 1 : vTaskWidth; + /** + * DRAW THE BOXES FOR GANTT + */ + var vTmpDivCell = void 0; + if (vComb) { + vTmpDivCell = vTmpDiv = this.vTaskList[i].getParItem().getCellDiv(); + } + else { + // Draw Task Bar which has colored bar div + vTmpRow_1 = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, 'glineitem gitem' + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null)); + this.vTaskList[i].setChildRow(vTmpRow_1); + events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow_1); + vTmpCell = draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtaskcell', null, taskCellWidth); + vTmpDivCell = vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); + } + // DRAW TASK BAR + vTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, vTaskWidth, vTaskLeftPx); + this.vTaskList[i].setBarDiv(vTmpDiv); + if (this.vTaskList[i].getStartVar()) { + // textbar + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, vTaskWidth); + if (this.vTaskList[i].getBarText()) { + draw_utils_1.newNode(vTmpDiv2, 'span', this.vDivId + 'tasktextbar_' + vID, 'textbar', this.vTaskList[i].getBarText(), this.vTaskList[i].getCompRestStr()); + } + this.vTaskList[i].setTaskDiv(vTmpDiv2); + } + // PLANNED + // If they are different, show plan bar... show if there is no real vStart as well (just plan dates) + if (vTaskPlanLeftPx && (vTaskPlanLeftPx != vTaskLeftPx || !this.vTaskList[i].getStartVar())) { + var vTmpPlanDiv = draw_utils_1.newNode(vTmpDivCell, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer gplan', null, vTaskPlanRightPx, vTaskPlanLeftPx); + var vTmpPlanDiv2 = draw_utils_1.newNode(vTmpPlanDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass() + ' gplan', null, vTaskPlanRightPx); + this.vTaskList[i].setPlanTaskDiv(vTmpPlanDiv2); + } + // and opaque completion div + draw_utils_1.newNode(vTmpDiv2, 'div', this.vDivId + 'complete_' + vID, this.vTaskList[i].getClass() + 'complete', null, this.vTaskList[i].getCompStr()); + // caption + if (vComb) + vTmpItem = this.vTaskList[i].getParItem(); + if (!vComb || (vComb && this.vTaskList[i].getParItem().getEnd() == this.vTaskList[i].getEnd())) + vCaptClass = 'gcaption'; + // Background cells + if (!vSingleCell && !vComb) { + vCellFormat = ''; + for (j = 0; j < vNumCols - 1; j++) { + if (this.vShowWeekends !== false && this.vFormat == 'day' && ((j % 7 == 4) || (j % 7 == 5))) + vCellFormat = 'gtaskcellwkend'; + else + vCellFormat = 'gtaskcell'; + draw_utils_1.newNode(vTmpRow_1, 'td', null, vCellFormat, '\u00A0\u00A0'); + } + } + } + } + if (this.getCaptionType() && vCaptClass !== null) { + var vCaptionStr = void 0; + switch (this.getCaptionType()) { + case 'Caption': + vCaptionStr = vTmpItem.getCaption(); + break; + case 'Resource': + vCaptionStr = vTmpItem.getResource(); + break; + case 'Duration': + vCaptionStr = vTmpItem.getDuration(this.vFormat, this.vLangs[this.vLang]); + break; + case 'Complete': + vCaptionStr = vTmpItem.getCompStr(); + break; + } + draw_utils_1.newNode(vTmpDiv, 'div', null, vCaptClass, vCaptionStr, 120, (vCaptClass == 'gmilecaption') ? 12 : 0); + } + // Add Task Info div for tooltip + if (this.vTaskList[i].getTaskDiv() && vTmpDiv) { + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'tt' + vID, null, null, null, null, 'none'); + var _a = this.createTaskInfo(this.vTaskList[i], this.vTooltipTemplate), component = _a.component, callback = _a.callback; + vTmpDiv2.appendChild(component); + events_1.addTooltipListeners(this, this.vTaskList[i].getTaskDiv(), vTmpDiv2, callback); + } + // Add Plan Task Info div for tooltip + if (this.vTaskList[i].getPlanTaskDiv() && vTmpDiv) { + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv, 'div', this.vDivId + 'tt' + vID, null, null, null, null, 'none'); + var _b = this.createTaskInfo(this.vTaskList[i], this.vTooltipTemplate), component = _b.component, callback = _b.callback; + vTmpDiv2.appendChild(component); + events_1.addTooltipListeners(this, this.vTaskList[i].getPlanTaskDiv(), vTmpDiv2, callback); + } + } + if (this.vDebug) { + var ad = new Date(); + console.log('after tasks loop', ad, (ad.getTime() - bd_1.getTime())); + } + if (!vSingleCell) { + vTmpTBody.appendChild(vDateRow.cloneNode(true)); + } + else if (this.vFormat == 'day') { + vTmpTBody.appendChild(document.createElement('tr')); + } + // MAIN VIEW: Appending all generated components to main view + while (this.vDiv.hasChildNodes()) + this.vDiv.removeChild(this.vDiv.firstChild); + vTmpDiv = draw_utils_1.newNode(this.vDiv, 'div', null, 'gchartcontainer'); + vTmpDiv.style.height = this.vTotalHeight; + var leftvTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', null, 'gmain gmainleft'); + leftvTmpDiv.appendChild(vLeftHeader); + // leftvTmpDiv.appendChild(vLeftTable); + var rightvTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', null, 'gmain gmainright'); + rightvTmpDiv.appendChild(vRightHeader); + rightvTmpDiv.appendChild(vRightTable); + vTmpDiv.appendChild(leftvTmpDiv); + vTmpDiv.appendChild(rightvTmpDiv); + draw_utils_1.newNode(vTmpDiv, 'div', null, 'ggridfooter'); + vTmpDiv2 = draw_utils_1.newNode(this.getChartBody(), 'div', this.vDivId + 'Lines', 'glinediv'); + if (this.vEvents.onLineContainerHover && typeof this.vEvents.onLineContainerHover === 'function') { + events_1.addListener('mouseover', this.vEvents.onLineContainerHover, vTmpDiv2); + events_1.addListener('mouseout', this.vEvents.onLineContainerHover, vTmpDiv2); + } + vTmpDiv2.style.visibility = 'hidden'; + this.setLines(vTmpDiv2); + /* Quick hack to show the generated HTML on older browsers - add a '/' to the begining of this line to activate + let tmpGenSrc=document.createElement('textarea'); + tmpGenSrc.appendChild(document.createTextNode(vTmpDiv.innerHTML)); + vDiv.appendChild(tmpGenSrc); + //*/ + // LISTENERS: Now all the content exists, register scroll listeners + events_1.addScrollListeners(this); + // now check if we are actually scrolling the pane + if (this.vScrollTo != '') { + var vScrollDate = new Date(vMinDate.getTime()); + var vScrollPx = 0; + if (this.vScrollTo.substr && this.vScrollTo.substr(0, 2) == 'px') { + vScrollPx = parseInt(this.vScrollTo.substr(2)); + } + else { + if (this.vScrollTo === 'today') { + vScrollDate = new Date(); + } + else if (this.vScrollTo instanceof Date) { + vScrollDate = this.vScrollTo; + } + else { + vScrollDate = date_utils_1.parseDateStr(this.vScrollTo, this.getDateInputFormat()); + } + if (this.vFormat == 'hour') + vScrollDate.setMinutes(0, 0, 0); + else + vScrollDate.setHours(0, 0, 0, 0); + vScrollPx = general_utils_1.getOffset(vMinDate, vScrollDate, vColWidth, this.vFormat, this.vShowWeekends) - 30; + } + this.getChartBody().scrollLeft = vScrollPx; + } + if (vMinDate.getTime() <= (new Date()).getTime() && vMaxDate.getTime() >= (new Date()).getTime()) + this.vTodayPx = general_utils_1.getOffset(vMinDate, new Date(), vColWidth, this.vFormat, this.vShowWeekends); + else + this.vTodayPx = -1; + // Dependencies + var bdd = void 0; + if (this.vDebug) { + bdd = new Date(); + console.log('before DrawDependencies', bdd); + } + if (this.vEvents && typeof this.vEvents.beforeLineDraw === 'function') { + this.vEvents.beforeLineDraw(); + } + this.DrawDependencies(this.vDebug); + events_1.addListenerDependencies(this.vLineOptions); + if (this.vEvents && typeof this.vEvents.afterLineDraw === 'function') { + this.vEvents.afterLineDraw(); + } + if (this.vDebug) { + var ad = new Date(); + console.log('after DrawDependencies', ad, (ad.getTime() - bdd.getTime())); + } + } + if (this.vDebug) { + var ad = new Date(); + console.log('after draw', ad, (ad.getTime() - bd.getTime())); + } + events_1.updateGridHeaderWidth(this); + this.chartRowDateToX = function (date) { + return general_utils_1.getOffset(vMinDate, date, vColWidth, this.vFormat, this.vShowWeekends); + }; + if (this.vEvents && this.vEvents.afterDraw) { + this.vEvents.afterDraw(); + } + }; //this.draw + if (this.vDiv && this.vDiv.nodeName.toLowerCase() == 'div') + this.vDivId = this.vDiv.id; +}; //GanttChart + +},{"./draw_columns":3,"./draw_dependencies":4,"./events":5,"./lang":8,"./options":9,"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13,"./xml":14}],3:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var date_utils_1 = require("./utils/date_utils"); +var task_1 = require("./task"); +var events_1 = require("./events"); +var draw_utils_1 = require("./utils/draw_utils"); +exports.COLUMN_ORDER = [ + 'vShowRes', + 'vShowDur', + 'vShowComp', + 'vShowStartDate', + 'vShowEndDate', + 'vShowPlanStartDate', + 'vShowPlanEndDate', + 'vShowCost', + 'vAdditionalHeaders', + 'vShowAddEntries' +]; +exports.draw_header = function (column, i, vTmpRow, vTaskList, vEditable, vEventsChange, vEvents, vDateTaskTableDisplayFormat, vAdditionalHeaders, vFormat, vLangs, vLang, vResources, Draw) { + var vTmpCell, vTmpDiv; + if ('vShowRes' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gresource'); + var text = draw_utils_1.makeInput(vTaskList[i].getResource(), vEditable, 'resource', vTaskList[i].getResource(), vResources); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setResource(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'res', Draw, 'change'); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'res'); + } + if ('vShowDur' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gduration'); + var text = draw_utils_1.makeInput(vTaskList[i].getDuration(vFormat, vLangs[vLang]), vEditable, 'text', vTaskList[i].getDuration()); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setDuration(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'dur', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'dur'); + } + if ('vShowComp' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gpccomplete'); + var text = draw_utils_1.makeInput(vTaskList[i].getCompStr(), vEditable, 'percentage', vTaskList[i].getCompVal()); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { task.setComp(e.target.value); task.setCompVal(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'comp', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'comp'); + } + if ('vShowStartDate' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gstartdate'); + var v = date_utils_1.formatDateStr(vTaskList[i].getStart(), vDateTaskTableDisplayFormat, vLangs[vLang]); + var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getStart()); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setStart(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'start', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'start'); + } + if ('vShowEndDate' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'genddate'); + var v = date_utils_1.formatDateStr(vTaskList[i].getEnd(), vDateTaskTableDisplayFormat, vLangs[vLang]); + var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getEnd()); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setEnd(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'end', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'end'); + } + if ('vShowPlanStartDate' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gplanstartdate'); + var v = vTaskList[i].getPlanStart() ? date_utils_1.formatDateStr(vTaskList[i].getPlanStart(), vDateTaskTableDisplayFormat, vLangs[vLang]) : ''; + var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getPlanStart()); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setPlanStart(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'planstart', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'planstart'); + } + if ('vShowPlanEndDate' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gplanenddate'); + var v = vTaskList[i].getPlanEnd() ? date_utils_1.formatDateStr(vTaskList[i].getPlanEnd(), vDateTaskTableDisplayFormat, vLangs[vLang]) : ''; + var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getPlanEnd()); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setPlanEnd(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'planend', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'planend'); + } + if ('vShowCost' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gcost'); + var text = draw_utils_1.makeInput(vTaskList[i].getCost(), vEditable, 'cost'); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text); + var callback = function (task, e) { return task.setCost(e.target.value); }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'cost', Draw); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'cost'); + } + if ('vAdditionalHeaders' == column && vAdditionalHeaders) { + for (var key in vAdditionalHeaders) { + var header = vAdditionalHeaders[key]; + var css = header.class ? header.class : "gadditional-" + key; + var data = vTaskList[i].getDataObject(); + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, "gadditional " + css); + // const callback = (task, e) => task.setCost(e.target.value); + // addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'costdate'); + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, data ? data[key] : ''); + } + } + if ('vShowAddEntries' == column) { + vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gaddentries'); + var button = ""; + vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, button); + var callback = function (task, e) { + task_1.AddTaskItemObject({ + vParent: task.getParent() + }); + }; + events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList[i], 'addentries', Draw.bind(this)); + events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'addentries'); + } +}; +exports.draw_bottom = function (column, vTmpRow, vAdditionalHeaders) { + if ('vShowRes' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gresource', '\u00A0'); + if ('vShowDur' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gduration', '\u00A0'); + if ('vShowComp' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gpccomplete', '\u00A0'); + if ('vShowStartDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gstartdate', '\u00A0'); + if ('vShowEndDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning genddate', '\u00A0'); + if ('vShowPlanStartDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gplanstartdate', '\u00A0'); + if ('vShowPlanEndDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gplanenddate', '\u00A0'); + if ('vShowCost' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gcost', '\u00A0'); + if ('vAdditionalHeaders' == column && vAdditionalHeaders) { + for (var key in vAdditionalHeaders) { + var header = vAdditionalHeaders[key]; + var css = header.class ? header.class : "gadditional-" + key; + draw_utils_1.newNode(vTmpRow, 'td', null, "gspanning gadditional " + css, '\u00A0'); + } + } + if ('vShowAddEntries' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gaddentries', '\u00A0'); +}; +exports.draw_list_headings = function (column, vTmpRow, vAdditionalHeaders) { + if ('vShowRes' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gresource', '\u00A0'); + if ('vShowDur' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gduration', '\u00A0'); + if ('vShowComp' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gpccomplete', '\u00A0'); + if ('vShowStartDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gstartdate', '\u00A0'); + if ('vShowEndDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning genddate', '\u00A0'); + if ('vShowPlanStartDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gstartdate', '\u00A0'); + if ('vShowPlanEndDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gplanenddate', '\u00A0'); + if ('vShowCost' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gcost', '\u00A0'); + if ('vAdditionalHeaders' == column && vAdditionalHeaders) { + for (var key in vAdditionalHeaders) { + var header = vAdditionalHeaders[key]; + var css = header.class ? header.class : "gadditional-" + key; + draw_utils_1.newNode(vTmpRow, 'td', null, "gspanning gadditional " + css, '\u00A0'); + } + } + if ('vShowAddEntries' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gaddentries', '\u00A0'); +}; +exports.draw_task_headings = function (column, vTmpRow, vLangs, vLang, vAdditionalHeaders) { + if ('vShowRes' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gresource', vLangs[vLang]['resource']); + if ('vShowDur' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gduration', vLangs[vLang]['duration']); + if ('vShowComp' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gpccomplete', vLangs[vLang]['comp']); + if ('vShowStartDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gstartdate', vLangs[vLang]['startdate']); + if ('vShowEndDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading genddate', vLangs[vLang]['enddate']); + if ('vShowPlanStartDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gplanstartdate', vLangs[vLang]['planstartdate']); + if ('vShowPlanEndDate' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gplanenddate', vLangs[vLang]['planenddate']); + if ('vShowCost' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gcost', vLangs[vLang]['cost']); + if ('vAdditionalHeaders' == column && vAdditionalHeaders) { + for (var key in vAdditionalHeaders) { + var header = vAdditionalHeaders[key]; + var text = header.translate ? vLangs[vLang][header.translate] : header.title; + var css = header.class ? header.class : "gadditional-" + key; + draw_utils_1.newNode(vTmpRow, 'td', null, "gtaskheading gadditional " + css, text); + } + } + if ('vShowAddEntries' == column) + draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskheading gaddentries', vLangs[vLang]['addentries']); +}; + +},{"./events":5,"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12}],4:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.drawDependency = function (x1, y1, x2, y2, pType, pClass) { + var vDir = 1; + var vBend = false; + var vShort = 4; + var vRow = Math.floor(this.getRowHeight() / 2); + if (y2 < y1) + vRow *= -1; + switch (pType) { + case 'SF': + vShort *= -1; + if (x1 - 10 <= x2 && y1 != y2) + vBend = true; + vDir = -1; + break; + case 'SS': + if (x1 < x2) + vShort *= -1; + else + vShort = x2 - x1 - (2 * vShort); + break; + case 'FF': + if (x1 <= x2) + vShort = x2 - x1 + (2 * vShort); + vDir = -1; + break; + default: + if (x1 + 10 >= x2 && y1 != y2) + vBend = true; + break; + } + if (vBend) { + this.sLine(x1, y1, x1 + vShort, y1, pClass); + this.sLine(x1 + vShort, y1, x1 + vShort, y2 - vRow, pClass); + this.sLine(x1 + vShort, y2 - vRow, x2 - (vShort * 2), y2 - vRow, pClass); + this.sLine(x2 - (vShort * 2), y2 - vRow, x2 - (vShort * 2), y2, pClass); + this.sLine(x2 - (vShort * 2), y2, x2 - (1 * vDir), y2, pClass); + } + else if (y1 != y2) { + this.sLine(x1, y1, x1 + vShort, y1, pClass); + this.sLine(x1 + vShort, y1, x1 + vShort, y2, pClass); + this.sLine(x1 + vShort, y2, x2 - (1 * vDir), y2, pClass); + } + else + this.sLine(x1, y1, x2 - (1 * vDir), y2, pClass); + var vTmpDiv = this.sLine(x2, y2, x2 - 3 - ((vDir < 0) ? 1 : 0), y2 - 3 - ((vDir < 0) ? 1 : 0), pClass + "Arw"); + vTmpDiv.style.width = '0px'; + vTmpDiv.style.height = '0px'; +}; +exports.DrawDependencies = function (vDebug) { + if (vDebug === void 0) { vDebug = false; } + if (this.getShowDeps() == 1) { + this.CalcTaskXY(); //First recalculate the x,y + this.clearDependencies(); + var vList = this.getList(); + for (var i = 0; i < vList.length; i++) { + var vDepend = vList[i].getDepend(); + var vDependType = vList[i].getDepType(); + var n = vDepend.length; + if (n > 0 && vList[i].getVisible() == 1) { + for (var k = 0; k < n; k++) { + var vTask = this.getArrayLocationByID(vDepend[k]); + if (vTask >= 0 && vList[vTask].getGroup() != 2) { + if (vList[vTask].getVisible() == 1) { + if (vDebug) { + console.log("init drawDependency ", vList[vTask].getID(), new Date()); + } + var cssClass = 'gDepId' + vList[vTask].getID() + + ' ' + 'gDepNextId' + vList[i].getID(); + var dependedData = vList[vTask].getDataObject(); + var nextDependedData = vList[i].getDataObject(); + if (dependedData && dependedData.pID && nextDependedData && nextDependedData.pID) { + cssClass += ' gDepDataId' + dependedData.pID + ' ' + 'gDepNextDataId' + nextDependedData.pID; + } + if (vDependType[k] == 'SS') + this.drawDependency(vList[vTask].getStartX() - 1, vList[vTask].getStartY(), vList[i].getStartX() - 1, vList[i].getStartY(), 'SS', cssClass + ' gDepSS'); + else if (vDependType[k] == 'FF') + this.drawDependency(vList[vTask].getEndX(), vList[vTask].getEndY(), vList[i].getEndX(), vList[i].getEndY(), 'FF', cssClass + ' gDepFF'); + else if (vDependType[k] == 'SF') + this.drawDependency(vList[vTask].getStartX() - 1, vList[vTask].getStartY(), vList[i].getEndX(), vList[i].getEndY(), 'SF', cssClass + ' gDepSF'); + else if (vDependType[k] == 'FS') + this.drawDependency(vList[vTask].getEndX(), vList[vTask].getEndY(), vList[i].getStartX() - 1, vList[i].getStartY(), 'FS', cssClass + ' gDepFS'); + } + } + } + } + } + } + // draw the current date line + if (this.vTodayPx >= 0) + this.sLine(this.vTodayPx, 0, this.vTodayPx, this.getChartTable().offsetHeight - 1, 'gCurDate'); +}; + +},{}],5:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var general_utils_1 = require("./utils/general_utils"); +// Function to open/close and hide/show children of specified task +exports.folder = function (pID, ganttObj) { + var vList = ganttObj.getList(); + ganttObj.clearDependencies(); // clear these first so slow rendering doesn't look odd + for (var i = 0; i < vList.length; i++) { + if (vList[i].getID() == pID) { + if (vList[i].getOpen() == 1) { + vList[i].setOpen(0); + exports.hide(pID, ganttObj); + if (general_utils_1.isIE()) + vList[i].getGroupSpan().innerText = '+'; + else + vList[i].getGroupSpan().textContent = '+'; + } + else { + vList[i].setOpen(1); + exports.show(pID, 1, ganttObj); + if (general_utils_1.isIE()) + vList[i].getGroupSpan().innerText = '-'; + else + vList[i].getGroupSpan().textContent = '-'; + } + } + } + var bd; + if (this.vDebug) { + bd = new Date(); + console.log('after drawDependency', bd); + } + ganttObj.DrawDependencies(this.vDebug); + if (this.vDebug) { + var ad = new Date(); + console.log('after drawDependency', ad, (ad.getTime() - bd.getTime())); + } +}; +exports.hide = function (pID, ganttObj) { + var vList = ganttObj.getList(); + var vID = 0; + for (var i = 0; i < vList.length; i++) { + if (vList[i].getParent() == pID) { + vID = vList[i].getID(); + // it's unlikely but if the task list has been updated since + // the chart was drawn some of the rows may not exist + if (vList[i].getListChildRow()) + vList[i].getListChildRow().style.display = 'none'; + if (vList[i].getChildRow()) + vList[i].getChildRow().style.display = 'none'; + vList[i].setVisible(0); + if (vList[i].getGroup()) + exports.hide(vID, ganttObj); + } + } +}; +// Function to show children of specified task +exports.show = function (pID, pTop, ganttObj) { + var vList = ganttObj.getList(); + var vID = 0; + var vState = ''; + for (var i = 0; i < vList.length; i++) { + if (vList[i].getParent() == pID) { + if (!vList[i].getParItem()) { + console.error("Cant find parent on who event (maybe problems with Task ID and Parent Id mixes?)"); + } + if (vList[i].getParItem().getGroupSpan()) { + if (general_utils_1.isIE()) + vState = vList[i].getParItem().getGroupSpan().innerText; + else + vState = vList[i].getParItem().getGroupSpan().textContent; + } + i = vList.length; + } + } + for (var i = 0; i < vList.length; i++) { + if (vList[i].getParent() == pID) { + var vChgState = false; + vID = vList[i].getID(); + if (pTop == 1 && vState == '+') + vChgState = true; + else if (vState == '-') + vChgState = true; + else if (vList[i].getParItem() && vList[i].getParItem().getGroup() == 2) + vList[i].setVisible(1); + if (vChgState) { + if (vList[i].getListChildRow()) + vList[i].getListChildRow().style.display = ''; + if (vList[i].getChildRow()) + vList[i].getChildRow().style.display = ''; + vList[i].setVisible(1); + } + if (vList[i].getGroup()) + exports.show(vID, 0, ganttObj); + } + } +}; +exports.mouseOver = function (pObj1, pObj2) { + if (this.getUseRowHlt()) { + pObj1.className += ' gitemhighlight'; + pObj2.className += ' gitemhighlight'; + } +}; +exports.mouseOut = function (pObj1, pObj2) { + if (this.getUseRowHlt()) { + pObj1.className = pObj1.className.replace(/(?:^|\s)gitemhighlight(?!\S)/g, ''); + pObj2.className = pObj2.className.replace(/(?:^|\s)gitemhighlight(?!\S)/g, ''); + } +}; +exports.showToolTip = function (pGanttChartObj, e, pContents, pWidth, pTimer) { + var vTtDivId = pGanttChartObj.getDivId() + 'JSGanttToolTip'; + var vMaxW = 500; + var vMaxAlpha = 100; + var vShowing = pContents.id; + if (pGanttChartObj.getUseToolTip()) { + if (pGanttChartObj.vTool == null) { + pGanttChartObj.vTool = document.createElement('div'); + pGanttChartObj.vTool.id = vTtDivId; + pGanttChartObj.vTool.className = 'JSGanttToolTip'; + pGanttChartObj.vTool.vToolCont = document.createElement('div'); + pGanttChartObj.vTool.vToolCont.id = vTtDivId + 'cont'; + pGanttChartObj.vTool.vToolCont.className = 'JSGanttToolTipcont'; + pGanttChartObj.vTool.vToolCont.setAttribute('showing', ''); + pGanttChartObj.vTool.appendChild(pGanttChartObj.vTool.vToolCont); + document.body.appendChild(pGanttChartObj.vTool); + pGanttChartObj.vTool.style.opacity = 0; + pGanttChartObj.vTool.setAttribute('currentOpacity', 0); + pGanttChartObj.vTool.setAttribute('fadeIncrement', 10); + pGanttChartObj.vTool.setAttribute('moveSpeed', 10); + pGanttChartObj.vTool.style.filter = 'alpha(opacity=0)'; + pGanttChartObj.vTool.style.visibility = 'hidden'; + pGanttChartObj.vTool.style.left = Math.floor(((e) ? e.clientX : window.event.clientX) / 2) + 'px'; + pGanttChartObj.vTool.style.top = Math.floor(((e) ? e.clientY : window.event.clientY) / 2) + 'px'; + this.addListener('mouseover', function () { clearTimeout(pGanttChartObj.vTool.delayTimeout); }, pGanttChartObj.vTool); + this.addListener('mouseout', function () { general_utils_1.delayedHide(pGanttChartObj, pGanttChartObj.vTool, pTimer); }, pGanttChartObj.vTool); + } + clearTimeout(pGanttChartObj.vTool.delayTimeout); + var newHTML = pContents.innerHTML; + if (pGanttChartObj.vTool.vToolCont.getAttribute("content") !== newHTML) { + pGanttChartObj.vTool.vToolCont.innerHTML = pContents.innerHTML; + // as we are allowing arbitrary HTML we should remove any tag ids to prevent duplication + general_utils_1.stripIds(pGanttChartObj.vTool.vToolCont); + pGanttChartObj.vTool.vToolCont.setAttribute("content", newHTML); + } + if (pGanttChartObj.vTool.vToolCont.getAttribute('showing') != vShowing || pGanttChartObj.vTool.style.visibility != 'visible') { + if (pGanttChartObj.vTool.vToolCont.getAttribute('showing') != vShowing) { + pGanttChartObj.vTool.vToolCont.setAttribute('showing', vShowing); + } + pGanttChartObj.vTool.style.visibility = 'visible'; + // Rather than follow the mouse just have it stay put + general_utils_1.updateFlyingObj(e, pGanttChartObj, pTimer); + pGanttChartObj.vTool.style.width = (pWidth) ? pWidth + 'px' : 'auto'; + if (!pWidth && general_utils_1.isIE()) { + pGanttChartObj.vTool.style.width = pGanttChartObj.vTool.offsetWidth; + } + if (pGanttChartObj.vTool.offsetWidth > vMaxW) { + pGanttChartObj.vTool.style.width = vMaxW + 'px'; + } + } + if (pGanttChartObj.getUseFade()) { + clearInterval(pGanttChartObj.vTool.fadeInterval); + pGanttChartObj.vTool.fadeInterval = setInterval(function () { general_utils_1.fadeToolTip(1, pGanttChartObj.vTool, vMaxAlpha); }, pTimer); + } + else { + pGanttChartObj.vTool.style.opacity = vMaxAlpha * 0.01; + pGanttChartObj.vTool.style.filter = 'alpha(opacity=' + vMaxAlpha + ')'; + } + } +}; +exports.addListener = function (eventName, handler, control) { + // Check if control is a string + if (control === String(control)) + control = general_utils_1.findObj(control); + if (control.addEventListener) //Standard W3C + { + return control.addEventListener(eventName, handler, false); + } + else if (control.attachEvent) //IExplore + { + return control.attachEvent('on' + eventName, handler); + } + else { + return false; + } +}; +exports.removeListener = function (eventName, handler, control) { + // Check if control is a string + if (control === String(control)) + control = general_utils_1.findObj(control); + if (control.removeEventListener) { + //Standard W3C + return control.removeEventListener(eventName, handler, false); + } + else if (control.detachEvent) { + //IExplore + return control.attachEvent('on' + eventName, handler); + } + else { + return false; + } +}; +exports.syncScroll = function (elements, attrName) { + var syncFlags = new Map(elements.map(function (e) { return [e, false]; })); + function scrollEvent(e) { + if (!syncFlags.get(e.target)) { + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var el = elements_2[_i]; + if (el !== e.target) { + syncFlags.set(el, true); + el[attrName] = e.target[attrName]; + } + } + } + syncFlags.set(e.target, false); + } + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var el = elements_1[_i]; + el.addEventListener('scroll', scrollEvent); + } +}; +exports.addTooltipListeners = function (pGanttChart, pObj1, pObj2, callback) { + var isShowingTooltip = false; + exports.addListener('mouseover', function (e) { + if (isShowingTooltip || !callback) { + exports.showToolTip(pGanttChart, e, pObj2, null, pGanttChart.getTimer()); + } + else if (callback) { + isShowingTooltip = true; + var promise = callback(); + exports.showToolTip(pGanttChart, e, pObj2, null, pGanttChart.getTimer()); + if (promise && promise.then) { + promise.then(function () { + if (pGanttChart.vTool.vToolCont.getAttribute('showing') === pObj2.id && + pGanttChart.vTool.style.visibility === 'visible') { + exports.showToolTip(pGanttChart, e, pObj2, null, pGanttChart.getTimer()); + } + }); + } + } + }, pObj1); + exports.addListener('mouseout', function (e) { + var outTo = e.relatedTarget; + if (general_utils_1.isParentElementOrSelf(outTo, pObj1) || (pGanttChart.vTool && general_utils_1.isParentElementOrSelf(outTo, pGanttChart.vTool))) { + // not actually out + } + else { + isShowingTooltip = false; + } + general_utils_1.delayedHide(pGanttChart, pGanttChart.vTool, pGanttChart.getTimer()); + }, pObj1); +}; +exports.addThisRowListeners = function (pGanttChart, pObj1, pObj2) { + exports.addListener('mouseover', function () { pGanttChart.mouseOver(pObj1, pObj2); }, pObj1); + exports.addListener('mouseover', function () { pGanttChart.mouseOver(pObj1, pObj2); }, pObj2); + exports.addListener('mouseout', function () { pGanttChart.mouseOut(pObj1, pObj2); }, pObj1); + exports.addListener('mouseout', function () { pGanttChart.mouseOut(pObj1, pObj2); }, pObj2); +}; +exports.updateGridHeaderWidth = function (pGanttChart) { + var head = pGanttChart.getChartHead(); + var body = pGanttChart.getChartBody(); + if (!head || !body) + return; + var isScrollVisible = body.scrollHeight > body.clientHeight; + if (isScrollVisible) { + head.style.width = "calc(100% - " + general_utils_1.getScrollbarWidth() + "px)"; + } + else { + head.style.width = '100%'; + } +}; +exports.addFolderListeners = function (pGanttChart, pObj, pID) { + exports.addListener('click', function () { + exports.folder(pID, pGanttChart); + exports.updateGridHeaderWidth(pGanttChart); + }, pObj); +}; +exports.addFormatListeners = function (pGanttChart, pFormat, pObj) { + exports.addListener('click', function () { general_utils_1.changeFormat(pFormat, pGanttChart); }, pObj); +}; +exports.addScrollListeners = function (pGanttChart) { + exports.addListener('resize', function () { pGanttChart.getChartHead().scrollLeft = pGanttChart.getChartBody().scrollLeft; }, window); + exports.addListener('resize', function () { + pGanttChart.getListBody().scrollTop = pGanttChart.getChartBody().scrollTop; + }, window); +}; +exports.addListenerClickCell = function (vTmpCell, vEvents, task, column) { + exports.addListener('click', function (e) { + if (e.target.classList.contains('gfoldercollapse') === false && + vEvents[column] && typeof vEvents[column] === 'function') { + vEvents[column](task, e, vTmpCell); + } + }, vTmpCell); +}; +exports.addListenerInputCell = function (vTmpCell, vEventsChange, callback, task, column, draw, event) { + if (draw === void 0) { draw = null; } + if (event === void 0) { event = 'blur'; } + if (vTmpCell.children[0] && vTmpCell.children[0].children && vTmpCell.children[0].children[0]) { + var tagName = vTmpCell.children[0].children[0].tagName; + var selectInputOrButton = tagName === 'SELECT' || tagName === 'INPUT' || tagName === 'BUTTON'; + if (selectInputOrButton) { + exports.addListener(event, function (e) { + if (callback) { + callback(task, e); + } + if (vEventsChange[column] && typeof vEventsChange[column] === 'function') { + var q = vEventsChange[column](task, e, vTmpCell, vColumnsNames[column]); + if (q && q.then) { + q.then(function (e) { return draw(); }); + } + else { + draw(); + } + } + else { + draw(); + } + }, vTmpCell.children[0].children[0]); + } + } +}; +exports.addListenerDependencies = function (vLineOptions) { + var elements = document.querySelectorAll('.gtaskbarcontainer'); + for (var i = 0; i < elements.length; i++) { + var taskDiv = elements[i]; + taskDiv.addEventListener('mouseover', function (e) { + toggleDependencies(e, vLineOptions); + }); + taskDiv.addEventListener('mouseout', function (e) { + toggleDependencies(e, vLineOptions); + }); + } +}; +var toggleDependencies = function (e, vLineOptions) { + var target = e.currentTarget; + var ids = target.getAttribute('id').split('_'); + var style = vLineOptions && vLineOptions.borderStyleHover !== undefined ? vLineOptions.hoverStyle : 'groove'; + if (e.type === 'mouseout') { + style = ''; + } + if (ids.length > 1) { + var frameZones = Array.from(document.querySelectorAll(".gDepId" + ids[1])); + frameZones.forEach(function (c) { + c.style.borderStyle = style; + }); + // document.querySelectorAll(`.gDepId${ids[1]}`).forEach((c: any) => { + // c.style.borderStyle = style; + // }); + } +}; +// "pID": 122 +var vColumnsNames = { + taskname: 'pName', + res: 'pRes', + dur: '', + comp: 'pComp', + start: 'pStart', + end: 'pEnd', + planstart: 'pPlanStart', + planend: 'pPlanEnd', + link: 'pLink', + cost: 'pCost', + mile: 'pMile', + group: 'pGroup', + parent: 'pParent', + open: 'pOpen', + depend: 'pDepend', + caption: 'pCaption', + note: 'pNotes' +}; + +},{"./utils/general_utils":13}],6:[function(require,module,exports){ +"use strict"; +/* + * Copyright (c) 2013-2018, Paul Geldart, Eduardo Rodrigues, Ricardo Cardoso and Mario Mol. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of AUTHORS nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL AUTHORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This project is based on jsGantt 1.2, (which can be obtained from + https://code.google.com/p/jsgantt/) and remains under the original BSD license. + Copyright (c) 2009, Shlomy Gantz BlueBrick Inc. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +var events_1 = require("./events"); +var general_utils_1 = require("./utils/general_utils"); +var xml_1 = require("./xml"); +var task_1 = require("./task"); +var draw_1 = require("./draw"); +var json_1 = require("./json"); +var date_utils_1 = require("./utils/date_utils"); +if (!exports.JSGantt) + exports.JSGantt = {}; +exports.JSGantt.isIE = general_utils_1.isIE; +exports.JSGantt.TaskItem = task_1.TaskItem; +exports.JSGantt.GanttChart = draw_1.GanttChart; +exports.JSGantt.updateFlyingObj = general_utils_1.updateFlyingObj; +exports.JSGantt.showToolTip = events_1.showToolTip; +exports.JSGantt.stripIds = general_utils_1.stripIds; +exports.JSGantt.stripUnwanted = general_utils_1.stripUnwanted; +exports.JSGantt.delayedHide = general_utils_1.delayedHide; +exports.JSGantt.hideToolTip = general_utils_1.hideToolTip; +exports.JSGantt.fadeToolTip = general_utils_1.fadeToolTip; +exports.JSGantt.moveToolTip = general_utils_1.moveToolTip; +exports.JSGantt.getZoomFactor = general_utils_1.getZoomFactor; +exports.JSGantt.getOffset = general_utils_1.getOffset; +exports.JSGantt.getScrollPositions = general_utils_1.getScrollPositions; +exports.JSGantt.processRows = task_1.processRows; +exports.JSGantt.sortTasks = task_1.sortTasks; +// Used to determine the minimum date of all tasks and set lower bound based on format +exports.JSGantt.getMinDate = date_utils_1.getMinDate; +// Used to determine the maximum date of all tasks and set upper bound based on format +exports.JSGantt.getMaxDate = date_utils_1.getMaxDate; +// This function finds the document id of the specified object +exports.JSGantt.findObj = general_utils_1.findObj; +exports.JSGantt.changeFormat = general_utils_1.changeFormat; +// Tasks +exports.JSGantt.folder = events_1.folder; +exports.JSGantt.hide = events_1.hide; +exports.JSGantt.show = events_1.show; +exports.JSGantt.taskLink = task_1.taskLink; +exports.JSGantt.parseDateStr = date_utils_1.parseDateStr; +exports.JSGantt.formatDateStr = date_utils_1.formatDateStr; +exports.JSGantt.parseDateFormatStr = date_utils_1.parseDateFormatStr; +// XML +exports.JSGantt.parseXML = xml_1.parseXML; +exports.JSGantt.parseXMLString = xml_1.parseXMLString; +exports.JSGantt.findXMLNode = xml_1.findXMLNode; +exports.JSGantt.getXMLNodeValue = xml_1.getXMLNodeValue; +exports.JSGantt.AddXMLTask = xml_1.AddXMLTask; +// JSON +exports.JSGantt.parseJSON = json_1.parseJSON; +exports.JSGantt.parseJSONString = json_1.parseJSONString; +exports.JSGantt.addJSONTask = json_1.addJSONTask; +exports.JSGantt.benchMark = general_utils_1.benchMark; +exports.JSGantt.getIsoWeek = date_utils_1.getIsoWeek; +exports.JSGantt.addListener = events_1.addListener; +exports.JSGantt.addTooltipListeners = events_1.addTooltipListeners; +exports.JSGantt.addThisRowListeners = events_1.addThisRowListeners; +exports.JSGantt.addFolderListeners = events_1.addFolderListeners; +exports.JSGantt.addFormatListeners = events_1.addFormatListeners; +exports.JSGantt.addScrollListeners = events_1.addScrollListeners; +exports.JSGantt.criticalPath = general_utils_1.criticalPath; + +},{"./draw":2,"./events":5,"./json":7,"./task":10,"./utils/date_utils":11,"./utils/general_utils":13,"./xml":14}],7:[function(require,module,exports){ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var task_1 = require("./task"); +var general_utils_1 = require("./utils/general_utils"); +/** + * + * @param pFile + * @param pGanttlet + */ +exports.parseJSON = function (pFile, pGanttVar, vDebug, redrawAfter) { + if (vDebug === void 0) { vDebug = false; } + if (redrawAfter === void 0) { redrawAfter = true; } + return __awaiter(this, void 0, void 0, function () { + var jsonObj, bd, ad; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, general_utils_1.makeRequest(pFile, true, true)]; + case 1: + jsonObj = _a.sent(); + if (vDebug) { + bd = new Date(); + console.log('before jsonparse', bd); + } + exports.addJSONTask(pGanttVar, jsonObj); + if (this.vDebug) { + ad = new Date(); + console.log('after addJSONTask', ad, (ad.getTime() - bd.getTime())); + } + if (redrawAfter) { + pGanttVar.Draw(); + } + return [2 /*return*/, jsonObj]; + } + }); + }); +}; +exports.parseJSONString = function (pStr, pGanttVar) { + exports.addJSONTask(pGanttVar, JSON.parse(pStr)); +}; +exports.addJSONTask = function (pGanttVar, pJsonObj) { + for (var index = 0; index < pJsonObj.length; index++) { + var id = void 0; + var name_1 = void 0; + var start = void 0; + var end = void 0; + var planstart = void 0; + var planend = void 0; + var itemClass = void 0; + var link = ''; + var milestone = 0; + var resourceName = ''; + var completion = void 0; + var group = 0; + var parent_1 = void 0; + var open_1 = void 0; + var dependsOn = ''; + var caption = ''; + var notes = ''; + var cost = void 0; + var duration = ''; + var bartext = ''; + var additionalObject = {}; + for (var prop in pJsonObj[index]) { + var property = prop; + var value = pJsonObj[index][property]; + switch (property.toLowerCase()) { + case 'pid': + case 'id': + id = value; + break; + case 'pname': + case 'name': + name_1 = value; + break; + case 'pstart': + case 'start': + start = value; + break; + case 'pend': + case 'end': + end = value; + break; + case 'pplanstart': + case 'planstart': + planstart = value; + break; + case 'pplanend': + case 'planend': + planend = value; + break; + case 'pclass': + case 'class': + itemClass = value; + break; + case 'plink': + case 'link': + link = value; + break; + case 'pmile': + case 'mile': + milestone = value; + break; + case 'pres': + case 'res': + resourceName = value; + break; + case 'pcomp': + case 'comp': + completion = value; + break; + case 'pgroup': + case 'group': + group = value; + break; + case 'pparent': + case 'parent': + parent_1 = value; + break; + case 'popen': + case 'open': + open_1 = value; + break; + case 'pdepend': + case 'depend': + dependsOn = value; + break; + case 'pcaption': + case 'caption': + caption = value; + break; + case 'pnotes': + case 'notes': + notes = value; + break; + case 'pcost': + case 'cost': + cost = value; + break; + case 'duration': + case 'pduration': + duration = value; + break; + case 'bartext': + case 'pbartext': + bartext = value; + break; + default: + additionalObject[property.toLowerCase()] = value; + } + } + //if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) { + pGanttVar.AddTaskItem(new task_1.TaskItem(id, name_1, start, end, itemClass, link, milestone, resourceName, completion, group, parent_1, open_1, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, bartext, additionalObject)); + //} + } +}; + +},{"./task":10,"./utils/general_utils":13}],8:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var es = { + 'january': 'Enero', + 'february': 'Febrero', + 'march': 'Marzo', + 'april': 'Abril', + 'maylong': 'Mayo', + 'june': 'Junio', + 'july': 'Julio', + 'august': 'Agosto', + 'september': 'Septiembre', + 'october': 'Octubre', + 'november': 'Noviembre', + 'december': 'Diciembre', + 'jan': 'Ene', + 'feb': 'Feb', + 'mar': 'Mar', + 'apr': 'Abr', + 'may': 'May', + 'jun': 'Jun', + 'jul': 'Jul', + 'aug': 'Ago', + 'sep': 'Sep', + 'oct': 'Oct', + 'nov': 'Nov', + 'dec': 'Dic', + 'sunday': 'Domingo', + 'monday': 'Lunes', + 'tuesday': 'Martes', + 'wednesday': 'Miércoles', + 'thursday': 'Jueves', + 'friday': 'Viernes', + 'saturday': 'Sábado', + 'sun': ' Dom', + 'mon': ' Lun', + 'tue': ' Mar', + 'wed': ' Mie', + 'thu': ' Jue', + 'fri': ' Vie', + 'sat': ' Sab', + 'resource': 'Recurso', + 'duration': 'Duración', + 'comp': '% Compl.', + 'completion': 'Completado', + 'startdate': 'Inicio', + 'planstartdate': 'Inicio Planificado', + 'cost': 'Coste', + 'enddate': 'Fin', + 'planenddate': 'Fin Planificado', + 'moreinfo': 'Más Información', + 'notes': 'Notas', + 'format': 'Formato', + 'hour': 'Hora', + 'day': 'Día', + 'week': 'Semana', + 'month': 'Mes', + 'quarter': 'Trimestre', + 'hours': 'Horas', + 'days': 'Días', + 'weeks': 'Semanas', + 'months': 'Meses', + 'quarters': 'Trimestres', + 'hr': 'h', + 'dy': 'Día', + 'wk': 'Sem.', + 'mth': 'Mes', + 'qtr': 'Trim.', + 'hrs': 'h', + 'dys': 'Días', + 'wks': 'Sem.', + 'mths': 'Meses', + 'qtrs': 'Trim.', + 'tooltipLoading': 'Cargando...' +}; +exports.es = es; +var en = { + 'format': 'Format', + 'hour': 'Hour', + 'day': 'Day', + 'week': 'Week', + 'month': 'Month', + 'quarter': 'Quarter', + 'hours': 'Hours', + 'days': 'Days', + 'weeks': 'Weeks', + 'months': 'Months', + 'quarters': 'Quarters', + 'hr': 'Hr', + 'dy': 'Day', + 'wk': 'Wk', + 'mth': 'Mth', + 'qtr': 'Qtr', + 'hrs': 'Hrs', + 'dys': 'Days', + 'wks': 'Wks', + 'mths': 'Mths', + 'qtrs': 'Qtrs', + 'resource': 'Resource', + 'duration': 'Duration', + 'comp': '% Comp.', + 'completion': 'Completion', + 'startdate': 'Start Date', + 'planstartdate': 'Plan Start Date', + 'enddate': 'End Date', + 'planenddate': 'Plan End Date', + 'cost': 'Cost', + 'moreinfo': 'More Information', + 'notes': 'Notes', + 'january': 'January', + 'february': 'February', + 'march': 'March', + 'april': 'April', + 'maylong': 'May', + 'june': 'June', + 'july': 'July', + 'august': 'August', + 'september': 'September', + 'october': 'October', + 'november': 'November', + 'december': 'December', + 'jan': 'Jan', + 'feb': 'Feb', + 'mar': 'Mar', + 'apr': 'Apr', + 'may': 'May', + 'jun': 'Jun', + 'jul': 'Jul', + 'aug': 'Aug', + 'sep': 'Sep', + 'oct': 'Oct', + 'nov': 'Nov', + 'dec': 'Dec', + 'sunday': 'Sunday', + 'monday': 'Monday', + 'tuesday': 'Tuesday', + 'wednesday': 'Wednesday', + 'thursday': 'Thursday', + 'friday': 'Friday', + 'saturday': 'Saturday', + 'sun': 'Sun', + 'mon': 'Mon', + 'tue': 'Tue', + 'wed': 'Wed', + 'thu': 'Thu', + 'fri': 'Fri', + 'sat': 'Sat', + 'tooltipLoading': 'Loading...' +}; +exports.en = en; +var de = { + 'format': 'Ansicht', + 'hour': 'Stunde', + 'day': 'Tag', + 'week': 'Woche', + 'month': 'Monat', + 'quarter': 'Quartal', + 'hours': 'Stunden', + 'days': 'Tage', + 'weeks': 'Wochen', + 'months': 'Monate', + 'quarters': 'Quartale', + 'hr': 'h', + 'dy': 'T', + 'wk': 'W', + 'mth': 'M', + 'qtr': 'Q', + 'hrs': 'Std', + 'dys': 'Tage', + 'wks': 'Wochen', + 'mths': 'Monate', + 'qtrs': 'Quartal', + 'resource': 'Resource', + 'duration': 'Dauer', + 'comp': '%Fertig', + 'completion': 'Fertigstellung', + 'startdate': 'Erste Buchu', + 'planstartdate': 'Erste Buchu Plan', + 'enddate': 'Letzte Buchung', + 'planenddate': 'Plan Letzte Buchung', + 'cost': 'Cost', + 'moreinfo': 'Weitere Infos', + 'notes': 'Anmerkung', + 'january': 'Jänner', + 'february': 'Februar', + 'march': 'März', + 'april': 'April', + 'maylong': 'Mai', + 'june': 'Juni', + 'july': 'Juli', + 'august': 'August', + 'september': 'September', + 'october': 'Oktober', + 'november': 'November', + 'december': 'Dezember', + 'jan': 'Jan', + 'feb': 'Feb', + 'mar': 'Mar', + 'apr': 'Apr', + 'may': 'Mai', + 'jun': 'Jun', + 'jul': 'Jul', + 'aug': 'Aug', + 'sep': 'Sep', + 'oct': 'Okt', + 'nov': 'Nov', + 'dec': 'Dez', + 'sunday': 'Sonntag', + 'monday': 'Montag', + 'tuesday': 'Dienstag', + 'wednesday': 'Mittwoch', + 'thursday': 'Donnerstag', + 'friday': 'Freitag', + 'saturday': 'Samstag', + 'sun': 'So', + 'mon': 'Mo', 'tue': 'Di', 'wed': 'Mi', 'thu': 'Do', 'fri': 'Fr', 'sat': 'Sa' +}; +exports.de = de; +var pt = { + 'hours': 'Horas', + 'days': 'Dias', + 'weeks': 'Weeks', + 'months': 'Months', + 'quarters': 'Quarters', + 'format': 'Formato', + 'hour': 'Hora', + 'day': 'Dia', + 'week': 'Semana', + 'month': 'Mês', + 'quarter': 'Trimestre', + 'hr': 'hr', + 'dy': 'dia', + 'wk': 'sem.', + 'mth': 'mês', + 'qtr': 'qtr', + 'hrs': 'hrs', + 'dys': 'dias', + 'wks': 'sem.', + 'mths': 'meses', + 'qtrs': 'qtrs', + 'completion': 'Terminado', + 'comp': '% Completado', + 'moreinfo': 'Mais informações', + 'notes': 'Notas', + 'resource': 'Responsável', + 'duration': 'Duração', + 'startdate': 'Data inicial', + 'planstartdate': 'Plan Data inicial', + 'enddate': 'Data final', + 'planenddate': 'Plan Data final', + 'cost': 'Custo', + 'jan': 'Jan', + 'feb': 'Fev', + 'mar': 'Mar', + 'apr': 'Abr', + 'may': 'Mai', + 'jun': 'Jun', + 'jul': 'Jul', + 'aug': 'Ago', + 'sep': 'Set', + 'oct': 'Out', + 'nov': 'Nov', + 'dec': 'Dez', + 'january': 'Janeiro', + 'february': 'Fevereiro', + 'march': 'Março', + 'april': 'Abril', + 'maylong': 'Maio', + 'june': 'Junho', + 'july': 'Julho', + 'august': 'Agosto', + 'september': 'Setembro', + 'october': 'Outubro', + 'november': 'Novembro', + 'december': 'Dezembro', + 'sun': 'Dom', + 'mon': 'Seg', + 'tue': 'Ter', + 'wed': 'Qua', + 'thu': 'Qui', + 'fri': 'Sex', + 'sat': 'Sab' +}; +exports.pt = pt; +var ru = { + 'january': 'Январь', + 'february': 'Февраль', + 'march': 'Март', + 'april': 'Апрель', + 'maylong': 'Май', + 'june': 'Июнь', + 'july': 'Июль', + 'august': 'Август', 'september': 'Сентябрь', + 'october': 'Октябрь', + 'november': 'Ноябрь', + 'december': 'Декабрь', + 'jan': 'Янв', + 'feb': 'Фев', + 'mar': 'Мар', + 'apr': 'Апр', + 'may': 'Май', + 'jun': 'Июн', + 'jul': 'Июл', + 'aug': 'Авг', + 'sep': 'Сен', + 'oct': 'Окт', + 'nov': 'Ноя', + 'dec': 'Дек', + 'sunday': 'Воскресенье', + 'monday': 'Понедельник', + 'tuesday': 'Вторник', + 'wednesday': 'Среда', + 'thursday': 'Четверг', + 'friday': 'Пятница', + 'saturday': 'Суббота', + 'sun': ' Вс', + 'mon': ' Пн', + 'tue': ' Вт', + 'wed': ' Ср', + 'thu': ' Чт', + 'fri': ' Пт', + 'sat': ' Сб', + 'resource': 'Ресурс', + 'duration': 'Длительность', + 'comp': '% выполнения', + 'completion': 'Выполнено', + 'startdate': 'Нач. дата', + 'planstartdate': 'Plan Нач. дата', + 'enddate': 'Кон. дата', + 'planenddate': 'Plan Кон. дата', + 'cost': 'Cost', + 'moreinfo': 'Детали', + 'notes': 'Заметки', + 'format': 'Формат', + 'hour': 'Час', + 'day': 'День', + 'week': 'Неделя', + 'month': 'Месяц', + 'quarter': 'Кварт', + 'hours': 'Часов', + 'days': 'Дней', + 'weeks': 'Недель', + 'months': 'Месяцев', + 'quarters': 'Кварталов', + 'hr': 'ч.', + 'dy': 'дн.', + 'wk': 'нед.', + 'mth': 'мес.', + 'qtr': 'кв.', + 'hrs': 'ч.', + 'dys': 'дн.', + 'wks': 'нед.', + 'mths': 'мес.', + 'qtrs': 'кв.', + 'tooltipLoading': 'Загрузка...' +}; +exports.ru = ru; +var fr = { + // Mois : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3619 + // Jours : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3617 + 'january': 'Janvier', + 'february': 'Février', + 'march': 'Mars', + 'april': 'Avril', + 'maylong': 'Mai', + 'june': 'Juin', + 'july': 'Juillet', + 'august': 'Août', + 'september': 'Septembre', + 'october': 'Octobre', + 'november': 'Novembre', + 'december': 'Décembre', + 'jan': 'Janv', + 'feb': 'Févr', + 'mar': 'Mars', + 'apr': 'Avr', + 'may': 'Mai', + 'jun': 'Juin', + 'jul': 'Juil', + 'aug': 'Août', + 'sep': 'Sept', + 'oct': 'Oct', + 'nov': 'Nov', + 'dec': 'Déc', + 'sunday': 'Dimanche', + 'monday': 'Lundi', + 'tuesday': 'Mardi', + 'wednesday': 'Mercredi', + 'thursday': 'Jeudi', + 'friday': 'Vendredi', + 'saturday': 'Samedi', + 'sun': 'Dim', + 'mon': 'Lun', + 'tue': 'Mar', + 'wed': 'Mer', + 'thu': 'Jeu', + 'fri': 'Ven', + 'sat': 'Sam', + 'resource': 'Ressource', + 'duration': 'Durée', + 'comp': '% Term.', + 'completion': 'Terminé', + 'startdate': 'Début', + 'planstartdate': 'Plan Début', + 'enddate': 'Fin', + 'planenddate': 'Plan Fin', + 'cost': 'Cost', + 'moreinfo': "Plus d'informations", + 'notes': 'Notes', + 'format': 'Format', + 'hour': 'Heure', + 'day': 'Jour', + 'week': 'Semaine', + 'month': 'Mois', + 'quarter': 'Trimestre', + 'hours': 'Heures', + 'days': 'Jours', + 'weeks': 'Semaines', + 'months': 'Mois', + 'quarters': 'Trimestres', + 'hr': 'h', + 'dy': 'j', + 'wk': 'sem', + 'mth': 'mois', + 'qtr': 'tri', + 'hrs': 'h', + 'dys': 'j', + 'wks': 'sem', + 'mths': 'mois', + 'qtrs': 'tri' +}; +exports.fr = fr; +var cn = { + 'january': '一月', + 'february': '二月', + 'march': '三月', + 'april': '四月', + 'maylong': '五月', + 'june': '六月', + 'july': '七月', + 'august': '八月', + 'september': '九月', + 'october': '十月', + 'november': '十一月', + 'december': '十二月', + 'jan': '一月', + 'feb': '二月', + 'mar': '三月', + 'apr': '四月', + 'may': '五月', + 'jun': '六月', + 'jul': '七月', + 'aug': '八月', + 'sep': '九月', + 'oct': '十月', + 'nov': '十一月', + 'dec': '十二月', + 'sunday': '星期日', + 'monday': '星期一', + 'tuesday': '星期二', + 'wednesday': '星期三', + 'thursday': '星期四', + 'friday': '星期五', + 'saturday': '星期六', + 'sun': '星期日', + 'mon': '星期一', + 'tue': '星期二', + 'wed': '星期三', + 'thu': '星期四', + 'fri': '星期五', + 'sat': '星期六', + 'resource': '資源', + 'duration': '時程', + 'comp': '達成率', + 'completion': '達成', + 'startdate': '起始日期', + 'planstartdate': '計劃起始日期', + 'enddate': '截止日期', + 'planenddate': '計劃截止日期', + 'cost': '成本', + 'moreinfo': "更多資訊", + 'notes': '備註', + 'format': '格式', + 'hour': '時', + 'day': '日', + 'week': '星期', + 'month': '月', + 'quarter': '季', + 'hours': '小時', + 'days': '天', + 'weeks': '週', + 'months': '月', + 'quarters': '季', + 'hr': '小時', + 'dy': '天', + 'wk': '週', + 'mth': '月', + 'qtr': '季', + 'hrs': '小時', + 'dys': '天', + 'wks': '週', + 'mths': '月', + 'qtrs': '季' +}; +exports.cn = cn; +var sv = { + 'format': 'Filter', + 'hour': 'Timme', + 'day': 'Dag', + 'week': 'Vecka', + 'month': 'Månad', + 'quarter': 'Kvartal', + 'hours': 'Timmar', + 'days': 'Dagar', + 'weeks': 'Veckor', + 'months': 'Månader', + 'quarters': 'Kvartal', + 'hr': 'Timme', + 'dy': 'Dag', + 'wk': 'Vecka', + 'mth': 'Månad', + 'qtr': 'Q', + 'hrs': 'Timmar', + 'dys': 'Dagar', + 'wks': 'Veckor', + 'mths': 'Månader', + 'qtrs': 'Q', + 'resource': 'Resurs', + 'duration': 'Tidsåtgång', + 'comp': '% klart', + 'completion': 'Klart', + 'startdate': 'Startdatum', + 'planstartdate': 'Planerad startdatum', + 'enddate': 'Slutdatum', + 'planenddate': 'Planerad slutdatum', + 'cost': 'Kostnad', + 'moreinfo': 'Mer Information', + 'notes': 'Notes', + 'january': 'januari', + 'february': 'februari', + 'march': 'mars', + 'april': 'april', + 'maylong': 'maj', + 'june': 'juni', + 'july': 'juli', + 'august': 'augusti', + 'september': 'september', + 'october': 'oktober', + 'november': 'november', + 'december': 'december', + 'jan': 'jan', + 'feb': 'feb', + 'mar': 'mar', + 'apr': 'apr', + 'may': 'maj', + 'jun': 'jun', + 'jul': 'jul', + 'aug': 'aug', + 'sep': 'sep', + 'oct': 'okt', + 'nov': 'nov', + 'dec': 'dec', + 'sunday': 'söndag', + 'monday': 'måndag', + 'tuesday': 'tisdag', + 'wednesday': 'onsdag', + 'thursday': 'torsdag', + 'friday': 'fredag', + 'saturday': 'lördag', + 'sun': 'sön', + 'mon': 'mån', + 'tue': 'tis', + 'wed': 'ons', + 'thu': 'tor', + 'fri': 'fre', + 'sat': 'lör' +}; +exports.sv = sv; +var nl = { + 'format': 'Format', + 'hour': 'Uur', + 'day': 'Dag', + 'week': 'Week', + 'month': 'Maand', + 'quarter': 'Kwartaal', + 'hours': 'Uren', + 'days': 'Dagen', + 'weeks': 'Weken', + 'months': 'Maanden', + 'quarters': 'Kwartalen', + 'hr': 'uur', + 'dy': 'dag', + 'wk': 'wk', + 'mth': 'mnd', + 'qtr': 'kw', + 'hrs': 'uren', + 'dys': 'dagen', + 'wks': 'weken', + 'mths': 'maanden', + 'qtrs': 'kwartalen', + 'resource': 'Resource', + 'duration': 'Doorlooptijd', + 'comp': '% gereed', + 'completion': 'Gereed', + 'startdate': 'Startdatum', + 'planstartdate': 'Geplande startdatum', + 'enddate': 'Einddatum', + 'planenddate': 'Geplande einddatum', + 'cost': 'Kosten', + 'moreinfo': 'Meer informatie', + 'notes': 'Notities', + 'january': 'januari', + 'february': 'februari', + 'march': 'maart', + 'april': 'april', + 'maylong': 'mei', + 'june': 'juni', + 'july': 'juli', + 'august': 'augustus', + 'september': 'september', + 'october': 'oktober', + 'november': 'november', + 'december': 'december', + 'jan': 'jan', + 'feb': 'feb', + 'mar': 'mrt', + 'apr': 'apr', + 'may': 'mei', + 'jun': 'jun', + 'jul': 'jul', + 'aug': 'aug', + 'sep': 'sep', + 'oct': 'okt', + 'nov': 'nov', + 'dec': 'dec', + 'sunday': 'zondag', + 'monday': 'maandag', + 'tuesday': 'dinsdag', + 'wednesday': 'woensdag', + 'thursday': 'donderdag', + 'friday': 'vrijdag', + 'saturday': 'zaterdag', + 'sun': 'zo', + 'mon': 'ma', + 'tue': 'di', + 'wed': 'wo', + 'thu': 'do', + 'fri': 'vr', + 'sat': 'za' +}; +exports.nl = nl; +var id = { + 'format': 'Format', + 'hour': 'Jam', + 'day': 'Hari', + 'week': 'Minggu', + 'month': 'Bulan', + 'quarter': 'Kuartal', + 'hours': 'Jam', + 'days': 'Hari', + 'weeks': 'Minggu', + 'months': 'Bulan', + 'quarters': 'Kuartal', + 'hr': 'Jam', + 'dy': 'Hari', + 'wk': 'Min', + 'mth': 'Bln', + 'qtr': 'Krtl', + 'hrs': 'Jam', + 'dys': 'Hari', + 'wks': 'Min', + 'mths': 'Bln', + 'qtrs': 'Krtl', + 'resource': 'Sumber Daya', + 'duration': 'Durasi', + 'comp': '% Penyelesaian', + 'completion': 'Penyelesaian', + 'startdate': 'Tanggal Mulai', + 'planstartdate': 'Perencanaan Tanggal Mulai', + 'enddate': 'Tanggal Akhir', + 'planenddate': 'Perencanaan Tanggal Akhir', + 'cost': 'Biaya', + 'moreinfo': 'Informasi Lebih Lanjut', + 'notes': 'Catatan', + 'january': 'Januari', + 'february': 'Februari', + 'march': 'Maret', + 'april': 'April', + 'maylong': 'Mei', + 'june': 'Juni', + 'july': 'Juli', + 'august': 'Agustus', + 'september': 'September', + 'october': 'Oktober', + 'november': 'November', + 'december': 'Desember', + 'jan': 'Jan', + 'feb': 'Feb', + 'mar': 'Mar', + 'apr': 'Apr', + 'may': 'Mei', + 'jun': 'Jun', + 'jul': 'Jul', + 'aug': 'Agu', + 'sep': 'Sep', + 'oct': 'Okt', + 'nov': 'Nov', + 'dec': 'Des', + 'sunday': 'Minggu', + 'monday': 'Senin', + 'tuesday': 'Selasa', + 'wednesday': 'Rabu', + 'thursday': 'Kamis', + 'friday': 'Jumat', + 'saturday': 'Sabtu', + 'sun': 'Min', + 'mon': 'Sen', + 'tue': 'Sel', + 'wed': 'Rab', + 'thu': 'Kam', + 'fri': 'Jum', + 'sat': 'Sab' +}; +exports.id = id; +var tr = { + 'format': 'Biçim', + 'hour': 'Saat', + 'day': 'Gün', + 'week': 'Hafta', + 'month': 'Ay', + 'quarter': 'Çeyrek Yıl', + 'hours': 'Saat', + 'days': 'Gün', + 'weeks': 'Hafta', + 'months': 'Ay', + 'quarters': 'Çeyrek Yıl', + 'hr': 'Saat', + 'dy': 'Gün', + 'wk': 'Hft', + 'mth': 'Ay', + 'qtr': 'Çyrk', + 'hrs': 'Saat', + 'dys': 'Gün', + 'wks': 'Hft', + 'mths': 'Ay', + 'qtrs': 'Çyrk', + 'resource': 'Kaynak', + 'duration': 'Süre', + 'comp': '% Tamamlanma.', + 'completion': 'Tamamlanma', + 'startdate': 'Başlangıç Tarihi', + 'planstartdate': 'Plan Başlama Tarihi', + 'enddate': 'Bitiş Tarihi', + 'planenddate': 'Plan Bitiş Tarihi', + 'cost': 'Tutar', + 'moreinfo': 'Daha Fazla Bilgi', + 'notes': 'Notlar', + 'january': 'Ocak', + 'february': 'Şubat', + 'march': 'Mart', + 'april': 'Nisan', + 'maylong': 'Mayıs', + 'june': 'Haziran', + 'july': 'Temmuz', + 'august': 'Ağustos', + 'september': 'Eylül', + 'october': 'Ekim', + 'november': 'Kasım', + 'december': 'Aralık', + 'jan': 'Oca', + 'feb': 'Şub', + 'mar': 'Mar', + 'apr': 'Nis', + 'may': 'May', + 'jun': 'Haz', + 'jul': 'Tem', + 'aug': 'Ağu', + 'sep': 'Eyl', + 'oct': 'Eki', + 'nov': 'Kas', + 'dec': 'Ara', + 'sunday': 'Pazar', + 'monday': 'Pazartesi', + 'tuesday': 'Salı', + 'wednesday': 'Çarşamba', + 'thursday': 'Perşembe', + 'friday': 'Cuma', + 'saturday': 'Cumartesi', + 'sun': 'Paz', + 'mon': 'Pzt', + 'tue': 'Sal', + 'wed': 'Çrş', + 'thu': 'Prş', + 'fri': 'Cum', + 'sat': 'Cmt' +}; +exports.tr = tr; +var ja = { + 'format': 'タイムライン表示', + 'hour': '時', + 'day': '日', + 'week': '週', + 'month': '月', + 'quarter': '四半期', + 'hours': '時間', + 'days': '日間', + 'weeks': '週間', + 'months': '月間', + 'quarters': '四半期', + 'hr': '時', + 'dy': '日', + 'wk': '週', + 'mth': '月', + 'qtr': '四', + 'hrs': '時間', + 'dys': '日間', + 'wks': '週間', + 'mths': '月間', + 'qtrs': '四半期', + 'resource': 'リソース', + 'duration': '期間', + 'comp': '進捗率', + 'completion': '進捗率', + 'startdate': '開始日', + 'planstartdate': '予定開始日', + 'enddate': '期日', + 'planenddate': '予定期日', + 'cost': 'コスト', + 'moreinfo': '詳細', + 'notes': 'ノート', + 'january': '1月', + 'february': '2月', + 'march': '3月', + 'april': '4月', + 'maylong': '5月', + 'june': '6月', + 'july': '7月', + 'august': '8月', + 'september': '9月', + 'october': '10月', + 'november': '11月', + 'december': '12月', + 'jan': '1月', + 'feb': '2月', + 'mar': '3月', + 'apr': '4月', + 'may': '5月', + 'jun': '6月', + 'jul': '7月', + 'aug': '8月', + 'sep': '9月', + 'oct': '10月', + 'nov': '11月', + 'dec': '12月', + 'sunday': '日曜日', + 'monday': '月曜日', + 'tuesday': '火曜日', + 'wednesday': '水曜日', + 'thursday': '木曜日', + 'friday': '金曜日', + 'saturday': '土曜日', + 'sun': '日', + 'mon': '月', + 'tue': '火', + 'wed': '水', + 'thu': '木', + 'fri': '金', + 'sat': '土', + 'tooltipLoading': 'ローディング中...' +}; +exports.ja = ja; +var cs = { + 'format': 'Zobrazení', + 'hour': 'Hodina', + 'day': 'Den', + 'week': 'Týden', + 'month': 'Měsíc', + 'quarter': 'Kvartál', + 'hours': 'Hodiny', + 'days': 'Dni', + 'weeks': 'Týdny', + 'months': 'Měsíce', + 'quarters': 'Kvartály', + 'hr': 'Ho', + 'dy': 'Den', + 'wk': 'Tyd', + 'mth': 'Měs', + 'qtr': 'Kvar', + 'hrs': 'Ho', + 'dys': 'Dni', + 'wks': 'Tyd', + 'mths': 'Měs', + 'qtrs': 'Kvar', + 'resource': 'Přiřazeno', + 'duration': 'Trvání', + 'comp': '% Hotovo', + 'completion': 'Hotovo', + 'startdate': 'Start', + 'planstartdate': 'Plánovaný start', + 'enddate': 'Konec', + 'planenddate': 'Plánovaný konec', + 'cost': 'Náklady', + 'moreinfo': 'Více informací', + 'notes': 'Poznámky', + 'january': 'Leden', + 'february': 'Únor', + 'march': 'Březen', + 'april': 'Duben', + 'maylong': 'Květen', + 'june': 'Červen', + 'july': 'Červenec', + 'august': 'Srpen', + 'september': 'Září', + 'october': 'Říjen', + 'november': 'Listopad', + 'december': 'Prosinec', + 'jan': 'Led', + 'feb': 'Úno', + 'mar': 'Bře', + 'apr': 'Dub', + 'may': 'Kvě', + 'jun': 'Čer', + 'jul': 'Čvc', + 'aug': 'Srp', + 'sep': 'Zář', + 'oct': 'Říj', + 'nov': 'Lis', + 'dec': 'Pro', + 'sunday': 'Neděle', + 'monday': 'Pondělí', + 'tuesday': 'Úterý', + 'wednesday': 'Středa', + 'thursday': 'Čtvrtek', + 'friday': 'Pátek', + 'saturday': 'Sobota', + 'sun': 'Ne', + 'mon': 'Po', + 'tue': 'Út', + 'wed': 'St', + 'thu': 'Čt', + 'fri': 'Pa', + 'sat': 'So', + 'tooltipLoading': 'Nahrávám...' +}; +exports.cs = cs; +var hu = { + 'format': 'Formátum', + 'hour': 'Óra', + 'day': 'Nap', + 'week': 'Hét', + 'month': 'Hónap', + 'quarter': 'Negyedév ', + 'hours': 'Órák', + 'days': 'Nap', + 'weeks': 'Hét', + 'months': 'Hónap', + 'quarters': 'Negyedév', + 'hr': 'Ó', + 'dy': 'Nap', + 'wk': 'Hét', + 'mth': 'Hó', + 'qtr': 'NÉ', + 'hrs': 'Óra', + 'dys': 'Nap', + 'wks': 'Hét', + 'mths': 'Hó', + 'qtrs': 'NÉ', + 'resource': 'Erőforrás', + 'duration': 'Időtartam', + 'comp': '% Kész', + 'completion': 'Elkészült', + 'startdate': 'Kezdés', + 'planstartdate': 'Tervezett kezdés', + 'enddate': 'Befejezés', + 'planenddate': 'Tervezett befejezés', + 'cost': 'Költség', + 'moreinfo': 'További információ', + 'notes': 'Jegyzetek', + 'january': 'Január', + 'february': 'Február', + 'march': 'Március', + 'april': 'Április', + 'maylong': 'Május', + 'june': 'Június', + 'july': 'Július', + 'august': 'Augusztus', + 'september': 'Szeptember', + 'october': 'Október', + 'november': 'November', + 'december': 'December', + 'jan': 'Jan', + 'feb': 'Feb', + 'mar': 'Már', + 'apr': 'Ápr', + 'may': 'Máj', + 'jun': 'Jún', + 'jul': 'Júl', + 'aug': 'Aug', + 'sep': 'Szep', + 'oct': 'Okt', + 'nov': 'Nov', + 'dec': 'Dec', + 'sunday': 'Vasárnap', + 'monday': 'Hétfő', + 'tuesday': 'Kedd', + 'wednesday': 'Szerda', + 'thursday': 'Csütörtök', + 'friday': 'Péntek', + 'saturday': 'Szombat', + 'sun': 'Vas', + 'mon': 'Hé', + 'tue': 'Ke', + 'wed': 'Sze', + 'thu': 'Csü', + 'fri': 'Pén', + 'sat': 'Szo', + 'tooltipLoading': 'Belöltés...' +}; +exports.hu = hu; + +},{}],9:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var date_utils_1 = require("./utils/date_utils"); +var draw_columns_1 = require("./draw_columns"); +exports.includeGetSet = function () { + /** + * SETTERS + */ + this.setOptions = function (options) { + var keys = Object.keys(options); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = options[key]; + if (key === 'vResources' || key === 'vColumnOrder') { + // ev = `this.set${key.substr(1)}(val)`; + this['set' + key.substr(1)](val); + } + else if (val instanceof Array) { + // ev = `this.set${key.substr(1)}(...val)`; + this['set' + key.substr(1)].apply(this, val); + } + else { + // ev = `this.set${key.substr(1)}(val)`; + this['set' + key.substr(1)](val); + } + } + }; + this.setUseFade = function (pVal) { this.vUseFade = pVal; }; + this.setUseMove = function (pVal) { this.vUseMove = pVal; }; + this.setUseRowHlt = function (pVal) { this.vUseRowHlt = pVal; }; + this.setUseToolTip = function (pVal) { this.vUseToolTip = pVal; }; + this.setUseSort = function (pVal) { this.vUseSort = pVal; }; + this.setUseSingleCell = function (pVal) { this.vUseSingleCell = pVal * 1; }; + this.setFormatArr = function () { + var vValidFormats = 'hour day week month quarter'; + this.vFormatArr = new Array(); + for (var i = 0, j = 0; i < arguments.length; i++) { + if (vValidFormats.indexOf(arguments[i].toLowerCase()) != -1 && arguments[i].length > 1) { + this.vFormatArr[j++] = arguments[i].toLowerCase(); + var vRegExp = new RegExp('(?:^|\s)' + arguments[i] + '(?!\S)', 'g'); + vValidFormats = vValidFormats.replace(vRegExp, ''); + } + } + }; + this.setShowRes = function (pVal) { this.vShowRes = pVal; }; + this.setShowDur = function (pVal) { this.vShowDur = pVal; }; + this.setShowComp = function (pVal) { this.vShowComp = pVal; }; + this.setShowStartDate = function (pVal) { this.vShowStartDate = pVal; }; + this.setShowEndDate = function (pVal) { this.vShowEndDate = pVal; }; + this.setShowPlanStartDate = function (pVal) { this.vShowPlanStartDate = pVal; }; + this.setShowPlanEndDate = function (pVal) { this.vShowPlanEndDate = pVal; }; + this.setShowCost = function (pVal) { this.vShowCost = pVal; }; + this.setShowAddEntries = function (pVal) { this.vShowAddEntries = pVal; }; + this.setShowTaskInfoRes = function (pVal) { this.vShowTaskInfoRes = pVal; }; + this.setShowTaskInfoDur = function (pVal) { this.vShowTaskInfoDur = pVal; }; + this.setShowTaskInfoComp = function (pVal) { this.vShowTaskInfoComp = pVal; }; + this.setShowTaskInfoStartDate = function (pVal) { this.vShowTaskInfoStartDate = pVal; }; + this.setShowTaskInfoEndDate = function (pVal) { this.vShowTaskInfoEndDate = pVal; }; + this.setShowTaskInfoNotes = function (pVal) { this.vShowTaskInfoNotes = pVal; }; + this.setShowTaskInfoLink = function (pVal) { this.vShowTaskInfoLink = pVal; }; + this.setShowEndWeekDate = function (pVal) { this.vShowEndWeekDate = pVal; }; + this.setShowWeekends = function (pVal) { this.vShowWeekends = pVal; }; + this.setShowSelector = function () { + var vValidSelectors = 'top bottom'; + this.vShowSelector = new Array(); + for (var i = 0, j = 0; i < arguments.length; i++) { + if (vValidSelectors.indexOf(arguments[i].toLowerCase()) != -1 && arguments[i].length > 1) { + this.vShowSelector[j++] = arguments[i].toLowerCase(); + var vRegExp = new RegExp('(?:^|\s)' + arguments[i] + '(?!\S)', 'g'); + vValidSelectors = vValidSelectors.replace(vRegExp, ''); + } + } + }; + this.setShowDeps = function (pVal) { this.vShowDeps = pVal; }; + this.setDateInputFormat = function (pVal) { this.vDateInputFormat = pVal; }; + this.setDateTaskTableDisplayFormat = function (pVal) { this.vDateTaskTableDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setDateTaskDisplayFormat = function (pVal) { this.vDateTaskDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setHourMajorDateDisplayFormat = function (pVal) { this.vHourMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setHourMinorDateDisplayFormat = function (pVal) { this.vHourMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setDayMajorDateDisplayFormat = function (pVal) { this.vDayMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setDayMinorDateDisplayFormat = function (pVal) { this.vDayMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setWeekMajorDateDisplayFormat = function (pVal) { this.vWeekMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setWeekMinorDateDisplayFormat = function (pVal) { this.vWeekMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setMonthMajorDateDisplayFormat = function (pVal) { this.vMonthMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setMonthMinorDateDisplayFormat = function (pVal) { this.vMonthMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setQuarterMajorDateDisplayFormat = function (pVal) { this.vQuarterMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setQuarterMinorDateDisplayFormat = function (pVal) { this.vQuarterMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); }; + this.setCaptionType = function (pType) { this.vCaptionType = pType; }; + this.setFormat = function (pFormat) { + this.vFormat = pFormat; + this.Draw(); + }; + this.setWorkingDays = function (workingDays) { this.vWorkingDays = workingDays; }; + this.setMinGpLen = function (pMinGpLen) { this.vMinGpLen = pMinGpLen; }; + this.setScrollTo = function (pDate) { this.vScrollTo = pDate; }; + this.setHourColWidth = function (pWidth) { this.vHourColWidth = pWidth; }; + this.setDayColWidth = function (pWidth) { this.vDayColWidth = pWidth; }; + this.setWeekColWidth = function (pWidth) { this.vWeekColWidth = pWidth; }; + this.setMonthColWidth = function (pWidth) { this.vMonthColWidth = pWidth; }; + this.setQuarterColWidth = function (pWidth) { this.vQuarterColWidth = pWidth; }; + this.setRowHeight = function (pHeight) { this.vRowHeight = pHeight; }; + this.setLang = function (pLang) { if (this.vLangs[pLang]) + this.vLang = pLang; }; + this.setChartBody = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + this.vChartBody = pDiv; }; + this.setChartHead = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + this.vChartHead = pDiv; }; + this.setListBody = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + this.vListBody = pDiv; }; + this.setChartTable = function (pTable) { if (typeof HTMLTableElement !== 'function' || pTable instanceof HTMLTableElement) + this.vChartTable = pTable; }; + this.setLines = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + this.vLines = pDiv; }; + this.setLineOptions = function (lineOptions) { this.vLineOptions = lineOptions; }; + this.setTimer = function (pVal) { this.vTimer = pVal * 1; }; + this.setTooltipDelay = function (pVal) { this.vTooltipDelay = pVal * 1; }; + this.setTooltipTemplate = function (pVal) { this.vTooltipTemplate = pVal; }; + this.setMinDate = function (pVal) { this.vMinDate = pVal; }; + this.setMaxDate = function (pVal) { this.vMaxDate = pVal; }; + this.addLang = function (pLang, pVals) { + if (!this.vLangs[pLang]) { + this.vLangs[pLang] = new Object(); + for (var vKey in this.vLangs['en']) + this.vLangs[pLang][vKey] = (pVals[vKey]) ? document.createTextNode(pVals[vKey]).data : this.vLangs['en'][vKey]; + } + }; + this.setTotalHeight = function (pVal) { this.vTotalHeight = pVal; }; + this.setEvents = function (pEvents) { this.vEvents = pEvents; }; + this.setEventsChange = function (pEventsChange) { this.vEventsChange = pEventsChange; }; + this.setEventClickRow = function (fn) { this.vEventClickRow = fn; }; + this.setResources = function (resources) { this.vResources = resources; }; + this.setAdditionalHeaders = function (headers) { this.vAdditionalHeaders = headers; }; + this.setColumnOrder = function (order) { this.vColumnOrder = order; }; + this.setEditable = function (editable) { this.vEditable = editable; }; + this.setDebug = function (debug) { this.vDebug = debug; }; + /** + * GETTERS + */ + this.getDivId = function () { return this.vDivId; }; + this.getUseFade = function () { return this.vUseFade; }; + this.getUseMove = function () { return this.vUseMove; }; + this.getUseRowHlt = function () { return this.vUseRowHlt; }; + this.getUseToolTip = function () { return this.vUseToolTip; }; + this.getUseSort = function () { return this.vUseSort; }; + this.getUseSingleCell = function () { return this.vUseSingleCell; }; + this.getFormatArr = function () { return this.vFormatArr; }; + this.getShowRes = function () { return this.vShowRes; }; + this.getShowDur = function () { return this.vShowDur; }; + this.getShowComp = function () { return this.vShowComp; }; + this.getShowStartDate = function () { return this.vShowStartDate; }; + this.getShowEndDate = function () { return this.vShowEndDate; }; + this.getShowPlanStartDate = function () { return this.vShowPlanStartDate; }; + this.getShowPlanEndDate = function () { return this.vShowPlanEndDate; }; + this.getShowCost = function () { return this.vShowCost; }; + this.getShowAddEntries = function () { return this.vShowAddEntries; }; + this.getShowTaskInfoRes = function () { return this.vShowTaskInfoRes; }; + this.getShowTaskInfoDur = function () { return this.vShowTaskInfoDur; }; + this.getShowTaskInfoComp = function () { return this.vShowTaskInfoComp; }; + this.getShowTaskInfoStartDate = function () { return this.vShowTaskInfoStartDate; }; + this.getShowTaskInfoEndDate = function () { return this.vShowTaskInfoEndDate; }; + this.getShowTaskInfoNotes = function () { return this.vShowTaskInfoNotes; }; + this.getShowTaskInfoLink = function () { return this.vShowTaskInfoLink; }; + this.getShowEndWeekDate = function () { return this.vShowEndWeekDate; }; + this.getShowWeekends = function () { return this.vShowWeekends; }; + this.getShowSelector = function () { return this.vShowSelector; }; + this.getShowDeps = function () { return this.vShowDeps; }; + this.getDateInputFormat = function () { return this.vDateInputFormat; }; + this.getDateTaskTableDisplayFormat = function () { return this.vDateTaskTableDisplayFormat; }; + this.getDateTaskDisplayFormat = function () { return this.vDateTaskDisplayFormat; }; + this.getHourMajorDateDisplayFormat = function () { return this.vHourMajorDateDisplayFormat; }; + this.getHourMinorDateDisplayFormat = function () { return this.vHourMinorDateDisplayFormat; }; + this.getDayMajorDateDisplayFormat = function () { return this.vDayMajorDateDisplayFormat; }; + this.getDayMinorDateDisplayFormat = function () { return this.vDayMinorDateDisplayFormat; }; + this.getWeekMajorDateDisplayFormat = function () { return this.vWeekMajorDateDisplayFormat; }; + this.getWeekMinorDateDisplayFormat = function () { return this.vWeekMinorDateDisplayFormat; }; + this.getMonthMajorDateDisplayFormat = function () { return this.vMonthMajorDateDisplayFormat; }; + this.getMonthMinorDateDisplayFormat = function () { return this.vMonthMinorDateDisplayFormat; }; + this.getQuarterMajorDateDisplayFormat = function () { return this.vQuarterMajorDateDisplayFormat; }; + this.getQuarterMinorDateDisplayFormat = function () { return this.vQuarterMinorDateDisplayFormat; }; + this.getCaptionType = function () { return this.vCaptionType; }; + this.getMinGpLen = function () { return this.vMinGpLen; }; + this.getScrollTo = function () { return this.vScrollTo; }; + this.getHourColWidth = function () { return this.vHourColWidth; }; + this.getDayColWidth = function () { return this.vDayColWidth; }; + this.getWeekColWidth = function () { return this.vWeekColWidth; }; + this.getMonthColWidth = function () { return this.vMonthColWidth; }; + this.getQuarterColWidth = function () { return this.vQuarterColWidth; }; + this.getRowHeight = function () { return this.vRowHeight; }; + this.getChartBody = function () { return this.vChartBody; }; + this.getChartHead = function () { return this.vChartHead; }; + this.getListBody = function () { return this.vListBody; }; + this.getChartTable = function () { return this.vChartTable; }; + this.getLines = function () { return this.vLines; }; + this.getTimer = function () { return this.vTimer; }; + this.getMinDate = function () { return this.vMinDate; }; + this.getMaxDate = function () { return this.vMaxDate; }; + this.getTooltipDelay = function () { return this.vTooltipDelay; }; + this.getList = function () { return this.vTaskList; }; + this.getEventsClickCell = function () { return this.vEvents; }; + this.getEventsChange = function () { return this.vEventsChange; }; + this.getEventClickRow = function () { return this.vEventClickRow; }; + this.getResources = function () { return this.vResources; }; + this.getAdditionalHeaders = function () { return this.vAdditionalHeaders; }; + this.getColumnOrder = function () { return this.vColumnOrder || draw_columns_1.COLUMN_ORDER; }; +}; + +},{"./draw_columns":3,"./utils/date_utils":11}],10:[function(require,module,exports){ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var general_utils_1 = require("./utils/general_utils"); +var draw_utils_1 = require("./utils/draw_utils"); +var date_utils_1 = require("./utils/date_utils"); +// function to open window to display task link +exports.taskLink = function (pRef, pWidth, pHeight) { + var vWidth, vHeight; + if (pWidth) + vWidth = pWidth; + else + vWidth = 400; + if (pHeight) + vHeight = pHeight; + else + vHeight = 400; + window.open(pRef, 'newwin', 'height=' + vHeight + ',width=' + vWidth); // let OpenWindow = +}; +exports.sortTasks = function (pList, pID, pIdx) { + if (pList.length < 2) { + return pIdx; + } + var sortIdx = pIdx; + var sortArr = new Array(); + for (var i = 0; i < pList.length; i++) { + if (pList[i].getParent() == pID) + sortArr.push(pList[i]); + } + if (sortArr.length > 0) { + sortArr.sort(function (a, b) { + var i = a.getStart().getTime() - b.getStart().getTime(); + if (i == 0) + i = a.getEnd().getTime() - b.getEnd().getTime(); + if (i == 0) + return a.getID() - b.getID(); + else + return i; + }); + } + for (var j = 0; j < sortArr.length; j++) { + for (var i = 0; i < pList.length; i++) { + if (pList[i].getID() == sortArr[j].getID()) { + pList[i].setSortIdx(sortIdx++); + sortIdx = exports.sortTasks(pList, pList[i].getID(), sortIdx); + } + } + } + return sortIdx; +}; +exports.TaskItemObject = function (object) { + var pDataObject = __assign({}, object); + general_utils_1.internalProperties.forEach(function (property) { + delete pDataObject[property]; + }); + return new exports.TaskItem(object.pID, object.pName, object.pStart, object.pEnd, object.pClass, object.pLink, object.pMile, object.pRes, object.pComp, object.pGroup, object.pParent, object.pOpen, object.pDepend, object.pCaption, object.pNotes, object.pGantt, object.pCost, object.pPlanStart, object.pPlanEnd, object.pDuration, object.pBarText, object); +}; +exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt, pCost, pPlanStart, pPlanEnd, pDuration, pBarText, pDataObject) { + if (pCost === void 0) { pCost = null; } + if (pPlanStart === void 0) { pPlanStart = null; } + if (pPlanEnd === void 0) { pPlanEnd = null; } + if (pDuration === void 0) { pDuration = null; } + if (pBarText === void 0) { pBarText = null; } + if (pDataObject === void 0) { pDataObject = null; } + var vGantt = pGantt ? pGantt : this; + var _id = document.createTextNode(pID).data; + var vID = general_utils_1.hashKey(document.createTextNode(pID).data); + var vName = document.createTextNode(pName).data; + var vStart = null; + var vEnd = null; + var vPlanStart = null; + var vPlanEnd = null; + var vGroupMinStart = null; + var vGroupMinEnd = null; + var vClass = document.createTextNode(pClass).data; + var vLink = document.createTextNode(pLink).data; + var vMile = parseInt(document.createTextNode(pMile).data); + var vRes = document.createTextNode(pRes).data; + var vComp = parseFloat(document.createTextNode(pComp).data); + var vCost = parseInt(document.createTextNode(pCost).data); + var vGroup = parseInt(document.createTextNode(pGroup).data); + var vDataObject = pDataObject; + var vCompVal; + var parent = document.createTextNode(pParent).data; + if (parent && parent !== '0') { + parent = general_utils_1.hashKey(parent).toString(); + } + var vParent = parent; + var vOpen = (vGroup == 2) ? 1 : parseInt(document.createTextNode(pOpen).data); + var vDepend = new Array(); + var vDependType = new Array(); + var vCaption = document.createTextNode(pCaption).data; + var vDuration = pDuration || ''; + var vBarText = pBarText || ''; + var vLevel = 0; + var vNumKid = 0; + var vWeight = 0; + var vVisible = 1; + var vSortIdx = 0; + var vToDelete = false; + var x1, y1, x2, y2; + var vNotes; + var vParItem = null; + var vCellDiv = null; + var vBarDiv = null; + var vTaskDiv = null; + var vPlanTaskDiv = null; + var vListChildRow = null; + var vChildRow = null; + var vGroupSpan = null; + vNotes = document.createElement('span'); + vNotes.className = 'gTaskNotes'; + if (pNotes != null) { + vNotes.innerHTML = pNotes; + general_utils_1.stripUnwanted(vNotes); + } + if (pStart != null && pStart != '') { + vStart = (pStart instanceof Date) ? pStart : date_utils_1.parseDateStr(document.createTextNode(pStart).data, vGantt.getDateInputFormat()); + vGroupMinStart = vStart; + } + if (pEnd != null && pEnd != '') { + vEnd = (pEnd instanceof Date) ? pEnd : date_utils_1.parseDateStr(document.createTextNode(pEnd).data, vGantt.getDateInputFormat()); + vGroupMinEnd = vEnd; + } + if (pPlanStart != null && pPlanStart != '') { + vPlanStart = (pPlanStart instanceof Date) ? pPlanStart : date_utils_1.parseDateStr(document.createTextNode(pPlanStart).data, vGantt.getDateInputFormat()); + vGroupMinStart = vPlanStart; + } + if (pPlanEnd != null && pPlanEnd != '') { + vPlanEnd = (pPlanEnd instanceof Date) ? pPlanEnd : date_utils_1.parseDateStr(document.createTextNode(pPlanEnd).data, vGantt.getDateInputFormat()); + vGroupMinEnd = vPlanEnd; + } + if (pDepend != null) { + var vDependStr = pDepend + ''; + var vDepList = vDependStr.split(','); + var n = vDepList.length; + for (var k = 0; k < n; k++) { + if (vDepList[k].toUpperCase().endsWith('SS')) { + vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2); + vDependType[k] = 'SS'; + } + else if (vDepList[k].toUpperCase().endsWith('FF')) { + vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2); + vDependType[k] = 'FF'; + } + else if (vDepList[k].toUpperCase().endsWith('SF')) { + vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2); + vDependType[k] = 'SF'; + } + else if (vDepList[k].toUpperCase().endsWith('FS')) { + vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2); + vDependType[k] = 'FS'; + } + else { + vDepend[k] = vDepList[k]; + vDependType[k] = 'FS'; + } + if (vDepend[k]) { + vDepend[k] = general_utils_1.hashKey(vDepend[k]).toString(); + } + } + } + this.getID = function () { return vID; }; + this.getOriginalID = function () { return _id; }; + this.getGantt = function () { return vGantt; }; + this.getName = function () { return vName; }; + this.getStart = function () { + if (vStart) + return vStart; + else if (vPlanStart) + return vPlanStart; + else + return new Date(); + }; + this.getStartVar = function () { + return vStart; + }; + this.getEnd = function () { + if (vEnd) + return vEnd; + else if (vPlanEnd) + return vPlanEnd; + else if (vStart && vDuration) { + var date = new Date(vStart); + var vUnits = vDuration.split(' '); + var value = parseInt(vUnits[0]); + switch (vUnits[1]) { + case 'hour': + date.setMinutes(date.getMinutes() + (value * 60)); + break; + case 'day': + date.setMinutes(date.getMinutes() + (value * 60 * 24)); + break; + case 'week': + date.setMinutes(date.getMinutes() + (value * 60 * 24 * 7)); + break; + case 'month': + date.setMonth(date.getMonth() + (value)); + break; + case 'quarter': + date.setMonth(date.getMonth() + (value * 3)); + break; + } + return date; + } + else + return new Date(); + }; + this.getPlanStart = function () { return vPlanStart ? vPlanStart : vStart; }; + this.getPlanEnd = function () { return vPlanEnd ? vPlanEnd : vEnd; }; + this.getCost = function () { return vCost; }; + this.getGroupMinStart = function () { return vGroupMinStart; }; + this.getGroupMinEnd = function () { return vGroupMinEnd; }; + this.getClass = function () { return vClass; }; + this.getLink = function () { return vLink; }; + this.getMile = function () { return vMile; }; + this.getDepend = function () { + if (vDepend) + return vDepend; + else + return null; + }; + this.getDataObject = function () { return vDataObject; }; + this.getDepType = function () { if (vDependType) + return vDependType; + else + return null; }; + this.getCaption = function () { if (vCaption) + return vCaption; + else + return ''; }; + this.getResource = function () { if (vRes) + return vRes; + else + return '\u00A0'; }; + this.getCompVal = function () { if (vComp) + return vComp; + else if (vCompVal) + return vCompVal; + else + return 0; }; + this.getCompStr = function () { if (vComp) + return vComp + '%'; + else if (vCompVal) + return vCompVal + '%'; + else + return ''; }; + this.getCompRestStr = function () { if (vComp) + return (100 - vComp) + '%'; + else if (vCompVal) + return (100 - vCompVal) + '%'; + else + return ''; }; + this.getNotes = function () { return vNotes; }; + this.getSortIdx = function () { return vSortIdx; }; + this.getToDelete = function () { return vToDelete; }; + this.getDuration = function (pFormat, pLang) { + if (vMile) { + vDuration = '-'; + } + else if (!vEnd && vDuration) { + return vDuration; + } + else { + var vUnits = null; + switch (pFormat) { + case 'week': + vUnits = 'day'; + break; + case 'month': + vUnits = 'week'; + break; + case 'quarter': + vUnits = 'month'; + break; + default: + vUnits = pFormat; + break; + } + // let vTaskEnd = new Date(this.getEnd().getTime()); + // if ((vTaskEnd.getTime() - (vTaskEnd.getTimezoneOffset() * 60000)) % (86400000) == 0) { + // vTaskEnd = new Date(vTaskEnd.getFullYear(), vTaskEnd.getMonth(), vTaskEnd.getDate() + 1, vTaskEnd.getHours(), vTaskEnd.getMinutes(), vTaskEnd.getSeconds()); + // } + // let tmpPer = (getOffset(this.getStart(), vTaskEnd, 999, vUnits)) / 1000; + var hours = (this.getEnd().getTime() - this.getStart().getTime()) / 1000 / 60 / 60; + var tmpPer = void 0; + switch (vUnits) { + case 'hour': + tmpPer = Math.round(hours); + vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['hrs'] : pLang['hr']); + break; + case 'day': + tmpPer = Math.round(hours / 24); + vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['dys'] : pLang['dy']); + break; + case 'week': + tmpPer = Math.round(hours / 24 / 7); + vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['wks'] : pLang['wk']); + break; + case 'month': + tmpPer = Math.round(hours / 24 / 7 / 30); + vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['mths'] : pLang['mth']); + break; + case 'quarter': + tmpPer = Math.round(hours / 24 / 7 / 30 / 3); + vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['qtrs'] : pLang['qtr']); + break; + } + } + return vDuration; + }; + this.getBarText = function () { return vBarText; }; + this.getParent = function () { return vParent; }; + this.getGroup = function () { return vGroup; }; + this.getOpen = function () { return vOpen; }; + this.getLevel = function () { return vLevel; }; + this.getNumKids = function () { return vNumKid; }; + this.getWeight = function () { return vWeight; }; + this.getStartX = function () { return x1; }; + this.getStartY = function () { return y1; }; + this.getEndX = function () { return x2; }; + this.getEndY = function () { return y2; }; + this.getVisible = function () { return vVisible; }; + this.getParItem = function () { return vParItem; }; + this.getCellDiv = function () { return vCellDiv; }; + this.getBarDiv = function () { return vBarDiv; }; + this.getTaskDiv = function () { return vTaskDiv; }; + this.getPlanTaskDiv = function () { return vPlanTaskDiv; }; + this.getChildRow = function () { return vChildRow; }; + this.getListChildRow = function () { return vListChildRow; }; + this.getGroupSpan = function () { return vGroupSpan; }; + this.setName = function (pName) { vName = pName; }; + this.setNotes = function (pNotes) { vNotes = pNotes; }; + this.setClass = function (pClass) { vClass = pClass; }; + this.setCost = function (pCost) { vCost = pCost; }; + this.setResource = function (pRes) { vRes = pRes; }; + this.setDuration = function (pDuration) { vDuration = pDuration; }; + this.setDataObject = function (pDataObject) { vDataObject = pDataObject; }; + this.setStart = function (pStart) { + if (pStart instanceof Date) { + vStart = pStart; + } + else { + var temp = new Date(pStart); + if (temp instanceof Date && !isNaN(temp.valueOf())) { + vStart = temp; + } + } + }; + this.setEnd = function (pEnd) { + if (pEnd instanceof Date) { + vEnd = pEnd; + } + else { + var temp = new Date(pEnd); + if (temp instanceof Date && !isNaN(temp.valueOf())) { + vEnd = temp; + } + } + }; + this.setPlanStart = function (pPlanStart) { + if (pPlanStart instanceof Date) + vPlanStart = pPlanStart; + else + vPlanStart = new Date(pPlanStart); + }; + this.setPlanEnd = function (pPlanEnd) { + if (pPlanEnd instanceof Date) + vPlanEnd = pPlanEnd; + else + vPlanEnd = new Date(pPlanEnd); + }; + this.setGroupMinStart = function (pStart) { if (pStart instanceof Date) + vGroupMinStart = pStart; }; + this.setGroupMinEnd = function (pEnd) { if (pEnd instanceof Date) + vGroupMinEnd = pEnd; }; + this.setLevel = function (pLevel) { vLevel = parseInt(document.createTextNode(pLevel).data); }; + this.setNumKid = function (pNumKid) { vNumKid = parseInt(document.createTextNode(pNumKid).data); }; + this.setWeight = function (pWeight) { vWeight = parseInt(document.createTextNode(pWeight).data); }; + this.setCompVal = function (pCompVal) { vCompVal = parseFloat(document.createTextNode(pCompVal).data); }; + this.setComp = function (pComp) { + vComp = parseInt(document.createTextNode(pComp).data); + }; + this.setStartX = function (pX) { x1 = parseInt(document.createTextNode(pX).data); }; + this.setStartY = function (pY) { y1 = parseInt(document.createTextNode(pY).data); }; + this.setEndX = function (pX) { x2 = parseInt(document.createTextNode(pX).data); }; + this.setEndY = function (pY) { y2 = parseInt(document.createTextNode(pY).data); }; + this.setOpen = function (pOpen) { vOpen = parseInt(document.createTextNode(pOpen).data); }; + this.setVisible = function (pVisible) { vVisible = parseInt(document.createTextNode(pVisible).data); }; + this.setSortIdx = function (pSortIdx) { vSortIdx = parseInt(document.createTextNode(pSortIdx).data); }; + this.setToDelete = function (pToDelete) { if (pToDelete) + vToDelete = true; + else + vToDelete = false; }; + this.setParItem = function (pParItem) { if (pParItem) + vParItem = pParItem; }; + this.setCellDiv = function (pCellDiv) { if (typeof HTMLDivElement !== 'function' || pCellDiv instanceof HTMLDivElement) + vCellDiv = pCellDiv; }; //"typeof HTMLDivElement !== 'function'" to play nice with ie6 and 7 + this.setGroup = function (pGroup) { + if (pGroup === true || pGroup === 'true') { + vGroup = 1; + } + else if (pGroup === false || pGroup === 'false') { + vGroup = 0; + } + else { + vGroup = parseInt(document.createTextNode(pGroup).data); + } + }; + this.setBarText = function (pBarText) { if (pBarText) + vBarText = pBarText; }; + this.setBarDiv = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + vBarDiv = pDiv; }; + this.setTaskDiv = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + vTaskDiv = pDiv; }; + this.setPlanTaskDiv = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement) + vPlanTaskDiv = pDiv; }; + this.setChildRow = function (pRow) { if (typeof HTMLTableRowElement !== 'function' || pRow instanceof HTMLTableRowElement) + vChildRow = pRow; }; + this.setListChildRow = function (pRow) { if (typeof HTMLTableRowElement !== 'function' || pRow instanceof HTMLTableRowElement) + vListChildRow = pRow; }; + this.setGroupSpan = function (pSpan) { if (typeof HTMLSpanElement !== 'function' || pSpan instanceof HTMLSpanElement) + vGroupSpan = pSpan; }; + this.getAllData = function () { + return { + pID: vID, + pName: vName, + pStart: vStart, + pEnd: vEnd, + pPlanStart: vPlanStart, + pPlanEnd: vPlanEnd, + pGroupMinStart: vGroupMinStart, + pGroupMinEnd: vGroupMinEnd, + pClass: vClass, + pLink: vLink, + pMile: vMile, + pRes: vRes, + pComp: vComp, + pCost: vCost, + pGroup: vGroup, + pDataObjec: vDataObject + }; + }; +}; +/** + * @param pTask + * @param templateStrOrFn template string or function(task). In any case parameters in template string are substituted. + * If string - just a static template. + * If function(task): string - per task template. Can return null|undefined to fallback to default template. + * If function(task): Promise) - async per task template. Tooltip will show 'Loading...' if promise is not yet complete. + * Otherwise returned template will be handled in the same manner as in other cases. + */ +exports.createTaskInfo = function (pTask, templateStrOrFn) { + var _this = this; + if (templateStrOrFn === void 0) { templateStrOrFn = null; } + var vTmpDiv; + var vTaskInfoBox = document.createDocumentFragment(); + var vTaskInfo = draw_utils_1.newNode(vTaskInfoBox, 'div', null, 'gTaskInfo'); + var setupTemplate = function (template) { + vTaskInfo.innerHTML = ""; + if (template) { + var allData_1 = pTask.getAllData(); + general_utils_1.internalProperties.forEach(function (key) { + var lang; + if (general_utils_1.internalPropertiesLang[key]) { + lang = _this.vLangs[_this.vLang][general_utils_1.internalPropertiesLang[key]]; + } + if (!lang) { + lang = key; + } + var val = allData_1[key]; + template = template.replace("{{" + key + "}}", val); + if (lang) { + template = template.replace("{{Lang:" + key + "}}", lang); + } + else { + template = template.replace("{{Lang:" + key + "}}", key); + } + }); + draw_utils_1.newNode(vTaskInfo, 'span', null, 'gTtTemplate', template); + } + else { + draw_utils_1.newNode(vTaskInfo, 'span', null, 'gTtTitle', pTask.getName()); + if (_this.vShowTaskInfoStartDate == 1) { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIsd'); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['startdate'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', date_utils_1.formatDateStr(pTask.getStart(), _this.vDateTaskDisplayFormat, _this.vLangs[_this.vLang])); + } + if (_this.vShowTaskInfoEndDate == 1) { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIed'); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['enddate'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', date_utils_1.formatDateStr(pTask.getEnd(), _this.vDateTaskDisplayFormat, _this.vLangs[_this.vLang])); + } + if (_this.vShowTaskInfoDur == 1 && !pTask.getMile()) { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTId'); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['duration'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getDuration(_this.vFormat, _this.vLangs[_this.vLang])); + } + if (_this.vShowTaskInfoComp == 1) { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIc'); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['completion'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getCompStr()); + } + if (_this.vShowTaskInfoRes == 1) { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIr'); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['resource'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getResource()); + } + if (_this.vShowTaskInfoLink == 1 && pTask.getLink() != '') { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIl'); + var vTmpNode = draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel'); + vTmpNode = draw_utils_1.newNode(vTmpNode, 'a', null, 'gTaskText', _this.vLangs[_this.vLang]['moreinfo']); + vTmpNode.setAttribute('href', pTask.getLink()); + } + if (_this.vShowTaskInfoNotes == 1) { + vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIn'); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['notes'] + ': '); + if (pTask.getNotes()) + vTmpDiv.appendChild(pTask.getNotes()); + } + } + }; + var callback; + if (typeof templateStrOrFn === 'function') { + callback = function () { + var strOrPromise = templateStrOrFn(pTask); + if (!strOrPromise || typeof strOrPromise === 'string') { + setupTemplate(strOrPromise); + } + else if (strOrPromise.then) { + setupTemplate(_this.vLangs[_this.vLang]['tooltipLoading'] || _this.vLangs['en']['tooltipLoading']); + return strOrPromise.then(setupTemplate); + } + }; + } + else { + setupTemplate(templateStrOrFn); + } + return { component: vTaskInfoBox, callback: callback }; +}; +exports.AddTaskItem = function (value) { + var vExists = false; + for (var i = 0; i < this.vTaskList.length; i++) { + if (this.vTaskList[i].getID() == value.getID()) { + i = this.vTaskList.length; + vExists = true; + } + } + if (!vExists) { + this.vTaskList.push(value); + this.vProcessNeeded = true; + } +}; +exports.AddTaskItemObject = function (object) { + if (!object.pGantt) { + object.pGantt = this; + } + return this.AddTaskItem(exports.TaskItemObject(object)); +}; +exports.RemoveTaskItem = function (pID) { + // simply mark the task for removal at this point - actually remove it next time we re-draw the chart + for (var i = 0; i < this.vTaskList.length; i++) { + if (this.vTaskList[i].getID() == pID) + this.vTaskList[i].setToDelete(true); + else if (this.vTaskList[i].getParent() == pID) + this.RemoveTaskItem(this.vTaskList[i].getID()); + } + this.vProcessNeeded = true; +}; +exports.ClearTasks = function () { + var _this = this; + this.vTaskList.map(function (task) { return _this.RemoveTaskItem(task.getID()); }); + this.vProcessNeeded = true; +}; +// Recursively process task tree ... set min, max dates of parent tasks and identfy task level. +exports.processRows = function (pList, pID, pRow, pLevel, pOpen, pUseSort, vDebug) { + if (vDebug === void 0) { vDebug = false; } + var vMinDate = new Date(); + var vMaxDate = new Date(); + var vVisible = pOpen; + var vCurItem = null; + var vCompSum = 0; + var vMinSet = 0; + var vMaxSet = 0; + var vNumKid = 0; + var vWeight = 0; + var vLevel = pLevel; + var vList = pList; + var vComb = false; + var i = 0; + for (i = 0; i < pList.length; i++) { + if (pList[i].getToDelete()) { + pList.splice(i, 1); + i--; + } + if (i >= 0 && pList[i].getID() == pID) + vCurItem = pList[i]; + } + for (i = 0; i < pList.length; i++) { + if (pList[i].getParent() == pID) { + vVisible = pOpen; + pList[i].setParItem(vCurItem); + pList[i].setVisible(vVisible); + if (vVisible == 1 && pList[i].getOpen() == 0) + vVisible = 0; + if (pList[i].getMile() && pList[i].getParItem() && pList[i].getParItem().getGroup() == 2) { //remove milestones owned by combined groups + pList.splice(i, 1); + i--; + continue; + } + pList[i].setLevel(vLevel); + if (pList[i].getGroup()) { + if (pList[i].getParItem() && pList[i].getParItem().getGroup() == 2) + pList[i].setGroup(2); + exports.processRows(vList, pList[i].getID(), i, vLevel + 1, vVisible, 0); + } + if (vMinSet == 0 || pList[i].getStart() < vMinDate) { + vMinDate = pList[i].getStart(); + vMinSet = 1; + } + if (vMaxSet == 0 || pList[i].getEnd() > vMaxDate) { + vMaxDate = pList[i].getEnd(); + vMaxSet = 1; + } + vNumKid++; + vWeight += pList[i].getEnd() - pList[i].getStart() + 1; + vCompSum += pList[i].getCompVal() * (pList[i].getEnd() - pList[i].getStart() + 1); + pList[i].setSortIdx(i * pList.length); + } + } + if (pRow >= 0) { + if (pList[pRow].getGroupMinStart() != null && pList[pRow].getGroupMinStart() < vMinDate) { + vMinDate = pList[pRow].getGroupMinStart(); + } + if (pList[pRow].getGroupMinEnd() != null && pList[pRow].getGroupMinEnd() > vMaxDate) { + vMaxDate = pList[pRow].getGroupMinEnd(); + } + pList[pRow].setStart(vMinDate); + pList[pRow].setEnd(vMaxDate); + pList[pRow].setNumKid(vNumKid); + pList[pRow].setWeight(vWeight); + pList[pRow].setCompVal(Math.ceil(vCompSum / vWeight)); + } + if (pID == 0 && pUseSort == 1) { + var bd = void 0; + if (vDebug) { + bd = new Date(); + console.log('before afterTasks', bd); + } + exports.sortTasks(pList, 0, 0); + if (vDebug) { + var ad = new Date(); + console.log('after afterTasks', ad, (ad.getTime() - bd.getTime())); + } + pList.sort(function (a, b) { return a.getSortIdx() - b.getSortIdx(); }); + } + if (pID == 0 && pUseSort != 1) // Need to sort combined tasks regardless + { + for (i = 0; i < pList.length; i++) { + if (pList[i].getGroup() == 2) { + vComb = true; + var bd = void 0; + if (vDebug) { + bd = new Date(); + console.log('before sortTasks', bd); + } + exports.sortTasks(pList, pList[i].getID(), pList[i].getSortIdx() + 1); + if (vDebug) { + var ad = new Date(); + console.log('after sortTasks', ad, (ad.getTime() - bd.getTime())); + } + } + } + if (vComb == true) + pList.sort(function (a, b) { return a.getSortIdx() - b.getSortIdx(); }); + } +}; + +},{"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13}],11:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * DATES + */ +exports.getMinDate = function (pList, pFormat, pMinDate) { + var vDate = new Date(); + if (pList.length <= 0) + return pMinDate || vDate; + vDate.setTime((pMinDate && pMinDate.getTime()) || pList[0].getStart().getTime()); + // Parse all Task Start dates to find min + for (var i = 0; i < pList.length; i++) { + if (pList[i].getStart().getTime() < vDate.getTime()) + vDate.setTime(pList[i].getStart().getTime()); + } + // Adjust min date to specific format boundaries (first of week or first of month) + if (pFormat == 'day') { + vDate.setDate(vDate.getDate() - 1); + while (vDate.getDay() % 7 != 1) + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'week') { + vDate.setDate(vDate.getDate() - 1); + while (vDate.getDay() % 7 != 1) + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'month') { + vDate.setDate(vDate.getDate() - 15); + while (vDate.getDate() > 1) + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'quarter') { + vDate.setDate(vDate.getDate() - 31); + if (vDate.getMonth() == 0 || vDate.getMonth() == 1 || vDate.getMonth() == 2) + vDate.setFullYear(vDate.getFullYear(), 0, 1); + else if (vDate.getMonth() == 3 || vDate.getMonth() == 4 || vDate.getMonth() == 5) + vDate.setFullYear(vDate.getFullYear(), 3, 1); + else if (vDate.getMonth() == 6 || vDate.getMonth() == 7 || vDate.getMonth() == 8) + vDate.setFullYear(vDate.getFullYear(), 6, 1); + else if (vDate.getMonth() == 9 || vDate.getMonth() == 10 || vDate.getMonth() == 11) + vDate.setFullYear(vDate.getFullYear(), 9, 1); + } + else if (pFormat == 'hour') { + vDate.setHours(vDate.getHours() - 1); + while (vDate.getHours() % 6 != 0) + vDate.setHours(vDate.getHours() - 1); + } + if (pFormat == 'hour') + vDate.setMinutes(0, 0); + else + vDate.setHours(0, 0, 0); + return (vDate); +}; +exports.getMaxDate = function (pList, pFormat, pMaxDate) { + var vDate = new Date(); + if (pList.length <= 0) + return pMaxDate || vDate; + vDate.setTime((pMaxDate && pMaxDate.getTime()) || pList[0].getEnd().getTime()); + // Parse all Task End dates to find max + for (var i = 0; i < pList.length; i++) { + if (pList[i].getEnd().getTime() > vDate.getTime()) + vDate.setTime(pList[i].getEnd().getTime()); + } + // Adjust max date to specific format boundaries (end of week or end of month) + if (pFormat == 'day') { + vDate.setDate(vDate.getDate() + 1); + while (vDate.getDay() % 7 != 0) + vDate.setDate(vDate.getDate() + 1); + } + else if (pFormat == 'week') { + //For weeks, what is the last logical boundary? + vDate.setDate(vDate.getDate() + 1); + while (vDate.getDay() % 7 != 0) + vDate.setDate(vDate.getDate() + 1); + } + else if (pFormat == 'month') { + // Set to last day of current Month + while (vDate.getDate() > 1) + vDate.setDate(vDate.getDate() + 1); + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'quarter') { + // Set to last day of current Quarter + if (vDate.getMonth() == 0 || vDate.getMonth() == 1 || vDate.getMonth() == 2) + vDate.setFullYear(vDate.getFullYear(), 2, 31); + else if (vDate.getMonth() == 3 || vDate.getMonth() == 4 || vDate.getMonth() == 5) + vDate.setFullYear(vDate.getFullYear(), 5, 30); + else if (vDate.getMonth() == 6 || vDate.getMonth() == 7 || vDate.getMonth() == 8) + vDate.setFullYear(vDate.getFullYear(), 8, 30); + else if (vDate.getMonth() == 9 || vDate.getMonth() == 10 || vDate.getMonth() == 11) + vDate.setFullYear(vDate.getFullYear(), 11, 31); + } + else if (pFormat == 'hour') { + if (vDate.getHours() == 0) + vDate.setDate(vDate.getDate() + 1); + vDate.setHours(vDate.getHours() + 1); + while (vDate.getHours() % 6 != 5) + vDate.setHours(vDate.getHours() + 1); + } + return (vDate); +}; +exports.coerceDate = function (date) { + if (date instanceof Date) { + return date; + } + else { + var temp = new Date(date); + if (temp instanceof Date && !isNaN(temp.valueOf())) { + return temp; + } + } +}; +exports.parseDateStr = function (pDateStr, pFormatStr) { + var vDate = new Date(); + var vDateParts = pDateStr.split(/[^0-9]/); + if (pDateStr.length >= 10 && vDateParts.length >= 3) { + while (vDateParts.length < 5) + vDateParts.push(0); + switch (pFormatStr) { + case 'mm/dd/yyyy': + vDate = new Date(vDateParts[2], vDateParts[0] - 1, vDateParts[1], vDateParts[3], vDateParts[4]); + break; + case 'dd/mm/yyyy': + vDate = new Date(vDateParts[2], vDateParts[1] - 1, vDateParts[0], vDateParts[3], vDateParts[4]); + break; + case 'yyyy-mm-dd': + vDate = new Date(vDateParts[0], vDateParts[1] - 1, vDateParts[2], vDateParts[3], vDateParts[4]); + break; + } + } + return (vDate); +}; +exports.formatDateStr = function (pDate, pDateFormatArr, pL) { + var vDateStr = ''; + var vYear2Str = pDate.getFullYear().toString().substring(2, 4); + var vMonthStr = (pDate.getMonth() + 1) + ''; + var vMonthArr = new Array(pL['january'], pL['february'], pL['march'], pL['april'], pL['maylong'], pL['june'], pL['july'], pL['august'], pL['september'], pL['october'], pL['november'], pL['december']); + var vDayArr = new Array(pL['sunday'], pL['monday'], pL['tuesday'], pL['wednesday'], pL['thursday'], pL['friday'], pL['saturday']); + var vMthArr = new Array(pL['jan'], pL['feb'], pL['mar'], pL['apr'], pL['may'], pL['jun'], pL['jul'], pL['aug'], pL['sep'], pL['oct'], pL['nov'], pL['dec']); + var vDyArr = new Array(pL['sun'], pL['mon'], pL['tue'], pL['wed'], pL['thu'], pL['fri'], pL['sat']); + for (var i = 0; i < pDateFormatArr.length; i++) { + switch (pDateFormatArr[i]) { + case 'dd': + if (pDate.getDate() < 10) + vDateStr += '0'; // now fall through + case 'd': + vDateStr += pDate.getDate(); + break; + case 'day': + vDateStr += vDyArr[pDate.getDay()]; + break; + case 'DAY': + vDateStr += vDayArr[pDate.getDay()]; + break; + case 'mm': + if (parseInt(vMonthStr, 10) < 10) + vDateStr += '0'; // now fall through + case 'm': + vDateStr += vMonthStr; + break; + case 'mon': + vDateStr += vMthArr[pDate.getMonth()]; + break; + case 'month': + vDateStr += vMonthArr[pDate.getMonth()]; + break; + case 'yyyy': + vDateStr += pDate.getFullYear(); + break; + case 'yy': + vDateStr += vYear2Str; + break; + case 'qq': + vDateStr += pL['qtr']; // now fall through + case 'q': + vDateStr += Math.floor(pDate.getMonth() / 3) + 1; + break; + case 'hh': + if ((((pDate.getHours() % 12) == 0) ? 12 : pDate.getHours() % 12) < 10) + vDateStr += '0'; // now fall through + case 'h': + vDateStr += ((pDate.getHours() % 12) == 0) ? 12 : pDate.getHours() % 12; + break; + case 'HH': + if ((pDate.getHours()) < 10) + vDateStr += '0'; // now fall through + case 'H': + vDateStr += (pDate.getHours()); + break; + case 'MI': + if (pDate.getMinutes() < 10) + vDateStr += '0'; // now fall through + case 'mi': + vDateStr += pDate.getMinutes(); + break; + case 'pm': + vDateStr += ((pDate.getHours()) < 12) ? 'am' : 'pm'; + break; + case 'PM': + vDateStr += ((pDate.getHours()) < 12) ? 'AM' : 'PM'; + break; + case 'ww': + if (exports.getIsoWeek(pDate) < 10) + vDateStr += '0'; // now fall through + case 'w': + vDateStr += exports.getIsoWeek(pDate); + break; + case 'week': + var vWeekNum = exports.getIsoWeek(pDate); + var vYear = pDate.getFullYear(); + var vDayOfWeek = (pDate.getDay() == 0) ? 7 : pDate.getDay(); + if (vWeekNum >= 52 && parseInt(vMonthStr, 10) === 1) + vYear--; + if (vWeekNum == 1 && parseInt(vMonthStr, 10) === 12) + vYear++; + if (vWeekNum < 10) + vWeekNum = parseInt('0' + vWeekNum, 10); + vDateStr += vYear + '-W' + vWeekNum + '-' + vDayOfWeek; + break; + default: + if (pL[pDateFormatArr[i].toLowerCase()]) + vDateStr += pL[pDateFormatArr[i].toLowerCase()]; + else + vDateStr += pDateFormatArr[i]; + break; + } + } + return vDateStr; +}; +exports.parseDateFormatStr = function (pFormatStr) { + var vComponantStr = ''; + var vCurrChar = ''; + var vSeparators = new RegExp('[\/\\ -.,\'":]'); + var vDateFormatArray = new Array(); + for (var i = 0; i < pFormatStr.length; i++) { + vCurrChar = pFormatStr.charAt(i); + if ((vCurrChar.match(vSeparators)) || (i + 1 == pFormatStr.length)) // separator or end of string + { + if ((i + 1 == pFormatStr.length) && (!(vCurrChar.match(vSeparators)))) // at end of string add any non-separator chars to the current component + { + vComponantStr += vCurrChar; + } + vDateFormatArray.push(vComponantStr); + if (vCurrChar.match(vSeparators)) + vDateFormatArray.push(vCurrChar); + vComponantStr = ''; + } + else { + vComponantStr += vCurrChar; + } + } + return vDateFormatArray; +}; +exports.getIsoWeek = function (pDate) { + // We have to compare against the monday of the first week of the year containing 04 jan *not* 01/01 + // 60*60*24*1000=86400000 + var dayMiliseconds = 86400000; + var keyDay = new Date(pDate.getFullYear(), 0, 4, 0, 0, 0); + var keyDayOfWeek = (keyDay.getDay() == 0) ? 6 : keyDay.getDay() - 1; // define monday as 0 + var firstMondayYearTime = keyDay.getTime() - (keyDayOfWeek * dayMiliseconds); + var thisDate = new Date(pDate.getFullYear(), pDate.getMonth(), pDate.getDate(), 0, 0, 0); // This at 00:00:00 + var thisTime = thisDate.getTime(); + var daysFromFirstMonday = Math.round(((thisTime - firstMondayYearTime) / dayMiliseconds)); + var lastWeek = 99; + var thisWeek = 99; + var firstMondayYear = new Date(firstMondayYearTime); + thisWeek = Math.ceil((daysFromFirstMonday + 1) / 7); + if (thisWeek <= 0) + thisWeek = exports.getIsoWeek(new Date(pDate.getFullYear() - 1, 11, 31, 0, 0, 0)); + else if (thisWeek == 53 && (new Date(pDate.getFullYear(), 0, 1, 0, 0, 0)).getDay() != 4 && (new Date(pDate.getFullYear(), 11, 31, 0, 0, 0)).getDay() != 4) + thisWeek = 1; + return thisWeek; +}; + +},{}],12:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var events_1 = require("../events"); +exports.makeInput = function (formattedValue, editable, type, value, choices) { + if (type === void 0) { type = 'text'; } + if (value === void 0) { value = null; } + if (choices === void 0) { choices = null; } + if (!value) { + value = formattedValue; + } + if (editable) { + switch (type) { + case 'date': + // Take timezone into account before converting to ISO String + value = value ? new Date(value.getTime() - (value.getTimezoneOffset() * 60000)).toISOString().split('T')[0] : ''; + return ""; + case 'resource': + if (choices) { + var found = choices.filter(function (c) { return c.id == value || c.name == value; }); + if (found && found.length > 0) { + value = found[0].id; + } + else { + choices.push({ id: value, name: value }); + } + return ""; + } + else { + return ""; + } + case 'cost': + return ""; + default: + return ""; + } + } + else { + return formattedValue; + } +}; +exports.newNode = function (pParent, pNodeType, pId, pClass, pText, pWidth, pLeft, pDisplay, pColspan, pAttribs) { + if (pId === void 0) { pId = null; } + if (pClass === void 0) { pClass = null; } + if (pText === void 0) { pText = null; } + if (pWidth === void 0) { pWidth = null; } + if (pLeft === void 0) { pLeft = null; } + if (pDisplay === void 0) { pDisplay = null; } + if (pColspan === void 0) { pColspan = null; } + if (pAttribs === void 0) { pAttribs = null; } + var vNewNode = pParent.appendChild(document.createElement(pNodeType)); + if (pAttribs) { + for (var i = 0; i + 1 < pAttribs.length; i += 2) { + vNewNode.setAttribute(pAttribs[i], pAttribs[i + 1]); + } + } + if (pId) + vNewNode.id = pId; // I wish I could do this with setAttribute but older IEs don't play nice + if (pClass) + vNewNode.className = pClass; + if (pWidth) + vNewNode.style.width = (isNaN(pWidth * 1)) ? pWidth : pWidth + 'px'; + if (pLeft) + vNewNode.style.left = (isNaN(pLeft * 1)) ? pLeft : pLeft + 'px'; + if (pText) { + if (pText.indexOf && pText.indexOf('<') === -1) { + vNewNode.appendChild(document.createTextNode(pText)); + } + else { + vNewNode.insertAdjacentHTML('beforeend', pText); + } + } + if (pDisplay) + vNewNode.style.display = pDisplay; + if (pColspan) + vNewNode.colSpan = pColspan; + return vNewNode; +}; +exports.getArrayLocationByID = function (pId) { + var vList = this.getList(); + for (var i = 0; i < vList.length; i++) { + if (vList[i].getID() == pId) + return i; + } + return -1; +}; +exports.CalcTaskXY = function () { + var vID; + var vList = this.getList(); + var vBarDiv; + var vTaskDiv; + var vParDiv; + var vLeft, vTop, vWidth; + var vHeight = Math.floor((this.getRowHeight() / 2)); + for (var i = 0; i < vList.length; i++) { + vID = vList[i].getID(); + vBarDiv = vList[i].getBarDiv(); + vTaskDiv = vList[i].getTaskDiv(); + if ((vList[i].getParItem() && vList[i].getParItem().getGroup() == 2)) { + vParDiv = vList[i].getParItem().getChildRow(); + } + else + vParDiv = vList[i].getChildRow(); + if (vBarDiv) { + vList[i].setStartX(vBarDiv.offsetLeft + 1); + vList[i].setStartY(vParDiv.offsetTop + vBarDiv.offsetTop + vHeight - 1); + vList[i].setEndX(vBarDiv.offsetLeft + vBarDiv.offsetWidth + 1); + vList[i].setEndY(vParDiv.offsetTop + vBarDiv.offsetTop + vHeight - 1); + } + } +}; +exports.sLine = function (x1, y1, x2, y2, pClass) { + var vLeft = Math.min(x1, x2); + var vTop = Math.min(y1, y2); + var vWid = Math.abs(x2 - x1) + 1; + var vHgt = Math.abs(y2 - y1) + 1; + var vTmpDiv = document.createElement('div'); + vTmpDiv.id = this.vDivId + 'line' + this.vDepId++; + vTmpDiv.style.position = 'absolute'; + vTmpDiv.style.overflow = 'hidden'; + vTmpDiv.style.zIndex = '0'; + vTmpDiv.style.left = vLeft + 'px'; + vTmpDiv.style.top = vTop + 'px'; + vTmpDiv.style.width = vWid + 'px'; + vTmpDiv.style.height = vHgt + 'px'; + vTmpDiv.style.visibility = 'visible'; + if (vWid == 1) + vTmpDiv.className = 'glinev'; + else + vTmpDiv.className = 'glineh'; + if (pClass) + vTmpDiv.className += ' ' + pClass; + this.getLines().appendChild(vTmpDiv); + if (this.vEvents.onLineDraw && typeof this.vEvents.onLineDraw === 'function') { + this.vEvents.onLineDraw(vTmpDiv); + } + return vTmpDiv; +}; +exports.drawSelector = function (pPos) { + var vOutput = document.createDocumentFragment(); + var vDisplay = false; + for (var i = 0; i < this.vShowSelector.length && !vDisplay; i++) { + if (this.vShowSelector[i].toLowerCase() == pPos.toLowerCase()) + vDisplay = true; + } + if (vDisplay) { + var vTmpDiv = exports.newNode(vOutput, 'div', null, 'gselector', this.vLangs[this.vLang]['format'] + ':'); + if (this.vFormatArr.join().toLowerCase().indexOf('hour') != -1) + events_1.addFormatListeners(this, 'hour', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formathour' + pPos, 'gformlabel' + ((this.vFormat == 'hour') ? ' gselected' : ''), this.vLangs[this.vLang]['hour'])); + if (this.vFormatArr.join().toLowerCase().indexOf('day') != -1) + events_1.addFormatListeners(this, 'day', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatday' + pPos, 'gformlabel' + ((this.vFormat == 'day') ? ' gselected' : ''), this.vLangs[this.vLang]['day'])); + if (this.vFormatArr.join().toLowerCase().indexOf('week') != -1) + events_1.addFormatListeners(this, 'week', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatweek' + pPos, 'gformlabel' + ((this.vFormat == 'week') ? ' gselected' : ''), this.vLangs[this.vLang]['week'])); + if (this.vFormatArr.join().toLowerCase().indexOf('month') != -1) + events_1.addFormatListeners(this, 'month', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatmonth' + pPos, 'gformlabel' + ((this.vFormat == 'month') ? ' gselected' : ''), this.vLangs[this.vLang]['month'])); + if (this.vFormatArr.join().toLowerCase().indexOf('quarter') != -1) + events_1.addFormatListeners(this, 'quarter', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatquarter' + pPos, 'gformlabel' + ((this.vFormat == 'quarter') ? ' gselected' : ''), this.vLangs[this.vLang]['quarter'])); + } + else { + exports.newNode(vOutput, 'div', null, 'gselector'); + } + return vOutput; +}; + +},{"../events":5}],13:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.internalProperties = ['pID', 'pName', 'pStart', 'pEnd', 'pClass', 'pLink', 'pMile', 'pRes', 'pComp', 'pGroup', 'pParent', + 'pOpen', 'pDepend', 'pCaption', 'pNotes', 'pGantt', 'pCost', 'pPlanStart', 'pPlanEnd']; +exports.internalPropertiesLang = { + 'pID': 'id', + 'pName': 'name', + 'pStart': 'startdate', + 'pEnd': 'enddate', + 'pLink': 'link', + 'pMile': 'mile', + 'pRes': 'resource', + 'pComp': 'comp', + 'pGroup': 'group', + 'pParent': 'parent', + 'pOpen': 'open', + 'pDepend': 'depend', + 'pCaption': 'caption', + 'pNotes': 'notes', + 'pCost': 'cost', + 'pPlanStart': 'planstartdate', + 'pPlanEnd': 'planenddate' +}; +exports.getMinDate = function (pList, pFormat, pMinDate) { + var vDate = new Date(); + if (pList.length <= 0) + return pMinDate || vDate; + vDate.setTime((pMinDate && pMinDate.getTime()) || pList[0].getStart().getTime()); + // Parse all Task Start dates to find min + for (var i = 0; i < pList.length; i++) { + if (pList[i].getStart().getTime() < vDate.getTime()) + vDate.setTime(pList[i].getStart().getTime()); + } + // Adjust min date to specific format boundaries (first of week or first of month) + if (pFormat == 'day') { + vDate.setDate(vDate.getDate() - 1); + while (vDate.getDay() % 7 != 1) + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'week') { + vDate.setDate(vDate.getDate() - 1); + while (vDate.getDay() % 7 != 1) + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'month') { + vDate.setDate(vDate.getDate() - 15); + while (vDate.getDate() > 1) + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'quarter') { + vDate.setDate(vDate.getDate() - 31); + if (vDate.getMonth() == 0 || vDate.getMonth() == 1 || vDate.getMonth() == 2) + vDate.setFullYear(vDate.getFullYear(), 0, 1); + else if (vDate.getMonth() == 3 || vDate.getMonth() == 4 || vDate.getMonth() == 5) + vDate.setFullYear(vDate.getFullYear(), 3, 1); + else if (vDate.getMonth() == 6 || vDate.getMonth() == 7 || vDate.getMonth() == 8) + vDate.setFullYear(vDate.getFullYear(), 6, 1); + else if (vDate.getMonth() == 9 || vDate.getMonth() == 10 || vDate.getMonth() == 11) + vDate.setFullYear(vDate.getFullYear(), 9, 1); + } + else if (pFormat == 'hour') { + vDate.setHours(vDate.getHours() - 1); + while (vDate.getHours() % 6 != 0) + vDate.setHours(vDate.getHours() - 1); + } + if (pFormat == 'hour') + vDate.setMinutes(0, 0); + else + vDate.setHours(0, 0, 0); + return (vDate); +}; +exports.getMaxDate = function (pList, pFormat, pMaxDate) { + var vDate = new Date(); + if (pList.length <= 0) + return pMaxDate || vDate; + vDate.setTime((pMaxDate && pMaxDate.getTime()) || pList[0].getEnd().getTime()); + // Parse all Task End dates to find max + for (var i = 0; i < pList.length; i++) { + if (pList[i].getEnd().getTime() > vDate.getTime()) + vDate.setTime(pList[i].getEnd().getTime()); + } + // Adjust max date to specific format boundaries (end of week or end of month) + if (pFormat == 'day') { + vDate.setDate(vDate.getDate() + 1); + while (vDate.getDay() % 7 != 0) + vDate.setDate(vDate.getDate() + 1); + } + else if (pFormat == 'week') { + //For weeks, what is the last logical boundary? + vDate.setDate(vDate.getDate() + 1); + while (vDate.getDay() % 7 != 0) + vDate.setDate(vDate.getDate() + 1); + } + else if (pFormat == 'month') { + // Set to last day of current Month + while (vDate.getDate() > 1) + vDate.setDate(vDate.getDate() + 1); + vDate.setDate(vDate.getDate() - 1); + } + else if (pFormat == 'quarter') { + // Set to last day of current Quarter + if (vDate.getMonth() == 0 || vDate.getMonth() == 1 || vDate.getMonth() == 2) + vDate.setFullYear(vDate.getFullYear(), 2, 31); + else if (vDate.getMonth() == 3 || vDate.getMonth() == 4 || vDate.getMonth() == 5) + vDate.setFullYear(vDate.getFullYear(), 5, 30); + else if (vDate.getMonth() == 6 || vDate.getMonth() == 7 || vDate.getMonth() == 8) + vDate.setFullYear(vDate.getFullYear(), 8, 30); + else if (vDate.getMonth() == 9 || vDate.getMonth() == 10 || vDate.getMonth() == 11) + vDate.setFullYear(vDate.getFullYear(), 11, 31); + } + else if (pFormat == 'hour') { + if (vDate.getHours() == 0) + vDate.setDate(vDate.getDate() + 1); + vDate.setHours(vDate.getHours() + 1); + while (vDate.getHours() % 6 != 5) + vDate.setHours(vDate.getHours() + 1); + } + return (vDate); +}; +exports.findObj = function (theObj, theDoc) { + if (theDoc === void 0) { theDoc = null; } + var p, i, foundObj; + if (!theDoc) + theDoc = document; + if (document.getElementById) + foundObj = document.getElementById(theObj); + return foundObj; +}; +exports.changeFormat = function (pFormat, ganttObj) { + if (ganttObj) + ganttObj.setFormat(pFormat); + else + alert('Chart undefined'); +}; +exports.coerceDate = function (date) { + if (date instanceof Date) { + return date; + } + else { + var temp = new Date(date); + if (temp instanceof Date && !isNaN(temp.valueOf())) { + return temp; + } + } +}; +exports.parseDateStr = function (pDateStr, pFormatStr) { + var vDate = new Date(); + var vDateParts = pDateStr.split(/[^0-9]/); + if (pDateStr.length >= 10 && vDateParts.length >= 3) { + while (vDateParts.length < 5) + vDateParts.push(0); + switch (pFormatStr) { + case 'mm/dd/yyyy': + vDate = new Date(vDateParts[2], vDateParts[0] - 1, vDateParts[1], vDateParts[3], vDateParts[4]); + break; + case 'dd/mm/yyyy': + vDate = new Date(vDateParts[2], vDateParts[1] - 1, vDateParts[0], vDateParts[3], vDateParts[4]); + break; + case 'yyyy-mm-dd': + vDate = new Date(vDateParts[0], vDateParts[1] - 1, vDateParts[2], vDateParts[3], vDateParts[4]); + break; + } + } + return (vDate); +}; +exports.formatDateStr = function (pDate, pDateFormatArr, pL) { + var vDateStr = ''; + var vYear2Str = pDate.getFullYear().toString().substring(2, 4); + var vMonthStr = (pDate.getMonth() + 1) + ''; + var vMonthArr = new Array(pL['january'], pL['february'], pL['march'], pL['april'], pL['maylong'], pL['june'], pL['july'], pL['august'], pL['september'], pL['october'], pL['november'], pL['december']); + var vDayArr = new Array(pL['sunday'], pL['monday'], pL['tuesday'], pL['wednesday'], pL['thursday'], pL['friday'], pL['saturday']); + var vMthArr = new Array(pL['jan'], pL['feb'], pL['mar'], pL['apr'], pL['may'], pL['jun'], pL['jul'], pL['aug'], pL['sep'], pL['oct'], pL['nov'], pL['dec']); + var vDyArr = new Array(pL['sun'], pL['mon'], pL['tue'], pL['wed'], pL['thu'], pL['fri'], pL['sat']); + for (var i = 0; i < pDateFormatArr.length; i++) { + switch (pDateFormatArr[i]) { + case 'dd': + if (pDate.getDate() < 10) + vDateStr += '0'; // now fall through + case 'd': + vDateStr += pDate.getDate(); + break; + case 'day': + vDateStr += vDyArr[pDate.getDay()]; + break; + case 'DAY': + vDateStr += vDayArr[pDate.getDay()]; + break; + case 'mm': + if (parseInt(vMonthStr, 10) < 10) + vDateStr += '0'; // now fall through + case 'm': + vDateStr += vMonthStr; + break; + case 'mon': + vDateStr += vMthArr[pDate.getMonth()]; + break; + case 'month': + vDateStr += vMonthArr[pDate.getMonth()]; + break; + case 'yyyy': + vDateStr += pDate.getFullYear(); + break; + case 'yy': + vDateStr += vYear2Str; + break; + case 'qq': + vDateStr += pL['qtr']; // now fall through + case 'q': + vDateStr += Math.floor(pDate.getMonth() / 3) + 1; + break; + case 'hh': + if ((((pDate.getHours() % 12) == 0) ? 12 : pDate.getHours() % 12) < 10) + vDateStr += '0'; // now fall through + case 'h': + vDateStr += ((pDate.getHours() % 12) == 0) ? 12 : pDate.getHours() % 12; + break; + case 'HH': + if ((pDate.getHours()) < 10) + vDateStr += '0'; // now fall through + case 'H': + vDateStr += (pDate.getHours()); + break; + case 'MI': + if (pDate.getMinutes() < 10) + vDateStr += '0'; // now fall through + case 'mi': + vDateStr += pDate.getMinutes(); + break; + case 'pm': + vDateStr += ((pDate.getHours()) < 12) ? 'am' : 'pm'; + break; + case 'PM': + vDateStr += ((pDate.getHours()) < 12) ? 'AM' : 'PM'; + break; + case 'ww': + if (exports.getIsoWeek(pDate) < 10) + vDateStr += '0'; // now fall through + case 'w': + vDateStr += exports.getIsoWeek(pDate); + break; + case 'week': + var vWeekNum = exports.getIsoWeek(pDate); + var vYear = pDate.getFullYear(); + var vDayOfWeek = (pDate.getDay() == 0) ? 7 : pDate.getDay(); + if (vWeekNum >= 52 && parseInt(vMonthStr, 10) === 1) + vYear--; + if (vWeekNum == 1 && parseInt(vMonthStr, 10) === 12) + vYear++; + if (vWeekNum < 10) + vWeekNum = parseInt('0' + vWeekNum, 10); + vDateStr += vYear + '-W' + vWeekNum + '-' + vDayOfWeek; + break; + default: + if (pL[pDateFormatArr[i].toLowerCase()]) + vDateStr += pL[pDateFormatArr[i].toLowerCase()]; + else + vDateStr += pDateFormatArr[i]; + break; + } + } + return vDateStr; +}; +exports.parseDateFormatStr = function (pFormatStr) { + var vComponantStr = ''; + var vCurrChar = ''; + var vSeparators = new RegExp('[\/\\ -.,\'":]'); + var vDateFormatArray = new Array(); + for (var i = 0; i < pFormatStr.length; i++) { + vCurrChar = pFormatStr.charAt(i); + if ((vCurrChar.match(vSeparators)) || (i + 1 == pFormatStr.length)) // separator or end of string + { + if ((i + 1 == pFormatStr.length) && (!(vCurrChar.match(vSeparators)))) // at end of string add any non-separator chars to the current component + { + vComponantStr += vCurrChar; + } + vDateFormatArray.push(vComponantStr); + if (vCurrChar.match(vSeparators)) + vDateFormatArray.push(vCurrChar); + vComponantStr = ''; + } + else { + vComponantStr += vCurrChar; + } + } + return vDateFormatArray; +}; +exports.stripIds = function (pNode) { + for (var i = 0; i < pNode.childNodes.length; i++) { + if ('removeAttribute' in pNode.childNodes[i]) + pNode.childNodes[i].removeAttribute('id'); + if (pNode.childNodes[i].hasChildNodes()) + exports.stripIds(pNode.childNodes[i]); + } +}; +exports.stripUnwanted = function (pNode) { + var vAllowedTags = new Array('#text', 'p', 'br', 'ul', 'ol', 'li', 'div', 'span', 'img'); + for (var i = 0; i < pNode.childNodes.length; i++) { + /* versions of IE<9 don't support indexOf on arrays so add trailing comma to the joined array and lookup value to stop substring matches */ + if ((vAllowedTags.join().toLowerCase() + ',').indexOf(pNode.childNodes[i].nodeName.toLowerCase() + ',') == -1) { + pNode.replaceChild(document.createTextNode(pNode.childNodes[i].outerHTML), pNode.childNodes[i]); + } + if (pNode.childNodes[i].hasChildNodes()) + exports.stripUnwanted(pNode.childNodes[i]); + } +}; +exports.delayedHide = function (pGanttChartObj, pTool, pTimer) { + var vDelay = pGanttChartObj.getTooltipDelay() || 1500; + if (pTool) + pTool.delayTimeout = setTimeout(function () { exports.hideToolTip(pGanttChartObj, pTool, pTimer); }, vDelay); +}; +exports.getZoomFactor = function () { + var vFactor = 1; + if (document.body.getBoundingClientRect) { + // rect is only in physical pixel size in IE before version 8 + var vRect = document.body.getBoundingClientRect(); + var vPhysicalW = vRect.right - vRect.left; + var vLogicalW = document.body.offsetWidth; + // the zoom level is always an integer percent value + vFactor = Math.round((vPhysicalW / vLogicalW) * 100) / 100; + } + return vFactor; +}; +exports.benchMark = function (pItem) { + var vEndTime = new Date().getTime(); + alert(pItem + ': Elapsed time: ' + ((vEndTime - this.vBenchTime) / 1000) + ' seconds.'); + this.vBenchTime = new Date().getTime(); +}; +exports.getIsoWeek = function (pDate) { + // We have to compare against the monday of the first week of the year containing 04 jan *not* 01/01 + // 60*60*24*1000=86400000 + var dayMiliseconds = 86400000; + var keyDay = new Date(pDate.getFullYear(), 0, 4, 0, 0, 0); + var keyDayOfWeek = (keyDay.getDay() == 0) ? 6 : keyDay.getDay() - 1; // define monday as 0 + var firstMondayYearTime = keyDay.getTime() - (keyDayOfWeek * dayMiliseconds); + var thisDate = new Date(pDate.getFullYear(), pDate.getMonth(), pDate.getDate(), 0, 0, 0); // This at 00:00:00 + var thisTime = thisDate.getTime(); + var daysFromFirstMonday = Math.round(((thisTime - firstMondayYearTime) / dayMiliseconds)); + var lastWeek = 99; + var thisWeek = 99; + var firstMondayYear = new Date(firstMondayYearTime); + thisWeek = Math.ceil((daysFromFirstMonday + 1) / 7); + if (thisWeek <= 0) + thisWeek = exports.getIsoWeek(new Date(pDate.getFullYear() - 1, 11, 31, 0, 0, 0)); + else if (thisWeek == 53 && (new Date(pDate.getFullYear(), 0, 1, 0, 0, 0)).getDay() != 4 && (new Date(pDate.getFullYear(), 11, 31, 0, 0, 0)).getDay() != 4) + thisWeek = 1; + return thisWeek; +}; +exports.getScrollPositions = function () { + var vScrollLeft = window.pageXOffset; + var vScrollTop = window.pageYOffset; + if (!('pageXOffset' in window)) // Internet Explorer before version 9 + { + var vZoomFactor = exports.getZoomFactor(); + vScrollLeft = Math.round(document.documentElement.scrollLeft / vZoomFactor); + vScrollTop = Math.round(document.documentElement.scrollTop / vZoomFactor); + } + return { x: vScrollLeft, y: vScrollTop }; +}; +var scrollbarWidth = undefined; +exports.getScrollbarWidth = function () { + if (scrollbarWidth) + return scrollbarWidth; + var outer = document.createElement('div'); + outer.className = 'gscrollbar-calculation-container'; + document.body.appendChild(outer); + // Creating inner element and placing it in the container + var inner = document.createElement('div'); + outer.appendChild(inner); + // Calculating difference between container's full width and the child width + scrollbarWidth = (outer.offsetWidth - inner.offsetWidth); + // Removing temporary elements from the DOM + outer.parentNode.removeChild(outer); + return scrollbarWidth; +}; +exports.getOffset = function (pStartDate, pEndDate, pColWidth, pFormat, pShowWeekends) { + var DAY_CELL_MARGIN_WIDTH = 3; // Cell margin for 'day' format + var WEEK_CELL_MARGIN_WIDTH = 3; // Cell margin for 'week' format + var MONTH_CELL_MARGIN_WIDTH = 3; // Cell margin for 'month' format + var QUARTER_CELL_MARGIN_WIDTH = 3; // Cell margin for 'quarter' format + var HOUR_CELL_MARGIN_WIDTH = 3; // Cell margin for 'hour' format + var vMonthDaysArr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); + var curTaskStart = new Date(pStartDate.getTime()); + var curTaskEnd = new Date(pEndDate.getTime()); + var vTaskRightPx = 0; + var tmpTaskStart = Date.UTC(curTaskStart.getFullYear(), curTaskStart.getMonth(), curTaskStart.getDate(), curTaskStart.getHours(), 0, 0); + var tmpTaskEnd = Date.UTC(curTaskEnd.getFullYear(), curTaskEnd.getMonth(), curTaskEnd.getDate(), curTaskEnd.getHours(), 0, 0); + var oneHour = 3600000; + var vTaskRight = (tmpTaskEnd - tmpTaskStart) / oneHour; // Length of task in hours + var vPosTmpDate; + if (pFormat == 'day') { + if (!pShowWeekends) { + var start = curTaskStart; + var end = curTaskEnd; + var countWeekends = 0; + while (start < end) { + var day = start.getDay(); + if (day === 6 || day == 0) { + countWeekends++; + } + start = new Date(start.getTime() + 24 * oneHour); + } + vTaskRight -= countWeekends * 24; + } + vTaskRightPx = Math.ceil((vTaskRight / 24) * (pColWidth + DAY_CELL_MARGIN_WIDTH) - 1); + } + else if (pFormat == 'week') { + vTaskRightPx = Math.ceil((vTaskRight / (24 * 7)) * (pColWidth + WEEK_CELL_MARGIN_WIDTH) - 1); + } + else if (pFormat == 'month') { + var vMonthsDiff = (12 * (curTaskEnd.getFullYear() - curTaskStart.getFullYear())) + (curTaskEnd.getMonth() - curTaskStart.getMonth()); + vPosTmpDate = new Date(curTaskEnd.getTime()); + vPosTmpDate.setDate(curTaskStart.getDate()); + var vDaysCrctn = (curTaskEnd.getTime() - vPosTmpDate.getTime()) / (86400000); + vTaskRightPx = Math.ceil((vMonthsDiff * (pColWidth + MONTH_CELL_MARGIN_WIDTH)) + (vDaysCrctn * (pColWidth / vMonthDaysArr[curTaskEnd.getMonth()])) - 1); + } + else if (pFormat == 'quarter') { + var vMonthsDiff = (12 * (curTaskEnd.getFullYear() - curTaskStart.getFullYear())) + (curTaskEnd.getMonth() - curTaskStart.getMonth()); + vPosTmpDate = new Date(curTaskEnd.getTime()); + vPosTmpDate.setDate(curTaskStart.getDate()); + var vDaysCrctn = (curTaskEnd.getTime() - vPosTmpDate.getTime()) / (86400000); + vTaskRightPx = Math.ceil((vMonthsDiff * ((pColWidth + QUARTER_CELL_MARGIN_WIDTH) / 3)) + (vDaysCrctn * (pColWidth / 90)) - 1); + } + else if (pFormat == 'hour') { + // can't just calculate sum because of daylight savings changes + vPosTmpDate = new Date(curTaskEnd.getTime()); + vPosTmpDate.setMinutes(curTaskStart.getMinutes(), 0); + var vMinsCrctn = (curTaskEnd.getTime() - vPosTmpDate.getTime()) / (3600000); + vTaskRightPx = Math.ceil((vTaskRight * (pColWidth + HOUR_CELL_MARGIN_WIDTH)) + (vMinsCrctn * (pColWidth))); + } + return vTaskRightPx; +}; +exports.isIE = function () { + if (typeof document.all != 'undefined') { + if ('pageXOffset' in window) + return false; // give IE9 and above the benefit of the doubt! + else + return true; + } + else + return false; +}; +exports.hideToolTip = function (pGanttChartObj, pTool, pTimer) { + if (pGanttChartObj.getUseFade()) { + clearInterval(pTool.fadeInterval); + pTool.fadeInterval = setInterval(function () { exports.fadeToolTip(-1, pTool, 0); }, pTimer); + } + else { + pTool.style.opacity = 0; + pTool.style.filter = 'alpha(opacity=0)'; + pTool.style.visibility = 'hidden'; + pTool.vToolCont.setAttribute("showing", null); + } +}; +exports.fadeToolTip = function (pDirection, pTool, pMaxAlpha) { + var vIncrement = parseInt(pTool.getAttribute('fadeIncrement')); + var vAlpha = pTool.getAttribute('currentOpacity'); + var vCurAlpha = parseInt(vAlpha); + if ((vCurAlpha != pMaxAlpha && pDirection == 1) || (vCurAlpha != 0 && pDirection == -1)) { + var i = vIncrement; + if (pMaxAlpha - vCurAlpha < vIncrement && pDirection == 1) { + i = pMaxAlpha - vCurAlpha; + } + else if (vAlpha < vIncrement && pDirection == -1) { + i = vCurAlpha; + } + vAlpha = vCurAlpha + (i * pDirection); + pTool.style.opacity = vAlpha * 0.01; + pTool.style.filter = 'alpha(opacity=' + vAlpha + ')'; + pTool.setAttribute('currentOpacity', vAlpha); + } + else { + clearInterval(pTool.fadeInterval); + if (pDirection == -1) { + pTool.style.opacity = 0; + pTool.style.filter = 'alpha(opacity=0)'; + pTool.style.visibility = 'hidden'; + pTool.vToolCont.setAttribute("showing", null); + } + } +}; +exports.hashString = function (key) { + if (!key) { + key = 'default'; + } + key += ''; + var hash = 5381; + for (var i = 0; i < key.length; i++) { + if (key.charCodeAt) { + // tslint:disable-next-line:no-bitwise + hash = (hash << 5) + hash + key.charCodeAt(i); + } + // tslint:disable-next-line:no-bitwise + hash = hash & hash; + } + // tslint:disable-next-line:no-bitwise + return hash >>> 0; +}; +exports.hashKey = function (key) { + return this.hashString(key); +}; +exports.criticalPath = function (tasks) { + var path = {}; + // calculate duration + tasks.forEach(function (task) { + task.duration = new Date(task.pEnd).getTime() - new Date(task.pStart).getTime(); + }); + tasks.forEach(function (task) { + if (!path[task.pID]) { + path[task.pID] = task; + } + if (!path[task.pParent]) { + path[task.pParent] = { + childrens: [] + }; + } + if (!path[task.pID].childrens) { + path[task.pID].childrens = []; + } + path[task.pParent].childrens.push(task); + var max = path[task.pParent].childrens[0].duration; + path[task.pParent].childrens.forEach(function (t) { + if (t.duration > max) { + max = t.duration; + } + }); + path[task.pParent].duration = max; + }); + var finalNodes = { 0: path[0] }; + var node = path[0]; + var _loop_1 = function () { + if (node.childrens.length > 0) { + var found_1 = node.childrens[0]; + var max_1 = found_1.duration; + node.childrens.forEach(function (c) { + if (c.duration > max_1) { + found_1 = c; + max_1 = c.duration; + } + }); + finalNodes[found_1.pID] = found_1; + node = found_1; + } + else { + node = null; + } + }; + while (node) { + _loop_1(); + } +}; +function isParentElementOrSelf(child, parent) { + while (child) { + if (child === parent) + return true; + child = child.parentElement; + } +} +exports.isParentElementOrSelf = isParentElementOrSelf; +exports.updateFlyingObj = function (e, pGanttChartObj, pTimer) { + var vCurTopBuf = 3; + var vCurLeftBuf = 5; + var vCurBotBuf = 3; + var vCurRightBuf = 15; + var vMouseX = (e) ? e.clientX : window.event.clientX; + var vMouseY = (e) ? e.clientY : window.event.clientY; + var vViewportX = document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; + var vViewportY = document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; + var vNewX = vMouseX; + var vNewY = vMouseY; + if (navigator.appName.toLowerCase() == 'microsoft internet explorer') { + // the clientX and clientY properties include the left and top borders of the client area + vMouseX -= document.documentElement.clientLeft; + vMouseY -= document.documentElement.clientTop; + var vZoomFactor = exports.getZoomFactor(); + if (vZoomFactor != 1) { // IE 7 at non-default zoom level + vMouseX = Math.round(vMouseX / vZoomFactor); + vMouseY = Math.round(vMouseY / vZoomFactor); + } + } + var vScrollPos = exports.getScrollPositions(); + /* Code for positioned right of the mouse by default*/ + /* + if (vMouseX+vCurRightBuf+pGanttChartObj.vTool.offsetWidth>vViewportX) + { + if (vMouseX-vCurLeftBuf-pGanttChartObj.vTool.offsetWidth<0) vNewX=vScrollPos.x; + else vNewX=vMouseX+vScrollPos.x-vCurLeftBuf-pGanttChartObj.vTool.offsetWidth; + } + else vNewX=vMouseX+vScrollPos.x+vCurRightBuf; + */ + /* Code for positioned left of the mouse by default */ + if (vMouseX - vCurLeftBuf - pGanttChartObj.vTool.offsetWidth < 0) { + if (vMouseX + vCurRightBuf + pGanttChartObj.vTool.offsetWidth > vViewportX) + vNewX = vScrollPos.x; + else + vNewX = vMouseX + vScrollPos.x + vCurRightBuf; + } + else + vNewX = vMouseX + vScrollPos.x - vCurLeftBuf - pGanttChartObj.vTool.offsetWidth; + /* Code for positioned below the mouse by default */ + if (vMouseY + vCurBotBuf + pGanttChartObj.vTool.offsetHeight > vViewportY) { + if (vMouseY - vCurTopBuf - pGanttChartObj.vTool.offsetHeight < 0) + vNewY = vScrollPos.y; + else + vNewY = vMouseY + vScrollPos.y - vCurTopBuf - pGanttChartObj.vTool.offsetHeight; + } + else + vNewY = vMouseY + vScrollPos.y + vCurBotBuf; + /* Code for positioned above the mouse by default */ + /* + if (vMouseY-vCurTopBuf-pGanttChartObj.vTool.offsetHeight<0) + { + if (vMouseY+vCurBotBuf+pGanttChartObj.vTool.offsetHeight>vViewportY) vNewY=vScrollPos.y; + else vNewY=vMouseY+vScrollPos.y+vCurBotBuf; + } + else vNewY=vMouseY+vScrollPos.y-vCurTopBuf-pGanttChartObj.vTool.offsetHeight; + */ + if (pGanttChartObj.getUseMove()) { + clearInterval(pGanttChartObj.vTool.moveInterval); + pGanttChartObj.vTool.moveInterval = setInterval(function () { exports.moveToolTip(vNewX, vNewY, pGanttChartObj.vTool, pTimer); }, pTimer); + } + else { + pGanttChartObj.vTool.style.left = vNewX + 'px'; + pGanttChartObj.vTool.style.top = vNewY + 'px'; + } +}; +exports.moveToolTip = function (pNewX, pNewY, pTool, timer) { + var vSpeed = parseInt(pTool.getAttribute('moveSpeed')); + var vOldX = parseInt(pTool.style.left); + var vOldY = parseInt(pTool.style.top); + if (pTool.style.visibility != 'visible') { + pTool.style.left = pNewX + 'px'; + pTool.style.top = pNewY + 'px'; + clearInterval(pTool.moveInterval); + } + else { + if (pNewX != vOldX && pNewY != vOldY) { + vOldX += Math.ceil((pNewX - vOldX) / vSpeed); + vOldY += Math.ceil((pNewY - vOldY) / vSpeed); + pTool.style.left = vOldX + 'px'; + pTool.style.top = vOldY + 'px'; + } + else { + clearInterval(pTool.moveInterval); + } + } +}; +exports.makeRequest = function (pFile, json, vDebug) { + if (json === void 0) { json = true; } + if (vDebug === void 0) { vDebug = false; } + if (window.fetch) { + var f = fetch(pFile); + if (json) { + return f.then(function (res) { return res.json(); }); + } + else { + return f; + } + } + else { + return exports.makeRequestOldBrowsers(pFile, vDebug) + .then(function (xhttp) { + if (json) { + var jsonObj = JSON.parse(xhttp.response); + return jsonObj; + } + else { + var xmlDoc = xhttp.responseXML; + return xmlDoc; + } + }); + } +}; +exports.makeRequestOldBrowsers = function (pFile, vDebug) { + if (vDebug === void 0) { vDebug = false; } + return new Promise(function (resolve, reject) { + var bd; + if (vDebug) { + bd = new Date(); + console.log('before jsonparse', bd); + } + var xhttp; + if (window.XMLHttpRequest) { + xhttp = new XMLHttpRequest(); + } + else { // IE 5/6 + xhttp = new window.ActiveXObject('Microsoft.XMLHTTP'); + } + xhttp.open('GET', pFile, true); + xhttp.send(null); + xhttp.onload = function (e) { + if (xhttp.readyState === 4) { + if (xhttp.status === 200) { + // resolve(xhttp.responseText); + } + else { + console.error(xhttp.statusText); + } + if (vDebug) { + bd = new Date(); + console.log('before jsonparse', bd); + } + resolve(xhttp); + } + }; + xhttp.onerror = function (e) { + reject(xhttp.statusText); + }; + }); +}; +exports.calculateStartEndFromDepend = function (tasksList) { +}; + +},{}],14:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var task_1 = require("./task"); +var date_utils_1 = require("./utils/date_utils"); +var draw_utils_1 = require("./utils/draw_utils"); +var general_utils_1 = require("./utils/general_utils"); +exports.parseXML = function (pFile, pGanttVar) { + return general_utils_1.makeRequest(pFile, false, false) + .then(function (xmlDoc) { + exports.AddXMLTask(pGanttVar, xmlDoc); + }); +}; +exports.parseXMLString = function (pStr, pGanttVar) { + var xmlDoc; + if (typeof window.DOMParser != 'undefined') { + xmlDoc = (new window.DOMParser()).parseFromString(pStr, 'text/xml'); + } + else if (typeof window.ActiveXObject != 'undefined' && + new window.ActiveXObject('Microsoft.XMLDOM')) { + xmlDoc = new window.ActiveXObject('Microsoft.XMLDOM'); + xmlDoc.async = 'false'; + xmlDoc.loadXML(pStr); + } + exports.AddXMLTask(pGanttVar, xmlDoc); +}; +exports.findXMLNode = function (pRoot, pNodeName) { + var vRetValue; + try { + vRetValue = pRoot.getElementsByTagName(pNodeName); + } + catch (error) { + ; + } // do nothing, we'll return undefined + return vRetValue; +}; +// pType can be 1=numeric, 2=String, all other values just return raw data +exports.getXMLNodeValue = function (pRoot, pNodeName, pType, pDefault) { + var vRetValue; + try { + vRetValue = pRoot.getElementsByTagName(pNodeName)[0].childNodes[0].nodeValue; + } + catch (error) { + if (typeof pDefault != 'undefined') + vRetValue = pDefault; + } + if (typeof vRetValue != 'undefined' && vRetValue != null) { + if (pType == 1) + vRetValue *= 1; + else if (pType == 2) + vRetValue = vRetValue.toString(); + } + return vRetValue; +}; +exports.AddXMLTask = function (pGanttVar, pXmlDoc) { + var project = ''; + var Task; + var n = 0; + var m = 0; + var i = 0; + var j = 0; + var k = 0; + var maxPID = 0; + var ass = new Array(); + var assRes = new Array(); + var res = new Array(); + var pars = new Array(); + var projNode = exports.findXMLNode(pXmlDoc, 'Project'); + if (typeof projNode != 'undefined' && projNode.length > 0) { + project = projNode[0].getAttribute('xmlns'); + } + if (project == 'http://schemas.microsoft.com/project') { + pGanttVar.setDateInputFormat('yyyy-mm-dd'); + Task = exports.findXMLNode(pXmlDoc, 'Task'); + if (typeof Task == 'undefined') + n = 0; + else + n = Task.length; + var resources = exports.findXMLNode(pXmlDoc, 'Resource'); + if (typeof resources == 'undefined') { + n = 0; + m = 0; + } + else + m = resources.length; + for (i = 0; i < m; i++) { + var resname = exports.getXMLNodeValue(resources[i], 'Name', 2, ''); + var uid = exports.getXMLNodeValue(resources[i], 'UID', 1, -1); + if (resname.length > 0 && uid > 0) + res[uid] = resname; + } + var assignments = exports.findXMLNode(pXmlDoc, 'Assignment'); + if (typeof assignments == 'undefined') + j = 0; + else + j = assignments.length; + for (i = 0; i < j; i++) { + var uid = void 0; + var resUID = exports.getXMLNodeValue(assignments[i], 'ResourceUID', 1, -1); + uid = exports.getXMLNodeValue(assignments[i], 'TaskUID', 1, -1); + if (uid > 0) { + if (resUID > 0) + assRes[uid] = res[resUID]; + ass[uid] = assignments[i]; + } + } + // Store information about parent UIDs in an easily searchable form + for (i = 0; i < n; i++) { + var uid = void 0; + uid = exports.getXMLNodeValue(Task[i], 'UID', 1, 0); + var vOutlineNumber = void 0; + if (uid != 0) + vOutlineNumber = exports.getXMLNodeValue(Task[i], 'OutlineNumber', 2, '0'); + if (uid > 0) + pars[vOutlineNumber] = uid; + if (uid > maxPID) + maxPID = uid; + } + for (i = 0; i < n; i++) { + // optional parameters may not have an entry + // Task ID must NOT be zero otherwise it will be skipped + var pID = exports.getXMLNodeValue(Task[i], 'UID', 1, 0); + if (pID != 0) { + var pName = exports.getXMLNodeValue(Task[i], 'Name', 2, 'No Task Name'); + var pStart = exports.getXMLNodeValue(Task[i], 'Start', 2, ''); + var pEnd = exports.getXMLNodeValue(Task[i], 'Finish', 2, ''); + var pPlanStart = exports.getXMLNodeValue(Task[i], 'PlanStart', 2, ''); + var pPlanEnd = exports.getXMLNodeValue(Task[i], 'PlanFinish', 2, ''); + var pDuration = exports.getXMLNodeValue(Task[i], 'Duration', 2, ''); + var pLink = exports.getXMLNodeValue(Task[i], 'HyperlinkAddress', 2, ''); + var pMile = exports.getXMLNodeValue(Task[i], 'Milestone', 1, 0); + var pComp = exports.getXMLNodeValue(Task[i], 'PercentWorkComplete', 1, 0); + var pCost = exports.getXMLNodeValue(Task[i], 'Cost', 2, 0); + var pGroup = exports.getXMLNodeValue(Task[i], 'Summary', 1, 0); + var pParent = 0; + var vOutlineLevel = exports.getXMLNodeValue(Task[i], 'OutlineLevel', 1, 0); + var vOutlineNumber = void 0; + if (vOutlineLevel > 1) { + vOutlineNumber = exports.getXMLNodeValue(Task[i], 'OutlineNumber', 2, '0'); + pParent = pars[vOutlineNumber.substr(0, vOutlineNumber.lastIndexOf('.'))]; + } + var pNotes = void 0; + try { + pNotes = Task[i].getElementsByTagName('Notes')[0].childNodes[1].nodeValue; //this should be a CDATA node + } + catch (error) { + pNotes = ''; + } + var pRes = void 0; + if (typeof assRes[pID] != 'undefined') + pRes = assRes[pID]; + else + pRes = ''; + var predecessors = exports.findXMLNode(Task[i], 'PredecessorLink'); + if (typeof predecessors == 'undefined') + j = 0; + else + j = predecessors.length; + var pDepend = ''; + for (k = 0; k < j; k++) { + var depUID = exports.getXMLNodeValue(predecessors[k], 'PredecessorUID', 1, -1); + var depType = exports.getXMLNodeValue(predecessors[k], 'Type', 1, 1); + if (depUID > 0) { + if (pDepend.length > 0) + pDepend += ','; + switch (depType) { + case 0: + pDepend += depUID + 'FF'; + break; + case 1: + pDepend += depUID + 'FS'; + break; + case 2: + pDepend += depUID + 'SF'; + break; + case 3: + pDepend += depUID + 'SS'; + break; + default: + pDepend += depUID + 'FS'; + break; + } + } + } + var pOpen = 1; + var pCaption = ''; + var pClass = void 0; + if (pGroup > 0) + pClass = 'ggroupblack'; + else if (pMile > 0) + pClass = 'gmilestone'; + else + pClass = 'gtaskblue'; + // check for split tasks + var splits = exports.findXMLNode(ass[pID], 'TimephasedData'); + if (typeof splits == 'undefined') + j = 0; + else + j = splits.length; + var vSplitStart = pStart; + var vSplitEnd = pEnd; + var vSubCreated = false; + var vDepend = pDepend.replace(/,*[0-9]+[FS]F/g, ''); + for (k = 0; k < j; k++) { + var vDuration = exports.getXMLNodeValue(splits[k], 'Value', 2, '0'); + //remove all text + vDuration = '0' + vDuration.replace(/\D/g, ''); + vDuration *= 1; + if ((vDuration == 0 && !vSubCreated) || (k + 1 == j && pGroup == 2)) { + // No time booked in the given period (or last entry) + // Make sure the parent task is set as a combined group + pGroup = 2; + // Handle last loop + if (k + 1 == j) + vDepend = pDepend.replace(/,*[0-9]+[FS]S/g, ''); + // Now create a subtask + maxPID++; + vSplitEnd = exports.getXMLNodeValue(splits[k], (k + 1 == j) ? 'Finish' : 'Start', 2, ''); + pGanttVar.AddTaskItem(new task_1.TaskItem(maxPID, pName, vSplitStart, vSplitEnd, 'gtaskblue', pLink, pMile, pRes, pComp, 0, pID, pOpen, vDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration)); + vSubCreated = true; + vDepend = ''; + } + else if (vDuration != 0 && vSubCreated) { + vSplitStart = exports.getXMLNodeValue(splits[k], 'Start', 2, ''); + vSubCreated = false; + } + } + if (vSubCreated) + pDepend = ''; + // Finally add the task + pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration)); + } + } + } + else { + Task = pXmlDoc.getElementsByTagName('task'); + n = Task.length; + for (i = 0; i < n; i++) { + // optional parameters may not have an entry + // Task ID must NOT be zero otherwise it will be skipped + var pID = exports.getXMLNodeValue(Task[i], 'pID', 1, 0); + if (pID != 0) { + var pName = exports.getXMLNodeValue(Task[i], 'pName', 2, 'No Task Name'); + var pStart = exports.getXMLNodeValue(Task[i], 'pStart', 2, ''); + var pEnd = exports.getXMLNodeValue(Task[i], 'pEnd', 2, ''); + var pPlanStart = exports.getXMLNodeValue(Task[i], 'pPlanStart', 2, ''); + var pPlanEnd = exports.getXMLNodeValue(Task[i], 'pPlanEnd', 2, ''); + var pDuration = exports.getXMLNodeValue(Task[i], 'pDuration', 2, ''); + var pLink = exports.getXMLNodeValue(Task[i], 'pLink', 2, ''); + var pMile = exports.getXMLNodeValue(Task[i], 'pMile', 1, 0); + var pComp = exports.getXMLNodeValue(Task[i], 'pComp', 1, 0); + var pCost = exports.getXMLNodeValue(Task[i], 'pCost', 2, 0); + var pGroup = exports.getXMLNodeValue(Task[i], 'pGroup', 1, 0); + var pParent = exports.getXMLNodeValue(Task[i], 'pParent', 1, 0); + var pRes = exports.getXMLNodeValue(Task[i], 'pRes', 2, ''); + var pOpen = exports.getXMLNodeValue(Task[i], 'pOpen', 1, 1); + var pDepend = exports.getXMLNodeValue(Task[i], 'pDepend', 2, ''); + var pCaption = exports.getXMLNodeValue(Task[i], 'pCaption', 2, ''); + var pNotes = exports.getXMLNodeValue(Task[i], 'pNotes', 2, ''); + var pClass = exports.getXMLNodeValue(Task[i], 'pClass', 2, ''); + if (typeof pClass == 'undefined') { + if (pGroup > 0) + pClass = 'ggroupblack'; + else if (pMile > 0) + pClass = 'gmilestone'; + else + pClass = 'gtaskblue'; + } + // Finally add the task + pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration)); + } + } + } +}; +exports.getXMLProject = function () { + var vProject = ''; + for (var i = 0; i < this.vTaskList.length; i++) { + vProject += this.getXMLTask(i, true); + } + vProject += ''; + return vProject; +}; +exports.getXMLTask = function (pID, pIdx) { + var i = 0; + var vIdx = -1; + var vTask = ''; + var vOutFrmt = date_utils_1.parseDateFormatStr(this.getDateInputFormat() + ' HH:MI'); + if (pIdx === true) + vIdx = pID; + else { + for (i = 0; i < this.vTaskList.length; i++) { + if (this.vTaskList[i].getID() == pID) { + vIdx = i; + break; + } + } + } + if (vIdx >= 0 && vIdx < this.vTaskList.length) { + /* Simplest way to return case sensitive node names is to just build a string */ + vTask = ''; + vTask += '' + this.vTaskList[vIdx].getID() + ''; + vTask += '' + this.vTaskList[vIdx].getName() + ''; + vTask += '' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getStart(), vOutFrmt, this.vLangs[this.vLang]) + ''; + vTask += '' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getEnd(), vOutFrmt, this.vLangs[this.vLang]) + ''; + vTask += '' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getPlanStart(), vOutFrmt, this.vLangs[this.vLang]) + ''; + vTask += '' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getPlanEnd(), vOutFrmt, this.vLangs[this.vLang]) + ''; + vTask += '' + this.vTaskList[vIdx].getDuration() + ''; + vTask += '' + this.vTaskList[vIdx].getClass() + ''; + vTask += '' + this.vTaskList[vIdx].getLink() + ''; + vTask += '' + this.vTaskList[vIdx].getMile() + ''; + if (this.vTaskList[vIdx].getResource() != '\u00A0') + vTask += '' + this.vTaskList[vIdx].getResource() + ''; + vTask += '' + this.vTaskList[vIdx].getCompVal() + ''; + vTask += '' + this.vTaskList[vIdx].getCost() + ''; + vTask += '' + this.vTaskList[vIdx].getGroup() + ''; + vTask += '' + this.vTaskList[vIdx].getParent() + ''; + vTask += '' + this.vTaskList[vIdx].getOpen() + ''; + vTask += ''; + var vDepList = this.vTaskList[vIdx].getDepend(); + for (i = 0; i < vDepList.length; i++) { + if (i > 0) + vTask += ','; + if (vDepList[i] > 0) + vTask += vDepList[i] + this.vTaskList[vIdx].getDepType()[i]; + } + vTask += ''; + vTask += '' + this.vTaskList[vIdx].getCaption() + ''; + var vTmpFrag = document.createDocumentFragment(); + var vTmpDiv = draw_utils_1.newNode(vTmpFrag, 'div', null, null, this.vTaskList[vIdx].getNotes().innerHTML); + vTask += '' + vTmpDiv.innerHTML + ''; + vTask += ''; + } + return vTask; +}; + +},{"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13}]},{},[1])(1) +}); diff --git a/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.css b/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.css new file mode 100644 index 000000000..289fae403 --- /dev/null +++ b/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.css @@ -0,0 +1 @@ +.gridHoverStyle,.gridSelection,.timelineSelection{background-color:#fff3a1}.gantt_grid_scale .gantt_grid_head_cell{color:#a6a6a6;border-top:none!important;border-right:none!important}.gantt_grid_data .gantt_cell{border-right:none;color:#454545}.gantt_task_link .gantt_link_arrow_right{border-width:6px;margin-top:-3px}.gantt_task_link .gantt_link_arrow_left{border-width:6px;margin-left:-6px;margin-top:-3px}.gantt_task_link .gantt_link_arrow_down,.gantt_task_link .gantt_link_arrow_up{border-width:6px}.gantt_task_line .gantt_task_progress_drag{bottom:-4px;height:10px;margin-left:-8px;width:16px}.chartHeaderBg{background-color:#fff}.gantt_task .gantt_task_scale .gantt_scale_cell{color:#a6a6a6;border-right:1px solid #ebebeb}.gantt_row.gantt_project,.gantt_row.odd.gantt_project{background-color:#edffef}.gantt_task_row.gantt_project,.gantt_task_row.odd.gantt_project{background-color:#f5fff6}.gantt_task_line.gantt_project{background-color:#65c16f;border:1px solid #3c9445}.gantt_task_line.gantt_project .gantt_task_progress{background-color:#46ad51}.buttonBg{background:#fff}.gantt_cal_light .gantt_btn_set{margin:5px 10px}.gantt_btn_set.gantt_cancel_btn_set{background:#fff;color:#454545;border:1px solid #cecece}.gantt_btn_set.gantt_save_btn_set{background:#3db9d3;text-shadow:0 -1px 0 #248a9f;color:#fff}.gantt_btn_set.gantt_delete_btn_set{text-shadow:0 -1px 0 #6f6f6f;background:#ec8e00;text-shadow:0 -1px 0 #a60;color:#fff}.gantt_cal_light_wide{padding-left:0!important;padding-right:0!important}.gantt_cal_light_wide .gantt_cal_larea{border-left:none!important;border-right:none!important}.gantt_popup_button.gantt_ok_button{background:#3db9d3;text-shadow:0 -1px 0 #248a9f;color:#fff;font-weight:700;border-width:0}.gantt_popup_button.gantt_cancel_button{font-weight:700;color:#454544}.gantt_popup_title{background-color:#fff}.gantt_popup_shadow{box-shadow:3px 3px 3px rgba(0,0,0,.07)}.gantt_qi_big_icon.icon_edit{color:#454545;background:#fff}.gantt_qi_big_icon.icon_delete{text-shadow:0 -1px 0 #a60;background:#ec8e00;color:#fff;border-width:0}.gantt_tooltip{box-shadow:3px 3px 3px rgba(0,0,0,.07);border-left:1px solid rgba(0,0,0,.07);border-top:1px solid rgba(0,0,0,.07);font-size:8pt;color:#454545}.gantt_container,.gantt_tooltip{background-color:#fff;font-family:Arial}.gantt_container{font-size:13px;border:1px solid #cecece;position:relative;white-space:nowrap;overflow-x:hidden;overflow-y:hidden}.gantt_task_scroll{overflow-x:scroll}.gantt_grid,.gantt_task{position:relative;overflow-x:hidden;overflow-y:hidden;display:inline-block;vertical-align:top}.gantt_grid_scale,.gantt_task_scale{color:#6b6b6b;font-size:12px;border-bottom:1px solid #cecece;box-sizing:border-box}.gantt_grid_scale,.gantt_task_scale,.gantt_task_vscroll{background-color:#fff}.gantt_scale_line{box-sizing:border-box;-moz-box-sizing:border-box;border-top:1px solid #cecece}.gantt_scale_line:first-child{border-top:none}.gantt_grid_head_cell{display:inline-block;vertical-align:top;border-right:1px solid #cecece;text-align:center;position:relative;cursor:default;height:100%;box-sizing:border-box;-moz-box-sizing:border-box;line-height:33px;-moz-user-select:-moz-none;-webkit-user-select:none;user-select:none;overflow:hidden}.gantt_scale_line{clear:both}.gantt_grid_data{width:100%;overflow:hidden;position:relative}.gantt_row{position:relative;-webkit-user-select:none;-moz-user-select:none;-moz-user-select:-moz-none}.gantt_add,.gantt_grid_head_add{width:100%;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NTQ3MjMyMENDNkI0MTFFMjk4MTI5QTg3MDhFNDVDQTkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NTQ3MjMyMERDNkI0MTFFMjk4MTI5QTg3MDhFNDVDQTkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo1NDcyMzIwQUM2QjQxMUUyOTgxMjlBODcwOEU0NUNBOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo1NDcyMzIwQkM2QjQxMUUyOTgxMjlBODcwOEU0NUNBOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PshZT8UAAABbSURBVHjaYrTdeZmBEsCER+4wEP+H4sPkGGCDg020ARR7gb4GIAcYDKMDdPnDyAbYkGG5DVW9cIQMvUdBBAuUY4vDz8iAcZinA2zgCHqAYQMseAywJcYFAAEGAM+UFGuohFczAAAAAElFTkSuQmCC);background-position:50%;background-repeat:no-repeat;cursor:pointer;position:relative;-moz-opacity:.3;opacity:.3}.gantt_grid_head_cell.gantt_grid_head_add{-moz-opacity:.6;opacity:.6;top:0}.gantt_grid_head_cell.gantt_grid_head_add:hover{-moz-opacity:1;opacity:1}.gantt_grid_data .gantt_row.odd:hover,.gantt_grid_data .gantt_row:hover{background-color:#fff3a1}.gantt_grid_data .gantt_row.odd:hover .gantt_add,.gantt_grid_data .gantt_row:hover .gantt_add{-moz-opacity:1;opacity:1}.gantt_row,.gantt_task_row{border-bottom:1px solid #ebebeb;background-color:#fff}.gantt_row.odd,.gantt_task_row.odd{background-color:#fff}.gantt_cell,.gantt_grid_head_cell,.gantt_row,.gantt_scale_cell,.gantt_task_cell,.gantt_task_row{box-sizing:border-box;-moz-box-sizing:border-box}.gantt_grid_head_cell,.gantt_scale_cell{line-height:inherit}.gantt_grid_scale .gantt_grid_column_resize_wrap{cursor:col-resize;position:absolute;width:13px;margin-left:-7px}.gantt_grid_column_resize_wrap .gantt_grid_column_resize{background-color:#cecece;height:100%;width:1px;margin:0 auto}.gantt_drag_marker.gantt_grid_resize_area{background-color:hsla(0,0%,91%,.5);border-left:1px solid #cecece;border-right:1px solid #cecece;height:100%;width:100%;box-sizing:border-box}.gantt_row{display:flex}.gantt_row>div{flex-shrink:0;flex-grow:0}.gantt_cell{vertical-align:top;border-right:1px solid #ebebeb;padding-left:6px;padding-right:6px;height:100%;overflow:hidden;white-space:nowrap;font-size:13px}.gantt_cell_tree{display:flex;flex-wrap:nowrap}.gantt_grid_data .gantt_last_cell,.gantt_grid_scale .gantt_last_cell,.gantt_task .gantt_task_scale .gantt_scale_cell.gantt_last_cell,.gantt_task_bg .gantt_last_cell{border-right-width:0}.gantt_task .gantt_task_scale .gantt_scale_cell.gantt_last_cell{border-right-width:1px}.gantt_task_bg{overflow:hidden}.gantt_scale_cell{display:inline-block;white-space:nowrap;overflow:hidden;border-right:1px solid #cecece;text-align:center;height:100%}.gantt_task_cell{display:inline-block;height:100%;border-right:1px solid #ebebeb}.gantt_layout_cell.gantt_ver_scroll{width:0;background-color:transparent;height:1px;overflow-x:hidden;overflow-y:scroll;position:absolute;right:0;z-index:1}.gantt_ver_scroll>div{width:1px;height:1px}.gantt_hor_scroll{height:0;background-color:transparent;width:100%;clear:both;overflow-x:scroll;overflow-y:hidden}.gantt_layout_cell .gantt_hor_scroll{position:absolute}.gantt_hor_scroll>div{width:5000px;height:1px}.gantt_tree_icon,.gantt_tree_indent{flex-grow:0;flex-shrink:0}.gantt_tree_indent{width:15px;height:100%}.gantt_tree_content,.gantt_tree_icon{vertical-align:top}.gantt_tree_icon{width:28px;height:100%;background-repeat:no-repeat;background-position:50%}.gantt_tree_content{height:100%;white-space:nowrap;min-width:0}.gantt_tree_icon.gantt_open{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAArklEQVQ4T2NkoBJgpJI5DEPAoFOnTv0/c+YMQR+bmJgwmJmZwX2E4bVp06b9j4yMZODg4MBp2I8fPxiWL1/OkJWVNUAGcXJyMnz//h3uQrJdRLFBIAPQAchlJLsIFuCMjIwM////B5sJMoRkg2CuIdtrQcHBDOxsbHBfCQgIMHz48AHO//nrF8O6tWsJR7+7uzsDIxMTznT0/98/hp07d+I3iGopm2DewKFg8OV+AJWkfRMrTobLAAAAAElFTkSuQmCC);width:18px;cursor:pointer}.gantt_tree_icon.gantt_close{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAkUlEQVQ4T2NkoBJgpJI5DEPAoFOnTv0/c+YMQR+bmJgwmJmZwX2E4bVp06b9j4yMZODg4MBp2I8fPxiWL1/OkJWVNeIN4uTkxAin79+/M5AcRtgCHGQIyQbhijaiDQoKDmZgZ2PDGf0/f/1iWLd2LeHod3d3Z2BkYsJp0P9//xh27tyJ3yCqpWyCeQOHgsGX+wEZpW4T5LCxKwAAAABJRU5ErkJggg==);width:18px;cursor:pointer}.gantt_tree_icon.gantt_blank{width:18px}.gantt_tree_icon.gantt_folder_open{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAs0lEQVQ4T62T0Q2EIBBEpQlzuaaMsQoqooqLsSljbMLLmMxmUXBR4U+Qt7Mzi2sqLVeJ00SgEMKWAnvvzYLyAyHfT5sU2fXDJSwCAXK8MI0/UTkva7IIFJsg3NSwnKdFoKtAWOQ1CN7CEqeTotE5L7QyJhmBcklZM4ZgTiAr3iOU3kD93ppO5SkMjB1EeXdBWoSkRql3YeIRe+cGvktS056JR9wsmeBUkujCfNXWCPC8GugPqn5ii/hV+FoAAAAASUVORK5CYII=)}.gantt_tree_icon.gantt_folder_closed{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAfElEQVQ4T2NkoBJgpJI5DCgGTZ8+/T82gzMzMwlaCFcAM0RKQgyrI/0Dg/EahmIQyBB0DRvXr4W78tmLV1gtAbmYoEEgnciG4QpTogzCFyEwSyg2CBS2oCAZNQh3cA+hMAJ5AlcKxuVBlOgnNgVjMwyUrQjmamKLGaoZBAAOTFyLnFFW4wAAAABJRU5ErkJggg==)}.gantt_tree_icon.gantt_file{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAeElEQVQ4T2NkoBJgRDZn+vTp/wmZm5mZiaIHph7DICkJMUJmMfgHBmMYhtUgbAo3rl+L4lp0NUQbBPI2umuRDaPIIFAYwAyjv0HoMQALM5JdhG4QLMxGDcKdyIdoGIE89OzFK4KZF5Rl8EY/QROQFGA1iBQD0NUCAJVjcxO0naAQAAAAAElFTkSuQmCC)}.gantt_grid_head_cell .gantt_sort{position:absolute;right:5px;top:8px;width:7px;height:13px;background-repeat:no-repeat;background-position:50%}.gantt_grid_head_cell .gantt_sort.gantt_asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAANCAYAAABlyXS1AAAARUlEQVR4nGNgQAKGxib/GbABkIS7b8B/DAUwCRiGK0CXwFBAb1DfP/U/LszwHwi2X7qFgUEArBtdAVwCBmAKMCSQFSDzAWXXaOHsXeqkAAAAAElFTkSuQmCC)}.gantt_grid_head_cell .gantt_sort.gantt_desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAANCAYAAABlyXS1AAAARUlEQVR42mNgQAL1/VP/M2ADIIntF2/9x1AAlrh0C47hCmA60DFYwX88gIFGwNDY5D8uDFbg7hvwHx2jmIBTAlkB0e4BAEjlaNtBWJPnAAAAAElFTkSuQmCC)}.gantt_inserted,.gantt_updated{font-weight:700}.gantt_deleted{text-decoration:line-through}.gantt_invalid{background-color:#ffe0e0}.gantt_error{color:red}.gantt_status{right:1px;padding:5px 10px;background:hsla(0,0%,61%,.1);position:absolute;top:1px;transition:opacity .2s;opacity:0}.gantt_status.gantt_status_visible{opacity:1}#gantt_ajax_dots span{transition:opacity .2s;background-repeat:no-repeat;opacity:0}#gantt_ajax_dots span.gantt_dot_visible{opacity:1}.gantt_column_drag_marker{border:1px solid #cecece;opacity:.8}.gantt_grid_head_cell_dragged{border:1px solid #cecece;opacity:.3}.gantt_grid_target_marker{position:absolute;top:0;width:2px;height:100%;background-color:#ffa011;transform:translateX(-1px)}.gantt_grid_target_marker:after,.gantt_grid_target_marker:before{display:block;content:"";position:absolute;left:-5px;width:0;height:0;border:6px solid transparent}.gantt_grid_target_marker:before{border-top-color:#ffa011}.gantt_grid_target_marker:after{bottom:0;border-bottom-color:#ffa011}.gantt_message_area{position:fixed;right:5px;width:250px;z-index:1000}.gantt-info{min-width:120px;padding:4px 4px 4px 20px;font-family:Arial;z-index:10000;margin:5px;margin-bottom:10px;transition:all .5s ease}.gantt-info.hidden{height:0;padding:0;border-width:0;margin:0;overflow:hidden}.gantt_modal_box{overflow:hidden;display:inline-block;min-width:250px;width:250px;text-align:center;position:fixed;z-index:20000;box-shadow:3px 3px 3px rgba(0,0,0,.07);font-family:Arial;border-radius:6px;border:1px solid #cecece;background:#fff}.gantt_popup_title{border-top-left-radius:6px;border-top-right-radius:6px;border-width:0}.gantt_button,.gantt_popup_button{border:1px solid #cecece;height:30px;line-height:30px;display:inline-block;margin:0 5px;border-radius:4px;background:#fff}.gantt-info,.gantt_button,.gantt_popup_button{user-select:none;-webkit-user-select:none;-moz-user-select:-moz-none;cursor:pointer}.gantt_popup_text{overflow:hidden}.gantt_popup_controls{border-radius:6px;padding:10px}.gantt_popup_button{min-width:100px}div.dhx_modal_cover{background-color:#000;cursor:default;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20);opacity:.2;position:fixed;z-index:19999;left:0;top:0;width:100%;height:100%;border:none;zoom:1}.gantt-info img,.gantt_modal_box img{float:left;margin-right:20px}.gantt-alert-error,.gantt-confirm-error{border:1px solid red}.gantt_button input,.gantt_popup_button div{border-radius:4px;font-size:14px;box-sizing:content-box;padding:0;margin:0;vertical-align:top}.gantt_popup_title{border-bottom:1px solid #cecece;height:40px;line-height:40px;font-size:20px}.gantt_popup_text{margin:15px 15px 5px;font-size:14px;color:#000;min-height:30px;border-radius:6px}.gantt-error,.gantt-info{font-size:14px;color:#000;box-shadow:3px 3px 3px rgba(0,0,0,.07);padding:0;background-color:#fff;border-radius:3px;border:1px solid #fff}.gantt-info div{padding:5px 10px;background-color:#fff;border-radius:3px;border:1px solid #cecece}.gantt-error{background-color:#d81b1b;border:1px solid #ff3c3c}.gantt-error div{background-color:#d81b1b;border:1px solid #940000;color:#fff}.gantt-warning{background-color:#ff9000;border:1px solid #ffa633}.gantt-warning div{background-color:#ff9000;border:1px solid #b36500;color:#fff}.gantt_data_area div,.gantt_grid div{-ms-touch-action:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.gantt_data_area{position:relative;overflow-x:hidden;overflow-y:hidden;-moz-user-select:-moz-none;-webkit-user-select:none;user-select:none}.gantt_links_area{position:absolute;left:0;top:0}.gantt_side_content,.gantt_task_content,.gantt_task_progress{line-height:inherit;overflow:hidden;height:100%}.gantt_task_content{font-size:12px;color:#fff;width:100%;top:0;cursor:pointer;position:absolute;white-space:nowrap;text-align:center}.gantt_task_progress{text-align:center;z-index:0;background:#299cb4}.gantt_task_progress_wrapper{border-radius:inherit;position:relative;width:100%;height:100%;overflow:hidden}.gantt_task_line{border-radius:2px;position:absolute;box-sizing:border-box;background-color:#3db9d3;border:1px solid #2898b0;-webkit-user-select:none;-moz-user-select:none;-moz-user-select:-moz-none}.gantt_task_line.gantt_drag_move div{cursor:move}.gantt_touch_move,.gantt_touch_progress .gantt_touch_resize{transform:scale(1.02,1.1);transform-origin:50%}.gantt_touch_progress .gantt_task_progress_drag,.gantt_touch_resize .gantt_task_drag{transform:scaleY(1.3);transform-origin:50%}.gantt_side_content{position:absolute;white-space:nowrap;color:#6e6e6e;top:0;font-size:11px}.gantt_side_content.gantt_left{right:100%;padding-right:20px}.gantt_side_content.gantt_right{left:100%;padding-left:20px}.gantt_side_content.gantt_link_crossing{bottom:8.75px;top:auto}.gantt_link_arrow,.gantt_task_link .gantt_line_wrapper{position:absolute;cursor:pointer}.gantt_line_wrapper div{background-color:#ffa011}.gantt_task_link:hover .gantt_line_wrapper div{box-shadow:0 0 5px 0 #ffa011}.gantt_task_link div.gantt_link_arrow{background-color:transparent;border-style:solid;width:0;height:0}.gantt_link_control{position:absolute;width:20px;top:0}.gantt_link_control div{display:none;cursor:pointer;box-sizing:border-box;position:relative;top:50%;margin-top:-7.5px;vertical-align:middle;border:1px solid #929292;border-radius:6.5px;height:13px;width:13px;background-color:#f0f0f0}.gantt_link_control.task_right div.gantt_link_point{margin-left:7px}.gantt_link_control div:hover{background-color:#fff}.gantt_link_control.task_left{left:-20px}.gantt_link_control.task_right{right:-20px}.gantt_link_target .gantt_link_control div,.gantt_task_line.gantt_drag_move .gantt_link_control div,.gantt_task_line.gantt_drag_move .gantt_task_drag,.gantt_task_line.gantt_drag_move .gantt_task_progress_drag,.gantt_task_line.gantt_drag_progress .gantt_link_control div,.gantt_task_line.gantt_drag_progress .gantt_task_drag,.gantt_task_line.gantt_drag_progress .gantt_task_progress_drag,.gantt_task_line.gantt_drag_resize .gantt_link_control div,.gantt_task_line.gantt_drag_resize .gantt_task_drag,.gantt_task_line.gantt_drag_resize .gantt_task_progress_drag,.gantt_task_line.gantt_selected .gantt_link_control div,.gantt_task_line.gantt_selected .gantt_task_drag,.gantt_task_line.gantt_selected .gantt_task_progress_drag,.gantt_task_line:hover .gantt_link_control div,.gantt_task_line:hover .gantt_task_drag,.gantt_task_line:hover .gantt_task_progress_drag{display:block}.gantt_link_source,.gantt_link_target{box-shadow:0 0 3px #3db9d3}.gantt_link_target.link_finish_allow,.gantt_link_target.link_start_allow{box-shadow:0 0 3px #ffbf5e}.gantt_link_target.link_finish_deny,.gantt_link_target.link_start_deny{box-shadow:0 0 3px #e87e7b}.link_finish_allow .gantt_link_control.task_end_date div,.link_start_allow .gantt_link_control.task_start_date div{background-color:#ffbf5e;border-color:#ffa011}.link_finish_deny .gantt_link_control.task_end_date div,.link_start_deny .gantt_link_control.task_start_date div{background-color:#e87e7b;border-color:#dd3e3a}.gantt_link_arrow_right{border-width:4px 0 4px 6px;border-top-color:transparent!important;border-right-color:transparent!important;border-bottom-color:transparent!important;border-left-color:#ffa011;margin-top:-1px}.gantt_link_arrow_left{border-width:4px 6px 4px 0;margin-top:-1px;border-top-color:transparent!important;border-right-color:#ffa011;border-bottom-color:transparent!important;border-left-color:transparent!important}.gantt_link_arrow_up{border-width:0 4px 6px;border-color:transparent transparent #ffa011;border-top-color:transparent!important;border-right-color:transparent!important;border-bottom-color:#ffa011;border-left-color:transparent!important}.gantt_link_arrow_down{border-width:4px 6px 0 4px;border-top-color:#ffa011;border-right-color:transparent!important;border-bottom-color:transparent!important;border-left-color:transparent!important}.gantt_task_drag,.gantt_task_progress_drag{cursor:ew-resize;display:none;position:absolute}.gantt_task_drag.task_right{cursor:e-resize}.gantt_task_drag.task_left{cursor:w-resize}.gantt_task_drag{height:100%;width:8px;z-index:1;top:-1px}.gantt_task_drag.task_left{left:-7px}.gantt_task_drag.task_right{right:-7px}.gantt_task_progress_drag{height:8px;width:8px;bottom:-4px;margin-left:-4px;background-position:bottom;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAYAAAB24g05AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkY3Rjk0RUVDMkYzMTFFMkI1OThEQTA3ODU0OTkzMEEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkY3Rjk0RUZDMkYzMTFFMkI1OThEQTA3ODU0OTkzMEEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyRjdGOTRFQ0MyRjMxMUUyQjU5OERBMDc4NTQ5OTMwQSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyRjdGOTRFREMyRjMxMUUyQjU5OERBMDc4NTQ5OTMwQSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PobPBzIAAADkSURBVHjaYpk2bRoDDsAExL1QdjEQ/8OmiAWHZk4gXqymqhQM4ty6fU8OSMUA8XdiDBAB4k0a6iqWRga6EKcwMQXduHlnL5DpB8Rv0J2JDFSA+JiOtgZcMwiA2CAxkBxUDVYDLEAKgIpV9XQ0MZwFEgPJAZnHoWpRDAgC4n2W5saiQKfjClQGkBxQDciL+6B6wAbkA/EqJwdrTkUFOQZCAKQGpBbIXA3SCzJggo+XK7OEuBgDsQCkFqgHrBfsBT5eHgZSAUwP2IBfv36TbABMDygdtK1Zv6UESLORaAbIhG6AAAMAKN8wE24DXWcAAAAASUVORK5CYII=);background-repeat:no-repeat;z-index:1}.gantt_task_progress_drag:hover{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAYAAAB24g05AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAs0lEQVQoz6WMPW7CQBgFJxZaiZ60qcgdwjVMmzu8gpwhDULabXyBdHAGuzRHivQiQZovigS2+Jtu95t5T03TMITtCtjEc5VSOgx5k5F4CnxJWgKUUl5sv6eUvk/daiCeAe1fDCCpBtq4jQ/YngO9pMWpGH99OOcDtt8ifmWEuO3D/R+wXQOdpGcuIGkGdNFQ2RawlTTlSsLd2RY55+O95JyPFQ/y8MAE+CylfADpxvYHWP8CXj+JR4wdKHYAAAAASUVORK5CYII=)}.gantt_link_tooltip{box-shadow:3px 3px 3px #888;background-color:#fff;border-left:1px dotted #cecece;border-top:1px dotted #cecece;font-family:Tahoma;font-size:8pt;color:#444;padding:6px;line-height:20px}.gantt_link_direction{height:0;border:0 none #ffa011;border-bottom-style:dashed;border-bottom-width:2px;transform-origin:0 0;-ms-transform-origin:0 0;-webkit-transform-origin:0 0;z-index:2;margin-left:1px;position:absolute}.gantt_grid_data .gantt_row.gantt_selected,.gantt_grid_data .gantt_row.odd.gantt_selected,.gantt_task_row.gantt_selected{background-color:#fff3a1}.gantt_task_row.gantt_selected .gantt_task_cell{border-right-color:#ffec6e}.gantt_task_line.gantt_selected{box-shadow:0 0 5px #299cb4}.gantt_task_line.gantt_project.gantt_selected{box-shadow:0 0 5px #46ad51}.gantt_task_line.gantt_milestone{visibility:hidden;background-color:#d33daf;border:0 solid #61164f;box-sizing:content-box;-moz-box-sizing:content-box}.gantt_task_line.gantt_milestone div{visibility:visible}.gantt_task_line.gantt_milestone .gantt_task_content{background:inherit;border:inherit;border-width:1px;border-radius:inherit;box-sizing:border-box;-moz-box-sizing:border-box;transform:rotate(45deg)}.gantt_task_line.gantt_task_inline_color{border-color:#999}.gantt_task_line.gantt_task_inline_color .gantt_task_progress{background-color:#363636;opacity:.2}.gantt_task_line.gantt_task_inline_color.gantt_project.gantt_selected,.gantt_task_line.gantt_task_inline_color.gantt_selected{box-shadow:0 0 5px #999}.gantt_task_link.gantt_link_inline_color:hover .gantt_line_wrapper div{box-shadow:0 0 5px 0 #999}.gantt_critical_task{background-color:#e63030;border-color:#9d3a3a}.gantt_critical_task .gantt_task_progress{background-color:rgba(0,0,0,.4)}.gantt_critical_link .gantt_line_wrapper>div{background-color:#e63030}.gantt_critical_link .gantt_link_arrow{border-color:#e63030}.gantt_btn_set:focus,.gantt_cell:focus,.gantt_grid_head_cell:focus,.gantt_popup_button:focus,.gantt_qi_big_icon:focus,.gantt_row:focus{box-shadow:inset 0 0 1px 1px #4d90fe}.gantt_split_parent,.gantt_split_subproject{opacity:.1;pointer-events:none}.gantt_unselectable,.gantt_unselectable div{-webkit-user-select:none;-moz-user-select:none;-moz-user-select:-moz-none}.gantt_cal_light{-webkit-tap-highlight-color:transparent;background:#fff;border-radius:6px;font-family:Arial;font-size:13px;border:1px solid #cecece;color:#6b6b6b;font-size:12px;position:absolute;z-index:10001;width:550px;height:250px;box-shadow:3px 3px 3px rgba(0,0,0,.07)}.gantt_cal_light_wide{width:650px}.gantt_cal_light select{font-family:Arial;border:1px solid #cecece;font-size:13px;padding:2px;margin:0}.gantt_cal_ltitle{padding:7px 10px;overflow:hidden;-webkit-border-top-left-radius:6px;-webkit-border-bottom-left-radius:0;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:0;-moz-border-radius-topleft:6px;-moz-border-radius-bottomleft:0;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:0;border-top-left-radius:6px;border-bottom-left-radius:0;border-top-right-radius:6px;border-bottom-right-radius:0}.gantt_cal_ltitle,.gantt_cal_ltitle span{white-space:nowrap}.gantt_cal_lsection{color:#727272;font-weight:700;padding:12px 0 5px 10px}.gantt_cal_lsection .gantt_fullday{float:right;margin-right:5px;font-size:12px;font-weight:400;line-height:20px;vertical-align:top;cursor:pointer}.gantt_cal_lsection{font-size:13px}.gantt_cal_ltext{padding:2px 10px;overflow:hidden}.gantt_cal_ltext textarea{overflow-y:auto;overflow-x:hidden;font-family:Arial;font-size:13px;box-sizing:border-box;border:1px solid #cecece;height:100%;width:100%;outline:none!important;resize:none}.gantt_section_constraint [data-constraint-time-select]{margin-left:20px}.gantt_time{font-weight:700}.gantt_cal_light .gantt_title{padding-left:10px}.gantt_cal_larea{border:1px solid #cecece;border-left:none;border-right:none;background-color:#fff;overflow:hidden;height:1px}.gantt_btn_set{margin:10px 7px 5px 10px;padding:5px 15px 5px 10px;float:left;border-radius:4px;border:0 solid #cecece;height:32px;font-weight:700;background:#fff;box-sizing:border-box;cursor:pointer}.gantt_hidden{display:none}.gantt_btn_set div{float:left;font-size:13px;height:22px;line-height:22px;background-repeat:no-repeat;vertical-align:middle}.gantt_save_btn{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTk1OUU5RDFDMzA0MTFFMkExMUZBQTdDNDAzOUE5RjMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTk1OUU5RDJDMzA0MTFFMkExMUZBQTdDNDAzOUE5RjMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxOTU5RTlDRkMzMDQxMUUyQTExRkFBN0M0MDM5QTlGMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxOTU5RTlEMEMzMDQxMUUyQTExRkFBN0M0MDM5QTlGMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PjDroXYAAAEXSURBVHjaYvz//z8DJYCRUgPIAUxAbAnEHiAHMIBcQCwGaRYXF3e6evXqoffv39/dv38/CymaGSUkJBzv3LlzCsj///fv3wdAihkkIQnEvkAshU8zLy+v7a1bt06ANP/79+87kDIAy505cybq06dPr3p7ezuwGQLTfOPGjWP/ESAZLg8kPKBO+g01RBJNszWyZqC6uSgWgIg/f/4shxnS2dnZBjMEqNkSFGBImi8CKTYMA4BYCGjIczRDHC5dunQQSfN7IKWI4UUkjjdMMdCwnw8ePLjwHxV4Yw1gZA5Q47z/2EELzhhCE+ABGvIQWSeQvwcU38QaAML2wHj+C/X3MyAlijeB4ZBoBOIPQGxJKIVSnBsBAgwABddBclWfcZUAAAAASUVORK5CYII=);margin-top:2px;width:21px}.gantt_cancel_btn{margin-top:2px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDkzMDA3MzlDMzA0MTFFMjg2QTVFMzFEQzgwRkJERDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDkzMDA3M0FDMzA0MTFFMjg2QTVFMzFEQzgwRkJERDYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowOTMwMDczN0MzMDQxMUUyODZBNUUzMURDODBGQkRENiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowOTMwMDczOEMzMDQxMUUyODZBNUUzMURDODBGQkRENiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmYuYOUAAAEdSURBVHjaYvz//z8DJYAFXWDlypU8QKoIiD2A2AwqfAqIdwBxX3h4+Bdk9YzILgBqtgdS84FYEYeF94E4EWjIQZgAE5LmQCB1AKoZZKMPEAtAMYh9GSp3AKjWD8UFQAEhIPshEIOc3wHENUBb/qJ57SyQMoJyPwKxElDNO1gYFEE17wMKVmIJlzNQzeegrjaA6qmBecEbSvfh0GwMxGeBhoPoemQ9MAO0kEIbl2YTqPAFKK2IbMB3AjabYIkRZmQD7kNpMyI0G0PpO8gGbIUFJj7NQDk2INWIrIcJKfBAKcwJqvkcDs0TgFgXGo19KCkRmpDWQdWDEk0NUoCBoq0FqhkE/IEWbKJKUmZEz43QzFSKIzN1481M5ACAAAMAlfl/lCwRpagAAAAASUVORK5CYII=);width:20px}.gantt_delete_btn{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjFENzI3NUNDMzA0MTFFMjhBNjJGQTc3MUIyQzYzNEYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjFENzI3NURDMzA0MTFFMjhBNjJGQTc3MUIyQzYzNEYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyMUQ3Mjc1QUMzMDQxMUUyOEE2MkZBNzcxQjJDNjM0RiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyMUQ3Mjc1QkMzMDQxMUUyOEE2MkZBNzcxQjJDNjM0RiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmUD0gAAAABvSURBVHjaYvz//z8DIyMjAxYQicReji4J0ofKQNP8HwmgGQbXB8IsWGwDSSwDuioKjY9uBthVjFAXYHUGAQA2kYmBUoAUBpGk0LAwgBvwH+YX4mkwptgLowYMRgOITUyYKRFIN/wnDjQgJySAAAMApryKzL8wjfUAAAAASUVORK5CYII=);margin-top:2px;width:20px}.gantt_cal_cover{width:100%;height:100%;position:absolute;z-index:10000;top:0;left:0;background-color:#000;opacity:.1;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10)}.gantt_custom_button{padding:0 3px;font-family:Arial;font-size:13px;font-weight:400;margin-right:10px;margin-top:-5px;cursor:pointer;float:right;height:21px;width:90px;border:1px solid #cecece;text-align:center;border-radius:4px}.gantt_custom_button div{cursor:pointer;float:none;height:21px;line-height:21px;vertical-align:middle}.gantt_custom_button div:first-child{display:none}.gantt_cal_light_wide{width:580px;padding:2px 4px}.gantt_cal_light_wide .gantt_cal_larea{box-sizing:border-box;border:1px solid #cecece}.gantt_cal_light_wide .gantt_cal_lsection{border:0;float:left;text-align:right;width:80px;height:20px;padding:5px 10px 0 0}.gantt_cal_light_wide .gantt_wrap_section{position:relative;padding:10px 0;overflow:hidden;border-bottom:1px solid #ebebeb}.gantt_cal_light_wide .gantt_section_time{overflow:hidden;padding-top:2px!important;padding-right:0;height:20px!important}.gantt_cal_light_wide .gantt_cal_ltext{padding-right:0}.gantt_cal_light_wide .gantt_cal_larea{padding:0 10px;width:100%}.gantt_cal_light_wide .gantt_section_time{background:transparent}.gantt_cal_light_wide .gantt_cal_checkbox label{padding-left:0}.gantt_cal_light_wide .gantt_cal_lsection .gantt_fullday{float:none;margin-right:0;font-weight:700;cursor:pointer}.gantt_cal_light_wide .gantt_custom_button{position:absolute;top:0;right:0;margin-top:2px}.gantt_cal_light_wide .gantt_repeat_right{margin-right:55px}.gantt_cal_light_wide.gantt_cal_light_full{width:738px}.gantt_cal_wide_checkbox input{margin-top:8px;margin-left:14px}.gantt_cal_light input{font-size:13px}.gantt_section_time{background-color:#fff;white-space:nowrap;padding:2px 10px 5px;padding-top:2px!important}.gantt_section_time .gantt_time_selects{float:left;height:25px}.gantt_section_time .gantt_time_selects select{height:23px;padding:2px;border:1px solid #cecece}.gantt_duration{width:100px;height:23px;float:left;white-space:nowrap;margin-left:20px;line-height:23px}.gantt_duration .gantt_duration_dec,.gantt_duration .gantt_duration_inc,.gantt_duration .gantt_duration_value{box-sizing:border-box;text-align:center;vertical-align:top;height:100%;border:1px solid #cecece}.gantt_duration .gantt_duration_value{width:40px;padding:3px 4px;border-left-width:0;border-right-width:0}.gantt_duration .gantt_duration_value.gantt_duration_value_formatted{width:70px}.gantt_duration .gantt_duration_dec,.gantt_duration .gantt_duration_inc{width:20px;padding:1px;padding-bottom:1px;background:#fff}.gantt_duration .gantt_duration_dec{-moz-border-top-left-radius:4px;-moz-border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;border-top-left-radius:4px;border-bottom-left-radius:4px}.gantt_duration .gantt_duration_inc{margin-right:4px;-moz-border-top-right-radius:4px;-moz-border-bottom-right-radius:4px;-webkit-border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px}.gantt_resources{max-height:150px;height:auto;overflow-y:auto}.gantt_resource_row{display:block;padding:10px 0;border-bottom:1px solid #ebebeb;cursor:pointer}.gantt_resource_row input[type=checkbox]:not(:checked),.gantt_resource_row input[type=checkbox]:not(:checked)~div{opacity:.5}.gantt_resource_toggle{vertical-align:middle}.gantt_resources_filter .gantt_resources_filter_input{padding:1px 2px;box-sizing:border-box}.gantt_resources_filter .switch_unsetted{vertical-align:middle}.gantt_resource_cell{display:inline-block}.gantt_resource_cell.gantt_resource_cell_checkbox{width:24px;max-width:24px;min-width:24px;vertical-align:middle}.gantt_resource_cell.gantt_resource_cell_label{width:40%;max-width:40%;vertical-align:middle}.gantt_resource_cell.gantt_resource_cell_value{width:30%;max-width:30%;vertical-align:middle}.gantt_resource_cell.gantt_resource_cell_value input,.gantt_resource_cell.gantt_resource_cell_value select{width:80%;vertical-align:middle;padding:1px 2px;box-sizing:border-box}.gantt_resource_cell.gantt_resource_cell_unit{width:10%;max-width:10%;vertical-align:middle}.gantt_resource_early_value{opacity:.8;font-size:.9em}.gantt_cal_quick_info{border:1px solid #cecece;border-radius:6px;position:absolute;z-index:300;box-shadow:3px 3px 3px rgba(0,0,0,.07);background-color:#fff;width:300px;transition:left .5s ease,right .5s;-moz-transition:left .5s ease,right .5s;-webkit-transition:left .5s ease,right .5s;-o-transition:left .5s ease,right .5s}.gantt_no_animate{transition:none;-moz-transition:none;-webkit-transition:none;-o-transition:none}.gantt_cal_quick_info.gantt_qi_left .gantt_qi_big_icon{float:right}.gantt_cal_qi_title{-webkit-border-top-left-radius:6px;-webkit-border-bottom-left-radius:0;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:0;-moz-border-radius-topleft:6px;-moz-border-radius-bottomleft:0;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:0;border-top-left-radius:6px;border-bottom-left-radius:0;border-top-right-radius:6px;border-bottom-right-radius:0;padding:5px 0 8px 12px;color:#454545;background-color:#fff;border-bottom:1px solid #cecece}.gantt_cal_qi_tdate{font-size:14px;font-weight:700}.gantt_cal_qi_tcontent{font-size:13px}.gantt_cal_qi_content{padding:16px 8px;font-size:13px;color:#454545;overflow:hidden}.gantt_cal_qi_controls{-webkit-border-top-left-radius:0;-webkit-border-bottom-left-radius:6px;-webkit-border-top-right-radius:0;-webkit-border-bottom-right-radius:6px;-moz-border-radius-topleft:0;-moz-border-radius-bottomleft:6px;-moz-border-radius-topright:0;-moz-border-radius-bottomright:6px;border-top-left-radius:0;border-bottom-left-radius:6px;border-top-right-radius:0;border-bottom-right-radius:6px;padding-left:7px}.gantt_cal_qi_controls .gantt_menu_icon{margin-top:6px;background-repeat:no-repeat}.gantt_cal_qi_controls .gantt_menu_icon.icon_edit{width:20px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3QYFCjI5ZQj5bAAAAFNJREFUOMvt0zEOACAIA0DkwTymH8bJTRTKZGJXyaWEKPKTCQAH4Ls37cItcDUzsxHNDLZNhCq7Gt1wh9ErV7EjyGAhyGLphlnsClWuS32rn0czAV+vNGrM/LBtAAAAAElFTkSuQmCC)}.gantt_cal_qi_controls .gantt_menu_icon.icon_delete{width:20px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjFENzI3NUNDMzA0MTFFMjhBNjJGQTc3MUIyQzYzNEYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjFENzI3NURDMzA0MTFFMjhBNjJGQTc3MUIyQzYzNEYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyMUQ3Mjc1QUMzMDQxMUUyOEE2MkZBNzcxQjJDNjM0RiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyMUQ3Mjc1QkMzMDQxMUUyOEE2MkZBNzcxQjJDNjM0RiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmUD0gAAAABvSURBVHjaYvz//z8DIyMjAxYQicReji4J0ofKQNP8HwmgGQbXB8IsWGwDSSwDuioKjY9uBthVjFAXYHUGAQA2kYmBUoAUBpGk0LAwgBvwH+YX4mkwptgLowYMRgOITUyYKRFIN/wnDjQgJySAAAMApryKzL8wjfUAAAAASUVORK5CYII=)}.gantt_qi_big_icon{font-size:13px;border-radius:4px;font-weight:700;background:#fff;margin:5px 9px 8px 0;min-width:60px;line-height:32px;vertical-align:middle;padding:0 10px 0 5px;cursor:pointer;border:1px solid #cecece}.gantt_cal_qi_controls div{float:left;height:32px;text-align:center;line-height:32px}.gantt_tooltip{padding:10px;position:absolute;z-index:50;white-space:nowrap}.gantt_resource_marker{position:absolute;text-align:center;font-size:14px;color:#fff}.gantt_resource_marker_ok{background:rgba(78,208,134,.75)}.gantt_resource_marker_overtime{background:hsla(0,100%,76%,.69)}.gantt_histogram_label{width:100%;height:100%;position:absolute;z-index:1;font-weight:700;font-size:13px}.gantt_histogram_fill{background-color:rgba(41,157,180,.2);width:100%;position:absolute;bottom:0}.gantt_histogram_hor_bar{height:1px;margin-top:-1px}.gantt_histogram_hor_bar,.gantt_histogram_vert_bar{position:absolute;background:#299db4;margin-left:-1px}.gantt_histogram_vert_bar{width:1px}.gantt_histogram_cell{position:absolute;text-align:center;font-size:13px;color:#000}.gantt_marker{height:100%;width:2px;top:0;position:absolute;text-align:center;background-color:rgba(255,0,0,.4);box-sizing:border-box}.gantt_marker .gantt_marker_content{padding:5px;background:inherit;color:#fff;position:absolute;font-size:12px;line-height:12px;opacity:.8}.gantt_marker_area{position:absolute;top:0;left:0}.gantt_grid_editor_placeholder{position:absolute}.gantt_grid_editor_placeholder>div,.gantt_grid_editor_placeholder input,.gantt_grid_editor_placeholder select{width:100%;height:100%;box-sizing:border-box}.gantt_row_placeholder div{opacity:.5}.gantt_row_placeholder .gantt_add,.gantt_row_placeholder .gantt_file{display:none}.gantt_drag_marker.gantt_grid_dnd_marker{background-color:transparent;transition:all .1s ease}.gantt_grid_dnd_marker_line{height:4px;width:100%;background-color:#3498db}.gantt_grid_dnd_marker_line:before{background:#fff;width:12px;height:12px;box-sizing:border-box;border:3px solid #3498db;border-radius:6px;content:"";line-height:1px;display:block;position:absolute;margin-left:-11px;margin-top:-4px;pointer-events:none}.gantt_grid_dnd_marker_folder{height:100%;width:100%;position:absolute;pointer-events:none;box-sizing:border-box;box-shadow:inset 0 0 0 2px #3f98db;background:transparent}.gantt_overlay_area{display:none}.gantt_overlay,.gantt_overlay_area{position:absolute;height:inherit;width:inherit;top:0;left:0}.gantt_click_drag_rect{position:absolute;left:0;top:0;outline:1px solid #3f98db;background-color:rgba(52,152,219,.3)}.gantt_timeline_move_available,.gantt_timeline_move_available *{cursor:move}.gantt_rtl .gantt_grid{text-align:right}.gantt_rtl .gantt_cell,.gantt_rtl .gantt_row{flex-direction:row-reverse}.gantt_layout_content{width:100%;overflow:auto;box-sizing:border-box}.gantt_layout_cell{position:relative;box-sizing:border-box}.gantt_layout_cell>.gantt_layout_header{background:#33aae8;color:#fff;font-size:17px;padding:5px 10px;box-sizing:border-box}.gantt_layout_header.collapsed_x{background:#a9a9a9}.gantt_layout_header.collapsed_x .gantt_header_arrow:before{content:"\21E7"}.gantt_layout_header.collapsed_y{background:#a9a9a9}.gantt_layout_header.collapsed_y .gantt_header_arrow:before{content:"\21E9"}.gantt_layout_header{cursor:pointer}.gantt_layout_header .gantt_header_arrow{float:right;text-align:right}.gantt_layout_header .gantt_header_arrow:before{content:"\21E6"}.gantt_layout_header.vertical .gantt_header_arrow:before{content:"\21E7"}.gantt_layout_outer_scroll_vertical .gantt_layout_content{overflow-y:hidden}.gantt_layout_outer_scroll_horizontal .gantt_layout_content{overflow-x:hidden}.gantt_layout_x>.gantt_layout_cell{display:inline-block;vertical-align:top}.gantt_layout_x{white-space:nowrap}.gantt_resizing{opacity:.7;background:#f2f2f2}.gantt_layout_cell_border_right.gantt_resizer{overflow:visible;border-right:0}.gantt_resizer{cursor:e-resize;position:relative}.gantt_resizer_y{cursor:n-resize}.gantt_resizer_stick{background:#33aae8;z-index:9999;position:absolute;top:0;width:100%}.gantt_resizer_x .gantt_resizer_x{position:absolute;width:20px;height:100%;margin-left:-10px;top:0;left:0;z-index:1}.gantt_resizer_y .gantt_resizer_y{position:absolute;height:20px;width:100%;top:-10px;left:0;z-index:1}.gantt_resizer_error{background:#cd5c5c!important}.gantt_layout_cell_border_left{border-left:1px solid #cecece}.gantt_layout_cell_border_right{border-right:1px solid #cecece}.gantt_layout_cell_border_top{border-top:1px solid #cecece}.gantt_layout_cell_border_bottom{border-bottom:1px solid #cecece}.gantt_layout_cell_border_transparent{border-color:transparent}.gantt_window{position:absolute;top:50%;left:50%;z-index:999999999;background:#fff}.gantt_window_content{position:relative}.gantt_window_content_header{background:#39c;color:#fff;height:33px;padding:10px 10px 0;border-bottom:2px solid #fff;position:relative}.gantt_window_content_header_text{padding-left:10%}.gantt_window_content_header_buttons{position:absolute;top:10px;right:10px}.gantt_window_content_header_buttons:hover{color:#000;cursor:pointer}.gantt_window_content_resizer{position:absolute;width:15px;height:15px;bottom:0;line-height:15px;right:-1px;text-align:center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAABlBMVEUAAAAAAAClZ7nPAAAAAXRSTlMAQObYZgAAABZJREFUeAFjIAUwUshlpJDLSIhLGAAACQ4AFk79JaMAAAAASUVORK5CYII=);cursor:nw-resize;z-index:999}.gantt_window_content_frame{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.1);z-index:9999}.gantt_window_drag{cursor:pointer!important}.gantt_window_resizing{overflow:visible}.gantt_window_resizing_body{overflow:hidden!important}.gantt_window_modal{background:rgba(0,0,0,.1);z-index:9999;top:0;left:0;width:100%;height:100%;position:fixed}.gantt_cal_light,.gantt_cal_quick_info,.gantt_container,.gantt_message_area,.gantt_modal_box,.gantt_tooltip{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.gantt_noselect{-moz-user-select:-moz-none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.gantt_drag_marker{position:absolute;top:-1000px;left:-1000px;font-family:Arial;font-size:13px;z-index:1;white-space:nowrap}.gantt_drag_marker .gantt_tree_icon.gantt_blank,.gantt_drag_marker .gantt_tree_icon.gantt_close,.gantt_drag_marker .gantt_tree_icon.gantt_open,.gantt_drag_marker .gantt_tree_indent{display:none}.gantt_drag_marker,.gantt_drag_marker .gantt_row.odd{background-color:#fff}.gantt_drag_marker .gantt_row{border-left:1px solid #d2d2d2;border-top:1px solid #d2d2d2}.gantt_drag_marker .gantt_cell{border-color:#d2d2d2}.gantt_row.gantt_over,.gantt_task_row.gantt_over{background-color:#0070fe}.gantt_row.gantt_transparent .gantt_cell{opacity:.7}.gantt_task_row.gantt_transparent{background-color:#f8fdfd}.gantt_popup_button.gantt_delete_button{background:#3db9d3;text-shadow:0 -1px 0 #248a9f;color:#fff;font-weight:700;border-width:0}.gantt_container_resize_watcher{background:transparent;width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1;pointer-events:none;border:0;box-sizing:border-box;opacity:0} \ No newline at end of file diff --git a/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.d.ts b/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.d.ts new file mode 100644 index 000000000..abbed2392 --- /dev/null +++ b/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.d.ts @@ -0,0 +1,2485 @@ +// Type definitions for dhtmlxGantt 7.0.1 +// Project: https://dhtmlx.com/docs/products/dhtmlxGantt + +type GanttCallback = (...args: any[]) => any; + + +export type GanttEventName = "onAfterAutoSchedule"|"onAfterBatchUpdate"|"onAfterBranchLoading"|"onAfterLightbox"|"onAfterLinkAdd"|"onAfterLinkDelete"|"onAfterLinkUpdate"|"onAfterQuickInfo"|"onAfterRedo"|"onAfterSort"|"onAfterTaskAdd"|"onAfterTaskAutoSchedule"|"onAfterTaskDelete"|"onAfterTaskDrag"|"onAfterTaskMove"|"onAfterTaskUpdate"|"onAfterUndo"|"onAjaxError"|"onAutoScheduleCircularLink"|"onBeforeAutoSchedule"|"onBeforeBatchUpdate"|"onBeforeBranchLoading"|"onBeforeCollapse"|"onBeforeDataRender"|"onBeforeExpand"|"onBeforeGanttReady"|"onBeforeGanttRender"|"onBeforeLightbox"|"onBeforeLinkAdd"|"onBeforeLinkDelete"|"onBeforeLinkDisplay"|"onBeforeLinkUpdate"|"onBeforeMultiSelect"|"onBeforeParse"|"onBeforeRedo"|"onBeforeRedoStack"|"onBeforeRowDragEnd"|"onBeforeRowDragMove"|"onBeforeTaskAdd"|"onBeforeTaskAutoSchedule"|"onBeforeTaskChanged"|"onBeforeTaskDelete"|"onBeforeTaskDisplay"|"onBeforeTaskDrag"|"onBeforeTaskMove"|"onBeforeTaskMultiSelect"|"onBeforeTaskSelected"|"onBeforeTaskUpdate"|"onBeforeUndo"|"onBeforeUndoStack"|"onCircularLinkError"|"onClear"|"onCollapse"|"onColumnResize"|"onColumnResizeEnd"|"onColumnResizeStart"|"onContextMenu"|"onDataProcessorReady"|"onDataRender"|"onDestroy"|"onEmptyClick"|"onError"|"onExpand"|"onGanttLayoutReady"|"onGanttReady"|"onGanttRender"|"onGanttScroll"|"onGridHeaderClick"|"onGridResize"|"onGridResizeEnd"|"onGridResizeStart"|"onLightbox"|"onLightboxButton"|"onLightboxCancel"|"onLightboxChange"|"onLightboxDelete"|"onLightboxSave"|"onLinkClick"|"onLinkCreated"|"onLinkDblClick"|"onLinkIdChange"|"onLinkValidation"|"onLoadEnd"|"onLoadStart"|"onMouseMove"|"onMultiSelect"|"onOptionsLoad"|"onParse"|"onQuickInfo"|"onRowDragEnd"|"onRowDragStart"|"onScaleAdjusted"|"onScaleClick"|"onTaskClick"|"onTaskClosed"|"onTaskCreated"|"onTaskDblClick"|"onTaskDrag"|"onTaskIdChange"|"onTaskLoading"|"onTaskMultiSelect"|"onTaskOpened"|"onTaskRowClick"|"onTaskSelected"|"onTaskUnselected"|"onTemplatesReady"; + + +export interface GanttTemplates { + + /** + * specifies the content of start date or end date columns in grid + * @param date the date which needs formatting + * @param task the task object + * @param column the name of the column that called the template + */ + date_grid(date: Date, task: any, column: string): string; + + /** + * specifies the text of tooltips that are displayed when the user creates a new dependency link + * @param from the id of the source task + * @param from_start true, if the link is being dragged from the start of the source task, false - if
from the end of the task + * @param to the id of the target task( 'null' or 'undefined', if the target task isn't specified yet) + * @param to_start true, if the link is being dragged to the start of the target task, false - if
to the end of the task + */ + drag_link(from: string|number, from_start: boolean, to: string|number, to_start: boolean): string; + + /** + * specifies the CSS class that will be applied to the pop-up that appears when a user drags a link + * @param from the id of the source task + * @param from_start true, if the link is being dragged from the start of the source task, false - if
from the end of the task + * @param to the id of the target task( 'null' or 'undefined', if the target task isn't specified yet) + * @param to_start true, if the link is being dragged to the start of the target task, false - if
to the end of the task + */ + drag_link_class(from: string|number, from_start: boolean, to: string|number, to_start: boolean): string; + + /** + * сonverts a date object to a date string. Used to send data back to the server + * @param date the date which needs formatting + */ + format_date(date: Date): string; + + /** + * specifies the custom content inserted before the labels of child items in the tree column + * @param task the task object + */ + grid_blank(task: any): string; + + /** + * specifies the format of dates in the "Start time" column + * @param date the date which needs formatting + * @param column the name of the column that called the template + */ + grid_date_format(date: Date, column: string): string; + + /** + * specifies the icon of child items in the tree column + * @param task the task object + */ + grid_file(task: any): string; + + /** + * specifies the icon of parent items in the tree column + * @param task the task object + */ + grid_folder(task: any): string; + + /** + * specifies the CSS class that will be applied to the headers of the table's columns + * @param columnName the column's name (as specified in the "name" property of the column object) + * @param column column object (as specified in the gantt.config.columns config) + */ + grid_header_class(columnName: string, column: any): string; + + /** + * specifies the indent of the child items in a branch (in the tree column) + * @param task the task object + */ + grid_indent(task: any): string; + + /** + * specifies the icon of the open/close sign in the tree column + * @param task the task object + */ + grid_open(task: any): string; + + /** + * specifies the CSS class that will be applied to a grid row + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + grid_row_class(start: Date, end: Date, task: any): string; + + /** + * defines the height of the filled area in the resourceHistogram + * @param start_date start date of the scale cell + * @param end_date end date of the scale cell + * @param resource the resource object + * @param tasks tasks that are assigned to the specified resource and overlap start/end dates of the cell + */ + histogram_cell_allocated(start_date: Date, end_date: Date, resource: any, tasks: any[]): void; + + /** + * specifies the height of the line that defines the available capacity of the resource + * @param start_date start date of the scale cell + * @param end_date end date of the scale cell + * @param resource the resource object + * @param tasks tasks that are assigned to the specified resource and overlap start/end dates of the cell + */ + histogram_cell_capacity(start_date: Date, end_date: Date, resource: any, tasks: any[]): void; + + /** + * defines the CSS class which is applied to a cell of the resource panel + * @param start_date start date of the scale cell + * @param end_date end date of the scale cell + * @param resource the resource object + * @param tasks tasks that are assigned to the specified resource and overlap start/end dates of the cell + */ + histogram_cell_class(start_date: Date, end_date: Date, resource: any, tasks: any[]): void; + + /** + * defines the label inside a cell + * @param start_date start date of the scale cell + * @param end_date end date of the scale cell + * @param resource the resource object + * @param tasks tasks that are assigned to the specified resource and overlap start/end dates of the cell + */ + histogram_cell_label(start_date: Date, end_date: Date, resource: any, tasks: any[]): void; + + /** + * specifies the CSS class that will be applied to a link + * @param link the link object + */ + link_class(link: any): string; + + /** + * specifies the text in the header of the link's "delete" confirm window + * @param link the link object + */ + link_description(link: any): string; + + /** + * converts date string into a Date object + * @param date the string which need to be parsed + */ + parse_date(date: string): Date; + + /** + * specifies the text in the completed part of the task bar + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + progress_text(start: Date, end: Date, task: any): string; + + /** + * specifies the CSS class that will be applied to the pop-up edit form + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + quick_info_class(start: Date, end: Date, task: any): void; + + /** + * specifies the content of the pop-up edit form + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + quick_info_content(start: Date, end: Date, task: any): string; + + /** + * specifies the date of the pop-up edit form + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + quick_info_date(start: Date, end: Date, task: any): string; + + /** + * specifies the title of the pop-up edit form + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + quick_info_title(start: Date, end: Date, task: any): string; + + /** + * defines the CSS class names of cells in the resource timeline cells + * @param start_date start date of the scale cell + * @param end_date end date of the scale cell + * @param resource the resource object + * @param tasks tasks that are assigned to specified resource and overlap start/end dates of the cell + */ + resource_cell_class(start_date: Date, end_date: Date, resource: any, tasks: any[]): string; + + /** + * defines the HTML content of resource timeline cells + * @param start_date start date of the scale cell + * @param end_date end date of the scale cell + * @param resource the resource object + * @param tasks tasks that are assigned to specified resource and overlap start/end dates of the cell + */ + resource_cell_value(start_date: Date, end_date: Date, resource: any, tasks: any[]): string; + + /** + * specifies the CSS class that will be applied to cells of the time scale of the timeline area + * @param date the date of a cell + */ + scale_cell_class(date: Date): string; + + /** + * specifies the CSS class that will be applied to the time scale + * @param scale the scale's configuration object + */ + scale_row_class(scale: any): string; + + /** + * specifies the CSS class that will be applied to task bars + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + task_class(start: Date, end: Date, task: any): string; + + /** + * specifies the date format of the label in the 'Time period' section of the lightbox + * @param date the date which needs formatting + */ + task_date(date: Date): string; + + /** + * specifies the format for the end dates of tasks in the lightbox + * @param date the date which needs formatting + */ + task_end_date(date: Date): string; + + /** + * specifies the CSS class that will be applied to the row of the timeline area + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + task_row_class(start: Date, end: Date, task: any): string; + + /** + * specifies the text in the task bars and the header of the lightbox + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + task_text(start: Date, end: Date, task: any): string; + + /** + * specifies the date period in the header of the lightbox + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + task_time(start: Date, end: Date, task: any): string; + + /** + * specifies the dates of unscheduled tasks + * @param task the task object + */ + task_unscheduled_time(task: any): void; + + /** + * specifies the format of the drop-down time selector in the lightbox + * @param date the date which needs formatting + */ + time_picker(date: Date): string; + + /** + * specifies the CSS class that will be applied to the cells of the timeline area + * @param item the task object assigned to the row + * @param date the date of a cell + */ + timeline_cell_class(item: any, date: Date): string; + + /** + * specifies the format of start and end dates displayed in the tooltip + * @param date the date which needs formatting + */ + tooltip_date_format(date: Date): string; + + /** + * specifies the text of tooltips + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + tooltip_text(start: Date, end: Date, task: any): string; + + /** + * a string from an XML file is converted into a date object in conformity with this template + * @param date the date which needs formatting + */ + xml_date(date: Date): string; + + /** + * a date object is converted into a string in conformity with this template. Used to send data back to the server + * @param date the date which needs formatting + */ + xml_format(date: Date): string; + + /** + * specifies the text assigned to tasks bars on the right side + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + rightside_text(start: Date, end: Date, task: any): string; + + /** + * specifies the text assigned to tasks bars on the left side + * @param start the date when a task is scheduled to begin + * @param end the date when a task is scheduled to be completed + * @param task the task object + */ + leftside_text(start: Date, end: Date, task: any): string; + + /** + * specifies the lightbox's header + * @param start_date the date when a task is scheduled to begin + * @param end_date the date when a task is scheduled to be completed + * @param task the task's object + */ + lightbox_header(start_date: Date, end_date: Date, task: any): string; +} + +export interface GanttConfigOptions { + + /** + * enables auto scheduling + */ + auto_scheduling: boolean; + + /** + * disables usage of time contraints for tasks + */ + auto_scheduling_compatibility: boolean; + + /** + * allows or forbids creating links from parent tasks (projects) to their children + */ + auto_scheduling_descendant_links: boolean; + + /** + * defines whether gantt will do autoscheduling on data loading/parsing + */ + auto_scheduling_initial: boolean; + + /** + * defines whether the whole project will be moved (see the details below) + */ + auto_scheduling_move_projects: boolean; + + /** + * enables the auto scheduling mode, in which tasks will always be rescheduled to the earliest possible date + */ + auto_scheduling_strict: boolean; + + /** + * automatically converts tasks with subtasks to projects and projects without subtasks back to tasks + */ + auto_types: boolean; + + /** + * enables automatic adjusting of the grid's columns to the grid's width + */ + autofit: boolean; + + /** + * enables autoscrolling while dragging a task or link out of the current browser screen + */ + autoscroll: boolean; + + /** + * defines the speed of autoscrolling (in ms) while dragging a task or link out of the current browser screen + */ + autoscroll_speed: number; + + /** + * forces the Gantt chart to automatically change its size to show all tasks without scrolling + */ + autosize: boolean|string; + + /** + * sets the minimum width (in pixels) that the Gantt chart can take in the horizontal 'autosize' mode + */ + autosize_min_width: number; + + /** + * enables dynamic loading in the Gantt chart + */ + branch_loading: boolean; + + /** + * specifies that the task has children that are not yet loaded from the backend + */ + branch_loading_property: string; + + /** + * stores a collection of buttons resided in the left bottom corner of the lightbox + */ + buttons_left: any[]; + + /** + * stores a collection of buttons resided in the right bottom corner of the lightbox + */ + buttons_right: any[]; + + /** + * changes the name of the property that affects binding of a calendar to a task/group of tasks + */ + calendar_property: string; + + /** + * enables cascade deleting of nested tasks and links + */ + cascade_delete: boolean; + + /** + * enables advanced drag-n-drop + */ + click_drag: any; + + /** + * configures the columns of the table + */ + columns: any[]; + + /** + * contains all available constraint types + */ + constraint_types: any; + + /** + * enables adjusting the task's start and end dates to the work time (while dragging) + */ + correct_work_time: boolean; + + /** + * defines internal implementation of the code of date formatting methods + */ + csp: boolean|string; + + /** + * sets the date format that is used to parse data from a data set and to send dates back to the server + */ + date_format: string; + + /** + * sets the format of dates in the "Start time" column of the table + */ + date_grid: string; + + /** + * sets the format of the time scale (X-Axis) + */ + date_scale: string; + + /** + * 'says' to open the lightbox while creating new events by clicking the '+' button + */ + details_on_create: boolean; + + /** + * 'says' to open the lightbox after double clicking on a task + */ + details_on_dblclick: boolean; + + /** + * enables the possibility to drag the lightbox by the header + */ + drag_lightbox: boolean; + + /** + * enables creating dependency links by drag-and-drop + */ + drag_links: boolean; + + /** + * stores the types of available drag-and-drop modes + */ + drag_mode: any; + + /** + * enables the possibility to move tasks by drag-and-drop + */ + drag_move: boolean; + + /** + * enables the possibility to drag several selected tasks at once + */ + drag_multiple: boolean; + + /** + * enables the possibility to change the task progress by dragging the progress knob + */ + drag_progress: boolean; + + /** + * enables drag and drop of items of the project type + */ + drag_project: boolean; + + /** + * enables the possibility to resize tasks by drag-and-drop + */ + drag_resize: boolean; + + /** + * configures the behavior of the drag_timeline extension + */ + drag_timeline: any; + + /** + * sets the number of 'gantt.config.duration_unit' units that will correspond to one unit of the 'duration' data property. + */ + duration_step: number; + + /** + * sets the duration unit + */ + duration_unit: string; + + /** + * enables automatic merging of multiple resource calendars into one + */ + dynamic_resource_calendars: boolean; + + /** + * changes the name of a property that affects the editing ability of tasks/links in the read-only Gantt chart + */ + editable_property: string; + + /** + * an object that contains definitions of inline editors + */ + editor_types: any; + + /** + * sets the end value of the time scale + */ + end_date: Date; + + /** + * 'says' the Gantt chart to automatically extend the time scale in order to fit all displayed tasks + */ + fit_tasks: boolean; + + /** + * adjusts the width of columns inside a scrollable grid + */ + grid_elastic_columns: boolean; + + /** + * makes the grid resizable by dragging the right grid's border + */ + grid_resize: boolean; + + /** + * sets the name of the attribute of the grid resizer's DOM element + */ + grid_resizer_attribute: string; + + /** + * sets the name of the attribute of the column resizer's DOM element. The attribute presents the column's index + */ + grid_resizer_column_attribute: string; + + /** + * sets the width of the grid + */ + grid_width: number; + + /** + * shows the critical path in the chart + */ + highlight_critical_path: boolean; + + /** + * enables/disables horizontal scroll by the Shift|Alt|Meta key + mouse wheel movement + */ + horizontal_scroll_key: string|boolean; + + /** + * defines whether tasks should inherit work calendars from their summary parents + */ + inherit_calendar: boolean; + + /** + * specifies whether sub-scales shall use the scale_cell_class template by default + */ + inherit_scale_class: boolean; + + /** + * sets whether the timeline area will be initially scrolled to display the earliest task + */ + initial_scroll: boolean; + + /** + * keeps the duration of a task unchanged during editing of the start/end of a task + */ + inline_editors_date_processing: string; + + /** + * 'says' to preserve the initial grid's width while resizing columns within + */ + keep_grid_width: boolean; + + /** + * enables keyboard navigation in gantt + */ + keyboard_navigation: boolean; + + /** + * enables keyboard navigation by cells + */ + keyboard_navigation_cells: boolean; + + /** + * sets the name of the attribute of the task layer's DOM element + */ + layer_attribute: string; + + /** + * specifies the layout object + */ + layout: any; + + /** + * specifies the lightbox object + */ + lightbox: any; + + /** + * increases the height of the lightbox + */ + lightbox_additional_height: number; + + /** + * sets the size of the link arrow + */ + link_arrow_size: number; + + /** + * sets the name of the attribute that will specify the id of the link's HTML element + */ + link_attribute: string; + + /** + * sets the width of dependency links in the timeline area + */ + link_line_width: number; + + /** + * sets the width of the area (over the link) sensitive to clicks + */ + link_wrapper_width: number; + + /** + * stores the types of links dependencies + */ + links: any; + + /** + * sets the minimum width for a column in the timeline area + */ + min_column_width: number; + + /** + * sets the minimum duration (in milliseconds) that can be set for a task during resizing. + */ + min_duration: number; + + /** + * sets the minumum width for the grid (in pixels) while being resized + */ + min_grid_column_width: number; + + /** + * enables/disables multi-task selection in the Gantt chart + */ + multiselect: boolean; + + /** + * specifies whether multi-task selection will be available within one or any level + */ + multiselect_one_level: boolean; + + /** + * enables the possibility to expand/collapse split tasks by clicking the +/- button + */ + open_split_tasks: boolean; + + /** + * openes all branches initially + */ + open_tree_initially: boolean; + + /** + * activates the 'branch' mode that allows vertically reordering tasks within the same tree level + */ + order_branch: string|boolean; + + /** + * activates the 'branch' mode that allows reordering tasks within the whole gantt + */ + order_branch_free: boolean; + + /** + * adds an empty row into the end of the list of tasks to simplify tasks editing via keyboard + */ + placeholder_task: boolean; + + /** + * preserves the current position of the vertical and horizontal scrolls while re-drawing the gantt chart + */ + preserve_scroll: boolean; + + /** + * specifies whether the gantt container should block the mousewheel event, or should it be propagated up to the window element + */ + prevent_default_scroll: boolean; + + /** + * specifies the end date of a project + */ + project_end: Date; + + /** + * specifies the start date of a project + */ + project_start: Date; + + /** + * defines whether the task form will appear from the left/right side of the screen or near the selected task + */ + quick_info_detached: boolean; + + /** + * stores a collection of buttons resided in the pop-up task's details form + */ + quickinfo_buttons: any[]; + + /** + * activates the read-only mode for the Gantt chart + */ + readonly: boolean; + + /** + * changes the name of a property that affects the read-only behaviour of tasks/links + */ + readonly_property: string; + + /** + * enables the Redo functionality for the gantt + */ + redo: boolean; + + /** + * enables the possibility to reorder grid columns by drag and drop + */ + reorder_grid_columns: boolean; + + /** + * changes the name of the attribute that Gantt uses to find which resource the task row in the resource grid/timeline is referring to + */ + resource_attribute: string; + + /** + * defines a set of working calendars that can be assigned to a specific resource, e.g. a user + */ + resource_calendars: any; + + /** + * defines the property of a task object that stores a resource id associated with resourceGrid/Timeline/Histogram/Calendar + */ + resource_property: string; + + /** + * tells the resource timeline to render elements and call templates for non-allocated cells + */ + resource_render_empty_cells: boolean; + + /** + * specifies the name of the dataStore connected to the resourceGrid/resourceTimeline/resourceHistogram views + */ + resource_store: string; + + /** + * sets the id of the virtual root element + */ + root_id: string|number; + + /** + * enables rounding the task's start and end dates to the nearest scale marks + */ + round_dnd_dates: boolean; + + /** + * sets the default height for rows of the table + */ + row_height: number; + + /** + * switches gantt to the right-to-left mode + */ + rtl: boolean; + + /** + * sets the height of the time scale and the header of the grid + */ + scale_height: number; + + /** + * sets the minimal scale unit (in case multiple scales are used) as the interval of the leading/closing empty space + */ + scale_offset_minimal: boolean; + + /** + * sets the unit of the time scale (X-Axis) + */ + scale_unit: string; + + /** + * defines configuration settings of the time scale + */ + scales: any[]; + + /** + * enables backward scheduling + */ + schedule_from_end: boolean; + + /** + * specifies whether the timeline area shall be scrolled while selecting to display the selected task + */ + scroll_on_click: boolean; + + /** + * set the sizes of the vertical (width) and horizontal (height) scrolls + */ + scroll_size: number; + + /** + * enables selection of tasks in the Gantt chart + */ + select_task: boolean; + + /** + * enables converting server-side dates from UTC to a local time zone (and backward) while sending data to the server + */ + server_utc: boolean; + + /** + * shows the chart (timeline) area of the Gantt chart + */ + show_chart: boolean; + + /** + * enables showing error alerts in case of unexpected behavior + */ + show_errors: boolean; + + /** + * shows the grid area of the Gantt chart + */ + show_grid: boolean; + + /** + * enables/disables displaying links in the Gantt chart + */ + show_links: boolean; + + /** + * shows/hides markers on the page + */ + show_markers: boolean; + + /** + * enables displaying of the progress inside the task bars + */ + show_progress: boolean; + + /** + * activates/disables the 'quick_info' extension (pop-up task's details form) + */ + show_quick_info: boolean; + + /** + * enables/disables displaying column borders in the chart area + */ + show_task_cells: boolean; + + /** + * enables showing tasks that are outside the specified date range in the Gantt chart + */ + show_tasks_outside_timescale: boolean; + + /** + * enables showing unscheduled tasks + */ + show_unscheduled: boolean; + + /** + * hides non-working time from the time scale + */ + skip_off_time: boolean; + + /** + * enables the smart rendering mode for gantt's tasks and links rendering + */ + smart_rendering: boolean; + + /** + * specifies that only visible part of the time scale is rendered on the screen + */ + smart_scales: boolean; + + /** + * enables sorting in the table + */ + sort: boolean; + + /** + * sets the start value of the time scale + */ + start_date: Date; + + /** + * sets the starting day of the week + */ + start_on_monday: boolean; + + /** + * generates a background image for the timeline area instead of rendering actual columns' and rows' lines + */ + static_background: boolean; + + /** + * enables rendering of highlighted cells in the static_background mode + */ + static_background_cells: boolean; + + /** + * sets the step of the time scale (X-Axis) + */ + step: number; + + /** + * specifies the second time scale(s) (deprecated) + */ + subscales: any[]; + + /** + * sets the name of the attribute that will specify the id of the task's HTML element + */ + task_attribute: string; + + /** + * sets the format of the date label in the 'Time period' section of the lightbox + */ + task_date: string; + + /** + * sets the height of task bars in the timeline area + */ + task_height: number|string; + + /** + * sets the offset (in pixels) of the nearest task from the left border in the timeline + */ + task_scroll_offset: number; + + /** + * sets the format of the time drop-down selector in the lightbox + */ + time_picker: string; + + /** + * sets the minimum step (in minutes) for the task's time values + */ + time_step: number; + + /** + * sets the length of time, in milliseconds, before the tooltip hides + */ + tooltip_hide_timeout: number; + + /** + * sets the right (if positive) offset of the tooltip's position + */ + tooltip_offset_x: number; + + /** + * sets the top (if positive) offset of the tooltip's position + */ + tooltip_offset_y: number; + + /** + * sets the timeout in milliseconds before the tooltip is displayed for a task + */ + tooltip_timeout: number; + + /** + * enables/disables the touch support for the Gantt chart + */ + touch: boolean|string; + + /** + * defines the time period in milliseconds that is used to differ the long touch gesture from the scroll gesture + */ + touch_drag: number|boolean; + + /** + * returns vibration feedback before/after drag and drop on touch devices + */ + touch_feedback: boolean; + + /** + * defines the duration of vibration feedback before/after drag and drop on touch devices (in milliseconds) + */ + touch_feedback_duration: number; + + /** + * redefines functions responsible for displaying different types of tasks + */ + type_renderers: any; + + /** + * stores the names of lightbox's structures (used for different types of tasks) + */ + types: any; + + /** + * enables the Undo functionality for the gantt + */ + undo: boolean; + + /** + * sets the actions that the Undo operation will revert + */ + undo_actions: any; + + /** + * sets the number of steps that should be reverted by the undo method + */ + undo_steps: number; + + /** + * sets the types of entities for which the Undo operation will be applied + */ + undo_types: any; + + /** + * enables WAI-ARIA support to make the component recognizable for screen readers + */ + wai_aria_attributes: boolean; + + /** + * enables calculating the duration of tasks in working time instead of calendar time + */ + work_time: boolean; + + /** + * defines date formats that are used to parse data from a data set and to send data to a server + */ + xml_date: string; +} + +export interface GanttDateHelpers { + add(origin: Date, count: number, unit: string): Date; + copy(origin: Date): Date; + date_part(origin: Date): Date; + time_part(origin: Date): Date; + day_start(origin: Date): Date; + month_start(origin: Date): Date; + week_start(origin: Date): Date; + year_start(origin: Date): Date; + getISOWeek(origin: Date): number; + getUTCISOWeek(origin: Date): number; + date_to_str(format: string): any; + str_to_date(format: string): any; + convert_to_utc(origin: Date): Date; + to_fixed(value: number): string; +} + +export interface GanttHotkeys { + edit_save: number; + edit_cancel: number; +} + +export type MonthLabelList = [string, string, string, string, string, string, string, string, string, string, string, string]; +export type WeekDayLabelList = [string, string, string, string, string, string, string]; + +export interface GanttLocaleDate { + month_full: MonthLabelList; + month_short: MonthLabelList; + day_full: WeekDayLabelList; + day_short: WeekDayLabelList; +} + +export interface GanttLocaleLabels { + new_task: string; + icon_save: string; + icon_cancel: string; + icon_details: string; + icon_edit: string; + icon_delete: string; + confirm_closing: string; + confirm_deleting: string; + section_description: string; + section_time: string; + section_type: string; + + /* grid columns */ + column_wbs: string; + column_text: string; + column_start_date: string; + column_duration: string; + column_add: string; + + /* link confirmation */ + link: string; + confirm_link_deleting: string; + link_start: string; + link_end: string; + + type_task: string; + type_project: string; + type_milestone: string; + + minutes: string; + hours: string; + days: string; + weeks: string; + months: string; + years: string; + + /* message popup */ + message_ok: string; + message_cancel: string; + + /* constraints */ + section_constraint: string; + constraint_type: string; + constraint_date: string; + asap: string; + alap: string; + snet: string; + snlt: string; + fnet: string; + fnlt: string; + mso: string; + mfo: string; + + /* resource control */ + resources_filter_placeholder: string; + resources_filter_label: string; +} + +export interface GanttLocale { + date: GanttLocaleDate; + labels: GanttLocaleLabels; +} + +export interface GanttPlugins { + auto_scheduling?: boolean; + click_drag?: boolean; + critical_path?: boolean; + drag_timeline?: boolean; + fullscreen?: boolean; + keyboard_navigation?: boolean; + quick_info?: boolean; + tooltip?: boolean; + undo?: boolean; + grouping?: boolean; + marker?: boolean; + multiselect?: boolean; + overlay?: boolean; +} + +export interface GanttInitializationConfig { + container?: string|HTMLElement; + config?: any; + templates?: any; + events?: any; + data?: any; + plugins?: GanttPlugins; + locale?: any; +} + +export interface GanttInternationalization { + setLocale(locale: any): void; + getLocale(language?: string): GanttLocale; + addLocale(language: string, locale: GanttLocale): void; +} +export type GanttPlugin = (gantt: GanttStatic) => void; + +export interface GanttEnterprise { + plugin(plugin: GanttPlugin): void; + getGanttInstance(settings?: GanttInitializationConfig) : GanttStatic; +} + + +export interface GanttStatic { + + /** + * redefines the default click behavior for buttons of the Gantt chart + */ + $click: any; + + /** + * gantt ajax module + */ + ajax: any; + + /** + * the interface of the working calendar object + */ + calendar: any; + + /** + * defines configuration options for dates, scale, controls + */ + config: GanttConfigOptions; + + /** + * stores various constants to reduce the use of magic numbers in the code + */ + constants: any; + + /** + * a set of date formatting methods + */ + date: GanttDateHelpers; + + /** + * a set of flags which describe current environment + */ + env: any; + + /** + * an object that stores various extensions + */ + ext: any; + + /** + * a set of methods for Gantt chart localization + */ + i18n: GanttInternationalization; + + /** + * specifies JSON serialization and parsing + */ + json: any; + + /** + * defines the hot keys for the Gantt chart + */ + keys: GanttHotkeys; + + /** + * returns the license name of dhtmlxGantt + */ + license: any; + + /** + * the current locale object (region-specific labels) of the Gantt chart + */ + locale: GanttLocale; + + /** + * specifies serialization and parsing in the XML format of dhtmlxGantt 1.0 + */ + oldxml: any; + + /** + * returns the current skin of the Gantt chart + */ + skin: string; + + /** + * returns objects of the available skins + */ + skins: any; + + /** + * defines formatting templates for dates, titles, tooltips in the Gantt chart + */ + templates: GanttTemplates; + + /** + * various helper modules + */ + utils: any; + + /** + * returns the version of dhtmlxGantt + */ + version: string; + + /** + * specifies XML serialization and parsing + */ + xml: any; + + /** + * Promise object constructor + */ + Promise(): void; + + /** + * adds a calendar into Gantt + * @param calendar an object with configuration of the calendar + */ + addCalendar(calendar: any): number; + + /** + * adds a new dependency link + * @param link the link object + */ + addLink(link: any): string|number; + + /** + * displays an additional layer with custom elements for a link in the timeline area + * @param func a render function or a config object + */ + addLinkLayer(func: any): string; + + /** + * adds a marker to the timeline area + * @param marker the marker's configuration object + */ + addMarker(marker: any): string; + + /** + * adds a new keyboard shortcut + * @param shortcut the key name or the name of keys combination for a shortcut (shortcut syntax) + * @param handler the handler of the shortcut call + * @param scope the name of the context element to attach the handler function to (list of scopes) + */ + addShortcut(shortcut: string, handler: GanttCallback, scope: string): void; + + /** + * adds a new task + * @param task the task object + * @param parent optional, optional, the parent's id + * @param index optional, optional, the position the task will be added into (0 or greater) + */ + addTask(task: any, parent?: string|number, index?: number): string|number; + + /** + * displays an additional layer with custom elements for a task in the timeline area + * @param func a render function or a config object + */ + addTaskLayer(func: any): string; + + /** + * calls an alert message box + * @param config the alert box's configuration + */ + alert(config: any): HTMLElement; + + /** + * if the specified expression is false, an errorMessage is shown in the red popup at the top right corner of the screen + * @param expression true to assert the expression, false - if assertion fails + * @param errorMessage an error message that will be shown in the red popup + */ + assert(expression: boolean, errorMessage: string): void; + + /** + * attaches the handler to an inner event of dhtmlxGantt + * @param name the event's name, case-insensitive + * @param handler the handler function + * @param settings optional, an object with settings for the event handler + */ + attachEvent(name: GanttEventName, handler: GanttCallback, settings: any): string; + + /** + * recalculates the schedule of the project + * @param taskId optional, optional, the task id + */ + autoSchedule(taskId?: string|number): void; + + /** + * updates multiple tasks/links at once + * @param callback the callback function + */ + batchUpdate(callback: GanttCallback): void; + + /** + * creates a new function that, when called, has its this keyword set to the provided value + * @param method the target function + * @param thisArg the value to be passed as the this parameter to the target function when the bound function is called + */ + bind(method: GanttCallback, thisArg: any): GanttCallback; + + /** + * calculates the duration of a task + * @param config the configuration object of a time span + */ + calculateDuration(config: any): number; + + /** + * calculates the end date of a task + * @param config the configuration object of a time span + */ + calculateEndDate(config: any): Date; + + /** + * calculates the level of nesting of a task + * @param task the task's object + */ + calculateTaskLevel(task: any): number; + + /** + * calls an inner event + * @param name the event's name, case-insensitive + * @param params an array of the event-related data + */ + callEvent(name: string, params: any[]): boolean; + + /** + * repaints the lighbox for the task according to its type + * @param type the task type + */ + changeLightboxType(type: string): void; + + /** + * changes the link's id + * @param id the current link's id + * @param new_id the new link's id + */ + changeLinkId(id: string|number, new_id: string|number): void; + + /** + * changes the task's id + * @param id the current task's id + * @param new_id the new task's id + */ + changeTaskId(id: string|number, new_id: string|number): void; + + /** + * checks whether an event has some handler(s) specified + * @param name the event's name + */ + checkEvent(name: GanttEventName): boolean; + + /** + * removes all tasks and additional elements (including markers) from the Gantt chart + */ + clearAll(): void; + + /** + * clears the stack of stored redo commands + */ + clearRedoStack(): void; + + /** + * clears the stack of stored undo commands + */ + clearUndoStack(): void; + + /** + * closes the branch with the specified id + * @param id the branch id + */ + close(id: string|number): void; + + /** + * collapses gantt from the full screen mode to the normal mode + */ + collapse(): void; + + /** + * returns the index of the column by the date + * @param date a date object + */ + columnIndexByDate(date: Date): void; + + /** + * calls a confirm message box + * @param config the confirm box's configuration + */ + confirm(config: any): HTMLElement; + + /** + * creates a deep copy of provided object + * @param task the object that needs to be copied + */ + copy(task: any): any; + + /** + * recalculates the task duration in the work time + * @param task the task's object + */ + correctTaskWorkTime(task: any): void; + + /** + * creates a working calendar + * @param parentCalendar optional, (optional) an existing calendar that is used for creating a new one on the base of it + */ + createCalendar(parentCalendar?: any): void; + + /** + * сreates a new dataProcessor instance and attaches it to gantt + * @param config dataProcessor configuration object + */ + createDataProcessor(config: any): any; + + /** + * creates a datastore according to the provided configuration + * @param config a configuration object of a datastore + */ + createDatastore(config: any): void; + + /** + * adds a new task and opens the lightbox to confirm + * @param task the task object + * @param parent the parent's id + * @param index optional, optional, the position the task will be added into (0 or greater) + */ + createTask(task: any, parent: string, index?: number): string|number; + + /** + * dataProcessor constructor + * @param url url to the data feed + */ + dataProcessor(url: string): void; + + /** + * gets the date of the specified horizontal position in the chart area + * @param pos the relative horizontal position you want to know the date of + */ + dateFromPos(pos: number): Date; + + /** + * returns false if the provided argument is undefined, otherwise true + * @param task the object that should be checked + */ + defined(task: any): boolean; + + /** + * deletes a task calendar by its id + * @param id the id of the calendar + */ + deleteCalendar(id: string|number): void; + + /** + * deletes the specified dependency link + * @param id the dependency link's id + */ + deleteLink(id: string|number): void; + + /** + * deletes the specified marker + * @param markerId the marker's id + */ + deleteMarker(markerId: string): void; + + /** + * deletes the specified task + * @param id the task's id + */ + deleteTask(id: string|number): void; + + /** + * destroys the gantt instance + */ + destructor(): void; + + /** + * detaches all events from dhtmlxGantt (both custom and inner ones) + */ + detachAllEvents(): void; + + /** + * detaches a handler from an event (which was attached before by the attachEvent() method) + * @param id the event's id + */ + detachEvent(id: string): void; + + /** + * iterates over all parent tasks of the specified task in the Gantt chart + * @param code a function that will iterate over tasks. Takes a task object as a parameter + * @param startTask the id of the item the parent tasks of which should be iterated over + * @param master optional, the object, that 'this' will refer to + */ + eachParent(code: GanttCallback, startTask: string|number, master?: any): void; + + /** + * iterates over all selected tasks in the Gantt chart + * @param code a function that will iterate over tasks. Takes a task id as a parameter + */ + eachSelectedTask(code: GanttCallback): void; + + /** + * iterates over all child tasks of a specific task or the of whole Gantt chart + * @param code a function that will iterate over tasks. Takes a task object as a parameter + * @param parent optional, the parent id. If specified, the function will iterate over children of the
specified parent + * @param master optional, the object, that 'this' will refer to + */ + eachTask(code: GanttCallback, parent?: string|number, master?: any): void; + + /** + * attaches an event handler to an HTML element + * @param node the HTML node or its id + * @param event the name of an HTML event (without the 'on' prefix) + * @param handler the event handler + * @param options optional, optional, the value of either the useCapture or options parameter. Read details + */ + event(node: HTMLElement|string, event: string, handler: GanttCallback, options?: any): void; + + /** + * removes an event handler from an HTML element + * @param node the HTML node or its id + * @param event the name of an HTML event (without the 'on' prefix) + * @param handler the event handler + * @param options optional, optional, the value of either the useCapture or options parameter. Read details + */ + eventRemove(node: HTMLElement|string, event: string, handler: GanttCallback, options?: any): void; + + /** + * expands gantt to the full screen mode + */ + expand(): void; + + /** + * exports data from the Gantt chart to an Excel document + * @param _export_ an object with export settings (see the details) + */ + exportToExcel(_export_: any): void; + + /** + * exports data from the Gantt chart to an iCal string + * @param _export_ an object with export settings (see the details) + */ + exportToICal(_export_: any): void; + + /** + * exports the structure and data of a Gantt chart into a JSON object + * @param config an object with Gantt configuration + */ + exportToJSON(config: any): void; + + /** + * exports data from the Gantt chart to MS Project + * @param _export_ an object with export settings (see the details) + */ + exportToMSProject(_export_: any): void; + + /** + * exports a Gantt chart into the PDF format + * @param _export_ an object with export settings (see the details) + */ + exportToPDF(_export_: any): void; + + /** + * exports a Gantt chart into the PNG format + * @param _export_ an object with export settings (see the details) + */ + exportToPNG(_export_: any): void; + + /** + * exports data from the Gantt chart to Primavera P6 + * @param _export_ an object with export settings (see the details) + */ + exportToPrimaveraP6(_export_: any): void; + + /** + * returns all dependency loops in the chart + */ + findCycles(): any[]; + + /** + * sets focus on the gantt + */ + focus(): void; + + /** + * gets worktime calendar by id + * @param calendarId the id of the global calendar or "global" + */ + getCalendar(calendarId: string|number): any; + + /** + * gets all the calendars added into Gantt + */ + getCalendars(): any[]; + + /** + * returns the 1st-level child tasks of the specified parent branch + * @param id the parent branch's id + */ + getChildren(id: string|number): any[]; + + /** + * returns the closest working time + * @param config the configuration object + */ + getClosestWorkTime(config: any): Date; + + /** + * returns the index of the column by its name + * @param name the name of the column + */ + getColumnIndex(name: string): number; + + /** + * returns all tasks and links that a task is connected with + * @param id optional, optional, the id of a task + */ + getConnectedGroup(id?: string|number): any; + + /** + * returns the earliest and latest dates allowed by the constraint applied to a task + * @param task a task object + */ + getConstraintLimitations(task: any): void; + + /** + * returns the constraint type applied to the task + * @param task a task object + */ + getConstraintType(task: any): string; + + /** + * returns the configuration object of a datastore + * @param name the name of the datastore + */ + getDatastore(name: string): any; + + /** + * returns the free slack of a task + * @param task the object of a task + */ + getFreeSlack(task: any): number; + + /** + * gets the index of a task in the tree + * @param id the task id + */ + getGlobalTaskIndex(id: string|number): number; + + /** + * gets the configuration object of a column + * @param name the column's name + */ + getGridColumn(name: string): any; + + /** + * gets columns of the Gantt chart + */ + getGridColumns(): any[]; + + /** + * gets the label of a select control in the lightbox + * @param property the name of a data property that the control is mapped to + * @param key the option's id. This parameter is compared with the task's data property to
assign the select's option to the task + */ + getLabel(property: string, key: string|number): string; + + /** + * returns the id of the last selected task + */ + getLastSelectedTask(): string|number; + + /** + * gets the lightbox's HTML object element + */ + getLightbox(): HTMLElement; + + /** + * returns the object of the lightbox's section + * @param name the name of the section + */ + getLightboxSection(name: string): any; + + /** + * returns the name of the active lighbox's structure + */ + getLightboxType(): string; + + /** + * returns values of the lightbox's sections + */ + getLightboxValues(): any; + + /** + * returns the dependency link object by the specified id + * @param id the link id + */ + getLink(id: string|number): any; + + /** + * returns the number of all dependency links presented in the Gantt chart + */ + getLinkCount(): number; + + /** + * returns the HTML element of the specified dependency link + * @param id the link id + */ + getLinkNode(id: string|number): HTMLElement; + + /** + * returns all links presented in the Gantt chart + */ + getLinks(): any[]; + + /** + * gets the marker's object + * @param markerId the marker's id + */ + getMarker(markerId: string): any; + + /** + * returns the id of the next item (no matter what the level of nesting is: the same or different) + * @param id the task id + */ + getNext(id: string|number): string|number; + + /** + * returns the id of the next task of the same level + * @param id the task id + */ + getNextSibling(id: string|number): string|number; + + /** + * returns the id of the parent task + * @param id the task id + */ + getParent(id: string|number): string|number; + + /** + * returns the id of the previous item (no matter what the level of nesting is: the same or different) + * @param id the task id + */ + getPrev(id: string|number): string|number; + + /** + * returns the id of the previous task of the same level + * @param id the task id + */ + getPrevSibling(id: string|number): string|number; + + /** + * returns the stack of stored redo user actions + */ + getRedoStack(): any[]; + + /** + * returns all tasks assigned to the resource + * @param resourceId the id of the resource + */ + getResourceAssignments(resourceId: string|number): any[]; + + /** + * returns a calendar which the resource is assigned to + * @param resource the id or object of the resource + */ + getResourceCalendar(resource: any): any; + + /** + * returns the configuration of the time scale + */ + getScale(): any; + + /** + * returns the scroll position + */ + getScrollState(): any; + + /** + * returns the id of the selected task + */ + getSelectedId(): string; + + /** + * returns an array of the currently selected tasks + */ + getSelectedTasks(): any[]; + + /** + * gets a key navigation shortcut handler + * @param shortcut the key name or the name of keys combination for a shortcut (shortcut syntax) + * @param scope the name of the context element to attach the handler function to (list of scopes) + */ + getShortcutHandler(shortcut: string, scope: string): GanttCallback; + + /** + * returns siblings of the specified task (including itself) + * @param id the task id + */ + getSiblings(id: string|number): any[]; + + /** + * checks how much time (in the current duration unit) a task has before it starts to affect other tasks + * @param task1 the object of the 1st task to check the slack for + * @param task2 the object of the 2nd task to check the slack for + */ + getSlack(task1: any, task2: any): number|string; + + /** + * gets the current state of the Gantt chart + */ + getState(): any; + + /** + * calculates the combined start/end dates of tasks nested in a project or another task + * @param task_id optional, the task's id, api/gantt_root_id_config.md will be used if not specified + */ + getSubtaskDates(task_id?: string|number): any; + + /** + * calculates the combined duration of tasks nested in a project or another task. + * @param task_id optional, the task's id, api/gantt_root_id_config.md will be used if not specified + */ + getSubtaskDuration(task_id?: string|number): number; + + /** + * returns the task object + * @param id the task id + */ + getTask(id: string|number): any; + + /** + * finds a task by the specified criteria + * @param propertyName the name of the property to match, or a filter function + * @param propertyValue the property value + */ + getTaskBy(propertyName: string|GanttCallback, propertyValue: any): any[]; + + /** + * returns a task by its global task index + * @param index the task index in the tree (zero-based numbering) + */ + getTaskByIndex(index: number): any; + + /** + * returns a collection of tasks which occur during the specified period + * @param from optional, the start date of the period + * @param to optional, the end date of the period + */ + getTaskByTime(from?: Date, to?: Date): any[]; + + /** + * returns a task by its WBS code + * @param code the WBS code of the task + */ + getTaskByWBSCode(code: string): any; + + /** + * gets a calendar assigned to the specified task (a task level calendar) + * @param task the id or object of a task + */ + getTaskCalendar(task: any): any; + + /** + * gets the number of tasks that are currently loaded in the gantt + */ + getTaskCount(): number; + + /** + * returns the visible height of a task + */ + getTaskHeight(): number; + + /** + * gets the index of a task in the branch + * @param id the task id + */ + getTaskIndex(id: string|number): number; + + /** + * returns the HTML element of the task bar + * @param id the task id + */ + getTaskNode(id: string|number): HTMLElement; + + /** + * calculates the position and size of the task's DOM element in the timeline area + * @param task the task object + * @param from the start date of the item + * @param to the end date of the item + */ + getTaskPosition(task: any, from: Date, to: Date): any; + + /** + * returns the HTML element of the task row in the table + * @param id the task id + */ + getTaskRowNode(id: string|number): HTMLElement; + + /** + * gets the top position of the task's DOM element in the timeline area + * @param id the task's id + */ + getTaskTop(id: number|string): number; + + /** + * returns the type of a task + * @param task the task object + */ + getTaskType(task: any): string; + + /** + * returns the total slack of a task + * @param task the object of a task + */ + getTotalSlack(task: any): number; + + /** + * returns the stack of stored undo user actions + */ + getUndoStack(): any[]; + + /** + * gets the number of tasks visible on the screen (those that are not collapsed) + */ + getVisibleTaskCount(): number; + + /** + * returns the WBS code (the outline number) of a task + * @param task the object of a task + */ + getWBSCode(task: any): string; + + /** + * returns the working hours of the specified date + * @param date a date to check + */ + getWorkHours(date: Date): any[]; + + /** + * groups tasks by the specified task's attribute + * @param config the grouping configuration object, or false to ungroup tasks + */ + groupBy(config: any): void; + + /** + * checks whether the specified item has child tasks + * @param id the task id + */ + hasChild(id: string|number): boolean; + + /** + * hides the lightbox modal overlay that blocks interactions with the remaining screen + * @param box optional, an element to hide + */ + hideCover(box?: HTMLElement): void; + + /** + * closes the lightbox if it's currently active + */ + hideLightbox(): void; + + /** + * hides the pop-up task form (if it's currently active) + */ + hideQuickInfo(): void; + + /** + * converts an Excel file to JSON + * @param config an object with configuration properties of an imported file + */ + importFromExcel(config: any): void; + + /** + * converts an XML or MPP MS Project file to JSON + * @param config an object with configuration properties of an imported file + */ + importFromMSProject(config: any): void; + + /** + * converts an XML or XAR Primavera P6 file to JSON + * @param config an object with configuration properties of an imported file + */ + importFromPrimaveraP6(config: any): void; + + /** + * initializes a dhtmlxGantt inside a container + * @param container an HTML container (or its id) where a dhtmlxGantt object will be initialized + * @param from optional, the start value of the time scale (X–Axis) + * @param to optional, the end value of the time scale (X–Axis) + */ + init(container: string|HTMLElement, from?: Date, to?: Date): void; + + /** + * checks whether a task is a child of a different task + * @param childId the id of a task that you want to check as a child + * @param parentId the id of a task that you want to check as a parent + */ + isChildOf(childId: string|number, parentId: string|number): boolean; + + /** + * checks whether the link is circular + * @param link the link object + */ + isCircularLink(link: any): boolean; + + /** + * checks whether the specified link is critical + * @param link the link's object + */ + isCriticalLink(link: any): boolean; + + /** + * checks whether the specified task is critical + * @param task the task's object + */ + isCriticalTask(task: any): boolean; + + /** + * checks whether the specified link is correct + * @param link the link object + */ + isLinkAllowed(link: any): boolean; + + /** + * checks whether the specified link exists + * @param id the link id + */ + isLinkExists(id: string|number): boolean; + + /** + * checks whether the specified task or link is read-only + * @param id the task/link id + */ + isReadonly(id: string|number): boolean; + + /** + * checks whether the specified task is currently selected + * @param task the task's id + */ + isSelectedTask(task: string|number): boolean; + + /** + * checks whether the specified task is split + * @param task the object of a task + */ + isSplitTask(task: any): boolean; + + /** + * checks whether the specified task is summary + * @param task the object of a task + */ + isSummaryTask(task: any): boolean; + + /** + * checks whether the specified task exists + * @param id the task id + */ + isTaskExists(id: string|number): boolean; + + /** + * checks whether the specifies task is currently rendered in the Gantt chart + * @param id the task's id + */ + isTaskVisible(id: string|number): boolean; + + /** + * checks if the task is unscheduled + * @param task the task's object + */ + isUnscheduledTask(task: any): boolean; + + /** + * checks whether the specified date is working or not + * @param config the configuration object of a time span + */ + isWorkTime(config: any): boolean; + + /** + * loads data to the gantt from an external data source + * @param url the server-side url (may be a static file or a server side script that outputs data) + * @param type optional, ('json', 'xml', 'oldxml') the data type. The default value - 'json' + * @param callback optional, the callback function + */ + load(url: string, type?: string, callback?: GanttCallback): any; + + /** + * gets the id of a task from the specified HTML event + * @param e a native event + */ + locate(e: Event): string|number; + + /** + * merges several working calendars into one + * @param calendars an array of calendars' objects + */ + mergeCalendars(calendars: any[]): void; + + /** + * calls a message box of the specified type + * @param config the message box's configuration + */ + message(config: any): HTMLElement; + + /** + * adds properties of the 'source' object into the 'target' object + * @param target the target object + * @param source the source object + * @param force if true, properties of the 'source' will overwrite matching properties of the 'target', if there are any. If false, properties that already exist in the 'target' will be omitted + */ + mixin(target: any, source: any, force: boolean): void; + + /** + * calls a modalbox + * @param config the modal box's configuration + */ + modalbox(config: any): HTMLElement; + + /** + * moves a task to a new position + * @param sid the id of the task to move + * @param tindex the index of the position that the task will be moved to
(the index within a branch) + * @param parent optional, the parent id. If specified, the tindex will refer to the index in the
'parent' branch + */ + moveTask(sid: string|number, tindex: number, parent?: string|number): boolean; + + /** + * opens the branch with the specified id + * @param id the branch id + */ + open(id: string|number): void; + + /** + * loads data from a client-side resource + * @param url a string or object which represents data + * @param type optional, optional, ('json', 'xml') the data type. The default value - 'json' + */ + parse(url: any, type?: string): void; + + /** + * activates specified extensions + * @param ext extensions that need to be activated + */ + plugins(ext: any): void; + + /** + * gets the relative horizontal position of the specified date in the chart area + * @param date a date you want to know the position of + */ + posFromDate(date: Date): number; + + /** + * applies the reverted changes to the gantt once again + */ + redo(): void; + + /** + * refreshes data in the Gantt chart + */ + refreshData(): void; + + /** + * refreshes the specifies link + * @param id the link id + */ + refreshLink(id: string|number): void; + + /** + * refreshes the task and its related links + * @param id the task id + * @param refresh_links optional, optional, defines whether links related to the task should be refreshed, true by default + */ + refreshTask(id: string|number, refresh_links?: boolean): void; + + /** + * removes the specified layer related to a link + * @param layerId a DOM element that will be displayed in the layer + */ + removeLinkLayer(layerId: string): void; + + /** + * removes a keyboard shortcut + * @param shortcut the key name or the name of keys combination for a shortcut (shortcut syntax) + * @param scope the element to which the shortcut is attached (list of scopes) + */ + removeShortcut(shortcut: string, scope: any): void; + + /** + * removes the specified layer related to a task + * @param layerId a DOM element that will be displayed in the layer + */ + removeTaskLayer(layerId: string): void; + + /** + * renders the whole Gantt chart + */ + render(): void; + + /** + * updates all markers on the page + */ + renderMarkers(): void; + + /** + * rebuilds the Gantt layout using the current value of the layout config + */ + resetLayout(): void; + + /** + * removes the current lightbox's HTML object element + */ + resetLightbox(): void; + + /** + * re-calculates the duration of a project task depending on the dates of its children + * @param task the task's object + */ + resetProjectDates(task: any): void; + + /** + * re-calculates the skin's settings from the related attached skin CSS file + */ + resetSkin(): void; + + /** + * forces the lightbox to resize + */ + resizeLightbox(): void; + + /** + * rounds the specified date to the nearest date in the time scale + * @param date the Date object to round + */ + roundDate(date: Date): Date; + + /** + * rounds the start and end task's dates to the nearest dates in the time scale + * @param task the task object + */ + roundTaskDates(task: any): void; + + /** + * scrolls the Gantt container to the specified position + * @param x value of horizontal scroll or 'null' (if the scroll position shouldn't be changed) + * @param y value of vertical scroll or 'null' (if the scroll position shouldn't be changed) + */ + scrollTo(x: number|null, y: number|null): void; + + /** + * selects the specified task + * @param id the task id + */ + selectTask(id: string|number): string|number; + + /** + * serializes the data into JSON or XML format + * @param type optional, the format that the data will be serialized into.
Possible values: 'json' (default ), 'xml'. + */ + serialize(type?: string): any; + + /** + * returns a list of options + * @param list_name the name of a list + * @param options optional, an array of options + */ + serverList(list_name: string, options?: any[]): any[]; + + /** + * set the parent for a task + * @param task the task id + * @param pid the parent task id + */ + setParent(task: number|string, pid: number|string): void; + + /** + * resizes the Gantt chart + */ + setSizes(): void; + + /** + * sets the working time for the Gantt chart + * @param config the configuration object of a time span + */ + setWorkTime(config: any): void; + + /** + * shows the lightbox modal overlay that blocks interactions with the remaining screen + * @param box optional, an element to hide + */ + showCover(box?: HTMLElement): void; + + /** + * scrolls the chart area to makes the specified date visible + * @param date the date to show in the chart + */ + showDate(date: Date): void; + + /** + * opens the lightbox for the specified task + * @param id the task id + */ + showLightbox(id: string|number): void; + + /** + * displays the pop-up task form for the specified task + * @param id the task id + */ + showQuickInfo(id: string|number): void; + + /** + * makes the specified task visible on the screen + * @param id the task id + */ + showTask(id: string|number): void; + + /** + * sorts tasks in the grid + * @param field the name of the column that the grid will be sorted by or a custom sorting function + * @param desc optional, specifies the sorting direction: true - descending sort and false - ascending
sort. By default, false + * @param parent optional, the id of the parent task. Specify the parameter if you want to sort tasks only in the branch of the specified parent. + * @param silent optional, specifies whether rendering should be invoked after reordering items + */ + sort(field: string|GanttCallback, desc?: boolean, parent?: string|number, silent?: boolean): void; + + /** + * selects the specified task if it was unselected and vice versa + * @param task the task's id + */ + toggleTaskSelection(task: string|number): void; + + /** + * returns a unique id + */ + uid(): number; + + /** + * reverts the changes made in the gantt + */ + undo(): void; + + /** + * removes selection from the selected task + * @param id optional, optional, the id of the task to remove selection from, see details + */ + unselectTask(id?: string|number): void; + + /** + * unsets a working time in the Gantt Chart + * @param config the configuration object of a time span + */ + unsetWorkTime(config: any): void; + + /** + * updates the specified collection with new options + * @param collection the name of the collection to update + * @param options the new values of the collection + */ + updateCollection(collection: string, options: any[]): boolean; + + /** + * updates the specified dependency link + * @param id the task id + */ + updateLink(id: string): void; + + /** + * updates the specified marker + * @param markerId the marker's id + */ + updateMarker(markerId: string): void; + + /** + * updates the specified task + * @param id the task id + */ + updateTask(id: string): void; +} + +declare var gantt: GanttStatic; + +declare var Gantt: GanttEnterprise; + +export {gantt, Gantt}; \ No newline at end of file diff --git a/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.js b/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.js new file mode 100644 index 000000000..a778ce513 --- /dev/null +++ b/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.js @@ -0,0 +1,14 @@ +/* +@license + +dhtmlxGantt v.7.0.1 Standard + +This version of dhtmlxGantt is distributed under GPL 2.0 license and can be legally used in GPL projects. + +To use dhtmlxGantt in non-GPL projects (and get Pro version of the product), please obtain Commercial/Enterprise or Ultimate license on our site https://dhtmlx.com/docs/products/dhtmlxGantt/#licensing or contact us at sales@dhtmlx.com + +(c) XB Software Ltd. + +*/ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("dhtmlxgantt",[],e):"object"==typeof exports?exports.dhtmlxgantt=e():t.dhtmlxgantt=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/codebase/",n(n.s=242)}([function(t,e,n){var i,r=n(3);t.exports={copy:function t(e){var n,i;if(e&&"object"==typeof e)switch(!0){case r.isDate(e):i=new Date(e);break;case r.isArray(e):for(i=new Array(e.length),n=0;n=0}function a(t){return!{a:!0,area:!0}[t.nodeName.loLowerCase()]||!!t.getAttribute("href")}function o(t){return!{input:!0,select:!0,textarea:!0,button:!0,object:!0}[t.nodeName.toLowerCase()]||!t.hasAttribute("disabled")}function s(t){if(!t)return"";var e=t.className||"";return e.baseVal&&(e=e.baseVal),e.indexOf||(e=""),u(e)}var l;function c(t){return t.tagName?t:(t=t||window.event).target||t.srcElement}function u(t){return(String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")}).apply(t)}t.exports={getNodePosition:n,getFocusableNodes:function(t){for(var e=t.querySelectorAll(["a[href]","area[href]","input","select","textarea","button","iframe","object","embed","[tabindex]","[contenteditable]"].join(", ")),n=Array.prototype.slice.call(e,0),s=0;s=0){if(!n)return i;var o=0===a||!u(r.charAt(a-1)),l=a+e.length>=r.length||!u(r.charAt(a+e.length));if(o&&l)return i}}i=i.parentNode}return null},locateAttribute:function(t,e){if(e){for(var n=c(t);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}},getTargetNode:c,getRelativeEventPosition:function(t,e){var i=document.documentElement,r=n(e);return{x:t.clientX+i.scrollLeft-i.clientLeft-r.x+e.scrollLeft,y:t.clientY+i.scrollTop-i.clientTop-r.y+e.scrollTop}},isChildOf:function(t,e){if(!t||!e)return!1;for(;t&&t!=e;)t=t.parentNode;return t===e},hasClass:function(t,e){return"classList"in t?t.classList.contains(e):new RegExp("\\b"+e+"\\b").test(t.className)},closest:function(t,e){if(t.closest)return t.closest(e);if(t.matches||t.msMatchesSelector||t.webkitMatchesSelector){var n=t;if(!document.documentElement.contains(n))return null;do{if((n.matches||n.msMatchesSelector||n.webkitMatchesSelector).call(n,e))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null}return console.error("Your browser is not supported"),null}}},function(t,e){t.exports=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function i(){this.constructor=t}t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}},function(t,e){var n={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,quarter:7776e3,year:31536e3};function i(t){return!(!t||"object"!=typeof t)&&!!(t.getFullYear&&t.getMonth&&t.getDate)}function r(t,e){var n=[];if(t.filter)return t.filter(e);for(var i=0;i=0||navigator.userAgent.indexOf("Trident")>=0),isIE6:n&&!XMLHttpRequest&&navigator.userAgent.indexOf("MSIE")>=0,isIE7:n&&navigator.userAgent.indexOf("MSIE 7.0")>=0&&navigator.userAgent.indexOf("Trident")<0,isIE8:n&&navigator.userAgent.indexOf("MSIE 8.0")>=0&&navigator.userAgent.indexOf("Trident")>=0,isOpera:n&&navigator.userAgent.indexOf("Opera")>=0,isChrome:n&&navigator.userAgent.indexOf("Chrome")>=0,isKHTML:n&&(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0),isFF:n&&navigator.userAgent.indexOf("Firefox")>=0,isIPad:n&&navigator.userAgent.search(/iPad/gi)>=0,isEdge:n&&-1!=navigator.userAgent.indexOf("Edge"),isNode:!n||"undefined"==typeof navigator};t.exports=i},function(t,e,n){var i=n(0),r=n(4),a=n(1),o=function(){"use strict";function t(t,e,n,o){t&&(this.$container=a.toNode(t),this.$parent=t),this.$config=i.mixin(e,{headerHeight:33}),this.$gantt=o,this.$domEvents=o._createDomEventScope(),this.$id=e.id||"c"+i.uid(),this.$name="cell",this.$factory=n,r(this)}return t.prototype.destructor=function(){this.$parent=this.$container=this.$view=null,this.$gantt.$services.getService("mouseEvents").detach("click","gantt_header_arrow",this._headerClickHandler),this.$domEvents.detachAll(),this.callEvent("onDestroy",[]),this.detachAllEvents()},t.prototype.cell=function(t){return null},t.prototype.scrollTo=function(t,e){1*t==t&&(this.$view.scrollLeft=t),1*e==e&&(this.$view.scrollTop=e)},t.prototype.clear=function(){this.getNode().innerHTML="",this.getNode().className="gantt_layout_content",this.getNode().style.padding="0"},t.prototype.resize=function(t){if(this.$parent)return this.$parent.resize(t);!1===t&&(this.$preResize=!0);var e=this.$container,n=e.offsetWidth,i=e.offsetHeight,r=this.getSize();e===document.body&&(n=document.body.offsetWidth,i=document.body.offsetHeight),nr.maxWidth&&(n=r.maxWidth),ir.maxHeight&&(i=r.maxHeight),this.setSize(n,i),this.$preResize,this.$preResize=!1},t.prototype.hide=function(){this._hide(!0),this.resize()},t.prototype.show=function(t){this._hide(!1),t&&this.$parent&&this.$parent.show(),this.resize()},t.prototype._hide=function(t){if(!0===t&&this.$view.parentNode)this.$view.parentNode.removeChild(this.$view);else if(!1===t&&!this.$view.parentNode){var e=this.$parent.cellIndex(this.$id);this.$parent.moveView(this,e)}this.$config.hidden=t},t.prototype.$toHTML=function(t,e){void 0===t&&(t=""),e=[e||"",this.$config.css||""].join(" ");var n=this.$config,i="";n.raw?t="string"==typeof n.raw?n.raw:"":(t||(t="
"+(n.html||"")+"
"),n.header&&(i="
"+(n.canCollapse?"
":"")+"
"+n.header+"
"));return"
"+i+t+"
"},t.prototype.$fill=function(t,e){this.$view=t,this.$parent=e,this.init()},t.prototype.getNode=function(){return this.$view.querySelector("gantt_layout_cell")||this.$view},t.prototype.init=function(){var t=this;this._headerClickHandler=function(e){a.locateAttribute(e,"data-cell-id")==t.$id&&t.toggle()},this.$gantt.$services.getService("mouseEvents").delegate("click","gantt_header_arrow",this._headerClickHandler),this.callEvent("onReady",[])},t.prototype.toggle=function(){this.$config.collapsed=!this.$config.collapsed,this.resize()},t.prototype.getSize=function(){var t={height:this.$config.height||0,width:this.$config.width||0,gravity:this.$config.gravity||1,minHeight:this.$config.minHeight||0,minWidth:this.$config.minWidth||0,maxHeight:this.$config.maxHeight||1e5,maxWidth:this.$config.maxWidth||1e5};if(this.$config.collapsed){var e="x"===this.$config.mode;t[e?"width":"height"]=t[e?"maxWidth":"maxHeight"]=this.$config.headerHeight}return t},t.prototype.getContentSize=function(){var t=this.$lastSize.contentX;t!==1*t&&(t=this.$lastSize.width);var e=this.$lastSize.contentY;return e!==1*e&&(e=this.$lastSize.height),{width:t,height:e}},t.prototype._getBorderSizes=function(){var t={top:0,right:0,bottom:0,left:0,horizontal:0,vertical:0};return this._currentBorders&&(this._currentBorders[this._borders.left]&&(t.left=1,t.horizontal++),this._currentBorders[this._borders.right]&&(t.right=1,t.horizontal++),this._currentBorders[this._borders.top]&&(t.top=1,t.vertical++),this._currentBorders[this._borders.bottom]&&(t.bottom=1,t.vertical++)),t},t.prototype.setSize=function(t,e){this.$view.style.width=t+"px",this.$view.style.height=e+"px";var n=this._getBorderSizes(),i=e-n.vertical,r=t-n.horizontal;this.$lastSize={x:t,y:e,contentX:r,contentY:i},this.$config.header?this._sizeHeader():this._sizeContent()},t.prototype._borders={left:"gantt_layout_cell_border_left",right:"gantt_layout_cell_border_right",top:"gantt_layout_cell_border_top",bottom:"gantt_layout_cell_border_bottom"},t.prototype._setBorders=function(t,e){e||(e=this);var n=e.$view;for(var i in this._borders)a.removeClassName(n,this._borders[i]);"string"==typeof t&&(t=[t]);var r={};for(i=0;i";return e+=r.getHtmlSelect(t.options,[{key:"style",value:"width:100%;"}]),e+=""},a.prototype.set_value=function(t,e,n,i){var r=t.firstChild;!r._dhx_onchange&&i.onchange&&(r.onchange=i.onchange,r._dhx_onchange=!0),void 0===e&&(e=(r.options[0]||{}).value),r.value=e||""},a.prototype.get_value=function(t){return t.firstChild.value},a.prototype.focus=function(e){var n=e.firstChild;t._focus(n,!0)},a}},function(t,e){t.exports=function(t){return t.config.smart_rendering&&t._smart_render}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:e,t.exports=n}).call(this,n(13))},function(t,e,n){var i=n(0);t.exports={createDropTargetObject:function(t){var e={targetParent:null,targetIndex:0,targetId:null,child:!1,nextSibling:!1,prevSibling:!1};return t&&i.mixin(e,t,!0),e},nextSiblingTarget:function(t,e,n){var i=this.createDropTargetObject();return i.targetId=e,i.nextSibling=!0,i.targetParent=n.getParent(i.targetId),i.targetIndex=n.getBranchIndex(i.targetId),(n.getParent(t)!=i.targetParent||i.targetIndexn.getBranchIndex(t)&&(i.targetIndex-=1),i},firstChildTarget:function(t,e,n){var i=this.createDropTargetObject();return i.targetId=e,i.targetParent=i.targetId,i.targetIndex=0,i.child=!0,i},lastChildTarget:function(t,e,n){var i=n.getChildren(e),r=this.createDropTargetObject();return r.targetId=i[i.length-1],r.targetParent=e,r.targetIndex=i.length,r.nextSibling=!0,r}}},function(t,e,n){var i=n(12);t.exports=function(t,e,n,r){var a=e.width[t];if(a<=0)return!1;if(!r.config.smart_rendering||i(r))return!0;var o=e.left[t]-a,s=e.left[t]+a;return o<=n.x_end&&s>=n.x}},function(t,e){t.exports=function(t,e){var n=0,i=t.left.length-1;if(e)for(var r=0;re.x_end){i=r;break}}return{start:n,end:i}}},function(t,e){t.exports=function(t,e){var n=e.$getConfig();return{top:e.getItemTop(t.id),height:n.row_height,left:0,right:1/0}}},function(t,e,n){var i=n(22),r=n(4),a=n(0),o=n(32),s=n(100),l=function(t,e,n,s){this.$config=a.mixin({},e||{}),this.$scaleHelper=new i(s),this.$gantt=s,this._posFromDateCache={},this._timelineDragScroll=null,a.mixin(this,o()),r(this)};function c(t,e){for(var n,i,r,a=0,o=t.length-1;a<=o;)if(i=+t[n=Math.floor((a+o)/2)],r=+t[n-1],ie)){for(;+t[n]==+t[n+1];)n++;return n}if(!isNaN(r)&&r",this.$task=t.childNodes[0],this.$task.innerHTML="
",this.$task_scale=this.$task.childNodes[0],this.$task_data=this.$task.childNodes[1],this.$task_data.innerHTML="
",this.$task_bg=this.$task_data.childNodes[0],this.$task_links=this.$task_data.childNodes[1],this.$task_bars=this.$task_data.childNodes[2],this._tasks={col_width:0,width:[],full_width:0,trace_x:[],rendered:{}};var e=this.$getConfig(),n=e[this.$config.bind+"_attribute"],i=e[this.$config.bindLinks+"_attribute"];!n&&this.$config.bind&&(n="data-"+this.$config.bind+"-id"),!i&&this.$config.bindLinks&&(i="data-"+this.$config.bindLinks+"-id"),this.$config.item_attribute=n||null,this.$config.link_attribute=i||null;var r=this._createLayerConfig();this.$config.layers||(this.$config.layers=r.tasks),this.$config.linkLayers||(this.$config.linkLayers=r.links),this._attachLayers(this.$gantt),this.callEvent("onReady",[]),this.$gantt.ext.dragTimeline&&(this._timelineDragScroll=this.$gantt.ext.dragTimeline.create(),this._timelineDragScroll.attach(this))},setSize:function(t,e){var n=this.$getConfig();if(1*t===t&&(this.$config.width=t),1*e===e){this.$config.height=e;var i=Math.max(this.$config.height-n.scale_height);this.$task_data.style.height=i+"px"}if(this.refresh(),this.$task_bg.style.backgroundImage="",n.smart_rendering&&this.$config.rowStore){var r=this.$config.rowStore;this.$task_bg.style.height=n.row_height*r.countVisible()+"px"}else this.$task_bg.style.height="";for(var a=this._tasks,o=this.$task_data.childNodes,s=0,l=o.length;s'+this._prepareScaleHtml(t[a],e,n)+"")}return i.join("")},_prepareScaleHtml:function(t,e,n){var i=this.$getConfig(),r=this.$gantt.templates,a=[],o=null,s=null,l=t.format||t.template||t.date;"string"==typeof l&&(l=this.$gantt.date.date_to_str(l));var u=0,d=t.count;!i.smart_scales||isNaN(e)||isNaN(n)||(u=c(t.left,e),d=c(t.left,n)+1),s=t.css||function(){},!t.css&&i.inherit_scale_class&&(s=r.scale_cell_class);for(var h=u;h"+f+"";a.push(k)}}return a.join("")},dateFromPos:function(t){var e=this._tasks;if(t<0||t>e.full_width||!e.full_width)return null;var n=c(this._tasks.left,t),i=this._tasks.left[n],r=e.width[n]||e.col_width,a=0;r&&(a=(t-i)/r,e.rtl&&(a=1-a));var o=0;return a&&(o=this._getColumnDuration(e,e.trace_x[n])),new Date(e.trace_x[n].valueOf()+Math.round(a*o))},posFromDate:function(t){if(!this.isVisible())return 0;if(!t)return 0;var e=String(t.valueOf());if(void 0!==this._posFromDateCache[e])return this._posFromDateCache[e];var n=this.columnIndexByDate(t);this.$gantt.assert(n>=0,"Invalid day index");var i=Math.floor(n),r=n%1,a=this._tasks.left[Math.min(i,this._tasks.width.length-1)];i==this._tasks.width.length&&(a+=this._tasks.width[this._tasks.width.length-1]),r&&(i=r.max_date)return this._tasks.rtl?0:n.length;var a=c(n,e),o=this._getClosestVisibleColumn(a,n,i),s=n[o],l=this._tasks.trace_index_transition;if(!s)return l?l[0]:0;var u=(t-n[o])/this._getColumnDuration(this._tasks,n[o]);return l?l[o]+(1-u):o+u},getItemPosition:function(t,e,n){var i,r,a;return this._tasks.rtl?(r=this.posFromDate(e||t.start_date),i=this.posFromDate(n||t.end_date)):(i=this.posFromDate(e||t.start_date),r=this.posFromDate(n||t.end_date)),a=Math.max(r-i,0),{left:i,top:this.getItemTop(t.id),height:this.getItemHeight(),width:a}},getItemHeight:function(){var t=this.$getConfig(),e=t.task_height;if("full"==e){var n=t.task_height_offset||5;e=t.row_height-n}return e=Math.min(e,t.row_height),Math.max(e,0)},getScale:function(){return this._tasks},_getScales:function(){var t=this.$getConfig(),e=this.$scaleHelper,n=[e.primaryScale(t)].concat(e.getSubScales(t));return e.sortScales(n),n},_getColumnDuration:function(t,e){return this.$gantt.date.add(e,t.step,t.unit)-e},_bindStore:function(){if(this.$config.bind){var t=this.$gantt.getDatastore(this.$config.bind);if(this.$config.rowStore=t,t&&!t._timelineCacheAttached){var e=this;t._timelineCacheAttached=t.attachEvent("onBeforeFilter",function(){e._resetTopPositionHeight()})}}},_unbindStore:function(){if(this.$config.bind){var t=this.$gantt.getDatastore(this.$config.bind);t._timelineCacheAttached&&(t.detachEvent(t._timelineCacheAttached),t._timelineCacheAttached=!1)}},refresh:function(){this._bindStore(),this.$config.bindLinks&&(this.$config.linkStore=this.$gantt.getDatastore(this.$config.bindLinks)),this._resetTopPositionHeight(),this._initStaticBackgroundRender(),this._render_tasks_scales()},destructor:function(){var t=this.$gantt;this._clearLayers(t),this._unbindStore(),this.$task=null,this.$task_scale=null,this.$task_data=null,this.$task_bg=null,this.$task_links=null,this.$task_bars=null,this.$gantt=null,this.$config.rowStore&&(this.$config.rowStore.detachEvent(this._staticBgHandler),this.$config.rowStore=null),this.$config.linkStore&&(this.$config.linkStore=null),this._timelineDragScroll&&(this._timelineDragScroll.destructor(),this._timelineDragScroll=null),this.callEvent("onDestroy",[]),this.detachAllEvents()}},t.exports=l},function(t,e){t.exports=function(t){var e=[];return{delegate:function(n,i,r,a){e.push([n,i,r,a]),t.$services.getService("mouseEvents").delegate(n,i,r,a)},destructor:function(){for(var n=t.$services.getService("mouseEvents"),i=0;i",this.$grid=t.childNodes[0],this.$grid.innerHTML="
",this.$grid_scale=this.$grid.childNodes[0],this.$grid_data=this.$grid.childNodes[1];var c=a[this.$config.bind+"_attribute"];if(!c&&this.$config.bind&&(c="data-"+this.$config.bind+"-id"),this.$config.item_attribute=c||null,!this.$config.layers){var u=this._createLayerConfig();this.$config.layers=u}var d=o(e,this);d.init(),this._renderHeaderResizers=d.doOnRender,this._mouseDelegates=n(20)(e),this._addLayers(this.$gantt),this._initEvents(),s&&(this._columnDND=new l(e,this),this._columnDND.init()),this.callEvent("onReady",[])},_validateColumnWidth:function(t,e){var n=t[e];if(n&&"*"!=n){var i=this.$gantt,r=1*n;isNaN(r)?i.assert(!1,"Wrong "+e+" value of column "+t.name):t[e]=r}},setSize:function(t,e){this.$config.width=this.$state.width=t,this.$config.height=this.$state.height=e;for(var n,i=this.getGridColumns(),r=0,a=(u=this.$getConfig()).grid_elastic_columns,o=0,s=i.length;ou.max_width&&(d=u.max_width-u.width),r-=u.width,u.width+=d,l-=d}for(var h=l>0?1:-1;l>0&&1===h||l<0&&-1===h;){var f=l;for(o=e+1;o-1&&((_=i[e].width+l)==this._getColumnWidth(i[e],n,_)&&(i[e].width=_));return this._getColsTotalWidth()},_getColsTotalWidth:function(){for(var t=this.getGridColumns(),e=0,n=0;no+h&&(d.width=h=f-o),o+=h;var _=t._sort&&d.name==t._sort.name?"
":"",g=["gantt_grid_head_cell","gantt_grid_head_"+d.name,u?"gantt_last_cell":"",i.grid_header_class(d.name,d)].join(" "),p="width:"+(h-(u?1:0))+"px;",v=d.label||s["column_"+d.name]||s[d.name];v=v||"";var m="
"+v+_+"
";a.push(m)}this.$grid_scale.style.height=e.scale_height+"px",this.$grid_scale.style.lineHeight=l+"px",this.$grid_scale.innerHTML=a.join(""),this._renderHeaderResizers&&this._renderHeaderResizers()},_getGridWidth:function(){return this.$config.width},destructor:function(){this._clearLayers(this.$gantt),this._mouseDelegates&&(this._mouseDelegates.destructor(),this._mouseDelegates=null),this._unbindStore(),this.$grid=null,this.$grid_scale=null,this.$grid_data=null,this.$gantt=null,this.$config.rowStore&&(this.$config.rowStore.detachEvent(this._staticBgHandler),this.$config.rowStore=null),this.callEvent("onDestroy",[]),this.detachAllEvents()}},t.exports=c},function(t,e,n){var i=n(0);t.exports=function(t){var e=t.date,n=t.$services;return{getSum:function(t,e,n){void 0===n&&(n=t.length-1),void 0===e&&(e=0);for(var i=0,r=e;r<=n;r++)i+=t[r];return i},setSumWidth:function(t,e,n,i){var r=e.width;void 0===i&&(i=r.length-1),void 0===n&&(n=0);var a=i-n+1;if(!(n>r.length-1||a<=0||i>r.length-1)){var o=t-this.getSum(r,n,i);this.adjustSize(o,r,n,i),this.adjustSize(-o,r,i+1),e.full_width=this.getSum(r)}},splitSize:function(t,e){for(var n=[],i=0;in(e.unit,e.step)?-1:0});for(var i=0;i=0;u--){var d=u==t.length-1,h=this.initScaleConfig(t[u],r,a);d&&this.processIgnores(h),this.initColSizes(h,e,l,s[u]),this.limitVisibleRange(h),d&&(l=h.full_width),c.unshift(h)}for(u=0;u=+l&&(l=e.add(c,i,n));+c<+l;){o.call(this,new Date(c));var u=c.getTimezoneOffset();c=e.add(c,i,n),c=t._correct_dst_change(c,u,i,n),e[n+"_start"]&&(c=e[n+"_start"](c))}},limitVisibleRange:function(t){var n=t.trace_x,i=t.width.length-1,r=0;if(+n[0]<+t.min_date&&0!=i){var a=Math.floor(t.width[0]*((n[1]-t.min_date)/(n[1]-n[0])));r+=t.width[0]-a,t.width[0]=a,n[0]=new Date(t.min_date)}var o=n.length-1,s=n[o],l=e.add(s,t.step,t.unit);if(+l>+t.max_date&&o>0&&(a=t.width[o]-Math.floor(t.width[o]*((l-t.max_date)/(l-s))),r+=t.width[o]-a,t.width[o]=a),r){for(var c=this.getSum(t.width),u=0,d=0;d"}};function a(t,e,n){return e=e||[],"<"+t+o(n||[])+">"+(e.innerHTML||"")+""}function o(t){var e="";return i.forEach(t,function(t){e+=" "+t.key+"='"+t.value+"'"}),e}t.exports=r},function(t,e){t.exports=function(t){var e={};return t.$data.tasksStore.attachEvent("onStoreUpdated",function(){e={}}),function(n,i,r,a){var o=n.id+"_"+i+"_"+r.unit+"_"+r.step;return e[o]?e[o]:e[o]=function(e,n,i,r){g="task"==e.$role?[]:t.getTaskBy(n,e.id);for(var a=i.unit,o=i.step,s={},l=0;l1&&(d+=1),u==s.types.milestone&&(o.left-=Math.round(c/2),o.width=c);var h=document.createElement("div"),f=Math.round(o.width);a.$config.item_attribute&&(h.setAttribute(a.$config.item_attribute,e.id),h.setAttribute(a.$config.bind+"_id",e.id)),s.show_progress&&u!=s.types.milestone&&function(e,n,i,r,a){var o=1*e.progress||0;i=Math.max(i-2,0);var s=document.createElement("div"),l=Math.round(i*o);l=Math.min(i,l),e.progressColor&&(s.style.backgroundColor=e.progressColor,s.style.opacity=1),s.style.width=l+"px",s.className="gantt_task_progress",s.innerHTML=a.progress_text(e.start_date,e.end_date,e),r.rtl&&(s.style.position="absolute",s.style.right="0px");var c=document.createElement("div");if(c.className="gantt_task_progress_wrapper",c.appendChild(s),n.appendChild(c),t.config.drag_progress&&!t.isReadonly(e)){var u=document.createElement("div"),d=l;r.rtl&&(d=i-l),u.style.left=d+"px",u.className="gantt_task_progress_drag",s.appendChild(u),n.appendChild(u)}}(e,h,f,s,l);var _=function(e,n,i){var r=document.createElement("div");return t.getTaskType(e.type)!=t.config.types.milestone&&(r.innerHTML=i.task_text(e.start_date,e.end_date,e)),r.className="gantt_task_content",r}(e,0,l);e.textColor&&(_.style.color=e.textColor),h.appendChild(_);var g=function(e,n,i,r){var a=r.$getConfig(),o=[e];n&&o.push(n);var s=t.getState(),l=t.getTask(i);if(t.getTaskType(l.type)==a.types.milestone?o.push("gantt_milestone"):t.getTaskType(l.type)==a.types.project&&o.push("gantt_project"),o.push("gantt_bar_"+t.getTaskType(l.type)),t.isSummaryTask(l)&&o.push("gantt_dependent_task"),t.isSplitTask(l)&&(a.open_split_tasks&&!l.$open||!a.open_split_tasks)&&o.push("gantt_split_parent"),a.select_task&&t.isSelectedTask(i)&&o.push("gantt_selected"),i==s.drag_id&&(o.push("gantt_drag_"+s.drag_mode),s.touch_drag&&o.push("gantt_touch_"+s.drag_mode)),s.link_source_id==i&&o.push("gantt_link_source"),s.link_target_id==i&&o.push("gantt_link_target"),a.highlight_critical_path&&t.isCriticalTask&&t.isCriticalTask(l)&&o.push("gantt_critical_task"),s.link_landing_area&&s.link_target_id&&s.link_source_id&&s.link_target_id!=s.link_source_id){var c=s.link_source_id,u=s.link_from_start,d=s.link_to_start,h=t.isLinkAllowed(c,i,u,d),f="";f=h?d?"link_start_allow":"link_finish_allow":d?"link_start_deny":"link_finish_deny",o.push(f)}return o.join(" ")}("gantt_task_line",l.task_class(e.start_date,e.end_date,e),e.id,a);(e.color||e.progressColor||e.textColor)&&(g+=" gantt_task_inline_color"),h.className=g;var p=["left:"+o.left+"px","top:"+(d+o.top)+"px","height:"+c+"px","line-height:"+Math.max(c<30?c-2:c,0)+"px","width:"+f+"px"];e.color&&p.push("background-color:"+e.color),e.textColor&&p.push("color:"+e.textColor),h.style.cssText=p.join(";");var v=function(t,e,r){var a="gantt_left "+i(!e.rtl,t);return n(t,r.leftside_text,a)}(e,s,l);v&&h.appendChild(v),(v=function(t,e,r){var a="gantt_right "+i(!!e.rtl,t);return n(t,r.rightside_text,a)}(e,s,l))&&h.appendChild(v),t._waiAria.setTaskBarAttr(e,h);var m=t.getState();return t.isReadonly(e)||(s.drag_resize&&!t.isSummaryTask(e)&&u!=s.types.milestone&&r(h,"gantt_task_drag",e,function(t){var e=document.createElement("div");return e.className=t,e},s),s.drag_links&&s.show_links&&r(h,"gantt_link_control",e,function(t){var e=document.createElement("div");e.className=t,e.style.cssText=["height:"+c+"px","line-height:"+c+"px"].join(";");var n=document.createElement("div");n.className="gantt_link_point";var i=!1;return m.link_source_id&&s.touch&&(i=!0),n.style.display=i?"block":"",e.appendChild(n),e},s)),h}}function n(t,e,n){if(!e)return null;var i=e(t.start_date,t.end_date,t);if(!i)return null;var r=document.createElement("div");return r.className="gantt_side_content "+n,r.innerHTML=i,r}function i(e,n){var i=function(e){return e?{$source:[t.config.links.start_to_start],$target:[t.config.links.start_to_start,t.config.links.finish_to_start]}:{$source:[t.config.links.finish_to_start,t.config.links.finish_to_finish],$target:[t.config.links.finish_to_finish]}}(e);for(var r in i)for(var a=n[r],o=0;o=+s.min_date&&((o=r([n,a.rtl?"task_right":"task_left","task_start_date"].join(" "))).setAttribute("data-bind-property","start_date"),e.appendChild(o)),+i.end_date<=+s.max_date&&((o=r([n,a.rtl?"task_left":"task_right","task_end_date"].join(" "))).setAttribute("data-bind-property","end_date"),e.appendChild(o))}return function(n,i){var r=i.$getConfig().type_renderers[t.getTaskType(n.type)],a=e;return r?r.call(t,n,function(e){return a.call(t,e,i)},i):a.call(t,n,i)}}},function(t,e){t.exports=function(t,e,n,i){if(!t.start_date||!t.end_date)return null;var r=n.$getConfig(),a=n.getItemTop(t.id),o=r.row_height;if(a>e.y_end||a+oe.x_end||u0?t[r].$parent.getNextSibling(t[r].$id):t[r].$parent.getPrevSibling(t[r].$id);"resizer"==o.$name&&(o=i>0?o.$parent.getNextSibling(o.$id):o.$parent.getPrevSibling(o.$id));var s=o.getSize();if(o[n]){var l=a.gravity+s.gravity,c=a[n]+s[n],u=l/c;t[r].$config.gravity=u*e,o.$config[n]=c-e,o.$config.gravity=l-u*e}else t[r].$config[n]=e;var d=this.$gantt.$ui.getView("grid");d&&t[r].$content===d&&!d.$config.scrollable&&(this.$gantt.config.grid_width=e)}},e.prototype.resize=function(e){var n=!1;if(this.$root&&!this._resizeInProgress&&(this.callEvent("onBeforeResize",[]),n=!0,this._resizeInProgress=!0),t.prototype.resize.call(this,!0),t.prototype.resize.call(this,!1),n){var i=[];i=(i=(i=i.concat(this.getCellsByType("viewCell"))).concat(this.getCellsByType("viewLayout"))).concat(this.getCellsByType("hostCell"));for(var r=this.getCellsByType("scroller"),a=0;a=0&&this.$cells[e+1]?this.$cells[e+1]:null},e.prototype.getPrevSibling=function(t){var e=this.cellIndex(t);return e>=0&&this.$cells[e-1]?this.$cells[e-1]:null},e.prototype.cell=function(t){for(var e=0;e=n.childNodes.length?n.appendChild(t.$view):n.insertBefore(t.$view,n.childNodes[e])},e.prototype._parseConfig=function(t){this.$cells=[],this._xLayout=!t.rows;for(var e=t.rows||t.cols||t.views,n=0;n=0;i--){var a=this.$cells[i];a.$fill(n[i],this),a.$config.hidden&&a.$view.parentNode.removeChild(a.$view)}},e.prototype.$toHTML=function(){for(var e=this._xLayout?"x":"y",n=[],i=0;i=1e5&&(c.maxWidth=i),c.maxHeight>=1e5&&(c.maxHeight=a),c.minWidth=c.minWidth!=c.minWidth?0:c.minWidth,c.minHeight=c.minHeight!=c.minHeight?0:c.minHeight,this._xLayout?(c.minWidth+=this.$config.margin*this.$cells.length||0,c.minWidth+=2*this.$config.padding||0,c.minHeight+=2*this.$config.padding||0):(c.minHeight+=this.$config.margin*this.$cells.length||0,c.minHeight+=2*this.$config.padding||0),c},e.prototype._calcFreeSpace=function(t,e,n){var i=n?e.minWidth:e.minHeight,r=e.maxWidth,a=t;return a?(a>r&&(a=r),ar&&(a=r,this._free-=a,this._gravity-=e.gravity),aa&&(i=a),i=0;i--)if(!e[i].$config.hidden){n=i;break}for(i=0;i=n,a="";!r&&e[i+1]&&"scrollbar"==e[i+1].$config.view&&(this._xLayout?r=!0:a="gantt_layout_cell_border_transparent"),this._setBorders(r?[]:[t,a],e[i])}},e.prototype._updateCellVisibility=function(){for(var t,e=this._visibleCells||{},n=!this._visibleCells,i={},r=0;r=n.$level)return!1;for(;n&&this.exists(i);){if((n=this.getItem(i))&&n.id==e)return!0;i=this.getParent(n)}return!1},getSiblings:function(t){if(!this.exists(t))return i.$create();var e=this.getParent(t);return this.getChildren(e)},getNextSibling:function(t){for(var e=this.getSiblings(t),n=0,i=e.length;nn[t]?1:-1}:t;if(e){var r=i;i=function(t,e){return r(e,t)}}var o=this.getChildren(n);if(o){for(var s=[],l=o.length-1;l>=0;l--)s[l]=this.getItem(o[l]);s.sort(i);for(l=0;l=0&&this.splice(t,e||1)},$remove:function(t){this.$removeAt(this.$find(t))},$insertAt:function(t,e){if(e||0===e){var n=this.splice(e,this.length-e);this[e]=t,this.push.apply(this,n)}else this.push(t)},$find:function(t){for(var e=0;ei&&(e=Math.min(n.length,e))}this.pull[t.id]=t,this._skip_refresh||this._updateOrder(function(){-1===this.$find(t.id)&&this.$insertAt(t.id,e)}),this.filter()},isVisible:function(t){return this.visibleOrder.$find(t)>-1},getVisibleItems:function(){return this.getIndexRange()},addItem:function(t,e){return r.defined(t.id)||(t.id=r.uid()),this.$initItem&&(t=this.$initItem(t)),!(!this._skip_refresh&&!1===this.callEvent("onBeforeAdd",[t.id,t]))&&(this._addItemInner(t,e),this._skip_refresh||(this.callEvent("onAfterAdd",[t.id,t]),this.callEvent("onStoreUpdated",[t.id,t,"add"])),t.id)},_changeIdInner:function(t,e){this.pull[t]&&(this.pull[e]=this.pull[t]);var n=this._searchVisibleOrder[t];this.pull[e].id=e,this._updateOrder(function(){this[this.$find(t)]=e}),this._searchVisibleOrder[e]=n,delete this._searchVisibleOrder[t],delete this.pull[t]},changeId:function(t,e){this._changeIdInner(t,e),this.callEvent("onIdChange",[t,e])},exists:function(t){return!!this.pull[t]},_moveInner:function(t,e){var n=this.getIdByIndex(t);this._updateOrder(function(){this.$removeAt(t),this.$insertAt(n,Math.min(this.length,e))})},move:function(t,e){var n=this.getIdByIndex(t),i=this.getItem(n);this._moveInner(t,e),this._skip_refresh||this.callEvent("onStoreUpdated",[i.id,i,"move"])},clearAll:function(){this.pull={},this.visibleOrder=i.$create(),this.fullOrder=i.$create(),this._skip_refresh||(this.callEvent("onClearAll",[]),this.refresh())},silent:function(t,e){this._skip_refresh=!0,t.call(e||this),this._skip_refresh=!1},arraysEqual:function(t,e){if(t.length!==e.length)return!1;for(var n=0;n1)for(var n=1;n","gm"),n=new RegExp(" +","gm");function i(t){return(t+"").replace(e," ").replace(n," ")}var r=new RegExp("'","gm");function a(t){return(t+"").replace(r,"'")}for(var o in t._waiAria={getAttributeString:function(t){var e=[" "];for(var n in t){var r=a(i(t[n]));e.push(n+"='"+r+"'")}return e.push(" "),e.join(" ")},getTimelineCellAttr:function(e){return t._waiAria.getAttributeString({"aria-label":e})},_taskCommonAttr:function(e,n){e.start_date&&e.end_date&&(n.setAttribute("aria-label",i(t.templates.tooltip_text(e.start_date,e.end_date,e))),e.$dataprocessor_class&&n.setAttribute("aria-busy",!0),n.setAttribute("aria-selected",t.isSelectedTask(e.id)?"true":"false"))},setTaskBarAttr:function(e,n){this._taskCommonAttr(e,n),!t.isReadonly(e)&&t.config.drag_move&&(e.id!=t.getState().drag_id?n.setAttribute("aria-grabbed",!1):n.setAttribute("aria-grabbed",!0))},taskRowAttr:function(e,n){this._taskCommonAttr(e,n),!t.isReadonly(e)&&t.config.order_branch&&n.setAttribute("aria-grabbed",!1),n.setAttribute("role","row"),n.setAttribute("aria-level",e.$level),t.hasChild(e.id)&&n.setAttribute("aria-expanded",e.$open?"true":"false")},linkAttr:function(e,n){var r=t.config.links,a=e.type==r.finish_to_start||e.type==r.start_to_start,o=e.type==r.start_to_start||e.type==r.start_to_finish,s=t.locale.labels.link+" "+t.templates.drag_link(e.source,o,e.target,a);n.setAttribute("aria-label",i(s)),t.isReadonly(e)&&n.setAttribute("aria-readonly",!0)},gridSeparatorAttr:function(t){t.setAttribute("role","separator")},lightboxHiddenAttr:function(t){t.setAttribute("aria-hidden","true")},lightboxVisibleAttr:function(t){t.setAttribute("aria-hidden","false")},lightboxAttr:function(t){t.setAttribute("role","dialog"),t.setAttribute("aria-hidden","true"),t.firstChild.setAttribute("role","heading")},lightboxButtonAttrString:function(e){return this.getAttributeString({role:"button","aria-label":t.locale.labels[e],tabindex:"0"})},lightboxHeader:function(t,e){t.setAttribute("aria-label",e)},lightboxSelectAttrString:function(e){var n="";switch(e){case"%Y":n=t.locale.labels.years;break;case"%m":n=t.locale.labels.months;break;case"%d":n=t.locale.labels.days;break;case"%H:%i":n=t.locale.labels.hours+t.locale.labels.minutes}return t._waiAria.getAttributeString({"aria-label":n})},lightboxDurationInputAttrString:function(e){return this.getAttributeString({"aria-label":t.locale.labels.column_duration,"aria-valuemin":"0"})},gridAttrString:function(){return[" role='treegrid'",t.config.multiselect?"aria-multiselectable='true'":"aria-multiselectable='false'"," "].join(" ")},gridScaleRowAttrString:function(){return"role='row'"},gridScaleCellAttrString:function(e,n){var i="";if("add"==e.name)i=this.getAttributeString({role:"button","aria-label":t.locale.labels.new_task});else{var r={role:"columnheader","aria-label":n};t._sort&&t._sort.name==e.name&&("asc"==t._sort.direction?r["aria-sort"]="ascending":r["aria-sort"]="descending"),i=this.getAttributeString(r)}return i},gridDataAttrString:function(){return"role='rowgroup'"},gridCellAttrString:function(e,n,i){var r={role:"gridcell","aria-label":n};return e.editor&&!t.isReadonly(i)||(r["aria-readonly"]=!0),this.getAttributeString(r)},gridAddButtonAttrString:function(e){return this.getAttributeString({role:"button","aria-label":t.locale.labels.new_task})},messageButtonAttrString:function(t){return"tabindex='0' role='button' aria-label='"+t+"'"},messageInfoAttr:function(t){t.setAttribute("role","alert")},messageModalAttr:function(t,e){t.setAttribute("role","dialog"),e&&t.setAttribute("aria-labelledby",e)},quickInfoAttr:function(t){t.setAttribute("role","dialog")},quickInfoHeaderAttrString:function(){return" role='heading' "},quickInfoHeader:function(t,e){t.setAttribute("aria-label",e)},quickInfoButtonAttrString:function(e){return t._waiAria.getAttributeString({role:"button","aria-label":e,tabindex:"0"})},tooltipAttr:function(t){t.setAttribute("role","tooltip")},tooltipVisibleAttr:function(t){t.setAttribute("aria-hidden","false")},tooltipHiddenAttr:function(t){t.setAttribute("aria-hidden","true")}},t._waiAria)t._waiAria[o]=function(e){return function(){return t.config.wai_aria_attributes?e.apply(this,arguments):""}}(t._waiAria[o])}},function(t,e){t.exports=function(t){t._extend_to_optional=function(e){var n=e,i={render:n.render,focus:n.focus,set_value:function(e,r,a,o){var s=t._resolve_default_mapping(o);if(!a[s.start_date]||"start_date"==s.start_date&&this._isAllowedUnscheduledTask(a)){i.disable(e,o);var l={};for(var c in s)l[s[c]]=a[c];return n.set_value.call(t,e,r,l,o)}return i.enable(e,o),n.set_value.call(t,e,r,a,o)},get_value:function(e,i,r){return r.disabled?{start_date:null}:n.get_value.call(t,e,i,r)},update_block:function(e,n){if(t.callEvent("onSectionToggle",[t._lightbox_id,n]),e.style.display=n.disabled?"none":"block",n.button){var i=e.previousSibling.querySelector(".gantt_custom_button_label"),r=t.locale.labels,a=n.disabled?r[n.name+"_enable_button"]:r[n.name+"_disable_button"];i.innerHTML=a}t.resizeLightbox()},disable:function(t,e){e.disabled=!0,i.update_block(t,e)},enable:function(t,e){e.disabled=!1,i.update_block(t,e)},button_click:function(e,n,r,a){if(!1!==t.callEvent("onSectionButton",[t._lightbox_id,r])){var o=t._get_typed_lightbox_config()[e];o.disabled?i.enable(a,o):i.disable(a,o)}}};return i},t.form_blocks.duration_optional=t._extend_to_optional(t.form_blocks.duration),t.form_blocks.time_optional=t._extend_to_optional(t.form_blocks.time)}},function(t,e,n){var i=n(2);t.exports=function(t){var e=n(11)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(n){var i=t.config.types,r=t.locale.labels,a=[],o=n.filter||function(t,e){return!i.placeholder||e!==i.placeholder};for(var s in i)!1==!o(s,i[s])&&a.push({key:i[s],label:r["type_"+s]});n.options=a;var l=n.onchange;return n.onchange=function(){t.changeLightboxType(this.value),"function"==typeof l&&l.apply(this,arguments)},e.prototype.render.apply(this,arguments)},r}},function(t,e,n){var i=n(2),r=n(25);t.exports=function(t){var e=n(5)(t);function a(){return e.apply(this,arguments)||this}function o(e){return!e||e===t.config.constraint_types.ASAP||e===t.config.constraint_types.ALAP}function s(t,e){for(var n=o(e),i=0;i",a=[];for(var o in t.config.constraint_types)a.push({key:t.config.constraint_types[o],label:t.locale.labels[t.config.constraint_types[o]]});return e.options=e.options||a,i+=""+r.getHtmlSelect(e.options,[{key:"data-type",value:"constraint-type"}])+"",i+="",i+=""},a.prototype.set_value=function(e,n,i,r){var a=e.querySelector("[data-constraint-type-select] select"),o=e.querySelectorAll("[data-constraint-time-select] select"),l=r._time_format_order,c=t._resolve_default_mapping(r);a._eventsInitialized||(a.addEventListener("change",function(t){s(o,t.target.value)}),a._eventsInitialized=!0);var u=i[c.constraint_date]||new Date;t.form_blocks._fill_lightbox_select(o,0,u,l,r);var d=i[c.constraint_type]||t.getConstraintType(i);a.value=d,s(o,d)},a.prototype.get_value=function(e,n,i){var r=e.querySelector("[data-constraint-type-select] select"),a=e.querySelectorAll("[data-constraint-time-select] select"),s=r.value,l=null;return o(s)||(l=t.form_blocks.getTimePickerValue(a,i)),{constraint_type:s,constraint_date:l}},a.prototype.focus=function(e){t._focus(e.querySelector("select"))},a}},function(t,e,n){var i=n(2);t.exports=function(t){var e=n(11)(t);function r(){return e.apply(this,arguments)||this}function a(e,n){var i=[],r=[];n&&(i=t.getTaskByTime(),e.allow_root&&i.unshift({id:t.config.root_id,text:e.root_label||""}),i=function(e,n,i){var r=n.filter||function(){return!0};e=e.slice(0);for(var a=0;a",i=" "+t.locale.labels[t.config.duration_unit+"s"]+" ",r=e.single_date?" style='display:none'":"",a=e.readonly?" disabled='disabled'":"",o=t._waiAria.lightboxDurationInputAttrString(e),s="gantt_duration_value";e.formatter&&(i="",s+=" gantt_duration_value_formatted");var l="
"+i+"
";return"
"+n+" "+l+"
"},a.prototype.set_value=function(e,n,i,r){var a,c,u,d,h=e.getElementsByTagName("select"),f=e.getElementsByTagName("input"),_=f[1],g=[f[0],f[2]],p=e.getElementsByTagName("span")[0],v=r._time_format_order;function m(){var n=s.call(t,e,r),a=l.call(t,e,r),o=t.calculateEndDate({start_date:n,duration:a,task:i}),c=t.templates.task_end_date||t.templates.task_date;p.innerHTML=c(o)}function y(t){var e=_.value;e=o(r).parse(e),window.isNaN(e)&&(e=0),(e+=t)<1&&(e=1),_.value=o(r).format(e),m()}g[0].onclick=t.bind(function(){y(-1*t.config.duration_step)},this),g[1].onclick=t.bind(function(){y(1*t.config.duration_step)},this),h[0].onchange=m,h[1].onchange=m,h[2].onchange=m,h[3]&&(h[3].onchange=m),_.onkeydown=t.bind(function(e){var n;return(n=(e=e||window.event).charCode||e.keyCode||e.which)==t.constants.KEY_CODES.DOWN?(y(-1*t.config.duration_step),!1):n==t.constants.KEY_CODES.UP?(y(1*t.config.duration_step),!1):void window.setTimeout(m,1)},this),_.onchange=t.bind(m,this),"string"==typeof(a=t._resolve_default_mapping(r))&&(a={start_date:a}),c=i[a.start_date]||new Date,u=i[a.end_date]||t.calculateEndDate({start_date:c,duration:1,task:i}),d=Math.round(i[a.duration])||t.calculateDuration({start_date:c,end_date:u,task:i}),d=o(r).format(d),t.form_blocks._fill_lightbox_select(h,0,c,v,r),_.value=d,m()},a.prototype.get_value=function(e,n,i){var r=s(e,i),a=l(e,i),o=t.calculateEndDate({start_date:r,duration:a,task:n});return"string"==typeof t._resolve_default_mapping(i)?r:{start_date:r,end_date:o,duration:a}},a.prototype.focus=function(e){t._focus(e.getElementsByTagName("select")[0])},a}},function(t,e,n){var i=n(2);t.exports=function(t){var e=n(5)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){var e="
";if(t.options&&t.options.length)for(var n=0;n"+t.options[n].label+"";return e+="
"},r.prototype.set_value=function(t,e,n,i){var r;i.options&&i.options.length&&(r=t.querySelector("input[type=radio][value='"+e+"']")||t.querySelector("input[type=radio][value='"+i.default_value+"']"))&&(!t._dhx_onchange&&i.onchange&&(t.onchange=i.onchange,t._dhx_onchange=!0),r.checked=!0)},r.prototype.get_value=function(t,e){var n=t.querySelector("input[type=radio]:checked");return n?n.value:""},r.prototype.focus=function(e){t._focus(e.querySelector("input[type=radio]"))},r}},function(t,e,n){var i=n(3),r=n(2);t.exports=function(t){var e=n(5)(t);function a(){return e.apply(this,arguments)||this}return r(a,e),a.prototype.render=function(t){var e="
";if(t.options&&t.options.length)for(var n=0;n"+t.options[n].label+"";return e+="
"},a.prototype.set_value=function(t,e,n,r){var a=Array.prototype.slice.call(t.querySelectorAll("input[type=checkbox]"));!t._dhx_onchange&&r.onchange&&(t.onchange=r.onchange,t._dhx_onchange=!0),i.forEach(a,function(t){t.checked=!!e&&e.indexOf(t.value)>=0})},a.prototype.get_value=function(t){return i.arrayMap(Array.prototype.slice.call(t.querySelectorAll("input[type=checkbox]:checked")),function(t){return t.value})},a.prototype.focus=function(e){t._focus(e.querySelector("input[type=checkbox]"))},a}},function(t,e,n){var i=n(2);t.exports=function(t){var e=n(5)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(e){var n=t.form_blocks.getTimePicker.call(this,e),i="
";return i+=n,e.single_date?(n=t.form_blocks.getTimePicker.call(this,e,!0),i+=""):i+="  –  ",i+=n,i+="
"},r.prototype.set_value=function(e,n,i,r){var a=r,o=e.getElementsByTagName("select"),s=r._time_format_order;if(a.auto_end_date)for(var l=function(){d=new Date(o[s[2]].value,o[s[1]].value,o[s[0]].value,0,0),h=t.calculateEndDate({start_date:d,duration:1,task:i}),t.form_blocks._fill_lightbox_select(o,s.size,h,s,a)},c=0;c<4;c++)o[c].onchange=l;var u=t._resolve_default_mapping(r);"string"==typeof u&&(u={start_date:u});var d=i[u.start_date]||new Date,h=i[u.end_date]||t.calculateEndDate({start_date:d,duration:1,task:i});t.form_blocks._fill_lightbox_select(o,0,d,s,a),t.form_blocks._fill_lightbox_select(o,s.size,h,s,a)},r.prototype.get_value=function(e,n,i){var r,a=e.getElementsByTagName("select"),o=i._time_format_order;return r=t.form_blocks.getTimePickerValue(a,i),"string"==typeof t._resolve_default_mapping(i)?r:{start_date:r,end_date:function(e,n,r){var a=t.form_blocks.getTimePickerValue(e,i,n.size);return a<=r?t.date.add(r,t._get_timepicker_step(),"minute"):a}(a,o,r)}},r.prototype.focus=function(e){t._focus(e.getElementsByTagName("select")[0])},r}},function(t,e,n){var i=n(2);t.exports=function(t){var e=n(5)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){return"
"},r.prototype.set_value=function(e,n){t.form_blocks.textarea._get_input(e).value=n||""},r.prototype.get_value=function(e){return t.form_blocks.textarea._get_input(e).value},r.prototype.focus=function(e){var n=t.form_blocks.textarea._get_input(e);t._focus(n,!0)},r.prototype._get_input=function(t){return t.querySelector("textarea")},r}},function(t,e,n){var i=n(2);t.exports=function(t){var e=n(5)(t);function r(){return e.apply(this,arguments)||this}return i(r,e),r.prototype.render=function(t){return"
"},r.prototype.set_value=function(t,e){t.innerHTML=e||""},r.prototype.get_value=function(t){return t.innerHTML||""},r.prototype.focus=function(){},r}},function(t,e,n){t.exports=function(t){var e=n(1),i=n(3),r=n(52)(t),a=n(51)(t),o=n(50)(t),s=n(11)(t),l=n(49)(t),c=n(48)(t),u=n(47)(t),d=n(46)(t),h=n(11)(t),f=n(45)(t),_=n(44)(t);function g(e,n){var i,r,a="";for(r=0;r
"+t.locale.labels[i]+"
";return a}function p(e,n,i){var r,a,o,s,l,c,u="";switch(i.timeFormat[n]){case"%Y":for(e._time_format_order[2]=n,e._time_format_order.size++,e.year_range&&(isNaN(e.year_range)?e.year_range.push&&(o=e.year_range[0],s=e.year_range[1]):r=e.year_range),r=r||10,a=a||Math.floor(r/2),o=o||i.date.getFullYear()-a,s=s||o+r,l=o;l"+l+"";break;case"%m":for(e._time_format_order[1]=n,e._time_format_order.size++,l=0;l<12;l++)u+="";break;case"%d":for(e._time_format_order[0]=n,e._time_format_order.size++,l=1;l<32;l++)u+="";break;case"%H:%i":for(e._time_format_order[3]=n,e._time_format_order.size++,l=i.first,c=i.date.getDate(),e._time_values=[];l"+t.templates.time_picker(i.date)+"",e._time_values.push(l),i.date.setTime(i.date.valueOf()+60*t._get_timepicker_step()*1e3),l=24*(i.date.getDate()!=c?1:0)*60+60*i.date.getHours()+i.date.getMinutes()}return u}t._lightbox_methods={},t._lightbox_template="
 
",t.$services.getService("state").registerProvider("lightbox",function(){return{lightbox:t._lightbox_id}}),t.showLightbox=function(t){if(this.callEvent("onBeforeLightbox",[t])){var e=this.getTask(t),n=this.getLightbox(this.getTaskType(e.type));this._center_lightbox(n),this.showCover(),this._fill_lightbox(t,n),this._waiAria.lightboxVisibleAttr(n),this.callEvent("onLightbox",[t])}},t._get_timepicker_step=function(){if(this.config.round_dnd_dates){var e;if(function(t){var e=t.$ui.getView("timeline");return!(!e||!e.isVisible())}(this)){var n=t.getScale();e=i.getSecondsInUnit(n.unit)*n.step/60}return(!e||e>=1440)&&(e=this.config.time_step),e}return this.config.time_step},t.getLabel=function(t,e){for(var n=this._get_typed_lightbox_config(),i=0;i
"+this.locale.labels["button_"+t[n].button]+"
"),this.config.wide_form&&(e+="
"),e+="
"+i.render.call(this,t[n]),e+="
"}}return e},t.resizeLightbox=function(){if(this._lightbox){var t=this._lightbox.childNodes[1];t.style.height="0px",t.style.height=t.scrollHeight+"px",this._lightbox.style.height=t.scrollHeight+this.config.lightbox_additional_height+"px",t.style.height=t.scrollHeight+"px"}},t._center_lightbox=function(t){if(t){t.style.display="block";var e=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,n=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,i=window.innerHeight||document.documentElement.clientHeight;t.style.top=e?Math.round(e+Math.max((i-t.offsetHeight)/2,0))+"px":Math.round(Math.max((i-t.offsetHeight)/2,0)+9)+"px",document.documentElement.scrollWidth>document.body.offsetWidth?t.style.left=Math.round(n+(document.body.offsetWidth-t.offsetWidth)/2)+"px":t.style.left=Math.round((document.body.offsetWidth-t.offsetWidth)/2)+"px"}},t.showCover=function(){if(!this._cover){this._cover=document.createElement("DIV"),this._cover.className="gantt_cal_cover";var t=void 0!==document.height?document.height:document.body.offsetHeight,e=document.documentElement?document.documentElement.scrollHeight:0;this._cover.style.height=Math.max(t,e)+"px",document.body.appendChild(this._cover)}},t._init_lightbox_events=function(){t.lightbox_events={},t.lightbox_events.gantt_save_btn=function(){t._save_lightbox()},t.lightbox_events.gantt_delete_btn=function(){t.callEvent("onLightboxDelete",[t._lightbox_id])&&(t.isTaskExists(t._lightbox_id)?t.$click.buttons.delete(t._lightbox_id):t.hideLightbox())},t.lightbox_events.gantt_cancel_btn=function(){t._cancel_lightbox()},t.lightbox_events.default=function(n,i){if(i.getAttribute("data-dhx-button"))t.callEvent("onLightboxButton",[i.className,i,n]);else{var r,a,o=e.getClassName(i);if(-1!=o.indexOf("gantt_custom_button"))if(-1!=o.indexOf("gantt_custom_button_"))for(r=i.parentNode.getAttribute("data-index"),a=i;a&&-1==e.getClassName(a).indexOf("gantt_cal_lsection");)a=a.parentNode;else r=i.getAttribute("data-index"),a=i.parentNode,i=i.firstChild;var s=t._get_typed_lightbox_config();r&&(r*=1,t.form_blocks[s[1*r].type].button_click(r,i,a,a.nextSibling))}},this.event(t.getLightbox(),"click",function(n){var i=(n=n||window.event).target?n.target:n.srcElement,r=e.getClassName(i);return r||(i=i.previousSibling,r=e.getClassName(i)),i&&r&&0===r.indexOf("gantt_btn_set")&&(i=i.firstChild,r=e.getClassName(i)),!(!i||!r)&&(t.defined(t.lightbox_events[i.className])?t.lightbox_events[i.className]:t.lightbox_events.default)(n,i)}),t.getLightbox().onkeydown=function(n){var i=n||window.event,r=n.target||n.srcElement,a=e.getClassName(r).indexOf("gantt_btn_set")>-1;switch((n||i).keyCode){case t.constants.KEY_CODES.SPACE:if((n||i).shiftKey)return;a&&r.click&&r.click();break;case t.keys.edit_save:if((n||i).shiftKey)return;a&&r.click?r.click():t._save_lightbox();break;case t.keys.edit_cancel:t._cancel_lightbox()}}},t._cancel_lightbox=function(){var e=this.getLightboxValues();this.callEvent("onLightboxCancel",[this._lightbox_id,e.$new]),t.isTaskExists(e.id)&&e.$new&&this.silent(function(){t.$data.tasksStore.removeItem(e.id),t._update_flags(e.id,null)}),this.refreshData(),this.hideLightbox()},t._save_lightbox=function(){var t=this.getLightboxValues();this.callEvent("onLightboxSave",[this._lightbox_id,t,!!t.$new])&&(t.$new?(delete t.$new,this.addTask(t,t.parent,this.getTaskIndex(t.id))):this.isTaskExists(t.id)&&(this.mixin(this.getTask(t.id),t,!0),this.refreshTask(t.id),this.updateTask(t.id)),this.refreshData(),this.hideLightbox())},t._resolve_default_mapping=function(t){var e=t.map_to;return!{time:!0,time_optional:!0,duration:!0,duration_optional:!0}[t.type]?"constraint"===t.type&&(t.map_to&&"string"!=typeof t.map_to||(e={constraint_type:"constraint_type",constraint_date:"constraint_date"})):"auto"==t.map_to?e={start_date:"start_date",end_date:"end_date",duration:"duration"}:"string"==typeof t.map_to&&(e={start_date:t.map_to}),e},t.getLightboxValues=function(){var e={};t.isTaskExists(this._lightbox_id)&&(e=this.mixin({},this.getTask(this._lightbox_id)));for(var n=this._get_typed_lightbox_config(),i=0;i0&&(s+=" "),(a=p(e,r,c))&&(o=t._waiAria.lightboxSelectAttrString(c.timeFormat[r]),s+="");return s},getTimePickerValue:function(e,n,i){var r,a=n._time_format_order,o=t.defined(a[3]),s=0,l=0,c=i||0;return o&&(r=parseInt(e[a[3]+c].value,10),s=Math.floor(r/60),l=r%60),new Date(e[a[2]+c].value,e[a[1]+c].value,e[a[0]+c].value,s,l)},_fill_lightbox_select:function(e,n,i,r){if(e[n+r[0]].value=i.getDate(),e[n+r[1]].value=i.getMonth(),e[n+r[2]].value=i.getFullYear(),t.defined(r[3])){var a=60*i.getHours()+i.getMinutes();a=Math.round(a/t._get_timepicker_step())*t._get_timepicker_step();var o=e[n+r[3]];o.value=a,o.setAttribute("data-value",a)}},template:new r,textarea:new a,select:new s,time:new o,duration:new u,parent:new d,radio:new c,checkbox:new l,resources:new h,constraint:new f,typeselect:new _},t._is_lightbox_timepicker=function(){for(var t=this._get_typed_lightbox_config(),e=0;e1?null:t.touches[0]?{target:t.target,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:t},function(){return!1}):window.navigator.pointerEnabled?this._touch_events(["pointermove","pointerdown","pointerup"],function(t){return"mouse"==t.pointerType?null:t},function(t){return!t||"mouse"==t.pointerType}):window.navigator.msPointerEnabled&&this._touch_events(["MSPointerMove","MSPointerDown","MSPointerUp"],function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t},function(t){return!t||t.pointerType==t.MSPOINTER_TYPE_MOUSE})}},t));var n=[];t._touch_events=function(i,r,a){for(var o,s=0,l=!1,c=!1,u=null,d=null,h=null,f=0;f5||Math.abs(g)>5)&&(t._touch_scroll_active=c=!0,s=0,o=t.getScrollState()),c){t.scrollTo(o.x+f,o.y+g);var p=t.getScrollState();if(o.x!=p.x&&g>2*f||o.y!=p.y&&f>2*g)return _(n)}}return _(n)}return!0}}]),n.push([this.$container,"contextmenu",function(t){if(l)return _(t)}]),n.push([this.$container,i[1],function(n){if(!a(n))if(n.touches&&n.touches.length>1)l=!1;else{u=r(n),t._locate_css(u,"gantt_hor_scroll")||t._locate_css(u,"gantt_ver_scroll")||(l=!0);var i=e();d=setTimeout(function(){var e=t.locate(u);i&&e&&!t._locate_css(u,"gantt_link_control")&&!t._locate_css(u,"gantt_grid_data")&&(i.on_mouse_down(u),i.drag&&i.drag.start_drag&&(!function(e){var n=t._getTaskLayers(),i=t.getTask(e);if(i&&t.isTaskVisible(e))for(var r=0;re._levels.length-1||e.setLevel(t)},this.getCurrentLevel=function(){return e._activeLevelIndex},this.getLevels=function(){return e._levels},this.setLevel=function(t){var n=e._getZoomIndexByName(t);-1===n&&e.$gantt.assert(-1!==n,"Invalid zoom level for gantt.ext.zoom.setLevel. "+t+" is not an expected value."),e._setLevel(n,0)},this._getZoomIndexByName=function(t){var n=-1;if("string"==typeof t){if(!isNaN(Number(t))&&e._levels[Number(t)])n=Number(t);else for(var i=0;i0&&(r=!0),t.preventDefault(),t.stopPropagation(),e._setScaleSettings(r,i)},this._setScaleDates=function(){e._initialStartDate&&e._initialEndDate&&(e.$gantt.config.start_date=e._initialStartDate,e.$gantt.config.end_date=e._initialEndDate)},this.$gantt=t,this._domEvents=this.$gantt._createDomEventScope()}return t.prototype.init=function(t){var e=this;a(this.$gantt)&&(this._initialStartDate=t.startDate,this._initialEndDate=t.endDate,this._activeLevelIndex=t.activeLevelIndex?t.activeLevelIndex:0,this._levels=this._mapScales(t.levels||s),this._handler=t.handler||this._defaultHandler,this._minColumnWidth=t.minColumnWidth||60,this._maxColumnWidth=t.maxColumnWidth||240,this._widthStep=t.widthStep||3/8*t.minColumnWidth,this._useKey=t.useKey,this._initialized||(r(this),this.$gantt.attachEvent("onGanttScroll",function(){e._getVisibleDate()})),this._domEvents.detachAll(),"wheel"===t.trigger&&(this.$gantt.$root?this._attachWheelEvent(t):this.$gantt.attachEvent("onGanttReady",function(){e._attachWheelEvent(t)})),this._initialized=!0,this.setLevel(this._activeLevelIndex))},t.prototype._mapScales=function(t){return t.map(function(t){return Array.isArray(t)?{scales:t}:t})},t.prototype._setScaleSettings=function(t,e){t?this._stepUp(e):this._stepDown(e)},t.prototype._stepUp=function(t){if(!(this._activeLevelIndex>=this._levels.length-1)){var e=this._activeLevelIndex;if(this._setScaleDates(),this._widthStep){var n=this.$gantt.config.min_column_width+this._widthStep;n>this._maxColumnWidth&&(n=this._minColumnWidth,e++),this.$gantt.config.min_column_width=n}else e++;this._setLevel(e,t)}},t.prototype._stepDown=function(t){if(!(this._activeLevelIndex<1)){var e=this._activeLevelIndex;if(this._setScaleDates(),this._widthStep){var n=this.$gantt.config.min_column_width-this._widthStep;n0&&_+p>=v+2&&(s=0),o&&!k?o=0:o<0&&!y?o=0:o>0&&y+k>=b&&(o=0);var w=t.config.autoscroll_step;w&&w<2&&(w=2),o*=w||n,s*=w||n,(o||s)&&function(e,n){var i=t.getScrollState(),r=null,a=null;e&&(r=i.x+e,r=Math.min(i.width,r),r=Math.max(0,r));n&&(a=i.y+n,a=Math.min(i.height,a),a=Math.max(0,a));t.scrollTo(r,a)}(o,s)}function m(t,n,i){return t-e<0&&tn-e&&t>i?1:0}t.attachEvent("onGanttReady",function(){r(t)||(t.eventRemove(document.body,"mousemove",p),t.event(document.body,"mousemove",p))})}},function(t,e,n){t.exports=function(t){t.ext||(t.ext={});for(var e=[n(58),n(57),n(56)],i=0;i-1&&(n.className=n.className.slice(0,t))},200))})}},function(t,e){t.exports=function(t){t.skins.broadway={config:{grid_width:360,row_height:35,scale_height:35,link_line_width:1,link_arrow_size:7,lightbox_additional_height:86},_second_column_width:90,_third_column_width:80,_lightbox_template:"
 
",_config_buttons_left:{},_config_buttons_right:{gantt_delete_btn:"icon_delete",gantt_save_btn:"icon_save"}}}},function(t,e){t.exports=function(t){t.skins.terrace={config:{grid_width:360,row_height:35,scale_height:35,link_line_width:2,link_arrow_size:6,lightbox_additional_height:75},_second_column_width:90,_third_column_width:70}}},function(t,e){t.exports=function(t){t.skins.meadow={config:{grid_width:350,row_height:27,scale_height:30,link_line_width:2,link_arrow_size:6,lightbox_additional_height:72},_second_column_width:95,_third_column_width:80}}},function(t,e){t.exports=function(t){t.skins.skyblue={config:{grid_width:350,row_height:27,scale_height:27,link_line_width:1,link_arrow_size:8,lightbox_additional_height:75},_second_column_width:95,_third_column_width:80}}},function(t,e){function n(t,e){var n=e.skin;if(!n||t)for(var i=document.getElementsByTagName("link"),r=0;rl.width?l.min_width:l.width,l.width=l.max_width&&l.max_widthl[1]&&(t.config.grid_width=l[1]),r&&t.config.show_chart)if(a.$config.width=t.config.grid_width-1,n)a.$parent.$config.width=t.config.grid_width,a.$parent.$config.group&&t.$layout._syncCellSizes(a.$parent.$config.group,a.$parent.$config.width);else if(r&&!i.isChildOf(r.$task,e.$view)){if(!a.$config.original_grid_width){var c=t.skins[t.skin];c&&c.config&&c.config.grid_width?a.$config.original_grid_width=c.config.grid_width:a.$config.original_grid_width=0}t.config.grid_width=a.$config.original_grid_width,a.$parent.$config.width=t.config.grid_width}else a.$parent._setContentSize(a.$config.width,null),t.$layout._syncCellSizes(a.$parent.$config.group,t.config.grid_width);else r&&i.isChildOf(r.$task,e.$view)&&(a.$config.original_grid_width=t.config.grid_width),n||(a.$parent.$config.width=0)}n=!1}}),this._initScrollStateEvents(e)},_initScrollStateEvents:function(e){t._getVerticalScrollbar=this.getVerticalScrollbar,t._getHorizontalScrollbar=this.getHorizontalScrollbar;var n=this.getVerticalScrollbar(),i=this.getHorizontalScrollbar();n&&n.attachEvent("onScroll",function(e,n,i){var r=t.getScrollState();t.callEvent("onGanttScroll",[r.x,e,r.x,n])}),i&&i.attachEvent("onScroll",function(e,n,i){var r=t.getScrollState();t.callEvent("onGanttScroll",[e,r.y,n,r.y])}),e.attachEvent("onResize",function(){n&&!t.$scroll_ver&&(t.$scroll_ver=n.$scroll_ver),i&&!t.$scroll_hor&&(t.$scroll_hor=i.$scroll_hor)})},_findGridResizer:function(t,e){for(var n,i=t.getCellsByType("resizer"),r=!0,a=0;aa.bottom&&(d.y=a.bottom-r.height-s),d.right>a.right&&(d.x=a.right-r.width-o),d}function v(t){var n=u(),i=["gantt_link_tooltip"];n.link_source_id&&n.link_target_id&&(e.isLinkAllowed(n.link_source_id,n.link_target_id,n.link_from_start,n.link_to_start)?i.push("gantt_allowed_link"):i.push("gantt_invalid_link"));var r=e.templates.drag_link_class(n.link_source_id,n.link_from_start,n.link_target_id,n.link_to_start);r&&i.push(r);var a="
"+e.templates.drag_link(n.link_source_id,n.link_from_start,n.link_target_id,n.link_to_start)+"
";t.innerHTML=a}function m(){o=s=r=null,a=!0}function y(n,i,r,a){var o=function(){_._direction&&_._direction.parentNode||(_._direction=document.createElement("div"),t.$task_links.appendChild(_._direction));return _._direction}(),s=u(),l=["gantt_link_direction"];e.templates.link_direction_class&&l.push(e.templates.link_direction_class(s.link_source_id,s.link_from_start,s.link_target_id,s.link_to_start));var c=Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2));if(c=Math.max(0,c-3)){o.className=l.join(" ");var d=(a-i)/(r-n),h=Math.atan(d);2==k(n,r,i,a)?h+=Math.PI:3==k(n,r,i,a)&&(h-=Math.PI);var f=Math.sin(h),g=Math.cos(h),p=Math.round(i),v=Math.round(n),m=["-webkit-transform: rotate("+h+"rad)","-moz-transform: rotate("+h+"rad)","-ms-transform: rotate("+h+"rad)","-o-transform: rotate("+h+"rad)","transform: rotate("+h+"rad)","width:"+Math.round(c)+"px"];if(-1!=window.navigator.userAgent.indexOf("MSIE 8.0")){m.push('-ms-filter: "'+function(t,e){return"progid:DXImageTransform.Microsoft.Matrix(M11 = "+e+",M12 = -"+t+",M21 = "+t+",M22 = "+e+",SizingMethod = 'auto expand')"}(f,g)+'"');var y=Math.abs(Math.round(n-r)),b=Math.abs(Math.round(a-i));switch(k(n,r,i,a)){case 1:p-=b;break;case 2:v-=y,p-=b;break;case 3:v-=y}}m.push("top:"+p+"px"),m.push("left:"+v+"px"),o.style.cssText=m.join(";")}}function k(t,e,n,i){return e>=t?i<=n?1:4:i<=n?2:3}_.attachEvent("onBeforeDragStart",e.bind(function(n,r){var a=r.target||r.srcElement;if(m(),e.getState().drag_id)return!1;if(i.locateClassName(a,"gantt_link_point")){i.locateClassName(a,"task_start_date")&&(s=!0);var l=e.locate(r);o=l;var c=e.getTask(l);if(e.isReadonly(c))return m(),!1;return this._dir_start=g(c,!!s,0,t.$getConfig(),!0),!0}return!1},this)),_.attachEvent("onAfterDragStart",e.bind(function(t,n){e.config.touch&&e.refreshData(),v(_.config.marker)},this)),_.attachEvent("onDragMove",e.bind(function(o,s){var l=_.config,c=p(s,l.marker);!function(t,e){t.style.left=e.x+"px",t.style.top=e.y+"px"}(l.marker,c);var u=!!i.locateClassName(s,"gantt_link_control"),d=r,h=n,f=a,m=e.locate(s),k=!0;if(i.isChildOf(s.target||s.srcElement,e.$root)||(u=!1,m=null),u&&(k=!i.locateClassName(s,"task_end_date"),u=!!m),r=m,n=u,a=k,u){var b=e.getTask(m),w=t.$getConfig(),x=i.locateClassName(s,"gantt_link_control"),T=0;x&&(T=Math.floor(x.offsetWidth/2)),this._dir_end=g(b,!!a,T,w)}else this._dir_end=i.getRelativeEventPosition(s,t.$task_data),e.env.isEdge&&(this._dir_end.y+=window.scrollY);var $=!(h==u&&d==m&&f==k);return $&&(d&&e.refreshTask(d,!1),m&&e.refreshTask(m,!1)),$&&v(l.marker),y(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y),!0},this)),_.attachEvent("onDragEnd",e.bind(function(){var t=u();if(t.link_source_id&&t.link_target_id&&t.link_source_id!=t.link_target_id){var n=e._get_link_type(t.link_from_start,t.link_to_start),i={source:t.link_source_id,target:t.link_target_id,type:n};i.type&&e.isLinkAllowed(i)&&e.callEvent("onLinkCreated",[i])&&e.addLink(i)}m(),e.config.touch?e.refreshData():(t.link_source_id&&e.refreshTask(t.link_source_id,!1),t.link_target_id&&e.refreshTask(t.link_target_id,!1)),_._direction&&(_._direction.parentNode&&_._direction.parentNode.removeChild(_._direction),_._direction=null)},this)),e.attachEvent("onGanttRender",e.bind(function(){_._direction&&y(this._dir_start.x,this._dir_start.y,this._dir_end.x,this._dir_end.y)},this))};t.exports={createLinkDND:function(){return{init:r}}}},function(t,e,n){var i=n(1),r=n(0),a=n(40),o=n(3);t.exports={createTaskDND:function(){var t;return{extend:function(e){e.roundTaskDates=function(e){t.round_task_dates(e)}},init:function(e,n){return t=function(t,e){var n=e.$services;return{drag:null,dragMultiple:{},_events:{before_start:{},before_finish:{},after_finish:{}},_handlers:{},init:function(){this._domEvents=e._createDomEventScope(),this.clear_drag_state();var t=e.config.drag_mode;this.set_actions(),n.getService("state").registerProvider("tasksDnd",r.bind(function(){return{drag_id:this.drag?this.drag.id:void 0,drag_mode:this.drag?this.drag.mode:void 0,drag_from_start:this.drag?this.drag.left:void 0}},this));var i={before_start:"onBeforeTaskDrag",before_finish:"onBeforeTaskChanged",after_finish:"onAfterTaskDrag"};for(var a in this._events)for(var o in t)this._events[a][o]=i[a];this._handlers[t.move]=this._move,this._handlers[t.resize]=this._resize,this._handlers[t.progress]=this._resize_progress},set_actions:function(){var n=t.$task_data;this._domEvents.attach(n,"mousemove",e.bind(function(t){this.on_mouse_move(t)},this)),this._domEvents.attach(n,"mousedown",e.bind(function(t){this.on_mouse_down(t)},this)),this._domEvents.attach(e.$root,"mouseup",e.bind(function(t){this.on_mouse_up(t)},this))},clear_drag_state:function(){this.drag={id:null,mode:null,pos:null,start_x:null,start_y:null,obj:null,left:null},this.dragMultiple={}},_resize:function(n,i,r){var a=t.$getConfig(),o=this._drag_task_coords(n,r);r.left?(n.start_date=e.dateFromPos(o.start+i),n.start_date||(n.start_date=new Date(e.getState().min_date))):(n.end_date=e.dateFromPos(o.end+i),n.end_date||(n.end_date=new Date(e.getState().max_date)));var s=this._calculateMinDuration(a.min_duration,a.duration_unit);n.end_date-n.start_datec){var u=c-s.end;(ui||void 0===i)&&(i=d)}}return i},_move:function(t,n,i){var r=this._drag_task_coords(t,i),a=e.dateFromPos(r.start+n),o=e.dateFromPos(r.end+n);a?o?(t.start_date=a,t.end_date=o):(t.end_date=new Date(e.getState().max_date),t.start_date=e.dateFromPos(e.posFromDate(t.end_date)-(r.end-r.start))):(t.start_date=new Date(e.getState().min_date),t.end_date=e.dateFromPos(e.posFromDate(t.start_date)+(r.end-r.start)))},_drag_task_coords:function(t,n){return{start:n.obj_s_x=n.obj_s_x||e.posFromDate(t.start_date),end:n.obj_e_x=n.obj_e_x||e.posFromDate(t.end_date)}},_mouse_position_change:function(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)},_is_number:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},on_mouse_move:function(t){if(this.drag.start_drag){var n=i.getRelativeEventPosition(t,e.$task_data),r=this.drag.start_drag.start_x,o=this.drag.start_drag.start_y;(Date.now()-this.drag.timestamp>50||this._is_number(r)&&this._is_number(o)&&this._mouse_position_change({x:r,y:o},n)>20)&&this._start_dnd(t)}if(this.drag.mode){if(!a(this,40))return;this._update_on_move(t)}},_update_item_on_move:function(t,n,i,r,a){var o=e.getTask(n),s=e.mixin({},o),l=e.mixin({},o);this._handlers[i].apply(this,[l,t,r]),e.mixin(o,l,!0),e.callEvent("onTaskDrag",[o.id,i,l,s,a]),e.mixin(o,l,!0),e.refreshTask(n)},_update_on_move:function(n){var a=this.drag,o=t.$getConfig();if(a.mode){var s=i.getRelativeEventPosition(n,t.$task_data);if(a.pos&&a.pos.x==s.x)return;a.pos=s;var l=e.dateFromPos(s.x);if(!l||isNaN(l.getTime()))return;var c=s.x-a.start_x,u=e.getTask(a.id);if(this._handlers[a.mode]){if(a.mode===o.drag_mode.move){var d={};if(this._isMultiselect()&&e.getSelectedTasks().indexOf(a.id)>=0&&(d=this.dragMultiple),e.isSummaryTask(u)&&e.config.drag_project){var h={};h[a.id]=r.copy(a),d=r.mixin(h,this.dragMultiple)}var f=this._find_max_shift(d,c);for(var _ in void 0!==f&&(c=f),this._update_item_on_move(c,a.id,a.mode,a,n),d){var g=d[_];this._update_item_on_move(c,g.id,g.mode,g,n)}}else this._update_item_on_move(c,a.id,a.mode,a,n);e._update_parents(a.id)}}},on_mouse_down:function(n,r){if(2!=n.button||void 0===n.button){var a=t.$getConfig(),o=e.locate(n),s=null;if(e.isTaskExists(o)&&(s=e.getTask(o)),!e.isReadonly(s)&&!this.drag.mode){this.clear_drag_state(),r=r||n.target||n.srcElement;var l=i.getClassName(r),c=this._get_drag_mode(l,r);if(!l||!c)return r.parentNode?this.on_mouse_down(n,r.parentNode):void 0;if(c)if(c.mode&&c.mode!=a.drag_mode.ignore&&a["drag_"+c.mode]){if(o=e.locate(r),s=e.copy(e.getTask(o)||{}),e.isReadonly(s))return this.clear_drag_state(),!1;if(e.isSummaryTask(s)&&!a.drag_project&&c.mode!=a.drag_mode.progress)return void this.clear_drag_state();c.id=o;var u=i.getRelativeEventPosition(n,e.$task_data);c.start_x=u.x,c.start_y=u.y,c.obj=s,this.drag.start_drag=c,this.drag.timestamp=Date.now()}else this.clear_drag_state();else if(e.checkEvent("onMouseDown")&&e.callEvent("onMouseDown",[l.split(" ")[0]])&&r.parentNode)return this.on_mouse_down(n,r.parentNode)}}},_fix_dnd_scale_time:function(n,i){var r=t.$getConfig(),a=e.getScale().unit,o=e.getScale().step;function s(n){if(e.config.correct_work_time){var i=t.$getConfig();e.isWorkTime(n.start_date,void 0,n)||(n.start_date=e.calculateEndDate({start_date:n.start_date,duration:-1,unit:i.duration_unit,task:n}))}}r.round_dnd_dates||(a="minute",o=r.time_step),i.mode==r.drag_mode.resize?i.left?(n.start_date=e.roundDate({date:n.start_date,unit:a,step:o}),s(n)):(n.end_date=e.roundDate({date:n.end_date,unit:a,step:o}),function(n){if(e.config.correct_work_time){var i=t.$getConfig();e.isWorkTime(new Date(n.end_date-1),void 0,n)||(n.end_date=e.calculateEndDate({start_date:n.end_date,duration:1,unit:i.duration_unit,task:n}))}}(n)):i.mode==r.drag_mode.move&&(n.start_date=e.roundDate({date:n.start_date,unit:a,step:o}),s(n),n.end_date=e.calculateEndDate(n))},_fix_working_times:function(n,i){var r=t.$getConfig();(i=i||{mode:r.drag_mode.move}).mode==r.drag_mode.resize?i.left?n.start_date=e.getClosestWorkTime({date:n.start_date,dir:"future",task:n}):n.end_date=e.getClosestWorkTime({date:n.end_date,dir:"past",task:n}):i.mode==r.drag_mode.move&&e.correctTaskWorkTime(n)},_finalize_mouse_up:function(t,n,i,r){var a=e.getTask(t);if(n.work_time&&n.correct_work_time&&this._fix_working_times(a,i),this._fix_dnd_scale_time(a,i),this._fireEvent("before_finish",i.mode,[t,i.mode,e.copy(i.obj),r])){var o=t;e._init_task_timing(a),this.clear_drag_state(),e.updateTask(a.id),this._fireEvent("after_finish",i.mode,[o,i.mode,r])}else this.clear_drag_state(),t==i.id&&(i.obj._dhx_changed=!1,e.mixin(a,i.obj,!0)),e.refreshTask(a.id)},on_mouse_up:function(n){var i=this.drag;if(i.mode&&i.id){var r=t.$getConfig(),a=e.getTask(i.id),o=this.dragMultiple;if(i.mode===r.drag_mode.move&&(e.isSummaryTask(a)&&r.drag_project||this._isMultiselect()))for(var s in o)this._finalize_mouse_up(o[s].id,r,o[s],n);this._finalize_mouse_up(i.id,r,i,n)}this.clear_drag_state()},_get_drag_mode:function(e,n){var i=t.$getConfig().drag_mode,r={mode:null,left:null};switch((e||"").split(" ")[0]){case"gantt_task_line":case"gantt_task_content":r.mode=i.move;break;case"gantt_task_drag":r.mode=i.resize;var a=n.getAttribute("data-bind-property");r.left="start_date"==a;break;case"gantt_task_progress_drag":r.mode=i.progress;break;case"gantt_link_control":case"gantt_link_point":r.mode=i.ignore;break;default:r=null}return r},_start_dnd:function(n){var i=this.drag=this.drag.start_drag;delete i.start_drag;var r=t.$getConfig(),a=i.id;if(r["drag_"+i.mode]&&e.callEvent("onBeforeDrag",[a,i.mode,n])&&this._fireEvent("before_start",i.mode,[a,i.mode,n])){delete i.start_drag;var s=e.getTask(a);if(e.isReadonly(s))return void this.clear_drag_state();if(this._isMultiselect()){var l=e.getSelectedTasks();l.indexOf(i.id)>=0&&o.forEach(l,e.bind(function(t){var n=e.getTask(t);e.isSummaryTask(n)&&e.config.drag_project&&i.mode==r.drag_mode.move&&this._addSubtasksToDragMultiple(n.id),this.dragMultiple[t]=e.mixin({id:n.id,obj:e.copy(n)},this.drag)},this))}e.isSummaryTask(s)&&e.config.drag_project&&i.mode==r.drag_mode.move&&this._addSubtasksToDragMultiple(s.id),e.callEvent("onTaskDragStart",[])}else this.clear_drag_state()},_fireEvent:function(t,n,i){e.assert(this._events[t],"Invalid stage:{"+t+"}");var r=this._events[t][n];return e.assert(r,"Unknown after drop mode:{"+n+"}"),e.assert(i,"Invalid event arguments"),!e.checkEvent(r)||e.callEvent(r,i)},round_task_dates:function(e){var n=this.drag,i=t.$getConfig();n||(n={mode:i.drag_mode.move}),this._fix_dnd_scale_time(e,n)},destructor:function(){this._domEvents.detachAll()},_isMultiselect:function(){return e.config.drag_multiple&&!!(e.getSelectedTasks&&e.getSelectedTasks().length>0)},_addSubtasksToDragMultiple:function(t){e.eachTask(function(t){this.dragMultiple[t.id]=e.mixin({id:t.id,obj:e.copy(t)},this.drag)},t,this)}}}(e,n),e._tasks_dnd=t,t.init(n)},destructor:function(){t&&(t.destructor(),t=null)}}}}},function(t,e,n){var i=n(0),r=n(72),a=n(71),o=n(1),s=function(t){var e=t.$services;return{onCreated:function(e){var o=e.$config;o.bind=i.defined(o.bind)?o.bind:"task",o.bindLinks=i.defined(o.bindLinks)?o.bindLinks:"link",e._linksDnD=a.createLinkDND(),e._tasksDnD=r.createTaskDND(),e._tasksDnD.extend(e),this._mouseDelegates=n(20)(t)},onInitialized:function(e){this._attachDomEvents(t),this._attachStateProvider(t,e),e._tasksDnD.init(e,t),e._linksDnD.init(e,t),"timeline"==e.$config.id&&this.extendDom(e)},onDestroyed:function(e){this._clearDomEvents(t),this._clearStateProvider(t),e._tasksDnD&&e._tasksDnD.destructor()},extendDom:function(e){t.$task=e.$task,t.$task_scale=e.$task_scale,t.$task_data=e.$task_data,t.$task_bg=e.$task_bg,t.$task_links=e.$task_links,t.$task_bars=e.$task_bars},_clearDomEvents:function(){this._mouseDelegates.destructor(),this._mouseDelegates=null},_attachDomEvents:function(t){function e(e,n){if(e&&this.callEvent("onLinkDblClick",[e,n])){var i=this.getLink(e);if(this.isReadonly(i))return;var r=this.locale.labels.link+" "+this.templates.link_description(this.getLink(e))+" "+this.locale.labels.confirm_link_deleting;window.setTimeout(function(){t._dhtmlx_confirm(r,"",function(){t.deleteLink(e)})},this.config.touch?300:1)}}this._mouseDelegates.delegate("click","gantt_task_link",t.bind(function(t,e){var n=this.locate(t,this.config.link_attribute);n&&this.callEvent("onLinkClick",[n,t])},t),this.$task),this._mouseDelegates.delegate("click","gantt_scale_cell",t.bind(function(e,n){var i=o.getRelativeEventPosition(e,t.$task_data),r=t.dateFromPos(i.x),a=Math.floor(t.columnIndexByDate(r)),s=t.getScale().trace_x[a];t.callEvent("onScaleClick",[e,s])},t),this.$task),this._mouseDelegates.delegate("doubleclick","gantt_task_link",t.bind(function(n,i,r){i=this.locate(n,t.config.link_attribute),e.call(this,i,n)},t),this.$task),this._mouseDelegates.delegate("doubleclick","gantt_link_point",t.bind(function(t,n,i){n=this.locate(t);var r=this.getTask(n),a=null;return i.parentNode&&o.getClassName(i.parentNode)&&(a=o.getClassName(i.parentNode).indexOf("_left")>-1?r.$target[0]:r.$source[0]),a&&e.call(this,a,t),!1},t),this.$task)},_attachStateProvider:function(t,n){var i=n;e.getService("state").registerProvider("tasksTimeline",function(){return{scale_unit:i._tasks?i._tasks.unit:void 0,scale_step:i._tasks?i._tasks.step:void 0}})},_clearStateProvider:function(){e.getService("state").unregisterProvider("tasksTimeline")}}};t.exports=s},function(t,e,n){var i=n(1);function r(t,e){var n=i.getNodePosition(e.$grid_data);return t.x+=n.x-e.$grid.scrollLeft,t.y+=n.y-e.$grid_data.scrollTop,t}t.exports={removeLineHighlight:function(t){t.markerLine&&t.markerLine.parentNode&&t.markerLine.parentNode.removeChild(t.markerLine),t.markerLine=null},highlightPosition:function(t,e,n){var a=function(t,e){var n=i.getNodePosition(e.$grid_data),r=i.getRelativeEventPosition(t,e.$grid_data),a=e.$config.rowStore,o=n.x,s=r.y-10,l=e.$getConfig();sn.y+c-l.row_height&&(s=n.y+c-l.row_height),n.x=o,n.y=s,n}(t,n);e.marker.style.left=a.x+9+"px",e.marker.style.top=a.y+"px";var o=e.markerLine;o||((o=document.createElement("div")).className="gantt_drag_marker gantt_grid_dnd_marker",o.innerHTML="
",o.style.pointerEvents="none",document.body.appendChild(o),e.markerLine=o),t.child?function(t,e,n){var i=t.targetParent,a=r({x:0,y:n.getItemTop(i)},n);e.innerHTML="
",e.style.width=n.$grid_data.offsetWidth+"px",e.style.top=a.y+"px",e.style.left=a.x+"px",e.style.height=n.getItemHeight(i)+"px"}(t,o,n):function(t,e,n){var i=function(t,e){var n=e.$config.rowStore,i={x:0,y:0},a=e.$grid_data.querySelector(".gantt_tree_indent"),o=15,s=0;if(a&&(o=a.offsetWidth),t.targetId!==n.$getRootId()){var l=e.getItemTop(t.targetId),c=e.getItemHeight(t.targetId);if(s=n.exists(t.targetId)?n.calculateItemLevel(n.getItem(t.targetId)):0,t.prevSibling)i.y=l;else if(t.nextSibling){var u=0;n.eachItem(function(t){-1!==n.getIndexById(t.id)&&u++},t.targetId),i.y=l+c+u*c}else i.y=l+c,s+=1}return i.x=40+s*o,i.width=Math.max(e.$grid_data.offsetWidth-i.x,0),r(i,e)}(t,n);e.innerHTML="
",e.style.left=i.x+"px",e.style.height="4px",e.style.top=i.y-2+"px",e.style.width=i.width+"px"}(t,o,n)}}},function(t,e,n){var i=n(15);t.exports=function(t,e,n,r,a){var o;if(e!==a.$getRootId())o=n<.25?i.prevSiblingTarget(t,e,a):!(n>.6)||a.hasChild(e)&&a.getItem(e).$open?i.firstChildTarget(t,e,a):i.nextSiblingTarget(t,e,a);else{var s=a.$getRootId();o=a.hasChild(s)&&r>=0?i.lastChildTarget(t,s,a):i.firstChildTarget(t,s,a)}return o}},function(t,e,n){var i=n(15);function r(t,e,n,r,a){for(var o=e;r.exists(o);){var s=r.calculateItemLevel(r.getItem(o));if((s===n||s===n-1)&&r.getBranchIndex(o)>-1)break;o=a?r.getPrev(o):r.getNext(o)}return r.exists(o)?r.calculateItemLevel(r.getItem(o))===n?a?i.nextSiblingTarget(t,o,r):i.prevSiblingTarget(t,o,r):i.firstChildTarget(t,o,r):null}function a(t,e,n,i){return r(t,e,n,i,!0)}function o(t,e,n,i){return r(t,e,n,i,!1)}t.exports=function(t,e,n,r,s,l){var c;if(e!==s.$getRootId())n<.5?s.calculateItemLevel(s.getItem(e))===l?c=s.getPrevSibling(e)?i.nextSiblingTarget(t,s.getPrevSibling(e),s):i.prevSiblingTarget(t,e,s):(c=a(t,e,l,s))&&(c=o(t,e,l,s)):s.calculateItemLevel(s.getItem(e))===l?c=i.nextSiblingTarget(t,e,s):(c=o(t,e,l,s))&&(c=a(t,e,l,s));else{var u=s.$getRootId(),d=s.getChildren(u);c=i.createDropTargetObject(),c=d.length&&r>=0?a(t,function(t){for(var e=t.getNext();t.exists(e);){var n=t.getNext(e);if(!t.exists(n))return e;e=n}return null}(s),l,s):o(t,u,l,s)}return c}},function(t,e,n){var i=n(1),r=n(15),a=n(76),o=n(75),s=n(74);t.exports={init:function(t,e){var n=t.$services.getService("dnd");if(e.$config.bind&&t.getDatastore(e.$config.bind)){var l=new n(e.$grid_data,{updates_per_second:60});t.defined(e.$getConfig().dnd_sensitivity)&&(l.config.sensitivity=e.$getConfig().dnd_sensitivity),l.attachEvent("onBeforeDragStart",t.bind(function(n,r){var a=c(r);if(!a)return!1;if(t.hideQuickInfo&&t._hideQuickInfo(),i.closest(r.target,".gantt_grid_editor_placeholder"))return!1;var o=a.getAttribute(e.$config.item_attribute),s=e.$config.rowStore.getItem(o);return!t.isReadonly(s)&&(l.config.initial_open_state=s.$open,!!t.callEvent("onRowDragStart",[o,r.target||r.srcElement,r])&&void 0)},t)),l.attachEvent("onAfterDragStart",t.bind(function(t,n){var i=c(n);l.config.marker.innerHTML=i.outerHTML;var a=l.config.marker.firstChild;a&&(l.config.marker.style.opacity=.4,a.style.position="static",a.style.pointerEvents="none"),l.config.id=i.getAttribute(e.$config.item_attribute);var o=e.$config.rowStore,s=o.getItem(l.config.id);l.config.level=o.calculateItemLevel(s),l.config.drop_target=r.createDropTargetObject({targetParent:o.getParent(s.id),targetIndex:o.getBranchIndex(s.id),targetId:s.id,nextSibling:!0}),s.$open=!1,s.$transparent=!0,this.refreshData()},t)),l.attachEvent("onDragMove",t.bind(function(n,i){var a=u(i);return a&&!1!==t.callEvent("onBeforeRowDragMove",[l.config.id,a.targetParent,a.targetIndex])||(a=r.createDropTargetObject(l.config.drop_target)),s.highlightPosition(a,l.config,e),l.config.drop_target=a,this.callEvent("onRowDragMove",[l.config.id,a.targetParent,a.targetIndex]),!0},t)),l.attachEvent("onDragEnd",t.bind(function(){var t=e.$config.rowStore,n=t.getItem(l.config.id);s.removeLineHighlight(l.config),n.$transparent=!1,n.$open=l.config.initial_open_state;var i=l.config.drop_target;!1===this.callEvent("onBeforeRowDragEnd",[l.config.id,i.targetParent,i.targetIndex])?n.$drop_target=null:(t.move(l.config.id,i.targetIndex,i.targetParent),this.callEvent("onRowDragEnd",[l.config.id,i.targetParent,i.targetIndex])),t.refresh(n.id)},t))}function c(t){return i.locateAttribute(t,e.$config.item_attribute)}function u(t){var n=function(t){var n=i.getRelativeEventPosition(t,e.$grid_data).y,r=e.$config.rowStore;if((n=n||0)<0)return r.$getRootId();var a=Math.floor(n/e.getItemHeight());return a>r.countVisible()-1?r.$getRootId():r.getIdByIndex(a)}(t),r=null,s=e.$config.rowStore,c=!e.$getConfig().order_branch_free,u=i.getRelativeEventPosition(t,e.$grid_data).y;return n!==s.$getRootId()&&(r=(u-e.getItemTop(n))/e.getItemHeight()),c?a(l.config.id,n,r,u,s,l.config.level):o(l.config.id,n,r,u,s)}}}},function(t,e,n){var i=n(1);t.exports={init:function(t,e){var n=t.$services.getService("dnd");if(e.$config.bind&&t.getDatastore(e.$config.bind)){var r=new n(e.$grid_data,{updates_per_second:60});t.defined(e.$getConfig().dnd_sensitivity)&&(r.config.sensitivity=e.$getConfig().dnd_sensitivity),r.attachEvent("onBeforeDragStart",t.bind(function(n,s){var l=a(s);if(!l)return!1;if(t.hideQuickInfo&&t._hideQuickInfo(),i.closest(s.target,".gantt_grid_editor_placeholder"))return!1;var c=l.getAttribute(e.$config.item_attribute),u=o().getItem(c);return!t.isReadonly(u)&&(r.config.initial_open_state=u.$open,!!t.callEvent("onRowDragStart",[c,s.target||s.srcElement,s])&&void 0)},t)),r.attachEvent("onAfterDragStart",t.bind(function(t,n){var i=a(n);r.config.marker.innerHTML=i.outerHTML;var s=r.config.marker.firstChild;s&&(s.style.position="static"),r.config.id=i.getAttribute(e.$config.item_attribute);var l=o(),c=l.getItem(r.config.id);r.config.index=l.getBranchIndex(r.config.id),r.config.parent=c.parent,c.$open=!1,c.$transparent=!0,this.refreshData()},t)),r.lastTaskOfLevel=function(t){for(var e=null,n=o().getItems(),i=0,r=n.length;in.y+c-l.row_height&&(s=n.y+c-l.row_height),n.x=a,n.y=s,n},t),r._getTargetY=t.bind(function(t){var n=i.getNodePosition(e.$grid_data),r=t.pageY-n.y+(e.$state.scrollTop||0);return r<0&&(r=0),r},t),r._getTaskByY=t.bind(function(t,n){var i=e.$getConfig(),r=o();t=t||0;var a=Math.floor(t/i.row_height);return(a=nr.countVisible()-1?null:r.getIdByIndex(a)},t),r.attachEvent("onDragMove",t.bind(function(t,n){var i=r.config,a=r._getGridPos(n),s=e.$getConfig(),l=o();i.marker.style.left=a.x+10+"px",i.marker.style.top=a.y+"px";var c=l.getItem(r.config.id),u=r._getTargetY(n),d=r._getTaskByY(u,l.getIndexById(c.id));function h(t,e){return!l.isChildOf(f.id,e.id)&&(t.$level==e.$level||s.order_branch_free)}if(l.exists(d)||(d=r.lastTaskOfLevel(s.order_branch_free?c.$level:0))==r.config.id&&(d=null),l.exists(d)){var f=l.getItem(d);if(l.getIndexById(f.id)*s.row_height+s.row_height/2=0;)v=l.getIdByIndex(_-y),m=l.getItem(v),y++;if(c.id==f.id)return;h(f,c)&&c.id!=f.id?l.move(c.id,0,0,f.id):f.$level!=c.$level-1||l.getChildren(f.id).length?m&&h(m,c)&&c.id!=m.id&&l.move(c.id,-1,l.getParent(m.id)):l.move(c.id,0,f.id)}return!0},t)),r.attachEvent("onDragEnd",t.bind(function(){var t=o(),e=t.getItem(r.config.id);e.$transparent=!1,e.$open=r.config.initial_open_state,!1===this.callEvent("onBeforeRowDragEnd",[r.config.id,r.config.parent,r.config.index])?(t.move(r.config.id,r.config.index,r.config.parent),e.$drop_target=null):this.callEvent("onRowDragEnd",[r.config.id,e.$drop_target]),this.refreshData()},t))}function a(t){return i.locateAttribute(t,e.$config.item_attribute)}function o(){return t.getDatastore(e.$config.bind)}}}},function(t,e,n){var i=n(0),r=n(78),a=n(77),o=function(t){return{onCreated:function(e){e.$config=i.mixin(e.$config,{bind:"task"}),"grid"==e.$config.id&&(this.extendGantt(e),t.ext.inlineEditors=t.ext._inlineEditors.createEditors(e),t.ext.inlineEditors.init()),this._mouseDelegates=n(20)(t)},onInitialized:function(e){var n=e.$getConfig();n.order_branch&&("marker"==n.order_branch?a.init(e.$gantt,e):r.init(e.$gantt,e)),this.initEvents(e,t),"grid"==e.$config.id&&this.extendDom(e)},onDestroyed:function(e){"grid"==e.$config.id&&t.ext.inlineEditors.destructor(),this.clearEvents(e,t)},initEvents:function(t,e){this._mouseDelegates.delegate("click","gantt_row",e.bind(function(n,i,r){var a=t.$getConfig();if(null!==i){var o=this.getTask(i);a.scroll_on_click&&!e._is_icon_open_click(n)&&this.showDate(o.start_date),e.callEvent("onTaskRowClick",[i,r])}},e),t.$grid),this._mouseDelegates.delegate("click","gantt_grid_head_cell",e.bind(function(n,i,r){var a=r.getAttribute("data-column-id");if(e.callEvent("onGridHeaderClick",[a,n])){var o=t.$getConfig();if("add"!=a){if(o.sort){for(var s,l=a,c=0;c"+l+""),c&&(l="
"+l),l&&(u.innerHTML=l),u}return null}return{render:function(i,r,s){var l=r.$getConfig(),c=r.$getTemplates(),h=r.getScale(),g=e(i,l.resource_property,h,r),p=[],v={},m=i.capacity||r.$config.capacity||24;n[i.id]={},u[i.id]=null,d[i.id]=null;for(var y=!!s,k=a(h,s),b=k.start;b<=k.end;b++){var w=g[b];if(w&&(!y||o(b,h,s,t))){var x=c.histogram_cell_capacity(w.start_date,w.end_date,i,w.tasks);v[w.start_date.valueOf()]=x||0;var T=r.getItemPosition(i,w.start_date,w.end_date),$=_(i,T,m,l,c,w,r);$&&(p.push($),n[i.id][b]=$)}}var S=null;if(p.length){S=document.createElement("div");for(var C=0;C",f=""):(h=g.template?g.template(e):e[g.name],i.isDate(h)&&(h=s.date_grid(h,e,g.name)),null!==h&&void 0!==h||(h=""),f=h,h="
"+h+"
");var p="gantt_cell"+(_?" gantt_last_cell":""),v=[];if(g.tree){p+=" gantt_cell_tree";for(var m=0;m"+v.join("")+"",c.push(d)}if(p=t.getGlobalTaskIndex(e.id)%2==0?"":" odd",p+=e.$transparent?" gantt_transparent":"",p+=e.$dataprocessor_class?" "+e.$dataprocessor_class:"",s.grid_row_class){var w=s.grid_row_class.call(t,e.start_date,e.end_date,e);w&&(p+=" "+w)}l.isSelected(e.id)&&(p+=" gantt_selected");var x=document.createElement("div");x.className="gantt_row"+p+" gantt_row_"+t.getTaskType(e.type);var T=n.getItemHeight();return x.style.height=T+"px",x.style.lineHeight=T+"px",o.smart_rendering&&(x.style.position="absolute",x.style.left="0px",x.style.top=n.getItemTop(e.id)+"px"),n.$config.item_attribute&&(x.setAttribute(n.$config.item_attribute,e.id),x.setAttribute(n.$config.bind+"_id",e.id)),t._waiAria.taskRowAttr(e,x),x.innerHTML=c.join(""),x},update:null,getRectangle:r,getVisibleRange:a}}},function(t,e){t.exports=function(t,e,n,i){var r=n.$gantt.getTask(t.source),a=n.$gantt.getTask(t.target),o=n.$getConfig(),s=n.getItemTop(r.id),l=o.row_height,c=n.getItemTop(a.id),u=o.row_height;if(e.y>s+l&&e.y>c+u)return!1;if(e.y_endh){var g=h;h=d,d=g}if(f>_){g=_;_=f,f=g}return d+=-100,h+=100,f+=-100,_+=100,!(e.x>h&&e.x>_)&&!(e.x_endt.x?this.dirs.right:e.y>t.y?this.dirs.down:this.dirs.up}},n={path:[],clear:function(){this.path=[]},current:function(){return this.path[this.path.length-1]},point:function(e){return e?(this.path.push(t.copy(e)),e):this.current()},point_to:function(n,i,r){r=r?{x:r.x,y:r.y}:t.copy(this.point());var a=e.dirs;switch(n){case a.left:r.x-=i;break;case a.right:r.x+=i;break;case a.up:r.y-=i;break;case a.down:r.y+=i}return this.point(r)},get_points:function(n,i){var r=this.get_endpoint(n,i),a=t.config,o=r.e_y-r.y,s=r.e_x-r.x,l=e.dirs;this.clear(),this.point({x:r.x,y:r.y});var c=2*a.link_arrow_size,u=this.get_line_type(n,i.$getConfig()),d=r.e_x>r.x;if(u.from_start&&u.to_start)this.point_to(l.left,c),d?(this.point_to(l.down,o),this.point_to(l.right,s)):(this.point_to(l.right,s),this.point_to(l.down,o)),this.point_to(l.right,c);else if(!u.from_start&&u.to_start)if(d=r.e_x>r.x+2*c,this.point_to(l.right,c),d)s-=c,this.point_to(l.down,o),this.point_to(l.right,s);else{s-=2*c;var h=o>0?1:-1;this.point_to(l.down,h*(a.row_height/2)),this.point_to(l.right,s),this.point_to(l.down,h*(Math.abs(o)-a.row_height/2)),this.point_to(l.right,c)}else u.from_start||u.to_start?u.from_start&&!u.to_start&&(d=r.e_x>r.x-2*c,this.point_to(l.left,c),d?(s+=2*c,h=o>0?1:-1,this.point_to(l.down,h*(a.row_height/2)),this.point_to(l.right,s),this.point_to(l.down,h*(Math.abs(o)-a.row_height/2)),this.point_to(l.left,c)):(s+=c,this.point_to(l.down,o),this.point_to(l.right,s))):(this.point_to(l.right,c),d?(this.point_to(l.right,s),this.point_to(l.down,o)):(this.point_to(l.down,o),this.point_to(l.right,s)),this.point_to(l.left,c));return this.path},get_line_type:function(e,n){var i=n.links,r=!1,a=!1;return e.type==i.start_to_start?r=a=!0:e.type==i.finish_to_finish?r=a=!1:e.type==i.finish_to_start?(r=!1,a=!0):e.type==i.start_to_finish?(r=!0,a=!1):t.assert(!1,"Invalid link type"),n.rtl&&(r=!r,a=!a),{from_start:r,to_start:a}},get_endpoint:function(e,n){var i=n.$getConfig(),a=this.get_line_type(e,i),o=a.from_start,s=a.to_start,l=t.getTask(e.source),c=t.getTask(e.target),u=r(l,n),d=r(c,n);return{x:o?u.left:u.left+u.width,e_x:s?d.left:d.left+d.width,y:u.top,e_y:d.top}}};function r(e,n){var i=n.$getConfig(),r=n.getItemPosition(e);if(t.getTaskType(e.type)==i.types.milestone){var a=t.getTaskHeight(),o=Math.sqrt(2*a*a);r.left-=o/2,r.width=o}return r}return{render:function(i,r){var a=r.$getConfig(),o=n.get_endpoint(i,r),s=o.e_y-o.y;if(!(o.e_x-o.x||s))return null;var l=n.get_points(i,r),c=e.get_lines(l,r),u=document.createElement("div"),d="gantt_task_link";i.color&&(d+=" gantt_link_inline_color");var h=t.templates.link_class?t.templates.link_class(i):"";h&&(d+=" "+h),a.highlight_critical_path&&t.isCriticalLink&&t.isCriticalLink(i)&&(d+=" gantt_critical_link"),u.className=d,r.$config.link_attribute&&(u.setAttribute(r.$config.link_attribute,i.id),u.setAttribute("link_id",i.id));for(var f=0;fg.end)&&c(t.id,v)}n[t.id]={};for(var m=g.start;m<=g.end;m++){var y=d(h,m,t,a,f,_,s);!y&&l(t,m)?c(t.id,m):y&&!y.parentNode&&i.appendChild(y)}}},getRectangle:i,getVisibleRange:a}}},function(t,e,n){var i=n(28);t.exports=function(t,e,n,r){if(!r.isSplitTask(t))return!1;var a=r.getSubtaskDates(t.id);return i({id:t.id,start_date:a.start_date,end_date:a.end_date,parent:t.parent},e,n,r)}},function(t,e,n){var i=n(27),r=n(86),a=n(6);t.exports=function(t){var e=i(t);return{render:function(n,i){if(t.isSplitTask(n)&&(t.config.open_split_tasks&&!n.$open||!t.config.open_split_tasks)){var r=document.createElement("div"),a=t.getTaskPosition(n);return t.hasChild(n.id)&&t.eachTask(function(n){var o=t.isSummaryTask(n);o&&t.resetProjectDates(n);var s=e(n,i);if(s){var l=Math.floor((t.config.row_height-a.height)/2);s.style.top=a.top+l+"px",s.classList.add("gantt_split_child"),o&&s.classList.add("gantt_split_subproject"),r.appendChild(s)}},n.id),r}return!1},update:null,isInViewPort:r,getVisibleRange:a}}},function(t,e,n){var i=n(28),r=n(6),a=n(27);t.exports=function(t){return{render:a(t),update:null,isInViewPort:i,getVisibleRange:r}}},function(t,e){t.exports=function(t){return function(e,n,i){"keepDates"==i?function(e,n){"duration"==n?e.end_date=t.calculateEndDate(e):"end_date"!=n&&"start_date"!=n||(e.duration=t.calculateDuration(e))}(e,n):"keepDuration"==i?function(e,n){"end_date"==n?e.start_date=t.calculateEndDate({start_date:e.end_date,duration:-e.duration,task:e}):"start_date"!=n&&"duration"!=n||(e.end_date=t.calculateEndDate(e))}(e,n):function(e,n){"start_date"==n||"duration"==n?e.end_date=t.calculateEndDate(e):"end_date"==n&&(e.duration=t.calculateDuration(e))}(e,n)}}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}function a(e){return e.formatter||t.ext.formatters.durationFormatter()}return n(2)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r},set_value:function(t,e,n,i){this.get_input(i).value=a(n.editor).format(t)},get_value:function(t,e,n){return a(e.editor).parse(this.get_input(n).value||"")}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}function a(e){return e.formatter||t.ext.formatters.linkFormatter()}function o(t,e){for(var n=(t||"").split(e.delimiter||","),i=0;i";i.innerHTML=r},hide:function(){},set_value:function(e,n,i,r){this.get_input(r).value=s(e,i.editor,t)},get_value:function(t,e,n){return o(this.get_input(n).value||"",e.editor)},save:function(e,n,i){var r=c(t.getTask(e),this.get_value(e,n,i),n.editor);(r.add.length||r.remove.length)&&t.batchUpdate(function(){r.add.forEach(function(e){t.addLink(e)}),r.remove.forEach(function(e){t.deleteLink(e)}),t.autoSchedule&&t.autoSchedule()})},is_changed:function(e,n,i,r){var a=this.get_value(n,i,r),l=o(s(e,i.editor,t),i.editor);return a.join()!==l.join()}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0),r="%Y-%m-%d",a=null,o=null;function s(){return e.apply(this,arguments)||this}return n(2)(s,e),i.mixin(s.prototype,{show:function(e,n,i,s){a||(a=t.date.date_to_str(r)),o||(o=t.date.str_to_date(r));var l=null,c=null;l="function"==typeof i.min?i.min(e,n):i.min,c="function"==typeof i.max?i.max(e,n):i.max;var u="
";s.innerHTML=u},set_value:function(t,e,n,i){t&&t.getFullYear?this.get_input(i).value=a(t):this.get_input(i).value=t},is_valid:function(t,e,n,i){return!(!t||isNaN(t.getTime()))},get_value:function(t,e,n){var i;try{i=o(this.get_input(n).value||"")}catch(t){i=null}return i}},!0),s}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(2)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){for(var r="
",i.innerHTML=r},get_input:function(t){return t.querySelector("select")}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(2)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r},get_value:function(t,e,n){return this.get_input(n).value||""},is_valid:function(t,e,n,i){return!isNaN(parseInt(t,10))}},!0),r}},function(t,e,n){t.exports=function(t){var e=n(7)(t),i=n(0);function r(){return e.apply(this,arguments)||this}return n(2)(r,e),i.mixin(r.prototype,{show:function(t,e,n,i){var r="
";i.innerHTML=r}},!0),r}},function(t,e){t.exports={init:function(t,e){var n=t,i=e.$gantt,r=null,a=i.ext.keyboardNavigation;a.attachEvent("onBeforeFocus",function(e){var i=t.locateCell(e);if(clearTimeout(r),i){var a=i.columnName,o=i.id,s=n.getState();if(n.isVisible()&&s.id==o&&s.columnName===a)return!1}return!0}),a.attachEvent("onFocus",function(e){var i=t.locateCell(e),a=t.getState();return clearTimeout(r),!i||i.id==a.id&&i.columnName==a.columnName||n.isVisible()&&n.save(),!0}),t.attachEvent("onHide",function(){clearTimeout(r)}),a.attachEvent("onBlur",function(){return r=setTimeout(function(){n.save()}),!0}),i.attachEvent("onTaskDblClick",function(e,n){var i=t.getState(),r=t.locateCell(n.target);return!r||!t.isVisible()||r.columnName!=i.columnName}),i.attachEvent("onTaskClick",function(e,n){if(i._is_icon_open_click(n))return!0;var r=t.getState(),a=t.locateCell(n.target);return!a||!t.getEditorConfig(a.columnName)||(t.isVisible()&&r.id==a.id&&r.columnName==a.columnName||t.startEdit(a.id,a.columnName),!1)}),i.attachEvent("onEmptyClick",function(){return n.save(),!0}),a.attachEvent("onKeyDown",function(e,r){var o=t.locateCell(r.target),s=!!o&&t.getEditorConfig(o.columnName),l=t.getState(),c=i.constants.KEY_CODES,u=r.keyCode,d=!1;switch(u){case c.ENTER:t.isVisible()?(t.save(),r.preventDefault(),d=!0):s&&!(r.ctrlKey||r.metaKey||r.shiftKey)&&(n.startEdit(o.id,o.columnName),r.preventDefault(),d=!0);break;case c.ESC:t.isVisible()&&(t.hide(),r.preventDefault(),d=!0);break;case c.UP:case c.DOWN:break;case c.LEFT:case c.RIGHT:(s&&t.isVisible()||"date"===l.editorType)&&(d=!0);break;case c.SPACE:t.isVisible()&&(d=!0),s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),r.preventDefault(),d=!0);break;case c.DELETE:s&&!t.isVisible()?(n.startEdit(o.id,o.columnName),d=!0):s&&t.isVisible()&&(d=!0);break;case c.TAB:if(t.isVisible()){r.shiftKey?t.editPrevCell(!0):t.editNextCell(!0);var h=t.getState();h.id&&a.focus({type:"taskCell",id:h.id,column:h.columnName}),r.preventDefault(),d=!0}break;default:if(t.isVisible())d=!0;else if(u>=48&&u<=57||u>95&&u<112||u>=64&&u<=91||u>185&&u<193||u>218&&u<223){var f=e.modifiers,_=f.alt||f.ctrl||f.meta||f.shift;f.alt||_&&a.getCommandHandler(e,"taskCell")||s&&!t.isVisible()&&(n.startEdit(o.id,o.columnName),d=!0)}}return!d})},onShow:function(t,e,n){},onHide:function(t,e,n){n.$gantt.focus()},destroy:function(){}}},function(t,e){t.exports={init:function(t,e){var n=e.$gantt;n.attachEvent("onTaskClick",function(e,i){if(n._is_icon_open_click(i))return!0;var r=t.getState(),a=t.locateCell(i.target);return!a||!t.getEditorConfig(a.columnName)||(t.isVisible()&&r.id==a.id&&r.columnName==a.columnName||t.startEdit(a.id,a.columnName),!1)}),n.attachEvent("onEmptyClick",function(){return t.isVisible()&&t.isChanged()?t.save():t.hide(),!0}),n.attachEvent("onTaskDblClick",function(e,n){var i=t.getState(),r=t.locateCell(n.target);return!r||!t.isVisible()||r.columnName!=i.columnName||(t.hide(),!1)})},onShow:function(t,e,n){var i=n.$gantt;i.ext&&i.ext.keyboardNavigation&&i.ext.keyboardNavigation.attachEvent("onKeyDown",function(e,n){var r=i.constants.KEY_CODES,a=!1;switch(n.keyCode){case r.SPACE:t.isVisible()&&(a=!0)}return!a});e.onkeydown=function(e){e=e||window.event;var n=i.constants.KEY_CODES;if(!(e.defaultPrevented||e.shiftKey&&e.keyCode!=n.TAB)){var r=!0;switch(e.keyCode){case i.keys.edit_save:t.save();break;case i.keys.edit_cancel:t.hide();break;case n.UP:case n.DOWN:t.isVisible()&&(t.hide(),r=!1);break;case n.TAB:e.shiftKey?t.editPrevCell(!0):t.editNextCell(!0);break;default:r=!1}r&&e.preventDefault()}}},onHide:function(){},destroy:function(){}}},function(t,e,n){var i=n(97),r=n(96);t.exports=function(t){var e=null;return{setMapping:function(t){e=t},getMapping:function(){return e||(t.config.keyboard_navigation_cells?r:i)}}}},function(t,e,n){var i=n(98),r=n(95),a=n(94),o=n(93),s=n(92),l=n(91),c=n(90),u=n(0),d=n(1),h=n(4),f=n(89);function _(t){t.config.editor_types={text:new(r(t)),number:new(a(t)),select:new(o(t)),date:new(s(t)),predecessor:new(l(t)),duration:new(c(t))}}t.exports=function(t){var e=i(t),n={};h(n);var r={init:_,createEditors:function(i){function r(t,e){var n=i.$getConfig(),r=function(t,e){for(var n=i.$getConfig(),r=i.getItemTop(t),a=i.getItemHeight(t),o=i.getGridColumns(),s=0,l=0,c=0,u=0;u0?t.getNext:t.getPrev,i=(n=t.bind(n,t))(this._itemId);t.isTaskExists(i)&&t.isReadonly(t.getTask(i));)i=n(i);return i},editNextRow:function(){var t=this.getNextCell(1);t&&this.startEdit(t,this._columnName)},editPrevRow:function(){var t=this.getNextCell(-1);t&&this.startEdit(t,this._columnName)},destructor:function(){o.forEach(function(t){s.detachEvent(t)}),s=null,this.hide(),this.detachAllEvents()}};return u.mixin(l,e),u.mixin(l,n),l}};return u.mixin(r,e),u.mixin(r,n),r}},function(t,e){t.exports={create:function(){return{render:function(){},destroy:function(){}}}}},function(t,e,n){var i=n(2),r=n(1),a=n(0),o=n(9),s=function(t){"use strict";var e=["altKey","shiftKey","metaKey"];function n(e,n,i,r){var o=t.apply(this,arguments)||this;this.$config=a.mixin(n,{scroll:"x"}),o._scrollHorizontalHandler=a.bind(o._scrollHorizontalHandler,o),o._scrollVerticalHandler=a.bind(o._scrollVerticalHandler,o),o._outerScrollVerticalHandler=a.bind(o._outerScrollVerticalHandler,o),o._outerScrollHorizontalHandler=a.bind(o._outerScrollHorizontalHandler,o),o._mouseWheelHandler=a.bind(o._mouseWheelHandler,o),this.$config.hidden=!0;var s=r.config.scroll_size;return r.env.isIE&&(s+=1),this._isHorizontal()?(o.$config.height=s,o.$parent.$config.height=s):(o.$config.width=s,o.$parent.$config.width=s),this.$config.scrollPosition=0,o.$name="scroller",o}return i(n,t),n.prototype.init=function(t){t.innerHTML=this.$toHTML(),this.$view=t.firstChild,this.$view||this.init(),this._isVertical()?this._initVertical():this._initHorizontal(),this._initMouseWheel(),this._initLinkedViews()},n.prototype.$toHTML=function(){return"
"},n.prototype._getRootParent=function(){for(var t=this.$parent;t&&t.$parent;)t=t.$parent;if(t)return t},n.prototype._eachView=function(){var t=[];return function t(e,n){if(n.push(e),e.$cells)for(var i=0;id[s]&&d[o]>e&&u>d[s]-l+2&&(e=u+(i?0:2),n=d[s]);else{var h=Math.max(d[o]-u,0);(u+=h)>Math.max(d[s]-h,0)&&u>e&&(e=u,n=d[s])}}return{outerScroll:n,innerScroll:e}},n.prototype.scroll=function(t){this._isHorizontal()?this.scrollHorizontally(t):this.scrollVertically(t)},n.prototype.getScrollState=function(){return{visible:this.isVisible(),direction:this.$config.scroll,size:this.$config.outerSize,scrollSize:this.$config.scrollSize||0,position:this.$config.scrollPosition||0}},n.prototype.setSize=function(e,n){t.prototype.setSize.apply(this,arguments);var i=this._getScrollSize(),r=(this._isVertical()?n:e)-this._getScrollOffset()+(this._isHorizontal()?1:0);i.innerScroll&&r>i.outerScroll&&(i.innerScroll+=r-i.outerScroll),this.$config.scrollSize=i.innerScroll,this.$config.width=e,this.$config.height=n,this._setScrollSize(i.innerScroll)},n.prototype.isVisible=function(){return!(!this.$parent||!this.$parent.$view.parentNode)},n.prototype.shouldShow=function(){var t=this._getScrollSize();return!(!t.innerScroll&&this.$parent&&this.$parent.$view.parentNode)&&!(!t.innerScroll||this.$parent&&this.$parent.$view.parentNode)},n.prototype.shouldHide=function(){return!(this._getScrollSize().innerScroll||!this.$parent||!this.$parent.$view.parentNode)},n.prototype.toggleVisibility=function(){this.shouldHide()?this.hide():this.shouldShow()&&this.show()},n.prototype._getScaleOffset=function(t){var e=0;return!t||"timeline"!=t.$config.view&&"grid"!=t.$config.view||(e=t.$content.$getConfig().scale_height),e},n.prototype._getScrollOffset=function(){var t=0;if(this._isVertical()){var e=this.$parent.$parent;t=Math.max(this._getScaleOffset(e.getPrevSibling(this.$parent.$id)),this._getScaleOffset(e.getNextSibling(this.$parent.$id)))}else for(var n=this._getLinkedViews(),i=0;i=0&&(!t[l]||t.deltaX||t.wheelDeltaX||(a=2*s,s=0)),a&&Math.abs(a)>Math.abs(s)){if(this._isVertical())return;if(i.x)return!0;if(!this.$scroll_hor||!this.$scroll_hor.offsetWidth)return!0;var c=a/-40,u=this._oldLeft,d=u+30*c;if(this.scrollHorizontally(d),this.$scroll_hor.scrollLeft=d,u==this.$scroll_hor.scrollLeft)return!0;this._oldLeft=this.$scroll_hor.scrollLeft}else{if(this._isHorizontal())return;if(i.y)return!0;if(!this.$scroll_ver||!this.$scroll_ver.offsetHeight)return!0;c=s/-40;void 0===s&&(c=t.detail);var h=this._oldTop,f=this.$scroll_ver.scrollTop+30*c;if(this.scrollVertically(f),this.$scroll_ver.scrollTop=f,h==this.$scroll_ver.scrollTop)return!0;this._oldTop=this.$scroll_ver.scrollTop}return t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1}},n}(n(10));t.exports=s},function(t,e){t.exports=null},function(t,e,n){var i=n(2),r=n(0),a=function(t){"use strict";function e(e,n,i){var a=t.apply(this,arguments)||this;if(n.view){n.id&&(this.$id=r.uid());var o=r.copy(n);if(delete o.config,delete o.templates,this.$content=this.$factory.createView(n.view,this,o,this),!this.$content)return!1}return a.$name="viewCell",a}return i(e,t),e.prototype.destructor=function(){this.clear(),t.prototype.destructor.call(this)},e.prototype.clear=function(){if(this.$initialized=!1,this.$content){var e=this.$content.unload||this.$content.destructor;e&&e.call(this.$content)}t.prototype.clear.call(this)},e.prototype.scrollTo=function(e,n){this.$content&&this.$content.scrollTo?this.$content.scrollTo(e,n):t.prototype.scrollTo.call(this,e,n)},e.prototype._setContentSize=function(t,e){var n=this._getBorderSizes();if("number"==typeof t){var i=t+n.horizontal;this.$config.width=i}if("number"==typeof e){var r=e+n.vertical;this.$config.height=r}},e.prototype.setSize=function(e,n){if(t.prototype.setSize.call(this,e,n),!this.$preResize&&this.$content&&!this.$initialized){this.$initialized=!0;var i=this.$view.childNodes[0],r=this.$view.childNodes[1];r||(r=i),this.$content.init(r)}},e.prototype.setContentSize=function(){!this.$preResize&&this.$content&&this.$initialized&&this.$content.setSize(this.$lastSize.contentX,this.$lastSize.contentY)},e.prototype.getContentSize=function(){var e=t.prototype.getContentSize.call(this);if(this.$content&&this.$initialized){var n=this.$content.getSize();e.width=void 0===n.contentX?n.width:n.contentX,e.height=void 0===n.contentY?n.height:n.contentY}var i=this._getBorderSizes();return e.width+=i.horizontal,e.height+=i.vertical,e},e}(n(10));t.exports=a},function(t,e,n){var i=n(2),r=n(29),a=n(10),o=function(t){"use strict";function e(e,n,i){for(var r=t.apply(this,arguments)||this,a=0;at.x_end||e.left+e.widtht.y_end||e.top+e.height-1&&o.click?o.click():(a(n,!0),i=!0)}27==e&&(a(n,!1),i=!0)}return i?(t.preventDefault&&t.preventDefault(),!(t.cancelBubble=!0)):void 0}}function s(t){s.cover||(s.cover=document.createElement("div"),s.cover.onkeydown=o,s.cover.className="dhx_modal_cover",document.body.appendChild(s.cover)),s.cover.style.display=t?"inline-block":"none"}function l(e,n,i){var r=t._waiAria.messageButtonAttrString(e),a=n.toLowerCase().replace(/ /g,"_");return"
"+e+"
"}function c(){for(var t=[].slice.apply(arguments,[0]),e=0;e'+o.title+""),f+='
'+(o.content?"":o.text)+'
',s&&(f+=l(c(o.ok,t.locale.labels.message_ok,"OK"),"ok",!0)),u&&(f+=l(c(o.cancel,t.locale.labels.message_cancel,"Cancel"),"cancel",!1)),o.buttons)for(var _=0;_",n.className="gantt-info dhtmlx-info gantt-"+e.type+" dhtmlx-"+e.type,n.onclick=function(){p.hide(e.id),e=null},t._waiAria.messageInfoAttr(n),"bottom"==p.position&&p.area.firstChild?p.area.insertBefore(n,p.area.firstChild):p.area.appendChild(n),e.expire>0&&(p.timers[e.id]=window.setTimeout(function(){p.hide(e.id)},e.expire)),p.pull[e.id]=n,n=null,e.id}(e)}};p.seed=(new Date).valueOf(),p.uid=i.uid,p.expire=4e3,p.keyboard=!0,p.position="top",p.pull={},p.timers={},p.hideAll=function(){for(var t in p.pull)p.hide(t)},p.hide=function(t){var e=p.pull[t];e&&e.parentNode&&(window.setTimeout(function(){e.parentNode.removeChild(e),e=null},2e3),e.className+=" hidden",p.timers[t]&&window.clearTimeout(p.timers[t]),delete p.pull[t])};var v=[];return t.attachEvent("onMessagePopup",function(t){v.push(t)}),t.attachEvent("onAfterMessagePopup",function(t){for(var e=0;e=0)return null;var n=arguments[1]||this.config.task_attribute,i=a.locateAttribute(e,n);return i?i.getAttribute(n):null},t._locate_css=function(t,e,n){return a.locateClassName(t,e,n)},t._locateHTML=function(t,e){return a.locateAttribute(t,e||this.config.task_attribute)}}t.attachEvent("onParse",function(){r(t)||t.attachEvent("onGanttRender",function(){if(t.config.initial_scroll){var e=t.getTaskByIndex(0),n=e?e.id:t.config.root_id;t.isTaskExists(n)&&t.showTask(n)}},{once:!0})}),t.attachEvent("onBeforeGanttReady",function(){this.config.scroll_size||(this.config.scroll_size=a.getScrollSize()||1),r(t)||(this._eventRemoveAll(),this.$mouseEvents.reset(),this.resetLightbox())})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"],month_short:["Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"],day_full:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"],day_short:["Нед","Пон","Вів","Сер","Чет","Птн","Суб"]},labels:{new_task:"Нове завдання",icon_save:"Зберегти",icon_cancel:"Відміна",icon_details:"Деталі",icon_edit:"Редагувати",icon_delete:"Вилучити",confirm_closing:"",confirm_deleting:"Подія вилучиться назавжди. Ви впевнені?",section_description:"Опис",section_time:"Часовий проміжок",section_type:"Тип",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Відміна",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],month_short:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],day_full:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],day_short:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},labels:{new_task:"Yeni görev",icon_save:"Kaydet",icon_cancel:"İptal",icon_details:"Detaylar",icon_edit:"Düzenle",icon_delete:"Sil",confirm_closing:"",confirm_deleting:"Görev silinecek, emin misiniz?",section_description:"Açıklama",section_time:"Zaman Aralığı",section_type:"Tip",column_wbs:"WBS",column_text:"Görev Adı",column_start_date:"Başlangıç",column_duration:"Süre",column_add:"",link:"Bağlantı",confirm_link_deleting:"silinecek",link_start:" (başlangıç)",link_end:" (bitiş)",type_task:"Görev",type_project:"Proje",type_milestone:"Kilometretaşı",minutes:"Dakika",hours:"Saat",days:"Gün",weeks:"Hafta",months:"Ay",years:"Yıl",message_ok:"OK",message_cancel:"Ýptal",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],month_short:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],day_full:["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"],day_short:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},labels:{new_task:"Ny uppgift",icon_save:"Spara",icon_cancel:"Avbryt",icon_details:"Detajer",icon_edit:"Ändra",icon_delete:"Ta bort",confirm_closing:"",confirm_deleting:"Är du säker på att du vill ta bort händelsen permanent?",section_description:"Beskrivning",section_time:"Tid",section_type:"Typ",column_wbs:"WBS",column_text:"Uppgiftsnamn",column_start_date:"Starttid",column_duration:"Varaktighet",column_add:"",link:"Länk",confirm_link_deleting:"kommer tas bort",link_start:" (start)",link_end:" (slut)",type_task:"Uppgift",type_project:"Projekt",type_milestone:"Milstolpe",minutes:"Minuter",hours:"Timmar",days:"Dagar",weeks:"Veckor",months:"Månader",years:"År",message_ok:"OK",message_cancel:"Avbryt",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"],month_short:["Jan","Feb","Mar","Apr","Máj","Jún","Júl","Aug","Sept","Okt","Nov","Dec"],day_full:["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"],day_short:["Ne","Po","Ut","St","Št","Pi","So"]},labels:{new_task:"Nová úloha",icon_save:"Uložiť",icon_cancel:"Späť",icon_details:"Detail",icon_edit:"Edituj",icon_delete:"Zmazať",confirm_closing:"Vaše zmeny nebudú uložené. Skutočne?",confirm_deleting:"Udalosť bude natrvalo vymazaná. Skutočne?",section_description:"Poznámky",section_time:"Doba platnosti",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Späť",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"],month_short:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],day_full:["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"],day_short:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"]},labels:{new_task:"Nova naloga",icon_save:"Shrani",icon_cancel:"Prekliči",icon_details:"Podrobnosti",icon_edit:"Uredi",icon_delete:"Izbriši",confirm_closing:"",confirm_deleting:"Dogodek bo izbrisan. Želite nadaljevati?",section_description:"Opis",section_time:"Časovni okvir",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Prekliči",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Январь","Февраль","Март","Апрель","Maй","Июнь","Июль","Август","Сентябрь","Oктябрь","Ноябрь","Декабрь"],month_short:["Янв","Фев","Maр","Aпр","Maй","Июн","Июл","Aвг","Сен","Окт","Ноя","Дек"],day_full:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],day_short:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"]},labels:{new_task:"Новое задание",icon_save:"Сохранить",icon_cancel:"Отменить",icon_details:"Детали",icon_edit:"Изменить",icon_delete:"Удалить",confirm_closing:"",confirm_deleting:"Событие будет удалено безвозвратно, продолжить?",section_description:"Описание",section_time:"Период времени",section_type:"Тип",column_wbs:"ИСР",column_text:"Задача",column_start_date:"Начало",column_duration:"Длительность",column_add:"",link:"Связь",confirm_link_deleting:"будет удалена",link_start:" (начало)",link_end:" (конец)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Минута",hours:"Час",days:"День",weeks:"Неделя",months:"Месяц",years:"Год",message_ok:"OK",message_cancel:"Отменить",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"начните вводить слово для фильтрации",resources_filter_label:"спрятать не установленные"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","November","December"],month_short:["Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sep","Oct","Nov","Dec"],day_full:["Duminica","Luni","Marti","Miercuri","Joi","Vineri","Sambata"],day_short:["Du","Lu","Ma","Mi","Jo","Vi","Sa"]},labels:{new_task:"Sarcina noua",icon_save:"Salveaza",icon_cancel:"Anuleaza",icon_details:"Detalii",icon_edit:"Editeaza",icon_delete:"Sterge",confirm_closing:"Schimbarile nu vor fi salvate, esti sigur?",confirm_deleting:"Evenimentul va fi sters permanent, esti sigur?",section_description:"Descriere",section_time:"Interval",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Anuleaza",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],month_short:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],day_full:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],day_short:["Nie","Pon","Wto","Śro","Czw","Pią","Sob"]},labels:{new_task:"Nowe zadanie",icon_save:"Zapisz",icon_cancel:"Anuluj",icon_details:"Szczegóły",icon_edit:"Edytuj",icon_delete:"Usuń",confirm_closing:"",confirm_deleting:"Zdarzenie zostanie usunięte na zawsze, kontynuować?",section_description:"Opis",section_time:"Okres czasu",section_type:"Typ",column_wbs:"WBS",column_text:"Nazwa zadania",column_start_date:"Początek",column_duration:"Czas trwania",column_add:"",link:"Link",confirm_link_deleting:"zostanie usunięty",link_start:" (początek)",link_end:" (koniec)",type_task:"Zadanie",type_project:"Projekt",type_milestone:"Milestone",minutes:"Minuty",hours:"Godziny",days:"Dni",weeks:"Tydzień",months:"Miesiące",years:"Lata",message_ok:"OK",message_cancel:"Anuluj",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],month_short:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],day_full:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],day_short:["Søn","Man","Tir","Ons","Tor","Fre","Lør"]},labels:{new_task:"Ny oppgave",icon_save:"Lagre",icon_cancel:"Avbryt",icon_details:"Detaljer",icon_edit:"Endre",icon_delete:"Slett",confirm_closing:"Endringer blir ikke lagret, er du sikker?",confirm_deleting:"Oppføringen vil bli slettet, er du sikker?",section_description:"Beskrivelse",section_time:"Tidsperiode",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Avbryt",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],month_short:["Jan","Feb","mrt","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],day_full:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],day_short:["Zo","Ma","Di","Wo","Do","Vr","Za"]},labels:{new_task:"Nieuwe taak",icon_save:"Opslaan",icon_cancel:"Annuleren",icon_details:"Details",icon_edit:"Bewerken",icon_delete:"Verwijderen",confirm_closing:"",confirm_deleting:"Item zal permanent worden verwijderd, doorgaan?",section_description:"Beschrijving",section_time:"Tijd periode",section_type:"Type",column_wbs:"WBS",column_text:"Taak omschrijving",column_start_date:"Startdatum",column_duration:"Duur",column_add:"",link:"Koppeling",confirm_link_deleting:"zal worden verwijderd",link_start:" (start)",link_end:" (eind)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"minuten",hours:"uren",days:"dagen",weeks:"weken",months:"maanden",years:"jaren",message_ok:"OK",message_cancel:"Annuleren",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],month_short:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],day_full:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],day_short:["Søn","Mon","Tir","Ons","Tor","Fre","Lør"]},labels:{new_task:"Ny oppgave",icon_save:"Lagre",icon_cancel:"Avbryt",icon_details:"Detaljer",icon_edit:"Rediger",icon_delete:"Slett",confirm_closing:"",confirm_deleting:"Hendelsen vil bli slettet permanent. Er du sikker?",section_description:"Beskrivelse",section_time:"Tidsperiode",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Avbryt",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){return function(t){var e=this;for(var n in this.addLocale=function(t,n){e._locales[t]=n},this.getLocale=function(t){return e._locales[t]},this._locales={},t)this._locales[n]=t[n]}}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],month_short:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],day_full:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],day_short:["일","월","화","수","목","금","토"]},labels:{new_task:"이름없는 작업",icon_save:"저장",icon_cancel:"취소",icon_details:"세부 사항",icon_edit:"수정",icon_delete:"삭제",confirm_closing:"",confirm_deleting:"작업을 삭제하시겠습니까?",section_description:"설명",section_time:"기간",section_type:"Type",column_wbs:"WBS",column_text:"작업명",column_start_date:"시작일",column_duration:"기간",column_add:"",link:"전제",confirm_link_deleting:"삭제 하시겠습니까?",link_start:" (start)",link_end:" (end)",type_task:"작업",type_project:"프로젝트",type_milestone:"마일스톤",minutes:"분",hours:"시간",days:"일",weeks:"주",months:"달",years:"년",message_ok:"OK",message_cancel:"취소",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],month_short:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],day_full:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],day_short:["日","月","火","水","木","金","土"]},labels:{new_task:"新しい仕事",icon_save:"保存",icon_cancel:"キャンセル",icon_details:"詳細",icon_edit:"編集",icon_delete:"削除",confirm_closing:"",confirm_deleting:"イベント完全に削除されます、宜しいですか?",section_description:"デスクリプション",section_time:"期間",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"キャンセル",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],month_short:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Ags","Sep","Okt","Nov","Des"],day_full:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],day_short:["Ming","Sen","Sel","Rab","Kam","Jum","Sab"]},labels:{new_task:"Tugas baru",icon_save:"Simpan",icon_cancel:"Batal",icon_details:"Detail",icon_edit:"Edit",icon_delete:"Hapus",confirm_closing:"",confirm_deleting:"Acara akan dihapus",section_description:"Keterangan",section_time:"Periode",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Batal",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],month_short:["Jan","Feb","Már","Ápr","Máj","Jún","Júl","Aug","Sep","Okt","Nov","Dec"],day_full:["Vasárnap","Hétfõ","Kedd","Szerda","Csütörtök","Péntek","szombat"],day_short:["Va","Hé","Ke","Sze","Csü","Pé","Szo"]},labels:{new_task:"Új feladat",icon_save:"Mentés",icon_cancel:"Mégse",icon_details:"Részletek",icon_edit:"Szerkesztés",icon_delete:"Törlés",confirm_closing:"",confirm_deleting:"Az esemény törölve lesz, biztosan folytatja?",section_description:"Leírás",section_time:"Idõszak",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Mégse",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],month_short:["Sij","Velj","Ožu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"],day_full:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"],day_short:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"]},labels:{new_task:"Novi Zadatak",icon_save:"Spremi",icon_cancel:"Odustani",icon_details:"Detalji",icon_edit:"Izmjeni",icon_delete:"Obriši",confirm_closing:"",confirm_deleting:"Zadatak će biti trajno izbrisan, jeste li sigurni?",section_description:"Opis",section_time:"Vremenski Period",section_type:"Tip",column_wbs:"WBS",column_text:"Naziv Zadatka",column_start_date:"Početno Vrijeme",column_duration:"Trajanje",column_add:"",link:"Poveznica",confirm_link_deleting:"će biti izbrisan",link_start:" (početak)",link_end:" (kraj)",type_task:"Zadatak",type_project:"Projekt",type_milestone:"Milestone",minutes:"Minute",hours:"Sati",days:"Dani",weeks:"Tjedni",months:"Mjeseci",years:"Godine",message_ok:"OK",message_cancel:"Odustani",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],month_short:["ינו","פבר","מרץ","אפר","מאי","יונ","יול","אוג","ספט","אוק","נוב","דצמ"],day_full:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],day_short:["א","ב","ג","ד","ה","ו","ש"]},labels:{new_task:"משימה חדש",icon_save:"שמור",icon_cancel:"בטל",icon_details:"פרטים",icon_edit:"ערוך",icon_delete:"מחק",confirm_closing:"",confirm_deleting:"ארוע ימחק סופית.להמשיך?",section_description:"הסבר",section_time:"תקופה",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"בטל",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],month_short:["Jan","Fév","Mar","Avr","Mai","Juin","Juil","Aoû","Sep","Oct","Nov","Déc"],day_full:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],day_short:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},labels:{new_task:"Nouvelle tâche",icon_save:"Enregistrer",icon_cancel:"Annuler",icon_details:"Détails",icon_edit:"Modifier",icon_delete:"Effacer",confirm_closing:"",confirm_deleting:"L'événement sera effacé sans appel, êtes-vous sûr ?",section_description:"Description",section_time:"Période",section_type:"Type",column_wbs:"OTP",column_text:"Nom de la tâche",column_start_date:"Date initiale",column_duration:"Durée",column_add:"",link:"Le lien",confirm_link_deleting:"sera supprimé",link_start:"(début)",link_end:"(fin)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Heures",days:"Jours",weeks:"Semaines",months:"Mois",years:"Années",message_ok:"OK",message_cancel:"Annuler",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],month_short:["Tam","Hel","Maa","Huh","Tou","Kes","Hei","Elo","Syy","Lok","Mar","Jou"],day_full:["Sunnuntai","Maanantai","Tiistai","Keskiviikko","Torstai","Perjantai","Lauantai"],day_short:["Su","Ma","Ti","Ke","To","Pe","La"]},labels:{new_task:"Uusi tehtävä",icon_save:"Tallenna",icon_cancel:"Peru",icon_details:"Tiedot",icon_edit:"Muokkaa",icon_delete:"Poista",confirm_closing:"",confirm_deleting:"Haluatko varmasti poistaa tapahtuman?",section_description:"Kuvaus",section_time:"Aikajakso",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Peru",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],month_short:["1","2","3","4","5","6","7","8","9","10","11","12"],day_full:["يکشنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],day_short:["ی","د","س","چ","پ","ج","ش"]},labels:{new_task:"وظیفه جدید",icon_save:"ذخیره",icon_cancel:"لغو",icon_details:"جزییات",icon_edit:"ویرایش",icon_delete:"حذف",confirm_closing:"تغییرات شما ازدست خواهد رفت، آیا مطمئن هستید؟",confirm_deleting:"این مورد برای همیشه حذف خواهد شد، آیا مطمئن هستید؟",section_description:"توضیحات",section_time:"مدت زمان",section_type:"نوع",column_wbs:"WBS",column_text:"عنوان",column_start_date:"زمان شروع",column_duration:"مدت",column_add:"",link:"ارتباط",confirm_link_deleting:"حذف خواهد شد",link_start:" (آغاز)",link_end:" (پایان)",type_task:"وظیفه",type_project:"پروژه",type_milestone:"نگارش",minutes:"دقایق",hours:"ساعات",days:"روزها",weeks:"هفته",months:"ماه‌ها",years:"سال‌ها",message_ok:"تایید",message_cancel:"لغو",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],month_short:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],day_full:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],day_short:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"]},labels:{new_task:"Nueva tarea",icon_save:"Guardar",icon_cancel:"Cancelar",icon_details:"Detalles",icon_edit:"Editar",icon_delete:"Eliminar",confirm_closing:"",confirm_deleting:"El evento se borrará definitivamente, ¿continuar?",section_description:"Descripción",section_time:"Período",section_type:"Tipo",column_wbs:"EDT",column_text:"Tarea",column_start_date:"Inicio",column_duration:"Duración",column_add:"",link:"Enlace",confirm_link_deleting:"será borrada",link_start:" (inicio)",link_end:" (fin)",type_task:"Tarea",type_project:"Proyecto",type_milestone:"Hito",minutes:"Minutos",hours:"Horas",days:"Días",weeks:"Semanas",months:"Meses",years:"Años",message_ok:"OK",message_cancel:"Cancelar",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["January","February","March","April","May","June","July","August","September","October","November","December"],month_short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],day_full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},labels:{new_task:"New task",icon_save:"Save",icon_cancel:"Cancel",icon_details:"Details",icon_edit:"Edit",icon_delete:"Delete",confirm_closing:"",confirm_deleting:"Task will be deleted permanently, are you sure?",section_description:"Description",section_time:"Time period",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Cancel",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάϊος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],month_short:["ΙΑΝ","ΦΕΒ","ΜΑΡ","ΑΠΡ","ΜΑΙ","ΙΟΥΝ","ΙΟΥΛ","ΑΥΓ","ΣΕΠ","ΟΚΤ","ΝΟΕ","ΔΕΚ"],day_full:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Κυριακή"],day_short:["ΚΥ","ΔΕ","ΤΡ","ΤΕ","ΠΕ","ΠΑ","ΣΑ"]},labels:{new_task:"Νέα εργασία",icon_save:"Αποθήκευση",icon_cancel:"Άκυρο",icon_details:"Λεπτομέρειες",icon_edit:"Επεξεργασία",icon_delete:"Διαγραφή",confirm_closing:"",confirm_deleting:"Το έργο θα διαγραφεί οριστικά. Θέλετε να συνεχίσετε;",section_description:"Περιγραφή",section_time:"Χρονική περίοδος",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Άκυρο",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:[" Januar"," Februar"," März "," April"," Mai"," Juni"," Juli"," August"," September "," Oktober"," November "," Dezember"],month_short:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],day_full:["Sonntag","Montag","Dienstag"," Mittwoch"," Donnerstag","Freitag","Samstag"],day_short:["So","Mo","Di","Mi","Do","Fr","Sa"]},labels:{new_task:"Neue Aufgabe",icon_save:"Speichern",icon_cancel:"Abbrechen",icon_details:"Details",icon_edit:"Ändern",icon_delete:"Löschen",confirm_closing:"",confirm_deleting:"Der Eintrag wird gelöscht",section_description:"Beschreibung",section_time:"Zeitspanne",section_type:"Type",column_wbs:"PSP",column_text:"Task-Namen",column_start_date:"Startzeit",column_duration:"Dauer",column_add:"",link:"Link",confirm_link_deleting:"werden gelöscht",link_start:"(starten)",link_end:"(ende)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minuten",hours:"Stunden",days:"Tage",weeks:"Wochen",months:"Monate",years:"Jahre",message_ok:"OK",message_cancel:"Abbrechen",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Januar","Februar","Marts","April","Maj","Juni","Juli","August","September","Oktober","November","December"],month_short:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],day_full:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],day_short:["Søn","Man","Tir","Ons","Tor","Fre","Lør"]},labels:{new_task:"Ny opgave",icon_save:"Gem",icon_cancel:"Fortryd",icon_details:"Detaljer",icon_edit:"Tilret",icon_delete:"Slet",confirm_closing:"Dine rettelser vil gå tabt.. Er dy sikker?",confirm_deleting:"Bigivenheden vil blive slettet permanent. Er du sikker?",section_description:"Beskrivelse",section_time:"Tidsperiode",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Fortryd",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"],month_short:["Led","Ún","Bře","Dub","Kvě","Čer","Čec","Srp","Září","Říj","List","Pro"],day_full:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"],day_short:["Ne","Po","Út","St","Čt","Pá","So"]},labels:{new_task:"Nová práce",icon_save:"Uložit",icon_cancel:"Zpět",icon_details:"Detail",icon_edit:"Edituj",icon_delete:"Smazat",confirm_closing:"",confirm_deleting:"Událost bude trvale smazána, opravdu?",section_description:"Poznámky",section_time:"Doba platnosti",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Zpět",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],month_short:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],day_full:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],day_short:["日","一","二","三","四","五","六"]},labels:{new_task:"新任務",icon_save:"保存",icon_cancel:"关闭",icon_details:"详细",icon_edit:"编辑",icon_delete:"删除",confirm_closing:"请确认是否撤销修改!",confirm_deleting:"是否删除日程?",section_description:"描述",section_time:"时间范围",section_type:"类型",column_wbs:"工作分解结构",column_text:"任务名",column_start_date:"开始时间",column_duration:"持续时间",column_add:"",link:"关联",confirm_link_deleting:"将被删除",link_start:" (开始)",link_end:" (结束)",type_task:"任务",type_project:"项目",type_milestone:"里程碑",minutes:"分钟",hours:"小时",days:"天",weeks:"周",months:"月",years:"年",message_ok:"OK",message_cancel:"关闭",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"],month_short:["Gen","Feb","Mar","Abr","Mai","Jun","Jul","Ago","Set","Oct","Nov","Des"],day_full:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"],day_short:["Dg","Dl","Dm","Dc","Dj","Dv","Ds"]},labels:{new_task:"Nova tasca",icon_save:"Guardar",icon_cancel:"Cancel·lar",icon_details:"Detalls",icon_edit:"Editar",icon_delete:"Esborrar",confirm_closing:"",confirm_deleting:"L'esdeveniment s'esborrarà definitivament, continuar ?",section_description:"Descripció",section_time:"Periode de temps",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"Cancel·lar",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["Студзень","Люты","Сакавік","Красавік","Maй","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"],month_short:["Студз","Лют","Сак","Крас","Maй","Чэр","Ліп","Жнів","Вер","Каст","Ліст","Снеж"],day_full:["Нядзеля","Панядзелак","Аўторак","Серада","Чацвер","Пятніца","Субота"],day_short:["Нд","Пн","Аўт","Ср","Чцв","Пт","Сб"]},labels:{new_task:"Новае заданне",icon_save:"Захаваць",icon_cancel:"Адмяніць",icon_details:"Дэталі",icon_edit:"Змяніць",icon_delete:"Выдаліць",confirm_closing:"",confirm_deleting:"Падзея будзе выдалена незваротна, працягнуць?",section_description:"Апісанне",section_time:"Перыяд часу",section_type:"Тып",column_wbs:"ІСР",column_text:"Задача",column_start_date:"Пачатак",column_duration:"Працяг",column_add:"",link:"Сувязь",confirm_link_deleting:"будзе выдалена",link_start:"(пачатак)",link_end:"(канец)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Хвiлiна",hours:"Гадзiна",days:"Дзень",weeks:"Тыдзень",months:"Месяц",years:"Год",message_ok:"OK",message_cancel:"Адмяніць",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={date:{month_full:["كانون الثاني","شباط","آذار","نيسان","أيار","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],month_short:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],day_full:["الأحد","الأثنين","ألثلاثاء","الأربعاء","ألحميس","ألجمعة","السبت"],day_short:["احد","اثنين","ثلاثاء","اربعاء","خميس","جمعة","سبت"]},labels:{new_task:"مهمة جديد",icon_save:"اخزن",icon_cancel:"الغاء",icon_details:"تفاصيل",icon_edit:"تحرير",icon_delete:"حذف",confirm_closing:"التغييرات سوف تضيع, هل انت متأكد؟",confirm_deleting:"الحدث سيتم حذفها نهائيا ، هل أنت متأكد؟",section_description:"الوصف",section_time:"الفترة الزمنية",section_type:"Type",column_wbs:"WBS",column_text:"Task name",column_start_date:"Start time",column_duration:"Duration",column_add:"",link:"Link",confirm_link_deleting:"will be deleted",link_start:" (start)",link_end:" (end)",type_task:"Task",type_project:"Project",type_milestone:"Milestone",minutes:"Minutes",hours:"Hours",days:"Days",weeks:"Week",months:"Months",years:"Years",message_ok:"OK",message_cancel:"الغاء",section_constraint:"Constraint",constraint_type:"Constraint type",constraint_date:"Constraint date",asap:"As Soon As Possible",alap:"As Late As Possible",snet:"Start No Earlier Than",snlt:"Start No Later Than",fnet:"Finish No Earlier Than",fnlt:"Finish No Later Than",mso:"Must Start On",mfo:"Must Finish On",resources_filter_placeholder:"type to filter",resources_filter_label:"hide empty"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(145),r=n(144),a=n(143),o=n(142),s=n(141),l=n(140),c=n(139),u=n(138),d=n(137),h=n(136),f=n(135),_=n(134),g=n(133),p=n(132),v=n(131),m=n(130),y=n(129),k=n(128),b=n(127),w=n(126),x=n(125),T=n(124),$=n(123),S=n(122),C=n(121),E=n(120),D=n(119),A=n(118),N=n(117),M=n(116),I=n(115);e.default=function(){return new w.default({en:d.default,ar:i.default,be:r.default,ca:a.default,cn:o.default,cs:s.default,da:l.default,de:c.default,el:u.default,es:h.default,fa:f.default,fi:_.default,fr:g.default,he:p.default,hr:v.default,hu:m.default,id:y.default,jp:k.default,kr:b.default,nb:x.default,nl:T.default,no:$.default,pl:S.default,ro:C.default,ru:E.default,si:D.default,sk:A.default,sv:N.default,tr:M.default,ua:I.default})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){}},function(t,e){t.exports=function(t){t.destructor=function(){for(var e in t.callEvent("onDestroy",[]),this.clearAll(),this.$root&&delete this.$root.gantt,this._eventRemoveAll(),this.$layout&&this.$layout.destructor(),this.resetLightbox(),this._dp&&this._dp.destructor&&this._dp.destructor(),this.$services.destructor(),this.detachAllEvents(),this)0===e.indexOf("$")&&delete this[e];t.$destroyed=!0}}},function(t,e){t.exports=function(t){return function(e,n){e||t.config.show_errors&&!1!==t.callEvent("onError",[n])&&t.message({type:"error",text:n,expire:-1})}}},function(t,e){function n(t,e){var n;t.event(e,"resize",function(){clearTimeout(n),n=setTimeout(function(){t.render()},300)})}t.exports=function(t){"static"==window.getComputedStyle(t.$root).getPropertyValue("position")&&(t.$root.style.position="relative");var e=document.createElement("iframe");e.className="gantt_container_resize_watcher",e.tabIndex=-1,t.config.wai_aria_attributes&&(e.setAttribute("role","none"),e.setAttribute("aria-hidden",!0)),t.$root.appendChild(e),e.contentWindow?n(t,e.contentWindow):(t.$root.removeChild(e),n(t,window))}},function(t,e,n){var i=n(1),r=n(3),a=n(8),o=n(150);t.exports=function(t){var e=n(35);t.assert=n(149)(t),t.init=function(t,e,n){e&&n&&(this.config.start_date=this._min_date=new Date(e),this.config.end_date=this._max_date=new Date(n)),this.date.init(),this.init=function(t){this.$container&&this.$container.parentNode&&(this.$container.parentNode.removeChild(this.$container),this.$container=null),this.$layout&&this.$layout.clear(),this._reinit(t)},this._reinit(t)};var s=function(){this._clearTaskLayers&&this._clearTaskLayers(),this._clearLinkLayers&&this._clearLinkLayers(),this.$layout&&(this.$layout.destructor(),this.$layout=null,this.$ui.reset())}.bind(t),l=function(){a(t)||(this.$root.innerHTML="",this.$root.gantt=this,e(this),this.config.layout.id="main",this.$layout=this.$ui.createView("layout",this.$root,this.config.layout),this.$layout.attachEvent("onBeforeResize",function(){for(var e=t.$services.getService("datastores"),n=0;n3600&&o<86400){var s=e.getTimezoneOffset()-n;s&&(e=t.date.add(e,s,"minute"))}return e},t.isSplitTask=function(e){return t.assert(e&&e instanceof Object,"Invalid argument task="+e+" of gantt.isSplitTask. Task object was expected"),this.$data.tasksStore._isSplitItem(e)},t._is_icon_open_click=function(t){if(!t)return!1;var e=t.target||t.srcElement;if(!e||!e.className)return!1;var n=i.getClassName(e);return-1!==n.indexOf("gantt_tree_icon")&&(-1!==n.indexOf("gantt_close")||-1!==n.indexOf("gantt_open"))}}},function(t,e){t.exports=function(t){function e(){return t._cached_functions.update_if_changed(t),t._cached_functions.active||t._cached_functions.activate(),!0}t._cached_functions={cache:{},mode:!1,critical_path_mode:!1,wrap_methods:function(t,e){if(e._prefetch_originals)for(var n in e._prefetch_originals)e[n]=e._prefetch_originals[n];e._prefetch_originals={};for(n=0;ntask="+e+" of gantt.isUnscheduledTask. Task object was expected"),!!e.unscheduled||!e.start_date},t._isAllowedUnscheduledTask=function(e){return!(!e.unscheduled||!t.config.show_unscheduled)},t._isTaskInTimelineLimits=function(t){var e=t.start_date?t.start_date.valueOf():null,n=t.end_date?t.end_date.valueOf():null;return!!(e&&n&&e<=this._max_date.valueOf()&&n>=this._min_date.valueOf())},t.isTaskVisible=function(t){if(!this.isTaskExists(t))return!1;var e=this.getTask(t);return!(!this._isAllowedUnscheduledTask(e)&&!this._isTaskInTimelineLimits(e))&&!!(this.getGlobalTaskIndex(t)>=0)},t._getProjectEnd=function(){if(t.config.project_end)return t.config.project_end;var e=t.getTaskByTime();return(e=e.sort(function(t,e){return+t.end_date>+e.end_date?1:-1})).length?e[e.length-1].end_date:null},t._getProjectStart=function(){if(t.config.project_start)return t.config.project_start;if(t.config.start_date)return t.config.start_date;if(t.getState().min_date)return t.getState().min_date;var e=t.getTaskByTime();return(e=e.sort(function(t,e){return+t.start_date>+e.start_date?1:-1})).length?e[0].start_date:null};var e=function(e,n){var i=!(!n||n==t.config.root_id)&&t.getTask(n),r=null;if(i)r=t.config.schedule_from_end?t.calculateEndDate({start_date:i.end_date,duration:-t.config.duration_step,task:e}):i.start_date;else if(t.config.schedule_from_end)r=t.calculateEndDate({start_date:t._getProjectEnd(),duration:-t.config.duration_step,task:e});else{var a=t.getTaskByIndex(0);r=a?a.start_date?a.start_date:a.end_date?t.calculateEndDate({start_date:a.end_date,duration:-t.config.duration_step,task:e}):null:t.config.start_date||t.getState().min_date}return t.assert(r,"Invalid dates"),new Date(r)};t._set_default_task_timing=function(n){n.start_date=n.start_date||e(n,t.getParent(n)),n.duration=n.duration||t.config.duration_step,n.end_date=n.end_date||t.calculateEndDate(n)},t.createTask=function(n,i,r){(n=n||{},t.defined(n.id)||(n.id=t.uid()),n.start_date||(n.start_date=e(n,i)),void 0===n.text&&(n.text=t.locale.labels.new_task),void 0===n.duration&&(n.duration=1),this.isTaskExists(i))&&(this.setParent(n,i,!0),this.getTask(i).$open=!0);return this.callEvent("onTaskCreated",[n])?(this.config.details_on_create?(n.$new=!0,this.silent(function(){t.$data.tasksStore.addItem(n,r)}),this.selectTask(n.id),this.refreshData(),this.showLightbox(n.id)):this.addTask(n,i,r)&&(this.showTask(n.id),this.selectTask(n.id)),n.id):null},t._update_flags=function(e,n){var i=t.$data.tasksStore;void 0===e?(this._lightbox_id=null,i.silent(function(){i.unselect()}),this._tasks_dnd&&this._tasks_dnd.drag&&(this._tasks_dnd.drag.id=null)):(this._lightbox_id==e&&(this._lightbox_id=n),i.getSelectedId()==e&&i.silent(function(){i.unselect(e),i.select(n)}),this._tasks_dnd&&this._tasks_dnd.drag&&this._tasks_dnd.drag.id==e&&(this._tasks_dnd.drag.id=n))};var n=function(e,n){var i=t.getTaskType(e.type),r={type:i,$no_start:!1,$no_end:!1};return n||i!=e.$rendered_type?(i==t.config.types.project?r.$no_end=r.$no_start=!0:i!=t.config.types.milestone&&(r.$no_end=!(e.end_date||e.duration),r.$no_start=!e.start_date,t._isAllowedUnscheduledTask(e)&&(r.$no_end=r.$no_start=!1)),r):(r.$no_start=e.$no_start,r.$no_end=e.$no_end,r)};function r(e){e.$effective_calendar=t.getTaskCalendar(e).id,e.start_date=t.getClosestWorkTime({dir:"future",date:e.start_date,unit:t.config.duration_unit,task:e}),e.end_date=t.calculateEndDate(e)}t._init_task_timing=function(t){var e=n(t,!0),i=t.$rendered_type!=e.type,a=e.type;i&&(t.$no_start=e.$no_start,t.$no_end=e.$no_end,t.$rendered_type=e.type),i&&a!=this.config.types.milestone&&a==this.config.types.project&&this._set_default_task_timing(t),a==this.config.types.milestone&&(t.end_date=t.start_date),t.start_date&&t.end_date&&(t.duration=this.calculateDuration(t)),t.end_date||(t.end_date=t.start_date),t.duration=t.duration||0;var o=this.getTaskCalendar(t);t.$effective_calendar&&t.$effective_calendar!==o.id&&(r(t),this.config.inherit_calendar&&this.isSummaryTask(t)&&this.eachTask(function(t){r(t)},t.id)),t.$effective_calendar=o.id},t.isSummaryTask=function(e){t.assert(e&&e instanceof Object,"Invalid argument task="+e+" of gantt.isSummaryTask. Task object was expected");var i=n(e);return!(!i.$no_end&&!i.$no_start)},t.resetProjectDates=function(t){var i=n(t);if(i.$no_end||i.$no_start){var r=this.getSubtaskDates(t.id);(function(t,i,r){var a=n(t);a.$no_start&&(t.start_date=i&&i!=1/0?new Date(i):e(t,this.getParent(t)));a.$no_end&&(t.end_date=r&&r!=-1/0?new Date(r):this.calculateEndDate({start_date:t.start_date,duration:this.config.duration_step,task:t}));(a.$no_start||a.$no_end)&&this._init_task_timing(t)}).call(this,t,r.start_date,r.end_date)}},t.getSubtaskDuration=function(e){var n=0,i=void 0!==e?e:t.config.root_id;return this.eachTask(function(e){this.getTaskType(e.type)==t.config.types.project||this.isUnscheduledTask(e)||(n+=e.duration)},i),n},t.getSubtaskDates=function(e){var n=null,i=null,r=void 0!==e?e:t.config.root_id;return this.eachTask(function(e){this.getTaskType(e.type)==t.config.types.project||this.isUnscheduledTask(e)||(e.start_date&&!e.$no_start&&(!n||n>e.start_date.valueOf())&&(n=e.start_date.valueOf()),e.end_date&&!e.$no_end&&(!i||i=+n.min_date&&+s<=+n.max_date)o=Math.floor(t.columnIndexByDate(s)),n.trace_x[o]||(o-=1,n.rtl&&(o=0)),a=new Date(n.trace_x[o]),r=t.date.add(a,l,c);else{for(o=Math.floor(t.columnIndexByDate(s)),r=t.date[c+"_start"](new Date(n.min_date)),n.trace_x[o]&&(r=t.date[c+"_start"](n.trace_x[o]));+r<+s;){var u=(r=t.date[c+"_start"](t.date.add(r,l,c))).getTimezoneOffset();r=t._correct_dst_change(r,u,r,c),t.date[c+"_start"]&&(r=t.date[c+"_start"](r))}a=t.date.add(r,-1*l,c)}return e.dir&&"future"==e.dir?r:e.dir&&"past"==e.dir?a:Math.abs(s-a)1e6&&this._resetTimestampCache();var e=null;if(t.day||0===t.day)e=t.day;else if(t.date){var n=String(t.date.valueOf());this._cached_timestamps[n]?e=this._cached_timestamps[n]:(e=Date.UTC(t.date.getFullYear(),t.date.getMonth(),t.date.getDate()),this._cached_timestamps[n]=e,this._cached_timestamps_count++)}return e},_checkIfWorkingUnit:function(t,e,n,i){if(!i){if(void 0===n&&(n=this._getUnitOrder(e)),void 0===n)return!0;if(n&&!this._isWorkTime(t,this.units[n-1],n-1))return!1}return!this["_is_work_"+e]||this["_is_work_"+e](t)},_is_work_day:function(t){var e=this._getWorkHours(t);return!!Array.isArray(e)&&e.length>0},_is_work_hour:function(t){for(var e=this._getWorkHours(t),n=t.getHours(),i=0;i=e[i].startHour&&n=e[i].start&&no.valueOf(),this._isWorkTime(a,n))(d||h&&f)&&(s=r[n+"_start"](new Date(a)),l=r.add(s,i,n)),d?(d=!1,u=this._nextDate(s,n,i),c+=(l.valueOf()-a.valueOf())/(l.valueOf()-s.valueOf())):h&&f?(h=!1,c+=(o.valueOf()-a.valueOf())/(l.valueOf()-s.valueOf())):c++;else{var _=this._getUnitOrder(n),g=this.units[_-1];g&&!this._isWorkTime(a,g)&&(u=this._getClosestWorkTimeFuture(a,g))}a=u}return c},_getMinutesPerHour:function(t){for(var e=this._getTimeOfDayStamp(t),n=this._getTimeOfDayStamp(this._nextDate(t,"hour",1)),i=this._getWorkHours(t),r=0;r=a.start&&n<=a.end)return 60;if(ea.start)return(Math.min(n,a.end)-Math.max(e,a.start))/60}return 0},_getMinutesPerDay:function(t){var e=0;return this._getWorkHours(t).forEach(function(t){e+=t.durationMinutes}),e},getHoursPerDay:function(t){var e=0;return this._getWorkHours(t).forEach(function(t){e+=t.durationHours}),e},_getWorkUnitsForRange:function(t,e,n,i){var a,o=0,s=new Date(t),l=new Date(e);for(a="minute"==n?r.bind(this._getMinutesPerDay,this):r.bind(this.getHoursPerDay,this);s.valueOf()=0?1:-1;return n=Math.abs(1*n),this._calculateEndDate(e,n,i,r*a)},_calculateEndDate:function(t,e,n,i){return!!n&&(1==i&&"minute"==n?this._calculateMinuteEndDate(t,e,i):1==i&&"hour"==n?this._calculateHourEndDate(t,e,i):this._addInterval(t,e,n,i,null).end)},_addInterval:function(t,e,n,i,r){for(var a=0,o=t;a0?new Date(s.valueOf()-1):new Date(s.valueOf()+1),n)&&a++,o=s}return{end:o,start:t,added:a}},_calculateHourEndDate:function(t,e,n){var i=new Date(t),r=0;n=n||1,e=Math.abs(1*e);var a=this._addInterval(i,e,"hour",n,function(t){return!(t.getHours()||t.getMinutes()||t.getSeconds()||t.getMilliseconds())});if(r=a.added,i=a.end,(c=e-r)&&c>24){for(var o=i;r0?new Date(s.valueOf()-1):new Date(s.valueOf()+1),"day")){var l=this.getHoursPerDay(o);if(r+l>=e)break;r+=l}o=s}i=o}if(r0?this._getClosestWorkTimeFuture(a,r):this._getClosestWorkTimePast(a,r),!this._isWorkTime(a,e)));){if(++o>3e3)return this.$gantt.assert(!1,"Invalid working time check"),!1;var s=a.getTimezoneOffset();a=this.$gantt.date.add(a,n,e),a=this.$gantt._correct_dst_change(a,s,n,e),this.$gantt.date[e+"_start"]&&(a=this.$gantt.date[e+"_start"](a))}return a},hasWorkTime:function(){var t=this.getConfig(),e=t.dates,n=[];for(var i in t.dates)Number(i)>6&&n.push(Number(i));var r=this._checkWorkHours(t.hours),a=!1;return[0,1,2,3,4,5,6].forEach(function(t){if(!a){var n=e[t];!0===n?a=r:Array.isArray(n)&&(a=this._checkWorkHours(n))}}),a},_checkWorkHours:function(t){if(0===t.length)return!1;for(var e=!1,n=0;ne.length?t:e,r=t===i?e:t;i=i.slice(),r=r.slice();n=[];for(var a=0;ao.start&&(n.push({start:Math.max(o.start,l.start),end:Math.min(o.end,l.end)}),o.end>l.end&&(r.splice(s,1),s--,a--))}return n},_mergeAdjacentIntervals:function(t){var e=t.slice();e.sort(function(t,e){return t.start-e.start});for(var n=e[0],i=1;in.end&&(n.end=r.end),e.splice(i,1),i--):n=r}return e},_mergeHoursConfig:function(t,e){return this._mergeAdjacentIntervals(this._intersectHourRanges(t,e))},merge:function(t,e){var n=i.copy(t.getConfig().parsed),r=i.copy(e.getConfig().parsed),a={hours:this._toHoursArray(this._mergeHoursConfig(n.hours,r.hours)),dates:{}};for(var o in n.dates){var s=n.dates[o],l=r.dates[o];if(s&&l)if(Array.isArray(s)||Array.isArray(l)){var c=Array.isArray(s)?s:n.hours,u=Array.isArray(l)?l:r.hours;a.dates[o]=this._toHoursArray(this._mergeHoursConfig(c,u))}else a.dates[o]=!0;else a.dates[o]=!1}return a}},t.exports=r},function(t,e,n){var i=n(0),r=n(31),a=n(165),o=n(164),s=n(160),l=n(159)();function c(t){this.$gantt=t,this._calendars={}}c.prototype={_calendars:{},_convertWorkTimeSettings:function(t){var e=t.days;if(e&&!t.dates){t.dates=t.dates||{};for(var n=0;n=3?(r=n,a=i):"string"==typeof arguments[1]?r=arguments[1]:"function"==typeof arguments[1]&&(a=arguments[1]),this._load_type=r,this.callEvent("onLoadStart",[e,r]),this.ajax.get(e,t.bind(function(t){this.on_load(t,r),this.callEvent("onLoadEnd",[e,r]),"function"==typeof a&&a.call(this)},this))},t.parse=function(t,e){this.on_load({xmlDoc:{responseText:t}},e)},t.serialize=function(t){return this[t=t||"json"].serialize()},t.on_load=function(t,e){if(t.xmlDoc&&404===t.xmlDoc.status)this.assert(!1,"Failed to load the data from "+t.xmlDoc.responseURL+", server returns 404");else{this.callEvent("onBeforeParse",[]),e||(e="json"),this.assert(this[e],"Invalid data type:'"+e+"'");var n=t.xmlDoc.responseText,i=this[e].parse(n,t);this._process_loading(i)}},t._process_loading=function(t){t.collections&&this._load_collections(t.collections),this.$data.tasksStore.parse(t.data||t.tasks);var e=t.links||(t.collections?t.collections.links:[]);this.$data.linksStore.parse(e),this.callEvent("onParse",[]),this.render()},t._load_collections=function(t){var e=!1;for(var n in t)if(t.hasOwnProperty(n)){e=!0;var i=t[n],r=this.serverList[n];if(!r)continue;r.splice(0,r.length);for(var a=0;a"},_copyObject:function(t){return""},serialize:function(){for(var e=[],n=[],i=t.json.serialize(),r=0,a=i.data.length;r"+e.join("")+""+n.join("")+""}},t.oldxml={parse:function(e,n){n=t.xml._getXML(e,n,"projects");for(var i={collections:{links:[]}},r=i.data=[],a=t.ajax.xpath("//task",n),o=0;o=r-20&&(t.autoscrollRight(),t.autoscrollStart()),o<=a+20&&(t.autoscrollLeft(),t.autoscrollStart()),oa+20&&t.autoscrollStop(),!0}),this._dnd.attachEvent("onDragEnd",function(){t.autoscrollStop()}))},t.prototype.autoscrollStart=function(){var t=this;if(0!==this._scrollOrder){var e=10*this._scrollOrder,n=this._scrollView.getScrollState();this._scrollView.scrollTo(n.position+e),setTimeout(function(){t.autoscrollStart()},50)}},t.prototype.autoscrollRight=function(){this._scrollOrder=1},t.prototype.autoscrollLeft=function(){this._scrollOrder=-1},t.prototype.autoscrollStop=function(){this._scrollOrder=0},t.prototype.getCorrection=function(){return this.isScrollable()?this._scrollView.getScrollState().position:0},t.prototype.isScrollable=function(){return!!this.$grid.$config.scrollable},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=n(171),a=function(){function t(t,e){var n=this;this._targetMarker=null,this.calculateCurrentPosition=function(t){var e=n.$grid.$grid.getBoundingClientRect(),i=e.right,r=e.left,a=t;return a>i&&(a=i),a=e},d=function(t){return--t});for(var h=this._dragX-this.$grid.$grid.getBoundingClientRect().left+this._scrollableGrid.getCorrection(),f=l;u(f,c)&&(void 0===t||void 0===e);f=d(f))s.startX=s.endX,s.endX+=o[f].width,h>=s.startX&&(h<=s.endX||!u(d(f),c))&&(t=f,n=s.startX,i=s.endX,r=(h-s.startX)/(s.endX-s.startX)),a===o[f].name&&(e=f);return{targetIndex:t,draggedIndex:e,xBefore:n,xAfter:i,columnRelativePos:r}},t.prototype.setMarkerPosition=function(t,e){void 0===e&&(e=10);var n=this._dnd.config.marker,i=this._dnd._obj.getBoundingClientRect();n.style.top=i.y+e+"px",n.style.left=t+"px"},t.prototype.drawTargetMarker=function(t){var e,n=t.targetIndex,r=t.draggedIndex,a=t.xBefore,o=t.xAfter,s=t.columnRelativePos;this._targetMarker||(this._targetMarker=document.createElement("div"),i.addClassName(this._targetMarker,"gantt_grid_target_marker"),this._targetMarker.style.display="none",this._targetMarker.style.height=this._gridConfig.scale_height+"px"),this._targetMarker.parentNode||this.$grid.$grid_scale.appendChild(this._targetMarker),e=n>r?o:n.5?o:a,this._targetMarker.style.left=e+"px",this._targetMarker.style.display="block"},t.prototype.cleanTargetMarker=function(){this._targetMarker&&this._targetMarker.parentNode&&this.$grid.$grid_scale.removeChild(this._targetMarker),this._targetMarker=null},t}();e.ColumnsGridDnd=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(172);e.default=i.ColumnsGridDnd},function(t,e){t.exports=function(t,e){return{init:function(){},doOnRender:function(){}}}},function(t,e,n){var i=n(21);t.exports=function(t){n(170)(t),i.prototype.getGridColumns=function(){for(var t=this.$getConfig().columns,e=[],n=0;n=0?"&":"?",a=t.getScrollState().y||0,o={taskId:e,url:n+r+"parent_id="+encodeURIComponent(e)};if(!1===t.callEvent("onBeforeBranchLoading",[o]))return;t.load(o.url,this._load_type,function(){a&&t.scrollTo(null,a),t.callEvent("onAfterBranchLoading",[o])}),i[e]=!0}})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this.format=function(t){return e._getWBSCode(t.source)},this.canParse=function(t){return e._linkReg.test(t)},this.parse=function(t){if(!e.canParse(t))return null;var n=e._linkReg.exec(t)[0].trim();return{id:void 0,source:e._findSource(n)||null,target:null,type:e._gantt.config.links.finish_to_start,lag:0}},this._getWBSCode=function(t){var n=e._gantt.getTask(t);return e._gantt.getWBSCode(n)},this._findSource=function(t){var n=new RegExp("^[0-9.]+","i");if(n.exec(t)){var i=n.exec(t)[0],r=e._gantt.getTaskByWBSCode(i);if(r)return r.id}return null},this._linkReg=/^[0-9\.]+/,this._gantt=t}return t.create=function(e,n){return void 0===e&&(e=null),new t(n)},t}();e.default=i},function(t,e,n){var i=n(33).default,r=n(177).default;t.exports=function(t){t.ext.formatters={durationFormatter:function(e){return e||(e={}),e.store||(e.store=t.config.duration_unit),e.enter||(e.enter=t.config.duration_unit),i.create(e,t)},linkFormatter:function(e){return r.create(e,t)}}}},function(t,e){t.exports=function(t){function e(e){return function(){return!t.config.auto_types||t.getTaskType(t.config.types.project)!=t.config.types.project||e.apply(this,arguments)}}function n(e){t.batchUpdate(function(){!function e(n){!function(e){e=e.id||e;var n=t.getTask(e),i=a(n);!1!==i&&r(n,i)}(n);var i=t.getParent(n);i!=t.config.root_id&&e(i)}(e)})}var i;function r(e,n){t.getState().group_mode||(e.type=n,t.updateTask(e.id))}function a(e){var n=t.config.types,i=t.hasChild(e.id),r=t.getTaskType(e.type);return i&&r===n.task?n.project:!i&&r===n.project&&n.task}var o,s,l=!0;function c(e){e!=t.config.root_id&&t.isTaskExists(e)&&n(e)}t.attachEvent("onParse",e(function(){l=!1,t.batchUpdate(function(){t.eachTask(function(t){var e=a(t);!1!==e&&r(t,e)})}),l=!0})),t.attachEvent("onAfterTaskAdd",e(function(t){l&&n(t)})),t.attachEvent("onAfterTaskUpdate",e(function(t){l&&n(t)})),t.attachEvent("onBeforeTaskDelete",e(function(e,n){return i=t.getParent(e),!0})),t.attachEvent("onAfterTaskDelete",e(function(t,e){c(i)})),t.attachEvent("onRowDragStart",e(function(e,n,i){return o=t.getParent(e),!0})),t.attachEvent("onRowDragEnd",e(function(t,e){c(o),n(t)})),t.attachEvent("onBeforeTaskMove",e(function(e,n,i){return s=t.getParent(e),!0})),t.attachEvent("onAfterTaskMove",e(function(t,e,i){document.querySelector(".gantt_drag_marker")||(c(s),n(t))}))}},function(t,e){t.exports=function(t){function e(e){return function(){return!t.config.placeholder_task||e.apply(this,arguments)}}function n(){var e=t.getTaskBy("type",t.config.types.placeholder);if(!e.length||!t.isTaskExists(e[0].id)){var n={unscheduled:!0,type:t.config.types.placeholder,duration:0,text:t.locale.labels.new_task};if(!1===t.callEvent("onTaskCreated",[n]))return;t.addTask(n)}}function i(e){var n=t.getTask(e);n.type==t.config.types.placeholder&&(n.start_date&&n.end_date&&n.unscheduled&&(n.unscheduled=!1),t.batchUpdate(function(){var e=t.copy(n);t.silent(function(){t.deleteTask(n.id)}),delete e["!nativeeditor_status"],e.type=t.config.types.task,e.id=t.uid(),t.addTask(e)}))}t.config.types.placeholder="placeholder",t.attachEvent("onDataProcessorReady",e(function(n){n&&!n._silencedPlaceholder&&(n._silencedPlaceholder=!0,n.attachEvent("onBeforeUpdate",e(function(e,i,r){return r.type!=t.config.types.placeholder||(n.setUpdated(e,!1),!1)})))}));var r=!1;function a(e){if(t.config.types.placeholder&&t.isTaskExists(e)&&t.getTask(e).type==t.config.types.placeholder)return!0;return!1}function o(t){return!(!a(t.source)&&!a(t.target))}t.attachEvent("onGanttReady",function(){r||(r=!0,t.attachEvent("onAfterTaskUpdate",e(i)),t.attachEvent("onAfterTaskAdd",e(function(e,i){i.type!=t.config.types.placeholder&&(t.getTaskBy("type",t.config.types.placeholder).forEach(function(e){t.silent(function(){t.isTaskExists(e.id)&&t.deleteTask(e.id)})}),n())})),t.attachEvent("onParse",e(n)))}),t.attachEvent("onLinkValidation",function(t){return!o(t)}),t.attachEvent("onBeforeLinkAdd",function(t,e){return!o(e)}),t.attachEvent("onBeforeUndoStack",function(e){for(var n=0;n-1?t.indexOf("?"):t.length),this.serverProcessor=t+("/"===t.slice(-1)?"":"/")+n}else{var i=this._ganttMode+"s";this.serverProcessor=t+e.ajax.urlSeparator(t)+"gantt_mode="+i}return!0}),t.attachEvent("insertCallback",function(t,n,i,r){var a=t.data||e.xml._xmlNodeToJSON(t.firstChild),o={add:e.addTask,isExist:e.isTaskExists};"links"===r&&(o.add=e.addLink,o.isExist=e.isLinkExists),o.isExist.call(e,n)||(a.id=n,o.add.call(e,a))}),t.attachEvent("updateCallback",function(t,n){var i=t.data||e.xml._xmlNodeToJSON(t.firstChild);if(e.isTaskExists(n)){var r=e.getTask(n);for(var a in i){var o=i[a];switch(a){case"id":continue;case"start_date":case"end_date":o=e.defined(e.templates.xml_date)?e.templates.xml_date(o):e.templates.parse_date(o);break;case"duration":r.end_date=e.calculateEndDate({start_date:r.start_date,duration:o,task:r})}r[a]=o}e.updateTask(n),e.refreshData()}}),t.attachEvent("deleteCallback",function(t,n,i,r){var a={delete:e.deleteTask,isExist:e.isTaskExists};"links"===r&&(a.delete=e.deleteLink,a.isExist=e.isLinkExists),a.isExist.call(e,n)&&a.delete.call(e,n)})},t.prototype.detach=function(){var t=this;i.forEach(this._dataProcessorHandlers,function(e){t.$gantt.detachEvent(e)}),this._dataProcessorHandlers=[]},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),r=n(3),a=n(0),o=n(187),s=n(186),l=n(185);e.createDataProcessor=function(t){var e,n;t instanceof Function?e=t:t.hasOwnProperty("router")?e=t.router:t.hasOwnProperty("link")&&t.hasOwnProperty("task")&&(e=t),n=e?"CUSTOM":t.mode||"REST-JSON";var i=new c(t.url);return i.init(this),i.setTransactionMode({mode:n,router:e},t.batchUpdate),i};var c=function(){function t(t){this.serverProcessor=t,this.action_param="!nativeeditor_status",this.object=null,this.updatedRows=[],this.autoUpdate=!0,this.updateMode="cell",this._headers=null,this._payload=null,this._postDelim="_",this._waitMode=0,this._in_progress={},this._storage=l.default.create(),this._invalid={},this.messages=[],this.styles={updated:"font-weight:bold;",inserted:"font-weight:bold;",deleted:"text-decoration : line-through;",invalid:"background-color:FFE0E0;",invalid_cell:"border-bottom:2px solid red;",error:"color:red;",clear:"font-weight:normal;text-decoration:none;"},this.enableUTFencoding(!0),i(this)}return t.prototype.setTransactionMode=function(t,e){"object"==typeof t?(this._tMode=t.mode||this._tMode,a.defined(t.headers)&&(this._headers=t.headers),a.defined(t.payload)&&(this._payload=t.payload)):(this._tMode=t,this._tSend=e),"REST"===this._tMode&&(this._tSend=!1,this._endnm=!0),"JSON"!==this._tMode&&"REST-JSON"!==this._tMode||(this._tSend=!1,this._endnm=!0,this._serializeAsJson=!0,this._headers=this._headers||{},this._headers["Content-type"]="application/json"),"CUSTOM"===this._tMode&&(this._tSend=!1,this._endnm=!0,this._router=t.router)},t.prototype.escape=function(t){return this._utf?encodeURIComponent(t):escape(t)},t.prototype.enableUTFencoding=function(t){this._utf=!!t},t.prototype.setDataColumns=function(t){this._columns="string"==typeof t?t.split(","):t},t.prototype.getSyncState=function(){return!this.updatedRows.length},t.prototype.enableDataNames=function(t){this._endnm=!!t},t.prototype.enablePartialDataSend=function(t){this._changed=!!t},t.prototype.setUpdateMode=function(t,e){this.autoUpdate="cell"===t,this.updateMode=t,this.dnd=e},t.prototype.ignore=function(t,e){this._silent_mode=!0,t.call(e||window),this._silent_mode=!1},t.prototype.setUpdated=function(t,e,n){if(!this._silent_mode){var i=this.findRow(t);n=n||"updated";var r=this.$gantt.getUserData(t,this.action_param);r&&"updated"===n&&(n=r),e?(this.set_invalid(t,!1),this.updatedRows[i]=t,this.$gantt.setUserData(t,this.action_param,n),this._in_progress[t]&&(this._in_progress[t]="wait")):this.is_invalid(t)||(this.updatedRows.splice(i,1),this.$gantt.setUserData(t,this.action_param,"")),this.markRow(t,e,n),e&&this.autoUpdate&&this.sendData(t)}},t.prototype.markRow=function(t,e,n){var i="",r=this.is_invalid(t);if(r&&(i=this.styles[r],e=!0),this.callEvent("onRowMark",[t,e,n,r])&&(i=this.styles[e?n:"clear"]+i,this.$gantt[this._methods[0]](t,i),r&&r.details)){i+=this.styles[r+"_cell"];for(var a=0;aa.indexOf("/task")?"link":"task",this.setGanttMode(r);var o,s=this.$gantt.ajax;try{o=JSON.parse(e.xmlDoc.responseText)}catch(t){e.xmlDoc.responseText.length||(o={})}if(o){var l=o.action||this.getState(n)||"updated",c=o.sid||n[0],u=o.tid||n[0];return t.afterUpdateCallback(c,u,l,o,r),t.finalizeUpdate(),void this.setGanttMode(r)}var d=s.xmltop("data",e.xmlDoc);if(!d)return this.cleanUpdate(n);var h=s.xpath("//data/action",d);if(!h.length)return this.cleanUpdate(n);for(var f=0;fr||+n.end_date<+i)return!1}return!0}),o.attachEvent("onIdChange",function(e,n){t._update_flags(e,n)}),o.attachEvent("onAfterUpdate",function(e){if(t._update_parents(e),t.getState("batchUpdate").batch_update)return!0;for(var n=o.getItem(e),i=0;i=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(196),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(13))},function(t,e,n){(function(e,n,i){t.exports=function(){var t,r,a;return function t(e,n,i){function r(o,s){if(!n[o]){if(!e[o]){var l="function"==typeof _dereq_&&_dereq_;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};e[o][0].call(u.exports,function(t){var n=e[o][1][t];return r(n||t)},u,u.exports,t,e,n,i)}return n[o].exports}for(var a="function"==typeof _dereq_&&_dereq_,o=0;o0;)f(t)}function f(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),i=t.shift();e.call(n,i)}}l.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},l.prototype.hasCustomScheduler=function(){return this._customScheduler},l.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},l.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},l.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},l.prototype.fatalError=function(t,n){n?(e.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),e.exit(2)):this.throwLater(t)},l.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(l.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?c.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},l.prototype.invoke=function(t,e,n){this._trampolineEnabled?u.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},l.prototype.settlePromises=function(t){this._trampolineEnabled?d.call(this,t):this._schedule(function(){t._settlePromises()})}):(l.prototype.invokeLater=c,l.prototype.invoke=u,l.prototype.settlePromises=d),l.prototype._drainQueues=function(){h(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,h(this._lateQueue)},l.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},l.prototype._reset=function(){this._isTickUsed=!1},n.exports=l,n.exports.firstLineError=r},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,i){var r=!1,a=function(t,e){this._reject(e)},o=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(a,a,null,this,t)},s=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},l=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(a){r||(r=!0,t.prototype._propagateFrom=i.propagateFromFunction(),t.prototype._boundValue=i.boundValueFunction());var c=n(a),u=new t(e);u._propagateFrom(this,1);var d=this._target();if(u._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:d,bindingPromise:c};d._then(e,o,void 0,u,h),c._then(s,l,void 0,u,h),u._setOnCancel(c)}else u._resolveCallback(d);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";var i;"undefined"!=typeof Promise&&(i=Promise);var r=t("./promise")();r.noConflict=function(){try{Promise===r&&(Promise=i)}catch(t){}return r},e.exports=r},{"./promise":22}],5:[function(t,e,n){"use strict";var i=Object.create;if(i){var r=i(null),a=i(null);r[" size"]=a[" size"]=0}e.exports=function(e){var n=t("./util"),i=n.canEvaluate;function r(t){var i=this.pop(),r=function(t,i){var r;if(null!=t&&(r=t[i]),"function"!=typeof r){var a="Object "+n.classString(t)+" has no method '"+n.toString(i)+"'";throw new e.TypeError(a)}return r}(t,i);return r.apply(t,this)}function a(t){return t[this]}function o(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}n.isIdentifier,e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(i){var r=(void 0)(t);e=null!==r?r:a}else e=a;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,i,r){var a=t("./util"),o=a.tryCatch,s=a.errorObj,l=e._async;e.prototype.break=e.prototype.cancel=function(){if(!r.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(a.isArray(t))for(var n=0;n=0)return n[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},i.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},i.prototype._popContext=function(){if(void 0!==this._trace){var t=n.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},i.CapturedTrace=null,i.create=function(){if(e)return new i},i.deactivateLongStackTraces=function(){},i.activateLongStackTraces=function(){var n=t.prototype._pushContext,a=t.prototype._popContext,o=t._peekContext,s=t.prototype._peekContext,l=t.prototype._promiseCreated;i.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=a,t._peekContext=o,t.prototype._peekContext=s,t.prototype._promiseCreated=l,e=!1},e=!0,t.prototype._pushContext=i.prototype._pushContext,t.prototype._popContext=i.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},i}},{}],9:[function(t,n,i){"use strict";n.exports=function(n,i){var r,a,o,s=n._getDomain,l=n._async,c=t("./errors").Warning,u=t("./util"),d=t("./es5"),h=u.canAttachTrace,f=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,_=/\((?:timers\.js):\d+:\d+\)/,g=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,p=null,v=null,m=!1,y=!(0==u.env("BLUEBIRD_DEBUG")),k=!(0==u.env("BLUEBIRD_WARNINGS")||!y&&!u.env("BLUEBIRD_WARNINGS")),b=!(0==u.env("BLUEBIRD_LONG_STACK_TRACES")||!y&&!u.env("BLUEBIRD_LONG_STACK_TRACES")),w=0!=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(k||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){U("rejectionHandled",r,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),U("unhandledRejection",a,t,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(t,e,n){return z(t,e,n||this)},n.onPossiblyUnhandledRejection=function(t){var e=s();a="function"==typeof t?null===e?t:u.domainBind(e,t):void 0},n.onUnhandledRejectionHandled=function(t){var e=s();r="function"==typeof t?null===e?t:u.domainBind(e,t):void 0};var x=function(){};n.longStackTraces=function(){if(l.haveItemsQueued()&&!Z.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!Z.longStackTraces&&G()){var t=n.prototype._captureStackTrace,e=n.prototype._attachExtraTrace,r=n.prototype._dereferenceTrace;Z.longStackTraces=!0,x=function(){if(l.haveItemsQueued()&&!Z.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=t,n.prototype._attachExtraTrace=e,n.prototype._dereferenceTrace=r,i.deactivateLongStackTraces(),l.enableTrampoline(),Z.longStackTraces=!1},n.prototype._captureStackTrace=R,n.prototype._attachExtraTrace=F,n.prototype._dereferenceTrace=H,i.activateLongStackTraces(),l.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return Z.longStackTraces&&G()};var T=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n={detail:e,cancelable:!0};d.defineProperty(n,"promise",{value:e.promise}),d.defineProperty(n,"reason",{value:e.reason});var i=new CustomEvent(t.toLowerCase(),n);return!u.global.dispatchEvent(i)}}if("function"==typeof Event){var t=new Event("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,d.defineProperty(n,"promise",{value:e.promise}),d.defineProperty(n,"reason",{value:e.reason}),!u.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),u.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!u.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),$=u.isNode?function(){return e.emit.apply(e,arguments)}:u.global?function(t){var e="on"+t.toLowerCase(),n=u.global[e];return!!n&&(n.apply(u.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function S(t,e){return{promise:e}}var C={promiseCreated:S,promiseFulfilled:S,promiseRejected:S,promiseResolved:S,promiseCancelled:S,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:S},E=function(t){var e=!1;try{e=$.apply(null,arguments)}catch(t){l.throwLater(t),e=!0}var n=!1;try{n=T(t,C[t].apply(null,arguments))}catch(t){l.throwLater(t),n=!0}return n||e};function D(){return!1}function A(t,e,n){var i=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+u.toString(t));i._attachCancellationCallback(t)})}catch(t){return t}}function N(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?u.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function M(){return this._onCancelField}function I(t){this._onCancelField=t}function P(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(t,e){if(0!=(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}n.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?n.longStackTraces():!t.longStackTraces&&n.hasLongStackTraces()&&x()),"warnings"in t){var e=t.warnings;Z.warnings=!!e,w=Z.warnings,u.isObject(e)&&"wForgottenReturn"in e&&(w=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!Z.cancellation){if(l.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=P,n.prototype._propagateFrom=L,n.prototype._onCancel=M,n.prototype._setOnCancel=I,n.prototype._attachCancellationCallback=N,n.prototype._execute=A,O=L,Z.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!Z.monitoring?(Z.monitoring=!0,n.prototype._fireEvent=E):!t.monitoring&&Z.monitoring&&(Z.monitoring=!1,n.prototype._fireEvent=D)),n},n.prototype._fireEvent=D,n.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(t){},n.prototype._attachCancellationCallback=function(t){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(t,e){};var O=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function j(){var t=this._boundTo;return void 0!==t&&t instanceof n?t.isFulfilled()?t.value():void 0:t}function R(){this._trace=new X(this._peekContext())}function F(t,e){if(h(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var i=V(t);u.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),u.notEnumerableProp(t,"__stackCleaned__",!0)}}}function H(){this._trace=void 0}function z(t,e,i){if(Z.warnings){var r,a=new c(t);if(e)i._attachExtraTrace(a);else if(Z.longStackTraces&&(r=n._peekContext()))r.attachExtraTrace(a);else{var o=V(a);a.stack=o.message+"\n"+o.stack.join("\n")}E("warning",a)||W(a,"",!0)}}function B(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:B(e)}}function W(t,e,n){if("undefined"!=typeof console){var i;if(u.isObject(t)){var r=t.stack;i=e+v(r,t)}else i=e+String(t);"function"==typeof o?o(i,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(i)}}function U(t,e,n,i){var r=!1;try{"function"==typeof e&&(r=!0,"rejectionHandled"===t?e(i):e(n,i))}catch(t){l.throwLater(t)}"unhandledRejection"===t?E(t,n,i)||r||W(n,"Unhandled rejection "):E(t,i)}function q(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{if(e=t&&"function"==typeof t.toString?t.toString():u.toString(t),/\[object [a-zA-Z0-9$_]+\]/.test(e))try{var n=JSON.stringify(t);e=n}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function G(){return"function"==typeof Q}var K=function(){return!1},Y=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function J(t){var e=t.match(Y);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function X(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);Q(this,X),e>32&&this.uncycle()}u.inherits(X,Error),i.CapturedTrace=X,X.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],n={},i=0,r=this;void 0!==r;++i)e.push(r),r=r._parent;for(var i=(t=this._length=i)-1;i>=0;--i){var a=e[i].stack;void 0===n[a]&&(n[a]=i)}for(var i=0;i0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[i]._parent=void 0,e[i]._length=1;var l=i>0?e[i-1]:this;s=0;--u)e[u]._length=c,c++;return}}}},X.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=V(t),n=e.message,i=[e.stack],r=this;void 0!==r;)i.push(B(r.stack.split("\n"))),r=r._parent;!function(t){for(var e=t[0],n=1;n=0;--s)if(i[s]===a){o=s;break}for(var s=o;s>=0;--s){var l=i[s];if(e[r]!==l)break;e.pop(),r--}e=i}}(i),function(t){for(var e=0;e=0)return p=/@/,v=e,m=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){i="stack"in t}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(v=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?q(e):e.toString()},null):(p=t,v=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(o=function(t){console.warn(t)},u.isNode&&e.stderr.isTTY?o=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:u.isNode||"string"!=typeof(new Error).stack||(o=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var Z={warnings:k,longStackTraces:!1,cancellation:!1,monitoring:!1};return b&&n.longStackTraces(),{longStackTraces:function(){return Z.longStackTraces},warnings:function(){return Z.warnings},cancellation:function(){return Z.cancellation},monitoring:function(){return Z.monitoring},propagateFromFunction:function(){return O},boundValueFunction:function(){return j},checkForgottenReturns:function(t,e,n,i,r){if(void 0===t&&null!==e&&w){if(void 0!==r&&r._returnedNonUndefined())return;if(0==(65535&i._bitField))return;n&&(n+=" ");var a="",o="";if(e._trace){for(var s=e._trace.stack.split("\n"),l=B(s),c=l.length-1;c>=0;--c){var u=l[c];if(!_.test(u)){var d=u.match(g);d&&(a="at "+d[1]+":"+d[2]+":"+d[3]+" ");break}}if(l.length>0)for(var h=l[0],c=0;c0&&(o="\n"+s[c-1]);break}}var f="a promise was created in a "+n+"handler "+a+"but was not returned from it, see http://goo.gl/rRqMUw"+o;i._warn(f,!0,e)}},setBounds:function(t,e){if(G()){for(var n,i,r=t.stack.split("\n"),a=e.stack.split("\n"),o=-1,s=-1,l=0;l=s||(K=function(t){if(f.test(t))return!0;var e=J(t);return!!(e&&e.fileName===n&&o<=e.line&&e.line<=s)})}},warn:z,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),z(n)},CapturedTrace:X,fireDomEvent:T,fireGlobalEvent:$}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var i=arguments[1];return i instanceof t&&i.suppressUnhandledRejections(),this.caught(n,function(){return i})}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.reduce,i=t.all;function r(){return i(this)}t.prototype.each=function(t){return n(this,t,e,0)._then(r,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return n(this,t,e,e)},t.each=function(t,i){return n(t,i,e,0)._then(r,void 0,void 0,t,void 0)},t.mapSeries=function(t,i){return n(t,i,e,e)}}},{}],12:[function(t,e,n){"use strict";var i,r,a=t("./es5"),o=a.freeze,s=t("./util"),l=s.inherits,c=s.notEnumerableProp;function u(t,e){function n(i){if(!(this instanceof n))return new n(i);c(this,"message","string"==typeof i?i:e),c(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(n,Error),n}var d=u("Warning","warning"),h=u("CancellationError","cancellation error"),f=u("TimeoutError","timeout error"),_=u("AggregateError","aggregate error");try{i=TypeError,r=RangeError}catch(t){i=u("TypeError","type error"),r=u("RangeError","range error")}for(var g="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),p=0;p1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function d(){return f.call(this,this.promise._target()._settledValue())}function h(t){if(!u(this,t))return o.e=t,o}function f(t){var r=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(r._boundValue()):s.call(r._boundValue(),t);if(l===i)return l;if(void 0!==l){r._setReturnedNonUndefined();var f=n(l,r);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new a("late cancellation observer");return r._attachExtraTrace(_),o.e=_,o}f.isPending()&&f._attachCancellationCallback(new c(this))}return f._then(d,h,void 0,this,void 0)}}}return r.isRejected()?(u(this),o.e=t,o):(u(this),t)}return l.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){u(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,i){return"function"!=typeof t?this.then():this._then(n,i,void 0,new l(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,f,f)},e.prototype.tap=function(t){return this._passThrough(t,1,f)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,f);var i,a=new Array(n-1),o=0;for(i=0;i0&&"function"==typeof arguments[e]&&(t=arguments[e]);var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a,o){var s=e._getDomain,l=t("./util"),c=l.tryCatch,u=l.errorObj,d=e._async;function h(t,e,n,i){this.constructor$(t),this._promise._captureStackTrace();var r=s();this._callback=null===r?e:l.domainBind(r,e),this._preservedValues=i===a?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],d.invoke(this._asyncInit,this,void 0)}function f(t,n,r,a){if("function"!=typeof n)return i("expecting a function but got "+l.classString(n));var o=0;if(void 0!==r){if("object"!=typeof r||null===r)return e.reject(new TypeError("options argument must be an object but it is "+l.classString(r)));if("number"!=typeof r.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+l.classString(r.concurrency)));o=r.concurrency}return o="number"==typeof o&&isFinite(o)&&o>=1?o:0,new h(t,n,o,a).promise()}l.inherits(h,n),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(t,n){var i=this._values,a=this.length(),s=this._preservedValues,l=this._limit;if(n<0){if(i[n=-1*n-1]=t,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return i[n]=t,this._queue.push(n),!1;null!==s&&(s[n]=t);var d=this._promise,h=this._callback,f=d._boundValue();d._pushContext();var _=c(h).call(f,t,n,a),g=d._popContext();if(o.checkForgottenReturns(_,g,null!==s?"Promise.filter":"Promise.map",d),_===u)return this._reject(_.e),!0;var p=r(_,this._promise);if(p instanceof e){var v=(p=p._target())._bitField;if(0==(50397184&v))return l>=1&&this._inFlight++,i[n]=p,p._proxy(this,-1*(n+1)),!1;if(0==(33554432&v))return 0!=(16777216&v)?(this._reject(p._reason()),!0):(this._cancel(),!0);_=p._value()}i[n]=_}var m=++this._totalResolved;return m>=a&&(null!==s?this._filter(i,s):this._resolve(i),!0)},h.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight1){a.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],u=arguments[2];i=o.isArray(c)?s(t).apply(u,c):s(t).call(u,c)}else i=s(t)();var d=l._popContext();return a.checkForgottenReturns(i,d,"Promise.try",l),l._resolveFromSyncValue(i),l},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";var i=t("./util"),r=i.maybeWrapAsError,a=t("./errors"),o=a.OperationalError,s=t("./es5"),l=/^(?:name|message|stack|cause)$/;function c(t){var e;if(function(t){return t instanceof Error&&s.getPrototypeOf(t)===Error.prototype}(t)){(e=new o(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=s.keys(t),r=0;r1){var n,i=new Array(e-1),r=0;for(n=0;n0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+c.classString(t);arguments.length>1&&(n+=", "+c.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},D.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},D.prototype.spread=function(t){return"function"!=typeof t?a("expecting a function but got "+c.classString(t)):this.all()._then(t,void 0,void 0,v,void 0)},D.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},D.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},D.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},D.getNewLibraryCopy=n.exports,D.is=function(t){return t instanceof D},D.fromNode=D.fromCallback=function(t){var e=new D(p);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=E(t)(S(e,n));return i===C&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},D.all=function(t){return new k(t).promise()},D.cast=function(t){var e=y(t);return e instanceof D||((e=new D(p))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},D.resolve=D.fulfilled=D.cast,D.reject=D.rejected=function(t){var e=new D(p);return e._captureStackTrace(),e._rejectCallback(t,!0),e},D.setScheduler=function(t){if("function"!=typeof t)throw new _("expecting a function but got "+c.classString(t));return h.setScheduler(t)},D.prototype._then=function(t,e,n,i,r){var a=void 0!==r,o=a?r:new D(p),l=this._target(),u=l._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var d=s();if(0!=(50397184&u)){var f,_,v=l._settlePromiseCtx;0!=(33554432&u)?(_=l._rejectionHandler0,f=t):0!=(16777216&u)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(v=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),f=e),h.invoke(v,l,{handler:null===d?f:"function"==typeof f&&c.domainBind(d,f),promise:o,receiver:i,value:_})}else l._addCallbacks(t,e,o,i,d);return o},D.prototype._length=function(){return 65535&this._bitField},D.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},D.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},D.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},D.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},D.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},D.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},D.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},D.prototype._isFinal=function(){return(4194304&this._bitField)>0},D.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},D.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},D.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},D.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},D.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==l)return void 0===e&&this._isBound()?this._boundValue():e},D.prototype._promiseAt=function(t){return this[4*t-4+2]},D.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},D.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},D.prototype._boundValue=function(){},D.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,n=t._rejectionHandler0,i=t._promise0,r=t._receiverAt(0);void 0===r&&(r=l),this._addCallbacks(e,n,i,r,null)},D.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),i=t._rejectionHandlerAt(e),r=t._promiseAt(e),a=t._receiverAt(e);void 0===a&&(a=l),this._addCallbacks(n,i,r,a,null)},D.prototype._addCallbacks=function(t,e,n,i,r){var a=this._length();if(a>=65531&&(a=0,this._setLength(0)),0===a)this._promise0=n,this._receiver0=i,"function"==typeof t&&(this._fulfillmentHandler0=null===r?t:c.domainBind(r,t)),"function"==typeof e&&(this._rejectionHandler0=null===r?e:c.domainBind(r,e));else{var o=4*a-4;this[o+2]=n,this[o+3]=i,"function"==typeof t&&(this[o+0]=null===r?t:c.domainBind(r,t)),"function"==typeof e&&(this[o+1]=null===r?e:c.domainBind(r,e))}return this._setLength(a+1),a},D.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},D.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(i(),!1);var n=y(t,this);if(!(n instanceof D))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r!==this){var a=r._bitField;if(0==(50397184&a)){var o=this._length();o>0&&r._migrateCallback0(this);for(var s=1;s>>16)){if(t===this){var n=i();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this),this._dereferenceTrace())}},D.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,c.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},D.prototype._fulfillPromises=function(t,e){for(var n=1;n0){if(0!=(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var i=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,i,t),this._fulfillPromises(e,i)}this._setLength(0)}this._clearCancellationData()},D.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},D.defer=D.pending=function(){x.deprecated("Promise.defer","new Promise");var t=new D(p);return{promise:t,resolve:A,reject:N}},c.notEnumerableProp(D,"_makeSelfResolutionError",i),t("./method")(D,p,y,a,x),t("./bind")(D,p,y,x),t("./cancel")(D,k,a,x),t("./direct_resolve")(D),t("./synchronous_inspection")(D),t("./join")(D,k,y,p,h,s),D.Promise=D,D.version="3.5.4",t("./map.js")(D,k,a,y,p,x),t("./call_get.js")(D),t("./using.js")(D,a,y,w,p,x),t("./timers.js")(D,p,x),t("./generators.js")(D,a,p,y,o,x),t("./nodeify.js")(D),t("./promisify.js")(D,p),t("./props.js")(D,k,y,a),t("./race.js")(D,p,y,a),t("./reduce.js")(D,k,a,y,p,x),t("./settle.js")(D,k,x),t("./some.js")(D,k,a),t("./filter.js")(D,p),t("./each.js")(D,p),t("./any.js")(D),c.toFastProperties(D),c.toFastProperties(D.prototype),M({a:1}),M({b:2}),M({c:3}),M(1),M(function(){}),M(void 0),M(!1),M(new D(p)),x.setBounds(d.firstLineError,c.lastLineError),D}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a){var o=t("./util");function s(t){var i=this._promise=new e(n);t instanceof e&&i._propagateFrom(t,3),i._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.isArray,o.inherits(s,a),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,a){var s=i(this._values,this._promise);if(s instanceof e){var l=(s=s._target())._bitField;if(this._values=s,0==(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,a);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=o.asArray(s)))0!==s.length?this._iterate(s):-5===a?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(a));else{var c=r("expecting an array or an iterable object but got "+o.classString(s)).reason();this._promise._rejectCallback(c,!1)}},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var r=this._promise,a=!1,o=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n=this._length){var i;if(this._isMap)i=function(t){for(var e=new a,n=t.length/2|0,i=0;i>1},e.prototype.props=function(){return d(this)},e.props=function(t){return d(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(t,e){var n=new r;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},o.prototype._promiseRejected=function(t,e){var n=new r;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return i.deprecated(".settle()",".reflect()"),new o(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,i){var r=t("./util"),a=t("./errors").RangeError,o=t("./errors").AggregateError,s=r.isArray,l={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function u(t,e){if((0|e)!==e||e<0)return i("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new c(t),r=n.promise();return n.setHowMany(e),n.init(),r}r.inherits(c,n),c.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return u(t,e)},e.prototype.some=function(t){return u(this,t)},e._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},a=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},o=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return o.call(this._target())},t.prototype.isRejected=function(){return a.call(this._target())},t.prototype.isFulfilled=function(){return r.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),i.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){var i=t("./util"),r=i.errorObj,a=i.isObject,o={}.hasOwnProperty;return function(t,s){if(a(t)){if(t instanceof e)return t;var l=function(t){try{return function(t){return t.then}(t)}catch(t){return r.e=t,r}}(t);if(l===r){s&&s._pushContext();var c=e.reject(l.e);return s&&s._popContext(),c}if("function"==typeof l){if(function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return function(t,a,o){var s=new e(n),l=s;o&&o._pushContext(),s._captureStackTrace(),o&&o._popContext();var c=!0,u=i.tryCatch(a).call(t,function(t){s&&(s._resolveCallback(t),s=null)},function(t){s&&(s._rejectCallback(t,c,!0),s=null)});return c=!1,s&&u===r&&(s._rejectCallback(u.e,!0,!0),s=null),l}(t,l,s)}}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,i){var r=t("./util"),a=e.TimeoutError;function o(t){this.handle=t}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var a,l;return void 0!==r?(a=e.resolve(r)._then(s,null,null,t,void 0),i.cancellation()&&r instanceof e&&a._setOnCancel(r)):(a=new e(n),l=setTimeout(function(){a._fulfill()},+t),i.cancellation()&&a._setOnCancel(new o(l)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};function c(t){return clearTimeout(this.handle),t}function u(t){throw clearTimeout(this.handle),t}e.prototype.delay=function(t){return l(t,this)},e.prototype.timeout=function(t,e){var n,s;t=+t;var l=new o(setTimeout(function(){n.isPending()&&function(t,e,n){var i;i="string"!=typeof e?e instanceof Error?e:new a("operation timed out"):new a(e),r.markAsOriginatingFromRejection(i),t._attachExtraTrace(i),t._reject(i),null!=n&&n.cancel()}(n,e,s)},t));return i.cancellation()?(s=this.then(),(n=s._then(c,u,void 0,l,void 0))._setOnCancel(l)):n=this._then(c,u,void 0,l,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,i,r,a,o){var s=t("./util"),l=t("./errors").TypeError,c=t("./util").inherits,u=s.errorObj,d=s.tryCatch,h={};function f(t){setTimeout(function(){throw t},0)}function _(t,n){var r=0,o=t.length,s=new e(a);return function a(){if(r>=o)return s._fulfill();var l=function(t){var e=i(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[r++]);if(l instanceof e&&l._isDisposable()){try{l=i(l._getDisposer().tryDispose(n),t.promise)}catch(t){return f(t)}if(l instanceof e)return l._then(a,f,null,null,null)}a()}(),s}function g(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function v(t){return g.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function m(t){this.length=t,this.promise=null,this[t-1]=null}g.prototype.data=function(){return this._data},g.prototype.promise=function(){return this._promise},g.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},g.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var i=e!==h?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,i},g.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},c(p,g),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},m.prototype._resultCancelled=function(){for(var t=this.length,n=0;n0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,r());throw new l}}},{"./errors":12,"./util":36}],36:[function(t,i,r){"use strict";var a=t("./es5"),o="undefined"==typeof navigator,s={e:{}},l,c="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:void 0!==this?this:null;function u(){try{var t=l;return l=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function d(t){return l=t,u}var h=function(t,e){var n={}.hasOwnProperty;function i(){for(var i in this.constructor=t,this.constructor$=e,e.prototype)n.call(e.prototype,i)&&"$"!==i.charAt(i.length-1)&&(this[i+"$"]=e.prototype[i])}return i.prototype=e.prototype,t.prototype=new i,t.prototype};function f(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function _(t){return"function"==typeof t||"object"==typeof t&&null!==t}function g(t){return f(t)?new Error(C(t)):t}function p(t,e){var n,i=t.length,r=new Array(i+1);for(n=0;n1,i=e.length>0&&!(1===e.length&&"constructor"===e[0]),r=b.test(t+"")&&a.names(t).length>0;if(n||i||r)return!0}return!1}catch(t){return!1}}function x(t){function e(){}e.prototype=t;var n=new e;function i(){return typeof n.foo}return i(),i(),t}var T=/^[a-z$_][a-z$_0-9]*$/i;function $(t){return T.test(t)}function S(t,e,n){for(var i=new Array(t),r=0;r10||t[0]>0}(),B.isNode&&B.toFastProperties(e);try{throw new Error}catch(t){B.lastLineError=t}i.exports=B},{"./es5":13}]},{},[4])(4)}(),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,n(39),n(13),n(197).setImmediate)},function(t,e,n){t.exports=n(198)},function(t,e,n){var i=n(0);t.exports=function(){var t={};return{getState:function(e){if(e)return t[e].method();var n={};for(var r in t)t[r].internal||i.mixin(n,t[r].method(),!0);return n},registerProvider:function(e,n,i){t[e]={method:n,internal:i}},unregisterProvider:function(e){delete t[e]}}}},function(t,e){t.exports=function(t){var e={};function n(n,i,r){r=r||n;var a=t.config,o=t.templates;t.config[n]&&e[r]!=a[n]&&(i&&o[r]||(o[r]=t.date.date_to_str(a[n]),e[r]=a[n]))}return{initTemplates:function(){var e=t.locale.labels;e.gantt_save_btn=e.icon_save,e.gantt_cancel_btn=e.icon_cancel,e.gantt_delete_btn=e.icon_delete;var i=t.date,r=i.date_to_str,a=t.config,o=r(a.xml_date||a.date_format,a.server_utc),s=i.str_to_date(a.xml_date||a.date_format,a.server_utc);n("date_scale",!0,void 0,t.config,t.templates),n("date_grid",!0,"grid_date_format",t.config,t.templates),n("task_date",!0,void 0,t.config,t.templates),t.mixin(t.templates,{xml_format:void 0,format_date:o,xml_date:void 0,parse_date:s,progress_text:function(t,e,n){return""},grid_header_class:function(t,e){return""},task_text:function(t,e,n){return n.text},task_class:function(t,e,n){return""},task_end_date:function(e){return t.templates.task_date(e)},grid_row_class:function(t,e,n){return""},task_row_class:function(t,e,n){return""},timeline_cell_class:function(t,e){return""},scale_cell_class:function(t){return""},scale_row_class:function(t){return""},grid_indent:function(t){return"
"},grid_folder:function(t){return"
"},grid_file:function(t){return"
"},grid_open:function(t){return"
"},grid_blank:function(t){return"
"},date_grid:function(e,n,i){return n&&t.isUnscheduledTask(n)&&t.config.show_unscheduled?t.templates.task_unscheduled_time(n):t.templates.grid_date_format(e,i)},task_time:function(e,n,i){return t.isUnscheduledTask(i)&&t.config.show_unscheduled?t.templates.task_unscheduled_time(i):t.templates.task_date(e)+" - "+t.templates.task_end_date(n)},task_unscheduled_time:function(t){return""},time_picker:r(a.time_picker),link_class:function(t){return""},link_description:function(e){var n=t.getTask(e.source),i=t.getTask(e.target);return""+n.text+" – "+i.text+""},drag_link:function(e,n,i,r){e=t.getTask(e);var a=t.locale.labels,o=""+e.text+" "+(n?a.link_start:a.link_end)+"
";return i&&(o+=" "+(i=t.getTask(i)).text+" "+(r?a.link_start:a.link_end)+"
"),o},drag_link_class:function(e,n,i,r){var a="";return e&&i&&(a=" "+(t.isLinkAllowed(e,i,n,r)?"gantt_link_allow":"gantt_link_deny")),"gantt_link_tooltip"+a},tooltip_date_format:i.date_to_str("%Y-%m-%d"),tooltip_text:function(e,n,i){return"Task: "+i.text+"
Start date: "+t.templates.tooltip_date_format(e)+"
End date: "+t.templates.tooltip_date_format(n)}})},initTemplate:n}}},function(t,e,n){var i=n(4),r=n(0),a=n(40),o=n(14);t.exports=function(t){function e(t){return{target:t.target||t.srcElement,pageX:t.pageX,pageY:t.pageY,clientX:t.clientX,clientY:t.clientY,metaKey:t.metaKey,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey}}function n(n,a){this._obj=n,this._settings=a||{},i(this);var o=this.getInputMethods();this._drag_start_timer=null,t.attachEvent("onGanttScroll",r.bind(function(t,e){this.clearDragTimer()},this));for(var s=0;sthis.config.sensitivity},initDnDMarker:function(){var t=this.config.marker=document.createElement("div");t.className="gantt_drag_marker",t.innerHTML="Dragging object",document.body.appendChild(t)},backupEventTarget:function(n,i){if(t.config.touch){var r=i(n),a=r.target||r.srcElement,o=a.cloneNode(!0);this.config.original_target=e(r),this.config.original_target.target=o,this.config.backup_element=a,a.parentNode.appendChild(o),a.style.display="none",document.body.appendChild(a)}},getInputMethods:function(){var e=[];if(e.push({move:"mousemove",down:"mousedown",up:"mouseup",accessor:function(t){return t}}),t.config.touch){var n=!0;try{document.createEvent("TouchEvent")}catch(t){n=!1}n?e.push({move:"touchmove",down:"touchstart",up:"touchend",accessor:function(t){return t.touches&&t.touches.length>1?null:t.touches[0]?{target:document.elementFromPoint(t.touches[0].clientX,t.touches[0].clientY),pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}:t}}):o.navigator.pointerEnabled?e.push({move:"pointermove",down:"pointerdown",up:"pointerup",accessor:function(t){return"mouse"==t.pointerType?null:t}}):o.navigator.msPointerEnabled&&e.push({move:"MSPointerMove",down:"MSPointerDown",up:"MSPointerUp",accessor:function(t){return t.pointerType==t.MSPOINTER_TYPE_MOUSE?null:t}})}return e},clearDragTimer:function(){this._drag_start_timer&&(clearTimeout(this._drag_start_timer),this._drag_start_timer=null)},dragStart:function(e,n,i){this.config&&this.config.started||(this.config={obj:e,marker:null,started:!1,pos:this.getPosition(n),sensitivity:4},this._settings&&r.mixin(this.config,this._settings,!0),this.traceDragEvents(e,i),t._prevent_touch_scroll=!0,document.body.className+=" gantt_noselect",t.config.touch&&this.dragMove(e,n,i.accessor))},dragMove:function(e,n,i){var r=i(n);if(!r)return!1;if(!this.config.marker&&!this.config.started){var a=this.getPosition(r);if(t.config.touch||this.checkPositionChange(a)){if(this.config.started=!0,this.config.ignore=!1,!1===this.callEvent("onBeforeDragStart",[e,this.config.original_target]))return this.config.ignore=!0,!1;this.backupEventTarget(n,i),this.initDnDMarker(),t._touch_feedback(),this.callEvent("onAfterDragStart",[e,this.config.original_target])}else this.config.ignore=!0}return!this.config.ignore&&(r.pos=this.getPosition(r),this.config.marker.style.left=r.pos.x+"px",this.config.marker.style.top=r.pos.y+"px",this.callEvent("onDragMove",[e,r]),!0)},dragEnd:function(e){var n=this.config.backup_element;n&&n.parentNode&&n.parentNode.removeChild(n),t._prevent_touch_scroll=!1,this.config.marker&&(this.config.marker.parentNode.removeChild(this.config.marker),this.config.marker=null,this.callEvent("onDragEnd",[])),this.config.started=!1,document.body.className=document.body.className.replace(" gantt_noselect","")},getPosition:function(t){var e=0,n=0;return t.pageX||t.pageY?(e=t.pageX,n=t.pageY):(t.clientX||t.clientY)&&(e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:e,y:n}}},n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={date_to_str:function(t,e,n){return function(i){t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return e?n.date.to_fixed(i.getUTCDate()):n.date.to_fixed(i.getDate());case"%m":return e?n.date.to_fixed(i.getUTCMonth()+1):n.date.to_fixed(i.getMonth()+1);case"%j":return e?i.getUTCDate():i.getDate();case"%n":return e?i.getUTCMonth()+1:i.getMonth()+1;case"%y":return e?n.date.to_fixed(i.getUTCFullYear()%100):n.date.to_fixed(i.getFullYear()%100);case"%Y":return e?i.getUTCFullYear():i.getFullYear();case"%D":return e?n.locale.date.day_short[i.getUTCDay()]:n.locale.date.day_short[i.getDay()];case"%l":return e?n.locale.date.day_full[i.getUTCDay()]:n.locale.date.day_full[i.getDay()];case"%M":return e?n.locale.date.month_short[i.getUTCMonth()]:n.locale.date.month_short[i.getMonth()];case"%F":return e?n.locale.date.month_full[i.getUTCMonth()]:n.locale.date.month_full[i.getMonth()];case"%h":return e?n.date.to_fixed((i.getUTCHours()+11)%12+1):n.date.to_fixed((i.getHours()+11)%12+1);case"%g":return e?(i.getUTCHours()+11)%12+1:(i.getHours()+11)%12+1;case"%G":return e?i.getUTCHours():i.getHours();case"%H":return e?n.date.to_fixed(i.getUTCHours()):n.date.to_fixed(i.getHours());case"%i":return e?n.date.to_fixed(i.getUTCMinutes()):n.date.to_fixed(i.getMinutes());case"%a":return e?i.getUTCHours()>11?"pm":"am":i.getHours()>11?"pm":"am";case"%A":return e?i.getUTCHours()>11?"PM":"AM":i.getHours()>11?"PM":"AM";case"%s":return e?n.date.to_fixed(i.getUTCSeconds()):n.date.to_fixed(i.getSeconds());case"%W":return e?n.date.to_fixed(n.date.getUTCISOWeek(i)):n.date.to_fixed(n.date.getISOWeek(i));default:return t}})}},str_to_date:function(t,e,n){return function(i){for(var r=[0,0,1,0,0,0],a=i.match(/[a-zA-Z]+|[0-9]+/g),o=t.match(/%[a-zA-Z]/g),s=0;s50?1900:2e3);break;case"%g":case"%G":case"%h":case"%H":r[3]=a[s]||0;break;case"%i":r[4]=a[s]||0;break;case"%Y":r[0]=a[s]||0;break;case"%a":case"%A":r[3]=r[3]%12+("am"===(a[s]||"").toLowerCase()?0:12);break;case"%s":r[5]=a[s]||0;break;case"%M":r[1]=n.locale.date.month_short_hash[a[s]]||0;break;case"%F":r[1]=n.locale.date.month_full_hash[a[s]]||0}return e?new Date(Date.UTC(r[0],r[1],r[2],r[3],r[4],r[5])):new Date(r[0],r[1],r[2],r[3],r[4],r[5])}}};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={date_to_str:function(t,e,n){t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+to_fixed(date.get'+(e?"UTC":"")+'Date())+"';case"%m":return'"+to_fixed((date.get'+(e?"UTC":"")+'Month()+1))+"';case"%j":return'"+date.get'+(e?"UTC":"")+'Date()+"';case"%n":return'"+(date.get'+(e?"UTC":"")+'Month()+1)+"';case"%y":return'"+to_fixed(date.get'+(e?"UTC":"")+'FullYear()%100)+"';case"%Y":return'"+date.get'+(e?"UTC":"")+'FullYear()+"';case"%D":return'"+locale.date.day_short[date.get'+(e?"UTC":"")+'Day()]+"';case"%l":return'"+locale.date.day_full[date.get'+(e?"UTC":"")+'Day()]+"';case"%M":return'"+locale.date.month_short[date.get'+(e?"UTC":"")+'Month()]+"';case"%F":return'"+locale.date.month_full[date.get'+(e?"UTC":"")+'Month()]+"';case"%h":return'"+to_fixed((date.get'+(e?"UTC":"")+'Hours()+11)%12+1)+"';case"%g":return'"+((date.get'+(e?"UTC":"")+'Hours()+11)%12+1)+"';case"%G":return'"+date.get'+(e?"UTC":"")+'Hours()+"';case"%H":return'"+to_fixed(date.get'+(e?"UTC":"")+'Hours())+"';case"%i":return'"+to_fixed(date.get'+(e?"UTC":"")+'Minutes())+"';case"%a":return'"+(date.get'+(e?"UTC":"")+'Hours()>11?"pm":"am")+"';case"%A":return'"+(date.get'+(e?"UTC":"")+'Hours()>11?"PM":"AM")+"';case"%s":return'"+to_fixed(date.get'+(e?"UTC":"")+'Seconds())+"';case"%W":return'"+to_fixed(getISOWeek(date))+"';case"%w":return'"+to_fixed(getWeek(date))+"';default:return t}});var i=new Function("date","to_fixed","locale","getISOWeek","getWeek",'return "'+t+'";');return function(t){return i(t,n.date.to_fixed,n.locale,n.date.getISOWeek,n.date.getWeek)}},str_to_date:function(t,e,n){for(var i="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);",r=t.match(/%[a-zA-Z]/g),a=0;a50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":i+="set[3]=temp["+a+"]||0;";break;case"%i":i+="set[4]=temp["+a+"]||0;";break;case"%Y":i+="set[0]=temp["+a+"]||0;";break;case"%a":case"%A":i+="set[3]=set[3]%12+((temp["+a+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":i+="set[5]=temp["+a+"]||0;";break;case"%M":i+="set[1]=locale.date.month_short_hash[temp["+a+"]]||0;";break;case"%F":i+="set[1]=locale.date.month_full_hash[temp["+a+"]]||0;"}var o="set[0],set[1],set[2],set[3],set[4],set[5]";e&&(o=" Date.UTC("+o+")");var s=new Function("date","locale","var set=[0,0,1,0,0,0]; "+i+" return new Date("+o+");");return function(t){return s(t,n.locale)}}};e.default=i},function(t,e,n){var i=n(204).default,r=n(203).default;t.exports=function(t){function e(){var e=!1;if("auto"===t.config.csp)try{new Function("result = false;")}catch(t){e=!0}else e=t.config.csp;return e}return{init:function(){for(var e=t.locale,n=e.date.month_short,i=e.date.month_short_hash={},r=0;r=9?9:n>=6?6:n>=3?3:0,t.setMonth(e),t},year_start:function(t){return t.setMonth(0),this.month_start(t)},day_start:function(t){return this.date_part(t)},hour_start:function(t){return t.getMinutes()&&t.setMinutes(0),this.minute_start(t),t},minute_start:function(t){return t.getSeconds()&&t.setSeconds(0),t.getMilliseconds()&&t.setMilliseconds(0),t},_add_days:function(t,e){var n=new Date(t.valueOf());return n.setDate(n.getDate()+e),e>=0&&!t.getHours()&&n.getHours()&&(n.getDate()<=t.getDate()||n.getMonth()=0?"&":"?")+"dhxr"+(new Date).getTime()+"=1"),d.open(e,n,o),l)for(var f in l)d.setRequestHeader(f,l[f]);else"POST"==e.toUpperCase()||"PUT"==e||"DELETE"==e?d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"):"GET"==e&&(a=null);if(d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.send(a),!o)return{xmlDoc:d,filePath:n}})},urlSeparator:function(t){return-1!=t.indexOf("?")?"&":"?"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t.exports=function(){return{layout:{css:"gantt_container",rows:[{cols:[{view:"grid",scrollX:"scrollHor",scrollY:"scrollVer"},{resizer:!0,width:1},{view:"timeline",scrollX:"scrollHor",scrollY:"scrollVer"},{view:"scrollbar",id:"scrollVer"}]},{view:"scrollbar",id:"scrollHor",height:20}]},links:{finish_to_start:"0",start_to_start:"1",finish_to_finish:"2",start_to_finish:"3"},types:{task:"task",project:"project",milestone:"milestone"},auto_types:!1,duration_unit:"day",work_time:!1,correct_work_time:!1,skip_off_time:!1,cascade_delete:!0,autosize:!1,autosize_min_width:0,autoscroll:!0,autoscroll_speed:30,show_links:!0,show_task_cells:!0,static_background:!1,static_background_cells:!0,branch_loading:!1,branch_loading_property:"$has_child",show_loading:!1,show_chart:!0,show_grid:!0,min_duration:36e5,date_format:"%d-%m-%Y %H:%i",xml_date:void 0,start_on_monday:!0,server_utc:!1,show_progress:!0,fit_tasks:!1,select_task:!0,scroll_on_click:!0,smart_rendering:!0,preserve_scroll:!0,readonly:!1,date_grid:"%Y-%m-%d",drag_links:!0,drag_progress:!0,drag_resize:!0,drag_project:!1,drag_move:!0,drag_mode:{resize:"resize",progress:"progress",move:"move",ignore:"ignore"},round_dnd_dates:!0,link_wrapper_width:20,root_id:0,autofit:!1,columns:[{name:"text",tree:!0,width:"*",resize:!0},{name:"start_date",align:"center",resize:!0},{name:"duration",align:"center"},{name:"add",width:44}],scale_offset_minimal:!0,inherit_scale_class:!1,scales:[{unit:"day",step:1,date:"%d %M"}],time_step:60,duration_step:1,task_date:"%d %F %Y",time_picker:"%H:%i",task_attribute:"data-task-id",link_attribute:"data-link-id",layer_attribute:"data-layer",buttons_left:["gantt_save_btn","gantt_cancel_btn"],_migrate_buttons:{dhx_save_btn:"gantt_save_btn",dhx_cancel_btn:"gantt_cancel_btn",dhx_delete_btn:"gantt_delete_btn"},buttons_right:["gantt_delete_btn"],lightbox:{sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"time",type:"duration",map_to:"auto"}],project_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",type:"duration",readonly:!0,map_to:"auto"}],milestone_sections:[{name:"description",height:70,map_to:"text",type:"textarea",focus:!0},{name:"type",type:"typeselect",map_to:"type"},{name:"time",type:"duration",single_date:!0,map_to:"auto"}]},drag_lightbox:!0,sort:!1,details_on_create:!0,details_on_dblclick:!0,initial_scroll:!0,task_scroll_offset:100,order_branch:!1,order_branch_free:!1,task_height:"full",min_column_width:70,min_grid_column_width:70,grid_resizer_column_attribute:"data-column-index",keep_grid_width:!1,grid_resize:!1,grid_elastic_columns:!1,show_tasks_outside_timescale:!1,show_unscheduled:!0,readonly_property:"readonly",editable_property:"editable",calendar_property:"calendar_id",resource_calendars:{},dynamic_resource_calendars:!1,inherit_calendar:!1,type_renderers:{},open_tree_initially:!1,optimize_render:!0,prevent_default_scroll:!1,show_errors:!0,wai_aria_attributes:!0,smart_scales:!0,rtl:!1,placeholder_task:!1,horizontal_scroll_key:"shiftKey",drag_timeline:{useKey:void 0,ignore:".gantt_task_line, .gantt_task_link"},drag_multiple:!0,csp:"auto"}}},function(t,e){t.exports=function(){var t={};return{services:{},setService:function(e,n){t[e]=n},getService:function(e){return t[e]?t[e]():null},dropService:function(e){t[e]&&delete t[e]},destructor:function(){for(var e in t)if(t[e]){var n=t[e];n&&n.destructor&&n.destructor()}t=null}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){return function(t){var e=this;for(var n in this.addExtension=function(t,n){e._extensions[t]=n},this.getExtension=function(t){return e._extensions[t]},this._extensions={},t)this._extensions[n]=t[n]}}();e.default=i},function(t,e){t.exports={KEY_CODES:{UP:38,DOWN:40,LEFT:37,RIGHT:39,SPACE:32,ENTER:13,DELETE:46,ESC:27,TAB:9}}},function(t,e,n){t.exports=function(t){var e=new function(){this.constants=n(211),this.version="7.0.1",this.license="gpl",this.templates={},this.ext={},this.keys={edit_save:this.constants.KEY_CODES.ENTER,edit_cancel:this.constants.KEY_CODES.ESC}},i=new(0,n(210).default)(t);e.plugins=function(t){for(var n in t){var r=i.getExtension(n);r&&r(e)}},e.$services=n(209)(),e.config=n(208)(),e.ajax=n(207)(e),e.date=n(205)(e);var r=n(202)(e);e.$services.setService("dnd",function(){return r});var a=n(201)(e);e.$services.setService("templateLoader",function(){return a}),n(4)(e);var o=new(n(200));o.registerProvider("global",function(){var t={min_date:e._min_date,max_date:e._max_date,selected_task:null};return e.$data&&e.$data.tasksStore&&(t.selected_task=e.$data.tasksStore.getSelectedId()),t}),e.getState=o.getState,e.$services.setService("state",function(){return o});var s=n(0);s.mixin(e,s),e.Promise=n(199),e.env=n(9),n(195)(e);var l=n(189);e.dataProcessor=l.DEPRECATED_api,e.createDataProcessor=l.createDataProcessor,n(184)(e),n(176)(e),n(175)(e),n(169)(e),n(168)(e),n(167)(e),n(155)(e),n(154).default(e),n(153)(e),n(152)(e),n(151)(e),n(148)(e),n(147).default(e);var c=n(146).default();return e.i18n={addLocale:c.addLocale,setLocale:function(t){if("string"==typeof t){var n=c.getLocale(t);n||(n=c.getLocale("en")),e.locale=n}else if(t)if(e.locale)for(var i in t)t[i]&&"object"==typeof t[i]?(e.locale[i]||(e.locale[i]={}),e.mixin(e.locale[i],t[i],!0)):e.locale[i]=t[i];else e.locale=t},getLocale:c.getLocale},e.i18n.setLocale("en"),e}},function(t,e,n){n(24);var i=n(212);t.exports=function(t){var e=i(t);return e.env.isNode||n(114)(e),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=10,r=function(){function t(t){var e=this;this.maxSteps=i,this.undoEnabled=!0,this.redoEnabled=!0,this.action={create:function(t){return{commands:t?t.slice():[]}},invert:function(t){for(var n,i=e._gantt.copy(t),r=e.command,a=0;athis.maxSteps;)t.shift();return e}}},t.prototype._pop=function(t){return t.pop()},t.prototype._reorderCommands=function(t){var e={any:0,link:1,task:2},n={move:1,any:0};t.commands.sort(function(t,i){if("task"===t.entity&&"task"===i.entity)return t.type!==i.type?(n[i.type]||0)-(n[t.type]||0):"move"===t.type&&t.oldValue&&i.oldValue&&i.oldValue.parent===t.oldValue.parent?t.oldValue.$index-i.oldValue.$index:0;var r=e[t.entity]||e.any;return(e[i.entity]||e.any)-r})},t.prototype._applyAction=function(t){var e=null,n=this.command.entity,i=this.command.type,r=this._gantt,a={};a[n.task]={add:"addTask",get:"getTask",update:"updateTask",remove:"deleteTask",move:"moveTask",isExists:"isTaskExists"},a[n.link]={add:"addLink",get:"getLink",update:"updateLink",remove:"deleteLink",isExists:"isLinkExists"},r.batchUpdate(function(){for(var n=0;nn.bottom&&(a.bottom=n.bottom,a.top=a.bottom-a.height),a.leftn.right&&(a.right=n.right,a.left=a.right-a.width),c.x>=a.left&&c.x<=a.right&&(a.left=c.x-a.width-o,a.right=a.left+a.width),c.y>=a.top&&c.y<=a.bottom&&(a.top=c.y-a.height-s,a.bottom=a.top+a.height),a},t.prototype._getViewPortSize=function(){var t,e=this._gantt,n=this._getViewPort(),r=n,a=window.scrollY+document.body.scrollTop,o=window.scrollX+document.body.scrollLeft;return n===e.$task_data?(r=e.$task,a=0,o=0,t=i.getNodePosition(e.$task)):t=i.getNodePosition(r),{left:t.x+o,top:t.y+a,width:t.width,height:t.height,bottom:t.y+t.height+a,right:t.x+t.width+o}},t}();e.Tooltip=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(41),r=n(1),a=n(3),o=n(217),s=function(){function t(t){this._listeners={},this.tooltip=new o.Tooltip(t),this._gantt=t,this._domEvents=i(),this._initDelayedFunctions()}return t.prototype.destructor=function(){this.tooltip.hide(),this._domEvents.detachAll()},t.prototype.hideTooltip=function(){this.delayHide()},t.prototype.attach=function(t){var e=this,n=document.body,i=this._gantt;t.global||(n=i.$root);var a=null,o=function(n){var i=r.getTargetNode(n),o=r.closest(i,t.selector);if(!r.isChildOf(i,e.tooltip.getNode())){var s=function(){a=o,t.onmouseenter(n,o)};a?o&&o===a?t.onmousemove(n,o):(t.onmouseleave(n,a),a=null,o&&o!==a&&s()):o&&s()}};this.detach(t.selector),this._domEvents.attach(n,"mousemove",o),this._listeners[t.selector]={node:n,handler:o}},t.prototype.detach=function(t){var e=this._listeners[t];e&&this._domEvents.detach(e.node,"mousemove",e.handler)},t.prototype.tooltipFor=function(t){var e=this,n=function(t){var e=t;return document.createEventObject&&!document.createEvent&&(e=document.createEventObject(t)),e};this._initDelayedFunctions(),this.attach({selector:t.selector,global:t.global,onmouseenter:function(i,r){var a=t.html(i,r);a&&e.delayShow(n(i),a)},onmousemove:function(i,r){var a=t.html(i,r);a?e.delayShow(n(i),a):(e.delayShow.$cancelTimeout(),e.delayHide())},onmouseleave:function(){e.delayShow.$cancelTimeout(),e.delayHide()}})},t.prototype._initDelayedFunctions=function(){var t=this,e=this._gantt;this.delayShow&&this.delayShow.$cancelTimeout(),this.delayHide&&this.delayHide.$cancelTimeout(),this.tooltip.hide(),this.delayShow=a.delay(function(n,i){!1===e.callEvent("onBeforeTooltip",[n])?t.tooltip.hide():(t.tooltip.setContent(i),t.tooltip.show(n))},e.config.tooltip_timeout||1),this.delayHide=a.delay(function(){t.delayShow.$cancelTimeout(),t.tooltip.hide()},e.config.tooltip_hide_timeout||1)},t}();e.TooltipManager=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(218);e.default=function(t){t.config.tooltip_timeout=30,t.config.tooltip_offset_y=20,t.config.tooltip_offset_x=10,t.config.tooltip_hide_timeout=30;var e=new i.TooltipManager(t);t.ext.tooltips=e,t.attachEvent("onGanttReady",function(){e.tooltipFor({selector:"["+t.config.task_attribute+"]:not(.gantt_task_row)",html:function(e){if(!t.config.touch||t.config.touch_tooltip){var n=t.locate(e);if(t.isTaskExists(n)){var i=t.getTask(n);return t.templates.tooltip_text(i.start_date,i.end_date,i)}return null}},global:!1})}),t.attachEvent("onDestroy",function(){e.destructor()}),t.attachEvent("onLightbox",function(){e.hideTooltip()}),t.attachEvent("onBeforeTooltip",function(){if(t.getState().link_source_id)return!1}),t.attachEvent("onGanttScroll",function(){e.hideTooltip()})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this.show=function(t,n){void 0===n?e._showForTask(t):e._showAtCoordinates(t,n)},this.hide=function(t){var n=e._gantt,i=e._quickInfoBox;e._quickInfoBoxId=0;var r=e._quickInfoTask;if(e._quickInfoTask=null,i&&i.parentNode){if(n.config.quick_info_detached)return n.callEvent("onAfterQuickInfo",[r]),i.parentNode.removeChild(i);i.className+=" gantt_qi_hidden","auto"===i.style.right?i.style.left="-350px":i.style.right="-350px",t&&(i.style.left=i.style.right="",i.parentNode.removeChild(i)),n.callEvent("onAfterQuickInfo",[r])}},this.getNode=function(){return e._quickInfoBox?e._quickInfoBox:null},this.setContainer=function(t){t&&(e._container="string"==typeof t?document.getElementById(t):t)},this.setContent=function(t){var n=e._gantt,i={taskId:null,header:{title:"",date:""},content:"",buttons:n.config.quickinfo_buttons};t||(t=i),t.taskId||(t.taskId=i.taskId),t.header||(t.header=i.header),t.header.title||(t.header.title=i.header.title),t.header.date||(t.header.date=i.header.date),t.content||(t.content=i.content),t.buttons||(t.buttons=i.buttons);var r=e.getNode();r||(r=e._createQuickInfoElement()),t.taskId&&(e._quickInfoBoxId=t.taskId);var a=r.querySelector(".gantt_cal_qi_title"),o=a.querySelector(".gantt_cal_qi_tcontent"),s=a.querySelector(".gantt_cal_qi_tdate"),l=r.querySelector(".gantt_cal_qi_content"),c=r.querySelector(".gantt_cal_qi_controls");n._waiAria.quickInfoHeader(r,[t.header.title,t.header.date].join(" ")),o.innerHTML=t.header.title,s.innerHTML=t.header.date,t.header.title||t.header.date?a.style.display="":a.style.display="none",l.innerHTML=t.content;var u=t.buttons;u.length?c.style.display="":c.style.display="none";for(var d="",h=0;h
"+n.locale.labels[u[h]]+"
"}c.innerHTML=d,n.eventRemove(r,"click",e._qiButtonClickHandler),n.eventRemove(r,"keypress",e._qiKeyPressHandler),n.event(r,"click",e._qiButtonClickHandler),n.event(r,"keypress",e._qiKeyPressHandler)},this._qiButtonClickHandler=function(t){t=t||event,e._qi_button_click(t.target||t.srcElement)},this._qiKeyPressHandler=function(t){var n=(t=t||event).which||event.keyCode;13!==n&&32!==n||setTimeout(function(){e._qi_button_click(t.target||t.srcElement)},1)},this._gantt=t}return t.prototype._showAtCoordinates=function(t,e){this.hide(!0),this._quickInfoBoxId=0,this._quickInfoTask=null,this._quickInfoBox||(this._createQuickInfoElement(),this.setContent()),this._appendAtCoordinates(t,e),this._gantt.callEvent("onQuickInfo",[null])},t.prototype._showForTask=function(t){var e=this._gantt;if((t!==this._quickInfoBoxId||!e.utils.dom.isChildOf(this._quickInfoBox,document.body))&&e.config.show_quick_info){this.hide(!0);var n=this._getContainer(),i=this._get_event_counter_part(t,6,n.xViewport,n.yViewport);i&&(this._quickInfoBox=this._init_quick_info(t),this._quickInfoTask=t,this._quickInfoBox.className=this._prepare_quick_info_classname(t),this._fill_quick_data(t),this._show_quick_info(i,6),e.callEvent("onQuickInfo",[t]))}},t.prototype._get_event_counter_part=function(t,e,n,i){var r=this._gantt,a=r.getTaskNode(t);if(!a&&!(a=r.getTaskRowNode(t)))return null;var o=0,s=e+a.offsetTop+a.offsetHeight,l=a;if(r.utils.dom.isChildOf(l,n))for(;l&&l!==n;)o+=l.offsetLeft,l=l.offsetParent;var c=r.getScrollState();return l?{left:o,top:s,dx:o+a.offsetWidth/2-c.x>n.offsetWidth/2?1:0,dy:s+a.offsetHeight/2-c.y>i.offsetHeight/2?1:0,width:a.offsetWidth,height:a.offsetHeight}:null},t.prototype._createQuickInfoElement=function(){var t=this,e=this._gantt,n=document.createElement("div");n.className+="gantt_cal_quick_info",e._waiAria.quickInfoAttr(n);var i='
';if(i+='
',i+="
",n.innerHTML=i,e.config.quick_info_detached){var r=this._getContainer();e.event(r.parent,"scroll",function(){t.hide()})}return this._quickInfoBox=n,n},t.prototype._init_quick_info=function(t){var e=this._gantt,n=e.getTask(t);return"boolean"==typeof this._quickInfoReadonly&&e.isReadonly(n)!==this._quickInfoReadonly&&(this.hide(!0),this._quickInfoBox=null),this._quickInfoReadonly=e.isReadonly(n),this._quickInfoBox||(this._quickInfoBox=this._createQuickInfoElement()),this._quickInfoBox},t.prototype._prepare_quick_info_classname=function(t){var e=this._gantt,n=e.getTask(t),i="gantt_cal_quick_info",r=e.templates.quick_info_class(n.start_date,n.end_date,n);return r&&(i+=" "+r),i},t.prototype._fill_quick_data=function(t){var e=this._gantt,n=e.getTask(t);this._quickInfoBoxId=t;var i=null;if(this._quickInfoReadonly)for(var r=e.config.quickinfo_buttons,a={icon_delete:!0,icon_edit:!0},o=0;oc.offsetHeight/2&&(h=t.top-(o+t.height+2*e))t.getGlobalTaskIndex(n)?1:-1}),e},forSelected:function(t){for(var e=this.getSelected(),n=0;nc?t.getNext(u):t.getPrev(u);for(u=n;t.getGlobalTaskIndex(u)!==s;)this.select(u,e)&&!a&&(a=!0,r=u),u=s>l?t.getNext(u):t.getPrev(u)}}else o=n;else{this.isSelected(n)||this.select(n,e),i=this.getSelected();for(var d=0;d+n.max_date||(!e.end_date||+e.end_date<+n.min_date)&&+e.start_date<+n.min_date)){var i=document.createElement("div");i.setAttribute("data-marker-id",e.id);var r="gantt_marker";t.templates.marker_class&&(r+=" "+t.templates.marker_class(e)),e.css&&(r+=" "+e.css),e.title&&(i.title=e.title),i.className=r;var a=t.posFromDate(e.start_date);if(i.style.left=a+"px",i.style.height=Math.max(t.getRowTop(t.getVisibleTaskCount()),0)+"px",e.end_date){var o=t.posFromDate(e.end_date);i.style.width=Math.max(o-a,0)+"px"}return e.text&&(i.innerHTML="
"+e.text+"
"),i}}function n(){if(t.$task_data){var e=document.createElement("div");e.className="gantt_marker_area",t.$task_data.appendChild(e),t.$marker_area=e}}t._markers||(t._markers=t.createDatastore({name:"marker",initItem:function(e){return e.id=e.id||t.uid(),e}})),t.config.show_markers=!0,t.attachEvent("onBeforeGanttRender",function(){t.$marker_area||n()}),t.attachEvent("onDataRender",function(){t.$marker_area||(n(),t.renderMarkers())}),t.attachEvent("onGanttReady",function(){n(),t.$services.getService("layers").createDataRender({name:"marker",defaultContainer:function(){return t.$marker_area}}).addLayer(e)}),t.getMarker=function(t){return this._markers?this._markers.getItem(t):null},t.addMarker=function(t){return this._markers.addItem(t)},t.deleteMarker=function(t){return!!this._markers.exists(t)&&(this._markers.removeItem(t),!0)},t.updateMarker=function(t){this._markers.refresh(t)},t._getMarkers=function(){return this._markers.getItems()},t.renderMarkers=function(){this._markers.refresh()}}},function(t,e){t.exports=function(t){t.$keyboardNavigation.dispatcher={isActive:!1,activeNode:null,globalNode:new t.$keyboardNavigation.GanttNode,enable:function(){this.isActive=!0,this.globalNode.enable(),this.setActiveNode(this.getActiveNode())},disable:function(){this.isActive=!1,this.globalNode.disable()},isEnabled:function(){return!!this.isActive},getDefaultNode:function(){var e;return(e=t.config.keyboard_navigation_cells?new t.$keyboardNavigation.TaskCell:new t.$keyboardNavigation.TaskRow).isValid()||(e=e.fallback()),e},setDefaultNode:function(){this.setActiveNode(this.getDefaultNode())},getActiveNode:function(){var t=this.activeNode;return t&&!t.isValid()&&(t=t.fallback()),t},fromDomElement:function(e){for(var n=[t.$keyboardNavigation.TaskRow,t.$keyboardNavigation.TaskCell,t.$keyboardNavigation.HeaderCell],i=0;i=0&&!i[r];)r--;i[r]&&(n=new t.$keyboardNavigation.TaskCell(e.taskId,r))}return n},fromDomElement:function(n){if(!t.config.keyboard_navigation_cells)return null;var i=t.locate(n);if(t.isTaskExists(i)){var r=0,a=e.locateAttribute(n,"data-column-index");return a&&(r=1*a.getAttribute("data-column-index")),new t.$keyboardNavigation.TaskCell(i,r)}return null},getNode:function(){if(t.isTaskExists(this.taskId)&&t.isTaskVisible(this.taskId)){if(t.config.show_grid){var e=t.$grid.querySelector(".gantt_row["+t.config.task_attribute+"='"+this.taskId+"']");return e?e.querySelector("[data-column-index='"+this.columnIndex+"']"):null}return t.getTaskNode(this.taskId)}},keys:{up:function(){var e=null,n=t.getPrev(this.taskId);e=n?new t.$keyboardNavigation.TaskCell(n,this.columnIndex):new t.$keyboardNavigation.HeaderCell(this.columnIndex),this.moveTo(e)},down:function(){var e=t.getNext(this.taskId);e&&this.moveTo(new t.$keyboardNavigation.TaskCell(e,this.columnIndex))},left:function(){this.columnIndex>0&&this.moveTo(new t.$keyboardNavigation.TaskCell(this.taskId,this.columnIndex-1))},right:function(){var e=t.getGridColumns();this.columnIndex-1},fallback:function(){if(!t.getVisibleTaskCount()){var e=new t.$keyboardNavigation.HeaderCell;return e.isValid()?e:null}var n=-1;if(t.getTaskByIndex(this.index-1))n=this.index-1;else if(t.getTaskByIndex(this.index+1))n=this.index+1;else for(var i=this.index;i>=0;){if(t.getTaskByIndex(i)){n=i;break}i--}if(n>-1)return new t.$keyboardNavigation.TaskRow(t.getTaskByIndex(n).id)},fromDomElement:function(e){if(t.config.keyboard_navigation_cells)return null;var n=t.locate(e);return t.isTaskExists(n)?new t.$keyboardNavigation.TaskRow(n):null},getNode:function(){if(t.isTaskExists(this.taskId)&&t.isTaskVisible(this.taskId))return t.config.show_grid?t.$grid.querySelector(".gantt_row["+t.config.task_attribute+"='"+this.taskId+"']"):t.getTaskNode(this.taskId)},focus:function(e){if(!e){var n,i,r=t.getTaskPosition(t.getTask(this.taskId)),a=t.config.row_height,o=t.getScrollState();n=t.$task?t.$task.offsetWidth:o.inner_width,i=t.$grid_data||t.$task_data?(t.$grid_data||t.$task_data).offsetHeight:o.inner_height,r.topo.y+i?t.scrollTo(null,r.top-5*a):t.config.show_chart&&(r.lefto.x+n)&&t.scrollTo(r.left-t.config.task_scroll_offset)}t.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this,[e])},keys:{pagedown:function(){t.getVisibleTaskCount()&&this.moveTo(new t.$keyboardNavigation.TaskRow(t.getTaskByIndex(t.getVisibleTaskCount()-1).id))},pageup:function(){t.getVisibleTaskCount()&&this.moveTo(new t.$keyboardNavigation.TaskRow(t.getTaskByIndex(0).id))},up:function(){var e=null,n=t.getPrev(this.taskId);e=n?new t.$keyboardNavigation.TaskRow(n):new t.$keyboardNavigation.HeaderCell,this.moveTo(e)},down:function(){var e=t.getNext(this.taskId);e&&this.moveTo(new t.$keyboardNavigation.TaskRow(e))},"shift+down":function(){t.hasChild(this.taskId)&&!t.getTask(this.taskId).$open&&t.open(this.taskId)},"shift+up":function(){t.hasChild(this.taskId)&&t.getTask(this.taskId).$open&&t.close(this.taskId)},"shift+right":function(){if(!t.isReadonly(this)){var e=t.getPrevSibling(this.taskId);if(t.isTaskExists(e)&&!t.isChildOf(this.taskId,e))t.getTask(e).$open=!0,!1!==t.moveTask(this.taskId,-1,e)&&t.updateTask(this.taskId)}},"shift+left":function(){if(!t.isReadonly(this)){var e=t.getParent(this.taskId);if(t.isTaskExists(e))!1!==t.moveTask(this.taskId,t.getTaskIndex(e)+1,t.getParent(e))&&t.updateTask(this.taskId)}},space:function(e){t.isSelectedTask(this.taskId)?t.unselectTask(this.taskId):t.selectTask(this.taskId)},"ctrl+left":function(e){t.close(this.taskId)},"ctrl+right":function(e){t.open(this.taskId)},delete:function(e){t.isReadonly(this)||t.$click.buttons.delete(this.taskId)},enter:function(){t.isReadonly(this)||t.showLightbox(this.taskId)},"ctrl+enter":function(){t.isReadonly(this)||t.createTask({},this.taskId)}}}),t.$keyboardNavigation.TaskRow.prototype.bindAll(t.$keyboardNavigation.TaskRow.prototype.keys)}},function(t,e,n){t.exports=function(t){var e=n(1);t.$keyboardNavigation.HeaderCell=function(t){this.index=t||0},t.$keyboardNavigation.HeaderCell.prototype=t._compose(t.$keyboardNavigation.KeyNavNode,{_handlers:null,isValid:function(){return!(!t.config.show_grid&&t.getVisibleTaskCount())&&(!!t.getGridColumns()[this.index]||!t.getVisibleTaskCount())},fallback:function(){if(!t.config.show_grid)return t.getVisibleTaskCount()?new t.$keyboardNavigation.TaskRow:null;for(var e=t.getGridColumns(),n=this.index;n>=0&&!e[n];)n--;return e[n]?new t.$keyboardNavigation.HeaderCell(n):null},fromDomElement:function(n){var i=e.locateClassName(n,"gantt_grid_head_cell");if(i){for(var r=0;i&&i.previousSibling;)i=i.previousSibling,r+=1;return new t.$keyboardNavigation.HeaderCell(r)}return null},getNode:function(){return t.$grid_scale.childNodes[this.index]},keys:{left:function(){this.index>0&&this.moveTo(new t.$keyboardNavigation.HeaderCell(this.index-1))},right:function(){var e=t.getGridColumns();this.index=i.length-1){var l=i[0];if(l)return l.focus(),n.preventDefault(),!0}return!1}}()}},function(t,e){t.exports=function(t){t.$keyboardNavigation.EventHandler={_handlers:null,findHandler:function(e){this._handlers||(this._handlers={});var n=t.$keyboardNavigation.shortcuts.getHash(e);return this._handlers[n]},doAction:function(e,n){var i=this.findHandler(e);if(i){if(!1===t.$keyboardNavigation.facade.callEvent("onBeforeAction",[e,n]))return;i.call(this,n),n.preventDefault?n.preventDefault():n.returnValue=!1}},bind:function(e,n){this._handlers||(this._handlers={});for(var i=t.$keyboardNavigation.shortcuts,r=i.parse(e),a=0;a=96&&e.keyCode<=105&&(e.keyCode-=48);var n=String.fromCharCode(e.keyCode);return n&&(e.keyCode=n.toLowerCase().charCodeAt(0)),e},getHashFromEvent:function(t){return this.getHash(this.getCommandFromEvent(t))},getHash:function(t){var e=[];for(var n in t.modifiers)t.modifiers[n]&&e.push(n);return e.push(t.keyCode),e.join(this.junctionChar)},getExpressions:function(t){return t.split(this.junctionChar)},getWords:function(t){return t.split(this.combinationChar)},trim:function(t){return t.replace(/\s/g,"")},junctionChar:",",combinationChar:"+",commandKeys:{shift:16,alt:18,ctrl:17,meta:!0},specialKeys:{backspace:8,tab:9,enter:13,esc:27,space:32,up:38,down:40,left:37,right:39,home:36,end:35,pageup:33,pagedown:34,delete:46,insert:45,plus:107,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123}}}},function(t,e,n){t.exports=function(t){var e=n(4);!function(t){t.config.keyboard_navigation=!0,t.config.keyboard_navigation_cells=!1,t.$keyboardNavigation={},t._compose=function(){for(var t=Array.prototype.slice.call(arguments,0),e={},n=0;n=10){for(var e=t._trace.slice(t._trace.length-10),n=[],i=1;i75&&(i=0)),{x:t._scrollState.x+i,y:t._scrollState.y+r}},this._setScrollPosition=function(t,e){requestAnimationFrame(function(){gantt.$ui.getView(t.$config.scrollX).scroll(e.x),gantt.$ui.getView(t.$config.scrollY).scroll(e.y)})},this._stopDrag=function(e){if(t._trace=[],gantt.$root.classList.remove("gantt_noselect"),void 0!==t._originalReadonly&&(gantt.config.readonly=t._originalReadonly),void 0!==t._originAutoscroll&&(gantt.config.autoscroll=t._originAutoscroll),gantt.config.drag_timeline){var n=gantt.config.drag_timeline.useKey;if(n&&!0!==e[n])return}t._mouseDown=!1},this._startDrag=function(e){t._originAutoscroll=gantt.config.autoscroll,gantt.config.autoscroll=!1,gantt.$root.classList.add("gantt_noselect"),t._originalReadonly=gantt.config.readonly,gantt.config.readonly=!0,t._trace=[],t._mouseDown=!0;var n=t._getScrollPosition(t._timeline),i=n.x,r=n.y;t._scrollState={x:i,y:r},t._startPoint={x:e.clientX,y:e.clientY},t._trace.push(t._startPoint)},this._domEvents=gantt._createDomEventScope(),this._trace=[]}return t.create=function(){return new t},t.prototype.destructor=function(){this._domEvents.detachAll()},t.prototype.attach=function(t){var e=this;this._timeline=t,this._domEvents.attach(t.$task,"mousedown",function(t){if(gantt.config.drag_timeline){var n=gantt.config.drag_timeline,i=n.useKey,r=n.ignore;if(!1!==n.enabled){var a=".gantt_task_line, .gantt_task_link";void 0!==r&&(a=r instanceof Array?r.join(", "):r),a&&gantt.utils.dom.closest(t.target,a)||i&&!0!==t[i]||e._startDrag(t)}}}),this._domEvents.attach(document,"keydown",function(t){if(gantt.config.drag_timeline){var n=gantt.config.drag_timeline.useKey;n&&!0===t[n]&&e._applyDndReadyStyles()}}),this._domEvents.attach(document,"keyup",function(t){if(gantt.config.drag_timeline){var n=gantt.config.drag_timeline.useKey;n&&!1===t[n]&&(e._clearDndReadyStyles(),e._stopDrag(t))}}),this._domEvents.attach(document,"mouseup",function(t){e._stopDrag(t)}),this._domEvents.attach(gantt.$root,"mouseup",function(t){e._stopDrag(t)}),this._domEvents.attach(document,"mouseleave",function(t){e._stopDrag(t)}),this._domEvents.attach(gantt.$root,"mouseleave",function(t){e._stopDrag(t)}),this._domEvents.attach(gantt.$root,"mousemove",function(n){if(gantt.config.drag_timeline){var i=gantt.config.drag_timeline.useKey;if((!i||!0===n[i])&&!0===e._mouseDown){e._trace.push({x:n.clientX,y:n.clientY});var r=e._countNewScrollPosition({x:n.clientX,y:n.clientY});e._setScrollPosition(t,r),e._scrollState=r,e._startPoint={x:n.clientX,y:n.clientY}}}})},t}();e.EventsManager=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(236);e.default=function(t){t.ext||(t.ext={}),t.ext.dragTimeline={create:function(){return i.EventsManager.create()}},t.config.drag_timeline={enabled:!0}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),r=n(3);function a(t,e){var n=t-e;return n>=0?n:-n}var o=function(){function t(t){var e=this;this._el=document.createElement("div"),this._viewPort=t.viewPort,this._el.classList.add(t.className),"function"==typeof t.callback&&(this._callback=t.callback),"function"==typeof t.render&&(this.render=function(){e._el=t.render(e._startPoint,e._endPoint),""!==t.className&&e._el.classList.add(t.className),e.draw()}),r.isEventable(this._viewPort)||i(this._viewPort),this._singleRow=t.singleRow,this._useRequestAnimationFrame=t.useRequestAnimationFrame}return t.prototype.setStyles=function(){if(this._singleRow){var t=gantt.config.row_height;this._el.style.height=t+"px",this._el.style.top=(Math.ceil(this._positionPoint.relative.top/t)-1)*t+"px"}else this._el.style.height=a(this._endPoint.relative.top,this._startPoint.relative.top)+"px",this._el.style.top=this._positionPoint.relative.top+"px";this._el.style.width=a(this._endPoint.relative.left,this._startPoint.relative.left)+"px",this._el.style.left=this._positionPoint.relative.left+"px"},t.prototype.render=function(){this.setStyles(),this.draw()},t.prototype.draw=function(){var t=this;if(this._useRequestAnimationFrame)return requestAnimationFrame(function(){t._viewPort.appendChild(t.getElement())});this._viewPort.appendChild(this.getElement())},t.prototype.clear=function(){var t=this;if(this._useRequestAnimationFrame)return requestAnimationFrame(function(){t._el.parentNode&&t._viewPort.removeChild(t._el)});this._el.parentNode&&this._viewPort.removeChild(this._el)},t.prototype.getElement=function(){return this._el},t.prototype.getViewPort=function(){return this._viewPort},t.prototype.setStart=function(t){this._startPoint=t,this._startDate=gantt.dateFromPos(this._startPoint.relative.left),this._viewPort.callEvent("onBeforeDrag",[this._startPoint])},t.prototype.setEnd=function(t){if(this._endPoint=t,this._singleRow){var e=gantt.config.row_height;this._endPoint.relative.top=Math.ceil(this._startPoint.relative.top/e)*e}this._endDate=gantt.dateFromPos(this._endPoint.relative.left),this._startPoint.relative.left>this._endPoint.relative.left&&(this._positionPoint={relative:{left:this._endPoint.relative.left,top:this._positionPoint.relative.top},absolute:{left:this._endPoint.absolute.left,top:this._positionPoint.absolute.top}}),this._startPoint.relative.top>this._endPoint.relative.top&&(this._positionPoint={relative:{left:this._positionPoint.relative.left,top:this._endPoint.relative.top},absolute:{left:this._positionPoint.absolute.left,top:this._endPoint.absolute.top}}),this._viewPort.callEvent("onDrag",[this._startPoint,this._endPoint])},t.prototype.setPosition=function(t){this._positionPoint=t},t.prototype.dragEnd=function(t){var e;t.relative.left<0&&(t.relative.left=0),this._viewPort.callEvent("onBeforeDragEnd",[this._startPoint,t]),this.setEnd(t),this._startDate.valueOf()>this._endDate.valueOf()&&(e=[this._endDate,this._startDate],this._startDate=e[0],this._endDate=e[1]),this.clear();var n=gantt.getTaskByTime(this._startDate,this._endDate),i=this._getTasksByTop(this._startPoint.relative.top,this._endPoint.relative.top);this._viewPort.callEvent("onDragEnd",[this._startPoint,this._endPoint]),this._callback&&this._callback(this._startPoint,this._endPoint,this._startDate,this._endDate,n,i)},t.prototype.getInBounds=function(){return this._singleRow},t.prototype._getTasksByTop=function(t,e){var n=t,i=e;t>e&&(n=e,i=t);for(var r=gantt.config.row_height,a=Math.ceil(n/r)-1,o=Math.ceil(i/r)-1,s=[],l=a;l<=o;l++){gantt.getTaskByIndex(l)&&s.push(gantt.getTaskByIndex(l))}return s},t}();e.SelectedRegion=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){this._mouseDown=!1,this._domEvents=gantt._createDomEventScope()}return t.prototype.attach=function(t,e){var n=this,i=t.getViewPort();this._originPosition=window.getComputedStyle(i).display,this._restoreOriginPosition=function(){i.style.position=n._originPosition},"static"===this._originPosition&&(i.style.position="relative");var r=gantt.$services.getService("state");r.registerProvider("clickDrag",function(){return{autoscroll:!1}});var a=null;this._domEvents.attach(i,"mousedown",function(i){a=null,gantt.utils.dom.closest(i.target,".gantt_task_line, .gantt_task_link")||(r.registerProvider("clickDrag",function(){return{autoscroll:n._mouseDown}}),e&&!0!==i[e]||(a=n._getCoordinates(i,t)))}),this._domEvents.attach(document.body,"mouseup",function(i){if(a=null,(!e||!0===i[e])&&!0===n._mouseDown){n._mouseDown=!1;var r=n._getCoordinates(i,t);t.dragEnd(r)}}),this._domEvents.attach(i,"mousemove",function(i){if(!e||!0===i[e]){var r=null;if(!n._mouseDown&&a)return r=n._getCoordinates(i,t),void(Math.abs(a.relative.left-r.relative.left)>5&&a&&(n._mouseDown=!0,t.setStart(a),t.setPosition(a),t.setEnd(a),a=null));!0===n._mouseDown&&(r=n._getCoordinates(i,t),t.setEnd(r),t.render())}})},t.prototype.detach=function(){this._domEvents.detachAll(),this._restoreOriginPosition&&this._restoreOriginPosition(),gantt.$services.getService("state").unregisterProvider("clickDrag")},t.prototype.destructor=function(){this.detach()},t.prototype._getCoordinates=function(t,e){var n=e.getViewPort(),i=n.getBoundingClientRect(),r=t.clientX,a=t.clientY;return{absolute:{left:r,top:a},relative:{left:r-i.left+n.scrollLeft,top:a-i.top+n.scrollTop}}},t}();e.EventsManager=i},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n= 0);\r\n}\r\n\r\nfunction hasHref(node){\r\n\tvar canHaveHref = {\"a\": true, \"area\": true};\r\n\tif(canHaveHref[node.nodeName.loLowerCase()]){\r\n\t\treturn !!node.getAttribute(\"href\");\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nfunction isEnabled(node){\r\n\tvar canDisable = {\"input\":true, \"select\":true, \"textarea\":true, \"button\":true, \"object\":true};\r\n\tif(canDisable[node.nodeName.toLowerCase()]){\r\n\t\treturn !node.hasAttribute(\"disabled\");\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nfunction getFocusableNodes(root){\r\n\tvar nodes = root.querySelectorAll([\r\n\t\t\"a[href]\",\r\n\t\t\"area[href]\",\r\n\t\t\"input\",\r\n\t\t\"select\",\r\n\t\t\"textarea\",\r\n\t\t\"button\",\r\n\t\t\"iframe\",\r\n\t\t\"object\",\r\n\t\t\"embed\",\r\n\t\t\"[tabindex]\",\r\n\t\t\"[contenteditable]\"\r\n\t].join(\", \"));\r\n\r\n\tvar nodesArray = Array.prototype.slice.call(nodes, 0);\r\n\tfor(var i = 0; i < nodesArray.length; i++){\r\n\t\tvar node = nodesArray[i];\r\n\t\tvar isValid = (hasNonNegativeTabIndex(node) || isEnabled(node) || hasHref(node)) && isVisible(node);\r\n\t\tif(!isValid){\r\n\t\t\tnodesArray.splice(i, 1);\r\n\t\t\ti--;\r\n\t\t}\r\n\t}\r\n\treturn nodesArray;\r\n}\r\n\r\nfunction getScrollSize(){\r\n\tvar div = document.createElement(\"div\");\r\n\tdiv.style.cssText=\"visibility:hidden;position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;height:110px;min-height:100px;overflow-y:scroll;\";\r\n\r\n\tdocument.body.appendChild(div);\r\n\tvar width = div.offsetWidth-div.clientWidth;\r\n\tdocument.body.removeChild(div);\r\n\r\n\treturn width;\r\n}\r\n\r\nfunction getClassName(node){\r\n\tif(!node) return \"\";\r\n\r\n\tvar className = node.className || \"\";\r\n\tif(className.baseVal)//'className' exist but not a string - IE svg element in DOM\r\n\t\tclassName = className.baseVal;\r\n\r\n\tif(!className.indexOf)\r\n\t\tclassName = \"\";\r\n\r\n\treturn _trimString(className);\r\n}\r\n\r\nfunction addClassName(node, className){\r\n\tif (className && node.className.indexOf(className) === -1) {\r\n\t\tnode.className += \" \" + className;\r\n\t}\r\n}\r\n\r\nfunction removeClassName(node, name) {\r\n\tname = name.split(\" \");\r\n\tfor (var i = 0; i < name.length; i++) {\r\n\t\tvar regEx = new RegExp(\"\\\\s?\\\\b\" + name[i] + \"\\\\b(?![-_.])\", \"\");\r\n\t\tnode.className = node.className.replace(regEx, \"\");\r\n\t}\r\n}\r\n\r\nfunction hasClass(element, className){\r\n\tif ('classList' in element) {\r\n\t\treturn element.classList.contains(className);\r\n\t} else { \r\n\t\treturn new RegExp(\"\\\\b\" + className + \"\\\\b\").test(element.className);\r\n\t}\r\n}\r\n\r\nfunction toNode(node) {\r\n\tif (typeof node === \"string\") {\r\n\t\treturn (document.getElementById(node) || document.querySelector(node) || document.body);\r\n\t}\r\n\treturn node || document.body;\r\n}\r\n\r\nvar _slave;\r\nfunction insert(node, newone) {\r\n\tif(!_slave){\r\n\t\t_slave = document.createElement(\"div\");\r\n\t}\r\n\t_slave.innerHTML = newone;\r\n\tvar child = _slave.firstChild;\r\n\tnode.appendChild(child);\r\n\treturn child;\r\n}\r\n\r\nfunction remove(node) {\r\n\tif (node && node.parentNode) {\r\n\t\tnode.parentNode.removeChild(node);\r\n\t}\r\n}\r\n\r\nfunction getChildren(node, css) {\r\n\tvar ch = node.childNodes;\r\n\tvar len = ch.length;\r\n\tvar out = [];\r\n\tfor (var i = 0; i < len; i++) {\r\n\t\tvar obj = ch[i];\r\n\t\tif (obj.className && obj.className.indexOf(css) !== -1) {\r\n\t\t\tout.push(obj);\r\n\t\t}\r\n\t}\r\n\treturn out;\r\n}\r\n\r\nfunction getTargetNode(e){\r\n\tvar trg;\r\n\tif (e.tagName)\r\n\t\ttrg = e;\r\n\telse {\r\n\t\te=e||window.event;\r\n\t\ttrg=e.target||e.srcElement;\r\n\t}\r\n\treturn trg;\r\n}\r\n\r\nfunction locateAttribute(e, attribute) {\r\n\tif(!attribute) return;\r\n\r\n\tvar trg = getTargetNode(e);\r\n\r\n\twhile (trg){\r\n\t\tif (trg.getAttribute){\t//text nodes has not getAttribute\r\n\t\t\tvar test = trg.getAttribute(attribute);\r\n\t\t\tif (test) return trg;\r\n\t\t}\r\n\t\ttrg=trg.parentNode;\r\n\t}\r\n\treturn null;\r\n}\r\n\r\nfunction _trimString(str){\r\n\tvar func = String.prototype.trim || function(){ return this.replace(/^\\s+|\\s+$/g, \"\"); };\r\n\treturn func.apply(str);\r\n}\r\n\r\nfunction locateClassName(e, classname, strict){\r\n\tvar trg = getTargetNode(e);\r\n\tvar css = \"\";\r\n\r\n\tif(strict === undefined)\r\n\t\tstrict = true;\r\n\r\n\twhile (trg){\r\n\t\tcss = getClassName(trg);\r\n\t\tif(css){\r\n\t\t\tvar ind = css.indexOf(classname);\r\n\t\t\tif (ind >= 0){\r\n\t\t\t\tif (!strict)\r\n\t\t\t\t\treturn trg;\r\n\r\n\t\t\t\t//check that we have exact match\r\n\t\t\t\tvar left = (ind === 0) || (!_trimString(css.charAt(ind - 1)));\r\n\t\t\t\tvar right = ((ind + classname.length >= css.length)) || (!_trimString(css.charAt(ind + classname.length)));\r\n\r\n\t\t\t\tif (left && right)\r\n\t\t\t\t\treturn trg;\r\n\t\t\t}\r\n\t\t}\r\n\t\ttrg=trg.parentNode;\r\n\t}\r\n\treturn null;\r\n}\r\n\r\n/*\r\nevent position relatively to DOM element\r\n */\r\nfunction getRelativeEventPosition(ev, node){\r\n\tvar d = document.documentElement;\r\n\tvar box = elementPosition(node);\r\n\r\n\treturn {\r\n\t\tx: ev.clientX + d.scrollLeft - d.clientLeft - box.x + node.scrollLeft,\r\n\t\ty: ev.clientY + d.scrollTop - d.clientTop - box.y + node.scrollTop\r\n\t};\r\n}\r\n\r\nfunction isChildOf(child, parent){\r\n\tif(!child || !parent){\r\n\t\treturn false;\r\n\t}\r\n\r\n\twhile(child && child != parent) {\r\n\t\tchild = child.parentNode;\r\n\t}\r\n\r\n\treturn child === parent;\r\n}\r\n\r\nfunction closest(element, selector){\r\n\tif(element.closest){\r\n\t\treturn element.closest(selector);\r\n\t}else if(element.matches || element.msMatchesSelector || element.webkitMatchesSelector){\r\n\t\tvar el = element;\r\n\t\tif (!document.documentElement.contains(el)) return null;\r\n\t\tdo {\r\n\t\t\tvar method = el.matches || el.msMatchesSelector || el.webkitMatchesSelector;\r\n\r\n\t\t\tif (method.call(el, selector)) return el;\r\n\t\t\tel = el.parentElement || el.parentNode;\r\n\t\t} while (el !== null && el.nodeType === 1); \r\n\t\treturn null;\r\n\t}else{\r\n\t\t// eslint-disable-next-line no-console\r\n\t\tconsole.error(\"Your browser is not supported\");\r\n\t\treturn null;\r\n\t}\r\n}\r\n\r\nmodule.exports = {\r\n\tgetNodePosition: elementPosition,\r\n\tgetFocusableNodes: getFocusableNodes,\r\n\tgetScrollSize: getScrollSize,\r\n\tgetClassName: getClassName,\r\n\taddClassName: addClassName,\r\n\tremoveClassName: removeClassName,\r\n\tinsertNode: insert,\r\n\tremoveNode: remove,\r\n\tgetChildNodes: getChildren,\r\n\ttoNode: toNode,\r\n\tlocateClassName:locateClassName,\r\n\tlocateAttribute: locateAttribute,\r\n\tgetTargetNode: getTargetNode,\r\n\tgetRelativeEventPosition: getRelativeEventPosition,\r\n\tisChildOf: isChildOf,\r\n\thasClass: hasClass,\r\n\tclosest: closest\r\n};","module.exports = function (d, b) {\r\n\tfor (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\r\n\tfunction __() { this.constructor = d; }\r\n\td.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n};","var units = {\r\n\t\"second\": 1,\r\n\t\"minute\": 60,\r\n\t\"hour\": 60 * 60,\r\n\t\"day\": 60 * 60 * 24,\r\n\t\"week\": 60 * 60 * 24 * 7,\r\n\t\"month\": 60 * 60 * 24 * 30,\r\n\t\"quarter\": 60 * 60 * 24 * 30 * 3,\r\n\t\"year\": 60 * 60 * 24 * 365\r\n};\r\nfunction getSecondsInUnit(unit){\r\n\treturn units[unit] || units.hour;\r\n}\r\n\r\nfunction forEach(arr, callback) {\r\n\tif (arr.forEach) {\r\n\t\tarr.forEach(callback);\r\n\t} else {\r\n\t\tvar workArray = arr.slice();\r\n\t\tfor (var i = 0; i < workArray.length; i++) {\r\n\t\t\tcallback(workArray[i], i);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction arrayMap(arr, callback) {\r\n\tif (arr.map) {\r\n\t\treturn arr.map(callback);\r\n\t} else {\r\n\t\tvar workArray = arr.slice();\r\n\t\tvar resArray = [];\r\n\r\n\t\tfor (var i = 0; i < workArray.length; i++) {\r\n\t\t\tresArray.push(callback(workArray[i], i));\r\n\t\t}\r\n\t\treturn resArray;\r\n\t}\r\n}\r\n\r\n\r\nfunction arrayFind(arr, callback) {\r\n\tif (arr.find) {\r\n\t\treturn arr.find(callback);\r\n\t} else {\r\n\t\tfor (var i = 0; i < arr.length; i++) {\r\n\t\t\tif (callback(arr[i], i)) {\r\n\t\t\t\treturn arr[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// iframe-safe array type check instead of using instanceof\r\nfunction isArray(obj){\r\n\tif(Array.isArray){\r\n\t\treturn Array.isArray(obj);\r\n\t}else{\r\n\t\t// close enough\r\n\t\treturn (obj && obj.length !== undefined && obj.pop && obj.push);\r\n\t}\r\n}\r\n\r\n// non-primitive string object, e.g. new String(\"abc\")\r\nfunction isStringObject(obj){\r\n\treturn obj && typeof obj === \"object\"\r\n\t\t&& Function.prototype.toString.call(obj.constructor) === \"function String() { [native code] }\";\r\n}\r\n\r\n// non-primitive number object, e.g. new Number(5)\r\nfunction isNumberObject(obj){\r\n\treturn obj && typeof obj === \"object\"\r\n\t\t&& Function.prototype.toString.call(obj.constructor) === \"function Number() { [native code] }\";\r\n}\r\n\r\n// non-primitive number object, e.g. new Boolean(true)\r\nfunction isBooleanObject(obj){\r\n\treturn obj && typeof obj === \"object\"\r\n\t\t&& Function.prototype.toString.call(obj.constructor) === \"function Boolean() { [native code] }\";\r\n}\r\n\r\nfunction isDate(obj) {\r\n\tif (obj && typeof obj === \"object\") {\r\n\t\treturn !!(obj.getFullYear && obj.getMonth && obj.getDate);\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nfunction isValidDate(obj){\r\n\treturn isDate(obj) && !isNaN(obj.getTime());\r\n}\r\n\r\nfunction arrayFilter(arr, callback) {\r\n\tvar result = [];\r\n\r\n\tif (arr.filter) {\r\n\t\treturn arr.filter(callback);\r\n\t} else {\r\n\t\tfor (var i = 0; i < arr.length; i++) {\r\n\t\t\tif (callback(arr[i], i)) {\r\n\t\t\t\tresult[result.length] = arr[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\nfunction hashToArray(hash) {\r\n\tvar result = [];\r\n\r\n\tfor (var key in hash) {\r\n\t\tif (hash.hasOwnProperty(key)) {\r\n\t\t\tresult.push(hash[key]);\r\n\t\t}\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\nfunction arraySome(arr, callback) {\r\n\tif (arr.length === 0) return false;\r\n\r\n\tfor (var i = 0; i < arr.length; i++) {\r\n\t\tif (callback(arr[i], i, arr)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction arrayDifference(arr, callback) {\r\n\treturn arrayFilter(arr, function(item, i) {\r\n\t\treturn !callback(item, i);\r\n\t});\r\n}\r\n\r\nfunction throttle (callback, timeout) {\r\n\tvar wait = false;\r\n\r\n\treturn function () {\r\n\t\tif (!wait) {\r\n\t\t\tcallback.apply(null, arguments);\r\n\t\t\twait = true;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\twait = false;\r\n\t\t\t}, timeout);\r\n\t\t}\r\n\t};\r\n}\r\n\r\nfunction delay (callback, timeout){\r\n\tvar timer;\r\n\r\n\tvar result = function() {\r\n\t\tresult.$cancelTimeout();\r\n\t\tcallback.$pending = true;\r\n\t\tvar args = Array.prototype.slice.call(arguments);\r\n\t\ttimer = setTimeout(function(){\r\n\t\t\tcallback.apply(this, args);\r\n\t\t\tresult.$pending = false;\r\n\t\t}, timeout);\r\n\t};\r\n\t\r\n\tresult.$pending = false;\r\n\tresult.$cancelTimeout = function(){\r\n\t\tclearTimeout(timer);\r\n\t\tcallback.$pending = false;\r\n\t};\r\n\tresult.$execute = function(){\r\n\t\tcallback();\r\n\t\tcallback.$cancelTimeout();\r\n\t};\r\n\r\n\treturn result;\r\n}\r\n\r\nfunction sortArrayOfHash(arr, field, desc) {\r\n\tvar compare = function(a, b) {\r\n\t\treturn a < b;\r\n\t};\r\n\r\n\tarr.sort(function(a, b) {\r\n\t\tif (a[field] === b[field]) return 0;\r\n\r\n\t\treturn desc ? compare(a[field], b[field]) : compare(b[field], a[field]);\r\n\t});\r\n}\r\n\r\nfunction objectKeys(obj) {\r\n\tif (Object.keys) {\r\n\t\treturn Object.keys(obj);\r\n\t}\r\n\tvar result = [];\r\n\tvar key;\r\n\tfor (key in obj) {\r\n\t\tif (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n\t\t\tresult.push(key);\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nfunction isEventable(obj) {\r\n\treturn obj.attachEvent && obj.detachEvent;\r\n}\r\n\r\nmodule.exports = {\r\n\tgetSecondsInUnit: getSecondsInUnit,\r\n\tforEach: forEach,\r\n\tarrayMap: arrayMap,\r\n\tarrayFind: arrayFind,\r\n\tarrayFilter: arrayFilter,\r\n\tarrayDifference: arrayDifference,\r\n\tarraySome: arraySome,\r\n\thashToArray: hashToArray,\r\n\tsortArrayOfHash: sortArrayOfHash,\r\n\tthrottle: throttle,\r\n\tisArray: isArray,\r\n\tisDate: isDate,\r\n\tisValidDate: isValidDate,\r\n\tisStringObject: isStringObject,\r\n\tisNumberObject: isNumberObject,\r\n\tisBooleanObject: isBooleanObject,\r\n\tdelay: delay,\r\n\tobjectKeys: objectKeys,\r\n\tisEventable: isEventable\r\n};","var EventHost = function(){\r\n\tthis._silent_mode = false;\r\n\tthis.listeners = {};\r\n};\r\n\r\nEventHost.prototype = {\r\n\t_silentStart: function() {\r\n\t\tthis._silent_mode = true;\r\n\t},\r\n\t_silentEnd: function() {\r\n\t\tthis._silent_mode = false;\r\n\t}\r\n};\r\n\r\nvar\tcreateEventStorage = function(obj) {\r\n\tvar handlers = {};\r\n\tvar index = 0;\r\n\tvar eventStorage = function(){\r\n\t\tvar combinedResult = true;\r\n\t\tfor(var i in handlers){\r\n\t\t\tvar handlerResult = handlers[i].apply(obj, arguments);\r\n\t\t\tcombinedResult=combinedResult && handlerResult;\r\n\t\t}\r\n\t\treturn combinedResult;\r\n\t};\r\n\teventStorage.addEvent=function(handler, settings){\r\n\t\tif (typeof (handler) == \"function\"){\r\n\t\t\tvar handlerId;\r\n\t\t\tif(settings && settings.id){\r\n\t\t\t\thandlerId = settings.id;\r\n\t\t\t}else{\r\n\t\t\t\thandlerId = index;\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\r\n\t\t\tif(settings && settings.once){\r\n\t\t\t\tvar originalHandler = handler;\r\n\t\t\t\thandler = function(){\r\n\t\t\t\t\toriginalHandler();\r\n\t\t\t\t\teventStorage.removeEvent(handlerId);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\thandlers[handlerId] = handler;\r\n\t\t\treturn handlerId;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\teventStorage.removeEvent=function(id){\r\n\t\tdelete handlers[id];\r\n\t};\r\n\r\n\teventStorage.clear = function(){\r\n\t\thandlers = {};\r\n\t};\r\n\r\n\treturn eventStorage;\r\n};\r\n\r\nfunction makeEventable(obj){\r\n\r\n\tvar eventHost = new EventHost();\r\n\tobj.attachEvent=function(eventName, handler, settings){\r\n\t\teventName = 'ev_'+eventName.toLowerCase();\r\n\t\tif (!eventHost.listeners[eventName]){\r\n\t\t\teventHost.listeners[eventName] = createEventStorage(this);\r\n\t\t}\r\n\r\n\t\tif(settings && settings.thisObject){\r\n\t\t\thandler = handler.bind(settings.thisObject);\r\n\t\t}\r\n\r\n\t\tvar innerId = eventHost.listeners[eventName].addEvent(handler, settings);\r\n\r\n\t\tvar handlerId = (eventName+':'+innerId); //return ID (ev_eventname:1)\r\n\t\tif(settings && settings.id){\r\n\t\t\thandlerId = settings.id;\r\n\t\t}\r\n\t\treturn handlerId;\r\n\t};\r\n\r\n\tobj.attachAll = function(callback){\r\n\t\tthis.attachEvent('listen_all', callback);\r\n\t};\r\n\r\n\tobj.callEvent=function(name, eventArguments){\r\n\t\tif (eventHost._silent_mode) return true;\r\n\r\n\t\tvar handlerName = 'ev_'+name.toLowerCase();\r\n\r\n\t\tvar listeners = eventHost.listeners;\r\n\t\tif (listeners['ev_listen_all']){\r\n\t\t\tlisteners['ev_listen_all'].apply(this, [name].concat(eventArguments));\r\n\t\t}\r\n\r\n\t\tif (listeners[handlerName])\r\n\t\t\treturn listeners[handlerName].apply(this, eventArguments);\r\n\t\treturn true;\r\n\t};\r\n\r\n\tobj.checkEvent=function(name){\r\n\t\tvar listeners = eventHost.listeners;\r\n\t\treturn (!!listeners['ev_'+name.toLowerCase()]);\r\n\t};\r\n\r\n\tobj.detachEvent=function(id){\r\n\t\tif (id){\r\n\t\t\tvar listeners = eventHost.listeners;\r\n\t\t\tfor(var i in listeners){\r\n\t\t\t\tlisteners[i].removeEvent(id); //remove event\r\n\t\t\t}\r\n\r\n\t\t\tvar list = id.split(':');//get EventName and ID\r\n\t\t\tvar listeners = eventHost.listeners;\r\n\t\t\tif(list.length === 2){\r\n\t\t\t\tvar eventName = list[0];\r\n\t\t\t\tvar eventId = list[1];\r\n\t\t\t\tif(listeners[eventName]){\r\n\t\t\t\t\tlisteners[eventName].removeEvent(eventId); //remove event\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tobj.detachAllEvents = function(){\r\n\t\tfor (var name in eventHost.listeners) {\r\n\t\t\teventHost.listeners[name].clear();\r\n\t\t}\r\n\t};\r\n\r\n}\r\n\r\nmodule.exports = makeEventable;","function dummy() {\r\n\t// eslint-disable-next-line\r\n\tconsole.log(\"Method is not implemented.\"); \r\n}\r\nfunction BaseControl() {\r\n}\r\n\r\n// base methods will be runned in gantt context\r\nBaseControl.prototype.render = dummy; // arguments: sns\r\nBaseControl.prototype.set_value = dummy; // arguments: node, value, ev, sns(config)\r\nBaseControl.prototype.get_value = dummy; // arguments node, ev, sns(config)\r\nBaseControl.prototype.focus = dummy; // arguments: node\r\n\r\nmodule.exports = function(gantt) { // we could send current instance of gantt to module\r\n\treturn BaseControl;\r\n};","module.exports = function getVisibleTasksRange(gantt, view, datastore, viewport){\r\n\tvar config = view.$getConfig();\r\n\tvar height = config.row_height;\r\n\tvar buffer = 5;\r\n\tvar indexStart = Math.max(0, Math.floor(viewport.y / height) - buffer);\r\n\tvar indexEnd = Math.min(datastore.count(), Math.ceil(viewport.y_end / height) + buffer);\r\n\treturn {\r\n\t\tstart: indexStart,\r\n\t\tend: indexEnd\r\n\t};\r\n};","module.exports = function (gantt) {\r\n\r\n\tvar BaseEditor = function () {\r\n\t};\r\n\r\n\tBaseEditor.prototype = {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t},\r\n\t\thide: function () {\r\n\t\t},\r\n\t\tset_value: function (value, id, column, node) {\r\n\t\t\tthis.get_input(node).value = value;\r\n\t\t},\r\n\t\tget_value: function (id, column, node) {\r\n\t\t\treturn this.get_input(node).value || \"\";\r\n\t\t},\r\n\t\tis_changed: function (value, id, column, node) {\r\n\t\t\tvar currentValue = this.get_value(id, column, node);\r\n\t\t\tif (currentValue && value && currentValue.valueOf && value.valueOf) {\r\n\t\t\t\treturn currentValue.valueOf() != value.valueOf();\r\n\t\t\t} else {\r\n\t\t\t\treturn currentValue != value;\r\n\t\t\t}\r\n\t\t},\r\n\t\tis_valid: function (value, id, column, node) {\r\n\t\t\treturn true;\r\n\t\t},\r\n\r\n\t\tsave: function (id, column, node) {\r\n\r\n\t\t},\r\n\t\tget_input: function (node) {\r\n\t\t\treturn node.querySelector(\"input\");\r\n\t\t},\r\n\t\tfocus: function (node) {\r\n\t\t\tvar input = this.get_input(node);\r\n\t\t\tif (!input) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (input.focus) {\r\n\t\t\t\tinput.focus();\r\n\t\t\t}\r\n\r\n\t\t\tif (input.select) {\r\n\t\t\t\tinput.select();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\treturn BaseEditor;\r\n};","var utils = require(\"./env\");\r\n\r\nmodule.exports = function(gantt){\r\n\treturn utils.isNode || !gantt.$root;\r\n};","/* eslint-disable no-restricted-globals */\r\nvar isWindowAwailable = typeof window !== \"undefined\";\r\n\r\n/* eslint-enable no-restricted-globals */\r\n\r\nvar env = {\r\n\tisIE: isWindowAwailable && (navigator.userAgent.indexOf(\"MSIE\") >= 0 || navigator.userAgent.indexOf(\"Trident\") >= 0),\r\n\tisIE6: isWindowAwailable && (!XMLHttpRequest && navigator.userAgent.indexOf(\"MSIE\") >= 0),\r\n\tisIE7: isWindowAwailable && (navigator.userAgent.indexOf(\"MSIE 7.0\") >= 0 && navigator.userAgent.indexOf(\"Trident\") < 0),\r\n\tisIE8: isWindowAwailable && (navigator.userAgent.indexOf(\"MSIE 8.0\") >= 0 && navigator.userAgent.indexOf(\"Trident\") >= 0),\r\n\tisOpera: isWindowAwailable && (navigator.userAgent.indexOf(\"Opera\") >= 0),\r\n\tisChrome: isWindowAwailable && (navigator.userAgent.indexOf(\"Chrome\") >= 0),\r\n\tisKHTML: isWindowAwailable && (navigator.userAgent.indexOf(\"Safari\") >= 0 || navigator.userAgent.indexOf(\"Konqueror\") >= 0),\r\n\tisFF: isWindowAwailable && (navigator.userAgent.indexOf(\"Firefox\") >= 0),\r\n\tisIPad: isWindowAwailable && (navigator.userAgent.search(/iPad/gi) >= 0),\r\n\tisEdge: isWindowAwailable && (navigator.userAgent.indexOf(\"Edge\")!=-1),\r\n\tisNode: (!isWindowAwailable || typeof navigator == \"undefined\")\r\n};\r\n\r\nmodule.exports = env;","var utils = require(\"../../../utils/utils\"),\r\n\teventable = require(\"../../../utils/eventable\"),\r\n\tdomHelpers = require(\"../utils/dom_helpers\");\r\n\r\nvar Cell = (function () {\r\n\t\"use strict\";\r\n\r\n\tfunction Cell(parent, config, factory, gantt) {\r\n\t\tif (parent) {\r\n\t\t\tthis.$container = domHelpers.toNode(parent);\r\n\t\t\tthis.$parent = parent;\r\n\t\t}\r\n\t\t// save config\r\n\t\tthis.$config = utils.mixin(config, {\r\n\t\t\theaderHeight: 33\r\n\t\t});\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$domEvents = gantt._createDomEventScope();\r\n\t\t// set id\r\n\t\tthis.$id = config.id || \"c\" + utils.uid();\r\n\r\n\t\tthis.$name = \"cell\";\r\n\t\tthis.$factory = factory;\r\n\r\n\t\teventable(this);\r\n\r\n\t}\r\n\r\n\tCell.prototype.destructor = function () {\r\n\t\tthis.$parent = this.$container = this.$view = null;\r\n\t\tvar mouse = this.$gantt.$services.getService(\"mouseEvents\");\r\n\t\tmouse.detach(\"click\", \"gantt_header_arrow\", this._headerClickHandler);\r\n\t\tthis.$domEvents.detachAll();\r\n\t\tthis.callEvent(\"onDestroy\", []);\r\n\t\tthis.detachAllEvents();\r\n\t};\r\n\tCell.prototype.cell = function (id) {\r\n\t\treturn null;\r\n\t};\r\n\r\n\tCell.prototype.scrollTo = function(left, top){\r\n\r\n\t\tif (left*1 == left){\r\n\t\t\tthis.$view.scrollLeft = left;\r\n\t\t}\r\n\t\tif(top*1 == top){\r\n\t\t\tthis.$view.scrollTop = top;\r\n\t\t}\r\n\t};\r\n\r\n\tCell.prototype.clear = function(){\r\n\t\tthis.getNode().innerHTML = \"\";\r\n\t\tthis.getNode().className = \"gantt_layout_content\";\r\n\t\tthis.getNode().style.padding = \"0\";\r\n\t};\r\n\r\n\tCell.prototype.resize = function (final) {\r\n\t\tif (this.$parent) {\r\n\t\t\treturn this.$parent.resize(final);\r\n\t\t}\r\n\r\n\t\tif(final === false){\r\n\t\t\tthis.$preResize = true;\r\n\t\t}\r\n\r\n\t\tvar topCont = this.$container;\r\n\t\tvar x = topCont.offsetWidth;\r\n\t\tvar y = topCont.offsetHeight;\r\n\t\tvar topSize = this.getSize();\r\n\t\tif (topCont === document.body) {\r\n\t\t\tx = document.body.offsetWidth;\r\n\t\t\ty = document.body.offsetHeight;\r\n\t\t}\r\n\t\tif (x < topSize.minWidth) {\r\n\t\t\tx = topSize.minWidth;\r\n\t\t}\r\n\t\tif (x > topSize.maxWidth) {\r\n\t\t\tx = topSize.maxWidth;\r\n\t\t}\r\n\t\tif (y < topSize.minHeight) {\r\n\t\t\ty = topSize.minHeight;\r\n\t\t}\r\n\t\tif (y > topSize.maxHeight) {\r\n\t\t\ty = topSize.maxHeight;\r\n\t\t}\r\n\t\tthis.setSize(x, y);\r\n\r\n\t\tif(!this.$preResize){\r\n\t\t//\tself.callEvent(\"onResize\", [x, y]);\r\n\t\t}\r\n\t\tthis.$preResize = false;\r\n\t};\r\n\r\n\tCell.prototype.hide = function () {\r\n\t\tthis._hide(true);\r\n\t\tthis.resize();\r\n\t};\r\n\tCell.prototype.show = function (force) {\r\n\t\tthis._hide(false);\r\n\t\tif (force && this.$parent) {\r\n\t\t\tthis.$parent.show();\r\n\t\t}\r\n\t\tthis.resize();\r\n\t};\r\n\tCell.prototype._hide = function (mode) {\r\n\t\tif (mode === true && this.$view.parentNode) {\r\n\t\t\tthis.$view.parentNode.removeChild(this.$view);\r\n\t\t}\r\n\t\telse if (mode === false && !this.$view.parentNode) {\r\n\t\t\tvar index = this.$parent.cellIndex(this.$id);\r\n\t\t\tthis.$parent.moveView(this, index);\r\n\t\t}\r\n\t\tthis.$config.hidden = mode;\r\n\t};\r\n\tCell.prototype.$toHTML = function (content, css) {\r\n\t\tif (content === void 0) { content = \"\"; }\r\n\t\tcss = [(css || \"\"), (this.$config.css || \"\")].join(\" \");\r\n\t\tvar obj = this.$config;\r\n\t\tvar header = \"\";\r\n\t\tif (obj.raw) {\r\n\t\t\tcontent = typeof obj.raw === \"string\" ? obj.raw : \"\";\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (!content) {\r\n\t\t\t\tcontent = \"
\" + (obj.html || \"\") + \"
\";\r\n\t\t\t}\r\n\t\t\tif (obj.header) {\r\n\t\t\t\tvar collapseIcon = obj.canCollapse ? \"
\" : \"\";\r\n\t\t\t\theader = \"
\" + collapseIcon + \"
\" + obj.header + \"
\";\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn \"
\" + header + content + \"
\";\r\n\t};\r\n\tCell.prototype.$fill = function (node, parent) {\r\n\t\tthis.$view = node;\r\n\t\tthis.$parent = parent;\r\n\t\tthis.init();\r\n\t};\r\n\tCell.prototype.getNode = function () {\r\n\t\treturn (this.$view.querySelector(\"gantt_layout_cell\") || this.$view);\r\n\t};\r\n\tCell.prototype.init = function () {\r\n\t\t// [NOT-GOOD] code is executed for each component, while it still has only one handler, it is no good\r\n\r\n\t\tvar self = this;\r\n\r\n\t\tthis._headerClickHandler = function(e){\r\n\t\t\tvar cellId = domHelpers.locateAttribute(e, \"data-cell-id\");\r\n\t\t\tif(cellId == self.$id){\r\n\t\t\t\tself.toggle();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar mouse = this.$gantt.$services.getService(\"mouseEvents\");\r\n\t\tmouse.delegate(\"click\", \"gantt_header_arrow\", this._headerClickHandler);\r\n\r\n\t\tthis.callEvent(\"onReady\", []);\r\n\t};\r\n\tCell.prototype.toggle = function () {\r\n\t\tthis.$config.collapsed = !this.$config.collapsed;\r\n\t\tthis.resize();\r\n\t};\r\n\tCell.prototype.getSize = function () {\r\n\t\tvar size = {\r\n\t\t\theight: this.$config.height || 0,\r\n\t\t\twidth: this.$config.width || 0,\r\n\t\t\tgravity: this.$config.gravity || 1,\r\n\t\t\tminHeight: this.$config.minHeight || 0,\r\n\t\t\tminWidth: this.$config.minWidth || 0,\r\n\t\t\tmaxHeight: this.$config.maxHeight || 100000,\r\n\t\t\tmaxWidth: this.$config.maxWidth || 100000\r\n\t\t};\r\n\t\tif (this.$config.collapsed) {\r\n\t\t\tvar mode = this.$config.mode === \"x\";\r\n\t\t\tsize[mode ? \"width\" : \"height\"] = size[mode ? \"maxWidth\" : \"maxHeight\"] = this.$config.headerHeight;\r\n\t\t}\r\n\t\treturn size;\r\n\t};\r\n\r\n\tCell.prototype.getContentSize = function(){\r\n\r\n\t\tvar width = this.$lastSize.contentX;\r\n\t\tif(width !== width*1){\r\n\t\t\twidth = this.$lastSize.width;\r\n\t\t}\r\n\r\n\t\tvar height = this.$lastSize.contentY;\r\n\t\tif(height !== height*1){\r\n\t\t\theight = this.$lastSize.height;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\twidth: width,\r\n\t\t\theight: height\r\n\t\t};\r\n\t};\r\n\r\n\tCell.prototype._getBorderSizes = function(){\r\n\t\tvar borders = {\r\n\t\t\ttop: 0,\r\n\t\t\tright: 0,\r\n\t\t\tbottom: 0,\r\n\t\t\tleft: 0,\r\n\t\t\thorizontal: 0,\r\n\t\t\tvertical: 0\r\n\t\t};\r\n\t\tif(this._currentBorders){\r\n\t\t\tif(this._currentBorders[this._borders.left]){\r\n\t\t\t\tborders.left = 1;\r\n\t\t\t\tborders.horizontal++;\r\n\t\t\t}\r\n\r\n\t\t\tif(this._currentBorders[this._borders.right]){\r\n\t\t\t\tborders.right = 1;\r\n\t\t\t\tborders.horizontal++;\r\n\t\t\t}\r\n\r\n\t\t\tif(this._currentBorders[this._borders.top]){\r\n\t\t\t\tborders.top = 1;\r\n\t\t\t\tborders.vertical++;\r\n\t\t\t}\r\n\r\n\t\t\tif(this._currentBorders[this._borders.bottom]){\r\n\t\t\t\tborders.bottom = 1;\r\n\t\t\t\tborders.vertical++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn borders;\r\n\r\n\t};\r\n\r\n\tCell.prototype.setSize = function (x, y) {\r\n\t\tthis.$view.style.width = x + \"px\";\r\n\t\tthis.$view.style.height = y + \"px\";\r\n\r\n\t\tvar borders = this._getBorderSizes();\r\n\t\tvar contentY = y - borders.vertical;\r\n\t\tvar contentX = x - borders.horizontal;\r\n\r\n\t\tthis.$lastSize = { x: x, y: y, contentX: contentX, contentY: contentY };\r\n\t\tif (this.$config.header) {\r\n\t\t\tthis._sizeHeader();\r\n\t\t}else{\r\n\t\t\tthis._sizeContent();\r\n\t\t}\r\n\t};\r\n\r\n\tCell.prototype._borders = {\r\n\t\t\"left\":\"gantt_layout_cell_border_left\",\r\n\t\t\"right\":\"gantt_layout_cell_border_right\",\r\n\t\t\"top\":\"gantt_layout_cell_border_top\",\r\n\t\t\"bottom\":\"gantt_layout_cell_border_bottom\"\r\n\t};\r\n\r\n\tCell.prototype._setBorders = function(css, view){\r\n\t\tif(!view) {\r\n\t\t\tview = this;\r\n\t\t}\r\n\t\tvar node = view.$view;\r\n\r\n\t\tfor( var i in this._borders){\r\n\t\t\tdomHelpers.removeClassName(node, this._borders[i]);\r\n\t\t}\r\n\r\n\t\tif(typeof css == \"string\"){\r\n\t\t\tcss = [css];\r\n\t\t}\r\n\r\n\t\tvar cssHash = {};\r\n\r\n\t\tfor(var i = 0; i < css.length; i++){\r\n\t\t\tdomHelpers.addClassName(node, css[i]);\r\n\t\t\tcssHash[css[i]] = true;\r\n\t\t}\r\n\r\n\t\tview._currentBorders = cssHash;\r\n\t};\r\n\r\n\r\n\tCell.prototype._sizeContent = function(){\r\n\t\tvar content = this.$view.childNodes[0];\r\n\t\tif(content && content.className == \"gantt_layout_content\"){\r\n\t\t\tcontent.style.height = this.$lastSize.contentY + \"px\";\r\n\t\t}\r\n\t};\r\n\r\n\tCell.prototype._sizeHeader = function () {\r\n\t\tvar size = this.$lastSize;\r\n\t\tsize.contentY -= this.$config.headerHeight;\r\n\t\tvar header = this.$view.childNodes[0];\r\n\t\tvar content = this.$view.childNodes[1];\r\n\t\tvar xLayout = this.$config.mode === \"x\";\r\n\t\tif (this.$config.collapsed) {\r\n\t\t\tcontent.style.display = \"none\";\r\n\t\t\tif (xLayout) {\r\n\t\t\t\theader.className = \"gantt_layout_header collapsed_x\";\r\n\t\t\t\theader.style.width = size.y + \"px\";\r\n\t\t\t\tvar d = Math.floor(size.y / 2 - size.x / 2);\r\n\t\t\t\theader.style.transform = \"rotate(90deg) translate(\" + d + \"px, \" + d + \"px)\";\r\n\t\t\t\tcontent.style.display = \"none\";\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\theader.className = \"gantt_layout_header collapsed_y\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (xLayout) {\r\n\t\t\t\theader.className = \"gantt_layout_header\";\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\theader.className = \"gantt_layout_header vertical\";\r\n\t\t\t}\r\n\t\t\theader.style.width = 'auto';\r\n\t\t\theader.style.transform = '';\r\n\t\t\tcontent.style.display = \"\";\r\n\t\t\tcontent.style.height = size.contentY + \"px\";\r\n\t\t}\r\n\t\theader.style.height = this.$config.headerHeight + \"px\";\r\n\t};\r\n\treturn Cell;\r\n}());\r\n\r\nmodule.exports = Cell;\r\n","var __extends = require(\"../../../../utils/extends\");\r\nvar htmlHelpers = require(\"../../utils/html_helpers\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction SelectControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\t\r\n\t\treturn self; \r\n\t}\r\n\t\r\n\t__extends(SelectControl, _super);\r\n\t\r\n\tSelectControl.prototype.render = function(sns) {\r\n\t\tvar height = (sns.height || \"23\") + \"px\";\r\n\t\tvar html = \"
\";\r\n\r\n\t\thtml += htmlHelpers.getHtmlSelect(sns.options, [{ key: \"style\", value: \"width:100%;\" }]);\r\n\t\thtml += \"
\";\r\n\t\treturn html;\r\n\t};\r\n\r\n\tSelectControl.prototype.set_value = function(node, value, ev, sns) {\r\n\t\tvar select = node.firstChild;\r\n\t\tif (!select._dhx_onchange && sns.onchange) {\r\n\t\t\tselect.onchange = sns.onchange;\r\n\t\t\tselect._dhx_onchange = true;\r\n\t\t}\r\n\t\tif (typeof value === \"undefined\")\r\n\t\t\tvalue = (select.options[0] || {}).value;\r\n\t\tselect.value = value || \"\";\r\n\t};\r\n\t\r\n\tSelectControl.prototype.get_value = function(node) {\r\n\t\treturn node.firstChild.value;\r\n\t};\r\n\t\r\n\tSelectControl.prototype.focus = function(node) {\r\n\t\tvar a = node.firstChild;\r\n\t\tgantt._focus(a, true);\r\n\t};\r\n\t\r\n\treturn SelectControl;\r\n};","module.exports = function(gantt){\r\n\treturn gantt.config.smart_rendering && gantt._smart_render;\r\n};","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1, eval)(\"this\");\r\n} catch (e) {\r\n\t// This works if the window reference is available\r\n\tif (typeof window === \"object\") g = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n","\r\n/* eslint-disable no-restricted-globals */\r\nvar globalScope;\r\nif(typeof window !== \"undefined\"){\r\n\tglobalScope = window;\r\n}else{\r\n\tglobalScope = global;\r\n}\r\n/* eslint-enable no-restricted-globals */\r\n\r\nmodule.exports = globalScope;","/**\r\n * The state object for order branch drag and drop\r\n */\r\n\r\nvar utils = require(\"../../../../utils/utils\");\r\n\r\nmodule.exports = {\r\n\tcreateDropTargetObject: function createDropTargetObject(parent) {\r\n\t\tvar res = {\r\n\t\t\ttargetParent: null,\r\n\t\t\ttargetIndex: 0,\r\n\t\t\ttargetId: null,\r\n\t\t\tchild: false,\r\n\t\t\tnextSibling: false,\r\n\t\t\tprevSibling: false\r\n\t\t};\r\n\r\n\t\tif (parent) {\r\n\t\t\tutils.mixin(res, parent, true);\r\n\t\t}\r\n\t\treturn res;\r\n\t},\r\n\tnextSiblingTarget: function nextSiblingTarget(dndTaskId, targetTaskId, store) {\r\n\t\tvar result = this.createDropTargetObject();\r\n\t\tresult.targetId = targetTaskId;\r\n\t\tresult.nextSibling = true;\r\n\t\tresult.targetParent = store.getParent(result.targetId);\r\n\t\tresult.targetIndex = store.getBranchIndex(result.targetId);\r\n\t\tif(store.getParent(dndTaskId) != result.targetParent || result.targetIndex < store.getBranchIndex(dndTaskId)){\r\n\t\t\tresult.targetIndex += 1;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\tprevSiblingTarget: function prevSiblingTarget(dndTaskId, targetTaskId, store) {\r\n\t\tvar result = this.createDropTargetObject();\r\n\t\tresult.targetId = targetTaskId;\r\n\t\tresult.prevSibling = true;\r\n\t\tresult.targetParent = store.getParent(result.targetId);\r\n\t\tresult.targetIndex = store.getBranchIndex(result.targetId);\r\n\t\tif(store.getParent(dndTaskId) == result.targetParent && result.targetIndex > store.getBranchIndex(dndTaskId)){\r\n\t\t\tresult.targetIndex -= 1;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\tfirstChildTarget: function firstChildTarget(dndTaskId, targetTaskId, store) {\r\n\t\tvar result = this.createDropTargetObject();\r\n\t\tresult.targetId = targetTaskId;\r\n\t\tresult.targetParent = result.targetId;\r\n\t\tresult.targetIndex = 0;\r\n\t\tresult.child = true;\r\n\t\treturn result;\r\n\t},\r\n\tlastChildTarget: function lastChildTarget(dndTaskId, targetTaskId, store) {\r\n\t\tvar children = store.getChildren(targetTaskId);\r\n\t\tvar result = this.createDropTargetObject();\r\n\t\tresult.targetId = children[children.length - 1];\r\n\t\tresult.targetParent = targetTaskId;\r\n\t\tresult.targetIndex = children.length;\r\n\t\tresult.nextSibling = true;\r\n\t\treturn result;\r\n\t}\r\n};","var isLegacyRender = require(\"../is_legacy_smart_render\");\r\n\r\nmodule.exports = function isColumnVisible(columnIndex, scale, viewPort, gantt){\r\n\tvar width = scale.width[columnIndex];\r\n\tif(width <= 0){\r\n\t\treturn false;\r\n\t}\r\n\tif(!gantt.config.smart_rendering || isLegacyRender(gantt)){\r\n\t\treturn true;\r\n\t}\r\n\tvar cellLeftCoord = scale.left[columnIndex] - width;\r\n\tvar cellRightCoord = scale.left[columnIndex] + width;\r\n\treturn (cellLeftCoord <= viewPort.x_end && cellRightCoord >= viewPort.x);//do not render skipped columns\r\n};","module.exports = function getVisibleCellsRange(scale, viewport){\r\n\tvar firstCellIndex = 0;\r\n\tvar lastCellIndex = scale.left.length - 1;\r\n\tif(viewport){\r\n\t\tfor(var i = 0; i < scale.left.length; i++){\r\n\t\t\tvar left = scale.left[i];\r\n\t\t\tif(left < viewport.x){\r\n\t\t\t\tfirstCellIndex = i;\r\n\t\t\t}\r\n\t\t\tif(left > viewport.x_end){\r\n\t\t\t\tlastCellIndex = i;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\tstart: firstCellIndex,\r\n\t\tend: lastCellIndex\r\n\t};\r\n};","module.exports = function(item, view){\r\n\tvar config = view.$getConfig();\r\n\r\n\treturn {\r\n\t\ttop: view.getItemTop(item.id),\r\n\t\theight: config.row_height,\r\n\t\tleft: 0,\r\n\t\tright: Infinity\r\n\t};\r\n};","var ScaleHelper = require(\"./scales_ignore\");\r\nvar eventable = require(\"../../../utils/eventable\");\r\nvar utils = require(\"../../../utils/utils\");\r\nvar topPositionMixin = require(\"../row_position_mixin\");\r\nvar canvasRender = require(\"./tasks_canvas_render\");\r\n\r\nvar Timeline = function(parent, config, factory, gantt){\r\n\tthis.$config = utils.mixin({}, config || {});\r\n\tthis.$scaleHelper = new ScaleHelper(gantt);\r\n\tthis.$gantt = gantt;\r\n\tthis._posFromDateCache = {};\r\n\tthis._timelineDragScroll = null;\r\n\tutils.mixin(this, topPositionMixin());\r\n\teventable(this);\r\n};\r\n\r\nTimeline.prototype = {\r\n\tinit: function(container) {\r\n\t\tcontainer.innerHTML += \"
\";\r\n\t\tthis.$task = container.childNodes[0];\r\n\r\n\t\tthis.$task.innerHTML = \"
\";\r\n\t\tthis.$task_scale = this.$task.childNodes[0];\r\n\r\n\t\tthis.$task_data = this.$task.childNodes[1];\r\n\t\tthis.$task_data.innerHTML = \"
\";\r\n\t\tthis.$task_bg = this.$task_data.childNodes[0];\r\n\t\tthis.$task_links = this.$task_data.childNodes[1];\r\n\t\tthis.$task_bars = this.$task_data.childNodes[2];\r\n\r\n\t\tthis._tasks = {\r\n\t\t\tcol_width: 0,\r\n\t\t\twidth: [], // width of each column\r\n\t\t\tfull_width: 0, // width of all columns\r\n\t\t\ttrace_x: [],\r\n\t\t\trendered: {}\r\n\t\t};\r\n\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar attr = config[this.$config.bind + \"_attribute\"];\r\n\t\tvar linksAttr = config[this.$config.bindLinks + \"_attribute\"];\r\n\t\tif(!attr && this.$config.bind){\r\n\t\t\tattr = \"data-\" + this.$config.bind + \"-id\";\r\n\t\t}\r\n\t\tif(!linksAttr && this.$config.bindLinks){\r\n\t\t\tlinksAttr = \"data-\" + this.$config.bindLinks + \"-id\";\r\n\t\t}\r\n\t\tthis.$config.item_attribute = attr || null;\r\n\t\tthis.$config.link_attribute = linksAttr || null;\r\n\r\n\t\tvar layers = this._createLayerConfig();\r\n\t\tif(!this.$config.layers){\r\n\t\t\tthis.$config.layers = layers.tasks;\r\n\t\t}\r\n\t\tif(!this.$config.linkLayers){\r\n\t\t\tthis.$config.linkLayers = layers.links;\r\n\t\t}\r\n\r\n\t\tthis._attachLayers(this.$gantt);\r\n\r\n\t\tthis.callEvent(\"onReady\", []);\r\n\t\t//this.refresh();\r\n\t\tif (this.$gantt.ext.dragTimeline) {\r\n\t\t\tthis._timelineDragScroll = this.$gantt.ext.dragTimeline.create();\r\n\t\t\tthis._timelineDragScroll.attach(this);\r\n\t\t}\r\n\t},\r\n\r\n\tsetSize: function(width, height){\r\n\t\tvar config = this.$getConfig();\r\n\r\n\t\tif(width*1 === width){\r\n\t\t\tthis.$config.width = width;\r\n\t\t}\r\n\t\tif(height*1 === height){\r\n\r\n\t\t\tthis.$config.height = height;\r\n\t\t\tvar dataHeight = Math.max(this.$config.height - config.scale_height);\r\n\t\t\tthis.$task_data.style.height = dataHeight + 'px';\r\n\t\t}\r\n\r\n\t\tthis.refresh();\r\n\t\tthis.$task_bg.style.backgroundImage = \"\";\r\n\r\n\t\tif(config.smart_rendering && this.$config.rowStore){\r\n\t\t\tvar store = this.$config.rowStore;\r\n\t\t\tthis.$task_bg.style.height = config.row_height * store.countVisible() +\"px\";\r\n\t\t}else{\r\n\t\t\tthis.$task_bg.style.height = \"\";\r\n\t\t}\r\n\r\n\t\tvar scale = this._tasks;\r\n\t\t//timeline area layers\r\n\t\tvar data_els = this.$task_data.childNodes;\r\n\t\tfor(var i= 0, len = data_els.length; i < len; i++){\r\n\t\t\tvar el = data_els[i];\r\n\t\t\tif(el.hasAttribute(\"data-layer\") && el.style)\r\n\t\t\t\tel.style.width = scale.full_width + \"px\";\r\n\t\t}\r\n\t},\r\n\r\n\tisVisible: function(){\r\n\t\tif(this.$parent && this.$parent.$config){\r\n\t\t\treturn !this.$parent.$config.hidden;\r\n\t\t}else{\r\n\t\t\treturn this.$task.offsetWidth;\r\n\t\t}\r\n\t},\r\n\r\n\tgetSize: function(){\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar store = this.$config.rowStore;\r\n\r\n\t\tvar contentHeight = store ? config.row_height * store.countVisible() : 0,\r\n\t\t\tcontentWidth = this.isVisible() ? this._tasks.full_width : 0;\r\n\r\n\t\treturn {\r\n\t\t\tx: this.isVisible() ? this.$config.width : 0,\r\n\t\t\ty: this.isVisible() ? this.$config.height : 0,\r\n\t\t\tcontentX: this.isVisible() ? contentWidth : 0,\r\n\t\t\tcontentY: this.isVisible() ? (config.scale_height + contentHeight) : 0,\r\n\t\t\tscrollHeight: this.isVisible() ? contentHeight : 0,\r\n\t\t\tscrollWidth: this.isVisible() ? contentWidth : 0\r\n\t\t};\r\n\t},\r\n\r\n\tscrollTo: function(left, top){\r\n\t\tif(!this.isVisible())\r\n\t\t\treturn;\r\n\r\n\t\tvar scrolled = false;\r\n\r\n\t\tthis.$config.scrollTop = this.$config.scrollTop || 0;\r\n\t\tthis.$config.scrollLeft = this.$config.scrollLeft || 0;\r\n\t\tif(top*1 === top){\r\n\t\t\tthis.$config.scrollTop = top;\r\n\t\t\tthis.$task_data.scrollTop = this.$config.scrollTop;\r\n\t\t\tscrolled = true;\r\n\t\t}\r\n\t\tif (left*1 === left){\r\n\t\t\tthis.$task.scrollLeft = left;\r\n\t\t\tthis.$config.scrollLeft = this.$task.scrollLeft;\r\n\t\t\tthis._refreshScales();\r\n\t\t\tscrolled = true;\r\n\t\t}\r\n\r\n\t\tif(scrolled){\r\n\t\t\tthis.callEvent(\"onScroll\", [this.$config.scrollLeft, this.$config.scrollTop]);\r\n\t\t}\r\n\t},\r\n\r\n\t_refreshScales: function _refreshScales() {\r\n\t\tif(!this.isVisible())\r\n\t\t\treturn;\r\n\r\n\t\tvar config = this.$getConfig();\r\n\t\tif (!config.smart_scales) return;\r\n\r\n\t\tvar viewPort = this.getViewPort();\r\n\r\n\t\tvar scales = this._scales;\r\n\t\tthis.$task_scale.innerHTML = this._getScaleChunkHtml(scales, viewPort.x, viewPort.x_end);\r\n\t},\r\n\r\n\tgetViewPort: function(){\r\n\t\tvar scrollLeft = this.$config.scrollLeft || 0;\r\n\t\tvar scrollTop = this.$config.scrollTop || 0;\r\n\t\tvar height = this.$config.height || 0;\r\n\t\tvar width = this.$config.width || 0;\r\n\t\treturn {\r\n\t\t\ty: scrollTop,\r\n\t\t\ty_end: scrollTop + height,\r\n\t\t\tx: scrollLeft,\r\n\t\t\tx_end: scrollLeft + width,\r\n\t\t\theight: height,\r\n\t\t\twidth: width\r\n\t\t};\r\n\t},\r\n\r\n\t_createLayerConfig: function(){\r\n\t\tvar self = this;\r\n\t\tvar taskFilter = function(){\r\n\t\t\treturn self.isVisible();\r\n\t\t};\r\n\r\n\t\tvar taskLayers = [\r\n\t\t\t{\r\n\t\t\t\texpose: true,\r\n\t\t\t\trenderer: this.$gantt.$ui.layers.taskBar(),\r\n\t\t\t\tcontainer: this.$task_bars,\r\n\t\t\t\tfilter: [taskFilter]\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\trenderer: this.$gantt.$ui.layers.taskSplitBar(),\r\n\t\t\t\tfilter: [taskFilter],\r\n\t\t\t\tcontainer: this.$task_bars,\r\n\t\t\t\tappend: true\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\trenderer: this.$gantt.$ui.layers.taskBg(),\r\n\t\t\t\tcontainer: this.$task_bg,\r\n\t\t\t\tfilter: [\r\n\t\t\t\t\t//function(){\r\n\t\t\t\t\t//\treturn !self.$getConfig().static_background;\r\n\t\t\t\t\t//},\r\n\t\t\t\t\ttaskFilter\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t];\r\n\r\n\t\tvar linkLayers = [\r\n\t\t\t{\r\n\t\t\t\texpose: true,\r\n\t\t\t\trenderer: this.$gantt.$ui.layers.link(),\r\n\t\t\t\tcontainer: this.$task_links,\r\n\t\t\t\tfilter: [taskFilter]\r\n\t\t\t}\r\n\t\t];\r\n\r\n\t\treturn {\r\n\t\t\ttasks: taskLayers,\r\n\t\t\tlinks: linkLayers\r\n\t\t};\r\n\r\n\t},\r\n\r\n\t_attachLayers: function(gantt){\r\n\t\tthis._taskLayers = [];\r\n\t\tthis._linkLayers = [];\r\n\r\n\t\tvar self = this;\r\n\r\n\t\tvar layers = this.$gantt.$services.getService(\"layers\");\r\n\r\n\t\tif(this.$config.bind){\r\n\r\n\t\t\tthis._bindStore();\r\n\t\t\tvar taskRenderer = layers.getDataRender(this.$config.bind);\r\n\r\n\t\t\tif(!taskRenderer){\r\n\t\t\t\ttaskRenderer = layers.createDataRender({\r\n\t\t\t\t\tname: this.$config.bind,\r\n\t\t\t\t\tdefaultContainer: function(){ return self.$task_data;}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\ttaskRenderer.container = function(){ return self.$task_data;};\r\n\r\n\t\t\tvar taskLayers = this.$config.layers;\r\n\t\t\tfor(var i = 0; taskLayers && i < taskLayers.length; i++){\r\n\t\t\t\tvar layer = taskLayers[i];\r\n\r\n\t\t\t\tif(typeof layer == \"string\"){\r\n\t\t\t\t\tlayer = this.$gantt.$ui.layers[layer]();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(typeof layer == \"function\" || (layer && layer.render && layer.update)){\r\n\t\t\t\t\tlayer = {renderer: layer};\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlayer.view = this;\r\n\r\n\t\t\t\tvar bar_layer = taskRenderer.addLayer(layer);\r\n\t\t\t\tthis._taskLayers.push(bar_layer);\r\n\t\t\t\tif(layer.expose){\r\n\t\t\t\t\tthis._taskRenderer = taskRenderer.getLayer(bar_layer);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis._initStaticBackgroundRender();\r\n\t\t}\r\n\r\n\t\tif(this.$config.bindLinks){\r\n\t\t\tself.$config.linkStore = self.$gantt.getDatastore(self.$config.bindLinks);\r\n\r\n\t\t\tvar linkRenderer = layers.getDataRender(this.$config.bindLinks);\r\n\r\n\t\t\tif(!linkRenderer){\r\n\t\t\t\tlinkRenderer = layers.createDataRender({\r\n\t\t\t\t\tname: this.$config.bindLinks,\r\n\t\t\t\t\tdefaultContainer: function(){ return self.$task_data;}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tvar linkLayers = this.$config.linkLayers;\r\n\t\t\tfor(var i = 0; linkLayers && i < linkLayers.length; i++){\r\n\r\n\t\t\t\tif(typeof layer == \"string\"){\r\n\t\t\t\t\tlayer = this.$gantt.$ui.layers[layer]();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar layer = linkLayers[i];\r\n\t\t\t\tlayer.view = this;\r\n\t\t\t//\tlayer.getViewPort = getViewPort;\r\n\t\t\t//\tsubscribeSmartRender(layer);\r\n\t\t\t\tvar linkLayer = linkRenderer.addLayer(layer);\r\n\t\t\t\tthis._taskLayers.push(linkLayer);\r\n\t\t\t\tif(linkLayers[i].expose){\r\n\t\t\t\t\tthis._linkRenderer = linkRenderer.getLayer(linkLayer);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t_initStaticBackgroundRender: function(){\r\n\t\tvar self = this;\r\n\t\tvar staticRender = canvasRender.create();\r\n\t\tvar store = self.$config.rowStore;\r\n\t\tif(!store) return;\r\n\r\n\t\tthis._staticBgHandler = store.attachEvent(\"onStoreUpdated\", function(id, item, mode){\r\n\t\t\tif(id !== null) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif(!self.isVisible())\r\n\t\t\t\treturn;\r\n\t\t\tvar config = self.$getConfig();\r\n\t\t\tif(config.static_background) {\r\n\t\t\t\tvar store = self.$gantt.getDatastore(self.$config.bind);\r\n\t\t\t\tvar staticBgContainer = self.$task_bg_static;\r\n\t\t\t\tif(!staticBgContainer){\r\n\t\t\t\t\tstaticBgContainer = document.createElement(\"div\");\r\n\t\t\t\t\tstaticBgContainer.className = \"gantt_task_bg\";\r\n\t\t\t\t\tself.$task_bg_static = staticBgContainer;\r\n\t\t\t\t\tif(self.$task_bg.nextSibling){\r\n\t\t\t\t\t\tself.$task_data.insertBefore(staticBgContainer, self.$task_bg.nextSibling);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tself.$task_data.appendChild(staticBgContainer);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (store) {\r\n\t\t\t\t\tstaticRender.render(staticBgContainer, config, self.getScale(), config.row_height * store.countVisible());\r\n\t\t\t\t}\r\n\t\t\t}else if(config.static_background){\r\n\t\t\t\tif(self.$task_bg_static && self.$task_bg_static.parentNode){\r\n\t\t\t\t\tself.$task_bg_static.parentNode.removeChild(self.$task_bg_static);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\tthis.attachEvent(\"onDestroy\", function () {\r\n\t\t\tstaticRender.destroy();\r\n\t\t});\r\n\t\tthis._initStaticBackgroundRender = function(){};//init once\r\n\t},\r\n\r\n\t_clearLayers: function(gantt){\r\n\t\tvar layers = this.$gantt.$services.getService(\"layers\");\r\n\t\tvar taskRenderer = layers.getDataRender(this.$config.bind);\r\n\t\tvar linkRenderer = layers.getDataRender(this.$config.bindLinks);\r\n\r\n\t\tif (this._taskLayers) {\r\n\t\t\tfor(var i = 0; i < this._taskLayers.length; i++){\r\n\t\t\t\ttaskRenderer.removeLayer(this._taskLayers[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (this._linkLayers) {\r\n\t\t\tfor(var i = 0; i < this._linkLayers.length; i++){\r\n\t\t\t\tlinkRenderer.removeLayer(this._linkLayers[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._linkLayers = [];\r\n\t\tthis._taskLayers = [];\r\n\t},\r\n\r\n\t_render_tasks_scales: function _render_tasks_scales() {\r\n\t\tvar config = this.$getConfig();\r\n\r\n\t\tvar scales_html = \"\",\r\n\t\t\touter_width = 0,\r\n\t\t\tscale_height = 0;\r\n\r\n\t\tvar state = this.$gantt.getState();\r\n\r\n\t\tif (this.isVisible()) {\r\n\t\t\tvar helpers = this.$scaleHelper;\r\n\t\t\tvar scales = this._getScales();\r\n\t\t\tscale_height = config.scale_height;\r\n\r\n\t\t\tvar availWidth = this.$config.width;\r\n\t\t\tif(config.autosize == \"x\" || config.autosize == \"xy\"){\r\n\t\t\t\tavailWidth = Math.max(config.autosize_min_width, 0);\r\n\t\t\t}\r\n\r\n\t\t\tvar cfgs = helpers.prepareConfigs(scales, config.min_column_width, availWidth, scale_height - 1, state.min_date, state.max_date, config.rtl);\r\n\t\t\tvar cfg = this._tasks = cfgs[cfgs.length - 1];\r\n\t\t\tthis._scales = cfgs;\r\n\t\t\tthis._posFromDateCache = {};\r\n\r\n\t\t\tscales_html = this._getScaleChunkHtml(cfgs, 0, this.$config.width);\r\n\r\n\t\t\touter_width = cfg.full_width + \"px\";//cfg.full_width + (this._scroll_sizes().y ? scrollSizes.scroll_size : 0) + \"px\";\r\n\t\t\tscale_height += \"px\";\r\n\t\t}\r\n\r\n\t\tthis.$task_scale.style.height = scale_height;\r\n\r\n\t\tthis.$task_data.style.width =\r\n\t\t\tthis.$task_scale.style.width = outer_width;\r\n\r\n\t\tthis.$task_scale.innerHTML = scales_html;\r\n\r\n\t},\r\n\r\n\t_getScaleChunkHtml: function _get_scale_chunk_html (scales, fromPos, toPos) {\r\n\t\tvar templates = this.$gantt.templates;\r\n\t\tvar html = [];\r\n\r\n\t\tvar css = templates.scale_row_class;\r\n\t\tfor (var i = 0; i < scales.length; i++) {\r\n\t\t\tvar cssClass = \"gantt_scale_line\";\r\n\t\t\tvar tplClass = css(scales[i]);\r\n\t\t\tif (tplClass) {\r\n\t\t\t\tcssClass += \" \" + tplClass;\r\n\t\t\t}\r\n\r\n\t\t\thtml.push(\"
\" + this._prepareScaleHtml(scales[i], fromPos, toPos) + \"
\");\r\n\t\t}\r\n\r\n\t\treturn html.join(\"\");\r\n\t},\r\n\t_prepareScaleHtml: function _prepare_scale_html(config, fromPos, toPos) {\r\n\t\tvar globalConfig = this.$getConfig();\r\n\t\tvar globalTemplates = this.$gantt.templates;\r\n\r\n\t\tvar cells = [];\r\n\t\tvar date = null, css = null;\r\n\r\n\t\tvar content = config.format || config.template || config.date;\r\n\r\n\t\tif(typeof content === \"string\"){\r\n\t\t\tcontent = this.$gantt.date.date_to_str(content);\r\n\t\t}\r\n\r\n\t\tvar startIndex = 0,\r\n\t\t\tendIndex = config.count;\r\n\r\n\t\tif (globalConfig.smart_scales && (!isNaN(fromPos) && !isNaN(toPos))) {\r\n\t\t\tstartIndex = _findBinary(config.left, fromPos);\r\n\t\t\tendIndex = _findBinary(config.left, toPos) + 1;\r\n\t\t}\r\n\r\n\t\tcss = config.css || function () {\r\n\t\t\t};\r\n\t\tif (!config.css && globalConfig.inherit_scale_class) {\r\n\t\t\tcss = globalTemplates.scale_cell_class;\r\n\t\t}\r\n\r\n\t\tfor (var i = startIndex; i < endIndex; i++) {\r\n\t\t\tif (!config.trace_x[i]) break;\r\n\r\n\t\t\tdate = new Date(config.trace_x[i]);\r\n\t\t\tvar value = content.call(this, date),\r\n\t\t\t\twidth = config.width[i],\r\n\t\t\t\theight = config.height,\r\n\t\t\t\tleft = config.left[i],\r\n\t\t\t\tstyle = \"\",\r\n\t\t\t\ttemplate = \"\",\r\n\t\t\t\tcssclass = \"\";\r\n\r\n\t\t\tif (width) {\r\n\t\t\t\tvar position = globalConfig.smart_scales ? (\"position:absolute;left:\" + left + \"px\") : \"\";\r\n\r\n\t\t\t\tstyle = \"width:\" + (width) + \"px;height:\" + height + \"px;\" + position;\r\n\t\t\t\tcssclass = \"gantt_scale_cell\" + (i == config.count - 1 ? \" gantt_last_cell\" : \"\");\r\n\r\n\t\t\t\ttemplate = css.call(this, date);\r\n\t\t\t\tif (template) cssclass += \" \" + template;\r\n\r\n\t\t\t\tvar ariaAttr = this.$gantt._waiAria.getTimelineCellAttr(value);\r\n\t\t\t\tvar cell = \"
\" + value + \"
\";\r\n\t\t\t\tcells.push(cell);\r\n\t\t\t} else {\r\n\t\t\t\t//do not render ignored cells\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn cells.join(\"\");\r\n\t},\r\n\tdateFromPos: function dateFromPos(x) {\r\n\t\tvar scale = this._tasks;\r\n\t\tif (x < 0 || x > scale.full_width || !scale.full_width) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tvar ind = _findBinary(this._tasks.left, x);\r\n\t\tvar summ = this._tasks.left[ind];\r\n\r\n\t\tvar col_width = scale.width[ind] || scale.col_width;\r\n\t\tvar part = 0;\r\n\t\tif (col_width) {\r\n\t\t\tpart = (x - summ) / col_width;\r\n\t\t\tif(scale.rtl){\r\n\t\t\t\tpart = 1 - part;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar unit = 0;\r\n\t\tif (part) {\r\n\t\t\tunit = this._getColumnDuration(scale, scale.trace_x[ind]);\r\n\t\t}\r\n\r\n\t\tvar date = new Date(scale.trace_x[ind].valueOf() + Math.round(part * unit));\r\n\t\treturn date;\r\n\t},\r\n\tposFromDate: function posFromDate(date) {\r\n\t\tif (!this.isVisible())\r\n\t\t\treturn 0;\r\n\r\n\t\tif(!date){\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\tvar dateValue = String(date.valueOf());\r\n\r\n\t\tif(this._posFromDateCache[dateValue] !== undefined){\r\n\t\t\treturn this._posFromDateCache[dateValue];\r\n\t\t}\r\n\t\tvar ind = this.columnIndexByDate(date);\r\n\t\tthis.$gantt.assert(ind >= 0, \"Invalid day index\");\r\n\r\n\t\tvar wholeCells = Math.floor(ind);\r\n\t\tvar partCell = ind % 1;\r\n\r\n\t\tvar pos = this._tasks.left[Math.min(wholeCells, this._tasks.width.length - 1)];\r\n\t\tif (wholeCells == this._tasks.width.length)\r\n\t\t\tpos += this._tasks.width[this._tasks.width.length - 1];\r\n\t\t//for(var i=1; i <= wholeCells; i++)\r\n\t\t//\tpos += gantt._tasks.width[i-1];\r\n\r\n\t\tif (partCell) {\r\n\t\t\tif (wholeCells < this._tasks.width.length) {\r\n\t\t\t\tpos += this._tasks.width[wholeCells] * (partCell % 1);\r\n\t\t\t} else {\r\n\t\t\t\tpos += 1;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar roundPos = Math.round(pos);\r\n\t\tthis._posFromDateCache[dateValue] = roundPos;\r\n\t\treturn Math.round(roundPos);\r\n\t},\r\n\r\n\t_getNextVisibleColumn: function (startIndex, columns, ignores) {\r\n\t\t// iterate columns to the right\r\n\t\tvar date = +columns[startIndex];\r\n\t\tvar visibleDateIndex = startIndex;\r\n\t\twhile (ignores[date]) {\r\n\t\t\tvisibleDateIndex++;\r\n\t\t\tdate = +columns[visibleDateIndex];\r\n\t\t}\r\n\r\n\t\treturn visibleDateIndex;\r\n\t},\r\n\t_getPrevVisibleColumn: function (startIndex, columns, ignores) {\r\n\t\t// iterate columns to the left\r\n\t\tvar date = +columns[startIndex];\r\n\t\tvar visibleDateIndex = startIndex;\r\n\t\twhile (ignores[date]) {\r\n\t\t\tvisibleDateIndex--;\r\n\t\t\tdate = +columns[visibleDateIndex];\r\n\t\t}\r\n\t\treturn visibleDateIndex;\r\n\t},\r\n\t_getClosestVisibleColumn: function (startIndex, columns, ignores) {\r\n\t\tvar visibleDateIndex = this._getNextVisibleColumn(startIndex, columns, ignores);\r\n\t\tif (!columns[visibleDateIndex]) {\r\n\t\t\tvisibleDateIndex = this._getPrevVisibleColumn(startIndex, columns, ignores);\r\n\t\t}\r\n\t\treturn visibleDateIndex;\r\n\t},\r\n\tcolumnIndexByDate: function columnIndexByDate(date) {\r\n\t\tvar pos = new Date(date).valueOf();\r\n\t\tvar days = this._tasks.trace_x_ascending,\r\n\t\t\tignores = this._tasks.ignore_x;\r\n\r\n\t\tvar state = this.$gantt.getState();\r\n\r\n\t\tif (pos <= state.min_date) {\r\n\t\t\tif(this._tasks.rtl){\r\n\t\t\t\treturn days.length;\r\n\t\t\t}else{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif (pos >= state.max_date) {\r\n\t\t\tif(this._tasks.rtl){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn days.length;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar dateIndex = _findBinary(days, pos);\r\n\r\n\t\tvar visibleIndex = this._getClosestVisibleColumn(dateIndex, days, ignores);\r\n\t\tvar visibleDate = days[visibleIndex];\r\n\t\tvar transition = this._tasks.trace_index_transition;\r\n\r\n\t\tif(!visibleDate){\r\n\t\t\tif(transition){\r\n\t\t\t\treturn transition[0];\r\n\t\t\t}else{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar part = ((date - days[visibleIndex]) / this._getColumnDuration(this._tasks, days[visibleIndex]));\r\n\t\tif(transition){\r\n\t\t\treturn transition[visibleIndex] + (1 - part);\r\n\t\t}else{\r\n\t\t\treturn visibleIndex + part;\r\n\t\t}\r\n\t},\r\n\tgetItemPosition:function (task, start_date, end_date) {\r\n\t\tvar xLeft, xRight, width;\r\n\t\tif(this._tasks.rtl){\r\n\t\t\txRight = this.posFromDate(start_date || task.start_date);\r\n\t\t\txLeft = this.posFromDate(end_date || task.end_date);\r\n\t\t}else{\r\n\t\t\txLeft = this.posFromDate(start_date || task.start_date);\r\n\t\t\txRight = this.posFromDate(end_date || task.end_date);\r\n\t\t}\r\n\t\twidth = Math.max((xRight - xLeft), 0);\r\n\r\n\t\tvar y = this.getItemTop(task.id);\r\n\t\tvar height = this.getItemHeight();\r\n\t\treturn {\r\n\t\t\tleft: xLeft,\r\n\t\t\ttop: y,\r\n\t\t\theight: height,\r\n\t\t\twidth: width\r\n\t\t};\r\n\t},\r\n\r\n\tgetItemHeight: function(){\r\n\t\tvar config = this.$getConfig();\r\n\r\n\t\t// height of the bar item\r\n\t\tvar height = config.task_height;\r\n\r\n\t\tif (height == \"full\") {\r\n\t\t\tvar offset = config.task_height_offset || 5;\r\n\t\t\theight = config.row_height - offset;\r\n\t\t}\r\n\t\t//item height cannot be bigger than row height\r\n\t\theight = Math.min(height, config.row_height);\r\n\t\treturn Math.max(height, 0);\r\n\t},\r\n\r\n\tgetScale: function(){\r\n\t\treturn this._tasks;\r\n\t},\r\n\r\n\t_getScales: function _get_scales() {\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar helpers = this.$scaleHelper;\r\n\t\tvar scales = [helpers.primaryScale(config)].concat(helpers.getSubScales(config));\r\n\r\n\t\thelpers.sortScales(scales);\r\n\t\treturn scales;\r\n\t},\r\n\r\n\t_getColumnDuration: function _get_coll_duration(scale, date) {\r\n\t\treturn this.$gantt.date.add(date, scale.step, scale.unit) - date;\r\n\t},\r\n\t_bindStore: function () {\r\n\t\tif (this.$config.bind){\r\n\t\t\tvar rowStore = this.$gantt.getDatastore(this.$config.bind);\r\n\t\t\tthis.$config.rowStore = rowStore;\r\n\t\t\tif(rowStore && !rowStore._timelineCacheAttached){\r\n\t\t\t\tvar self = this;\r\n\t\t\t\trowStore._timelineCacheAttached = rowStore.attachEvent(\"onBeforeFilter\", function(){\r\n\t\t\t\t\tself._resetTopPositionHeight();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t_unbindStore: function(){\r\n\t\tif (this.$config.bind){\r\n\t\t\tvar rowStore = this.$gantt.getDatastore(this.$config.bind);\r\n\t\t\tif(rowStore._timelineCacheAttached){\r\n\t\t\t\trowStore.detachEvent(rowStore._timelineCacheAttached);\r\n\t\t\t\trowStore._timelineCacheAttached = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\trefresh: function(){\r\n\t\tthis._bindStore();\r\n\r\n\t\tif(this.$config.bindLinks) {\r\n\t\t\tthis.$config.linkStore = this.$gantt.getDatastore(this.$config.bindLinks);\r\n\t\t}\r\n\r\n\t\tthis._resetTopPositionHeight();\r\n\t\tthis._initStaticBackgroundRender();\r\n\t\tthis._render_tasks_scales();\r\n\t},\r\n\r\n\tdestructor: function(){\r\n\t\tvar gantt = this.$gantt;\r\n\t\tthis._clearLayers(gantt);\r\n\t\tthis._unbindStore();\r\n\t\tthis.$task = null;\r\n\t\tthis.$task_scale = null;\r\n\t\tthis.$task_data = null;\r\n\t\tthis.$task_bg = null;\r\n\t\tthis.$task_links = null;\r\n\t\tthis.$task_bars = null;\r\n\r\n\t\tthis.$gantt = null;\r\n\r\n\t\tif(this.$config.rowStore){\r\n\t\t\tthis.$config.rowStore.detachEvent(this._staticBgHandler);\r\n\t\t\tthis.$config.rowStore = null;\r\n\t\t}\r\n\t\tif(this.$config.linkStore){\r\n\t\t\tthis.$config.linkStore = null;\r\n\t\t}\r\n\r\n\t\tif(this._timelineDragScroll) {\r\n\t\t\tthis._timelineDragScroll.destructor();\r\n\t\t\tthis._timelineDragScroll = null;\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onDestroy\", []);\r\n\t\tthis.detachAllEvents();\r\n\r\n\t}\r\n};\r\n\r\nmodule.exports = Timeline;\r\n\r\nfunction _findBinary(array, target) {\r\n\t// modified binary search, target value not exactly match array elements, looking for closest one\r\n\r\n\tvar low = 0, high = array.length - 1, i, item, prev;\r\n\twhile (low <= high) {\r\n\r\n\t\ti = Math.floor((low + high) / 2);\r\n\t\titem = +array[i];\r\n\t\tprev = +array[i - 1];\r\n\t\tif (item < target) {\r\n\t\t\tlow = i + 1;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (item > target) {\r\n\t\t\tif (!(!isNaN(prev) && prev < target)) {\r\n\t\t\t\thigh = i - 1;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else {\r\n\t\t\t\t// if target is between 'i' and 'i-1' return 'i - 1'\r\n\t\t\t\treturn i - 1;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\twhile (+array[i] == +array[i + 1]) i++;\r\n\r\n\t\treturn i;\r\n\t}\r\n\treturn array.length - 1;\r\n}\r\n\r\n","function create(gantt){\r\n\tvar events = [];\r\n\r\n\treturn {\r\n\t\tdelegate:function(event, className, handler, root) {\r\n\t\t\tevents.push([event, className, handler, root]);\r\n\r\n\t\t\tvar helper = gantt.$services.getService(\"mouseEvents\");\r\n\t\t\thelper.delegate(event, className, handler, root);\r\n\t\t},\r\n\t\tdestructor: function(){\r\n\t\t\tvar mouseEvents = gantt.$services.getService(\"mouseEvents\");\r\n\t\t\tfor(var i = 0; i < events.length; i++){\r\n\t\t\t\tvar h = events[i];\r\n\t\t\t\tmouseEvents.detach(h[0], h[1], h[2], h[3]);\r\n\t\t\t}\r\n\t\t\tevents = [];\r\n\t\t}\r\n\t};\r\n}\r\n\r\nmodule.exports = create;","var domHelpers = require(\"../utils/dom_helpers\"),\r\n\tutils = require(\"../../../utils/utils\"),\r\n\teventable = require(\"../../../utils/eventable\"),\r\n\tgridResize = require(\"./grid_resize\"),\r\n\ttopPositionMixin = require(\"../row_position_mixin\");\r\n\r\nvar ColumnDnd = require(\"../plugins/column_grid_dnd\").default;\r\n\r\nvar Grid = function (parent, config, factory, gantt) {\r\n\tthis.$config = utils.mixin({}, config || {});\r\n\tthis.$gantt = gantt;\r\n\tthis.$parent = parent;\r\n\teventable(this);\r\n\tthis.$state = {};\r\n\tutils.mixin(this, topPositionMixin());\r\n};\r\n\r\n\r\nGrid.prototype = {\r\n\tinit: function(container) {\r\n\t\tvar gantt = this.$gantt;\r\n\t\tvar gridAriaAttr = gantt._waiAria.gridAttrString();\r\n\t\tvar gridDataAriaAttr = gantt._waiAria.gridDataAttrString();\r\n\t\tvar _ganttConfig = this.$getConfig();\r\n\t\tvar reorderColumns = _ganttConfig.reorder_grid_columns || false;\r\n\t\tif (this.$config.reorder_grid_columns !== undefined) {\r\n\t\t\treorderColumns = this.$config.reorder_grid_columns;\r\n\t\t}\r\n\r\n\r\n\t\tcontainer.innerHTML = \"
\";\r\n\t\tthis.$grid = container.childNodes[0];\r\n\r\n\t\tthis.$grid.innerHTML = \"
\";\r\n\r\n\t\tthis.$grid_scale = this.$grid.childNodes[0];\r\n\t\tthis.$grid_data = this.$grid.childNodes[1];\r\n\r\n\t\tvar attr = _ganttConfig[this.$config.bind + \"_attribute\"];\r\n\t\tif (!attr && this.$config.bind) {\r\n\t\t\tattr = \"data-\" + this.$config.bind + \"-id\";\r\n\t\t}\r\n\t\tthis.$config.item_attribute = attr || null;\r\n\r\n\t\tif (!this.$config.layers) {\r\n\t\t\tvar layers = this._createLayerConfig();\r\n\t\t\tthis.$config.layers = layers;\r\n\t\t}\r\n\r\n\t\tvar resizer = gridResize(gantt, this);\r\n\t\tresizer.init();\r\n\t\tthis._renderHeaderResizers = resizer.doOnRender;\r\n\t\tthis._mouseDelegates = require(\"../mouse_event_container\")(gantt);\r\n\r\n\t\tthis._addLayers(this.$gantt);\r\n\t\tthis._initEvents();\r\n\r\n\t\tif (reorderColumns) {\r\n\t\t\tthis._columnDND = new ColumnDnd(gantt, this);\r\n\t\t\tthis._columnDND.init();\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onReady\", []);\r\n\t\t//this.refresh();\r\n\t},\r\n\r\n\t_validateColumnWidth: function (column, property) {\r\n\t\t// user can set {name:\"text\", width:\"200\",...} for some reason,\r\n\t\t// check and convert it to number when possible\r\n\t\tvar value = column[property];\r\n\t\tif (value && value != \"*\") {\r\n\t\t\tvar gantt = this.$gantt;\r\n\t\t\tvar numericWidth = value * 1;\r\n\t\t\tif (isNaN(numericWidth)) {\r\n\t\t\t\tgantt.assert(false, \"Wrong \" + property + \" value of column \" + column.name);\r\n\t\t\t} else {\r\n\t\t\t\tcolumn[property] = numericWidth;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetSize: function (width, height) {\r\n\t\tthis.$config.width = this.$state.width = width;\r\n\t\tthis.$config.height = this.$state.height = height;\r\n\r\n\t\t// TODO: maybe inherit and override in a subclass instead of extending here\r\n\r\n\t\tvar columns = this.getGridColumns(),\r\n\t\t\tinnerWidth = 0;\r\n\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar elasticColumns = config.grid_elastic_columns;\r\n\r\n\t\tfor (var i = 0, l = columns.length; i < l; i++) {\r\n\t\t\tthis._validateColumnWidth(columns[i], \"min_width\");\r\n\t\t\tthis._validateColumnWidth(columns[i], \"max_width\");\r\n\t\t\tthis._validateColumnWidth(columns[i], \"width\");\r\n\r\n\t\t\tinnerWidth += columns[i].width * 1;\r\n\t\t}\r\n\r\n\t\tvar outerWidth;\r\n\t\tif (isNaN(innerWidth) || !this.$config.scrollable) {\r\n\t\t\touterWidth = this._setColumnsWidth(width + 1);\r\n\t\t\tinnerWidth = outerWidth;\r\n\t\t}\r\n\r\n\t\tif(this.$config.scrollable && elasticColumns && !isNaN(innerWidth)){\r\n\r\n\t\t\tvar minWidth = 0;\r\n\t\t\tcolumns.forEach(function(col){\r\n\t\t\t\tminWidth += col.min_width || config.min_grid_column_width;\r\n\t\t\t});\r\n\r\n\t\t\tvar columnsWidth = Math.max(minWidth, width);\r\n\t\t\tinnerWidth = this._setColumnsWidth(columnsWidth);\r\n\t\t\touterWidth = width;\r\n\t\t}\r\n\r\n\t\tif (this.$config.scrollable) {\r\n\t\t\tthis.$grid_scale.style.width = innerWidth + \"px\";\r\n\t\t\tthis.$grid_data.style.width = innerWidth + \"px\";\r\n\t\t} else {\r\n\t\t\tthis.$grid_scale.style.width = \"inherit\";\r\n\t\t\tthis.$grid_data.style.width = \"inherit\";\r\n\t\t}\r\n\t\tthis.$config.width -= 1;\r\n\r\n\t\tvar config = this.$getConfig();\r\n\t\tif (outerWidth !== width) {\r\n\t\t\tif(outerWidth !== undefined){\r\n\t\t\t\tconfig.grid_width = outerWidth;\r\n\t\t\t\tthis.$config.width = outerWidth - 1;\r\n\t\t\t}else{\r\n\t\t\t\tif(!isNaN(innerWidth)){\r\n\t\t\t\t\tthis._setColumnsWidth(innerWidth);\r\n\t\t\t\t\tconfig.grid_width = innerWidth;\r\n\t\t\t\t\tthis.$config.width = innerWidth - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar dataHeight = Math.max(this.$state.height - config.scale_height, 0);\r\n\t\tthis.$grid_data.style.height = dataHeight + \"px\";\r\n\t\tthis.refresh();\r\n\t},\r\n\tgetSize: function () {\r\n\r\n\t\tvar config = this.$getConfig();\r\n\r\n\t\tvar store = this.$config.rowStore;\r\n\r\n\t\tvar contentHeight = store ? config.row_height * store.countVisible() : 0,\r\n\t\t\tcontentWidth = this._getGridWidth();\r\n\r\n\t\tvar size = {\r\n\t\t\tx: this.$state.width,\r\n\t\t\ty: this.$state.height,\r\n\t\t\tcontentX: this.isVisible() ? contentWidth : 0,\r\n\t\t\tcontentY: this.isVisible() ? (config.scale_height + contentHeight) : 0,\r\n\t\t\tscrollHeight: this.isVisible() ? contentHeight : 0,\r\n\t\t\tscrollWidth: this.isVisible() ? contentWidth : 0\r\n\t\t};\r\n\r\n\t\treturn size;\r\n\t},\r\n\r\n\t_bindStore: function () {\r\n\t\tif (this.$config.bind){\r\n\t\t\tvar rowStore = this.$gantt.getDatastore(this.$config.bind);\r\n\t\t\tthis.$config.rowStore = rowStore;\r\n\t\t\tif(rowStore && !rowStore._gridCacheAttached){\r\n\t\t\t\tvar self = this;\r\n\t\t\t\trowStore._gridCacheAttached = rowStore.attachEvent(\"onBeforeFilter\", function(){\r\n\t\t\t\t\tself._resetTopPositionHeight();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t_unbindStore: function(){\r\n\t\tif (this.$config.bind){\r\n\t\t\tvar rowStore = this.$gantt.getDatastore(this.$config.bind);\r\n\t\t\tif(rowStore._gridCacheAttached){\r\n\t\t\t\trowStore.detachEvent(rowStore._gridCacheAttached);\r\n\t\t\t\trowStore._gridCacheAttached = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\trefresh: function () {\r\n\t\tthis._bindStore();\r\n\r\n\t\tthis._resetTopPositionHeight();\r\n\t\tthis._initSmartRenderingPlaceholder();\r\n\r\n\t\tthis._calculateGridWidth();\r\n\t\tthis._renderGridHeader();\r\n\t},\r\n\r\n\tgetViewPort: function(){\r\n\t\tvar scrollLeft = this.$config.scrollLeft || 0;\r\n\t\tvar scrollTop = this.$config.scrollTop || 0;\r\n\t\tvar height = this.$config.height || 0;\r\n\t\tvar width = this.$config.width || 0;\r\n\t\treturn {\r\n\t\t\ty: scrollTop,\r\n\t\t\ty_end: scrollTop + height,\r\n\t\t\tx: scrollLeft,\r\n\t\t\tx_end: scrollLeft + width,\r\n\t\t\theight: height,\r\n\t\t\twidth: width\r\n\t\t};\r\n\t},\r\n\r\n\tscrollTo: function (left, top) {\r\n\t\tif (!this.isVisible())\r\n\t\t\treturn;\r\n\r\n\t\tvar scrolled = false;\r\n\r\n\t\tthis.$config.scrollTop = this.$config.scrollTop || 0;\r\n\t\tthis.$config.scrollLeft = this.$config.scrollLeft || 0;\r\n\r\n\t\tif (left * 1 == left) {\r\n\t\t\tthis.$config.scrollLeft = this.$state.scrollLeft = this.$grid.scrollLeft = left;\r\n\t\t\tscrolled = true;\r\n\t\t}\r\n\r\n\t\t// var config = this.$getConfig();\r\n\t\tif (top * 1 == top) {\r\n\t\t\tthis.$config.scrollTop = this.$state.scrollTop = this.$grid_data.scrollTop = top;\r\n\t\t\tscrolled = true;\r\n\t\t}\r\n\r\n\t\tif(scrolled){\r\n\t\t\tthis.callEvent(\"onScroll\", [this.$config.scrollLeft, this.$config.scrollTop]);\r\n\t\t}\r\n\t},\r\n\r\n\tgetColumnIndex: function (name) {\r\n\t\tvar columns = this.$getConfig().columns;\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tif (columns[i].name == name) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t},\r\n\r\n\tgetColumn: function (name) {\r\n\t\tvar index = this.getColumnIndex(name);\r\n\t\tif (index === null) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn this.$getConfig().columns[index];\r\n\t},\r\n\r\n\tgetGridColumns: function () {\r\n\t\tvar config = this.$getConfig();\r\n\t\treturn config.columns.slice();\r\n\t},\r\n\tisVisible: function () {\r\n\t\tif (this.$parent && this.$parent.$config) {\r\n\t\t\treturn !this.$parent.$config.hidden;\r\n\t\t} else {\r\n\t\t\treturn this.$grid.offsetWidth;\r\n\t\t}\r\n\t},\r\n\r\n\tgetItemHeight: function () {\r\n\t\tvar config = this.$getConfig();\r\n\t\treturn config.row_height;\r\n\t},\r\n\r\n\t_createLayerConfig: function () {\r\n\t\tvar gantt = this.$gantt;\r\n\t\tvar self = this;\r\n\t\tvar layers = [\r\n\t\t\t{\r\n\t\t\t\trenderer: gantt.$ui.layers.gridLine(),\r\n\t\t\t\tcontainer: this.$grid_data,\r\n\t\t\t\tfilter: [function () {\r\n\t\t\t\t\treturn self.isVisible();\r\n\t\t\t\t}]\r\n\t\t\t}\r\n\t\t];\r\n\t\treturn layers;\r\n\t},\r\n\r\n\t_addLayers: function (gantt) {\r\n\t\tif (!this.$config.bind)\r\n\t\t\treturn;\r\n\r\n\t\tthis._taskLayers = [];\r\n\r\n\t\tvar self = this;\r\n\r\n\t\tvar layers = this.$gantt.$services.getService(\"layers\");\r\n\t\tvar taskRenderer = layers.getDataRender(this.$config.bind);\r\n\r\n\t\tif (!taskRenderer) {\r\n\t\t\ttaskRenderer = layers.createDataRender({\r\n\t\t\t\tname: this.$config.bind,\r\n\t\t\t\tdefaultContainer: function () { return self.$grid_data; }\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tvar taskLayers = this.$config.layers;\r\n\t\tfor (var i = 0; taskLayers && i < taskLayers.length; i++) {\r\n\t\t\tvar layer = taskLayers[i];\r\n\t\t\tlayer.view = this;\r\n\r\n\t\t\tvar bar_layer = taskRenderer.addLayer(layer);\r\n\t\t\tthis._taskLayers.push(bar_layer);\r\n\t\t}\r\n\r\n\t\tthis._bindStore();\r\n\r\n\t\tthis._initSmartRenderingPlaceholder();\r\n\t},\r\n\r\n\t_refreshPlaceholderOnStoreUpdate: function (id) {\r\n\t\tvar config = this.$getConfig(),\r\n\t\t\tstore = this.$config.rowStore;\r\n\r\n\t\tif (!store || id !== null || !this.isVisible() || !config.smart_rendering) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar contentHeight;\r\n\t\tif (this.$config.scrollY) {\r\n\t\t\tvar scroll = this.$gantt.$ui.getView(this.$config.scrollY);\r\n\t\t\tif (scroll)\r\n\t\t\t\tcontentHeight = scroll.getScrollState().scrollSize;\r\n\t\t}\r\n\r\n\t\tif (!contentHeight) {\r\n\t\t\tcontentHeight = store ? config.row_height * store.countVisible() : 0;\r\n\t\t}\r\n\r\n\t\tif (contentHeight) {\r\n\t\t\tif (this.$rowsPlaceholder && this.$rowsPlaceholder.parentNode) {\r\n\t\t\t\tthis.$rowsPlaceholder.parentNode.removeChild(this.$rowsPlaceholder);\r\n\t\t\t}\r\n\r\n\t\t\tvar placeholder = this.$rowsPlaceholder = document.createElement(\"div\");\r\n\t\t\tplaceholder.style.visibility = \"hidden\";\r\n\t\t\tplaceholder.style.height = contentHeight + \"px\";\r\n\t\t\tplaceholder.style.width = \"1px\";\r\n\t\t\tthis.$grid_data.appendChild(placeholder);\r\n\t\t}\r\n\t},\r\n\r\n\t_initSmartRenderingPlaceholder: function () {\r\n\t\tvar store = this.$config.rowStore;\r\n\t\tif (!store) {\r\n\t\t\treturn;\r\n\t\t} else {\r\n\t\t\tthis._initSmartRenderingPlaceholder = function () { };\r\n\t\t}\r\n\t\tthis._staticBgHandler = store.attachEvent(\"onStoreUpdated\", utils.bind(this._refreshPlaceholderOnStoreUpdate, this));\r\n\t},\r\n\r\n\t_initEvents: function () {\r\n\t\tvar gantt = this.$gantt;\r\n\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_close\", gantt.bind(function (e, id, trg) {\r\n\t\t\tvar store = this.$config.rowStore;\r\n\t\t\tif (!store) return true;\r\n\r\n\t\t\tvar target = domHelpers.locateAttribute(e, this.$config.item_attribute);\r\n\t\t\tif (target) {\r\n\t\t\t\tstore.close(target.getAttribute(this.$config.item_attribute));\r\n\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}, this), this.$grid);\r\n\r\n\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_open\", gantt.bind(function (e, id, trg) {\r\n\t\t\tvar store = this.$config.rowStore;\r\n\t\t\tif (!store) return true;\r\n\r\n\t\t\tvar target = domHelpers.locateAttribute(e, this.$config.item_attribute);\r\n\t\t\tif (target) {\r\n\t\t\t\tstore.open(target.getAttribute(this.$config.item_attribute));\r\n\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}, this), this.$grid);\r\n\t},\r\n\r\n\t_clearLayers: function (gantt) {\r\n\t\tvar layers = this.$gantt.$services.getService(\"layers\");\r\n\t\tvar taskRenderer = layers.getDataRender(this.$config.bind);\r\n\r\n\t\tif (this._taskLayers) {\r\n\t\t\tfor (var i = 0; i < this._taskLayers.length; i++) {\r\n\t\t\t\ttaskRenderer.removeLayer(this._taskLayers[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._taskLayers = [];\r\n\t},\r\n\r\n\t_getColumnWidth: function (column, config, width) {\r\n\t\tvar min_width = column.min_width || config.min_grid_column_width;\r\n\t\tvar new_width = Math.max(width, min_width || 10);\r\n\t\tif (column.max_width)\r\n\t\t\tnew_width = Math.min(new_width, column.max_width);\r\n\t\treturn new_width;\r\n\t},\r\n\t// set min width only if width < than config.min_grid_column_width\r\n\t_checkGridColumnMinWidthLimits: function (columns, config) {\r\n\t\tfor (var i = 0, l = columns.length; i < l; i++) {\r\n\t\t\tvar width = columns[i].width * 1;\r\n\t\t\tif (!columns[i].min_width && width < config.min_grid_column_width){\r\n\t\t\t\tcolumns[i].min_width = width;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t// return min and max possible grid width according to restricts\r\n\t_getGridWidthLimits: function () {\r\n\t\tvar config = this.$getConfig(),\r\n\t\t\tcolumns = this.getGridColumns(),\r\n\t\t\tmin_limit = 0,\r\n\t\t\tmax_limit = 0;\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tmin_limit += columns[i].min_width ? columns[i].min_width : config.min_grid_column_width;\r\n\t\t\tif (max_limit !== undefined) {\r\n\t\t\t\tmax_limit = columns[i].max_width ? (max_limit + columns[i].max_width) : undefined;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis._checkGridColumnMinWidthLimits(columns, config); // FIX ME: should it be before calculating limits?\r\n\t\treturn [min_limit, max_limit];\r\n\t},\r\n\t// resize columns to get total newWidth, starting from columns[start_index]\r\n\t_setColumnsWidth: function (newWidth, start_index) {\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar columns = this.getGridColumns(),\r\n\t\t\tcolumns_width = 0,\r\n\t\t\tfinal_width = newWidth;\r\n\r\n\t\tstart_index = !window.isNaN(start_index) ? start_index : -1;\r\n\r\n\t\tfor (var i = 0, l = columns.length; i < l; i++) {\r\n\t\t\tcolumns_width += columns[i].width * 1;\r\n\t\t}\r\n\r\n\t\tif (window.isNaN(columns_width)) {\r\n\t\t\tthis._calculateGridWidth();\r\n\t\t\tcolumns_width = 0;\r\n\t\t\tfor (var i = 0, l = columns.length; i < l; i++) {\r\n\t\t\t\tcolumns_width += columns[i].width * 1;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar extra_width = final_width - columns_width;\r\n\r\n\t\tvar start_width = 0;\r\n\t\tfor (var i = 0; i < start_index + 1; i++) {\r\n\t\t\tstart_width += columns[i].width;\r\n\t\t}\r\n\r\n\t\tcolumns_width -= start_width;\r\n\r\n\t\tfor (var i = start_index + 1; i < columns.length; i++) {\r\n\r\n\t\t\tvar col = columns[i];\r\n\t\t\tvar share = Math.round(extra_width * (col.width / columns_width));\r\n\r\n\t\t\t// columns have 2 additional restrict fields - min_width & max_width that are set by user\r\n\t\t\tif (extra_width < 0) {\r\n\t\t\t\tif (col.min_width && col.width + share < col.min_width)\r\n\t\t\t\t\tshare = col.min_width - col.width;\r\n\t\t\t\telse if (!col.min_width && config.min_grid_column_width && col.width + share < config.min_grid_column_width)\r\n\t\t\t\t\tshare = config.min_grid_column_width - col.width;\r\n\t\t\t} else if (col.max_width && col.width + share > col.max_width)\r\n\t\t\t\tshare = col.max_width - col.width;\r\n\r\n\t\t\tcolumns_width -= col.width;\r\n\t\t\tcol.width += share;\r\n\t\t\textra_width -= share;\r\n\r\n\t\t}\r\n\r\n\t\tvar iterator = extra_width > 0 ? 1 : -1;\r\n\t\twhile ((extra_width > 0 && iterator === 1) || (extra_width < 0 && iterator === -1)) {\r\n\t\t\tvar curExtra = extra_width;\r\n\t\t\tfor (i = start_index + 1; i < columns.length; i++) {\r\n\t\t\t\tvar new_width = columns[i].width + iterator;\r\n\r\n\t\t\t\tif (new_width == this._getColumnWidth(columns[i], config, new_width)) {\r\n\t\t\t\t\textra_width -= iterator;\r\n\t\t\t\t\tcolumns[i].width = new_width;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!extra_width)\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif (curExtra == extra_width)\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t// if impossible to resize the right-side columns, resize the start column\r\n\t\tif (extra_width && start_index > -1) {\r\n\t\t\tvar new_width = columns[start_index].width + extra_width;\r\n\t\t\tif (new_width == this._getColumnWidth(columns[start_index], config, new_width))\r\n\t\t\t\tcolumns[start_index].width = new_width;\r\n\t\t}\r\n\r\n\t\t//if (this.callEvent(\"onGridResizeEnd\", [config.grid_width, final_width]) === false)\r\n\t\t//\treturn;\r\n\r\n\t\treturn this._getColsTotalWidth();\r\n\t},\r\n\r\n\t_getColsTotalWidth: function () {\r\n\t\tvar columns = this.getGridColumns();\r\n\t\tvar cols_width = 0;\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tvar v = parseFloat(columns[i].width);\r\n\t\t\tif (window.isNaN(v)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tcols_width += v;\r\n\t\t}\r\n\t\treturn cols_width;\r\n\t},\r\n\t_calculateGridWidth: function () {\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar columns = this.getGridColumns();\r\n\t\tvar cols_width = 0;\r\n\t\tvar unknown = [];\r\n\t\tvar width = [];\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tvar v = parseFloat(columns[i].width);\r\n\t\t\tif (window.isNaN(v)) {\r\n\t\t\t\tv = config.min_grid_column_width || 10;\r\n\t\t\t\tunknown.push(i);\r\n\t\t\t}\r\n\t\t\twidth[i] = v;\r\n\t\t\tcols_width += v;\r\n\t\t}\r\n\t\tvar gridWidth = this._getGridWidth() + 1;\r\n\t\tif (config.autofit || unknown.length) {\r\n\t\t\tvar diff = gridWidth - cols_width;\r\n\t\t\t// TODO: logic may be improved for proportional changing of width\r\n\r\n\t\t\t// autofit adjusts columns widths to the outer grid width\r\n\t\t\t// it doesn't makes sense if grid has inner scroll with elastic columns\r\n\t\t\tif (config.autofit && !config.grid_elastic_columns) {\r\n\t\t\t\t// delta must be added for all columns\r\n\t\t\t\tfor (var i = 0; i < width.length; i++) {\r\n\t\t\t\t\tvar delta = Math.round(diff / (width.length - i));\r\n\t\t\t\t\twidth[i] += delta;\r\n\t\t\t\t\tvar new_width = this._getColumnWidth(columns[i], config, width[i]);\r\n\r\n\t\t\t\t\tif (new_width != width[i]) {\r\n\t\t\t\t\t\tdelta = new_width - width[i];\r\n\t\t\t\t\t\twidth[i] = new_width;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdiff -= delta;\r\n\t\t\t\t}\r\n\t\t\t} else if (unknown.length) {\r\n\t\t\t\t// there are several columns with undefined width\r\n\t\t\t\tfor (var i = 0; i < unknown.length; i++) {\r\n\t\t\t\t\tvar delta = Math.round(diff / (unknown.length - i)); // no float values, just integer\r\n\t\t\t\t\tvar index = unknown[i];\r\n\t\t\t\t\twidth[index] += delta;\r\n\t\t\t\t\tvar new_width = this._getColumnWidth(columns[index], config, width[index]);\r\n\t\t\t\t\tif (new_width != width[index]) {\r\n\t\t\t\t\t\tdelta = new_width - width[index];\r\n\t\t\t\t\t\twidth[index] = new_width;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdiff -= delta;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tfor (var i = 0; i < width.length; i++) {\r\n\t\t\t\tcolumns[i].width = width[i];\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar changed = (gridWidth != cols_width);\r\n\t\t\tthis.$config.width = cols_width - 1;\r\n\t\t\tconfig.grid_width = cols_width;\r\n\t\t\tif (changed) {\r\n\t\t\t\tthis.$parent._setContentSize(this.$config.width, null);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\t_renderGridHeader: function () {\r\n\t\tvar gantt = this.$gantt;\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar locale = this.$gantt.locale;\r\n\t\tvar templates = this.$gantt.templates;\r\n\r\n\t\tvar columns = this.getGridColumns();\r\n\t\tif (config.rtl) {\r\n\t\t\tcolumns = columns.reverse();\r\n\t\t}\r\n\t\tvar cells = [];\r\n\t\tvar width = 0,\r\n\t\t\tlabels = locale.labels;\r\n\r\n\t\tvar lineHeigth = config.scale_height - 1;\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tvar last = i == columns.length - 1;\r\n\t\t\tvar col = columns[i];\r\n\r\n\t\t\t// ensure columns have non-empty names\r\n\t\t\tif (!col.name) {\r\n\t\t\t\tcol.name = gantt.uid() + \"\";\r\n\t\t\t}\r\n\r\n\t\t\tvar colWidth = col.width * 1;\r\n\r\n\t\t\tvar gridWidth = this._getGridWidth();\r\n\t\t\tif (last && gridWidth > width + colWidth)\r\n\t\t\t\tcol.width = colWidth = gridWidth - width;\r\n\t\t\twidth += colWidth;\r\n\t\t\tvar sort = (gantt._sort && col.name == gantt._sort.name) ? (\"
\") : \"\";\r\n\t\t\tvar cssClass = [\"gantt_grid_head_cell\",\r\n\t\t\t\t(\"gantt_grid_head_\" + col.name),\r\n\t\t\t\t(last ? \"gantt_last_cell\" : \"\"),\r\n\t\t\t\ttemplates.grid_header_class(col.name, col)].join(\" \");\r\n\r\n\t\t\tvar style = \"width:\" + (colWidth - (last ? 1 : 0)) + \"px;\";\r\n\t\t\tvar label = (col.label || labels[\"column_\" + col.name] || labels[col.name]);\r\n\t\t\tlabel = label || \"\";\r\n\r\n\t\t\tvar ariaAttrs = gantt._waiAria.gridScaleCellAttrString(col, label);\r\n\r\n\t\t\tvar cell = \"
\" + label + sort + \"
\";\r\n\t\t\tcells.push(cell);\r\n\t\t}\r\n\t\tthis.$grid_scale.style.height = (config.scale_height) + \"px\";\r\n\t\tthis.$grid_scale.style.lineHeight = lineHeigth + \"px\";\r\n\t\t//this.$grid_scale.style.width = \"inherit\";\r\n\t\tthis.$grid_scale.innerHTML = cells.join(\"\");\r\n\r\n\t\tif (this._renderHeaderResizers) {\r\n\t\t\tthis._renderHeaderResizers();\r\n\t\t}\r\n\t},\r\n\r\n\t_getGridWidth: function () {\r\n\t\t// TODO: refactor/remove/comment some of _getGridWidth/this.$config.width/this.$state.width, it's not clear what they do\r\n\t\treturn this.$config.width;\r\n\t},\r\n\r\n\tdestructor: function () {\r\n\t\tthis._clearLayers(this.$gantt);\r\n\t\tif (this._mouseDelegates) {\r\n\t\t\tthis._mouseDelegates.destructor();\r\n\t\t\tthis._mouseDelegates = null;\r\n\t\t}\r\n\t\tthis._unbindStore();\r\n\t\tthis.$grid = null;\r\n\t\tthis.$grid_scale = null;\r\n\t\tthis.$grid_data = null;\r\n\t\tthis.$gantt = null;\r\n\t\tif (this.$config.rowStore) {\r\n\t\t\tthis.$config.rowStore.detachEvent(this._staticBgHandler);\r\n\t\t\tthis.$config.rowStore = null;\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onDestroy\", []);\r\n\t\tthis.detachAllEvents();\r\n\t}\r\n};\r\n\r\nmodule.exports = Grid;\r\n","var utils = require(\"../../../utils/utils\");\r\n\r\nfunction ScaleHelper(gantt){\r\n\tvar dateHelper = gantt.date;\r\n\tvar services = gantt.$services;\r\n\r\n\treturn {\r\n\t\tgetSum: function (sizes, from, to) {\r\n\t\t\tif (to === undefined)\r\n\t\t\t\tto = sizes.length - 1;\r\n\t\t\tif (from === undefined)\r\n\t\t\t\tfrom = 0;\r\n\r\n\t\t\tvar summ = 0;\r\n\t\t\tfor (var i = from; i <= to; i++)\r\n\t\t\t\tsumm += sizes[i];\r\n\r\n\t\t\treturn summ;\r\n\t\t},\r\n\t\tsetSumWidth: function (sum_width, scale, from, to) {\r\n\t\t\tvar parts = scale.width;\r\n\r\n\t\t\tif (to === undefined)\r\n\t\t\t\tto = parts.length - 1;\r\n\t\t\tif (from === undefined)\r\n\t\t\t\tfrom = 0;\r\n\t\t\tvar length = to - from + 1;\r\n\r\n\t\t\tif (from > parts.length - 1 || length <= 0 || to > parts.length - 1)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tvar oldWidth = this.getSum(parts, from, to);\r\n\r\n\t\t\tvar diff = sum_width - oldWidth;\r\n\r\n\t\t\tthis.adjustSize(diff, parts, from, to);\r\n\t\t\tthis.adjustSize(-diff, parts, to + 1);\r\n\r\n\t\t\tscale.full_width = this.getSum(parts);\r\n\t\t},\r\n\t\tsplitSize: function (width, count) {\r\n\t\t\tvar arr = [];\r\n\t\t\tfor (var i = 0; i < count; i++) arr[i] = 0;\r\n\r\n\t\t\tthis.adjustSize(width, arr);\r\n\t\t\treturn arr;\r\n\r\n\t\t},\r\n\t\tadjustSize: function (width, parts, from, to) {\r\n\t\t\tif (!from)\r\n\t\t\t\tfrom = 0;\r\n\t\t\tif (to === undefined)\r\n\t\t\t\tto = parts.length - 1;\r\n\r\n\t\t\tvar length = to - from + 1;\r\n\r\n\t\t\tvar full = this.getSum(parts, from, to);\r\n\r\n\t\t\tfor (var i = from; i <= to; i++) {\r\n\t\t\t\tvar share = Math.floor(width * (full ? (parts[i] / full) : (1 / length)));\r\n\r\n\t\t\t\tfull -= parts[i];\r\n\t\t\t\twidth -= share;\r\n\t\t\t\tlength--;\r\n\r\n\t\t\t\tparts[i] += share;\r\n\t\t\t}\r\n\t\t\tparts[parts.length - 1] += width;\r\n\t\t},\r\n\t\tsortScales: function (scales) {\r\n\t\t\tfunction cellSize(unit, step) {\r\n\t\t\t\tvar d = new Date(1970, 0, 1);\r\n\t\t\t\treturn dateHelper.add(d, step, unit) - d;\r\n\t\t\t}\r\n\r\n\t\t\tscales.sort(function (a, b) {\r\n\t\t\t\tif (cellSize(a.unit, a.step) < cellSize(b.unit, b.step)) {\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t} else if (cellSize(a.unit, a.step) > cellSize(b.unit, b.step)) {\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tfor (var i = 0; i < scales.length; i++) {\r\n\t\t\t\tscales[i].index = i;\r\n\t\t\t}\r\n\t\t},\r\n\t\t_isLegacyMode: function(config){\r\n\t\t\tvar scaleConfig = config || gantt.config;\r\n\t\t\treturn scaleConfig.scale_unit || scaleConfig.date_scale || scaleConfig.subscales;\r\n\t\t},\r\n\t\t_prepareScaleObject: function(scale){\r\n\t\t\tvar format = scale.format;\r\n\t\t\tif(!format){\r\n\t\t\t\tformat = scale.template || scale.date || \"%d %M\";\r\n\t\t\t}\r\n\r\n\t\t\tif(typeof format === \"string\"){\r\n\t\t\t\tformat = gantt.date.date_to_str(format);\r\n\t\t\t}\r\n\t\t\treturn {\r\n\t\t\t\tunit: scale.unit || \"day\",\r\n\t\t\t\tstep: scale.step || 1,\r\n\t\t\t\tformat: format,\r\n\t\t\t\tcss: scale.css\r\n\t\t\t};\r\n\t\t},\r\n\t\tprimaryScale: function(config) {\r\n\t\t\tvar templates = services.getService(\"templateLoader\");\r\n\t\t\tvar legacyMode = this._isLegacyMode(config);\r\n\r\n\t\t\tvar scaleConfig = config || gantt.config;\r\n\r\n\t\t\tvar result;\r\n\t\t\tif(legacyMode){\r\n\t\t\t\ttemplates.initTemplate(\"date_scale\", undefined, undefined, scaleConfig, gantt.config.templates);\r\n\t\t\t\tresult = {\r\n\t\t\t\t\tunit: gantt.config.scale_unit,\r\n\t\t\t\t\tstep: gantt.config.step,\r\n\t\t\t\t\ttemplate: gantt.templates.date_scale,\r\n\t\t\t\t\tdate: gantt.config.date_scale,\r\n\t\t\t\t\tcss: gantt.templates.scale_cell_class\r\n\t\t\t\t};\r\n\t\t\t}else{\r\n\t\t\t\tvar primaryScale = scaleConfig.scales[0];\r\n\t\t\t\tresult = {\r\n\t\t\t\t\tunit: primaryScale.unit,\r\n\t\t\t\t\tstep: primaryScale.step,\r\n\t\t\t\t\ttemplate: primaryScale.template,\r\n\t\t\t\t\tformat: primaryScale.format,\r\n\t\t\t\t\tdate: primaryScale.date,\r\n\t\t\t\t\tcss: primaryScale.css || gantt.templates.scale_cell_class\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\treturn this._prepareScaleObject(result);\r\n\t\t},\r\n\t\tgetSubScales: function(config) {\r\n\t\t\tvar legacyMode = this._isLegacyMode(config);\r\n\t\t\tvar scaleConfig = config || gantt.config;\r\n\t\t\tvar scales;\r\n\t\t\tif(legacyMode){\r\n\t\t\t\tscales = scaleConfig.subscales || [];\r\n\t\t\t}else{\r\n\t\t\t\tscales = scaleConfig.scales.slice(1);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn scales.map(function(scale){\r\n\t\t\t\treturn this._prepareScaleObject(scale);\r\n\t\t\t}.bind(this));\r\n\t\t},\r\n\r\n\t\tprepareConfigs: function (scales, min_coll_width, container_width, scale_height, minDate, maxDate, rtl) {\r\n\t\t\tvar heights = this.splitSize(scale_height, scales.length);\r\n\t\t\tvar full_width = container_width;\r\n\r\n\t\t\tvar configs = [];\r\n\t\t\tfor (var i = scales.length - 1; i >= 0; i--) {\r\n\t\t\t\tvar main_scale = (i == scales.length - 1);\r\n\t\t\t\tvar cfg = this.initScaleConfig(scales[i], minDate, maxDate);\r\n\t\t\t\tif (main_scale) {\r\n\t\t\t\t\tthis.processIgnores(cfg);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.initColSizes(cfg, min_coll_width, full_width, heights[i]);\r\n\t\t\t\tthis.limitVisibleRange(cfg);\r\n\r\n\t\t\t\tif (main_scale) {\r\n\t\t\t\t\tfull_width = cfg.full_width;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconfigs.unshift(cfg);\r\n\t\t\t}\r\n\r\n\r\n\t\t\tfor (var i = 0; i < configs.length - 1; i++) {\r\n\t\t\t\tthis.alineScaleColumns(configs[configs.length - 1], configs[i]);\r\n\t\t\t}\r\n\t\t\tfor (var i = 0; i < configs.length; i++) {\r\n\r\n\t\t\t\tif(rtl){\r\n\t\t\t\t\tthis.reverseScale(configs[i]);\r\n\t\t\t\t}\r\n\t\t\t\tthis.setPosSettings(configs[i]);\r\n\t\t\t}\r\n\t\t\treturn configs;\r\n\r\n\t\t},\r\n\r\n\t\treverseScale: function(scale){\r\n\t\t\tscale.width = scale.width.reverse();\r\n\t\t\tscale.trace_x = scale.trace_x.reverse();\r\n\r\n\t\t\tvar indexes = scale.trace_indexes;\r\n\t\t\tscale.trace_indexes = {};\r\n\t\t\tscale.trace_index_transition = {};\r\n\t\t\tscale.rtl = true;\r\n\t\t\tfor(var i = 0; i < scale.trace_x.length; i++){\r\n\t\t\t\tscale.trace_indexes[scale.trace_x[i].valueOf()] = i;\r\n\t\t\t\tscale.trace_index_transition[indexes[scale.trace_x[i].valueOf()]] = i;\r\n\t\t\t}\r\n\t\t\treturn scale;\r\n\t\t},\r\n\r\n\t\tsetPosSettings: function (config) {\r\n\t\t\tfor (var i = 0, len = config.trace_x.length; i < len; i++) {\r\n\t\t\t\tconfig.left.push((config.width[i - 1] || 0) + (config.left[i - 1] || 0));\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t_ignore_time_config: function (date, scale) {\r\n\r\n\t\t\tif (gantt.config.skip_off_time) {\r\n\t\t\t\tvar skip = true;\r\n\t\t\t\tvar probe = date;\r\n\r\n\t\t\t\t// check dates in case custom scale unit, e.g. {unit: \"month\", step: 3}\r\n\t\t\t\tfor (var i = 0; i < scale.step; i++) {\r\n\t\t\t\t\tif (i) {\r\n\t\t\t\t\t\tprobe = dateHelper.add(date, i, scale.unit);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tskip = skip && !this.isWorkTime(probe, scale.unit);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn skip;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t},\r\n\t\t//defined in an extension\r\n\t\tprocessIgnores: function (config) {\r\n\t\t\tconfig.ignore_x = {};\r\n\t\t\tconfig.display_count = config.count;\r\n\t\t},\r\n\t\tinitColSizes: function (config, min_col_width, full_width, line_height) {\r\n\t\t\tvar cont_width = full_width;\r\n\r\n\t\t\tconfig.height = line_height;\r\n\r\n\t\t\tvar column_count = config.display_count === undefined ? config.count : config.display_count;\r\n\r\n\t\t\tif (!column_count)\r\n\t\t\t\tcolumn_count = 1;\r\n\r\n\t\t\tconfig.col_width = Math.floor(cont_width / column_count);\r\n\r\n\t\t\tif (min_col_width) {\r\n\t\t\t\tif (config.col_width < min_col_width) {\r\n\t\t\t\t\tconfig.col_width = min_col_width;\r\n\t\t\t\t\tcont_width = config.col_width * column_count;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tconfig.width = [];\r\n\t\t\tvar ignores = config.ignore_x || {};\r\n\t\t\tfor (var i = 0; i < config.trace_x.length; i++) {\r\n\t\t\t\tif (ignores[config.trace_x[i].valueOf()] || (config.display_count == config.count)) {\r\n\t\t\t\t\tconfig.width[i] = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// width of month columns should be proportional month duration\r\n\t\t\t\t\tvar width = 1;\r\n\t\t\t\t\tif (config.unit == \"month\") {\r\n\t\t\t\t\t\tvar days = Math.round((dateHelper.add(config.trace_x[i], config.step, config.unit) - config.trace_x[i]) / (1000 * 60 * 60 * 24));\r\n\t\t\t\t\t\twidth = days;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconfig.width[i] = width;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.adjustSize(cont_width - this.getSum(config.width)/* 1 width per column from the code above */, config.width);\r\n\t\t\tconfig.full_width = this.getSum(config.width);\r\n\t\t},\r\n\t\tinitScaleConfig: function (config, min_date, max_date) {\r\n\t\t\tvar cfg = utils.mixin({\r\n\t\t\t\tcount: 0,\r\n\t\t\t\tcol_width: 0,\r\n\t\t\t\tfull_width: 0,\r\n\t\t\t\theight: 0,\r\n\t\t\t\twidth: [],\r\n\t\t\t\tleft: [],\r\n\t\t\t\ttrace_x: [],\r\n\t\t\t\ttrace_indexes: {},\r\n\t\t\t\tmin_date: new Date(min_date),\r\n\t\t\t\tmax_date: new Date(max_date)\r\n\t\t\t}, config);\r\n\r\n\t\t\tthis.eachColumn(config.unit, config.step, min_date, max_date, function (date) {\r\n\t\t\t\tcfg.count++;\r\n\t\t\t\tcfg.trace_x.push(new Date(date));\r\n\t\t\t\tcfg.trace_indexes[date.valueOf()] = cfg.trace_x.length - 1;\r\n\t\t\t});\r\n\r\n\t\t\tcfg.trace_x_ascending = cfg.trace_x.slice();\r\n\t\t\treturn cfg;\r\n\t\t},\r\n\t\titerateScales: function (lower_scale, upper_scale, from, to, callback) {\r\n\t\t\tvar upper_dates = upper_scale.trace_x;\r\n\t\t\tvar lower_dates = lower_scale.trace_x;\r\n\r\n\t\t\tvar prev = from || 0;\r\n\t\t\tvar end = to || (lower_dates.length - 1);\r\n\t\t\tvar prevUpper = 0;\r\n\r\n\r\n\t\t\tfor (var up = 1; up < upper_dates.length; up++) {\r\n\t\t\t\tvar target_index = (lower_scale.trace_indexes[+upper_dates[up]]);\r\n\t\t\t\tif (target_index !== undefined && target_index <= end) {\r\n\t\t\t\t\tif (callback) {\r\n\t\t\t\t\t\tcallback.apply(this, [prevUpper, up, prev, target_index]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tprev = target_index;\r\n\t\t\t\t\tprevUpper = up;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\talineScaleColumns: function (lower_scale, upper_scale, from, to) {\r\n\t\t\tthis.iterateScales(lower_scale, upper_scale, from, to, function (upper_start, upper_end, lower_start, lower_end) {\r\n\t\t\t\tvar targetWidth = this.getSum(lower_scale.width, lower_start, lower_end - 1);\r\n\t\t\t\tvar actualWidth = this.getSum(upper_scale.width, upper_start, upper_end - 1);\r\n\t\t\t\tif (actualWidth != targetWidth) {\r\n\t\t\t\t\tthis.setSumWidth(targetWidth, upper_scale, upper_start, upper_end - 1);\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\teachColumn: function (unit, step, min_date, max_date, callback) {\r\n\t\t\tvar start = new Date(min_date),\r\n\t\t\t\tend = new Date(max_date);\r\n\t\t\tif (dateHelper[unit + \"_start\"]) {\r\n\t\t\t\tstart = dateHelper[unit + \"_start\"](start);\r\n\t\t\t}\r\n\r\n\t\t\tvar curr = new Date(start);\r\n\t\t\tif (+curr >= +end) {\r\n\t\t\t\tend = dateHelper.add(curr, step, unit);\r\n\t\t\t}\r\n\t\t\twhile (+curr < +end) {\r\n\t\t\t\tcallback.call(this, new Date(curr));\r\n\t\t\t\tvar tzOffset = curr.getTimezoneOffset();\r\n\t\t\t\tcurr = dateHelper.add(curr, step, unit);\r\n\t\t\t\tcurr = gantt._correct_dst_change(curr, tzOffset, step, unit);\r\n\t\t\t\tif (dateHelper[unit + '_start'])\r\n\t\t\t\t\tcurr = dateHelper[unit + \"_start\"](curr);\r\n\t\t\t}\r\n\t\t},\r\n\t\tlimitVisibleRange: function (cfg) {\r\n\t\t\tvar dates = cfg.trace_x;\r\n\r\n\t\t\tvar left = 0, right = cfg.width.length - 1;\r\n\t\t\tvar diff = 0;\r\n\t\t\tif (+dates[0] < +cfg.min_date && left != right) {\r\n\t\t\t\tvar width = Math.floor(cfg.width[0] * ((dates[1] - cfg.min_date) / (dates[1] - dates[0])));\r\n\t\t\t\tdiff += cfg.width[0] - width;\r\n\t\t\t\tcfg.width[0] = width;\r\n\r\n\t\t\t\tdates[0] = new Date(cfg.min_date);\r\n\t\t\t}\r\n\r\n\t\t\tvar last = dates.length - 1;\r\n\t\t\tvar lastDate = dates[last];\r\n\t\t\tvar outDate = dateHelper.add(lastDate, cfg.step, cfg.unit);\r\n\t\t\tif (+outDate > +cfg.max_date && last > 0) {\r\n\t\t\t\tvar width = cfg.width[last] - Math.floor(cfg.width[last] * ((outDate - cfg.max_date) / (outDate - lastDate)));\r\n\t\t\t\tdiff += cfg.width[last] - width;\r\n\t\t\t\tcfg.width[last] = width;\r\n\t\t\t}\r\n\r\n\t\t\tif (diff) {\r\n\t\t\t\tvar full = this.getSum(cfg.width);\r\n\t\t\t\tvar shared = 0;\r\n\t\t\t\tfor (var i = 0; i < cfg.width.length; i++) {\r\n\t\t\t\t\tvar share = Math.floor(diff * (cfg.width[i] / full));\r\n\t\t\t\t\tcfg.width[i] += share;\r\n\t\t\t\t\tshared += share;\r\n\t\t\t\t}\r\n\t\t\t\tthis.adjustSize(diff - shared, cfg.width);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t};\r\n}\r\n\r\nmodule.exports = ScaleHelper;\r\n","var helpers = require(\"../../../utils/helpers\");\r\n\r\nvar htmlHelpers = {\r\n\tgetHtmlSelect: function(options, attributes, value) {\r\n\t\tvar innerHTML = \"\";\r\n\t\tvar _this = this;\r\n\r\n\t\toptions = options || [];\r\n\t\t\r\n\t\thelpers.forEach(options, function(entry) {\r\n\t\t\tvar _attributes = [{ key: \"value\", value: entry.key }];\r\n\r\n\t\t\tif (value == entry.key) {\r\n\t\t\t\t_attributes[_attributes.length] = { key: \"selected\", value: \"selected\" };\r\n\t\t\t}\r\n\t\t\tif (entry.attributes) {\r\n\t\t\t\t_attributes = _attributes.concat(entry.attributes);\r\n\t\t\t}\r\n\t\t\tinnerHTML += _this.getHtmlOption({ innerHTML: entry.label }, _attributes);\r\n\t\t});\r\n\r\n\t\treturn _getHtmlContainer(\"select\", { innerHTML: innerHTML }, attributes);\r\n\t},\r\n\tgetHtmlOption: function(options, attributes) { return _getHtmlContainer(\"option\", options, attributes); },\r\n\tgetHtmlButton: function(options, attributes) { return _getHtmlContainer(\"button\", options, attributes); },\r\n\tgetHtmlDiv: function(options, attributes) { return _getHtmlContainer(\"div\", options, attributes); },\r\n\tgetHtmlLabel: function(options, attributes) { return _getHtmlContainer(\"label\", options, attributes); },\r\n\tgetHtmlInput: function(attributes) {\r\n\t\treturn \"\";\r\n\t}\r\n};\r\n\r\nfunction _getHtmlContainer(tag, options, attributes) {\r\n\tvar html;\r\n\r\n\toptions = options || [];\r\n\t\r\n\thtml = \"<\" + tag + _getHtmlAttributes(attributes || []) + \">\" + (options.innerHTML || \"\") + \"\";\r\n\treturn html;\r\n\r\n}\r\n\r\nfunction _getHtmlAttributes(attributes) {\r\n\tvar html = \"\";\r\n\r\n\thelpers.forEach(attributes, function(entry) {\r\n\t\thtml += \" \" + entry.key + \"='\" + entry.value + \"'\";\r\n\t});\r\n\treturn html;\r\n}\r\n\r\nmodule.exports = htmlHelpers;","module.exports = function createResourceTimelineBuilder(gantt){\r\n\r\n\tvar resourceTaskCache = {};\r\n\r\n\tgantt.$data.tasksStore.attachEvent(\"onStoreUpdated\", function(){\r\n\t\tresourceTaskCache = {};\r\n\t});\r\n\r\n\tfunction getResourceLoad(resource, resourceProperty, scale, timeline){\r\n\t\tvar cacheKey = resource.id + \"_\" + resourceProperty + \"_\" + scale.unit + \"_\" + scale.step;\r\n\t\tvar res;\r\n\t\tif (!resourceTaskCache[cacheKey]) {\r\n\t\t\tres = resourceTaskCache[cacheKey] = calculateResourceLoad(resource, resourceProperty, scale, timeline);\r\n\r\n\t\t} else {\r\n\t\t\tres = resourceTaskCache[cacheKey];\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\r\n\tfunction calculateResourceLoad(resource, resourceProperty, scale, timeline) {\r\n\r\n\t\tvar tasks;\r\n\t\tif(resource.$role == \"task\"){\r\n\t\t\ttasks = [];\r\n\t\t}else{\r\n\t\t\ttasks = gantt.getTaskBy(resourceProperty, resource.id);\r\n\t\t}\r\n\t\tvar scaleUnit = scale.unit;\r\n\t\tvar scaleStep = scale.step;\r\n\t\tvar timegrid = {};\r\n\r\n\t\tfor (var i = 0; i < tasks.length; i++) {\r\n\t\t\tvar task = tasks[i];\r\n\r\n\t\t\tvar currDate = gantt.date[scaleUnit + \"_start\"](new Date(task.start_date));\r\n\r\n\t\t\twhile (currDate < task.end_date) {\r\n\r\n\t\t\t\tvar date = currDate;\r\n\t\t\t\tcurrDate = gantt.date.add(currDate, scaleStep, scaleUnit);\r\n\r\n\t\t\t\tif (!gantt.isWorkTime({date: date, task: task, unit: scaleUnit})) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar timestamp = date.valueOf();\r\n\t\t\t\tif (!timegrid[timestamp]){\r\n\t\t\t\t\ttimegrid[timestamp] = [];\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttimegrid[timestamp].push(task);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar timetable = [];\r\n\t\tvar start, end, tasks;\r\n\t\tvar config = timeline.$getConfig();\r\n\r\n\t\tfor(var i = 0; i < scale.trace_x.length; i++){\r\n\t\t\tstart = new Date(scale.trace_x[i]);\r\n\t\t\tend = gantt.date.add(start, scaleStep, scaleUnit);\r\n\t\t\ttasks = timegrid[start.valueOf()] || [];\r\n\t\t\tif(tasks.length || config.resource_render_empty_cells){\r\n\t\t\t\ttimetable.push({\r\n\t\t\t\t\tstart_date: start,\r\n\t\t\t\t\tend_date: end,\r\n\t\t\t\t\ttasks: tasks\r\n\t\t\t\t});\r\n\t\t\t}else{\r\n\t\t\t\ttimetable.push(null);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn timetable;\r\n\t}\r\n\r\n\r\n\r\n\treturn getResourceLoad;\r\n};","function createTaskRenderer(gantt) {\r\n\r\n\tfunction _render_task_element(task, view) {\r\n\t\tvar config = view.$getConfig();\r\n\t\tvar painters = config.type_renderers;\r\n\t\tvar renderer = painters[gantt.getTaskType(task.type)],\r\n\t\t\tdefaultRenderer = _task_default_render;\r\n\r\n\t\tif (!renderer) {\r\n\t\t\treturn defaultRenderer.call(gantt, task, view);\r\n\t\t}else{\r\n\t\t\treturn renderer.call(gantt, task, function(task){ return defaultRenderer.call(gantt, task, view);}, view);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction _task_default_render(task, view) {\r\n\t\tif (gantt._isAllowedUnscheduledTask(task))\r\n\t\t\treturn;\r\n\r\n\t\tif (!gantt._isTaskInTimelineLimits(task)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar pos = view.getItemPosition(task);\r\n\r\n\t\tvar cfg = view.$getConfig(),\r\n\t\t\ttemplates = view.$getTemplates();\r\n\t\tvar height = view.getItemHeight();\r\n\r\n\t\tvar taskType = gantt.getTaskType(task.type);\r\n\r\n\t\tvar padd = Math.floor((gantt.config.row_height - height) / 2);\r\n\t\tif (taskType == cfg.types.milestone && cfg.link_line_width > 1) {\r\n\t\t\t//little adjust milestone position, so horisontal corners would match link arrow when thickness of link line is more than 1px\r\n\t\t\tpadd += 1;\r\n\t\t}\r\n\r\n\t\tif (taskType == cfg.types.milestone) {\r\n\t\t\tpos.left -= Math.round(height / 2);\r\n\t\t\tpos.width = height;\r\n\t\t}\r\n\r\n\t\tvar div = document.createElement(\"div\");\r\n\r\n\t\tvar width = Math.round(pos.width);\r\n\r\n\t\tif(view.$config.item_attribute) {\r\n\t\t\tdiv.setAttribute(view.$config.item_attribute, task.id);\r\n\t\t\tdiv.setAttribute(view.$config.bind + \"_id\", task.id); // 'task_id'/'resource_id' for backward compatibility\r\n\t\t}\r\n\r\n\t\tif (cfg.show_progress && taskType != cfg.types.milestone) {\r\n\t\t\t_render_task_progress(task, div, width, cfg, templates);\r\n\t\t}\r\n\r\n\t\t//use separate div to display content above progress bar\r\n\t\tvar content = _render_task_content(task, width, templates);\r\n\t\tif (task.textColor) {\r\n\t\t\tcontent.style.color = task.textColor;\r\n\t\t}\r\n\t\tdiv.appendChild(content);\r\n\r\n\t\tvar css = _combine_item_class(\"gantt_task_line\",\r\n\t\t\ttemplates.task_class(task.start_date, task.end_date, task),\r\n\t\t\ttask.id,\r\n\t\t\tview);\r\n\t\tif (task.color || task.progressColor || task.textColor) {\r\n\t\t\tcss += \" gantt_task_inline_color\";\r\n\t\t}\r\n\t\tdiv.className = css;\r\n\r\n\t\tvar styles = [\r\n\t\t\t\"left:\" + pos.left + \"px\",\r\n\t\t\t\"top:\" + (padd + pos.top) + 'px',\r\n\t\t\t\"height:\" + height + 'px',\r\n\t\t\t\"line-height:\" + (Math.max(height < 30 ? height - 2 : height, 0)) + 'px',\r\n\t\t\t\"width:\" + width + 'px'\r\n\t\t];\r\n\t\tif (task.color) {\r\n\t\t\tstyles.push(\"background-color:\" + task.color);\r\n\t\t}\r\n\t\tif (task.textColor) {\r\n\t\t\tstyles.push(\"color:\" + task.textColor);\r\n\t\t}\r\n\r\n\t\tdiv.style.cssText = styles.join(\";\");\r\n\t\tvar side = _render_leftside_content(task, cfg, templates);\r\n\t\tif (side) div.appendChild(side);\r\n\r\n\t\tside = _render_rightside_content(task, cfg, templates);\r\n\t\tif (side) div.appendChild(side);\r\n\r\n\t\tgantt._waiAria.setTaskBarAttr(task, div);\r\n\r\n\t\tvar state = gantt.getState();\r\n\r\n\t\tif (!gantt.isReadonly(task)) {\r\n\t\t\tif (cfg.drag_resize && !gantt.isSummaryTask(task) && taskType != cfg.types.milestone) {\r\n\t\t\t\t_render_pair(div, \"gantt_task_drag\", task, function (css) {\r\n\t\t\t\t\tvar el = document.createElement(\"div\");\r\n\t\t\t\t\tel.className = css;\r\n\t\t\t\t\treturn el;\r\n\t\t\t\t}, cfg);\r\n\t\t\t}\r\n\t\t\tif (cfg.drag_links && cfg.show_links) {\r\n\t\t\t\t_render_pair(div, \"gantt_link_control\", task, function (css) {\r\n\t\t\t\t\tvar outer = document.createElement(\"div\");\r\n\t\t\t\t\touter.className = css;\r\n\t\t\t\t\touter.style.cssText = [\r\n\t\t\t\t\t\t\"height:\" + height + 'px',\r\n\t\t\t\t\t\t\"line-height:\" + height + 'px'\r\n\t\t\t\t\t].join(\";\");\r\n\t\t\t\t\tvar inner = document.createElement(\"div\");\r\n\t\t\t\t\tinner.className = \"gantt_link_point\";\r\n\r\n\t\t\t\t\tvar showLinkPoints = false;\r\n\t\t\t\t\tif(state.link_source_id && cfg.touch){\r\n\t\t\t\t\t\tshowLinkPoints = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tinner.style.display = showLinkPoints ? \"block\" : \"\";\r\n\t\t\t\t\touter.appendChild(inner);\r\n\t\t\t\t\treturn outer;\r\n\t\t\t\t}, cfg);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn div;\r\n\t}\r\n\r\n\tfunction _render_side_content(task, template, cssClass) {\r\n\t\tif (!template) return null;\r\n\r\n\t\tvar text = template(task.start_date, task.end_date, task);\r\n\t\tif (!text) return null;\r\n\t\tvar content = document.createElement(\"div\");\r\n\t\tcontent.className = \"gantt_side_content \" + cssClass;\r\n\t\tcontent.innerHTML = text;\r\n\t\treturn content;\r\n\t}\r\n\r\n\tfunction _render_leftside_content(task, cfg, templates) {\r\n\t\tvar css = \"gantt_left \" + _get_link_crossing_css(!cfg.rtl ? true : false, task, cfg);\r\n\t\treturn _render_side_content(task, templates.leftside_text, css);\r\n\t}\r\n\r\n\tfunction _render_rightside_content(task, cfg, templates) {\r\n\t\tvar css = \"gantt_right \" + _get_link_crossing_css(!cfg.rtl ? false : true, task, cfg);\r\n\t\treturn _render_side_content(task, templates.rightside_text, css);\r\n\t}\r\n\r\n\tfunction _get_link_crossing_css(left, task) {\r\n\t\tvar cond = _get_conditions(left);\r\n\r\n\t\tfor (var i in cond) {\r\n\t\t\tvar links = task[i];\r\n\t\t\tfor (var ln = 0; ln < links.length; ln++) {\r\n\t\t\t\tvar link = gantt.getLink(links[ln]);\r\n\r\n\t\t\t\tfor (var tp = 0; tp < cond[i].length; tp++) {\r\n\t\t\t\t\tif (link.type == cond[i][tp]) {\r\n\t\t\t\t\t\treturn \"gantt_link_crossing\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\r\n\tfunction _render_task_content(task, width, templates) {\r\n\t\tvar content = document.createElement(\"div\");\r\n\t\tif (gantt.getTaskType(task.type) != gantt.config.types.milestone)\r\n\t\t\tcontent.innerHTML = templates.task_text(task.start_date, task.end_date, task);\r\n\t\tcontent.className = \"gantt_task_content\";\r\n\t\t//content.style.width = width + 'px';\r\n\t\treturn content;\r\n\t}\r\n\r\n\tfunction _render_task_progress(task, element, maxWidth, cfg, templates) {\r\n\t\tvar done = task.progress * 1 || 0;\r\n\r\n\t\tmaxWidth = Math.max(maxWidth - 2, 0);//2px for borders\r\n\t\tvar pr = document.createElement(\"div\");\r\n\t\tvar width = Math.round(maxWidth * done);\r\n\r\n\t\twidth = Math.min(maxWidth, width);\r\n\t\tif (task.progressColor) {\r\n\t\t\tpr.style.backgroundColor = task.progressColor;\r\n\t\t\tpr.style.opacity = 1;\r\n\t\t}\r\n\t\tpr.style.width = width + 'px';\r\n\t\tpr.className = \"gantt_task_progress\";\r\n\t\tpr.innerHTML = templates.progress_text(task.start_date, task.end_date, task);\r\n\r\n\t\tif(cfg.rtl){\r\n\t\t\tpr.style.position = \"absolute\";\r\n\t\t\tpr.style.right = \"0px\";\r\n\t\t}\r\n\r\n\t\tvar wrapper = document.createElement(\"div\");\r\n\t\twrapper.className = \"gantt_task_progress_wrapper\";\r\n\t\twrapper.appendChild(pr);\r\n\t\telement.appendChild(wrapper);\r\n\r\n\t\tif (gantt.config.drag_progress && !gantt.isReadonly(task)) {\r\n\t\t\tvar drag = document.createElement(\"div\");\r\n\r\n\t\t\tvar markerPos = width;\r\n\t\t\tif(cfg.rtl){\r\n\t\t\t\tmarkerPos = maxWidth - width;\r\n\t\t\t}\r\n\r\n\t\t\tdrag.style.left = markerPos + 'px';\r\n\t\t\tdrag.className = \"gantt_task_progress_drag\";\r\n\t\t\tpr.appendChild(drag);\r\n\t\t\telement.appendChild(drag);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction _get_conditions(leftside) {\r\n\t\tif (leftside) {\r\n\t\t\treturn {\r\n\t\t\t\t$source: [\r\n\t\t\t\t\tgantt.config.links.start_to_start\r\n\t\t\t\t],\r\n\t\t\t\t$target: [\r\n\t\t\t\t\tgantt.config.links.start_to_start,\r\n\t\t\t\t\tgantt.config.links.finish_to_start\r\n\t\t\t\t]\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\treturn {\r\n\t\t\t\t$source: [\r\n\t\t\t\t\tgantt.config.links.finish_to_start,\r\n\t\t\t\t\tgantt.config.links.finish_to_finish\r\n\t\t\t\t],\r\n\t\t\t\t$target: [\r\n\t\t\t\t\tgantt.config.links.finish_to_finish\r\n\t\t\t\t]\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n\r\n\tfunction _combine_item_class(basic, template, itemId, view) {\r\n\t\tvar cfg = view.$getConfig();\r\n\t\tvar css = [basic];\r\n\t\tif (template)\r\n\t\t\tcss.push(template);\r\n\r\n\t\tvar state = gantt.getState();\r\n\r\n\t\tvar task = gantt.getTask(itemId);\r\n\r\n\t\tif (gantt.getTaskType(task.type) == cfg.types.milestone) {\r\n\t\t\tcss.push(\"gantt_milestone\");\r\n\t\t}else if (gantt.getTaskType(task.type) == cfg.types.project) {\r\n\t\t\tcss.push(\"gantt_project\");\r\n\t\t}\r\n\r\n\t\tcss.push(\"gantt_bar_\" + gantt.getTaskType(task.type));\r\n\r\n\r\n\t\tif (gantt.isSummaryTask(task))\r\n\t\t\tcss.push(\"gantt_dependent_task\");\r\n\r\n\t\tif (gantt.isSplitTask(task) && ((cfg.open_split_tasks && !task.$open) || !cfg.open_split_tasks)) {\r\n\t\t\tcss.push(\"gantt_split_parent\");\r\n\t\t}\r\n\r\n\t\tif (cfg.select_task && gantt.isSelectedTask(itemId)) {\r\n\t\t\tcss.push(\"gantt_selected\");\r\n\t\t}\r\n\r\n\t\tif (itemId == state.drag_id) {\r\n\t\t\tcss.push(\"gantt_drag_\" + state.drag_mode);\r\n\t\t\tif (state.touch_drag) {\r\n\t\t\t\tcss.push(\"gantt_touch_\" + state.drag_mode);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (state.link_source_id == itemId)\r\n\t\t\tcss.push(\"gantt_link_source\");\r\n\r\n\t\tif (state.link_target_id == itemId)\r\n\t\t\tcss.push(\"gantt_link_target\");\r\n\r\n\r\n\t\tif (cfg.highlight_critical_path && gantt.isCriticalTask) {\r\n\t\t\tif (gantt.isCriticalTask(task))\r\n\t\t\t\tcss.push(\"gantt_critical_task\");\r\n\t\t}\r\n\r\n\t\tif (state.link_landing_area &&\r\n\t\t\t(state.link_target_id && state.link_source_id) &&\r\n\t\t\t(state.link_target_id != state.link_source_id)) {\r\n\r\n\t\t\tvar from_id = state.link_source_id;\r\n\t\t\tvar from_start = state.link_from_start;\r\n\t\t\tvar to_start = state.link_to_start;\r\n\r\n\t\t\tvar allowDrag = gantt.isLinkAllowed(from_id, itemId, from_start, to_start);\r\n\r\n\t\t\tvar dragClass = \"\";\r\n\t\t\tif (allowDrag) {\r\n\t\t\t\tif (to_start)\r\n\t\t\t\t\tdragClass = \"link_start_allow\";\r\n\t\t\t\telse\r\n\t\t\t\t\tdragClass = \"link_finish_allow\";\r\n\t\t\t} else {\r\n\t\t\t\tif (to_start)\r\n\t\t\t\t\tdragClass = \"link_start_deny\";\r\n\t\t\t\telse\r\n\t\t\t\t\tdragClass = \"link_finish_deny\";\r\n\t\t\t}\r\n\t\t\tcss.push(dragClass);\r\n\t\t}\r\n\t\treturn css.join(\" \");\r\n\t}\r\n\r\n\tfunction _render_pair(parent, css, task, content, config) {\r\n\t\tvar state = gantt.getState();\r\n\t\tvar className, element;\r\n\t\tif (+task.start_date >= +state.min_date) {\r\n\t\t\tclassName = [css, config.rtl ? \"task_right\" : \"task_left\", \"task_start_date\"];\r\n\t\t\telement = content(className.join(\" \"));\r\n\t\t\telement.setAttribute(\"data-bind-property\", \"start_date\");\r\n\t\t\tparent.appendChild(element);\r\n\t\t}\r\n\r\n\t\tif (+task.end_date <= +state.max_date){\r\n\t\t\tclassName = [css, config.rtl ? \"task_left\" : \"task_right\", \"task_end_date\"];\r\n\t\t\telement = content(className.join(\" \"));\r\n\t\t\telement.setAttribute(\"data-bind-property\", \"end_date\");\r\n\t\t\tparent.appendChild(element);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn _render_task_element;\r\n}\r\n\r\nmodule.exports = createTaskRenderer;","// optimized checker for task bars smart rendering\r\n\r\n// first check the vertical position since it's easier to calculate\r\nmodule.exports = function isBarInViewport(item, viewport, view, gantt){\r\n\tif(!item.start_date || !item.end_date){\r\n\t\treturn null;\r\n\t}\r\n\r\n\tvar config = view.$getConfig();\r\n\tvar top = view.getItemTop(item.id);\r\n\tvar height = config.row_height;\r\n\r\n\tif(top > viewport.y_end || top + height < viewport.y){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tvar padding = 200;\r\n\tvar startCoord = view.posFromDate(item.start_date);\r\n\tvar endCoord = view.posFromDate(item.end_date);\r\n\tvar left = Math.min(startCoord, endCoord) - padding;\r\n\tvar right = Math.max(startCoord, endCoord) + padding;\r\n\r\n\tif(left > viewport.x_end || right < viewport.x){\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n};","var __extends = require(\"../../../utils/extends\"),\r\n\tdomHelpers = require(\"../utils/dom_helpers\"),\r\n\tCell = require(\"./cell\");\r\n\r\nvar Layout = (function (_super) {\r\n\t\"use strict\";\r\n\r\n\t__extends(Layout, _super);\r\n\tfunction Layout(parent, config, factory) {\r\n\t\tvar _this = _super.apply(this, arguments) || this;\r\n\r\n\t\tif(parent)\r\n\t\t\t_this.$root = true;\r\n\r\n\t\t_this._parseConfig(config);\r\n\t\t_this.$name = \"layout\";\r\n\t\treturn _this;\r\n\t}\r\n\r\n\tLayout.prototype.destructor = function () {\r\n\t\tif (this.$container && this.$view) {\r\n\t\t\tdomHelpers.removeNode(this.$view);\r\n\t\t}\r\n\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\tvar child = this.$cells[i];\r\n\t\t\tchild.destructor();\r\n\t\t}\r\n\t\tthis.$cells = [];\r\n\r\n\t\t_super.prototype.destructor.call(this);\r\n\t};\r\n\r\n\tLayout.prototype._resizeScrollbars = function(autosize, scrollbars){\r\n\t\tvar scrollChanged = false;\r\n\t\tvar visibleScrollbars = [],\r\n\t\t\thiddenSrollbars = [];\r\n\r\n\t\tfunction showScrollbar(scrollbar){\r\n\t\t\tscrollbar.$parent.show();\r\n\t\t\tscrollChanged = true;\r\n\t\t\tvisibleScrollbars.push(scrollbar);\r\n\t\t}\r\n\t\tfunction hideScrollbar(scrollbar){\r\n\t\t\tscrollbar.$parent.hide();\r\n\t\t\tscrollChanged = true;\r\n\t\t\thiddenSrollbars.push(scrollbar);\r\n\t\t}\r\n\r\n\t\tvar scrollbar;\r\n\t\tfor(var i = 0; i < scrollbars.length; i++){\r\n\t\t\tscrollbar = scrollbars[i];\r\n\r\n\t\t\tif(autosize[scrollbar.$config.scroll]) {\r\n\t\t\t\thideScrollbar(scrollbar);\r\n\t\t\t}else if(scrollbar.shouldHide()){\r\n\t\t\t\thideScrollbar(scrollbar);\r\n\t\t\t}else if(scrollbar.shouldShow()){\r\n\t\t\t\tshowScrollbar(scrollbar);\r\n\t\t\t}else{\r\n\t\t\t\tif(scrollbar.isVisible()){\r\n\t\t\t\t\tvisibleScrollbars.push(scrollbar);\r\n\t\t\t\t}else{\r\n\t\t\t\t\thiddenSrollbars.push(scrollbar);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar visibleGroups = {};\r\n\t\tfor(var i = 0; i < visibleScrollbars.length; i++){\r\n\t\t\tif(visibleScrollbars[i].$config.group){\r\n\t\t\t\tvisibleGroups[visibleScrollbars[i].$config.group] = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(var i = 0; i < hiddenSrollbars.length; i++){\r\n\t\t\tscrollbar = hiddenSrollbars[i];\r\n\r\n\t\t\tif(scrollbar.$config.group && visibleGroups[scrollbar.$config.group]){\r\n\t\t\t\tshowScrollbar(scrollbar);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn scrollChanged;\r\n\t};\r\n\r\n\tLayout.prototype._syncCellSizes = function(groupName, newSize){\r\n\t\tif(!groupName)\r\n\t\t\treturn;\r\n\r\n\t\tvar groups = {};\r\n\r\n\t\tthis._eachChild(function(cell){\r\n\t\t\tif(cell.$config.group && cell.$name != \"scrollbar\" && cell.$name != \"resizer\"){\r\n\t\t\t\tif(!groups[cell.$config.group]){\r\n\t\t\t\t\tgroups[cell.$config.group] = [];\r\n\t\t\t\t}\r\n\t\t\t\tgroups[cell.$config.group].push(cell);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif(groups[groupName]){\r\n\t\t\tthis._syncGroupSize(groups[groupName], newSize);\r\n\t\t}\r\n\t\treturn groups[groupName];\r\n\t};\r\n\r\n\tLayout.prototype._syncGroupSize = function(cells, newSize){\r\n\t\tif(!cells.length) return;\r\n\r\n\t\tvar property = cells[0].$parent._xLayout ? \"width\" : \"height\";\r\n\t\tvar direction = cells[0].$parent.getNextSibling(cells[0].$id) ? 1 : -1;\r\n\r\n\t\tfor(var i = 0; i < cells.length; i++){\r\n\t\t\tvar ownSize = cells[i].getSize();\r\n\r\n\t\t\tvar resizeSibling = direction > 0 ? cells[i].$parent.getNextSibling(cells[i].$id) : cells[i].$parent.getPrevSibling(cells[i].$id);\r\n\t\t\tif(resizeSibling.$name == \"resizer\"){\r\n\t\t\t\tresizeSibling = direction > 0 ? resizeSibling.$parent.getNextSibling(resizeSibling.$id) : resizeSibling.$parent.getPrevSibling(resizeSibling.$id);\r\n\t\t\t}\r\n\t\t\tvar siblingSize = resizeSibling.getSize();\r\n\r\n\t\t\tif(resizeSibling[property]){\r\n\t\t\t\tvar totalGravity = ownSize.gravity + siblingSize.gravity;\r\n\t\t\t\tvar totalSize = ownSize[property] + siblingSize[property];\r\n\t\t\t\tvar k = totalGravity / totalSize;\r\n\t\t\t\tcells[i].$config.gravity = k * newSize;\r\n\r\n\t\t\t\tresizeSibling.$config[property] = totalSize - newSize;\r\n\t\t\t\tresizeSibling.$config.gravity = totalGravity - k * newSize;\r\n\t\t\t}else{\r\n\r\n\r\n\t\t\t\tcells[i].$config[property] = newSize;\r\n\t\t\t}\r\n\r\n\t\t\tvar mainGrid = this.$gantt.$ui.getView(\"grid\");\r\n\t\t\tif(mainGrid && cells[i].$content === mainGrid && !mainGrid.$config.scrollable){\r\n\t\t\t\tthis.$gantt.config.grid_width = newSize;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tLayout.prototype.resize = function(startStage){\r\n\t\tvar mainCall = false;\r\n\t\tif(this.$root && !this._resizeInProgress){\r\n\t\t\tthis.callEvent(\"onBeforeResize\", []);\r\n\t\t\tmainCall = true;\r\n\t\t\tthis._resizeInProgress = true;\r\n\t\t}\r\n\r\n\t\t_super.prototype.resize.call(this, true);\r\n\t\t_super.prototype.resize.call(this, false);\r\n\r\n\t\tif(mainCall){\r\n\r\n\t\t\tvar contentViews = [];\r\n\t\t\tcontentViews = contentViews.concat(this.getCellsByType(\"viewCell\"));\r\n\t\t\tcontentViews = contentViews.concat(this.getCellsByType(\"viewLayout\"));\r\n\t\t\tcontentViews = contentViews.concat(this.getCellsByType(\"hostCell\"));\r\n\r\n\t\t\tvar scrollbars = this.getCellsByType(\"scroller\");\r\n\r\n\t\t\tfor(var i = 0; i < contentViews.length; i++){\r\n\t\t\t\tif(!contentViews[i].$config.hidden)\r\n\t\t\t\t\tcontentViews[i].setContentSize();\r\n\t\t\t}\r\n\r\n\t\t\tvar autosize = this._getAutosizeMode(this.$config.autosize);\r\n\r\n\t\t\tvar scrollChanged = this._resizeScrollbars(autosize, scrollbars);\r\n\r\n\t\t\tif(this.$config.autosize){\r\n\t\t\t\tthis.autosize(this.$config.autosize);\r\n\t\t\t\tscrollChanged = true;\r\n\t\t\t}\r\n\r\n\t\t\tif(scrollChanged){\r\n\t\t\t\tthis.resize();\r\n\t\t\t\tfor(var i = 0; i < contentViews.length; i++){\r\n\t\t\t\t\tif(!contentViews[i].$config.hidden)\r\n\t\t\t\t\t\tcontentViews[i].setContentSize();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.callEvent(\"onResize\", []);\r\n\t\t}\r\n\t\tif(mainCall){\r\n\t\t\tthis._resizeInProgress = false;\r\n\t\t}\r\n\t};\r\n\r\n\tLayout.prototype._eachChild = function(code, cell){\r\n\t\tcell = cell || this;\r\n\t\tcode(cell);\r\n\t\tif(cell.$cells){\r\n\t\t\tfor(var i = 0; i < cell.$cells.length; i++){\r\n\t\t\t\tthis._eachChild(code, cell.$cells[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tLayout.prototype.isChild = function(view){\r\n\t\tvar res = false;\r\n\t\tthis._eachChild(function(child){\r\n\t\t\tif(child === view || child.$content === view){\r\n\t\t\t\tres = true;\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn res;\r\n\t};\r\n\r\n\tLayout.prototype.getCellsByType = function(type){\r\n\t\tvar res = [];\r\n\t\tif(type === this.$name){\r\n\t\t\tres.push(this);\r\n\t\t}\r\n\r\n\t\tif(this.$content && this.$content.$name == type){\r\n\t\t\tres.push(this.$content);\r\n\t\t}\r\n\r\n\t\tif(this.$cells){\r\n\t\t\tfor(var i = 0; i < this.$cells.length; i++){\r\n\t\t\t\tvar children = Layout.prototype.getCellsByType.call(this.$cells[i], type);\r\n\t\t\t\tif(children.length){\r\n\t\t\t\t\tres.push.apply(res, children);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res;\r\n\t};\r\n\r\n\tLayout.prototype.getNextSibling = function(cellId){\r\n\t\tvar index = this.cellIndex(cellId);\r\n\t\tif(index >= 0 && this.$cells[index + 1]){\r\n\t\t\treturn this.$cells[index + 1];\r\n\t\t}else{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t};\r\n\r\n\tLayout.prototype.getPrevSibling = function(cellId){\r\n\t\tvar index = this.cellIndex(cellId);\r\n\t\tif(index >= 0 && this.$cells[index - 1]){\r\n\t\t\treturn this.$cells[index - 1];\r\n\t\t}else{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tLayout.prototype.cell = function (id) {\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\tvar child = this.$cells[i];\r\n\t\t\tif (child.$id === id) {\r\n\t\t\t\treturn child;\r\n\t\t\t}\r\n\t\t\tvar sub = child.cell(id);\r\n\t\t\tif (sub) {\r\n\t\t\t\treturn sub;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tLayout.prototype.cellIndex = function (id) {\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\tif (this.$cells[i].$id === id) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\tLayout.prototype.moveView = function (view, ind) {\r\n\t\tif (this.$cells[ind] !== view) {\r\n\t\t\treturn window.alert(\"Not implemented\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\tind += this.$config.header ? 1 : 0;\r\n\t\t\tvar node = this.$view;\r\n\t\t\tif (ind >= node.childNodes.length) {\r\n\t\t\t\tnode.appendChild(view.$view);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnode.insertBefore(view.$view, node.childNodes[ind]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tLayout.prototype._parseConfig = function (config) {\r\n\t\tthis.$cells = [];\r\n\t\tthis._xLayout = !config.rows;\r\n\t\tvar cells = config.rows || config.cols || config.views;\r\n\t\tfor (var i = 0; i < cells.length; i++) {\r\n\t\t\tvar cell = cells[i];\r\n\t\t\tcell.mode = this._xLayout ? \"x\" : \"y\";\r\n\t\t\tvar $content = this.$factory.initUI(cell, this);\r\n\t\t\tif(!$content){\r\n\t\t\t\tcells.splice(i, 1);\r\n\t\t\t\ti--;\r\n\t\t\t}else{\r\n\t\t\t\t$content.$parent = this;\r\n\t\t\t\tthis.$cells.push($content);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tLayout.prototype.getCells = function () {\r\n\t\treturn this.$cells;\r\n\t};\r\n\tLayout.prototype.render = function () {\r\n\t\tvar view = domHelpers.insertNode(this.$container, this.$toHTML());\r\n\t\tthis.$fill(view, null);\r\n\t\tthis.callEvent(\"onReady\", []);\r\n\t\tthis.resize();\r\n\r\n\t\t// do simple repaint after the first call\r\n\t\tthis.render = this.resize;\r\n\t};\r\n\tLayout.prototype.$fill = function (node, parent) {\r\n\t\tthis.$view = node;\r\n\t\tthis.$parent = parent;\r\n\t\tvar cells = domHelpers.getChildNodes(node, \"gantt_layout_cell\");\r\n\t\tfor (var i = cells.length - 1; i >= 0; i--) {\r\n\t\t\tvar sub = this.$cells[i];\r\n\t\t\tsub.$fill(cells[i], this);\r\n\t\t\t// initially hidden cell\r\n\t\t\tif (sub.$config.hidden) {\r\n\t\t\t\tsub.$view.parentNode.removeChild(sub.$view);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tLayout.prototype.$toHTML = function () {\r\n\t\tvar mode = this._xLayout ? \"x\" : \"y\";\r\n\t\tvar html = [];\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\thtml.push(this.$cells[i].$toHTML());\r\n\t\t}\r\n\t\treturn _super.prototype.$toHTML.call(this, html.join(\"\"), (this.$root ? \"gantt_layout_root \" : \"\") + \"gantt_layout gantt_layout_\" + mode);\r\n\t};\r\n\r\n\tLayout.prototype.getContentSize = function(mode){\r\n\t\tvar contentWidth = 0,\r\n\t\t\tcontentHeight = 0;\r\n\r\n\t\tvar cellSize, cell, borders;\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\tcell = this.$cells[i];\r\n\t\t\tif(cell.$config.hidden)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tcellSize = cell.getContentSize(mode);\r\n\r\n\t\t\tif(cell.$config.view === \"scrollbar\" && mode[cell.$config.scroll]){\r\n\t\t\t\tcellSize.height = 0;\r\n\t\t\t\tcellSize.width = 0;\r\n\t\t\t}\r\n\r\n\t\t\tif(cell.$config.resizer){\r\n\t\t\t\tif(this._xLayout){\r\n\t\t\t\t\tcellSize.height = 0;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcellSize.width = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborders = cell._getBorderSizes();\r\n\r\n\t\t\tif(this._xLayout){\r\n\t\t\t\tcontentWidth += (cellSize.width + borders.horizontal);\r\n\t\t\t\tcontentHeight = Math.max(contentHeight, (cellSize.height + borders.vertical));\r\n\t\t\t}else{\r\n\t\t\t\tcontentWidth = Math.max(contentWidth, cellSize.width + borders.horizontal);\r\n\t\t\t\tcontentHeight += cellSize.height + borders.vertical;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tborders = this._getBorderSizes();\r\n\t\tcontentWidth += borders.horizontal;\r\n\t\tcontentHeight += borders.vertical;\r\n\r\n\t\tif(this.$root){\r\n\t\t\tcontentWidth += 1;\r\n\t\t\tcontentHeight += 1;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\twidth: contentWidth,\r\n\t\t\theight: contentHeight\r\n\t\t};\r\n\t};\r\n\r\n\tLayout.prototype._cleanElSize = function(value){\r\n\t\treturn ((value || \"\").toString().replace(\"px\", \"\") * 1 || 0);\r\n\t};\r\n\tLayout.prototype._getBoxStyles = function(div){\r\n\t\tvar computed = null;\r\n\t\tif(window.getComputedStyle){\r\n\t\t\tcomputed = window.getComputedStyle(div, null);\r\n\t\t}else{\r\n\t\t\t//IE with elem.currentStyle does not calculate sizes from %, so will use the default approach\r\n\t\t\tcomputed = {\r\n\t\t\t\t\"width\":div.clientWidth,\r\n\t\t\t\t\"height\":div.clientHeight\r\n\t\t\t};\r\n\t\t}\r\n\t\tvar properties = [\r\n\t\t\t\"width\",\r\n\t\t\t\"height\",\r\n\r\n\t\t\t\"paddingTop\",\r\n\t\t\t\"paddingBottom\",\r\n\t\t\t\"paddingLeft\",\r\n\t\t\t\"paddingRight\",\r\n\r\n\t\t\t\"borderLeftWidth\",\r\n\t\t\t\"borderRightWidth\",\r\n\t\t\t\"borderTopWidth\",\r\n\t\t\t\"borderBottomWidth\"\r\n\t\t];\r\n\t\tvar styles = {\r\n\t\t\tboxSizing:(computed.boxSizing == \"border-box\")\r\n\t\t};\r\n\r\n\t\tif(computed.MozBoxSizing){\r\n\t\t\tstyles.boxSizing = (computed.MozBoxSizing == \"border-box\");\r\n\t\t}\r\n\t\tfor(var i =0; i < properties.length; i++){\r\n\t\t\tstyles[properties[i]] = computed[properties[i]] ? this._cleanElSize(computed[properties[i]]) : 0;\r\n\t\t}\r\n\r\n\r\n\t\tvar box = {\r\n\t\t\thorPaddings : (styles.paddingLeft + styles.paddingRight + styles.borderLeftWidth + styles.borderRightWidth),\r\n\t\t\tvertPaddings : (styles.paddingTop + styles.paddingBottom + styles.borderTopWidth + styles.borderBottomWidth),\r\n\t\t\tborderBox: styles.boxSizing,\r\n\t\t\tinnerWidth : styles.width,\r\n\t\t\tinnerHeight : styles.height,\r\n\t\t\touterWidth : styles.width,\r\n\t\t\touterHeight : styles.height\r\n\t\t};\r\n\r\n\r\n\t\tif(box.borderBox){\r\n\t\t\tbox.innerWidth -= box.horPaddings;\r\n\t\t\tbox.innerHeight -= box.vertPaddings;\r\n\t\t}else{\r\n\t\t\tbox.outerWidth += box.horPaddings;\r\n\t\t\tbox.outerHeight += box.vertPaddings;\r\n\t\t}\r\n\r\n\t\treturn box;\r\n\t};\r\n\r\n\tLayout.prototype._getAutosizeMode = function(config){\r\n\t\tvar res = {x:false, y:false};\r\n\t\tif(config === \"xy\"){\r\n\t\t\tres.x = res.y = true;\r\n\t\t}else if(config === \"y\" || config === true){\r\n\t\t\tres.y = true;\r\n\t\t}else if(config === \"x\"){\r\n\t\t\tres.x = true;\r\n\t\t}\r\n\t\treturn res;\r\n\t};\r\n\r\n\tLayout.prototype.autosize = function(mode) {\r\n\t\tvar res = this._getAutosizeMode(mode);\r\n\t\tvar boxSizes = this._getBoxStyles(this.$container);\r\n\t\tvar contentSizes = this.getContentSize(mode);\r\n\r\n\t\tvar node = this.$container;\r\n\t\tif(res.x){\r\n\t\t\tif(boxSizes.borderBox){\r\n\t\t\t\tcontentSizes.width += boxSizes.horPaddings;\r\n\t\t\t}\r\n\t\t\tnode.style.width = contentSizes.width + \"px\";\r\n\t\t}\r\n\t\tif(res.y){\r\n\t\t\tif(boxSizes.borderBox){\r\n\t\t\t\tcontentSizes.height += boxSizes.vertPaddings;\r\n\t\t\t}\r\n\t\t\tnode.style.height = contentSizes.height + \"px\";\r\n\t\t}\r\n\t};\r\n\r\n\tLayout.prototype.getSize = function () {\r\n\t\tthis._sizes = [];\r\n\t\tvar width = 0;\r\n\t\tvar minWidth = 0;\r\n\t\tvar maxWidth = 100000;\r\n\t\tvar height = 0;\r\n\t\tvar maxHeight = 100000;\r\n\t\tvar minHeight = 0;\r\n\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\r\n\t\t\tvar size = this._sizes[i] = this.$cells[i].getSize();\r\n\t\t\tif (this.$cells[i].$config.hidden) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (this._xLayout) {\r\n\t\t\t\tif (!size.width && size.minWidth) {\r\n\t\t\t\t\twidth += size.minWidth;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\twidth += size.width;\r\n\t\t\t\t}\r\n\t\t\t\tmaxWidth += size.maxWidth;\r\n\t\t\t\tminWidth += size.minWidth;\r\n\t\t\t\theight = Math.max(height, size.height);\r\n\t\t\t\tmaxHeight = Math.min(maxHeight, size.maxHeight); // min of maxHeight\r\n\t\t\t\tminHeight = Math.max(minHeight, size.minHeight); // max of minHeight\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (!size.height && size.minHeight) {\r\n\t\t\t\t\theight += size.minHeight;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\theight += size.height;\r\n\t\t\t\t}\r\n\t\t\t\tmaxHeight += size.maxHeight;\r\n\t\t\t\tminHeight += size.minHeight;\r\n\t\t\t\twidth = Math.max(width, size.width);\r\n\t\t\t\tmaxWidth = Math.min(maxWidth, size.maxWidth); // min of maxWidth\r\n\t\t\t\tminWidth = Math.max(minWidth, size.minWidth); // max of minWidth\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar self = _super.prototype.getSize.call(this);\r\n\t\t// maxWidth\r\n\t\tif (self.maxWidth >= 100000) {\r\n\t\t\tself.maxWidth = maxWidth;\r\n\t\t}\r\n\t\t// maxHeight\r\n\t\tif (self.maxHeight >= 100000) {\r\n\t\t\tself.maxHeight = maxHeight;\r\n\t\t}\r\n\t\t// minWidth\r\n\t\tself.minWidth = self.minWidth !== self.minWidth ? 0 : self.minWidth;// || self.width || Math.max(minWidth, width);\r\n\t\t// minHeight\r\n\t\tself.minHeight = self.minHeight !== self.minHeight ? 0 : self.minHeight;//self.minHeight || self.height || Math.max(minHeight, height);\r\n\t\t// sizes with paddings and margins\r\n\t\tif (this._xLayout) {\r\n\t\t\tself.minWidth += this.$config.margin * (this.$cells.length) || 0;\r\n\t\t\tself.minWidth += this.$config.padding * 2 || 0;\r\n\t\t\tself.minHeight += (this.$config.padding * 2) || 0;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tself.minHeight += this.$config.margin * (this.$cells.length) || 0;\r\n\t\t\tself.minHeight += (this.$config.padding * 2) || 0;\r\n\t\t}\r\n\t\t\r\n\t\treturn self;\r\n\t};\r\n\t// calc total gravity and free space\r\n\tLayout.prototype._calcFreeSpace = function (s, cell, xLayout) {\r\n\t\tvar min = xLayout ? cell.minWidth : cell.minHeight;\r\n\t\tvar max = xLayout ? cell.maxWidth : cell.maxWidth;\r\n\t\tvar side = s;\r\n\t\tif (!side) {\r\n\t\t\tside = Math.floor(this._free / this._gravity * cell.gravity);\r\n\t\t\tif (side > max) {\r\n\t\t\t\tside = max;\r\n\t\t\t\tthis._free -= side;\r\n\t\t\t\tthis._gravity -= cell.gravity;\r\n\t\t\t}\r\n\t\t\tif (side < min) {\r\n\t\t\t\tside = min;\r\n\t\t\t\tthis._free -= side;\r\n\t\t\t\tthis._gravity -= cell.gravity;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (side > max) {\r\n\t\t\t\tside = max;\r\n\t\t\t}\r\n\t\t\tif (side < min) {\r\n\t\t\t\tside = min;\r\n\t\t\t}\r\n\t\t\tthis._free -= side;\r\n\t\t}\r\n\t\treturn side;\r\n\t};\r\n\tLayout.prototype._calcSize = function (s, size, xLayout) {\r\n\t\tvar side = s;\r\n\t\tvar min = xLayout ? size.minWidth : size.minHeight;\r\n\t\tvar max = xLayout ? size.maxWidth : size.maxHeight;\r\n\t\tif (!side) {\r\n\t\t\tside = Math.floor(this._free / this._gravity * size.gravity);\r\n\t\t}\r\n\t\tif (side > max) {\r\n\t\t\tside = max;\r\n\t\t}\r\n\t\tif (side < min) {\r\n\t\t\tside = min;\r\n\t\t}\r\n\t\treturn side;\r\n\t};\r\n\r\n\tLayout.prototype._configureBorders = function(){\r\n\t\tif(this.$root){\r\n\t\t\tthis._setBorders([\r\n\t\t\t\tthis._borders.left,\r\n\t\t\t\tthis._borders.top,\r\n\t\t\t\tthis._borders.right,\r\n\t\t\t\tthis._borders.bottom\r\n\t\t\t],\r\n\t\t\tthis);\r\n\t\t}\r\n\r\n\t\tvar borderClass = this._xLayout ? this._borders.right : this._borders.bottom;\r\n\r\n\t\tvar cells = this.$cells;\r\n\r\n\t\tvar lastVisibleIndex = cells.length - 1;\r\n\t\tfor(var i = lastVisibleIndex; i >= 0; i--){\r\n\t\t\tif (!cells[i].$config.hidden) {\r\n\t\t\t\tlastVisibleIndex = i;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (var i = 0; i < cells.length; i++) {\r\n\t\t\tif (cells[i].$config.hidden) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tvar lastCell = i >= lastVisibleIndex;\r\n\t\t\tvar borderColorClass = \"\";\r\n\t\t\tif(!lastCell && cells[i + 1]){\r\n\t\t\t\tif(cells[i + 1].$config.view == \"scrollbar\"){\r\n\t\t\t\t\tif(this._xLayout){\r\n\t\t\t\t\t\tlastCell = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tborderColorClass = \"gantt_layout_cell_border_transparent\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\r\n\t\t\tthis._setBorders(lastCell ? [] : [borderClass, borderColorClass], cells[i]);\r\n\t\t}\r\n\t};\r\n\r\n\tLayout.prototype._updateCellVisibility = function(){\r\n\t\tvar oldVisibleCells = this._visibleCells || {};\r\n\t\tvar firstCall = !this._visibleCells;\r\n\t\tvar visibleCells = {};\r\n\t\tvar cell;\r\n\t\tfor (var i = 0; i < this._sizes.length; i++) {\r\n\t\t\tcell = this.$cells[i];\r\n\r\n\t\t\tif (!firstCall && cell.$config.hidden && oldVisibleCells[cell.$id]) {\r\n\t\t\t\tcell._hide(true);\r\n\t\t\t}else if(!cell.$config.hidden && !oldVisibleCells[cell.$id]){\r\n\t\t\t\tcell._hide(false);\r\n\t\t\t}\r\n\r\n\t\t\tif(!cell.$config.hidden){\r\n\t\t\t\tvisibleCells[cell.$id] = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis._visibleCells = visibleCells;\r\n\t};\r\n\r\n\tLayout.prototype.setSize = function (x, y) {\r\n\t\tthis._configureBorders();\r\n\t\t_super.prototype.setSize.call(this, x, y);\r\n\t\ty = this.$lastSize.contentY;\r\n\t\tx = this.$lastSize.contentX;\r\n\r\n\t\tvar padding = (this.$config.padding || 0);\r\n\t\tthis.$view.style.padding = padding + \"px\";\r\n\t\tthis._gravity = 0;\r\n\t\tthis._free = this._xLayout ? x : y;\r\n\t\tthis._free -= padding * 2;\r\n\t\t// calc all gravity\r\n\r\n\t\tvar cell,\r\n\t\t\tsize;\r\n\r\n\t\tthis._updateCellVisibility();\r\n\r\n\t\tfor (var i = 0; i < this._sizes.length; i++) {\r\n\t\t\tcell = this.$cells[i];\r\n\r\n\t\t\tif (cell.$config.hidden) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tvar margin = (this.$config.margin || 0);\r\n\t\t\tif(cell.$name == \"resizer\" && !margin){\r\n\t\t\t\tmargin = -1;\r\n\t\t\t}\r\n\r\n\t\t\t// set margins to child cell\r\n\t\t\tvar cellView = cell.$view;\r\n\r\n\t\t\tvar marginSide = this._xLayout ? \"marginRight\" : \"marginBottom\";\r\n\t\t\tif (i !== this.$cells.length - 1) {\r\n\t\t\t\tcellView.style[marginSide] = margin + \"px\";\r\n\t\t\t\tthis._free -= margin; // calc free space without margin\r\n\t\t\t}\r\n\t\t\tsize = this._sizes[i];\r\n\t\t\tif (this._xLayout) {\r\n\t\t\t\tif (!size.width) {\r\n\t\t\t\t\tthis._gravity += size.gravity;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (!size.height) {\r\n\t\t\t\t\tthis._gravity += size.gravity;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (var i = 0; i < this._sizes.length; i++) {\r\n\t\t\tcell = this.$cells[i];\r\n\r\n\t\t\tif (cell.$config.hidden) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tsize = this._sizes[i];\r\n\t\t\tvar width = size.width;\r\n\t\t\tvar height = size.height;\r\n\t\t\tif (this._xLayout) {\r\n\t\t\t\tthis._calcFreeSpace(width, size, true);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis._calcFreeSpace(height, size, false);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\tcell = this.$cells[i];\r\n\r\n\t\t\tif (cell.$config.hidden) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tsize = this._sizes[i];\r\n\t\t\tvar dx = void 0;\r\n\t\t\tvar dy = void 0;\r\n\t\t\tif (this._xLayout) {\r\n\t\t\t\tdx = this._calcSize(size.width, size, true);\r\n\t\t\t\tdy = y - padding * 2; // layout height without paddings\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tdx = x - padding * 2; // layout width without paddings\r\n\t\t\t\tdy = this._calcSize(size.height, size, false);\r\n\t\t\t}\r\n\r\n\t\t\tcell.setSize(dx, dy);\r\n\t\t}\r\n\r\n\t};\r\n\r\n\treturn Layout;\r\n}(Cell));\r\n\r\nmodule.exports = Layout;","module.exports = function(item, view){\r\n\treturn {\r\n\t\ttop: view.getItemTop(item.id),\r\n\t\theight: view.getItemHeight(item.id),\r\n\t\tleft: 0,\r\n\t\tright: Infinity\r\n\t};\r\n};","var utils = require(\"../../utils/utils\");\r\nvar helpers = require(\"../../utils/helpers\");\r\n\r\n\r\nfunction IsWorkTimeArgument(date, unit, task, id, calendar){\r\n\tthis.date = date;\r\n\tthis.unit = unit;\r\n\tthis.task = task;\r\n\tthis.id = id;\r\n\tthis.calendar = calendar;\r\n\treturn this;\r\n}\r\n\r\nfunction ClosestWorkTimeArgument(date, dir, unit, task, id, calendar){\r\n\tthis.date = date;\r\n\tthis.dir = dir;\r\n\tthis.unit = unit;\r\n\tthis.task = task;\r\n\tthis.id = id;\r\n\tthis.calendar = calendar;\r\n\treturn this;\r\n}\r\n\r\nfunction CalculateEndDateArgument(start_date, duration, unit, step, task, id, calendar){\r\n\tthis.start_date = start_date;\r\n\tthis.duration = duration;\r\n\tthis.unit = unit;\r\n\tthis.step = step;\r\n\tthis.task = task;\r\n\tthis.id = id;\r\n\tthis.calendar = calendar;\r\n\treturn this;\r\n}\r\n\r\nfunction GetDurationArgument(start, end, task, calendar) {\r\n\tthis.start_date = start;\r\n\tthis.end_date = end;\r\n\tthis.task = task;\r\n\tthis.calendar = calendar;\r\n\tthis.unit = null;\r\n\tthis.step = null;\r\n\treturn this;\r\n}\r\n\r\nvar calendarArgumentsHelper = function(gantt){\r\n\treturn {\r\n\t\tgetWorkHoursArguments: function () {\r\n\t\t\tvar config = arguments[0];\r\n\t\t\tif (helpers.isDate(config)) {\r\n\t\t\t\tconfig = {\r\n\t\t\t\t\tdate: config\r\n\t\t\t\t};\r\n\t\t\t} else {\r\n\t\t\t\tconfig = utils.mixin({}, config);\r\n\t\t\t}\r\n\r\n\t\t\tif(!helpers.isValidDate(config.date)){\r\n\t\t\t\tgantt.assert(false, \"Invalid date argument for getWorkHours method\");\r\n\t\t\t\tthrow new Error(\"Invalid date argument for getWorkHours method\");\r\n\t\t\t}\r\n\r\n\t\t\treturn config;\r\n\t\t},\r\n\t\tsetWorkTimeArguments: function () {\r\n\t\t\treturn arguments[0];\r\n\t\t},\r\n\t\tunsetWorkTimeArguments: function () {\r\n\t\t\treturn arguments[0];\r\n\t\t},\r\n\t\tisWorkTimeArguments: function () {\r\n\t\t\tvar config = arguments[0];\r\n\t\t\tif(config instanceof IsWorkTimeArgument){\r\n\t\t\t\treturn config;\r\n\t\t\t}\r\n\r\n\t\t\tvar processedConfig;\r\n\t\t\tif (!config.date) {\r\n\t\t\t\t//IsWorkTimeArgument(date, unit, task, id, calendar)\r\n\t\t\t\tprocessedConfig = new IsWorkTimeArgument(arguments[0], arguments[1], arguments[2], null, arguments[3]);\r\n\t\t\t} else {\r\n\t\t\t\tprocessedConfig = new IsWorkTimeArgument(config.date, config.unit, config.task, null, config.calendar);\r\n\t\t\t}\r\n\r\n\t\t\tprocessedConfig.unit = processedConfig.unit || gantt.config.duration_unit;\r\n\r\n\t\t\tif(!helpers.isValidDate(processedConfig.date)){\r\n\t\t\t\tgantt.assert(false, \"Invalid date argument for isWorkTime method\");\r\n\t\t\t\tthrow new Error(\"Invalid date argument for isWorkTime method\");\r\n\t\t\t}\r\n\r\n\t\t\treturn processedConfig;\r\n\t\t},\r\n\t\tgetClosestWorkTimeArguments: function (arg) {\r\n\t\t\tvar config = arguments[0];\r\n\t\t\tif (config instanceof ClosestWorkTimeArgument)\r\n\t\t\t\treturn config;\r\n\r\n\t\t\tvar processedConfig;\r\n\t\t\tif (helpers.isDate(config)) {\r\n\t\t\t\tprocessedConfig = new ClosestWorkTimeArgument(config);\r\n\r\n\t\t\t} else {\r\n\t\t\t\tprocessedConfig = new ClosestWorkTimeArgument(\r\n\t\t\t\t\tconfig.date,\r\n\t\t\t\t\tconfig.dir,\r\n\t\t\t\t\tconfig.unit,\r\n\t\t\t\t\tconfig.task,\r\n\t\t\t\t\tnull,//config.id,\r\n\t\t\t\t\tconfig.calendar\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tif(config.id){\r\n\t\t\t\tprocessedConfig.task = config;\r\n\t\t\t}\r\n\t\t\tprocessedConfig.dir = config.dir || 'any';\r\n\t\t\tprocessedConfig.unit = config.unit || gantt.config.duration_unit;\r\n\r\n\t\t\tif(!helpers.isValidDate(processedConfig.date)){\r\n\t\t\t\tgantt.assert(false, \"Invalid date argument for getClosestWorkTime method\");\r\n\t\t\t\tthrow new Error(\"Invalid date argument for getClosestWorkTime method\");\r\n\t\t\t}\r\n\t\t\treturn processedConfig;\r\n\t\t},\r\n\r\n\t\t_getStartEndConfig: function (param) {\r\n\t\t\tvar argumentType = GetDurationArgument;\r\n\t\t\tvar config;\r\n\t\t\tif (param instanceof argumentType)\r\n\t\t\t\treturn param;\r\n\r\n\t\t\tif (helpers.isDate(param)) {\r\n\t\t\t\tconfig = new argumentType(arguments[0], arguments[1], arguments[2], arguments[3]);\r\n\t\t\t} else {\r\n\t\t\t\tconfig = new argumentType(param.start_date, param.end_date, param.task);\r\n\t\t\t\tif (param.id) {\r\n\t\t\t\t\tconfig.task = param;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconfig.unit = config.unit || gantt.config.duration_unit;\r\n\t\t\tconfig.step = config.step || gantt.config.duration_step;\r\n\t\t\tconfig.start_date = config.start_date || config.start || config.date;\r\n\r\n\t\t\tif(!helpers.isValidDate(config.start_date)){\r\n\t\t\t\tgantt.assert(false, \"Invalid start_date argument for getDuration method\");\r\n\t\t\t\tthrow new Error(\"Invalid start_date argument for getDuration method\");\r\n\t\t\t}\r\n\r\n\t\t\tif(!helpers.isValidDate(config.end_date)){\r\n\t\t\t\tgantt.assert(false, \"Invalid end_date argument for getDuration method\");\r\n\t\t\t\tthrow new Error(\"Invalid end_date argument for getDuration method\");\r\n\t\t\t}\r\n\r\n\t\t\treturn config;\r\n\t\t},\r\n\r\n\t\tgetDurationArguments: function (start, end, unit, step) {\r\n\t\t\treturn this._getStartEndConfig.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\thasDurationArguments: function (start, end, unit, step) {\r\n\t\t\treturn this._getStartEndConfig.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\tcalculateEndDateArguments: function (start, duration, unit, step) {\r\n\t\t\tvar config = arguments[0];\r\n\t\t\tif (config instanceof CalculateEndDateArgument)\r\n\t\t\t\treturn config;\r\n\r\n\t\t\tvar processedConfig;\r\n\t\t\t//CalculateEndDateArgument(start_date, duration, unit, step, task, id, calendar)\r\n\t\t\tif (helpers.isDate(config)) {\r\n\t\t\t\tprocessedConfig = new CalculateEndDateArgument(\r\n\t\t\t\t\targuments[0],\r\n\t\t\t\t\targuments[1],\r\n\t\t\t\t\targuments[2],\r\n\t\t\t\t\tundefined,\r\n\t\t\t\t\targuments[3],\r\n\t\t\t\t\tundefined,\r\n\t\t\t\t\targuments[4]\r\n\t\t\t\t);\r\n\r\n\t\t\t} else {\r\n\t\t\t\tprocessedConfig = new CalculateEndDateArgument(\r\n\t\t\t\t\tconfig.start_date,\r\n\t\t\t\t\tconfig.duration,\r\n\t\t\t\t\tconfig.unit,\r\n\t\t\t\t\tconfig.step,\r\n\t\t\t\t\tconfig.task,\r\n\t\t\t\t\tnull,//config.id,\r\n\t\t\t\t\tconfig.calendar\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tif(config.id){\r\n\t\t\t\tprocessedConfig.task = config;\r\n\r\n\t\t\t\t// received a task object as an argument\r\n\t\t\t\t// ignore 'unit' and 'step' properties in this case, since it's likely a part of data model of a task\r\n\t\t\t\tprocessedConfig.unit = null;\r\n\t\t\t\tprocessedConfig.step = null;\r\n\t\t\t}\r\n\r\n\t\t\tprocessedConfig.unit = processedConfig.unit || gantt.config.duration_unit;\r\n\t\t\tprocessedConfig.step = processedConfig.step || gantt.config.duration_step;\r\n\r\n\t\t\tif(!helpers.isValidDate(processedConfig.start_date)){\r\n\t\t\t\tgantt.assert(false, \"Invalid start_date argument for calculateEndDate method\");\r\n\t\t\t\tthrow new Error(\"Invalid start_date argument for calculateEndDate method\");\r\n\t\t\t}\r\n\r\n\t\t\treturn processedConfig;\r\n\t\t}\r\n\t};\r\n};\r\n\r\n\r\nmodule.exports = calendarArgumentsHelper;","function createMixin(){\r\n\tvar topCache = {};\r\n\treturn {\r\n\t\t_resetTopPositionHeight: function(){\r\n\t\t\ttopCache = {};\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Get top coordinate by row index (order)\r\n\t\t * @param {number} index\r\n\t\t */\r\n\t\tgetRowTop: function(index){\r\n\t\t\treturn index * this.$getConfig().row_height;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Get top coordinate by item id\r\n\t\t * @param {*} task_id\r\n\t\t */\r\n\t\tgetItemTop: function (taskId) {\r\n\t\t\tif(this.$config.rowStore){\r\n\t\t\t\tif(topCache[taskId] !== undefined){\r\n\t\t\t\t\treturn topCache[taskId];\r\n\t\t\t\t}\r\n\t\t\t\tvar store = this.$config.rowStore;\r\n\t\t\t\tif(!store) return 0;\r\n\r\n\t\t\t\tvar itemIndex = store.getIndexById(taskId);\r\n\r\n\t\t\t\tif (itemIndex === -1 && store.getParent && store.exists(taskId)) {\r\n\t\t\t\t\tvar parentId = store.getParent(taskId);\r\n\t\t\t\t\tif (store.exists(parentId)) {\r\n\t\t\t\t\t\t// if task is not found in list - maybe it's parent is a split task and we should use parents index instead\r\n\t\t\t\t\t\tvar parent = store.getItem(parentId);\r\n\t\t\t\t\t\tif (this.$gantt.isSplitTask(parent)) {\r\n\t\t\t\t\t\t\treturn this.getRowTop(store.getIndexById(parent.id));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttopCache[taskId] = this.getRowTop(itemIndex);\r\n\t\t\t\treturn topCache[taskId];\r\n\t\t\t}else{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t};\r\n}\r\n\r\nmodule.exports = createMixin;","export default class DurationFormatterNumeric implements IDurationFormatter {\r\n\tstatic create = (settings: IDurationFormatterConfig = null): IDurationFormatter => {\r\n\t\treturn new DurationFormatterNumeric();\r\n\t}\r\n\tcanParse = (value: string) : boolean => {\r\n\t\treturn !isNaN(this.parse(value));\r\n\t}\r\n\tformat = (value: number) : string => {\r\n\t\treturn String(value);\r\n\t}\r\n\tparse = (value: string) : number => {\r\n\t\treturn parseInt(value, 10);\r\n\t}\r\n}","function copyLinkIdsArray(gantt, linkIds, targetHash){\r\n\tfor(var i = 0; i < linkIds.length; i++) {\r\n\t\tif(gantt.isLinkExists(linkIds[i])){\r\n\t\t\ttargetHash[linkIds[i]] = gantt.getLink(linkIds[i]);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction copyLinkIds(gantt, task, targetHash){\r\n\tcopyLinkIdsArray(gantt, task.$source, targetHash);\r\n\tcopyLinkIdsArray(gantt, task.$target, targetHash);\r\n}\r\n\r\nfunction getSubtreeLinks(gantt, rootId){\r\n\tvar res = {};\r\n\r\n\tif(gantt.isTaskExists(rootId)){\r\n\t\tcopyLinkIds(gantt, gantt.getTask(rootId), res);\r\n\t}\r\n\r\n\tgantt.eachTask(function(child){\r\n\t\tcopyLinkIds(gantt, child, res);\r\n\t}, rootId);\r\n\r\n\treturn res;\r\n}\r\n\r\nfunction getSubtreeTasks(gantt, rootId){\r\n\tvar res = {};\r\n\r\n\tgantt.eachTask(function(child){\r\n\t\tres[child.id] = child;\r\n\t}, rootId);\r\n\r\n\treturn res;\r\n}\r\n\r\nmodule.exports = {\r\n\tgetSubtreeLinks: getSubtreeLinks,\r\n\tgetSubtreeTasks: getSubtreeTasks\r\n};","var ScaleHelper = require(\"./ui/timeline/scales_ignore\");\r\nvar PrimaryScaleHelper = require(\"./ui/timeline/scales\");\r\n\r\nfunction resolveConfigRange(unit, gantt){\r\n\tvar range = {\r\n\t\tstart_date:null,\r\n\t\tend_date:null\r\n\t};\r\n\r\n\tif (gantt.config.start_date && gantt.config.end_date) {\r\n\t\trange.start_date = gantt.date[unit + \"_start\"](new Date(gantt.config.start_date));\r\n\r\n\t\tvar end = new Date(gantt.config.end_date);\r\n\t\tvar start_interval = gantt.date[unit + \"_start\"](new Date(end));\r\n\t\tif (+end != +start_interval) {\r\n\t\t\tend = gantt.date.add(start_interval, 1, unit);\r\n\t\t} else {\r\n\t\t\tend = start_interval;\r\n\t\t}\r\n\r\n\t\trange.end_date = end;\r\n\t}\r\n\treturn range;\r\n}\r\n\r\nfunction _scale_range_unit(gantt) {\r\n\tvar primaryScale = (new PrimaryScaleHelper(gantt)).primaryScale();\r\n\tvar unit = primaryScale.unit;\r\n\tvar step = primaryScale.step;\r\n\tif (gantt.config.scale_offset_minimal) {\r\n\r\n\t\tvar helper = new ScaleHelper(gantt);\r\n\t\tvar scales = [helper.primaryScale()].concat(helper.getSubScales());\r\n\r\n\t\thelper.sortScales(scales);\r\n\t\tunit = scales[scales.length - 1].unit;\r\n\t\tstep = scales[scales.length - 1].step || 1;\r\n\t}\r\n\treturn { unit:unit, step:step };\r\n}\r\n\r\nfunction _init_tasks_range(gantt) {\r\n\tvar cfg = _scale_range_unit(gantt);\r\n\tvar unit = cfg.unit,\r\n\t\tstep = cfg.step;\r\n\tvar range = resolveConfigRange(unit, gantt);\r\n\r\n\tif(!(range.start_date && range.end_date)){\r\n\t\trange = gantt.getSubtaskDates();\r\n\t\tif(!range.start_date || !range.end_date){\r\n\t\t\trange = {\r\n\t\t\t\tstart_date: new Date(),\r\n\t\t\t\tend_date: new Date()\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\trange.start_date = gantt.date[unit + \"_start\"](range.start_date);\r\n\t\trange.start_date = gantt.calculateEndDate({\r\n\t\t\tstart_date: gantt.date[unit + \"_start\"](range.start_date),\r\n\t\t\tduration: -1,\r\n\t\t\tunit: unit,\r\n\t\t\tstep:step\r\n\t\t});//one free column before first task\r\n\r\n\t\trange.end_date = gantt.date[unit + \"_start\"](range.end_date);\r\n\t\trange.end_date = gantt.calculateEndDate({start_date: range.end_date, duration: 2, unit: unit, step:step});//one free column after last task\r\n\t}\r\n\r\n\tgantt._min_date = range.start_date;\r\n\tgantt._max_date = range.end_date;\r\n}\r\n\r\nfunction _adjust_scales(gantt) {\r\n\tif (gantt.config.fit_tasks) {\r\n\t\tvar old_min = +gantt._min_date,\r\n\t\t\told_max = +gantt._max_date;\r\n\t\t//this._init_tasks_range();\r\n\t\tif (+gantt._min_date != old_min || +gantt._max_date != old_max) {\r\n\t\t\tgantt.render();\r\n\r\n\t\t\tgantt.callEvent(\"onScaleAdjusted\", []);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nmodule.exports = function updateTasksRange(gantt){\r\n\t_init_tasks_range(gantt);\r\n\t_adjust_scales(gantt);\r\n};\r\n","var powerArray = require(\"./power_array\");\r\nvar utils = require(\"../../utils/utils\");\r\nvar helpers = require(\"../../utils/helpers\");\r\nvar DataStore = require(\"./datastore\");\r\n\r\n// TODO: remove workaround for mixup with es5 and ts imports\r\nif(DataStore.default){\r\n\tDataStore = DataStore.default;\r\n}\r\n\r\nvar TreeDataStore = function(config){\r\n\tDataStore.apply(this, [config]);\r\n\tthis._branches = {};\r\n\r\n\tthis.pull = {};\r\n\tthis.$initItem = config.initItem;\r\n\tthis.$parentProperty = config.parentProperty || \"parent\";\r\n\r\n\tif(typeof config.rootId !== \"function\"){\r\n\t\tthis.$getRootId = (function(val){\r\n\t\t\treturn function(){return val;};\r\n\t\t})(config.rootId || 0);\r\n\t}else{\r\n\t\tthis.$getRootId = config.rootId;\r\n\t}\r\n\r\n\t// TODO: replace with live reference to gantt config\r\n\tthis.$openInitially = config.openInitially;\r\n\r\n\tthis.visibleOrder = powerArray.$create();\r\n\tthis.fullOrder = powerArray.$create();\r\n\tthis._searchVisibleOrder = {};\r\n\tthis._skip_refresh = false;\r\n\r\n\tthis._ganttConfig = null;\r\n\tif(config.getConfig){\r\n\t\tthis._ganttConfig = config.getConfig();\r\n\t}\r\n\r\n\tthis.attachEvent(\"onFilterItem\", function(id, item){\r\n\r\n\t\tvar canOpenSplitTasks = false;\r\n\t\tif(this._ganttConfig){\r\n\t\t\tvar canOpenSplitTasks = this._ganttConfig.open_split_tasks;\r\n\t\t}\r\n\r\n\t\tvar open = true;\r\n\t\tthis.eachParent(function(parent){\r\n\t\t\topen = open && parent.$open && (canOpenSplitTasks || !this._isSplitItem(parent));\r\n\t\t}, item);\r\n\t\treturn !!open;\r\n\t});\r\n\r\n\treturn this;\r\n};\r\n\r\nTreeDataStore.prototype = utils.mixin({\r\n\r\n\t\t_buildTree: function(data){\r\n\t\t\tvar item = null;\r\n\t\t\tvar rootId = this.$getRootId();\r\n\t\t\tfor (var i = 0, len = data.length; i < len; i++){\r\n\t\t\t\titem = data[i];\r\n\t\t\t\tthis.setParent(item, this.getParent(item) || rootId);\r\n\t\t\t}\r\n\r\n\t\t\t// calculating $level for each item\r\n\t\t\tfor (var i = 0, len = data.length; i < len; i++){\r\n\t\t\t\titem = data[i];\r\n\t\t\t\tthis._add_branch(item);\r\n\t\t\t\titem.$level = this.calculateItemLevel(item);\r\n\r\n\t\t\t\tif (!utils.defined(item.$open)) {\r\n\t\t\t\t\titem.$open = utils.defined(item.open) ? item.open : this.$openInitially();\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tthis._updateOrder();\r\n\t\t},\r\n\t\t_isSplitItem: function(item){\r\n\t\t\treturn (item.render == \"split\" && this.hasChild(item.id));\r\n\t\t},\r\n\t\tparse: function(data){\r\n\t\t\tthis.callEvent(\"onBeforeParse\", [data]);\r\n\t\t\tvar loaded = this._parseInner(data);\r\n\t\t\tthis._buildTree(loaded);\r\n\t\t\tthis.filter();\r\n\t\t\tthis.callEvent(\"onParse\", [loaded]);\r\n\t\t},\r\n\r\n\t\t_addItemInner: function(item, index){\r\n\r\n\t\t\tvar parent = this.getParent(item);\r\n\r\n\t\t\tif(!utils.defined(parent)){\r\n\t\t\t\tparent = this.$getRootId();\r\n\t\t\t\tthis.setParent(item, parent);\r\n\t\t\t}\r\n\r\n\t\t\tvar parentIndex = this.getIndexById(parent);\r\n\t\t\tvar targetIndex = parentIndex + Math.min(Math.max(index, 0), this.visibleOrder.length);\r\n\r\n\t\t\tif(targetIndex*1 !== targetIndex){\r\n\t\t\t\ttargetIndex = undefined;\r\n\t\t\t}\r\n\t\t\tDataStore.prototype._addItemInner.call(this, item, targetIndex);\r\n\t\t\tthis.setParent(item, parent);\r\n\r\n\t\t\tif(item.hasOwnProperty(\"$rendered_parent\")){\r\n\t\t\t\tthis._move_branch(item, item.$rendered_parent);\r\n\t\t\t}\r\n\t\t\tthis._add_branch(item, index);\r\n\t\t},\r\n\t\t_changeIdInner: function(oldId, newId){\r\n\t\t\tvar children = this.getChildren(oldId);\r\n\t\t\tvar visibleOrder = this._searchVisibleOrder[oldId];\r\n\r\n\t\t\tDataStore.prototype._changeIdInner.call(this, oldId, newId);\r\n\r\n\t\t\tvar parent = this.getParent(newId);\r\n\r\n\t\t\tthis._replace_branch_child(parent, oldId, newId);\r\n\t\t\tfor(var i = 0; i < children.length; i++){\r\n\t\t\t\tthis.setParent(this.getItem(children[i]), newId);\r\n\t\t\t}\r\n\r\n\t\t\tthis._searchVisibleOrder[newId] = visibleOrder;\r\n\t\t\tdelete this._branches[oldId];\r\n\t\t},\r\n\r\n\t\t_traverseBranches: function(code, parent){\r\n\t\t\tparent = parent || this.$getRootId();\r\n\t\t\tvar branch = this._branches[parent];\r\n\t\t\tif (branch) {\r\n\t\t\t\tfor (var i = 0; i < branch.length; i++) {\r\n\t\t\t\t\tvar itemId = branch[i];\r\n\t\t\t\t\tcode.call(this, itemId);\r\n\t\t\t\t\tif (this._branches[itemId])\r\n\t\t\t\t\t\tthis._traverseBranches(code, itemId);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t_updateOrder: function(code){\r\n\r\n\t\t\tthis.fullOrder = powerArray.$create();\r\n\t\t\tthis._traverseBranches(function(taskId){\r\n\t\t\t\tthis.fullOrder.push(taskId);\r\n\t\t\t});\r\n\r\n\t\t\tif(code)\r\n\t\t\t\tDataStore.prototype._updateOrder.call(this, code);\r\n\t\t},\r\n\r\n\t\t_removeItemInner: function(id){\r\n\r\n\t\t\tvar items = [];\r\n\t\t\tthis.eachItem(function(child){\r\n\t\t\t\titems.push(child);\r\n\t\t\t}, id);\r\n\r\n\t\t\titems.push(this.getItem(id));\r\n\r\n\t\t\tfor(var i = 0; i < items.length; i++){\r\n\r\n\t\t\t\tthis._move_branch(items[i], this.getParent(items[i]), null);\r\n\t\t\t\tDataStore.prototype._removeItemInner.call(this, items[i].id);\r\n\t\t\t\tthis._move_branch(items[i], this.getParent(items[i]), null);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tmove: function(sid, tindex, parent){\r\n\t\t\t//target id as 4th parameter\r\n\t\t\tvar id = arguments[3];\r\n\t\t\tif (id) {\r\n\t\t\t\tif (id === sid) return;\r\n\r\n\t\t\t\tparent = this.getParent(id);\r\n\t\t\t\ttindex = this.getBranchIndex(id);\r\n\t\t\t}\r\n\t\t\tif(sid == parent){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tparent = parent || this.$getRootId();\r\n\t\t\tvar source = this.getItem(sid);\r\n\t\t\tvar source_pid = this.getParent(source.id);\r\n\r\n\t\t\tvar tbranch = this.getChildren(parent);\r\n\r\n\t\t\tif (tindex == -1)\r\n\t\t\t\ttindex = tbranch.length + 1;\r\n\t\t\tif (source_pid == parent) {\r\n\t\t\t\tvar sindex = this.getBranchIndex(sid);\r\n\t\t\t\tif (sindex == tindex) return;\r\n\t\t\t}\r\n\r\n\t\t\tif(this.callEvent(\"onBeforeItemMove\", [sid, parent, tindex]) === false)\r\n\t\t\t\treturn false;\r\n\r\n\t\t\tthis._replace_branch_child(source_pid, sid);\r\n\t\t\ttbranch = this.getChildren(parent);\r\n\r\n\t\t\tvar tid = tbranch[tindex];\r\n\t\t\tif (!tid) //adding as last element\r\n\t\t\t\ttbranch.push(sid);\r\n\t\t\telse\r\n\t\t\t\ttbranch = tbranch.slice(0, tindex).concat([ sid ]).concat(tbranch.slice(tindex));\r\n\r\n\t\t\tthis.setParent(source, parent);\r\n\t\t\tthis._branches[parent] = tbranch;\r\n\r\n\t\t\tvar diff = this.calculateItemLevel(source) - source.$level;\r\n\t\t\tsource.$level += diff;\r\n\t\t\tthis.eachItem(function(item){\r\n\t\t\t\titem.$level += diff;\r\n\t\t\t}, source.id, this);\r\n\r\n\r\n\t\t\tthis._moveInner(this.getIndexById(sid), this.getIndexById(parent) + tindex);\r\n\r\n\t\t\tthis.callEvent(\"onAfterItemMove\", [sid, parent, tindex]);\r\n\t\t\tthis.refresh();\r\n\t\t},\r\n\r\n\t\tgetBranchIndex: function(id){\r\n\t\t\tvar branch = this.getChildren(this.getParent(id));\r\n\t\t\tfor (var i = 0; i < branch.length; i++)\r\n\t\t\t\tif (branch[i] == id)\r\n\t\t\t\t\treturn i;\r\n\r\n\t\t\treturn -1;\r\n\t\t},\r\n\t\thasChild: function(id){\r\n\t\t\treturn (utils.defined(this._branches[id]) && this._branches[id].length);\r\n\t\t},\r\n\t\tgetChildren: function(id){\r\n\t\t\treturn utils.defined(this._branches[id]) ? this._branches[id] : powerArray.$create();\r\n\t\t},\r\n\r\n\t\tisChildOf: function(childId, parentId){\r\n\t\t\tif (!this.exists(childId))\r\n\t\t\t\treturn false;\r\n\t\t\tif (parentId === this.$getRootId())\r\n\t\t\t\treturn true;\r\n\r\n\t\t\tif (!this.hasChild(parentId))\r\n\t\t\t\treturn false;\r\n\r\n\t\t\tvar item = this.getItem(childId);\r\n\t\t\tvar pid = this.getParent(childId);\r\n\r\n\t\t\tvar parent = this.getItem(parentId);\r\n\t\t\tif(parent.$level >= item.$level){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\twhile (item && this.exists(pid)) {\r\n\t\t\t\titem = this.getItem(pid);\r\n\r\n\t\t\t\tif (item && item.id == parentId)\r\n\t\t\t\t\treturn true;\r\n\t\t\t\tpid = this.getParent(item);\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t},\r\n\r\n\t\tgetSiblings: function(id){\r\n\t\t\tif(!this.exists(id)){\r\n\t\t\t\treturn powerArray.$create();\r\n\t\t\t}\r\n\t\t\tvar parent = this.getParent(id);\r\n\t\t\treturn this.getChildren(parent);\r\n\r\n\t\t},\r\n\t\tgetNextSibling: function(id){\r\n\t\t\tvar siblings = this.getSiblings(id);\r\n\t\t\tfor(var i= 0, len = siblings.length; i < len; i++){\r\n\t\t\t\tif(siblings[i] == id)\r\n\t\t\t\t\treturn siblings[i+1] || null;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\tgetPrevSibling: function(id){\r\n\t\t\tvar siblings = this.getSiblings(id);\r\n\t\t\tfor(var i= 0, len = siblings.length; i < len; i++){\r\n\t\t\t\tif(siblings[i] == id)\r\n\t\t\t\t\treturn siblings[i-1] || null;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\tgetParent: function(id){\r\n\t\t\tvar item = null;\r\n\t\t\tif(id.id !== undefined){\r\n\t\t\t\titem = id;\r\n\t\t\t}else{\r\n\t\t\t\titem = this.getItem(id);\r\n\t\t\t}\r\n\r\n\t\t\tvar parent;\r\n\t\t\tif(item){\r\n\t\t\t\tparent = item[this.$parentProperty];\r\n\t\t\t}else{\r\n\t\t\t\tparent = this.$getRootId();\r\n\t\t\t}\r\n\t\t\treturn parent;\r\n\r\n\t\t},\r\n\r\n\t\tclearAll: function(){\r\n\t\t\tthis._branches = {};\r\n\t\t\tDataStore.prototype.clearAll.call(this);\r\n\t\t},\r\n\r\n\t\tcalculateItemLevel: function(item){\r\n\t\t\tvar level = 0;\r\n\t\t\tthis.eachParent(function(){\r\n\t\t\t\tlevel++;\r\n\t\t\t}, item);\r\n\t\t\treturn level;\r\n\t\t},\r\n\r\n\t\t_setParentInner: function(item, new_pid, silent){\r\n\t\t\tif(!silent){\r\n\t\t\t\tif(item.hasOwnProperty(\"$rendered_parent\")){\r\n\t\t\t\t\tthis._move_branch(item, item.$rendered_parent, new_pid);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthis._move_branch(item, item[this.$parentProperty], new_pid);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\tsetParent: function(item, new_pid, silent){\r\n\t\t\tthis._setParentInner(item, new_pid, silent);\r\n\r\n\t\t\titem[this.$parentProperty] = new_pid;\r\n\t\t},\r\n\t\teachItem: function(code, parent){\r\n\t\t\tparent = parent || this.$getRootId();\r\n\r\n\r\n\t\t\tvar branch = this.getChildren(parent);\r\n\t\t\tif (branch)\r\n\t\t\t\tfor (var i=0; i b[field];\r\n\t\t\t\treturn result ? 1 : -1;\r\n\t\t\t}) : field;\r\n\r\n\t\t\tif (desc) {\r\n\t\t\t\tvar original_criteria = criteria;\r\n\t\t\t\tcriteria = function (a, b) {\r\n\t\t\t\t\treturn original_criteria(b, a);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tvar els = this.getChildren(parent);\r\n\r\n\t\t\tif (els){\r\n\t\t\t\tvar temp = [];\r\n\t\t\t\tfor (var i = els.length - 1; i >= 0; i--)\r\n\t\t\t\t\ttemp[i] = this.getItem(els[i]);\r\n\r\n\t\t\t\ttemp.sort(criteria);\r\n\r\n\t\t\t\tfor (var i = 0; i < temp.length; i++) {\r\n\t\t\t\t\tels[i] = temp[i].id;\r\n\t\t\t\t\tthis.sort(field, desc, els[i]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tfilter: function(rule){\r\n\t\t\tfor(var i in this.pull){\r\n\t\t\t\tif(this.pull[i].$rendered_parent !== this.getParent(this.pull[i])){\r\n\t\t\t\t\tthis._move_branch(this.pull[i], this.pull[i].$rendered_parent, this.getParent(this.pull[i]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn DataStore.prototype.filter.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\topen: function(id){\r\n\t\t\tif(this.exists(id)){\r\n\t\t\t\tthis.getItem(id).$open = true;\r\n\t\t\t\tthis.callEvent(\"onItemOpen\", [id]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tclose: function(id){\r\n\t\t\tif(this.exists(id)){\r\n\t\t\t\tthis.getItem(id).$open = false;\r\n\t\t\t\tthis.callEvent(\"onItemClose\", [id]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tdestructor: function(){\r\n\t\t\tDataStore.prototype.destructor.call(this);\r\n\t\t\tthis._branches = null;\r\n\t\t}\r\n\t},\r\n\tDataStore.prototype\r\n);\r\n\r\nmodule.exports = TreeDataStore;","var utils = require(\"../../utils/utils\");\r\n\r\nvar $powerArray = {\r\n\t$create: function(array){\r\n\t\treturn utils.mixin(array || [], this);\r\n\t},\r\n\t//remove element at specified position\r\n\t$removeAt:function(pos,len){\r\n\t\tif (pos>=0) this.splice(pos,(len||1));\r\n\t},\r\n\t//find element in collection and remove it\r\n\t$remove:function(value){\r\n\t\tthis.$removeAt(this.$find(value));\r\n\t},\r\n\t//add element to collection at specific position\r\n\t$insertAt:function(data,pos){\r\n\t\tif (!pos && pos!==0) \t//add to the end by default\r\n\t\t\tthis.push(data);\r\n\t\telse {\r\n\t\t\tvar b = this.splice(pos,(this.length-pos));\r\n\t\t\tthis[pos] = data;\r\n\t\t\tthis.push.apply(this,b); //reconstruct array without loosing this pointer\r\n\t\t}\r\n\t},\r\n\t//return index of element, -1 if it doesn't exists\r\n\t$find:function(data){\r\n\t\tfor (var i=0; i data_size){\r\n\t\t\t\t//dhx.log(\"Warning\",\"DataStore:add\",\"Index of out of bounds\");\r\n\t\t\t\tindex = Math.min(order.length,index);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t//gantt.assert(!this.exists(id), \"Not unique ID\");\r\n\r\n\t\tthis.pull[item.id]=item;\r\n\t\tif (!this._skip_refresh){\r\n\t\t\tthis._updateOrder(function(){\r\n\t\t\t\tif(this.$find(item.id) === -1)\r\n\t\t\t\t\tthis.$insertAt(item.id,index);\r\n\t\t\t});\r\n\t\t}\r\n\t\tthis.filter();\r\n\t\t//order.$insertAt(item.id,index);\r\n\t},\r\n\r\n\r\n\tisVisible: function(id){\r\n\t\treturn this.visibleOrder.$find(id) > -1;\r\n\t},\r\n\tgetVisibleItems: function(){\r\n\t\treturn this.getIndexRange();\r\n\t},\r\n\r\n\taddItem: function(item, index){\r\n\t\tif (!utils.defined(item.id))\r\n\t\t\titem.id = utils.uid();\r\n\r\n\t\tif(this.$initItem){\r\n\t\t\titem = this.$initItem(item);\r\n\t\t}\r\n\r\n\t\tif (!this._skip_refresh){\r\n\t\t\tif (this.callEvent(\"onBeforeAdd\", [item.id, item]) === false) return false;\r\n\t\t}\r\n\r\n\r\n\t\tthis._addItemInner(item, index);\r\n\r\n\t\tif (!this._skip_refresh){\r\n\t\t\tthis.callEvent(\"onAfterAdd\",[item.id, item]);\r\n\t\t\t//repaint signal\r\n\t\t\tthis.callEvent(\"onStoreUpdated\",[item.id,item,\"add\"]);\r\n\t\t}\r\n\t\treturn item.id;\r\n\t},\r\n\r\n\t_changeIdInner: function(oldId, newId){\r\n\t\tif(this.pull[oldId])\r\n\t\t\tthis.pull[newId] = this.pull[oldId];\r\n\r\n\t\tvar visibleOrder = this._searchVisibleOrder[oldId];\r\n\t\tthis.pull[newId].id = newId;\r\n\t\tthis._updateOrder(function(){\r\n\t\t\tthis[this.$find(oldId)] = newId;\r\n\t\t});\r\n\t\tthis._searchVisibleOrder[newId] = visibleOrder;\r\n\t\tdelete this._searchVisibleOrder[oldId];\r\n\r\n\t\t//this.visibleOrder[this.visibleOrder.$find(oldId)]=newId;\r\n\t\tdelete this.pull[oldId];\r\n\t},\r\n\tchangeId: function(oldId, newId){\r\n\t\tthis._changeIdInner(oldId, newId);\r\n\r\n\t\tthis.callEvent(\"onIdChange\", [oldId, newId]);\r\n\r\n\t},\r\n\texists: function(id){\r\n\t\treturn !!(this.pull[id]);\r\n\t},\r\n\r\n\t_moveInner: function(sindex, tindex){\r\n\t\tvar id = this.getIdByIndex(sindex);\r\n\r\n\t\tthis._updateOrder(function(){\r\n\t\t\tthis.$removeAt(sindex);\r\n\t\t\tthis.$insertAt(id,Math.min(this.length, tindex));\r\n\t\t});\r\n\t\t//this.visibleOrder.$removeAt(sindex);\t//remove at old position\r\n\t\t//if (sindex=0 && tindex>=0, \"DataStore::move\",\"Incorrect indexes\");\r\n\r\n\t\tvar id = this.getIdByIndex(sindex);\r\n\t\tvar obj = this.getItem(id);\r\n\t\tthis._moveInner(sindex, tindex);\r\n\r\n\r\n\t\tif (!this._skip_refresh) {\r\n\t\t\t//repaint signal\r\n\t\t\tthis.callEvent(\"onStoreUpdated\", [obj.id, obj, \"move\"]);\r\n\t\t}\r\n\t},\r\n\tclearAll: function(){\r\n\t\tthis.pull = {};\r\n\t\tthis.visibleOrder = powerArray.$create();\r\n\t\tthis.fullOrder = powerArray.$create();\r\n\t\tif (this._skip_refresh) return;\r\n\t\tthis.callEvent(\"onClearAll\",[]);\r\n\t\tthis.refresh();\r\n\t},\r\n\r\n\tsilent:function(code, master){\r\n\t\tthis._skip_refresh = true;\r\n\t\tcode.call(master||this);\r\n\t\tthis._skip_refresh = false;\r\n\t},\r\n\r\n\tarraysEqual: function (arr1, arr2) {\r\n\t\tif(arr1.length !== arr2.length)\r\n\t\t\treturn false;\r\n\t\tfor(var i = 0; i < arr1.length; i++) {\r\n\t\t\tif(arr1[i] !== arr2[i])\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t},\r\n\r\n\trefresh: function(id, quick){\r\n\t\tif (this._skip_refresh) return;\r\n\r\n\t\tvar args;\r\n\t\tif (id){\r\n\t\t\targs = [id, this.pull[id], \"paint\"];\r\n\t\t}else{\r\n\t\t\targs = [null,null,null];\r\n\t\t}\r\n\r\n\t\tif(this.callEvent(\"onBeforeStoreUpdate\", args) === false){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(id){\r\n\t\t\t// if item changes visible order (e.g. expand-collapse branch) - do a complete repaint\r\n\t\t\tif(!quick){\r\n\t\t\t\tvar oldOrder = this.visibleOrder;\r\n\t\t\t\tthis.filter();\r\n\t\t\t\tif(!this.arraysEqual(oldOrder, this.visibleOrder)){\r\n\t\t\t\t\tid = undefined;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}else{\r\n\t\t\tthis.filter();\r\n\t\t}\r\n\r\n\t\tif (id){\r\n\t\t\targs = [id, this.pull[id], \"paint\"];\r\n\t\t}else{\r\n\t\t\targs = [null,null,null];\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onStoreUpdated\",args);\r\n\t},\r\n\r\n\tcount: function(){\r\n\t\treturn this.fullOrder.length;\r\n\t},\r\n\tcountVisible: function(){\r\n\t\treturn this.visibleOrder.length;\r\n\t},\r\n\r\n\tsort: function(sort){},\r\n\r\n\tserialize: function(){},\r\n\r\n\teachItem: function(code){\r\n\t\tfor (var i=0; i 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","function checkTimeout(host, updPerSecond){\r\n\tif (!updPerSecond)\r\n\t\treturn true;\r\n\t\r\n\tif (host._on_timeout)\r\n\t\treturn false;\r\n\t\r\n\tvar timeout = Math.ceil(1000/updPerSecond);\r\n\tif (timeout < 2) return true;\r\n\r\n\tsetTimeout(function(){\r\n\t\tdelete host._on_timeout;\r\n\t}, timeout);\r\n\r\n\thost._on_timeout = true;\r\n\treturn true;\r\n}\r\n\r\nmodule.exports = checkTimeout;","var utils = require(\"../../../utils/utils\");\r\n\r\nfunction createScope(addEvent, removeEvent) {\r\n\taddEvent = addEvent || utils.event;\r\n\tremoveEvent = removeEvent || utils.eventRemove;\r\n\r\n\tvar handlers = [];\r\n\r\n\tvar eventScope = {\r\n\t\tattach: function(el, event, callback, capture){\r\n\t\t\thandlers.push({element: el, event:event, callback: callback, capture: capture});\r\n\t\t\taddEvent(el, event, callback, capture);\r\n\t\t},\r\n\t\tdetach: function(el, event, callback, capture){\r\n\t\t\tremoveEvent(el, event, callback, capture);\r\n\t\t\tfor(var i = 0; i < handlers.length; i++){\r\n\t\t\t\tvar handler = handlers[i];\r\n\t\t\t\tif (handler.element === el && handler.event === event && handler.callback === callback && handler.capture === capture) {\r\n\t\t\t\t\thandlers.splice(i, 1);\r\n\t\t\t\t\ti--;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\tdetachAll: function () {\r\n\t\t\tvar staticArray = handlers.slice();\r\n\t\t\t// original handlers array can be spliced on every iteration\r\n\t\t\tfor (var i = 0; i < staticArray.length; i++){\r\n\t\t\t\tvar handler = staticArray[i];\r\n\t\t\t\teventScope.detach(handler.element, handler.event, handler.callback, handler.capture);\r\n\t\t\t\teventScope.detach(handler.element, handler.event, handler.callback, undefined);\r\n\t\t\t\teventScope.detach(handler.element, handler.event, handler.callback, false);\r\n\t\t\t\teventScope.detach(handler.element, handler.event, handler.callback, true);\r\n\t\t\t}\r\n\t\t\thandlers.splice(0, handlers.length);\r\n\t\t},\r\n\t\textend: function(){\r\n\t\t\treturn createScope(this.event, this.eventRemove);\r\n\t\t}\r\n\t};\r\n\r\n\treturn eventScope;\r\n}\r\n\r\nmodule.exports = createScope;","module.exports = function(gantt){\r\n\t// TODO: why eslint fails on regexp?\r\n\t// eslint-disable-next-line no-control-regex\r\n\tvar htmlTags = new RegExp(\"<(?:.|\\n)*?>\", \"gm\");\r\n\tvar extraSpaces = new RegExp(\" +\", \"gm\");\r\n\r\n\tfunction stripHTMLLite(htmlText){\r\n\t\treturn (htmlText + \"\")\r\n\t\t\t.replace(htmlTags, \" \").\r\n\t\t\treplace(extraSpaces, \" \");\r\n\t}\r\n\r\n\tvar singleQuotes = new RegExp(\"'\", \"gm\");\r\n\tfunction escapeQuotes(text){\r\n\t\treturn (text + \"\").replace(singleQuotes, \"'\");\r\n\t}\r\n\r\n\tgantt._waiAria = {\r\n\t\tgetAttributeString: function(attr){\r\n\t\t\tvar attributes = [\" \"];\r\n\t\t\tfor(var i in attr){\r\n\t\t\t\tvar text = escapeQuotes(stripHTMLLite(attr[i]));\r\n\t\t\t\tattributes.push(i + \"='\" + text + \"'\");\r\n\t\t\t}\r\n\t\t\tattributes.push(\" \");\r\n\t\t\treturn attributes.join(\" \");\r\n\r\n\t\t},\r\n\r\n\t\tgetTimelineCellAttr:function(dateString){\r\n\r\n\t\t\treturn gantt._waiAria.getAttributeString({\"aria-label\": dateString});\r\n\t\t},\r\n\r\n\t\t_taskCommonAttr: function(task, div){\r\n\r\n\t\t\tif(!(task.start_date && task.end_date))\r\n\t\t\t\treturn;\r\n\r\n\t\t\tdiv.setAttribute(\"aria-label\", stripHTMLLite(gantt.templates.tooltip_text(task.start_date, task.end_date, task)));\r\n\r\n\t\t\tif(task.$dataprocessor_class){\r\n\t\t\t\tdiv.setAttribute(\"aria-busy\", true);\r\n\t\t\t}\r\n\r\n\t\t\tdiv.setAttribute(\"aria-selected\", gantt.isSelectedTask(task.id) ? \"true\" : \"false\");\r\n\t\t},\r\n\r\n\t\tsetTaskBarAttr: function(task, div){\r\n\t\t\tthis._taskCommonAttr(task, div);\r\n\r\n\t\t\tif(!gantt.isReadonly(task) && gantt.config.drag_move){\r\n\t\t\t\tif(task.id != gantt.getState().drag_id){\r\n\t\t\t\t\tdiv.setAttribute(\"aria-grabbed\", false);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdiv.setAttribute(\"aria-grabbed\", true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\ttaskRowAttr: function(task, div){\r\n\r\n\t\t\tthis._taskCommonAttr(task, div);\r\n\r\n\t\t\tif(!gantt.isReadonly(task) && gantt.config.order_branch){\r\n\t\t\t\tdiv.setAttribute(\"aria-grabbed\", false);\r\n\t\t\t}\r\n\r\n\t\t\tdiv.setAttribute(\"role\", \"row\");\r\n\r\n\t\t\tdiv.setAttribute(\"aria-level\", task.$level);\r\n\r\n\t\t\tif(gantt.hasChild(task.id)){\r\n\t\t\t\tdiv.setAttribute(\"aria-expanded\", task.$open ? \"true\" : \"false\");\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tlinkAttr: function(link, div){\r\n\r\n\t\t\tvar linkTypes = gantt.config.links;\r\n\r\n\t\t\tvar toStart = link.type == linkTypes.finish_to_start || link.type == linkTypes.start_to_start;\r\n\t\t\tvar fromStart = link.type == linkTypes.start_to_start || link.type == linkTypes.start_to_finish;\r\n\r\n\t\t\tvar content = gantt.locale.labels.link + \" \" + gantt.templates.drag_link(link.source, fromStart, link.target, toStart);\r\n\r\n\t\t\tdiv.setAttribute(\"aria-label\", stripHTMLLite(content));\r\n\t\t\tif(gantt.isReadonly(link)){\r\n\t\t\t\tdiv.setAttribute(\"aria-readonly\", true);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tgridSeparatorAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"role\", \"separator\");\r\n\t\t},\r\n\r\n\t\tlightboxHiddenAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"aria-hidden\", \"true\");\r\n\t\t},\r\n\r\n\t\tlightboxVisibleAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"aria-hidden\", \"false\");\r\n\t\t},\r\n\r\n\t\tlightboxAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"role\", \"dialog\");\r\n\t\t\tdiv.setAttribute(\"aria-hidden\", \"true\");\r\n\t\t\tdiv.firstChild.setAttribute(\"role\", \"heading\");\r\n\t\t},\r\n\r\n\t\tlightboxButtonAttrString:function(buttonName){\r\n\t\t\treturn this.getAttributeString({\"role\":\"button\", \"aria-label\":gantt.locale.labels[buttonName], \"tabindex\":\"0\"});\r\n\t\t},\r\n\r\n\t\tlightboxHeader: function(div, headerText){\r\n\t\t\tdiv.setAttribute(\"aria-label\", headerText);\r\n\t\t},\r\n\r\n\t\tlightboxSelectAttrString: function(time_option){\r\n\t\t\tvar label = \"\";\r\n\r\n\t\t\tswitch (time_option) {\r\n\t\t\t\tcase \"%Y\":\r\n\t\t\t\t\tlabel = gantt.locale.labels.years;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%m\":\r\n\t\t\t\t\tlabel = gantt.locale.labels.months;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%d\":\r\n\t\t\t\t\tlabel = gantt.locale.labels.days;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"%H:%i\":\r\n\t\t\t\t\tlabel = gantt.locale.labels.hours + gantt.locale.labels.minutes;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\treturn gantt._waiAria.getAttributeString({\"aria-label\": label});\r\n\t\t},\r\n\r\n\t\tlightboxDurationInputAttrString: function(section){\r\n\t\t\treturn this.getAttributeString({\"aria-label\": gantt.locale.labels.column_duration, \"aria-valuemin\": \"0\"});\r\n\t\t},\r\n\r\n\t\tgridAttrString: function(){\r\n\t\t\treturn [\" role='treegrid'\", gantt.config.multiselect ? \"aria-multiselectable='true'\" : \"aria-multiselectable='false'\", \" \"].join(\" \");\r\n\t\t},\r\n\r\n\r\n\t\tgridScaleRowAttrString: function(){\r\n\t\t\treturn \"role='row'\";\r\n\t\t},\r\n\r\n\t\tgridScaleCellAttrString: function(column, label){\r\n\t\t\tvar attrs = \"\";\r\n\t\t\tif(column.name == \"add\"){\r\n\t\t\t\tattrs = this.getAttributeString({\"role\":\"button\", \"aria-label\": gantt.locale.labels.new_task});\r\n\t\t\t}else{\r\n\r\n\t\t\t\tvar attributes = {\r\n\t\t\t\t\t\"role\":\"columnheader\",\r\n\t\t\t\t\t\"aria-label\": label\r\n\t\t\t\t};\r\n\r\n\t\t\t\tif(gantt._sort && gantt._sort.name == column.name){\r\n\t\t\t\t\tif(gantt._sort.direction == \"asc\"){\r\n\t\t\t\t\t\tattributes[\"aria-sort\"] = \"ascending\";\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tattributes[\"aria-sort\"] = \"descending\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tattrs = this.getAttributeString(attributes);\r\n\t\t\t}\r\n\t\t\treturn attrs;\r\n\t\t},\r\n\r\n\t\tgridDataAttrString: function(){\r\n\t\t\treturn \"role='rowgroup'\";\r\n\t\t},\r\n\r\n\t\tgridCellAttrString: function(column, textValue, task){\r\n\t\t\tvar attributes = {\"role\":\"gridcell\", \"aria-label\": textValue};\r\n\t\t\tif(!column.editor || gantt.isReadonly(task)){\r\n\t\t\t\tattributes[\"aria-readonly\"] = true;\r\n\t\t\t}\r\n\r\n\t\t\treturn this.getAttributeString(attributes);\r\n\t\t},\r\n\r\n\t\tgridAddButtonAttrString: function(column){\r\n\t\t\treturn this.getAttributeString({\"role\":\"button\", \"aria-label\": gantt.locale.labels.new_task});\r\n\t\t},\r\n\r\n\t\tmessageButtonAttrString: function(buttonLabel){\r\n\t\t\treturn \"tabindex='0' role='button' aria-label='\"+buttonLabel+\"'\";\r\n\t\t},\r\n\r\n\t\tmessageInfoAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"role\", \"alert\");\r\n\t\t\t//div.setAttribute(\"tabindex\", \"-1\");\r\n\t\t},\r\n\r\n\t\tmessageModalAttr: function(div, uid){\r\n\t\t\tdiv.setAttribute(\"role\", \"dialog\");\r\n\t\t\tif(uid){\r\n\t\t\t\tdiv.setAttribute(\"aria-labelledby\", uid);\r\n\t\t\t}\r\n\r\n\t\t//\tdiv.setAttribute(\"tabindex\", \"-1\");\r\n\t\t},\r\n\r\n\t\tquickInfoAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"role\", \"dialog\");\r\n\t\t},\r\n\r\n\t\tquickInfoHeaderAttrString: function(){\r\n\t\t\treturn \" role='heading' \";\r\n\t\t},\r\n\r\n\t\tquickInfoHeader: function(div, header){\r\n\t\t\tdiv.setAttribute(\"aria-label\", header);\r\n\t\t},\r\n\r\n\t\tquickInfoButtonAttrString: function(label){\r\n\t\t\treturn gantt._waiAria.getAttributeString({\"role\":\"button\", \"aria-label\":label, \"tabindex\":\"0\"});\r\n\t\t},\r\n\r\n\t\ttooltipAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"role\", \"tooltip\");\r\n\t\t},\r\n\r\n\t\ttooltipVisibleAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"aria-hidden\", \"false\");\r\n\t\t},\r\n\r\n\t\ttooltipHiddenAttr: function(div){\r\n\t\t\tdiv.setAttribute(\"aria-hidden\", \"true\");\r\n\t\t}\r\n\t};\r\n\r\n\tfunction isDisabled(){\r\n\t\treturn !gantt.config.wai_aria_attributes;\r\n\t}\r\n\r\n\tfor(var i in gantt._waiAria){\r\n\t\tgantt._waiAria[i] = (function(payload){\r\n\t\t\treturn function(){\r\n\t\t\t\tif(isDisabled()){\r\n\t\t\t\t\treturn \"\";\r\n\t\t\t\t}\r\n\t\t\t\treturn payload.apply(this, arguments);\r\n\t\t\t};\r\n\t\t})(gantt._waiAria[i]);\r\n\t}\r\n\r\n\r\n};","module.exports = function(gantt) {\r\n\r\n\tgantt._extend_to_optional = function (lightbox_block) {\r\n\r\n\t\tvar duration = lightbox_block;\r\n\t\tvar optional_time = {\r\n\t\t\trender: duration.render,\r\n\t\t\tfocus: duration.focus,\r\n\t\t\tset_value: function (node, value, task, section) {\r\n\t\t\t\tvar mapping = gantt._resolve_default_mapping(section);\r\n\t\t\t\tif (!task[mapping.start_date] || (mapping.start_date == \"start_date\" && this._isAllowedUnscheduledTask(task))) {\r\n\t\t\t\t\toptional_time.disable(node, section);\r\n\t\t\t\t\tvar val = {};\r\n\r\n\t\t\t\t\tfor (var i in mapping) {\r\n\t\t\t\t\t\t//take default values from the time control from task start/end dates\r\n\t\t\t\t\t\tval[mapping[i]] = task[i];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn duration.set_value.call(gantt, node, value, val, section);//set default value\r\n\t\t\t\t} else {\r\n\t\t\t\t\toptional_time.enable(node, section);\r\n\t\t\t\t\treturn duration.set_value.call(gantt, node, value, task, section);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tget_value: function (node, task, section) {\r\n\t\t\t\tif (section.disabled) {\r\n\t\t\t\t\treturn {start_date: null};\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn duration.get_value.call(gantt, node, task, section);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tupdate_block: function (node, section) {\r\n\t\t\t\tgantt.callEvent(\"onSectionToggle\", [gantt._lightbox_id, section]);\r\n\t\t\t\tnode.style.display = section.disabled ? \"none\" : \"block\";\r\n\r\n\t\t\t\tif (section.button) {\r\n\t\t\t\t\tvar button = node.previousSibling.querySelector(\".gantt_custom_button_label\"),\r\n\t\t\t\t\t\tlabels = gantt.locale.labels;\r\n\r\n\t\t\t\t\tvar button_text = section.disabled ? labels[section.name + \"_enable_button\"] : labels[section.name + \"_disable_button\"];\r\n\r\n\t\t\t\t\tbutton.innerHTML = button_text;\r\n\t\t\t\t}\r\n\t\t\t\tgantt.resizeLightbox();\r\n\t\t\t},\r\n\t\t\tdisable: function (node, section) {\r\n\t\t\t\tsection.disabled = true;\r\n\t\t\t\toptional_time.update_block(node, section);\r\n\r\n\t\t\t},\r\n\t\t\tenable: function (node, section) {\r\n\t\t\t\tsection.disabled = false;\r\n\t\t\t\toptional_time.update_block(node, section);\r\n\t\t\t},\r\n\t\t\tbutton_click: function (index, el, section, container) {\r\n\t\t\t\tif (gantt.callEvent(\"onSectionButton\", [gantt._lightbox_id, section]) === false) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar config = gantt._get_typed_lightbox_config()[index];\r\n\t\t\t\tif (config.disabled) {\r\n\t\t\t\t\toptional_time.enable(container, config);\r\n\t\t\t\t} else {\r\n\t\t\t\t\toptional_time.disable(container, config);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\treturn optional_time;\r\n\t};\r\n\r\n\tgantt.form_blocks.duration_optional = gantt._extend_to_optional(gantt.form_blocks.duration);\r\n\tgantt.form_blocks.time_optional = gantt._extend_to_optional(gantt.form_blocks.time);\r\n\r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./select_control\")(gantt);\r\n\r\n\tfunction TypeselectControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(TypeselectControl, _super);\r\n\r\n\tTypeselectControl.prototype.render = function(sns) {\r\n\t\tvar types = gantt.config.types,\r\n\t\t\tlocale = gantt.locale.labels,\r\n\t\t\toptions = [];\r\n\r\n\t\tvar filter = sns.filter || function (typeKey, typeValue) {\r\n\t\t\tif (!types.placeholder || typeValue !== types.placeholder) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\tfor (var i in types) {\r\n\t\t\tif (!filter(i, types[i]) === false) {\r\n\t\t\t\toptions.push({ key: types[i], label: locale[\"type_\" + i] });\r\n\t\t\t}\r\n\t\t}\r\n\t\tsns.options = options;\r\n\r\n\t\tvar oldOnChange = sns.onchange;\r\n\t\tsns.onchange = function () {\r\n\t\t\tgantt.changeLightboxType(this.value);\r\n\t\t\tif (typeof oldOnChange == 'function') {\r\n\t\t\t\toldOnChange.apply(this, arguments);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\treturn _super.prototype.render.apply(this, arguments);\r\n\t};\r\n\r\n\treturn TypeselectControl;\r\n};\r\n","var __extends = require(\"../../../../utils/extends\");\r\nvar htmlHelpers = require(\"../../utils/html_helpers\");\r\n\r\nmodule.exports = function (gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction ConstraintControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(ConstraintControl, _super);\r\n\r\n\tfunction isNonTimedConstraint(value) {\r\n\t\tif (!value || value === gantt.config.constraint_types.ASAP || value === gantt.config.constraint_types.ALAP) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction toggleTimeSelect(timeSelects, typeValue) {\r\n\t\tvar isNonTimed = isNonTimedConstraint(typeValue);\r\n\t\tfor (var i = 0; i < timeSelects.length; i++) {\r\n\t\t\ttimeSelects[i].disabled = isNonTimed;\r\n\t\t}\r\n\t}\r\n\r\n\tConstraintControl.prototype.render = function (sns) {\r\n\t\tvar height = (sns.height || 30) + \"px\";\r\n\t\tvar html = \"
\";\r\n\r\n\t\tvar options = [];\r\n\t\tfor (var i in gantt.config.constraint_types) {\r\n\t\t\toptions.push({ key: gantt.config.constraint_types[i], label: gantt.locale.labels[gantt.config.constraint_types[i]] });\r\n\t\t}\r\n\r\n\t\tsns.options = sns.options || options;\r\n\r\n\t\thtml += \"\" + htmlHelpers.getHtmlSelect(sns.options, [{ key: \"data-type\", value: \"constraint-type\" }]) + \"\";\r\n\r\n\t\tvar timeLabel = gantt.locale.labels[\"constraint_date\"] || \"Constraint date\";\r\n\t\thtml += \"\";\r\n\r\n\t\thtml += \"
\";\r\n\t\treturn html;\r\n\t};\r\n\r\n\tConstraintControl.prototype.set_value = function (node, value, task, config) {\r\n\t\tvar typeSelect = node.querySelector(\"[data-constraint-type-select] select\");\r\n\t\tvar timeSelects = node.querySelectorAll(\"[data-constraint-time-select] select\");\r\n\t\tvar map = config._time_format_order;\r\n\r\n\t\tvar mapping = gantt._resolve_default_mapping(config);\r\n\r\n\t\tif (!typeSelect._eventsInitialized) {\r\n\t\t\ttypeSelect.addEventListener(\"change\", function (e) {\r\n\t\t\t\ttoggleTimeSelect(timeSelects, e.target.value);\r\n\t\t\t});\r\n\t\t\ttypeSelect._eventsInitialized = true;\r\n\t\t}\r\n\r\n\t\tvar constraintDate = task[mapping.constraint_date] || new Date();\r\n\t\tgantt.form_blocks._fill_lightbox_select(timeSelects, 0, constraintDate, map, config);\r\n\r\n\t\tvar constraintType = task[mapping.constraint_type] || gantt.getConstraintType(task);\r\n\t\ttypeSelect.value = constraintType;\r\n\t\ttoggleTimeSelect(timeSelects, constraintType);\r\n\t};\r\n\r\n\tConstraintControl.prototype.get_value = function (node, task, config) {\r\n\t\tvar typeSelect = node.querySelector(\"[data-constraint-type-select] select\");\r\n\t\tvar timeSelects = node.querySelectorAll(\"[data-constraint-time-select] select\");\r\n\r\n\t\tvar constraintType = typeSelect.value;\r\n\t\tvar constraintDate = null;\r\n\t\tif (!isNonTimedConstraint(constraintType)) {\r\n\t\t\tconstraintDate = gantt.form_blocks.getTimePickerValue(timeSelects, config);\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tconstraint_type: constraintType,\r\n\t\t\tconstraint_date: constraintDate\r\n\t\t};\r\n\t};\r\n\r\n\tConstraintControl.prototype.focus = function (node) {\r\n\t\tgantt._focus(node.querySelector(\"select\"));\r\n\t};\r\n\r\n\treturn ConstraintControl;\r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./select_control\")(gantt);\r\n\r\n\tfunction ParentControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this; \r\n\r\n\t\treturn self; \r\n\t}\r\n\r\n\t__extends(ParentControl, _super);\r\n\r\n\r\n\tParentControl.prototype.render = function(sns) {\r\n\t\treturn _display(sns, false);\r\n\t};\r\n\r\n\tParentControl.prototype.set_value = function(node, value, ev, config) {\r\n\t\tvar tmpDom = document.createElement(\"div\");\r\n\t\ttmpDom.innerHTML = _display(config, ev.id);\r\n\t\tvar newOptions = tmpDom.removeChild(tmpDom.firstChild);\r\n\t\tnode.onselect = null;\r\n\t\tnode.parentNode.replaceChild(newOptions, node);\r\n\r\n\t\treturn gantt.form_blocks.select.set_value.apply(gantt, [newOptions, value, ev, config]);\r\n\t};\r\n\r\n\tfunction _display(config, item_id) {\r\n\t\tvar tasks = [],\r\n\t\t\toptions = [];\r\n\t\tif (item_id) {\r\n\t\t\ttasks = gantt.getTaskByTime();\r\n\t\t\tif (config.allow_root) {\r\n\t\t\t\ttasks.unshift({id: gantt.config.root_id, text: config.root_label || \"\"});\r\n\t\t\t}\r\n\t\t\ttasks = _filter(tasks, config, item_id);\r\n\t\t\tif (config.sort) {\r\n\t\t\t\ttasks.sort(config.sort);\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar text = config.template || gantt.templates.task_text;\r\n\t\tfor (var i = 0; i < tasks.length; i++) {\r\n\t\t\tvar label = text.apply(gantt, [tasks[i].start_date, tasks[i].end_date, tasks[i]]);\r\n\t\t\tif (label === undefined) {\r\n\t\t\t\tlabel = \"\";\r\n\t\t\t}\r\n\t\t\toptions.push({\r\n\t\t\t\tkey: tasks[i].id,\r\n\t\t\t\tlabel: label\r\n\t\t\t});\r\n\t\t}\r\n\t\tconfig.options = options;\r\n\t\tconfig.map_to = config.map_to || \"parent\";\r\n\t\treturn gantt.form_blocks.select.render.apply(this, arguments);\r\n\t}\r\n\r\n\tfunction _filter(options, config, item_id) {\r\n\t\tvar filter = config.filter || function() {\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\toptions = options.slice(0);\r\n\r\n\t\tfor (var i = 0; i < options.length; i++) {\r\n\t\t\tvar task = options[i];\r\n\t\t\tif (task.id == item_id || gantt.isChildOf(task.id, item_id) || filter(task.id, task) === false) {\r\n\t\t\t\toptions.splice(i, 1);\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\treturn ParentControl;\r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nvar DurationFormatterNumeric = require(\"../../../common/duration_formatter_numeric\").default;\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction DurationControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this; \r\n\r\n\t\treturn self; \r\n\t}\r\n\r\n\tfunction getFormatter(config) {\r\n\t\treturn config.formatter || new DurationFormatterNumeric();\r\n\t}\r\n\r\n\t__extends(DurationControl, _super);\r\n\r\n\tDurationControl.prototype.render = function(sns) {\r\n\t\tvar time = \"
\" + gantt.form_blocks.getTimePicker.call(this, sns) + \"
\";\r\n\t\tvar label = \" \"+ gantt.locale.labels[gantt.config.duration_unit + \"s\"] +\" \";\r\n\t\tvar singleDate = sns.single_date ? \" style='display:none'\" : \"\";\r\n\t\tvar readonly = sns.readonly ? \" disabled='disabled'\" : \"\";\r\n\t\tvar ariaAttr = gantt._waiAria.lightboxDurationInputAttrString(sns);\r\n\r\n\t\tvar durationInputClass = \"gantt_duration_value\";\r\n\t\tif(sns.formatter) {\r\n\t\t\tlabel = \"\";\r\n\t\t\tdurationInputClass += \" gantt_duration_value_formatted\" ;\r\n\t\t}\r\n\r\n\t\tvar duration = \"
\" +\r\n\t\t\t\"\" +\r\n\t\t\t\"\" +\r\n\t\t\t\"\"+label+\"\" +\r\n\t\t\t\"
\";\r\n\t\tvar html = \"
\" + time + \" \" + duration + \"
\";\r\n\t\treturn html;\r\n\t};\r\n\r\n\tDurationControl.prototype.set_value = function(node, value, ev, config) {\r\n\t\tvar s = node.getElementsByTagName(\"select\");\r\n\t\tvar inps = node.getElementsByTagName(\"input\");\r\n\t\tvar duration = inps[1];\r\n\t\tvar btns = [inps[0], inps[2]];\r\n\t\tvar endspan = node.getElementsByTagName(\"span\")[0];\r\n\t\tvar map = config._time_format_order;\r\n\t\tvar mapping;\r\n\t\tvar start_date;\r\n\t\tvar end_date;\r\n\t\tvar duration_val;\r\n\r\n\t\tfunction _calc_date() {\r\n\t\t\tvar start_date = _getStartDate.call(gantt, node, config);\r\n\t\t\tvar duration = _getDuration.call(gantt, node, config);\r\n\t\t\tvar end_date = gantt.calculateEndDate({start_date: start_date, duration: duration, task: ev});\r\n\r\n\t\t\tvar template = gantt.templates.task_end_date || gantt.templates.task_date;\r\n\t\t\tendspan.innerHTML = template(end_date);\r\n\t\t}\r\n\r\n\t\tfunction _change_duration(step) {\r\n\t\t\tvar value = duration.value;\r\n\r\n\t\t\tvalue = getFormatter(config).parse(value);\r\n\t\t\tif (window.isNaN(value))\r\n\t\t\t\tvalue = 0;\r\n\t\t\tvalue += step;\r\n\t\t\tif (value < 1) value = 1;\r\n\t\t\tduration.value = getFormatter(config).format(value);\r\n\t\t\t_calc_date();\r\n\t\t}\r\n\r\n\t\tbtns[0].onclick = gantt.bind(function() {\r\n\t\t\t_change_duration(-1 * gantt.config.duration_step);\r\n\t\t}, this);\r\n\t\tbtns[1].onclick = gantt.bind(function() {\r\n\t\t\t_change_duration(1 * gantt.config.duration_step);\r\n\t\t}, this);\r\n\t\ts[0].onchange = _calc_date;\r\n\t\ts[1].onchange = _calc_date;\r\n\t\ts[2].onchange = _calc_date;\r\n\t\tif (s[3]) s[3].onchange = _calc_date;\r\n\r\n\t\tduration.onkeydown = gantt.bind(function(e) {\r\n\t\t\tvar code; \r\n\r\n\t\t\te = e || window.event;\r\n\t\t\tcode = (e.charCode || e.keyCode || e.which);\r\n\t\t\t\r\n\t\t\tif (code == gantt.constants.KEY_CODES.DOWN) {\r\n\t\t\t\t_change_duration(-1 * gantt.config.duration_step);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tif (code == gantt.constants.KEY_CODES.UP) {\r\n\t\t\t\t_change_duration(1 * gantt.config.duration_step);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\twindow.setTimeout(_calc_date, 1);\r\n\t\t}, this);\r\n\r\n\t\tduration.onchange = gantt.bind(_calc_date, this);\r\n\r\n\t\tmapping = gantt._resolve_default_mapping(config);\r\n\t\tif (typeof(mapping) === \"string\") mapping = {start_date: mapping};\r\n\r\n\t\tstart_date = ev[mapping.start_date] || new Date();\r\n\t\tend_date = ev[mapping.end_date] || gantt.calculateEndDate({\r\n\t\t\tstart_date: start_date,\r\n\t\t\tduration: 1,\r\n\t\t\ttask: ev\r\n\t\t});\r\n\t\tduration_val = Math.round(ev[mapping.duration]) || gantt.calculateDuration({\r\n\t\t\tstart_date: start_date,\r\n\t\t\tend_date: end_date,\r\n\t\t\ttask: ev\r\n\t\t});\r\n\t\tduration_val = getFormatter(config).format(duration_val);\r\n\r\n\t\tgantt.form_blocks._fill_lightbox_select(s, 0, start_date, map, config);\r\n\t\tduration.value = duration_val;\r\n\t\t_calc_date();\r\n\t};\r\n\r\n\tDurationControl.prototype.get_value = function(node, ev, config) {\r\n\t\tvar startDate = _getStartDate(node, config);\r\n\t\tvar duration = _getDuration(node, config);\r\n\t\tvar endDate = gantt.calculateEndDate({start_date: startDate, duration: duration, task: ev});\r\n\r\n\t\tif (typeof gantt._resolve_default_mapping(config) == \"string\") {\r\n\t\t\treturn startDate;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tstart_date: startDate,\r\n\t\t\tend_date: endDate,\r\n\t\t\tduration: duration\r\n\t\t};\r\n\t};\r\n\r\n\tDurationControl.prototype.focus = function(node) {\r\n\t\tgantt._focus(node.getElementsByTagName(\"select\")[0]);\r\n\t};\r\n\r\n\r\n\tfunction _getStartDate(node, config) {\r\n\t\tvar s = node.getElementsByTagName(\"select\");\r\n\t\tvar map = config._time_format_order;\r\n\t\tvar hours = 0;\r\n\t\tvar minutes = 0;\r\n\r\n\t\tif (gantt.defined(map[3])) {\r\n\t\t\tvar input = s[map[3]];\r\n\t\t\tvar time = parseInt(input.value, 10);\r\n\t\t\tif (isNaN(time) && input.hasAttribute(\"data-value\")) {\r\n\t\t\t\ttime = parseInt(input.getAttribute(\"data-value\"), 10);\r\n\t\t\t}\r\n\r\n\t\t\thours = Math.floor(time / 60);\r\n\t\t\tminutes = time % 60;\r\n\t\t}\r\n\t\treturn new Date(s[map[2]].value, s[map[1]].value, s[map[0]].value, hours, minutes);\r\n\t}\r\n\r\n\tfunction _getDuration(node, config) {\r\n\t\tvar duration = node.getElementsByTagName(\"input\")[1];\r\n\r\n\t\tduration = getFormatter(config).parse(duration.value);\r\n\t\tif (!duration || window.isNaN(duration)) duration = 1;\r\n\t\tif (duration < 0) duration *= -1;\r\n\t\treturn duration;\r\n\t}\r\n\r\n\treturn DurationControl; \r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction RadioControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\r\n\t\treturn self; \r\n\t}\r\n\r\n\t__extends(RadioControl, _super);\r\n\r\n\tRadioControl.prototype.render = function(sns) {\r\n\t\tvar height = (sns.height || \"23\") + \"px\";\r\n\t\tvar html = \"
\";\r\n\r\n\t\tif (sns.options && sns.options.length) {\r\n\t\t\tfor (var i = 0; i < sns.options.length; i++) {\r\n\t\t\t\thtml += \"\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\thtml += \"
\";\r\n\t\treturn html;\r\n\t};\r\n\r\n\tRadioControl.prototype.set_value = function(node, value, ev, sns) {\r\n\t\tvar radio;\r\n\r\n\t\tif (!sns.options || !sns.options.length) return;\r\n\r\n\t\tradio = node.querySelector(\"input[type=radio][value='\" + value + \"']\") ||\r\n\t\t\t\tnode.querySelector(\"input[type=radio][value='\" + sns.default_value + \"']\");\r\n\r\n\t\tif (!radio) return;\r\n\r\n\t\tif (!node._dhx_onchange && sns.onchange) {\r\n\t\t\tnode.onchange = sns.onchange;\r\n\t\t\tnode._dhx_onchange = true;\r\n\t\t}\r\n\r\n\t\tradio.checked = true;\r\n\t};\r\n\r\n\tRadioControl.prototype.get_value = function(node, ev) {\r\n\t\tvar result = node.querySelector(\"input[type=radio]:checked\");\r\n\r\n\t\treturn result ? result.value : \"\";\r\n\t};\r\n\r\n\tRadioControl.prototype.focus = function(node) {\r\n\t\tgantt._focus(node.querySelector(\"input[type=radio]\"));\r\n\t};\r\n\r\n\treturn RadioControl;\r\n};","var helpers = require(\"../../../../utils/helpers\");\r\nvar __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction CheckboxControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\r\n\t\treturn self; \r\n\t}\r\n\r\n\t__extends(CheckboxControl, _super);\r\n\r\n\tCheckboxControl.prototype.render = function(sns) {\r\n\t\tvar height = (sns.height || \"23\") + \"px\";\r\n\t\tvar html = \"
\";\r\n\r\n\t\tif (sns.options && sns.options.length) {\r\n\t\t\tfor (var i = 0; i < sns.options.length; i++) {\r\n\t\t\t\thtml += \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t\thtml += \"
\";\r\n\t\treturn html;\r\n\t};\r\n\r\n\tCheckboxControl.prototype.set_value = function(node, value, ev, sns) {\r\n\t\tvar checkboxes = Array.prototype.slice.call(node.querySelectorAll(\"input[type=checkbox]\"));\r\n\r\n\t\tif (!node._dhx_onchange && sns.onchange) {\r\n\t\t\tnode.onchange = sns.onchange;\r\n\t\t\tnode._dhx_onchange = true;\r\n\t\t}\r\n\r\n\t\thelpers.forEach(checkboxes, function(entry) {\r\n\t\t\tentry.checked = value ? value.indexOf(entry.value) >= 0 : false;\r\n\t\t});\r\n\t};\r\n\r\n\tCheckboxControl.prototype.get_value = function(node) {\r\n\t\treturn helpers.arrayMap(Array.prototype.slice.call(node.querySelectorAll(\"input[type=checkbox]:checked\")), function(entry) {\r\n\t\t\treturn entry.value;\r\n\t\t});\r\n\t};\r\n\r\n\tCheckboxControl.prototype.focus = function(node) {\r\n\t\tgantt._focus(node.querySelector(\"input[type=checkbox]\"));\r\n\t};\r\n\r\n\treturn CheckboxControl;\r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function (gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction TimeControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(TimeControl, _super);\r\n\r\n\tTimeControl.prototype.render = function (sns) {\r\n\t\tvar time = gantt.form_blocks.getTimePicker.call(this, sns);\r\n\t\tvar html = \"
\";\r\n\t\thtml += time;\r\n\r\n\t\tif (sns.single_date) {\r\n\t\t\ttime = gantt.form_blocks.getTimePicker.call(this, sns, true);\r\n\t\t\thtml += \"\";\r\n\t\t} else {\r\n\t\t\thtml += \"  –  \";\r\n\t\t}\r\n\r\n\t\thtml += time;\r\n\t\thtml += \"
\";\r\n\t\treturn html;\r\n\t};\r\n\r\n\tTimeControl.prototype.set_value = function (node, value, ev, config) {\r\n\t\tvar cfg = config;\r\n\t\tvar s = node.getElementsByTagName(\"select\");\r\n\t\tvar map = config._time_format_order;\r\n\r\n\t\tif (cfg.auto_end_date) {\r\n\t\t\tvar _update_lightbox_select = function () {\r\n\t\t\t\tstart_date = new Date(s[map[2]].value, s[map[1]].value, s[map[0]].value, 0, 0);\r\n\t\t\t\tend_date = gantt.calculateEndDate({ start_date: start_date, duration: 1, task: ev });\r\n\t\t\t\tgantt.form_blocks._fill_lightbox_select(s, map.size, end_date, map, cfg);\r\n\t\t\t};\r\n\t\t\tfor (var i = 0; i < 4; i++) {\r\n\t\t\t\ts[i].onchange = _update_lightbox_select;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar mapping = gantt._resolve_default_mapping(config);\r\n\r\n\t\tif (typeof (mapping) === \"string\") mapping = { start_date: mapping };\r\n\r\n\t\tvar start_date = ev[mapping.start_date] || new Date();\r\n\t\tvar end_date = ev[mapping.end_date] || gantt.calculateEndDate({\r\n\t\t\tstart_date: start_date,\r\n\t\t\tduration: 1,\r\n\t\t\ttask: ev\r\n\t\t});\r\n\r\n\t\tgantt.form_blocks._fill_lightbox_select(s, 0, start_date, map, cfg);\r\n\t\tgantt.form_blocks._fill_lightbox_select(s, map.size, end_date, map, cfg);\r\n\t};\r\n\r\n\tTimeControl.prototype.get_value = function (node, ev, config) {\r\n\t\tvar selects = node.getElementsByTagName(\"select\");\r\n\t\tvar startDate;\r\n\t\tvar map = config._time_format_order;\r\n\t\tfunction _getEndDate(selects, map, startDate) {\r\n\t\t\tvar endDate = gantt.form_blocks.getTimePickerValue(selects, config, map.size);\r\n\r\n\t\t\tif (endDate <= startDate) {\r\n\t\t\t\treturn gantt.date.add(startDate, gantt._get_timepicker_step(), \"minute\");\r\n\t\t\t}\r\n\t\t\treturn endDate;\r\n\t\t}\r\n\r\n\t\tstartDate = gantt.form_blocks.getTimePickerValue(selects, config);\r\n\r\n\t\tif (typeof gantt._resolve_default_mapping(config) === \"string\") {\r\n\t\t\treturn startDate;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tstart_date: startDate,\r\n\t\t\tend_date: _getEndDate(selects, map, startDate)\r\n\t\t};\r\n\t};\r\n\r\n\tTimeControl.prototype.focus = function (node) {\r\n\t\tgantt._focus(node.getElementsByTagName(\"select\")[0]);\r\n\t};\r\n\r\n\treturn TimeControl;\r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction TextareaControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this;\r\n\r\n\t\treturn self; \r\n\t}\r\n\r\n\t__extends(TextareaControl, _super);\r\n\r\n\tTextareaControl.prototype.render = function(sns) {\r\n\t\tvar height = (sns.height || \"130\") + \"px\";\r\n\t\treturn \"
\";\r\n\t};\r\n\r\n\tTextareaControl.prototype.set_value = function(node, value) {\r\n\t\tgantt.form_blocks.textarea._get_input(node).value = value || \"\";\r\n\t};\r\n\r\n\tTextareaControl.prototype.get_value = function(node) {\r\n\t\treturn gantt.form_blocks.textarea._get_input(node).value;\r\n\t};\r\n\r\n\tTextareaControl.prototype.focus = function(node) {\r\n\t\tvar a = gantt.form_blocks.textarea._get_input(node);\r\n\t\tgantt._focus(a, true);\r\n\t};\r\n\r\n\tTextareaControl.prototype._get_input = function(node) {\r\n\t\treturn node.querySelector(\"textarea\");\r\n\t};\r\n\r\n\treturn TextareaControl;\r\n};","var __extends = require(\"../../../../utils/extends\");\r\n\r\nmodule.exports = function(gantt) {\r\n\tvar _super = require(\"./base_control\")(gantt);\r\n\r\n\tfunction TemplateControl() {\r\n\t\tvar self = _super.apply(this, arguments) || this; \r\n\t\treturn self; \r\n\t}\r\n\r\n\t__extends(TemplateControl, _super);\r\n\r\n\r\n\tTemplateControl.prototype.render = function(sns) {\r\n\t\tvar height = (sns.height || \"30\") + \"px\";\r\n\t\treturn \"
\";\r\n\t};\r\n\r\n\tTemplateControl.prototype.set_value = function(node, value) {\r\n\t\tnode.innerHTML = value || \"\";\r\n\t};\r\n\r\n\tTemplateControl.prototype.get_value = function(node) {\r\n\t\treturn node.innerHTML || \"\";\r\n\t};\r\n\r\n\tTemplateControl.prototype.focus = function() {};\r\n\r\n\treturn TemplateControl;\r\n};","module.exports = function (gantt) {\r\n\tvar domHelpers = require(\"../utils/dom_helpers\");\r\n\tvar helpers = require(\"../../../utils/helpers\");\r\n\r\n\tvar TemplateControl = require(\"./controls/template_control\")(gantt);\r\n\tvar TextareaControl = require(\"./controls/textarea_control\")(gantt);\r\n\tvar TimeControl = require(\"./controls/time_control\")(gantt);\r\n\tvar SelectControl = require(\"./controls/select_control\")(gantt);\r\n\tvar CheckboxControl = require(\"./controls/checkbox_control\")(gantt);\r\n\tvar RadioControl = require(\"./controls/radio_control\")(gantt);\r\n\tvar DurationControl = require(\"./controls/duration_control\")(gantt);\r\n\tvar ParentControl = require(\"./controls/parent_control\")(gantt);\r\n\tvar ResourcesControl = require(\"./controls/resources_control\")(gantt);\r\n\tvar ConstraintControl = require(\"./controls/constraint_control\")(gantt);\r\n\tvar TypeselectControl = require(\"./controls/typeselect_control\")(gantt);\r\n\r\n\tgantt._lightbox_methods = {};\r\n\tgantt._lightbox_template = \"
 
\";\r\n\r\n\r\n\t//TODO: gantt._lightbox_id is changed from data.js and accessed from autoscheduling, check if it can be removed from gantt object\r\n\tvar state = gantt.$services.getService(\"state\");\r\n\tstate.registerProvider(\"lightbox\", function () {\r\n\t\treturn {\r\n\t\t\tlightbox: gantt._lightbox_id\r\n\t\t};\r\n\t});\r\n\r\n\tgantt.showLightbox = function (id) {\r\n\t\tif (!this.callEvent(\"onBeforeLightbox\", [id])) return;\r\n\r\n\t\tvar task = this.getTask(id);\r\n\r\n\t\tvar box = this.getLightbox(this.getTaskType(task.type));\r\n\t\tthis._center_lightbox(box);\r\n\t\tthis.showCover();\r\n\t\tthis._fill_lightbox(id, box);\r\n\r\n\t\tthis._waiAria.lightboxVisibleAttr(box);\r\n\r\n\t\tthis.callEvent(\"onLightbox\", [id]);\r\n\t};\r\n\r\n\tfunction _is_chart_visible(gantt) {\r\n\t\tvar timeline = gantt.$ui.getView(\"timeline\");\r\n\t\tif (timeline && timeline.isVisible()) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tgantt._get_timepicker_step = function () {\r\n\t\tif (this.config.round_dnd_dates) {\r\n\t\t\tvar step;\r\n\t\t\tif (_is_chart_visible(this)) {\r\n\t\t\t\tvar scale = gantt.getScale();\r\n\t\t\t\tstep = (helpers.getSecondsInUnit(scale.unit) * scale.step) / 60;//timepicker step is measured in minutes\r\n\t\t\t}\r\n\r\n\t\t\tif (!step || step >= 60 * 24) {\r\n\t\t\t\tstep = this.config.time_step;\r\n\t\t\t}\r\n\t\t\treturn step;\r\n\t\t}\r\n\t\treturn this.config.time_step;\r\n\t};\r\n\tgantt.getLabel = function (property, key) {\r\n\t\tvar sections = this._get_typed_lightbox_config();\r\n\t\tfor (var i = 0; i < sections.length; i++) {\r\n\t\t\tif (sections[i].map_to == property) {\r\n\t\t\t\tvar options = sections[i].options;\r\n\t\t\t\tfor (var j = 0; j < options.length; j++) {\r\n\t\t\t\t\tif (options[j].key == key) {\r\n\t\t\t\t\t\treturn options[j].label;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn \"\";\r\n\t};\r\n\r\n\tgantt.updateCollection = function (list_name, collection) {\r\n\t\tcollection = collection.slice(0);\r\n\t\tvar list = gantt.serverList(list_name);\r\n\t\tif (!list) return false;\r\n\t\tlist.splice(0, list.length);\r\n\t\tlist.push.apply(list, collection || []);\r\n\t\tgantt.resetLightbox();\r\n\t};\r\n\tgantt.getLightboxType = function () {\r\n\t\treturn this.getTaskType(this._lightbox_type);\r\n\t};\r\n\tgantt.getLightbox = function (type) {\r\n\t\tvar lightboxDiv;\r\n\t\tvar fullWidth;\r\n\t\tvar html;\r\n\t\tvar sns;\r\n\t\tvar ds;\r\n\t\tvar classNames = \"\";\r\n\r\n\t\tif (type === undefined)\r\n\t\t\ttype = this.getLightboxType();\r\n\r\n\t\tif (!this._lightbox || this.getLightboxType() != this.getTaskType(type)) {\r\n\t\t\tthis._lightbox_type = this.getTaskType(type);\r\n\t\t\tlightboxDiv = document.createElement(\"div\");\r\n\t\t\tclassNames = \"gantt_cal_light\";\r\n\t\t\tfullWidth = this._is_lightbox_timepicker();\r\n\r\n\t\t\tif (gantt.config.wide_form || fullWidth)\r\n\t\t\t\tclassNames += \" gantt_cal_light_wide\";\r\n\r\n\t\t\tif (fullWidth) {\r\n\t\t\t\tgantt.config.wide_form = true;\r\n\t\t\t\tclassNames += \" gantt_cal_light_full\";\r\n\t\t\t}\r\n\r\n\t\t\tlightboxDiv.className = classNames;\r\n\r\n\t\t\tlightboxDiv.style.visibility = \"hidden\";\r\n\t\t\thtml = this._lightbox_template;\r\n\r\n\t\t\thtml += getHtmlButtons(this.config.buttons_left);\r\n\t\t\thtml += getHtmlButtons(this.config.buttons_right, true);\r\n\r\n\t\t\tlightboxDiv.innerHTML = html;\r\n\r\n\t\t\tgantt._waiAria.lightboxAttr(lightboxDiv);\r\n\r\n\t\t\tif (gantt.config.drag_lightbox) {\r\n\t\t\t\tlightboxDiv.firstChild.onmousedown = gantt._ready_to_dnd;\r\n\t\t\t\tlightboxDiv.firstChild.onselectstart = function () {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t};\r\n\t\t\t\tlightboxDiv.firstChild.style.cursor = \"pointer\";\r\n\t\t\t\tgantt._init_dnd_events();\r\n\t\t\t}\r\n\r\n\t\t\tdocument.body.insertBefore(lightboxDiv, document.body.firstChild);\r\n\t\t\tthis._lightbox = lightboxDiv;\r\n\r\n\t\t\tsns = this._get_typed_lightbox_config(type);\r\n\t\t\thtml = this._render_sections(sns);\r\n\r\n\t\t\tds = lightboxDiv.querySelector(\"div.gantt_cal_larea\");\r\n\t\t\tds.innerHTML = html;\r\n\r\n\t\t\tbindLabelsToInputs(sns);\r\n\r\n\t\t\t//sizes\r\n\t\t\tthis.resizeLightbox();\r\n\r\n\t\t\tthis._init_lightbox_events(this);\r\n\t\t\tlightboxDiv.style.display = \"none\";\r\n\t\t\tlightboxDiv.style.visibility = \"visible\";\r\n\t\t}\r\n\t\treturn this._lightbox;\r\n\t};\r\n\r\n\tgantt._render_sections = function (sns) {\r\n\t\tvar html = \"\";\r\n\t\tfor (var i = 0; i < sns.length; i++) {\r\n\t\t\tvar block = this.form_blocks[sns[i].type];\r\n\t\t\tif (!block) continue; //ignore incorrect blocks\r\n\t\t\tsns[i].id = \"area_\" + this.uid();\r\n\r\n\t\t\tvar display = sns[i].hidden ? \" style='display:none'\" : \"\";\r\n\t\t\tvar button = \"\";\r\n\t\t\tif (sns[i].button) {\r\n\t\t\t\tbutton = \"
\" + this.locale.labels[\"button_\" + sns[i].button] + \"
\";\r\n\t\t\t}\r\n\t\t\tif (this.config.wide_form) {\r\n\t\t\t\thtml += \"
\";\r\n\t\t\t}\r\n\t\t\thtml += \"
\" + block.render.call(this, sns[i]);\r\n\t\t\thtml += \"
\";\r\n\t\t}\r\n\t\treturn html;\r\n\t};\r\n\r\n\r\n\tgantt.resizeLightbox = function () {\r\n\t\tif (!this._lightbox) return;\r\n\r\n\t\tvar con = this._lightbox.childNodes[1];\r\n\t\tcon.style.height = \"0px\";\r\n\t\tcon.style.height = con.scrollHeight + \"px\";\r\n\t\tthis._lightbox.style.height = con.scrollHeight + this.config.lightbox_additional_height + \"px\";\r\n\t\tcon.style.height = con.scrollHeight + \"px\"; //it is incredible , how ugly IE can be\r\n\t};\r\n\r\n\tgantt._center_lightbox = function (box) {\r\n\t\tif (box) {\r\n\t\t\tbox.style.display = \"block\";\r\n\r\n\t\t\tvar scroll_top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;\r\n\t\t\tvar scroll_left = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;\r\n\r\n\t\t\tvar view_height = window.innerHeight || document.documentElement.clientHeight;\r\n\r\n\t\t\tif (scroll_top) // if vertical scroll on window\r\n\t\t\t\tbox.style.top = Math.round(scroll_top + Math.max((view_height - box.offsetHeight) / 2, 0)) + \"px\";\r\n\t\t\telse // vertical scroll on body\r\n\t\t\t\tbox.style.top = Math.round(Math.max(((view_height - box.offsetHeight) / 2), 0) + 9) + \"px\"; // +9 for compatibility with auto tests\r\n\r\n\t\t\t// not quite accurate but used for compatibility reasons\r\n\t\t\tif (document.documentElement.scrollWidth > document.body.offsetWidth) // if horizontal scroll on the window\r\n\t\t\t\tbox.style.left = Math.round(scroll_left + (document.body.offsetWidth - box.offsetWidth) / 2) + \"px\";\r\n\t\t\telse // horizontal scroll on the body\r\n\t\t\t\tbox.style.left = Math.round((document.body.offsetWidth - box.offsetWidth) / 2) + \"px\";\r\n\t\t}\r\n\t};\r\n\tgantt.showCover = function () {\r\n\t\tif (this._cover) return;\r\n\r\n\t\tthis._cover = document.createElement(\"DIV\");\r\n\t\tthis._cover.className = \"gantt_cal_cover\";\r\n\t\tvar _document_height = ((document.height !== undefined) ? document.height : document.body.offsetHeight);\r\n\t\tvar _scroll_height = ((document.documentElement) ? document.documentElement.scrollHeight : 0);\r\n\t\tthis._cover.style.height = Math.max(_document_height, _scroll_height) + \"px\";\r\n\t\tdocument.body.appendChild(this._cover);\r\n\t};\r\n\r\n\r\n\tgantt._init_lightbox_events = function () {\r\n\t\tgantt.lightbox_events = {};\r\n\r\n\r\n\t\tgantt.lightbox_events.gantt_save_btn = function () {\r\n\t\t\tgantt._save_lightbox();\r\n\t\t};\r\n\r\n\r\n\t\tgantt.lightbox_events.gantt_delete_btn = function () {\r\n\t\t\tif (!gantt.callEvent(\"onLightboxDelete\", [gantt._lightbox_id]))\r\n\t\t\t\treturn;\r\n\r\n\t\t\tif (gantt.isTaskExists(gantt._lightbox_id)) {\r\n\t\t\t\tgantt.$click.buttons[\"delete\"](gantt._lightbox_id);\r\n\t\t\t} else {\r\n\t\t\t\tgantt.hideLightbox();\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\r\n\t\tgantt.lightbox_events.gantt_cancel_btn = function () {\r\n\t\t\tgantt._cancel_lightbox();\r\n\t\t};\r\n\r\n\r\n\t\tgantt.lightbox_events[\"default\"] = function (e, src) {\r\n\t\t\tif (src.getAttribute(\"data-dhx-button\")) {\r\n\t\t\t\tgantt.callEvent(\"onLightboxButton\", [src.className, src, e]);\r\n\t\t\t} else {\r\n\t\t\t\tvar index, block, sec;\r\n\r\n\t\t\t\tvar className = domHelpers.getClassName(src);\r\n\t\t\t\tif (className.indexOf(\"gantt_custom_button\") != -1) {\r\n\t\t\t\t\tif (className.indexOf(\"gantt_custom_button_\") != -1) {\r\n\t\t\t\t\t\tindex = src.parentNode.getAttribute(\"data-index\");\r\n\t\t\t\t\t\tsec = src;\r\n\t\t\t\t\t\twhile (sec && domHelpers.getClassName(sec).indexOf(\"gantt_cal_lsection\") == -1) {\r\n\t\t\t\t\t\t\tsec = sec.parentNode;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tindex = src.getAttribute(\"data-index\");\r\n\t\t\t\t\t\tsec = src.parentNode;\r\n\t\t\t\t\t\tsrc = src.firstChild;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar sections = gantt._get_typed_lightbox_config();\r\n\r\n\t\t\t\tif (index) {\r\n\t\t\t\t\tindex = index * 1;\r\n\t\t\t\t\tblock = gantt.form_blocks[sections[index * 1].type];\r\n\t\t\t\t\tblock.button_click(index, src, sec, sec.nextSibling);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.event(gantt.getLightbox(), \"click\", function (e) {\r\n\t\t\te = e || window.event;\r\n\t\t\tvar src = e.target ? e.target : e.srcElement;\r\n\r\n\t\t\tvar className = domHelpers.getClassName(src);\r\n\t\t\tif (!className) {\r\n\t\t\t\tsrc = src.previousSibling;\r\n\t\t\t\tclassName = domHelpers.getClassName(src);\r\n\t\t\t}\r\n\t\t\tif (src && className && className.indexOf(\"gantt_btn_set\") === 0) {\r\n\t\t\t\tsrc = src.firstChild;\r\n\t\t\t\tclassName = domHelpers.getClassName(src);\r\n\t\t\t}\r\n\t\t\tif (src && className) {\r\n\t\t\t\tvar func = gantt.defined(gantt.lightbox_events[src.className]) ? gantt.lightbox_events[src.className] : gantt.lightbox_events[\"default\"];\r\n\t\t\t\treturn func(e, src);\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\tgantt.getLightbox().onkeydown = function (e) {\r\n\t\t\tvar event = e || window.event;\r\n\t\t\tvar target = e.target || e.srcElement;\r\n\t\t\tvar buttonTarget = domHelpers.getClassName(target).indexOf(\"gantt_btn_set\") > -1;\r\n\r\n\t\t\tswitch ((e || event).keyCode) {\r\n\t\t\t\tcase gantt.constants.KEY_CODES.SPACE: {\r\n\t\t\t\t\tif ((e || event).shiftKey) return;\r\n\t\t\t\t\tif (buttonTarget && target.click) {\r\n\t\t\t\t\t\ttarget.click();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tcase gantt.keys.edit_save:\r\n\t\t\t\t\tif ((e || event).shiftKey) return;\r\n\t\t\t\t\tif (buttonTarget && target.click) {\r\n\t\t\t\t\t\ttarget.click();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tgantt._save_lightbox();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase gantt.keys.edit_cancel:\r\n\t\t\t\t\tgantt._cancel_lightbox();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\r\n\tgantt._cancel_lightbox = function () {\r\n\t\tvar task = this.getLightboxValues();\r\n\t\tthis.callEvent(\"onLightboxCancel\", [this._lightbox_id, task.$new]);\r\n\t\tif (gantt.isTaskExists(task.id) && task.$new) {\r\n\t\t\tthis.silent(function () {\r\n\t\t\t\tgantt.$data.tasksStore.removeItem(task.id);\r\n\t\t\t\tgantt._update_flags(task.id, null);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tthis.refreshData();\r\n\t\tthis.hideLightbox();\r\n\t};\r\n\r\n\tgantt._save_lightbox = function () {\r\n\t\tvar task = this.getLightboxValues();\r\n\t\tif (!this.callEvent(\"onLightboxSave\", [this._lightbox_id, task, !!task.$new]))\r\n\t\t\treturn;\r\n\r\n\t\tif (task.$new) {\r\n\t\t\tdelete task.$new;\r\n\t\t\tthis.addTask(task, task.parent, this.getTaskIndex(task.id));\r\n\t\t} else if (this.isTaskExists(task.id)) {\r\n\t\t\tthis.mixin(this.getTask(task.id), task, true);\r\n\t\t\tthis.refreshTask(task.id);\r\n\t\t\tthis.updateTask(task.id);\r\n\t\t}\r\n\t\tthis.refreshData();\r\n\r\n\t\t// TODO: do we need any blockable events here to prevent closing lightbox?\r\n\t\tthis.hideLightbox();\r\n\t};\r\n\r\n\tgantt._resolve_default_mapping = function (section) {\r\n\t\tvar mapping = section.map_to;\r\n\t\tvar time_controls = { \"time\": true, \"time_optional\": true, \"duration\": true, \"duration_optional\": true };\r\n\t\tif (time_controls[section.type]) {\r\n\t\t\tif (section.map_to == \"auto\") {\r\n\t\t\t\tmapping = { start_date: \"start_date\", end_date: \"end_date\", duration: \"duration\" };\r\n\t\t\t} else if (typeof (section.map_to) === \"string\") {\r\n\t\t\t\tmapping = { start_date: section.map_to };\r\n\t\t\t}\r\n\t\t} else if (section.type === \"constraint\") {\r\n\t\t\tif (!section.map_to || typeof (section.map_to) === \"string\") {\r\n\t\t\t\tmapping = { constraint_type: \"constraint_type\", constraint_date: \"constraint_date\" };\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn mapping;\r\n\t};\r\n\r\n\tgantt.getLightboxValues = function () {\r\n\t\tvar task = {};\r\n\r\n\t\tif (gantt.isTaskExists(this._lightbox_id)) {\r\n\t\t\ttask = this.mixin({}, this.getTask(this._lightbox_id));\r\n\t\t}\r\n\r\n\t\tvar sns = this._get_typed_lightbox_config();\r\n\t\tfor (var i = 0; i < sns.length; i++) {\r\n\t\t\tvar node = document.getElementById(sns[i].id);\r\n\t\t\tnode = (node ? node.nextSibling : node);\r\n\t\t\tvar block = this.form_blocks[sns[i].type];\r\n\t\t\tif (!block) continue;\r\n\t\t\tvar res = block.get_value.call(this, node, task, sns[i]);\r\n\t\t\tvar map_to = gantt._resolve_default_mapping(sns[i]);\r\n\t\t\tif (typeof map_to == \"string\" && map_to != \"auto\") {\r\n\t\t\t\ttask[map_to] = res;\r\n\t\t\t} else if (typeof map_to == \"object\") {\r\n\t\t\t\tfor (var property in map_to) {\r\n\t\t\t\t\tif (map_to[property])\r\n\t\t\t\t\t\ttask[map_to[property]] = res[property];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn task;\r\n\t};\r\n\r\n\r\n\tgantt.hideLightbox = function () {\r\n\t\tvar box = this.getLightbox();\r\n\t\tif (box) box.style.display = \"none\";\r\n\r\n\t\tthis._waiAria.lightboxHiddenAttr(box);\r\n\t\tthis._lightbox_id = null;\r\n\r\n\t\tthis.hideCover();\r\n\t\tthis.callEvent(\"onAfterLightbox\", []);\r\n\t};\r\n\tgantt.hideCover = function () {\r\n\t\tif (this._cover)\r\n\t\t\tthis._cover.parentNode.removeChild(this._cover);\r\n\t\tthis._cover = null;\r\n\t};\r\n\r\n\tgantt.resetLightbox = function () {\r\n\t\tif (gantt._lightbox && !gantt._custom_lightbox)\r\n\t\t\tgantt._lightbox.parentNode.removeChild(gantt._lightbox);\r\n\t\tgantt._lightbox = null;\r\n\t\tgantt.hideCover();\r\n\t};\r\n\tgantt._set_lightbox_values = function (data, box) {\r\n\t\tvar task = data;\r\n\t\tvar s = box.getElementsByTagName(\"span\");\r\n\t\tvar lightboxHeader = [];\r\n\t\tif (gantt.templates.lightbox_header) {\r\n\t\t\tlightboxHeader.push(\"\");\r\n\t\t\tlightboxHeader.push(gantt.templates.lightbox_header(task.start_date, task.end_date, task));\r\n\t\t\ts[1].innerHTML = \"\";\r\n\t\t\ts[2].innerHTML = gantt.templates.lightbox_header(task.start_date, task.end_date, task);\r\n\t\t} else {\r\n\t\t\tlightboxHeader.push(this.templates.task_time(task.start_date, task.end_date, task));\r\n\t\t\tlightboxHeader.push(String(this.templates.task_text(task.start_date, task.end_date, task) || \"\").substr(0, 70)); //IE6 fix\r\n\t\t\ts[1].innerHTML = this.templates.task_time(task.start_date, task.end_date, task);\r\n\t\t\ts[2].innerHTML = String(this.templates.task_text(task.start_date, task.end_date, task) || \"\").substr(0, 70); //IE6 fix\r\n\t\t}\r\n\t\ts[1].innerHTML = lightboxHeader[0];\r\n\t\ts[2].innerHTML = lightboxHeader[1];\r\n\r\n\t\tgantt._waiAria.lightboxHeader(box, lightboxHeader.join(\" \"));\r\n\r\n\t\tvar sns = this._get_typed_lightbox_config(this.getLightboxType());\r\n\t\tfor (var i = 0; i < sns.length; i++) {\r\n\t\t\tvar section = sns[i];\r\n\r\n\t\t\tif (!this.form_blocks[section.type]) {\r\n\t\t\t\tcontinue;//skip incorrect sections, same check is done during rendering\r\n\t\t\t}\r\n\r\n\r\n\t\t\tvar node = document.getElementById(section.id).nextSibling;\r\n\t\t\tvar block = this.form_blocks[section.type];\r\n\t\t\tvar map_to = gantt._resolve_default_mapping(sns[i]);\r\n\t\t\tvar value = this.defined(task[map_to]) ? task[map_to] : section.default_value;\r\n\t\t\tblock.set_value.call(gantt, node, value, task, section);\r\n\r\n\t\t\tif (section.focus)\r\n\t\t\t\tblock.focus.call(gantt, node);\r\n\t\t}\r\n\t\tif (data.id)\r\n\t\t\tgantt._lightbox_id = data.id;\r\n\t};\r\n\tgantt._fill_lightbox = function (id, box) {\r\n\t\tvar task = this.getTask(id);\r\n\t\tthis._set_lightbox_values(task, box);\r\n\t};\r\n\r\n\r\n\tgantt.getLightboxSection = function (name) {\r\n\t\tvar config = this._get_typed_lightbox_config();\r\n\t\tvar i = 0;\r\n\t\tfor (i; i < config.length; i++)\r\n\t\t\tif (config[i].name == name)\r\n\t\t\t\tbreak;\r\n\t\tvar section = config[i];\r\n\t\tif (!section)\r\n\t\t\treturn null;\r\n\r\n\t\tif (!this._lightbox)\r\n\t\t\tthis.getLightbox();\r\n\t\tvar header = document.getElementById(section.id);\r\n\t\tvar node = header.nextSibling;\r\n\r\n\t\tvar result = {\r\n\t\t\tsection: section,\r\n\t\t\theader: header,\r\n\t\t\tnode: node,\r\n\t\t\tgetValue: function (ev) {\r\n\t\t\t\treturn gantt.form_blocks[section.type].get_value.call(gantt, node, (ev || {}), section);\r\n\t\t\t},\r\n\t\t\tsetValue: function (value, ev) {\r\n\t\t\t\treturn gantt.form_blocks[section.type].set_value.call(gantt, node, value, (ev || {}), section);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar handler = this._lightbox_methods[\"get_\" + section.type + \"_control\"];\r\n\t\treturn handler ? handler(result) : result;\r\n\t};\r\n\r\n\tgantt._lightbox_methods.get_template_control = function (result) {\r\n\t\tresult.control = result.node;\r\n\t\treturn result;\r\n\t};\r\n\tgantt._lightbox_methods.get_select_control = function (result) {\r\n\t\tresult.control = result.node.getElementsByTagName(\"select\")[0];\r\n\t\treturn result;\r\n\t};\r\n\tgantt._lightbox_methods.get_textarea_control = function (result) {\r\n\t\tresult.control = result.node.getElementsByTagName(\"textarea\")[0];\r\n\t\treturn result;\r\n\t};\r\n\tgantt._lightbox_methods.get_time_control = function (result) {\r\n\t\tresult.control = result.node.getElementsByTagName(\"select\"); // array\r\n\t\treturn result;\r\n\t};\r\n\r\n\r\n\tgantt._init_dnd_events = function () {\r\n\t\tthis.event(document.body, \"mousemove\", gantt._move_while_dnd);\r\n\t\tthis.event(document.body, \"mouseup\", gantt._finish_dnd);\r\n\t\tgantt._init_dnd_events = function () {\r\n\t\t};\r\n\t};\r\n\tgantt._move_while_dnd = function (event) {\r\n\t\tif (gantt._dnd_start_lb) {\r\n\t\t\tif (!document.gantt_unselectable) {\r\n\t\t\t\tdocument.body.className += \" gantt_unselectable\";\r\n\t\t\t\tdocument.gantt_unselectable = true;\r\n\t\t\t}\r\n\t\t\tvar lb = gantt.getLightbox();\r\n\t\t\tvar now = [event.pageX, event.pageY];\r\n\t\t\tlb.style.top = gantt._lb_start[1] + now[1] - gantt._dnd_start_lb[1] + \"px\";\r\n\t\t\tlb.style.left = gantt._lb_start[0] + now[0] - gantt._dnd_start_lb[0] + \"px\";\r\n\t\t}\r\n\t};\r\n\tgantt._ready_to_dnd = function (event) {\r\n\t\tvar lb = gantt.getLightbox();\r\n\t\tgantt._lb_start = [parseInt(lb.style.left, 10), parseInt(lb.style.top, 10)];\r\n\t\tgantt._dnd_start_lb = [event.pageX, event.pageY];\r\n\t};\r\n\tgantt._finish_dnd = function () {\r\n\t\tif (gantt._lb_start) {\r\n\t\t\tgantt._lb_start = gantt._dnd_start_lb = false;\r\n\t\t\tdocument.body.className = document.body.className.replace(\" gantt_unselectable\", \"\");\r\n\t\t\tdocument.gantt_unselectable = false;\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tgantt._focus = function (node, select) {\r\n\t\tif (node && node.focus) {\r\n\t\t\tif (gantt.config.touch) {\r\n\t\t\t\t//do not focus editor, to prevent auto-zoom\r\n\t\t\t} else {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif (select && node.select) node.select();\r\n\t\t\t\t\tnode.focus();\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\t// silent errors\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tgantt.form_blocks = {\r\n\t\tgetTimePicker: function (sns, hidden) {\r\n\t\t\tvar html = \"\";\r\n\t\t\tvar cfg = this.config;\r\n\t\t\tvar i;\r\n\t\t\tvar options;\r\n\t\t\tvar ariaAttrs;\r\n\t\t\tvar readonly;\r\n\t\t\tvar display;\r\n\t\t\tvar settings = {\r\n\t\t\t\tfirst: 0,\r\n\t\t\t\tlast: 24 * 60,\r\n\t\t\t\tdate: this.date.date_part(new Date(gantt._min_date.valueOf())),\r\n\t\t\t\ttimeFormat: getTimeFormat(sns)\r\n\t\t\t};\r\n\r\n\t\t\t// map: default order => real one\r\n\t\t\tsns._time_format_order = { size: 0 };\r\n\r\n\t\t\tif (gantt.config.limit_time_select) {\r\n\t\t\t\tsettings.first = 60 * cfg.first_hour;\r\n\t\t\t\tsettings.last = 60 * cfg.last_hour + 1;\r\n\t\t\t\tsettings.date.setHours(cfg.first_hour);\r\n\t\t\t}\r\n\r\n\t\t\tfor (i = 0; i < settings.timeFormat.length; i++) {\r\n\t\t\t\t// adding spaces between selects\r\n\t\t\t\tif (i > 0) {\r\n\t\t\t\t\thtml += \" \";\r\n\t\t\t\t}\r\n\r\n\t\t\t\toptions = getHtmlTimePickerOptions(sns, i, settings);\r\n\r\n\t\t\t\tif (options) {\r\n\t\t\t\t\tariaAttrs = gantt._waiAria.lightboxSelectAttrString(settings.timeFormat[i]);\r\n\t\t\t\t\treadonly = sns.readonly ? \"disabled='disabled'\" : \"\";\r\n\t\t\t\t\tdisplay = hidden ? \" style='display:none' \" : \"\";\r\n\t\t\t\t\thtml += \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn html;\r\n\t\t},\r\n\t\tgetTimePickerValue: function (selects, config, offset) {\r\n\t\t\tvar map = config._time_format_order;\r\n\t\t\tvar needSetTime = gantt.defined(map[3]);\r\n\r\n\t\t\tvar time;\r\n\t\t\tvar hours = 0;\r\n\t\t\tvar minutes = 0;\r\n\r\n\t\t\tvar mapOffset = offset || 0;\r\n\r\n\t\t\tif (needSetTime) {\r\n\t\t\t\ttime = parseInt(selects[map[3] + mapOffset].value, 10);\r\n\t\t\t\thours = Math.floor(time / 60);\r\n\t\t\t\tminutes = time % 60;\r\n\t\t\t}\r\n\t\t\treturn new Date(selects[map[2] + mapOffset].value, selects[map[1] + mapOffset].value, selects[map[0] + mapOffset].value, hours, minutes);\r\n\t\t},\r\n\r\n\t\t_fill_lightbox_select: function (s, i, d, map) {\r\n\t\t\ts[i + map[0]].value = d.getDate();\r\n\t\t\ts[i + map[1]].value = d.getMonth();\r\n\t\t\ts[i + map[2]].value = d.getFullYear();\r\n\t\t\tif (gantt.defined(map[3])) {\r\n\t\t\t\tvar v = d.getHours() * 60 + d.getMinutes();\r\n\t\t\t\tv = Math.round(v / gantt._get_timepicker_step()) * gantt._get_timepicker_step();\r\n\t\t\t\tvar input = s[i + map[3]];\r\n\t\t\t\tinput.value = v;\r\n\t\t\t\t//in case option not shown\r\n\t\t\t\tinput.setAttribute(\"data-value\", v);\r\n\t\t\t}\r\n\t\t},\r\n\t\ttemplate: new TemplateControl(),\r\n\t\ttextarea: new TextareaControl(),\r\n\t\tselect: new SelectControl(),\r\n\t\ttime: new TimeControl(),\r\n\t\tduration: new DurationControl(),\r\n\t\tparent: new ParentControl(),\r\n\t\tradio: new RadioControl(),\r\n\t\tcheckbox: new CheckboxControl(),\r\n\t\tresources: new ResourcesControl(),\r\n\t\tconstraint: new ConstraintControl(),\r\n\t\ttypeselect: new TypeselectControl()\r\n\t};\r\n\r\n\tgantt._is_lightbox_timepicker = function () {\r\n\t\tvar s = this._get_typed_lightbox_config();\r\n\t\tfor (var i = 0; i < s.length; i++)\r\n\t\t\tif (s[i].name == \"time\" && s[i].type == \"time\")\r\n\t\t\t\treturn true;\r\n\t\treturn false;\r\n\t};\r\n\r\n\tgantt._dhtmlx_confirm = function (message, title, callback, ok) {\r\n\t\tif (!message)\r\n\t\t\treturn callback();\r\n\t\tvar opts = { text: message };\r\n\t\tif (title)\r\n\t\t\topts.title = title;\r\n\t\tif (ok) {\r\n\t\t\topts.ok = ok;\r\n\t\t}\r\n\t\tif (callback) {\r\n\t\t\topts.callback = function (result) {\r\n\t\t\t\tif (result)\r\n\t\t\t\t\tcallback();\r\n\t\t\t};\r\n\t\t}\r\n\t\tgantt.confirm(opts);\r\n\t};\r\n\r\n\tfunction _get_type_name(type_value) {\r\n\t\tfor (var i in this.config.types) {\r\n\t\t\tif (this.config.types[i] == type_value) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn \"task\";\r\n\t}\r\n\r\n\tgantt._get_typed_lightbox_config = function (type) {\r\n\t\tif (type === undefined) {\r\n\t\t\ttype = this.getLightboxType();\r\n\t\t}\r\n\r\n\t\tvar field = _get_type_name.call(this, type);\r\n\r\n\t\tif (gantt.config.lightbox[field + \"_sections\"]) {\r\n\t\t\treturn gantt.config.lightbox[field + \"_sections\"];\r\n\t\t} else {\r\n\t\t\treturn gantt.config.lightbox.sections;\r\n\t\t}\r\n\t};\r\n\r\n\tgantt._silent_redraw_lightbox = function (type) {\r\n\t\tvar oldType = this.getLightboxType();\r\n\r\n\t\tif (this.getState().lightbox) {\r\n\t\t\tvar taskId = this.getState().lightbox;\r\n\t\t\tvar formData = this.getLightboxValues(),\r\n\t\t\t\ttask = this.copy(this.getTask(taskId));\r\n\r\n\t\t\tthis.resetLightbox();\r\n\r\n\t\t\tvar updTask = this.mixin(task, formData, true);\r\n\t\t\tvar box = this.getLightbox(type ? type : undefined);\r\n\t\t\tthis._center_lightbox(this.getLightbox());\r\n\t\t\tthis._set_lightbox_values(updTask, box);\r\n\t\t\tthis.showCover();\r\n\t\t} else {\r\n\t\t\tthis.resetLightbox();\r\n\t\t\tthis.getLightbox(type ? type : undefined);\r\n\t\t}\r\n\t\tthis.callEvent(\"onLightboxChange\", [oldType, this.getLightboxType()]);\r\n\t};\r\n\r\n\tfunction bindLabelsToInputs(sns) {\r\n\t\tvar section;\r\n\t\tvar label;\r\n\t\tvar labelBlock;\r\n\t\tvar inputBlock;\r\n\t\tvar input;\r\n\t\tvar i;\r\n\r\n\t\tfor (i = 0; i < sns.length; i++) {\r\n\t\t\tsection = sns[i];\r\n\t\t\tlabelBlock = document.getElementById(section.id);\r\n\r\n\t\t\tif (!section.id || !labelBlock) continue;\r\n\r\n\t\t\tlabel = labelBlock.querySelector(\"label\");\r\n\t\t\tinputBlock = labelBlock.nextSibling;\r\n\r\n\t\t\tif (!inputBlock) continue;\r\n\r\n\t\t\tinput = inputBlock.querySelector(\"input, select, textarea\");\r\n\t\t\tif (input) {\r\n\t\t\t\tinput.id = input.id || \"input_\" + gantt.uid();\r\n\t\t\t\tsection.inputId = input.id;\r\n\t\t\t\tlabel.setAttribute(\"for\", section.inputId);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction getHtmlButtons(buttons, floatRight) {\r\n\t\tvar button;\r\n\t\tvar ariaAttr;\r\n\t\tvar html = \"\";\r\n\t\tvar i;\r\n\r\n\t\tfor (i = 0; i < buttons.length; i++) {\r\n\t\t\t// needed to migrate from 'dhx_something' to 'gantt_something' naming in a lightbox\r\n\t\t\tbutton = gantt.config._migrate_buttons[buttons[i]] ? gantt.config._migrate_buttons[buttons[i]] : buttons[i];\r\n\r\n\t\t\tariaAttr = gantt._waiAria.lightboxButtonAttrString(button);\r\n\t\t\thtml += \"
\" + gantt.locale.labels[button] + \"
\";\r\n\t\t}\r\n\t\treturn html;\r\n\t}\r\n\r\n\tfunction getTimeFormat(sns) {\r\n\t\tvar scale;\r\n\t\tvar unit;\r\n\t\tvar result;\r\n\r\n\t\tif (sns.time_format) return sns.time_format;\r\n\r\n\t\t// default order\r\n\t\tresult = [\"%d\", \"%m\", \"%Y\"];\r\n\t\tscale = gantt.getScale();\r\n\t\tunit = scale ? scale.unit : gantt.config.duration_unit;\r\n\t\tif (helpers.getSecondsInUnit(unit) < helpers.getSecondsInUnit(\"day\")) {\r\n\t\t\tresult.push(\"%H:%i\");\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\tfunction getHtmlTimePickerOptions(sns, index, settings) {\r\n\t\tvar range;\r\n\t\tvar offset;\r\n\t\tvar start_year;\r\n\t\tvar end_year;\r\n\t\tvar i;\r\n\t\tvar time;\r\n\t\tvar diff;\r\n\t\tvar tdate;\r\n\t\tvar html = \"\";\r\n\r\n\t\tswitch (settings.timeFormat[index]) {\r\n\t\t\tcase \"%Y\":\r\n\t\t\t\tsns._time_format_order[2] = index;\r\n\t\t\t\tsns._time_format_order.size++;\r\n\t\t\t\t//year\r\n\r\n\t\t\t\tif (sns.year_range) {\r\n\t\t\t\t\tif (!isNaN(sns.year_range)) {\r\n\t\t\t\t\t\trange = sns.year_range;\r\n\t\t\t\t\t} else if (sns.year_range.push) {\r\n\t\t\t\t\t\t// if\r\n\t\t\t\t\t\tstart_year = sns.year_range[0];\r\n\t\t\t\t\t\tend_year = sns.year_range[1];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\trange = range || 10;\r\n\t\t\t\toffset = offset || Math.floor(range / 2);\r\n\t\t\t\tstart_year = start_year || settings.date.getFullYear() - offset;\r\n\t\t\t\tend_year = end_year || start_year + range;\r\n\r\n\t\t\t\tfor (i = start_year; i < end_year; i++)\r\n\t\t\t\t\thtml += \"\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%m\":\r\n\t\t\t\tsns._time_format_order[1] = index;\r\n\t\t\t\tsns._time_format_order.size++;\r\n\t\t\t\t//month\r\n\t\t\t\tfor (i = 0; i < 12; i++)\r\n\t\t\t\t\thtml += \"\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%d\":\r\n\t\t\t\tsns._time_format_order[0] = index;\r\n\t\t\t\tsns._time_format_order.size++;\r\n\t\t\t\t//days\r\n\t\t\t\tfor (i = 1; i < 32; i++)\r\n\t\t\t\t\thtml += \"\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"%H:%i\":\r\n\t\t\t\t// var last = 24*60, first = 0;\r\n\t\t\t\tsns._time_format_order[3] = index;\r\n\t\t\t\tsns._time_format_order.size++;\r\n\t\t\t\t//hours\r\n\t\t\t\ti = settings.first;\r\n\t\t\t\ttdate = settings.date.getDate();\r\n\t\t\t\tsns._time_values = [];\r\n\r\n\t\t\t\twhile (i < settings.last) {\r\n\t\t\t\t\ttime = gantt.templates.time_picker(settings.date);\r\n\t\t\t\t\thtml += \"\";\r\n\t\t\t\t\tsns._time_values.push(i);\r\n\t\t\t\t\tsettings.date.setTime(settings.date.valueOf() + gantt._get_timepicker_step() * 60 * 1000);\r\n\t\t\t\t\tdiff = (settings.date.getDate() != tdate) ? 1 : 0; // moved or not to the next day\r\n\t\t\t\t\ti = diff * 24 * 60 + settings.date.getHours() * 60 + settings.date.getMinutes();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn html;\r\n\t}\r\n};","module.exports = function(gantt) {\r\n\r\n\tgantt.config.touch_drag = 500; //nearly immediate dnd\r\n\tgantt.config.touch = true;\r\n\tgantt.config.touch_feedback = true;\r\n\tgantt.config.touch_feedback_duration = 1;\r\n\tgantt._prevent_touch_scroll = false;\r\n\r\n\r\n\tgantt._touch_feedback = function () {\r\n\t\tif (gantt.config.touch_feedback) {\r\n\t\t\tif (navigator.vibrate)\r\n\t\t\t\tnavigator.vibrate(gantt.config.touch_feedback_duration);\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.attachEvent(\"onGanttReady\", gantt.bind(function(){\r\n\t\tif (this.config.touch != \"force\")\r\n\t\t\tthis.config.touch = this.config.touch &&\r\n\t\t\t\t((navigator.userAgent.indexOf(\"Mobile\") != -1) ||\r\n\t\t\t\t\t(navigator.userAgent.indexOf(\"iPad\") != -1) ||\r\n\t\t\t\t\t(navigator.userAgent.indexOf(\"Android\") != -1) ||\r\n\t\t\t\t\t(navigator.userAgent.indexOf(\"Touch\") != -1));\r\n\r\n\t\tif (this.config.touch) {\r\n\r\n\t\t\tvar touchEventsSupported = true;\r\n\t\t\ttry {\r\n\t\t\t\tdocument.createEvent(\"TouchEvent\");\r\n\t\t\t} catch (e) {\r\n\t\t\t\ttouchEventsSupported = false;\r\n\t\t\t}\r\n\r\n\t\t\tif (touchEventsSupported) {\r\n\t\t\t\tthis._touch_events([\"touchmove\", \"touchstart\", \"touchend\"], function (ev) {\r\n\t\t\t\t\tif (ev.touches && ev.touches.length > 1) return null;\r\n\t\t\t\t\tif (ev.touches[0])\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\ttarget: ev.target,\r\n\t\t\t\t\t\t\tpageX: ev.touches[0].pageX,\r\n\t\t\t\t\t\t\tpageY: ev.touches[0].pageY,\r\n\t\t\t\t\t\t\tclientX: ev.touches[0].clientX,\r\n\t\t\t\t\t\t\tclientY: ev.touches[0].clientY\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\treturn ev;\r\n\t\t\t\t}, function () {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t});\r\n\t\t\t} else if (window.navigator.pointerEnabled) {\r\n\t\t\t\tthis._touch_events([\"pointermove\", \"pointerdown\", \"pointerup\"], function (ev) {\r\n\t\t\t\t\tif (ev.pointerType == \"mouse\") return null;\r\n\t\t\t\t\treturn ev;\r\n\t\t\t\t}, function (ev) {\r\n\t\t\t\t\treturn (!ev || (ev.pointerType == \"mouse\" ));\r\n\t\t\t\t});\r\n\t\t\t} else if (window.navigator.msPointerEnabled) {\r\n\t\t\t\tthis._touch_events([\"MSPointerMove\", \"MSPointerDown\", \"MSPointerUp\"], function (ev) {\r\n\t\t\t\t\tif (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE) return null;\r\n\t\t\t\t\treturn ev;\r\n\t\t\t\t}, function (ev) {\r\n\t\t\t\t\treturn (!ev || ev.pointerType == ev.MSPOINTER_TYPE_MOUSE);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}, gantt));\r\n\r\n\r\n\tfunction getTaskDND(){\r\n\t\tvar _tasks_dnd;\r\n\t\tif(gantt.$ui.getView(\"timeline\")){\r\n\t\t\t_tasks_dnd = gantt.$ui.getView(\"timeline\")._tasks_dnd;\r\n\t\t}\r\n\t\treturn _tasks_dnd;\r\n\t}\r\n\r\n\tvar touchHandlers = [];\r\n\r\n//we can't use native scrolling, as we need to sync momentum between different parts\r\n//so we will block native scroll and use the custom one\r\n//in future we can add custom momentum\r\n\tgantt._touch_events = function (names, accessor, ignore) {\r\n\t\t//webkit on android need to be handled separately\r\n\t\tvar dblclicktime = 0;\r\n\t\tvar action_mode = false;\r\n\t\tvar scroll_mode = false;\r\n\t\tvar action_start = null;\r\n\t\tvar scroll_state;\r\n\t\tvar long_tap_timer = null;\r\n\t\tvar current_target = null;\r\n\r\n\r\n\r\n\t\tfor(var i = 0; i < touchHandlers.length; i++){\r\n\t\t\tgantt.eventRemove(touchHandlers[i][0], touchHandlers[i][1], touchHandlers[i][2]);\r\n\t\t}\r\n\t\ttouchHandlers = [];\r\n\r\n\t\t//touch move\r\n\t\ttouchHandlers.push([gantt.$container, names[0], function (e) {\r\n\t\t\tvar _tasks_dnd = getTaskDND();\r\n\r\n\t\t\t\tif (ignore(e)) return;\r\n\r\n\t\t\t\t//ignore common and scrolling moves\r\n\t\t\t\tif (!action_mode) return;\r\n\r\n\t\t\t\tif (long_tap_timer) clearTimeout(long_tap_timer);\r\n\r\n\t\t\t\tvar source = accessor(e);\r\n\t\t\t\tif (_tasks_dnd && (_tasks_dnd.drag.id || _tasks_dnd.drag.start_drag)) {\r\n\t\t\t\t\t_tasks_dnd.on_mouse_move(source);\r\n\t\t\t\t\tif (e.preventDefault)\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.cancelBubble = true;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!gantt._prevent_touch_scroll) {\r\n\t\t\t\t\tif (source && action_start) {\r\n\t\t\t\t\t\tvar dx = action_start.pageX - source.pageX;\r\n\t\t\t\t\t\tvar dy = action_start.pageY - source.pageY;\r\n\t\t\t\t\t\tif (!scroll_mode && (Math.abs(dx) > 5 || Math.abs(dy) > 5)) {\r\n\t\t\t\t\t\t\tgantt._touch_scroll_active = scroll_mode = true;\r\n\t\t\t\t\t\t\tdblclicktime = 0;\r\n\t\t\t\t\t\t\tscroll_state = gantt.getScrollState();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (scroll_mode) {\r\n\t\t\t\t\t\t\tgantt.scrollTo(scroll_state.x + dx, scroll_state.y + dy);\r\n\t\t\t\t\t\t\tvar new_scroll_state = gantt.getScrollState();\r\n\r\n\t\t\t\t\t\t\tif ((scroll_state.x != new_scroll_state.x && dy > 2 * dx) ||\r\n\t\t\t\t\t\t\t\t(scroll_state.y != new_scroll_state.y && dx > 2 * dy )) {\r\n\t\t\t\t\t\t\t\treturn block_action(e);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn block_action(e);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}]);\r\n\r\n\r\n\t\t//block touch context menu in IE10\r\n\t\ttouchHandlers.push([this.$container, \"contextmenu\", function (e) {\r\n\t\t\tif (action_mode)\r\n\t\t\t\treturn block_action(e);\r\n\t\t}]);\r\n\r\n\t\t//touch start\r\n\t\ttouchHandlers.push([this.$container, names[1], function (e) {\r\n\t\t\tif (ignore(e)) return;\r\n\t\t\tif (e.touches && e.touches.length > 1) {\r\n\t\t\t\taction_mode = false;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\taction_start = accessor(e);\r\n\t\t\tif (!gantt._locate_css(action_start, \"gantt_hor_scroll\") && !gantt._locate_css(action_start, \"gantt_ver_scroll\")) {\r\n\t\t\t\taction_mode = true;\r\n\t\t\t}\r\n\t\t\tvar _tasks_dnd = getTaskDND();\r\n\r\n\t\t\t//long tap\r\n\t\t\tlong_tap_timer = setTimeout(function () {\r\n\t\t\t\tvar taskId = gantt.locate(action_start);\r\n\t\t\t\tif (_tasks_dnd && (taskId && !gantt._locate_css(action_start, \"gantt_link_control\") && !gantt._locate_css(action_start, \"gantt_grid_data\"))) {\r\n\t\t\t\t\t_tasks_dnd.on_mouse_down(action_start);\r\n\r\n\t\t\t\t\tif (_tasks_dnd.drag && _tasks_dnd.drag.start_drag) {\r\n\t\t\t\t\t\tcloneTaskRendered(taskId);\r\n\t\t\t\t\t\t_tasks_dnd._start_dnd(action_start);\r\n\t\t\t\t\t\tgantt._touch_drag = true;\r\n\r\n\t\t\t\t\t\tgantt.refreshTask(taskId);\r\n\r\n\t\t\t\t\t\tgantt._touch_feedback();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlong_tap_timer = null;\r\n\t\t\t}, gantt.config.touch_drag);\r\n\t\t}]);\r\n\r\n\t\t//touch end\r\n\t\ttouchHandlers.push([this.$container, names[2], function (e) {\r\n\t\t\tif (ignore(e)) return;\r\n\t\t\tif (long_tap_timer) clearTimeout(long_tap_timer);\r\n\t\t\tgantt._touch_drag = false;\r\n\t\t\taction_mode = false;\r\n\t\t\tvar source = accessor(e);\r\n\r\n\t\t\tvar _tasks_dnd = getTaskDND();\r\n\r\n\t\t\tif(_tasks_dnd)\r\n\t\t\t\t_tasks_dnd.on_mouse_up(source);\r\n\r\n\t\t\tif (current_target) {\r\n\t\t\t\tgantt.refreshTask(gantt.locate(current_target));\r\n\t\t\t\tif (current_target.parentNode) {\r\n\t\t\t\t\tcurrent_target.parentNode.removeChild(current_target);\r\n\t\t\t\t\tgantt._touch_feedback();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tgantt._touch_scroll_active = action_mode = scroll_mode = false;\r\n\t\t\tcurrent_target = null;\r\n\r\n\t\t\t//dbl-tap handling\r\n\t\t\tif (action_start && dblclicktime) {\r\n\t\t\t\tvar now = new Date();\r\n\t\t\t\tif ((now - dblclicktime) < 500) {\r\n\r\n\t\t\t\t\tvar mouseEvents = gantt.$services.getService(\"mouseEvents\");\r\n\t\t\t\t\tmouseEvents.onDoubleClick(action_start);\r\n\t\t\t\t\tblock_action(e);\r\n\t\t\t\t} else\r\n\t\t\t\t\tdblclicktime = now;\r\n\t\t\t} else {\r\n\t\t\t\tdblclicktime = new Date();\r\n\t\t\t}\r\n\t\t}]);\r\n\r\n\t\tfor(var i = 0; i < touchHandlers.length; i++){\r\n\t\t\tgantt.event(touchHandlers[i][0], touchHandlers[i][1], touchHandlers[i][2]);\r\n\t\t}\r\n\r\n\t\t//common helper, prevents event\r\n\t\tfunction block_action(e) {\r\n\t\t\tif (e && e.preventDefault){\r\n\t\t\t\te.preventDefault();\r\n\t\t\t}\r\n\t\t\te.cancelBubble = true;\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tfunction cloneTaskRendered(taskId) {\r\n\t\t\tvar renders = gantt._getTaskLayers();\r\n\t\t\tvar task = gantt.getTask(taskId);\r\n\t\t\tif (task && gantt.isTaskVisible(taskId)) {\r\n\t\t\t\tfor (var i = 0; i < renders.length; i++) {\r\n\t\t\t\t\ttask = renders[i].rendered[taskId];\r\n\t\t\t\t\tif (task && task.getAttribute(gantt.config.task_attribute) && task.getAttribute(gantt.config.task_attribute) == taskId) {\r\n\t\t\t\t\t\tvar copy = task.cloneNode(true);\r\n\t\t\t\t\t\tcurrent_target = task;\r\n\t\t\t\t\t\trenders[i].rendered[taskId] = copy;\r\n\t\t\t\t\t\ttask.style.display = \"none\";\r\n\t\t\t\t\t\tcopy.className += \" gantt_drag_move \";\r\n\t\t\t\t\t\ttask.parentNode.appendChild(copy);\r\n\t\t\t\t\t\t//return copy;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n};","import * as env from \"../../../utils/env\";\r\nimport * as eventable from \"../../../utils/eventable\";\r\nimport * as isHeadless from \"../../../utils/is_headless\";\r\nimport { IScale, TModifierKeys } from \"../../common/config\";\r\n\r\ninterface ITimelineZoomConfig {\r\n\thandler?: (e: Event) => {};\r\n\tstartDate?: Date;\r\n\tendDate?: Date;\r\n\tlevels: IZoomLevel[];\r\n\tactiveLevelIndex?: number;\r\n\twidthStep?: number;\r\n\tminColumnWidth?: number;\r\n\tmaxColumnWidth?: number;\r\n\tuseKey?: \"ctrlKey\" | \"altKey\" | \"shiftKey\";\r\n\ttrigger?: \"wheel\" | null | undefined;\r\n\telement?: Element | (() => Element);\r\n}\r\n\r\nconst USE_KEY = [\"ctrlKey\", \"altKey\", \"shiftKey\", \"metaKey\"];\r\n\r\ninterface IZoomLevel {\r\n\tname?: string;\r\n\tscale_height?: number;\r\n\tmin_column_width: number;\r\n\tscales: IScale[];\r\n}\r\n\r\nconst _defaultScales = [\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"month\",\r\n\t\t\tdate: \"%M\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d\",\r\n\t\t\tstep: 1\r\n\t\t}\r\n\t],\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d %M\",\r\n\t\t\tstep: 1\r\n\t\t}\r\n\t],\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d %M\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\tunit: \"hour\",\r\n\t\t\tdate: \"%H:00\",\r\n\t\t\tstep: 8\r\n\t\t},\r\n\t],\r\n\t[\r\n\t\t{\r\n\t\t\tunit: \"day\",\r\n\t\t\tdate: \"%d %M\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\tunit: \"hour\",\r\n\t\t\tdate: \"%H:00\",\r\n\t\t\tstep: 1\r\n\t\t},\r\n\t],\r\n];\r\n\r\nexport default class TimelineZoom {\r\n\tpublic attachEvent: (eventName: string, handler: () => void) => string;\r\n\tpublic callEvent: (eventName: string, args: any[]) => any;\r\n\tpublic detachEvent: (eventName: string) => any;\r\n\tprotected _initialStartDate: Date;\r\n\tprotected _initialEndDate: Date;\r\n\tprotected _activeLevelIndex: number;\r\n\tprotected _levels: IZoomLevel[];\r\n\tprotected _handler: (e: any) => void;\r\n\tprotected $gantt;\r\n\tprotected _widthStep: number;\r\n\tprotected _minColumnWidth: number;\r\n\tprotected _maxColumnWidth: number;\r\n\tprotected _useKey: TModifierKeys;\r\n\tprotected _visibleDate: Date;\r\n\tprotected _initialized: boolean;\r\n\tprotected _domEvents: any;\r\n\r\n\tconstructor(gantt) {\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis._domEvents = this.$gantt._createDomEventScope();\r\n\t}\r\n\r\n\tpublic init(config: ITimelineZoomConfig) {\r\n\t\tif(!isHeadless(this.$gantt)){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._initialStartDate = config.startDate;\r\n\t\tthis._initialEndDate = config.endDate;\r\n\t\tthis._activeLevelIndex = config.activeLevelIndex ? config.activeLevelIndex : 0;\r\n\t\tthis._levels = this._mapScales(config.levels || _defaultScales);\r\n\t\tthis._handler = config.handler || this._defaultHandler;\r\n\t\tthis._minColumnWidth = config.minColumnWidth || 60;\r\n\t\tthis._maxColumnWidth = config.maxColumnWidth || 240;\r\n\t\tthis._widthStep = config.widthStep || 3/8 * config.minColumnWidth;\r\n\t\tthis._useKey = config.useKey;\r\n\r\n\t\tif(!this._initialized){\r\n\t\t\teventable(this);\r\n\t\t\tthis.$gantt.attachEvent(\"onGanttScroll\", () => {\r\n\t\t\t\tthis._getVisibleDate();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tthis._domEvents.detachAll();\r\n\r\n\t\tif(config.trigger === \"wheel\"){\r\n\t\t\tif(this.$gantt.$root){\r\n\t\t\t\tthis._attachWheelEvent(config);\r\n\t\t\t}else{\r\n\t\t\t\tthis.$gantt.attachEvent(\"onGanttReady\", () => {\r\n\t\t\t\t\tthis._attachWheelEvent(config);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._initialized = true;\r\n\t\tthis.setLevel(this._activeLevelIndex);\r\n\t}\r\n\r\n\tpublic zoomIn = () => {\r\n\t\tconst index = this.getCurrentLevel() - 1;\r\n\t\tif(index < 0){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.setLevel(index);\r\n\t}\r\n\r\n\tpublic zoomOut = () => {\r\n\t\tconst index = this.getCurrentLevel() + 1;\r\n\t\tif(index > this._levels.length - 1){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.setLevel(index);\r\n\t}\r\n\r\n\tpublic getCurrentLevel = () => {\r\n\t\treturn this._activeLevelIndex;\r\n\t}\r\n\r\n\tpublic getLevels = () => {\r\n\t\treturn this._levels;\r\n\t}\r\n\r\n\tpublic setLevel = (level: number|string) => {\r\n\t\tconst zoomLevel = this._getZoomIndexByName(level);\r\n\r\n\t\tif(zoomLevel === -1){\r\n\t\t\tthis.$gantt.assert(zoomLevel !== -1, \"Invalid zoom level for gantt.ext.zoom.setLevel. \" + level + \" is not an expected value.\");\r\n\t\t}\r\n\t\tthis._setLevel(zoomLevel, 0);\r\n\t}\r\n\r\n\tprotected _getZoomIndexByName = (levelName: number|string) => {\r\n\t\tlet zoomLevel:number = -1;\r\n\t\tif(typeof levelName === \"string\"){\r\n\t\t\tif(!isNaN(Number(levelName)) && this._levels[Number(levelName)]){\r\n\t\t\t\tzoomLevel = Number(levelName);\r\n\t\t\t}else{\r\n\t\t\t\tfor(let i = 0; i < this._levels.length; i++){\r\n\t\t\t\t\tif(this._levels[i].name === levelName){\r\n\t\t\t\t\t\tzoomLevel = i;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tzoomLevel = levelName;\r\n\t\t}\r\n\t\treturn zoomLevel;\r\n\t}\r\n\r\n\tprotected _mapScales(levels: IScale[][] | any): IZoomLevel[]{\r\n\t\treturn levels.map((l) => {\r\n\t\t\tif(Array.isArray(l)){\r\n\t\t\t\treturn {\r\n\t\t\t\t\tscales: l\r\n\t\t\t\t};\r\n\t\t\t}else{\r\n\t\t\t\treturn l;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tprotected _getVisibleDate = () => {\r\n\t\tconst scrollPos = this.$gantt.getScrollState().x;\r\n\t\tconst viewPort = this.$gantt.$task.offsetWidth;\r\n\t\tthis._visibleDate = this.$gantt.dateFromPos(scrollPos + viewPort/2);\r\n\t}\r\n\r\n\tprotected _setLevel = (level: number, cursorOffset: number) => {\r\n\t\tthis._activeLevelIndex = level;\r\n\r\n\t\tconst gantt = this.$gantt;\r\n\t\tconst nextConfig = gantt.copy(this._levels[this._activeLevelIndex]);\r\n\t\tconst chartConfig = gantt.copy(nextConfig);\r\n\t\tdelete chartConfig.name;\r\n\r\n\t\tgantt.mixin(gantt.config, chartConfig, true);\r\n\r\n\t\tconst isRendered = !!gantt.$root;\r\n\r\n\t\tif(isRendered){\r\n\t\t\tif(cursorOffset){\r\n\t\t\t\tconst cursorDate = this.$gantt.dateFromPos(cursorOffset + this.$gantt.getScrollState().x);\r\n\t\t\t\tthis.$gantt.render();\r\n\t\t\t\tconst newPosition = this.$gantt.posFromDate(cursorDate);\r\n\t\t\t\tthis.$gantt.scrollTo(newPosition - cursorOffset);\r\n\t\t\t}else{\r\n\t\t\t\tconst viewPort = this.$gantt.$task.offsetWidth;\r\n\t\t\t\tif(!this._visibleDate){\r\n\t\t\t\t\tthis._getVisibleDate();\r\n\t\t\t\t}\r\n\t\t\t\tconst middleDate = this._visibleDate;\r\n\t\t\t\tthis.$gantt.render();\r\n\t\t\t\tconst newPosition = this.$gantt.posFromDate(middleDate);\r\n\t\t\t\tthis.$gantt.scrollTo(newPosition - viewPort/2);\r\n\t\t\t}\r\n\r\n\t\t\tthis.callEvent(\"onAfterZoom\", [this._activeLevelIndex, nextConfig]);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _attachWheelEvent = (config) => {\r\n\t\tconst event = env.isFF ? \"wheel\" : \"mousewheel\";\r\n\t\tlet el: Element;\r\n\t\tif(typeof config.element === \"function\"){\r\n\t\t\tel = config.element();\r\n\t\t}else{\r\n\t\t\tel = config.element as Element;\r\n\t\t}\r\n\t\tif (!el){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._domEvents.attach(el, event, this.$gantt.bind(function(e) {\r\n\t\t\tif (this._useKey) {\r\n\t\t\t\tif (USE_KEY.indexOf(this._useKey) < 0) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!e[this._useKey]) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (typeof this._handler === \"function\") {\r\n\t\t\t\tthis._handler.apply(this, [e]);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}, this));\r\n\t}\r\n\r\n\tprivate _defaultHandler = (e: any):void => {\r\n\t\tconst timelineOffset = this.$gantt.$task.getBoundingClientRect().x;\r\n\t\tconst cursorOffset = e.clientX - timelineOffset;\r\n\t\tconst wheelY = this.$gantt.env.isFF ? (e.deltaY*-40) : e.wheelDelta;\r\n\t\tlet wheelUp = false;\r\n\t\tif (wheelY > 0) {\r\n\t\t\twheelUp = true;\r\n\t\t}\r\n\t\te.preventDefault();\r\n\t\te.stopPropagation();\r\n\t\tthis._setScaleSettings(wheelUp, cursorOffset);\r\n\t}\r\n\r\n\tprivate _setScaleSettings(wheelUp: boolean, cursorOffset: number) {\r\n\t\tif (wheelUp) {\r\n\t\t\tthis._stepUp(cursorOffset);\r\n\t\t} else {\r\n\t\t\tthis._stepDown(cursorOffset);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _setScaleDates = () => {\r\n\t\tif(this._initialStartDate && this._initialEndDate){\r\n\t\t\tthis.$gantt.config.start_date = this._initialStartDate;\r\n\t\t\tthis.$gantt.config.end_date = this._initialEndDate;\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _stepUp(cursorOffset) {\r\n\t\tif (this._activeLevelIndex >= this._levels.length - 1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet nextLevel = this._activeLevelIndex;\r\n\t\tthis._setScaleDates();\r\n\r\n\t\tif(this._widthStep){\r\n\t\t\tlet newColumnWidth = this.$gantt.config.min_column_width + this._widthStep;\r\n\t\t\tif (newColumnWidth > this._maxColumnWidth) {\r\n\t\t\t\tnewColumnWidth = this._minColumnWidth;\r\n\t\t\t\tnextLevel++;\r\n\t\t\t}\r\n\r\n\t\t\tthis.$gantt.config.min_column_width = newColumnWidth;\r\n\t\t}else{\r\n\t\t\tnextLevel++;\r\n\t\t}\r\n\t\tthis._setLevel(nextLevel, cursorOffset);\r\n\t}\r\n\tprivate _stepDown(cursorOffset) {\r\n\t\tif (this._activeLevelIndex < 1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet nextLevel = this._activeLevelIndex;\r\n\t\tthis._setScaleDates();\r\n\r\n\t\tif(this._widthStep){\r\n\t\t\tlet newColumnWidth = this.$gantt.config.min_column_width - this._widthStep;\r\n\t\t\tif (newColumnWidth < this._minColumnWidth) {\r\n\t\t\t\tnewColumnWidth = this._maxColumnWidth;\r\n\t\t\t\tnextLevel--;\r\n\t\t\t}\r\n\t\t\tthis.$gantt.config.min_column_width = newColumnWidth;\r\n\t\t}else{\r\n\t\t\tnextLevel--;\r\n\t\t}\r\n\t\tthis._setLevel(nextLevel, cursorOffset);\r\n\t}\r\n}","if (window.dhtmlx){\r\n\r\n\tif (!window.dhtmlx.attaches)\r\n\twindow.dhtmlx.attaches = {};\r\n\r\n\twindow.dhtmlx.attaches.attachGantt=function(start, end, gantt){\r\n\t\tvar obj = document.createElement(\"DIV\");\r\n\r\n\t\tgantt = gantt || window.gantt;\r\n\r\n\t\tobj.id = \"gantt_\"+ gantt.uid();\r\n\t\tobj.style.width = \"100%\";\r\n\t\tobj.style.height = \"100%\";\r\n\t\tobj.cmp = \"grid\";\r\n\r\n\t\tdocument.body.appendChild(obj);\r\n\t\tthis.attachObject(obj.id);\r\n\t\tthis.dataType = \"gantt\";\r\n\t\tthis.dataObj = gantt;\r\n\r\n\t\tvar that = this.vs[this.av];\r\n\t\tthat.grid = gantt;\r\n\r\n\t\tgantt.init(obj.id, start, end);\r\n\t\tobj.firstChild.style.border = \"none\";\r\n\r\n\t\tthat.gridId = obj.id;\r\n\t\tthat.gridObj = obj;\r\n\r\n\t\tvar method_name=\"_viewRestore\";\r\n\t\treturn this.vs[this[method_name]()].grid;\r\n\t};\r\n\r\n}\r\nif (typeof(window.dhtmlXCellObject) != \"undefined\") {\r\n\r\n\twindow.dhtmlXCellObject.prototype.attachGantt=function(start, end, gantt){\r\n\t\tgantt = gantt || window.gantt;\r\n\r\n\t\tvar obj = document.createElement(\"DIV\");\r\n\t\tobj.id = \"gantt_\"+gantt.uid();\r\n\t\tobj.style.width = \"100%\";\r\n\t\tobj.style.height = \"100%\";\r\n\t\tobj.cmp = \"grid\";\r\n\r\n\t\tdocument.body.appendChild(obj);\r\n\t\tthis.attachObject(obj.id);\r\n\r\n\t\tthis.dataType = \"gantt\";\r\n\t\tthis.dataObj = gantt;\r\n\r\n\t\tgantt.init(obj.id, start, end);\r\n\t\tobj.firstChild.style.border = \"none\";\r\n\r\n\t\tobj = null;\r\n\t\tthis.callEvent(\"_onContentAttach\",[]);\r\n\r\n\t\treturn this.dataObj;\r\n\t};\r\n}\r\n\r\nmodule.exports = null;","if (window.jQuery){\r\n\r\n\t(function( $ ){\r\n\r\n\t\tvar methods = [];\r\n\t\t$.fn.dhx_gantt = function(config){\r\n\t\t\tconfig = config || {};\r\n\t\t\tif (typeof(config) === 'string') {\r\n\t\t\t\tif (methods[config] ) {\r\n\t\t\t\t\treturn methods[config].apply(this, []);\r\n\t\t\t\t}else {\r\n\t\t\t\t\t$.error('Method ' + config + ' does not exist on jQuery.dhx_gantt');\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tvar views = [];\r\n\t\t\t\tthis.each(function() {\r\n\t\t\t\t\tif (this && this.getAttribute){\r\n\t\t\t\t\t\tif (!this.gantt && !(window.gantt.$root == this)){\r\n\r\n\t\t\t\t\t\t\tvar newgantt = (window.gantt.$container && window.Gantt) ? window.Gantt.getGanttInstance():window.gantt;\r\n\t\t\t\t\t\t\tfor (var key in config)\r\n\t\t\t\t\t\t\t\tif (key!=\"data\")\r\n\t\t\t\t\t\t\t\t\tnewgantt.config[key] = config[key];\r\n\r\n\t\t\t\t\t\t\tnewgantt.init(this);\r\n\t\t\t\t\t\t\tif (config.data)\r\n\t\t\t\t\t\t\t\tnewgantt.parse(config.data);\r\n\r\n\t\t\t\t\t\t\tviews.push(newgantt);\r\n\t\t\t\t\t\t} else\r\n\t\t\t\t\t\t\tviews.push(typeof this.gantt == \"object\" ? this.gantt : window.gantt);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\r\n\t\t\t\tif (views.length === 1) return views[0];\r\n\t\t\t\treturn views;\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t})(window.jQuery);\r\n\r\n}\r\n\r\n\r\nmodule.exports = null;","var domHelpers = require(\"../utils/dom_helpers\");\r\nvar isHeadless = require(\"../../../utils/is_headless\");\r\n\r\nmodule.exports = function(gantt){\r\n\r\n\tvar scrollRange = 50,\r\n\t\tscrollStep = 30,\r\n\t\tscrollDelay = 10,\r\n\t\tscrollSpeed = 50;\r\n\r\n\tvar interval = null,\r\n\t\tisMove = false,\r\n\t\tdelayTimeout = null,\r\n\t\tstartPos = {\r\n\t\t\tstarted: false\r\n\t\t},\r\n\t\teventPos = {};\r\n\r\n\r\n\tfunction isDisplayed(element){\r\n\t\treturn element &&\r\n\t\t\tdomHelpers.isChildOf(element, gantt.$root) &&\r\n\t\t\telement.offsetHeight;\r\n\t}\r\n\r\n\tfunction getAutoscrollContainer(){\r\n\t\tvar element;\r\n\t\tif(isDisplayed(gantt.$task)){\r\n\t\t\telement = gantt.$task;\r\n\t\t}else if(isDisplayed(gantt.$grid)){\r\n\t\t\telement = gantt.$grid;\r\n\t\t}else{\r\n\t\t\telement = gantt.$root;\r\n\t\t}\r\n\r\n\t\treturn element;\r\n\t}\r\n\r\n\tfunction isScrollState() {\r\n\t\tvar dragMarker = !!document.querySelector(\".gantt_drag_marker\");\r\n\t\tvar isResize = !!document.querySelector(\".gantt_drag_marker.gantt_grid_resize_area\");\r\n\t\tvar isLink = !!document.querySelector(\".gantt_link_direction\");\r\n\t\tvar state = gantt.getState();\r\n\t\tvar isClickDrag = state.autoscroll;\r\n\t\tisMove = dragMarker && !isResize && !isLink;\r\n\r\n\t\treturn !((!state.drag_mode && !dragMarker) || isResize) || isClickDrag;\r\n\t}\r\n\r\n\tfunction defineDelayTimeout(state) {\r\n\t\tif (delayTimeout) {\r\n\t\t\tclearTimeout(delayTimeout);\r\n\t\t\tdelayTimeout = null;\r\n\t\t}\r\n\t\tif (state) {\r\n\t\t\tvar speed = gantt.config.autoscroll_speed;\r\n\t\t\tif (speed && speed < 10) // limit speed value to 10\r\n\t\t\t\tspeed = 10;\r\n\r\n\t\t\tdelayTimeout = setTimeout(function() {\r\n\t\t\t\tinterval = setInterval(tick, speed || scrollSpeed);\r\n\t\t\t}, gantt.config.autoscroll_delay || scrollDelay);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction defineScrollInterval(state) {\r\n\t\tif (state) {\r\n\t\t\tdefineDelayTimeout(true);\r\n\t\t\tif (!startPos.started) {\r\n\t\t\t\tstartPos.x = eventPos.x;\r\n\t\t\t\tstartPos.y = eventPos.y;\r\n\t\t\t\tstartPos.started = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (interval) {\r\n\t\t\t\tclearInterval(interval);\r\n\t\t\t\tinterval = null;\r\n\t\t\t}\r\n\t\t\tdefineDelayTimeout(false);\r\n\t\t\tstartPos.started = false;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction autoscrollInterval(event) {\r\n\r\n\t\tvar isScroll = isScrollState();\r\n\r\n\t\tif ((interval || delayTimeout) && !isScroll) {\r\n\t\t\tdefineScrollInterval(false);\r\n\t\t}\r\n\r\n\t\tif (!gantt.config.autoscroll || !isScroll) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\teventPos = {\r\n\t\t\tx: event.clientX,\r\n\t\t\ty: event.clientY\r\n\t\t};\r\n\r\n\t\tif (!interval && isScroll) {\r\n\t\t\tdefineScrollInterval(true);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction tick() {\r\n\r\n\t\tif (!isScrollState()) {\r\n\t\t\tdefineScrollInterval(false);\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar box = domHelpers.getNodePosition(getAutoscrollContainer());\r\n\t\tvar posX = eventPos.x - box.x;\r\n\t\tvar posY = eventPos.y - box.y;\r\n\r\n\t\tvar scrollLeft = isMove ? 0 : need_scroll(posX, box.width, startPos.x - box.x);\r\n\t\tvar scrollTop = need_scroll(posY, box.height, startPos.y - box.y);\r\n\r\n\t\tvar scrollState = gantt.getScrollState();\r\n\r\n\t\tvar currentScrollTop = scrollState.y,\r\n\t\t\tscrollOuterHeight = scrollState.inner_height,\r\n\t\t\tscrollInnerHeight = scrollState.height,\r\n\t\t\tcurrentScrollLeft = scrollState.x,\r\n\t\t\tscrollOuterWidth = scrollState.inner_width,\r\n\t\t\tscrollInnerWidth = scrollState.width;\r\n\r\n\t\t// do scrolling only if we have scrollable area to do so\r\n\t\tif (scrollTop && !scrollOuterHeight) {\r\n\t\t\tscrollTop = 0;\r\n\t\t} else if (scrollTop < 0 && !currentScrollTop) {\r\n\t\t\tscrollTop = 0;\r\n\t\t} else if (scrollTop > 0 && currentScrollTop + scrollOuterHeight >= scrollInnerHeight + 2) {\r\n\t\t\tscrollTop = 0;\r\n\t\t}\r\n\r\n\t\tif (scrollLeft && !scrollOuterWidth) {\r\n\t\t\tscrollLeft = 0;\r\n\t\t} else if (scrollLeft < 0 && !currentScrollLeft) {\r\n\t\t\tscrollLeft = 0;\r\n\t\t} else if (scrollLeft > 0 && currentScrollLeft + scrollOuterWidth >= scrollInnerWidth) {\r\n\t\t\tscrollLeft = 0;\r\n\t\t}\r\n\r\n\t\tvar step = gantt.config.autoscroll_step;\r\n\r\n\t\tif (step && step < 2) // limit step value to 2\r\n\t\t\tstep = 2;\r\n\r\n\t\tscrollLeft = scrollLeft * (step || scrollStep);\r\n\t\tscrollTop = scrollTop * (step || scrollStep);\r\n\r\n\t\tif (scrollLeft || scrollTop) {\r\n\t\t\tscroll(scrollLeft, scrollTop);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction need_scroll(pos, boxSize, startCoord) {\r\n\t\tif ((pos - scrollRange < 0) && (pos < startCoord))\r\n\t\t\treturn -1;\r\n\t\telse if ((pos > boxSize - scrollRange) && (pos > startCoord))\r\n\t\t\treturn 1;\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tfunction scroll(left, top) {\r\n\t\tvar scrollState = gantt.getScrollState();\r\n\r\n\t\tvar scrollLeft = null,\r\n\t\t\tscrollTop = null;\r\n\r\n\t\tif (left) {\r\n\t\t\tscrollLeft = scrollState.x + left;\r\n\t\t\tscrollLeft = Math.min(scrollState.width, scrollLeft);\r\n\t\t\tscrollLeft = Math.max(0, scrollLeft);\r\n\t\t}\r\n\r\n\t\tif (top) {\r\n\t\t\tscrollTop = scrollState.y + top;\r\n\t\t\tscrollTop = Math.min(scrollState.height, scrollTop);\r\n\t\t\tscrollTop = Math.max(0, scrollTop);\r\n\t\t}\r\n\r\n\t\tgantt.scrollTo(scrollLeft, scrollTop);\r\n\t}\r\n\r\n\tgantt.attachEvent(\"onGanttReady\", function() {\r\n\t\tif(!isHeadless(gantt)){\r\n\t\t\tgantt.eventRemove(document.body, \"mousemove\", autoscrollInterval);\r\n\t\t\tgantt.event(document.body, \"mousemove\", autoscrollInterval);\r\n\t\t}\r\n\t});\r\n\r\n};","module.exports = function(gantt){\r\n\tif(!gantt.ext){\r\n\t\tgantt.ext = {};\r\n\t}\r\n\r\n\tvar modules = [\r\n\t\trequire(\"./autoscroll\"),\r\n\t\trequire(\"./jquery_hooks\"),\r\n\t\trequire(\"./dhtmlx_hooks\")\r\n\t];\r\n\r\n\tfor(var i = 0; i < modules.length; i++){\r\n\t\tif(modules[i])\r\n\t\t\tmodules[i](gantt);\r\n\t}\r\n\r\n\tvar TimelineZoom = require(\"./timeline_zoom\").default;\r\n\tgantt.ext.zoom = new TimelineZoom(gantt);\r\n};","module.exports = function(gantt) {\r\ngantt.skins[\"contrast_white\"] = {\r\n\tconfig:{\r\n\t\tgrid_width:360,\r\n\t\trow_height: 35,\r\n\t\tscale_height: 35,\r\n\t\tlink_line_width:2,\r\n\t\tlink_arrow_size:6,\r\n\t\tlightbox_additional_height:75\r\n\t},\r\n\t_second_column_width:100,\r\n\t_third_column_width:80\r\n};\r\n\r\n};","module.exports = function(gantt) {\r\ngantt.skins[\"contrast_black\"] = {\r\n\tconfig:{\r\n\t\tgrid_width:360,\r\n\t\trow_height: 35,\r\n\t\tscale_height: 35,\r\n\t\tlink_line_width:2,\r\n\t\tlink_arrow_size:6,\r\n\t\tlightbox_additional_height:75\r\n\t},\r\n\t_second_column_width:100,\r\n\t_third_column_width:80\r\n};\r\n\r\n};","module.exports = function(gantt) {\r\n\tgantt.skins.material = {\r\n\t\tconfig: {\r\n\t\t\tgrid_width: 411,\r\n\t\t\trow_height: 34,\r\n\t\t\ttask_height_offset: 6,\r\n\t\t\tscale_height: 36,\r\n\t\t\tlink_line_width: 2,\r\n\t\t\tlink_arrow_size: 6,\r\n\t\t\tlightbox_additional_height: 80\r\n\t\t},\r\n\t\t_second_column_width: 110,\r\n\t\t_third_column_width: 75,\r\n\t\t_redefine_lightbox_buttons: {\r\n\t\t\t\"buttons_left\": [\"dhx_delete_btn\"],\r\n\t\t\t\"buttons_right\": [\"dhx_save_btn\", \"dhx_cancel_btn\"]\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.attachEvent(\"onAfterTaskDrag\", function (id) {\r\n\t\tvar t = gantt.getTaskNode(id);\r\n\t\tif (t) {\r\n\t\t\tt.className += \" gantt_drag_animation\";\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tvar indx = t.className.indexOf(\" gantt_drag_animation\");\r\n\t\t\t\tif (indx > -1) {\r\n\t\t\t\t\tt.className = t.className.slice(0, indx);\r\n\t\t\t\t}\r\n\t\t\t}, 200);\r\n\t\t}\r\n\t});\r\n\r\n};","module.exports = function(gantt) {\r\n\tgantt.skins.broadway = {\r\n\t\tconfig: {\r\n\t\t\tgrid_width: 360,\r\n\t\t\trow_height: 35,\r\n\t\t\tscale_height: 35,\r\n\t\t\tlink_line_width: 1,\r\n\t\t\tlink_arrow_size: 7,\r\n\t\t\tlightbox_additional_height: 86\r\n\t\t},\r\n\t\t_second_column_width: 90,\r\n\t\t_third_column_width: 80,\r\n\r\n\t\t_lightbox_template: \"
 
\",\r\n\t\t_config_buttons_left: {},\r\n\t\t_config_buttons_right: {\r\n\t\t\t\"gantt_delete_btn\": \"icon_delete\",\r\n\t\t\t\"gantt_save_btn\": \"icon_save\"\r\n\t\t}\r\n\t};\r\n};","module.exports = function(gantt) {\r\ngantt.skins.terrace = {\r\n\tconfig:{\r\n\t\tgrid_width:360,\r\n\t\trow_height: 35,\r\n\t\tscale_height: 35,\r\n\t\tlink_line_width:2,\r\n\t\tlink_arrow_size:6,\r\n\t\tlightbox_additional_height:75\r\n\t},\r\n\t_second_column_width:90,\r\n\t_third_column_width:70\t\t\r\n};\r\n\r\n};","module.exports = function(gantt) {\r\ngantt.skins.meadow = {\r\n\tconfig:{\r\n\t\tgrid_width:350,\r\n\t\trow_height: 27,\r\n\t\tscale_height: 30,\r\n\t\tlink_line_width:2,\r\n\t\tlink_arrow_size:6,\r\n\t\tlightbox_additional_height:72\r\n\t},\r\n\t_second_column_width:95,\r\n\t_third_column_width:80\r\n};\r\n\r\n};","module.exports = function(gantt) {\r\ngantt.skins.skyblue = {\r\n\tconfig:{\r\n\t\tgrid_width:350,\r\n\t\trow_height: 27,\r\n\t\tscale_height: 27,\r\n\t\tlink_line_width:1,\r\n\t\tlink_arrow_size:8,\r\n\t\tlightbox_additional_height:75\r\n\t},\r\n\t_second_column_width:95,\r\n\t_third_column_width:80\r\n};\r\n\r\n};","function _configure(col, data, force) {\r\n\tfor (var key in data)\r\n\t\tif (typeof col[key] == \"undefined\" || force)\r\n\t\t\tcol[key] = data[key];\r\n}\r\n\r\nfunction _get_skin(force, gantt) {\r\n\tvar skin = gantt.skin;\r\n\tif (!skin || force) {\r\n\t\tvar links = document.getElementsByTagName(\"link\");\r\n\t\tfor (var i = 0; i < links.length; i++) {\r\n\t\t\tvar res = links[i].href.match(\"dhtmlxgantt_([a-z_]+).css\");\r\n\t\t\tif (res) {\r\n\t\t\t\tif (gantt.skins[res[1]] || !skin) {\r\n\t\t\t\t\tskin = res[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tgantt.skin = skin || \"terrace\";\r\n\tvar skinset = gantt.skins[gantt.skin] || gantt.skins[\"terrace\"];\r\n\r\n\t//apply skin related settings\r\n\t_configure(gantt.config, skinset.config, force);\r\n\r\n\tvar config = gantt.getGridColumns();\r\n\tif (config[1] && !gantt.defined(config[1].width))\r\n\t\tconfig[1].width = skinset._second_column_width;\r\n\tif (config[2] && !gantt.defined(config[2].width))\r\n\t\tconfig[2].width = skinset._third_column_width;\r\n\t\r\n\tfor (var i=0; i column.width) ? column.min_width : column.width;\r\n\t\t\t\tcolumn.width = (column.max_width && column.max_width < column.width) ? column.max_width : column.width;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (skinset.config.task_height)\r\n\t\tgantt.config.task_height = skinset.config.task_height || \"full\"; \r\n\r\n\tif (skinset._lightbox_template)\r\n\t\tgantt._lightbox_template = skinset._lightbox_template;\r\n\r\n\tif (skinset._redefine_lightbox_buttons) {\r\n\t\tgantt.config.buttons_right = skinset._redefine_lightbox_buttons[\"buttons_right\"];\r\n\t\tgantt.config.buttons_left = skinset._redefine_lightbox_buttons[\"buttons_left\"];\r\n\t}\r\n\r\n\r\n\tgantt.resetLightbox();\r\n}\r\n\r\nmodule.exports = function(gantt) {\r\n\tif(!gantt.resetSkin){\r\n\t\tgantt.resetSkin = function () {\r\n\t\t\tthis.skin = \"\";\r\n\t\t\t_get_skin(true, this);\r\n\t\t};\r\n\t\tgantt.skins = {};\r\n\r\n\t\tgantt.attachEvent(\"onGanttLayoutReady\", function(){\r\n\t\t\t_get_skin(false, this);\r\n\t\t});\r\n\t}\r\n};","function createLayoutFacade(){\r\n\r\n\tfunction getTimeline(gantt){\r\n\t\treturn gantt.$ui.getView(\"timeline\");\r\n\t}\r\n\r\n\tfunction getGrid(gantt){\r\n\t\treturn gantt.$ui.getView(\"grid\");\r\n\t}\r\n\r\n\tfunction getVerticalScrollbar(gantt){\r\n\t\treturn gantt.$ui.getView(\"scrollVer\");\r\n\t}\r\n\r\n\tfunction getHorizontalScrollbar(gantt){\r\n\t\treturn gantt.$ui.getView(\"scrollHor\");\r\n\t}\r\n\r\n\tvar DEFAULT_VALUE = \"DEFAULT_VALUE\";\r\n\r\n\tfunction tryCall(getView, method, args, fallback){\r\n\t\tvar view = getView(this);\r\n\t\tif (!(view && view.isVisible())) {\r\n\t\t\tif(fallback){\r\n\t\t\t\treturn fallback();\r\n\t\t\t}else{\r\n\t\t\t\treturn DEFAULT_VALUE;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn view[method].apply(view, args);\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tgetColumnIndex: function(name) {\r\n\t\t\tvar res = tryCall.call(this, getGrid, \"getColumnIndex\", [name]);\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tdateFromPos: function(x) {\r\n\t\t\tvar res = tryCall.call(this, getTimeline, \"dateFromPos\", Array.prototype.slice.call(arguments));\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn this.getState().min_date;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tposFromDate: function(date) {\r\n\t\t\tvar res = tryCall.call(this, getTimeline, \"posFromDate\", [date]);\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tgetRowTop: function(index) {\r\n\t\t\tvar self = this;\r\n\t\t\tvar res = tryCall.call(self, getTimeline, \"getRowTop\", [index],\r\n\t\t\t\tfunction(){ return tryCall.call(self, getGrid, \"getRowTop\", [index]);}\r\n\t\t\t\t);\r\n\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tgetTaskTop: function(id) {\r\n\t\t\tvar self = this;\r\n\t\t\tvar res = tryCall.call(self, getTimeline, \"getItemTop\", [id],\r\n\t\t\t\tfunction(){ return tryCall.call(self, getGrid, \"getItemTop\", [id]);}\r\n\t\t\t);\r\n\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\r\n\t\tgetTaskPosition: function(task, start_date, end_date) {\r\n\t\t\tvar res = tryCall.call(this, getTimeline, \"getItemPosition\", [task, start_date, end_date]);\r\n\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\tvar top = this.getTaskTop(task.id);\r\n\t\t\t\tvar height = this.getTaskHeight();\r\n\r\n\t\t\t\treturn {\r\n\t\t\t\t\tleft: 0,\r\n\t\t\t\t\ttop: top,\r\n\t\t\t\t\theight: height,\r\n\t\t\t\t\twidth: 0\r\n\t\t\t\t};\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tgetTaskHeight: function() {\r\n\t\t\tvar self = this;\r\n\t\t\tvar res = tryCall.call(self, getTimeline, \"getItemHeight\", [],\r\n\t\t\t\tfunction(){ return tryCall.call(self, getGrid, \"getItemHeight\", []);}\r\n\t\t\t);\r\n\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\r\n\t\tcolumnIndexByDate: function(date) {\r\n\t\t\tvar res = tryCall.call(this, getTimeline, \"columnIndexByDate\", [date]);\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn 0;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\troundTaskDates: function() {\r\n\t\t\ttryCall.call(this, getTimeline, \"roundTaskDates\", []);\r\n\t\t},\r\n\r\n\t\tgetScale: function() {\r\n\t\t\tvar res = tryCall.call(this, getTimeline, \"getScale\", []);\r\n\t\t\tif(res === DEFAULT_VALUE){\r\n\t\t\t\treturn null;\r\n\t\t\t}else{\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tgetTaskNode: function(id) {\r\n\t\t\tvar timeline = getTimeline(this);\r\n\t\t\tif (!timeline || !timeline.isVisible()) {\r\n\t\t\t\treturn null;\r\n\t\t\t} else {\r\n\t\t\t\tvar node = timeline._taskRenderer.rendered[id];\r\n\t\t\t\tif(!node){\r\n\t\t\t\t\tvar domAttr = timeline.$config.item_attribute;\r\n\t\t\t\t\tnode = timeline.$task_bars.querySelector(\"[\" +domAttr+ \"='\"+id+\"']\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn node || null;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\r\n\t\tgetLinkNode: function(id) {\r\n\t\t\tvar timeline = getTimeline(this);\r\n\t\t\tif (!timeline.isVisible()) {\r\n\t\t\t\treturn null;\r\n\t\t\t} else {\r\n\t\t\t\treturn timeline._linkRenderer.rendered[id];\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tscrollTo: function(left, top){\r\n\t\t\tvar vertical = getVerticalScrollbar(this);\r\n\t\t\tvar horizontal = getHorizontalScrollbar(this);\r\n\r\n\t\t\tvar oldH = {position: 0},\r\n\t\t\t\toldV = {position: 0};\r\n\r\n\t\t\tif(vertical){\r\n\t\t\t\toldV = vertical.getScrollState();\r\n\t\t\t}\r\n\t\t\tif(horizontal){\r\n\t\t\t\toldH = horizontal.getScrollState();\r\n\t\t\t}\r\n\r\n\t\t\tif (horizontal && left*1 == left){\r\n\t\t\t\thorizontal.scroll(left);\r\n\t\t\t}\r\n\t\t\tif(vertical && top*1 == top){\r\n\t\t\t\tvertical.scroll(top);\r\n\t\t\t}\r\n\r\n\t\t\tvar newV = {position: 0},\r\n\t\t\t\tnewH = {position: 0};\r\n\t\t\tif(vertical){\r\n\t\t\t\tnewV = vertical.getScrollState();\r\n\t\t\t}\r\n\t\t\tif(horizontal){\r\n\t\t\t\tnewH = horizontal.getScrollState();\r\n\t\t\t}\r\n\r\n\t\t\tthis.callEvent(\"onGanttScroll\", [oldH.position, oldV.position, newH.position, newV.position]);\r\n\t\t},\r\n\r\n\t\tshowDate: function(date){\r\n\t\t\tvar date_x = this.posFromDate(date);\r\n\t\t\tvar scroll_to = Math.max(date_x - this.config.task_scroll_offset, 0);\r\n\t\t\tthis.scrollTo(scroll_to);\r\n\t\t},\r\n\t\tshowTask: function(id) {\r\n\t\t\tvar pos = this.getTaskPosition(this.getTask(id));\r\n\r\n\t\t\tvar left = Math.max(pos.left - this.config.task_scroll_offset, 0);\r\n\r\n\t\t\tvar dataHeight = this._scroll_state().y;\r\n\t\t\tvar top;\r\n\t\t\tif(!dataHeight){\r\n\t\t\t\ttop = pos.top;\r\n\t\t\t}else{\r\n\t\t\t\ttop = pos.top - (dataHeight - this.config.row_height)/2;\r\n\t\t\t}\r\n\r\n\t\t\tthis.scrollTo(left, top);\r\n\t\t},\r\n\t\t_scroll_state: function(){\r\n\t\t\tvar result = {\r\n\t\t\t\tx: false,\r\n\t\t\t\ty: false,\r\n\t\t\t\tx_pos: 0,\r\n\t\t\t\ty_pos: 0,\r\n\t\t\t\tscroll_size: this.config.scroll_size + 1,//1px for inner content\r\n\t\t\t\tx_inner: 0,\r\n\t\t\t\ty_inner: 0\r\n\t\t\t};\r\n\r\n\t\t\tvar scrollVer = getVerticalScrollbar(this),\r\n\t\t\t\tscrollHor = getHorizontalScrollbar(this);\r\n\t\t\tif(scrollHor){\r\n\t\t\t\tvar horState = scrollHor.getScrollState();\r\n\t\t\t\tif(horState.visible){\r\n\t\t\t\t\tresult.x = horState.size;\r\n\t\t\t\t\tresult.x_inner = horState.scrollSize;\r\n\t\t\t\t}\r\n\t\t\t\tresult.x_pos = horState.position || 0;\r\n\t\t\t}\r\n\r\n\t\t\tif(scrollVer){\r\n\t\t\t\tvar verState = scrollVer.getScrollState();\r\n\t\t\t\tif(verState.visible){\r\n\t\t\t\t\tresult.y = verState.size;\r\n\r\n\t\t\t\t\tresult.y_inner = verState.scrollSize;\r\n\t\t\t\t}\r\n\t\t\t\tresult.y_pos = verState.position || 0;\r\n\t\t\t}\r\n\r\n\t\t\treturn result;\r\n\t\t},\r\n\t\tgetScrollState: function(){\r\n\t\t\tvar state = this._scroll_state();\r\n\t\t\treturn { x:state.x_pos, y:state.y_pos, inner_width:state.x, inner_height:state.y, width: state.x_inner, height: state.y_inner };\r\n\t\t}\r\n\r\n\t};\r\n\r\n}\r\n\r\nmodule.exports = createLayoutFacade;","module.exports = function(gantt) {\r\n\tdelete gantt.addTaskLayer;\r\n\tdelete gantt.addLinkLayer;\r\n};","var domHelpers = require(\"./utils/dom_helpers\");\r\n\r\nvar initializer = (function() {\r\n\treturn function (gantt) {\r\n\t\treturn {\r\n\r\n\t\t\tgetVerticalScrollbar: function(){\r\n\t\t\t\treturn gantt.$ui.getView(\"scrollVer\");\r\n\t\t\t},\r\n\t\t\tgetHorizontalScrollbar: function(){\r\n\t\t\t\treturn gantt.$ui.getView(\"scrollHor\");\r\n\t\t\t},\r\n\r\n\t\t\t_legacyGridResizerClass: function(layout){\r\n\t\t\t\tvar resizers = layout.getCellsByType(\"resizer\");\r\n\t\t\t\tfor(var i = 0; i < resizers.length; i++){\r\n\t\t\t\t\tvar r = resizers[i];\r\n\t\t\t\t\tvar gridResizer = false;\r\n\r\n\t\t\t\t\tvar prev = r.$parent.getPrevSibling(r.$id);\r\n\t\t\t\t\tif(prev && prev.$config && prev.$config.id === \"grid\"){\r\n\t\t\t\t\t\tgridResizer= true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tvar next = r.$parent.getNextSibling(r.$id);\r\n\t\t\t\t\t\tif(next && next.$config && next.$config.id === \"grid\"){\r\n\t\t\t\t\t\t\tgridResizer= true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(gridResizer){\r\n\t\t\t\t\t\tr.$config.css = (r.$config.css ? r.$config.css + \" \" : \"\") + \"gantt_grid_resize_wrap\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\tonCreated: function(layout) {\r\n\t\t\t\tvar first = true;\r\n\r\n\t\t\t\tthis._legacyGridResizerClass(layout);\r\n\r\n\t\t\t\tlayout.attachEvent(\"onBeforeResize\", function() {\r\n\t\t\t\t\tvar mainTimeline = gantt.$ui.getView(\"timeline\");\r\n\t\t\t\t\tif (mainTimeline)\r\n\t\t\t\t\t\tmainTimeline.$config.hidden = mainTimeline.$parent.$config.hidden = !gantt.config.show_chart;\r\n\r\n\t\t\t\t\tvar mainGrid = gantt.$ui.getView(\"grid\");\r\n\r\n\t\t\t\t\tif(!mainGrid)\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\tvar showGrid = gantt.config.show_grid;\r\n\t\t\t\t\tif (first) {\r\n\t\t\t\t\t\tvar colsWidth = mainGrid._getColsTotalWidth();\r\n\t\t\t\t\t\tif (colsWidth !== false){\r\n\t\t\t\t\t\t\tgantt.config.grid_width = colsWidth;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tshowGrid = showGrid && !!gantt.config.grid_width;\r\n\t\t\t\t\t\tgantt.config.show_grid = showGrid;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmainGrid.$config.hidden = mainGrid.$parent.$config.hidden = !showGrid;\r\n\r\n\t\t\t\t\tif (!mainGrid.$config.hidden) {\r\n\t\t\t\t\t\t/* restrict grid width due to min_width, max_width, min_grid_column_width */\r\n\t\t\t\t\t\tvar grid_limits = mainGrid._getGridWidthLimits();\r\n\t\t\t\t\t\tif (grid_limits[0] && gantt.config.grid_width < grid_limits[0])\r\n\t\t\t\t\t\t\tgantt.config.grid_width = grid_limits[0];\r\n\t\t\t\t\t\tif (grid_limits[1] && gantt.config.grid_width > grid_limits[1])\r\n\t\t\t\t\t\t\tgantt.config.grid_width = grid_limits[1];\r\n\t\t\t\t\t\tif (mainTimeline && gantt.config.show_chart){\r\n\r\n\t\t\t\t\t\t\tmainGrid.$config.width = gantt.config.grid_width - 1;\r\n\t\t\t\t\t\t\tif (!first) {\r\n\t\t\t\t\t\t\t\tif (mainTimeline && !domHelpers.isChildOf(mainTimeline.$task, layout.$view)) {\r\n\t\t\t\t\t\t\t\t\t// timeline is being displayed after being not visible, reset grid with from full screen\r\n\t\t\t\t\t\t\t\t\tif (!mainGrid.$config.original_grid_width) {\r\n\t\t\t\t\t\t\t\t\t\tvar skinSettings = gantt.skins[gantt.skin];\r\n\t\t\t\t\t\t\t\t\t\tif(skinSettings && skinSettings.config && skinSettings.config.grid_width){\r\n\t\t\t\t\t\t\t\t\t\t\tmainGrid.$config.original_grid_width = skinSettings.config.grid_width;\r\n\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\tmainGrid.$config.original_grid_width = 0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tgantt.config.grid_width = mainGrid.$config.original_grid_width;\r\n\t\t\t\t\t\t\t\t\tmainGrid.$parent.$config.width = gantt.config.grid_width;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tmainGrid.$parent._setContentSize(mainGrid.$config.width, null);\r\n\t\t\t\t\t\t\t\t\tgantt.$layout._syncCellSizes(mainGrid.$parent.$config.group, gantt.config.grid_width);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tmainGrid.$parent.$config.width = gantt.config.grid_width;\r\n\t\t\t\t\t\t\t\tif (mainGrid.$parent.$config.group) {\r\n\t\t\t\t\t\t\t\t\tgantt.$layout._syncCellSizes(mainGrid.$parent.$config.group, mainGrid.$parent.$config.width);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (mainTimeline && domHelpers.isChildOf(mainTimeline.$task, layout.$view)) {\r\n\t\t\t\t\t\t\t\t// hiding timeline, remember grid with to restore it when timeline is displayed again\r\n\t\t\t\t\t\t\t\tmainGrid.$config.original_grid_width = gantt.config.grid_width;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (!first) {\r\n\t\t\t\t\t\t\t\tmainGrid.$parent.$config.width = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfirst = false;\r\n\t\t\t\t});\r\n\t\t\t\tthis._initScrollStateEvents(layout);\r\n\t\t\t},\r\n\r\n\t\t\t_initScrollStateEvents: function(layout) {\r\n\t\t\t\tgantt._getVerticalScrollbar = this.getVerticalScrollbar;\r\n\t\t\t\tgantt._getHorizontalScrollbar = this.getHorizontalScrollbar;\r\n\r\n\t\t\t\tvar vertical = this.getVerticalScrollbar();\r\n\t\t\t\tvar horizontal = this.getHorizontalScrollbar();\r\n\t\t\t\tif (vertical) {\r\n\t\t\t\t\tvertical.attachEvent(\"onScroll\", function(oldPos, newPos, dir){\r\n\t\t\t\t\t\tvar scrollState = gantt.getScrollState();\r\n\t\t\t\t\t\tgantt.callEvent(\"onGanttScroll\", [scrollState.x, oldPos, scrollState.x, newPos]);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tif (horizontal) {\r\n\t\t\t\t\thorizontal.attachEvent(\"onScroll\", function(oldPos, newPos, dir){\r\n\t\t\t\t\t\tvar scrollState = gantt.getScrollState();\r\n\t\t\t\t\t\tgantt.callEvent(\"onGanttScroll\", [oldPos, scrollState.y, newPos, scrollState.y]);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlayout.attachEvent(\"onResize\", function(){\r\n\t\t\t\t\tif (vertical && !gantt.$scroll_ver){\r\n\t\t\t\t\t\tgantt.$scroll_ver = vertical.$scroll_ver;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (horizontal && !gantt.$scroll_hor){\r\n\t\t\t\t\t\tgantt.$scroll_hor = horizontal.$scroll_hor;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t},\r\n\r\n\t\t\t_findGridResizer: function(layout, grid){\r\n\t\t\t\tvar resizers = layout.getCellsByType(\"resizer\");\r\n\r\n\t\t\t\tvar gridFirst = true;\r\n\t\t\t\tvar gridResizer;\r\n\t\t\t\tfor(var i = 0; i < resizers.length; i++){\r\n\t\t\t\t\tvar res = resizers[i];\r\n\t\t\t\t\tres._getSiblings();\r\n\t\t\t\t\tvar prev = res._behind;\r\n\t\t\t\t\tvar next = res._front;\r\n\t\t\t\t\tif(prev && prev.$content === grid || (prev.isChild && prev.isChild(grid))){\r\n\t\t\t\t\t\tgridResizer = res;\r\n\t\t\t\t\t\tgridFirst = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}else if(next && next.$content === grid || (next.isChild && next.isChild(grid))){\r\n\t\t\t\t\t\tgridResizer = res;\r\n\t\t\t\t\t\tgridFirst = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn {\r\n\t\t\t\t\tresizer: gridResizer,\r\n\t\t\t\t\tgridFirst: gridFirst\r\n\t\t\t\t};\r\n\t\t\t},\r\n\r\n\t\t\tonInitialized: function (layout) {\r\n\t\t\t\tvar grid = gantt.$ui.getView(\"grid\");\r\n\r\n\t\t\t\tvar resizeInfo = this._findGridResizer(layout, grid);\r\n\r\n\t\t\t\t// expose grid resize events\r\n\t\t\t\tif(resizeInfo.resizer){\r\n\t\t\t\t\tvar gridFirst = resizeInfo.gridFirst,\r\n\t\t\t\t\t\tnext = resizeInfo.resizer;\r\n\t\t\t\t\tvar initialWidth;\r\n\t\t\t\t\tnext.attachEvent(\"onResizeStart\", function(prevCellWidth, nextCellWidth){\r\n\r\n\t\t\t\t\t\tvar grid = gantt.$ui.getView(\"grid\");\r\n\t\t\t\t\t\tvar viewCell = grid ? grid.$parent : null;\r\n\t\t\t\t\t\tif(viewCell){\r\n\t\t\t\t\t\t\tvar limits = grid._getGridWidthLimits();\r\n\r\n\t\t\t\t\t\t\t// min grid width is defined by min widths of its columns, unless grid has horizontal scroll\r\n\t\t\t\t\t\t\tif(!grid.$config.scrollable)\r\n\t\t\t\t\t\t\t\tviewCell.$config.minWidth = limits[0];\r\n\r\n\t\t\t\t\t\t\tviewCell.$config.maxWidth = limits[1];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tinitialWidth = gridFirst ? prevCellWidth : nextCellWidth;\r\n\t\t\t\t\t\treturn gantt.callEvent(\"onGridResizeStart\", [initialWidth]);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tnext.attachEvent(\"onResize\", function(newBehindSize, newFrontSize){\r\n\t\t\t\t\t\tvar newSize = gridFirst ? newBehindSize : newFrontSize;\r\n\t\t\t\t\t\treturn gantt.callEvent(\"onGridResize\", [initialWidth, newSize]);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tnext.attachEvent(\"onResizeEnd\", function(oldBackSize, oldFrontSize, newBackSize, newFrontSize){\r\n\r\n\t\t\t\t\t\tvar oldSize = gridFirst ? oldBackSize : oldFrontSize;\r\n\t\t\t\t\t\tvar newSize = gridFirst ? newBackSize : newFrontSize;\r\n\t\t\t\t\t\tvar grid = gantt.$ui.getView(\"grid\");\r\n\t\t\t\t\t\tvar viewCell = grid ? grid.$parent : null;\r\n\t\t\t\t\t\tif(viewCell){\r\n\t\t\t\t\t\t\tviewCell.$config.minWidth = undefined;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar res = gantt.callEvent(\"onGridResizeEnd\", [oldSize, newSize]);\r\n\t\t\t\t\t\tif(res){\r\n\t\t\t\t\t\t\tgantt.config.grid_width = newSize;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn res;\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tonDestroyed: function (timeline) {\r\n\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t};\r\n})();\r\n\r\nmodule.exports = initializer;","var domHelpers = require(\"../utils/dom_helpers\");\r\n\r\nvar initLinksDND = function(timeline, gantt) {\r\n\tvar _link_landing,\r\n\t\t_link_target_task,\r\n\t\t_link_target_task_start,\r\n\t\t_link_source_task,\r\n\t\t_link_source_task_start,\r\n\t\tmarkerDefaultOffset = 10,\r\n\t\tscrollDefaultSize = 18;\r\n\r\n\r\n\tfunction getVisibleMilestoneWidth() {\r\n\t\tvar origWidth = timeline.getItemHeight();//m-s have square shape\r\n\t\treturn Math.round(Math.sqrt(2 * origWidth * origWidth)) - 2;\r\n\t}\r\n\r\n\tfunction isMilestone(task) {\r\n\t\treturn gantt.getTaskType(task.type) == gantt.config.types.milestone;\r\n\t}\r\n\r\n\tfunction getDndState(){\r\n\t\treturn {\r\n\t\t\tlink_source_id : _link_source_task,\r\n\t\t\tlink_target_id : _link_target_task,\r\n\t\t\tlink_from_start : _link_source_task_start,\r\n\t\t\tlink_to_start : _link_target_task_start,\r\n\t\t\tlink_landing_area : _link_landing\r\n\t\t};\r\n\t}\r\n\r\n\tvar services = gantt.$services;\r\n\r\n\tvar state = services.getService(\"state\");\r\n\tvar DnD = services.getService(\"dnd\");\r\n\r\n\tstate.registerProvider(\"linksDnD\", getDndState);\r\n\r\n\tvar dnd = new DnD(timeline.$task_bars, { \r\n\t\tsensitivity : 0, \r\n\t\tupdates_per_second : 60,\r\n\t\tmousemoveContainer: gantt.$root\r\n\t});\r\n\r\n\tvar start_marker = \"task_start_date\",\r\n\t\tend_marker = \"task_end_date\",\r\n\t\tlink_edge_marker = \"gantt_link_point\",\r\n\t\tlink_landing_hover_area = \"gantt_link_control\";\r\n\r\n\tdnd.attachEvent(\"onBeforeDragStart\", gantt.bind(function(obj,e) {\r\n\t\tvar target = (e.target||e.srcElement);\r\n\t\tresetDndState();\r\n\t\tif(gantt.getState().drag_id)\r\n\t\t\treturn false;\r\n\r\n\t\tif(domHelpers.locateClassName(target, link_edge_marker)){\r\n\t\t\tif(domHelpers.locateClassName(target, start_marker))\r\n\t\t\t\t_link_source_task_start = true;\r\n\r\n\t\t\tvar sid = gantt.locate(e);\r\n\t\t\t_link_source_task = sid;\r\n\r\n\t\t\tvar t = gantt.getTask(sid);\r\n\t\t\tif(gantt.isReadonly(t)){\r\n\t\t\t\tresetDndState();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tvar shift = 0;\r\n\r\n\t\t\tthis._dir_start = getLinePos(t, !!_link_source_task_start, shift, timeline.$getConfig(), true);\r\n\t\t\treturn true;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t}, this));\r\n\r\n\tdnd.attachEvent(\"onAfterDragStart\", gantt.bind(function(obj,e) {\r\n\t\tif(gantt.config.touch) {\r\n\t\t\tgantt.refreshData();\r\n\t\t}\r\n\t\tupdateMarkedHtml(dnd.config.marker);\r\n\t}, this));\r\n\r\n\tfunction getLinePos(task, to_start, shift, cfg, isStart){\r\n\t\tvar taskPos = getMilestonePosition(task, function(task){ return gantt.getTaskPosition(task);}, cfg);\r\n\r\n\t\tvar pos = {x: taskPos.x, y: taskPos.y};\r\n\t\tif(!to_start){\r\n\t\t\tpos.x = taskPos.xEnd;\r\n\t\t}\r\n\r\n\t\t//var pos = gantt._get_task_pos(task, !!to_start);\r\n\t\tpos.y += gantt.config.row_height/2;\r\n\r\n\t\tvar offset = isMilestone(task) && isStart ? 2 : 0;\r\n\r\n\t\tshift = shift || 0;\r\n\t\tif(cfg.rtl)\r\n\t\t\tshift = shift * -1;\r\n\r\n\t\tpos.x += (to_start ? -1 : 1)*shift - offset;\r\n\t\treturn pos;\r\n\t}\r\n\r\n\tfunction getMilestonePosition(task, getTaskPosition, cfg){\r\n\t\tvar pos = getTaskPosition(task);\r\n\r\n\t\tvar res = {\r\n\t\t\tx: pos.left,\r\n\t\t\ty: pos.top,\r\n\t\t\twidth: pos.width,\r\n\t\t\theight: pos.height\r\n\t\t};\r\n\r\n\t\tif(cfg.rtl){\r\n\t\t\tres.xEnd = res.x;\r\n\t\t\tres.x = res.xEnd + res.width;\r\n\t\t}else{\r\n\t\t\tres.xEnd = res.x + res.width;\r\n\t\t}\r\n\t\tres.yEnd = res.y + res.height;\r\n\r\n\t\tif(gantt.getTaskType(task.type) == gantt.config.types.milestone){\r\n\t\t\tvar milestoneWidth = getVisibleMilestoneWidth();\r\n\r\n\t\t\tres.x += (!cfg.rtl ? -1 : 1)*(milestoneWidth / 2);\r\n\t\t\tres.xEnd += (!cfg.rtl ? 1 : -1)*(milestoneWidth / 2);\r\n\r\n\t\t\t//pos.x -= milestoneWidth / 2;\r\n\t\t\t//pos.xEnd += milestoneWidth / 2;\r\n\t\t\tres.width = pos.xEnd - pos.x;\r\n\t\t}\r\n\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\tfunction getVieportSize(){\r\n\t\tvar root = gantt.$root;\r\n\t\treturn { right: root.offsetWidth, bottom: root.offsetHeight };\r\n\t}\r\n\tfunction getMarkerSize (marker){\r\n\t\tvar width = 0, height = 0;\r\n\t\tif(marker){\r\n\t\t\twidth = marker.offsetWidth || 0;\r\n\t\t\theight = marker.offsetHeight || 0;\r\n\t\t}\r\n\t\treturn { width: width, height: height };\r\n\t}\r\n\r\n\tfunction getPosition(e, marker){\r\n\t\tvar oldPos = dnd.getPosition(e);\r\n\r\n\t\tvar markerSize = getMarkerSize(marker);\r\n\t\tvar viewportSize = getVieportSize();\r\n\r\n\t\tvar offsetX = gantt.config.tooltip_offset_x || markerDefaultOffset;\r\n\t\tvar offsetY = gantt.config.tooltip_offset_y || markerDefaultOffset;\r\n\r\n\t\tvar scrollSize = gantt.config.scroll_size || scrollDefaultSize;\r\n\r\n\t\tvar position = {\r\n\t\t\ty: oldPos.y + offsetY,\r\n\t\t\tx: oldPos.x + offsetX,\r\n\t\t\tbottom: oldPos.y + markerSize.height + offsetY + scrollSize,\r\n\t\t\tright: oldPos.x + markerSize.width + offsetX + scrollSize\r\n\t\t};\r\n\r\n\t\tif(position.bottom > viewportSize.bottom){\r\n\t\t\tposition.y = viewportSize.bottom - markerSize.height - offsetY;\r\n\t\t}\r\n\r\n\t\tif(position.right > viewportSize.right){\r\n\t\t\tposition.x = viewportSize.right - markerSize.width - offsetX;\r\n\t\t}\r\n\t\treturn position;\r\n\t}\r\n\r\n\tdnd.attachEvent(\"onDragMove\", gantt.bind(function(obj,e) {\r\n\t\tvar dd = dnd.config;\r\n\t\tvar pos = getPosition(e, dd.marker);\r\n\t\tadvanceMarker(dd.marker, pos);\r\n\t\tvar landing = !!domHelpers.locateClassName(e, link_landing_hover_area);\r\n\r\n\t\tvar prevTarget = _link_target_task;\r\n\t\tvar prevLanding = _link_landing;\r\n\t\tvar prevToStart = _link_target_task_start;\r\n\r\n\t\tvar targ = gantt.locate(e),\r\n\t\t\tto_start = true;\r\n\t\t\r\n\t\t// can drag and drop link to another gantt on the page, such links are not supported\r\n\t\tvar sameGantt = domHelpers.isChildOf(e.target || e.srcElement, gantt.$root);\r\n\t\tif(!sameGantt){\r\n\t\t\tlanding = false;\r\n\t\t\ttarg = null;\r\n\t\t}\r\n\r\n\t\tif(landing){\r\n\t\t\t//refreshTask\r\n\t\t\tto_start = !domHelpers.locateClassName(e, end_marker);\r\n\t\t\tlanding = !!targ;\r\n\t\t}\r\n\r\n\t\t_link_target_task = targ;\r\n\t\t_link_landing = landing;\r\n\t\t_link_target_task_start = to_start;\r\n\r\n\t\tif(landing){\r\n\t\t\tvar t = gantt.getTask(targ);\r\n\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tvar node = domHelpers.locateClassName(e, link_landing_hover_area);\r\n\t\t\tvar shift = 0;\r\n\t\t\tif(node){\r\n\t\t\t\tshift = Math.floor(node.offsetWidth / 2);\r\n\t\t\t}\r\n\r\n\t\t\tthis._dir_end = getLinePos(t, !!_link_target_task_start,shift, config);\r\n\t\t}else{\r\n\t\t\tthis._dir_end = domHelpers.getRelativeEventPosition(e, timeline.$task_data);\r\n\t\t\tif(gantt.env.isEdge){ // to fix margin collapsing\r\n\t\t\t\tthis._dir_end.y += window.scrollY;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar targetChanged = !(prevLanding == landing && prevTarget == targ && prevToStart == to_start);\r\n\t\tif(targetChanged){\r\n\t\t\tif(prevTarget)\r\n\t\t\t\tgantt.refreshTask(prevTarget, false);\r\n\t\t\tif(targ)\r\n\t\t\t\tgantt.refreshTask(targ, false);\r\n\t\t}\r\n\r\n\t\tif(targetChanged){\r\n\t\t\tupdateMarkedHtml(dd.marker);\r\n\t\t}\r\n\r\n\t\tshowDirectingLine(this._dir_start.x, this._dir_start.y, this._dir_end.x, this._dir_end.y);\r\n\r\n\t\treturn true;\r\n\t}, this));\r\n\r\n\r\n\tdnd.attachEvent(\"onDragEnd\", gantt.bind(function() {\r\n\t\tvar drag = getDndState();\r\n\r\n\t\tif(drag.link_source_id && drag.link_target_id && drag.link_source_id != drag.link_target_id){\r\n\t\t\tvar type = gantt._get_link_type(drag.link_from_start, drag.link_to_start);\r\n\r\n\t\t\tvar link = {source : drag.link_source_id, target: drag.link_target_id, type:type};\r\n\t\t\tif(link.type && gantt.isLinkAllowed(link)) {\r\n\t\t\t\tif(gantt.callEvent(\"onLinkCreated\", [link])){\r\n\t\t\t\t\tgantt.addLink(link);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tresetDndState();\r\n\r\n\t\tif(gantt.config.touch) {\r\n\t\t\tgantt.refreshData();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (drag.link_source_id)\r\n\t\t\t\tgantt.refreshTask(drag.link_source_id, false);\r\n\t\t\tif (drag.link_target_id)\r\n\t\t\t\tgantt.refreshTask(drag.link_target_id, false);\r\n\t\t}\r\n\t\tremoveDirectionLine();\r\n\t}, this));\r\n\r\n\tfunction updateMarkedHtml(marker){\r\n\t\tvar link = getDndState();\r\n\r\n\t\tvar css = [\"gantt_link_tooltip\"];\r\n\t\tif(link.link_source_id && link.link_target_id){\r\n\t\t\tif(gantt.isLinkAllowed(link.link_source_id, link.link_target_id, link.link_from_start, link.link_to_start)){\r\n\t\t\t\tcss.push(\"gantt_allowed_link\");\r\n\t\t\t}else{\r\n\t\t\t\tcss.push(\"gantt_invalid_link\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar className = gantt.templates.drag_link_class(link.link_source_id, link.link_from_start, link.link_target_id, link.link_to_start);\r\n\t\tif(className)\r\n\t\t\tcss.push(className);\r\n\r\n\t\tvar html = \"
\" +\r\n\t\t\tgantt.templates.drag_link(link.link_source_id, link.link_from_start, link.link_target_id, link.link_to_start) +\r\n\t\t\t\"
\";\r\n\t\tmarker.innerHTML = html;\r\n\t}\r\n\r\n\tfunction advanceMarker(marker, pos){\r\n\t\tmarker.style.left = pos.x + \"px\";\r\n\t\tmarker.style.top = pos.y + \"px\";\r\n\t}\r\n\r\n\tfunction resetDndState(){\r\n\t\t_link_source_task =\r\n\t\t\t_link_source_task_start =\r\n\t\t\t\t_link_target_task = null;\r\n\t\t_link_target_task_start = true;\r\n\t}\r\n\tfunction showDirectingLine(s_x, s_y, e_x, e_y){\r\n\t\tvar div = getDirectionLine();\r\n\r\n\t\tvar link = getDndState();\r\n\r\n\t\tvar css = [\"gantt_link_direction\"];\r\n\t\tif(gantt.templates.link_direction_class){\r\n\t\t\tcss.push(gantt.templates.link_direction_class(link.link_source_id, link.link_from_start, link.link_target_id, link.link_to_start));\r\n\t\t}\r\n\r\n\t\tvar dist =Math.sqrt( (Math.pow(e_x - s_x, 2)) + (Math.pow(e_y - s_y, 2)) );\r\n\t\tdist = Math.max(0, dist - 3);\r\n\t\tif(!dist)\r\n\t\t\treturn;\r\n\r\n\t\tdiv.className = css.join(\" \");\r\n\t\tvar tan = (e_y - s_y)/(e_x - s_x),\r\n\t\t\tangle = Math.atan(tan);\r\n\r\n\t\tif(coordinateCircleQuarter(s_x, e_x, s_y, e_y) == 2){\r\n\t\t\tangle += Math.PI;\r\n\t\t}else if(coordinateCircleQuarter(s_x, e_x, s_y, e_y) == 3){\r\n\t\t\tangle -= Math.PI;\r\n\t\t}\r\n\r\n\r\n\r\n\t\tvar sin = Math.sin(angle),\r\n\t\t\tcos = Math.cos(angle),\r\n\t\t\ttop = Math.round(s_y),\r\n\t\t\tleft = Math.round(s_x);\r\n\r\n\r\n\t\tvar style = [\r\n\t\t\t\"-webkit-transform: rotate(\"+angle+\"rad)\",\r\n\t\t\t\"-moz-transform: rotate(\"+angle+\"rad)\",\r\n\t\t\t\"-ms-transform: rotate(\"+angle+\"rad)\",\r\n\t\t\t\"-o-transform: rotate(\"+angle+\"rad)\",\r\n\t\t\t\"transform: rotate(\"+angle+\"rad)\",\r\n\t\t\t\"width:\" + Math.round(dist) + \"px\"\r\n\t\t];\r\n\r\n\t\tif(window.navigator.userAgent.indexOf(\"MSIE 8.0\") != -1){\r\n\t\t\t//ms-filter breaks styles in ie9, so add it only for 8th\r\n\t\t\tstyle.push(\"-ms-filter: \\\"\" + ieTransform(sin, cos) + \"\\\"\");\r\n\r\n\t\t\tvar shiftLeft = Math.abs(Math.round(s_x - e_x)),\r\n\t\t\t\tshiftTop = Math.abs(Math.round(e_y - s_y));\r\n\t\t\t//fix rotation axis\r\n\t\t\tswitch(coordinateCircleQuarter(s_x, e_x, s_y, e_y)){\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\ttop -= shiftTop;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tleft -= shiftLeft;\r\n\t\t\t\t\ttop -= shiftTop;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tleft -= shiftLeft;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstyle.push(\"top:\" + top + \"px\");\r\n\t\tstyle.push(\"left:\" + left + \"px\");\r\n\r\n\t\tdiv.style.cssText = style.join(\";\");\r\n\t}\r\n\r\n\tfunction ieTransform(sin, cos){\r\n\t\treturn \"progid:DXImageTransform.Microsoft.Matrix(\"+\r\n\t\t\t\"M11 = \"+cos+\",\"+\r\n\t\t\t\"M12 = -\"+sin+\",\"+\r\n\t\t\t\"M21 = \"+sin+\",\"+\r\n\t\t\t\"M22 = \"+cos+\",\"+\r\n\t\t\t\"SizingMethod = 'auto expand'\"+\r\n\t\t\")\";\r\n\t}\r\n\tfunction coordinateCircleQuarter(sX, eX, sY, eY){\r\n\t\tif(eX >= sX){\r\n\t\t\tif(eY <= sY){\r\n\t\t\t\treturn 1;\r\n\t\t\t}else{\r\n\t\t\t\treturn 4;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tif(eY <= sY){\r\n\t\t\t\treturn 2;\r\n\t\t\t}else{\r\n\t\t\t\treturn 3;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\tfunction getDirectionLine(){\r\n\t\tif(!dnd._direction || !dnd._direction.parentNode){\r\n\t\t\tdnd._direction = document.createElement(\"div\");\r\n\t\t\ttimeline.$task_links.appendChild(dnd._direction);\r\n\t\t}\r\n\t\treturn dnd._direction;\r\n\t}\r\n\tfunction removeDirectionLine(){\r\n\t\tif(dnd._direction){\r\n\t\t\tif (dnd._direction.parentNode)\t//the event line can be detached because of data refresh\r\n\t\t\t\tdnd._direction.parentNode.removeChild(dnd._direction);\r\n\r\n\t\t\tdnd._direction = null;\r\n\t\t}\r\n\t}\r\n\tgantt.attachEvent(\"onGanttRender\", gantt.bind(function() {\r\n\t\tif(dnd._direction){\r\n\t\t\tshowDirectingLine(this._dir_start.x, this._dir_start.y, this._dir_end.x, this._dir_end.y);\r\n\t\t}\r\n\t}, this));\r\n};\r\n\r\nmodule.exports = {\r\n\tcreateLinkDND: function(){\r\n\t\treturn {\r\n\t\t\tinit: initLinksDND\r\n\t\t};\r\n\t}\r\n};","var domHelpers = require(\"../utils/dom_helpers\");\r\nvar utils = require(\"../../../utils/utils\");\r\nvar timeout = require(\"../../../utils/timeout\");\r\nvar helpers = require(\"../../../utils/helpers\");\r\n\r\nfunction createTaskDND(timeline, gantt) {\r\n\tvar services = gantt.$services;\r\n\treturn {\r\n\t\tdrag: null,\r\n\t\tdragMultiple: {},\r\n\t\t_events: {\r\n\t\t\tbefore_start: {},\r\n\t\t\tbefore_finish: {},\r\n\t\t\tafter_finish: {}\r\n\t\t},\r\n\t\t_handlers: {},\r\n\t\tinit: function() {\r\n\t\t\tthis._domEvents = gantt._createDomEventScope();\r\n\t\t\tthis.clear_drag_state();\r\n\t\t\tvar drag = gantt.config.drag_mode;\r\n\t\t\tthis.set_actions();\r\n\r\n\t\t\tvar stateService = services.getService(\"state\");\r\n\t\t\tstateService.registerProvider(\"tasksDnd\", utils.bind(function() {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tdrag_id : this.drag ? this.drag.id : undefined,\r\n\t\t\t\t\tdrag_mode : this.drag ? this.drag.mode : undefined,\r\n\t\t\t\t\tdrag_from_start : this.drag ? this.drag.left : undefined\r\n\t\t\t\t};\r\n\t\t\t}, this));\r\n\r\n\t\t\tvar evs = {\r\n\t\t\t\t\"before_start\": \"onBeforeTaskDrag\",\r\n\t\t\t\t\"before_finish\": \"onBeforeTaskChanged\",\r\n\t\t\t\t\"after_finish\": \"onAfterTaskDrag\"\r\n\t\t\t};\r\n\t\t\t//for now, all drag operations will trigger the same events\r\n\t\t\tfor (var stage in this._events) {\r\n\t\t\t\tfor (var mode in drag) {\r\n\t\t\t\t\tthis._events[stage][mode] = evs[stage];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis._handlers[drag.move] = this._move;\r\n\t\t\tthis._handlers[drag.resize] = this._resize;\r\n\t\t\tthis._handlers[drag.progress] = this._resize_progress;\r\n\t\t},\r\n\t\tset_actions: function() {\r\n\t\t\tvar data = timeline.$task_data;\r\n\t\t\tthis._domEvents.attach(data, \"mousemove\", gantt.bind(function(e) {\r\n\t\t\t\tthis.on_mouse_move(e);\r\n\t\t\t}, this));\r\n\t\t\tthis._domEvents.attach(data, \"mousedown\", gantt.bind(function(e) {\r\n\t\t\t\tthis.on_mouse_down(e);\r\n\t\t\t}, this));\r\n\t\t\tthis._domEvents.attach(gantt.$root, \"mouseup\", gantt.bind(function(e) {\r\n\t\t\t\tthis.on_mouse_up(e);\r\n\t\t\t}, this));\r\n\t\t},\r\n\r\n\t\tclear_drag_state: function() {\r\n\t\t\tthis.drag = {\r\n\t\t\t\tid: null,\r\n\t\t\t\tmode: null,\r\n\t\t\t\tpos: null,\r\n\t\t\t\tstart_x: null,\r\n\t\t\t\tstart_y: null,\r\n\t\t\t\tobj: null,\r\n\t\t\t\tleft: null\r\n\t\t\t};\r\n\t\t\tthis.dragMultiple = {};\r\n\t\t},\r\n\t\t_resize: function(task, shift, drag) {\r\n\t\t\tvar cfg = timeline.$getConfig();\r\n\t\t\tvar coords_x = this._drag_task_coords(task, drag);\r\n\t\t\tif (drag.left) {\r\n\t\t\t\ttask.start_date = gantt.dateFromPos(coords_x.start + shift);\r\n\t\t\t\tif (!task.start_date) {\r\n\t\t\t\t\ttask.start_date = new Date(gantt.getState().min_date);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\ttask.end_date = gantt.dateFromPos(coords_x.end + shift);\r\n\t\t\t\tif (!task.end_date) {\r\n\t\t\t\t\ttask.end_date = new Date(gantt.getState().max_date);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar minDurationInUnits = this._calculateMinDuration(cfg.min_duration, cfg.duration_unit);\r\n\t\t\tif (task.end_date - task.start_date < cfg.min_duration) {\r\n\t\t\t\tif (drag.left)\r\n\t\t\t\t\ttask.start_date = gantt.calculateEndDate(task.end_date, -minDurationInUnits, cfg.duration_unit, task);\r\n\t\t\t\telse\r\n\t\t\t\t\ttask.end_date = gantt.calculateEndDate(task.start_date, minDurationInUnits, cfg.duration_unit, task);\r\n\t\t\t}\r\n\t\t\tgantt._init_task_timing(task);\r\n\t\t},\r\n\t\t_calculateMinDuration: function(duration, unit) {\r\n\t\t\tvar inMs = {\r\n\t\t\t\t\"minute\": 60000,\r\n\t\t\t\t\"hour\": 3600000,\r\n\t\t\t\t\"day\": 86400000,\r\n\t\t\t\t\"week\": 604800000,\r\n\t\t\t\t\"month\": 2419200000,\r\n\t\t\t\t\"year\": 31356000000\r\n\t\t\t};\r\n\t\t\treturn Math.ceil(duration / inMs[unit]);\r\n\t\t},\r\n\t\t_resize_progress: function(task, shift, drag) {\r\n\t\t\tvar coords_x = this._drag_task_coords(task, drag);\r\n\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tvar diffValue = !config.rtl ? (drag.pos.x - coords_x.start) : (coords_x.start - drag.pos.x);\r\n\r\n\t\t\tvar diff = Math.max(0, diffValue);\r\n\t\t\ttask.progress = Math.min(1, diff / Math.abs(coords_x.end - coords_x.start));\r\n\t\t},\r\n\t\t_find_max_shift: function(dragItems, shift) {\r\n\t\t\tvar correctShift;\r\n\t\t\tfor (var i in dragItems) {\r\n\t\t\t\tvar drag = dragItems[i];\r\n\t\t\t\tvar task = gantt.getTask(drag.id);\r\n\r\n\t\t\t\tvar coords_x = this._drag_task_coords(task, drag);\r\n\t\t\t\tvar minX = gantt.posFromDate(new Date(gantt.getState().min_date));\r\n\t\t\t\tvar maxX = gantt.posFromDate(new Date(gantt.getState().max_date));\r\n\r\n\t\t\t\tif (coords_x.end + shift > maxX) {\r\n\t\t\t\t\tvar maxShift = maxX - coords_x.end;\r\n\t\t\t\t\tif (maxShift < correctShift || correctShift === undefined) {\r\n\t\t\t\t\t\tcorrectShift = maxShift;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (coords_x.start + shift < minX) {\r\n\t\t\t\t\tvar minShift = minX - coords_x.start;\r\n\t\t\t\t\tif (minShift > correctShift || correctShift === undefined) {\r\n\t\t\t\t\t\tcorrectShift = minShift;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn correctShift;\r\n\t\t},\r\n\t\t_move: function(task, shift, drag) {\r\n\t\t\tvar coords_x = this._drag_task_coords(task, drag);\r\n\t\t\tvar new_start = gantt.dateFromPos(coords_x.start + shift),\r\n\t\t\t\tnew_end = gantt.dateFromPos(coords_x.end + shift);\r\n\t\t\tif (!new_start) {\r\n\t\t\t\ttask.start_date = new Date(gantt.getState().min_date);\r\n\t\t\t\ttask.end_date = gantt.dateFromPos(gantt.posFromDate(task.start_date) + (coords_x.end - coords_x.start));\r\n\t\t\t} else if (!new_end) {\r\n\t\t\t\ttask.end_date = new Date(gantt.getState().max_date);\r\n\t\t\t\ttask.start_date = gantt.dateFromPos(gantt.posFromDate(task.end_date) - (coords_x.end - coords_x.start));\r\n\t\t\t} else {\r\n\t\t\t\ttask.start_date = new_start;\r\n\t\t\t\ttask.end_date = new_end;\r\n\t\t\t}\r\n\t\t},\r\n\t\t_drag_task_coords: function(t, drag) {\r\n\t\t\tvar start = drag.obj_s_x = drag.obj_s_x || gantt.posFromDate(t.start_date);\r\n\t\t\tvar end = drag.obj_e_x = drag.obj_e_x || gantt.posFromDate(t.end_date);\r\n\t\t\treturn {\r\n\t\t\t\tstart: start,\r\n\t\t\t\tend: end\r\n\t\t\t};\r\n\t\t},\r\n\t\t_mouse_position_change: function(oldPos, newPos) {\r\n\t\t\tvar dx = oldPos.x - newPos.x,\r\n\t\t\t\tdy = oldPos.y - newPos.y;\r\n\t\t\treturn Math.sqrt(dx * dx + dy * dy);\r\n\t\t},\r\n\t\t_is_number: function(n) {\r\n\t\t\treturn !isNaN(parseFloat(n)) && isFinite(n);\r\n\t\t},\r\n\r\n\t\ton_mouse_move: function(e) {\r\n\t\t\tif (this.drag.start_drag) {\r\n\t\t\t\tvar pos = domHelpers.getRelativeEventPosition(e, gantt.$task_data);\r\n\r\n\t\t\t\tvar sX = this.drag.start_drag.start_x,\r\n\t\t\t\t\tsY = this.drag.start_drag.start_y;\r\n\r\n\t\t\t\tif ((Date.now() - this.drag.timestamp > 50) ||\r\n\t\t\t\t\t(this._is_number(sX) && this._is_number(sY) && this._mouse_position_change({\r\n\t\t\t\t\t\tx: sX,\r\n\t\t\t\t\t\ty: sY\r\n\t\t\t\t\t}, pos) > 20)) {\r\n\t\t\t\t\tthis._start_dnd(e);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar drag = this.drag;\r\n\r\n\t\t\tif (drag.mode) {\r\n\t\t\t\tif (!timeout(this, 40))//limit update frequency\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tthis._update_on_move(e);\r\n\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t_update_item_on_move: function(shift, id, mode, drag, e) {\r\n\t\t\tvar task = gantt.getTask(id);\r\n\t\t\tvar original = gantt.mixin({}, task);\r\n\t\t\tvar copy = gantt.mixin({}, task);\r\n\t\t\tthis._handlers[mode].apply(this, [copy, shift, drag]);\r\n\t\t\tgantt.mixin(task, copy, true);\r\n\t\t\t//gantt._update_parents(drag.id, true);\r\n\t\t\tgantt.callEvent(\"onTaskDrag\", [task.id, mode, copy, original, e]);\r\n\t\t\tgantt.mixin(task, copy, true);\r\n\t\t\tgantt.refreshTask(id);\r\n\t\t},\r\n\r\n\t\t_update_on_move: function(e) {\r\n\t\t\tvar drag = this.drag;\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tif (drag.mode) {\r\n\t\t\t\tvar pos = domHelpers.getRelativeEventPosition(e, timeline.$task_data);\r\n\t\t\t\tif (drag.pos && drag.pos.x == pos.x)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tdrag.pos = pos;\r\n\r\n\t\t\t\tvar curr_date = gantt.dateFromPos(pos.x);\r\n\t\t\t\tif (!curr_date || isNaN(curr_date.getTime()))\r\n\t\t\t\t\treturn;\r\n\r\n\r\n\t\t\t\tvar shift = pos.x - drag.start_x;\r\n\t\t\t\tvar task = gantt.getTask(drag.id);\r\n\t\t\t\tif (this._handlers[drag.mode]) {\r\n\t\t\t\t\tif (drag.mode === config.drag_mode.move) {\r\n\t\t\t\t\t\tvar dragHash = {};\r\n\r\n\t\t\t\t\t\tif (this._isMultiselect()) {\r\n\t\t\t\t\t\t\tvar selectedTasksIds = gantt.getSelectedTasks();\r\n\t\t\t\t\t\t\tif (selectedTasksIds.indexOf(drag.id) >= 0) {\r\n\t\t\t\t\t\t\t\tdragHash = this.dragMultiple;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (gantt.isSummaryTask(task) && gantt.config.drag_project) {\r\n\t\t\t\t\t\t\tvar initialDrag = {};\r\n\t\t\t\t\t\t\tinitialDrag[drag.id] = utils.copy(drag);\r\n\t\t\t\t\t\t\tdragHash = utils.mixin(initialDrag, this.dragMultiple);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tvar maxShift = this._find_max_shift(dragHash, shift);\r\n\t\t\t\t\t\tif (maxShift !== undefined) {\r\n\t\t\t\t\t\t\tshift = maxShift;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis._update_item_on_move(shift, drag.id, drag.mode, drag, e);\r\n\t\t\t\t\t\tfor (var i in dragHash) {\r\n\t\t\t\t\t\t\tvar childDrag = dragHash[i];\r\n\t\t\t\t\t\t\tthis._update_item_on_move(shift, childDrag.id, childDrag.mode, childDrag, e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// for resize and progress\r\n\t\t\t\t\t\tthis._update_item_on_move(shift, drag.id, drag.mode, drag, e);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgantt._update_parents(drag.id);\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\ton_mouse_down: function(e, src) {\r\n\t\t\t// on Mac we do not get onmouseup event when clicking right mouse button leaving us in dnd state\r\n\t\t\t// let's ignore right mouse button then\r\n\t\t\tif (e.button == 2 && e.button !== undefined)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tvar id = gantt.locate(e);\r\n\t\t\tvar task = null;\r\n\t\t\tif (gantt.isTaskExists(id)) {\r\n\t\t\t\ttask = gantt.getTask(id);\r\n\t\t\t}\r\n\r\n\t\t\tif (gantt.isReadonly(task) || this.drag.mode) return;\r\n\r\n\t\t\tthis.clear_drag_state();\r\n\r\n\t\t\tsrc = src || (e.target || e.srcElement);\r\n\r\n\t\t\tvar className = domHelpers.getClassName(src);\r\n\t\t\tvar drag = this._get_drag_mode(className, src);\r\n\r\n\t\t\tif (!className || !drag) {\r\n\t\t\t\tif (src.parentNode)\r\n\t\t\t\t\treturn this.on_mouse_down(e, src.parentNode);\r\n\t\t\t\telse\r\n\t\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (!drag) {\r\n\t\t\t\tif (gantt.checkEvent(\"onMouseDown\") && gantt.callEvent(\"onMouseDown\", [className.split(\" \")[0]])) {\r\n\t\t\t\t\tif (src.parentNode)\r\n\t\t\t\t\t\treturn this.on_mouse_down(e, src.parentNode);\r\n\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (drag.mode && drag.mode != config.drag_mode.ignore && config[\"drag_\" + drag.mode]) {\r\n\t\t\t\t\tid = gantt.locate(src);\r\n\t\t\t\t\ttask = gantt.copy(gantt.getTask(id) || {});\r\n\r\n\t\t\t\t\tif (gantt.isReadonly(task)) {\r\n\t\t\t\t\t\tthis.clear_drag_state();\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ((gantt.isSummaryTask(task) && !config.drag_project) && drag.mode != config.drag_mode.progress) {//only progress drag is allowed for tasks with flexible duration\r\n\t\t\t\t\t\tthis.clear_drag_state();\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdrag.id = id;\r\n\t\t\t\t\tvar pos = domHelpers.getRelativeEventPosition(e, gantt.$task_data);\r\n\r\n\t\t\t\t\tdrag.start_x = pos.x;\r\n\t\t\t\t\tdrag.start_y = pos.y;\r\n\t\t\t\t\tdrag.obj = task;\r\n\t\t\t\t\tthis.drag.start_drag = drag;\r\n\t\t\t\t\tthis.drag.timestamp = Date.now();\r\n\r\n\t\t\t\t} else\r\n\t\t\t\t\tthis.clear_drag_state();\r\n\t\t\t}\r\n\t\t},\r\n\t\t_fix_dnd_scale_time: function(task, drag) {\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tvar unit = gantt.getScale().unit,\r\n\t\t\t\tstep = gantt.getScale().step;\r\n\t\t\tif (!config.round_dnd_dates) {\r\n\t\t\t\tunit = 'minute';\r\n\t\t\t\tstep = config.time_step;\r\n\t\t\t}\r\n\r\n\t\t\tfunction fixStart(task) {\r\n\t\t\t\tif (!gantt.config.correct_work_time)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tvar config = timeline.$getConfig();\r\n\t\t\t\tif (!gantt.isWorkTime(task.start_date, undefined, task))\r\n\t\t\t\t\ttask.start_date = gantt.calculateEndDate({\r\n\t\t\t\t\t\tstart_date: task.start_date,\r\n\t\t\t\t\t\tduration: -1,\r\n\t\t\t\t\t\tunit: config.duration_unit,\r\n\t\t\t\t\t\ttask: task\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tfunction fixEnd(task) {\r\n\t\t\t\tif (!gantt.config.correct_work_time)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tvar config = timeline.$getConfig();\r\n\t\t\t\tif (!gantt.isWorkTime(new Date(task.end_date - 1), undefined, task))\r\n\t\t\t\t\ttask.end_date = gantt.calculateEndDate({\r\n\t\t\t\t\t\tstart_date: task.end_date,\r\n\t\t\t\t\t\tduration: 1,\r\n\t\t\t\t\t\tunit: config.duration_unit,\r\n\t\t\t\t\t\ttask: task\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif (drag.mode == config.drag_mode.resize) {\r\n\t\t\t\tif (drag.left) {\r\n\t\t\t\t\ttask.start_date = gantt.roundDate({date: task.start_date, unit: unit, step: step});\r\n\t\t\t\t\tfixStart(task);\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttask.end_date = gantt.roundDate({date: task.end_date, unit: unit, step: step});\r\n\t\t\t\t\tfixEnd(task);\r\n\t\t\t\t}\r\n\t\t\t} else if (drag.mode == config.drag_mode.move) {\r\n\t\t\t\ttask.start_date = gantt.roundDate({date: task.start_date, unit: unit, step: step});\r\n\t\t\t\tfixStart(task);\r\n\t\t\t\ttask.end_date = gantt.calculateEndDate(task);\r\n\t\t\t}\r\n\t\t},\r\n\t\t_fix_working_times: function(task, drag) {\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tvar drag = drag || {mode: config.drag_mode.move};\r\n\r\n\t\t\tif (drag.mode == config.drag_mode.resize) {\r\n\t\t\t\tif (drag.left) {\r\n\t\t\t\t\ttask.start_date = gantt.getClosestWorkTime({date: task.start_date, dir: 'future', task: task});\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttask.end_date = gantt.getClosestWorkTime({date: task.end_date, dir: 'past', task: task});\r\n\t\t\t\t}\r\n\t\t\t} else if (drag.mode == config.drag_mode.move) {\r\n\t\t\t\tgantt.correctTaskWorkTime(task);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t_finalize_mouse_up: function(taskId, config, drag, e) {\r\n\t\t\tvar task = gantt.getTask(taskId);\r\n\r\n\t\t\tif (config.work_time && config.correct_work_time) {\r\n\t\t\t\tthis._fix_working_times(task, drag);\r\n\t\t\t}\r\n\r\n\t\t\tthis._fix_dnd_scale_time(task, drag);\r\n\r\n\t\t\tif (!this._fireEvent(\"before_finish\", drag.mode, [taskId, drag.mode, gantt.copy(drag.obj), e])) {\r\n\t\t\t\t//drag.obj._dhx_changed = false;\r\n\t\t\t\tthis.clear_drag_state();\r\n\t\t\t\tif (taskId == drag.id) {\r\n\t\t\t\t\tdrag.obj._dhx_changed = false;\r\n\t\t\t\t\tgantt.mixin(task, drag.obj, true);\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tgantt.refreshTask(task.id);\r\n\t\t\t} else {\r\n\t\t\t\tvar drag_id = taskId;\r\n\r\n\t\t\t\tgantt._init_task_timing(task);\r\n\r\n\t\t\t\tthis.clear_drag_state();\r\n\t\t\t\tgantt.updateTask(task.id);\r\n\t\t\t\tthis._fireEvent(\"after_finish\", drag.mode, [drag_id, drag.mode, e]);\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\ton_mouse_up: function(e) {\r\n\r\n\t\t\tvar drag = this.drag;\r\n\t\t\tif (drag.mode && drag.id) {\r\n\t\t\t\tvar config = timeline.$getConfig();\r\n\t\t\t\t//drop\r\n\t\t\t\tvar task = gantt.getTask(drag.id);\r\n\t\t\t\tvar dragMultiple = this.dragMultiple;\r\n\r\n\t\t\t\tif (drag.mode === config.drag_mode.move) {\r\n\t\t\t\t\tif ((gantt.isSummaryTask(task) && config.drag_project) || (this._isMultiselect())) {\r\n\t\t\t\t\t\tfor (var i in dragMultiple) {\r\n\t\t\t\t\t\t\tthis._finalize_mouse_up(dragMultiple[i].id, config, dragMultiple[i], e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis._finalize_mouse_up(drag.id, config, drag, e);\r\n\t\t\t}\r\n\t\t\tthis.clear_drag_state();\r\n\t\t},\r\n\t\t_get_drag_mode: function(className, el) {\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tvar modes = config.drag_mode;\r\n\t\t\tvar classes = (className || \"\").split(\" \");\r\n\t\t\tvar classname = classes[0];\r\n\t\t\tvar drag = {mode: null, left: null};\r\n\t\t\tswitch (classname) {\r\n\t\t\t\tcase \"gantt_task_line\":\r\n\t\t\t\tcase \"gantt_task_content\":\r\n\t\t\t\t\tdrag.mode = modes.move;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"gantt_task_drag\":\r\n\t\t\t\t\tdrag.mode = modes.resize;\r\n\r\n\t\t\t\t\tvar dragProperty = el.getAttribute(\"data-bind-property\");\r\n\r\n\t\t\t\t\tif (dragProperty == \"start_date\") {\r\n\t\t\t\t\t\tdrag.left = true;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdrag.left = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"gantt_task_progress_drag\":\r\n\t\t\t\t\tdrag.mode = modes.progress;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"gantt_link_control\":\r\n\t\t\t\tcase \"gantt_link_point\":\r\n\t\t\t\t\tdrag.mode = modes.ignore;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tdrag = null;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn drag;\r\n\r\n\t\t},\r\n\r\n\t\t_start_dnd: function(e) {\r\n\t\t\tvar drag = this.drag = this.drag.start_drag;\r\n\t\t\tdelete drag.start_drag;\r\n\r\n\t\t\tvar cfg = timeline.$getConfig();\r\n\t\t\tvar id = drag.id;\r\n\r\n\t\t\tif (!cfg[\"drag_\" + drag.mode] || !gantt.callEvent(\"onBeforeDrag\", [id, drag.mode, e]) || !this._fireEvent(\"before_start\", drag.mode, [id, drag.mode, e])) {\r\n\t\t\t\tthis.clear_drag_state();\r\n\t\t\t} else {\r\n\t\t\t\tdelete drag.start_drag;\r\n\t\t\t\tvar task = gantt.getTask(id);\r\n\t\t\t\tif (gantt.isReadonly(task)){\r\n\t\t\t\t\tthis.clear_drag_state();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tif (this._isMultiselect()) {\r\n\t\t\t\t\t// for don't move selected tasks when drag unselected task\r\n\t\t\t\t\tvar selectedTasksIds = gantt.getSelectedTasks();\r\n\t\t\t\t\tif (selectedTasksIds.indexOf(drag.id) >= 0) {\r\n\t\t\t\t\t\thelpers.forEach(selectedTasksIds, gantt.bind(function(taskId) {\r\n\t\t\t\t\t\t\tvar selectedTask = gantt.getTask(taskId);\r\n\t\t\t\t\t\t\tif (gantt.isSummaryTask(selectedTask) && gantt.config.drag_project && drag.mode == cfg.drag_mode.move) {\r\n\t\t\t\t\t\t\t\tthis._addSubtasksToDragMultiple(selectedTask.id);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.dragMultiple[taskId] = gantt.mixin({\r\n\t\t\t\t\t\t\t\tid: selectedTask.id,\r\n\t\t\t\t\t\t\t\tobj: gantt.copy(selectedTask)\r\n\t\t\t\t\t\t\t}, this.drag);\r\n\t\t\t\t\t\t}, this));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// for move unselected summary\r\n\t\t\t\tif (gantt.isSummaryTask(task) && gantt.config.drag_project && drag.mode == cfg.drag_mode.move) {\r\n\t\t\t\t\tthis._addSubtasksToDragMultiple(task.id);\r\n\t\t\t\t}\r\n\t\t\t\tgantt.callEvent(\"onTaskDragStart\", []);\r\n\t\t\t}\r\n\r\n\t\t},\r\n\t\t_fireEvent: function(stage, mode, params) {\r\n\t\t\tgantt.assert(this._events[stage], \"Invalid stage:{\" + stage + \"}\");\r\n\r\n\t\t\tvar trigger = this._events[stage][mode];\r\n\r\n\t\t\tgantt.assert(trigger, \"Unknown after drop mode:{\" + mode + \"}\");\r\n\t\t\tgantt.assert(params, \"Invalid event arguments\");\r\n\r\n\r\n\t\t\tif (!gantt.checkEvent(trigger))\r\n\t\t\t\treturn true;\r\n\r\n\t\t\treturn gantt.callEvent(trigger, params);\r\n\t\t},\r\n\r\n\t\tround_task_dates: function(task) {\r\n\t\t\tvar drag_state = this.drag;\r\n\t\t\tvar config = timeline.$getConfig();\r\n\t\t\tif (!drag_state) {\r\n\t\t\t\tdrag_state = {mode: config.drag_mode.move};\r\n\t\t\t}\r\n\t\t\tthis._fix_dnd_scale_time(task, drag_state);\r\n\t\t},\r\n\t\tdestructor: function() {\r\n\t\t\tthis._domEvents.detachAll();\r\n\t\t},\r\n\t\t_isMultiselect: function() {\r\n\t\t\treturn gantt.config.drag_multiple && !!(gantt.getSelectedTasks && gantt.getSelectedTasks().length > 0);\r\n\t\t},\r\n\t\t_addSubtasksToDragMultiple: function(summaryId) {\r\n\t\t\tgantt.eachTask(function(child) {\r\n\t\t\t\tthis.dragMultiple[child.id] = gantt.mixin({\r\n\t\t\t\t\tid: child.id,\r\n\t\t\t\t\tobj: gantt.copy(child)\r\n\t\t\t\t}, this.drag);\r\n\t\t\t}, summaryId, this);\r\n\t\t}\r\n\t};\r\n}\r\n\r\nfunction initTaskDND() {\r\n\tvar _tasks_dnd;\r\n\treturn {\r\n\t\textend: function(timeline) {\r\n\t\t\ttimeline.roundTaskDates = function(task) {\r\n\t\t\t\t_tasks_dnd.round_task_dates(task);\r\n\t\t\t};\r\n\r\n\t\t},\r\n\t\tinit: function(timeline, gantt) {\r\n\t\t\t_tasks_dnd = createTaskDND(timeline, gantt);\r\n\t\t\t// TODO: entry point for touch handlers, move touch to timeline\r\n\t\t\ttimeline._tasks_dnd = _tasks_dnd;\r\n\t\t\treturn _tasks_dnd.init(gantt);\r\n\t\t},\r\n\t\tdestructor: function() {\r\n\t\t\tif (_tasks_dnd) {\r\n\t\t\t\t_tasks_dnd.destructor();\r\n\t\t\t\t_tasks_dnd = null;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n}\r\n\r\nmodule.exports = {\r\n\tcreateTaskDND: initTaskDND\r\n};\r\n","var utils = require(\"../../../utils/utils\"),\r\n\ttaskDnD = require(\"./tasks_dnd\"),\r\n\tlinkDnD = require(\"./links_dnd\"),\r\n\tdomHelpers = require(\"../utils/dom_helpers\");\r\n\r\nvar initializer = (function(){\r\n\treturn function(gantt){\r\n\t\tvar services = gantt.$services;\r\n\t\treturn {\r\n\t\t\tonCreated: function (timeline) {\r\n\t\t\t\tvar config = timeline.$config;\r\n\t\t\t\tconfig.bind = utils.defined(config.bind) ? config.bind : \"task\";\r\n\t\t\t\tconfig.bindLinks = utils.defined(config.bindLinks) ? config.bindLinks : \"link\";\r\n\r\n\t\t\t\ttimeline._linksDnD = linkDnD.createLinkDND();\r\n\t\t\t\ttimeline._tasksDnD = taskDnD.createTaskDND();\r\n\t\t\t\ttimeline._tasksDnD.extend(timeline);\r\n\r\n\t\t\t\tthis._mouseDelegates = require(\"../mouse_event_container\")(gantt);\r\n\t\t\t},\r\n\t\t\tonInitialized: function (timeline) {\r\n\t\t\t\tthis._attachDomEvents(gantt);\r\n\r\n\t\t\t\tthis._attachStateProvider(gantt, timeline);\r\n\r\n\t\t\t\ttimeline._tasksDnD.init(timeline, gantt);\r\n\t\t\t\ttimeline._linksDnD.init(timeline, gantt);\r\n\r\n\t\t\t\tif(timeline.$config.id == \"timeline\"){\r\n\t\t\t\t\tthis.extendDom(timeline);\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tonDestroyed: function (timeline) {\r\n\t\t\t\tthis._clearDomEvents(gantt);\r\n\t\t\t\tthis._clearStateProvider(gantt);\r\n\t\t\t\tif (timeline._tasksDnD) {\r\n\t\t\t\t\ttimeline._tasksDnD.destructor();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\textendDom: function(timeline){\r\n\t\t\t\tgantt.$task = timeline.$task;\r\n\t\t\t\tgantt.$task_scale = timeline.$task_scale;\r\n\t\t\t\tgantt.$task_data = timeline.$task_data;\r\n\t\t\t\tgantt.$task_bg = timeline.$task_bg;\r\n\t\t\t\tgantt.$task_links = timeline.$task_links;\r\n\t\t\t\tgantt.$task_bars = timeline.$task_bars;\r\n\t\t\t},\r\n\r\n\t\t\t_clearDomEvents: function(){\r\n\t\t\t\tthis._mouseDelegates.destructor();\r\n\t\t\t\tthis._mouseDelegates = null;\r\n\t\t\t},\r\n\r\n\t\t\t_attachDomEvents: function(gantt){\r\n\t\t\t\tfunction _delete_link_handler(id, e) {\r\n\t\t\t\t\tif (id && this.callEvent(\"onLinkDblClick\", [id, e])) {\r\n\r\n\t\t\t\t\t\tvar link = this.getLink(id);\r\n\t\t\t\t\t\tif (this.isReadonly(link)) return;\r\n\r\n\t\t\t\t\t\tvar title = \"\";\r\n\t\t\t\t\t\tvar question = this.locale.labels.link + \" \" + this.templates.link_description(this.getLink(id)) + \" \" + this.locale.labels.confirm_link_deleting;\r\n\r\n\t\t\t\t\t\twindow.setTimeout(function () {\r\n\t\t\t\t\t\t\tgantt._dhtmlx_confirm(question, title, function () {\r\n\t\t\t\t\t\t\t\tgantt.deleteLink(id);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}, (this.config.touch ? 300 : 1));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_task_link\", gantt.bind(function (e, trg) {\r\n\t\t\t\t\tvar id = this.locate(e, this.config.link_attribute);\r\n\t\t\t\t\tif (id) {\r\n\t\t\t\t\t\tthis.callEvent(\"onLinkClick\", [id, e]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}, gantt), this.$task);\r\n\r\n\t\t\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_scale_cell\", gantt.bind(function (e, trg) {\r\n\t\t\t\t\tvar pos = domHelpers.getRelativeEventPosition(e, gantt.$task_data);\r\n\t\t\t\t\tvar date = gantt.dateFromPos(pos.x);\r\n\t\t\t\t\tvar coll = Math.floor(gantt.columnIndexByDate(date));\r\n\r\n\t\t\t\t\tvar coll_date = gantt.getScale().trace_x[coll];\r\n\r\n\t\t\t\t\tgantt.callEvent(\"onScaleClick\", [e, coll_date]);\r\n\t\t\t\t}, gantt), this.$task);\r\n\r\n\t\t\t\tthis._mouseDelegates.delegate(\"doubleclick\", \"gantt_task_link\", gantt.bind(function (e, id, trg) {\r\n\t\t\t\t\tvar id = this.locate(e, gantt.config.link_attribute);\r\n\t\t\t\t\t_delete_link_handler.call(this, id, e);\r\n\t\t\t\t}, gantt), this.$task);\r\n\r\n\t\t\t\tthis._mouseDelegates.delegate(\"doubleclick\", \"gantt_link_point\", gantt.bind(function (e, id, trg) {\r\n\t\t\t\t\tvar id = this.locate(e),\r\n\t\t\t\t\t\ttask = this.getTask(id);\r\n\r\n\t\t\t\t\tvar link = null;\r\n\t\t\t\t\tif (trg.parentNode && domHelpers.getClassName(trg.parentNode)) {\r\n\t\t\t\t\t\tif (domHelpers.getClassName(trg.parentNode).indexOf(\"_left\") > -1) {\r\n\t\t\t\t\t\t\tlink = task.$target[0];\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tlink = task.$source[0];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (link)\r\n\t\t\t\t\t\t_delete_link_handler.call(this, link, e);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}, gantt), this.$task);\r\n\t\t\t},\r\n\r\n\t\t\t_attachStateProvider: function(gantt, timeline){\r\n\t\t\t\tvar self = timeline;\r\n\t\t\t\tvar state = services.getService(\"state\");\r\n\t\t\t\tstate.registerProvider(\"tasksTimeline\", function(){\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tscale_unit: self._tasks ? self._tasks.unit : undefined,\r\n\t\t\t\t\t\tscale_step: self._tasks ? self._tasks.step : undefined\r\n\t\t\t\t\t};\r\n\t\t\t\t});\r\n\t\t\t},\r\n\r\n\t\t\t_clearStateProvider: function(){\r\n\t\t\t\tvar state = services.getService(\"state\");\r\n\t\t\t\tstate.unregisterProvider(\"tasksTimeline\");\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\r\n})();\r\n\r\nmodule.exports = initializer;","var domHelpers = require(\"../../utils/dom_helpers\");\r\n\r\n/**\r\n * methods for highlighting current drag and drop position\r\n */\r\n\r\nfunction highlightPosition(target, root, grid){\r\n\tvar markerPos = getTaskMarkerPosition(target, grid);\r\n\t// setting position of row\r\n\troot.marker.style.left = markerPos.x + 9 + \"px\";\r\n\troot.marker.style.top = markerPos.y + \"px\";\r\n\tvar markerLine = root.markerLine;\r\n\tif(!markerLine){\r\n\t\tmarkerLine = document.createElement(\"div\");\r\n\t\tmarkerLine.className = \"gantt_drag_marker gantt_grid_dnd_marker\";\r\n\t\tmarkerLine.innerHTML = \"
\";\r\n\t\tmarkerLine.style.pointerEvents = \"none\";\r\n\t\tdocument.body.appendChild(markerLine);\r\n\t\troot.markerLine = markerLine;\r\n\t}\r\n\tif(target.child){\r\n\t\thighlightFolder(target, markerLine, grid);\r\n\t}else{\r\n\t\thighlightRow(target, markerLine, grid);\r\n\t}\r\n}\r\n\r\nfunction removeLineHighlight(root){\r\n\tif(root.markerLine && root.markerLine.parentNode){\r\n\t\troot.markerLine.parentNode.removeChild(root.markerLine);\r\n\t}\r\n\troot.markerLine = null;\r\n}\r\n\r\nfunction highlightRow(target, markerLine, grid){\r\n\tvar linePos = getLineMarkerPosition(target, grid);\r\n\r\n\tmarkerLine.innerHTML = \"
\";\r\n\tmarkerLine.style.left = linePos.x + \"px\";\r\n\tmarkerLine.style.height = \"4px\";\r\n\r\n\tmarkerLine.style.top = (linePos.y - 2) + \"px\";\r\n\tmarkerLine.style.width = linePos.width + \"px\";\r\n\r\n\treturn markerLine;\r\n}\r\nfunction highlightFolder(target, markerFolder, grid){\r\n\tvar id = target.targetParent;\r\n\tvar pos = gridToPageCoordinates({x: 0, y: grid.getItemTop(id)}, grid);\r\n\r\n\tmarkerFolder.innerHTML = \"
\";\r\n\tmarkerFolder.style.width = grid.$grid_data.offsetWidth + \"px\";\r\n\tmarkerFolder.style.top = pos.y + \"px\";\r\n\tmarkerFolder.style.left = pos.x + \"px\";\r\n\tmarkerFolder.style.height = grid.getItemHeight(id) + \"px\";\r\n\treturn markerFolder;\r\n}\r\n\r\nfunction getLineMarkerPosition(target, grid){\r\n\tvar store = grid.$config.rowStore;\r\n\tvar pos = {x:0, y:0};\r\n\tvar indentNode = grid.$grid_data.querySelector(\".gantt_tree_indent\");\r\n\tvar indent = 15;\r\n\tvar level = 0;\r\n\tif(indentNode){\r\n\t\tindent = indentNode.offsetWidth;\r\n\t}\r\n\tvar iconWidth = 40;\r\n\tif(target.targetId !== store.$getRootId()){\r\n\t\tvar itemTop = grid.getItemTop(target.targetId);\r\n\t\tvar itemHeight = grid.getItemHeight(target.targetId);\r\n\t\tlevel = store.exists(target.targetId) ? store.calculateItemLevel(store.getItem(target.targetId)) : 0;\r\n\r\n\t\tif(target.prevSibling){\r\n\t\t\tpos.y = itemTop;\r\n\t\t}else if(target.nextSibling){\r\n\t\t\tvar childCount = 0;\r\n\t\t\tstore.eachItem(function(child){\r\n\t\t\t\tif(store.getIndexById(child.id) !== -1)\r\n\t\t\t\t\tchildCount++;\r\n\t\t\t}, target.targetId);\r\n\r\n\t\t\tpos.y = itemTop + itemHeight + childCount*itemHeight;\r\n\t\t}else {\r\n\t\t\tpos.y = itemTop + itemHeight;\r\n\t\t\tlevel += 1;\r\n\t\t}\r\n\t}\r\n\tpos.x = iconWidth + level * indent;\r\n\tpos.width = Math.max(grid.$grid_data.offsetWidth - pos.x, 0);\r\n\treturn gridToPageCoordinates(pos, grid);\r\n}\r\n\r\nfunction gridToPageCoordinates(pos, grid){\r\n\tvar gridPos = domHelpers.getNodePosition(grid.$grid_data);\r\n\tpos.x += gridPos.x - grid.$grid.scrollLeft;\r\n\tpos.y += gridPos.y - grid.$grid_data.scrollTop;\r\n\treturn pos;\r\n}\r\n\r\nfunction getTaskMarkerPosition(e, grid) {\r\n\tvar pos = domHelpers.getNodePosition(grid.$grid_data);\r\n\tvar ePos = domHelpers.getRelativeEventPosition(e, grid.$grid_data);\r\n\tvar store = grid.$config.rowStore;\r\n\t// row offset\r\n\tvar x = pos.x;\r\n\tvar y = ePos.y - 10;\r\n\r\n\tvar config = grid.$getConfig();\r\n\t// prevent moving row out of grid_data container\r\n\tif (y < pos.y) y = pos.y;\r\n\tvar gridHeight = store.countVisible() * config.row_height;\r\n\tif (y > pos.y + gridHeight - config.row_height) y = pos.y + gridHeight - config.row_height;\r\n\r\n\tpos.x = x;\r\n\tpos.y = y;\r\n\treturn pos;\r\n}\r\n\r\nmodule.exports = {\r\n\tremoveLineHighlight: removeLineHighlight,\r\n\thighlightPosition: highlightPosition\r\n};\r\n","/**\r\n * resolve dnd position of the task when gantt.config.order_branch_free = true\r\n */\r\n\r\nvar dropTarget = require(\"./drop_target\");\r\n\r\nmodule.exports = function getMultiLevelDropPosition(dndTaskId, targetTaskId, relTargetPos, eventTop, store){\r\n\tvar result;\r\n\r\n\tif(targetTaskId !== store.$getRootId()){\r\n\t\tif(relTargetPos < 0.25){\r\n\t\t\tresult = dropTarget.prevSiblingTarget(dndTaskId, targetTaskId, store);\r\n\t\t}else if(relTargetPos > 0.60 && !(store.hasChild(targetTaskId) && store.getItem(targetTaskId).$open)){\r\n\t\t\tresult = dropTarget.nextSiblingTarget(dndTaskId, targetTaskId, store);\r\n\t\t}else {\r\n\t\t\tresult = dropTarget.firstChildTarget(dndTaskId, targetTaskId, store);\r\n\t\t}\r\n\t}else{\r\n\t\tvar rootId = store.$getRootId();\r\n\t\tif(store.hasChild(rootId) && eventTop >= 0){\r\n\t\t\tresult = dropTarget.lastChildTarget(dndTaskId, rootId, store);\r\n\t\t}else{\r\n\t\t\tresult = dropTarget.firstChildTarget(dndTaskId, rootId, store);\r\n\t\t}\r\n\t}\r\n\r\n\treturn result;\r\n};","/**\r\n * resolve dnd position of the task when gantt.config.order_branch_free = false\r\n */\r\n\r\nvar dropTarget = require(\"./drop_target\");\r\n\r\nfunction getLast(store){\r\n\tvar current = store.getNext();\r\n\twhile(store.exists(current)){\r\n\r\n\t\tvar next = store.getNext(current);\r\n\t\tif(!store.exists(next)){\r\n\t\t\treturn current;\r\n\t\t}else{\r\n\t\t\tcurrent = next;\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n}\r\n\r\nfunction findClosesTarget(dndTaskId, taskId, allowedLevel, store, up){\r\n\tvar prev = taskId;\r\n\twhile(store.exists(prev)){\r\n\t\tvar targetLevel = store.calculateItemLevel(store.getItem(prev));\r\n\t\tif((targetLevel === allowedLevel || targetLevel === (allowedLevel - 1)) && store.getBranchIndex(prev) > -1){\r\n\t\t\tbreak;\r\n\t\t}else {\r\n\t\t\tprev = up ? store.getPrev(prev) : store.getNext(prev);\r\n\t\t}\r\n\t}\r\n\r\n\tif(store.exists(prev)){\r\n\t\tif(store.calculateItemLevel(store.getItem(prev)) === allowedLevel){\r\n\t\t\treturn up ? dropTarget.nextSiblingTarget(dndTaskId, prev, store) : dropTarget.prevSiblingTarget(dndTaskId, prev, store);\r\n\t\t}else{\r\n\t\t\treturn dropTarget.firstChildTarget(dndTaskId, prev, store);\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n}\r\n\r\nfunction findTargetAbove(dndTaskId, taskId, allowedLevel, store){\r\n\treturn findClosesTarget(dndTaskId, taskId, allowedLevel, store, true);\r\n}\r\nfunction findTargetBelow(dndTaskId, taskId, allowedLevel, store){\r\n\treturn findClosesTarget(dndTaskId, taskId, allowedLevel, store, false);\r\n}\r\n\r\nmodule.exports = function getSameLevelDropPosition(dndTaskId, targetTaskId, relTargetPos, eventTop, store, level){\r\n\tvar result;\r\n\tif(targetTaskId !== store.$getRootId()) {\r\n\t\tif (relTargetPos < 0.5) {\r\n\t\t\tif (store.calculateItemLevel(store.getItem(targetTaskId)) === level) {\r\n\t\t\t\tif(store.getPrevSibling(targetTaskId)){\r\n\t\t\t\t\tresult = dropTarget.nextSiblingTarget(dndTaskId, store.getPrevSibling(targetTaskId), store);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tresult = dropTarget.prevSiblingTarget(dndTaskId, targetTaskId, store);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tresult = findTargetAbove(dndTaskId, targetTaskId, level, store);\r\n\t\t\t\tif (result) {\r\n\t\t\t\t\tresult = findTargetBelow(dndTaskId, targetTaskId, level, store);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (store.calculateItemLevel(store.getItem(targetTaskId)) === level) {\r\n\t\t\t\tresult = dropTarget.nextSiblingTarget(dndTaskId, targetTaskId, store);\r\n\t\t\t} else {\r\n\t\t\t\tresult = findTargetBelow(dndTaskId, targetTaskId, level, store);\r\n\t\t\t\tif (result) {\r\n\t\t\t\t\tresult = findTargetAbove(dndTaskId, targetTaskId, level, store);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}else{\r\n\t\tvar rootId = store.$getRootId();\r\n\t\tvar rootLevel = store.getChildren(rootId);\r\n\t\tresult = dropTarget.createDropTargetObject();\r\n\t\tif(rootLevel.length && eventTop >= 0){\r\n\t\t\tresult = findTargetAbove(dndTaskId, getLast(store), level, store);\r\n\t\t}else{\r\n\t\t\tresult = findTargetBelow(dndTaskId, rootId, level, store);\r\n\t\t}\r\n\t}\r\n\r\n\treturn result;\r\n};\r\n","var domHelpers = require(\"../utils/dom_helpers\");\r\nvar dropTarget = require(\"./tasks_grid_dnd_marker_helpers/drop_target\");\r\nvar getLockedLevelTarget = require(\"./tasks_grid_dnd_marker_helpers/locked_level\");\r\nvar getMultiLevelTarget = require(\"./tasks_grid_dnd_marker_helpers/multi_level\");\r\nvar higlighter = require(\"./tasks_grid_dnd_marker_helpers/highlight\");\r\n\r\nfunction _init_dnd(gantt, grid) {\r\n\tvar DnD = gantt.$services.getService(\"dnd\");\r\n\r\n\tif(!grid.$config.bind || !gantt.getDatastore(grid.$config.bind)){\r\n\t\treturn;\r\n\t}\r\n\r\n\tfunction locate(e){\r\n\t\treturn domHelpers.locateAttribute(e, grid.$config.item_attribute);\r\n\t}\r\n\r\n\tvar dnd = new DnD(grid.$grid_data, {updates_per_second: 60});\r\n\tif (gantt.defined(grid.$getConfig().dnd_sensitivity))\r\n\t\tdnd.config.sensitivity = grid.$getConfig().dnd_sensitivity;\r\n\r\n\tdnd.attachEvent(\"onBeforeDragStart\", gantt.bind(function (obj, e) {\r\n\t\tvar el = locate(e);\r\n\t\tif (!el) return false;\r\n\t\tif (gantt.hideQuickInfo) gantt._hideQuickInfo();\r\n\t\tif (domHelpers.closest(e.target, \".gantt_grid_editor_placeholder\")){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar id = el.getAttribute(grid.$config.item_attribute);\r\n\t\tvar datastore = grid.$config.rowStore;\r\n\t\tvar task = datastore.getItem(id);\r\n\r\n\t\tif (gantt.isReadonly(task))\r\n\t\t\treturn false;\r\n\r\n\t\tdnd.config.initial_open_state = task.$open;\r\n\t\tif (!gantt.callEvent(\"onRowDragStart\", [id, e.target || e.srcElement, e])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t}, gantt));\r\n\r\n\tdnd.attachEvent(\"onAfterDragStart\", gantt.bind(function (obj, e) {\r\n\t\tvar el = locate(e);\r\n\r\n\t\tdnd.config.marker.innerHTML = el.outerHTML;\r\n\t\tvar element = dnd.config.marker.firstChild;\r\n\t\tif(element){\r\n\t\t\tdnd.config.marker.style.opacity = 0.4;\r\n\t\t\telement.style.position = \"static\";\r\n\t\t\telement.style.pointerEvents = \"none\";\r\n\t\t}\r\n\r\n\t\tdnd.config.id = el.getAttribute(grid.$config.item_attribute);\r\n\r\n\t\tvar store = grid.$config.rowStore;\r\n\r\n\t\tvar task = store.getItem(dnd.config.id);\r\n\t\tdnd.config.level = store.calculateItemLevel(task);\r\n\t\tdnd.config.drop_target = dropTarget.createDropTargetObject({\r\n\t\t\ttargetParent: store.getParent(task.id),\r\n\t\t\ttargetIndex: store.getBranchIndex(task.id),\r\n\t\t\ttargetId: task.id,\r\n\t\t\tnextSibling: true\r\n\t\t});\r\n\r\n\t\ttask.$open = false;\r\n\t\ttask.$transparent = true;\r\n\t\tthis.refreshData();\r\n\t}, gantt));\r\n\r\n\tfunction getTargetTaskId(e){\r\n\t\tvar y = domHelpers.getRelativeEventPosition(e, grid.$grid_data).y;\r\n\t\tvar store = grid.$config.rowStore;\r\n\r\n\t\ty = y || 0;\r\n\r\n\t\tif(y < 0){\r\n\t\t\treturn store.$getRootId();\r\n\t\t}\r\n\r\n\t\tvar index = Math.floor(y / grid.getItemHeight());\r\n\r\n\t\tif (index > store.countVisible() - 1)\r\n\t\t\treturn store.$getRootId();\r\n\r\n\t\treturn store.getIdByIndex(index);\r\n\t}\r\n\r\n\tfunction getDropPosition(e){\r\n\t\tvar targetTaskId = getTargetTaskId(e);\r\n\t\tvar relTargetPos = null;\r\n\t\tvar store = grid.$config.rowStore;\r\n\t\tvar config = grid.$getConfig();\r\n\t\tvar lockLevel = !config.order_branch_free;\r\n\r\n\t\tvar eventTop = domHelpers.getRelativeEventPosition(e, grid.$grid_data).y;\r\n\r\n\t\tif(targetTaskId !== store.$getRootId()) {\r\n\t\t\tvar rowTop = grid.getItemTop(targetTaskId);\r\n\t\t\tvar rowHeight = grid.getItemHeight();\r\n\t\t\trelTargetPos = (eventTop - rowTop) / rowHeight;\r\n\t\t}\r\n\r\n\t\tvar result;\r\n\t\tif(!lockLevel){\r\n\t\t\tresult = getMultiLevelTarget(dnd.config.id, targetTaskId, relTargetPos, eventTop, store);\r\n\t\t}else{\r\n\t\t\tresult = getLockedLevelTarget(dnd.config.id, targetTaskId, relTargetPos, eventTop, store, dnd.config.level);\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\tdnd.attachEvent(\"onDragMove\", gantt.bind(function (obj, e) {\r\n\t\tvar target = getDropPosition(e);\r\n\r\n\t\tif(!target ||\r\n\t\t\tgantt.callEvent(\"onBeforeRowDragMove\", [dnd.config.id, target.targetParent, target.targetIndex]) === false){\r\n\t\t\t\ttarget = dropTarget.createDropTargetObject(dnd.config.drop_target);\r\n\t\t\t}\r\n\r\n\t\thiglighter.highlightPosition(target, dnd.config, grid);\r\n\t\tdnd.config.drop_target = target;\r\n\r\n\t\tthis.callEvent(\"onRowDragMove\", [dnd.config.id, target.targetParent, target.targetIndex]);\r\n\t\treturn true;\r\n\t}, gantt));\r\n\r\n\tdnd.attachEvent(\"onDragEnd\", gantt.bind(function () {\r\n\t\tvar store = grid.$config.rowStore;\r\n\t\tvar task = store.getItem(dnd.config.id);\r\n\r\n\t\thiglighter.removeLineHighlight(dnd.config);\r\n\r\n\t\ttask.$transparent = false;\r\n\t\ttask.$open = dnd.config.initial_open_state;\r\n\t\tvar target = dnd.config.drop_target;\r\n\r\n\t\tif (this.callEvent(\"onBeforeRowDragEnd\", [dnd.config.id, target.targetParent, target.targetIndex]) === false) {\r\n\t\t\ttask.$drop_target = null;\r\n\t\t} else {\r\n\t\t\tstore.move(dnd.config.id, target.targetIndex, target.targetParent);\r\n\t\t\tthis.callEvent(\"onRowDragEnd\", [dnd.config.id, target.targetParent, target.targetIndex]);\r\n\t\t}\r\n\t\tstore.refresh(task.id);\r\n\t}, gantt));\r\n}\r\n\r\nmodule.exports = {\r\n\tinit: _init_dnd\r\n};","var domHelpers = require(\"../utils/dom_helpers\");\r\n\r\nfunction _init_dnd(gantt, grid) {\r\n\tvar DnD = gantt.$services.getService(\"dnd\");\r\n\r\n\tif(!grid.$config.bind || !gantt.getDatastore(grid.$config.bind)){\r\n\t\treturn;\r\n\t}\r\n\r\n\tfunction locate(e){\r\n\t\treturn domHelpers.locateAttribute(e, grid.$config.item_attribute);\r\n\t}\r\n\r\n\tfunction getStore(){\r\n\t\treturn gantt.getDatastore(grid.$config.bind);\r\n\t}\r\n\r\n\tvar dnd = new DnD(grid.$grid_data, {updates_per_second: 60});\r\n\tif (gantt.defined(grid.$getConfig().dnd_sensitivity))\r\n\t\tdnd.config.sensitivity = grid.$getConfig().dnd_sensitivity;\r\n\r\n\tdnd.attachEvent(\"onBeforeDragStart\", gantt.bind(function (obj, e) {\r\n\t\tvar el = locate(e);\r\n\t\tif (!el) return false;\r\n\t\tif (gantt.hideQuickInfo) gantt._hideQuickInfo();\r\n\r\n\t\tif (domHelpers.closest(e.target, \".gantt_grid_editor_placeholder\")){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar id = el.getAttribute(grid.$config.item_attribute);\r\n\r\n\t\tvar datastore = getStore();\r\n\r\n\t\tvar task = datastore.getItem(id);\r\n\r\n\t\tif (gantt.isReadonly(task))\r\n\t\t\treturn false;\r\n\r\n\t\tdnd.config.initial_open_state = task.$open;\r\n\t\tif (!gantt.callEvent(\"onRowDragStart\", [id, e.target || e.srcElement, e])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t}, gantt));\r\n\r\n\tdnd.attachEvent(\"onAfterDragStart\", gantt.bind(function (obj, e) {\r\n\t\tvar el = locate(e);\r\n\t\tdnd.config.marker.innerHTML = el.outerHTML;\r\n\t\tvar element = dnd.config.marker.firstChild;\r\n\t\tif(element){\r\n\t\t\telement.style.position = \"static\";\r\n\t\t}\r\n\r\n\t\tdnd.config.id = el.getAttribute(grid.$config.item_attribute);\r\n\r\n\t\tvar store = getStore();\r\n\r\n\t\tvar task = store.getItem(dnd.config.id);\r\n\t\tdnd.config.index = store.getBranchIndex(dnd.config.id);\r\n\t\tdnd.config.parent = task.parent;\r\n\t\ttask.$open = false;\r\n\t\ttask.$transparent = true;\r\n\t\tthis.refreshData();\r\n\t}, gantt));\r\n\r\n\tdnd.lastTaskOfLevel = function (level) {\r\n\t\tvar last_item = null;\r\n\t\tvar store = getStore();\r\n\t\tvar tasks = store.getItems();\r\n\t\tfor (var i = 0, len = tasks.length; i < len; i++) {\r\n\t\t\tif (tasks[i].$level == level) {\r\n\t\t\t\tlast_item = tasks[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last_item ? last_item.id : null;\r\n\t};\r\n\tdnd._getGridPos = gantt.bind(function (e) {\r\n\t\tvar pos = domHelpers.getNodePosition(grid.$grid_data);\r\n\t\tvar store = getStore();\r\n\t\t// row offset\r\n\t\tvar x = pos.x;\r\n\t\tvar y = e.pos.y - 10;\r\n\r\n\t\tvar config = grid.$getConfig();\r\n\t\t// prevent moving row out of grid_data container\r\n\t\tif (y < pos.y) y = pos.y;\r\n\t\tvar gridHeight = store.countVisible() * config.row_height;\r\n\t\tif (y > pos.y + gridHeight - config.row_height) y = pos.y + gridHeight - config.row_height;\r\n\r\n\t\tpos.x = x;\r\n\t\tpos.y = y;\r\n\t\treturn pos;\r\n\t}, gantt);\r\n\tdnd._getTargetY = gantt.bind(function (e) {\r\n\t\tvar pos = domHelpers.getNodePosition(grid.$grid_data);\r\n\r\n\t\tvar y = e.pageY - pos.y + (grid.$state.scrollTop || 0);\r\n\t\tif (y < 0)\r\n\t\t\ty = 0;\r\n\t\treturn y;\r\n\t}, gantt);\r\n\tdnd._getTaskByY = gantt.bind(function (y, dropIndex) {\r\n\r\n\t\tvar config = grid.$getConfig(),\r\n\t\t\tstore = getStore();\r\n\r\n\t\ty = y || 0;\r\n\r\n\t\tvar index = Math.floor(y / config.row_height);\r\n\t\tindex = dropIndex < index ? index - 1 : index;\r\n\r\n\t\tif (index > store.countVisible() - 1)\r\n\t\t\treturn null;\r\n\r\n\t\treturn store.getIdByIndex(index);\r\n\t}, gantt);\r\n\tdnd.attachEvent(\"onDragMove\", gantt.bind(function (obj, e) {\r\n\t\tvar dd = dnd.config;\r\n\t\tvar pos = dnd._getGridPos(e);\r\n\r\n\t\tvar config = grid.$getConfig(),\r\n\t\t\tstore = getStore();\r\n\r\n\t\t// setting position of row\r\n\t\tdd.marker.style.left = pos.x + 10 + \"px\";\r\n\t\tdd.marker.style.top = pos.y + \"px\";\r\n\r\n\t\t// highlight row when mouseover\r\n\t\tvar item = store.getItem(dnd.config.id);\r\n\t\tvar targetY = dnd._getTargetY(e);\r\n\t\tvar el = dnd._getTaskByY(targetY, store.getIndexById(item.id));\r\n\r\n\t\tif (!store.exists(el)) {\r\n\t\t\tel = dnd.lastTaskOfLevel(config.order_branch_free ? item.$level : 0);\r\n\t\t\tif (el == dnd.config.id) {\r\n\t\t\t\tel = null;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction allowedLevel(next, item) {\r\n\t\t\treturn (!(store.isChildOf(over.id, item.id)) && (next.$level == item.$level || config.order_branch_free));\r\n\t\t}\r\n\r\n\t\tif (store.exists(el)) {\r\n\t\t\tvar over = store.getItem(el);\r\n\r\n\t\t\tif (store.getIndexById(over.id) * config.row_height + config.row_height / 2 < targetY) {\r\n\t\t\t\t//hovering over bottom part of item, check can be drop to bottom\r\n\t\t\t\tvar index = store.getIndexById(over.id);\r\n\t\t\t\tvar nextId = store.getNext(over.id);//adds +1 when hovering over placeholder\r\n\t\t\t\tvar next = store.getItem(nextId);\r\n\t\t\t\tif (next) {\r\n\t\t\t\t\tif (next.id != item.id) {\r\n\t\t\t\t\t\tover = next; //there is a valid target\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tif (config.order_branch_free) {\r\n\t\t\t\t\t\t\tif (!(store.isChildOf(item.id, over.id) && store.getChildren(over.id).length == 1))\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tstore.move(item.id, store.getBranchIndex(over.id) + 1, store.getParent(over.id));\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//we at end of the list, check and drop at the end of list\r\n\t\t\t\t\tnextId = store.getIdByIndex(index);\r\n\t\t\t\t\tnext = store.getItem(nextId);\r\n\r\n\t\t\t\t\tif (allowedLevel(next, item) && next.id != item.id) {\r\n\t\t\t\t\t\tstore.move(item.id, -1, store.getParent(next.id));\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (config.order_branch_free) {\r\n\t\t\t\tif (over.id != item.id && allowedLevel(over, item)) {\r\n\t\t\t\t\tif (!store.hasChild(over.id)) {\r\n\t\t\t\t\t\tover.$open = true;\r\n\t\t\t\t\t\tstore.move(item.id, -1, over.id);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (store.getIndexById(over.id) || config.row_height / 3 < targetY) return;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//if item is on different level, check the one before it\r\n\t\t\tvar index = store.getIndexById(over.id),\r\n\t\t\t\tprevId = store.getIdByIndex(index - 1);\r\n\r\n\t\t\tvar prev = store.getItem(prevId);\r\n\r\n\t\t\tvar shift = 1;\r\n\t\t\twhile ((!prev || prev.id == over.id) && index - shift >= 0) {\r\n\r\n\t\t\t\tprevId = store.getIdByIndex(index - shift);\r\n\t\t\t\tprev = store.getItem(prevId);\r\n\t\t\t\tshift++;\r\n\t\t\t}\r\n\r\n\t\t\tif (item.id == over.id) return;\r\n\t\t\t//replacing item under cursor\r\n\t\t\tif (allowedLevel(over, item) && item.id != over.id) {\r\n\t\t\t\tstore.move(item.id, 0, 0, over.id);\r\n\r\n\t\t\t} else if (over.$level == item.$level - 1 && !store.getChildren(over.id).length) {\r\n\t\t\t\tstore.move(item.id, 0, over.id);\r\n\r\n\t\t\t} else if (prev && (allowedLevel(prev, item)) && (item.id != prev.id)) {\r\n\t\t\t\tstore.move(item.id, -1, store.getParent(prev.id));\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}, gantt));\r\n\r\n\tdnd.attachEvent(\"onDragEnd\", gantt.bind(function () {\r\n\t\tvar store = getStore();\r\n\t\tvar task = store.getItem(dnd.config.id);\r\n\t\ttask.$transparent = false;\r\n\t\ttask.$open = dnd.config.initial_open_state;\r\n\r\n\t\tif (this.callEvent(\"onBeforeRowDragEnd\", [dnd.config.id, dnd.config.parent, dnd.config.index]) === false) {\r\n\t\t\tstore.move(dnd.config.id, dnd.config.index, dnd.config.parent);\r\n\t\t\ttask.$drop_target = null;\r\n\t\t} else {\r\n\t\t\tthis.callEvent(\"onRowDragEnd\", [dnd.config.id, task.$drop_target]);\r\n\t\t}\r\n\r\n\t\tthis.refreshData();\r\n\t}, gantt));\r\n}\r\n\r\nmodule.exports = {\r\n\tinit: _init_dnd\r\n};","var utils = require(\"../../../utils/utils\");\r\nvar rowDnd = require(\"./tasks_grid_dnd\");\r\nvar rowDndMarker = require(\"./tasks_grid_dnd_marker\");\r\n\r\nvar initializer = (function(){\r\n\treturn function(gantt){\r\n\t\treturn {\r\n\t\t\tonCreated: function (grid) {\r\n\t\t\t\tgrid.$config = utils.mixin(grid.$config, {\r\n\t\t\t\t\tbind: \"task\"\r\n\t\t\t\t});\r\n\t\t\t\tif(grid.$config.id == \"grid\") {\r\n\t\t\t\t\tthis.extendGantt(grid);\r\n\t\t\t\t\tgantt.ext.inlineEditors = gantt.ext._inlineEditors.createEditors(grid);\r\n\t\t\t\t\tgantt.ext.inlineEditors.init();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._mouseDelegates = require(\"../mouse_event_container\")(gantt);\r\n\t\t\t},\r\n\t\t\tonInitialized: function (grid) {\r\n\t\t\t\tvar config = grid.$getConfig();\r\n\t\t\t\tif (config.order_branch) {\r\n\t\t\t\t\tif(config.order_branch == \"marker\"){\r\n\t\t\t\t\t\trowDndMarker.init(grid.$gantt, grid);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\trowDnd.init(grid.$gantt, grid);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.initEvents(grid, gantt);\r\n\t\t\t\tif(grid.$config.id == \"grid\") {\r\n\t\t\t\t\tthis.extendDom(grid);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonDestroyed: function (grid) {\r\n\t\t\t\tif(grid.$config.id == \"grid\") {\r\n\t\t\t\t\tgantt.ext.inlineEditors.destructor();\r\n\t\t\t\t}\r\n\t\t\t\tthis.clearEvents(grid, gantt);\r\n\t\t\t},\r\n\r\n\t\t\tinitEvents: function (grid, gantt) {\r\n\t\t\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_row\", gantt.bind(function (e, id, trg) {\r\n\t\t\t\t\tvar config = grid.$getConfig();\r\n\t\t\t\t\tif (id !== null) {\r\n\t\t\t\t\t\tvar task = this.getTask(id);\r\n\t\t\t\t\t\tif (config.scroll_on_click && !gantt._is_icon_open_click(e))\r\n\t\t\t\t\t\t\tthis.showDate(task.start_date);\r\n\t\t\t\t\t\tgantt.callEvent(\"onTaskRowClick\", [id, trg]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}, gantt), grid.$grid);\r\n\r\n\t\t\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_grid_head_cell\", gantt.bind(function (e, id, trg) {\r\n\t\t\t\t\tvar column = trg.getAttribute(\"data-column-id\");\r\n\r\n\t\t\t\t\tif (!gantt.callEvent(\"onGridHeaderClick\", [column, e]))\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\tvar config = grid.$getConfig();\r\n\r\n\t\t\t\t\tif (column == \"add\") {\r\n\t\t\t\t\t\tvar mouseEvents = gantt.$services.getService(\"mouseEvents\");\r\n\t\t\t\t\t\tmouseEvents.callHandler(\"click\", \"gantt_add\", grid.$grid, [e, config.root_id]);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (config.sort) {\r\n\t\t\t\t\t\tvar sorting_method = column,\r\n\t\t\t\t\t\t\tconf;\r\n\r\n\t\t\t\t\t\tfor (var i = 0; i < config.columns.length; i++) {\r\n\t\t\t\t\t\t\tif (config.columns[i].name == column) {\r\n\t\t\t\t\t\t\t\tconf = config.columns[i];\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (conf && conf.sort !== undefined && conf.sort !== true) {\r\n\t\t\t\t\t\t\tsorting_method = conf.sort;\r\n\r\n\t\t\t\t\t\t\tif (!sorting_method) { // column sort property 'false', no sorting\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tvar sort = (this._sort && this._sort.direction && this._sort.name == column) ? this._sort.direction : \"desc\";\r\n\t\t\t\t\t\t// invert sort direction\r\n\t\t\t\t\t\tsort = (sort == \"desc\") ? \"asc\" : \"desc\";\r\n\t\t\t\t\t\tthis._sort = {\r\n\t\t\t\t\t\t\tname: column,\r\n\t\t\t\t\t\t\tdirection: sort\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tthis.sort(sorting_method, sort == \"desc\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}, gantt), grid.$grid);\r\n\r\n\t\t\t\tthis._mouseDelegates.delegate(\"click\", \"gantt_add\", gantt.bind(function (e, id, trg) {\r\n\t\t\t\t\tvar config = grid.$getConfig();\r\n\t\t\t\t\tif (config.readonly) return;\r\n\r\n\t\t\t\t\tvar item = {};\r\n\t\t\t\t\tthis.createTask(item, id ? id : gantt.config.root_id);\r\n\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}, gantt), grid.$grid);\r\n\r\n\t\t\t},\r\n\r\n\t\t\tclearEvents: function(grid, gantt){\r\n\t\t\t\tthis._mouseDelegates.destructor();\r\n\t\t\t\tthis._mouseDelegates = null;\r\n\t\t\t},\r\n\r\n\t\t\textendDom: function(grid){\r\n\t\t\t\tgantt.$grid = grid.$grid;\r\n\t\t\t\tgantt.$grid_scale = grid.$grid_scale;\r\n\t\t\t\tgantt.$grid_data = grid.$grid_data;\r\n\t\t\t},\r\n\t\t\textendGantt: function(grid){\r\n\t\t\t\tgantt.getGridColumns = gantt.bind(grid.getGridColumns, grid);\r\n\r\n\t\t\t\tgrid.attachEvent(\"onColumnResizeStart\", function(){\r\n\t\t\t\t\treturn gantt.callEvent(\"onColumnResizeStart\", arguments);\r\n\t\t\t\t});\r\n\t\t\t\tgrid.attachEvent(\"onColumnResize\", function(){\r\n\t\t\t\t\treturn gantt.callEvent(\"onColumnResize\", arguments);\r\n\t\t\t\t});\r\n\t\t\t\tgrid.attachEvent(\"onColumnResizeEnd\", function(){\r\n\t\t\t\t\treturn gantt.callEvent(\"onColumnResizeEnd\", arguments);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tgrid.attachEvent(\"onColumnResizeComplete\", function(columns, totalWidth){\r\n\t\t\t\t\tgantt.config.grid_width = totalWidth;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n})();\r\n\r\nmodule.exports = initializer;","var getRectangle = require(\"./viewport/get_bg_row_rectangle\");\r\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\r\nvar getVisibleCellsRange = require(\"./viewport/get_visible_cells_range\");\r\nvar isColumnVisible = require(\"./viewport/is_column_visible\");\r\nvar resourceTimetable = require(\"../../resource_timetable_builder\");\r\n\r\nfunction renderBar(level, start, end, timeline){\r\n\tvar top = (1 - (level*1||0))*100;\r\n\tvar left = timeline.posFromDate(start);\r\n\tvar right = timeline.posFromDate(end);\r\n\tvar element = document.createElement(\"div\");\r\n\telement.className = \"gantt_histogram_hor_bar\";\r\n\telement.style.top = top + '%';\r\n\telement.style.left = left + \"px\";\r\n\telement.style.width = (right - left + 1) + \"px\";\r\n\treturn element;\r\n}\r\nfunction renderConnection(prevLevel, nextLevel, left){\r\n\tif(prevLevel === nextLevel){\r\n\t\treturn null;\r\n\t}\r\n\r\n\tvar top = 1 - Math.max(prevLevel, nextLevel);\r\n\tvar height = Math.abs(prevLevel - nextLevel);\r\n\tvar element = document.createElement(\"div\");\r\n\telement.className = \"gantt_histogram_vert_bar\";\r\n\telement.style.top = top*100 + \"%\";\r\n\telement.style.height = height*100 + \"%\";\r\n\telement.style.left = left + \"px\";\r\n\r\n\treturn element;\r\n}\r\n\r\nfunction generateRenderResourceHistogram(gantt){\r\n\tvar getResourceLoad = resourceTimetable(gantt);\r\n\tvar renderedHistogramCells = {};\r\n\tvar renderedHistogramRows = {};\r\n\tvar renderedHistogramCapacity = {};\r\n\r\n\tfunction detachRenderedHistogramCell(id, index){\r\n\r\n\t\tvar renderedRow = renderedHistogramCells[id];\r\n\t\tif(renderedRow && renderedRow[index] && \r\n\t\t\trenderedRow[index].parentNode\r\n\t\t\t){\r\n\t\t\t\trenderedRow[index].parentNode.removeChild(renderedRow[index]);\r\n\t\t\t}\r\n\t}\r\n\r\n\tfunction renderHistogramLine(capacity, timeline, maxCapacity, viewport){\r\n\t\tvar scale = timeline.getScale();\r\n\r\n\t\tvar el = document.createElement(\"div\");\r\n\t\t\r\n\t\tvar range = getVisibleCellsRange(scale, viewport);\r\n\t\tfor (var i = range.start; i <= range.end; i++) {\r\n\t\t\tvar colStart = scale.trace_x[i];\r\n\t\t\tvar colEnd = scale.trace_x[i + 1] || gantt.date.add(colStart, scale.step, scale.unit);\r\n\t\t\tvar col = scale.trace_x[i].valueOf();\r\n\t\t\tvar level = Math.min(capacity[col]/maxCapacity, 1) || 0;\r\n\t\t\t// do not render histogram for lines with below zero capacity, as it's reserved for folders\r\n\t\t\tif(level < 0){\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tvar nextLevel = Math.min(capacity[colEnd.valueOf()]/maxCapacity, 1) || 0;\r\n\t\t\tvar bar = renderBar(level, colStart, colEnd, timeline);\r\n\t\t\tif(bar){\r\n\t\t\t\tel.appendChild(bar);\r\n\t\t\t}\r\n\t\t\tvar connection = renderConnection(level, nextLevel, timeline.posFromDate(colEnd));\r\n\t\t\tif(connection){\r\n\t\t\t\tel.appendChild(connection);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn el;\r\n\t}\r\n\r\n\tfunction renderCapacityElement(resource, sizes, capacityMatrix, config, timeline, maxCapacity, viewport){\r\n\r\n\t\tvar renderedElement = renderedHistogramCapacity[resource.id];\r\n\t\tif(renderedElement && renderedElement.parentNode){\r\n\t\t\trenderedElement.parentNode.removeChild(renderedElement);\r\n\t\t}\r\n\r\n\t\tvar capacityElement = renderHistogramLine(capacityMatrix, timeline, maxCapacity, viewport);\r\n\t\tif (capacityElement) {\r\n\t\t\tcapacityElement.setAttribute(\"data-resource-id\", resource.id);\r\n\t\t\tcapacityElement.setAttribute(timeline.$config.item_attribute, resource.id);\r\n\t\t\tcapacityElement.style.position = \"absolute\";\r\n\t\t\tcapacityElement.style.top = (sizes.top + 1) + \"px\";\r\n\t\t\tcapacityElement.style.height = (config.row_height - 1) + \"px\";\r\n\t\t\tcapacityElement.style.left = 0;\r\n\t\t}\r\n\t\treturn capacityElement;\r\n\t}\r\n\r\n\tfunction renderHistogramCell(resource, sizes, maxCapacity, config, templates, day, timeline){\r\n\t\tvar css = templates.histogram_cell_class(day.start_date, day.end_date, resource, day.tasks);\r\n\t\tvar content = templates.histogram_cell_label(day.start_date, day.end_date, resource, day.tasks);\r\n\t\tvar fill = templates.histogram_cell_allocated(day.start_date, day.end_date, resource, day.tasks);\r\n\t\tif(css || content){\r\n\t\t\tvar el = document.createElement('div');\r\n\t\t\tel.className = [\"gantt_histogram_cell\", css].join(\" \");\r\n\t\t\tel.setAttribute(timeline.$config.item_attribute, resource.id);\r\n\t\t\tel.style.cssText = [\r\n\t\t\t\t'left:' + sizes.left + 'px',\r\n\t\t\t\t'width:' + sizes.width + 'px',\r\n\t\t\t\t'height:' + (config.row_height - 1) + 'px',\r\n\t\t\t\t'line-height:' + (config.row_height - 1) + 'px',\r\n\t\t\t\t'top:' + (sizes.top + 1) + 'px'\r\n\t\t\t].join(\";\");\r\n\r\n\r\n\t\t\tif (content) {\r\n\t\t\t\tcontent = \"
\" + content +\"
\";\r\n\t\t\t}\r\n\r\n\t\t\tif (fill) {\r\n\t\t\t\tcontent = \"
\" + content;\r\n\t\t\t}\r\n\r\n\t\t\tif (content) {\r\n\t\t\t\tel.innerHTML = content;\r\n\t\t\t}\r\n\r\n\t\t\treturn el;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfunction renderResourceHistogram(resource, timeline, viewport) {\r\n\t\tvar config = timeline.$getConfig(),\r\n\t\t\ttemplates = timeline.$getTemplates();\r\n\t\tvar scale = timeline.getScale();\r\n\t\tvar timetable = getResourceLoad(resource, config.resource_property, scale, timeline);\r\n\r\n\t\tvar cells = [];\r\n\t\tvar capacityMatrix = {};\r\n\t\tvar maxCapacity = resource.capacity || timeline.$config.capacity || 24;\r\n\t\trenderedHistogramCells[resource.id] = {};\r\n\t\trenderedHistogramRows[resource.id] = null;\r\n\t\trenderedHistogramCapacity[resource.id] = null;\r\n\r\n\t\tvar smartRendering = !!viewport;//no viewport means smart rendering is disabled\r\n\r\n\t\tvar range = getVisibleCellsRange(scale, viewport);\r\n\t\tfor (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\r\n\r\n\t\t\tvar day = timetable[columnIndex];\r\n\t\t\tif(!day){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tif(smartRendering && !isColumnVisible(columnIndex, scale, viewport, gantt)){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tvar capacity = templates.histogram_cell_capacity(day.start_date, day.end_date, resource, day.tasks);\r\n\t\t\tcapacityMatrix[day.start_date.valueOf()] = capacity || 0;\r\n\t\t\tvar sizes = timeline.getItemPosition(resource, day.start_date, day.end_date);\r\n\r\n\t\t\tvar el = renderHistogramCell(resource, sizes, maxCapacity, config, templates, day, timeline);\r\n\t\t\tif(el){\r\n\t\t\t\tcells.push(el);\r\n\t\t\t\trenderedHistogramCells[resource.id][columnIndex] = el;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar row = null;\r\n\t\tif (cells.length) {\r\n\t\t\trow = document.createElement(\"div\");\r\n\t\t\tfor (var i = 0; i < cells.length; i++) {\r\n\t\t\t\trow.appendChild(cells[i]);\r\n\t\t\t}\r\n\r\n\t\t\tvar capacityElement = renderCapacityElement(resource, sizes, capacityMatrix, config, timeline, maxCapacity, viewport);\r\n\t\t\tif(capacityElement){\r\n\t\t\t\trow.appendChild(capacityElement);\r\n\t\t\t\trenderedHistogramCapacity[resource.id] = capacityElement;\r\n\t\t\t}\r\n\t\t\trenderedHistogramRows[resource.id] = row;\r\n\t\t}\r\n\r\n\t\treturn row;\r\n\t}\r\n\r\n\tfunction updateResourceHistogram(resource, node, timeline, viewport) {\r\n\t\tvar config = timeline.$getConfig(),\r\n\t\t\ttemplates = timeline.$getTemplates();\r\n\t\tvar scale = timeline.getScale();\r\n\t\tvar timetable = getResourceLoad(resource, config.resource_property, scale, timeline);\r\n\t\tvar maxCapacity = resource.capacity || timeline.$config.capacity || 24;\r\n\t\tvar capacityMatrix = {};\r\n\r\n\t\tvar smartRendering = !!viewport;//no viewport means smart rendering is disabled\r\n\t\t\r\n\t\tvar range = getVisibleCellsRange(scale, viewport);\r\n\r\n\t\tvar checkedColumns = {};\r\n\t\tif(renderedHistogramCells && renderedHistogramCells[resource.id]){\r\n\t\t\tfor(var i in renderedHistogramCells[resource.id]){\r\n\t\t\t\tcheckedColumns[i] = i;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\r\n\t\t\tvar day = timetable[columnIndex];\r\n\t\t\tcheckedColumns[columnIndex] = false;\r\n\t\t\tif(!day){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tvar capacity = templates.histogram_cell_capacity(day.start_date, day.end_date, resource, day.tasks);\r\n\t\t\tcapacityMatrix[day.start_date.valueOf()] = capacity || 0;\r\n\t\t\tvar sizes = timeline.getItemPosition(resource, day.start_date, day.end_date);\r\n\r\n\t\t\tif(smartRendering && !isColumnVisible(columnIndex, scale, viewport, gantt)){\r\n\t\t\t\tdetachRenderedHistogramCell(resource.id, columnIndex);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tvar renderedCell = renderedHistogramCells[resource.id];\r\n\t\t\tif(!renderedCell || !renderedCell[columnIndex]){\r\n\t\t\t\tvar el = renderHistogramCell(resource, sizes, maxCapacity, config, templates, day, timeline);\r\n\t\t\t\tif(el){\r\n\t\t\t\t\tnode.appendChild(el);\r\n\t\t\t\t\trenderedHistogramCells[resource.id][columnIndex] = el;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(renderedCell && renderedCell[columnIndex] && !renderedCell[columnIndex].parentNode){\r\n\t\t\t\tnode.appendChild(renderedCell[columnIndex]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(var i in checkedColumns){\r\n\t\t\tif(checkedColumns[i] !== false){\r\n\t\t\t\tdetachRenderedHistogramCell(resource.id, i);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar capacityElement = renderCapacityElement(resource, sizes, capacityMatrix, config, timeline, maxCapacity, viewport);\r\n\t\tif(capacityElement){\r\n\t\t\tnode.appendChild(capacityElement);\r\n\t\t\trenderedHistogramCapacity[resource.id] = capacityElement;\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\trender: renderResourceHistogram,\r\n\t\tupdate: updateResourceHistogram,\r\n\t\tgetRectangle: getRectangle,\r\n\t\tgetVisibleRange: getVisibleRange\r\n\t};\r\n}\r\n\r\nmodule.exports = generateRenderResourceHistogram;","var getRectangle = require(\"./viewport/get_bg_row_rectangle\");\r\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\r\nvar getVisibleCellsRange = require(\"./viewport/get_visible_cells_range\");\r\nvar isColumnVisible = require(\"./viewport/is_column_visible\");\r\nvar resourceTimetable = require(\"../../resource_timetable_builder\");\r\n\r\nfunction generateRenderResourceLine(gantt){\r\n\tvar getResourceLoad = resourceTimetable(gantt);\r\n\tvar renderedResourceLines = {};\r\n\r\n\tfunction renderResourceLineCell(resource, day, templates, config, timeline){\r\n\t\tvar css = templates.resource_cell_class(day.start_date, day.end_date, resource, day.tasks);\r\n\t\tvar content = templates.resource_cell_value(day.start_date, day.end_date, resource, day.tasks);\r\n\r\n\t\tif (css || content){\r\n\t\t\tvar sizes = timeline.getItemPosition(resource, day.start_date, day.end_date);\r\n\t\t\tvar el = document.createElement('div');\r\n\t\t\tel.setAttribute(timeline.$config.item_attribute, resource.id);\r\n\t\t\tel.className = [\"gantt_resource_marker\", css].join(\" \");\r\n\r\n\t\t\tel.style.cssText = [\r\n\t\t\t\t'left:' + sizes.left + 'px',\r\n\t\t\t\t'width:' + sizes.width + 'px',\r\n\t\t\t\t'height:' + (config.row_height - 1) + 'px',\r\n\t\t\t\t'line-height:' + (config.row_height - 1) + 'px',\r\n\t\t\t\t'top:' + sizes.top + 'px'\r\n\t\t\t].join(\";\");\r\n\r\n\t\t\tif(content)\r\n\t\t\t\tel.innerHTML = content;\r\n\t\t\t\r\n\t\t\treturn el;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfunction detachRenderedResourceLine(id, index){\r\n\t\tif(renderedResourceLines[id] && renderedResourceLines[id][index] &&\r\n\t\t\trenderedResourceLines[id][index].parentNode\r\n\t\t\t){\r\n\t\t\t\trenderedResourceLines[id][index].parentNode.removeChild(renderedResourceLines[id][index]);\r\n\t\t\t}\r\n\t}\r\n\r\n\tfunction renderResourceLine(resource, timeline, viewport) {\r\n\t\tvar config = timeline.$getConfig(),\r\n\t\t\ttemplates = timeline.$getTemplates();\r\n\t\tvar scale = timeline.getScale();\r\n\t\tvar timetable = getResourceLoad(resource, config.resource_property, timeline.getScale(), timeline);\r\n\t\tvar smartRendering = !!viewport;//no viewport means smart rendering is disabled\r\n\t\tvar cells = [];\r\n\t\trenderedResourceLines[resource.id] = {};\r\n\r\n\t\tvar range = getVisibleCellsRange(scale, viewport);\r\n\t\tfor (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\r\n\r\n\t\t\tvar day = timetable[columnIndex];\r\n\t\t\tif(!day){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tif(smartRendering && !isColumnVisible(columnIndex, scale, viewport, gantt)){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tvar cell = renderResourceLineCell(resource, day, templates, config, timeline);\r\n\t\t\tif(cell){\r\n\t\t\t\tcells.push(cell);\r\n\t\t\t\trenderedResourceLines[resource.id][columnIndex] = cell;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar row = null;\r\n\t\tif(cells.length){\r\n\t\t\trow = document.createElement(\"div\");\r\n\t\t\tfor(var i = 0; i < cells.length; i++){\r\n\t\t\t\trow.appendChild(cells[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn row;\r\n\t}\r\n\r\n\tfunction updateResourceLine(resource, node, timeline, viewport) {\r\n\t\tvar config = timeline.$getConfig(),\r\n\t\t\ttemplates = timeline.$getTemplates();\r\n\t\tvar scale = timeline.getScale();\r\n\t\tvar timetable = getResourceLoad(resource, config.resource_property, timeline.getScale(), timeline);\r\n\r\n\t\tvar range = getVisibleCellsRange(scale, viewport);\r\n\r\n\t\tvar checkedColumns = {};\r\n\t\tif(renderedResourceLines && renderedResourceLines[resource.id]){\r\n\t\t\tfor(var i in renderedResourceLines[resource.id]){\r\n\t\t\t\tcheckedColumns[i] = i;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\r\n\t\t\tvar day = timetable[columnIndex];\r\n\t\t\tcheckedColumns[columnIndex] = false;\r\n\t\t\tif(!day){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tif(!isColumnVisible(columnIndex, scale, viewport, gantt)){\r\n\t\t\t\tdetachRenderedResourceLine(resource.id, columnIndex);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tif(!renderedResourceLines[resource.id] || !renderedResourceLines[resource.id][columnIndex]){\r\n\t\t\t\tvar cell = renderResourceLineCell(resource, day, templates, config, timeline);\r\n\t\t\t\tif(cell){\r\n\t\t\t\t\tnode.appendChild(cell);\r\n\t\t\t\t\trenderedResourceLines[resource.id][columnIndex] = cell;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(renderedResourceLines[resource.id] && renderedResourceLines[resource.id][columnIndex] && !renderedResourceLines[resource.id][columnIndex].parentNode){\r\n\t\t\t\tnode.appendChild(renderedResourceLines[resource.id][columnIndex]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(var i in checkedColumns){\r\n\t\t\tif(checkedColumns[i] !== false){\r\n\t\t\t\tdetachRenderedResourceLine(resource.id, i);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\trender: renderResourceLine,\r\n\t\tupdate: updateResourceLine,\r\n\t\tgetRectangle: getRectangle,\r\n\t\tgetVisibleRange: getVisibleRange\r\n\t};\r\n}\r\n\r\nmodule.exports = generateRenderResourceLine;","var helpers = require(\"../../../utils/helpers\");\r\nvar getRowRectangle = require(\"./viewport/get_grid_row_rectangle\");\r\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\r\n\r\nfunction createGridLineRender(gantt){\r\n\r\n\tfunction _render_grid_item(item, view, viewport) {\r\n\t\tvar columns = view.getGridColumns();\r\n\t\tvar config = view.$getConfig(),\r\n\t\t\ttemplates = view.$getTemplates();\r\n\r\n\t\tvar store = view.$config.rowStore;\r\n\r\n\t\tvar cells = [];\r\n\t\tvar has_child;\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tvar last = i == columns.length - 1;\r\n\t\t\tvar col = columns[i];\r\n\t\t\tvar cell;\r\n\r\n\t\t\tvar value;\r\n\t\t\tvar textValue;\r\n\t\t\tif (col.name == \"add\") {\r\n\t\t\t\tvar aria = gantt._waiAria.gridAddButtonAttrString(col);\r\n\r\n\t\t\t\tvalue = \"
\";\r\n\t\t\t\ttextValue = \"\";\r\n\t\t\t} else {\r\n\t\t\t\tif (col.template)\r\n\t\t\t\t\tvalue = col.template(item);\r\n\t\t\t\telse\r\n\t\t\t\t\tvalue = item[col.name];\r\n\r\n\t\t\t\tif (helpers.isDate(value)){\r\n\t\t\t\t\tvalue = templates.date_grid(value, item, col.name);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (value === null || value === undefined) {\r\n\t\t\t\t\tvalue = \"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttextValue = value;\r\n\t\t\t\tvalue = \"
\" + value + \"
\";\r\n\t\t\t}\r\n\t\t\tvar css = \"gantt_cell\" + (last ? \" gantt_last_cell\" : \"\");\r\n\r\n\t\t\tvar tree = [];\r\n\t\t\tif (col.tree) {\r\n\t\t\t\tcss += \" gantt_cell_tree\";\r\n\t\t\t\tfor (var j = 0; j < item.$level; j++)\r\n\t\t\t\t\ttree.push(templates.grid_indent(item));\r\n\r\n\t\t\t\thas_child = store.hasChild(item.id) && !(gantt.isSplitTask(item) && !gantt.config.open_split_tasks);\r\n\t\t\t\tif (has_child) {\r\n\t\t\t\t\ttree.push(templates.grid_open(item));\r\n\t\t\t\t\ttree.push(templates.grid_folder(item));\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttree.push(templates.grid_blank(item));\r\n\t\t\t\t\ttree.push(templates.grid_file(item));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar style = \"width:\" + (col.width - (last ? 1 : 0)) + \"px;\";\r\n\t\t\tif (this.defined(col.align)){\r\n\t\t\t\tvar flexAlign = {\r\n\t\t\t\t\tright: \"flex-end\",\r\n\t\t\t\t\tleft: \"flex-start\",\r\n\t\t\t\t\tcenter: \"center\"\r\n\t\t\t\t};\r\n\t\t\t\tvar justifyContent = flexAlign[col.align];\r\n\r\n\t\t\t\tstyle += \"text-align:\" + col.align + \";justify-content:\" + justifyContent + \";\";\r\n\t\t\t}\r\n\r\n\t\t\tvar aria = gantt._waiAria.gridCellAttrString(col, textValue, item);\r\n\r\n\t\t\ttree.push(value);\r\n\t\t\tcell = \"
\" + tree.join(\"\") + \"
\";\r\n\t\t\tcells.push(cell);\r\n\t\t}\r\n\t\tvar css = gantt.getGlobalTaskIndex(item.id) % 2 === 0 ? \"\" : \" odd\";\r\n\t\tcss += (item.$transparent) ? \" gantt_transparent\" : \"\";\r\n\r\n\t\tcss += (item.$dataprocessor_class ? \" \" + item.$dataprocessor_class : \"\");\r\n\r\n\t\tif (templates.grid_row_class) {\r\n\t\t\tvar css_template = templates.grid_row_class.call(gantt, item.start_date, item.end_date, item);\r\n\t\t\tif (css_template)\r\n\t\t\t\tcss += \" \" + css_template;\r\n\t\t}\r\n\r\n\t\tif(store.isSelected(item.id)) {\r\n\t\t\tcss += \" gantt_selected\";\r\n\t\t}\r\n\r\n\t\tvar el = document.createElement(\"div\");\r\n\t\tel.className = \"gantt_row\" + css + \" gantt_row_\" + gantt.getTaskType(item.type);\r\n\t\tvar height = view.getItemHeight();\r\n\t\tel.style.height = height + \"px\";\r\n\t\tel.style.lineHeight = height + \"px\";\r\n\r\n\t\tif(config.smart_rendering){\r\n\t\t\tel.style.position = \"absolute\";\r\n\t\t\tel.style.left = \"0px\";\r\n\t\t\tel.style.top = view.getItemTop(item.id) + \"px\";\r\n\t\t}\r\n\r\n\t\tif(view.$config.item_attribute){\r\n\t\t\tel.setAttribute(view.$config.item_attribute, item.id);\r\n\t\t\tel.setAttribute(view.$config.bind + \"_id\", item.id); // 'task_id'/'resource_id' for backward compatibility\r\n\t\t}\r\n\r\n\t\tgantt._waiAria.taskRowAttr(item, el);\r\n\r\n\t\tel.innerHTML = cells.join(\"\");\r\n\t\treturn el;\r\n\t}\r\n\r\n\treturn {\r\n\t\trender: _render_grid_item,\r\n\t\tupdate: null,\r\n\t\tgetRectangle: getRowRectangle,\r\n\t\tgetVisibleRange: getVisibleRange\r\n\t};\r\n}\r\n\r\nmodule.exports = createGridLineRender;","\r\n// optimized checker for links smart rendering\r\n\r\n// first check the vertical position since it's easier to calculate\r\n\r\nmodule.exports = function isLinkInViewPort(item, viewport, view, gantt){\r\n\tvar source = view.$gantt.getTask(item.source);\r\n\tvar target = view.$gantt.getTask(item.target);\r\n\tvar config = view.$getConfig();\r\n\t// check vertical visibility first since it's a lighter check\r\n\tvar sourceTop = view.getItemTop(source.id);\r\n\tvar sourceHeight = config.row_height;\r\n\r\n\tvar targetTop = view.getItemTop(target.id);\r\n\tvar targetHeight = config.row_height;\r\n\r\n\tif(viewport.y > sourceTop + sourceHeight && \r\n\t\tviewport.y > targetTop + targetHeight){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(viewport.y_end < targetTop && \r\n\t\tviewport.y_end < sourceTop){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tvar padding = 100;\r\n\tvar sourceLeft = view.posFromDate(source.start_date);\r\n\tvar sourceRight = view.posFromDate(source.end_date);\r\n\tvar targetLeft = view.posFromDate(target.start_date);\r\n\tvar targetRight = view.posFromDate(target.end_date);\r\n\t\r\n\tif(sourceLeft > sourceRight){\r\n\t\t// rtl\r\n\t\tvar tmp = sourceRight;\r\n\t\tsourceRight = sourceLeft;\r\n\t\tsourceLeft = tmp;\r\n\t}\r\n\tif(targetLeft > targetRight){\r\n\t\t// rtl\r\n\t\tvar tmp = targetRight;\r\n\t\ttargetRight = targetLeft;\r\n\t\ttargetLeft = tmp;\r\n\t}\r\n\tsourceLeft += -padding; // add buffer for custom elements\r\n\tsourceRight += padding;\r\n\ttargetLeft += -padding; // add buffer for custom elements\r\n\ttargetRight += padding;\r\n\r\n\tif(viewport.x > sourceRight && \r\n\t\tviewport.x > targetRight){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(viewport.x_end < sourceLeft && \r\n\t\tviewport.x_end < targetLeft){\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n};\r\n","var isInViewPort = require(\"./viewport/is_link_in_viewport\");\r\n\r\nfunction createLinkRender(gantt){\r\n\r\nfunction _render_link_element(link, view) {\r\n\tvar config = view.$getConfig();\r\n\r\n\tvar pt = path_builder.get_endpoint(link, view);\r\n\tvar dy = pt.e_y - pt.y;\r\n\tvar dx = pt.e_x - pt.x;\r\n\tif(!dx && !dy){\r\n\t\treturn null;\r\n\t}\r\n\r\n\r\n\tvar dots = path_builder.get_points(link, view);\r\n\tvar lines = drawer.get_lines(dots, view);\r\n\r\n\tvar div = document.createElement(\"div\");\r\n\r\n\tvar css = \"gantt_task_link\";\r\n\r\n\tif (link.color) {\r\n\t\tcss += \" gantt_link_inline_color\";\r\n\t}\r\n\tvar cssTemplate = gantt.templates.link_class ? gantt.templates.link_class(link) : \"\";\r\n\tif (cssTemplate) {\r\n\t\tcss += \" \" + cssTemplate;\r\n\t}\r\n\r\n\tif (config.highlight_critical_path && gantt.isCriticalLink) {\r\n\t\tif (gantt.isCriticalLink(link))\r\n\t\t\tcss += \" gantt_critical_link\";\r\n\t}\r\n\r\n\tdiv.className = css;\r\n\r\n\tif(view.$config.link_attribute){\r\n\t\tdiv.setAttribute(view.$config.link_attribute, link.id);\r\n\t\tdiv.setAttribute(\"link_id\", link.id);\r\n\t}\r\n\r\n\tfor (var i = 0; i < lines.length; i++) {\r\n\t\tif (i == lines.length - 1) {\r\n\t\t\tlines[i].size -= config.link_arrow_size;\r\n\t\t}\r\n\t\tvar el = drawer.render_line(lines[i], lines[i + 1], view);\r\n\t\tif (link.color) {\r\n\t\t\tel.firstChild.style.backgroundColor = link.color;\r\n\t\t}\r\n\t\tdiv.appendChild(el);\r\n\t}\r\n\r\n\tvar direction = lines[lines.length - 1].direction;\r\n\tvar endpoint = _render_link_arrow(dots[dots.length - 1], direction, view);\r\n\tif (link.color) {\r\n\t\tendpoint.style.borderColor = link.color;\r\n\t}\r\n\tdiv.appendChild(endpoint);\r\n\r\n\tgantt._waiAria.linkAttr(link, div);\r\n\r\n\treturn div;\r\n}\r\n\r\nfunction _render_link_arrow(point, direction, view) {\r\n\tvar config = view.$getConfig();\r\n\tvar div = document.createElement(\"div\");\r\n\tvar top = point.y;\r\n\tvar left = point.x;\r\n\r\n\tvar size = config.link_arrow_size;\r\n\tvar line_width = config.row_height;\r\n\tvar className = \"gantt_link_arrow gantt_link_arrow_\" + direction;\r\n\tswitch (direction) {\r\n\t\tcase drawer.dirs.right:\r\n\t\t\ttop -= (size - line_width) / 2;\r\n\t\t\tleft -= size;\r\n\t\t\tbreak;\r\n\t\tcase drawer.dirs.left:\r\n\t\t\ttop -= (size - line_width) / 2;\r\n\t\t\tbreak;\r\n\t\tcase drawer.dirs.up:\r\n\t\t\tleft -= size;\r\n\t\t\tbreak;\r\n\t\tcase drawer.dirs.down:\r\n\t\t\ttop += size * 2;\r\n\t\t\tleft -= size;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t}\r\n\tdiv.style.cssText = [\r\n\t\t\"top:\" + top + \"px\",\r\n\t\t\"left:\" + left + 'px'].join(';');\r\n\tdiv.className = className;\r\n\r\n\treturn div;\r\n}\r\n\r\n\r\nvar drawer = {\r\n\tcurrent_pos: null,\r\n\tdirs: {\"left\": 'left', \"right\": 'right', \"up\": 'up', \"down\": 'down'},\r\n\tpath: [],\r\n\tclear: function () {\r\n\t\tthis.current_pos = null;\r\n\t\tthis.path = [];\r\n\t},\r\n\tpoint: function (pos) {\r\n\t\tthis.current_pos = gantt.copy(pos);\r\n\t},\r\n\tget_lines: function (dots) {\r\n\t\tthis.clear();\r\n\t\tthis.point(dots[0]);\r\n\t\tfor (var i = 1; i < dots.length; i++) {\r\n\t\t\tthis.line_to(dots[i]);\r\n\t\t}\r\n\t\treturn this.get_path();\r\n\t},\r\n\tline_to: function (pos) {\r\n\t\tvar next = gantt.copy(pos);\r\n\t\tvar prev = this.current_pos;\r\n\r\n\t\tvar line = this._get_line(prev, next);\r\n\t\tthis.path.push(line);\r\n\t\tthis.current_pos = next;\r\n\t},\r\n\tget_path: function () {\r\n\t\treturn this.path;\r\n\t},\r\n\tget_wrapper_sizes: function (v, view) {\r\n\t\tvar config = view.$getConfig();\r\n\t\tvar res,\r\n\t\t\twrapper_size = config.link_wrapper_width,\r\n\t\t\ty = v.y + (config.row_height - wrapper_size) / 2;\r\n\t\tswitch (v.direction) {\r\n\t\t\tcase this.dirs.left:\r\n\t\t\t\tres = {\r\n\t\t\t\t\ttop: y,\r\n\t\t\t\t\theight: wrapper_size,\r\n\t\t\t\t\tlineHeight: wrapper_size,\r\n\t\t\t\t\tleft: v.x - v.size - wrapper_size / 2,\r\n\t\t\t\t\twidth: v.size + wrapper_size\r\n\t\t\t\t};\r\n\t\t\t\tbreak;\r\n\t\t\tcase this.dirs.right:\r\n\t\t\t\tres = {\r\n\t\t\t\t\ttop: y,\r\n\t\t\t\t\tlineHeight: wrapper_size,\r\n\t\t\t\t\theight: wrapper_size,\r\n\t\t\t\t\tleft: v.x - wrapper_size / 2,\r\n\t\t\t\t\twidth: v.size + wrapper_size\r\n\t\t\t\t};\r\n\t\t\t\tbreak;\r\n\t\t\tcase this.dirs.up:\r\n\t\t\t\tres = {\r\n\t\t\t\t\ttop: y - v.size,\r\n\t\t\t\t\tlineHeight: v.size + wrapper_size,\r\n\t\t\t\t\theight: v.size + wrapper_size,\r\n\t\t\t\t\tleft: v.x - wrapper_size / 2,\r\n\t\t\t\t\twidth: wrapper_size\r\n\t\t\t\t};\r\n\t\t\t\tbreak;\r\n\t\t\tcase this.dirs.down:\r\n\t\t\t\tres = {\r\n\t\t\t\t\ttop: y /*- wrapper_size/2*/,\r\n\t\t\t\t\tlineHeight: v.size + wrapper_size,\r\n\t\t\t\t\theight: v.size + wrapper_size,\r\n\t\t\t\t\tleft: v.x - wrapper_size / 2,\r\n\t\t\t\t\twidth: wrapper_size\r\n\t\t\t\t};\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t},\r\n\tget_line_sizes: function (v, view) {\r\n\t\tvar config = view.$getConfig();\r\n\t\tvar res,\r\n\t\t\tline_size = config.link_line_width,\r\n\t\t\twrapper_size = config.link_wrapper_width,\r\n\t\t\tsize = v.size + line_size;\r\n\t\tswitch (v.direction) {\r\n\t\t\tcase this.dirs.left:\r\n\t\t\tcase this.dirs.right:\r\n\t\t\t\tres = {\r\n\t\t\t\t\theight: line_size,\r\n\t\t\t\t\twidth: size,\r\n\t\t\t\t\tmarginTop: (wrapper_size - line_size) / 2,\r\n\t\t\t\t\tmarginLeft: (wrapper_size - line_size) / 2\r\n\t\t\t\t};\r\n\t\t\t\tbreak;\r\n\t\t\tcase this.dirs.up:\r\n\t\t\tcase this.dirs.down:\r\n\t\t\t\tres = {\r\n\t\t\t\t\theight: size,\r\n\t\t\t\t\twidth: line_size,\r\n\t\t\t\t\tmarginTop: (wrapper_size - line_size) / 2,\r\n\t\t\t\t\tmarginLeft: (wrapper_size - line_size) / 2\r\n\t\t\t\t};\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\r\n\t\treturn res;\r\n\t},\r\n\trender_line: function (v, end, view) {\r\n\t\tvar pos = this.get_wrapper_sizes(v, view);\r\n\t\tvar wrapper = document.createElement(\"div\");\r\n\t\twrapper.style.cssText = [\r\n\t\t\t\"top:\" + pos.top + \"px\",\r\n\t\t\t\"left:\" + pos.left + \"px\",\r\n\t\t\t\"height:\" + pos.height + \"px\",\r\n\t\t\t\"width:\" + pos.width + \"px\"\r\n\t\t].join(';');\r\n\t\twrapper.className = \"gantt_line_wrapper\";\r\n\r\n\t\tvar innerPos = this.get_line_sizes(v, view);\r\n\t\tvar inner = document.createElement(\"div\");\r\n\t\tinner.style.cssText = [\r\n\t\t\t\"height:\" + innerPos.height + \"px\",\r\n\t\t\t\"width:\" + innerPos.width + \"px\",\r\n\t\t\t\"margin-top:\" + innerPos.marginTop + \"px\",\r\n\t\t\t\"margin-left:\" + innerPos.marginLeft + \"px\"\r\n\t\t].join(\";\");\r\n\r\n\t\tinner.className = \"gantt_link_line_\" + v.direction;\r\n\t\twrapper.appendChild(inner);\r\n\r\n\t\treturn wrapper;\r\n\t},\r\n\t_get_line: function (from, to) {\r\n\t\tvar direction = this.get_direction(from, to);\r\n\t\tvar vect = {\r\n\t\t\tx: from.x,\r\n\t\t\ty: from.y,\r\n\t\t\tdirection: this.get_direction(from, to)\r\n\t\t};\r\n\t\tif (direction == this.dirs.left || direction == this.dirs.right) {\r\n\t\t\tvect.size = Math.abs(from.x - to.x);\r\n\t\t} else {\r\n\t\t\tvect.size = Math.abs(from.y - to.y);\r\n\t\t}\r\n\t\treturn vect;\r\n\t},\r\n\tget_direction: function (from, to) {\r\n\t\tvar direction = 0;\r\n\t\tif (to.x < from.x) {\r\n\t\t\tdirection = this.dirs.left;\r\n\t\t} else if (to.x > from.x) {\r\n\t\t\tdirection = this.dirs.right;\r\n\t\t} else if (to.y > from.y) {\r\n\t\t\tdirection = this.dirs.down;\r\n\t\t} else {\r\n\t\t\tdirection = this.dirs.up;\r\n\t\t}\r\n\t\treturn direction;\r\n\t}\r\n\r\n};\r\n\r\nvar path_builder = {\r\n\r\n\tpath: [],\r\n\tclear: function () {\r\n\t\tthis.path = [];\r\n\t},\r\n\tcurrent: function () {\r\n\t\treturn this.path[this.path.length - 1];\r\n\t},\r\n\tpoint: function (next) {\r\n\t\tif (!next)\r\n\t\t\treturn this.current();\r\n\r\n\t\tthis.path.push(gantt.copy(next));\r\n\t\treturn next;\r\n\t},\r\n\tpoint_to: function (direction, diff, point) {\r\n\t\tif (!point)\r\n\t\t\tpoint = gantt.copy(this.point());\r\n\t\telse\r\n\t\t\tpoint = {x: point.x, y: point.y};\r\n\t\tvar dir = drawer.dirs;\r\n\t\tswitch (direction) {\r\n\t\t\tcase (dir.left):\r\n\t\t\t\tpoint.x -= diff;\r\n\t\t\t\tbreak;\r\n\t\t\tcase (dir.right):\r\n\t\t\t\tpoint.x += diff;\r\n\t\t\t\tbreak;\r\n\t\t\tcase (dir.up):\r\n\t\t\t\tpoint.y -= diff;\r\n\t\t\t\tbreak;\r\n\t\t\tcase (dir.down):\r\n\t\t\t\tpoint.y += diff;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn this.point(point);\r\n\t},\r\n\tget_points: function (link, view) {\r\n\t\tvar pt = this.get_endpoint(link, view);\r\n\t\tvar xy = gantt.config;\r\n\r\n\t\tvar dy = pt.e_y - pt.y;\r\n\t\tvar dx = pt.e_x - pt.x;\r\n\r\n\t\tvar dir = drawer.dirs;\r\n\r\n\t\tthis.clear();\r\n\t\tthis.point({x: pt.x, y: pt.y});\r\n\r\n\t\tvar shiftX = 2 * xy.link_arrow_size;//just random size for first line\r\n\t\tvar lineType = this.get_line_type(link, view.$getConfig());\r\n\r\n\t\tvar forward = (pt.e_x > pt.x);\r\n\t\tif (lineType.from_start && lineType.to_start) {\r\n\t\t\tthis.point_to(dir.left, shiftX);\r\n\t\t\tif (forward) {\r\n\t\t\t\tthis.point_to(dir.down, dy);\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t} else {\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t\tthis.point_to(dir.down, dy);\r\n\t\t\t}\r\n\t\t\tthis.point_to(dir.right, shiftX);\r\n\r\n\t\t} else if (!lineType.from_start && lineType.to_start) {\r\n\t\t\tforward = (pt.e_x > (pt.x + 2 * shiftX));\r\n\t\t\tthis.point_to(dir.right, shiftX);\r\n\t\t\tif (forward) {\r\n\t\t\t\tdx -= shiftX;\r\n\t\t\t\tthis.point_to(dir.down, dy);\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t} else {\r\n\t\t\t\tdx -= 2 * shiftX;\r\n\t\t\t\tvar sign = dy > 0 ? 1 : -1;\r\n\r\n\t\t\t\tthis.point_to(dir.down, sign * (xy.row_height / 2));\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t\tthis.point_to(dir.down, sign * ( Math.abs(dy) - (xy.row_height / 2)));\r\n\t\t\t\tthis.point_to(dir.right, shiftX);\r\n\t\t\t}\r\n\r\n\t\t} else if (!lineType.from_start && !lineType.to_start) {\r\n\t\t\tthis.point_to(dir.right, shiftX);\r\n\t\t\tif (forward) {\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t\tthis.point_to(dir.down, dy);\r\n\t\t\t} else {\r\n\t\t\t\tthis.point_to(dir.down, dy);\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t}\r\n\t\t\tthis.point_to(dir.left, shiftX);\r\n\t\t} else if (lineType.from_start && !lineType.to_start) {\r\n\r\n\t\t\tforward = (pt.e_x > (pt.x - 2 * shiftX));\r\n\t\t\tthis.point_to(dir.left, shiftX);\r\n\r\n\t\t\tif (!forward) {\r\n\t\t\t\tdx += shiftX;\r\n\t\t\t\tthis.point_to(dir.down, dy);\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t} else {\r\n\t\t\t\tdx += 2 * shiftX;\r\n\t\t\t\tvar sign = dy > 0 ? 1 : -1;\r\n\t\t\t\tthis.point_to(dir.down, sign * (xy.row_height / 2));\r\n\t\t\t\tthis.point_to(dir.right, dx);\r\n\t\t\t\tthis.point_to(dir.down, sign * ( Math.abs(dy) - (xy.row_height / 2)));\r\n\t\t\t\tthis.point_to(dir.left, shiftX);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this.path;\r\n\t},\r\n\tget_line_type: function(link, config){\r\n\t\tvar types = config.links;\r\n\t\tvar from_start = false, to_start = false;\r\n\t\tif (link.type == types.start_to_start) {\r\n\t\t\tfrom_start = to_start = true;\r\n\t\t} else if (link.type == types.finish_to_finish) {\r\n\t\t\tfrom_start = to_start = false;\r\n\t\t} else if (link.type == types.finish_to_start) {\r\n\t\t\tfrom_start = false;\r\n\t\t\tto_start = true;\r\n\t\t} else if (link.type == types.start_to_finish) {\r\n\t\t\tfrom_start = true;\r\n\t\t\tto_start = false;\r\n\t\t} else {\r\n\t\t\tgantt.assert(false, \"Invalid link type\");\r\n\t\t}\r\n\r\n\t\tif(config.rtl){\r\n\t\t\tfrom_start = !from_start;\r\n\t\t\tto_start = !to_start;\r\n\t\t}\r\n\r\n\t\treturn {from_start: from_start, to_start: to_start};\r\n\t},\r\n\r\n\tget_endpoint: function (link, view) {\r\n\t\tvar config = view.$getConfig();\r\n\r\n\t\tvar lineType = this.get_line_type(link, config);\r\n\t\tvar from_start = lineType.from_start,\r\n\t\t\tto_start = lineType.to_start;\r\n\r\n\t\tvar source = gantt.getTask(link.source);\r\n\t\tvar target = gantt.getTask(link.target);\r\n\r\n\t\tvar from = getMilestonePosition(source, view),\r\n\t\t\tto = getMilestonePosition(target, view);\r\n\r\n\t\treturn {\r\n\t\t\tx: from_start ? from.left : (from.left + from.width),\r\n\t\t\te_x: to_start ? to.left : (to.left + to.width),\r\n\t\t\ty: from.top,\r\n\t\t\te_y: to.top\r\n\t\t};\r\n\t}\r\n};\r\n\r\nfunction getMilestonePosition(task, view){\r\n\tvar config = view.$getConfig();\r\n\tvar pos = view.getItemPosition(task);\r\n\tif(gantt.getTaskType(task.type) == config.types.milestone){\r\n\t\tvar milestoneHeight = gantt.getTaskHeight();\r\n\t\tvar milestoneWidth = Math.sqrt(2*milestoneHeight*milestoneHeight);\r\n\t\tpos.left -= milestoneWidth / 2;\r\n\t\tpos.width = milestoneWidth;\r\n\t}\r\n\treturn pos;\r\n}\r\n\r\n\r\nreturn {\r\n\trender: _render_link_element,\r\n\tupdate: null,\r\n\t//getRectangle: getLinkRectangle\r\n\tisInViewPort: isInViewPort\r\n};\r\n}\r\n\r\nmodule.exports = createLinkRender;","var getRowRectangle = require(\"./viewport/get_bg_row_rectangle\");\r\nvar isLegacyRender = require(\"./is_legacy_smart_render\");\r\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\r\nvar getVisibleCellsRange = require(\"./viewport/get_visible_cells_range\");\r\nvar isColumnVisible = require(\"./viewport/is_column_visible\");\r\n\r\nfunction createTaskBgRender(gantt){\r\n\tvar renderedCells = {};\r\n\tvar visibleCells = {};\r\n\r\n\tfunction isRendered(item, columnIndex){\r\n\t\tif(renderedCells[item.id][columnIndex] && renderedCells[item.id][columnIndex].parentNode){\r\n\t\t\treturn true;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction detachRenderedCell(itemId, columnIndex){\r\n\t\tif(renderedCells[itemId] && renderedCells[itemId][columnIndex] &&\r\n\t\t\trenderedCells[itemId][columnIndex].parentNode\r\n\t\t\t){\r\n\t\t\t\trenderedCells[itemId][columnIndex].parentNode.removeChild(renderedCells[itemId][columnIndex]);\r\n\t\t\t}\r\n\t}\r\n\r\n\tfunction getCellTemplate(view){\r\n\t\tvar templates = view.$getTemplates();\r\n\t\tvar cssTemplate;\r\n\t\tif (typeof templates.task_cell_class !== \"undefined\") {\r\n\t\t\tcssTemplate = templates.task_cell_class;\r\n\t\t\t// eslint-disable-next-line no-console\r\n\t\t\tvar log = console.warn || console.log;\r\n\t\t\tlog('gantt.templates.task_cell_class template is deprecated and will be removed soon. Please use gantt.templates.timeline_cell_class instead.');\r\n\t\t} else {\r\n\t\t\tcssTemplate = templates.timeline_cell_class;\r\n\t\t}\r\n\t\treturn cssTemplate;\r\n\t}\r\n\r\n\tfunction renderCells(item, node, view, viewPort){\r\n\t\tvar config = view.$getConfig();\r\n\t\tvar cfg = view.getScale();\r\n\t\tvar count = cfg.count;\r\n\t\tvar cssTemplate = getCellTemplate(view);\r\n\r\n\t\tif (config.show_task_cells) {\r\n\t\t\tif(!renderedCells[item.id]){\r\n\t\t\t\trenderedCells[item.id] = {};\r\n\t\t\t}\r\n\t\t\tif(!visibleCells[item.id]){\r\n\t\t\t\tvisibleCells[item.id] = {};\r\n\t\t\t}\r\n\r\n\t\t\tvar range = getVisibleCellsRange(cfg, viewPort);\r\n\r\n\t\t\tfor(var i in visibleCells[item.id]){\r\n\t\t\t\tvar index = visibleCells[item.id][i];\r\n\r\n\t\t\t\tif(Number(index) < range.start || Number(index) > range.end){\r\n\t\t\t\t\tdetachRenderedCell(item.id, index);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvisibleCells[item.id] = {};\r\n\t\t\t// TODO: do not iterate all cell, only ones in the viewport and once that are already rendered\r\n\t\t\tfor (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\r\n\t\t\t\tvar cell = renderOneCell(cfg, columnIndex, item, viewPort, count, cssTemplate, config);\r\n\t\t\t\tif(!cell && isRendered(item, columnIndex)){\r\n\t\t\t\t\tdetachRenderedCell(item.id, columnIndex);\r\n\t\t\t\t}else if (cell && !cell.parentNode){\r\n\t\t\t\t\tnode.appendChild(cell);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction renderOneCell(scale, columnIndex, item, viewPort, count, cssTemplate, config){\r\n\t\tvar width = scale.width[columnIndex],\r\n\t\t\tcssclass = \"\";\r\n\r\n\t\tif (isColumnVisible(columnIndex, scale, viewPort, gantt)) {//do not render skipped columns\r\n\t\t\t\r\n\t\t\tvar cssTemplateContent = cssTemplate(item, scale.trace_x[columnIndex]);\r\n\r\n\t\t\tif(config.static_background){\r\n\t\t\t\t// if cell render in static background is not allowed, or if it's a blank cell\r\n\t\t\t\tif(!(config.static_background_cells && cssTemplateContent)){\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(renderedCells[item.id][columnIndex]){\r\n\t\t\t\tvisibleCells[item.id][columnIndex] = columnIndex;\r\n\t\t\t\treturn renderedCells[item.id][columnIndex];\r\n\t\t\t}\r\n\t\t\tvar cell = document.createElement(\"div\");\r\n\t\t\tcell.style.width = (width) + \"px\";\r\n\r\n\t\t\tcssclass = \"gantt_task_cell\" + (columnIndex == count - 1 ? \" gantt_last_cell\" : \"\");\r\n\t\t\tif (cssTemplateContent) {\r\n\t\t\t\tcssclass += \" \" + cssTemplateContent;\r\n\t\t\t}\r\n\t\t\tcell.className = cssclass;\r\n\r\n\t\t\tcell.style.position = \"absolute\";\r\n\t\t\tcell.style.left = scale.left[columnIndex] + \"px\";\r\n\t\t\trenderedCells[item.id][columnIndex] = cell;\r\n\t\t\tvisibleCells[item.id][columnIndex] = columnIndex;\r\n\r\n\t\t\treturn cell;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfunction _render_bg_line(item, view, viewPort) {\r\n\t\tvar config = view.$getConfig(),\r\n\t\t\ttemplates = view.$getTemplates();\r\n\t\tvar cfg = view.getScale();\r\n\t\tvar count = cfg.count;\r\n\r\n\t\tif(config.static_background && !config.static_background_cells){\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tvar row = document.createElement(\"div\");\r\n\r\n\t\tvar cellTemplate = getCellTemplate(view);\r\n\r\n\t\tvar range;\r\n\r\n\t\tif(!viewPort || !config.smart_rendering || isLegacyRender(gantt)){\r\n\t\t\trange = {\r\n\t\t\t\tstart: 0,\r\n\t\t\t\tend: count - 1\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\trange = getVisibleCellsRange(cfg, viewPort.x);\r\n\t\t}\r\n\t\tif (config.show_task_cells) {\r\n\t\t\trenderedCells[item.id] = {};\r\n\t\t\tvisibleCells[item.id] = {};\r\n\t\t\tfor (var columnIndex = range.start; columnIndex <= range.end; columnIndex++) {\r\n\t\t\t\tvar cell = renderOneCell(cfg, columnIndex, item, viewPort, count, cellTemplate, config);\r\n\t\t\t\tif(cell){\r\n\t\t\t\t\trow.appendChild(cell);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar odd = gantt.getGlobalTaskIndex(item.id) % 2 !== 0;\r\n\t\tvar cssTemplate = templates.task_row_class(item.start_date, item.end_date, item);\r\n\t\tvar css = \"gantt_task_row\" + (odd ? \" odd\" : \"\") + (cssTemplate ? ' ' + cssTemplate : '');\r\n\r\n\t\tvar store = view.$config.rowStore;\r\n\t\tif(store.isSelected(item.id)) {\r\n\t\t\tcss += \" gantt_selected\";\r\n\t\t}\r\n\r\n\t\trow.className = css;\r\n\r\n\t\tif (config.smart_rendering) {\r\n\t\t\trow.style.position = \"absolute\";\r\n\t\t\trow.style.top = view.getItemTop(item.id) + \"px\";\r\n\t\t\trow.style.width = \"100%\";\r\n\t\t}else{\r\n\t\t\trow.style.position = \"relative\";\r\n\t\t}\r\n\t\trow.style.height = (config.row_height) + \"px\";\r\n\r\n\t\tif(view.$config.item_attribute){\r\n\t\t\trow.setAttribute(view.$config.item_attribute, item.id);\r\n\t\t\trow.setAttribute(view.$config.bind + \"_id\", item.id); // 'task_id'/'resource_id' for backward compatibility\r\n\t\t}\r\n\r\n\t\treturn row;\r\n\t}\r\n\r\n\treturn {\r\n\t\trender: _render_bg_line,\r\n\t\tupdate: renderCells,\r\n\t\tgetRectangle: getRowRectangle,\r\n\t\tgetVisibleRange: getVisibleRange\r\n\t};\r\n}\r\n\r\nmodule.exports = createTaskBgRender;\r\n","var isBarInViewport = require(\"./is_bar_in_viewport\");\r\nmodule.exports = function isSplitTaskInViewport(item, viewport, view, gantt){\r\n\tif (!gantt.isSplitTask(item)) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tvar range = gantt.getSubtaskDates(item.id);\r\n\r\n\treturn isBarInViewport({\r\n\t\tid: item.id,\r\n\t\tstart_date: range.start_date,\r\n\t\tend_date: range.end_date,\r\n\t\tparent: item.parent\r\n\t}, viewport, view, gantt);\r\n};","var createBaseBarRender = require(\"./task_bar_render\");\r\nvar isInViewPort = require(\"./viewport/is_split_task_in_viewport\");\r\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\r\n\r\nfunction createTaskRenderer(gantt){\r\n\tvar defaultRender = createBaseBarRender(gantt);\r\n\r\n\tfunction renderSplitTask(task, timeline) {\r\n\t\tif (gantt.isSplitTask(task) && ((gantt.config.open_split_tasks && !task.$open) || !gantt.config.open_split_tasks)) {\r\n\t\t\tvar el = document.createElement('div'),\r\n\t\t\t\tsizes = gantt.getTaskPosition(task);\r\n\r\n\t\t\tif(gantt.hasChild(task.id)){\r\n\t\t\t\tgantt.eachTask(function(child){\r\n\t\t\t\t\tvar isProject = gantt.isSummaryTask(child);\r\n\t\t\t\t\tif(isProject){\r\n\t\t\t\t\t\tgantt.resetProjectDates(child);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar element = defaultRender(child, timeline);\r\n\t\t\t\t\tif(!element)\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\tvar padding = Math.floor((gantt.config.row_height - sizes.height) / 2);\r\n\r\n\t\t\t\t\telement.style.top = (sizes.top + padding) + \"px\";\r\n\t\t\t\t\telement.classList.add(\"gantt_split_child\");\r\n\t\t\t\t\tif(isProject){\r\n\t\t\t\t\t\telement.classList.add(\"gantt_split_subproject\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tel.appendChild(element);\r\n\t\t\t\t}, task.id);\r\n\t\t\t}\r\n\t\t\treturn el;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\treturn {\r\n\t\trender: renderSplitTask,\r\n\t\tupdate: null,\r\n\t\t//getRectangle: getBarRectangle\r\n\t\tisInViewPort: isInViewPort,\r\n\t\tgetVisibleRange: getVisibleRange\r\n\t};\r\n}\r\n\r\nmodule.exports = createTaskRenderer;","var isInViewPort = require(\"./viewport/is_bar_in_viewport\");\r\nvar getVisibleRange = require(\"./viewport/get_visible_bars_range\");\r\nvar createBaseBarRender = require(\"./task_bar_render\");\r\n\r\nmodule.exports = function createTaskRenderer(gantt){\r\n\tvar defaultRender = createBaseBarRender(gantt);\r\n\treturn {\r\n\t\trender: defaultRender,\r\n\t\tupdate: null,\r\n\t\t//getRectangle: getBarRectangle\r\n\t\tisInViewPort: isInViewPort,\r\n\t\tgetVisibleRange: getVisibleRange\r\n\t};\r\n};","module.exports = function (gantt) {\r\n\treturn function processTaskDateProperties(item, mapTo, mode) {\r\n\t\tif (mode == \"keepDates\") {\r\n\t\t\tkeepDatesOnEdit(item, mapTo);\r\n\t\t} else if (mode == \"keepDuration\") {\r\n\t\t\tkeepDurationOnEdit(item, mapTo);\r\n\t\t} else {\r\n\t\t\tdefaultActionOnEdit(item, mapTo);\r\n\t\t}\r\n\t};\r\n\r\n\t// resize task\r\n\t// resize task when start/end/duration changes\r\n\tfunction keepDatesOnEdit(item, mapTo) {\r\n\t\tif (mapTo == \"duration\") {\r\n\t\t\titem.end_date = gantt.calculateEndDate(item);\r\n\t\t} else if (mapTo == \"end_date\" || mapTo == \"start_date\") {\r\n\t\t\titem.duration = gantt.calculateDuration(item);\r\n\t\t}\r\n\t}\r\n\r\n\t// move task(before 6.2)\r\n\t// move task when start/end dates changes\r\n\t// resize task when duration changes\r\n\tfunction keepDurationOnEdit(item, mapTo) {\r\n\t\tif (mapTo == \"end_date\") {\r\n\t\t\titem.start_date = gantt.calculateEndDate({\r\n\t\t\t\tstart_date: item.end_date,\r\n\t\t\t\tduration: -item.duration,\r\n\t\t\t\ttask: item\r\n\t\t\t}\r\n\t\t\t);\r\n\t\t} else if (mapTo == \"start_date\" || mapTo == \"duration\") {\r\n\t\t\titem.end_date = gantt.calculateEndDate(item);\r\n\t\t}\r\n\t}\r\n\r\n\t// default behavior\r\n\t// move task when start date changes\r\n\t// resize task when end date/duration changes\r\n\tfunction defaultActionOnEdit(item, mapTo) {\r\n\t\tif (mapTo == \"start_date\" || mapTo == \"duration\") {\r\n\t\t\titem.end_date = gantt.calculateEndDate(item);\r\n\t\t} else if (mapTo == \"end_date\") {\r\n\t\t\titem.duration = gantt.calculateDuration(item);\r\n\t\t}\r\n\t}\r\n};","module.exports = function(gantt) {\r\n\r\n\tvar BaseEditor = require(\"./base\")(gantt),\r\n\t\tutils = require(\"../../../../../utils/utils\");\r\n\tvar __extends = require(\"../../../../../utils/extends\");\r\n\r\n\tfunction TextEditor() {\r\n\t\tvar self = BaseEditor.apply(this, arguments) || this;\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(TextEditor, BaseEditor);\r\n\r\n\tfunction getFormatter(config) {\r\n\t\treturn config.formatter || gantt.ext.formatters.durationFormatter();\r\n\t}\r\n\tutils.mixin(TextEditor.prototype, {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t\tvar html = \"
\";\r\n\t\t\tplaceholder.innerHTML = html;\r\n\t\t},\r\n\t\tset_value: function (value, id, column, node) {\r\n\t\t\tthis.get_input(node).value = getFormatter(column.editor).format(value);\r\n\t\t},\r\n\t\tget_value: function (id, column, node) {\r\n\t\t\treturn getFormatter(column.editor).parse(this.get_input(node).value || \"\");\r\n\t\t}\r\n\t}, true);\r\n\r\n\treturn TextEditor;\r\n};","module.exports = function (gantt) {\r\n\r\n\tvar BaseEditor = require(\"./base\")(gantt),\r\n\t\tutils = require(\"../../../../../utils/utils\");\r\n\tvar __extends = require(\"../../../../../utils/extends\");\r\n\r\n\tfunction PredecessorEditor() {\r\n\t\tvar self = BaseEditor.apply(this, arguments) || this;\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(PredecessorEditor, BaseEditor);\r\n\r\n\tfunction getFormatter(config) {\r\n\t\treturn config.formatter || gantt.ext.formatters.linkFormatter();\r\n\t}\r\n\r\n\tfunction parseInputString(value, config) {\r\n\t\tvar predecessors = (value || \"\").split(config.delimiter || \",\");\r\n\t\tfor (var i = 0; i < predecessors.length; i++) {\r\n\t\t\tvar val = predecessors[i].trim();\r\n\t\t\tif (val) {\r\n\t\t\t\tpredecessors[i] = val;\r\n\t\t\t} else {\r\n\t\t\t\tpredecessors.splice(i, 1);\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpredecessors.sort();\r\n\t\treturn predecessors;\r\n\t}\r\n\r\n\tfunction formatPredecessors(task, config, gantt) {\r\n\t\tvar links = task.$target;\r\n\t\tvar labels = [];\r\n\t\tfor (var i = 0; i < links.length; i++) {\r\n\t\t\tvar link = gantt.getLink(links[i]);\r\n\t\t\tlabels.push(getFormatter(config).format(link));\r\n\t\t}\r\n\t\treturn labels.join((config.delimiter || \",\") + \" \");\r\n\t}\r\n\r\n\tfunction getSelectedLinks(taskId, predecessorCodes, config) {\r\n\t\tvar links = [];\r\n\t\tpredecessorCodes.forEach(function (code) {\r\n\t\t\tvar link = getFormatter(config).parse(code);\r\n\t\t\tif(link){\r\n\t\t\t\tlink.target = taskId;\r\n\t\t\t\tif (gantt.isLinkAllowed(link)) {\r\n\t\t\t\t\tlinks.push(link);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn links;\r\n\t}\r\n\r\n\tfunction formatLinkKey(link){\r\n\t\treturn link.source + \"_\" + link.target + \"_\" + link.type + \"_\" + (link.lag||0);\r\n\t}\r\n\r\n\tfunction getLinksDiff(task, predecessorCodes, config) {\r\n\t\tvar selectedLinks = getSelectedLinks(task.id, predecessorCodes, config);\r\n\t\tvar existingLinksSearch = {};\r\n\t\ttask.$target.forEach(function (linkId) {\r\n\t\t\tvar link = gantt.getLink(linkId);\r\n\t\t\texistingLinksSearch[formatLinkKey(link)] = link.id;\r\n\t\t});\r\n\r\n\t\tvar linksToAdd = [];\r\n\t\tselectedLinks.forEach(function (link) {\r\n\t\t\tvar linkKey = formatLinkKey(link);\r\n\t\t\tif (!existingLinksSearch[linkKey]) {\r\n\t\t\t\tlinksToAdd.push(link);\r\n\t\t\t} else {\r\n\t\t\t\tdelete existingLinksSearch[linkKey];\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tvar linksToDelete = [];\r\n\t\tfor (var i in existingLinksSearch) {\r\n\t\t\tlinksToDelete.push(existingLinksSearch[i]);\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tadd: linksToAdd,\r\n\t\t\tremove: linksToDelete\r\n\t\t};\r\n\t}\r\n\r\n\tutils.mixin(PredecessorEditor.prototype, {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t\tvar html = \"
\";\r\n\t\t\tplaceholder.innerHTML = html;\r\n\t\t},\r\n\t\thide: function () {\r\n\t\t},\r\n\t\tset_value: function (value, id, column, node) {\r\n\t\t\tthis.get_input(node).value = formatPredecessors(value, column.editor, gantt);\r\n\t\t},\r\n\t\tget_value: function (id, column, node) {\r\n\t\t\treturn parseInputString((this.get_input(node).value || \"\"), column.editor);\r\n\t\t},\r\n\t\tsave: function (id, column, node) {\r\n\t\t\tvar task = gantt.getTask(id);\r\n\r\n\t\t\tvar linksDiff = getLinksDiff(task, this.get_value(id, column, node), column.editor);\r\n\r\n\t\t\tif (linksDiff.add.length || linksDiff.remove.length) {\r\n\t\t\t\tgantt.batchUpdate(function () {\r\n\t\t\t\t\tlinksDiff.add.forEach(function (link) {\r\n\t\t\t\t\t\tgantt.addLink(link);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tlinksDiff.remove.forEach(function (linkId) {\r\n\t\t\t\t\t\tgantt.deleteLink(linkId);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif (gantt.autoSchedule)\r\n\t\t\t\t\t\tgantt.autoSchedule();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t},\r\n\t\tis_changed: function (value, id, column, node) {\r\n\t\t\tvar inputPredecessors = this.get_value(id, column, node);\r\n\t\t\tvar taskPredecessors = parseInputString(formatPredecessors(value, column.editor, gantt), column.editor);\r\n\r\n\t\t\treturn inputPredecessors.join() !== taskPredecessors.join();\r\n\t\t}\r\n\t}, true);\r\n\r\n\treturn PredecessorEditor;\r\n};","module.exports = function (gantt) {\r\n\tvar BaseEditor = require(\"./base\")(gantt),\r\n\t\tutils = require(\"../../../../../utils/utils\");\r\n\tvar __extends = require(\"../../../../../utils/extends\");\r\n\r\n\tvar html5DateFormat = \"%Y-%m-%d\";\r\n\r\n\tvar dateToStr = null;\r\n\tvar strToDate = null;\r\n\r\n\tfunction init() {\r\n\t\tif (!dateToStr) {\r\n\t\t\tdateToStr = gantt.date.date_to_str(html5DateFormat);\r\n\t\t}\r\n\t\tif (!strToDate) {\r\n\t\t\tstrToDate = gantt.date.str_to_date(html5DateFormat);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction DateEditor() {\r\n\t\tvar self = BaseEditor.apply(this, arguments) || this;\r\n\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(DateEditor, BaseEditor);\r\n\r\n\tutils.mixin(DateEditor.prototype, {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t\tinit();\r\n\t\t\tvar minValue = null;\r\n\t\t\tvar maxValue = null;\r\n\r\n\t\t\tif(typeof config.min === \"function\"){\r\n\t\t\t\tminValue = config.min(id, column);\r\n\t\t\t}else{\r\n\t\t\t\tminValue = config.min;\r\n\t\t\t}\r\n\r\n\t\t\tif(typeof config.max === \"function\"){\r\n\t\t\t\tmaxValue = config.max(id, column);\r\n\t\t\t}else{\r\n\t\t\t\tmaxValue = config.max;\r\n\t\t\t}\r\n\r\n\t\t\tvar minAttr = minValue ? \" min='\" + dateToStr(minValue)+\"' \" : \"\";\r\n\t\t\tvar maxAttr = maxValue ? \" max='\" + dateToStr(maxValue)+\"' \" : \"\";\r\n\t\t\tvar html = \"
\";\r\n\t\t\tplaceholder.innerHTML = html;\r\n\t\t},\r\n\t\tset_value: function (value, id, column, node) {\r\n\t\t\tif (value && value.getFullYear) {\r\n\t\t\t\tthis.get_input(node).value = dateToStr(value);\r\n\t\t\t} else {\r\n\t\t\t\tthis.get_input(node).value = value;\r\n\t\t\t}\r\n\t\t},\r\n\t\tis_valid: function (value, id, column, node) {\r\n\t\t\tif (!value || isNaN(value.getTime()))\r\n\t\t\t\treturn false;\r\n\t\t\treturn true;\r\n\t\t},\r\n\t\tget_value: function (id, column, node) {\r\n\t\t\tvar parsed;\r\n\t\t\ttry {\r\n\t\t\t\tparsed = strToDate(this.get_input(node).value || \"\");\r\n\t\t\t} catch (e) {\r\n\t\t\t\tparsed = null;// return null will cancel changes\r\n\t\t\t}\r\n\r\n\t\t\treturn parsed;\r\n\t\t}\r\n\t}, true);\r\n\r\n\treturn DateEditor;\r\n};\r\n","module.exports = function(gantt) {\r\n\tvar BaseEditor = require(\"./base\")(gantt),\r\n\t\tutils = require(\"../../../../../utils/utils\");\r\n\tvar __extends = require(\"../../../../../utils/extends\");\r\n\r\n\tfunction SelectEditor() {\r\n\t\tvar self = BaseEditor.apply(this, arguments) || this;\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(SelectEditor, BaseEditor);\r\n\r\n\tutils.mixin(SelectEditor.prototype, {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t\tvar html = \"
\";\r\n\t\t\tplaceholder.innerHTML = html;\r\n\t\t},\r\n\t\tget_input: function (node) {\r\n\t\t\treturn node.querySelector(\"select\");\r\n\t\t}\r\n\t}, true);\r\n\r\n\treturn SelectEditor;\r\n};","module.exports = function (gantt) {\r\n\r\n\tvar BaseEditor = require(\"./base\")(gantt),\r\n\t\tutils = require(\"../../../../../utils/utils\");\r\n\tvar __extends = require(\"../../../../../utils/extends\");\r\n\r\n\tfunction NumberEditor() {\r\n\t\tvar self = BaseEditor.apply(this, arguments) || this;\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(NumberEditor, BaseEditor);\r\n\r\n\tutils.mixin(NumberEditor.prototype, {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t\tvar min = config.min || 0,\r\n\t\t\t\tmax = config.max || 100;\r\n\r\n\t\t\tvar html = \"
\";\r\n\t\t\tplaceholder.innerHTML = html;\r\n\t\t},\r\n\t\tget_value: function (id, column, node) {\r\n\t\t\treturn this.get_input(node).value || \"\";\r\n\t\t},\r\n\t\tis_valid: function (value, id, column, node) {\r\n\t\t\treturn !isNaN(parseInt(value, 10));\r\n\t\t}\r\n\t}, true);\r\n\r\n\treturn NumberEditor;\r\n};","module.exports = function(gantt) {\r\n\r\n\tvar BaseEditor = require(\"./base\")(gantt),\r\n\t\tutils = require(\"../../../../../utils/utils\");\r\n\tvar __extends = require(\"../../../../../utils/extends\");\r\n\r\n\tfunction TextEditor() {\r\n\t\tvar self = BaseEditor.apply(this, arguments) || this;\r\n\t\treturn self;\r\n\t}\r\n\r\n\t__extends(TextEditor, BaseEditor);\r\n\r\n\tutils.mixin(TextEditor.prototype, {\r\n\t\tshow: function (id, column, config, placeholder) {\r\n\t\t\tvar html = \"
\";\r\n\t\t\tplaceholder.innerHTML = html;\r\n\t\t}\r\n\t}, true);\r\n\r\n\treturn TextEditor;\r\n};","module.exports = {\r\n\tinit: function(controller, grid){\r\n\t\tvar self = controller;\r\n\t\tvar gantt = grid.$gantt;\r\n\r\n\t\tvar onBlurDelay = null;\r\n\t\tvar keyNav = gantt.ext.keyboardNavigation;\r\n\t\tkeyNav.attachEvent(\"onBeforeFocus\", function (node) {\r\n\t\t\tvar activeCell = controller.locateCell(node);\r\n\t\t\tclearTimeout(onBlurDelay);\r\n\t\t\tif (activeCell) {\r\n\t\t\t\tvar columnName = activeCell.columnName;\r\n\t\t\t\tvar id = activeCell.id;\r\n\r\n\t\t\t\tvar editorState = self.getState();\r\n\t\t\t\tif(self.isVisible()){\r\n\t\t\t\t\tif(editorState.id == id && editorState.columnName === columnName) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tkeyNav.attachEvent(\"onFocus\", function (node) {\r\n\t\t\tvar activeCell = controller.locateCell(node);\r\n\t\t\tvar state = controller.getState();\r\n\t\t\tclearTimeout(onBlurDelay);\r\n\t\t\tif (activeCell && !(activeCell.id == state.id && activeCell.columnName == state.columnName)) {\r\n\t\t\t\tif(self.isVisible()){\r\n\t\t\t\t\tself.save();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tcontroller.attachEvent(\"onHide\", function(){\r\n\t\t\tclearTimeout(onBlurDelay);\r\n\t\t});\r\n\r\n\t\tkeyNav.attachEvent(\"onBlur\", function () {\r\n\t\t\tonBlurDelay = setTimeout(function(){\r\n\t\t\t\tself.save();\r\n\t\t\t});\r\n\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onTaskDblClick\", function(id,e){\r\n\t\t\t// block lightbox on double click inside editor\r\n\t\t\tvar state = controller.getState();\r\n\t\t\tvar cell = controller.locateCell(e.target);\r\n\t\t\tif(cell && controller.isVisible() && cell.columnName == state.columnName){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onTaskClick\", function (id, e) {\r\n\t\t\tif(gantt._is_icon_open_click(e))\r\n\t\t\t\treturn true;\r\n\r\n\t\t\tvar state = controller.getState();\r\n\t\t\tvar cell = controller.locateCell(e.target);\r\n\r\n\t\t\tif (cell && controller.getEditorConfig(cell.columnName)) {\r\n\t\t\t\tif(controller.isVisible() && state.id == cell.id && state.columnName == cell.columnName){\r\n\t\t\t\t\t// do nothing if editor is already active in this cell\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcontroller.startEdit(cell.id, cell.columnName);\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\t\tgantt.attachEvent(\"onEmptyClick\", function () {\r\n\t\t\tself.save();\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tkeyNav.attachEvent(\"onKeyDown\", function(command, e){\r\n\t\t\tvar activeCell = controller.locateCell(e.target);\r\n\t\t\tvar hasEditor = activeCell ? controller.getEditorConfig(activeCell.columnName) : false;\r\n\r\n\t\t\tvar state = controller.getState();\r\n\t\t\tvar keyboard = gantt.constants.KEY_CODES;\r\n\t\t\tvar keyCode = e.keyCode;\r\n\t\t\tvar preventKeyNav = false;\r\n\r\n\t\t\tswitch (keyCode){\r\n\t\t\t\tcase keyboard.ENTER:\r\n\t\t\t\t\tif(controller.isVisible()){\r\n\t\t\t\t\t\tcontroller.save();\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}else if(hasEditor && !(e.ctrlKey || e.metaKey || e.shiftKey)){\r\n\t\t\t\t\t\tself.startEdit(activeCell.id, activeCell.columnName);\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.ESC:\r\n\t\t\t\t\tif(controller.isVisible()){\r\n\t\t\t\t\t\tcontroller.hide();\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.UP:\r\n\t\t\t\tcase keyboard.DOWN:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.LEFT:\r\n\t\t\t\tcase keyboard.RIGHT:\r\n\t\t\t\t\tif((hasEditor && controller.isVisible()) || state.editorType === \"date\"){\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.SPACE:\r\n\t\t\t\t\tif(controller.isVisible()){\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(hasEditor && !controller.isVisible()){\r\n\t\t\t\t\t\tself.startEdit(activeCell.id, activeCell.columnName);\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.DELETE:\r\n\t\t\t\t\tif(hasEditor && !controller.isVisible()){\r\n\t\t\t\t\t\tself.startEdit(activeCell.id, activeCell.columnName);\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t} else if(hasEditor && controller.isVisible()){\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.TAB:\r\n\t\t\t\t\tif(controller.isVisible()){\r\n\r\n\t\t\t\t\t\tif(e.shiftKey){\r\n\t\t\t\t\t\t\tcontroller.editPrevCell(true);\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tcontroller.editNextCell(true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar newState = controller.getState();\r\n\t\t\t\t\t\tif(newState.id){\r\n\t\t\t\t\t\t\tkeyNav.focus({type:\"taskCell\", id: newState.id, column:newState.columnName});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tif(controller.isVisible())\r\n\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\telse{\r\n\r\n\t\t\t\t\t\t// start editing on character key\r\n\t\t\t\t\t\tif((keyCode >= 48 && keyCode <= 57) || // [0-9]\r\n\t\t\t\t\t\t\t(keyCode > 95 && keyCode < 112) || // numpad\r\n\t\t\t\t\t\t\t(keyCode >= 64 && keyCode <= 91) || // [a-z]\r\n\t\t\t\t\t\t\t(keyCode > 185 && keyCode < 193) || //;=-,etc\r\n\t\t\t\t\t\t\t(keyCode > 218 && keyCode < 223)\r\n\t\t\t\t\t\t){\r\n\t\t\t\t\t\t\tvar modifiers = command.modifiers;\r\n\r\n\t\t\t\t\t\t\tvar anyModifier = modifiers.alt || modifiers.ctrl || modifiers.meta || modifiers.shift;\r\n\t\t\t\t\t\t\tif(modifiers.alt){\r\n\t\t\t\t\t\t\t\t// don't start editing on alt+key\r\n\t\t\t\t\t\t\t}else if (anyModifier && keyNav.getCommandHandler(command, \"taskCell\")){\r\n\t\t\t\t\t\t\t\t// don't start editing if command already have a keyboard shortcut\r\n\t\t\t\t\t\t\t}else if(hasEditor && !controller.isVisible()){\r\n\t\t\t\t\t\t\t\tself.startEdit(activeCell.id, activeCell.columnName);\r\n\t\t\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tif (preventKeyNav){\r\n\t\t\t\treturn false;\r\n\t\t\t} else{\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t},\r\n\tonShow: function(controller, placeholder, grid){},\r\n\tonHide: function(controller, placeholder, grid){\r\n\t\tvar gantt = grid.$gantt;\r\n\t\tgantt.focus();\r\n\r\n\t},\r\n\tdestroy: function(){}\r\n};\r\n\r\n","module.exports = {\r\n\tinit: function (controller, grid) {\r\n\t\tvar gantt = grid.$gantt;\r\n\r\n\t\tgantt.attachEvent(\"onTaskClick\", function (id, e) {\r\n\t\t\tif (gantt._is_icon_open_click(e))\r\n\t\t\t\treturn true;\r\n\t\t\tvar state = controller.getState();\r\n\t\t\tvar cell = controller.locateCell(e.target);\r\n\r\n\t\t\tif (cell && controller.getEditorConfig(cell.columnName)) {\r\n\t\t\t\tif (controller.isVisible() && state.id == cell.id && state.columnName == cell.columnName) {\r\n\t\t\t\t\t// do nothing if editor is already active in this cell\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcontroller.startEdit(cell.id, cell.columnName);\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onEmptyClick\", function () {\r\n\t\t\tif (controller.isVisible() && controller.isChanged()) {\r\n\t\t\t\tcontroller.save();\r\n\t\t\t} else {\r\n\t\t\t\tcontroller.hide();\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onTaskDblClick\", function (id, e) {\r\n\t\t\tvar state = controller.getState();\r\n\t\t\tvar cell = controller.locateCell(e.target);\r\n\t\t\tif (cell && controller.isVisible() && cell.columnName == state.columnName) {\r\n\t\t\t\tcontroller.hide();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\t},\r\n\r\n\tonShow: function (controller, placeholder, grid) {\r\n\t\tvar gantt = grid.$gantt;\r\n\t\t\r\n\r\n\t\tif(gantt.ext && gantt.ext.keyboardNavigation){\r\n\t\t\tvar keyNav = gantt.ext.keyboardNavigation;\r\n\t\t\tkeyNav.attachEvent(\"onKeyDown\", function(command, e){\r\n\t\t\t\tvar keyboard = gantt.constants.KEY_CODES;\r\n\t\t\t\tvar keyCode = e.keyCode;\r\n\t\t\t\tvar preventKeyNav = false;\r\n\r\n\t\t\t\tswitch (keyCode){\r\n\t\t\t\t\tcase keyboard.SPACE:\r\n\t\t\t\t\t\tif(controller.isVisible()){\r\n\t\t\t\t\t\t\tpreventKeyNav = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif (preventKeyNav){\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t} else{\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\t\r\n\t\tplaceholder.onkeydown = function (e) {\r\n\t\t\te = e || window.event;\r\n\r\n\t\t\tvar keyboard = gantt.constants.KEY_CODES;\r\n\t\t\tif (e.defaultPrevented || (e.shiftKey && e.keyCode != keyboard.TAB)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar shouldPrevent = true;\r\n\t\t\tswitch (e.keyCode) {\r\n\t\t\t\tcase gantt.keys.edit_save:\r\n\t\t\t\t\tcontroller.save();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase gantt.keys.edit_cancel:\r\n\t\t\t\t\tcontroller.hide();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.UP:\r\n\t\t\t\tcase keyboard.DOWN:\r\n\t\t\t\t\tif (controller.isVisible()) {\r\n\t\t\t\t\t\tcontroller.hide();\r\n\t\t\t\t\t\tshouldPrevent = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase keyboard.TAB:\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tcontroller.editPrevCell(true);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tcontroller.editNextCell(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tshouldPrevent = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tif (shouldPrevent) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t}\r\n\t\t};\r\n\t},\r\n\tonHide: function () {\r\n\r\n\t},\r\n\r\n\tdestroy: function () {\r\n\r\n\t}\r\n};\r\n\r\n","var defaultMapping = require(\"./keyboard_mappings/default\");\r\nvar keyNavMappings = require(\"./keyboard_mappings/keyboard_navigation\");\r\n\r\nmodule.exports = function(gantt){\r\n\r\n\tvar mapping = null;\r\n\r\n\treturn {\r\n\t\tsetMapping: function(map){\r\n\t\t\tmapping = map;\r\n\t\t},\r\n\t\tgetMapping: function(){\r\n\r\n\t\t\tif(mapping){\r\n\t\t\t\treturn mapping;\r\n\t\t\t}else if(gantt.config.keyboard_navigation_cells){\r\n\t\t\t\treturn keyNavMappings;\r\n\t\t\t}else{\r\n\t\t\t\treturn defaultMapping;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n};\r\n","var getKeyboardMapping = require(\"./keyboard_mappings\");\r\nvar textEditorFactory = require(\"./editors/text\"),\r\n\tnumberEditorFactory = require(\"./editors/number\"),\r\n\tselectEditorFactory = require(\"./editors/select\"),\r\n\tdateEditorFactory = require(\"./editors/date\"),\r\n\tpredecessorEditorFactory = require(\"./editors/predecessor\"),\r\n\tdurationEditorFactory = require(\"./editors/duration\");\r\nvar utils = require(\"../../../../utils/utils\");\r\nvar domHelpers = require(\"../../utils/dom_helpers\");\r\nvar eventable = require(\"../../../../utils/eventable\");\r\nvar linkedPropertiesProcessor = require(\"./linked_properties\");\r\n\r\nfunction initConfigs(gantt){\r\n\tgantt.config.editor_types = {\r\n\t\ttext: new (textEditorFactory(gantt))(),\r\n\t\tnumber: new (numberEditorFactory(gantt))(),\r\n\t\tselect: new (selectEditorFactory(gantt))(),\r\n\t\tdate: new (dateEditorFactory(gantt))(),\r\n\t\tpredecessor: new (predecessorEditorFactory(gantt))(),\r\n\t\tduration: new (durationEditorFactory(gantt))()\r\n\t};\r\n}\r\n\r\nfunction create(gantt){\r\n\tvar keyboardMapping = getKeyboardMapping(gantt);\r\n\r\n\tvar eventBus = {};\r\n\teventable(eventBus);\r\n\r\n\tfunction createGridEditors(grid) {\r\n\r\n\t\tfunction _getGridCellFromNode(node){\r\n\t\t\tif(!domHelpers.isChildOf(node, grid.$grid)){\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tvar row = domHelpers.locateAttribute(node, grid.$config.item_attribute);\r\n\t\t\tvar cell = domHelpers.locateAttribute(node, \"data-column-name\");\r\n\t\t\tif(cell){\r\n\t\t\t\tvar columnName = cell.getAttribute(\"data-column-name\");\r\n\t\t\t\tvar id = row.getAttribute(grid.$config.item_attribute);\r\n\t\t\t\treturn {\r\n\t\t\t\t\tid: id,\r\n\t\t\t\t\tcolumnName: columnName\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tfunction _getEditorPosition(itemId, columnName) {\r\n\t\t\tvar config = grid.$getConfig();\r\n\t\t\tvar top = grid.getItemTop(itemId);\r\n\t\t\tvar height = grid.getItemHeight(itemId);\r\n\t\t\tvar cols = grid.getGridColumns();\r\n\t\t\tvar left = 0,\r\n\t\t\t\tright = 0,\r\n\t\t\t\twidth = 0;\r\n\r\n\t\t\tfor (var i = 0; i < cols.length; i++) {\r\n\t\t\t\tif (cols[i].name == columnName) {\r\n\t\t\t\t\twidth = cols[i].width;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif (config.rtl) {\r\n\t\t\t\t\tright += cols[i].width;\r\n\t\t\t\t}\telse {\r\n\t\t\t\t\tleft += cols[i].width;\r\n\t\t\t\t}\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tif (config.rtl) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\ttop: top,\r\n\t\t\t\t\tright: right,\r\n\t\t\t\t\theight: height,\r\n\t\t\t\t\twidth: width\r\n\t\t\t\t};\r\n\t\t\t} else {\r\n\t\t\t\treturn {\r\n\t\t\t\t\ttop: top,\r\n\t\t\t\t\tleft: left,\r\n\t\t\t\t\theight: height,\r\n\t\t\t\t\twidth: width\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\r\n\t\tfunction findVisibleIndex(grid, columnName) {\r\n\t\t\tvar columns = grid.getGridColumns();\r\n\t\t\tfor (var i = 0; i < columns.length; i++){\r\n\t\t\t\tif(columns[i].name == columnName){\r\n\t\t\t\t\treturn i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\tfunction _createPlaceholder(itemId, columnName) {\r\n\t\t\tvar config = grid.$getConfig();\r\n\t\t\tvar pos = _getEditorPosition(itemId, columnName);\r\n\t\t\tvar el = document.createElement(\"div\");\r\n\t\t\tel.className = \"gantt_grid_editor_placeholder\";\r\n\t\t\tel.setAttribute(grid.$config.item_attribute, itemId);\r\n\t\t\tel.setAttribute(grid.$config.bind + \"_id\", itemId);// for backward compatibility\r\n\r\n\t\t\tel.setAttribute(\"data-column-name\", columnName);\r\n\r\n\t\t\tvar visibleIndex = findVisibleIndex(grid, columnName);\r\n\t\t\tel.setAttribute(\"data-column-index\", visibleIndex);\r\n\r\n\t\t\tif (config.rtl) {\r\n\t\t\t\tel.style.cssText = [\r\n\t\t\t\t\t\"top:\" + pos.top + \"px\",\r\n\t\t\t\t\t\"right:\" + pos.right + \"px\",\r\n\t\t\t\t\t\"width:\" + pos.width + \"px\",\r\n\t\t\t\t\t\"height:\" + pos.height + \"px\"\r\n\t\t\t\t].join(\";\");\r\n\t\t\t} else {\r\n\t\t\t\tel.style.cssText = [\r\n\t\t\t\t\t\"top:\" + pos.top + \"px\",\r\n\t\t\t\t\t\"left:\" + pos.left + \"px\",\r\n\t\t\t\t\t\"width:\" + pos.width + \"px\",\r\n\t\t\t\t\t\"height:\" + pos.height + \"px\"\r\n\t\t\t\t].join(\";\");\r\n\t\t\t}\r\n\r\n\t\t\treturn el;\r\n\t\t}\r\n\r\n\t\tvar updateTaskDateProperties = linkedPropertiesProcessor(gantt);\r\n\r\n\t\tvar handlers = [];\r\n\t\tvar store = null;\r\n\t\tvar controller = {\r\n\t\t\t_itemId: null,\r\n\t\t\t_columnName: null,\r\n\t\t\t_editor: null,\r\n\t\t\t_editorType: null,\r\n\t\t\t_placeholder: null,\r\n\r\n\t\t\tlocateCell: _getGridCellFromNode,\r\n\t\t\tgetEditorConfig: function (columnName) {\r\n\t\t\t\tvar column = grid.getColumn(columnName);\r\n\t\t\t\treturn column.editor;\r\n\t\t\t},\r\n\r\n\t\t\tinit: function () {\r\n\t\t\t\tvar mapping = keyboardMapping.getMapping();\r\n\t\t\t\tif(mapping.init){\r\n\t\t\t\t\tmapping.init(this, grid);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstore = grid.$gantt.getDatastore(grid.$config.bind);\r\n\r\n\t\t\t\tvar self = this;\r\n\r\n\t\t\t\thandlers.push(store.attachEvent(\"onIdChange\", function(oldId, newId){\r\n\t\t\t\t\tif(self._itemId == oldId){\r\n\t\t\t\t\t\tself._itemId = newId;\r\n\t\t\t\t\t}\r\n\t\t\t\t}));\r\n\t\t\t\thandlers.push(store.attachEvent(\"onStoreUpdated\", function(){\r\n\t\t\t\t\tif(grid.$gantt.getState(\"batchUpdate\").batch_update){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(self.isVisible() && !store.isVisible(self._itemId)){\r\n\t\t\t\t\t\tself.hide();\r\n\t\t\t\t\t}\r\n\t\t\t\t}));\r\n\r\n\t\t\t\tthis.init = function(){};\r\n\t\t\t},\r\n\r\n\t\t\tgetState: function(){\r\n\t\t\t\treturn {\r\n\t\t\t\t\teditor: this._editor,\r\n\t\t\t\t\teditorType: this._editorType,\r\n\t\t\t\t\tplaceholder: this._placeholder,\r\n\t\t\t\t\tid: this._itemId,\r\n\t\t\t\t\tcolumnName: this._columnName\r\n\t\t\t\t};\r\n\t\t\t},\r\n\r\n\t\t\tstartEdit: function(itemId, columnName) {\r\n\t\t\t\tif (this.isVisible()) {\r\n\t\t\t\t\tthis.save();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(!store.exists(itemId)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar editorState = {id: itemId, columnName: columnName};\r\n\t\t\t\tif (gantt.isReadonly(store.getItem(itemId))) {\r\n\t\t\t\t\tthis.callEvent(\"onEditPrevent\", [editorState]);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this.callEvent(\"onBeforeEditStart\", [editorState]) === false) {\r\n\t\t\t\t\tthis.callEvent(\"onEditPrevent\", [editorState]);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.show(editorState.id, editorState.columnName);\r\n\t\t\t\tthis.setValue();\r\n\r\n\t\t\t\tthis.callEvent(\"onEditStart\", [editorState]);\r\n\t\t\t},\r\n\t\t\tisVisible: function(){\r\n\t\t\t\treturn !!(this._editor && domHelpers.isChildOf(this._placeholder, document.body));\r\n\t\t\t},\r\n\t\t\tshow: function (itemId, columnName) {\r\n\t\t\t\tif (this.isVisible()) {\r\n\t\t\t\t\tthis.save();\r\n\t\t\t\t}\r\n\t\t\t\tvar editorState = {id: itemId, columnName: columnName};\r\n\r\n\t\t\t\tvar column = grid.getColumn(editorState.columnName);\r\n\t\t\t\tvar editorConfig = this.getEditorConfig(column.name);\r\n\t\t\t\tif(!editorConfig)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tvar editor = grid.$getConfig().editor_types[editorConfig.type];\r\n\r\n\t\t\t\tvar placeholder = _createPlaceholder(editorState.id, editorState.columnName);\r\n\t\t\t\tgrid.$grid_data.appendChild(placeholder);\r\n\t\t\t\teditor.show(editorState.id, column, editorConfig, placeholder);\r\n\t\t\t\tthis._editor = editor;\r\n\t\t\t\tthis._placeholder = placeholder;\r\n\t\t\t\tthis._itemId = editorState.id;\r\n\t\t\t\tthis._columnName = editorState.columnName;\r\n\t\t\t\tthis._editorType = editorConfig.type;\r\n\r\n\t\t\t\tvar mapping = keyboardMapping.getMapping();\r\n\t\t\t\tif(mapping.onShow){\r\n\t\t\t\t\tmapping.onShow(this, placeholder, grid);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\tsetValue: function () {\r\n\t\t\t\tvar state = this.getState();\r\n\t\t\t\tvar itemId = state.id,\r\n\t\t\t\t\tcolumnName = state.columnName;\r\n\r\n\t\t\t\tvar column = grid.getColumn(columnName);\r\n\t\t\t\tvar item = store.getItem(itemId);\r\n\t\t\t\tvar editorConfig = this.getEditorConfig(columnName);\r\n\r\n\t\t\t\tif(!editorConfig)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tvar value = item[editorConfig.map_to];\r\n\t\t\t\tif(editorConfig.map_to == \"auto\"){\r\n\t\t\t\t\tvalue = store.getItem(itemId);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._editor.set_value(value, itemId, column, this._placeholder);\r\n\t\t\t\tthis.focus();\r\n\t\t\t},\r\n\r\n\t\t\tfocus: function(){\r\n\t\t\t\tthis._editor.focus(this._placeholder);\r\n\t\t\t},\r\n\r\n\t\t\tgetValue: function () {\r\n\t\t\t\tvar column = grid.getColumn(this._columnName);\r\n\t\t\t\treturn this._editor.get_value(this._itemId, column, this._placeholder);\r\n\t\t\t},\r\n\r\n\t\t\t_getItemValue: function() {\r\n\t\t\t\tvar editorConfig = this.getEditorConfig(this._columnName);\r\n\r\n\t\t\t\tif(!editorConfig)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tvar item = gantt.getTask(this._itemId);\r\n\t\t\t\tvar value = item[editorConfig.map_to];\r\n\t\t\t\tif(editorConfig.map_to == \"auto\"){\r\n\t\t\t\t\tvalue = store.getItem(this._itemId);\r\n\t\t\t\t}\r\n\t\t\t\treturn value;\r\n\t\t\t},\r\n\r\n\t\t\tisChanged: function(){\r\n\r\n\t\t\t\tvar column = grid.getColumn(this._columnName);\r\n\r\n\t\t\t\tvar value = this._getItemValue();\r\n\r\n\t\t\t\treturn this._editor.is_changed(value, this._itemId, column, this._placeholder);\r\n\t\t\t},\r\n\r\n\t\t\thide: function () {\r\n\t\t\t\tif(!this._itemId)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tvar itemId = this._itemId,\r\n\t\t\t\t\tcolumnName = this._columnName;\r\n\r\n\t\t\t\tvar mapping = keyboardMapping.getMapping();\r\n\t\t\t\tif(mapping.onHide){\r\n\t\t\t\t\tmapping.onHide(this, this._placeholder, grid);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._itemId = null;\r\n\t\t\t\tthis._columnName = null;\r\n\t\t\t\tthis._editorType = null;\r\n\t\t\t\tif (!this._placeholder) return;\r\n\r\n\t\t\t\tif (this._editor) {\r\n\t\t\t\t\tthis._editor.hide(this._placeholder);\r\n\t\t\t\t}\r\n\t\t\t\tthis._editor = null;\r\n\t\t\t\tif (this._placeholder.parentNode) {\r\n\t\t\t\t\tthis._placeholder.parentNode.removeChild(this._placeholder);\r\n\t\t\t\t}\r\n\t\t\t\tthis._placeholder = null;\r\n\r\n\t\t\t\tthis.callEvent(\"onEditEnd\", [{id: itemId, columnName: columnName}]);\r\n\t\t\t},\r\n\t\t\tsave: function () {\r\n\t\t\t\tif(!(this.isVisible() && store.exists(this._itemId) && this.isChanged())) {\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar itemId = this._itemId,\r\n\t\t\t\t\tcolumnName = this._columnName;\r\n\r\n\t\t\t\tif(!store.exists(itemId)) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar item = store.getItem(itemId);\r\n\t\t\t\tvar editorConfig = this.getEditorConfig(columnName);\r\n\t\t\t\tvar editorState = {\r\n\t\t\t\t\tid: itemId,\r\n\t\t\t\t\tcolumnName: columnName,\r\n\t\t\t\t\tnewValue: this.getValue(),\r\n\t\t\t\t\toldValue: this._getItemValue()\r\n\t\t\t\t};\r\n\t\t\t\tif (this.callEvent(\"onBeforeSave\", [editorState]) !== false) {\r\n\t\t\t\t\tif (this._editor.is_valid(editorState.newValue, editorState.id, editorState.columnName, this._placeholder)) {\r\n\r\n\t\t\t\t\t\tvar mapTo = editorConfig.map_to;\r\n\t\t\t\t\t\tvar value = editorState.newValue;\r\n\t\t\t\t\t\tif (mapTo != \"auto\") {\r\n\t\t\t\t\t\t\titem[mapTo] = value;\r\n\t\t\t\t\t\t\tupdateTaskDateProperties(item, mapTo, gantt.config.inline_editors_date_processing);\r\n\r\n\t\t\t\t\t\t\tstore.updateItem(itemId);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis._editor.save(itemId, grid.getColumn(columnName), this._placeholder);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.callEvent(\"onSave\", [editorState]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.hide();\r\n\t\t\t},\r\n\r\n\t\t\t_findEditableCell: function findEditableCell(start, direction){\r\n\t\t\t\tvar nextIndex = start;\r\n\t\t\t\tvar columns = grid.getGridColumns();\r\n\t\t\t\tvar nextColumn = columns[nextIndex];\r\n\r\n\t\t\t\tvar columnName = nextColumn ? nextColumn.name : null;\r\n\t\t\t\tif(columnName){\r\n\t\t\t\t\twhile(columnName && !this.getEditorConfig(columnName)){\r\n\t\t\t\t\t\tcolumnName = this._findEditableCell(start + direction, direction);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn columnName;\r\n\t\t\t\t}\r\n\t\t\t\treturn null;\r\n\t\t\t},\r\n\r\n\t\t\tgetNextCell: function moveCell(dir){\r\n\t\t\t\treturn this._findEditableCell(grid.getColumnIndex(this._columnName) + dir, dir);\r\n\t\t\t},\r\n\r\n\t\t\tgetFirstCell: function getFirstCell(){\r\n\t\t\t\treturn this._findEditableCell(0, 1);\r\n\t\t\t},\r\n\r\n\t\t\tgetLastCell: function getLastCell(){\r\n\t\t\t\treturn this._findEditableCell(grid.getGridColumns().length - 1, -1);\r\n\t\t\t},\r\n\r\n\t\t\teditNextCell: function nextCell(canChangeRow){\r\n\t\t\t\tvar cell = this.getNextCell(1);\r\n\t\t\t\tif(cell){\r\n\t\t\t\t\tvar nextColumn = this.getNextCell(1);\r\n\t\t\t\t\tif(nextColumn && this.getEditorConfig(nextColumn)){\r\n\t\t\t\t\t\tthis.startEdit(this._itemId, nextColumn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}else if(canChangeRow && this.moveRow(1)){\r\n\t\t\t\t\tvar task = this.moveRow(1);\r\n\t\t\t\t\tcell = this.getFirstCell();\r\n\t\t\t\t\tif(cell && this.getEditorConfig(cell)){\r\n\t\t\t\t\t\tthis.startEdit(task, cell);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\teditPrevCell: function prevCell(canChangeRow){\r\n\t\t\t\tvar cell = this.getNextCell(-1);\r\n\t\t\t\tif(cell){\r\n\t\t\t\t\tvar nextColumn = this.getNextCell(-1);\r\n\t\t\t\t\tif(nextColumn && this.getEditorConfig(nextColumn)){\r\n\t\t\t\t\t\tthis.startEdit(this._itemId, nextColumn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}else if(canChangeRow && this.moveRow(-1)){\r\n\t\t\t\t\tvar task = this.moveRow(-1);\r\n\t\t\t\t\tcell = this.getLastCell();\r\n\t\t\t\t\tif(cell && this.getEditorConfig(cell)){\r\n\t\t\t\t\t\tthis.startEdit(task, cell);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\tmoveRow: function moveRow(dir) {\r\n\t\t\t\tvar moveTask = dir > 0 ? gantt.getNext : gantt.getPrev;\r\n\t\t\t\tmoveTask = gantt.bind(moveTask, gantt);\r\n\r\n\t\t\t\tvar nextItem = moveTask(this._itemId);\r\n\t\t\t\t// skip readonly rows\r\n\t\t\t\twhile (gantt.isTaskExists(nextItem) && gantt.isReadonly(gantt.getTask(nextItem))) {\r\n\t\t\t\t\tnextItem = moveTask(nextItem);\r\n\t\t\t\t}\r\n\t\t\t\treturn nextItem;\r\n\t\t\t},\r\n\r\n\t\t\teditNextRow: function nextRow(){\r\n\t\t\t\tvar row = this.getNextCell(1);\r\n\t\t\t\tif(row){\r\n\t\t\t\t\tthis.startEdit(row, this._columnName);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\teditPrevRow: function prevRow(){\r\n\t\t\t\tvar row = this.getNextCell(-1);\r\n\t\t\t\tif(row){\r\n\t\t\t\t\tthis.startEdit(row, this._columnName);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tdestructor: function(){\r\n\t\t\t\thandlers.forEach(function(handlerId){\r\n\t\t\t\t\tstore.detachEvent(handlerId);\r\n\t\t\t\t});\r\n\t\t\t\tstore = null;\r\n\t\t\t\tthis.hide();\r\n\t\t\t\tthis.detachAllEvents();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tutils.mixin(controller, keyboardMapping);\r\n\t\tutils.mixin(controller, eventBus);\r\n\r\n\t\treturn controller;\r\n\t}\r\n\r\n\r\n\tvar inlineEditController = {\r\n\t\tinit: initConfigs,\r\n\t\tcreateEditors: createGridEditors\r\n\t};\r\n\r\n\tutils.mixin(inlineEditController, keyboardMapping);\r\n\tutils.mixin(inlineEditController, eventBus);\r\n\r\n\treturn inlineEditController;\r\n}\r\n\r\n\r\n\r\n\r\nmodule.exports = create;","var createStaticBgHelper = function(){\r\n\treturn {\r\n\t\trender: function () { },\r\n\t\tdestroy: function () { }\r\n\t};\r\n};\r\n\r\nmodule.exports = {\r\n\tcreate: function(){\r\n\t\treturn createStaticBgHelper();\r\n\t}\r\n};\r\n\r\n","var __extends = require(\"../../../utils/extends\"),\r\n\tdomHelpers = require(\"../utils/dom_helpers\"),\r\n\tutils = require(\"../../../utils/utils\"),\r\n\tenv = require(\"../../../utils/env\"),\r\n\tCell = require(\"./cell\");\r\n\r\nvar ScrollbarCell = (function (_super) {\r\n\t\"use strict\";\r\n\r\n\tvar SCROLL_MODIFIER_KEYS = [\"altKey\", \"shiftKey\", \"metaKey\"]; // it's no way to disable ctrl+wheel\r\n\t__extends(ScrollbarCell, _super);\r\n\tfunction ScrollbarCell(parent, config, factory, gantt) {\r\n\r\n\t\tvar _this = _super.apply(this, arguments) || this;\r\n\t\tthis.$config = utils.mixin(config, {scroll: \"x\"});\r\n\t\t_this._scrollHorizontalHandler = utils.bind(_this._scrollHorizontalHandler, _this);\r\n\t\t_this._scrollVerticalHandler = utils.bind(_this._scrollVerticalHandler, _this);\r\n\t\t_this._outerScrollVerticalHandler = utils.bind(_this._outerScrollVerticalHandler, _this);\r\n\t\t_this._outerScrollHorizontalHandler = utils.bind(_this._outerScrollHorizontalHandler, _this);\r\n\t\t_this._mouseWheelHandler = utils.bind(_this._mouseWheelHandler, _this);\r\n\r\n\t\tthis.$config.hidden = true;\r\n\t\tvar size = gantt.config.scroll_size;\r\n\r\n\t\tif(gantt.env.isIE){\r\n\t\t\t// full element height/width must be bigger than just a browser scrollbar,\r\n\t\t\t// otherwise the scrollbar element won't be scrolled on click\r\n\t\t\tsize += 1;\r\n\t\t}\r\n\r\n\t\tif(this._isHorizontal()){\r\n\t\t\t_this.$config.height = size;\r\n\t\t\t_this.$parent.$config.height = size;\r\n\t\t}else{\r\n\t\t\t_this.$config.width = size;\r\n\t\t\t_this.$parent.$config.width = size;\r\n\t\t}\r\n\r\n\t\tthis.$config.scrollPosition = 0;\r\n\r\n\t\t_this.$name = \"scroller\";\r\n\t\treturn _this;\r\n\t}\r\n\r\n\tScrollbarCell.prototype.init = function(container){\r\n\t\tcontainer.innerHTML = this.$toHTML();\r\n\t\tthis.$view = container.firstChild;\r\n\r\n\t\tif(!this.$view){\r\n\t\t\tthis.init();\r\n\t\t}\r\n\t\tif(this._isVertical()){\r\n\t\t\tthis._initVertical();\r\n\t\t}else{\r\n\t\t\tthis._initHorizontal();\r\n\t\t}\r\n\t\tthis._initMouseWheel();\r\n\t\tthis._initLinkedViews();\r\n\t};\r\n\r\n\tScrollbarCell.prototype.$toHTML = function () {\r\n\t\tvar className = this._isHorizontal() ? \"gantt_hor_scroll\" : \"gantt_ver_scroll\";\r\n\t\treturn \"
\";\r\n\t};\r\n\r\n\tScrollbarCell.prototype._getRootParent = function(){\r\n\t\tvar parent = this.$parent;\r\n\t\twhile(parent && parent.$parent){\r\n\t\t\tparent = parent.$parent;\r\n\t\t}\r\n\t\tif(parent){\r\n\t\t\treturn parent;\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tfunction eachCell(root, res){\r\n\t\tres.push(root);\r\n\t\tif(root.$cells){\r\n\t\t\tfor(var i = 0; i < root.$cells.length; i++){\r\n\t\t\t\teachCell(root.$cells[i], res);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tScrollbarCell.prototype._eachView = function(){\r\n\t\tvar res = [];\r\n\t\teachCell(this._getRootParent(), res);\r\n\t\treturn res;\r\n\t};\r\n\r\n\tScrollbarCell.prototype._getLinkedViews = function(){\r\n\t\tvar views = this._eachView();\r\n\t\tvar res = [];\r\n\t\tfor(var i = 0; i < views.length; i++){\r\n\t\t\tif(views[i].$config && ((this._isVertical() && views[i].$config.scrollY == this.$id) || (this._isHorizontal() && views[i].$config.scrollX == this.$id)) ){\r\n\t\t\t\tres.push(views[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res;\r\n\t};\r\n\r\n\r\n\tScrollbarCell.prototype._initHorizontal = function(){\r\n\t\tthis.$scroll_hor = this.$view;\r\n\t\tthis.$domEvents.attach(this.$view, \"scroll\", this._scrollHorizontalHandler);\r\n\r\n\t};\r\n\r\n\tScrollbarCell.prototype._initLinkedViews = function(){\r\n\t\tvar views = this._getLinkedViews();\r\n\t\tvar css = this._isVertical() ?\"gantt_layout_outer_scroll gantt_layout_outer_scroll_vertical\" : \"gantt_layout_outer_scroll gantt_layout_outer_scroll_horizontal\";\r\n\t\tfor(var i = 0; i < views.length; i++){\r\n\t\t\t//views[i].$config.css = [views[i].$config.css || \"\", css].join(\" \");\r\n\t\t\tdomHelpers.addClassName(views[i].$view || views[i].getNode(), css);\r\n\t\t}\r\n\t};\r\n\r\n\tScrollbarCell.prototype._initVertical = function(){\r\n\t\tthis.$scroll_ver = this.$view;\r\n\t\tthis.$domEvents.attach(this.$view, \"scroll\", this._scrollVerticalHandler);\r\n\t};\r\n\r\n\tScrollbarCell.prototype._updateLinkedViews = function(){\r\n\t};\r\n\r\n\tScrollbarCell.prototype._initMouseWheel = function(){\r\n\t\tvar ff = env.isFF;\r\n\t\tif (ff)\r\n\t\t\tthis.$domEvents.attach(this._getRootParent().$view, \"wheel\", this._mouseWheelHandler);\r\n\t\telse\r\n\t\t\tthis.$domEvents.attach(this._getRootParent().$view, \"mousewheel\", this._mouseWheelHandler);\r\n\t};\r\n\r\n\r\n\r\n\r\n\tScrollbarCell.prototype.scrollHorizontally = function(left){\r\n\t\tif(this._scrolling) return;\r\n\t\tthis._scrolling = true;\r\n\r\n\t\tthis.$scroll_hor.scrollLeft = left;\r\n\t\tthis.$config.codeScrollLeft = left;\r\n\t\tleft = this.$scroll_hor.scrollLeft;\r\n\r\n\t\tvar views = this._getLinkedViews();\r\n\t\tfor(var i = 0; i < views.length; i++){\r\n\t\t\tif(views[i].scrollTo){\r\n\t\t\t\tviews[i].scrollTo(left, undefined);\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar oldSize = this.$config.scrollPosition;\r\n\t\tthis.$config.scrollPosition = left;\r\n\t\tthis.callEvent(\"onScroll\", [oldSize, left, this.$config.scroll]);\r\n\t\tthis._scrolling = false;\r\n\t};\r\n\tScrollbarCell.prototype.scrollVertically = function(top){\r\n\t\tif(this._scrolling) return;\r\n\t\tthis._scrolling = true;\r\n\r\n\t\tthis.$scroll_ver.scrollTop = top;\r\n\t\ttop = this.$scroll_ver.scrollTop;\r\n\r\n\t\tvar views = this._getLinkedViews();\r\n\r\n\t\tfor(var i = 0; i < views.length; i++){\r\n\t\t\tif(views[i].scrollTo){\r\n\t\t\t\tviews[i].scrollTo(undefined, top);\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar oldSize = this.$config.scrollPosition;\r\n\t\tthis.$config.scrollPosition = top;\r\n\t\tthis.callEvent(\"onScroll\", [oldSize, top, this.$config.scroll]);\r\n\t\tthis._scrolling = false;\r\n\t};\r\n\r\n\tScrollbarCell.prototype._isVertical = function(){\r\n\t\treturn this.$config.scroll == \"y\";\r\n\t};\r\n\tScrollbarCell.prototype._isHorizontal = function(){\r\n\t\treturn this.$config.scroll == \"x\";\r\n\t};\r\n\tScrollbarCell.prototype._scrollHorizontalHandler = function (e) {\r\n\t\tif(this._isVertical() || this._scrolling){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//in safari we can catch previous onscroll after setting new value from mouse-wheel event\r\n\t\t//set delay to prevent value drifiting\r\n\t\tif ((new Date()) - ( this._wheel_time || 0 ) < 100) return true;\r\n\t\tif (this.$gantt._touch_scroll_active) return;\r\n\t\tvar left = this.$scroll_hor.scrollLeft;\r\n\r\n\t\tthis.scrollHorizontally(left);\r\n\r\n\t\tthis._oldLeft = this.$scroll_hor.scrollLeft;\r\n\t};\r\n\tScrollbarCell.prototype._outerScrollHorizontalHandler = function(e){\r\n\t\tif(this._isVertical()){\r\n\t\t\treturn;\r\n\t\t}\r\n\t};\r\n\r\n\tScrollbarCell.prototype.show = function(){\r\n\t\tthis.$parent.show();\r\n\t};\r\n\tScrollbarCell.prototype.hide = function(){\r\n\t\tthis.$parent.hide();\r\n\t};\r\n\r\n\tScrollbarCell.prototype._getScrollSize = function(){\r\n\t\tvar scrollSize = 0;\r\n\t\tvar outerSize = 0;\r\n\t\tvar isHorizontal = this._isHorizontal();\r\n\r\n\t\tvar linked = this._getLinkedViews();\r\n\t\tvar view;\r\n\t\tvar scrollProperty = isHorizontal ? \"scrollWidth\" : \"scrollHeight\",\r\n\t\t\tinnerSizeProperty = isHorizontal ? \"contentX\" : \"contentY\";\r\n\t\tvar outerProperty = isHorizontal ? \"x\" : \"y\";\r\n\t\tvar offset = this._getScrollOffset();\r\n\r\n\t\tfor(var i = 0; i < linked.length; i++){\r\n\t\t\tview = linked[i];\r\n\t\t\tif(!(view && view.$content && view.$content.getSize && !view.$config.hidden)) continue;\r\n\r\n\t\t\tvar sizes = view.$content.getSize();\r\n\t\t\tvar cellScrollSize;\r\n\t\t\tif(sizes.hasOwnProperty(scrollProperty)){\r\n\t\t\t\tcellScrollSize = sizes[scrollProperty];\r\n\t\t\t}else{\r\n\t\t\t\tcellScrollSize = sizes[innerSizeProperty];\r\n\t\t\t}\r\n\r\n\t\t\tif(offset){\r\n\t\t\t\t// precalculated vertical/horizontal offsets of scrollbar to emulate 4.x look\r\n\t\t\t\tif(sizes[innerSizeProperty] > sizes[outerProperty] && sizes[innerSizeProperty] > scrollSize && (cellScrollSize > (sizes[outerProperty] - offset + 2))){\r\n\t\t\t\t\tscrollSize = cellScrollSize + (isHorizontal ? 0 : 2);\r\n\t\t\t\t\touterSize = sizes[outerProperty];\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tvar nonScrollableSize = Math.max(sizes[innerSizeProperty] - cellScrollSize, 0);\r\n\t\t\t\tvar scrollableViewPortSize = Math.max(sizes[outerProperty] - nonScrollableSize, 0);\r\n\t\t\t\tcellScrollSize = cellScrollSize + nonScrollableSize;\r\n\r\n\t\t\t\tif(cellScrollSize > scrollableViewPortSize && (cellScrollSize > scrollSize) ){\r\n\t\t\t\t\t//|| (cellScrollSize === scrollSize && sizes[outerProperty] < outerSize) // same scroll width but smaller scrollable view port\r\n\r\n\t\t\t\t\tscrollSize = cellScrollSize;\r\n\t\t\t\t\touterSize = sizes[outerProperty];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\touterScroll: outerSize,\r\n\t\t\tinnerScroll: scrollSize\r\n\t\t};\r\n\t};\r\n\r\n\tScrollbarCell.prototype.scroll = function(position){\r\n\t\tif(this._isHorizontal()){\r\n\t\t\tthis.scrollHorizontally(position);\r\n\t\t}else{\r\n\t\t\tthis.scrollVertically(position);\r\n\t\t}\r\n\t};\r\n\r\n\tScrollbarCell.prototype.getScrollState = function(){\r\n\t\treturn {\r\n\t\t\tvisible: this.isVisible(),\r\n\t\t\tdirection: this.$config.scroll,\r\n\t\t\tsize: this.$config.outerSize,\r\n\t\t\tscrollSize: this.$config.scrollSize || 0,\r\n\t\t\tposition: this.$config.scrollPosition || 0\r\n\t\t};\r\n\t};\r\n\r\n\tScrollbarCell.prototype.setSize = function(width, height){\r\n\t\t_super.prototype.setSize.apply(this, arguments);\r\n\r\n\t\tvar scrollSizes = this._getScrollSize();\r\n\r\n\t\tvar ownSize = (this._isVertical() ? height : width) - this._getScrollOffset() + (this._isHorizontal() ? 1 : 0);\r\n\r\n\t\tif(scrollSizes.innerScroll && ownSize > scrollSizes.outerScroll){\r\n\t\t\tscrollSizes.innerScroll += (ownSize - scrollSizes.outerScroll);\r\n\t\t}\r\n\t\tthis.$config.scrollSize = scrollSizes.innerScroll;\r\n\r\n\t\tthis.$config.width = width;\r\n\t\tthis.$config.height = height;\r\n\t\tthis._setScrollSize(scrollSizes.innerScroll);\r\n\t};\r\n\r\n\tScrollbarCell.prototype.isVisible = function(){\r\n\t\treturn !!(this.$parent && this.$parent.$view.parentNode);\r\n\t};\r\n\r\n\tScrollbarCell.prototype.shouldShow = function(){\r\n\t\tvar scrollSizes = this._getScrollSize();\r\n\t\tif(!scrollSizes.innerScroll && (this.$parent && this.$parent.$view.parentNode)){\r\n\t\t\treturn false;\r\n\t\t}else if(scrollSizes.innerScroll && !(this.$parent && this.$parent.$view.parentNode)){\r\n\t\t\treturn true;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t};\r\n\r\n\tScrollbarCell.prototype.shouldHide = function(){\r\n\t\tvar scrollSizes = this._getScrollSize();\r\n\t\tif(!scrollSizes.innerScroll && (this.$parent && this.$parent.$view.parentNode)){\r\n\t\t\treturn true;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tScrollbarCell.prototype.toggleVisibility = function(){\r\n\t\tif(this.shouldHide()){\r\n\t\t\tthis.hide();\r\n\t\t}else if(this.shouldShow()){\r\n\t\t\tthis.show();\r\n\t\t}\r\n\t};\r\n\t\r\n\tScrollbarCell.prototype._getScaleOffset = function(view){\r\n\t\tvar offset = 0;\r\n\t\tif(view && (view.$config.view == \"timeline\" || view.$config.view == \"grid\")){\r\n\t\t\toffset = view.$content.$getConfig().scale_height;\r\n\t\t}\r\n\t\treturn offset;\r\n\t};\r\n\r\n\tScrollbarCell.prototype._getScrollOffset = function(){\r\n\t\tvar offset = 0;\r\n\t\tif(this._isVertical()){\r\n\t\t\tvar parentLayout = this.$parent.$parent;\r\n\t\t\toffset = Math.max(\r\n\t\t\t\tthis._getScaleOffset(parentLayout.getPrevSibling(this.$parent.$id)),\r\n\t\t\t\tthis._getScaleOffset(parentLayout.getNextSibling(this.$parent.$id))\r\n\t\t\t\t);\r\n\t\t}else{\r\n\t\t\tvar linked = this._getLinkedViews();\r\n\r\n\t\t\tfor (var i = 0; i < linked.length; i++) {\r\n\t\t\t\tvar view = linked[i],\r\n\t\t\t\t\tvparent = view.$parent;\r\n\t\t\t\tvar cells = vparent.$cells;\r\n\r\n\t\t\t\tvar last = cells[cells.length - 1];\r\n\r\n\t\t\t\tif (last && last.$config.view == \"scrollbar\" && last.$config.hidden === false) {\r\n\t\t\t\t\toffset = last.$config.width;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn offset || 0;\r\n\t};\r\n\r\n\tScrollbarCell.prototype._setScrollSize = function(size){\r\n\t\tvar property = this._isHorizontal() ? \"width\" : \"height\";\r\n\t\tvar scrollbar = this._isHorizontal() ? this.$scroll_hor : this.$scroll_ver;\r\n\r\n\t\tvar offset = this._getScrollOffset();\r\n\r\n\t\tvar node = scrollbar.firstChild;\r\n\r\n\t\tif(offset){\r\n\t\t\tif(this._isVertical()){\r\n\r\n\t\t\t\tthis.$config.outerSize = (this.$config.height - offset + 3);\r\n\t\t\t\tscrollbar.style.height = this.$config.outerSize + \"px\";\r\n\t\t\t\tscrollbar.style.top = (offset-1) + \"px\";\r\n\t\t\t\tdomHelpers.addClassName(scrollbar, this.$parent._borders.top);\r\n\t\t\t\tdomHelpers.addClassName(scrollbar.parentNode, \"gantt_task_vscroll\");\r\n\t\t\t}else{\r\n\t\t\t\tthis.$config.outerSize = (this.$config.width - offset + 1);\r\n\t\t\t\tscrollbar.style.width = this.$config.outerSize + \"px\";\r\n\t\t\t\t//domHelpers.addClassName(scrollbar, this.$parent._borders.right);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tscrollbar.style.top = \"auto\";\r\n\t\t\tdomHelpers.removeClassName(scrollbar, this.$parent._borders.top);\r\n\t\t\tdomHelpers.removeClassName(scrollbar.parentNode, \"gantt_task_vscroll\");\r\n\t\t\tthis.$config.outerSize = this.$config.height;\r\n\t\t}\r\n\r\n\t\tnode.style[property] = size + \"px\";\r\n\t};\r\n\r\n\tScrollbarCell.prototype._scrollVerticalHandler = function (e) {\r\n\t\tif(this._scrollHorizontalHandler() || this._scrolling){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (this.$gantt._touch_scroll_active) return;\r\n\t\tvar top = this.$scroll_ver.scrollTop;\r\n\t\tvar prev = this._oldTop;\r\n\t\tif(top == prev) return;\r\n\r\n\t\tthis.scrollVertically(top);\r\n\r\n\t\tthis._oldTop = this.$scroll_ver.scrollTop;\r\n\r\n\t};\r\n\tScrollbarCell.prototype._outerScrollVerticalHandler = function(e){\r\n\t\tif(this._scrollHorizontalHandler()){\r\n\t\t\treturn;\r\n\t\t}\r\n\t};\r\n\r\n\tScrollbarCell.prototype._checkWheelTarget = function(targetNode){\r\n\t\tvar connectedViews = this._getLinkedViews().concat(this);\r\n\r\n\t\tfor(var i = 0; i < connectedViews.length; i++){\r\n\t\t\tvar node = connectedViews[i].$view;\r\n\t\t\tif(domHelpers.isChildOf(targetNode, node)){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t};\r\n\r\n\tScrollbarCell.prototype._mouseWheelHandler = function(e){\r\n\t\tvar target = e.target || e.srcElement;\r\n\r\n\t\tif(!this._checkWheelTarget(target))\r\n\t\t\treturn;\r\n\r\n\t\tthis._wheel_time = new Date();\r\n\r\n\t\tvar res = {};\r\n\t\tvar ff = env.isFF;\r\n\t\tvar wx = ff ? (e.deltaX*-20) : e.wheelDeltaX*2;\r\n\t\tvar wy = ff ? (e.deltaY*-40) : e.wheelDelta;\r\n\r\n\t\tvar horizontalScrollModifier = this.$gantt.config.horizontal_scroll_key;\r\n\r\n\t\tif (horizontalScrollModifier !== false) {\r\n\t\t\tif (SCROLL_MODIFIER_KEYS.indexOf(horizontalScrollModifier) >= 0) {\r\n\t\t\t\tif(e[horizontalScrollModifier] && !(e.deltaX || e.wheelDeltaX)){\r\n\t\t\t\t\t// shift+mousewheel for horizontal scroll\r\n\t\t\t\t\twx = wy*2;\r\n\t\t\t\t\twy = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tif (wx && Math.abs(wx) > Math.abs(wy)){\r\n\t\t\tif(this._isVertical()){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif(res.x) return true;//no horisontal scroll, must not block scrolling\r\n\t\t\tif(!this.$scroll_hor || !this.$scroll_hor.offsetWidth) return true;\r\n\r\n\t\t\tvar dir = wx/-40;\r\n\t\t\tvar oldLeft = this._oldLeft;\r\n\t\t\tvar left = oldLeft+dir*30;\r\n\t\t\tthis.scrollHorizontally(left);\r\n\t\t\tthis.$scroll_hor.scrollLeft = left;\r\n\t\t\t// not block scroll if position hasn't changed\r\n\t\t\tif(oldLeft == this.$scroll_hor.scrollLeft){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\tthis._oldLeft = this.$scroll_hor.scrollLeft;\r\n\t\t} else {\r\n\t\t\tif(this._isHorizontal()){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif(res.y) return true;//no vertical scroll, must not block scrolling\r\n\t\t\tif(!this.$scroll_ver || !this.$scroll_ver.offsetHeight) return true;\r\n\r\n\t\t\tvar dir = wy/-40;\r\n\t\t\tif (typeof wy == \"undefined\")\r\n\t\t\t\tdir = e.detail;\r\n\r\n\t\t\tvar oldTop = this._oldTop;\r\n\t\t\tvar top = this.$scroll_ver.scrollTop+dir*30;\r\n\r\n\t\t\t//if(!this.$gantt.config.prevent_default_scroll &&\r\n\t\t\t//\t(this.$gantt._cached_scroll_pos && ((this.$gantt._cached_scroll_pos.y == top) || (this.$gantt._cached_scroll_pos.y <= 0 && top <= 0)))) return true;\r\n\r\n\r\n\t\t\tthis.scrollVertically(top);\r\n\t\t\tthis.$scroll_ver.scrollTop = top;\r\n\r\n\t\t\t// not block scroll if position hasn't changed\r\n\t\t\tif(oldTop == this.$scroll_ver.scrollTop){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tthis._oldTop = this.$scroll_ver.scrollTop;\r\n\t\t}\r\n\r\n\t\tif (e.preventDefault)\r\n\t\t\te.preventDefault();\r\n\t\te.cancelBubble=true;\r\n\t\treturn false;\r\n\t};\r\n\r\n\treturn ScrollbarCell;\r\n})(Cell);\r\n\r\nmodule.exports = ScrollbarCell;","module.exports = null;","var __extends = require(\"../../../utils/extends\"),\r\n\tutils = require(\"../../../utils/utils\"),\r\n\tCell = require(\"./cell\");\r\n\r\nvar ViewCell = (function (_super) {\r\n\t\"use strict\";\r\n\r\n\t__extends(ViewCell, _super);\r\n\tfunction ViewCell(parent, config, factory) {\r\n\r\n\t\tvar _this = _super.apply(this, arguments) || this;\r\n\r\n\t\tif(config.view){\r\n\t\t\tif(config.id){\r\n\t\t\t\t// pass id to the nested view\r\n\t\t\t\tthis.$id = utils.uid();\r\n\t\t\t}\r\n\t\t\tvar childConfig = utils.copy(config);\r\n\t\t\tdelete childConfig.config;\r\n\t\t\tdelete childConfig.templates;\r\n\r\n\t\t\tthis.$content = this.$factory.createView(config.view, this, childConfig, this);\r\n\t\t\tif(!this.$content)\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t_this.$name = \"viewCell\";\r\n\t\treturn _this;\r\n\t}\r\n\r\n\tViewCell.prototype.destructor = function(){\r\n\t\tthis.clear();\r\n\t\t_super.prototype.destructor.call(this);\r\n\t};\r\n\r\n\tViewCell.prototype.clear = function(){\r\n\r\n\t\tthis.$initialized = false;\r\n\r\n\t\t// call destructor\r\n\t\tif (this.$content){\r\n\t\t\tvar method = this.$content.unload || this.$content.destructor;\r\n\t\t\tif (method){\r\n\t\t\t\tmethod.call(this.$content);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t_super.prototype.clear.call(this);\r\n\r\n\t};\r\n\r\n\tViewCell.prototype.scrollTo = function(left, top){\r\n\r\n\t\tif(this.$content && this.$content.scrollTo){\r\n\t\t\tthis.$content.scrollTo(left, top);\r\n\t\t}else{\r\n\t\t\t_super.prototype.scrollTo.call(this, left, top);\r\n\t\t}\r\n\t};\r\n\r\n\tViewCell.prototype._setContentSize = function(x, y){\r\n\t\tvar borders = this._getBorderSizes();\r\n\t\tif(typeof x === \"number\"){\r\n\t\t\tvar outerX = x + borders.horizontal;\r\n\t\t\tthis.$config.width = outerX;\r\n\t\t}\r\n\t\tif(typeof y === \"number\"){\r\n\t\t\tvar outerY = y + borders.vertical;\r\n\t\t\tthis.$config.height = outerY;\r\n\t\t}\r\n\t};\r\n\r\n\tViewCell.prototype.setSize = function(x, y){\r\n\t\t_super.prototype.setSize.call(this, x, y);\r\n\r\n\t\tif(!this.$preResize && this.$content) {\r\n\t\t\tif (!this.$initialized) {\r\n\t\t\t\tthis.$initialized = true;\r\n\t\t\t\tvar header = this.$view.childNodes[0];\r\n\t\t\t\tvar content = this.$view.childNodes[1];\r\n\t\t\t\tif(!content) content = header;\r\n\r\n\t\t\t\t/*if(this.$content.$config){\r\n\t\t\t\t\tthis.$content.$config.width = this.$lastSize.contentX;\r\n\t\t\t\t\tthis.$content.$config.height = this.$lastSize.contentY;\r\n\t\t\t\t}*/\r\n\t\t\t\tthis.$content.init(content);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tViewCell.prototype.setContentSize = function(){\r\n\t\tif(!this.$preResize && this.$content) {\r\n\t\t\tif (this.$initialized) {\r\n\t\t\t\tthis.$content.setSize(this.$lastSize.contentX, this.$lastSize.contentY);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tViewCell.prototype.getContentSize = function(){\r\n\t\tvar size = _super.prototype.getContentSize.call(this);\r\n\r\n\t\tif(this.$content && this.$initialized){\r\n\t\t\tvar childSize = this.$content.getSize();\r\n\t\t\tsize.width = childSize.contentX === undefined ? childSize.width : childSize.contentX;\r\n\t\t\tsize.height = childSize.contentY === undefined ? childSize.height : childSize.contentY;\r\n\t\t}\r\n\r\n\t\tvar borders = this._getBorderSizes();\r\n\t\tsize.width += borders.horizontal;\r\n\t\tsize.height += borders.vertical;\r\n\r\n\t\treturn size;\r\n\t};\r\n\r\n\treturn ViewCell;\r\n}(Cell));\r\n\r\nmodule.exports = ViewCell;","var __extends = require(\"../../../utils/extends\"),\r\n\tLayout = require(\"./layout\"),\r\n\tCell = require(\"./cell\");\r\n\r\nvar ViewLayout = (function (_super) {\r\n\t\"use strict\";\r\n\r\n\t__extends(ViewLayout, _super);\r\n\tfunction ViewLayout(parent, config, factory) {\r\n\t\tvar _this = _super.apply(this, arguments) || this;\r\n\t\tfor (var i = 0; i < _this.$cells.length; i++) {\r\n\t\t\t_this.$cells[i].$config.hidden = (i !== 0);\r\n\t\t}\r\n\t\t_this.$cell = _this.$cells[0];\r\n\t\t_this.$name = \"viewLayout\";\r\n\r\n\t\treturn _this;\r\n\t}\r\n\tViewLayout.prototype.cell = function (id) {\r\n\t\tvar cell = _super.prototype.cell.call(this, id);\r\n\t\tif (!cell.$view) {\r\n\t\t\tthis.$fill(null, this);\r\n\t\t}\r\n\t\treturn cell;\r\n\t};\r\n\tViewLayout.prototype.moveView = function (view) {\r\n\t\tvar body = this.$view;\r\n\t\tif (this.$cell) {\r\n\t\t\tthis.$cell.$config.hidden = true;\r\n\t\t\tbody.removeChild(this.$cell.$view);\r\n\t\t}\r\n\t\tthis.$cell = view;\r\n\t\tbody.appendChild(view.$view);\r\n\t};\r\n\tViewLayout.prototype.setSize = function (x, y) {\r\n\t\tCell.prototype.setSize.call(this, x, y);\r\n\t};\r\n\r\n\tViewLayout.prototype.setContentSize = function(){\r\n\t\tvar size = this.$lastSize;\r\n\t\tthis.$cell.setSize(size.contentX, size.contentY);\r\n\t};\r\n\r\n\tViewLayout.prototype.getSize = function () {\r\n\t\tvar sizes = _super.prototype.getSize.call(this);\r\n\t\tif (this.$cell) {\r\n\t\t\tvar cellSize = this.$cell.getSize();\r\n\t\t\tif (this.$config.byMaxSize) {\r\n\t\t\t\tfor (var i = 0; i < this.$cells.length; i++) {\r\n\t\t\t\t\tvar otherCell = this.$cells[i].getSize();\r\n\t\t\t\t\tfor (var cell in cellSize) {\r\n\t\t\t\t\t\tcellSize[cell] = Math.max(cellSize[cell], otherCell[cell]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (var size in sizes) {\r\n\t\t\t\tsizes[size] = sizes[size] || cellSize[size];\r\n\t\t\t}\r\n\t\t\tsizes.gravity = Math.max(sizes.gravity, cellSize.gravity);\r\n\t\t}\r\n\t\treturn sizes;\r\n\t};\r\n\treturn ViewLayout;\r\n}(Layout));\r\n\r\nmodule.exports = ViewLayout;","module.exports = function(viewport, box){\r\n\tif(!box){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(box.left > viewport.x_end || box.left + box.width < viewport.x){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(box.top > viewport.y_end || box.top + box.height < viewport.y){\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n};","var genericViewPortChecker = require(\"./viewport/is_in_viewport\");\r\nvar isLegacyRender = require(\"./is_legacy_smart_render\");\r\nvar basicGetRectangle = require(\"./viewport/get_grid_row_rectangle\");\r\nvar rendererFactory = function(gantt){\r\n\r\n\t//hash of dom elements is needed to redraw single bar/link\r\n\tvar task_area_pulls = {},\r\n\t\ttask_area_renderers = {};\r\n\r\n\tfunction getView(layer){\r\n\t\tvar view = null;\r\n\t\tif (typeof layer.view === \"string\") {\r\n\t\t\tview = gantt.$ui.getView(layer.view);\r\n\t\t} else if (layer.view) {\r\n\t\t\tview = layer.view;\r\n\t\t}\r\n\t\treturn view;\r\n\t}\r\n\r\n\tfunction getRenderer(id, layer, node) {\r\n\r\n\t\tif (task_area_renderers[id])\r\n\t\t\treturn task_area_renderers[id];\r\n\r\n\t\tif (!layer.renderer)\r\n\t\t\tgantt.assert(false, \"Invalid renderer call\");\r\n\r\n\t\tvar renderMethod = null;\r\n\t\tvar updateMethod = null;\r\n\t\tvar getRectangle = null;\r\n\t\tvar specializedViewPortChecker = null;\r\n\r\n\t\tif(typeof layer.renderer === \"function\"){\r\n\t\t\trenderMethod = layer.renderer;\r\n\t\t\tgetRectangle = basicGetRectangle;\r\n\t\t}else{\r\n\t\t\trenderMethod = layer.renderer.render;\r\n\t\t\tupdateMethod = layer.renderer.update;\r\n\t\t\t\r\n\t\t\tif(layer.renderer.isInViewPort){\r\n\t\t\t\tspecializedViewPortChecker = layer.renderer.isInViewPort;\r\n\t\t\t}else{\r\n\t\t\t\tgetRectangle = layer.renderer.getRectangle;\r\n\t\t\t}\r\n\r\n\t\t\tif (!getRectangle && getRectangle !== null) {\r\n\t\t\t\tgetRectangle = basicGetRectangle;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar filter = layer.filter;\r\n\r\n\t\tif (node)\r\n\t\t\tnode.setAttribute(gantt.config.layer_attribute, true);\r\n\r\n\t\ttask_area_renderers[id] = {\r\n\t\t\trender_item: function (item, container, viewPort) {\r\n\t\t\t\tcontainer = container || node;\r\n\r\n\t\t\t\tif (filter) {\r\n\t\t\t\t\tif (!filter(item)) {\r\n\t\t\t\t\t\tthis.remove_item(item.id);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar view = getView(layer);\r\n\t\t\t\tvar rendererViewPort = viewPort;\r\n\t\t\t\tif(!rendererViewPort && view && view.$getConfig().smart_rendering){\r\n\t\t\t\t\trendererViewPort = view.getViewPort();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar dom = null;\r\n\t\t\t\tif(!isLegacyRender(gantt) && (getRectangle || specializedViewPortChecker) && rendererViewPort){\r\n\t\t\t\t\tvar isVisible = false;\r\n\t\t\t\t\tif(specializedViewPortChecker){\r\n\t\t\t\t\t\tisVisible = specializedViewPortChecker(item, rendererViewPort, view, gantt);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tisVisible = genericViewPortChecker(rendererViewPort, getRectangle(item, view, gantt));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(isVisible){\r\n\t\t\t\t\t\tdom = renderMethod.call(gantt, item, view, rendererViewPort);\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdom = renderMethod.call(gantt, item, view, rendererViewPort);\r\n\t\t\t\t}\r\n\t\t\t\tthis.append(item, dom, container);\r\n\t\t\t},\r\n\r\n\t\t\tclear: function (container) {\r\n\r\n\t\t\t\tthis.rendered = task_area_pulls[id] = {};\r\n\t\t\t\tif(!layer.append)\r\n\t\t\t\t\tthis.clear_container(container);\r\n\t\t\t},\r\n\t\t\tclear_container: function (container) {\r\n\t\t\t\tcontainer = container || node;\r\n\t\t\t\tif (container)\r\n\t\t\t\t\tcontainer.innerHTML = \"\";\r\n\t\t\t},\r\n\t\t\tget_visible_range: function(datastore){\r\n\t\t\t\tvar view = getView(layer);\r\n\t\t\t\tvar viewport;\r\n\t\t\t\tif(view && view.$getConfig().smart_rendering){\r\n\t\t\t\t\tviewport = view.getViewPort();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(!(view && viewport && layer.renderer && layer.renderer.getVisibleRange)){\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tstart: 0,\r\n\t\t\t\t\t\tend: datastore.count()\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\treturn layer.renderer.getVisibleRange(gantt, view, datastore, viewport);\r\n\t\t\t},\r\n\t\t\trender_items: function (items, container) {\r\n\t\t\t\tcontainer = container || node;\r\n\r\n\t\t\t\tvar buffer = document.createDocumentFragment();\r\n\t\t\t\tthis.clear(container);\r\n\r\n\t\t\t\tvar viewPort = null;\r\n\t\t\t\tvar view = getView(layer);\r\n\t\t\t\tif(view && view.$getConfig().smart_rendering){\r\n\t\t\t\t\tviewPort = view.getViewPort();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (var i = 0, vis = items.length; i < vis; i++) {\r\n\t\t\t\t\tthis.render_item(items[i], buffer, viewPort);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcontainer.appendChild(buffer, container);\r\n\t\t\t},\r\n\t\t\tupdate_items: function (items, container) {\r\n\t\t\t\tvar view = getView(layer);\r\n\t\t\t\tif(!view || !view.$getConfig().smart_rendering || isLegacyRender(gantt)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(!this.rendered){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(!(getRectangle || specializedViewPortChecker)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcontainer = container || node;\r\n\r\n\t\t\t\tvar buffer = document.createDocumentFragment();\r\n\r\n\t\t\t\tvar viewPort = null;\r\n\t\t\t\tif(view){\r\n\t\t\t\t\tviewPort = view.getViewPort();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar nodesToRemove = {};\r\n\t\t\t\tfor(var i in this.rendered){\r\n\t\t\t\t\tnodesToRemove[i] = true;\r\n\t\t\t\t}\r\n\t\t\t\tfor (var i = 0, vis = items.length; i < vis; i++) {\r\n\t\t\t\t\tvar item = items[i];\r\n\t\t\t\t\tvar itemNode = this.rendered[item.id];\r\n\t\t\t\t\tnodesToRemove[item.id] = false;\r\n\t\t\t\t\tif (itemNode && itemNode.parentNode) {\r\n\t\t\t\t\t\tvar isVisible = false;\r\n\t\t\t\t\t\tif(specializedViewPortChecker){\r\n\t\t\t\t\t\t\tisVisible = specializedViewPortChecker(item, viewPort, view, gantt);\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tisVisible = genericViewPortChecker(viewPort, getRectangle(item, view, gantt));\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (!isVisible) {\r\n\t\t\t\t\t\t\tnodesToRemove[item.id] = true;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif(updateMethod){\r\n\t\t\t\t\t\t\t\tupdateMethod.call(gantt, item, itemNode, view, viewPort);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.restore(item, buffer);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.render_item(items[i], buffer, viewPort);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor(var i in nodesToRemove){\r\n\t\t\t\t\tif(nodesToRemove[i]){\r\n\t\t\t\t\t\tthis.hide(i);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(buffer.childNodes.length){\r\n\t\t\t\t\tcontainer.appendChild(buffer, container);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tappend: function (item, node, container) {\r\n\t\t\t\tif(!this.rendered){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!node) {\r\n\t\t\t\t\tif (this.rendered[item.id]) {\r\n\t\t\t\t\t\tthis.remove_item(item.id);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this.rendered[item.id] && this.rendered[item.id].parentNode) {\r\n\t\t\t\t\tthis.replace_item(item.id, node);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcontainer.appendChild(node);\r\n\t\t\t\t}\r\n\t\t\t\tthis.rendered[item.id] = node;\r\n\r\n\t\t\t},\r\n\t\t\treplace_item: function (item_id, newNode) {\r\n\t\t\t\tvar item = this.rendered[item_id];\r\n\t\t\t\tif (item && item.parentNode) {\r\n\t\t\t\t\titem.parentNode.replaceChild(newNode, item);\r\n\t\t\t\t}\r\n\t\t\t\tthis.rendered[item_id] = newNode;\r\n\t\t\t},\r\n\t\t\tremove_item: function (item_id) {\r\n\t\t\t\tthis.hide(item_id);\r\n\t\t\t\tdelete this.rendered[item_id];\r\n\t\t\t},\r\n\t\t\thide: function (item_id) {\r\n\t\t\t\tvar item = this.rendered[item_id];\r\n\t\t\t\tif (item && item.parentNode) {\r\n\t\t\t\t\titem.parentNode.removeChild(item);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\trestore: function (item, container) {\r\n\t\t\t\tvar dom = this.rendered[item.id];\r\n\t\t\t\tif (dom) {\r\n\t\t\t\t\tif (!dom.parentNode) {\r\n\t\t\t\t\t\tthis.append(item, dom, container || node);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.render_item(item, container || node);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tchange_id: function (oldid, newid) {\r\n\t\t\t\tthis.rendered[newid] = this.rendered[oldid];\r\n\t\t\t\tdelete this.rendered[oldid];\r\n\t\t\t},\r\n\t\t\trendered: task_area_pulls[id],\r\n\t\t\tnode: node,\r\n\t\t\tdestructor: function () {\r\n\t\t\t\tthis.clear();\r\n\t\t\t\tdelete task_area_renderers[id];\r\n\t\t\t\tdelete task_area_pulls[id];\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\treturn task_area_renderers[id];\r\n\t}\r\n\r\n\r\n\tfunction clearRenderers() {\r\n\t\tfor (var i in task_area_renderers) {\r\n\t\t\tgetRenderer(i).destructor();\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\tgetRenderer: getRenderer,\r\n\t\tclearRenderers: clearRenderers\r\n\t};\r\n\r\n};\r\n\r\nmodule.exports = rendererFactory;","var renderFactoryProvider = require(\"./render_factory\");\r\nvar utils = require(\"../../../utils/utils\"),\r\n\tdomHelpers = require(\"../utils/dom_helpers\"),\r\n\tisLegacyRender = require(\"./is_legacy_smart_render\");\r\n\r\nvar layerFactory = function(gantt){\r\n\r\n\tvar renderFactory = renderFactoryProvider(gantt);\r\n\treturn {\r\n\tcreateGroup: function (getContainer, relativeRoot, defaultFilters, initLayer) {\r\n\r\n\t\tvar renderGroup = {\r\n\t\t\ttempCollection: [],\r\n\t\t\trenderers: {},\r\n\t\t\tcontainer: getContainer,\r\n\t\t\tfilters: [],\r\n\t\t\tgetLayers: function () {\r\n\t\t\t\tthis._add();// add pending layers\r\n\r\n\t\t\t\tvar res = [];\r\n\t\t\t\tfor (var i in this.renderers) {\r\n\t\t\t\t\tres.push(this.renderers[i]);\r\n\t\t\t\t}\r\n\t\t\t\treturn res;\r\n\t\t\t},\r\n\t\t\tgetLayer: function (id) {\r\n\t\t\t\treturn this.renderers[id];\r\n\t\t\t},\r\n\t\t\t_add: function (layer) {\r\n\t\t\t\tif (layer) {\r\n\t\t\t\t\tlayer.id = layer.id || utils.uid();\r\n\t\t\t\t\tthis.tempCollection.push(layer);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar container = this.container();\r\n\r\n\t\t\t\tvar pending = this.tempCollection;\r\n\t\t\t\tfor (var i = 0; i < pending.length; i++) {\r\n\t\t\t\t\tlayer = pending[i];\r\n\r\n\t\t\t\t\tif (!this.container() && !(layer && layer.container && domHelpers.isChildOf(layer.container, document.body))) continue;\r\n\r\n\t\t\t\t\tvar node = layer.container,\r\n\t\t\t\t\t\tid = layer.id,\r\n\t\t\t\t\t\ttopmost = layer.topmost;\r\n\t\t\t\t\tif (!node.parentNode) {\r\n\t\t\t\t\t\t//insert on top or below the tasks\r\n\t\t\t\t\t\tif (topmost) {\r\n\t\t\t\t\t\t\tcontainer.appendChild(node);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tvar rel = relativeRoot ? relativeRoot() : container.firstChild;\r\n\t\t\t\t\t\t\tif (rel)\r\n\t\t\t\t\t\t\t\tcontainer.insertBefore(node, rel);\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tcontainer.appendChild(node);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.renderers[id] = renderFactory.getRenderer(\r\n\t\t\t\t\t\tid,\r\n\t\t\t\t\t\tlayer,\r\n\t\t\t\t\t\tnode\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tif (initLayer) {\r\n\t\t\t\t\t\tinitLayer(layer, gantt);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.tempCollection.splice(i, 1);\r\n\t\t\t\t\ti--;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\taddLayer: function (config) {\r\n\t\t\t\tif(config){\r\n\t\t\t\t\tif(typeof config == \"function\"){\r\n\t\t\t\t\t\tconfig = {renderer: config};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(config.filter === undefined){\r\n\t\t\t\t\t\tconfig.filter = mergeFilters(defaultFilters || []);\r\n\t\t\t\t\t}else if(config.filter instanceof Array){\r\n\t\t\t\t\t\tconfig.filter.push(defaultFilters);\r\n\t\t\t\t\t\tconfig.filter = mergeFilters(config.filter);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(!config.container){\r\n\t\t\t\t\t\tconfig.container = document.createElement(\"div\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tconfig.requestUpdate = function(){\r\n\t\t\t\t\t\tif(gantt.config.smart_rendering && !isLegacyRender(gantt)){\r\n\t\t\t\t\t\t\tif(self.renderers[config.id]){\r\n\t\t\t\t\t\t\t\tself.onUpdateRequest(self.renderers[config.id]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._add(config);\r\n\t\t\t\treturn (config ? config.id : undefined);\r\n\t\t\t},\r\n\t\t\tonUpdateRequest: function(layer){\r\n\r\n\t\t\t},\r\n\r\n\t\t\teachLayer: function(code){\r\n\t\t\t\tfor (var i in this.renderers) {\r\n\t\t\t\t\tcode(this.renderers[i]);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tremoveLayer: function (id) {\r\n\t\t\t\tif(!this.renderers[id])\r\n\t\t\t\t\treturn;\r\n\t\t\t\tthis.renderers[id].destructor();\r\n\t\t\t\tdelete this.renderers[id];\r\n\t\t\t},\r\n\t\t\tclear: function () {\r\n\t\t\t\tfor (var i in this.renderers) {\r\n\t\t\t\t\tthis.renderers[i].destructor();\r\n\t\t\t\t}\r\n\t\t\t\tthis.renderers = {};\r\n\t\t\t}//,\r\n\t\t\t//prepareConfig: prepareConfig\r\n\t\t};\r\n\r\n\t\tgantt.attachEvent(\"onDestroy\", function(){\r\n\t\t\trenderGroup.clear();\r\n\t\t\trenderGroup = null;\r\n\t\t});\r\n\r\n\t\treturn renderGroup;\r\n\t}\r\n};};\r\n\r\n\r\nfunction mergeFilters(filter_methods){\r\n\tif(!(filter_methods instanceof Array)){\r\n\t\tfilter_methods = Array.prototype.slice.call(arguments, 0);\r\n\t}\r\n\r\n\treturn function(obj){\r\n\t\tvar res = true;\r\n\t\tfor(var i = 0, len = filter_methods.length; i < len; i++){\r\n\t\t\tvar filter_method = filter_methods[i];\r\n\t\t\tif(filter_method){\r\n\t\t\t\tres = res && (filter_method(obj.id, obj) !== false);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t};\r\n}\r\n\r\n\r\nmodule.exports = layerFactory;\r\n","var createLayerFactory = require(\"./render/layer_engine\");\r\nfunction initLayer(layer, gantt){\r\n\tif(!layer.view){\r\n\t\treturn;\r\n\t}\r\n\r\n\tvar view = layer.view;\r\n\tif(typeof view === \"string\"){\r\n\t\tview = gantt.$ui.getView(view);\r\n\t}\r\n\r\n\tif(view && view.attachEvent){\r\n\t\tview.attachEvent(\"onScroll\", function(){\r\n\t\t\tif(layer.requestUpdate){\r\n\t\t\t\tlayer.requestUpdate();\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n\r\nvar createLayerEngine = function(gantt){\r\n\tvar factory = createLayerFactory(gantt);\r\n\treturn {\r\n\t\tgetDataRender: function(name){\r\n\t\t\treturn gantt.$services.getService(\"layer:\" + name) || null;\r\n\t\t},\r\n\t\tcreateDataRender: function(config){\r\n\t\t\tvar name = config.name,\r\n\t\t\t\tdefaultContainer = config.defaultContainer,\r\n\t\t\t\tpreviusSiblingContainer = config.defaultContainerSibling;\r\n\r\n\t\t\tvar layers = factory.createGroup(\r\n\t\t\t\tdefaultContainer,\r\n\t\t\t\tpreviusSiblingContainer,\r\n\t\t\t\tfunction(itemId, item){\r\n\t\t\t\t\tif(layers.filters){\r\n\t\t\t\t\t\tfor(var i = 0; i < layers.filters.length; i++){\r\n\t\t\t\t\t\t\tif(layers.filters[i](itemId, item) === false){\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tinitLayer\r\n\t\t\t);\r\n\r\n\t\t\tgantt.$services.setService(\"layer:\" + name, function(){\r\n\t\t\t\treturn layers;\r\n\t\t\t});\r\n\r\n\t\t\tgantt.attachEvent(\"onGanttReady\", function () {\r\n\t\t\t\tlayers.addLayer();// init layers on start\r\n\t\t\t});\r\n\r\n\t\t\treturn layers;\r\n\t\t},\r\n\t\tinit: function(){\r\n\t\t\tvar taskLayers = this.createDataRender({\r\n\t\t\t\tname: \"task\",\r\n\t\t\t\tdefaultContainer: function(){\r\n\t\t\t\t\tif(gantt.$task_data){\r\n\t\t\t\t\t\treturn gantt.$task_data;\r\n\t\t\t\t\t}else if(gantt.$ui.getView(\"timeline\")){\r\n\t\t\t\t\t\treturn gantt.$ui.getView(\"timeline\").$task_data;\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tdefaultContainerSibling: function(){\r\n\t\t\t\t\tif(gantt.$task_links){\r\n\t\t\t\t\t\treturn gantt.$task_links;\r\n\t\t\t\t\t}else if(gantt.$ui.getView(\"timeline\")){\r\n\t\t\t\t\t\treturn gantt.$ui.getView(\"timeline\").$task_links;\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tfilter: function(item){\r\n\r\n\t\t\t\t}\r\n\t\t\t}, gantt);\r\n\r\n\t\t\tvar linkLayers = this.createDataRender({\r\n\t\t\t\tname: \"link\",\r\n\t\t\t\tdefaultContainer: function(){\r\n\t\t\t\t\tif(gantt.$task_data){\r\n\t\t\t\t\t\treturn gantt.$task_data;\r\n\t\t\t\t\t}else if(gantt.$ui.getView(\"timeline\")){\r\n\t\t\t\t\t\treturn gantt.$ui.getView(\"timeline\").$task_data;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, gantt);\r\n\r\n\t\t\treturn {\r\n\t\t\t\taddTaskLayer: function(config){\r\n\t\t\t\t\tif(typeof config === \"function\"){\r\n\t\t\t\t\t\tconfig = {\r\n\t\t\t\t\t\t\trenderer: config\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconfig.view = \"timeline\";\r\n\r\n\t\t\t\t\treturn taskLayers.addLayer(config);\r\n\t\t\t\t},\r\n\r\n\t\t\t\t_getTaskLayers: function(){\r\n\t\t\t\t\treturn taskLayers.getLayers();\r\n\t\t\t\t},\r\n\t\t\t\tremoveTaskLayer: function(id){\r\n\t\t\t\t\ttaskLayers.removeLayer(id);\r\n\t\t\t\t},\r\n\r\n\t\t\t\t_clearTaskLayers: function(){\r\n\t\t\t\t\ttaskLayers.clear();\r\n\t\t\t\t},\r\n\t\t\t\taddLinkLayer: function(config){\r\n\t\t\t\t\tif(typeof config === \"function\"){\r\n\t\t\t\t\t\tconfig = {\r\n\t\t\t\t\t\t\trenderer: config\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconfig.view = \"timeline\";\r\n\t\t\t\t\treturn linkLayers.addLayer(config);\r\n\t\t\t\t},\r\n\r\n\t\t\t\t_getLinkLayers: function(){\r\n\t\t\t\t\treturn linkLayers.getLayers();\r\n\t\t\t\t},\r\n\t\t\t\tremoveLinkLayer: function(id){\r\n\t\t\t\t\tlinkLayers.removeLayer(id);\r\n\t\t\t\t},\r\n\r\n\t\t\t\t_clearLinkLayers: function(){\r\n\t\t\t\t\tlinkLayers.clear();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t};\r\n};\r\n\r\nmodule.exports = createLayerEngine;","var domHelpers = require(\"./utils/dom_helpers\");\r\n\r\nvar createMouseHandler = (function(domHelpers) {\r\n\treturn function (gantt) {\r\n\t\tvar eventHandlers = {\r\n\t\t\t\"click\": {},\r\n\t\t\t\"doubleclick\": {},\r\n\t\t\t\"contextMenu\": {}\r\n\t\t};\r\n\r\n\t\tfunction addEventTarget(event, className, handler, root) {\r\n\t\t\tif(!eventHandlers[event][className]){\r\n\t\t\t\teventHandlers[event][className] = [];\r\n\t\t\t}\r\n\r\n\t\t\teventHandlers[event][className].push({\r\n\t\t\t\thandler: handler,\r\n\t\t\t\troot: root\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfunction callHandler(eventName, className, root, args) {\r\n\t\t\tvar handlers = eventHandlers[eventName][className];\r\n\t\t\tif(handlers){\r\n\t\t\t\tfor(var i = 0; i < handlers.length; i++){\r\n\t\t\t\t\tif(!(root || handlers[i].root) || handlers[i].root === root){\r\n\t\t\t\t\t\thandlers[i].handler.apply(this, args);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction onClick(e) {\r\n\t\t\te = e || window.event;\r\n\t\t\tvar id = gantt.locate(e);\r\n\r\n\t\t\tvar handlers = findEventHandlers(e, eventHandlers.click);\r\n\t\t\tvar res = true;\r\n\t\t\tif (id !== null) {\r\n\t\t\t\tres = !gantt.checkEvent(\"onTaskClick\") || gantt.callEvent(\"onTaskClick\", [id, e]);\r\n\t\t\t} else {\r\n\t\t\t\tgantt.callEvent(\"onEmptyClick\", [e]);\r\n\t\t\t}\r\n\r\n\t\t\tif (res) {\r\n\t\t\t\tvar default_action = callEventHandlers(handlers, e, id);\r\n\t\t\t\tif (!default_action)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tif (id && gantt.getTask(id) && gantt.config.select_task && !gantt.config.multiselect) {\r\n\t\t\t\t\tgantt.selectTask(id);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction onContextMenu(e) {\r\n\t\t\te = e || window.event;\r\n\t\t\tvar src = e.target || e.srcElement,\r\n\t\t\t\ttaskId = gantt.locate(src),\r\n\t\t\t\tlinkId = gantt.locate(src, gantt.config.link_attribute);\r\n\r\n\t\t\tvar res = !gantt.checkEvent(\"onContextMenu\") || gantt.callEvent(\"onContextMenu\", [taskId, linkId, e]);\r\n\t\t\tif (!res) {\r\n\t\t\t\tif (e.preventDefault)\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\telse\r\n\t\t\t\t\te.returnValue = false;\r\n\t\t\t}\r\n\t\t\treturn res;\r\n\t\t}\r\n\r\n\t\tfunction findEventHandlers(e, hash){\r\n\t\t\tvar trg = e.target || e.srcElement;\r\n\t\t\tvar handlers = [];\r\n\t\t\twhile (trg) {\r\n\t\t\t\tvar css = domHelpers.getClassName(trg);\r\n\t\t\t\tif (css) {\r\n\t\t\t\t\tcss = css.split(\" \");\r\n\t\t\t\t\tfor (var i = 0; i < css.length; i++) {\r\n\t\t\t\t\t\tif (!css[i]) continue;\r\n\t\t\t\t\t\tif (hash[css[i]]) {\r\n\t\t\t\t\t\t\tvar delegateHandlers = hash[css[i]];\r\n\r\n\t\t\t\t\t\t\tfor(var h = 0; h < delegateHandlers.length; h++){\r\n\t\t\t\t\t\t\t\tif(delegateHandlers[h].root){\r\n\t\t\t\t\t\t\t\t\tif(!domHelpers.isChildOf(trg, delegateHandlers[h].root)){\r\n\t\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\thandlers.push(delegateHandlers[h].handler);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttrg = trg.parentNode;\r\n\t\t\t}\r\n\t\t\treturn handlers;\r\n\t\t}\r\n\r\n\t\tfunction callEventHandlers(handlers, e, id){\r\n\t\t\tvar res = true;\r\n\r\n\t\t\tfor(var i = 0; i < handlers.length; i++){\r\n\t\t\t\tvar handlerResult = handlers[i].call(gantt, e, id, e.target || e.srcElement);\r\n\t\t\t\tres = res && !(typeof handlerResult != \"undefined\" && handlerResult !== true);\r\n\t\t\t}\r\n\r\n\t\t\treturn res;\r\n\t\t}\r\n\r\n\r\n\t\tfunction onDoubleClick(e) {\r\n\t\t\te = e || window.event;\r\n\t\t\tvar id = gantt.locate(e);\r\n\r\n\t\t\tvar handlers = findEventHandlers(e, eventHandlers.doubleclick);\r\n\t\t\t// when doubleclick fired not on task, id === null\r\n\t\t\tvar res = !gantt.checkEvent(\"onTaskDblClick\") || id === null || gantt.callEvent(\"onTaskDblClick\", [id, e]);\r\n\t\t\tif (res) {\r\n\t\t\t\tvar default_action = callEventHandlers(handlers, e, id);\r\n\t\t\t\tif (!default_action)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tif (id !== null && gantt.getTask(id)) {\r\n\t\t\t\t\tif (res && gantt.config.details_on_dblclick && !gantt.isReadonly()) {\r\n\t\t\t\t\t\tgantt.showLightbox(id);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction onMouseMove(e) {\r\n\t\t\tif (gantt.checkEvent(\"onMouseMove\")) {\r\n\t\t\t\tvar id = gantt.locate(e);\r\n\t\t\t\tgantt._last_move_event = e;\r\n\t\t\t\tgantt.callEvent(\"onMouseMove\", [id, e]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction detach(eventName, className, handler, root) {\r\n\t\t\tif (eventHandlers[eventName] && eventHandlers[eventName][className]) {\r\n\t\t\t\tvar handlers = eventHandlers[eventName];\r\n\t\t\t\tvar elementHandlers = handlers[className];\r\n\t\t\t\tfor(var i = 0; i < elementHandlers.length; i++){\r\n\t\t\t\t\tif(elementHandlers[i].root == root){\r\n\t\t\t\t\t\telementHandlers.splice(i, 1);\r\n\t\t\t\t\t\ti--;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!elementHandlers.length){\r\n\t\t\t\t\tdelete handlers[className];\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar domEvents = gantt._createDomEventScope();\r\n\r\n\t\tfunction reset(node){\r\n\r\n\t\t\tdomEvents.detachAll();\r\n\r\n\t\t\tif(node){\r\n\t\t\t\tdomEvents.attach(node, \"click\", onClick);\r\n\t\t\t\tdomEvents.attach(node, \"dblclick\", onDoubleClick);\r\n\t\t\t\tdomEvents.attach(node, \"mousemove\", onMouseMove);\r\n\t\t\t\tdomEvents.attach(node, \"contextmenu\", onContextMenu);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\r\n\t\treturn {\r\n\t\t\treset: reset,\r\n\t\t\tglobal: function(event, classname, handler){\r\n\t\t\t\taddEventTarget(event, classname, handler, null);\r\n\t\t\t},\r\n\t\t\tdelegate: addEventTarget,\r\n\t\t\tdetach: detach,\r\n\t\t\tcallHandler: callHandler,\r\n\t\t\tonDoubleClick: onDoubleClick,\r\n\t\t\tonMouseMove: onMouseMove,\r\n\t\t\tonContextMenu: onContextMenu,\r\n\t\t\tonClick: onClick,\r\n\t\t\tdestructor: function(){\r\n\t\t\t\treset();\r\n\t\t\t\teventHandlers = null;\r\n\t\t\t\tdomEvents = null;\r\n\t\t\t}\r\n\r\n\t\t};\r\n\t};\r\n\r\n})(domHelpers);\r\n\r\n\r\nmodule.exports = {\r\n\tinit:createMouseHandler\r\n};","var utils = require(\"../../utils/utils\");\r\n\r\nfunction ViewSettings(config){\r\n\tutils.mixin(this, config, true);\r\n}\r\n\r\n\r\nfunction extendSettings (store, parentSettings){\r\n\tvar own = this.$config[store];\r\n\r\n\tif(own){\r\n\t\tif(own instanceof ViewSettings){\r\n\t\t\treturn own;\r\n\t\t}else{\r\n\t\t\tViewSettings.prototype = parentSettings;\r\n\t\t\tthis.$config[store] = new ViewSettings(own);\r\n\t\t\treturn this.$config[store];\r\n\t\t}\r\n\t}else{\r\n\t\treturn parentSettings;\r\n\t}\r\n}\r\n\r\nvar configurable = function(parentView){\r\n\tvar parentConfig,\r\n\t\tparentTemplates;\r\n\r\n\treturn {\r\n\t\t$getConfig: function(){\r\n\t\t\tif(!parentConfig){\r\n\t\t\t\tparentConfig = parentView ? parentView.$getConfig() : this.$gantt.config;\r\n\t\t\t}\r\n\t\t\tif(!this.$config.config){\r\n\t\t\t\treturn parentConfig;\r\n\t\t\t}else{\r\n\t\t\t\treturn extendSettings.call(this, \"config\", parentConfig);\r\n\t\t\t}\r\n\t\t},\r\n\t\t$getTemplates: function(){\r\n\t\t\tif(!parentTemplates){\r\n\t\t\t\tparentTemplates = parentView ? parentView.$getTemplates() : this.$gantt.templates;\r\n\t\t\t}\r\n\t\t\tif(!this.$config.templates){\r\n\t\t\t\treturn parentTemplates;\r\n\t\t\t}else{\r\n\t\t\t\treturn extendSettings.call(this, \"templates\", parentTemplates);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n};\r\n\r\nmodule.exports = function(obj, parent){\r\n\tutils.mixin(obj, configurable(parent));\r\n};","var utils = require(\"../../utils/utils\"),\r\n\tconfigurable = require(\"./configurable\");\r\n\r\nvar uiFactory = function createFactory(gantt){\r\n\tvar views = {};\r\n\r\n\tfunction ui(cell, parentView) {\r\n\t\tvar content;\r\n\t\tvar view = \"cell\";\r\n\t\tif (cell.view){\r\n\t\t\tview = \"viewcell\";\r\n\t\t}else if (cell.resizer) {\r\n\t\t\tview = \"resizer\";\r\n\t\t}\r\n\t\telse if (cell.rows || cell.cols) {\r\n\t\t\tview = \"layout\";\r\n\t\t}\r\n\t\telse if (cell.views) {\r\n\t\t\tview = \"multiview\";\r\n\t\t}\r\n\r\n\t\tcontent = createView.call(this, view, null, cell, parentView);\r\n\t\treturn content;\r\n\t}\r\n\t\r\n\tvar createdViews = {};\r\n\r\n\tfunction createView(name, parent, config, parentView) {\r\n\t\tvar creator = views[name];\r\n\r\n\t\tif(!creator || !creator.create)\r\n\t\t\treturn false;\r\n\r\n\t\tif(name == \"resizer\" && !config.mode){\r\n\t\t\tif(parentView.$config.cols){\r\n\t\t\t\tconfig.mode = \"x\";\r\n\t\t\t}else{\r\n\t\t\t\tconfig.mode = \"y\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(name == \"viewcell\" && config.view == \"scrollbar\" && !config.scroll){\r\n\t\t\tif(parentView.$config.cols){\r\n\t\t\t\tconfig.scroll = \"y\";\r\n\t\t\t}else{\r\n\t\t\t\tconfig.scroll = \"x\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar config = utils.copy(config);\r\n\r\n\t\tif(!config.id && !createdViews[config.view]){\r\n\t\t\tconfig.id = config.view;\r\n\t\t}\r\n\r\n\t\tif(config.id && !config.css){\r\n\t\t\tconfig.css = config.id+\"_cell\";\r\n\t\t}\r\n\r\n\t\tvar view = new creator.create(parent, config, this, gantt);\r\n\r\n\t\tif(creator.configure){\r\n\t\t\tcreator.configure(view);\r\n\t\t}\r\n\r\n\t\tconfigurable(view, parentView);\r\n\t\tif(!view.$id){\r\n\t\t\tview.$id = config.id || gantt.uid();\r\n\t\t}\r\n\r\n\t\tif(!view.$parent && typeof parent == \"object\"){\r\n\t\t\tview.$parent = parent;\r\n\t\t}\r\n\t\tif(!view.$config){\r\n\t\t\tview.$config = config;\r\n\t\t}\r\n\r\n\t\tif(createdViews[view.$id]){\r\n\t\t\tview.$id = gantt.uid();\r\n\t\t}\r\n\r\n\t\tcreatedViews[view.$id] = view;\r\n\r\n\t\treturn view;\r\n\t}\r\n\r\n\tfunction reset(){\r\n\t\tcreatedViews = {};\r\n\t}\r\n\r\n\tfunction register(name, viewConstructor, configure){\r\n\t\tviews[name] = {create: viewConstructor, configure: configure};\r\n\t}\r\n\r\n\tfunction getView(id){\r\n\t\treturn createdViews[id];\r\n\t}\r\n\r\n\tvar factory = {\r\n\t\tinitUI:ui,\r\n\t\treset: reset,\r\n\t\tregisterView: register,\r\n\t\tcreateView: createView,\r\n\t\tgetView: getView\r\n\t};\r\n\r\n\treturn factory;\r\n};\r\n\r\nmodule.exports = {\r\n\tcreateFactory: uiFactory\r\n};\r\n\r\n","var uiFactory = require(\"./ui_factory\"),\r\n\tmouseEvents = require(\"./mouse\"),\r\n\tcreateLayers = require(\"./gantt_layers\"),\r\n\tCell = require(\"./layout/cell\"),\r\n\tLayout = require(\"./layout/layout\"),\r\n\tViewLayout = require(\"./layout/view_layout\"),\r\n\tViewCell = require(\"./layout/view_cell\"),\r\n\tResizer = require(\"./layout/resizer_cell\"),\r\n\tScrollbar = require(\"./layout/scrollbar_cell\"),\r\n\tTimeline = require(\"./timeline/timeline\"),\r\n\tGrid = require(\"./grid/grid\"),\r\n\tResourceGrid = require(\"./grid/resource_grid\"),\r\n\tResourceTimeline = require(\"./timeline/resource_timeline\"),\r\n\tResourceHistogram = require(\"./timeline/resource_histogram\");\r\n\r\n\r\nvar gridEditorsFactory = require(\"./grid/editors/controller\");\r\n\r\n\r\nvar renderTaskBar = require(\"./render/task_bar_smart_render\"),\r\n\trenderSplitTaskBar = require(\"./render/task_split_render\"),\r\n\trenderTaskBg = require(\"./render/task_bg_render\"),\r\n\trenderLink = require(\"./render/link_render\"),\r\n\tgridRenderer = require(\"./render/task_grid_line_render\"),\r\n\tresourceMatrixRenderer = require(\"./render/resource_matrix_render\"),\r\n\tresourceHistogramRenderer = require(\"./render/resource_histogram_render\");\r\n\r\nvar mainGridInitializer = require(\"./grid/main_grid_initializer\");\r\nvar mainTimelineInitializer = require(\"./timeline/main_timeline_initializer\");\r\nvar mainLayoutInitializer = require(\"./main_layout_initializer\");\r\n\r\nfunction initUI(gantt){\r\n\tfunction attachInitializer(view, initializer){\r\n\t\tvar ext = initializer(gantt);\r\n\t\tif(ext.onCreated)\r\n\t\t\text.onCreated(view);\r\n\t\tview.attachEvent(\"onReady\", function(){\r\n\t\t\tif(ext.onInitialized)\r\n\t\t\t\text.onInitialized(view);\r\n\t\t});\r\n\t\tview.attachEvent(\"onDestroy\", function(){\r\n\t\t\tif(ext.onDestroyed)\r\n\t\t\t\text.onDestroyed(view);\r\n\t\t});\r\n\t}\r\n\r\n\tvar factory = uiFactory.createFactory(gantt);\r\n\tfactory.registerView(\"cell\", Cell);\r\n\tfactory.registerView(\"resizer\", Resizer);\r\n\tfactory.registerView(\"scrollbar\", Scrollbar);\r\n\tfactory.registerView(\"layout\", Layout, function(view){\r\n\t\tvar id = view.$config ? view.$config.id : null;\r\n\t\tif(id === \"main\"){\r\n\t\t\tattachInitializer(view, mainLayoutInitializer);\r\n\t\t}\r\n\t});\r\n\tfactory.registerView(\"viewcell\", ViewCell);\r\n\tfactory.registerView(\"multiview\", ViewLayout);\r\n\tfactory.registerView(\"timeline\", Timeline, function(view){\r\n\t\tvar id = view.$config ? view.$config.id : null;\r\n\t\tif(id === \"timeline\" || view.$config.bind == \"task\"){\r\n\t\t\tattachInitializer(view, mainTimelineInitializer);\r\n\t\t}\r\n\t});\r\n\tfactory.registerView(\"grid\", Grid, function(view){\r\n\t\tvar id = view.$config ? view.$config.id : null;\r\n\t\tif(id === \"grid\" || view.$config.bind == \"task\"){\r\n\t\t\tattachInitializer(view, mainGridInitializer);\r\n\t\t}\r\n\t});\r\n\r\n\tfactory.registerView(\"resourceGrid\", ResourceGrid);\r\n\tfactory.registerView(\"resourceTimeline\", ResourceTimeline);\r\n\tfactory.registerView(\"resourceHistogram\", ResourceHistogram);\r\n\r\n\tvar layersEngine = createLayers(gantt);\r\n\r\n\tvar inlineEditors = gridEditorsFactory(gantt);\r\n\r\n\tgantt.ext.inlineEditors = inlineEditors;\r\n\tgantt.ext._inlineEditors = inlineEditors;\r\n\tinlineEditors.init(gantt);\r\n\r\n\treturn {\r\n\t\tfactory:factory,\r\n\t\tmouseEvents: mouseEvents.init(gantt),\r\n\t\tlayersApi: layersEngine.init(),\r\n\t\trender:{\r\n\t\t\tgridLine: function(){\r\n\t\t\t\treturn gridRenderer(gantt);\r\n\t\t\t},\r\n\t\t\ttaskBg: function(){\r\n\t\t\t\treturn renderTaskBg(gantt);\r\n\t\t\t},\r\n\t\t\ttaskBar: function(){\r\n\t\t\t\treturn renderTaskBar(gantt);\r\n\t\t\t},\r\n\t\t\ttaskSplitBar: function(){\r\n\t\t\t\treturn renderSplitTaskBar(gantt);\r\n\t\t\t},\r\n\t\t\tlink: function(){\r\n\t\t\t\treturn renderLink(gantt);\r\n\t\t\t},\r\n\t\t\tresourceRow: function(){\r\n\t\t\t\treturn resourceMatrixRenderer(gantt);\r\n\t\t\t},\r\n\t\t\tresourceHistogram: function(){\r\n\t\t\t\treturn resourceHistogramRenderer(gantt);\r\n\t\t\t}\r\n\t\t},\r\n\t\tlayersService: {\r\n\t\t\tgetDataRender: function(name){\r\n\t\t\t\treturn layersEngine.getDataRender(name, gantt);\r\n\t\t\t},\r\n\t\t\tcreateDataRender: function(config){\r\n\t\t\t\treturn layersEngine.createDataRender(config, gantt);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n}\r\n\r\nmodule.exports = {\r\n\tinit: initUI\r\n};","var utils = require(\"../../utils/utils\");\r\nvar domHelpers = require(\"./utils/dom_helpers\");\r\n\r\nmodule.exports = function(gantt) {\r\n\r\n\tvar boxAttribute = \"data-dhxbox\";\r\n\r\n\tvar _dhx_msg_cfg = null;\r\n\r\n\tfunction callback(config, result) {\r\n\t\tvar usercall = config.callback;\r\n\t\tmodalBox.hide(config.box);\r\n\r\n\t\t_dhx_msg_cfg = config.box = null;\r\n\t\tif (usercall)\r\n\t\t\tusercall(result);\r\n\t}\r\n\r\n\tfunction modal_key(event) {\r\n\t\tif (_dhx_msg_cfg) {\r\n\r\n\t\t\tvar code = event.which || event.keyCode;\r\n\t\t\tvar preventDefault = false;\r\n\r\n\t\t\tif (messageBox.keyboard) {\r\n\t\t\t\tif (code == 13 || code == 32) {\r\n\t\t\t\t\t// default behavior is to confirm/submit popup on space/enter\r\n\t\t\t\t\t// if browser focus is set on button element - do button click instead of default behavior\r\n\t\t\t\t\tvar target = event.target || event.srcElement;\r\n\t\t\t\t\tif (domHelpers.getClassName(target).indexOf(\"gantt_popup_button\") > -1 && target.click) {\r\n\t\t\t\t\t\ttarget.click();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tcallback(_dhx_msg_cfg, true);\r\n\t\t\t\t\t\tpreventDefault = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (code == 27) {\r\n\t\t\t\t\tcallback(_dhx_msg_cfg, false);\r\n\t\t\t\t\tpreventDefault = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (preventDefault) {\r\n\t\t\t\tif (event.preventDefault){\r\n\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t}\r\n\t\t\t\treturn !(event.cancelBubble = true);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tgantt.event(document, \"keydown\", modal_key, true);\r\n\r\n\tfunction modality(mode) {\r\n\t\tif (!modality.cover) {\r\n\t\t\tmodality.cover = document.createElement(\"div\");\r\n\t\t\t//necessary for IE only\r\n\t\t\tmodality.cover.onkeydown = modal_key;\r\n\t\t\tmodality.cover.className = \"dhx_modal_cover\";\r\n\t\t\tdocument.body.appendChild(modality.cover);\r\n\t\t}\r\n\r\n\t\tmodality.cover.style.display = mode ? \"inline-block\" : \"none\";\r\n\t}\r\n\r\n\tfunction button(text, className, result) {\r\n\t\tvar buttonAriaAttrs = gantt._waiAria.messageButtonAttrString(text);\r\n\t\tvar name = className.toLowerCase().replace(/ /g, \"_\");\r\n\t\tvar button_css = \"gantt_\" + name + \"_button\" + \" dhtmlx_\" + name + \"_button\"; // dhtmlx_ok_button, dhtmlx_click_me_button\r\n\t\treturn \"
\" + text + \"
\";\r\n\t}\r\n\r\n\tfunction info(text) {\r\n\t\tif (!messageBox.area) {\r\n\t\t\tmessageBox.area = document.createElement(\"div\");\r\n\t\t\tmessageBox.area.className = \"gantt_message_area dhtmlx_message_area\";\r\n\t\t\tmessageBox.area.style[messageBox.position] = \"5px\";\r\n\t\t\tdocument.body.appendChild(messageBox.area);\r\n\t\t}\r\n\r\n\t\tmessageBox.hide(text.id);\r\n\t\tvar message = document.createElement(\"div\");\r\n\t\tmessage.innerHTML = \"
\" + text.text + \"
\";\r\n\t\tmessage.className = \"gantt-info dhtmlx-info gantt-\" + text.type + \" dhtmlx-\" + text.type;\r\n\t\tmessage.onclick = function () {\r\n\t\t\tmessageBox.hide(text.id);\r\n\t\t\ttext = null;\r\n\t\t};\r\n\r\n\t\tgantt._waiAria.messageInfoAttr(message);\r\n\r\n\t\tif (messageBox.position == \"bottom\" && messageBox.area.firstChild)\r\n\t\t\tmessageBox.area.insertBefore(message, messageBox.area.firstChild);\r\n\t\telse\r\n\t\t\tmessageBox.area.appendChild(message);\r\n\r\n\t\tif (text.expire > 0)\r\n\t\t\tmessageBox.timers[text.id] = window.setTimeout(function () {\r\n\t\t\t\tmessageBox.hide(text.id);\r\n\t\t\t}, text.expire);\r\n\r\n\t\tmessageBox.pull[text.id] = message;\r\n\t\tmessage = null;\r\n\r\n\t\treturn text.id;\r\n\t}\r\n\r\n\tfunction getFirstDefined() {\r\n\t\tvar values = [].slice.apply(arguments, [0]);\r\n\r\n\t\tfor (var i = 0; i < values.length; i++) {\r\n\t\t\tif (values[i]) {\r\n\t\t\t\treturn values[i];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction _boxStructure(config, ok, cancel) {\r\n\t\tvar box = document.createElement(\"div\");\r\n\r\n\t\tvar contentId = utils.uid();\r\n\t\tgantt._waiAria.messageModalAttr(box, contentId);\r\n\r\n\r\n\t\tbox.className = \" gantt_modal_box dhtmlx_modal_box gantt-\" + config.type + \" dhtmlx-\" + config.type;\r\n\t\tbox.setAttribute(boxAttribute, 1);\r\n\r\n\t\tvar inner = '';\r\n\r\n\t\tif (config.width)\r\n\t\t\tbox.style.width = config.width;\r\n\t\tif (config.height)\r\n\t\t\tbox.style.height = config.height;\r\n\t\tif (config.title)\r\n\t\t\tinner += '
' + config.title + '
';\r\n\t\tinner += '
' + (config.content ? '' : config.text) + '
';\r\n\t\tif (ok)\r\n\t\t\tinner += button(getFirstDefined(config.ok, gantt.locale.labels.message_ok, \"OK\"), \"ok\", true);\r\n\t\tif (cancel)\r\n\t\t\tinner += button(getFirstDefined(config.cancel, gantt.locale.labels.message_cancel, \"Cancel\"), \"cancel\", false);\r\n\r\n\t\tif (config.buttons) {\r\n\t\t\tfor (var i = 0; i < config.buttons.length; i++) {\r\n\t\t\t\tvar btn = config.buttons[i];\r\n\t\t\t\tif (typeof btn == \"object\") {\r\n\t\t\t\t\t// Support { label:\"Save\", css:\"main_button\", value:\"save\" }\r\n\t\t\t\t\tvar label = btn.label;\r\n\t\t\t\t\tvar css = btn.css || (\"gantt_\" + btn.label.toLowerCase() + \"_button dhtmlx_\" + btn.label.toLowerCase() + \"_button\");\r\n\t\t\t\t\tvar value = btn.value || i;\r\n\t\t\t\t\tinner += button(label, css, value);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tinner += button(btn, btn, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tinner += '
';\r\n\t\tbox.innerHTML = inner;\r\n\r\n\t\tif (config.content) {\r\n\t\t\tvar node = config.content;\r\n\t\t\tif (typeof node == \"string\")\r\n\t\t\t\tnode = document.getElementById(node);\r\n\t\t\tif (node.style.display == 'none')\r\n\t\t\t\tnode.style.display = \"\";\r\n\t\t\tbox.childNodes[config.title ? 1 : 0].appendChild(node);\r\n\t\t}\r\n\r\n\t\tbox.onclick = function (event) {\r\n\t\t\tvar source = event.target || event.srcElement;\r\n\t\t\tif (!source.className) source = source.parentNode;\r\n\t\t\tif (domHelpers.closest(source, \".gantt_popup_button\")) {\r\n\t\t\t\tvar result = source.getAttribute(\"data-result\");\r\n\t\t\t\tresult = (result == \"true\") || (result == \"false\" ? false : result);\r\n\t\t\t\tcallback(config, result);\r\n\t\t\t}\r\n\t\t};\r\n\t\tconfig.box = box;\r\n\t\tif (ok || cancel)\r\n\t\t\t_dhx_msg_cfg = config;\r\n\r\n\t\treturn box;\r\n\t}\r\n\r\n\tfunction _createBox(config, ok, cancel) {\r\n\t\tvar box = config.tagName ? config : _boxStructure(config, ok, cancel);\r\n\r\n\t\tif (!config.hidden)\r\n\t\t\tmodality(true);\r\n\t\tdocument.body.appendChild(box);\r\n\t\tvar x = Math.abs(Math.floor(((window.innerWidth || document.documentElement.offsetWidth) - box.offsetWidth) / 2));\r\n\t\tvar y = Math.abs(Math.floor(((window.innerHeight || document.documentElement.offsetHeight) - box.offsetHeight) / 2));\r\n\t\tif (config.position == \"top\")\r\n\t\t\tbox.style.top = \"-3px\";\r\n\t\telse\r\n\t\t\tbox.style.top = y + 'px';\r\n\t\tbox.style.left = x + 'px';\r\n\t\t//necessary for IE only\r\n\t\tbox.onkeydown = modal_key;\r\n\r\n\t\tmodalBox.focus(box);\r\n\r\n\t\tif (config.hidden)\r\n\t\t\tmodalBox.hide(box);\r\n\r\n\t\tgantt.callEvent(\"onMessagePopup\", [box]);\r\n\t\treturn box;\r\n\t}\r\n\r\n\tfunction alertPopup(config) {\r\n\t\treturn _createBox(config, true, false);\r\n\t}\r\n\r\n\tfunction confirmPopup(config) {\r\n\t\treturn _createBox(config, true, true);\r\n\t}\r\n\r\n\tfunction boxPopup(config) {\r\n\t\treturn _createBox(config);\r\n\t}\r\n\r\n\tfunction box_params(text, type, callback) {\r\n\t\tif (typeof text != \"object\") {\r\n\t\t\tif (typeof type == \"function\") {\r\n\t\t\t\tcallback = type;\r\n\t\t\t\ttype = \"\";\r\n\t\t\t}\r\n\t\t\ttext = {text: text, type: type, callback: callback};\r\n\t\t}\r\n\t\treturn text;\r\n\t}\r\n\r\n\tfunction params(text, type, expire, id) {\r\n\t\tif (typeof text != \"object\")\r\n\t\t\ttext = {text: text, type: type, expire: expire, id: id};\r\n\t\ttext.id = text.id || utils.uid();\r\n\t\ttext.expire = text.expire || messageBox.expire;\r\n\t\treturn text;\r\n\t}\r\n\r\n\tvar alertBox = function () {\r\n\t\tvar text = box_params.apply(this, arguments);\r\n\t\ttext.type = text.type || \"confirm\";\r\n\t\treturn alertPopup(text);\r\n\t};\r\n\tvar confirmBox = function () {\r\n\t\tvar text = box_params.apply(this, arguments);\r\n\t\ttext.type = text.type || \"alert\";\r\n\t\treturn confirmPopup(text);\r\n\t};\r\n\tvar modalBox = function () {\r\n\t\tvar text = box_params.apply(this, arguments);\r\n\t\ttext.type = text.type || \"alert\";\r\n\t\treturn boxPopup(text);\r\n\t};\r\n\tmodalBox.hide = function (node) {\r\n\t\twhile (node && node.getAttribute && !node.getAttribute(boxAttribute))\r\n\t\t\tnode = node.parentNode;\r\n\t\tif (node) {\r\n\t\t\tnode.parentNode.removeChild(node);\r\n\t\t\tmodality(false);\r\n\r\n\t\t\tgantt.callEvent(\"onAfterMessagePopup\", [node]);\r\n\t\t}\r\n\t};\r\n\r\n\tmodalBox.focus = function (node) {\r\n\t\tsetTimeout(function () {\r\n\t\t\tvar focusable = domHelpers.getFocusableNodes(node);\r\n\t\t\tif (focusable.length) {\r\n\t\t\t\tif (focusable[0].focus) focusable[0].focus();\r\n\t\t\t}\r\n\t\t}, 1);\r\n\t};\r\n\r\n\tvar messageBox = function (text, type, expire, id) {\r\n\t\ttext = params.apply(this, arguments);\r\n\t\ttext.type = text.type || \"info\";\r\n\r\n\t\tvar subtype = text.type.split(\"-\")[0];\r\n\t\tswitch (subtype) {\r\n\t\t\tcase \"alert\":\r\n\t\t\t\treturn alertPopup(text);\r\n\t\t\tcase \"confirm\":\r\n\t\t\t\treturn confirmPopup(text);\r\n\t\t\tcase \"modalbox\":\r\n\t\t\t\treturn boxPopup(text);\r\n\t\t\tdefault:\r\n\t\t\t\treturn info(text);\r\n\t\t}\r\n\t};\r\n\r\n\tmessageBox.seed = (new Date()).valueOf();\r\n\tmessageBox.uid = utils.uid;\r\n\tmessageBox.expire = 4000;\r\n\tmessageBox.keyboard = true;\r\n\tmessageBox.position = \"top\";\r\n\tmessageBox.pull = {};\r\n\tmessageBox.timers = {};\r\n\r\n\tmessageBox.hideAll = function () {\r\n\t\tfor (var key in messageBox.pull)\r\n\t\t\tmessageBox.hide(key);\r\n\t};\r\n\tmessageBox.hide = function (id) {\r\n\t\tvar obj = messageBox.pull[id];\r\n\t\tif (obj && obj.parentNode) {\r\n\t\t\twindow.setTimeout(function () {\r\n\t\t\t\tobj.parentNode.removeChild(obj);\r\n\t\t\t\tobj = null;\r\n\t\t\t}, 2000);\r\n\t\t\tobj.className += \" hidden\";\r\n\r\n\t\t\tif (messageBox.timers[id])\r\n\t\t\t\twindow.clearTimeout(messageBox.timers[id]);\r\n\t\t\tdelete messageBox.pull[id];\r\n\t\t}\r\n\t};\r\n\r\n\tvar popups = [];\r\n\tgantt.attachEvent(\"onMessagePopup\", function(box){\r\n\t\tpopups.push(box);\r\n\t});\r\n\tgantt.attachEvent(\"onAfterMessagePopup\", function(box){\r\n\t\tfor(var i = 0; i < popups.length; i++){\r\n\t\t\tif(popups[i] === box){\r\n\t\t\t\tpopups.splice(i, 1);\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\tgantt.attachEvent(\"onDestroy\", function(){\r\n\t\tif(modality.cover && modality.cover.parentNode){\r\n\t\t\tmodality.cover.parentNode.removeChild(modality.cover);\r\n\t\t}\r\n\r\n\t\tfor(var i = 0; i < popups.length; i++){\r\n\t\t\tif(popups[i].parentNode){\r\n\t\t\t\tpopups[i].parentNode.removeChild(popups[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tpopups = null;\r\n\r\n\t\tif(messageBox.area && messageBox.area.parentNode){\r\n\t\t\tmessageBox.area.parentNode.removeChild(messageBox.area);\r\n\t\t}\r\n\t\tmessageBox = null;\r\n\t});\r\n\r\n\treturn {\r\n\t\talert: alertBox,\r\n\t\tconfirm: confirmBox,\r\n\t\tmessage: messageBox,\r\n\t\tmodalbox: modalBox\r\n\t};\r\n};","module.exports = function(gantt) {\r\n\tvar utils = require(\"../utils/utils\");\r\n\tvar env = require(\"../utils/env\");\r\n\tvar isHeadless = require(\"../utils/is_headless\");\r\n\r\n\tif(!env.isNode){\r\n\t\tvar domHelpers = require(\"./ui/utils/dom_helpers\");\r\n\r\n\t\tvar codeHelpers = require(\"../utils/helpers\");\r\n\t\tgantt.utils = {\r\n\t\t\tarrayFind: codeHelpers.arrayFind,\r\n\t\t\tdom: {\r\n\t\t\t\tgetNodePosition: domHelpers.getNodePosition,\r\n\t\t\t\tgetRelativeEventPosition: domHelpers.getRelativeEventPosition,\r\n\t\t\t\tisChildOf: domHelpers.isChildOf,\r\n\t\t\t\thasClass: domHelpers.hasClass,\r\n\t\t\t\tclosest: domHelpers.closest\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar domEvents = require(\"./ui/utils/dom_event_scope\")();\r\n\t\tgantt.event = domEvents.attach;\r\n\t\tgantt.eventRemove = domEvents.detach;\r\n\t\tgantt._eventRemoveAll = domEvents.detachAll;\r\n\t\tgantt._createDomEventScope = domEvents.extend;\r\n\r\n\t\tutils.mixin(gantt, require(\"./ui/message\")(gantt));\r\n\t\tvar uiApi = require(\"./ui/index\").init(gantt);\r\n\t\tgantt.$ui = uiApi.factory;\r\n\t\tgantt.$ui.layers = uiApi.render;\r\n\t\tgantt.$mouseEvents = uiApi.mouseEvents;\r\n\t\tgantt.$services.setService(\"mouseEvents\", function () {\r\n\t\t\treturn gantt.$mouseEvents;\r\n\t\t});\r\n\t\tgantt.mixin(gantt, uiApi.layersApi);\r\n\r\n\t\trequire(\"./data_task_layers\")(gantt);\r\n\r\n\t\tgantt.$services.setService(\"layers\", function () {\r\n\t\t\treturn uiApi.layersService;\r\n\t\t});\r\n\r\n\t\tvar createLayoutFacade = require(\"./facades/layout\");\r\n\t\tgantt.mixin(gantt, createLayoutFacade());\r\n\t\trequire(\"./ui/skin\")(gantt);\r\n\t\trequire(\"../css/skins/skyblue\")(gantt);\r\n\t\trequire(\"../css/skins/meadow\")(gantt);\r\n\t\trequire(\"../css/skins/terrace\")(gantt);\r\n\t\trequire(\"../css/skins/broadway\")(gantt);\r\n\t\trequire(\"../css/skins/material\")(gantt);\r\n\t\trequire(\"../css/skins/contrast_black\")(gantt);\r\n\t\trequire(\"../css/skins/contrast_white\")(gantt);\r\n\t\trequire(\"./ui/plugins\")(gantt);\r\n\t\trequire(\"./ui/touch\")(gantt);\r\n\t\trequire(\"./ui/lightbox\")(gantt);\r\n\t\trequire(\"./ui/lightbox/lightbox_optional_time\")(gantt);\r\n\t\trequire(\"./ui/wai_aria\")(gantt);\r\n\r\n\t\tgantt.locate = function(e) {\r\n\t\t\tvar trg = domHelpers.getTargetNode(e);\r\n\t\r\n\t\t\t//ignore empty cells\r\n\t\t\tvar className = domHelpers.getClassName(trg);\r\n\t\t\tif ((className || \"\").indexOf(\"gantt_task_cell\") >= 0) return null;\r\n\t\r\n\t\t\tvar targetAttribute = arguments[1] || this.config.task_attribute;\r\n\t\r\n\t\t\tvar node = domHelpers.locateAttribute(trg, targetAttribute);\r\n\t\t\tif(node){\r\n\t\t\t\treturn node.getAttribute(targetAttribute);\r\n\t\t\t}else{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tgantt._locate_css = function(e, classname, strict){\r\n\t\t\treturn domHelpers.locateClassName(e, classname, strict);\r\n\t\t};\r\n\t\r\n\t\tgantt._locateHTML = function(e, attribute) {\r\n\t\t\treturn domHelpers.locateAttribute(e, attribute || this.config.task_attribute);\r\n\t\t};\r\n\t}\r\n\r\n\tgantt.attachEvent(\"onParse\", function(){\r\n\t\tif(!isHeadless(gantt)){\r\n\t\t\tgantt.attachEvent(\"onGanttRender\", function(){\r\n\t\t\t\tif(gantt.config.initial_scroll){\r\n\t\t\t\t\tvar firstTask = gantt.getTaskByIndex(0);\r\n\t\t\t\t\tvar id = firstTask ? firstTask.id : gantt.config.root_id;\r\n\t\t\t\t\tif(gantt.isTaskExists(id))\r\n\t\t\t\t\tgantt.showTask(id);\r\n\t\t\t\t}\r\n\t\t\t}, {once: true});\r\n\t\t}\r\n\r\n\t});\r\n\r\n\tgantt.attachEvent(\"onBeforeGanttReady\", function(){\r\n\t\tif (!this.config.scroll_size)\r\n\t\t\tthis.config.scroll_size = domHelpers.getScrollSize() || 1;\r\n\r\n\t\tif(!isHeadless(gantt)){\r\n\t\t\t// detach listeners before clearing old DOM, possible IE errors when accessing detached nodes\r\n\t\t\tthis._eventRemoveAll();\r\n\t\t\tthis.$mouseEvents.reset();\r\n\r\n\t\t\tthis.resetLightbox();\r\n\t\t}\r\n\r\n\t});\r\n};","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Січень\", \"Лютий\", \"Березень\", \"Квітень\", \"Травень\", \"Червень\", \"Липень\", \"Серпень\", \"Вересень\", \"Жовтень\", \"Листопад\", \"Грудень\"],\r\n\t\tmonth_short: [\"Січ\", \"Лют\", \"Бер\", \"Кві\", \"Тра\", \"Чер\", \"Лип\", \"Сер\", \"Вер\", \"Жов\", \"Лис\", \"Гру\"],\r\n\t\tday_full: [\"Неділя\", \"Понеділок\", \"Вівторок\", \"Середа\", \"Четвер\", \"П'ятниця\", \"Субота\"],\r\n\t\tday_short: [\"Нед\", \"Пон\", \"Вів\", \"Сер\", \"Чет\", \"Птн\", \"Суб\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Нове завдання\",\r\n\t\ticon_save: \"Зберегти\",\r\n\t\ticon_cancel: \"Відміна\",\r\n\t\ticon_details: \"Деталі\",\r\n\t\ticon_edit: \"Редагувати\",\r\n\t\ticon_delete: \"Вилучити\",\r\n\t\tconfirm_closing: \"\", // Ваші зміни втратяться. Ви впевнені ?\r\n\t\tconfirm_deleting: \"Подія вилучиться назавжди. Ви впевнені?\",\r\n\t\tsection_description: \"Опис\",\r\n\t\tsection_time: \"Часовий проміжок\",\r\n\t\tsection_type: \"Тип\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Відміна\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n * updated by @levkar at https://github.com/DHTMLX/gantt/pull/10\r\n */\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Ocak\", \"Şubat\", \"Mart\", \"Nisan\", \"Mayıs\", \"Haziran\", \"Temmuz\", \"Ağustos\", \"Eylül\", \"Ekim\", \"Kasım\", \"Aralık\"],\r\n\t\tmonth_short: [\"Oca\", \"Şub\", \"Mar\", \"Nis\", \"May\", \"Haz\", \"Tem\", \"Ağu\", \"Eyl\", \"Eki\", \"Kas\", \"Ara\"],\r\n\t\tday_full: [\"Pazar\", \"Pazartesi\", \"Salı\", \"Çarşamba\", \"Perşembe\", \"Cuma\", \"Cumartesi\"],\r\n\t\tday_short: [\"Paz\", \"Pzt\", \"Sal\", \"Çar\", \"Per\", \"Cum\", \"Cmt\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Yeni görev\",\r\n\t\ticon_save: \"Kaydet\",\r\n\t\ticon_cancel: \"İptal\",\r\n\t\ticon_details: \"Detaylar\",\r\n\t\ticon_edit: \"Düzenle\",\r\n\t\ticon_delete: \"Sil\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Görev silinecek, emin misiniz?\",\r\n\t\tsection_description: \"Açıklama\",\r\n\t\tsection_time: \"Zaman Aralığı\",\r\n\t\tsection_type: \"Tip\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Görev Adı\",\r\n\t\tcolumn_start_date: \"Başlangıç\",\r\n\t\tcolumn_duration: \"Süre\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Bağlantı\",\r\n\t\tconfirm_link_deleting: \"silinecek\",\r\n\t\tlink_start: \" (başlangıç)\",\r\n\t\tlink_end: \" (bitiş)\",\r\n\r\n\t\ttype_task: \"Görev\",\r\n\t\ttype_project: \"Proje\",\r\n\t\ttype_milestone: \"Kilometretaşı\",\r\n\r\n\r\n\t\tminutes: \"Dakika\",\r\n\t\thours: \"Saat\",\r\n\t\tdays: \"Gün\",\r\n\t\tweeks: \"Hafta\",\r\n\t\tmonths: \"Ay\",\r\n\t\tyears: \"Yıl\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Ýptal\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n\tTranslation by Peter Eriksson\r\n */\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januari\", \"Februari\", \"Mars\", \"April\", \"Maj\", \"Juni\", \"Juli\", \"Augusti\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Maj\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Söndag\", \"Måndag\", \"Tisdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lördag\"],\r\n\t\tday_short: [\"Sön\", \"Mån\", \"Tis\", \"Ons\", \"Tor\", \"Fre\", \"Lör\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny uppgift\",\r\n\t\ticon_save: \"Spara\",\r\n\t\ticon_cancel: \"Avbryt\",\r\n\t\ticon_details: \"Detajer\",\r\n\t\ticon_edit: \"Ändra\",\r\n\t\ticon_delete: \"Ta bort\",\r\n\t\tconfirm_closing: \"\",\r\n\t\tconfirm_deleting: \"Är du säker på att du vill ta bort händelsen permanent?\",\r\n\t\tsection_description: \"Beskrivning\",\r\n\t\tsection_time: \"Tid\",\r\n\t\tsection_type: \"Typ\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Uppgiftsnamn\",\r\n\t\tcolumn_start_date: \"Starttid\",\r\n\t\tcolumn_duration: \"Varaktighet\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\r\n\t\tlink: \"Länk\",\r\n\t\tconfirm_link_deleting: \"kommer tas bort\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (slut)\",\r\n\t\ttype_task: \"Uppgift\",\r\n\t\ttype_project: \"Projekt\",\r\n\t\ttype_milestone: \"Milstolpe\",\r\n\r\n\t\tminutes: \"Minuter\",\r\n\t\thours: \"Timmar\",\r\n\t\tdays: \"Dagar\",\r\n\t\tweeks: \"Veckor\",\r\n\t\tmonths: \"Månader\",\r\n\t\tyears: \"År\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Avbryt\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Január\", \"Február\", \"Marec\", \"Apríl\", \"Máj\", \"Jún\", \"Júl\", \"August\", \"September\", \"Október\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Máj\", \"Jún\", \"Júl\", \"Aug\", \"Sept\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Nedeľa\", \"Pondelok\", \"Utorok\", \"Streda\", \"Štvrtok\", \"Piatok\", \"Sobota\"],\r\n\t\tday_short: [\"Ne\", \"Po\", \"Ut\", \"St\", \"Št\", \"Pi\", \"So\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nová úloha\",\r\n\t\ticon_save: \"Uložiť\",\r\n\t\ticon_cancel: \"Späť\",\r\n\t\ticon_details: \"Detail\",\r\n\t\ticon_edit: \"Edituj\",\r\n\t\ticon_delete: \"Zmazať\",\r\n\t\tconfirm_closing: \"Vaše zmeny nebudú uložené. Skutočne?\", // Vaše změny budou ztraceny, opravdu ?\r\n\t\tconfirm_deleting: \"Udalosť bude natrvalo vymazaná. Skutočne?\",\r\n\t\tsection_description: \"Poznámky\",\r\n\t\tsection_time: \"Doba platnosti\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Späť\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Marec\", \"April\", \"Maj\", \"Junij\", \"Julij\", \"Avgust\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Maj\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Nedelja\", \"Ponedeljek\", \"Torek\", \"Sreda\", \"Četrtek\", \"Petek\", \"Sobota\"],\r\n\t\tday_short: [\"Ned\", \"Pon\", \"Tor\", \"Sre\", \"Čet\", \"Pet\", \"Sob\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nova naloga\",\r\n\t\ticon_save: \"Shrani\",\r\n\t\ticon_cancel: \"Prekliči\",\r\n\t\ticon_details: \"Podrobnosti\",\r\n\t\ticon_edit: \"Uredi\",\r\n\t\ticon_delete: \"Izbriši\",\r\n\t\tconfirm_closing: \"\", // Spremembe ne bodo shranjene. Želite nadaljevati ?\r\n\t\tconfirm_deleting: \"Dogodek bo izbrisan. Želite nadaljevati?\",\r\n\t\tsection_description: \"Opis\",\r\n\t\tsection_time: \"Časovni okvir\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Prekliči\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Январь\", \"Февраль\", \"Март\", \"Апрель\", \"Maй\", \"Июнь\", \"Июль\", \"Август\", \"Сентябрь\", \"Oктябрь\", \"Ноябрь\", \"Декабрь\"],\r\n\t\tmonth_short: [\"Янв\", \"Фев\", \"Maр\", \"Aпр\", \"Maй\", \"Июн\", \"Июл\", \"Aвг\", \"Сен\", \"Окт\", \"Ноя\", \"Дек\"],\r\n\t\tday_full: [\"Воскресенье\", \"Понедельник\", \"Вторник\", \"Среда\", \"Четверг\", \"Пятница\", \"Суббота\"],\r\n\t\tday_short: [\"Вс\", \"Пн\", \"Вт\", \"Ср\", \"Чт\", \"Пт\", \"Сб\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Новое задание\",\r\n\t\ticon_save: \"Сохранить\",\r\n\t\ticon_cancel: \"Отменить\",\r\n\t\ticon_details: \"Детали\",\r\n\t\ticon_edit: \"Изменить\",\r\n\t\ticon_delete: \"Удалить\",\r\n\t\tconfirm_closing: \"\", // Ваши изменения будут потеряны, продолжить?\r\n\t\tconfirm_deleting: \"Событие будет удалено безвозвратно, продолжить?\",\r\n\t\tsection_description: \"Описание\",\r\n\t\tsection_time: \"Период времени\",\r\n\t\tsection_type: \"Тип\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"ИСР\",\r\n\t\tcolumn_text: \"Задача\",\r\n\t\tcolumn_start_date: \"Начало\",\r\n\t\tcolumn_duration: \"Длительность\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Связь\",\r\n\t\tconfirm_link_deleting: \"будет удалена\",\r\n\t\tlink_start: \" (начало)\",\r\n\t\tlink_end: \" (конец)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Минута\",\r\n\t\thours: \"Час\",\r\n\t\tdays: \"День\",\r\n\t\tweeks: \"Неделя\",\r\n\t\tmonths: \"Месяц\",\r\n\t\tyears: \"Год\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Отменить\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"начните вводить слово для фильтрации\",\r\n\t\tresources_filter_label: \"спрятать не установленные\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n\tTraducere de Ovidiu Lixandru: http://www.madball.ro\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Ianuarie\", \"Februarie\", \"Martie\", \"Aprilie\", \"Mai\", \"Iunie\", \"Iulie\", \"August\", \"Septembrie\", \"Octombrie\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Ian\", \"Feb\", \"Mar\", \"Apr\", \"Mai\", \"Iun\", \"Iul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Duminica\", \"Luni\", \"Marti\", \"Miercuri\", \"Joi\", \"Vineri\", \"Sambata\"],\r\n\t\tday_short: [\"Du\", \"Lu\", \"Ma\", \"Mi\", \"Jo\", \"Vi\", \"Sa\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Sarcina noua\",\r\n\t\ticon_save: \"Salveaza\",\r\n\t\ticon_cancel: \"Anuleaza\",\r\n\t\ticon_details: \"Detalii\",\r\n\t\ticon_edit: \"Editeaza\",\r\n\t\ticon_delete: \"Sterge\",\r\n\t\tconfirm_closing: \"Schimbarile nu vor fi salvate, esti sigur?\",// Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Evenimentul va fi sters permanent, esti sigur?\",\r\n\t\tsection_description: \"Descriere\",\r\n\t\tsection_time: \"Interval\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Anuleaza\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\r\n\t\tmonth_short: [\"Sty\", \"Lut\", \"Mar\", \"Kwi\", \"Maj\", \"Cze\", \"Lip\", \"Sie\", \"Wrz\", \"Paź\", \"Lis\", \"Gru\"],\r\n\t\tday_full: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\r\n\t\tday_short: [\"Nie\", \"Pon\", \"Wto\", \"Śro\", \"Czw\", \"Pią\", \"Sob\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nowe zadanie\",\r\n\t\ticon_save: \"Zapisz\",\r\n\t\ticon_cancel: \"Anuluj\",\r\n\t\ticon_details: \"Szczegóły\",\r\n\t\ticon_edit: \"Edytuj\",\r\n\t\ticon_delete: \"Usuń\",\r\n\t\tconfirm_closing: \"\", // Zmiany zostaną usunięte, jesteś pewien?\r\n\t\tconfirm_deleting: \"Zdarzenie zostanie usunięte na zawsze, kontynuować?\",\r\n\t\tsection_description: \"Opis\",\r\n\t\tsection_time: \"Okres czasu\",\r\n\t\tsection_type: \"Typ\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Nazwa zadania\",\r\n\t\tcolumn_start_date: \"Początek\",\r\n\t\tcolumn_duration: \"Czas trwania\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"zostanie usunięty\",\r\n\t\tlink_start: \" (początek)\",\r\n\t\tlink_end: \" (koniec)\",\r\n\r\n\t\ttype_task: \"Zadanie\",\r\n\t\ttype_project: \"Projekt\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minuty\",\r\n\t\thours: \"Godziny\",\r\n\t\tdays: \"Dni\",\r\n\t\tweeks: \"Tydzień\",\r\n\t\tmonths: \"Miesiące\",\r\n\t\tyears: \"Lata\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Anuluj\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Mars\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Desember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Søndag\", \"Mandag\", \"Tirsdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lørdag\"],\r\n\t\tday_short: [\"Søn\", \"Man\", \"Tir\", \"Ons\", \"Tor\", \"Fre\", \"Lør\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny oppgave\",\r\n\t\ticon_save: \"Lagre\",\r\n\t\ticon_cancel: \"Avbryt\",\r\n\t\ticon_details: \"Detaljer\",\r\n\t\ticon_edit: \"Endre\",\r\n\t\ticon_delete: \"Slett\",\r\n\t\tconfirm_closing: \"Endringer blir ikke lagret, er du sikker?\", // Endringer blir ikke lagret, er du sikker?\r\n\t\tconfirm_deleting: \"Oppføringen vil bli slettet, er du sikker?\",\r\n\t\tsection_description: \"Beskrivelse\",\r\n\t\tsection_time: \"Tidsperiode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Avbryt\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januari\", \"Februari\", \"Maart\", \"April\", \"Mei\", \"Juni\", \"Juli\", \"Augustus\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"mrt\", \"Apr\", \"Mei\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Zondag\", \"Maandag\", \"Dinsdag\", \"Woensdag\", \"Donderdag\", \"Vrijdag\", \"Zaterdag\"],\r\n\t\tday_short: [\"Zo\", \"Ma\", \"Di\", \"Wo\", \"Do\", \"Vr\", \"Za\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nieuwe taak\",\r\n\t\ticon_save: \"Opslaan\",\r\n\t\ticon_cancel: \"Annuleren\",\r\n\t\ticon_details: \"Details\",\r\n\t\ticon_edit: \"Bewerken\",\r\n\t\ticon_delete: \"Verwijderen\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Item zal permanent worden verwijderd, doorgaan?\",\r\n\t\tsection_description: \"Beschrijving\",\r\n\t\tsection_time: \"Tijd periode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Taak omschrijving\",\r\n\t\tcolumn_start_date: \"Startdatum\",\r\n\t\tcolumn_duration: \"Duur\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Koppeling\",\r\n\t\tconfirm_link_deleting: \"zal worden verwijderd\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (eind)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"minuten\",\r\n\t\thours: \"uren\",\r\n\t\tdays: \"dagen\",\r\n\t\tweeks: \"weken\",\r\n\t\tmonths: \"maanden\",\r\n\t\tyears: \"jaren\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Annuleren\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Mars\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Desember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Søndag\", \"Mandag\", \"Tirsdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lørdag\"],\r\n\t\tday_short: [\"Søn\", \"Mon\", \"Tir\", \"Ons\", \"Tor\", \"Fre\", \"Lør\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny oppgave\",\r\n\t\ticon_save: \"Lagre\",\r\n\t\ticon_cancel: \"Avbryt\",\r\n\t\ticon_details: \"Detaljer\",\r\n\t\ticon_edit: \"Rediger\",\r\n\t\ticon_delete: \"Slett\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Hendelsen vil bli slettet permanent. Er du sikker?\",\r\n\t\tsection_description: \"Beskrivelse\",\r\n\t\tsection_time: \"Tidsperiode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Avbryt\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","export default class LocaleManager{\r\n\tprivate _locales:{[key:string]: IGanttLocale };\r\n\r\n\tconstructor(config: {[key:string]: IGanttLocale }){\r\n\t\tthis._locales = {};\r\n\t\tfor(const i in config){\r\n\t\t\tthis._locales[i] = config[i];\r\n\t\t}\r\n\t}\r\n\r\n\taddLocale = (name: string, locale: IGanttLocale) => {\r\n\t\tthis._locales[name] = locale;\r\n\t}\r\n\r\n\tgetLocale = (name: string): IGanttLocale => {\r\n\t\treturn this._locales[name];\r\n\t}\r\n}","/*\r\n\tTranslated by cjkim@dbvalley.com\r\n*/\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"1월\", \"2월\", \"3월\", \"4월\", \"5월\", \"6월\", \"7월\", \"8월\", \"9월\", \"10월\", \"11월\", \"12월\"],\r\n\t\tmonth_short: [\"1월\", \"2월\", \"3월\", \"4월\", \"5월\", \"6월\", \"7월\", \"8월\", \"9월\", \"10월\", \"11월\", \"12월\"],\r\n\t\tday_full: [\"일요일\", \"월요일\", \"화요일\", \"수요일\", \"목요일\", \"금요일\", \"토요일\"],\r\n\t\tday_short: [\"일\", \"월\", \"화\", \"수\", \"목\", \"금\", \"토\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"이름없는 작업\",\r\n\t\ticon_save: \"저장\",\r\n\t\ticon_cancel: \"취소\",\r\n\t\ticon_details: \"세부 사항\",\r\n\t\ticon_edit: \"수정\",\r\n\t\ticon_delete: \"삭제\",\r\n\t\tconfirm_closing: \"\",\r\n\t\tconfirm_deleting: \"작업을 삭제하시겠습니까?\",\r\n\t\tsection_description: \"설명\",\r\n\t\tsection_time: \"기간\",\r\n\t\tsection_type: \"Type\",\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"작업명\",\r\n\t\tcolumn_start_date: \"시작일\",\r\n\t\tcolumn_duration: \"기간\",\r\n\t\tcolumn_add: \"\",\r\n\t\tlink: \"전제\",\r\n\t\tconfirm_link_deleting: \"삭제 하시겠습니까?\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\t\ttype_task: \"작업\",\r\n\t\ttype_project: \"프로젝트\",\r\n\t\ttype_milestone: \"마일스톤\",\r\n\t\tminutes: \"분\",\r\n\t\thours: \"시간\",\r\n\t\tdays: \"일\",\r\n\t\tweeks: \"주\",\r\n\t\tmonths: \"달\",\r\n\t\tyears: \"년\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"취소\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n Translation by Genexus Japan Inc.\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"],\r\n\t\tmonth_short: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"],\r\n\t\tday_full: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\r\n\t\tday_short: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"新しい仕事\",\r\n\t\ticon_save: \"保存\",\r\n\t\ticon_cancel: \"キャンセル\",\r\n\t\ticon_details: \"詳細\",\r\n\t\ticon_edit: \"編集\",\r\n\t\ticon_delete: \"削除\",\r\n\t\tconfirm_closing: \"\", // 変更が取り消されます、宜しいですか?\r\n\t\tconfirm_deleting: \"イベント完全に削除されます、宜しいですか?\",\r\n\t\tsection_description: \"デスクリプション\",\r\n\t\tsection_time: \"期間\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"キャンセル\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januari\", \"Februari\", \"Maret\", \"April\", \"Mei\", \"Juni\", \"Juli\", \"Agustus\", \"September\", \"Oktober\", \"November\", \"Desember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Mei\", \"Jun\", \"Jul\", \"Ags\", \"Sep\", \"Okt\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Minggu\", \"Senin\", \"Selasa\", \"Rabu\", \"Kamis\", \"Jumat\", \"Sabtu\"],\r\n\t\tday_short: [\"Ming\", \"Sen\", \"Sel\", \"Rab\", \"Kam\", \"Jum\", \"Sab\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Tugas baru\",\r\n\t\ticon_save: \"Simpan\",\r\n\t\ticon_cancel: \"Batal\",\r\n\t\ticon_details: \"Detail\",\r\n\t\ticon_edit: \"Edit\",\r\n\t\ticon_delete: \"Hapus\",\r\n\t\tconfirm_closing: \"\", /* Perubahan tidak akan disimpan ? */\r\n\t\tconfirm_deleting: \"Acara akan dihapus\",\r\n\t\tsection_description: \"Keterangan\",\r\n\t\tsection_time: \"Periode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Batal\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Január\", \"Február\", \"Március\", \"Április\", \"Május\", \"Június\", \"Július\", \"Augusztus\", \"Szeptember\", \"Október\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Már\", \"Ápr\", \"Máj\", \"Jún\", \"Júl\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Vasárnap\", \"Hétfõ\", \"Kedd\", \"Szerda\", \"Csütörtök\", \"Péntek\", \"szombat\"],\r\n\t\tday_short: [\"Va\", \"Hé\", \"Ke\", \"Sze\", \"Csü\", \"Pé\", \"Szo\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Új feladat\",\r\n\t\ticon_save: \"Mentés\",\r\n\t\ticon_cancel: \"Mégse\",\r\n\t\ticon_details: \"Részletek\",\r\n\t\ticon_edit: \"Szerkesztés\",\r\n\t\ticon_delete: \"Törlés\",\r\n\t\tconfirm_closing: \"\", // A változások elvesznek, biztosan folytatja? \"\r\n\t\tconfirm_deleting: \"Az esemény törölve lesz, biztosan folytatja?\",\r\n\t\tsection_description: \"Leírás\",\r\n\t\tsection_time: \"Idõszak\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Mégse\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n Translation by Davor\r\n http://docs.dhtmlx.com/gantt/desktop__localization.html#comment-2569116291\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Siječanj\", \"Veljača\", \"Ožujak\", \"Travanj\", \"Svibanj\", \"Lipanj\", \"Srpanj\", \"Kolovoz\", \"Rujan\", \"Listopad\", \"Studeni\", \"Prosinac\"],\r\n\t\tmonth_short: [\"Sij\", \"Velj\", \"Ožu\", \"Tra\", \"Svi\", \"Lip\", \"Srp\", \"Kol\", \"Ruj\", \"Lis\", \"Stu\", \"Pro\"],\r\n\t\tday_full: [\"Nedjelja\", \"Ponedjeljak\", \"Utorak\", \"Srijeda\", \"Četvrtak\", \"Petak\", \"Subota\"],\r\n\t\tday_short: [\"Ned\", \"Pon\", \"Uto\", \"Sri\", \"Čet\", \"Pet\", \"Sub\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Novi Zadatak\",\r\n\t\ticon_save: \"Spremi\",\r\n\t\ticon_cancel: \"Odustani\",\r\n\t\ticon_details: \"Detalji\",\r\n\t\ticon_edit: \"Izmjeni\",\r\n\t\ticon_delete: \"Obriši\",\r\n\t\tconfirm_closing: \"\",\r\n\t\tconfirm_deleting: \"Zadatak će biti trajno izbrisan, jeste li sigurni?\",\r\n\t\tsection_description: \"Opis\",\r\n\t\tsection_time: \"Vremenski Period\",\r\n\t\tsection_type: \"Tip\",\r\n\r\n\t\t/* grid columns */\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Naziv Zadatka\",\r\n\t\tcolumn_start_date: \"Početno Vrijeme\",\r\n\t\tcolumn_duration: \"Trajanje\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Poveznica\",\r\n\t\tconfirm_link_deleting: \"će biti izbrisan\",\r\n\t\tlink_start: \" (početak)\",\r\n\t\tlink_end: \" (kraj)\",\r\n\r\n\t\ttype_task: \"Zadatak\",\r\n\t\ttype_project: \"Projekt\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\t\tminutes: \"Minute\",\r\n\t\thours: \"Sati\",\r\n\t\tdays: \"Dani\",\r\n\t\tweeks: \"Tjedni\",\r\n\t\tmonths: \"Mjeseci\",\r\n\t\tyears: \"Godine\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Odustani\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\r\n\t\tmonth_short: [\"ינו\", \"פבר\", \"מרץ\", \"אפר\", \"מאי\", \"יונ\", \"יול\", \"אוג\", \"ספט\", \"אוק\", \"נוב\", \"דצמ\"],\r\n\t\tday_full: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\r\n\t\tday_short: [\"א\", \"ב\", \"ג\", \"ד\", \"ה\", \"ו\", \"ש\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"משימה חדש\",\r\n\t\ticon_save: \"שמור\",\r\n\t\ticon_cancel: \"בטל\",\r\n\t\ticon_details: \"פרטים\",\r\n\t\ticon_edit: \"ערוך\",\r\n\t\ticon_delete: \"מחק\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"ארוע ימחק סופית.להמשיך?\",\r\n\t\tsection_description: \"הסבר\",\r\n\t\tsection_time: \"תקופה\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"בטל\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Janvier\", \"Février\", \"Mars\", \"Avril\", \"Mai\", \"Juin\", \"Juillet\", \"Août\", \"Septembre\", \"Octobre\", \"Novembre\", \"Décembre\"],\r\n\t\tmonth_short: [\"Jan\", \"Fév\", \"Mar\", \"Avr\", \"Mai\", \"Juin\", \"Juil\", \"Aoû\", \"Sep\", \"Oct\", \"Nov\", \"Déc\"],\r\n\t\tday_full: [\"Dimanche\", \"Lundi\", \"Mardi\", \"Mercredi\", \"Jeudi\", \"Vendredi\", \"Samedi\"],\r\n\t\tday_short: [\"Dim\", \"Lun\", \"Mar\", \"Mer\", \"Jeu\", \"Ven\", \"Sam\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nouvelle tâche\",\r\n\t\ticon_save: \"Enregistrer\",\r\n\t\ticon_cancel: \"Annuler\",\r\n\t\ticon_details: \"Détails\",\r\n\t\ticon_edit: \"Modifier\",\r\n\t\ticon_delete: \"Effacer\",\r\n\t\tconfirm_closing: \"\",// Vos modifications seront perdus, êtes-vous sûr ?\r\n\t\tconfirm_deleting: \"L'événement sera effacé sans appel, êtes-vous sûr ?\",\r\n\r\n\t\tsection_description: \"Description\",\r\n\t\tsection_time: \"Période\",\r\n\t\tsection_type: \"Type\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"OTP\",\r\n\t\tcolumn_text: \"Nom de la tâche\",\r\n\t\tcolumn_start_date: \"Date initiale\",\r\n\t\tcolumn_duration: \"Durée\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Le lien\",\r\n\t\tconfirm_link_deleting: \"sera supprimé\",\r\n\t\tlink_start: \"(début)\",\r\n\t\tlink_end: \"(fin)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Heures\",\r\n\t\tdays: \"Jours\",\r\n\t\tweeks: \"Semaines\",\r\n\t\tmonths: \"Mois\",\r\n\t\tyears: \"Années\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Annuler\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Tammikuu\", \"Helmikuu\", \"Maaliskuu\", \"Huhtikuu\", \"Toukokuu\", \"Kesäkuu\", \"Heinäkuu\", \"Elokuu\", \"Syyskuu\", \"Lokakuu\", \"Marraskuu\", \"Joulukuu\"],\r\n\t\tmonth_short: [\"Tam\", \"Hel\", \"Maa\", \"Huh\", \"Tou\", \"Kes\", \"Hei\", \"Elo\", \"Syy\", \"Lok\", \"Mar\", \"Jou\"],\r\n\t\tday_full: [\"Sunnuntai\", \"Maanantai\", \"Tiistai\", \"Keskiviikko\", \"Torstai\", \"Perjantai\", \"Lauantai\"],\r\n\t\tday_short: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Uusi tehtävä\",\r\n\t\ticon_save: \"Tallenna\",\r\n\t\ticon_cancel: \"Peru\",\r\n\t\ticon_details: \"Tiedot\",\r\n\t\ticon_edit: \"Muokkaa\",\r\n\t\ticon_delete: \"Poista\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Haluatko varmasti poistaa tapahtuman?\",\r\n\t\tsection_description: \"Kuvaus\",\r\n\t\tsection_time: \"Aikajakso\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Peru\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n dhtmlxGantt Persian (Farsi, fa_IR) locale by Mohammad Shokri http://slashsbin.com/\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\r\n\t\t\t\"ژانویه\",\r\n\t\t\t\"فوریه\",\r\n\t\t\t\"مارس\",\r\n\t\t\t\"آوریل\",\r\n\t\t\t\"مه\",\r\n\t\t\t\"ژوئن\",\r\n\t\t\t\"ژوئیه\",\r\n\t\t\t\"اوت\",\r\n\t\t\t\"سپتامبر\",\r\n\t\t\t\"اکتبر\",\r\n\t\t\t\"نوامبر\",\r\n\t\t\t\"دسامبر\"\r\n\t\t],\r\n\t\tmonth_short: [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"],\r\n\t\tday_full: [\r\n\t\t\t\"يکشنبه\",\r\n\t\t\t\"دوشنبه\",\r\n\t\t\t\"سه‌شنبه\",\r\n\t\t\t\"چهارشنبه\",\r\n\t\t\t\"پنجشنبه\",\r\n\t\t\t\"جمعه\",\r\n\t\t\t\"شنبه\"\r\n\t\t],\r\n\t\tday_short: [\r\n\t\t\t\"ی\",\r\n\t\t\t\"د\",\r\n\t\t\t\"س\",\r\n\t\t\t\"چ\",\r\n\t\t\t\"پ\",\r\n\t\t\t\"ج\",\r\n\t\t\t\"ش\"\r\n\t\t]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"وظیفه جدید\",\r\n\t\ticon_save: \"ذخیره\",\r\n\t\ticon_cancel: \"لغو\",\r\n\t\ticon_details: \"جزییات\",\r\n\t\ticon_edit: \"ویرایش\",\r\n\t\ticon_delete: \"حذف\",\r\n\t\tconfirm_closing: \"تغییرات شما ازدست خواهد رفت، آیا مطمئن هستید؟\",\r\n\t\tconfirm_deleting: \"این مورد برای همیشه حذف خواهد شد، آیا مطمئن هستید؟\",\r\n\t\tsection_description: \"توضیحات\",\r\n\t\tsection_time: \"مدت زمان\",\r\n\t\tsection_type: \"نوع\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"عنوان\",\r\n\t\tcolumn_start_date: \"زمان شروع\",\r\n\t\tcolumn_duration: \"مدت\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"ارتباط\",\r\n\t\tconfirm_link_deleting: \"حذف خواهد شد\",\r\n\t\tlink_start: \" (آغاز)\",\r\n\t\tlink_end: \" (پایان)\",\r\n\r\n\t\ttype_task: \"وظیفه\",\r\n\t\ttype_project: \"پروژه\",\r\n\t\ttype_milestone: \"نگارش\",\r\n\r\n\t\tminutes: \"دقایق\",\r\n\t\thours: \"ساعات\",\r\n\t\tdays: \"روزها\",\r\n\t\tweeks: \"هفته\",\r\n\t\tmonths: \"ماه‌ها\",\r\n\t\tyears: \"سال‌ها\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"تایید\",\r\n\t\tmessage_cancel: \"لغو\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n @Autor Manuel Fernandez Panzuela - www.mfernandez.es\r\n\r\n Update 30/10/2015:\r\n Translation of new labels by Jorge Macias\r\n https://disqus.com/by/disqus_bTuZk1voC7/\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Enero\", \"Febrero\", \"Marzo\", \"Abril\", \"Mayo\", \"Junio\", \"Julio\", \"Agosto\", \"Septiembre\", \"Octubre\", \"Noviembre\", \"Diciembre\"],\r\n\t\tmonth_short: [\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"],\r\n\t\tday_full: [\"Domingo\", \"Lunes\", \"Martes\", \"Miércoles\", \"Jueves\", \"Viernes\", \"Sábado\"],\r\n\t\tday_short: [\"Dom\", \"Lun\", \"Mar\", \"Mié\", \"Jue\", \"Vie\", \"Sáb\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nueva tarea\",\r\n\t\ticon_save: \"Guardar\",\r\n\t\ticon_cancel: \"Cancelar\",\r\n\t\ticon_details: \"Detalles\",\r\n\t\ticon_edit: \"Editar\",\r\n\t\ticon_delete: \"Eliminar\",\r\n\t\tconfirm_closing: \"\", // \"Sus cambios se perderán, continuar ?\"\r\n\t\tconfirm_deleting: \"El evento se borrará definitivamente, ¿continuar?\",\r\n\t\tsection_description: \"Descripción\",\r\n\t\tsection_time: \"Período\",\r\n\t\tsection_type: \"Tipo\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"EDT\",\r\n\t\tcolumn_text: \"Tarea\",\r\n\t\tcolumn_start_date: \"Inicio\",\r\n\t\tcolumn_duration: \"Duración\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Enlace\",\r\n\t\tconfirm_link_deleting: \"será borrada\",\r\n\t\tlink_start: \" (inicio)\",\r\n\t\tlink_end: \" (fin)\",\r\n\r\n\t\ttype_task: \"Tarea\",\r\n\t\ttype_project: \"Proyecto\",\r\n\t\ttype_milestone: \"Hito\",\r\n\r\n\r\n\t\tminutes: \"Minutos\",\r\n\t\thours: \"Horas\",\r\n\t\tdays: \"Días\",\r\n\t\tweeks: \"Semanas\",\r\n\t\tmonths: \"Meses\",\r\n\t\tyears: \"Años\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancelar\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\r\n\t\tday_short: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"New task\",\r\n\t\ticon_save: \"Save\",\r\n\t\ticon_cancel: \"Cancel\",\r\n\t\ticon_details: \"Details\",\r\n\t\ticon_edit: \"Edit\",\r\n\t\ticon_delete: \"Delete\",\r\n\t\tconfirm_closing: \"\",// Your changes will be lost, are you sure?\r\n\t\tconfirm_deleting: \"Task will be deleted permanently, are you sure?\",\r\n\t\tsection_description: \"Description\",\r\n\t\tsection_time: \"Time period\",\r\n\t\tsection_type: \"Type\",\r\n\r\n\t\t/* grid columns */\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancel\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Ιανουάριος\", \"Φεβρουάριος\", \"Μάρτιος\", \"Απρίλιος\", \"Μάϊος\", \"Ιούνιος\", \"Ιούλιος\", \"Αύγουστος\", \"Σεπτέμβριος\", \"Οκτώβριος\", \"Νοέμβριος\", \"Δεκέμβριος\"],\r\n\t\tmonth_short: [\"ΙΑΝ\", \"ΦΕΒ\", \"ΜΑΡ\", \"ΑΠΡ\", \"ΜΑΙ\", \"ΙΟΥΝ\", \"ΙΟΥΛ\", \"ΑΥΓ\", \"ΣΕΠ\", \"ΟΚΤ\", \"ΝΟΕ\", \"ΔΕΚ\"],\r\n\t\tday_full: [\"Κυριακή\", \"Δευτέρα\", \"Τρίτη\", \"Τετάρτη\", \"Πέμπτη\", \"Παρασκευή\", \"Κυριακή\"],\r\n\t\tday_short: [\"ΚΥ\", \"ΔΕ\", \"ΤΡ\", \"ΤΕ\", \"ΠΕ\", \"ΠΑ\", \"ΣΑ\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Νέα εργασία\",\r\n\t\ticon_save: \"Αποθήκευση\",\r\n\t\ticon_cancel: \"Άκυρο\",\r\n\t\ticon_details: \"Λεπτομέρειες\",\r\n\t\ticon_edit: \"Επεξεργασία\",\r\n\t\ticon_delete: \"Διαγραφή\",\r\n\t\tconfirm_closing: \"\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Το έργο θα διαγραφεί οριστικά. Θέλετε να συνεχίσετε;\",\r\n\t\tsection_description: \"Περιγραφή\",\r\n\t\tsection_time: \"Χρονική περίοδος\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Άκυρο\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\" Januar\", \" Februar\", \" März \", \" April\", \" Mai\", \" Juni\", \" Juli\", \" August\", \" September \", \" Oktober\", \" November \", \" Dezember\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mär\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"],\r\n\t\tday_full: [\"Sonntag\", \"Montag\", \"Dienstag\", \" Mittwoch\", \" Donnerstag\", \"Freitag\", \"Samstag\"],\r\n\t\tday_short: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Neue Aufgabe\",\r\n\t\ticon_save: \"Speichern\",\r\n\t\ticon_cancel: \"Abbrechen\",\r\n\t\ticon_details: \"Details\",\r\n\t\ticon_edit: \"Ändern\",\r\n\t\ticon_delete: \"Löschen\",\r\n\t\tconfirm_closing: \"\", // \"Ihre Veränderungen werden verloren sein, wollen Sie ergänzen? \"\r\n\t\tconfirm_deleting: \"Der Eintrag wird gelöscht\",\r\n\t\tsection_description: \"Beschreibung\",\r\n\t\tsection_time: \"Zeitspanne\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"PSP\",\r\n\t\tcolumn_text: \"Task-Namen\",\r\n\t\tcolumn_start_date: \"Startzeit\",\r\n\t\tcolumn_duration: \"Dauer\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"werden gelöscht\",\r\n\t\tlink_start: \"(starten)\",\r\n\t\tlink_end: \"(ende)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minuten\",\r\n\t\thours: \"Stunden\",\r\n\t\tdays: \"Tage\",\r\n\t\tweeks: \"Wochen\",\r\n\t\tmonths: \"Monate\",\r\n\t\tyears: \"Jahre\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Abbrechen\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Januar\", \"Februar\", \"Marts\", \"April\", \"Maj\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"December\"],\r\n\t\tmonth_short: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"Maj\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dec\"],\r\n\t\tday_full: [\"Søndag\", \"Mandag\", \"Tirsdag\", \"Onsdag\", \"Torsdag\", \"Fredag\", \"Lørdag\"],\r\n\t\tday_short: [\"Søn\", \"Man\", \"Tir\", \"Ons\", \"Tor\", \"Fre\", \"Lør\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Ny opgave\",\r\n\t\ticon_save: \"Gem\",\r\n\t\ticon_cancel: \"Fortryd\",\r\n\t\ticon_details: \"Detaljer\",\r\n\t\ticon_edit: \"Tilret\",\r\n\t\ticon_delete: \"Slet\",\r\n\t\tconfirm_closing: \"Dine rettelser vil gå tabt.. Er dy sikker?\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"Bigivenheden vil blive slettet permanent. Er du sikker?\",\r\n\t\tsection_description: \"Beskrivelse\",\r\n\t\tsection_time: \"Tidsperiode\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Fortryd\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Leden\", \"Únor\", \"Březen\", \"Duben\", \"Květen\", \"Červen\", \"Červenec\", \"Srpen\", \"Září\", \"Říjen\", \"Listopad\", \"Prosinec\"],\r\n\t\tmonth_short: [\"Led\", \"Ún\", \"Bře\", \"Dub\", \"Kvě\", \"Čer\", \"Čec\", \"Srp\", \"Září\", \"Říj\", \"List\", \"Pro\"],\r\n\t\tday_full: [\"Neděle\", \"Pondělí\", \"Úterý\", \"Středa\", \"Čtvrtek\", \"Pátek\", \"Sobota\"],\r\n\t\tday_short: [\"Ne\", \"Po\", \"Út\", \"St\", \"Čt\", \"Pá\", \"So\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nová práce\",\r\n\t\ticon_save: \"Uložit\",\r\n\t\ticon_cancel: \"Zpět\",\r\n\t\ticon_details: \"Detail\",\r\n\t\ticon_edit: \"Edituj\",\r\n\t\ticon_delete: \"Smazat\",\r\n\t\tconfirm_closing: \"\", // Vaše změny budou ztraceny, opravdu ?\r\n\t\tconfirm_deleting: \"Událost bude trvale smazána, opravdu?\",\r\n\t\tsection_description: \"Poznámky\",\r\n\t\tsection_time: \"Doba platnosti\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Zpět\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\nTranslation by FreezeSoul\r\n\r\nUpdate 26/10/2015:\r\nTranslation of new labels by zwh8800\r\n https://github.com/DHTMLX/gantt/pull/7\r\n\r\n*/\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\r\n\t\tmonth_short: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"],\r\n\t\tday_full: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\r\n\t\tday_short: [\"日\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"新任務\",\r\n\t\ticon_save: \"保存\",\r\n\t\ticon_cancel: \"关闭\",\r\n\t\ticon_details: \"详细\",\r\n\t\ticon_edit: \"编辑\",\r\n\t\ticon_delete: \"删除\",\r\n\t\tconfirm_closing: \"请确认是否撤销修改!\", // Your changes will be lost, are your sure?\r\n\t\tconfirm_deleting: \"是否删除日程?\",\r\n\t\tsection_description: \"描述\",\r\n\t\tsection_time: \"时间范围\",\r\n\t\tsection_type: \"类型\",\r\n\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"工作分解结构\",\r\n\t\tcolumn_text: \"任务名\",\r\n\t\tcolumn_start_date: \"开始时间\",\r\n\t\tcolumn_duration: \"持续时间\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\r\n\t\tlink: \"关联\",\r\n\t\tconfirm_link_deleting: \"将被删除\",\r\n\t\tlink_start: \" (开始)\",\r\n\t\tlink_end: \" (结束)\",\r\n\r\n\t\ttype_task: \"任务\",\r\n\t\ttype_project: \"项目\",\r\n\t\ttype_milestone: \"里程碑\",\r\n\r\n\t\tminutes: \"分钟\",\r\n\t\thours: \"小时\",\r\n\t\tdays: \"天\",\r\n\t\tweeks: \"周\",\r\n\t\tmonths: \"月\",\r\n\t\tyears: \"年\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"关闭\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","/*\r\n @Traducido por Vicente Adria Bohigues - vicenteadria@hotmail.com\r\n */\r\n\r\nconst locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Gener\", \"Febrer\", \"Març\", \"Abril\", \"Maig\", \"Juny\", \"Juliol\", \"Agost\", \"Setembre\", \"Octubre\", \"Novembre\", \"Desembre\"],\r\n\t\tmonth_short: [\"Gen\", \"Feb\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Oct\", \"Nov\", \"Des\"],\r\n\t\tday_full: [\"Diumenge\", \"Dilluns\", \"Dimarts\", \"Dimecres\", \"Dijous\", \"Divendres\", \"Dissabte\"],\r\n\t\tday_short: [\"Dg\", \"Dl\", \"Dm\", \"Dc\", \"Dj\", \"Dv\", \"Ds\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Nova tasca\",\r\n\t\ticon_save: \"Guardar\",\r\n\t\ticon_cancel: \"Cancel·lar\",\r\n\t\ticon_details: \"Detalls\",\r\n\t\ticon_edit: \"Editar\",\r\n\t\ticon_delete: \"Esborrar\",\r\n\t\tconfirm_closing: \"\", // \"Els seus canvis es perdràn, continuar ?\"\r\n\t\tconfirm_deleting: \"L'esdeveniment s'esborrarà definitivament, continuar ?\",\r\n\t\tsection_description: \"Descripció\",\r\n\t\tsection_time: \"Periode de temps\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Cancel·lar\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"Студзень\", \"Люты\", \"Сакавік\", \"Красавік\", \"Maй\", \"Чэрвень\", \"Ліпень\", \"Жнівень\", \"Верасень\", \"Кастрычнік\", \"Лістапад\", \"Снежань\"],\r\n\t\tmonth_short: [\"Студз\", \"Лют\", \"Сак\", \"Крас\", \"Maй\", \"Чэр\", \"Ліп\", \"Жнів\", \"Вер\", \"Каст\", \"Ліст\", \"Снеж\"],\r\n\t\tday_full: [\"Нядзеля\", \"Панядзелак\", \"Аўторак\", \"Серада\", \"Чацвер\", \"Пятніца\", \"Субота\"],\r\n\t\tday_short: [\"Нд\", \"Пн\", \"Аўт\", \"Ср\", \"Чцв\", \"Пт\", \"Сб\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"Новае заданне\",\r\n\t\ticon_save: \"Захаваць\",\r\n\t\ticon_cancel: \"Адмяніць\",\r\n\t\ticon_details: \"Дэталі\",\r\n\t\ticon_edit: \"Змяніць\",\r\n\t\ticon_delete: \"Выдаліць\",\r\n\t\tconfirm_closing: \"\", // Унесеныя змены будуць страчаны, працягнуць?\r\n\t\tconfirm_deleting: \"Падзея будзе выдалена незваротна, працягнуць?\",\r\n\t\tsection_description: \"Апісанне\",\r\n\t\tsection_time: \"Перыяд часу\",\r\n\t\tsection_type: \"Тып\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"ІСР\",\r\n\t\tcolumn_text: \"Задача\",\r\n\t\tcolumn_start_date: \"Пачатак\",\r\n\t\tcolumn_duration: \"Працяг\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Сувязь\",\r\n\t\tconfirm_link_deleting: \"будзе выдалена\",\r\n\t\tlink_start: \"(пачатак)\",\r\n\t\tlink_end: \"(канец)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\r\n\t\tminutes: \"Хвiлiна\",\r\n\t\thours: \"Гадзiна\",\r\n\t\tdays: \"Дзень\",\r\n\t\tweeks: \"Тыдзень\",\r\n\t\tmonths: \"Месяц\",\r\n\t\tyears: \"Год\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"Адмяніць\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","const locale: IGanttLocale = {\r\n\tdate: {\r\n\t\tmonth_full: [\"كانون الثاني\", \"شباط\", \"آذار\", \"نيسان\", \"أيار\", \"حزيران\", \"تموز\", \"آب\", \"أيلول\", \"تشرين الأول\", \"تشرين الثاني\", \"كانون الأول\"],\r\n\t\tmonth_short: [\"يناير\", \"فبراير\", \"مارس\", \"أبريل\", \"مايو\", \"يونيو\", \"يوليو\", \"أغسطس\", \"سبتمبر\", \"أكتوبر\", \"نوفمبر\", \"ديسمبر\"],\r\n\t\tday_full: [\"الأحد\", \"الأثنين\", \"ألثلاثاء\", \"الأربعاء\", \"ألحميس\", \"ألجمعة\", \"السبت\"],\r\n\t\tday_short: [\"احد\", \"اثنين\", \"ثلاثاء\", \"اربعاء\", \"خميس\", \"جمعة\", \"سبت\"]\r\n\t},\r\n\tlabels: {\r\n\t\tnew_task: \"مهمة جديد\",\r\n\t\ticon_save: \"اخزن\",\r\n\t\ticon_cancel: \"الغاء\",\r\n\t\ticon_details: \"تفاصيل\",\r\n\t\ticon_edit: \"تحرير\",\r\n\t\ticon_delete: \"حذف\",\r\n\t\tconfirm_closing: \"التغييرات سوف تضيع, هل انت متأكد؟\", // Your changes will be lost, are your sure ?\r\n\t\tconfirm_deleting: \"الحدث سيتم حذفها نهائيا ، هل أنت متأكد؟\",\r\n\t\tsection_description: \"الوصف\",\r\n\t\tsection_time: \"الفترة الزمنية\",\r\n\t\tsection_type: \"Type\",\r\n\t\t/* grid columns */\r\n\r\n\t\tcolumn_wbs: \"WBS\",\r\n\t\tcolumn_text: \"Task name\",\r\n\t\tcolumn_start_date: \"Start time\",\r\n\t\tcolumn_duration: \"Duration\",\r\n\t\tcolumn_add: \"\",\r\n\r\n\t\t/* link confirmation */\r\n\t\tlink: \"Link\",\r\n\t\tconfirm_link_deleting: \"will be deleted\",\r\n\t\tlink_start: \" (start)\",\r\n\t\tlink_end: \" (end)\",\r\n\r\n\t\ttype_task: \"Task\",\r\n\t\ttype_project: \"Project\",\r\n\t\ttype_milestone: \"Milestone\",\r\n\r\n\t\tminutes: \"Minutes\",\r\n\t\thours: \"Hours\",\r\n\t\tdays: \"Days\",\r\n\t\tweeks: \"Week\",\r\n\t\tmonths: \"Months\",\r\n\t\tyears: \"Years\",\r\n\r\n\t\t/* message popup */\r\n\t\tmessage_ok: \"OK\",\r\n\t\tmessage_cancel: \"الغاء\",\r\n\r\n\t\t/* constraints */\r\n\t\tsection_constraint: \"Constraint\",\r\n\t\tconstraint_type: \"Constraint type\",\r\n\t\tconstraint_date: \"Constraint date\",\r\n\t\tasap: \"As Soon As Possible\",\r\n\t\talap: \"As Late As Possible\",\r\n\t\tsnet: \"Start No Earlier Than\",\r\n\t\tsnlt: \"Start No Later Than\",\r\n\t\tfnet: \"Finish No Earlier Than\",\r\n\t\tfnlt: \"Finish No Later Than\",\r\n\t\tmso: \"Must Start On\",\r\n\t\tmfo: \"Must Finish On\",\r\n\r\n\t\t/* resource control */\r\n\t\tresources_filter_placeholder: \"type to filter\",\r\n\t\tresources_filter_label: \"hide empty\"\r\n\t}\r\n};\r\n\r\nexport default locale;","import ar from \"./locale_ar\";\r\nimport be from \"./locale_be\";\r\nimport ca from \"./locale_ca\";\r\nimport cn from \"./locale_cn\";\r\nimport cs from \"./locale_cs\";\r\nimport da from \"./locale_da\";\r\nimport de from \"./locale_de\";\r\nimport el from \"./locale_el\";\r\nimport en from \"./locale_en\";\r\nimport es from \"./locale_es\";\r\nimport fa from \"./locale_fa\";\r\nimport fi from \"./locale_fi\";\r\nimport fr from \"./locale_fr\";\r\nimport he from \"./locale_he\";\r\nimport hr from \"./locale_hr\";\r\nimport hu from \"./locale_hu\";\r\nimport id from \"./locale_id\";\r\nimport jp from \"./locale_jp\";\r\nimport kr from \"./locale_kr\";\r\n\r\nimport LocaleManager from \"./locale_manager\";\r\n\r\nimport nb from \"./locale_nb\";\r\nimport nl from \"./locale_nl\";\r\nimport no from \"./locale_no\";\r\nimport pl from \"./locale_pl\";\r\nimport ro from \"./locale_ro\";\r\nimport ru from \"./locale_ru\";\r\nimport si from \"./locale_si\";\r\nimport sk from \"./locale_sk\";\r\nimport sv from \"./locale_sv\";\r\nimport tr from \"./locale_tr\";\r\nimport ua from \"./locale_ua\";\r\n\r\nexport default function(){\r\n\treturn new LocaleManager({\r\n\t\ten,\r\n\t\tar,\r\n\t\tbe,\r\n\t\tca,\r\n\t\tcn,\r\n\t\tcs,\r\n\t\tda,\r\n\t\tde,\r\n\t\tel,\r\n\t\tes,\r\n\t\tfa,\r\n\t\tfi,\r\n\t\tfr,\r\n\t\the,\r\n\t\thr,\r\n\t\thu,\r\n\t\tid,\r\n\t\tjp,\r\n\t\tkr,\r\n\t\tnb,\r\n\t\tnl,\r\n\t\tno,\r\n\t\tpl,\r\n\t\tro,\r\n\t\tru,\r\n\t\tsi,\r\n\t\tsk,\r\n\t\tsv,\r\n\t\ttr,\r\n\t\tua\r\n\t});\r\n}","// all builds except for evaluation version get this mockup\r\n// the evaluation build gets actual codes\r\nexport default () => {};","function extend(gantt){\r\n\r\n\tgantt.destructor = function(){\r\n\t\tgantt.callEvent(\"onDestroy\", []);\r\n\t\tthis.clearAll();\r\n\r\n\t\tif(this.$root){\r\n\t\t\tdelete this.$root.gantt;\r\n\t\t}\r\n\r\n\t\tthis._eventRemoveAll();\r\n\t\tif(this.$layout){\r\n\t\t\tthis.$layout.destructor();\r\n\t\t}\r\n\r\n\t\tthis.resetLightbox();\r\n\r\n\t\tif(this._dp && this._dp.destructor){\r\n\t\t\tthis._dp.destructor();\r\n\t\t}\r\n\t\tthis.$services.destructor();\r\n\r\n\t\t// detachAllEvents should be called last, because in components may be attached events\r\n\t\tthis.detachAllEvents();\r\n\r\n\t\tfor(var i in this){\r\n\t\t\tif(i.indexOf(\"$\") === 0){\r\n\t\t\t\tdelete this[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\tgantt.$destroyed = true;\r\n\t};\r\n}\r\n\r\nmodule.exports = extend;\r\n","/*\r\n \tasserts will be removed in final code, so you can place them anythere\r\n\twithout caring about performance impacts\r\n*/\r\n\r\nmodule.exports = function(gantt){\r\n\treturn function assert(check, message){\r\n\t\tif (!check){\r\n\t\t\tif(gantt.config.show_errors && gantt.callEvent(\"onError\",[message]) !== false) {\r\n\t\t\t\tgantt.message({type: \"error\", text: message, expire: -1});\r\n\r\n\t\t\t\t// eslint-disable-next-line no-debugger\r\n\t\t\t\tdebugger;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n};","function addResizeListener(gantt){\r\n\tvar containerStyles = window.getComputedStyle(gantt.$root);\r\n\tif(containerStyles.getPropertyValue(\"position\") == \"static\"){\r\n\t\tgantt.$root.style.position = \"relative\";\r\n\t}\r\n\r\n\tvar resizeWatcher = document.createElement('iframe');\r\n\tresizeWatcher.className = \"gantt_container_resize_watcher\";\r\n\tresizeWatcher.tabIndex = -1;\r\n\tif(gantt.config.wai_aria_attributes){\r\n\t\tresizeWatcher.setAttribute(\"role\", \"none\");\r\n\t\tresizeWatcher.setAttribute(\"aria-hidden\", true);\r\n\t}\r\n\r\n\t// in some environments (namely, in SalesForce) iframe.contentWindow is not available\r\n\tgantt.$root.appendChild(resizeWatcher);\r\n\tif (resizeWatcher.contentWindow) {\r\n\t\tlistenWindowResize(gantt, resizeWatcher.contentWindow);\r\n\t} else {\r\n\t\t// if so - ditch the iframe and fallback to listening the main window resize\r\n\t\tgantt.$root.removeChild(resizeWatcher);\r\n\t\tlistenWindowResize(gantt, window);\r\n\t}\r\n}\r\n\r\nfunction listenWindowResize(gantt, window){\r\n\tvar resizeDelay;\r\n\tgantt.event(window, \"resize\", function(){\r\n\t\tclearTimeout(resizeDelay);\r\n\t\tresizeDelay = setTimeout(function(){\r\n\t\t\tgantt.render();\r\n\t\t}, 300);\r\n\t});\r\n}\r\n\r\nmodule.exports = addResizeListener;","var domHelpers = require(\"./ui/utils/dom_helpers\"),\r\n\thelpers = require(\"../utils/helpers\");\r\nvar isHeadless = require(\"../utils/is_headless\");\r\nvar addResizeListener = require(\"./ui/resize_listener\");\r\n\r\nmodule.exports = function(gantt){\r\n\tvar calculateScaleRange = require(\"./gantt_data_range\");\r\n\r\n\tgantt.assert = require(\"./common/assert\")(gantt);\r\n\r\n//initial initialization\r\n\tgantt.init = function(node, from, to){\r\n\t\tif(from && to){\r\n\t\t\tthis.config.start_date = this._min_date = new Date(from);\r\n\t\t\tthis.config.end_date = this._max_date = new Date(to);\r\n\t\t}\r\n\t\tthis.date.init();\r\n\r\n\t\t//can be called only once\r\n\t\tthis.init = function(node){\r\n\t\t\tif (this.$container && this.$container.parentNode){\r\n\t\t\t\tthis.$container.parentNode.removeChild(this.$container);\r\n\t\t\t\tthis.$container = null;\r\n\t\t\t}\r\n\r\n\t\t\tif(this.$layout){\r\n\t\t\t\tthis.$layout.clear();\r\n\t\t\t}\r\n\t\t\tthis._reinit(node);\r\n\t\t};\r\n\r\n\t\tthis._reinit(node);\r\n\t};\r\n\r\n\r\n\tvar dropLayout = (function dropLayout(){\r\n\t\tif(this._clearTaskLayers){\r\n\t\t\tthis._clearTaskLayers();\r\n\t\t}\r\n\r\n\t\tif(this._clearLinkLayers){\r\n\t\t\tthis._clearLinkLayers();\r\n\t\t}\r\n\r\n\t\tif(this.$layout){\r\n\t\t\tthis.$layout.destructor();\r\n\t\t\tthis.$layout = null;\r\n\t\t\tthis.$ui.reset();\r\n\t\t}\r\n\t}).bind(gantt);\r\n\r\n\tvar rebuildLayout = (function rebuildLayout(){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.$root.innerHTML = \"\";\r\n\t\t\r\n\t\tthis.$root.gantt = this;\r\n\t\tcalculateScaleRange(this);\r\n\t\tthis.config.layout.id = \"main\";\r\n\t\tthis.$layout = this.$ui.createView(\"layout\", this.$root, this.config.layout);\r\n\r\n\t\tthis.$layout.attachEvent(\"onBeforeResize\", function(){\r\n\t\t\tvar storeNames = gantt.$services.getService(\"datastores\");\r\n\t\t\tfor(var i = 0; i < storeNames.length; i++){\r\n\t\t\t\tgantt.getDatastore(storeNames[i]).filter();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis.$layout.attachEvent(\"onResize\", function(){\r\n\t\t\tgantt.refreshData();\r\n\t\t});\r\n\r\n\t\tthis.callEvent(\"onGanttLayoutReady\", []);\r\n\t\tthis.$layout.render();\r\n\r\n\t\tthis.$container = this.$layout.$container.firstChild;\r\n\r\n\t\taddResizeListener(this);\r\n\t}).bind(gantt);\r\n\r\n\tgantt.resetLayout = function(){\r\n\t\tdropLayout();\r\n\t\trebuildLayout();\r\n\t\tthis.render();\r\n\t};\r\n\r\n\tgantt._reinit = function(node){\r\n\t\tthis.callEvent(\"onBeforeGanttReady\", []);\r\n\t\tthis._update_flags();\r\n\r\n\t\tvar config = this.$services.getService(\"templateLoader\");\r\n\t\tconfig.initTemplates(this);\r\n\r\n\t\tdropLayout();\r\n\r\n\t\tif(node){\r\n\t\t\tthis.$root = domHelpers.toNode(node);\r\n\t\t\trebuildLayout();\r\n\t\t\tthis.$mouseEvents.reset(this.$root);\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onTemplatesReady\",[]);\r\n\t\r\n\t\tthis.callEvent(\"onGanttReady\", []);\r\n\r\n\t\tthis.render();\r\n\t};\r\n\r\n\tgantt.$click={\r\n\t\tbuttons:{\r\n\t\t\t\"edit\": function(id) {\r\n\t\t\t\tif (gantt.isReadonly(gantt.getTask(id))) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tgantt.showLightbox(id);\r\n\t\t\t},\r\n\t\t\t\"delete\": function(id) {\r\n\t\t\t\tvar task = gantt.getTask(id);\r\n\t\t\t\tif (gantt.isReadonly(task)) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar question = gantt.locale.labels.confirm_deleting;\r\n\t\t\t\tvar title = gantt.locale.labels.confirm_deleting_title;\r\n\r\n\t\t\t\tgantt._dhtmlx_confirm(question, title, function(){\r\n\t\t\t\t\tif(!gantt.isTaskExists(id)){\r\n\t\t\t\t\t\tgantt.hideLightbox();\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(task.$new){\r\n\t\t\t\t\t\tgantt.silent(function(){\r\n\t\t\t\t\t\t\tgantt.deleteTask(id, true);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tgantt.refreshData();\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tgantt.deleteTask(id);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgantt.hideLightbox();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n//renders self\r\n\tgantt.render = function(){\r\n\t\tthis.callEvent(\"onBeforeGanttRender\", []);\r\n\r\n\t\tvar visibleDate;\r\n\t\tif(!isHeadless(gantt)){\r\n\t\t\tif (!this.config.sort && this._sort) {\r\n\t\t\t\tthis._sort = undefined;\r\n\t\t\t}\r\n\r\n\t\t\tif(this.$root){\r\n\t\t\t\tif(this.config.rtl){\r\n\t\t\t\t\tthis.$root.classList.add(\"gantt_rtl\");\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthis.$root.classList.remove(\"gantt_rtl\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar pos = this.getScrollState();\r\n\t\t\tvar posX = pos ? pos.x : 0;\r\n\t\t\tif(this._getHorizontalScrollbar()){\r\n\t\t\t\tvar scrollbar = this._getHorizontalScrollbar();\r\n\t\t\t\tposX = scrollbar.$config.codeScrollLeft || posX || 0;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tvisibleDate = null;\r\n\t\t\tif(posX){\r\n\t\t\t\tvisibleDate = gantt.dateFromPos(posX + this.config.task_scroll_offset);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcalculateScaleRange(this);\r\n\r\n\t\tif(!isHeadless(gantt)){\r\n\t\t\tthis.$layout.$config.autosize = this.config.autosize;\r\n\t\t\tthis.$layout.resize();\r\n\r\n\t\t\tif(this.config.preserve_scroll && pos){\r\n\r\n\t\t\t\tif(posX){\r\n\t\t\t\t\tvar new_pos = gantt.getScrollState();\r\n\t\t\t\t\tvar new_date = gantt.dateFromPos(new_pos.x);\r\n\t\t\t\t\tif(!(+visibleDate == +new_date && new_pos.y == pos.y)){\r\n\t\t\t\t\t\tif(visibleDate){\r\n\t\t\t\t\t\t\tthis.showDate(visibleDate);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(pos.y)\r\n\t\t\t\t\t\t\tgantt.scrollTo(undefined, pos.y);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}else{\r\n\t\t\tgantt.refreshData();\r\n\t\t}\r\n\t\tthis.callEvent(\"onGanttRender\", []);\r\n\t};\r\n\r\n\t//TODO: add layout.resize method that wouldn't trigger data repaint\r\n\tgantt.setSizes = gantt.render;\r\n\r\n\r\n\tgantt.getTaskRowNode = function(id) {\r\n\t\tvar els = this.$grid_data.childNodes;\r\n\t\tvar attribute = this.config.task_attribute;\r\n\t\tfor (var i = 0; i < els.length; i++) {\r\n\t\t\tif (els[i].getAttribute) {\r\n\t\t\t\tvar value = els[i].getAttribute(attribute);\r\n\t\t\t\tif (value == id) return els[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\r\n\tgantt.changeLightboxType = function(type){\r\n\t\tif(this.getLightboxType() == type)\r\n\t\t\treturn true;\r\n\t\tgantt._silent_redraw_lightbox(type);\r\n\t};\r\n\r\n\tgantt._get_link_type = function (from_start, to_start) {\r\n\t\tvar type = null;\r\n\t\tif (from_start && to_start) {\r\n\t\t\ttype = gantt.config.links.start_to_start;\r\n\t\t} else if (!from_start && to_start) {\r\n\t\t\ttype = gantt.config.links.finish_to_start;\r\n\t\t} else if (!from_start && !to_start) {\r\n\t\t\ttype = gantt.config.links.finish_to_finish;\r\n\t\t} else if (from_start && !to_start) {\r\n\t\t\ttype = gantt.config.links.start_to_finish;\r\n\t\t}\r\n\t\treturn type;\r\n\t};\r\n\r\n\tgantt.isLinkAllowed = function (from, to, from_start, to_start) {\r\n\t\tvar link = null;\r\n\t\tif (typeof(from) == \"object\") {\r\n\t\t\tlink = from;\r\n\t\t} else {\r\n\t\t\tlink = {source: from, target: to, type: this._get_link_type(from_start, to_start)};\r\n\t\t}\r\n\r\n\t\tif (!link) return false;\r\n\t\tif (!(link.source && link.target && link.type)) return false;\r\n\t\tif (link.source == link.target) return false;\r\n\r\n\t\tvar res = true;\r\n\t\t//any custom rules\r\n\t\tif (this.checkEvent(\"onLinkValidation\"))\r\n\t\t\tres = this.callEvent(\"onLinkValidation\", [link]);\r\n\r\n\t\treturn res;\r\n\t};\r\n\r\n\r\n\tgantt._correct_dst_change = function(date, prevOffset, step, unit){\r\n\t\tvar time_unit = helpers.getSecondsInUnit(unit) * step;\r\n\t\tif(time_unit > 60*60 && time_unit < 60*60*24){\r\n\t\t\t//correct dst change only if current unit is more than one hour and less than day (days have own checking), e.g. 12h\r\n\t\t\tvar offsetChanged = date.getTimezoneOffset() - prevOffset;\r\n\t\t\tif(offsetChanged){\r\n\t\t\t\tdate = gantt.date.add(date, offsetChanged, \"minute\");\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn date;\r\n\t};\r\n\r\n\tgantt.isSplitTask = function(task){\r\n\t\tgantt.assert(task && task instanceof Object, \"Invalid argument task=\"+task+\" of gantt.isSplitTask. Task object was expected\");\r\n\t\treturn this.$data.tasksStore._isSplitItem(task);\r\n\t};\r\n\r\n\tgantt._is_icon_open_click = function(e) {\r\n\t\tif (!e)\r\n\t\t\treturn false;\r\n\t\tvar target = e.target || e.srcElement;\r\n\t\tif (!(target && target.className))\r\n\t\t\treturn false;\r\n\t\tvar className = domHelpers.getClassName(target);\r\n\t\tif (className.indexOf(\"gantt_tree_icon\") !== -1 && (className.indexOf(\"gantt_close\") !== -1 || className.indexOf(\"gantt_open\") !== -1))\r\n\t\t\treturn true;\r\n\t\treturn false;\r\n\t};\r\n\r\n};","/*\r\n reuse results of functions that can be recalculated during rendering\r\n greatly increases the rendering speed when critical path enabled\r\n Sample - 94_dev/critical_path.html\r\n\r\n */\r\nmodule.exports = function(gantt){\r\n\r\ngantt._cached_functions = {\r\n\tcache: {},\r\n\tmode: false,\r\n\tcritical_path_mode: false,\r\n\twrap_methods : function(methods, object){\r\n\t\tif(object._prefetch_originals){\r\n\t\t\tfor(var i in object._prefetch_originals){\r\n\t\t\t\tobject[i] = object._prefetch_originals[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\tobject._prefetch_originals = {};\r\n\t\tfor(var i = 0; i < methods.length; i++)\r\n\t\t\tthis.prefetch(methods[i], object);\r\n\r\n\t},\r\n\tprefetch : function(methodname, host){\r\n\t\tvar original = host[methodname];\r\n\t\tif(original){\r\n\t\t\tvar optimizer = this;\r\n\r\n\t\t\thost._prefetch_originals[methodname] = original;\r\n\t\t\thost[methodname] = function get_prefetched_value(){\r\n\r\n\t\t\t\tvar argumentsArray = new Array(arguments.length);\r\n\t\t\t\tfor (var i = 0, l = arguments.length; i < l; i++) {\r\n\t\t\t\t\targumentsArray[i] = arguments[i];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(optimizer.active){\r\n\t\t\t\t\tvar args = optimizer.get_arguments_hash(Array.prototype.slice.call(argumentsArray));\r\n\t\t\t\t\tif(!optimizer.cache[methodname]){\r\n\t\t\t\t\t\toptimizer.cache[methodname] = {};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar cached_values = optimizer.cache[methodname];\r\n\r\n\t\t\t\t\tif(optimizer.has_cached_value(cached_values, args)){\r\n\t\t\t\t\t\treturn optimizer.get_cached_value(cached_values, args);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tvar value = original.apply(this, argumentsArray);\r\n\t\t\t\t\t\toptimizer.cache_value(cached_values, args, value);\r\n\t\t\t\t\t\treturn value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn original.apply(this, argumentsArray);\r\n\t\t\t};\r\n\t\t}\r\n\t\treturn original;\r\n\t},\r\n\tcache_value: function(cache, arguments_hash, value){\r\n\t\tif(this.is_date(value))\r\n\t\t\tvalue = new Date(value);\r\n\t\tcache[arguments_hash] = value;\r\n\t},\r\n\thas_cached_value: function(cache, arguments_hash){\r\n\t\treturn cache.hasOwnProperty(arguments_hash);\r\n\t},\r\n\tget_cached_value: function(cache, arguments_hash){\r\n\t\tvar data = cache[arguments_hash];\r\n\r\n\t\t//for cached dates - return copy\r\n\t\tif(this.is_date(data)){\r\n\t\t\tdata = new Date(data);\r\n\t\t}\r\n\t\treturn data;\r\n\t},\r\n\tis_date: function(value){\r\n\t\treturn (value && value.getUTCDate);\r\n\t},\r\n\tget_arguments_hash:function(args){\r\n\t\tvar values = [];\r\n\t\tfor(var i = 0; i < args.length; i++){\r\n\t\t\tvalues.push(this.stringify_argument(args[i]));\r\n\t\t}\r\n\t\treturn \"(\" + values.join(\";\") + \")\";\r\n\t},\r\n\tstringify_argument: function(value){\r\n\t\t//expecting task or link, or any other data entries, dates and primitive values\r\n\t\tvar ret = \"\";\r\n\t\tif(value.id){\r\n\t\t\tret = value.id;\r\n\t\t}else if(this.is_date(value)){\r\n\t\t\tret = value.valueOf();\r\n\t\t}else{\r\n\t\t\tret = value;\r\n\t\t}\r\n\t\treturn ret + \"\";\r\n\t},\r\n\tactivate: function(){\r\n\t\tthis.clear();\r\n\t\tthis.active = true;\r\n\t},\r\n\tdeactivate: function(){\r\n\t\tthis.clear();\r\n\t\tthis.active = false;\r\n\t},\r\n\tclear: function(){\r\n\t\tthis.cache = {};\r\n\t},\r\n\r\n\tsetup: function(gantt){\r\n\t\tvar override_gantt = [];\r\n\r\n\t\tvar gantt_methods = [\r\n\t\t\t'_isProjectEnd',\r\n\t\t\t'_getProjectEnd',\r\n\t\t\t'_getSlack'\r\n\t\t];\r\n\r\n\r\n\r\n\t\tif(this.mode == 'auto'){\r\n\t\t\tif(gantt.config.highlight_critical_path){\r\n\t\t\t\toverride_gantt = gantt_methods;\r\n\t\t\t}\r\n\t\t}else if(this.mode === true){\r\n\t\t\toverride_gantt = gantt_methods;\r\n\t\t}\r\n\r\n\t\tthis.wrap_methods(override_gantt, gantt);\r\n\r\n\t},\r\n\tupdate_if_changed: function(gantt){\r\n\t\tvar changed = (this.critical_path_mode != gantt.config.highlight_critical_path ||\r\n\t\t\t\t\t\tthis.mode !== gantt.config.optimize_render);\r\n\t\tif(changed){\r\n\t\t\tthis.critical_path_mode = gantt.config.highlight_critical_path;\r\n\t\t\tthis.mode = gantt.config.optimize_render;\r\n\t\t\tthis.setup(gantt);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nfunction activate(){\r\n\tgantt._cached_functions.update_if_changed(gantt);\r\n\tif(!gantt._cached_functions.active){\r\n\t\tgantt._cached_functions.activate();\r\n\t}\r\n\treturn true;\r\n}\r\ngantt.attachEvent(\"onBeforeGanttRender\", activate);\r\ngantt.attachEvent(\"onBeforeDataRender\", activate);\r\ngantt.attachEvent(\"onBeforeSmartRender\", function(){\r\n\tactivate();\r\n});\r\ngantt.attachEvent(\"onBeforeParse\", activate);\r\ngantt.attachEvent(\"onDataRender\", function(){\r\n\tgantt._cached_functions.deactivate();\r\n});\r\nvar deactivTimeout = null;\r\ngantt.attachEvent(\"onSmartRender\", function(){\r\n\tif(deactivTimeout)\r\n\t\tclearTimeout(deactivTimeout);\r\n\tdeactivTimeout = setTimeout(function(){\r\n\t\tgantt._cached_functions.deactivate();\r\n\t}, 1000);\r\n});\r\n\r\ngantt.attachEvent(\"onBeforeGanttReady\", function(){\r\n\tgantt._cached_functions.update_if_changed(gantt);\r\n\treturn true;\r\n});\r\n\r\n};","module.exports = function(gantt) {\r\n\tgantt.getTaskType = function (type) {\r\n\t\tvar checkType = type;\r\n\t\tif(type && typeof type == \"object\"){\r\n\t\t\tcheckType = type.type;\r\n\t\t}\r\n\r\n\t\tfor (var i in this.config.types) {\r\n\t\t\tif (this.config.types[i] == checkType) {\r\n\t\t\t\treturn checkType;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn gantt.config.types.task;\r\n\t};\r\n};","// all builds except for evaluation version get this mockup\r\n// the evaluation build gets actual codes\r\nexport default () => {};","var helpers = require(\"../utils/helpers\");\r\n\r\nmodule.exports = function(gantt) {\r\n\r\n\tgantt.isUnscheduledTask = function (task) {\r\n\t\tgantt.assert(task && task instanceof Object, \"Invalid argument task=\"+task+\" of gantt.isUnscheduledTask. Task object was expected\");\r\n\t\treturn (!!task.unscheduled || !task.start_date);\r\n\t};\r\n\r\n\tgantt._isAllowedUnscheduledTask = function (task) {\r\n\t\treturn !!(task.unscheduled && gantt.config.show_unscheduled);\r\n\t};\r\n\r\n\tgantt._isTaskInTimelineLimits = function(task) {\r\n\t\tvar taskStart = task.start_date ? task.start_date.valueOf() : null;\r\n\t\tvar taskEnd = task.end_date ? task.end_date.valueOf() : null;\r\n\t\treturn !!(taskStart && taskEnd && taskStart <= this._max_date.valueOf() && taskEnd >= this._min_date.valueOf());\r\n\t};\r\n\tgantt.isTaskVisible = function (id) {\r\n\t\tif (!this.isTaskExists(id)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar task = this.getTask(id);\r\n\t\tif (!(this._isAllowedUnscheduledTask(task) || this._isTaskInTimelineLimits(task))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn !!(this.getGlobalTaskIndex(id) >= 0);\r\n\t};\r\n\r\n\tgantt._getProjectEnd = function() {\r\n\t\tif(gantt.config.project_end){\r\n\t\t\treturn gantt.config.project_end;\r\n\t\t}else{\r\n\t\t\tvar tasks = gantt.getTaskByTime();\r\n\t\t\ttasks = tasks.sort(function (a, b) {\r\n\t\t\t\treturn +a.end_date > +b.end_date ? 1 : -1;\r\n\t\t\t});\r\n\t\t\treturn tasks.length ? tasks[tasks.length - 1].end_date : null;\r\n\t\t}\r\n\t};\r\n\tgantt._getProjectStart = function() {\r\n\t\tif (gantt.config.project_start) {\r\n\t\t\treturn gantt.config.project_start;\r\n\t\t}\r\n\r\n\t\t// use timeline start if project start is not specified\r\n\t\tif (gantt.config.start_date) {\r\n\t\t\treturn gantt.config.start_date;\r\n\t\t}\r\n\t\tif (gantt.getState().min_date) {\r\n\t\t\treturn gantt.getState().min_date;\r\n\t\t}\r\n\r\n\t\t// earliest task start if neither project start nor timeline are specified\r\n\t\tvar tasks = gantt.getTaskByTime();\r\n\t\ttasks = tasks.sort(function (a, b) {\r\n\t\t\treturn +a.start_date > +b.start_date ? 1 : -1;\r\n\t\t});\r\n\t\treturn tasks.length ? tasks[0].start_date : null;\r\n\t};\r\n\r\n\tvar getDefaultTaskDate = function (item, parent_id) {\r\n\t\tvar parent = (parent_id && parent_id != gantt.config.root_id) ? gantt.getTask(parent_id) : false,\r\n\t\t\tstartDate = null;\r\n\t\tif (parent) {\r\n\t\t\tif(gantt.config.schedule_from_end){\r\n\t\t\t\tstartDate = gantt.calculateEndDate({\r\n\t\t\t\t\tstart_date: parent.end_date,\r\n\t\t\t\t\tduration: - gantt.config.duration_step,\r\n\t\t\t\t\ttask:item\r\n\t\t\t\t});\r\n\t\t\t}else{\r\n\t\t\t\tstartDate = parent.start_date;\r\n\t\t\t}\r\n\r\n\t\t} else if(gantt.config.schedule_from_end) {\r\n\t\t\tstartDate = gantt.calculateEndDate({\r\n\t\t\t\tstart_date: gantt._getProjectEnd(),\r\n\t\t\t\tduration: - gantt.config.duration_step,\r\n\t\t\t\ttask:item\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tvar first = gantt.getTaskByIndex(0);\r\n\t\t\tstartDate = first ? (first.start_date ? first.start_date : (first.end_date ? gantt.calculateEndDate({\r\n\t\t\t\tstart_date: first.end_date,\r\n\t\t\t\tduration: -gantt.config.duration_step,\r\n\t\t\t\ttask:item\r\n\t\t\t}) : null)) : gantt.config.start_date || gantt.getState().min_date;\r\n\t\t}\r\n\t\tgantt.assert(startDate, \"Invalid dates\");\r\n\t\treturn new Date(startDate);\r\n\t};\r\n\r\n\tgantt._set_default_task_timing = function (task) {\r\n\t\ttask.start_date = task.start_date || getDefaultTaskDate(task, gantt.getParent(task));\r\n\t\ttask.duration = task.duration || gantt.config.duration_step;\r\n\t\ttask.end_date = task.end_date || gantt.calculateEndDate(task);\r\n\t};\r\n\r\n\tgantt.createTask = function (item, parent, index) {\r\n\t\titem = item || {};\r\n\r\n\t\tif (!gantt.defined(item.id))\r\n\t\t\titem.id = gantt.uid();\r\n\r\n\t\tif (!item.start_date) {\r\n\t\t\titem.start_date = getDefaultTaskDate(item, parent);\r\n\t\t}\r\n\t\tif (item.text === undefined) {\r\n\t\t\titem.text = gantt.locale.labels.new_task;\r\n\t\t}\r\n\t\tif (item.duration === undefined) {\r\n\t\t\titem.duration = 1;\r\n\t\t}\r\n\r\n\t\tif (this.isTaskExists(parent)) {\r\n\t\t\tthis.setParent(item, parent, true);\r\n\t\t\tvar parentObj = this.getTask(parent);\r\n\t\t\tparentObj.$open = true;\r\n\t\t}\r\n\r\n\t\tif (!this.callEvent(\"onTaskCreated\", [item])) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tif (this.config.details_on_create) {\r\n\t\t\titem.$new = true;\r\n\t\t\tthis.silent(function(){\r\n\t\t\t\tgantt.$data.tasksStore.addItem(item, index);\r\n\t\t\t});\r\n\t\t\tthis.selectTask(item.id);\r\n\t\t\tthis.refreshData();\r\n\t\t\tthis.showLightbox(item.id);\r\n\t\t} else {\r\n\t\t\tif (this.addTask(item, parent, index)) {\r\n\t\t\t\tthis.showTask(item.id);\r\n\t\t\t\tthis.selectTask(item.id);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn item.id;\r\n\t};\r\n\r\n\tgantt._update_flags = function (oldid, newid) {\r\n\t\t// TODO: need a proper way to update all possible flags\r\n\t\tvar store = gantt.$data.tasksStore;\r\n\t\tif (oldid === undefined) {\r\n\t\t\tthis._lightbox_id = null;\r\n\r\n\t\t\tstore.silent(function(){\r\n\t\t\t\tstore.unselect();\r\n\t\t\t});\r\n\r\n\t\t\tif (this._tasks_dnd && this._tasks_dnd.drag) {\r\n\t\t\t\tthis._tasks_dnd.drag.id = null;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (this._lightbox_id == oldid)\r\n\t\t\t\tthis._lightbox_id = newid;\r\n\r\n\t\t\t// TODO: probably can be removed\r\n\t\t\tif (store.getSelectedId() == oldid) {\r\n\t\t\t\tstore.silent(function(){\r\n\t\t\t\t\tstore.unselect(oldid);\r\n\t\t\t\t\tstore.select(newid);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif (this._tasks_dnd && this._tasks_dnd.drag && this._tasks_dnd.drag.id == oldid) {\r\n\t\t\t\tthis._tasks_dnd.drag.id = newid;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tvar getTaskTimingMode = function (task, force) {\r\n\t\tvar task_type = gantt.getTaskType(task.type);\r\n\r\n\t\tvar state = {\r\n\t\t\ttype: task_type,\r\n\t\t\t$no_start: false,\r\n\t\t\t$no_end: false\r\n\t\t};\r\n\r\n\t\tif (!force && task_type == task.$rendered_type) {\r\n\t\t\tstate.$no_start = task.$no_start;\r\n\t\t\tstate.$no_end = task.$no_end;\r\n\t\t\treturn state;\r\n\t\t}\r\n\r\n\t\tif (task_type == gantt.config.types.project) {\r\n\t\t\t//project duration is always defined by children duration\r\n\t\t\tstate.$no_end = state.$no_start = true;\r\n\t\t} else if (task_type != gantt.config.types.milestone) {\r\n\t\t\t//tasks can have fixed duration, children duration(as projects), or one date fixed, and other defined by nested items\r\n\t\t\tstate.$no_end = !(task.end_date || task.duration);\r\n\t\t\tstate.$no_start = !task.start_date;\r\n\r\n\t\t\tif (gantt._isAllowedUnscheduledTask(task)) {\r\n\t\t\t\tstate.$no_end = state.$no_start = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn state;\r\n\t};\r\n\r\n\tgantt._init_task_timing = function (task) {\r\n\t\tvar task_mode = getTaskTimingMode(task, true);\r\n\r\n\t\tvar dirty = task.$rendered_type != task_mode.type;\r\n\r\n\t\tvar task_type = task_mode.type;\r\n\r\n\t\tif (dirty) {\r\n\t\t\ttask.$no_start = task_mode.$no_start;\r\n\t\t\ttask.$no_end = task_mode.$no_end;\r\n\t\t\ttask.$rendered_type = task_mode.type;\r\n\t\t}\r\n\r\n\t\tif (dirty && task_type != this.config.types.milestone) {\r\n\t\t\tif (task_type == this.config.types.project) {\r\n\t\t\t\t//project duration is always defined by children duration\r\n\t\t\t\tthis._set_default_task_timing(task);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (task_type == this.config.types.milestone) {\r\n\t\t\ttask.end_date = task.start_date;\r\n\t\t}\r\n\t\tif (task.start_date && task.end_date) {\r\n\t\t\ttask.duration = this.calculateDuration(task);\r\n\t\t}\r\n\r\n\t\tif (!task.end_date) {\r\n\t\t\ttask.end_date = task.start_date;\r\n\t\t}\r\n\r\n\t\ttask.duration = task.duration || 0;\r\n\r\n\t\t// work calendar of task has changed\r\n\t\tvar effectiveCalendar = this.getTaskCalendar(task);\r\n\t\tif(task.$effective_calendar && task.$effective_calendar !== effectiveCalendar.id){\r\n\t\t\tupdateTaskTiming(task);\r\n\t\t\tif(this.config.inherit_calendar && this.isSummaryTask(task)){\r\n\t\t\t\tthis.eachTask(function(child){\r\n\t\t\t\t\tupdateTaskTiming(child);\r\n\t\t\t\t}, task.id);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\ttask.$effective_calendar = effectiveCalendar.id;\r\n\t};\r\n\r\n\tfunction updateTaskTiming(task) {\r\n\t\ttask.$effective_calendar = gantt.getTaskCalendar(task).id;\r\n\t\ttask.start_date = gantt.getClosestWorkTime({\r\n\t\t\tdir: \"future\",\r\n\t\t\tdate: task.start_date,\r\n\t\t\tunit: gantt.config.duration_unit,\r\n\t\t\ttask: task\r\n\t\t});\r\n\t\ttask.end_date = gantt.calculateEndDate(task);\r\n\t}\r\n\r\n\tgantt.isSummaryTask = function (task) {\r\n\t\tgantt.assert(task && task instanceof Object, \"Invalid argument task=\"+task+\" of gantt.isSummaryTask. Task object was expected\");\r\n\r\n\t\tvar mode = getTaskTimingMode(task);\r\n\r\n\t\treturn !!(mode.$no_end || mode.$no_start);\r\n\t};\r\n\r\n// downward calculation of project duration\r\n\tgantt.resetProjectDates = function (task) {\r\n\t\tvar taskMode = getTaskTimingMode(task);\r\n\t\tif (taskMode.$no_end || taskMode.$no_start) {\r\n\t\t\tvar dates = this.getSubtaskDates(task.id);\r\n\t\t\tassignProjectDates.call(this, task, dates.start_date, dates.end_date);\r\n\t\t}\r\n\t};\r\n\r\n\tfunction assignProjectDates(task, from, to) {\r\n\t\tvar taskTiming = getTaskTimingMode(task);\r\n\t\tif (taskTiming.$no_start) {\r\n\t\t\tif (from && from != Infinity) {\r\n\t\t\t\ttask.start_date = new Date(from);\r\n\t\t\t} else {\r\n\t\t\t\ttask.start_date = getDefaultTaskDate(task, this.getParent(task));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (taskTiming.$no_end) {\r\n\t\t\tif (to && to != -Infinity) {\r\n\t\t\t\ttask.end_date = new Date(to);\r\n\t\t\t} else {\r\n\t\t\t\ttask.end_date = this.calculateEndDate({\r\n\t\t\t\t\tstart_date: task.start_date,\r\n\t\t\t\t\tduration: this.config.duration_step,\r\n\t\t\t\t\ttask: task\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (taskTiming.$no_start || taskTiming.$no_end) {\r\n\t\t\tthis._init_task_timing(task);\r\n\t\t}\r\n\t}\r\n\r\n\tgantt.getSubtaskDuration = function (task_id) {\r\n\t\tvar res = 0,\r\n\t\t\troot = task_id !== undefined ? task_id : gantt.config.root_id;\r\n\r\n\t\tthis.eachTask(function (child) {\r\n\t\t\tif (this.getTaskType(child.type) == gantt.config.types.project || this.isUnscheduledTask(child))\r\n\t\t\t\treturn;\r\n\r\n\t\t\tres += child.duration;\r\n\t\t}, root);\r\n\r\n\t\treturn res;\r\n\t};\r\n\r\n\tgantt.getSubtaskDates = function (task_id) {\r\n\t\tvar min = null,\r\n\t\t\tmax = null,\r\n\t\t\troot = task_id !== undefined ? task_id : gantt.config.root_id;\r\n\r\n\t\tthis.eachTask(function (child) {\r\n\t\t\tif (this.getTaskType(child.type) == gantt.config.types.project || this.isUnscheduledTask(child))\r\n\t\t\t\treturn;\r\n\r\n\t\t\tif ((child.start_date && !child.$no_start) && (!min || min > child.start_date.valueOf()))\r\n\t\t\t\tmin = child.start_date.valueOf();\r\n\t\t\tif ((child.end_date && !child.$no_end) && (!max || max < child.end_date.valueOf()))\r\n\t\t\t\tmax = child.end_date.valueOf();\r\n\t\t}, root);\r\n\r\n\t\treturn {\r\n\t\t\tstart_date: min ? new Date(min) : null,\r\n\t\t\tend_date: max ? new Date(max) : null\r\n\t\t};\r\n\t};\r\n\r\n\r\n// upward calculation of project duration\r\n\tgantt._update_parents = function (taskId, silent) {\r\n\t\tif (!taskId) return;\r\n\r\n\t\tvar task = this.getTask(taskId);\r\n\t\tvar pid = this.getParent(task);\r\n\r\n\t\tvar taskTiming = getTaskTimingMode(task);\r\n\r\n\t\tvar has_changed = true;\r\n\r\n\t\tif (taskTiming.$no_start || taskTiming.$no_end) {\r\n\t\t\tvar oldStart = task.start_date.valueOf(),\r\n\t\t\t\toldEnd = task.end_date.valueOf();\r\n\r\n\t\t\tgantt.resetProjectDates(task);\r\n\r\n\t\t\t// not refresh parent projects if dates hasn't changed\r\n\t\t\tif (oldStart == task.start_date.valueOf() && oldEnd == task.end_date.valueOf()) {\r\n\t\t\t\thas_changed = false;\r\n\t\t\t}\r\n\r\n\t\t\tif (has_changed && !silent) {\r\n\t\t\t\tthis.refreshTask(task.id, true);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tif (has_changed && pid && this.isTaskExists(pid)) {\r\n\t\t\tthis._update_parents(pid, silent);\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.roundDate = function (config) {\r\n\t\tvar scale = gantt.getScale();\r\n\r\n\t\tif (helpers.isDate(config)) {\r\n\t\t\tconfig = {\r\n\t\t\t\tdate: config,\r\n\t\t\t\tunit: scale ? scale.unit : gantt.config.duration_unit,\r\n\t\t\t\tstep: scale ? scale.step : gantt.config.duration_step\r\n\t\t\t};\r\n\t\t}\r\n\t\tvar date = config.date,\r\n\t\t\tsteps = config.step,\r\n\t\t\tunit = config.unit;\r\n\r\n\t\tif(!scale){\r\n\t\t\treturn date;\r\n\t\t}\r\n\r\n\t\tvar upper, lower, colIndex;\r\n\t\tif (unit == scale.unit && steps == scale.step &&\r\n\t\t\t+date >= +scale.min_date && +date <= +scale.max_date) {\r\n\t\t\t//find date in time scale config\r\n\t\t\tcolIndex = Math.floor(gantt.columnIndexByDate(date));\r\n\r\n\t\t\tif (!scale.trace_x[colIndex]) {\r\n\t\t\t\tcolIndex -= 1;// end of time scale\r\n\t\t\t\tif(scale.rtl){\r\n\t\t\t\t\tcolIndex = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlower = new Date(scale.trace_x[colIndex]);\r\n\t\t\tupper = gantt.date.add(lower, steps, unit);\r\n\t\t} else {\r\n\t\t\tcolIndex = Math.floor(gantt.columnIndexByDate(date));\r\n\r\n\t\t\tupper = gantt.date[unit + \"_start\"](new Date(scale.min_date));\r\n\t\t\tif (scale.trace_x[colIndex]) {\r\n\t\t\t\tupper = gantt.date[unit + \"_start\"](scale.trace_x[colIndex]);// end of time scale\r\n\t\t\t}\r\n\r\n\t\t\twhile (+upper < +date) {\r\n\t\t\t\tupper = gantt.date[unit + \"_start\"](gantt.date.add(upper, steps, unit));\r\n\r\n\t\t\t\tvar tzOffset = upper.getTimezoneOffset();\r\n\r\n\t\t\t\tupper = gantt._correct_dst_change(upper, tzOffset, upper, unit);\r\n\t\t\t\tif (gantt.date[unit + '_start'])\r\n\t\t\t\t\tupper = gantt.date[unit + '_start'](upper);\r\n\t\t\t}\r\n\r\n\t\t\tlower = gantt.date.add(upper, -1 * steps, unit);\r\n\r\n\t\t}\r\n\t\tif (config.dir && config.dir == 'future')\r\n\t\t\treturn upper;\r\n\t\tif (config.dir && config.dir == 'past')\r\n\t\t\treturn lower;\r\n\r\n\t\tif (Math.abs(date - lower) < Math.abs(upper - date)) {\r\n\t\t\treturn lower;\r\n\t\t} else {\r\n\t\t\treturn upper;\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tgantt.correctTaskWorkTime = function (task) {\r\n\t\tif (gantt.config.work_time && gantt.config.correct_work_time) {\r\n\t\t\tif (!this.isWorkTime(task.start_date, undefined, task)) {\r\n\t\t\t\ttask.start_date = this.getClosestWorkTime({date: task.start_date, dir: 'future', task: task});\r\n\t\t\t\ttask.end_date = this.calculateEndDate(task);\r\n\t\t\t} else if (!this.isWorkTime(new Date(+task.end_date - 1), undefined, task)) {\r\n\t\t\t\ttask.end_date = this.calculateEndDate(task);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.attachEvent(\"onBeforeTaskUpdate\", function (id, task) {\r\n\t\tgantt._init_task_timing(task);\r\n\t\treturn true;\r\n\t});\r\n\tgantt.attachEvent(\"onBeforeTaskAdd\", function (id, task) {\r\n\t\tgantt._init_task_timing(task);\r\n\t\treturn true;\r\n\t});\r\n\r\n\tgantt.attachEvent(\"onAfterTaskMove\", function (id, parent, tindex) {\r\n\t\tgantt._init_task_timing(gantt.getTask(id));\r\n\t\treturn true;\r\n\t});\r\n\r\n};","// TODO: rework public api for date methods\r\nvar utils = require(\"../../utils/utils\");\r\n\r\nvar createWorkTimeFacade = function(calendarManager, timeCalculator){\r\n\treturn {\r\n\t\tgetWorkHours: function (date) {\r\n\t\t\treturn timeCalculator.getWorkHours(date);\r\n\t\t},\r\n\r\n\t\tsetWorkTime: function (config) {\r\n\t\t\treturn timeCalculator.setWorkTime(config);\r\n\t\t},\r\n\r\n\t\tunsetWorkTime: function (config) {\r\n\t\t\ttimeCalculator.unsetWorkTime(config);\r\n\t\t},\r\n\r\n\t\tisWorkTime: function (date, unit, task) {\r\n\t\t\treturn timeCalculator.isWorkTime(date, unit, task);\r\n\t\t},\r\n\r\n\t\tgetClosestWorkTime: function (config) {\r\n\t\t\treturn timeCalculator.getClosestWorkTime(config);\r\n\t\t},\r\n\r\n\t\tcalculateDuration: function (start_date, end_date, task) {\r\n\t\t\treturn timeCalculator.calculateDuration(start_date, end_date, task);\r\n\t\t},\r\n\t\t_hasDuration: function (start_date, end_date, task) {\r\n\t\t\treturn timeCalculator.hasDuration(start_date, end_date, task);\r\n\t\t},\r\n\r\n\t\tcalculateEndDate: function (start, duration, unit, task) {\r\n\t\t\treturn timeCalculator.calculateEndDate(start, duration, unit, task);\r\n\t\t},\r\n\r\n\t\tmergeCalendars: utils.bind(calendarManager.mergeCalendars, calendarManager),\r\n\t\tcreateCalendar: utils.bind(calendarManager.createCalendar, calendarManager),\r\n\t\taddCalendar: utils.bind(calendarManager.addCalendar, calendarManager),\r\n\t\tgetCalendar: utils.bind(calendarManager.getCalendar, calendarManager),\r\n\t\tgetCalendars: utils.bind(calendarManager.getCalendars, calendarManager),\r\n\t\tgetResourceCalendar: utils.bind(calendarManager.getResourceCalendar, calendarManager),\r\n\t\tgetTaskCalendar: utils.bind(calendarManager.getTaskCalendar, calendarManager),\r\n\t\tdeleteCalendar: utils.bind(calendarManager.deleteCalendar, calendarManager)\r\n\t};\r\n};\r\n\r\n\r\nmodule.exports = { create: createWorkTimeFacade };","function CalendarDisabledTimeStrategy(gantt, argumentsHelper){\r\n\tthis.argumentsHelper = argumentsHelper;\r\n\tthis.$gantt = gantt;\r\n}\r\n\r\nCalendarDisabledTimeStrategy.prototype = {\r\n\tgetWorkHours: function () {\r\n\t\treturn [0, 24];\r\n\t},\r\n\tsetWorkTime: function () {\r\n\t\treturn true;\r\n\t},\r\n\tunsetWorkTime: function () {\r\n\t\treturn true;\r\n\t},\r\n\tisWorkTime: function () {\r\n\t\treturn true;\r\n\t},\r\n\tgetClosestWorkTime: function (config) {\r\n\t\tvar config = this.argumentsHelper.getClosestWorkTimeArguments.apply(this.argumentsHelper, arguments);\r\n\t\treturn config.date;\r\n\t},\r\n\r\n\tcalculateDuration: function () {\r\n\t\tvar config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\r\n\t\tvar from = config.start_date,\r\n\t\t\tto = config.end_date,\r\n\t\t\tunit = config.unit,\r\n\t\t\tstep = config.step;\r\n\r\n\t\treturn this._calculateDuration(from, to, unit, step);\r\n\t},\r\n\t_calculateDuration: function (start, end, unit, step) {\r\n\t\tvar dateHelper = this.$gantt.date;\r\n\t\tvar fixedUnits = {\r\n\t\t\t\"week\": 1000 * 60 * 60 * 24 * 7,\r\n\t\t\t\"day\": 1000 * 60 * 60 * 24,\r\n\t\t\t\"hour\": 1000 * 60 * 60,\r\n\t\t\t\"minute\": 1000 * 60\r\n\t\t};\r\n\r\n\t\tvar res = 0;\r\n\t\tif (fixedUnits[unit]) {\r\n\t\t\tres = Math.round((end - start) / (step * fixedUnits[unit]));\r\n\t\t} else {\r\n\t\t\tvar from = new Date(start),\r\n\t\t\t\tto = new Date(end);\r\n\t\t\twhile (from.valueOf() < to.valueOf()) {\r\n\t\t\t\tres += 1;\r\n\t\t\t\tfrom = dateHelper.add(from, step, unit);\r\n\t\t\t}\r\n\r\n\t\t\tif (from.valueOf() != end.valueOf()) {\r\n\t\t\t\tres += (to - from) / (dateHelper.add(from, step, unit) - from);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn Math.round(res);\r\n\t},\r\n\r\n\thasDuration: function () {\r\n\t\tvar config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\r\n\t\tvar from = config.start_date,\r\n\t\t\tto = config.end_date,\r\n\t\t\tunit = config.unit;\r\n\r\n\t\tif (!unit) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tfrom = new Date(from);\r\n\t\tto = new Date(to);\r\n\r\n\t\treturn (from.valueOf() < to.valueOf());\r\n\t},\r\n\r\n\thasWorkTime: function() {\r\n\t\treturn true;\r\n\t},\r\n\r\n\tequals: function(calendar) {\r\n\t\tif(!(calendar instanceof CalendarDisabledTimeStrategy)){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\r\n\tcalculateEndDate: function () {\r\n\t\tvar config = this.argumentsHelper.calculateEndDateArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tvar start = config.start_date,\r\n\t\t\tduration = config.duration,\r\n\t\t\tunit = config.unit,\r\n\t\t\tstep = config.step;\r\n\r\n\t\treturn this.$gantt.date.add(start, step * duration, unit);\r\n\t}\r\n};\r\n\r\nmodule.exports = CalendarDisabledTimeStrategy;","var createArgumentsHelper = require(\"./calendar_arguments_helper\"),\r\n\tNoWorkTimeCalendar = require(\"./strategy/no_work_time\");\r\n\r\nfunction TimeCalculator(calendarManager){\r\n\r\n\tthis.$gantt = calendarManager.$gantt;\r\n\tthis.argumentsHelper = createArgumentsHelper(this.$gantt);\r\n\tthis.calendarManager = calendarManager;\r\n\tthis.$disabledCalendar = new NoWorkTimeCalendar(this.$gantt, this.argumentsHelper);\r\n}\r\n\r\nTimeCalculator.prototype = {\r\n\t_getCalendar: function (config) {\r\n\t\tvar calendar;\r\n\t\tif (!this.$gantt.config.work_time) {\r\n\t\t\tcalendar = this.$disabledCalendar;\r\n\t\t} else {\r\n\t\t\tvar manager = this.calendarManager;\r\n\t\t\tif (config.task) {\r\n\t\t\t\tcalendar = manager.getTaskCalendar(config.task);\r\n\t\t\t} else if (config.id) {\r\n\t\t\t\tcalendar = manager.getTaskCalendar(config);\r\n\t\t\t} else if (config.calendar) {\r\n\t\t\t\tcalendar = config.calendar;\r\n\t\t\t}\r\n\t\t\tif (!calendar) {\r\n\t\t\t\tcalendar = manager.getTaskCalendar();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn calendar;\r\n\t},\r\n\r\n\tgetWorkHours: function (config) {\r\n\t\tconfig = this.argumentsHelper.getWorkHoursArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tvar calendar = this._getCalendar(config);\r\n\r\n\t\treturn calendar.getWorkHours(config.date);\r\n\t},\r\n\r\n\tsetWorkTime: function (config, calendar) {\r\n\t\tconfig = this.argumentsHelper.setWorkTimeArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tif (!calendar)\r\n\t\t\tcalendar = this.calendarManager.getCalendar(); // Global\r\n\t\treturn calendar.setWorkTime(config);\r\n\t},\r\n\r\n\tunsetWorkTime: function (config, calendar) {\r\n\t\tconfig = this.argumentsHelper.unsetWorkTimeArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tif (!calendar)\r\n\t\t\tcalendar = this.calendarManager.getCalendar(); // Global\r\n\t\treturn calendar.unsetWorkTime(config);\r\n\t},\r\n\tisWorkTime: function (date, unit, task, calendar) {\r\n\t\tvar config = this.argumentsHelper.isWorkTimeArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tcalendar = this._getCalendar(config);\r\n\t\treturn calendar.isWorkTime(config);\r\n\t},\r\n\tgetClosestWorkTime: function (config) {\r\n\t\tconfig = this.argumentsHelper.getClosestWorkTimeArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tvar calendar = this._getCalendar(config);\r\n\r\n\t\treturn calendar.getClosestWorkTime(config);\r\n\t},\r\n\r\n\tcalculateDuration: function () { // start_date_date, end_date, task\r\n\t\tvar config = this.argumentsHelper.getDurationArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\r\n\t\tvar calendar = this._getCalendar(config);\r\n\t\treturn calendar.calculateDuration(config);\r\n\t},\r\n\thasDuration: function () {\r\n\t\tvar config = this.argumentsHelper.hasDurationArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tvar calendar = this._getCalendar(config);\r\n\r\n\t\treturn calendar.hasDuration(config);\r\n\t},\r\n\tcalculateEndDate: function (config) { // start_date, duration, unit, task\r\n\t\tvar config = this.argumentsHelper.calculateEndDateArguments.apply(this.argumentsHelper, arguments);\r\n\r\n\t\tvar calendar = this._getCalendar(config);\r\n\t\treturn calendar.calculateEndDate(config);\r\n\t}\r\n};\r\n\r\nmodule.exports = TimeCalculator;\r\n\r\n","module.exports = function() {\r\n\tfunction getResourcesCalendarKey(resourceAssignments){\r\n\t\treturn resourceAssignments.map(function(res){\r\n\t\t\tif(res && res.resource_id){\r\n\t\t\t\treturn res.resource_id;\r\n\t\t\t} else {\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t}).sort().join(\"-\");\r\n\t}\r\n\r\n\tvar dynamicCalendars = {};\r\n\r\n\tfunction mergeResourceCalendars(resourceAssignments, manager){\r\n\t\treturn manager.mergeCalendars(resourceAssignments.map(function(assignment){\r\n\t\t\tvar resourceId = (assignment && assignment.resource_id) ? assignment.resource_id : assignment;\r\n\t\t\treturn manager.getResourceCalendar(resourceId);\r\n\t\t}));\r\n\t}\r\n\tfunction getCalendarIdFromMultipleResources(resourceAssignments, manager){\r\n\t\tvar key = getResourcesCalendarKey(resourceAssignments);\r\n\t\tif(!resourceAssignments.length){\r\n\t\t\treturn null;\r\n\t\t}else if(resourceAssignments.length === 1){\r\n\t\t\treturn manager.getResourceCalendar(key).id;\r\n\t\t}else if (dynamicCalendars[key]){\r\n\t\t\treturn dynamicCalendars[key].id;\r\n\t\t} else {\r\n\t\t\tvar tempCalendar = mergeResourceCalendars(resourceAssignments, manager);\r\n\r\n\t\t\tdynamicCalendars[key] = tempCalendar;\r\n\t\t\treturn manager.addCalendar(tempCalendar);\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\tgetCalendarIdFromMultipleResources: getCalendarIdFromMultipleResources\r\n\t};\r\n};","module.exports = {\r\n\tisLegacyResourceCalendarFormat: function(resourceCalendarsProperty){\r\n\t\t// modern format:\r\n\t\t//gantt.config.resource_calendars = {\r\n\t\t//\tresourceId: calendarId,\r\n\t\t//\tresourceId: calendarId,\r\n\t\t//\tresourceId: calendarId\r\n\t\t//\t};\r\n\t\t\r\n\t\t// legacy format:\r\n\t\t// gantt.config.resource_calendars = {\r\n\t\t//\t\"resourceProperty\": {\r\n\t\t//\t\tresourceId: calendarId,\r\n\t\t//\t\tresourceId: calendarId,\r\n\t\t//\t\tresourceId: calendarId\r\n\t\t//\t\t}\r\n\t\t//\t};\r\n\r\n\t\tif(!resourceCalendarsProperty){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tfor(var i in resourceCalendarsProperty){\r\n\t\t\tif(resourceCalendarsProperty[i] && typeof resourceCalendarsProperty[i] === \"object\"){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t},\r\n\tgetResourceProperty: function(config){\r\n\t\tvar resourceCalendarsConfig = config.resource_calendars;\r\n\t\tvar propertyName = config.resource_property;\r\n\t\tif(this.isLegacyResourceCalendarFormat(resourceCalendarsConfig)){\r\n\t\t\tfor(var i in config){\r\n\t\t\t\tpropertyName = i;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn propertyName;\r\n\t},\r\n\tgetCalendarIdFromLegacyConfig: function(task, config){\r\n\t\tif (config) {\r\n\t\t\tfor (var field in config) {\r\n\t\t\t\tvar resource = config[field];\r\n\t\t\t\tif (task[field]) {\r\n\t\t\t\t\tvar calendarId = resource[task[field]];\r\n\t\t\t\t\tif (calendarId) {\r\n\t\t\t\t\t\treturn calendarId;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n};","import { IWorkUnitCache } from \"./workunit_cache_interface\";\r\n\r\nexport class WorkUnitsObjectCache implements IWorkUnitCache {\r\n\tprivate _cache: any;\r\n\tconstructor() {\r\n\t\tthis.clear();\r\n\t}\r\n\r\n\tgetItem(unit: string, timestamp: string): number|boolean {\r\n\t\tconst cache = this._cache;\r\n\t\tif (cache && cache[unit]) {\r\n\t\t\tconst units = cache[unit];\r\n\r\n\t\t\tif (units[timestamp] !== undefined) {\r\n\t\t\t\treturn units[timestamp];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}\r\n\tsetItem(unit: string, timestamp: string, value: boolean): void {\r\n\t\tif (!unit || !timestamp) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst cache = this._cache;\r\n\r\n\t\tif (!cache) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!cache[unit]) {\r\n\t\t\tcache[unit] = {};\r\n\t\t}\r\n\t\tcache[unit][timestamp] = value;\r\n\t}\r\n\tclear(): void{\r\n\t\tthis._cache = {};\r\n\t}\r\n}","\r\n\r\nimport { IWorkUnitCache } from \"./workunit_cache_interface\";\r\n\r\nexport class WorkUnitsMapCache implements IWorkUnitCache {\r\n\tprivate _cache: Map>;\r\n\tconstructor() {\r\n\t\tthis.clear();\r\n\t}\r\n\r\n\tgetItem(unit: string, timestamp: string): number|boolean {\r\n\t\tif (this._cache.has(unit)) {\r\n\t\t\tconst unitCache = this._cache.get(unit);\r\n\t\t\tif (unitCache.has(timestamp)) {\r\n\t\t\t\treturn unitCache.get(timestamp);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}\r\n\tsetItem(unit: string, timestamp: string, value: boolean): void {\r\n\t\tif (!unit || !timestamp) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst cache = this._cache;\r\n\r\n\t\tlet unitCache;\r\n\t\tif (!cache.has(unit)) {\r\n\t\t\tunitCache = new Map();\r\n\t\t\tcache.set(unit, unitCache);\r\n\t\t} else {\r\n\t\t\tunitCache = cache.get(unit);\r\n\t\t}\r\n\t\tunitCache.set(timestamp, value);\r\n\t}\r\n\tclear(): void{\r\n\t\tthis._cache = new Map>();\r\n\t}\r\n}","import { IWorkUnitCache } from \"./workunit_cache_interface\";\r\nimport { WorkUnitsMapCache } from \"./workunit_map_cache\";\r\nimport { WorkUnitsObjectCache } from \"./workunit_object_cache\";\r\n\r\nexport function createCacheObject(): IWorkUnitCache {\r\n\r\n\t// worktime hash is on the hot path,\r\n\t// Map seems to work faster than plain array, use it whenever possible\r\n\tif (typeof Map !== \"undefined\") {\r\n\t\treturn new WorkUnitsMapCache();\r\n\t} else {\r\n\t\treturn new WorkUnitsObjectCache();\r\n\t}\r\n}","var cacheFactory = require(\"./work_unit_cache\"),\r\n\tutils = require(\"../../../utils/utils\");\r\n\r\nfunction CalendarWorkTimeStrategy(gantt, argumentsHelper) {\r\n\tthis.argumentsHelper = argumentsHelper;\r\n\tthis.$gantt = gantt;\r\n\tthis._workingUnitsCache = cacheFactory.createCacheObject();\r\n\tthis._worktime = null;\r\n\tthis._cached_timestamps = {};\r\n\tthis._cached_timestamps_count = 0;\r\n}\r\n\r\nCalendarWorkTimeStrategy.prototype = {\r\n\tunits: [\r\n\t\t\"year\",\r\n\t\t\"month\",\r\n\t\t\"week\",\r\n\t\t\"day\",\r\n\t\t\"hour\",\r\n\t\t\"minute\"\r\n\t],\r\n\t// cache previously calculated worktime\r\n\t_getUnitOrder: function (unit) {\r\n\t\tfor (var i = 0, len = this.units.length; i < len; i++) {\r\n\t\t\tif (this.units[i] == unit)\r\n\t\t\t\treturn i;\r\n\t\t}\r\n\t},\r\n\t_resetTimestampCache: function(){\r\n\t\tthis._cached_timestamps = {};\r\n\t\tthis._cached_timestamps_count = 0;\r\n\t},\r\n\t_timestamp: function (settings) {\r\n\t\t// minor optimization, store calculated timestamps to reduce computations\r\n\t\t// reset cache when number of keys exceeds large number where key lookup may became more expensive than the recalculation\r\n\t\tif(this._cached_timestamps_count > 1000000){\r\n\t\t\tthis._resetTimestampCache();\r\n\t\t}\r\n\r\n\t\tvar timestamp = null;\r\n\t\tif ((settings.day || settings.day === 0)) {\r\n\t\t\ttimestamp = settings.day;\r\n\t\t} else if (settings.date) {\r\n\t\t\tvar value = String(settings.date.valueOf());\r\n\t\t\tif(this._cached_timestamps[value]){\r\n\t\t\t\ttimestamp = this._cached_timestamps[value];\r\n\t\t\t}else{\r\n\t\t\t\t// store worktime datestamp in utc so it could be recognized in different timezones (e.g. opened locally and sent to the export service in different timezone)\r\n\t\t\t\ttimestamp = Date.UTC(settings.date.getFullYear(), settings.date.getMonth(), settings.date.getDate());\r\n\t\t\t\tthis._cached_timestamps[value] = timestamp;\r\n\t\t\t\tthis._cached_timestamps_count++;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn timestamp;\r\n\t},\r\n\t_checkIfWorkingUnit: function (date, unit, order, skipLookup) {\r\n\t\tif(!skipLookup){\r\n\t\t\tif (order === undefined) {\r\n\t\t\t\torder = this._getUnitOrder(unit);\r\n\t\t\t}\r\n\r\n\t\t\t// disable worktime check for custom time units\r\n\t\t\tif (order === undefined) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tif (order) {\r\n\t\t\t\t//check if bigger time unit is a work time (hour < day < month...)\r\n\t\t\t\t//i.e. don't check particular hour if the whole day is marked as not working\r\n\t\t\t\tif (!this._isWorkTime(date, this.units[order - 1], order - 1)) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!this[\"_is_work_\" + unit])\r\n\t\t\treturn true;\r\n\t\treturn this[\"_is_work_\" + unit](date);\r\n\t},\r\n\t//checkings for particular time units\r\n\t//methods for month-year-week can be defined, otherwise always return 'true'\r\n\t_is_work_day: function (date) {\r\n\t\tvar val = this._getWorkHours(date);\r\n\r\n\t\tif (Array.isArray(val)) {\r\n\t\t\treturn val.length > 0;\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\t_is_work_hour: function (date) {\r\n\t\tvar hours = this._getWorkHours(date); // [{start: 8*60*60, end: 12*60*60}, {start: 13*60*60, end: 17*60*60}]\r\n\t\tvar value = date.getHours();\r\n\t\tfor (var i = 0; i < hours.length; i++) {\r\n\t\t\tif(value >= hours[i].startHour && value < hours[i].endHour){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\t_getTimeOfDayStamp: function(date) {\r\n\t\treturn date.getHours() * 60 * 60 + date.getMinutes() * 60;\r\n\t},\r\n\r\n\t_is_work_minute: function(date){\r\n\t\tvar hours = this._getWorkHours(date); // [{start: 8*60*60, end: 12*60*60}, {start: 13*60*60, end: 17*60*60}]\r\n\t\tvar checkTime = this._getTimeOfDayStamp(date);\r\n\t\tfor (var i = 0; i < hours.length; i++) {\r\n\t\t\tif(checkTime >= hours[i].start && checkTime < hours[i].end){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\t_internDatesPull: {},\r\n\t_nextDate: function (start, unit, step) {\r\n\t\tvar dateHelper = this.$gantt.date;\r\n\t\treturn dateHelper.add(start, step, unit);\r\n\r\n\t\t/*var start_value = +start,\r\n\t\t\tkey = unit + \"_\" + step;\r\n\t\tvar interned = this._internDatesPull[key];\r\n\t\tif(!interned){\r\n\t\t\tinterned = this._internDatesPull[key] = {};\r\n\t\t}\r\n\t\tvar calculated;\r\n\t\tif(!interned[start_value]){\r\n\t\t\tinterned[start_value] = calculated = dateHelper.add(start, step, unit);\r\n\t\t\t//interned[start_value] = dateHelper.add(start, step, unit);\r\n\t\t}\r\n\t\treturn calculated || interned[start_value];*/\r\n\t},\r\n\t_getWorkUnitsBetweenGeneric: function (from, to, unit, step) {\r\n\t\tvar dateHelper = this.$gantt.date;\r\n\t\tvar start = new Date(from),\r\n\t\t\tend = new Date(to);\r\n\t\tstep = step || 1;\r\n\t\tvar units = 0;\r\n\r\n\r\n\t\tvar next = null;\r\n\t\tvar stepStart,\r\n\t\t\tstepEnd;\r\n\r\n\t\t// calculating decimal durations, i.e. 2016-09-20 00:05:00 - 2016-09-20 01:00:00 ~ 0.95 instead of 1\r\n\t\t// and also 2016-09-20 00:00:00 - 2016-09-20 00:05:00 ~ 0.05 instead of 1\r\n\t\t// durations must be rounded later\r\n\t\tvar checkFirst = false;\r\n\t\tstepStart = dateHelper[unit + \"_start\"](new Date(start));\r\n\t\tif (stepStart.valueOf() != start.valueOf()) {\r\n\t\t\tcheckFirst = true;\r\n\t\t}\r\n\t\tvar checkLast = false;\r\n\t\tstepEnd = dateHelper[unit + \"_start\"](new Date(to));\r\n\t\tif (stepEnd.valueOf() != to.valueOf()) {\r\n\t\t\tcheckLast = true;\r\n\t\t}\r\n\r\n\t\tvar isLastStep = false;\r\n\t\twhile (start.valueOf() < end.valueOf()) {\r\n\t\t\tnext = this._nextDate(start, unit, step);\r\n\t\t\tisLastStep = (next.valueOf() > end.valueOf());\r\n\r\n\t\t\tif (this._isWorkTime(start, unit)) {\r\n\t\t\t\tif (checkFirst || (checkLast && isLastStep)) {\r\n\t\t\t\t\tstepStart = dateHelper[unit + \"_start\"](new Date(start));\r\n\t\t\t\t\tstepEnd = dateHelper.add(stepStart, step, unit);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (checkFirst) {\r\n\t\t\t\t\tcheckFirst = false;\r\n\t\t\t\t\tnext = this._nextDate(stepStart, unit, step);\r\n\t\t\t\t\tunits += ((stepEnd.valueOf() - start.valueOf()) / (stepEnd.valueOf() - stepStart.valueOf()));\r\n\t\t\t\t} else if (checkLast && isLastStep) {\r\n\t\t\t\t\tcheckLast = false;\r\n\t\t\t\t\tunits += ((end.valueOf() - start.valueOf()) / (stepEnd.valueOf() - stepStart.valueOf()));\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tunits++;\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tvar unitOrder = this._getUnitOrder(unit);\r\n\t\t\t\tvar biggerTimeUnit = this.units[unitOrder - 1];\r\n\t\t\t\tif(biggerTimeUnit && !this._isWorkTime(start, biggerTimeUnit)){\r\n\t\t\t\t\tnext = this._getClosestWorkTimeFuture(start, biggerTimeUnit);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tstart = next;\r\n\t\t}\r\n\t\treturn units;\r\n\t},\r\n\r\n\t_getMinutesPerHour: function (date) {\r\n\t\tvar hourStart = this._getTimeOfDayStamp(date);\r\n\t\tvar hourEnd = this._getTimeOfDayStamp(this._nextDate(date, \"hour\", 1));\r\n\t\tvar worktimes = this._getWorkHours(date);\r\n\r\n\t\tfor(var i = 0; i < worktimes.length; i++){\r\n\t\t\tvar interval = worktimes[i];\r\n\t\t\tif(hourStart >= interval.start && hourEnd <= interval.end){\r\n\t\t\t\treturn 60;// hour inside a working interval, all hour is a work hour\r\n\t\t\t}else if(hourStart < interval.end && hourEnd > interval.start){\r\n\t\t\t\t// hour is partially work time\r\n\t\t\t\tvar duration = Math.min(hourEnd, interval.end) - Math.max(hourStart, interval.start);\r\n\t\t\t\treturn duration / 60;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn 0;\r\n\t},\r\n\r\n\t_getMinutesPerDay: function (date) {\r\n\t\tvar hours = this._getWorkHours(date);\r\n\t\tvar res = 0;\r\n\t\thours.forEach(function(interval){\r\n\t\t\tres+= interval.durationMinutes;\r\n\t\t});\r\n\t\treturn res;\r\n\t},\r\n\tgetHoursPerDay: function (date) {\r\n\t\tvar hours = this._getWorkHours(date);\r\n\t\tvar res = 0;\r\n\t\thours.forEach(function(interval){\r\n\t\t\tres+= interval.durationHours;\r\n\t\t});\r\n\t\treturn res;\r\n\t},\r\n\t_getWorkUnitsForRange: function (from, to, unit, step) {\r\n\t\tvar total = 0;\r\n\t\tvar start = new Date(from),\r\n\t\t\tend = new Date(to);\r\n\r\n\t\tvar getUnitsPerDay;\r\n\t\tif (unit == \"minute\") {\r\n\t\t\tgetUnitsPerDay = utils.bind(this._getMinutesPerDay, this);\r\n\t\t} else {\r\n\t\t\tgetUnitsPerDay = utils.bind(this.getHoursPerDay, this);\r\n\t\t}\r\n\r\n\t\twhile (start.valueOf() < end.valueOf()) {\r\n\t\t\tif (this._isWorkTime(start, \"day\")) {\r\n\t\t\t\ttotal += getUnitsPerDay(start);\r\n\t\t\t}\r\n\t\t\tstart = this._nextDate(start, \"day\", 1);\r\n\t\t}\r\n\r\n\t\treturn total / step;\r\n\t},\r\n\r\n\t// optimized method for calculating work units duration of large time spans\r\n\t// implemented for hours and minutes units, bigger time units don't benefit from the optimization so much\r\n\t_getWorkUnitsBetweenQuick: function (from, to, unit, step) {\r\n\t\tvar start = new Date(from),\r\n\t\t\tend = new Date(to);\r\n\t\tstep = step || 1;\r\n\r\n\t\tvar firstDayStart = new Date(start);\r\n\t\tvar firstDayEnd = this.$gantt.date.add(this.$gantt.date.day_start(new Date(start)), 1, \"day\");\r\n\r\n\t\tif (end.valueOf() <= firstDayEnd.valueOf()) {\r\n\t\t\treturn this._getWorkUnitsBetweenGeneric(from, to, unit, step);\r\n\t\t} else {\r\n\r\n\t\t\tvar lastDayStart = this.$gantt.date.day_start(new Date(end));\r\n\t\t\tvar lastDayEnd = end;\r\n\r\n\t\t\tvar startPart = this._getWorkUnitsBetweenGeneric(firstDayStart, firstDayEnd, unit, step);\r\n\t\t\tvar endPart = this._getWorkUnitsBetweenGeneric(lastDayStart, lastDayEnd, unit, step);\r\n\r\n\t\t\tvar rangePart = this._getWorkUnitsForRange(firstDayEnd, lastDayStart, unit, step);\r\n\t\t\tvar total = startPart + rangePart + endPart;\r\n\r\n\t\t\treturn total;\r\n\t\t}\r\n\t},\r\n\r\n\tgetConfig: function () {\r\n\t\treturn this._worktime;\r\n\t},\r\n\t_setConfig: function (settings) {\r\n\t\tthis._worktime = settings;\r\n\t\tthis._parseSettings();\r\n\t\tthis._workingUnitsCache.clear();\r\n\t},\r\n\t_parseSettings: function() {\r\n\t\tvar settings = this.getConfig();\r\n\t\tsettings.parsed = {\r\n\t\t\tdates: {},\r\n\t\t\thours: null\r\n\t\t};\r\n\r\n\t\tsettings.parsed.hours = this._parseHours(settings.hours);\r\n\t\tfor(var i in settings.dates){\r\n\t\t\tsettings.parsed.dates[i] = this._parseHours(settings.dates[i]);\r\n\t\t}\r\n\t},\r\n\r\n\t_tryChangeCalendarSettings: function (payload) {\r\n\t\tvar backup = JSON.stringify(this.getConfig());\r\n\t\tpayload();\r\n\t\tif (!this.hasWorkTime()) {\r\n\t\t//\tthis.$gantt.assert(false, \"Invalid calendar settings, no worktime available\");\r\n\t\t\tthis._setConfig(JSON.parse(backup));\r\n\t\t\tthis._workingUnitsCache.clear();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\t_arraysEqual: function(a, b){\r\n\t\tif (a === b) return true;\r\n\t\tif (!a || !b) return false;\r\n\t\tif (a.length != b.length) return false;\r\n\r\n\t\tfor (var i = 0; i < a.length; ++i) {\r\n\t\t\tif (a[i] !== b[i]) return false;\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\r\n\tequals: function (calendar) {\r\n\t\tif(!(calendar instanceof CalendarWorkTimeStrategy)){\r\n\t\t\treturn false;\r\n\t\t} \r\n\r\n\t\tvar mySettings = this.getConfig();\r\n\t\tvar thatSettings = calendar.getConfig();\r\n\r\n\t\tif (!this._arraysEqual(mySettings.hours, thatSettings.hours)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar myDays = Object.keys(mySettings.dates);\r\n\t\tvar otherDates = Object.keys(thatSettings.dates);\r\n\t\tmyDays.sort();\r\n\t\totherDates.sort();\r\n\r\n\t\tif (!this._arraysEqual(myDays, otherDates)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tfor(var i = 0; i < myDays.length; i++){\r\n\t\t\tvar timestamp = myDays[i];\r\n\t\t\tvar myHours = mySettings.dates[timestamp];\r\n\t\t\tvar otherHours = mySettings.dates[timestamp];\r\n\r\n\t\t\t// day settings not equal\r\n\t\t\tif(myHours !== otherHours && \r\n\t\t\t\t// but still can be two arrays with the equivalent hour settings\r\n\t\t\t\t!(Array.isArray(myHours) && Array.isArray(otherHours) && this._arraysEqual(myHours, otherHours))\r\n\t\t\t\t){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t},\r\n\r\n\tgetWorkHours: function () {\r\n\t\tvar config = this.argumentsHelper.getWorkHoursArguments.apply(this.argumentsHelper, arguments);\r\n\t\treturn this._getWorkHours(config.date, false);\r\n\t},\r\n\t_getWorkHours: function (date, parsed) {\r\n\t\tvar calendar = this.getConfig();\r\n\t\tif(parsed !== false){\r\n\t\t\tcalendar = calendar.parsed;\r\n\t\t}\r\n\r\n\t\tif(!date){\r\n\t\t\treturn calendar.hours;\r\n\t\t}\r\n\r\n\t\tvar t = this._timestamp({date: date});\r\n\t\tvar hours = true;\r\n\r\n\t\tif (calendar.dates[t] !== undefined) {\r\n\t\t\thours = calendar.dates[t];//custom day\r\n\t\t} else if (calendar.dates[date.getDay()] !== undefined) {\r\n\t\t\thours = calendar.dates[date.getDay()];//week day\r\n\t\t}\r\n\t\tif (hours === true) {\r\n\t\t\treturn calendar.hours;\r\n\t\t} else if (hours) {\r\n\t\t\treturn hours;\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n\r\n\t_parseHours: function(hours) {\r\n\t\tif(Array.isArray(hours)){\r\n\r\n\t\t\tvar timestampRanges = [];// worktime as seconds range\r\n\t\t\thours.forEach(function(hour){\r\n\t\t\t\tif(typeof hour === \"number\"){\r\n\t\t\t\t\ttimestampRanges.push(hour*60*60);\r\n\t\t\t\t}else if(typeof hour === \"string\") {\r\n\t\t\t\t\t// \"12-13\", or \"12:00-13:00\", or \"12:00:00-13:00:00\"\r\n\t\t\t\t\thour.split(\"-\").map(function(time){\r\n\t\t\t\t\t\treturn time.trim();\r\n\t\t\t\t\t}).forEach(function(part){\r\n\t\t\t\t\t\tvar parsed = part.split(\":\").map(function(time){\r\n\t\t\t\t\t\t\treturn time.trim();\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tvar value = parseInt(parsed[0]*60*60);\r\n\t\t\t\t\t\tif(parsed[1]){\r\n\t\t\t\t\t\t\tvalue += parseInt(parsed[1]*60);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(parsed[2]){\r\n\t\t\t\t\t\t\tvalue += parseInt(parsed[2]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttimestampRanges.push(value);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tvar timerangeConfig = [];\r\n\t\t\tfor (var i = 0; i < timestampRanges.length; i += 2) {\r\n\t\t\t\tvar start = timestampRanges[i];\r\n\t\t\t\tvar end = timestampRanges[i + 1];\r\n\t\t\t\tvar duration = end - start;\r\n\r\n\t\t\t\ttimerangeConfig.push({\r\n\t\t\t\t\tstart: start,\r\n\t\t\t\t\tend: end,\r\n\t\t\t\t\tstartHour: Math.floor(start / (60*60)),\r\n\t\t\t\t\tendHour: Math.ceil(end / (60*60)),\r\n\t\t\t\t\tdurationSeconds: duration,\r\n\t\t\t\t\tdurationMinutes: duration/60,\r\n\t\t\t\t\tdurationHours: duration/(60 * 60)\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\treturn timerangeConfig;\r\n\t\t} else {\r\n\t\t\treturn hours;\r\n\t\t}\r\n\t},\r\n\r\n\tsetWorkTime: function (settings) {\r\n\t\treturn this._tryChangeCalendarSettings(utils.bind(function () {\r\n\t\t\tvar hours = settings.hours !== undefined ? settings.hours : true;\r\n\t\t\tvar timestamp = this._timestamp(settings);\r\n\t\t\tvar calendarConfig = this.getConfig();\r\n\t\t\tif (timestamp !== null) {\r\n\t\t\t\tcalendarConfig.dates[timestamp] = hours;\r\n\t\t\t} else {\r\n\t\t\t\tcalendarConfig.hours = hours;\r\n\t\t\t}\r\n\r\n\t\t\tthis._parseSettings();\r\n\t\t\tthis._workingUnitsCache.clear();\r\n\t\t}, this));\r\n\t},\r\n\r\n\tunsetWorkTime: function (settings) {\r\n\t\treturn this._tryChangeCalendarSettings(utils.bind(function () {\r\n\t\t\tif (!settings) {\r\n\t\t\t\tthis.reset_calendar();\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar timestamp = this._timestamp(settings);\r\n\r\n\t\t\t\tif (timestamp !== null) {\r\n\t\t\t\t\tdelete this.getConfig().dates[timestamp];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Clear work units cache\r\n\t\t\tthis._workingUnitsCache.clear();\r\n\t\t}, this));\r\n\t},\r\n\r\n\t_isWorkTime: function (date, unit, order) {\r\n\t\t// Check if this item has in the cache\r\n\r\n\t\t// use string keys\r\n\t\tvar dateKey = String(date.valueOf());\r\n\t\tvar is_work_unit = -1;this._workingUnitsCache.getItem(unit, dateKey);\r\n\r\n\t\tif (is_work_unit == -1) {\r\n\t\t\t// calculate if not cached\r\n\t\t\tis_work_unit = this._checkIfWorkingUnit(date, unit, order);\r\n\t\t//\tthis._workingUnitsCache.setItem(unit, dateKey, is_work_unit);\r\n\t\t}\r\n\r\n\t\treturn is_work_unit;\r\n\t},\r\n\r\n\tisWorkTime: function () {\r\n\t\tvar config = this.argumentsHelper.isWorkTimeArguments.apply( this.argumentsHelper, arguments);\r\n\t\treturn this._isWorkTime(config.date, config.unit);\r\n\t},\r\n\r\n\tcalculateDuration: function () {\r\n\t\tvar config = this.argumentsHelper.getDurationArguments.apply( this.argumentsHelper, arguments);\r\n\r\n\t\tif (!config.unit) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn this._calculateDuration(config.start_date, config.end_date, config.unit, config.step);\r\n\t},\r\n\r\n\t_calculateDuration: function (from, to, unit, step) {\r\n\t\tvar res = 0;\r\n\t\tif (unit == \"hour\" || unit == \"minute\") {\r\n\t\t\tres = this._getWorkUnitsBetweenQuick(from, to, unit, step);\r\n\t\t} else {\r\n\t\t\tres = this._getWorkUnitsBetweenGeneric(from, to, unit, step);\r\n\t\t}\r\n\r\n\t\t// getWorkUnits.. returns decimal durations\r\n\t\treturn Math.round(res);\r\n\t},\r\n\thasDuration: function () {\r\n\t\tvar config = this.argumentsHelper.getDurationArguments.apply( this.argumentsHelper, arguments);\r\n\r\n\t\tvar from = config.start_date,\r\n\t\t\tto = config.end_date,\r\n\t\t\tunit = config.unit,\r\n\t\t\tstep = config.step;\r\n\r\n\t\tif (!unit) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tvar start = new Date(from),\r\n\t\t\tend = new Date(to);\r\n\t\tstep = step || 1;\r\n\r\n\t\twhile (start.valueOf() < end.valueOf()) {\r\n\t\t\tif (this._isWorkTime(start, unit))\r\n\t\t\t\treturn true;\r\n\t\t\tstart = this._nextDate(start, unit, step);\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\tcalculateEndDate: function () {\r\n\t\tvar config = this.argumentsHelper.calculateEndDateArguments.apply( this.argumentsHelper, arguments);\r\n\r\n\t\tvar from = config.start_date,\r\n\t\t\tduration = config.duration,\r\n\t\t\tunit = config.unit,\r\n\t\t\tstep = config.step;\r\n\r\n\t\tif (!unit)\r\n\t\t\treturn false;\r\n\r\n\t\tvar mult = (config.duration >= 0) ? 1 : -1;\r\n\t\tduration = Math.abs(duration * 1);\r\n\t\treturn this._calculateEndDate(from, duration, unit, step * mult);\r\n\t},\r\n\r\n\t_calculateEndDate: function (from, duration, unit, step) {\r\n\t\tif (!unit)\r\n\t\t\treturn false;\r\n\r\n\t\tif (step == 1 && unit == \"minute\") {\r\n\t\t\treturn this._calculateMinuteEndDate(from, duration, step);\r\n\t\t} else if (step == 1 && unit == \"hour\") {\r\n\t\t\treturn this._calculateHourEndDate(from, duration, step);\r\n\t\t} else {\r\n\t\t\tvar interval = this._addInterval(from, duration, unit, step, null);\r\n\t\t\treturn interval.end;\r\n\t\t}\r\n\t},\r\n\r\n\t_addInterval: function (start, duration, unit, step, stopAction) {\r\n\t\tvar added = 0;\r\n\t\tvar current = start;\r\n\t\twhile (added < duration && !(stopAction && stopAction(current))) {\r\n\t\t\tvar next = this._nextDate(current, unit, step);\r\n\t\t\tif (this._isWorkTime(step > 0 ? new Date(next.valueOf() - 1) : new Date(next.valueOf() + 1), unit)) {\r\n\t\t\t\tadded++;\r\n\t\t\t}\r\n\t\t\tcurrent = next;\r\n\t\t}\r\n\t\treturn {\r\n\t\t\tend: current,\r\n\t\t\tstart: start,\r\n\t\t\tadded: added\r\n\t\t};\r\n\t},\r\n\r\n\t_calculateHourEndDate: function (from, duration, step) {\r\n\t\tvar start = new Date(from),\r\n\t\tadded = 0;\r\n\t\tstep = step || 1;\r\n\t\tduration = Math.abs(duration * 1);\r\n\r\n\t\tvar interval = this._addInterval(start, duration, \"hour\", step, function (date) {\r\n\t\t\t// iterate until hour end\r\n\t\t\tif (!(date.getHours() || date.getMinutes() || date.getSeconds() || date.getMilliseconds())) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\tadded = interval.added;\r\n\t\tstart = interval.end;\r\n\r\n\t\tvar durationLeft = duration - added;\r\n\r\n\t\tif (durationLeft && durationLeft > 24) {\r\n\t\t\tvar current = start;\r\n\t\t\twhile (added < duration) {\r\n\t\t\t\tvar next = this._nextDate(current, \"day\", step);\r\n\t\t\t\t// reset to day start in case DST switch happens in the process\r\n\t\t\t\tnext.setHours(0);\r\n\t\t\t\tnext.setMinutes(0);\r\n\t\t\t\tnext.setSeconds(0);\r\n\t\t\t\tif (this._isWorkTime(step > 0 ? new Date(next.valueOf() - 1) : new Date(next.valueOf() + 1), \"day\")) {\r\n\t\t\t\t\tvar hours = this.getHoursPerDay(current);\r\n\t\t\t\t\tif (added + hours >= duration) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tadded += hours;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcurrent = next;\r\n\t\t\t}\r\n\t\t\tstart = current;\r\n\t\t}\r\n\r\n\t\tif (added < duration) {\r\n\t\t\tvar durationLeft = duration - added;\r\n\t\t\tinterval = this._addInterval(start, durationLeft, \"hour\", step, null);\r\n\t\t\tstart = interval.end;\r\n\t\t}\r\n\r\n\t\treturn start;\r\n\t},\r\n\r\n\t_calculateMinuteEndDate: function (from, duration, step) {\r\n\r\n\t\tvar start = new Date(from),\r\n\t\t\tadded = 0;\r\n\t\tstep = step || 1;\r\n\t\tduration = Math.abs(duration * 1);\r\n\r\n\t\tvar interval = this._addInterval(start, duration, \"minute\", step, function (date) {\r\n\t\t\t// iterate until hour end\r\n\t\t\tif (!(date.getMinutes() || date.getSeconds() || date.getMilliseconds())) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\tadded = interval.added;\r\n\t\tstart = interval.end;\r\n\r\n\t\twhile (added < duration) {\r\n\t\t\tvar left = duration - added;\r\n\r\n\t\t\tif(this._isWorkTime(start, \"hour\")){\r\n\t\t\t\tvar minutesInHour = this._getMinutesPerHour(start);\r\n\t\t\t\tif(minutesInHour <= left){\r\n\t\t\t\t\tadded += minutesInHour;\r\n\t\t\t\t\tstart = this._nextDate(start, \"hour\", step);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tstart = this._getClosestWorkTimeFuture(start, \"hour\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (added < duration) {\r\n\t\t\tvar durationLeft = duration - added;\r\n\t\t\tinterval = this._addInterval(start, durationLeft, \"minute\", step, null);\r\n\t\t\tstart = interval.end;\r\n\t\t}\r\n\r\n\t\treturn start;\r\n\t},\r\n\r\n\tgetClosestWorkTime: function () {\r\n\t\tvar settings = this.argumentsHelper.getClosestWorkTimeArguments.apply( this.argumentsHelper, arguments);\r\n\t\treturn this._getClosestWorkTime(settings.date, settings.unit, settings.dir);\r\n\t},\r\n\r\n\t_getClosestWorkTime: function (inputDate, unit, direction) {\r\n\t\tvar result = new Date(inputDate);\r\n\r\n\t\tif (this._isWorkTime(result, unit)) {\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\tresult = this.$gantt.date[unit + '_start'](result);\r\n\r\n\t\tif (direction == 'any' || !direction) {\r\n\t\t\tvar closestFuture = this._getClosestWorkTimeFuture(result, unit);\r\n\t\t\tvar closestPast = this._getClosestWorkTimePast(result, unit);\r\n\t\t\tif (Math.abs(closestFuture - inputDate) <= Math.abs(inputDate - closestPast)) {\r\n\t\t\t\tresult = closestFuture;\r\n\t\t\t} else {\r\n\t\t\t\tresult = closestPast;\r\n\t\t\t}\r\n\t\t} else if (direction == \"past\") {\r\n\t\t\tresult = this._getClosestWorkTimePast(result, unit);\r\n\t\t} else {\r\n\t\t\tresult = this._getClosestWorkTimeFuture(result, unit);\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t_getClosestWorkTimeFuture: function (date, unit) {\r\n\t\treturn this._getClosestWorkTimeGeneric(date, unit, 1);\r\n\t},\r\n\r\n\t_getClosestWorkTimePast: function (date, unit) {\r\n\t\tvar result = this._getClosestWorkTimeGeneric(date, unit, -1);\r\n\t\t// should return the end of the closest work interval\r\n\t\treturn this.$gantt.date.add(result, 1, unit);\r\n\t},\r\n\r\n\t_getClosestWorkTimeGeneric: function (date, unit, increment) {\r\n\t\tvar unitOrder = this._getUnitOrder(unit),\r\n\t\t\tbiggerTimeUnit = this.units[unitOrder - 1];\r\n\r\n\t\tvar result = date;\r\n\r\n\t\t// be extra sure we won't fall into infinite loop, 3k seems big enough\r\n\t\tvar maximumLoop = 3000,\r\n\t\t\tcount = 0;\r\n\r\n\t\twhile (!this._isWorkTime(result, unit)) {\r\n\t\t\tif (biggerTimeUnit && !this._isWorkTime(result, biggerTimeUnit)) {\r\n\t\t\t\t// if we look for closest work hour and detect a week-end - first find the closest work day,\r\n\t\t\t\t// and continue iterations after that\r\n\t\t\t\tif (increment > 0) {\r\n\t\t\t\t\tresult = this._getClosestWorkTimeFuture(result, biggerTimeUnit);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresult = this._getClosestWorkTimePast(result, biggerTimeUnit);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this._isWorkTime(result, unit)) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tcount++;\r\n\t\t\tif (count > maximumLoop) {\r\n\t\t\t\tthis.$gantt.assert(false, \"Invalid working time check\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tvar tzOffset = result.getTimezoneOffset();\r\n\t\t\tresult = this.$gantt.date.add(result, increment, unit);\r\n\r\n\t\t\tresult = this.$gantt._correct_dst_change(result, tzOffset, increment, unit);\r\n\t\t\tif (this.$gantt.date[unit + '_start']) {\r\n\t\t\t\tresult = this.$gantt.date[unit + '_start'](result);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Check whether this calendar has working time. Calendar has working time only if there are regular working days of week\r\n\t * \r\n\t */\r\n\thasWorkTime: function () {\r\n\t\tvar worktime = this.getConfig();\r\n\t\tvar dates = worktime.dates;\r\n\r\n\t\tvar daysOfWeek = [0, 1, 2, 3, 4, 5, 6];\r\n\t\tvar exceptions = [];\r\n\t\tfor(var i in worktime.dates){\r\n\t\t\tif(Number(i) > 6){\r\n\t\t\t\texceptions.push(Number(i));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar hasRegularHours = this._checkWorkHours(worktime.hours);\r\n\r\n\t\tvar result = false;\r\n\t\tdaysOfWeek.forEach(function(day){\r\n\t\t\tif(result){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar dayConfig = dates[day];\r\n\t\t\tif(dayConfig === true){\r\n\t\t\t\t// workday uses global hours\r\n\t\t\t\tresult = hasRegularHours;\r\n\t\t\t}else if(Array.isArray(dayConfig)){\r\n\t\t\t\t// workday uses custom hours\r\n\t\t\t\tresult = this._checkWorkHours(dayConfig);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn result;\r\n\r\n\t},\r\n\r\n\t_checkWorkHours: function(hoursArray) {\r\n\t\tif (hoursArray.length === 0) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tvar result = false;\r\n\t\tfor (var i = 0; i < hoursArray.length; i += 2) {\r\n\t\t\tif (hoursArray[i] !== hoursArray[i + 1]) {\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n};\r\n\r\nmodule.exports = CalendarWorkTimeStrategy;","var utils = require(\"../../../utils/utils\");\r\nfunction WorkTimeCalendarMerger(){\r\n}\r\n\r\nWorkTimeCalendarMerger.prototype = {\r\n\r\n\r\n\t/**\r\n\t * convert hours array items into objects, e.g. [8, 12, 17, 18] -> [{start: 8, end: 12}, {start:17, end:18}]\r\n\t * @param {Array} hoursArray \r\n\t */\r\n\t_getIntervals: function(hoursArray){\r\n\t\tvar result = [];\r\n\t\tfor(var i = 0; i < hoursArray.length; i += 2){\r\n\t\t\t\r\n\t\t\tresult.push({\r\n\t\t\t\tstart: hoursArray[i], \r\n\t\t\t\tend: hoursArray[i+1]\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Convert ranges config into hours array\r\n\t * [{start: 8, end: 12}, {start:17, end:18}] --> [8, 12, 17, 18]\r\n\t * @param {*} intervalsArray \r\n\t */\r\n\t_toHoursArray: function(intervalsArray){\r\n\t\tvar result = [];\r\n\r\n\t\tfunction toFixed(value){\r\n\t\t\tvar str = String(value);\r\n\t\t\tif(str.length < 2){\r\n\t\t\t\tstr = \"0\" + str;\r\n\t\t\t}\r\n\t\t\treturn str;\r\n\t\t}\r\n\t\tfunction formatHHMM(secondsValue){\r\n\t\t\tvar hours = Math.floor(secondsValue / (60*60));\r\n\t\t\tvar minutePart = secondsValue - hours * 60 * 60;\r\n\r\n\t\t\tvar minutes = Math.floor(minutePart / (60));\r\n\t\t\treturn hours + \":\" + toFixed(minutes);\r\n\t\t}\r\n\t\tfor(var i = 0; i < intervalsArray.length; i++){\r\n\t\t\tresult.push(\r\n\t\t\t\tformatHHMM(intervalsArray[i].start) + \r\n\t\t\t\t\"-\" + \r\n\t\t\t\tformatHHMM(intervalsArray[i].end)\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Build intersection of hour intervals. e.g.\r\n\t * first: [{start: 8, end: 12}, {start:13, end:18}]\r\n\t * second: [{start: 10, end: 15}]\r\n\t * result: [{start: 10, end: 12}, {start: 13, end: 15}]\r\n\t * @param {Array} first \r\n\t * @param {Array} second \r\n\t */\r\n\t_intersectHourRanges: function(first, second){\r\n\t\tvar result = [];\r\n\r\n\t\tvar baseArray = first.length > second.length ? first : second;\r\n\t\tvar overridesArray = first === baseArray ? second: first;\r\n\t\tbaseArray = baseArray.slice();\r\n\t\toverridesArray = overridesArray.slice();\r\n\r\n\t\tvar result = [];\r\n\t\tfor(var i = 0; i < baseArray.length; i++){\r\n\t\t\tvar base = baseArray[i];\r\n\t\t\t\r\n\t\t\tfor(var j = 0; j < overridesArray.length; j++){\r\n\t\t\t\tvar current = overridesArray[j];\r\n\t\t\t\tif(current.start < base.end && current.end > base.start){\r\n\t\t\t\t\tresult.push({\r\n\t\t\t\t\t\tstart: Math.max(base.start, current.start),\r\n\t\t\t\t\t\tend: Math.min(base.end, current.end)\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif(base.end > current.end){\r\n\t\t\t\t\t\toverridesArray.splice(j, 1);\r\n\t\t\t\t\t\tj--;\r\n\t\t\t\t\t\ti--;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Reduce the number of ranges in config when possible,\r\n\t * joins ranges that can be merged\r\n\t * parts: [{start: 8, end: 12}, {start:12, end:13}, {start: 15, end: 17}]\r\n\t * result: [{start: 8, end: 13}, {start: 15, end: 17}]\r\n\t * @param {Array} parts \r\n\t */\r\n\t_mergeAdjacentIntervals: function(parts){\r\n\t\tvar result = parts.slice();\r\n\t\tresult.sort(function(a, b){\r\n\t\t\treturn a.start - b.start;\r\n\t\t});\r\n\t\tvar base = result[0];\r\n\t\tfor(var i = 1; i < result.length; i++){\r\n\t\t\tvar current = result[i];\r\n\t\t\tif(current.start <= base.end){\r\n\t\t\t\tif(current.end > base.end){\r\n\t\t\t\t\tbase.end = current.end;\r\n\t\t\t\t}\r\n\t\t\t\tresult.splice(i, 1);\r\n\t\t\t\ti--;\r\n\t\t\t}else{\r\n\t\t\t\tbase = current;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t_mergeHoursConfig: function(firstHours, secondHours){\r\n\t\t//var firstIntervals = this._getIntervals(firstHours);\r\n\t\t//var secondIntervals = this._getIntervals(secondHours);\r\n\r\n\t\treturn this._mergeAdjacentIntervals(\r\n\t\t\tthis._intersectHourRanges(firstHours, secondHours)\r\n\t\t);\r\n\t},\r\n\r\n\tmerge: function(first, second){\r\n\t\tvar firstConfig = utils.copy(first.getConfig().parsed);\r\n\r\n\t\tvar secondConfig = utils.copy(second.getConfig().parsed);\r\n\r\n\t\tvar mergedSettings = {\r\n\t\t\thours: this._toHoursArray(this._mergeHoursConfig(firstConfig.hours, secondConfig.hours)),\r\n\t\t\tdates: {}\r\n\t\t};\r\n\r\n\t\tfor(var i in firstConfig.dates){\r\n\t\t\tvar firstDate = firstConfig.dates[i];\r\n\t\t\tvar secondDate = secondConfig.dates[i];\r\n\r\n\t\t\t// if this key is a working date in both calendars\r\n\t\t\tif(firstDate && secondDate){\r\n\t\t\t\t// if at least one of working date is set by hours config - build intersection\r\n\t\t\t\tif(Array.isArray(firstDate) || Array.isArray(secondDate)){\r\n\t\t\t\t\tvar firstHours = Array.isArray(firstDate) ? firstDate : firstConfig.hours;\r\n\t\t\t\t\tvar secondHours = Array.isArray(secondDate) ? secondDate : secondConfig.hours;\r\n\t\t\t\t\tmergedSettings.dates[i] = this._toHoursArray(this._mergeHoursConfig(firstHours, secondHours));\r\n\t\t\t\t}else{\r\n\t\t\t\t\t// date will use global hours\r\n\t\t\t\t\tmergedSettings.dates[i] = true;\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tmergedSettings.dates[i] = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\treturn mergedSettings;\r\n\r\n\t}\r\n\r\n};\r\n\r\nmodule.exports = WorkTimeCalendarMerger;","var utils = require(\"../../utils/utils\");\r\nvar createArgumentsHelper = require(\"./calendar_arguments_helper\");\r\nvar CalendarMergeHelper = require(\"./strategy/work_calendar_merger\");\r\nvar CalendarWorkTimeStrategy = require(\"./strategy/calendar_strategy\");\r\nvar legacyResourceCalendarConfig = require(\"./legacy_resource_config\");\r\nvar dynamicResourceCalendars = require(\"./dynamic_resource_calendars\")();\r\n\r\nfunction CalendarManager (gantt){\r\n\tthis.$gantt = gantt;\r\n\tthis._calendars = {};\r\n}\r\n\r\nCalendarManager.prototype = {\r\n\t_calendars: {},\r\n\t_convertWorkTimeSettings: function (settings) {\r\n\t\tvar days = settings.days;\r\n\t\tif (days && !settings.dates) {\r\n\t\t\tsettings.dates = settings.dates || {};\r\n\t\t\tfor (var i = 0; i < days.length; i++) {\r\n\t\t\t\tsettings.dates[i] = days[i];\r\n\t\t\t\tif (!(days[i] instanceof Array)) {\r\n\t\t\t\t\tsettings.dates[i] = !!days[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tdelete settings.days;\r\n\t\treturn settings;\r\n\t},\r\n\tmergeCalendars: function(){\r\n\t\tvar calendars = [];\r\n\t\tvar args = arguments;\r\n\t\tif(Array.isArray(args[0])){\r\n\t\t\tcalendars = args[0].slice();\r\n\t\t}else{\r\n\t\t\tfor(var i = 0; i < arguments.length; i++){\r\n\t\t\t\tcalendars.push(arguments[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar mergeHelper = new CalendarMergeHelper();\r\n\r\n\t\tvar result;\r\n\t\tcalendars.forEach(function(calendar){\r\n\t\t\tif(!result){\r\n\t\t\t\tresult = calendar;\r\n\t\t\t} else{\r\n\t\t\t\tresult = this._createCalendarFromConfig(mergeHelper.merge(result, calendar));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}.bind(this));\r\n\t\treturn this.createCalendar(result);\r\n\t},\r\n\r\n\t_createCalendarFromConfig: function(config){\r\n\t\tvar apiCore = new CalendarWorkTimeStrategy(this.$gantt, createArgumentsHelper(this.$gantt));\r\n\t\tapiCore.id = String(utils.uid());\r\n\t\tapiCore._setConfig(this._convertWorkTimeSettings(config));\r\n\r\n\t\treturn apiCore;\r\n\t},\r\n\r\n\tcreateCalendar: function (parentCalendar) {\r\n\t\tvar settings;\r\n\r\n\t\tif (!parentCalendar) {\r\n\t\t\tparentCalendar = {};\r\n\t\t}\r\n\r\n\t\tif (parentCalendar.getConfig){\r\n\t\t\tsettings = utils.copy(parentCalendar.getConfig());\r\n\t\t} else if (parentCalendar.worktime) {\r\n\t\t\tsettings = utils.copy(parentCalendar.worktime);\r\n\t\t} else {\r\n\t\t\tsettings = utils.copy(parentCalendar);\r\n\t\t}\r\n\r\n\t\tvar defaults = utils.copy(this.defaults.fulltime.worktime);\r\n\t\tutils.mixin(settings, defaults);\r\n\r\n\t\treturn this._createCalendarFromConfig(settings);\r\n\t},\r\n\r\n\tgetCalendar: function (id) {\r\n\t\tid = id || \"global\";\r\n\t\tthis.createDefaultCalendars();\r\n\t\treturn this._calendars[id];\r\n\t},\r\n\r\n\tgetCalendars: function () {\r\n\t\tvar res = [];\r\n\t\tfor (var i in this._calendars) {\r\n\t\t\tres.push(this.getCalendar(i));\r\n\t\t}\r\n\t\treturn res;\r\n\t},\r\n\r\n\t_getOwnCalendar: function(task){\r\n\t\tvar config = this.$gantt.config;\r\n\t\tif (task[config.calendar_property]) {\r\n\t\t\treturn this.getCalendar(task[config.calendar_property]);\r\n\t\t}\r\n\r\n\t\tif (config.resource_calendars) {\r\n\t\t\tvar calendar;\r\n\t\t\tvar calendarId;\r\n\t\t\tvar resourceProperty = legacyResourceCalendarConfig.getResourceProperty(config);\r\n\t\t\tif(Array.isArray(task[resourceProperty])){\r\n\t\t\t\t// if multiple resources are attached to the task - merge their calendars\r\n\t\t\t\tif(config.dynamic_resource_calendars){\r\n\t\t\t\t\tcalendarId = dynamicResourceCalendars.getCalendarIdFromMultipleResources(task[resourceProperty], this);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tif(legacyResourceCalendarConfig.isLegacyResourceCalendarFormat(config.resource_calendars)){\r\n\t\t\t\t\tvar calendarId = legacyResourceCalendarConfig.getCalendarIdFromLegacyConfig(task, config.resource_calendars);\r\n\t\t\t\t}else if(resourceProperty && task[resourceProperty] && config.resource_calendars[task[resourceProperty]]){\r\n\t\t\t\t\tvar calendar = this.getResourceCalendar(task[resourceProperty]);\r\n\t\t\t\t}\r\n\t\t\t} \r\n\r\n\t\t\tif(calendarId){\r\n\t\t\t\tcalendar = this.getCalendar(calendarId);\r\n\t\t\t}\r\n\r\n\t\t\tif(calendar){\r\n\t\t\t\treturn calendar;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns calendar assigned to the specified resource.\r\n\t * Returns the global calendar if no custom calendar is associated with the resource.\r\n\t * @param {(string|number|Object)} resource - resource object or resource id \r\n\t * @returns {object} Calendar object\r\n\t */\r\n\tgetResourceCalendar: function(resource) {\r\n\t\tif (resource === null || resource === undefined) {\r\n\t\t\treturn this.getCalendar();\r\n\t\t}\r\n\r\n\t\tvar resourceId = null;\r\n\t\t// if task id is provided\r\n\t\tif((typeof resource === \"number\" || typeof resource === \"string\")){\r\n\t\t\tresourceId = resource;\r\n\t\t}else{\r\n\t\t\tresourceId = resource.id || resource.key;\r\n\t\t}\r\n\r\n\t\tvar config = this.$gantt.config;\r\n\t\tvar calendarsConfig = config.resource_calendars;\r\n\t\tvar calendarId = null;\r\n\t\tif (calendarsConfig) {\r\n\t\t\tif(legacyResourceCalendarConfig.isLegacyResourceCalendarFormat(calendarsConfig)){\r\n\t\t\t\tfor(var field in calendarsConfig){\r\n\t\t\t\t\tif(calendarsConfig[field][resourceId]){\r\n\t\t\t\t\t\tcalendarId = calendarsConfig[field][resourceId];\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tvar calendarId = calendarsConfig[resourceId];\r\n\t\t\t}\r\n\r\n\t\t\tif(calendarId){\r\n\t\t\t\treturn this.getCalendar(calendarId);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn this.getCalendar();\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the calendar assigned to a task.\r\n\t * - Returns a calendar assigned via task[gantt.config.calendar_property] if specified.\r\n\t * - Returns a calendar assigned to the task resource if specified.\r\n\t * - Returns the global calendar otherwise.\r\n\t * @param {(string|number|Object)} task - task object or task id \r\n\t * @returns {object} Calendar object\r\n\t */\r\n\tgetTaskCalendar: function (task) {\r\n\t\tvar gantt = this.$gantt;\r\n\t\tvar taskObject;\r\n\t\tif (task === null || task === undefined) {\r\n\t\t\treturn this.getCalendar();\r\n\t\t}\r\n\r\n\t\t// if task id is provided\r\n\t\tif((typeof task === \"number\" || typeof task === \"string\") && gantt.isTaskExists(task)){\r\n\t\t\ttaskObject = gantt.getTask(task);\r\n\t\t}else{\r\n\t\t\ttaskObject = task;\r\n\t\t}\r\n\r\n\t\tif(!taskObject){\r\n\t\t\treturn this.getCalendar();\r\n\t\t}\r\n\r\n\t\tvar calendar = this._getOwnCalendar(taskObject);\r\n\t\tif (!calendar && gantt.config.inherit_calendar && gantt.isTaskExists(taskObject.parent)){\r\n\t\t\tvar stop = false;\r\n\t\t\tgantt.eachParent(function(parent){\r\n\t\t\t\tif(stop) return;\r\n\t\t\t\tif(gantt.isSummaryTask(parent)){\r\n\t\t\t\t\tcalendar = this._getOwnCalendar(parent);\r\n\t\t\t\t\tif(calendar){\r\n\t\t\t\t\t\tstop = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, taskObject.id, this);\r\n\t\t}\r\n\r\n\t\treturn calendar || this.getCalendar();\r\n\t},\r\n\r\n\taddCalendar: function(calendar) { // puts new calendar to Global Storage - gantt.calendarManager._calendars {}\r\n\t\tif (!(this.isCalendar(calendar))) {\r\n\t\t\tvar id = calendar.id;\r\n\t\t\tcalendar = this.createCalendar(calendar);\r\n\t\t\tcalendar.id = id;\r\n\t\t}\r\n\r\n\t\t// validate/check if empty calendar\r\n\t\tif (!calendar._tryChangeCalendarSettings(function () {\r\n\t\t\t})) {\r\n\r\n\t\t\tthis.$gantt.callEvent(\"onCalendarError\", [{message: \"Invalid calendar settings, no worktime available\"}, calendar]);\r\n\t\t\treturn null;\r\n\t\t} else {\r\n\t\t\tvar config = this.$gantt.config;\r\n\r\n\t\t\tcalendar.id = calendar.id || utils.uid();\r\n\t\t\tthis._calendars[calendar.id] = calendar;\r\n\t\t\tif (!config.worktimes)\r\n\t\t\t\tconfig.worktimes = {};\r\n\t\t\tconfig.worktimes[calendar.id] = calendar.getConfig();\r\n\t\t\treturn calendar.id;\r\n\t\t}\r\n\t},\r\n\r\n\tdeleteCalendar: function (calendar) {\r\n\t\tvar config = this.$gantt.config;\r\n\t\tif (!calendar) return false;\r\n\t\tif (this._calendars[calendar]) {\r\n\t\t\tdelete this._calendars[calendar];\r\n\t\t\tif (config.worktimes && config.worktimes[calendar])\r\n\t\t\t\tdelete config.worktimes[calendar];\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t},\r\n\r\n\trestoreConfigCalendars: function (configs) {\r\n\t\tfor (var i in configs) {\r\n\t\t\tif (this._calendars[i])\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tvar settings = configs[i];\r\n\t\t\tvar calendar = this.createCalendar(settings);\r\n\t\t\tcalendar.id = i;\r\n\t\t\tthis.addCalendar(calendar);\r\n\t\t}\r\n\t},\r\n\r\n\tdefaults: {\r\n\t\tglobal: {\r\n\t\t\tid: \"global\",\r\n\t\t\tworktime: {\r\n\t\t\t\thours: [8, 12, 13, 17],\r\n\t\t\t\tdays: [0, 1, 1, 1, 1, 1, 0]\r\n\t\t\t}\r\n\t\t},\r\n\t\tfulltime: {\r\n\t\t\tid: \"fulltime\",\r\n\t\t\tworktime: {\r\n\t\t\t\thours: [0, 24],\r\n\t\t\t\tdays: [1, 1, 1, 1, 1, 1, 1]\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tcreateDefaultCalendars: function () {\r\n\t\tvar config = this.$gantt.config;\r\n\t\tthis.restoreConfigCalendars(this.defaults);\r\n\t\tthis.restoreConfigCalendars(config.worktimes);\r\n\t},\r\n\r\n\tisCalendar: function(possibleCalendar) {\r\n\t\t// because we don't have any way to check without dependency to CalendarWorkTimeStrategy\r\n\t\tvar props = [\r\n\t\t\tpossibleCalendar.isWorkTime,\r\n\t\t\tpossibleCalendar.setWorkTime,\r\n\t\t\tpossibleCalendar.getWorkHours,\r\n\t\t\tpossibleCalendar.unsetWorkTime,\r\n\t\t\tpossibleCalendar.getClosestWorkTime,\r\n\t\t\tpossibleCalendar.calculateDuration,\r\n\t\t\tpossibleCalendar.hasDuration,\r\n\t\t\tpossibleCalendar.calculateEndDate\r\n\t\t];\r\n\t\treturn props.every(function(entry) {\r\n\t\t\treturn entry instanceof Function;\r\n\t\t});\r\n\t}\r\n};\r\n\r\nmodule.exports = CalendarManager;","var CalendarManager = require(\"./calendar_manager\"),\r\n\tTimeCalculator = require(\"./time_calculator\"),\r\n\tworktimeFacadeFactory = require(\"../facades/worktime_calendars\"),\r\n\tutils = require(\"../../utils/utils\");\r\n\r\nmodule.exports = function (gantt) {\r\n\tvar manager = new CalendarManager(gantt),\r\n\ttimeCalculator = new TimeCalculator(manager);\r\n\tvar facade = worktimeFacadeFactory.create(manager, timeCalculator);\r\n\tutils.mixin(gantt, facade);\r\n};\r\n","var helpers = require(\"../utils/helpers\");\r\n\r\nmodule.exports = function(gantt) {\r\n\r\n\tgantt.load = function (url, type, callback) {\r\n\t\tthis._load_url = url;\r\n\t\tthis.assert(arguments.length, \"Invalid load arguments\");\r\n\r\n\t\tvar tp = 'json', cl = null;\r\n\t\tif (arguments.length >= 3) {\r\n\t\t\ttp = type;\r\n\t\t\tcl = callback;\r\n\t\t} else {\r\n\t\t\tif (typeof arguments[1] == \"string\")\r\n\t\t\t\ttp = arguments[1];\r\n\t\t\telse if (typeof arguments[1] == \"function\")\r\n\t\t\t\tcl = arguments[1];\r\n\t\t}\r\n\r\n\t\tthis._load_type = tp;\r\n\r\n\t\tthis.callEvent(\"onLoadStart\", [url, tp]);\r\n\r\n\t\treturn this.ajax.get(url, gantt.bind(function (l) {\r\n\t\t\tthis.on_load(l, tp);\r\n\t\t\tthis.callEvent(\"onLoadEnd\", [url, tp]);\r\n\t\t\tif (typeof cl == \"function\")\r\n\t\t\t\tcl.call(this);\r\n\t\t}, this));\r\n\t};\r\n\tgantt.parse = function (data, type) {\r\n\t\tthis.on_load({xmlDoc: {responseText: data}}, type);\r\n\t};\r\n\r\n\tgantt.serialize = function (type) {\r\n\t\ttype = type || \"json\";\r\n\t\treturn this[type].serialize();\r\n\t};\r\n\r\n\t/*\r\n\ttasks and relations\r\n\t{\r\n\tdata:[\r\n\t\t{\r\n\t\t\t\"id\":\"string\",\r\n\t\t\t\"text\":\"...\",\r\n\t\t\t\"start_date\":\"Date or string\",\r\n\t\t\t\"end_date\":\"Date or string\",\r\n\t\t\t\"duration\":\"number\",\r\n\t\t\t\"progress\":\"0..1\",\r\n\t\t\t\"parent_id\":\"string\",\r\n\t\t\t\"order\":\"number\"\r\n\t\t},...],\r\n\tlinks:[\r\n\t\t{\r\n\t\t\tid:\"string\",\r\n\t\t\tsource:\"string\",\r\n\t\t\ttarget:\"string\",\r\n\t\t\ttype:\"string\"\r\n\t\t},...],\r\n\tcollections:{\r\n\t\t\tcollectionName:[\r\n\t\t\t\t{key:, label:, optional:...},...\r\n\t\t\t],...\r\n\t\t}\r\n\t}\r\n\r\n\t* */\r\n\r\n\tgantt.on_load = function (resp, type) {\r\n\t\tif(resp.xmlDoc && resp.xmlDoc.status === 404){ // work if we don't have a file at current url\r\n\t\t\tthis.assert(false, \"Failed to load the data from \" \r\n\t\t\t\t+ resp.xmlDoc.responseURL + \", server returns 404\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.callEvent(\"onBeforeParse\", []);\r\n\t\tif (!type)\r\n\t\t\ttype = \"json\";\r\n\t\tthis.assert(this[type], \"Invalid data type:'\" + type + \"'\");\r\n\r\n\t\tvar raw = resp.xmlDoc.responseText;\r\n\r\n\t\tvar data = this[type].parse(raw, resp);\r\n\t\tthis._process_loading(data);\r\n\t};\r\n\r\n\tgantt._process_loading = function (data) {\r\n\t\tif(data.collections)\r\n\t\t\tthis._load_collections(data.collections);\r\n\r\n\t\tthis.$data.tasksStore.parse(data.data || data.tasks);\r\n\t\tvar links = data.links || (data.collections ? data.collections.links : []);\r\n\t\tthis.$data.linksStore.parse(links);\r\n\r\n\t\t//this._sync_links();\r\n\t\tthis.callEvent(\"onParse\", []);\r\n\t\tthis.render();\r\n\t};\r\n\r\n\tgantt._load_collections = function (collections) {\r\n\t\tvar collections_loaded = false;\r\n\t\tfor (var key in collections) {\r\n\t\t\tif (collections.hasOwnProperty(key)) {\r\n\t\t\t\tcollections_loaded = true;\r\n\t\t\t\tvar collection = collections[key];\r\n\t\t\t\tvar arr = this.serverList[key];\r\n\t\t\t\tif (!arr) continue;\r\n\t\t\t\tarr.splice(0, arr.length); //clear old options\r\n\t\t\t\tfor (var j = 0; j < collection.length; j++) {\r\n\t\t\t\t\tvar option = collection[j];\r\n\t\t\t\t\tvar obj = this.copy(option);\r\n\t\t\t\t\tobj.key = obj.value;// resulting option object\r\n\r\n\t\t\t\t\tfor (var option_key in option) {\r\n\t\t\t\t\t\tif (option.hasOwnProperty(option_key)) {\r\n\t\t\t\t\t\t\tif (option_key == \"value\" || option_key == \"label\")\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\tobj[option_key] = option[option_key]; // obj['value'] = option['value']\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tarr.push(obj);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (collections_loaded)\r\n\t\t\tthis.callEvent(\"onOptionsLoad\", []);\r\n\t};\r\n\r\n\tgantt.attachEvent(\"onBeforeTaskDisplay\", function (id, task) {\r\n\t\treturn !task.$ignore;\r\n\t});\r\n\r\n\tfunction jsonParseError(data){\r\n\t\tgantt.assert(false, \"Can't parse data: incorrect value of gantt.parse or gantt.load method. \"\r\n\t\t\t+ \"Actual argument value: \" + JSON.stringify(data));\r\n\t\tthrow new Error(\"Invalid argument for gantt.parse or gantt.load. An object or a JSON string of format https://docs.dhtmlx.com/gantt/desktop__supported_data_formats.html#json is expected. Actual argument value: \"\r\n\t\t\t+ JSON.stringify(data));\r\n\t}\r\n\r\n\tgantt.json = {\r\n\t\tparse: function (data) {\r\n\t\t\tif(!data){\r\n\t\t\t\tjsonParseError(data);\r\n\t\t\t}\r\n\r\n\t\t\tif (typeof data == \"string\") {\r\n\t\t\t\tif (typeof JSON != undefined){\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\tdata = JSON.parse(data);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcatch(e) {\r\n\t\t\t\t\t\tjsonParseError(data);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tgantt.assert(false, \"JSON is not supported\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(!data.data && !data.tasks){\r\n\t\t\t\tjsonParseError(data);\r\n\t\t\t}\r\n\r\n\t\t\tif (data.dhx_security)\r\n\t\t\t\tgantt.security_key = data.dhx_security;\r\n\t\t\treturn data;\r\n\t\t},\r\n\t\tserializeTask: function (task) {\r\n\t\t\treturn this._copyObject(task);\r\n\t\t},\r\n\t\tserializeLink: function (link) {\r\n\t\t\treturn this._copyLink(link);\r\n\t\t},\r\n\t\t_copyLink: function (obj) {\r\n\t\t\tvar copy = {};\r\n\t\t\tfor (var key in obj)\r\n\t\t\t\tcopy[key] = obj[key];\r\n\t\t\treturn copy;\r\n\t\t},\r\n\t\t_copyObject: function (obj) {\r\n\t\t\tvar copy = {};\r\n\t\t\tfor (var key in obj) {\r\n\t\t\t\tif (key.charAt(0) == \"$\")\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\tcopy[key] = obj[key];\r\n\r\n\t\t\t\tif (helpers.isDate(copy[key])) {\r\n\t\t\t\t\tcopy[key] = gantt.defined(gantt.templates.xml_format) ? gantt.templates.xml_format(copy[key]) : gantt.templates.format_date(copy[key]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn copy;\r\n\t\t},\r\n\t\tserialize: function () {\r\n\t\t\tvar tasks = [];\r\n\t\t\tvar links = [];\r\n\r\n\t\t\tgantt.eachTask(function (obj) {\r\n\t\t\t\tgantt.resetProjectDates(obj);\r\n\t\t\t\ttasks.push(this.serializeTask(obj));\r\n\t\t\t}, gantt.config.root_id, this);\r\n\r\n\t\t\tvar rawLinks = gantt.getLinks();\r\n\t\t\tfor (var i = 0; i < rawLinks.length; i++) {\r\n\t\t\t\tlinks.push(this.serializeLink(rawLinks[i]));\r\n\t\t\t}\r\n\r\n\t\t\treturn {\r\n\t\t\t\tdata: tasks,\r\n\t\t\t\tlinks: links\r\n\t\t\t};\r\n\t\t}\r\n\t};\r\n\r\n\t/*\r\n\t\r\n\t\t\r\n\t\t\tMy task 1\r\n\t\t\t16.08.2013\r\n\t\t\t22.08.2013\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\t*/\r\n\r\n\tfunction xmlParseError(data){\r\n\t\tgantt.assert(false, \"Can't parse data: incorrect value of gantt.parse or gantt.load method. \"\r\n\t\t\t+ \"Actual argument value: \" + JSON.stringify(data));\r\n\t\tthrow new Error(\"Invalid argument for gantt.parse or gantt.load. An XML of format https://docs.dhtmlx.com/gantt/desktop__supported_data_formats.html#xmldhtmlxgantt20 is expected. Actual argument value: \"\r\n\t\t\t+ JSON.stringify(data));\r\n\t}\r\n\r\n\tgantt.xml = {\r\n\t\t_xmlNodeToJSON: function (node, attrs_only) {\r\n\t\t\tvar t = {};\r\n\t\t\tfor (var i = 0; i < node.attributes.length; i++)\r\n\t\t\t\tt[node.attributes[i].name] = node.attributes[i].value;\r\n\r\n\t\t\tif (!attrs_only) {\r\n\t\t\t\tfor (var i = 0; i < node.childNodes.length; i++) {\r\n\t\t\t\t\tvar child = node.childNodes[i];\r\n\t\t\t\t\tif (child.nodeType == 1)\r\n\t\t\t\t\t\tt[child.tagName] = child.firstChild ? child.firstChild.nodeValue : \"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!t.text) t.text = node.firstChild ? node.firstChild.nodeValue : \"\";\r\n\t\t\t}\r\n\r\n\t\t\treturn t;\r\n\t\t},\r\n\t\t_getCollections: function (loader) {\r\n\t\t\tvar collection = {};\r\n\t\t\tvar opts = gantt.ajax.xpath(\"//coll_options\", loader);\r\n\t\t\tfor (var i = 0; i < opts.length; i++) {\r\n\t\t\t\tvar bind = opts[i].getAttribute(\"for\");\r\n\t\t\t\tvar arr = collection[bind] = [];\r\n\t\t\t\tvar itms = gantt.ajax.xpath(\".//item\", opts[i]);\r\n\t\t\t\tfor (var j = 0; j < itms.length; j++) {\r\n\t\t\t\t\tvar itm = itms[j];\r\n\t\t\t\t\tvar attrs = itm.attributes;\r\n\t\t\t\t\tvar obj = {key: itms[j].getAttribute(\"value\"), label: itms[j].getAttribute(\"label\")};\r\n\t\t\t\t\tfor (var k = 0; k < attrs.length; k++) {\r\n\t\t\t\t\t\tvar attr = attrs[k];\r\n\t\t\t\t\t\tif (attr.nodeName == \"value\" || attr.nodeName == \"label\")\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tobj[attr.nodeName] = attr.nodeValue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tarr.push(obj);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn collection;\r\n\t\t},\r\n\t\t_getXML: function (text, loader, toptag) {\r\n\t\t\ttoptag = toptag || \"data\";\r\n\t\t\tif (!loader.getXMLTopNode) {\r\n\t\t\t\tloader = gantt.ajax.parse(loader);\r\n\t\t\t}\r\n\r\n\t\t\tvar xml = gantt.ajax.xmltop(toptag, loader.xmlDoc);\r\n\t\t\tif (!xml || xml.tagName != toptag) {\r\n\t\t\t\txmlParseError(text);\r\n\t\t\t}\r\n\r\n\t\t\tvar skey = xml.getAttribute(\"dhx_security\");\r\n\t\t\tif (skey)\r\n\t\t\t\tgantt.security_key = skey;\r\n\r\n\t\t\treturn xml;\r\n\t\t},\r\n\t\tparse: function (text, loader) {\r\n\t\t\tloader = this._getXML(text, loader);\r\n\t\t\tvar data = {};\r\n\r\n\t\t\tvar evs = data.data = [];\r\n\t\t\tvar xml = gantt.ajax.xpath(\"//task\", loader);\r\n\r\n\t\t\tfor (var i = 0; i < xml.length; i++)\r\n\t\t\t\tevs[i] = this._xmlNodeToJSON(xml[i]);\r\n\r\n\t\t\tdata.collections = this._getCollections(loader);\r\n\t\t\treturn data;\r\n\t\t},\r\n\t\t_copyLink: function (obj) {\r\n\t\t\treturn \"\";\r\n\t\t},\r\n\t\t_copyObject: function (obj) {\r\n\t\t\treturn \"\";\r\n\t\t},\r\n\t\tserialize: function () {\r\n\t\t\tvar tasks = [];\r\n\t\t\tvar links = [];\r\n\r\n\t\t\tvar json = gantt.json.serialize();\r\n\t\t\tfor (var i = 0, len = json.data.length; i < len; i++) {\r\n\t\t\t\ttasks.push(this._copyObject(json.data[i]));\r\n\t\t\t}\r\n\t\t\tfor (var i = 0, len = json.links.length; i < len; i++) {\r\n\t\t\t\tlinks.push(this._copyLink(json.links[i]));\r\n\t\t\t}\r\n\t\t\treturn \"\" + tasks.join(\"\") + \"\" + links.join(\"\") + \"\";\r\n\t\t}\r\n\t};\r\n\r\n\r\n\tgantt.oldxml = {\r\n\t\tparse: function (text, loader) {\r\n\t\t\tloader = gantt.xml._getXML(text, loader, \"projects\");\r\n\t\t\tvar data = {collections: {links: []}};\r\n\r\n\t\t\tvar evs = data.data = [];\r\n\t\t\tvar xml = gantt.ajax.xpath(\"//task\", loader);\r\n\r\n\t\t\tfor (var i = 0; i < xml.length; i++) {\r\n\t\t\t\tevs[i] = gantt.xml._xmlNodeToJSON(xml[i]);\r\n\t\t\t\tvar parent = xml[i].parentNode;\r\n\r\n\t\t\t\tif (parent.tagName == \"project\")\r\n\t\t\t\t\tevs[i].parent = \"project-\" + parent.getAttribute(\"id\");\r\n\t\t\t\telse\r\n\t\t\t\t\tevs[i].parent = parent.parentNode.getAttribute(\"id\");\r\n\t\t\t}\r\n\r\n\t\t\txml = gantt.ajax.xpath(\"//project\", loader);\r\n\t\t\tfor (var i = 0; i < xml.length; i++) {\r\n\t\t\t\tvar ev = gantt.xml._xmlNodeToJSON(xml[i], true);\r\n\t\t\t\tev.id = \"project-\" + ev.id;\r\n\t\t\t\tevs.push(ev);\r\n\t\t\t}\r\n\r\n\t\t\tfor (var i = 0; i < evs.length; i++) {\r\n\t\t\t\tvar ev = evs[i];\r\n\t\t\t\tev.start_date = ev.startdate || ev.est;\r\n\t\t\t\tev.end_date = ev.enddate;\r\n\t\t\t\tev.text = ev.name;\r\n\t\t\t\tev.duration = ev.duration / 8;\r\n\t\t\t\tev.open = 1;\r\n\t\t\t\tif (!ev.duration && !ev.end_date) ev.duration = 1;\r\n\t\t\t\tif (ev.predecessortasks)\r\n\t\t\t\t\tdata.collections.links.push({\r\n\t\t\t\t\t\ttarget: ev.id,\r\n\t\t\t\t\t\tsource: ev.predecessortasks,\r\n\t\t\t\t\t\ttype: gantt.config.links.finish_to_start\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\treturn data;\r\n\t\t},\r\n\t\tserialize: function () {\r\n\t\t\tgantt.message(\"Serialization to 'old XML' is not implemented\");\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.serverList = function (name, array) {\r\n\t\tif (array) {\r\n\t\t\tthis.serverList[name] = array.slice(0);\r\n\t\t} else if (!this.serverList[name]) {\r\n\t\t\tthis.serverList[name] = [];\r\n\t\t}\r\n\t\treturn this.serverList[name];\r\n\t};\r\n\r\n};","module.exports = function(gantt) {\r\n\tgantt.isReadonly = function (item) {\r\n\t\tif (item && item[this.config.editable_property]) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\treturn (item && item[this.config.readonly_property]) || this.config.readonly;\r\n\t\t}\r\n\t};\r\n};","module.exports = function(gantt) {\r\n\tgantt.getGridColumn = function(name) {\r\n\t\tvar columns = gantt.config.columns;\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tif (columns[i].name == name)\r\n\t\t\t\treturn columns[i];\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t};\r\n\r\n\tgantt.getGridColumns = function() {\r\n\t\treturn gantt.config.columns.slice();\r\n\t};\r\n};","const SENSITIVITY = 20;\r\nconst TIMEOUT = 50;\r\nconst SCROLLSTEP = 10;\r\n\r\nexport default class ScrollableGrid {\r\n\tpublic getCurrentX;\r\n\tprivate $gantt;\r\n\tprivate $grid;\r\n\tprivate _dnd;\r\n\tprivate _scrollView;\r\n\tprivate _scrollOrder: 0 | 1 | -1 = 0;\r\n\r\n\tconstructor(params) {\r\n\t\tconst {gantt, grid, dnd, getCurrentX} = params;\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$grid = grid;\r\n\t\tthis._dnd = dnd;\r\n\t\tthis.getCurrentX = getCurrentX;\r\n\t\tthis._scrollView = this.$gantt.$ui.getView(this.$grid.$config.scrollX);\r\n\t\tthis.attachEvents();\r\n\t}\r\n\tattachEvents() {\r\n\t\tif (this.isScrollable()) {\r\n\t\t\tthis._dnd.attachEvent(\"onDragMove\", (obj, e) => {\r\n\t\t\t\tconst gridBoundingRect = this.$grid.$grid.getBoundingClientRect();\r\n\t\t\t\tconst maxLeft = gridBoundingRect.right;\r\n\t\t\t\tconst minLeft = gridBoundingRect.left;\r\n\t\t\t\tconst currentX = this.getCurrentX(e.clientX);\r\n\r\n\t\t\t\tif (currentX >= maxLeft - SENSITIVITY) {\r\n\t\t\t\t\tthis.autoscrollRight();\r\n\t\t\t\t\tthis.autoscrollStart();\r\n\t\t\t\t}\r\n\t\t\t\tif (currentX <= minLeft + SENSITIVITY) {\r\n\t\t\t\t\tthis.autoscrollLeft();\r\n\t\t\t\t\tthis.autoscrollStart();\r\n\t\t\t\t}\r\n\t\t\t\tif (currentX < maxLeft - SENSITIVITY && currentX > minLeft + SENSITIVITY) {\r\n\t\t\t\t\tthis.autoscrollStop();\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\t\t\tthis._dnd.attachEvent(\"onDragEnd\", () => {\r\n\t\t\t\tthis.autoscrollStop();\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tautoscrollStart() {\r\n\t\tif (this._scrollOrder === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst scrollStep = SCROLLSTEP * this._scrollOrder;\r\n\t\tconst scrollState = this._scrollView.getScrollState();\r\n\t\tthis._scrollView.scrollTo(scrollState.position + scrollStep);\r\n\t\tsetTimeout(() => { this.autoscrollStart(); }, TIMEOUT);\r\n\t}\r\n\tautoscrollRight() {\r\n\t\tthis._scrollOrder = 1;\r\n\t}\r\n\tautoscrollLeft() {\r\n\t\tthis._scrollOrder = -1;\r\n\t}\r\n\tautoscrollStop() {\r\n\t\tthis._scrollOrder = 0;\r\n\t}\r\n\tgetCorrection() {\r\n\t\tif (!this.isScrollable()) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\treturn this._scrollView.getScrollState().position;\r\n\t}\r\n\tisScrollable() {\r\n\t\treturn !!this.$grid.$config.scrollable;\r\n\t}\r\n}","import * as domHelpers from \"../../utils/dom_helpers\";\r\nimport ScrollableGrid from \"./scrollable_grid\";\r\n\r\nconst COLUMN_ID_ATTR_NAME = \"data-column-id\";\r\n\r\nexport class ColumnsGridDnd {\r\n\tprivate $gantt;\r\n\tprivate $grid;\r\n\tprivate _dragX;\r\n\tprivate _dnd;\r\n\tprivate _originAutoscroll;\r\n\tprivate _scrollableGrid: ScrollableGrid;\r\n\tprivate _draggedCell;\r\n\tprivate _targetMarker = null;\r\n\tprivate _gridConfig;\r\n\tconstructor(gantt, grid) {\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$grid = grid;\r\n\t}\r\n\tinit() {\r\n\t\tconst DND = this.$gantt.$services.getService(\"dnd\");\r\n\t\tthis._dnd = new DND(this.$grid.$grid_scale, { updates_per_second: 60 });\r\n\t\tthis._scrollableGrid = new ScrollableGrid({\r\n\t\t\tgantt: this.$gantt,\r\n\t\t\tgrid: this.$grid,\r\n\t\t\tdnd: this._dnd,\r\n\t\t\tgetCurrentX: this.calculateCurrentPosition\r\n\t\t});\r\n\t\tthis.attachEvents();\r\n\t}\r\n\tattachEvents() {\r\n\t\tthis._dnd.attachEvent(\"onBeforeDragStart\", (obj, e) => {\r\n\t\t\tthis._gridConfig = this.$grid.$getConfig();\r\n\t\t\tthis._originAutoscroll = this.$gantt.config.autoscroll;\r\n\t\t\tthis.$gantt.config.autoscroll = false;\r\n\t\t\tthis._draggedCell = this.$gantt.utils.dom.closest(e.target, \".gantt_grid_head_cell\");\r\n\t\t\tif (!this._draggedCell) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tthis._dnd.attachEvent(\"onAfterDragStart\", (obj, e) => {\r\n\t\t\tthis._dnd.config.column = this._draggedCell.getAttribute(COLUMN_ID_ATTR_NAME);\r\n\t\t\tthis._dnd.config.marker.innerHTML = this._draggedCell.outerHTML;\r\n\t\t\tthis._dnd.config.marker.classList.add(\"gantt_column_drag_marker\");\r\n\t\t\tthis._dnd.config.marker.style.height = this._gridConfig.scale_height + \"px\";\r\n\t\t\tthis._dnd.config.marker.style.lineHeight = this._gridConfig.scale_height + \"px\";\r\n\t\t\tthis._draggedCell.classList.add(\"gantt_grid_head_cell_dragged\");\r\n\t\t});\r\n\r\n\t\tthis._dnd.attachEvent(\"onDragMove\", (obj, e) => {\r\n\t\t\tthis._dragX = e.clientX;\r\n\t\t\tconst x = this.calculateCurrentPosition(e.clientX);\r\n\t\t\tthis.setMarkerPosition(x);\r\n\t\t\tthis.drawTargetMarker(this.findColumnsIndexes());\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tthis._dnd.attachEvent(\"onDragEnd\", () => {\r\n\t\t\tthis.$gantt.config.autoscroll = this._originAutoscroll;\r\n\t\t\tthis._draggedCell.classList.remove(\"gantt_grid_head_cell_dragged\");\r\n\t\t\tthis.cleanTargetMarker();\r\n\t\t\tthis.reorderColumns();\r\n\t\t});\r\n\r\n\t}\r\n\treorderColumns() {\r\n\t\tconst { targetIndex, draggedIndex } = this.findColumnsIndexes();\r\n\r\n\t\tif (targetIndex === draggedIndex) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst columns = this.$grid.$getConfig().columns;\r\n\t\tconst draggedColumn = columns[draggedIndex];\r\n\t\tconst targetColumn = columns[targetIndex];\r\n\r\n\t\tif (this.$grid.callEvent(\"onBeforeColumnReorder\", [{ draggedColumn, targetColumn, draggedIndex, targetIndex }]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\r\n\t\tcolumns.splice(draggedIndex, 1);\r\n\t\tcolumns.splice(targetIndex, 0, draggedColumn);\r\n\t\tthis.$gantt.render();\r\n\t\tthis.$grid.callEvent(\"onAfterColumnReorder\", [{ draggedColumn, targetColumn, draggedIndex, targetIndex }]);\r\n\t}\r\n\tfindColumnsIndexes() {\r\n\t\tconst draggedId = this._dnd.config.column;\r\n\t\tconst columns = this.$grid.$getConfig().columns;\r\n\t\tlet targetIndex: number;\r\n\t\tlet draggedIndex: number;\r\n\t\tlet xBefore: number;\r\n\t\tlet xAfter: number;\r\n\t\tconst currentColumn = { startX: 0, endX: 0 };\r\n\r\n\t\tlet start = 0;\r\n\t\tlet end = columns.length - 1;\r\n\t\tlet compare = (a, b) => a <= b;\r\n\t\tlet next = (index) => ++index;\r\n\t\tif (this.$gantt.config.rtl) {\r\n\t\t\tstart = columns.length - 1;\r\n\t\t\tend = 0;\r\n\t\t\tcompare = (a, b) => a >= b;\r\n\t\t\tnext = (index) => --index;\r\n\t\t}\r\n\r\n\t\tlet columnRelativePos: number;\r\n\r\n\t\tconst relativeX = this._dragX - this.$grid.$grid.getBoundingClientRect().left + this._scrollableGrid.getCorrection();\r\n\t\tfor (let i = start; compare(i, end); i = next(i)) {\r\n\t\t\tif (targetIndex !== undefined && draggedIndex !== undefined) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcurrentColumn.startX = currentColumn.endX;\r\n\t\t\tcurrentColumn.endX += columns[i].width;\r\n\r\n\t\t\t// if drop on a column or drop after the last column\r\n\t\t\tif (relativeX >= currentColumn.startX && (relativeX <= currentColumn.endX || !compare(next(i), end))) {\r\n\t\t\t\ttargetIndex = i;\r\n\t\t\t\txBefore = currentColumn.startX;\r\n\t\t\t\txAfter = currentColumn.endX;\r\n\t\t\t\tcolumnRelativePos = (relativeX - currentColumn.startX) / (currentColumn.endX - currentColumn.startX);\r\n\t\t\t}\r\n\t\t\tif (draggedId === columns[i].name) {\r\n\t\t\t\tdraggedIndex = i;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\ttargetIndex,\r\n\t\t\tdraggedIndex,\r\n\t\t\txBefore,\r\n\t\t\txAfter,\r\n\t\t\tcolumnRelativePos\r\n\t\t};\r\n\t}\r\n\tsetMarkerPosition(x: number, y: number = 10) {\r\n\t\tconst { marker } = this._dnd.config;\r\n\t\tconst gridOffset = this._dnd._obj.getBoundingClientRect();\r\n\t\tmarker.style.top = `${gridOffset.y + y}px`;\r\n\t\tmarker.style.left = `${x}px`;\r\n\t}\r\n\tcalculateCurrentPosition = (eventX: number) => {\r\n\t\tconst gridBoundingRect = this.$grid.$grid.getBoundingClientRect();\r\n\t\tconst maxLeft = gridBoundingRect.right;\r\n\t\tconst minLeft = gridBoundingRect.left;\r\n\t\tlet x = eventX;\r\n\t\tif (x > maxLeft) {\r\n\t\t\tx = maxLeft;\r\n\t\t}\r\n\t\tif (x < minLeft) {\r\n\t\t\tx = minLeft;\r\n\t\t}\r\n\t\treturn x;\r\n\t}\r\n\tdrawTargetMarker({ targetIndex, draggedIndex, xBefore, xAfter, columnRelativePos }) {\r\n\t\tif (!this._targetMarker) {\r\n\t\t\tthis._targetMarker = document.createElement(\"div\");\r\n\t\t\tdomHelpers.addClassName(this._targetMarker, \"gantt_grid_target_marker\");\r\n\t\t\tthis._targetMarker.style.display = \"none\";\r\n\t\t\tthis._targetMarker.style.height = `${this._gridConfig.scale_height}px`;\r\n\t\t}\r\n\r\n\t\t// marker can be detached after gantt.render\r\n\t\tif(!this._targetMarker.parentNode){\r\n\t\t\tthis.$grid.$grid_scale.appendChild(this._targetMarker);\r\n\t\t}\r\n\r\n\t\tlet nextPosition: number;\r\n\t\tif (targetIndex > draggedIndex) {\r\n\t\t\tnextPosition = xAfter;\r\n\t\t} else if (targetIndex < draggedIndex) {\r\n\t\t\tnextPosition = xBefore;\r\n\t\t} else {\r\n\t\t\tif(columnRelativePos > 0.5){\r\n\t\t\t\tnextPosition = xAfter;\r\n\t\t\t}else{\r\n\t\t\t\tnextPosition = xBefore;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._targetMarker.style.left = `${nextPosition}px`;\r\n\t\tthis._targetMarker.style.display = \"block\";\r\n\t}\r\n\tcleanTargetMarker() {\r\n\t\tif (this._targetMarker && this._targetMarker.parentNode) {\r\n\t\t\tthis.$grid.$grid_scale.removeChild(this._targetMarker);\r\n\t\t}\r\n\t\tthis._targetMarker = null;\r\n\t}\r\n}","import {ColumnsGridDnd} from \"./column_grid_dnd\";\r\nexport default ColumnsGridDnd;","function createResizer(gantt, grid){\r\n\treturn {\r\n\t\tinit: function(){},\r\n\t\tdoOnRender: function(){}\r\n\t};\r\n}\r\n\r\nmodule.exports = createResizer;","var Grid = require(\"./ui/grid/grid\");\r\n\r\nmodule.exports = function(gantt) {\r\n\trequire(\"./grid_column_api.gpl\")(gantt);\r\n\tGrid.prototype.getGridColumns = function () {\r\n\t\tvar config = this.$getConfig();\r\n\t\tvar columns = config.columns,\r\n\t\t\tvisibleColumns = [];\r\n\r\n\t\tfor (var i = 0; i < columns.length; i++) {\r\n\t\t\tif (!columns[i].hide)\r\n\t\t\t\tvisibleColumns.push(columns[i]);\r\n\t\t}\r\n\r\n\t\treturn visibleColumns;\r\n\t};\r\n};","module.exports = function(gantt) {\r\n\tvar TreeDataStore = require(\"./datastore/treedatastore\");\r\n\r\n\tvar loadedBranches = {};\r\n\tgantt.attachEvent(\"onClearAll\", function(){\r\n\t\tloadedBranches = {};\r\n\t});\r\n\r\n\tvar old_has_children = TreeDataStore.prototype.hasChild;\r\n\tgantt.$data.tasksStore.hasChild = function (id) {\r\n\t\tif (old_has_children.apply(this, arguments))\r\n\t\t\treturn true;\r\n\t\tif (this.exists(id)) {\r\n\t\t\treturn this.getItem(id)[gantt.config.branch_loading_property];\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\r\n\tfunction needLoading(id) {\r\n\t\tif (gantt.config.branch_loading && gantt._load_url) {\r\n\t\t\tvar alreadyLoaded = !!loadedBranches[id];\r\n\t\t\t// call ajax only if branch has children\r\n\t\t\tif (!alreadyLoaded && (!gantt.getChildren(id).length && gantt.hasChild(id))) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tgantt.attachEvent(\"onTaskOpened\", function (id) {\r\n\t\tif (gantt.config.branch_loading && gantt._load_url) {\r\n\t\t\t// call ajax only if branch has children\r\n\t\t\tif (needLoading(id)) {\r\n\t\t\t\tvar url = gantt._load_url;\r\n\t\t\t\turl = url.replace(/(\\?|&)?parent_id=.+&?/, \"\");\r\n\t\t\t\tvar param = url.indexOf(\"?\") >= 0 ? \"&\" : \"?\";\r\n\t\t\t\tvar y = gantt.getScrollState().y || 0;\r\n\r\n\t\t\t\tvar requestData = {\r\n\t\t\t\t\ttaskId: id,\r\n\t\t\t\t\turl: url + param + \"parent_id=\" + encodeURIComponent(id)\r\n\t\t\t\t};\r\n\r\n\t\t\t\tif(gantt.callEvent(\"onBeforeBranchLoading\", [requestData]) === false){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgantt.load(requestData.url, this._load_type, function () {\r\n\t\t\t\t\tif (y) {\r\n\t\t\t\t\t\tgantt.scrollTo(null, y);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgantt.callEvent(\"onAfterBranchLoading\", [requestData]);\r\n\t\t\t\t});\r\n\t\t\t\tloadedBranches[id] = true;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n};","export default class LinkFormatterSimple implements ILinkFormatter {\r\n\tstatic create = (settings: ILinkFormatterConfig = null, gantt: any): LinkFormatterSimple => {\r\n\t\treturn new LinkFormatterSimple(gantt);\r\n\t}\r\n\tprotected _linkReg: RegExp;\r\n\tprotected _gantt: any;\r\n\r\n\tconstructor(gantt: any) {\r\n\t\tthis._linkReg = /^[0-9\\.]+/;\r\n\t\tthis._gantt = gantt;\r\n\t}\r\n\r\n\tformat = (link: ILink) : string => {\r\n\t\tconst wbs = this._getWBSCode(link.source);\r\n\t\treturn wbs;\r\n\t}\r\n\r\n\tcanParse = (value: string) : boolean => {\r\n\t\treturn this._linkReg.test(value);\r\n\t}\r\n\tparse = (value: string) : ILink => {\r\n\t\tif(!this.canParse(value)){\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tconst linkPart = this._linkReg.exec(value)[0].trim();\r\n\r\n\t\tconst source = this._findSource(linkPart) || null;\r\n\r\n\t\treturn {\r\n\t\t\tid: undefined,\r\n\t\t\tsource,\r\n\t\t\ttarget: null,\r\n\t\t\ttype: this._gantt.config.links.finish_to_start,\r\n\t\t\tlag: 0\r\n\t\t};\r\n\t}\r\n\r\n\tprotected _getWBSCode = (source: number | string) => {\r\n\t\tconst pred = this._gantt.getTask(source);\r\n\t\treturn this._gantt.getWBSCode(pred);\r\n\t}\r\n\r\n\tprotected _findSource = (value: string) => {\r\n\t\tconst reqTemplate = new RegExp(\"^[0-9\\.]+\", \"i\");\r\n\t\tif(reqTemplate.exec(value)){\r\n\t\t\tconst wbs = reqTemplate.exec(value)[0];\r\n\t\t\tconst task = this._gantt.getTaskByWBSCode(wbs);\r\n\t\t\tif(task){\r\n\t\t\t\treturn task.id;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n}","\r\nvar DurationFormatter = require(\"../common/duration_formatter\").default;\r\nvar LinkFormatter = require(\"../common/link_formatter\").default;\r\n\r\nmodule.exports = function(gantt){\r\n\tgantt.ext.formatters = {\r\n\t\tdurationFormatter: function(settings){\r\n\t\t\tif(!settings){\r\n\t\t\t\tsettings = {};\r\n\t\t\t}\r\n\t\t\tif(!settings.store){\r\n\t\t\t\tsettings.store = gantt.config.duration_unit;\r\n\t\t\t}\r\n\t\t\tif(!settings.enter){\r\n\t\t\t\tsettings.enter = gantt.config.duration_unit;\r\n\t\t\t}\r\n\t\t\treturn DurationFormatter.create(settings, gantt);\r\n\t\t},\r\n\t\tlinkFormatter: function(settings){\r\n\t\t\treturn LinkFormatter.create(settings, gantt);\r\n\t\t}\r\n\t};\r\n};","module.exports = function(gantt) {\r\n\tfunction isEnabled() {\r\n\t\treturn gantt.config.auto_types && // if enabled\r\n\t\t\t(gantt.getTaskType(gantt.config.types.project) == gantt.config.types.project);// and supported\r\n\t}\r\n\r\n\tfunction callIfEnabled(callback) {\r\n\t\treturn function() {\r\n\t\t\tif (!isEnabled()) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn callback.apply(this, arguments);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction updateParents(childId) {\r\n\t\tgantt.batchUpdate(function() {\r\n\t\t\tcheckParent(childId);\r\n\t\t});\r\n\t}\r\n\r\n\tvar delTaskParent;\r\n\r\n\tfunction checkParent(id) {\r\n\t\tsetTaskType(id);\r\n\t\tvar parent = gantt.getParent(id);\r\n\r\n\t\tif (parent != gantt.config.root_id) {\r\n\t\t\tcheckParent(parent);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction setTaskType(id) {\r\n\t\tid = id.id || id;\r\n\t\tvar task = gantt.getTask(id);\r\n\t\tvar targetType = getTaskTypeToUpdate(task);\r\n\r\n\t\tif (targetType !== false) {\r\n\t\t\tupdateTaskType(task, targetType);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateTaskType(task, targetType) {\r\n\t\tif(!gantt.getState().group_mode){\r\n\t\t\ttask.type = targetType;\r\n\t\t\tgantt.updateTask(task.id);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction getTaskTypeToUpdate(task) {\r\n\t\tvar allTypes = gantt.config.types;\r\n\t\tvar hasChildren = gantt.hasChild(task.id);\r\n\t\tvar taskType = gantt.getTaskType(task.type);\r\n\r\n\t\tif (hasChildren && taskType === allTypes.task) {\r\n\t\t\treturn allTypes.project;\r\n\t\t}\r\n\r\n\t\tif (!hasChildren && taskType === allTypes.project) {\r\n\t\t\treturn allTypes.task;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\tvar isParsingDone = true;\r\n\r\n\tgantt.attachEvent(\"onParse\", callIfEnabled(function() {\r\n\t\tisParsingDone = false;\r\n\r\n\t\tgantt.batchUpdate(function() {\r\n\t\t\tgantt.eachTask(function(task) {\r\n\t\t\t\tvar targetType = getTaskTypeToUpdate(task);\r\n\t\t\t\tif (targetType !== false) {\r\n\t\t\t\t\tupdateTaskType(task, targetType);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tisParsingDone = true;\r\n\t}));\r\n\r\n\tgantt.attachEvent(\"onAfterTaskAdd\", callIfEnabled(function(id) {\r\n\t\tif (isParsingDone) {\r\n\t\t\tupdateParents(id);\r\n\t\t}\r\n\t}));\r\n\r\n\tgantt.attachEvent(\"onAfterTaskUpdate\", callIfEnabled(function(id) {\r\n\t\tif (isParsingDone) {\r\n\t\t\tupdateParents(id);\r\n\t\t}\r\n\t}));\r\n\r\n\tfunction updateAfterRemoveChild(id){\r\n\t\tif (id != gantt.config.root_id && gantt.isTaskExists(id)) {\r\n\t\t\tupdateParents(id);\r\n\t\t}\r\n\t}\r\n\r\n\tgantt.attachEvent(\"onBeforeTaskDelete\", callIfEnabled(function(id, task) {\r\n\t\tdelTaskParent = gantt.getParent(id);\r\n\t\treturn true;\r\n\t}));\r\n\r\n\tgantt.attachEvent(\"onAfterTaskDelete\", callIfEnabled(function(id, task) {\r\n\t\tupdateAfterRemoveChild(delTaskParent);\r\n\t}));\r\n\r\n\r\n\tvar originalRowDndParent;\r\n\r\n\tgantt.attachEvent(\"onRowDragStart\", callIfEnabled(function(id, target, e) {\r\n\t\toriginalRowDndParent = gantt.getParent(id);\r\n\t\treturn true;\r\n\t}));\r\n\r\n\tgantt.attachEvent(\"onRowDragEnd\", callIfEnabled(function(id, target) {\r\n\t\tupdateAfterRemoveChild(originalRowDndParent);\r\n\t\tupdateParents(id);\r\n\t}));\r\n\r\n\tvar originalMoveTaskParent;\r\n\r\n\tgantt.attachEvent(\"onBeforeTaskMove\", callIfEnabled(function(sid, parent, tindex) {\r\n\t\toriginalMoveTaskParent = gantt.getParent(sid);\r\n\t\treturn true;\r\n\t}));\r\n\r\n\tgantt.attachEvent(\"onAfterTaskMove\", callIfEnabled(function(id, parent, tindex) {\r\n\t\tif (document.querySelector(\".gantt_drag_marker\")) {\r\n\t\t\t// vertical dnd in progress\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tupdateAfterRemoveChild(originalMoveTaskParent);\r\n\t\tupdateParents(id);\r\n\t}));\r\n};","module.exports = function addPlaceholder(gantt){\r\n\tfunction isEnabled(){\r\n\t\treturn gantt.config.placeholder_task;\r\n\t}\r\n\r\n\tfunction callIfEnabled(callback){\r\n\t\treturn function(){\r\n\t\t\tif(!isEnabled()){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn callback.apply(this, arguments);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction silenceDataProcessor(dataProcessor){\r\n\t\tif(dataProcessor && !dataProcessor._silencedPlaceholder){\r\n\t\t\tdataProcessor._silencedPlaceholder = true;\r\n\t\t\tdataProcessor.attachEvent(\"onBeforeUpdate\", callIfEnabled(function(id, state, data){\r\n\t\t\t\tif(data.type == gantt.config.types.placeholder){\r\n\t\t\t\t\tdataProcessor.setUpdated(id, false);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}));\r\n\t\t}\r\n\t}\r\n\r\n\tfunction insertPlaceholder(){\r\n\t\tvar placeholders = gantt.getTaskBy(\"type\", gantt.config.types.placeholder);\r\n\t\tif(!placeholders.length || !gantt.isTaskExists(placeholders[0].id)){\r\n\t\t\tvar placeholder = {\r\n\t\t\t\tunscheduled: true,\r\n\t\t\t\ttype: gantt.config.types.placeholder,\r\n\t\t\t\tduration:0,\r\n\t\t\t\ttext: gantt.locale.labels.new_task\r\n\t\t\t};\r\n\t\t\tif(gantt.callEvent(\"onTaskCreated\", [placeholder]) === false){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tgantt.addTask(placeholder);\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\tfunction afterEdit(id){\r\n\t\tvar item = gantt.getTask(id);\r\n\t\tif(item.type == gantt.config.types.placeholder) {\r\n\t\t\tif(item.start_date && item.end_date && item.unscheduled){\r\n\t\t\t\titem.unscheduled = false;\r\n\t\t\t}\r\n\r\n\t\t\tgantt.batchUpdate(function(){\r\n\t\t\t\tvar newTask = gantt.copy(item);\r\n\t\t\t\tgantt.silent(function(){\r\n\t\t\t\t\tgantt.deleteTask(item.id);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tdelete newTask[\"!nativeeditor_status\"];\r\n\t\t\t\tnewTask.type = gantt.config.types.task;\r\n\t\t\t\tnewTask.id = gantt.uid();\r\n\t\t\t\tgantt.addTask(newTask);\r\n\r\n\t\t\t\t//insertPlaceholder();\r\n\t\t\t});\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tgantt.config.types.placeholder = \"placeholder\";\r\n\tgantt.attachEvent(\"onDataProcessorReady\", callIfEnabled(silenceDataProcessor));\r\n\r\n\tvar ready = false;\r\n\tgantt.attachEvent(\"onGanttReady\", function(){\r\n\t\tif(ready){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tready = true;\r\n\t\tgantt.attachEvent(\"onAfterTaskUpdate\", callIfEnabled(afterEdit));\r\n\t\tgantt.attachEvent(\"onAfterTaskAdd\", callIfEnabled(function(id, task){\r\n\t\t\tif(task.type != gantt.config.types.placeholder){\r\n\t\t\t\tvar placeholders = gantt.getTaskBy(\"type\", gantt.config.types.placeholder);\r\n\t\t\t\tplaceholders.forEach(function(p){\r\n\t\t\t\t\tgantt.silent(function(){\r\n\t\t\t\t\t\tif(gantt.isTaskExists(p.id))\r\n\t\t\t\t\t\t\tgantt.deleteTask(p.id);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\tinsertPlaceholder();\r\n\t\t\t}\r\n\t\t}));\r\n\t\tgantt.attachEvent(\"onParse\", callIfEnabled(insertPlaceholder));\r\n\t});\r\n\r\n\tfunction isPlaceholderTask(taskId){\r\n\t\tif(gantt.config.types.placeholder && gantt.isTaskExists(taskId)){\r\n\t\t\tvar task = gantt.getTask(taskId);\r\n\t\t\tif(task.type == gantt.config.types.placeholder){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\tfunction isPlaceholderLink(link){\r\n\t\tif(isPlaceholderTask(link.source) || isPlaceholderTask(link.target)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\tgantt.attachEvent(\"onLinkValidation\", function(link){\r\n\t\tif(isPlaceholderLink(link)){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t});\r\n\tgantt.attachEvent(\"onBeforeLinkAdd\", function(id,link){\r\n\t\tif(isPlaceholderLink(link)){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t});\r\n\r\n\tgantt.attachEvent(\"onBeforeUndoStack\", function(action){\r\n\t\tfor(var i = 0; i < action.commands.length; i++){\r\n\t\t\tvar command = action.commands[i];\r\n\t\t\tif(command.entity === \"task\" && command.value.type === gantt.config.types.placeholder){\r\n\t\t\t\taction.commands.splice(i,1);\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t});\r\n\r\n};","var helpers = require(\"../../utils/helpers\");\r\n\r\nfunction createResourceMethods(gantt){\r\n\r\n\tvar resourceTaskCache = {};\r\n\r\n\tgantt.$data.tasksStore.attachEvent(\"onStoreUpdated\", function(){\r\n\t\tresourceTaskCache = {};\r\n\t});\r\n\r\n\tfunction getTaskBy(propertyName, propertyValue) {\r\n\t\tif (typeof propertyName == \"function\") {\r\n\t\t\treturn filterResourceTasks(propertyName);\r\n\t\t} else {\r\n\t\t\tif (helpers.isArray(propertyValue)) {\r\n\t\t\t\treturn getResourceTasks(propertyName, propertyValue);\r\n\t\t\t} else {\r\n\t\t\t\treturn getResourceTasks(propertyName, [propertyValue]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction filterResourceTasks(filter) {\r\n\t\tvar res = [];\r\n\t\tgantt.eachTask(function (task) {\r\n\t\t\tif (filter(task)) {\r\n\t\t\t\tres.push(task);\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn res;\r\n\t}\r\n\r\n\tvar falsyValuePrefix = String(Math.random());\r\n\tfunction resourceHashFunction(value){\r\n\t\tif (value === null){\r\n\t\t\treturn falsyValuePrefix + String(value);\r\n\t\t}\r\n\t\treturn String(value);\r\n\t}\r\n\r\n\tfunction getResourceTasks(property, resourceIds) {\r\n\t\tvar res;\r\n\t\tvar cacheKey = resourceIds.join(\"_\") + \"_\" + property;\r\n\t\tvar resourceHash = {};\r\n\t\thelpers.forEach(resourceIds, function(resourceId) {\r\n\t\t\tresourceHash[resourceHashFunction(resourceId)] = true;\r\n\t\t});\r\n\r\n\t\tif (!resourceTaskCache[cacheKey]) {\r\n\t\t\tres = resourceTaskCache[cacheKey] = [];\r\n\t\t\tgantt.eachTask(function (task) {\r\n\t\t\t\tif (task.type == gantt.config.types.project) return;\r\n\t\t\t\tif (property in task) {\r\n\t\t\t\t\tvar resourceValue;\r\n\t\t\t\t\tif (!helpers.isArray(task[property])) {\r\n\t\t\t\t\t\tresourceValue = [task[property]];\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tresourceValue = task[property];\r\n\t\t\t\t\t}\r\n\t\t\t\t\thelpers.forEach(resourceValue, function(value) {\r\n\t\t\t\t\t\tif (resourceHash[resourceHashFunction(value)] || (value && resourceHash[resourceHashFunction(value.resource_id)])) {\r\n\t\t\t\t\t\t\tres.push(task);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tres = resourceTaskCache[cacheKey];\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\tfunction selectAssignments(resourceId, taskId, result){\r\n\t\tvar property = gantt.config.resource_property;\r\n\t\tvar owners = [];\r\n\t\tif (gantt.getDatastore(\"task\").exists(taskId)) {\r\n\t\t\tvar task = gantt.getTask(taskId);\r\n\t\t\towners = task[property] || [];\r\n\t\t}\r\n\r\n\t\tif (!Array.isArray(owners)) {\r\n\t\t\towners = [owners];\r\n\t\t}\r\n\t\tfor (var i = 0; i < owners.length; i++) {\r\n\t\t\tif (owners[i].resource_id == resourceId) {\r\n\t\t\t\tresult.push({task_id: task.id, resource_id:owners[i].resource_id, value:owners[i].value});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction getResourceAssignments(resourceId, taskId){\r\n\t\t// resource assignment as an independent module:\r\n\t\t// {taskId:, resourceId, value}\r\n\t\t// TODO: probably should add a separate datastore for these\r\n\t\tvar assignments = [];\r\n\t\tvar property = gantt.config.resource_property;\r\n\t\tif(taskId !== undefined){\r\n\t\t\tselectAssignments(resourceId, taskId, assignments);\r\n\t\t}else{\r\n\t\t\tvar tasks = gantt.getTaskBy(property, resourceId);\r\n\t\t\ttasks.forEach(function(task){\r\n\t\t\t\tselectAssignments(resourceId, task.id, assignments);\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn assignments;\r\n\t}\r\n\r\n\treturn {\r\n\t\tfilterTasks: getTaskBy,\r\n\t\tgetResourceAssignments: getResourceAssignments\r\n\t};\r\n}\r\n\r\nmodule.exports = function(gantt){\r\n\tvar methods = createResourceMethods(gantt);\r\n\r\n\tgantt.getTaskBy = methods.filterTasks;\r\n\tgantt.getResourceAssignments = methods.getResourceAssignments;\r\n\tgantt.config.resource_property = \"owner_id\";\r\n\tgantt.config.resource_store = \"resource\";\r\n\tgantt.config.resource_render_empty_cells = false;\r\n\r\n\t/**\r\n\t * these are placeholder functions that should be redefined by the user\r\n\t*/\r\n\tgantt.templates.histogram_cell_class = function(start_date, end_date, resource, tasks) {};\r\n\tgantt.templates.histogram_cell_label = function(start_date, end_date, resource, tasks) {\r\n\t\treturn tasks.length + \"/3\";\r\n\t};\r\n\tgantt.templates.histogram_cell_allocated = function(start_date, end_date, resource, tasks) {\r\n\t\treturn tasks.length / 3;\r\n\t};\r\n\tgantt.templates.histogram_cell_capacity = function(start_date, end_date, resource, tasks) {\r\n\t\treturn 0;\r\n\t};\r\n\r\n\r\n\r\n\tgantt.templates.resource_cell_class = function(start, end, resource, tasks) {\r\n\t\tvar css = \"\";\r\n\t\tif (tasks.length <= 1) {\r\n\t\t\tcss = \"gantt_resource_marker_ok\";\r\n\t\t} else {\r\n\t\t\tcss = \"gantt_resource_marker_overtime\";\r\n\t\t}\r\n\t\treturn css;\r\n\t};\r\n\r\n\tgantt.templates.resource_cell_value = function(start, end, resource, tasks) {\r\n\t\treturn tasks.length * 8;\r\n\t};\r\n};\r\n\r\n\r\n","var createWbs = (function(gantt){\r\n\treturn {\r\n\t_needRecalc: true,\r\n\treset: function(){\r\n\t\tthis._needRecalc = true;\r\n\t},\r\n\t_isRecalcNeeded: function(){\r\n\t\treturn (!this._isGroupSort() && this._needRecalc);\r\n\t},\r\n\t_isGroupSort: function() {\r\n\t\treturn !!(gantt.getState().group_mode);\r\n\t},\r\n\t_getWBSCode: function(task) {\r\n\t\tif(!task) return \"\";\r\n\r\n\t\tif(this._isRecalcNeeded()){\r\n\t\t\tthis._calcWBS();\r\n\t\t}\r\n\r\n\t\tif(task.$virtual) return \"\";\r\n\t\tif(this._isGroupSort()) return task.$wbs || \"\";\r\n\r\n\t\tif(!task.$wbs) {\r\n\t\t\tthis.reset();\r\n\t\t\tthis._calcWBS();\r\n\t\t}\r\n\t\treturn task.$wbs;\r\n\t},\r\n\t_setWBSCode: function(task, value) {\r\n\t\ttask.$wbs = value;\r\n\t},\r\n\tgetWBSCode: function(task) {\r\n\t\treturn this._getWBSCode(task);\r\n\t},\r\n\tgetByWBSCode: function(code){\r\n\t\tvar parts = code.split(\".\");\r\n\t\tvar currentNode = gantt.config.root_id;\r\n\t\tfor(var i = 0; i < parts.length; i++){\r\n\t\t\tvar children = gantt.getChildren(currentNode);\r\n\t\t\tvar index = parts[i]*1 - 1;\r\n\t\t\tif(gantt.isTaskExists(children[index])){\r\n\t\t\t\tcurrentNode = children[index];\r\n\t\t\t}else{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(gantt.isTaskExists(currentNode)){\r\n\t\t\treturn gantt.getTask(currentNode);\r\n\t\t}else{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t},\r\n\t_calcWBS: function() {\r\n\t\tif(!this._isRecalcNeeded()) return;\r\n\r\n\t\tvar _isFirst = true;\r\n\t\tgantt.eachTask(function(ch) {\r\n\t\t\tif(_isFirst) {\r\n\t\t\t\t_isFirst = false;\r\n\t\t\t\tthis._setWBSCode(ch, \"1\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tvar _prevSibling = gantt.getPrevSibling(ch.id);\r\n\t\t\tif (_prevSibling !== null) {\r\n\t\t\t\tvar _wbs = gantt.getTask(_prevSibling).$wbs;\r\n\t\t\t\tif(_wbs) {\r\n\t\t\t\t\t_wbs = _wbs.split(\".\");\r\n\t\t\t\t\t_wbs[_wbs.length-1]++;\r\n\t\t\t\t\tthis._setWBSCode(ch, _wbs.join(\".\"));\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tvar _parent = gantt.getParent(ch.id);\r\n\t\t\t\tthis._setWBSCode(ch, gantt.getTask(_parent).$wbs + \".1\");\r\n\t\t\t}\r\n\t\t}, gantt.config.root_id, this);\r\n\r\n\t\tthis._needRecalc = false;\r\n\t}\r\n};\r\n});\r\n\r\nmodule.exports = function(gantt){\r\n\tvar wbs = createWbs(gantt);\r\n\tgantt.getWBSCode = function getWBSCode(task) {\r\n\t\treturn wbs.getWBSCode(task);\r\n\t};\r\n\r\n\tgantt.getTaskByWBSCode = function(code) {\r\n\t\treturn wbs.getByWBSCode(code);\r\n\t};\r\n\r\n\tfunction resetCache(){\r\n\t\twbs.reset();\r\n\t\treturn true;\r\n\t}\r\n\r\n\tgantt.attachEvent(\"onAfterTaskMove\", resetCache);\r\n\tgantt.attachEvent(\"onBeforeParse\", resetCache);\r\n\tgantt.attachEvent(\"onAfterTaskDelete\", resetCache);\r\n\tgantt.attachEvent(\"onAfterTaskAdd\", resetCache);\r\n\tgantt.attachEvent(\"onAfterSort\", resetCache);\r\n\r\n};\r\n","var global = require(\"../../utils/global\");\r\n\r\nfunction createMethod(gantt){\r\n\tvar methods = {};\r\n\tvar isActive = false;\r\n\tfunction disableMethod(methodName, dummyMethod){\r\n\t\tdummyMethod = typeof dummyMethod == \"function\" ? dummyMethod : function(){};\r\n\r\n\t\tif(!methods[methodName]){\r\n\t\t\tmethods[methodName] = this[methodName];\r\n\t\t\tthis[methodName] = dummyMethod;\r\n\t\t}\r\n\t}\r\n\tfunction restoreMethod(methodName){\r\n\t\tif(methods[methodName]){\r\n\t\t\tthis[methodName] = methods[methodName];\r\n\t\t\tmethods[methodName] = null;\r\n\t\t}\r\n\t}\r\n\tfunction disableMethods(methodsHash){\r\n\t\tfor(var i in methodsHash){\r\n\t\t\tdisableMethod.call(this, i, methodsHash[i]);\r\n\t\t}\r\n\t}\r\n\tfunction restoreMethods(){\r\n\t\tfor(var i in methods){\r\n\t\t\trestoreMethod.call(this, i);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction batchUpdatePayload(callback){\r\n\t\ttry{\r\n\t\t\tcallback();\r\n\t\t}catch(e){\r\n\t\t\tglobal.console.error(e);\r\n\t\t}\r\n\t}\r\n\r\n\tvar state = gantt.$services.getService(\"state\");\r\n\tstate.registerProvider(\"batchUpdate\", function(){\r\n\t\treturn {\r\n\t\t\tbatch_update: isActive\r\n\t\t};\r\n\t}, false);\r\n\r\n\treturn function batchUpdate(callback, noRedraw) {\r\n\t\tif(isActive){\r\n\t\t\t// batch mode is already active\r\n\t\t\tbatchUpdatePayload(callback);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar call_dp = (this._dp && this._dp.updateMode != \"off\");\r\n\t\tvar dp_mode;\r\n\t\tif (call_dp){\r\n\t\t\tdp_mode = this._dp.updateMode;\r\n\t\t\tthis._dp.setUpdateMode(\"off\");\r\n\t\t}\r\n\r\n\t\t// temporary disable some methods while updating multiple tasks\r\n\t\tvar resetProjects = {};\r\n\t\tvar methods = {\r\n\t\t\t\"render\":true,\r\n\t\t\t\"refreshData\":true,\r\n\t\t\t\"refreshTask\":true,\r\n\t\t\t\"refreshLink\":true,\r\n\t\t\t\"resetProjectDates\":function(task){\r\n\t\t\t\tresetProjects[task.id] = task;\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tdisableMethods.call(this, methods);\r\n\r\n\t\tisActive = true;\r\n\t\tthis.callEvent(\"onBeforeBatchUpdate\", []);\r\n\r\n\t\tbatchUpdatePayload(callback);\r\n\r\n\t\tthis.callEvent(\"onAfterBatchUpdate\", []);\r\n\r\n\t\trestoreMethods.call(this);\r\n\r\n\t\t// do required updates after changes applied\r\n\t\tfor(var i in resetProjects){\r\n\t\t\tthis.resetProjectDates(resetProjects[i]);\r\n\t\t}\r\n\r\n\t\tisActive = false;\r\n\r\n\t\tif(!noRedraw){\r\n\t\t\tthis.render();\r\n\t\t}\r\n\r\n\t\tif (call_dp) {\r\n\t\t\tthis._dp.setUpdateMode(dp_mode);\r\n\t\t\tthis._dp.setGanttMode(\"task\");\r\n\t\t\tthis._dp.sendData();\r\n\t\t\tthis._dp.setGanttMode(\"link\");\r\n\t\t\tthis._dp.sendData();\r\n\t\t}\r\n\t};\r\n\r\n\r\n\r\n}\r\n\r\nmodule.exports = function(gantt){\r\n\tgantt.batchUpdate = createMethod(gantt);\r\n};","module.exports = function(gantt){\r\n\tif(!gantt.ext){\r\n\t\tgantt.ext = {};\r\n\t}\r\n\r\n\tvar modules = [\r\n\t\trequire(\"./batch_update\"),\r\n\t\trequire(\"./wbs\"),\r\n\t\trequire(\"./resources\"),\r\n\t\trequire(\"./new_task_placeholder\"),\r\n\t\trequire(\"./auto_task_types\"),\r\n\t\trequire(\"./formatters\")\r\n\t];\r\n\r\n\tfor(var i = 0; i < modules.length; i++){\r\n\t\tif(modules[i])\r\n\t\t\tmodules[i](gantt);\r\n\t}\r\n};","import * as utils from \"../../utils/utils\";\r\n\r\nexport default class SimpleStorage {\r\n\tpublic static create = () : SimpleStorage => {\r\n\t\treturn new SimpleStorage();\r\n\t}\r\n\r\n\tprotected _storage: { [id: string]: any; };\r\n\r\n\tprotected constructor() {\r\n\t\tthis._storage = {};\r\n\t}\r\n\r\n\tpublic clear = (): void => {\r\n\t\tthis._storage = {};\r\n\t}\r\n\r\n\tpublic storeItem = (item: any): void => {\r\n\t\tthis._storage[item.id] = utils.copy(item);\r\n\t}\r\n\r\n\tpublic getStoredItem = (id: string): any => {\r\n\t\treturn this._storage[id] || null;\r\n\t}\r\n}","\r\nexport default function extendGantt(gantt: any, dp: any) {\r\n\tgantt.getUserData = function(id, name) {\r\n\t\tif (!this.userdata) {\r\n\t\t\tthis.userdata = {};\r\n\t\t}\r\n\t\tif (this.userdata[id] && this.userdata[id][name]) {\r\n\t\t\treturn this.userdata[id][name];\r\n\t\t}\r\n\t\treturn \"\";\r\n\t};\r\n\tgantt.setUserData = function(id, name, value) {\r\n\t\tif (!this.userdata) {\r\n\t\t\tthis.userdata = {};\r\n\t\t}\r\n\t\tif (!this.userdata[id]) {\r\n\t\t\tthis.userdata[id] = {};\r\n\t\t}\r\n\t\tthis.userdata[id][name] = value;\r\n\t};\r\n\r\n\tgantt._change_id = function(oldId, newId) {\r\n\t\tif (this._dp._ganttMode !== \"task\") {\r\n\t\t\tthis.changeLinkId(oldId, newId);\r\n\t\t} else {\r\n\t\t\tthis.changeTaskId(oldId, newId);\r\n\t\t}\r\n\t};\r\n\r\n\tgantt._row_style = function(rowId, classname){\r\n\t\tif (this._dp._ganttMode !== \"task\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!gantt.isTaskExists(rowId)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst task = gantt.getTask(rowId);\r\n\t\ttask.$dataprocessor_class = classname;\r\n\t\tgantt.refreshTask(rowId);\r\n\t};\r\n\r\n\t// fake method for dataprocessor\r\n\tgantt._delete_task = function(rowId, node) {}; // tslint:disable-line\r\n\r\n\tgantt._sendTaskOrder = function(id, item){\r\n\t\tif (item.$drop_target) {\r\n\t\t\tthis._dp.setGanttMode(\"task\");\r\n\t\t\tthis.getTask(id).target = item.$drop_target;\r\n\t\t\tthis._dp.setUpdated(id, true,\"order\");\r\n\t\t\tdelete this.getTask(id).$drop_target;\r\n\t\t}\r\n\t};\r\n\r\n\tgantt.setDp = function() {\r\n\t\tthis._dp = dp;\r\n\t};\r\n\r\n\tgantt.setDp();\r\n}","import * as helpers from \"../../utils/helpers\";\r\n\r\nexport default class DataProcessorEvents {\r\n\tprotected _dataProcessorHandlers: any[];\r\n\tprotected $gantt: any;\r\n\tprotected $dp: any;\r\n\r\n\tconstructor(gantt: any, dp: any) {\r\n\t\tthis.$gantt = gantt;\r\n\t\tthis.$dp = dp;\r\n\t\tthis._dataProcessorHandlers = [];\r\n\t}\r\n\r\n\tattach() {\r\n\t\tconst dp = this.$dp;\r\n\t\tconst gantt = this.$gantt;\r\n\t\tconst treeHelper = require(\"../../utils/task_tree_helpers\");\r\n\t\tconst cascadeDelete = {};\r\n\r\n\t\tfunction clientSideDelete(id) {\r\n\t\t\tconst updated = dp.updatedRows.slice();\r\n\t\t\tlet clientOnly = false;\r\n\r\n\t\t\tfor (let i = 0; i < updated.length && !dp._in_progress[id]; i++) {\r\n\t\t\t\tif (updated[i] === id) {\r\n\t\t\t\t\tif (gantt.getUserData(id, \"!nativeeditor_status\") === \"inserted\") {\r\n\t\t\t\t\t\tclientOnly = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdp.setUpdated(id,false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn clientOnly;\r\n\t\t}\r\n\r\n\t\tfunction getTaskLinks(task) {\r\n\t\t\tlet _links = [];\r\n\r\n\t\t\tif (task.$source) {\r\n\t\t\t\t_links = _links.concat(task.$source);\r\n\t\t\t}\r\n\t\t\tif (task.$target) {\r\n\t\t\t\t_links = _links.concat(task.$target);\r\n\t\t\t}\r\n\r\n\t\t\treturn _links;\r\n\t\t}\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterTaskAdd\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isTaskExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdated(id, true, \"inserted\");\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterTaskUpdate\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isTaskExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdated(id, true);\r\n\r\n\t\t\t\t// gantt can be destroyed/reinitialized after dp.setUpdated\r\n\t\t\t\tif(gantt._sendTaskOrder){\r\n\t\t\t\t\tgantt._sendTaskOrder(id, item);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onBeforeTaskDelete\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (!gantt.config.cascade_delete) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\tcascadeDelete[id] = {\r\n\t\t\t\ttasks: treeHelper.getSubtreeTasks(gantt, id),\r\n\t\t\t\tlinks: treeHelper.getSubtreeLinks(gantt, id)\r\n\t\t\t};\r\n\t\t\treturn true;\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterTaskDelete\", function(id, item) { // tslint:disable-line\r\n\t\t\tdp.setGanttMode(\"tasks\");\r\n\r\n\t\t\t// not send delete request if item is not inserted into the db - just remove it from the client\r\n\t\t\tconst needDbDelete = !clientSideDelete(id);\r\n\t\t\tif (!needDbDelete) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (gantt.config.cascade_delete && cascadeDelete[id]) {\r\n\t\t\t\tconst dpMode = dp.updateMode;\r\n\t\t\t\tdp.setUpdateMode(\"off\");\r\n\r\n\t\t\t\tconst cascade = cascadeDelete[id];\r\n\t\t\t\tfor (const i in cascade.tasks) {\r\n\t\t\t\t\tif (!clientSideDelete(i)) {\r\n\t\t\t\t\t\tdp.storeItem(cascade.tasks[i]);\r\n\t\t\t\t\t\tdp.setUpdated(i, true, \"deleted\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tdp.setGanttMode(\"links\");\r\n\t\t\t\tfor (const i in cascade.links) {\r\n\t\t\t\t\tif (!clientSideDelete(i)) {\r\n\t\t\t\t\t\tdp.storeItem(cascade.links[i]);\r\n\t\t\t\t\t\tdp.setUpdated(i, true, \"deleted\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcascadeDelete[id] = null;\r\n\r\n\t\t\t\tif (dpMode !== \"off\") {\r\n\t\t\t\t\tdp.sendAllData();\r\n\t\t\t\t}\r\n\t\t\t\tdp.setGanttMode(\"tasks\");\r\n\t\t\t\tdp.setUpdateMode(dpMode);\r\n\t\t\t}\r\n\r\n\t\t\tdp.storeItem(item);\r\n\t\t\tdp.setUpdated(id, true, \"deleted\");\r\n\r\n\t\t\tif (dp.updateMode !== \"off\" && !dp._tSend) {\r\n\t\t\t\tdp.sendAllData();\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterLinkUpdate\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isLinkExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"links\");\r\n\t\t\t\tdp.setUpdated(id, true);\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterLinkAdd\", function(id, item) { // tslint:disable-line\r\n\t\t\tif (gantt.isLinkExists(id)) {\r\n\t\t\t\tdp.setGanttMode(\"links\");\r\n\t\t\t\tdp.setUpdated(id, true,\"inserted\");\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onAfterLinkDelete\", function(id, item) { // tslint:disable-line\r\n\t\t\tdp.setGanttMode(\"links\");\r\n\r\n\t\t\tconst needDbDelete = !clientSideDelete(id);\r\n\t\t\tif (!needDbDelete) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdp.storeItem(item);\r\n\t\t\tdp.setUpdated(id, true,\"deleted\");\r\n\t\t}));\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onRowDragEnd\", function(id, target) { // tslint:disable-line\r\n\t\t\tgantt._sendTaskOrder(id, gantt.getTask(id));\r\n\t\t}));\r\n\r\n\t\tlet tasks = null;\r\n\t\tlet links = null;\r\n\r\n\t\tthis._dataProcessorHandlers.push(gantt.attachEvent(\"onTaskIdChange\", function(oldId, newId) { // tslint:disable-line\r\n\t\t\tif (!dp._waitMode) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst children = gantt.getChildren(newId);\r\n\t\t\tif (children.length) {\r\n\t\t\t\ttasks = tasks || {};\r\n\r\n\t\t\t\tfor (let i = 0; i < children.length; i++) {\r\n\t\t\t\t\tconst ch = this.getTask(children[i]);\r\n\t\t\t\t\ttasks[ch.id] = ch;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst item = this.getTask(newId);\r\n\t\t\tconst itemLinks = getTaskLinks(item);\r\n\r\n\t\t\tif (itemLinks.length) {\r\n\t\t\t\tlinks = links || {};\r\n\r\n\t\t\t\tfor (let i = 0; i < itemLinks.length; i++) {\r\n\t\t\t\t\tconst link = this.getLink(itemLinks[i]);\r\n\t\t\t\t\tlinks[link.id] = link;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}));\r\n\r\n\t\tdp.attachEvent(\"onAfterUpdateFinish\", function() {\r\n\t\t\tif (tasks || links) {\r\n\t\t\t\tgantt.batchUpdate(function() {\r\n\t\t\t\t\tfor (const id in tasks) {\r\n\t\t\t\t\t\tgantt.updateTask(tasks[id].id);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor (const id in links) {\r\n\t\t\t\t\t\tgantt.updateLink(links[id].id);\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttasks = null;\r\n\t\t\t\t\tlinks = null;\r\n\t\t\t\t});\r\n\t\t\t\tif (tasks) {\r\n\t\t\t\t\tgantt._dp.setGanttMode(\"tasks\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tgantt._dp.setGanttMode(\"links\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tdp.attachEvent(\"onBeforeDataSending\", function() {\r\n\t\t\tif (this._tMode === \"CUSTOM\") {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tlet url = this._serverProcessor;\r\n\t\t\tif (this._tMode === \"REST-JSON\" || this._tMode === \"REST\") {\r\n\t\t\t\tconst mode = this._ganttMode;\r\n\r\n\t\t\t\turl = url.substring(0, url.indexOf(\"?\") > -1 ? url.indexOf(\"?\") : url.length);\r\n\t\t\t\t// editing=true&\r\n\t\t\t\tthis.serverProcessor = url + (url.slice(-1) === \"/\" ? \"\" : \"/\") + mode;\r\n\t\t\t} else {\r\n\t\t\t\tconst pluralizedMode = this._ganttMode + \"s\";\r\n\t\t\t\tthis.serverProcessor = url + gantt.ajax.urlSeparator(url) + \"gantt_mode=\" + pluralizedMode;\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tdp.attachEvent(\"insertCallback\", function insertCallback(upd, id, parent, mode) { // tslint:disable-line\r\n\t\t\tconst data = upd.data || gantt.xml._xmlNodeToJSON(upd.firstChild);\r\n\t\t\tconst methods = {\r\n\t\t\t\tadd: gantt.addTask,\r\n\t\t\t\tisExist: gantt.isTaskExists\r\n\t\t\t};\r\n\t\t\tif (mode === \"links\") {\r\n\t\t\t\tmethods.add = gantt.addLink;\r\n\t\t\t\tmethods.isExist = gantt.isLinkExists;\r\n\t\t\t}\r\n\t\t\tif (methods.isExist.call(gantt, id)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tdata.id = id;\r\n\t\t\tmethods.add.call(gantt, data);\r\n\t\t});\r\n\r\n\t\tdp.attachEvent(\"updateCallback\", function updateCallback(upd, id) {\r\n\t\t\tconst data = upd.data || gantt.xml._xmlNodeToJSON(upd.firstChild);\r\n\t\t\tif (!gantt.isTaskExists(id)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst objData = gantt.getTask(id);\r\n\t\t\tfor (const key in data) {\r\n\t\t\t\tlet property = data[key];\r\n\t\t\t\tswitch (key) {\r\n\t\t\t\t\tcase \"id\":\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\tcase \"start_date\":\r\n\t\t\t\t\tcase \"end_date\":\r\n\t\t\t\t\t\tproperty = gantt.defined(gantt.templates.xml_date) ? gantt.templates.xml_date(property) : gantt.templates.parse_date(property);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"duration\":\r\n\t\t\t\t\t\tobjData.end_date = gantt.calculateEndDate({start_date: objData.start_date, duration: property, task:objData});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tobjData[key] = property;\r\n\t\t\t}\r\n\t\t\tgantt.updateTask(id);\r\n\t\t\tgantt.refreshData();\r\n\t\t});\r\n\t\tdp.attachEvent(\"deleteCallback\", function deleteCallback(upd, id, parent, mode) { // tslint:disable-line\r\n\t\t\tconst methods = {\r\n\t\t\t\tdelete: gantt.deleteTask,\r\n\t\t\t\tisExist: gantt.isTaskExists\r\n\t\t\t};\r\n\t\t\tif (mode === \"links\") {\r\n\t\t\t\tmethods.delete = gantt.deleteLink;\r\n\t\t\t\tmethods.isExist = gantt.isLinkExists;\r\n\t\t\t}\r\n\t\t\tif (methods.isExist.call(gantt, id)) {\r\n\t\t\t\tmethods.delete.call(gantt, id);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tdetach() {\r\n\t\thelpers.forEach(this._dataProcessorHandlers, (e) => {\r\n\t\t\tthis.$gantt.detachEvent(e);\r\n\t\t});\r\n\t\tthis._dataProcessorHandlers = [];\r\n\t}\r\n}\r\n","import * as eventable from \"../../utils/eventable\";\r\nimport * as helpers from \"../../utils/helpers\";\r\nimport * as utils from \"../../utils/utils\";\r\nimport DataProcessorEvents from \"./data_processor_events\";\r\nimport extendGantt from \"./extend_gantt\";\r\nimport SimpleStorage from \"./simple_storage\";\r\n\r\nexport interface DataProcessor { // tslint:disable-line\r\n\t$gantt: any;\r\n\tdetachAllEvents: any;\r\n\tattachEvent: any;\r\n\tcallEvent: any;\r\n\r\n\tserverProcessor: string;\r\n\taction_param: string;\r\n\tobject: any;\r\n\tupdatedRows: any[];\r\n\tautoUpdate: boolean;\r\n\tupdateMode: string;\r\n\tmessages: any[];\r\n\tstyles: object;\r\n\tdnd: any;\r\n}\r\n\r\nexport function createDataProcessor(config: any) {\r\n\tlet router;\r\n\tlet tMode;\r\n\tif (config instanceof Function) {\r\n\t\trouter = config;\r\n\t} else if (config.hasOwnProperty(\"router\")) {\r\n\t\trouter = config.router;\r\n\t} else if (config.hasOwnProperty(\"link\") && config.hasOwnProperty(\"task\")) {\r\n\t\trouter = config;\r\n\t}\r\n\tif (router) {\r\n\t\ttMode = \"CUSTOM\";\r\n\t} else {\r\n\t\ttMode = config.mode || \"REST-JSON\";\r\n\t}\r\n\tconst gantt = this; // tslint:disable-line\r\n\tconst dp = new DataProcessor(config.url);\r\n\tdp.init(gantt);\r\n\tdp.setTransactionMode({\r\n\t\tmode: tMode,\r\n\t\trouter\r\n\t}, config.batchUpdate);\r\n\treturn dp;\r\n}\r\n\r\nexport class DataProcessor {\r\n\tpublic modes: object;\r\n\tpublic serverProcessor: string;\r\n\tpublic action_param: string; // tslint:disable-line\r\n\tpublic object: any;\r\n\tpublic updatedRows: any[];\r\n\tpublic autoUpdate: boolean;\r\n\tpublic updateMode: string;\r\n\tpublic messages: any[];\r\n\tpublic styles: object;\r\n\tpublic dnd: any;\r\n\r\n\tprotected _tMode: string;\r\n\tprotected _headers: any;\r\n\tprotected _payload: any;\r\n\tprotected _postDelim: string;\r\n\tprotected _waitMode: number;\r\n\tprotected _in_progress: object; // tslint:disable-line\r\n\tprotected _invalid: object;\r\n\tprotected _storage: SimpleStorage;\r\n\tprotected _tSend: boolean;\r\n\tprotected _endnm: boolean;\r\n\tprotected _serializeAsJson: boolean;\r\n\tprotected _router: any;\r\n\tprotected _utf: boolean;\r\n\tprotected obj: any;\r\n\tprotected _columns: any;\r\n\tprotected _changed: boolean;\r\n\tprotected _methods: any[];\r\n\tprotected _user: any;\r\n\tprotected _uActions: object;\r\n\tprotected _needUpdate: boolean;\r\n\tprotected _ganttMode: string;\r\n\r\n\tprotected _silent_mode: any; // tslint:disable-line\r\n\tprotected _updateBusy: any;\r\n\tprotected _serverProcessor: any;\r\n\tprotected _initialized: boolean;\r\n\r\n\tconstructor(serverProcessorURL?) {\r\n\t\tthis.serverProcessor = serverProcessorURL;\r\n\t\tthis.action_param = \"!nativeeditor_status\";\r\n\r\n\t\tthis.object = null;\r\n\t\tthis.updatedRows = []; // ids of updated rows\r\n\r\n\t\tthis.autoUpdate = true;\r\n\t\tthis.updateMode = \"cell\";\r\n\t\tthis._headers = null;\r\n\t\tthis._payload = null;\r\n\t\tthis._postDelim = \"_\";\r\n\r\n\t\tthis._waitMode = 0;\r\n\t\tthis._in_progress = {}; // ?\r\n\t\tthis._storage = SimpleStorage.create();\r\n\t\tthis._invalid = {};\r\n\t\tthis.messages = [];\r\n\r\n\t\tthis.styles = {\r\n\t\t\tupdated: \"font-weight:bold;\",\r\n\t\t\tinserted: \"font-weight:bold;\",\r\n\t\t\tdeleted: \"text-decoration : line-through;\",\r\n\t\t\tinvalid: \"background-color:FFE0E0;\",\r\n\t\t\tinvalid_cell: \"border-bottom:2px solid red;\",\r\n\t\t\terror: \"color:red;\",\r\n\t\t\tclear: \"font-weight:normal;text-decoration:none;\"\r\n\t\t};\r\n\t\tthis.enableUTFencoding(true);\r\n\t\teventable(this);\r\n\t}\r\n\r\n\tsetTransactionMode(mode:any, total?:any) {\r\n\t\tif (typeof mode === \"object\") {\r\n\t\t\tthis._tMode = mode.mode || this._tMode;\r\n\r\n\t\t\tif (utils.defined(mode.headers)) {\r\n\t\t\t\tthis._headers = mode.headers;\r\n\t\t\t}\r\n\r\n\t\t\tif (utils.defined(mode.payload)) {\r\n\t\t\t\tthis._payload = mode.payload;\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\t\t\tthis._tMode = mode;\r\n\t\t\tthis._tSend = total;\r\n\t\t}\r\n\r\n\t\tif (this._tMode === \"REST\") {\r\n\t\t\tthis._tSend = false;\r\n\t\t\tthis._endnm = true;\r\n\t\t}\r\n\r\n\t\tif (this._tMode === \"JSON\" || this._tMode === \"REST-JSON\") {\r\n\t\t\tthis._tSend = false;\r\n\t\t\tthis._endnm = true;\r\n\t\t\tthis._serializeAsJson = true;\r\n\t\t\tthis._headers = this._headers || {};\r\n\t\t\tthis._headers[\"Content-type\"] = \"application/json\";\r\n\t\t}\r\n\r\n\t\tif (this._tMode === \"CUSTOM\") {\r\n\t\t\tthis._tSend = false;\r\n\t\t\tthis._endnm = true;\r\n\t\t\tthis._router = mode.router;\r\n\t\t}\r\n\t}\r\n\r\n\tescape(data:any) {\r\n\t\tif (this._utf) {\r\n\t\t\treturn encodeURIComponent(data);\r\n\t\t} else {\r\n\t\t\treturn escape(data);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: allows to set escaping mode\r\n\t * @param: true - utf based escaping, simple - use current page encoding\r\n\t * @type: public\r\n\t */\r\n\tenableUTFencoding(mode:boolean) {\r\n\t\tthis._utf = !!mode;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: allows to define, which column may trigger update\r\n\t * @param: val - array or list of true/false values\r\n\t * @type: public\r\n\t */\r\n\tsetDataColumns(val:string|any) {\r\n\t\tthis._columns = (typeof val === \"string\") ? val.split(\",\") : val;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: get state of updating\r\n\t * @returns: true - all in sync with server, false - some items not updated yet.\r\n\t * @type: public\r\n\t */\r\n\tgetSyncState() {\r\n\t\treturn !this.updatedRows.length;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: enable/disable named field for data syncing, will use column ids for grid\r\n\t * @param: mode - true/false\r\n\t * @type: public\r\n\t */\r\n\tenableDataNames(mode: boolean) {\r\n\t\tthis._endnm = !!mode;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: enable/disable mode , when only changed fields and row id send to the server side, instead of all fields in default mode\r\n\t * @param: mode - true/false\r\n\t * @type: public\r\n\t */\r\n\tenablePartialDataSend(mode: boolean) {\r\n\t\tthis._changed = !!mode;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: set if rows should be send to server automatically\r\n\t * @param: mode - \"row\" - based on row selection changed, \"cell\" - based on cell editing finished, \"off\" - manual data sending\r\n\t * @type: public\r\n\t */\r\n\tsetUpdateMode(mode: string, dnd: any) {\r\n\t\tthis.autoUpdate = (mode === \"cell\");\r\n\t\tthis.updateMode = mode;\r\n\t\tthis.dnd = dnd;\r\n\t}\r\n\r\n\tignore(code: any, master: any) {\r\n\t\tthis._silent_mode = true;\r\n\t\tcode.call(master || window);\r\n\t\tthis._silent_mode = false;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: mark row as updated/normal. check mandatory fields, initiate autoupdate (if turned on)\r\n\t * @param: rowId - id of row to set update-status for\r\n\t * @param: state - true for \"updated\", false for \"not updated\"\r\n\t * @param: mode - update mode name\r\n\t * @type: public\r\n\t */\r\n\tsetUpdated(rowId:number|string, state: boolean, mode?: string) {\r\n\t\tif (this._silent_mode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst ind = this.findRow(rowId);\r\n\r\n\t\tmode = mode || \"updated\";\r\n\t\tconst existing = this.$gantt.getUserData(rowId, this.action_param);\r\n\t\tif (existing && mode === \"updated\") {\r\n\t\t\tmode = existing;\r\n\t\t}\r\n\t\tif (state) {\r\n\t\t\tthis.set_invalid(rowId, false); // clear previous error flag\r\n\t\t\tthis.updatedRows[ind] = rowId;\r\n\t\t\tthis.$gantt.setUserData(rowId, this.action_param, mode);\r\n\t\t\tif (this._in_progress[rowId]) {\r\n\t\t\t\tthis._in_progress[rowId] = \"wait\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (!this.is_invalid(rowId)) {\r\n\t\t\t\tthis.updatedRows.splice(ind, 1);\r\n\t\t\t\tthis.$gantt.setUserData(rowId, this.action_param, \"\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.markRow(rowId, state, mode);\r\n\t\tif (state && this.autoUpdate) {\r\n\t\t\tthis.sendData(rowId);\r\n\t\t}\r\n\t}\r\n\r\n\tmarkRow(id: number | string, state: boolean, mode: string) {\r\n\t\tlet str = \"\";\r\n\t\tconst invalid = this.is_invalid(id);\r\n\t\tif (invalid) {\r\n\t\t\tstr = this.styles[invalid];\r\n\t\t\tstate = true;\r\n\t\t}\r\n\t\tif (this.callEvent(\"onRowMark\", [id, state, mode, invalid])) {\r\n\t\t\t// default logic\r\n\t\t\tstr = this.styles[state ? mode : \"clear\"] + str;\r\n\r\n\t\t\tthis.$gantt[this._methods[0]](id, str);\r\n\r\n\t\t\tif (invalid && invalid.details) {\r\n\t\t\t\tstr += this.styles[invalid + \"_cell\"];\r\n\t\t\t\tfor (let i = 0; i < invalid.details.length; i++) {\r\n\t\t\t\t\tif (invalid.details[i]) {\r\n\t\t\t\t\t\tthis.$gantt[this._methods[1]](id, i, str);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tgetActionByState(state: string):string {\r\n\t\tif (state === \"inserted\") {\r\n\t\t\treturn \"create\";\r\n\t\t}\r\n\r\n\t\tif (state === \"updated\") {\r\n\t\t\treturn \"update\";\r\n\t\t}\r\n\r\n\t\tif (state === \"deleted\") {\r\n\t\t\treturn \"delete\";\r\n\t\t}\r\n\r\n\t\t// reorder\r\n\t\treturn \"update\";\r\n\t}\r\n\r\n\tgetState(id: number | string) {\r\n\t\treturn this.$gantt.getUserData(id, this.action_param);\r\n\t}\r\n\r\n\tis_invalid(id: number | string) {\r\n\t\treturn this._invalid[id];\r\n\t}\r\n\r\n\tset_invalid(id: number | string, mode: any, details?) {\r\n\t\tif (details) {\r\n\t\t\tmode = {\r\n\t\t\t\tvalue: mode,\r\n\t\t\t\tdetails,\r\n\t\t\t\ttoString: function() { // tslint:disable-line\r\n\t\t\t\t\treturn this.value.toString();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t\tthis._invalid[id] = mode;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: check mandatory fields and verify values of cells, initiate update (if specified). Can be redefined in order to provide custom validation\r\n\t * @param: rowId - id of row to set update-status for\r\n\t * @type: public\r\n\t */\r\n\t// tslint:disable-next-line\r\n\tcheckBeforeUpdate(rowId: number | string) { \r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: send row(s) values to server\r\n\t * @param: rowId - id of row which data to send. If not specified, then all \"updated\" rows will be send\r\n\t * @type: public\r\n\t */\r\n\tsendData(rowId?: any) {\r\n\t\tif (this.$gantt.editStop) {\r\n\t\t\tthis.$gantt.editStop();\r\n\t\t}\r\n\r\n\r\n\t\tif (typeof rowId === \"undefined\" || this._tSend) {\r\n\t\t\treturn this.sendAllData();\r\n\t\t}\r\n\t\tif (this._in_progress[rowId]) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tthis.messages = [];\r\n\t\tif (!this.checkBeforeUpdate(rowId) && this.callEvent(\"onValidationError\", [rowId, this.messages])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis._beforeSendData(this._getRowData(rowId), rowId);\r\n\t}\r\n\r\n\tserialize(data: any, id: any) {\r\n\t\tif (this._serializeAsJson) {\r\n\t\t\treturn this._serializeAsJSON(data);\r\n\t\t}\r\n\r\n\t\tif (typeof data === \"string\") {\r\n\t\t\treturn data;\r\n\t\t}\r\n\t\tif (typeof id !== \"undefined\") {\r\n\t\t\treturn this.serialize_one(data, \"\");\r\n\t\t} else {\r\n\t\t\tconst stack = [];\r\n\t\t\tconst keys = [];\r\n\t\t\tfor (const key in data) {\r\n\t\t\t\tif (data.hasOwnProperty(key)) {\r\n\t\t\t\t\tstack.push(this.serialize_one(data[key], key + this._postDelim));\r\n\t\t\t\t\tkeys.push(key);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tstack.push(\"ids=\" + this.escape(keys.join(\",\")));\r\n\t\t\tif (this.$gantt.security_key) {\r\n\t\t\t\tstack.push(\"dhx_security=\" + this.$gantt.security_key);\r\n\t\t\t}\r\n\t\t\treturn stack.join(\"&\");\r\n\t\t}\r\n\t}\r\n\r\n\tserialize_one(data: any, pref: string) {\r\n\t\tif (typeof data === \"string\") {\r\n\t\t\treturn data;\r\n\t\t}\r\n\t\tconst stack = [];\r\n\t\tlet serialized = \"\";\r\n\t\tfor (const key in data)\r\n\t\t\tif (data.hasOwnProperty(key)) {\r\n\t\t\t\tif ((key === \"id\" ||\r\n\t\t\t\t\tkey == this.action_param) && // tslint:disable-line\r\n\t\t\t\t\tthis._tMode === \"REST\") {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof data[key] === \"string\" || typeof data[key] === \"number\") {\r\n\t\t\t\t\tserialized = data[key];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tserialized = JSON.stringify(data[key]);\r\n\t\t\t\t}\r\n\t\t\t\tstack.push(this.escape((pref || \"\") + key) + \"=\" + this.escape(serialized));\r\n\t\t\t}\r\n\t\treturn stack.join(\"&\");\r\n\t}\r\n\r\n\tsendAllData() {\r\n\t\tif (!this.updatedRows.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.messages = [];\r\n\t\tlet valid: any = true;\r\n\r\n\t\tthis._forEachUpdatedRow(function(rowId) {\r\n\t\t\tvalid = valid && this.checkBeforeUpdate(rowId);\r\n\t\t});\r\n\r\n\t\tif (!valid && !this.callEvent(\"onValidationError\", [\"\", this.messages])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (this._tSend) {\r\n\t\t\tthis._sendData(this._getAllData());\r\n\t\t} else {\r\n\t\t\t// this.updatedRows can be spliced from onBeforeUpdate via dp.setUpdated false\r\n\t\t\t// use an iterator instead of for(var i = 0; i < this.updatedRows; i++) then\r\n\t\t\tthis._forEachUpdatedRow(function(rowId) {\r\n\t\t\t\tif (!this._in_progress[rowId]) {\r\n\t\t\t\t\tif (this.is_invalid(rowId)) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis._beforeSendData(this._getRowData(rowId), rowId);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfindRow(pattern: any) {\r\n\t\tlet i = 0;\r\n\t\tfor (i = 0; i < this.updatedRows.length; i++) {\r\n\t\t\tif (pattern == this.updatedRows[i]) { // tslint:disable-line\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn i;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: define custom actions\r\n\t * @param: name - name of action, same as value of action attribute\r\n\t * @param: handler - custom function, which receives a XMl response content for action\r\n\t * @type: private\r\n\t */\r\n\tdefineAction(name: string, handler: any) {\r\n\t\tif (!this._uActions) {\r\n\t\t\tthis._uActions = {};\r\n\t\t}\r\n\t\tthis._uActions[name] = handler;\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: used in combination with setOnBeforeUpdateHandler to create custom client-server transport system\r\n\t * @param: sid - id of item before update\r\n\t * @param: tid - id of item after up0ate\r\n\t * @param: action - action name\r\n\t * @type: public\r\n\t * @topic: 0\r\n\t */\r\n\tafterUpdateCallback(sid: number | string, tid: number | string, action: string, btag: any, ganttMode: string) {\r\n\t\tif(!this.$gantt){\r\n\t\t\t// destructor has been called before the callback\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.setGanttMode(ganttMode);\r\n\r\n\t\tconst marker = sid;\r\n\t\tconst correct = (action !== \"error\" && action !== \"invalid\");\r\n\t\tif (!correct) {\r\n\t\t\tthis.set_invalid(sid, action);\r\n\t\t}\r\n\t\tif ((this._uActions) && (this._uActions[action]) && (!this._uActions[action](btag))) {\r\n\t\t\treturn (delete this._in_progress[marker]);\r\n\t\t}\r\n\r\n\t\tif (this._in_progress[marker] !== \"wait\") {\r\n\t\t\tthis.setUpdated(sid, false);\r\n\t\t}\r\n\r\n\t\tconst originalSid = sid;\r\n\r\n\t\tswitch (action) {\r\n\t\t\tcase \"inserted\":\r\n\t\t\tcase \"insert\":\r\n\t\t\t\tif (tid != sid) { // tslint:disable-line\r\n\t\t\t\t\tthis.setUpdated(sid, false);\r\n\t\t\t\t\tthis.$gantt[this._methods[2]](sid, tid);\r\n\t\t\t\t\tsid = tid;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"delete\":\r\n\t\t\tcase \"deleted\":\r\n\t\t\t\tthis.$gantt.setUserData(sid, this.action_param, \"true_deleted\");\r\n\t\t\t\tthis.$gantt[this._methods[3]](sid);\r\n\t\t\t\tdelete this._in_progress[marker];\r\n\t\t\t\treturn this.callEvent(\"onAfterUpdate\", [sid, action, tid, btag]);\r\n\t\t}\r\n\r\n\t\tif (this._in_progress[marker] !== \"wait\") {\r\n\t\t\tif (correct) {\r\n\t\t\t\tthis.$gantt.setUserData(sid, this.action_param, \"\");\r\n\t\t\t}\r\n\t\t\tdelete this._in_progress[marker];\r\n\t\t} else {\r\n\t\t\tdelete this._in_progress[marker];\r\n\t\t\tthis.setUpdated(tid, true, this.$gantt.getUserData(sid, this.action_param));\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onAfterUpdate\", [originalSid, action, tid, btag]);\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: response from server\r\n\t * @param: xml - XMLLoader object with response XML\r\n\t * @type: private\r\n\t */\r\n\tafterUpdate(that: any, xml: any, id?:any) {\r\n\t\tlet _xml;\r\n\t\tif (arguments.length === 3) {\r\n\t\t\t_xml = arguments[1];\r\n\t\t} else {\r\n\t\t\t// old dataprocessor\r\n\t\t\t_xml = arguments[4];\r\n\t\t}\r\n\t\tlet mode = this.getGanttMode();\r\n\t\tconst reqUrl = _xml.filePath || _xml.url;\r\n\r\n\t\tif (this._tMode !== \"REST\" && this._tMode !== \"REST-JSON\") {\r\n\t\t\tif (reqUrl.indexOf(\"gantt_mode=links\") !== -1) {\r\n\t\t\t\tmode = \"link\";\r\n\t\t\t} else {\r\n\t\t\t\tmode = \"task\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (reqUrl.indexOf(\"/link\") > reqUrl.indexOf(\"/task\")) {\r\n\t\t\t\tmode = \"link\";\r\n\t\t\t} else {\r\n\t\t\t\tmode = \"task\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.setGanttMode(mode);\r\n\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\t// try to use json first\r\n\t\tlet tag;\r\n\r\n\t\ttry {\r\n\t\t\ttag = JSON.parse(xml.xmlDoc.responseText);\r\n\t\t} catch (e) {\r\n\r\n\t\t\t// empty response also can be processed by json handler\r\n\t\t\tif (!xml.xmlDoc.responseText.length) {\r\n\t\t\t\ttag = {};\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (tag) {\r\n\t\t\tconst action = tag.action || this.getState(id) || \"updated\";\r\n\t\t\tconst sid = tag.sid || id[0];\r\n\t\t\tconst tid = tag.tid || id[0];\r\n\t\t\tthat.afterUpdateCallback(sid, tid, action, tag, mode);\r\n\t\t\tthat.finalizeUpdate();\r\n\t\t\tthis.setGanttMode(mode);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// xml response\r\n\t\tconst top = ajax.xmltop(\"data\", xml.xmlDoc); // fix incorrect content type in IE\r\n\t\tif (!top) {\r\n\t\t\treturn this.cleanUpdate(id);\r\n\t\t}\r\n\t\tconst atag = ajax.xpath(\"//data/action\", top);\r\n\t\tif (!atag.length) {\r\n\t\t\treturn this.cleanUpdate(id);\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < atag.length; i++) {\r\n\t\t\tconst btag = atag[i];\r\n\t\t\tconst action = btag.getAttribute(\"type\");\r\n\t\t\tconst sid = btag.getAttribute(\"sid\");\r\n\t\t\tconst tid = btag.getAttribute(\"tid\");\r\n\r\n\t\t\tthat.afterUpdateCallback(sid, tid, action, btag, mode);\r\n\t\t}\r\n\t\tthat.finalizeUpdate();\r\n\t}\r\n\r\n\tcleanUpdate(id: any[]) {\r\n\t\tif (id) {\r\n\t\t\tfor (let i = 0; i < id.length; i++) {\r\n\t\t\t\tdelete this._in_progress[id[i]];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfinalizeUpdate() {\r\n\t\tif (this._waitMode) {\r\n\t\t\tthis._waitMode--;\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onAfterUpdateFinish\", []);\r\n\t\tif (!this.updatedRows.length) {\r\n\t\t\tthis.callEvent(\"onFullSync\", []);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @desc: initializes data-processor\r\n\t * @param: gantt - dhtmlxGantt object to attach this data-processor to\r\n\t * @type: public\r\n\t */\r\n\tinit(gantt: any) {\r\n\t\tif (this._initialized) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.$gantt = gantt;\r\n\t\tif (this.$gantt._dp_init) {\r\n\t\t\tthis.$gantt._dp_init(this);\r\n\t\t}\r\n\r\n\t\tthis._setDefaultTransactionMode();\r\n\r\n\t\tthis.styles = {\r\n\t\t\tupdated:\"gantt_updated\",\r\n\t\t\torder:\"gantt_updated\",\r\n\t\t\tinserted:\"gantt_inserted\",\r\n\t\t\tdeleted:\"gantt_deleted\",\r\n\t\t\tinvalid:\"gantt_invalid\",\r\n\t\t\terror:\"gantt_error\",\r\n\t\t\tclear:\"\"\r\n\t\t};\r\n\r\n\t\tthis._methods=[\"_row_style\",\"setCellTextStyle\",\"_change_id\",\"_delete_task\"];\r\n\t\textendGantt(this.$gantt, this);\r\n\t\tconst dataProcessorEvents = new DataProcessorEvents(this.$gantt, this);\r\n\t\tdataProcessorEvents.attach();\r\n\t\tthis.attachEvent(\"onDestroy\", function() {\r\n\t\t\tdelete this.setGanttMode;\r\n\t\t\tdelete this._getRowData;\r\n\r\n\t\t\tdelete this.$gantt._dp;\r\n\t\t\tdelete this.$gantt._change_id;\r\n\t\t\tdelete this.$gantt._row_style;\r\n\t\t\tdelete this.$gantt._delete_task;\r\n\t\t\tdelete this.$gantt._sendTaskOrder;\r\n\t\t\tdelete this.$gantt;\r\n\r\n\t\t\tdataProcessorEvents.detach();\r\n\t\t});\r\n\t\tthis.$gantt.callEvent(\"onDataProcessorReady\", [this]);\r\n\t\tthis._initialized = true;\r\n\t}\r\n\r\n\tsetOnAfterUpdate(handler) {\r\n\t\tthis.attachEvent(\"onAfterUpdate\", handler);\r\n\t}\r\n\r\n\tsetOnBeforeUpdateHandler(handler) {\r\n\t\tthis.attachEvent(\"onBeforeDataSending\", handler);\r\n\t}\r\n\r\n\t/* starts autoupdate mode\r\n\t\t@param interval time interval for sending update requests\r\n\t*/\r\n\tsetAutoUpdate(interval, user) {\r\n\t\tinterval = interval || 2000;\r\n\r\n\t\tthis._user = user || (new Date()).valueOf();\r\n\t\tthis._needUpdate = false;\r\n\r\n\t\tthis._updateBusy = false;\r\n\r\n\t\tthis.attachEvent(\"onAfterUpdate\", this.afterAutoUpdate); // arguments sid, action, tid, xml_node;\r\n\r\n\t\tthis.attachEvent(\"onFullSync\", this.fullSync);\r\n\r\n\t\tsetInterval(() => {\r\n\t\t\tthis.loadUpdate();\r\n\t\t}, interval);\r\n\t}\r\n\r\n\t/* process updating request response\r\n\t\tif status == collision version is deprecated\r\n\t\tset flag for autoupdating immediately\r\n\t*/\r\n\tafterAutoUpdate(sid, action, tid, xml_node) { // tslint:disable-line\r\n\t\tif (action === \"collision\") {\r\n\t\t\tthis._needUpdate = true;\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\t/* callback function for onFillSync event\r\n\t\tcall update function if it's need\r\n\t*/\r\n\tfullSync() {\r\n\t\tif (this._needUpdate) {\r\n\t\t\tthis._needUpdate = false;\r\n\t\t\tthis.loadUpdate();\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/* sends query to the server and call callback function\r\n\t*/\r\n\tgetUpdates(url, callback) {\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\tif (this._updateBusy) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\tthis._updateBusy = true;\r\n\t\t}\r\n\r\n\t\tajax.get(url, callback);\r\n\r\n\t}\r\n\r\n\t/* loads updates and processes them\r\n\t*/\r\n\tloadUpdate() {\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\tconst version = this.$gantt.getUserData(0, \"version\");\r\n\t\tlet url = this.serverProcessor + ajax.urlSeparator(this.serverProcessor) + [\"dhx_user=\" + this._user, \"dhx_version=\" + version].join(\"&\");\r\n\t\turl = url.replace(\"editing=true&\", \"\");\r\n\t\tthis.getUpdates(url, (xml) => {\r\n\t\t\tconst vers = ajax.xpath(\"//userdata\", xml);\r\n\t\t\tthis.obj.setUserData(0, \"version\", this._getXmlNodeValue(vers[0]));\r\n\r\n\t\t\tconst updates = ajax.xpath(\"//update\", xml);\r\n\t\t\tif (updates.length) {\r\n\t\t\t\tthis._silent_mode = true;\r\n\r\n\t\t\t\tfor (let i = 0; i < updates.length; i++) {\r\n\t\t\t\t\tconst status = updates[i].getAttribute(\"status\");\r\n\t\t\t\t\tconst id = updates[i].getAttribute(\"id\");\r\n\t\t\t\t\tconst parent = updates[i].getAttribute(\"parent\");\r\n\t\t\t\t\tswitch (status) {\r\n\t\t\t\t\t\tcase \"inserted\":\r\n\t\t\t\t\t\t\tthis.callEvent(\"insertCallback\", [updates[i], id, parent]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"updated\":\r\n\t\t\t\t\t\t\tthis.callEvent(\"updateCallback\", [updates[i], id, parent]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"deleted\":\r\n\t\t\t\t\t\t\tthis.callEvent(\"deleteCallback\", [updates[i], id, parent]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._silent_mode = false;\r\n\t\t\t}\r\n\r\n\t\t\tthis._updateBusy = false;\r\n\t\t});\r\n\t}\r\n\r\n\tdestructor() {\r\n\t\tthis.callEvent(\"onDestroy\", []);\r\n\t\tthis.detachAllEvents();\r\n\r\n\t\tthis.updatedRows = [];\r\n\t\tthis._in_progress = {}; // ?\r\n\t\tthis._invalid = {};\r\n\t\tthis._storage.clear();\r\n\t\tthis._storage = null;\r\n\t\tthis._headers = null;\r\n\t\tthis._payload = null;\r\n\t\tdelete this._initialized;\r\n\t}\r\n\r\n\tsetGanttMode(mode) {\r\n\t\tif (mode === \"tasks\") {\r\n\t\t\tmode = \"task\";\r\n\t\t} else if (mode === \"links\") {\r\n\t\t\tmode = \"link\";\r\n\t\t}\r\n\r\n\t\tconst modes = this.modes || {};\r\n\t\tconst ganttMode = this.getGanttMode();\r\n\t\tif (ganttMode) {\r\n\t\t\tmodes[ganttMode] = {\r\n\t\t\t\t_in_progress : this._in_progress,\r\n\t\t\t\t_invalid: this._invalid,\r\n\t\t\t\t_storage: this._storage,\r\n\t\t\t\tupdatedRows : this.updatedRows\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tlet newState = modes[mode];\r\n\t\tif (!newState) {\r\n\t\t\tnewState = modes[mode] = {\r\n\t\t\t\t_in_progress : {},\r\n\t\t\t\t_invalid : {},\r\n\t\t\t\t_storage : SimpleStorage.create(),\r\n\t\t\t\tupdatedRows : []\r\n\t\t\t};\r\n\t\t}\r\n\t\tthis._in_progress = newState._in_progress;\r\n\t\tthis._invalid = newState._invalid;\r\n\t\tthis._storage = newState._storage;\r\n\t\tthis.updatedRows = newState.updatedRows;\r\n\t\tthis.modes = modes;\r\n\t\tthis._ganttMode = mode;\r\n\t}\r\n\tgetGanttMode():string {\r\n\t\treturn this._ganttMode;\r\n\t}\r\n\r\n\tstoreItem(item) {\r\n\t\tthis._storage.storeItem(item);\r\n\t}\r\n\r\n\turl(url: string) {\r\n\t\tthis.serverProcessor = this._serverProcessor = url;\r\n\t}\r\n\r\n\tprotected _beforeSendData(data: any, rowId: any) {\r\n\t\tif (!this.callEvent(\"onBeforeUpdate\", [rowId, this.getState(rowId), data])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis._sendData(data, rowId);\r\n\t}\r\n\r\n\tprotected _serializeAsJSON(data: any) {\r\n\t\tif (typeof data === \"string\") {\r\n\t\t\treturn data;\r\n\t\t}\r\n\r\n\t\tconst copy = utils.copy(data);\r\n\t\tif (this._tMode === \"REST-JSON\") {\r\n\t\t\tdelete copy.id;\r\n\t\t\tdelete copy[this.action_param];\r\n\t\t}\r\n\r\n\t\treturn JSON.stringify(copy);\r\n\t}\r\n\r\n\tprotected _applyPayload(url: string) {\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\t\tif (this._payload) {\r\n\t\t\tfor (const key in this._payload) {\r\n\t\t\t\turl = url + ajax.urlSeparator(url) + this.escape(key) + \"=\" + this.escape(this._payload[key]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn url;\r\n\t}\r\n\r\n\t// GET/POST/JSON modes of the dataProcessor didn't send the whole data items in 'delete' requests\r\n\t// clear extra info from the data in order not to change the request format\r\n\tprotected _cleanupArgumentsBeforeSend(dataToSend: any) {\r\n\t\tlet processedData;\r\n\t\tif(dataToSend[this.action_param] === undefined){// hash of updated items, and not an individual item\r\n\t\t\tprocessedData = {};\r\n\t\t\tfor(const i in dataToSend) {\r\n\t\t\t\tprocessedData[i] = this._cleanupArgumentsBeforeSend(dataToSend[i]);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tprocessedData = this._cleanupItemBeforeSend(dataToSend);\r\n\t\t}\r\n\t\treturn processedData;\r\n\t}\r\n\tprotected _cleanupItemBeforeSend(updatedItem: any) {\r\n\t\tlet output = null;\r\n\t\tif(updatedItem){\r\n\t\t\tif(updatedItem[this.action_param] === \"deleted\"){\r\n\t\t\t\toutput = {};\r\n\t\t\t\toutput.id = updatedItem.id;\r\n\t\t\t\toutput[this.action_param] = updatedItem[this.action_param];\r\n\t\t\t}else{\r\n\t\t\t\toutput = updatedItem;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn output;\r\n\t}\r\n\r\n\tprotected _sendData(dataToSend: any, rowId?: any) {\r\n\t\tif (!dataToSend) {\r\n\t\t\treturn; // nothing to send\r\n\t\t}\r\n\t\tif (!this.callEvent(\"onBeforeDataSending\", rowId ? [rowId, this.getState(rowId), dataToSend] : [null, null, dataToSend])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (rowId) {\r\n\t\t\tthis._in_progress[rowId] = (new Date()).valueOf();\r\n\t\t}\r\n\r\n\t\tconst ajax = this.$gantt.ajax;\r\n\r\n\t\tif (this._tMode === \"CUSTOM\") {\r\n\t\t\tconst taskState = this.getState(rowId);\r\n\t\t\tconst taskAction = this.getActionByState(taskState);\r\n\t\t\tconst ganttMode = this.getGanttMode();\r\n\t\t\tconst _onResolvedCreateUpdate = (tag) => {\r\n\t\t\t\tlet action = taskState || \"updated\";\r\n\t\t\t\tlet sid = rowId;\r\n\t\t\t\tlet tid = rowId;\r\n\r\n\t\t\t\tif (tag) {\r\n\t\t\t\t\taction = tag.action || taskState;\r\n\t\t\t\t\tsid = tag.sid || sid;\r\n\t\t\t\t\ttid = tag.id || tag.tid || tid;\r\n\t\t\t\t}\r\n\t\t\t\tthis.afterUpdateCallback(sid, tid, action, tag, ganttMode);\r\n\t\t\t};\r\n\r\n\t\t\tlet actionPromise;\r\n\t\t\tif (this._router instanceof Function) {\r\n\t\t\t\tactionPromise = this._router(ganttMode, taskAction, dataToSend, rowId);\r\n\t\t\t} else if (this._router[ganttMode] instanceof Function) {\r\n\t\t\t\tactionPromise = this._router[ganttMode](taskAction, dataToSend, rowId);\r\n\t\t\t} else {\r\n\t\t\t\tswitch (taskState) {\r\n\t\t\t\t\tcase \"inserted\":\r\n\t\t\t\t\t\tactionPromise = this._router[ganttMode].create(dataToSend);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"deleted\":\r\n\t\t\t\t\t\tactionPromise = this._router[ganttMode].delete(rowId);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tactionPromise = this._router[ganttMode].update(dataToSend, rowId);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(actionPromise){\r\n\t\t\t\t// neither promise nor {tid: newId} response object\r\n\t\t\t\tif(!actionPromise.then &&\r\n\t\t\t\t\t(actionPromise.id === undefined && actionPromise.tid === undefined)){\r\n\t\t\t\t\tthrow new Error(\"Incorrect router return value. A Promise or a response object is expected\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(actionPromise.then){\r\n\t\t\t\t\tactionPromise.then(_onResolvedCreateUpdate).catch((error) => {\r\n\t\t\t\t\t\tif(error && error.action){\r\n\t\t\t\t\t\t\t_onResolvedCreateUpdate(error);\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t_onResolvedCreateUpdate({ action: \"error\", value: error});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}else{\r\n\t\t\t\t\t// custom method may return a response object in case of sync action\r\n\t\t\t\t\t_onResolvedCreateUpdate(actionPromise);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t_onResolvedCreateUpdate(null);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet queryParams: any;\r\n\t\tqueryParams = {\r\n\t\t\tcallback: (xml) => {\r\n\t\t\t\tconst ids = [];\r\n\r\n\t\t\t\tif (rowId) {\r\n\t\t\t\t\tids.push(rowId);\r\n\t\t\t\t} else if (dataToSend) {\r\n\t\t\t\t\tfor (const key in dataToSend) {\r\n\t\t\t\t\t\tids.push(key);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn this.afterUpdate(this, xml, ids);\r\n\t\t\t},\r\n\t\t\theaders: this._headers\r\n\t\t};\r\n\r\n\t\tconst urlParams = this.serverProcessor + (this._user ? (ajax.urlSeparator(this.serverProcessor) + [\"dhx_user=\" + this._user, \"dhx_version=\" + this.$gantt.getUserData(0, \"version\")].join(\"&\")) : \"\");\r\n\t\tlet url: any = this._applyPayload(urlParams);\r\n\t\tlet data;\r\n\r\n\t\tswitch (this._tMode) {\r\n\t\t\tcase \"GET\":\r\n\t\t\t\tdata = this._cleanupArgumentsBeforeSend(dataToSend);\r\n\t\t\t\tqueryParams.url = url + ajax.urlSeparator(url) + this.serialize(data, rowId);\r\n\t\t\t\tqueryParams.method = \"GET\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"POST\":\r\n\t\t\t\tdata = this._cleanupArgumentsBeforeSend(dataToSend);\r\n\t\t\t\tqueryParams.url = url;\r\n\t\t\t\tqueryParams.method = \"POST\";\r\n\t\t\t\tqueryParams.data = this.serialize(data, rowId);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"JSON\":\r\n\t\t\t\tdata = {};\r\n\t\t\t\tconst preprocessedData = this._cleanupItemBeforeSend(dataToSend);\r\n\t\t\t\tfor (const key in preprocessedData) {\r\n\t\t\t\t\tif (key === this.action_param || key === \"id\" || key === \"gr_id\") {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdata[key] = preprocessedData[key];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tqueryParams.url = url;\r\n\t\t\t\tqueryParams.method = \"POST\";\r\n\t\t\t\tqueryParams.data = JSON.stringify({\r\n\t\t\t\t\tid: rowId,\r\n\t\t\t\t\taction: dataToSend[this.action_param],\r\n\t\t\t\t\tdata\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"REST\":\r\n\t\t\tcase \"REST-JSON\":\r\n\t\t\t\turl = urlParams.replace(/(&|\\?)editing=true/, \"\");\r\n\t\t\t\tdata = \"\";\r\n\r\n\t\t\t\tswitch (this.getState(rowId)) {\r\n\t\t\t\t\tcase \"inserted\":\r\n\t\t\t\t\t\tqueryParams.method = \"POST\";\r\n\t\t\t\t\t\tqueryParams.data = this.serialize(dataToSend, rowId);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"deleted\":\r\n\t\t\t\t\t\tqueryParams.method = \"DELETE\";\r\n\t\t\t\t\t\turl = url + (url.slice(-1) === \"/\" ? \"\" : \"/\") + rowId;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tqueryParams.method = \"PUT\";\r\n\t\t\t\t\t\tqueryParams.data = this.serialize(dataToSend, rowId);\r\n\t\t\t\t\t\turl = url + (url.slice(-1) === \"/\" ? \"\" : \"/\") + rowId;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tqueryParams.url = this._applyPayload(url);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tthis._waitMode++;\r\n\t\treturn ajax.query(queryParams);\r\n\t}\r\n\r\n\tprotected _forEachUpdatedRow(code: any) {\r\n\t\tconst updatedRows = this.updatedRows.slice();\r\n\t\tfor (let i = 0; i < updatedRows.length; i++) {\r\n\t\t\tconst rowId = updatedRows[i];\r\n\t\t\tif (this.$gantt.getUserData(rowId, this.action_param)) {\r\n\t\t\t\tcode.call(this, rowId);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprotected _setDefaultTransactionMode() {\r\n\t\tif (this.serverProcessor) {\r\n\t\t\tthis.setTransactionMode(\"POST\", true);\r\n\t\t\tthis.serverProcessor += (this.serverProcessor.indexOf(\"?\") !== -1 ? \"&\" : \"?\") + \"editing=true\";\r\n\t\t\tthis._serverProcessor = this.serverProcessor;\r\n\t\t}\r\n\t}\r\n\r\n\t/* returns xml node value\r\n\t\t@param node\r\n\t\t\txml node\r\n\t*/\r\n\tprotected _getXmlNodeValue(node) {\r\n\t\tif (node.firstChild) {\r\n\t\t\treturn node.firstChild.nodeValue;\r\n\t\t}\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\tprotected _getAllData() {\r\n\t\tconst out = {};\r\n\t\tlet hasOne = false;\r\n\r\n\t\tthis._forEachUpdatedRow(function(id) {\r\n\t\t\tif (this._in_progress[id] || this.is_invalid(id)){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst row = this._getRowData(id);\r\n\t\t\tif (!this.callEvent(\"onBeforeUpdate\", [id, this.getState(id), row])) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tout[id] = row;\r\n\t\t\thasOne = true;\r\n\t\t\tthis._in_progress[id] = (new Date()).valueOf();\r\n\t\t});\r\n\r\n\t\treturn hasOne ? out : null;\r\n\t}\r\n\r\n\tprotected _prepareDataItem(rawItem: any): any {\r\n\t\tconst processedItem = {};\r\n\r\n\t\tfor (const key in rawItem) {\r\n\t\t\tif (key.substr(0, 1) === \"$\") {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tconst value = rawItem[key];\r\n\t\t\tif (helpers.isDate(value)) {\r\n\t\t\t\tprocessedItem[key] = this.$gantt.defined(this.$gantt.templates.xml_format) ? this.$gantt.templates.xml_format(value) : this.$gantt.templates.format_date(value);\r\n\t\t\t} else if(value === null) {\r\n\t\t\t\tprocessedItem[key] = \"\";\r\n\t\t\t} else {\r\n\t\t\t\tprocessedItem[key] = value;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprocessedItem[this.action_param] = this.$gantt.getUserData(rawItem.id, this.action_param);\r\n\t\treturn processedItem;\r\n\t}\r\n\r\n\tprotected getStoredItem(id){\r\n\t\treturn this._storage.getStoredItem(id);\r\n\t}\r\n\r\n\tprotected _getRowData(id) {\r\n\t\tlet dataItem;\r\n\t\tconst gantt = this.$gantt;\r\n\t\tif (this.getGanttMode() === \"task\") {\r\n\t\t\tif(gantt.isTaskExists(id)){\r\n\t\t\t\tdataItem =this.$gantt.getTask(id);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif(gantt.isLinkExists(id)){\r\n\t\t\t\tdataItem =this.$gantt.getLink(id);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!dataItem) {\r\n\t\t\tdataItem = this.getStoredItem(id);\r\n\t\t}\r\n\r\n\t\tif (!dataItem) {\r\n\t\t\tdataItem = { id };\r\n\t\t}\r\n\r\n\t\treturn this._prepareDataItem(dataItem);\r\n\t}\r\n}","var DataProcessor = require(\"./data_processor\");\r\nmodule.exports = {\r\n\tDEPRECATED_api: function(server) {\r\n\t\treturn new (DataProcessor.DataProcessor)(server);\r\n\t},\r\n\tcreateDataProcessor: DataProcessor.createDataProcessor,\r\n\tgetDataProcessorModes: DataProcessor.getAvailableModes\r\n};","var isHeadless = require(\"../../utils/is_headless\");\r\n\r\nvar storeRenderCreator = function(name, gantt){\r\n\t\r\n\tvar store = gantt.getDatastore(name);\r\n\r\n\tvar itemRepainter = {\r\n\t\trenderItem: function(id, renderer){\r\n\r\n\t\t\tvar renders = renderer.getLayers();\r\n\r\n\t\t\tvar item = store.getItem(id);\r\n\t\t\tif(item && store.isVisible(id)) {\r\n\t\t\t\tfor (var i = 0; i < renders.length; i++)\r\n\t\t\t\t\trenders[i].render_item(item);\r\n\t\t\t}\r\n\t\t},\r\n\t\trenderItems: function(renderer){\r\n\t\t\tvar renderers = renderer.getLayers();\r\n\t\t\tfor (var i = 0; i < renderers.length; i++) {\r\n\t\t\t\trenderers[i].clear();\r\n\t\t\t}\r\n\r\n\t\t\tvar allData = store.getVisibleItems();\r\n\r\n\t\t\tvar loadedRanges = {};\r\n\t\t\tfor (var i = 0; i < renderers.length; i++) {\r\n\t\t\t\tvar layer = renderers[i];\r\n\t\t\t\tvar layerData = allData;\r\n\t\t\t\tif(layer.get_visible_range){\r\n\t\t\t\t\tvar range = layer.get_visible_range(store);\r\n\t\t\t\t\tvar key = range.start + \" - \" + range.end;\r\n\t\t\t\t\tif(loadedRanges[key]){\r\n\t\t\t\t\t\tlayerData = loadedRanges[key];\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlayerData = store.getIndexRange(range.start, range.end);\r\n\t\t\t\t\t\tloadedRanges[key] = layerData;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\trenderers[i].render_items(layerData);\r\n\t\t\t}\r\n\t\t},\r\n\t\tupdateItems: function(layer) {\r\n\t\t\tif(layer.update_items){\r\n\t\t\t\tvar data;\r\n\t\t\t\tif(layer.get_visible_range){\r\n\t\t\t\t\tvar range = layer.get_visible_range(store);\r\n\t\t\t\t\tdata = store.getIndexRange(range.start, range.end);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdata = store.getVisibleItems();\r\n\t\t\t\t}\r\n\t\t\t\tlayer.update_items(data);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tstore.attachEvent(\"onStoreUpdated\", function(id, item, action){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tvar renderer = gantt.$services.getService(\"layers\").getDataRender(name);\r\n\t\tif(renderer){\r\n\t\t\trenderer.onUpdateRequest = function(layer){\r\n\t\t\t\titemRepainter.updateItems(layer);\r\n\t\t\t};\r\n\t\t}\r\n\t});\r\n\r\n\tfunction skipRepaint(gantt){\r\n\t\tvar state = gantt.$services.getService(\"state\");\r\n\t\tif(state.getState(\"batchUpdate\").batch_update){\r\n\t\t\treturn true;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tstore.attachEvent(\"onStoreUpdated\", function(id, item, action){\r\n\t\tif(skipRepaint(gantt)){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif(!id || action == \"move\" || action == \"delete\"){\r\n\t\t\tstore.callEvent(\"onBeforeRefreshAll\", []);\r\n\t\t\tstore.callEvent(\"onAfterRefreshAll\", []);\r\n\t\t}else{\r\n\t\t\tstore.callEvent(\"onBeforeRefreshItem\", [item.id]);\r\n\t\t\tstore.callEvent(\"onAfterRefreshItem\", [item.id]);\r\n\t\t}\r\n\t});\r\n\r\n\tstore.attachEvent(\"onAfterRefreshAll\", function(){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tvar renderer = gantt.$services.getService(\"layers\").getDataRender(name);\r\n\t\tif(renderer){\r\n\t\t\titemRepainter.renderItems(renderer);\r\n\t\t}\r\n\t});\r\n\tstore.attachEvent(\"onAfterRefreshItem\", function(id){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tvar renderer = gantt.$services.getService(\"layers\").getDataRender(name);\t\t\r\n\t\tif(renderer){\r\n\t\t\titemRepainter.renderItem(id, renderer);\r\n\t\t}\r\n\t});\r\n\r\n\t// TODO: probably can be done more in a more efficient way\r\n\tstore.attachEvent(\"onItemOpen\", function(){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tgantt.render();\r\n\t});\r\n\r\n\tstore.attachEvent(\"onItemClose\", function(){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tgantt.render();\r\n\t});\r\n\r\n\tfunction refreshId(renders, oldId, newId, item) {\r\n\t\tfor (var i = 0; i < renders.length; i++) {\r\n\t\t\trenders[i].change_id(oldId, newId);\r\n\t\t}\r\n\t}\r\n\r\n\tstore.attachEvent(\"onIdChange\", function(oldId, newId){\r\n\t\tif(isHeadless(gantt)){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\t// in case of linked datastores (tasks <-> links), id change should recalculate something in linked datastore before any repaint\r\n\t\t// use onBeforeIdChange for this hook.\r\n\t\t// TODO: use something more reasonable instead\r\n\t\tstore.callEvent(\"onBeforeIdChange\", [oldId, newId]);\r\n\r\n\t\tif(skipRepaint(gantt)){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar renderer = gantt.$services.getService(\"layers\").getDataRender(name);\r\n\t\trefreshId(renderer.getLayers(), oldId, newId, store.getItem(newId));\r\n\t\titemRepainter.renderItem(newId, renderer);\r\n\t});\r\n\r\n};\r\n\r\nmodule.exports = {\r\n\tbindDataStore: storeRenderCreator\r\n};","function createDataStoreSelectMixin(store){\r\n\tvar selectedId = null;\r\n\r\n\tvar deleteItem = store._removeItemInner;\r\n\t\r\n\tfunction unselect(id){\r\n\t\tselectedId = null;\r\n\t\tthis.callEvent(\"onAfterUnselect\", [id]);\r\n\t}\r\n\r\n\tstore._removeItemInner = function(id){\r\n\t\tif(selectedId == id){\r\n\t\t\tunselect.call(this, id);\r\n\t\t}\r\n\r\n\t\tif(selectedId && this.eachItem){\r\n\t\t\tthis.eachItem(function(subItem){\r\n\t\t\t\tif(subItem.id == selectedId){\r\n\t\t\t\t\tunselect.call(this, subItem.id);\r\n\t\t\t\t}\r\n\t\t\t}, id);\r\n\t\t}\r\n\r\n\t\treturn deleteItem.apply(this, arguments);\r\n\t};\r\n\r\n\tstore.attachEvent(\"onIdChange\", function(oldId, newId) {\r\n\t\tif (store.getSelectedId() == oldId) {\r\n\t\t\tstore.silent(function () {\r\n\t\t\t\tstore.unselect(oldId);\r\n\t\t\t\tstore.select(newId);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\treturn {\r\n\t\tselect: function(id){\r\n\t\t\tif (id){\r\n\r\n\t\t\t\tif(selectedId == id)\r\n\t\t\t\t\treturn selectedId;\r\n\r\n\t\t\t\tif(!this._skip_refresh) {\r\n\t\t\t\t\tif (!this.callEvent(\"onBeforeSelect\", [id])) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.unselect();\r\n\r\n\t\t\t\tselectedId = id;\r\n\r\n\t\t\t\tif(!this._skip_refresh) {\r\n\t\t\t\t\tthis.refresh(id);\r\n\t\t\t\t\tthis.callEvent(\"onAfterSelect\", [id]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn selectedId;\r\n\t\t},\r\n\t\tgetSelectedId: function(){\r\n\t\t\treturn selectedId;\r\n\t\t},\r\n\t\tisSelected: function(id){\r\n\t\t\treturn id == selectedId;\r\n\t\t},\r\n\t\tunselect: function(id){\r\n\t\t\tvar id = id || selectedId;\r\n\t\t\tif(!id)\r\n\t\t\t\treturn;\r\n\t\t\tselectedId = null;\r\n\t\t\tif(!this._skip_refresh){\r\n\t\t\t\tthis.refresh(id);\r\n\t\t\t\tunselect.call(this, id);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n}\r\n\r\nmodule.exports = createDataStoreSelectMixin;","var utils = require(\"../../utils/utils\");\r\n\r\n\r\nvar createLinksStoreFacade = function(){\r\n\treturn {\r\n\tgetLinkCount: function () {\r\n\t\treturn this.$data.linksStore.count();\r\n\t},\r\n\r\n\tgetLink : function (id) {\r\n\t\treturn this.$data.linksStore.getItem(id);\r\n\t},\r\n\r\n\tgetLinks : function () {\r\n\t\treturn this.$data.linksStore.getItems();\r\n\t},\r\n\r\n\tisLinkExists : function (id) {\r\n\t\treturn this.$data.linksStore.exists(id);\r\n\t},\r\n\r\n\taddLink : function (link) {\r\n\t\treturn this.$data.linksStore.addItem(link);\r\n\t},\r\n\r\n\tupdateLink : function (id, data) {\r\n\t\tif (!utils.defined(data))\r\n\t\t\tdata = this.getLink(id);\r\n\t\tthis.$data.linksStore.updateItem(id, data);\r\n\t},\r\n\r\n\tdeleteLink : function (id) {\r\n\t\treturn this.$data.linksStore.removeItem(id);\r\n\t},\r\n\r\n\tchangeLinkId : function (oldid, newid) {\r\n\t\treturn this.$data.linksStore.changeId(oldid, newid);\r\n\t}\r\n};\r\n};\r\n\r\nmodule.exports = createLinksStoreFacade;","var utils = require(\"../../utils/utils\");\r\n\r\nvar createTasksDatastoreFacade = function(){\r\n\treturn {\r\n\tgetTask: function (id) {\r\n\t\tthis.assert(id, \"Invalid argument for gantt.getTask\");\r\n\t\tvar task = this.$data.tasksStore.getItem(id);\r\n\t\tthis.assert(task, \"Task not found id=\" + id);\r\n\t\treturn task;\r\n\t},\r\n\tgetTaskByTime: function (from, to) {\r\n\t\tvar p = this.$data.tasksStore.getItems();\r\n\r\n\t\tvar res = [];\r\n\r\n\t\tif (!(from || to)) {\r\n\t\t\tres = p;\r\n\t\t} else {\r\n\t\t\tfrom = +from || -Infinity;\r\n\t\t\tto = +to || Infinity;\r\n\t\t\tfor (var t = 0; t < p.length; t++){\r\n\t\t\t\tvar task = p[t];\r\n\t\t\t\tif (+task.start_date < to && +task.end_date > from)\r\n\t\t\t\t\tres.push(task);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res;\r\n\t},\r\n\tisTaskExists: function (id) {\r\n\t\tif(!this.$data || !this.$data.tasksStore){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn this.$data.tasksStore.exists(id);\r\n\t},\r\n\tupdateTask: function (id, item) {\r\n\t\tif (!utils.defined(item)) item = this.getTask(id);\r\n\t\tthis.$data.tasksStore.updateItem(id, item);\r\n\t\tif(this.isTaskExists(id))\r\n\t\t\tthis.refreshTask(id);\r\n\t},\r\n\taddTask: function (item, parent, index) {\r\n\t\tif (!utils.defined(item.id))\r\n\t\t\titem.id = utils.uid();\r\n\r\n\t\tif (!utils.defined(parent)) parent = this.getParent(item) || 0;\r\n\t\tif (!this.isTaskExists(parent)) parent = this.config.root_id;\r\n\t\tthis.setParent(item, parent);\r\n\r\n\t\treturn this.$data.tasksStore.addItem(item, index, parent);\r\n\t},\r\n\tdeleteTask: function (id) {\r\n\t\treturn this.$data.tasksStore.removeItem(id);\r\n\t},\r\n\tgetTaskCount: function () {\r\n\t\treturn this.$data.tasksStore.count();\r\n\t},\r\n\tgetVisibleTaskCount: function () {\r\n\t\treturn this.$data.tasksStore.countVisible();\r\n\t},\r\n\tgetTaskIndex: function (id) {\r\n\t\treturn this.$data.tasksStore.getBranchIndex(id);\r\n\t},\r\n\tgetGlobalTaskIndex: function (id) {\r\n\t\tthis.assert(id, \"Invalid argument\");\r\n\t\treturn this.$data.tasksStore.getIndexById(id);\r\n\t},\r\n\teachTask: function (code, parent, master) {\r\n\t\treturn this.$data.tasksStore.eachItem(utils.bind(code, master||this), parent);\r\n\t},\r\n\teachParent: function (callback, startTask, master) {\r\n\t\treturn this.$data.tasksStore.eachParent(utils.bind(callback, master || this), startTask);\r\n\t},\r\n\tchangeTaskId: function (oldid, newid) {\r\n\t\tthis.$data.tasksStore.changeId(oldid, newid);\r\n\t\tvar task = this.$data.tasksStore.getItem(newid);\r\n\r\n\t\tvar links = [];\r\n\r\n\t\tif (task.$source) {\r\n\t\t\tlinks = links.concat(task.$source);\r\n\t\t}\r\n\t\tif (task.$target) {\r\n\t\t\tlinks = links.concat(task.$target);\r\n\t\t}\r\n\r\n\t\tfor (var i = 0; i < links.length; i++) {\r\n\t\t\tvar link = this.getLink(links[i]);\r\n\t\t\tif (link.source == oldid) {\r\n\t\t\t\tlink.source = newid;\r\n\t\t\t}\r\n\t\t\tif (link.target == oldid) {\r\n\t\t\t\tlink.target = newid;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcalculateTaskLevel: function (item) {\r\n\t\treturn this.$data.tasksStore.calculateItemLevel(item);\r\n\t},\r\n\tgetNext: function (id) {\r\n\t\treturn this.$data.tasksStore.getNext(id);\r\n\t},\r\n\tgetPrev: function (id) {\r\n\t\treturn this.$data.tasksStore.getPrev(id);\r\n\t},\r\n\tgetParent: function (id) {\r\n\t\treturn this.$data.tasksStore.getParent(id);\r\n\t},\r\n\tsetParent: function (task, new_pid, silent) {\r\n\t\treturn this.$data.tasksStore.setParent(task, new_pid, silent);\r\n\t},\r\n\tgetSiblings: function (id) {\r\n\t\treturn this.$data.tasksStore.getSiblings(id).slice();\r\n\t},\r\n\tgetNextSibling: function (id) {\r\n\t\treturn this.$data.tasksStore.getNextSibling(id);\r\n\t},\r\n\tgetPrevSibling: function (id) {\r\n\t\treturn this.$data.tasksStore.getPrevSibling(id);\r\n\t},\r\n\tgetTaskByIndex: function(index){\r\n\t\tvar id = this.$data.tasksStore.getIdByIndex(index);\r\n\t\tif(this.isTaskExists(id)){\r\n\t\t\treturn this.getTask(id);\r\n\t\t}else{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t},\r\n\tgetChildren: function (id) {\r\n\t\tif(!this.hasChild(id)){\r\n\t\t\treturn [];\r\n\t\t}else{\r\n\t\t\treturn this.$data.tasksStore.getChildren(id).slice();\r\n\t\t}\r\n\t},\r\n\thasChild: function (id) {\r\n\t\treturn this.$data.tasksStore.hasChild(id);\r\n\t},\r\n\topen: function (id) {\r\n\t\tthis.$data.tasksStore.open(id);\r\n\t},\r\n\tclose: function (id) {\r\n\t\tthis.$data.tasksStore.close(id);\r\n\t},\r\n\tmoveTask: function (sid, tindex, parent) {\r\n\t\treturn this.$data.tasksStore.move.apply(this.$data.tasksStore, arguments);\r\n\t},\r\n\tsort: function(field, desc, parent, silent) {\r\n\t\tvar render = !silent;//4th argument to cancel redraw after sorting\r\n\r\n\t\tthis.$data.tasksStore.sort(field, desc, parent);\r\n\t\tthis.callEvent(\"onAfterSort\", [field, desc, parent]);\r\n\r\n\t\tif (render) {\r\n\t\t\tthis.render();\r\n\t\t}\r\n\t}\r\n};\r\n};\r\n\r\nmodule.exports = createTasksDatastoreFacade;\r\n\r\n\r\n","var utils = require(\"../../utils/utils\");\r\nvar createTasksFacade = require(\"./datastore_tasks\"),\r\n\tcreateLinksFacade = require(\"./datastore_links\"),\r\n\tDataStore = require(\"../datastore/datastore\"),\r\n\tTreeDataStore = require(\"../datastore/treedatastore\"),\r\n\tcreateDatastoreSelect = require(\"../datastore/select\");\r\nvar datastoreRender = require(\"../datastore/datastore_render\");\r\nvar isHeadless = require(\"../../utils/is_headless\");\r\n\r\n// TODO: remove workaround for mixup with es5 and ts imports\r\nif(DataStore.default){\r\n\tDataStore = DataStore.default;\r\n}\r\n\r\nfunction getDatastores(){\r\n\tvar storeNames = this.$services.getService(\"datastores\");\r\n\tvar res = [];\r\n\tfor(var i = 0; i < storeNames.length; i++){\r\n\t\tres.push(this.getDatastore(storeNames[i]));\r\n\t}\r\n\treturn res;\r\n}\r\n\r\nvar createDatastoreFacade = function(){\r\n\treturn {\r\n\tcreateDatastore: function(config){\r\n\r\n\t\tvar $StoreType = (config.type || \"\").toLowerCase() == \"treedatastore\" ? TreeDataStore : DataStore;\r\n\r\n\t\tif (config) {\r\n\t\t\tvar self = this;\r\n\t\t\tconfig.openInitially = function(){ return self.config.open_tree_initially; };\r\n\t\t}\r\n\r\n\t\tvar store = new $StoreType(config);\r\n\t\tthis.mixin(store, createDatastoreSelect(store));\r\n\r\n\t\tif (config.name) {\r\n\t\t\tvar servicePrefix = \"datastore:\";\r\n\r\n\t\t\tthis.$services.dropService(servicePrefix + config.name);\r\n\t\t\tthis.$services.setService(servicePrefix + config.name, function() { return store; } );\r\n\r\n\t\t\tvar storeList = this.$services.getService(\"datastores\");\r\n\t\t\tif (!storeList) {\r\n\t\t\t\tstoreList = [];\r\n\t\t\t\tthis.$services.setService(\"datastores\", function() { return storeList; });\r\n\t\t\t\tstoreList.push(config.name);\r\n\t\t\t} else if (storeList.indexOf(config.name) < 0) {\r\n\t\t\t\tstoreList.push(config.name);\r\n\t\t\t}\r\n\r\n\t\t\tdatastoreRender.bindDataStore(config.name, this);\r\n\r\n\t\t}\r\n\r\n\t\treturn store;\r\n\t},\r\n\tgetDatastore: function(name){\r\n\t\treturn this.$services.getService(\"datastore:\" + name);\r\n\t},\r\n\r\n\trefreshData: function () {\r\n\t\tvar scrollState;\r\n\t\tif(!isHeadless(this)){\r\n\t\t\tscrollState = this.getScrollState();\r\n\t\t}\r\n\r\n\t\tthis.callEvent(\"onBeforeDataRender\", []);\r\n\r\n\t\tvar stores = getDatastores.call(this);\r\n\t\tfor(var i = 0; i < stores.length; i++){\r\n\t\t\tstores[i].refresh();\r\n\t\t}\r\n\r\n\t\tif(!isHeadless(this) && (scrollState.x || scrollState.y)){\r\n\t\t\tthis.scrollTo(scrollState.x, scrollState.y);\r\n\t\t}\r\n\t\tthis.callEvent(\"onDataRender\", []);\r\n\t},\r\n\r\n\tisChildOf: function(childId, parentId){\r\n\t\treturn this.$data.tasksStore.isChildOf(childId, parentId);\r\n\t},\r\n\r\n\trefreshTask: function (taskId, refresh_links) {\r\n\t\tvar task = this.getTask(taskId);\r\n\t\tif (task && this.isTaskVisible(taskId)) {\r\n\r\n\t\t\tthis.$data.tasksStore.refresh(taskId, !!this.getState().drag_id);// do quick refresh during drag and drop\r\n\r\n\t\t\tif (refresh_links !== undefined && !refresh_links)\r\n\t\t\t\treturn;\r\n\t\t\tfor (var i = 0; i < task.$source.length; i++) {\r\n\t\t\t\tthis.refreshLink(task.$source[i]);\r\n\t\t\t}\r\n\t\t\tfor (var i = 0; i < task.$target.length; i++) {\r\n\t\t\t\tthis.refreshLink(task.$target[i]);\r\n\t\t\t}\r\n\t\t}else if(this.isTaskExists(taskId) && this.isTaskExists(this.getParent(taskId))){\r\n\t\t\tthis.refreshTask(this.getParent(taskId));\r\n\t\t}\r\n\r\n\t},\r\n\trefreshLink: function (linkId) {\r\n\t\tthis.$data.linksStore.refresh(linkId, !!this.getState().drag_id);// do quick refresh during drag and drop\r\n\t},\r\n\r\n\tsilent: function(code){\r\n\t\tvar gantt = this;\r\n\t\tgantt.$data.tasksStore.silent(function(){\r\n\t\t\tgantt.$data.linksStore.silent(function(){\r\n\t\t\t\tcode();\r\n\t\t\t});\r\n\t\t});\r\n\t},\r\n\r\n\tclearAll: function () {\r\n\t\tvar stores = getDatastores.call(this);\r\n\t\tfor(var i = 0; i < stores.length; i++){\r\n\t\t\tstores[i].clearAll();\r\n\t\t}\r\n\r\n\t\tthis._update_flags();\r\n\t\tthis.userdata = {};\r\n\t\tthis.callEvent(\"onClear\", []);\r\n\t\tthis.render();\r\n\t},\r\n\t_clear_data: function () {\r\n\t\tthis.$data.tasksStore.clearAll();\r\n\t\tthis.$data.linksStore.clearAll();\r\n\t\tthis._update_flags();\r\n\t\tthis.userdata = {};\r\n\t},\r\n\r\n\tselectTask: function(id){\r\n\t\tvar store = this.$data.tasksStore;\r\n\t\tif(!this.config.select_task)\r\n\t\t\treturn false;\r\n\t\tif (id){\r\n\r\n\t\t\tstore.select(id);\r\n\t\t}\r\n\t\treturn store.getSelectedId();\r\n\t},\r\n\tunselectTask: function(id){\r\n\t\tvar store = this.$data.tasksStore;\r\n\t\tstore.unselect(id);\r\n\t},\r\n\tisSelectedTask: function(id){\r\n\t\treturn this.$data.tasksStore.isSelected(id);\r\n\t},\r\n\tgetSelectedId: function() {\r\n\t\treturn this.$data.tasksStore.getSelectedId();\r\n\t}\r\n};\r\n};\r\n\r\nfunction createFacade(){\r\n\tvar res = utils.mixin({}, createDatastoreFacade());\r\n\tutils.mixin(res, createTasksFacade());\r\n\tutils.mixin(res, createLinksFacade());\r\n\treturn res;\r\n}\r\n\r\n\r\n\r\n\r\nmodule.exports = {create: createFacade};","var utils = require(\"../../utils/utils\");\r\nvar facadeFactory = require(\"./../facades/datastore\");\r\nvar calculateScaleRange = require(\"../gantt_data_range\");\r\nfunction initDataStores(gantt){\r\n\r\n\tvar facade = facadeFactory.create();\r\n\tutils.mixin(gantt, facade);\r\n\tvar tasksStore = gantt.createDatastore({\r\n\t\tname: \"task\",\r\n\t\ttype: \"treeDatastore\",\r\n\t\trootId: function() { return gantt.config.root_id; },\r\n\t\tinitItem: utils.bind(_init_task, gantt),\r\n\t\tgetConfig: function() { return gantt.config; }\r\n\t});\r\n\r\n\tvar linksStore = gantt.createDatastore({\r\n\t\tname: \"link\",\r\n\t\tinitItem: utils.bind(_init_link, gantt)\r\n\t});\r\n\r\n\tgantt.attachEvent(\"onDestroy\", function(){\r\n\t\ttasksStore.destructor();\r\n\t\tlinksStore.destructor();\r\n\t});\r\n\r\n\ttasksStore.attachEvent(\"onBeforeRefreshAll\", function(){\r\n\r\n\t\tvar order = tasksStore.getVisibleItems();\r\n\r\n\t\tfor(var i=0; i < order.length; i++){\r\n\t\t\tvar item = order[i];\r\n\t\t\titem.$index = i;\r\n\t\t\tgantt.resetProjectDates(item);\r\n\t\t}\r\n\r\n\t});\r\n\r\n\ttasksStore.attachEvent(\"onFilterItem\", function(id, task) {\r\n\t\tif (gantt.config.show_tasks_outside_timescale) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tvar min = null, max = null;\r\n\t\tif (gantt.config.start_date && gantt.config.end_date) {\r\n\t\t\tif (gantt._isAllowedUnscheduledTask(task)) return true;\r\n\t\t\tmin = gantt.config.start_date.valueOf();\r\n\t\t\tmax = gantt.config.end_date.valueOf();\r\n\r\n\t\t\tif (+task.start_date > max || +task.end_date < +min)\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t});\r\n\r\n\ttasksStore.attachEvent(\"onIdChange\", function(oldId, newId){\r\n\t\tgantt._update_flags(oldId, newId);\r\n\t});\r\n\r\n\ttasksStore.attachEvent(\"onAfterUpdate\", function(id){\r\n\t\tgantt._update_parents(id);\r\n\t\tif(gantt.getState(\"batchUpdate\").batch_update){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tvar task = tasksStore.getItem(id);\r\n\t\tfor (var i = 0; i < task.$source.length; i++) {\r\n\t\t\tlinksStore.refresh(task.$source[i]);\r\n\t\t}\r\n\t\tfor (var i = 0; i < task.$target.length; i++) {\r\n\t\t\tlinksStore.refresh(task.$target[i]);\r\n\t\t}\r\n\t});\r\n\r\n\ttasksStore.attachEvent(\"onAfterItemMove\", function(sid, parent, tindex){\r\n\t\tvar source = gantt.getTask(sid);\r\n\r\n\t\tif(this.getNextSibling(sid) !== null){\r\n\t\t\tsource.$drop_target = this.getNextSibling(sid);\r\n\t\t} else if(this.getPrevSibling(sid) !== null){\r\n\t\t\tsource.$drop_target = \"next:\" + this.getPrevSibling(sid);\r\n\t\t}else{\r\n\t\t\tsource.$drop_target = \"next:null\";\r\n\t\t}\r\n\r\n\t});\r\n\r\n\ttasksStore.attachEvent(\"onStoreUpdated\", function(id, item, action){\r\n\t\tif(action == \"delete\"){\r\n\t\t\tgantt._update_flags(id, null);\r\n\t\t}\r\n\r\n\t\tvar state = gantt.$services.getService(\"state\");\r\n\t\tif(state.getState(\"batchUpdate\").batch_update){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(gantt.config.fit_tasks && action !== \"paint\"){\r\n\t\t\tvar oldState = gantt.getState();\r\n\t\t\tcalculateScaleRange(gantt);\r\n\t\t\tvar newState = gantt.getState();\r\n\r\n\t\t\t//this._init_tasks_range();\r\n\t\t\tif (+oldState.min_date != +newState.min_date || +oldState.max_date != +newState.max_date) {\r\n\t\t\t\tgantt.render();\r\n\r\n\t\t\t\tgantt.callEvent(\"onScaleAdjusted\", []);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif(action == \"add\" || action == \"move\" || action == \"delete\"){\r\n\t\t\tgantt.$layout.resize();\r\n\t\t}else if(!id){\r\n\t\t\tlinksStore.refresh();\r\n\t\t}\r\n\r\n\t});\r\n\r\n\tlinksStore.attachEvent(\"onAfterAdd\", function(id, link){\r\n\t\tsync_link(link);\r\n\t});\r\n\tlinksStore.attachEvent(\"onAfterUpdate\", function(id, link){\r\n\t\tsync_links();\r\n\t});\r\n\tlinksStore.attachEvent(\"onAfterDelete\", function(id, link){\r\n\t\tsync_link_delete(link);\r\n\t});\r\n\tlinksStore.attachEvent(\"onBeforeIdChange\", function(oldId, newId){\r\n\t\tsync_link_delete(gantt.mixin({id:oldId}, gantt.$data.linksStore.getItem(newId)));\r\n\t\tsync_link(gantt.$data.linksStore.getItem(newId));\r\n\t});\r\n\r\n\tfunction checkLinkedTaskVisibility(taskId){\r\n\t\tvar isVisible = gantt.isTaskVisible(taskId);\r\n\t\tif(!isVisible && gantt.isTaskExists(taskId)){\r\n\t\t\tvar parent = gantt.getParent(taskId);\r\n\t\t\tif(gantt.isTaskExists(parent) && gantt.isTaskVisible(parent)){\r\n\t\t\t\tparent = gantt.getTask(parent);\r\n\t\t\t\tif(gantt.isSplitTask(parent)){\r\n\t\t\t\t\tisVisible = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn isVisible;\r\n\t}\r\n\r\n\tlinksStore.attachEvent(\"onFilterItem\", function(id, link){\r\n\t\tif (!gantt.config.show_links) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar sourceVisible = checkLinkedTaskVisibility(link.source);\r\n\t\tvar targetVisible = checkLinkedTaskVisibility(link.target);\r\n\r\n\t\tif (!(sourceVisible && targetVisible) ||\r\n\t\t\tgantt._isAllowedUnscheduledTask(gantt.getTask(link.source)) || gantt._isAllowedUnscheduledTask(gantt.getTask(link.target)))\r\n\t\t\treturn false;\r\n\r\n\t\treturn gantt.callEvent(\"onBeforeLinkDisplay\", [id, link]);\r\n\t});\r\n\r\n\r\n\t(function(){\r\n\t\t// delete all connected links after task is deleted\r\n\t\tvar treeHelper = require(\"../../utils/task_tree_helpers\");\r\n\t\tvar deletedLinks = {};\r\n\r\n\t\tgantt.attachEvent(\"onBeforeTaskDelete\", function(id, item){\r\n\t\t\tdeletedLinks[id] = treeHelper.getSubtreeLinks(gantt, id);\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\tgantt.attachEvent(\"onAfterTaskDelete\", function(id, item) {\r\n\t\t\tif(deletedLinks[id]){\r\n\t\t\t\tgantt.$data.linksStore.silent(function(){\r\n\t\t\t\t\tfor(var i in deletedLinks[id]){\r\n\t\t\t\t\t\tgantt.$data.linksStore.removeItem(i);\r\n\t\t\t\t\t\tsync_link_delete(deletedLinks[id][i]);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdeletedLinks[id] = null;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t})();\r\n\r\n\tgantt.attachEvent(\"onAfterLinkDelete\", function(id, link) {\r\n\t\tgantt.refreshTask(link.source);\r\n\t\tgantt.refreshTask(link.target);\r\n\t});\r\n\r\n\tgantt.attachEvent(\"onParse\", sync_links);\r\n\r\n\tmapEvents({\r\n\t\tsource: linksStore,\r\n\t\ttarget: gantt,\r\n\t\tevents:{\r\n\t\t\t\"onItemLoading\":\"onLinkLoading\",\r\n\t\t\t\"onBeforeAdd\":\"onBeforeLinkAdd\",\r\n\t\t\t\"onAfterAdd\":\"onAfterLinkAdd\",\r\n\t\t\t\"onBeforeUpdate\":\"onBeforeLinkUpdate\",\r\n\t\t\t\"onAfterUpdate\":\"onAfterLinkUpdate\",\r\n\t\t\t\"onBeforeDelete\":\"onBeforeLinkDelete\",\r\n\t\t\t\"onAfterDelete\":\"onAfterLinkDelete\",\r\n\t\t\t\"onIdChange\":\"onLinkIdChange\"\r\n\t\t}\r\n\t});\r\n\r\n\tmapEvents({\r\n\t\tsource: tasksStore,\r\n\t\ttarget: gantt,\r\n\t\tevents:{\r\n\t\t\t\"onItemLoading\":\"onTaskLoading\",\r\n\t\t\t\"onBeforeAdd\":\"onBeforeTaskAdd\",\r\n\t\t\t\"onAfterAdd\":\"onAfterTaskAdd\",\r\n\t\t\t\"onBeforeUpdate\":\"onBeforeTaskUpdate\",\r\n\t\t\t\"onAfterUpdate\":\"onAfterTaskUpdate\",\r\n\t\t\t\"onBeforeDelete\":\"onBeforeTaskDelete\",\r\n\t\t\t\"onAfterDelete\":\"onAfterTaskDelete\",\r\n\t\t\t\"onIdChange\":\"onTaskIdChange\",\r\n\t\t\t\"onBeforeItemMove\":\"onBeforeTaskMove\",\r\n\t\t\t\"onAfterItemMove\":\"onAfterTaskMove\",\r\n\t\t\t\"onFilterItem\":\"onBeforeTaskDisplay\",\r\n\t\t\t\"onItemOpen\":\"onTaskOpened\",\r\n\t\t\t\"onItemClose\":\"onTaskClosed\",\r\n\t\t\t\"onBeforeSelect\":\"onBeforeTaskSelected\",\r\n\t\t\t\"onAfterSelect\":\"onTaskSelected\",\r\n\t\t\t\"onAfterUnselect\":\"onTaskUnselected\"\r\n\t\t}\r\n\t});\r\n\r\n\tgantt.$data = {\r\n\t\ttasksStore: tasksStore,\r\n\t\tlinksStore: linksStore\r\n\t};\r\n\r\n\tfunction sync_link(link){\r\n\t\tif(gantt.isTaskExists(link.source)){\r\n\t\t\tvar sourceTask = gantt.getTask(link.source);\r\n\t\t\tsourceTask.$source = sourceTask.$source || [];\r\n\t\t\tsourceTask.$source.push(link.id);\r\n\t\t}\r\n\t\tif(gantt.isTaskExists(link.target)){\r\n\t\t\tvar targetTask = gantt.getTask(link.target);\r\n\t\t\ttargetTask.$target = targetTask.$target || [];\r\n\t\t\ttargetTask.$target.push(link.id);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction sync_link_delete(link){\r\n\t\tif(gantt.isTaskExists(link.source)){\r\n\t\t\tvar sourceTask = gantt.getTask(link.source);\r\n\t\t\tfor(var i = 0; i < sourceTask.$source.length; i++){\r\n\t\t\t\tif(sourceTask.$source[i] == link.id){\r\n\t\t\t\t\tsourceTask.$source.splice(i, 1);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(gantt.isTaskExists(link.target)){\r\n\t\t\tvar targetTask = gantt.getTask(link.target);\r\n\t\t\tfor(var i = 0; i < targetTask.$target.length; i++){\r\n\t\t\t\tif(targetTask.$target[i] == link.id){\r\n\t\t\t\t\ttargetTask.$target.splice(i, 1);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction sync_links() {\r\n\t\tvar task = null;\r\n\t\tvar tasks = gantt.$data.tasksStore.getItems();\r\n\r\n\t\tfor(var i = 0, len = tasks.length; i < len; i++){\r\n\t\t\ttask = tasks[i];\r\n\t\t\ttask.$source = [];\r\n\t\t\ttask.$target = [];\r\n\t\t}\r\n\r\n\t\tvar links = gantt.$data.linksStore.getItems();\r\n\t\tfor (var i = 0, len = links.length; i < len; i++) {\r\n\r\n\t\t\tvar link = links[i];\r\n\t\t\tsync_link(link);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction mapEvents(conf){\r\n\t\tvar mapFrom = conf.source;\r\n\t\tvar mapTo = conf.target;\r\n\t\tfor(var i in conf.events){\r\n\t\t\t(function(sourceEvent, targetEvent){\r\n\t\t\t\tmapFrom.attachEvent(sourceEvent, function(){\r\n\t\t\t\t\treturn mapTo.callEvent(targetEvent, Array.prototype.slice.call(arguments));\r\n\t\t\t\t}, targetEvent);\r\n\t\t\t})(i, conf.events[i]);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction _init_task(task) {\r\n\t\tif (!this.defined(task.id))\r\n\t\t\ttask.id = this.uid();\r\n\r\n\t\tif (task.start_date)\r\n\t\t\ttask.start_date = gantt.date.parseDate(task.start_date, \"parse_date\");\r\n\t\tif (task.end_date)\r\n\t\t\ttask.end_date = gantt.date.parseDate(task.end_date, \"parse_date\");\r\n\r\n\r\n\t\tvar duration = null;\r\n\t\tif (task.duration || task.duration === 0) {\r\n\t\t\ttask.duration = duration = task.duration * 1;\r\n\t\t}\r\n\r\n\t\tif (duration) {\r\n\t\t\tif (task.start_date && !task.end_date) {\r\n\t\t\t\ttask.end_date = this.calculateEndDate(task);\r\n\t\t\t} else if (!task.start_date && task.end_date) {\r\n\t\t\t\ttask.start_date = this.calculateEndDate({\r\n\t\t\t\t\tstart_date: task.end_date,\r\n\t\t\t\t\tduration: -task.duration,\r\n\t\t\t\t\ttask: task\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\ttask.progress = Number(task.progress) || 0;\r\n\r\n\t\tif (this._isAllowedUnscheduledTask(task)) {\r\n\t\t\tthis._set_default_task_timing(task);\r\n\t\t}\r\n\t\tthis._init_task_timing(task);\r\n\t\tif (task.start_date && task.end_date)\r\n\t\t\tthis.correctTaskWorkTime(task);\r\n\r\n\t\ttask.$source = [];\r\n\t\ttask.$target = [];\r\n\r\n\t\tvar originalTask = this.$data.tasksStore.getItem(task.id);\r\n\t\tif (originalTask && !utils.defined(task.open)) {\r\n\t\t\t// if a task with the same id is already in the gantt and the new object doesn't specify the `open` state -\r\n\t\t\t// restore the `open` state we already have in the chart\r\n\t\t\ttask.$open = originalTask.$open;\r\n\t\t}\r\n\r\n\t\tif (task.parent === undefined) {\r\n\t\t\ttask.parent = this.config.root_id;\r\n\t\t}\r\n\t\treturn task;\r\n\t}\r\n\r\n\tfunction _init_link(link) {\r\n\t\tif (!this.defined(link.id))\r\n\t\t\tlink.id = this.uid();\r\n\t\treturn link;\r\n\t}\r\n}\r\n\r\n\r\nmodule.exports = initDataStores;\r\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a + <%----%> + + + + + + + <%----%> + + + + + diff --git a/OI/Proyecto.aspx.cs b/OI/Proyecto.aspx.cs new file mode 100644 index 000000000..5f3631145 --- /dev/null +++ b/OI/Proyecto.aspx.cs @@ -0,0 +1,208 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +public partial class OI_Proyecto : ClsPaginas +{ + + #region Propiedades + public const string iddivAgregarProyecto = "iddivAgregarProyecto"; + public int RCveEvento { get { return ViewState["RCveEvento"] != null ? ViewState["RCveEvento"].ToString().ToEntero() : 0; } set { ViewState["RCveEvento"] = value; } } + public int RCveEventoB { get { return ViewState["RCveEventoB"] != null ? ViewState["RCveEventoB"].ToString().ToEntero() : 0; } set { ViewState["RCveEventoB"] = value; } } + public int Folio { get { return ViewState["Folio"] != null ? ViewState["Folio"].ToString().ToEntero() : 0; } set { ViewState["Folio"] = value; } } + public decimal Avance { get { return ViewState["Avance"] != null ? ViewState["Avance"].ToString().ToEntero() : 0; } set { ViewState["Avance"] = value; } } + public int CveUsuarioPara { get { return ViewState["CveUsuarioPara"].ToString().ToEntero(); } set { ViewState["CveUsuarioPara"] = value; } } + public int CveUsuarioDe { get { return ViewState["CveUsuarioDe"].ToString().ToEntero(); } set { ViewState["CveUsuarioDe"] = value; } } + public List LCveUsuarioCCP { get { if (ViewState["LCveUsuarioCCP"] == null) { ViewState["LCveUsuarioCCP"] = new List(); } return (List)ViewState["LCveUsuarioCCP"]; } set { ViewState["LCveUsuarioCCP"] = value; } } + public List LcveuserVisto { get { if (ViewState["LcveuserVisto"] == null) { ViewState["LcveuserVisto"] = new List(); } return (List)ViewState["LcveuserVisto"]; } set { ViewState["LcveuserVisto"] = value; } } + + #endregion + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (Request["CveEvento"] != null) + { + RCveEvento = Request["CveEvento"].ToString().ToEntero(); + } + if(RCveEvento > 0) + { + loadEvento(); + } + + DdlPara.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("Estatus =1 ", "Rol ASC"); ; + DdlPara.DataBind(); + + DdlTema.DataSource = get_GlobalDTOIRevision(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("CveUsuario = {0}", UsuarioActual.CveUsuario)); + DdlTema.DataBind(); + DdlTema.Items.Insert(0, new ListItem("Seleccione", "-1")); + } + + } + public void loadEvento() + { + string separator = ""; + StringBuilder str = new StringBuilder(); + str.AppendLine("datosGant=["); + using (ClsOIEventos oieve = new ClsOIEventos()) + { + if (oieve.GetTareaConHijos(RCveEvento,UsuarioActual.CveEmpresa)) + { + foreach (System.Data.DataRow dr in oieve.DtResultados.Select("Nivel > 0")) + { + str.AppendLine(string.Format("{0}{{id: {1}, text: \"{2}\", start_date: \"{3:yyyy/MM/dd}\", end_date: \"{4:yyyy/MM/dd}\", parent: {5}, progress:{6}, open: true }}", + separator,dr["CveEvento"], dr["Asunto"].ToString().Replace("\\", "\\\\").Replace("\"", "\\\""), dr["FechaInicio"], dr["FechaFin"], (dr["Nivel"].ToString().ToEntero()<=1?0: dr["CveEventoPadre"].ToString().ToEntero()), dr["Avance"].ToString().ToDecimal()/100)); + separator = ","; + + } + } + } + str.AppendLine("];loadGant();"); + this.RegistraScript(str.ToString()); + UpContenido.Update(); + //{ id: 2, text: "Direccion: evaluación de mercado", start_date: "2020/04/29 00:00", end_date: "2020/05/02 00:00",/*duration: 3,*/ parent: 1, progress: 0.25 } + } + + protected void LnkNewProyecto_Click(object sender, EventArgs e) + { + this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarProyecto)); + RCveEventoB = RCveEvento; + } + + protected void btnguardarProyecto_Click(object sender, EventArgs e) + { + string errorMessage = ""; + + int cveUsuarioDe = UsuarioActual.CveUsuario; + List listaCCP = new List(); + int cveUsuarioPara = DdlPara.SelectedValue.ToEntero(); + + OITipoEventos cveTipoEvento = OITipoEventos.Proyecto; + string asunto = TxtAsunto.Text; + string descripcion = TxtDescripcion.Text; + int prioridad = DdlPrioridad.SelectedValue.ToEntero(); + string fechaInicio = ""; + if (txtFechaI.Text.ToDateTimeExcat().Year <= 1999) + { + if (txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999) + { + errorMessage = "No se ingresó una fecha de inicio valida"; + + } + else + { + fechaInicio = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy/MM/dd HH:mm"); + } + } + else + { + fechaInicio = txtFechaI.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm"); + } + string fechaFin = ""; + if (txtFechaF.Text.ToDateTimeExcat().Year <= 1999) + { + if (txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999) + { + errorMessage = "No se ingresó una fecha fin valida"; + + } + else + { + fechaFin = string.Format("{0:yyyy/MM/dd} 23:59", txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy")); + } + } + else + { + fechaFin = txtFechaF.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm"); + } + int cveRevision = DdlTema.SelectedValue.ToEntero(); + string archivoname = ""; + string rutaarchivoOri = ""; + //string ArchivoExtencion = ""; + //foreach (Archivo item in TxtArchivo.getfiles().Archivos) + //{ + // archivoname = item.filenameO; + // ArchivoExtencion = string.Format("{0}{1}", (item.Extencion.Length > 0 ? "." : ""), item.Extencion); + // rutaarchivoOri = string.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, item.patch, item.filename); + //} + + + int cveUsuarioIng = UsuarioActual.CveUsuario; + int cveEmpresa = UsuarioActual.CveEmpresa; + bool Continuar = false; + int Folio = -1; + int CveEvento = -1; + + if (cveUsuarioDe <= 0) + { + errorMessage = "No se selecciono el miembro 'C C Para'"; + } + + if (cveUsuarioPara <= 0) + { + errorMessage = "No se selecciono el miembro 'Para'"; + + } + if (errorMessage.Length == 0) + { + + List chkList = new List(); + + using (ClsOIEventos objOI = new ClsOIEventos()) + { + objOI.IniciaTransacSQL(); + Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, RCveEventoB); + + CveEvento = objOI.CveEvento; + Folio = objOI.Folio; + if (CveEvento == 0) + { + Continuar = false; + } + if (Continuar) + { + objOI.Commit(); + //ObjEventosCorreo o = objOI.objCorreo; + //string mailbody = MailgetBodyNuevatarea(o.Folio, o.Link, o.Asunto, o.Descripcion, o.Fechai, o.Fechaf, o.Prioridad, o.Tema); + //EnviarCorreo(UsuarioActual.Empresa, o.AsuntoCorreo, mailbody, o.mailPara, ""); + } + else + { + objOI.RollBack(); + Continuar = false; + } + } + if (Continuar && CveEvento > 0) + { + if (rutaarchivoOri.Length > 0) + { + string ruta = string.Format("{0}OIFiles\\", UsuarioActual.Empresa.Ruta); + if (!System.IO.Directory.Exists(ruta)) + { + System.IO.Directory.CreateDirectory(ruta); + } + ruta = string.Format("{0}{1}\\", ruta, Folio); + if (!System.IO.Directory.Exists(ruta)) + { + System.IO.Directory.CreateDirectory(ruta); + } + ruta = string.Format("{0}{1}", ruta, archivoname);//, ArchivoExtencion); + System.IO.File.Move(rutaarchivoOri, ruta); + } + //this.Alert("Se ha agregadó la nueva tarea", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("location.replace(\"/OI/Proyecto.aspx?CveEvento={0}\");", CveEvento)); + loadEvento(); + TxtAsunto.Text = ""; + TxtDescripcion.Text = ""; + txtFechaF.Text = ""; + txtFechaI.Text = ""; + } + } + + } + + +} \ No newline at end of file diff --git a/OI/RepMinutas.aspx.vb b/OI/RepMinutas.aspx.vb index 291199234..c63326e75 100644 --- a/OI/RepMinutas.aspx.vb +++ b/OI/RepMinutas.aspx.vb @@ -51,9 +51,9 @@ Partial Class OI_RepMinutas 'e.Row.Cells(1).Width = Unit.Pixel(200) 'Asunto 'e.Row.Cells(2).Width = Unit.Pixel(550) 'Descripcion 'e.Row.Cells(3).Width = Unit.Pixel(70) 'TareasTotal - - e.Row.FCLiteral("LtlFechaInicio").Text = String.Format("{1}", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("FechaInicio").ToDateTime.ToString("dd/MM/yyyy")) - e.Row.FCLiteral("LtlAsunto").Text = String.Format("{1}", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("Asunto")) + + e.Row.FCLiteral("LtlFechaInicio").Text = String.Format("{1}", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("FechaInicio").ToDateTime.ToString("dd/MM/yyyy")) + e.Row.FCLiteral("LtlAsunto").Text = String.Format("{1}", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("Asunto")) End If End Sub diff --git a/OI/RepProyectos.aspx b/OI/RepProyectos.aspx new file mode 100644 index 000000000..05fe28076 --- /dev/null +++ b/OI/RepProyectos.aspx @@ -0,0 +1,239 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepProyectos.aspx.cs" Inherits="OI_RepProyectos" %> + + + + + + + + Proyectos + + + + + + + +
  • + Agregar Proyecto +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + <%# string.Format("
    {1}
    ",Eval("Avance"),Eval("Avance","%{0:##0.##}") , + (Convert.ToDecimal(Eval("Avance").ToString())>70? "green-sharp":(Convert.ToDecimal(Eval("Avance").ToString())>35?"yellow-saffron":"red-haze"))) + %> +
    + <%--yellow-saffron--%> + <%--green-sharp--%> + <%--red-haze--%> + <%-- --%> +
    +
    +
    +
    + + +
    +
    +
    + + + + diff --git a/OI/RepProyectos.aspx.cs b/OI/RepProyectos.aspx.cs new file mode 100644 index 000000000..4cb9cc150 --- /dev/null +++ b/OI/RepProyectos.aspx.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; + +public partial class OI_RepProyectos : ClsPaginas +{ + #region Propiedades + public const string iddivAgregarProyecto = "iddivAgregarProyecto"; + #endregion + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + DdlPara.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("Estatus =1 ", "Rol ASC"); ; + DdlPara.DataBind(); + + DdlTema.DataSource = get_GlobalDTOIRevision(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("CveUsuario = {0}", UsuarioActual.CveUsuario)); + DdlTema.DataBind(); + DdlTema.Items.Insert(0, new ListItem("Seleccione", "-1")); + cargar(); + } + } + + public void cargar() + { + + using (ClsOIEventos ObjOI_E = new ClsOIEventos()) + { + if (ObjOI_E.GetEventos2(-1, UsuarioActual.CveEmpresa, -1) && ObjOI_E.DtResultados.Rows.Count > 0) + { + System.Data.DataTable dt = ObjOI_E.DtResultados; + GvProyecto.DataSource = dt.FiltraParametros(string.Format("CveTipoEvento ={0} AND (CveUsuarioDe ={1} OR CveUsuarioPara={1} ) AND (CveEventoPadre IS NULL OR CveEventoPadre <= 0)", (int)OITipoEventos.Proyecto, UsuarioActual.CveUsuario)); + GvProyecto.DataBind(); + } + } + UpContenido.Update(); + } + protected void LnkNewProyecto_Click(object sender, EventArgs e) + { + this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarProyecto)); + } + + protected void btnguardarProyecto_Click(object sender, EventArgs e) + { + string errorMessage = ""; + + int cveUsuarioDe = UsuarioActual.CveUsuario; + List listaCCP = new List(); + int cveUsuarioPara = DdlPara.SelectedValue.ToEntero(); + + OITipoEventos cveTipoEvento = OITipoEventos.Proyecto; + string asunto = TxtAsunto.Text; + string descripcion = TxtDescripcion.Text; + int prioridad = DdlPrioridad.SelectedValue.ToEntero(); + string fechaInicio = ""; + if (txtFechaI.Text.ToDateTimeExcat().Year <= 1999) + { + if (txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999) + { + errorMessage = "No se ingresó una fecha de inicio valida"; + + } + else + { + fechaInicio = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy/MM/dd HH:mm"); + } + } + else + { + fechaInicio = txtFechaI.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm"); + } + string fechaFin = ""; + if (txtFechaF.Text.ToDateTimeExcat().Year <= 1999) + { + if (txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999) + { + errorMessage = "No se ingresó una fecha fin valida"; + + } + else + { + fechaFin = string.Format("{0:yyyy/MM/dd} 23:59", txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy")); + } + } + else + { + fechaFin = txtFechaF.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm"); + } + int cveRevision = DdlTema.SelectedValue.ToEntero(); + string archivoname = ""; + string rutaarchivoOri = ""; + //string ArchivoExtencion = ""; + //foreach (Archivo item in TxtArchivo.getfiles().Archivos) + //{ + // archivoname = item.filenameO; + // ArchivoExtencion = string.Format("{0}{1}", (item.Extencion.Length > 0 ? "." : ""), item.Extencion); + // rutaarchivoOri = string.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, item.patch, item.filename); + //} + + + int cveUsuarioIng = UsuarioActual.CveUsuario; + int cveEmpresa = UsuarioActual.CveEmpresa; + bool Continuar = false; + int Folio = -1; + int CveEvento = -1; + + if (cveUsuarioDe <= 0) + { + errorMessage = "No se selecciono el miembro 'C C Para'"; + } + + if (cveUsuarioPara <= 0) + { + errorMessage = "No se selecciono el miembro 'Para'"; + + } + if (errorMessage.Length == 0) + { + + List chkList = new List(); + + using (ClsOIEventos objOI = new ClsOIEventos()) + { + objOI.IniciaTransacSQL(); + Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa); + + CveEvento = objOI.CveEvento; + Folio = objOI.Folio; + if (CveEvento == 0) + { + Continuar = false; + } + if (Continuar) + { + objOI.Commit(); + //ObjEventosCorreo o = objOI.objCorreo; + //string mailbody = MailgetBodyNuevatarea(o.Folio, o.Link, o.Asunto, o.Descripcion, o.Fechai, o.Fechaf, o.Prioridad, o.Tema); + //EnviarCorreo(UsuarioActual.Empresa, o.AsuntoCorreo, mailbody, o.mailPara, ""); + } + else + { + objOI.RollBack(); + Continuar = false; + } + } + if (Continuar && CveEvento > 0) + { + if (rutaarchivoOri.Length > 0) + { + string ruta = string.Format("{0}OIFiles\\", UsuarioActual.Empresa.Ruta); + if (!System.IO.Directory.Exists(ruta)) + { + System.IO.Directory.CreateDirectory(ruta); + } + ruta = string.Format("{0}{1}\\", ruta, Folio); + if (!System.IO.Directory.Exists(ruta)) + { + System.IO.Directory.CreateDirectory(ruta); + } + ruta = string.Format("{0}{1}", ruta, archivoname);//, ArchivoExtencion); + System.IO.File.Move(rutaarchivoOri, ruta); + } + //this.Alert("Se ha agregadó la nueva tarea", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("location.replace(\"/OI/Proyecto.aspx?CveEvento={0}\");", CveEvento)); + this.Alert("Se ha agregadó la nueva tarea", ModExtensiones.TipoMensaje.MsgInformacion); + + cargar(); + TxtAsunto.Text = ""; + TxtDescripcion.Text = ""; + txtFechaF.Text = ""; + txtFechaI.Text = ""; + } + } + + } +} \ No newline at end of file diff --git a/OI/TareaDetalle.aspx.cs b/OI/TareaDetalle.aspx.cs index 1c39bf4ad..3ca09aee1 100644 --- a/OI/TareaDetalle.aspx.cs +++ b/OI/TareaDetalle.aspx.cs @@ -125,7 +125,7 @@ public partial class OI_TareaDetalle : ClsPaginas bool esPara = UsuarioActual.CveUsuario == CveUsuarioPara; Permisos = new OI_TareaDetalle_Permisos { - EntrarOI = (EsNuevo || esmiembro|| true), + EntrarOI = (EsNuevo || esmiembro), CheckList = (EsNuevo || esdeel || esPara), EdicionGeneral = (EsNuevo || esdeel), Bitacora = esmiembro, @@ -741,7 +741,7 @@ public partial class OI_TareaDetalle : ClsPaginas { int CveEstatus = DDlEstatus.SelectedValue.ToEntero(); - if ((Permisos.Estatus1_2_3 && CveEstatus.Contiene(new int[] { 1, 2, 3 })) || (Permisos.Estatus4_5 && CveEstatus.Contiene(new int[] { 45 }))) + if ((Permisos.Estatus1_2_3 && CveEstatus.Contiene(new int[] { 1, 2, 3 })) || (Permisos.Estatus4_5 && CveEstatus.Contiene(new int[] { 4,5 }))) { using (ClsOIEventos objOI = new ClsOIEventos()) {