wave-ui 1.58.0 → 1.60.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.
@@ -166,7 +166,7 @@ export default {
166
166
  &__button {
167
167
  position: relative;
168
168
  width: 1.1em;
169
- height: 1.1em;
169
+ aspect-ratio: 1;
170
170
  display: inline-flex;
171
171
  align-items: center;
172
172
  justify-content: center;
@@ -216,6 +216,7 @@ export default {
216
216
  position: absolute;
217
217
  left: 0;
218
218
  width: 100%;
219
+ height: 100%;
219
220
  font-size: 1em;
220
221
  justify-content: flex-start;
221
222
  overflow: hidden;
@@ -295,7 +295,7 @@ export default {
295
295
  transform: translateX(-50%);
296
296
  top: 0;
297
297
  width: $base-increment;
298
- height: $base-increment;
298
+ aspect-ratio: 1;
299
299
  background-color: rgba(0, 0, 0, 0.2);
300
300
  border-radius: 99em;
301
301
  // box-shadow: 0 0 0 1px #fff;
@@ -358,7 +358,7 @@ export default {
358
358
  &__thumb {
359
359
  position: absolute;
360
360
  width: 3 * $base-increment;
361
- height: 3 * $base-increment;
361
+ aspect-ratio: 1;
362
362
  left: 100%;
363
363
  top: 50%;
364
364
  transform: translate(-50%, -50%);
@@ -373,7 +373,7 @@ export default {
373
373
  left: 0;
374
374
  top: 0;
375
375
  width: 100%;
376
- height: 100%;
376
+ aspect-ratio: 1;
377
377
  border: none;
378
378
  border-radius: 99em;
379
379
  cursor: pointer;
@@ -452,7 +452,7 @@ export default {
452
452
  transform: translateX(-50%) rotate(-45deg);
453
453
  border-radius: 99em 99em 99em 0;
454
454
  width: 2.8em;
455
- height: 2.8em;
455
+ aspect-ratio: 1;
456
456
 
457
457
  & > div {
458
458
  position: absolute;
@@ -61,7 +61,7 @@ export default {
61
61
  align-self: center;
62
62
  font-size: 2rem;
63
63
  width: 1em;
64
- height: 1em;
64
+ aspect-ratio: 1;
65
65
 
66
66
  &.size--xs {font-size: round(0.9 * divide($base-font-size, 2)) * 2;}
67
67
  &.size--sm {font-size: round(1.5 * $base-font-size);}
@@ -73,7 +73,7 @@ export default {
73
73
  content: '';
74
74
  position: absolute;
75
75
  width: 100%;
76
- height: 100%;
76
+ aspect-ratio: 1;
77
77
  top: 0;
78
78
  left: 0;
79
79
  background-color: currentColor;
@@ -33,8 +33,13 @@ component(
33
33
  :class="inputClasses")
34
34
  .w-switch__track(v-if="$slots.track")
35
35
  slot(name="track")
36
- .w-switch__thumb(v-if="$slots.thumb")
37
- slot(name="thumb")
36
+ .w-switch__thumb(v-if="$slots.thumb || loading")
37
+ w-progress(
38
+ v-if="loading"
39
+ circle
40
+ color="inherit"
41
+ v-bind="typeof loading === 'number' ? { 'model-value': loading } : {}")
42
+ slot(v-else name="thumb")
38
43
  template(v-if="hasLabel && !labelOnLeft")
39
44
  label.w-switch__label.w-switch__label--right.w-form-el-shakable(
40
45
  v-if="$slots.default || label"
@@ -57,7 +62,8 @@ export default {
57
62
  color: { type: String, default: 'primary' },
58
63
  labelColor: { type: String, default: 'primary' },
59
64
  thin: { type: Boolean },
60
- noRipple: { type: Boolean }
65
+ noRipple: { type: Boolean },
66
+ loading: { type: [Boolean, Number], default: false }
61
67
  // Props from mixin: name, disabled, readonly, required, tabindex, validators.
62
68
  // Computed from mixin: inputName, isDisabled & isReadonly.
63
69
  },
@@ -88,6 +94,7 @@ export default {
88
94
  'w-switch--ripple': this.ripple.start,
89
95
  'w-switch--custom-thumb': this.$slots.thumb,
90
96
  'w-switch--custom-track': this.$slots.track,
97
+ 'w-switch--loading': this.loading,
91
98
  'w-switch--rippled': this.ripple.end
92
99
  }
93
100
  },
@@ -142,6 +149,7 @@ $disabled-color: #ddd;
142
149
  vertical-align: middle;
143
150
  cursor: pointer;
144
151
 
152
+ &--loading {cursor: wait;}
145
153
  &--disabled, &--readonly {
146
154
  cursor: not-allowed;
147
155
  touch-action: initial;
@@ -234,7 +242,9 @@ $disabled-color: #ddd;
234
242
  background-color: currentColor;
235
243
  }
236
244
  }
237
- &--custom-thumb &__input:after {display: none;}
245
+ &--loading .w-progress {padding: 1px;}
246
+ &--loading.w-switch--thin.w-switch--on .w-progress {color: #fff;}
247
+ &--loading &__input:after, &--custom-thumb &__input:after {display: none;}
238
248
  &__thumb > * {
239
249
  width: inherit;
240
250
  height: inherit;
@@ -247,7 +257,7 @@ $disabled-color: #ddd;
247
257
  left: 0;
248
258
  top: 0;
249
259
  width: $small-form-el-size;
250
- height: $small-form-el-size;
260
+ aspect-ratio: 1;
251
261
  background-color: currentColor;
252
262
  border-radius: 100%;
253
263
  opacity: 0;
@@ -37,11 +37,16 @@
37
37
  v-if="i < headers.length - 1 && resizableColumns"
38
38
  :class="{ 'w-table__col-resizer--hover': colResizing.hover === i, 'w-table__col-resizer--active': colResizing.columnIndex === i }"
39
39
  @click.stop="/* Prevent click on header, which triggers sorting & DOM refresh. */")
40
+ //- Progress bar only.
41
+ w-transition-fade
42
+ tr.w-table__progress-bar(v-if="loading === 'header'")
43
+ td(:colspan="headers.length")
44
+ w-progress(tile)
40
45
 
41
46
  //- Table body.
42
47
  tbody
43
- //- Progress bar.
44
- tr.w-table__progress-bar(v-if="loading")
48
+ //- Progress bar & loading text.
49
+ tr.w-table__progress-bar(v-if="loading === true")
45
50
  td(:colspan="headers.length")
46
51
  w-progress(tile)
47
52
  .w-table__loading-text
@@ -52,7 +57,7 @@
52
57
  slot(name="no-data") No data to show.
53
58
 
54
59
  //- Normal rows.
55
- template(v-else)
60
+ template(v-if="tableItems.length && loading !== true")
56
61
  template(v-for="(item, i) in sortedItems")
57
62
  //- Fully custom tr (`item` slot).
58
63
  slot(
@@ -150,7 +155,7 @@ export default {
150
155
  fixedLayout: { type: Boolean },
151
156
  fixedHeaders: { type: Boolean },
152
157
  fixedFooter: { type: Boolean },
153
- loading: { type: Boolean },
158
+ loading: { type: [Boolean, String] }, // Bool or 'header' to only display the bar in the header.
154
159
  // Allow single sort: `+id`, or multiple in an array like: ['+id', '-firstName'].
155
160
  sort: { type: [String, Array] },
156
161
 
@@ -188,6 +193,7 @@ export default {
188
193
  uidKey: { type: String, default: 'id' },
189
194
 
190
195
  filter: { type: Function },
196
+ sortFunction: { type: Function },
191
197
  mobileBreakpoint: { type: Number, default: 0 },
192
198
  resizableColumns: { type: Boolean }
193
199
  },
@@ -232,7 +238,7 @@ export default {
232
238
  },
233
239
 
234
240
  sortedItems () {
235
- if (!this.activeSorting.length) return this.filteredItems
241
+ if (!this.activeSorting.length || this.sortFunction) return this.filteredItems
236
242
 
237
243
  // Only sort with 1 key for now, may handle more later.
238
244
  const sortKey1 = this.activeSorting[0].replace(/^[+-]/, '')
@@ -313,15 +319,18 @@ export default {
313
319
  ]
314
320
  },
315
321
 
316
- sortTable (header) {
322
+ async sortTable (header) {
317
323
  const alreadySortingThis = this.activeSortingKeys[header.key]
318
324
  if (alreadySortingThis && this.activeSortingKeys[header.key] === '-') {
319
325
  this.activeSorting = []
320
- return this.$emit('update:sort')
321
326
  }
322
327
  else this.$set(this.activeSorting, 0, (alreadySortingThis ? '-' : '+') + header.key)
323
328
 
324
329
  this.$emit('update:sort', this.activeSorting)
330
+
331
+ if (typeof this.sortFunction === 'function') {
332
+ await this.sortFunction(this.activeSorting)
333
+ }
325
334
  },
326
335
 
327
336
  doSelectRow (item, index) {
@@ -549,6 +558,8 @@ $tr-border-top: 1px;
549
558
 
550
559
  // Table headers.
551
560
  // ------------------------------------------------------
561
+ thead {position: relative;}
562
+
552
563
  &__header {padding: $base-increment;}
553
564
  &__header--resizable {
554
565
  overflow: hidden;
@@ -628,6 +639,12 @@ $tr-border-top: 1px;
628
639
 
629
640
  // Progress bar when loading.
630
641
  &__progress-bar:nth-child(odd) {background: none;}
642
+ thead .w-progress {
643
+ position: absolute;
644
+ bottom: 0;
645
+ left: 0;
646
+ right: 0;
647
+ }
631
648
  &__progress-bar td {padding: 0;height: 1px;}
632
649
  @-moz-document url-prefix() {
633
650
  &__progress-bar td {height: 100%;}
@@ -754,6 +771,7 @@ $tr-border-top: 1px;
754
771
 
755
772
  .w-table__progress-bar {
756
773
  display: table-row;
774
+
757
775
  td {display: table-cell;}
758
776
  td:before {display: none;}
759
777
  }
@@ -178,8 +178,10 @@ export default {
178
178
 
179
179
  if (!this.fillBar && this.activeTabEl) {
180
180
  const { left, width } = this.activeTabEl.getBoundingClientRect()
181
- const { left: parentLeft } = this.activeTabEl.parentNode.getBoundingClientRect()
182
- this.slider.left = `${left - parentLeft + this.activeTabEl.parentNode.scrollLeft}px`
181
+ const tabsBar = this.activeTabEl.parentNode
182
+ const { left: parentLeft } = tabsBar.getBoundingClientRect()
183
+ const { borderLeftWidth } = getComputedStyle(tabsBar)
184
+ this.slider.left = `${left - parentLeft - parseInt(borderLeftWidth) + tabsBar.scrollLeft}px`
183
185
  this.slider.width = `${width}px`
184
186
  }
185
187
  else {
@@ -5,7 +5,7 @@ ul.w-timeline
5
5
  :is="item[itemIconKey] || icon ? 'w-icon' : 'div'"
6
6
  :class="{ [item[itemColorKey] || color]: item[itemColorKey] || color }")
7
7
  | {{ item[itemIconKey] || icon }}
8
- slot(name="item" v-if="!$slots[`item.${i + 1}`]" :item="item" :index="i + 1")
8
+ slot(name="item" v-if="!$scopedSlots[`item.${i + 1}`]" :item="item" :index="i + 1")
9
9
  .w-timeline-item__title(
10
10
  :class="{ [item[itemColorKey] || color]: item[itemColorKey] || color }"
11
11
  v-html="item[itemTitleKey]")
@@ -52,7 +52,7 @@ export default {
52
52
  border-radius: 1em;
53
53
  border: 1px solid currentColor;
54
54
  width: $base-font-size;
55
- height: $base-font-size;
55
+ aspect-ratio: 1;
56
56
  transform: translateX(-50%);
57
57
  z-index: 1;
58
58
  }
@@ -1,7 +1,6 @@
1
1
  import config, { mergeConfig } from './utils/config'
2
2
  import NotificationManager from './utils/notification-manager'
3
3
  import colors from './utils/colors'
4
- import { consoleWarn } from './utils/console'
5
4
  // import * as directives from './directives'
6
5
 
7
6
  const shadeColor = (col, amt) => {
@@ -42,8 +41,8 @@ export default class WaveUI {
42
41
  // if (directives[id]) Vue.directive(id, directives[id])
43
42
  // }
44
43
  Vue.directive('focus', {
45
- // When the bound element is inserted into the DOM.
46
- inserted: el => el.focus()
44
+ // Wait for the next tick to focus the newly mounted element.
45
+ inserted: el => setTimeout(() => el.focus(), 0)
47
46
  })
48
47
  Vue.directive('scroll', {
49
48
  inserted: (el, binding) => {