@awes-io/ui 2.47.3 → 2.49.1

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/assets/css/components/button-fixed.css +3 -3
  3. package/components/1_atoms/AwDropdown.vue +1 -1
  4. package/components/2_molecules/AwButton.vue +1 -1
  5. package/components/2_molecules/AwIsland/AwIslandBuilder.vue +1 -1
  6. package/components/2_molecules/AwSelect.vue +2 -2
  7. package/components/2_molecules/AwSelectObject.vue +2 -2
  8. package/components/3_organisms/AwAddressBlock.vue +60 -20
  9. package/components/3_organisms/AwBirthdayPicker.vue +2 -2
  10. package/components/3_organisms/AwBottomBar.vue +1 -1
  11. package/components/3_organisms/AwCalendar/AwCalendar.vue +1 -1
  12. package/components/3_organisms/AwCalendar/AwCalendarView.vue +1 -1
  13. package/components/3_organisms/AwCalendar/_AwCalendarNav.vue +3 -3
  14. package/components/3_organisms/AwCalendar/_AwCalendarWeekdays.vue +1 -2
  15. package/components/3_organisms/AwCodeSnippet.vue +1 -1
  16. package/components/3_organisms/AwCropper.vue +2 -2
  17. package/components/3_organisms/AwDate.vue +1 -1
  18. package/components/3_organisms/AwDisplayDate.vue +1 -1
  19. package/components/3_organisms/AwDownloadLink.vue +2 -2
  20. package/components/3_organisms/AwFetchData.vue +1 -1
  21. package/components/3_organisms/AwIslandAvatar.vue +4 -4
  22. package/components/3_organisms/AwModal.vue +2 -2
  23. package/components/3_organisms/AwModelEdit.vue +6 -6
  24. package/components/3_organisms/AwMultiBlockBuilder.vue +9 -4
  25. package/components/3_organisms/AwPagination.vue +3 -3
  26. package/components/3_organisms/AwSearch.vue +2 -2
  27. package/components/3_organisms/AwTable/AwTableBuilder.vue +3 -3
  28. package/components/3_organisms/AwUploader.vue +4 -4
  29. package/components/3_organisms/AwUploaderFiles.vue +2 -2
  30. package/components/4_pages/AwPage.vue +3 -3
  31. package/components/4_pages/AwPageModal.vue +2 -2
  32. package/components/4_pages/_AwButtonFixed.vue +3 -3
  33. package/components/5_layouts/AwLayoutCenter.vue +1 -1
  34. package/components/5_layouts/AwLayoutError.vue +2 -2
  35. package/components/5_layouts/_AwLayoutLogo.vue +1 -1
  36. package/components/5_layouts/_AwMobileMenu.vue +8 -8
  37. package/components/5_layouts/_AwOfflineNotify.vue +2 -2
  38. package/components/5_layouts/_AwUserMenu.vue +3 -3
  39. package/components/_config.js +16 -1
  40. package/nuxt/awes.config.js +2 -0
  41. package/nuxt/index.js +0 -22
  42. package/nuxt/templates/lang.plugin.js +90 -7
  43. package/package.json +2 -3
  44. package/lang/de.js +0 -198
  45. package/lang/en.js +0 -222
  46. package/lang/ru.js +0 -203
  47. package/lang/uk.js +0 -199
@@ -2,7 +2,7 @@
2
2
  <div v-if="pagesTotal > 1" class="flex items-center lg:px-6">
3
3
  <!-- info text -->
