@empathyco/x-components 6.3.2 → 7.0.1

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 (51) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/core/index.js +0 -1
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-adapter-platform.platformnextquery.md +1 -1
  5. package/docs/API-reference/api/x-adapter-platform.platformnextquery.source.md +1 -1
  6. package/docs/API-reference/api/x-adapter-platform.platformrelatedtag.md +1 -1
  7. package/docs/API-reference/api/x-adapter-platform.platformrelatedtag.source.md +1 -1
  8. package/docs/API-reference/api/x-components.basecurrency.md +10 -25
  9. package/docs/API-reference/api/x-components.basepricefilterlabel.md +4 -6
  10. package/docs/API-reference/api/x-components.baseresultcurrentprice.md +9 -3
  11. package/docs/API-reference/api/x-components.baseresultpreviousprice.md +9 -3
  12. package/docs/API-reference/api/x-components.md +0 -15
  13. package/docs/API-reference/components/common/currency/x-components.base-currency.md +47 -140
  14. package/docs/API-reference/components/common/filters/labels/x-components.base-price-filter-label.md +43 -8
  15. package/docs/API-reference/components/common/result/x-components.base-result-current-price.md +30 -7
  16. package/docs/API-reference/components/common/result/x-components.base-result-previous-price.md +33 -7
  17. package/js/components/currency/base-currency.vue.js +5 -8
  18. package/js/components/currency/base-currency.vue.js.map +1 -1
  19. package/js/components/currency/base-currency.vue2.js +21 -63
  20. package/js/components/currency/base-currency.vue2.js.map +1 -1
  21. package/js/components/filters/labels/base-price-filter-label.vue.js +15 -4
  22. package/js/components/filters/labels/base-price-filter-label.vue.js.map +1 -1
  23. package/js/components/result/base-result-current-price.vue.js +2 -1
  24. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  25. package/js/components/result/base-result-current-price.vue2.js +9 -13
  26. package/js/components/result/base-result-current-price.vue2.js.map +1 -1
  27. package/js/components/result/base-result-previous-price.vue.js +2 -1
  28. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  29. package/js/components/result/base-result-previous-price.vue2.js +9 -12
  30. package/js/components/result/base-result-previous-price.vue2.js.map +1 -1
  31. package/js/index.js +0 -1
  32. package/js/index.js.map +1 -1
  33. package/package.json +3 -3
  34. package/report/x-adapter-platform.api.json +2 -2
  35. package/report/x-components.api.json +294 -85
  36. package/report/x-components.api.md +33 -20
  37. package/types/src/components/currency/base-currency.vue.d.ts +27 -43
  38. package/types/src/components/currency/base-currency.vue.d.ts.map +1 -1
  39. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts +26 -8
  40. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
  41. package/types/src/components/result/base-result-current-price.vue.d.ts +21 -27
  42. package/types/src/components/result/base-result-current-price.vue.d.ts.map +1 -1
  43. package/types/src/components/result/base-result-previous-price.vue.d.ts +21 -25
  44. package/types/src/components/result/base-result-previous-price.vue.d.ts.map +1 -1
  45. package/types/src/utils/index.d.ts +0 -1
  46. package/types/src/utils/index.d.ts.map +1 -1
  47. package/docs/API-reference/api/x-components.currencyformatter.md +0 -76
  48. package/js/utils/currency-formatter.js +0 -121
  49. package/js/utils/currency-formatter.js.map +0 -1
  50. package/types/src/utils/currency-formatter.d.ts +0 -30
  51. package/types/src/utils/currency-formatter.d.ts.map +0 -1
@@ -634,26 +634,32 @@ buttonClass: StringConstructor;
634
634
  BaseEventButton: DefineComponent< {}, {}, any>;
635
635
  }, {}, string, ComponentProvideOptions, true, {}, any>;
636
636
 
