@taiga-ui/core 2.29.0 → 2.30.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.
Files changed (54) hide show
  1. package/bundles/taiga-ui-core-components-dialog.umd.js +1 -1
  2. package/bundles/taiga-ui-core-components-dialog.umd.min.js +1 -1
  3. package/bundles/taiga-ui-core-components-dialog.umd.min.js.map +1 -1
  4. package/bundles/taiga-ui-core-components-hints-host.umd.js +1 -0
  5. package/bundles/taiga-ui-core-components-hints-host.umd.js.map +1 -1
  6. package/bundles/taiga-ui-core-components-hints-host.umd.min.js.map +1 -1
  7. package/bundles/taiga-ui-core-constants.umd.js +2 -2
  8. package/bundles/taiga-ui-core-constants.umd.js.map +1 -1
  9. package/bundles/taiga-ui-core-constants.umd.min.js +1 -1
  10. package/bundles/taiga-ui-core-constants.umd.min.js.map +1 -1
  11. package/bundles/taiga-ui-core-utils-format.umd.js +37 -5
  12. package/bundles/taiga-ui-core-utils-format.umd.js.map +1 -1
  13. package/bundles/taiga-ui-core-utils-format.umd.min.js +1 -1
  14. package/bundles/taiga-ui-core-utils-format.umd.min.js.map +1 -1
  15. package/components/dialog/taiga-ui-core-components-dialog.metadata.json +1 -1
  16. package/constants/taiga-ui-core-constants.metadata.json +1 -1
  17. package/constants/version.d.ts +1 -1
  18. package/esm2015/components/dialog/dialog.component.js +1 -1
  19. package/esm2015/components/hints-host/hint-box/hint-box.component.js +2 -1
  20. package/esm2015/constants/regexp.js +2 -2
  21. package/esm2015/constants/version.js +2 -2
  22. package/esm2015/utils/format/format-number.js +5 -6
  23. package/esm2015/utils/format/get-fractional-part-padded.js +15 -0
  24. package/esm2015/utils/format/index.js +3 -1
  25. package/esm2015/utils/format/number-to-string-without-exp.js +18 -0
  26. package/esm5/components/dialog/dialog.component.js +1 -1
  27. package/esm5/components/hints-host/hint-box/hint-box.component.js +2 -1
  28. package/esm5/constants/regexp.js +2 -2
  29. package/esm5/constants/version.js +2 -2
  30. package/esm5/utils/format/format-number.js +5 -6
  31. package/esm5/utils/format/get-fractional-part-padded.js +16 -0
  32. package/esm5/utils/format/index.js +3 -1
  33. package/esm5/utils/format/number-to-string-without-exp.js +19 -0
  34. package/fesm2015/taiga-ui-core-components-dialog.js +1 -1
  35. package/fesm2015/taiga-ui-core-components-hints-host.js +1 -0
  36. package/fesm2015/taiga-ui-core-components-hints-host.js.map +1 -1
  37. package/fesm2015/taiga-ui-core-constants.js +2 -2
  38. package/fesm2015/taiga-ui-core-constants.js.map +1 -1
  39. package/fesm2015/taiga-ui-core-utils-format.js +36 -6
  40. package/fesm2015/taiga-ui-core-utils-format.js.map +1 -1
  41. package/fesm5/taiga-ui-core-components-dialog.js +1 -1
  42. package/fesm5/taiga-ui-core-components-hints-host.js +1 -0
  43. package/fesm5/taiga-ui-core-components-hints-host.js.map +1 -1
  44. package/fesm5/taiga-ui-core-constants.js +2 -2
  45. package/fesm5/taiga-ui-core-constants.js.map +1 -1
  46. package/fesm5/taiga-ui-core-utils-format.js +36 -6
  47. package/fesm5/taiga-ui-core-utils-format.js.map +1 -1
  48. package/package.json +3 -3
  49. package/styles/taiga-ui-theme.less +1 -0
  50. package/styles/theme/dialog.less +13 -0
  51. package/utils/format/get-fractional-part-padded.d.ts +8 -0
  52. package/utils/format/index.d.ts +2 -0
  53. package/utils/format/number-to-string-without-exp.d.ts +7 -0
  54. package/utils/format/taiga-ui-core-utils-format.metadata.json +1 -1
@@ -12,6 +12,38 @@ function capitalize(value) {
12
12
  return value.toLowerCase().replace(/(?:^|\s)\S/g, function (char) { return char.toUpperCase(); });
13
13
  }
14
14
 
