@wavemaker/react-runtime 11.14.1-16.6404
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,691 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.truncateText = exports.triggerFn = exports.prettifyLabels = exports.isShowLegend = exports.isPieType = exports.isPieChart = exports.isNumberType = exports.isLineTypeChart = exports.isLineChart = exports.isEmptyObject = exports.isDonutChart = exports.isCumulativeLineChart = exports.isColumnChart = exports.isChartDataJSON = exports.isChartDataArray = exports.isBubbleChart = exports.isBarChart = exports.isAxisDomainSupported = exports.isAreaChart = exports.getSampleData = exports.getRadiusValue = exports.getNumberFormatedData = exports.getLodashOrderByFormat = exports.getLegendPopupStyle = exports.getDateList = exports.getDateFormatedData = exports.getBarSpacingValue = exports.formatNumber = exports.convertToRechartsFormat = exports.allShapes = exports.SAMPLE_DATA = exports.NONE = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _forEach = _interopRequireDefault(require("lodash-es/forEach"));
|
|
11
|
+
var _includes = _interopRequireDefault(require("lodash-es/includes"));
|
|
12
|
+
var _split = _interopRequireDefault(require("lodash-es/split"));
|
|
13
|
+
var _invert = _interopRequireDefault(require("lodash-es/invert"));
|
|
14
|
+
var _isArray = _interopRequireDefault(require("lodash-es/isArray"));
|
|
15
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
16
|
+
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; }
|
|
17
|
+
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; } //utils.ts
|
|
18
|
+
// Constants - COMPLETE from Angular
|
|
19
|
+
var chartTypes = ["Column", "Line", "Area", "Cumulative Line", "Bar", "Pie", "Donut", "Bubble"];
|
|
20
|
+
var allShapes = exports.allShapes = ["circle", "square", "diamond", "cross", "triangle-up", "triangle-down"];
|
|
21
|
+
var getCurrentAndPreviousYears = function getCurrentAndPreviousYears() {
|
|
22
|
+
var numberOfYears = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
|
|
23
|
+
var currentYear = new Date().getFullYear();
|
|
24
|
+
return Array.from({
|
|
25
|
+
length: numberOfYears
|
|
26
|
+
}, function (_, index) {
|
|
27
|
+
var year = currentYear - (numberOfYears - 1) + index;
|
|
28
|
+
return "01/01/".concat(year);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var dateList = getCurrentAndPreviousYears();
|
|
32
|
+
// This will generate dates like ['01/01/2022', '01/01/2023', '01/01/2024'] if current year is 2024
|
|
33
|
+
|
|
34
|
+
var dataTypeJSON = ["Column", "Line", "Pie", "Bar", "Donut", "Bubble"];
|
|
35
|
+
var lineTypeCharts = ["Line", "Area", "Cumulative Line"];
|
|
36
|
+
var dataTypeArray = ["Cumulative Line", "Area"];
|
|
37
|
+
var SAMPLE_DATA = exports.SAMPLE_DATA = {
|
|
38
|
+
group1: "Europe",
|
|
39
|
+
group2: "Asia",
|
|
40
|
+
group3: "America",
|
|
41
|
+
group4: "Australia"
|
|
42
|
+
};
|
|
43
|
+
var NONE = exports.NONE = "none";
|
|
44
|
+
var barSpacingMap = {
|
|
45
|
+
small: 0.3,
|
|
46
|
+
medium: 0.5,
|
|
47
|
+
large: 0.8
|
|
48
|
+
};
|
|
49
|
+
var donutRatioMap = {
|
|
50
|
+
small: 0.3,
|
|
51
|
+
medium: 0.6,
|
|
52
|
+
large: 0.7
|
|
53
|
+
};
|
|
54
|
+
var barSpacingMapInvert = (0, _invert["default"])(barSpacingMap);
|
|
55
|
+
var donutRatioMapInvert = (0, _invert["default"])(donutRatioMap);
|
|
56
|
+
var tickformats = {
|
|
57
|
+
Thousand: {
|
|
58
|
+
prefix: "K",
|
|
59
|
+
divider: 1000
|
|
60
|
+
},
|
|
61
|
+
Million: {
|
|
62
|
+
prefix: "M",
|
|
63
|
+
divider: 1000000
|
|
64
|
+
},
|
|
65
|
+
Billion: {
|
|
66
|
+
prefix: "B",
|
|
67
|
+
divider: 1000000000
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var aggregationFnMap = {
|
|
71
|
+
average: "AVG",
|
|
72
|
+
count: "COUNT",
|
|
73
|
+
maximum: "MAX",
|
|
74
|
+
minimum: "MIN",
|
|
75
|
+
sum: "SUM"
|
|
76
|
+
};
|
|
77
|
+
var advanceDataProps = ["aggregation", "aggregationcolumn", "groupby", "orderby"];
|
|
78
|
+
|
|
79
|
+
// Chart type utility functions - COMPLETE from Angular
|
|
80
|
+
var isPieChart = exports.isPieChart = function isPieChart(type) {
|
|
81
|
+
return type === "Pie";
|
|
82
|
+
};
|
|
83
|
+
var isLineChart = exports.isLineChart = function isLineChart(type) {
|
|
84
|
+
return type === "Line";
|
|
85
|
+
};
|
|
86
|
+
var isBarChart = exports.isBarChart = function isBarChart(type) {
|
|
87
|
+
return type === "Bar";
|
|
88
|
+
};
|
|
89
|
+
var isDonutChart = exports.isDonutChart = function isDonutChart(type) {
|
|
90
|
+
return type === "Donut";
|
|
91
|
+
};
|
|
92
|
+
var isBubbleChart = exports.isBubbleChart = function isBubbleChart(type) {
|
|
93
|
+
return type === "Bubble";
|
|
94
|
+
};
|
|
95
|
+
var isColumnChart = exports.isColumnChart = function isColumnChart(type) {
|
|
96
|
+
return type === "Column";
|
|
97
|
+
};
|
|
98
|
+
var isAreaChart = exports.isAreaChart = function isAreaChart(type) {
|
|
99
|
+
return type === "Area";
|
|
100
|
+
};
|
|
101
|
+
var isCumulativeLineChart = exports.isCumulativeLineChart = function isCumulativeLineChart(type) {
|
|
102
|
+
return type === "Cumulative Line";
|
|
103
|
+
};
|
|
104
|
+
var isPieType = exports.isPieType = function isPieType(type) {
|
|
105
|
+
return isPieChart(type) || isDonutChart(type);
|
|
106
|
+
};
|
|
107
|
+
var isChartDataJSON = exports.isChartDataJSON = function isChartDataJSON(type) {
|
|
108
|
+
return (0, _includes["default"])(dataTypeJSON, type) || !(0, _includes["default"])(chartTypes, type);
|
|
109
|
+
};
|
|
110
|
+
var isChartDataArray = exports.isChartDataArray = function isChartDataArray(type) {
|
|
111
|
+
return (0, _includes["default"])(dataTypeArray, type);
|
|
112
|
+
};
|
|
113
|
+
var isLineTypeChart = exports.isLineTypeChart = function isLineTypeChart(type) {
|
|
114
|
+
return (0, _includes["default"])(lineTypeCharts, type);
|
|
115
|
+
};
|
|
116
|
+
var isAxisDomainSupported = exports.isAxisDomainSupported = function isAxisDomainSupported(type) {
|
|
117
|
+
return isColumnChart(type) || isAreaChart(type);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Enhanced number type checking to match Angular implementation
|
|
121
|
+
var isNumberType = exports.isNumberType = function isNumberType(type) {
|
|
122
|
+
var numberTypes = ["number", "integer", "float", "double", "long", "short", "byte", "decimal", "bigdecimal", "biginteger", "int", "Number"];
|
|
123
|
+
return numberTypes.includes(type === null || type === void 0 ? void 0 : type.toLowerCase());
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Helper functions - COMPLETE from Angular
|
|
127
|
+
var isShowLegend = exports.isShowLegend = function isShowLegend(value) {
|
|
128
|
+
if (value === "false" || value === false) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (value === "true" || value === true) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
return value === "hide" ? false : true;
|
|
135
|
+
};
|
|
136
|
+
var triggerFn = exports.triggerFn = function triggerFn(callback) {
|
|
137
|
+
if (typeof callback === "function") {
|
|
138
|
+
callback();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
var getClonedObject = function getClonedObject(obj) {
|
|
142
|
+
return JSON.parse(JSON.stringify(obj));
|
|
143
|
+
};
|
|
144
|
+
var prettifyLabels = exports.prettifyLabels = function prettifyLabels(label) {
|
|
145
|
+
if (!label) return "";
|
|
146
|
+
return label.replace(/^./, function (str) {
|
|
147
|
+
return str.toUpperCase();
|
|
148
|
+
}).trim();
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// COMPLETE constructSampleData function from Angular
|
|
152
|
+
var constructSampleData = function constructSampleData(dataType, yaxisLength, shape) {
|
|
153
|
+
var first_series = [];
|
|
154
|
+
var second_series = [];
|
|
155
|
+
var third_series = [];
|
|
156
|
+
var first_series_array = [];
|
|
157
|
+
var second_series_array = [];
|
|
158
|
+
var third_series_array = [];
|
|
159
|
+
var first_series_bubble = [];
|
|
160
|
+
var second_series_bubble = [];
|
|
161
|
+
var third_series_bubble = [];
|
|
162
|
+
var data = [];
|
|
163
|
+
switch (dataType) {
|
|
164
|
+
case "jsonFormat":
|
|
165
|
+
first_series = [{
|
|
166
|
+
x: "01/01/2001",
|
|
167
|
+
y: 4000000
|
|
168
|
+
}, {
|
|
169
|
+
x: "01/01/2002",
|
|
170
|
+
y: 1000000
|
|
171
|
+
}, {
|
|
172
|
+
x: "01/01/2003",
|
|
173
|
+
y: 5000000
|
|
174
|
+
}];
|
|
175
|
+
second_series = [{
|
|
176
|
+
x: "01/01/2001",
|
|
177
|
+
y: 3000000
|
|
178
|
+
}, {
|
|
179
|
+
x: "01/01/2002",
|
|
180
|
+
y: 4000000
|
|
181
|
+
}, {
|
|
182
|
+
x: "01/01/2003",
|
|
183
|
+
y: 7000000
|
|
184
|
+
}];
|
|
185
|
+
third_series = [{
|
|
186
|
+
x: "01/01/2001",
|
|
187
|
+
y: 2000000
|
|
188
|
+
}, {
|
|
189
|
+
x: "01/01/2002",
|
|
190
|
+
y: 8000000
|
|
191
|
+
}, {
|
|
192
|
+
x: "01/01/2003",
|
|
193
|
+
y: 6000000
|
|
194
|
+
}];
|
|
195
|
+
data[0] = {
|
|
196
|
+
values: first_series,
|
|
197
|
+
key: SAMPLE_DATA.group1
|
|
198
|
+
};
|
|
199
|
+
if (yaxisLength >= 2) {
|
|
200
|
+
data[1] = {
|
|
201
|
+
values: second_series,
|
|
202
|
+
key: SAMPLE_DATA.group2
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (yaxisLength >= 3) {
|
|
206
|
+
data[2] = {
|
|
207
|
+
values: third_series,
|
|
208
|
+
key: SAMPLE_DATA.group3
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
case "lineChartFormat":
|
|
213
|
+
first_series = [{
|
|
214
|
+
x: 1,
|
|
215
|
+
y: 4000000
|
|
216
|
+
}, {
|
|
217
|
+
x: 2,
|
|
218
|
+
y: 1000000
|
|
219
|
+
}, {
|
|
220
|
+
x: 3,
|
|
221
|
+
y: 5000000
|
|
222
|
+
}];
|
|
223
|
+
second_series = [{
|
|
224
|
+
x: 1,
|
|
225
|
+
y: 3000000
|
|
226
|
+
}, {
|
|
227
|
+
x: 2,
|
|
228
|
+
y: 4000000
|
|
229
|
+
}, {
|
|
230
|
+
x: 3,
|
|
231
|
+
y: 7000000
|
|
232
|
+
}];
|
|
233
|
+
third_series = [{
|
|
234
|
+
x: 1,
|
|
235
|
+
y: 2000000
|
|
236
|
+
}, {
|
|
237
|
+
x: 2,
|
|
238
|
+
y: 8000000
|
|
239
|
+
}, {
|
|
240
|
+
x: 3,
|
|
241
|
+
y: 6000000
|
|
242
|
+
}];
|
|
243
|
+
data[0] = {
|
|
244
|
+
values: first_series,
|
|
245
|
+
key: SAMPLE_DATA.group1
|
|
246
|
+
};
|
|
247
|
+
if (yaxisLength >= 2) {
|
|
248
|
+
data[1] = {
|
|
249
|
+
values: second_series,
|
|
250
|
+
key: SAMPLE_DATA.group2
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (yaxisLength >= 3) {
|
|
254
|
+
data[2] = {
|
|
255
|
+
values: third_series,
|
|
256
|
+
key: SAMPLE_DATA.group3
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case "arrayFormat":
|
|
261
|
+
first_series_array = [[1, 4000000], [2, 1000000], [3, 5000000]];
|
|
262
|
+
second_series_array = [[1, 3000000], [2, 4000000], [3, 7000000]];
|
|
263
|
+
third_series_array = [[1, 2000000], [2, 8000000], [3, 6000000]];
|
|
264
|
+
data[0] = {
|
|
265
|
+
values: first_series_array,
|
|
266
|
+
key: SAMPLE_DATA.group1
|
|
267
|
+
};
|
|
268
|
+
if (yaxisLength >= 2) {
|
|
269
|
+
data[1] = {
|
|
270
|
+
values: second_series_array,
|
|
271
|
+
key: SAMPLE_DATA.group2
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
if (yaxisLength >= 3) {
|
|
275
|
+
data[2] = {
|
|
276
|
+
values: third_series_array,
|
|
277
|
+
key: SAMPLE_DATA.group3
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
case "bubbleFormat":
|
|
282
|
+
shape = shape === "random" ? allShapes[Math.floor(Math.random() * allShapes.length)] : shape;
|
|
283
|
+
first_series_bubble = [{
|
|
284
|
+
x: 80.66,
|
|
285
|
+
y: 33739900,
|
|
286
|
+
size: 78,
|
|
287
|
+
shape: shape
|
|
288
|
+
}, {
|
|
289
|
+
x: 79.84,
|
|
290
|
+
y: 81902300,
|
|
291
|
+
size: 90,
|
|
292
|
+
shape: shape
|
|
293
|
+
}, {
|
|
294
|
+
x: 78.6,
|
|
295
|
+
y: 5523100,
|
|
296
|
+
size: 45,
|
|
297
|
+
shape: shape
|
|
298
|
+
}];
|
|
299
|
+
second_series_bubble = [{
|
|
300
|
+
x: 72.73,
|
|
301
|
+
y: 79716200,
|
|
302
|
+
size: 98,
|
|
303
|
+
shape: shape
|
|
304
|
+
}, {
|
|
305
|
+
x: 80.05,
|
|
306
|
+
y: 61801600,
|
|
307
|
+
size: 20,
|
|
308
|
+
shape: shape
|
|
309
|
+
}, {
|
|
310
|
+
x: 72.49,
|
|
311
|
+
y: 73137200,
|
|
312
|
+
size: 34,
|
|
313
|
+
shape: shape
|
|
314
|
+
}];
|
|
315
|
+
third_series_bubble = [{
|
|
316
|
+
x: 68.09,
|
|
317
|
+
y: 33739900,
|
|
318
|
+
size: 45,
|
|
319
|
+
shape: shape
|
|
320
|
+
}, {
|
|
321
|
+
x: 81.55,
|
|
322
|
+
y: 7485600,
|
|
323
|
+
size: 78,
|
|
324
|
+
shape: shape
|
|
325
|
+
}, {
|
|
326
|
+
x: 68.6,
|
|
327
|
+
y: 141850000,
|
|
328
|
+
size: 56,
|
|
329
|
+
shape: shape
|
|
330
|
+
}];
|
|
331
|
+
data[0] = {
|
|
332
|
+
values: first_series_bubble,
|
|
333
|
+
key: SAMPLE_DATA.group1
|
|
334
|
+
};
|
|
335
|
+
if (yaxisLength >= 2) {
|
|
336
|
+
data[1] = {
|
|
337
|
+
values: second_series_bubble,
|
|
338
|
+
key: SAMPLE_DATA.group2
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (yaxisLength >= 3) {
|
|
342
|
+
data[2] = {
|
|
343
|
+
values: third_series_bubble,
|
|
344
|
+
key: SAMPLE_DATA.group3
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
break;
|
|
348
|
+
case "pieChartFormat":
|
|
349
|
+
data = [{
|
|
350
|
+
x: SAMPLE_DATA.group1,
|
|
351
|
+
y: 1000000
|
|
352
|
+
}, {
|
|
353
|
+
x: SAMPLE_DATA.group2,
|
|
354
|
+
y: 2000000
|
|
355
|
+
}, {
|
|
356
|
+
x: SAMPLE_DATA.group3,
|
|
357
|
+
y: 3000000
|
|
358
|
+
}, {
|
|
359
|
+
x: SAMPLE_DATA.group4,
|
|
360
|
+
y: 4000000
|
|
361
|
+
}];
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Ensure every point carries an _dataObj reference like real datasets -----------------
|
|
366
|
+
if (Array.isArray(data)) {
|
|
367
|
+
var _data$;
|
|
368
|
+
if (data.length && (_data$ = data[0]) !== null && _data$ !== void 0 && _data$.values) {
|
|
369
|
+
// Series-based sample (Column/Line/Area/Bar/Bubble etc.)
|
|
370
|
+
data.forEach(function (series) {
|
|
371
|
+
if (Array.isArray(series.values)) {
|
|
372
|
+
series.values = series.values.map(function (pt) {
|
|
373
|
+
// Skip array-format points ([x,y]) – they aren't objects
|
|
374
|
+
if (Array.isArray(pt)) return pt;
|
|
375
|
+
return _objectSpread(_objectSpread({}, pt), {}, {
|
|
376
|
+
_dataObj: pt._dataObj || _objectSpread({}, pt)
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
} else {
|
|
382
|
+
// Flat array (Pie/Donut sample)
|
|
383
|
+
data = data.map(function (pt) {
|
|
384
|
+
return _objectSpread(_objectSpread({}, pt), {}, {
|
|
385
|
+
_dataObj: pt._dataObj || _objectSpread({}, pt)
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return data;
|
|
391
|
+
};
|
|
392
|
+
var getDataType = function getDataType(widgetContext) {
|
|
393
|
+
var type = widgetContext.type;
|
|
394
|
+
if (isPieType(type)) {
|
|
395
|
+
return "pieChartFormat";
|
|
396
|
+
}
|
|
397
|
+
if (isBubbleChart(type)) {
|
|
398
|
+
return "bubbleFormat";
|
|
399
|
+
}
|
|
400
|
+
return isChartDataJSON(type) ? "jsonFormat" : "arrayFormat";
|
|
401
|
+
};
|
|
402
|
+
var getSampleData = exports.getSampleData = function getSampleData(widgetContext) {
|
|
403
|
+
return constructSampleData(getDataType(widgetContext), (0, _split["default"])(widgetContext.yaxisdatakey || "", ",").length, widgetContext.shape);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Enhanced formatNumber function - Fixed NaN issue (BUG FIX 7)
|
|
407
|
+
var formatNumber = exports.formatNumber = function formatNumber(value, format) {
|
|
408
|
+
// Handle NaN and invalid values
|
|
409
|
+
if (!value && value !== 0) return "";
|
|
410
|
+
if (isNaN(value) || !isFinite(value)) return "";
|
|
411
|
+
var formattedData;
|
|
412
|
+
var divider;
|
|
413
|
+
var prefix;
|
|
414
|
+
if (format) {
|
|
415
|
+
try {
|
|
416
|
+
if (format === "Thousand" || format === "Million" || format === "Billion") {
|
|
417
|
+
var _tickformats, _tickformats2;
|
|
418
|
+
divider = ((_tickformats = tickformats[format]) === null || _tickformats === void 0 ? void 0 : _tickformats.divider) || 1;
|
|
419
|
+
prefix = ((_tickformats2 = tickformats[format]) === null || _tickformats2 === void 0 ? void 0 : _tickformats2.prefix) || "";
|
|
420
|
+
if (divider > 1) {
|
|
421
|
+
var result = value / divider;
|
|
422
|
+
formattedData = "".concat(result.toFixed(2)).concat(prefix);
|
|
423
|
+
} else {
|
|
424
|
+
formattedData = value.toString();
|
|
425
|
+
}
|
|
426
|
+
} else if (format === "%") {
|
|
427
|
+
formattedData = "".concat((value * 100).toFixed(2), "%");
|
|
428
|
+
} else if (format === ".f") {
|
|
429
|
+
formattedData = value.toFixed(2);
|
|
430
|
+
} else {
|
|
431
|
+
formattedData = value.toString();
|
|
432
|
+
}
|
|
433
|
+
} catch (e) {
|
|
434
|
+
formattedData = value.toString();
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
// Auto formatting when no format option is chosen
|
|
438
|
+
if (value >= 1000000000) {
|
|
439
|
+
formattedData = "".concat((value / 1000000000).toFixed(1), "B");
|
|
440
|
+
} else if (value >= 1000000) {
|
|
441
|
+
formattedData = "".concat((value / 1000000).toFixed(1), "M");
|
|
442
|
+
} else if (value >= 1000) {
|
|
443
|
+
formattedData = "".concat((value / 1000).toFixed(1), "K");
|
|
444
|
+
} else {
|
|
445
|
+
formattedData = value.toString();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return removeTrailingZeros(formattedData);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// Remove trailing zeros function
|
|
452
|
+
var removeTrailingZeros = function removeTrailingZeros(value) {
|
|
453
|
+
if (!value) {
|
|
454
|
+
return value;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// Remove trailing zeros after decimal point
|
|
458
|
+
return value.replace(/\.0+([A-Za-z]*)$/, "$1").replace(/\.([1-9]+)0+([A-Za-z]*)$/, ".$1$2");
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// COMPLETE formatDate function from Angular
|
|
462
|
+
var formatDate = function formatDate(date, format) {
|
|
463
|
+
if (!date) return "";
|
|
464
|
+
try {
|
|
465
|
+
var momentDate = (0, _momentTimezone["default"])(date);
|
|
466
|
+
if (!momentDate.isValid()) return "";
|
|
467
|
+
if (format) {
|
|
468
|
+
return momentDate.format(format);
|
|
469
|
+
}
|
|
470
|
+
return momentDate.format("MM/DD/YYYY");
|
|
471
|
+
} catch (e) {
|
|
472
|
+
return "";
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// COMPLETE helper functions from Angular
|
|
477
|
+
var getLodashOrderByFormat = exports.getLodashOrderByFormat = function getLodashOrderByFormat(orderby) {
|
|
478
|
+
var columns;
|
|
479
|
+
var orderByColumns = [];
|
|
480
|
+
var orders = [];
|
|
481
|
+
(0, _forEach["default"])((0, _split["default"])(orderby, ","), function (col) {
|
|
482
|
+
columns = (0, _split["default"])(col, ":");
|
|
483
|
+
orderByColumns.push(columns[0]);
|
|
484
|
+
orders.push(columns[1]);
|
|
485
|
+
});
|
|
486
|
+
return {
|
|
487
|
+
columns: orderByColumns,
|
|
488
|
+
orders: orders
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
var getBarSpacingValue = exports.getBarSpacingValue = function getBarSpacingValue(value, prop) {
|
|
492
|
+
if (prop === "value") {
|
|
493
|
+
return barSpacingMap[value];
|
|
494
|
+
}
|
|
495
|
+
if (prop === "key") {
|
|
496
|
+
return barSpacingMapInvert[value];
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
var getRadiusValue = exports.getRadiusValue = function getRadiusValue(value, prop) {
|
|
500
|
+
if (prop === "value") {
|
|
501
|
+
return donutRatioMap[value];
|
|
502
|
+
}
|
|
503
|
+
if (prop === "key") {
|
|
504
|
+
return donutRatioMapInvert[value];
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
var getLabelValues = function getLabelValues(showlabels, showlabelsoutside) {
|
|
508
|
+
var labelsConfig = {};
|
|
509
|
+
switch (showlabels) {
|
|
510
|
+
case "hide":
|
|
511
|
+
labelsConfig.showlabels = false;
|
|
512
|
+
break;
|
|
513
|
+
case "inside":
|
|
514
|
+
labelsConfig.showlabels = true;
|
|
515
|
+
labelsConfig.showlabelsoutside = false;
|
|
516
|
+
break;
|
|
517
|
+
case "outside":
|
|
518
|
+
labelsConfig.showlabels = true;
|
|
519
|
+
labelsConfig.showlabelsoutside = true;
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
return labelsConfig;
|
|
523
|
+
};
|
|
524
|
+
var isAxisDomainValid = function isAxisDomainValid(widgetContext, axis) {
|
|
525
|
+
if (widgetContext[axis + "domain"] === "Min" && isAxisDomainSupported(widgetContext.type)) {
|
|
526
|
+
return true;
|
|
527
|
+
}
|
|
528
|
+
return false;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
// Enhanced convertToRechartsFormat function - FIXED to handle proper data conversion
|
|
532
|
+
var convertToRechartsFormat = exports.convertToRechartsFormat = function convertToRechartsFormat(data, type) {
|
|
533
|
+
var _data$2;
|
|
534
|
+
if (!data || data.length === 0) return [];
|
|
535
|
+
if (isPieType(type)) {
|
|
536
|
+
return data.map(function (item) {
|
|
537
|
+
return {
|
|
538
|
+
name: item.x,
|
|
539
|
+
value: item.y,
|
|
540
|
+
_dataObj: item._dataObj
|
|
541
|
+
};
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// For other chart types
|
|
546
|
+
if ((0, _isArray["default"])((_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.values)) {
|
|
547
|
+
var result = [];
|
|
548
|
+
var xValuesSet = new Set();
|
|
549
|
+
|
|
550
|
+
// Collect all unique x values
|
|
551
|
+
data.forEach(function (series) {
|
|
552
|
+
if (series.values) {
|
|
553
|
+
series.values.forEach(function (point) {
|
|
554
|
+
var xValue = isChartDataJSON(type) ? point.x : point[0];
|
|
555
|
+
xValuesSet.add(xValue);
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// Sort x values
|
|
561
|
+
var sortedXValues = Array.from(xValuesSet).sort(function (a, b) {
|
|
562
|
+
// Handle different data types for sorting
|
|
563
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
564
|
+
return a - b;
|
|
565
|
+
}
|
|
566
|
+
return String(a).localeCompare(String(b));
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// Create data points for each x value
|
|
570
|
+
sortedXValues.forEach(function (x) {
|
|
571
|
+
var resultPoint = {
|
|
572
|
+
x: x
|
|
573
|
+
};
|
|
574
|
+
data.forEach(function (series) {
|
|
575
|
+
if (series.values) {
|
|
576
|
+
var point = series.values.find(function (p) {
|
|
577
|
+
var pointX = isChartDataJSON(type) ? p.x : p[0];
|
|
578
|
+
return pointX === x;
|
|
579
|
+
});
|
|
580
|
+
if (point) {
|
|
581
|
+
var key = prettifyLabels(series.key);
|
|
582
|
+
var yValue = isChartDataJSON(type) ? point.y : point[1];
|
|
583
|
+
|
|
584
|
+
// Ensure we have a valid number
|
|
585
|
+
resultPoint[key] = typeof yValue === "number" ? yValue : parseFloat(yValue) || 0;
|
|
586
|
+
resultPoint["".concat(key, "_dataObj")] = point._dataObj;
|
|
587
|
+
if (isBubbleChart(type) && point.size) {
|
|
588
|
+
resultPoint["".concat(key, "_size")] = point.size;
|
|
589
|
+
}
|
|
590
|
+
} else {
|
|
591
|
+
// Fill missing values with 0 for consistency
|
|
592
|
+
var _key = prettifyLabels(series.key);
|
|
593
|
+
resultPoint[_key] = 0;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
result.push(resultPoint);
|
|
598
|
+
});
|
|
599
|
+
return result;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// If data is already in the correct format
|
|
603
|
+
return data;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
// Additional utility functions to match Angular functionality
|
|
607
|
+
var getDateFormatedData = exports.getDateFormatedData = function getDateFormatedData(dateFormat, d) {
|
|
608
|
+
if (!d) return "";
|
|
609
|
+
try {
|
|
610
|
+
var date = (0, _momentTimezone["default"])(d);
|
|
611
|
+
if (!date.isValid()) return d;
|
|
612
|
+
|
|
613
|
+
// Handle different date format patterns
|
|
614
|
+
var format = dateFormat || "MM/DD/YYYY";
|
|
615
|
+
|
|
616
|
+
// Convert D3 format patterns to moment.js patterns
|
|
617
|
+
if (format === "%x") format = "MM/DD/YYYY";
|
|
618
|
+
if (format === "%c") format = "ddd MMM DD HH:mm:ss YYYY";
|
|
619
|
+
return date.format(format);
|
|
620
|
+
} catch (e) {
|
|
621
|
+
return d;
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
var getNumberFormatedData = exports.getNumberFormatedData = function getNumberFormatedData(numberFormat, d) {
|
|
625
|
+
return formatNumber(d, numberFormat);
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// Get date list for sample data
|
|
629
|
+
var getDateList = exports.getDateList = function getDateList() {
|
|
630
|
+
return dateList;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// Utility to check if value is empty object
|
|
634
|
+
var isEmptyObject = exports.isEmptyObject = function isEmptyObject(obj) {
|
|
635
|
+
return obj && (0, _typeof2["default"])(obj) === "object" && Object.keys(obj).length === 0;
|
|
636
|
+
};
|
|
637
|
+
var getLegendPopupStyle = exports.getLegendPopupStyle = function getLegendPopupStyle(position) {
|
|
638
|
+
// base styles for all positions
|
|
639
|
+
var baseStyle = {
|
|
640
|
+
position: "absolute",
|
|
641
|
+
zIndex: 10,
|
|
642
|
+
borderRadius: "4px",
|
|
643
|
+
padding: "8px"
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
// position-specific styles
|
|
647
|
+
switch (position) {
|
|
648
|
+
case "top":
|
|
649
|
+
return _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
650
|
+
right: "3%",
|
|
651
|
+
bottom: "100%",
|
|
652
|
+
width: "80%",
|
|
653
|
+
display: "flex",
|
|
654
|
+
flexWrap: "wrap",
|
|
655
|
+
gap: "8px",
|
|
656
|
+
justifyContent: "flex-end"
|
|
657
|
+
});
|
|
658
|
+
case "bottom":
|
|
659
|
+
return _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
660
|
+
right: "3%",
|
|
661
|
+
bottom: "0%",
|
|
662
|
+
width: "80%",
|
|
663
|
+
display: "flex",
|
|
664
|
+
flexWrap: "wrap",
|
|
665
|
+
gap: "8px",
|
|
666
|
+
justifyContent: "flex-end"
|
|
667
|
+
});
|
|
668
|
+
case "right":
|
|
669
|
+
return _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
670
|
+
right: "3%",
|
|
671
|
+
top: "50%",
|
|
672
|
+
transform: "translateY(-50%)",
|
|
673
|
+
maxHeight: "100%",
|
|
674
|
+
overflowY: "auto",
|
|
675
|
+
display: "flex",
|
|
676
|
+
flexDirection: "column",
|
|
677
|
+
gap: "8px",
|
|
678
|
+
maxWidth: "200px" // limit the width of right legend
|
|
679
|
+
});
|
|
680
|
+
case "hide":
|
|
681
|
+
default:
|
|
682
|
+
return {
|
|
683
|
+
display: "none"
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var truncateText = exports.truncateText = function truncateText(text) {
|
|
688
|
+
var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
689
|
+
if (text.length <= maxLength) return text;
|
|
690
|
+
return text.substring(0, maxLength) + "...";
|
|
691
|
+
};
|