637
- // @public
637
+ // @public (undocumented)
638
638
  export const BaseCurrency: DefineComponent<ExtractPropTypes< {
639
639
  value: {
640
640
  type: NumberConstructor;
641
641
  required: true;
642
642
  };
643
+ currency: StringConstructor;
643
644
  format: {
644
- type: StringConstructor;
645
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
646
+ default: () => {};
645
647
  };
646
648
  }>, {
647
- currency: ComputedRef<string>;
649
+ currencyText: ComputedRef<string>;
648
650
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
649
651
  value: {
650
652
  type: NumberConstructor;
651
653
  required: true;
652
654
  };
655
+ currency: StringConstructor;
653
656
  format: {
654
- type: StringConstructor;
657
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
658
+ default: () => {};
655
659
  };
656
- }>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
660
+ }>> & Readonly<{}>, {
661
+ format: Omit<Intl.NumberFormatOptions, "currency" | "style">;
662
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
657
663
 
658
664
  // @public
659
665
  export const BaseDropdown: DefineComponent<ExtractPropTypes< {
@@ -1120,9 +1126,8 @@ range: RangeValue;
1120
1126
  }>;
1121
1127
  required: true;
1122
1128
  };
1123
- format: {
1124
- type: StringConstructor;
1125
- };
1129
+ currency: StringConstructor;
1130
+ format: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
1126
1131
  lessThan: {
1127
1132
  type: StringConstructor;
1128
1133
  required: true;
@@ -1144,9 +1149,8 @@ range: RangeValue;
1144
1149
  }>;
1145
1150
  required: true;
1146
1151
  };
1147
- format: {
1148
- type: StringConstructor;
1149
- };
1152
+ currency: StringConstructor;
1153
+ format: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
1150
1154
  lessThan: {
1151
1155
  type: StringConstructor;
1152
1156
  required: true;
@@ -1224,8 +1228,10 @@ result: {
1224
1228
  type: PropType<Result>;
1225
1229
  required: true;
1226
1230
  };
1231
+ currency: StringConstructor;
1227
1232
  format: {
1228
- type: StringConstructor;
1233
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
1234
+ default: () => {};
1229
1235
  };
1230
1236
  }>, {
1231
1237
  dynamicClasses: ComputedRef<VueCSSClasses>;
@@ -1234,10 +1240,14 @@ result: {
1234
1240
  type: PropType<Result>;
1235
1241
  required: true;
1236
1242
  };
1243
+ currency: StringConstructor;
1237
1244
  format: {
1238
- type: StringConstructor;
1245
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
1246
+ default: () => {};
1239
1247
  };
1240
- }>> & Readonly<{}>, {}, {}, {
1248
+ }>> & Readonly<{}>, {
1249
+ format: Omit<Intl.NumberFormatOptions, "currency" | "style">;
1250
+ }, {}, {
1241
1251
  BaseCurrency: DefineComponent< {}, {}, any>;
1242
1252
  }, {}, string, ComponentProvideOptions, true, {}, any>;
1243
1253
 
@@ -1312,18 +1322,24 @@ result: {
1312
1322
  type: PropType<Result>;
1313
1323
  required: true;
1314
1324
  };
1325
+ currency: StringConstructor;
1315
1326
  format: {
1316
- type: StringConstructor;
1327
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
1328
+ default: () => {};
1317
1329
  };
1318
1330
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
1319
1331
  result: {
1320
1332
  type: PropType<Result>;
1321
1333
  required: true;
1322
1334
  };
1335
+ currency: StringConstructor;
1323
1336
  format: {
1324
- type: StringConstructor;
1337
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
1338
+ default: () => {};
1325
1339
  };
1326
- }>> & Readonly<{}>, {}, {}, {
1340
+ }>> & Readonly<{}>, {
1341
+ format: Omit<Intl.NumberFormatOptions, "currency" | "style">;
1342
+ }, {}, {
1327
1343
  BaseCurrency: DefineComponent< {}, {}, any>;
1328
1344
  }, {}, string, ComponentProvideOptions, true, {}, any>;
1329
1345
 
