wave-ui 2.40.4 → 2.42.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "2.40.4",
3
+ "version": "2.42.0",
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
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "dev": "vite",
38
38
  "build": "vite build --base /wave-ui/",
39
39
  "build-bundle": "BUNDLE=true vite build && mv ./dist/style.css ./dist/wave-ui.css",
40
- "serve": "vite preview --root docs --base /wave-ui/",
40
+ "serve": "vite preview --base /wave-ui/",
41
41
  "lint": "vite lint"
42
42
  },
43
43
  "sideEffects": [
@@ -46,30 +46,29 @@
46
46
  "*.vue"
47
47
  ],
48
48
  "devDependencies": {
49
- "@babel/core": "^7.17.9",
50
- "@babel/eslint-parser": "^7.17.0",
51
- "@babel/plugin-proposal-class-properties": "^7.16.7",
49
+ "@babel/core": "^7.18.13",
50
+ "@babel/eslint-parser": "^7.18.9",
51
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
52
52
  "@mdi/font": "^5.9.55",
53
53
  "@vitejs/plugin-vue": "^1.10.2",
54
54
  "@vue/compiler-sfc": "3.1.5",
55
- "autoprefixer": "^10.4.4",
55
+ "autoprefixer": "^10.4.8",
56
56
  "axios": "^0.25.0",
57
57
  "eslint": "^7.32.0",
58
58
  "font-awesome": "^4.7.0",
59
- "gsap": "^3.10.3",
59
+ "gsap": "^3.11.0",
60
60
  "ionicons": "^4.6.3",
61
61
  "material-design-icons": "^3.0.1",
62
- "postcss": "^8.4.12",
62
+ "postcss": "^8.4.16",
63
63
  "rollup-plugin-delete": "^2.0.0",
64
- "sass": "^1.50.0",
65
- "simple-syntax-highlighter": "^2.2.0",
64
+ "sass": "^1.54.5",
65
+ "simple-syntax-highlighter": "^2.2.3",
66
66
  "splitpanes": "^3.1.1",
67
- "vite": "^2.9.5",
67
+ "vite": "^2.9.15",
68
68
  "vite-plugin-pug": "^0.3.1",
69
- "vue": "^3.2.33",
70
- "vue-cal": "^4.2.0",
71
- "vue-router": "^4.0.14",
72
- "vueperslides": "^3.3.2",
69
+ "vue": "^3.2.37",
70
+ "vue-router": "^4.1.5",
71
+ "vueperslides": "^3.4.2",
73
72
  "vuex": "^4.0.2"
74
73
  }
75
74
  }
@@ -73,7 +73,7 @@
73
73
  v-if="$slots[`item-cell.${header.key}`] || $slots[`item-cell.${j + 1}`] || $slots['item-cell']"
74
74
  :key="`${j}-a`"
75
75
  :data-label="header.label"
76
- :class="`text-${header.align || 'left'}`")
76
+ :class="{ [`text-${header.align || 'left'}`]: true, 'w-table__cell--sticky': header.sticky }")
77
77
  slot(
78
78
  v-if="$slots[`item-cell.${header.key}`]"
79
79
  :name="`item-cell.${header.key}`"
@@ -103,7 +103,7 @@
103
103
  v-else
104
104
  :key="`${j}-b`"
105
105
  :data-label="header.label"
106
- :class="`text-${header.align || 'left'}`")
106
+ :class="{ [`text-${header.align || 'left'}`]: true, 'w-table__cell--sticky': header.sticky }")
107
107
  div(v-html="item[header.key] || ''")
