Skip to content

Commit 101fbf9

Browse files
committed
fix: add isIos param in corestore and update textarea
1 parent fe2532c commit 101fbf9

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

adminforth/spa/src/afcl/Input.vue

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
aria-describedby="helper-text-explanation"
1818
class="afcl-input inline-flex bg-lightInputBackground border border-lightInputBorder rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
1919
blue-500 focus:border-blue-500 block w-20 p-2.5 dark:bg-darkInputBackground dark:border-darkInputBorder placeholder-lightInputPlaceholderText dark:placeholder-darkInputPlaceholderText dark:text-darkInputText translate-y-0"
20-
:class="{'rounded-l-md': !$slots.prefix && !prefix, 'rounded-r-md': !$slots.suffix && !suffix, 'w-full': fullWidth, 'text-base': isIOSDevice, 'text-sm': !isIOSDevice }"
20+
:class="{'rounded-l-md': !$slots.prefix && !prefix, 'rounded-r-md': !$slots.suffix && !suffix, 'w-full': fullWidth, 'text-base': isIos, 'text-sm': !isIos }"
2121
:disabled="readonly"
2222
>
2323

@@ -36,7 +36,10 @@
3636
<script setup lang="ts">
3737
3838
import { ref } from 'vue';
39-
const isIOSDevice = isIOS();
39+
import { useCoreStore } from '@/stores/core';
40+
41+
const coreStore = useCoreStore();
42+
const isIos = coreStore.isIos;
4043
4144
const props = defineProps<{
4245
type: string,
@@ -53,12 +56,5 @@ defineExpose({
5356
focus: () => input.value?.focus(),
5457
});
5558
56-
function isIOS() {
57-
return (
58-
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
59-
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
60-
)
61-
}
62-
6359
</script>
6460

adminforth/spa/src/afcl/Textarea.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<textarea
33
ref="input"
4-
class="bg-lightInputBackground border border-lightInputBorder text-lightInputText placeholder-lightInputPlaceholderText text-sm rounded-lg block w-full p-2.5 dark:bg-darkInputBackground dark:border-darkInputBorder dark:placeholder-darkInputPlaceholderText dark:text-darkInputText dark:border-darkInputBorder focus:ring-lightInputFocusRing focus:border-lightInputFocusBorder dark:focus:ring-darkInputFocusRing dark:focus:border-darkInputFocusBorder"
4+
class="afcl-textarea bg-lightInputBackground border border-lightInputBorder text-lightInputText placeholder-lightInputPlaceholderText text-sm rounded-md block w-full p-2.5 dark:bg-darkInputBackground dark:border-darkInputBorder dark:placeholder-darkInputPlaceholderText dark:text-darkInputText dark:border-darkInputBorder focus:ring-lightInputFocusRing focus:border-lightInputFocusBorder dark:focus:ring-darkInputFocusRing dark:focus:border-darkInputFocusBorder"
5+
:class="`${readonly ? 'opacity-50' : ''} ${isIos ? 'text-md' : 'text-sm'}`"
56
:placeholder="placeholder"
67
:value="modelValue"
78
@input="$emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)"
@@ -11,6 +12,10 @@
1112

1213
<script setup lang="ts">
1314
import { ref } from 'vue';
15+
import { useCoreStore } from '@/stores/core';
16+
17+
const coreStore = useCoreStore();
18+
const isIos = coreStore.isIos;
1419
1520
const props = defineProps<{
1621
modelValue: string

adminforth/spa/src/stores/core.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ export const useCoreStore = defineStore('core', () => {
221221
return userData.value && userFullnameField && userData.value[userFullnameField];
222222
})
223223

224+
const isIos = computed(() => {
225+
return (
226+
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
227+
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
228+
)});
229+
224230

225231
return {
226232
config,
@@ -245,5 +251,6 @@ export const useCoreStore = defineStore('core', () => {
245251
resetAdminUser,
246252
resetResource,
247253
isResourceFetching,
254+
isIos
248255
}
249256
})

0 commit comments

Comments
 (0)