@@ -2115,9 +2131,6 @@ export { CuratedCheckTinyFilledIcon }
2115
2131
 
2116
2132
  export { CuratedCheckTinyIcon }
2117
2133
 
2118
- // @public
2119
- export function currencyFormatter(value: number, format?: string): string;
2120
-
2121
2134
  // @public
2122
2135
  export function debounce<Payload>(wire: Wire<Payload>, timeInMs: TimeSelector | number, options?: TimedWireOperatorOptions): Wire<Payload>;
2123
2136
 
@@ -1,40 +1,4 @@
1
- /**
2
- * Renders the value received as a property which always must be a JavaScript number, with the
3
- * proper format provided as a string property or by injection. The rendered tag is a span in
4
- * order to render a default inline HTML element.
5
- *
6
- * Regarding the format or mask to be defined as string:
7
- * - Use 'i' to define integer numbers.
8
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
9
- * format doesn't include decimals, it is filled with zeros until reach the length defined with
10
- * 'd's.
11
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
12
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
13
- * than one character.
14
- * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the
15
- * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).
16
- * - Set whatever you need around the integers and decimals marks.
17
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
18
- *
19
- * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length
20
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
21
- * part, it deletes significant digits.
22
- *
23
- * Basic example:
24
- *
25
- * ```vue
26
- * <BaseCurrency
27
- * :value="123456.789"
28
- * format="i.iiii,dddd €"
29
- * />
30
- * ```
31
- *
32
- * It will render: `123.456,7890 €`.
33
- *
34
- * See docs below for more examples.
35
- *
36
- * @public
37
- */
1
+ import type { PropType } from 'vue';
38
2
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
39
3
  /**
40
4
  * Numeric value to be formatted.
@@ -49,15 +13,24 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
49
13
  required: true;
50
14
  };
51
15
  /**
52
- * The format as string.
16
+ * The ISO 4217 currency value. If not specified we use snippetConfig.currency
17
+ *
18
+ * @public
19
+ */
20
+ currency: StringConstructor;
21
+ /**
22
+ * The currency format possibilities from Intl.NumberFormatOptions.
23
+ * Allows customization of decimal places, grouping, etc.
24
+ * Note: 'currency' and 'style' options are managed internally.
53
25
  *
54
26
  * @public
55
27
  */
56
28
  format: {
57
- type: StringConstructor;
29
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
30
+ default: () => {};
58
31
  };
59
32
  }>, {
60
- currency: import("vue").ComputedRef<string>;
33
+ currencyText: import("vue").ComputedRef<string>;
61
34
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
62
35
  /**
63
36
  * Numeric value to be formatted.
@@ -72,13 +45,24 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
72
45
  required: true;
73
46
  };
74
47
  /**
75
- * The format as string.
48
+ * The ISO 4217 currency value. If not specified we use snippetConfig.currency
49
+ *
50
+ * @public
51
+ */
52
+ currency: StringConstructor;
53
+ /**
54
+ * The currency format possibilities from Intl.NumberFormatOptions.
55
+ * Allows customization of decimal places, grouping, etc.
56
+ * Note: 'currency' and 'style' options are managed internally.
76
57
  *
77
58
  * @public
78
59
  */
79
60
  format: {
80
- type: StringConstructor;
61
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
62
+ default: () => {};
81
63
  };
82
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
64
+ }>> & Readonly<{}>, {
65
+ format: Omit<Intl.NumberFormatOptions, "currency" | "style">;
66
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
83
67
  export default _default;
84
68
  //# sourceMappingURL=base-currency.vue?vue&type=script&lang.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/currency/base-currency.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;IAGC;;;;;;;OAOG;;;;;IAMH;;;;OAIG;;;;;;;IAjBH;;;;;;;OAOG;;;;;IAMH;;;;OAIG;;;;;AAnBP,wBAuDE"}
1
+ {"version":3,"file":"base-currency.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/currency/base-currency.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;;IAK/B;;;;;;;OAOG;;;;;IAMH;;;;OAIG;;IAEH;;;;;;OAMG;;cAEe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;;;;;;IA3BhF;;;;;;;OAOG;;;;;IAMH;;;;OAIG;;IAEH;;;;;;OAMG;;cAEe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;;;;;;AA7BpF,wBAkDE"}
@@ -14,10 +14,19 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
14
14
  }>;
