@dhis2/analytics 28.0.3 → 28.0.5
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/build/cjs/__demo__/DataDimension.stories.js +1 -2
- package/build/cjs/__demo__/Filter.stories.js +1 -2
- package/build/cjs/__demo__/FixedPeriodSelect.stories.js +1 -2
- package/build/cjs/__demo__/OpenFileDialog.stories.js +19 -1
- package/build/cjs/__demo__/OrgUnitDimension.stories.js +1 -2
- package/build/cjs/__demo__/PivotTable.stories.js +166 -224
- package/build/cjs/__demo__/ScatterPlotPdfExport.stories.js +1 -2
- package/build/cjs/__demo__/SingleValue.stories.js +1 -2
- package/build/cjs/__demo__/Toolbar.stories.js +1 -2
- package/build/cjs/api/__tests__/dimensions.spec.js +1 -2
- package/build/cjs/api/analytics/Analytics.js +8 -9
- package/build/cjs/api/analytics/AnalyticsBase.js +58 -77
- package/build/cjs/api/analytics/AnalyticsRequest.js +1 -2
- package/build/cjs/api/analytics/AnalyticsRequestBase.js +18 -21
- package/build/cjs/api/analytics/AnalyticsRequestPropertiesMixin.js +19 -38
- package/build/cjs/api/analytics/AnalyticsResponseHeader.js +5 -7
- package/build/cjs/api/analytics/__tests__/AnalyticsBase.spec.js +9 -12
- package/build/cjs/api/analytics/__tests__/AnalyticsRequest.spec.js +8 -2
- package/build/cjs/api/analytics/utils.js +11 -17
- package/build/cjs/api/dimensions.js +119 -148
- package/build/cjs/api/expression.js +39 -60
- package/build/cjs/api/organisationUnits.js +23 -35
- package/build/cjs/components/AboutAOUnit/AboutAOUnit.js +12 -20
- package/build/cjs/components/CachedDataQueryProvider.js +7 -9
- package/build/cjs/components/DashboardPluginWrapper/DashboardPluginWrapper.js +18 -22
- package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +44 -61
- package/build/cjs/components/DataDimension/Calculation/DataElementOption.js +5 -6
- package/build/cjs/components/DataDimension/Calculation/DataElementSelector.js +29 -38
- package/build/cjs/components/DataDimension/Calculation/DndContext.js +29 -37
- package/build/cjs/components/DataDimension/Calculation/DraggingItem.js +5 -6
- package/build/cjs/components/DataDimension/Calculation/DropZone.js +4 -5
- package/build/cjs/components/DataDimension/Calculation/FormulaField.js +29 -32
- package/build/cjs/components/DataDimension/Calculation/FormulaItem.js +14 -16
- package/build/cjs/components/DataDimension/Calculation/MathOperatorSelector.js +23 -29
- package/build/cjs/components/DataDimension/Calculation/Operator.js +6 -7
- package/build/cjs/components/DataDimension/DataDimension.js +20 -32
- package/build/cjs/components/DataDimension/Info/CalculationInfo.js +14 -22
- package/build/cjs/components/DataDimension/Info/DataElementInfo.js +23 -36
- package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +30 -44
- package/build/cjs/components/DataDimension/Info/DataSetInfo.js +26 -39
- package/build/cjs/components/DataDimension/Info/EventDataItemInfo.js +21 -34
- package/build/cjs/components/DataDimension/Info/IndicatorInfo.js +21 -32
- package/build/cjs/components/DataDimension/Info/InfoPopover.js +6 -7
- package/build/cjs/components/DataDimension/Info/InfoTable.js +39 -52
- package/build/cjs/components/DataDimension/Info/OptionInfo.js +13 -20
- package/build/cjs/components/DataDimension/Info/ProgramIndicatorInfo.js +46 -58
- package/build/cjs/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +22 -32
- package/build/cjs/components/DataDimension/ItemSelector/DataTypeSelector.js +6 -7
- package/build/cjs/components/DataDimension/ItemSelector/DetailSelector.js +5 -6
- package/build/cjs/components/DataDimension/ItemSelector/GroupSelector.js +10 -12
- package/build/cjs/components/DataDimension/ItemSelector/ItemSelector.js +86 -104
- package/build/cjs/components/DataDimension/ItemSelector/MetricSelector.js +5 -6
- package/build/cjs/components/DataDimension/SourceEmptyPlaceholder.js +10 -13
- package/build/cjs/components/DataDimension/TransferOption.js +35 -39
- package/build/cjs/components/DimensionMenu.js +13 -14
- package/build/cjs/components/DimensionsPanel/DimensionsPanel.js +8 -9
- package/build/cjs/components/DimensionsPanel/List/DimensionItem.js +12 -13
- package/build/cjs/components/DimensionsPanel/List/DimensionList.js +12 -11
- package/build/cjs/components/DimensionsPanel/List/OptionsButton.js +8 -11
- package/build/cjs/components/DimensionsPanel/List/RecommendedIcon.js +10 -13
- package/build/cjs/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +48 -41
- package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +110 -114
- package/build/cjs/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +36 -33
- package/build/cjs/components/DynamicDimension/DynamicDimension.js +9 -13
- package/build/cjs/components/DynamicDimension/ItemSelector.js +25 -38
- package/build/cjs/components/FileMenu/DeleteDialog.js +11 -16
- package/build/cjs/components/FileMenu/FileMenu.js +19 -30
- package/build/cjs/components/FileMenu/GetLinkDialog.js +7 -7
- package/build/cjs/components/FileMenu/RenameDialog.js +13 -21
- package/build/cjs/components/FileMenu/SaveAsDialog.js +13 -21
- package/build/cjs/components/FileMenu/__tests__/DeleteDialog.spec.js +24 -27
- package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +55 -31
- package/build/cjs/components/FileMenu/__tests__/GetLinkDialog.spec.js +35 -39
- package/build/cjs/components/FileMenu/__tests__/RenameDialog.spec.js +17 -11
- package/build/cjs/components/FileMenu/__tests__/SaveAsDialog.spec.js +44 -37
- package/build/cjs/components/FileMenu/utils.js +10 -12
- package/build/cjs/components/Filter/Filter.js +21 -27
- package/build/cjs/components/Filter/__tests__/Filter.spec.js +29 -34
- package/build/cjs/components/Interpretations/InterpretationModal/Comment.js +8 -10
- package/build/cjs/components/Interpretations/InterpretationModal/CommentAddForm.js +10 -15
- package/build/cjs/components/Interpretations/InterpretationModal/CommentDeleteButton.js +10 -15
- package/build/cjs/components/Interpretations/InterpretationModal/CommentUpdateForm.js +12 -17
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +19 -25
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationThread.js +12 -14
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationForm.js +12 -17
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationList.js +10 -11
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +23 -33
- package/build/cjs/components/Interpretations/common/Interpretation/Interpretation.js +13 -15
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +7 -11
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +5 -7
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +15 -23
- package/build/cjs/components/Interpretations/common/Interpretation/useLike.js +5 -6
- package/build/cjs/components/Interpretations/common/Message/Message.js +6 -7
- package/build/cjs/components/Interpretations/common/Message/MessageButtonStrip.js +8 -11
- package/build/cjs/components/Interpretations/common/Message/MessageEditorContainer.js +18 -21
- package/build/cjs/components/Interpretations/common/Message/MessageIconButton.js +34 -40
- package/build/cjs/components/Interpretations/common/Message/MessageInput.js +1 -2
- package/build/cjs/components/Interpretations/common/Message/MessageStatsBar.js +8 -11
- package/build/cjs/components/LegendKey/LegendKey.js +3 -4
- package/build/cjs/components/OfflineTooltip.js +18 -26
- package/build/cjs/components/OpenFileDialog/CreatedByFilter.js +28 -26
- package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +23 -26
- package/build/cjs/components/OpenFileDialog/DateField.js +3 -4
- package/build/cjs/components/OpenFileDialog/FileList.js +19 -22
- package/build/cjs/components/OpenFileDialog/NameFilter.js +15 -21
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +50 -79
- package/build/cjs/components/OpenFileDialog/PaginationControls.js +22 -28
- package/build/cjs/components/OpenFileDialog/VisTypeFilter.js +65 -36
- package/build/cjs/components/OpenFileDialog/__tests__/OpenFileDialog.spec.js +51 -0
- package/build/cjs/components/Options/VisualizationOptions.js +35 -46
- package/build/cjs/components/OrgUnitDimension/OrgUnitDimension.js +38 -60
- package/build/cjs/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +78 -44
- package/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +17 -25
- package/build/cjs/components/PeriodDimension/FixedPeriodSelect.js +15 -21
- package/build/cjs/components/PeriodDimension/PeriodDimension.js +9 -12
- package/build/cjs/components/PeriodDimension/PeriodTransfer.js +49 -63
- package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +25 -30
- package/build/cjs/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +14 -21
- package/build/cjs/components/PeriodDimension/__tests__/PeriodDimension.spec.js +27 -23
- package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +6 -7
- package/build/cjs/components/PeriodDimension/utils/index.js +1 -5
- package/build/cjs/components/PivotTable/PivotTable.js +8 -10
- package/build/cjs/components/PivotTable/PivotTableBody.js +20 -29
- package/build/cjs/components/PivotTable/PivotTableCell.js +8 -12
- package/build/cjs/components/PivotTable/PivotTableClippedAxis.js +14 -17
- package/build/cjs/components/PivotTable/PivotTableColumnHeaderCell.js +7 -8
- package/build/cjs/components/PivotTable/PivotTableColumnHeaders.js +22 -29
- package/build/cjs/components/PivotTable/PivotTableContainer.js +5 -6
- package/build/cjs/components/PivotTable/PivotTableDimensionLabelCell.js +4 -5
- package/build/cjs/components/PivotTable/PivotTableEmptyCell.js +3 -4
- package/build/cjs/components/PivotTable/PivotTableEmptyRow.js +4 -5
- package/build/cjs/components/PivotTable/PivotTableEngineContext.js +5 -7
- package/build/cjs/components/PivotTable/PivotTableHead.js +13 -16
- package/build/cjs/components/PivotTable/PivotTableHeaderCell.js +8 -9
- package/build/cjs/components/PivotTable/PivotTableRow.js +20 -27
- package/build/cjs/components/PivotTable/PivotTableRowHeaderCell.js +5 -6
- package/build/cjs/components/PivotTable/PivotTableSortIcon.js +4 -5
- package/build/cjs/components/PivotTable/PivotTableTitleRow.js +19 -24
- package/build/cjs/components/PivotTable/PivotTableTitleRows.js +4 -5
- package/build/cjs/components/PivotTable/PivotTableValueCell.js +6 -8
- package/build/cjs/components/RichText/Editor/Editor.js +70 -85
- package/build/cjs/components/RichText/Editor/__tests__/Editor.spec.js +6 -7
- package/build/cjs/components/RichText/Parser/Parser.js +5 -10
- package/build/cjs/components/RichText/Parser/__tests__/MdParser.spec.js +1 -1
- package/build/cjs/components/RichText/Parser/__tests__/Parser.spec.js +22 -23
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +20 -24
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +8 -13
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +9 -17
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +11 -16
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +56 -47
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +8 -8
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +30 -23
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +23 -17
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/__snapshots__/HoverMenuList.spec.js.snap +63 -0
- package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +17 -21
- package/build/cjs/components/Toolbar/Toolbar.js +10 -16
- package/build/cjs/components/Toolbar/ToolbarSidebar.js +12 -18
- package/build/cjs/components/Toolbar/UpdateButton.js +18 -24
- package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +19 -18
- package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +8 -8
- package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +14 -11
- package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +16 -14
- package/build/cjs/components/TransferOption.js +14 -15
- package/build/cjs/components/TranslationDialog/TranslationModal/LocalesSelect.js +19 -27
- package/build/cjs/components/TranslationDialog/TranslationModal/TranslationForm.js +17 -25
- package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModal.js +9 -10
- package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModalActions.js +18 -27
- package/build/cjs/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js +25 -16
- package/build/cjs/components/TranslationDialog/TranslationModal/useTranslationsResults.js +3 -4
- package/build/cjs/components/UserMention/UserList.js +6 -7
- package/build/cjs/components/UserMention/UserMentionWrapper.js +13 -20
- package/build/cjs/components/UserMention/useUserSearchResults.js +12 -16
- package/build/cjs/components/VisTypeIcon.js +5 -6
- package/build/cjs/index.js +38 -39
- package/build/cjs/locales/ar_IQ/translations.json +20 -11
- package/build/cjs/locales/cs/translations.json +2 -0
- package/build/cjs/locales/en/translations.json +1 -0
- package/build/cjs/locales/es/translations.json +2 -0
- package/build/cjs/locales/fr/translations.json +2 -0
- package/build/cjs/locales/id/translations.json +20 -11
- package/build/cjs/locales/index.js +62 -62
- package/build/cjs/locales/lo/translations.json +2 -0
- package/build/cjs/locales/nb/translations.json +2 -0
- package/build/cjs/locales/prs/translations.json +2 -0
- package/build/cjs/locales/ps/translations.json +2 -0
- package/build/cjs/locales/pt/translations.json +2 -0
- package/build/cjs/locales/pt_BR/translations.json +2 -0
- package/build/cjs/locales/ru/translations.json +2 -0
- package/build/cjs/locales/si/translations.json +20 -11
- package/build/cjs/locales/sv/translations.json +20 -11
- package/build/cjs/locales/tet/translations.json +20 -11
- package/build/cjs/locales/tg/translations.json +2 -0
- package/build/cjs/locales/uk/translations.json +2 -0
- package/build/cjs/locales/ur/translations.json +2 -0
- package/build/cjs/locales/uz_UZ_Cyrl/translations.json +2 -0
- package/build/cjs/locales/uz_UZ_Latn/translations.json +4 -2
- package/build/cjs/locales/vi/translations.json +2 -0
- package/build/cjs/locales/zh/translations.json +2 -0
- package/build/cjs/locales/zh_CN/translations.json +17 -15
- package/build/cjs/modules/__tests__/expressions.spec.js +4 -5
- package/build/cjs/modules/__tests__/isNumeric.spec.js +33 -0
- package/build/cjs/modules/dimensionListItem.js +4 -5
- package/build/cjs/modules/expressions.js +3 -9
- package/build/cjs/modules/getPWAInstallationStatus.js +7 -9
- package/build/cjs/modules/layout/dimensionCreate.js +1 -3
- package/build/cjs/modules/layout/dimensionIsValid.js +3 -4
- package/build/cjs/modules/legends.js +5 -6
- package/build/cjs/modules/outliers/index.js +5 -6
- package/build/cjs/modules/outliers/iqr.js +4 -6
- package/build/cjs/modules/outliers/modZScore.js +6 -14
- package/build/cjs/modules/outliers/zScore.js +3 -4
- package/build/cjs/modules/pivotTable/AdaptiveClippingController.js +12 -16
- package/build/cjs/modules/pivotTable/PivotTableEngine.js +48 -59
- package/build/cjs/modules/pivotTable/clipAxis.js +7 -8
- package/build/cjs/modules/pivotTable/clipPartitionedAxis.js +9 -10
- package/build/cjs/modules/pivotTable/getHeaderForDisplay.js +8 -9
- package/build/cjs/modules/pivotTable/measureText.js +7 -9
- package/build/cjs/modules/pivotTable/useParentSize.js +1 -2
- package/build/cjs/modules/pivotTable/useScrollPosition.js +1 -2
- package/build/cjs/modules/pivotTable/useTableClipping.js +6 -7
- package/build/cjs/modules/relativeItems/index.js +1 -4
- package/build/cjs/modules/renderValue.js +1 -2
- package/build/cjs/modules/utils.js +11 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +3 -8
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/axis.js +7 -10
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customAxes.js +2 -5
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +7 -8
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +1 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/index.js +6 -7
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/getFormatter.js +2 -3
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/getSteps.js +2 -3
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/getTrimmedConfig.js +3 -4
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +8 -10
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/legend.js +6 -7
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/legendSet.js +22 -26
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/plotOptions.js +8 -9
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/index.js +18 -20
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/pie.js +1 -4
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +1 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +1 -3
- package/build/cjs/visualizations/config/index.js +11 -12
- package/build/cjs/visualizations/config/validators/dhis/index.js +3 -4
- package/build/cjs/visualizations/index.js +1 -4
- package/build/cjs/visualizations/store/adapters/dhis_highcharts/index.js +7 -8
- package/build/cjs/visualizations/store/index.js +15 -17
- package/build/cjs/visualizations/store/validators/dhis/index.js +5 -6
- package/build/cjs/visualizations/util/getFilterText.js +3 -6
- package/build/cjs/visualizations/util/shouldUseContrastColor.js +1 -2
- package/build/es/__demo__/OpenFileDialog.stories.js +17 -0
- package/build/es/__demo__/PivotTable.stories.js +165 -222
- package/build/es/api/__tests__/dimensions.spec.js +1 -2
- package/build/es/api/analytics/Analytics.js +8 -9
- package/build/es/api/analytics/AnalyticsBase.js +58 -77
- package/build/es/api/analytics/AnalyticsRequest.js +1 -2
- package/build/es/api/analytics/AnalyticsRequestBase.js +18 -21
- package/build/es/api/analytics/AnalyticsRequestPropertiesMixin.js +19 -38
- package/build/es/api/analytics/AnalyticsResponseHeader.js +5 -7
- package/build/es/api/analytics/__tests__/AnalyticsBase.spec.js +8 -10
- package/build/es/api/analytics/__tests__/AnalyticsRequest.spec.js +8 -2
- package/build/es/api/analytics/utils.js +11 -17
- package/build/es/api/dimensions.js +119 -148
- package/build/es/api/expression.js +39 -60
- package/build/es/api/organisationUnits.js +23 -35
- package/build/es/components/AboutAOUnit/AboutAOUnit.js +11 -18
- package/build/es/components/CachedDataQueryProvider.js +6 -7
- package/build/es/components/DashboardPluginWrapper/DashboardPluginWrapper.js +17 -20
- package/build/es/components/DataDimension/Calculation/CalculationModal.js +43 -59
- package/build/es/components/DataDimension/Calculation/DataElementOption.js +5 -6
- package/build/es/components/DataDimension/Calculation/DataElementSelector.js +28 -36
- package/build/es/components/DataDimension/Calculation/DndContext.js +28 -35
- package/build/es/components/DataDimension/Calculation/DraggingItem.js +5 -6
- package/build/es/components/DataDimension/Calculation/DropZone.js +4 -5
- package/build/es/components/DataDimension/Calculation/FormulaField.js +29 -32
- package/build/es/components/DataDimension/Calculation/FormulaItem.js +13 -14
- package/build/es/components/DataDimension/Calculation/MathOperatorSelector.js +23 -29
- package/build/es/components/DataDimension/Calculation/Operator.js +6 -7
- package/build/es/components/DataDimension/DataDimension.js +19 -30
- package/build/es/components/DataDimension/Info/CalculationInfo.js +13 -20
- package/build/es/components/DataDimension/Info/DataElementInfo.js +23 -36
- package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +29 -42
- package/build/es/components/DataDimension/Info/DataSetInfo.js +26 -39
- package/build/es/components/DataDimension/Info/EventDataItemInfo.js +21 -34
- package/build/es/components/DataDimension/Info/IndicatorInfo.js +20 -30
- package/build/es/components/DataDimension/Info/InfoPopover.js +6 -7
- package/build/es/components/DataDimension/Info/InfoTable.js +39 -52
- package/build/es/components/DataDimension/Info/OptionInfo.js +13 -20
- package/build/es/components/DataDimension/Info/ProgramIndicatorInfo.js +45 -56
- package/build/es/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +21 -30
- package/build/es/components/DataDimension/ItemSelector/DataTypeSelector.js +6 -7
- package/build/es/components/DataDimension/ItemSelector/DetailSelector.js +5 -6
- package/build/es/components/DataDimension/ItemSelector/GroupSelector.js +9 -10
- package/build/es/components/DataDimension/ItemSelector/ItemSelector.js +85 -102
- package/build/es/components/DataDimension/ItemSelector/MetricSelector.js +5 -6
- package/build/es/components/DataDimension/SourceEmptyPlaceholder.js +10 -13
- package/build/es/components/DataDimension/TransferOption.js +35 -39
- package/build/es/components/DimensionMenu.js +13 -14
- package/build/es/components/DimensionsPanel/DimensionsPanel.js +7 -7
- package/build/es/components/DimensionsPanel/List/DimensionItem.js +11 -11
- package/build/es/components/DimensionsPanel/List/DimensionList.js +11 -9
- package/build/es/components/DimensionsPanel/List/OptionsButton.js +8 -11
- package/build/es/components/DimensionsPanel/List/RecommendedIcon.js +10 -13
- package/build/es/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +47 -40
- package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +110 -114
- package/build/es/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +35 -32
- package/build/es/components/DynamicDimension/DynamicDimension.js +9 -13
- package/build/es/components/DynamicDimension/ItemSelector.js +24 -36
- package/build/es/components/FileMenu/DeleteDialog.js +10 -14
- package/build/es/components/FileMenu/FileMenu.js +18 -28
- package/build/es/components/FileMenu/GetLinkDialog.js +7 -7
- package/build/es/components/FileMenu/RenameDialog.js +12 -19
- package/build/es/components/FileMenu/SaveAsDialog.js +12 -19
- package/build/es/components/FileMenu/__tests__/DeleteDialog.spec.js +23 -26
- package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +56 -32
- package/build/es/components/FileMenu/__tests__/GetLinkDialog.spec.js +34 -38
- package/build/es/components/FileMenu/__tests__/RenameDialog.spec.js +18 -12
- package/build/es/components/FileMenu/__tests__/SaveAsDialog.spec.js +43 -36
- package/build/es/components/FileMenu/utils.js +10 -12
- package/build/es/components/Filter/Filter.js +21 -27
- package/build/es/components/Filter/__tests__/Filter.spec.js +28 -33
- package/build/es/components/Interpretations/InterpretationModal/Comment.js +7 -8
- package/build/es/components/Interpretations/InterpretationModal/CommentAddForm.js +9 -13
- package/build/es/components/Interpretations/InterpretationModal/CommentDeleteButton.js +9 -13
- package/build/es/components/Interpretations/InterpretationModal/CommentUpdateForm.js +11 -15
- package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +18 -23
- package/build/es/components/Interpretations/InterpretationModal/InterpretationThread.js +11 -12
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationForm.js +11 -15
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationList.js +10 -11
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +22 -31
- package/build/es/components/Interpretations/common/Interpretation/Interpretation.js +12 -13
- package/build/es/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +7 -11
- package/build/es/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +4 -5
- package/build/es/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +14 -21
- package/build/es/components/Interpretations/common/Interpretation/useLike.js +5 -6
- package/build/es/components/Interpretations/common/Message/Message.js +6 -7
- package/build/es/components/Interpretations/common/Message/MessageButtonStrip.js +8 -11
- package/build/es/components/Interpretations/common/Message/MessageEditorContainer.js +18 -21
- package/build/es/components/Interpretations/common/Message/MessageIconButton.js +34 -40
- package/build/es/components/Interpretations/common/Message/MessageStatsBar.js +8 -11
- package/build/es/components/LegendKey/LegendKey.js +3 -4
- package/build/es/components/OfflineTooltip.js +18 -26
- package/build/es/components/OpenFileDialog/CreatedByFilter.js +26 -25
- package/build/es/components/OpenFileDialog/CustomSelectOption.js +23 -26
- package/build/es/components/OpenFileDialog/DateField.js +3 -4
- package/build/es/components/OpenFileDialog/FileList.js +19 -22
- package/build/es/components/OpenFileDialog/NameFilter.js +15 -21
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +49 -78
- package/build/es/components/OpenFileDialog/PaginationControls.js +22 -28
- package/build/es/components/OpenFileDialog/VisTypeFilter.js +64 -36
- package/build/es/components/OpenFileDialog/__tests__/OpenFileDialog.spec.js +49 -0
- package/build/es/components/Options/VisualizationOptions.js +34 -44
- package/build/es/components/OrgUnitDimension/OrgUnitDimension.js +37 -58
- package/build/es/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +77 -43
- package/build/es/components/PeriodDimension/FixedPeriodFilter.js +17 -25
- package/build/es/components/PeriodDimension/FixedPeriodSelect.js +14 -19
- package/build/es/components/PeriodDimension/PeriodDimension.js +9 -12
- package/build/es/components/PeriodDimension/PeriodTransfer.js +48 -61
- package/build/es/components/PeriodDimension/RelativePeriodFilter.js +25 -30
- package/build/es/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +13 -20
- package/build/es/components/PeriodDimension/__tests__/PeriodDimension.spec.js +26 -22
- package/build/es/components/PeriodDimension/utils/fixedPeriods.js +6 -7
- package/build/es/components/PeriodDimension/utils/index.js +1 -5
- package/build/es/components/PivotTable/PivotTable.js +7 -8
- package/build/es/components/PivotTable/PivotTableBody.js +20 -29
- package/build/es/components/PivotTable/PivotTableCell.js +8 -12
- package/build/es/components/PivotTable/PivotTableClippedAxis.js +14 -17
- package/build/es/components/PivotTable/PivotTableColumnHeaderCell.js +7 -8
- package/build/es/components/PivotTable/PivotTableColumnHeaders.js +22 -29
- package/build/es/components/PivotTable/PivotTableContainer.js +5 -6
- package/build/es/components/PivotTable/PivotTableDimensionLabelCell.js +4 -5
- package/build/es/components/PivotTable/PivotTableEmptyCell.js +3 -4
- package/build/es/components/PivotTable/PivotTableEmptyRow.js +4 -5
- package/build/es/components/PivotTable/PivotTableEngineContext.js +4 -5
- package/build/es/components/PivotTable/PivotTableHead.js +13 -16
- package/build/es/components/PivotTable/PivotTableHeaderCell.js +8 -9
- package/build/es/components/PivotTable/PivotTableRow.js +20 -27
- package/build/es/components/PivotTable/PivotTableRowHeaderCell.js +5 -6
- package/build/es/components/PivotTable/PivotTableSortIcon.js +4 -5
- package/build/es/components/PivotTable/PivotTableTitleRow.js +18 -22
- package/build/es/components/PivotTable/PivotTableTitleRows.js +4 -5
- package/build/es/components/PivotTable/PivotTableValueCell.js +5 -6
- package/build/es/components/RichText/Editor/Editor.js +69 -83
- package/build/es/components/RichText/Editor/__tests__/Editor.spec.js +7 -8
- package/build/es/components/RichText/Parser/Parser.js +4 -8
- package/build/es/components/RichText/Parser/__tests__/MdParser.spec.js +1 -1
- package/build/es/components/RichText/Parser/__tests__/Parser.spec.js +21 -22
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuBar.js +20 -23
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +7 -11
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +8 -15
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +10 -14
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +57 -48
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +7 -7
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +27 -20
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +21 -15
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/__snapshots__/HoverMenuList.spec.js.snap +63 -0
- package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +17 -21
- package/build/es/components/Toolbar/Toolbar.js +10 -16
- package/build/es/components/Toolbar/ToolbarSidebar.js +12 -18
- package/build/es/components/Toolbar/UpdateButton.js +18 -24
- package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +18 -17
- package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +7 -7
- package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +13 -10
- package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +15 -13
- package/build/es/components/TransferOption.js +14 -15
- package/build/es/components/TranslationDialog/TranslationModal/LocalesSelect.js +19 -27
- package/build/es/components/TranslationDialog/TranslationModal/TranslationForm.js +16 -23
- package/build/es/components/TranslationDialog/TranslationModal/TranslationModal.js +8 -8
- package/build/es/components/TranslationDialog/TranslationModal/TranslationModalActions.js +18 -27
- package/build/es/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js +24 -15
- package/build/es/components/TranslationDialog/TranslationModal/useTranslationsResults.js +3 -4
- package/build/es/components/UserMention/UserList.js +6 -7
- package/build/es/components/UserMention/UserMentionWrapper.js +12 -18
- package/build/es/components/UserMention/useUserSearchResults.js +12 -16
- package/build/es/components/VisTypeIcon.js +5 -6
- package/build/es/locales/ar_IQ/translations.json +20 -11
- package/build/es/locales/cs/translations.json +2 -0
- package/build/es/locales/en/translations.json +1 -0
- package/build/es/locales/es/translations.json +2 -0
- package/build/es/locales/fr/translations.json +2 -0
- package/build/es/locales/id/translations.json +20 -11
- package/build/es/locales/lo/translations.json +2 -0
- package/build/es/locales/nb/translations.json +2 -0
- package/build/es/locales/prs/translations.json +2 -0
- package/build/es/locales/ps/translations.json +2 -0
- package/build/es/locales/pt/translations.json +2 -0
- package/build/es/locales/pt_BR/translations.json +2 -0
- package/build/es/locales/ru/translations.json +2 -0
- package/build/es/locales/si/translations.json +20 -11
- package/build/es/locales/sv/translations.json +20 -11
- package/build/es/locales/tet/translations.json +20 -11
- package/build/es/locales/tg/translations.json +2 -0
- package/build/es/locales/uk/translations.json +2 -0
- package/build/es/locales/ur/translations.json +2 -0
- package/build/es/locales/uz_UZ_Cyrl/translations.json +2 -0
- package/build/es/locales/uz_UZ_Latn/translations.json +4 -2
- package/build/es/locales/vi/translations.json +2 -0
- package/build/es/locales/zh/translations.json +2 -0
- package/build/es/locales/zh_CN/translations.json +17 -15
- package/build/es/modules/__tests__/expressions.spec.js +4 -5
- package/build/es/modules/__tests__/isNumeric.spec.js +31 -0
- package/build/es/modules/dimensionListItem.js +4 -5
- package/build/es/modules/expressions.js +3 -9
- package/build/es/modules/getPWAInstallationStatus.js +7 -9
- package/build/es/modules/layout/dimensionCreate.js +1 -3
- package/build/es/modules/layout/dimensionIsValid.js +3 -4
- package/build/es/modules/legends.js +5 -6
- package/build/es/modules/outliers/index.js +2 -3
- package/build/es/modules/outliers/iqr.js +4 -6
- package/build/es/modules/outliers/modZScore.js +6 -14
- package/build/es/modules/outliers/zScore.js +3 -4
- package/build/es/modules/pivotTable/AdaptiveClippingController.js +12 -16
- package/build/es/modules/pivotTable/PivotTableEngine.js +48 -59
- package/build/es/modules/pivotTable/clipAxis.js +7 -8
- package/build/es/modules/pivotTable/clipPartitionedAxis.js +9 -10
- package/build/es/modules/pivotTable/getHeaderForDisplay.js +8 -9
- package/build/es/modules/pivotTable/measureText.js +7 -9
- package/build/es/modules/pivotTable/useParentSize.js +1 -2
- package/build/es/modules/pivotTable/useScrollPosition.js +1 -2
- package/build/es/modules/pivotTable/useTableClipping.js +6 -7
- package/build/es/modules/relativeItems/index.js +1 -4
- package/build/es/modules/renderValue.js +1 -2
- package/build/es/modules/utils.js +9 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +3 -8
- package/build/es/visualizations/config/adapters/dhis_highcharts/axis.js +2 -5
- package/build/es/visualizations/config/adapters/dhis_highcharts/customAxes.js +2 -5
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +7 -8
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +1 -2
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/index.js +6 -7
- package/build/es/visualizations/config/adapters/dhis_highcharts/getFormatter.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/getSteps.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/getTrimmedConfig.js +3 -4
- package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +7 -8
- package/build/es/visualizations/config/adapters/dhis_highcharts/legend.js +6 -7
- package/build/es/visualizations/config/adapters/dhis_highcharts/legendSet.js +22 -26
- package/build/es/visualizations/config/adapters/dhis_highcharts/plotOptions.js +8 -9
- package/build/es/visualizations/config/adapters/dhis_highcharts/series/index.js +18 -20
- package/build/es/visualizations/config/adapters/dhis_highcharts/series/pie.js +1 -4
- package/build/es/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +1 -3
- package/build/es/visualizations/config/index.js +11 -12
- package/build/es/visualizations/config/validators/dhis/index.js +3 -4
- package/build/es/visualizations/index.js +1 -4
- package/build/es/visualizations/store/adapters/dhis_highcharts/index.js +7 -8
- package/build/es/visualizations/store/index.js +15 -17
- package/build/es/visualizations/store/validators/dhis/index.js +5 -6
- package/build/es/visualizations/util/getFilterText.js +3 -6
- package/build/es/visualizations/util/shouldUseContrastColor.js +1 -2
- package/package.json +13 -15
- package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -89
- package/build/cjs/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -29
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -93
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodDimension.spec.js.snap +0 -17
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +0 -89
- package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -89
- package/build/es/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -26
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -93
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodDimension.spec.js.snap +0 -17
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +0 -89
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { InterpretationsAndDetailsToggler } from '../index.js';
|
|
4
5
|
describe('<InterpretationsAndDetailsToggler/>', () => {
|
|
5
6
|
const noop = () => {};
|
|
6
|
-
|
|
7
|
+
test('accepts an `onClick` prop', async () => {
|
|
8
|
+
const user = userEvent.setup();
|
|
7
9
|
const onClick = jest.fn();
|
|
8
|
-
|
|
10
|
+
render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
9
11
|
onClick: onClick
|
|
10
12
|
}));
|
|
11
|
-
|
|
13
|
+
await user.click(screen.getByRole('button'));
|
|
12
14
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
13
15
|
});
|
|
14
|
-
|
|
16
|
+
test('accepts a `dataTest` prop', () => {
|
|
15
17
|
const dataTest = 'test';
|
|
16
|
-
|
|
18
|
+
render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
17
19
|
onClick: noop,
|
|
18
20
|
dataTest: dataTest
|
|
19
21
|
}));
|
|
20
|
-
expect(
|
|
22
|
+
expect(screen.getByTestId(dataTest)).toBeInTheDocument();
|
|
21
23
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
test('accepts a `disabled` prop', () => {
|
|
25
|
+
render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
24
26
|
disabled: true,
|
|
25
27
|
onClick: noop
|
|
26
28
|
}));
|
|
27
|
-
expect(
|
|
29
|
+
expect(screen.getByRole('button')).toBeDisabled();
|
|
28
30
|
});
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
+
test('accepts an `isShowing` prop', () => {
|
|
32
|
+
const showingDataTest = 'dhis2-analytics-interpretationsanddetailstoggler-showing';
|
|
33
|
+
render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
31
34
|
onClick: noop
|
|
32
35
|
}));
|
|
33
|
-
|
|
36
|
+
expect(screen.queryByTestId(showingDataTest)).not.toBeInTheDocument();
|
|
37
|
+
render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
34
38
|
isShowing: true,
|
|
35
39
|
onClick: noop
|
|
36
40
|
}));
|
|
37
|
-
expect(
|
|
38
|
-
expect(wrapper.find('SvgChevronLeft24')).toHaveLength(1);
|
|
39
|
-
expect(wrapperWithIsShowing.find('SvgChevronRight24')).toHaveLength(1);
|
|
40
|
-
expect(wrapperWithIsShowing.find('SvgChevronLeft24')).toHaveLength(0);
|
|
41
|
+
expect(screen.getByTestId(showingDataTest)).toBeInTheDocument();
|
|
41
42
|
});
|
|
42
43
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Toolbar } from '../index.js';
|
|
4
4
|
describe('<Toolbar/>', () => {
|
|
5
|
-
|
|
5
|
+
test('renders children', () => {
|
|
6
6
|
const childNode = 'text node';
|
|
7
|
-
|
|
8
|
-
expect(
|
|
7
|
+
render(/*#__PURE__*/React.createElement(Toolbar, null, childNode));
|
|
8
|
+
expect(screen.getByText(childNode)).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
test('accepts a `dataTest` prop', () => {
|
|
11
11
|
const dataTest = 'test';
|
|
12
|
-
|
|
12
|
+
render(/*#__PURE__*/React.createElement(Toolbar, {
|
|
13
13
|
dataTest: dataTest
|
|
14
14
|
}));
|
|
15
|
-
expect(
|
|
15
|
+
expect(screen.getByTestId(dataTest)).toBeInTheDocument();
|
|
16
16
|
});
|
|
17
17
|
});
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ToolbarSidebar } from '../index.js';
|
|
4
4
|
describe('<ToolbarSidebar/>', () => {
|
|
5
|
-
|
|
5
|
+
test('renders children', () => {
|
|
6
6
|
const childNode = 'text node';
|
|
7
|
-
|
|
8
|
-
expect(
|
|
7
|
+
render(/*#__PURE__*/React.createElement(ToolbarSidebar, null, childNode));
|
|
8
|
+
expect(screen.getByText(childNode)).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
test('accepts a `dataTest` prop', () => {
|
|
11
11
|
const dataTest = 'test';
|
|
12
|
-
|
|
12
|
+
render(/*#__PURE__*/React.createElement(ToolbarSidebar, {
|
|
13
13
|
dataTest: dataTest
|
|
14
14
|
}));
|
|
15
|
-
expect(
|
|
15
|
+
expect(screen.getByTestId(dataTest)).toBeInTheDocument();
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
const
|
|
17
|
+
test('accepts a `isHidden` prop', () => {
|
|
18
|
+
const {
|
|
19
|
+
container
|
|
20
|
+
} = render(/*#__PURE__*/React.createElement(ToolbarSidebar, {
|
|
19
21
|
isHidden: true
|
|
20
22
|
}));
|
|
21
|
-
|
|
23
|
+
const divEl = container.querySelector('div');
|
|
24
|
+
expect(divEl).toHaveClass('isHidden');
|
|
22
25
|
});
|
|
23
26
|
});
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { UpdateButton } from '../index.js';
|
|
4
5
|
describe('<UpdateButton/>', () => {
|
|
5
6
|
const noop = () => {};
|
|
6
|
-
|
|
7
|
+
test('accepts an `onClick` prop', async () => {
|
|
8
|
+
const user = userEvent.setup();
|
|
7
9
|
const onClick = jest.fn();
|
|
8
|
-
|
|
10
|
+
render(/*#__PURE__*/React.createElement(UpdateButton, {
|
|
9
11
|
onClick: onClick
|
|
10
12
|
}));
|
|
11
|
-
|
|
13
|
+
await user.click(screen.getByRole('button'));
|
|
12
14
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
13
15
|
});
|
|
14
|
-
|
|
16
|
+
test('accepts a `dataTest` prop', () => {
|
|
15
17
|
const dataTest = 'test';
|
|
16
|
-
|
|
18
|
+
render(/*#__PURE__*/React.createElement(UpdateButton, {
|
|
17
19
|
onClick: noop,
|
|
18
20
|
dataTest: dataTest
|
|
19
21
|
}));
|
|
20
|
-
expect(
|
|
22
|
+
expect(screen.getByTestId(dataTest)).toBeInTheDocument();
|
|
21
23
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
test('accepts a `disabled` prop', () => {
|
|
25
|
+
render(/*#__PURE__*/React.createElement(UpdateButton, {
|
|
24
26
|
disabled: true,
|
|
25
27
|
onClick: noop
|
|
26
28
|
}));
|
|
27
|
-
expect(
|
|
29
|
+
expect(screen.getByRole('button')).toBeDisabled();
|
|
28
30
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
test('accepts an `loading` prop', () => {
|
|
32
|
+
render(/*#__PURE__*/React.createElement(UpdateButton, {
|
|
31
33
|
onClick: noop,
|
|
32
34
|
loading: true
|
|
33
35
|
}));
|
|
34
|
-
expect(
|
|
36
|
+
expect(screen.getByTestId('dhis2-uicore-circularloader')).toBeInTheDocument();
|
|
35
37
|
});
|
|
36
38
|
});
|
|
@@ -4,21 +4,20 @@ import cx from 'classnames';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import styles from './styles/TransferOption.style.js';
|
|
7
|
-
export const TransferOption =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
7
|
+
export const TransferOption = ({
|
|
8
|
+
disabled,
|
|
9
|
+
label,
|
|
10
|
+
highlighted,
|
|
11
|
+
selected,
|
|
12
|
+
onClick,
|
|
13
|
+
onDoubleClick,
|
|
14
|
+
value,
|
|
15
|
+
icon,
|
|
16
|
+
active,
|
|
17
|
+
tooltipText,
|
|
18
|
+
dataTest,
|
|
19
|
+
onEditClick
|
|
20
|
+
}) => {
|
|
22
21
|
const renderContent = () => /*#__PURE__*/React.createElement("div", {
|
|
23
22
|
"data-test": `${dataTest}-content`,
|
|
24
23
|
onClick: event => {
|
|
@@ -8,33 +8,28 @@ const query = {
|
|
|
8
8
|
resource: 'locales/db'
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
export const LocalesSelect =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = _ref;
|
|
11
|
+
export const LocalesSelect = ({
|
|
12
|
+
onChange,
|
|
13
|
+
selected
|
|
14
|
+
}) => {
|
|
16
15
|
const {
|
|
17
16
|
data,
|
|
18
17
|
fetching
|
|
19
18
|
} = useDataQuery(query);
|
|
20
19
|
return /*#__PURE__*/React.createElement(SingleSelect, {
|
|
21
20
|
prefix: selected ? i18n.t('Translating to') : i18n.t('Choose a locale'),
|
|
22
|
-
onChange:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref2;
|
|
26
|
-
return onChange(selected);
|
|
27
|
-
},
|
|
21
|
+
onChange: ({
|
|
22
|
+
selected
|
|
23
|
+
}) => onChange(selected),
|
|
28
24
|
loading: fetching,
|
|
29
25
|
selected: data && selected ? selected : '',
|
|
30
26
|
dense: true
|
|
31
27
|
}, data && data.locales
|
|
32
28
|
// XXX remove duplicates ?! fr_SN - French (Senegal)
|
|
33
|
-
.reduce((locales,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref3;
|
|
29
|
+
.reduce((locales, {
|
|
30
|
+
locale,
|
|
31
|
+
name
|
|
32
|
+
}) => {
|
|
38
33
|
if (!locales.find(entry => entry.locale === locale)) {
|
|
39
34
|
locales.push({
|
|
40
35
|
locale,
|
|
@@ -42,17 +37,14 @@ export const LocalesSelect = _ref => {
|
|
|
42
37
|
});
|
|
43
38
|
}
|
|
44
39
|
return locales;
|
|
45
|
-
}, []).map(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
label: name
|
|
54
|
-
});
|
|
55
|
-
}));
|
|
40
|
+
}, []).map(({
|
|
41
|
+
locale,
|
|
42
|
+
name
|
|
43
|
+
}) => /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
44
|
+
key: locale,
|
|
45
|
+
value: locale,
|
|
46
|
+
label: name
|
|
47
|
+
})));
|
|
56
48
|
};
|
|
57
49
|
LocalesSelect.propTypes = {
|
|
58
50
|
onChange: PropTypes.func.isRequired,
|
|
@@ -7,15 +7,14 @@ import { LocalesSelect } from './LocalesSelect.js';
|
|
|
7
7
|
import { TranslationModalActions } from './TranslationModalActions.js';
|
|
8
8
|
const SESSION_STORAGE_TRANSLATION_LOCALE_KEY = 'translation-dialog-selected-locale';
|
|
9
9
|
const camelCaseToUnderscores = field => field.replace(/[a-z][A-Z]/g, match => [match.charAt(0), match.charAt(1)].join('_')).toLowerCase();
|
|
10
|
-
export const TranslationForm =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
10
|
+
export const TranslationForm = ({
|
|
11
|
+
fieldsToTranslate,
|
|
12
|
+
objectToTranslate,
|
|
13
|
+
translations,
|
|
14
|
+
resource,
|
|
15
|
+
onTranslationSaved,
|
|
16
|
+
onClose
|
|
17
|
+
}) => {
|
|
19
18
|
const [newTranslations, setNewTranslations] = useState();
|
|
20
19
|
const [translationLocale, setTranslationLocale] = useState();
|
|
21
20
|
const [fieldsTranslations, setFieldsTranslations] = useState({});
|
|
@@ -68,14 +67,11 @@ export const TranslationForm = _ref => {
|
|
|
68
67
|
const translationsMutationRef = useRef({
|
|
69
68
|
resource: `${resource}/translations`,
|
|
70
69
|
type: 'update',
|
|
71
|
-
data:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
translations
|
|
77
|
-
};
|
|
78
|
-
}
|
|
70
|
+
data: ({
|
|
71
|
+
translations
|
|
72
|
+
}) => ({
|
|
73
|
+
translations
|
|
74
|
+
})
|
|
79
75
|
});
|
|
80
76
|
const [saveTranslations, {
|
|
81
77
|
loading: saveInProgress
|
|
@@ -119,12 +115,9 @@ export const TranslationForm = _ref => {
|
|
|
119
115
|
})), translationLocale && /*#__PURE__*/React.createElement(DataTableCell, null, /*#__PURE__*/React.createElement(TextAreaField, {
|
|
120
116
|
label: fieldsTranslations[field],
|
|
121
117
|
value: getTranslationForField(field),
|
|
122
|
-
onChange:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} = _ref3;
|
|
126
|
-
return setTranslationForField(field, value);
|
|
127
|
-
},
|
|
118
|
+
onChange: ({
|
|
119
|
+
value
|
|
120
|
+
}) => setTranslationForField(field, value),
|
|
128
121
|
rows: 3
|
|
129
122
|
})), !translationLocale && index === 0 && /*#__PURE__*/React.createElement(DataTableCell, {
|
|
130
123
|
rowSpan: String(fieldsToTranslate.length)
|
|
@@ -5,13 +5,12 @@ import React, { useEffect, useState } from 'react';
|
|
|
5
5
|
import { TranslationForm } from './TranslationForm.js';
|
|
6
6
|
import { TranslationModalActions } from './TranslationModalActions.js';
|
|
7
7
|
import { useTranslationsResults } from './useTranslationsResults.js';
|
|
8
|
-
export const TranslationModal =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} = _ref;
|
|
8
|
+
export const TranslationModal = ({
|
|
9
|
+
objectToTranslate,
|
|
10
|
+
fieldsToTranslate,
|
|
11
|
+
onClose,
|
|
12
|
+
onTranslationSaved
|
|
13
|
+
}) => {
|
|
15
14
|
const [translations, setTranslations] = useState([]);
|
|
16
15
|
const endpointPath = new URL(objectToTranslate.href).pathname;
|
|
17
16
|
const endpointPathMatch = endpointPath.match(/api\/(?:\d+\/)?(?<resource>.+)/);
|
|
@@ -30,7 +29,8 @@ export const TranslationModal = _ref => {
|
|
|
30
29
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
31
30
|
large: true,
|
|
32
31
|
position: "middle",
|
|
33
|
-
onClose: onClose
|
|
32
|
+
onClose: onClose,
|
|
33
|
+
dataTest: "dhis2-analytics-translation-modal"
|
|
34
34
|
}, /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Translate: {{objectName}}', {
|
|
35
35
|
objectName: objectToTranslate.name || 'TEXT',
|
|
36
36
|
// XXX
|
|
@@ -4,36 +4,27 @@ import { Button, ButtonStrip, ModalActions } from '@dhis2/ui';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { OfflineTooltip } from '../../OfflineTooltip.js';
|
|
7
|
-
const SaveButton =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
disabled: disabled
|
|
18
|
-
}, i18n.t('Save translations'));
|
|
19
|
-
};
|
|
20
|
-
SaveButton.defaultProps = {
|
|
21
|
-
disabled: false,
|
|
22
|
-
loading: false,
|
|
23
|
-
onClick: Function.prototype
|
|
24
|
-
};
|
|
7
|
+
const SaveButton = ({
|
|
8
|
+
disabled = false,
|
|
9
|
+
loading = false,
|
|
10
|
+
onClick = Function.prototype
|
|
11
|
+
}) => /*#__PURE__*/React.createElement(Button, {
|
|
12
|
+
primary: true,
|
|
13
|
+
onClick: onClick,
|
|
14
|
+
loading: loading,
|
|
15
|
+
disabled: disabled
|
|
16
|
+
}, i18n.t('Save translations'));
|
|
25
17
|
SaveButton.propTypes = {
|
|
26
18
|
disabled: PropTypes.bool.isRequired,
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
onClick: PropTypes.func.isRequired,
|
|
20
|
+
loading: PropTypes.bool
|
|
29
21
|
};
|
|
30
|
-
export const TranslationModalActions =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref2;
|
|
22
|
+
export const TranslationModalActions = ({
|
|
23
|
+
onClose,
|
|
24
|
+
onSave = Function.prototype,
|
|
25
|
+
saveInProgress,
|
|
26
|
+
saveButtonDisabled
|
|
27
|
+
}) => {
|
|
37
28
|
const {
|
|
38
29
|
isDisconnected: offline
|
|
39
30
|
} = useDhis2ConnectionStatus();
|
package/build/es/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CustomDataProvider } from '@dhis2/app-runtime';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { TranslationModal } from '../TranslationModal.js';
|
|
5
5
|
const mockUseTranslationResults = jest.fn(() => ({
|
|
@@ -9,19 +9,26 @@ const mockUseTranslationResults = jest.fn(() => ({
|
|
|
9
9
|
jest.mock('../useTranslationsResults.js', () => ({
|
|
10
10
|
useTranslationsResults: args => mockUseTranslationResults(args)
|
|
11
11
|
}));
|
|
12
|
-
describe('
|
|
13
|
-
let shallowTranslationModal;
|
|
12
|
+
describe('TranslationDialog component', () => {
|
|
14
13
|
let props;
|
|
15
14
|
const onClose = jest.fn();
|
|
16
15
|
const onTranslationSaved = jest.fn();
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const renderTranslationModalComponent = props => {
|
|
17
|
+
return render(/*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
18
|
+
data: {
|
|
19
|
+
i18n: {
|
|
20
|
+
name: 'Name',
|
|
21
|
+
description: 'Description'
|
|
22
|
+
},
|
|
23
|
+
'locales/db': [{
|
|
24
|
+
locale: 'en',
|
|
25
|
+
name: 'English',
|
|
26
|
+
displayName: 'English'
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement(TranslationModal, props)));
|
|
22
30
|
};
|
|
23
31
|
beforeEach(() => {
|
|
24
|
-
shallowTranslationModal = undefined;
|
|
25
32
|
props = {
|
|
26
33
|
fieldsToTranslate: ['name', 'description'],
|
|
27
34
|
objectToTranslate: {
|
|
@@ -32,15 +39,17 @@ describe('The Translation Dialog component', () => {
|
|
|
32
39
|
onTranslationSaved
|
|
33
40
|
};
|
|
34
41
|
});
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
test('renders a Modal component', () => {
|
|
43
|
+
renderTranslationModalComponent(props);
|
|
44
|
+
expect(screen.getByTestId('dhis2-analytics-translation-modal')).toBeInTheDocument();
|
|
37
45
|
});
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
test("renders a ModalTitle containing the object's name", () => {
|
|
47
|
+
renderTranslationModalComponent(props);
|
|
48
|
+
expect(screen.getByText(`Translate: ${props.objectToTranslate.name}`)).toBeInTheDocument();
|
|
40
49
|
});
|
|
41
50
|
test.each(['https://dhis2.tld/path/api/visualization/object-id', 'https://dhis2.tld/path/api/42/visualization/object-id'])('uses the correct resource for the translation endpoint', href => {
|
|
42
51
|
props.objectToTranslate.href = href;
|
|
43
|
-
|
|
52
|
+
renderTranslationModalComponent(props);
|
|
44
53
|
expect(mockUseTranslationResults).toHaveBeenCalled();
|
|
45
54
|
expect(mockUseTranslationResults).toHaveBeenCalledWith({
|
|
46
55
|
resource: 'visualization/object-id'
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useAlert, useDataQuery } from '@dhis2/app-runtime';
|
|
2
2
|
import i18n from '@dhis2/d2-i18n';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
|
-
export const useTranslationsResults =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} = _ref;
|
|
4
|
+
export const useTranslationsResults = ({
|
|
5
|
+
resource
|
|
6
|
+
}) => {
|
|
8
7
|
const translationsQueryRef = useRef({
|
|
9
8
|
translations: {
|
|
10
9
|
resource: `${resource}/translations`
|
|
@@ -2,13 +2,12 @@ import i18n from '@dhis2/d2-i18n';
|
|
|
2
2
|
import { MenuItem } from '@dhis2/ui';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const UserList =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
5
|
+
export const UserList = ({
|
|
6
|
+
users,
|
|
7
|
+
selectedUserIndex,
|
|
8
|
+
onUserClick,
|
|
9
|
+
pager
|
|
10
|
+
}) => {
|
|
12
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, users.map(u => {
|
|
13
12
|
var _users$selectedUserIn;
|
|
14
13
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
@@ -23,12 +23,11 @@ const getVirtualPopperReference = ref => {
|
|
|
23
23
|
})
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export const UserMentionWrapper =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
26
|
+
export const UserMentionWrapper = ({
|
|
27
|
+
children,
|
|
28
|
+
inputReference,
|
|
29
|
+
onUserSelect = Function.prototype
|
|
30
|
+
}) => {
|
|
32
31
|
const [listIsOpen, setListIsOpen] = useState(false);
|
|
33
32
|
const [captureText, setCaptureText] = useState(false);
|
|
34
33
|
const [capturedText, setCapturedText] = useState('');
|
|
@@ -61,10 +60,9 @@ export const UserMentionWrapper = _ref => {
|
|
|
61
60
|
const onUserListClose = () => reset();
|
|
62
61
|
|
|
63
62
|
// event bubbles up from the input/textarea
|
|
64
|
-
const onInput =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = _ref2;
|
|
63
|
+
const onInput = ({
|
|
64
|
+
target
|
|
65
|
+
}) => {
|
|
68
66
|
const {
|
|
69
67
|
selectionEnd,
|
|
70
68
|
value
|
|
@@ -83,11 +81,10 @@ export const UserMentionWrapper = _ref => {
|
|
|
83
81
|
};
|
|
84
82
|
|
|
85
83
|
// event bubbles up from the wrapped input/textarea
|
|
86
|
-
const onKeyDown =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} = _ref3;
|
|
84
|
+
const onKeyDown = ({
|
|
85
|
+
key,
|
|
86
|
+
target
|
|
87
|
+
}) => {
|
|
91
88
|
const {
|
|
92
89
|
selectionStart
|
|
93
90
|
} = target;
|
|
@@ -187,9 +184,6 @@ export const UserMentionWrapper = _ref => {
|
|
|
187
184
|
id: userMentionWrapperClasses.__hash
|
|
188
185
|
}, userMentionWrapperClasses), resolvedHeaderStyle.styles);
|
|
189
186
|
};
|
|
190
|
-
UserMentionWrapper.defaultProps = {
|
|
191
|
-
onUserSelect: Function.prototype
|
|
192
|
-
};
|
|
193
187
|
UserMentionWrapper.propTypes = {
|
|
194
188
|
inputReference: PropTypes.object.isRequired,
|
|
195
189
|
onUserSelect: PropTypes.func.isRequired,
|
|
@@ -4,24 +4,20 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
4
4
|
const usersQuery = {
|
|
5
5
|
users: {
|
|
6
6
|
resource: 'users/gist',
|
|
7
|
-
params:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
rootJunction: 'OR'
|
|
17
|
-
};
|
|
18
|
-
}
|
|
7
|
+
params: ({
|
|
8
|
+
searchText
|
|
9
|
+
}) => ({
|
|
10
|
+
fields: 'id,displayName,username',
|
|
11
|
+
order: 'firstName,surname',
|
|
12
|
+
total: true,
|
|
13
|
+
filter: `username:ilike:${searchText},firstName:ilike:${searchText},surname:ilike:${searchText},email:ilike:${searchText}`,
|
|
14
|
+
rootJunction: 'OR'
|
|
15
|
+
})
|
|
19
16
|
}
|
|
20
17
|
};
|
|
21
|
-
export const useUserSearchResults =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref2;
|
|
18
|
+
export const useUserSearchResults = ({
|
|
19
|
+
searchText
|
|
20
|
+
}) => {
|
|
25
21
|
const [{
|
|
26
22
|
users,
|
|
27
23
|
pager
|
|
@@ -2,12 +2,11 @@ import { IconVisualizationArea16, IconVisualizationAreaStacked16, IconVisualizat
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { VIS_TYPE_LINE_LIST, VIS_TYPE_PIVOT_TABLE, VIS_TYPE_COLUMN, VIS_TYPE_STACKED_COLUMN, VIS_TYPE_BAR, VIS_TYPE_STACKED_BAR, VIS_TYPE_LINE, VIS_TYPE_AREA, VIS_TYPE_STACKED_AREA, VIS_TYPE_PIE, VIS_TYPE_RADAR, VIS_TYPE_GAUGE, VIS_TYPE_YEAR_OVER_YEAR_LINE, VIS_TYPE_YEAR_OVER_YEAR_COLUMN, VIS_TYPE_SINGLE_VALUE, VIS_TYPE_SCATTER, VIS_TYPE_OUTLIER_TABLE } from '../modules/visTypes.js';
|
|
5
|
-
export const VisTypeIcon =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} = _ref;
|
|
5
|
+
export const VisTypeIcon = ({
|
|
6
|
+
type,
|
|
7
|
+
useSmall = false,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
11
10
|
let VisIcon;
|
|
12
11
|
switch (type) {
|
|
13
12
|
case VIS_TYPE_LINE_LIST:
|