15
+ /**
16
+ * Convert number to string with replacing exponent part on decimals
17
+ *
18
+ * @param value the number
19
+ * @return string representation of a number
20
+ */
21
+ function numberToStringWithoutExp(value) {
22
+ var valueAsString = String(value);
23
+ var _a = __read(valueAsString.split('e-'), 2), numberPart = _a[0], expPart = _a[1];
24
+ var valueWithoutExp = valueAsString;
25
+ if (expPart) {
26
+ var _b = __read(numberPart.split('.'), 2), fractionalPart = _b[1];
27
+ var decimalDigits = Number(expPart) + ((fractionalPart === null || fractionalPart === void 0 ? void 0 : fractionalPart.length) || 0);
28
+ valueWithoutExp = value.toFixed(decimalDigits);
29
+ }
30
+ return valueWithoutExp;
31
+ }
32
+
33
+ /**
34
+ * Return fractional part of number
35
+ *
36
+ * @param value the number
37
+ * @param precision number of digits of decimal part, null to keep untouched
38
+ * @return the fractional part of number
39
+ */
40
+ function getFractionPartPadded(value, precision) {
41
+ var _a = __read(numberToStringWithoutExp(value).split('.'), 2), _b = _a[1], fractionPartPadded = _b === void 0 ? '' : _b;
42
+ return typeof precision === 'number'
43
+ ? fractionPartPadded.substr(0, precision)
44
+ : fractionPartPadded;
45
+ }
46
+
15
47
  /**
16
48
  * Formats number adding thousand separators and correct decimal separator
17
49
  * padding decimal part with zeroes to given length
@@ -29,15 +61,13 @@ function formatNumber(value, decimalLimit, decimalSeparator, thousandSeparator,
29
61
  if (thousandSeparator === void 0) { thousandSeparator = CHAR_NO_BREAK_SPACE; }
30
62
  if (zeroPadding === void 0) { zeroPadding = true; }
31
63
  var integerPartString = Math.floor(Math.abs(value)).toString();
32
- var fractionPartString = value.toString().split('.')[1] || '';
33
- var fractionPartPadded = fractionPartString;
64
+ var fractionPartPadded = getFractionPartPadded(value, decimalLimit);
34
65
  if (decimalLimit !== null) {
35
66
  var zeroPaddingSize = zeroPadding
36
- ? Math.max(decimalLimit - fractionPartString.length, 0)
67
+ ? Math.max(decimalLimit - fractionPartPadded.length, 0)
37
68
  : 0;
38
- var basePartString = fractionPartString.substr(0, decimalLimit);
39
69
  var zeroPartString = '0'.repeat(zeroPaddingSize);
40
- fractionPartPadded = "" + basePartString + zeroPartString;
70
+ fractionPartPadded = "" + fractionPartPadded + zeroPartString;
41
71
  }
42
72
  var remainder = integerPartString.length % 3;
43
73
  var sign = value < 0 ? '-' : '';
@@ -136,5 +166,5 @@ function tuiPluralizeToICU(pluralize) {
136
166
  * Generated bundle index. Do not edit.
137
167
  */
138
168
 
