all files / workbook/actions/ data-validation.js

96.55% Statements 308/319
88.38% Branches 213/241
100% Functions 25/25
96.55% Lines 308/319
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   1052× 1052×   1049× 1049× 1049×   1052× 1052× 1052× 1052× 1052× 1052×   1049× 14× 14× 14× 14× 14× 14×     257× 257× 257× 257× 257× 257× 94× 94× 94× 94× 94×     163× 163×   257× 257× 94×   257× 257× 257× 257× 257× 257× 257× 257× 257× 257× 253× 253× 253× 253× 253×   253× 38× 38×     38× 47×   153× 153× 153× 153×             253× 3323×   268×       257× 257× 257× 257× 257× 59× 58× 58× 45×     45×   58× 58×       198× 22×   198× 72× 72×   72× 72× 72×       126×   198× 195×   198× 198× 198× 2480× 629×   2480× 21×       257× 1431× 241× 203× 203×         38× 38× 38× 22×   38× 38× 38×   38×     1393× 43845×   43845× 41403× 41403× 43× 10×   43× 43×     41403× 41403× 842× 841×   842×       2442× 2442× 2442× 2442× 2439× 2439×           257× 38× 38× 38× 17×     38×     79× 32×   79×   14×   14×   93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93×     93× 4233× 1739×           93× 93× 14× 479× 478× 328×   478×         79× 3755× 2891×   3755×     93× 98× 6069×   6069× 5624× 5624×   6069× 250209× 250209× 250209× 3203×     247006× 1031×           93× 45×     44×   45× 45× 45×     48× 48× 53× 53× 53× 53×       990× 990× 990× 73× 51×   22×   917× 461×   478× 478× 478× 478× 478× 478× 284× 284× 284×   284×   194× 22× 22× 22×     22× 22× 26× 26× 60× 26× 26×       22×     172× 172×     478× 1171× 1035× 1035× 1035×   1171×           478× 478× 89× 89× 89× 129× 129× 129×     129× 46×     83×     89×     478× 478× 478× 478× 478× 478× 478× 478× 598× 64× 26×       534× 456× 456× 456×     78× 78× 78×     572× 572× 5525× 229×   5296× 5296×           5296× 113751× 113751× 1042× 1042× 89×             302× 302× 302× 40× 40× 40× 40×   262×         302×   150978×        
define(["require", "exports", "../base/index", "../common/index", "../common/index", "../common/index", "../common/index", "../common/index", "../index", "../base/index", "@syncfusion/ej2-base"], function (require, exports, index_1, index_2, index_3, index_4, index_5, index_6, index_7, index_8, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var WorkbookDataValidation = (function () {
        function WorkbookDataValidation(parent) {
            this.parent = parent;
            this.addEventListener();
        }
        WorkbookDataValidation.prototype.destroy = function () {
            this.removeEventListener();
            this.highlightInvalidData = null;
            this.parent = null;
        };
        WorkbookDataValidation.prototype.addEventListener = function () {
            this.parent.on(index_2.cellValidation, this.updateValidationHandler, this);
            this.parent.on(index_2.addHighlight, this.addHighlightHandler, this);
            this.parent.on(index_3.removeHighlight, this.removeHighlightHandler, this);
            this.parent.on(index_5.beforeInsert, this.beforeInsertDeleteHandler, this);
            this.parent.on(index_5.beforeDelete, this.beforeInsertDeleteHandler, this);
            this.parent.on(index_7.refreshInsertDelete, this.beforeInsertDeleteHandler, this);
        };
        WorkbookDataValidation.prototype.removeEventListener = function () {
            if (!this.parent.isDestroyed) {
                this.parent.off(index_2.cellValidation, this.updateValidationHandler);
                this.parent.off(index_2.addHighlight, this.addHighlightHandler);
                this.parent.off(index_3.removeHighlight, this.removeHighlightHandler);
                this.parent.off(index_5.beforeInsert, this.beforeInsertDeleteHandler);
                this.parent.off(index_5.beforeDelete, this.beforeInsertDeleteHandler);
                this.parent.off(index_7.refreshInsertDelete, this.beforeInsertDeleteHandler);
            }
        };
        WorkbookDataValidation.prototype.updateValidationHandler = function (args) {
            var _this = this;
            var sheetName;
            var lastIndex = args.range.lastIndexOf('!');
            var sheet;
            var isActiveSheet;
            if (lastIndex > -1) {
                sheetName = args.range.substring(0, lastIndex);
                args.range = args.range.substring(lastIndex + 1);
                var sheetIdx = index_8.getSheetIndex(this.parent, sheetName);
                sheet = index_1.getSheet(this.parent, sheetIdx);
                isActiveSheet = sheetIdx === this.parent.activeSheetIndex;
            }
            else {
                sheet = this.parent.getActiveSheet();
                isActiveSheet = true;
            }
            var rangeInfo = this.getRangeWhenColumnSelected(args.range, sheet);
            if (sheetName) {
                args.range = sheetName + '!' + rangeInfo.range;
            }
            var indexes = index_2.getSwapRange(index_4.getRangeIndexes(rangeInfo.range));
            var column;
            var cell;
            var frozenRow;
            var uiRefresh;
            var viewport;
            var updateCellHighlightOnUI;
            var updateColHighlightOnUI;
            var options = { colIdx: indexes[1] };
            if (isActiveSheet) {
                frozenRow = this.parent.frozenRowCount(sheet);
                var frozenCol_1 = this.parent.frozenColCount(sheet);
                var parent_1 = this.parent;
                var viewOffset = parent_1.viewport || {};
                viewport = parent_1.scrollSettings && parent_1.scrollSettings.enableVirtualization ? [frozenRow + viewOffset.topIndex, frozenCol_1 +
                        viewOffset.leftIndex, viewOffset.bottomIndex, viewOffset.rightIndex] : [0, 0, sheet.rowCount - 1, sheet.colCount - 1];
                if (rangeInfo.isFullCol) {
                    var viewportRowIndexes_1 = [[viewport[0], viewport[2]]];
                    Iif (frozenRow) {
                        viewportRowIndexes_1.push([index_4.getRangeIndexes(sheet.topLeftCell)[0], frozenRow - 1]);
                    }
                    updateColHighlightOnUI = function (validation) {
                        if (validation.isHighlighted && ((options.colIdx >= viewport[1] && options.colIdx <= viewport[3]) ||
                            options.colIdx < frozenCol_1) && !index_7.isHiddenCol(sheet, options.colIdx)) {
                            viewportRowIndexes_1.forEach(function (indexes) {
                                for (options.rowIdx = indexes[0]; options.rowIdx <= indexes[1]; options.rowIdx++) {
                                    Eif (!index_1.isHiddenRow(sheet, options.rowIdx)) {
                                        options.cell = index_1.getCell(options.rowIdx, options.colIdx, sheet, false, true);
                                        options.validation = options.cell.validation ? options.cell.validation : validation;
                                        _this.parent.notify(index_2.updateHighlight, options);
                                    }
                                }
                            });
                        }
                    };
                }
                updateCellHighlightOnUI = function (validation) {
                    if (validation.isHighlighted && uiRefresh && ((options.colIdx >= viewport[1] && options.colIdx <= viewport[3]) ||
                        options.colIdx < frozenCol_1) && !index_7.isHiddenCol(sheet, options.colIdx)) {
                        _this.parent.notify(index_2.updateHighlight, options);
                    }
                };
            }
            var highlightObj;
            var isListType;
            var activeIdx;
            var updateFormula;
            if (args.isRemoveValidation) {
                if (isActiveSheet) {
                    activeIdx = index_4.getRangeIndexes(sheet.activeCell);
                    if (activeIdx[0] >= indexes[0] && activeIdx[1] >= indexes[1] && activeIdx[0] <= indexes[2] && activeIdx[1] <= indexes[3]) {
                        var validation = index_1.getCell(activeIdx[0], activeIdx[1], sheet, false, true).validation ||
                            (index_8.checkColumnValidation(sheet.columns[indexes[1]], activeIdx[0], activeIdx[1]) &&
                                sheet.columns[activeIdx[1]].validation);
                        isListType = validation && validation.type === 'List';
                    }
                    options.isRemoveValidation = true;
                    options.isRemoveHighlightedData = true;
                }
            }
            else {
                if (args.isAction && this.highlightInvalidData) {
                    highlightObj = { isHighlighted: this.highlightInvalidData };
                }
                if (args.rules.type === 'List') {
                    activeIdx = index_4.getRangeIndexes(sheet.activeCell);
                    isListType = isActiveSheet && activeIdx[0] >= indexes[0] && activeIdx[1] >= indexes[1] && activeIdx[0] <= indexes[2] &&
                        activeIdx[1] <= indexes[3];
                    Eif (args.rules.value1) {
                        args.rules.value1 = args.rules.value1.trim();
                        if (args.rules.value1[args.rules.value1.length - 1] === this.parent.listSeparator) {
                            args.rules.value1 = args.rules.value1.substring(0, args.rules.value1.length - 1);
                        }
                    }
                }
                else if (args.rules.type === 'Custom' && !ej2_base_1.isNullOrUndefined(args.rules.value2)) {
                    delete args.rules.value2;
                }
                if (isActiveSheet) {
                    options.removeOnValidData = true;
                }
                var isFormulaVal1_1 = index_3.checkIsFormula(args.rules.value1);
                var isFormulaVal2_1 = index_3.checkIsFormula(args.rules.value2);
                updateFormula = function (rowIdx) {
                    if (isFormulaVal1_1) {
                        options.validation.value1 = index_4.getUpdatedFormula([rowIdx, options.colIdx, rowIdx, options.colIdx], indexes, sheet, _this.parent, { formula: args.rules.value1 });
                    }
                    if (isFormulaVal2_1) {
                        options.validation.value2 = index_4.getUpdatedFormula([rowIdx, options.colIdx, rowIdx, options.colIdx], indexes, sheet, _this.parent, { formula: args.rules.value2 });
                    }
                };
            }
            for (options.colIdx; options.colIdx <= indexes[3]; options.colIdx++) {
                if (rangeInfo.isFullCol) {
                    if (args.isRemoveValidation) {
                        column = sheet.columns[options.colIdx];
                        if (column && column.validation) {
                            Eif (isActiveSheet) {
                                updateColHighlightOnUI(column.validation);
                            }
                            delete column.validation;
                        }
                    }
                    else {
                        options.validation = Object.assign({}, args.rules, highlightObj);
                        updateFormula(0);
                        if (!sheet.columns[options.colIdx]) {
                            sheet.columns[options.colIdx] = {};
                        }
                        sheet.columns[options.colIdx].validation = options.validation;
                        Eif (isActiveSheet) {
                            updateColHighlightOnUI(options.validation);
                        }
                        continue;
                    }
                }
                for (options.rowIdx = indexes[0]; options.rowIdx <= indexes[2]; options.rowIdx++) {
                    uiRefresh = isActiveSheet && ((options.rowIdx >= viewport[0] && options.rowIdx <= viewport[2]) ||
                        options.rowIdx < frozenRow) && !index_1.isHiddenRow(sheet, options.rowIdx);
                    if (args.isRemoveValidation) {
                        column = sheet.columns[options.colIdx];
                        if (column && column.validation) {
                            if (options.rowIdx === indexes[2]) {
                                column.validation.address = index_6.getSplittedAddressForColumn(column.validation.address, [indexes[0], options.colIdx, indexes[2], options.colIdx], options.colIdx);
                            }
                            Eif (isActiveSheet) {
                                updateCellHighlightOnUI(column.validation);
                            }
                        }
                        cell = index_1.getCell(options.rowIdx, options.colIdx, sheet);
                        if (cell && cell.validation && !index_5.updateCell(this.parent, sheet, { cell: { validation: {} }, rowIdx: options.rowIdx, colIdx: options.colIdx })) {
                            if (isActiveSheet) {
                                updateCellHighlightOnUI(cell.validation);
                            }
                            delete cell.validation;
                        }
                    }
                    else {
                        options.validation = Object.assign({}, args.rules, highlightObj);
                        updateFormula(options.rowIdx);
                        Eif (!index_5.updateCell(this.parent, sheet, { cell: { validation: options.validation }, rowIdx: options.rowIdx, colIdx: options.colIdx })) {
                            if (isActiveSheet) {
                                options.cell = index_1.getCell(options.rowIdx, options.colIdx, sheet);
                                updateCellHighlightOnUI(options.validation);
                            }
                        }
                    }
                }
            }
            if (isListType) {
                cell = index_1.getCell(activeIdx[0], activeIdx[1], sheet, false, true);
                var validation = cell.validation;
                if (!validation) {
                    validation = index_8.checkColumnValidation(sheet.columns[activeIdx[1]], activeIdx[0], activeIdx[1]) ?
                        sheet.columns[activeIdx[1]].validation : {};
                }
                this.parent.notify(index_5.addListValidationDropdown, { validation: validation, cell: cell, rowIdx: activeIdx[0], colIdx: activeIdx[1], isRefresh: true });
            }
        };
        WorkbookDataValidation.prototype.addHighlightHandler = function (args) {
            if (args.isAction) {
                this.highlightInvalidData = true;
            }
            this.invalidDataHandler(args.range);
        };
        WorkbookDataValidation.prototype.removeHighlightHandler = function (args) {
            if (args.isAction) {
                this.highlightInvalidData = null;
            }
            this.invalidDataHandler(args.range, true);
        };
        WorkbookDataValidation.prototype.invalidDataHandler = function (range, isRemoveHighlightedData) {
            var _this = this;
            var cell;
            var col;
            var rowIdx;
            var colIdx;
            var indexes;
            var uiRefresh;
            var isActiveSheet;
            var isFullRange;
            var lastColIdx;
            var row;
            var parent = this.parent;
            var sheet = this.parent.getActiveSheet();
            var frozenRow = this.parent.frozenRowCount(sheet);
            var frozenCol = this.parent.frozenColCount(sheet);
            var viewport = parent.scrollSettings && parent.scrollSettings.enableVirtualization ? (parent.viewport ?
                [frozenRow + parent.viewport.topIndex, frozenCol + parent.viewport.leftIndex, parent.viewport.bottomIndex,
                    parent.viewport.rightIndex] : []) : [0, 0, sheet.rowCount - 1, sheet.colCount - 1];
            var updateHighlightOnUI = function (validation, col) {
                if (uiRefresh && ((colIdx >= viewport[1] && colIdx <= viewport[3]) || colIdx < frozenCol) && !index_7.isHiddenCol(sheet, colIdx)) {
                    _this.parent.notify(index_2.updateHighlight, {
                        isRemoveHighlightedData: isRemoveHighlightedData, rowIdx: rowIdx, colIdx: colIdx, cell: cell,
                        validation: validation, removeOnValidData: true, col: col
                    });
                }
            };
            var updateHighlightProp;
            if (isRemoveHighlightedData) {
                updateHighlightProp = function (validation, updateHighlight) {
                    if (validation.isHighlighted) {
                        if (updateHighlight) {
                            delete validation.isHighlighted;
                        }
                        updateHighlightOnUI(validation);
                    }
                };
            }
            else {
                updateHighlightProp = function (validation, updateHighlight, col) {
                    if (updateHighlight) {
                        validation.isHighlighted = true;
                    }
                    updateHighlightOnUI(validation, col);
                };
            }
            var updateValidationHighlight = function () {
                for (rowIdx = indexes[0]; rowIdx <= indexes[2]; rowIdx++) {
                    uiRefresh = isActiveSheet && ((rowIdx >= viewport[0] && rowIdx <= viewport[2]) || rowIdx < frozenRow) &&
                        !index_1.isHiddenRow(sheet, rowIdx);
                    if (isFullRange) {
                        row = index_8.getRow(sheet, rowIdx);
                        lastColIdx = Math.max(row && row.cells ? row.cells.length - 1 : null, sheet.columns.length - 1, indexes[3]);
                    }
                    for (colIdx = indexes[1]; colIdx <= lastColIdx; colIdx++) {
                        cell = index_1.getCell(rowIdx, colIdx, sheet, false, true);
                        col = sheet.columns[colIdx];
                        if (cell.validation) {
                            updateHighlightProp(cell.validation, true, col);
                        }
                        else {
                            if (index_8.checkColumnValidation(col, rowIdx, colIdx)) {
                                updateHighlightProp(col.validation, rowIdx === indexes[2]);
                            }
                        }
                    }
                }
            };
            if (range) {
                if (range.includes('!')) {
                    var sheetIdx = index_3.getSheetIndexFromAddress(this.parent, range);
                    sheet = index_1.getSheet(this.parent, sheetIdx);
                    range = index_3.getRangeFromAddress(range);
                    isActiveSheet = sheetIdx === this.parent.activeSheetIndex;
                }
                else {
                    isActiveSheet = true;
                }
                indexes = index_2.getSwapRange(index_4.getRangeIndexes(this.getRangeWhenColumnSelected(index_2.getUpdatedRange(sheet, range), sheet).range));
                lastColIdx = indexes[3];
                updateValidationHighlight();
            }
            else {
                isFullRange = true;
                this.parent.sheets.forEach(function (model, sheetIdx) {
                    sheet = model;
                    indexes = [0, 0, Math.max(sheet.rows.length - 1, viewport[2]), Math.max(sheet.usedRange.colIndex, viewport[3])];
                    isActiveSheet = sheetIdx === _this.parent.activeSheetIndex;
                    updateValidationHighlight();
                });
            }
        };
        WorkbookDataValidation.prototype.beforeInsertDeleteHandler = function (args) {
            var _this = this;
            var isSheetAction;
            if (args.modelType === 'Sheet') {
                if (args.name !== index_7.refreshInsertDelete) {
                    return;
                }
                isSheetAction = true;
            }
            else if (args.name === index_7.refreshInsertDelete) {
                return;
            }
            var isInsert = args.name === index_5.beforeInsert;
            var eventArgs;
            var endIdx;
            var curSheet;
            var prevIdx;
            if (isInsert) {
                curSheet = index_1.getSheet(this.parent, args.activeSheetIndex);
                endIdx = args.index + (args.model.length - 1);
                eventArgs = { insertDeleteArgs: { startIndex: args.index, endIndex: endIdx, modelType: args.modelType, isInsert: true,
                        sheet: curSheet }, sheetIdx: args.activeSheetIndex };
                prevIdx = args.index - 1;
            }
            else if (isSheetAction) {
                var sheetNames = [];
                var sheetId = void 0;
                var formulaArgs = {
                    action: 'getSheetInfo', sheetInfo: []
                };
                this.parent.notify(index_7.workbookFormulaOperation, formulaArgs);
                for (var idx = args.startIndex; idx <= args.endIndex; idx++) {
                    sheetId = this.parent.sheets[idx].id;
                    for (var i = 0; i < formulaArgs.sheetInfo.length; i++) {
                        if (formulaArgs.sheetInfo[i].index === sheetId) {
                            sheetNames.push(formulaArgs.sheetInfo[i].sheet);
                            break;
                        }
                    }
                }
                eventArgs = { sheetNames: sheetNames };
            }
            else {
                curSheet = args.model;
                eventArgs = { insertDeleteArgs: { startIndex: args.start, modelType: args.modelType,
                        endIndex: args.end, sheet: curSheet }, sheetIdx: index_7.getSheetIndexFromId(this.parent, curSheet.id) };
            }
            var updateFormula = function (validation) {
                if (index_3.checkIsFormula(validation.value1) && (!eventArgs.otherSheet || validation.value1.includes(curSheet.name))) {
                    eventArgs.cell = { formula: validation.value1 };
                    _this.parent.notify(index_4.getUpdatedFormulaOnInsertDelete, eventArgs);
                    validation.value1 = eventArgs.cell.formula;
                }
                Iif (index_3.checkIsFormula(validation.value2) && (!eventArgs.otherSheet || validation.value2.includes(curSheet.name))) {
                    eventArgs.cell = { formula: validation.value2 };
                    _this.parent.notify(index_4.getUpdatedFormulaOnInsertDelete, eventArgs);
                    validation.value2 = eventArgs.cell.formula;
                }
            };
            var isColAction = args.modelType === 'Column';
            var updateValidationToInsertedModel = function (validation, isColUpdate) {
                Eif (validation) {
                    eventArgs.insertDeleteArgs.forceUpdate = true;
                    for (var insertIdx = args.index; insertIdx <= endIdx; insertIdx++) {
                        validation = ej2_base_1.extend({}, validation);
                        updateFormula(validation);
                        Iif (isColUpdate) {
                            index_7.setColumn(curSheet, insertIdx, { validation: validation });
                        }
                        else if (isColAction) {
                            index_1.setCell(rowIdx, insertIdx, curSheet, { validation: validation }, true);
                        }
                        else {
                            index_1.setCell(insertIdx, colIdx, curSheet, { validation: validation }, true);
                        }
                    }
                    delete eventArgs.insertDeleteArgs.forceUpdate;
                }
            };
            var cell;
            var column;
            var endRowCount;
            var endColCount;
            var rowIdx;
            var colIdx;
            var isInsertOnCurSheet;
            this.parent.sheets.forEach(function (sheet, sheetIdx) {
                if (isSheetAction) {
                    if (sheetIdx >= args.startIndex && sheetIdx <= args.endIndex) {
                        return;
                    }
                }
                else {
                    if (sheetIdx === eventArgs.sheetIdx) {
                        isInsertOnCurSheet = isInsert;
                        delete eventArgs.otherSheet;
                        delete eventArgs.formulaSheet;
                    }
                    else {
                        eventArgs.otherSheet = true;
                        eventArgs.formulaSheet = sheet;
                        isInsertOnCurSheet = false;
                    }
                }
                endRowCount = sheet.usedRange.rowIndex + 1;
                for (colIdx = 0, endColCount = sheet.usedRange.colIndex + 1; colIdx < endColCount; colIdx++) {
                    if (isInsertOnCurSheet && isColAction && colIdx >= args.index && colIdx <= endIdx) {
                        continue;
                    }
                    column = sheet.columns && sheet.columns[colIdx];
                    Iif (column && column.validation) {
                        updateFormula(column.validation);
                        if (isInsertOnCurSheet && isColAction && prevIdx === colIdx) {
                            updateValidationToInsertedModel(column.validation, true);
                        }
                    }
                    for (rowIdx = 0; rowIdx < endRowCount; rowIdx++) {
                        cell = index_1.getCell(rowIdx, colIdx, sheet, false, true);
                        if (cell.validation && (!isInsertOnCurSheet || isColAction || rowIdx < args.index || rowIdx > endIdx)) {
                            updateFormula(cell.validation);
                            if (isInsertOnCurSheet && prevIdx === (isColAction ? colIdx : rowIdx)) {
                                updateValidationToInsertedModel(cell.validation);
                            }
                        }
                    }
                }
            });
        };
        WorkbookDataValidation.prototype.getRangeWhenColumnSelected = function (range, sheet) {
            var isFullCol;
            var colNames = range.split(':');
            if (range.match(/\D/g) && !range.match(/[0-9]/g)) {
                colNames[0] += 1;
                colNames[1] += sheet.rowCount;
                range = colNames[0] + ':' + colNames[1];
                isFullCol = true;
            }
            else Iif (!range.match(/\D/g) && range.match(/[0-9]/g)) {
                colNames[0] = 'A' + colNames[0];
                colNames[1] = index_2.getCellAddress(0, sheet.colCount - 1).replace(/[0-9]/g, '') + colNames[1];
                range = colNames[0] + ':' + colNames[1];
            }
            return { range: range, isFullCol: isFullCol };
        };
        WorkbookDataValidation.prototype.getModuleName = function () {
            return 'workbookDataValidation';
        };
        return WorkbookDataValidation;
    }());
    exports.WorkbookDataValidation = WorkbookDataValidation;
});