fui-material 2.1.14 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50047,6 +50047,46 @@ function fDownloadBlobFile(blob, fileName) {
50047
50047
  document.body.removeChild(link2);
50048
50048
  window.URL.revokeObjectURL(url);
50049
50049
  }
50050
+ function fBankRound(value, decimalPlaces) {
50051
+ if (decimalPlaces == void 0) decimalPlaces = 2;
50052
+ const factor = Math.pow(10, decimalPlaces);
50053
+ const roundedValue = Math.round(value * factor) / factor;
50054
+ const strValue = roundedValue.toString();
50055
+ const dotIndex = strValue.indexOf(".");
50056
+ if (dotIndex === -1) {
50057
+ return roundedValue;
50058
+ }
50059
+ const fractionalPart = strValue.slice(dotIndex + 1);
50060
+ if (fractionalPart.length <= decimalPlaces) {
50061
+ return roundedValue;
50062
+ }
50063
+ const nextDigit = fractionalPart[decimalPlaces];
50064
+ if (nextDigit === "5") {
50065
+ const lastDigit = fractionalPart[decimalPlaces - 1];
50066
+ if (+lastDigit % 2 !== 0) {
50067
+ return +(roundedValue + Math.pow(10, -decimalPlaces)).toFixed(decimalPlaces);
50068
+ } else {
50069
+ return +roundedValue.toFixed(decimalPlaces);
50070
+ }
50071
+ }
50072
+ return +roundedValue.toFixed(decimalPlaces);
50073
+ }
50074
+ const fFormatRuNumber = (a, options) => {
50075
+ if (typeof a !== "number" || isNaN(a)) return "";
50076
+ let processedValue = a;
50077
+ if (options == null ? void 0 : options.useBankRound) {
50078
+ const decimalPlaces = options.bankRoundDecimalPlaces;
50079
+ processedValue = fBankRound(processedValue, decimalPlaces);
50080
+ }
50081
+ const formatOptions = {};
50082
+ if ((options == null ? void 0 : options.maximumFractionDigits) !== void 0) {
50083
+ formatOptions.maximumFractionDigits = options.maximumFractionDigits;
50084
+ }
50085
+ if ((options == null ? void 0 : options.minimumFractionDigits) !== void 0) {
50086
+ formatOptions.minimumFractionDigits = options.minimumFractionDigits;
50087
+ }
50088
+ return new Intl.NumberFormat("ru-RU", formatOptions).format(processedValue);
50089
+ };
50050
50090
  function bind(fn, thisArg) {
50051
50091
  return function wrap() {
50052
50092
  return fn.apply(thisArg, arguments);
@@ -52545,6 +52585,7 @@ export {
52545
52585
  FTrashIcon,
52546
52586
  FUnlinkIcon,
52547
52587
  fAlert,
52588
+ fBankRound,
52548
52589
  fConfirm,
52549
52590
  fConvertFileToBase64,
52550
52591
  fDownloadBlobFile,
@@ -52553,6 +52594,7 @@ export {
52553
52594
  fExportTableToExcel,
52554
52595
  fExportingHtmlToDocx,
52555
52596
  fExportingHtmlToXlsx,
52597
+ fFormatRuNumber,
52556
52598
  fGenerateUniqueId,
52557
52599
  fInstallFormatCodeXlsx,
52558
52600
  fNotification,