@dimailn/vuetify 2.7.2-alpha2 → 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.css +45 -45
- package/dist/vuetify.css.map +1 -1
- package/dist/vuetify.js +490 -349
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VAppBar/VAppBar.js +7 -12
- package/es5/components/VAppBar/VAppBar.js.map +1 -1
- package/es5/components/VAutocomplete/VAutocomplete.js +10 -7
- package/es5/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/es5/components/VCheckbox/VSimpleCheckbox.js +66 -35
- package/es5/components/VCheckbox/VSimpleCheckbox.js.map +1 -1
- package/es5/components/VColorPicker/VColorPicker.js +6 -6
- package/es5/components/VColorPicker/VColorPicker.js.map +1 -1
- package/es5/components/VData/VData.js +14 -2
- package/es5/components/VData/VData.js.map +1 -1
- package/es5/components/VDataIterator/VDataIterator.js +4 -3
- package/es5/components/VDataIterator/VDataIterator.js.map +1 -1
- package/es5/components/VDataTable/VDataTable.js +2 -2
- package/es5/components/VDataTable/VDataTable.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeader.js +4 -3
- package/es5/components/VDataTable/VDataTableHeader.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeaderDesktop.js +4 -2
- package/es5/components/VDataTable/VDataTableHeaderDesktop.js.map +1 -1
- package/es5/components/VDataTable/VVirtualTable.js +1 -1
- package/es5/components/VDataTable/VVirtualTable.js.map +1 -1
- package/es5/components/VDataTable/mixins/header.js +1 -1
- package/es5/components/VDataTable/mixins/header.js.map +1 -1
- package/es5/components/VDatePicker/VDatePicker.js +6 -6
- package/es5/components/VDatePicker/VDatePicker.js.map +1 -1
- package/es5/components/VDialog/VDialog.js +1 -1
- package/es5/components/VDialog/VDialog.js.map +1 -1
- package/es5/components/VExpansionPanel/VExpansionPanelContent.js +1 -1
- package/es5/components/VExpansionPanel/VExpansionPanelContent.js.map +1 -1
- package/es5/components/VExpansionPanel/VExpansionPanelHeader.js +1 -1
- package/es5/components/VExpansionPanel/VExpansionPanelHeader.js.map +1 -1
- package/es5/components/VForm/VForm.js +8 -8
- package/es5/components/VForm/VForm.js.map +1 -1
- package/es5/components/VGrid/VCol.js +3 -3
- package/es5/components/VGrid/VCol.js.map +1 -1
- package/es5/components/VGrid/VContainer.js +3 -1
- package/es5/components/VGrid/VContainer.js.map +1 -1
- package/es5/components/VImg/VImg.js +1 -1
- package/es5/components/VImg/VImg.js.map +1 -1
- package/es5/components/VInput/VInput.js +1 -1
- package/es5/components/VInput/VInput.js.map +1 -1
- package/es5/components/VItemGroup/VItem.js +17 -18
- package/es5/components/VItemGroup/VItem.js.map +1 -1
- package/es5/components/VItemGroup/VItemGroup.js +1 -1
- package/es5/components/VItemGroup/VItemGroup.js.map +1 -1
- package/es5/components/VList/VList.js +1 -1
- package/es5/components/VList/VList.js.map +1 -1
- package/es5/components/VList/VListGroup.js +12 -15
- package/es5/components/VList/VListGroup.js.map +1 -1
- package/es5/components/VMenu/VMenu.js +1 -1
- package/es5/components/VMenu/VMenu.js.map +1 -1
- package/es5/components/VOverlay/VOverlay.js +1 -1
- package/es5/components/VOverlay/VOverlay.js.map +1 -1
- package/es5/components/VRadioGroup/VRadioGroup.js +5 -5
- package/es5/components/VRadioGroup/VRadioGroup.js.map +1 -1
- package/es5/components/VRangeSlider/VRangeSlider.js +1 -1
- package/es5/components/VRangeSlider/VRangeSlider.js.map +1 -1
- package/es5/components/VSelect/VSelect.js +3 -5
- package/es5/components/VSelect/VSelect.js.map +1 -1
- package/es5/components/VSelect/VSelectList.js +7 -5
- package/es5/components/VSelect/VSelectList.js.map +1 -1
- package/es5/components/VSparkline/VSparkline.js +6 -6
- package/es5/components/VSparkline/VSparkline.js.map +1 -1
- package/es5/components/VStepper/VStepperContent.js +1 -1
- package/es5/components/VStepper/VStepperContent.js.map +1 -1
- package/es5/components/VStepper/VStepperStep.js +1 -1
- package/es5/components/VStepper/VStepperStep.js.map +1 -1
- package/es5/components/VSubheader/VSubheader.js +3 -3
- package/es5/components/VSubheader/VSubheader.js.map +1 -1
- package/es5/components/VTabs/VTab.js.map +1 -1
- package/es5/components/VTabs/VTabs.js +1 -2
- package/es5/components/VTabs/VTabs.js.map +1 -1
- package/es5/components/VTextField/VTextField.js +5 -2
- package/es5/components/VTextField/VTextField.js.map +1 -1
- package/es5/components/VToolbar/VToolbar.js +2 -3
- package/es5/components/VToolbar/VToolbar.js.map +1 -1
- package/es5/components/VTreeview/VTreeviewNode.js +1 -1
- package/es5/components/VTreeview/VTreeviewNode.js.map +1 -1
- package/es5/components/transitions/createTransition.js +9 -4
- package/es5/components/transitions/createTransition.js.map +1 -1
- package/es5/components/transitions/expand-transition.js +8 -7
- package/es5/components/transitions/expand-transition.js.map +1 -1
- package/es5/directives/intersect/index.js +20 -7
- package/es5/directives/intersect/index.js.map +1 -1
- package/es5/directives/mutate/index.js +13 -13
- package/es5/directives/mutate/index.js.map +1 -1
- package/es5/directives/resize/index.js +8 -8
- package/es5/directives/resize/index.js.map +1 -1
- package/es5/directives/scroll/index.js +10 -9
- package/es5/directives/scroll/index.js.map +1 -1
- package/es5/directives/touch/index.js +4 -4
- package/es5/directives/touch/index.js.map +1 -1
- package/es5/framework.js +1 -1
- package/es5/install.js +10 -33
- package/es5/install.js.map +1 -1
- package/es5/mixins/activatable/index.js +9 -4
- package/es5/mixins/activatable/index.js.map +1 -1
- package/es5/mixins/applicationable/index.js +4 -4
- package/es5/mixins/applicationable/index.js.map +1 -1
- package/es5/mixins/binds-attrs/index.js +1 -1
- package/es5/mixins/binds-attrs/index.js.map +1 -1
- package/es5/mixins/detachable/index.js +5 -6
- package/es5/mixins/detachable/index.js.map +1 -1
- package/es5/mixins/groupable/index.js +1 -1
- package/es5/mixins/groupable/index.js.map +1 -1
- package/es5/mixins/intersectable/index.js +2 -2
- package/es5/mixins/intersectable/index.js.map +1 -1
- package/es5/mixins/menuable/index.js +1 -1
- package/es5/mixins/menuable/index.js.map +1 -1
- package/es5/mixins/overlayable/index.js +5 -4
- package/es5/mixins/overlayable/index.js.map +1 -1
- package/es5/mixins/proxyable/index.js +0 -4
- package/es5/mixins/proxyable/index.js.map +1 -1
- package/es5/mixins/selectable/index.js +2 -5
- package/es5/mixins/selectable/index.js.map +1 -1
- package/es5/mixins/translatable/index.js +1 -1
- package/es5/mixins/translatable/index.js.map +1 -1
- package/es5/mixins/validatable/index.js +2 -2
- package/es5/mixins/validatable/index.js.map +1 -1
- package/es5/services/breakpoint/index.js +3 -1
- package/es5/services/breakpoint/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/VAppBar/VAppBar.js +7 -11
- package/lib/components/VAppBar/VAppBar.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.js +11 -8
- package/lib/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/lib/components/VCheckbox/VSimpleCheckbox.js +72 -36
- package/lib/components/VCheckbox/VSimpleCheckbox.js.map +1 -1
- package/lib/components/VColorPicker/VColorPicker.js +6 -6
- package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
- package/lib/components/VData/VData.js +15 -2
- package/lib/components/VData/VData.js.map +1 -1
- package/lib/components/VDataIterator/VDataIterator.js +4 -3
- package/lib/components/VDataIterator/VDataIterator.js.map +1 -1
- package/lib/components/VDataTable/VDataTable.js +2 -2
- package/lib/components/VDataTable/VDataTable.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeader.js +4 -3
- package/lib/components/VDataTable/VDataTableHeader.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeaderDesktop.js +3 -1
- package/lib/components/VDataTable/VDataTableHeaderDesktop.js.map +1 -1
- package/lib/components/VDataTable/VVirtualTable.js +1 -1
- package/lib/components/VDataTable/VVirtualTable.js.map +1 -1
- package/lib/components/VDataTable/mixins/header.js +1 -1
- package/lib/components/VDataTable/mixins/header.js.map +1 -1
- package/lib/components/VDatePicker/VDatePicker.js +6 -6
- package/lib/components/VDatePicker/VDatePicker.js.map +1 -1
- package/lib/components/VDialog/VDialog.js +1 -1
- package/lib/components/VDialog/VDialog.js.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelContent.js +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelContent.js.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelHeader.js +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelHeader.js.map +1 -1
- package/lib/components/VForm/VForm.js +8 -8
- package/lib/components/VForm/VForm.js.map +1 -1
- package/lib/components/VGrid/VCol.js +3 -3
- package/lib/components/VGrid/VCol.js.map +1 -1
- package/lib/components/VGrid/VContainer.js +3 -1
- package/lib/components/VGrid/VContainer.js.map +1 -1
- package/lib/components/VImg/VImg.js +1 -1
- package/lib/components/VImg/VImg.js.map +1 -1
- package/lib/components/VInput/VInput.js +1 -1
- package/lib/components/VInput/VInput.js.map +1 -1
- package/lib/components/VItemGroup/VItem.js +20 -18
- package/lib/components/VItemGroup/VItem.js.map +1 -1
- package/lib/components/VItemGroup/VItemGroup.js +1 -1
- package/lib/components/VItemGroup/VItemGroup.js.map +1 -1
- package/lib/components/VList/VList.js +1 -1
- package/lib/components/VList/VList.js.map +1 -1
- package/lib/components/VList/VListGroup.js +11 -15
- package/lib/components/VList/VListGroup.js.map +1 -1
- package/lib/components/VMenu/VMenu.js +1 -1
- package/lib/components/VMenu/VMenu.js.map +1 -1
- package/lib/components/VOverlay/VOverlay.js +1 -1
- package/lib/components/VOverlay/VOverlay.js.map +1 -1
- package/lib/components/VRadioGroup/VRadioGroup.js +5 -7
- package/lib/components/VRadioGroup/VRadioGroup.js.map +1 -1
- package/lib/components/VRangeSlider/VRangeSlider.js +1 -1
- package/lib/components/VRangeSlider/VRangeSlider.js.map +1 -1
- package/lib/components/VSelect/VSelect.js +1 -3
- package/lib/components/VSelect/VSelect.js.map +1 -1
- package/lib/components/VSelect/VSelectList.js +7 -5
- package/lib/components/VSelect/VSelectList.js.map +1 -1
- package/lib/components/VSparkline/VSparkline.js +6 -6
- package/lib/components/VSparkline/VSparkline.js.map +1 -1
- package/lib/components/VStepper/VStepperContent.js +1 -1
- package/lib/components/VStepper/VStepperContent.js.map +1 -1
- package/lib/components/VStepper/VStepperStep.js +1 -1
- package/lib/components/VStepper/VStepperStep.js.map +1 -1
- package/lib/components/VSubheader/VSubheader.js +2 -3
- package/lib/components/VSubheader/VSubheader.js.map +1 -1
- package/lib/components/VTabs/VTab.js.map +1 -1
- package/lib/components/VTabs/VTabs.js +1 -2
- package/lib/components/VTabs/VTabs.js.map +1 -1
- package/lib/components/VTextField/VTextField.js +5 -2
- package/lib/components/VTextField/VTextField.js.map +1 -1
- package/lib/components/VToolbar/VToolbar.js +4 -3
- package/lib/components/VToolbar/VToolbar.js.map +1 -1
- package/lib/components/VTreeview/VTreeviewNode.js +1 -1
- package/lib/components/VTreeview/VTreeviewNode.js.map +1 -1
- package/lib/components/transitions/createTransition.js +1 -1
- package/lib/components/transitions/createTransition.js.map +1 -1
- package/lib/components/transitions/expand-transition.js +8 -7
- package/lib/components/transitions/expand-transition.js.map +1 -1
- package/lib/directives/intersect/index.js +20 -7
- package/lib/directives/intersect/index.js.map +1 -1
- package/lib/directives/mutate/index.js +13 -13
- package/lib/directives/mutate/index.js.map +1 -1
- package/lib/directives/resize/index.js +8 -8
- package/lib/directives/resize/index.js.map +1 -1
- package/lib/directives/scroll/index.js +10 -9
- package/lib/directives/scroll/index.js.map +1 -1
- package/lib/directives/touch/index.js +4 -4
- package/lib/directives/touch/index.js.map +1 -1
- package/lib/framework.js +1 -1
- package/lib/install.js +5 -28
- package/lib/install.js.map +1 -1
- package/lib/mixins/activatable/index.js +10 -5
- package/lib/mixins/activatable/index.js.map +1 -1
- package/lib/mixins/applicationable/index.js +4 -4
- package/lib/mixins/applicationable/index.js.map +1 -1
- package/lib/mixins/binds-attrs/index.js +1 -1
- package/lib/mixins/binds-attrs/index.js.map +1 -1
- package/lib/mixins/detachable/index.js +6 -7
- package/lib/mixins/detachable/index.js.map +1 -1
- package/lib/mixins/groupable/index.js +1 -1
- package/lib/mixins/groupable/index.js.map +1 -1
- package/lib/mixins/intersectable/index.js +2 -2
- package/lib/mixins/intersectable/index.js.map +1 -1
- package/lib/mixins/menuable/index.js +1 -1
- package/lib/mixins/menuable/index.js.map +1 -1
- package/lib/mixins/overlayable/index.js +5 -4
- package/lib/mixins/overlayable/index.js.map +1 -1
- package/lib/mixins/proxyable/index.js +0 -4
- package/lib/mixins/proxyable/index.js.map +1 -1
- package/lib/mixins/selectable/index.js +2 -5
- package/lib/mixins/selectable/index.js.map +1 -1
- package/lib/mixins/translatable/index.js +1 -1
- package/lib/mixins/translatable/index.js.map +1 -1
- package/lib/mixins/validatable/index.js +2 -2
- package/lib/mixins/validatable/index.js.map +1 -1
- package/lib/services/breakpoint/index.js +3 -1
- package/lib/services/breakpoint/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/VAppBar/VAppBar.ts +11 -13
- package/src/components/VAutocomplete/VAutocomplete.ts +13 -6
- package/src/components/VBottomSheet/VBottomSheet.sass +1 -1
- package/src/components/VCheckbox/VSimpleCheckbox.ts +84 -42
- package/src/components/VCheckbox/__tests__/VSimpleCheckbox.spec.ts +46 -13
- package/src/components/VColorPicker/VColorPicker.ts +6 -6
- package/src/components/VData/VData.ts +12 -1
- package/src/components/VDataIterator/VDataIterator.ts +5 -3
- package/src/components/VDataTable/VDataTable.ts +2 -2
- package/src/components/VDataTable/VDataTableHeader.ts +5 -4
- package/src/components/VDataTable/VDataTableHeaderDesktop.ts +1 -1
- package/src/components/VDataTable/VVirtualTable.ts +1 -1
- package/src/components/VDataTable/mixins/header.ts +6 -6
- package/src/components/VDatePicker/VDatePicker.ts +6 -6
- package/src/components/VDialog/VDialog.ts +1 -1
- package/src/components/VExpansionPanel/VExpansionPanelContent.ts +1 -1
- package/src/components/VExpansionPanel/VExpansionPanelHeader.ts +1 -1
- package/src/components/VForm/VForm.ts +8 -8
- package/src/components/VGrid/VCol.ts +2 -2
- package/src/components/VGrid/VContainer.ts +1 -1
- package/src/components/VImg/VImg.ts +1 -1
- package/src/components/VInput/VInput.ts +1 -1
- package/src/components/VItemGroup/VItem.ts +25 -23
- package/src/components/VItemGroup/VItemGroup.ts +3 -3
- package/src/components/VList/VList.ts +1 -1
- package/src/components/VList/VListGroup.ts +14 -14
- package/src/components/VMenu/VMenu.sass +2 -2
- package/src/components/VMenu/VMenu.ts +1 -0
- package/src/components/VOverlay/VOverlay.ts +1 -1
- package/src/components/VRadioGroup/VRadioGroup.ts +8 -9
- package/src/components/VRangeSlider/VRangeSlider.ts +1 -1
- package/src/components/VSelect/VSelect.ts +6 -5
- package/src/components/VSelect/VSelectList.ts +5 -5
- package/src/components/VSnackbar/VSnackbar.sass +2 -2
- package/src/components/VSparkline/VSparkline.ts +6 -6
- package/src/components/VStepper/VStepperContent.ts +1 -1
- package/src/components/VStepper/VStepperStep.ts +1 -1
- package/src/components/VSubheader/VSubheader.ts +2 -2
- package/src/components/VTabs/VTab.ts +1 -1
- package/src/components/VTabs/VTabs.ts +1 -2
- 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/components/VTextField/VTextField.ts +4 -3
- package/src/components/VToolbar/VToolbar.ts +4 -5
- package/src/components/VTreeview/VTreeviewNode.ts +1 -1
- package/src/components/transitions/createTransition.ts +1 -2
- package/src/components/transitions/expand-transition.ts +9 -7
- package/src/directives/intersect/index.ts +81 -42
- package/src/directives/mutate/index.ts +58 -49
- package/src/directives/resize/index.ts +33 -14
- package/src/directives/scroll/index.ts +36 -20
- package/src/directives/touch/index.ts +37 -27
- package/src/install.ts +10 -32
- package/src/mixins/activatable/index.ts +8 -4
- package/src/mixins/applicationable/index.ts +4 -4
- package/src/mixins/binds-attrs/index.ts +1 -1
- package/src/mixins/detachable/index.ts +7 -6
- package/src/mixins/groupable/index.ts +1 -1
- package/src/mixins/intersectable/index.ts +2 -2
- package/src/mixins/menuable/index.ts +1 -1
- package/src/mixins/overlayable/index.ts +4 -5
- package/src/mixins/proxyable/index.ts +0 -5
- package/src/mixins/selectable/index.ts +3 -7
- package/src/mixins/translatable/index.ts +1 -1
- package/src/mixins/validatable/index.ts +2 -2
- package/src/services/breakpoint/index.ts +5 -0
- package/src/styles/generic/_transitions.scss +38 -38
- package/src/util/__tests__/helpers.spec.ts +62 -1
- package/src/util/helpers.ts +42 -1
- package/src/util/legacyEventsMixin.ts +34 -0
|
@@ -62,7 +62,7 @@ export default baseMixins.extend({
|
|
|
62
62
|
this.addActivatorEvents()
|
|
63
63
|
},
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
beforeUnmount () {
|
|
66
66
|
this.removeActivatorEvents()
|
|
67
67
|
},
|
|
68
68
|
|
|
@@ -88,14 +88,18 @@ export default baseMixins.extend({
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
genActivator () {
|
|
91
|
-
|
|
91
|
+
let node = getSlot(this, 'activator', Object.assign(this.getValueProxy(), {
|
|
92
92
|
attrs: {
|
|
93
93
|
...this.genActivatorListeners(),
|
|
94
94
|
...this.genActivatorAttributes(),
|
|
95
95
|
}
|
|
96
96
|
})) || []
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
node = Array.isArray(node) ? node : [node]
|
|
99
|
+
|
|
100
|
+
this.activatorNode = node.flatMap(node => {
|
|
101
|
+
return node.type === Symbol.for('v-fgt') ? node.children : node
|
|
102
|
+
})
|
|
99
103
|
|
|
100
104
|
return node
|
|
101
105
|
},
|
|
@@ -167,7 +171,7 @@ export default baseMixins.extend({
|
|
|
167
171
|
// Use the contents of the activator slot
|
|
168
172
|
// There's either only one element in it or we
|
|
169
173
|
// don't have a click event to use as a last resort
|
|
170
|
-
const vm = this.activatorNode[0].component
|
|
174
|
+
const vm = this.activatorNode[0].component?.ctx
|
|
171
175
|
if (
|
|
172
176
|
vm &&
|
|
173
177
|
(vm.isActivatable !== undefined || vm.isMenuable !== undefined)
|
|
@@ -28,7 +28,7 @@ export default function applicationable (value: TargetProp, events: string[] = [
|
|
|
28
28
|
: this.callUpdate()
|
|
29
29
|
},
|
|
30
30
|
applicationProperty (newVal, oldVal) {
|
|
31
|
-
this.$vuetify.application.unregister(this
|
|
31
|
+
this.$vuetify.application.unregister(this.$.uid, oldVal)
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
|
|
@@ -51,7 +51,7 @@ export default function applicationable (value: TargetProp, events: string[] = [
|
|
|
51
51
|
this.removeApplication()
|
|
52
52
|
},
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
unmounted () {
|
|
55
55
|
this.removeApplication()
|
|
56
56
|
},
|
|
57
57
|
|
|
@@ -60,7 +60,7 @@ export default function applicationable (value: TargetProp, events: string[] = [
|
|
|
60
60
|
if (!this.app) return
|
|
61
61
|
|
|
62
62
|
this.$vuetify.application.register(
|
|
63
|
-
this
|
|
63
|
+
this.$.uid,
|
|
64
64
|
this.applicationProperty,
|
|
65
65
|
this.updateApplication()
|
|
66
66
|
)
|
|
@@ -69,7 +69,7 @@ export default function applicationable (value: TargetProp, events: string[] = [
|
|
|
69
69
|
if (!force && !this.app) return
|
|
70
70
|
|
|
71
71
|
this.$vuetify.application.unregister(
|
|
72
|
-
this
|
|
72
|
+
this.$.uid,
|
|
73
73
|
this.applicationProperty
|
|
74
74
|
)
|
|
75
75
|
},
|
|
@@ -9,7 +9,7 @@ function makeWatcher (property: string): ThisType<Vue> & ((val: any, oldVal: any
|
|
|
9
9
|
return function (this: Vue, val, oldVal) {
|
|
10
10
|
for (const attr in oldVal) {
|
|
11
11
|
if (!Object.prototype.hasOwnProperty.call(val, attr)) {
|
|
12
|
-
|
|
12
|
+
delete this.$data[property][attr]
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
for (const attr in val) {
|
|
@@ -27,9 +27,9 @@ function validateAttachTarget (val: any) {
|
|
|
27
27
|
|
|
28
28
|
function removeActivator (activator: VNode[]) {
|
|
29
29
|
activator.forEach(node => {
|
|
30
|
-
node.
|
|
31
|
-
node.
|
|
32
|
-
node.
|
|
30
|
+
node.el &&
|
|
31
|
+
node.el.parentNode &&
|
|
32
|
+
node.el.parentNode.removeChild(node.el)
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -94,7 +94,7 @@ export default mixins<options &
|
|
|
94
94
|
this.isActive = false
|
|
95
95
|
},
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
beforeUnmount () {
|
|
98
98
|
if (
|
|
99
99
|
this.$refs.content &&
|
|
100
100
|
this.$refs.content.parentNode
|
|
@@ -103,7 +103,7 @@ export default mixins<options &
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
unmounted () {
|
|
107
107
|
if (this.activatorNode) {
|
|
108
108
|
const activator = Array.isArray(this.activatorNode) ? this.activatorNode : [this.activatorNode]
|
|
109
109
|
if (this.$el.isConnected) {
|
|
@@ -126,7 +126,8 @@ export default mixins<options &
|
|
|
126
126
|
|
|
127
127
|
methods: {
|
|
128
128
|
getScopeIdAttrs () {
|
|
129
|
-
|
|
129
|
+
// В Vue 3 $vnode больше не существует, используем современный способ
|
|
130
|
+
const scopeId = this.$options._scopeId || this.$options.__scopeId
|
|
130
131
|
|
|
131
132
|
return scopeId && {
|
|
132
133
|
[scopeId]: '',
|
|
@@ -57,7 +57,7 @@ export function factory<T extends string, C extends VueConstructor | null = null
|
|
|
57
57
|
this[namespace] && (this[namespace] as any).register(this)
|
|
58
58
|
},
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
beforeUnmount () {
|
|
61
61
|
this[namespace] && (this[namespace] as any).unregister(this)
|
|
62
62
|
},
|
|
63
63
|
|
|
@@ -23,10 +23,10 @@ export default function intersectable (options: { onVisible: string[] }) {
|
|
|
23
23
|
}, vnode)
|
|
24
24
|
},
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
unmounted () {
|
|
27
27
|
const {vnode} = getCurrentInstance()
|
|
28
28
|
|
|
29
|
-
Intersect.
|
|
29
|
+
Intersect.unmounted(this.$el as HTMLElement, {
|
|
30
30
|
name: 'intersect',
|
|
31
31
|
value: this.onObserve,
|
|
32
32
|
}, vnode)
|
|
@@ -55,7 +55,7 @@ export default defineComponent({
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
beforeUnmount () {
|
|
59
59
|
this.removeOverlay()
|
|
60
60
|
},
|
|
61
61
|
|
|
@@ -71,11 +71,12 @@ export default defineComponent({
|
|
|
71
71
|
}
|
|
72
72
|
const wrapper = {
|
|
73
73
|
data() {
|
|
74
|
-
return { value: false }
|
|
74
|
+
return { value: false, zIndex: undefined }
|
|
75
75
|
},
|
|
76
76
|
render() {
|
|
77
77
|
return h(VOverlay, {
|
|
78
|
-
|
|
78
|
+
modelValue: this.value,
|
|
79
|
+
zIndex: this.zIndex,
|
|
79
80
|
...props
|
|
80
81
|
})
|
|
81
82
|
}
|
|
@@ -142,8 +143,6 @@ export default defineComponent({
|
|
|
142
143
|
this.overlayApp.unmount()
|
|
143
144
|
this.overlayApp = null
|
|
144
145
|
this.overlay = null
|
|
145
|
-
console.log('destroyed')
|
|
146
|
-
|
|
147
146
|
})
|
|
148
147
|
|
|
149
148
|
// Cancel animation frame in case
|
|
@@ -7,7 +7,7 @@ import Comparable from '../comparable'
|
|
|
7
7
|
|
|
8
8
|
// Utilities
|
|
9
9
|
import mixins from '../../util/mixins'
|
|
10
|
-
import {h} from 'vue'
|
|
10
|
+
import { h } from 'vue'
|
|
11
11
|
|
|
12
12
|
export function prevent (e: Event) {
|
|
13
13
|
e.preventDefault()
|
|
@@ -21,11 +21,6 @@ export default mixins(
|
|
|
21
21
|
).extend({
|
|
22
22
|
name: 'selectable',
|
|
23
23
|
|
|
24
|
-
model: {
|
|
25
|
-
prop: 'inputValue',
|
|
26
|
-
event: 'change',
|
|
27
|
-
},
|
|
28
|
-
|
|
29
24
|
props: {
|
|
30
25
|
id: String,
|
|
31
26
|
value: null as any,
|
|
@@ -97,7 +92,7 @@ export default mixins(
|
|
|
97
92
|
if (!label) return label
|
|
98
93
|
|
|
99
94
|
// Label shouldn't cause the input to focus
|
|
100
|
-
label!.onClick =
|
|
95
|
+
label!.onClick = this.onClick
|
|
101
96
|
|
|
102
97
|
return label
|
|
103
98
|
},
|
|
@@ -121,6 +116,7 @@ export default mixins(
|
|
|
121
116
|
})
|
|
122
117
|
},
|
|
123
118
|
onClick (e: Event) {
|
|
119
|
+
e.preventDefault()
|
|
124
120
|
this.onChange()
|
|
125
121
|
this.$emit('click', e)
|
|
126
122
|
},
|
|
@@ -214,7 +214,7 @@ export default baseMixins.extend({
|
|
|
214
214
|
this.$emit('update:error', val)
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
|
-
|
|
217
|
+
modelValue (val) {
|
|
218
218
|
this.lazyValue = val
|
|
219
219
|
},
|
|
220
220
|
},
|
|
@@ -227,7 +227,7 @@ export default baseMixins.extend({
|
|
|
227
227
|
this.form && this.form.register(this)
|
|
228
228
|
},
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
beforeUnmount () {
|
|
231
231
|
this.form && this.form.unregister(this)
|
|
232
232
|
},
|
|
233
233
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { reactive } from 'vue'
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
// Extensions
|
|
2
5
|
import { Service } from '../service'
|
|
3
6
|
|
|
@@ -72,6 +75,8 @@ export class Breakpoint extends Service implements IBreakpoint {
|
|
|
72
75
|
this.mobileBreakpoint = mobileBreakpoint
|
|
73
76
|
this.scrollBarWidth = scrollBarWidth
|
|
74
77
|
this.thresholds = thresholds
|
|
78
|
+
|
|
79
|
+
return reactive(this)
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
public init () {
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
// Component specific transitions
|
|
13
13
|
.carousel-transition {
|
|
14
|
-
&-enter {
|
|
14
|
+
&-enter-from {
|
|
15
15
|
transform: translate(100%, 0);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
&-leave, &-leave-to {
|
|
18
|
+
&-leave-from, &-leave-to {
|
|
19
19
|
position: absolute;
|
|
20
20
|
top: 0;
|
|
21
21
|
transform: translate(-100%, 0);
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.carousel-reverse-transition {
|
|
26
|
-
&-enter {
|
|
26
|
+
&-enter-from {
|
|
27
27
|
transform: translate(-100%, 0);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
&-leave, &-leave-to {
|
|
30
|
+
&-leave-from, &-leave-to {
|
|
31
31
|
position: absolute;
|
|
32
32
|
top: 0;
|
|
33
33
|
transform: translate(100%, 0);
|
|
@@ -40,24 +40,24 @@
|
|
|
40
40
|
pointer-events: none !important;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
&-enter, &-leave-to {
|
|
43
|
+
&-enter-from, &-leave-to {
|
|
44
44
|
transform: scale(0.5);
|
|
45
45
|
opacity: 0;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
&-enter-to, &-leave {
|
|
48
|
+
&-enter-to, &-leave-from {
|
|
49
49
|
opacity: 1;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.dialog-bottom-transition {
|
|
54
|
-
&-enter, &-leave-to {
|
|
54
|
+
&-enter-from, &-leave-to {
|
|
55
55
|
transform: translateY(100%);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.dialog-top-transition {
|
|
60
|
-
&-enter, &-leave-to {
|
|
60
|
+
&-enter-from, &-leave-to {
|
|
61
61
|
transform: translateY(-100%);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
transition: .3s map-get($transition, 'linear-out-slow-in');
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
&-enter,
|
|
72
|
+
&-enter-from,
|
|
73
73
|
&-leave-to {
|
|
74
74
|
opacity: 0;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
&-leave,
|
|
77
|
+
&-leave-from,
|
|
78
78
|
&-leave-active,
|
|
79
79
|
&-leave-to {
|
|
80
80
|
position: absolute !important;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
.picker-transition {
|
|
85
|
-
&-enter {
|
|
85
|
+
&-enter-from {
|
|
86
86
|
transform: translate(0, 100%);
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.picker-reverse-transition {
|
|
95
|
-
&-enter {
|
|
95
|
+
&-enter-from {
|
|
96
96
|
transform: translate(0, -100%);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -103,11 +103,11 @@
|
|
|
103
103
|
|
|
104
104
|
.picker-title-transition {
|
|
105
105
|
&-enter-to,
|
|
106
|
-
&-leave {
|
|
106
|
+
&-leave-from {
|
|
107
107
|
transform: translate(0, 0);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
&-enter {
|
|
110
|
+
&-enter-from {
|
|
111
111
|
transform: translate(-100%, 0);
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
transform: translate(100%, 0);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
&-leave,
|
|
119
|
+
&-leave-from,
|
|
120
120
|
&-leave-to,
|
|
121
121
|
&-leave-active {
|
|
122
122
|
position: absolute !important;
|
|
@@ -124,11 +124,11 @@
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.tab-transition {
|
|
127
|
-
&-enter {
|
|
127
|
+
&-enter-from {
|
|
128
128
|
transform: translate(100%, 0);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
&-leave, &-leave-active {
|
|
131
|
+
&-leave-from, &-leave-active {
|
|
132
132
|
position: absolute;
|
|
133
133
|
top: 0;
|
|
134
134
|
}
|
|
@@ -140,11 +140,11 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.tab-reverse-transition {
|
|
143
|
-
&-enter {
|
|
143
|
+
&-enter-from {
|
|
144
144
|
transform: translate(-100%, 0);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
&-leave, &-leave-to {
|
|
147
|
+
&-leave-from, &-leave-to {
|
|
148
148
|
top: 0;
|
|
149
149
|
position: absolute;
|
|
150
150
|
transform: translate(100%, 0);
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
.scale-transition {
|
|
164
164
|
@include transition-default();
|
|
165
165
|
|
|
166
|
-
&-enter, &-leave, &-leave-to {
|
|
166
|
+
&-enter-from, &-leave-from, &-leave-to {
|
|
167
167
|
opacity: 0;
|
|
168
168
|
transform: scale(0);
|
|
169
169
|
}
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
.scale-rotate-transition {
|
|
173
173
|
@include transition-default();
|
|
174
174
|
|
|
175
|
-
&-enter, &-leave, &-leave-to {
|
|
175
|
+
&-enter-from, &-leave-from, &-leave-to {
|
|
176
176
|
opacity: 0;
|
|
177
177
|
transform: scale(0) rotate(-45deg);
|
|
178
178
|
}
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
.scale-rotate-reverse-transition {
|
|
182
182
|
@include transition-default();
|
|
183
183
|
|
|
184
|
-
&-enter, &-leave, &-leave-to {
|
|
184
|
+
&-enter-from, &-leave-from, &-leave-to {
|
|
185
185
|
opacity: 0;
|
|
186
186
|
transform: scale(0) rotate(45deg);
|
|
187
187
|
}
|
|
@@ -190,12 +190,12 @@
|
|
|
190
190
|
.message-transition {
|
|
191
191
|
@include transition-default();
|
|
192
192
|
|
|
193
|
-
&-enter, &-leave-to {
|
|
193
|
+
&-enter-from, &-leave-to {
|
|
194
194
|
opacity: 0;
|
|
195
195
|
transform: translateY(-15px);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
&-leave, &-leave-active {
|
|
198
|
+
&-leave-from, &-leave-active {
|
|
199
199
|
position: absolute;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
.slide-y-transition {
|
|
204
204
|
@include transition-default();
|
|
205
205
|
|
|
206
|
-
&-enter, &-leave-to {
|
|
206
|
+
&-enter-from, &-leave-to {
|
|
207
207
|
opacity: 0;
|
|
208
208
|
transform: translateY(-15px);
|
|
209
209
|
}
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
.slide-y-reverse-transition {
|
|
213
213
|
@include transition-default();
|
|
214
214
|
|
|
215
|
-
&-enter, &-leave-to {
|
|
215
|
+
&-enter-from, &-leave-to {
|
|
216
216
|
opacity: 0;
|
|
217
217
|
transform: translateY(15px);
|
|
218
218
|
}
|
|
@@ -221,11 +221,11 @@
|
|
|
221
221
|
.scroll-y-transition {
|
|
222
222
|
@include transition-default();
|
|
223
223
|
|
|
224
|
-
&-enter, &-leave-to {
|
|
224
|
+
&-enter-from, &-leave-to {
|
|
225
225
|
opacity: 0;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
&-enter {
|
|
228
|
+
&-enter-from {
|
|
229
229
|
transform: translateY(-15px);
|
|
230
230
|
}
|
|
231
231
|
|
|
@@ -237,11 +237,11 @@
|
|
|
237
237
|
.scroll-y-reverse-transition {
|
|
238
238
|
@include transition-default();
|
|
239
239
|
|
|
240
|
-
&-enter, &-leave-to {
|
|
240
|
+
&-enter-from, &-leave-to {
|
|
241
241
|
opacity: 0;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
&-enter {
|
|
244
|
+
&-enter-from {
|
|
245
245
|
transform: translateY(15px);
|
|
246
246
|
}
|
|
247
247
|
|
|
@@ -253,11 +253,11 @@
|
|
|
253
253
|
.scroll-x-transition {
|
|
254
254
|
@include transition-default();
|
|
255
255
|
|
|
256
|
-
&-enter, &-leave-to {
|
|
256
|
+
&-enter-from, &-leave-to {
|
|
257
257
|
opacity: 0;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
&-enter {
|
|
260
|
+
&-enter-from {
|
|
261
261
|
transform: translateX(-15px);
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -269,11 +269,11 @@
|
|
|
269
269
|
.scroll-x-reverse-transition {
|
|
270
270
|
@include transition-default();
|
|
271
271
|
|
|
272
|
-
&-enter, &-leave-to {
|
|
272
|
+
&-enter-from, &-leave-to {
|
|
273
273
|
opacity: 0;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
&-enter {
|
|
276
|
+
&-enter-from {
|
|
277
277
|
transform: translateX(15px);
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
.slide-x-transition {
|
|
286
286
|
@include transition-default();
|
|
287
287
|
|
|
288
|
-
&-enter, &-leave-to {
|
|
288
|
+
&-enter-from, &-leave-to {
|
|
289
289
|
opacity: 0;
|
|
290
290
|
transform: translateX(-15px);
|
|
291
291
|
}
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
.slide-x-reverse-transition {
|
|
295
295
|
@include transition-default();
|
|
296
296
|
|
|
297
|
-
&-enter, &-leave-to {
|
|
297
|
+
&-enter-from, &-leave-to {
|
|
298
298
|
opacity: 0;
|
|
299
299
|
transform: translateX(15px);
|
|
300
300
|
}
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
.fade-transition {
|
|
304
304
|
@include transition-default();
|
|
305
305
|
|
|
306
|
-
&-enter, &-leave-to {
|
|
306
|
+
&-enter-from, &-leave-to {
|
|
307
307
|
opacity: 0 !important;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
.fab-transition {
|
|
312
312
|
@include transition-default();
|
|
313
313
|
|
|
314
|
-
&-enter, &-leave-to {
|
|
314
|
+
&-enter-from, &-leave-to {
|
|
315
315
|
transform: scale(0) rotate(-45deg);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Vue from 'vue/dist/vue.common.js'
|
|
2
1
|
import {
|
|
3
2
|
deepEqual,
|
|
4
3
|
getNestedValue,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
humanReadableFileSize,
|
|
11
10
|
sortItems,
|
|
12
11
|
createSimpleFunctional,
|
|
12
|
+
normalizeClasses,
|
|
13
13
|
} from '../helpers'
|
|
14
14
|
import { mount } from '@vue/test-utils'
|
|
15
15
|
|
|
@@ -379,3 +379,64 @@ describe('helpers', () => {
|
|
|
379
379
|
expect(items).toStrictEqual([{ string: 'bar', number: 3 }, { string: 'baz', number: 2 }, { string: 'baz', number: 1 }, { string: 'foo', number: 1 }])
|
|
380
380
|
})
|
|
381
381
|
})
|
|
382
|
+
|
|
383
|
+
describe('normalizeClasses', () => {
|
|
384
|
+
it('should return empty object for undefined input', () => {
|
|
385
|
+
expect(normalizeClasses(undefined)).toEqual({})
|
|
386
|
+
})
|
|
387
|
+
|
|
388
|
+
it('should return empty object for null input', () => {
|
|
389
|
+
expect(normalizeClasses(null as any)).toEqual({})
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
it('should normalize string classes', () => {
|
|
393
|
+
expect(normalizeClasses('class1 class2 class3')).toEqual({
|
|
394
|
+
class1: true,
|
|
395
|
+
class2: true,
|
|
396
|
+
class3: true
|
|
397
|
+
})
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
it('should handle string with extra spaces', () => {
|
|
401
|
+
expect(normalizeClasses(' class1 class2 ')).toEqual({
|
|
402
|
+
class1: true,
|
|
403
|
+
class2: true
|
|
404
|
+
})
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
it('should return object as is', () => {
|
|
408
|
+
const classes = { class1: true, class2: false }
|
|
409
|
+
expect(normalizeClasses(classes)).toBe(classes)
|
|
410
|
+
})
|
|
411
|
+
|
|
412
|
+
it('should normalize array of strings', () => {
|
|
413
|
+
expect(normalizeClasses(['class1', 'class2', 'class3'])).toEqual({
|
|
414
|
+
class1: true,
|
|
415
|
+
class2: true,
|
|
416
|
+
class3: true
|
|
417
|
+
})
|
|
418
|
+
})
|
|
419
|
+
|
|
420
|
+
it('should normalize array of objects', () => {
|
|
421
|
+
expect(normalizeClasses([{ class1: true }, { class2: false }])).toEqual({
|
|
422
|
+
class1: true,
|
|
423
|
+
class2: false
|
|
424
|
+
})
|
|
425
|
+
})
|
|
426
|
+
|
|
427
|
+
it('should normalize mixed array', () => {
|
|
428
|
+
expect(normalizeClasses(['class1', { class2: true }, 'class3'])).toEqual({
|
|
429
|
+
class1: true,
|
|
430
|
+
class2: true,
|
|
431
|
+
class3: true
|
|
432
|
+
})
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
it('should handle empty string', () => {
|
|
436
|
+
expect(normalizeClasses('')).toEqual({})
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
it('should handle string with only spaces', () => {
|
|
440
|
+
expect(normalizeClasses(' ')).toEqual({})
|
|
441
|
+
})
|
|
442
|
+
})
|
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
|
+
}
|