@dhis2-ui/transfer 9.11.0 → 9.11.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/__e2e__/{add_remove-highlighted-options.stories.e2e.js → add_remove-highlighted-options.e2e.stories.js} +2 -13
- package/build/cjs/__e2e__/common/options.js +2 -3
- package/build/cjs/__e2e__/common/stateful-decorator.js +3 -8
- package/build/cjs/__e2e__/{disabled-transfer-buttons.stories.e2e.js → disabled-transfer-buttons.e2e.stories.js} +4 -20
- package/build/cjs/__e2e__/{disabled-transfer-options.stories.e2e.js → disabled-transfer-options.e2e.stories.js} +4 -12
- package/build/cjs/__e2e__/{display-order.stories.e2e.js → display-order.e2e.stories.js} +2 -13
- package/build/cjs/__e2e__/{filter-options-list.stories.e2e.js → filter-options-list.e2e.stories.js} +3 -24
- package/build/cjs/__e2e__/{highlight-range-of-options.stories.e2e.js → highlight-range-of-options.e2e.stories.js} +2 -15
- package/build/cjs/__e2e__/{loading_lists.stories.e2e.js → loading_lists.e2e.stories.js} +2 -16
- package/build/cjs/__e2e__/{notify_at_end_of_list.stories.e2e.js → notify_at_end_of_list.e2e.stories.js} +2 -17
- package/build/cjs/__e2e__/{reorder-with-buttons.stories.e2e.js → reorder-with-buttons.e2e.stories.js} +2 -11
- package/build/cjs/__e2e__/{set_unset-highlighted-option.stories.e2e.js → set_unset-highlighted-option.e2e.stories.js} +2 -13
- package/build/cjs/__e2e__/{transferring-items.stories.e2e.js → transferring-items.e2e.stories.js} +2 -13
- package/build/cjs/__tests__/common.test.js +0 -1
- package/build/cjs/__tests__/helper/add-all-selectable-source-options.test.js +0 -1
- package/build/cjs/__tests__/helper/add-individual-source-options.test.js +0 -1
- package/build/cjs/__tests__/helper/default-filter-callback.test.js +0 -1
- package/build/cjs/__tests__/helper/is-reorder-down-disabled.test.js +0 -1
- package/build/cjs/__tests__/helper/is-reorder-up-disabled.test.js +0 -1
- package/build/cjs/__tests__/helper/move-highlighted-picked-option-down.test.js +0 -1
- package/build/cjs/__tests__/helper/move-highlighted-picked-option-up.test.js +0 -1
- package/build/cjs/__tests__/helper/remove-all-picked-options.test.js +0 -1
- package/build/cjs/__tests__/helper/remove-individual-picked-options.test.js +0 -1
- package/build/cjs/__tests__/helper/use-highlighted-option/create-toggle-highlighted-option.test.js +2 -9
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-add.test.js +0 -1
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-range.test.js +2 -3
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-replace.test.js +0 -1
- package/build/cjs/__tests__/helper/use-highlighted-option.test.js +1 -5
- package/build/cjs/__tests__/transfer.test.js +1 -5
- package/build/cjs/actions.js +2 -9
- package/build/cjs/add-all.js +2 -9
- package/build/cjs/add-individual.js +2 -9
- package/build/cjs/common/find-option-index.js +0 -3
- package/build/cjs/common/get-mode-by-modifier-key.js +2 -8
- package/build/cjs/common/index.js +0 -6
- package/build/cjs/common/is-option.js +0 -2
- package/build/cjs/common/modes.js +6 -9
- package/build/cjs/common/remove-option.js +0 -6
- package/build/cjs/common/styles.js +3 -8
- package/build/cjs/common/toggle-value.js +0 -4
- package/build/cjs/container.js +2 -8
- package/build/cjs/end-intersection-detector.js +1 -8
- package/build/cjs/features/add_remove-highlighted-options/index.js +0 -1
- package/build/cjs/features/common/index.js +0 -2
- package/build/cjs/features/disabled-transfer-buttons/index.js +0 -1
- package/build/cjs/features/disabled-transfer-options/index.js +0 -2
- package/build/cjs/features/display-order/index.js +6 -5
- package/build/cjs/features/filter-options-list/index.js +6 -8
- package/build/cjs/features/highlight-range-of-options/index.js +8 -5
- package/build/cjs/features/loading_lists/index.js +2 -3
- package/build/cjs/features/notify_at_end_of_list/index.js +1 -2
- package/build/cjs/features/reorder-with-buttons/index.js +3 -3
- package/build/cjs/features/set_unset-highlighted-option/index.js +0 -2
- package/build/cjs/features/transferring-items/index.js +6 -6
- package/build/cjs/filter.js +5 -14
- package/build/cjs/icons.js +17 -35
- package/build/cjs/index.js +0 -2
- package/build/cjs/left-footer.js +2 -10
- package/build/cjs/left-header.js +2 -10
- package/build/cjs/left-side.js +2 -9
- package/build/cjs/options-container.js +9 -20
- package/build/cjs/picked-options.js +2 -10
- package/build/cjs/remove-all.js +2 -9
- package/build/cjs/remove-individual.js +2 -9
- package/build/cjs/reordering-actions.js +7 -16
- package/build/cjs/right-footer.js +2 -10
- package/build/cjs/right-header.js +2 -10
- package/build/cjs/right-side.js +2 -9
- package/build/cjs/source-options.js +2 -10
- package/build/cjs/transfer/add-all-selectable-source-options.js +3 -4
- package/build/cjs/transfer/add-individual-source-options.js +1 -4
- package/build/cjs/transfer/create-double-click-handlers.js +0 -5
- package/build/cjs/transfer/default-filter-callback.js +0 -2
- package/build/cjs/transfer/get-option-click-handlers.js +0 -3
- package/build/cjs/transfer/index.js +0 -26
- package/build/cjs/transfer/is-reorder-down-disabled.js +4 -4
- package/build/cjs/transfer/is-reorder-up-disabled.js +4 -4
- package/build/cjs/transfer/move-highlighted-picked-option-down.js +4 -5
- package/build/cjs/transfer/move-highlighted-picked-option-up.js +4 -5
- package/build/cjs/transfer/remove-all-picked-options.js +0 -2
- package/build/cjs/transfer/remove-individual-picked-options.js +1 -4
- package/build/cjs/transfer/use-filter.js +0 -4
- package/build/cjs/transfer/use-highlighted-options/create-toggle-highlighted-option.js +2 -12
- package/build/cjs/transfer/use-highlighted-options/toggle-add.js +0 -3
- package/build/cjs/transfer/use-highlighted-options/toggle-range.js +3 -8
- package/build/cjs/transfer/use-highlighted-options/toggle-replace.js +0 -4
- package/build/cjs/transfer/use-highlighted-options.js +0 -5
- package/build/cjs/transfer-option.js +4 -16
- package/build/cjs/transfer.js +29 -54
- package/build/cjs/{transfer.stories.js → transfer.prod.stories.js} +83 -103
- package/build/cjs/use-resize-counter.js +0 -4
- package/build/es/__e2e__/common/stateful-decorator.js +1 -2
- package/build/es/__e2e__/{disabled-transfer-buttons.stories.e2e.js → disabled-transfer-buttons.e2e.stories.js} +2 -1
- package/build/es/__e2e__/{disabled-transfer-options.stories.e2e.js → disabled-transfer-options.e2e.stories.js} +2 -1
- package/build/es/__e2e__/{filter-options-list.stories.e2e.js → filter-options-list.e2e.stories.js} +1 -3
- package/build/es/__tests__/helper/use-highlighted-option/create-toggle-highlighted-option.test.js +2 -1
- package/build/es/__tests__/helper/use-highlighted-option/toggle-range.test.js +2 -2
- package/build/es/__tests__/helper/use-highlighted-option.test.js +1 -1
- package/build/es/actions.js +1 -1
- package/build/es/add-all.js +1 -1
- package/build/es/add-individual.js +1 -1
- package/build/es/common/find-option-index.js +1 -1
- package/build/es/common/get-mode-by-modifier-key.js +3 -6
- package/build/es/common/modes.js +5 -4
- package/build/es/common/remove-option.js +1 -4
- package/build/es/common/toggle-value.js +0 -2
- package/build/es/container.js +1 -1
- package/build/es/features/display-order/index.js +6 -3
- package/build/es/features/filter-options-list/index.js +6 -6
- package/build/es/features/highlight-range-of-options/index.js +8 -3
- package/build/es/features/loading_lists/index.js +2 -2
- package/build/es/features/notify_at_end_of_list/index.js +1 -1
- package/build/es/features/reorder-with-buttons/index.js +3 -2
- package/build/es/features/transferring-items/index.js +6 -3
- package/build/es/filter.js +4 -4
- package/build/es/icons.js +16 -16
- package/build/es/left-footer.js +1 -1
- package/build/es/left-header.js +1 -1
- package/build/es/left-side.js +1 -1
- package/build/es/options-container.js +6 -5
- package/build/es/picked-options.js +1 -1
- package/build/es/remove-all.js +1 -1
- package/build/es/remove-individual.js +1 -1
- package/build/es/reordering-actions.js +6 -6
- package/build/es/right-footer.js +1 -1
- package/build/es/right-header.js +1 -1
- package/build/es/right-side.js +1 -1
- package/build/es/source-options.js +1 -1
- package/build/es/transfer/add-all-selectable-source-options.js +3 -2
- package/build/es/transfer/add-individual-source-options.js +1 -2
- package/build/es/transfer/create-double-click-handlers.js +0 -3
- package/build/es/transfer/get-option-click-handlers.js +1 -1
- package/build/es/transfer/is-reorder-down-disabled.js +4 -2
- package/build/es/transfer/is-reorder-up-disabled.js +4 -2
- package/build/es/transfer/move-highlighted-picked-option-down.js +4 -3
- package/build/es/transfer/move-highlighted-picked-option-up.js +4 -3
- package/build/es/transfer/remove-individual-picked-options.js +1 -2
- package/build/es/transfer/use-filter.js +0 -2
- package/build/es/transfer/use-highlighted-options/create-toggle-highlighted-option.js +3 -7
- package/build/es/transfer/use-highlighted-options/toggle-add.js +1 -1
- package/build/es/transfer/use-highlighted-options/toggle-range.js +4 -6
- package/build/es/transfer/use-highlighted-options/toggle-replace.js +0 -2
- package/build/es/transfer/use-highlighted-options.js +1 -2
- package/build/es/transfer-option.js +1 -2
- package/build/es/transfer.js +28 -32
- package/build/es/{transfer.stories.js → transfer.prod.stories.js} +65 -50
- package/build/es/use-resize-counter.js +1 -2
- package/package.json +10 -10
- /package/build/es/__e2e__/{add_remove-highlighted-options.stories.e2e.js → add_remove-highlighted-options.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{display-order.stories.e2e.js → display-order.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{highlight-range-of-options.stories.e2e.js → highlight-range-of-options.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{loading_lists.stories.e2e.js → loading_lists.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{notify_at_end_of_list.stories.e2e.js → notify_at_end_of_list.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{reorder-with-buttons.stories.e2e.js → reorder-with-buttons.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{set_unset-highlighted-option.stories.e2e.js → set_unset-highlighted-option.e2e.stories.js} +0 -0
- /package/build/es/__e2e__/{transferring-items.stories.e2e.js → transferring-items.e2e.stories.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ADD_MODE, RANGE_MODE, REPLACE_MODE } from './modes.js';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* @param {Object} args
|
|
4
5
|
* @param {bool} args.altKey
|
|
@@ -7,7 +8,6 @@ import { ADD_MODE, RANGE_MODE, REPLACE_MODE } from './modes.js';
|
|
|
7
8
|
* @param {bool} args.metaKey
|
|
8
9
|
* @return {string}
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
export const getModeByModifierKey = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
altKey,
|
|
@@ -18,19 +18,16 @@ export const getModeByModifierKey = _ref => {
|
|
|
18
18
|
const keys = [altKey, shiftKey, ctrlKey, metaKey];
|
|
19
19
|
const amountKeyPressed = keys.filter(v => v);
|
|
20
20
|
const moreThanOneKeyPressed = amountKeyPressed.length;
|
|
21
|
-
|
|
22
21
|
if (moreThanOneKeyPressed !== 1) {
|
|
23
22
|
return REPLACE_MODE;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
if (altKey || ctrlKey || metaKey) {
|
|
27
25
|
return ADD_MODE;
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
if (shiftKey) {
|
|
31
28
|
return RANGE_MODE;
|
|
32
|
-
}
|
|
33
|
-
|
|
29
|
+
}
|
|
34
30
|
|
|
31
|
+
// default to replace mode
|
|
35
32
|
return REPLACE_MODE;
|
|
36
33
|
};
|
package/build/es/common/modes.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Click modes when clicking on an option with/without
|
|
3
3
|
* a modifier key (ctrl, alt, cmd, shift)
|
|
4
4
|
*/
|
|
5
|
-
// no or multiple modifier keys
|
|
6
|
-
export const REPLACE_MODE = 'REPLACE_MODE'; // add/remove options from selection
|
|
7
|
-
|
|
8
|
-
export const ADD_MODE = 'ADD_MODE'; // create selection range
|
|
9
5
|
|
|
6
|
+
// no or multiple modifier keys
|
|
7
|
+
export const REPLACE_MODE = 'REPLACE_MODE';
|
|
8
|
+
// add/remove options from selection
|
|
9
|
+
export const ADD_MODE = 'ADD_MODE';
|
|
10
|
+
// create selection range
|
|
10
11
|
export const RANGE_MODE = 'RANGE_MODE';
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { findOptionIndex } from './find-option-index.js';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* @param {Object[]} options
|
|
4
5
|
* @param {Object} option
|
|
5
6
|
* @returns {Object}
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
8
|
export const removeOption = (options, option) => {
|
|
9
9
|
const index = findOptionIndex(options, option);
|
|
10
|
-
|
|
11
10
|
if (index === -1) {
|
|
12
11
|
return options;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
if (index === 0) {
|
|
16
14
|
return options.slice(1);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
return [...options.slice(0, index), ...options.slice(index + 1)];
|
|
20
17
|
};
|
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export const toggleValue = (values, value) => {
|
|
7
7
|
const index = values.indexOf(value);
|
|
8
|
-
|
|
9
8
|
if (index === -1) {
|
|
10
9
|
return [...values, value];
|
|
11
10
|
} else if (index === 0) {
|
|
12
11
|
values.slice(1);
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
const prevSlice = values.slice(0, index);
|
|
16
14
|
const nextSlice = values.slice(index + 1);
|
|
17
15
|
return [...prevSlice, ...nextSlice];
|
package/build/es/container.js
CHANGED
|
@@ -14,7 +14,7 @@ export const Container = _ref => {
|
|
|
14
14
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
15
|
id: "3332822660",
|
|
16
16
|
dynamic: [height]
|
|
17
|
-
}, [
|
|
17
|
+
}, [`div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;height:${height};}`]));
|
|
18
18
|
};
|
|
19
19
|
Container.propTypes = {
|
|
20
20
|
height: PropTypes.string.isRequired,
|
|
@@ -15,7 +15,8 @@ When('the user deselects one selected option', () => {
|
|
|
15
15
|
cy.get('{transfer-actions-removeindividual}').click();
|
|
16
16
|
});
|
|
17
17
|
When('the user deselects multiple selected options', () => {
|
|
18
|
-
cy.get('{transfer-pickedoptions} {transferoption}')
|
|
18
|
+
cy.get('{transfer-pickedoptions} {transferoption}')
|
|
19
|
+
// should take third, then first item
|
|
19
20
|
.then($options => {
|
|
20
21
|
const $arr = $options.toArray();
|
|
21
22
|
return [$arr[2], $arr[0]];
|
|
@@ -28,7 +29,8 @@ When('the user selects one option', () => {
|
|
|
28
29
|
cy.get('{transfer-actions-addindividual}').click();
|
|
29
30
|
});
|
|
30
31
|
When('the user selects multiple options', () => {
|
|
31
|
-
cy.get('{transfer-sourceoptions} {transferoption}')
|
|
32
|
+
cy.get('{transfer-sourceoptions} {transferoption}')
|
|
33
|
+
// should take fifth, then first item
|
|
32
34
|
.then($options => {
|
|
33
35
|
const $arr = $options.toArray();
|
|
34
36
|
return [$arr[4], $arr[0]];
|
|
@@ -74,8 +76,9 @@ Then('it should be positioned according to the order of the supplied options', (
|
|
|
74
76
|
} = _ref5;
|
|
75
77
|
return label === option.label && value === option.value;
|
|
76
78
|
}));
|
|
77
|
-
expect(selectableSourceOptions).to.eql(originalOptions);
|
|
79
|
+
expect(selectableSourceOptions).to.eql(originalOptions);
|
|
78
80
|
|
|
81
|
+
// and confirm that the deselected option is in the selectable options list
|
|
79
82
|
const [deselectedOption] = deselectedOptions;
|
|
80
83
|
const hasOption = !!selectableSourceOptions.find(_ref6 => {
|
|
81
84
|
let {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
import { extractOptionFromElement } from '../common/index.js';
|
|
3
|
-
Given('filtering is enabled', () => {
|
|
3
|
+
Given('filtering is enabled', () => {
|
|
4
|
+
// no op
|
|
4
5
|
});
|
|
5
|
-
Given('the options list is being filtered', () => {
|
|
6
|
+
Given('the options list is being filtered', () => {
|
|
7
|
+
// no op
|
|
6
8
|
});
|
|
7
9
|
Given('the result is not empty', () => {
|
|
8
10
|
cy.visitStory('Transfer filtering', 'Some Results');
|
|
@@ -10,7 +12,8 @@ Given('the result is not empty', () => {
|
|
|
10
12
|
Given('the result is empty', () => {
|
|
11
13
|
cy.visitStory('Transfer filtering', 'Empty Result');
|
|
12
14
|
});
|
|
13
|
-
Given('a no-result message has been provided', () => {
|
|
15
|
+
Given('a no-result message has been provided', () => {
|
|
16
|
+
// no op
|
|
14
17
|
});
|
|
15
18
|
Given('the options are being search with a {string} search term', firstCase => {
|
|
16
19
|
if (firstCase === 'uppercase') {
|
|
@@ -18,7 +21,6 @@ Given('the options are being search with a {string} search term', firstCase => {
|
|
|
18
21
|
} else if (firstCase === 'lowercase') {
|
|
19
22
|
cy.visitStory('Transfer filtering', 'Lowercase Search');
|
|
20
23
|
}
|
|
21
|
-
|
|
22
24
|
cy.get('{transfer-filter} input').then($input => $input.val()).as('firstCaseTerm');
|
|
23
25
|
});
|
|
24
26
|
Given('some options are listed', () => {
|
|
@@ -34,13 +36,11 @@ When('the user uses the same search term but {string}', secondCase => {
|
|
|
34
36
|
cy.all(() => cy.get('@firstCaseTerm'), () => cy.get('{transfer-filter} input')).then(_ref => {
|
|
35
37
|
let [firstCaseTerm, $filterInput] = _ref;
|
|
36
38
|
let secondCaseTerm;
|
|
37
|
-
|
|
38
39
|
if (secondCase === 'uppercase') {
|
|
39
40
|
secondCaseTerm = firstCaseTerm.toUpperCase();
|
|
40
41
|
} else if (secondCase === 'lowercase') {
|
|
41
42
|
secondCaseTerm = firstCaseTerm.toLowerCase();
|
|
42
43
|
}
|
|
43
|
-
|
|
44
44
|
cy.wrap($filterInput).clear().type(secondCaseTerm);
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -49,9 +49,14 @@ When('the user highlightes the second options following the highlighted option w
|
|
|
49
49
|
cy.get('@secondBelowInitiallyHighlighted').clickWith('shift');
|
|
50
50
|
});
|
|
51
51
|
When('the user highlightes the second options following the last highlighted option', () => {
|
|
52
|
-
cy.get('@initiallyHighlightedMultiple')
|
|
53
|
-
|
|
54
|
-
.
|
|
52
|
+
cy.get('@initiallyHighlightedMultiple')
|
|
53
|
+
// last highlighted option
|
|
54
|
+
.last()
|
|
55
|
+
|
|
56
|
+
// next sibling
|
|
57
|
+
.next().as('firstBelowLastHighlighted')
|
|
58
|
+
|
|
59
|
+
// second next sibling
|
|
55
60
|
.next().as('secondBelowLastHighlighted').clickWith('shift');
|
|
56
61
|
});
|
|
57
62
|
When('the user {string} clicks a highlighted option', modifierKey => {
|
|
@@ -18,12 +18,12 @@ Given('the picked list is not loading', () => {
|
|
|
18
18
|
Then('the loading indicator should be shown', () => {
|
|
19
19
|
cy.get('@listType').then(listType => {
|
|
20
20
|
const listSelector = listType === 'source' ? '{transfer-leftside}' : '{transfer-rightside}';
|
|
21
|
-
cy.get(
|
|
21
|
+
cy.get(`${listSelector} .loading`).should('exist');
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
Then('the loading indicator should not be shown', () => {
|
|
25
25
|
cy.get('@listType').then(listType => {
|
|
26
26
|
const listSelector = listType === 'source' ? '{transfer-leftside}' : '{transfer-rightside}';
|
|
27
|
-
cy.get(
|
|
27
|
+
cy.get(`${listSelector} .loading`).should('not.exist');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -18,7 +18,7 @@ Given('the Transfer does not have enough items to fill the picked list completel
|
|
|
18
18
|
When('the user scroll to the end of the list', () => {
|
|
19
19
|
cy.get('@listType').then(listType => {
|
|
20
20
|
const listSelector = listType === 'source' ? 'transfer-sourceoptions' : 'transfer-pickedoptions';
|
|
21
|
-
cy.get(
|
|
21
|
+
cy.get(`{${listSelector}-endintersectiondetector}`).scrollIntoView();
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
Then('the callback for reaching the end should not be called', () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
|
-
Given('reordering of items is enabled', () => {
|
|
2
|
+
Given('reordering of items is enabled', () => {
|
|
3
|
+
// no op
|
|
3
4
|
});
|
|
4
5
|
Given('the selected list has three items', () => {
|
|
5
6
|
cy.visitStory('Transfer Reorder Buttons', 'Has Some Selected');
|
|
@@ -35,7 +36,7 @@ When("the user clicks the 'move down' button", () => {
|
|
|
35
36
|
});
|
|
36
37
|
Then('the highlighted item should be moved to the {int}. place', next => {
|
|
37
38
|
const index = next - 1;
|
|
38
|
-
cy.get('@previousValue').then(previousValue => cy.get(
|
|
39
|
+
cy.get('@previousValue').then(previousValue => cy.get(`[data-value="${previousValue}"]`)).invoke('index').should('equal', index);
|
|
39
40
|
});
|
|
40
41
|
Then("the 'move up' and 'move down' buttons should be disabled", () => {
|
|
41
42
|
cy.get('{transfer-reorderingactions-buttonmoveup}').should('have.attr', 'disabled');
|
|
@@ -8,15 +8,18 @@ Given('some options are selected', () => {
|
|
|
8
8
|
cy.visitStory('Transfer Transferring Items', 'Some Selected');
|
|
9
9
|
});
|
|
10
10
|
Given('one or more items in the options list are highlighted', () => {
|
|
11
|
-
cy.get('{transfer-sourceoptions} {transferoption}').filter(index => index < 3)
|
|
11
|
+
cy.get('{transfer-sourceoptions} {transferoption}').filter(index => index < 3)
|
|
12
|
+
// shuffle order so we can check they're added in the right order
|
|
12
13
|
.then($options => cy.wrap([$options[2], $options[0], $options[1]])).each($option => cy.wrap($option).clickWith('ctrl')).then($options => $options.toArray().map(extractOptionFromElement)).as('itemsToBeSelected');
|
|
13
14
|
});
|
|
14
15
|
Given('some items in the options list are highlighted', () => {
|
|
15
|
-
cy.get('{transfer-sourceoptions} {transferoption}').filter(index => index < 3)
|
|
16
|
+
cy.get('{transfer-sourceoptions} {transferoption}').filter(index => index < 3)
|
|
17
|
+
// shuffle order so we can check they're added in the right order
|
|
16
18
|
.then($options => cy.wrap([$options[2], $options[0], $options[1]])).each($option => cy.wrap($option).clickWith('ctrl')).then($options => $options.toArray().map(extractOptionFromElement)).as('itemsToBeSelected');
|
|
17
19
|
});
|
|
18
20
|
Given('some items in the selected list are highlighted', () => {
|
|
19
|
-
cy.get('{transfer-pickedoptions} {transferoption}').filter(index => index < 3)
|
|
21
|
+
cy.get('{transfer-pickedoptions} {transferoption}').filter(index => index < 3)
|
|
22
|
+
// shuffle order so we can check they're added in the right order
|
|
20
23
|
.then($options => cy.wrap([$options[2], $options[0], $options[1]])).each($option => cy.wrap($option).clickWith('ctrl')).then($options => $options.toArray().map(extractOptionFromElement)).as('itemsToBeDeselected');
|
|
21
24
|
});
|
|
22
25
|
When("the user clicks the 'move to selected list' button", () => {
|
package/build/es/filter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { spacers } from '@dhis2/ui-constants';
|
|
2
3
|
import { Field } from '@dhis2-ui/field';
|
|
3
4
|
import { Input } from '@dhis2-ui/input';
|
|
4
|
-
import { spacers } from '@dhis2/ui-constants';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export const Filter = _ref => {
|
|
@@ -18,9 +18,9 @@ export const Filter = _ref => {
|
|
|
18
18
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
19
19
|
label: label,
|
|
20
20
|
name: dataTest,
|
|
21
|
-
dataTest:
|
|
21
|
+
dataTest: `${dataTest}-field`
|
|
22
22
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
23
|
-
dataTest:
|
|
23
|
+
dataTest: `${dataTest}-input`,
|
|
24
24
|
type: "search",
|
|
25
25
|
placeholder: placeholder,
|
|
26
26
|
value: filter,
|
|
@@ -28,7 +28,7 @@ export const Filter = _ref => {
|
|
|
28
28
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
29
29
|
id: "3679907342",
|
|
30
30
|
dynamic: [spacers.dp8, spacers.dp8]
|
|
31
|
-
}, [
|
|
31
|
+
}, [`div.__jsx-style-dynamic-selector{padding-bottom:${spacers.dp8};}`, `div.__jsx-style-dynamic-selector:first-child{padding-top:${spacers.dp8};}`]));
|
|
32
32
|
};
|
|
33
33
|
Filter.propTypes = {
|
|
34
34
|
dataTest: PropTypes.string.isRequired,
|
package/build/es/icons.js
CHANGED
|
@@ -10,7 +10,7 @@ export const IconAddAll = _ref => {
|
|
|
10
10
|
disabled
|
|
11
11
|
} = _ref;
|
|
12
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
-
className:
|
|
13
|
+
className: `jsx-${centerButtonStyles.__hash}` + " " + "centerButton"
|
|
14
14
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
15
15
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16
16
|
width: "16",
|
|
@@ -18,18 +18,18 @@ export const IconAddAll = _ref => {
|
|
|
18
18
|
viewBox: "0 0 16 16",
|
|
19
19
|
"data-test": dataTest,
|
|
20
20
|
fill: disabled ? theme.disabled : '#404B5A',
|
|
21
|
-
className:
|
|
21
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
22
22
|
}, /*#__PURE__*/React.createElement("g", {
|
|
23
23
|
fillRule: "evenodd",
|
|
24
|
-
className:
|
|
24
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
25
25
|
}, /*#__PURE__*/React.createElement("polygon", {
|
|
26
26
|
fillRule: "nonzero",
|
|
27
27
|
points: "6 2 4.94 3.06 9.13 7.25 0 7.25 0 8.75 9.13 8.75 4.94 12.94 6 14 12 8",
|
|
28
|
-
className:
|
|
28
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
29
29
|
}), /*#__PURE__*/React.createElement("polygon", {
|
|
30
30
|
fillRule: "nonzero",
|
|
31
31
|
points: "10 2 8.94 3.06 13.13 7.25 13.9 8 13.13 8.75 8.94 12.94 10 14 16 8",
|
|
32
|
-
className:
|
|
32
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
33
33
|
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
34
34
|
id: centerButtonStyles.__hash
|
|
35
35
|
}, centerButtonStyles));
|
|
@@ -44,7 +44,7 @@ export const IconAddIndividual = _ref2 => {
|
|
|
44
44
|
disabled
|
|
45
45
|
} = _ref2;
|
|
46
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className:
|
|
47
|
+
className: `jsx-${centerButtonStyles.__hash}` + " " + "centerButton"
|
|
48
48
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
49
49
|
fill: disabled ? theme.disabled : '#404B5A',
|
|
50
50
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -52,10 +52,10 @@ export const IconAddIndividual = _ref2 => {
|
|
|
52
52
|
height: "16",
|
|
53
53
|
viewBox: "0 0 16 16",
|
|
54
54
|
"data-test": dataTest,
|
|
55
|
-
className:
|
|
55
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
56
56
|
}, /*#__PURE__*/React.createElement("polygon", {
|
|
57
57
|
points: "8 2 6.94 3.06 11.13 7.25 2 7.25 2 8.75 11.13 8.75 6.94 12.94 8 14 14 8",
|
|
58
|
-
className:
|
|
58
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
59
59
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
60
60
|
id: centerButtonStyles.__hash
|
|
61
61
|
}, centerButtonStyles));
|
|
@@ -70,7 +70,7 @@ export const IconRemoveAll = _ref3 => {
|
|
|
70
70
|
disabled
|
|
71
71
|
} = _ref3;
|
|
72
72
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className:
|
|
73
|
+
className: `jsx-${centerButtonStyles.__hash}` + " " + "centerButton"
|
|
74
74
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
75
75
|
fill: disabled ? theme.disabled : '#404B5A',
|
|
76
76
|
width: "16px",
|
|
@@ -78,20 +78,20 @@ export const IconRemoveAll = _ref3 => {
|
|
|
78
78
|
viewBox: "0 0 16 16",
|
|
79
79
|
"data-test": dataTest,
|
|
80
80
|
xmlns: "http://www.w3.org/2000/svg",
|
|
81
|
-
className:
|
|
81
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
82
82
|
}, /*#__PURE__*/React.createElement("g", {
|
|
83
83
|
fillRule: "evenodd",
|
|
84
|
-
className:
|
|
84
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
85
85
|
}, /*#__PURE__*/React.createElement("polygon", {
|
|
86
86
|
fillRule: "nonzero",
|
|
87
87
|
points: "10 2 8.94 3.06 13.13 7.25 4 7.25 4 8.75 13.13 8.75 8.94 12.94 10 14 16 8",
|
|
88
88
|
transform: "matrix(-1 0 0 1 20 0)",
|
|
89
|
-
className:
|
|
89
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
90
90
|
}), /*#__PURE__*/React.createElement("polygon", {
|
|
91
91
|
fillRule: "nonzero",
|
|
92
92
|
points: "1.06 2 0 3.06 4.19 7.25 4.96 8 4.19 8.75 0 12.94 1.06 14 7.06 8",
|
|
93
93
|
transform: "matrix(-1 0 0 1 7.06 0)",
|
|
94
|
-
className:
|
|
94
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
95
95
|
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
96
96
|
id: centerButtonStyles.__hash
|
|
97
97
|
}, centerButtonStyles));
|
|
@@ -106,7 +106,7 @@ export const IconRemoveIndividual = _ref4 => {
|
|
|
106
106
|
disabled
|
|
107
107
|
} = _ref4;
|
|
108
108
|
return /*#__PURE__*/React.createElement("div", {
|
|
109
|
-
className:
|
|
109
|
+
className: `jsx-${centerButtonStyles.__hash}` + " " + "centerButton"
|
|
110
110
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
111
111
|
fill: disabled ? theme.disabled : '#404B5A',
|
|
112
112
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -114,11 +114,11 @@ export const IconRemoveIndividual = _ref4 => {
|
|
|
114
114
|
height: "16",
|
|
115
115
|
viewBox: "0 0 16 16",
|
|
116
116
|
"data-test": dataTest,
|
|
117
|
-
className:
|
|
117
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
118
118
|
}, /*#__PURE__*/React.createElement("polygon", {
|
|
119
119
|
points: "8 2 6.94 3.06 11.13 7.25 2 7.25 2 8.75 11.13 8.75 6.94 12.94 8 14 14 8",
|
|
120
120
|
transform: "matrix(-1 0 0 1 16 0)",
|
|
121
|
-
className:
|
|
121
|
+
className: `jsx-${centerButtonStyles.__hash}`
|
|
122
122
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
123
123
|
id: centerButtonStyles.__hash
|
|
124
124
|
}, centerButtonStyles));
|
package/build/es/left-footer.js
CHANGED
|
@@ -14,7 +14,7 @@ export const LeftFooter = _ref => {
|
|
|
14
14
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
15
|
id: "3629116366",
|
|
16
16
|
dynamic: [borderColor, spacers.dp8]
|
|
17
|
-
}, [
|
|
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 ${borderColor};padding:0 ${spacers.dp8};}`]));
|
|
18
18
|
};
|
|
19
19
|
LeftFooter.propTypes = {
|
|
20
20
|
children: PropTypes.node,
|
package/build/es/left-header.js
CHANGED
|
@@ -14,7 +14,7 @@ export const LeftHeader = _ref => {
|
|
|
14
14
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
15
|
id: "2175954399",
|
|
16
16
|
dynamic: [borderColor, spacers.dp8]
|
|
17
|
-
}, [
|
|
17
|
+
}, [`div.__jsx-style-dynamic-selector{border-bottom:1px solid ${borderColor};-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;padding:0 ${spacers.dp8};}`]));
|
|
18
18
|
};
|
|
19
19
|
LeftHeader.propTypes = {
|
|
20
20
|
children: PropTypes.node,
|
package/build/es/left-side.js
CHANGED
|
@@ -19,7 +19,7 @@ export const LeftSide = _ref => {
|
|
|
19
19
|
'', /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
20
|
id: "4143353612",
|
|
21
21
|
dynamic: [backgroundColor, borderRadius, borderColor, width]
|
|
22
|
-
}, [
|
|
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:${backgroundColor};border-radius:${borderRadius};border:1px solid ${borderColor};min-height:240px;max-width:100%;width:${width};}`]));
|
|
23
23
|
};
|
|
24
24
|
LeftSide.propTypes = {
|
|
25
25
|
width: PropTypes.string.isRequired,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { CircularLoader } from '@dhis2-ui/loader';
|
|
3
2
|
import { spacers } from '@dhis2/ui-constants';
|
|
3
|
+
import { CircularLoader } from '@dhis2-ui/loader';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React, { Fragment, useRef } from 'react';
|
|
6
6
|
import { EndIntersectionDetector } from './end-intersection-detector.js';
|
|
@@ -37,20 +37,21 @@ export const OptionsContainer = _ref => {
|
|
|
37
37
|
const highlighted = !!highlightedOptions.find(highlightedSourceOption => highlightedSourceOption === option.value);
|
|
38
38
|
return /*#__PURE__*/React.createElement(Fragment, {
|
|
39
39
|
key: option.value
|
|
40
|
-
}, renderOption({
|
|
40
|
+
}, renderOption({
|
|
41
|
+
...option,
|
|
41
42
|
...getOptionClickHandlers(option, selectionHandler, toggleHighlightedOption),
|
|
42
43
|
highlighted,
|
|
43
44
|
selected
|
|
44
45
|
}));
|
|
45
46
|
}), onEndReached && /*#__PURE__*/React.createElement(EndIntersectionDetector, {
|
|
46
|
-
dataTest:
|
|
47
|
-
key:
|
|
47
|
+
dataTest: `${dataTest}-endintersectiondetector`,
|
|
48
|
+
key: `key-${resizeCounter}`,
|
|
48
49
|
rootRef: optionsRef,
|
|
49
50
|
onEndReached: onEndReached
|
|
50
51
|
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
51
52
|
id: "3254058061",
|
|
52
53
|
dynamic: [spacers.dp4]
|
|
53
|
-
}, [
|
|
54
|
+
}, [`.optionsContainer.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:${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;inset-inline-start: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);}"]));
|
|
54
55
|
};
|
|
55
56
|
OptionsContainer.defaultProps = {
|
|
56
57
|
selected: false
|
|
@@ -23,7 +23,7 @@ export const PickedOptions = _ref => {
|
|
|
23
23
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
24
|
id: "392419471",
|
|
25
25
|
dynamic: [spacers.dp4]
|
|
26
|
-
}, [
|
|
26
|
+
}, [`.container.__jsx-style-dynamic-selector{padding:${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
27
|
};
|
|
28
28
|
PickedOptions.propTypes = {
|
|
29
29
|
children: PropTypes.node.isRequired,
|
package/build/es/remove-all.js
CHANGED
|
@@ -15,7 +15,7 @@ export const RemoveIndividual = _ref => {
|
|
|
15
15
|
onClick: onClick,
|
|
16
16
|
icon: /*#__PURE__*/React.createElement(IconRemoveIndividual, {
|
|
17
17
|
disabled: disabled,
|
|
18
|
-
dataTest:
|
|
18
|
+
dataTest: `${dataTest}-iconremoveindividual`
|
|
19
19
|
})
|
|
20
20
|
}, label);
|
|
21
21
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { Button } from '@dhis2-ui/button';
|
|
3
2
|
import { spacers } from '@dhis2/ui-constants';
|
|
3
|
+
import { Button } from '@dhis2-ui/button';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { IconMoveDown, IconMoveUp } from './icons.js';
|
|
@@ -19,24 +19,24 @@ export const ReorderingActions = _ref => {
|
|
|
19
19
|
small: true,
|
|
20
20
|
disabled: disabledDown,
|
|
21
21
|
onClick: () => !disabledDown && onChangeDown(event),
|
|
22
|
-
dataTest:
|
|
22
|
+
dataTest: `${dataTest}-buttonmovedown`,
|
|
23
23
|
icon: /*#__PURE__*/React.createElement(IconMoveDown, {
|
|
24
|
-
dataTest:
|
|
24
|
+
dataTest: `${dataTest}-iconmovedown`,
|
|
25
25
|
disabled: disabledDown
|
|
26
26
|
})
|
|
27
27
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
28
28
|
small: true,
|
|
29
29
|
disabled: disabledUp,
|
|
30
30
|
onClick: () => !disabledUp && onChangeUp(event),
|
|
31
|
-
dataTest:
|
|
31
|
+
dataTest: `${dataTest}-buttonmoveup`,
|
|
32
32
|
icon: /*#__PURE__*/React.createElement(IconMoveUp, {
|
|
33
|
-
dataTest:
|
|
33
|
+
dataTest: `${dataTest}-iconmoveup`,
|
|
34
34
|
disabled: disabledUp
|
|
35
35
|
})
|
|
36
36
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
37
37
|
id: "874845231",
|
|
38
38
|
dynamic: [spacers.dp8, spacers.dp8, spacers.dp8]
|
|
39
|
-
}, [
|
|
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:${spacers.dp8};}`, `div.__jsx-style-dynamic-selector:last-child{padding-bottom:${spacers.dp8};}`, `div.__jsx-style-dynamic-selector>button:first-child{margin-inline-start:${spacers.dp8};}`]));
|
|
40
40
|
};
|
|
41
41
|
ReorderingActions.propTypes = {
|
|
42
42
|
dataTest: PropTypes.string.isRequired,
|
package/build/es/right-footer.js
CHANGED
|
@@ -14,7 +14,7 @@ export const RightFooter = _ref => {
|
|
|
14
14
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
15
|
id: "3629116366",
|
|
16
16
|
dynamic: [borderColor, spacers.dp8]
|
|
17
|
-
}, [
|
|
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 ${borderColor};padding:0 ${spacers.dp8};}`]));
|
|
18
18
|
};
|
|
19
19
|
RightFooter.propTypes = {
|
|
20
20
|
children: PropTypes.node,
|
package/build/es/right-header.js
CHANGED
|
@@ -14,7 +14,7 @@ export const RightHeader = _ref => {
|
|
|
14
14
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
15
|
id: "2175954399",
|
|
16
16
|
dynamic: [borderColor, spacers.dp8]
|
|
17
|
-
}, [
|
|
17
|
+
}, [`div.__jsx-style-dynamic-selector{border-bottom:1px solid ${borderColor};-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;padding:0 ${spacers.dp8};}`]));
|
|
18
18
|
};
|
|
19
19
|
RightHeader.propTypes = {
|
|
20
20
|
children: PropTypes.node,
|
package/build/es/right-side.js
CHANGED
|
@@ -19,7 +19,7 @@ export const RightSide = _ref => {
|
|
|
19
19
|
'', /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
20
|
id: "1391448013",
|
|
21
21
|
dynamic: [backgroundColor, borderColor, borderRadius, width]
|
|
22
|
-
}, [
|
|
22
|
+
}, [`div.__jsx-style-dynamic-selector{background-color:${backgroundColor};border:1px solid ${borderColor};border-radius:${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:${width};}`]));
|
|
23
23
|
};
|
|
24
24
|
RightSide.propTypes = {
|
|
25
25
|
width: PropTypes.string.isRequired,
|
|
@@ -23,7 +23,7 @@ export const SourceOptions = _ref => {
|
|
|
23
23
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
24
|
id: "392419471",
|
|
25
25
|
dynamic: [spacers.dp4]
|
|
26
|
-
}, [
|
|
26
|
+
}, [`.container.__jsx-style-dynamic-selector{padding:${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
27
|
};
|
|
28
28
|
SourceOptions.propTypes = {
|
|
29
29
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -20,14 +20,15 @@ export const addAllSelectableSourceOptions = _ref => {
|
|
|
20
20
|
return !disabled;
|
|
21
21
|
});
|
|
22
22
|
const newSelected = enabledSourceOptions.reduce((accumulatedSelected, enabledSourceOption) => [...accumulatedSelected, enabledSourceOption.value], selected);
|
|
23
|
-
setHighlightedSourceOptions([]);
|
|
23
|
+
setHighlightedSourceOptions([]);
|
|
24
|
+
|
|
25
|
+
// If we ever allow maxSelection to be any value
|
|
24
26
|
// other than 1 and Infinity, we need to think
|
|
25
27
|
// about how this should behave:
|
|
26
28
|
//
|
|
27
29
|
// Either we hide this button when it's not "Infinity",
|
|
28
30
|
// or we have to decide whether we want to take the first
|
|
29
31
|
// nth options or the last
|
|
30
|
-
|
|
31
32
|
onChange({
|
|
32
33
|
selected: newSelected
|
|
33
34
|
});
|
|
@@ -18,7 +18,6 @@ export const addIndividualSourceOptions = _ref => {
|
|
|
18
18
|
selected,
|
|
19
19
|
setHighlightedSourceOptions
|
|
20
20
|
} = _ref;
|
|
21
|
-
|
|
22
21
|
/**
|
|
23
22
|
* Creates a subset of the highlighted options to reflect a changed
|
|
24
23
|
* filter value in case previously highlighted options are now
|
|
@@ -33,13 +32,13 @@ export const addIndividualSourceOptions = _ref => {
|
|
|
33
32
|
const filteredHighlightedSourceOptions = filterable ? highlightedSourceOptions.filter(value => sourceOptions.find(filteredOption => filteredOption.value === value)) : highlightedSourceOptions;
|
|
34
33
|
const newSelected = filteredHighlightedSourceOptions.reduce((accumulatedSelected, value) => [...accumulatedSelected, filteredHighlightedSourceOptions.find(filteredHighlightedSourceOption => filteredHighlightedSourceOption === value)], selected);
|
|
35
34
|
setHighlightedSourceOptions([]);
|
|
35
|
+
|
|
36
36
|
/**
|
|
37
37
|
* This will extract from the end, hence the "-1 *"
|
|
38
38
|
* As the "newest" additions are always at the end of the array,
|
|
39
39
|
* it's safe to just take the last nth (depending on maxSelection)
|
|
40
40
|
* to always get the right ones
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
42
|
onChange({
|
|
44
43
|
selected: newSelected.slice(-1 * maxSelections)
|
|
45
44
|
});
|