@hisptz/dhis2-analytics 1.0.9 → 1.0.11
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/components/ChartAnalytics/ChartAnalytics.stories.js +6 -6
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +2 -4
- package/build/cjs/components/ChartAnalytics/index.js +25 -17
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +1 -1
- package/build/cjs/components/Map/Map.stories.js +1 -1
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +1 -1
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +1 -1
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +3 -12
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +8 -1
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +1 -1
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +1 -1
- package/build/cjs/components/PivotTable/PivotTable.stories.js +277 -0
- package/build/cjs/components/PivotTable/components/AssignedCategoriesIcon/index.js +32 -0
- package/build/cjs/components/PivotTable/components/PivotTable.js +60 -0
- package/build/cjs/components/PivotTable/components/PivotTableBody.js +41 -0
- package/build/cjs/components/PivotTable/components/PivotTableCell.js +40 -0
- package/build/cjs/components/PivotTable/components/PivotTableClippedAxis.js +26 -0
- package/build/cjs/components/PivotTable/components/PivotTableColumnHeaderCell.js +71 -0
- package/build/cjs/components/PivotTable/components/PivotTableColumnHeaders.js +60 -0
- package/build/cjs/components/PivotTable/components/PivotTableContainer.js +33 -0
- package/build/cjs/components/PivotTable/components/PivotTableDimensionLabelCell.js +77 -0
- package/build/cjs/components/PivotTable/components/PivotTableEmptyCell.js +22 -0
- package/build/cjs/components/PivotTable/components/PivotTableEmptyRow.js +33 -0
- package/build/cjs/components/PivotTable/components/PivotTableEngineContext.js +25 -0
- package/build/cjs/components/PivotTable/components/PivotTableHead.js +35 -0
- package/build/cjs/components/PivotTable/components/PivotTableHeaderCell.js +37 -0
- package/build/cjs/components/PivotTable/components/PivotTableRow.js +65 -0
- package/build/cjs/components/PivotTable/components/PivotTableRowHeaderCell.js +49 -0
- package/build/cjs/components/PivotTable/components/PivotTableTitleRow.js +52 -0
- package/build/cjs/components/PivotTable/components/PivotTableTitleRows.js +46 -0
- package/build/cjs/components/PivotTable/components/PivotTableValueCell.js +69 -0
- package/build/cjs/components/PivotTable/constants/dataTypes.js +129 -0
- package/build/cjs/components/PivotTable/constants/pivotTable.js +64 -0
- package/build/cjs/components/PivotTable/constants/predefinedDimensions.js +62 -0
- package/build/cjs/components/PivotTable/constants/valueTypes.js +55 -0
- package/build/cjs/components/PivotTable/data/column-data.json +210 -0
- package/build/cjs/components/PivotTable/hooks/useParentSize.js +41 -0
- package/build/cjs/components/PivotTable/hooks/useScrollPosition.js +38 -0
- package/build/cjs/components/PivotTable/hooks/useSortableColumns.js +34 -0
- package/build/cjs/components/PivotTable/hooks/useTableClipping.js +53 -0
- package/build/cjs/components/PivotTable/index.js +47 -0
- package/build/cjs/components/PivotTable/interfaces/index.js +1 -0
- package/build/cjs/components/PivotTable/services/adaptiveClippingController.js +197 -0
- package/build/cjs/components/PivotTable/services/engine.js +901 -0
- package/build/cjs/components/PivotTable/utils/getOuLevelAndGroupText.js +71 -0
- package/build/cjs/components/PivotTable/utils/index.js +322 -0
- package/build/cjs/components/PivotTable/utils/isColorBright.js +29 -0
- package/build/cjs/components/PivotTable/utils/layout/dimension.js +61 -0
- package/build/cjs/components/PivotTable/utils/layout/dimensionGetId.js +12 -0
- package/build/cjs/components/PivotTable/utils/layout/dimensionGetItems.js +12 -0
- package/build/cjs/components/PivotTable/utils/layout/dimensionIs.js +9 -0
- package/build/cjs/components/PivotTable/utils/layout/dimensionIsEmpty.js +9 -0
- package/build/cjs/components/PivotTable/utils/layout/dimensionIsValid.js +25 -0
- package/build/cjs/components/PivotTable/utils/legend.js +40 -0
- package/build/cjs/components/PivotTable/utils/ouIdHelper/index.js +27 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +1 -1
- package/build/cjs/index.js +11 -0
- package/build/cjs/locales/en/translations.json +33 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +3 -3
- package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +2 -3
- package/build/es/components/ChartAnalytics/index.js +2 -3
- package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +1 -1
- package/build/es/components/Map/Map.stories.js +1 -1
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +1 -1
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +1 -1
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +9 -8
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +8 -1
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +1 -1
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +1 -1
- package/build/es/components/PivotTable/PivotTable.stories.js +268 -0
- package/build/es/components/PivotTable/components/AssignedCategoriesIcon/index.js +24 -0
- package/build/es/components/PivotTable/components/PivotTable.js +51 -0
- package/build/es/components/PivotTable/components/PivotTableBody.js +33 -0
- package/build/es/components/PivotTable/components/PivotTableCell.js +32 -0
- package/build/es/components/PivotTable/components/PivotTableClippedAxis.js +18 -0
- package/build/es/components/PivotTable/components/PivotTableColumnHeaderCell.js +62 -0
- package/build/es/components/PivotTable/components/PivotTableColumnHeaders.js +52 -0
- package/build/es/components/PivotTable/components/PivotTableContainer.js +25 -0
- package/build/es/components/PivotTable/components/PivotTableDimensionLabelCell.js +68 -0
- package/build/es/components/PivotTable/components/PivotTableEmptyCell.js +14 -0
- package/build/es/components/PivotTable/components/PivotTableEmptyRow.js +25 -0
- package/build/es/components/PivotTable/components/PivotTableEngineContext.js +14 -0
- package/build/es/components/PivotTable/components/PivotTableHead.js +27 -0
- package/build/es/components/PivotTable/components/PivotTableHeaderCell.js +29 -0
- package/build/es/components/PivotTable/components/PivotTableRow.js +57 -0
- package/build/es/components/PivotTable/components/PivotTableRowHeaderCell.js +41 -0
- package/build/es/components/PivotTable/components/PivotTableTitleRow.js +42 -0
- package/build/es/components/PivotTable/components/PivotTableTitleRows.js +37 -0
- package/build/es/components/PivotTable/components/PivotTableValueCell.js +60 -0
- package/build/es/components/PivotTable/constants/dataTypes.js +98 -0
- package/build/es/components/PivotTable/constants/pivotTable.js +29 -0
- package/build/es/components/PivotTable/constants/predefinedDimensions.js +44 -0
- package/build/es/components/PivotTable/constants/valueTypes.js +27 -0
- package/build/es/components/PivotTable/data/column-data.json +210 -0
- package/build/es/components/PivotTable/hooks/useParentSize.js +33 -0
- package/build/es/components/PivotTable/hooks/useScrollPosition.js +30 -0
- package/build/es/components/PivotTable/hooks/useSortableColumns.js +27 -0
- package/build/es/components/PivotTable/hooks/useTableClipping.js +46 -0
- package/build/es/components/PivotTable/index.js +26 -0
- package/build/es/components/PivotTable/interfaces/index.js +1 -0
- package/build/es/components/PivotTable/services/adaptiveClippingController.js +191 -0
- package/build/es/components/PivotTable/services/engine.js +894 -0
- package/build/es/components/PivotTable/utils/getOuLevelAndGroupText.js +63 -0
- package/build/es/components/PivotTable/utils/index.js +309 -0
- package/build/es/components/PivotTable/utils/isColorBright.js +22 -0
- package/build/es/components/PivotTable/utils/layout/dimension.js +48 -0
- package/build/es/components/PivotTable/utils/layout/dimensionGetId.js +5 -0
- package/build/es/components/PivotTable/utils/layout/dimensionGetItems.js +5 -0
- package/build/es/components/PivotTable/utils/layout/dimensionIs.js +2 -0
- package/build/es/components/PivotTable/utils/layout/dimensionIsEmpty.js +2 -0
- package/build/es/components/PivotTable/utils/layout/dimensionIsValid.js +18 -0
- package/build/es/components/PivotTable/utils/legend.js +27 -0
- package/build/es/components/PivotTable/utils/ouIdHelper/index.js +17 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +1 -1
- package/build/es/index.js +1 -0
- package/build/es/locales/en/translations.json +33 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +1 -2
- package/build/types/components/ChartAnalytics/index.d.ts +3 -3
- package/build/types/components/PivotTable/components/AssignedCategoriesIcon/index.d.ts +3 -0
- package/build/types/components/PivotTable/components/PivotTable.d.ts +12 -0
- package/build/types/components/PivotTable/components/PivotTableBody.d.ts +7 -0
- package/build/types/components/PivotTable/components/PivotTableCell.d.ts +17 -0
- package/build/types/components/PivotTable/components/PivotTableClippedAxis.d.ts +7 -0
- package/build/types/components/PivotTable/components/PivotTableColumnHeaderCell.d.ts +13 -0
- package/build/types/components/PivotTable/components/PivotTableColumnHeaders.d.ts +11 -0
- package/build/types/components/PivotTable/components/PivotTableContainer.d.ts +8 -0
- package/build/types/components/PivotTable/components/PivotTableDimensionLabelCell.d.ts +13 -0
- package/build/types/components/PivotTable/components/PivotTableEmptyCell.d.ts +7 -0
- package/build/types/components/PivotTable/components/PivotTableEmptyRow.d.ts +5 -0
- package/build/types/components/PivotTable/components/PivotTableEngineContext.d.ts +8 -0
- package/build/types/components/PivotTable/components/PivotTableHead.d.ts +21 -0
- package/build/types/components/PivotTable/components/PivotTableHeaderCell.d.ts +22 -0
- package/build/types/components/PivotTable/components/PivotTableRow.d.ts +19 -0
- package/build/types/components/PivotTable/components/PivotTableRowHeaderCell.d.ts +8 -0
- package/build/types/components/PivotTable/components/PivotTableTitleRow.d.ts +21 -0
- package/build/types/components/PivotTable/components/PivotTableTitleRows.d.ts +12 -0
- package/build/types/components/PivotTable/components/PivotTableValueCell.d.ts +8 -0
- package/build/types/components/PivotTable/constants/dataTypes.d.ts +90 -0
- package/build/types/components/PivotTable/constants/pivotTable.d.ts +29 -0
- package/build/types/components/PivotTable/constants/predefinedDimensions.d.ts +80 -0
- package/build/types/components/PivotTable/constants/valueTypes.d.ts +22 -0
- package/build/types/components/PivotTable/hooks/useParentSize.d.ts +8 -0
- package/build/types/components/PivotTable/hooks/useScrollPosition.d.ts +5 -0
- package/build/types/components/PivotTable/hooks/useSortableColumns.d.ts +8 -0
- package/build/types/components/PivotTable/hooks/useTableClipping.d.ts +24 -0
- package/build/types/components/PivotTable/index.d.ts +26 -0
- package/build/types/components/PivotTable/interfaces/index.d.ts +72 -0
- package/build/types/components/PivotTable/services/adaptiveClippingController.d.ts +44 -0
- package/build/types/components/PivotTable/services/engine.d.ts +252 -0
- package/build/types/components/PivotTable/utils/getOuLevelAndGroupText.d.ts +1 -0
- package/build/types/components/PivotTable/utils/index.d.ts +38 -0
- package/build/types/components/PivotTable/utils/isColorBright.d.ts +1 -0
- package/build/types/components/PivotTable/utils/layout/dimension.d.ts +35 -0
- package/build/types/components/PivotTable/utils/layout/dimensionGetId.d.ts +3 -0
- package/build/types/components/PivotTable/utils/layout/dimensionGetItems.d.ts +3 -0
- package/build/types/components/PivotTable/utils/layout/dimensionIs.d.ts +1 -0
- package/build/types/components/PivotTable/utils/layout/dimensionIsEmpty.d.ts +3 -0
- package/build/types/components/PivotTable/utils/layout/dimensionIsValid.d.ts +5 -0
- package/build/types/components/PivotTable/utils/legend.d.ts +11 -0
- package/build/types/components/PivotTable/utils/ouIdHelper/index.d.ts +10 -0
- package/build/types/index.d.ts +1 -0
- package/package.json +6 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const SORT_ORDER_ASCENDING = 1;
|
|
2
|
+
export const SORT_ORDER_DESCENDING = -1;
|
|
3
|
+
export const CELL_TYPE_VALUE = 'value';
|
|
4
|
+
export const CELL_TYPE_SUBTOTAL = 'subtotal';
|
|
5
|
+
export const CELL_TYPE_TOTAL = 'total';
|
|
6
|
+
export const AGGREGATE_TYPE_SUM = 'SUM';
|
|
7
|
+
export const AGGREGATE_TYPE_AVERAGE = 'AVERAGE';
|
|
8
|
+
export const AGGREGATE_TYPE_NA = 'N/A';
|
|
9
|
+
export const NUMBER_TYPE_VALUE = 'VALUE';
|
|
10
|
+
export const NUMBER_TYPE_ROW_PERCENTAGE = 'ROW_PERCENTAGE';
|
|
11
|
+
export const NUMBER_TYPE_COLUMN_PERCENTAGE = 'COLUMN_PERCENTAGE';
|
|
12
|
+
export const BORDER_COLOR = '#b2b2b2';
|
|
13
|
+
export const FONT_SIZE_OPTION_SMALL = 'SMALL';
|
|
14
|
+
export const FONT_SIZE_SMALL = 10;
|
|
15
|
+
export const FONT_SIZE_OPTION_NORMAL = 'NORMAL';
|
|
16
|
+
export const FONT_SIZE_NORMAL = 11;
|
|
17
|
+
export const FONT_SIZE_OPTION_LARGE = 'LARGE';
|
|
18
|
+
export const FONT_SIZE_LARGE = 13;
|
|
19
|
+
export const DISPLAY_DENSITY_OPTION_COMPACT = 'COMPACT';
|
|
20
|
+
export const DISPLAY_DENSITY_PADDING_COMPACT = 4;
|
|
21
|
+
export const DISPLAY_DENSITY_OPTION_NORMAL = 'NORMAL';
|
|
22
|
+
export const DISPLAY_DENSITY_PADDING_NORMAL = 5;
|
|
23
|
+
export const DISPLAY_DENSITY_OPTION_COMFORTABLE = 'COMFORTABLE';
|
|
24
|
+
export const DISPLAY_DENSITY_PADDING_COMFORTABLE = 7;
|
|
25
|
+
export const CLIPPED_CELL_MAX_SIZE = 360;
|
|
26
|
+
export const CLIPPED_CELL_MIN_SIZE = 36;
|
|
27
|
+
export const WRAPPED_TEXT_JUSTIFY_BUFFER = 25;
|
|
28
|
+
export const WRAPPED_TEXT_LINE_HEIGHT = 1.0;
|
|
29
|
+
export const CLIPPED_AXIS_PARTITION_SIZE_PX = 1000;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IconClock16, IconDimensionData16, IconDimensionOrgUnit16 } from '@dhis2/ui';
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import AssignedCategoriesIcon from "../components/AssignedCategoriesIcon";
|
|
4
|
+
export const DIMENSION_ID_DATA = 'dx';
|
|
5
|
+
export const DIMENSION_ID_PERIOD = 'pe';
|
|
6
|
+
export const DIMENSION_ID_ORGUNIT = 'ou';
|
|
7
|
+
export const DIMENSION_ID_ASSIGNED_CATEGORIES = 'co';
|
|
8
|
+
export const DIMENSION_PROP_NO_ITEMS = 'noItems';
|
|
9
|
+
export const getFixedDimensions = () => ({
|
|
10
|
+
[DIMENSION_ID_DATA]: {
|
|
11
|
+
id: DIMENSION_ID_DATA,
|
|
12
|
+
name: i18n.t('Data'),
|
|
13
|
+
iconName: 'DataIcon',
|
|
14
|
+
icon: IconDimensionData16
|
|
15
|
+
},
|
|
16
|
+
[DIMENSION_ID_PERIOD]: {
|
|
17
|
+
id: DIMENSION_ID_PERIOD,
|
|
18
|
+
name: i18n.t('Period'),
|
|
19
|
+
iconName: 'PeriodIcon',
|
|
20
|
+
icon: IconClock16
|
|
21
|
+
},
|
|
22
|
+
[DIMENSION_ID_ORGUNIT]: {
|
|
23
|
+
id: DIMENSION_ID_ORGUNIT,
|
|
24
|
+
name: i18n.t('Organisation unit'),
|
|
25
|
+
iconName: 'OrgUnitIcon',
|
|
26
|
+
icon: IconDimensionOrgUnit16
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export const getDynamicDimensions = () => ({
|
|
30
|
+
[DIMENSION_ID_ASSIGNED_CATEGORIES]: {
|
|
31
|
+
id: DIMENSION_ID_ASSIGNED_CATEGORIES,
|
|
32
|
+
name: i18n.t('Assigned Categories'),
|
|
33
|
+
iconName: 'AssignedCategoriesIcon',
|
|
34
|
+
icon: AssignedCategoriesIcon,
|
|
35
|
+
[DIMENSION_PROP_NO_ITEMS]: true
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export const getPredefinedDimensions = () => ({
|
|
39
|
+
...getFixedDimensions(),
|
|
40
|
+
...getDynamicDimensions()
|
|
41
|
+
});
|
|
42
|
+
export const filterOutPredefinedDimensions = dimensionIds => dimensionIds.filter(dimensionId => !Object.keys(getPredefinedDimensions()).includes(dimensionId));
|
|
43
|
+
export const getPredefinedDimensionProp = (dimensionId, propName) => (getPredefinedDimensions()[dimensionId] || {})[propName];
|
|
44
|
+
export const getDimensionById = dimensionId => getPredefinedDimensions()[dimensionId];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* These types match the types in the backend
|
|
2
|
+
https://github.com/dhis2/dhis2-core/blob/master/dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const VALUE_TYPE_NUMBER = 'NUMBER';
|
|
6
|
+
export const VALUE_TYPE_UNIT_INTERVAL = 'UNIT_INTERVAL';
|
|
7
|
+
export const VALUE_TYPE_PERCENTAGE = 'PERCENTAGE';
|
|
8
|
+
export const VALUE_TYPE_INTEGER = 'INTEGER';
|
|
9
|
+
export const VALUE_TYPE_INTEGER_POSITIVE = 'INTEGER_POSITIVE';
|
|
10
|
+
export const VALUE_TYPE_INTEGER_NEGATIVE = 'INTEGER_NEGATIVE';
|
|
11
|
+
export const VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = 'INTEGER_ZERO_OR_POSITIVE';
|
|
12
|
+
export const VALUE_TYPE_TEXT = 'TEXT';
|
|
13
|
+
export const VALUE_TYPE_LONG_TEXT = 'LONG_TEXT';
|
|
14
|
+
export const VALUE_TYPE_LETTER = 'LETTER';
|
|
15
|
+
export const VALUE_TYPE_PHONE_NUMBER = 'PHONE_NUMBER';
|
|
16
|
+
export const VALUE_TYPE_EMAIL = 'EMAIL';
|
|
17
|
+
export const VALUE_TYPE_USERNAME = 'USERNAME';
|
|
18
|
+
export const VALUE_TYPE_URL = 'URL';
|
|
19
|
+
export const VALUE_TYPE_BOOLEAN = 'BOOLEAN';
|
|
20
|
+
export const VALUE_TYPE_TRUE_ONLY = 'TRUE_ONLY';
|
|
21
|
+
export const VALUE_TYPE_DATE = 'DATE';
|
|
22
|
+
export const VALUE_TYPE_TIME = 'TIME';
|
|
23
|
+
export const VALUE_TYPE_DATETIME = 'DATETIME';
|
|
24
|
+
export const VALUE_TYPE_ORGANISATION_UNIT = 'ORGANISATION_UNIT';
|
|
25
|
+
export const VALUE_TYPE_AGE = 'AGE';
|
|
26
|
+
const NUMERIC_VALUE_TYPES = [VALUE_TYPE_NUMBER, VALUE_TYPE_UNIT_INTERVAL, VALUE_TYPE_PERCENTAGE, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE];
|
|
27
|
+
export const isNumericValueType = type => NUMERIC_VALUE_TYPES.includes(type);
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": [
|
|
3
|
+
{
|
|
4
|
+
"name": "dx",
|
|
5
|
+
"column": "Data",
|
|
6
|
+
"valueType": "TEXT",
|
|
7
|
+
"type": "java.lang.String",
|
|
8
|
+
"hidden": false,
|
|
9
|
+
"meta": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ou",
|
|
13
|
+
"column": "Organisation unit",
|
|
14
|
+
"valueType": "TEXT",
|
|
15
|
+
"type": "java.lang.String",
|
|
16
|
+
"hidden": false,
|
|
17
|
+
"meta": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "value",
|
|
21
|
+
"column": "Value",
|
|
22
|
+
"valueType": "NUMBER",
|
|
23
|
+
"type": "java.lang.Double",
|
|
24
|
+
"hidden": false,
|
|
25
|
+
"meta": false
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"metaData": {
|
|
29
|
+
"items": {
|
|
30
|
+
"2022": {
|
|
31
|
+
"name": "2022"
|
|
32
|
+
},
|
|
33
|
+
"KctpIIucige": {
|
|
34
|
+
"name": "Selenga"
|
|
35
|
+
},
|
|
36
|
+
"YmmeuGbqOwR": {
|
|
37
|
+
"name": "Gbo"
|
|
38
|
+
},
|
|
39
|
+
"daJPPxtIrQn": {
|
|
40
|
+
"name": "Jaiama Bongor"
|
|
41
|
+
},
|
|
42
|
+
"tTUf91fCytl": {
|
|
43
|
+
"uid": "tTUf91fCytl",
|
|
44
|
+
"name": "Chiefdom"
|
|
45
|
+
},
|
|
46
|
+
"ou": {
|
|
47
|
+
"name": "Organisation unit"
|
|
48
|
+
},
|
|
49
|
+
"sxRd2XOzFbz": {
|
|
50
|
+
"name": "Tikonko"
|
|
51
|
+
},
|
|
52
|
+
"THIS_YEAR": {
|
|
53
|
+
"name": "This year"
|
|
54
|
+
},
|
|
55
|
+
"O6uvpzGd5pu": {
|
|
56
|
+
"uid": "O6uvpzGd5pu",
|
|
57
|
+
"code": "OU_264",
|
|
58
|
+
"name": "Bo"
|
|
59
|
+
},
|
|
60
|
+
"U6Kr7Gtpidn": {
|
|
61
|
+
"name": "Kakua"
|
|
62
|
+
},
|
|
63
|
+
"YuQRtpLP10I": {
|
|
64
|
+
"name": "Badjia"
|
|
65
|
+
},
|
|
66
|
+
"zFDYIgyGmXG": {
|
|
67
|
+
"name": "Bargbo"
|
|
68
|
+
},
|
|
69
|
+
"I4jWcnFmgEC": {
|
|
70
|
+
"name": "Niawa Lenga"
|
|
71
|
+
},
|
|
72
|
+
"dx": {
|
|
73
|
+
"name": "Data"
|
|
74
|
+
},
|
|
75
|
+
"BGGmAwx33dj": {
|
|
76
|
+
"name": "Bumpe Ngao"
|
|
77
|
+
},
|
|
78
|
+
"pe": {
|
|
79
|
+
"name": "Period"
|
|
80
|
+
},
|
|
81
|
+
"Uvn6LCg7dVU": {
|
|
82
|
+
"name": "ANC 1 Coverage"
|
|
83
|
+
},
|
|
84
|
+
"ARZ4y5i4reU": {
|
|
85
|
+
"name": "Wonde"
|
|
86
|
+
},
|
|
87
|
+
"JdhagCUEMbj": {
|
|
88
|
+
"name": "Komboya"
|
|
89
|
+
},
|
|
90
|
+
"vWbkYPRmKyS": {
|
|
91
|
+
"name": "Baoma"
|
|
92
|
+
},
|
|
93
|
+
"dGheVylzol6": {
|
|
94
|
+
"name": "Bargbe"
|
|
95
|
+
},
|
|
96
|
+
"kU8vhUkAGaT": {
|
|
97
|
+
"name": "Lugbu"
|
|
98
|
+
},
|
|
99
|
+
"npWGUj37qDe": {
|
|
100
|
+
"name": "Valunia"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"dimensions": {
|
|
104
|
+
"dx": [
|
|
105
|
+
"Uvn6LCg7dVU"
|
|
106
|
+
],
|
|
107
|
+
"pe": [
|
|
108
|
+
"2022"
|
|
109
|
+
],
|
|
110
|
+
"ou": [
|
|
111
|
+
"YuQRtpLP10I",
|
|
112
|
+
"vWbkYPRmKyS",
|
|
113
|
+
"dGheVylzol6",
|
|
114
|
+
"zFDYIgyGmXG",
|
|
115
|
+
"BGGmAwx33dj",
|
|
116
|
+
"YmmeuGbqOwR",
|
|
117
|
+
"daJPPxtIrQn",
|
|
118
|
+
"U6Kr7Gtpidn",
|
|
119
|
+
"JdhagCUEMbj",
|
|
120
|
+
"kU8vhUkAGaT",
|
|
121
|
+
"I4jWcnFmgEC",
|
|
122
|
+
"KctpIIucige",
|
|
123
|
+
"sxRd2XOzFbz",
|
|
124
|
+
"npWGUj37qDe",
|
|
125
|
+
"ARZ4y5i4reU"
|
|
126
|
+
],
|
|
127
|
+
"co": []
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"rows": [
|
|
131
|
+
[
|
|
132
|
+
"Uvn6LCg7dVU",
|
|
133
|
+
"YuQRtpLP10I",
|
|
134
|
+
"304.1"
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"Uvn6LCg7dVU",
|
|
138
|
+
"vWbkYPRmKyS",
|
|
139
|
+
"213.7"
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"Uvn6LCg7dVU",
|
|
143
|
+
"dGheVylzol6",
|
|
144
|
+
"126.5"
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
"Uvn6LCg7dVU",
|
|
148
|
+
"zFDYIgyGmXG",
|
|
149
|
+
"206.4"
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"Uvn6LCg7dVU",
|
|
153
|
+
"BGGmAwx33dj",
|
|
154
|
+
"120.9"
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"Uvn6LCg7dVU",
|
|
158
|
+
"YmmeuGbqOwR",
|
|
159
|
+
"203.1"
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
"Uvn6LCg7dVU",
|
|
163
|
+
"daJPPxtIrQn",
|
|
164
|
+
"89.3"
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
"Uvn6LCg7dVU",
|
|
168
|
+
"U6Kr7Gtpidn",
|
|
169
|
+
"104.4"
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
"Uvn6LCg7dVU",
|
|
173
|
+
"JdhagCUEMbj",
|
|
174
|
+
"187.1"
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
"Uvn6LCg7dVU",
|
|
178
|
+
"kU8vhUkAGaT",
|
|
179
|
+
"96.1"
|
|
180
|
+
],
|
|
181
|
+
[
|
|
182
|
+
"Uvn6LCg7dVU",
|
|
183
|
+
"I4jWcnFmgEC",
|
|
184
|
+
"147.9"
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
"Uvn6LCg7dVU",
|
|
188
|
+
"KctpIIucige",
|
|
189
|
+
"91.1"
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
"Uvn6LCg7dVU",
|
|
193
|
+
"sxRd2XOzFbz",
|
|
194
|
+
"203.2"
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"Uvn6LCg7dVU",
|
|
198
|
+
"npWGUj37qDe",
|
|
199
|
+
"95.7"
|
|
200
|
+
],
|
|
201
|
+
[
|
|
202
|
+
"Uvn6LCg7dVU",
|
|
203
|
+
"ARZ4y5i4reU",
|
|
204
|
+
"84.3"
|
|
205
|
+
]
|
|
206
|
+
],
|
|
207
|
+
"height": 15,
|
|
208
|
+
"width": 3,
|
|
209
|
+
"headerWidth": 3
|
|
210
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
3
|
+
const initialState = {
|
|
4
|
+
width: 0,
|
|
5
|
+
height: 0
|
|
6
|
+
};
|
|
7
|
+
export const useParentSize = function (elementRef, renderCounter) {
|
|
8
|
+
let initialSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : initialState;
|
|
9
|
+
const [size, setSize] = useState({
|
|
10
|
+
width: initialSize.width || 0,
|
|
11
|
+
height: initialSize.height || 0
|
|
12
|
+
});
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const el = elementRef.current && elementRef.current.parentElement;
|
|
15
|
+
if (!el) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const onResize = () => {
|
|
19
|
+
setSize({
|
|
20
|
+
width: el.clientWidth,
|
|
21
|
+
height: el.clientHeight
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
onResize();
|
|
25
|
+
if (renderCounter) {
|
|
26
|
+
setSize(initialState);
|
|
27
|
+
}
|
|
28
|
+
const observer = new ResizeObserver(onResize);
|
|
29
|
+
observer.observe(el);
|
|
30
|
+
return () => observer.disconnect();
|
|
31
|
+
}, [elementRef, renderCounter]);
|
|
32
|
+
return size;
|
|
33
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import debounce from 'lodash/debounce';
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
export const useScrollPosition = function (containerRef) {
|
|
4
|
+
let debounceWait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
5
|
+
const [scrollPosition, setScrollPosition] = useState({
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0
|
|
8
|
+
});
|
|
9
|
+
const onScroll = useCallback(debounce(() => {
|
|
10
|
+
if (!containerRef.current) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const scroll = {
|
|
14
|
+
x: containerRef.current.scrollLeft,
|
|
15
|
+
y: containerRef.current.scrollTop
|
|
16
|
+
};
|
|
17
|
+
setScrollPosition(scroll);
|
|
18
|
+
}, debounceWait), [containerRef, debounceWait]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const currentRef = containerRef.current;
|
|
21
|
+
if (!currentRef) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
currentRef.addEventListener('scroll', onScroll);
|
|
25
|
+
return () => {
|
|
26
|
+
currentRef.removeEventListener('scroll', onScroll);
|
|
27
|
+
};
|
|
28
|
+
}, [containerRef, onScroll]);
|
|
29
|
+
return scrollPosition;
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { SORT_ORDER_ASCENDING, SORT_ORDER_DESCENDING } from '../constants/pivotTable';
|
|
3
|
+
export const useSortableColumns = engine => {
|
|
4
|
+
const [sortBy, setSortBy] = useState(null);
|
|
5
|
+
const onSortByColumn = column => {
|
|
6
|
+
let order = SORT_ORDER_ASCENDING;
|
|
7
|
+
if (sortBy && sortBy.column === column) {
|
|
8
|
+
if (sortBy.order === SORT_ORDER_ASCENDING) {
|
|
9
|
+
order = SORT_ORDER_DESCENDING;
|
|
10
|
+
} else if (sortBy.order === SORT_ORDER_DESCENDING) {
|
|
11
|
+
engine.clearSort();
|
|
12
|
+
setSortBy(null);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
engine.sort(column, order);
|
|
17
|
+
setSortBy({
|
|
18
|
+
column,
|
|
19
|
+
order
|
|
20
|
+
}); // Force a re-render
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
sortBy,
|
|
25
|
+
onSortByColumn
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { clipPartitionedAxis } from '../utils';
|
|
3
|
+
import { CLIPPED_AXIS_PARTITION_SIZE_PX } from '../constants/pivotTable';
|
|
4
|
+
import { useScrollPosition } from './useScrollPosition.js';
|
|
5
|
+
export const useTableClipping = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
containerRef,
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
engine
|
|
11
|
+
} = _ref;
|
|
12
|
+
const scrollPosition = useScrollPosition(containerRef);
|
|
13
|
+
const lineHeight = engine.fontSize + engine.cellPadding * 2 + 2;
|
|
14
|
+
const rows = useMemo(() => {
|
|
15
|
+
const headerSize = engine.adaptiveClippingController.rows.headerSize + (engine.options.title ? lineHeight : 0) + (engine.options.subtitle ? lineHeight : 0);
|
|
16
|
+
const viewportPosition = engine.options.fixColumnHeaders ? scrollPosition.y : Math.max(0, scrollPosition.y - headerSize);
|
|
17
|
+
const viewportWidth = height - (engine.options.fixColumnHeaders ? engine.adaptiveClippingController.rows.headerSize : Math.max(headerSize - scrollPosition.y, 0));
|
|
18
|
+
return clipPartitionedAxis({
|
|
19
|
+
partitionSize: CLIPPED_AXIS_PARTITION_SIZE_PX,
|
|
20
|
+
partitions: engine.adaptiveClippingController.rows.partitions,
|
|
21
|
+
axisMap: engine.rowMap,
|
|
22
|
+
widthMap: engine.adaptiveClippingController.rows.sizes,
|
|
23
|
+
viewportWidth,
|
|
24
|
+
viewportPosition,
|
|
25
|
+
totalWidth: engine.adaptiveClippingController.rows.totalSize
|
|
26
|
+
});
|
|
27
|
+
}, [scrollPosition.y, height, lineHeight, engine.adaptiveClippingController.rows.headerSize, engine.adaptiveClippingController.rows.partitions, engine.adaptiveClippingController.rows.sizes, engine.adaptiveClippingController.rows.totalSize, engine.options.fixColumnHeaders, engine.rowMap, engine.options.title, engine.options.subtitle]);
|
|
28
|
+
const columns = useMemo(() => {
|
|
29
|
+
const viewportPosition = Math.max(0, engine.options.fixRowHeaders ? scrollPosition.x : scrollPosition.x - engine.adaptiveClippingController.columns.headerSize);
|
|
30
|
+
const viewportWidth = width - (engine.options.fixRowHeaders ? engine.adaptiveClippingController.columns.headerSize : Math.max(engine.adaptiveClippingController.columns.headerSize - scrollPosition.x, 0));
|
|
31
|
+
return clipPartitionedAxis({
|
|
32
|
+
partitionSize: CLIPPED_AXIS_PARTITION_SIZE_PX,
|
|
33
|
+
partitions: engine.adaptiveClippingController.columns.partitions,
|
|
34
|
+
axisMap: engine.columnMap,
|
|
35
|
+
widthMap: engine.adaptiveClippingController.columns.sizes,
|
|
36
|
+
viewportWidth,
|
|
37
|
+
viewportPosition,
|
|
38
|
+
totalWidth: engine.adaptiveClippingController.columns.totalSize
|
|
39
|
+
});
|
|
40
|
+
}, [scrollPosition.x, width, engine.adaptiveClippingController.columns.headerSize, engine.adaptiveClippingController.columns.partitions, engine.adaptiveClippingController.columns.sizes, engine.adaptiveClippingController.columns.totalSize, engine.options.fixRowHeaders, engine.columnMap]);
|
|
41
|
+
return {
|
|
42
|
+
rows,
|
|
43
|
+
columns,
|
|
44
|
+
scrollPosition
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PivotTable } from "./components/PivotTable";
|
|
3
|
+
export * from "./interfaces";
|
|
4
|
+
export function CustomPivotTable(_ref) {
|
|
5
|
+
var _config$options, _config$layout$column, _config$layout$rows$m, _config$layout$filter, _config$layout$filter2, _config$options2;
|
|
6
|
+
let {
|
|
7
|
+
analytics,
|
|
8
|
+
config
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/React.createElement(PivotTable, {
|
|
11
|
+
data: analytics,
|
|
12
|
+
legendSets: (_config$options = config.options) === null || _config$options === void 0 ? void 0 : _config$options.legendSets,
|
|
13
|
+
visualization: {
|
|
14
|
+
columns: (_config$layout$column = config.layout.columns.map(column => ({
|
|
15
|
+
dimension: column
|
|
16
|
+
}))) !== null && _config$layout$column !== void 0 ? _config$layout$column : [],
|
|
17
|
+
rows: (_config$layout$rows$m = config.layout.rows.map(column => ({
|
|
18
|
+
dimension: column
|
|
19
|
+
}))) !== null && _config$layout$rows$m !== void 0 ? _config$layout$rows$m : [],
|
|
20
|
+
filter: (_config$layout$filter = (_config$layout$filter2 = config.layout.filter) === null || _config$layout$filter2 === void 0 ? void 0 : _config$layout$filter2.map(column => ({
|
|
21
|
+
dimension: column
|
|
22
|
+
}))) !== null && _config$layout$filter !== void 0 ? _config$layout$filter : [],
|
|
23
|
+
...((_config$options2 = config.options) !== null && _config$options2 !== void 0 ? _config$options2 : {})
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
import { measureTextWithWrapping } from '../utils';
|
|
6
|
+
import { CLIPPED_AXIS_PARTITION_SIZE_PX, CLIPPED_CELL_MIN_SIZE } from '../constants/pivotTable';
|
|
7
|
+
export class AdaptiveClippingController {
|
|
8
|
+
constructor(engine) {
|
|
9
|
+
_defineProperty(this, "columns", {
|
|
10
|
+
orientation: "column",
|
|
11
|
+
sizes: [],
|
|
12
|
+
headerSize: 0,
|
|
13
|
+
partitions: [],
|
|
14
|
+
totalSize: 0
|
|
15
|
+
});
|
|
16
|
+
_defineProperty(this, "rows", {
|
|
17
|
+
orientation: "row",
|
|
18
|
+
sizes: [],
|
|
19
|
+
headerSize: 0,
|
|
20
|
+
partitions: [],
|
|
21
|
+
totalSize: 0
|
|
22
|
+
});
|
|
23
|
+
_defineProperty(this, "engine", void 0);
|
|
24
|
+
this.engine = engine;
|
|
25
|
+
this.reset();
|
|
26
|
+
}
|
|
27
|
+
addSize(_ref, _ref2) {
|
|
28
|
+
let {
|
|
29
|
+
row,
|
|
30
|
+
column
|
|
31
|
+
} = _ref;
|
|
32
|
+
let {
|
|
33
|
+
width,
|
|
34
|
+
height
|
|
35
|
+
} = _ref2;
|
|
36
|
+
if (column >= 0) {
|
|
37
|
+
const columnSize = this.columns.sizes[column] || {
|
|
38
|
+
pre: 0,
|
|
39
|
+
size: 0
|
|
40
|
+
};
|
|
41
|
+
columnSize.size = Math.max(columnSize.size, width);
|
|
42
|
+
this.columns.sizes[column] = columnSize;
|
|
43
|
+
} else {
|
|
44
|
+
const index = this.engine.rowDepth + column;
|
|
45
|
+
this.columns.headerSizes[index] = Math.max(this.columns.headerSizes[index] || 0, width);
|
|
46
|
+
}
|
|
47
|
+
if (row >= 0) {
|
|
48
|
+
const rowSize = this.rows.sizes[row] || {
|
|
49
|
+
pre: 0,
|
|
50
|
+
size: 0
|
|
51
|
+
};
|
|
52
|
+
rowSize.size = Math.max(rowSize.size, height);
|
|
53
|
+
this.rows.sizes[row] = rowSize;
|
|
54
|
+
} else {
|
|
55
|
+
const index = this.engine.columnDepth + row;
|
|
56
|
+
this.rows.headerSizes[index] = Math.max(this.rows.headerSizes[index] || 0, height);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
add(_ref3, renderedValue) {
|
|
60
|
+
let {
|
|
61
|
+
row,
|
|
62
|
+
column
|
|
63
|
+
} = _ref3;
|
|
64
|
+
this.addSize({
|
|
65
|
+
row,
|
|
66
|
+
column
|
|
67
|
+
}, this.measureText(renderedValue));
|
|
68
|
+
}
|
|
69
|
+
measureText(renderedValue) {
|
|
70
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
71
|
+
return measureTextWithWrapping(renderedValue, {
|
|
72
|
+
fontSize: this.engine.fontSize,
|
|
73
|
+
...options
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
getCellSize(contentSize) {
|
|
77
|
+
return Math.ceil(contentSize) + this.engine.cellPadding * 2 + /*border*/2;
|
|
78
|
+
}
|
|
79
|
+
finalizeAxis(axis) {
|
|
80
|
+
axis.headerSize = 0;
|
|
81
|
+
const isColumn = axis.orientation === 'column';
|
|
82
|
+
const map = isColumn ? this.engine.columnMap : this.engine.rowMap;
|
|
83
|
+
const getHeader = index => isColumn ? this.engine.getRawColumnHeader(index) : this.engine.getRawRowHeader(index);
|
|
84
|
+
map.forEach((index, mapIndex) => {
|
|
85
|
+
var _axis$sizes$index2;
|
|
86
|
+
const headerStack = getHeader(index);
|
|
87
|
+
headerStack === null || headerStack === void 0 ? void 0 : headerStack.forEach((header, level) => {
|
|
88
|
+
const label = this.engine.visualization.showHierarchy && header !== null && header !== void 0 && header.hierarchy ? header.hierarchy.join(' / ') : header === null || header === void 0 ? void 0 : header.name;
|
|
89
|
+
if (label) {
|
|
90
|
+
const isLeafHeader = level === headerStack.length - 1;
|
|
91
|
+
if (isColumn) {
|
|
92
|
+
var _axis$sizes$index;
|
|
93
|
+
const headerSize = this.measureText(label, {
|
|
94
|
+
maxWidth: isLeafHeader ? Math.max(CLIPPED_CELL_MIN_SIZE, ((_axis$sizes$index = axis.sizes[index]) === null || _axis$sizes$index === void 0 ? void 0 : _axis$sizes$index.size) || 0) : 0
|
|
95
|
+
});
|
|
96
|
+
this.addSize({
|
|
97
|
+
row: -headerStack.length + level,
|
|
98
|
+
column: index
|
|
99
|
+
}, {
|
|
100
|
+
height: headerSize.height,
|
|
101
|
+
width: isLeafHeader ? headerSize.width + (this.engine.isSortable(mapIndex) ? this.engine.scrollIconBuffer : 0) : 0
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
const headerSize = this.measureText(label, {});
|
|
105
|
+
this.addSize({
|
|
106
|
+
row: index,
|
|
107
|
+
column: -headerStack.length + level
|
|
108
|
+
}, {
|
|
109
|
+
height: isLeafHeader ? headerSize.height : 0,
|
|
110
|
+
width: headerSize.width
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
axis.sizes[index] = {
|
|
116
|
+
pre: 0,
|
|
117
|
+
size: this.getCellSize((_axis$sizes$index2 = axis.sizes[index]) === null || _axis$sizes$index2 === void 0 ? void 0 : _axis$sizes$index2.size)
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
this.populateAxisPartitions(axis);
|
|
121
|
+
}
|
|
122
|
+
populateAxisPartitions(axis) {
|
|
123
|
+
axis.totalSize = 0;
|
|
124
|
+
axis.partitions = [];
|
|
125
|
+
let nextPartitionPx = 0;
|
|
126
|
+
const isColumn = axis.orientation === 'column';
|
|
127
|
+
const map = isColumn ? this.engine.columnMap : this.engine.rowMap;
|
|
128
|
+
map.forEach((index, mapIndex) => {
|
|
129
|
+
if (axis.totalSize >= nextPartitionPx) {
|
|
130
|
+
axis.partitions.push(mapIndex);
|
|
131
|
+
nextPartitionPx += CLIPPED_AXIS_PARTITION_SIZE_PX;
|
|
132
|
+
}
|
|
133
|
+
axis.sizes[index].pre = axis.totalSize;
|
|
134
|
+
axis.totalSize += axis.sizes[index].size;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
resetRowPartitions() {
|
|
138
|
+
this.populateAxisPartitions(this.rows);
|
|
139
|
+
}
|
|
140
|
+
finalize() {
|
|
141
|
+
if (this.engine.visualization.showDimensionLabels) {
|
|
142
|
+
var _this$engine$dimensio, _this$engine$dimensio2, _this$engine$dimensio3, _this$engine$dimensio4, _this$engine$dimensio5, _this$engine$dimensio6;
|
|
143
|
+
const columnDimensionCount = (_this$engine$dimensio = (_this$engine$dimensio2 = this.engine.dimensionLookup) === null || _this$engine$dimensio2 === void 0 ? void 0 : _this$engine$dimensio2.columnHeaders.length) !== null && _this$engine$dimensio !== void 0 ? _this$engine$dimensio : 0;
|
|
144
|
+
const rowDimensionCount = (_this$engine$dimensio3 = (_this$engine$dimensio4 = this.engine.dimensionLookup) === null || _this$engine$dimensio4 === void 0 ? void 0 : _this$engine$dimensio4.rowHeaders.length) !== null && _this$engine$dimensio3 !== void 0 ? _this$engine$dimensio3 : 0;
|
|
145
|
+
(_this$engine$dimensio5 = this.engine.dimensionLookup) === null || _this$engine$dimensio5 === void 0 ? void 0 : (_this$engine$dimensio6 = _this$engine$dimensio5.columnHeaders) === null || _this$engine$dimensio6 === void 0 ? void 0 : _this$engine$dimensio6.forEach((_, columnLevel) => {
|
|
146
|
+
var _this$engine$dimensio7, _this$engine$dimensio8;
|
|
147
|
+
(_this$engine$dimensio7 = this.engine.dimensionLookup) === null || _this$engine$dimensio7 === void 0 ? void 0 : (_this$engine$dimensio8 = _this$engine$dimensio7.rowHeaders) === null || _this$engine$dimensio8 === void 0 ? void 0 : _this$engine$dimensio8.forEach((_, rowLevel) => {
|
|
148
|
+
const label = this.engine.getDimensionLabel(rowLevel, columnLevel);
|
|
149
|
+
if (label) {
|
|
150
|
+
this.add({
|
|
151
|
+
row: -rowDimensionCount + rowLevel,
|
|
152
|
+
column: -columnDimensionCount + columnLevel
|
|
153
|
+
}, label);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
this.finalizeAxis(this.columns);
|
|
159
|
+
this.finalizeAxis(this.rows);
|
|
160
|
+
this.columns.headerSize = 0;
|
|
161
|
+
this.columns.headerSizes = this.columns.headerSizes.map(size => {
|
|
162
|
+
const paddedSize = this.getCellSize(size);
|
|
163
|
+
this.columns.headerSize += paddedSize;
|
|
164
|
+
return paddedSize;
|
|
165
|
+
});
|
|
166
|
+
this.rows.headerSize = 0;
|
|
167
|
+
this.rows.headerSizes = this.rows.headerSizes.map(size => {
|
|
168
|
+
const paddedSize = this.getCellSize(size);
|
|
169
|
+
this.rows.headerSize += paddedSize;
|
|
170
|
+
return paddedSize;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
reset() {
|
|
174
|
+
this.columns = {
|
|
175
|
+
orientation: 'column',
|
|
176
|
+
totalSize: 0,
|
|
177
|
+
headerSize: 0,
|
|
178
|
+
sizes: [],
|
|
179
|
+
partitions: [],
|
|
180
|
+
headerSizes: []
|
|
181
|
+
};
|
|
182
|
+
this.rows = {
|
|
183
|
+
orientation: 'row',
|
|
184
|
+
totalSize: 0,
|
|
185
|
+
headerSize: 0,
|
|
186
|
+
sizes: [],
|
|
187
|
+
partitions: [],
|
|
188
|
+
headerSizes: []
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|