139
- export { capitalize, formatNumber, formatPhone, otherDecimalSymbol, pluralize, tuiPluralizeToICU };
169
+ export { capitalize, formatNumber, formatPhone, getFractionPartPadded, numberToStringWithoutExp, otherDecimalSymbol, pluralize, tuiPluralizeToICU };
140
170
  //# sourceMappingURL=taiga-ui-core-utils-format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-utils-format.js","sources":["ng://@taiga-ui/core/utils/format/capitalize.ts","ng://@taiga-ui/core/utils/format/format-number.ts","ng://@taiga-ui/core/utils/format/format-phone.ts","ng://@taiga-ui/core/utils/format/other-decimal-symbol.ts","ng://@taiga-ui/core/utils/format/pluralize.ts","ng://@taiga-ui/core/utils/format/pluralize-to-icu.ts","ng://@taiga-ui/core/utils/format/taiga-ui-core-utils-format.ts"],"sourcesContent":["/**\n * Capitalizes a given string, replacing it with a lowercase string and making\n * the first letter of each word uppercase.\n *\n * @param value the input string\n * @return the capitalized string\n */\nexport function capitalize(value: string): string {\n return value.toLowerCase().replace(/(?:^|\\s)\\S/g, char => char.toUpperCase());\n}\n","import {CHAR_NO_BREAK_SPACE} from '@taiga-ui/cdk';\n\n/**\n * Formats number adding thousand separators and correct decimal separator\n * padding decimal part with zeroes to given length\n *\n * @param value the input number\n * @param decimalLimit number of digits of decimal part, null to keep untouched\n * @param decimalSeparator separator between the integer and the decimal part\n * @param thousandSeparator separator between thousands\n * @param zeroPadding enable zeros at the end of decimal part\n * @return the formatted string\n */\nexport function formatNumber(\n value: number,\n decimalLimit: number | null = null,\n decimalSeparator: string = ',',\n thousandSeparator: string = CHAR_NO_BREAK_SPACE,\n zeroPadding: boolean = true,\n): string {\n const integerPartString = Math.floor(Math.abs(value)).toString();\n const fractionPartString = value.toString().split('.')[1] || '';\n let fractionPartPadded = fractionPartString;\n\n if (decimalLimit !== null) {\n const zeroPaddingSize: number = zeroPadding\n ? Math.max(decimalLimit - fractionPartString.length, 0)\n : 0;\n const basePartString = fractionPartString.substr(0, decimalLimit);\n const zeroPartString = '0'.repeat(zeroPaddingSize);\n\n fractionPartPadded = `${basePartString}${zeroPartString}`;\n }\n\n const remainder = integerPartString.length % 3;\n const sign = value < 0 ? '-' : '';\n let result = sign + integerPartString.charAt(0);\n\n for (let i = 1; i < integerPartString.length; i++) {\n if (i % 3 === remainder && integerPartString.length > 3) {\n result += thousandSeparator;\n }\n\n result += integerPartString.charAt(i);\n }\n\n return !!fractionPartPadded || decimalLimit\n ? result + decimalSeparator + fractionPartPadded\n : result;\n}\n","/**\n * Formats a string with the phone format +7XXXXXXXXXXXX or XXXXXXXXXXXX,\n * adding parentheses and hyphens.\n *\n * @param value the input string\n * @param countryCode a country code\n * @param phoneMask a phone number mask\n * @return the formatted phone string of the form +7 XXX XXX-XX-XX\n */\nexport function formatPhone(\n value: string,\n countryCode: string,\n phoneMask: string,\n): string {\n if (!value) {\n return '';\n }\n\n let result = countryCode;\n\n countryCode = countryCode.replace(/[()]/g, '');\n\n if (!value.startsWith(countryCode)) {\n value = countryCode + value.replace('+', '');\n }\n\n const splitPhoneMask = phoneMask.split('');\n const splitValue = value.slice(countryCode.length).split('');\n\n result += ' ';\n\n if (splitValue.length === 0) {\n return result;\n }\n\n for (let i = 0; i < splitPhoneMask.length; i++) {\n if (splitValue.length === 0) {\n break;\n }\n\n if (splitPhoneMask[i] === '#') {\n result += splitValue[0] || '';\n splitValue.splice(0, 1);\n } else {\n result += splitPhoneMask[i];\n }\n }\n\n return result;\n}\n","import {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\nexport function otherDecimalSymbol(symbol: TuiDecimalSymbol): TuiDecimalSymbol {\n return symbol === '.' ? ',' : '.';\n}\n","import {TuiPluralize} from '@taiga-ui/core/types';\n\n/**\n * Selects the correct plural form to display.\n *\n * @param value the input number\n * @param args an array of three plural forms, e.g. ['год', 'года', 'лет']\n * @deprecated This implementation targets Russian.\n * Use https://angular.io/api/common/NgPlural for your implementations.\n */\nexport function pluralize(value: number, [one, few, many]: TuiPluralize): string {\n const ten = value % 10;\n const hundred = value % 100;\n\n // 1, 21, 101, 121, но не 11, 111, 211...\n if (ten === 1 && hundred !== 11) {\n return one;\n }\n\n // 2, 3, 4, 22, 33, 44, 152, 163, 174, но не 12, 13, 14, 112, 213, 314...\n if (ten >= 2 && ten <= 4 && (hundred < 10 || hundred >= 20)) {\n return few;\n }\n\n return many;\n}\n","import {TuiPluralize} from '@taiga-ui/core/types';\n\n// TODO: remove in 3.0\n\n/**\n * Temporary util for mapping TuiPluralize array to ICU format\n */\nexport function tuiPluralizeToICU(pluralize: TuiPluralize): Record<string, string> {\n return {\n one: pluralize[0],\n few: pluralize[1],\n many: pluralize[2],\n other: pluralize[2],\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;;;;SAOgB,UAAU,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,WAAW,EAAE,GAAA,CAAC,CAAC;AAClF;;ACPA;;;;;;;;;;;SAWgB,YAAY,CACxB,KAAa,EACb,YAAkC,EAClC,gBAA8B,EAC9B,iBAA+C,EAC/C,WAA2B;IAH3B,6BAAA,EAAA,mBAAkC;IAClC,iCAAA,EAAA,sBAA8B;IAC9B,kCAAA,EAAA,uCAA+C;IAC/C,4BAAA,EAAA,kBAA2B;IAE3B,IAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACjE,IAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAChE,IAAI,kBAAkB,GAAG,kBAAkB,CAAC;IAE5C,IAAI,YAAY,KAAK,IAAI,EAAE;QACvB,IAAM,eAAe,GAAW,WAAW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,GAAG,IAAI,CAAC,KAAK,OAAO,GAAG,EAAE,IAAI,OAAO,IAAI,EAAE,CAAC,EAAE;QACzD,OAAO,GAAG,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AAChB;;ACvBA;AAEA;;;SAGgB,iBAAiB,CAAC,SAAuB;IACrD,OAAO;QACH,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;QACjB,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;QACjB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAClB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;KACtB,CAAC;AACN;;ACdA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-utils-format.js","sources":["ng://@taiga-ui/core/utils/format/capitalize.ts","ng://@taiga-ui/core/utils/format/number-to-string-without-exp.ts","ng://@taiga-ui/core/utils/format/get-fractional-part-padded.ts","ng://@taiga-ui/core/utils/format/format-number.ts","ng://@taiga-ui/core/utils/format/format-phone.ts","ng://@taiga-ui/core/utils/format/other-decimal-symbol.ts","ng://@taiga-ui/core/utils/format/pluralize.ts","ng://@taiga-ui/core/utils/format/pluralize-to-icu.ts","ng://@taiga-ui/core/utils/format/taiga-ui-core-utils-format.ts"],"sourcesContent":["/**\n * Capitalizes a given string, replacing it with a lowercase string and making\n * the first letter of each word uppercase.\n *\n * @param value the input string\n * @return the capitalized string\n */\nexport function capitalize(value: string): string {\n return value.toLowerCase().replace(/(?:^|\\s)\\S/g, char => char.toUpperCase());\n}\n","/**\n * Convert number to string with replacing exponent part on decimals\n *\n * @param value the number\n * @return string representation of a number\n */\nexport function numberToStringWithoutExp(value: number): string {\n const valueAsString = String(value);\n const [numberPart, expPart] = valueAsString.split('e-');\n\n let valueWithoutExp = valueAsString;\n\n if (expPart) {\n const [, fractionalPart] = numberPart.split('.');\n const decimalDigits = Number(expPart) + (fractionalPart?.length || 0);\n\n valueWithoutExp = value.toFixed(decimalDigits);\n }\n\n return valueWithoutExp;\n}\n","import {numberToStringWithoutExp} from './number-to-string-without-exp';\n\n/**\n * Return fractional part of number\n *\n * @param value the number\n * @param precision number of digits of decimal part, null to keep untouched\n * @return the fractional part of number\n */\nexport function getFractionPartPadded(value: number, precision?: number | null): string {\n const [, fractionPartPadded = ''] = numberToStringWithoutExp(value).split('.');\n\n return typeof precision === 'number'\n ? fractionPartPadded.substr(0, precision)\n : fractionPartPadded;\n}\n","import {CHAR_NO_BREAK_SPACE} from '@taiga-ui/cdk';\n\nimport {getFractionPartPadded} from './get-fractional-part-padded';\n\n/**\n * Formats number adding thousand separators and correct decimal separator\n * padding decimal part with zeroes to given length\n *\n * @param value the input number\n * @param decimalLimit number of digits of decimal part, null to keep untouched\n * @param decimalSeparator separator between the integer and the decimal part\n * @param thousandSeparator separator between thousands\n * @param zeroPadding enable zeros at the end of decimal part\n * @return the formatted string\n */\nexport function formatNumber(\n value: number,\n decimalLimit: number | null = null,\n decimalSeparator: string = ',',\n thousandSeparator: string = CHAR_NO_BREAK_SPACE,\n zeroPadding: boolean = true,\n): string {\n const integerPartString = Math.floor(Math.abs(value)).toString();\n\n let fractionPartPadded = getFractionPartPadded(value, decimalLimit);\n\n if (decimalLimit !== null) {\n const zeroPaddingSize: number = zeroPadding\n ? Math.max(decimalLimit - fractionPartPadded.length, 0)\n : 0;\n const zeroPartString = '0'.repeat(zeroPaddingSize);\n\n fractionPartPadded = `${fractionPartPadded}${zeroPartString}`;\n }\n\n const remainder = integerPartString.length % 3;\n const sign = value < 0 ? '-' : '';\n let result = sign + integerPartString.charAt(0);\n\n for (let i = 1; i < integerPartString.length; i++) {\n if (i % 3 === remainder && integerPartString.length > 3) {\n result += thousandSeparator;\n }\n\n result += integerPartString.charAt(i);\n }\n\n return !!fractionPartPadded || decimalLimit\n ? result + decimalSeparator + fractionPartPadded\n : result;\n}\n","/**\n * Formats a string with the phone format +7XXXXXXXXXXXX or XXXXXXXXXXXX,\n * adding parentheses and hyphens.\n *\n * @param value the input string\n * @param countryCode a country code\n * @param phoneMask a phone number mask\n * @return the formatted phone string of the form +7 XXX XXX-XX-XX\n */\nexport function formatPhone(\n value: string,\n countryCode: string,\n phoneMask: string,\n): string {\n if (!value) {\n return '';\n }\n\n let result = countryCode;\n\n countryCode = countryCode.replace(/[()]/g, '');\n\n if (!value.startsWith(countryCode)) {\n value = countryCode + value.replace('+', '');\n }\n\n const splitPhoneMask = phoneMask.split('');\n const splitValue = value.slice(countryCode.length).split('');\n\n result += ' ';\n\n if (splitValue.length === 0) {\n return result;\n }\n\n for (let i = 0; i < splitPhoneMask.length; i++) {\n if (splitValue.length === 0) {\n break;\n }\n\n if (splitPhoneMask[i] === '#') {\n result += splitValue[0] || '';\n splitValue.splice(0, 1);\n } else {\n result += splitPhoneMask[i];\n }\n }\n\n return result;\n}\n","import {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\nexport function otherDecimalSymbol(symbol: TuiDecimalSymbol): TuiDecimalSymbol {\n return symbol === '.' ? ',' : '.';\n}\n","import {TuiPluralize} from '@taiga-ui/core/types';\n\n/**\n * Selects the correct plural form to display.\n *\n * @param value the input number\n * @param args an array of three plural forms, e.g. ['год', 'года', 'лет']\n * @deprecated This implementation targets Russian.\n * Use https://angular.io/api/common/NgPlural for your implementations.\n */\nexport function pluralize(value: number, [one, few, many]: TuiPluralize): string {\n const ten = value % 10;\n const hundred = value % 100;\n\n // 1, 21, 101, 121, но не 11, 111, 211...\n if (ten === 1 && hundred !== 11) {\n return one;\n }\n\n // 2, 3, 4, 22, 33, 44, 152, 163, 174, но не 12, 13, 14, 112, 213, 314...\n if (ten >= 2 && ten <= 4 && (hundred < 10 || hundred >= 20)) {\n return few;\n }\n\n return many;\n}\n","import {TuiPluralize} from '@taiga-ui/core/types';\n\n// TODO: remove in 3.0\n\n/**\n * Temporary util for mapping TuiPluralize array to ICU format\n */\nexport function tuiPluralizeToICU(pluralize: TuiPluralize): Record<string, string> {\n return {\n one: pluralize[0],\n few: pluralize[1],\n many: pluralize[2],\n other: pluralize[2],\n };\n}\n","/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KAAK,CAAC,IAAI,OAAO,KAAK,EAAE,EAAE;QAC7B,OAAO,GAAG,CAAC;KACd;;IAGD,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,OAAO,GAAG,EAAE,IAAI,OAAO,IAAI,EAAE,CAAC,EAAE;QACzD,OAAO,GAAG,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AAChB;;ACvBA;AAEA;;;SAGgB,iBAAiB,CAAC,SAAuB;IACrD,OAAO;QACH,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;QACjB,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;QACjB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAClB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;KACtB,CAAC;AACN;;ACdA;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ui/core",
