@awes-io/ui 2.53.0 → 2.55.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
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.55.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.55.0...@awes-io/ui@2.55.1) (2022-07-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * app cookies expiration added ([395ace4](https://github.com/awes-io/client/commit/395ace4780ef7a23cc0b6b38df58be188fcbac87))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.55.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.54.0...@awes-io/ui@2.55.0) (2022-07-11)
18
+
19
+
20
+ ### Features
21
+
22
+ * **aw-calendar:** translations from dayjs ([c6f50fa](https://github.com/awes-io/client/commit/c6f50fa1134932894ffe691391c41290c490ad51))
23
+
24
+
25
+
26
+
27
+
28
+ # [2.54.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.53.0...@awes-io/ui@2.54.0) (2022-07-05)
29
+
30
+
31
+ ### Features
32
+
33
+ * optional menu items translation and tooltip ([8a24879](https://github.com/awes-io/client/commit/8a24879ee5d0b1ff60165567e2b70201b4cfe518))
34
+
35
+
36
+
37
+
38
+
6
39
  # [2.53.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.52.0...@awes-io/ui@2.53.0) (2022-06-29)
7
40
 
8
41
 
@@ -17,6 +17,7 @@
17
17
  &__nav-title {
18
18
  flex-grow: 1;
19
19
  text-align: center;
20
+ text-transform: capitalize;
20
21
  font-weight: bold;
21
22
  }
22
23
 
@@ -30,6 +31,7 @@
30
31
  &__weekday {
31
32
  display: block;
32
33
  text-align: center;
34
+ text-transform: capitalize;
33
35
  opacity: 0.8;
34
36
  margin-top: theme('spacing.2');
35
37
  }
@@ -20,10 +20,7 @@
20
20
  />
21
21
  </slot>
22
22
 
23
- <AwCalendarWeekdays
24
- :first-day="firstDay"
25
- :weekday-names="$t('aw.calendar.weekdays_short')"
26
- />
23
+ <AwCalendarWeekdays :first-day="firstDay" />
27
24
 
28
25
  <AwCalendarDays
29
26
  :first-day="firstDay"
@@ -1,9 +1,6 @@
1
1
  <template>
2
2
  <div class="aw-calendar" @click="onClick">
3
- <AwCalendarWeekdays
4
- :first-day="firstDay"
5
- :weekday-names="$t('aw.calendar.weekdays_short')"
6
- />
3
+ <AwCalendarWeekdays :first-day="firstDay" />
7
4
 
8
5
  <AwCalendarDays
9
6
  :first-day="firstDay"
@@ -35,6 +35,7 @@
35
35
  </template>
36
36
 
37
37
  <script>
38
+ import { pathOr, isType } from 'rambdax'
38
39
  import { AwCalendar as _config } from '@AwConfig'
39
40
 
40
41
  export default {
@@ -50,10 +51,8 @@ export default {
50
51
  },
51
52
 
52
53
  months: {
53
- type: Array,
54
- default() {
55
- return this.$t('aw.calendar.months')
56
- }
54
+ type: [Array, Function],
55
+ default: null
57
56
  },
58
57
 
59
58
  disabledPrev: Boolean,
@@ -63,7 +62,23 @@ export default {
63
62
 
64
63
  computed: {
65
64
  _months() {
66
- return Array.isArray(this.months) ? this.months : _config.months
65
+ if (isType('Array', this.month)) {
66
+ return this.month
67
+ }
68
+
69
+ const months = pathOr(
70
+ _config.months,
71
+ ['Ls', this.$i18n.locale, 'months'],
72
+ this.$dayjs
73
+ )
74
+
75
+ if (isType('Function', months) && months.s) {
76
+ return months.s
77
+ } else if (isType('Array', months)) {
78
+ return months
79
+ } else {
80
+ return _config.months
81
+ }
67
82
  }
68
83
  }
69
84
  }
@@ -16,7 +16,7 @@ export default {
16
16
 
17
17
  weekdayNames: {
18
18
  type: Array,
19
- required: true
19
+ default: null
20
20
  }
21
21
  },
22
22
 
@@ -33,7 +33,11 @@ export default {
33
33
 
34
34
  const namesArray = Array.isArray(weekdayNames)
35
35
  ? weekdayNames
36
- : _config.weekdaysShort
36
+ : pathOr(
37
+ _config.weekdaysShort,
38
+ ['Ls', parent.$i18n.locale, 'weekdaysMin'],
39
+ parent.$dayjs
40
+ )
37
41
 
38
42
  const sortedNames = namesArray
39
43
  .slice(firstDay)
@@ -50,10 +50,7 @@
50
50
  :disabled-next="view.disabledNext"
51
51
  v-on="view.navListeners"
52
52
  />
53
- <AwCalendarWeekdays
54
- :first-day="firstDay"
55
- :weekday-names="$t('aw.calendar.weekdays_short')"
56
- />
53
+ <AwCalendarWeekdays :first-day="firstDay" />
57
54
  <AwCalendarDays
58
55
  :first-day="firstDay"
59
56
  :month="month"
@@ -175,6 +175,7 @@ export default {
175
175
  {
176
176
  show,
177
177
  text,
178
+ translate = true,
178
179
  subtitle,
179
180
  description,
180
181
  href,
@@ -203,7 +204,7 @@ export default {
203
204
  href = isType('Function', href)
204
205
  ? href(state, getters)
205
206
  : href
206
- text = this.$t(text)
207
+ text = translate === false ? text : this.$t(text)
207
208
  subtitle = subtitle ? this.$t(subtitle) : undefined
208
209
  description = description ? this.$t(description) : null
209
210
 
@@ -19,7 +19,12 @@
19
19
  "
20
20
  >
21
21
  <AwIcon v-if="item.icon" size="16" :name="item.icon" />
22
- <span>{{ item.text }}</span>
22
+ <span
23
+ v-tooltip="tooltips[i]"
24
+ :[$options.TOOLTIP_EL_ATTR]="i"
25
+ >
26
+ {{ item.text }}
27
+ </span>
23
28
  <AwBadge
24
29
  v-if="item.badge"
25
30
  v-bind="item.badge"
@@ -56,7 +61,12 @@
56
61
  }"
57
62
  class="aw-nav__child truncate aw-nav__child--sub"
58
63
  >
59
- <span>{{ subchild.text }}</span>
64
+ <span
65
+ v-tooltip="tooltips[i + '-' + j]"
66
+ :[$options.TOOLTIP_EL_ATTR]="i + '-' + j"
67
+ >
68
+ {{ subchild.text }}
69
+ </span>
60
70
  <AwBadge
61
71
  v-if="subchild.badge"
62
72
  v-bind="subchild.badge"
@@ -70,12 +80,15 @@
70
80
 
71
81
  <script>
72
82
  import { viewOr, lensProp } from 'rambdax'
83
+ import { supportsPassive } from '@AwUtils/events'
73
84
  import AwNavItem from '@AwLayouts/_AwNavItem.vue'
74
85
 
75
86
  const TOGGLE_CHILDREN_ATTR = 'data-toggle-children'
76
87
 
77
88
  const OPEN_CHILDREN_ATTR = 'data-open-children'
78
89
 
90
+ const TOOLTIP_EL_ATTR = 'data-tooltip-el'
91
+
79
92
  const targetByAttribute = (attr, $event) =>
80
93
  $event.target.hasAttribute(attr)
81
94
  ? $event.target
@@ -92,6 +105,8 @@ export default {
92
105
 
93
106
  OPEN_CHILDREN_ATTR,
94
107
 
108
+ TOOLTIP_EL_ATTR,
109
+
95
110
  props: {
96
111
  title: {
97
112
  type: String,
@@ -112,7 +127,8 @@ export default {
112
127
 
113
128
  data() {
114
129
  return {
115
- openedChildren: []
130
+ openedChildren: [],
131
+ tooltips: {}
116
132
  }
117
133
  },
118
134
 
@@ -137,11 +153,37 @@ export default {
137
153
  )
138
154
  )
139
155
  })
156
+
157
+ if (typeof oldItems !== 'undefined') {
158
+ this.$nextTick(this._calculateOversizedText)
159
+ }
140
160
  },
141
161
  immediate: true
142
162
  }
143
163
  },
144
164
 
165
+ mounted() {
166
+ this.$nextTick(this._calculateOversizedText)
167
+
168
+ const eventOptions = supportsPassive() ? { passive: true } : false
169
+
170
+ window.addEventListener(
171
+ 'resize',
172
+ this._calculateOversizedText,
173
+ eventOptions
174
+ )
175
+
176
+ this.$once('hook:beforeDestroy', () => {
177
+ this.tooltips = {}
178
+
179
+ window.addEventListener(
180
+ 'resize',
181
+ this._calculateOversizedText,
182
+ eventOptions
183
+ )
184
+ })
185
+ },
186
+
145
187
  methods: {
146
188
  _getItemToggleAttr(item) {
147
189
  return item.href ? OPEN_CHILDREN_ATTR : TOGGLE_CHILDREN_ATTR
@@ -175,6 +217,23 @@ export default {
175
217
 
176
218
  return
177
219
  }
220
+ },
221
+
222
+ _calculateOversizedText() {
223
+ this.tooltips = {}
224
+
225
+ const children = this.$el.querySelectorAll(
226
+ '[' + TOOLTIP_EL_ATTR + ']'
227
+ )
228
+
229
+ for (let i = 0; i < children.length; i++) {
230
+ const el = children[i]
231
+
232
+ if (el.scrollWidth > el.clientWidth) {
233
+ this.tooltips[el.getAttribute(TOOLTIP_EL_ATTR)] =
234
+ el.textContent
235
+ }
236
+ }
178
237
  }
179
238
  }
180
239
  }
@@ -13,7 +13,7 @@ export default function({ store, app }) {
13
13
 
14
14
  if (isNil(isDark)) {
15
15
  isDark = window.matchMedia('(prefers-color-scheme: dark)').matches
16
- JsCookie.set(COOKIE_NAME, isDark, { sameSite: 'lax' })
16
+ JsCookie.set(COOKIE_NAME, isDark, { sameSite: 'lax', expires: 365 })
17
17
  } else {
18
18
  isDark = JSON.parse(isDark)
19
19
  }
@@ -36,7 +36,7 @@ export default function({ store, app }) {
36
36
  store.watch(
37
37
  (state) => state.awesIo.isDarkTheme,
38
38
  (isDark) => {
39
- JsCookie.set(COOKIE_NAME, isDark, { sameSite: 'lax' })
39
+ JsCookie.set(COOKIE_NAME, isDark, { sameSite: 'lax', expires: 365 })
40
40
  document.documentElement.setAttribute(ATTR, isDark)
41
41
  app.head.htmlAttrs[ATTR] = isDark
42
42
  }
@@ -118,9 +118,9 @@ export default async ({ app, $axios }) => {
118
118
  }
119
119
  } else if (_browserLang) {
120
120
  app.i18n.locale = _browserLang
121
- JsCookie.set(langCookie, _browserLang, { sameSite: 'lax' })
121
+ JsCookie.set(langCookie, _browserLang, { sameSite: 'lax', expires: 365 })
122
122
  } else {
123
- JsCookie.set(langCookie, i18nOptions.locale, { sameSite: 'lax' })
123
+ JsCookie.set(langCookie, i18nOptions.locale, { sameSite: 'lax', expires: 365 })
124
124
  }
125
125
  }
126
126
 
@@ -173,7 +173,7 @@ export default async ({ app, $axios }) => {
173
173
  app.i18n.locale = locale
174
174
 
175
175
  if (langCookie) {
176
- JsCookie.set(langCookie, locale, { sameSite: 'lax' })
176
+ JsCookie.set(langCookie, locale, { sameSite: 'lax', expires: 365 })
177
177
  }
178
178
 
179
179
  for (const afterListener of afterListeners.keys()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.53.0",
3
+ "version": "2.55.1",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -54,7 +54,7 @@
54
54
  "@nuxtjs/svg-sprite": "^0.5.2",
55
55
  "@popperjs/core": "^2.0.5",
56
56
  "autosize": "^4.0.2",
57
- "axios": "^0.19.0",
57
+ "axios": "^0.27.2",
58
58
  "body-scroll-lock": "^2.6.4",
59
59
  "chroma-js": "^2.0.6",
60
60
  "clipboard-copy": "^3.1.0",
@@ -122,5 +122,5 @@
122
122
  "vue-template-compiler": "^2.6.10",
123
123
  "webfonts-generator": "^0.4.0"
124
124
  },
125
- "gitHead": "bdd10f2d121d75c137381357d3dbc72119b40630"
125
+ "gitHead": "b43f233a26bb90c7e3a232aec4602bedde29bf2d"
126
126
  }