currency.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * DevExtreme (localization/currency.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var extend = require("../core/utils/extend").extend;
  11. var numberLocalization = require("./number");
  12. numberLocalization.inject({
  13. _formatNumberCore: function(value, format, formatConfig) {
  14. if ("currency" === format) {
  15. formatConfig.precision = formatConfig.precision || 0;
  16. var result = this.format(value, extend({}, formatConfig, {
  17. type: "fixedpoint"
  18. }));
  19. var currencyPart = this.getCurrencySymbol().symbol.replace("$", "$$$$");
  20. result = result.replace(/^(\D*)(\d.*)/, "$1" + currencyPart + "$2");
  21. return result
  22. }
  23. return this.callBase.apply(this, arguments)
  24. },
  25. getCurrencySymbol: function() {
  26. return {
  27. symbol: "$"
  28. }
  29. },
  30. getOpenXmlCurrencyFormat: function() {
  31. return "$#,##0{0}_);\\($#,##0{0}\\)"
  32. }
  33. });