dxd-style-code 0.1.7 → 0.1.9
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/dxd-style-code.js +11974 -3725
- package/dist/dxd-style-code.umd.cjs +10 -1
- package/dist/style.css +1 -1
- package/package.json +14 -6
- package/src/components/atoms/DXAvatar/DXAvatar.stories.js +319 -0
- package/src/components/atoms/DXAvatar/DXAvatar.vue +167 -0
- package/src/components/atoms/DXAvatar/index.js +2 -0
- package/src/components/atoms/DXBackdrop/DXBackdrop.stories.js +341 -0
- package/src/components/atoms/DXBackdrop/DXBackdrop.vue +102 -0
- package/src/components/atoms/DXBackdrop/index.js +2 -0
- package/src/components/atoms/DXBadge/DXBadge.stories.js +239 -0
- package/src/components/atoms/DXBadge/DXBadge.vue +45 -0
- package/src/components/atoms/DXBadge/index.js +2 -0
- package/src/components/atoms/DXButton/DXButton.stories.js +178 -0
- package/src/components/atoms/DXButton/DXButton.vue +84 -0
- package/src/components/atoms/DXButton/index.js +2 -0
- package/src/components/atoms/DXCard/DXCard.stories.js +133 -0
- package/src/components/atoms/DXCard/DXCard.vue +46 -0
- package/src/components/atoms/DXCard/index.js +2 -0
- package/src/components/atoms/DXCheckbox/DXCheckbox.stories.js +294 -0
- package/src/components/atoms/DXCheckbox/DXCheckbox.vue +191 -0
- package/src/components/atoms/DXCheckbox/index.js +2 -0
- package/src/components/atoms/DXDivider/DXDivider.stories.js +135 -0
- package/src/components/atoms/DXDivider/DXDivider.vue +74 -0
- package/src/components/atoms/DXDivider/index.js +2 -0
- package/src/components/atoms/DXDropdownItem/DXDropdownItem.vue +116 -0
- package/src/components/atoms/DXDropdownItem/index.js +2 -0
- package/src/components/atoms/DXFormLabel/DXFormLabel.stories.js +194 -0
- package/src/components/atoms/DXFormLabel/DXFormLabel.vue +94 -0
- package/src/components/atoms/DXFormLabel/index.js +2 -0
- package/src/components/atoms/DXIcon/DXIcon.stories.js +156 -0
- package/src/components/atoms/DXIcon/DXIcon.vue +102 -0
- package/src/components/atoms/DXIcon/index.js +3 -0
- package/src/components/atoms/DXIconWrapper/DXIconWrapper.stories.js +237 -0
- package/src/components/atoms/DXIconWrapper/DXIconWrapper.vue +79 -0
- package/src/components/atoms/DXIconWrapper/index.js +2 -0
- package/src/components/atoms/DXInputAddon/DXInputAddon.stories.js +230 -0
- package/src/components/atoms/DXInputAddon/DXInputAddon.vue +64 -0
- package/src/components/atoms/DXInputAddon/index.js +2 -0
- package/src/components/atoms/DXLink/DXLink.stories.js +475 -0
- package/src/components/atoms/DXLink/DXLink.vue +229 -0
- package/src/components/atoms/DXLink/index.js +2 -0
- package/src/components/atoms/DXLoader/DXLoader.stories.js +280 -0
- package/src/components/atoms/DXLoader/DXLoader.vue +78 -0
- package/src/components/atoms/DXLoader/index.js +2 -0
- package/src/components/atoms/DXProgress/DXProgress.stories.js +312 -0
- package/src/components/atoms/DXProgress/DXProgress.vue +85 -0
- package/src/components/atoms/DXProgress/index.js +2 -0
- package/src/components/atoms/DXQuote/DXQuote.stories.js +255 -0
- package/src/components/atoms/DXQuote/DXQuote.vue +97 -0
- package/src/components/atoms/DXQuote/index.js +2 -0
- package/src/components/atoms/DXRadio/DXRadio.stories.js +277 -0
- package/src/components/atoms/DXRadio/DXRadio.vue +144 -0
- package/src/components/atoms/DXRadio/index.js +2 -0
- package/src/components/atoms/DXSkeleton/DXSkeleton.stories.js +50 -0
- package/src/components/atoms/DXSkeleton/DXSkeleton.vue +19 -0
- package/src/components/atoms/DXSkeleton/index.js +2 -0
- package/src/components/atoms/DXSlider/DXSlider.stories.js +522 -0
- package/src/components/atoms/DXSlider/DXSlider.vue +338 -0
- package/src/components/atoms/DXSlider/index.js +2 -0
- package/src/components/atoms/DXTags/DXTags.stories.js +206 -0
- package/src/components/atoms/DXTags/DXTags.vue +111 -0
- package/src/components/atoms/DXTags/index.js +2 -0
- package/src/components/atoms/DXToast/DXToast.stories.js +40 -0
- package/src/components/atoms/DXToast/DXToast.vue +32 -0
- package/src/components/atoms/DXToast/index.js +2 -0
- package/src/components/atoms/DXToggle/DXToggle.stories.js +143 -0
- package/src/components/atoms/DXToggle/DXToggle.vue +142 -0
- package/src/components/atoms/DXToggle/index.js +2 -0
- package/src/components/atoms/DXToggleButton/DXToggleButton.stories.js +513 -0
- package/src/components/atoms/DXToggleButton/DXToggleButton.vue +140 -0
- package/src/components/atoms/DXToggleButton/index.js +2 -0
- package/src/components/atoms/DXTooltip/DXTooltip.stories.js +243 -0
- package/src/components/atoms/DXTooltip/DXTooltip.vue +151 -0
- package/src/components/atoms/DXTooltip/index.js +2 -0
- package/src/components/atoms/index.js +24 -0
- package/src/components/index.js +20 -0
- package/src/components/layout/DXBox/DXBox.stories.js +238 -0
- package/src/components/layout/DXBox/DXBox.vue +198 -0
- package/src/components/layout/DXBox/index.js +2 -0
- package/src/components/layout/DXContainer/DXContainer.stories.js +147 -0
- package/src/components/layout/DXContainer/DXContainer.vue +83 -0
- package/src/components/layout/DXContainer/index.js +2 -0
- package/src/components/layout/DXFlex/DXFlex.stories.js +210 -0
- package/src/components/layout/DXFlex/DXFlex.vue +149 -0
- package/src/components/layout/DXFlex/index.js +2 -0
- package/src/components/layout/DXGrid/DXGrid.stories.js +238 -0
- package/src/components/layout/DXGrid/DXGrid.vue +167 -0
- package/src/components/layout/DXGrid/index.js +2 -0
- package/src/components/layout/DXSpacer/DXSpacer.stories.js +187 -0
- package/src/components/layout/DXSpacer/DXSpacer.vue +102 -0
- package/src/components/layout/DXSpacer/index.js +2 -0
- package/src/components/layout/DXStack/DXStack.stories.js +199 -0
- package/src/components/layout/DXStack/DXStack.vue +140 -0
- package/src/components/layout/DXStack/index.js +2 -0
- package/src/components/layout/index.js +8 -0
- package/src/components/molecules/DXActionButtons/DXActionButtons.stories.js +288 -0
- package/src/components/molecules/DXActionButtons/DXActionButtons.vue +106 -0
- package/src/components/molecules/DXActionButtons/index.js +2 -0
- package/src/components/molecules/DXAlert/DXAlert.stories.js +70 -0
- package/src/components/molecules/DXAlert/DXAlert.vue +116 -0
- package/src/components/molecules/DXAlert/index.js +2 -0
- package/src/components/molecules/DXBaseTable/DXBaseTable.stories.js +433 -0
- package/src/components/molecules/DXBaseTable/DXBaseTable.vue +459 -0
- package/src/components/molecules/DXBaseTable/index.js +4 -0
- package/src/components/molecules/DXBreadcrumb/DXBreadcrumb.stories.js +227 -0
- package/src/components/molecules/DXBreadcrumb/DXBreadcrumb.vue +96 -0
- package/src/components/molecules/DXBreadcrumb/index.js +2 -0
- package/src/components/molecules/DXButtonGroup/DXButtonGroup.stories.js +26 -0
- package/src/components/molecules/DXButtonGroup/DXButtonGroup.vue +78 -0
- package/src/components/molecules/DXButtonGroup/index.js +2 -0
- package/src/components/molecules/DXCloseButton/DXCloseButton.stories.js +53 -0
- package/src/components/molecules/DXCloseButton/DXCloseButton.vue +62 -0
- package/src/components/molecules/DXCloseButton/index.js +3 -0
- package/src/components/molecules/DXComboBox/DXComboBox.stories.js +62 -0
- package/src/components/molecules/DXComboBox/DXComboBox.vue +167 -0
- package/src/components/molecules/DXComboBox/index.js +2 -0
- package/src/components/molecules/DXCopyField/DXCopyField.stories.js +231 -0
- package/src/components/molecules/DXCopyField/DXCopyField.vue +75 -0
- package/src/components/molecules/DXCopyField/index.js +2 -0
- package/src/components/molecules/DXDataFilter/DXDataFilter.stories.js +275 -0
- package/src/components/molecules/DXDataFilter/DXDataFilter.vue +385 -0
- package/src/components/molecules/DXDataFilter/index.js +2 -0
- package/src/components/molecules/DXDatePicker/DXDatePicker.stories.js +42 -0
- package/src/components/molecules/DXDatePicker/DXDatePicker.vue +121 -0
- package/src/components/molecules/DXDatePicker/index.js +2 -0
- package/src/components/molecules/DXDropdownDivider/DXDropdownDivider.vue +30 -0
- package/src/components/molecules/DXDropdownDivider/index.js +2 -0
- package/src/components/molecules/DXFileUpload/DXFileUpload.stories.js +53 -0
- package/src/components/molecules/DXFileUpload/DXFileUpload.vue +199 -0
- package/src/components/molecules/DXFileUpload/index.js +2 -0
- package/src/components/molecules/DXFilterGroup/DXFilterGroup.stories.js +43 -0
- package/src/components/molecules/DXFilterGroup/DXFilterGroup.vue +43 -0
- package/src/components/molecules/DXFilterGroup/index.js +2 -0
- package/src/components/molecules/DXFormControl/DXFormControl.stories.js +69 -0
- package/src/components/molecules/DXFormControl/DXFormControl.vue +72 -0
- package/src/components/molecules/DXFormControl/index.js +2 -0
- package/src/components/molecules/DXInput/DXInput.stories.js +291 -0
- package/src/components/molecules/DXInput/DXInput.vue +156 -0
- package/src/components/molecules/DXInput/index.js +3 -0
- package/src/components/molecules/DXInputGroup/DXInputGroup.stories.js +228 -0
- package/src/components/molecules/DXInputGroup/DXInputGroup.vue +64 -0
- package/src/components/molecules/DXInputGroup/index.js +2 -0
- package/src/components/molecules/DXInputMask/DXInputMask.stories.js +53 -0
- package/src/components/molecules/DXInputMask/DXInputMask.vue +89 -0
- package/src/components/molecules/DXInputMask/index.js +2 -0
- package/src/components/molecules/DXMenu/DXMenu.stories.js +379 -0
- package/src/components/molecules/DXMenu/DXMenu.vue +331 -0
- package/src/components/molecules/DXMenu/README.md +479 -0
- package/src/components/molecules/DXMenu/index.js +2 -0
- package/src/components/molecules/DXPagination/DXPagination.stories.js +62 -0
- package/src/components/molecules/DXPagination/DXPagination.vue +123 -0
- package/src/components/molecules/DXPagination/index.js +2 -0
- package/src/components/molecules/DXPasswordInput/DXPasswordInput.stories.js +42 -0
- package/src/components/molecules/DXPasswordInput/DXPasswordInput.vue +74 -0
- package/src/components/molecules/DXPasswordInput/index.js +2 -0
- package/src/components/molecules/DXRadioCard/DXRadioCard.stories.js +60 -0
- package/src/components/molecules/DXRadioCard/DXRadioCard.vue +71 -0
- package/src/components/molecules/DXRadioCard/index.js +2 -0
- package/src/components/molecules/DXRadioGroup/DXRadioGroup.stories.js +297 -0
- package/src/components/molecules/DXRadioGroup/DXRadioGroup.vue +73 -0
- package/src/components/molecules/DXRadioGroup/index.js +2 -0
- package/src/components/molecules/DXRating/DXRating.stories.js +322 -0
- package/src/components/molecules/DXRating/DXRating.vue +402 -0
- package/src/components/molecules/DXRating/index.js +2 -0
- package/src/components/molecules/DXSearchBar/DXSearchBar.stories.js +357 -0
- package/src/components/molecules/DXSearchBar/DXSearchBar.vue +525 -0
- package/src/components/molecules/DXSearchBar/index.js +2 -0
- package/src/components/molecules/DXSearchSelect/DXSearchSelect.stories.js +50 -0
- package/src/components/molecules/DXSearchSelect/DXSearchSelect.vue +207 -0
- package/src/components/molecules/DXSearchSelect/index.js +2 -0
- package/src/components/molecules/DXSegmentedControl/DXSegmentedControl.stories.js +326 -0
- package/src/components/molecules/DXSegmentedControl/DXSegmentedControl.vue +116 -0
- package/src/components/molecules/DXSegmentedControl/index.js +2 -0
- package/src/components/molecules/DXSelect/DXSelect.stories.js +259 -0
- package/src/components/molecules/DXSelect/DXSelect.vue +149 -0
- package/src/components/molecules/DXSelect/index.js +3 -0
- package/src/components/molecules/DXStatCard/DXStatCard.stories.js +335 -0
- package/src/components/molecules/DXStatCard/DXStatCard.vue +309 -0
- package/src/components/molecules/DXStatCard/index.js +2 -0
- package/src/components/molecules/DXTableFiltersPanel/DXTableFiltersPanel.vue +72 -0
- package/src/components/molecules/DXTableFiltersPanel/index.js +7 -0
- package/src/components/molecules/DXTablePagination/DXTablePagination.stories.js +236 -0
- package/src/components/molecules/DXTablePagination/DXTablePagination.vue +93 -0
- package/src/components/molecules/DXTablePagination/index.js +2 -0
- package/src/components/molecules/DXTableToolbar/DXTableToolbar.stories.js +271 -0
- package/src/components/molecules/DXTableToolbar/DXTableToolbar.vue +102 -0
- package/src/components/molecules/DXTableToolbar/index.js +2 -0
- package/src/components/molecules/DXTextarea/DXTextarea.stories.js +239 -0
- package/src/components/molecules/DXTextarea/DXTextarea.vue +158 -0
- package/src/components/molecules/DXTextarea/index.js +3 -0
- package/src/components/molecules/DXTimePicker/DXTimePicker.stories.js +282 -0
- package/src/components/molecules/DXTimePicker/DXTimePicker.vue +640 -0
- package/src/components/molecules/DXTimePicker/index.js +2 -0
- package/src/components/molecules/DXValidationIcon/DXValidationIcon.stories.js +60 -0
- package/src/components/molecules/DXValidationIcon/DXValidationIcon.vue +53 -0
- package/src/components/molecules/DXValidationIcon/index.js +3 -0
- package/src/components/molecules/index.js +34 -0
- package/src/components/organisms/DXAccordion/DXAccordion.stories.js +33 -0
- package/src/components/organisms/DXAccordion/DXAccordion.vue +104 -0
- package/src/components/organisms/DXAccordion/index.js +2 -0
- package/src/components/organisms/DXAppLayout/DXAppLayout.stories.js +689 -0
- package/src/components/organisms/DXAppLayout/DXAppLayout.vue +460 -0
- package/src/components/organisms/DXAppLayout/index.js +2 -0
- package/src/components/organisms/DXAuthenticationForm/DXAuthenticationForm.stories.js +232 -0
- package/src/components/organisms/DXAuthenticationForm/DXAuthenticationForm.vue +458 -0
- package/src/components/organisms/DXAuthenticationForm/index.js +2 -0
- package/src/components/organisms/DXChartContainer/DXChartContainer.stories.js +286 -0
- package/src/components/organisms/DXChartContainer/DXChartContainer.vue +273 -0
- package/src/components/organisms/DXChartContainer/index.js +2 -0
- package/src/components/organisms/DXChatInterface/DXChatInterface.stories.js +164 -0
- package/src/components/organisms/DXChatInterface/DXChatInterface.vue +583 -0
- package/src/components/organisms/DXChatInterface/index.js +2 -0
- package/src/components/organisms/DXCommentSection/DXCommentSection.stories.js +173 -0
- package/src/components/organisms/DXCommentSection/DXCommentSection.vue +487 -0
- package/src/components/organisms/DXCommentSection/index.js +2 -0
- package/src/components/organisms/DXDashboardGrid/DXDashboardGrid.stories.js +331 -0
- package/src/components/organisms/DXDashboardGrid/DXDashboardGrid.vue +309 -0
- package/src/components/organisms/DXDashboardGrid/index.js +2 -0
- package/src/components/organisms/DXDashboardWidget/DXDashboardWidget.stories.js +271 -0
- package/src/components/organisms/DXDashboardWidget/DXDashboardWidget.vue +260 -0
- package/src/components/organisms/DXDashboardWidget/index.js +2 -0
- package/src/components/organisms/DXDataTable/DXDataTable.stories.js +247 -0
- package/src/components/organisms/DXDataTable/DXDataTable.vue +496 -0
- package/src/components/organisms/DXDataTable/index.js +2 -0
- package/src/components/organisms/DXDropdown/DXDropdown.stories.js +795 -0
- package/src/components/organisms/DXDropdown/DXDropdown.vue +238 -0
- package/src/components/organisms/DXDropdown/index.js +2 -0
- package/src/components/organisms/DXEmptyState/DXEmptyState.stories.js +37 -0
- package/src/components/organisms/DXEmptyState/DXEmptyState.vue +41 -0
- package/src/components/organisms/DXEmptyState/index.js +2 -0
- package/src/components/organisms/DXFormWizard/DXFormWizard.stories.js +378 -0
- package/src/components/organisms/DXFormWizard/DXFormWizard.vue +578 -0
- package/src/components/organisms/DXFormWizard/index.js +2 -0
- package/src/components/organisms/DXHeaderBar/DXHeaderBar.stories.js +448 -0
- package/src/components/organisms/DXHeaderBar/DXHeaderBar.vue +190 -0
- package/src/components/organisms/DXHeaderBar/index.js +2 -0
- package/src/components/organisms/DXMediaGallery/DXMediaGallery.stories.js +347 -0
- package/src/components/organisms/DXMediaGallery/DXMediaGallery.vue +422 -0
- package/src/components/organisms/DXMediaGallery/index.js +2 -0
- package/src/components/organisms/DXModal/DXModal.stories.js +138 -0
- package/src/components/organisms/DXModal/DXModal.vue +213 -0
- package/src/components/organisms/DXModal/index.js +2 -0
- package/src/components/organisms/DXNotificationCenter/DXNotificationCenter.stories.js +183 -0
- package/src/components/organisms/DXNotificationCenter/DXNotificationCenter.vue +566 -0
- package/src/components/organisms/DXNotificationCenter/index.js +2 -0
- package/src/components/organisms/DXReportGenerator/DXReportGenerator.stories.js +199 -0
- package/src/components/organisms/DXReportGenerator/DXReportGenerator.vue +344 -0
- package/src/components/organisms/DXReportGenerator/index.js +2 -0
- package/src/components/organisms/DXSettingsPanel/DXSettingsPanel.stories.js +245 -0
- package/src/components/organisms/DXSettingsPanel/DXSettingsPanel.vue +454 -0
- package/src/components/organisms/DXSettingsPanel/index.js +2 -0
- package/src/components/organisms/DXSidebar/DXSidebar.stories.js +316 -0
- package/src/components/organisms/DXSidebar/DXSidebar.vue +212 -0
- package/src/components/organisms/DXSidebar/index.js +2 -0
- package/src/components/organisms/DXSidebarMenu/DATA_STRUCTURE.md +299 -0
- package/src/components/organisms/DXSidebarMenu/DXSidebarMenu.stories.js +729 -0
- package/src/components/organisms/DXSidebarMenu/DXSidebarMenu.vue +257 -0
- package/src/components/organisms/DXSidebarMenu/DXSidebarMenuItem.vue +249 -0
- package/src/components/organisms/DXSidebarMenu/README.md +333 -0
- package/src/components/organisms/DXSidebarMenu/index.js +3 -0
- package/src/components/organisms/DXTable/DXTable.stories.js +550 -0
- package/src/components/organisms/DXTable/DXTable.vue +324 -0
- package/src/components/organisms/DXTable/index.js +2 -0
- package/src/components/organisms/DXTabs/DXTabs.stories.js +407 -0
- package/src/components/organisms/DXTabs/DXTabs.vue +301 -0
- package/src/components/organisms/DXTabs/index.js +2 -0
- package/src/components/organisms/DXUserProfileCard/DXUserProfileCard.stories.js +194 -0
- package/src/components/organisms/DXUserProfileCard/DXUserProfileCard.vue +403 -0
- package/src/components/organisms/DXUserProfileCard/index.js +2 -0
- package/src/components/organisms/DXWizard/DXWizard.stories.js +212 -0
- package/src/components/organisms/DXWizard/DXWizard.vue +615 -0
- package/src/components/organisms/DXWizard/index.js +2 -0
- package/src/components/organisms/index.js +25 -0
- package/src/components/typography/DXBlockquote/DXBlockquote.stories.js +33 -0
- package/src/components/typography/DXBlockquote/DXBlockquote.vue +44 -0
- package/src/components/typography/DXBlockquote/index.js +2 -0
- package/src/components/typography/DXCode/DXCode.stories.js +29 -0
- package/src/components/typography/DXCode/DXCode.vue +46 -0
- package/src/components/typography/DXCode/index.js +2 -0
- package/src/components/typography/DXHeading/DXHeading.stories.js +54 -0
- package/src/components/typography/DXHeading/DXHeading.vue +68 -0
- package/src/components/typography/DXHeading/index.js +2 -0
- package/src/components/typography/DXLabel/DXLabel.stories.js +40 -0
- package/src/components/typography/DXLabel/DXLabel.vue +49 -0
- package/src/components/typography/DXLabel/index.js +2 -0
- package/src/components/typography/DXList/DXList.stories.js +50 -0
- package/src/components/typography/DXList/DXList.vue +55 -0
- package/src/components/typography/DXList/index.js +2 -0
- package/src/components/typography/DXText/DXText.stories.js +47 -0
- package/src/components/typography/DXText/DXText.vue +67 -0
- package/src/components/typography/DXText/index.js +2 -0
- package/src/components/typography/index.js +8 -0
- package/src/components/utilities/DXAnimatePresence/DXAnimatePresence.stories.js +335 -0
- package/src/components/utilities/DXAnimatePresence/DXAnimatePresence.vue +207 -0
- package/src/components/utilities/DXAnimatePresence/index.js +2 -0
- package/src/components/utilities/DXBreakpointProvider/DXBreakpointProvider.stories.js +321 -0
- package/src/components/utilities/DXBreakpointProvider/DXBreakpointProvider.vue +158 -0
- package/src/components/utilities/DXBreakpointProvider/index.js +2 -0
- package/src/components/utilities/DXObserver/DXObserver.stories.js +324 -0
- package/src/components/utilities/DXObserver/DXObserver.vue +182 -0
- package/src/components/utilities/DXObserver/index.js +2 -0
- package/src/components/utilities/DXPortal/DXPortal.stories.js +267 -0
- package/src/components/utilities/DXPortal/DXPortal.vue +69 -0
- package/src/components/utilities/DXPortal/index.js +2 -0
- package/src/components/utilities/DXStaggeredAnimation/DXStaggeredAnimation.stories.js +339 -0
- package/src/components/utilities/DXStaggeredAnimation/DXStaggeredAnimation.vue +155 -0
- package/src/components/utilities/DXStaggeredAnimation/index.js +2 -0
- package/src/components/utilities/DXThemeProvider/DXThemeProvider.stories.js +327 -0
- package/src/components/utilities/DXThemeProvider/DXThemeProvider.vue +227 -0
- package/src/components/utilities/DXThemeProvider/index.js +2 -0
- package/src/components/utilities/DXTransitionGroup/DXTransitionGroup.stories.js +368 -0
- package/src/components/utilities/DXTransitionGroup/DXTransitionGroup.vue +212 -0
- package/src/components/utilities/DXTransitionGroup/index.js +2 -0
- package/src/components/utilities/index.js +9 -0
- package/src/composables/useAnimation.js +264 -0
- package/src/composables/useClassComposition.js +35 -0
- package/src/composables/useDataAttributes.js +83 -0
- package/src/composables/useMenu.js +88 -0
- package/src/composables/useSize.js +135 -0
- package/src/composables/useSpacing.js +37 -0
- package/src/composables/useTableColumns.js +88 -0
- package/src/composables/useTableData.js +82 -0
- package/src/composables/useTableFilter.js +158 -0
- package/src/composables/useTablePagination.js +89 -0
- package/src/composables/useTableSelection.js +77 -0
- package/src/composables/useTableSort.js +75 -0
- package/src/composables/useTabsScroll.js +88 -0
- package/src/composables/useVariant.js +700 -0
- package/src/index.js +86 -0
- package/src/styles/animations.css +171 -0
- package/src/styles/index.css +99 -0
- package/src/styles/tokens.js +123 -0
- package/src/utils/propTypes.js +77 -0
- package/src/utils/toggleButtonPresets.js +115 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import DXDashboardGrid from './DXDashboardGrid.vue';
|
|
3
|
+
import DXStatCard from '../../molecules/DXStatCard/DXStatCard.vue';
|
|
4
|
+
import DXCard from '../../atoms/DXCard/DXCard.vue';
|
|
5
|
+
import DXButton from '../../atoms/DXButton/DXButton.vue';
|
|
6
|
+
import { UserGroupIcon, ChartBarIcon, CurrencyDollarIcon } from '@heroicons/vue/24/outline';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Organisms/DXDashboardGrid',
|
|
10
|
+
component: DXDashboardGrid,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component: `
|
|
16
|
+
# DXDashboardGrid
|
|
17
|
+
|
|
18
|
+
Сетка для дашборда с поддержкой drag-and-drop для перестановки виджетов.
|
|
19
|
+
|
|
20
|
+
## Назначение
|
|
21
|
+
|
|
22
|
+
DXDashboardGrid предоставляет настраиваемую сетку для создания дашбордов с виджетами.
|
|
23
|
+
Поддерживает перестановку виджетов через drag-and-drop и изменение их размеров.
|
|
24
|
+
|
|
25
|
+
## Архитектура
|
|
26
|
+
|
|
27
|
+
### Использует
|
|
28
|
+
- \`vue-draggable-next\` - для drag-and-drop функциональности
|
|
29
|
+
- \`DXStatCard\` - для карточек статистики (через slot)
|
|
30
|
+
- \`useClassComposition\` composable - для стилей
|
|
31
|
+
- \`useSpacing\` composable - для отступов
|
|
32
|
+
|
|
33
|
+
### Используется в
|
|
34
|
+
- Настраиваемые дашборды
|
|
35
|
+
- Панели мониторинга
|
|
36
|
+
- Аналитические панели
|
|
37
|
+
|
|
38
|
+
## Внутренняя логика
|
|
39
|
+
|
|
40
|
+
### Grid Layout
|
|
41
|
+
Использует CSS Grid для размещения виджетов. Каждый виджет занимает определенное
|
|
42
|
+
количество колонок (w) и строк (h).
|
|
43
|
+
|
|
44
|
+
### Drag-and-Drop
|
|
45
|
+
Виджеты можно перетаскивать за handle (иконка в правом верхнем углу).
|
|
46
|
+
При перетаскивании вычисляется новая позиция виджета.
|
|
47
|
+
|
|
48
|
+
### Размеры виджетов
|
|
49
|
+
Каждый виджет имеет свойства w (ширина в колонках) и h (высота в строках).
|
|
50
|
+
|
|
51
|
+
## Особенности
|
|
52
|
+
|
|
53
|
+
### Редактируемый режим
|
|
54
|
+
При \`editable={false}\` drag-and-drop отключается, виджеты становятся статичными.
|
|
55
|
+
|
|
56
|
+
### Кастомные виджеты
|
|
57
|
+
Используйте slot \`widget\` для кастомного отображения виджетов.
|
|
58
|
+
|
|
59
|
+
### События
|
|
60
|
+
Компонент эмитит события при перемещении, добавлении и удалении виджетов.
|
|
61
|
+
`,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
argTypes: {
|
|
66
|
+
columns: {
|
|
67
|
+
control: 'number',
|
|
68
|
+
min: 1,
|
|
69
|
+
max: 12,
|
|
70
|
+
description: 'Количество колонок в сетке.',
|
|
71
|
+
table: {
|
|
72
|
+
type: { summary: 'number' },
|
|
73
|
+
defaultValue: { summary: '12' },
|
|
74
|
+
category: 'Layout',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
rowHeight: {
|
|
78
|
+
control: 'number',
|
|
79
|
+
min: 50,
|
|
80
|
+
max: 200,
|
|
81
|
+
step: 10,
|
|
82
|
+
description: 'Высота строки в пикселях.',
|
|
83
|
+
table: {
|
|
84
|
+
type: { summary: 'number' },
|
|
85
|
+
defaultValue: { summary: '100' },
|
|
86
|
+
category: 'Layout',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
editable: {
|
|
90
|
+
control: 'boolean',
|
|
91
|
+
description: 'Редактируемый режим (drag-and-drop включен).',
|
|
92
|
+
table: {
|
|
93
|
+
type: { summary: 'boolean' },
|
|
94
|
+
defaultValue: { summary: 'true' },
|
|
95
|
+
category: 'Behavior',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const defaultWidgets = [
|
|
102
|
+
{
|
|
103
|
+
id: 1,
|
|
104
|
+
w: 4,
|
|
105
|
+
h: 2,
|
|
106
|
+
type: 'stat',
|
|
107
|
+
title: 'Пользователи',
|
|
108
|
+
config: { title: 'Всего', value: 1250, icon: UserGroupIcon },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 2,
|
|
112
|
+
w: 4,
|
|
113
|
+
h: 2,
|
|
114
|
+
type: 'stat',
|
|
115
|
+
title: 'Продажи',
|
|
116
|
+
config: { title: 'Сегодня', value: 45230, icon: ChartBarIcon },
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 3,
|
|
120
|
+
w: 4,
|
|
121
|
+
h: 2,
|
|
122
|
+
type: 'stat',
|
|
123
|
+
title: 'Доход',
|
|
124
|
+
config: { title: 'За месяц', value: 125000, icon: CurrencyDollarIcon },
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 4,
|
|
128
|
+
w: 6,
|
|
129
|
+
h: 3,
|
|
130
|
+
type: 'chart',
|
|
131
|
+
title: 'График продаж',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 5,
|
|
135
|
+
w: 6,
|
|
136
|
+
h: 3,
|
|
137
|
+
type: 'table',
|
|
138
|
+
title: 'Последние заказы',
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
export const Default = {
|
|
143
|
+
args: {
|
|
144
|
+
columns: 12,
|
|
145
|
+
rowHeight: 100,
|
|
146
|
+
editable: true,
|
|
147
|
+
},
|
|
148
|
+
parameters: {
|
|
149
|
+
docs: {
|
|
150
|
+
description: {
|
|
151
|
+
story: 'Базовый дашборд с виджетами. Перетаскивайте виджеты за иконку в правом верхнем углу.',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
render: (args) => ({
|
|
156
|
+
components: { DXDashboardGrid, DXStatCard, DXCard },
|
|
157
|
+
setup() {
|
|
158
|
+
const widgets = ref([...defaultWidgets]);
|
|
159
|
+
return { args, widgets };
|
|
160
|
+
},
|
|
161
|
+
template: `
|
|
162
|
+
<DXDashboardGrid v-bind="args" v-model:widgets="widgets">
|
|
163
|
+
<template #widget="{ widget }">
|
|
164
|
+
<DXCard v-if="widget.type === 'stat'" class="h-full">
|
|
165
|
+
<DXStatCard
|
|
166
|
+
:title="widget.config.title"
|
|
167
|
+
:value="widget.config.value"
|
|
168
|
+
:icon="widget.config.icon"
|
|
169
|
+
/>
|
|
170
|
+
</DXCard>
|
|
171
|
+
<DXCard v-else class="h-full p-4">
|
|
172
|
+
<h3 class="font-semibold mb-2">{{ widget.title }}</h3>
|
|
173
|
+
<p class="text-sm text-slate-600">Контент виджета {{ widget.type }}</p>
|
|
174
|
+
</DXCard>
|
|
175
|
+
</template>
|
|
176
|
+
</DXDashboardGrid>
|
|
177
|
+
`,
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const WithStatCards = {
|
|
182
|
+
parameters: {
|
|
183
|
+
docs: {
|
|
184
|
+
description: {
|
|
185
|
+
story: 'Дашборд с карточками статистики. Использует DXStatCard для отображения метрик.',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
render: () => ({
|
|
190
|
+
components: { DXDashboardGrid, DXStatCard, DXCard },
|
|
191
|
+
setup() {
|
|
192
|
+
const widgets = ref([
|
|
193
|
+
{
|
|
194
|
+
id: 1,
|
|
195
|
+
w: 3,
|
|
196
|
+
h: 2,
|
|
197
|
+
type: 'stat',
|
|
198
|
+
config: {
|
|
199
|
+
title: 'Всего пользователей',
|
|
200
|
+
value: 1250,
|
|
201
|
+
icon: UserGroupIcon,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: 2,
|
|
206
|
+
w: 3,
|
|
207
|
+
h: 2,
|
|
208
|
+
type: 'stat',
|
|
209
|
+
config: {
|
|
210
|
+
title: 'Продажи',
|
|
211
|
+
value: 45230,
|
|
212
|
+
valueFormat: 'currency',
|
|
213
|
+
currency: 'USD',
|
|
214
|
+
trend: { value: 12.5, direction: 'up' },
|
|
215
|
+
icon: ChartBarIcon,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: 3,
|
|
220
|
+
w: 3,
|
|
221
|
+
h: 2,
|
|
222
|
+
type: 'stat',
|
|
223
|
+
config: {
|
|
224
|
+
title: 'Конверсия',
|
|
225
|
+
value: 24.5,
|
|
226
|
+
valueFormat: 'percentage',
|
|
227
|
+
trend: { value: 3.2, direction: 'up' },
|
|
228
|
+
icon: CurrencyDollarIcon,
|
|
229
|
+
color: 'success',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: 4,
|
|
234
|
+
w: 3,
|
|
235
|
+
h: 2,
|
|
236
|
+
type: 'stat',
|
|
237
|
+
config: {
|
|
238
|
+
title: 'Новые заказы',
|
|
239
|
+
value: 89,
|
|
240
|
+
icon: UserGroupIcon,
|
|
241
|
+
color: 'primary',
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
]);
|
|
245
|
+
return { widgets };
|
|
246
|
+
},
|
|
247
|
+
template: `
|
|
248
|
+
<DXDashboardGrid :widgets="widgets" :columns="12" :row-height="120">
|
|
249
|
+
<template #widget="{ widget }">
|
|
250
|
+
<DXCard class="h-full">
|
|
251
|
+
<DXStatCard
|
|
252
|
+
:title="widget.config.title"
|
|
253
|
+
:value="widget.config.value"
|
|
254
|
+
:value-format="widget.config.valueFormat"
|
|
255
|
+
:currency="widget.config.currency"
|
|
256
|
+
:trend="widget.config.trend"
|
|
257
|
+
:icon="widget.config.icon"
|
|
258
|
+
:color="widget.config.color"
|
|
259
|
+
/>
|
|
260
|
+
</DXCard>
|
|
261
|
+
</template>
|
|
262
|
+
</DXDashboardGrid>
|
|
263
|
+
`,
|
|
264
|
+
}),
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export const ReadOnly = {
|
|
268
|
+
args: {
|
|
269
|
+
columns: 12,
|
|
270
|
+
rowHeight: 100,
|
|
271
|
+
editable: false,
|
|
272
|
+
},
|
|
273
|
+
parameters: {
|
|
274
|
+
docs: {
|
|
275
|
+
description: {
|
|
276
|
+
story: 'Дашборд в режиме только для чтения. Drag-and-drop отключен.',
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
render: (args) => ({
|
|
281
|
+
components: { DXDashboardGrid, DXCard },
|
|
282
|
+
setup() {
|
|
283
|
+
const widgets = ref([...defaultWidgets]);
|
|
284
|
+
return { args, widgets };
|
|
285
|
+
},
|
|
286
|
+
template: `
|
|
287
|
+
<DXDashboardGrid v-bind="args" v-model:widgets="widgets">
|
|
288
|
+
<template #widget="{ widget }">
|
|
289
|
+
<DXCard class="h-full p-4">
|
|
290
|
+
<h3 class="font-semibold mb-2">{{ widget.title }}</h3>
|
|
291
|
+
<p class="text-sm text-slate-600">Виджет {{ widget.type }}</p>
|
|
292
|
+
</DXCard>
|
|
293
|
+
</template>
|
|
294
|
+
</DXDashboardGrid>
|
|
295
|
+
`,
|
|
296
|
+
}),
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const CustomSizes = {
|
|
300
|
+
parameters: {
|
|
301
|
+
docs: {
|
|
302
|
+
description: {
|
|
303
|
+
story: 'Дашборд с различными размерами виджетов. Виджеты имеют разные значения w и h.',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
render: () => ({
|
|
308
|
+
components: { DXDashboardGrid, DXCard },
|
|
309
|
+
setup() {
|
|
310
|
+
const widgets = ref([
|
|
311
|
+
{ id: 1, w: 6, h: 2, title: 'Большой виджет 1' },
|
|
312
|
+
{ id: 2, w: 3, h: 2, title: 'Маленький виджет 1' },
|
|
313
|
+
{ id: 3, w: 3, h: 2, title: 'Маленький виджет 2' },
|
|
314
|
+
{ id: 4, w: 4, h: 4, title: 'Высокий виджет' },
|
|
315
|
+
{ id: 5, w: 8, h: 2, title: 'Широкий виджет' },
|
|
316
|
+
]);
|
|
317
|
+
return { widgets };
|
|
318
|
+
},
|
|
319
|
+
template: `
|
|
320
|
+
<DXDashboardGrid :widgets="widgets" :columns="12" :row-height="100">
|
|
321
|
+
<template #widget="{ widget }">
|
|
322
|
+
<DXCard class="h-full p-4">
|
|
323
|
+
<h3 class="font-semibold mb-2">{{ widget.title }}</h3>
|
|
324
|
+
<p class="text-sm text-slate-600">Размер: {{ widget.w }}x{{ widget.h }}</p>
|
|
325
|
+
</DXCard>
|
|
326
|
+
</template>
|
|
327
|
+
</DXDashboardGrid>
|
|
328
|
+
`,
|
|
329
|
+
}),
|
|
330
|
+
};
|
|
331
|
+
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="gridClasses"
|
|
4
|
+
:style="gridStyles"
|
|
5
|
+
data-component="DXDashboardGrid"
|
|
6
|
+
:data-columns="columns"
|
|
7
|
+
:data-editable="editable"
|
|
8
|
+
>
|
|
9
|
+
<vuedraggable
|
|
10
|
+
v-model="internalWidgets"
|
|
11
|
+
:animation="200"
|
|
12
|
+
:disabled="!editable"
|
|
13
|
+
handle=".drag-handle"
|
|
14
|
+
:group="{ name: 'widgets', pull: false, put: false }"
|
|
15
|
+
item-key="id"
|
|
16
|
+
@start="handleDragStart"
|
|
17
|
+
@end="handleDragEnd"
|
|
18
|
+
@change="handleDragChange"
|
|
19
|
+
>
|
|
20
|
+
<template #item="{ element: widget }">
|
|
21
|
+
<div
|
|
22
|
+
:class="widgetClasses"
|
|
23
|
+
:style="widgetStyles(widget)"
|
|
24
|
+
>
|
|
25
|
+
<div v-if="editable" class="drag-handle absolute top-2 right-2 z-10 cursor-move">
|
|
26
|
+
<DXIcon
|
|
27
|
+
:icon="Bars3Icon"
|
|
28
|
+
size="sm"
|
|
29
|
+
class="text-slate-400 hover:text-slate-600"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
<slot name="widget" :widget="widget">
|
|
33
|
+
<div class="p-4 bg-white border border-slate-200 rounded-lg h-full">
|
|
34
|
+
<h3 class="font-semibold mb-2">{{ widget.title || `Виджет ${widget.id}` }}</h3>
|
|
35
|
+
<p class="text-sm text-slate-600">Используйте slot widget для кастомного контента</p>
|
|
36
|
+
</div>
|
|
37
|
+
</slot>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</vuedraggable>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup>
|
|
45
|
+
import { ref, computed, watch } from "vue";
|
|
46
|
+
import { useClassComposition } from "@/composables/useClassComposition";
|
|
47
|
+
import { useSpacing } from "@/composables/useSpacing";
|
|
48
|
+
import { VueDraggableNext as vuedraggable } from "vue-draggable-next";
|
|
49
|
+
import DXIcon from "../../atoms/DXIcon/DXIcon.vue";
|
|
50
|
+
import { Bars3Icon } from "@heroicons/vue/24/outline";
|
|
51
|
+
|
|
52
|
+
const props = defineProps({
|
|
53
|
+
/**
|
|
54
|
+
* Массив виджетов (v-model)
|
|
55
|
+
* Формат: [{ id, x, y, w, h, type, title?, config? }]
|
|
56
|
+
*/
|
|
57
|
+
widgets: {
|
|
58
|
+
type: Array,
|
|
59
|
+
required: true,
|
|
60
|
+
default: () => [],
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Количество колонок в сетке
|
|
64
|
+
* @default 12
|
|
65
|
+
*/
|
|
66
|
+
columns: { type: Number, default: 12 },
|
|
67
|
+
/**
|
|
68
|
+
* Высота строки в пикселях
|
|
69
|
+
* @default 100
|
|
70
|
+
*/
|
|
71
|
+
rowHeight: { type: Number, default: 100 },
|
|
72
|
+
/**
|
|
73
|
+
* Редактируемый режим (drag-and-drop включен)
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
editable: { type: Boolean, default: true },
|
|
77
|
+
/**
|
|
78
|
+
* Отступ между виджетами: none | xs | sm | md | lg | xl
|
|
79
|
+
* @default 'md'
|
|
80
|
+
*/
|
|
81
|
+
gap: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "md",
|
|
84
|
+
validator: (v) => ["none", "xs", "sm", "md", "lg", "xl"].includes(v),
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const emit = defineEmits([
|
|
89
|
+
"update:widgets",
|
|
90
|
+
"widget-move",
|
|
91
|
+
"widget-resize",
|
|
92
|
+
"widget-add",
|
|
93
|
+
"widget-remove",
|
|
94
|
+
]);
|
|
95
|
+
|
|
96
|
+
const internalWidgets = ref([...props.widgets]);
|
|
97
|
+
const isDragging = ref(false);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Классы для grid контейнера
|
|
101
|
+
*
|
|
102
|
+
* @description
|
|
103
|
+
* Вычисляет классы для grid контейнера с использованием CSS Grid.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Array} Массив классов
|
|
106
|
+
*/
|
|
107
|
+
const gridClasses = computed(() =>
|
|
108
|
+
useClassComposition("relative w-full")
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Стили для grid контейнера
|
|
113
|
+
*
|
|
114
|
+
* @description
|
|
115
|
+
* Вычисляет стили для grid контейнера с количеством колонок и отступами.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Object} Объект со стилями
|
|
118
|
+
*/
|
|
119
|
+
const gridStyles = computed(() => ({
|
|
120
|
+
display: "grid",
|
|
121
|
+
gridTemplateColumns: `repeat(${props.columns}, 1fr)`,
|
|
122
|
+
gridAutoRows: `${props.rowHeight}px`,
|
|
123
|
+
gap: gapValue.value,
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Стили для grid контейнера
|
|
128
|
+
*
|
|
129
|
+
* @description
|
|
130
|
+
* Вычисляет стили для grid контейнера с количеством колонок.
|
|
131
|
+
*
|
|
132
|
+
* @returns {Object} Объект со стилями
|
|
133
|
+
*/
|
|
134
|
+
/**
|
|
135
|
+
* Значение gap для CSS
|
|
136
|
+
*
|
|
137
|
+
* @description
|
|
138
|
+
* Преобразует gap prop в значение для CSS.
|
|
139
|
+
*
|
|
140
|
+
* @returns {string} Значение gap
|
|
141
|
+
*/
|
|
142
|
+
const gapValue = computed(() => {
|
|
143
|
+
const gapMap = {
|
|
144
|
+
none: "0px",
|
|
145
|
+
xs: "4px",
|
|
146
|
+
sm: "8px",
|
|
147
|
+
md: "16px",
|
|
148
|
+
lg: "24px",
|
|
149
|
+
xl: "32px",
|
|
150
|
+
};
|
|
151
|
+
return gapMap[props.gap] || gapMap.md;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Классы для виджета
|
|
156
|
+
*
|
|
157
|
+
* @description
|
|
158
|
+
* Вычисляет классы для каждого виджета.
|
|
159
|
+
*
|
|
160
|
+
* @returns {Array} Массив классов
|
|
161
|
+
*/
|
|
162
|
+
const widgetClasses = computed(() =>
|
|
163
|
+
useClassComposition(
|
|
164
|
+
"relative transition-all",
|
|
165
|
+
{
|
|
166
|
+
"cursor-move": props.editable && isDragging.value,
|
|
167
|
+
"cursor-default": !props.editable,
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Стили для виджета
|
|
174
|
+
*
|
|
175
|
+
* @description
|
|
176
|
+
* Вычисляет стили для позиционирования виджета в grid.
|
|
177
|
+
*
|
|
178
|
+
* @param {Object} widget - Виджет
|
|
179
|
+
* @returns {Object} Объект со стилями
|
|
180
|
+
*/
|
|
181
|
+
function widgetStyles(widget) {
|
|
182
|
+
return {
|
|
183
|
+
gridColumn: `span ${widget.w || 4}`,
|
|
184
|
+
gridRow: `span ${widget.h || 2}`,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Обработчик начала перетаскивания
|
|
190
|
+
*
|
|
191
|
+
* @description
|
|
192
|
+
* Вызывается при начале перетаскивания виджета.
|
|
193
|
+
*
|
|
194
|
+
* @param {Object} event - Событие drag
|
|
195
|
+
*/
|
|
196
|
+
function handleDragStart(event) {
|
|
197
|
+
isDragging.value = true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Обработчик окончания перетаскивания
|
|
202
|
+
*
|
|
203
|
+
* @description
|
|
204
|
+
* Вызывается при окончании перетаскивания виджета.
|
|
205
|
+
*
|
|
206
|
+
* @param {Object} event - Событие drag
|
|
207
|
+
*/
|
|
208
|
+
function handleDragEnd(event) {
|
|
209
|
+
isDragging.value = false;
|
|
210
|
+
|
|
211
|
+
// Вычисляем новую позицию виджета
|
|
212
|
+
const widget = internalWidgets.value[event.newIndex];
|
|
213
|
+
if (widget) {
|
|
214
|
+
// Обновляем позицию на основе нового индекса
|
|
215
|
+
const newPosition = calculatePosition(event.newIndex);
|
|
216
|
+
emit("widget-move", widget.id, newPosition);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Обработчик изменения при перетаскивании
|
|
222
|
+
*
|
|
223
|
+
* @description
|
|
224
|
+
* Вызывается при изменении порядка виджетов.
|
|
225
|
+
*
|
|
226
|
+
* @param {Object} event - Событие изменения
|
|
227
|
+
*/
|
|
228
|
+
function handleDragChange(event) {
|
|
229
|
+
if (event.added) {
|
|
230
|
+
// Виджет добавлен
|
|
231
|
+
const widget = event.added.element;
|
|
232
|
+
emit("widget-add", widget);
|
|
233
|
+
} else if (event.removed) {
|
|
234
|
+
// Виджет удален
|
|
235
|
+
const widget = event.removed.element;
|
|
236
|
+
emit("widget-remove", widget);
|
|
237
|
+
} else if (event.moved) {
|
|
238
|
+
// Виджет перемещен
|
|
239
|
+
const widget = event.moved.element;
|
|
240
|
+
const newPosition = calculatePosition(event.moved.newIndex);
|
|
241
|
+
emit("widget-move", widget.id, newPosition);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Вычисление позиции виджета
|
|
247
|
+
*
|
|
248
|
+
* @description
|
|
249
|
+
* Вычисляет позицию (x, y) виджета на основе его индекса в grid.
|
|
250
|
+
*
|
|
251
|
+
* @param {number} index - Индекс виджета
|
|
252
|
+
* @returns {Object} Объект с позицией { x, y }
|
|
253
|
+
*/
|
|
254
|
+
function calculatePosition(index) {
|
|
255
|
+
// Упрощенная логика: вычисляем позицию на основе индекса
|
|
256
|
+
// В реальной реализации нужно учитывать размеры виджетов
|
|
257
|
+
let currentX = 0;
|
|
258
|
+
let currentY = 0;
|
|
259
|
+
let currentRowHeight = 0;
|
|
260
|
+
|
|
261
|
+
for (let i = 0; i < index; i++) {
|
|
262
|
+
const widget = internalWidgets.value[i];
|
|
263
|
+
const widgetW = widget.w || 4;
|
|
264
|
+
const widgetH = widget.h || 2;
|
|
265
|
+
|
|
266
|
+
if (currentX + widgetW > props.columns) {
|
|
267
|
+
// Переход на новую строку
|
|
268
|
+
currentX = 0;
|
|
269
|
+
currentY += currentRowHeight;
|
|
270
|
+
currentRowHeight = widgetH;
|
|
271
|
+
} else {
|
|
272
|
+
currentX += widgetW;
|
|
273
|
+
currentRowHeight = Math.max(currentRowHeight, widgetH);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return { x: currentX, y: currentY };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Синхронизация с prop widgets
|
|
281
|
+
watch(
|
|
282
|
+
() => props.widgets,
|
|
283
|
+
(newWidgets) => {
|
|
284
|
+
internalWidgets.value = [...newWidgets];
|
|
285
|
+
},
|
|
286
|
+
{ deep: true }
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
// Синхронизация изменений с родителем
|
|
290
|
+
watch(
|
|
291
|
+
internalWidgets,
|
|
292
|
+
(newWidgets) => {
|
|
293
|
+
emit("update:widgets", newWidgets);
|
|
294
|
+
},
|
|
295
|
+
{ deep: true }
|
|
296
|
+
);
|
|
297
|
+
</script>
|
|
298
|
+
|
|
299
|
+
<style scoped>
|
|
300
|
+
/* Стили для drag-and-drop */
|
|
301
|
+
:deep(.sortable-ghost) {
|
|
302
|
+
opacity: 0.3;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
:deep(.sortable-drag) {
|
|
306
|
+
opacity: 0.5;
|
|
307
|
+
}
|
|
308
|
+
</style>
|
|
309
|
+
|