@jetbrains/ring-ui-built 6.0.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/LICENSE.txt +202 -0
- package/README.md +103 -0
- package/components/_helpers/_rollupPluginBabelHelpers.js +648 -0
- package/components/_helpers/anchor.js +31 -0
- package/components/_helpers/badge.js +3 -0
- package/components/_helpers/button__classes.js +34 -0
- package/components/_helpers/caption.js +31 -0
- package/components/_helpers/card.js +132 -0
- package/components/_helpers/date-picker.js +3 -0
- package/components/_helpers/dialog__body-scroll-preventer.js +54 -0
- package/components/_helpers/grid.js +3 -0
- package/components/_helpers/header.js +3 -0
- package/components/_helpers/heading.js +3 -0
- package/components/_helpers/icon__svg.js +75 -0
- package/components/_helpers/input.js +235 -0
- package/components/_helpers/island.js +3 -0
- package/components/_helpers/link.js +3 -0
- package/components/_helpers/list.js +3 -0
- package/components/_helpers/query-assist__suggestions.js +102 -0
- package/components/_helpers/select__filter.js +94 -0
- package/components/_helpers/services-link.js +48 -0
- package/components/_helpers/sidebar.js +123 -0
- package/components/_helpers/tab-link.js +34 -0
- package/components/_helpers/table.js +3 -0
- package/components/_helpers/theme.js +95 -0
- package/components/_helpers/title.js +103 -0
- package/components/alert/alert.d.ts +113 -0
- package/components/alert/alert.js +294 -0
- package/components/alert/container.d.ts +15 -0
- package/components/alert/container.js +52 -0
- package/components/alert-service/alert-service.d.ts +36 -0
- package/components/alert-service/alert-service.js +220 -0
- package/components/analytics/analytics.d.ts +18 -0
- package/components/analytics/analytics.js +31 -0
- package/components/analytics/analytics__custom-plugin.d.ts +28 -0
- package/components/analytics/analytics__custom-plugin.js +89 -0
- package/components/auth/auth.d.ts +3 -0
- package/components/auth/auth.js +133 -0
- package/components/auth/auth__core.d.ts +236 -0
- package/components/auth/auth__core.js +1653 -0
- package/components/auth/background-flow.d.ts +31 -0
- package/components/auth/background-flow.js +147 -0
- package/components/auth/down-notification.d.ts +15 -0
- package/components/auth/down-notification.js +157 -0
- package/components/auth/iframe-flow.d.ts +20 -0
- package/components/auth/iframe-flow.js +196 -0
- package/components/auth/request-builder.d.ts +48 -0
- package/components/auth/request-builder.js +104 -0
- package/components/auth/response-parser.d.ts +70 -0
- package/components/auth/response-parser.js +138 -0
- package/components/auth/storage.d.ts +112 -0
- package/components/auth/storage.js +429 -0
- package/components/auth/token-validator.d.ts +93 -0
- package/components/auth/token-validator.js +269 -0
- package/components/auth/window-flow.d.ts +26 -0
- package/components/auth/window-flow.js +154 -0
- package/components/auth-dialog/auth-dialog.d.ts +60 -0
- package/components/auth-dialog/auth-dialog.js +221 -0
- package/components/auth-dialog-service/auth-dialog-service.d.ts +6 -0
- package/components/auth-dialog-service/auth-dialog-service.js +92 -0
- package/components/avatar/avatar-example-datauri.d.ts +1 -0
- package/components/avatar/avatar-example-datauri.js +4 -0
- package/components/avatar/avatar.d.ts +52 -0
- package/components/avatar/avatar.js +183 -0
- package/components/avatar/fallback-avatar.d.ts +17 -0
- package/components/avatar/fallback-avatar.js +151 -0
- package/components/badge/badge.d.ts +24 -0
- package/components/badge/badge.js +59 -0
- package/components/button/button.d.ts +67 -0
- package/components/button/button.js +131 -0
- package/components/button/button__classes.d.ts +2 -0
- package/components/button/button__classes.js +2 -0
- package/components/button-group/button-group.d.ts +18 -0
- package/components/button-group/button-group.js +48 -0
- package/components/button-group/caption.d.ts +8 -0
- package/components/button-group/caption.js +5 -0
- package/components/button-set/button-set.d.ts +16 -0
- package/components/button-set/button-set.js +47 -0
- package/components/button-toolbar/button-toolbar.d.ts +16 -0
- package/components/button-toolbar/button-toolbar.js +46 -0
- package/components/caret/caret.d.ts +66 -0
- package/components/caret/caret.js +259 -0
- package/components/checkbox/checkbox.d.ts +45 -0
- package/components/checkbox/checkbox.js +130 -0
- package/components/clipboard/clipboard-fallback.d.ts +2 -0
- package/components/clipboard/clipboard-fallback.js +42 -0
- package/components/clipboard/clipboard.d.ts +5 -0
- package/components/clipboard/clipboard.js +185 -0
- package/components/code/code.d.ts +44 -0
- package/components/code/code.js +191 -0
- package/components/confirm/confirm.d.ts +48 -0
- package/components/confirm/confirm.js +153 -0
- package/components/confirm-service/confirm-service.d.ts +21 -0
- package/components/confirm-service/confirm-service.js +141 -0
- package/components/content-layout/content-layout.d.ts +26 -0
- package/components/content-layout/content-layout.js +79 -0
- package/components/content-layout/sidebar.d.ts +31 -0
- package/components/content-layout/sidebar.js +7 -0
- package/components/contenteditable/contenteditable.d.ts +47 -0
- package/components/contenteditable/contenteditable.js +84 -0
- package/components/control-label/control-label.d.ts +11 -0
- package/components/control-label/control-label.js +36 -0
- package/components/data-list/data-list.d.ts +85 -0
- package/components/data-list/data-list.js +251 -0
- package/components/data-list/data-list.mock.d.ts +16 -0
- package/components/data-list/data-list.mock.js +192 -0
- package/components/data-list/item.d.ts +50 -0
- package/components/data-list/item.js +235 -0
- package/components/data-list/selection.d.ts +16 -0
- package/components/data-list/selection.js +148 -0
- package/components/data-list/title.d.ts +26 -0
- package/components/data-list/title.js +28 -0
- package/components/date-picker/consts.d.ts +98 -0
- package/components/date-picker/consts.js +46 -0
- package/components/date-picker/date-input.d.ts +47 -0
- package/components/date-picker/date-input.js +177 -0
- package/components/date-picker/date-picker.d.ts +77 -0
- package/components/date-picker/date-picker.js +404 -0
- package/components/date-picker/date-popup.d.ts +55 -0
- package/components/date-picker/date-popup.js +488 -0
- package/components/date-picker/day.d.ts +30 -0
- package/components/date-picker/day.js +133 -0
- package/components/date-picker/formats.d.ts +2 -0
- package/components/date-picker/formats.js +3 -0
- package/components/date-picker/month-names.d.ts +13 -0
- package/components/date-picker/month-names.js +110 -0
- package/components/date-picker/month-slider.d.ts +29 -0
- package/components/date-picker/month-slider.js +93 -0
- package/components/date-picker/month.d.ts +14 -0
- package/components/date-picker/month.js +58 -0
- package/components/date-picker/months.d.ts +11 -0
- package/components/date-picker/months.js +133 -0
- package/components/date-picker/weekdays.d.ts +13 -0
- package/components/date-picker/weekdays.js +39 -0
- package/components/date-picker/years.d.ts +25 -0
- package/components/date-picker/years.js +134 -0
- package/components/dialog/dialog.d.ts +64 -0
- package/components/dialog/dialog.js +240 -0
- package/components/dialog/dialog__body-scroll-preventer.d.ts +9 -0
- package/components/dialog/dialog__body-scroll-preventer.js +6 -0
- package/components/dropdown/anchor.d.ts +11 -0
- package/components/dropdown/anchor.js +24 -0
- package/components/dropdown/dropdown.d.ts +87 -0
- package/components/dropdown/dropdown.js +247 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +36 -0
- package/components/dropdown-menu/dropdown-menu.js +199 -0
- package/components/editable-heading/editable-heading.d.ts +32 -0
- package/components/editable-heading/editable-heading.js +276 -0
- package/components/error-bubble/error-bubble.d.ts +18 -0
- package/components/error-bubble/error-bubble.js +88 -0
- package/components/error-message/error-message.d.ts +27 -0
- package/components/error-message/error-message.js +78 -0
- package/components/footer/footer.d.ts +28 -0
- package/components/footer/footer.js +118 -0
- package/components/global/compose.d.ts +7 -0
- package/components/global/compose.js +17 -0
- package/components/global/composeRefs.d.ts +3 -0
- package/components/global/composeRefs.js +19 -0
- package/components/global/controls-height.d.ts +9 -0
- package/components/global/controls-height.js +19 -0
- package/components/global/create-stateful-context.d.ts +27 -0
- package/components/global/create-stateful-context.js +49 -0
- package/components/global/data-tests.d.ts +3 -0
- package/components/global/data-tests.js +30 -0
- package/components/global/dom.d.ts +37 -0
- package/components/global/dom.js +151 -0
- package/components/global/focus-sensor-hoc.d.ts +19 -0
- package/components/global/focus-sensor-hoc.js +165 -0
- package/components/global/fuzzy-highlight.d.ts +11 -0
- package/components/global/fuzzy-highlight.js +90 -0
- package/components/global/get-event-key.d.ts +2 -0
- package/components/global/get-event-key.js +101 -0
- package/components/global/get-uid.d.ts +1 -0
- package/components/global/get-uid.js +22 -0
- package/components/global/inject-styles.d.ts +3 -0
- package/components/global/inject-styles.js +22 -0
- package/components/global/linear-function.d.ts +6 -0
- package/components/global/linear-function.js +15 -0
- package/components/global/listeners.d.ts +8 -0
- package/components/global/listeners.js +58 -0
- package/components/global/memoize.d.ts +1 -0
- package/components/global/memoize.js +23 -0
- package/components/global/normalize-indent.d.ts +1 -0
- package/components/global/normalize-indent.js +60 -0
- package/components/global/promise-with-timeout.d.ts +5 -0
- package/components/global/promise-with-timeout.js +19 -0
- package/components/global/prop-types.d.ts +4 -0
- package/components/global/prop-types.js +9 -0
- package/components/global/react-dom-renderer.d.ts +16 -0
- package/components/global/react-dom-renderer.js +54 -0
- package/components/global/react-render-adapter.d.ts +1 -0
- package/components/global/react-render-adapter.js +6 -0
- package/components/global/rerender-hoc.d.ts +10 -0
- package/components/global/rerender-hoc.js +46 -0
- package/components/global/schedule-raf.d.ts +1 -0
- package/components/global/schedule-raf.js +28 -0
- package/components/global/sniffer.d.ts +3 -0
- package/components/global/sniffer.js +6 -0
- package/components/global/theme.d.ts +21 -0
- package/components/global/theme.js +42 -0
- package/components/global/trivial-template-tag.d.ts +1 -0
- package/components/global/trivial-template-tag.js +21 -0
- package/components/global/typescript-utils.d.ts +2 -0
- package/components/global/typescript-utils.js +8 -0
- package/components/global/url.d.ts +57 -0
- package/components/global/url.js +142 -0
- package/components/global/use-event-callback.d.ts +1 -0
- package/components/global/use-event-callback.js +17 -0
- package/components/global/variables.d.ts +89 -0
- package/components/global/variables.js +1 -0
- package/components/grid/col.d.ts +31 -0
- package/components/grid/col.js +80 -0
- package/components/grid/grid.d.ts +14 -0
- package/components/grid/grid.js +46 -0
- package/components/grid/row.d.ts +40 -0
- package/components/grid/row.js +75 -0
- package/components/group/group.d.ts +12 -0
- package/components/group/group.js +39 -0
- package/components/header/header.d.ts +34 -0
- package/components/header/header.js +189 -0
- package/components/header/logo.d.ts +14 -0
- package/components/header/logo.js +51 -0
- package/components/header/profile.d.ts +75 -0
- package/components/header/profile.js +258 -0
- package/components/header/services-link.d.ts +25 -0
- package/components/header/services-link.js +13 -0
- package/components/header/services.d.ts +33 -0
- package/components/header/services.js +174 -0
- package/components/header/smart-profile.d.ts +36 -0
- package/components/header/smart-profile.js +303 -0
- package/components/header/smart-services.d.ts +26 -0
- package/components/header/smart-services.js +192 -0
- package/components/header/tray-icon.d.ts +32 -0
- package/components/header/tray-icon.js +57 -0
- package/components/header/tray.d.ts +9 -0
- package/components/header/tray.js +41 -0
- package/components/heading/heading.d.ts +25 -0
- package/components/heading/heading.js +69 -0
- package/components/http/http.d.ts +61 -0
- package/components/http/http.js +386 -0
- package/components/http/http.mock.d.ts +20 -0
- package/components/http/http.mock.js +113 -0
- package/components/hub-source/hub-source.d.ts +44 -0
- package/components/hub-source/hub-source.js +217 -0
- package/components/hub-source/hub-source__user.d.ts +4 -0
- package/components/hub-source/hub-source__user.js +60 -0
- package/components/hub-source/hub-source__users-groups.d.ts +24 -0
- package/components/hub-source/hub-source__users-groups.js +86 -0
- package/components/i18n/i18n-context.d.ts +13 -0
- package/components/i18n/i18n-context.js +27 -0
- package/components/i18n/i18n.d.ts +59 -0
- package/components/i18n/i18n.js +139 -0
- package/components/icon/icon.d.ts +43 -0
- package/components/icon/icon.js +109 -0
- package/components/icon/icon__constants.d.ts +30 -0
- package/components/icon/icon__constants.js +34 -0
- package/components/icon/icon__svg.d.ts +15 -0
- package/components/icon/icon__svg.js +14 -0
- package/components/icon/index.d.ts +2 -0
- package/components/icon/index.js +17 -0
- package/components/input/input.d.ts +77 -0
- package/components/input/input.js +35 -0
- package/components/island/adaptive-island-hoc.d.ts +61 -0
- package/components/island/adaptive-island-hoc.js +53 -0
- package/components/island/content.d.ts +43 -0
- package/components/island/content.js +151 -0
- package/components/island/header.d.ts +8 -0
- package/components/island/header.js +100 -0
- package/components/island/island.d.ts +78 -0
- package/components/island/island.js +60 -0
- package/components/island-legacy/content-legacy.d.ts +10 -0
- package/components/island-legacy/content-legacy.js +34 -0
- package/components/island-legacy/header-legacy.d.ts +10 -0
- package/components/island-legacy/header-legacy.js +36 -0
- package/components/island-legacy/island-legacy.d.ts +12 -0
- package/components/island-legacy/island-legacy.js +36 -0
- package/components/link/clickableLink.d.ts +20 -0
- package/components/link/clickableLink.js +69 -0
- package/components/link/link.d.ts +138 -0
- package/components/link/link.js +86 -0
- package/components/list/consts.d.ts +77 -0
- package/components/list/consts.js +27 -0
- package/components/list/list.d.ts +205 -0
- package/components/list/list.js +802 -0
- package/components/list/list__custom.d.ts +6 -0
- package/components/list/list__custom.js +92 -0
- package/components/list/list__hint.d.ts +15 -0
- package/components/list/list__hint.js +33 -0
- package/components/list/list__item.d.ts +8 -0
- package/components/list/list__item.js +237 -0
- package/components/list/list__link.d.ts +9 -0
- package/components/list/list__link.js +76 -0
- package/components/list/list__separator.d.ts +5 -0
- package/components/list/list__separator.js +39 -0
- package/components/list/list__title.d.ts +5 -0
- package/components/list/list__title.js +48 -0
- package/components/list/list__users-groups-source.d.ts +27 -0
- package/components/list/list__users-groups-source.js +195 -0
- package/components/loader/loader.d.ts +28 -0
- package/components/loader/loader.js +93 -0
- package/components/loader/loader__core.d.ts +75 -0
- package/components/loader/loader__core.js +327 -0
- package/components/loader-inline/loader-inline.d.ts +18 -0
- package/components/loader-inline/loader-inline.js +50 -0
- package/components/loader-screen/loader-screen.d.ts +17 -0
- package/components/loader-screen/loader-screen.js +64 -0
- package/components/login-dialog/login-dialog.d.ts +47 -0
- package/components/login-dialog/login-dialog.js +216 -0
- package/components/login-dialog/service.d.ts +2 -0
- package/components/login-dialog/service.js +98 -0
- package/components/markdown/markdown.d.ts +12 -0
- package/components/markdown/markdown.js +43 -0
- package/components/message/message.d.ts +55 -0
- package/components/message/message.js +267 -0
- package/components/old-browsers-message/old-browsers-message.d.ts +2 -0
- package/components/old-browsers-message/old-browsers-message.js +92 -0
- package/components/old-browsers-message/old-browsers-message__stop.d.ts +1 -0
- package/components/old-browsers-message/old-browsers-message__stop.js +11 -0
- package/components/old-browsers-message/white-list.d.ts +2 -0
- package/components/old-browsers-message/white-list.js +37 -0
- package/components/pager/pager.d.ts +78 -0
- package/components/pager/pager.js +390 -0
- package/components/panel/panel.d.ts +12 -0
- package/components/panel/panel.js +39 -0
- package/components/permissions/permissions.d.ts +111 -0
- package/components/permissions/permissions.js +221 -0
- package/components/permissions/permissions__cache.d.ts +93 -0
- package/components/permissions/permissions__cache.js +257 -0
- package/components/popup/popup.consts.d.ts +37 -0
- package/components/popup/popup.consts.js +44 -0
- package/components/popup/popup.d.ts +147 -0
- package/components/popup/popup.js +424 -0
- package/components/popup/popup.target.d.ts +7 -0
- package/components/popup/popup.target.js +24 -0
- package/components/popup/position.d.ts +30 -0
- package/components/popup/position.js +271 -0
- package/components/popup-menu/popup-menu.d.ts +80 -0
- package/components/popup-menu/popup-menu.js +141 -0
- package/components/progress-bar/progress-bar.d.ts +64 -0
- package/components/progress-bar/progress-bar.js +120 -0
- package/components/query-assist/query-assist.d.ts +306 -0
- package/components/query-assist/query-assist.js +1098 -0
- package/components/query-assist/query-assist__suggestions.d.ts +29 -0
- package/components/query-assist/query-assist__suggestions.js +75 -0
- package/components/radio/radio.d.ts +18 -0
- package/components/radio/radio.js +48 -0
- package/components/radio/radio__item.d.ts +28 -0
- package/components/radio/radio__item.js +88 -0
- package/components/select/select.d.ts +276 -0
- package/components/select/select.js +1310 -0
- package/components/select/select__filter.d.ts +19 -0
- package/components/select/select__filter.js +85 -0
- package/components/select/select__popup.d.ts +166 -0
- package/components/select/select__popup.js +631 -0
- package/components/shortcuts/core.d.ts +74 -0
- package/components/shortcuts/core.js +249 -0
- package/components/shortcuts/shortcut-title.d.ts +1 -0
- package/components/shortcuts/shortcut-title.js +56 -0
- package/components/shortcuts/shortcuts-hoc.d.ts +65 -0
- package/components/shortcuts/shortcuts-hoc.js +61 -0
- package/components/shortcuts/shortcuts.d.ts +28 -0
- package/components/shortcuts/shortcuts.js +92 -0
- package/components/storage/storage.d.ts +18 -0
- package/components/storage/storage.js +92 -0
- package/components/storage/storage__fallback.d.ts +79 -0
- package/components/storage/storage__fallback.js +254 -0
- package/components/storage/storage__local.d.ts +38 -0
- package/components/storage/storage__local.js +217 -0
- package/components/style.css +1 -0
- package/components/tab-trap/tab-trap.d.ts +43 -0
- package/components/tab-trap/tab-trap.js +180 -0
- package/components/table/cell.d.ts +13 -0
- package/components/table/cell.js +37 -0
- package/components/table/disable-hover-hoc.d.ts +64 -0
- package/components/table/disable-hover-hoc.js +62 -0
- package/components/table/header-cell.d.ts +43 -0
- package/components/table/header-cell.js +109 -0
- package/components/table/header.d.ts +56 -0
- package/components/table/header.js +151 -0
- package/components/table/multitable.d.ts +25 -0
- package/components/table/multitable.js +140 -0
- package/components/table/row-with-focus-sensor.d.ts +18 -0
- package/components/table/row-with-focus-sensor.js +117 -0
- package/components/table/row.d.ts +59 -0
- package/components/table/row.js +299 -0
- package/components/table/selection-adapter.d.ts +5 -0
- package/components/table/selection-adapter.js +14 -0
- package/components/table/selection-shortcuts-hoc.d.ts +17 -0
- package/components/table/selection-shortcuts-hoc.js +205 -0
- package/components/table/selection.d.ts +47 -0
- package/components/table/selection.js +257 -0
- package/components/table/smart-table.d.ts +64 -0
- package/components/table/smart-table.js +149 -0
- package/components/table/table.d.ts +159 -0
- package/components/table/table.js +463 -0
- package/components/tabs/collapsible-more.d.ts +29 -0
- package/components/tabs/collapsible-more.js +222 -0
- package/components/tabs/collapsible-tab.d.ts +16 -0
- package/components/tabs/collapsible-tab.js +88 -0
- package/components/tabs/collapsible-tabs.d.ts +43 -0
- package/components/tabs/collapsible-tabs.js +354 -0
- package/components/tabs/custom-item.d.ts +9 -0
- package/components/tabs/custom-item.js +11 -0
- package/components/tabs/dumb-tabs.d.ts +35 -0
- package/components/tabs/dumb-tabs.js +189 -0
- package/components/tabs/smart-tabs.d.ts +20 -0
- package/components/tabs/smart-tabs.js +141 -0
- package/components/tabs/tab-link.d.ts +18 -0
- package/components/tabs/tab-link.js +13 -0
- package/components/tabs/tab.d.ts +27 -0
- package/components/tabs/tab.js +41 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/tabs/tabs.js +99 -0
- package/components/tag/tag.d.ts +64 -0
- package/components/tag/tag.js +213 -0
- package/components/tags-input/tags-input.d.ts +138 -0
- package/components/tags-input/tags-input.js +534 -0
- package/components/tags-list/tags-list.d.ts +46 -0
- package/components/tags-list/tags-list.js +102 -0
- package/components/text/text.d.ts +23 -0
- package/components/text/text.js +57 -0
- package/components/toggle/toggle.d.ts +39 -0
- package/components/toggle/toggle.js +86 -0
- package/components/tooltip/tooltip.d.ts +65 -0
- package/components/tooltip/tooltip.js +229 -0
- package/components/user-agreement/service.d.ts +69 -0
- package/components/user-agreement/service.js +487 -0
- package/components/user-agreement/toolbox.eula.d.ts +2 -0
- package/components/user-agreement/toolbox.eula.js +3 -0
- package/components/user-agreement/user-agreement.d.ts +60 -0
- package/components/user-agreement/user-agreement.js +172 -0
- package/components/user-card/card.d.ts +70 -0
- package/components/user-card/card.js +80 -0
- package/components/user-card/smart-user-card-tooltip.d.ts +20 -0
- package/components/user-card/smart-user-card-tooltip.js +172 -0
- package/components/user-card/tooltip.d.ts +36 -0
- package/components/user-card/tooltip.js +144 -0
- package/components/user-card/user-card.d.ts +11 -0
- package/components/user-card/user-card.js +85 -0
- package/package.json +118 -0
- package/typings.d.ts +43 -0
@@ -0,0 +1,802 @@
|
|
1
|
+
import { _ as _defineProperty, a as _inherits, b as _createSuper, c as _classCallCheck, k as _assertThisInitialized, e as _objectWithoutProperties, d as _createClass, g as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.includes.js';
|
3
|
+
import 'core-js/modules/es.string.includes.js';
|
4
|
+
import 'core-js/modules/es.array.map.js';
|
5
|
+
import 'core-js/modules/es.array.concat.js';
|
6
|
+
import 'core-js/modules/es.symbol.js';
|
7
|
+
import 'core-js/modules/es.symbol.description.js';
|
8
|
+
import 'core-js/modules/es.object.to-string.js';
|
9
|
+
import 'core-js/modules/es.array.find-index.js';
|
10
|
+
import 'core-js/modules/es.object.assign.js';
|
11
|
+
import 'core-js/modules/es.array.find.js';
|
12
|
+
import React, { Component } from 'react';
|
13
|
+
import PropTypes from 'prop-types';
|
14
|
+
import classNames from 'classnames';
|
15
|
+
import VirtualizedList from 'react-virtualized/dist/es/List';
|
16
|
+
import AutoSizer from 'react-virtualized/dist/es/AutoSizer';
|
17
|
+
import WindowScroller from 'react-virtualized/dist/es/WindowScroller';
|
18
|
+
import { CellMeasurerCache, CellMeasurer } from 'react-virtualized/dist/es/CellMeasurer';
|
19
|
+
import deprecate from 'util-deprecate';
|
20
|
+
import memoizeOne from 'memoize-one';
|
21
|
+
import joinDataTestAttributes from '../global/data-tests.js';
|
22
|
+
import getUID from '../global/get-uid.js';
|
23
|
+
import scheduleRAF from '../global/schedule-raf.js';
|
24
|
+
import memoize from '../global/memoize.js';
|
25
|
+
import { preventDefault } from '../global/dom.js';
|
26
|
+
import Shortcuts from '../shortcuts/shortcuts.js';
|
27
|
+
import createStatefulContext from '../global/create-stateful-context.js';
|
28
|
+
import ListLink from './list__link.js';
|
29
|
+
import ListItem from './list__item.js';
|
30
|
+
import ListCustom from './list__custom.js';
|
31
|
+
import ListTitle from './list__title.js';
|
32
|
+
import ListSeparator from './list__separator.js';
|
33
|
+
import ListHint from './list__hint.js';
|
34
|
+
import { Type, Dimension, DEFAULT_ITEM_TYPE } from './consts.js';
|
35
|
+
import { m as modules_3b67a421 } from '../_helpers/list.js';
|
36
|
+
import 'core-js/modules/es.array.reduce.js';
|
37
|
+
import 'core-js/modules/es.object.entries.js';
|
38
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
39
|
+
import 'core-js/modules/es.array.iterator.js';
|
40
|
+
import 'core-js/modules/es.map.js';
|
41
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
42
|
+
import 'core-js/modules/es.weak-map.js';
|
43
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
44
|
+
import 'core-js/modules/es.array.filter.js';
|
45
|
+
import 'core-js/modules/es.regexp.exec.js';
|
46
|
+
import 'core-js/modules/es.string.split.js';
|
47
|
+
import 'core-js/modules/es.set.js';
|
48
|
+
import '../shortcuts/core.js';
|
49
|
+
import 'core-js/modules/es.array.slice.js';
|
50
|
+
import 'core-js/modules/es.array.splice.js';
|
51
|
+
import 'core-js/modules/es.string.match.js';
|
52
|
+
import 'combokeys';
|
53
|
+
import '../global/sniffer.js';
|
54
|
+
import 'sniffr';
|
55
|
+
import '../link/link.js';
|
56
|
+
import '../link/clickableLink.js';
|
57
|
+
import '../_helpers/link.js';
|
58
|
+
import 'core-js/modules/es.array.index-of.js';
|
59
|
+
import '../avatar/avatar.js';
|
60
|
+
import '../global/url.js';
|
61
|
+
import 'core-js/modules/es.string.replace.js';
|
62
|
+
import '../avatar/fallback-avatar.js';
|
63
|
+
import 'core-js/modules/es.array.from.js';
|
64
|
+
import '../checkbox/checkbox.js';
|
65
|
+
import '@jetbrains/icons/checkmark-14px';
|
66
|
+
import '@jetbrains/icons/remove-14px';
|
67
|
+
import '../icon/icon.js';
|
68
|
+
import '../icon/icon__constants.js';
|
69
|
+
import '../_helpers/icon__svg.js';
|
70
|
+
import 'core-js/modules/es.string.starts-with.js';
|
71
|
+
import '../global/prop-types.js';
|
72
|
+
import '../global/composeRefs.js';
|
73
|
+
import '../global/get-event-key.js';
|
74
|
+
|
75
|
+
var _excluded = ["selectedLabel", "originalModel"];
|
76
|
+
function noop() {}
|
77
|
+
var warnEmptyKey = deprecate(function () {}, 'No key passed for list item with non-string label. It is considered as a bad practice and has been deprecated, please provide a key.');
|
78
|
+
/**
|
79
|
+
* @param {Type} listItemType
|
80
|
+
* @param {Object} item list item
|
81
|
+
*/
|
82
|
+
function isItemType(listItemType, item) {
|
83
|
+
var type = item.rgItemType;
|
84
|
+
if (type == null) {
|
85
|
+
type = DEFAULT_ITEM_TYPE;
|
86
|
+
}
|
87
|
+
return type === listItemType;
|
88
|
+
}
|
89
|
+
var nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
|
90
|
+
function isActivatable(item) {
|
91
|
+
return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
|
92
|
+
}
|
93
|
+
function getDataHash(data) {
|
94
|
+
return data.map(function (it) {
|
95
|
+
return "".concat(it.key, "-").concat(it.disabled);
|
96
|
+
}).join('-');
|
97
|
+
}
|
98
|
+
var shouldActivateFirstItem = function shouldActivateFirstItem(props) {
|
99
|
+
return props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
|
100
|
+
};
|
101
|
+
var ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
|
102
|
+
/**
|
103
|
+
* @name List
|
104
|
+
* @constructor
|
105
|
+
* @extends {ReactComponent}
|
106
|
+
*/
|
107
|
+
/**
|
108
|
+
* Displays a list of items.
|
109
|
+
*/
|
110
|
+
var List = /*#__PURE__*/function (_Component) {
|
111
|
+
_inherits(List, _Component);
|
112
|
+
var _super = _createSuper(List);
|
113
|
+
function List() {
|
114
|
+
var _this;
|
115
|
+
_classCallCheck(this, List);
|
116
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
117
|
+
args[_key] = arguments[_key];
|
118
|
+
}
|
119
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
121
|
+
activeIndex: null,
|
122
|
+
prevActiveIndex: null,
|
123
|
+
prevData: [],
|
124
|
+
activeItem: null,
|
125
|
+
needScrollToActive: false,
|
126
|
+
scrolling: false,
|
127
|
+
hasOverflow: false,
|
128
|
+
disabledHover: false,
|
129
|
+
scrolledToBottom: false
|
130
|
+
});
|
131
|
+
_defineProperty(_assertThisInitialized(_this), "scheduleScrollListener", scheduleRAF());
|
132
|
+
_defineProperty(_assertThisInitialized(_this), "scheduleHoverListener", scheduleRAF());
|
133
|
+
_defineProperty(_assertThisInitialized(_this), "virtualizedList", void 0);
|
134
|
+
_defineProperty(_assertThisInitialized(_this), "unmounted", void 0);
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
136
|
+
_defineProperty(_assertThisInitialized(_this), "hoverHandler", memoize(function (index) {
|
137
|
+
return function () {
|
138
|
+
return _this.scheduleHoverListener(function () {
|
139
|
+
if (_this.state.disabledHover) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
if (_this.container) {
|
143
|
+
_this.setState({
|
144
|
+
activeIndex: index,
|
145
|
+
activeItem: _this.props.data[index],
|
146
|
+
needScrollToActive: false
|
147
|
+
});
|
148
|
+
}
|
149
|
+
});
|
150
|
+
};
|
151
|
+
}));
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
153
|
+
_defineProperty(_assertThisInitialized(_this), "_bufferSize", 10);
|
154
|
+
// keep X items above and below of the visible area
|
155
|
+
// reuse size cache for similar items
|
156
|
+
_defineProperty(_assertThisInitialized(_this), "sizeCacheKey", function (index) {
|
157
|
+
if (index === 0 || index === _this.props.data.length + 1) {
|
158
|
+
return Type.MARGIN;
|
159
|
+
}
|
160
|
+
var item = _this.props.data[index - 1];
|
161
|
+
var isFirst = index === 1;
|
162
|
+
switch (item.rgItemType) {
|
163
|
+
case Type.SEPARATOR:
|
164
|
+
case Type.TITLE:
|
165
|
+
return "".concat(item.rgItemType).concat(isFirst ? '_first' : '').concat(item.description ? '_desc' : '');
|
166
|
+
case Type.MARGIN:
|
167
|
+
return Type.MARGIN;
|
168
|
+
case Type.CUSTOM:
|
169
|
+
return "".concat(Type.CUSTOM, "_").concat(item.key);
|
170
|
+
case Type.ITEM:
|
171
|
+
case Type.LINK:
|
172
|
+
default:
|
173
|
+
if (item.details) {
|
174
|
+
return "".concat(Type.ITEM, "_").concat(item.details);
|
175
|
+
}
|
176
|
+
return Type.ITEM;
|
177
|
+
}
|
178
|
+
});
|
179
|
+
_defineProperty(_assertThisInitialized(_this), "_cache", new CellMeasurerCache({
|
180
|
+
defaultHeight: _this.defaultItemHeight(),
|
181
|
+
fixedWidth: true,
|
182
|
+
keyMapper: _this.sizeCacheKey
|
183
|
+
}));
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "_hasActivatableItems", memoizeOne(function (items) {
|
185
|
+
return items.some(isActivatable);
|
186
|
+
}));
|
187
|
+
_defineProperty(_assertThisInitialized(_this), "activateFirst", function () {
|
188
|
+
var firstActivatableIndex = _this.props.data.findIndex(isActivatable);
|
189
|
+
if (firstActivatableIndex >= 0) {
|
190
|
+
_this.setState({
|
191
|
+
activeIndex: firstActivatableIndex,
|
192
|
+
activeItem: _this.props.data[firstActivatableIndex],
|
193
|
+
needScrollToActive: true
|
194
|
+
});
|
195
|
+
}
|
196
|
+
});
|
197
|
+
_defineProperty(_assertThisInitialized(_this), "selectHandler", memoize(function (index) {
|
198
|
+
return function (event) {
|
199
|
+
var tryKeepOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
200
|
+
var item = _this.props.data[index];
|
201
|
+
if (!_this.props.useMouseUp && item.onClick) {
|
202
|
+
item.onClick(item, event);
|
203
|
+
} else if (_this.props.useMouseUp && item.onMouseUp) {
|
204
|
+
item.onMouseUp(item, event);
|
205
|
+
}
|
206
|
+
if (_this.props.onSelect) {
|
207
|
+
_this.props.onSelect(item, event, {
|
208
|
+
tryKeepOpen
|
209
|
+
});
|
210
|
+
}
|
211
|
+
};
|
212
|
+
}));
|
213
|
+
_defineProperty(_assertThisInitialized(_this), "checkboxHandler", memoize(function (index) {
|
214
|
+
return function (event) {
|
215
|
+
return _this.selectHandler(index)(event, true);
|
216
|
+
};
|
217
|
+
}));
|
218
|
+
_defineProperty(_assertThisInitialized(_this), "upHandler", function (e) {
|
219
|
+
var _this$props = _this.props,
|
220
|
+
data = _this$props.data,
|
221
|
+
disableMoveOverflow = _this$props.disableMoveOverflow;
|
222
|
+
var index = _this.state.activeIndex;
|
223
|
+
var newIndex;
|
224
|
+
if (index === null || index === 0) {
|
225
|
+
if (!disableMoveOverflow) {
|
226
|
+
newIndex = data.length - 1;
|
227
|
+
} else {
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
} else {
|
231
|
+
newIndex = index - 1;
|
232
|
+
}
|
233
|
+
_this.moveHandler(newIndex, _this.upHandler, e);
|
234
|
+
});
|
235
|
+
_defineProperty(_assertThisInitialized(_this), "downHandler", function (e) {
|
236
|
+
var _this$props2 = _this.props,
|
237
|
+
data = _this$props2.data,
|
238
|
+
disableMoveOverflow = _this$props2.disableMoveOverflow,
|
239
|
+
disableMoveDownOverflow = _this$props2.disableMoveDownOverflow;
|
240
|
+
var index = _this.state.activeIndex;
|
241
|
+
var newIndex;
|
242
|
+
if (index === null) {
|
243
|
+
newIndex = 0;
|
244
|
+
} else if (index + 1 === data.length) {
|
245
|
+
if (!disableMoveOverflow && !disableMoveDownOverflow) {
|
246
|
+
newIndex = 0;
|
247
|
+
} else {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
} else {
|
251
|
+
newIndex = index + 1;
|
252
|
+
}
|
253
|
+
_this.moveHandler(newIndex, _this.downHandler, e);
|
254
|
+
});
|
255
|
+
_defineProperty(_assertThisInitialized(_this), "homeHandler", function (e) {
|
256
|
+
_this.moveHandler(0, _this.downHandler, e);
|
257
|
+
});
|
258
|
+
_defineProperty(_assertThisInitialized(_this), "endHandler", function (e) {
|
259
|
+
_this.moveHandler(_this.props.data.length - 1, _this.upHandler, e);
|
260
|
+
});
|
261
|
+
_defineProperty(_assertThisInitialized(_this), "onDocumentMouseMove", function () {
|
262
|
+
if (_this.state.disabledHover) {
|
263
|
+
_this.setState({
|
264
|
+
disabledHover: false
|
265
|
+
});
|
266
|
+
}
|
267
|
+
});
|
268
|
+
_defineProperty(_assertThisInitialized(_this), "onDocumentKeyDown", function (e) {
|
269
|
+
var metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line @typescript-eslint/no-magic-numbers
|
270
|
+
if (!_this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
|
271
|
+
_this.setState({
|
272
|
+
disabledHover: true
|
273
|
+
});
|
274
|
+
}
|
275
|
+
});
|
276
|
+
_defineProperty(_assertThisInitialized(_this), "mouseHandler", function () {
|
277
|
+
_this.setState({
|
278
|
+
scrolling: false
|
279
|
+
});
|
280
|
+
});
|
281
|
+
_defineProperty(_assertThisInitialized(_this), "scrollHandler", function () {
|
282
|
+
_this.setState({
|
283
|
+
scrolling: true
|
284
|
+
}, _this.scrollEndHandler);
|
285
|
+
});
|
286
|
+
_defineProperty(_assertThisInitialized(_this), "enterHandler", function (event, shortcut) {
|
287
|
+
if (_this.state.activeIndex !== null) {
|
288
|
+
var item = _this.props.data[_this.state.activeIndex];
|
289
|
+
_this.selectHandler(_this.state.activeIndex)(event);
|
290
|
+
if (item.href && !event.defaultPrevented) {
|
291
|
+
if (shortcut != null && ['command+enter', 'ctrl+enter'].includes(shortcut)) {
|
292
|
+
window.open(item.href, '_blank');
|
293
|
+
} else if (shortcut === 'shift+enter') {
|
294
|
+
window.open(item.href);
|
295
|
+
} else {
|
296
|
+
window.location.href = item.href;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
return false; // do not propagate event
|
300
|
+
} else {
|
301
|
+
return true; // propagate event to the parent component (e.g., QueryAssist)
|
302
|
+
}
|
303
|
+
});
|
304
|
+
_defineProperty(_assertThisInitialized(_this), "clearSelected", function () {
|
305
|
+
_this.setState({
|
306
|
+
activeIndex: null,
|
307
|
+
needScrollToActive: false
|
308
|
+
});
|
309
|
+
});
|
310
|
+
_defineProperty(_assertThisInitialized(_this), "scrollEndHandler", function () {
|
311
|
+
return _this.scheduleScrollListener(function () {
|
312
|
+
var innerContainer = _this.inner;
|
313
|
+
if (innerContainer) {
|
314
|
+
var maxScrollingPosition = innerContainer.scrollHeight;
|
315
|
+
var sensitivity = _this.defaultItemHeight() / 2;
|
316
|
+
var currentScrollingPosition = innerContainer.scrollTop + innerContainer.clientHeight + sensitivity;
|
317
|
+
var scrolledToBottom = maxScrollingPosition > 0 && currentScrollingPosition >= maxScrollingPosition;
|
318
|
+
if (!_this.unmounted) {
|
319
|
+
_this.setState({
|
320
|
+
scrolledToBottom
|
321
|
+
});
|
322
|
+
}
|
323
|
+
if (scrolledToBottom) {
|
324
|
+
_this.props.onScrollToBottom();
|
325
|
+
}
|
326
|
+
}
|
327
|
+
});
|
328
|
+
});
|
329
|
+
_defineProperty(_assertThisInitialized(_this), "checkOverflow", function () {
|
330
|
+
if (_this.inner) {
|
331
|
+
_this.setState({
|
332
|
+
hasOverflow: _this.inner.scrollHeight - _this.inner.clientHeight > 1
|
333
|
+
});
|
334
|
+
}
|
335
|
+
});
|
336
|
+
_defineProperty(_assertThisInitialized(_this), "renderItem", function (_ref) {
|
337
|
+
var _ref$index = _ref.index,
|
338
|
+
index = _ref$index === void 0 ? 1 : _ref$index,
|
339
|
+
style = _ref.style,
|
340
|
+
_ref$isScrolling = _ref.isScrolling,
|
341
|
+
isScrolling = _ref$isScrolling === void 0 ? false : _ref$isScrolling,
|
342
|
+
parent = _ref.parent,
|
343
|
+
key = _ref.key;
|
344
|
+
var itemKey;
|
345
|
+
var el;
|
346
|
+
var realIndex = index - 1;
|
347
|
+
var item = _this.props.data[realIndex];
|
348
|
+
var itemId = _this.getId(item);
|
349
|
+
// top and bottom margins
|
350
|
+
if (index === 0 || index === _this.props.data.length + 1 || item.rgItemType === Type.MARGIN) {
|
351
|
+
itemKey = key || "".concat(Type.MARGIN, "_").concat(index);
|
352
|
+
el = /*#__PURE__*/React.createElement("div", {
|
353
|
+
style: {
|
354
|
+
height: Dimension.MARGIN
|
355
|
+
}
|
356
|
+
});
|
357
|
+
} else {
|
358
|
+
// Hack around SelectNG implementation
|
359
|
+
item.selectedLabel;
|
360
|
+
item.originalModel;
|
361
|
+
var restProps = _objectWithoutProperties(item, _excluded);
|
362
|
+
var cleanedProps = restProps;
|
363
|
+
if (cleanedProps.url) {
|
364
|
+
cleanedProps.href = cleanedProps.url;
|
365
|
+
}
|
366
|
+
if (cleanedProps.href) {
|
367
|
+
cleanedProps.rgItemType = Type.LINK;
|
368
|
+
}
|
369
|
+
var itemProps = Object.assign({
|
370
|
+
rgItemType: DEFAULT_ITEM_TYPE
|
371
|
+
}, restProps);
|
372
|
+
itemKey = key || itemId;
|
373
|
+
itemProps.hover = realIndex === _this.state.activeIndex;
|
374
|
+
if (itemProps.hoverClassName != null && itemProps.hover) {
|
375
|
+
itemProps.className = classNames(itemProps.className, itemProps.hoverClassName);
|
376
|
+
}
|
377
|
+
itemProps.onMouseOver = _this.hoverHandler(realIndex);
|
378
|
+
itemProps.tabIndex = -1;
|
379
|
+
itemProps.scrolling = isScrolling;
|
380
|
+
var selectHandler = _this.selectHandler(realIndex);
|
381
|
+
if (_this.props.useMouseUp) {
|
382
|
+
itemProps.onMouseUp = selectHandler;
|
383
|
+
} else {
|
384
|
+
itemProps.onClick = selectHandler;
|
385
|
+
}
|
386
|
+
itemProps.onCheckboxChange = _this.checkboxHandler(realIndex);
|
387
|
+
if (itemProps.compact == null) {
|
388
|
+
itemProps.compact = _this.props.compact;
|
389
|
+
}
|
390
|
+
var ItemComponent;
|
391
|
+
var isFirst = index === 1;
|
392
|
+
switch (itemProps.rgItemType) {
|
393
|
+
case Type.SEPARATOR:
|
394
|
+
ItemComponent = ListSeparator;
|
395
|
+
itemProps.isFirst = isFirst;
|
396
|
+
break;
|
397
|
+
case Type.LINK:
|
398
|
+
ItemComponent = ListLink;
|
399
|
+
_this.addItemDataTestToProp(itemProps);
|
400
|
+
break;
|
401
|
+
case Type.ITEM:
|
402
|
+
ItemComponent = ListItem;
|
403
|
+
_this.addItemDataTestToProp(itemProps);
|
404
|
+
break;
|
405
|
+
case Type.CUSTOM:
|
406
|
+
ItemComponent = ListCustom;
|
407
|
+
_this.addItemDataTestToProp(itemProps);
|
408
|
+
break;
|
409
|
+
case Type.TITLE:
|
410
|
+
itemProps.isFirst = isFirst;
|
411
|
+
ItemComponent = ListTitle;
|
412
|
+
break;
|
413
|
+
default:
|
414
|
+
throw new Error("Unknown menu element type: ".concat(itemProps.rgItemType));
|
415
|
+
}
|
416
|
+
el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
|
417
|
+
}
|
418
|
+
return parent ? /*#__PURE__*/React.createElement(CellMeasurer, {
|
419
|
+
cache: _this._cache,
|
420
|
+
key: itemKey,
|
421
|
+
parent: parent,
|
422
|
+
rowIndex: index,
|
423
|
+
columnIndex: 0
|
424
|
+
}, function (_ref2) {
|
425
|
+
var registerChild = _ref2.registerChild;
|
426
|
+
return /*#__PURE__*/React.createElement("div", {
|
427
|
+
ref: registerChild,
|
428
|
+
style: style,
|
429
|
+
role: "row",
|
430
|
+
id: itemId
|
431
|
+
}, /*#__PURE__*/React.createElement("div", {
|
432
|
+
role: "cell"
|
433
|
+
}, el));
|
434
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
435
|
+
role: "row",
|
436
|
+
id: itemId,
|
437
|
+
key: itemKey
|
438
|
+
}, /*#__PURE__*/React.createElement("div", {
|
439
|
+
role: "cell"
|
440
|
+
}, el));
|
441
|
+
});
|
442
|
+
_defineProperty(_assertThisInitialized(_this), "addItemDataTestToProp", function (props) {
|
443
|
+
props['data-test'] = joinDataTestAttributes('ring-list-item', props['data-test']);
|
444
|
+
return props;
|
445
|
+
});
|
446
|
+
_defineProperty(_assertThisInitialized(_this), "virtualizedListRef", function (el) {
|
447
|
+
_this.virtualizedList = el;
|
448
|
+
});
|
449
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", function (el) {
|
450
|
+
_this.container = el;
|
451
|
+
});
|
452
|
+
_defineProperty(_assertThisInitialized(_this), "_inner", void 0);
|
453
|
+
_defineProperty(_assertThisInitialized(_this), "id", getUID('list-'));
|
454
|
+
_defineProperty(_assertThisInitialized(_this), "shortcutsScope", _this.id);
|
455
|
+
_defineProperty(_assertThisInitialized(_this), "shortcutsMap", {
|
456
|
+
up: _this.upHandler,
|
457
|
+
down: _this.downHandler,
|
458
|
+
home: _this.homeHandler,
|
459
|
+
end: _this.endHandler,
|
460
|
+
enter: _this.enterHandler,
|
461
|
+
'meta+enter': _this.enterHandler,
|
462
|
+
'ctrl+enter': _this.enterHandler,
|
463
|
+
'command+enter': _this.enterHandler,
|
464
|
+
'shift+enter': _this.enterHandler
|
465
|
+
});
|
466
|
+
return _this;
|
467
|
+
}
|
468
|
+
_createClass(List, [{
|
469
|
+
key: "componentDidMount",
|
470
|
+
value: function componentDidMount() {
|
471
|
+
document.addEventListener('mousemove', this.onDocumentMouseMove);
|
472
|
+
document.addEventListener('keydown', this.onDocumentKeyDown, true);
|
473
|
+
if (this.props.activeIndex == null && shouldActivateFirstItem(this.props)) {
|
474
|
+
this.activateFirst();
|
475
|
+
}
|
476
|
+
}
|
477
|
+
}, {
|
478
|
+
key: "shouldComponentUpdate",
|
479
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
480
|
+
var _this2 = this;
|
481
|
+
return nextProps !== this.props || Object.keys(nextState).some(function (key) {
|
482
|
+
return nextState[key] !== _this2.state[key];
|
483
|
+
});
|
484
|
+
}
|
485
|
+
}, {
|
486
|
+
key: "componentDidUpdate",
|
487
|
+
value: function componentDidUpdate(prevProps) {
|
488
|
+
if (this.virtualizedList && prevProps.data !== this.props.data) {
|
489
|
+
this.virtualizedList.recomputeRowHeights();
|
490
|
+
}
|
491
|
+
if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
|
492
|
+
this.activateFirst();
|
493
|
+
}
|
494
|
+
this.checkOverflow();
|
495
|
+
}
|
496
|
+
}, {
|
497
|
+
key: "componentWillUnmount",
|
498
|
+
value: function componentWillUnmount() {
|
499
|
+
this.unmounted = true;
|
500
|
+
document.removeEventListener('mousemove', this.onDocumentMouseMove);
|
501
|
+
document.removeEventListener('keydown', this.onDocumentKeyDown, true);
|
502
|
+
}
|
503
|
+
}, {
|
504
|
+
key: "hasActivatableItems",
|
505
|
+
value: function hasActivatableItems() {
|
506
|
+
return this._hasActivatableItems(this.props.data);
|
507
|
+
}
|
508
|
+
}, {
|
509
|
+
key: "moveHandler",
|
510
|
+
value: function moveHandler(index, retryCallback, e) {
|
511
|
+
var correctedIndex;
|
512
|
+
if (this.props.data.length === 0 || !this.hasActivatableItems()) {
|
513
|
+
return;
|
514
|
+
} else if (this.props.data.length < index) {
|
515
|
+
correctedIndex = 0;
|
516
|
+
} else {
|
517
|
+
correctedIndex = index;
|
518
|
+
}
|
519
|
+
var item = this.props.data[correctedIndex];
|
520
|
+
this.setState({
|
521
|
+
activeIndex: correctedIndex,
|
522
|
+
activeItem: item,
|
523
|
+
needScrollToActive: true
|
524
|
+
}, function onSet() {
|
525
|
+
if (!isActivatable(item)) {
|
526
|
+
retryCallback(e);
|
527
|
+
return;
|
528
|
+
}
|
529
|
+
if (e.key !== 'Home' && e.key !== 'End') {
|
530
|
+
preventDefault(e);
|
531
|
+
}
|
532
|
+
});
|
533
|
+
}
|
534
|
+
}, {
|
535
|
+
key: "getFirst",
|
536
|
+
value: function getFirst() {
|
537
|
+
return this.props.data.find(function (item) {
|
538
|
+
return item.rgItemType === Type.ITEM || item.rgItemType === Type.CUSTOM;
|
539
|
+
});
|
540
|
+
}
|
541
|
+
}, {
|
542
|
+
key: "getSelected",
|
543
|
+
value: function getSelected() {
|
544
|
+
return this.state.activeIndex != null ? this.props.data[this.state.activeIndex] : null;
|
545
|
+
}
|
546
|
+
}, {
|
547
|
+
key: "defaultItemHeight",
|
548
|
+
value: function defaultItemHeight() {
|
549
|
+
return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
|
550
|
+
}
|
551
|
+
}, {
|
552
|
+
key: "getVisibleListHeight",
|
553
|
+
value: function getVisibleListHeight(maxHeight) {
|
554
|
+
return maxHeight - this.defaultItemHeight() - Dimension.INNER_PADDING;
|
555
|
+
}
|
556
|
+
}, {
|
557
|
+
key: "_deprecatedGenerateKeyFromContent",
|
558
|
+
value: function _deprecatedGenerateKeyFromContent(itemProps) {
|
559
|
+
var identificator = itemProps.label || itemProps.description;
|
560
|
+
var isString = typeof identificator === 'string' || identificator instanceof String;
|
561
|
+
if (identificator && !isString) {
|
562
|
+
warnEmptyKey();
|
563
|
+
"".concat(itemProps.rgItemType, "_").concat(JSON.stringify(identificator));
|
564
|
+
}
|
565
|
+
return "".concat(itemProps.rgItemType, "_").concat(identificator);
|
566
|
+
}
|
567
|
+
}, {
|
568
|
+
key: "getId",
|
569
|
+
value: function getId(item) {
|
570
|
+
return item != null ? "".concat(this.id, ":").concat(item.key || this._deprecatedGenerateKeyFromContent(item)) : undefined;
|
571
|
+
}
|
572
|
+
}, {
|
573
|
+
key: "inner",
|
574
|
+
get: function get() {
|
575
|
+
if (!this._inner) {
|
576
|
+
this._inner = this.container && this.container.querySelector('.ring-list__i');
|
577
|
+
}
|
578
|
+
return this._inner;
|
579
|
+
}
|
580
|
+
}, {
|
581
|
+
key: "renderVirtualizedInner",
|
582
|
+
value: function renderVirtualizedInner(_ref3) {
|
583
|
+
var _this3 = this;
|
584
|
+
var height = _ref3.height,
|
585
|
+
maxHeight = _ref3.maxHeight,
|
586
|
+
_ref3$autoHeight = _ref3.autoHeight,
|
587
|
+
autoHeight = _ref3$autoHeight === void 0 ? false : _ref3$autoHeight,
|
588
|
+
rowCount = _ref3.rowCount,
|
589
|
+
isScrolling = _ref3.isScrolling,
|
590
|
+
_ref3$onChildScroll = _ref3.onChildScroll,
|
591
|
+
onChildScroll = _ref3$onChildScroll === void 0 ? noop : _ref3$onChildScroll,
|
592
|
+
scrollTop = _ref3.scrollTop,
|
593
|
+
registerChild = _ref3.registerChild;
|
594
|
+
var dirOverride = {
|
595
|
+
direction: 'inherit'
|
596
|
+
}; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
|
597
|
+
return /*#__PURE__*/React.createElement(AutoSizer, {
|
598
|
+
disableHeight: true,
|
599
|
+
onResize: this.props.onResize
|
600
|
+
}, function (_ref4) {
|
601
|
+
var width = _ref4.width;
|
602
|
+
return /*#__PURE__*/React.createElement("div", {
|
603
|
+
ref: registerChild
|
604
|
+
}, /*#__PURE__*/React.createElement(VirtualizedList, {
|
605
|
+
"aria-label": _this3.props.ariaLabel,
|
606
|
+
ref: _this3.virtualizedListRef,
|
607
|
+
className: "ring-list__i",
|
608
|
+
autoHeight: autoHeight,
|
609
|
+
style: maxHeight ? _objectSpread2({
|
610
|
+
maxHeight,
|
611
|
+
height: 'auto'
|
612
|
+
}, dirOverride) : dirOverride,
|
613
|
+
autoContainerWidth: true,
|
614
|
+
height: height,
|
615
|
+
width: width,
|
616
|
+
isScrolling: isScrolling,
|
617
|
+
onScroll: function onScroll(e) {
|
618
|
+
onChildScroll(e);
|
619
|
+
_this3.scrollEndHandler();
|
620
|
+
},
|
621
|
+
scrollTop: scrollTop,
|
622
|
+
rowCount: rowCount,
|
623
|
+
estimatedRowSize: _this3.defaultItemHeight(),
|
624
|
+
rowHeight: _this3._cache.rowHeight,
|
625
|
+
rowRenderer: _this3.renderItem,
|
626
|
+
overscanRowCount: _this3._bufferSize
|
627
|
+
// ensure rerendering
|
628
|
+
,
|
629
|
+
noop: function noop() {},
|
630
|
+
scrollToIndex: !_this3.props.disableScrollToActive && _this3.state.needScrollToActive && _this3.state.activeIndex != null ? _this3.state.activeIndex + 1 : undefined,
|
631
|
+
scrollToAlignment: "center",
|
632
|
+
deferredMeasurementCache: _this3._cache,
|
633
|
+
onRowsRendered: _this3.checkOverflow
|
634
|
+
}));
|
635
|
+
});
|
636
|
+
}
|
637
|
+
}, {
|
638
|
+
key: "renderVirtualized",
|
639
|
+
value: function renderVirtualized(maxHeight, rowCount) {
|
640
|
+
var _this4 = this;
|
641
|
+
if (maxHeight) {
|
642
|
+
return this.renderVirtualizedInner({
|
643
|
+
height: maxHeight,
|
644
|
+
maxHeight,
|
645
|
+
rowCount
|
646
|
+
});
|
647
|
+
}
|
648
|
+
return /*#__PURE__*/React.createElement(WindowScroller, null, function (props) {
|
649
|
+
return _this4.renderVirtualizedInner(_objectSpread2(_objectSpread2({}, props), {}, {
|
650
|
+
rowCount,
|
651
|
+
autoHeight: true
|
652
|
+
}));
|
653
|
+
});
|
654
|
+
}
|
655
|
+
}, {
|
656
|
+
key: "renderSimple",
|
657
|
+
value: function renderSimple(maxHeight, rowCount) {
|
658
|
+
var items = [];
|
659
|
+
for (var index = 0; index < rowCount; index++) {
|
660
|
+
items.push(this.renderItem({
|
661
|
+
index,
|
662
|
+
isScrolling: this.state.scrolling
|
663
|
+
}));
|
664
|
+
}
|
665
|
+
return /*#__PURE__*/React.createElement("div", {
|
666
|
+
className: classNames('ring-list__i', modules_3b67a421.simpleInner),
|
667
|
+
onScroll: this.scrollHandler,
|
668
|
+
onMouseMove: this.mouseHandler
|
669
|
+
}, /*#__PURE__*/React.createElement("div", {
|
670
|
+
"aria-label": this.props.ariaLabel,
|
671
|
+
role: "grid",
|
672
|
+
style: maxHeight ? {
|
673
|
+
maxHeight: this.getVisibleListHeight(maxHeight)
|
674
|
+
} : undefined
|
675
|
+
}, items));
|
676
|
+
}
|
677
|
+
}, {
|
678
|
+
key: "render",
|
679
|
+
value: /** @override */
|
680
|
+
function render() {
|
681
|
+
var hint = this.getSelected() && this.props.hintOnSelection || this.props.hint;
|
682
|
+
var fadeStyles = hint ? {
|
683
|
+
bottom: Dimension.ITEM_HEIGHT
|
684
|
+
} : undefined;
|
685
|
+
var rowCount = this.props.data.length + 2;
|
686
|
+
var maxHeight = this.props.maxHeight && this.getVisibleListHeight(this.props.maxHeight);
|
687
|
+
var classes = classNames(modules_3b67a421.list, this.props.className);
|
688
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActiveItemContext.Updater, {
|
689
|
+
value: this.getId(this.state.activeItem),
|
690
|
+
skipUpdate: this.props.hidden || !isActivatable(this.state.activeItem)
|
691
|
+
}), /*#__PURE__*/React.createElement("div", {
|
692
|
+
id: this.props.id,
|
693
|
+
ref: this.containerRef,
|
694
|
+
className: classes,
|
695
|
+
onMouseOut: this.props.onMouseOut,
|
696
|
+
onBlur: this.props.onMouseOut,
|
697
|
+
onMouseLeave: this.clearSelected,
|
698
|
+
"data-test": "ring-list"
|
699
|
+
}, this.props.shortcuts && /*#__PURE__*/React.createElement(Shortcuts, {
|
700
|
+
map: this.props.shortcutsMap ? _objectSpread2(_objectSpread2({}, this.shortcutsMap), this.props.shortcutsMap) : this.shortcutsMap,
|
701
|
+
scope: this.shortcutsScope
|
702
|
+
}), this.props.renderOptimization ? this.renderVirtualized(maxHeight, rowCount) : this.renderSimple(maxHeight, rowCount), this.state.hasOverflow && !this.state.scrolledToBottom && /*#__PURE__*/React.createElement("div", {
|
703
|
+
className: modules_3b67a421.fade,
|
704
|
+
style: fadeStyles
|
705
|
+
}), hint && /*#__PURE__*/React.createElement(ListHint, {
|
706
|
+
label: hint
|
707
|
+
})));
|
708
|
+
}
|
709
|
+
}], [{
|
710
|
+
key: "getDerivedStateFromProps",
|
711
|
+
value: function getDerivedStateFromProps(nextProps, prevState) {
|
712
|
+
var prevActiveIndex = prevState.prevActiveIndex,
|
713
|
+
prevData = prevState.prevData,
|
714
|
+
activeItem = prevState.activeItem;
|
715
|
+
var data = nextProps.data,
|
716
|
+
activeIndex = nextProps.activeIndex,
|
717
|
+
restoreActiveIndex = nextProps.restoreActiveIndex;
|
718
|
+
var nextState = {
|
719
|
+
prevActiveIndex: activeIndex,
|
720
|
+
prevData: data
|
721
|
+
};
|
722
|
+
if (data !== prevData) {
|
723
|
+
Object.assign(nextState, {
|
724
|
+
activeIndex: null,
|
725
|
+
activeItem: null
|
726
|
+
});
|
727
|
+
}
|
728
|
+
if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
|
729
|
+
Object.assign(nextState, {
|
730
|
+
activeIndex,
|
731
|
+
activeItem: data[activeIndex],
|
732
|
+
needScrollToActive: true
|
733
|
+
});
|
734
|
+
} else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
|
735
|
+
// Restore active index if there is an item with the same "key" property
|
736
|
+
var index = data.findIndex(function (item) {
|
737
|
+
return item.key === activeItem.key;
|
738
|
+
});
|
739
|
+
if (index >= 0) {
|
740
|
+
Object.assign(nextState, {
|
741
|
+
activeIndex: index,
|
742
|
+
activeItem: data[index]
|
743
|
+
});
|
744
|
+
}
|
745
|
+
}
|
746
|
+
return nextState;
|
747
|
+
}
|
748
|
+
}]);
|
749
|
+
return List;
|
750
|
+
}(Component);
|
751
|
+
_defineProperty(List, "propTypes", {
|
752
|
+
id: PropTypes.string,
|
753
|
+
className: PropTypes.string,
|
754
|
+
hint: PropTypes.node,
|
755
|
+
hintOnSelection: PropTypes.string,
|
756
|
+
data: PropTypes.array,
|
757
|
+
maxHeight: PropTypes.number,
|
758
|
+
activeIndex: PropTypes.number,
|
759
|
+
restoreActiveIndex: PropTypes.bool,
|
760
|
+
activateSingleItem: PropTypes.bool,
|
761
|
+
activateFirstItem: PropTypes.bool,
|
762
|
+
shortcuts: PropTypes.bool,
|
763
|
+
shortcutsMap: PropTypes.object,
|
764
|
+
onMouseOut: PropTypes.func,
|
765
|
+
onSelect: PropTypes.func,
|
766
|
+
onScrollToBottom: PropTypes.func,
|
767
|
+
onResize: PropTypes.func,
|
768
|
+
useMouseUp: PropTypes.bool,
|
769
|
+
visible: PropTypes.bool,
|
770
|
+
renderOptimization: PropTypes.bool,
|
771
|
+
disableMoveOverflow: PropTypes.bool,
|
772
|
+
disableMoveDownOverflow: PropTypes.bool,
|
773
|
+
compact: PropTypes.bool,
|
774
|
+
disableScrollToActive: PropTypes.bool,
|
775
|
+
hidden: PropTypes.bool,
|
776
|
+
ariaLabel: PropTypes.string
|
777
|
+
});
|
778
|
+
_defineProperty(List, "defaultProps", {
|
779
|
+
data: [],
|
780
|
+
restoreActiveIndex: false,
|
781
|
+
// restore active item using its "key" property
|
782
|
+
activateSingleItem: false,
|
783
|
+
// if there is only one item, activate it
|
784
|
+
activateFirstItem: false,
|
785
|
+
// if there no active items, activate the first one
|
786
|
+
onMouseOut: noop,
|
787
|
+
onSelect: noop,
|
788
|
+
onScrollToBottom: noop,
|
789
|
+
onResize: noop,
|
790
|
+
shortcuts: false,
|
791
|
+
renderOptimization: true,
|
792
|
+
disableMoveDownOverflow: false,
|
793
|
+
ariaLabel: 'List'
|
794
|
+
});
|
795
|
+
_defineProperty(List, "isItemType", isItemType);
|
796
|
+
_defineProperty(List, "ListHint", ListHint);
|
797
|
+
_defineProperty(List, "ListProps", {
|
798
|
+
Type,
|
799
|
+
Dimension
|
800
|
+
});
|
801
|
+
|
802
|
+
export { ActiveItemContext, List as default };
|