all files / actions/ cell-edit.js

93.26% Statements 346/371
85.35% Branches 233/273
100% Functions 29/29
93.24% Lines 345/370
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518   841× 841× 841× 841×   841× 841× 841× 841× 841× 841×     185× 185× 185× 185× 185× 185×       185×       185×             182× 182× 182× 182× 182×   182×     182× 182× 181×     178× 178× 149×         182×             157× 157× 12×   157×         157× 157× 157× 157× 157× 157× 157×       157× 157× 157× 157× 157×                             157×   157× 28×   129× 21×   108× 20×   88× 30×   58×   50×   43×     39× 29×   10×                       157× 157× 157×   157× 131×     28× 28× 28×       21× 21× 21× 21× 21× 21×         20× 18× 18×     21× 21× 21× 21× 21× 21×   12× 12× 12×   12× 12×     10×     20× 20× 20× 20×       17× 17× 14×   17× 17× 17×           15×     17×   17× 16×       17× 17× 17×     20×   20× 20× 20× 20× 20× 20×   30× 30×       30×   30× 30× 30× 30× 30× 30×   66× 66× 66× 66× 66×       59×     59× 10× 10×     10×   59×   59× 59×   66× 66× 66× 66×                     10×           10×     40×       10×         29× 29×   29× 29× 29× 29× 29× 29× 29× 29× 29× 30×   28× 15× 15×   13×             29×                 17× 17× 17×   125×   839×        
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-treegrid", "@syncfusion/ej2-data"], function (require, exports, ej2_base_1, ej2_treegrid_1, ej2_data_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CellEdit = (function () {
        function CellEdit(ganttObj) {
            this.isCellEdit = false;
            this.isResourceCellEdited = false;
            this.parent = ganttObj;
            this.bindTreeGridProperties();
        }
        CellEdit.prototype.bindTreeGridProperties = function () {
            this.parent.treeGrid.editSettings.allowEditing = this.parent.editSettings.allowEditing;
            this.parent.treeGrid.editSettings.allowNextRowEdit = this.parent.editSettings.allowNextRowEdit;
            this.parent.treeGrid.editSettings.mode = 'Cell';
            this.parent.treeGrid.cellEdit = this.ensureEditCell.bind(this);
            Eif (this.parent.editSettings.allowEditing) {
                ej2_treegrid_1.TreeGrid.Inject(ej2_treegrid_1.Edit);
            }
        };
        CellEdit.prototype.ensureEditCell = function (args) {
            var _this = this;
            var data = args.rowData;
            var field = args.columnName;
            this.editedColumn = this.parent.getColumnByField(field, this.parent.ganttColumns);
            var taskSettings = this.parent.taskFields;
            Iif (this.parent.readOnly) {
                args.cancel = true;
                return;
            }
            Iif (this.parent.editSettings.mode === 'Dialog') {
                args.cancel = true;
                return;
            }
            if (data.hasChildRecords && !this.parent.allowParentDependency && ((field === taskSettings.endDate && ((!ej2_base_1.isNullOrUndefined(data['isManual']) &&
                data['isManual'] === false) || this.parent.taskMode === 'Auto')) || field === taskSettings.duration
                || field === taskSettings.dependency || field === taskSettings.progress || field === taskSettings.work ||
                field === taskSettings.type || field === 'taskType')) {
                Eif ((field === taskSettings.dependency && !this.parent.allowParentDependency) || field !== taskSettings.dependency) {
                    args.cancel = true;
                }
            }
            else {
                var callBackPromise_1 = new ej2_data_1.Deferred();
                var parentReference_1 = this.parent;
                this.currentEditedRowData = args.rowData;
                this.parent.trigger('cellEdit', args, function (arg) {
                    if (arg.columnName === parentReference_1.taskFields.progress && arg.rowData.hasChildRecords) {
                        arg.cancel = true;
                    }
                    Iif (data.level === 0 && _this.parent.viewType === 'ResourceView') {
                        arg.cancel = true;
                    }
                    callBackPromise_1.resolve(arg);
                    if (!arg.cancel) {
                        if (arg.columnName === _this.parent.taskFields.notes) {
                            _this.openNotesEditor(arg);
                        }
                        else {
                            _this.isCellEdit = true;
                            if (!ej2_base_1.isNullOrUndefined(_this.parent.toolbarModule)) {
                                _this.parent.toolbarModule.refreshToolbarItems();
                            }
                        }
                    }
                });
                return callBackPromise_1;
            }
        };
        CellEdit.prototype.openNotesEditor = function (args) {
            var taskSettings = this.parent.taskFields;
            var data = args.rowData;
            var field = args.columnName;
            if ((field === taskSettings.notes && !this.parent.showInlineNotes)) {
                args.cancel = true;
                var columnTypes = this.parent.editModule.dialogModule.updatedEditFields.map(function (x) { return x.type; });
                var index = columnTypes.indexOf('Notes');
                Eif (index !== -1) {
                    this.parent.editModule.dialogModule.openEditDialog(data.ganttProperties.rowUniqueID);
                    var tabObj = document.getElementById(this.parent.element.id + '_Tab').ej2_instances[0];
                    tabObj.selectedItem = index;
                }
            }
            if (field === taskSettings.notes && this.parent.showInlineNotes === true) {
                this.isCellEdit = true;
            }
        };
        CellEdit.prototype.initiateCellEdit = function (args, editedObj) {
            var isValid = true;
            if (args['name'] === 'actionComplete' && args['previousData'] === args['data'][args['column'].field]) {
                isValid = false;
            }
            if (this.parent.undoRedoModule && this.parent['isUndoRedoItemPresent']('Edit')) {
                if (isValid) {
                    Iif (this.parent.undoRedoModule['redoEnabled']) {
                        this.parent.undoRedoModule['disableRedo']();
                    }
                    this.parent.undoRedoModule['createUndoCollection']();
                    var action = {};
                    action['action'] = 'CellEditing';
                    action['editedColumn'] = args['column'].field;
                    action['modifiedRecords'] = [];
                    this.parent.undoRedoModule['getUndoCollection'][this.parent.undoRedoModule['getUndoCollection'].length - 1] = action;
                }
            }
            var column = ej2_base_1.getValue('column', args);
            var data = ej2_base_1.getValue('data', args);
            var editedArgs = {};
            editedArgs.action = 'CellEditing';
            editedArgs.data = this.parent.getTaskByUniqueID(data.uniqueID);
            var previousValue = ej2_base_1.getValue('previousData', args);
            var editedValue = this.parent.allowUnscheduledTasks ? data[column.field] : ((ej2_base_1.isNullOrUndefined(data[column.field])
                || data[column.field] === '') && (this.parent.taskFields.duration === column.field ||
                this.parent.taskFields.startDate === column.field || this.parent.taskFields.endDate === column.field)) ? previousValue
                : data[column.field];
            Eif (!ej2_base_1.isNullOrUndefined(data)) {
                data[column.field] = previousValue;
                editedArgs.data[column.field] = previousValue;
                this.parent.initiateEditAction(true);
                Iif (this.parent.weekWorkingTime.length > 0 && editedValue && (column.field === this.parent.taskFields.startDate ||
                    column.field === this.parent.taskFields.baselineStartDate)) {
                    var sDate = column.field === this.parent.taskFields.startDate ? data.ganttProperties.startDate :
                        data.ganttProperties.baselineStartDate;
                    var prevDay = this.parent['getStartTime'](sDate);
                    if (prevDay / 3600 === sDate.getHours()) {
                        var dayStartTime = this.parent['getStartTime'](editedValue);
                        this.parent.dataOperation.setTime(dayStartTime, editedValue);
                        this.parent.setRecordValue(column.field, editedValue, editedArgs.data);
                    }
                    else {
                        this.parent.setRecordValue(column.field, editedValue, editedArgs.data);
                    }
                }
                else {
                    this.parent.setRecordValue(column.field, editedValue, editedArgs.data);
                }
                if (column.field === this.parent.taskFields.name) {
                    this.taskNameEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.startDate) {
                    this.startDateEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.endDate) {
                    this.endDateEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.duration) {
                    this.durationEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.resourceInfo) {
                    this.resourceEdited(editedArgs, editedObj, data);
                }
                else if (column.field === this.parent.taskFields.progress) {
                    this.progressEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.baselineStartDate
                    || column.field === this.parent.taskFields.baselineEndDate) {
                    this.baselineEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.dependency) {
                    this.dependencyEdited(editedArgs, previousValue);
                }
                else if (column.field === this.parent.taskFields.notes) {
                    this.notedEdited(editedArgs);
                }
                else if (column.field === this.parent.taskFields.work) {
                    this.workEdited(editedArgs);
                }
                else if ((column.field === this.parent.taskFields.type || column.field === 'taskType') &&
                    !ej2_base_1.isNullOrUndefined(this.parent.taskFields.work)) {
                    this.typeEdited(editedArgs, editedObj);
                }
                else if (column.field === this.parent.taskFields.manual) {
                    this.taskmodeEdited(editedArgs);
                }
                else {
                    this.parent.setRecordValue('taskData.' + column.field, editedArgs.data[column.field], editedArgs.data);
                    this.parent.editModule.initiateSaveAction(editedArgs);
                }
            }
            else {
                this.parent.editModule.endEditAction(args);
            }
            this.isCellEdit = false;
            Eif (!ej2_base_1.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn)) {
                this.parent.editModule.cellEditModule.editedColumn = null;
            }
            if (!ej2_base_1.isNullOrUndefined(this.parent.toolbarModule)) {
                this.parent.toolbarModule.refreshToolbarItems();
            }
        };
        CellEdit.prototype.taskNameEdited = function (args) {
            this.parent.setRecordValue('taskData.' + this.parent.taskFields.name, args.data[this.parent.taskFields.name], args.data);
            this.parent.setRecordValue('taskName', args.data[this.parent.taskFields.name], args.data.ganttProperties, true);
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.notedEdited = function (args) {
            this.parent.setRecordValue('taskData.' + this.parent.taskFields.notes, args.data[this.parent.taskFields.notes], args.data);
            this.parent.setRecordValue('notes', args.data[this.parent.taskFields.notes], args.data.ganttProperties, true);
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.taskmodeEdited = function (args) {
            this.parent.setRecordValue('isAutoSchedule', !args.data[this.parent.taskFields.manual], args.data.ganttProperties, true);
            this.parent.editModule.updateTaskScheduleModes(args.data);
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.startDateEdited = function (args) {
            var ganttData = args.data;
            var ganttProb = args.data.ganttProperties;
            var currentValue = args.data[this.parent.taskFields.startDate];
            currentValue = currentValue ? new Date(currentValue.getTime()) : null;
            currentValue = this.parent.dateValidationModule.checkStartDate(currentValue, ganttData.ganttProperties, ganttData.ganttProperties.isMilestone);
            if (ej2_base_1.isNullOrUndefined(currentValue)) {
                Eif (!ganttData.hasChildRecords) {
                    this.parent.setRecordValue('startDate', null, ganttProb, true);
                    Iif (!(ganttProb.startDate === null && ganttProb.endDate === null && ganttProb.duration !== null)) {
                        this.parent.setRecordValue('duration', null, ganttProb, true);
                    }
                    this.parent.setRecordValue('isMilestone', false, ganttProb, true);
                }
            }
            else if (ganttProb.endDate || !ej2_base_1.isNullOrUndefined(ganttProb.duration)) {
                this.parent.setRecordValue('startDate', new Date(currentValue.getTime()), ganttProb, true);
                this.parent.dateValidationModule.calculateEndDate(ganttData);
            }
            else Eif (ej2_base_1.isNullOrUndefined(ganttProb.endDate) && ej2_base_1.isNullOrUndefined(ganttProb.duration)) {
                this.parent.setRecordValue('startDate', new Date(currentValue.getTime()), ganttProb, true);
            }
            this.parent.setRecordValue('isMilestone', ganttProb.duration === 0 ? true : false, ganttProb, true);
            this.parent.dataOperation.updateWidthLeft(args.data);
            this.parent.dataOperation.updateMappingData(ganttData, 'startDate');
            this.parent.dataOperation.updateMappingData(ganttData, 'endDate');
            this.parent.dataOperation.updateMappingData(ganttData, 'duration');
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.validateEndDateWithSegments = function (ganttProp) {
            var ganttSegments = [];
            var segments = ganttProp.segments;
            for (var i = 0; i < segments.length; i++) {
                var segment = segments[parseInt(i.toString(), 10)];
                var endDate = segment.endDate;
                endDate = (!ej2_base_1.isNullOrUndefined(ganttProp.endDate)) && endDate.getTime() <
                    ganttProp.endDate.getTime() && i !== segments.length - 1 ? endDate : ganttProp.endDate;
                segment.duration = this.parent.dataOperation.getDuration(segment.startDate, endDate, ganttProp.durationUnit, ganttProp.isAutoSchedule, ganttProp.isMilestone);
                if (segments.length > 0 && endDate.getTime() < segment.startDate.getTime()
                    && endDate.getTime() <= ganttProp.endDate.getTime()) {
                    segments[i - 1].duration = this.parent.dataOperation.getDuration(segments[i - 1].startDate, ganttProp.endDate, ganttProp.durationUnit, ganttProp.isAutoSchedule, ganttProp.isMilestone);
                    continue;
                }
                ganttSegments.push(segment);
            }
            return ganttSegments;
        };
        CellEdit.prototype.endDateEdited = function (args) {
            var ganttProb = args.data.ganttProperties;
            var currentValue = args.data[this.parent.taskFields.endDate];
            currentValue = currentValue ? new Date(currentValue.getTime()) : null;
            if (ej2_base_1.isNullOrUndefined(currentValue)) {
                this.parent.setRecordValue('endDate', currentValue, ganttProb, true);
                Eif (!(ganttProb.startDate === null && ganttProb.endDate === null && ganttProb.duration !== null)) {
                    this.parent.setRecordValue('duration', null, ganttProb, true);
                }
                this.parent.setRecordValue('isMilestone', false, ganttProb, true);
            }
            else {
                var dayEndTime = this.parent['getCurrentDayEndTime'](currentValue);
                if ((currentValue.getHours() === 0 && dayEndTime !== 86400)) {
                    this.parent.dateValidationModule.setTime(dayEndTime, currentValue);
                }
                currentValue = this.parent.dateValidationModule.checkEndDate(currentValue, ganttProb, ganttProb.isMilestone);
                this.parent.setRecordValue('endDate', currentValue, ganttProb, true);
                if (!ej2_base_1.isNullOrUndefined(ganttProb.startDate) && ej2_base_1.isNullOrUndefined(ganttProb.duration)) {
                    Iif (this.parent.dateValidationModule.compareDates(ganttProb.endDate, ganttProb.startDate) === -1) {
                        this.parent.setRecordValue('endDate', new Date(ganttProb.startDate.getTime()), ganttProb, true);
                        dayEndTime = this.parent['getCurrentDayEndTime'](ganttProb.endDate);
                        this.parent.dateValidationModule.setTime(dayEndTime, ganttProb.endDate);
                    }
                }
                else Iif (!ej2_base_1.isNullOrUndefined(ganttProb.duration) && ej2_base_1.isNullOrUndefined(ganttProb.startDate)) {
                    this.parent.setRecordValue('startDate', this.parent.dateValidationModule.getStartDate(ganttProb.endDate, ganttProb.duration, ganttProb.durationUnit, ganttProb), ganttProb, true);
                }
                if (!ej2_base_1.isNullOrUndefined(ganttProb.segments)) {
                    ganttProb.segments = this.validateEndDateWithSegments(ganttProb);
                }
                if (this.compareDatesFromRecord(ganttProb) <= 0) {
                    this.parent.dateValidationModule.calculateDuration(args.data);
                }
                else {
                    this.parent.editModule.revertCellEdit(args);
                }
                this.updateDates(args);
                this.parent.setRecordValue('isMilestone', (ganttProb.duration === 0 ? true : false), ganttProb, true);
                if (ganttProb.isMilestone) {
                    this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(ganttProb.startDate, ganttProb), ganttProb, true);
                }
            }
            if (!ej2_base_1.isNullOrUndefined(args.data.ganttProperties.segments) && args.data.ganttProperties.segments.length > 0) {
                this.parent.setRecordValue('segments', this.parent.dataOperation.setSegmentsInfo(args.data, false), args.data.ganttProperties, true);
                this.parent.dataOperation.updateMappingData(args.data, 'segments');
            }
            this.parent.dataOperation.updateWidthLeft(args.data);
            this.parent.dataOperation.updateMappingData(args.data, 'startDate');
            this.parent.dataOperation.updateMappingData(args.data, 'endDate');
            this.parent.dataOperation.updateMappingData(args.data, 'duration');
            this.parent.editModule.updateResourceRelatedFields(args.data, 'endDate');
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.durationEdited = function (args) {
            var regex = /^[^\d.-]+$/;
            Iif (regex.test(args.data[this.parent.taskFields.duration])) {
                var err = "The provided value for the " + this.parent.taskFields.duration + " field is invalid. Please ensure the " + this.parent.taskFields.duration + " field contains only valid numeric values.";
                this.parent.trigger('actionFailure', { error: err });
            }
            if (parseInt(args.data[this.parent.taskFields.duration], 10) < 0) {
                args.data[this.parent.taskFields.duration] = 0;
            }
            var ganttProb = args.data.ganttProperties;
            var durationString = args.data[this.parent.taskFields.duration];
            this.parent.dataOperation.updateDurationValue(durationString, ganttProb);
            this.updateDates(args);
            this.parent.editModule.updateResourceRelatedFields(args.data, 'duration');
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.updateDates = function (args) {
            var ganttProb = args.data.ganttProperties;
            var endDate = this.parent.dateValidationModule.getDateFromFormat(ganttProb.endDate);
            var startDate = this.parent.dateValidationModule.getDateFromFormat(ganttProb.startDate);
            var currentDuration = ganttProb.duration;
            if (ej2_base_1.isNullOrUndefined(currentDuration)) {
                this.parent.setRecordValue('isMilestone', false, ganttProb, true);
                if (args.data[this.parent.taskFields.duration] !== null) {
                    this.parent.setRecordValue('endDate', null, ganttProb, true);
                }
            }
            else {
                Iif (ej2_base_1.isNullOrUndefined(startDate) && !ej2_base_1.isNullOrUndefined(endDate)) {
                    this.parent.setRecordValue('startDate', this.parent.dateValidationModule.getStartDate(endDate, currentDuration, ganttProb.durationUnit, ganttProb), ganttProb, true);
                }
                if (currentDuration !== 0 && ganttProb.isMilestone) {
                    this.parent.setRecordValue('isMilestone', false, ganttProb, true);
                    Iif (!ej2_base_1.isNullOrUndefined(this.parent.taskFields.milestone)) {
                        this.parent.setRecordValue(this.parent.taskFields.milestone, false, args.data, true);
                    }
                    this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(ganttProb.startDate, ganttProb), ganttProb, true);
                }
                if (!ej2_base_1.isNullOrUndefined(ganttProb.segments) && ganttProb.segments.length > 0) {
                    this.parent.setRecordValue('segments', this.parent.dataOperation.setSegmentsInfo(args.data, false), ganttProb, true);
                    this.parent.dataOperation.updateMappingData(args.data, 'segments');
                }
                this.parent.setRecordValue('isMilestone', (ganttProb.duration === 0 ? true : false), ganttProb, true);
                this.parent.dateValidationModule.calculateEndDate(args.data);
            }
            this.parent.dataOperation.updateWidthLeft(args.data);
            this.parent.dataOperation.updateMappingData(args.data, 'endDate');
            this.parent.dataOperation.updateMappingData(args.data, 'startDate');
            this.parent.dataOperation.updateMappingData(args.data, 'duration');
        };
        CellEdit.prototype.progressEdited = function (args) {
            var ganttRecord = args.data;
            this.parent.setRecordValue('progress', (ganttRecord[this.parent.taskFields.progress] > 100 ? 100 : ganttRecord[this.parent.taskFields.progress]), ganttRecord.ganttProperties, true);
            this.parent.setRecordValue('taskData.' + this.parent.taskFields.progress, (ganttRecord[this.parent.taskFields.progress] > 100 ? 100 : ganttRecord[this.parent.taskFields.progress]), args.data);
            if (!ganttRecord.ganttProperties.isAutoSchedule) {
                this.parent.setRecordValue('autoWidth', this.parent.dataOperation.calculateWidth(ganttRecord, false), ganttRecord.ganttProperties, true);
            }
            if (!ej2_base_1.isNullOrUndefined(args.data.ganttProperties.segments) && args.data.ganttProperties.segments.length > 0 &&
                !ej2_base_1.isNullOrUndefined(this.parent.editModule.taskbarEditModule)) {
                this.parent.editModule.taskbarEditModule.updateSegmentProgress(args.data.ganttProperties);
            }
            Eif (!args.data.hasChildRecords) {
                var width = ganttRecord.ganttProperties.isAutoSchedule ? ganttRecord.ganttProperties.width :
                    ganttRecord.ganttProperties.autoWidth;
                this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth(width, ganttRecord.ganttProperties.progress), ganttRecord.ganttProperties, true);
            }
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.baselineEdited = function (args) {
            var ganttRecord = args.data.ganttProperties;
            var baseLineStartDate = args.data[this.parent.taskFields.baselineStartDate];
            var baseLineEndDate = args.data[this.parent.taskFields.baselineEndDate];
            var dayEndTime = this.parent['getCurrentDayEndTime'](baseLineEndDate);
            if (baseLineEndDate && baseLineEndDate.getHours() === 0 && dayEndTime !== 86400) {
                this.parent.dateValidationModule.setTime(dayEndTime, baseLineEndDate);
            }
            this.parent.setRecordValue('baselineStartDate', this.parent.dateValidationModule.checkBaselineStartDate(baseLineStartDate, ganttRecord), ganttRecord, true);
            this.parent.setRecordValue('baselineEndDate', this.parent.dateValidationModule.checkBaselineEndDate(baseLineEndDate), ganttRecord, true);
            Eif (ganttRecord.baselineStartDate && ganttRecord.baselineEndDate) {
                this.parent.setRecordValue('baselineLeft', this.parent.dataOperation.calculateBaselineLeft(ganttRecord), ganttRecord, true);
                this.parent.setRecordValue('baselineWidth', this.parent.dataOperation.calculateBaselineWidth(ganttRecord), ganttRecord, true);
            }
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.resourceEdited = function (args, editedObj, previousData) {
            var resourceSettings = this.parent.resourceFields;
            var editedResourceId = editedObj[this.parent.taskFields.resourceInfo];
            Eif (editedResourceId) {
                this.isResourceCellEdited = true;
                var tempResourceInfo = this.parent.dataOperation.setResourceInfo(editedObj);
                var editedResouceLength = tempResourceInfo.length;
                var previousResource = previousData.ganttProperties.resourceInfo;
                var index = void 0;
                var editedResources = [];
                var resourceData = this.parent.resources;
                var newIndex = void 0;
                var _loop_1 = function (count) {
                    if (previousResource) {
                        var previousResourceLength = previousResource.length;
                        for (newIndex = 0; newIndex < previousResourceLength; newIndex++) {
                            if (previousResource[newIndex][resourceSettings.id] === editedResourceId[count]) {
                                index = newIndex;
                                break;
                            }
                            else {
                                index = -1;
                            }
                        }
                    }
                    if (!ej2_base_1.isNullOrUndefined(index) && index !== -1) {
                        editedResources.push(previousResource[parseInt(index.toString(), 10)]);
                    }
                    else {
                        var resource = resourceData.filter(function (resourceInfo) {
                            return (editedResourceId[count] === resourceInfo[resourceSettings.id]);
                        });
                        var ganttDataResource = ej2_base_1.extend({}, resource[0]);
                        ganttDataResource[resourceSettings.unit] = 100;
                        editedResources.push(ganttDataResource);
                    }
                };
                for (var count = 0; count < editedResouceLength; count++) {
                    _loop_1(count);
                }
                args.data.ganttProperties.resourceInfo = editedResources;
                this.parent.dataOperation.updateMappingData(args.data, 'resourceInfo');
                this.parent.editModule.updateResourceRelatedFields(args.data, 'resource');
                if (this.parent.viewType === 'ResourceView') {
                    this.parent.editModule.dialogModule.isResourceUpdate = true;
                    this.parent.editModule.dialogModule.previousResource = previousResource;
                }
                this.updateDates(args);
                this.updateEditedRecord(args);
            }
        };
        CellEdit.prototype.dependencyEdited = function (editedArgs, cellEditArgs) {
            var specialCharacterPattern = /[!@#$%^&*()_=[\]{};:<>|./?-]/;
            if (specialCharacterPattern.test(editedArgs.data[this.parent.taskFields.dependency])) {
                var err = "The provided value for the " + this.parent.taskFields.dependency + " field is invalid. Please ensure that the " + this.parent.taskFields.dependency + " field does not contain any special characters.";
                this.parent.trigger('actionFailure', { error: err });
            }
            this.parent.predecessorModule.updateUnscheduledDependency(editedArgs.data);
            var FF = this.parent.localeObj.getConstant('FF');
            var FS = this.parent.localeObj.getConstant('FS');
            var SS = this.parent.localeObj.getConstant('SS');
            var SF = this.parent.localeObj.getConstant('SF');
            var value = '';
            Eif (!ej2_base_1.isNullOrUndefined(editedArgs.data[this.parent.taskFields.dependency])) {
                var splitString_1 = editedArgs.data[this.parent.taskFields.dependency].split(',');
                splitString_1.map(function (splitvalue, index) {
                    if (splitvalue.includes(FF)) {
                        value += splitvalue.replace(FF, 'FF');
                        value += (splitString_1.length !== index + 1) ? ',' : '';
                    }
                    else if (splitvalue.includes(FS)) {
                        value += splitvalue.replace(FS, 'FS');
                        value += (splitString_1.length !== index + 1) ? ',' : '';
                    }
                    else if (splitvalue.includes(SS)) {
                        value += splitvalue.replace(SS, 'SS');
                        value += (splitString_1.length !== index + 1) ? ',' : '';
                    }
                    else if (splitvalue.includes(SF)) {
                        value += splitvalue.replace(SF, 'SF');
                        value += (splitString_1.length !== index + 1) ? ',' : '';
                    }
                    else {
                        value += splitvalue;
                        value += (splitString_1.length !== index + 1) ? ',' : '';
                    }
                });
            }
            if (!this.parent.connectorLineEditModule.updatePredecessor(editedArgs.data, value, editedArgs)) {
                this.parent.editModule.revertCellEdit(cellEditArgs);
            }
        };
        CellEdit.prototype.workEdited = function (editedArgs) {
            var ganttProb = editedArgs.data.ganttProperties;
            Iif (editedArgs.data[this.parent.taskFields.work] < 0) {
                editedArgs.data[this.parent.taskFields.work] = 0;
            }
            var workValue = editedArgs.data[this.parent.taskFields.work];
            this.parent.setRecordValue('work', workValue, ganttProb, true);
            this.parent.editModule.updateResourceRelatedFields(editedArgs.data, 'work');
            this.updateDates(editedArgs);
            this.updateEditedRecord(editedArgs);
        };
        CellEdit.prototype.typeEdited = function (args, editedObj) {
            var key = this.parent.taskFields.type || 'taskType';
            var ganttProb = args.data.ganttProperties;
            var taskType = editedObj["" + key];
            this.parent.setRecordValue('taskType', taskType, ganttProb, true);
            Iif (ganttProb.taskType === 'FixedDuration' && ganttProb.duration === 0) {
                this.parent.editModule.updateResourceRelatedFields(args.data, 'work');
            }
            this.updateEditedRecord(args);
        };
        CellEdit.prototype.compareDatesFromRecord = function (ganttRecord) {
            var sDate = this.parent.dateValidationModule.getValidStartDate(ganttRecord);
            var eDate = this.parent.dateValidationModule.getValidEndDate(ganttRecord);
            return this.parent.dateValidationModule.compareDates(sDate, eDate);
        };
        CellEdit.prototype.updateEditedRecord = function (args) {
            this.parent.editModule.initiateUpdateAction(args);
        };
        CellEdit.prototype.destroy = function () {
            this.parent.editModule.cellEditModule = undefined;
        };
        return CellEdit;
    }());
    exports.CellEdit = CellEdit;
});