diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..1b6a42d --- /dev/null +++ b/.htaccess @@ -0,0 +1,14 @@ + + + Options -MultiViews -Indexes + + + # Handle Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + #RewriteBase / + RewriteRule ^ /index.html [L] + + + + diff --git a/src/components/BasicPacks/BasicInput.vue b/src/components/BasicPacks/BasicInput.vue index 9012c27..3afadee 100644 --- a/src/components/BasicPacks/BasicInput.vue +++ b/src/components/BasicPacks/BasicInput.vue @@ -36,6 +36,7 @@ import {usePrefix} from "@/utils/usePrefix"; import {computed} from "vue"; import {usePrice} from "@/utils/usePrice"; +import {persianToEnglishDigits, shouldNormalizeInputDigits} from '@/utils/persianDigits'; //Props interface Prop { @@ -59,9 +60,7 @@ const addonTextColor = computed(() => props.addonTextColor) //emits const localValue = computed({ set(value) { - props.type === 'price' - ? emits('update:value', value?.toString().replaceAll(',', '')) - : emits('update:value', value) + emits('update:value', normalizeValue(value)) }, get() { return props.type === 'price' @@ -75,16 +74,26 @@ const props = withDefaults(defineProps(), { }) const emits = defineEmits(['update:value', 'onchange']) -const handlerChange = (e: any) => { - props.type === 'price' - ? emits('update:value', e.target.value?.toString().replaceAll(',', '')) - : emits('update:value', e.target.value) - props.type === 'price' - ? emits('onchange', e.target.value?.toString().replaceAll(',', '')) - : emits('onchange', e.target.value) +function normalizeValue(value: unknown) { + if (value == null || value === '') { + return value + } + + let normalized = String(value) + if (shouldNormalizeInputDigits(props)) { + normalized = persianToEnglishDigits(normalized) + } + if (props.type === 'price') { + normalized = normalized.replaceAll(',', '') + } + return normalized } -//css style +const handlerChange = (e: any) => { + const normalized = normalizeValue(e.target.value) + emits('update:value', normalized) + emits('onchange', normalized) +} const {prefixCls} = usePrefix('input') diff --git a/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue b/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue index d9e2f48..12e5d50 100644 --- a/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue +++ b/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue @@ -1,5 +1,5 @@