@hisptz/dhis2-analytics 1.0.31 → 1.0.33
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.test.js +5 -5
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +0 -2
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +12 -3
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +0 -1
- package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +2 -2
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +0 -2
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +9 -10
- package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +0 -1
- package/package.json +5 -6
- package/LICENSE +0 -29
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var _react = require("@cypress/react");
|
|
4
4
|
var _highcharts = _interopRequireDefault(require("highcharts"));
|
|
5
5
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _DownloadMenu =
|
|
6
|
+
var _DownloadMenu = require("./components/DownloadMenu");
|
|
7
7
|
var _columnData = _interopRequireDefault(require("./data/column-data.json"));
|
|
8
8
|
var _export = require("./services/export");
|
|
9
|
-
var _ =
|
|
9
|
+
var _ = require(".");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -25,7 +25,7 @@ const props = {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
function TestComponent() {
|
|
28
|
-
return /*#__PURE__*/_react2.default.createElement(_.
|
|
28
|
+
return /*#__PURE__*/_react2.default.createElement(_.ChartAnalytics, props);
|
|
29
29
|
}
|
|
30
30
|
function ExportTestComponent() {
|
|
31
31
|
const [chartRef, setChartRef] = (0, _react2.useState)(null);
|
|
@@ -34,9 +34,9 @@ function ExportTestComponent() {
|
|
|
34
34
|
display: "flex",
|
|
35
35
|
flexDirection: "column"
|
|
36
36
|
}
|
|
37
|
-
}, /*#__PURE__*/_react2.default.createElement("div", null, /*#__PURE__*/_react2.default.createElement(_DownloadMenu.
|
|
37
|
+
}, /*#__PURE__*/_react2.default.createElement("div", null, /*#__PURE__*/_react2.default.createElement(_DownloadMenu.ChartDownloadMenu, {
|
|
38
38
|
chartRef: chartRef
|
|
39
|
-
})), /*#__PURE__*/_react2.default.createElement(_.
|
|
39
|
+
})), /*#__PURE__*/_react2.default.createElement(_.ChartAnalytics, _extends({}, props, {
|
|
40
40
|
ref: setChartRef
|
|
41
41
|
})));
|
|
42
42
|
}
|
|
@@ -37,13 +37,11 @@ function getLegendsFromParams(params) {
|
|
|
37
37
|
min,
|
|
38
38
|
max
|
|
39
39
|
} = params;
|
|
40
|
-
console.log(params);
|
|
41
40
|
const sanitizedPalette = Array.isArray(palette) ? palette : palette.split(",");
|
|
42
41
|
const classes = sanitizedPalette.length;
|
|
43
42
|
const difference = max - min;
|
|
44
43
|
const interval = Math.round(difference / classes);
|
|
45
44
|
const legends = [];
|
|
46
|
-
console.log(10 / 9);
|
|
47
45
|
for (let i = 0; i < classes; i++) {
|
|
48
46
|
const min = i * interval;
|
|
49
47
|
const max = min + interval;
|
package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js
CHANGED
|
@@ -6,13 +6,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.EarthEngine = void 0;
|
|
7
7
|
var _utils = require("../utils");
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
|
-
var _api = _interopRequireDefault(require("./api"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
9
|
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; }
|
|
12
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
11
|
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); }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
async function importEEModule() {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
if (import.meta.env.STORYBOOK_BUILD === "true") {
|
|
17
|
+
return await Promise.resolve().then(() => _interopRequireWildcard(require("@google/earthengine")));
|
|
18
|
+
}
|
|
19
|
+
return await Promise.resolve().then(() => _interopRequireWildcard(require("./api")));
|
|
20
|
+
}
|
|
21
|
+
const EE = await importEEModule();
|
|
22
|
+
// import EE from "./api"
|
|
14
23
|
// @ts-ignore
|
|
15
|
-
const ee =
|
|
24
|
+
const ee = EE;
|
|
16
25
|
// @ts-ignore
|
|
17
26
|
window.ee = ee;
|
|
18
27
|
const FEATURE_STYLE = {
|
|
@@ -149,7 +149,6 @@ function Legend(_ref3) {
|
|
|
149
149
|
};
|
|
150
150
|
const name = (_head3 = (0, _lodash.head)(_react.default.Children.toArray(children))) === null || _head3 === void 0 ? void 0 : _head3.props.name;
|
|
151
151
|
const shouldCollapse = collapsed && !inPrintMode;
|
|
152
|
-
console.log(inPrintMode);
|
|
153
152
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
154
153
|
className: "w-100"
|
|
155
154
|
}, shouldCollapse ? /*#__PURE__*/_react.default.createElement(CollapsedLegendIcon, {
|
|
@@ -2,10 +2,10 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { mount } from "@cypress/react";
|
|
3
3
|
import HighCharts from "highcharts";
|
|
4
4
|
import React, { useState } from "react";
|
|
5
|
-
import ChartDownloadMenu from "./components/DownloadMenu";
|
|
5
|
+
import { ChartDownloadMenu } from "./components/DownloadMenu";
|
|
6
6
|
import columnData from "./data/column-data.json";
|
|
7
7
|
import { setupHighchartsModules } from "./services/export";
|
|
8
|
-
import ChartAnalytics from ".";
|
|
8
|
+
import { ChartAnalytics } from ".";
|
|
9
9
|
const props = {
|
|
10
10
|
analytics: columnData,
|
|
11
11
|
config: {
|
|
@@ -27,13 +27,11 @@ function getLegendsFromParams(params) {
|
|
|
27
27
|
min,
|
|
28
28
|
max
|
|
29
29
|
} = params;
|
|
30
|
-
console.log(params);
|
|
31
30
|
const sanitizedPalette = Array.isArray(palette) ? palette : palette.split(",");
|
|
32
31
|
const classes = sanitizedPalette.length;
|
|
33
32
|
const difference = max - min;
|
|
34
33
|
const interval = Math.round(difference / classes);
|
|
35
34
|
const legends = [];
|
|
36
|
-
console.log(10 / 9);
|
|
37
35
|
for (let i = 0; i < classes; i++) {
|
|
38
36
|
const min = i * interval;
|
|
39
37
|
const max = min + interval;
|
package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js
CHANGED
|
@@ -3,16 +3,15 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
3
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
4
|
import { combineReducers, getFeatureCollectionProperties, getHistogramStatistics, getInfo, getScale, hasClasses } from "../utils";
|
|
5
5
|
import { find, head, isEmpty } from "lodash";
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
import EE from "./api";
|
|
6
|
+
async function importEEModule() {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
if (import.meta.env.STORYBOOK_BUILD === "true") {
|
|
9
|
+
return await import("@google/earthengine");
|
|
10
|
+
}
|
|
11
|
+
return await import("./api");
|
|
12
|
+
}
|
|
13
|
+
const EE = await importEEModule();
|
|
14
|
+
// import EE from "./api"
|
|
16
15
|
// @ts-ignore
|
|
17
16
|
const ee = EE;
|
|
18
17
|
// @ts-ignore
|
|
@@ -140,7 +140,6 @@ function Legend(_ref3) {
|
|
|
140
140
|
};
|
|
141
141
|
const name = (_head3 = head(React.Children.toArray(children))) === null || _head3 === void 0 ? void 0 : _head3.props.name;
|
|
142
142
|
const shouldCollapse = collapsed && !inPrintMode;
|
|
143
|
-
console.log(inPrintMode);
|
|
144
143
|
return /*#__PURE__*/React.createElement("div", {
|
|
145
144
|
className: "w-100"
|
|
146
145
|
}, shouldCollapse ? /*#__PURE__*/React.createElement(CollapsedLegendIcon, {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hisptz/dhis2-analytics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "A collection of reusable react components for visualizing analytics data from DHIS2",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "d2-app-scripts build --no-verify",
|
|
7
|
+
"build": "d2-app-scripts build --no-verify --mode production",
|
|
8
8
|
"build:types": "tsc --project tsconfig.build.json",
|
|
9
9
|
"postbuild": "yarn build:types",
|
|
10
10
|
"start": "d2-app-scripts start",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@dhis2/analytics": "^24.4.2",
|
|
33
33
|
"@dhis2/app-runtime": "^3.7.0",
|
|
34
|
-
"@hisptz/dhis2-ui": "^1.0.
|
|
35
|
-
"@hisptz/dhis2-utils": "^1.0.
|
|
34
|
+
"@hisptz/dhis2-ui": "^1.0.33",
|
|
35
|
+
"@hisptz/dhis2-utils": "^1.0.32",
|
|
36
36
|
"async-es": "^3.2.4",
|
|
37
37
|
"d3-color": "^3.1.0",
|
|
38
38
|
"d3-scale": "^4.0.2",
|
|
@@ -76,6 +76,5 @@
|
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"lodash": "^4"
|
|
79
|
-
}
|
|
80
|
-
"gitHead": "e078e65fb6babe6b5180621087bb80c64e2f0aac"
|
|
79
|
+
}
|
|
81
80
|
}
|
package/LICENSE
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022, HISP Tanzania
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|