@wavemaker/react-runtime 11.14.1-15.6409
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/actions/base-action.js +32 -0
- package/actions/login-action.js +53 -0
- package/actions/logout-action.js +41 -0
- package/actions/navigation-action.js +145 -0
- package/actions/notification-action.js +147 -0
- package/actions/timer-action.js +164 -0
- package/actions/toast-provider.js +111 -0
- package/actions/toast.js +115 -0
- package/actions/toast.service.js +94 -0
- package/actions/types/index.js +11 -0
- package/components/advanced/carousel/index.js +456 -0
- package/components/advanced/carousel/props.js +5 -0
- package/components/advanced/carousel/template.js +72 -0
- package/components/advanced/login/index.js +307 -0
- package/components/advanced/login/props.js +5 -0
- package/components/advanced/marquee/index.js +158 -0
- package/components/advanced/marquee/props.js +5 -0
- package/components/basic/anchor/index.js +239 -0
- package/components/basic/anchor/props.js +5 -0
- package/components/basic/audio/index.js +61 -0
- package/components/basic/html/index.js +158 -0
- package/components/basic/icon/index.js +85 -0
- package/components/basic/iframe/iframe.utils.js +10 -0
- package/components/basic/iframe/index.js +95 -0
- package/components/basic/label/index.js +139 -0
- package/components/basic/message/index.js +120 -0
- package/components/basic/message/props.js +5 -0
- package/components/basic/picture/index.js +117 -0
- package/components/basic/picture/props.js +5 -0
- package/components/basic/progress-bar/index.js +168 -0
- package/components/basic/progress-bar/props.js +18 -0
- package/components/basic/progress-circle/index.js +196 -0
- package/components/basic/progress-circle/props.js +16 -0
- package/components/basic/richtexteditor/index.js +533 -0
- package/components/basic/richtexteditor/props.js +5 -0
- package/components/basic/search/index.js +1023 -0
- package/components/basic/search/props.js +5 -0
- package/components/basic/search/providers.js +350 -0
- package/components/basic/spinner/index.js +202 -0
- package/components/basic/spinner/props.js +12 -0
- package/components/basic/tile/index.js +91 -0
- package/components/basic/tree/Components/TreeNodeComponent.js +142 -0
- package/components/basic/tree/index.js +503 -0
- package/components/basic/tree/props.js +5 -0
- package/components/basic/tree/utils.js +154 -0
- package/components/basic/video/index.js +85 -0
- package/components/basic/video/props.js +5 -0
- package/components/chart/components/barColumnChart/index.js +132 -0
- package/components/chart/components/barColumnChart/props.js +5 -0
- package/components/chart/components/bubbleChart/index.js +176 -0
- package/components/chart/components/bubbleChart/props.js +5 -0
- package/components/chart/components/chartLegend/components/ClassicLegendItem.js +39 -0
- package/components/chart/components/chartLegend/components/FuriousLegendItem.js +81 -0
- package/components/chart/components/chartLegend/index.js +69 -0
- package/components/chart/components/chartLegend/props.js +5 -0
- package/components/chart/components/chartLegend/utils.js +31 -0
- package/components/chart/components/chartTooltip/index.js +53 -0
- package/components/chart/components/chartTooltip/styles.js +37 -0
- package/components/chart/components/chartTooltip/utils.js +23 -0
- package/components/chart/components/cumulativeLineChart/index.js +113 -0
- package/components/chart/components/cumulativeLineChart/props.js +5 -0
- package/components/chart/components/cumulativeLineChart/utils.js +34 -0
- package/components/chart/components/index.js +40 -0
- package/components/chart/components/lineAreaChart/index.js +140 -0
- package/components/chart/components/lineAreaChart/props.js +5 -0
- package/components/chart/components/noDataMessage/index.js +27 -0
- package/components/chart/components/pieDonutChart/index.js +171 -0
- package/components/chart/components/pieDonutChart/props.js +5 -0
- package/components/chart/constant.js +72 -0
- package/components/chart/index.js +930 -0
- package/components/chart/props.js +5 -0
- package/components/chart/utils.js +691 -0
- package/components/common/AppSpinner.js +36 -0
- package/components/common/app-spinner.js +26 -0
- package/components/common/index.js +12 -0
- package/components/constants.js +1208 -0
- package/components/container/accordion/accordion-pane/index.js +108 -0
- package/components/container/accordion/accordion-pane/props.js +11 -0
- package/components/container/accordion/index.js +232 -0
- package/components/container/accordion/props.js +13 -0
- package/components/container/alignment-utils.js +183 -0
- package/components/container/index.js +188 -0
- package/components/container/layout-grid/grid-column/index.js +34 -0
- package/components/container/layout-grid/grid-row/index.js +24 -0
- package/components/container/layout-grid/index.js +33 -0
- package/components/container/linear-layout/index.js +72 -0
- package/components/container/linear-layout/linear-layout-item/index.js +43 -0
- package/components/container/panel/components/panel-header/index.js +144 -0
- package/components/container/panel/components/panel-header/props.js +5 -0
- package/components/container/panel/hooks.js +144 -0
- package/components/container/panel/index.js +286 -0
- package/components/container/panel/props.js +5 -0
- package/components/container/props.js +5 -0
- package/components/container/tabs/index.js +379 -0
- package/components/container/tabs/props.js +20 -0
- package/components/container/tabs/tab-pane/index.js +42 -0
- package/components/container/tabs/tab-pane/props.js +5 -0
- package/components/container/wizard/WizardContext.js +16 -0
- package/components/container/wizard/components/StepComponents.js +100 -0
- package/components/container/wizard/components/WizardStep.js +89 -0
- package/components/container/wizard/index.js +710 -0
- package/components/container/wizard/props.js +5 -0
- package/components/container/wizard/utils.js +133 -0
- package/components/container/wizard/wizard-action/index.js +22 -0
- package/components/container/wizard/wizard-step/index.js +94 -0
- package/components/data/card/card-actions/index.js +24 -0
- package/components/data/card/card-content/index.js +38 -0
- package/components/data/card/card-footer/index.js +24 -0
- package/components/data/card/index.js +246 -0
- package/components/data/card/props.js +5 -0
- package/components/data/form/base-form/constant.js +39 -0
- package/components/data/form/base-form/index.js +460 -0
- package/components/data/form/base-form/props.js +29 -0
- package/components/data/form/base-form/utils.js +42 -0
- package/components/data/form/dynamic-fields/index.js +196 -0
- package/components/data/form/dynamic-fields/props.js +5 -0
- package/components/data/form/dynamic-fields/utils.js +237 -0
- package/components/data/form/form-action/index.js +71 -0
- package/components/data/form/form-body/index.js +26 -0
- package/components/data/form/form-context.js +34 -0
- package/components/data/form/form-controller/props.js +19 -0
- package/components/data/form/form-controller/validation-contrustor.js +313 -0
- package/components/data/form/form-controller/withFormController.js +320 -0
- package/components/data/form/form-field/base-field.js +138 -0
- package/components/data/form/form-field/index.js +36 -0
- package/components/data/form/form-field/props.js +5 -0
- package/components/data/form/form-footer/index.js +26 -0
- package/components/data/form/form-header/index.js +56 -0
- package/components/data/form/index.js +39 -0
- package/components/data/form/props.js +5 -0
- package/components/data/list/components/GroupHeader.js +35 -0
- package/components/data/list/components/GroupedListItems.js +98 -0
- package/components/data/list/components/ListContainer.js +27 -0
- package/components/data/list/components/ListDND.js +241 -0
- package/components/data/list/components/ListHeader.js +59 -0
- package/components/data/list/components/ListItem.js +148 -0
- package/components/data/list/components/ListItemWithTemplate.js +59 -0
- package/components/data/list/components/ListItems.js +231 -0
- package/components/data/list/components/ListPagination.js +165 -0
- package/components/data/list/components/LoadMoreButton.js +39 -0
- package/components/data/list/components/NoDataMessage.js +22 -0
- package/components/data/list/components/StandardListItems.js +84 -0
- package/components/data/list/components/index.js +119 -0
- package/components/data/list/components/props.js +5 -0
- package/components/data/list/hooks/index.js +75 -0
- package/components/data/list/hooks/props.js +5 -0
- package/components/data/list/hooks/useCurrentPageItems.js +48 -0
- package/components/data/list/hooks/useGroupedData.js +37 -0
- package/components/data/list/hooks/useListData.js +60 -0
- package/components/data/list/hooks/useListEffects.js +285 -0
- package/components/data/list/hooks/useListEventHandlers.js +291 -0
- package/components/data/list/hooks/useListPagination.js +168 -0
- package/components/data/list/hooks/useListState.js +98 -0
- package/components/data/list/hooks/useListStateManager.js +195 -0
- package/components/data/list/hooks/usePaginatedGroupedData.js +121 -0
- package/components/data/list/index.js +611 -0
- package/components/data/list/props.js +5 -0
- package/components/data/list/templates/media-template.js +53 -0
- package/components/data/list/utils/constants.js +81 -0
- package/components/data/list/utils/list-helpers.js +173 -0
- package/components/data/list/utils/list-widget-methods.js +114 -0
- package/components/data/live-filter/index.js +279 -0
- package/components/data/live-filter/props.js +12 -0
- package/components/data/live-form/index.js +93 -0
- package/components/data/live-form/props.js +16 -0
- package/components/data/pagination/components/BasicPagination.js +77 -0
- package/components/data/pagination/components/ClassicPagination.js +191 -0
- package/components/data/pagination/components/InlinePagination.js +99 -0
- package/components/data/pagination/components/LoadingComponent.js +31 -0
- package/components/data/pagination/components/PageSizeSelector.js +175 -0
- package/components/data/pagination/components/PagerNavigation.js +105 -0
- package/components/data/pagination/components/TotalRecords.js +52 -0
- package/components/data/pagination/components/index.js +47 -0
- package/components/data/pagination/components/props.js +5 -0
- package/components/data/pagination/hooks/index.js +19 -0
- package/components/data/pagination/hooks/props.js +5 -0
- package/components/data/pagination/hooks/useNavigationSize.js +44 -0
- package/components/data/pagination/hooks/usePagination.js +796 -0
- package/components/data/pagination/index.js +322 -0
- package/components/data/table/components/AddNewRow.js +190 -0
- package/components/data/table/components/EditableCell.js +91 -0
- package/components/data/table/components/FieldValidationError.js +24 -0
- package/components/data/table/components/RowExpansionButton.js +74 -0
- package/components/data/table/components/TableBody.js +279 -0
- package/components/data/table/components/TableFilters.js +325 -0
- package/components/data/table/components/TableFooterActions.js +48 -0
- package/components/data/table/components/TableHeader.js +174 -0
- package/components/data/table/components/TablePanelHeading.js +68 -0
- package/components/data/table/components/index.js +74 -0
- package/components/data/table/hooks/index.js +219 -0
- package/components/data/table/hooks/useCellState.js +117 -0
- package/components/data/table/hooks/useDynamicColumns.js +85 -0
- package/components/data/table/hooks/useEditingState.js +47 -0
- package/components/data/table/hooks/useFormWidget.js +184 -0
- package/components/data/table/hooks/usePaginationState.js +60 -0
- package/components/data/table/hooks/usePanelStructure.js +40 -0
- package/components/data/table/hooks/useResponsiveColumns.js +34 -0
- package/components/data/table/hooks/useRowExpansion.js +110 -0
- package/components/data/table/hooks/useRowHandlers.js +38 -0
- package/components/data/table/hooks/useRowSelection.js +213 -0
- package/components/data/table/hooks/useServerSideSorting.js +165 -0
- package/components/data/table/hooks/useTableColumns.js +263 -0
- package/components/data/table/hooks/useTableData.js +154 -0
- package/components/data/table/hooks/useTableEdit.js +467 -0
- package/components/data/table/hooks/useTableEffects.js +139 -0
- package/components/data/table/hooks/useTableFilter.js +389 -0
- package/components/data/table/hooks/useTableInitialization.js +103 -0
- package/components/data/table/hooks/useTableState.js +69 -0
- package/components/data/table/hooks/useTableStateManager.js +558 -0
- package/components/data/table/index.js +1295 -0
- package/components/data/table/live-table/index.js +232 -0
- package/components/data/table/props.js +5 -0
- package/components/data/table/table-action/index.js +78 -0
- package/components/data/table/table-column/index.js +35 -0
- package/components/data/table/table-row/index.js +49 -0
- package/components/data/table/table-row-action/index.js +74 -0
- package/components/data/table/utils/buildSelectionColumns.js +173 -0
- package/components/data/table/utils/columnBuilder.js +209 -0
- package/components/data/table/utils/columnProxy.js +48 -0
- package/components/data/table/utils/columnWidthDistribution.js +98 -0
- package/components/data/table/utils/constants.js +80 -0
- package/components/data/table/utils/crud-handlers.js +518 -0
- package/components/data/table/utils/dynamic-columns.js +118 -0
- package/components/data/table/utils/index.js +607 -0
- package/components/data/table/utils/renderDisplayCell.js +183 -0
- package/components/data/table/utils/selectionUtils.js +166 -0
- package/components/data/table/utils/table-helpers.js +100 -0
- package/components/data/table/utils/validation.js +124 -0
- package/components/data/types.js +113 -0
- package/components/data/utils/field-data-utils.js +66 -0
- package/components/data/utils/filter-field-util.js +81 -0
- package/components/data/utils/index.js +216 -0
- package/components/dialogs/alert-dialog/index.js +80 -0
- package/components/dialogs/confirm-dialog/index.js +105 -0
- package/components/dialogs/dialog/index.js +56 -0
- package/components/dialogs/dialog-actions/index.js +18 -0
- package/components/dialogs/dialog-body/index.js +21 -0
- package/components/dialogs/dialog-content/index.js +30 -0
- package/components/dialogs/dialog-header/index.js +93 -0
- package/components/dialogs/iframe-dialog/index.js +114 -0
- package/components/dialogs/index.js +129 -0
- package/components/dialogs/login-dialog/index.js +369 -0
- package/components/dialogs/login-dialog/props.js +5 -0
- package/components/dialogs/page-dialog/index.js +96 -0
- package/components/dialogs/withDialogWrapper.js +108 -0
- package/components/form/button/index.js +216 -0
- package/components/form/button-group/index.js +60 -0
- package/components/input/calendar/index.js +546 -0
- package/components/input/calendar/props.js +5 -0
- package/components/input/calendar/utils.js +340 -0
- package/components/input/chips/SortableChip/index.js +115 -0
- package/components/input/chips/SortableChip/props.js +5 -0
- package/components/input/chips/index.js +488 -0
- package/components/input/chips/props.js +5 -0
- package/components/input/chips/utils.js +259 -0
- package/components/input/color-picker/index.js +678 -0
- package/components/input/color-picker/props.js +5 -0
- package/components/input/composite/index.js +137 -0
- package/components/input/currency/index.js +263 -0
- package/components/input/currency/props.js +5 -0
- package/components/input/default/checkbox/index.js +230 -0
- package/components/input/default/checkbox/props.js +5 -0
- package/components/input/default/checkboxset/index.js +476 -0
- package/components/input/default/checkboxset/props.js +5 -0
- package/components/input/default/radioset/index.js +379 -0
- package/components/input/default/radioset/props.js +5 -0
- package/components/input/default/switch/index.js +490 -0
- package/components/input/default/switch/prop.js +5 -0
- package/components/input/epoch/date/components/DatePickerPopover.js +220 -0
- package/components/input/epoch/date/index.js +520 -0
- package/components/input/epoch/date/props.js +5 -0
- package/components/input/epoch/date/styled.js +70 -0
- package/components/input/epoch/date/utils.js +108 -0
- package/components/input/epoch/datetime/index.js +656 -0
- package/components/input/epoch/datetime/props.js +5 -0
- package/components/input/epoch/datetime/styled.js +90 -0
- package/components/input/epoch/datetime/utils.js +244 -0
- package/components/input/epoch/time/index.js +412 -0
- package/components/input/epoch/time/props.js +5 -0
- package/components/input/epoch/time/utils.js +209 -0
- package/components/input/fileupload/Utils.js +134 -0
- package/components/input/fileupload/components/ListItems.js +140 -0
- package/components/input/fileupload/components/MultiUpload.js +85 -0
- package/components/input/fileupload/components/SingleUpload.js +65 -0
- package/components/input/fileupload/index.js +170 -0
- package/components/input/fileupload/props.js +5 -0
- package/components/input/fileupload/useFileUpload.js +400 -0
- package/components/input/number/index.js +295 -0
- package/components/input/number/props.js +5 -0
- package/components/input/rating/index.js +368 -0
- package/components/input/rating/props.js +5 -0
- package/components/input/select/index.js +344 -0
- package/components/input/select/props.js +5 -0
- package/components/input/slider/index.js +167 -0
- package/components/input/slider/props.js +5 -0
- package/components/input/text/index.js +434 -0
- package/components/input/text/props.js +5 -0
- package/components/input/text/util.js +179 -0
- package/components/input/textarea/index.js +347 -0
- package/components/input/textarea/props.js +5 -0
- package/components/layout/footer/index.js +30 -0
- package/components/layout/header/index.js +30 -0
- package/components/layout/leftnav/index.js +44 -0
- package/components/layout/rightnav/index.js +32 -0
- package/components/layout/topnav/index.js +34 -0
- package/components/navbar/index.js +41 -0
- package/components/navbar/nav/index.js +102 -0
- package/components/navbar/nav/props.js +5 -0
- package/components/navbar/nav-item/index.js +44 -0
- package/components/navigation/breadcrumb/index.js +56 -0
- package/components/navigation/breadcrumb/props.js +5 -0
- package/components/navigation/menu/components/ListItems.js +66 -0
- package/components/navigation/menu/constants.js +101 -0
- package/components/navigation/menu/index.js +807 -0
- package/components/navigation/menu/props.js +5 -0
- package/components/navigation/popover/index.js +209 -0
- package/components/navigation/popover/props.js +15 -0
- package/components/page/content/index.js +28 -0
- package/components/page/error-boundary/index.js +108 -0
- package/components/page/index.js +137 -0
- package/components/page/page-content/index.js +23 -0
- package/components/page/partial/index.js +36 -0
- package/components/page/partial-container/index.js +48 -0
- package/components/page/props.js +5 -0
- package/components/page/toast-container/index.js +33 -0
- package/components/prefab/container/index.js +46 -0
- package/components/prefab/index.js +67 -0
- package/context/AppContext.js +25 -0
- package/context/AppSpinnerProvider.js +43 -0
- package/context/LocalizationProvider.js +79 -0
- package/context/PrefabContext.js +66 -0
- package/context/WidgetProvider.js +187 -0
- package/core/app-config.js +1 -0
- package/core/app.service.js +357 -0
- package/core/appVariablesStore.js +20 -0
- package/core/appstore.js +88 -0
- package/core/constants/currency-constant.js +1071 -0
- package/core/constants/events.js +34 -0
- package/core/constants/index.js +27 -0
- package/core/dialog.service.js +76 -0
- package/core/event-notifier.js +151 -0
- package/core/formatter/date-formatters.js +222 -0
- package/core/formatter/index.js +131 -0
- package/core/formatter/number-formatters.js +142 -0
- package/core/formatter/security-formatters.js +323 -0
- package/core/formatter/string-formatters.js +52 -0
- package/core/formatter/types.js +18 -0
- package/core/formatters.js +24 -0
- package/core/proxy-service.js +412 -0
- package/core/script-registry.js +63 -0
- package/core/security.service.js +11 -0
- package/core/util/common.js +33 -0
- package/core/util/dom.js +107 -0
- package/core/util/index.js +136 -0
- package/core/util/security.js +184 -0
- package/core/util/utils.js +189 -0
- package/core/widget-observer.js +98 -0
- package/higherOrder/BaseApp.js +430 -0
- package/higherOrder/BaseAppProps.js +5 -0
- package/higherOrder/BaseDateTime.js +251 -0
- package/higherOrder/BasePage.js +715 -0
- package/higherOrder/BasePartial.js +124 -0
- package/higherOrder/BasePrefab.js +145 -0
- package/higherOrder/DataNav.js +377 -0
- package/higherOrder/helper.js +43 -0
- package/higherOrder/props.js +5 -0
- package/higherOrder/withBaseWrapper.js +183 -0
- package/hooks/useAccess.js +308 -0
- package/hooks/useAppConfig.js +42 -0
- package/hooks/useAuth.js +562 -0
- package/hooks/useDataSourceSubscription.js +125 -0
- package/hooks/useDebounce.js +76 -0
- package/hooks/useDeviceVisibility.js +49 -0
- package/hooks/useHttp.js +338 -0
- package/libs/index.js +20 -0
- package/mui-config/theme-provider.js +17 -0
- package/mui-config/theme.js +371 -0
- package/package-lock.json +10177 -0
- package/package.json +95 -0
- package/store/index.js +33 -0
- package/store/middleware/navigationMiddleware.js +48 -0
- package/store/slices/appConfigSlice.js +103 -0
- package/store/slices/authSlice.js +508 -0
- package/store/slices/i18nSlice.js +206 -0
- package/types/index.js +15 -0
- package/utils/dataset-util.js +174 -0
- package/utils/eval-expression.js +32 -0
- package/utils/form-state.util.js +140 -0
- package/utils/form-utils.js +187 -0
- package/utils/format-util.js +260 -0
- package/utils/page-params-util.js +24 -0
- package/utils/resource-url.js +27 -0
- package/utils/state-persistance.js +343 -0
- package/utils/style-utils.js +73 -0
- package/utils/transformedDataset-utils.js +633 -0
- package/utils/widget-cleanup-util.js +84 -0
- package/utils/widgets.js +99 -0
- package/variables/base-variable.js +173 -0
- package/variables/constants.js +27 -0
- package/variables/live-variable.js +166 -0
- package/variables/model-variable.js +77 -0
- package/variables/service-variable.js +307 -0
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _material = require("@mui/material");
|
|
15
|
+
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
16
|
+
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
17
|
+
var _lodash = require("lodash");
|
|
18
|
+
var _utils = require("./utils");
|
|
19
|
+
var _constant = require("./constant");
|
|
20
|
+
var _noDataMessage = require("./components/noDataMessage");
|
|
21
|
+
var _barColumnChart = require("./components/barColumnChart");
|
|
22
|
+
var _lineAreaChart = require("./components/lineAreaChart");
|
|
23
|
+
var _bubbleChart = require("./components/bubbleChart");
|
|
24
|
+
var _cumulativeLineChart = require("./components/cumulativeLineChart");
|
|
25
|
+
var _pieDonutChart = require("./components/pieDonutChart");
|
|
26
|
+
var _excluded = ["title", "type", "subheading", "datavalue", "groupby", "aggregation", "aggregationcolumn", "orderby", "xaxisdatakey", "xaxislabel", "xnumberformat", "xdigits", "xdateformat", "xaxislabeldistance", "xunits", "yaxisdatakey", "yaxislabel", "ynumberformat", "ydigits", "yaxislabeldistance", "yunits", "iconclass", "nodatamessage", "loadingdatamsg", "tooltips", "showlegend", "showlabelsoutside", "showvalues", "staggerlabels", "reducexticks", "showlabels", "labeltype", "barspacing", "donutratio", "bubblesize", "showxdistance", "showydistance", "areaviewtype", "interpolation", "centerlabel", "customcolors", "theme", "offset", "offsettop", "offsetbottom", "offsetright", "offsetleft", "showxaxis", "showyaxis", "linethickness", "highlightpoints", "formattype", "dataset", "datasource", "width", "height", "shape", "onSelect", "onTransform", "onBeforerender", "xdomain", "ydomain", "labelthreshold", "legendtype", "viewtype", "fontsize", "fontunit", "color", "fontfamily", "fontweight", "fontstyle", "textdecoration", "className", "show", "styles", "name"];
|
|
27
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
28
|
+
var __jsx = _react["default"].createElement;
|
|
29
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
|
+
var WmChart = function WmChart(props) {
|
|
32
|
+
var title = props.title,
|
|
33
|
+
_props$type = props.type,
|
|
34
|
+
type = _props$type === void 0 ? "Column" : _props$type,
|
|
35
|
+
subheading = props.subheading,
|
|
36
|
+
datavalue = props.datavalue,
|
|
37
|
+
groupby = props.groupby,
|
|
38
|
+
_props$aggregation = props.aggregation,
|
|
39
|
+
aggregation = _props$aggregation === void 0 ? "none" : _props$aggregation,
|
|
40
|
+
aggregationcolumn = props.aggregationcolumn,
|
|
41
|
+
orderby = props.orderby,
|
|
42
|
+
xaxisdatakey = props.xaxisdatakey,
|
|
43
|
+
xaxislabel = props.xaxislabel,
|
|
44
|
+
xnumberformat = props.xnumberformat,
|
|
45
|
+
xdigits = props.xdigits,
|
|
46
|
+
xdateformat = props.xdateformat,
|
|
47
|
+
_props$xaxislabeldist = props.xaxislabeldistance,
|
|
48
|
+
xaxislabeldistance = _props$xaxislabeldist === void 0 ? -12 : _props$xaxislabeldist,
|
|
49
|
+
xunits = props.xunits,
|
|
50
|
+
yaxisdatakey = props.yaxisdatakey,
|
|
51
|
+
yaxislabel = props.yaxislabel,
|
|
52
|
+
ynumberformat = props.ynumberformat,
|
|
53
|
+
ydigits = props.ydigits,
|
|
54
|
+
_props$yaxislabeldist = props.yaxislabeldistance,
|
|
55
|
+
yaxislabeldistance = _props$yaxislabeldist === void 0 ? 12 : _props$yaxislabeldist,
|
|
56
|
+
yunits = props.yunits,
|
|
57
|
+
iconclass = props.iconclass,
|
|
58
|
+
_props$nodatamessage = props.nodatamessage,
|
|
59
|
+
nodatamessage = _props$nodatamessage === void 0 ? "No Data Available." : _props$nodatamessage,
|
|
60
|
+
_props$loadingdatamsg = props.loadingdatamsg,
|
|
61
|
+
loadingdatamsg = _props$loadingdatamsg === void 0 ? "Loading..." : _props$loadingdatamsg,
|
|
62
|
+
_props$tooltips = props.tooltips,
|
|
63
|
+
tooltips = _props$tooltips === void 0 ? true : _props$tooltips,
|
|
64
|
+
_props$showlegend = props.showlegend,
|
|
65
|
+
showlegend = _props$showlegend === void 0 ? "top" : _props$showlegend,
|
|
66
|
+
_props$showlabelsouts = props.showlabelsoutside,
|
|
67
|
+
showlabelsoutside = _props$showlabelsouts === void 0 ? true : _props$showlabelsouts,
|
|
68
|
+
_props$showvalues = props.showvalues,
|
|
69
|
+
showvalues = _props$showvalues === void 0 ? false : _props$showvalues,
|
|
70
|
+
_props$staggerlabels = props.staggerlabels,
|
|
71
|
+
staggerlabels = _props$staggerlabels === void 0 ? false : _props$staggerlabels,
|
|
72
|
+
_props$reducexticks = props.reducexticks,
|
|
73
|
+
reducexticks = _props$reducexticks === void 0 ? true : _props$reducexticks,
|
|
74
|
+
_props$showlabels = props.showlabels,
|
|
75
|
+
showlabels = _props$showlabels === void 0 ? "outside" : _props$showlabels,
|
|
76
|
+
_props$labeltype = props.labeltype,
|
|
77
|
+
labeltype = _props$labeltype === void 0 ? "percent" : _props$labeltype,
|
|
78
|
+
_props$barspacing = props.barspacing,
|
|
79
|
+
barspacing = _props$barspacing === void 0 ? "medium" : _props$barspacing,
|
|
80
|
+
_props$donutratio = props.donutratio,
|
|
81
|
+
donutratio = _props$donutratio === void 0 ? "medium" : _props$donutratio,
|
|
82
|
+
bubblesize = props.bubblesize,
|
|
83
|
+
_props$showxdistance = props.showxdistance,
|
|
84
|
+
showxdistance = _props$showxdistance === void 0 ? false : _props$showxdistance,
|
|
85
|
+
_props$showydistance = props.showydistance,
|
|
86
|
+
showydistance = _props$showydistance === void 0 ? false : _props$showydistance,
|
|
87
|
+
_props$areaviewtype = props.areaviewtype,
|
|
88
|
+
areaviewtype = _props$areaviewtype === void 0 ? "none" : _props$areaviewtype,
|
|
89
|
+
_props$interpolation = props.interpolation,
|
|
90
|
+
interpolation = _props$interpolation === void 0 ? "linear" : _props$interpolation,
|
|
91
|
+
centerlabel = props.centerlabel,
|
|
92
|
+
customcolors = props.customcolors,
|
|
93
|
+
_props$theme = props.theme,
|
|
94
|
+
theme = _props$theme === void 0 ? "Azure" : _props$theme,
|
|
95
|
+
offset = props.offset,
|
|
96
|
+
_props$offsettop = props.offsettop,
|
|
97
|
+
offsettop = _props$offsettop === void 0 ? 25 : _props$offsettop,
|
|
98
|
+
_props$offsetbottom = props.offsetbottom,
|
|
99
|
+
offsetbottom = _props$offsetbottom === void 0 ? 55 : _props$offsetbottom,
|
|
100
|
+
_props$offsetright = props.offsetright,
|
|
101
|
+
offsetright = _props$offsetright === void 0 ? 25 : _props$offsetright,
|
|
102
|
+
_props$offsetleft = props.offsetleft,
|
|
103
|
+
offsetleft = _props$offsetleft === void 0 ? 75 : _props$offsetleft,
|
|
104
|
+
_props$showxaxis = props.showxaxis,
|
|
105
|
+
showxaxis = _props$showxaxis === void 0 ? true : _props$showxaxis,
|
|
106
|
+
_props$showyaxis = props.showyaxis,
|
|
107
|
+
showyaxis = _props$showyaxis === void 0 ? true : _props$showyaxis,
|
|
108
|
+
linethickness = props.linethickness,
|
|
109
|
+
_props$highlightpoint = props.highlightpoints,
|
|
110
|
+
highlightpoints = _props$highlightpoint === void 0 ? false : _props$highlightpoint,
|
|
111
|
+
formattype = props.formattype,
|
|
112
|
+
dataset = props.dataset,
|
|
113
|
+
datasource = props.datasource,
|
|
114
|
+
width = props.width,
|
|
115
|
+
_props$height = props.height,
|
|
116
|
+
height = _props$height === void 0 ? "400px" : _props$height,
|
|
117
|
+
_props$shape = props.shape,
|
|
118
|
+
shape = _props$shape === void 0 ? "circle" : _props$shape,
|
|
119
|
+
onSelect = props.onSelect,
|
|
120
|
+
onTransform = props.onTransform,
|
|
121
|
+
onBeforerender = props.onBeforerender,
|
|
122
|
+
_props$xdomain = props.xdomain,
|
|
123
|
+
xdomain = _props$xdomain === void 0 ? "Default" : _props$xdomain,
|
|
124
|
+
_props$ydomain = props.ydomain,
|
|
125
|
+
ydomain = _props$ydomain === void 0 ? "Default" : _props$ydomain,
|
|
126
|
+
_props$labelthreshold = props.labelthreshold,
|
|
127
|
+
labelthreshold = _props$labelthreshold === void 0 ? 0.01 : _props$labelthreshold,
|
|
128
|
+
_props$legendtype = props.legendtype,
|
|
129
|
+
legendtype = _props$legendtype === void 0 ? "furious" : _props$legendtype,
|
|
130
|
+
_props$viewtype = props.viewtype,
|
|
131
|
+
viewtype = _props$viewtype === void 0 ? "Grouped" : _props$viewtype,
|
|
132
|
+
fontsize = props.fontsize,
|
|
133
|
+
fontunit = props.fontunit,
|
|
134
|
+
color = props.color,
|
|
135
|
+
fontfamily = props.fontfamily,
|
|
136
|
+
fontweight = props.fontweight,
|
|
137
|
+
fontstyle = props.fontstyle,
|
|
138
|
+
textdecoration = props.textdecoration,
|
|
139
|
+
className = props.className,
|
|
140
|
+
_props$show = props.show,
|
|
141
|
+
show = _props$show === void 0 ? true : _props$show,
|
|
142
|
+
_props$styles = props.styles,
|
|
143
|
+
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
144
|
+
name = props.name,
|
|
145
|
+
otherProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
146
|
+
|
|
147
|
+
// const muiTheme = useTheme();
|
|
148
|
+
var _useState = (0, _react.useState)(false),
|
|
149
|
+
isLoadInProgress = _useState[0],
|
|
150
|
+
setIsLoadInProgress = _useState[1];
|
|
151
|
+
var _useState2 = (0, _react.useState)(false),
|
|
152
|
+
showContentLoadError = _useState2[0],
|
|
153
|
+
setShowContentLoadError = _useState2[1];
|
|
154
|
+
var _useState3 = (0, _react.useState)(false),
|
|
155
|
+
invalidConfig = _useState3[0],
|
|
156
|
+
setInvalidConfig = _useState3[1];
|
|
157
|
+
var _useState4 = (0, _react.useState)(""),
|
|
158
|
+
errMsg = _useState4[0],
|
|
159
|
+
setErrMsg = _useState4[1];
|
|
160
|
+
var _useState5 = (0, _react.useState)([]),
|
|
161
|
+
chartData = _useState5[0],
|
|
162
|
+
setChartData = _useState5[1];
|
|
163
|
+
var _useState6 = (0, _react.useState)([]),
|
|
164
|
+
processedData = _useState6[0],
|
|
165
|
+
setProcessedData = _useState6[1];
|
|
166
|
+
var _useState7 = (0, _react.useState)([]),
|
|
167
|
+
xDataKeyArr = _useState7[0],
|
|
168
|
+
setXDataKeyArr = _useState7[1];
|
|
169
|
+
var _useState8 = (0, _react.useState)(null),
|
|
170
|
+
selectedItem = _useState8[0],
|
|
171
|
+
setSelectedItem = _useState8[1];
|
|
172
|
+
var _useState9 = (0, _react.useState)(false),
|
|
173
|
+
isVisuallyGrouped = _useState9[0],
|
|
174
|
+
setIsVisuallyGrouped = _useState9[1];
|
|
175
|
+
var _useState0 = (0, _react.useState)(""),
|
|
176
|
+
xAxisDataType = _useState0[0],
|
|
177
|
+
setXAxisDataType = _useState0[1];
|
|
178
|
+
var _useState1 = (0, _react.useState)([]),
|
|
179
|
+
selectedRegions = _useState1[0],
|
|
180
|
+
setSelectedRegions = _useState1[1];
|
|
181
|
+
var _useState10 = (0, _react.useState)([]),
|
|
182
|
+
availableRegions = _useState10[0],
|
|
183
|
+
setAvailableRegions = _useState10[1];
|
|
184
|
+
var chartContainerRef = (0, _react.useRef)(null);
|
|
185
|
+
var chartColors = (0, _react.useMemo)(function () {
|
|
186
|
+
var _themes;
|
|
187
|
+
if (customcolors) {
|
|
188
|
+
if ((0, _lodash.isString)(customcolors)) {
|
|
189
|
+
return (0, _lodash.split)(customcolors, ",");
|
|
190
|
+
}
|
|
191
|
+
if ((0, _lodash.isArray)(customcolors)) {
|
|
192
|
+
return customcolors;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return ((_themes = _constant.themes[theme]) === null || _themes === void 0 ? void 0 : _themes.colors) || _constant.themes["Terrestrial"].colors;
|
|
196
|
+
}, [customcolors, theme]);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Timeout ref used to distinguish a single click from a double click on legend items.
|
|
200
|
+
* When the first click occurs we start a timer; if a second click arrives before the
|
|
201
|
+
* timer fires we treat it as a double-click and cancel the pending single-click logic.
|
|
202
|
+
*/
|
|
203
|
+
var legendClickTimeoutRef = (0, _react.useRef)(null);
|
|
204
|
+
|
|
205
|
+
// COMPLETE binddataset logic from Angular
|
|
206
|
+
var binddataset = (0, _react.useMemo)(function () {
|
|
207
|
+
return dataset !== undefined;
|
|
208
|
+
}, [dataset]);
|
|
209
|
+
var shouldShowLegend = (0, _react.useMemo)(function () {
|
|
210
|
+
return (0, _utils.isShowLegend)(showlegend);
|
|
211
|
+
}, [showlegend]);
|
|
212
|
+
var legendPosition = (0, _react.useMemo)(function () {
|
|
213
|
+
// For line charts, only allow 'hide', 'top', and 'bottom'
|
|
214
|
+
if (type === "Line") {
|
|
215
|
+
if (showlegend === "top") return "top";
|
|
216
|
+
if (showlegend === "bottom") return "bottom";
|
|
217
|
+
return "top"; // default to top for any other value
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// For other chart types, keep existing logic
|
|
221
|
+
if (showlegend === "top") return "top";
|
|
222
|
+
if (showlegend === "bottom") return "bottom";
|
|
223
|
+
if (showlegend === "right") return "right";
|
|
224
|
+
return "top";
|
|
225
|
+
}, [showlegend, type]);
|
|
226
|
+
|
|
227
|
+
// BUG FIX 1: Default caption visible in UI
|
|
228
|
+
var getDefaultXAxisLabel = (0, _react.useCallback)(function () {
|
|
229
|
+
// In a horizontal Bar chart the numeric series (yaxisdatakey) is plotted along X.
|
|
230
|
+
if (type === "Bar") {
|
|
231
|
+
if (yaxislabel) {
|
|
232
|
+
return "".concat(yaxislabel).concat(yunits ? " (".concat(yunits, ")") : "");
|
|
233
|
+
}
|
|
234
|
+
if (yaxisdatakey) {
|
|
235
|
+
var keys = yaxisdatakey.split(",").map(function (k) {
|
|
236
|
+
return (0, _utils.prettifyLabels)(k.trim());
|
|
237
|
+
});
|
|
238
|
+
return "".concat(keys.join(" ")).concat(yunits ? " (".concat(yunits, ")") : "");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (xaxislabel) {
|
|
242
|
+
return "".concat(xaxislabel).concat(xunits ? " (".concat(xunits, ")") : "");
|
|
243
|
+
}
|
|
244
|
+
if (xaxisdatakey) {
|
|
245
|
+
return "".concat((0, _utils.prettifyLabels)(xaxisdatakey)).concat(xunits ? " (".concat(xunits, ")") : "");
|
|
246
|
+
}
|
|
247
|
+
return "x caption";
|
|
248
|
+
}, [type, xaxislabel, xaxisdatakey, xunits, yaxislabel, yaxisdatakey, yunits]);
|
|
249
|
+
|
|
250
|
+
// BUG FIX 3: YAxis caption updating properly
|
|
251
|
+
var getDefaultYAxisLabel = (0, _react.useCallback)(function () {
|
|
252
|
+
// In a horizontal Bar chart the categorical series (xaxisdatakey) is plotted along Y.
|
|
253
|
+
if (type === "Bar") {
|
|
254
|
+
if (xaxislabel) {
|
|
255
|
+
return "".concat(xaxislabel).concat(xunits ? " (".concat(xunits, ")") : "");
|
|
256
|
+
}
|
|
257
|
+
if (xaxisdatakey) {
|
|
258
|
+
return "".concat((0, _utils.prettifyLabels)(xaxisdatakey)).concat(xunits ? " (".concat(xunits, ")") : "");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (yaxislabel) {
|
|
262
|
+
return "".concat(yaxislabel).concat(yunits ? " (".concat(yunits, ")") : "");
|
|
263
|
+
}
|
|
264
|
+
if (yaxisdatakey) {
|
|
265
|
+
var keys = yaxisdatakey.split(",").map(function (key) {
|
|
266
|
+
return (0, _utils.prettifyLabels)(key.trim());
|
|
267
|
+
});
|
|
268
|
+
return "".concat(keys.join(" ")).concat(yunits ? " (".concat(yunits, ")") : "");
|
|
269
|
+
}
|
|
270
|
+
return "y caption";
|
|
271
|
+
}, [type, yaxislabel, yaxisdatakey, yunits, xaxislabel, xaxisdatakey, xunits]);
|
|
272
|
+
|
|
273
|
+
// COMPLETE Angular helper functions
|
|
274
|
+
var isGroupByEnabled = (0, _react.useCallback)(function () {
|
|
275
|
+
return !!(groupby && groupby !== _utils.NONE);
|
|
276
|
+
}, [groupby]);
|
|
277
|
+
var isAggregationEnabled = (0, _react.useCallback)(function () {
|
|
278
|
+
return !!(isGroupByEnabled() && aggregation !== _utils.NONE && aggregationcolumn);
|
|
279
|
+
}, [aggregation, aggregationcolumn, isGroupByEnabled]);
|
|
280
|
+
var isDataFilteringEnabled = (0, _react.useCallback)(function () {
|
|
281
|
+
return isAggregationEnabled() || !isVisuallyGrouped && orderby;
|
|
282
|
+
}, [isAggregationEnabled, isVisuallyGrouped, orderby]);
|
|
283
|
+
|
|
284
|
+
// BUG FIX 2 & 8: getxAxisVal function - Fixed to properly handle xaxisdatakey
|
|
285
|
+
var getxAxisVal = (0, _react.useCallback)(function (dataObj, xKey, index) {
|
|
286
|
+
var value = (0, _lodash.get)(dataObj, xKey);
|
|
287
|
+
|
|
288
|
+
// For bubble charts with non-numeric x values, use indices
|
|
289
|
+
if ((0, _utils.isBubbleChart)(type) && typeof value === "string") {
|
|
290
|
+
// Store the actual value for display
|
|
291
|
+
if (value !== undefined && value !== null) {
|
|
292
|
+
setXDataKeyArr(function (prev) {
|
|
293
|
+
var newArr = (0, _toConsumableArray2["default"])(prev);
|
|
294
|
+
if (index !== undefined) {
|
|
295
|
+
newArr[index] = value;
|
|
296
|
+
}
|
|
297
|
+
return newArr;
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return index !== undefined ? index : 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// For line type charts with non-numeric data, use indices but store original values
|
|
304
|
+
if ((0, _utils.isLineTypeChart)(type) && !(0, _utils.isNumberType)(xAxisDataType)) {
|
|
305
|
+
// Store the actual value for display
|
|
306
|
+
if (value !== undefined && value !== null) {
|
|
307
|
+
setXDataKeyArr(function (prev) {
|
|
308
|
+
var newArr = (0, _toConsumableArray2["default"])(prev);
|
|
309
|
+
if (index !== undefined) {
|
|
310
|
+
newArr[index] = value;
|
|
311
|
+
}
|
|
312
|
+
return newArr;
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (value instanceof Date) {
|
|
316
|
+
return value;
|
|
317
|
+
} else {
|
|
318
|
+
return index !== undefined ? index : value;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return value;
|
|
322
|
+
}, [type, xAxisDataType]);
|
|
323
|
+
|
|
324
|
+
// COMPLETE valueFinder function from Angular
|
|
325
|
+
var valueFinder = (0, _react.useCallback)(function (dataObj, xKey, yKey, index, shapeVal) {
|
|
326
|
+
var xVal = getxAxisVal(dataObj, xKey, index);
|
|
327
|
+
var value = (0, _lodash.get)(dataObj, yKey);
|
|
328
|
+
var yVal = parseFloat(value) || value;
|
|
329
|
+
var size = parseFloat(dataObj[bubblesize || ""]) || 2;
|
|
330
|
+
var dataPoint = {};
|
|
331
|
+
if ((0, _utils.isChartDataJSON)(type)) {
|
|
332
|
+
dataPoint.x = xVal;
|
|
333
|
+
dataPoint.y = yVal;
|
|
334
|
+
if ((0, _utils.isBubbleChart)(type)) {
|
|
335
|
+
dataPoint.size = size;
|
|
336
|
+
dataPoint.shape = shapeVal || "circle";
|
|
337
|
+
}
|
|
338
|
+
} else if ((0, _utils.isChartDataArray)(type)) {
|
|
339
|
+
dataPoint = [xVal, yVal];
|
|
340
|
+
}
|
|
341
|
+
dataPoint._dataObj = dataObj;
|
|
342
|
+
return dataPoint;
|
|
343
|
+
}, [getxAxisVal, bubblesize, type]);
|
|
344
|
+
var getValidData = (0, _react.useCallback)(function (values) {
|
|
345
|
+
return values.length === 1 && values[0] === undefined ? [] : values;
|
|
346
|
+
}, []);
|
|
347
|
+
|
|
348
|
+
// COMPLETE processChartData function from Angular - FIXED to avoid state updates
|
|
349
|
+
var processChartData = (0, _react.useCallback)(function (processedDataset) {
|
|
350
|
+
if (!binddataset) {
|
|
351
|
+
var sampleData = (0, _utils.getSampleData)({
|
|
352
|
+
type: type,
|
|
353
|
+
yaxisdatakey: yaxisdatakey,
|
|
354
|
+
shape: shape
|
|
355
|
+
});
|
|
356
|
+
return sampleData;
|
|
357
|
+
}
|
|
358
|
+
if (!processedDataset || processedDataset.length === 0) {
|
|
359
|
+
return [];
|
|
360
|
+
}
|
|
361
|
+
var datum = [];
|
|
362
|
+
var yAxisKey;
|
|
363
|
+
var shapes = [];
|
|
364
|
+
var values = [];
|
|
365
|
+
var xAxisKey = xaxisdatakey;
|
|
366
|
+
var yAxisKeys = yaxisdatakey ? yaxisdatakey.split(",").map(function (k) {
|
|
367
|
+
return k.trim();
|
|
368
|
+
}) : [];
|
|
369
|
+
var dataSet = processedDataset;
|
|
370
|
+
if ((0, _lodash.isArray)(dataSet)) {
|
|
371
|
+
if ((0, _utils.isPieType)(type)) {
|
|
372
|
+
yAxisKey = yAxisKeys[0];
|
|
373
|
+
datum = (0, _lodash.map)(dataSet, function (dataObj, index) {
|
|
374
|
+
if (!(0, _lodash.isEmpty)(dataSet[index])) {
|
|
375
|
+
return valueFinder(dataSet[index], xAxisKey || "", yAxisKey);
|
|
376
|
+
}
|
|
377
|
+
return undefined;
|
|
378
|
+
});
|
|
379
|
+
datum = getValidData(datum);
|
|
380
|
+
} else {
|
|
381
|
+
if ((0, _utils.isBubbleChart)(type)) {
|
|
382
|
+
shapes.push(shape === "random" ? _utils.allShapes : shape);
|
|
383
|
+
}
|
|
384
|
+
yAxisKeys.forEach(function (yAxisKey, series) {
|
|
385
|
+
values = (0, _lodash.map)(dataSet, function (dataObj, index) {
|
|
386
|
+
if (!(0, _lodash.isEmpty)(dataSet[index])) {
|
|
387
|
+
return valueFinder(dataSet[index], xAxisKey || "", yAxisKey, index, (0, _lodash.isArray)(shapes) && shapes[series] || shape);
|
|
388
|
+
}
|
|
389
|
+
return undefined;
|
|
390
|
+
});
|
|
391
|
+
values = getValidData(values);
|
|
392
|
+
datum.push({
|
|
393
|
+
values: values,
|
|
394
|
+
key: (0, _utils.prettifyLabels)(yAxisKey)
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return datum;
|
|
400
|
+
}, [binddataset, type, xaxisdatakey, yaxisdatakey, shape, valueFinder, getValidData]);
|
|
401
|
+
|
|
402
|
+
// COMPLETE getVisuallyGroupedData function from Angular - FIXED to avoid state updates
|
|
403
|
+
var getVisuallyGroupedData = (0, _react.useCallback)(function (queryResponse, groupingColumn) {
|
|
404
|
+
var groupData = {};
|
|
405
|
+
var groupValues = [];
|
|
406
|
+
var orderByDetails;
|
|
407
|
+
var maxLength;
|
|
408
|
+
var chartDataResult = [];
|
|
409
|
+
var _isAreaChart = (0, _utils.isAreaChart)(type);
|
|
410
|
+
var yAxisKey = (0, _lodash.first)((0, _lodash.split)(yaxisdatakey || "", ","));
|
|
411
|
+
var processedResponse = (0, _lodash.orderBy)(queryResponse, (0, _lodash.split)(groupby || "", ","));
|
|
412
|
+
if (orderby) {
|
|
413
|
+
orderByDetails = (0, _utils.getLodashOrderByFormat)(orderby);
|
|
414
|
+
processedResponse = (0, _lodash.orderBy)(processedResponse, orderByDetails.columns, orderByDetails.orders);
|
|
415
|
+
}
|
|
416
|
+
var groupedResponse = (0, _lodash.groupBy)(processedResponse, groupingColumn);
|
|
417
|
+
if (_isAreaChart) {
|
|
418
|
+
maxLength = (0, _lodash.max)((0, _lodash.map)(groupedResponse, function (obj) {
|
|
419
|
+
return obj.length;
|
|
420
|
+
})) || 0;
|
|
421
|
+
}
|
|
422
|
+
(0, _lodash.forEach)(groupedResponse, function (values, groupKey) {
|
|
423
|
+
groupValues = _isAreaChart ? (0, _lodash.fill)(new Array(maxLength || 0), [0, 0]) : [];
|
|
424
|
+
(0, _lodash.forEachRight)(values, function (value, index) {
|
|
425
|
+
groupValues[index] = valueFinder(value, xaxisdatakey || "", yAxisKey || "", index);
|
|
426
|
+
});
|
|
427
|
+
groupData = {
|
|
428
|
+
key: groupKey,
|
|
429
|
+
values: groupValues
|
|
430
|
+
};
|
|
431
|
+
chartDataResult.push(groupData);
|
|
432
|
+
});
|
|
433
|
+
return chartDataResult;
|
|
434
|
+
}, [groupby, orderby, type, xaxisdatakey, yaxisdatakey, valueFinder]);
|
|
435
|
+
|
|
436
|
+
// COMPLETE getGroupingDetails function from Angular
|
|
437
|
+
var getGroupingDetails = (0, _react.useCallback)(function () {
|
|
438
|
+
if (isGroupByEnabled() && !isAggregationEnabled()) {
|
|
439
|
+
var isVisuallyGroupedResult = false;
|
|
440
|
+
var visualGroupingColumn;
|
|
441
|
+
var groupingColumnIndex;
|
|
442
|
+
var columns = [];
|
|
443
|
+
var groupbyColumns = groupby && groupby !== _utils.NONE ? groupby.split(",") : [];
|
|
444
|
+
var yAxisKeys = yaxisdatakey ? yaxisdatakey.split(",").map(function (k) {
|
|
445
|
+
return k.trim();
|
|
446
|
+
}) : [];
|
|
447
|
+
if (groupbyColumns.length > 1) {
|
|
448
|
+
for (var i = 0; i < groupbyColumns.length; i++) {
|
|
449
|
+
var column = groupbyColumns[i];
|
|
450
|
+
if (xaxisdatakey !== column && !yAxisKeys.includes(column)) {
|
|
451
|
+
isVisuallyGroupedResult = true;
|
|
452
|
+
visualGroupingColumn = column;
|
|
453
|
+
groupingColumnIndex = i;
|
|
454
|
+
groupbyColumns.splice(groupingColumnIndex, 1);
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (visualGroupingColumn) {
|
|
459
|
+
columns.push(visualGroupingColumn);
|
|
460
|
+
}
|
|
461
|
+
if (groupbyColumns.length) {
|
|
462
|
+
columns.push.apply(columns, (0, _toConsumableArray2["default"])(groupbyColumns));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (xaxisdatakey !== aggregationcolumn) {
|
|
466
|
+
columns.push(xaxisdatakey || "");
|
|
467
|
+
}
|
|
468
|
+
yAxisKeys.forEach(function (key) {
|
|
469
|
+
if (key !== aggregationcolumn) {
|
|
470
|
+
columns.push(key);
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
var groupingExpression = columns.join(",");
|
|
474
|
+
setIsVisuallyGrouped(isVisuallyGroupedResult);
|
|
475
|
+
return {
|
|
476
|
+
expression: groupingExpression,
|
|
477
|
+
isVisuallyGrouped: isVisuallyGroupedResult,
|
|
478
|
+
visualGroupingColumn: visualGroupingColumn
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
expression: "",
|
|
483
|
+
isVisuallyGrouped: false,
|
|
484
|
+
visualGroupingColumn: ""
|
|
485
|
+
};
|
|
486
|
+
}, [aggregationcolumn, groupby, isAggregationEnabled, isGroupByEnabled, xaxisdatakey, yaxisdatakey]);
|
|
487
|
+
var transformForRecharts = (0, _react.useCallback)(function (data) {
|
|
488
|
+
if (!data || data.length === 0) return [];
|
|
489
|
+
return (0, _utils.convertToRechartsFormat)(data, type);
|
|
490
|
+
}, [type]);
|
|
491
|
+
|
|
492
|
+
// COMPLETE getAggregatedData function from Angular (simplified for React)
|
|
493
|
+
var getAggregatedData = (0, _react.useCallback)(function (callback) {
|
|
494
|
+
// This would typically make API calls in a real implementation
|
|
495
|
+
// For now, we'll process the data directly
|
|
496
|
+
(0, _utils.triggerFn)(callback);
|
|
497
|
+
}, []);
|
|
498
|
+
var filterDataByRegions = (0, _react.useCallback)(function (data) {
|
|
499
|
+
if (!data || data.length === 0) return [];
|
|
500
|
+
if ((0, _utils.isPieType)(type)) {
|
|
501
|
+
return data.filter(function (item) {
|
|
502
|
+
return selectedRegions.includes(item.x);
|
|
503
|
+
});
|
|
504
|
+
} else {
|
|
505
|
+
return data.filter(function (series) {
|
|
506
|
+
return selectedRegions.includes(series.key);
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}, [selectedRegions, type]);
|
|
510
|
+
|
|
511
|
+
// BUG FIX 9: Get available regions considering groupBy
|
|
512
|
+
var getAvailableRegions = (0, _react.useCallback)(function (data) {
|
|
513
|
+
if (!data || data.length === 0) return [];
|
|
514
|
+
if ((0, _utils.isPieType)(type)) {
|
|
515
|
+
return (0, _lodash.uniq)(data.map(function (item) {
|
|
516
|
+
return item.x;
|
|
517
|
+
}));
|
|
518
|
+
} else {
|
|
519
|
+
// For grouped data, use the group keys
|
|
520
|
+
if (isGroupByEnabled() && groupby) {
|
|
521
|
+
var groupKeys = (0, _lodash.uniq)(data.map(function (series) {
|
|
522
|
+
return series.key;
|
|
523
|
+
}));
|
|
524
|
+
return groupKeys;
|
|
525
|
+
}
|
|
526
|
+
return (0, _lodash.uniq)(data.map(function (series) {
|
|
527
|
+
return series.key;
|
|
528
|
+
}));
|
|
529
|
+
}
|
|
530
|
+
}, [type, isGroupByEnabled, groupby]);
|
|
531
|
+
|
|
532
|
+
// Handle beforerender event
|
|
533
|
+
(0, _react.useEffect)(function () {
|
|
534
|
+
setTimeout(function () {
|
|
535
|
+
onBeforerender === null || onBeforerender === void 0 || onBeforerender(props, renderChart);
|
|
536
|
+
}, 10);
|
|
537
|
+
}, []);
|
|
538
|
+
|
|
539
|
+
// COMPLETE _plotChartProxy function from Angular - FIXED to avoid infinite loops
|
|
540
|
+
var _plotChartProxy = (0, _react.useCallback)(function () {
|
|
541
|
+
setShowContentLoadError(false);
|
|
542
|
+
setInvalidConfig(false);
|
|
543
|
+
setIsLoadInProgress(true);
|
|
544
|
+
try {
|
|
545
|
+
var groupingDetails = getGroupingDetails();
|
|
546
|
+
var data;
|
|
547
|
+
var isValidAxis = binddataset ? !!(xaxisdatakey && yaxisdatakey) : true;
|
|
548
|
+
if (!isValidAxis) {
|
|
549
|
+
setProcessedData([]);
|
|
550
|
+
} else if (groupingDetails.isVisuallyGrouped && !(0, _utils.isPieType)(type)) {
|
|
551
|
+
data = getVisuallyGroupedData(chartData, groupingDetails.visualGroupingColumn || "");
|
|
552
|
+
var filteredData = filterDataByRegions(data);
|
|
553
|
+
setProcessedData(transformForRecharts(filteredData));
|
|
554
|
+
} else {
|
|
555
|
+
data = processChartData(chartData);
|
|
556
|
+
var _filteredData = filterDataByRegions(data);
|
|
557
|
+
setProcessedData(transformForRecharts(_filteredData));
|
|
558
|
+
}
|
|
559
|
+
} catch (error) {
|
|
560
|
+
console.error("Error processing chart data:", error);
|
|
561
|
+
setShowContentLoadError(true);
|
|
562
|
+
setInvalidConfig(true);
|
|
563
|
+
setErrMsg("Error processing chart data");
|
|
564
|
+
} finally {
|
|
565
|
+
setIsLoadInProgress(false);
|
|
566
|
+
}
|
|
567
|
+
}, [binddataset, chartData, getGroupingDetails, getVisuallyGroupedData, processChartData, transformForRecharts, type, xaxisdatakey, yaxisdatakey, filterDataByRegions, props]);
|
|
568
|
+
var handleTransform = (0, _react.useCallback)(function () {
|
|
569
|
+
if (onTransform) {
|
|
570
|
+
var transformedData = onTransform({}, props);
|
|
571
|
+
if (transformedData) {
|
|
572
|
+
setChartData(transformedData);
|
|
573
|
+
return; // Exit early if data is transformed
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}, [onTransform, props]);
|
|
577
|
+
|
|
578
|
+
// Memoize the data processing functions to prevent infinite loops
|
|
579
|
+
var processDataWithFilters = (0, _react.useCallback)(function (data) {
|
|
580
|
+
var filteredData = filterDataByRegions(data);
|
|
581
|
+
return transformForRecharts(filteredData);
|
|
582
|
+
}, [filterDataByRegions, transformForRecharts]);
|
|
583
|
+
var setupRegions = (0, _react.useCallback)(function (data) {
|
|
584
|
+
var regions = getAvailableRegions(data);
|
|
585
|
+
if (!(0, _lodash.isEqual)(regions, availableRegions)) {
|
|
586
|
+
setAvailableRegions(regions);
|
|
587
|
+
// Initialize selectedRegions with all regions if empty
|
|
588
|
+
setSelectedRegions(function (prev) {
|
|
589
|
+
if (prev.length === 0) {
|
|
590
|
+
return regions;
|
|
591
|
+
}
|
|
592
|
+
var validRegions = prev.filter(function (region) {
|
|
593
|
+
return regions.includes(region);
|
|
594
|
+
});
|
|
595
|
+
return validRegions.length > 0 ? validRegions : regions;
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
}, [getAvailableRegions, availableRegions]);
|
|
599
|
+
|
|
600
|
+
// Single effect to handle all data processing
|
|
601
|
+
(0, _react.useEffect)(function () {
|
|
602
|
+
var data = [];
|
|
603
|
+
if (!binddataset) {
|
|
604
|
+
var _data;
|
|
605
|
+
// Use sample data
|
|
606
|
+
data = (0, _utils.getSampleData)({
|
|
607
|
+
type: type,
|
|
608
|
+
yaxisdatakey: yaxisdatakey,
|
|
609
|
+
shape: shape
|
|
610
|
+
});
|
|
611
|
+
// set the xDataKeyArr to the datakeys in the data
|
|
612
|
+
var dd = (_data = data) === null || _data === void 0 ? void 0 : _data.map(function (item) {
|
|
613
|
+
var _item$values;
|
|
614
|
+
return (_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values.map(function (item) {
|
|
615
|
+
return item.x;
|
|
616
|
+
});
|
|
617
|
+
});
|
|
618
|
+
setXDataKeyArr(dd.flat());
|
|
619
|
+
} else if (dataset) {
|
|
620
|
+
// Use real dataset
|
|
621
|
+
var processedDataset = (0, _lodash.isArray)(dataset) ? dataset : [dataset];
|
|
622
|
+
setChartData(processedDataset);
|
|
623
|
+
if (processedDataset.length > 0) {
|
|
624
|
+
data = processChartData(processedDataset);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if (data.length > 0) {
|
|
628
|
+
setupRegions(data);
|
|
629
|
+
setProcessedData(processDataWithFilters(data));
|
|
630
|
+
}
|
|
631
|
+
}, [binddataset, dataset, type, yaxisdatakey, shape, processDataWithFilters, setupRegions]);
|
|
632
|
+
|
|
633
|
+
// Handle chart data updates - only when NOT using onTransform
|
|
634
|
+
(0, _react.useEffect)(function () {
|
|
635
|
+
if (binddataset && chartData.length > 0 && !onTransform) {
|
|
636
|
+
_plotChartProxy();
|
|
637
|
+
}
|
|
638
|
+
}, [binddataset, chartData, onTransform]);
|
|
639
|
+
|
|
640
|
+
// Handle transform separately
|
|
641
|
+
(0, _react.useEffect)(function () {
|
|
642
|
+
if (binddataset) {
|
|
643
|
+
handleTransform();
|
|
644
|
+
}
|
|
645
|
+
}, [binddataset]);
|
|
646
|
+
|
|
647
|
+
// Handle region selection changes
|
|
648
|
+
(0, _react.useEffect)(function () {
|
|
649
|
+
if (selectedRegions.length > 0 && chartData.length > 0) {
|
|
650
|
+
var data = binddataset ? processChartData(chartData) : (0, _utils.getSampleData)({
|
|
651
|
+
type: type,
|
|
652
|
+
yaxisdatakey: yaxisdatakey,
|
|
653
|
+
shape: shape
|
|
654
|
+
});
|
|
655
|
+
setProcessedData(processDataWithFilters(data));
|
|
656
|
+
}
|
|
657
|
+
}, [selectedRegions]);
|
|
658
|
+
|
|
659
|
+
// Handle window resize
|
|
660
|
+
(0, _react.useEffect)(function () {
|
|
661
|
+
var handleResize = function handleResize() {
|
|
662
|
+
if (binddataset && chartData.length > 0) {
|
|
663
|
+
_plotChartProxy();
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
window.addEventListener("resize", handleResize);
|
|
667
|
+
return function () {
|
|
668
|
+
return window.removeEventListener("resize", handleResize);
|
|
669
|
+
};
|
|
670
|
+
}, [binddataset, chartData.length]);
|
|
671
|
+
|
|
672
|
+
// BUG FIX 10: Fixed onSelect event handler
|
|
673
|
+
var handleChartClick = (0, _react.useCallback)(function (data, event) {
|
|
674
|
+
if (!data || !onSelect) return;
|
|
675
|
+
var selectedChartItem = data;
|
|
676
|
+
var dataObj = (data === null || data === void 0 ? void 0 : data._dataObj) || data;
|
|
677
|
+
setSelectedItem(dataObj);
|
|
678
|
+
onSelect === null || onSelect === void 0 || onSelect(event, props, dataObj, selectedChartItem);
|
|
679
|
+
}, [onSelect, props]);
|
|
680
|
+
var getXAxisConfig = (0, _react.useMemo)(function () {
|
|
681
|
+
return {
|
|
682
|
+
hide: !showxaxis,
|
|
683
|
+
label: {
|
|
684
|
+
value: getDefaultXAxisLabel(),
|
|
685
|
+
position: "insideBottom",
|
|
686
|
+
offset: xaxislabeldistance,
|
|
687
|
+
fill: "#000"
|
|
688
|
+
},
|
|
689
|
+
tick: {
|
|
690
|
+
fontSize: 12,
|
|
691
|
+
fontFamily: "inherit",
|
|
692
|
+
fill: "currentColor"
|
|
693
|
+
},
|
|
694
|
+
tickFormatter: xnumberformat ? function (value) {
|
|
695
|
+
return (0, _utils.formatNumber)(value, xnumberformat);
|
|
696
|
+
} : function (value, index) {
|
|
697
|
+
// BUG FIX 2 & 8: Show actual values instead of indices
|
|
698
|
+
if (xDataKeyArr.length > 0 && index !== undefined && xDataKeyArr[index] !== undefined) {
|
|
699
|
+
return xDataKeyArr[index];
|
|
700
|
+
}
|
|
701
|
+
// console.log('value line 721', value);
|
|
702
|
+
return value;
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
}, [showxaxis, getDefaultXAxisLabel, xnumberformat, xDataKeyArr]);
|
|
706
|
+
var getYAxisConfig = (0, _react.useMemo)(function () {
|
|
707
|
+
return {
|
|
708
|
+
hide: !showyaxis,
|
|
709
|
+
label: {
|
|
710
|
+
value: (0, _utils.truncateText)(getDefaultYAxisLabel(), 20),
|
|
711
|
+
angle: -90,
|
|
712
|
+
position: "insideLeft",
|
|
713
|
+
offset: yaxislabeldistance,
|
|
714
|
+
fill: "#000",
|
|
715
|
+
style: {
|
|
716
|
+
textAnchor: "middle"
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
tick: {
|
|
720
|
+
fontSize: 12,
|
|
721
|
+
fontFamily: "inherit",
|
|
722
|
+
fill: "currentColor"
|
|
723
|
+
},
|
|
724
|
+
tickFormatter: function tickFormatter(value, index) {
|
|
725
|
+
if (typeof value === "number") {
|
|
726
|
+
return (0, _utils.formatNumber)(value, ynumberformat);
|
|
727
|
+
}
|
|
728
|
+
return value;
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
}, [showyaxis, getDefaultYAxisLabel, ynumberformat, yaxislabeldistance]);
|
|
732
|
+
var handleRegionChange = (0, _react.useCallback)(function (region) {
|
|
733
|
+
var isDoubleClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
734
|
+
setSelectedRegions(function (prev) {
|
|
735
|
+
// If only one region exists, do nothing.
|
|
736
|
+
if (availableRegions.length === 1) {
|
|
737
|
+
return prev;
|
|
738
|
+
}
|
|
739
|
+
if (isDoubleClick) {
|
|
740
|
+
// Double-click: isolate the clicked region.
|
|
741
|
+
return [region];
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// Single click: toggle the region's visibility.
|
|
745
|
+
var newSelection = prev.includes(region) ? prev.filter(function (r) {
|
|
746
|
+
return r !== region;
|
|
747
|
+
}) : [].concat((0, _toConsumableArray2["default"])(prev), [region]);
|
|
748
|
+
|
|
749
|
+
// Prevent the case where all regions are deselected – fall back to selecting all.
|
|
750
|
+
return newSelection.length === 0 ? (0, _toConsumableArray2["default"])(availableRegions) : newSelection;
|
|
751
|
+
});
|
|
752
|
+
}, [availableRegions]);
|
|
753
|
+
|
|
754
|
+
// Unified click handler: uses e.detail to distinguish click vs double-click.
|
|
755
|
+
var handleLegendClick = (0, _react.useCallback)(function (region, e) {
|
|
756
|
+
// If a timer is already pending, clear it; we'll start a new one if needed.
|
|
757
|
+
if (legendClickTimeoutRef.current) {
|
|
758
|
+
clearTimeout(legendClickTimeoutRef.current);
|
|
759
|
+
legendClickTimeoutRef.current = null;
|
|
760
|
+
}
|
|
761
|
+
if (e.detail === 2) {
|
|
762
|
+
// Second click within system double-click threshold.
|
|
763
|
+
handleRegionChange(region, true);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// Defer single-click logic; will be cancelled by a second click.
|
|
768
|
+
legendClickTimeoutRef.current = setTimeout(function () {
|
|
769
|
+
handleRegionChange(region, false);
|
|
770
|
+
legendClickTimeoutRef.current = null;
|
|
771
|
+
}, 200);
|
|
772
|
+
}, [handleRegionChange]);
|
|
773
|
+
(0, _react.useEffect)(function () {
|
|
774
|
+
if (binddataset && datasource && isDataFilteringEnabled()) {
|
|
775
|
+
getAggregatedData(function () {
|
|
776
|
+
return _plotChartProxy();
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
}, [binddataset, datasource, isDataFilteringEnabled, getAggregatedData, _plotChartProxy]);
|
|
780
|
+
var renderChart = function renderChart() {
|
|
781
|
+
if (!processedData || processedData.length === 0 || selectedRegions.length === 0) {
|
|
782
|
+
return __jsx(_noDataMessage.NoDataMessage, null, __jsx(_material.Typography, {
|
|
783
|
+
variant: "body1"
|
|
784
|
+
}, selectedRegions.length === 0 ? "Please select at least one region to display" : nodatamessage));
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// BUG FIX 4 & 5: Proper data keys handling for multiple y-axis values
|
|
788
|
+
var dataKeys = yaxisdatakey ? yaxisdatakey.split(",").map(function (key) {
|
|
789
|
+
return (0, _utils.prettifyLabels)(key.trim());
|
|
790
|
+
}) : processedData.length > 0 ? Object.keys(processedData[0]).filter(function (k) {
|
|
791
|
+
return k !== "x" && !k.endsWith("_dataObj") && !k.endsWith("_size");
|
|
792
|
+
}) : [];
|
|
793
|
+
var strokeWidth = linethickness ? parseInt(linethickness) : 2;
|
|
794
|
+
var pointSize = highlightpoints ? 5 : 0;
|
|
795
|
+
var commonProps = {
|
|
796
|
+
data: processedData,
|
|
797
|
+
dataKeys: dataKeys,
|
|
798
|
+
selectedRegions: selectedRegions,
|
|
799
|
+
chartColors: chartColors,
|
|
800
|
+
margin: {
|
|
801
|
+
top: 15,
|
|
802
|
+
right: 60,
|
|
803
|
+
left: 30,
|
|
804
|
+
bottom: 15
|
|
805
|
+
},
|
|
806
|
+
showLegend: shouldShowLegend,
|
|
807
|
+
legendPosition: legendPosition,
|
|
808
|
+
xAxisConfig: getXAxisConfig,
|
|
809
|
+
yAxisConfig: getYAxisConfig,
|
|
810
|
+
numberFormat: ynumberformat || "0.00",
|
|
811
|
+
xDataKeyArr: xDataKeyArr,
|
|
812
|
+
onChartClick: handleChartClick,
|
|
813
|
+
onLegendClick: handleLegendClick,
|
|
814
|
+
tooltips: tooltips,
|
|
815
|
+
barSpacing: barspacing,
|
|
816
|
+
legendtype: legendtype,
|
|
817
|
+
availableRegions: availableRegions
|
|
818
|
+
};
|
|
819
|
+
switch (type) {
|
|
820
|
+
case "Column":
|
|
821
|
+
return __jsx(_barColumnChart.BarColumnChart, (0, _extends2["default"])({}, commonProps, {
|
|
822
|
+
type: "Column",
|
|
823
|
+
viewtype: viewtype
|
|
824
|
+
}));
|
|
825
|
+
case "Bar":
|
|
826
|
+
return __jsx(_barColumnChart.BarColumnChart, (0, _extends2["default"])({}, commonProps, {
|
|
827
|
+
type: "Bar",
|
|
828
|
+
viewtype: viewtype
|
|
829
|
+
}));
|
|
830
|
+
case "Line":
|
|
831
|
+
return __jsx(_lineAreaChart.LineAreaChart, (0, _extends2["default"])({}, commonProps, {
|
|
832
|
+
type: "Line",
|
|
833
|
+
interpolation: interpolation,
|
|
834
|
+
strokeWidth: strokeWidth,
|
|
835
|
+
pointSize: pointSize,
|
|
836
|
+
legendtype: legendtype,
|
|
837
|
+
availableRegions: availableRegions
|
|
838
|
+
}));
|
|
839
|
+
case "Area":
|
|
840
|
+
return __jsx(_lineAreaChart.LineAreaChart, (0, _extends2["default"])({}, commonProps, {
|
|
841
|
+
type: "Area",
|
|
842
|
+
areaViewType: areaviewtype,
|
|
843
|
+
interpolation: interpolation,
|
|
844
|
+
strokeWidth: strokeWidth,
|
|
845
|
+
pointSize: pointSize
|
|
846
|
+
}));
|
|
847
|
+
case "Cumulative Line":
|
|
848
|
+
return __jsx(_cumulativeLineChart.CumulativeLineChart, (0, _extends2["default"])({}, commonProps, {
|
|
849
|
+
interpolation: interpolation,
|
|
850
|
+
strokeWidth: strokeWidth,
|
|
851
|
+
pointSize: pointSize
|
|
852
|
+
}));
|
|
853
|
+
case "Pie":
|
|
854
|
+
case "Donut":
|
|
855
|
+
return __jsx(_pieDonutChart.PieDonutChart, (0, _extends2["default"])({}, commonProps, {
|
|
856
|
+
type: type,
|
|
857
|
+
showlabels: showlabels,
|
|
858
|
+
labeltype: labeltype,
|
|
859
|
+
shouldShowLegend: shouldShowLegend,
|
|
860
|
+
onChartClick: handleChartClick,
|
|
861
|
+
onLegendClick: handleLegendClick,
|
|
862
|
+
showLegend: shouldShowLegend,
|
|
863
|
+
centerlabel: centerlabel
|
|
864
|
+
}));
|
|
865
|
+
case "Bubble":
|
|
866
|
+
return __jsx(_bubbleChart.BubbleChart, (0, _extends2["default"])({}, commonProps, {
|
|
867
|
+
shape: shape
|
|
868
|
+
}));
|
|
869
|
+
default:
|
|
870
|
+
return __jsx(_noDataMessage.NoDataMessage, null, __jsx(_material.Typography, {
|
|
871
|
+
variant: "body1"
|
|
872
|
+
}, "Unsupported chart type: ", type));
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
var fontStyles = (0, _react.useMemo)(function () {
|
|
876
|
+
return {
|
|
877
|
+
fontSize: fontsize && fontunit ? "".concat(fontsize).concat(fontunit) : undefined,
|
|
878
|
+
color: color,
|
|
879
|
+
fontFamily: fontfamily,
|
|
880
|
+
fontWeight: fontweight,
|
|
881
|
+
fontStyle: fontstyle,
|
|
882
|
+
textDecoration: textdecoration
|
|
883
|
+
};
|
|
884
|
+
}, [fontsize, fontunit, color, fontfamily, fontweight, fontstyle, textdecoration]);
|
|
885
|
+
return __jsx(_material.Box, {
|
|
886
|
+
component: "div",
|
|
887
|
+
className: "app-chart ".concat(className || "", " ").concat(title ? "panel" : ""),
|
|
888
|
+
style: _objectSpread(_objectSpread({}, styles), fontStyles),
|
|
889
|
+
ref: chartContainerRef,
|
|
890
|
+
id: "wmChart-".concat(type),
|
|
891
|
+
name: name
|
|
892
|
+
}, title && __jsx(_material.Box, {
|
|
893
|
+
component: "div",
|
|
894
|
+
className: "panel-heading"
|
|
895
|
+
}, __jsx("h3", {
|
|
896
|
+
className: "panel-title"
|
|
897
|
+
}, iconclass && __jsx("div", {
|
|
898
|
+
className: "pull-left"
|
|
899
|
+
}, __jsx("i", {
|
|
900
|
+
className: "app-icon panel-icon ".concat(iconclass)
|
|
901
|
+
})), __jsx("div", {
|
|
902
|
+
className: "heading",
|
|
903
|
+
dangerouslySetInnerHTML: {
|
|
904
|
+
__html: _dompurify["default"].sanitize(title)
|
|
905
|
+
}
|
|
906
|
+
}), subheading && __jsx("div", {
|
|
907
|
+
className: "description",
|
|
908
|
+
dangerouslySetInnerHTML: {
|
|
909
|
+
__html: _dompurify["default"].sanitize(subheading)
|
|
910
|
+
}
|
|
911
|
+
}))), __jsx(_material.Box, {
|
|
912
|
+
component: "div",
|
|
913
|
+
className: "app-chart-inner ".concat(title ? "panel-body" : "")
|
|
914
|
+
}, renderChart(), isLoadInProgress && __jsx(_material.Box, {
|
|
915
|
+
component: "div",
|
|
916
|
+
className: "app-spinner"
|
|
917
|
+
}, __jsx(_material.Box, {
|
|
918
|
+
className: "spinner-message"
|
|
919
|
+
}, __jsx(_material.CircularProgress, null), __jsx(_material.Typography, {
|
|
920
|
+
variant: "body2",
|
|
921
|
+
sx: {
|
|
922
|
+
mt: 1
|
|
923
|
+
}
|
|
924
|
+
}, loadingdatamsg))), showContentLoadError && __jsx(_noDataMessage.NoDataMessage, null, __jsx("div", {
|
|
925
|
+
className: "wm-content-info readonly-wrapper"
|
|
926
|
+
}, __jsx("p", {
|
|
927
|
+
className: "wm-message ".concat(invalidConfig ? "error" : "")
|
|
928
|
+
}, errMsg || nodatamessage)))));
|
|
929
|
+
};
|
|
930
|
+
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmChart);
|