angular-qlik-api
Version:
AngulerQlikApi is the angular wrapper for Qlik Engine API. It facilitates the usage and handles the synchronization.
1,629 lines (1,621 loc) • 222 kB
JavaScript
import { Component, Inject, Injectable, Input, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @template T
*/
var Deferred = (function () {
function Deferred() {
var _this = this;
this.promise = new Promise(function (resolve, reject) {
_this.reject = reject;
_this.resolve = resolve;
});
}
return Deferred;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var QlikConfig = (function () {
function QlikConfig(qlikConfig) {
this.useWss = qlikConfig.useWss || false;
this.address = qlikConfig.address || 'localhost';
this.port = qlikConfig.port || 4848;
}
/**
* @return {?}
*/
QlikConfig.prototype.getWebsocketConnectionLink = /**
* @return {?}
*/
function () {
var /** @type {?} */ protocol = this.useWss ? 'wss' : 'ws';
return protocol + '://' + this.address + ':' + this.port + '/app/';
};
return QlikConfig;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var HyperCube = (function () {
function HyperCube(deferred, globalService, doc, cubeOuterId) {
this.definition = {
'jsonrpc': '2.0',
'id': null,
'method': 'CreateSessionObject',
'handle': null,
'params': [
{
'qInfo': {
'qType': 'Chart'
},
'qHyperCubeDef': {
'qInitialDataFetch': [
{
'qHeight': 2000,
'qWidth': 1
}
],
'qDimensions': [],
'qMeasures': [],
'qSuppressZero': false,
'qSuppressMissing': false,
'qMode': 'S',
'qInterColumnSortOrder': [],
'qStateName': '$'
}
}
]
};
this.callback = [];
this.outerDoc = doc;
this.deferred = new Deferred();
this.doc = deferred;
this.globalService = globalService;
this.cubeOuterId = cubeOuterId;
}
/**
* @param {?} cb
* @return {?}
*/
HyperCube.prototype.subscribe = /**
* @param {?} cb
* @return {?}
*/
function (cb) {
var _this = this;
this.callback.push(cb);
this.doc.promise.then(function (h) {
_this.setHandle(h);
_this.setDefinitionId(_this.globalService.getNextEnumerator());
_this.globalService.wsSend(_this.definition, [_this.onMessageCubeCreated.bind(_this)]);
});
return this;
};
/**
* @return {?}
*/
HyperCube.prototype.unsubscribe = /**
* @return {?}
*/
function () {
var _this = this;
this.deferred.promise.then(function (d) {
_this.outerDoc.removeHyperCube(_this.cubeOuterId);
});
};
/**
* @return {?}
*/
HyperCube.prototype.getLayout = /**
* @return {?}
*/
function () {
var _this = this;
this.deferred.promise.then(function (d) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetLayout',
'handle': d,
'params': []
}, [_this.onMessageLayout.bind(_this)]);
});
};
/**
* @param {?} m
* @return {?}
*/
HyperCube.prototype.onMessageCubeCreated = /**
* @param {?} m
* @return {?}
*/
function (m) {
if (m.error) {
this.deferred.reject(m.error.message);
console.error(m.error.message);
}
else {
this.deferred.resolve(m.result.qReturn.qHandle);
this.getLayout();
}
};
/**
* @param {?} m
* @return {?}
*/
HyperCube.prototype.onMessageLayout = /**
* @param {?} m
* @return {?}
*/
function (m) {
if (m.error) {
console.error(m.error.message);
}
else {
this.callback.forEach(function (f) {
f(m);
});
}
};
/**
* @param {?} b
* @return {?}
*/
HyperCube.prototype.setSuppressZero = /**
* @param {?} b
* @return {?}
*/
function (b) {
this.definition.params[0].qHyperCubeDef.qSuppressZero = b;
return this;
};
/**
* @param {?} arr
* @return {?}
*/
HyperCube.prototype.setEffectiveColumnSorter = /**
* @param {?} arr
* @return {?}
*/
function (arr) {
this.definition.params[0].qHyperCubeDef['qEffectiveInterColumnSortOrder'] = arr;
return this;
};
/**
* @param {?} b
* @return {?}
*/
HyperCube.prototype.setSuppressMissing = /**
* @param {?} b
* @return {?}
*/
function (b) {
this.definition.params[0].qHyperCubeDef.qSuppressMissing = b;
return this;
};
/**
* @param {?} s
* @return {?}
*/
HyperCube.prototype.setStateName = /**
* @param {?} s
* @return {?}
*/
function (s) {
this.definition.params[0].qHyperCubeDef.qStateName = s;
return this;
};
/**
* @param {?} height
* @param {?} width
* @return {?}
*/
HyperCube.prototype.setInitialDataFetch = /**
* @param {?} height
* @param {?} width
* @return {?}
*/
function (height, width) {
this.definition.params[0].qHyperCubeDef.qInitialDataFetch[0].qHeight = height;
this.definition.params[0].qHyperCubeDef.qInitialDataFetch[0].qWidth = width;
return this;
};
/**
* @param {?} dim
* @return {?}
*/
HyperCube.prototype.addDimension = /**
* @param {?} dim
* @return {?}
*/
function (dim) {
this.definition.params[0].qHyperCubeDef.qDimensions.push(dim.definition);
this.definition.params[0].qHyperCubeDef.qInitialDataFetch[0].qWidth =
this.definition.params[0].qHyperCubeDef.qInitialDataFetch[0].qWidth + 1;
return this;
};
/**
* @param {?} ms
* @return {?}
*/
HyperCube.prototype.addMeasure = /**
* @param {?} ms
* @return {?}
*/
function (ms) {
this.definition.params[0].qHyperCubeDef.qMeasures.push(ms.definition);
this.definition.params[0].qHyperCubeDef.qInitialDataFetch[0].qWidth =
this.definition.params[0].qHyperCubeDef.qInitialDataFetch[0].qWidth + 1;
return this;
};
/**
* @param {?} dimensionIndex
* @param {?} rowIndex
* @return {?}
*/
HyperCube.prototype.select = /**
* @param {?} dimensionIndex
* @param {?} rowIndex
* @return {?}
*/
function (dimensionIndex, rowIndex) {
var _this = this;
this.deferred.promise.then(function (d) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectHyperCubeValues',
'handle': d,
'params': [
'/qHyperCubeDef',
dimensionIndex,
[
rowIndex
],
true
]
}, [function () { _this.outerDoc.refreshAll(); }]);
});
return this;
};
/**
* @param {?} h
* @return {?}
*/
HyperCube.prototype.setHandle = /**
* @param {?} h
* @return {?}
*/
function (h) {
this.definition.handle = h;
};
/**
* @param {?} n
* @return {?}
*/
HyperCube.prototype.setDefinitionId = /**
* @param {?} n
* @return {?}
*/
function (n) {
this.definition.id = n;
};
return HyperCube;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var List = (function () {
function List(deferred, globalService, doc, cubeOuterId) {
this.definition = {
'jsonrpc': '2.0',
'id': null,
'method': 'CreateSessionObject',
'handle': null,
'params': [
{
'qInfo': {
'qType': 'List'
},
'qListObjectDef': {
'qStateName': '$',
'qLibraryId': '',
'qDef': {
'qGrouping': 'N',
'qFieldDefs': [],
'qFieldLabels': [],
'qSortCriterias': [
{
'qSortByState': 1,
'qSortByFrequency': 0,
'qSortByNumeric': 0,
'qSortByAscii': 0,
'qSortByLoadOrder': 0,
'qSortByExpression': 0,
'qExpression': {
'qv': ''
}
}
],
'qNumberPresentations': [
{
'qType': 'U',
'qnDec': 10,
'qUseThou': 0,
'qFmt': '',
'qDec': '.',
'qThou': ' '
}
]
},
'qAutoSortByState': {
'qDisplayNumberOfRows': -1
},
'qFrequencyMode': 'EQ_NX_FREQUENCY_NONE',
'qShowAlternatives': true,
'qInitialDataFetch': [
{
'qTop': 0,
'qLeft': 0,
'qHeight': 100,
'qWidth': 1
}
]
}
}
]
};
this.outerDoc = doc;
this.deferred = new Deferred();
this.doc = deferred;
this.globalService = globalService;
this.cubeOuterId = cubeOuterId;
}
/**
* @param {?} cb
* @return {?}
*/
List.prototype.subscribe = /**
* @param {?} cb
* @return {?}
*/
function (cb) {
var _this = this;
this.callback = cb;
this.doc.promise.then(function (h) {
_this.setHandle(h);
_this.setDefinitionId(_this.globalService.getNextEnumerator());
_this.globalService.wsSend(_this.definition, [_this.onMessageListCreated.bind(_this)]);
});
return this;
};
/**
* @return {?}
*/
List.prototype.unsubscribe = /**
* @return {?}
*/
function () {
var _this = this;
this.deferred.promise.then(function (d) {
_this.outerDoc.removeHyperCube(_this.cubeOuterId);
});
};
/**
* @param {?} m
* @return {?}
*/
List.prototype.onMessageListCreated = /**
* @param {?} m
* @return {?}
*/
function (m) {
if (m.error) {
this.deferred.reject(m.error.message);
console.error(m.error.message);
}
else {
this.deferred.resolve(m.result.qReturn.qHandle);
this.getLayout();
}
};
/**
* @return {?}
*/
List.prototype.getLayout = /**
* @return {?}
*/
function () {
var _this = this;
this.deferred.promise.then(function (d) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetLayout',
'handle': d,
'params': []
}, [_this.onMessageLayout.bind(_this)]);
});
};
/**
* @param {?} m
* @return {?}
*/
List.prototype.onMessageLayout = /**
* @param {?} m
* @return {?}
*/
function (m) {
if (m.error) {
console.error(m.error.message);
}
else {
this.callback(m);
}
};
/**
* @param {?} qFieldDefs
* @param {?=} qFieldLabels
* @return {?}
*/
List.prototype.addQFieldDef = /**
* @param {?} qFieldDefs
* @param {?=} qFieldLabels
* @return {?}
*/
function (qFieldDefs, qFieldLabels) {
this.definition.params[0].qListObjectDef.qDef.qFieldDefs.push(qFieldDefs);
this.definition.params[0].qListObjectDef.qDef.qFieldLabels.push(qFieldDefs || '');
return this;
};
/**
* @param {?} index
* @return {?}
*/
List.prototype.select = /**
* @param {?} index
* @return {?}
*/
function (index) {
var _this = this;
this.deferred.promise.then(function (d) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectListObjectValues',
'handle': d,
'params': [
'/qListObjectDef',
[
index
],
true
]
}, [function () { _this.outerDoc.refreshAll(); }]);
});
return this;
};
/**
* @param {?} h
* @return {?}
*/
List.prototype.setHandle = /**
* @param {?} h
* @return {?}
*/
function (h) {
this.definition.handle = h;
};
/**
* @param {?} n
* @return {?}
*/
List.prototype.setDefinitionId = /**
* @param {?} n
* @return {?}
*/
function (n) {
this.definition.id = n;
};
return List;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var Bookmark = (function () {
function Bookmark(deferred, globalService, doc, bookmarkOuterId) {
this.outerDoc = doc;
this.deferred = new Deferred();
this.doc = deferred;
this.globalService = globalService;
this.bookmarkOuterId = bookmarkOuterId;
}
/**
* @param {?} handle
* @return {?}
*/
Bookmark.prototype.setHandle = /**
* @param {?} handle
* @return {?}
*/
function (handle) {
this.deferred.resolve(handle);
};
/**
* @return {?}
*/
Bookmark.prototype.apply = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Apply',
'handle': handle,
'params': {}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qPatches
* @return {?}
*/
Bookmark.prototype.applyPatches = /**
* @param {?} qPatches
* @return {?}
*/
function (qPatches) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'ApplyPatches',
'handle': handle,
'params': {
qPatches: qPatches
}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Bookmark.prototype.getInfo = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetInfo',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Bookmark.prototype.getLayout = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetLayout',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Bookmark.prototype.getProperties = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'getProperties',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Bookmark.prototype.publish = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Publish',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qProp
* @return {?}
*/
Bookmark.prototype.setProperties = /**
* @param {?} qProp
* @return {?}
*/
function (qProp) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SetProperties',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Bookmark.prototype.unPublish = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'UnPublish',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
return Bookmark;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var Field = (function () {
function Field(deferred, globalService, doc, fieldOuterId) {
this.outerDoc = doc;
this.deferred = new Deferred();
this.doc = deferred;
this.globalService = globalService;
this.fieldOuterId = fieldOuterId;
}
/**
* @param {?} handle
* @return {?}
*/
Field.prototype.setHandle = /**
* @param {?} handle
* @return {?}
*/
function (handle) {
this.deferred.resolve(handle);
};
/**
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.clearAllButThis = /**
* @param {?=} qSoftLock
* @return {?}
*/
function (qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'ClearAllButThis',
'handle': handle,
'params': {
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Field.prototype.clear = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Clear',
'handle': handle,
'params': {}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Field.prototype.getAndMode = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetAndMode',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Field.prototype.getCardinal = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetCardinal',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Field.prototype.getNxProperties = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetNxProperties',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Field.prototype.lock = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Lock',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qValues
* @param {?} qToggleMode
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.lowLevelSelect = /**
* @param {?} qValues
* @param {?} qToggleMode
* @param {?=} qSoftLock
* @return {?}
*/
function (qValues, qToggleMode, qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'LowLevelSelect',
'handle': handle,
'params': {
qValues: qValues,
qToggleMode: qToggleMode,
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.selectAll = /**
* @param {?=} qSoftLock
* @return {?}
*/
function (qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectAll',
'handle': handle,
'params': {
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.selectAlternative = /**
* @param {?=} qSoftLock
* @return {?}
*/
function (qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectAlternative',
'handle': handle,
'params': {
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.selectExcluded = /**
* @param {?=} qSoftLock
* @return {?}
*/
function (qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectExcluded',
'handle': handle,
'params': {
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qMatch
* @param {?=} qSoftLock
* @param {?=} qExcludedValuesMode
* @return {?}
*/
Field.prototype.select = /**
* @param {?} qMatch
* @param {?=} qSoftLock
* @param {?=} qExcludedValuesMode
* @return {?}
*/
function (qMatch, qSoftLock, qExcludedValuesMode) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Select',
'handle': handle,
'params': {
qMatch: qMatch,
qSoftLock: qSoftLock,
qExcludedValuesMode: qExcludedValuesMode
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.selectPossible = /**
* @param {?=} qSoftLock
* @return {?}
*/
function (qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectPossible',
'handle': handle,
'params': {
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qFieldValues
* @param {?} qToggleMode
* @param {?=} qSoftLock
* @return {?}
*/
Field.prototype.selectValues = /**
* @param {?} qFieldValues
* @param {?} qToggleMode
* @param {?=} qSoftLock
* @return {?}
*/
function (qFieldValues, qToggleMode, qSoftLock) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SelectValues',
'handle': handle,
'params': {
qFieldValues: qFieldValues,
qToggleMode: qToggleMode,
qSoftLock: qSoftLock
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qAndMode
* @return {?}
*/
Field.prototype.setAndMode = /**
* @param {?} qAndMode
* @return {?}
*/
function (qAndMode) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SetAndMode',
'handle': handle,
'params': {
qAndMode: qAndMode
}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qOneAndOnlyOne
* @return {?}
*/
Field.prototype.setNxProperties = /**
* @param {?} qOneAndOnlyOne
* @return {?}
*/
function (qOneAndOnlyOne) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SetNxProperties',
'handle': handle,
'params': {
qProperties: {
qOneAndOnlyOne: qOneAndOnlyOne
}
}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @param {?} qMatch
* @param {?=} qSoftLock
* @param {?=} qExcludedValuesMode
* @return {?}
*/
Field.prototype.toggleSelect = /**
* @param {?} qMatch
* @param {?=} qSoftLock
* @param {?=} qExcludedValuesMode
* @return {?}
*/
function (qMatch, qSoftLock, qExcludedValuesMode) {
var _this = this;
if (qSoftLock === void 0) { qSoftLock = false; }
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'ToggleSelect',
'handle': handle,
'params': {
qMatch: qMatch,
qSoftLock: qSoftLock,
qExcludedValuesMode: qExcludedValuesMode
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* @return {?}
*/
Field.prototype.unlock = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Unlock',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
return Field;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {string} */
var QOp = {
Add: 'Add',
Remove: 'Remove',
Replace: 'Replace',
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var GenericMeasure = (function () {
function GenericMeasure(deferred, globalService, doc, genericMeasureId) {
this.outerDoc = doc;
this.deferred = new Deferred();
this.doc = deferred;
this.globalService = globalService;
this.genericMeasureId = genericMeasureId;
}
/**
* @param {?} handle
* @return {?}
*/
GenericMeasure.prototype.setHandle = /**
* @param {?} handle
* @return {?}
*/
function (handle) {
this.deferred.resolve(handle);
this.getProperties();
};
/**
* Applies a patch to the properties of an object. Allows an update to some of the properties.
* @param {Array<QPatches>} qPatches
* @returns {Promise<any>}
*/
/**
* Applies a patch to the properties of an object. Allows an update to some of the properties.
* @param {?} qPatches
* @return {?}
*/
GenericMeasure.prototype.applyPatches = /**
* Applies a patch to the properties of an object. Allows an update to some of the properties.
* @param {?} qPatches
* @return {?}
*/
function (qPatches) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'ApplyPatches',
'handle': handle,
'params': {
qPatches: qPatches
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Returns the type and identifier of the object.
* @returns {Promise<any>}
*/
/**
* Returns the type and identifier of the object.
* @return {?}
*/
GenericMeasure.prototype.getInfo = /**
* Returns the type and identifier of the object.
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetInfo',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Evaluates a measure and displays its properties, including the dynamic properties.
* @param {QGenericMeasureProperties} qLayout
* @returns {Promise<any>}
*/
/**
* Evaluates a measure and displays its properties, including the dynamic properties.
* @param {?} qLayout
* @return {?}
*/
GenericMeasure.prototype.getLayout = /**
* Evaluates a measure and displays its properties, including the dynamic properties.
* @param {?} qLayout
* @return {?}
*/
function (qLayout) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetLayout',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Lists the linked objects to a generic object, a dimension or a measure.
* @param {Array<QLinkedObjectInfo>} qItems
* @returns {Promise<any>}
*/
/**
* Lists the linked objects to a generic object, a dimension or a measure.
* @param {?} qItems
* @return {?}
*/
GenericMeasure.prototype.getLinkedObjects = /**
* Lists the linked objects to a generic object, a dimension or a measure.
* @param {?} qItems
* @return {?}
*/
function (qItems) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetLinkedObjects',
'handle': handle,
'params': {
qItems: qItems
}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Returns the definition of a measure.
* @returns {Promise<any>}
*/
/**
* Returns the definition of a measure.
* @return {?}
*/
GenericMeasure.prototype.getMeasure = /**
* Returns the definition of a measure.
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetMeasure',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Shows the properties of an object.
* Returns the identifier and the definition of the measure.
* @returns {Promise<any>}
*/
/**
* Shows the properties of an object.
* Returns the identifier and the definition of the measure.
* @return {?}
*/
GenericMeasure.prototype.getProperties = /**
* Shows the properties of an object.
* Returns the identifier and the definition of the measure.
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'GetProperties',
'handle': handle,
'params': {}
}, [function (message) {
console.log(message);
_this.qProp = message.result.qProp;
setTimeout(function () { }, 1);
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Publishes a measure.
* @returns {Promise<any>}
*/
/**
* Publishes a measure.
* @return {?}
*/
GenericMeasure.prototype.publish = /**
* Publishes a measure.
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'Publish',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Sets some properties for a measure.
* @param {QGenericMeasureProperties} qProp
* @returns {Promise<any>}
*/
/**
* Sets some properties for a measure.
* @param {?} qProp
* @return {?}
*/
GenericMeasure.prototype.setProperties = /**
* Sets some properties for a measure.
* @param {?} qProp
* @return {?}
*/
function (qProp) {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'SetProperties',
'handle': handle,
'params': {
qProp: qProp
}
}, [function (message) {
_this.outerDoc.refreshAll();
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Unpublishes a measure.
* @returns {Promise<any>}
*/
/**
* Unpublishes a measure.
* @return {?}
*/
GenericMeasure.prototype.unPublish = /**
* Unpublishes a measure.
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ deferred = new Deferred();
this.deferred.promise.then(function (handle) {
_this.globalService.wsSend({
'jsonrpc': '2.0',
'id': _this.globalService.getNextEnumerator(),
'method': 'UnPublish',
'handle': handle,
'params': {}
}, [function (message) {
deferred.resolve(message);
}]);
});
return deferred.promise;
};
/**
* Module helper method
* Sets the title. If presist true will automatically save the object
* @param {string} title
* @param {boolean} presist
* @returns {GenericMeasure}
*/
/**
* Module helper method
* Sets the title. If presist true will automatically save the object
* @param {?} title
* @param {?=} presist
* @return {?}
*/
GenericMeasure.prototype.$setTitle = /**
* Module helper method
* Sets the title. If presist true will automatically save the object
* @param {?} title
* @param {?=} presist
* @return {?}
*/
function (title, presist) {
var _this = this;
if (presist === void 0) { presist = true; }
this.applyPatches([{
qOp: QOp.Add,
qPath: '/qMetaDef/title',
qValue: '"' + title + '"'
}]).then(function (m) {
_this.getProperties();
if (presist) {
_this.outerDoc.saveObjects();
}
});
return this;
};
/**
* Module helper method
* Sets the description. If presist param set to true will, then the GenericMeasure object is saved automatically
* @param {string} description
* @param {boolean} presist
* @returns {Promise<any>}
*/
/**
* Module helper method
* Sets the description. If presist param set to true will, then the GenericMeasure object is saved automatically
* @param {?} description
* @param {?=} presist
* @return {?}
*/
GenericMeasure.prototype.$setDescription = /**
* Module helper method
* Sets the description. If presist param set to true will, then the GenericMeasure object is saved automatically
* @param {?} description
* @param {?=} presist
* @return {?}
*/
function (description, presist) {
var _this = this;
if (presist === void 0) { presist = true; }
this.applyPatches([{
qOp: QOp.Add,
qPath: '/qMetaDef/description',
qValue: '"' + description + '"'
}]).then(function (m) {
_this.getProperties();
if (presist) {
_this.outerDoc.saveObjects();
}
});
return this;
};
/**
* Module helper method
* Sets the tag property. If presist param set to true will, then the GenericMeasure object is saved automatically
* @param {Array<string>} tags
* @param {boolean} presist
* @returns {Promise<any>}
*/
/**
* Module helper method
* Sets the tag property. If presist param set to true will, then the GenericMeasure object is saved automatically
* @param