@ryuzaki13/react-foundation-lib 1.2.8 → 1.2.9

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.
@@ -2,7 +2,7 @@
2
2
  var e = "p_curr";
3
3
  function t(e, t, n) {
4
4
  if (!t || !n) return e;
5
- let r = t[n === "internal" ? 0 : 1]?.trim(), i = r.startsWith(",");
5
+ let r = t[n === "internal" ? 0 : 1]?.trim() ?? "", i = r.startsWith(",");
6
6
  return r ? `${e}${i ? "" : " "}${r}` : e;
7
7
  }
8
8
  function n(t) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/currency/currency.ts"],"sourcesContent":["import { type WrappedODataParameters } from \"../odata-service\";\n\nconst CURRENCY_PARAMETER_ID = \"p_curr\";\n\n/** Runtime-режим валюты, который задается общим OData-параметром страницы. */\nexport type CurrencyMode = \"internal\" | \"rub\";\n\n/** Собирает display-подпись с валютным суффиксом. */\nexport function resolveCurrencyAwareLabel(\n\tlabel: string,\n\tcurrencyLabels: readonly [string, string] | undefined,\n\tcurrencyMode: CurrencyMode | null | undefined\n): string {\n\tif (!currencyLabels || !currencyMode) {\n\t\treturn label;\n\t}\n\n\tconst currencyLabelIndex = currencyMode === \"internal\" ? 0 : 1;\n\tconst currencyLabel = currencyLabels[currencyLabelIndex]?.trim();\n\tconst hasComma = currencyLabel.startsWith(\",\");\n\n\t// NOTE: нужно закрепить правило, что запятая ставится в currencyLabel\n\treturn currencyLabel ? `${label}${hasComma ? \"\" : \" \"}${currencyLabel}` : label;\n}\n\n/** Определяет режим валюты по общему OData-параметру `p_curr`. */\nexport function resolveCurrencyModeFromODataParameters(params?: WrappedODataParameters): CurrencyMode | null {\n\tif (!params || !Object.prototype.hasOwnProperty.call(params, CURRENCY_PARAMETER_ID)) {\n\t\treturn null;\n\t}\n\n\tconst value = params[CURRENCY_PARAMETER_ID]?.value;\n\tif (value === false) return \"internal\";\n\tif (value === true) return \"rub\";\n\n\treturn null;\n}\n"],"mappings":";AAEA,IAAM,IAAwB;AAM9B,SAAgB,EACf,GACA,GACA,GACS;CACT,IAAI,CAAC,KAAkB,CAAC,GACvB,OAAO;CAIR,IAAM,IAAgB,EADK,MAAiB,aAAa,IAAI,EACL,EAAE,KAAK,GACzD,IAAW,EAAc,WAAW,GAAG;CAG7C,OAAO,IAAgB,GAAG,IAAQ,IAAW,KAAK,MAAM,MAAkB;AAC3E;AAGA,SAAgB,EAAuC,GAAsD;CAC5G,IAAI,CAAC,KAAU,CAAC,OAAO,UAAU,eAAe,KAAK,GAAQ,CAAqB,GACjF,OAAO;CAGR,IAAM,IAAQ,EAAO,EAAsB,EAAE;CAI7C,OAHI,MAAU,KAAc,aACxB,MAAU,KAAa,QAEpB;AACR"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/currency/currency.ts"],"sourcesContent":["import { type WrappedODataParameters } from \"../odata-service\";\n\nconst CURRENCY_PARAMETER_ID = \"p_curr\";\n\n/** Runtime-режим валюты, который задается общим OData-параметром страницы. */\nexport type CurrencyMode = \"internal\" | \"rub\";\n\n/** Собирает display-подпись с валютным суффиксом. */\nexport function resolveCurrencyAwareLabel(\n\tlabel: string,\n\tcurrencyLabels: readonly [string, string] | undefined,\n\tcurrencyMode: CurrencyMode | null | undefined\n): string {\n\tif (!currencyLabels || !currencyMode) {\n\t\treturn label;\n\t}\n\n\tconst currencyLabelIndex = currencyMode === \"internal\" ? 0 : 1;\n\tconst currencyLabel = currencyLabels[currencyLabelIndex]?.trim() ?? \"\";\n\tconst hasComma = currencyLabel.startsWith(\",\");\n\n\t// NOTE: нужно закрепить правило, что запятая ставится в currencyLabel\n\treturn currencyLabel ? `${label}${hasComma ? \"\" : \" \"}${currencyLabel}` : label;\n}\n\n/** Определяет режим валюты по общему OData-параметру `p_curr`. */\nexport function resolveCurrencyModeFromODataParameters(params?: WrappedODataParameters): CurrencyMode | null {\n\tif (!params || !Object.prototype.hasOwnProperty.call(params, CURRENCY_PARAMETER_ID)) {\n\t\treturn null;\n\t}\n\n\tconst value = params[CURRENCY_PARAMETER_ID]?.value;\n\tif (value === false) return \"internal\";\n\tif (value === true) return \"rub\";\n\n\treturn null;\n}\n"],"mappings":";AAEA,IAAM,IAAwB;AAM9B,SAAgB,EACf,GACA,GACA,GACS;CACT,IAAI,CAAC,KAAkB,CAAC,GACvB,OAAO;CAIR,IAAM,IAAgB,EADK,MAAiB,aAAa,IAAI,EACL,EAAE,KAAK,KAAK,IAC9D,IAAW,EAAc,WAAW,GAAG;CAG7C,OAAO,IAAgB,GAAG,IAAQ,IAAW,KAAK,MAAM,MAAkB;AAC3E;AAGA,SAAgB,EAAuC,GAAsD;CAC5G,IAAI,CAAC,KAAU,CAAC,OAAO,UAAU,eAAe,KAAK,GAAQ,CAAqB,GACjF,OAAO;CAGR,IAAM,IAAQ,EAAO,EAAsB,EAAE;CAI7C,OAHI,MAAU,KAAc,aACxB,MAAU,KAAa,QAEpB;AACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuzaki13/react-foundation-lib",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Reusable React and TypeScript foundation utilities, hooks, and primitives.",
5
5
  "license": "MIT",
6
6
  "author": "Ryuzaki13",