@pagamio/frontend-commons-lib 0.8.175 → 0.8.183
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/lib/api/client.d.ts +88 -0
- package/lib/api/client.js +339 -0
- package/lib/api/context.d.ts +112 -0
- package/lib/api/context.js +105 -0
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.js +4 -0
- package/lib/api/swr.d.ts +46 -0
- package/lib/api/swr.js +124 -0
- package/lib/api/types.d.ts +145 -0
- package/lib/api/types.js +10 -0
- package/lib/auth/authenticators/AuthenticatorFactory.d.ts +25 -0
- package/lib/auth/authenticators/AuthenticatorFactory.js +32 -0
- package/lib/auth/authenticators/index.d.ts +7 -0
- package/lib/auth/authenticators/index.js +7 -0
- package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.d.ts +21 -0
- package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.js +26 -0
- package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.d.ts +74 -0
- package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.js +99 -0
- package/lib/auth/authenticators/types.d.ts +26 -0
- package/lib/auth/authenticators/types.js +9 -0
- package/lib/auth/components/AppBanner.d.ts +7 -0
- package/lib/auth/components/AppBanner.js +9 -0
- package/lib/auth/components/AuthCard.d.ts +8 -0
- package/lib/auth/components/AuthCard.js +14 -0
- package/lib/auth/components/AuthFormUtils.d.ts +58 -0
- package/lib/auth/components/AuthFormUtils.js +52 -0
- package/lib/auth/components/AuthPageLayout.d.ts +45 -0
- package/lib/auth/components/AuthPageLayout.js +12 -0
- package/lib/auth/components/ChangePasswordPage.d.ts +12 -0
- package/lib/auth/components/ChangePasswordPage.js +59 -0
- package/lib/auth/components/CustomerRegistrationPage.d.ts +50 -0
- package/lib/auth/components/CustomerRegistrationPage.js +140 -0
- package/lib/auth/components/ForgotPasswordPage.d.ts +38 -0
- package/lib/auth/components/ForgotPasswordPage.js +76 -0
- package/lib/auth/components/LoginPage.d.ts +73 -0
- package/lib/auth/components/LoginPage.js +115 -0
- package/lib/auth/components/LogoutButton.d.ts +30 -0
- package/lib/auth/components/LogoutButton.js +47 -0
- package/lib/auth/components/ResetPasswordPage.d.ts +42 -0
- package/lib/auth/components/ResetPasswordPage.js +88 -0
- package/lib/auth/components/hooks/useChangeUserPassword.d.ts +26 -0
- package/lib/auth/components/hooks/useChangeUserPassword.js +63 -0
- package/lib/auth/components/index.d.ts +8 -0
- package/lib/auth/components/index.js +7 -0
- package/lib/auth/context/AuthContext.d.ts +65 -0
- package/lib/auth/context/AuthContext.js +150 -0
- package/lib/auth/context/index.d.ts +1 -0
- package/lib/auth/context/index.js +1 -0
- package/lib/auth/index.d.ts +7 -0
- package/lib/auth/index.js +7 -0
- package/lib/auth/services/AuthService.d.ts +230 -0
- package/lib/auth/services/AuthService.js +475 -0
- package/lib/auth/services/LogoutService.d.ts +27 -0
- package/lib/auth/services/LogoutService.js +98 -0
- package/lib/auth/services/index.d.ts +2 -0
- package/lib/auth/services/index.js +2 -0
- package/lib/auth/shared/index.d.ts +1 -0
- package/lib/auth/shared/index.js +1 -0
- package/lib/auth/shared/layout/AuthPageLayout.d.ts +10 -0
- package/lib/auth/shared/layout/AuthPageLayout.js +16 -0
- package/lib/auth/shared/layout/index.d.ts +1 -0
- package/lib/auth/shared/layout/index.js +1 -0
- package/lib/auth/types/auth.types.d.ts +234 -0
- package/lib/auth/types/auth.types.js +14 -0
- package/lib/auth/types/index.d.ts +1 -0
- package/lib/auth/types/index.js +1 -0
- package/lib/auth/utils/TokenManager.d.ts +43 -0
- package/lib/auth/utils/TokenManager.js +171 -0
- package/lib/auth/utils/Transformers.d.ts +158 -0
- package/lib/auth/utils/Transformers.js +263 -0
- package/lib/auth/utils/errorDetection.d.ts +22 -0
- package/lib/auth/utils/errorDetection.js +190 -0
- package/lib/auth/utils/index.d.ts +3 -0
- package/lib/auth/utils/index.js +3 -0
- package/lib/components/charts/LineGraph.d.ts +15 -0
- package/lib/components/charts/LineGraph.js +131 -0
- package/lib/components/icons/Icon.d.ts +8 -0
- package/lib/components/icons/Icon.js +13 -0
- package/lib/components/icons/index.d.ts +2 -0
- package/lib/components/icons/index.js +2 -0
- package/lib/components/icons/types.d.ts +26 -0
- package/lib/components/icons/types.js +33 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/components/layout/AppLayout.d.ts +34 -0
- package/lib/components/layout/AppLayout.js +19 -0
- package/lib/components/layout/AuthPageLayout.d.ts +13 -0
- package/lib/components/layout/AuthPageLayout.js +15 -0
- package/lib/components/layout/BreadcrumbNav.d.ts +2 -0
- package/lib/components/layout/BreadcrumbNav.js +10 -0
- package/lib/components/layout/LayoutContent.d.ts +6 -0
- package/lib/components/layout/LayoutContent.js +10 -0
- package/lib/components/layout/Navbar.d.ts +106 -0
- package/lib/components/layout/Navbar.js +66 -0
- package/lib/components/layout/PageHeader.d.ts +8 -0
- package/lib/components/layout/PageHeader.js +7 -0
- package/lib/components/layout/SessionExpiryModal.d.ts +10 -0
- package/lib/components/layout/SessionExpiryModal.js +9 -0
- package/lib/components/layout/Sidebar.d.ts +6 -0
- package/lib/components/layout/Sidebar.js +87 -0
- package/lib/components/layout/VerticalTabsLayout.d.ts +12 -0
- package/lib/components/layout/VerticalTabsLayout.js +14 -0
- package/lib/components/layout/index.d.ts +9 -0
- package/lib/components/layout/index.js +9 -0
- package/lib/components/ui/Avatar.d.ts +6 -0
- package/lib/components/ui/Avatar.js +11 -0
- package/lib/components/ui/AvatarIcon.d.ts +4 -0
- package/lib/components/ui/AvatarIcon.js +6 -0
- package/lib/components/ui/Button.d.ts +14 -0
- package/lib/components/ui/Button.js +30 -0
- package/lib/components/ui/Calendar.d.ts +9 -0
- package/lib/components/ui/Calendar.js +35 -0
- package/lib/components/ui/Card.d.ts +16 -0
- package/lib/components/ui/Card.js +6 -0
- package/lib/components/ui/Chart.d.ts +2 -0
- package/lib/components/ui/Chart.js +16 -0
- package/lib/components/ui/Checkbox.d.ts +4 -0
- package/lib/components/ui/Checkbox.js +8 -0
- package/lib/components/ui/Command.d.ts +80 -0
- package/lib/components/ui/Command.js +28 -0
- package/lib/components/ui/ContainedTab.d.ts +21 -0
- package/lib/components/ui/ContainedTab.js +37 -0
- package/lib/components/ui/DateFormat.d.ts +6 -0
- package/lib/components/ui/DateFormat.js +8 -0
- package/lib/components/ui/DatePicker.d.ts +14 -0
- package/lib/components/ui/DatePicker.js +91 -0
- package/lib/components/ui/DateRangeModal.d.ts +38 -0
- package/lib/components/ui/DateRangeModal.js +89 -0
- package/lib/components/ui/DetailsCard.d.ts +16 -0
- package/lib/components/ui/DetailsCard.js +14 -0
- package/lib/components/ui/DetailsPage.d.ts +36 -0
- package/lib/components/ui/DetailsPage.js +50 -0
- package/lib/components/ui/Dialog.d.ts +19 -0
- package/lib/components/ui/Dialog.js +22 -0
- package/lib/components/ui/EmptyState.d.ts +6 -0
- package/lib/components/ui/EmptyState.js +6 -0
- package/lib/components/ui/FilterComponent.d.ts +30 -0
- package/lib/components/ui/FilterComponent.js +80 -0
- package/lib/components/ui/FilterList.d.ts +52 -0
- package/lib/components/ui/FilterList.js +62 -0
- package/lib/components/ui/FilterSection.d.ts +31 -0
- package/lib/components/ui/FilterSection.js +21 -0
- package/lib/components/ui/FilterWrapper.d.ts +6 -0
- package/lib/components/ui/FilterWrapper.js +7 -0
- package/lib/components/ui/Form.d.ts +23 -0
- package/lib/components/ui/Form.js +62 -0
- package/lib/components/ui/HoverableValue.d.ts +7 -0
- package/lib/components/ui/HoverableValue.js +8 -0
- package/lib/components/ui/IconButton.d.ts +10 -0
- package/lib/components/ui/IconButton.js +10 -0
- package/lib/components/ui/ImageComponent.d.ts +8 -0
- package/lib/components/ui/ImageComponent.js +5 -0
- package/lib/components/ui/ImageUploader.d.ts +17 -0
- package/lib/components/ui/ImageUploader.js +144 -0
- package/lib/components/ui/Input.d.ts +4 -0
- package/lib/components/ui/Input.js +8 -0
- package/lib/components/ui/Label.d.ts +5 -0
- package/lib/components/ui/Label.js +9 -0
- package/lib/components/ui/Loader.d.ts +10 -0
- package/lib/components/ui/Loader.js +7 -0
- package/lib/components/ui/Modal.d.ts +72 -0
- package/lib/components/ui/Modal.js +31 -0
- package/lib/components/ui/MultiSelect.d.ts +16 -0
- package/lib/components/ui/MultiSelect.js +59 -0
- package/lib/components/ui/NotificationModal.d.ts +18 -0
- package/lib/components/ui/NotificationModal.js +40 -0
- package/lib/components/ui/PhoneInput.d.ts +12 -0
- package/lib/components/ui/PhoneInput.js +58 -0
- package/lib/components/ui/Popover.d.ts +7 -0
- package/lib/components/ui/Popover.js +10 -0
- package/lib/components/ui/Progress.d.ts +7 -0
- package/lib/components/ui/Progress.js +7 -0
- package/lib/components/ui/Radio.d.ts +5 -0
- package/lib/components/ui/Radio.js +14 -0
- package/lib/components/ui/RangeDatePicker.d.ts +78 -0
- package/lib/components/ui/RangeDatePicker.js +68 -0
- package/lib/components/ui/Select.d.ts +13 -0
- package/lib/components/ui/Select.js +57 -0
- package/lib/components/ui/Separator.d.ts +4 -0
- package/lib/components/ui/Separator.js +7 -0
- package/lib/components/ui/Sheet.d.ts +26 -0
- package/lib/components/ui/Sheet.js +37 -0
- package/lib/components/ui/StatusCell.d.ts +9 -0
- package/lib/components/ui/StatusCell.js +6 -0
- package/lib/components/ui/Switch.d.ts +10 -0
- package/lib/components/ui/Switch.js +22 -0
- package/lib/components/ui/Tab.d.ts +15 -0
- package/lib/components/ui/Tab.js +13 -0
- package/lib/components/ui/TableDownload.d.ts +11 -0
- package/lib/components/ui/TableDownload.js +82 -0
- package/lib/components/ui/TailwindIndicator.d.ts +1 -0
- package/lib/components/ui/TailwindIndicator.js +6 -0
- package/lib/components/ui/TextField.d.ts +60 -0
- package/lib/components/ui/TextField.js +42 -0
- package/lib/components/ui/Textarea.d.ts +5 -0
- package/lib/components/ui/Textarea.js +8 -0
- package/lib/components/ui/Toast.d.ts +12 -0
- package/lib/components/ui/Toast.js +25 -0
- package/lib/components/ui/UploadField.d.ts +15 -0
- package/lib/components/ui/UploadField.js +45 -0
- package/lib/components/ui/VerticalTab.d.ts +16 -0
- package/lib/components/ui/VerticalTab.js +13 -0
- package/lib/components/ui/index.d.ts +49 -0
- package/lib/components/ui/index.js +47 -0
- package/lib/context/BreadcrumbContext.d.ts +28 -0
- package/lib/context/BreadcrumbContext.js +238 -0
- package/lib/context/FormEngineDrawerProvider.d.ts +21 -0
- package/lib/context/FormEngineDrawerProvider.js +38 -0
- package/lib/context/MultiFormEngineDrawerProvider.d.ts +25 -0
- package/lib/context/MultiFormEngineDrawerProvider.js +89 -0
- package/lib/context/SidebarContext.d.ts +65 -0
- package/lib/context/SidebarContext.js +47 -0
- package/lib/context/ToastContext.d.ts +17 -0
- package/lib/context/ToastContext.js +29 -0
- package/lib/context/index.d.ts +5 -0
- package/lib/context/index.js +5 -0
- package/lib/dashboard-visuals/components/BaseChart.d.ts +55 -0
- package/lib/dashboard-visuals/components/BaseChart.js +201 -0
- package/lib/dashboard-visuals/components/CardWrapper.d.ts +10 -0
- package/lib/dashboard-visuals/components/CardWrapper.js +13 -0
- package/lib/dashboard-visuals/components/ChartDetailsModal.d.ts +57 -0
- package/lib/dashboard-visuals/components/ChartDetailsModal.js +27 -0
- package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.d.ts +29 -0
- package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.js +4 -0
- package/lib/dashboard-visuals/components/ChartFormatter.d.ts +22 -0
- package/lib/dashboard-visuals/components/ChartFormatter.js +46 -0
- package/lib/dashboard-visuals/components/ChartWrapper.d.ts +11 -0
- package/lib/dashboard-visuals/components/ChartWrapper.js +14 -0
- package/lib/dashboard-visuals/components/DashboardFilter.d.ts +8 -0
- package/lib/dashboard-visuals/components/DashboardFilter.js +17 -0
- package/lib/dashboard-visuals/components/DataTable.d.ts +3 -0
- package/lib/dashboard-visuals/components/DataTable.js +57 -0
- package/lib/dashboard-visuals/components/EmptyState.d.ts +6 -0
- package/lib/dashboard-visuals/components/EmptyState.js +6 -0
- package/lib/dashboard-visuals/components/ErrorState.d.ts +7 -0
- package/lib/dashboard-visuals/components/ErrorState.js +5 -0
- package/lib/dashboard-visuals/components/FilterComponentSkeleton.d.ts +3 -0
- package/lib/dashboard-visuals/components/FilterComponentSkeleton.js +11 -0
- package/lib/dashboard-visuals/components/Pagination.d.ts +10 -0
- package/lib/dashboard-visuals/components/Pagination.js +7 -0
- package/lib/dashboard-visuals/components/Switch.d.ts +8 -0
- package/lib/dashboard-visuals/components/Switch.js +10 -0
- package/lib/dashboard-visuals/components/TileSkeleton.d.ts +2 -0
- package/lib/dashboard-visuals/components/TileSkeleton.js +5 -0
- package/lib/dashboard-visuals/components/molecules/Analytics.d.ts +11 -0
- package/lib/dashboard-visuals/components/molecules/Analytics.js +9 -0
- package/lib/dashboard-visuals/components/molecules/DataGrid.d.ts +15 -0
- package/lib/dashboard-visuals/components/molecules/DataGrid.js +124 -0
- package/lib/dashboard-visuals/components/molecules/NoChartData.d.ts +6 -0
- package/lib/dashboard-visuals/components/molecules/NoChartData.js +6 -0
- package/lib/dashboard-visuals/components/molecules/VisualChart.d.ts +16 -0
- package/lib/dashboard-visuals/components/molecules/VisualChart.js +8 -0
- package/lib/dashboard-visuals/components/types.d.ts +62 -0
- package/lib/dashboard-visuals/components/types.js +1 -0
- package/lib/dashboard-visuals/hooks/useChartData.d.ts +15 -0
- package/lib/dashboard-visuals/hooks/useChartData.js +82 -0
- package/lib/dashboard-visuals/hooks/useTooltipFormatter.d.ts +13 -0
- package/lib/dashboard-visuals/hooks/useTooltipFormatter.js +10 -0
- package/lib/dashboard-visuals/index.d.ts +39 -0
- package/lib/dashboard-visuals/index.js +168 -0
- package/lib/dashboard-visuals/types/index.d.ts +83 -0
- package/lib/dashboard-visuals/types/index.js +1 -0
- package/lib/dashboard-visuals/types/metricDetailData.d.ts +25 -0
- package/lib/dashboard-visuals/types/metricDetailData.js +1 -0
- package/lib/dashboard-visuals/utils/api.d.ts +5 -0
- package/lib/dashboard-visuals/utils/api.js +6 -0
- package/lib/dashboard-visuals/utils/chartOptions.d.ts +481 -0
- package/lib/dashboard-visuals/utils/chartOptions.js +393 -0
- package/lib/dashboard-visuals/utils/chunkArray.d.ts +1 -0
- package/lib/dashboard-visuals/utils/chunkArray.js +7 -0
- package/lib/dashboard-visuals/utils/defaultColors.d.ts +1 -0
- package/lib/dashboard-visuals/utils/defaultColors.js +1 -0
- package/lib/dashboard-visuals/utils/formatUtil.d.ts +203 -0
- package/lib/dashboard-visuals/utils/formatUtil.js +472 -0
- package/lib/dashboard-visuals/utils/gridUtil.d.ts +11 -0
- package/lib/dashboard-visuals/utils/gridUtil.js +32 -0
- package/lib/dashboard-visuals/utils/index.d.ts +6 -0
- package/lib/dashboard-visuals/utils/index.js +6 -0
- package/lib/dashboard-visuals/utils/tooltipUtils.d.ts +11 -0
- package/lib/dashboard-visuals/utils/tooltipUtils.js +180 -0
- package/lib/dashboard-visuals/visualRegistry.d.ts +4 -0
- package/lib/dashboard-visuals/visualRegistry.js +41 -0
- package/lib/dashboard-visuals/visuals/BarChart.d.ts +58 -0
- package/lib/dashboard-visuals/visuals/BarChart.js +95 -0
- package/lib/dashboard-visuals/visuals/BarLineHybridChart.d.ts +33 -0
- package/lib/dashboard-visuals/visuals/BarLineHybridChart.js +60 -0
- package/lib/dashboard-visuals/visuals/BubbleChart.d.ts +25 -0
- package/lib/dashboard-visuals/visuals/BubbleChart.js +101 -0
- package/lib/dashboard-visuals/visuals/DistributionChart.d.ts +11 -0
- package/lib/dashboard-visuals/visuals/DistributionChart.js +48 -0
- package/lib/dashboard-visuals/visuals/DonutChart.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/DonutChart.js +105 -0
- package/lib/dashboard-visuals/visuals/GaugeChart.d.ts +32 -0
- package/lib/dashboard-visuals/visuals/GaugeChart.js +53 -0
- package/lib/dashboard-visuals/visuals/GroupedBarChart.d.ts +47 -0
- package/lib/dashboard-visuals/visuals/GroupedBarChart.js +131 -0
- package/lib/dashboard-visuals/visuals/HeatmapChart.d.ts +79 -0
- package/lib/dashboard-visuals/visuals/HeatmapChart.js +146 -0
- package/lib/dashboard-visuals/visuals/HorizontalBarChart.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/HorizontalBarChart.js +131 -0
- package/lib/dashboard-visuals/visuals/ItemPerformanceCard.d.ts +30 -0
- package/lib/dashboard-visuals/visuals/ItemPerformanceCard.js +31 -0
- package/lib/dashboard-visuals/visuals/LineChart.d.ts +56 -0
- package/lib/dashboard-visuals/visuals/LineChart.js +80 -0
- package/lib/dashboard-visuals/visuals/LineGraph.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/LineGraph.js +189 -0
- package/lib/dashboard-visuals/visuals/MetricSummaryCard.d.ts +14 -0
- package/lib/dashboard-visuals/visuals/MetricSummaryCard.js +8 -0
- package/lib/dashboard-visuals/visuals/MultiGaugeChart.d.ts +39 -0
- package/lib/dashboard-visuals/visuals/MultiGaugeChart.js +119 -0
- package/lib/dashboard-visuals/visuals/PieChart.d.ts +59 -0
- package/lib/dashboard-visuals/visuals/PieChart.js +194 -0
- package/lib/dashboard-visuals/visuals/SelectedEventTile.d.ts +14 -0
- package/lib/dashboard-visuals/visuals/SelectedEventTile.js +35 -0
- package/lib/dashboard-visuals/visuals/SpeedometerChart.d.ts +53 -0
- package/lib/dashboard-visuals/visuals/SpeedometerChart.js +94 -0
- package/lib/dashboard-visuals/visuals/Table.d.ts +26 -0
- package/lib/dashboard-visuals/visuals/Table.js +113 -0
- package/lib/dashboard-visuals/visuals/Tile.d.ts +16 -0
- package/lib/dashboard-visuals/visuals/Tile.js +16 -0
- package/lib/dashboard-visuals/visuals/TreeMap.d.ts +25 -0
- package/lib/dashboard-visuals/visuals/TreeMap.js +45 -0
- package/lib/dashboard-visuals/visuals/WaterfallChart.d.ts +52 -0
- package/lib/dashboard-visuals/visuals/WaterfallChart.js +266 -0
- package/lib/form-engine/Form.d.ts +4 -0
- package/lib/form-engine/Form.js +14 -0
- package/lib/form-engine/FormEngine.d.ts +3 -0
- package/lib/form-engine/FormEngine.js +121 -0
- package/lib/form-engine/components/FieldWrapper.d.ts +18 -0
- package/lib/form-engine/components/FieldWrapper.js +63 -0
- package/lib/form-engine/components/index.d.ts +2 -0
- package/lib/form-engine/components/index.js +2 -0
- package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.d.ts +16 -0
- package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.js +48 -0
- package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.js +5 -0
- package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.js +82 -0
- package/lib/form-engine/components/inputs/date-input/DateInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/date-input/DateInput.js +7 -0
- package/lib/form-engine/components/inputs/date-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/date-input/index.js +1 -0
- package/lib/form-engine/components/inputs/email-input/EmailInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/email-input/EmailInput.js +5 -0
- package/lib/form-engine/components/inputs/email-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/email-input/index.js +1 -0
- package/lib/form-engine/components/inputs/index.d.ts +13 -0
- package/lib/form-engine/components/inputs/index.js +13 -0
- package/lib/form-engine/components/inputs/label-input/LabelInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/label-input/LabelInput.js +7 -0
- package/lib/form-engine/components/inputs/label-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/label-input/index.js +1 -0
- package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.js +5 -0
- package/lib/form-engine/components/inputs/number-input/NumberInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/number-input/NumberInput.js +5 -0
- package/lib/form-engine/components/inputs/number-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/number-input/index.js +1 -0
- package/lib/form-engine/components/inputs/password-input/PasswordInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/password-input/PasswordInput.js +9 -0
- package/lib/form-engine/components/inputs/password-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/password-input/index.js +1 -0
- package/lib/form-engine/components/inputs/radio-button/RadioInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/radio-button/RadioInput.js +6 -0
- package/lib/form-engine/components/inputs/radio-button/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/radio-button/index.js +1 -0
- package/lib/form-engine/components/inputs/select/SelectInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/select/SelectInput.js +6 -0
- package/lib/form-engine/components/inputs/select/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/select/index.js +1 -0
- package/lib/form-engine/components/inputs/textarea-input/TextareaInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/textarea-input/TextareaInput.js +5 -0
- package/lib/form-engine/components/inputs/textarea-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/textarea-input/index.js +1 -0
- package/lib/form-engine/components/inputs/time-input/TimeInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/time-input/TimeInput.js +5 -0
- package/lib/form-engine/components/inputs/time-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/time-input/index.js +1 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.js +7 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/index.js +1 -0
- package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.d.ts +4 -0
- package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.js +59 -0
- package/lib/form-engine/components/inputs/upload-field/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/upload-field/index.js +1 -0
- package/lib/form-engine/hooks/useFormPersistence.d.ts +11 -0
- package/lib/form-engine/hooks/useFormPersistence.js +46 -0
- package/lib/form-engine/index.d.ts +5 -0
- package/lib/form-engine/index.js +5 -0
- package/lib/form-engine/registry/RegisterComponents.d.ts +1 -0
- package/lib/form-engine/registry/RegisterComponents.js +35 -0
- package/lib/form-engine/registry/Registry.d.ts +5 -0
- package/lib/form-engine/registry/Registry.js +13 -0
- package/lib/form-engine/registry/index.d.ts +2 -0
- package/lib/form-engine/registry/index.js +2 -0
- package/lib/form-engine/types/index.d.ts +311 -0
- package/lib/form-engine/types/index.js +1 -0
- package/lib/helpers/index.d.ts +2 -0
- package/lib/helpers/index.js +2 -0
- package/lib/helpers/utils.d.ts +37 -0
- package/lib/helpers/utils.js +77 -0
- package/lib/helpers/validations.d.ts +80 -0
- package/lib/helpers/validations.js +39 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +30 -0
- package/lib/mocks/mockApiRequestsConfig.d.ts +2 -0
- package/lib/mocks/mockApiRequestsConfig.js +343 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.d.ts +14 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.js +40 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/index.d.ts +11 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/index.js +7 -0
- package/lib/pagamio-drawer/components/BaseDrawer.d.ts +11 -0
- package/lib/pagamio-drawer/components/BaseDrawer.js +10 -0
- package/lib/pagamio-drawer/components/DrawerContent.d.ts +27 -0
- package/lib/pagamio-drawer/components/DrawerContent.js +237 -0
- package/lib/pagamio-drawer/index.d.ts +22 -0
- package/lib/pagamio-drawer/index.js +133 -0
- package/lib/pagamio-table/data-table/ExportButton.d.ts +57 -0
- package/lib/pagamio-table/data-table/ExportButton.js +96 -0
- package/lib/pagamio-table/data-table/MantineCoreTable.d.ts +44 -0
- package/lib/pagamio-table/data-table/MantineCoreTable.js +129 -0
- package/lib/pagamio-table/data-table/Pagination.d.ts +10 -0
- package/lib/pagamio-table/data-table/Pagination.js +5 -0
- package/lib/pagamio-table/data-table/TableDownload.d.ts +8 -0
- package/lib/pagamio-table/data-table/TableDownload.js +81 -0
- package/lib/pagamio-table/data-table/TableToolbar.d.ts +3 -0
- package/lib/pagamio-table/data-table/TableToolbar.js +16 -0
- package/lib/pagamio-table/data-table/exportUtils.d.ts +42 -0
- package/lib/pagamio-table/data-table/exportUtils.js +782 -0
- package/lib/pagamio-table/data-table/index.d.ts +5 -0
- package/lib/pagamio-table/data-table/index.js +11 -0
- package/lib/pagamio-table/data-table/pdfExportUtils.d.ts +111 -0
- package/lib/pagamio-table/data-table/pdfExportUtils.js +113 -0
- package/lib/pagamio-table/data-table/types.d.ts +169 -0
- package/lib/pagamio-table/data-table/types.js +1 -0
- package/lib/pagamio-table/index.d.ts +4 -0
- package/lib/pagamio-table/index.js +4 -0
- package/lib/pagamio-table/utils/functionHelper.d.ts +12 -0
- package/lib/pagamio-table/utils/functionHelper.js +24 -0
- package/lib/pagamio-table/utils/index.d.ts +1 -0
- package/lib/pagamio-table/utils/index.js +1 -0
- package/lib/rbac/hooks.d.ts +39 -0
- package/lib/rbac/hooks.js +51 -0
- package/lib/rbac/index.d.ts +8 -0
- package/lib/rbac/index.js +11 -0
- package/lib/rbac/store.d.ts +24 -0
- package/lib/rbac/store.js +37 -0
- package/lib/rbac/types.d.ts +39 -0
- package/lib/rbac/types.js +4 -0
- package/lib/rbac/utils.d.ts +44 -0
- package/lib/rbac/utils.js +117 -0
- package/lib/shared/constants/index.d.ts +2 -0
- package/lib/shared/constants/index.js +2 -0
- package/lib/shared/hooks/index.d.ts +4 -0
- package/lib/shared/hooks/index.js +4 -0
- package/lib/shared/hooks/useAnyDrawerOpen.d.ts +4 -0
- package/lib/shared/hooks/useAnyDrawerOpen.js +18 -0
- package/lib/shared/hooks/useContainerWidth.d.ts +2 -0
- package/lib/shared/hooks/useContainerWidth.js +18 -0
- package/lib/shared/hooks/useImageUpload.d.ts +15 -0
- package/lib/shared/hooks/useImageUpload.js +66 -0
- package/lib/shared/hooks/useMediaQueries.d.ts +5 -0
- package/lib/shared/hooks/useMediaQueries.js +35 -0
- package/lib/shared/hooks/usePagamioTable.d.ts +158 -0
- package/lib/shared/hooks/usePagamioTable.js +475 -0
- package/lib/shared/hooks/useSessionTimer.d.ts +33 -0
- package/lib/shared/hooks/useSessionTimer.js +96 -0
- package/lib/shared/index.d.ts +4 -0
- package/lib/shared/index.js +4 -0
- package/lib/shared/types/index.d.ts +1 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/shared/url/index.d.ts +9 -0
- package/lib/shared/url/index.js +20 -0
- package/lib/shared/utils/filterUtils.d.ts +5 -0
- package/lib/shared/utils/filterUtils.js +31 -0
- package/lib/shared/utils/functionHelper.d.ts +27 -0
- package/lib/shared/utils/functionHelper.js +124 -0
- package/lib/shared/utils/index.d.ts +2 -0
- package/lib/shared/utils/index.js +2 -0
- package/lib/shared/utils/localStorage.d.ts +53 -0
- package/lib/shared/utils/localStorage.js +139 -0
- package/lib/styles.css +6247 -0
- package/lib/translations/components/LocaleSwitcher.d.ts +7 -0
- package/lib/translations/components/LocaleSwitcher.js +18 -0
- package/lib/translations/components/index.d.ts +1 -0
- package/lib/translations/components/index.js +1 -0
- package/lib/translations/context/TranslationContext.d.ts +5 -0
- package/lib/translations/context/TranslationContext.js +151 -0
- package/lib/translations/context/index.d.ts +1 -0
- package/lib/translations/context/index.js +1 -0
- package/lib/translations/hooks/index.d.ts +2 -0
- package/lib/translations/hooks/index.js +2 -0
- package/lib/translations/hooks/useLibTranslations.d.ts +7 -0
- package/lib/translations/hooks/useLibTranslations.js +46 -0
- package/lib/translations/hooks/useTranslation.d.ts +7 -0
- package/lib/translations/hooks/useTranslation.js +11 -0
- package/lib/translations/index.d.ts +91 -0
- package/lib/translations/index.js +11 -0
- package/lib/translations/locales/en.json +21 -0
- package/lib/translations/locales/es.json +21 -0
- package/lib/translations/locales/fr.json +21 -0
- package/lib/translations/locales/pt.json +21 -0
- package/lib/translations/types/index.d.ts +24 -0
- package/lib/translations/types/index.js +1 -0
- package/lib/translations/utils/index.d.ts +6 -0
- package/lib/translations/utils/index.js +25 -0
- package/package.json +9 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { QueryProps } from 'src/shared/types';
|
|
2
|
+
import type { ChartToolTipProps, DistributionChartTooltip, DistributionQueryProps, StatisticsQueryProps, TableColumn, TooltipField } from '../types';
|
|
3
|
+
interface DonutChartProps<TData extends {
|
|
4
|
+
id: string | number;
|
|
5
|
+
}> {
|
|
6
|
+
title?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
query: QueryProps;
|
|
9
|
+
nameKey: string;
|
|
10
|
+
valueKey: string;
|
|
11
|
+
colors?: string[];
|
|
12
|
+
chartDetails?: {
|
|
13
|
+
columns?: any[];
|
|
14
|
+
data?: any[];
|
|
15
|
+
};
|
|
16
|
+
tooltipValueFormat: string;
|
|
17
|
+
tooltipTitle?: string;
|
|
18
|
+
tooltipUnit?: string;
|
|
19
|
+
tooltipAdditionalFields?: (string | TooltipField)[];
|
|
20
|
+
currencyDisplaySymbol?: string;
|
|
21
|
+
showLabels?: boolean;
|
|
22
|
+
showTooltipMarker?: boolean;
|
|
23
|
+
metricDetailData: {
|
|
24
|
+
statisticsUrl?: string;
|
|
25
|
+
title: string;
|
|
26
|
+
topFiveChartTitle: string;
|
|
27
|
+
bottomFiveChartTitle: string;
|
|
28
|
+
itemStatisticsQuery: StatisticsQueryProps;
|
|
29
|
+
valueMetricsQuery: StatisticsQueryProps;
|
|
30
|
+
averageMetricsQuery: StatisticsQueryProps;
|
|
31
|
+
distributionMetricsQuery: DistributionQueryProps;
|
|
32
|
+
yAxisDataNameKey: string;
|
|
33
|
+
xAxisNameKey: string;
|
|
34
|
+
xAxisLabel: string;
|
|
35
|
+
yAxisLabel: string;
|
|
36
|
+
nameKey: string;
|
|
37
|
+
valueKey: string;
|
|
38
|
+
dataGridSearchKey: string;
|
|
39
|
+
dataGridColumns: TableColumn<TData>[];
|
|
40
|
+
dataSearchInputPlaceHolder: string;
|
|
41
|
+
chartToolTip?: ChartToolTipProps;
|
|
42
|
+
detailsTableTitle?: string;
|
|
43
|
+
distributionChartTooltip: DistributionChartTooltip;
|
|
44
|
+
};
|
|
45
|
+
showDetailsModal?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare const DonutChart: <TData extends {
|
|
48
|
+
id: string | number;
|
|
49
|
+
}>({ title, url, query, nameKey, valueKey, colors, tooltipValueFormat, chartDetails, tooltipTitle, tooltipUnit, tooltipAdditionalFields, showLabels, showTooltipMarker, metricDetailData, showDetailsModal, ...props }: DonutChartProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export default DonutChart;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactECharts from 'echarts-for-react';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import BaseChart from '../components/BaseChart';
|
|
5
|
+
import { DashboardPaths, defaultColors } from '../utils';
|
|
6
|
+
const DonutChart = ({ title, url = DashboardPaths.QUERY, query, nameKey, valueKey, colors = defaultColors, tooltipValueFormat, chartDetails, tooltipTitle, tooltipUnit = '', tooltipAdditionalFields = [], showLabels = true, showTooltipMarker = true, metricDetailData, showDetailsModal = true, ...props }) => {
|
|
7
|
+
const formatChartData = useCallback((data) => {
|
|
8
|
+
if (!data?.length)
|
|
9
|
+
return { legendData: [], seriesData: [] };
|
|
10
|
+
const legendData = data.map((item) => item[nameKey]);
|
|
11
|
+
const seriesData = data.map((item) => {
|
|
12
|
+
const dataPoint = {
|
|
13
|
+
name: item[nameKey],
|
|
14
|
+
value: item[valueKey],
|
|
15
|
+
};
|
|
16
|
+
return dataPoint;
|
|
17
|
+
});
|
|
18
|
+
return { legendData, seriesData };
|
|
19
|
+
}, [nameKey, valueKey]);
|
|
20
|
+
const createChartOptions = useCallback((chartData) => {
|
|
21
|
+
return {
|
|
22
|
+
tooltip: {
|
|
23
|
+
trigger: 'item',
|
|
24
|
+
extraCssText: 'box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);',
|
|
25
|
+
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
|
26
|
+
textStyle: {
|
|
27
|
+
color: '#333',
|
|
28
|
+
},
|
|
29
|
+
borderWidth: 1,
|
|
30
|
+
borderColor: '#ddd',
|
|
31
|
+
appendToBody: true,
|
|
32
|
+
formatter: undefined,
|
|
33
|
+
},
|
|
34
|
+
legend: {
|
|
35
|
+
orient: 'horizontal',
|
|
36
|
+
bottom: 0,
|
|
37
|
+
left: 'center',
|
|
38
|
+
itemWidth: 15,
|
|
39
|
+
itemHeight: 10,
|
|
40
|
+
textStyle: {
|
|
41
|
+
fontSize: 12,
|
|
42
|
+
},
|
|
43
|
+
icon: 'rect',
|
|
44
|
+
pageIconSize: 12,
|
|
45
|
+
},
|
|
46
|
+
color: colors,
|
|
47
|
+
series: [
|
|
48
|
+
{
|
|
49
|
+
name: title,
|
|
50
|
+
type: 'pie',
|
|
51
|
+
radius: ['40%', '70%'],
|
|
52
|
+
center: ['50%', '45%'],
|
|
53
|
+
avoidLabelOverlap: false,
|
|
54
|
+
itemStyle: {
|
|
55
|
+
borderColor: '#fff',
|
|
56
|
+
borderWidth: 2,
|
|
57
|
+
},
|
|
58
|
+
label: {
|
|
59
|
+
show: showLabels,
|
|
60
|
+
position: 'outside',
|
|
61
|
+
formatter: '{b}',
|
|
62
|
+
fontSize: 12,
|
|
63
|
+
lineHeight: 15,
|
|
64
|
+
rich: {
|
|
65
|
+
b: {
|
|
66
|
+
fontSize: 12,
|
|
67
|
+
lineHeight: 15,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
labelLine: {
|
|
72
|
+
show: showLabels,
|
|
73
|
+
length: 15,
|
|
74
|
+
length2: 10,
|
|
75
|
+
},
|
|
76
|
+
emphasis: {
|
|
77
|
+
label: {
|
|
78
|
+
show: true,
|
|
79
|
+
fontSize: 14,
|
|
80
|
+
fontWeight: 'bold',
|
|
81
|
+
},
|
|
82
|
+
itemStyle: {
|
|
83
|
+
shadowBlur: 10,
|
|
84
|
+
shadowOffsetX: 0,
|
|
85
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
data: chartData.seriesData,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
}, [colors, showLabels, title]);
|
|
93
|
+
return (_jsx(BaseChart, { title: title, detailsModalTitle: metricDetailData.title, url: url, query: query, chartDetails: chartDetails, itemStatisticsQuery: metricDetailData.itemStatisticsQuery, valueMetricsQuery: metricDetailData.valueMetricsQuery, averageMetricsQuery: metricDetailData.averageMetricsQuery, distributionMetricsQuery: metricDetailData.distributionMetricsQuery, yAxisDataNameKey: metricDetailData.yAxisDataNameKey, xAxisNameKey: metricDetailData.xAxisNameKey, xAxisLabel: metricDetailData.xAxisLabel, yAxisLabel: metricDetailData.yAxisLabel, nameKey: metricDetailData.nameKey, valueKey: metricDetailData.valueKey, distributionChartTooltip: metricDetailData.distributionChartTooltip, dataGridSearchKey: metricDetailData.dataGridSearchKey, dataGridColumns: metricDetailData.dataGridColumns, dataSearchInputPlaceHolder: metricDetailData.dataSearchInputPlaceHolder, chartToolTip: metricDetailData.chartToolTip, detailsTableTitle: metricDetailData.detailsTableTitle, showDetailsModal: showDetailsModal, getChartOptions: (data) => createChartOptions(formatChartData(data)), topFivePerformingChartTitle: metricDetailData.topFiveChartTitle, bottomFivePerformingChartTitle: metricDetailData.bottomFiveChartTitle, tooltipValueFormat: tooltipValueFormat, tooltipTitle: tooltipTitle, tooltipUnit: tooltipUnit, tooltipAdditionalFields: tooltipAdditionalFields, ...props, children: ({ metricData, tooltipFormatterFn }) => {
|
|
94
|
+
const chartData = formatChartData(metricData);
|
|
95
|
+
const chartOptions = createChartOptions(chartData);
|
|
96
|
+
if (tooltipFormatterFn) {
|
|
97
|
+
chartOptions.tooltip = {
|
|
98
|
+
...chartOptions.tooltip,
|
|
99
|
+
formatter: tooltipFormatterFn,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return (_jsx("div", { className: "mt-4", children: _jsx(ReactECharts, { option: chartOptions, style: { height: '350px' } }) }));
|
|
103
|
+
} }));
|
|
104
|
+
};
|
|
105
|
+
export default DonutChart;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { QueryProps } from 'src/shared/types';
|
|
2
|
+
import type { TooltipField } from '../types';
|
|
3
|
+
import type { MetricDetailData } from '../types/metricDetailData';
|
|
4
|
+
interface GaugeChartProps<TData extends {
|
|
5
|
+
id: string | number;
|
|
6
|
+
}> {
|
|
7
|
+
title?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
query: QueryProps;
|
|
10
|
+
nameKey: string;
|
|
11
|
+
valueKey: string;
|
|
12
|
+
colors?: {
|
|
13
|
+
low: string;
|
|
14
|
+
medium: string;
|
|
15
|
+
high: string;
|
|
16
|
+
};
|
|
17
|
+
chartDetails?: {
|
|
18
|
+
columns?: any[];
|
|
19
|
+
data?: any[];
|
|
20
|
+
};
|
|
21
|
+
tooltipValueFormat: string;
|
|
22
|
+
tooltipTitle?: string;
|
|
23
|
+
tooltipUnit?: string;
|
|
24
|
+
tooltipAdditionalFields?: (string | TooltipField)[];
|
|
25
|
+
currencyDisplaySymbol?: string;
|
|
26
|
+
metricDetailData: MetricDetailData<TData>;
|
|
27
|
+
showDetailsModal?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const GaugeChart: <TData extends {
|
|
30
|
+
id: string | number;
|
|
31
|
+
}>({ title, url, query, nameKey, valueKey, colors, chartDetails, tooltipValueFormat, tooltipTitle, tooltipUnit, tooltipAdditionalFields, metricDetailData, showDetailsModal, ...props }: GaugeChartProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default GaugeChart;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactECharts from 'echarts-for-react';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import BaseChart from '../components/BaseChart';
|
|
5
|
+
import { DashboardPaths } from '../utils';
|
|
6
|
+
const defaultGaugeColors = {
|
|
7
|
+
low: '#F44336', // Red
|
|
8
|
+
medium: '#FFC107', // Amber
|
|
9
|
+
high: '#4CAF50', // Green
|
|
10
|
+
};
|
|
11
|
+
const GaugeChart = ({ title, url = DashboardPaths.QUERY, query, nameKey, valueKey, colors = defaultGaugeColors, chartDetails, tooltipValueFormat, tooltipTitle = 'Value', tooltipUnit = '', tooltipAdditionalFields = [], metricDetailData, showDetailsModal = true, ...props }) => {
|
|
12
|
+
const getGaugeOptions = useCallback((data, tooltipFormatter) => {
|
|
13
|
+
if (!data || data.length === 0)
|
|
14
|
+
return {};
|
|
15
|
+
// Extract the first item for single gauge display
|
|
16
|
+
const firstItem = data[0];
|
|
17
|
+
const name = firstItem[nameKey];
|
|
18
|
+
const value = firstItem[valueKey];
|
|
19
|
+
return {
|
|
20
|
+
tooltip: {
|
|
21
|
+
formatter: tooltipFormatter || `{a} <br/>{b} : {c}%`,
|
|
22
|
+
},
|
|
23
|
+
series: [
|
|
24
|
+
{
|
|
25
|
+
name: title,
|
|
26
|
+
type: 'gauge',
|
|
27
|
+
detail: { formatter: '{value}%' },
|
|
28
|
+
data: [{ value, name }],
|
|
29
|
+
axisLine: {
|
|
30
|
+
lineStyle: {
|
|
31
|
+
width: 30,
|
|
32
|
+
color: [
|
|
33
|
+
[0.33, colors.low],
|
|
34
|
+
[0.66, colors.medium],
|
|
35
|
+
[1, colors.high],
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
pointer: {
|
|
40
|
+
itemStyle: {
|
|
41
|
+
color: 'auto',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}, [colors, nameKey, title, valueKey]);
|
|
48
|
+
return (_jsx(BaseChart, { title: title, detailsModalTitle: metricDetailData.title, url: url, query: query, chartDetails: chartDetails, itemStatisticsQuery: metricDetailData.itemStatisticsQuery, valueMetricsQuery: metricDetailData.valueMetricsQuery, averageMetricsQuery: metricDetailData.averageMetricsQuery, distributionMetricsQuery: metricDetailData.distributionMetricsQuery, yAxisDataNameKey: metricDetailData.yAxisDataNameKey, xAxisNameKey: metricDetailData.xAxisNameKey, xAxisLabel: metricDetailData.xAxisLabel, yAxisLabel: metricDetailData.yAxisLabel, nameKey: metricDetailData.nameKey, valueKey: metricDetailData.valueKey, dataGridSearchKey: metricDetailData.dataGridSearchKey, dataGridColumns: metricDetailData.dataGridColumns, dataSearchInputPlaceHolder: metricDetailData.dataSearchInputPlaceHolder, chartToolTip: metricDetailData.chartToolTip, detailsTableTitle: metricDetailData.detailsTableTitle, getChartOptions: getGaugeOptions, distributionChartTooltip: metricDetailData.distributionChartTooltip, tooltipValueFormat: tooltipValueFormat, tooltipTitle: tooltipTitle, tooltipUnit: tooltipUnit, tooltipAdditionalFields: tooltipAdditionalFields, topFivePerformingChartTitle: metricDetailData.topFiveChartTitle, bottomFivePerformingChartTitle: metricDetailData.bottomFiveChartTitle, showDetailsModal: showDetailsModal, ...props, children: ({ metricData, tooltipFormatterFn }) => {
|
|
49
|
+
const gaugeOptions = getGaugeOptions(metricData, tooltipFormatterFn);
|
|
50
|
+
return (_jsx("div", { className: "mt-4", children: _jsx(ReactECharts, { option: gaugeOptions, style: { height: '350px' } }) }));
|
|
51
|
+
} }));
|
|
52
|
+
};
|
|
53
|
+
export default GaugeChart;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { QueryProps } from 'src/shared/types';
|
|
2
|
+
import type { ChartToolTipProps, DistributionChartTooltip, DistributionQueryProps, StatisticsQueryProps, TableColumn, TooltipField } from '../types';
|
|
3
|
+
interface GroupedBarChartProps<TData extends {
|
|
4
|
+
id: string | number;
|
|
5
|
+
}> {
|
|
6
|
+
title?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
query: QueryProps;
|
|
10
|
+
xAxisLabel: string;
|
|
11
|
+
xAxisValueKey: string;
|
|
12
|
+
rightYAxisValueKey: string;
|
|
13
|
+
leftYAxisValueKey: string;
|
|
14
|
+
chartToolTip: ChartToolTipProps;
|
|
15
|
+
tooltipValueFormat: string;
|
|
16
|
+
tooltipTitle?: string;
|
|
17
|
+
tooltipUnit?: string;
|
|
18
|
+
tooltipAdditionalFields?: (string | TooltipField)[];
|
|
19
|
+
yAxisLabelFormatter?: (value: number) => string;
|
|
20
|
+
metricDetailData: {
|
|
21
|
+
title: string;
|
|
22
|
+
statisticsUrl?: string;
|
|
23
|
+
itemStatisticsQuery: StatisticsQueryProps;
|
|
24
|
+
valueMetricsQuery: StatisticsQueryProps;
|
|
25
|
+
averageMetricsQuery: StatisticsQueryProps;
|
|
26
|
+
distributionMetricsQuery: DistributionQueryProps;
|
|
27
|
+
yAxisDataNameKey: string;
|
|
28
|
+
xAxisNameKey: string;
|
|
29
|
+
xAxisLabel: string;
|
|
30
|
+
yAxisLabel: string;
|
|
31
|
+
nameKey: string;
|
|
32
|
+
valueKey: string;
|
|
33
|
+
dataGridSearchKey: string;
|
|
34
|
+
dataGridColumns: TableColumn<TData>[];
|
|
35
|
+
dataSearchInputPlaceHolder: string;
|
|
36
|
+
chartToolTip?: ChartToolTipProps;
|
|
37
|
+
detailsTableTitle?: string;
|
|
38
|
+
topFiveChartTitle?: string;
|
|
39
|
+
bottomFiveChartTitle?: string;
|
|
40
|
+
distributionChartTooltip: DistributionChartTooltip;
|
|
41
|
+
};
|
|
42
|
+
showDetailsModal?: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare const GroupedBarChart: <TData extends {
|
|
45
|
+
id: string | number;
|
|
46
|
+
}>({ title, className, url, query, xAxisLabel, xAxisValueKey, leftYAxisValueKey, rightYAxisValueKey, tooltipValueFormat, chartToolTip, tooltipTitle, tooltipUnit, tooltipAdditionalFields, yAxisLabelFormatter, metricDetailData, showDetailsModal, ...props }: GroupedBarChartProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export default GroupedBarChart;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import ReactECharts from 'echarts-for-react';
|
|
3
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import Card from '../components/CardWrapper';
|
|
5
|
+
import ChartDetailsModal from '../components/ChartDetailsModal';
|
|
6
|
+
import ChartWrapper from '../components/ChartWrapper';
|
|
7
|
+
import { useChartData } from '../hooks/useChartData';
|
|
8
|
+
import { DashboardPaths, createTooltipFormatter, processTooltipFields } from '../utils';
|
|
9
|
+
import { createDistributionMetricOptions, getGroupedChartOptions } from '../utils/chartOptions';
|
|
10
|
+
const useMetricData = (url, queryConfig) => {
|
|
11
|
+
const { data, error, isEmpty, loading, refresh } = useChartData(url, {
|
|
12
|
+
...queryConfig.query,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
metricData: {
|
|
16
|
+
value: data?.[queryConfig.valueKey] ?? 0,
|
|
17
|
+
previousValue: queryConfig.previousValueKey ? (data?.[queryConfig.previousValueKey] ?? 0) : undefined,
|
|
18
|
+
change: data?.[queryConfig.changeKey] ?? 0,
|
|
19
|
+
title: queryConfig.title,
|
|
20
|
+
format: queryConfig.format,
|
|
21
|
+
isEmpty,
|
|
22
|
+
loading,
|
|
23
|
+
error,
|
|
24
|
+
refresh: () => refresh().catch(() => { }),
|
|
25
|
+
currency: data?.additionalData?.currency,
|
|
26
|
+
},
|
|
27
|
+
data,
|
|
28
|
+
error,
|
|
29
|
+
isEmpty,
|
|
30
|
+
loading,
|
|
31
|
+
refresh,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const GroupedBarChart = ({ title, className = '', url = DashboardPaths.QUERY, query, xAxisLabel, xAxisValueKey, leftYAxisValueKey, rightYAxisValueKey, tooltipValueFormat, chartToolTip, tooltipTitle = 'Value', tooltipUnit = '', tooltipAdditionalFields = [], yAxisLabelFormatter, metricDetailData, showDetailsModal = true, ...props }) => {
|
|
35
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
36
|
+
const { data: metricData = [], error, isEmpty, loading, refresh } = useChartData(url, query);
|
|
37
|
+
const statisticsUrl = metricDetailData?.statisticsUrl ?? DashboardPaths.METRICS;
|
|
38
|
+
const processedTooltipFields = useMemo(() => processTooltipFields(tooltipAdditionalFields), [tooltipAdditionalFields]);
|
|
39
|
+
const processedDistributionTooltipFields = useMemo(() => processTooltipFields(metricDetailData.distributionChartTooltip.tooltipAdditionalFields), [metricDetailData.distributionChartTooltip.tooltipAdditionalFields]);
|
|
40
|
+
const tooltipFormatterFn = useMemo(() => createTooltipFormatter(tooltipValueFormat, tooltipTitle, tooltipUnit, processedTooltipFields, metricData, metricData[0]?.currency), [tooltipTitle, tooltipUnit, processedTooltipFields, metricData, tooltipValueFormat]);
|
|
41
|
+
const createChartOptions = useCallback((data, title, metricDetailData, tooltipConfig) => {
|
|
42
|
+
const tooltipFields = tooltipConfig?.tooltipFields
|
|
43
|
+
? processTooltipFields(tooltipConfig.tooltipFields)
|
|
44
|
+
: processTooltipFields(processedTooltipFields);
|
|
45
|
+
const formatterFn = tooltipConfig
|
|
46
|
+
? createTooltipFormatter(tooltipValueFormat, tooltipConfig.tooltipTitle ?? tooltipTitle, tooltipConfig.tooltipUnit ?? tooltipUnit, tooltipFields, tooltipConfig.data ?? data, tooltipConfig.data?.[0]?.currency ?? data[0]?.currency)
|
|
47
|
+
: tooltipFormatterFn;
|
|
48
|
+
return getGroupedChartOptions({
|
|
49
|
+
leftYAxisValueKey: leftYAxisValueKey,
|
|
50
|
+
rightYAxisValueKey: rightYAxisValueKey,
|
|
51
|
+
xAxisValueKey: xAxisValueKey,
|
|
52
|
+
xAxisLabel: xAxisLabel,
|
|
53
|
+
chartToolTip: {
|
|
54
|
+
...chartToolTip,
|
|
55
|
+
formatter: formatterFn,
|
|
56
|
+
},
|
|
57
|
+
data,
|
|
58
|
+
yAxisLabelFormatter,
|
|
59
|
+
});
|
|
60
|
+
}, [
|
|
61
|
+
tooltipFormatterFn,
|
|
62
|
+
tooltipTitle,
|
|
63
|
+
tooltipUnit,
|
|
64
|
+
processedTooltipFields,
|
|
65
|
+
chartToolTip,
|
|
66
|
+
tooltipValueFormat,
|
|
67
|
+
yAxisLabelFormatter,
|
|
68
|
+
]);
|
|
69
|
+
const createChartOptionsWithData = useCallback((data, tooltipConfig) => createChartOptions(data, title, metricDetailData, tooltipConfig), [title, metricDetailData, createChartOptions]);
|
|
70
|
+
const chartOptions = useMemo(() => createChartOptionsWithData(metricData), [metricData, createChartOptionsWithData]);
|
|
71
|
+
const { metricData: itemMetricsData } = useMetricData(statisticsUrl, metricDetailData.itemStatisticsQuery);
|
|
72
|
+
const { metricData: valueMetricsData } = useMetricData(statisticsUrl, metricDetailData.valueMetricsQuery);
|
|
73
|
+
const { metricData: averageMetricsData } = useMetricData(statisticsUrl, metricDetailData.averageMetricsQuery);
|
|
74
|
+
const { data: fullMetricData = [], error: fullDataError, isEmpty: isfullMetricDataEmpty, loading: isLoadingFullMetricData, refresh: refreshFullMetricData, } = useChartData(url, {
|
|
75
|
+
...query,
|
|
76
|
+
limit: undefined,
|
|
77
|
+
});
|
|
78
|
+
const fullChartOptions = useMemo(() => createChartOptionsWithData(fullMetricData), [fullMetricData, createChartOptionsWithData]);
|
|
79
|
+
const { data: distributionStatData, error: distributionStatDataError, isEmpty: isDistributionStatMetricDataEmpty, loading: isLoadingDistributionStatlMetricData, refresh: refreshDistributionStatMetricData, } = useChartData(url, {
|
|
80
|
+
...metricDetailData.distributionMetricsQuery.query,
|
|
81
|
+
});
|
|
82
|
+
const distributionMetricData = useMemo(() => {
|
|
83
|
+
return createDistributionMetricOptions({
|
|
84
|
+
distributionChartTooltip: metricDetailData.distributionChartTooltip,
|
|
85
|
+
distributionData: distributionStatData ?? [],
|
|
86
|
+
processedTooltipFields: processedDistributionTooltipFields,
|
|
87
|
+
xAxisDataValueKey: metricDetailData.distributionMetricsQuery.xAxisDataValueKey,
|
|
88
|
+
seriesDataValueKey: metricDetailData.distributionMetricsQuery.seriesDataValueKey,
|
|
89
|
+
});
|
|
90
|
+
}, [
|
|
91
|
+
distributionStatData,
|
|
92
|
+
metricDetailData.distributionMetricsQuery.seriesDataValueKey,
|
|
93
|
+
metricDetailData.distributionMetricsQuery.xAxisDataValueKey,
|
|
94
|
+
metricDetailData.distributionChartTooltip,
|
|
95
|
+
processedDistributionTooltipFields,
|
|
96
|
+
]);
|
|
97
|
+
const { topFiveItems, bottomFiveItems } = useMemo(() => {
|
|
98
|
+
if (!fullMetricData || fullMetricData.length === 0) {
|
|
99
|
+
return {
|
|
100
|
+
topFiveItems: [],
|
|
101
|
+
bottomFiveItems: [],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const topFiveMetric = fullMetricData.slice(0, 5);
|
|
105
|
+
const bottomFiveMetric = fullMetricData.slice(-5).reverse();
|
|
106
|
+
return {
|
|
107
|
+
topFiveItems: createChartOptionsWithData(topFiveMetric, {
|
|
108
|
+
tooltipTitle: metricDetailData.topFiveChartTitle,
|
|
109
|
+
tooltipUnit,
|
|
110
|
+
tooltipFields: processedTooltipFields,
|
|
111
|
+
data: topFiveMetric,
|
|
112
|
+
}),
|
|
113
|
+
bottomFiveItems: createChartOptionsWithData(bottomFiveMetric, {
|
|
114
|
+
tooltipTitle: metricDetailData.bottomFiveChartTitle,
|
|
115
|
+
tooltipUnit,
|
|
116
|
+
tooltipFields: processedTooltipFields,
|
|
117
|
+
data: bottomFiveMetric,
|
|
118
|
+
}),
|
|
119
|
+
};
|
|
120
|
+
}, [fullMetricData, createChartOptionsWithData, tooltipUnit, processedTooltipFields, metricDetailData]);
|
|
121
|
+
return (_jsxs(_Fragment, { children: [_jsx(Card, { title: title, ...props, onOpenDetails: metricData ? () => setIsModalOpen(true) : undefined, children: _jsx(ChartWrapper, { loading: loading, error: error, isEmpty: isEmpty, onRetry: refresh, children: _jsx("div", { className: "mt-[19px]", children: _jsx(ReactECharts, { option: chartOptions, style: { height: '100%', minHeight: '340px' }, className: "h-[340px] md:h-[400px]", opts: { renderer: 'canvas' }, notMerge: true }) }) }) }), showDetailsModal && (_jsx(ChartDetailsModal, { title: metricDetailData.title, isOpen: isModalOpen, onClose: () => setIsModalOpen(false), data: fullMetricData, columns: metricDetailData.dataGridColumns, error: fullDataError, isEmpty: isfullMetricDataEmpty, loading: isLoadingFullMetricData, detailsTableTitle: metricDetailData.detailsTableTitle, refresh: refreshFullMetricData, renderDetailsChart: fullMetricData.length <= 40, top5PerformingItems: topFiveItems, bottom5NonPerformingItems: bottomFiveItems, chartData: fullChartOptions, valueKey: metricDetailData.valueKey, dataGridQuery: query, searchKey: metricDetailData.dataGridSearchKey, searchInputPlaceHolder: metricDetailData.dataSearchInputPlaceHolder, itemMetricsData: itemMetricsData, valueMetricsData: valueMetricsData, averageMetricsData: averageMetricsData, distributionMetricsData: {
|
|
122
|
+
data: distributionMetricData ?? [],
|
|
123
|
+
title: metricDetailData.distributionMetricsQuery.title,
|
|
124
|
+
isEmpty: isDistributionStatMetricDataEmpty,
|
|
125
|
+
loading: isLoadingDistributionStatlMetricData,
|
|
126
|
+
error: distributionStatDataError,
|
|
127
|
+
refresh: () => refreshDistributionStatMetricData().catch(() => { }),
|
|
128
|
+
chartToolTip: metricDetailData.distributionMetricsQuery.chartToolTip,
|
|
129
|
+
} }))] }));
|
|
130
|
+
};
|
|
131
|
+
export default GroupedBarChart;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { QueryProps } from 'src/shared/types';
|
|
2
|
+
import type { ChartToolTipProps, DistributionQueryProps, StatisticsQueryProps, TableColumn } from '../types';
|
|
3
|
+
interface HeatmapChartProps<TData extends {
|
|
4
|
+
id: string | number;
|
|
5
|
+
}> {
|
|
6
|
+
title?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
query: QueryProps;
|
|
9
|
+
xAxisKey: string;
|
|
10
|
+
yAxisKey: string;
|
|
11
|
+
valueKey: string;
|
|
12
|
+
colorRange?: [string, string];
|
|
13
|
+
tooltipTitle?: string;
|
|
14
|
+
tooltipUnit?: string;
|
|
15
|
+
visualMapLabels?: [string, string];
|
|
16
|
+
visualMapRange?: [number, number];
|
|
17
|
+
visualMapConfig?: {
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
calculable?: boolean;
|
|
21
|
+
orient?: 'horizontal' | 'vertical';
|
|
22
|
+
left?: string | number;
|
|
23
|
+
right?: string | number;
|
|
24
|
+
top?: string | number;
|
|
25
|
+
bottom?: string | number;
|
|
26
|
+
show?: boolean;
|
|
27
|
+
precision?: number;
|
|
28
|
+
text?: [string, string];
|
|
29
|
+
textStyle?: {
|
|
30
|
+
color?: string;
|
|
31
|
+
fontSize?: number;
|
|
32
|
+
};
|
|
33
|
+
inRange?: {
|
|
34
|
+
color?: string[];
|
|
35
|
+
opacity?: number[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
grid?: {
|
|
39
|
+
top?: number | string;
|
|
40
|
+
bottom?: number | string;
|
|
41
|
+
left?: number | string;
|
|
42
|
+
right?: number | string;
|
|
43
|
+
};
|
|
44
|
+
showSplitArea?: boolean;
|
|
45
|
+
splitAreaConfig?: {
|
|
46
|
+
show?: boolean;
|
|
47
|
+
areaStyle?: {
|
|
48
|
+
color?: string[];
|
|
49
|
+
opacity?: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
xAxisLabelFormatter?: (label: string) => string;
|
|
53
|
+
yAxisLabelFormatter?: (label: string) => string;
|
|
54
|
+
transformData?: (data: any[], xAxisKey: string, yAxisKey: string, valueKey: string) => {
|
|
55
|
+
xAxis: string[];
|
|
56
|
+
yAxis: string[];
|
|
57
|
+
data: [number, number, number][];
|
|
58
|
+
};
|
|
59
|
+
metricDetailData?: {
|
|
60
|
+
statisticsUrl?: string;
|
|
61
|
+
title: string;
|
|
62
|
+
itemStatisticsQuery: StatisticsQueryProps;
|
|
63
|
+
valueMetricsQuery: StatisticsQueryProps;
|
|
64
|
+
averageMetricsQuery: StatisticsQueryProps;
|
|
65
|
+
distributionMetricsQuery: DistributionQueryProps;
|
|
66
|
+
nameKey: string;
|
|
67
|
+
valueKey: string;
|
|
68
|
+
dataGridSearchKey: string;
|
|
69
|
+
dataGridColumns: TableColumn<TData>[];
|
|
70
|
+
dataSearchInputPlaceHolder: string;
|
|
71
|
+
chartToolTip?: ChartToolTipProps;
|
|
72
|
+
detailsTableTitle?: string;
|
|
73
|
+
};
|
|
74
|
+
showDetailsModal?: boolean;
|
|
75
|
+
}
|
|
76
|
+
declare const HeatmapChart: <TData extends {
|
|
77
|
+
id: string | number;
|
|
78
|
+
}>({ title, url, query, xAxisKey, yAxisKey, valueKey, colorRange, tooltipTitle, tooltipUnit, visualMapLabels, visualMapRange, visualMapConfig, grid, showSplitArea, splitAreaConfig, xAxisLabelFormatter, yAxisLabelFormatter, transformData, metricDetailData, showDetailsModal, }: HeatmapChartProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export default HeatmapChart;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactECharts from 'echarts-for-react';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import Card from '../components/CardWrapper';
|
|
5
|
+
import ChartWrapper from '../components/ChartWrapper';
|
|
6
|
+
import { useChartData } from '../hooks/useChartData';
|
|
7
|
+
import { DashboardPaths, getHeatmapData } from '../utils';
|
|
8
|
+
const HeatmapChart = ({ title, url = DashboardPaths.QUERY, query, xAxisKey, yAxisKey, valueKey, colorRange = ['#d73027', '#1a9850'], tooltipTitle = 'Value', tooltipUnit = '', visualMapLabels = ['Low', 'High'], visualMapRange = [0, 100], visualMapConfig, grid = { top: 60, bottom: 120, left: 120, right: 60 }, showSplitArea = false, splitAreaConfig, xAxisLabelFormatter, yAxisLabelFormatter, transformData, metricDetailData, showDetailsModal = true, }) => {
|
|
9
|
+
const { data: metricData = [], error, isEmpty, loading, refresh } = useChartData(url, query);
|
|
10
|
+
const chartData = useMemo(() => {
|
|
11
|
+
if (!metricData.length)
|
|
12
|
+
return { xAxis: [], yAxis: [], data: [] };
|
|
13
|
+
// Use custom transformData function if provided, otherwise use generic getHeatmapData
|
|
14
|
+
const transformFunction = transformData || getHeatmapData;
|
|
15
|
+
const { xAxis, yAxis, data } = transformFunction(metricData, xAxisKey, yAxisKey, valueKey);
|
|
16
|
+
// Apply formatters to axis categories if provided
|
|
17
|
+
const formattedXAxis = xAxis.map((category) => {
|
|
18
|
+
if (xAxisLabelFormatter) {
|
|
19
|
+
return xAxisLabelFormatter(category);
|
|
20
|
+
}
|
|
21
|
+
return category;
|
|
22
|
+
});
|
|
23
|
+
const formattedYAxis = yAxis.map((category) => {
|
|
24
|
+
if (yAxisLabelFormatter) {
|
|
25
|
+
return yAxisLabelFormatter(category);
|
|
26
|
+
}
|
|
27
|
+
return category;
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
xAxis: formattedXAxis,
|
|
31
|
+
yAxis: formattedYAxis,
|
|
32
|
+
data,
|
|
33
|
+
};
|
|
34
|
+
}, [metricData, xAxisKey, yAxisKey, valueKey, transformData, xAxisLabelFormatter, yAxisLabelFormatter]);
|
|
35
|
+
const dataRange = useMemo(() => {
|
|
36
|
+
if (chartData.data.length === 0)
|
|
37
|
+
return visualMapRange;
|
|
38
|
+
// Extract values from the heatmap data (third element in each array)
|
|
39
|
+
const values = chartData.data
|
|
40
|
+
.map((item) => item[2])
|
|
41
|
+
.filter((val) => typeof val === 'number');
|
|
42
|
+
if (values.length === 0)
|
|
43
|
+
return visualMapRange;
|
|
44
|
+
const min = Math.min(...values);
|
|
45
|
+
const max = Math.max(...values);
|
|
46
|
+
// Ensure we have a proper range for the visual map
|
|
47
|
+
return min === max ? [0, Math.max(max, 1)] : [min, max];
|
|
48
|
+
}, [chartData.data, visualMapRange]);
|
|
49
|
+
const chartOptions = useMemo(() => ({
|
|
50
|
+
tooltip: {
|
|
51
|
+
position: 'top',
|
|
52
|
+
formatter: ({ value }) => {
|
|
53
|
+
if (!value || value.length < 3)
|
|
54
|
+
return '';
|
|
55
|
+
const xLabel = chartData.xAxis[value[0]];
|
|
56
|
+
const yLabel = chartData.yAxis[value[1]];
|
|
57
|
+
const dataValue = value[2];
|
|
58
|
+
return `
|
|
59
|
+
<div>
|
|
60
|
+
<strong>${tooltipTitle}</strong><br/>
|
|
61
|
+
${yAxisKey}: ${yLabel}<br/>
|
|
62
|
+
${xAxisKey}: ${xLabel}<br/>
|
|
63
|
+
${valueKey}: ${dataValue.toLocaleString()} ${tooltipUnit}
|
|
64
|
+
</div>
|
|
65
|
+
`;
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
grid: { ...grid, containLabel: true },
|
|
69
|
+
xAxis: {
|
|
70
|
+
type: 'category',
|
|
71
|
+
data: chartData.xAxis,
|
|
72
|
+
splitArea: {
|
|
73
|
+
show: showSplitArea,
|
|
74
|
+
...splitAreaConfig,
|
|
75
|
+
},
|
|
76
|
+
axisLabel: {
|
|
77
|
+
rotate: 0,
|
|
78
|
+
fontSize: 11,
|
|
79
|
+
interval: 0,
|
|
80
|
+
margin: 10,
|
|
81
|
+
overflow: 'none',
|
|
82
|
+
width: 80,
|
|
83
|
+
textStyle: {
|
|
84
|
+
fontSize: 11,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
axisTick: { alignWithLabel: true },
|
|
88
|
+
},
|
|
89
|
+
yAxis: {
|
|
90
|
+
type: 'category',
|
|
91
|
+
data: chartData.yAxis,
|
|
92
|
+
splitArea: {
|
|
93
|
+
show: showSplitArea,
|
|
94
|
+
...splitAreaConfig,
|
|
95
|
+
},
|
|
96
|
+
axisLabel: {
|
|
97
|
+
fontSize: 11,
|
|
98
|
+
margin: 8,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
visualMap: {
|
|
102
|
+
min: visualMapConfig?.min ?? dataRange[0],
|
|
103
|
+
max: visualMapConfig?.max ?? dataRange[1],
|
|
104
|
+
calculable: visualMapConfig?.calculable ?? true,
|
|
105
|
+
orient: visualMapConfig?.orient ?? 'horizontal',
|
|
106
|
+
left: visualMapConfig?.left ?? 'center',
|
|
107
|
+
right: visualMapConfig?.right,
|
|
108
|
+
top: visualMapConfig?.top,
|
|
109
|
+
bottom: visualMapConfig?.bottom ?? '5%',
|
|
110
|
+
show: visualMapConfig?.show ?? true,
|
|
111
|
+
precision: visualMapConfig?.precision ?? 0,
|
|
112
|
+
text: visualMapConfig?.text ?? [visualMapLabels[1], visualMapLabels[0]],
|
|
113
|
+
textStyle: visualMapConfig?.textStyle,
|
|
114
|
+
inRange: {
|
|
115
|
+
color: visualMapConfig?.inRange?.color ?? colorRange,
|
|
116
|
+
...visualMapConfig?.inRange,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
series: [
|
|
120
|
+
{
|
|
121
|
+
name: title,
|
|
122
|
+
type: 'heatmap',
|
|
123
|
+
data: chartData.data,
|
|
124
|
+
label: { show: true, fontSize: 10 },
|
|
125
|
+
emphasis: { itemStyle: { shadowBlur: 10, shadowColor: 'rgba(0,0,0,0.5)' } },
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
}), [
|
|
129
|
+
chartData,
|
|
130
|
+
colorRange,
|
|
131
|
+
title,
|
|
132
|
+
tooltipTitle,
|
|
133
|
+
tooltipUnit,
|
|
134
|
+
xAxisKey,
|
|
135
|
+
yAxisKey,
|
|
136
|
+
valueKey,
|
|
137
|
+
dataRange,
|
|
138
|
+
grid,
|
|
139
|
+
visualMapConfig,
|
|
140
|
+
visualMapLabels,
|
|
141
|
+
showSplitArea,
|
|
142
|
+
splitAreaConfig,
|
|
143
|
+
]);
|
|
144
|
+
return (_jsx(Card, { title: title, children: _jsx(ChartWrapper, { loading: loading, error: error, isEmpty: isEmpty, onRetry: refresh, children: _jsx(ReactECharts, { option: chartOptions, style: { height: '400px', width: '100%', minWidth: '600px' } }) }) }));
|
|
145
|
+
};
|
|
146
|
+
export default HeatmapChart;
|