@jetbrains/ring-ui 4.1.0-beta.9 → 4.1.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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/container.css +1 -1
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +1 -1
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.js +1 -0
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +31 -6
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +1 -1
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +5 -2
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +2 -2
- package/components/dialog-ng/dialog-ng.js +7 -8
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/island/island.css +4 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -5
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -1
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +4 -8
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +27 -0
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -1
- package/components/user-agreement/user-agreement.examples.js +7 -4
- package/components/user-agreement/user-agreement.js +1 -0
- package/package.json +75 -78
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -127
- package/dist/_helpers/anchor.js +0 -33
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button__classes.js +0 -39
- package/dist/_helpers/caption.js +0 -25
- package/dist/_helpers/card.js +0 -77
- package/dist/_helpers/date-picker.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -56
- package/dist/_helpers/grid.js +0 -3
- package/dist/_helpers/header.js +0 -3
- package/dist/_helpers/icon__svg.js +0 -83
- package/dist/_helpers/inject-styles.js +0 -22
- package/dist/_helpers/island.js +0 -3
- package/dist/_helpers/list.js +0 -3
- package/dist/_helpers/query-assist__suggestions.js +0 -95
- package/dist/_helpers/select__filter.js +0 -78
- package/dist/_helpers/services-link.js +0 -42
- package/dist/_helpers/sidebar.js +0 -127
- package/dist/_helpers/table.js +0 -3
- package/dist/_helpers/tabs.js +0 -3
- package/dist/_helpers/title.js +0 -99
- package/dist/alert/alert.js +0 -254
- package/dist/alert/container.js +0 -50
- package/dist/alert-service/alert-service.js +0 -159
- package/dist/analytics/analytics.js +0 -116
- package/dist/analytics/analytics__custom-plugin.js +0 -127
- package/dist/analytics/analytics__fus-plugin.js +0 -101
- package/dist/analytics/analytics__ga-plugin.js +0 -66
- package/dist/analytics/analytics__plugin-utils.js +0 -79
- package/dist/auth/auth.js +0 -90
- package/dist/auth/auth__core.js +0 -987
- package/dist/auth/background-flow.js +0 -123
- package/dist/auth/down-notification.js +0 -111
- package/dist/auth/iframe-flow.js +0 -147
- package/dist/auth/landing-entry.js +0 -5
- package/dist/auth/landing.js +0 -84
- package/dist/auth/request-builder.js +0 -75
- package/dist/auth/response-parser.js +0 -117
- package/dist/auth/storage.js +0 -279
- package/dist/auth/token-validator.js +0 -176
- package/dist/auth/window-flow.js +0 -133
- package/dist/auth-dialog/auth-dialog.js +0 -132
- package/dist/auth-dialog-service/auth-dialog-service.js +0 -67
- package/dist/avatar/avatar-example-datauri.js +0 -26
- package/dist/avatar/avatar.js +0 -155
- package/dist/badge/badge.js +0 -52
- package/dist/button/button.js +0 -117
- package/dist/button/button__classes.js +0 -5
- package/dist/button-group/button-group.js +0 -30
- package/dist/button-group/caption.js +0 -5
- package/dist/button-set/button-set.js +0 -27
- package/dist/button-toolbar/button-toolbar.js +0 -30
- package/dist/caret/caret.js +0 -264
- package/dist/checkbox/checkbox.js +0 -110
- package/dist/confirm/confirm.js +0 -122
- package/dist/confirm-service/confirm-service.js +0 -112
- package/dist/content-layout/content-layout.js +0 -67
- package/dist/content-layout/sidebar.js +0 -6
- package/dist/contenteditable/contenteditable.js +0 -81
- package/dist/data-list/data-list.js +0 -203
- package/dist/data-list/data-list.mock.js +0 -190
- package/dist/data-list/item.js +0 -225
- package/dist/data-list/selection.js +0 -101
- package/dist/data-list/title.js +0 -16
- package/dist/date-picker/consts.js +0 -70
- package/dist/date-picker/date-input.js +0 -169
- package/dist/date-picker/date-picker.js +0 -356
- package/dist/date-picker/date-popup.js +0 -459
- package/dist/date-picker/day.js +0 -119
- package/dist/date-picker/formats.js +0 -3
- package/dist/date-picker/month-names.js +0 -92
- package/dist/date-picker/month-slider.js +0 -83
- package/dist/date-picker/month.js +0 -48
- package/dist/date-picker/months.js +0 -121
- package/dist/date-picker/weekdays.js +0 -24
- package/dist/date-picker/years.js +0 -109
- package/dist/dialog/dialog.js +0 -197
- package/dist/dialog/dialog__body-scroll-preventer.js +0 -2
- package/dist/dropdown/anchor.js +0 -16
- package/dist/dropdown/dropdown.js +0 -236
- package/dist/error-bubble/error-bubble.js +0 -59
- package/dist/error-message/error-message.js +0 -55
- package/dist/footer/footer.js +0 -127
- package/dist/global/angular-component-factory.js +0 -83
- package/dist/global/compose.js +0 -9
- package/dist/global/composeRefs.js +0 -15
- package/dist/global/conic-gradient.js +0 -37
- package/dist/global/create-stateful-context.js +0 -54
- package/dist/global/data-tests.js +0 -22
- package/dist/global/dom.js +0 -124
- package/dist/global/focus-sensor-hoc.js +0 -147
- package/dist/global/fuzzy-highlight.js +0 -67
- package/dist/global/get-event-key.js +0 -111
- package/dist/global/get-uid.js +0 -15
- package/dist/global/inject-styles.js +0 -17
- package/dist/global/linear-function.js +0 -18
- package/dist/global/listeners.js +0 -42
- package/dist/global/memoize.js +0 -18
- package/dist/global/normalize-indent.js +0 -28
- package/dist/global/promise-with-timeout.js +0 -13
- package/dist/global/radial-gradient-mask.js +0 -49
- package/dist/global/react-dom-renderer.js +0 -45
- package/dist/global/rerender-hoc.js +0 -53
- package/dist/global/ring-angular-component.js +0 -24
- package/dist/global/schedule-raf.js +0 -31
- package/dist/global/sniffer.js +0 -6
- package/dist/global/supports-css.js +0 -20
- package/dist/global/theme.js +0 -56
- package/dist/global/trivial-template-tag.js +0 -15
- package/dist/global/url.js +0 -163
- package/dist/global/variables_dark.js +0 -57
- package/dist/grid/col.js +0 -62
- package/dist/grid/grid.js +0 -35
- package/dist/grid/row.js +0 -66
- package/dist/group/group.js +0 -34
- package/dist/header/header.js +0 -144
- package/dist/header/logo.js +0 -39
- package/dist/header/profile.js +0 -212
- package/dist/header/services-link.js +0 -10
- package/dist/header/services.js +0 -135
- package/dist/header/smart-profile.js +0 -227
- package/dist/header/smart-services.js +0 -159
- package/dist/header/tray-icon.js +0 -45
- package/dist/header/tray.js +0 -33
- package/dist/heading/heading.js +0 -76
- package/dist/http/http.js +0 -216
- package/dist/http/http.mock.js +0 -65
- package/dist/hub-source/hub-source.js +0 -130
- package/dist/hub-source/hub-source__user.js +0 -28
- package/dist/hub-source/hub-source__users-groups.js +0 -62
- package/dist/icon/icon.js +0 -105
- package/dist/icon/icon__constants.js +0 -33
- package/dist/icon/icon__svg.js +0 -6
- package/dist/icon/index.js +0 -9
- package/dist/input/input.js +0 -231
- package/dist/island/adaptive-island-hoc.js +0 -48
- package/dist/island/content.js +0 -158
- package/dist/island/header.js +0 -85
- package/dist/island/island.js +0 -53
- package/dist/island-legacy/content-legacy.js +0 -28
- package/dist/island-legacy/header-legacy.js +0 -30
- package/dist/island-legacy/island-legacy.js +0 -30
- package/dist/link/clickableLink.js +0 -65
- package/dist/link/link.js +0 -118
- package/dist/list/consts.js +0 -26
- package/dist/list/list.js +0 -800
- package/dist/list/list__custom.js +0 -82
- package/dist/list/list__hint.js +0 -26
- package/dist/list/list__item.js +0 -197
- package/dist/list/list__link.js +0 -65
- package/dist/list/list__separator.js +0 -30
- package/dist/list/list__title.js +0 -39
- package/dist/list/list__users-groups-source.js +0 -124
- package/dist/loader/loader.js +0 -72
- package/dist/loader/loader__core.js +0 -272
- package/dist/loader-inline/inject-styles.js +0 -11
- package/dist/loader-inline/loader-inline.js +0 -58
- package/dist/loader-screen/loader-screen.js +0 -46
- package/dist/login-dialog/login-dialog.js +0 -184
- package/dist/login-dialog/service.js +0 -67
- package/dist/message/message.js +0 -232
- package/dist/old-browsers-message/old-browsers-message.js +0 -101
- package/dist/old-browsers-message/old-browsers-message__stop.js +0 -5
- package/dist/old-browsers-message/white-list.js +0 -34
- package/dist/pager/pager.js +0 -352
- package/dist/panel/panel.js +0 -34
- package/dist/permissions/permissions.js +0 -200
- package/dist/permissions/permissions__cache.js +0 -272
- package/dist/popup/popup.consts.js +0 -41
- package/dist/popup/popup.js +0 -389
- package/dist/popup/popup.target.js +0 -27
- package/dist/popup/position.js +0 -280
- package/dist/popup-menu/popup-menu.js +0 -108
- package/dist/progress-bar/progress-bar.js +0 -111
- package/dist/proxy-attrs/proxy-attrs.js +0 -19
- package/dist/query-assist/query-assist.js +0 -1023
- package/dist/query-assist/query-assist__suggestions.js +0 -43
- package/dist/radio/radio.js +0 -39
- package/dist/radio/radio__item.js +0 -82
- package/dist/select/select.js +0 -1335
- package/dist/select/select__filter.js +0 -49
- package/dist/select/select__popup.js +0 -541
- package/dist/shortcuts/core.js +0 -245
- package/dist/shortcuts/shortcut-title.js +0 -51
- package/dist/shortcuts/shortcuts-hoc.js +0 -43
- package/dist/shortcuts/shortcuts.js +0 -72
- package/dist/storage/storage.js +0 -55
- package/dist/storage/storage__fallback.js +0 -214
- package/dist/storage/storage__local.js +0 -150
- package/dist/style.css +0 -1
- package/dist/tab-trap/tab-trap.js +0 -178
- package/dist/table/cell.js +0 -25
- package/dist/table/disable-hover-hoc.js +0 -53
- package/dist/table/header-cell.js +0 -91
- package/dist/table/header.js +0 -189
- package/dist/table/multitable.js +0 -140
- package/dist/table/row-with-focus-sensor.js +0 -79
- package/dist/table/row.js +0 -270
- package/dist/table/selection-adapter.js +0 -14
- package/dist/table/selection-shortcuts-hoc.js +0 -212
- package/dist/table/selection.js +0 -221
- package/dist/table/smart-table.js +0 -113
- package/dist/table/table.js +0 -405
- package/dist/tabs/collapsible-more.js +0 -193
- package/dist/tabs/collapsible-tab.js +0 -90
- package/dist/tabs/collapsible-tabs.js +0 -361
- package/dist/tabs/custom-item.js +0 -13
- package/dist/tabs/dumb-tabs.js +0 -159
- package/dist/tabs/smart-tabs.js +0 -102
- package/dist/tabs/tab-link.js +0 -35
- package/dist/tabs/tab.js +0 -32
- package/dist/tabs/tabs.js +0 -65
- package/dist/tag/tag.js +0 -190
- package/dist/tags-input/tags-input.js +0 -474
- package/dist/tags-list/tags-list.js +0 -94
- package/dist/text/text.js +0 -38
- package/dist/toggle/toggle.js +0 -80
- package/dist/tooltip/tooltip.js +0 -205
- package/dist/user-card/card.js +0 -14
- package/dist/user-card/smart-user-card-tooltip.js +0 -112
- package/dist/user-card/tooltip.js +0 -91
- package/dist/user-card/user-card.js +0 -46
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Converts an array of cached permissions to a a map of a permission key
|
|
5
|
-
* to the respective cached permission.
|
|
6
|
-
*
|
|
7
|
-
* @param { {
|
|
8
|
-
* permission: {key: string},
|
|
9
|
-
* global: boolean?,
|
|
10
|
-
* projects: {id: string}[]?
|
|
11
|
-
* }[] } permissions
|
|
12
|
-
* @param {function} namesConverter a function, which maps a server-side permission name to client-side permission name
|
|
13
|
-
* @return {object} permission cache
|
|
14
|
-
* @private
|
|
15
|
-
*/
|
|
16
|
-
class PermissionCache {
|
|
17
|
-
/**
|
|
18
|
-
* Convert an array of projects to a set of project ids.
|
|
19
|
-
*
|
|
20
|
-
* @param {object[]=} projects
|
|
21
|
-
* @return {object} a set of project ids
|
|
22
|
-
* @private
|
|
23
|
-
*/
|
|
24
|
-
static _toProjectIdSet(projects) {
|
|
25
|
-
let projectIdSet = null;
|
|
26
|
-
|
|
27
|
-
if (projects) {
|
|
28
|
-
projectIdSet = {};
|
|
29
|
-
|
|
30
|
-
for (let i = 0; i < projects.length; i++) {
|
|
31
|
-
projectIdSet[projects[i].id] = true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return projectIdSet;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
constructor(permissions, namesConverter) {
|
|
39
|
-
this.namesConverter = namesConverter || (key => key);
|
|
40
|
-
|
|
41
|
-
this.set(permissions);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
set(permissions) {
|
|
45
|
-
const permissionCache = (permissions || []).reduce((_permissionCache, permission) => {
|
|
46
|
-
const key = this.namesConverter(permission.permission.key);
|
|
47
|
-
|
|
48
|
-
if (key) {
|
|
49
|
-
_permissionCache[key] = {
|
|
50
|
-
global: permission.global,
|
|
51
|
-
projectIdSet: this.constructor._toProjectIdSet(permission.projects)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return _permissionCache;
|
|
56
|
-
}, {});
|
|
57
|
-
this._permissions = permissions;
|
|
58
|
-
this.permissionCache = permissionCache;
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get() {
|
|
63
|
-
return this._permissions;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Checks if the current user has the given permissions in the project with the given id.
|
|
67
|
-
*
|
|
68
|
-
* @param {string} permissions space separated list of permissions
|
|
69
|
-
* @param {string=} projectId optional projectId. If absent the method checks
|
|
70
|
-
* if the given permission is granted in any project.
|
|
71
|
-
*
|
|
72
|
-
* @return {boolean}
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
has(permissions, projectId) {
|
|
77
|
-
const lexems = this.lex(permissions);
|
|
78
|
-
|
|
79
|
-
if (lexems.length === 0) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
return this.or(lexems, projectId);
|
|
85
|
-
} catch (e) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Lexes permission query string to an array of lexems.
|
|
91
|
-
*
|
|
92
|
-
* @param {string} query
|
|
93
|
-
* @return {string[]}
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
lex(query) {
|
|
98
|
-
const lexems = [];
|
|
99
|
-
|
|
100
|
-
if (query) {
|
|
101
|
-
let currentIdentifier = '';
|
|
102
|
-
|
|
103
|
-
for (let i = 0; i < query.length; i++) {
|
|
104
|
-
switch (query.charAt(i)) {
|
|
105
|
-
case ' ':
|
|
106
|
-
case '\t':
|
|
107
|
-
case '\n':
|
|
108
|
-
case '\r':
|
|
109
|
-
// Finish current token
|
|
110
|
-
if (currentIdentifier) {
|
|
111
|
-
lexems.push(currentIdentifier);
|
|
112
|
-
currentIdentifier = '';
|
|
113
|
-
} // Skip space
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
break;
|
|
117
|
-
|
|
118
|
-
case '(':
|
|
119
|
-
case ')':
|
|
120
|
-
case '&':
|
|
121
|
-
case '|':
|
|
122
|
-
case '!':
|
|
123
|
-
// Finish current token
|
|
124
|
-
if (currentIdentifier) {
|
|
125
|
-
lexems.push(currentIdentifier);
|
|
126
|
-
currentIdentifier = '';
|
|
127
|
-
} // Append operator
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
lexems.push(query.charAt(i));
|
|
131
|
-
break;
|
|
132
|
-
|
|
133
|
-
default:
|
|
134
|
-
currentIdentifier += query.charAt(i);
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (currentIdentifier) {
|
|
140
|
-
lexems.push(currentIdentifier);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return lexems;
|
|
145
|
-
}
|
|
146
|
-
/*
|
|
147
|
-
or -> and ( '|' and )*
|
|
148
|
-
and -> not ( '&'? not )*
|
|
149
|
-
not -> '!'* term
|
|
150
|
-
term -> '(' or ')' | permission
|
|
151
|
-
permission -> [^()&|!\s]+
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @param {string[]} lexems
|
|
156
|
-
* @param {string=} projectId
|
|
157
|
-
* @return {boolean}
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
or(lexems, projectId) {
|
|
162
|
-
let result = this.and(lexems, projectId);
|
|
163
|
-
|
|
164
|
-
while (lexems.length > 0 && lexems[0] !== ')') {
|
|
165
|
-
if (lexems.shift() !== '|') {
|
|
166
|
-
throw new Error('Operator \'|\' was expected');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
result = this.and(lexems, projectId) || result;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return result;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @param {string[]} lexems
|
|
176
|
-
* @param {string=} projectId
|
|
177
|
-
* @return {boolean}
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
and(lexems, projectId) {
|
|
182
|
-
let result = this.not(lexems, projectId);
|
|
183
|
-
|
|
184
|
-
while (lexems.length > 0 && lexems[0] !== ')' && lexems[0] !== '|') {
|
|
185
|
-
// Expect optional '&'
|
|
186
|
-
if (lexems[0] === '&') {
|
|
187
|
-
lexems.shift();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
result = this.not(lexems, projectId) && result;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return result;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @param {string[]} lexems
|
|
197
|
-
* @param {string=} projectId
|
|
198
|
-
* @return {boolean}
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
not(lexems, projectId) {
|
|
203
|
-
let notCounter = 0;
|
|
204
|
-
|
|
205
|
-
while (lexems.length > 0 && lexems[0] === '!') {
|
|
206
|
-
++notCounter;
|
|
207
|
-
lexems.shift();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const result = this.term(lexems, projectId);
|
|
211
|
-
return notCounter % 2 === 0 ? result : !result;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* @param {string[]} lexems
|
|
215
|
-
* @param {string=} projectId
|
|
216
|
-
* @return {boolean}
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
term(lexems, projectId) {
|
|
221
|
-
if (lexems.length === 0) {
|
|
222
|
-
throw new Error('Operand was expected');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const t = lexems.shift();
|
|
226
|
-
let result; // Nested parenthesized expression
|
|
227
|
-
|
|
228
|
-
if (t === '(') {
|
|
229
|
-
result = this.or(lexems, projectId); // Expect ')'
|
|
230
|
-
|
|
231
|
-
if (lexems.shift() !== ')') {
|
|
232
|
-
throw new Error('Operator \')\' was expected');
|
|
233
|
-
}
|
|
234
|
-
} else {
|
|
235
|
-
result = this.testPermission(t, projectId);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return result;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* @param {string} permissionName
|
|
242
|
-
* @param {string=} projectId
|
|
243
|
-
* @return {boolean}
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
testPermission(permissionName, projectId) {
|
|
248
|
-
const permissionCache = this.permissionCache;
|
|
249
|
-
const cachedPermission = permissionCache[permissionName] || permissionCache[this.namesConverter(permissionName)]; // Hasn't the permission in any project
|
|
250
|
-
|
|
251
|
-
if (!cachedPermission) {
|
|
252
|
-
return false;
|
|
253
|
-
} // The permission is global or is given in the global project
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (cachedPermission.global) {
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (projectId) {
|
|
261
|
-
// if projectId is specified check that the permission is given in the project
|
|
262
|
-
return cachedPermission.projectIdSet && projectId in cachedPermission.projectIdSet;
|
|
263
|
-
} else {
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
_defineProperty(PermissionCache, "GLOBAL_PROJECT_ID", 'global');
|
|
271
|
-
|
|
272
|
-
export default PermissionCache;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const Directions = {
|
|
2
|
-
BOTTOM_RIGHT: 'BOTTOM_RIGHT',
|
|
3
|
-
BOTTOM_LEFT: 'BOTTOM_LEFT',
|
|
4
|
-
BOTTOM_CENTER: 'BOTTOM_CENTER',
|
|
5
|
-
TOP_LEFT: 'TOP_LEFT',
|
|
6
|
-
TOP_RIGHT: 'TOP_RIGHT',
|
|
7
|
-
TOP_CENTER: 'TOP_CENTER',
|
|
8
|
-
RIGHT_TOP: 'RIGHT_TOP',
|
|
9
|
-
RIGHT_BOTTOM: 'RIGHT_BOTTOM',
|
|
10
|
-
RIGHT_CENTER: 'RIGHT_CENTER',
|
|
11
|
-
LEFT_TOP: 'LEFT_TOP',
|
|
12
|
-
LEFT_BOTTOM: 'LEFT_BOTTOM',
|
|
13
|
-
LEFT_CENTER: 'LEFT_CENTER'
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* When positioning a popup, directions will be tried in the listed order.
|
|
17
|
-
* @type {Array.<string>}
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const DEFAULT_DIRECTIONS = [Directions.BOTTOM_RIGHT, Directions.BOTTOM_LEFT, Directions.TOP_LEFT, Directions.TOP_RIGHT, Directions.RIGHT_TOP, Directions.RIGHT_BOTTOM, Directions.LEFT_TOP, Directions.LEFT_BOTTOM];
|
|
21
|
-
/**
|
|
22
|
-
* @enum {number}
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const Dimension = {
|
|
26
|
-
MARGIN: 16,
|
|
27
|
-
BORDER_WIDTH: 1
|
|
28
|
-
};
|
|
29
|
-
const MinWidth = {
|
|
30
|
-
TARGET: -1
|
|
31
|
-
};
|
|
32
|
-
const MaxHeight = {
|
|
33
|
-
SCREEN: -1
|
|
34
|
-
};
|
|
35
|
-
const Display = {
|
|
36
|
-
HIDDEN: 0,
|
|
37
|
-
SHOWING: 1,
|
|
38
|
-
SHOWN: 2
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export { DEFAULT_DIRECTIONS, Dimension, Directions, Display, MaxHeight, MinWidth };
|
package/dist/popup/popup.js
DELETED
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import { _ as _defineProperty, c as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import getUID from '../global/get-uid.js';
|
|
7
|
-
import scheduleRAF from '../global/schedule-raf.js';
|
|
8
|
-
import { Listeners, getStyles } from '../global/dom.js';
|
|
9
|
-
import Shortcuts from '../shortcuts/shortcuts.js';
|
|
10
|
-
import joinDataTestAttributes from '../global/data-tests.js';
|
|
11
|
-
import TabTrap from '../tab-trap/tab-trap.js';
|
|
12
|
-
import position, { positionPropKeys } from './position.js';
|
|
13
|
-
import { Display, DEFAULT_DIRECTIONS, Directions, Dimension, MinWidth, MaxHeight } from './popup.consts.js';
|
|
14
|
-
import { PopupTargetContext, PopupTarget } from './popup.target.js';
|
|
15
|
-
export { PopupTarget, PopupTargetContext } from './popup.target.js';
|
|
16
|
-
import '../shortcuts/core.js';
|
|
17
|
-
import 'combokeys';
|
|
18
|
-
import '../global/sniffer.js';
|
|
19
|
-
import 'sniffr';
|
|
20
|
-
|
|
21
|
-
var modules_2f69e2e2 = {"popup":"popup_popup__d157c5ca global_font__0f8f4370","hidden":"popup_hidden__d157c5ca","showing":"popup_showing__d157c5ca","attached":"popup_attached__d157c5ca"};
|
|
22
|
-
|
|
23
|
-
const stop = e => e.stopPropagation();
|
|
24
|
-
|
|
25
|
-
const getPopupContainer = target => typeof target === 'string' ? document.querySelector(`[data-portaltarget=${target}]`) : target;
|
|
26
|
-
/**
|
|
27
|
-
* @constructor
|
|
28
|
-
* @name Popup
|
|
29
|
-
* @extends {ReactComponent}
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
class Popup extends PureComponent {
|
|
33
|
-
constructor() {
|
|
34
|
-
super(...arguments);
|
|
35
|
-
|
|
36
|
-
_defineProperty(this, "state", {
|
|
37
|
-
display: Display.SHOWING
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
_defineProperty(this, "listeners", new Listeners());
|
|
41
|
-
|
|
42
|
-
_defineProperty(this, "redrawScheduler", scheduleRAF(true));
|
|
43
|
-
|
|
44
|
-
_defineProperty(this, "uid", getUID('popup-'));
|
|
45
|
-
|
|
46
|
-
_defineProperty(this, "calculateDisplay", prevState => _objectSpread2(_objectSpread2({}, prevState), {}, {
|
|
47
|
-
display: this.props.hidden ? Display.SHOWING : Display.SHOWN
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
_defineProperty(this, "portalRef", el => {
|
|
51
|
-
this.node = el;
|
|
52
|
-
this.parent = el && el.parentElement;
|
|
53
|
-
|
|
54
|
-
if (el && this.getContainer()) {
|
|
55
|
-
this._redraw();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
_defineProperty(this, "popupRef", el => {
|
|
60
|
-
this.popup = el;
|
|
61
|
-
|
|
62
|
-
this._redraw();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
_defineProperty(this, "containerRef", el => {
|
|
66
|
-
this.container = el;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
_defineProperty(this, "_updateDirection", newDirection => {
|
|
70
|
-
if (this.state.direction !== newDirection) {
|
|
71
|
-
this.setState({
|
|
72
|
-
direction: newDirection
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
if (this.props.onDirectionChange) {
|
|
76
|
-
this.props.onDirectionChange(newDirection);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
_defineProperty(this, "_updatePosition", () => {
|
|
82
|
-
if (this.popup) {
|
|
83
|
-
this.popup.style.position = 'absolute';
|
|
84
|
-
|
|
85
|
-
if (this.isVisible()) {
|
|
86
|
-
const {
|
|
87
|
-
styles: style,
|
|
88
|
-
direction
|
|
89
|
-
} = this.position();
|
|
90
|
-
Object.keys(style).forEach(key => {
|
|
91
|
-
const value = style[key];
|
|
92
|
-
|
|
93
|
-
if (typeof value === 'number') {
|
|
94
|
-
this.popup.style[key] = `${value}px`;
|
|
95
|
-
} else {
|
|
96
|
-
this.popup.style[key] = value.toString();
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
this._updateDirection(direction);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
this.setState(this.calculateDisplay);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
_defineProperty(this, "_redraw", () => {
|
|
108
|
-
if (this.isVisible()) {
|
|
109
|
-
this.redrawScheduler(this._updatePosition);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
_defineProperty(this, "_onEscPress", evt => {
|
|
114
|
-
this.props.onEscPress(evt);
|
|
115
|
-
|
|
116
|
-
this._onCloseAttempt(evt, true);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
_defineProperty(this, "_onDocumentClick", evt => {
|
|
120
|
-
if (this.container && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && this._getAnchor() && this._getAnchor().contains(evt.target)) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
this.props.onOutsideClick(evt);
|
|
125
|
-
|
|
126
|
-
this._onCloseAttempt(evt, false);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
_defineProperty(this, "shortcutsScope", this.uid);
|
|
130
|
-
|
|
131
|
-
_defineProperty(this, "shortcutsMap", {
|
|
132
|
-
esc: this._onEscPress
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
componentDidMount() {
|
|
137
|
-
if (!this.props.client) {
|
|
138
|
-
// eslint-disable-next-line react/no-did-mount-set-state
|
|
139
|
-
this.setState({
|
|
140
|
-
client: true
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (!this.props.hidden) {
|
|
145
|
-
this._setListenersEnabled(true);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
componentDidUpdate(prevProps, prevState) {
|
|
150
|
-
const {
|
|
151
|
-
hidden
|
|
152
|
-
} = this.props;
|
|
153
|
-
|
|
154
|
-
if (this.props !== prevProps) {
|
|
155
|
-
if (prevProps.hidden !== hidden) {
|
|
156
|
-
this._setListenersEnabled(!hidden);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
this._redraw();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
|
|
163
|
-
this.props.onShow();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
componentWillUnmount() {
|
|
168
|
-
this._setListenersEnabled(false);
|
|
169
|
-
|
|
170
|
-
this.popup = null;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
shouldUseShortcuts() {
|
|
174
|
-
const {
|
|
175
|
-
shortcuts,
|
|
176
|
-
hidden
|
|
177
|
-
} = this.props;
|
|
178
|
-
return shortcuts && !hidden;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
getContainer() {
|
|
182
|
-
const target = this.props.target || this.ringPopupTarget;
|
|
183
|
-
return target && getPopupContainer(target);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
position() {
|
|
187
|
-
const positionProps = positionPropKeys.reduce((acc, key) => {
|
|
188
|
-
acc[key] = this.props[key];
|
|
189
|
-
return acc;
|
|
190
|
-
}, {});
|
|
191
|
-
const container = this.getContainer();
|
|
192
|
-
return position(_objectSpread2({
|
|
193
|
-
popup: this.popup,
|
|
194
|
-
container: container && getStyles(container).position !== 'static' ? container : null,
|
|
195
|
-
anchor: this._getAnchor()
|
|
196
|
-
}, positionProps));
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
_getAnchor() {
|
|
200
|
-
return this.props.anchorElement || this.parent;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* @param {boolean} enable
|
|
204
|
-
* @private
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
_setListenersEnabled(enable) {
|
|
209
|
-
if (enable && !this._listenersEnabled) {
|
|
210
|
-
setTimeout(() => {
|
|
211
|
-
this._listenersEnabled = true;
|
|
212
|
-
this.listeners.add(window, 'resize', this._redraw);
|
|
213
|
-
this.listeners.add(window, 'scroll', this._redraw);
|
|
214
|
-
this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
|
|
215
|
-
|
|
216
|
-
let el = this._getAnchor();
|
|
217
|
-
|
|
218
|
-
while (el) {
|
|
219
|
-
this.listeners.add(el, 'scroll', this._redraw);
|
|
220
|
-
el = el.parentElement;
|
|
221
|
-
}
|
|
222
|
-
}, 0);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (!enable && this._listenersEnabled) {
|
|
227
|
-
this.listeners.removeAll();
|
|
228
|
-
this._listenersEnabled = false;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Returns visibility state
|
|
233
|
-
* @return {boolean}
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
isVisible() {
|
|
238
|
-
return !this.props.hidden;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
_onCloseAttempt(evt, isEsc) {
|
|
242
|
-
this.props.onCloseAttempt(evt, isEsc);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
getInternalContent() {
|
|
246
|
-
const {
|
|
247
|
-
trapFocus,
|
|
248
|
-
autoFocusFirst,
|
|
249
|
-
children
|
|
250
|
-
} = this.props;
|
|
251
|
-
return trapFocus ? /*#__PURE__*/React.createElement(TabTrap, {
|
|
252
|
-
autoFocusFirst: autoFocusFirst,
|
|
253
|
-
focusBackOnExit: true
|
|
254
|
-
}, children) : children;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
render() {
|
|
258
|
-
const {
|
|
259
|
-
className,
|
|
260
|
-
style,
|
|
261
|
-
hidden,
|
|
262
|
-
attached,
|
|
263
|
-
keepMounted,
|
|
264
|
-
client,
|
|
265
|
-
onMouseDown,
|
|
266
|
-
onMouseUp,
|
|
267
|
-
onMouseOver,
|
|
268
|
-
onMouseOut,
|
|
269
|
-
onContextMenu,
|
|
270
|
-
'data-test': dataTest
|
|
271
|
-
} = this.props;
|
|
272
|
-
const showing = this.state.display === Display.SHOWING;
|
|
273
|
-
const classes = classNames(className, modules_2f69e2e2.popup, {
|
|
274
|
-
[modules_2f69e2e2.attached]: attached,
|
|
275
|
-
[modules_2f69e2e2.hidden]: hidden,
|
|
276
|
-
[modules_2f69e2e2.showing]: showing
|
|
277
|
-
});
|
|
278
|
-
const direction = (this.state.direction || '').toLowerCase().replace(/[_]/g, '-');
|
|
279
|
-
return /*#__PURE__*/React.createElement(PopupTargetContext.Consumer, null, value => {
|
|
280
|
-
this.ringPopupTarget = value;
|
|
281
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
282
|
-
// prevent bubbling through portal
|
|
283
|
-
onClick: stop // This handler only blocks bubbling through React portal
|
|
284
|
-
,
|
|
285
|
-
role: "presentation",
|
|
286
|
-
ref: this.portalRef
|
|
287
|
-
}, this.shouldUseShortcuts() && /*#__PURE__*/React.createElement(Shortcuts, {
|
|
288
|
-
map: this.shortcutsMap,
|
|
289
|
-
scope: this.shortcutsScope
|
|
290
|
-
}), (client || this.state.client) && (keepMounted || !hidden) && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PopupTarget, {
|
|
291
|
-
id: this.uid,
|
|
292
|
-
ref: this.containerRef,
|
|
293
|
-
onMouseOver: onMouseOver,
|
|
294
|
-
onFocus: onMouseOver,
|
|
295
|
-
onMouseOut: onMouseOut,
|
|
296
|
-
onBlur: onMouseOut,
|
|
297
|
-
onContextMenu: onContextMenu
|
|
298
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
299
|
-
"data-test": joinDataTestAttributes('ring-popup', dataTest),
|
|
300
|
-
"data-test-shown": !hidden && !showing,
|
|
301
|
-
"data-test-direction": direction,
|
|
302
|
-
ref: this.popupRef,
|
|
303
|
-
className: classes,
|
|
304
|
-
style: style,
|
|
305
|
-
onMouseDown: onMouseDown,
|
|
306
|
-
onMouseUp: onMouseUp // mouse handlers are used to track clicking on inner elements
|
|
307
|
-
,
|
|
308
|
-
role: "presentation"
|
|
309
|
-
}, this.getInternalContent())), this.getContainer() || document.body));
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
_defineProperty(Popup, "propTypes", {
|
|
316
|
-
anchorElement: PropTypes.instanceOf(Node),
|
|
317
|
-
target: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Element)]),
|
|
318
|
-
className: PropTypes.string,
|
|
319
|
-
style: PropTypes.object,
|
|
320
|
-
hidden: PropTypes.bool.isRequired,
|
|
321
|
-
onOutsideClick: PropTypes.func,
|
|
322
|
-
onEscPress: PropTypes.func,
|
|
323
|
-
// onCloseAttempt is a common callback for ESC pressing and outside clicking.
|
|
324
|
-
// Use it if you don't need different behaviors for this cases.
|
|
325
|
-
onCloseAttempt: PropTypes.func,
|
|
326
|
-
children: PropTypes.node.isRequired,
|
|
327
|
-
dontCloseOnAnchorClick: PropTypes.bool,
|
|
328
|
-
shortcuts: PropTypes.bool,
|
|
329
|
-
keepMounted: PropTypes.bool,
|
|
330
|
-
// pass this prop to preserve the popup's DOM state while hidden
|
|
331
|
-
'data-test': PropTypes.string,
|
|
332
|
-
client: PropTypes.bool,
|
|
333
|
-
// true means that it's never used in SSR
|
|
334
|
-
directions: PropTypes.arrayOf(PropTypes.string),
|
|
335
|
-
autoPositioning: PropTypes.bool,
|
|
336
|
-
autoCorrectTopOverflow: PropTypes.bool,
|
|
337
|
-
left: PropTypes.number,
|
|
338
|
-
top: PropTypes.number,
|
|
339
|
-
maxHeight: PropTypes.number,
|
|
340
|
-
minWidth: PropTypes.number,
|
|
341
|
-
sidePadding: PropTypes.number,
|
|
342
|
-
attached: PropTypes.bool,
|
|
343
|
-
// Popup adjacent to an input, without upper border and shadow
|
|
344
|
-
onMouseDown: PropTypes.func,
|
|
345
|
-
onMouseUp: PropTypes.func,
|
|
346
|
-
onMouseOver: PropTypes.func,
|
|
347
|
-
onMouseOut: PropTypes.func,
|
|
348
|
-
onContextMenu: PropTypes.func,
|
|
349
|
-
onDirectionChange: PropTypes.func,
|
|
350
|
-
onShow: PropTypes.func,
|
|
351
|
-
// set to true whenever popup contains focusable and scrollable content
|
|
352
|
-
trapFocus: PropTypes.bool,
|
|
353
|
-
autoFocusFirst: PropTypes.bool
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
_defineProperty(Popup, "defaultProps", {
|
|
357
|
-
shortcuts: true,
|
|
358
|
-
hidden: false,
|
|
359
|
-
|
|
360
|
-
onOutsideClick() {},
|
|
361
|
-
|
|
362
|
-
onEscPress() {},
|
|
363
|
-
|
|
364
|
-
onCloseAttempt() {},
|
|
365
|
-
|
|
366
|
-
dontCloseOnAnchorClick: false,
|
|
367
|
-
keepMounted: false,
|
|
368
|
-
directions: DEFAULT_DIRECTIONS,
|
|
369
|
-
autoPositioning: true,
|
|
370
|
-
autoCorrectTopOverflow: true,
|
|
371
|
-
left: 0,
|
|
372
|
-
top: 0,
|
|
373
|
-
offset: 0,
|
|
374
|
-
sidePadding: 8,
|
|
375
|
-
attached: false,
|
|
376
|
-
trapFocus: false,
|
|
377
|
-
autoFocusFirst: false,
|
|
378
|
-
legacy: false
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
_defineProperty(Popup, "PopupProps", {
|
|
382
|
-
Directions,
|
|
383
|
-
Dimension,
|
|
384
|
-
MinWidth,
|
|
385
|
-
MaxHeight
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
export default Popup;
|
|
389
|
-
export { getPopupContainer };
|