@wavemaker/react-runtime 11.14.1-rc.236
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 +10183 -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,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.processNode = exports.getNestedPropertyLocal = exports.generateUniqueNodeId = exports.findNodeById = void 0;
|
|
8
|
+
var _isArray = _interopRequireDefault(require("lodash-es/isArray"));
|
|
9
|
+
var _cloneDeep = _interopRequireDefault(require("lodash-es/cloneDeep"));
|
|
10
|
+
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
// Helper function to get nested property (local version for processNode)
|
|
15
|
+
var getNestedPropertyLocal = exports.getNestedPropertyLocal = function getNestedPropertyLocal(obj, path) {
|
|
16
|
+
if (!path || !obj) return undefined;
|
|
17
|
+
try {
|
|
18
|
+
var normalizedPath = path.replace(/\[(\d+)\]/g, ".$1").replace(/^\./, "");
|
|
19
|
+
return (0, _get["default"])(obj, normalizedPath);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Function to generate unique nodeId
|
|
26
|
+
var generateUniqueNodeId = exports.generateUniqueNodeId = function generateUniqueNodeId(baseId, usedNodeIds) {
|
|
27
|
+
var uniqueId = baseId;
|
|
28
|
+
var counter = 1;
|
|
29
|
+
while (usedNodeIds.has(uniqueId)) {
|
|
30
|
+
uniqueId = "".concat(baseId, "_").concat(counter);
|
|
31
|
+
counter++;
|
|
32
|
+
}
|
|
33
|
+
usedNodeIds.add(uniqueId);
|
|
34
|
+
return uniqueId;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Process a single node and its children with depth tracking
|
|
38
|
+
var processNode = exports.processNode = function processNode(item, depth, parent, rootDataset, nodeIndex, treeName, options) {
|
|
39
|
+
var levels = options.levels,
|
|
40
|
+
nodelabel = options.nodelabel,
|
|
41
|
+
nodeicon = options.nodeicon,
|
|
42
|
+
nodechildren = options.nodechildren,
|
|
43
|
+
nodeid = options.nodeid,
|
|
44
|
+
generateUniqueNodeId = options.generateUniqueNodeId;
|
|
45
|
+
|
|
46
|
+
// Helper functions for property resolution
|
|
47
|
+
var getLabelValue = function getLabelValue() {
|
|
48
|
+
var _ref, _ref2, _item$nodelabel;
|
|
49
|
+
if (nodelabel && (nodelabel.includes("[") || nodelabel.includes("."))) {
|
|
50
|
+
// Try to get the property from the current item only (like Angular's getEvaluatedData)
|
|
51
|
+
var currentItemValue = getNestedPropertyLocal(item, nodelabel);
|
|
52
|
+
if (currentItemValue !== undefined) {
|
|
53
|
+
return currentItemValue;
|
|
54
|
+
}
|
|
55
|
+
// If not found on current item, fall back to default values (don't do global search)
|
|
56
|
+
}
|
|
57
|
+
return (_ref = (_ref2 = (_item$nodelabel = item[nodelabel]) !== null && _item$nodelabel !== void 0 ? _item$nodelabel : item.label) !== null && _ref2 !== void 0 ? _ref2 : item.name) !== null && _ref !== void 0 ? _ref : String(item);
|
|
58
|
+
};
|
|
59
|
+
var getIconValue = function getIconValue() {
|
|
60
|
+
var _item$nodeicon;
|
|
61
|
+
if (nodeicon && (nodeicon.includes("[") || nodeicon.includes("."))) {
|
|
62
|
+
// Try to get the property from the current item only (like Angular's getEvaluatedData)
|
|
63
|
+
var currentItemValue = getNestedPropertyLocal(item, nodeicon);
|
|
64
|
+
if (currentItemValue !== undefined) {
|
|
65
|
+
return currentItemValue;
|
|
66
|
+
}
|
|
67
|
+
// If not found on current item, fall back to default values (don't do global search)
|
|
68
|
+
}
|
|
69
|
+
return (_item$nodeicon = item[nodeicon]) !== null && _item$nodeicon !== void 0 ? _item$nodeicon : item.icon;
|
|
70
|
+
};
|
|
71
|
+
var getNodeIdValue = function getNodeIdValue() {
|
|
72
|
+
if (nodeid && (nodeid.includes("[") || nodeid.includes("."))) {
|
|
73
|
+
// Try to get the property from the current item only (like Angular's getEvaluatedData)
|
|
74
|
+
var currentItemValue = getNestedPropertyLocal(item, nodeid);
|
|
75
|
+
if (currentItemValue !== undefined) {
|
|
76
|
+
return String(currentItemValue);
|
|
77
|
+
}
|
|
78
|
+
// If not found on current item, return undefined (no fallback like Angular)
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// For direct properties, return the value or undefined (no fallback like Angular)
|
|
83
|
+
var directValue = item[nodeid];
|
|
84
|
+
if (directValue !== undefined) {
|
|
85
|
+
return String(directValue);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// If no nodeid specified or found, generate a fallback for React's internal use
|
|
89
|
+
if (!nodeid) {
|
|
90
|
+
var _ref3, _item$nodeId;
|
|
91
|
+
var fallbackId = (_ref3 = (_item$nodeId = item.nodeId) !== null && _item$nodeId !== void 0 ? _item$nodeId : item.id) !== null && _ref3 !== void 0 ? _ref3 : "node_".concat(Date.now(), "_").concat(Math.random());
|
|
92
|
+
return String(fallbackId);
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
};
|
|
96
|
+
var getChildrenValue = function getChildrenValue() {
|
|
97
|
+
if (nodechildren && (nodechildren.includes("[") || nodechildren.includes("."))) {
|
|
98
|
+
// Try to get the property from the current item only (like Angular's getEvaluatedData)
|
|
99
|
+
var currentItemValue = getNestedPropertyLocal(item, nodechildren);
|
|
100
|
+
if (currentItemValue !== undefined) {
|
|
101
|
+
return currentItemValue;
|
|
102
|
+
}
|
|
103
|
+
// If not found on current item, fall back to default values (don't do global search)
|
|
104
|
+
}
|
|
105
|
+
// Use logical OR (||) like Angular to fall back to item.children only if the result is falsy
|
|
106
|
+
return item[nodechildren] || item.children;
|
|
107
|
+
};
|
|
108
|
+
var labelValue = getLabelValue();
|
|
109
|
+
var iconValue = getIconValue();
|
|
110
|
+
var nodeIdValue = getNodeIdValue();
|
|
111
|
+
var childrenData = getChildrenValue();
|
|
112
|
+
|
|
113
|
+
// Ensure we have a unique nodeId for React's internal use
|
|
114
|
+
// If nodeIdValue is undefined (like Angular), generate a fallback
|
|
115
|
+
var finalNodeId = nodeIdValue || generateUniqueNodeId("node_".concat(Date.now(), "_").concat(nodeIndex || 0));
|
|
116
|
+
var node = {
|
|
117
|
+
name: String(labelValue || ""),
|
|
118
|
+
label: String(labelValue || ""),
|
|
119
|
+
icon: iconValue,
|
|
120
|
+
nodeId: String(finalNodeId),
|
|
121
|
+
data: (0, _cloneDeep["default"])(item),
|
|
122
|
+
open: depth < levels,
|
|
123
|
+
checked: item.checked || false,
|
|
124
|
+
parent: parent,
|
|
125
|
+
tId: treeName ? "".concat(treeName, "_").concat(finalNodeId) : "tree_node_".concat(finalNodeId),
|
|
126
|
+
isParent: (0, _isArray["default"])(childrenData) && childrenData.length > 0
|
|
127
|
+
};
|
|
128
|
+
if ((0, _isArray["default"])(childrenData) && childrenData.length > 0) {
|
|
129
|
+
node.children = childrenData.map(function (child, index) {
|
|
130
|
+
return processNode(child, depth + 1, node, rootDataset, index, treeName, options);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return node;
|
|
134
|
+
};
|
|
135
|
+
var findNodeById = exports.findNodeById = function findNodeById(nodes, id) {
|
|
136
|
+
var _iterator = _createForOfIteratorHelper(nodes),
|
|
137
|
+
_step;
|
|
138
|
+
try {
|
|
139
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
140
|
+
var _node$children;
|
|
141
|
+
var node = _step.value;
|
|
142
|
+
if (String(node.nodeId) === String(id)) return node;
|
|
143
|
+
if ((_node$children = node.children) !== null && _node$children !== void 0 && _node$children.length) {
|
|
144
|
+
var found = findNodeById(node.children, id);
|
|
145
|
+
if (found) return found;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} catch (err) {
|
|
149
|
+
_iterator.e(err);
|
|
150
|
+
} finally {
|
|
151
|
+
_iterator.f();
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
16
|
+
var _resourceUrl = require("@wavemaker/react-runtime/utils/resource-url");
|
|
17
|
+
var _excluded = ["subtitlelang", "videoposter", "className"];
|
|
18
|
+
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); }
|
|
19
|
+
var __jsx = _react["default"].createElement;
|
|
20
|
+
var DEFAULT_CLASS = "app-video";
|
|
21
|
+
var Video = (0, _styles.styled)("video")({
|
|
22
|
+
width: "100%",
|
|
23
|
+
height: "auto"
|
|
24
|
+
});
|
|
25
|
+
var Source = (0, _styles.styled)("source")({});
|
|
26
|
+
var WmVideo = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
27
|
+
var _props$subtitlelang = props.subtitlelang,
|
|
28
|
+
subtitlelang = _props$subtitlelang === void 0 ? "en" : _props$subtitlelang,
|
|
29
|
+
_props$videoposter = props.videoposter,
|
|
30
|
+
videoposter = _props$videoposter === void 0 ? "resources/images/imagelists/default-image.png" : _props$videoposter,
|
|
31
|
+
className = props.className,
|
|
32
|
+
restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
33
|
+
var computedPoster = (0, _react.useMemo)(function () {
|
|
34
|
+
return (0, _resourceUrl.prefixPrefabResourceUrl)(videoposter, props.prefabName);
|
|
35
|
+
}, [videoposter]);
|
|
36
|
+
var computedMp4 = (0, _react.useMemo)(function () {
|
|
37
|
+
return (0, _resourceUrl.prefixPrefabResourceUrl)(props.mp4format, props.prefabName);
|
|
38
|
+
}, [props.mp4format]);
|
|
39
|
+
var computedWebm = (0, _react.useMemo)(function () {
|
|
40
|
+
return (0, _resourceUrl.prefixPrefabResourceUrl)(props.webmformat, props.prefabName);
|
|
41
|
+
}, [props.webmformat]);
|
|
42
|
+
var computedOgg = (0, _react.useMemo)(function () {
|
|
43
|
+
return (0, _resourceUrl.prefixPrefabResourceUrl)(props.oggformat, props.prefabName);
|
|
44
|
+
}, [props.oggformat]);
|
|
45
|
+
var computedSubtitles = (0, _react.useMemo)(function () {
|
|
46
|
+
return (0, _resourceUrl.prefixPrefabResourceUrl)(props.subtitlesource, props.prefabName);
|
|
47
|
+
}, [props.subtitlesource]);
|
|
48
|
+
return __jsx(_Box["default"], (0, _extends2["default"])({
|
|
49
|
+
className: (0, _clsx["default"])(DEFAULT_CLASS, className),
|
|
50
|
+
title: props.hint,
|
|
51
|
+
"aria-label": props.arialabel,
|
|
52
|
+
style: props.styles
|
|
53
|
+
}, restProps), __jsx(Video, {
|
|
54
|
+
controls: props.controls,
|
|
55
|
+
poster: computedPoster,
|
|
56
|
+
muted: props.muted,
|
|
57
|
+
loop: props.loop,
|
|
58
|
+
autoPlay: props.autoplay,
|
|
59
|
+
preload: props.videopreload,
|
|
60
|
+
tabIndex: props.tabindex,
|
|
61
|
+
name: props.name
|
|
62
|
+
}, computedMp4 && __jsx(Source, {
|
|
63
|
+
src: computedMp4,
|
|
64
|
+
type: "video/mp4"
|
|
65
|
+
}), computedWebm && __jsx(Source, {
|
|
66
|
+
src: computedWebm,
|
|
67
|
+
type: "video/webm"
|
|
68
|
+
}), computedOgg && __jsx(Source, {
|
|
69
|
+
src: computedOgg,
|
|
70
|
+
type: "video/ogg"
|
|
71
|
+
}), computedSubtitles && __jsx("track", {
|
|
72
|
+
kind: "subtitles",
|
|
73
|
+
label: subtitlelang,
|
|
74
|
+
srcLang: subtitlelang,
|
|
75
|
+
src: computedSubtitles,
|
|
76
|
+
"default": true
|
|
77
|
+
}), props.videosupportmessage || "Your browser does not support the video tag."));
|
|
78
|
+
}, function (prev, current) {
|
|
79
|
+
var keys = ["mp4format", "webmformat", "oggformat", "subtitlelang", "subtitlesource", "poster", "hint"];
|
|
80
|
+
return keys.every(function (key) {
|
|
81
|
+
return prev[key] === current[key];
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
WmVideo.displayName = "WmVideo";
|
|
85
|
+
var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmVideo);
|
|
@@ -0,0 +1,132 @@
|
|
|
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.BarColumnChart = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _recharts = require("recharts");
|
|
12
|
+
var _chartTooltip = require("../chartTooltip");
|
|
13
|
+
var _chartLegend = require("../chartLegend");
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
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); }
|
|
16
|
+
var __jsx = _react["default"].createElement;
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
var BarColumnChart = exports.BarColumnChart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
20
|
+
var type = _ref.type,
|
|
21
|
+
data = _ref.data,
|
|
22
|
+
dataKeys = _ref.dataKeys,
|
|
23
|
+
selectedRegions = _ref.selectedRegions,
|
|
24
|
+
chartColors = _ref.chartColors,
|
|
25
|
+
margin = _ref.margin,
|
|
26
|
+
barSpacing = _ref.barSpacing,
|
|
27
|
+
showValues = _ref.showValues,
|
|
28
|
+
_ref$legendPosition = _ref.legendPosition,
|
|
29
|
+
legendPosition = _ref$legendPosition === void 0 ? "top" : _ref$legendPosition,
|
|
30
|
+
xAxisConfig = _ref.xAxisConfig,
|
|
31
|
+
yAxisConfig = _ref.yAxisConfig,
|
|
32
|
+
numberFormat = _ref.numberFormat,
|
|
33
|
+
xDataKeyArr = _ref.xDataKeyArr,
|
|
34
|
+
onChartClick = _ref.onChartClick,
|
|
35
|
+
onLegendClick = _ref.onLegendClick,
|
|
36
|
+
_ref$tooltips = _ref.tooltips,
|
|
37
|
+
tooltips = _ref$tooltips === void 0 ? true : _ref$tooltips,
|
|
38
|
+
_ref$showlegend = _ref.showlegend,
|
|
39
|
+
showlegend = _ref$showlegend === void 0 ? true : _ref$showlegend,
|
|
40
|
+
legendtype = _ref.legendtype,
|
|
41
|
+
availableRegions = _ref.availableRegions,
|
|
42
|
+
_ref$viewtype = _ref.viewtype,
|
|
43
|
+
viewtype = _ref$viewtype === void 0 ? "Grouped" : _ref$viewtype;
|
|
44
|
+
var isBarChart = type === "Bar"; // Bar = horizontal bars, Column = vertical bars
|
|
45
|
+
var isStacked = viewtype === "Stacked";
|
|
46
|
+
var formatValue = (0, _react.useCallback)(function (label) {
|
|
47
|
+
if (typeof label === "number") {
|
|
48
|
+
return (0, _utils.formatNumber)(label, numberFormat);
|
|
49
|
+
}
|
|
50
|
+
return String(label);
|
|
51
|
+
}, [numberFormat]);
|
|
52
|
+
var shouldShowLegend = (0, _react.useMemo)(function () {
|
|
53
|
+
return (0, _utils.isShowLegend)(showlegend);
|
|
54
|
+
}, [showlegend]);
|
|
55
|
+
return __jsx(_recharts.ResponsiveContainer, {
|
|
56
|
+
width: "100%",
|
|
57
|
+
height: "100%"
|
|
58
|
+
}, __jsx(_recharts.BarChart, {
|
|
59
|
+
data: data,
|
|
60
|
+
margin: margin,
|
|
61
|
+
layout: isBarChart ? "vertical" : "horizontal" // vertical layout = horizontal bars, horizontal layout = vertical bars
|
|
62
|
+
,
|
|
63
|
+
barGap: isStacked ? 0 : (0, _utils.getBarSpacingValue)(barSpacing || "medium", "value"),
|
|
64
|
+
barCategoryGap: isStacked ? 0 : undefined
|
|
65
|
+
}, __jsx(_recharts.CartesianGrid, {
|
|
66
|
+
strokeDasharray: "3 3"
|
|
67
|
+
}), __jsx(_recharts.XAxis, isBarChart ? _objectSpread({
|
|
68
|
+
type: "number"
|
|
69
|
+
}, xAxisConfig) : _objectSpread({
|
|
70
|
+
dataKey: "x"
|
|
71
|
+
}, xAxisConfig)), __jsx(_recharts.YAxis, isBarChart ? _objectSpread({
|
|
72
|
+
dataKey: "x",
|
|
73
|
+
type: "category",
|
|
74
|
+
interval: 0
|
|
75
|
+
}, yAxisConfig) : yAxisConfig), tooltips && __jsx(_recharts.Tooltip, {
|
|
76
|
+
content: function content(_ref2) {
|
|
77
|
+
var active = _ref2.active,
|
|
78
|
+
payload = _ref2.payload,
|
|
79
|
+
label = _ref2.label;
|
|
80
|
+
return __jsx(_chartTooltip.ChartTooltip, {
|
|
81
|
+
active: active,
|
|
82
|
+
payload: payload,
|
|
83
|
+
label: label,
|
|
84
|
+
xDataKeyArr: xDataKeyArr,
|
|
85
|
+
numberFormat: numberFormat
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
wrapperStyle: {
|
|
89
|
+
zIndex: 9999
|
|
90
|
+
},
|
|
91
|
+
shared: true,
|
|
92
|
+
cursor: {
|
|
93
|
+
fill: "rgba(0, 0, 0, 0.1)"
|
|
94
|
+
}
|
|
95
|
+
}), shouldShowLegend && __jsx(_recharts.Legend, {
|
|
96
|
+
content: function content(props) {
|
|
97
|
+
var _props$payload;
|
|
98
|
+
return __jsx(_chartLegend.ChartLegend, {
|
|
99
|
+
selectedRegions: selectedRegions,
|
|
100
|
+
onLegendClick: onLegendClick,
|
|
101
|
+
legendPosition: legendPosition,
|
|
102
|
+
payload: ((_props$payload = props === null || props === void 0 ? void 0 : props.payload) !== null && _props$payload !== void 0 ? _props$payload : []).map(function (item) {
|
|
103
|
+
var _item$dataKey;
|
|
104
|
+
return {
|
|
105
|
+
value: item.value || "",
|
|
106
|
+
color: item.color || "#000",
|
|
107
|
+
dataKey: (_item$dataKey = item.dataKey) === null || _item$dataKey === void 0 ? void 0 : _item$dataKey.toString()
|
|
108
|
+
};
|
|
109
|
+
}),
|
|
110
|
+
legendtype: legendtype,
|
|
111
|
+
availableRegions: availableRegions
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
wrapperStyle: _objectSpread({}, (0, _utils.getLegendPopupStyle)(legendPosition || "top"))
|
|
115
|
+
}), dataKeys.map(function (dataKey, index) {
|
|
116
|
+
var isVisible = selectedRegions.includes(dataKey);
|
|
117
|
+
return __jsx(_recharts.Bar, {
|
|
118
|
+
key: dataKey,
|
|
119
|
+
dataKey: dataKey,
|
|
120
|
+
name: dataKey,
|
|
121
|
+
fill: chartColors === null || chartColors === void 0 ? void 0 : chartColors[index % (chartColors === null || chartColors === void 0 ? void 0 : chartColors.length)],
|
|
122
|
+
onClick: onChartClick,
|
|
123
|
+
isAnimationActive: true,
|
|
124
|
+
hide: !isVisible,
|
|
125
|
+
stackId: isStacked && isVisible ? "stack" : undefined
|
|
126
|
+
}, showValues && __jsx(_recharts.LabelList, {
|
|
127
|
+
dataKey: dataKey,
|
|
128
|
+
position: isStacked ? "center" : isBarChart ? "right" : "top",
|
|
129
|
+
formatter: formatValue
|
|
130
|
+
}));
|
|
131
|
+
})));
|
|
132
|
+
});
|
|
@@ -0,0 +1,176 @@
|
|
|
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.BubbleChart = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _recharts = require("recharts");
|
|
14
|
+
var _chartTooltip = require("../chartTooltip");
|
|
15
|
+
var _chartLegend = require("../chartLegend");
|
|
16
|
+
var _utils = require("../../utils");
|
|
17
|
+
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); }
|
|
18
|
+
var __jsx = _react["default"].createElement;
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
// Define valid scatter shapes
|
|
22
|
+
var VALID_SHAPES = ["circle", "diamond", "square", "triangle"];
|
|
23
|
+
var BubbleChart = exports.BubbleChart = function BubbleChart(_ref) {
|
|
24
|
+
var data = _ref.data,
|
|
25
|
+
dataKeys = _ref.dataKeys,
|
|
26
|
+
selectedRegions = _ref.selectedRegions,
|
|
27
|
+
chartColors = _ref.chartColors,
|
|
28
|
+
margin = _ref.margin,
|
|
29
|
+
showLegend = _ref.showLegend,
|
|
30
|
+
legendPosition = _ref.legendPosition,
|
|
31
|
+
xAxisConfig = _ref.xAxisConfig,
|
|
32
|
+
yAxisConfig = _ref.yAxisConfig,
|
|
33
|
+
numberFormat = _ref.numberFormat,
|
|
34
|
+
xDataKeyArr = _ref.xDataKeyArr,
|
|
35
|
+
onLegendClick = _ref.onLegendClick,
|
|
36
|
+
onChartClick = _ref.onChartClick,
|
|
37
|
+
_ref$tooltips = _ref.tooltips,
|
|
38
|
+
tooltips = _ref$tooltips === void 0 ? true : _ref$tooltips,
|
|
39
|
+
_ref$shape = _ref.shape,
|
|
40
|
+
shape = _ref$shape === void 0 ? "circle" : _ref$shape;
|
|
41
|
+
var calculateDomain = function calculateDomain() {
|
|
42
|
+
var allValues = data.flatMap(function (item) {
|
|
43
|
+
return dataKeys.map(function (key) {
|
|
44
|
+
return item["".concat(key, "_size")] || item[key] || 0;
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return [0, Math.max.apply(Math, (0, _toConsumableArray2["default"])(allValues))];
|
|
48
|
+
};
|
|
49
|
+
var domain = calculateDomain();
|
|
50
|
+
var range = [16, 225]; // Min and max bubble sizes
|
|
51
|
+
|
|
52
|
+
// Function to get a random shape
|
|
53
|
+
var getRandomShape = function getRandomShape() {
|
|
54
|
+
var randomIndex = Math.floor(Math.random() * VALID_SHAPES.length);
|
|
55
|
+
return VALID_SHAPES[randomIndex];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Memoize random shapes for each data point to maintain consistency during rerenders
|
|
59
|
+
var randomShapes = (0, _react.useMemo)(function () {
|
|
60
|
+
if (shape !== "random") return {};
|
|
61
|
+
return data.reduce(function (acc, _, index) {
|
|
62
|
+
acc[index] = getRandomShape();
|
|
63
|
+
return acc;
|
|
64
|
+
}, {});
|
|
65
|
+
}, [data.length, shape]);
|
|
66
|
+
|
|
67
|
+
// Modified xAxis config to handle string values
|
|
68
|
+
var modifiedXAxisConfig = _objectSpread(_objectSpread({}, xAxisConfig), {}, {
|
|
69
|
+
tickFormatter: function tickFormatter(value, index) {
|
|
70
|
+
// If we have stored string values, use them
|
|
71
|
+
if (xDataKeyArr && xDataKeyArr[index] !== undefined) {
|
|
72
|
+
var label = xDataKeyArr[index];
|
|
73
|
+
// Truncate long labels
|
|
74
|
+
return typeof label === "string" && label.length > 20 ? label.substring(0, 17) + "..." : label;
|
|
75
|
+
}
|
|
76
|
+
// Fallback to original formatter
|
|
77
|
+
return xAxisConfig.tickFormatter ? xAxisConfig.tickFormatter(value, index) : value;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
var commonChartElements = __jsx(_react["default"].Fragment, null, __jsx(_recharts.CartesianGrid, {
|
|
81
|
+
strokeDasharray: "3 3"
|
|
82
|
+
}), __jsx(_recharts.XAxis, (0, _extends2["default"])({
|
|
83
|
+
type: "number",
|
|
84
|
+
dataKey: "x",
|
|
85
|
+
name: "X"
|
|
86
|
+
}, modifiedXAxisConfig)), __jsx(_recharts.YAxis, (0, _extends2["default"])({
|
|
87
|
+
type: "number",
|
|
88
|
+
dataKey: "y",
|
|
89
|
+
name: "Y"
|
|
90
|
+
}, yAxisConfig)), __jsx(_recharts.ZAxis, {
|
|
91
|
+
type: "number",
|
|
92
|
+
dataKey: "z",
|
|
93
|
+
domain: domain,
|
|
94
|
+
range: range
|
|
95
|
+
}), tooltips && __jsx(_recharts.Tooltip, {
|
|
96
|
+
content: function content(_ref2) {
|
|
97
|
+
var active = _ref2.active,
|
|
98
|
+
payload = _ref2.payload;
|
|
99
|
+
if (!active || !payload || !payload.length) return null;
|
|
100
|
+
|
|
101
|
+
// Get the x value and its corresponding label
|
|
102
|
+
var xValue = payload[0].payload.x;
|
|
103
|
+
var xLabel = xDataKeyArr[xValue] || xValue;
|
|
104
|
+
|
|
105
|
+
// Create transformed payload for each series
|
|
106
|
+
var transformedPayload = dataKeys.filter(function (key) {
|
|
107
|
+
return selectedRegions.includes(key);
|
|
108
|
+
}).map(function (dataKey, index) {
|
|
109
|
+
var seriesPayload = payload.find(function (p) {
|
|
110
|
+
return p.payload.seriesName === dataKey && p.payload.x === xValue;
|
|
111
|
+
});
|
|
112
|
+
if (!seriesPayload) return null;
|
|
113
|
+
return {
|
|
114
|
+
name: dataKey,
|
|
115
|
+
value: Number(seriesPayload.payload.y) || 0,
|
|
116
|
+
color: (chartColors === null || chartColors === void 0 ? void 0 : chartColors[index % ((chartColors === null || chartColors === void 0 ? void 0 : chartColors.length) || 1)]) || "#8884d8",
|
|
117
|
+
dataKey: dataKey
|
|
118
|
+
};
|
|
119
|
+
}).filter(function (item) {
|
|
120
|
+
return item !== null;
|
|
121
|
+
});
|
|
122
|
+
return __jsx(_chartTooltip.ChartTooltip, {
|
|
123
|
+
active: active,
|
|
124
|
+
payload: transformedPayload,
|
|
125
|
+
label: xLabel,
|
|
126
|
+
xDataKeyArr: xDataKeyArr,
|
|
127
|
+
numberFormat: numberFormat
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
cursor: {
|
|
131
|
+
strokeDasharray: "3 3"
|
|
132
|
+
},
|
|
133
|
+
wrapperStyle: {
|
|
134
|
+
zIndex: 9999
|
|
135
|
+
}
|
|
136
|
+
}), showLegend && __jsx(_recharts.Legend, {
|
|
137
|
+
content: function content(props) {
|
|
138
|
+
return __jsx(_chartLegend.ChartLegend, (0, _extends2["default"])({}, props, {
|
|
139
|
+
selectedRegions: selectedRegions,
|
|
140
|
+
onLegendClick: onLegendClick,
|
|
141
|
+
position: legendPosition
|
|
142
|
+
}));
|
|
143
|
+
},
|
|
144
|
+
wrapperStyle: _objectSpread({}, (0, _utils.getLegendPopupStyle)(legendPosition))
|
|
145
|
+
}));
|
|
146
|
+
return __jsx(_recharts.ResponsiveContainer, {
|
|
147
|
+
width: "100%",
|
|
148
|
+
height: "100%"
|
|
149
|
+
}, __jsx(_recharts.ScatterChart, {
|
|
150
|
+
margin: margin
|
|
151
|
+
}, commonChartElements, dataKeys.map(function (dataKey, index) {
|
|
152
|
+
var _seriesData$;
|
|
153
|
+
var color = (chartColors === null || chartColors === void 0 ? void 0 : chartColors[index % ((chartColors === null || chartColors === void 0 ? void 0 : chartColors.length) || 1)]) || "#8884d8";
|
|
154
|
+
var seriesData = selectedRegions.includes(dataKey) ? data.map(function (item, itemIndex) {
|
|
155
|
+
return {
|
|
156
|
+
x: item.x,
|
|
157
|
+
y: item[dataKey],
|
|
158
|
+
z: item["".concat(dataKey, "_size")],
|
|
159
|
+
color: color,
|
|
160
|
+
seriesName: dataKey,
|
|
161
|
+
dataKey: dataKey,
|
|
162
|
+
shape: shape === "random" ? randomShapes[itemIndex] : shape
|
|
163
|
+
};
|
|
164
|
+
}) : [];
|
|
165
|
+
return __jsx(_recharts.Scatter, {
|
|
166
|
+
key: dataKey,
|
|
167
|
+
name: dataKey,
|
|
168
|
+
data: seriesData,
|
|
169
|
+
fill: color,
|
|
170
|
+
onClick: function onClick(data, event) {
|
|
171
|
+
return onChartClick(data, index, event);
|
|
172
|
+
},
|
|
173
|
+
shape: shape === "random" ? ((_seriesData$ = seriesData[0]) === null || _seriesData$ === void 0 ? void 0 : _seriesData$.shape) || "circle" : shape
|
|
174
|
+
});
|
|
175
|
+
})));
|
|
176
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ClassicLegendItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var __jsx = _react["default"].createElement;
|
|
11
|
+
var ClassicLegendItem = exports.ClassicLegendItem = function ClassicLegendItem(_ref) {
|
|
12
|
+
var entry = _ref.entry,
|
|
13
|
+
index = _ref.index,
|
|
14
|
+
selectedRegions = _ref.selectedRegions,
|
|
15
|
+
onItemClick = _ref.onItemClick;
|
|
16
|
+
return __jsx(_material.Box, {
|
|
17
|
+
component: "div",
|
|
18
|
+
key: "legend-".concat(index),
|
|
19
|
+
onClick: function onClick(e) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
onItemClick(entry.value, e);
|
|
22
|
+
},
|
|
23
|
+
sx: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
cursor: "pointer"
|
|
27
|
+
}
|
|
28
|
+
}, __jsx(_material.Box, {
|
|
29
|
+
component: "span",
|
|
30
|
+
sx: {
|
|
31
|
+
width: 12,
|
|
32
|
+
height: 12,
|
|
33
|
+
backgroundColor: selectedRegions.includes(entry.value) ? entry.color : "transparent",
|
|
34
|
+
marginRight: 1,
|
|
35
|
+
borderRadius: "50%",
|
|
36
|
+
border: "2px solid ".concat(entry.color)
|
|
37
|
+
}
|
|
38
|
+
}), __jsx("span", null, entry.value.length > 10 ? entry.value.slice(0, 10) + "..." : entry.value));
|
|
39
|
+
};
|