UNPKG

trclib

Version:

Client and utility wrappers for TRC rest APIs

50 lines (49 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var trc = require("./trc2"); var PluginOptionsHelper = (function () { function PluginOptionsHelper() { } PluginOptionsHelper.New = function (opts, currentSheet) { if (opts == null || opts == undefined) { opts = { recId: null, gotoUrl: "" }; } var oh = new PluginOptionsHelper(); oh._opts = opts; oh._currentSheetId = currentSheet.getId(); return oh; }; PluginOptionsHelper.prototype.getGotoLink = function (p) { var sheetId = this._currentSheetId; if (p.sheetId != undefined) { sheetId = p.sheetId; } var plugin = "_"; if (p.plugin != undefined) { plugin = p.plugin; } var uri = this._opts.gotoUrl + "/" + sheetId + "/" + plugin + "/index.html"; if (p.recId != undefined) { uri = trc.StaticHelper.addQuery(uri, "recId", p.recId); p.tags = "_single"; } if (plugin == "_") { if (p.tags != undefined) { uri = trc.StaticHelper.addQuery(uri, "tags", p.tags); } } return uri; }; PluginOptionsHelper.prototype.getStartupRecId = function () { var r = this._opts.recId; if (r == undefined) { return null; } return r; }; return PluginOptionsHelper; }()); exports.PluginOptionsHelper = PluginOptionsHelper;