choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
61 lines (52 loc) • 1.98 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _get from "@babel/runtime/helpers/get";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
import { __decorate } from "tslib";
import { observer } from 'mobx-react';
import { NumberField } from '../number-field/NumberField';
import { FieldType } from '../data-set/enum';
import formatCurrency from '../formatter/formatCurrency';
import defaultFormatBigNumber from '../formatter/formatBigNumber';
import { getCurrencyFormatOptions, getCurrencyFormatter } from '../field/utils';
var Currency = /*#__PURE__*/function (_NumberField) {
_inherits(Currency, _NumberField);
var _super = _createSuper(Currency);
function Currency() {
_classCallCheck(this, Currency);
return _super.apply(this, arguments);
}
_createClass(Currency, [{
key: "getFieldType",
value: function getFieldType() {
return FieldType.currency;
}
}, {
key: "getFormatter",
value: function getFormatter() {
return this.getProp('formatter') || getCurrencyFormatter();
}
}, {
key: "getFormatOptions",
value: function getFormatOptions() {
var _this = this;
return getCurrencyFormatOptions(function (name) {
return _this.getProp(name);
}, this.lang);
}
}, {
key: "getBigNumberFormatValue",
value: function getBigNumberFormatValue(value, _) {
return _get(_getPrototypeOf(Currency.prototype), "getBigNumberFormatValue", this).call(this, value, false);
}
}]);
return Currency;
}(NumberField);
Currency.displayName = 'Currency';
Currency.format = formatCurrency;
Currency.bigNumberFormat = defaultFormatBigNumber;
Currency = __decorate([observer], Currency);
export default Currency;
//# sourceMappingURL=Currency.js.map