igniteui-angular-spreadsheet
Version:
Ignite UI Angular spreadsheet component for displaying and editing Microsoft Excel workbooks for modern web apps.
618 lines (617 loc) • 22.8 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends, __values } from "tslib";
import { SpreadsheetVisualDataBase } from "./SpreadsheetVisualDataBase";
import { IConvertible_$type, IEnumerable_$type, IEnumerable$1_$type, typeCast, Date_$type, fromEn, markType } from "igniteui-angular-core";
import { CultureInfo } from "igniteui-angular-core";
import { IVisualData_$type } from "igniteui-angular-core";
import { StringBuilder } from "igniteui-angular-core";
import { AppearanceHelper } from "igniteui-angular-core";
import { stringReplace } from "igniteui-angular-core";
import { ConvertUtil } from "igniteui-angular-core";
import { RectData } from "igniteui-angular-core";
import { PrimitiveVisualDataList } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
/**
* Represents the visual data for the spreadsheet.
*/
var SpreadsheetVisualData = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetVisualData, _super);
function SpreadsheetVisualData() {
var _this = _super.call(this) || this;
_this._tabArea = null;
_this._cellAreas = null;
_this._rowHeaderAreas = null;
_this._columnHeaderAreas = null;
_this.cellAreas = new SpreadsheetCellAreaVisualDataList();
_this.rowHeaderAreas = new SpreadsheetHeaderAreaVisualDataList();
_this.columnHeaderAreas = new SpreadsheetHeaderAreaVisualDataList();
return _this;
}
Object.defineProperty(SpreadsheetVisualData.prototype, "tabArea", {
/**
* Returns or sets the visual data for the area in the spreadsheet that contains the sheet tab items
*/
get: function () {
return this._tabArea;
},
set: function (a) {
this._tabArea = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetVisualData.prototype, "cellAreas", {
/**
* Returns or sets the visual data for the cell areas in the spreadsheet
*/
get: function () {
return this._cellAreas;
},
set: function (a) {
this._cellAreas = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetVisualData.prototype, "rowHeaderAreas", {
/**
* Returns or sets the visual data for the row header areas in the spreadsheet
*/
get: function () {
return this._rowHeaderAreas;
},
set: function (a) {
this._rowHeaderAreas = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetVisualData.prototype, "columnHeaderAreas", {
/**
* Returns or sets the visual data for the column header areas in the spreadsheet
*/
get: function () {
return this._columnHeaderAreas;
},
set: function (a) {
this._columnHeaderAreas = a;
},
enumerable: false,
configurable: true
});
/**
* Returns a string representation of the visual data
*/
SpreadsheetVisualData.prototype.serialize = function () {
var a = SpreadsheetVisualData._h(["cellAreas", "rowHeaderAreas", "columnHeaderAreas", "tabArea"], [this.cellAreas, this.rowHeaderAreas, this.columnHeaderAreas, this.tabArea]);
return a;
};
/**
* @hidden
*/
SpreadsheetVisualData._g = function (a) {
if (a == null) {
return null;
}
if (typeof a === 'string') {
return "\"" + stringReplace(a, "\"", "\\\"") + "\"";
}
if (typeCast(Date_$type, a) !== null) {
return (a.toJSON());
}
if (typeCast(IConvertible_$type, a) !== null) {
return ConvertUtil.toString1(a, CultureInfo.invariantCulture);
}
if (typeCast(IVisualData_$type, a) !== null) {
return a.serialize();
}
if (typeCast(SpreadsheetVisualDataBase.$, a) !== null) {
return a.serialize();
}
if (typeCast(IEnumerable_$type, a) !== null) {
return SpreadsheetVisualData._f(a);
}
return null;
};
/**
* @hidden
*/
SpreadsheetVisualData._f = function (a) {
var e_1, _a;
var b = false;
var c = null;
try {
for (var _b = __values(fromEn(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var d = _c.value;
if (b) {
c.u(", ");
}
else {
c = new StringBuilder(0);
c.u("[");
b = true;
}
var e = SpreadsheetVisualData._g(d);
if (e == null) {
e = "null";
}
c.l(e);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
if (c == null) {
return null;
}
c.u("]");
return c.toString();
};
/**
* @hidden
*/
SpreadsheetVisualData._h = function (a, b) {
var c = new StringBuilder(0);
var d = false;
c.u("{");
for (var e = 0; e < a.length; e++) {
var f = b[e];
if (f == null) {
continue;
}
if (typeCast(IEnumerable$1_$type.specialize(IVisualData_$type), f) !== null) {
d = AppearanceHelper.serializeItems(c, a[e], f, !d) || d;
}
else {
var g = SpreadsheetVisualData._g(f);
if (g != null) {
if (d) {
c.u(", ");
}
c.l(a[e]);
c.l(": ");
c.l(g);
d = true;
}
}
}
c.u("}");
return c.toString();
};
SpreadsheetVisualData.$t = markType(SpreadsheetVisualData, 'SpreadsheetVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetVisualData;
}(SpreadsheetVisualDataBase));
export { SpreadsheetVisualData };
/**
* Represents the visual data for a row or column header area within the spreadsheet
*/
var SpreadsheetHeaderAreaVisualData = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetHeaderAreaVisualData, _super);
function SpreadsheetHeaderAreaVisualData() {
var _this = _super.call(this) || this;
_this._relativeBounds = null;
_this._items = null;
_this._shapes = null;
_this.items = new SpreadsheetRowColumnVisualDataList();
_this.shapes = new PrimitiveVisualDataList();
_this.relativeBounds = RectData.empty;
return _this;
}
Object.defineProperty(SpreadsheetHeaderAreaVisualData.prototype, "relativeBounds", {
/**
* The position of the area within the containing visual.
*/
get: function () {
return this._relativeBounds;
},
set: function (a) {
this._relativeBounds = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetHeaderAreaVisualData.prototype, "items", {
/**
* The visual information about the items in the header
*/
get: function () {
return this._items;
},
set: function (a) {
this._items = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetHeaderAreaVisualData.prototype, "shapes", {
/**
* The visual shape data of the header area.
*/
get: function () {
return this._shapes;
},
set: function (a) {
this._shapes = a;
},
enumerable: false,
configurable: true
});
/**
* Returns a string representation of the visual data
*/
SpreadsheetHeaderAreaVisualData.prototype.serialize = function () {
return SpreadsheetVisualData._h(["relativeBounds", "items", "shapes"], [this.relativeBounds, this.items, SpreadsheetVisualData._f(this.shapes)]);
};
SpreadsheetHeaderAreaVisualData.$t = markType(SpreadsheetHeaderAreaVisualData, 'SpreadsheetHeaderAreaVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetHeaderAreaVisualData;
}(SpreadsheetVisualDataBase));
export { SpreadsheetHeaderAreaVisualData };
/**
* Represents the visual data for a list of row or column header areas within the spreadsheet
*/
var SpreadsheetHeaderAreaVisualDataList = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetHeaderAreaVisualDataList, _super);
function SpreadsheetHeaderAreaVisualDataList() {
return _super.call(this, SpreadsheetHeaderAreaVisualData.$, 0) || this;
}
SpreadsheetHeaderAreaVisualDataList.$t = markType(SpreadsheetHeaderAreaVisualDataList, 'SpreadsheetHeaderAreaVisualDataList', List$1.$.specialize(SpreadsheetHeaderAreaVisualData.$));
return SpreadsheetHeaderAreaVisualDataList;
}(List$1));
export { SpreadsheetHeaderAreaVisualDataList };
/**
* Represents the visual data for a cell area within the spreadsheet
*/
var SpreadsheetCellAreaVisualData = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetCellAreaVisualData, _super);
function SpreadsheetCellAreaVisualData() {
var _this = _super.call(this) || this;
_this._relativeBounds = null;
_this._columns = null;
_this._rows = null;
_this._shapes = null;
_this.rows = new SpreadsheetRowColumnVisualDataList();
_this.columns = new SpreadsheetRowColumnVisualDataList();
_this.shapes = new PrimitiveVisualDataList();
_this.relativeBounds = RectData.empty;
return _this;
}
Object.defineProperty(SpreadsheetCellAreaVisualData.prototype, "relativeBounds", {
/**
* The position of the area within the containing visual.
*/
get: function () {
return this._relativeBounds;
},
set: function (a) {
this._relativeBounds = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetCellAreaVisualData.prototype, "columns", {
/**
* The visual information about the columns for the cells
*/
get: function () {
return this._columns;
},
set: function (a) {
this._columns = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetCellAreaVisualData.prototype, "rows", {
/**
* The visual information about the rows for the cells
*/
get: function () {
return this._rows;
},
set: function (a) {
this._rows = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetCellAreaVisualData.prototype, "shapes", {
/**
* The visual shape data of the header area.
*/
get: function () {
return this._shapes;
},
set: function (a) {
this._shapes = a;
},
enumerable: false,
configurable: true
});
/**
* Returns a string representation of the visual data
*/
SpreadsheetCellAreaVisualData.prototype.serialize = function () {
return SpreadsheetVisualData._h(["relativeBounds", "columns", "rows", "shapes"], [this.relativeBounds, this.columns, this.rows, SpreadsheetVisualData._f(this.shapes)]);
};
SpreadsheetCellAreaVisualData.$t = markType(SpreadsheetCellAreaVisualData, 'SpreadsheetCellAreaVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetCellAreaVisualData;
}(SpreadsheetVisualDataBase));
export { SpreadsheetCellAreaVisualData };
/**
* Represents the visual data for a list of cell areas within the spreadsheet
*/
var SpreadsheetCellAreaVisualDataList = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetCellAreaVisualDataList, _super);
function SpreadsheetCellAreaVisualDataList() {
return _super.call(this, SpreadsheetCellAreaVisualData.$, 0) || this;
}
SpreadsheetCellAreaVisualDataList.$t = markType(SpreadsheetCellAreaVisualDataList, 'SpreadsheetCellAreaVisualDataList', List$1.$.specialize(SpreadsheetCellAreaVisualData.$));
return SpreadsheetCellAreaVisualDataList;
}(List$1));
export { SpreadsheetCellAreaVisualDataList };
/**
* Represents the visual data for a row or column within the spreadsheet
*/
var SpreadsheetRowColumnVisualData = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetRowColumnVisualData, _super);
function SpreadsheetRowColumnVisualData() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._index = 0;
_this._offset = 0;
_this._extent = 0;
return _this;
}
Object.defineProperty(SpreadsheetRowColumnVisualData.prototype, "index", {
/**
* The index of the associated row or column.
*/
get: function () {
return this._index;
},
set: function (a) {
this._index = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetRowColumnVisualData.prototype, "offset", {
/**
* The start offset of the row or column within the containing visual.
*/
get: function () {
return this._offset;
},
set: function (a) {
this._offset = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetRowColumnVisualData.prototype, "extent", {
/**
* The extent of the row or column within the containing visual.
*/
get: function () {
return this._extent;
},
set: function (a) {
this._extent = a;
},
enumerable: false,
configurable: true
});
/**
* Returns a string representation of the visual data
*/
SpreadsheetRowColumnVisualData.prototype.serialize = function () {
return SpreadsheetVisualData._h(["index", "offset", "extent"], [this.index, this.offset, this.extent]);
};
SpreadsheetRowColumnVisualData.$t = markType(SpreadsheetRowColumnVisualData, 'SpreadsheetRowColumnVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetRowColumnVisualData;
}(SpreadsheetVisualDataBase));
export { SpreadsheetRowColumnVisualData };
/**
* Represents the visual data for a list of row or column headers within the spreadsheet
*/
var SpreadsheetRowColumnVisualDataList = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetRowColumnVisualDataList, _super);
function SpreadsheetRowColumnVisualDataList() {
return _super.call(this, SpreadsheetRowColumnVisualData.$, 0) || this;
}
SpreadsheetRowColumnVisualDataList.$t = markType(SpreadsheetRowColumnVisualDataList, 'SpreadsheetRowColumnVisualDataList', List$1.$.specialize(SpreadsheetRowColumnVisualData.$));
return SpreadsheetRowColumnVisualDataList;
}(List$1));
export { SpreadsheetRowColumnVisualDataList };
/**
* Represents the visual data for the area containing the sheet tabs
*/
var SpreadsheetTabItemAreaVisualData = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetTabItemAreaVisualData, _super);
function SpreadsheetTabItemAreaVisualData() {
var _this = _super.call(this) || this;
_this._relativeBounds = null;
_this._tabs = null;
_this.tabs = new SpreadsheetTabVisualDataList();
_this.relativeBounds = RectData.empty;
return _this;
}
Object.defineProperty(SpreadsheetTabItemAreaVisualData.prototype, "relativeBounds", {
/**
* The position of the area within the containing visual.
*/
get: function () {
return this._relativeBounds;
},
set: function (a) {
this._relativeBounds = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabItemAreaVisualData.prototype, "tabs", {
/**
* The visual information about the sheet tab items
*/
get: function () {
return this._tabs;
},
set: function (a) {
this._tabs = a;
},
enumerable: false,
configurable: true
});
/**
* Returns a string representation of the visual data
*/
SpreadsheetTabItemAreaVisualData.prototype.serialize = function () {
return SpreadsheetVisualData._h(["relativeBounds", "tabs"], [this.relativeBounds, this.tabs]);
};
SpreadsheetTabItemAreaVisualData.$t = markType(SpreadsheetTabItemAreaVisualData, 'SpreadsheetTabItemAreaVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetTabItemAreaVisualData;
}(SpreadsheetVisualDataBase));
export { SpreadsheetTabItemAreaVisualData };
/**
* Represents the visual data for a sheet tab within the spreadsheet
*/
var SpreadsheetTabVisualData = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetTabVisualData, _super);
function SpreadsheetTabVisualData() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._sheetIndex = 0;
_this._color = null;
_this._isActive = false;
_this._isEditing = false;
_this._isProtected = false;
_this._isSelected = false;
_this._relativeBounds = null;
return _this;
}
Object.defineProperty(SpreadsheetTabVisualData.prototype, "sheetIndex", {
/**
* The index of the associated Sheet.
*/
get: function () {
return this._sheetIndex;
},
set: function (a) {
this._sheetIndex = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabVisualData.prototype, "color", {
/**
* The color associated with the sheet.
*/
get: function () {
return this._color;
},
set: function (a) {
this._color = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabVisualData.prototype, "isActive", {
/**
* If the sheet is active
*/
get: function () {
return this._isActive;
},
set: function (a) {
this._isActive = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabVisualData.prototype, "isEditing", {
/**
* If the sheet is in edit mode
*/
get: function () {
return this._isEditing;
},
set: function (a) {
this._isEditing = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabVisualData.prototype, "isProtected", {
/**
* If the sheet is protected
*/
get: function () {
return this._isProtected;
},
set: function (a) {
this._isProtected = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabVisualData.prototype, "isSelected", {
/**
* If the sheet is selected
*/
get: function () {
return this._isSelected;
},
set: function (a) {
this._isSelected = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SpreadsheetTabVisualData.prototype, "relativeBounds", {
/**
* The position of the tab relative to the tab area.
*/
get: function () {
return this._relativeBounds;
},
set: function (a) {
this._relativeBounds = a;
},
enumerable: false,
configurable: true
});
/**
* Returns a string representation of the visual data
*/
SpreadsheetTabVisualData.prototype.serialize = function () {
return SpreadsheetVisualData._h(["relativeBounds", "sheetIndex", "color", "isActive", "isEditing", "isProtected", "isSelected"], [this.relativeBounds, this.sheetIndex, this.color, this.isActive, this.isEditing, this.isProtected, this.isSelected]);
};
SpreadsheetTabVisualData.$t = markType(SpreadsheetTabVisualData, 'SpreadsheetTabVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetTabVisualData;
}(SpreadsheetVisualDataBase));
export { SpreadsheetTabVisualData };
/**
* Represents the visual data for a list of sheet tabs within the spreadsheet
*/
var SpreadsheetTabVisualDataList = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SpreadsheetTabVisualDataList, _super);
function SpreadsheetTabVisualDataList() {
return _super.call(this, SpreadsheetTabVisualData.$, 0) || this;
}
SpreadsheetTabVisualDataList.$t = markType(SpreadsheetTabVisualDataList, 'SpreadsheetTabVisualDataList', List$1.$.specialize(SpreadsheetTabVisualData.$));
return SpreadsheetTabVisualDataList;
}(List$1));
export { SpreadsheetTabVisualDataList };