UNPKG

reveal-sdk-node

Version:

RevealBI Node.js SDK

110 lines (109 loc) 3.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RVExcelDataSourceItem = void 0; const RVResourceBasedDataSourceItem_1 = require("../AbstractClasses/RVResourceBasedDataSourceItem"); const RVExcelRange_1 = require("./RVExcelRange"); const RVExcelDataSource_1 = require("./RVExcelDataSource"); const RVDataSourceItem_1 = require("../AbstractClasses/RVDataSourceItem"); /** * The data source item used to represent a dataset from an Excel file, it includes information like the * name of the sheet to get data from and the range to use when loading data. */ class RVExcelDataSourceItem extends RVResourceBasedDataSourceItem_1.RVResourceBasedDataSourceItem { /** @hidden */ constructor(arg) { super(new RVExcelDataSource_1.RVExcelDataSource(), arg); this._sheet = null; this._range = null; this._namedRange = null; this._pivotTable = null; this._firstRowContainsLabels = false; if (arg instanceof RVDataSourceItem_1.RVDataSourceItem) { this.firstRowContainsLabels = true; } else { var props = arg['Properties']; this._sheet = props["Sheet"]; this._range = RVExcelRange_1.RVExcelRange.fromJson(props["Range"]); this._namedRange = props["NamedRange"]; this._pivotTable = props["PivotTable"]; this._firstRowContainsLabels = props["TITLES_IN_FIRST_ROW"] === true; } } /** @hidden */ toJson() { var _a; var json = super.toJson(); var props = json['Properties']; props["Sheet"] = this._sheet; props["Range"] = (_a = this._range) === null || _a === void 0 ? void 0 : _a.toJson(); props["NamedRange"] = this._namedRange; props["PivotTable"] = this._pivotTable; props["TITLES_IN_FIRST_ROW"] = this._firstRowContainsLabels; return json; } /** * Name of the sheet in the worksheet to get the data from, if not specified and @see NamedRange is null, * then the first sheet in the file will be used. */ get sheet() { return this._sheet; } set sheet(value) { this._sheet = value; } /** * Definition of the range to load data from in the specified sheet. */ get range() { return this._range; } set range(value) { this._range = value; } /** * Named range to get data from, it's optional and if no specified the sheet specified in @see Sheet * will be used. */ get namedRange() { return this._namedRange; } set namedRange(value) { this._namedRange = value; } /** * Name of the pivot table to get data from. */ get pivotTable() { return this._pivotTable; } set pivotTable(value) { this._pivotTable = value; } /** * Flag indicating if the first row contains labels or data, it defaults to "true". * If you set this flag to <c>false</c> the columns will be automatically named as 'COL1', 'COL2', etc. */ get firstRowContainsLabels() { return this._firstRowContainsLabels; } set firstRowContainsLabels(value) { this._firstRowContainsLabels = value; } /** @hidden */ getType() { return "RVExcelDataSourceItem"; } /** @hidden */ _getWrapper() { var _a; var wrapper = super._getWrapper(); wrapper.firstRowContainsLabels(this.firstRowContainsLabels); wrapper.sheet(this.sheet); wrapper.namedRange(this.namedRange); wrapper.pivotTable(this.pivotTable); wrapper.range((_a = this.range) === null || _a === void 0 ? void 0 : _a._getWrapper()); return wrapper; } } exports.RVExcelDataSourceItem = RVExcelDataSourceItem;