@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
48 lines • 2.83 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2020 GoodData Corporation
var React = require("react");
var react_intl_1 = require("react-intl");
var InputWithNumberFormat_1 = require("@gooddata/goodstrap/lib/Form/InputWithNumberFormat");
var ExtendedPreview_1 = require("./ExtendedPreview");
var FormattedPreview_1 = require("../shared/FormattedPreview");
var DEFAULT_PREVIEW_VALUE = -1234.5678;
var Preview = /** @class */ (function (_super) {
__extends(Preview, _super);
function Preview() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
preview: DEFAULT_PREVIEW_VALUE,
};
_this.render = function () {
var _a = _this.props, format = _a.format, separators = _a.separators, intl = _a.intl;
return (React.createElement("div", { className: "gd-measure-custom-format-dialog-section gd-measure-custom-format-dialog-section-preview" },
React.createElement("span", { className: "gd-measure-custom-format-dialog-section-title" }, intl.formatMessage({ id: "measureNumberCustomFormatDialog.preview" })),
React.createElement("div", { className: "gd-measure-custom-format-dialog-preview" },
React.createElement(InputWithNumberFormat_1.default, { className: "s-custom-format-dialog-preview-input gd-measure-custom-format-dialog-preview-input", value: _this.state.preview, isSmall: true, autofocus: false, onChange: _this.onPreviewChange, separators: separators }),
React.createElement(FormattedPreview_1.FormattedPreview, { previewNumber: _this.state.preview, format: format, separators: separators, className: "s-custom-format-dialog-preview-formatted gd-measure-custom-format-dialog-preview-string" })),
React.createElement(ExtendedPreview_1.ExtendedPreview, { format: format, separators: separators })));
};
_this.onPreviewChange = function (value) {
_this.setState({ preview: value });
};
return _this;
}
return Preview;
}(React.PureComponent));
exports.Preview = Preview;
exports.default = react_intl_1.injectIntl(Preview);
//# sourceMappingURL=Preview.js.map