@dhis2-ui/header-bar 10.16.3 → 10.16.4
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__/stories/common.js +6 -11
- package/build/cjs/__e2e__/stories/with-update-available-notification.js +1 -2
- package/build/cjs/apps.js +51 -66
- package/build/cjs/debug-info/debug-info-menu-item.js +4 -5
- package/build/cjs/debug-info/debug-info-modal.js +3 -4
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +2 -4
- package/build/cjs/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +1 -2
- package/build/cjs/header-bar-context.js +6 -8
- package/build/cjs/header-bar.js +12 -14
- package/build/cjs/header-bar.prod.stories.js +1 -2
- package/build/cjs/join-path.js +1 -4
- package/build/cjs/locales/index.js +106 -65
- package/build/cjs/notification-icon.js +21 -24
- package/build/cjs/notifications.js +5 -6
- package/build/cjs/online-status.js +3 -4
- package/build/cjs/profile-menu/profile-header.js +44 -57
- package/build/cjs/profile-menu/profile-menu.js +17 -22
- package/build/cjs/profile-menu/update-notification.js +4 -5
- package/build/cjs/profile.js +7 -9
- package/build/cjs/title.js +9 -12
- package/build/es/__e2e__/stories/common.js +5 -9
- package/build/es/apps.js +50 -64
- package/build/es/debug-info/debug-info-menu-item.js +4 -5
- package/build/es/debug-info/debug-info-modal.js +3 -4
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +2 -4
- package/build/es/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +1 -2
- package/build/es/header-bar-context.js +5 -6
- package/build/es/header-bar.js +11 -12
- package/build/es/join-path.js +1 -4
- package/build/es/locales/index.js +78 -37
- package/build/es/notification-icon.js +21 -24
- package/build/es/notifications.js +5 -6
- package/build/es/online-status.js +3 -4
- package/build/es/profile-menu/profile-header.js +44 -57
- package/build/es/profile-menu/profile-menu.js +16 -20
- package/build/es/profile-menu/update-notification.js +4 -5
- package/build/es/profile.js +6 -7
- package/build/es/title.js +9 -12
- package/package.json +15 -15
- package/src/locales/index.js +114 -37
|
@@ -15,8 +15,7 @@ var _appRuntime = require("@dhis2/app-runtime");
|
|
|
15
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _modulesWithSpecialCharacters = require("./modulesWithSpecialCharacters.js");
|
|
18
|
-
function
|
|
19
|
-
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; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
20
|
/* eslint-disable react/display-name */
|
|
22
21
|
|
|
@@ -111,8 +110,7 @@ const dataProviderData = exports.dataProviderData = {
|
|
|
111
110
|
|
|
112
111
|
// Trailing "HeaderBar" because storybook is confusing this with the
|
|
113
112
|
// helper from the org unit tree's common.js helper with the same name
|
|
114
|
-
const createDecoratorCustomDataProviderHeaderBar =
|
|
115
|
-
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dataProviderData;
|
|
113
|
+
const createDecoratorCustomDataProviderHeaderBar = (data = dataProviderData) => {
|
|
116
114
|
return fn => {
|
|
117
115
|
window.dataProviderData = data;
|
|
118
116
|
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
@@ -172,10 +170,9 @@ const providerConfig = exports.providerConfig = {
|
|
|
172
170
|
baseUrl: 'https://domain.tld/',
|
|
173
171
|
apiVersion: ''
|
|
174
172
|
};
|
|
175
|
-
const MockAlert =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
} = _ref;
|
|
173
|
+
const MockAlert = ({
|
|
174
|
+
alert
|
|
175
|
+
}) => {
|
|
179
176
|
(0, _react.useEffect)(() => {
|
|
180
177
|
var _alert$options;
|
|
181
178
|
if ((_alert$options = alert.options) !== null && _alert$options !== void 0 && _alert$options.duration) {
|
|
@@ -220,9 +217,7 @@ const mockOfflineInterface = exports.mockOfflineInterface = {
|
|
|
220
217
|
subscribeToDhis2ConnectionStatus: () => () => undefined,
|
|
221
218
|
latestIsConnected: true
|
|
222
219
|
};
|
|
223
|
-
const createDecoratorProvider =
|
|
224
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : providerConfig;
|
|
225
|
-
let offlineInterface = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : mockOfflineInterface;
|
|
220
|
+
const createDecoratorProvider = (config = providerConfig, offlineInterface = mockOfflineInterface) => {
|
|
226
221
|
return fn => /*#__PURE__*/_react.default.createElement(_appRuntime.Provider, {
|
|
227
222
|
config: config,
|
|
228
223
|
offlineInterface: offlineInterface
|
|
@@ -7,8 +7,7 @@ exports.WithUpdateAvailableNotificationNoAppName = exports.WithUpdateAvailableNo
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _headerBar = require("../../header-bar.js");
|
|
9
9
|
var _common = require("./common.js");
|
|
10
|
-
function
|
|
11
|
-
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; }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
11
|
const WithUpdateAvailableNotification = () => {
|
|
13
12
|
const [modalOpen, setModalOpen] = (0, _react.useState)(false);
|
|
14
13
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_headerBar.HeaderBar, {
|
package/build/cjs/apps.js
CHANGED
|
@@ -14,8 +14,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _joinPath = require("./join-path.js");
|
|
16
16
|
var _index = _interopRequireDefault(require("./locales/index.js"));
|
|
17
|
-
function
|
|
18
|
-
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; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
19
|
/**
|
|
21
20
|
* Copied from here:
|
|
@@ -24,11 +23,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
24
23
|
function escapeRegExpCharacters(text) {
|
|
25
24
|
return text.replace(/[/.*+?^${}()|[\]\\]/g, '\\$&');
|
|
26
25
|
}
|
|
27
|
-
function Search(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
26
|
+
function Search({
|
|
27
|
+
value,
|
|
28
|
+
onChange
|
|
29
|
+
}) {
|
|
32
30
|
const {
|
|
33
31
|
baseUrl
|
|
34
32
|
} = (0, _appRuntime.useConfig)();
|
|
@@ -57,12 +55,11 @@ Search.propTypes = {
|
|
|
57
55
|
value: _propTypes.default.string.isRequired,
|
|
58
56
|
onChange: _propTypes.default.func.isRequired
|
|
59
57
|
};
|
|
60
|
-
function Item(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} = _ref2;
|
|
58
|
+
function Item({
|
|
59
|
+
name,
|
|
60
|
+
path,
|
|
61
|
+
img
|
|
62
|
+
}) {
|
|
66
63
|
return /*#__PURE__*/_react.default.createElement("a", {
|
|
67
64
|
href: path,
|
|
68
65
|
className: _style.default.dynamic([["1412616027", [_uiConstants.theme.primary050]]])
|
|
@@ -82,37 +79,32 @@ Item.propTypes = {
|
|
|
82
79
|
name: _propTypes.default.string,
|
|
83
80
|
path: _propTypes.default.string
|
|
84
81
|
};
|
|
85
|
-
function List(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} = _ref3;
|
|
82
|
+
function List({
|
|
83
|
+
apps,
|
|
84
|
+
filter
|
|
85
|
+
}) {
|
|
90
86
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
87
|
"data-test": "headerbar-apps-menu-list",
|
|
92
88
|
className: "jsx-2424821176"
|
|
93
|
-
}, apps.filter(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} = _ref4;
|
|
89
|
+
}, apps.filter(({
|
|
90
|
+
displayName,
|
|
91
|
+
name
|
|
92
|
+
}) => {
|
|
98
93
|
const appName = displayName || name;
|
|
99
94
|
const formattedAppName = appName.toLowerCase();
|
|
100
95
|
const formattedFilter = escapeRegExpCharacters(filter).toLowerCase();
|
|
101
96
|
return filter.length > 0 ? formattedAppName.match(formattedFilter) : true;
|
|
102
|
-
}).map((
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
img: icon
|
|
114
|
-
});
|
|
115
|
-
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
97
|
+
}).map(({
|
|
98
|
+
displayName,
|
|
99
|
+
name,
|
|
100
|
+
defaultAction,
|
|
101
|
+
icon
|
|
102
|
+
}, idx) => /*#__PURE__*/_react.default.createElement(Item, {
|
|
103
|
+
key: `app-${name}-${idx}`,
|
|
104
|
+
name: displayName || name,
|
|
105
|
+
path: defaultAction,
|
|
106
|
+
img: icon
|
|
107
|
+
})), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
116
108
|
id: "2424821176"
|
|
117
109
|
}, ["div.jsx-2424821176{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;width:30vw;min-width:300px;max-width:560px;min-height:200px;max-height:465px;margin-block-start:0;margin-block-end:8px;margin-inline:8px;overflow:auto;overflow-x:hidden;}"]));
|
|
118
110
|
}
|
|
@@ -120,43 +112,36 @@ List.propTypes = {
|
|
|
120
112
|
apps: _propTypes.default.array,
|
|
121
113
|
filter: _propTypes.default.string
|
|
122
114
|
};
|
|
123
|
-
const AppMenu =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
id: "3826299842"
|
|
140
|
-
}, ["div.jsx-3826299842{z-index:10000;position:absolute;inset-inline-end:-4px;}"]));
|
|
141
|
-
};
|
|
115
|
+
const AppMenu = ({
|
|
116
|
+
apps,
|
|
117
|
+
filter,
|
|
118
|
+
onFilterChange
|
|
119
|
+
}) => /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
"data-test": "headerbar-apps-menu",
|
|
121
|
+
className: "jsx-3826299842"
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_card.Card, null, /*#__PURE__*/_react.default.createElement(Search, {
|
|
123
|
+
value: filter,
|
|
124
|
+
onChange: onFilterChange
|
|
125
|
+
}), /*#__PURE__*/_react.default.createElement(List, {
|
|
126
|
+
apps: apps,
|
|
127
|
+
filter: filter
|
|
128
|
+
})), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
129
|
+
id: "3826299842"
|
|
130
|
+
}, ["div.jsx-3826299842{z-index:10000;position:absolute;inset-inline-end:-4px;}"]));
|
|
142
131
|
AppMenu.propTypes = {
|
|
143
132
|
apps: _propTypes.default.array.isRequired,
|
|
144
133
|
onFilterChange: _propTypes.default.func.isRequired,
|
|
145
134
|
filter: _propTypes.default.string
|
|
146
135
|
};
|
|
147
|
-
const Apps =
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} = _ref7;
|
|
136
|
+
const Apps = ({
|
|
137
|
+
apps
|
|
138
|
+
}) => {
|
|
151
139
|
const [show, setShow] = (0, _react.useState)(false);
|
|
152
140
|
const [filter, setFilter] = (0, _react.useState)('');
|
|
153
141
|
const handleVisibilityToggle = (0, _react.useCallback)(() => setShow(!show), [show]);
|
|
154
|
-
const handleFilterChange = (0, _react.useCallback)(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} = _ref8;
|
|
158
|
-
return setFilter(value);
|
|
159
|
-
}, []);
|
|
142
|
+
const handleFilterChange = (0, _react.useCallback)(({
|
|
143
|
+
value
|
|
144
|
+
}) => setFilter(value), []);
|
|
160
145
|
const containerEl = (0, _react.useRef)(null);
|
|
161
146
|
const onDocClick = (0, _react.useCallback)(evt => {
|
|
162
147
|
if (containerEl.current && !containerEl.current.contains(evt.target)) {
|
|
@@ -12,11 +12,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
13
13
|
var _useDebugInfo = require("./use-debug-info.js");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const DebugInfoMenuItem =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
15
|
+
const DebugInfoMenuItem = ({
|
|
16
|
+
hideProfileMenu,
|
|
17
|
+
showDebugInfoModal
|
|
18
|
+
}) => {
|
|
20
19
|
const debugInfo = (0, _useDebugInfo.useDebugInfo)();
|
|
21
20
|
const openDebugModal = () => {
|
|
22
21
|
hideProfileMenu();
|
|
@@ -13,10 +13,9 @@ var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
|
13
13
|
var _debugInfoTable = require("./debug-info-table.js");
|
|
14
14
|
var _useDebugInfo = require("./use-debug-info.js");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function DebugInfoModal(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
16
|
+
function DebugInfoModal({
|
|
17
|
+
onClose
|
|
18
|
+
}) {
|
|
20
19
|
const debugInfo = (0, _useDebugInfo.useFormattedDebugInfo)();
|
|
21
20
|
const {
|
|
22
21
|
show: showClipboardAlert
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
(0, _cypressCucumberPreprocessor.Then)('contains the user name', () => {
|
|
5
|
-
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-username"]')).then(
|
|
6
|
-
let [win, $name] = _ref;
|
|
5
|
+
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-username"]')).then(([win, $name]) => {
|
|
7
6
|
console.log('win.dataProviderData', win.dataProviderData);
|
|
8
7
|
const {
|
|
9
8
|
name
|
|
@@ -12,8 +11,7 @@ var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preproces
|
|
|
12
11
|
});
|
|
13
12
|
});
|
|
14
13
|
(0, _cypressCucumberPreprocessor.Then)('contains the user email', () => {
|
|
15
|
-
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-user-email"]')).then(
|
|
16
|
-
let [win, $email] = _ref2;
|
|
14
|
+
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-user-email"]')).then(([win, $email]) => {
|
|
17
15
|
const {
|
|
18
16
|
email
|
|
19
17
|
} = win.dataProviderData.me;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
(0, _cypressCucumberPreprocessor.Given)(/no app name contains a (.*)/, character => {
|
|
5
5
|
// Needs to be wrapped, otherwise for some reason the wrong char is in the scope
|
|
6
|
-
cy.all(() => cy.window(), () => cy.wrap(character)).then(
|
|
7
|
-
let [win, char] = _ref;
|
|
6
|
+
cy.all(() => cy.window(), () => cy.wrap(character)).then(([win, char]) => {
|
|
8
7
|
const {
|
|
9
8
|
dataProviderData
|
|
10
9
|
} = win;
|
|
@@ -6,19 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useHeaderBarContext = exports.HeaderBarContextProvider = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
function
|
|
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; }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
const headerBarContext = /*#__PURE__*/(0, _react.createContext)({
|
|
13
12
|
updateAvailable: false,
|
|
14
13
|
onApplyAvailableUpdate: () => {}
|
|
15
14
|
});
|
|
16
|
-
const HeaderBarContextProvider =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
15
|
+
const HeaderBarContextProvider = ({
|
|
16
|
+
updateAvailable,
|
|
17
|
+
onApplyAvailableUpdate,
|
|
18
|
+
children
|
|
19
|
+
}) => {
|
|
22
20
|
return /*#__PURE__*/_react.default.createElement(headerBarContext.Provider, {
|
|
23
21
|
value: {
|
|
24
22
|
updateAvailable,
|
package/build/cjs/header-bar.js
CHANGED
|
@@ -18,8 +18,7 @@ var _notifications = require("./notifications.js");
|
|
|
18
18
|
var _onlineStatus = require("./online-status.js");
|
|
19
19
|
var _profile = _interopRequireDefault(require("./profile.js"));
|
|
20
20
|
var _title = require("./title.js");
|
|
21
|
-
function
|
|
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; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
23
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
23
|
const query = {
|
|
25
24
|
title: {
|
|
@@ -41,15 +40,14 @@ const query = {
|
|
|
41
40
|
resource: 'me/dashboard'
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
|
-
const HeaderBar =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
} = _ref;
|
|
43
|
+
const HeaderBar = ({
|
|
44
|
+
appName,
|
|
45
|
+
className,
|
|
46
|
+
updateAvailable,
|
|
47
|
+
onApplyAvailableUpdate,
|
|
48
|
+
skipI18n
|
|
49
|
+
}) => {
|
|
50
|
+
var _data$user2, _data$user$avatar;
|
|
53
51
|
const {
|
|
54
52
|
appName: configAppName,
|
|
55
53
|
baseUrl,
|
|
@@ -70,16 +68,16 @@ const HeaderBar = _ref => {
|
|
|
70
68
|
}, [data, baseUrl]);
|
|
71
69
|
(0, _react.useEffect)(() => {
|
|
72
70
|
if (!loading && !error && !skipI18n) {
|
|
73
|
-
var _data$user
|
|
71
|
+
var _data$user;
|
|
74
72
|
// This is the "legacy" way of localising the header bar, which is necesasry for external (non-platform) apps
|
|
75
73
|
// For platform apps, setting i18n is handled by the app-shell so this logic is redundant (and running it twice caused issues)
|
|
76
74
|
// For external apps, this logic is kept for backwards compatibility, but they also have the option of passing `skipI18n`
|
|
77
75
|
// and initialising i18n in the consumer
|
|
78
|
-
const locale = (data === null || data === void 0
|
|
76
|
+
const locale = (data === null || data === void 0 || (_data$user = data.user) === null || _data$user === void 0 || (_data$user = _data$user.settings) === null || _data$user === void 0 ? void 0 : _data$user.keyUiLocale) || 'en';
|
|
79
77
|
_index.default.setDefaultNamespace('default');
|
|
80
78
|
_index.default.changeLanguage(locale);
|
|
81
79
|
}
|
|
82
|
-
}, [data === null || data === void 0
|
|
80
|
+
}, [data === null || data === void 0 || (_data$user2 = data.user) === null || _data$user2 === void 0 || (_data$user2 = _data$user2.settings) === null || _data$user2 === void 0 ? void 0 : _data$user2.keyUiLocale, error, loading, skipI18n]);
|
|
83
81
|
return /*#__PURE__*/_react.default.createElement(_headerBarContext.HeaderBarContextProvider, {
|
|
84
82
|
updateAvailable: updateAvailable,
|
|
85
83
|
onApplyAvailableUpdate: onApplyAvailableUpdate
|
|
@@ -11,8 +11,7 @@ var _onlineStatusMessage = require("./__e2e__/stories/online-status-message.js")
|
|
|
11
11
|
var _headerBar = require("./header-bar.js");
|
|
12
12
|
var _index = _interopRequireDefault(require("./locales/index.js"));
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function
|
|
15
|
-
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; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
15
|
const subtitle = 'The common navigation bar used in all DHIS2 apps';
|
|
17
16
|
const description = `
|
|
18
17
|
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.
|
package/build/cjs/join-path.js
CHANGED
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinPath = void 0;
|
|
7
|
-
const joinPath =
|
|
8
|
-
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
|
-
parts[_key] = arguments[_key];
|
|
10
|
-
}
|
|
7
|
+
const joinPath = (...parts) => {
|
|
11
8
|
const realParts = parts.filter(part => !!part);
|
|
12
9
|
return realParts.map(part => part.replace(/^\/+|\/+$/g, '')).join('/');
|
|
13
10
|
};
|
|
@@ -14,34 +14,34 @@ var _translations6 = _interopRequireDefault(require("./da/translations.json"));
|
|
|
14
14
|
var _translations7 = _interopRequireDefault(require("./en/translations.json"));
|
|
15
15
|
var _translations8 = _interopRequireDefault(require("./en_US/translations.json"));
|
|
16
16
|
var _translations9 = _interopRequireDefault(require("./es/translations.json"));
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
17
|
+
var _translations0 = _interopRequireDefault(require("./es_419/translations.json"));
|
|
18
|
+
var _translations1 = _interopRequireDefault(require("./fr/translations.json"));
|
|
19
|
+
var _translations10 = _interopRequireDefault(require("./hi_IN/translations.json"));
|
|
20
|
+
var _translations11 = _interopRequireDefault(require("./id/translations.json"));
|
|
21
|
+
var _translations12 = _interopRequireDefault(require("./km/translations.json"));
|
|
22
|
+
var _translations13 = _interopRequireDefault(require("./lo/translations.json"));
|
|
23
|
+
var _translations14 = _interopRequireDefault(require("./my/translations.json"));
|
|
24
|
+
var _translations15 = _interopRequireDefault(require("./nb/translations.json"));
|
|
25
|
+
var _translations16 = _interopRequireDefault(require("./nl/translations.json"));
|
|
26
|
+
var _translations17 = _interopRequireDefault(require("./or/translations.json"));
|
|
27
|
+
var _translations18 = _interopRequireDefault(require("./prs/translations.json"));
|
|
28
|
+
var _translations19 = _interopRequireDefault(require("./ps/translations.json"));
|
|
29
|
+
var _translations20 = _interopRequireDefault(require("./pt/translations.json"));
|
|
30
|
+
var _translations21 = _interopRequireDefault(require("./pt_BR/translations.json"));
|
|
31
|
+
var _translations22 = _interopRequireDefault(require("./ro/translations.json"));
|
|
32
|
+
var _translations23 = _interopRequireDefault(require("./ru/translations.json"));
|
|
33
|
+
var _translations24 = _interopRequireDefault(require("./si/translations.json"));
|
|
34
|
+
var _translations25 = _interopRequireDefault(require("./sv/translations.json"));
|
|
35
|
+
var _translations26 = _interopRequireDefault(require("./tet/translations.json"));
|
|
36
|
+
var _translations27 = _interopRequireDefault(require("./tg/translations.json"));
|
|
37
|
+
var _translations28 = _interopRequireDefault(require("./uk/translations.json"));
|
|
38
|
+
var _translations29 = _interopRequireDefault(require("./ur/translations.json"));
|
|
39
|
+
var _translations30 = _interopRequireDefault(require("./uz_Latn/translations.json"));
|
|
40
|
+
var _translations31 = _interopRequireDefault(require("./uz_UZ_Cyrl/translations.json"));
|
|
41
|
+
var _translations32 = _interopRequireDefault(require("./uz_UZ_Latn/translations.json"));
|
|
42
|
+
var _translations33 = _interopRequireDefault(require("./vi/translations.json"));
|
|
43
|
+
var _translations34 = _interopRequireDefault(require("./zh/translations.json"));
|
|
44
|
+
var _translations35 = _interopRequireDefault(require("./zh_CN/translations.json"));
|
|
45
45
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
46
46
|
//------------------------------------------------------------------------------
|
|
47
47
|
// <auto-generated>
|
|
@@ -53,41 +53,82 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
53
53
|
//------------------------------------------------------------------------------
|
|
54
54
|
|
|
55
55
|
const namespace = 'default';
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_d2I18n.default.
|
|
61
|
-
_d2I18n.default.
|
|
62
|
-
_d2I18n.default.
|
|
63
|
-
_d2I18n.default.
|
|
64
|
-
_d2I18n.default.
|
|
65
|
-
_d2I18n.default.
|
|
66
|
-
_d2I18n.default.
|
|
67
|
-
_d2I18n.default.
|
|
68
|
-
_d2I18n.default.
|
|
69
|
-
_d2I18n.default.
|
|
70
|
-
_d2I18n.default.
|
|
71
|
-
_d2I18n.default.
|
|
72
|
-
_d2I18n.default.
|
|
73
|
-
_d2I18n.default.
|
|
74
|
-
_d2I18n.default.
|
|
75
|
-
_d2I18n.default.
|
|
76
|
-
_d2I18n.default.
|
|
77
|
-
_d2I18n.default.
|
|
78
|
-
_d2I18n.default.
|
|
79
|
-
_d2I18n.default.
|
|
80
|
-
_d2I18n.default.
|
|
81
|
-
_d2I18n.default.
|
|
82
|
-
_d2I18n.default.
|
|
83
|
-
_d2I18n.default.
|
|
84
|
-
_d2I18n.default.
|
|
85
|
-
_d2I18n.default.
|
|
86
|
-
_d2I18n.default.
|
|
87
|
-
_d2I18n.default.
|
|
88
|
-
_d2I18n.default.
|
|
89
|
-
_d2I18n.default.
|
|
90
|
-
_d2I18n.default.
|
|
91
|
-
_d2I18n.default.
|
|
92
|
-
_d2I18n.default.
|
|
56
|
+
|
|
57
|
+
// Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
|
|
58
|
+
// custom translations from the datastore (added by the app adapter)
|
|
59
|
+
|
|
60
|
+
_d2I18n.default.addResourceBundle('ar', namespace, _translations.default, true, false);
|
|
61
|
+
_d2I18n.default.addResourceBundle('ar', namespace, _translations.default, true, false);
|
|
62
|
+
_d2I18n.default.addResourceBundle('ar_IQ', namespace, _translations2.default, true, false);
|
|
63
|
+
_d2I18n.default.addResourceBundle('ar-IQ', namespace, _translations2.default, true, false);
|
|
64
|
+
_d2I18n.default.addResourceBundle('bn', namespace, _translations3.default, true, false);
|
|
65
|
+
_d2I18n.default.addResourceBundle('bn', namespace, _translations3.default, true, false);
|
|
66
|
+
_d2I18n.default.addResourceBundle('ckb', namespace, _translations4.default, true, false);
|
|
67
|
+
_d2I18n.default.addResourceBundle('ckb', namespace, _translations4.default, true, false);
|
|
68
|
+
_d2I18n.default.addResourceBundle('cs', namespace, _translations5.default, true, false);
|
|
69
|
+
_d2I18n.default.addResourceBundle('cs', namespace, _translations5.default, true, false);
|
|
70
|
+
_d2I18n.default.addResourceBundle('da', namespace, _translations6.default, true, false);
|
|
71
|
+
_d2I18n.default.addResourceBundle('da', namespace, _translations6.default, true, false);
|
|
72
|
+
_d2I18n.default.addResourceBundle('en', namespace, _translations7.default, true, false);
|
|
73
|
+
_d2I18n.default.addResourceBundle('en', namespace, _translations7.default, true, false);
|
|
74
|
+
_d2I18n.default.addResourceBundle('en_US', namespace, _translations8.default, true, false);
|
|
75
|
+
_d2I18n.default.addResourceBundle('en-US', namespace, _translations8.default, true, false);
|
|
76
|
+
_d2I18n.default.addResourceBundle('es', namespace, _translations9.default, true, false);
|
|
77
|
+
_d2I18n.default.addResourceBundle('es', namespace, _translations9.default, true, false);
|
|
78
|
+
_d2I18n.default.addResourceBundle('es_419', namespace, _translations0.default, true, false);
|
|
79
|
+
_d2I18n.default.addResourceBundle('es-419', namespace, _translations0.default, true, false);
|
|
80
|
+
_d2I18n.default.addResourceBundle('fr', namespace, _translations1.default, true, false);
|
|
81
|
+
_d2I18n.default.addResourceBundle('fr', namespace, _translations1.default, true, false);
|
|
82
|
+
_d2I18n.default.addResourceBundle('hi_IN', namespace, _translations10.default, true, false);
|
|
83
|
+
_d2I18n.default.addResourceBundle('hi-IN', namespace, _translations10.default, true, false);
|
|
84
|
+
_d2I18n.default.addResourceBundle('id', namespace, _translations11.default, true, false);
|
|
85
|
+
_d2I18n.default.addResourceBundle('id', namespace, _translations11.default, true, false);
|
|
86
|
+
_d2I18n.default.addResourceBundle('km', namespace, _translations12.default, true, false);
|
|
87
|
+
_d2I18n.default.addResourceBundle('km', namespace, _translations12.default, true, false);
|
|
88
|
+
_d2I18n.default.addResourceBundle('lo', namespace, _translations13.default, true, false);
|
|
89
|
+
_d2I18n.default.addResourceBundle('lo', namespace, _translations13.default, true, false);
|
|
90
|
+
_d2I18n.default.addResourceBundle('my', namespace, _translations14.default, true, false);
|
|
91
|
+
_d2I18n.default.addResourceBundle('my', namespace, _translations14.default, true, false);
|
|
92
|
+
_d2I18n.default.addResourceBundle('nb', namespace, _translations15.default, true, false);
|
|
93
|
+
_d2I18n.default.addResourceBundle('nb', namespace, _translations15.default, true, false);
|
|
94
|
+
_d2I18n.default.addResourceBundle('nl', namespace, _translations16.default, true, false);
|
|
95
|
+
_d2I18n.default.addResourceBundle('nl', namespace, _translations16.default, true, false);
|
|
96
|
+
_d2I18n.default.addResourceBundle('or', namespace, _translations17.default, true, false);
|
|
97
|
+
_d2I18n.default.addResourceBundle('or', namespace, _translations17.default, true, false);
|
|
98
|
+
_d2I18n.default.addResourceBundle('prs', namespace, _translations18.default, true, false);
|
|
99
|
+
_d2I18n.default.addResourceBundle('prs', namespace, _translations18.default, true, false);
|
|
100
|
+
_d2I18n.default.addResourceBundle('ps', namespace, _translations19.default, true, false);
|
|
101
|
+
_d2I18n.default.addResourceBundle('ps', namespace, _translations19.default, true, false);
|
|
102
|
+
_d2I18n.default.addResourceBundle('pt', namespace, _translations20.default, true, false);
|
|
103
|
+
_d2I18n.default.addResourceBundle('pt', namespace, _translations20.default, true, false);
|
|
104
|
+
_d2I18n.default.addResourceBundle('pt_BR', namespace, _translations21.default, true, false);
|
|
105
|
+
_d2I18n.default.addResourceBundle('pt-BR', namespace, _translations21.default, true, false);
|
|
106
|
+
_d2I18n.default.addResourceBundle('ro', namespace, _translations22.default, true, false);
|
|
107
|
+
_d2I18n.default.addResourceBundle('ro', namespace, _translations22.default, true, false);
|
|
108
|
+
_d2I18n.default.addResourceBundle('ru', namespace, _translations23.default, true, false);
|
|
109
|
+
_d2I18n.default.addResourceBundle('ru', namespace, _translations23.default, true, false);
|
|
110
|
+
_d2I18n.default.addResourceBundle('si', namespace, _translations24.default, true, false);
|
|
111
|
+
_d2I18n.default.addResourceBundle('si', namespace, _translations24.default, true, false);
|
|
112
|
+
_d2I18n.default.addResourceBundle('sv', namespace, _translations25.default, true, false);
|
|
113
|
+
_d2I18n.default.addResourceBundle('sv', namespace, _translations25.default, true, false);
|
|
114
|
+
_d2I18n.default.addResourceBundle('tet', namespace, _translations26.default, true, false);
|
|
115
|
+
_d2I18n.default.addResourceBundle('tet', namespace, _translations26.default, true, false);
|
|
116
|
+
_d2I18n.default.addResourceBundle('tg', namespace, _translations27.default, true, false);
|
|
117
|
+
_d2I18n.default.addResourceBundle('tg', namespace, _translations27.default, true, false);
|
|
118
|
+
_d2I18n.default.addResourceBundle('uk', namespace, _translations28.default, true, false);
|
|
119
|
+
_d2I18n.default.addResourceBundle('uk', namespace, _translations28.default, true, false);
|
|
120
|
+
_d2I18n.default.addResourceBundle('ur', namespace, _translations29.default, true, false);
|
|
121
|
+
_d2I18n.default.addResourceBundle('ur', namespace, _translations29.default, true, false);
|
|
122
|
+
_d2I18n.default.addResourceBundle('uz_Latn', namespace, _translations30.default, true, false);
|
|
123
|
+
_d2I18n.default.addResourceBundle('uz-Latn', namespace, _translations30.default, true, false);
|
|
124
|
+
_d2I18n.default.addResourceBundle('uz_UZ_Cyrl', namespace, _translations31.default, true, false);
|
|
125
|
+
_d2I18n.default.addResourceBundle('uz-Cyrl-UZ', namespace, _translations31.default, true, false);
|
|
126
|
+
_d2I18n.default.addResourceBundle('uz_UZ_Latn', namespace, _translations32.default, true, false);
|
|
127
|
+
_d2I18n.default.addResourceBundle('uz-Latn-UZ', namespace, _translations32.default, true, false);
|
|
128
|
+
_d2I18n.default.addResourceBundle('vi', namespace, _translations33.default, true, false);
|
|
129
|
+
_d2I18n.default.addResourceBundle('vi', namespace, _translations33.default, true, false);
|
|
130
|
+
_d2I18n.default.addResourceBundle('zh', namespace, _translations34.default, true, false);
|
|
131
|
+
_d2I18n.default.addResourceBundle('zh', namespace, _translations34.default, true, false);
|
|
132
|
+
_d2I18n.default.addResourceBundle('zh_CN', namespace, _translations35.default, true, false);
|
|
133
|
+
_d2I18n.default.addResourceBundle('zh-CN', namespace, _translations35.default, true, false);
|
|
93
134
|
var _default = exports.default = _d2I18n.default;
|