15
15
  required: true;
16
16
  };
17
- /** Configuration for show the label. */
18
- format: {
19
- type: StringConstructor;
20
- };
17
+ /**
18
+ * An ISO 4217 currency value.
19
+ *
20
+ * @public
21
+ */
22
+ currency: StringConstructor;
23
+ /**
24
+ * The currency format possibilities from Intl.NumberFormatOptions.
25
+ * Allows customization of decimal places, grouping, etc.
26
+ *
27
+ * @public
28
+ */
29
+ format: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
21
30
  /**
22
31
  * Message shown when the filter hasn't got the min value defined.
23
32
  *
@@ -55,10 +64,19 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
55
64
  }>;
56
65
  required: true;
57
66
  };
58
- /** Configuration for show the label. */
59
- format: {
60
- type: StringConstructor;
61
- };
67
+ /**
68
+ * An ISO 4217 currency value.
69
+ *
70
+ * @public
71
+ */
72
+ currency: StringConstructor;
73
+ /**
74
+ * The currency format possibilities from Intl.NumberFormatOptions.
75
+ * Allows customization of decimal places, grouping, etc.
76
+ *
77
+ * @public
78
+ */
79
+ format: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
62
80
  /**
63
81
  * Message shown when the filter hasn't got the min value defined.
64
82
  *
@@ -1 +1 @@
1
- {"version":3,"file":"base-price-filter-label.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../../src/components/filters/labels/base-price-filter-label.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAInC;;;;;GAKG;;IAIC,iDAAiD;;cAE/B,QAAQ,CAAC;YAAE,KAAK,EAAE,UAAU,CAAA;SAAE,CAAC;;;IAGjD,wCAAwC;;;;IAIxC;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;IA/BH,iDAAiD;;cAE/B,QAAQ,CAAC;YAAE,KAAK,EAAE,UAAU,CAAA;SAAE,CAAC;;;IAGjD,wCAAwC;;;;IAIxC;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;AAlCP,wBA4EE"}
1
+ {"version":3,"file":"base-price-filter-label.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../../src/components/filters/labels/base-price-filter-label.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAInC;;;;;GAKG;;IAIC,iDAAiD;;cAE/B,QAAQ,CAAC;YAAE,KAAK,EAAE,UAAU,CAAA;SAAE,CAAC;;;IAGjD;;;;OAIG;;IAEH;;;;;OAKG;YACe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;IAChF;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;IAxCH,iDAAiD;;cAE/B,QAAQ,CAAC;YAAE,KAAK,EAAE,UAAU,CAAA;SAAE,CAAC;;;IAGjD;;;;OAIG;;IAEH;;;;;OAKG;YACe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;IAChF;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;AA3CP,wBAuFE"}
@@ -18,24 +18,20 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
18
18
  required: true;
19
19
  };
20
20
  /**
21
- * Format or mask to be defined as string.
22
- * - Use 'i' to define integer numbers.
23
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
24
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
25
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
26
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
27
- * than one character.
28
- * - Set whatever you need around the integers and decimals marks.
29
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
21
+ * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
30
22
  *
31
- * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length
32
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
33
- * part, delete significant digits.
23
+ * @public
24
+ */
25
+ currency: StringConstructor;
26
+ /**
27
+ * The currency format possibilities from Intl.NumberFormatOptions.
28
+ * Allows customization of decimal places, grouping, etc.
34
29
  *
35
30
  * @public
36
31
  */
37
32
  format: {
38
- type: StringConstructor;
33
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
34
+ default: () => {};
39
35
  };
