@jetbrains/ring-ui 4.1.0-beta.3 → 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.
Files changed (234) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +17 -15
  3. package/babel.config.js +3 -2
  4. package/components/alert/alert.js +9 -3
  5. package/components/alert/alert.test.js +21 -48
  6. package/components/alert/container.css +1 -1
  7. package/components/alert/container.test.js +3 -13
  8. package/components/alert-service/alert-service.examples.css +18 -0
  9. package/components/alert-service/alert-service.examples.js +21 -0
  10. package/components/alert-service/alert-service.js +10 -3
  11. package/components/analytics/analytics__fus-plugin.js +3 -3
  12. package/components/analytics/analytics__ga-plugin.js +2 -2
  13. package/components/auth/auth.test.js +14 -7
  14. package/components/auth/auth__core.js +64 -33
  15. package/components/auth-dialog/auth-dialog.css +2 -3
  16. package/components/auth-dialog/auth-dialog.js +4 -1
  17. package/components/auth-dialog/auth-dialog.test.js +3 -19
  18. package/components/avatar/avatar.css +4 -1
  19. package/components/avatar/avatar.examples.js +3 -2
  20. package/components/avatar/avatar.js +34 -6
  21. package/components/avatar/avatar.test.js +20 -17
  22. package/components/avatar/fallback-avatar.js +136 -0
  23. package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
  24. package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
  25. package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
  26. package/components/badge/badge.test.js +13 -20
  27. package/components/button/button.css +2 -2
  28. package/components/button/button.js +4 -1
  29. package/components/button/button.test.js +32 -33
  30. package/components/button-group/button-group.js +1 -1
  31. package/components/button-group/caption.js +1 -1
  32. package/components/button-ng/button-ng.js +1 -1
  33. package/components/button-set-ng/button-set-ng.js +3 -1
  34. package/components/checkbox/checkbox.css +1 -1
  35. package/components/code/code.js +2 -5
  36. package/components/confirm/confirm.js +1 -0
  37. package/components/confirm-service/confirm-service.js +5 -5
  38. package/components/content-layout/content-layout.css +1 -1
  39. package/components/data-list/data-list.css +1 -1
  40. package/components/date-picker/date-input.js +5 -4
  41. package/components/date-picker/date-picker.css +34 -22
  42. package/components/date-picker/date-picker.js +16 -14
  43. package/components/date-picker/date-popup.js +22 -7
  44. package/components/date-picker/month-names.js +8 -5
  45. package/components/date-picker/month.js +6 -2
  46. package/components/date-picker/weekdays.js +10 -2
  47. package/components/dialog/dialog.examples.js +3 -1
  48. package/components/dialog/dialog.js +10 -5
  49. package/components/dialog/dialog.test.js +1 -1
  50. package/components/dialog/dialog__body-scroll-preventer.js +51 -31
  51. package/components/dialog-ng/dialog-ng.js +10 -10
  52. package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
  53. package/components/dropdown/dropdown.examples.js +36 -1
  54. package/components/dropdown/dropdown.test.js +2 -2
  55. package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
  56. package/components/dropdown-menu/dropdown-menu.js +117 -0
  57. package/components/dropdown-menu/dropdown-menu.test.js +76 -0
  58. package/components/error-bubble/error-bubble-legacy.css +1 -1
  59. package/components/error-bubble/error-bubble.css +1 -1
  60. package/components/error-bubble/error-bubble.examples.js +1 -1
  61. package/components/error-page/error-page.css +2 -2
  62. package/components/footer-ng/footer-ng.js +13 -3
  63. package/components/form/form.css +2 -2
  64. package/components/form-ng/form-ng.js +3 -1
  65. package/components/global/global.css +1 -1
  66. package/components/global/theme.js +1 -1
  67. package/components/global/variables.css +8 -1
  68. package/components/grid/grid.css +10 -9
  69. package/components/header/header.css +1 -1
  70. package/components/header/header.examples.js +7 -8
  71. package/components/header/profile.js +10 -11
  72. package/components/http/http.js +1 -1
  73. package/components/icon/icon.css +5 -4
  74. package/components/input/input-legacy.css +7 -7
  75. package/components/island/header.js +2 -2
  76. package/components/island/island.css +8 -3
  77. package/components/island-legacy/island-legacy.css +3 -1
  78. package/components/list/list.js +6 -1
  79. package/components/list/list__custom.js +9 -3
  80. package/components/list/list__item.js +8 -2
  81. package/components/list/list__link.js +2 -1
  82. package/components/loader-inline/loader-inline.css +1 -1
  83. package/components/loader-screen/loader-screen.css +1 -1
  84. package/components/message/message.css +1 -1
  85. package/components/message/message.examples.js +8 -7
  86. package/components/pager/pager.js +5 -3
  87. package/components/permissions/permissions.js +1 -1
  88. package/components/popup/popup.js +1 -1
  89. package/components/popup/popup.test.js +15 -13
  90. package/components/progress-bar/progress-bar.css +1 -1
  91. package/components/progress-bar/progress-bar.examples.js +3 -3
  92. package/components/progress-bar/progress-bar.js +5 -2
  93. package/components/progress-bar/progress-bar.test.js +12 -13
  94. package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
  95. package/components/query-assist/query-assist.css +13 -3
  96. package/components/query-assist/query-assist.examples.js +3 -4
  97. package/components/query-assist/query-assist.js +56 -12
  98. package/components/query-assist/query-assist.test.js +37 -5
  99. package/components/save-field-ng/save-field-ng.css +0 -3
  100. package/components/save-field-ng/save-field-ng.js +3 -1
  101. package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
  102. package/components/select/select.css +12 -7
  103. package/components/select/select.examples.js +13 -0
  104. package/components/select/select.js +30 -43
  105. package/components/select/select.test.js +4 -5
  106. package/components/select/select__popup.js +1 -0
  107. package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
  108. package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
  109. package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
  110. package/components/sidebar/sidebar.css +1 -0
  111. package/components/sidebar-ng/sidebar-ng.js +6 -2
  112. package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
  113. package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
  114. package/components/table/header.js +9 -1
  115. package/components/table/row.js +2 -1
  116. package/components/table/table.css +2 -1
  117. package/components/table-legacy/table-legacy.css +2 -2
  118. package/components/table-legacy/table-legacy__toolbar.css +2 -2
  119. package/components/table-legacy-ng/table-legacy-ng.js +38 -5
  120. package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
  121. package/components/tabs/collapsible-tab.js +2 -2
  122. package/components/tabs/collapsible-tabs.js +5 -9
  123. package/components/tabs/tab-link.js +4 -2
  124. package/components/tabs/tabs.css +32 -5
  125. package/components/tabs-ng/tabs-ng.js +4 -2
  126. package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
  127. package/components/tag/tag.css +5 -2
  128. package/components/tag/tag.examples.js +3 -0
  129. package/components/tag/tag.js +19 -16
  130. package/components/tags-input/tag-input.examples.js +1 -1
  131. package/components/tags-input/tags-input.js +5 -2
  132. package/components/template-ng/template-ng.js +1 -1
  133. package/components/tooltip/tooltip.js +7 -2
  134. package/components/user-agreement/user-agreement.css +1 -5
  135. package/components/user-agreement/user-agreement.examples.js +7 -6
  136. package/components/user-agreement/user-agreement.js +11 -3
  137. package/package.json +85 -83
  138. package/webpack.config.js +14 -10
  139. package/components/button-set-ng/button-set-ng.html +0 -1
  140. package/components/footer-ng/footer-ng.html +0 -13
  141. package/components/form-ng/form-ng__error-bubble.html +0 -3
  142. package/components/table-legacy-ng/table-legacy-ng.html +0 -4
  143. package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
  144. package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
  145. package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
  146. package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
  147. package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
  148. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
  149. package/dist/_helpers/background-flow.js +0 -232
  150. package/dist/_helpers/badge.js +0 -3
  151. package/dist/_helpers/button.js +0 -145
  152. package/dist/_helpers/clickableLink.js +0 -65
  153. package/dist/_helpers/data-tests.js +0 -15
  154. package/dist/_helpers/disable-hover-hoc.js +0 -407
  155. package/dist/_helpers/dom.js +0 -101
  156. package/dist/_helpers/get-uid.js +0 -15
  157. package/dist/_helpers/linear-function.js +0 -17
  158. package/dist/_helpers/list.js +0 -1327
  159. package/dist/_helpers/logo.js +0 -36
  160. package/dist/_helpers/memoize.js +0 -17
  161. package/dist/_helpers/popup.js +0 -691
  162. package/dist/_helpers/popup.target.js +0 -27
  163. package/dist/_helpers/rerender-hoc.js +0 -49
  164. package/dist/_helpers/schedule-raf.js +0 -31
  165. package/dist/_helpers/sniffer.js +0 -6
  166. package/dist/_helpers/theme.js +0 -40
  167. package/dist/_helpers/url.js +0 -125
  168. package/dist/alert-service.js +0 -149
  169. package/dist/alert.js +0 -284
  170. package/dist/analytics.js +0 -116
  171. package/dist/auth-dialog-service.js +0 -56
  172. package/dist/auth-dialog.js +0 -122
  173. package/dist/auth.js +0 -1744
  174. package/dist/avatar.js +0 -152
  175. package/dist/badge.js +0 -52
  176. package/dist/button-group.js +0 -48
  177. package/dist/button-set.js +0 -27
  178. package/dist/button-toolbar.js +0 -30
  179. package/dist/button.js +0 -12
  180. package/dist/caret.js +0 -262
  181. package/dist/checkbox.js +0 -108
  182. package/dist/confirm-service.js +0 -102
  183. package/dist/confirm.js +0 -113
  184. package/dist/content-layout.js +0 -184
  185. package/dist/contenteditable.js +0 -81
  186. package/dist/data-list.js +0 -466
  187. package/dist/date-picker.js +0 -1398
  188. package/dist/dialog.js +0 -223
  189. package/dist/dropdown.js +0 -250
  190. package/dist/error-bubble.js +0 -56
  191. package/dist/error-message.js +0 -53
  192. package/dist/footer.js +0 -124
  193. package/dist/grid.js +0 -148
  194. package/dist/group.js +0 -34
  195. package/dist/header.js +0 -658
  196. package/dist/heading.js +0 -76
  197. package/dist/http.js +0 -207
  198. package/dist/hub-source.js +0 -130
  199. package/dist/icon.js +0 -211
  200. package/dist/input.js +0 -228
  201. package/dist/island.js +0 -314
  202. package/dist/link.js +0 -117
  203. package/dist/list.js +0 -29
  204. package/dist/loader-inline.js +0 -165
  205. package/dist/loader-screen.js +0 -45
  206. package/dist/loader.js +0 -338
  207. package/dist/login-dialog.js +0 -173
  208. package/dist/logo.js +0 -8
  209. package/dist/message.js +0 -226
  210. package/dist/old-browsers-message.js +0 -129
  211. package/dist/pager.js +0 -325
  212. package/dist/panel.js +0 -34
  213. package/dist/permissions.js +0 -466
  214. package/dist/popup-menu.js +0 -93
  215. package/dist/popup.js +0 -16
  216. package/dist/progress-bar.js +0 -111
  217. package/dist/proxy-attrs.js +0 -19
  218. package/dist/query-assist.js +0 -1081
  219. package/dist/radio.js +0 -112
  220. package/dist/select.js +0 -1920
  221. package/dist/selection.js +0 -213
  222. package/dist/shortcuts.js +0 -307
  223. package/dist/storage.js +0 -373
  224. package/dist/style.css +0 -1
  225. package/dist/tab-trap.js +0 -174
  226. package/dist/table.js +0 -903
  227. package/dist/tabs.js +0 -721
  228. package/dist/tag.js +0 -187
  229. package/dist/tags-input.js +0 -440
  230. package/dist/tags-list.js +0 -91
  231. package/dist/text.js +0 -38
  232. package/dist/toggle.js +0 -80
  233. package/dist/tooltip.js +0 -202
  234. package/dist/user-card.js +0 -218
