@dhis2-ui/select 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 +94 -57
- package/build/cjs/multi-select/features/menu_width_matches_input/index.js +2 -4
- package/build/cjs/multi-select/features/position/index.js +6 -12
- package/build/cjs/multi-select/filterable-menu.js +22 -25
- package/build/cjs/multi-select/input.js +14 -15
- package/build/cjs/multi-select/menu.js +24 -28
- package/build/cjs/multi-select/multi-select.e2e.stories.js +21 -32
- package/build/cjs/multi-select/multi-select.js +30 -31
- package/build/cjs/multi-select/multi-select.prod.stories.js +13 -21
- package/build/cjs/multi-select/selection-list.js +51 -57
- package/build/cjs/multi-select-option/multi-select-option.js +27 -30
- package/build/cjs/select/debounce/debounce.js +2 -6
- package/build/cjs/select/empty.js +11 -14
- package/build/cjs/select/filter-input.js +21 -24
- package/build/cjs/select/filterable-menu.js +6 -8
- package/build/cjs/select/input-clear-button.js +28 -31
- package/build/cjs/select/input-placeholder.js +5 -6
- package/build/cjs/select/input-prefix.js +5 -6
- package/build/cjs/select/input-wrapper.js +13 -14
- package/build/cjs/select/loading.js +15 -18
- package/build/cjs/select/menu-wrapper.js +8 -9
- package/build/cjs/select/no-match.js +9 -12
- package/build/cjs/select/select.js +3 -4
- package/build/cjs/simple-single-select/__stories__/DefaultPosition.js +1 -2
- package/build/cjs/simple-single-select/__stories__/Dense.js +1 -2
- package/build/cjs/simple-single-select/__stories__/Empty.js +1 -2
- package/build/cjs/simple-single-select/__stories__/EmptyWithEmptyNode.js +1 -2
- package/build/cjs/simple-single-select/__stories__/EmptyWithEmptyText.js +1 -2
- package/build/cjs/simple-single-select/__stories__/FlippedPosition.js +1 -2
- package/build/cjs/simple-single-select/__stories__/InfiniteLoading.js +1 -2
- package/build/cjs/simple-single-select/__stories__/ShiftedIntoView.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithClearButton.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithCustomLowMaxHeight.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithCustomOptions.js +17 -21
- package/build/cjs/simple-single-select/__stories__/WithDisabledOption.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithFilterField.js +5 -9
- package/build/cjs/simple-single-select/__stories__/WithInitialFocus.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithManyOptions.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithMultipleSelectsAndScrollableParent.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithNoMatchText.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithOnBlur.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithOnFocus.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithOptionsAndDisabled.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithOptionsAndLoading.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithOptionsAndLoadingText.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithPlaceholder.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithPlaceholderAndSelection.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithPrefix.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithPrefixAndSelection.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithRTL.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithScrollingParent.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithSelection.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithSelectionAndDisabled.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithServerSideFilteringDemo.js +25 -36
- package/build/cjs/simple-single-select/__stories__/WithSimpleFilteringDemo.js +4 -6
- package/build/cjs/simple-single-select/__stories__/WithoutOptionsAndLoading.js +1 -2
- package/build/cjs/simple-single-select/__stories__/WithoutSelection.js +1 -2
- package/build/cjs/simple-single-select/__stories__/simple-single-select-server-side-filtering/CustomDataProvider.js +19 -26
- package/build/cjs/simple-single-select/features/keyboard-interactions.test.e2e.js +9 -18
- package/build/cjs/simple-single-select/features/menu-positioning.test.e2e.js +8 -16
- package/build/cjs/simple-single-select/menu/empty.js +8 -11
- package/build/cjs/simple-single-select/menu/filter.js +11 -12
- package/build/cjs/simple-single-select/menu/loading.js +3 -4
- package/build/cjs/simple-single-select/menu/menu.js +26 -28
- package/build/cjs/simple-single-select/menu/no-match.js +9 -12
- package/build/cjs/simple-single-select/menu/option.js +20 -23
- package/build/cjs/simple-single-select/menu/options-list.js +23 -26
- package/build/cjs/simple-single-select/selected-value/clear-button.js +5 -6
- package/build/cjs/simple-single-select/selected-value/container.js +23 -25
- package/build/cjs/simple-single-select/selected-value/placeholder.js +5 -6
- package/build/cjs/simple-single-select/selected-value/prefix.js +5 -6
- package/build/cjs/simple-single-select/selected-value/selected-value.js +34 -35
- package/build/cjs/simple-single-select/simple-single-select.e2e.stories.js +1 -2
- package/build/cjs/simple-single-select/simple-single-select.js +47 -50
- package/build/cjs/simple-single-select/simple-single-select.test.js +14 -24
- package/build/cjs/simple-single-select/use-handle-key-press/use-focus-option.js +5 -6
- package/build/cjs/simple-single-select/use-handle-key-press/use-handle-key-press-on-combobox.js +31 -34
- package/build/cjs/simple-single-select/use-handle-key-press/use-handle-key-press-on-filter-input.js +11 -12
- package/build/cjs/simple-single-select/use-handle-key-press/use-handle-typing.js +10 -14
- package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-first-option-on-previous-page.js +6 -7
- package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-first-visible-option.js +5 -6
- package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-last-option-on-next-page.js +6 -7
- package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-last-visible-option.js +5 -6
- package/build/cjs/simple-single-select/use-handle-key-press/use-page-down.js +6 -7
- package/build/cjs/simple-single-select/use-handle-key-press/use-page-up.js +6 -7
- package/build/cjs/simple-single-select/use-handle-key-press/utils.js +17 -22
- package/build/cjs/simple-single-select-field/simple-single-select-field.js +3 -6
- package/build/cjs/simple-single-select-field/simple-single-select-field.prod.stories.js +1 -2
- package/build/cjs/simple-single-select-field/simple-single-select-field.test.js +3 -6
- package/build/cjs/single-select/features/menu_width_matches_input/index.js +2 -4
- package/build/cjs/single-select/features/position/index.js +4 -8
- package/build/cjs/single-select/filterable-menu.js +22 -25
- package/build/cjs/single-select/input.js +13 -14
- package/build/cjs/single-select/menu.js +9 -10
- package/build/cjs/single-select/selection.js +5 -6
- package/build/cjs/single-select/single-select.e2e.stories.js +18 -28
- package/build/cjs/single-select/single-select.js +29 -30
- package/build/cjs/single-select/single-select.prod.stories.js +7 -11
- package/build/cjs/single-select-option/single-select-option.js +25 -28
- package/build/es/locales/index.js +70 -33
- package/build/es/multi-select/features/menu_width_matches_input/index.js +2 -4
- package/build/es/multi-select/features/position/index.js +6 -12
- package/build/es/multi-select/filterable-menu.js +22 -25
- package/build/es/multi-select/input.js +14 -15
- package/build/es/multi-select/menu.js +24 -28
- package/build/es/multi-select/multi-select.e2e.stories.js +20 -30
- package/build/es/multi-select/multi-select.js +30 -31
- package/build/es/multi-select/multi-select.prod.stories.js +12 -19
- package/build/es/multi-select/selection-list.js +51 -57
- package/build/es/multi-select-option/multi-select-option.js +27 -30
- package/build/es/select/debounce/debounce.js +2 -6
- package/build/es/select/empty.js +11 -14
- package/build/es/select/filter-input.js +21 -24
- package/build/es/select/filterable-menu.js +5 -6
- package/build/es/select/input-clear-button.js +28 -31
- package/build/es/select/input-placeholder.js +5 -6
- package/build/es/select/input-prefix.js +5 -6
- package/build/es/select/input-wrapper.js +13 -14
- package/build/es/select/loading.js +15 -18
- package/build/es/select/menu-wrapper.js +8 -9
- package/build/es/select/no-match.js +9 -12
- package/build/es/select/select.js +2 -2
- package/build/es/simple-single-select/__stories__/WithCustomOptions.js +16 -19
- package/build/es/simple-single-select/__stories__/WithFilterField.js +4 -7
- package/build/es/simple-single-select/__stories__/WithServerSideFilteringDemo.js +24 -34
- package/build/es/simple-single-select/__stories__/WithSimpleFilteringDemo.js +3 -4
- package/build/es/simple-single-select/__stories__/simple-single-select-server-side-filtering/CustomDataProvider.js +19 -26
- package/build/es/simple-single-select/features/keyboard-interactions.test.e2e.js +9 -18
- package/build/es/simple-single-select/features/menu-positioning.test.e2e.js +8 -16
- package/build/es/simple-single-select/menu/empty.js +8 -11
- package/build/es/simple-single-select/menu/filter.js +11 -12
- package/build/es/simple-single-select/menu/loading.js +3 -4
- package/build/es/simple-single-select/menu/menu.js +25 -26
- package/build/es/simple-single-select/menu/no-match.js +9 -12
- package/build/es/simple-single-select/menu/option.js +19 -21
- package/build/es/simple-single-select/menu/options-list.js +22 -24
- package/build/es/simple-single-select/selected-value/clear-button.js +5 -6
- package/build/es/simple-single-select/selected-value/container.js +22 -23
- package/build/es/simple-single-select/selected-value/placeholder.js +5 -6
- package/build/es/simple-single-select/selected-value/prefix.js +5 -6
- package/build/es/simple-single-select/selected-value/selected-value.js +34 -35
- package/build/es/simple-single-select/simple-single-select.js +46 -48
- package/build/es/simple-single-select/simple-single-select.test.js +13 -22
- package/build/es/simple-single-select/use-handle-key-press/use-focus-option.js +5 -6
- package/build/es/simple-single-select/use-handle-key-press/use-handle-key-press-on-combobox.js +31 -34
- package/build/es/simple-single-select/use-handle-key-press/use-handle-key-press-on-filter-input.js +11 -12
- package/build/es/simple-single-select/use-handle-key-press/use-handle-typing.js +10 -14
- package/build/es/simple-single-select/use-handle-key-press/use-highlight-first-option-on-previous-page.js +6 -7
- package/build/es/simple-single-select/use-handle-key-press/use-highlight-first-visible-option.js +5 -6
- package/build/es/simple-single-select/use-handle-key-press/use-highlight-last-option-on-next-page.js +6 -7
- package/build/es/simple-single-select/use-handle-key-press/use-highlight-last-visible-option.js +5 -6
- package/build/es/simple-single-select/use-handle-key-press/use-page-down.js +6 -7
- package/build/es/simple-single-select/use-handle-key-press/use-page-up.js +6 -7
- package/build/es/simple-single-select/use-handle-key-press/utils.js +17 -22
- package/build/es/simple-single-select-field/simple-single-select-field.js +3 -6
- package/build/es/simple-single-select-field/simple-single-select-field.test.js +3 -6
- package/build/es/single-select/features/menu_width_matches_input/index.js +2 -4
- package/build/es/single-select/features/position/index.js +4 -8
- package/build/es/single-select/filterable-menu.js +22 -25
- package/build/es/single-select/input.js +13 -14
- package/build/es/single-select/menu.js +9 -10
- package/build/es/single-select/selection.js +5 -6
- package/build/es/single-select/single-select.e2e.stories.js +17 -26
- package/build/es/single-select/single-select.js +29 -30
- package/build/es/single-select/single-select.prod.stories.js +6 -9
- package/build/es/single-select-option/single-select-option.js +25 -28
- package/package.json +15 -15
- package/src/locales/index.js +102 -33
|
@@ -41,37 +41,74 @@ import viTranslations from './vi/translations.json';
|
|
|
41
41
|
import zhTranslations from './zh/translations.json';
|
|
42
42
|
import zh_CNTranslations from './zh_CN/translations.json';
|
|
43
43
|
const namespace = 'default';
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
i18n.
|
|
49
|
-
i18n.
|
|
50
|
-
i18n.
|
|
51
|
-
i18n.
|
|
52
|
-
i18n.
|
|
53
|
-
i18n.
|
|
54
|
-
i18n.
|
|
55
|
-
i18n.
|
|
56
|
-
i18n.
|
|
57
|
-
i18n.
|
|
58
|
-
i18n.
|
|
59
|
-
i18n.
|
|
60
|
-
i18n.
|
|
61
|
-
i18n.
|
|
62
|
-
i18n.
|
|
63
|
-
i18n.
|
|
64
|
-
i18n.
|
|
65
|
-
i18n.
|
|
66
|
-
i18n.
|
|
67
|
-
i18n.
|
|
68
|
-
i18n.
|
|
69
|
-
i18n.
|
|
70
|
-
i18n.
|
|
71
|
-
i18n.
|
|
72
|
-
i18n.
|
|
73
|
-
i18n.
|
|
74
|
-
i18n.
|
|
75
|
-
i18n.
|
|
76
|
-
i18n.
|
|
44
|
+
|
|
45
|
+
// Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
|
|
46
|
+
// custom translations from the datastore (added by the app adapter)
|
|
47
|
+
|
|
48
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
|
|
49
|
+
i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
|
|
50
|
+
i18n.addResourceBundle('ar_IQ', namespace, ar_IQTranslations, true, false);
|
|
51
|
+
i18n.addResourceBundle('ar-IQ', namespace, ar_IQTranslations, true, false);
|
|
52
|
+
i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
|
|
53
|
+
i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
|
|
54
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
|
|
55
|
+
i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
|
|
56
|
+
i18n.addResourceBundle('da', namespace, daTranslations, true, false);
|
|
57
|
+
i18n.addResourceBundle('da', namespace, daTranslations, true, false);
|
|
58
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false);
|
|
59
|
+
i18n.addResourceBundle('en', namespace, enTranslations, true, false);
|
|
60
|
+
i18n.addResourceBundle('en_US', namespace, en_USTranslations, true, false);
|
|
61
|
+
i18n.addResourceBundle('en-US', namespace, en_USTranslations, true, false);
|
|
62
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false);
|
|
63
|
+
i18n.addResourceBundle('es', namespace, esTranslations, true, false);
|
|
64
|
+
i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false);
|
|
65
|
+
i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false);
|
|
66
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
|
|
67
|
+
i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
|
|
68
|
+
i18n.addResourceBundle('hi_IN', namespace, hi_INTranslations, true, false);
|
|
69
|
+
i18n.addResourceBundle('hi-IN', namespace, hi_INTranslations, true, false);
|
|
70
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false);
|
|
71
|
+
i18n.addResourceBundle('id', namespace, idTranslations, true, false);
|
|
72
|
+
i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
|
|
73
|
+
i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
|
|
74
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
|
|
75
|
+
i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
|
|
76
|
+
i18n.addResourceBundle('my', namespace, myTranslations, true, false);
|
|
77
|
+
i18n.addResourceBundle('my', namespace, myTranslations, true, false);
|
|
78
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
|
|
79
|
+
i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
|
|
80
|
+
i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
|
|
81
|
+
i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
|
|
82
|
+
i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
|
|
83
|
+
i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
|
|
84
|
+
i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
|
|
85
|
+
i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
|
|
86
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
|
|
87
|
+
i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
|
|
88
|
+
i18n.addResourceBundle('pt_BR', namespace, pt_BRTranslations, true, false);
|
|
89
|
+
i18n.addResourceBundle('pt-BR', namespace, pt_BRTranslations, true, false);
|
|
90
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
|
|
91
|
+
i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
|
|
92
|
+
i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
|
|
93
|
+
i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
|
|
94
|
+
i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
|
|
95
|
+
i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
|
|
96
|
+
i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
|
|
97
|
+
i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
|
|
98
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
|
|
99
|
+
i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
|
|
100
|
+
i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
|
|
101
|
+
i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
|
|
102
|
+
i18n.addResourceBundle('uz_Latn', namespace, uz_LatnTranslations, true, false);
|
|
103
|
+
i18n.addResourceBundle('uz-Latn', namespace, uz_LatnTranslations, true, false);
|
|
104
|
+
i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false);
|
|
105
|
+
i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false);
|
|
106
|
+
i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false);
|
|
107
|
+
i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false);
|
|
108
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
|
|
109
|
+
i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
|
|
110
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
|
|
111
|
+
i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
|
|
112
|
+
i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false);
|
|
113
|
+
i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false);
|
|
77
114
|
export default i18n;
|
|
@@ -23,8 +23,7 @@ When('the MultiSelect menu is open', () => {
|
|
|
23
23
|
Then('the MultiSelect input is left aligned with the menu', () => {
|
|
24
24
|
const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
|
|
25
25
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
26
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
27
|
-
let [inputs, menus] = _ref;
|
|
26
|
+
cy.getAll(selectDataTest, menuDataTest).should(([inputs, menus]) => {
|
|
28
27
|
expect(inputs.length).to.equal(1);
|
|
29
28
|
expect(menus.length).to.equal(1);
|
|
30
29
|
const $input = inputs[0];
|
|
@@ -37,8 +36,7 @@ Then('the MultiSelect input is left aligned with the menu', () => {
|
|
|
37
36
|
When('the MultiSelect input and menu have the same width', () => {
|
|
38
37
|
const inputSelector = '[data-test="dhis2-uicore-select"]';
|
|
39
38
|
const menuSelector = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
40
|
-
cy.getAll(inputSelector, menuSelector).should(
|
|
41
|
-
let [$input, $menu] = _ref2;
|
|
39
|
+
cy.getAll(inputSelector, menuSelector).should(([$input, $menu]) => {
|
|
42
40
|
const inputWidth = Math.round($input.outerWidth());
|
|
43
41
|
const menuWidth = Math.round($menu.outerWidth());
|
|
44
42
|
expect(inputWidth).to.equal(menuWidth);
|
|
@@ -31,8 +31,7 @@ When('an option is clicked', () => {
|
|
|
31
31
|
Then('the Input remains the same height', () => {
|
|
32
32
|
const emptyInputHeight = '@emptyInputHeight';
|
|
33
33
|
const inputDataTest = '[data-test="dhis2-uicore-select-input"]';
|
|
34
|
-
cy.getAll(emptyInputHeight, inputDataTest).should(
|
|
35
|
-
let [emptyInputHeight, inputs] = _ref;
|
|
34
|
+
cy.getAll(emptyInputHeight, inputDataTest).should(([emptyInputHeight, inputs]) => {
|
|
36
35
|
expect(inputs.length).to.equal(1);
|
|
37
36
|
const $input = inputs[0];
|
|
38
37
|
const inputRect = $input.getBoundingClientRect();
|
|
@@ -42,8 +41,7 @@ Then('the Input remains the same height', () => {
|
|
|
42
41
|
Then('the top of the menu is aligned with the bottom of the input', () => {
|
|
43
42
|
const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
|
|
44
43
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
45
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
46
|
-
let [selects, menus] = _ref2;
|
|
44
|
+
cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
|
|
47
45
|
expect(selects.length).to.equal(1);
|
|
48
46
|
expect(menus.length).to.equal(1);
|
|
49
47
|
const $select = selects[0];
|
|
@@ -56,8 +54,7 @@ Then('the top of the menu is aligned with the bottom of the input', () => {
|
|
|
56
54
|
Then('the bottom of the menu is aligned with the top of the input', () => {
|
|
57
55
|
const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
|
|
58
56
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
59
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
60
|
-
let [selects, menus] = _ref3;
|
|
57
|
+
cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
|
|
61
58
|
expect(selects.length).to.equal(1);
|
|
62
59
|
expect(menus.length).to.equal(1);
|
|
63
60
|
const $select = selects[0];
|
|
@@ -70,8 +67,7 @@ Then('the bottom of the menu is aligned with the top of the input', () => {
|
|
|
70
67
|
Then('it is rendered on top of the MultiSelect', () => {
|
|
71
68
|
const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
|
|
72
69
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
73
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
74
|
-
let [selects, menus] = _ref4;
|
|
70
|
+
cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
|
|
75
71
|
expect(selects.length).to.equal(1);
|
|
76
72
|
expect(menus.length).to.equal(1);
|
|
77
73
|
const $select = selects[0];
|
|
@@ -85,8 +81,7 @@ Then('it is rendered on top of the MultiSelect', () => {
|
|
|
85
81
|
Then('the left of the Menu is aligned with the left of the Input', () => {
|
|
86
82
|
const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
|
|
87
83
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
88
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
89
|
-
let [selects, menus] = _ref5;
|
|
84
|
+
cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
|
|
90
85
|
expect(selects.length).to.equal(1);
|
|
91
86
|
expect(menus.length).to.equal(1);
|
|
92
87
|
const $select = selects[0];
|
|
@@ -99,8 +94,7 @@ Then('the left of the Menu is aligned with the left of the Input', () => {
|
|
|
99
94
|
Then('the Menu and the Input have an equal width', () => {
|
|
100
95
|
const inputDataTest = '[data-test="dhis2-uicore-multiselect"] .root-input';
|
|
101
96
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
102
|
-
cy.getAll(inputDataTest, menuDataTest).should(
|
|
103
|
-
let [inputs, menus] = _ref6;
|
|
97
|
+
cy.getAll(inputDataTest, menuDataTest).should(([inputs, menus]) => {
|
|
104
98
|
expect(inputs.length).to.equal(1);
|
|
105
99
|
expect(menus.length).to.equal(1);
|
|
106
100
|
const $input = inputs[0];
|
|
@@ -2,31 +2,28 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FilterableMenu as CommonFilterableMenu } from '../select/index.js';
|
|
4
4
|
import { Menu } from './menu.js';
|
|
5
|
-
const FilterableMenu =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Menu: Menu
|
|
28
|
-
});
|
|
29
|
-
};
|
|
5
|
+
const FilterableMenu = ({
|
|
6
|
+
dataTest,
|
|
7
|
+
options,
|
|
8
|
+
onChange,
|
|
9
|
+
selected,
|
|
10
|
+
empty,
|
|
11
|
+
handleClose,
|
|
12
|
+
handleFocusInput,
|
|
13
|
+
placeholder,
|
|
14
|
+
noMatchText
|
|
15
|
+
}) => /*#__PURE__*/React.createElement(CommonFilterableMenu, {
|
|
16
|
+
dataTest: dataTest,
|
|
17
|
+
options: options,
|
|
18
|
+
onChange: onChange,
|
|
19
|
+
selected: selected,
|
|
20
|
+
empty: empty,
|
|
21
|
+
handleClose: handleClose,
|
|
22
|
+
handleFocusInput: handleFocusInput,
|
|
23
|
+
placeholder: placeholder,
|
|
24
|
+
noMatchText: noMatchText,
|
|
25
|
+
Menu: Menu
|
|
26
|
+
});
|
|
30
27
|
FilterableMenu.propTypes = {
|
|
31
28
|
dataTest: PropTypes.string.isRequired,
|
|
32
29
|
noMatchText: PropTypes.string.isRequired,
|
|
@@ -7,21 +7,20 @@ import React from 'react';
|
|
|
7
7
|
import i18n from '../locales/index.js';
|
|
8
8
|
import { InputClearButton, InputPlaceholder, InputPrefix } from '../select/index.js';
|
|
9
9
|
import { SelectionList } from './selection-list.js';
|
|
10
|
-
const Input =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
10
|
+
const Input = ({
|
|
11
|
+
selected,
|
|
12
|
+
onChange,
|
|
13
|
+
clearable,
|
|
14
|
+
clearText,
|
|
15
|
+
placeholder,
|
|
16
|
+
dataTest,
|
|
17
|
+
prefix,
|
|
18
|
+
options,
|
|
19
|
+
className,
|
|
20
|
+
disabled,
|
|
21
|
+
inputMaxHeight = '100px',
|
|
22
|
+
collapseSelectionAfter
|
|
23
|
+
}) => {
|
|
25
24
|
const hasSelection = selected.length > 0;
|
|
26
25
|
const shouldCollapse = hasSelection && typeof collapseSelectionAfter === 'number' && selected.length > collapseSelectionAfter;
|
|
27
26
|
const onClear = e => {
|
|
@@ -5,40 +5,36 @@ const onDisabledClick = (_, e) => {
|
|
|
5
5
|
e.stopPropagation();
|
|
6
6
|
e.preventDefault();
|
|
7
7
|
};
|
|
8
|
-
const createHandler =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return (_, e) => {
|
|
16
|
-
e.stopPropagation();
|
|
17
|
-
|
|
18
|
-
// If the option is currently selected remove it from the array of selected options
|
|
19
|
-
if (isActive) {
|
|
20
|
-
const filtered = removeOption(value, selected);
|
|
21
|
-
const data = {
|
|
22
|
-
selected: filtered
|
|
23
|
-
};
|
|
24
|
-
return onChange(data, e);
|
|
25
|
-
}
|
|
8
|
+
const createHandler = ({
|
|
9
|
+
isActive,
|
|
10
|
+
onChange,
|
|
11
|
+
selected,
|
|
12
|
+
value
|
|
13
|
+
}) => (_, e) => {
|
|
14
|
+
e.stopPropagation();
|
|
26
15
|
|
|
27
|
-
|
|
16
|
+
// If the option is currently selected remove it from the array of selected options
|
|
17
|
+
if (isActive) {
|
|
18
|
+
const filtered = removeOption(value, selected);
|
|
28
19
|
const data = {
|
|
29
|
-
selected:
|
|
20
|
+
selected: filtered
|
|
30
21
|
};
|
|
31
22
|
return onChange(data, e);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Otherwise, add it to selected
|
|
26
|
+
const data = {
|
|
27
|
+
selected: selected.concat([value])
|
|
32
28
|
};
|
|
29
|
+
return onChange(data, e);
|
|
33
30
|
};
|
|
34
|
-
const Menu =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref2;
|
|
31
|
+
const Menu = ({
|
|
32
|
+
options,
|
|
33
|
+
onChange,
|
|
34
|
+
selected,
|
|
35
|
+
empty = '',
|
|
36
|
+
dataTest
|
|
37
|
+
}) => {
|
|
42
38
|
const renderedOptions = filterIgnored(options);
|
|
43
39
|
if (React.Children.count(renderedOptions) === 0) {
|
|
44
40
|
// If it's a string, supply it to our <Empty> component so it looks better
|
|
@@ -8,15 +8,12 @@ import { MultiSelect } from './multi-select.js';
|
|
|
8
8
|
window.onChange = window.Cypress && window.Cypress.cy.stub();
|
|
9
9
|
window.onFocus = window.Cypress && window.Cypress.cy.stub();
|
|
10
10
|
window.onBlur = window.Cypress && window.Cypress.cy.stub();
|
|
11
|
-
const CustomMultiSelectOption =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
onClick: e => onClick({}, e)
|
|
18
|
-
}, label);
|
|
19
|
-
};
|
|
11
|
+
const CustomMultiSelectOption = ({
|
|
12
|
+
label,
|
|
13
|
+
onClick
|
|
14
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
onClick: e => onClick({}, e)
|
|
16
|
+
}, label);
|
|
20
17
|
CustomMultiSelectOption.propTypes = {
|
|
21
18
|
label: PropTypes.string,
|
|
22
19
|
onClick: PropTypes.func
|
|
@@ -562,10 +559,9 @@ export const WithOptionsThatCanBeAddedToTheInput = () => {
|
|
|
562
559
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
563
560
|
className: "select",
|
|
564
561
|
selected: values,
|
|
565
|
-
onChange:
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
} = _ref2;
|
|
562
|
+
onChange: ({
|
|
563
|
+
selected
|
|
564
|
+
}) => {
|
|
569
565
|
window.onChange && window.onChange({
|
|
570
566
|
selected
|
|
571
567
|
});
|
|
@@ -605,23 +601,17 @@ export const MenuWidthChanging = () => {
|
|
|
605
601
|
flexGrow: 1
|
|
606
602
|
}
|
|
607
603
|
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
608
|
-
onChange:
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
return /*#__PURE__*/React.createElement(MultiSelectOption, {
|
|
620
|
-
key: id,
|
|
621
|
-
value: id,
|
|
622
|
-
label: name
|
|
623
|
-
});
|
|
624
|
-
}))), toggle && /*#__PURE__*/React.createElement("div", {
|
|
604
|
+
onChange: ({
|
|
605
|
+
selected
|
|
606
|
+
}) => console.log('size changed to ' + selected)
|
|
607
|
+
}, options.map(({
|
|
608
|
+
name,
|
|
609
|
+
id
|
|
610
|
+
}) => /*#__PURE__*/React.createElement(MultiSelectOption, {
|
|
611
|
+
key: id,
|
|
612
|
+
value: id,
|
|
613
|
+
label: name
|
|
614
|
+
})))), toggle && /*#__PURE__*/React.createElement("div", {
|
|
625
615
|
style: {
|
|
626
616
|
padding: '30px',
|
|
627
617
|
border: '1px solid green'
|
|
@@ -11,37 +11,36 @@ import { Menu } from './menu.js';
|
|
|
11
11
|
|
|
12
12
|
// stable object reference
|
|
13
13
|
const staticArr = [];
|
|
14
|
-
const MultiSelect =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = _ref;
|
|
14
|
+
const MultiSelect = ({
|
|
15
|
+
className,
|
|
16
|
+
selected = staticArr,
|
|
17
|
+
tabIndex,
|
|
18
|
+
maxHeight,
|
|
19
|
+
inputMaxHeight,
|
|
20
|
+
onChange,
|
|
21
|
+
onFocus,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
onBlur,
|
|
24
|
+
loading,
|
|
25
|
+
error,
|
|
26
|
+
warning,
|
|
27
|
+
valid,
|
|
28
|
+
disabled,
|
|
29
|
+
children,
|
|
30
|
+
clearable,
|
|
31
|
+
clearText,
|
|
32
|
+
filterable,
|
|
33
|
+
filterPlaceholder,
|
|
34
|
+
placeholder,
|
|
35
|
+
prefix,
|
|
36
|
+
empty,
|
|
37
|
+
loadingText,
|
|
38
|
+
noMatchText,
|
|
39
|
+
initialFocus,
|
|
40
|
+
dense,
|
|
41
|
+
collapseSelectionAfter,
|
|
42
|
+
dataTest = 'dhis2-uicore-multiselect'
|
|
43
|
+
}) => {
|
|
45
44
|
// If the select is filterable, use a filterable menu
|
|
46
45
|
const menu = filterable ? /*#__PURE__*/React.createElement(FilterableMenu, {
|
|
47
46
|
dataTest: dataTest,
|
|
@@ -24,15 +24,12 @@ const eventHandler = handlerName => (payload, event) => {
|
|
|
24
24
|
const onChange = eventHandler('onChange');
|
|
25
25
|
const onFocus = eventHandler('onFocus');
|
|
26
26
|
const onBlur = eventHandler('onBlur');
|
|
27
|
-
const CustomMultiSelectOption =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onClick: e => onClick({}, e)
|
|
34
|
-
}, label);
|
|
35
|
-
};
|
|
27
|
+
const CustomMultiSelectOption = ({
|
|
28
|
+
label,
|
|
29
|
+
onClick
|
|
30
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
onClick: e => onClick({}, e)
|
|
32
|
+
}, label);
|
|
36
33
|
CustomMultiSelectOption.propTypes = {
|
|
37
34
|
label: PropTypes.string,
|
|
38
35
|
onClick: PropTypes.func
|
|
@@ -333,10 +330,9 @@ export const WithMultipleSelectionsWrapped = () => {
|
|
|
333
330
|
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
334
331
|
className: "select",
|
|
335
332
|
selected: selected,
|
|
336
|
-
onChange:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
} = _ref2;
|
|
333
|
+
onChange: ({
|
|
334
|
+
selected
|
|
335
|
+
}) => {
|
|
340
336
|
console.log({
|
|
341
337
|
selected
|
|
342
338
|
});
|
|
@@ -503,12 +499,9 @@ export const CollapseSelectionAfterThreshold = () => {
|
|
|
503
499
|
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
504
500
|
className: "select",
|
|
505
501
|
selected: selected,
|
|
506
|
-
onChange:
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
} = _ref3;
|
|
510
|
-
return setSelected(selected);
|
|
511
|
-
},
|
|
502
|
+
onChange: ({
|
|
503
|
+
selected
|
|
504
|
+
}) => setSelected(selected),
|
|
512
505
|
collapseSelectionAfter: 2,
|
|
513
506
|
prefix: "Prefix text",
|
|
514
507
|
clearable: true,
|