@dhis2-ui/transfer 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/__e2e__/add_remove-highlighted-options.stories.e2e.js +30 -21
- package/build/cjs/__e2e__/common/stateful-decorator.js +26 -19
- package/build/cjs/__e2e__/disabled-transfer-buttons.stories.e2e.js +70 -49
- package/build/cjs/__e2e__/disabled-transfer-options.stories.e2e.js +14 -11
- package/build/cjs/__e2e__/display-order.stories.e2e.js +29 -20
- package/build/cjs/__e2e__/filter-options-list.stories.e2e.js +97 -73
- package/build/cjs/__e2e__/highlight-range-of-options.stories.e2e.js +49 -34
- package/build/cjs/__e2e__/loading_lists.stories.e2e.js +1 -1
- package/build/cjs/__e2e__/notify_at_end_of_list.stories.e2e.js +61 -43
- package/build/cjs/__e2e__/reorder-with-buttons.stories.e2e.js +19 -13
- package/build/cjs/__e2e__/set_unset-highlighted-option.stories.e2e.js +30 -21
- package/build/cjs/__e2e__/transferring-items.stories.e2e.js +29 -20
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-add.test.js +6 -3
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-range.test.js +48 -24
- package/build/cjs/__tests__/transfer.test.js +18 -10
- package/build/cjs/actions.js +13 -10
- package/build/cjs/add-all.js +17 -14
- package/build/cjs/add-individual.js +16 -13
- package/build/cjs/common/get-mode-by-modifier-key.js +7 -6
- package/build/cjs/common/modes.js +1 -1
- package/build/cjs/container.js +15 -12
- package/build/cjs/end-intersection-detector.js +21 -15
- package/build/cjs/features/disabled-transfer-options/index.js +4 -2
- package/build/cjs/features/display-order/index.js +47 -26
- package/build/cjs/features/filter-options-list/index.js +6 -3
- package/build/cjs/features/highlight-range-of-options/index.js +10 -5
- package/build/cjs/features/loading_lists/index.js +2 -2
- package/build/cjs/features/notify_at_end_of_list/index.js +5 -3
- package/build/cjs/features/set_unset-highlighted-option/index.js +6 -3
- package/build/cjs/features/transferring-items/index.js +77 -42
- package/build/cjs/filter.js +26 -23
- package/build/cjs/icons.js +134 -116
- package/build/cjs/left-footer.js +13 -10
- package/build/cjs/left-header.js +13 -10
- package/build/cjs/left-side.js +19 -16
- package/build/cjs/options-container.js +17 -16
- package/build/cjs/picked-options.js +22 -19
- package/build/cjs/remove-all.js +16 -13
- package/build/cjs/remove-individual.js +16 -13
- package/build/cjs/reordering-actions.js +34 -31
- package/build/cjs/right-footer.js +13 -10
- package/build/cjs/right-header.js +13 -10
- package/build/cjs/right-side.js +19 -16
- package/build/cjs/source-options.js +22 -19
- package/build/cjs/transfer/add-all-selectable-source-options.js +13 -9
- package/build/cjs/transfer/add-individual-source-options.js +11 -9
- package/build/cjs/transfer/create-double-click-handlers.js +17 -13
- package/build/cjs/transfer/default-filter-callback.js +6 -3
- package/build/cjs/transfer/is-reorder-down-disabled.js +10 -6
- package/build/cjs/transfer/is-reorder-up-disabled.js +10 -6
- package/build/cjs/transfer/move-highlighted-picked-option-down.js +6 -5
- package/build/cjs/transfer/move-highlighted-picked-option-up.js +6 -5
- package/build/cjs/transfer/remove-all-picked-options.js +5 -4
- package/build/cjs/transfer/remove-individual-picked-options.js +10 -8
- package/build/cjs/transfer/use-filter.js +8 -7
- package/build/cjs/transfer/use-highlighted-options/create-toggle-highlighted-option.js +45 -40
- package/build/cjs/transfer/use-highlighted-options/toggle-add.js +7 -6
- package/build/cjs/transfer/use-highlighted-options/toggle-range.js +16 -11
- package/build/cjs/transfer/use-highlighted-options/toggle-replace.js +7 -5
- package/build/cjs/transfer/use-highlighted-options.js +7 -5
- package/build/cjs/transfer-option.js +12 -11
- package/build/cjs/transfer.js +86 -72
- package/build/cjs/transfer.stories.js +127 -131
- package/build/es/__e2e__/add_remove-highlighted-options.stories.e2e.js +29 -20
- package/build/es/__e2e__/common/stateful-decorator.js +26 -19
- package/build/es/__e2e__/disabled-transfer-buttons.stories.e2e.js +69 -48
- package/build/es/__e2e__/disabled-transfer-options.stories.e2e.js +13 -10
- package/build/es/__e2e__/display-order.stories.e2e.js +28 -19
- package/build/es/__e2e__/filter-options-list.stories.e2e.js +96 -72
- package/build/es/__e2e__/highlight-range-of-options.stories.e2e.js +48 -33
- package/build/es/__e2e__/notify_at_end_of_list.stories.e2e.js +60 -42
- package/build/es/__e2e__/reorder-with-buttons.stories.e2e.js +18 -12
- package/build/es/__e2e__/set_unset-highlighted-option.stories.e2e.js +29 -20
- package/build/es/__e2e__/transferring-items.stories.e2e.js +28 -19
- package/build/es/__tests__/helper/use-highlighted-option/toggle-add.test.js +6 -3
- package/build/es/__tests__/helper/use-highlighted-option/toggle-range.test.js +48 -24
- package/build/es/__tests__/transfer.test.js +18 -10
- package/build/es/actions.js +13 -10
- package/build/es/add-all.js +17 -14
- package/build/es/add-individual.js +16 -13
- package/build/es/common/get-mode-by-modifier-key.js +7 -6
- package/build/es/container.js +15 -12
- package/build/es/end-intersection-detector.js +21 -15
- package/build/es/features/disabled-transfer-options/index.js +4 -2
- package/build/es/features/display-order/index.js +47 -26
- package/build/es/features/filter-options-list/index.js +6 -3
- package/build/es/features/highlight-range-of-options/index.js +10 -5
- package/build/es/features/loading_lists/index.js +2 -2
- package/build/es/features/notify_at_end_of_list/index.js +5 -3
- package/build/es/features/set_unset-highlighted-option/index.js +6 -3
- package/build/es/features/transferring-items/index.js +77 -42
- package/build/es/filter.js +26 -23
- package/build/es/icons.js +133 -115
- package/build/es/left-footer.js +13 -10
- package/build/es/left-header.js +13 -10
- package/build/es/left-side.js +19 -16
- package/build/es/options-container.js +17 -16
- package/build/es/picked-options.js +22 -19
- package/build/es/remove-all.js +16 -13
- package/build/es/remove-individual.js +16 -13
- package/build/es/reordering-actions.js +34 -31
- package/build/es/right-footer.js +13 -10
- package/build/es/right-header.js +13 -10
- package/build/es/right-side.js +19 -16
- package/build/es/source-options.js +22 -19
- package/build/es/transfer/add-all-selectable-source-options.js +13 -9
- package/build/es/transfer/add-individual-source-options.js +11 -9
- package/build/es/transfer/create-double-click-handlers.js +17 -13
- package/build/es/transfer/default-filter-callback.js +6 -3
- package/build/es/transfer/is-reorder-down-disabled.js +10 -6
- package/build/es/transfer/is-reorder-up-disabled.js +10 -6
- package/build/es/transfer/move-highlighted-picked-option-down.js +6 -5
- package/build/es/transfer/move-highlighted-picked-option-up.js +6 -5
- package/build/es/transfer/remove-all-picked-options.js +5 -4
- package/build/es/transfer/remove-individual-picked-options.js +10 -8
- package/build/es/transfer/use-filter.js +8 -7
- package/build/es/transfer/use-highlighted-options/create-toggle-highlighted-option.js +45 -40
- package/build/es/transfer/use-highlighted-options/toggle-add.js +7 -6
- package/build/es/transfer/use-highlighted-options/toggle-range.js +16 -11
- package/build/es/transfer/use-highlighted-options/toggle-replace.js +7 -5
- package/build/es/transfer/use-highlighted-options.js +7 -5
- package/build/es/transfer-option.js +12 -11
- package/build/es/transfer.js +86 -72
- package/build/es/transfer.stories.js +126 -130
- package/package.json +7 -7
package/build/es/left-header.js
CHANGED
|
@@ -3,16 +3,19 @@ import { spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { borderColor } from './common/index.js';
|
|
6
|
-
export const LeftHeader =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
export const LeftHeader = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
dataTest
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
"data-test": dataTest,
|
|
13
|
+
className: _JSXStyle.dynamic([["2175954399", [borderColor, spacers.dp8]]])
|
|
14
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
|
+
id: "2175954399",
|
|
16
|
+
dynamic: [borderColor, spacers.dp8]
|
|
17
|
+
}, ["div.__jsx-style-dynamic-selector{border-bottom:1px solid ".concat(borderColor, ";-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;padding:0 ").concat(spacers.dp8, ";}")]));
|
|
18
|
+
};
|
|
16
19
|
LeftHeader.propTypes = {
|
|
17
20
|
children: PropTypes.node,
|
|
18
21
|
dataTest: PropTypes.string
|
package/build/es/left-side.js
CHANGED
|
@@ -2,22 +2,25 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { backgroundColor, borderColor, borderRadius } from './common/index.js';
|
|
5
|
-
export const LeftSide =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export const LeftSide = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
dataTest,
|
|
9
|
+
width
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
"data-test": dataTest,
|
|
13
|
+
className: _JSXStyle.dynamic([["4143353612", [backgroundColor, borderRadius, borderColor, width]]])
|
|
14
|
+
}, children,
|
|
15
|
+
/**
|
|
16
|
+
* Flex basis 0px to make sure right and left side
|
|
17
|
+
* always have the same width
|
|
18
|
+
*/
|
|
19
|
+
'', /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
|
+
id: "4143353612",
|
|
21
|
+
dynamic: [backgroundColor, borderRadius, borderColor, width]
|
|
22
|
+
}, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;background-color:".concat(backgroundColor, ";border-radius:").concat(borderRadius, ";border:1px solid ").concat(borderColor, ";min-height:240px;max-width:100%;width:").concat(width, ";}")]));
|
|
23
|
+
};
|
|
21
24
|
LeftSide.propTypes = {
|
|
22
25
|
width: PropTypes.string.isRequired,
|
|
23
26
|
children: PropTypes.node,
|
|
@@ -5,19 +5,20 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import React, { Fragment, useRef } from 'react';
|
|
6
6
|
import { EndIntersectionDetector } from './end-intersection-detector.js';
|
|
7
7
|
import { useResizeCounter } from './use-resize-counter.js';
|
|
8
|
-
export const OptionsContainer =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
export const OptionsContainer = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
dataTest,
|
|
11
|
+
emptyComponent,
|
|
12
|
+
onEndReached,
|
|
13
|
+
getOptionClickHandlers,
|
|
14
|
+
highlightedOptions,
|
|
15
|
+
loading,
|
|
16
|
+
renderOption,
|
|
17
|
+
options,
|
|
18
|
+
selected,
|
|
19
|
+
selectionHandler,
|
|
20
|
+
toggleHighlightedOption
|
|
21
|
+
} = _ref;
|
|
21
22
|
const optionsRef = useRef(null);
|
|
22
23
|
const wrapperRef = useRef(null);
|
|
23
24
|
const resizeCounter = useResizeCounter(wrapperRef.current);
|
|
@@ -42,14 +43,14 @@ export const OptionsContainer = ({
|
|
|
42
43
|
selected
|
|
43
44
|
}));
|
|
44
45
|
}), onEndReached && /*#__PURE__*/React.createElement(EndIntersectionDetector, {
|
|
45
|
-
dataTest:
|
|
46
|
-
key:
|
|
46
|
+
dataTest: "".concat(dataTest, "-endintersectiondetector"),
|
|
47
|
+
key: "key-".concat(resizeCounter),
|
|
47
48
|
rootRef: optionsRef,
|
|
48
49
|
onEndReached: onEndReached
|
|
49
50
|
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
50
51
|
id: "889751462",
|
|
51
52
|
dynamic: [spacers.dp4]
|
|
52
|
-
}, [
|
|
53
|
+
}, [".optionsContainer.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:".concat(spacers.dp4, " 0;position:relative;overflow:hidden;}"), ".container.__jsx-style-dynamic-selector{overflow-y:auto;height:100%;}", ".loading.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;width:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;position:absolute;z-index:2;top:0;left:0;}", ".content-container.__jsx-style-dynamic-selector{z-index:1;position:relative;}", ".loading.__jsx-style-dynamic-selector+.container.__jsx-style-dynamic-selector .content-container.__jsx-style-dynamic-selector{-webkit-filter:blur(2px);filter:blur(2px);}"]));
|
|
53
54
|
};
|
|
54
55
|
OptionsContainer.defaultProps = {
|
|
55
56
|
selected: false
|
|
@@ -3,25 +3,28 @@ import { spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { EndIntersectionDetector } from './end-intersection-detector.js';
|
|
6
|
-
export const PickedOptions =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
export const PickedOptions = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
dataTest,
|
|
10
|
+
selectedEmptyComponent,
|
|
11
|
+
pickedOptionsRef,
|
|
12
|
+
onPickedEndReached
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
"data-test": dataTest,
|
|
16
|
+
ref: pickedOptionsRef,
|
|
17
|
+
className: _JSXStyle.dynamic([["392419471", [spacers.dp4]]]) + " " + "container"
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: _JSXStyle.dynamic([["392419471", [spacers.dp4]]]) + " " + "content-container"
|
|
20
|
+
}, !React.Children.count(children) && selectedEmptyComponent, children, onPickedEndReached && /*#__PURE__*/React.createElement(EndIntersectionDetector, {
|
|
21
|
+
rootRef: pickedOptionsRef,
|
|
22
|
+
onEndReached: onPickedEndReached
|
|
23
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
|
+
id: "392419471",
|
|
25
|
+
dynamic: [spacers.dp4]
|
|
26
|
+
}, [".container.__jsx-style-dynamic-selector{padding:".concat(spacers.dp4, " 0;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;overflow-y:auto;}"), ".content-container.__jsx-style-dynamic-selector{position:relative;}"]));
|
|
27
|
+
};
|
|
25
28
|
PickedOptions.propTypes = {
|
|
26
29
|
children: PropTypes.node.isRequired,
|
|
27
30
|
dataTest: PropTypes.string.isRequired,
|
package/build/es/remove-all.js
CHANGED
|
@@ -2,20 +2,23 @@ import { Button } from '@dhis2-ui/button';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { IconRemoveAll } from './icons.js';
|
|
5
|
-
export const RemoveAll =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
icon: /*#__PURE__*/React.createElement(IconRemoveAll, {
|
|
5
|
+
export const RemoveAll = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
label,
|
|
8
|
+
dataTest,
|
|
9
|
+
disabled,
|
|
10
|
+
onClick
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
13
|
+
dataTest: dataTest,
|
|
15
14
|
disabled: disabled,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
onClick: onClick,
|
|
16
|
+
icon: /*#__PURE__*/React.createElement(IconRemoveAll, {
|
|
17
|
+
disabled: disabled,
|
|
18
|
+
dataTest: "".concat(dataTest, "-iconremoveall")
|
|
19
|
+
})
|
|
20
|
+
}, label);
|
|
21
|
+
};
|
|
19
22
|
RemoveAll.propTypes = {
|
|
20
23
|
dataTest: PropTypes.string.isRequired,
|
|
21
24
|
onClick: PropTypes.func.isRequired,
|
|
@@ -2,20 +2,23 @@ import { Button } from '@dhis2-ui/button';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { IconRemoveIndividual } from './icons.js';
|
|
5
|
-
export const RemoveIndividual =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
icon: /*#__PURE__*/React.createElement(IconRemoveIndividual, {
|
|
5
|
+
export const RemoveIndividual = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
label,
|
|
8
|
+
dataTest,
|
|
9
|
+
disabled,
|
|
10
|
+
onClick
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
13
|
+
dataTest: dataTest,
|
|
15
14
|
disabled: disabled,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
onClick: onClick,
|
|
16
|
+
icon: /*#__PURE__*/React.createElement(IconRemoveIndividual, {
|
|
17
|
+
disabled: disabled,
|
|
18
|
+
dataTest: "".concat(dataTest, "-iconremoveindividual")
|
|
19
|
+
})
|
|
20
|
+
}, label);
|
|
21
|
+
};
|
|
19
22
|
RemoveIndividual.propTypes = {
|
|
20
23
|
dataTest: PropTypes.string.isRequired,
|
|
21
24
|
onClick: PropTypes.func.isRequired,
|
|
@@ -4,37 +4,40 @@ import { spacers } from '@dhis2/ui-constants';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { IconMoveDown, IconMoveUp } from './icons.js';
|
|
7
|
-
export const ReorderingActions =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
dataTest:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
dataTest:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
export const ReorderingActions = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
dataTest,
|
|
10
|
+
disabledDown,
|
|
11
|
+
disabledUp,
|
|
12
|
+
onChangeUp,
|
|
13
|
+
onChangeDown
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
"data-test": dataTest,
|
|
17
|
+
className: _JSXStyle.dynamic([["1295471940", [spacers.dp8, spacers.dp8, spacers.dp8]]])
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
19
|
+
small: true,
|
|
20
|
+
disabled: disabledDown,
|
|
21
|
+
onClick: () => !disabledDown && onChangeDown(event),
|
|
22
|
+
dataTest: "".concat(dataTest, "-buttonmovedown"),
|
|
23
|
+
icon: /*#__PURE__*/React.createElement(IconMoveDown, {
|
|
24
|
+
dataTest: "".concat(dataTest, "-iconmovedown"),
|
|
25
|
+
disabled: disabledDown
|
|
26
|
+
})
|
|
27
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
small: true,
|
|
29
|
+
disabled: disabledUp,
|
|
30
|
+
onClick: () => !disabledUp && onChangeUp(event),
|
|
31
|
+
dataTest: "".concat(dataTest, "-buttonmoveup"),
|
|
32
|
+
icon: /*#__PURE__*/React.createElement(IconMoveUp, {
|
|
33
|
+
dataTest: "".concat(dataTest, "-iconmoveup"),
|
|
34
|
+
disabled: disabledUp
|
|
35
|
+
})
|
|
36
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
37
|
+
id: "1295471940",
|
|
38
|
+
dynamic: [spacers.dp8, spacers.dp8, spacers.dp8]
|
|
39
|
+
}, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;padding-top:".concat(spacers.dp8, ";}"), "div.__jsx-style-dynamic-selector:last-child{padding-bottom:".concat(spacers.dp8, ";}"), "div.__jsx-style-dynamic-selector>button:first-child{margin-left:".concat(spacers.dp8, ";}")]));
|
|
40
|
+
};
|
|
38
41
|
ReorderingActions.propTypes = {
|
|
39
42
|
dataTest: PropTypes.string.isRequired,
|
|
40
43
|
onChangeDown: PropTypes.func.isRequired,
|
package/build/es/right-footer.js
CHANGED
|
@@ -3,16 +3,19 @@ import { spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { borderColor } from './common/index.js';
|
|
6
|
-
export const RightFooter =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
export const RightFooter = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
dataTest
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
"data-test": dataTest,
|
|
13
|
+
className: _JSXStyle.dynamic([["3629116366", [borderColor, spacers.dp8]]])
|
|
14
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
|
+
id: "3629116366",
|
|
16
|
+
dynamic: [borderColor, spacers.dp8]
|
|
17
|
+
}, ["div.__jsx-style-dynamic-selector{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;border-top:1px solid ".concat(borderColor, ";padding:0 ").concat(spacers.dp8, ";}")]));
|
|
18
|
+
};
|
|
16
19
|
RightFooter.propTypes = {
|
|
17
20
|
children: PropTypes.node,
|
|
18
21
|
dataTest: PropTypes.string
|
package/build/es/right-header.js
CHANGED
|
@@ -3,16 +3,19 @@ import { spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { borderColor } from './common/index.js';
|
|
6
|
-
export const RightHeader =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
export const RightHeader = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
dataTest
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
"data-test": dataTest,
|
|
13
|
+
className: _JSXStyle.dynamic([["2175954399", [borderColor, spacers.dp8]]])
|
|
14
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
|
+
id: "2175954399",
|
|
16
|
+
dynamic: [borderColor, spacers.dp8]
|
|
17
|
+
}, ["div.__jsx-style-dynamic-selector{border-bottom:1px solid ".concat(borderColor, ";-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;padding:0 ").concat(spacers.dp8, ";}")]));
|
|
18
|
+
};
|
|
16
19
|
RightHeader.propTypes = {
|
|
17
20
|
children: PropTypes.node,
|
|
18
21
|
dataTest: PropTypes.string
|
package/build/es/right-side.js
CHANGED
|
@@ -2,22 +2,25 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { backgroundColor, borderColor, borderRadius } from './common/index.js';
|
|
5
|
-
export const RightSide =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export const RightSide = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
dataTest,
|
|
9
|
+
width
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
"data-test": dataTest,
|
|
13
|
+
className: _JSXStyle.dynamic([["1391448013", [backgroundColor, borderColor, borderRadius, width]]])
|
|
14
|
+
}, children,
|
|
15
|
+
/**
|
|
16
|
+
* Flex basis 0px to make sure right and left side
|
|
17
|
+
* always have the same width
|
|
18
|
+
*/
|
|
19
|
+
'', /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
|
+
id: "1391448013",
|
|
21
|
+
dynamic: [backgroundColor, borderColor, borderRadius, width]
|
|
22
|
+
}, ["div.__jsx-style-dynamic-selector{background-color:".concat(backgroundColor, ";border:1px solid ").concat(borderColor, ";border-radius:").concat(borderRadius, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;max-width:100%;width:").concat(width, ";}")]));
|
|
23
|
+
};
|
|
21
24
|
RightSide.propTypes = {
|
|
22
25
|
width: PropTypes.string.isRequired,
|
|
23
26
|
children: PropTypes.node,
|
|
@@ -3,25 +3,28 @@ import { spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { EndIntersectionDetector } from './end-intersection-detector.js';
|
|
6
|
-
export const SourceOptions =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
export const SourceOptions = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
dataTest,
|
|
10
|
+
sourceEmptyPlaceholder,
|
|
11
|
+
sourceOptionsRef,
|
|
12
|
+
onSourceEndReached
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
"data-test": dataTest,
|
|
16
|
+
ref: sourceOptionsRef,
|
|
17
|
+
className: _JSXStyle.dynamic([["392419471", [spacers.dp4]]]) + " " + "container"
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: _JSXStyle.dynamic([["392419471", [spacers.dp4]]]) + " " + "content-container"
|
|
20
|
+
}, children, !React.Children.count(children) && sourceEmptyPlaceholder, onSourceEndReached && /*#__PURE__*/React.createElement(EndIntersectionDetector, {
|
|
21
|
+
rootRef: sourceOptionsRef,
|
|
22
|
+
onEndReached: onSourceEndReached
|
|
23
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
|
+
id: "392419471",
|
|
25
|
+
dynamic: [spacers.dp4]
|
|
26
|
+
}, [".container.__jsx-style-dynamic-selector{padding:".concat(spacers.dp4, " 0;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;overflow-y:auto;}"), ".content-container.__jsx-style-dynamic-selector{position:relative;}"]));
|
|
27
|
+
};
|
|
25
28
|
SourceOptions.propTypes = {
|
|
26
29
|
dataTest: PropTypes.string.isRequired,
|
|
27
30
|
children: PropTypes.node,
|
|
@@ -6,15 +6,19 @@
|
|
|
6
6
|
* @param {Function} arg.setHighlightedSourceOptions
|
|
7
7
|
* @returns {void}
|
|
8
8
|
*/
|
|
9
|
-
export const addAllSelectableSourceOptions =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
export const addAllSelectableSourceOptions = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
sourceOptions,
|
|
12
|
+
onChange,
|
|
13
|
+
selected,
|
|
14
|
+
setHighlightedSourceOptions
|
|
15
|
+
} = _ref;
|
|
16
|
+
const enabledSourceOptions = sourceOptions.filter(_ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
disabled
|
|
19
|
+
} = _ref2;
|
|
20
|
+
return !disabled;
|
|
21
|
+
});
|
|
18
22
|
const newSelected = enabledSourceOptions.reduce((accumulatedSelected, enabledSourceOption) => [...accumulatedSelected, enabledSourceOption.value], selected);
|
|
19
23
|
setHighlightedSourceOptions([]); // If we ever allow maxSelection to be any value
|
|
20
24
|
// other than 1 and Infinity, we need to think
|
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
* @param {Function} args.setHighlightedSourceOptions
|
|
9
9
|
* @returns void
|
|
10
10
|
*/
|
|
11
|
-
export const addIndividualSourceOptions =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
export const addIndividualSourceOptions = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
filterable,
|
|
14
|
+
sourceOptions,
|
|
15
|
+
highlightedSourceOptions,
|
|
16
|
+
maxSelections,
|
|
17
|
+
onChange,
|
|
18
|
+
selected,
|
|
19
|
+
setHighlightedSourceOptions
|
|
20
|
+
} = _ref;
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* Creates a subset of the highlighted options to reflect a changed
|
|
22
24
|
* filter value in case previously highlighted options are now
|
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
* @param {Function} args.setHighlightedPickedOptions
|
|
8
8
|
* @returns void
|
|
9
9
|
*/
|
|
10
|
-
export const createDoubleClickHandlers =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
export const createDoubleClickHandlers = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
maxSelections,
|
|
13
|
+
onChange,
|
|
14
|
+
selected,
|
|
15
|
+
setHighlightedPickedOptions,
|
|
16
|
+
setHighlightedSourceOptions
|
|
17
|
+
} = _ref;
|
|
18
|
+
|
|
19
|
+
const selectSingleOption = _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
value
|
|
22
|
+
} = _ref2;
|
|
20
23
|
const newSelected = selected.includes(value) ? selected : [...selected, value];
|
|
21
24
|
setHighlightedSourceOptions([]);
|
|
22
25
|
onChange({
|
|
@@ -24,9 +27,10 @@ export const createDoubleClickHandlers = ({
|
|
|
24
27
|
});
|
|
25
28
|
};
|
|
26
29
|
|
|
27
|
-
const deselectSingleOption =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const deselectSingleOption = _ref3 => {
|
|
31
|
+
let {
|
|
32
|
+
value
|
|
33
|
+
} = _ref3;
|
|
30
34
|
const newSelected = selected.filter(curSelected => curSelected !== value);
|
|
31
35
|
setHighlightedPickedOptions([]);
|
|
32
36
|
onChange({
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* @param {string} filter
|
|
4
4
|
* @returns {Object[]}
|
|
5
5
|
*/
|
|
6
|
-
export const defaultFilterCallback = (options, filter) => filter === '' ? options : options.filter(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export const defaultFilterCallback = (options, filter) => filter === '' ? options : options.filter(_ref => {
|
|
7
|
+
let {
|
|
8
|
+
label
|
|
9
|
+
} = _ref;
|
|
10
|
+
return label.match(new RegExp(filter, 'i'));
|
|
11
|
+
});
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
* @param {string[]} args.selected
|
|
5
5
|
* @returns {bool}
|
|
6
6
|
*/
|
|
7
|
-
export const isReorderDownDisabled =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const isReorderDownDisabled = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
highlightedPickedOptions,
|
|
10
|
+
selected
|
|
11
|
+
} = _ref;
|
|
12
|
+
return (// only one item can be moved with the buttons
|
|
13
|
+
highlightedPickedOptions.length !== 1 || // can't move an item down if it's the last one
|
|
14
|
+
selected.indexOf(highlightedPickedOptions[0]) === selected.length - 1
|
|
15
|
+
);
|
|
16
|
+
};
|