4
4
  <span class="flex-1 text-sm opacity-50 hidden lg:block">{{
5
- $t('AwPagination.info', {
5
+ $t('aw.pagination.info', {
6
6
  ...itemsRange,
7
7
  total
8
8
  })
@@ -33,7 +33,7 @@
33
33
  </AwButton>
34
34
 
35
35
  <span class="lg:hidden">
36
- {{ $t('AwPagination.page', { page, pagesTotal }) }}
36
+ {{ $t('aw.pagination.page', { page, pagesTotal }) }}
37
37
  </span>
38
38
  <div
39
39
  class="hidden lg:inline-flex aw-button-nav aw-button-nav__wrapper"
@@ -109,7 +109,7 @@
109
109
  </AwDropdown>
110
110
  </template>
111
111
  <span v-else class="text-sm opacity-50">
112
- {{ $t('AwPagination.limit', { limit }) }}
112
+ {{ $t('aw.pagination.limit', { limit }) }}
113
113
  </span>
114
114
  </div>
115
115
  </div>
@@ -85,11 +85,11 @@ export default {
85
85
 
86
86
  computed: {
87
87
  placeholder() {
88
- const basicPlaceholder = this.$t('AwSearch.text')
88
+ const basicPlaceholder = this.$t('aw.search.text')
89
89
 
90
90
  return this.globalKeyBind
91
91
  ? basicPlaceholder +
92
- this.$t('AwSearch.keyBind', { key: this.globalKeyBind })
92
+ this.$t('aw.search.key_bind', { key: this.globalKeyBind })
93
93
  : basicPlaceholder
94
94
  }
95
95
  },
@@ -22,7 +22,7 @@
22
22
  <slot name="empty-title">
23
23
  <!-- Text: "There are no data to show" -->
24
24
  <div class="text-mono-400 mb-4">
25
- {{ $t('AwTableBuilder.empty') }}
25
+ {{ $t('aw.table_builder.empty') }}
26
26
  </div>
27
27
  </slot>
28
28
 
@@ -55,7 +55,7 @@
55
55
  <slot name="empty-filter-title">
56
56
  <!-- Text: "There are no data to show" -->
57
57
  <div class="text-mono-400 mb-4">
58
- {{ $t('AwTableBuilder.emptyFilter') }}
58
+ {{ $t('aw.table_builder.empty_filter') }}
59
59
  </div>
60
60
  </slot>
61
61
 
@@ -171,7 +171,7 @@
171
171
  slot="left"
172
172
  class="h-5 w-5"
173
173
  />
174
- {{ $t('AwTableBuilder.loading') }}
174
+ {{ $t('aw.table_builder.loading') }}
175
175
  </AwChip>
176
176
  </slot>
177
177
  </div>
@@ -26,9 +26,9 @@
26
26
  />
27
27
  </svg>
28
28
  <span class="block ml-4">
29
- <span class="sm:text-lg">{{ $t('AwUploader.drop') }}</span>
29
+ <span class="sm:text-lg">{{ $t('aw.uploader.drop') }}</span>
30
30
  <span v-if="formatString" class="block text-sm text-mono-400">
31
- {{ $t('AwUploader.format', { formatString }) }}
31
+ {{ $t('aw.uploader.format', { formatString }) }}
32
32
  </span>
33
33
  </span>
34
34
  </slot>
@@ -271,11 +271,11 @@ export default {
271
271
  const fileName = file.name
272
272
 
273
273
  if (this._format.length && !this._extensionMatch(file)) {
274
- errors.push(this.$t('AwUploader.errorExtension', { fileName }))
274
+ errors.push(this.$t('aw.uploader.error_extension', { fileName }))
275
275
  }
276
276
 
277
277
  if (this.max && file.size > this.maxSizeBytes) {
278
- errors.push(this.$t('AwUploader.errorSize', { fileName }))
278
+ errors.push(this.$t('aw.uploader.error_size', { fileName }))
279
279
  }
280
280
 
281
281
  return errors
@@ -20,7 +20,7 @@
20
20
  <template #default="{ cell: file }">
21
21
  {{
22
22
  file.loaded
23
- ? parent.$t('AwUploader.loaded')
23
+ ? parent.$t('aw.uploader.loaded')
24
24
  : `${file.progress}%`
25
25
  }}
26
26
  </template>
@@ -31,7 +31,7 @@
31
31
  theme="icon"
32
32
  icon="close"
33
33
  size="sm"
34
- :text="parent.$t('AwUploader.remove')"
34
+ :text="parent.$t('aw.uploader.remove')"
35
35
  @click="props.removeFile(file.id)"
36
36
  />
37
37
  </template>
@@ -66,7 +66,7 @@
66
66
  >
67
67
  <div
68
68
  class="flex-1 text-sm text-mono-400"
69
- v-html="$sanitize($t('AwLayoutDefault.footer'))"
69
+ v-html="$sanitize($t('aw.layout_default.footer'))"
70
70
  ></div>
71
71
  <div class="flex-1 text-center">
72
72
  <AwButton
@@ -76,14 +76,14 @@
76
76
  @click="toggleFullscreen(false)"
77
77
  >
78
78
  <AwIconSystemMono name="close" class="mr-4" />
79
- {{ $t('AwPage.exitFullscreen') }}
79
+ {{ $t('aw.page.exit_fullscreen') }}
80
80
  </AwButton>
81
81
  </div>
82
82
  <div class="flex-1 flex">
83
83
  <AwSwitcher
84
84
  v-if="hasDarkThemeSwitcher"
85
85
  :checked="isDarkTheme"
86
- :label="$t('AwUserMenu.darkTheme')"
86
+ :label="$t('aw.user_menu.dark_theme')"
87
87
  class="ml-auto"
88
88
  @change="isDarkTheme = $event"
89
89
  />
@@ -51,8 +51,8 @@
51
51
 
52
52
  <div class="flex-1 flex justify-end">
53
53
  <button
54
- :title="$t('AwModal.close')"
55
- :aria-label="$t('AwModal.close')"
54
+ :title="$t('aw.modal.close')"
55
+ :aria-label="$t('aw.modal.close')"
56
56
  class="aw-page-modal__header-btn focus-outline ml-4"
57
57
  tabindex="0"
58
58
  @click="close"
@@ -8,6 +8,9 @@
8
8
  class="aw-button-fixed"
9
9
  v-on="$listeners"
10
10
  >
11
+ <slot name="icon">
12
+ <AwIcon :name="icon" size="24" class="flex-shrink-0" />
13
+ </slot>
11
14
  <span
12
15
  v-if="text"
13
16
  class="aw-button-fixed__text truncate"
@@ -15,9 +18,6 @@
15
18
  >
16
19
  <slot>{{ text }}</slot>
17
20
  </span>
18
- <slot name="icon">
19
- <AwIcon :name="icon" size="24" class="flex-shrink-0" />
20
- </slot>
21
21
  <span
22
22
  v-if="locked"
23
23
  class="aw-button-fixed__lock"
@@ -19,7 +19,7 @@
19
19
  </div>
20
20
 
21
21
  <div
22
- v-html="$sanitize($t('AwLayoutDefault.footer'))"
22
+ v-html="$sanitize($t('aw.layout_default.footer'))"
23
23
  class="pt-8 text-sm"
24
24
  ></div>
25
25
  </div>
@@ -2,7 +2,7 @@
2
2
  <div class="flex flex-col bg-mono-900 flex-grow min-h-screen">
3
3
  <div class="flex flex-col justify-center items-center m-auto">
4
4
  <h1 class="text-center text-3xl">
5
- {{ $t('AwLayoutError.subtitle') }}
5
+ {{ $t('aw.layout_error.subtitle') }}
6
6
  </h1>
7
7
  <p class="text-center text-6xl">{{ statusCode }}</p>
8
8
  <p class="text-center">
@@ -45,7 +45,7 @@ export default {
45
45
  },
46
46
 
47
47
  message() {
48
- return this.error.message || this.$t('AwLayoutError.message')
48
+ return this.error.message || this.$t('aw.layout_error.message')
49
49
  },
50
50
 
51
51
  isLoggedIn() {
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <img v-if="props.logo" v-bind="props.logo" />
8
8
  <span class="sr-only">
9
- {{ parent.$t('AwLayoutDefault.homepage') }}
9
+ {{ parent.$t('aw.layout_default.homepage') }}
10
10
  </span>
11
11
  </NLink>
12
12
  </template>
@@ -23,7 +23,7 @@
23
23
  <AwIconSystemMono name="arrow" size="16" />
24
24
  </template>
25
25
  <span class="sr-only">
26
- {{ $t('AwMobileMenu.back') }}
26
+ {{ $t('aw.mobile_menu.back') }}
27
27
  </span>
28
28
  </AwButton>
29
29
 
@@ -40,7 +40,7 @@
40
40
  <AwSwitcher
41
41
  v-else
42
42
  v-model="isDarkTheme"
43
- :label="$t('AwMobileMenu.darkTheme')"
43
+ :label="$t('aw.mobile_menu.dark_theme')"
44
44
  icon="moon"
45
45
  icon-place-in
46
46
  icon-color="warning"
@@ -60,7 +60,7 @@
60
60
  <AwIconSystemMono name="close" size="16" />
61
61
  </template>
62
62
  <span class="sr-only">
63
- {{ $t('AwMobileMenu.close') }}
63
+ {{ $t('aw.mobile_menu.close') }}
64
64
  </span>
65
65
  </AwButton>
66
66
  </div>
@@ -78,7 +78,7 @@
78
78
  <NLink
79
79
  v-if="profileUrl"
80
80
  :to="profileUrl"
81
- :aria-label="$t('AwMobileMenu.profile')"
81
+ :aria-label="$t('aw.mobile_menu.profile')"
82
82
  class="aw-mobile-menu__user-link"
83
83
  >
84
84
  <AwIconSystemMono name="angle" rotate="180" />
@@ -96,7 +96,7 @@
96
96
  <!-- top level menu -->
97
97
  <AwMobileMenuNav
98
98
  v-show="!submenuOpened"
99
- :title="$t('AwMobileMenu.mainMenu')"
99
+ :title="$t('aw.mobile_menu.main_menu')"
100
100
  :items="mainMenu"
101
101
  class="aw-mobile-menu__menu"
102
102
  @click:submenu="showSubmenu"
@@ -104,7 +104,7 @@
104
104
 
105
105
  <AwMobileMenuNav
106
106
  v-show="!submenuOpened"
107
- :title="$t('AwMobileMenu.secondaryMenu')"
107
+ :title="$t('aw.mobile_menu.secondary_menu')"
108
108
  :items="secondaryMenu"
109
109
  class="aw-mobile-menu__menu"
110
110
  @click:submenu="showSubmenu"
@@ -112,7 +112,7 @@
112
112
 
113
113
  <AwMobileMenuNav
114
114
  v-show="!submenuOpened"
115
- :title="$t('AwMobileMenu.userMenu')"
115
+ :title="$t('aw.mobile_menu.user_menu')"
116
116
  :items="userMenu"
117
117
  class="aw-mobile-menu__menu"
118
118
  @click:submenu="showSubmenu"
@@ -146,7 +146,7 @@
146
146
  class="aw-mobile-menu__logo"
147
147
  />
148
148
  <span class="aw-mobile-menu__version">
149
- {{ $t('AwMobileMenu.version', { version: $config.VERSION }) }}
149
+ {{ $t('aw.mobile_menu.version', { version: $config.VERSION }) }}
150
150
  </span>
151
151
  </slot>
152
152
  </div>
@@ -22,8 +22,8 @@ export default {
22
22
  offlineNotifyRemover = this.$notify({
23
23
  timeout: 0,
24
24
  type: 'error',
25
- title: this.$t('AwLayoutDefault.offline'),
26
- text: this.$t('AwLayoutDefault.offlineText'),
25
+ title: this.$t('aw.layout_default.offline'),
26
+ text: this.$t('aw.layout_default.offline_text'),
27
27
  icon: false,
28
28
  closable: false
29
29
  })
@@ -11,7 +11,7 @@
11
11
  <button
12
12
  class="aw-user-menu__user focus-outline"
13
13
  aria-haspopup="true"
14
- :aria-label="$t('AwUserMenu.openMenu')"
14
+ :aria-label="$t('aw.user_menu.open_menu')"
15
15
  @focus="openDropdown"
16
16
  @mouseenter="openDropdown"
17
17
  >
@@ -37,7 +37,7 @@
37
37
  </Component>
38
38
  <AwSwitcher
39
39
  v-model="isDarkTheme"
40
- :label="$t('AwUserMenu.darkTheme')"
40
+ :label="$t('aw.user_menu.dark_theme')"
41
41
  icon="moon"
42
42
  icon-place-in
43
43
  icon-color="warning"
@@ -77,7 +77,7 @@
77
77
  class="aw-user-menu__nav-item"
78
78
  @click="$auth.logout()"
79
79
  >
80
- {{ $t('AwUserMenu.logout') }}
80
+ {{ $t('aw.user_menu.logout') }}
81
81
  </AwNavItem> -->
82
82
  </AwDropdown>
83
83
  </slot>
@@ -75,7 +75,22 @@ export const AwDropdown = {
75
75
  }
76
76
 
77
77
  export const AwCalendar = {
78
- firstDay: 1
78
+ firstDay: 1,
79
+ weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
80
+ months: [
81
+ 'January',
82
+ 'February',
83
+ 'March',
84
+ 'April',
85
+ 'May',
86
+ 'June',
87
+ 'July',
88
+ 'August',
89
+ 'September',
90
+ 'October',
91
+ 'November',
92
+ 'December'
93
+ ]
79
94
  }
80
95
 
81
96
  export const AwCode = {
@@ -36,6 +36,8 @@ export const lang = {
36
36
  silentFallbackWarn: true,
37
37
  // own props
38
38
  fetchTranslation: false,
39
+ statsTranslation: false,
40
+ statsAutoload: false,
39
41
  langCookie: 'i18n_redirected'
40
42
  }
41
43
 
package/nuxt/index.js CHANGED
@@ -313,26 +313,6 @@ async function AwesIoUi() {
313
313
  options: components
314
314
  })
315
315
 
316
- /**
317
- * Add static translations
318
- */
319
- this.options.awesIo.langStatic = this.options.awesIo.langStatic || {}
320
-
321
- for (const locale of this.options.awesIo.lang.locales) {
322
- const code = locale.code || locale
323
-
324
- try {
325
- const { default: translation } = await import(
326
- '@awes-io/ui/lang/' + code
327
- )
328
- this.options.awesIo.langStatic[code] = translation || {}
329
- } catch (e) {
330
- console.warn(
331
- 'Awes.io/UI: No default translation for ' + code + ' locale'
332
- )
333
- }
334
- }
335
-
336
316
  /**
337
317
  * Add plugins sorter (axios should be first)
338
318
  */
@@ -355,8 +335,6 @@ async function AwesIoUi() {
355
335
  */
356
336
 
357
337
  this.nuxt.hook('modules:done', async () => {
358
- await this.nuxt.callHook('awesIo:staticTranslations')
359
-
360
338
  const templatesPath = join(__dirname, 'templates')
361
339
 
362
340
  for (const file of readdirSync(templatesPath)) {
@@ -2,7 +2,7 @@ import axios from 'axios'
2
2
  import Vue from 'vue'
3
3
  import VueI18n from 'vue-i18n'
4
4
  import JsCookie from 'js-cookie'
5
- import { omit, isType, prop, mergeDeepRight } from 'rambdax'
5
+ import { omit, isType, prop, mergeDeepRight, clone, isEmpty } from 'rambdax'
6
6
 
7
7
  Vue.use(VueI18n)
8
8
 
@@ -29,11 +29,12 @@ const cyrillicPluralization = (choice, choicesLength) => {
29
29
 
30
30
  const langOptions = JSON.parse('<%= JSON.stringify(options.lang) %>')
31
31
 
32
- const messages = JSON.parse(`<%= JSON.stringify(options.langStatic).replace(/\\"/g, "'") %>`)
33
-
34
- /* eslint-disable-next-line */
32
+ /* eslint-disable */
35
33
  const fetchTranslation = <%= options.lang.fetchTranslation %>
36
34
 
35
+ const statsTranslation = <%= options.lang.statsTranslation %>
36
+ /* eslint-enable */
37
+
37
38
  const langCookie = langOptions.langCookie
38
39
 
39
40
  const toLocale = (lang = '') => lang.slice(0, 2).toLowerCase()
@@ -46,13 +47,11 @@ const i18nOptions = mergeDeepRight(
46
47
  }
47
48
  },
48
49
  omit(
49
- ['locales', 'fetchTranslation', 'langCookie', 'static'],
50
+ ['locales', 'fetchTranslation', 'statsTranslation', 'statsAutoLoad', 'langCookie', 'static'],
50
51
  langOptions
51
52
  )
52
53
  )
53
54
 
54
- i18nOptions.messages = mergeDeepRight(messages, i18nOptions.messages || {})
55
-
56
55
  const beforeListeners = new Map()
57
56
  const afterListeners = new Map()
58
57
 
@@ -192,3 +191,87 @@ export default async ({ app, $axios }) => {
192
191
  */
193
192
  await app.i18n.setLocale(app.i18n.locale)
194
193
  }
194
+
195
+ /**
196
+ * Stats
197
+ */
198
+
199
+ if (statsTranslation) {
200
+ let stats = {}
201
+ let enabled = false
202
+
203
+ const storeStats = (key, locale, ctx) => {
204
+ stats[locale] = stats[locale] || {}
205
+
206
+ const item = stats[locale][key] = stats[locale][key] || { count: 0, exists: ctx.$te(key), pages: [] }
207
+
208
+ item.count++
209
+
210
+ const page = ctx.$route.path
211
+
212
+ if (!item.pages.includes(page)) {
213
+ item.pages.push(page)
214
+ }
215
+ }
216
+
217
+ const sendStats = () => {
218
+ if (isEmpty(stats)) return
219
+
220
+ for (const locale in stats) {
221
+
222
+ const data = clone(stats[locale])
223
+ delete stats[locale]
224
+
225
+ axios
226
+ .request({
227
+ method: 'POST',
228
+ data,
229
+ ...statsTranslation(locale, data)
230
+ })
231
+ .catch((e) => {
232
+ console.log(e)
233
+ })
234
+ }
235
+ }
236
+
237
+ const enableStats = () => {
238
+ if (enabled) return
239
+
240
+ enabled = true
241
+
242
+ setTimeout(sendStats, 500)
243
+ const tm = setInterval(sendStats, 5000)
244
+
245
+ window.$nuxt.$once('hook:beforeDestroy', () => {
246
+ clearInterval(tm)
247
+ })
248
+ }
249
+
250
+ const patchTranslationMethods = () => {
251
+ Vue.prototype.$t = function (key, ...values) {
252
+ const i18n = this.$i18n
253
+
254
+ storeStats(key, i18n.locale, this)
255
+
256
+ return i18n._t(key, i18n.locale, i18n._getMessages(), this, ...values)
257
+ }
258
+
259
+ Vue.prototype.$tc = function (key, choice, ...values) {
260
+ const i18n = this.$i18n
261
+
262
+ storeStats(key, i18n.locale, this)
263
+
264
+ return i18n._tc(key, i18n.locale, i18n._getMessages(), this, choice, ...values)
265
+ }
266
+ }
267
+
268
+ if (langOptions.statsAutoload) {
269
+ patchTranslationMethods()
270
+ window.onNuxtReady(enableStats)
271
+ } else {
272
+ window.__aw_enable_translation_stats = function() {
273
+ patchTranslationMethods()
274
+ enableStats()
275
+ }
276
+ }
277
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.47.3",
3
+ "version": "2.49.1",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -27,7 +27,6 @@
27
27
  "files": [
28
28
  "dist/*",
29
29
  "nuxt/*",
30
- "lang/*",
31
30
  "tailwind/*",
32
31
  "directives/*",
33
32
  "mixins/*",
@@ -123,5 +122,5 @@
123
122
  "vue-template-compiler": "^2.6.10",
124
123
  "webfonts-generator": "^0.4.0"
125
124
  },
126
- "gitHead": "8893c573987e8a2a7dc86cc75423b148a6428405"
125
+ "gitHead": "88e19d99b3529c4da104ff9517679b6fa795d022"
127
126
  }