@empathyco/x-components
Version:
Empathy X Components
84 lines • 2.87 kB
TypeScript
/**
* Renders the value received as a property which always must be a JavaScript number, with the
* proper format provided as a string property or by injection. The rendered tag is a span in
* order to render a default inline HTML element.
*
* Regarding the format or mask to be defined as string:
* - Use 'i' to define integer numbers.
* - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
* format 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.
* - If you want to hide the decimal part if it's zero, 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`).
* - Set whatever you need around the integers and decimals marks.
* - Default mask: 'i.iii,dd' which returns '1.345,67'.
*
* @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length
* of decimals provided from the adapter. Otherwise, when the component truncate the decimal
* part, it deletes significant digits.
*
* Basic example:
*
* ```vue
* <BaseCurrency
* :value="123456.789"
* format="i.iiii,dddd €"
* />
* ```
*
* It will render: `123.456,7890 €`.
*
* See docs below for more examples.
*
* @public
*/
declare const _default: import("vue").DefineComponent<{
/**
* Numeric value to be formatted.
*
* @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.
* @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.
*
* @public
*/
value: {
type: NumberConstructor;
required: true;
};
/**
* The format as string.
*
* @public
*/
format: {
type: StringConstructor;
};
}, {
currency: import("vue").ComputedRef<string>;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
/**
* Numeric value to be formatted.
*
* @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.
* @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.
*
* @public
*/
value: {
type: NumberConstructor;
required: true;
};
/**
* The format as string.
*
* @public
*/
format: {
type: StringConstructor;
};
}>>, {}, {}>;
export default _default;
//# sourceMappingURL=base-currency.vue?vue&type=script&lang.d.ts.map