12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 'use strict';
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: BI Dashboard
- *| (C) Copyright IBM Corp. 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define(['underscore', '../lib/@waca/core-client/js/core-client/ui/core/Class'], function (_, BaseClass) {
- var FacetClass = BaseClass.extend({
- _dataObject: null,
- init: function init(object) {
- FacetClass.inherited('init', this, arguments);
- this._dataObject = object;
- Object.defineProperty(this, 'displayValue', {
- get: function get() {
- if (object === undefined || object === null) {
- return null;
- } else {
- if (this._dataObject.hasOwnProperty('d')) {
- return this._dataObject.d;
- } else if (this._dataObject.hasOwnProperty('u')) {
- return this._dataObject.u;
- } else {
- return this._dataObject;
- }
- }
- }
- });
- Object.defineProperty(this, 'useValue', {
- get: function get() {
- if (object === undefined || object === null) {
- return null;
- } else {
- if (this._dataObject.hasOwnProperty('u')) {
- return this._dataObject.u;
- } else if (this._dataObject.hasOwnProperty('d')) {
- return this._dataObject.d;
- } else {
- return this._dataObject;
- }
- }
- }
- });
- Object.defineProperty(this, 'parent', {
- get: function get() {
- if (object === undefined || object === null) {
- return null;
- } else {
- return this._dataObject.hasOwnProperty('p') ? new FacetClass(object.p) : null;
- }
- }
- });
- },
- getParent: function getParent() {
- return this.parent;
- },
- toJSONObject: function toJSONObject() {
- var parent = this.parent ? {
- 'parent': { 'useValue': this.parent.useValue }
- } : {};
- return _.extend({ 'displayValue': this.displayValue, 'useValue': this.useValue }, parent);
- }
- });
- return FacetClass;
- });
- //# sourceMappingURL=FacetDataObject.js.map
|