vuetify 3.2.4 → 3.3.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/dist/_component-variables-labs.sass +1 -0
- package/dist/json/attributes.json +2503 -2151
- package/dist/json/importMap-labs.json +12 -4
- package/dist/json/importMap.json +28 -28
- package/dist/json/tags.json +107 -9
- package/dist/json/web-types.json +10785 -7110
- package/dist/vuetify-labs.css +263 -153
- package/dist/vuetify-labs.d.ts +35870 -16257
- package/dist/vuetify-labs.esm.js +1466 -934
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +1465 -933
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +246 -168
- package/dist/vuetify.d.ts +27883 -14061
- package/dist/vuetify.esm.js +477 -300
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +476 -299
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +811 -806
- package/dist/vuetify.min.js.map +1 -1
- package/lib/blueprints/{index.d.ts → index.d.mts} +5 -1
- package/lib/blueprints/{md1.d.ts → md1.d.mts} +5 -1
- package/lib/blueprints/{md2.d.ts → md2.d.mts} +5 -1
- package/lib/blueprints/{md3.d.ts → md3.d.mts} +5 -1
- package/lib/components/VAlert/VAlert.mjs.map +1 -1
- package/lib/components/VAlert/{index.d.ts → index.d.mts} +284 -69
- package/lib/components/VApp/{index.d.ts → index.d.mts} +80 -19
- package/lib/components/VAppBar/{index.d.ts → index.d.mts} +391 -119
- package/lib/components/VAutocomplete/VAutocomplete.css +15 -9
- package/lib/components/VAutocomplete/VAutocomplete.mjs +82 -34
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.sass +15 -11
- package/lib/components/VAutocomplete/index.d.mts +2048 -0
- package/lib/components/VAvatar/{index.d.ts → index.d.mts} +85 -30
- package/lib/components/VBadge/_variables.scss +1 -1
- package/lib/components/VBadge/{index.d.ts → index.d.mts} +105 -42
- package/lib/components/VBanner/{index.d.ts → index.d.mts} +282 -63
- package/lib/components/VBottomNavigation/{index.d.ts → index.d.mts} +93 -45
- package/lib/components/VBreadcrumbs/VBreadcrumbs.mjs +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbs.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbsDivider.mjs +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbsDivider.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/{index.d.ts → index.d.mts} +348 -212
- package/lib/components/VBtn/{index.d.ts → index.d.mts} +139 -53
- package/lib/components/VBtnGroup/{index.d.ts → index.d.mts} +84 -27
- package/lib/components/VBtnToggle/{index.d.ts → index.d.mts} +88 -35
- package/lib/components/VCalendar/util/props.mjs.map +1 -1
- package/lib/components/VCard/VCard.mjs.map +1 -1
- package/lib/components/VCard/{index.d.ts → index.d.mts} +957 -419
- package/lib/components/VCarousel/VCarousel.mjs.map +1 -1
- package/lib/components/VCarousel/{index.d.ts → index.d.mts} +616 -111
- package/lib/components/VCheckbox/VCheckboxBtn.mjs +3 -3
- package/lib/components/VCheckbox/VCheckboxBtn.mjs.map +1 -1
- package/lib/components/VCheckbox/{index.d.ts → index.d.mts} +408 -141
- package/lib/components/VChip/VChip.css +4 -2
- package/lib/components/VChip/VChip.mjs.map +1 -1
- package/lib/components/VChip/VChip.sass +3 -2
- package/lib/components/VChip/{index.d.ts → index.d.mts} +376 -85
- package/lib/components/VChipGroup/VChipGroup.mjs.map +1 -1
- package/lib/components/VChipGroup/index.d.mts +470 -0
- package/lib/components/VCode/{index.d.ts → index.d.mts} +78 -17
- package/lib/components/VColorPicker/VColorPicker.mjs +9 -4
- package/lib/components/VColorPicker/VColorPicker.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPickerEdit.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPickerSwatches.mjs +5 -4
- package/lib/components/VColorPicker/VColorPickerSwatches.mjs.map +1 -1
- package/lib/components/VColorPicker/{index.d.ts → index.d.mts} +241 -109
- package/lib/components/VColorPicker/util/index.mjs +2 -22
- package/lib/components/VColorPicker/util/index.mjs.map +1 -1
- package/lib/components/VCombobox/VCombobox.css +15 -9
- package/lib/components/VCombobox/VCombobox.mjs +82 -37
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VCombobox/VCombobox.sass +15 -11
- package/lib/components/VCombobox/index.d.mts +2060 -0
- package/lib/components/VCounter/VCounter.mjs.map +1 -1
- package/lib/components/VCounter/{index.d.ts → index.d.mts} +105 -45
- package/lib/components/VDefaultsProvider/{index.d.ts → index.d.mts} +82 -20
- package/lib/components/VDialog/{index.d.ts → index.d.mts} +571 -305
- package/lib/components/VDivider/{index.d.ts → index.d.mts} +81 -21
- package/lib/components/VExpansionPanel/{index.d.ts → index.d.mts} +374 -110
- package/lib/components/VField/VField.css +49 -16
- package/lib/components/VField/VField.mjs +12 -2
- package/lib/components/VField/VField.mjs.map +1 -1
- package/lib/components/VField/VField.sass +40 -11
- package/lib/components/VField/_variables.scss +8 -2
- package/lib/components/VField/index.d.mts +682 -0
- package/lib/components/VFileInput/VFileInput.css +3 -0
- package/lib/components/VFileInput/VFileInput.mjs +7 -1
- package/lib/components/VFileInput/VFileInput.mjs.map +1 -1
- package/lib/components/VFileInput/VFileInput.sass +6 -1
- package/lib/components/VFileInput/{index.d.ts → index.d.mts} +1033 -399
- package/lib/components/VFooter/{index.d.ts → index.d.mts} +85 -29
- package/lib/components/VForm/VForm.mjs.map +1 -1
- package/lib/components/VForm/index.d.mts +993 -0
- package/lib/components/VGrid/{index.d.ts → index.d.mts} +334 -100
- package/lib/components/VHover/VHover.mjs.map +1 -1
- package/lib/components/VHover/{index.d.ts → index.d.mts} +120 -37
- package/lib/components/VIcon/{index.d.ts → index.d.mts} +322 -81
- package/lib/components/VImg/VImg.css +2 -4
- package/lib/components/VImg/VImg.mjs +25 -24
- package/lib/components/VImg/VImg.mjs.map +1 -1
- package/lib/components/VImg/VImg.sass +4 -3
- package/lib/components/VImg/{index.d.ts → index.d.mts} +177 -40
- package/lib/components/VInput/VInput.css +10 -4
- package/lib/components/VInput/VInput.mjs +9 -3
- package/lib/components/VInput/VInput.mjs.map +1 -1
- package/lib/components/VInput/VInput.sass +7 -2
- package/lib/components/VInput/_variables.scss +1 -0
- package/lib/components/VInput/{index.d.ts → index.d.mts} +237 -93
- package/lib/components/VItemGroup/VItem.mjs +1 -1
- package/lib/components/VItemGroup/VItem.mjs.map +1 -1
- package/lib/components/VItemGroup/VItemGroup.mjs.map +1 -1
- package/lib/components/VItemGroup/index.d.mts +781 -0
- package/lib/components/VKbd/{index.d.ts → index.d.mts} +78 -17
- package/lib/components/VLabel/{index.d.ts → index.d.mts} +79 -18
- package/lib/components/VLayout/{index.d.ts → index.d.mts} +161 -42
- package/lib/components/VLazy/{index.d.ts → index.d.mts} +82 -27
- package/lib/components/VList/VList.mjs +6 -1
- package/lib/components/VList/VList.mjs.map +1 -1
- package/lib/components/VList/VListChildren.mjs +4 -8
- package/lib/components/VList/VListChildren.mjs.map +1 -1
- package/lib/components/VList/VListGroup.mjs +3 -0
- package/lib/components/VList/VListGroup.mjs.map +1 -1
- package/lib/components/VList/VListItem.mjs +11 -6
- package/lib/components/VList/VListItem.mjs.map +1 -1
- package/lib/components/VList/{index.d.ts → index.d.mts} +1245 -619
- package/lib/components/VLocaleProvider/{index.d.ts → index.d.mts} +80 -19
- package/lib/components/VMain/{index.d.ts → index.d.mts} +79 -19
- package/lib/components/VMenu/{index.d.ts → index.d.mts} +567 -299
- package/lib/components/VMessages/VMessages.mjs.map +1 -1
- package/lib/components/VMessages/{index.d.ts → index.d.mts} +87 -34
- package/lib/components/VNavigationDrawer/VNavigationDrawer.css +2 -0
- package/lib/components/VNavigationDrawer/VNavigationDrawer.mjs.map +1 -1
- package/lib/components/VNavigationDrawer/VNavigationDrawer.sass +2 -0
- package/lib/components/VNavigationDrawer/{index.d.ts → index.d.mts} +139 -57
- package/lib/components/VOverlay/{index.d.ts → index.d.mts} +159 -75
- package/lib/components/VPagination/VPagination.mjs.map +1 -1
- package/lib/components/VPagination/{index.d.ts → index.d.mts} +229 -125
- package/lib/components/VParallax/{index.d.ts → index.d.mts} +118 -18
- package/lib/components/VProgressCircular/VProgressCircular.mjs.map +1 -1
- package/lib/components/VProgressCircular/{index.d.ts → index.d.mts} +148 -45
- package/lib/components/VProgressLinear/{index.d.ts → index.d.mts} +119 -52
- package/lib/components/VRadio/{index.d.ts → index.d.mts} +139 -40
- package/lib/components/VRadioGroup/{index.d.ts → index.d.mts} +265 -93
- package/lib/components/VRangeSlider/VRangeSlider.mjs +4 -4
- package/lib/components/VRangeSlider/VRangeSlider.mjs.map +1 -1
- package/lib/components/VRangeSlider/{index.d.ts → index.d.mts} +313 -132
- package/lib/components/VRating/{index.d.ts → index.d.mts} +108 -49
- package/lib/components/VResponsive/VResponsive.css +13 -5
- package/lib/components/VResponsive/VResponsive.mjs +4 -1
- package/lib/components/VResponsive/VResponsive.mjs.map +1 -1
- package/lib/components/VResponsive/VResponsive.sass +12 -4
- package/lib/components/VResponsive/{index.d.ts → index.d.mts} +99 -16
- package/lib/components/VSelect/VSelect.css +15 -9
- package/lib/components/VSelect/VSelect.mjs +23 -18
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/VSelect.sass +14 -11
- package/lib/components/VSelect/index.d.mts +1986 -0
- package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
- package/lib/components/VSelectionControl/index.d.mts +403 -0
- package/lib/components/VSelectionControlGroup/{index.d.ts → index.d.mts} +90 -38
- package/lib/components/VSheet/{index.d.ts → index.d.mts} +81 -21
- package/lib/components/VSlideGroup/{index.d.ts → index.d.mts} +236 -61
- package/lib/components/VSlider/VSlider.mjs +2 -2
- package/lib/components/VSlider/VSlider.mjs.map +1 -1
- package/lib/components/VSlider/VSliderThumb.mjs +1 -1
- package/lib/components/VSlider/VSliderThumb.mjs.map +1 -1
- package/lib/components/VSlider/VSliderTrack.mjs.map +1 -1
- package/lib/components/VSlider/{index.d.ts → index.d.mts} +308 -126
- package/lib/components/VSlider/slider.mjs +8 -2
- package/lib/components/VSlider/slider.mjs.map +1 -1
- package/lib/components/VSnackbar/{index.d.ts → index.d.mts} +566 -297
- package/lib/components/VSwitch/VSwitch.css +3 -3
- package/lib/components/VSwitch/VSwitch.sass +4 -3
- package/lib/components/VSwitch/{index.d.ts → index.d.mts} +284 -101
- package/lib/components/VSystemBar/{index.d.ts → index.d.mts} +84 -27
- package/lib/components/VTable/{index.d.ts → index.d.mts} +122 -26
- package/lib/components/VTabs/VTabs.mjs.map +1 -1
- package/lib/components/VTabs/{index.d.ts → index.d.mts} +203 -113
- package/lib/components/VTextField/VTextField.css +9 -1
- package/lib/components/VTextField/VTextField.mjs +4 -2
- package/lib/components/VTextField/VTextField.mjs.map +1 -1
- package/lib/components/VTextField/VTextField.sass +8 -1
- package/lib/components/VTextField/index.d.mts +2735 -0
- package/lib/components/VTextarea/VTextarea.mjs +13 -4
- package/lib/components/VTextarea/VTextarea.mjs.map +1 -1
- package/lib/components/VTextarea/{index.d.ts → index.d.mts} +933 -393
- package/lib/components/VThemeProvider/{index.d.ts → index.d.mts} +80 -20
- package/lib/components/VTimeline/{index.d.ts → index.d.mts} +201 -62
- package/lib/components/VToolbar/{index.d.ts → index.d.mts} +325 -73
- package/lib/components/VTooltip/{index.d.ts → index.d.mts} +568 -297
- package/lib/components/VValidation/VValidation.mjs.map +1 -1
- package/lib/components/VValidation/index.d.mts +634 -0
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs.map +1 -1
- package/lib/components/VVirtualScroll/index.d.mts +229 -0
- package/lib/components/VWindow/{index.d.ts → index.d.mts} +271 -68
- package/lib/components/{index.d.ts → index.d.mts} +27847 -14031
- package/lib/components/index.mjs +2 -3
- package/lib/components/index.mjs.map +1 -1
- package/lib/components/transitions/{index.d.ts → index.d.mts} +1330 -355
- package/lib/composables/display.mjs +6 -6
- package/lib/composables/display.mjs.map +1 -1
- package/lib/composables/filter.mjs +5 -4
- package/lib/composables/filter.mjs.map +1 -1
- package/lib/composables/form.mjs +2 -3
- package/lib/composables/form.mjs.map +1 -1
- package/lib/composables/forwardRefs.mjs.map +1 -1
- package/lib/composables/group.mjs +13 -13
- package/lib/composables/group.mjs.map +1 -1
- package/lib/composables/icons.mjs.map +1 -1
- package/lib/composables/{items.mjs → list-items.mjs} +9 -6
- package/lib/composables/list-items.mjs.map +1 -0
- package/lib/composables/nested/nested.mjs.map +1 -1
- package/lib/composables/nested/selectStrategies.mjs.map +1 -1
- package/lib/composables/scroll.mjs +2 -2
- package/lib/composables/scroll.mjs.map +1 -1
- package/lib/composables/validation.mjs +44 -16
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/entry-bundler.mjs +1 -1
- package/lib/framework.mjs +1 -1
- package/lib/framework.mjs.map +1 -1
- package/lib/{index.d.ts → index.d.mts} +16 -10
- package/lib/labs/VBottomSheet/VBottomSheet.css +33 -0
- package/lib/labs/VBottomSheet/VBottomSheet.mjs +40 -0
- package/lib/labs/VBottomSheet/VBottomSheet.mjs.map +1 -0
- package/lib/labs/VBottomSheet/VBottomSheet.sass +37 -0
- package/lib/labs/VBottomSheet/_variables.scss +5 -0
- package/lib/labs/VBottomSheet/index.d.mts +871 -0
- package/lib/labs/VBottomSheet/index.mjs +2 -0
- package/lib/labs/VBottomSheet/index.mjs.map +1 -0
- package/lib/labs/VDataIterator/VDataIterator.mjs +160 -0
- package/lib/labs/VDataIterator/VDataIterator.mjs.map +1 -0
- package/lib/labs/VDataIterator/composables/items.mjs +37 -0
- package/lib/labs/VDataIterator/composables/items.mjs.map +1 -0
- package/lib/labs/VDataIterator/index.d.mts +704 -0
- package/lib/labs/VDataIterator/index.mjs +2 -0
- package/lib/labs/VDataIterator/index.mjs.map +1 -0
- package/lib/labs/VDataTable/VDataTable.mjs +58 -20
- package/lib/labs/VDataTable/VDataTable.mjs.map +1 -1
- package/lib/labs/VDataTable/VDataTableFooter.mjs.map +1 -1
- package/lib/labs/VDataTable/VDataTableGroupHeaderRow.mjs.map +1 -1
- package/lib/labs/VDataTable/VDataTableHeaders.mjs +17 -10
- package/lib/labs/VDataTable/VDataTableHeaders.mjs.map +1 -1
- package/lib/labs/VDataTable/VDataTableRows.mjs +1 -1
- package/lib/labs/VDataTable/VDataTableRows.mjs.map +1 -1
- package/lib/labs/VDataTable/VDataTableServer.mjs +50 -14
- package/lib/labs/VDataTable/VDataTableServer.mjs.map +1 -1
- package/lib/labs/VDataTable/VDataTableVirtual.mjs +50 -13
- package/lib/labs/VDataTable/VDataTableVirtual.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/expand.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/group.mjs +8 -6
- package/lib/labs/VDataTable/composables/group.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/headers.mjs +2 -3
- package/lib/labs/VDataTable/composables/headers.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/items.mjs +31 -32
- package/lib/labs/VDataTable/composables/items.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/paginate.mjs +14 -2
- package/lib/labs/VDataTable/composables/paginate.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/select.mjs +3 -3
- package/lib/labs/VDataTable/composables/select.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/sort.mjs +17 -17
- package/lib/labs/VDataTable/composables/sort.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/virtual.mjs.map +1 -1
- package/lib/labs/VDataTable/index.d.mts +9681 -0
- package/lib/labs/VDataTable/index.mjs +1 -1
- package/lib/labs/VDataTable/index.mjs.map +1 -1
- package/lib/labs/VDataTable/types.mjs.map +1 -1
- package/lib/labs/VInfiniteScroll/VInfiniteScroll.mjs.map +1 -1
- package/lib/labs/VInfiniteScroll/{index.d.ts → index.d.mts} +161 -54
- package/lib/labs/VSkeletonLoader/VSkeletonLoader.mjs.map +1 -1
- package/lib/labs/VSkeletonLoader/{index.d.ts → index.d.mts} +92 -31
- package/lib/labs/components.d.mts +11806 -0
- package/lib/labs/components.mjs +2 -0
- package/lib/labs/components.mjs.map +1 -1
- package/lib/labs/date/date.mjs.map +1 -1
- package/lib/labs/date/index.d.mts +70 -0
- package/lib/labs/date/index.mjs +1 -1
- package/lib/labs/date/index.mjs.map +1 -1
- package/lib/styles/settings/_variables.scss +3 -3
- package/lib/util/colorUtils.mjs +68 -3
- package/lib/util/colorUtils.mjs.map +1 -1
- package/lib/util/console.mjs +12 -81
- package/lib/util/console.mjs.map +1 -1
- package/lib/util/defineComponent.mjs.map +1 -1
- package/lib/util/helpers.mjs +4 -18
- package/lib/util/helpers.mjs.map +1 -1
- package/lib/util/propsFactory.mjs +2 -0
- package/lib/util/propsFactory.mjs.map +1 -1
- package/package.json +13 -9
- package/lib/components/VAutocomplete/index.d.ts +0 -2050
- package/lib/components/VBottomSheet/VBottomSheet.mjs +0 -29
- package/lib/components/VBottomSheet/VBottomSheet.mjs.map +0 -1
- package/lib/components/VBottomSheet/VBottomSheet.sass +0 -23
- package/lib/components/VBottomSheet/_variables.scss +0 -3
- package/lib/components/VBottomSheet/index.mjs +0 -4
- package/lib/components/VBottomSheet/index.mjs.map +0 -1
- package/lib/components/VChipGroup/index.d.ts +0 -280
- package/lib/components/VCombobox/index.d.ts +0 -2086
- package/lib/components/VData/VData.mjs +0 -374
- package/lib/components/VData/VData.mjs.map +0 -1
- package/lib/components/VData/index.mjs +0 -4
- package/lib/components/VData/index.mjs.map +0 -1
- package/lib/components/VDataIterator/VDataFooter.mjs +0 -194
- package/lib/components/VDataIterator/VDataFooter.mjs.map +0 -1
- package/lib/components/VDataIterator/VDataFooter.sass +0 -71
- package/lib/components/VDataIterator/VDataIterator.mjs +0 -316
- package/lib/components/VDataIterator/VDataIterator.mjs.map +0 -1
- package/lib/components/VDataIterator/_variables.scss +0 -13
- package/lib/components/VDataIterator/index.mjs +0 -10
- package/lib/components/VDataIterator/index.mjs.map +0 -1
- package/lib/components/VField/index.d.ts +0 -563
- package/lib/components/VForm/index.d.ts +0 -284
- package/lib/components/VItemGroup/index.d.ts +0 -396
- package/lib/components/VSelect/index.d.ts +0 -1981
- package/lib/components/VSelectionControl/index.d.ts +0 -387
- package/lib/components/VTextField/index.d.ts +0 -2061
- package/lib/components/VValidation/index.d.ts +0 -243
- package/lib/components/VVirtualScroll/index.d.ts +0 -197
- package/lib/composables/items.mjs.map +0 -1
- package/lib/labs/VDataTable/index.d.ts +0 -5415
- package/lib/labs/components.d.ts +0 -5945
- package/lib/labs/date/index.d.ts +0 -38
- /package/lib/components/VNoSsr/{index.d.ts → index.d.mts} +0 -0
- /package/lib/directives/{index.d.ts → index.d.mts} +0 -0
- /package/lib/iconsets/{fa-svg.d.ts → fa-svg.d.mts} +0 -0
- /package/lib/iconsets/{fa.d.ts → fa.d.mts} +0 -0
- /package/lib/iconsets/{fa4.d.ts → fa4.d.mts} +0 -0
- /package/lib/iconsets/{md.d.ts → md.d.mts} +0 -0
- /package/lib/iconsets/{mdi-svg.d.ts → mdi-svg.d.mts} +0 -0
- /package/lib/iconsets/{mdi.d.ts → mdi.d.mts} +0 -0
- /package/lib/labs/date/adapters/{vuetify.d.ts → vuetify.d.mts} +0 -0
- /package/lib/locale/adapters/{vue-i18n.d.ts → vue-i18n.d.mts} +0 -0
- /package/lib/locale/adapters/{vuetify.d.ts → vuetify.d.mts} +0 -0
- /package/lib/locale/{index.d.ts → index.d.mts} +0 -0
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { makeItemsProps, useItems } from "../../../composables/items.mjs"; // Utilities
|
|
1
|
+
// Utilities
|
|
3
2
|
import { computed } from 'vue';
|
|
4
3
|
import { getPropertyFromItem, propsFactory } from "../../../util/index.mjs"; // Types
|
|
4
|
+
// Composables
|
|
5
5
|
export const makeDataTableItemProps = propsFactory({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
items: {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: () => []
|
|
9
|
+
},
|
|
10
|
+
itemValue: {
|
|
11
|
+
type: [String, Array, Function],
|
|
12
|
+
default: 'value'
|
|
13
|
+
},
|
|
14
|
+
returnObject: Boolean
|
|
11
15
|
}, 'v-data-table-item');
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export function transformItem(props, item, columns) {
|
|
17
|
+
const value = props.returnObject ? item : getPropertyFromItem(item, props.itemValue);
|
|
18
|
+
const itemColumns = columns.reduce((obj, column) => {
|
|
19
|
+
obj[column.key] = getPropertyFromItem(item, column.value ?? column.key);
|
|
20
|
+
return obj;
|
|
21
|
+
}, {});
|
|
22
|
+
return {
|
|
23
|
+
type: 'item',
|
|
24
|
+
value,
|
|
25
|
+
columns: itemColumns,
|
|
26
|
+
raw: item
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function transformItems(props, items, columns) {
|
|
30
|
+
const array = [];
|
|
31
|
+
for (const item of items) {
|
|
32
|
+
array.push(transformItem(props, item, columns));
|
|
22
33
|
}
|
|
23
|
-
|
|
34
|
+
return array;
|
|
24
35
|
}
|
|
25
36
|
export function useDataTableItems(props, columns) {
|
|
26
|
-
const
|
|
27
|
-
items
|
|
28
|
-
} = useItems(props);
|
|
29
|
-
const dataTableItems = computed(() => items.value.map(item => {
|
|
30
|
-
return {
|
|
31
|
-
...item,
|
|
32
|
-
type: 'item',
|
|
33
|
-
columns: columns.value.reduce((obj, column) => {
|
|
34
|
-
add(obj, column.key, getPropertyFromItem(item.raw, column.value ?? column.key));
|
|
35
|
-
return obj;
|
|
36
|
-
}, {})
|
|
37
|
-
};
|
|
38
|
-
}));
|
|
37
|
+
const items = computed(() => transformItems(props, props.items, columns.value));
|
|
39
38
|
return {
|
|
40
|
-
items
|
|
39
|
+
items
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
42
|
//# sourceMappingURL=items.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.mjs","names":["
|
|
1
|
+
{"version":3,"file":"items.mjs","names":["computed","getPropertyFromItem","propsFactory","makeDataTableItemProps","items","type","Array","default","itemValue","String","Function","returnObject","Boolean","transformItem","props","item","columns","value","itemColumns","reduce","obj","column","key","raw","transformItems","array","push","useDataTableItems"],"sources":["../../../../src/labs/VDataTable/composables/items.ts"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { getPropertyFromItem, propsFactory } from '@/util'\n\n// Types\nimport type { PropType, Ref } from 'vue'\nimport type { SelectItemKey } from '@/util'\nimport type { DataTableItem, InternalDataTableHeader } from '../types'\n\nexport interface DataTableItemProps {\n items: any[]\n itemValue: SelectItemKey\n returnObject: boolean\n}\n\n// Composables\nexport const makeDataTableItemProps = propsFactory({\n items: {\n type: Array as PropType<DataTableItemProps['items']>,\n default: () => ([]),\n },\n itemValue: {\n type: [String, Array, Function] as PropType<SelectItemKey>,\n default: 'value',\n },\n returnObject: Boolean,\n}, 'v-data-table-item')\n\nexport function transformItem (\n props: Omit<DataTableItemProps, 'items'>,\n item: any,\n columns: InternalDataTableHeader[]\n): DataTableItem {\n const value = props.returnObject ? item : getPropertyFromItem(item, props.itemValue)\n const itemColumns = columns.reduce((obj, column) => {\n obj[column.key] = getPropertyFromItem(item, column.value ?? column.key)\n return obj\n }, {} as Record<string, unknown>)\n\n return {\n type: 'item',\n value,\n columns: itemColumns,\n raw: item,\n }\n}\n\nexport function transformItems (\n props: Omit<DataTableItemProps, 'items'>,\n items: DataTableItemProps['items'],\n columns: InternalDataTableHeader[]\n) {\n const array: DataTableItem[] = []\n\n for (const item of items) {\n array.push(transformItem(props, item, columns))\n }\n\n return array\n}\n\nexport function useDataTableItems (props: DataTableItemProps, columns: Ref<InternalDataTableHeader[]>) {\n const items = computed(() => transformItems(props, props.items, columns.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EA,OAAOS,KAAK;AACd;AAEA,OAAO,SAASE,iBAAiBA,CAAEb,KAAyB,EAAEE,OAAuC,EAAE;EACrG,MAAMZ,KAAK,GAAGJ,QAAQ,CAAC,MAAMwB,cAAc,CAACV,KAAK,EAAEA,KAAK,CAACV,KAAK,EAAEY,OAAO,CAACC,KAAK,CAAC,CAAC;EAE/E,OAAO;IAAEb;EAAM,CAAC;AAClB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Composables
|
|
2
2
|
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
|
|
3
3
|
import { computed, inject, provide, watchEffect } from 'vue';
|
|
4
|
-
import { propsFactory } from "../../../util/index.mjs"; // Types
|
|
4
|
+
import { clamp, propsFactory } from "../../../util/index.mjs"; // Types
|
|
5
5
|
export const makeDataTablePaginateProps = propsFactory({
|
|
6
6
|
page: {
|
|
7
7
|
type: [Number, String],
|
|
@@ -48,13 +48,25 @@ export function providePagination(options) {
|
|
|
48
48
|
itemsPerPage.value = value;
|
|
49
49
|
page.value = 1;
|
|
50
50
|
}
|
|
51
|
+
function nextPage() {
|
|
52
|
+
page.value = clamp(page.value + 1, 1, pageCount.value);
|
|
53
|
+
}
|
|
54
|
+
function prevPage() {
|
|
55
|
+
page.value = clamp(page.value - 1, 1, pageCount.value);
|
|
56
|
+
}
|
|
57
|
+
function setPage(value) {
|
|
58
|
+
page.value = clamp(value, 1, pageCount.value);
|
|
59
|
+
}
|
|
51
60
|
const data = {
|
|
52
61
|
page,
|
|
53
62
|
itemsPerPage,
|
|
54
|
-
itemsLength,
|
|
55
63
|
startIndex,
|
|
56
64
|
stopIndex,
|
|
57
65
|
pageCount,
|
|
66
|
+
itemsLength,
|
|
67
|
+
nextPage,
|
|
68
|
+
prevPage,
|
|
69
|
+
setPage,
|
|
58
70
|
setItemsPerPage
|
|
59
71
|
};
|
|
60
72
|
provide(VDataTablePaginationSymbol, data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginate.mjs","names":["useProxiedModel","computed","inject","provide","watchEffect","propsFactory","makeDataTablePaginateProps","page","type","Number","String","default","itemsPerPage","VDataTablePaginationSymbol","Symbol","for","createPagination","props","undefined","value","providePagination","options","itemsLength","startIndex","stopIndex","Math","min","pageCount","ceil","setItemsPerPage","data","usePagination","Error","usePaginatedItems","items","paginatedItems","slice"],"sources":["../../../../src/labs/VDataTable/composables/paginate.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, provide, watchEffect } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, Ref } from 'vue'\n\nexport const makeDataTablePaginateProps = propsFactory({\n page: {\n type: [Number, String],\n default: 1,\n },\n itemsPerPage: {\n type: [Number, String],\n default: 10,\n },\n}, 'v-data-table-paginate')\n\nconst VDataTablePaginationSymbol: InjectionKey<{\n page: Ref<number>\n itemsPerPage: Ref<number>\n
|
|
1
|
+
{"version":3,"file":"paginate.mjs","names":["useProxiedModel","computed","inject","provide","watchEffect","clamp","propsFactory","makeDataTablePaginateProps","page","type","Number","String","default","itemsPerPage","VDataTablePaginationSymbol","Symbol","for","createPagination","props","undefined","value","providePagination","options","itemsLength","startIndex","stopIndex","Math","min","pageCount","ceil","setItemsPerPage","nextPage","prevPage","setPage","data","usePagination","Error","usePaginatedItems","items","paginatedItems","slice"],"sources":["../../../../src/labs/VDataTable/composables/paginate.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, provide, watchEffect } from 'vue'\nimport { clamp, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, Ref } from 'vue'\n\nexport const makeDataTablePaginateProps = propsFactory({\n page: {\n type: [Number, String],\n default: 1,\n },\n itemsPerPage: {\n type: [Number, String],\n default: 10,\n },\n}, 'v-data-table-paginate')\n\nconst VDataTablePaginationSymbol: InjectionKey<{\n page: Ref<number>\n itemsPerPage: Ref<number>\n startIndex: Ref<number>\n stopIndex: Ref<number>\n pageCount: Ref<number>\n itemsLength: Ref<number>\n prevPage: () => void\n nextPage: () => void\n setPage: (value: number) => void\n setItemsPerPage: (value: number) => void\n}> = Symbol.for('vuetify:data-table-pagination')\n\ntype PaginationProps = {\n page: number | string\n 'onUpdate:page': ((val: any) => void) | undefined\n itemsPerPage: number | string\n 'onUpdate:itemsPerPage': ((val: any) => void) | undefined\n itemsLength?: number | string\n}\n\nexport function createPagination (props: PaginationProps) {\n const page = useProxiedModel(props, 'page', undefined, value => +(value ?? 1))\n const itemsPerPage = useProxiedModel(props, 'itemsPerPage', undefined, value => +(value ?? 10))\n\n return { page, itemsPerPage }\n}\n\nexport function providePagination (options: {\n page: Ref<number>\n itemsPerPage: Ref<number>\n itemsLength: Ref<number>\n}) {\n const { page, itemsPerPage, itemsLength } = options\n\n const startIndex = computed(() => {\n if (itemsPerPage.value === -1) return 0\n\n return itemsPerPage.value * (page.value - 1)\n })\n const stopIndex = computed(() => {\n if (itemsPerPage.value === -1) return itemsLength.value\n\n return Math.min(itemsLength.value, startIndex.value + itemsPerPage.value)\n })\n\n const pageCount = computed(() => {\n if (itemsPerPage.value === -1 || itemsLength.value === 0) return 1\n\n return Math.ceil(itemsLength.value / itemsPerPage.value)\n })\n\n watchEffect(() => {\n if (page.value > pageCount.value) {\n page.value = pageCount.value\n }\n })\n\n function setItemsPerPage (value: number) {\n itemsPerPage.value = value\n page.value = 1\n }\n\n function nextPage () {\n page.value = clamp(page.value + 1, 1, pageCount.value)\n }\n\n function prevPage () {\n page.value = clamp(page.value - 1, 1, pageCount.value)\n }\n\n function setPage (value: number) {\n page.value = clamp(value, 1, pageCount.value)\n }\n\n const data = { page, itemsPerPage, startIndex, stopIndex, pageCount, itemsLength, nextPage, prevPage, setPage, setItemsPerPage }\n\n provide(VDataTablePaginationSymbol, data)\n\n return data\n}\n\nexport function usePagination () {\n const data = inject(VDataTablePaginationSymbol)\n\n if (!data) throw new Error('Missing pagination!')\n\n return data\n}\n\nexport function usePaginatedItems (options: {\n items: Ref<readonly any[]>\n startIndex: Ref<number>\n stopIndex: Ref<number>\n itemsPerPage: Ref<number>\n}) {\n const { items, startIndex, stopIndex, itemsPerPage } = options\n const paginatedItems = computed(() => {\n if (itemsPerPage.value <= 0) return items.value\n\n return items.value.slice(startIndex.value, stopIndex.value)\n })\n\n return { paginatedItems }\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,iDAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAEC,WAAW,QAAQ,KAAK;AAAA,SACnDC,KAAK,EAAEC,YAAY,mCAE5B;AAGA,OAAO,MAAMC,0BAA0B,GAAGD,YAAY,CAAC;EACrDE,IAAI,EAAE;IACJC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX,CAAC;EACDC,YAAY,EAAE;IACZJ,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX;AACF,CAAC,EAAE,uBAAuB,CAAC;AAE3B,MAAME,0BAWJ,GAAGC,MAAM,CAACC,GAAG,CAAC,+BAA+B,CAAC;AAUhD,OAAO,SAASC,gBAAgBA,CAAEC,KAAsB,EAAE;EACxD,MAAMV,IAAI,GAAGR,eAAe,CAACkB,KAAK,EAAE,MAAM,EAAEC,SAAS,EAAEC,KAAK,IAAI,EAAEA,KAAK,IAAI,CAAC,CAAC,CAAC;EAC9E,MAAMP,YAAY,GAAGb,eAAe,CAACkB,KAAK,EAAE,cAAc,EAAEC,SAAS,EAAEC,KAAK,IAAI,EAAEA,KAAK,IAAI,EAAE,CAAC,CAAC;EAE/F,OAAO;IAAEZ,IAAI;IAAEK;EAAa,CAAC;AAC/B;AAEA,OAAO,SAASQ,iBAAiBA,CAAEC,OAIlC,EAAE;EACD,MAAM;IAAEd,IAAI;IAAEK,YAAY;IAAEU;EAAY,CAAC,GAAGD,OAAO;EAEnD,MAAME,U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AK,CAACG,IAAI,CAACY,KAAK,GAAG,CAAC,EAAE,CAAC,EAAEQ,SAAS,CAACR,KAAK,CAAC;EACxD;EAEA,SAASa,OAAOA,CAAEb,KAAa,EAAE;IAC/BZ,IAAI,CAACY,KAAK,GAAGf,KAAK,CAACe,KAAK,EAAE,CAAC,EAAEQ,SAAS,CAACR,KAAK,CAAC;EAC/C;EAEA,MAAMc,IAAI,GAAG;IAAE1B,IAAI;IAAEK,YAAY;IAAEW,UAAU;IAAEC,SAAS;IAAEG,SAAS;IAAEL,WAAW;IAAEQ,QAAQ;IAAEC,QAAQ;IAAEC,OAAO;IAAEH;EAAgB,CAAC;EAEhI3B,OAAO,CAACW,0BAA0B,EAAEoB,IAAI,CAAC;EAEzC,OAAOA,IAAI;AACb;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAI;EAC/B,MAAMD,IAAI,GAAGhC,MAAM,CAACY,0BAA0B,CAAC;EAE/C,IAAI,CAACoB,IAAI,EAAE,MAAM,IAAIE,KAAK,CAAC,qBAAqB,CAAC;EAEjD,OAAOF,IAAI;AACb;AAEA,OAAO,SAASG,iBAAiBA,CAAEf,OAKlC,EAAE;EACD,MAAM;IAAEgB,KAAK;IAAEd,UAAU;IAAEC,SAAS;IAAEZ;EAAa,CAAC,GAAGS,OAAO;EAC9D,MAAMiB,cAAc,GAAGtC,QAAQ,CAAC,MAAM;IACpC,IAAIY,YAAY,CAACO,KAAK,IAAI,CAAC,EAAE,OAAOkB,KAAK,CAAClB,KAAK;IAE/C,OAAOkB,KAAK,CAAClB,KAAK,CAACoB,KAAK,CAAChB,UAAU,CAACJ,KAAK,EAAEK,SAAS,CAACL,KAAK,CAAC;EAC7D,CAAC,CAAC;EAEF,OAAO;IAAEmB;EAAe,CAAC;AAC3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Composables
|
|
2
2
|
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
|
|
3
3
|
import { computed, inject, provide } from 'vue';
|
|
4
|
-
import { propsFactory } from "../../../util/index.mjs"; // Types
|
|
4
|
+
import { propsFactory, wrapInArray } from "../../../util/index.mjs"; // Types
|
|
5
5
|
export const makeDataTableSelectProps = propsFactory({
|
|
6
6
|
showSelect: Boolean,
|
|
7
7
|
modelValue: {
|
|
@@ -17,10 +17,10 @@ export function provideSelection(props, allItems) {
|
|
|
17
17
|
return [...v.values()];
|
|
18
18
|
});
|
|
19
19
|
function isSelected(items) {
|
|
20
|
-
return items.every(item => selected.value.has(item.value));
|
|
20
|
+
return wrapInArray(items).every(item => selected.value.has(item.value));
|
|
21
21
|
}
|
|
22
22
|
function isSomeSelected(items) {
|
|
23
|
-
return items.some(item => selected.value.has(item.value));
|
|
23
|
+
return wrapInArray(items).some(item => selected.value.has(item.value));
|
|
24
24
|
}
|
|
25
25
|
function select(items, value) {
|
|
26
26
|
const newSelected = new Set(selected.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.mjs","names":["useProxiedModel","computed","inject","provide","propsFactory","makeDataTableSelectProps","showSelect","Boolean","modelValue","type","Array","default","VDataTableSelectionSymbol","Symbol","for","provideSelection","props","allItems","selected","v","Set","values","isSelected","items","every","item","value","has","isSomeSelected","some","select","newSelected","add","delete","toggleSelect","selectAll","someSelected","size","allSelected","data","useSelection","Error"],"sources":["../../../../src/labs/VDataTable/composables/select.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, provide } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type {
|
|
1
|
+
{"version":3,"file":"select.mjs","names":["useProxiedModel","computed","inject","provide","propsFactory","wrapInArray","makeDataTableSelectProps","showSelect","Boolean","modelValue","type","Array","default","VDataTableSelectionSymbol","Symbol","for","provideSelection","props","allItems","selected","v","Set","values","isSelected","items","every","item","value","has","isSomeSelected","some","select","newSelected","add","delete","toggleSelect","selectAll","someSelected","size","allSelected","data","useSelection","Error"],"sources":["../../../../src/labs/VDataTable/composables/select.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, provide } from 'vue'\nimport { propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { DataTableItemProps } from './items'\nimport type { DataTableItem } from '../types'\n\nexport const makeDataTableSelectProps = propsFactory({\n showSelect: Boolean,\n modelValue: {\n type: Array as PropType<readonly any[]>,\n default: () => ([]),\n },\n}, 'v-data-table-select')\n\nexport const VDataTableSelectionSymbol: InjectionKey<{\n toggleSelect: (item: any) => void\n select: (items: any[], value: boolean) => void\n selectAll: (value: boolean) => void\n isSelected: (items: any[]) => boolean\n isSomeSelected: (items: any[]) => boolean\n someSelected: Ref<boolean>\n allSelected: Ref<boolean>\n}> = Symbol.for('vuetify:data-table-selection')\n\ntype SelectionProps = Pick<DataTableItemProps, 'itemValue'> & {\n modelValue: readonly any[]\n 'onUpdate:modelValue': ((value: any[]) => void) | undefined\n}\n\nexport function provideSelection <T extends DataTableItem> (props: SelectionProps, allItems: Ref<T[]>) {\n const selected = useProxiedModel(props, 'modelValue', props.modelValue, v => {\n return new Set(v)\n }, v => {\n return [...v.values()]\n })\n\n function isSelected (items: T | T[]) {\n return wrapInArray(items).every(item => selected.value.has(item.value))\n }\n\n function isSomeSelected (items: T | T[]) {\n return wrapInArray(items).some(item => selected.value.has(item.value))\n }\n\n function select (items: T[], value: boolean) {\n const newSelected = new Set(selected.value)\n\n for (const item of items) {\n if (value) newSelected.add(item.value)\n else newSelected.delete(item.value)\n }\n\n selected.value = newSelected\n }\n\n function toggleSelect (item: T) {\n select([item], !isSelected([item]))\n }\n\n function selectAll (value: boolean) {\n select(allItems.value, value)\n }\n\n const someSelected = computed(() => selected.value.size > 0)\n const allSelected = computed(() => isSelected(allItems.value))\n\n const data = { toggleSelect, select, selectAll, isSelected, isSomeSelected, someSelected, allSelected }\n\n provide(VDataTableSelectionSymbol, data)\n\n return data\n}\n\nexport function useSelection () {\n const data = inject(VDataTableSelectionSymbol)\n\n if (!data) throw new Error('Missing selection!')\n\n return data\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,iDAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,QAAQ,KAAK;AAAA,SACtCC,YAAY,EAAEC,WAAW,mCAElC;AAKA,OAAO,MAAMC,wBAAwB,GAAGF,YAAY,CAAC;EACnDG,UAAU,EAAEC,OAAO;EACnBC,UAAU,EAAE;IACVC,IAAI,EAAEC,KAAiC;IACvCC,OAAO,EAAEA,CAAA,KAAO;EAClB;AACF,CAAC,EAAE,qBAAqB,CAAC;AAEzB,OAAO,MAAMC,yBAQX,GAAGC,MAAM,CAACC,GAAG,CAAC,8BAA8B,CAAC;AAO/C,OAAO,SAASC,gBAAgBA,CAA4BC,KAAqB,EAAEC,QAAkB,EAAE;EACrG,MAAMC,QAAQ,GAAGnB,eAAe,CAACiB,KAAK,EAAE,YAAY,EAAEA,KAAK,CAACR,UAAU,EAAEW,CAAC,IAAI;IAC3E,OAAO,IAAIC,GAAG,CAACD,CAAC,CAAC;EACnB,CAAC,EAAEA,CAAC,IAAI;IACN,OAAO,CAAC,GAAGA,CAAC,CAACE,MAAM,EAAE,CAAC;EACxB,CAAC,CAAC;EAEF,SAASC,UAAUA,CAAEC,KAAc,EAAE;IACnC,OAAOnB,WAAW,CAACmB,KAAK,CAAC,CAACC,KAAK,CAACC,IAAI,IAAIP,QAAQ,CAACQ,KAAK,CAACC,GAAG,CAACF,IAAI,CAACC,KAAK,CAAC,CAAC;EACzE;EAEA,SAASE,cAAcA,CAAEL,KAAc,EAAE;IACvC,OAAOnB,WAAW,CAACmB,KAAK,CAAC,CAACM,IAAI,CAACJ,IAAI,IAAIP,QAAQ,CAACQ,KAAK,CAACC,GAAG,CAACF,IAAI,CAACC,KAAK,CAAC,CAAC;EACxE;EAEA,SAASI,MAAMA,CAAE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ables/proxiedModel.mjs";
|
|
2
|
+
import { useProxiedModel } from "../../../composables/proxiedModel.mjs";
|
|
3
|
+
import { useLocale } from "../../../composables/index.mjs"; // Utilities
|
|
3
4
|
import { computed, inject, provide, toRef } from 'vue';
|
|
4
5
|
import { getObjectValueByPath, propsFactory } from "../../../util/index.mjs"; // Types
|
|
5
6
|
export const makeDataTableSortProps = propsFactory({
|
|
@@ -7,6 +8,7 @@ export const makeDataTableSortProps = propsFactory({
|
|
|
7
8
|
type: Array,
|
|
8
9
|
default: () => []
|
|
9
10
|
},
|
|
11
|
+
customKeySort: Object,
|
|
10
12
|
multiSort: Boolean,
|
|
11
13
|
mustSort: Boolean
|
|
12
14
|
}, 'v-data-table-sort');
|
|
@@ -28,24 +30,24 @@ export function provideSort(options) {
|
|
|
28
30
|
multiSort,
|
|
29
31
|
page
|
|
30
32
|
} = options;
|
|
31
|
-
const toggleSort =
|
|
33
|
+
const toggleSort = column => {
|
|
32
34
|
let newSortBy = sortBy.value.map(x => ({
|
|
33
35
|
...x
|
|
34
36
|
})) ?? [];
|
|
35
|
-
const item = newSortBy.find(x => x.key === key);
|
|
37
|
+
const item = newSortBy.find(x => x.key === column.key);
|
|
36
38
|
if (!item) {
|
|
37
39
|
if (multiSort.value) newSortBy = [...newSortBy, {
|
|
38
|
-
key,
|
|
40
|
+
key: column.key,
|
|
39
41
|
order: 'asc'
|
|
40
42
|
}];else newSortBy = [{
|
|
41
|
-
key,
|
|
43
|
+
key: column.key,
|
|
42
44
|
order: 'asc'
|
|
43
45
|
}];
|
|
44
46
|
} else if (item.order === 'desc') {
|
|
45
47
|
if (mustSort.value) {
|
|
46
48
|
item.order = 'asc';
|
|
47
49
|
} else {
|
|
48
|
-
newSortBy = newSortBy.filter(x => x.key !== key);
|
|
50
|
+
newSortBy = newSortBy.filter(x => x.key !== column.key);
|
|
49
51
|
}
|
|
50
52
|
} else {
|
|
51
53
|
item.order = 'desc';
|
|
@@ -53,9 +55,13 @@ export function provideSort(options) {
|
|
|
53
55
|
sortBy.value = newSortBy;
|
|
54
56
|
if (page) page.value = 1;
|
|
55
57
|
};
|
|
58
|
+
function isSorted(column) {
|
|
59
|
+
return !!sortBy.value.find(item => item.key === column.key);
|
|
60
|
+
}
|
|
56
61
|
const data = {
|
|
57
62
|
sortBy,
|
|
58
|
-
toggleSort
|
|
63
|
+
toggleSort,
|
|
64
|
+
isSorted
|
|
59
65
|
};
|
|
60
66
|
provide(VDataTableSortSymbol, data);
|
|
61
67
|
return data;
|
|
@@ -65,17 +71,11 @@ export function useSort() {
|
|
|
65
71
|
if (!data) throw new Error('Missing sort!');
|
|
66
72
|
return data;
|
|
67
73
|
}
|
|
68
|
-
export function useSortedItems(items, sortBy
|
|
69
|
-
|
|
70
|
-
const customSorters = computed(() => {
|
|
71
|
-
return columns.value.reduce((obj, item) => {
|
|
72
|
-
if (item.sort) obj[item.key] = item.sort;
|
|
73
|
-
return obj;
|
|
74
|
-
}, {});
|
|
75
|
-
});
|
|
74
|
+
export function useSortedItems(props, items, sortBy) {
|
|
75
|
+
const locale = useLocale();
|
|
76
76
|
const sortedItems = computed(() => {
|
|
77
77
|
if (!sortBy.value.length) return items.value;
|
|
78
|
-
return sortItems(items.value, sortBy.value,
|
|
78
|
+
return sortItems(items.value, sortBy.value, locale.current.value, props.customKeySort);
|
|
79
79
|
});
|
|
80
80
|
return {
|
|
81
81
|
sortedItems
|
|
@@ -89,7 +89,7 @@ export function sortItems(items, sortByItems, locale, customSorters) {
|
|
|
89
89
|
return [...items].sort((a, b) => {
|
|
90
90
|
for (let i = 0; i < sortByItems.length; i++) {
|
|
91
91
|
const sortKey = sortByItems[i].key;
|
|
92
|
-
const sortOrder = sortByItems[i].order;
|
|
92
|
+
const sortOrder = sortByItems[i].order ?? 'asc';
|
|
93
93
|
if (sortOrder === false) continue;
|
|
94
94
|
let sortA = getObjectValueByPath(a.raw, sortKey);
|
|
95
95
|
let sortB = getObjectValueByPath(b.raw, sortKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.mjs","names":["useProxiedModel","computed","inject","provide","toRef","getObjectValueByPath","propsFactory","makeDataTableSortProps","sortBy","type","Array","default","multiSort","Boolean","mustSort","VDataTableSortSymbol","Symbol","for","createSort","props","provideSort","options","page","toggleSort","
|
|
1
|
+
{"version":3,"file":"sort.mjs","names":["useProxiedModel","useLocale","computed","inject","provide","toRef","getObjectValueByPath","propsFactory","makeDataTableSortProps","sortBy","type","Array","default","customKeySort","Object","multiSort","Boolean","mustSort","VDataTableSortSymbol","Symbol","for","createSort","props","provideSort","options","page","toggleSort","column","newSortBy","value","map","x","item","find","key","order","filter","isSorted","data","useSort","Error","useSortedItems","items","locale","sortedItems","length","sortItems","current","sortByItems","customSorters","stringCollator","Intl","Collator","sensitivity","usage","sort","a","b","i","sortKey","sortOrder","sortA","raw","sortB","customResult","Date","getTime","s","toString","toLocaleLowerCase","isNaN","Number","compare"],"sources":["../../../../src/labs/VDataTable/composables/sort.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { useLocale } from '@/composables'\n\n// Utilities\nimport { computed, inject, provide, toRef } from 'vue'\nimport { getObjectValueByPath, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { DataTableCompareFunction, InternalDataTableHeader } from '../types'\n\nexport const makeDataTableSortProps = propsFactory({\n sortBy: {\n type: Array as PropType<readonly SortItem[]>,\n default: () => ([]),\n },\n customKeySort: Object as PropType<Record<string, DataTableCompareFunction>>,\n multiSort: Boolean,\n mustSort: Boolean,\n}, 'v-data-table-sort')\n\nconst VDataTableSortSymbol: InjectionKey<{\n sortBy: Ref<readonly SortItem[]>\n toggleSort: (column: InternalDataTableHeader) => void\n isSorted: (column: InternalDataTableHeader) => boolean\n}> = Symbol.for('vuetify:data-table-sort')\n\nexport type SortItem = { key: string, order?: boolean | 'asc' | 'desc' }\n\ntype SortProps = {\n sortBy: readonly SortItem[]\n 'onUpdate:sortBy': ((value: any) => void) | undefined\n mustSort: boolean\n multiSort: boolean\n}\n\nexport function createSort (props: SortProps) {\n const sortBy = useProxiedModel(props, 'sortBy')\n const mustSort = toRef(props, 'mustSort')\n const multiSort = toRef(props, 'multiSort')\n\n return { sortBy, mustSort, multiSort }\n}\n\nexport function provideSort (options: {\n sortBy: Ref<readonly SortItem[]>\n mustSort: Ref<boolean>\n multiSort: Ref<boolean>\n page?: Ref<number>\n}) {\n const { sortBy, mustSort, multiSort, page } = options\n\n const toggleSort = (column: InternalDataTableHeader) => {\n let newSortBy = sortBy.value.map(x => ({ ...x })) ?? []\n const item = newSortBy.find(x => x.key === column.key)\n\n if (!item) {\n if (multiSort.value) newSortBy = [...newSortBy, { key: column.key, order: 'asc' }]\n else newSortBy = [{ key: column.key, order: 'asc' }]\n } else if (item.order === 'desc') {\n if (mustSort.value) {\n item.order = 'asc'\n } else {\n newSortBy = newSortBy.filter(x => x.key !== column.key)\n }\n } else {\n item.order = 'desc'\n }\n\n sortBy.value = newSortBy\n if (page) page.value = 1\n }\n\n function isSorted (column: InternalDataTableHeader) {\n return !!sortBy.value.find(item => item.key === column.key)\n }\n\n const data = { sortBy, toggleSort, isSorted }\n\n provide(VDataTableSortSymbol, data)\n\n return data\n}\n\nexport function useSort () {\n const data = inject(VDataTableSortSymbol)\n\n if (!data) throw new Error('Missing sort!')\n\n return data\n}\n\nexport function useSortedItems <T extends Record<string, any>> (\n props: { customKeySort?: Record<string, DataTableCompareFunction> },\n items: Ref<T[]>,\n sortBy: Ref<readonly SortItem[]>,\n) {\n const locale = useLocale()\n const sortedItems = computed(() => {\n if (!sortBy.value.length) return items.value\n\n return sortItems(items.value, sortBy.value, locale.current.value, props.customKeySort)\n })\n\n return { sortedItems }\n}\n\nexport function sortItems<T extends Record<string, any>> (\n items: T[],\n sortByItems: readonly SortItem[],\n locale: string,\n customSorters?: Record<string, DataTableCompareFunction>\n): T[] {\n const stringCollator = new Intl.Collator(locale, { sensitivity: 'accent', usage: 'sort' })\n\n return [...items].sort((a, b) => {\n for (let i = 0; i < sortByItems.length; i++) {\n const sortKey = sortByItems[i].key\n const sortOrder = sortByItems[i].order ?? 'asc'\n\n if (sortOrder === false) continue\n\n let sortA = getObjectValueByPath(a.raw, sortKey)\n let sortB = getObjectValueByPath(b.raw, sortKey)\n\n if (sortOrder === 'desc') {\n [sortA, sortB] = [sortB, sortA]\n }\n\n if (customSorters?.[sortKey]) {\n const customResult = customSorters[sortKey](sortA, sortB)\n\n if (!customResult) continue\n\n return customResult\n }\n\n // Check if both cannot be evaluated\n if (sortA == null || sortB == null) {\n continue\n }\n\n // Dates should be compared numerically\n if (sortA instanceof Date && sortB instanceof Date) {\n return sortA.getTime() - sortB.getTime()\n }\n\n [sortA, sortB] = [sortA, sortB].map(s => (s || '').toString().toLocaleLowerCase())\n\n if (sortA !== sortB) {\n if (!isNaN(sortA) && !isNaN(sortB)) return Number(sortA) - Number(sortB)\n return stringCollator.compare(sortA, sortB)\n }\n }\n\n return 0\n })\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe;AAAA,SACfC,SAAS,0CAElB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC7CC,oBAAoB,EAAEC,YAAY,mCAE3C;AAIA,OAAO,MAAMC,sBAAsB,GAAGD,YAAY,CAAC;EACjDE,MAAM,EAAE;IACNC,IAAI,EAAEC,KAAsC;IAC5CC,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDC,aAAa,EAAEC,MAA4D;EAC3EC,SAAS,EAAEC,OAAO;EAClBC,QAAQ,EAAED;AACZ,CAAC,EAAE,mBAAmB,CAAC;AAEvB,MAAME,oBAIJ,GAAGC,MAAM,CAACC,GAAG,CAAC,yBAAyB,CAAC;AAW1C,OAAO,SAASC,UAAUA,CAAEC,KAAgB,EAAE;EAC5C,MAAMb,MAAM,GAAGT,eAAe,CAACsB,KAAK,EAAE,QAAQ,CAAC;EAC/C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E,EAAEC,QAAQ,EAAE,CAACC,iBAAiB,EAAE,CAAC;MAElF,IAAIR,KAAK,KAAKE,KAAK,EAAE;QACnB,IAAI,CAACO,KAAK,CAACT,KAAK,CAAC,IAAI,CAACS,KAAK,CAACP,KAAK,CAAC,EAAE,OAAOQ,MAAM,CAACV,KAAK,CAAC,GAAGU,MAAM,CAACR,KAAK,CAAC;QACxE,OAAOb,cAAc,CAACsB,OAAO,CAACX,KAAK,EAAEE,KAAK,CAAC;MAC7C;IACF;IAEA,OAAO,CAAC;EACV,CAAC,CAAC;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.mjs","names":["computed","ref","shallowRef","propsFactory","makeDataTableVirtualProps","visibleItems","type","String","Number","default","itemHeight","UP","DOWN","useVirtual","props","items","startIndex","parseInt","containerRef","isScrolling","calculateOffset","index","value","calculateMidPointIndex","scrollTop","start","end","length","middle","Math","floor","middleOffset","lastScrollTop","scrollTimeout","handleScroll","clearTimeout","setTimeout","direction","midPointIndex","buffer","round","max","min","stopIndex","paddingTop","paddingBottom"],"sources":["../../../../src/labs/VDataTable/composables/virtual.ts"],"sourcesContent":["// Utilities\nimport { computed, ref, shallowRef } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nexport const makeDataTableVirtualProps = propsFactory({\n visibleItems: {\n type: [String, Number],\n default: 20,\n },\n itemHeight: {\n type: [String, Number],\n default: 52,\n },\n}, 'virtual')\n\ntype VirtualProps = {\n itemHeight: string | number\n visibleItems: string | number\n}\n\nconst UP = -1\nconst DOWN = 1\n\n// TODO: Replace this with composable from v-virtual-scroll\nexport function useVirtual (props: VirtualProps, items: Ref<any[]>) {\n const startIndex = shallowRef(0)\n const itemHeight = computed(() => parseInt(props.itemHeight, 10))\n const visibleItems = computed(() => parseInt(props.visibleItems, 10))\n const containerRef = ref<HTMLDivElement>()\n const isScrolling = shallowRef(false)\n\n function calculateOffset (index: number) {\n return index * itemHeight.value\n }\n\n function calculateMidPointIndex (scrollTop: number) {\n let start = 0\n let end = items.value.length\n\n while (start <= end) {\n const middle = start + Math.floor((end - start) / 2)\n const middleOffset = calculateOffset(middle)\n\n if (middleOffset === scrollTop) {\n return middle\n } else if (middleOffset < scrollTop) {\n start = middle + 1\n } else if (middleOffset > scrollTop) {\n end = middle - 1\n }\n }\n\n return start\n }\n\n let lastScrollTop = 0\n let scrollTimeout: any\n function handleScroll () {\n if (!containerRef.value) return\n\n isScrolling.value = true\n clearTimeout(scrollTimeout)\n scrollTimeout = setTimeout(() => {\n isScrolling.value = false\n }, 100)\n\n const scrollTop = containerRef.value.scrollTop\n const direction = scrollTop < lastScrollTop ? UP : DOWN\n\n const midPointIndex = calculateMidPointIndex(scrollTop)\n\n const buffer = Math.round(visibleItems.value / 3)\n if (direction === UP && midPointIndex <= startIndex.value) {\n startIndex.value = Math.max(midPointIndex - buffer, 0)\n } else if (direction === DOWN && midPointIndex >= startIndex.value + (buffer * 2)) {\n startIndex.value = Math.min(Math.max(0, midPointIndex - buffer), items.value.length - visibleItems.value)\n }\n\n lastScrollTop = containerRef.value.scrollTop\n }\n\n const stopIndex = computed(() => Math.min(items.value.length, startIndex.value + visibleItems.value))\n const paddingTop = computed(() => calculateOffset(startIndex.value))\n const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(stopIndex.value))\n\n return {\n startIndex,\n stopIndex,\n paddingTop,\n paddingBottom,\n handleScroll,\n containerRef,\n itemHeight,\n isScrolling,\n }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,GAAG,EAAEC,UAAU,QAAQ,KAAK;AAAA,SACtCC,YAAY,mCAErB;AAGA,OAAO,MAAMC,yBAAyB,GAAGD,YAAY,CAAC;EACpDE,YAAY,EAAE;IACZC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX,CAAC;EACDC,UAAU,EAAE;IACVJ,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX;AACF,CAAC,EAAE,SAAS,CAAC;AAOb,MAAME,EAAE,GAAG,CAAC,CAAC;AACb,MAAMC,IAAI,GAAG,CAAC;;AAEd;AACA,OAAO,SAASC,UAAUA,CAAEC,KAAmB,EAAEC,
|
|
1
|
+
{"version":3,"file":"virtual.mjs","names":["computed","ref","shallowRef","propsFactory","makeDataTableVirtualProps","visibleItems","type","String","Number","default","itemHeight","UP","DOWN","useVirtual","props","items","startIndex","parseInt","containerRef","isScrolling","calculateOffset","index","value","calculateMidPointIndex","scrollTop","start","end","length","middle","Math","floor","middleOffset","lastScrollTop","scrollTimeout","handleScroll","clearTimeout","setTimeout","direction","midPointIndex","buffer","round","max","min","stopIndex","paddingTop","paddingBottom"],"sources":["../../../../src/labs/VDataTable/composables/virtual.ts"],"sourcesContent":["// Utilities\nimport { computed, ref, shallowRef } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nexport const makeDataTableVirtualProps = propsFactory({\n visibleItems: {\n type: [String, Number],\n default: 20,\n },\n itemHeight: {\n type: [String, Number],\n default: 52,\n },\n}, 'virtual')\n\ntype VirtualProps = {\n itemHeight: string | number\n visibleItems: string | number\n}\n\nconst UP = -1\nconst DOWN = 1\n\n// TODO: Replace this with composable from v-virtual-scroll\nexport function useVirtual (props: VirtualProps, items: Ref<readonly any[]>) {\n const startIndex = shallowRef(0)\n const itemHeight = computed(() => parseInt(props.itemHeight, 10))\n const visibleItems = computed(() => parseInt(props.visibleItems, 10))\n const containerRef = ref<HTMLDivElement>()\n const isScrolling = shallowRef(false)\n\n function calculateOffset (index: number) {\n return index * itemHeight.value\n }\n\n function calculateMidPointIndex (scrollTop: number) {\n let start = 0\n let end = items.value.length\n\n while (start <= end) {\n const middle = start + Math.floor((end - start) / 2)\n const middleOffset = calculateOffset(middle)\n\n if (middleOffset === scrollTop) {\n return middle\n } else if (middleOffset < scrollTop) {\n start = middle + 1\n } else if (middleOffset > scrollTop) {\n end = middle - 1\n }\n }\n\n return start\n }\n\n let lastScrollTop = 0\n let scrollTimeout: any\n function handleScroll () {\n if (!containerRef.value) return\n\n isScrolling.value = true\n clearTimeout(scrollTimeout)\n scrollTimeout = setTimeout(() => {\n isScrolling.value = false\n }, 100)\n\n const scrollTop = containerRef.value.scrollTop\n const direction = scrollTop < lastScrollTop ? UP : DOWN\n\n const midPointIndex = calculateMidPointIndex(scrollTop)\n\n const buffer = Math.round(visibleItems.value / 3)\n if (direction === UP && midPointIndex <= startIndex.value) {\n startIndex.value = Math.max(midPointIndex - buffer, 0)\n } else if (direction === DOWN && midPointIndex >= startIndex.value + (buffer * 2)) {\n startIndex.value = Math.min(Math.max(0, midPointIndex - buffer), items.value.length - visibleItems.value)\n }\n\n lastScrollTop = containerRef.value.scrollTop\n }\n\n const stopIndex = computed(() => Math.min(items.value.length, startIndex.value + visibleItems.value))\n const paddingTop = computed(() => calculateOffset(startIndex.value))\n const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(stopIndex.value))\n\n return {\n startIndex,\n stopIndex,\n paddingTop,\n paddingBottom,\n handleScroll,\n containerRef,\n itemHeight,\n isScrolling,\n }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,GAAG,EAAEC,UAAU,QAAQ,KAAK;AAAA,SACtCC,YAAY,mCAErB;AAGA,OAAO,MAAMC,yBAAyB,GAAGD,YAAY,CAAC;EACpDE,YAAY,EAAE;IACZC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX,CAAC;EACDC,UAAU,EAAE;IACVJ,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX;AACF,CAAC,EAAE,SAAS,CAAC;AAOb,MAAME,EAAE,GAAG,CAAC,CAAC;AACb,MAAMC,IAAI,GAAG,CAAC;;AAEd;AACA,OAAO,SAASC,UAAUA,CAAEC,KAAmB,EAAEC,K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