@dimailn/vuetify 2.7.2-alpha20 → 2.7.2-alpha21
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/dist/vuetify.js +125 -44
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.js +1 -1
- package/es5/components/VTabs/VTabs.js +1 -1
- package/es5/components/VTabs/VTabs.js.map +1 -1
- package/es5/install.js +10 -33
- package/es5/install.js.map +1 -1
- package/es5/mixins/detachable/index.js +2 -3
- package/es5/mixins/detachable/index.js.map +1 -1
- package/es5/util/helpers.js +44 -0
- package/es5/util/helpers.js.map +1 -1
- package/es5/util/legacyEventsMixin.js +48 -0
- package/es5/util/legacyEventsMixin.js.map +1 -0
- package/lib/components/VTabs/VTabs.js +1 -1
- package/lib/components/VTabs/VTabs.js.map +1 -1
- package/lib/install.js +5 -28
- package/lib/install.js.map +1 -1
- package/lib/mixins/detachable/index.js +3 -4
- package/lib/mixins/detachable/index.js.map +1 -1
- package/lib/util/helpers.js +42 -0
- package/lib/util/helpers.js.map +1 -1
- package/lib/util/legacyEventsMixin.js +37 -0
- package/lib/util/legacyEventsMixin.js.map +1 -0
- package/package.json +1 -1
- package/src/components/VTabs/VTabs.ts +1 -1
- package/src/components/VTabs/__tests__/VTab.spec.ts +48 -37
- package/src/components/VTabs/__tests__/VTabs.spec.ts +134 -79
- package/src/components/VTabs/__tests__/VTabsBar.spec.ts +67 -26
- package/src/components/VTabs/__tests__/VTabsSlider.spec.ts +7 -6
- package/src/components/VTabs/__tests__/__snapshots__/VTabs.spec.ts.snap +1 -3
- package/src/install.ts +10 -32
- package/src/mixins/detachable/index.ts +2 -1
- package/src/util/__tests__/helpers.spec.ts +62 -1
- package/src/util/helpers.ts +42 -1
- package/src/util/legacyEventsMixin.ts +34 -0
package/src/util/helpers.ts
CHANGED
|
@@ -531,4 +531,45 @@ export function normalizeAttrs (attrs) {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
return obj
|
|
534
|
-
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Нормализует классы из различных форматов в объект
|
|
538
|
+
* @param classes - классы в виде строки, объекта или массива
|
|
539
|
+
* @returns объект с нормализованными классами
|
|
540
|
+
*/
|
|
541
|
+
export function normalizeClasses (classes: string | Record<string, any> | Array<string | Record<string, any>> | undefined): Record<string, any> {
|
|
542
|
+
if (!classes) return {}
|
|
543
|
+
|
|
544
|
+
if (typeof classes === 'object' && !Array.isArray(classes)) {
|
|
545
|
+
return classes
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (typeof classes === 'string') {
|
|
549
|
+
const trimmed = classes.trim()
|
|
550
|
+
if (!trimmed) return {}
|
|
551
|
+
|
|
552
|
+
return trimmed.split(/\s+/).reduce((acc, cls) => {
|
|
553
|
+
acc[cls] = true
|
|
554
|
+
return acc
|
|
555
|
+
}, {} as Record<string, any>)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (Array.isArray(classes)) {
|
|
559
|
+
return classes.reduce((acc, cls) => {
|
|
560
|
+
if (typeof cls === 'string') {
|
|
561
|
+
const trimmed = cls.trim()
|
|
562
|
+
if (trimmed) {
|
|
563
|
+
trimmed.split(/\s+/).forEach(className => {
|
|
564
|
+
acc[className] = true
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
} else if (cls && typeof cls === 'object') {
|
|
568
|
+
Object.assign(acc, cls)
|
|
569
|
+
}
|
|
570
|
+
return acc
|
|
571
|
+
}, {} as Record<string, any>)
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return {}
|
|
575
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Legacy events mixin for Vue 3 migration
|
|
2
|
+
// Provides $on, $off, and $emitLegacy methods to maintain compatibility with Vue 2 code
|
|
3
|
+
|
|
4
|
+
export const legacyEventsMixin = {
|
|
5
|
+
methods: {
|
|
6
|
+
$emitLegacy (eventName: string, args?: any) {
|
|
7
|
+
if (!this.eventsLegacy || !this.eventsLegacy[eventName]) return
|
|
8
|
+
|
|
9
|
+
this.eventsLegacy[eventName].forEach((listener: Function) => listener(args))
|
|
10
|
+
},
|
|
11
|
+
$on (eventName: string, listener: Function) {
|
|
12
|
+
this.eventsLegacy ||= {}
|
|
13
|
+
this.eventsLegacy[eventName] ||= []
|
|
14
|
+
this.eventsLegacy[eventName].push(listener)
|
|
15
|
+
// console.warn("$on is not available")
|
|
16
|
+
},
|
|
17
|
+
$off (eventName: string, listener: Function) {
|
|
18
|
+
if (this.eventsLegacy && this.eventsLegacy[eventName]) {
|
|
19
|
+
this.eventsLegacy[eventName] = this.eventsLegacy[eventName].filter((_listener: Function) => _listener !== listener)
|
|
20
|
+
}
|
|
21
|
+
// console.warn('$off is not available')
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
$listeners () {
|
|
26
|
+
const names = Object.keys(this.$attrs).filter(name => name.startsWith('on'))
|
|
27
|
+
|
|
28
|
+
return names.reduce((listeners, name) => {
|
|
29
|
+
listeners[name] = this.$attrs[name]
|
|
30
|
+
return listeners
|
|
31
|
+
}, {})
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}
|