igniteui-angular-spreadsheet
Version:
Ignite UI Angular spreadsheet component for displaying and editing Microsoft Excel workbooks for modern web apps.
502 lines (501 loc) • 17.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 { 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.
*/
export let SpreadsheetVisualData = /*@__PURE__*/ (() => {
class SpreadsheetVisualData extends SpreadsheetVisualDataBase {
constructor() {
super();
this._tabArea = null;
this._cellAreas = null;
this._rowHeaderAreas = null;
this._columnHeaderAreas = null;
this.cellAreas = new SpreadsheetCellAreaVisualDataList();
this.rowHeaderAreas = new SpreadsheetHeaderAreaVisualDataList();
this.columnHeaderAreas = new SpreadsheetHeaderAreaVisualDataList();
}
/**
* Returns or sets the visual data for the area in the spreadsheet that contains the sheet tab items
*/
get tabArea() {
return this._tabArea;
}
set tabArea(a) {
this._tabArea = a;
}
/**
* Returns or sets the visual data for the cell areas in the spreadsheet
*/
get cellAreas() {
return this._cellAreas;
}
set cellAreas(a) {
this._cellAreas = a;
}
/**
* Returns or sets the visual data for the row header areas in the spreadsheet
*/
get rowHeaderAreas() {
return this._rowHeaderAreas;
}
set rowHeaderAreas(a) {
this._rowHeaderAreas = a;
}
/**
* Returns or sets the visual data for the column header areas in the spreadsheet
*/
get columnHeaderAreas() {
return this._columnHeaderAreas;
}
set columnHeaderAreas(a) {
this._columnHeaderAreas = a;
}
/**
* Returns a string representation of the visual data
*/
serialize() {
let a = SpreadsheetVisualData._h(["cellAreas", "rowHeaderAreas", "columnHeaderAreas", "tabArea"], [this.cellAreas, this.rowHeaderAreas, this.columnHeaderAreas, this.tabArea]);
return a;
}
/**
* @hidden
*/
static _g(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
*/
static _f(a) {
let b = false;
let c = null;
for (let d of fromEn(a)) {
if (b) {
c.u(", ");
}
else {
c = new StringBuilder(0);
c.u("[");
b = true;
}
let e = SpreadsheetVisualData._g(d);
if (e == null) {
e = "null";
}
c.l(e);
}
if (c == null) {
return null;
}
c.u("]");
return c.toString();
}
/**
* @hidden
*/
static _h(a, b) {
let c = new StringBuilder(0);
let d = false;
c.u("{");
for (let e = 0; e < a.length; e++) {
let 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 {
let 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;
})();
/**
* Represents the visual data for a row or column header area within the spreadsheet
*/
export let SpreadsheetHeaderAreaVisualData = /*@__PURE__*/ (() => {
class SpreadsheetHeaderAreaVisualData extends SpreadsheetVisualDataBase {
constructor() {
super();
this._relativeBounds = null;
this._items = null;
this._shapes = null;
this.items = new SpreadsheetRowColumnVisualDataList();
this.shapes = new PrimitiveVisualDataList();
this.relativeBounds = RectData.empty;
}
/**
* The position of the area within the containing visual.
*/
get relativeBounds() {
return this._relativeBounds;
}
set relativeBounds(a) {
this._relativeBounds = a;
}
/**
* The visual information about the items in the header
*/
get items() {
return this._items;
}
set items(a) {
this._items = a;
}
/**
* The visual shape data of the header area.
*/
get shapes() {
return this._shapes;
}
set shapes(a) {
this._shapes = a;
}
/**
* Returns a string representation of the visual data
*/
serialize() {
return SpreadsheetVisualData._h(["relativeBounds", "items", "shapes"], [this.relativeBounds, this.items, SpreadsheetVisualData._f(this.shapes)]);
}
}
SpreadsheetHeaderAreaVisualData.$t = markType(SpreadsheetHeaderAreaVisualData, 'SpreadsheetHeaderAreaVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetHeaderAreaVisualData;
})();
/**
* Represents the visual data for a list of row or column header areas within the spreadsheet
*/
export let SpreadsheetHeaderAreaVisualDataList = /*@__PURE__*/ (() => {
class SpreadsheetHeaderAreaVisualDataList extends List$1 {
constructor() {
super(SpreadsheetHeaderAreaVisualData.$, 0);
}
}
SpreadsheetHeaderAreaVisualDataList.$t = markType(SpreadsheetHeaderAreaVisualDataList, 'SpreadsheetHeaderAreaVisualDataList', List$1.$.specialize(SpreadsheetHeaderAreaVisualData.$));
return SpreadsheetHeaderAreaVisualDataList;
})();
/**
* Represents the visual data for a cell area within the spreadsheet
*/
export let SpreadsheetCellAreaVisualData = /*@__PURE__*/ (() => {
class SpreadsheetCellAreaVisualData extends SpreadsheetVisualDataBase {
constructor() {
super();
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;
}
/**
* The position of the area within the containing visual.
*/
get relativeBounds() {
return this._relativeBounds;
}
set relativeBounds(a) {
this._relativeBounds = a;
}
/**
* The visual information about the columns for the cells
*/
get columns() {
return this._columns;
}
set columns(a) {
this._columns = a;
}
/**
* The visual information about the rows for the cells
*/
get rows() {
return this._rows;
}
set rows(a) {
this._rows = a;
}
/**
* The visual shape data of the header area.
*/
get shapes() {
return this._shapes;
}
set shapes(a) {
this._shapes = a;
}
/**
* Returns a string representation of the visual data
*/
serialize() {
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;
})();
/**
* Represents the visual data for a list of cell areas within the spreadsheet
*/
export let SpreadsheetCellAreaVisualDataList = /*@__PURE__*/ (() => {
class SpreadsheetCellAreaVisualDataList extends List$1 {
constructor() {
super(SpreadsheetCellAreaVisualData.$, 0);
}
}
SpreadsheetCellAreaVisualDataList.$t = markType(SpreadsheetCellAreaVisualDataList, 'SpreadsheetCellAreaVisualDataList', List$1.$.specialize(SpreadsheetCellAreaVisualData.$));
return SpreadsheetCellAreaVisualDataList;
})();
/**
* Represents the visual data for a row or column within the spreadsheet
*/
export let SpreadsheetRowColumnVisualData = /*@__PURE__*/ (() => {
class SpreadsheetRowColumnVisualData extends SpreadsheetVisualDataBase {
constructor() {
super(...arguments);
this._index = 0;
this._offset = 0;
this._extent = 0;
}
/**
* The index of the associated row or column.
*/
get index() {
return this._index;
}
set index(a) {
this._index = a;
}
/**
* The start offset of the row or column within the containing visual.
*/
get offset() {
return this._offset;
}
set offset(a) {
this._offset = a;
}
/**
* The extent of the row or column within the containing visual.
*/
get extent() {
return this._extent;
}
set extent(a) {
this._extent = a;
}
/**
* Returns a string representation of the visual data
*/
serialize() {
return SpreadsheetVisualData._h(["index", "offset", "extent"], [this.index, this.offset, this.extent]);
}
}
SpreadsheetRowColumnVisualData.$t = markType(SpreadsheetRowColumnVisualData, 'SpreadsheetRowColumnVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetRowColumnVisualData;
})();
/**
* Represents the visual data for a list of row or column headers within the spreadsheet
*/
export let SpreadsheetRowColumnVisualDataList = /*@__PURE__*/ (() => {
class SpreadsheetRowColumnVisualDataList extends List$1 {
constructor() {
super(SpreadsheetRowColumnVisualData.$, 0);
}
}
SpreadsheetRowColumnVisualDataList.$t = markType(SpreadsheetRowColumnVisualDataList, 'SpreadsheetRowColumnVisualDataList', List$1.$.specialize(SpreadsheetRowColumnVisualData.$));
return SpreadsheetRowColumnVisualDataList;
})();
/**
* Represents the visual data for the area containing the sheet tabs
*/
export let SpreadsheetTabItemAreaVisualData = /*@__PURE__*/ (() => {
class SpreadsheetTabItemAreaVisualData extends SpreadsheetVisualDataBase {
constructor() {
super();
this._relativeBounds = null;
this._tabs = null;
this.tabs = new SpreadsheetTabVisualDataList();
this.relativeBounds = RectData.empty;
}
/**
* The position of the area within the containing visual.
*/
get relativeBounds() {
return this._relativeBounds;
}
set relativeBounds(a) {
this._relativeBounds = a;
}
/**
* The visual information about the sheet tab items
*/
get tabs() {
return this._tabs;
}
set tabs(a) {
this._tabs = a;
}
/**
* Returns a string representation of the visual data
*/
serialize() {
return SpreadsheetVisualData._h(["relativeBounds", "tabs"], [this.relativeBounds, this.tabs]);
}
}
SpreadsheetTabItemAreaVisualData.$t = markType(SpreadsheetTabItemAreaVisualData, 'SpreadsheetTabItemAreaVisualData', SpreadsheetVisualDataBase.$);
return SpreadsheetTabItemAreaVisualData;
})();
/**
* Represents the visual data for a sheet tab within the spreadsheet
*/
export let SpreadsheetTabVisualData = /*@__PURE__*/ (() => {
class SpreadsheetTabVisualData extends SpreadsheetVisualDataBase {
constructor() {
super(...arguments);
this._sheetIndex = 0;
this._color = null;
this._isActive = false;
this._isEditing = false;
this._isProtected = false;
this._isSelected = false;
this._relativeBounds = null;
}
/**
* The index of the associated Sheet.
*/
get sheetIndex() {
return this._sheetIndex;
}
set sheetIndex(a) {
this._sheetIndex = a;
}
/**
* The color associated with the sheet.
*/
get color() {
return this._color;
}
set color(a) {
this._color = a;
}
/**
* If the sheet is active
*/
get isActive() {
return this._isActive;
}
set isActive(a) {
this._isActive = a;
}
/**
* If the sheet is in edit mode
*/
get isEditing() {
return this._isEditing;
}
set isEditing(a) {
this._isEditing = a;
}
/**
* If the sheet is protected
*/
get isProtected() {
return this._isProtected;
}
set isProtected(a) {
this._isProtected = a;
}
/**
* If the sheet is selected
*/
get isSelected() {
return this._isSelected;
}
set isSelected(a) {
this._isSelected = a;
}
/**
* The position of the tab relative to the tab area.
*/
get relativeBounds() {
return this._relativeBounds;
}
set relativeBounds(a) {
this._relativeBounds = a;
}
/**
* Returns a string representation of the visual data
*/
serialize() {
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;
})();
/**
* Represents the visual data for a list of sheet tabs within the spreadsheet
*/
export let SpreadsheetTabVisualDataList = /*@__PURE__*/ (() => {
class SpreadsheetTabVisualDataList extends List$1 {
constructor() {
super(SpreadsheetTabVisualData.$, 0);
}
}
SpreadsheetTabVisualDataList.$t = markType(SpreadsheetTabVisualDataList, 'SpreadsheetTabVisualDataList', List$1.$.specialize(SpreadsheetTabVisualData.$));
return SpreadsheetTabVisualDataList;
})();