wave-ui 3.4.2 → 3.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "description": "An emerging UI framework for Vue.js (2 & 3) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "homepage": "https://antoniandre.github.io/wave-ui",
@@ -46,7 +46,8 @@
46
46
  "build": "vite build --base /wave-ui/",
47
47
  "build-bundle": "BUNDLE=true vite build && mv ./dist/style.css ./dist/wave-ui.css",
48
48
  "serve": "vite preview --base /wave-ui/",
49
- "lint": "vite lint"
49
+ "lint": "vite lint",
50
+ "publish": "npm run build && npm run build-bundle && git add . && git commit -m 'Publish documentation on Github.' && git push && git push tags && npm publish --tag latest"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@babel/core": "^7.21.3",
@@ -103,12 +103,17 @@ export default {
103
103
  padding: (2 * $base-increment) (3 * $base-increment);
104
104
  font-size: 1.3em;
105
105
  border-bottom: $border;
106
- border-top-left-radius: inherit;
107
- border-top-right-radius: inherit;
108
106
 
109
107
  &--has-toolbar {padding: 0;border-bottom: none;}
110
108
  }
111
109
 
110
+ // When there is no title apply the border radius to the image.
111
+ &__image:first-child {
112
+ border-top-left-radius: inherit;
113
+ border-top-right-radius: inherit;
114
+ overflow: hidden;
115
+ }
116
+
112
117
  &__content {
113
118
  padding: 3 * $base-increment;
114
119
  flex-grow: 1;
@@ -28,15 +28,19 @@ ul.w-tree(:class="classes")
28
28
  :depth="depth"
29
29
  :path="item.path"
30
30
  :open="item.open")
31
- w-icon(v-if="itemIcon(item)" class="w-tree__item-icon" :color="item.originalItem[itemIconColorKey] || iconColor") {{ itemIcon(item) }}
31
+ w-icon(
32
+ v-if="itemIcon(item)"
33
+ class="w-tree__item-icon"
34
+ :color="item.originalItem[itemIconColorKey] || iconColor").
35
+ {{ itemIcon(item) }}
32
36
  span(v-html="item.label")
33
37
  span.ml1(v-if="counts && (item.children || item.branch)").
34
38
  ({{ item.originalItem.children?.length || 0 }})
