@dhis2-ui/selector-bar 10.16.2 → 10.16.3
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/package.json +13 -12
- package/src/index.js +2 -0
- package/src/locales/ar/translations.json +3 -0
- package/src/locales/cs/translations.json +3 -0
- package/src/locales/en/translations.json +3 -0
- package/src/locales/es/translations.json +3 -0
- package/src/locales/es_419/translations.json +3 -0
- package/src/locales/fr/translations.json +3 -0
- package/src/locales/hi_IN/translations.json +3 -0
- package/src/locales/id/translations.json +3 -0
- package/src/locales/index.js +50 -0
- package/src/locales/lo/translations.json +3 -0
- package/src/locales/nb/translations.json +3 -0
- package/src/locales/pt/translations.json +3 -0
- package/src/locales/ru/translations.json +3 -0
- package/src/locales/uk/translations.json +3 -0
- package/src/locales/uz_UZ_Cyrl/translations.json +3 -0
- package/src/locales/uz_UZ_Latn/translations.json +3 -0
- package/src/locales/vi/translations.json +3 -0
- package/src/locales/zh/translations.json +3 -0
- package/src/locales/zh_CN/translations.json +3 -0
- package/src/selector-bar/__stories__/common.js +232 -0
- package/src/selector-bar/__stories__/keep-org-unit-expanded.js +71 -0
- package/src/selector-bar/__stories__/rtl.js +105 -0
- package/src/selector-bar/__stories__/with-multiple-rows.js +131 -0
- package/src/selector-bar/__stories__/with-right-hand-side-content.js +103 -0
- package/src/selector-bar/__stories__/with-some-inputs.js +95 -0
- package/src/selector-bar/index.js +1 -0
- package/src/selector-bar/selector-bar.js +171 -0
- package/src/selector-bar/selector-bar.prod.stories.js +6 -0
- package/src/selector-bar/selector-bar.test.js +124 -0
- package/src/selector-bar-item/features/toggle-children/index.js +27 -0
- package/src/selector-bar-item/features/toggle-children.feature +11 -0
- package/src/selector-bar-item/index.js +1 -0
- package/src/selector-bar-item/selector-bar-item.e2e.stories.js +64 -0
- package/src/selector-bar-item/selector-bar-item.js +190 -0
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.3",
|
|
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.3",
|
|
37
|
+
"@dhis2-ui/card": "10.16.3",
|
|
38
|
+
"@dhis2-ui/popper": "10.16.3",
|
|
39
|
+
"@dhis2-ui/layer": "10.16.3",
|
|
40
|
+
"@dhis2/ui-constants": "10.16.3",
|
|
41
|
+
"@dhis2/ui-icons": "10.16.3",
|
|
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.3",
|
|
47
|
+
"@dhis2-ui/menu": "10.16.3",
|
|
48
|
+
"@dhis2-ui/organisation-unit-tree": "10.16.3",
|
|
49
|
+
"@dhis2-ui/select": "10.16.3",
|
|
50
50
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
51
51
|
"react": "^18.3.1",
|
|
52
52
|
"react-dom": "^18.3.1",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
56
|
"build",
|
|
57
|
-
"types"
|
|
57
|
+
"types",
|
|
58
|
+
"src"
|
|
58
59
|
],
|
|
59
60
|
"types": "types"
|
|
60
61
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//------------------------------------------------------------------------------
|
|
2
|
+
// <auto-generated>
|
|
3
|
+
// This code was generated by d2-i18n-generate.
|
|
4
|
+
//
|
|
5
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
6
|
+
// the code is regenerated.
|
|
7
|
+
// </auto-generated>
|
|
8
|
+
//------------------------------------------------------------------------------
|
|
9
|
+
import i18n from '@dhis2/d2-i18n'
|
|
10
|
+
|
|
11
|
+
import arTranslations from './ar/translations.json'
|
|
12
|
+
import csTranslations from './cs/translations.json'
|
|
13
|
+
import enTranslations from './en/translations.json'
|
|
14
|
+
import esTranslations from './es/translations.json'
|
|
15
|
+
import es_419Translations from './es_419/translations.json'
|
|
16
|
+
import frTranslations from './fr/translations.json'
|
|
17
|
+
import hi_INTranslations from './hi_IN/translations.json'
|
|
18
|
+
import idTranslations from './id/translations.json'
|
|
19
|
+
import loTranslations from './lo/translations.json'
|
|
20
|
+
import nbTranslations from './nb/translations.json'
|
|
21
|
+
import ptTranslations from './pt/translations.json'
|
|
22
|
+
import ruTranslations from './ru/translations.json'
|
|
23
|
+
import ukTranslations from './uk/translations.json'
|
|
24
|
+
import uz_UZ_CyrlTranslations from './uz_UZ_Cyrl/translations.json'
|
|
25
|
+
import uz_UZ_LatnTranslations from './uz_UZ_Latn/translations.json'
|
|
26
|
+
import viTranslations from './vi/translations.json'
|
|
27
|
+
import zhTranslations from './zh/translations.json'
|
|
28
|
+
import zh_CNTranslations from './zh_CN/translations.json'
|
|
29
|
+
|
|
30
|
+
const namespace = 'default'
|
|
31
|
+
i18n.addResources('ar', namespace, arTranslations)
|
|
32
|
+
i18n.addResources('cs', namespace, csTranslations)
|
|
33
|
+
i18n.addResources('en', namespace, enTranslations)
|
|
34
|
+
i18n.addResources('es', namespace, esTranslations)
|
|
35
|
+
i18n.addResources('es_419', namespace, es_419Translations)
|
|
36
|
+
i18n.addResources('fr', namespace, frTranslations)
|
|
37
|
+
i18n.addResources('hi_IN', namespace, hi_INTranslations)
|
|
38
|
+
i18n.addResources('id', namespace, idTranslations)
|
|
39
|
+
i18n.addResources('lo', namespace, loTranslations)
|
|
40
|
+
i18n.addResources('nb', namespace, nbTranslations)
|
|
41
|
+
i18n.addResources('pt', namespace, ptTranslations)
|
|
42
|
+
i18n.addResources('ru', namespace, ruTranslations)
|
|
43
|
+
i18n.addResources('uk', namespace, ukTranslations)
|
|
44
|
+
i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations)
|
|
45
|
+
i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations)
|
|
46
|
+
i18n.addResources('vi', namespace, viTranslations)
|
|
47
|
+
i18n.addResources('zh', namespace, zhTranslations)
|
|
48
|
+
i18n.addResources('zh_CN', namespace, zh_CNTranslations)
|
|
49
|
+
|
|
50
|
+
export default i18n
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { CustomDataProvider } from '@dhis2/app-runtime'
|
|
2
|
+
import { colors } from '@dhis2/ui-constants'
|
|
3
|
+
import { Menu, MenuItem } from '@dhis2-ui/menu'
|
|
4
|
+
import { OrganisationUnitTree } from '@dhis2-ui/organisation-unit-tree'
|
|
5
|
+
import React, { useState } from 'react'
|
|
6
|
+
|
|
7
|
+
export const decoratorCommonStyles = (fn) => (
|
|
8
|
+
<>
|
|
9
|
+
{fn()}
|
|
10
|
+
<style jsx>{`
|
|
11
|
+
:global(body) {
|
|
12
|
+
background: ${colors.grey100};
|
|
13
|
+
padding: 0 !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:global(div#root) {
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
`}</style>
|
|
20
|
+
</>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
export const getOrganisationUnitData = (id) => {
|
|
24
|
+
let data
|
|
25
|
+
|
|
26
|
+
if (id === 'A0000000000') {
|
|
27
|
+
data = {
|
|
28
|
+
id: 'A0000000000',
|
|
29
|
+
path: '/A0000000000',
|
|
30
|
+
displayName: 'Org Unit 1',
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
id: 'A0000000001',
|
|
34
|
+
path: '/A0000000000/A0000000001',
|
|
35
|
+
children: [{ id: 'A0000000003' }, { id: 'A0000000004' }],
|
|
36
|
+
displayName: 'Org Unit 2',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'A0000000002',
|
|
40
|
+
path: '/A0000000000/A0000000002',
|
|
41
|
+
children: [],
|
|
42
|
+
displayName: 'Org Unit 3',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'A0000000006',
|
|
46
|
+
path: '/A0000000000/A0000000006',
|
|
47
|
+
children: [],
|
|
48
|
+
displayName: 'Org Unit 7',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (id === 'A0000000001') {
|
|
55
|
+
data = {
|
|
56
|
+
id: 'A0000000001',
|
|
57
|
+
path: '/A0000000000/A0000000001',
|
|
58
|
+
displayName: 'Org Unit 2',
|
|
59
|
+
children: [
|
|
60
|
+
{
|
|
61
|
+
id: 'A0000000003',
|
|
62
|
+
path: '/A0000000000/A0000000001/A0000000003',
|
|
63
|
+
children: [],
|
|
64
|
+
displayName: 'Org Unit 4',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'A0000000004',
|
|
68
|
+
path: '/A0000000000/A0000000001/A0000000004',
|
|
69
|
+
children: [],
|
|
70
|
+
displayName: 'Org Unit 5',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (id === 'A0000000002') {
|
|
77
|
+
data = {
|
|
78
|
+
displayName: 'Org Unit 3',
|
|
79
|
+
id: 'A0000000002',
|
|
80
|
+
path: '/A0000000000/A0000000002',
|
|
81
|
+
children: [],
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (id === 'A0000000003') {
|
|
86
|
+
data = {
|
|
87
|
+
displayName: 'Org Unit 4',
|
|
88
|
+
id: 'A0000000003',
|
|
89
|
+
path: '/A0000000000/A0000000001/A0000000003',
|
|
90
|
+
children: [
|
|
91
|
+
{
|
|
92
|
+
id: 'A0000000007',
|
|
93
|
+
path: '/A0000000000/A0000000001/A0000000003/A0000000007',
|
|
94
|
+
children: [],
|
|
95
|
+
displayName: 'Org Unit 8',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (id === 'A0000000004') {
|
|
102
|
+
data = {
|
|
103
|
+
displayName: 'Org Unit 5',
|
|
104
|
+
id: 'A0000000004',
|
|
105
|
+
path: '/A0000000000/A0000000001/A0000000004',
|
|
106
|
+
children: [],
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (id === 'A0000000006') {
|
|
111
|
+
data = {
|
|
112
|
+
displayName: 'Org Unit 7',
|
|
113
|
+
id: 'A0000000006',
|
|
114
|
+
path: '/A0000000000/A0000000006',
|
|
115
|
+
children: [],
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (id === 'A0000000007') {
|
|
120
|
+
data = {
|
|
121
|
+
displayName: 'Org Unit 8',
|
|
122
|
+
id: 'A0000000007',
|
|
123
|
+
path: '/A0000000000/A0000000001/A0000000003/A0000000007',
|
|
124
|
+
children: [],
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return data
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const dataProviderData = {
|
|
132
|
+
organisationUnits: (_, { id }) => {
|
|
133
|
+
const data = getOrganisationUnitData(id)
|
|
134
|
+
|
|
135
|
+
if (!data) {
|
|
136
|
+
return Promise.reject(new Error('404 - Org unit not found'))
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return Promise.resolve(data)
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const createDecoratorCustomDataProvider = (args) => {
|
|
144
|
+
const data = args?.data || dataProviderData
|
|
145
|
+
|
|
146
|
+
return (Story) => {
|
|
147
|
+
window.dataProviderData = data
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<CustomDataProvider data={data}>
|
|
151
|
+
<Story />
|
|
152
|
+
</CustomDataProvider>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const createStatefulDecorator = (args) => {
|
|
158
|
+
return (fn) => {
|
|
159
|
+
const [workflow, setWorkflow] = useState(args?.workflow || null)
|
|
160
|
+
const [workflowOpen, setWorkflowOpen] = useState(
|
|
161
|
+
args?.workflowOpen || false
|
|
162
|
+
)
|
|
163
|
+
const [dataSet, setDataSet] = useState(args?.dataSet || null)
|
|
164
|
+
const [dataSetOpen, setDataSetOpen] = useState(
|
|
165
|
+
args?.dataSetOpen || false
|
|
166
|
+
)
|
|
167
|
+
const [orgUnit, setOrgUnit] = useState(args?.orgUnit || null)
|
|
168
|
+
const [orgUnitOpen, setOrgUnitOpen] = useState(
|
|
169
|
+
args?.orgUnitOpen || false
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<>
|
|
174
|
+
{fn({
|
|
175
|
+
workflow,
|
|
176
|
+
setWorkflow,
|
|
177
|
+
workflowOpen,
|
|
178
|
+
setWorkflowOpen,
|
|
179
|
+
dataSet,
|
|
180
|
+
setDataSet,
|
|
181
|
+
dataSetOpen,
|
|
182
|
+
setDataSetOpen,
|
|
183
|
+
orgUnit,
|
|
184
|
+
setOrgUnit,
|
|
185
|
+
orgUnitOpen,
|
|
186
|
+
setOrgUnitOpen,
|
|
187
|
+
})}
|
|
188
|
+
</>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const workflows = [
|
|
194
|
+
{ value: 'm<4y', label: 'Mortality < 4 years' },
|
|
195
|
+
{ value: 'm<5y', label: 'Mortality < 5 years' },
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
export const dataSets = [
|
|
199
|
+
{ value: 'data-set-1', label: 'Data set 1' },
|
|
200
|
+
{ value: 'data-set-2', label: 'Data set 2' },
|
|
201
|
+
{ value: 'data-set-3', label: 'Data set 3' },
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
export const MenuSelect = ({ values, selected, onChange }) => {
|
|
205
|
+
return (
|
|
206
|
+
<div style={{ width: 400 }}>
|
|
207
|
+
<Menu>
|
|
208
|
+
{values.map(({ value, label }) => (
|
|
209
|
+
<MenuItem
|
|
210
|
+
key={value}
|
|
211
|
+
label={label}
|
|
212
|
+
active={selected === value}
|
|
213
|
+
onClick={() => onChange({ selected: value })}
|
|
214
|
+
/>
|
|
215
|
+
))}
|
|
216
|
+
</Menu>
|
|
217
|
+
</div>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const OrgUnitSelect = ({ onChange, selected }) => {
|
|
222
|
+
return (
|
|
223
|
+
<div style={{ width: 400, minHeight: 400, maxHeight: '70vh' }}>
|
|
224
|
+
<OrganisationUnitTree
|
|
225
|
+
singleSelection
|
|
226
|
+
onChange={onChange}
|
|
227
|
+
roots={['A0000000000']}
|
|
228
|
+
selected={selected}
|
|
229
|
+
/>
|
|
230
|
+
</div>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { OrganisationUnitTree } from '@dhis2-ui/organisation-unit-tree'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import { SelectorBar, SelectorBarItem } from '../../index.js'
|
|
4
|
+
import {
|
|
5
|
+
createStatefulDecorator,
|
|
6
|
+
decoratorCommonStyles,
|
|
7
|
+
createDecoratorCustomDataProvider,
|
|
8
|
+
} from './common.js'
|
|
9
|
+
|
|
10
|
+
export const KeepOrgUnitExpanded = (
|
|
11
|
+
_,
|
|
12
|
+
{ orgUnit, setOrgUnit, orgUnitOpen, setOrgUnitOpen }
|
|
13
|
+
) => {
|
|
14
|
+
const [expanded, setExpanded] = useState([])
|
|
15
|
+
const handleExpand = ({ path }) => setExpanded([...expanded, path])
|
|
16
|
+
const handleCollapse = ({ path }) =>
|
|
17
|
+
setExpanded(expanded.filter((p) => p !== path))
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<SelectorBar
|
|
22
|
+
disableClearSelections={!orgUnit}
|
|
23
|
+
onClearSelectionClick={() => setOrgUnit(null)}
|
|
24
|
+
>
|
|
25
|
+
<SelectorBarItem
|
|
26
|
+
label="Org unit"
|
|
27
|
+
value={orgUnit?.displayName}
|
|
28
|
+
noValueMessage="Choose an organisation unit"
|
|
29
|
+
open={orgUnitOpen}
|
|
30
|
+
setOpen={setOrgUnitOpen}
|
|
31
|
+
onClearSelectionClick={() => {
|
|
32
|
+
setOrgUnit(null)
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
style={{
|
|
37
|
+
width: 400,
|
|
38
|
+
minHeight: 400,
|
|
39
|
+
maxHeight: '70vh',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<OrganisationUnitTree
|
|
43
|
+
singleSelection
|
|
44
|
+
roots={['A0000000000']}
|
|
45
|
+
selected={orgUnit ? [orgUnit.path] : []}
|
|
46
|
+
onChange={(nextOrgUnit, evt) => {
|
|
47
|
+
evt.stopPropagation()
|
|
48
|
+
setOrgUnit(nextOrgUnit)
|
|
49
|
+
setOrgUnitOpen(false)
|
|
50
|
+
}}
|
|
51
|
+
expanded={expanded}
|
|
52
|
+
handleExpand={handleExpand}
|
|
53
|
+
handleCollapse={handleCollapse}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</SelectorBarItem>
|
|
57
|
+
</SelectorBar>
|
|
58
|
+
|
|
59
|
+
<p style={{ padding: '0 16px' }}>
|
|
60
|
+
This story illustrates how to keep states between mount/unmount
|
|
61
|
+
cycles of the component rendered inside the selector bar icon
|
|
62
|
+
</p>
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
KeepOrgUnitExpanded.decorators = [
|
|
68
|
+
decoratorCommonStyles,
|
|
69
|
+
createStatefulDecorator(),
|
|
70
|
+
createDecoratorCustomDataProvider(),
|
|
71
|
+
]
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Button } from '@dhis2-ui/button'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { SelectorBar, SelectorBarItem } from '../../index.js'
|
|
4
|
+
import {
|
|
5
|
+
OrgUnitSelect,
|
|
6
|
+
MenuSelect,
|
|
7
|
+
createDecoratorCustomDataProvider,
|
|
8
|
+
createStatefulDecorator,
|
|
9
|
+
decoratorCommonStyles,
|
|
10
|
+
workflows,
|
|
11
|
+
} from './common.js'
|
|
12
|
+
|
|
13
|
+
const RHSContent = () => (
|
|
14
|
+
<div className="rhs-content">
|
|
15
|
+
<Button small>Options</Button>
|
|
16
|
+
<style jsx>{`
|
|
17
|
+
.rhs-content {
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 40px;
|
|
20
|
+
padding: 0 16px;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
`}</style>
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
export const RTL = (
|
|
28
|
+
_,
|
|
29
|
+
{
|
|
30
|
+
workflow,
|
|
31
|
+
setWorkflow,
|
|
32
|
+
workflowOpen,
|
|
33
|
+
setWorkflowOpen,
|
|
34
|
+
orgUnit,
|
|
35
|
+
setOrgUnit,
|
|
36
|
+
orgUnitOpen,
|
|
37
|
+
setOrgUnitOpen,
|
|
38
|
+
}
|
|
39
|
+
) => {
|
|
40
|
+
return (
|
|
41
|
+
<div dir="rtl">
|
|
42
|
+
<SelectorBar
|
|
43
|
+
disableClearSelections={!workflow || !orgUnit}
|
|
44
|
+
onClearSelectionClick={() => {
|
|
45
|
+
setWorkflow(null)
|
|
46
|
+
setOrgUnit(null)
|
|
47
|
+
}}
|
|
48
|
+
additionalContent={<RHSContent />}
|
|
49
|
+
>
|
|
50
|
+
<SelectorBarItem
|
|
51
|
+
disabled={false}
|
|
52
|
+
label="Workflow"
|
|
53
|
+
value={workflow?.label}
|
|
54
|
+
noValueMessage="Choose a workflow"
|
|
55
|
+
open={workflowOpen}
|
|
56
|
+
setOpen={setWorkflowOpen}
|
|
57
|
+
onClearSelectionClick={() => {
|
|
58
|
+
setWorkflow(null)
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<MenuSelect
|
|
62
|
+
values={workflows}
|
|
63
|
+
selected={workflow?.value}
|
|
64
|
+
onChange={({ selected }) => {
|
|
65
|
+
setWorkflow(
|
|
66
|
+
workflows.find(
|
|
67
|
+
(currentWorkflow) =>
|
|
68
|
+
selected === currentWorkflow.value
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
setWorkflowOpen(false)
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
</SelectorBarItem>
|
|
75
|
+
|
|
76
|
+
<SelectorBarItem
|
|
77
|
+
disabled={!workflow}
|
|
78
|
+
label="Org unit"
|
|
79
|
+
value={orgUnit?.displayName}
|
|
80
|
+
noValueMessage="Choose an organisation unit"
|
|
81
|
+
open={orgUnitOpen}
|
|
82
|
+
setOpen={setOrgUnitOpen}
|
|
83
|
+
onClearSelectionClick={() => {
|
|
84
|
+
setOrgUnit(null)
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<OrgUnitSelect
|
|
88
|
+
selected={orgUnit ? [orgUnit.path] : []}
|
|
89
|
+
onChange={(nextOrgUnit, evt) => {
|
|
90
|
+
evt.stopPropagation()
|
|
91
|
+
setOrgUnit(nextOrgUnit)
|
|
92
|
+
setOrgUnitOpen(false)
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
</SelectorBarItem>
|
|
96
|
+
</SelectorBar>
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
RTL.decorators = [
|
|
102
|
+
decoratorCommonStyles,
|
|
103
|
+
createStatefulDecorator(),
|
|
104
|
+
createDecoratorCustomDataProvider(),
|
|
105
|
+
]
|