import { CustomValidation } from '../form'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers.d'; export type CurrencyFormat = { name?: string; label: string; currency: string; symbol: string; locale: string; }; export interface CurrencyValue { currency: string; // Currency ISO Code value?: number; } /** * Configuration interface for locale-specific settings of the InputCurrency component. */ export interface InputCurrencyLocaleConfig { /** * Error message to display when the input is empty. * * @example '{label} must not be empty' - 'Amount must not be empty' */ emptyInputErrorMessage?: string; } /** * InputCurrency component props */ export interface InputCurrencyProps { /** * Used for two-way data binding outside form integration, or sets initial value for form field. */ modelValue?: CurrencyValue; /** * The input label. Tell the user what input is this. */ label?: string; /** * Max input number value. */ max?: number; /** * Wether the input should be validated with vee-validator or not. * If you use this component within form input, you need to set this props as true. */ useValidator?: boolean; /** * This prop is required if you use this component in a form input. * Specify the unique field name, match with your needs for API request. * * @default 'numberInput' */ fieldName?: string; /** * Wether this input field is required or not. */ mandatory?: boolean; /** * Set custom validator message. * It is rarely use, this component has handled the validator message. * * @example: '{label} is required' * @example: { empty: '{label} field is required' } */ validatorMessage?: string | CustomValidation<'empty'>; /** * Custom invalid state. */ invalid?: boolean; /** * Specify the input placeholder. * * @default 'Enter {label}' or 'Enter number' */ placeholder?: string; /** * Disabled the input. */ disabled?: boolean; /** * Show information about the field. */ fieldInfo?: string; inputnNumberId?: string; } /** * InputCurrency component emits */ export type InputCurrencyEmits = { /** * Emits when the input has loosen focus. * The model value is the valid value from given min and max number. * * If the inputted number is above max, return the max. And vice versa. */ 'update:modelValue': [payload?: CurrencyValue]; /** * If you need to check validation, you can use this events. */ 'input': [payload?: number]; }; /** * **WangsVue - InputCurrency** * * _Handle input Currency with form validation. This component is an extension from InputNumber with mode currency._ * * --- --- * ![WangsVue](https://www.wangsit.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png) * * @group form */ declare class InputCurrency extends ClassComponent< InputCurrencyProps, unknown, InputCurrencyEmits > {} declare module '@vue/runtime-core' { interface GlobalComponents { InputCurrency: GlobalComponentConstructor; } } export default InputCurrency;