35
39
  component(
36
40
  :is="noTransition ? 'div' : 'w-transition-expand'"
37
41
  :y="!noTransition || null"
38
- @after-enter="$emit('open', { item: item.originalItem, open: item.open, depth, path: getTreeItemPathForOutput(item) })"
39
- @after-leave="$emit('close', { item: item.originalItem, open: item.open, depth, path: getTreeItemPathForOutput(item) })")
42
+ @after-enter="$emit('open', emitPayload(item))"
43
+ @after-leave="$emit('close', emitPayload(item))")
40
44
  w-tree(
41
45
  v-if="item.children && item.open"
42
46
  v-bind="$props"
@@ -104,6 +108,7 @@ export default {
104
108
  return {
105
109
  [`w-tree--depth${this.depth}`]: true,
106
110
  'w-tree--expand-icon': this.expandIcon && !this.depth,
111
+ 'w-tree--selectable': this.selectable,
107
112
  'w-tree--disabled': this.disabled && !this.depth,
108
113
  'w-tree--no-expand-button': !this.expandIcon
109
114
  }
@@ -130,6 +135,7 @@ export default {
130
135
  branch: item.branch,
131
136
  route: item[this.itemRouteKey],
132
137
  disabled: item[this.itemDisabledKey],
138
+ selected: oldItems[i]?.selected || false,
133
139
  depth: this.depth,
134
140
  open: !!(oldItems[i]?.open || this.expandAll || item[this.itemOpenKey]),
135
141
  parent: this.parent || null,
@@ -183,17 +189,12 @@ export default {
183
189
  if (typeof open === 'boolean') item.open = open
184
190
  else item.open = !item.open
185
191
 
186
- const emitParams = {
187
- item: item.originalItem,
188
- open: item.open,
189
- depth: this.depth,
190
- path: this.getTreeItemPathForOutput(item)
191
- }
192
+ const emitPayload = this.emitPayload(item)
192
193
 
193
- this.$emit(item.open ? 'before-open' : 'before-close', emitParams)
194
+ this.$emit(item.open ? 'before-open' : 'before-close', emitPayload)
194
195
 
195
196
  if (!this.unexpandableEmpty && !item.children) {
196
- this.$emit(item.open ? 'open' : 'close', emitParams)
197
+ this.$emit(item.open ? 'open' : 'close', emitPayload)
197
198
  }
198
199
 
199
200
  return true // Just to chain instructions.
@@ -203,29 +204,12 @@ export default {
203
204
  const route = item[this.itemRouteKey]
204
205
  if (route && this.$router && !this.hasExternalLink(item)) e.preventDefault()
205
206
 
206
- this.$emit('click', {
207
- item: item.originalItem,
208
- depth: this.depth,
209
- path: this.getTreeItemPathForOutput(item),
210
- e
211
- })
212
207
  if (item.children || (item.branch && !this.unexpandableEmpty)) this.expandDepth(item)
208
+ if (this.selectable) item.selected = !item.selected
213
209
 
214
- if (this.selectable) this.emitItemSelection(item, e)
215
- },
216
-
217
- emitItemSelection (item, e) {
218
- const emitParams = {
219
- item: item.originalItem,
220
- depth: this.depth,
221
- path: this.getTreeItemPathForOutput(item),
222
- e
223
- }
224
- if (item.children || (item.branch && !this.unexpandableEmpty)) {
225
- emitParams.open = item.open
226
- }
227
- this.$emit('update:model-value', emitParams)
228
- this.$emit('select', emitParams)
210
+ const emitPayload = this.emitPayload(item, e)
211
+ this.$emit('click', emitPayload)
212
+ this.emitItemSelection(item, e) // Always emitting on click, but different event for selection.
229
213
  },
230
214
 
231
215
  onLabelKeydown (item, e) {
@@ -254,7 +238,32 @@ export default {
254
238
  }
255
239
  }
256
240
 
257
- if (this.selectable) this.emitItemSelection(item, e)
241
+ if (e.which === 13) {
242
+ if (this.selectable) item.selected = !item.selected
243
+ // Always emitting on enter keydown, but different event for selection.
244
+ this.emitItemSelection(item, e)
245
+ }
246
+ },
247
+
248
+ emitItemSelection (item, e) {
249
+ const emitPayload = this.emitPayload(item, e)
250
+
251
+ this.$emit('update:model-value', emitPayload)
252
+ if (this.selectable) this.$emit('select', emitPayload)
253
+ },
254
+
255
+ emitPayload (item, e) {
256
+ const emitPayload = {
257
+ item: item.originalItem,
258
+ depth: this.depth,
259
+ path: this.getTreeItemPathForOutput(item)
260
+ }
261
+
262
+ if (e) emitPayload.e = e
263
+ if (item.children || (item.branch && !this.unexpandableEmpty)) emitPayload.open = item.open
264
+ if (this.selectable) emitPayload.selected = item.selected
265
+
266
+ return emitPayload
258
267
  },
259
268
 
260
269
  /**
@@ -305,6 +314,7 @@ export default {
305
314
  return {
306
315
  [item.children || item.branch ? 'w-tree__item--branch' : 'w-tree__item--leaf']: true,
307
316
  'w-tree__item--disabled': item[this.itemDisabledKey],
317
+ 'w-tree__item--selected': item.selected,
308
318
  'w-tree__item--empty': item.branch && !item.children,
309
319
  'w-tree__item--unexpandable': item.branch && !item.children && this.unexpandableEmpty
310
320
  }
@@ -359,12 +369,18 @@ $expand-icon-size: 20px;
359
369
  border-radius: $border-radius;
360
370
  }
361
371
  &:hover:before {background-color: $primary;opacity: 0.1;}
362
- &:focus:before {background-color: $primary;opacity: 0.2;}
372
+ &:focus-visible:before {background-color: $primary;opacity: 0.15;}
363
373
  }
374
+ &.w-tree--selectable &__item-label {cursor: pointer;}
375
+ &.w-tree--selectable &__item--disabled &__item-label {cursor: auto;}
364
376
  &__item--leaf &__item-label:before {
365
377
  left: - $base-increment;
366
378
  right: - $base-increment;
367
379
  }
380
+ &__item--selected > &__item-label:before {
381
+ background-color: $primary;
382
+ opacity: 0.25;
383
+ }
368
384
  &__item--disabled &__item-label {opacity: 0.5;}
369
385
  &__item--disabled &__item-label:before {display: none;}
370
386