@awes-io/ui 2.126.0 → 2.127.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.127.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.126.1...@awes-io/ui@2.127.0) (2025-01-16)
7
+
8
+
9
+ ### Features
10
+
11
+ * add emit empty string for aw money ([2e24b8b](https://github.com/awes-io/client/commit/2e24b8bc34d72f3c815ff8e910bc799324be6245))
12
+ * retry translations fetch on error ([1cee386](https://github.com/awes-io/client/commit/1cee386051a35e728c7d488ce207c0c4f685d393))
13
+
14
+
15
+
16
+
17
+
18
+ ## [2.126.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.126.0...@awes-io/ui@2.126.1) (2025-01-14)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * fix page single header ([0868d6e](https://github.com/awes-io/client/commit/0868d6e15eb18e9d13fd26826651c784ce6092b8))
24
+
25
+
26
+
27
+
28
+
6
29
  # [2.126.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.125.0...@awes-io/ui@2.126.0) (2025-01-10)
7
30
 
8
31
 
@@ -163,7 +163,8 @@
163
163
  left: calc(300px + 1.5rem);
164
164
  }
165
165
 
166
- .aw-layout__aw-layout-menu.aw-layout-menu--hide-submenu ~ .aw-page {
166
+ .aw-layout__aw-layout-menu.aw-layout-menu--hide-submenu ~ .aw-page,
167
+ .aw-layout__aw-layout-menu.aw-layout-menu--no-submenu ~ .aw-page {
167
168
  .aw-page-header__breadcrumbs {
168
169
  left: calc(6rem + 1.5rem);
169
170
  }
@@ -86,6 +86,13 @@
86
86
  &__header {
87
87
  position: sticky;
88
88
  top: 0;
89
+
90
+ display: grid;
91
+ grid-template-columns: minmax(min-content, 1fr) minmax(1rem, auto) minmax(max-content, 1fr);
92
+
93
+ .aw-page-header__breadcrumbs {
94
+ position: static;
95
+ }
89
96
  }
90
97
 
91
98
  .aw-page-header--is-stuck {
@@ -132,6 +132,8 @@ export default {
132
132
 
133
133
  if (this.value !== value) {
134
134
  this.$emit('input', value, valueFormatted)
135
+ } else if (!valueFormatted) {
136
+ this.$emit('input', null, null)
135
137
  }
136
138
  }
137
139
  },
@@ -48,7 +48,12 @@ export const lang = {
48
48
  fetchTranslation: false,
49
49
  statsTranslation: false,
50
50
  statsAutoload: false,
51
- langCookie: 'i18n_redirected'
51
+ langCookie: 'i18n_redirected',
52
+ retry: {
53
+ retries: 5,
54
+ retryDelay: 5000,
55
+ block: false
56
+ }
52
57
  }
53
58
 
54
59
  export const dayjs = {
@@ -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, clone, isEmpty } from 'rambdax'
5
+ import { omit, isType, prop, mergeDeepRight, clone, isEmpty, delay } from 'rambdax'
6
6
 
7
7
  Vue.use(VueI18n)
8
8
 
@@ -48,11 +48,13 @@ const i18nOptions = mergeDeepRight(
48
48
  }
49
49
  },
50
50
  omit(
51
- ['locales', 'fetchTranslation', 'statsTranslation', 'statsAutoLoad', 'langCookie', 'static'],
51
+ ['locales', 'fetchTranslation', 'statsTranslation', 'statsAutoLoad', 'langCookie', 'static', 'retry'],
52
52
  langOptions
53
53
  )
54
54
  )
55
55
 
56
+ const retryOptions = langOptions.retry || {}
57
+
56
58
  const beforeListeners = new Map()
57
59
  const afterListeners = new Map()
58
60
 
@@ -149,15 +151,39 @@ export default async ({ app, $axios }) => {
149
151
 
150
152
  try {
151
153
  const { data } = await axios.request(requestConfig)
152
- loadedLocales[locale] = data
154
+
155
+ loadedLocales[locale] = data || {}
156
+
157
+ return loadedLocales[locale]
153
158
  } catch (e) {
154
159
  console.log('Error fetching translation', e)
155
- } finally {
156
- return loadedLocales[locale] || {}
160
+
161
+ return false
157
162
  }
158
163
  }
159
164
  }
160
165
 
166
+ /**
167
+ * Retry fetch translation
168
+ */
169
+ let retryFetch = () => false
170
+
171
+ if (fetchTranslation && retryOptions.retries > 0) {
172
+ retryFetch = async (locale, retry) => {
173
+ await delay(retryOptions.retryDelay)
174
+
175
+ let fetchedData = await fetchLocale(locale)
176
+
177
+ if (!fetchedData && retry > 1) {
178
+ if (app.i18n.locale !== locale) return false
179
+
180
+ fetchedData = await retryFetch(locale, retry - 1)
181
+ }
182
+
183
+ return fetchedData
184
+ }
185
+ }
186
+
161
187
  /**
162
188
  * Global setLocale function
163
189
  */
@@ -171,12 +197,27 @@ export default async ({ app, $axios }) => {
171
197
  await beforeListener(locale, oldLocale)
172
198
  }
173
199
 
174
- const fetchedData = await fetchLocale(locale)
200
+ let fetchedData = await fetchLocale(locale)
201
+
202
+ if (!fetchedData && retryOptions.block && retryOptions.retries > 0) {
203
+ fetchedData = await retryFetch(locale, retryOptions.retries)
204
+ } else if (!fetchedData && retryOptions.retries > 0) {
205
+ retryFetch(locale, retryOptions.retries).then((data) => {
206
+ if (data) {
207
+ app.i18n.setLocaleMessage(
208
+ locale,
209
+ mergeDeepRight(app.i18n.getLocaleMessage(locale), data)
210
+ )
211
+ }
212
+ })
213
+ }
175
214
 
176
- app.i18n.setLocaleMessage(
177
- locale,
178
- mergeDeepRight(app.i18n.getLocaleMessage(locale), fetchedData)
179
- )
215
+ if (fetchedData) {
216
+ app.i18n.setLocaleMessage(
217
+ locale,
218
+ mergeDeepRight(app.i18n.getLocaleMessage(locale), fetchedData)
219
+ )
220
+ }
180
221
 
181
222
  app.i18n.locale = locale
182
223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.126.0",
3
+ "version": "2.127.0",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -114,5 +114,5 @@
114
114
  "rollup-plugin-visualizer": "^2.6.0",
115
115
  "rollup-plugin-vue": "^5.0.1"
116
116
  },
117
- "gitHead": "92b45a9c7f7cfeace8b190c420cd16515a7291d9"
117
+ "gitHead": "b9a6132fcaf91314242700794d2132e596c3ca7d"
118
118
  }