adminforth 2.4.0-next.275 → 2.4.0-next.277
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/spa/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build-only": "vite build",
|
|
11
11
|
"type-check": "vue-tsc --build --force",
|
|
12
12
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
13
|
-
"i18n:extract": "echo {} > i18n-empty.json && vue-i18n-extract report --vueFiles \"./src/**/*.{js,vue}\" --output ./i18n-messages.json --languageFiles \"i18n-empty.json\" --add"
|
|
13
|
+
"i18n:extract": "echo {} > i18n-empty.json && vue-i18n-extract report --vueFiles \"./src/**/*.{js,vue,ts}\" --output ./i18n-messages.json --languageFiles \"i18n-empty.json\" --add"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@iconify-prerendered/vue-flag": "^0.28.1748584105",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
@input="$emit('update:modelValue', type === 'number' ? Number(($event.target as HTMLInputElement)?.value) : ($event.target as HTMLInputElement)?.value)"
|
|
16
16
|
:value="modelValue"
|
|
17
17
|
aria-describedby="helper-text-explanation"
|
|
18
|
-
class="afcl-input
|
|
18
|
+
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
|
|
19
19
|
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}"
|
|
20
|
+
:class="{'rounded-l-md': !$slots.prefix && !prefix, 'rounded-r-md': !$slots.suffix && !suffix, 'w-full': fullWidth, 'text-base': isIOSDevice, 'text-sm': !isIOSDevice }"
|
|
21
21
|
:disabled="readonly"
|
|
22
22
|
>
|
|
23
23
|
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
37
|
|
|
38
38
|
import { ref } from 'vue';
|
|
39
|
+
const isIOSDevice = isIOS();
|
|
39
40
|
|
|
40
41
|
const props = defineProps<{
|
|
41
42
|
type: string,
|
|
@@ -52,5 +53,12 @@ defineExpose({
|
|
|
52
53
|
focus: () => input.value?.focus(),
|
|
53
54
|
});
|
|
54
55
|
|
|
56
|
+
function isIOS() {
|
|
57
|
+
return (
|
|
58
|
+
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
|
|
59
|
+
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
</script>
|
|
56
64
|
|
package/dist/spa/src/i18n.ts
CHANGED
|
@@ -7,7 +7,7 @@ function slavicPluralRule(choice: number, choicesLength: number, orgRule: any) {
|
|
|
7
7
|
if (choice === 0) {
|
|
8
8
|
return 0
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
const teen = choice > 10 && choice < 20
|
|
12
12
|
const endsWithOne = choice % 10 === 1
|
|
13
13
|
|
|
@@ -21,6 +21,8 @@ function slavicPluralRule(choice: number, choicesLength: number, orgRule: any) {
|
|
|
21
21
|
return choicesLength < 4 ? 2 : 3
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export let i18nInstance: ReturnType<typeof createI18n> | null = null
|
|
25
|
+
|
|
24
26
|
export function initI18n(app: ReturnType<typeof createApp>) {
|
|
25
27
|
const i18n = createI18n({
|
|
26
28
|
legacy: false,
|
|
@@ -48,7 +50,7 @@ export function initI18n(app: ReturnType<typeof createApp>) {
|
|
|
48
50
|
return key + ' ';
|
|
49
51
|
},
|
|
50
52
|
});
|
|
51
|
-
|
|
52
53
|
app.use(i18n);
|
|
54
|
+
i18nInstance = i18n
|
|
53
55
|
return i18n
|
|
54
56
|
}
|
package/dist/spa/src/main.ts
CHANGED
package/dist/spa/src/utils.ts
CHANGED
|
@@ -9,6 +9,7 @@ import adminforth from './adminforth';
|
|
|
9
9
|
import sanitizeHtml from 'sanitize-html'
|
|
10
10
|
import debounce from 'debounce';
|
|
11
11
|
import type { AdminForthResourceColumnInputCommon, Predicate } from '@/types/Common';
|
|
12
|
+
import { i18nInstance } from './i18n'
|
|
12
13
|
|
|
13
14
|
const LS_LANG_KEY = `afLanguage`;
|
|
14
15
|
const MAX_CONSECUTIVE_EMPTY_RESULTS = 2;
|
|
@@ -19,6 +20,7 @@ export async function callApi({path, method, body, headers}: {
|
|
|
19
20
|
body?: any
|
|
20
21
|
headers?: Record<string, string>
|
|
21
22
|
}): Promise<any> {
|
|
23
|
+
const t = i18nInstance?.global.t || ((s: string) => s)
|
|
22
24
|
const options = {
|
|
23
25
|
method,
|
|
24
26
|
headers: {
|
|
@@ -42,11 +44,11 @@ export async function callApi({path, method, body, headers}: {
|
|
|
42
44
|
// if it is internal error, say to user
|
|
43
45
|
if (e instanceof TypeError && e.message === 'Failed to fetch') {
|
|
44
46
|
// this is a network error
|
|
45
|
-
adminforth.alert({variant:'danger', message:
|
|
47
|
+
adminforth.alert({variant:'danger', message: t('Network error, please check your Internet connection and try again'),})
|
|
46
48
|
return null;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
adminforth.alert({variant:'danger', message:
|
|
51
|
+
adminforth.alert({variant:'danger', message: t('Something went wrong, please try again later'),})
|
|
50
52
|
console.error(`error in callApi ${path}`, e);
|
|
51
53
|
}
|
|
52
54
|
}
|