@empathyco/x-components 6.3.2 → 7.0.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 (46) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/core/index.js +0 -1
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-components.basecurrency.md +10 -25
  5. package/docs/API-reference/api/x-components.basepricefilterlabel.md +4 -6
  6. package/docs/API-reference/api/x-components.baseresultcurrentprice.md +9 -3
  7. package/docs/API-reference/api/x-components.baseresultpreviousprice.md +9 -3
  8. package/docs/API-reference/api/x-components.md +0 -15
  9. package/docs/API-reference/components/common/currency/x-components.base-currency.md +47 -140
  10. package/docs/API-reference/components/common/filters/labels/x-components.base-price-filter-label.md +43 -8
  11. package/docs/API-reference/components/common/result/x-components.base-result-current-price.md +30 -7
  12. package/docs/API-reference/components/common/result/x-components.base-result-previous-price.md +33 -7
  13. package/js/components/currency/base-currency.vue.js +5 -8
  14. package/js/components/currency/base-currency.vue.js.map +1 -1
  15. package/js/components/currency/base-currency.vue2.js +21 -63
  16. package/js/components/currency/base-currency.vue2.js.map +1 -1
  17. package/js/components/filters/labels/base-price-filter-label.vue.js +15 -4
  18. package/js/components/filters/labels/base-price-filter-label.vue.js.map +1 -1
  19. package/js/components/result/base-result-current-price.vue.js +2 -1
  20. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  21. package/js/components/result/base-result-current-price.vue2.js +9 -13
  22. package/js/components/result/base-result-current-price.vue2.js.map +1 -1
  23. package/js/components/result/base-result-previous-price.vue.js +2 -1
  24. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  25. package/js/components/result/base-result-previous-price.vue2.js +9 -12
  26. package/js/components/result/base-result-previous-price.vue2.js.map +1 -1
  27. package/js/index.js +0 -1
  28. package/js/index.js.map +1 -1
  29. package/package.json +2 -2
  30. package/report/x-components.api.json +294 -85
  31. package/report/x-components.api.md +33 -20
  32. package/types/src/components/currency/base-currency.vue.d.ts +27 -43
  33. package/types/src/components/currency/base-currency.vue.d.ts.map +1 -1
  34. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts +26 -8
  35. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
  36. package/types/src/components/result/base-result-current-price.vue.d.ts +21 -27
  37. package/types/src/components/result/base-result-current-price.vue.d.ts.map +1 -1
  38. package/types/src/components/result/base-result-previous-price.vue.d.ts +21 -25
  39. package/types/src/components/result/base-result-previous-price.vue.d.ts.map +1 -1
  40. package/types/src/utils/index.d.ts +0 -1
  41. package/types/src/utils/index.d.ts.map +1 -1
  42. package/docs/API-reference/api/x-components.currencyformatter.md +0 -76
  43. package/js/utils/currency-formatter.js +0 -121
  44. package/js/utils/currency-formatter.js.map +0 -1
  45. package/types/src/utils/currency-formatter.d.ts +0 -30
  46. package/types/src/utils/currency-formatter.d.ts.map +0 -1
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"file":"currency-formatter.js","sources":["../../../src/utils/currency-formatter.ts"],"sourcesContent":["/**\n * Regex to detect the format.\n */\nconst FORMAT_REGEX = /(i([^id]+))?i+(([^id?]+)(d+)(\\?)?)?/\n\n/**\n * Configuration for format currency.\n */\ninterface CurrencyConfig {\n /** The character between a group of three integer 'i's and the following one. */\n integerSeparator: string\n /**\n * The character between a group of three integer 'i's and the following one. It also\n * supports more than one single character.\n */\n decimalSeparator: string\n /** Length of decimals numbers. It counts the number of 'd's after the integer part. */\n decimalsNumber: number\n /** Boolean value to hide or show the decimal part when it has 0. */\n hideIntegerDecimals: boolean\n}\n\n/**\n * Parts of number: integer and decimal.\n */\ninterface NumberParts {\n /** Integer part of the number as string. */\n integer: string\n /** Decimal part of the number as string. */\n decimal: string\n}\n\n/**\n * Format a value with a given format.\n *\n * @param value - Numeric value to be formatted.\n * @param format - Format or mask to be defined as string.\n *\n * @remarks\n * Format:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n * - If you want to hide the decimal part if it's zero (non significant), you can add the `?` symbol\n * after the decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of\n * `1.234,00`). It defines the value of `hideIntegerDecimals`:\n * - If true (exists) and the value is an integer without decimals, the decimal non significant\n * zeroes are hidden.\n * - If false, the default behaviour will fill with zeros the remaining length until getting\n * the one defined with the 'd's.\n *\n * @returns Formatted number.\n *\n * @public\n */\nexport function currencyFormatter(value: number, format = 'i.iii,dd'): string {\n const { integer, decimal } = numberParts(value)\n const { decimalSeparator, decimalsNumber, integerSeparator, hideIntegerDecimals } =\n currencyConfig(format)\n\n const formattedInteger = formatInteger(integer, integerSeparator)\n const formattedDecimal = formatDecimal(decimal, {\n decimalsNumber,\n hideIntegerDecimals,\n decimalSeparator,\n })\n return format.replace(FORMAT_REGEX, `${formattedInteger}${formattedDecimal}`)\n}\n\n/**\n * Returns the formatted integer part. This computed returns:\n * - integer part with the integer separator added.\n *\n * @param integer - Integer value as a string.\n * @param integerSeparator - Separator to apply in the integer side.\n *\n * The regexp adds the integer separator for each thousand group (each 3 numbers).\n *\n * @returns Formatted integer.\n *\n * @internal\n */\nfunction formatInteger(integer: string, integerSeparator: string): string {\n return integer.replace(/\\B(?=(\\d{3})+(?!\\d))/g, integerSeparator)\n}\n\n/**\n * Returns the formatted decimal. This computed returns:\n * - decimal part filled with zeros until complete remaining slots defined with the decimal\n * length in the format.\n * - decimal part truncated. The decimal numbers length, defined with the number of 'd's in the\n * format prop. This must MATCH with the number of decimals provided from the adapter.\n *\n * @param decimal - Decimal part as a string.\n * @param CurrencyConfig - From which the `decimalsNumber`, `decimalsSeparator` and\n * `hideIntegerDecimals` are obtained.\n * @param CurrencyConfig.decimalsNumber - decimalsNumber currency config.\n * @param CurrencyConfig.decimalSeparator - decimalSeparator currency config.\n * @param CurrencyConfig.hideIntegerDecimals - hideIntegerDecimals currency config.\n *\n * @returns Formatted integer.\n *\n * @internal\n */\nfunction formatDecimal(\n decimal: string,\n {\n decimalsNumber,\n decimalSeparator,\n hideIntegerDecimals,\n }: Omit<CurrencyConfig, 'integerSeparator'>,\n): string {\n return hideIntegerDecimals && !+decimal\n ? ''\n : `${decimalSeparator}${decimal.padEnd(decimalsNumber, '0').substring(0, decimalsNumber)}`\n}\n\n/**\n * Function that divide fhe format passed as value for get integerSeparator, decimalSeparator\n * and decimalsNumber.\n *\n * @param format - Format or mask to apply to the value.\n *\n * @returns Object with properties of the currency config.\n *\n * @internal\n */\nfunction currencyConfig(format: string): CurrencyConfig {\n const [\n ,\n ,\n integerSeparator = '',\n ,\n decimalSeparator = '',\n decimals = '',\n hideIntegerDecimals = '',\n ] = FORMAT_REGEX.exec(format) ?? []\n return {\n integerSeparator,\n decimalSeparator,\n decimalsNumber: decimals.length,\n hideIntegerDecimals: !!hideIntegerDecimals,\n }\n}\n\n/**\n * Divide the number in two parts by separator '.', one of them is the integer number and other\n * the decimals numbers.\n *\n * @param value - Numeric value to be formatted.\n *\n * @returns Parts of number.\n *\n * @internal\n */\nfunction numberParts(value: number): NumberParts {\n const [integer, decimal = ''] = `${value}`.split('.')\n return {\n integer,\n decimal,\n }\n}\n"],"names":[],"mappings":"AAAA;;AAEG;AACH,MAAM,YAAY,GAAG,qCAAqC;AA6B1D;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;SACa,iBAAiB,CAAC,KAAa,EAAE,MAAM,GAAG,UAAU,EAAA;IAClE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC;AAC/C,IAAA,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,GAC/E,cAAc,CAAC,MAAM,CAAC;IAExB,MAAM,gBAAgB,GAAG,aAAa,CAAC,OAAO,EAAE,gBAAgB,CAAC;AACjE,IAAA,MAAM,gBAAgB,GAAG,aAAa,CAAC,OAAO,EAAE;QAC9C,cAAc;QACd,mBAAmB;QACnB,gBAAgB;AACjB,KAAA,CAAC;AACF,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAA,EAAG,gBAAgB,CAAA,EAAG,gBAAgB,CAAA,CAAE,CAAC;AAC/E;AAEA;;;;;;;;;;;;AAYG;AACH,SAAS,aAAa,CAAC,OAAe,EAAE,gBAAwB,EAAA;IAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,gBAAgB,CAAC;AACnE;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACH,SAAS,aAAa,CACpB,OAAe,EACf,EACE,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACsB,EAAA;AAE3C,IAAA,OAAO,mBAAmB,IAAI,CAAC,CAAC;AAC9B,UAAE;UACA,GAAG,gBAAgB,CAAA,EAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE;AAC9F;AAEA;;;;;;;;;AASG;AACH,SAAS,cAAc,CAAC,MAAc,EAAA;AACpC,IAAA,MAAM,KAGJ,gBAAgB,GAAG,EAAE,IAErB,gBAAgB,GAAG,EAAE,EACrB,QAAQ,GAAG,EAAE,EACb,mBAAmB,GAAG,EAAE,EACzB,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;IACnC,OAAO;QACL,gBAAgB;QAChB,gBAAgB;QAChB,cAAc,EAAE,QAAQ,CAAC,MAAM;QAC/B,mBAAmB,EAAE,CAAC,CAAC,mBAAmB;KAC3C;AACH;AAEA;;;;;;;;;AASG;AACH,SAAS,WAAW,CAAC,KAAa,EAAA;AAChC,IAAA,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,EAAE,CAAC,GAAG,CAAA,EAAG,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;IACrD,OAAO;QACL,OAAO;QACP,OAAO;KACR;AACH;;;;"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Format a value with a given format.
3
- *
4
- * @param value - Numeric value to be formatted.
5
- * @param format - Format or mask to be defined as string.
6
- *
7
- * @remarks
8
- * Format:
9
- * - Use 'i' to define integer numbers.
10
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
11
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
12
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
13
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
14
- * than one character.
15
- * - Set whatever you need around the integers and decimals marks.
16
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
17
- * - If you want to hide the decimal part if it's zero (non significant), you can add the `?` symbol
18
- * after the decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of
19
- * `1.234,00`). It defines the value of `hideIntegerDecimals`:
20
- * - If true (exists) and the value is an integer without decimals, the decimal non significant
21
- * zeroes are hidden.
22
- * - If false, the default behaviour will fill with zeros the remaining length until getting
23
- * the one defined with the 'd's.
24
- *
25
- * @returns Formatted number.
26
- *
27
- * @public
28
- */
29
- export declare function currencyFormatter(value: number, format?: string): string;
30
- //# sourceMappingURL=currency-formatter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"currency-formatter.d.ts","sourceRoot":"","sources":["../../../../src/utils/currency-formatter.ts"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAa,GAAG,MAAM,CAY5E"}