@@ -1,466 +0,0 @@
1
- import { b 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
- /**
273
- * <code>
274
- * const permissions = new Permissions(auth, {prefix: 'jetbrains.jetpass.', services: [auth.serviceId]})
275
- * permissions.load().then(function (p) {
276
- * const canReadUser = p.has('read-user');
277
- * ...
278
- * });
279
- *
280
- * permissions.check('read-user').then(function(canReadUser) {
281
- * ...
282
- * });
283
- * </code>
284
- *
285
- * @param {Auth} auth instance of well configured Auth object
286
- * @param {{
287
- * prefix: string?,
288
- * namesConverter: function?
289
- * serviceId: string?
290
- * }=} config permissions loaded configuration.
291
- * <code>prefix</code> if provided then this prefix is removed from the permissions names.
292
- * <code>namesConverter</code> if provided it maps permission names used on server-side to client-side permission names. It is used only if prefix is undefined.
293
- * <code>serviceId</code> if provided then permissions only for the service are loaded.
294
- * @constructor
295
- */
296
-
297
- class Permissions {
298
- /**
299
- * @const {string}
300
- */
301
- constructor(auth, config = {}) {
302
- _defineProperty(this, "_defaultDatasource", query => this._auth.http.get(Permissions.API_PERMISSION_CACHE_PATH, {
303
- query: {
304
- fields: 'permission/key,global,projects(id)',
305
- query
306
- }
307
- }));
308
-
309
- this.query = Permissions.getPermissionQuery(config.services);
310
- this.namesConverter = config.prefix ? Permissions.getDefaultNamesConverter(config.prefix) : config.namesConverter;
311
-
312
- if (!auth) {
313
- throw new Error('Parameter auth is required');
314
- }
315
-
316
- this._auth = auth;
317
- this._datasource = config.datasource || this._defaultDatasource;
318
- this._promise = null;
319
- this._subscribed = false;
320
- this._permissionCache = new PermissionCache(null, this.namesConverter);
321
- }
322
-
323
- /**
324
- * Returns function, which cuts off prefix from server-side permission name
325
- *
326
- * @param {string} prefix
327
- * @returns {Function}
328
- */
329
- static getDefaultNamesConverter(prefix) {
330
- return storedName => {
331
- if (storedName.indexOf(prefix) !== 0) {
332
- return storedName;
333
- } else {
334
- return storedName.substr(prefix.length);
335
- }
336
- };
337
- }
338
-
339
- static getPermissionQuery(services) {
340
- if (!services || !services.length) {
341
- return undefined;
342
- }
343
-
344
- return services.map(service => `service:{${service}}`).join(' or ');
345
- }
346
-
347
- set(cachedPermissions) {
348
- this._permissionCache.set(cachedPermissions);
349
-
350
- this._setCache(Promise.resolve(this._permissionCache));
351
-
352
- return this._permissionCache;
353
- }
354
-
355
- get() {
356
- return this._permissionCache.get();
357
- }
358
-
359
- _setCache(value) {
360
- this._promise = value;
361
- return value;
362
- }
363
-
364
- _getCache() {
365
- return this._promise;
366
- }
367
-
368
- _resetCache() {
369
- this._setCache(null);
370
- }
371
- /**
372
- * Loads logged-in user permissions.
373
- * @param {object?} options
374
- * @return {Promise.<Permissions>} promise that is resolved when the permissions are loaded
375
- */
376
-
377
-
378
- load(options) {
379
- if (this._subscribed === false) {
380
- this._auth.addListener('userChange', () => {
381
- this.reload();
382
- });
383
-
384
- this._subscribed = true;
385
- }
386
-
387
- if (!hasCacheControl('NO_CACHE', options) && this._getCache()) {
388
- return this._getCache();
389
- }
390
-
391
- if (hasCacheControl('NO_STORE', options)) {
392
- return this._loadPermissions().then(cachedPermissions => new PermissionCache(cachedPermissions, this.namesConverter));
393
- }
394
-
395
- return this._setCache(this._loadPermissions().then(cachedPermissions => this.set(cachedPermissions)));
396
-
397
- function hasCacheControl(value, _options) {
398
- if (_options && _options.cacheControl) {
399
- return _options.cacheControl[value];
400
- }
401
-
402
- return false;
403
- }
404
- }
405
-
406
- _loadPermissions() {
407
- return this._datasource(this.query);
408
- }
409
- /**
410
- * Reloads permission cache from server
411
- * @returns {Promise.<Permissions>} promise that is resolved when the permissions are reloaded
412
- */
413
-
414
-
415
- reload() {
416
- this._resetCache();
417
-
418
- return this.load();
419
- }
420
- /**
421
- * Waits till the permission cache is loaded then checks if the current user has the
422
- * given permissions in the project with the given id.
423
- *
424
- * @param {string} permissions space separated list of permissions
425
- * @param {string=} projectId optional projectId. If absent the method checks
426
- * if the given permission is granted in any project.
427
- *
428
- * @return {Promise.<boolean>}
429
- */
430
-
431
-
432
- check(permissions, projectId) {
433
- return this.load().then(permissionCache => permissionCache.has(permissions, projectId));
434
- }
435
- /**
436
- * Binds a property with the name <code>propertyName</code> of the <code>object</code>
437
- * to a boolean value that is true if user has the permissions and false if she doesn't.
438
- *
439
- * @example
440
- * <code>
441
- * userPermissions.bindVariable($scope, 'canReadRole', 'role-read')
442
- * </code>
443
- *
444
- * @param {object} object an object which property should be bound
445
- * @param {string} propertyName a name of a property to bind
446
- * @param {string} permissions space separated list of permissions
447
- * @param {string=} projectId optional projectId. If absent the method checks
448
- * if the given permissions are granted in any project.
449
- *
450
- * @return {Promise.<boolean>}
451
- */
452
-
453
-
454
- bindVariable(object, propertyName, permissions, projectId) {
455
- object[propertyName] = false;
456
- return this.check(permissions, projectId).then(permitted => {
457
- object[propertyName] = permitted;
458
- return permitted;
459
- });
460
- }
461
-
462
- }
463
-
464
- _defineProperty(Permissions, "API_PERMISSION_CACHE_PATH", 'permissions/cache');
465
-
466
- export default Permissions;
@@ -1,93 +0,0 @@
1
- import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends, c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { P as Popup } from './_helpers/popup.js';
5
- import { L as List } from './_helpers/list.js';
6
- import 'react-dom';
7
- import 'classnames';
8
- import './_helpers/get-uid.js';
9
- import './_helpers/schedule-raf.js';
10
- import './_helpers/dom.js';
11
- import './shortcuts.js';
12
- import 'combokeys';
13
- import './_helpers/sniffer.js';
14
- import 'sniffr';
15
- import './_helpers/data-tests.js';
16
- import './tab-trap.js';
17
- import './_helpers/popup.target.js';
18
- import 'react-virtualized/dist/es/List';
19
- import 'react-virtualized/dist/es/AutoSizer';
20
- import 'react-virtualized/dist/es/WindowScroller';
21
- import 'react-virtualized/dist/es/CellMeasurer';
22
- import 'util-deprecate';
23
- import 'memoize-one';
24
- import './_helpers/memoize.js';
25
- import './link.js';
26
- import 'focus-visible';
27
- import './_helpers/clickableLink.js';
28
- import './avatar.js';
29
- import './_helpers/url.js';
30
- import './checkbox.js';
31
- import '@jetbrains/icons/checkmark';
32
- import '@jetbrains/icons/remove-10px';
33
- import './icon.js';
34
-
35
- const _ref = Popup.propTypes || {},
36
- popupPropTypes = _objectWithoutProperties(_ref, ["children"]);
37
- /**
38
- * @name Popup Menu
39
- */
40
-
41
-
42
- class PopupMenu extends Popup {
43
- constructor(...args) {
44
- super(...args);
45
-
46
- _defineProperty(this, "onSelect", (item, event) => {
47
- if (this.props.closeOnSelect) {
48
- this._onCloseAttempt(event);
49
- }
50
-
51
- this.props.onSelect(item, event);
52
- });
53
-
54
- _defineProperty(this, "listRef", el => {
55
- this.list = el;
56
- });
57
- }
58
-
59
- /** @override */
60
- getInternalContent() {
61
- const _this$props = this.props,
62
- props = _objectWithoutProperties(_this$props, ["className"]);
63
-
64
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(List, _extends({
65
- ref: this.listRef
66
- }, props, {
67
- maxHeight: this.popup && this.popup.style.maxHeight,
68
- shortcuts: this.shouldUseShortcuts(),
69
- onSelect: this.onSelect
70
- })));
71
- }
72
-
73
- }
74
-
75
- _defineProperty(PopupMenu, "isItemType", List.isItemType);
76
-
77
- _defineProperty(PopupMenu, "ListProps", List.ListProps);
78
-
79
- _defineProperty(PopupMenu, "propTypes", _objectSpread2(_objectSpread2(_objectSpread2({}, popupPropTypes), List.propTypes), {}, {
80
- closeOnSelect: PropTypes.bool
81
- }));
82
-
83
- _defineProperty(PopupMenu, "defaultProps", _objectSpread2(_objectSpread2(_objectSpread2({}, List.defaultProps), Popup.defaultProps), {}, {
84
- renderOptimization: false,
85
- closeOnSelect: false
86
- }));
87
-
88
- const {
89
- ListProps
90
- } = List;
91
-
92
- export default PopupMenu;
93
- export { ListProps };
package/dist/popup.js DELETED
@@ -1,16 +0,0 @@
1
- import './_helpers/_rollupPluginBabelHelpers.js';
2
- import 'react';
3
- import 'react-dom';
4
- import 'prop-types';
5
- import 'classnames';
6
- import './_helpers/get-uid.js';
7
- import './_helpers/schedule-raf.js';
8
- import './_helpers/dom.js';
9
- import './shortcuts.js';
10
- import './_helpers/data-tests.js';
11
- import './tab-trap.js';
12
- export { P as default, g as getPopupContainer } from './_helpers/popup.js';
13
- export { P as PopupTarget, a as PopupTargetContext } from './_helpers/popup.target.js';
14
- import 'combokeys';
15
- import './_helpers/sniffer.js';
16
- import 'sniffr';
@@ -1,111 +0,0 @@
1
- import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import { T as Theme } from './_helpers/theme.js';
6
-
7
- var modules_fb7af416 = {"unit":"8px","light":"progressBar_light__9afa5539","progressBar":"progressBar_progressBar__9afa5539","dark":"progressBar_dark__9afa5539","line":"progressBar_line__9afa5539","globalMode":"progressBar_globalMode__9afa5539","progress-bar":"progressBar_progressBar__9afa5539"};
8
-
9
- /**
10
- * @name Progress Bar
11
- */
12
-
13
- class ProgressBar extends PureComponent {
14
- constructor(...args) {
15
- super(...args);
16
-
17
- _defineProperty(this, "progressbarWrapperRef", el => {
18
- this.progressbarWrapper = el;
19
- });
20
-
21
- _defineProperty(this, "progressbarRef", el => {
22
- this.progressbar = el;
23
- });
24
- }
25
-
26
- /**
27
- * @param {number} value The progress task value
28
- * @param {number} max The maximum value
29
- * @return {number} The progress task value in percents
30
- * @private
31
- */
32
- static toPercent(value, max) {
33
- const HUNDRED_PERCENT = 100;
34
- const percents = value * HUNDRED_PERCENT / max;
35
- return percents > HUNDRED_PERCENT ? HUNDRED_PERCENT : percents;
36
- }
37
-
38
- render() {
39
- const _this$props = this.props,
40
- {
41
- theme,
42
- className,
43
- global,
44
- max,
45
- value
46
- } = _this$props,
47
- otherProps = _objectWithoutProperties(_this$props, ["theme", "className", "global", "max", "value"]);
48
-
49
- const width = value ? `${ProgressBar.toPercent(value, max)}%` : null;
50
- const classes = classNames(modules_fb7af416.progressBar, className, {
51
- [modules_fb7af416.light]: theme === Theme.LIGHT,
52
- [modules_fb7af416.dark]: theme === Theme.DARK,
53
- [modules_fb7af416.globalMode]: global
54
- });
55
- return /*#__PURE__*/React.createElement("div", _extends({}, otherProps, {
56
- className: classes,
57
- ref: this.progressbarWrapperRef
58
- }), /*#__PURE__*/React.createElement("div", {
59
- className: modules_fb7af416.line,
60
- ref: this.progressbarRef,
61
- role: "progressbar",
62
- "aria-valuenow": value,
63
- "aria-valuemin": 0,
64
- "aria-valuemax": max,
65
- style: {
66
- width
67
- }
68
- }));
69
- }
70
-
71
- }
72
-
73
- _defineProperty(ProgressBar, "propTypes", {
74
- theme: PropTypes.string,
75
-
76
- /**
77
- * Sets the ring-progress-bar_global class to position the progress bar on top of the screen.
78
- * Should be placed directly inside body, will be positioned right below .ring-header
79
- * if placed adjacent to it.
80
- * @type {boolean}
81
- */
82
- global: PropTypes.bool,
83
-
84
- /**
85
- * Custom class
86
- * @type {string}
87
- */
88
- className: PropTypes.string,
89
- style: PropTypes.object,
90
-
91
- /**
92
- * A floating point number that specifies minimum completion rate for a task to be considered
93
- * complete. Default value is 1.0.
94
- * @type {number}
95
- */
96
- max: PropTypes.number,
97
-
98
- /**
99
- * A floating point number that specifies current task completion rate.
100
- * @type {number}
101
- */
102
- value: PropTypes.number
103
- });
104
-
105
- _defineProperty(ProgressBar, "defaultProps", {
106
- max: 1.0,
107
- value: 0,
108
- theme: Theme.LIGHT
109
- });
110
-
111
- export default ProgressBar;
@@ -1,19 +0,0 @@
1
- function proxyAttrs(template, attrsWhitelist) {
2
- return function copyAttrs(iElement, iAttrs) {
3
- const PREFIX = 'data-proxy-';
4
- const attrsList = attrsWhitelist || Object.keys(iAttrs.$attr);
5
- let resultTemplate = template;
6
- attrsList.forEach(attrName => {
7
- if (iAttrs[attrName] !== undefined) {
8
- const attrLower = iAttrs.$attr[attrName];
9
- const attrValue = iAttrs[attrName];
10
- const attrFind = `${PREFIX}${attrLower}`.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
11
- const attrReplace = `${attrLower}="${attrValue}"`;
12
- resultTemplate = resultTemplate.replace(RegExp(`${attrFind}(="")*`, 'g'), attrReplace);
13
- }
14
- });
15
- return resultTemplate;
16
- };
17
- }
18
-
19
- export default proxyAttrs;