Skip to content

Commit

Permalink
feat: implements latest Period Selector from Analytics (DHIS2-8807) (#…
Browse files Browse the repository at this point in the history
…872)

Bumps the Analytics version 
Bumps the @dhis2/data-visualizer-plugin version
Removes onDeselect and onReorder from the props passed to PeriodDimension
Refactors the FilterDialog to use ui-core instead of material-ui.
  • Loading branch information
martinkrulltott authored Jun 3, 2020
1 parent ff8cdf5 commit 886ccce
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 168 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"license": "BSD-3-Clause",
"dependencies": {
"@dhis2/analytics": "^4.3.25",
"@dhis2/analytics": "^6.0.3",
"@dhis2/app-runtime": "^2.2.1",
"@dhis2/d2-i18n": "^1.0.6",
"@dhis2/d2-ui-core": "^7.0.3",
Expand All @@ -14,7 +14,7 @@
"@dhis2/d2-ui-rich-text": "^7.0.3",
"@dhis2/d2-ui-sharing-dialog": "^7.0.3",
"@dhis2/d2-ui-translation-dialog": "^7.0.3",
"@dhis2/data-visualizer-plugin": "^34.4.1",
"@dhis2/data-visualizer-plugin": "^35.0.1",
"@dhis2/ui-core": "^4.21.1",
"@dhis2/ui-widgets": "^2.1.1",
"@material-ui/core": "^3.9.2",
Expand Down
62 changes: 35 additions & 27 deletions src/components/ItemFilter/FilterDialog.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { Button } from '@dhis2/ui-core';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import {
Button,
Modal,
ModalTitle,
ModalContent,
ModalActions,
ButtonStrip,
} from '@dhis2/ui-core';

import i18n from '@dhis2/d2-i18n';

Expand All @@ -15,13 +20,10 @@ import {
DIMENSION_ID_ORGUNIT,
} from '@dhis2/analytics';

const peId = DIMENSION_ID_PERIOD;
const ouId = DIMENSION_ID_ORGUNIT;

class FilterDialog extends Component {
onConfirm = id => () => this.props.onConfirm(id);

dialogContent() {
renderDialogContent() {
const { displayNameProperty, dimension, selectedItems } = this.props;
const dialogId = dimension.id;

Expand All @@ -33,15 +35,15 @@ class FilterDialog extends Component {
};

switch (dialogId) {
case peId: {
case DIMENSION_ID_PERIOD: {
return (
<PeriodDimension
selectedPeriods={selectedItems}
{...commonProps}
onSelect={commonProps.onSelect}
/>
);
}
case ouId:
case DIMENSION_ID_ORGUNIT:
return (
<OrgUnitDimension
displayNameProperty={displayNameProperty}
Expand All @@ -54,7 +56,6 @@ class FilterDialog extends Component {
<DynamicDimension
selectedItems={selectedItems}
dialogId={dialogId}
dialogTitle={dimension.name}
{...commonProps}
/>
);
Expand All @@ -66,22 +67,29 @@ class FilterDialog extends Component {
const dialogId = dimension.id;

return (
<Dialog
open={!!dialogId}
maxWidth="lg"
disableEnforceFocus
onClose={onClose}
>
{dialogId && this.dialogContent()}
<DialogActions>
<Button kind="secondary" onClick={onClose}>
{i18n.t('Cancel')}
</Button>
<Button kind="primary" onClick={this.onConfirm(dialogId)}>
{i18n.t('Confirm')}
</Button>
</DialogActions>
</Dialog>
<>
{dialogId && (
<Modal onClose={onClose} position="top" large>
<ModalTitle>{dimension.name}</ModalTitle>
<ModalContent>
{this.renderDialogContent()}
</ModalContent>
<ModalActions>
<ButtonStrip>
<Button secondary onClick={onClose}>
{i18n.t('Cancel')}
</Button>
<Button
primary
onClick={this.onConfirm(dialogId)}
>
{i18n.t('Confirm')}
</Button>
</ButtonStrip>
</ModalActions>
</Modal>
)}
</>
);
}
}
Expand Down
158 changes: 19 additions & 139 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1008,34 +1008,12 @@
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==

"@dhis2/analytics@^4.0.1", "@dhis2/analytics@^4.3.25":
version "4.3.29"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-4.3.29.tgz#4bcfe025c4ffccb1f2ff59c7097318781231ef3a"
integrity sha512-MgMIEioNL90P9BVix0u27SAL/0qe+GxE0Zk3vSyBYue3iQs3UrqPonbP0LPGKwoIjmxdL9/CSkeD8SWgS8BeWA==
dependencies:
"@dhis2/d2-i18n" "^1.0.4"
"@dhis2/d2-ui-org-unit-dialog" "^6.5.9"
"@dhis2/d2-ui-period-selector-dialog" "^6.5.7"
"@dhis2/ui-core" "^4.9.1"
"@material-ui/core" "^3.9.3"
"@material-ui/icons" "^3.0.2"
classnames "^2.2.6"
d2-utilizr "^0.2.16"
d3-color "^1.2.3"
highcharts "^7.2.1"
lodash "^4.17.13"
react-beautiful-dnd "^10.1.1"
resize-observer-polyfill "^1.5.1"
styled-jsx "^3.2.1"

"@dhis2/analytics@^5.1.3":
version "5.1.6"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-5.1.6.tgz#4ea54a8ac7f0f942c6e77b1343c400277952aeff"
integrity sha512-ivf3yYQ3w64IBMvXuxTjMU4/lbGWDXPyskVnkQp2XVn724S2feM1rZhyKwU4B5U+4MYR8xMMgTzU5tJ8mno4tQ==
"@dhis2/analytics@^6.0.2", "@dhis2/analytics@^6.0.3":
version "6.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-6.0.3.tgz#5875621a5ae92565f23603b156f86253c582740a"
integrity sha512-ctLGJpHLI5cCn+9ryA5m1B7euH7Hgofl4rFKTLjyKUCIAprojgDKf/9BuDby33ym5qN03ljj84wy/EtgcsXP2w==
dependencies:
"@dhis2/d2-i18n" "^1.0.4"
"@dhis2/d2-ui-org-unit-dialog" "^7.0.3"
"@dhis2/d2-ui-period-selector-dialog" "^7.0.3"
"@dhis2/ui-core" "^4.21.1"
"@material-ui/core" "^3.9.3"
"@material-ui/icons" "^3.0.2"
Expand Down Expand Up @@ -1119,25 +1097,14 @@
moment "^2.22.1"
rimraf "^2.6.2"

"@dhis2/d2-i18n@^1.0.3", "@dhis2/d2-i18n@^1.0.4", "@dhis2/d2-i18n@^1.0.6":
"@dhis2/d2-i18n@^1.0.6":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@dhis2/d2-i18n/-/d2-i18n-1.0.6.tgz#2914be8acf296f3a6bf7b51c76c46da6a120b0ff"
integrity sha512-7YdA4ppFosjuyf7ZMm47BrdsA5TWLM9lmS0lUPgjcCVeeWfUgagqzf4W5JGB9XQ3w1vzK+yy5zH2Ij8IgRAGhA==
dependencies:
i18next "^10.3"
moment "^2.24.0"

"@dhis2/[email protected]":
version "6.5.10"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-core/-/d2-ui-core-6.5.10.tgz#cbe1f1a9edcfa1e7cc7c482b1f2197280e545bac"
integrity sha512-mAsO91UjW0zdSOntz0/YnbjmUlHSAhwJMqMoKZMhsKDsJeeeZly18NYLjqztQH6uBRgBFFaHcMROsPAlSI0XUQ==
dependencies:
babel-runtime "^6.26.0"
d2 "~31.7"
lodash "^4.17.10"
material-ui "^0.20.0"
rxjs "^5.5.7"

"@dhis2/[email protected]", "@dhis2/d2-ui-core@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-core/-/d2-ui-core-7.0.3.tgz#75cf0bc7dfadfa6b000bcf61b17fb76f5efb7b1d"
Expand Down Expand Up @@ -1175,17 +1142,6 @@
lodash "^4.17.10"
prop-types "^15.6.2"

"@dhis2/d2-ui-org-unit-dialog@^6.5.9":
version "6.5.10"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-dialog/-/d2-ui-org-unit-dialog-6.5.10.tgz#88c079870cc50d45a25886cdd791f445b3959f26"
integrity sha512-5E7GK+XYGlvmaSVKZqo4E5AiqRnhEPySCBRBOHdnEwRuB97YnKmTFvX9H44VoKx71cYqs26NMlJCiBbQuioVpQ==
dependencies:
"@dhis2/d2-i18n" "^1.0.3"
"@dhis2/d2-ui-org-unit-tree" "6.5.10"
"@material-ui/core" "^3.3.1"
"@material-ui/icons" "^3.0.1"
prop-types "^15.5.10"

"@dhis2/d2-ui-org-unit-dialog@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-dialog/-/d2-ui-org-unit-dialog-7.0.3.tgz#2eec30a569d5fb07f256d4727fa8986c7d91c047"
Expand All @@ -1196,16 +1152,6 @@
"@material-ui/icons" "^3.0.1"
prop-types "^15.5.10"

"@dhis2/[email protected]":
version "6.5.10"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-tree/-/d2-ui-org-unit-tree-6.5.10.tgz#df25a6cd872b1aab915e470594dc5888a8e04647"
integrity sha512-pqdfMVL2YCuxxzACLVBkdz/6M+CHV8CYzx/u5cEpDF/CIPgU9EGThJfTFH59h7am8QPa5fSd1lMVE1MhpN51Ig==
dependencies:
"@dhis2/d2-ui-core" "6.5.10"
"@material-ui/core" "^3.3.1"
babel-runtime "^6.26.0"
prop-types "^15.5.10"

"@dhis2/[email protected]":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-tree/-/d2-ui-org-unit-tree-7.0.3.tgz#df16c7591a2c6b0dae22971604ffc653118b87ae"
Expand All @@ -1216,29 +1162,6 @@
babel-runtime "^6.26.0"
prop-types "^15.5.10"

"@dhis2/d2-ui-period-selector-dialog@^6.5.7":
version "6.5.7"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-period-selector-dialog/-/d2-ui-period-selector-dialog-6.5.7.tgz#081b5e5e2f0d9bcbc9d47ba706da16adebeafaf9"
integrity sha512-1pISB3brD1Tx+/k51/TK0kF+ZKeDOviSsM99EEUJ+RfviSx3kSxpYPv/VV0WYV69XUmDGkBJ8LPy0w6mUGVL/A==
dependencies:
"@dhis2/analytics" "^4.0.1"
"@dhis2/d2-i18n" "^1.0.4"
"@material-ui/core" "^3.3.1"
"@material-ui/icons" "^3.0.1"
babel-runtime "^6.26.0"
prop-types "^15.6.0"

"@dhis2/d2-ui-period-selector-dialog@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-period-selector-dialog/-/d2-ui-period-selector-dialog-7.0.3.tgz#95a6d9a470d04287484578d0db8dfa9083d87f36"
integrity sha512-uTqsKu6PsXb/MN8FxlGJeNZFrr1GkCbt/SQho0EvF1M62pvqI6dhYsrrusW3LWhiiVoTyNVZdF6NxUgGvMZMvQ==
dependencies:
"@dhis2/analytics" "^4.0.1"
"@material-ui/core" "^3.3.1"
"@material-ui/icons" "^3.0.1"
babel-runtime "^6.26.0"
prop-types "^15.6.0"

"@dhis2/[email protected]", "@dhis2/d2-ui-rich-text@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-rich-text/-/d2-ui-rich-text-7.0.3.tgz#26c3e4ecf5dddfb3445476c56c87a62448ce229d"
Expand All @@ -1248,15 +1171,6 @@
markdown-it "^8.4.2"
prop-types "^15.6.2"

"@dhis2/d2-ui-rich-text@^5.1.0":
version "5.3.11"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-rich-text/-/d2-ui-rich-text-5.3.11.tgz#47fca559b2d364bc318429dc14c479c8aa4f7839"
integrity sha512-17VK0akErL765dOxwQPCq5ORGLRJkxY9g58bZSLpz7FVGw5FvJX/OMrAKXqh3K+AkrWlVd7xoo5rykPFNafYhQ==
dependencies:
babel-runtime "^6.26.0"
markdown-it "^8.4.2"
prop-types "^15.6.2"

"@dhis2/[email protected]", "@dhis2/d2-ui-sharing-dialog@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-sharing-dialog/-/d2-ui-sharing-dialog-7.0.3.tgz#585b6e20ce991517b83a4a30e770f7f74b29de8e"
Expand Down Expand Up @@ -1285,14 +1199,13 @@
react-select "^2.0.0"
rxjs "^5.5.7"

"@dhis2/data-visualizer-plugin@^34.4.1":
version "34.4.1"
resolved "https://registry.yarnpkg.com/@dhis2/data-visualizer-plugin/-/data-visualizer-plugin-34.4.1.tgz#3b4a423a36e57dffda355109f8acf04d7819fb59"
integrity sha512-K/EGvjEsvJz/2x04ncu1K3EILyWNE1nCdMZLDprCV53A7MDvp19qJT7KiTTfa6YbLmVy62t0XX7vA2MTK/n+AQ==
"@dhis2/data-visualizer-plugin@^35.0.1":
version "35.0.1"
resolved "https://registry.yarnpkg.com/@dhis2/data-visualizer-plugin/-/data-visualizer-plugin-35.0.1.tgz#417bb435b43329beaaccbaa5dd29da4b4f9bdf97"
integrity sha512-PkBJTmQ3gbwsAKjOCX1nWGka5dYQXP6hBfQIZLemqFCFQJ1Mqswe0ZmYJqnKx81b382zATlua//gbzXrLGJYQQ==
dependencies:
"@dhis2/analytics" "^5.1.3"
"@dhis2/analytics" "^6.0.2"
"@dhis2/ui-core" "^4.21.1"
d2-analysis "33.2.15"
lodash-es "^4.17.11"

"@dhis2/prop-types@^1.6", "@dhis2/prop-types@^1.6.4":
Expand All @@ -1302,7 +1215,7 @@
dependencies:
prop-types "^15"

"@dhis2/ui-core@^4.21.1", "@dhis2/ui-core@^4.9.1":
"@dhis2/ui-core@^4.21.1":
version "4.21.1"
resolved "https://registry.yarnpkg.com/@dhis2/ui-core/-/ui-core-4.21.1.tgz#2b5518f6bd5de75404df3eefa83452e0c40852aa"
integrity sha512-dpK4UwktLw9qcRkDe5wU76j35ntoulqKpcaBoxXZ1+/rzR2FeaJ+w4l+I+bg45jcK9WjLLsFClc1zi+O/MG1MA==
Expand Down Expand Up @@ -2659,7 +2572,7 @@ babel-traverse@^6.0.0, babel-traverse@^6.18.0, babel-traverse@^6.26.0:
invariant "^2.2.2"
lodash "^4.17.4"

babel-types@6.26.0, babel-types@^6.0.0, babel-types@^6.18.0, babel-types@^6.26.0:
babel-types@^6.0.0, babel-types@^6.18.0, babel-types@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497"
integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=
Expand Down Expand Up @@ -3647,20 +3560,20 @@ conventional-commits-parser@^3.0.0:
through2 "^3.0.0"
trim-off-newlines "^1.0.0"

[email protected], convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20"
integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==
dependencies:
safe-buffer "~5.1.1"

[email protected]:
version "1.7.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442"
integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==
dependencies:
safe-buffer "~5.1.1"

convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20"
integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==
dependencies:
safe-buffer "~5.1.1"

[email protected]:
version "1.0.6"
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
Expand Down Expand Up @@ -4093,15 +4006,6 @@ cyclist@~0.2.2:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"
integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=

[email protected]:
version "33.2.15"
resolved "https://registry.yarnpkg.com/d2-analysis/-/d2-analysis-33.2.15.tgz#6320e1b7d4a245a09785803992d01cffc14c5c67"
integrity sha512-oMMzwC58UEcFiLR+q/c1r5pdaiFE11AnIswkOhnqAtYIMUOMiMkjrjt413Z6c0cpUNJz8myvRgHk6GUfd7RsEA==
dependencies:
"@dhis2/d2-ui-rich-text" "^5.1.0"
d2-utilizr "^0.2.16"
jquery "2.1.4"

d2-manifest@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/d2-manifest/-/d2-manifest-1.0.0.tgz#19d4a4c4e8151442ab730e932c9c2170be9ebcc9"
Expand Down Expand Up @@ -6256,11 +6160,6 @@ hex-color-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==

highcharts@^7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/highcharts/-/highcharts-7.2.1.tgz#313c434bbfd4525a72b76c6bfbd9c39dfe2d1993"
integrity sha512-/fSUZiONmM+x49IQJNf8XwZGiNGOPRmxEOcd0xdJP9Xc3OlG46ZiUWgSLfhYQ9Oyhmzc3V3SKYCLud8+rKLi+w==

highcharts@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/highcharts/-/highcharts-8.1.0.tgz#f93adaf8d53b0f83c74c9854f0ad10baec010d97"
Expand Down Expand Up @@ -7735,11 +7634,6 @@ joi@^11.1.1:
isemail "3.x.x"
topo "2.x.x"

[email protected]:
version "2.1.4"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.1.4.tgz#228bde698a0c61431dc2630a6a154f15890d2317"
integrity sha1-IoveaYoMYUMdwmMKahVPFYkNIxc=

js-levenshtein@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"
Expand Down Expand Up @@ -12385,20 +12279,6 @@ [email protected]:
loader-utils "^1.1.0"
schema-utils "^1.0.0"

styled-jsx@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-3.2.1.tgz#452051fe50df5e9c7c7f3dd20fa46c3060ac65b0"
integrity sha512-gM/WOrWYRpWReivzQqetEGohUc/TJSvUoZ5T/UJxJZIsVIPlRQLnp7R8Oue4q49sI08EBRQjQl2oBL3sfdrw2g==
dependencies:
babel-plugin-syntax-jsx "6.18.0"
babel-types "6.26.0"
convert-source-map "1.6.0"
loader-utils "1.2.3"
source-map "0.7.3"
string-hash "1.1.3"
stylis "3.5.4"
stylis-rule-sheet "0.0.10"

styled-jsx@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-3.3.0.tgz#32335c1a3ecfc923ba4f9c056eeb3d4699006b09"
Expand Down

0 comments on commit 886ccce

Please sign in to comment.