@jetbrains/ring-ui-built 7.0.0-beta.2 → 7.0.0-beta.4
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/components/_helpers/_rollupPluginBabelHelpers.js +1 -504
- package/components/_helpers/anchor.js +7 -10
- package/components/_helpers/button__classes.js +15 -13
- package/components/_helpers/caption.js +11 -21
- package/components/_helpers/card.js +91 -123
- package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
- package/components/_helpers/icon__svg.js +27 -29
- package/components/_helpers/input.js +150 -192
- package/components/_helpers/query-assist__suggestions.js +78 -93
- package/components/_helpers/select__filter.js +56 -75
- package/components/_helpers/services-link.js +23 -39
- package/components/_helpers/sidebar.js +91 -102
- package/components/_helpers/tab-link.js +8 -12
- package/components/_helpers/theme.js +42 -51
- package/components/_helpers/title.js +59 -84
- package/components/alert/alert.d.ts +7 -24
- package/components/alert/alert.js +111 -179
- package/components/alert/container.d.ts +0 -5
- package/components/alert/container.js +32 -44
- package/components/alert-service/alert-service.js +104 -162
- package/components/analytics/analytics.js +12 -20
- package/components/analytics/analytics__custom-plugin.js +52 -68
- package/components/auth/auth.js +2 -28
- package/components/auth/auth__core.d.ts +4 -4
- package/components/auth/auth__core.js +753 -1431
- package/components/auth/background-flow.js +84 -121
- package/components/auth/down-notification.js +31 -78
- package/components/auth/iframe-flow.js +70 -124
- package/components/auth/request-builder.js +46 -77
- package/components/auth/response-parser.js +84 -112
- package/components/auth/storage.js +160 -319
- package/components/auth/token-validator.js +132 -227
- package/components/auth/window-flow.js +84 -121
- package/components/auth-dialog/auth-dialog.d.ts +0 -18
- package/components/auth-dialog/auth-dialog.js +106 -175
- package/components/auth-dialog-service/auth-dialog-service.js +10 -31
- package/components/avatar/avatar-example-datauri.js +1 -1
- package/components/avatar/avatar.d.ts +0 -13
- package/components/avatar/avatar.js +94 -136
- package/components/avatar/fallback-avatar.d.ts +1 -10
- package/components/avatar/fallback-avatar.js +20 -40
- package/components/badge/badge.d.ts +0 -10
- package/components/badge/badge.js +32 -48
- package/components/breadcrumbs/breadcrumbs.js +13 -17
- package/components/button/button.d.ts +0 -21
- package/components/button/button.js +67 -101
- package/components/button-group/button-group.d.ts +0 -5
- package/components/button-group/button-group.js +27 -41
- package/components/button-group/caption.d.ts +0 -4
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.d.ts +0 -6
- package/components/button-set/button-set.js +19 -33
- package/components/button-toolbar/button-toolbar.d.ts +0 -6
- package/components/button-toolbar/button-toolbar.js +17 -31
- package/components/caret/caret.js +184 -211
- package/components/checkbox/checkbox.d.ts +0 -19
- package/components/checkbox/checkbox.js +69 -104
- package/components/clipboard/clipboard-fallback.js +7 -7
- package/components/clipboard/clipboard.js +36 -129
- package/components/code/code.d.ts +0 -12
- package/components/code/code.js +83 -163
- package/components/collapse/collapse-content.js +42 -60
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +12 -12
- package/components/collapse/collapse.js +12 -17
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +1 -3
- package/components/confirm/confirm.d.ts +0 -14
- package/components/confirm/confirm.js +67 -111
- package/components/confirm-service/confirm-service.js +23 -45
- package/components/content-layout/content-layout.d.ts +0 -7
- package/components/content-layout/content-layout.js +41 -63
- package/components/content-layout/sidebar.d.ts +0 -9
- package/components/content-layout/sidebar.js +1 -2
- package/components/contenteditable/contenteditable.d.ts +1 -22
- package/components/contenteditable/contenteditable.js +37 -60
- package/components/control-help/control-help.js +5 -3
- package/components/control-label/control-label.js +9 -14
- package/components/data-list/data-list.d.ts +0 -2
- package/components/data-list/data-list.js +115 -179
- package/components/data-list/data-list.mock.js +3 -6
- package/components/data-list/item.js +118 -164
- package/components/data-list/selection.js +77 -135
- package/components/data-list/title.d.ts +2 -2
- package/components/data-list/title.js +2 -12
- package/components/date-picker/consts.d.ts +0 -2
- package/components/date-picker/consts.js +16 -24
- package/components/date-picker/date-input.d.ts +0 -20
- package/components/date-picker/date-input.js +99 -147
- package/components/date-picker/date-picker.d.ts +0 -29
- package/components/date-picker/date-picker.js +143 -224
- package/components/date-picker/date-popup.d.ts +0 -22
- package/components/date-picker/date-popup.js +281 -351
- package/components/date-picker/day.d.ts +0 -14
- package/components/date-picker/day.js +72 -109
- package/components/date-picker/month-names.d.ts +1 -11
- package/components/date-picker/month-names.js +42 -72
- package/components/date-picker/month-slider.d.ts +0 -9
- package/components/date-picker/month-slider.js +43 -71
- package/components/date-picker/month.d.ts +1 -9
- package/components/date-picker/month.js +18 -30
- package/components/date-picker/months.d.ts +1 -9
- package/components/date-picker/months.js +45 -55
- package/components/date-picker/weekdays.d.ts +2 -8
- package/components/date-picker/weekdays.js +12 -25
- package/components/date-picker/years.d.ts +0 -6
- package/components/date-picker/years.js +77 -104
- package/components/dialog/dialog.d.ts +0 -20
- package/components/dialog/dialog.js +152 -210
- package/components/dialog/dialog__body-scroll-preventer.js +0 -3
- package/components/dropdown/anchor.d.ts +1 -8
- package/components/dropdown/anchor.js +0 -7
- package/components/dropdown/dropdown.d.ts +4 -22
- package/components/dropdown/dropdown.js +134 -176
- package/components/dropdown-menu/dropdown-menu.js +51 -103
- package/components/editable-heading/editable-heading.js +69 -118
- package/components/error-bubble/error-bubble.d.ts +0 -6
- package/components/error-bubble/error-bubble.js +29 -60
- package/components/error-message/error-message.d.ts +0 -10
- package/components/error-message/error-message.js +34 -59
- package/components/footer/footer.js +27 -43
- package/components/global/compose.js +1 -8
- package/components/global/composeRefs.d.ts +0 -3
- package/components/global/composeRefs.js +8 -15
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.d.ts +0 -4
- package/components/global/create-stateful-context.js +14 -17
- package/components/global/data-tests.js +7 -12
- package/components/global/dom.js +49 -82
- package/components/global/focus-sensor-hoc.js +95 -122
- package/components/global/fuzzy-highlight.js +23 -34
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +3 -7
- package/components/global/inject-styles.js +7 -14
- package/components/global/listeners.js +28 -47
- package/components/global/memoize.js +6 -10
- package/components/global/normalize-indent.js +19 -46
- package/components/global/promise-with-timeout.js +6 -8
- package/components/global/react-dom-renderer.d.ts +0 -5
- package/components/global/react-dom-renderer.js +29 -45
- package/components/global/rerender-hoc.js +16 -32
- package/components/global/schedule-raf.js +4 -4
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.d.ts +1 -0
- package/components/global/theme.js +2 -20
- package/components/global/trivial-template-tag.js +4 -9
- package/components/global/typescript-utils.js +2 -6
- package/components/global/url.js +20 -23
- package/components/global/use-event-callback.js +7 -4
- package/components/grid/col.d.ts +0 -14
- package/components/grid/col.js +26 -53
- package/components/grid/grid.d.ts +0 -5
- package/components/grid/grid.js +18 -32
- package/components/grid/row.d.ts +0 -18
- package/components/grid/row.js +22 -47
- package/components/group/group.d.ts +0 -5
- package/components/group/group.js +16 -27
- package/components/header/header-icon.d.ts +0 -22
- package/components/header/header-icon.js +19 -36
- package/components/header/header.d.ts +0 -7
- package/components/header/header.js +30 -71
- package/components/header/links.js +6 -3
- package/components/header/logo.d.ts +0 -4
- package/components/header/logo.js +15 -30
- package/components/header/profile.d.ts +1 -39
- package/components/header/profile.js +125 -190
- package/components/header/services-link.d.ts +0 -10
- package/components/header/services-link.js +1 -4
- package/components/header/services.d.ts +0 -14
- package/components/header/services.js +65 -110
- package/components/header/smart-profile.d.ts +0 -9
- package/components/header/smart-profile.js +119 -205
- package/components/header/smart-services.d.ts +0 -4
- package/components/header/smart-services.js +72 -141
- package/components/header/tray.d.ts +0 -5
- package/components/header/tray.js +21 -35
- package/components/heading/heading.js +21 -26
- package/components/http/http.js +162 -319
- package/components/http/http.mock.js +50 -98
- package/components/hub-source/hub-source.js +77 -182
- package/components/hub-source/hub-source__user.js +9 -37
- package/components/hub-source/hub-source__users-groups.js +34 -60
- package/components/i18n/i18n-context.js +7 -8
- package/components/i18n/i18n.js +3 -6
- package/components/icon/icon.d.ts +0 -11
- package/components/icon/icon.js +60 -85
- package/components/icon/icon__svg.d.ts +0 -8
- package/components/icon/icon__svg.js +0 -6
- package/components/icon/index.js +0 -6
- package/components/input/input.js +1 -13
- package/components/island/adaptive-island-hoc.d.ts +0 -1
- package/components/island/adaptive-island-hoc.js +30 -39
- package/components/island/content.d.ts +0 -10
- package/components/island/content.js +99 -119
- package/components/island/header.js +55 -73
- package/components/island/island.d.ts +0 -9
- package/components/island/island.js +25 -41
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +16 -27
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +19 -30
- package/components/island-legacy/island-legacy.d.ts +0 -5
- package/components/island-legacy/island-legacy.js +16 -27
- package/components/link/clickableLink.d.ts +0 -9
- package/components/link/clickableLink.js +33 -51
- package/components/link/link.d.ts +0 -25
- package/components/link/link.js +47 -68
- package/components/list/consts.js +2 -2
- package/components/list/list.d.ts +0 -32
- package/components/list/list.js +399 -516
- package/components/list/list__custom.js +51 -78
- package/components/list/list__hint.d.ts +0 -4
- package/components/list/list__hint.js +8 -21
- package/components/list/list__item.js +147 -211
- package/components/list/list__link.js +39 -59
- package/components/list/list__separator.js +15 -30
- package/components/list/list__title.js +25 -41
- package/components/list/list__users-groups-source.js +55 -123
- package/components/loader/loader.d.ts +0 -10
- package/components/loader/loader.js +38 -70
- package/components/loader/loader__core.js +123 -184
- package/components/loader-inline/loader-inline.d.ts +0 -6
- package/components/loader-inline/loader-inline.js +24 -38
- package/components/loader-screen/loader-screen.d.ts +0 -6
- package/components/loader-screen/loader-screen.js +24 -46
- package/components/login-dialog/login-dialog.d.ts +0 -11
- package/components/login-dialog/login-dialog.js +93 -144
- package/components/login-dialog/service.js +9 -31
- package/components/markdown/markdown.js +16 -29
- package/components/message/message.js +170 -217
- package/components/old-browsers-message/old-browsers-message.js +11 -14
- package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
- package/components/old-browsers-message/white-list.js +8 -13
- package/components/pager/pager.js +212 -277
- package/components/panel/panel.d.ts +0 -5
- package/components/panel/panel.js +16 -27
- package/components/permissions/permissions.js +118 -161
- package/components/permissions/permissions__cache.js +191 -218
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +237 -329
- package/components/popup/popup.target.js +9 -12
- package/components/popup/position.js +94 -101
- package/components/popup-menu/popup-menu.js +31 -76
- package/components/progress-bar/progress-bar.d.ts +19 -33
- package/components/progress-bar/progress-bar.js +55 -99
- package/components/query-assist/query-assist.d.ts +63 -93
- package/components/query-assist/query-assist.js +583 -746
- package/components/query-assist/query-assist__suggestions.js +2 -28
- package/components/radio/radio.d.ts +0 -8
- package/components/radio/radio.js +15 -35
- package/components/radio/radio__item.d.ts +0 -9
- package/components/radio/radio__item.js +52 -72
- package/components/scrollable-section/scrollable-section.js +22 -32
- package/components/select/select.js +693 -858
- package/components/select/select__filter.js +1 -28
- package/components/select/select__popup.js +317 -465
- package/components/shortcuts/core.js +147 -195
- package/components/shortcuts/shortcut-title.js +6 -10
- package/components/shortcuts/shortcuts-hoc.d.ts +0 -5
- package/components/shortcuts/shortcuts-hoc.js +23 -46
- package/components/shortcuts/shortcuts.d.ts +0 -8
- package/components/shortcuts/shortcuts.js +41 -72
- package/components/slider/slider.js +93 -113
- package/components/slider/slider.utils.js +16 -23
- package/components/storage/storage.js +3 -28
- package/components/storage/storage__fallback.js +137 -210
- package/components/storage/storage__local.js +89 -148
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +35 -61
- package/components/table/cell.d.ts +0 -6
- package/components/table/cell.js +11 -27
- package/components/table/disable-hover-hoc.d.ts +0 -1
- package/components/table/disable-hover-hoc.js +27 -42
- package/components/table/header-cell.d.ts +0 -10
- package/components/table/header-cell.js +59 -85
- package/components/table/header.d.ts +0 -15
- package/components/table/header.js +89 -126
- package/components/table/multitable.d.ts +0 -4
- package/components/table/multitable.js +83 -93
- package/components/table/row-with-focus-sensor.d.ts +2 -2
- package/components/table/row-with-focus-sensor.js +25 -60
- package/components/table/row.js +169 -235
- package/components/table/selection-adapter.js +2 -2
- package/components/table/selection-shortcuts-hoc.js +102 -126
- package/components/table/selection.js +150 -217
- package/components/table/simple-table.d.ts +0 -44
- package/components/table/simple-table.js +17 -59
- package/components/table/smart-table.d.ts +0 -48
- package/components/table/smart-table.js +40 -83
- package/components/table/table.d.ts +0 -2
- package/components/table/table.js +268 -377
- package/components/tabs/collapsible-more.d.ts +1 -9
- package/components/tabs/collapsible-more.js +47 -97
- package/components/tabs/collapsible-tab.js +32 -44
- package/components/tabs/collapsible-tabs.d.ts +2 -29
- package/components/tabs/collapsible-tabs.js +89 -161
- package/components/tabs/custom-item.d.ts +1 -7
- package/components/tabs/custom-item.js +4 -7
- package/components/tabs/dumb-tabs.d.ts +0 -11
- package/components/tabs/dumb-tabs.js +60 -104
- package/components/tabs/smart-tabs.d.ts +0 -6
- package/components/tabs/smart-tabs.js +29 -68
- package/components/tabs/tab-link.d.ts +0 -8
- package/components/tabs/tab-link.js +1 -4
- package/components/tabs/tab.d.ts +0 -8
- package/components/tabs/tab.js +14 -32
- package/components/tabs/tabs.js +1 -28
- package/components/tag/tag.d.ts +0 -19
- package/components/tag/tag.js +120 -179
- package/components/tags-input/tags-input.d.ts +7 -33
- package/components/tags-input/tags-input.js +223 -338
- package/components/tags-list/tags-list.d.ts +0 -13
- package/components/tags-list/tags-list.js +45 -74
- package/components/text/text.d.ts +0 -7
- package/components/text/text.js +27 -43
- package/components/toggle/toggle.d.ts +0 -15
- package/components/toggle/toggle.js +51 -76
- package/components/tooltip/tooltip.d.ts +0 -9
- package/components/tooltip/tooltip.js +109 -150
- package/components/user-agreement/service.js +259 -401
- package/components/user-agreement/user-agreement.d.ts +0 -18
- package/components/user-agreement/user-agreement.js +91 -137
- package/components/user-card/card.d.ts +0 -35
- package/components/user-card/card.js +1 -26
- package/components/user-card/smart-user-card-tooltip.d.ts +0 -5
- package/components/user-card/smart-user-card-tooltip.js +52 -108
- package/components/user-card/tooltip.d.ts +0 -9
- package/components/user-card/tooltip.js +35 -74
- package/components/user-card/user-card.js +1 -26
- package/package.json +1 -2
- package/components/global/prop-types.d.ts +0 -4
- package/components/global/prop-types.js +0 -9
- package/components/global/react-render-adapter.d.ts +0 -1
- package/components/global/react-render-adapter.js +0 -6
- package/components/header/tray-icon.d.ts +0 -1
- package/components/header/tray-icon.js +0 -26
@@ -1,15 +1,10 @@
|
|
1
|
-
import { _ as _defineProperty
|
2
|
-
import 'core-js/modules/es.array.concat.js';
|
3
|
-
import 'core-js/modules/es.array.filter.js';
|
4
|
-
import 'core-js/modules/es.array.index-of.js';
|
1
|
+
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
5
2
|
import 'core-js/modules/es.array.reduce.js';
|
6
|
-
import 'core-js/modules/
|
7
|
-
import 'core-js/modules/es.object.to-string.js';
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
8
4
|
import { PureComponent } from 'react';
|
9
5
|
import classNames from 'classnames';
|
10
6
|
import searchIcon from '@jetbrains/icons/search';
|
11
7
|
import memoizeOne from 'memoize-one';
|
12
|
-
import PropTypes from 'prop-types';
|
13
8
|
import Icon from '../icon/icon.js';
|
14
9
|
import Popup, { getPopupContainer } from '../popup/popup.js';
|
15
10
|
import { maxHeightForDirection } from '../popup/position.js';
|
@@ -26,39 +21,21 @@ import Shortcuts from '../shortcuts/shortcuts.js';
|
|
26
21
|
import { Button } from '../button/button.js';
|
27
22
|
import Text from '../text/text.js';
|
28
23
|
import { ControlsHeight } from '../global/controls-height.js';
|
29
|
-
import { refObject } from '../global/prop-types.js';
|
30
24
|
import { createComposedRef } from '../global/composeRefs.js';
|
31
25
|
import { DEFAULT_DIRECTIONS } from '../popup/popup.consts.js';
|
32
|
-
import {
|
26
|
+
import { m as modules_b607bec2, S as SelectFilter } from '../_helpers/select__filter.js';
|
33
27
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
34
28
|
import 'util-deprecate';
|
35
29
|
import '../icon/icon__constants.js';
|
36
30
|
import '../_helpers/icon__svg.js';
|
37
31
|
import 'core-js/modules/es.regexp.exec.js';
|
38
32
|
import 'core-js/modules/es.string.replace.js';
|
39
|
-
import 'core-js/modules/es.string.starts-with.js';
|
40
|
-
import 'core-js/modules/es.array.iterator.js';
|
41
|
-
import 'core-js/modules/es.map.js';
|
42
|
-
import 'core-js/modules/es.weak-map.js';
|
43
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
44
|
-
import 'core-js/modules/es.object.entries.js';
|
45
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
46
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
47
33
|
import 'react-dom';
|
48
34
|
import '../global/schedule-raf.js';
|
49
35
|
import '../global/data-tests.js';
|
50
36
|
import '../tab-trap/tab-trap.js';
|
51
|
-
import 'core-js/modules/es.array.includes.js';
|
52
|
-
import 'core-js/modules/es.array.map.js';
|
53
37
|
import 'core-js/modules/es.array.sort.js';
|
54
|
-
import 'core-js/modules/es.string.includes.js';
|
55
|
-
import 'core-js/modules/es.object.assign.js';
|
56
|
-
import 'core-js/modules/es.set.js';
|
57
|
-
import 'core-js/modules/es.string.split.js';
|
58
|
-
import 'core-js/modules/es.symbol.js';
|
59
38
|
import 'core-js/modules/es.symbol.description.js';
|
60
|
-
import 'core-js/modules/es.array.find.js';
|
61
|
-
import 'core-js/modules/es.array.find-index.js';
|
62
39
|
import 'react-virtualized/dist/es/List';
|
63
40
|
import 'react-virtualized/dist/es/AutoSizer';
|
64
41
|
import 'react-virtualized/dist/es/WindowScroller';
|
@@ -72,9 +49,7 @@ import '../_helpers/list.js';
|
|
72
49
|
import '../list/list__item.js';
|
73
50
|
import '../avatar/avatar.js';
|
74
51
|
import '../global/url.js';
|
75
|
-
import 'core-js/modules/es.string.match.js';
|
76
52
|
import '../avatar/fallback-avatar.js';
|
77
|
-
import 'core-js/modules/es.array.from.js';
|
78
53
|
import '../checkbox/checkbox.js';
|
79
54
|
import '@jetbrains/icons/checkmark-12px';
|
80
55
|
import '@jetbrains/icons/remove-12px';
|
@@ -86,7 +61,6 @@ import '../list/list__separator.js';
|
|
86
61
|
import '../list/list__hint.js';
|
87
62
|
import '../list/consts.js';
|
88
63
|
import '../shortcuts/core.js';
|
89
|
-
import 'core-js/modules/es.array.splice.js';
|
90
64
|
import 'combokeys';
|
91
65
|
import '../global/sniffer.js';
|
92
66
|
import 'sniffr';
|
@@ -95,55 +69,49 @@ import '@jetbrains/icons/close-12px';
|
|
95
69
|
import '@jetbrains/icons/chevron-down';
|
96
70
|
import '../_helpers/button__classes.js';
|
97
71
|
import '../_helpers/input.js';
|
98
|
-
import 'core-js/modules/es.object.values.js';
|
99
72
|
import '../i18n/i18n-context.js';
|
100
73
|
import '../i18n/i18n.js';
|
101
74
|
import '../control-label/control-label.js';
|
102
75
|
|
103
|
-
|
104
|
-
|
76
|
+
const FILTER_HEIGHT = 35;
|
77
|
+
const TOOLBAR_HEIGHT = 49;
|
105
78
|
function noop() {}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
112
|
-
args[_key] = arguments[_key];
|
113
|
-
}
|
114
|
-
_this = _callSuper(this, SelectPopup, [].concat(args));
|
115
|
-
_defineProperty(_this, "state", {
|
79
|
+
const FilterWithShortcuts = shortcutsHOC(SelectFilter);
|
80
|
+
class SelectPopup extends PureComponent {
|
81
|
+
constructor() {
|
82
|
+
super(...arguments);
|
83
|
+
_defineProperty(this, "state", {
|
116
84
|
popupFilterShortcutsOptions: {
|
117
85
|
modal: true,
|
118
86
|
disabled: true
|
119
87
|
},
|
120
88
|
tagsActiveIndex: null
|
121
89
|
});
|
122
|
-
_defineProperty(
|
90
|
+
_defineProperty(this, "isClickingPopup", false);
|
123
91
|
// This flag is set to true while an item in the popup is being clicked
|
124
|
-
_defineProperty(
|
125
|
-
_defineProperty(
|
126
|
-
_defineProperty(
|
127
|
-
|
128
|
-
|
92
|
+
_defineProperty(this, "filter", void 0);
|
93
|
+
_defineProperty(this, "caret", void 0);
|
94
|
+
_defineProperty(this, "onFilterFocus", () => {
|
95
|
+
this._togglePopupFilterShortcuts(false);
|
96
|
+
this.setState({
|
129
97
|
tagsActiveIndex: null
|
130
98
|
});
|
131
99
|
});
|
132
|
-
_defineProperty(
|
133
|
-
if (
|
134
|
-
|
100
|
+
_defineProperty(this, "popupFilterOnBlur", () => {
|
101
|
+
if (this.state.tagsActiveIndex === null) {
|
102
|
+
this._togglePopupFilterShortcuts(true);
|
135
103
|
}
|
136
104
|
});
|
137
|
-
_defineProperty(
|
138
|
-
|
105
|
+
_defineProperty(this, "mouseDownHandler", () => {
|
106
|
+
this.isClickingPopup = true;
|
139
107
|
});
|
140
|
-
_defineProperty(
|
141
|
-
|
108
|
+
_defineProperty(this, "mouseUpHandler", () => {
|
109
|
+
this.isClickingPopup = false;
|
142
110
|
});
|
143
|
-
_defineProperty(
|
144
|
-
_defineProperty(
|
145
|
-
|
146
|
-
|
111
|
+
_defineProperty(this, "popup", void 0);
|
112
|
+
_defineProperty(this, "onListSelect", (selected, event, opts) => {
|
113
|
+
const getSelectItemEvent = () => {
|
114
|
+
const customEvent = document.createEvent('Event');
|
147
115
|
customEvent.initEvent('select', true, false);
|
148
116
|
if (event && 'persist' in event) {
|
149
117
|
event.persist();
|
@@ -151,55 +119,45 @@ var SelectPopup = /*#__PURE__*/function (_PureComponent) {
|
|
151
119
|
customEvent.originalEvent = event;
|
152
120
|
return customEvent;
|
153
121
|
};
|
154
|
-
|
122
|
+
this.props.onSelect(selected, getSelectItemEvent(), opts);
|
155
123
|
});
|
156
|
-
_defineProperty(
|
157
|
-
|
124
|
+
_defineProperty(this, "tabPress", event => {
|
125
|
+
this.props.onCloseAttempt(event, true);
|
158
126
|
});
|
159
|
-
_defineProperty(
|
127
|
+
_defineProperty(this, "onClickHandler", () => {
|
160
128
|
var _this$filter;
|
161
|
-
return (_this$filter =
|
129
|
+
return (_this$filter = this.filter) === null || _this$filter === void 0 ? void 0 : _this$filter.focus();
|
162
130
|
});
|
163
|
-
_defineProperty(
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
if (Array.isArray(_this.props.selected)) {
|
171
|
-
_this.setState({
|
172
|
-
tagsActiveIndex: _this.props.selected.indexOf(tag)
|
173
|
-
});
|
174
|
-
}
|
175
|
-
};
|
131
|
+
_defineProperty(this, "handleRemoveTag", memoize(tag => event => this.removeTag(tag, event)));
|
132
|
+
_defineProperty(this, "handleTagClick", memoize(tag => () => {
|
133
|
+
if (Array.isArray(this.props.selected)) {
|
134
|
+
this.setState({
|
135
|
+
tagsActiveIndex: this.props.selected.indexOf(tag)
|
136
|
+
});
|
137
|
+
}
|
176
138
|
}));
|
177
|
-
_defineProperty(
|
178
|
-
|
139
|
+
_defineProperty(this, "handleListResize", () => {
|
140
|
+
this.forceUpdate();
|
179
141
|
});
|
180
|
-
_defineProperty(
|
181
|
-
if (Array.isArray(
|
182
|
-
|
183
|
-
return !item.disabled;
|
184
|
-
}).length !== _this.props.selected.length);
|
142
|
+
_defineProperty(this, "handleSelectAll", () => {
|
143
|
+
if (Array.isArray(this.props.selected)) {
|
144
|
+
this.props.onSelectAll(this.props.data.filter(item => !item.disabled).length !== this.props.selected.length);
|
185
145
|
}
|
186
146
|
});
|
187
|
-
_defineProperty(
|
147
|
+
_defineProperty(this, "getSelectAll", () => {
|
188
148
|
var _multiple$renderSelec;
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
});
|
193
|
-
return Array.isArray(_this.props.selected) && /*#__PURE__*/jsxs("div", {
|
149
|
+
const multiple = this.props.multiple;
|
150
|
+
const activeFilters = this.props.data.filter(item => !item.disabled);
|
151
|
+
return Array.isArray(this.props.selected) && /*#__PURE__*/jsxs("div", {
|
194
152
|
className: modules_b607bec2.selectAll,
|
195
153
|
children: [activeFilters.length === 0 ? /*#__PURE__*/jsx("span", {}) : /*#__PURE__*/jsx(Button, {
|
196
154
|
text: true,
|
197
155
|
inline: true,
|
198
|
-
onClick:
|
199
|
-
children: activeFilters.length !==
|
200
|
-
}), ((_multiple$renderSelec = multiple.renderSelectedItemsDescription) === null || _multiple$renderSelec === void 0 ? void 0 : _multiple$renderSelec.call(multiple,
|
156
|
+
onClick: this.handleSelectAll,
|
157
|
+
children: activeFilters.length !== this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'
|
158
|
+
}), ((_multiple$renderSelec = multiple.renderSelectedItemsDescription) === null || _multiple$renderSelec === void 0 ? void 0 : _multiple$renderSelec.call(multiple, this.props.selected, activeFilters.length)) || /*#__PURE__*/jsx(Text, {
|
201
159
|
info: true,
|
202
|
-
children: "".concat(
|
160
|
+
children: "".concat(this.props.selected.length, " selected")
|
203
161
|
})]
|
204
162
|
});
|
205
163
|
});
|
@@ -207,369 +165,312 @@ var SelectPopup = /*#__PURE__*/function (_PureComponent) {
|
|
207
165
|
// inside `render` function which can be called N times
|
208
166
|
// and should be fast as possible.
|
209
167
|
// Cache invalidates each time hidden or userDefinedMaxHeight changes
|
210
|
-
_defineProperty(
|
168
|
+
_defineProperty(this, "_adjustListMaxHeight", memoizeOne((hidden, userDefinedMaxHeight, ringPopupTarget) => {
|
211
169
|
if (hidden) {
|
212
170
|
return userDefinedMaxHeight;
|
213
171
|
}
|
214
172
|
// Calculate list's maximum height that can't
|
215
173
|
// get beyond the screen
|
216
174
|
// @see RG-1838, JT-48358
|
217
|
-
|
218
|
-
|
175
|
+
const minMaxHeight = 100;
|
176
|
+
const directions = this.props.directions || DEFAULT_DIRECTIONS;
|
219
177
|
// Note:
|
220
178
|
// Create a method which'll be called only when the popup opens and before
|
221
179
|
// render the list would be a better way
|
222
|
-
|
223
|
-
|
224
|
-
return anchorNode != null ? Math.min(directions.reduce(
|
180
|
+
const anchorNode = this.props.anchorElement;
|
181
|
+
const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
|
182
|
+
return anchorNode != null ? Math.min(directions.reduce((maxHeight, direction) => {
|
225
183
|
var _maxHeightForDirectio;
|
226
184
|
return Math.max(maxHeight, (_maxHeightForDirectio = maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : null)) !== null && _maxHeightForDirectio !== void 0 ? _maxHeightForDirectio : 0);
|
227
185
|
}, minMaxHeight), userDefinedMaxHeight) : userDefinedMaxHeight;
|
228
186
|
}));
|
229
|
-
_defineProperty(
|
230
|
-
|
187
|
+
_defineProperty(this, "popupRef", el => {
|
188
|
+
this.popup = el;
|
231
189
|
});
|
232
|
-
_defineProperty(
|
233
|
-
_defineProperty(
|
234
|
-
|
190
|
+
_defineProperty(this, "list", void 0);
|
191
|
+
_defineProperty(this, "listRef", el => {
|
192
|
+
this.list = el;
|
235
193
|
});
|
236
|
-
_defineProperty(
|
237
|
-
|
238
|
-
|
194
|
+
_defineProperty(this, "filterRef", el => {
|
195
|
+
this.filter = el;
|
196
|
+
this.caret = el && new Caret(el);
|
239
197
|
});
|
240
|
-
_defineProperty(
|
241
|
-
_defineProperty(
|
242
|
-
_defineProperty(
|
243
|
-
tab:
|
198
|
+
_defineProperty(this, "composedFilterRef", createComposedRef());
|
199
|
+
_defineProperty(this, "shortcutsScope", getUID('select-popup-'));
|
200
|
+
_defineProperty(this, "shortcutsMap", {
|
201
|
+
tab: this.tabPress
|
244
202
|
});
|
245
|
-
_defineProperty(
|
246
|
-
up:
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
},
|
270
|
-
del: function del() {
|
271
|
-
return _this.removeSelectedTag();
|
272
|
-
},
|
273
|
-
left: function left(event) {
|
274
|
-
return _this.handleNavigation(event, true);
|
275
|
-
},
|
276
|
-
right: function right(event) {
|
277
|
-
return _this.handleNavigation(event);
|
278
|
-
}
|
203
|
+
_defineProperty(this, "popupFilterShortcutsMap", {
|
204
|
+
up: event => this.list && this.list.upHandler(event),
|
205
|
+
down: event => this.list && this.list.downHandler(event),
|
206
|
+
home: event => this.list && this.list.homeHandler(event),
|
207
|
+
end: event => this.list && this.list.endHandler(event),
|
208
|
+
enter: event => this.list ? this.list.enterHandler(event) : this.props.onEmptyPopupEnter(event),
|
209
|
+
esc: event => this.props.onCloseAttempt(event, true),
|
210
|
+
tab: event => this.tabPress(event),
|
211
|
+
backspace: event => this.handleBackspace(event),
|
212
|
+
del: () => this.removeSelectedTag(),
|
213
|
+
left: event => this.handleNavigation(event, true),
|
214
|
+
right: event => this.handleNavigation(event)
|
215
|
+
});
|
216
|
+
}
|
217
|
+
componentDidMount() {
|
218
|
+
window.document.addEventListener('mouseup', this.mouseUpHandler);
|
219
|
+
}
|
220
|
+
componentWillUnmount() {
|
221
|
+
window.document.removeEventListener('mouseup', this.mouseUpHandler);
|
222
|
+
}
|
223
|
+
focusFilter() {
|
224
|
+
setTimeout(() => {
|
225
|
+
var _this$filter2;
|
226
|
+
return (_this$filter2 = this.filter) === null || _this$filter2 === void 0 ? void 0 : _this$filter2.focus();
|
279
227
|
});
|
280
|
-
return _this;
|
281
228
|
}
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
229
|
+
isEventTargetFilter(event) {
|
230
|
+
return event.target instanceof Element && event.target.matches('input,textarea');
|
231
|
+
}
|
232
|
+
handleNavigation(event, navigateLeft) {
|
233
|
+
if (this.isEventTargetFilter(event) && this.caret != null && Number(this.caret.getPosition()) > 0 || !Array.isArray(this.props.selected)) {
|
234
|
+
return;
|
287
235
|
}
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
236
|
+
let newIndex = null;
|
237
|
+
if (navigateLeft) {
|
238
|
+
newIndex = this.state.tagsActiveIndex === null ? this.props.selected.length - 1 : this.state.tagsActiveIndex - 1;
|
239
|
+
} else if (this.state.tagsActiveIndex !== null) {
|
240
|
+
newIndex = this.state.tagsActiveIndex + 1;
|
292
241
|
}
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
var _this2 = this;
|
297
|
-
setTimeout(function () {
|
298
|
-
var _this2$filter;
|
299
|
-
return (_this2$filter = _this2.filter) === null || _this2$filter === void 0 ? void 0 : _this2$filter.focus();
|
300
|
-
});
|
242
|
+
if (newIndex !== null && (newIndex >= this.props.selected.length || newIndex < 0)) {
|
243
|
+
newIndex = null;
|
244
|
+
this.focusFilter();
|
301
245
|
}
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
246
|
+
this.setState({
|
247
|
+
tagsActiveIndex: newIndex
|
248
|
+
});
|
249
|
+
}
|
250
|
+
removeTag(tag, event) {
|
251
|
+
if (!Array.isArray(this.props.selected)) {
|
252
|
+
return;
|
306
253
|
}
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
}
|
313
|
-
var newIndex = null;
|
314
|
-
if (navigateLeft) {
|
315
|
-
newIndex = this.state.tagsActiveIndex === null ? this.props.selected.length - 1 : this.state.tagsActiveIndex - 1;
|
316
|
-
} else if (this.state.tagsActiveIndex !== null) {
|
317
|
-
newIndex = this.state.tagsActiveIndex + 1;
|
318
|
-
}
|
319
|
-
if (newIndex !== null && (newIndex >= this.props.selected.length || newIndex < 0)) {
|
320
|
-
newIndex = null;
|
321
|
-
this.focusFilter();
|
322
|
-
}
|
254
|
+
const _tag = tag || this.props.selected.slice(0)[this.props.selected.length - 1];
|
255
|
+
if (_tag) {
|
256
|
+
this.onListSelect(_tag, event, {
|
257
|
+
tryKeepOpen: true
|
258
|
+
});
|
323
259
|
this.setState({
|
324
|
-
tagsActiveIndex:
|
260
|
+
tagsActiveIndex: null
|
325
261
|
});
|
262
|
+
this.focusFilter();
|
326
263
|
}
|
327
|
-
}
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
}
|
333
|
-
var _tag = tag || this.props.selected.slice(0)[this.props.selected.length - 1];
|
334
|
-
if (_tag) {
|
335
|
-
this.onListSelect(_tag, event, {
|
336
|
-
tryKeepOpen: true
|
337
|
-
});
|
338
|
-
this.setState({
|
339
|
-
tagsActiveIndex: null
|
340
|
-
});
|
341
|
-
this.focusFilter();
|
342
|
-
}
|
343
|
-
}
|
344
|
-
}, {
|
345
|
-
key: "removeSelectedTag",
|
346
|
-
value: function removeSelectedTag() {
|
347
|
-
if (Array.isArray(this.props.selected) && this.state.tagsActiveIndex != null) {
|
348
|
-
this.removeTag(this.props.selected[this.state.tagsActiveIndex]);
|
349
|
-
return false;
|
350
|
-
}
|
351
|
-
return true;
|
264
|
+
}
|
265
|
+
removeSelectedTag() {
|
266
|
+
if (Array.isArray(this.props.selected) && this.state.tagsActiveIndex != null) {
|
267
|
+
this.removeTag(this.props.selected[this.state.tagsActiveIndex]);
|
268
|
+
return false;
|
352
269
|
}
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
return true;
|
358
|
-
}
|
359
|
-
if (!this.isEventTargetFilter(event)) {
|
360
|
-
this.removeSelectedTag();
|
361
|
-
return false;
|
362
|
-
}
|
363
|
-
if ((event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) && !event.target.value) {
|
364
|
-
this.removeTag();
|
365
|
-
return false;
|
366
|
-
}
|
270
|
+
return true;
|
271
|
+
}
|
272
|
+
handleBackspace(event) {
|
273
|
+
if (!this.props.tags) {
|
367
274
|
return true;
|
368
275
|
}
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
this.setState({
|
373
|
-
popupFilterShortcutsOptions: {
|
374
|
-
modal: true,
|
375
|
-
disabled: shortcutsDisabled
|
376
|
-
}
|
377
|
-
});
|
276
|
+
if (!this.isEventTargetFilter(event)) {
|
277
|
+
this.removeSelectedTag();
|
278
|
+
return false;
|
378
279
|
}
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
return this.popup && this.popup.isVisible();
|
280
|
+
if ((event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) && !event.target.value) {
|
281
|
+
this.removeTag();
|
282
|
+
return false;
|
383
283
|
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
"data-test": "ring-select-popup-filter",
|
392
|
-
children: [!this.props.tags && /*#__PURE__*/jsx(Icon, {
|
393
|
-
glyph: (_this$props$filterIco = this.props.filterIcon) !== null && _this$props$filterIco !== void 0 ? _this$props$filterIco : searchIcon,
|
394
|
-
className: modules_b607bec2.filterIcon,
|
395
|
-
"data-test-custom": "ring-select-popup-filter-icon"
|
396
|
-
}), /*#__PURE__*/jsx(FilterWithShortcuts, {
|
397
|
-
rgShortcutsOptions: this.state.popupFilterShortcutsOptions,
|
398
|
-
rgShortcutsMap: this.popupFilterShortcutsMap,
|
399
|
-
value: this.props.filterValue,
|
400
|
-
inputRef: this.composedFilterRef(this.filterRef, this.props.filterRef),
|
401
|
-
onBlur: this.popupFilterOnBlur,
|
402
|
-
onFocus: this.onFilterFocus,
|
403
|
-
className: "ring-js-shortcuts",
|
404
|
-
inputClassName: classNames({
|
405
|
-
[modules_b607bec2.filterWithTagsInput]: this.props.tags
|
406
|
-
}),
|
407
|
-
placeholder: typeof this.props.filter === 'object' ? this.props.filter.placeholder : undefined,
|
408
|
-
height: this.props.tags ? ControlsHeight.S : ControlsHeight.L,
|
409
|
-
onChange: this.props.onFilter,
|
410
|
-
onClick: this.onClickHandler,
|
411
|
-
onClear: this.props.tags ? undefined : this.props.onClear,
|
412
|
-
"data-test-custom": "ring-select-popup-filter-input",
|
413
|
-
listId: this.props.listId,
|
414
|
-
enableShortcuts: Object.keys(this.popupFilterShortcutsMap)
|
415
|
-
})]
|
416
|
-
});
|
284
|
+
return true;
|
285
|
+
}
|
286
|
+
_togglePopupFilterShortcuts(shortcutsDisabled) {
|
287
|
+
this.setState({
|
288
|
+
popupFilterShortcutsOptions: {
|
289
|
+
modal: true,
|
290
|
+
disabled: shortcutsDisabled
|
417
291
|
}
|
418
|
-
|
292
|
+
});
|
293
|
+
}
|
294
|
+
isVisible() {
|
295
|
+
return this.popup && this.popup.isVisible();
|
296
|
+
}
|
297
|
+
getFilter() {
|
298
|
+
if (this.props.filter || this.props.tags) {
|
299
|
+
var _this$props$filterIco;
|
300
|
+
return /*#__PURE__*/jsxs("div", {
|
301
|
+
className: modules_b607bec2.filterWrapper,
|
302
|
+
"data-test": "ring-select-popup-filter",
|
303
|
+
children: [!this.props.tags && /*#__PURE__*/jsx(Icon, {
|
304
|
+
glyph: (_this$props$filterIco = this.props.filterIcon) !== null && _this$props$filterIco !== void 0 ? _this$props$filterIco : searchIcon,
|
305
|
+
className: modules_b607bec2.filterIcon,
|
306
|
+
"data-test-custom": "ring-select-popup-filter-icon"
|
307
|
+
}), /*#__PURE__*/jsx(FilterWithShortcuts, {
|
308
|
+
rgShortcutsOptions: this.state.popupFilterShortcutsOptions,
|
309
|
+
rgShortcutsMap: this.popupFilterShortcutsMap,
|
310
|
+
value: this.props.filterValue,
|
311
|
+
inputRef: this.composedFilterRef(this.filterRef, this.props.filterRef),
|
312
|
+
onBlur: this.popupFilterOnBlur,
|
313
|
+
onFocus: this.onFilterFocus,
|
314
|
+
className: "ring-js-shortcuts",
|
315
|
+
inputClassName: classNames({
|
316
|
+
[modules_b607bec2.filterWithTagsInput]: this.props.tags
|
317
|
+
}),
|
318
|
+
placeholder: typeof this.props.filter === 'object' ? this.props.filter.placeholder : undefined,
|
319
|
+
height: this.props.tags ? ControlsHeight.S : ControlsHeight.L,
|
320
|
+
onChange: this.props.onFilter,
|
321
|
+
onClick: this.onClickHandler,
|
322
|
+
onClear: this.props.tags ? undefined : this.props.onClear,
|
323
|
+
"data-test-custom": "ring-select-popup-filter-input",
|
324
|
+
listId: this.props.listId,
|
325
|
+
enableShortcuts: Object.keys(this.popupFilterShortcutsMap)
|
326
|
+
})]
|
327
|
+
});
|
419
328
|
}
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
}
|
426
|
-
return undefined;
|
329
|
+
return null;
|
330
|
+
}
|
331
|
+
getCustomTag(tags) {
|
332
|
+
if (tags !== null && typeof tags !== 'boolean') {
|
333
|
+
return tags.customTagComponent;
|
427
334
|
}
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
335
|
+
return undefined;
|
336
|
+
}
|
337
|
+
getTags() {
|
338
|
+
return Array.isArray(this.props.selected) && /*#__PURE__*/jsx("div", {
|
339
|
+
children: /*#__PURE__*/jsx(TagsList, {
|
340
|
+
tags: this.props.selected,
|
341
|
+
activeIndex: this.state.tagsActiveIndex,
|
342
|
+
handleRemove: this.handleRemoveTag,
|
343
|
+
handleClick: this.handleTagClick,
|
344
|
+
disabled: this.props.disabled,
|
345
|
+
customTagComponent: this.getCustomTag(this.props.tags)
|
346
|
+
})
|
347
|
+
});
|
348
|
+
}
|
349
|
+
getFilterWithTags() {
|
350
|
+
if (this.props.tags) {
|
351
|
+
const classes = classNames([modules_b607bec2.filterWithTags, {
|
352
|
+
[modules_b607bec2.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled
|
353
|
+
}]);
|
354
|
+
return /*#__PURE__*/jsxs("div", {
|
355
|
+
className: classes,
|
356
|
+
children: [this.getTags(), this.getFilter()]
|
440
357
|
});
|
441
358
|
}
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
359
|
+
return this.getFilter();
|
360
|
+
}
|
361
|
+
getBottomLine() {
|
362
|
+
const {
|
363
|
+
loading,
|
364
|
+
message,
|
365
|
+
data
|
366
|
+
} = this.props;
|
367
|
+
const hasMoreThanOneItem = data.length > 1;
|
368
|
+
return (loading || message) && /*#__PURE__*/jsxs("div", {
|
369
|
+
className: classNames(modules_b607bec2.bottomLine, {
|
370
|
+
[modules_b607bec2.bottomLineOverItem]: hasMoreThanOneItem
|
371
|
+
}),
|
372
|
+
children: [loading && /*#__PURE__*/jsx(LoaderInline, {}), message && /*#__PURE__*/jsx("div", {
|
373
|
+
className: modules_b607bec2.message,
|
374
|
+
children: message
|
375
|
+
})]
|
376
|
+
});
|
377
|
+
}
|
378
|
+
getList(ringPopupTarget) {
|
379
|
+
if (this.props.data.length) {
|
380
|
+
let {
|
381
|
+
maxHeight
|
382
|
+
} = this.props;
|
383
|
+
if (this.props.anchorElement) {
|
384
|
+
maxHeight = this._adjustListMaxHeight(this.props.hidden, maxHeight, ringPopupTarget);
|
453
385
|
}
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
386
|
+
if (this.props.filter) {
|
387
|
+
maxHeight -= FILTER_HEIGHT;
|
388
|
+
}
|
389
|
+
if (this.props.toolbar) {
|
390
|
+
maxHeight -= TOOLBAR_HEIGHT;
|
391
|
+
}
|
392
|
+
return /*#__PURE__*/jsx(List, {
|
393
|
+
id: this.props.listId,
|
394
|
+
maxHeight: maxHeight,
|
395
|
+
data: this.props.data,
|
396
|
+
activeIndex: this.props.activeIndex,
|
397
|
+
ref: this.listRef,
|
398
|
+
restoreActiveIndex: true,
|
399
|
+
activateFirstItem: true,
|
400
|
+
onSelect: this.onListSelect,
|
401
|
+
onResize: this.handleListResize,
|
402
|
+
onScrollToBottom: this.props.onLoadMore,
|
403
|
+
hidden: this.props.hidden,
|
404
|
+
shortcuts: !this.props.hidden,
|
405
|
+
disableMoveOverflow: this.props.disableMoveOverflow,
|
406
|
+
disableMoveDownOverflow: this.props.loading,
|
407
|
+
disableScrollToActive: this.props.disableScrollToActive,
|
408
|
+
compact: this.props.compact,
|
409
|
+
preventListOverscroll: this.props.preventListOverscroll,
|
410
|
+
renderOptimization: this.props.renderOptimization
|
472
411
|
});
|
473
412
|
}
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
413
|
+
return null;
|
414
|
+
}
|
415
|
+
render() {
|
416
|
+
const {
|
417
|
+
toolbar,
|
418
|
+
topbar,
|
419
|
+
className,
|
420
|
+
multiple,
|
421
|
+
hidden,
|
422
|
+
isInputMode,
|
423
|
+
anchorElement,
|
424
|
+
minWidth,
|
425
|
+
onCloseAttempt,
|
426
|
+
onOutsideClick,
|
427
|
+
directions,
|
428
|
+
top,
|
429
|
+
left,
|
430
|
+
offset,
|
431
|
+
style,
|
432
|
+
dir,
|
433
|
+
filter
|
434
|
+
} = this.props;
|
435
|
+
const classes = classNames(modules_b607bec2.popup, className);
|
436
|
+
return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
|
437
|
+
children: ringPopupTarget => {
|
438
|
+
const filterWithTags = this.getFilterWithTags();
|
439
|
+
const selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && this.getSelectAll();
|
440
|
+
const list = this.getList(this.props.ringPopupTarget || ringPopupTarget);
|
441
|
+
const bottomLine = this.getBottomLine();
|
442
|
+
const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
|
443
|
+
return /*#__PURE__*/jsx(Popup, {
|
444
|
+
trapFocus: false,
|
445
|
+
ref: this.popupRef,
|
446
|
+
hidden: hidden || !hasContent,
|
447
|
+
attached: isInputMode,
|
448
|
+
className: classes,
|
449
|
+
dontCloseOnAnchorClick: true,
|
450
|
+
anchorElement: anchorElement,
|
451
|
+
minWidth: minWidth,
|
452
|
+
onCloseAttempt: onCloseAttempt,
|
453
|
+
onOutsideClick: onOutsideClick,
|
454
|
+
directions: directions,
|
455
|
+
top: top,
|
456
|
+
left: left,
|
457
|
+
offset: offset,
|
458
|
+
onMouseDown: this.mouseDownHandler,
|
459
|
+
target: this.props.ringPopupTarget,
|
460
|
+
autoCorrectTopOverflow: false,
|
461
|
+
style: style,
|
462
|
+
children: /*#__PURE__*/jsxs("div", {
|
463
|
+
dir: dir,
|
464
|
+
children: [!hidden && filter && /*#__PURE__*/jsx(Shortcuts, {
|
465
|
+
map: this.shortcutsMap,
|
466
|
+
scope: this.shortcutsScope
|
467
|
+
}), topbar, hidden ? /*#__PURE__*/jsx("div", {}) : filterWithTags, selectAll, list, bottomLine, toolbar]
|
468
|
+
})
|
507
469
|
});
|
508
470
|
}
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
key: "render",
|
513
|
-
value: function render() {
|
514
|
-
var _this3 = this;
|
515
|
-
var _this$props2 = this.props,
|
516
|
-
toolbar = _this$props2.toolbar,
|
517
|
-
topbar = _this$props2.topbar,
|
518
|
-
className = _this$props2.className,
|
519
|
-
multiple = _this$props2.multiple,
|
520
|
-
hidden = _this$props2.hidden,
|
521
|
-
isInputMode = _this$props2.isInputMode,
|
522
|
-
anchorElement = _this$props2.anchorElement,
|
523
|
-
minWidth = _this$props2.minWidth,
|
524
|
-
onCloseAttempt = _this$props2.onCloseAttempt,
|
525
|
-
onOutsideClick = _this$props2.onOutsideClick,
|
526
|
-
directions = _this$props2.directions,
|
527
|
-
top = _this$props2.top,
|
528
|
-
left = _this$props2.left,
|
529
|
-
offset = _this$props2.offset,
|
530
|
-
style = _this$props2.style,
|
531
|
-
dir = _this$props2.dir,
|
532
|
-
filter = _this$props2.filter;
|
533
|
-
var classes = classNames(modules_b607bec2.popup, className);
|
534
|
-
return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
|
535
|
-
children: function children(ringPopupTarget) {
|
536
|
-
var filterWithTags = _this3.getFilterWithTags();
|
537
|
-
var selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && _this3.getSelectAll();
|
538
|
-
var list = _this3.getList(_this3.props.ringPopupTarget || ringPopupTarget);
|
539
|
-
var bottomLine = _this3.getBottomLine();
|
540
|
-
var hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
|
541
|
-
return /*#__PURE__*/jsx(Popup, {
|
542
|
-
trapFocus: false,
|
543
|
-
ref: _this3.popupRef,
|
544
|
-
hidden: hidden || !hasContent,
|
545
|
-
attached: isInputMode,
|
546
|
-
className: classes,
|
547
|
-
dontCloseOnAnchorClick: true,
|
548
|
-
anchorElement: anchorElement,
|
549
|
-
minWidth: minWidth,
|
550
|
-
onCloseAttempt: onCloseAttempt,
|
551
|
-
onOutsideClick: onOutsideClick,
|
552
|
-
directions: directions,
|
553
|
-
top: top,
|
554
|
-
left: left,
|
555
|
-
offset: offset,
|
556
|
-
onMouseDown: _this3.mouseDownHandler,
|
557
|
-
target: _this3.props.ringPopupTarget,
|
558
|
-
autoCorrectTopOverflow: false,
|
559
|
-
style: style,
|
560
|
-
children: /*#__PURE__*/jsxs("div", {
|
561
|
-
dir: dir,
|
562
|
-
children: [!hidden && filter && /*#__PURE__*/jsx(Shortcuts, {
|
563
|
-
map: _this3.shortcutsMap,
|
564
|
-
scope: _this3.shortcutsScope
|
565
|
-
}), topbar, hidden ? /*#__PURE__*/jsx("div", {}) : filterWithTags, selectAll, list, bottomLine, toolbar]
|
566
|
-
})
|
567
|
-
});
|
568
|
-
}
|
569
|
-
});
|
570
|
-
}
|
571
|
-
}]);
|
572
|
-
}(PureComponent);
|
471
|
+
});
|
472
|
+
}
|
473
|
+
}
|
573
474
|
_defineProperty(SelectPopup, "defaultProps", {
|
574
475
|
data: [],
|
575
476
|
activeIndex: null,
|
@@ -596,54 +497,5 @@ _defineProperty(SelectPopup, "defaultProps", {
|
|
596
497
|
onSelectAll: noop,
|
597
498
|
onEmptyPopupEnter: noop
|
598
499
|
});
|
599
|
-
SelectPopup.propTypes = {
|
600
|
-
activeIndex: PropTypes.number,
|
601
|
-
anchorElement: PropTypes.instanceOf(HTMLElement),
|
602
|
-
className: PropTypes.string,
|
603
|
-
compact: PropTypes.bool,
|
604
|
-
data: PropTypes.array,
|
605
|
-
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
606
|
-
directions: PropTypes.array,
|
607
|
-
disabled: PropTypes.bool,
|
608
|
-
disableMoveOverflow: PropTypes.bool,
|
609
|
-
disableScrollToActive: PropTypes.bool,
|
610
|
-
filter: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
611
|
-
value: PropTypes.string,
|
612
|
-
placeholder: PropTypes.string
|
613
|
-
})]),
|
614
|
-
filterValue: PropTypes.string,
|
615
|
-
filterIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
616
|
-
filterRef: PropTypes.oneOfType([PropTypes.func, refObject(PropTypes.instanceOf(HTMLInputElement))]),
|
617
|
-
hidden: PropTypes.bool,
|
618
|
-
isInputMode: PropTypes.bool,
|
619
|
-
listId: PropTypes.string,
|
620
|
-
maxHeight: PropTypes.number,
|
621
|
-
message: PropTypes.string,
|
622
|
-
minWidth: PropTypes.number,
|
623
|
-
multiple: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
624
|
-
label: PropTypes.string,
|
625
|
-
limit: PropTypes.number,
|
626
|
-
selectAll: PropTypes.bool
|
627
|
-
})]),
|
628
|
-
left: PropTypes.number,
|
629
|
-
loading: PropTypes.bool,
|
630
|
-
onClear: PropTypes.func,
|
631
|
-
onCloseAttempt: PropTypes.func,
|
632
|
-
onOutsideClick: PropTypes.func,
|
633
|
-
onEmptyPopupEnter: PropTypes.func,
|
634
|
-
onFilter: PropTypes.func,
|
635
|
-
onLoadMore: PropTypes.func,
|
636
|
-
onSelect: PropTypes.func,
|
637
|
-
onSelectAll: PropTypes.func,
|
638
|
-
renderOptimization: PropTypes.bool,
|
639
|
-
ringPopupTarget: PropTypes.string,
|
640
|
-
selected: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
641
|
-
style: PropTypes.object,
|
642
|
-
tags: PropTypes.object,
|
643
|
-
toolbar: PropTypes.node,
|
644
|
-
topbar: PropTypes.node,
|
645
|
-
top: PropTypes.number,
|
646
|
-
preventListOverscroll: PropTypes.bool
|
647
|
-
};
|
648
500
|
|
649
501
|
export { SelectPopup as default };
|