3
- "version": "2.29.0",
3
+ "version": "2.30.0",
4
4
  "description": "Core library for creating Angular components and applications using Taiga UI",
5
5
  "keywords": [
6
6
  "angular",
@@ -16,11 +16,11 @@
16
16
  "homepage": "https://github.com/tinkoff/taiga-ui",
17
17
  "schematics": "./schematics/collection.json",
18
18
  "dependencies": {
19
- "@taiga-ui/i18n": "2.29.0",
19
+ "@taiga-ui/i18n": "2.30.0",
20
20
  "tslib": "^1.10.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@taiga-ui/cdk": "2.29.0",
23
+ "@taiga-ui/cdk": "2.30.0",
24
24
  "@angular/animations": ">=9.0.0",
25
25
  "@angular/common": ">=9.0.0",
26
26
  "@angular/core": ">=9.0.0",
@@ -1,3 +1,4 @@
1
1
  @import 'theme/fonts.css';
2
+ @import 'theme/dialog.less';
2
3
  @import 'theme/variables.less';
3
4
  @import 'theme/wrapper.less';
@@ -0,0 +1,13 @@
1
+ @import '../mixins/mixins';
2
+
3
+ tui-root:not(._mobile) tui-dialog-host > section {
4
+ .customize-scroll();
5
+
6
+ &::-webkit-scrollbar-thumb {
7
+ background-color: rgba(168, 168, 168, 0.5);
8
+
9
+ &:hover {
10
+ background-color: rgba(204, 204, 204, 0.5);
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Return fractional part of number
3
+ *
4
+ * @param value the number
5
+ * @param precision number of digits of decimal part, null to keep untouched
6
+ * @return the fractional part of number
7
+ */
8
+ export declare function getFractionPartPadded(value: number, precision?: number | null): string;
@@ -1,6 +1,8 @@
1
1
  export * from './capitalize';
2
2
  export * from './format-number';
3
3
  export * from './format-phone';
4
+ export * from './get-fractional-part-padded';
5
+ export * from './number-to-string-without-exp';
4
6
  export * from './other-decimal-symbol';
5
7
  export * from './pluralize';
6
8
  export * from './pluralize-to-icu';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Convert number to string with replacing exponent part on decimals
3
+ *
4
+ * @param value the number
5
+ * @return string representation of a number
6
+ */
7
+ export declare function numberToStringWithoutExp(value: number): string;
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"capitalize":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"toLowerCase"}},"member":"replace"},"arguments":[{"__symbolic":"error","message":"Expression form not supported","line":8,"character":39,"module":"./capitalize"},{"__symbolic":"error","message":"Lambda not supported","line":8,"character":54,"module":"./capitalize"}]}},"formatNumber":{"__symbolic":"function"},"formatPhone":{"__symbolic":"function"},"otherDecimalSymbol":{"__symbolic":"function","parameters":["symbol"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"symbol"},"right":"."},"thenExpression":",","elseExpression":"."}},"pluralize":{"__symbolic":"function"},"tuiPluralizeToICU":{"__symbolic":"function","parameters":["pluralize"],"value":{"one":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":0},"few":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":1},"many":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":2},"other":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":2}}}},"origins":{"capitalize":"./capitalize","formatNumber":"./format-number","formatPhone":"./format-phone","otherDecimalSymbol":"./other-decimal-symbol","pluralize":"./pluralize","tuiPluralizeToICU":"./pluralize-to-icu"},"importAs":"@taiga-ui/core/utils/format"}
1
+ {"__symbolic":"module","version":4,"metadata":{"capitalize":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"toLowerCase"}},"member":"replace"},"arguments":[{"__symbolic":"error","message":"Expression form not supported","line":8,"character":39,"module":"./capitalize"},{"__symbolic":"error","message":"Lambda not supported","line":8,"character":54,"module":"./capitalize"}]}},"formatNumber":{"__symbolic":"function"},"formatPhone":{"__symbolic":"function"},"getFractionPartPadded":{"__symbolic":"function"},"numberToStringWithoutExp":{"__symbolic":"function"},"otherDecimalSymbol":{"__symbolic":"function","parameters":["symbol"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"symbol"},"right":"."},"thenExpression":",","elseExpression":"."}},"pluralize":{"__symbolic":"function"},"tuiPluralizeToICU":{"__symbolic":"function","parameters":["pluralize"],"value":{"one":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":0},"few":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":1},"many":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":2},"other":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"pluralize"},"index":2}}}},"origins":{"capitalize":"./capitalize","formatNumber":"./format-number","formatPhone":"./format-phone","getFractionPartPadded":"./get-fractional-part-padded","numberToStringWithoutExp":"./number-to-string-without-exp","otherDecimalSymbol":"./other-decimal-symbol","pluralize":"./pluralize","tuiPluralizeToICU":"./pluralize-to-icu"},"importAs":"@taiga-ui/core/utils/format"}