@jetbrains/ring-ui-built 6.0.32 → 6.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_helpers/_rollupPluginBabelHelpers.js +567 -1
- package/components/_helpers/anchor.js +6 -7
- package/components/_helpers/button__classes.js +14 -16
- package/components/_helpers/caption.js +20 -14
- package/components/_helpers/card.js +105 -95
- package/components/_helpers/dialog__body-scroll-preventer.js +19 -11
- package/components/_helpers/icon__svg.js +25 -22
- package/components/_helpers/input.js +176 -146
- package/components/_helpers/query-assist__suggestions.js +90 -74
- package/components/_helpers/select__filter.js +69 -48
- package/components/_helpers/services-link.js +37 -29
- package/components/_helpers/sidebar.js +107 -99
- package/components/_helpers/tab-link.js +7 -7
- package/components/_helpers/theme.js +40 -31
- package/components/_helpers/title.js +72 -57
- package/components/alert/alert.js +202 -150
- package/components/alert/container.js +41 -32
- package/components/alert-service/alert-service.js +170 -105
- package/components/analytics/analytics.js +22 -12
- package/components/analytics/analytics__custom-plugin.js +75 -54
- package/components/auth/auth.js +36 -4
- package/components/auth/auth__core.js +1471 -746
- package/components/auth/background-flow.js +127 -87
- package/components/auth/down-notification.js +73 -30
- package/components/auth/iframe-flow.js +133 -75
- package/components/auth/request-builder.js +82 -46
- package/components/auth/response-parser.js +116 -86
- package/components/auth/storage.js +334 -171
- package/components/auth/token-validator.js +242 -137
- package/components/auth/window-flow.js +134 -92
- package/components/auth-dialog/auth-dialog.js +172 -114
- package/components/auth-dialog-service/auth-dialog-service.js +31 -8
- package/components/avatar/avatar-example-datauri.js +1 -23
- package/components/avatar/avatar.js +152 -119
- package/components/avatar/fallback-avatar.js +38 -22
- package/components/badge/badge.js +45 -35
- package/components/button/button.js +107 -86
- package/components/button-group/button-group.js +33 -19
- package/components/button-set/button-set.js +32 -20
- package/components/button-toolbar/button-toolbar.js +31 -19
- package/components/caret/caret.js +220 -186
- package/components/checkbox/checkbox.js +101 -76
- package/components/clipboard/clipboard-fallback.js +10 -10
- package/components/clipboard/clipboard.js +132 -35
- package/components/code/code.js +166 -92
- package/components/collapse/collapse-content.js +64 -42
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +14 -12
- package/components/collapse/collapse.js +17 -11
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +3 -1
- package/components/confirm/confirm.js +104 -66
- package/components/confirm-service/confirm-service.js +59 -37
- package/components/content-layout/content-layout.js +64 -43
- package/components/content-layout/sidebar.js +1 -0
- package/components/contenteditable/contenteditable.js +59 -50
- package/components/control-label/control-label.js +9 -9
- package/components/data-list/data-list.js +182 -129
- package/components/data-list/data-list.mock.js +6 -2
- package/components/data-list/item.js +170 -143
- package/components/data-list/selection.js +136 -76
- package/components/data-list/title.js +12 -1
- package/components/date-picker/consts.js +26 -19
- package/components/date-picker/date-input.js +144 -113
- package/components/date-picker/date-picker.js +282 -227
- package/components/date-picker/date-popup.js +395 -350
- package/components/date-picker/day.js +116 -87
- package/components/date-picker/month-names.js +66 -43
- package/components/date-picker/month-slider.js +76 -51
- package/components/date-picker/month.js +25 -16
- package/components/date-picker/months.js +50 -43
- package/components/date-picker/weekdays.js +22 -12
- package/components/date-picker/years.js +110 -83
- package/components/dialog/dialog.js +190 -142
- package/components/dialog/dialog__body-scroll-preventer.js +4 -0
- package/components/dropdown/anchor.js +9 -0
- package/components/dropdown/dropdown.js +213 -182
- package/components/dropdown-menu/dropdown-menu.js +97 -71
- package/components/editable-heading/editable-heading.js +127 -75
- package/components/error-bubble/error-bubble.js +60 -31
- package/components/error-message/error-message.js +59 -39
- package/components/footer/footer.js +30 -27
- package/components/global/compose.js +10 -1
- package/components/global/composeRefs.js +12 -7
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.js +15 -15
- package/components/global/data-tests.js +14 -6
- package/components/global/dom.js +86 -47
- package/components/global/focus-sensor-hoc.js +132 -122
- package/components/global/fuzzy-highlight.js +36 -22
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +8 -4
- package/components/global/inject-styles.js +15 -10
- package/components/global/listeners.js +51 -27
- package/components/global/memoize.js +12 -6
- package/components/global/normalize-indent.js +50 -19
- package/components/global/promise-with-timeout.js +8 -6
- package/components/global/prop-types.js +5 -3
- package/components/global/react-dom-renderer.js +44 -28
- package/components/global/react-render-adapter.js +1 -1
- package/components/global/rerender-hoc.js +30 -12
- package/components/global/schedule-raf.js +6 -5
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.js +22 -0
- package/components/global/trivial-template-tag.js +10 -3
- package/components/global/typescript-utils.js +6 -2
- package/components/global/url.js +26 -20
- package/components/global/use-event-callback.js +4 -6
- package/components/grid/col.js +52 -35
- package/components/grid/grid.js +31 -17
- package/components/grid/row.js +47 -35
- package/components/group/group.js +25 -17
- package/components/header/header.js +78 -33
- package/components/header/logo.js +36 -20
- package/components/header/profile.js +199 -166
- package/components/header/services-link.js +4 -0
- package/components/header/services.js +116 -73
- package/components/header/smart-profile.js +203 -111
- package/components/header/smart-services.js +113 -62
- package/components/header/tray-icon.js +37 -21
- package/components/header/tray.js +32 -21
- package/components/heading/heading.js +25 -24
- package/components/http/http.d.ts +1 -2
- package/components/http/http.js +345 -203
- package/components/http/http.mock.d.ts +1 -5
- package/components/http/http.mock.js +101 -49
- package/components/hub-source/hub-source.js +190 -83
- package/components/hub-source/hub-source__user.js +44 -11
- package/components/hub-source/hub-source__users-groups.js +65 -37
- package/components/i18n/i18n-context.js +10 -7
- package/components/i18n/i18n.js +10 -7
- package/components/icon/icon.js +93 -76
- package/components/icon/icon__svg.js +8 -0
- package/components/icon/index.js +8 -0
- package/components/input/input.js +13 -0
- package/components/island/adaptive-island-hoc.js +43 -30
- package/components/island/content.js +132 -115
- package/components/island/header.js +70 -57
- package/components/island/island.js +40 -28
- package/components/island-legacy/content-legacy.js +25 -17
- package/components/island-legacy/header-legacy.js +27 -19
- package/components/island-legacy/island-legacy.js +25 -17
- package/components/link/clickableLink.js +59 -44
- package/components/link/link.js +68 -57
- package/components/list/consts.js +2 -2
- package/components/list/list.js +698 -611
- package/components/list/list__custom.js +62 -44
- package/components/list/list__hint.js +19 -10
- package/components/list/list__item.js +174 -133
- package/components/list/list__link.js +50 -37
- package/components/list/list__separator.js +24 -14
- package/components/list/list__title.js +32 -22
- package/components/list/list__users-groups-source.js +126 -54
- package/components/loader/loader.js +74 -43
- package/components/loader/loader__core.js +263 -198
- package/components/loader-inline/loader-inline.js +35 -23
- package/components/loader-screen/loader-screen.js +46 -25
- package/components/login-dialog/login-dialog.js +158 -111
- package/components/login-dialog/service.js +34 -8
- package/components/markdown/markdown.js +23 -15
- package/components/message/message.js +203 -161
- package/components/old-browsers-message/old-browsers-message.js +18 -11
- package/components/old-browsers-message/old-browsers-message__stop.js +7 -0
- package/components/old-browsers-message/white-list.js +17 -9
- package/components/pager/pager.js +271 -212
- package/components/panel/panel.js +25 -17
- package/components/permissions/permissions.js +172 -127
- package/components/permissions/permissions__cache.js +224 -194
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +343 -284
- package/components/popup/popup.target.js +8 -9
- package/components/popup/position.js +106 -96
- package/components/popup-menu/popup-menu.js +81 -44
- package/components/progress-bar/progress-bar.js +104 -87
- package/components/query-assist/query-assist.js +916 -838
- package/components/query-assist/query-assist__suggestions.js +30 -1
- package/components/radio/radio.js +34 -19
- package/components/radio/radio__item.js +69 -52
- package/components/select/select.js +957 -852
- package/components/select/select__filter.js +30 -0
- package/components/select/select__popup.js +487 -373
- package/components/shortcuts/core.js +217 -166
- package/components/shortcuts/shortcut-title.js +11 -6
- package/components/shortcuts/shortcuts-hoc.js +45 -19
- package/components/shortcuts/shortcuts.js +75 -50
- package/components/slider/slider.js +122 -99
- package/components/slider/slider.utils.js +24 -14
- package/components/storage/storage.js +33 -4
- package/components/storage/storage__fallback.js +224 -149
- package/components/storage/storage__local.js +153 -90
- package/components/tab-trap/tab-trap.js +153 -122
- package/components/table/cell.js +26 -14
- package/components/table/disable-hover-hoc.js +51 -33
- package/components/table/header-cell.js +89 -64
- package/components/table/header.js +132 -104
- package/components/table/multitable.js +125 -107
- package/components/table/row-with-focus-sensor.js +69 -25
- package/components/table/row.js +216 -175
- package/components/table/selection-adapter.js +3 -1
- package/components/table/selection-shortcuts-hoc.js +181 -180
- package/components/table/selection.js +226 -156
- package/components/table/smart-table.js +88 -50
- package/components/table/table.js +358 -289
- package/components/tabs/collapsible-more.js +79 -46
- package/components/tabs/collapsible-tab.js +38 -31
- package/components/tabs/collapsible-tabs.js +153 -88
- package/components/tabs/custom-item.js +2 -4
- package/components/tabs/dumb-tabs.js +117 -74
- package/components/tabs/smart-tabs.js +69 -29
- package/components/tabs/tab-link.js +5 -1
- package/components/tabs/tab.js +31 -19
- package/components/tabs/tabs.js +31 -0
- package/components/tag/tag.js +173 -133
- package/components/tags-input/tags-input.js +427 -329
- package/components/tags-list/tags-list.js +78 -57
- package/components/text/text.js +39 -28
- package/components/toggle/toggle.js +70 -56
- package/components/tooltip/tooltip.js +190 -146
- package/components/user-agreement/service.js +371 -228
- package/components/user-agreement/toolbox.eula.js +1 -160
- package/components/user-agreement/user-agreement.js +120 -85
- package/components/user-card/card.js +29 -0
- package/components/user-card/smart-user-card-tooltip.js +111 -51
- package/components/user-card/tooltip.js +84 -47
- package/components/user-card/user-card.js +29 -0
- package/package.json +1 -2
@@ -1,59 +1,111 @@
|
|
1
|
+
import { a as _inherits, b as _createClass, k as _toConsumableArray, d as _objectSpread2, l as _createForOfIteratorHelper, f as _classCallCheck, g as _callSuper, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import 'core-js/modules/es.array.filter.js';
|
4
|
+
import 'core-js/modules/es.array.index-of.js';
|
5
|
+
import 'core-js/modules/es.array.iterator.js';
|
6
|
+
import 'core-js/modules/es.map.js';
|
7
|
+
import 'core-js/modules/es.object.to-string.js';
|
8
|
+
import 'core-js/modules/es.promise.js';
|
9
|
+
import 'core-js/modules/es.regexp.constructor.js';
|
10
|
+
import 'core-js/modules/es.regexp.exec.js';
|
11
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
12
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
1
13
|
import HTTP from './http.js';
|
14
|
+
import 'core-js/modules/es.object.entries.js';
|
15
|
+
import 'core-js/modules/es.reflect.delete-property.js';
|
16
|
+
import 'core-js/modules/es.weak-map.js';
|
17
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
2
18
|
import 'es6-error';
|
3
19
|
import '../global/url.js';
|
20
|
+
import 'core-js/modules/es.string.match.js';
|
21
|
+
import 'core-js/modules/es.string.replace.js';
|
4
22
|
|
5
|
-
|
6
|
-
requestToken: ()
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
constructor() {
|
15
|
-
super(authMock);
|
16
|
-
this.defaultResponse = null;
|
17
|
-
this.requests = [];
|
18
|
-
this.responsesByUrlMap = new Map();
|
19
|
-
}
|
20
|
-
_fetch(url, params) {
|
21
|
-
this.requests = [...this.requests, {
|
22
|
-
url,
|
23
|
-
params: {
|
24
|
-
...params,
|
25
|
-
body: typeof params.body === 'string' ? JSON.parse(params.body) : params.body
|
26
|
-
}
|
27
|
-
}];
|
28
|
-
return {
|
29
|
-
status: 200,
|
30
|
-
headers: new Headers({
|
31
|
-
'content-type': 'application/json'
|
32
|
-
}),
|
33
|
-
json: () => Promise.resolve(this._getResponseForUrl(url) || this.defaultResponse)
|
34
|
-
};
|
23
|
+
var authMock = {
|
24
|
+
requestToken: function requestToken() {
|
25
|
+
return 'mock token';
|
26
|
+
},
|
27
|
+
shouldRefreshToken: function shouldRefreshToken() {
|
28
|
+
return false;
|
29
|
+
},
|
30
|
+
forceTokenUpdate: function forceTokenUpdate() {
|
31
|
+
return Promise.resolve(null);
|
35
32
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
this
|
33
|
+
};
|
34
|
+
var HTTPMock = /*#__PURE__*/function (_HTTP) {
|
35
|
+
function HTTPMock() {
|
36
|
+
var _this;
|
37
|
+
_classCallCheck(this, HTTPMock);
|
38
|
+
_this = _callSuper(this, HTTPMock, [authMock]);
|
39
|
+
_defineProperty(_this, "defaultResponse", void 0);
|
40
|
+
_defineProperty(_this, "requests", void 0);
|
41
|
+
_defineProperty(_this, "responsesByUrlMap", void 0);
|
42
|
+
_this.defaultResponse = null;
|
43
|
+
_this.requests = [];
|
44
|
+
_this.responsesByUrlMap = new Map();
|
45
|
+
return _this;
|
41
46
|
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
_inherits(HTTPMock, _HTTP);
|
48
|
+
return _createClass(HTTPMock, [{
|
49
|
+
key: "_fetch",
|
50
|
+
value: function _fetch(url, params) {
|
51
|
+
var _this2 = this;
|
52
|
+
this.requests = [].concat(_toConsumableArray(this.requests), [{
|
53
|
+
url,
|
54
|
+
params: _objectSpread2(_objectSpread2({}, params), {}, {
|
55
|
+
body: typeof params.body === 'string' ? JSON.parse(params.body) : params.body
|
56
|
+
})
|
57
|
+
}]);
|
58
|
+
return Promise.resolve({
|
59
|
+
status: 200,
|
60
|
+
headers: new Headers({
|
61
|
+
'content-type': 'application/json'
|
62
|
+
}),
|
63
|
+
json: function json() {
|
64
|
+
return Promise.resolve(_this2._getResponseForUrl(url) || _this2.defaultResponse);
|
65
|
+
}
|
66
|
+
});
|
67
|
+
}
|
68
|
+
}, {
|
69
|
+
key: "respondDefault",
|
70
|
+
value: function respondDefault(response) {
|
71
|
+
this.defaultResponse = response;
|
72
|
+
}
|
73
|
+
}, {
|
74
|
+
key: "respondForUrl",
|
75
|
+
value: function respondForUrl(url, response) {
|
76
|
+
this.responsesByUrlMap.set(url, response);
|
77
|
+
}
|
78
|
+
}, {
|
79
|
+
key: "_getResponseForUrl",
|
80
|
+
value: function _getResponseForUrl(urlToMatch) {
|
81
|
+
var urls = this.responsesByUrlMap.keys();
|
82
|
+
var _iterator = _createForOfIteratorHelper(urls),
|
83
|
+
_step;
|
84
|
+
try {
|
85
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
86
|
+
var url = _step.value;
|
87
|
+
if (url === urlToMatch) {
|
88
|
+
return this.responsesByUrlMap.get(url);
|
89
|
+
}
|
90
|
+
if (url instanceof RegExp && url.test(urlToMatch)) {
|
91
|
+
return this.responsesByUrlMap.get(url);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
} catch (err) {
|
95
|
+
_iterator.e(err);
|
96
|
+
} finally {
|
97
|
+
_iterator.f();
|
50
98
|
}
|
99
|
+
return null;
|
51
100
|
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
101
|
+
}, {
|
102
|
+
key: "getRequestsByUrlPart",
|
103
|
+
value: function getRequestsByUrlPart(url) {
|
104
|
+
return this.requests.filter(function (it) {
|
105
|
+
return it.url.indexOf(url) !== -1;
|
106
|
+
});
|
107
|
+
}
|
108
|
+
}]);
|
109
|
+
}(HTTP);
|
58
110
|
|
59
111
|
export { HTTPMock as default };
|
@@ -1,7 +1,17 @@
|
|
1
|
-
|
1
|
+
import { _ as _defineProperty, b as _createClass, f as _classCallCheck, h as _asyncToGenerator, i as _regeneratorRuntime } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import 'core-js/modules/es.array.filter.js';
|
4
|
+
import 'core-js/modules/es.array.index-of.js';
|
5
|
+
import 'core-js/modules/es.array.slice.js';
|
6
|
+
import 'core-js/modules/es.object.assign.js';
|
7
|
+
import 'core-js/modules/es.object.to-string.js';
|
8
|
+
|
9
|
+
var defaultOptions = {
|
2
10
|
searchMax: 20,
|
3
11
|
searchSideThreshold: 100,
|
4
|
-
queryFormatter:
|
12
|
+
queryFormatter: function queryFormatter(query) {
|
13
|
+
return "".concat(query, " or ").concat(query, "*");
|
14
|
+
}
|
5
15
|
};
|
6
16
|
/**
|
7
17
|
* HubSource is designed to speed up search requests for small installations.
|
@@ -9,101 +19,198 @@ const defaultOptions = {
|
|
9
19
|
* of cached results to greatly increase search speed. Useful for completion and
|
10
20
|
* select data source.
|
11
21
|
*/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
var HubSource = /*#__PURE__*/function () {
|
23
|
+
function HubSource(auth, relativeUrl, options) {
|
24
|
+
_classCallCheck(this, HubSource);
|
25
|
+
_defineProperty(this, "http", void 0);
|
26
|
+
_defineProperty(this, "relativeUrl", void 0);
|
27
|
+
_defineProperty(this, "options", void 0);
|
28
|
+
_defineProperty(this, "storedData", void 0);
|
29
|
+
_defineProperty(this, "isClientSideSearch", void 0);
|
30
|
+
_defineProperty(this, "filterFn", void 0);
|
21
31
|
this.http = auth.http;
|
22
32
|
this.relativeUrl = relativeUrl;
|
23
33
|
this.options = Object.assign({}, defaultOptions, options);
|
24
34
|
this.storedData = null;
|
25
35
|
this.isClientSideSearch = null;
|
26
|
-
this.filterFn = ()
|
27
|
-
|
28
|
-
|
29
|
-
return this.http.get(this.relativeUrl, {
|
30
|
-
query: queryParams
|
31
|
-
});
|
36
|
+
this.filterFn = function () {
|
37
|
+
return true;
|
38
|
+
};
|
32
39
|
}
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
return _createClass(HubSource, [{
|
41
|
+
key: "makeRequest",
|
42
|
+
value: function makeRequest(queryParams) {
|
43
|
+
return this.http.get(this.relativeUrl, {
|
44
|
+
query: queryParams
|
45
|
+
});
|
36
46
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
}, {
|
48
|
+
key: "makeCachedRequest",
|
49
|
+
value: function () {
|
50
|
+
var _makeCachedRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
51
|
+
var res;
|
52
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
53
|
+
while (1) switch (_context.prev = _context.next) {
|
54
|
+
case 0:
|
55
|
+
if (!this.storedData) {
|
56
|
+
_context.next = 2;
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
return _context.abrupt("return", this.storedData);
|
60
|
+
case 2:
|
61
|
+
_context.next = 4;
|
62
|
+
return this.makeRequest(params);
|
63
|
+
case 4:
|
64
|
+
res = _context.sent;
|
65
|
+
this.storedData = res;
|
66
|
+
return _context.abrupt("return", res);
|
67
|
+
case 7:
|
68
|
+
case "end":
|
69
|
+
return _context.stop();
|
70
|
+
}
|
71
|
+
}, _callee, this);
|
72
|
+
}));
|
73
|
+
function makeCachedRequest(_x) {
|
74
|
+
return _makeCachedRequest.apply(this, arguments);
|
75
|
+
}
|
76
|
+
return makeCachedRequest;
|
77
|
+
}()
|
78
|
+
}, {
|
79
|
+
key: "checkIsClientSideSearch",
|
80
|
+
value: function checkIsClientSideSearch(res) {
|
81
|
+
return res.total <= this.options.searchSideThreshold;
|
50
82
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
83
|
+
}, {
|
84
|
+
key: "getDefaultFilterFn",
|
85
|
+
value: function getDefaultFilterFn(query) {
|
86
|
+
if (!query) {
|
87
|
+
return function () {
|
88
|
+
return true;
|
89
|
+
};
|
90
|
+
}
|
91
|
+
return function (it) {
|
92
|
+
return it.name.toLowerCase().indexOf(query.toLowerCase()) !== -1;
|
93
|
+
};
|
59
94
|
}
|
60
|
-
|
61
|
-
|
95
|
+
}, {
|
96
|
+
key: "formatQuery",
|
97
|
+
value: function formatQuery(query) {
|
98
|
+
return query ? this.options.queryFormatter(query) : '';
|
62
99
|
}
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
100
|
+
}, {
|
101
|
+
key: "processResults",
|
102
|
+
value: function processResults(res) {
|
103
|
+
var _this = this;
|
104
|
+
var items = res[this.relativeUrl] || [];
|
105
|
+
if (this.isClientSideSearch) {
|
106
|
+
return items.filter(function (it) {
|
107
|
+
return _this.filterFn(it);
|
108
|
+
}).slice(0, this.options.searchMax);
|
109
|
+
}
|
110
|
+
return items;
|
68
111
|
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
112
|
+
}, {
|
113
|
+
key: "sideDetectionRequest",
|
114
|
+
value: function () {
|
115
|
+
var _sideDetectionRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, query) {
|
116
|
+
var res;
|
117
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
118
|
+
while (1) switch (_context2.prev = _context2.next) {
|
119
|
+
case 0:
|
120
|
+
_context2.next = 2;
|
121
|
+
return this.makeCachedRequest(HubSource.mergeParams(params, {
|
122
|
+
$top: this.options.searchSideThreshold
|
123
|
+
}));
|
124
|
+
case 2:
|
125
|
+
res = _context2.sent;
|
126
|
+
this.isClientSideSearch = this.checkIsClientSideSearch(res);
|
127
|
+
if (this.isClientSideSearch) {
|
128
|
+
_context2.next = 6;
|
129
|
+
break;
|
130
|
+
}
|
131
|
+
return _context2.abrupt("return", this.doServerSideSearch(params, query));
|
132
|
+
case 6:
|
133
|
+
return _context2.abrupt("return", res);
|
134
|
+
case 7:
|
135
|
+
case "end":
|
136
|
+
return _context2.stop();
|
137
|
+
}
|
138
|
+
}, _callee2, this);
|
139
|
+
}));
|
140
|
+
function sideDetectionRequest(_x2, _x3) {
|
141
|
+
return _sideDetectionRequest.apply(this, arguments);
|
142
|
+
}
|
143
|
+
return sideDetectionRequest;
|
144
|
+
}()
|
145
|
+
}, {
|
146
|
+
key: "doClientSideSearch",
|
147
|
+
value: function doClientSideSearch(params) {
|
148
|
+
return this.makeCachedRequest(HubSource.mergeParams(params, {
|
149
|
+
$top: this.constructor.TOP_ALL
|
150
|
+
}));
|
151
|
+
}
|
152
|
+
}, {
|
153
|
+
key: "doServerSideSearch",
|
154
|
+
value: function doServerSideSearch(params, query) {
|
155
|
+
return this.makeRequest(HubSource.mergeParams(params, {
|
156
|
+
query: this.formatQuery(query),
|
157
|
+
$top: this.options.searchMax
|
158
|
+
}));
|
159
|
+
}
|
160
|
+
}, {
|
161
|
+
key: "getValueFromSuitableSource",
|
162
|
+
value: function getValueFromSuitableSource(query, params) {
|
163
|
+
if (this.isClientSideSearch === null) {
|
164
|
+
return this.sideDetectionRequest(params, query);
|
165
|
+
}
|
166
|
+
if (this.isClientSideSearch) {
|
167
|
+
return this.doClientSideSearch(params);
|
168
|
+
}
|
77
169
|
return this.doServerSideSearch(params, query);
|
78
170
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
171
|
+
}, {
|
172
|
+
key: "get",
|
173
|
+
value: function () {
|
174
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query, params, filterFn) {
|
175
|
+
var res;
|
176
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
177
|
+
while (1) switch (_context3.prev = _context3.next) {
|
178
|
+
case 0:
|
179
|
+
HubSource.validateInputParams(params);
|
180
|
+
this.filterFn = filterFn || this.getDefaultFilterFn(query);
|
181
|
+
_context3.next = 4;
|
182
|
+
return this.getValueFromSuitableSource(query, params);
|
183
|
+
case 4:
|
184
|
+
res = _context3.sent;
|
185
|
+
return _context3.abrupt("return", this.processResults(res));
|
186
|
+
case 6:
|
187
|
+
case "end":
|
188
|
+
return _context3.stop();
|
189
|
+
}
|
190
|
+
}, _callee3, this);
|
191
|
+
}));
|
192
|
+
function get(_x4, _x5, _x6) {
|
193
|
+
return _get.apply(this, arguments);
|
194
|
+
}
|
195
|
+
return get;
|
196
|
+
}()
|
197
|
+
}], [{
|
198
|
+
key: "mergeParams",
|
199
|
+
value: function mergeParams(params, toMerge) {
|
200
|
+
return Object.assign({}, params, toMerge);
|
95
201
|
}
|
96
|
-
|
97
|
-
|
202
|
+
}, {
|
203
|
+
key: "validateInputParams",
|
204
|
+
value: function validateInputParams(params) {
|
205
|
+
if (params.top) {
|
206
|
+
throw new Error('HubSource: params.top should not be filled, configure "options.searchMax" instead');
|
207
|
+
}
|
208
|
+
if (params.query) {
|
209
|
+
throw new Error('HubSource: params.query should not be filled, configure "options.queryFormatter" instead');
|
210
|
+
}
|
98
211
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
HubSource.validateInputParams(params);
|
103
|
-
this.filterFn = filterFn || this.getDefaultFilterFn(query);
|
104
|
-
const res = await this.getValueFromSuitableSource(query, params);
|
105
|
-
return this.processResults(res);
|
106
|
-
}
|
107
|
-
}
|
212
|
+
}]);
|
213
|
+
}();
|
214
|
+
_defineProperty(HubSource, "TOP_ALL", -1);
|
108
215
|
|
109
216
|
export { HubSource as default };
|
@@ -1,27 +1,60 @@
|
|
1
|
+
import { h as _asyncToGenerator, i as _regeneratorRuntime } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
1
3
|
import HTTP from '../http/http.js';
|
4
|
+
import 'core-js/modules/es.array.index-of.js';
|
5
|
+
import 'core-js/modules/es.array.iterator.js';
|
6
|
+
import 'core-js/modules/es.object.entries.js';
|
7
|
+
import 'core-js/modules/es.object.to-string.js';
|
8
|
+
import 'core-js/modules/es.promise.js';
|
9
|
+
import 'core-js/modules/es.reflect.delete-property.js';
|
10
|
+
import 'core-js/modules/es.weak-map.js';
|
11
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
12
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
2
13
|
import 'es6-error';
|
3
14
|
import '../global/url.js';
|
15
|
+
import 'core-js/modules/es.regexp.exec.js';
|
16
|
+
import 'core-js/modules/es.string.match.js';
|
17
|
+
import 'core-js/modules/es.string.replace.js';
|
4
18
|
|
5
|
-
|
19
|
+
var DEFAULT_FIELDS = 'id,name,login,banned,banReason,profile(email/email,avatar/url)';
|
6
20
|
function convertUserForCard(hubUser) {
|
7
|
-
|
21
|
+
var _hubUser$profile, _hubUser$profile2;
|
22
|
+
var serverUri = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
8
23
|
return {
|
9
24
|
name: hubUser.name,
|
10
25
|
login: hubUser.login,
|
11
26
|
banned: hubUser.banned,
|
12
27
|
banReason: hubUser.banReason,
|
13
|
-
email: hubUser.profile
|
14
|
-
avatarUrl: hubUser.profile
|
15
|
-
href:
|
28
|
+
email: (_hubUser$profile = hubUser.profile) === null || _hubUser$profile === void 0 || (_hubUser$profile = _hubUser$profile.email) === null || _hubUser$profile === void 0 ? void 0 : _hubUser$profile.email,
|
29
|
+
avatarUrl: (_hubUser$profile2 = hubUser.profile) === null || _hubUser$profile2 === void 0 || (_hubUser$profile2 = _hubUser$profile2.avatar) === null || _hubUser$profile2 === void 0 ? void 0 : _hubUser$profile2.url,
|
30
|
+
href: "".concat(serverUri, "users/").concat(hubUser.id)
|
16
31
|
};
|
17
32
|
}
|
18
33
|
function createHubUserCardSource(auth, userId) {
|
19
|
-
|
20
|
-
|
21
|
-
return
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
var fields = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FIELDS;
|
35
|
+
var http = new HTTP(auth);
|
36
|
+
return /*#__PURE__*/function () {
|
37
|
+
var _getHubUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
38
|
+
var hubUser;
|
39
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
41
|
+
case 0:
|
42
|
+
_context.next = 2;
|
43
|
+
return http.get("".concat(auth.config.serverUri, "api/rest/users/").concat(userId, "?fields=").concat(fields));
|
44
|
+
case 2:
|
45
|
+
hubUser = _context.sent;
|
46
|
+
return _context.abrupt("return", convertUserForCard(hubUser, auth.config.serverUri));
|
47
|
+
case 4:
|
48
|
+
case "end":
|
49
|
+
return _context.stop();
|
50
|
+
}
|
51
|
+
}, _callee);
|
52
|
+
}));
|
53
|
+
function getHubUser() {
|
54
|
+
return _getHubUser.apply(this, arguments);
|
55
|
+
}
|
56
|
+
return getHubUser;
|
57
|
+
}();
|
25
58
|
}
|
26
59
|
|
27
60
|
export { convertUserForCard, createHubUserCardSource };
|
@@ -1,57 +1,85 @@
|
|
1
|
+
import { b as _createClass, f as _classCallCheck, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import 'core-js/modules/es.array.index-of.js';
|
4
|
+
import 'core-js/modules/es.array.iterator.js';
|
5
|
+
import 'core-js/modules/es.object.assign.js';
|
6
|
+
import 'core-js/modules/es.object.to-string.js';
|
7
|
+
import 'core-js/modules/es.promise.js';
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
1
9
|
import HubSource from './hub-source.js';
|
10
|
+
import 'core-js/modules/es.array.filter.js';
|
11
|
+
import 'core-js/modules/es.array.slice.js';
|
2
12
|
|
3
|
-
|
13
|
+
var defaultOptions = {
|
4
14
|
searchMax: 20,
|
5
15
|
searchSideThreshold: 200
|
6
16
|
};
|
7
|
-
|
8
|
-
auth
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
17
|
+
var HubSourceUsersGroups = /*#__PURE__*/function () {
|
18
|
+
function HubSourceUsersGroups(auth, options) {
|
19
|
+
_classCallCheck(this, HubSourceUsersGroups);
|
20
|
+
_defineProperty(this, "auth", void 0);
|
21
|
+
_defineProperty(this, "options", void 0);
|
22
|
+
_defineProperty(this, "usersSource", void 0);
|
23
|
+
_defineProperty(this, "groupsSource", void 0);
|
13
24
|
this.auth = auth;
|
14
25
|
this.options = Object.assign({}, defaultOptions, options);
|
15
26
|
this.usersSource = new HubSource(auth, 'users', {
|
16
27
|
searchMax: this.options.searchMax,
|
17
28
|
searchSideThreshold: this.options.searchSideThreshold,
|
18
|
-
queryFormatter:
|
29
|
+
queryFormatter: function queryFormatter(query) {
|
30
|
+
return "nameStartsWith: ".concat(HubSourceUsersGroups.wrapMultiwordQuery(query), " or loginStartsWith: ").concat(HubSourceUsersGroups.wrapMultiwordQuery(query));
|
31
|
+
}
|
19
32
|
});
|
20
33
|
this.groupsSource = new HubSource(auth, 'usergroups', {
|
21
34
|
searchMax: this.options.searchMax,
|
22
35
|
searchSideThreshold: this.options.searchSideThreshold
|
23
36
|
});
|
24
37
|
}
|
25
|
-
|
26
|
-
|
27
|
-
|
38
|
+
return _createClass(HubSourceUsersGroups, [{
|
39
|
+
key: "createUsersFilterFn",
|
40
|
+
value: function createUsersFilterFn(query) {
|
41
|
+
if (!query) {
|
42
|
+
return function () {
|
43
|
+
return true;
|
44
|
+
};
|
45
|
+
}
|
46
|
+
var normalizedQuery = query.toLowerCase();
|
47
|
+
return function (it) {
|
48
|
+
return it.name.toLowerCase().indexOf(normalizedQuery) !== -1 || it.login.toLowerCase().indexOf(normalizedQuery) !== -1;
|
49
|
+
};
|
28
50
|
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
return (
|
51
|
+
}, {
|
52
|
+
key: "getUsers",
|
53
|
+
value: function getUsers() {
|
54
|
+
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
55
|
+
return this.usersSource.get(query, {
|
56
|
+
fields: 'id,name,login,total,profile/avatar/url',
|
57
|
+
orderBy: 'name'
|
58
|
+
}, this.createUsersFilterFn(query));
|
34
59
|
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
}, {
|
61
|
+
key: "getGroups",
|
62
|
+
value: function getGroups() {
|
63
|
+
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
64
|
+
return this.groupsSource.get(query, {
|
65
|
+
fields: 'id,name,total,userCount,iconUrl',
|
66
|
+
orderBy: 'name'
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}, {
|
70
|
+
key: "getUserAndGroups",
|
71
|
+
value: function getUserAndGroups(query) {
|
72
|
+
return Promise.all([this.getUsers(query), this.getGroups(query)]);
|
73
|
+
}
|
74
|
+
}], [{
|
75
|
+
key: "wrapMultiwordQuery",
|
76
|
+
value: function wrapMultiwordQuery(query) {
|
77
|
+
if (query && query.indexOf(' ') !== -1) {
|
78
|
+
return "{".concat(query, "}");
|
79
|
+
}
|
80
|
+
return query;
|
81
|
+
}
|
82
|
+
}]);
|
83
|
+
}();
|
56
84
|
|
57
85
|
export { HubSourceUsersGroups as default };
|