@jupyterlab/shortcuts-extension 4.0.0-alpha.2 → 4.0.0-alpha.20
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/lib/components/ShortcutInput.d.ts +78 -0
- package/lib/components/ShortcutInput.js +348 -0
- package/lib/components/ShortcutInput.js.map +1 -0
- package/lib/components/ShortcutItem.d.ts +62 -0
- package/lib/components/ShortcutItem.js +282 -0
- package/lib/components/ShortcutItem.js.map +1 -0
- package/lib/components/ShortcutList.d.ts +23 -0
- package/lib/components/ShortcutList.js +19 -0
- package/lib/components/ShortcutList.js.map +1 -0
- package/lib/components/ShortcutTitleItem.d.ts +9 -0
- package/lib/components/ShortcutTitleItem.js +16 -0
- package/lib/components/ShortcutTitleItem.js.map +1 -0
- package/lib/components/ShortcutUI.d.ts +56 -0
- package/lib/components/ShortcutUI.js +363 -0
- package/lib/components/ShortcutUI.js.map +1 -0
- package/lib/components/TopNav.d.ts +48 -0
- package/lib/components/TopNav.js +92 -0
- package/lib/components/TopNav.js.map +1 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +6 -0
- package/lib/components/index.js.map +1 -0
- package/lib/index.js +48 -5
- package/lib/index.js.map +1 -1
- package/lib/renderer.d.ts +4 -0
- package/lib/renderer.js +10 -0
- package/lib/renderer.js.map +1 -0
- package/package.json +34 -15
- package/src/components/ShortcutInput.tsx +501 -0
- package/src/components/ShortcutItem.tsx +491 -0
- package/src/components/ShortcutList.tsx +61 -0
- package/src/components/ShortcutTitleItem.tsx +33 -0
- package/src/components/ShortcutUI.tsx +512 -0
- package/src/components/TopNav.tsx +193 -0
- package/src/components/index.ts +7 -0
- package/src/index.ts +297 -0
- package/src/renderer.tsx +13 -0
- package/style/base.css +393 -0
- package/style/index.css +10 -0
- package/style/index.js +10 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
3
|
+
export interface IShortcutInputProps {
|
|
4
|
+
handleUpdate: Function;
|
|
5
|
+
deleteShortcut: Function;
|
|
6
|
+
toggleInput: Function;
|
|
7
|
+
shortcut: ShortcutObject;
|
|
8
|
+
shortcutId: string;
|
|
9
|
+
toSymbols: Function;
|
|
10
|
+
keyBindingsUsed: {
|
|
11
|
+
[index: string]: TakenByObject;
|
|
12
|
+
};
|
|
13
|
+
sortConflict: Function;
|
|
14
|
+
clearConflicts: Function;
|
|
15
|
+
displayInput: boolean;
|
|
16
|
+
newOrReplace: string;
|
|
17
|
+
placeholder: string;
|
|
18
|
+
translator: ITranslator;
|
|
19
|
+
}
|
|
20
|
+
export interface IShortcutInputState {
|
|
21
|
+
value: string;
|
|
22
|
+
userInput: string;
|
|
23
|
+
isAvailable: boolean;
|
|
24
|
+
isFunctional: boolean;
|
|
25
|
+
takenByObject: TakenByObject;
|
|
26
|
+
keys: Array<string>;
|
|
27
|
+
currentChain: string;
|
|
28
|
+
selected: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Object for shortcut items */
|
|
31
|
+
export declare class ShortcutObject {
|
|
32
|
+
commandName: string;
|
|
33
|
+
label: string;
|
|
34
|
+
keys: {
|
|
35
|
+
[index: string]: Array<string>;
|
|
36
|
+
};
|
|
37
|
+
source: string;
|
|
38
|
+
selector: string;
|
|
39
|
+
category: string;
|
|
40
|
+
id: string;
|
|
41
|
+
hasConflict: boolean;
|
|
42
|
+
numberOfShortcuts: number;
|
|
43
|
+
constructor();
|
|
44
|
+
get(sortCriteria: string): string;
|
|
45
|
+
}
|
|
46
|
+
/** Object for conflicting shortcut error messages */
|
|
47
|
+
export declare class ErrorObject extends ShortcutObject {
|
|
48
|
+
takenBy: TakenByObject;
|
|
49
|
+
constructor();
|
|
50
|
+
}
|
|
51
|
+
/** Object for showing which shortcut conflicts with the new one */
|
|
52
|
+
export declare class TakenByObject {
|
|
53
|
+
takenBy: ShortcutObject;
|
|
54
|
+
takenByKey: string;
|
|
55
|
+
takenByLabel: string;
|
|
56
|
+
id: string;
|
|
57
|
+
constructor(shortcut?: ShortcutObject);
|
|
58
|
+
}
|
|
59
|
+
export declare class ShortcutInput extends React.Component<IShortcutInputProps, IShortcutInputState> {
|
|
60
|
+
constructor(props: IShortcutInputProps);
|
|
61
|
+
handleUpdate: () => void;
|
|
62
|
+
handleOverwrite: () => Promise<void>;
|
|
63
|
+
handleReplace: () => Promise<void>;
|
|
64
|
+
/** Parse user input for chained shortcuts */
|
|
65
|
+
parseChaining: (event: React.KeyboardEvent, value: string, userInput: string, keys: Array<string>, currentChain: string) => Array<any>;
|
|
66
|
+
/**
|
|
67
|
+
* Check if shorcut being typed will work
|
|
68
|
+
* (does not end with ctrl, alt, command, or shift)
|
|
69
|
+
* */
|
|
70
|
+
checkNonFunctional: (shortcut: string) => boolean;
|
|
71
|
+
/** Check if shortcut being typed is already taken */
|
|
72
|
+
checkShortcutAvailability: (userInput: string, keys: string[], currentChain: string) => TakenByObject;
|
|
73
|
+
checkConflict(takenByObject: TakenByObject, keys: string): void;
|
|
74
|
+
/** Parse and normalize user input */
|
|
75
|
+
handleInput: (event: React.KeyboardEvent) => void;
|
|
76
|
+
handleBlur: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
77
|
+
render(): JSX.Element;
|
|
78
|
+
}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { EN_US } from '@lumino/keyboard';
|
|
7
|
+
import { checkIcon, errorIcon } from '@jupyterlab/ui-components';
|
|
8
|
+
/** Object for shortcut items */
|
|
9
|
+
export class ShortcutObject {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.commandName = '';
|
|
12
|
+
this.label = '';
|
|
13
|
+
this.keys = {};
|
|
14
|
+
this.source = '';
|
|
15
|
+
this.selector = '';
|
|
16
|
+
this.category = '';
|
|
17
|
+
this.id = '';
|
|
18
|
+
this.numberOfShortcuts = 0;
|
|
19
|
+
this.hasConflict = false;
|
|
20
|
+
}
|
|
21
|
+
get(sortCriteria) {
|
|
22
|
+
if (sortCriteria === 'label') {
|
|
23
|
+
return this.label;
|
|
24
|
+
}
|
|
25
|
+
else if (sortCriteria === 'selector') {
|
|
26
|
+
return this.selector;
|
|
27
|
+
}
|
|
28
|
+
else if (sortCriteria === 'category') {
|
|
29
|
+
return this.category;
|
|
30
|
+
}
|
|
31
|
+
else if (sortCriteria === 'source') {
|
|
32
|
+
return this.source;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Object for conflicting shortcut error messages */
|
|
40
|
+
export class ErrorObject extends ShortcutObject {
|
|
41
|
+
constructor() {
|
|
42
|
+
super();
|
|
43
|
+
this.takenBy = new TakenByObject();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Object for showing which shortcut conflicts with the new one */
|
|
47
|
+
export class TakenByObject {
|
|
48
|
+
constructor(shortcut) {
|
|
49
|
+
if (shortcut) {
|
|
50
|
+
this.takenBy = shortcut;
|
|
51
|
+
this.takenByKey = '';
|
|
52
|
+
this.takenByLabel = shortcut.category + ': ' + shortcut.label;
|
|
53
|
+
this.id = shortcut.commandName + '_' + shortcut.selector;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.takenBy = new ShortcutObject();
|
|
57
|
+
this.takenByKey = '';
|
|
58
|
+
this.takenByLabel = '';
|
|
59
|
+
this.id = '';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export class ShortcutInput extends React.Component {
|
|
64
|
+
constructor(props) {
|
|
65
|
+
super(props);
|
|
66
|
+
this.handleUpdate = () => {
|
|
67
|
+
let keys = this.state.keys;
|
|
68
|
+
keys.push(this.state.currentChain);
|
|
69
|
+
this.setState({ keys: keys });
|
|
70
|
+
this.props.handleUpdate(this.props.shortcut, this.state.keys);
|
|
71
|
+
};
|
|
72
|
+
this.handleOverwrite = async () => {
|
|
73
|
+
this.props
|
|
74
|
+
.deleteShortcut(this.state.takenByObject.takenBy, this.state.takenByObject.takenByKey)
|
|
75
|
+
.then(this.handleUpdate());
|
|
76
|
+
};
|
|
77
|
+
this.handleReplace = async () => {
|
|
78
|
+
let keys = this.state.keys;
|
|
79
|
+
keys.push(this.state.currentChain);
|
|
80
|
+
this.props.toggleInput();
|
|
81
|
+
await this.props.deleteShortcut(this.props.shortcut, this.props.shortcutId);
|
|
82
|
+
this.props.handleUpdate(this.props.shortcut, keys);
|
|
83
|
+
};
|
|
84
|
+
/** Parse user input for chained shortcuts */
|
|
85
|
+
this.parseChaining = (event, value, userInput, keys, currentChain) => {
|
|
86
|
+
let key = EN_US.keyForKeydownEvent(event.nativeEvent);
|
|
87
|
+
const modKeys = ['Shift', 'Control', 'Alt', 'Meta', 'Ctrl', 'Accel'];
|
|
88
|
+
if (event.key === 'Backspace') {
|
|
89
|
+
userInput = '';
|
|
90
|
+
value = '';
|
|
91
|
+
keys = [];
|
|
92
|
+
currentChain = '';
|
|
93
|
+
this.setState({
|
|
94
|
+
value: value,
|
|
95
|
+
userInput: userInput,
|
|
96
|
+
keys: keys,
|
|
97
|
+
currentChain: currentChain
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else if (event.key !== 'CapsLock') {
|
|
101
|
+
const lastKey = userInput
|
|
102
|
+
.substr(userInput.lastIndexOf(' ') + 1, userInput.length)
|
|
103
|
+
.trim();
|
|
104
|
+
/** if last key was not a modefier then there is a chain */
|
|
105
|
+
if (modKeys.lastIndexOf(lastKey) === -1 && lastKey != '') {
|
|
106
|
+
userInput = userInput + ',';
|
|
107
|
+
keys.push(currentChain);
|
|
108
|
+
currentChain = '';
|
|
109
|
+
/** check if a modefier key was held down through chain */
|
|
110
|
+
if (event.ctrlKey && event.key != 'Control') {
|
|
111
|
+
userInput = (userInput + ' Ctrl').trim();
|
|
112
|
+
currentChain = (currentChain + ' Ctrl').trim();
|
|
113
|
+
}
|
|
114
|
+
if (event.metaKey && event.key != 'Meta') {
|
|
115
|
+
userInput = (userInput + ' Accel').trim();
|
|
116
|
+
currentChain = (currentChain + ' Accel').trim();
|
|
117
|
+
}
|
|
118
|
+
if (event.altKey && event.key != 'Alt') {
|
|
119
|
+
userInput = (userInput + ' Alt').trim();
|
|
120
|
+
currentChain = (currentChain + ' Alt').trim();
|
|
121
|
+
}
|
|
122
|
+
if (event.shiftKey && event.key != 'Shift') {
|
|
123
|
+
userInput = (userInput + ' Shift').trim();
|
|
124
|
+
currentChain = (currentChain + ' Shift').trim();
|
|
125
|
+
}
|
|
126
|
+
/** if not a modefier key, add to user input and current chain */
|
|
127
|
+
if (modKeys.lastIndexOf(event.key) === -1) {
|
|
128
|
+
userInput = (userInput + ' ' + key).trim();
|
|
129
|
+
currentChain = (currentChain + ' ' + key).trim();
|
|
130
|
+
/** if a modefier key, add to user input and current chain */
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
if (event.key === 'Meta') {
|
|
134
|
+
userInput = (userInput + ' Accel').trim();
|
|
135
|
+
currentChain = (currentChain + ' Accel').trim();
|
|
136
|
+
}
|
|
137
|
+
else if (event.key === 'Control') {
|
|
138
|
+
userInput = (userInput + ' Ctrl').trim();
|
|
139
|
+
currentChain = (currentChain + ' Ctrl').trim();
|
|
140
|
+
}
|
|
141
|
+
else if (event.key === 'Shift') {
|
|
142
|
+
userInput = (userInput + ' Shift').trim();
|
|
143
|
+
currentChain = (currentChain + ' Shift').trim();
|
|
144
|
+
}
|
|
145
|
+
else if (event.key === 'Alt') {
|
|
146
|
+
userInput = (userInput + ' Alt').trim();
|
|
147
|
+
currentChain = (currentChain + ' Alt').trim();
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
userInput = (userInput + ' ' + event.key).trim();
|
|
151
|
+
currentChain = (currentChain + ' ' + event.key).trim();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** if not a chain, add the key to user input and current chain */
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
/** if modefier key, rename */
|
|
158
|
+
if (event.key === 'Control') {
|
|
159
|
+
userInput = (userInput + ' Ctrl').trim();
|
|
160
|
+
currentChain = (currentChain + ' Ctrl').trim();
|
|
161
|
+
}
|
|
162
|
+
else if (event.key === 'Meta') {
|
|
163
|
+
userInput = (userInput + ' Accel').trim();
|
|
164
|
+
currentChain = (currentChain + ' Accel').trim();
|
|
165
|
+
}
|
|
166
|
+
else if (event.key === 'Shift') {
|
|
167
|
+
userInput = (userInput + ' Shift').trim();
|
|
168
|
+
currentChain = (currentChain + ' Shift').trim();
|
|
169
|
+
}
|
|
170
|
+
else if (event.key === 'Alt') {
|
|
171
|
+
userInput = (userInput + ' Alt').trim();
|
|
172
|
+
currentChain = (currentChain + ' Alt').trim();
|
|
173
|
+
/** if not a modefier key, add it regularly */
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
userInput = (userInput + ' ' + key).trim();
|
|
177
|
+
currentChain = (currentChain + ' ' + key).trim();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** update state of keys and currentChain */
|
|
182
|
+
this.setState({
|
|
183
|
+
keys: keys,
|
|
184
|
+
currentChain: currentChain
|
|
185
|
+
});
|
|
186
|
+
return [userInput, keys, currentChain];
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Check if shorcut being typed will work
|
|
190
|
+
* (does not end with ctrl, alt, command, or shift)
|
|
191
|
+
* */
|
|
192
|
+
this.checkNonFunctional = (shortcut) => {
|
|
193
|
+
const dontEnd = ['Ctrl', 'Alt', 'Accel', 'Shift'];
|
|
194
|
+
const shortcutKeys = this.state.currentChain.split(' ');
|
|
195
|
+
const last = shortcutKeys[shortcutKeys.length - 1];
|
|
196
|
+
this.setState({
|
|
197
|
+
isFunctional: !(dontEnd.indexOf(last) !== -1)
|
|
198
|
+
});
|
|
199
|
+
return dontEnd.indexOf(last) !== -1;
|
|
200
|
+
};
|
|
201
|
+
/** Check if shortcut being typed is already taken */
|
|
202
|
+
this.checkShortcutAvailability = (userInput, keys, currentChain) => {
|
|
203
|
+
/** First, check whole shortcut */
|
|
204
|
+
let isAvailable = Object.keys(this.props.keyBindingsUsed).indexOf(keys.join(' ') + currentChain + '_' + this.props.shortcut.selector) === -1 || userInput === '';
|
|
205
|
+
let takenByObject = new TakenByObject();
|
|
206
|
+
if (isAvailable) {
|
|
207
|
+
/** Next, check each piece of a chain */
|
|
208
|
+
for (let binding of keys) {
|
|
209
|
+
if (Object.keys(this.props.keyBindingsUsed).indexOf(binding + '_' + this.props.shortcut.selector) !== -1 &&
|
|
210
|
+
binding !== '') {
|
|
211
|
+
isAvailable = false;
|
|
212
|
+
takenByObject =
|
|
213
|
+
this.props.keyBindingsUsed[binding + '_' + this.props.shortcut.selector];
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/** Check current chain */
|
|
218
|
+
if (isAvailable &&
|
|
219
|
+
Object.keys(this.props.keyBindingsUsed).indexOf(currentChain + '_' + this.props.shortcut.selector) !== -1 &&
|
|
220
|
+
currentChain !== '') {
|
|
221
|
+
isAvailable = false;
|
|
222
|
+
takenByObject =
|
|
223
|
+
this.props.keyBindingsUsed[currentChain + '_' + this.props.shortcut.selector];
|
|
224
|
+
}
|
|
225
|
+
/** If unavailable set takenByObject */
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
takenByObject =
|
|
229
|
+
this.props.keyBindingsUsed[keys.join(' ') + currentChain + '_' + this.props.shortcut.selector];
|
|
230
|
+
}
|
|
231
|
+
/** allow to set shortcut to what it initially was if replacing */
|
|
232
|
+
if (!isAvailable) {
|
|
233
|
+
if (takenByObject.takenBy.id === this.props.shortcut.id &&
|
|
234
|
+
this.props.newOrReplace === 'replace') {
|
|
235
|
+
isAvailable = true;
|
|
236
|
+
takenByObject = new TakenByObject();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
this.setState({ isAvailable: isAvailable });
|
|
240
|
+
return takenByObject;
|
|
241
|
+
};
|
|
242
|
+
/** Parse and normalize user input */
|
|
243
|
+
this.handleInput = (event) => {
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
this.setState({ selected: false });
|
|
246
|
+
const parsed = this.parseChaining(event, this.state.value, this.state.userInput, this.state.keys, this.state.currentChain);
|
|
247
|
+
const userInput = parsed[0];
|
|
248
|
+
const keys = parsed[1];
|
|
249
|
+
const currentChain = parsed[2];
|
|
250
|
+
const value = this.props.toSymbols(userInput);
|
|
251
|
+
let takenByObject = this.checkShortcutAvailability(userInput, keys, currentChain);
|
|
252
|
+
this.checkConflict(takenByObject, keys);
|
|
253
|
+
this.setState({
|
|
254
|
+
value: value,
|
|
255
|
+
userInput: userInput,
|
|
256
|
+
takenByObject: takenByObject,
|
|
257
|
+
keys: keys,
|
|
258
|
+
currentChain: currentChain
|
|
259
|
+
}, () => this.checkNonFunctional(this.state.userInput));
|
|
260
|
+
};
|
|
261
|
+
this.handleBlur = (event) => {
|
|
262
|
+
if (event.relatedTarget === null ||
|
|
263
|
+
(event.relatedTarget.id !== 'no-blur' &&
|
|
264
|
+
event.relatedTarget.id !== 'overwrite')) {
|
|
265
|
+
this.props.toggleInput();
|
|
266
|
+
this.setState({
|
|
267
|
+
value: '',
|
|
268
|
+
userInput: ''
|
|
269
|
+
});
|
|
270
|
+
this.props.clearConflicts();
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
this.state = {
|
|
274
|
+
value: this.props.placeholder,
|
|
275
|
+
userInput: '',
|
|
276
|
+
isAvailable: true,
|
|
277
|
+
isFunctional: this.props.newOrReplace === 'replace',
|
|
278
|
+
takenByObject: new TakenByObject(),
|
|
279
|
+
keys: new Array(),
|
|
280
|
+
currentChain: '',
|
|
281
|
+
selected: true
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
checkConflict(takenByObject, keys) {
|
|
285
|
+
if (takenByObject.id !== '' &&
|
|
286
|
+
takenByObject.takenBy.id !== this.props.shortcut.id) {
|
|
287
|
+
this.props.sortConflict(this.props.shortcut, takenByObject, takenByObject.takenByLabel, '');
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
this.props.clearConflicts();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
render() {
|
|
294
|
+
const trans = this.props.translator.load('jupyterlab');
|
|
295
|
+
let inputClassName = 'jp-Shortcuts-Input';
|
|
296
|
+
if (!this.state.isAvailable) {
|
|
297
|
+
inputClassName += ' jp-mod-unavailable-Input';
|
|
298
|
+
}
|
|
299
|
+
return (React.createElement("div", { className: this.props.displayInput
|
|
300
|
+
? this.props.newOrReplace === 'new'
|
|
301
|
+
? 'jp-Shortcuts-InputBox jp-Shortcuts-InputBoxNew'
|
|
302
|
+
: 'jp-Shortcuts-InputBox'
|
|
303
|
+
: 'jp-mod-hidden', onBlur: event => this.handleBlur(event) },
|
|
304
|
+
React.createElement("div", { tabIndex: 0, id: "no-blur", className: inputClassName, onKeyDown: this.handleInput, ref: input => input && input.focus() },
|
|
305
|
+
React.createElement("p", { className: this.state.selected && this.props.newOrReplace === 'replace'
|
|
306
|
+
? 'jp-Shortcuts-InputText jp-mod-selected-InputText'
|
|
307
|
+
: this.state.value === ''
|
|
308
|
+
? 'jp-Shortcuts-InputText jp-mod-waiting-InputText'
|
|
309
|
+
: 'jp-Shortcuts-InputText' }, this.state.value === ''
|
|
310
|
+
? trans.__('press keys')
|
|
311
|
+
: this.state.value)),
|
|
312
|
+
React.createElement("button", { className: !this.state.isFunctional
|
|
313
|
+
? 'jp-Shortcuts-Submit jp-mod-defunc-Submit'
|
|
314
|
+
: !this.state.isAvailable
|
|
315
|
+
? 'jp-Shortcuts-Submit jp-mod-conflict-Submit'
|
|
316
|
+
: 'jp-Shortcuts-Submit', id: 'no-blur', disabled: !this.state.isAvailable || !this.state.isFunctional, onClick: () => {
|
|
317
|
+
if (this.props.newOrReplace === 'new') {
|
|
318
|
+
this.handleUpdate();
|
|
319
|
+
this.setState({
|
|
320
|
+
value: '',
|
|
321
|
+
keys: [],
|
|
322
|
+
currentChain: ''
|
|
323
|
+
});
|
|
324
|
+
this.props.toggleInput();
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
/** don't replace if field has not been edited */
|
|
328
|
+
if (this.state.selected) {
|
|
329
|
+
this.props.toggleInput();
|
|
330
|
+
this.setState({
|
|
331
|
+
value: '',
|
|
332
|
+
userInput: ''
|
|
333
|
+
});
|
|
334
|
+
this.props.clearConflicts();
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
void this.handleReplace();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} }, this.state.isAvailable ? React.createElement(checkIcon.react, null) : React.createElement(errorIcon.react, null)),
|
|
341
|
+
!this.state.isAvailable && (React.createElement("button", { hidden: true, id: "overwrite", onClick: () => {
|
|
342
|
+
void this.handleOverwrite();
|
|
343
|
+
this.props.clearConflicts();
|
|
344
|
+
this.props.toggleInput();
|
|
345
|
+
} }, trans.__('Overwrite')))));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=ShortcutInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShortcutInput.js","sourceRoot":"","sources":["../../src/components/ShortcutInput.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA6BjE,gCAAgC;AAChC,MAAM,OAAO,cAAc;IAWzB;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,GA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B,CAAC,CAAC;wBACH,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;qBAC1B;yBAAM;wBACL,iDAAiD;wBACjD,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;4BACvB,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;4BACzB,IAAI,CAAC,QAAQ,CAAC;gCACZ,KAAK,EAAE,EAAE;gCACT,SAAS,EAAE,EAAE;6BACd,CAAC,CAAC;4BACH,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;yBAC7B;6BAAM;4BACL,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;yBAC3B;qBACF;gBACH,CAAC,IAEA,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAC,SAAS,CAAC,KAAK,OAAG,CAAC,CAAC,CAAC,oBAAC,SAAS,CAAC,KAAK,OAAG,CAC5D;YACR,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAC1B,gCACE,MAAM,QACN,EAAE,EAAC,WAAW,EACd,OAAO,EAAE,GAAG,EAAE;oBACZ,KAAK,IAAI,CAAC,eAAe,EAAE,CAAC;oBAC5B,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;oBAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC3B,CAAC,IAEA,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CACf,CACV,CACG,CACP,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ErrorObject, ShortcutObject, TakenByObject } from './ShortcutInput';
|
|
3
|
+
import { IShortcutUIexternal } from './TopNav';
|
|
4
|
+
/** Props for ShortcutItem component */
|
|
5
|
+
export interface IShortcutItemProps {
|
|
6
|
+
shortcut: ShortcutObject | ErrorObject;
|
|
7
|
+
handleUpdate: Function;
|
|
8
|
+
resetShortcut: Function;
|
|
9
|
+
deleteShortcut: Function;
|
|
10
|
+
showSelectors: boolean;
|
|
11
|
+
keyBindingsUsed: {
|
|
12
|
+
[index: string]: TakenByObject;
|
|
13
|
+
};
|
|
14
|
+
sortConflict: Function;
|
|
15
|
+
clearConflicts: Function;
|
|
16
|
+
contextMenu: Function;
|
|
17
|
+
external: IShortcutUIexternal;
|
|
18
|
+
}
|
|
19
|
+
/** State for ShortcutItem component */
|
|
20
|
+
export interface IShortcutItemState {
|
|
21
|
+
displayNewInput: boolean;
|
|
22
|
+
displayReplaceInputLeft: boolean;
|
|
23
|
+
displayReplaceInputRight: boolean;
|
|
24
|
+
numShortcuts: number;
|
|
25
|
+
}
|
|
26
|
+
declare enum ShortCutLocation {
|
|
27
|
+
Left = 0,
|
|
28
|
+
Right = 1
|
|
29
|
+
}
|
|
30
|
+
/** React component for each command shortcut item */
|
|
31
|
+
export declare class ShortcutItem extends React.Component<IShortcutItemProps, IShortcutItemState> {
|
|
32
|
+
constructor(props: IShortcutItemProps);
|
|
33
|
+
/** Toggle display state of input box */
|
|
34
|
+
private toggleInputNew;
|
|
35
|
+
private toggleInputReplaceLeft;
|
|
36
|
+
private toggleInputReplaceRight;
|
|
37
|
+
private addCommandIfNeeded;
|
|
38
|
+
private handleRightClick;
|
|
39
|
+
/** Transform special key names into unicode characters */
|
|
40
|
+
toSymbols: (value: string) => string;
|
|
41
|
+
getErrorRow(): JSX.Element;
|
|
42
|
+
getCategoryCell(): JSX.Element;
|
|
43
|
+
getLabelCell(): JSX.Element;
|
|
44
|
+
getResetShortCutLink(): JSX.Element;
|
|
45
|
+
getSourceCell(): JSX.Element;
|
|
46
|
+
getOptionalSelectorCell(): JSX.Element | null;
|
|
47
|
+
getClassNameForShortCuts(nonEmptyKeys: string[]): string;
|
|
48
|
+
getToggleInputReplaceMethod(location: ShortCutLocation): () => void;
|
|
49
|
+
getDisplayReplaceInput(location: ShortCutLocation): boolean;
|
|
50
|
+
getOrDiplayIfNeeded(nonEmptyKeys: string[]): JSX.Element;
|
|
51
|
+
getShortCutAsInput(key: string, location: ShortCutLocation): JSX.Element;
|
|
52
|
+
getShortCutForDisplayOnly(key: string): JSX.Element[];
|
|
53
|
+
isLocationBeingEdited(location: ShortCutLocation): boolean;
|
|
54
|
+
getLocationFromIndex(index: number): ShortCutLocation;
|
|
55
|
+
getDivForKey(index: number, key: string, nonEmptyKeys: string[]): JSX.Element;
|
|
56
|
+
getAddLink(): JSX.Element;
|
|
57
|
+
getInputBoxWhenToggled(): JSX.Element;
|
|
58
|
+
getShortCutsCell(nonEmptyKeys: string[]): JSX.Element;
|
|
59
|
+
render(): JSX.Element;
|
|
60
|
+
private _commands;
|
|
61
|
+
}
|
|
62
|
+
export {};
|