@dhis2-ui/header-bar 9.11.0 → 9.11.1-beta.1
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/__e2e__/{header-bar.stories.e2e.js → header-bar.e2e.stories.js} +2 -20
- package/build/cjs/__e2e__/stories/common.js +12 -33
- package/build/cjs/__e2e__/stories/custom-application-title.js +3 -8
- package/build/cjs/__e2e__/stories/default.js +1 -7
- package/build/cjs/__e2e__/stories/me-with-avatar.js +3 -8
- package/build/cjs/__e2e__/stories/modulesWithSpecialCharacters.js +2 -3
- package/build/cjs/__e2e__/stories/online-status-message.js +4 -14
- package/build/cjs/__e2e__/stories/pwa-enabled.js +3 -8
- package/build/cjs/__e2e__/stories/user-has-all-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-no-authorities.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-interpretation-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-messaging-authority.js +5 -9
- package/build/cjs/__e2e__/stories/with-debug-info-edge-cases.js +11 -18
- package/build/cjs/__e2e__/stories/with-special-app-name-character.js +5 -9
- package/build/cjs/__e2e__/stories/with-update-available-notification.js +6 -13
- package/build/cjs/__e2e__/stories/zero-unread-interpretations.js +3 -8
- package/build/cjs/__e2e__/stories/zero-unread-messages.js +3 -8
- package/build/cjs/apps.js +9 -34
- package/build/cjs/debug-info/debug-info-menu-item.js +4 -17
- package/build/cjs/debug-info/debug-info-modal.js +2 -15
- package/build/cjs/debug-info/debug-info-table.js +2 -9
- package/build/cjs/debug-info/use-debug-info.js +0 -5
- package/build/cjs/features/common/index.js +3 -7
- package/build/cjs/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +9 -5
- package/build/cjs/features/the_headerbar_conditionally_renders_notification_icons/the_headerbar_conditionally_renders_notification_icons.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/common.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_app_menu_closes_when_the_user_clicks_outside.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_headerbar_contains_a_menu_icon.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_user_will_be_offered_a_menu_with_5_apps.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/common.js +4 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +2 -3
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_an_image_icon_if_the_user_has_an_avatar.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +4 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_profile_menu_closes_when_the_user_clicks_outside.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_edit_his_profile.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_his_account.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_about_dhis2_page.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_help_page.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_settings.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +16 -14
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/the_headerbar_displays_a_link_to_the_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_no_unread_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_some_unread_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/the_headerbar_displays_a_link_to_the_messages.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_no_unread_messages.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_some_unread_messages.js +0 -1
- package/build/cjs/features/the_headerbar_should_contain_a_logo_that_links_to_the_homepage/headerbar_contains_logo.js +0 -2
- package/build/cjs/features/the_headerbar_should_display_app_update_notification/index.js +0 -1
- package/build/cjs/features/the_headerbar_should_display_debug_version_infos/index.js +0 -1
- package/build/cjs/features/the_headerbar_should_display_the_title_provided_by_the_backend_and_the_app/the_headerbar_displays_the_custom_title.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/common.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +2 -4
- package/build/cjs/header-bar-context.js +3 -13
- package/build/cjs/header-bar.js +8 -31
- package/build/cjs/{header-bar.stories.js → header-bar.prod.stories.js} +33 -40
- package/build/cjs/index.js +0 -1
- package/build/cjs/join-path.js +0 -3
- package/build/cjs/locales/index.js +3 -77
- package/build/cjs/logo-image.js +2 -15
- package/build/cjs/logo.js +1 -8
- package/build/cjs/notification-icon.js +3 -13
- package/build/cjs/notifications.js +1 -12
- package/build/cjs/online-status.js +6 -16
- package/build/cjs/online-status.styles.js +2 -5
- package/build/cjs/profile/use-on-doc-click.js +0 -4
- package/build/cjs/profile/use-on-doc-click.test.js +0 -2
- package/build/cjs/profile-menu/index.js +0 -2
- package/build/cjs/profile-menu/profile-header.js +2 -20
- package/build/cjs/profile-menu/profile-menu.js +10 -33
- package/build/cjs/profile-menu/update-notification.js +3 -17
- package/build/cjs/profile.js +5 -19
- package/build/cjs/title.js +2 -8
- package/build/es/__e2e__/stories/common.js +3 -8
- package/build/es/__e2e__/stories/custom-application-title.js +2 -1
- package/build/es/__e2e__/stories/me-with-avatar.js +2 -1
- package/build/es/__e2e__/stories/online-status-message.js +3 -4
- package/build/es/__e2e__/stories/pwa-enabled.js +2 -1
- package/build/es/__e2e__/stories/user-has-all-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-no-authorities.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-interpretation-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-messaging-authority.js +4 -2
- package/build/es/__e2e__/stories/with-debug-info-edge-cases.js +10 -5
- package/build/es/__e2e__/stories/with-special-app-name-character.js +4 -2
- package/build/es/__e2e__/stories/with-update-available-notification.js +4 -2
- package/build/es/__e2e__/stories/zero-unread-interpretations.js +2 -1
- package/build/es/__e2e__/stories/zero-unread-messages.js +2 -1
- package/build/es/apps.js +6 -16
- package/build/es/debug-info/debug-info-menu-item.js +3 -5
- package/build/es/debug-info/debug-info-modal.js +1 -3
- package/build/es/debug-info/debug-info-table.js +1 -3
- package/build/es/features/common/index.js +1 -1
- package/build/es/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +11 -5
- package/build/es/features/the_headerbar_contains_a_profile_menu/common.js +4 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +2 -2
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +4 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +15 -11
- package/build/es/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +2 -1
- package/build/es/header-bar.js +5 -6
- package/build/es/{header-bar.stories.js → header-bar.prod.stories.js} +32 -11
- package/build/es/join-path.js +0 -1
- package/build/es/logo-image.js +1 -7
- package/build/es/notification-icon.js +2 -4
- package/build/es/notifications.js +0 -2
- package/build/es/online-status.js +6 -6
- package/build/es/online-status.styles.js +1 -1
- package/build/es/profile/use-on-doc-click.js +0 -1
- package/build/es/profile-menu/profile-header.js +1 -9
- package/build/es/profile-menu/profile-menu.js +7 -8
- package/build/es/profile-menu/update-notification.js +2 -4
- package/build/es/profile.js +1 -3
- package/build/es/title.js +1 -1
- package/package.json +18 -18
- /package/build/es/__e2e__/{header-bar.stories.e2e.js → header-bar.e2e.stories.js} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Then)('the messages link contains an icon with a number greater than 0', () => {
|
|
6
5
|
cy.get('[data-test="headerbar-messages-count"]').should($count => {
|
|
7
6
|
expect(parseInt($count.text(), 10)).to.be.greaterThan(0);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
var _index = require("../common/index.js");
|
|
6
|
-
|
|
7
5
|
(0, _cypressCucumberPreprocessor.Then)('the HeaderBar should display the dhis2 logo', () => {
|
|
8
6
|
cy.get('[data-test="headerbar-logo"]').should('be.visible');
|
|
9
7
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('the HeaderBar is rendered without an instance version in runtime context', () => {
|
|
6
5
|
cy.visitStory('HeaderBarTesting', 'With Unknown Instance Version');
|
|
7
6
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('the custom title is "Barbaz" and the app title is "Example!"', () => {
|
|
6
5
|
cy.visitStory('HeaderBarTesting', 'Custom Application Title');
|
|
7
6
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)(/the search contains a (.*)/, character => {
|
|
6
5
|
cy.get('[data-test="headerbar-apps-icon"]').click();
|
|
7
6
|
cy.get('#filter').type(character);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)(/no app name contains a (.*)/, character => {
|
|
6
5
|
// Needs to be wrapped, otherwise for some reason the wrong char is in the scope
|
|
7
6
|
cy.all(() => cy.window(), () => cy.wrap(character)).then(_ref => {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
var _modulesWithSpecialCharacters = require("../../__e2e__/stories/modulesWithSpecialCharacters.js");
|
|
6
|
-
|
|
7
5
|
(0, _cypressCucumberPreprocessor.Given)(/some app names contain a (.*)/, character => {
|
|
8
6
|
// Needs to be wrapped, otherwise for some reason the wrong char is in the scope
|
|
9
7
|
cy.wrap(character).then(char => {
|
|
10
|
-
cy.visitStory('HeaderBarTesting', 'With Special App Name Characters');
|
|
8
|
+
cy.visitStory('HeaderBarTesting', 'With Special App Name Characters');
|
|
11
9
|
|
|
10
|
+
// verify that there's a module with the special char in its name
|
|
12
11
|
const modulesWithSpecialChar = _modulesWithSpecialCharacters.modulesWithSpecialCharacters.filter(module => {
|
|
13
12
|
return module.displayName.indexOf(char) !== -1;
|
|
14
13
|
});
|
|
15
|
-
|
|
16
14
|
expect(modulesWithSpecialChar).to.have.length.of.at.least(1);
|
|
17
15
|
});
|
|
18
16
|
});
|
|
@@ -4,22 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useHeaderBarContext = exports.HeaderBarContextProvider = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
12
|
const headerBarContext = /*#__PURE__*/(0, _react.createContext)({
|
|
19
13
|
updateAvailable: false,
|
|
20
14
|
onApplyAvailableUpdate: () => {}
|
|
21
15
|
});
|
|
22
|
-
|
|
23
16
|
const HeaderBarContextProvider = _ref => {
|
|
24
17
|
let {
|
|
25
18
|
updateAvailable,
|
|
@@ -33,14 +26,11 @@ const HeaderBarContextProvider = _ref => {
|
|
|
33
26
|
}
|
|
34
27
|
}, children);
|
|
35
28
|
};
|
|
36
|
-
|
|
37
29
|
exports.HeaderBarContextProvider = HeaderBarContextProvider;
|
|
38
30
|
HeaderBarContextProvider.propTypes = {
|
|
39
31
|
children: _propTypes.default.node,
|
|
40
32
|
updateAvailable: _propTypes.default.bool,
|
|
41
33
|
onApplyAvailableUpdate: _propTypes.default.func
|
|
42
34
|
};
|
|
43
|
-
|
|
44
35
|
const useHeaderBarContext = () => (0, _react.useContext)(headerBarContext);
|
|
45
|
-
|
|
46
36
|
exports.useHeaderBarContext = useHeaderBarContext;
|
package/build/cjs/header-bar.js
CHANGED
|
@@ -4,41 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.HeaderBar = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
8
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
11
|
-
|
|
12
9
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
12
|
var _apps = _interopRequireDefault(require("./apps.js"));
|
|
19
|
-
|
|
20
13
|
var _headerBarContext = require("./header-bar-context.js");
|
|
21
|
-
|
|
22
14
|
var _joinPath = require("./join-path.js");
|
|
23
|
-
|
|
24
15
|
var _index = _interopRequireDefault(require("./locales/index.js"));
|
|
25
|
-
|
|
26
16
|
var _logo = require("./logo.js");
|
|
27
|
-
|
|
28
17
|
var _notifications = require("./notifications.js");
|
|
29
|
-
|
|
30
18
|
var _onlineStatus = require("./online-status.js");
|
|
31
|
-
|
|
32
19
|
var _profile = _interopRequireDefault(require("./profile.js"));
|
|
33
|
-
|
|
34
20
|
var _title = require("./title.js");
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
-
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
24
|
const query = {
|
|
43
25
|
title: {
|
|
44
26
|
resource: 'systemSettings/applicationTitle'
|
|
@@ -59,10 +41,8 @@ const query = {
|
|
|
59
41
|
resource: 'me/dashboard'
|
|
60
42
|
}
|
|
61
43
|
};
|
|
62
|
-
|
|
63
44
|
const HeaderBar = _ref => {
|
|
64
45
|
var _data$user$avatar;
|
|
65
|
-
|
|
66
46
|
let {
|
|
67
47
|
appName,
|
|
68
48
|
className,
|
|
@@ -81,23 +61,21 @@ const HeaderBar = _ref => {
|
|
|
81
61
|
} = (0, _appRuntime.useDataQuery)(query);
|
|
82
62
|
const apps = (0, _react.useMemo)(() => {
|
|
83
63
|
const getPath = path => path.startsWith('http:') || path.startsWith('https:') ? path : (0, _joinPath.joinPath)(baseUrl, 'api', path);
|
|
84
|
-
|
|
85
|
-
|
|
64
|
+
return data === null || data === void 0 ? void 0 : data.apps.modules.map(app => ({
|
|
65
|
+
...app,
|
|
86
66
|
icon: getPath(app.icon),
|
|
87
67
|
defaultAction: getPath(app.defaultAction)
|
|
88
68
|
}));
|
|
89
|
-
}, [data, baseUrl]);
|
|
69
|
+
}, [data, baseUrl]);
|
|
90
70
|
|
|
71
|
+
// See https://jira.dhis2.org/browse/LIBS-180
|
|
91
72
|
if (!loading && !error) {
|
|
92
73
|
// TODO: This will run every render which is probably wrong!
|
|
93
74
|
// Also, setting the global locale shouldn't be done in the headerbar
|
|
94
75
|
const locale = data.user.settings.keyUiLocale || 'en';
|
|
95
|
-
|
|
96
76
|
_index.default.setDefaultNamespace('default');
|
|
97
|
-
|
|
98
77
|
_index.default.changeLanguage(locale);
|
|
99
78
|
}
|
|
100
|
-
|
|
101
79
|
return /*#__PURE__*/_react.default.createElement(_headerBarContext.HeaderBarContextProvider, {
|
|
102
80
|
updateAvailable: updateAvailable,
|
|
103
81
|
onApplyAvailableUpdate: onApplyAvailableUpdate
|
|
@@ -126,9 +104,8 @@ const HeaderBar = _ref => {
|
|
|
126
104
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
127
105
|
id: "4230161118",
|
|
128
106
|
dynamic: [_uiConstants.colors.white]
|
|
129
|
-
}, [
|
|
107
|
+
}, [`.main.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;background-color:#2c6693;color:${_uiConstants.colors.white};height:48px;}`, ".right-control-spacer.__jsx-style-dynamic-selector{margin-inline-start:auto;}"])));
|
|
130
108
|
};
|
|
131
|
-
|
|
132
109
|
exports.HeaderBar = HeaderBar;
|
|
133
110
|
HeaderBar.propTypes = {
|
|
134
111
|
appName: _propTypes.default.string,
|
|
@@ -4,21 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.WithUpdateNotification = exports.WithOnlineStatusMessage = exports.WithOnlineStatus = exports.RTLHeader = exports.NonEnglishUserLocale = exports.NoAuthorityForInterpretationsApp = exports.Loading = exports.Error = exports.Default = exports.CustomLogoWideDimension = void 0;
|
|
7
|
-
|
|
8
7
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _common = require("./__e2e__/stories/common.js");
|
|
13
|
-
|
|
14
10
|
var _onlineStatusMessage = require("./__e2e__/stories/online-status-message.js");
|
|
15
|
-
|
|
16
11
|
var _headerBar = require("./header-bar.js");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const subtitle = 'The common navigation bar used in all DHIS2 apps';
|
|
14
|
+
const description = `
|
|
15
|
+
The header bar is mandatory for all apps. This creates a stable, understandable point of reference for the user across all kinds of different apps. It must always be displayed fixed to the top of the screen. Do not interfere or obstruct interaction with the header bar.
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
The header bar is included automatically with the App Shell and should not need any configuration.
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
#### Theme
|
|
20
|
+
|
|
21
|
+
The header bar can be themeed to suit the brand/color of your DHIS2 instance. The color of the text/icons will be automatically adjusted based on the selected color.
|
|
22
|
+
|
|
23
|
+
\`\`\`js
|
|
24
|
+
import { HeaderBar } from '@dhis2/ui'
|
|
25
|
+
\`\`\`
|
|
26
|
+
`;
|
|
22
27
|
const customData = {
|
|
23
28
|
'systemSettings/applicationTitle': {
|
|
24
29
|
applicationTitle: 'Foobar'
|
|
@@ -112,34 +117,40 @@ const customData = {
|
|
|
112
117
|
unreadMessageConversations: 5
|
|
113
118
|
}
|
|
114
119
|
};
|
|
115
|
-
const customLogoData = {
|
|
120
|
+
const customLogoData = {
|
|
121
|
+
...customData,
|
|
116
122
|
'staticContent/logo_banner': {
|
|
117
123
|
images: {
|
|
118
124
|
png: 'https://via.placeholder.com/150x50'
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
|
-
const customLocaleData = {
|
|
128
|
+
const customLocaleData = {
|
|
129
|
+
...customData,
|
|
123
130
|
'systemSettings/applicationTitle': {
|
|
124
131
|
applicationTitle: 'Le Gros Foobar'
|
|
125
132
|
},
|
|
126
|
-
me: {
|
|
133
|
+
me: {
|
|
134
|
+
...customData.me,
|
|
127
135
|
settings: {
|
|
128
136
|
keyUiLocale: 'fr'
|
|
129
137
|
}
|
|
130
138
|
},
|
|
131
139
|
'action::menu/getModules': {
|
|
132
|
-
modules: customData['action::menu/getModules'].modules.map(mod => ({
|
|
133
|
-
|
|
140
|
+
modules: customData['action::menu/getModules'].modules.map(mod => ({
|
|
141
|
+
...mod,
|
|
142
|
+
displayName: `Le ${mod.displayName}`
|
|
134
143
|
}))
|
|
135
144
|
}
|
|
136
145
|
};
|
|
137
|
-
const customAuthoritiesData = {
|
|
138
|
-
|
|
146
|
+
const customAuthoritiesData = {
|
|
147
|
+
...customData,
|
|
148
|
+
me: {
|
|
149
|
+
...customData.me,
|
|
139
150
|
authorities: ['M_dhis-web-messaging']
|
|
140
151
|
}
|
|
141
152
|
};
|
|
142
|
-
var _default = {
|
|
153
|
+
var _default = exports.default = {
|
|
143
154
|
title: 'Header Bar',
|
|
144
155
|
component: _headerBar.HeaderBar,
|
|
145
156
|
parameters: {
|
|
@@ -152,43 +163,33 @@ var _default = {
|
|
|
152
163
|
},
|
|
153
164
|
decorators: [(0, _common.createDecoratorProvider)()]
|
|
154
165
|
};
|
|
155
|
-
exports.default = _default;
|
|
156
|
-
|
|
157
166
|
const Default = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
158
167
|
data: customData
|
|
159
168
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
160
169
|
appName: "Example!"
|
|
161
170
|
}));
|
|
162
|
-
|
|
163
171
|
exports.Default = Default;
|
|
164
|
-
|
|
165
172
|
const CustomLogoWideDimension = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
166
173
|
data: customLogoData
|
|
167
174
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
168
175
|
appName: "Example!"
|
|
169
176
|
}));
|
|
170
|
-
|
|
171
177
|
exports.CustomLogoWideDimension = CustomLogoWideDimension;
|
|
172
178
|
CustomLogoWideDimension.storyName = 'Custom Logo (wide dimension)';
|
|
173
|
-
|
|
174
179
|
const NonEnglishUserLocale = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
175
180
|
data: customLocaleData
|
|
176
181
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
177
182
|
appName: "Exemple!"
|
|
178
183
|
}));
|
|
179
|
-
|
|
180
184
|
exports.NonEnglishUserLocale = NonEnglishUserLocale;
|
|
181
185
|
NonEnglishUserLocale.storyName = 'Non-english user locale';
|
|
182
|
-
|
|
183
186
|
const NoAuthorityForInterpretationsApp = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
184
187
|
data: customAuthoritiesData
|
|
185
188
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
186
189
|
appName: "Example!"
|
|
187
190
|
}));
|
|
188
|
-
|
|
189
191
|
exports.NoAuthorityForInterpretationsApp = NoAuthorityForInterpretationsApp;
|
|
190
192
|
NoAuthorityForInterpretationsApp.storyName = 'No authority for interpretations app';
|
|
191
|
-
|
|
192
193
|
const Loading = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
193
194
|
options: {
|
|
194
195
|
loadForever: true
|
|
@@ -196,27 +197,23 @@ const Loading = () => /*#__PURE__*/_react.default.createElement(_appRuntime.Cust
|
|
|
196
197
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
197
198
|
appName: "Example!"
|
|
198
199
|
}));
|
|
199
|
-
|
|
200
200
|
exports.Loading = Loading;
|
|
201
201
|
Loading.storyName = 'Loading...';
|
|
202
|
-
|
|
203
202
|
const Error = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
204
203
|
data: {}
|
|
205
204
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
206
205
|
appName: "Exemple!"
|
|
207
206
|
}));
|
|
208
|
-
|
|
209
207
|
exports.Error = Error;
|
|
210
208
|
Error.storyName = 'Error!';
|
|
211
|
-
|
|
212
209
|
const WithOnlineStatus = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
213
210
|
data: customData
|
|
214
211
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
215
212
|
appName: "Exemple!"
|
|
216
213
|
}));
|
|
217
|
-
|
|
218
214
|
exports.WithOnlineStatus = WithOnlineStatus;
|
|
219
|
-
WithOnlineStatus.decorators = [(0, _common.createDecoratorProvider)({
|
|
215
|
+
WithOnlineStatus.decorators = [(0, _common.createDecoratorProvider)({
|
|
216
|
+
..._common.providerConfig,
|
|
220
217
|
pwaEnabled: true
|
|
221
218
|
})];
|
|
222
219
|
WithOnlineStatus.parameters = {
|
|
@@ -229,24 +226,19 @@ WithOnlineStatus.parameters = {
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
};
|
|
232
|
-
|
|
233
229
|
const WithUpdateNotification = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
234
230
|
data: customData
|
|
235
231
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
236
232
|
appName: "Data Visualizer",
|
|
237
233
|
updateAvailable: true
|
|
238
234
|
}));
|
|
239
|
-
|
|
240
235
|
exports.WithUpdateNotification = WithUpdateNotification;
|
|
241
|
-
|
|
242
236
|
const WithOnlineStatusMessage = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
243
237
|
data: customData
|
|
244
238
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
245
239
|
appName: "Exemple!"
|
|
246
240
|
}), /*#__PURE__*/_react.default.createElement(_onlineStatusMessage.OnlineStatusMessageUpdate, null));
|
|
247
|
-
|
|
248
241
|
exports.WithOnlineStatusMessage = WithOnlineStatusMessage;
|
|
249
|
-
|
|
250
242
|
const RTLHeader = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
251
243
|
data: customData
|
|
252
244
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -254,11 +246,12 @@ const RTLHeader = () => /*#__PURE__*/_react.default.createElement(_appRuntime.Cu
|
|
|
254
246
|
}, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
|
255
247
|
appName: "Example!"
|
|
256
248
|
})));
|
|
257
|
-
|
|
258
249
|
exports.RTLHeader = RTLHeader;
|
|
259
|
-
WithOnlineStatusMessage.decorators = [(0, _common.createDecoratorProvider)({
|
|
250
|
+
WithOnlineStatusMessage.decorators = [(0, _common.createDecoratorProvider)({
|
|
251
|
+
..._common.providerConfig,
|
|
260
252
|
pwaEnabled: true
|
|
261
|
-
}, {
|
|
253
|
+
}, {
|
|
254
|
+
..._common.mockOfflineInterface,
|
|
262
255
|
latestIsConnected: false
|
|
263
256
|
})];
|
|
264
257
|
WithOnlineStatusMessage.parameters = {
|
package/build/cjs/index.js
CHANGED
package/build/cjs/join-path.js
CHANGED
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinPath = void 0;
|
|
7
|
-
|
|
8
7
|
const joinPath = function () {
|
|
9
8
|
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
9
|
parts[_key] = arguments[_key];
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
const realParts = parts.filter(part => !!part);
|
|
14
12
|
return realParts.map(part => part.replace(/^\/+|\/+$/g, '')).join('/');
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
exports.joinPath = joinPath;
|
|
@@ -4,81 +4,43 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
9
|
-
|
|
10
8
|
var _translations = _interopRequireDefault(require("./ar/translations.json"));
|
|
11
|
-
|
|
12
9
|
var _translations2 = _interopRequireDefault(require("./ar_IQ/translations.json"));
|
|
13
|
-
|
|
14
10
|
var _translations3 = _interopRequireDefault(require("./bn/translations.json"));
|
|
15
|
-
|
|
16
11
|
var _translations4 = _interopRequireDefault(require("./ckb/translations.json"));
|
|
17
|
-
|
|
18
12
|
var _translations5 = _interopRequireDefault(require("./cs/translations.json"));
|
|
19
|
-
|
|
20
13
|
var _translations6 = _interopRequireDefault(require("./da/translations.json"));
|
|
21
|
-
|
|
22
14
|
var _translations7 = _interopRequireDefault(require("./en/translations.json"));
|
|
23
|
-
|
|
24
15
|
var _translations8 = _interopRequireDefault(require("./es/translations.json"));
|
|
25
|
-
|
|
26
16
|
var _translations9 = _interopRequireDefault(require("./es_419/translations.json"));
|
|
27
|
-
|
|
28
17
|
var _translations10 = _interopRequireDefault(require("./fr/translations.json"));
|
|
29
|
-
|
|
30
18
|
var _translations11 = _interopRequireDefault(require("./id/translations.json"));
|
|
31
|
-
|
|
32
19
|
var _translations12 = _interopRequireDefault(require("./km/translations.json"));
|
|
33
|
-
|
|
34
20
|
var _translations13 = _interopRequireDefault(require("./lo/translations.json"));
|
|
35
|
-
|
|
36
21
|
var _translations14 = _interopRequireDefault(require("./my/translations.json"));
|
|
37
|
-
|
|
38
22
|
var _translations15 = _interopRequireDefault(require("./nb/translations.json"));
|
|
39
|
-
|
|
40
23
|
var _translations16 = _interopRequireDefault(require("./nl/translations.json"));
|
|
41
|
-
|
|
42
24
|
var _translations17 = _interopRequireDefault(require("./or/translations.json"));
|
|
43
|
-
|
|
44
25
|
var _translations18 = _interopRequireDefault(require("./prs/translations.json"));
|
|
45
|
-
|
|
46
26
|
var _translations19 = _interopRequireDefault(require("./ps/translations.json"));
|
|
47
|
-
|
|
48
27
|
var _translations20 = _interopRequireDefault(require("./pt/translations.json"));
|
|
49
|
-
|
|
50
28
|
var _translations21 = _interopRequireDefault(require("./pt_BR/translations.json"));
|
|
51
|
-
|
|
52
29
|
var _translations22 = _interopRequireDefault(require("./ro/translations.json"));
|
|
53
|
-
|
|
54
30
|
var _translations23 = _interopRequireDefault(require("./ru/translations.json"));
|
|
55
|
-
|
|
56
31
|
var _translations24 = _interopRequireDefault(require("./si/translations.json"));
|
|
57
|
-
|
|
58
32
|
var _translations25 = _interopRequireDefault(require("./sv/translations.json"));
|
|
59
|
-
|
|
60
33
|
var _translations26 = _interopRequireDefault(require("./tet/translations.json"));
|
|
61
|
-
|
|
62
34
|
var _translations27 = _interopRequireDefault(require("./tg/translations.json"));
|
|
63
|
-
|
|
64
35
|
var _translations28 = _interopRequireDefault(require("./uk/translations.json"));
|
|
65
|
-
|
|
66
36
|
var _translations29 = _interopRequireDefault(require("./ur/translations.json"));
|
|
67
|
-
|
|
68
37
|
var _translations30 = _interopRequireDefault(require("./uz_Latn/translations.json"));
|
|
69
|
-
|
|
70
38
|
var _translations31 = _interopRequireDefault(require("./uz_UZ_Cyrl/translations.json"));
|
|
71
|
-
|
|
72
39
|
var _translations32 = _interopRequireDefault(require("./uz_UZ_Latn/translations.json"));
|
|
73
|
-
|
|
74
40
|
var _translations33 = _interopRequireDefault(require("./vi/translations.json"));
|
|
75
|
-
|
|
76
41
|
var _translations34 = _interopRequireDefault(require("./zh/translations.json"));
|
|
77
|
-
|
|
78
42
|
var _translations35 = _interopRequireDefault(require("./zh_CN/translations.json"));
|
|
79
|
-
|
|
80
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
81
|
-
|
|
43
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
82
44
|
//------------------------------------------------------------------------------
|
|
83
45
|
// <auto-generated>
|
|
84
46
|
// This code was generated by d2-i18n-generate.
|
|
@@ -87,77 +49,41 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
87
49
|
// the code is regenerated.
|
|
88
50
|
// </auto-generated>
|
|
89
51
|
//------------------------------------------------------------------------------
|
|
90
|
-
const namespace = 'default';
|
|
91
52
|
|
|
53
|
+
const namespace = 'default';
|
|
92
54
|
_d2I18n.default.addResources('ar', namespace, _translations.default);
|
|
93
|
-
|
|
94
55
|
_d2I18n.default.addResources('ar_IQ', namespace, _translations2.default);
|
|
95
|
-
|
|
96
56
|
_d2I18n.default.addResources('bn', namespace, _translations3.default);
|
|
97
|
-
|
|
98
57
|
_d2I18n.default.addResources('ckb', namespace, _translations4.default);
|
|
99
|
-
|
|
100
58
|
_d2I18n.default.addResources('cs', namespace, _translations5.default);
|
|
101
|
-
|
|
102
59
|
_d2I18n.default.addResources('da', namespace, _translations6.default);
|
|
103
|
-
|
|
104
60
|
_d2I18n.default.addResources('en', namespace, _translations7.default);
|
|
105
|
-
|
|
106
61
|
_d2I18n.default.addResources('es', namespace, _translations8.default);
|
|
107
|
-
|
|
108
62
|
_d2I18n.default.addResources('es_419', namespace, _translations9.default);
|
|
109
|
-
|
|
110
63
|
_d2I18n.default.addResources('fr', namespace, _translations10.default);
|
|
111
|
-
|
|
112
64
|
_d2I18n.default.addResources('id', namespace, _translations11.default);
|
|
113
|
-
|
|
114
65
|
_d2I18n.default.addResources('km', namespace, _translations12.default);
|
|
115
|
-
|
|
116
66
|
_d2I18n.default.addResources('lo', namespace, _translations13.default);
|
|
117
|
-
|
|
118
67
|
_d2I18n.default.addResources('my', namespace, _translations14.default);
|
|
119
|
-
|
|
120
68
|
_d2I18n.default.addResources('nb', namespace, _translations15.default);
|
|
121
|
-
|
|
122
69
|
_d2I18n.default.addResources('nl', namespace, _translations16.default);
|
|
123
|
-
|
|
124
70
|
_d2I18n.default.addResources('or', namespace, _translations17.default);
|
|
125
|
-
|
|
126
71
|
_d2I18n.default.addResources('prs', namespace, _translations18.default);
|
|
127
|
-
|
|
128
72
|
_d2I18n.default.addResources('ps', namespace, _translations19.default);
|
|
129
|
-
|
|
130
73
|
_d2I18n.default.addResources('pt', namespace, _translations20.default);
|
|
131
|
-
|
|
132
74
|
_d2I18n.default.addResources('pt_BR', namespace, _translations21.default);
|
|
133
|
-
|
|
134
75
|
_d2I18n.default.addResources('ro', namespace, _translations22.default);
|
|
135
|
-
|
|
136
76
|
_d2I18n.default.addResources('ru', namespace, _translations23.default);
|
|
137
|
-
|
|
138
77
|
_d2I18n.default.addResources('si', namespace, _translations24.default);
|
|
139
|
-
|
|
140
78
|
_d2I18n.default.addResources('sv', namespace, _translations25.default);
|
|
141
|
-
|
|
142
79
|
_d2I18n.default.addResources('tet', namespace, _translations26.default);
|
|
143
|
-
|
|
144
80
|
_d2I18n.default.addResources('tg', namespace, _translations27.default);
|
|
145
|
-
|
|
146
81
|
_d2I18n.default.addResources('uk', namespace, _translations28.default);
|
|
147
|
-
|
|
148
82
|
_d2I18n.default.addResources('ur', namespace, _translations29.default);
|
|
149
|
-
|
|
150
83
|
_d2I18n.default.addResources('uz_Latn', namespace, _translations30.default);
|
|
151
|
-
|
|
152
84
|
_d2I18n.default.addResources('uz_UZ_Cyrl', namespace, _translations31.default);
|
|
153
|
-
|
|
154
85
|
_d2I18n.default.addResources('uz_UZ_Latn', namespace, _translations32.default);
|
|
155
|
-
|
|
156
86
|
_d2I18n.default.addResources('vi', namespace, _translations33.default);
|
|
157
|
-
|
|
158
87
|
_d2I18n.default.addResources('zh', namespace, _translations34.default);
|
|
159
|
-
|
|
160
88
|
_d2I18n.default.addResources('zh_CN', namespace, _translations35.default);
|
|
161
|
-
|
|
162
|
-
var _default = _d2I18n.default;
|
|
163
|
-
exports.default = _default;
|
|
89
|
+
var _default = exports.default = _d2I18n.default;
|