108
108
  span.w-table__col-resizer(
109
109
  v-if="j < headers.length - 1 && resizableColumns"
@@ -147,6 +147,7 @@ export default {
147
147
  items: { type: Array, required: true },
148
148
  headers: { type: Array, required: true },
149
149
  noHeaders: { type: Boolean },
150
+ fixedLayout: { type: Boolean },
150
151
  fixedHeaders: { type: Boolean },
151
152
  fixedFooter: { type: Boolean },
152
153
  loading: { type: Boolean },
@@ -264,11 +265,13 @@ export default {
264
265
 
265
266
  classes () {
266
267
  return {
268
+ 'w-table--fixed-layout': this.fixedLayout || this.resizableColumns || this.hasStickyColumn,
267
269
  'w-table--mobile': this.isMobile || null,
268
270
  'w-table--resizable-cols': this.resizableColumns || null,
269
271
  'w-table--resizing': this.colResizing.dragging,
270
272
  'w-table--fixed-header': this.fixedHeaders,
271
- 'w-table--fixed-footer': this.fixedFooter
273
+ 'w-table--fixed-footer': this.fixedFooter,
274
+ 'w-table--sticky-column': this.hasStickyColumn
272
275
  }
273
276
  },
274
277
 
@@ -276,6 +279,10 @@ export default {
276
279
  return ~~this.mobileBreakpoint && this.$waveui.breakpoint.width <= ~~this.mobileBreakpoint
277
280
  },
278
281
 
282
+ hasStickyColumn () {
283
+ return this.headers.find(header => header.sticky)
284
+ },
285
+
279
286
  // Faster lookup than array.includes(uid) and also cached.
280
287
  selectedRowsByUid () {
281
288
  return this.selectedRowsInternal.reduce((obj, uid) => (obj[uid] = true) && obj, {})
@@ -291,6 +298,7 @@ export default {
291
298
  headerClasses (header) {
292
299
  return {
293
300
  'w-table__header--sortable': header.sortable !== false, // Can also be falsy with `0`.
301
+ 'w-table__header--sticky': header.sticky,
294
302
  'w-table__header--resizable': !!this.resizableColumns,
295
303
  [`text-${header.align || 'left'}`]: true
296
304
  }
@@ -529,7 +537,7 @@ $tr-border-top: 1px;
529
537
  border-collapse: collapse;
530
538
  border: none;
531
539
 
532
- &--resizable-cols {
540
+ &--fixed-layout {
533
541
  table-layout: fixed; // Allow resizing beyond the cell minimum text width.
534
542
  }
535
543
 
@@ -552,6 +560,7 @@ $tr-border-top: 1px;
552
560
  position: sticky;
553
561
  top: 0;
554
562
  background-color: #fff;
563
+ z-index: 1; // For sticky columns to go under.
555
564
 
556
565
  &:after {
557
566
  content: '';
@@ -563,6 +572,22 @@ $tr-border-top: 1px;
563
572
  }
564
573
  }
565
574
 
575
+ &__header--sticky {
576
+ position: sticky;
577
+ left: 0;
578
+
579
+ &:before {
580
+ content: '';
581
+ position: absolute;
582
+ top: 0;
583
+ left: 0;
584
+ right: 0;
585
+ bottom: 0;
586
+ z-index: -1;
587
+ background-color: #fff;
588
+ }
589
+ }
590
+
566
591
  // Sorting arrow.
567
592
  &__header--sortable {cursor: pointer;}
568
593
  &__header-sort {
@@ -652,6 +677,24 @@ $tr-border-top: 1px;
652
677
  }
653
678
  }
654
679
 
680
+ &__cell--sticky {
681
+ position: sticky;
682
+ left: 0;
683
+
684
+ &:before, &:after {
685
+ content: '';
686
+ position: absolute;
687
+ top: 0;
688
+ left: 0;
689
+ right: 0;
690
+ bottom: 0;
691
+ z-index: -1;
692
+ }
693
+ &:before {background-color: #fff;}
694
+ }
695
+ tr:nth-child(odd) &__cell--sticky:after {background-color: $table-tr-odd-color;}
696
+ tr:hover &__cell--sticky:after {background-color: $table-tr-hover-color;}
697
+
655
698
  .no-data &__cell {
656
699
  background-color: rgba(255, 255, 255, 0.2);
657
700
  padding: (2 * $base-increment) $base-increment;
@@ -668,6 +711,7 @@ $tr-border-top: 1px;
668
711
  position: sticky;
669
712
  bottom: 0;
670
713
  background-color: #fff;
714
+ z-index: 1; // For sticky columns to go under.
671
715
 
672
716
  &:after {
673
717
  content: '';
@@ -359,6 +359,7 @@ export default {
359
359
  // ------------------------------------------------------
360
360
  &__content-wrap {
361
361
  position: relative;
362
+ flex-grow: 1;
362
363
 
363
364
  .w-tabs--card & {
364
365
  border: $border;
@@ -1,4 +1,4 @@
1
- import { reactive } from 'vue'
1
+ import { reactive, inject } from 'vue'
2
2
  import config, { mergeConfig } from './utils/config'
3
3
  import NotificationManager from './utils/notification-manager'
4
4
  import colors from './utils/colors'
@@ -111,11 +111,12 @@ export default class WaveUI {
111
111
  }
112
112
 
113
113
  this.config = config
114
- this.notify = notificationManager.notify
114
+ this.notify = (...args) => notificationManager.notify(...args)
115
115
  WaveUI.instance = this
116
116
 
117
117
  // Make waveui reactive and expose the single instance in Vue.
118
118
  app.config.globalProperties.$waveui = reactive(this)
119
+ app.provide('$waveui', WaveUI.instance)
119
120
  }
120
121
  }
121
122
 
@@ -124,4 +125,7 @@ export default class WaveUI {
124
125
  }
125
126
  }
126
127
 
127
- WaveUI.version = '__VERSION__'
128
+ /**
129
+ * Returns the WaveUI instance. Equivalent to using `$waveui` inside templates.
130
+ */
131
+ export const useWaveUI = () => inject('$waveui')
@@ -4,4 +4,4 @@ import * as components from './components'
4
4
  const install = WaveUI.install
5
5
  WaveUI.install = (app, options = {}) => install.call(WaveUI, app, { components, ...options })
6
6
 
7
- export default WaveUI
7
+ export { default, useWaveUI } from './core'