40
36
  }>, {
41
37
  dynamicClasses: import("vue").ComputedRef<VueCSSClasses>;
@@ -50,26 +46,24 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
50
46
  required: true;
51
47
  };
52
48
  /**
53
- * Format or mask to be defined as string.
54
- * - Use 'i' to define integer numbers.
55
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
56
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
57
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
58
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
59
- * than one character.
60
- * - Set whatever you need around the integers and decimals marks.
61
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
49
+ * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
62
50
  *
63
- * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length
64
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
65
- * part, delete significant digits.
51
+ * @public
52
+ */
53
+ currency: StringConstructor;
54
+ /**
55
+ * The currency format possibilities from Intl.NumberFormatOptions.
56
+ * Allows customization of decimal places, grouping, etc.
66
57
  *
67
58
  * @public
68
59
  */
69
60
  format: {
70
- type: StringConstructor;
61
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
62
+ default: () => {};
71
63
  };
72
- }>> & Readonly<{}>, {}, {}, {
64
+ }>> & Readonly<{}>, {
65
+ format: Omit<Intl.NumberFormatOptions, "currency" | "style">;
66
+ }, {}, {
73
67
  BaseCurrency: import("vue").DefineComponent<{}, {}, any>;
74
68
  }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
75
69
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-current-price.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/result/base-result-current-price.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAItD;;;;;GAKG;;IAIC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;;;;;;;;;;;;;OAgBG;;;;;;;IAzBH;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;;;;;;;;;;;;;OAgBG;;;;;;;AA5BP,wBAiDE"}
1
+ {"version":3,"file":"base-result-current-price.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/result/base-result-current-price.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAItD;;;;;GAKG;;IAIC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;OAIG;;IAEH;;;;;OAKG;;cAEe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;;;;;;IAtBhF;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;OAIG;;IAEH;;;;;OAKG;;cAEe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;;;;;;;;AAzBpF,wBA6CE"}
@@ -16,23 +16,20 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  required: true;
17
17
  };
18
18
  /**
19
- * Format or mask to be defined as string.
20
- * - Use 'i' to define integer numbers.
21
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
22
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
23
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
24
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
25
- * than one character.
26
- * - Set whatever you need around the integers and decimals marks.
19
+ * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
27
20
  *
28
- * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length
29
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
30
- * part, delete significant digits.
21
+ * @public
22
+ */
23
+ currency: StringConstructor;
24
+ /**
25
+ * The currency format possibilities from Intl.NumberFormatOptions.
26
+ * Allows customization of decimal places, grouping, etc.
31
27
  *
32
28
  * @public
33
29
  */
34
30
  format: {
35
- type: StringConstructor;
31
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
32
+ default: () => {};
36
33
  };
37
34
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
38
35
  /**
@@ -45,25 +42,24 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
45
42
  required: true;
46
43
  };
47
44
  /**
48
- * Format or mask to be defined as string.
49
- * - Use 'i' to define integer numbers.
50
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
51
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
52
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
53
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
54
- * than one character.
55
- * - Set whatever you need around the integers and decimals marks.
45
+ * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
56
46
  *
57
- * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length
58
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
59
- * part, delete significant digits.
47
+ * @public
48
+ */
49
+ currency: StringConstructor;
50
+ /**
51
+ * The currency format possibilities from Intl.NumberFormatOptions.
52
+ * Allows customization of decimal places, grouping, etc.
60
53
  *
61
54
  * @public
62
55
  */
63
56
  format: {
64
- type: StringConstructor;
57
+ type: PropType<Omit<Intl.NumberFormatOptions, "currency" | "style">>;
58
+ default: () => {};
65
59
  };
66
- }>> & Readonly<{}>, {}, {}, {
60
+ }>> & Readonly<{}>, {
61
+ format: Omit<Intl.NumberFormatOptions, "currency" | "style">;
62
+ }, {}, {
67
63
  BaseCurrency: import("vue").DefineComponent<{}, {}, any>;
68
64
  }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
