fix ui issues and upload image for guild good
This commit is contained in:
@@ -189,26 +189,27 @@ export class InputComponent {
|
||||
onInput($event: Event, isPriceFormat?: boolean) {
|
||||
// @ts-ignore
|
||||
let value = $event.target.value as string;
|
||||
// @ts-ignore
|
||||
const isDotInput = $event.data === '.';
|
||||
|
||||
if (isPriceFormat) {
|
||||
value = value.replace(/,/g, '');
|
||||
}
|
||||
|
||||
if (this.inputMode === 'numeric') {
|
||||
let newValue = parseFloat(value);
|
||||
|
||||
let replacedTargetValue: Maybe<number | string> = null;
|
||||
if (this.inputMode === 'numeric' && !isDotInput) {
|
||||
let newValue = parseFloat(value || '0');
|
||||
const minValidator = (this.min || this.min === 0) && parseFloat(value) < this.min!;
|
||||
const maxValidator = (this.max || this.max === 0) && parseFloat(value) > this.max;
|
||||
|
||||
if (minValidator || maxValidator) {
|
||||
if (minValidator) {
|
||||
this.toastService.warn({
|
||||
text: `مقدار فیلد باید بیشتر از ${this.min} باشد.`,
|
||||
text: `مقدار ${this.label} نمیتواند بیشتر از ${this.min} باشد.`,
|
||||
});
|
||||
}
|
||||
if (maxValidator) {
|
||||
this.toastService.warn({
|
||||
text: `مقدار فیلد باید کمتر از ${this.max} باشد.`,
|
||||
text: `مقدار ${this.label} نمیتواند کمتر از ${this.max} باشد.`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -217,23 +218,23 @@ export class InputComponent {
|
||||
newValue = 0;
|
||||
}
|
||||
|
||||
if (isPriceFormat) {
|
||||
// @ts-ignore
|
||||
$event.target.value = newValue.toLocaleString('en-US');
|
||||
} else {
|
||||
// @ts-ignore
|
||||
$event.target.value = newValue;
|
||||
}
|
||||
}
|
||||
if (!['nationalId', 'phone', 'postalCode', 'mobile'].includes(this.type))
|
||||
replacedTargetValue = isPriceFormat ? newValue.toLocaleString('en-US') : newValue;
|
||||
this.control.setValue(newValue);
|
||||
}
|
||||
if (!['nationalId', 'phone', 'postalCode', 'mobile'].includes(this.type)) {
|
||||
this.control.setValue(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.preparedMaxLength && this.preparedMaxLength < value.length) {
|
||||
let newValue = value.slice(0, value.length - 1);
|
||||
// @ts-ignore
|
||||
$event.target.value = newValue;
|
||||
replacedTargetValue = newValue;
|
||||
this.control.setValue(newValue);
|
||||
}
|
||||
|
||||
if (replacedTargetValue !== null) {
|
||||
// @ts-ignore
|
||||
this.$event.value = replacedTargetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user