@dhis2-ui/selector-bar 10.16.3 → 10.16.5
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/locales/index.js +49 -27
- package/build/cjs/selector-bar/__stories__/common.js +24 -31
- package/build/cjs/selector-bar/__stories__/keep-org-unit-expanded.js +13 -21
- package/build/cjs/selector-bar/__stories__/rtl.js +13 -15
- package/build/cjs/selector-bar/__stories__/with-multiple-rows.js +20 -23
- package/build/cjs/selector-bar/__stories__/with-right-hand-side-content.js +13 -15
- package/build/cjs/selector-bar/__stories__/with-some-inputs.js +13 -15
- package/build/cjs/selector-bar/selector-bar.js +14 -17
- package/build/cjs/selector-bar-item/selector-bar-item.e2e.stories.js +21 -30
- package/build/cjs/selector-bar-item/selector-bar-item.js +15 -17
- package/build/es/locales/index.js +40 -18
- package/build/es/selector-bar/__stories__/common.js +23 -29
- package/build/es/selector-bar/__stories__/keep-org-unit-expanded.js +12 -19
- package/build/es/selector-bar/__stories__/rtl.js +13 -15
- package/build/es/selector-bar/__stories__/with-multiple-rows.js +20 -23
- package/build/es/selector-bar/__stories__/with-right-hand-side-content.js +13 -15
- package/build/es/selector-bar/__stories__/with-some-inputs.js +13 -15
- package/build/es/selector-bar/selector-bar.js +13 -15
- package/build/es/selector-bar-item/selector-bar-item.e2e.stories.js +20 -28
- package/build/es/selector-bar-item/selector-bar-item.js +14 -15
- package/package.json +11 -11
- package/src/locales/index.js +57 -18
|
@@ -14,15 +14,15 @@ var _translations6 = _interopRequireDefault(require("./fr/translations.json"));
|
|
|
14
14
|
var _translations7 = _interopRequireDefault(require("./hi_IN/translations.json"));
|
|
15
15
|
var _translations8 = _interopRequireDefault(require("./id/translations.json"));
|
|
16
16
|
var _translations9 = _interopRequireDefault(require("./lo/translations.json"));
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
17
|
+
var _translations0 = _interopRequireDefault(require("./nb/translations.json"));
|
|
18
|
+
var _translations1 = _interopRequireDefault(require("./pt/translations.json"));
|
|
19
|
+
var _translations10 = _interopRequireDefault(require("./ru/translations.json"));
|
|
20
|
+
var _translations11 = _interopRequireDefault(require("./uk/translations.json"));
|
|
21
|
+
var _translations12 = _interopRequireDefault(require("./uz_UZ_Cyrl/translations.json"));
|
|
22
|
+
var _translations13 = _interopRequireDefault(require("./uz_UZ_Latn/translations.json"));
|
|
23
|
+
var _translations14 = _interopRequireDefault(require("./vi/translations.json"));
|
|
24
|
+
var _translations15 = _interopRequireDefault(require("./zh/translations.json"));
|
|
25
|
+
var _translations16 = _interopRequireDefault(require("./zh_CN/translations.json"));
|
|
26
26
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
27
|
//------------------------------------------------------------------------------
|
|
28
28
|
// <auto-generated>
|
|
@@ -34,22 +34,44 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
34
34
|
//------------------------------------------------------------------------------
|
|
35
35
|
|
|
36
36
|
const namespace = 'default';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_d2I18n.default.
|
|
42
|
-
_d2I18n.default.
|
|
43
|
-
_d2I18n.default.
|
|
44
|
-
_d2I18n.default.
|
|
45
|
-
_d2I18n.default.
|
|
46
|
-
_d2I18n.default.
|
|
47
|
-
_d2I18n.default.
|
|
48
|
-
_d2I18n.default.
|
|
49
|
-
_d2I18n.default.
|
|
50
|
-
_d2I18n.default.
|
|
51
|
-
_d2I18n.default.
|
|
52
|
-
_d2I18n.default.
|
|
53
|
-
_d2I18n.default.
|
|
54
|
-
_d2I18n.default.
|
|
37
|
+
|
|
38
|
+
// Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
|
|
39
|
+
// custom translations from the datastore (added by the app adapter)
|
|
40
|
+
|
|
41
|
+
_d2I18n.default.addResourceBundle('ar', namespace, _translations.default, true, false);
|
|
42
|
+
_d2I18n.default.addResourceBundle('ar', namespace, _translations.default, true, false);
|
|
43
|
+
_d2I18n.default.addResourceBundle('cs', namespace, _translations2.default, true, false);
|
|
44
|
+
_d2I18n.default.addResourceBundle('cs', namespace, _translations2.default, true, false);
|
|
45
|
+
_d2I18n.default.addResourceBundle('en', namespace, _translations3.default, true, false);
|
|
46
|
+
_d2I18n.default.addResourceBundle('en', namespace, _translations3.default, true, false);
|
|
47
|
+
_d2I18n.default.addResourceBundle('es', namespace, _translations4.default, true, false);
|
|
48
|
+
_d2I18n.default.addResourceBundle('es', namespace, _translations4.default, true, false);
|
|
49
|
+
_d2I18n.default.addResourceBundle('es_419', namespace, _translations5.default, true, false);
|
|
50
|
+
_d2I18n.default.addResourceBundle('es-419', namespace, _translations5.default, true, false);
|
|
51
|
+
_d2I18n.default.addResourceBundle('fr', namespace, _translations6.default, true, false);
|
|
52
|
+
_d2I18n.default.addResourceBundle('fr', namespace, _translations6.default, true, false);
|
|
53
|
+
_d2I18n.default.addResourceBundle('hi_IN', namespace, _translations7.default, true, false);
|
|
54
|
+
_d2I18n.default.addResourceBundle('hi-IN', namespace, _translations7.default, true, false);
|
|
55
|
+
_d2I18n.default.addResourceBundle('id', namespace, _translations8.default, true, false);
|
|
56
|
+
_d2I18n.default.addResourceBundle('id', namespace, _translations8.default, true, false);
|
|
57
|
+
_d2I18n.default.addResourceBundle('lo', namespace, _translations9.default, true, false);
|
|
58
|
+
_d2I18n.default.addResourceBundle('lo', namespace, _translations9.default, true, false);
|
|
59
|
+
_d2I18n.default.addResourceBundle('nb', namespace, _translations0.default, true, false);
|
|
60
|
+
_d2I18n.default.addResourceBundle('nb', namespace, _translations0.default, true, false);
|
|
61
|
+
_d2I18n.default.addResourceBundle('pt', namespace, _translations1.default, true, false);
|
|
62
|
+
_d2I18n.default.addResourceBundle('pt', namespace, _translations1.default, true, false);
|
|
63
|
+
_d2I18n.default.addResourceBundle('ru', namespace, _translations10.default, true, false);
|
|
64
|
+
_d2I18n.default.addResourceBundle('ru', namespace, _translations10.default, true, false);
|
|
65
|
+
_d2I18n.default.addResourceBundle('uk', namespace, _translations11.default, true, false);
|
|
66
|
+
_d2I18n.default.addResourceBundle('uk', namespace, _translations11.default, true, false);
|
|
67
|
+
_d2I18n.default.addResourceBundle('uz_UZ_Cyrl', namespace, _translations12.default, true, false);
|
|
68
|
+
_d2I18n.default.addResourceBundle('uz-Cyrl-UZ', namespace, _translations12.default, true, false);
|
|
69
|
+
_d2I18n.default.addResourceBundle('uz_UZ_Latn', namespace, _translations13.default, true, false);
|
|
70
|
+
_d2I18n.default.addResourceBundle('uz-Latn-UZ', namespace, _translations13.default, true, false);
|
|
71
|
+
_d2I18n.default.addResourceBundle('vi', namespace, _translations14.default, true, false);
|
|
72
|
+
_d2I18n.default.addResourceBundle('vi', namespace, _translations14.default, true, false);
|
|
73
|
+
_d2I18n.default.addResourceBundle('zh', namespace, _translations15.default, true, false);
|
|
74
|
+
_d2I18n.default.addResourceBundle('zh', namespace, _translations15.default, true, false);
|
|
75
|
+
_d2I18n.default.addResourceBundle('zh_CN', namespace, _translations16.default, true, false);
|
|
76
|
+
_d2I18n.default.addResourceBundle('zh-CN', namespace, _translations16.default, true, false);
|
|
55
77
|
var _default = exports.default = _d2I18n.default;
|
|
@@ -10,8 +10,7 @@ var _uiConstants = require("@dhis2/ui-constants");
|
|
|
10
10
|
var _menu = require("@dhis2-ui/menu");
|
|
11
11
|
var _organisationUnitTree = require("@dhis2-ui/organisation-unit-tree");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
function
|
|
14
|
-
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; }
|
|
13
|
+
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); }
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
const decoratorCommonStyles = fn => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, fn(), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
17
16
|
id: "3746816729",
|
|
@@ -114,10 +113,9 @@ const getOrganisationUnitData = id => {
|
|
|
114
113
|
};
|
|
115
114
|
exports.getOrganisationUnitData = getOrganisationUnitData;
|
|
116
115
|
const dataProviderData = exports.dataProviderData = {
|
|
117
|
-
organisationUnits: (_,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} = _ref;
|
|
116
|
+
organisationUnits: (_, {
|
|
117
|
+
id
|
|
118
|
+
}) => {
|
|
121
119
|
const data = getOrganisationUnitData(id);
|
|
122
120
|
if (!data) {
|
|
123
121
|
return Promise.reject(new Error('404 - Org unit not found'));
|
|
@@ -177,37 +175,32 @@ const dataSets = exports.dataSets = [{
|
|
|
177
175
|
value: 'data-set-3',
|
|
178
176
|
label: 'Data set 3'
|
|
179
177
|
}];
|
|
180
|
-
const MenuSelect =
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} = _ref2;
|
|
178
|
+
const MenuSelect = ({
|
|
179
|
+
values,
|
|
180
|
+
selected,
|
|
181
|
+
onChange
|
|
182
|
+
}) => {
|
|
186
183
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
187
184
|
style: {
|
|
188
185
|
width: 400
|
|
189
186
|
}
|
|
190
|
-
}, /*#__PURE__*/_react.default.createElement(_menu.Menu, null, values.map(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
})
|
|
202
|
-
});
|
|
203
|
-
})));
|
|
187
|
+
}, /*#__PURE__*/_react.default.createElement(_menu.Menu, null, values.map(({
|
|
188
|
+
value,
|
|
189
|
+
label
|
|
190
|
+
}) => /*#__PURE__*/_react.default.createElement(_menu.MenuItem, {
|
|
191
|
+
key: value,
|
|
192
|
+
label: label,
|
|
193
|
+
active: selected === value,
|
|
194
|
+
onClick: () => onChange({
|
|
195
|
+
selected: value
|
|
196
|
+
})
|
|
197
|
+
}))));
|
|
204
198
|
};
|
|
205
199
|
exports.MenuSelect = MenuSelect;
|
|
206
|
-
const OrgUnitSelect =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
} = _ref4;
|
|
200
|
+
const OrgUnitSelect = ({
|
|
201
|
+
onChange,
|
|
202
|
+
selected
|
|
203
|
+
}) => {
|
|
211
204
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
212
205
|
style: {
|
|
213
206
|
width: 400,
|
|
@@ -8,28 +8,20 @@ var _organisationUnitTree = require("@dhis2-ui/organisation-unit-tree");
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _index = require("../../index.js");
|
|
10
10
|
var _common = require("./common.js");
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
setOrgUnitOpen
|
|
19
|
-
} = _ref;
|
|
11
|
+
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
|
+
const KeepOrgUnitExpanded = (_, {
|
|
13
|
+
orgUnit,
|
|
14
|
+
setOrgUnit,
|
|
15
|
+
orgUnitOpen,
|
|
16
|
+
setOrgUnitOpen
|
|
17
|
+
}) => {
|
|
20
18
|
const [expanded, setExpanded] = (0, _react.useState)([]);
|
|
21
|
-
const handleExpand =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
const handleCollapse = _ref3 => {
|
|
28
|
-
let {
|
|
29
|
-
path
|
|
30
|
-
} = _ref3;
|
|
31
|
-
return setExpanded(expanded.filter(p => p !== path));
|
|
32
|
-
};
|
|
19
|
+
const handleExpand = ({
|
|
20
|
+
path
|
|
21
|
+
}) => setExpanded([...expanded, path]);
|
|
22
|
+
const handleCollapse = ({
|
|
23
|
+
path
|
|
24
|
+
}) => setExpanded(expanded.filter(p => p !== path));
|
|
33
25
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_index.SelectorBar, {
|
|
34
26
|
disableClearSelections: !orgUnit,
|
|
35
27
|
onClearSelectionClick: () => setOrgUnit(null)
|
|
@@ -17,17 +17,16 @@ const RHSContent = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
|
17
17
|
}, "Options"), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
18
18
|
id: "876392447"
|
|
19
19
|
}, [".rhs-content.jsx-876392447{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:40px;padding:0 16px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}"]));
|
|
20
|
-
const RTL = (_,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
20
|
+
const RTL = (_, {
|
|
21
|
+
workflow,
|
|
22
|
+
setWorkflow,
|
|
23
|
+
workflowOpen,
|
|
24
|
+
setWorkflowOpen,
|
|
25
|
+
orgUnit,
|
|
26
|
+
setOrgUnit,
|
|
27
|
+
orgUnitOpen,
|
|
28
|
+
setOrgUnitOpen
|
|
29
|
+
}) => {
|
|
31
30
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
31
|
dir: "rtl"
|
|
33
32
|
}, /*#__PURE__*/_react.default.createElement(_index.SelectorBar, {
|
|
@@ -50,10 +49,9 @@ const RTL = (_, _ref) => {
|
|
|
50
49
|
}, /*#__PURE__*/_react.default.createElement(_common.MenuSelect, {
|
|
51
50
|
values: _common.workflows,
|
|
52
51
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
53
|
-
onChange:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} = _ref2;
|
|
52
|
+
onChange: ({
|
|
53
|
+
selected
|
|
54
|
+
}) => {
|
|
57
55
|
setWorkflow(_common.workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
58
56
|
setWorkflowOpen(false);
|
|
59
57
|
}
|
|
@@ -10,21 +10,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _index = require("../../index.js");
|
|
11
11
|
var _common = require("./common.js");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const WithMultipleRows = (_,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
13
|
+
const WithMultipleRows = (_, {
|
|
14
|
+
workflow,
|
|
15
|
+
setWorkflow,
|
|
16
|
+
workflowOpen,
|
|
17
|
+
setWorkflowOpen,
|
|
18
|
+
dataSet,
|
|
19
|
+
setDataSet,
|
|
20
|
+
dataSetOpen,
|
|
21
|
+
setDataSetOpen,
|
|
22
|
+
orgUnit,
|
|
23
|
+
setOrgUnit,
|
|
24
|
+
orgUnitOpen,
|
|
25
|
+
setOrgUnitOpen
|
|
26
|
+
}) => {
|
|
28
27
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
28
|
className: "jsx-3203152640" + " " + "narrow-container"
|
|
30
29
|
}, /*#__PURE__*/_react.default.createElement(_index.SelectorBar, {
|
|
@@ -40,10 +39,9 @@ const WithMultipleRows = (_, _ref) => {
|
|
|
40
39
|
}, /*#__PURE__*/_react.default.createElement(_common.MenuSelect, {
|
|
41
40
|
values: _common.workflows,
|
|
42
41
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
43
|
-
onChange:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = _ref2;
|
|
42
|
+
onChange: ({
|
|
43
|
+
selected
|
|
44
|
+
}) => {
|
|
47
45
|
setWorkflow(_common.workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
48
46
|
setWorkflowOpen(false);
|
|
49
47
|
}
|
|
@@ -57,10 +55,9 @@ const WithMultipleRows = (_, _ref) => {
|
|
|
57
55
|
}, /*#__PURE__*/_react.default.createElement(_common.MenuSelect, {
|
|
58
56
|
values: _common.dataSets,
|
|
59
57
|
selected: dataSet === null || dataSet === void 0 ? void 0 : dataSet.value,
|
|
60
|
-
onChange:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} = _ref3;
|
|
58
|
+
onChange: ({
|
|
59
|
+
selected
|
|
60
|
+
}) => {
|
|
64
61
|
setDataSet(_common.dataSets.find(currentWorkflow => selected === currentWorkflow.value));
|
|
65
62
|
setDataSetOpen(false);
|
|
66
63
|
}
|
|
@@ -17,17 +17,16 @@ const RHSContent = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
|
17
17
|
}, "Options"), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
18
18
|
id: "876392447"
|
|
19
19
|
}, [".rhs-content.jsx-876392447{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:40px;padding:0 16px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}"]));
|
|
20
|
-
const WithAdditionalContent = (_,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
20
|
+
const WithAdditionalContent = (_, {
|
|
21
|
+
workflow,
|
|
22
|
+
setWorkflow,
|
|
23
|
+
workflowOpen,
|
|
24
|
+
setWorkflowOpen,
|
|
25
|
+
orgUnit,
|
|
26
|
+
setOrgUnit,
|
|
27
|
+
orgUnitOpen,
|
|
28
|
+
setOrgUnitOpen
|
|
29
|
+
}) => {
|
|
31
30
|
return /*#__PURE__*/_react.default.createElement(_index.SelectorBar, {
|
|
32
31
|
disableClearSelections: !workflow || !orgUnit,
|
|
33
32
|
onClearSelectionClick: () => {
|
|
@@ -48,10 +47,9 @@ const WithAdditionalContent = (_, _ref) => {
|
|
|
48
47
|
}, /*#__PURE__*/_react.default.createElement(_common.MenuSelect, {
|
|
49
48
|
values: _common.workflows,
|
|
50
49
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
51
|
-
onChange:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} = _ref2;
|
|
50
|
+
onChange: ({
|
|
51
|
+
selected
|
|
52
|
+
}) => {
|
|
55
53
|
setWorkflow(_common.workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
56
54
|
setWorkflowOpen(false);
|
|
57
55
|
}
|
|
@@ -8,17 +8,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _index = require("../../index.js");
|
|
9
9
|
var _common = require("./common.js");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const WithSomeInputs = (_,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
11
|
+
const WithSomeInputs = (_, {
|
|
12
|
+
workflow,
|
|
13
|
+
setWorkflow,
|
|
14
|
+
workflowOpen,
|
|
15
|
+
setWorkflowOpen,
|
|
16
|
+
orgUnit,
|
|
17
|
+
setOrgUnit,
|
|
18
|
+
orgUnitOpen,
|
|
19
|
+
setOrgUnitOpen
|
|
20
|
+
}) => {
|
|
22
21
|
return /*#__PURE__*/_react.default.createElement(_index.SelectorBar, {
|
|
23
22
|
disableClearSelections: !workflow && !orgUnit,
|
|
24
23
|
onClearSelectionClick: () => {
|
|
@@ -38,10 +37,9 @@ const WithSomeInputs = (_, _ref) => {
|
|
|
38
37
|
}, /*#__PURE__*/_react.default.createElement(_common.MenuSelect, {
|
|
39
38
|
values: _common.workflows,
|
|
40
39
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
41
|
-
onChange:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = _ref2;
|
|
40
|
+
onChange: ({
|
|
41
|
+
selected
|
|
42
|
+
}) => {
|
|
45
43
|
setWorkflow(_common.workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
46
44
|
setWorkflowOpen(false);
|
|
47
45
|
}
|
|
@@ -11,14 +11,12 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
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
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
const ClearSelection =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
16
|
+
const ClearSelection = ({
|
|
17
|
+
disabled,
|
|
18
|
+
onClick
|
|
19
|
+
}) => {
|
|
22
20
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
21
|
className: _style.default.dynamic([["3676026375", [_uiConstants.spacers.dp8]]]) + " " + "clear-selections"
|
|
24
22
|
}, /*#__PURE__*/_react.default.createElement(_button.Button, {
|
|
@@ -35,16 +33,15 @@ ClearSelection.propTypes = {
|
|
|
35
33
|
disabled: _propTypes.default.bool,
|
|
36
34
|
onClick: _propTypes.default.func
|
|
37
35
|
};
|
|
38
|
-
const SelectorBar =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = _ref2;
|
|
36
|
+
const SelectorBar = ({
|
|
37
|
+
className,
|
|
38
|
+
children,
|
|
39
|
+
onClearSelectionClick,
|
|
40
|
+
dataTest = 'dhis2-ui-selectorbar',
|
|
41
|
+
disableClearSelections,
|
|
42
|
+
additionalContent,
|
|
43
|
+
ariaLabel
|
|
44
|
+
}) => {
|
|
48
45
|
const container = (0, _react.useRef)(null);
|
|
49
46
|
const [childrenToFocus, setChildrenToFocus] = (0, _react.useState)([]);
|
|
50
47
|
(0, _react.useEffect)(() => {
|
|
@@ -7,8 +7,7 @@ exports.default = exports.OpenWithValue = exports.OpenNoValue = exports.ClosedWi
|
|
|
7
7
|
var _select = require("@dhis2-ui/select");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _selectorBarItem = require("./selector-bar-item.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 options = [{
|
|
13
12
|
value: 'value 1',
|
|
14
13
|
label: 'label 1'
|
|
@@ -31,45 +30,37 @@ const createStateDecorator = args => {
|
|
|
31
30
|
});
|
|
32
31
|
};
|
|
33
32
|
};
|
|
34
|
-
const createStory = () => (_,
|
|
33
|
+
const createStory = () => (_, {
|
|
34
|
+
open,
|
|
35
|
+
setOpen,
|
|
36
|
+
selected,
|
|
37
|
+
setSelected
|
|
38
|
+
}) => {
|
|
35
39
|
var _options$find;
|
|
36
|
-
let {
|
|
37
|
-
open,
|
|
38
|
-
setOpen,
|
|
39
|
-
selected,
|
|
40
|
-
setSelected
|
|
41
|
-
} = _ref;
|
|
42
40
|
return /*#__PURE__*/_react.default.createElement(_selectorBarItem.SelectorBarItem, {
|
|
43
41
|
label: "Selection bar item",
|
|
44
42
|
noValueMessage: "No value message",
|
|
45
43
|
open: open,
|
|
46
44
|
setOpen: setOpen,
|
|
47
|
-
value: ((_options$find = options.find(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = _ref2;
|
|
51
|
-
return value === selected;
|
|
52
|
-
})) === null || _options$find === void 0 ? void 0 : _options$find.label) || ''
|
|
45
|
+
value: ((_options$find = options.find(({
|
|
46
|
+
value
|
|
47
|
+
}) => value === selected)) === null || _options$find === void 0 ? void 0 : _options$find.label) || ''
|
|
53
48
|
}, /*#__PURE__*/_react.default.createElement(_select.SingleSelectField, {
|
|
54
49
|
selected: selected,
|
|
55
|
-
onChange:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} = _ref3;
|
|
50
|
+
onChange: ({
|
|
51
|
+
selected: nextSelected
|
|
52
|
+
}) => {
|
|
59
53
|
setSelected(nextSelected);
|
|
60
54
|
setOpen(false);
|
|
61
55
|
}
|
|
62
|
-
}, options.map(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
label: label
|
|
71
|
-
});
|
|
72
|
-
})));
|
|
56
|
+
}, options.map(({
|
|
57
|
+
value,
|
|
58
|
+
label
|
|
59
|
+
}) => /*#__PURE__*/_react.default.createElement(_select.SingleSelectOption, {
|
|
60
|
+
key: value,
|
|
61
|
+
value: value,
|
|
62
|
+
label: label
|
|
63
|
+
}))));
|
|
73
64
|
};
|
|
74
65
|
var _default = exports.default = {
|
|
75
66
|
title: 'SelectorBarItem'
|
|
@@ -13,8 +13,7 @@ var _popper = require("@dhis2-ui/popper");
|
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
-
function
|
|
17
|
-
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; }
|
|
16
|
+
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); }
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
18
|
const offsetModifier = {
|
|
20
19
|
name: 'offset',
|
|
@@ -33,27 +32,26 @@ const offsetModifier = {
|
|
|
33
32
|
* "multiple" selections, this would be more or less impossible to predict
|
|
34
33
|
* inside this component
|
|
35
34
|
*/
|
|
36
|
-
const SelectorBarItem =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} = _ref;
|
|
35
|
+
const SelectorBarItem = ({
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
dataTest = 'dhis2-ui-selectorbaritem',
|
|
39
|
+
disabled,
|
|
40
|
+
displayOnly,
|
|
41
|
+
label,
|
|
42
|
+
noValueMessage,
|
|
43
|
+
open,
|
|
44
|
+
setOpen,
|
|
45
|
+
value,
|
|
46
|
+
onClearSelectionClick
|
|
47
|
+
}) => {
|
|
50
48
|
const buttonRef = (0, _react.useRef)();
|
|
51
49
|
const Icon = open ? _uiIcons.IconChevronUp24 : _uiIcons.IconChevronDown24;
|
|
52
50
|
const handleKeyDown = evt => {
|
|
53
51
|
if (open && setOpen && evt.key === 'Tab') {
|
|
54
52
|
var _buttonRef$current;
|
|
55
53
|
// Move focus to trigger and defer close so Tab advances before the popup unmounts.
|
|
56
|
-
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0
|
|
54
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
57
55
|
requestAnimationFrame(() => setOpen(false));
|
|
58
56
|
}
|
|
59
57
|
};
|
|
@@ -26,22 +26,44 @@ import viTranslations from './vi/translations.json';
|
|
|
26
26
|
import zhTranslations from './zh/translations.json';
|
|
27
27
|
import zh_CNTranslations from './zh_CN/translations.json';
|
|
28
28
|
const namespace = 'default';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
i18n.
|
|
34
|
-
i18n.
|
|
35
|
-
i18n.
|
|
36
|
-
i18n.
|
|
37
|
-
i18n.
|
|
38
|
-
i18n.
|
|
39
|
-
i18n.
|
|
40
|
-
i18n.
|
|
41
|
-
i18n.
|
|
42
|
-
i18n.
|
|
43
|
-
i18n.
|
|
44
|
-
i18n.
|
|
45
|
-
i18n.
|
|
46
|
-
i18n.
|
|
29
|
+
|
|
30
|
+
// Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
|
|
31
|
+
// custom translations from the datastore (added by the app adapter)
|
|
32
|
+
|
|
33
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
|
|
34
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
|
|
35
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
|
|
36
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
|
|
37
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false);
|
|
38
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false);
|
|
39
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false);
|
|
40
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false);
|
|
41
|
+
i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false);
|
|
42
|
+
i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false);
|
|
43
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
|
|
44
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
|
|
45
|
+
i18n.addResourceBundle('hi_IN', namespace, hi_INTranslations, true, false);
|
|
46
|
+
i18n.addResourceBundle('hi-IN', namespace, hi_INTranslations, true, false);
|
|
47
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false);
|
|
48
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false);
|
|
49
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
|
|
50
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
|
|
51
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
|
|
52
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
|
|
53
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
|
|
54
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
|
|
55
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
|
|
56
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
|
|
57
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
|
|
58
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
|
|
59
|
+
i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false);
|
|
60
|
+
i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false);
|
|
61
|
+
i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false);
|
|
62
|
+
i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false);
|
|
63
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
|
|
64
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
|
|
65
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
|
|
66
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
|
|
67
|
+
i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false);
|
|
68
|
+
i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false);
|
|
47
69
|
export default i18n;
|
|
@@ -103,10 +103,9 @@ export const getOrganisationUnitData = id => {
|
|
|
103
103
|
return data;
|
|
104
104
|
};
|
|
105
105
|
export const dataProviderData = {
|
|
106
|
-
organisationUnits: (_,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} = _ref;
|
|
106
|
+
organisationUnits: (_, {
|
|
107
|
+
id
|
|
108
|
+
}) => {
|
|
110
109
|
const data = getOrganisationUnitData(id);
|
|
111
110
|
if (!data) {
|
|
112
111
|
return Promise.reject(new Error('404 - Org unit not found'));
|
|
@@ -164,36 +163,31 @@ export const dataSets = [{
|
|
|
164
163
|
value: 'data-set-3',
|
|
165
164
|
label: 'Data set 3'
|
|
166
165
|
}];
|
|
167
|
-
export const MenuSelect =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
} = _ref2;
|
|
166
|
+
export const MenuSelect = ({
|
|
167
|
+
values,
|
|
168
|
+
selected,
|
|
169
|
+
onChange
|
|
170
|
+
}) => {
|
|
173
171
|
return /*#__PURE__*/React.createElement("div", {
|
|
174
172
|
style: {
|
|
175
173
|
width: 400
|
|
176
174
|
}
|
|
177
|
-
}, /*#__PURE__*/React.createElement(Menu, null, values.map(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
})));
|
|
175
|
+
}, /*#__PURE__*/React.createElement(Menu, null, values.map(({
|
|
176
|
+
value,
|
|
177
|
+
label
|
|
178
|
+
}) => /*#__PURE__*/React.createElement(MenuItem, {
|
|
179
|
+
key: value,
|
|
180
|
+
label: label,
|
|
181
|
+
active: selected === value,
|
|
182
|
+
onClick: () => onChange({
|
|
183
|
+
selected: value
|
|
184
|
+
})
|
|
185
|
+
}))));
|
|
191
186
|
};
|
|
192
|
-
export const OrgUnitSelect =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
} = _ref4;
|
|
187
|
+
export const OrgUnitSelect = ({
|
|
188
|
+
onChange,
|
|
189
|
+
selected
|
|
190
|
+
}) => {
|
|
197
191
|
return /*#__PURE__*/React.createElement("div", {
|
|
198
192
|
style: {
|
|
199
193
|
width: 400,
|
|
@@ -2,26 +2,19 @@ import { OrganisationUnitTree } from '@dhis2-ui/organisation-unit-tree';
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { SelectorBar, SelectorBarItem } from '../../index.js';
|
|
4
4
|
import { createStatefulDecorator, decoratorCommonStyles, createDecoratorCustomDataProvider } from './common.js';
|
|
5
|
-
export const KeepOrgUnitExpanded = (_,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
5
|
+
export const KeepOrgUnitExpanded = (_, {
|
|
6
|
+
orgUnit,
|
|
7
|
+
setOrgUnit,
|
|
8
|
+
orgUnitOpen,
|
|
9
|
+
setOrgUnitOpen
|
|
10
|
+
}) => {
|
|
12
11
|
const [expanded, setExpanded] = useState([]);
|
|
13
|
-
const handleExpand =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
const handleCollapse = _ref3 => {
|
|
20
|
-
let {
|
|
21
|
-
path
|
|
22
|
-
} = _ref3;
|
|
23
|
-
return setExpanded(expanded.filter(p => p !== path));
|
|
24
|
-
};
|
|
12
|
+
const handleExpand = ({
|
|
13
|
+
path
|
|
14
|
+
}) => setExpanded([...expanded, path]);
|
|
15
|
+
const handleCollapse = ({
|
|
16
|
+
path
|
|
17
|
+
}) => setExpanded(expanded.filter(p => p !== path));
|
|
25
18
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SelectorBar, {
|
|
26
19
|
disableClearSelections: !orgUnit,
|
|
27
20
|
onClearSelectionClick: () => setOrgUnit(null)
|
|
@@ -10,17 +10,16 @@ const RHSContent = () => /*#__PURE__*/React.createElement("div", {
|
|
|
10
10
|
}, "Options"), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
11
11
|
id: "876392447"
|
|
12
12
|
}, [".rhs-content.jsx-876392447{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:40px;padding:0 16px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}"]));
|
|
13
|
-
export const RTL = (_,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = _ref;
|
|
13
|
+
export const RTL = (_, {
|
|
14
|
+
workflow,
|
|
15
|
+
setWorkflow,
|
|
16
|
+
workflowOpen,
|
|
17
|
+
setWorkflowOpen,
|
|
18
|
+
orgUnit,
|
|
19
|
+
setOrgUnit,
|
|
20
|
+
orgUnitOpen,
|
|
21
|
+
setOrgUnitOpen
|
|
22
|
+
}) => {
|
|
24
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
24
|
dir: "rtl"
|
|
26
25
|
}, /*#__PURE__*/React.createElement(SelectorBar, {
|
|
@@ -43,10 +42,9 @@ export const RTL = (_, _ref) => {
|
|
|
43
42
|
}, /*#__PURE__*/React.createElement(MenuSelect, {
|
|
44
43
|
values: workflows,
|
|
45
44
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
46
|
-
onChange:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} = _ref2;
|
|
45
|
+
onChange: ({
|
|
46
|
+
selected
|
|
47
|
+
}) => {
|
|
50
48
|
setWorkflow(workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
51
49
|
setWorkflowOpen(false);
|
|
52
50
|
}
|
|
@@ -3,21 +3,20 @@ import { OrganisationUnitTree } from '@dhis2-ui/organisation-unit-tree';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { SelectorBar, SelectorBarItem } from '../../index.js';
|
|
5
5
|
import { MenuSelect, createDecoratorCustomDataProvider, createStatefulDecorator, dataSets, decoratorCommonStyles, workflows } from './common.js';
|
|
6
|
-
export const WithMultipleRows = (_,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
6
|
+
export const WithMultipleRows = (_, {
|
|
7
|
+
workflow,
|
|
8
|
+
setWorkflow,
|
|
9
|
+
workflowOpen,
|
|
10
|
+
setWorkflowOpen,
|
|
11
|
+
dataSet,
|
|
12
|
+
setDataSet,
|
|
13
|
+
dataSetOpen,
|
|
14
|
+
setDataSetOpen,
|
|
15
|
+
orgUnit,
|
|
16
|
+
setOrgUnit,
|
|
17
|
+
orgUnitOpen,
|
|
18
|
+
setOrgUnitOpen
|
|
19
|
+
}) => {
|
|
21
20
|
return /*#__PURE__*/React.createElement("div", {
|
|
22
21
|
className: "jsx-3203152640" + " " + "narrow-container"
|
|
23
22
|
}, /*#__PURE__*/React.createElement(SelectorBar, {
|
|
@@ -33,10 +32,9 @@ export const WithMultipleRows = (_, _ref) => {
|
|
|
33
32
|
}, /*#__PURE__*/React.createElement(MenuSelect, {
|
|
34
33
|
values: workflows,
|
|
35
34
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
36
|
-
onChange:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = _ref2;
|
|
35
|
+
onChange: ({
|
|
36
|
+
selected
|
|
37
|
+
}) => {
|
|
40
38
|
setWorkflow(workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
41
39
|
setWorkflowOpen(false);
|
|
42
40
|
}
|
|
@@ -50,10 +48,9 @@ export const WithMultipleRows = (_, _ref) => {
|
|
|
50
48
|
}, /*#__PURE__*/React.createElement(MenuSelect, {
|
|
51
49
|
values: dataSets,
|
|
52
50
|
selected: dataSet === null || dataSet === void 0 ? void 0 : dataSet.value,
|
|
53
|
-
onChange:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} = _ref3;
|
|
51
|
+
onChange: ({
|
|
52
|
+
selected
|
|
53
|
+
}) => {
|
|
57
54
|
setDataSet(dataSets.find(currentWorkflow => selected === currentWorkflow.value));
|
|
58
55
|
setDataSetOpen(false);
|
|
59
56
|
}
|
|
@@ -10,17 +10,16 @@ const RHSContent = () => /*#__PURE__*/React.createElement("div", {
|
|
|
10
10
|
}, "Options"), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
11
11
|
id: "876392447"
|
|
12
12
|
}, [".rhs-content.jsx-876392447{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:40px;padding:0 16px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}"]));
|
|
13
|
-
export const WithAdditionalContent = (_,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = _ref;
|
|
13
|
+
export const WithAdditionalContent = (_, {
|
|
14
|
+
workflow,
|
|
15
|
+
setWorkflow,
|
|
16
|
+
workflowOpen,
|
|
17
|
+
setWorkflowOpen,
|
|
18
|
+
orgUnit,
|
|
19
|
+
setOrgUnit,
|
|
20
|
+
orgUnitOpen,
|
|
21
|
+
setOrgUnitOpen
|
|
22
|
+
}) => {
|
|
24
23
|
return /*#__PURE__*/React.createElement(SelectorBar, {
|
|
25
24
|
disableClearSelections: !workflow || !orgUnit,
|
|
26
25
|
onClearSelectionClick: () => {
|
|
@@ -41,10 +40,9 @@ export const WithAdditionalContent = (_, _ref) => {
|
|
|
41
40
|
}, /*#__PURE__*/React.createElement(MenuSelect, {
|
|
42
41
|
values: workflows,
|
|
43
42
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
44
|
-
onChange:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = _ref2;
|
|
43
|
+
onChange: ({
|
|
44
|
+
selected
|
|
45
|
+
}) => {
|
|
48
46
|
setWorkflow(workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
49
47
|
setWorkflowOpen(false);
|
|
50
48
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectorBar, SelectorBarItem } from '../../index.js';
|
|
3
3
|
import { OrgUnitSelect, MenuSelect, createDecoratorCustomDataProvider, createStatefulDecorator, decoratorCommonStyles, workflows } from './common.js';
|
|
4
|
-
export const WithSomeInputs = (_,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} = _ref;
|
|
4
|
+
export const WithSomeInputs = (_, {
|
|
5
|
+
workflow,
|
|
6
|
+
setWorkflow,
|
|
7
|
+
workflowOpen,
|
|
8
|
+
setWorkflowOpen,
|
|
9
|
+
orgUnit,
|
|
10
|
+
setOrgUnit,
|
|
11
|
+
orgUnitOpen,
|
|
12
|
+
setOrgUnitOpen
|
|
13
|
+
}) => {
|
|
15
14
|
return /*#__PURE__*/React.createElement(SelectorBar, {
|
|
16
15
|
disableClearSelections: !workflow && !orgUnit,
|
|
17
16
|
onClearSelectionClick: () => {
|
|
@@ -31,10 +30,9 @@ export const WithSomeInputs = (_, _ref) => {
|
|
|
31
30
|
}, /*#__PURE__*/React.createElement(MenuSelect, {
|
|
32
31
|
values: workflows,
|
|
33
32
|
selected: workflow === null || workflow === void 0 ? void 0 : workflow.value,
|
|
34
|
-
onChange:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref2;
|
|
33
|
+
onChange: ({
|
|
34
|
+
selected
|
|
35
|
+
}) => {
|
|
38
36
|
setWorkflow(workflows.find(currentWorkflow => selected === currentWorkflow.value));
|
|
39
37
|
setWorkflowOpen(false);
|
|
40
38
|
}
|
|
@@ -5,11 +5,10 @@ import cx from 'classnames';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React, { useRef, useState, useEffect } from 'react';
|
|
7
7
|
import i18n from '../locales/index.js';
|
|
8
|
-
const ClearSelection =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
8
|
+
const ClearSelection = ({
|
|
9
|
+
disabled,
|
|
10
|
+
onClick
|
|
11
|
+
}) => {
|
|
13
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
13
|
className: _JSXStyle.dynamic([["3676026375", [spacers.dp8]]]) + " " + "clear-selections"
|
|
15
14
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -26,16 +25,15 @@ ClearSelection.propTypes = {
|
|
|
26
25
|
disabled: PropTypes.bool,
|
|
27
26
|
onClick: PropTypes.func
|
|
28
27
|
};
|
|
29
|
-
export const SelectorBar =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = _ref2;
|
|
28
|
+
export const SelectorBar = ({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
onClearSelectionClick,
|
|
32
|
+
dataTest = 'dhis2-ui-selectorbar',
|
|
33
|
+
disableClearSelections,
|
|
34
|
+
additionalContent,
|
|
35
|
+
ariaLabel
|
|
36
|
+
}) => {
|
|
39
37
|
const container = useRef(null);
|
|
40
38
|
const [childrenToFocus, setChildrenToFocus] = useState([]);
|
|
41
39
|
useEffect(() => {
|
|
@@ -23,45 +23,37 @@ const createStateDecorator = args => {
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
const createStory = () => (_,
|
|
26
|
+
const createStory = () => (_, {
|
|
27
|
+
open,
|
|
28
|
+
setOpen,
|
|
29
|
+
selected,
|
|
30
|
+
setSelected
|
|
31
|
+
}) => {
|
|
27
32
|
var _options$find;
|
|
28
|
-
let {
|
|
29
|
-
open,
|
|
30
|
-
setOpen,
|
|
31
|
-
selected,
|
|
32
|
-
setSelected
|
|
33
|
-
} = _ref;
|
|
34
33
|
return /*#__PURE__*/React.createElement(SelectorBarItem, {
|
|
35
34
|
label: "Selection bar item",
|
|
36
35
|
noValueMessage: "No value message",
|
|
37
36
|
open: open,
|
|
38
37
|
setOpen: setOpen,
|
|
39
|
-
value: ((_options$find = options.find(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} = _ref2;
|
|
43
|
-
return value === selected;
|
|
44
|
-
})) === null || _options$find === void 0 ? void 0 : _options$find.label) || ''
|
|
38
|
+
value: ((_options$find = options.find(({
|
|
39
|
+
value
|
|
40
|
+
}) => value === selected)) === null || _options$find === void 0 ? void 0 : _options$find.label) || ''
|
|
45
41
|
}, /*#__PURE__*/React.createElement(SingleSelectField, {
|
|
46
42
|
selected: selected,
|
|
47
|
-
onChange:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = _ref3;
|
|
43
|
+
onChange: ({
|
|
44
|
+
selected: nextSelected
|
|
45
|
+
}) => {
|
|
51
46
|
setSelected(nextSelected);
|
|
52
47
|
setOpen(false);
|
|
53
48
|
}
|
|
54
|
-
}, options.map(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
label: label
|
|
63
|
-
});
|
|
64
|
-
})));
|
|
49
|
+
}, options.map(({
|
|
50
|
+
value,
|
|
51
|
+
label
|
|
52
|
+
}) => /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
53
|
+
key: value,
|
|
54
|
+
value: value,
|
|
55
|
+
label: label
|
|
56
|
+
}))));
|
|
65
57
|
};
|
|
66
58
|
export default {
|
|
67
59
|
title: 'SelectorBarItem'
|
|
@@ -24,27 +24,26 @@ const offsetModifier = {
|
|
|
24
24
|
* "multiple" selections, this would be more or less impossible to predict
|
|
25
25
|
* inside this component
|
|
26
26
|
*/
|
|
27
|
-
export const SelectorBarItem =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
27
|
+
export const SelectorBarItem = ({
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
dataTest = 'dhis2-ui-selectorbaritem',
|
|
31
|
+
disabled,
|
|
32
|
+
displayOnly,
|
|
33
|
+
label,
|
|
34
|
+
noValueMessage,
|
|
35
|
+
open,
|
|
36
|
+
setOpen,
|
|
37
|
+
value,
|
|
38
|
+
onClearSelectionClick
|
|
39
|
+
}) => {
|
|
41
40
|
const buttonRef = useRef();
|
|
42
41
|
const Icon = open ? IconChevronUp24 : IconChevronDown24;
|
|
43
42
|
const handleKeyDown = evt => {
|
|
44
43
|
if (open && setOpen && evt.key === 'Tab') {
|
|
45
44
|
var _buttonRef$current;
|
|
46
45
|
// Move focus to trigger and defer close so Tab advances before the popup unmounts.
|
|
47
|
-
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0
|
|
46
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
48
47
|
requestAnimationFrame(() => setOpen(false));
|
|
49
48
|
}
|
|
50
49
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/selector-bar",
|
|
3
|
-
"version": "10.16.
|
|
3
|
+
"version": "10.16.5",
|
|
4
4
|
"description": "UI Select",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"styled-jsx": "^4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@dhis2-ui/button": "10.16.
|
|
37
|
-
"@dhis2-ui/card": "10.16.
|
|
38
|
-
"@dhis2-ui/popper": "10.16.
|
|
39
|
-
"@dhis2-ui/layer": "10.16.
|
|
40
|
-
"@dhis2/ui-constants": "10.16.
|
|
41
|
-
"@dhis2/ui-icons": "10.16.
|
|
36
|
+
"@dhis2-ui/button": "10.16.5",
|
|
37
|
+
"@dhis2-ui/card": "10.16.5",
|
|
38
|
+
"@dhis2-ui/popper": "10.16.5",
|
|
39
|
+
"@dhis2-ui/layer": "10.16.5",
|
|
40
|
+
"@dhis2/ui-constants": "10.16.5",
|
|
41
|
+
"@dhis2/ui-icons": "10.16.5",
|
|
42
42
|
"classnames": "^2.3.1",
|
|
43
43
|
"prop-types": "^15.7.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@dhis2-ui/css": "10.16.
|
|
47
|
-
"@dhis2-ui/menu": "10.16.
|
|
48
|
-
"@dhis2-ui/organisation-unit-tree": "10.16.
|
|
49
|
-
"@dhis2-ui/select": "10.16.
|
|
46
|
+
"@dhis2-ui/css": "10.16.5",
|
|
47
|
+
"@dhis2-ui/menu": "10.16.5",
|
|
48
|
+
"@dhis2-ui/organisation-unit-tree": "10.16.5",
|
|
49
|
+
"@dhis2-ui/select": "10.16.5",
|
|
50
50
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
51
51
|
"react": "^18.3.1",
|
|
52
52
|
"react-dom": "^18.3.1",
|
package/src/locales/index.js
CHANGED
|
@@ -28,23 +28,62 @@ import zhTranslations from './zh/translations.json'
|
|
|
28
28
|
import zh_CNTranslations from './zh_CN/translations.json'
|
|
29
29
|
|
|
30
30
|
const namespace = 'default'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
i18n.
|
|
36
|
-
i18n.
|
|
37
|
-
|
|
38
|
-
i18n.
|
|
39
|
-
i18n.
|
|
40
|
-
|
|
41
|
-
i18n.
|
|
42
|
-
i18n.
|
|
43
|
-
|
|
44
|
-
i18n.
|
|
45
|
-
i18n.
|
|
46
|
-
|
|
47
|
-
i18n.
|
|
48
|
-
i18n.
|
|
31
|
+
|
|
32
|
+
// Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
|
|
33
|
+
// custom translations from the datastore (added by the app adapter)
|
|
34
|
+
|
|
35
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false)
|
|
36
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false)
|
|
37
|
+
|
|
38
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false)
|
|
39
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false)
|
|
40
|
+
|
|
41
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false)
|
|
42
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false)
|
|
43
|
+
|
|
44
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false)
|
|
45
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false)
|
|
46
|
+
|
|
47
|
+
i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false)
|
|
48
|
+
i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false)
|
|
49
|
+
|
|
50
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false)
|
|
51
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false)
|
|
52
|
+
|
|
53
|
+
i18n.addResourceBundle('hi_IN', namespace, hi_INTranslations, true, false)
|
|
54
|
+
i18n.addResourceBundle('hi-IN', namespace, hi_INTranslations, true, false)
|
|
55
|
+
|
|
56
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false)
|
|
57
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false)
|
|
58
|
+
|
|
59
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false)
|
|
60
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false)
|
|
61
|
+
|
|
62
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false)
|
|
63
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false)
|
|
64
|
+
|
|
65
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false)
|
|
66
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false)
|
|
67
|
+
|
|
68
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false)
|
|
69
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false)
|
|
70
|
+
|
|
71
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false)
|
|
72
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false)
|
|
73
|
+
|
|
74
|
+
i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false)
|
|
75
|
+
i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false)
|
|
76
|
+
|
|
77
|
+
i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false)
|
|
78
|
+
i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false)
|
|
79
|
+
|
|
80
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false)
|
|
81
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false)
|
|
82
|
+
|
|
83
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false)
|
|
84
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false)
|
|
85
|
+
|
|
86
|
+
i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false)
|
|
87
|
+
i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false)
|
|
49
88
|
|
|
50
89
|
export default i18n
|