69
65
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-previous-price.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/result/base-result-previous-price.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAInC;;;;GAIG;;IAIC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;;;;;;;;;;;;OAeG;;;;;IAxBH;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;;;;;;;;;;;;OAeG;;;;;;;AA3BP,wBAgCE"}
1
+ {"version":3,"file":"base-result-previous-price.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/result/base-result-previous-price.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAInC;;;;GAIG;;IAIC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;OAIG;;IAEH;;;;;OAKG;;cAEe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;;;;IAtBhF;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;;OAIG;;IAEH;;;;;OAKG;;cAEe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;;;;;;;;AAzBpF,wBA6BE"}
@@ -1,7 +1,6 @@
1
1
  export * from './array';
2
2
  export * from './cancellable-promise';
3
3
  export * from './clone';
4
- export * from './currency-formatter';
5
4
  export { debounce as debounceFunction } from './debounce';
6
5
  export * from './filters';
7
6
  export * from './focus';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,uBAAuB,CAAA;AACrC,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,uBAAuB,CAAA;AACrC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,SAAS,CAAA"}
@@ -1,76 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [currencyFormatter](./x-components.currencyformatter.md)
4
-
5
- ## currencyFormatter() function
6
-
7
- Format a value with a given format.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- export declare function currencyFormatter(value: number, format?: string): string;
13
- ```
14
-
15
- ## Parameters
16
-
17
- <table><thead><tr><th>
18
-
19
- Parameter
20
-
21
-
22
- </th><th>
23
-
24
- Type
25
-
26
-
27
- </th><th>
28
-
29
- Description
30
-
31
-
32
- </th></tr></thead>
33
- <tbody><tr><td>
34
-
35
- value
36
-
37
-
38
- </td><td>
39
-
40
- number
41
-
42
-
43
- </td><td>
44
-
45
- Numeric value to be formatted.
46
-
47
-
48
- </td></tr>
49
- <tr><td>
50
-
51
- format
52
-
53
-
54
- </td><td>
55
-
56
- string
57
-
58
-
59
- </td><td>
60
-
61
- _(Optional)_ Format or mask to be defined as string.
62
-
63
-
64
- </td></tr>
65
- </tbody></table>
66
-
67
- **Returns:**
68
-
69
- string
70
-
71
- Formatted number.
72
-
73
- ## Remarks
74
-
75
- Format: - Use 'i' to define integer numbers. - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the doesn't include decimals, it is filled with zeros until reach the length defined with 'd's. - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group. - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more than one character. - Set whatever you need around the integers and decimals marks. - Default mask: 'i.iii,dd' which returns '1.345,67'. - If you want to hide the decimal part if it's zero (non significant), you can add the `?` symbol after the decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`<!-- -->). It defines the value of `hideIntegerDecimals`<!-- -->: - If true (exists) and the value is an integer without decimals, the decimal non significant zeroes are hidden. - If false, the default behaviour will fill with zeros the remaining length until getting the one defined with the 'd's.
76
-
@@ -1,121 +0,0 @@
1
- /**
2
- * Regex to detect the format.
3
- */
4
- const FORMAT_REGEX = /(i([^id]+))?i+(([^id?]+)(d+)(\?)?)?/;
5
- /**
6
- * Format a value with a given format.
7
- *
8
- * @param value - Numeric value to be formatted.
9
- * @param format - Format or mask to be defined as string.
10
- *
11
- * @remarks
12
- * Format:
13
- * - Use 'i' to define integer numbers.
14
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
15
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
16
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
17
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
18
- * than one character.
19
- * - Set whatever you need around the integers and decimals marks.
20
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
21
- * - If you want to hide the decimal part if it's zero (non significant), you can add the `?` symbol
22
- * after the decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of
23
- * `1.234,00`). It defines the value of `hideIntegerDecimals`:
24
- * - If true (exists) and the value is an integer without decimals, the decimal non significant
25
- * zeroes are hidden.
26
- * - If false, the default behaviour will fill with zeros the remaining length until getting
27
- * the one defined with the 'd's.
28
- *
29
- * @returns Formatted number.
30
- *
31
- * @public
32
- */
33
- function currencyFormatter(value, format = 'i.iii,dd') {
34
- const { integer, decimal } = numberParts(value);
35
- const { decimalSeparator, decimalsNumber, integerSeparator, hideIntegerDecimals } = currencyConfig(format);
36
- const formattedInteger = formatInteger(integer, integerSeparator);
37
- const formattedDecimal = formatDecimal(decimal, {
38
- decimalsNumber,
39
- hideIntegerDecimals,
40
- decimalSeparator,
41
- });
42
- return format.replace(FORMAT_REGEX, `${formattedInteger}${formattedDecimal}`);
43
- }
44
- /**
45
- * Returns the formatted integer part. This computed returns:
46
- * - integer part with the integer separator added.
47
- *
48
- * @param integer - Integer value as a string.
49
- * @param integerSeparator - Separator to apply in the integer side.
50
- *
51
- * The regexp adds the integer separator for each thousand group (each 3 numbers).
52
- *
53
- * @returns Formatted integer.
54
- *
55
- * @internal
56
- */
57
- function formatInteger(integer, integerSeparator) {
58
- return integer.replace(/\B(?=(\d{3})+(?!\d))/g, integerSeparator);
59
- }
60
- /**
61
- * Returns the formatted decimal. This computed returns:
62
- * - decimal part filled with zeros until complete remaining slots defined with the decimal
63
- * length in the format.
64
- * - decimal part truncated. The decimal numbers length, defined with the number of 'd's in the
65
- * format prop. This must MATCH with the number of decimals provided from the adapter.
66
- *
67
- * @param decimal - Decimal part as a string.
68
- * @param CurrencyConfig - From which the `decimalsNumber`, `decimalsSeparator` and
69
- * `hideIntegerDecimals` are obtained.
70
- * @param CurrencyConfig.decimalsNumber - decimalsNumber currency config.
71
- * @param CurrencyConfig.decimalSeparator - decimalSeparator currency config.
72
- * @param CurrencyConfig.hideIntegerDecimals - hideIntegerDecimals currency config.
73
- *
74
- * @returns Formatted integer.
75
- *
76
- * @internal
77
- */
78
- function formatDecimal(decimal, { decimalsNumber, decimalSeparator, hideIntegerDecimals, }) {
79
- return hideIntegerDecimals && !+decimal
80
- ? ''
81
- : `${decimalSeparator}${decimal.padEnd(decimalsNumber, '0').substring(0, decimalsNumber)}`;
82
- }
83
- /**
84
- * Function that divide fhe format passed as value for get integerSeparator, decimalSeparator
85
- * and decimalsNumber.
86
- *
87
- * @param format - Format or mask to apply to the value.
88
- *
89
- * @returns Object with properties of the currency config.
90
- *
91
- * @internal
92
- */
93
- function currencyConfig(format) {
94
- const [, , integerSeparator = '', , decimalSeparator = '', decimals = '', hideIntegerDecimals = '',] = FORMAT_REGEX.exec(format) ?? [];
95
- return {
96
- integerSeparator,
97
- decimalSeparator,
98
- decimalsNumber: decimals.length,
99
- hideIntegerDecimals: !!hideIntegerDecimals,
100
- };
101
- }
102
- /**
103
- * Divide the number in two parts by separator '.', one of them is the integer number and other
104
- * the decimals numbers.
105
- *
106
- * @param value - Numeric value to be formatted.
107
- *
108
- * @returns Parts of number.
109
- *
110
- * @internal
111
- */
112
- function numberParts(value) {
113
- const [integer, decimal = ''] = `${value}`.split('.');
114
- return {
115
- integer,
116
- decimal,
117
- };
118
- }
119
-
120
- export { currencyFormatter };
121
- //# sourceMappingURL=currency-formatter.js.map