@jetbrains/ring-ui 5.0.36 → 5.0.38
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/editable-heading/editable-heading.d.ts +4 -2
- package/components/editable-heading/editable-heading.js +3 -3
- package/components/input/input.css +2 -0
- package/components/query-assist/query-assist.js +1 -1
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
- package/dist/_helpers/anchor.js +0 -1
- package/dist/_helpers/card.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
- package/dist/_helpers/footer.js +2 -13
- package/dist/_helpers/query-assist__suggestions.js +0 -10
- package/dist/_helpers/select__filter.js +0 -11
- package/dist/_helpers/services-link.js +0 -2
- package/dist/_helpers/sidebar.js +0 -12
- package/dist/_helpers/theme.js +0 -3
- package/dist/_helpers/title.js +0 -9
- package/dist/alert/alert.js +2 -32
- package/dist/alert/container.js +0 -5
- package/dist/alert-service/alert-service.js +0 -26
- package/dist/analytics/analytics.js +0 -22
- package/dist/analytics/analytics__custom-plugin.js +0 -38
- package/dist/analytics/analytics__fus-plugin.js +0 -20
- package/dist/analytics/analytics__ga-plugin.js +0 -13
- package/dist/analytics/analytics__plugin-utils.js +0 -8
- package/dist/analytics-ng/analytics-ng.js +3 -9
- package/dist/auth/auth.js +2 -3
- package/dist/auth/auth__core.js +30 -243
- package/dist/auth/background-flow.js +2 -25
- package/dist/auth/down-notification.js +0 -7
- package/dist/auth/iframe-flow.js +2 -26
- package/dist/auth/landing.js +2 -6
- package/dist/auth/request-builder.js +0 -11
- package/dist/auth/response-parser.js +4 -26
- package/dist/auth/storage.js +4 -60
- package/dist/auth/token-validator.js +6 -42
- package/dist/auth/window-flow.js +2 -34
- package/dist/auth-dialog/auth-dialog.js +2 -12
- package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
- package/dist/auth-ng/auth-ng.js +6 -22
- package/dist/auth-ng/auth-ng.mock.js +0 -4
- package/dist/autofocus-ng/autofocus-ng.js +0 -5
- package/dist/avatar/avatar.js +4 -17
- package/dist/avatar/fallback-avatar.js +2 -9
- package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
- package/dist/badge/badge.js +0 -3
- package/dist/button/button.js +0 -8
- package/dist/button-group/button-group.js +0 -3
- package/dist/button-group/caption.js +0 -2
- package/dist/button-group-ng/button-group-ng.js +0 -4
- package/dist/button-ng/button-ng.js +3 -21
- package/dist/button-set/button-set.js +0 -3
- package/dist/button-set-ng/button-set-ng.js +0 -2
- package/dist/button-toolbar/button-toolbar.js +0 -3
- package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
- package/dist/caret/caret.js +2 -53
- package/dist/checkbox/checkbox.js +0 -12
- package/dist/code/code.js +3 -25
- package/dist/compiler-ng/compiler-ng.js +0 -5
- package/dist/confirm/confirm.js +0 -6
- package/dist/confirm-service/confirm-service.js +10 -8
- package/dist/content-layout/content-layout.js +0 -7
- package/dist/contenteditable/contenteditable.js +6 -13
- package/dist/data-list/data-list.js +4 -28
- package/dist/data-list/item.js +0 -15
- package/dist/data-list/selection.js +0 -27
- package/dist/date-picker/consts.js +0 -7
- package/dist/date-picker/date-input.js +0 -20
- package/dist/date-picker/date-picker.js +2 -36
- package/dist/date-picker/date-popup.js +18 -71
- package/dist/date-picker/day.js +0 -14
- package/dist/date-picker/month-names.js +0 -9
- package/dist/date-picker/month-slider.js +0 -10
- package/dist/date-picker/month.js +2 -4
- package/dist/date-picker/months.js +6 -13
- package/dist/date-picker/years.js +0 -14
- package/dist/dialog/dialog.js +0 -19
- package/dist/dialog-ng/dialog-ng.js +17 -105
- package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
- package/dist/dropdown/dropdown.js +2 -33
- package/dist/dropdown-menu/dropdown-menu.js +4 -8
- package/dist/editable-heading/editable-heading.d.ts +4 -2
- package/dist/editable-heading/editable-heading.js +7 -6
- package/dist/error-bubble/error-bubble.js +2 -4
- package/dist/error-message/error-message.js +0 -3
- package/dist/footer-ng/footer-ng.js +0 -13
- package/dist/form-ng/form-ng.js +1 -21
- package/dist/global/angular-component-factory.js +0 -10
- package/dist/global/compose.js +0 -1
- package/dist/global/composeRefs.js +0 -1
- package/dist/global/controls-height.js +0 -2
- package/dist/global/create-stateful-context.js +0 -5
- package/dist/global/data-tests.js +0 -4
- package/dist/global/dom.js +2 -11
- package/dist/global/focus-sensor-hoc.js +4 -33
- package/dist/global/fuzzy-highlight.js +2 -16
- package/dist/global/get-event-key.js +8 -17
- package/dist/global/get-uid.js +0 -2
- package/dist/global/linear-function.js +0 -2
- package/dist/global/listeners.js +0 -13
- package/dist/global/memoize.js +0 -2
- package/dist/global/normalize-indent.js +2 -5
- package/dist/global/react-dom-renderer.js +0 -8
- package/dist/global/react-render-adapter.js +0 -7
- package/dist/global/rerender-hoc.js +0 -7
- package/dist/global/ring-angular-component.js +0 -5
- package/dist/global/schedule-raf.js +0 -5
- package/dist/global/trivial-template-tag.js +2 -3
- package/dist/global/url.js +0 -27
- package/dist/grid/col.js +0 -4
- package/dist/grid/grid.js +0 -3
- package/dist/grid/row.js +0 -5
- package/dist/group/group.js +0 -3
- package/dist/header/header.js +0 -5
- package/dist/header/logo.js +0 -4
- package/dist/header/profile.js +0 -7
- package/dist/header/services.js +0 -11
- package/dist/header/smart-profile.js +4 -18
- package/dist/header/smart-services.js +0 -17
- package/dist/header/tray-icon.js +2 -3
- package/dist/header/tray.js +0 -3
- package/dist/heading/heading.js +0 -5
- package/dist/http/http.js +20 -65
- package/dist/http/http.mock.js +2 -14
- package/dist/hub-source/hub-source.js +0 -32
- package/dist/hub-source/hub-source__user.js +0 -1
- package/dist/hub-source/hub-source__users-groups.js +0 -12
- package/dist/icon/icon.js +0 -13
- package/dist/icon/icon__constants.js +0 -4
- package/dist/icon/icon__svg.js +0 -10
- package/dist/icon-ng/icon-ng.js +2 -7
- package/dist/input/input.js +0 -30
- package/dist/input-ng/input-ng.js +0 -17
- package/dist/island/adaptive-island-hoc.js +0 -7
- package/dist/island/content.js +0 -25
- package/dist/island/header.js +0 -7
- package/dist/island/island.js +0 -4
- package/dist/island-legacy/content-legacy.js +0 -2
- package/dist/island-legacy/header-legacy.js +0 -2
- package/dist/island-legacy/island-legacy.js +0 -2
- package/dist/island-ng/island-content-ng.js +0 -3
- package/dist/link/clickableLink.js +2 -10
- package/dist/link/link.js +2 -9
- package/dist/link-ng/link-ng.js +0 -2
- package/dist/list/consts.js +0 -4
- package/dist/list/list.js +6 -128
- package/dist/list/list__custom.js +0 -4
- package/dist/list/list__hint.js +0 -3
- package/dist/list/list__item.js +0 -8
- package/dist/list/list__link.js +2 -3
- package/dist/list/list__separator.js +0 -1
- package/dist/list/list__title.js +0 -1
- package/dist/list/list__users-groups-source.js +4 -17
- package/dist/loader/loader.js +0 -10
- package/dist/loader/loader__core.js +6 -70
- package/dist/loader-inline/loader-inline.js +0 -3
- package/dist/loader-ng/loader-ng.js +0 -7
- package/dist/loader-screen/loader-screen.js +0 -3
- package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
- package/dist/login-dialog/login-dialog.js +0 -15
- package/dist/login-dialog/service.js +2 -4
- package/dist/markdown/code.js +0 -2
- package/dist/markdown/heading.js +0 -1
- package/dist/markdown/link.js +0 -1
- package/dist/markdown/markdown.js +0 -2
- package/dist/message/message.js +0 -24
- package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
- package/dist/old-browsers-message/old-browsers-message.js +2 -21
- package/dist/old-browsers-message/white-list.js +2 -6
- package/dist/pager/pager.js +2 -39
- package/dist/panel/panel.js +0 -3
- package/dist/permissions/permissions.js +1 -43
- package/dist/permissions/permissions__cache.js +12 -63
- package/dist/permissions-ng/permissions-ng.js +11 -19
- package/dist/place-under-ng/place-under-ng.js +0 -19
- package/dist/popup/popup.consts.js +0 -11
- package/dist/popup/popup.js +6 -68
- package/dist/popup/position.js +8 -30
- package/dist/popup-menu/popup-menu.js +4 -13
- package/dist/progress-bar/progress-bar.js +0 -14
- package/dist/promised-click-ng/promised-click-ng.js +3 -22
- package/dist/query-assist/query-assist.js +17 -201
- package/dist/radio/radio.js +0 -6
- package/dist/radio/radio__item.js +0 -9
- package/dist/radio-ng/radio-ng.js +0 -4
- package/dist/save-field-ng/save-field-ng.js +1 -37
- package/dist/select/select.js +18 -208
- package/dist/select/select__popup.js +4 -76
- package/dist/select-ng/select-ng.js +18 -74
- package/dist/select-ng/select-ng__lazy.js +2 -17
- package/dist/select-ng/select-ng__options.js +3 -29
- package/dist/shortcuts/core.js +4 -56
- package/dist/shortcuts/shortcuts-hoc.js +0 -4
- package/dist/shortcuts/shortcuts.js +0 -10
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
- package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
- package/dist/sidebar-ng/sidebar-ng.js +2 -12
- package/dist/storage/storage.js +2 -5
- package/dist/storage/storage__fallback.js +2 -48
- package/dist/storage/storage__local.js +0 -23
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +0 -37
- package/dist/table/cell.js +0 -2
- package/dist/table/disable-hover-hoc.js +0 -9
- package/dist/table/header-cell.js +0 -8
- package/dist/table/header.js +0 -16
- package/dist/table/multitable.js +0 -23
- package/dist/table/row-with-focus-sensor.js +0 -12
- package/dist/table/row.js +0 -18
- package/dist/table/selection-adapter.js +0 -2
- package/dist/table/selection-shortcuts-hoc.js +8 -42
- package/dist/table/selection.js +0 -50
- package/dist/table/smart-table.js +0 -9
- package/dist/table/table.js +6 -37
- package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
- package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
- package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
- package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
- package/dist/tabs/collapsible-more.js +0 -5
- package/dist/tabs/collapsible-tab.js +0 -4
- package/dist/tabs/collapsible-tabs.js +8 -28
- package/dist/tabs/dumb-tabs.js +0 -8
- package/dist/tabs/smart-tabs.js +0 -6
- package/dist/tabs/tab-link.js +0 -1
- package/dist/tabs/tab.js +0 -2
- package/dist/tabs-ng/tabs-ng.js +13 -29
- package/dist/tag/tag.js +0 -24
- package/dist/tags-input/tags-input.js +0 -76
- package/dist/tags-list/tags-list.js +0 -6
- package/dist/template-ng/template-ng.js +0 -12
- package/dist/text/text.js +0 -3
- package/dist/theme-ng/theme-ng.js +0 -8
- package/dist/title-ng/title-ng.js +6 -17
- package/dist/toggle/toggle.js +0 -4
- package/dist/tooltip/tooltip.js +4 -35
- package/dist/tooltip-ng/tooltip-ng.js +2 -8
- package/dist/user-agreement/service.js +0 -62
- package/dist/user-agreement/user-agreement.js +0 -8
- package/dist/user-card/smart-user-card-tooltip.js +2 -8
- package/dist/user-card/tooltip.js +0 -3
- package/package.json +37 -37
package/dist/shortcuts/core.js
CHANGED
|
@@ -6,57 +6,43 @@ import 'sniffr';
|
|
|
6
6
|
class Shortcuts {
|
|
7
7
|
constructor() {
|
|
8
8
|
_defineProperty(this, "ALLOW_SHORTCUTS_SELECTOR", '.ring-js-shortcuts');
|
|
9
|
-
|
|
10
9
|
_defineProperty(this, "ROOT_SCOPE", {
|
|
11
10
|
scopeId: 'ROOT',
|
|
12
11
|
options: {}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
_defineProperty(this, "_scopes", {});
|
|
16
|
-
|
|
17
14
|
_defineProperty(this, "_scopeChain", []);
|
|
18
|
-
|
|
19
15
|
_defineProperty(this, "combokeys", new Combokeys(document.documentElement));
|
|
20
|
-
|
|
21
16
|
_defineProperty(this, "trigger", combo => this.combokeys.trigger(combo));
|
|
22
|
-
|
|
23
17
|
_defineProperty(this, "_dispatcher", (e, key) => {
|
|
24
18
|
let currentScope;
|
|
25
|
-
|
|
26
19
|
for (let i = this._scopeChain.length - 1; i >= 0; i--) {
|
|
27
20
|
const scopeInChain = this._scopeChain[i];
|
|
28
21
|
currentScope = this._scopes[scopeInChain.scopeId];
|
|
29
|
-
|
|
30
22
|
if (currentScope && key != null && currentScope[key]) {
|
|
31
|
-
const ret = currentScope[key](e, key, scopeInChain.scopeId);
|
|
32
|
-
|
|
23
|
+
const ret = currentScope[key](e, key, scopeInChain.scopeId);
|
|
24
|
+
// Fall down in chain when returning true
|
|
33
25
|
if (ret !== true) {
|
|
34
26
|
return ret;
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
if (scopeInChain.options.modal) {
|
|
39
30
|
return true;
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
return undefined;
|
|
44
34
|
});
|
|
45
|
-
|
|
46
35
|
_defineProperty(this, "_defaultFilter", (e, element, key) => {
|
|
47
36
|
// if the element or its parents have the class "ring-js-shortcuts" then no need to stop
|
|
48
37
|
if (element === document || !(element instanceof HTMLElement) || key == null || element.matches(this.ALLOW_SHORTCUTS_SELECTOR) || (element.dataset.enabledShortcuts != null ? element.dataset.enabledShortcuts.split(',').includes(key) : element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null)) {
|
|
49
38
|
return false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
}
|
|
40
|
+
// stop for input, select, and textarea
|
|
53
41
|
return element.matches('input,select,textarea') || element.contentEditable === 'true';
|
|
54
42
|
});
|
|
55
|
-
|
|
56
43
|
this.setFilter();
|
|
57
44
|
this.setScope();
|
|
58
45
|
}
|
|
59
|
-
|
|
60
46
|
/**
|
|
61
47
|
* Binds a handler to a shortcut
|
|
62
48
|
*
|
|
@@ -69,31 +55,24 @@ class Shortcuts {
|
|
|
69
55
|
if (!(params instanceof Object) || typeof params.handler !== 'function') {
|
|
70
56
|
throw new Error('Shortcut handler should exist');
|
|
71
57
|
}
|
|
72
|
-
|
|
73
58
|
if (!params.scope) {
|
|
74
59
|
params.scope = this.ROOT_SCOPE.scopeId;
|
|
75
60
|
}
|
|
76
|
-
|
|
77
61
|
if (Array.isArray(params.key)) {
|
|
78
62
|
for (let i = 0; i < params.key.length; i++) {
|
|
79
63
|
this.bind(Object.assign({}, params, {
|
|
80
64
|
key: params.key[i]
|
|
81
65
|
}));
|
|
82
66
|
}
|
|
83
|
-
|
|
84
67
|
return;
|
|
85
68
|
}
|
|
86
|
-
|
|
87
69
|
if (typeof params.key !== 'string') {
|
|
88
70
|
throw new Error('Shortcut key should exist');
|
|
89
71
|
}
|
|
90
|
-
|
|
91
72
|
let scope = this._scopes[params.scope];
|
|
92
|
-
|
|
93
73
|
if (!scope) {
|
|
94
74
|
scope = this._scopes[params.scope] = {};
|
|
95
75
|
}
|
|
96
|
-
|
|
97
76
|
scope[params.key] = params.handler;
|
|
98
77
|
this.combokeys.bind(params.key, this._dispatcher, this._getKeyboardEventType(params));
|
|
99
78
|
}
|
|
@@ -104,13 +83,10 @@ class Shortcuts {
|
|
|
104
83
|
* @options.scope {string} Scope (optional)
|
|
105
84
|
* @options.type {string} Event type, will be passed to Combokeys (optional)
|
|
106
85
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
86
|
bindMap(map, options) {
|
|
110
87
|
if (!(map instanceof Object)) {
|
|
111
88
|
throw new Error('Shortcuts map shouldn\'t be empty');
|
|
112
89
|
}
|
|
113
|
-
|
|
114
90
|
for (const key in map) {
|
|
115
91
|
if (map.hasOwnProperty(key)) {
|
|
116
92
|
this.bind(Object.assign({}, options || {}, {
|
|
@@ -120,15 +96,12 @@ class Shortcuts {
|
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
98
|
}
|
|
123
|
-
|
|
124
99
|
unbindScope(scope) {
|
|
125
100
|
this._scopes[scope] = null;
|
|
126
101
|
}
|
|
127
|
-
|
|
128
102
|
getScope() {
|
|
129
103
|
return this._scopeChain.slice(1);
|
|
130
104
|
}
|
|
131
|
-
|
|
132
105
|
hasScope(scopeId) {
|
|
133
106
|
return this.indexOfScope(scopeId) !== -1;
|
|
134
107
|
}
|
|
@@ -139,58 +112,44 @@ class Shortcuts {
|
|
|
139
112
|
* @param options.modal whether keys should fall through this scope or not.
|
|
140
113
|
* Useful for modals or overlays
|
|
141
114
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
115
|
pushScope(scopeId) {
|
|
145
116
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
146
|
-
|
|
147
117
|
if (scopeId) {
|
|
148
118
|
const position = this.indexOfScope(scopeId);
|
|
149
|
-
|
|
150
119
|
if (position !== -1) {
|
|
151
120
|
this._scopeChain.splice(position, 1);
|
|
152
121
|
}
|
|
153
|
-
|
|
154
122
|
this._scopeChain.push(this.wrapScope(scopeId, options));
|
|
155
123
|
}
|
|
156
124
|
}
|
|
157
|
-
|
|
158
125
|
popScope(scopeId) {
|
|
159
126
|
if (scopeId) {
|
|
160
127
|
const position = this.indexOfScope(scopeId);
|
|
161
|
-
|
|
162
128
|
if (position !== -1) {
|
|
163
129
|
return this._scopeChain.splice(position, this._scopeChain.length - 1);
|
|
164
130
|
}
|
|
165
131
|
}
|
|
166
|
-
|
|
167
132
|
return undefined;
|
|
168
133
|
}
|
|
169
|
-
|
|
170
134
|
spliceScope(scopeId) {
|
|
171
135
|
if (scopeId) {
|
|
172
136
|
const position = this.indexOfScope(scopeId);
|
|
173
|
-
|
|
174
137
|
if (position !== -1) {
|
|
175
138
|
this._scopeChain.splice(position, 1);
|
|
176
139
|
}
|
|
177
140
|
}
|
|
178
141
|
}
|
|
179
|
-
|
|
180
142
|
setScope(scope) {
|
|
181
143
|
if (scope) {
|
|
182
144
|
let scopeChain;
|
|
183
|
-
|
|
184
145
|
if (typeof scope === 'string' || !Array.isArray(scope) && typeof scope === 'object' && scope !== null) {
|
|
185
146
|
scopeChain = [scope];
|
|
186
147
|
} else {
|
|
187
148
|
scopeChain = scope;
|
|
188
149
|
}
|
|
189
|
-
|
|
190
150
|
if (!Array.isArray(scopeChain)) {
|
|
191
151
|
return;
|
|
192
152
|
}
|
|
193
|
-
|
|
194
153
|
const scopes = scopeChain.map(scopeItem => {
|
|
195
154
|
const isScopeId = typeof scopeItem === 'string';
|
|
196
155
|
return isScopeId ? this.wrapScope(scopeItem) : scopeItem;
|
|
@@ -200,7 +159,6 @@ class Shortcuts {
|
|
|
200
159
|
this._scopeChain = [this.ROOT_SCOPE];
|
|
201
160
|
}
|
|
202
161
|
}
|
|
203
|
-
|
|
204
162
|
wrapScope(scopeId) {
|
|
205
163
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
206
164
|
return {
|
|
@@ -208,44 +166,34 @@ class Shortcuts {
|
|
|
208
166
|
options
|
|
209
167
|
};
|
|
210
168
|
}
|
|
211
|
-
|
|
212
169
|
hasKey(key, scope) {
|
|
213
170
|
var _this$_scopes$scope;
|
|
214
|
-
|
|
215
171
|
return !!((_this$_scopes$scope = this._scopes[scope]) !== null && _this$_scopes$scope !== void 0 && _this$_scopes$scope[key]);
|
|
216
172
|
}
|
|
217
|
-
|
|
218
173
|
_getKeyboardEventType(params) {
|
|
219
174
|
if (!params.type && sniffr.os.name === 'windows') {
|
|
220
175
|
const isSystemShortcut = typeof params.key === 'string' && params.key.match(/ctrl/i) && params.key.match(/shift/i) && params.key.match(/[0-9]/);
|
|
221
176
|
/**
|
|
222
177
|
* Windows system shortcuts (ctrl+shift+[0-9] are caught by the OS on 'keydown', so let's use 'keyup'
|
|
223
178
|
*/
|
|
224
|
-
|
|
225
179
|
if (isSystemShortcut) {
|
|
226
180
|
return 'keyup';
|
|
227
181
|
}
|
|
228
182
|
}
|
|
229
|
-
|
|
230
183
|
return params.type;
|
|
231
184
|
}
|
|
232
|
-
|
|
233
185
|
setFilter(fn) {
|
|
234
186
|
this.combokeys.stopCallback = typeof fn === 'function' ? fn : this._defaultFilter;
|
|
235
187
|
}
|
|
236
|
-
|
|
237
188
|
indexOfScope(scopeId) {
|
|
238
189
|
return this._scopeChain.findIndex(scope => scope.scopeId === scopeId);
|
|
239
190
|
}
|
|
240
|
-
|
|
241
191
|
reset() {
|
|
242
192
|
this._scopes = {};
|
|
243
193
|
this.setScope();
|
|
244
194
|
this.combokeys.reset();
|
|
245
195
|
}
|
|
246
|
-
|
|
247
196
|
}
|
|
248
|
-
|
|
249
197
|
var shortcutsInstance = new Shortcuts();
|
|
250
198
|
|
|
251
199
|
export { shortcutsInstance as default };
|
|
@@ -10,14 +10,11 @@ import 'sniffr';
|
|
|
10
10
|
|
|
11
11
|
function shortcutsHOC(ComposedComponent) {
|
|
12
12
|
var _class;
|
|
13
|
-
|
|
14
13
|
return _class = class WithShortcuts extends React.Component {
|
|
15
14
|
constructor() {
|
|
16
15
|
super(...arguments);
|
|
17
|
-
|
|
18
16
|
_defineProperty(this, "_shortcutsScopeUid", getUID('rg-shortcuts-'));
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
render() {
|
|
22
19
|
const {
|
|
23
20
|
rgShortcutsOptions,
|
|
@@ -31,7 +28,6 @@ function shortcutsHOC(ComposedComponent) {
|
|
|
31
28
|
disabled: rgShortcutsOptions.disabled
|
|
32
29
|
}, /*#__PURE__*/React.createElement(ComposedComponent, props));
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
}, _defineProperty(_class, "propTypes", {
|
|
36
32
|
rgShortcutsOptions: PropTypes.object,
|
|
37
33
|
rgShortcutsMap: PropTypes.object
|
|
@@ -12,27 +12,22 @@ class Shortcuts extends PureComponent {
|
|
|
12
12
|
this.turnShorcutsOn();
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
componentDidUpdate(prevProps) {
|
|
17
16
|
const {
|
|
18
17
|
disabled
|
|
19
18
|
} = this.props;
|
|
20
|
-
|
|
21
19
|
if (!prevProps.disabled && disabled) {
|
|
22
20
|
this.turnShorcutsOff();
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
if (prevProps.disabled && !disabled) {
|
|
26
23
|
this.turnShorcutsOn();
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
componentWillUnmount() {
|
|
31
27
|
if (!this.props.disabled) {
|
|
32
28
|
this.turnShorcutsOff();
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
turnShorcutsOn() {
|
|
37
32
|
const {
|
|
38
33
|
map,
|
|
@@ -42,7 +37,6 @@ class Shortcuts extends PureComponent {
|
|
|
42
37
|
shortcutsInstance.bindMap(map, this.props);
|
|
43
38
|
shortcutsInstance.pushScope(scope, options);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
turnShorcutsOff() {
|
|
47
41
|
const {
|
|
48
42
|
scope
|
|
@@ -50,13 +44,10 @@ class Shortcuts extends PureComponent {
|
|
|
50
44
|
shortcutsInstance.unbindScope(scope);
|
|
51
45
|
shortcutsInstance.spliceScope(scope);
|
|
52
46
|
}
|
|
53
|
-
|
|
54
47
|
render() {
|
|
55
48
|
return this.props.children || null;
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
_defineProperty(Shortcuts, "propTypes", {
|
|
61
52
|
map: PropTypes.object.isRequired,
|
|
62
53
|
scope: PropTypes.string.isRequired,
|
|
@@ -64,7 +55,6 @@ _defineProperty(Shortcuts, "propTypes", {
|
|
|
64
55
|
disabled: PropTypes.bool,
|
|
65
56
|
children: PropTypes.node
|
|
66
57
|
});
|
|
67
|
-
|
|
68
58
|
_defineProperty(Shortcuts, "defaultProps", {
|
|
69
59
|
options: {}
|
|
70
60
|
});
|
|
@@ -36,9 +36,7 @@ import '../_helpers/input.js';
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
const angularModule = angular.module('Ring.shortcuts.hint-popup', [DialogNg, ShortcutsNg, IconNG, InputNg, RingTemplateNg]);
|
|
39
|
-
|
|
40
39
|
const getTitle = title => typeof title === 'function' ? title() : title;
|
|
41
|
-
|
|
42
40
|
class HintPopupService extends RingAngularComponent {
|
|
43
41
|
show() {
|
|
44
42
|
let popupConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -53,7 +51,6 @@ class HintPopupService extends RingAngularComponent {
|
|
|
53
51
|
modes.forEach(mode => {
|
|
54
52
|
mode.shortcuts.forEach(shortcut => {
|
|
55
53
|
shortcut.titles = shortcut.titles || [];
|
|
56
|
-
|
|
57
54
|
if (shortcut.title && !shortcut.titles.includes(shortcut.title)) {
|
|
58
55
|
shortcut.titles.push(shortcut.title);
|
|
59
56
|
}
|
|
@@ -69,38 +66,29 @@ class HintPopupService extends RingAngularComponent {
|
|
|
69
66
|
label: okButtonLabel,
|
|
70
67
|
default: true
|
|
71
68
|
}],
|
|
72
|
-
|
|
73
69
|
controller() {
|
|
74
70
|
// eslint-disable-next-line consistent-this
|
|
75
71
|
const ctrl = this;
|
|
76
72
|
ctrl.searchIcon = searchIcon;
|
|
77
73
|
ctrl.modes = modes;
|
|
78
74
|
ctrl.tailTemplate = popupConfig.tailTemplate;
|
|
79
|
-
|
|
80
75
|
ctrl.isArray = it => Array.isArray(it);
|
|
81
|
-
|
|
82
76
|
ctrl.searchText = '';
|
|
83
77
|
ctrl.searchPlaceholder = searchPlaceholder;
|
|
84
78
|
ctrl.getTitle = getTitle;
|
|
85
79
|
}
|
|
86
|
-
|
|
87
80
|
}, popupConfig));
|
|
88
81
|
}
|
|
89
|
-
|
|
90
82
|
}
|
|
91
|
-
|
|
92
83
|
_defineProperty(HintPopupService, "$inject", ['dialog', 'shortcuts']);
|
|
93
|
-
|
|
94
84
|
function shortcutKeySymbolFilter(shortcut) {
|
|
95
85
|
return getShortcutTitle(shortcut);
|
|
96
86
|
}
|
|
97
|
-
|
|
98
87
|
function shortcutSearchFilter(shortcuts) {
|
|
99
88
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
100
89
|
return (shortcuts || []).filter(shortcut => {
|
|
101
90
|
const key = shortcut.key.join ? shortcut.key.join(' ') : shortcut.key;
|
|
102
91
|
const keysPresentation = shortcutKeySymbolFilter(key);
|
|
103
|
-
|
|
104
92
|
if (!shortcut.titles.length) {
|
|
105
93
|
return false;
|
|
106
94
|
} else {
|
|
@@ -111,7 +99,6 @@ function shortcutSearchFilter(shortcuts) {
|
|
|
111
99
|
}
|
|
112
100
|
});
|
|
113
101
|
}
|
|
114
|
-
|
|
115
102
|
angularModule.service('rgShortcutsHintPopup', HintPopupService);
|
|
116
103
|
angularModule.filter('shortcutKeySymbol', () => shortcutKeySymbolFilter);
|
|
117
104
|
angularModule.filter('shortcutSearch', () => shortcutSearchFilter);
|
|
@@ -11,70 +11,58 @@ angularModule.provider('shortcuts', function provider() {
|
|
|
11
11
|
const modes = {};
|
|
12
12
|
const mainModes = {};
|
|
13
13
|
const reference = [];
|
|
14
|
-
|
|
15
14
|
function addMode(config) {
|
|
16
15
|
modes[config.id] = config.shortcuts;
|
|
17
16
|
mainModes[config.id] = !!config.main;
|
|
18
|
-
|
|
19
17
|
if (config.hasOwnProperty('title')) {
|
|
20
18
|
reference.push(config);
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
return this;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
this.mode = addMode;
|
|
27
23
|
this.$get = ["$rootScope", function get($rootScope) {
|
|
28
24
|
return {
|
|
29
25
|
addMode,
|
|
30
|
-
|
|
31
26
|
bind(name, handlers, scope) {
|
|
32
|
-
const mode = modes[name];
|
|
27
|
+
const mode = modes[name];
|
|
33
28
|
|
|
29
|
+
// Nothing to bind
|
|
34
30
|
if (typeof handlers !== 'object') {
|
|
35
31
|
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
32
|
+
}
|
|
38
33
|
|
|
34
|
+
// No declaration
|
|
39
35
|
if (!mode) {
|
|
40
36
|
throw new Error(`Shortcut mode ${name} is not declared`);
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
mode.forEach(key => {
|
|
44
39
|
if (!angular.isFunction(handlers[key.action])) {
|
|
45
40
|
return;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
shortcutsInstance.bind({
|
|
49
43
|
key: key.key,
|
|
50
44
|
scope: scope || name,
|
|
51
45
|
handler: function () {
|
|
52
46
|
// TODO Dirty hack ;(
|
|
53
47
|
const ret = handlers[key.action](...arguments);
|
|
54
|
-
|
|
55
48
|
if (!$rootScope.$$phase) {
|
|
56
49
|
// eslint-disable-line angular/no-private-call
|
|
57
50
|
$rootScope.$apply();
|
|
58
51
|
}
|
|
59
|
-
|
|
60
52
|
return ret;
|
|
61
53
|
}
|
|
62
54
|
});
|
|
63
55
|
});
|
|
64
56
|
},
|
|
65
|
-
|
|
66
57
|
triggerAction(mode, action) {
|
|
67
58
|
const actions = modes[mode];
|
|
68
|
-
|
|
69
59
|
for (let i = actions.length - 1; i >= 0; i--) {
|
|
70
60
|
if (actions[i].action === action) {
|
|
71
61
|
return shortcutsInstance.trigger(actions[i].key[0] || actions[i].key);
|
|
72
62
|
}
|
|
73
63
|
}
|
|
74
|
-
|
|
75
64
|
return undefined;
|
|
76
65
|
},
|
|
77
|
-
|
|
78
66
|
isMainMode: name => mainModes[name],
|
|
79
67
|
getRegisteredShortcuts: () => reference,
|
|
80
68
|
shortcuts: shortcutsInstance
|
|
@@ -87,68 +75,56 @@ angularModule.directive('rgShortcutsApp', function rgShortcutsAppDirective() {
|
|
|
87
75
|
controller: ["$scope", "$rootScope", "$attrs", "shortcuts", function controller($scope, $rootScope, $attrs, shortcuts) {
|
|
88
76
|
$scope.zones = [];
|
|
89
77
|
$scope.loop = 'shortcutsLoop' in $attrs;
|
|
90
|
-
|
|
91
78
|
function getNext(current, back) {
|
|
92
79
|
const position = current && $scope.zones.indexOf(current);
|
|
93
80
|
let next;
|
|
94
|
-
|
|
95
81
|
if (position >= 0) {
|
|
96
82
|
next = back ? $scope.zones[position - 1] : $scope.zones[position + 1];
|
|
97
83
|
}
|
|
98
|
-
|
|
99
84
|
if (!next && ($scope.loop || !current)) {
|
|
100
85
|
next = back ? $scope.zones[$scope.zones.length - 1] : $scope.zones[0];
|
|
101
86
|
}
|
|
102
|
-
|
|
103
87
|
if (!next) {
|
|
104
88
|
next = $scope.zones[0];
|
|
105
|
-
}
|
|
106
|
-
|
|
89
|
+
}
|
|
107
90
|
|
|
91
|
+
// Skip invisible zones
|
|
108
92
|
if (next && (!document.documentElement.contains(next.element) || getStyles(next.element).display === 'none')) {
|
|
109
93
|
next = getNext(next, back);
|
|
110
94
|
}
|
|
111
|
-
|
|
112
95
|
return next;
|
|
113
96
|
}
|
|
114
|
-
|
|
115
97
|
this.deselect = () => {
|
|
116
98
|
$scope.current.onBlur();
|
|
117
99
|
$scope.current = null;
|
|
118
100
|
};
|
|
119
|
-
|
|
120
101
|
this.getCurrent = () => $scope.current;
|
|
121
|
-
|
|
122
102
|
this.select = next => {
|
|
123
103
|
if ($scope.current === next) {
|
|
124
104
|
return;
|
|
125
105
|
}
|
|
126
|
-
|
|
127
106
|
if ($scope.current) {
|
|
128
107
|
shortcutsInstance.spliceScope($scope.current.scope);
|
|
129
108
|
this.deselect();
|
|
130
109
|
}
|
|
131
|
-
|
|
132
110
|
if (!next) {
|
|
133
111
|
return;
|
|
134
112
|
}
|
|
135
|
-
|
|
136
113
|
shortcutsInstance.pushScope(next.scope);
|
|
137
114
|
$scope.current = next;
|
|
138
115
|
};
|
|
139
|
-
|
|
140
116
|
this.route = (action, e, combo, mode) => {
|
|
141
|
-
let next;
|
|
117
|
+
let next;
|
|
142
118
|
|
|
119
|
+
// There is nowhere to navigate
|
|
143
120
|
if (!$scope.zones.length) {
|
|
144
121
|
return false;
|
|
145
|
-
}
|
|
146
|
-
|
|
122
|
+
}
|
|
147
123
|
|
|
124
|
+
// Reset current zone if it's not equal to the current scope
|
|
148
125
|
if ($scope.current && $scope.current.scope !== shortcutsInstance.getScope().pop().scopeId) {
|
|
149
126
|
this.deselect();
|
|
150
127
|
}
|
|
151
|
-
|
|
152
128
|
if (action === 'main') {
|
|
153
129
|
$scope.zones.forEach((zone, index) => {
|
|
154
130
|
if (shortcuts.isMainMode(zone.name)) {
|
|
@@ -157,23 +133,20 @@ angularModule.directive('rgShortcutsApp', function rgShortcutsAppDirective() {
|
|
|
157
133
|
});
|
|
158
134
|
} else {
|
|
159
135
|
next = getNext($scope.current, action === 'prev');
|
|
160
|
-
}
|
|
161
|
-
|
|
136
|
+
}
|
|
162
137
|
|
|
138
|
+
// Select next zone and trigger same combo there
|
|
163
139
|
if (next) {
|
|
164
140
|
this.select(next);
|
|
165
|
-
|
|
166
141
|
if (shortcutsInstance.hasKey(combo, next.scope)) {
|
|
167
142
|
shortcutsInstance.trigger(combo);
|
|
168
|
-
}
|
|
169
|
-
|
|
143
|
+
}
|
|
144
|
+
// Otherwise go back
|
|
170
145
|
} else {
|
|
171
146
|
shortcuts.triggerAction(mode, action === 'next' ? 'prev' : 'next');
|
|
172
147
|
}
|
|
173
|
-
|
|
174
148
|
return false;
|
|
175
149
|
};
|
|
176
|
-
|
|
177
150
|
this.sort = () => {
|
|
178
151
|
const orderedElements = Array.from(document.querySelectorAll('[rg-shortcuts]'));
|
|
179
152
|
$scope.zones.forEach(zone => {
|
|
@@ -181,24 +154,21 @@ angularModule.directive('rgShortcutsApp', function rgShortcutsAppDirective() {
|
|
|
181
154
|
});
|
|
182
155
|
$scope.zones.sort((a, b) => a.order - b.order);
|
|
183
156
|
};
|
|
184
|
-
|
|
185
157
|
this.setup = (zone, keys) => {
|
|
186
158
|
shortcuts.bind(zone.name, keys, zone.scope);
|
|
187
159
|
$scope.zones.push(zone);
|
|
188
160
|
this.sort();
|
|
189
161
|
};
|
|
190
|
-
|
|
191
162
|
this.destroy = zone => {
|
|
192
163
|
shortcutsInstance.spliceScope(zone.scope);
|
|
193
164
|
shortcutsInstance.unbindScope(zone.scope);
|
|
194
165
|
const position = $scope.zones.indexOf(zone);
|
|
195
|
-
|
|
196
166
|
if (position !== -1) {
|
|
197
167
|
$scope.zones.splice(position, 1);
|
|
198
168
|
}
|
|
199
|
-
};
|
|
200
|
-
|
|
169
|
+
};
|
|
201
170
|
|
|
171
|
+
// Initial setup
|
|
202
172
|
const keyMap = {
|
|
203
173
|
next: this.route.bind(this, 'next'),
|
|
204
174
|
prev: this.route.bind(this, 'prev'),
|
|
@@ -24,18 +24,17 @@ import 'react';
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
const angularModule = angular.module('Ring.sidebar', [PlaceUnder, IconNG, ButtonNG]);
|
|
27
|
-
|
|
28
27
|
class SidebarController extends RingAngularComponent {
|
|
29
28
|
constructor() {
|
|
30
29
|
super(...arguments);
|
|
31
|
-
|
|
32
30
|
this.$onInit = () => {
|
|
33
31
|
const {
|
|
34
32
|
$scope
|
|
35
33
|
} = this.$inject;
|
|
36
34
|
this.dialogIsActive = false;
|
|
37
|
-
this.showed = this.show;
|
|
35
|
+
this.showed = this.show;
|
|
38
36
|
|
|
37
|
+
// dialog has been opened — open sidebar
|
|
39
38
|
$scope.$watch(() => this.dialogIsActive, () => {
|
|
40
39
|
if (this.dialogIsActive) {
|
|
41
40
|
this.show = true;
|
|
@@ -50,13 +49,9 @@ class SidebarController extends RingAngularComponent {
|
|
|
50
49
|
});
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
|
|
54
52
|
}
|
|
55
|
-
|
|
56
53
|
SidebarController.$inject = [];
|
|
57
|
-
|
|
58
54
|
_defineProperty(SidebarController, "$inject", ['$scope']);
|
|
59
|
-
|
|
60
55
|
function rgSidebarDirective() {
|
|
61
56
|
return {
|
|
62
57
|
restrict: 'E',
|
|
@@ -64,7 +59,6 @@ function rgSidebarDirective() {
|
|
|
64
59
|
replace: true,
|
|
65
60
|
scope: {},
|
|
66
61
|
controller: SidebarController,
|
|
67
|
-
|
|
68
62
|
/**
|
|
69
63
|
* {{
|
|
70
64
|
* show: boolean,
|
|
@@ -82,19 +76,16 @@ function rgSidebarDirective() {
|
|
|
82
76
|
controllerAs: 'sidebar'
|
|
83
77
|
};
|
|
84
78
|
}
|
|
85
|
-
|
|
86
79
|
function rgSidebarToggleButtonDirective() {
|
|
87
80
|
return {
|
|
88
81
|
restrict: 'E',
|
|
89
82
|
transclude: true,
|
|
90
83
|
replace: true,
|
|
91
84
|
scope: {},
|
|
92
|
-
|
|
93
85
|
controller() {
|
|
94
86
|
this.chevronRight = chevronRightIcon;
|
|
95
87
|
this.chevronLeft = chevronLeftIcon;
|
|
96
88
|
},
|
|
97
|
-
|
|
98
89
|
bindToController: {
|
|
99
90
|
model: '=',
|
|
100
91
|
dialogIsActive: '=?'
|
|
@@ -103,7 +94,6 @@ function rgSidebarToggleButtonDirective() {
|
|
|
103
94
|
controllerAs: 'button'
|
|
104
95
|
};
|
|
105
96
|
}
|
|
106
|
-
|
|
107
97
|
angularModule.directive('rgSidebar', rgSidebarDirective);
|
|
108
98
|
angularModule.directive('rgSidebarToggleButton', rgSidebarToggleButtonDirective);
|
|
109
99
|
var sidebarNg = angularModule.name;
|
package/dist/storage/storage.js
CHANGED
|
@@ -47,15 +47,13 @@ import 'deep-equal';
|
|
|
47
47
|
/**
|
|
48
48
|
* @name Storage
|
|
49
49
|
*/
|
|
50
|
-
|
|
51
50
|
/**
|
|
52
51
|
* @constructor
|
|
53
52
|
* @extends {LocalStorage}
|
|
54
53
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
let Storage = LocalStorage;
|
|
55
|
+
// Using try/catch here because of IE10+ protected mode and other browsers' quirks
|
|
57
56
|
// See https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js
|
|
58
|
-
|
|
59
57
|
try {
|
|
60
58
|
const temp = 'testStorage';
|
|
61
59
|
localStorage.setItem(temp, temp);
|
|
@@ -63,7 +61,6 @@ try {
|
|
|
63
61
|
} catch (e) {
|
|
64
62
|
Storage = FallbackStorage;
|
|
65
63
|
}
|
|
66
|
-
|
|
67
64
|
const ActualStorage = Storage;
|
|
68
65
|
|
|
69
66
|
export { ActualStorage as default };
|