This commit is contained in:
Nadar
2026-03-17 13:24:22 +03:00
commit 82e5ac9d81
554 changed files with 29637 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import dayjs from 'dayjs'
import dayjsLocaleDataPlugin from 'dayjs/plugin/localeData'
import dayjsTodayPlugin from 'dayjs/plugin/isToday'
import dayjsIsBetweenPlugin from 'dayjs/plugin/isBetween'
import dayjsUpdateLocalePlugin from 'dayjs/plugin/updateLocale'
import dayjsCustomParseFormatPlugin from 'dayjs/plugin/customParseFormat'
export default defineNuxtPlugin(() => {
dayjs.extend(dayjsLocaleDataPlugin)
dayjs.extend(dayjsTodayPlugin)
dayjs.extend(dayjsIsBetweenPlugin)
dayjs.extend(dayjsUpdateLocalePlugin)
dayjs.extend(dayjsCustomParseFormatPlugin)
return {}
})

View File

@@ -0,0 +1,13 @@
import { NuxtLink } from '#components'
import { provideGlobalConfig } from '#imports'
export default defineNuxtPlugin((nuxtApp) => {
provideGlobalConfig(
computed(() => ({
LINK_COMPONENT: NuxtLink,
})),
nuxtApp.vueApp,
)
return {}
})

21
layers/ui/plugins/i18n.ts Normal file
View File

@@ -0,0 +1,21 @@
import type { Composer } from 'vue-i18n'
export default defineNuxtPlugin((nuxtApp) => {
const i18n = nuxtApp.$i18n as Composer
if (i18n) {
i18n.mergeLocaleMessage('ru', {
'ui.select.selected': 'Выбрано: {0}',
'ui.select.select_option': 'Выбрать',
'ui.search': 'Поиск',
})
i18n.mergeLocaleMessage('en', {
'ui.select.selected': 'Selected: {0}',
'ui.select.select_option': 'Select',
'ui.search': 'Search',
})
}
return {}
})

View File

@@ -0,0 +1,7 @@
import notify from '../components/notification/notify'
export default defineNuxtPlugin((nuxtApp) => {
notify._context = nuxtApp.vueApp._context
return {}
})

View File

@@ -0,0 +1,33 @@
import * as defaultRules from '@vee-validate/rules'
import { configure, defineRule } from 'vee-validate'
import type { Composer } from 'vue-i18n'
export default defineNuxtPlugin((nuxtApp) => {
for (const rule in defaultRules) {
if (['default', 'url'].includes(rule))
continue
defineRule(rule, defaultRules[rule])
}
defineRule('url', (value, params): boolean => {
const optionalProtocol = Array.isArray(params) ? params[0] : params.optionalProtocol
if (optionalProtocol)
return /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(value)
return defaultRules.url(value, params)
})
const i18n = nuxtApp.$i18n as Composer
if (i18n) {
configure({
generateMessage: (context) => {
return i18n.t(`validation.${context.rule!.name}`, context.rule!.params)
},
})
}
return {}
})