'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2019 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @class CrosstabPropertyCallbacks * @hideconstructor * @classdesc This class provides APIs for dashboard avtivity state */ define(['underscore', '../../../widgets/livewidget/nls/StringResources'], function (_, StringResources) { var MIN_ROW_HEIGHT = 24; var MIN_COLUMN_WIDTH = 24; /** * this class is used in VisPropertyProvider. */ var CrosstabPropertyCallbacks = function () { function CrosstabPropertyCallbacks() { _classCallCheck(this, CrosstabPropertyCallbacks); } CrosstabPropertyCallbacks.prototype.getAPI = function getAPI() { // we have to return implementation here. return this; }; /** * validate the input for property input * @param {number} propertyValue * @param {number} range */ CrosstabPropertyCallbacks.prototype._checkValidInput = function _checkValidInput(propertyValue, range) { if (isNaN(propertyValue)) { return this._buildValidateResponse(false, StringResources.get('prop_sizeInputNonNumericValue')); } if (parseInt(propertyValue) < range) { return this._buildValidateResponse(false, StringResources.get('prop_sizeValueShouldBeHigher', { value: range })); } return this._buildValidateResponse(true); }; /** * validate the input for rowHeight property input * @param {number} rowHeightInput */ CrosstabPropertyCallbacks.prototype.checkValidRowHeightInput = function checkValidRowHeightInput(_content, rowHeightInput) { return this._checkValidInput(rowHeightInput, MIN_ROW_HEIGHT); }; /** * validate the input for columnWidth property input * @param {number} columnWidthInput */ CrosstabPropertyCallbacks.prototype.checkValidColumnWidthInput = function checkValidColumnWidthInput(_content, columnWidthInput) { return this._checkValidInput(columnWidthInput, MIN_COLUMN_WIDTH); }; /** * build validation response * @param {boolean} isValid * @param {string} message * @returns {object} */ CrosstabPropertyCallbacks.prototype._buildValidateResponse = function _buildValidateResponse(isValid, message) { return { isValid: isValid, message: message }; }; return CrosstabPropertyCallbacks; }(); return CrosstabPropertyCallbacks; }); //# sourceMappingURL=CrosstabPropertyCallbacks.js.map