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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 11932435× 11932435× 6918985× 19657× 19631× 26× 6899328× 5033107× 1× 1× 814057× 4192× 809865× 40× 814057× 8863× 805194× 1× 1× 1152× 1152× 1152× 1152× 17280× 17280× 15× 1152× 1× 1× 48× 48× 48× 48× 48× 48× 48× 343× 809× 809× 803× 48× 1× 1× 9882× 9882× 93× 93× 93× 91× 9882× 1× 1× 128× 1× 1× 4063× 4063× 138× 138× 138× 138× 267× 2566× 159× 159× 160× 160× 159× 1× 158× 158× 267× 138× 4063× 1370× 699× 1370× 49× 1321× 1370× 4063× 1550× 1017× 1017× 1550× 4063× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* istanbul ignore next */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; define(["require", "exports", "@syncfusion/ej2-base", "../common/index", "../common/index", "./index", "./sheet"], function (require, exports, ej2_base_1, index_1, index_2, index_3, sheet_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Cell = (function (_super) { __extends(Cell, _super); function Cell() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ ej2_base_1.Property('') ], Cell.prototype, "notes", void 0); __decorate([ ej2_base_1.Collection([], index_2.Image) ], Cell.prototype, "image", void 0); __decorate([ ej2_base_1.Collection([], index_1.Chart) ], Cell.prototype, "chart", void 0); __decorate([ ej2_base_1.Property('') ], Cell.prototype, "value", void 0); __decorate([ ej2_base_1.Property('') ], Cell.prototype, "formula", void 0); __decorate([ ej2_base_1.Property(0) ], Cell.prototype, "index", void 0); __decorate([ ej2_base_1.Property('General') ], Cell.prototype, "format", void 0); __decorate([ ej2_base_1.Complex({}, index_1.CellStyle) ], Cell.prototype, "style", void 0); __decorate([ ej2_base_1.Property('') ], Cell.prototype, "hyperlink", void 0); __decorate([ ej2_base_1.Property(false) ], Cell.prototype, "wrap", void 0); __decorate([ ej2_base_1.Property(true) ], Cell.prototype, "isLocked", void 0); __decorate([ ej2_base_1.Property('') ], Cell.prototype, "validation", void 0); __decorate([ ej2_base_1.Property(1) ], Cell.prototype, "colSpan", void 0); __decorate([ ej2_base_1.Property(1) ], Cell.prototype, "rowSpan", void 0); __decorate([ ej2_base_1.Property(false) ], Cell.prototype, "isReadOnly", void 0); return Cell; }(ej2_base_1.ChildProperty)); exports.Cell = Cell; function getCell(rowIndex, colIndex, sheet, isInitRow, returnEmptyObjIfNull) { var row = index_3.getRow(sheet, rowIndex); if (!row || !row.cells) { if (isInitRow) { if (!row) { sheet.rows[rowIndex] = { cells: [] }; } else { sheet.rows[rowIndex].cells = []; } } else { return returnEmptyObjIfNull ? {} : null; } } return sheet.rows[rowIndex].cells[colIndex] || (returnEmptyObjIfNull ? {} : null); } exports.getCell = getCell; function setCell(rowIndex, colIndex, sheet, cell, isExtend) { if (!sheet.rows[rowIndex]) { sheet.rows[rowIndex] = { cells: [] }; } else if (!sheet.rows[rowIndex].cells) { sheet.rows[rowIndex].cells = []; } if (isExtend && sheet.rows[rowIndex].cells[colIndex]) { ej2_base_1.extend(sheet.rows[rowIndex].cells[colIndex], cell, null, true); } else { sheet.rows[rowIndex].cells[colIndex] = cell; } } exports.setCell = setCell; function skipDefaultValue(style, defaultKey) { var defaultProps = { fontFamily: 'Calibri', verticalAlign: 'bottom', textIndent: '0pt', backgroundColor: '#ffffff', color: '#000000', textAlign: 'left', fontSize: '11pt', fontWeight: 'normal', fontStyle: 'normal', textDecoration: 'none', border: '', borderLeft: '', borderTop: '', borderRight: '', borderBottom: '' }; var changedProps = {}; var styleVal; Object.keys(defaultKey ? defaultProps : style).forEach(function (propName) { styleVal = style["" + propName]; if (styleVal !== defaultProps["" + propName]) { changedProps["" + propName] = styleVal; } }); return changedProps; } exports.skipDefaultValue = skipDefaultValue; function wrap(address, wrap, context, preventEvt, isPublic) { Iif (wrap === void 0) { wrap = true; } var addressInfo = context.getAddressInfo(address); var rng = addressInfo.indices; var sheet = sheet_1.getSheet(context, addressInfo.sheetIndex); var uiRefresh = addressInfo.sheetIndex === context.activeSheetIndex; var cancel = !preventEvt; for (var i = rng[0]; i <= rng[2]; i++) { for (var j = rng[1]; j <= rng[3]; j++) { cancel = index_2.updateCell(context, sheet, { cell: { wrap: wrap }, rowIdx: i, colIdx: j, preventEvt: preventEvt }); if (!cancel && uiRefresh) { context.notify(index_1.wrapEvent, { range: [i, j, i, j], wrap: wrap, sheet: sheet, initial: true, isPublic: isPublic }); } } } context.setProperties({ sheets: context.sheets }, true); } exports.wrap = wrap; function getColorCode(format) { var code; if (format.indexOf('[') > -1) { var colorValue = format.split('[')[1].split(']')[0]; var customColors = getCustomColors(); if (customColors.indexOf(colorValue) > -1) { code = colorValue; } } return code; } exports.getColorCode = getColorCode; function getCustomColors() { return ['Black', 'Blue', 'Cyan', 'Green', 'Magenta', 'Red', 'White', 'Yellow']; } exports.getCustomColors = getCustomColors; function isCustomDateTime(format, checkTime, option, checkBoth) { var isCustom; if (format.includes('"')) { var formatSection_1 = format.split(';'); var endStrIdx_1; var prevChar_1; formatSection_1.forEach(function (formatCode, index) { for (var idx = 0; idx < formatCode.length; idx++) { if (formatCode[idx] === '"' && formatCode[idx - 1] !== '\\') { endStrIdx_1 = idx; do { endStrIdx_1 = formatCode.indexOf('"', endStrIdx_1 + 1); prevChar_1 = formatCode[endStrIdx_1 - 1]; } while (prevChar_1 === '\\' || prevChar_1 === '_' || prevChar_1 === '*'); if (endStrIdx_1 === -1) { break; } formatCode = formatCode.substring(0, idx) + formatCode.substring(endStrIdx_1 + 1); idx--; } } formatSection_1[index] = formatCode; }); format = formatSection_1.join(';'); } if ((format.includes('d') || format.includes('y')) && !format.includes('#') && !getColorCode(format)) { if (option) { option.type = 'date'; } if (checkBoth && format.includes(' ') && format.split(' ').length === 2) { format = format.split(' ')[1]; } else { checkTime = false; } isCustom = true; } if (checkTime && (format.includes('h') || format.includes('m') || format.includes('s')) && !format.includes('#') && !getColorCode(format)) { if (option) { option.type = option.type || ''; option.type += 'time'; } isCustom = true; } return isCustom; } exports.isCustomDateTime = isCustomDateTime; }); |