@bigbinary/neeto-commons-frontend 2.0.48 → 2.0.49
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/cypress-commands.d.ts +19 -6
- package/cypress-utils.cjs.js +105 -4
- package/cypress-utils.d.ts +25 -0
- package/cypress-utils.js +105 -4
- package/initializers.cjs.js +1 -0
- package/initializers.js +1 -0
- package/package.json +1 -1
- package/react-utils.cjs.js +53 -41
- package/react-utils.d.ts +5 -3
- package/react-utils.js +53 -41
package/cypress-commands.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare namespace Cypress {
|
|
2
2
|
interface Chainable {
|
|
3
|
-
clearAndType(selector:
|
|
4
|
-
clearAndTypeFast(selector:
|
|
5
|
-
clearByClickAndTypeFast(selector:
|
|
6
|
-
typeFast(selector:
|
|
7
|
-
typeAndEnter(selector:
|
|
8
|
-
verifyToastMessage(message:
|
|
3
|
+
clearAndType(selector: string, text: string): Void;
|
|
4
|
+
clearAndTypeFast(selector: string, text: string): Void;
|
|
5
|
+
clearByClickAndTypeFast(selector: string, text: string): Void;
|
|
6
|
+
typeFast(selector: string, text: string): Void;
|
|
7
|
+
typeAndEnter(selector: string, text: string): Void;
|
|
8
|
+
verifyToastMessage(message: string): Void;
|
|
9
9
|
continueOnAlert(
|
|
10
10
|
alias:
|
|
11
11
|
| string
|
|
@@ -53,5 +53,18 @@ declare namespace Cypress {
|
|
|
53
53
|
globalState(key: string): Void;
|
|
54
54
|
ifExist(selector: string, callback: Function): Void;
|
|
55
55
|
ifNotExist(selector: string, callback: Function): Void;
|
|
56
|
+
dragAndDrop(props: {
|
|
57
|
+
subject: string;
|
|
58
|
+
target: string;
|
|
59
|
+
dragIndex: number;
|
|
60
|
+
dropIndex: number
|
|
61
|
+
});
|
|
62
|
+
verifyPlaceholder(textInputSelector: string, value: string): Void;
|
|
63
|
+
enableOrDisableSwitch(switchButton: string, value: string): Void;
|
|
64
|
+
interceptNonVersionedApi(props: {
|
|
65
|
+
url: string;
|
|
66
|
+
alias: string;
|
|
67
|
+
times?: number; // maximum number of times to match
|
|
68
|
+
}): Cypress.Chainable<Cypress.InterceptionOptions>;
|
|
56
69
|
}
|
|
57
70
|
}
|
package/cypress-utils.cjs.js
CHANGED
|
@@ -172,7 +172,29 @@ var commonSelectors = {
|
|
|
172
172
|
toastCloseButton: ".neeto-ui-toastr__close-button",
|
|
173
173
|
windowAlert: "#alert-box",
|
|
174
174
|
body: "body",
|
|
175
|
-
toastIcon: ".Toastify__toast-icon"
|
|
175
|
+
toastIcon: ".Toastify__toast-icon",
|
|
176
|
+
paneModalCrossIcon: ".neeto-ui-pane__close",
|
|
177
|
+
inputField: dataCy("input-field"),
|
|
178
|
+
alertConfirmationText: dataCy("alert-confirmation-text"),
|
|
179
|
+
alertCancelButton: dataCy("alert-cancel-button"),
|
|
180
|
+
alertModalCrossIcon: ".neeto-ui-modal__close",
|
|
181
|
+
saveChangesButton: dataCy("save-changes-button"),
|
|
182
|
+
cancelButton: dataCy("cancel-button"),
|
|
183
|
+
inputFieldError: dataCy("nui-input-error"),
|
|
184
|
+
selectDropDownError: dataCy("nui-select-error"),
|
|
185
|
+
subTitleHeading: function subTitleHeading(index) {
|
|
186
|
+
return dataCy("menubar-subtitle-heading", ":eq(".concat(index, ")"));
|
|
187
|
+
},
|
|
188
|
+
noDataTitle: dataCy("no-data-title"),
|
|
189
|
+
noDataDescription: dataCy("no-data-description"),
|
|
190
|
+
backDrop: "[data-testid='backdrop']",
|
|
191
|
+
menuBarHeading: dataCy("menubar-heading"),
|
|
192
|
+
tabItem: function tabItem(index) {
|
|
193
|
+
return dataCy("tab-item", ":eq(".concat(index, ")"));
|
|
194
|
+
},
|
|
195
|
+
dropdownWrapper: function dropdownWrapper(index) {
|
|
196
|
+
return dataCy("nui-select-container-wrapper", ":eq(".concat(index, ")"));
|
|
197
|
+
}
|
|
176
198
|
};
|
|
177
199
|
var tableSelectors = {
|
|
178
200
|
nthColumn: function nthColumn(n) {
|
|
@@ -181,7 +203,10 @@ var tableSelectors = {
|
|
|
181
203
|
tableBody: ".ant-table-body",
|
|
182
204
|
tableHeader: ".ant-table-thead th",
|
|
183
205
|
tableRow: ".ant-table-tbody tr",
|
|
184
|
-
spinner: ".ant-spin"
|
|
206
|
+
spinner: ".ant-spin",
|
|
207
|
+
nthHeading: function nthHeading(n) {
|
|
208
|
+
return "tr > th:nth-child(".concat(n, ")");
|
|
209
|
+
}
|
|
185
210
|
};
|
|
186
211
|
var profileSelectors = {
|
|
187
212
|
tab: dataCy("profile-section"),
|
|
@@ -203,7 +228,15 @@ var commonTexts = {
|
|
|
203
228
|
"new": "New",
|
|
204
229
|
takeAction: "Take action",
|
|
205
230
|
unblock: "Unblock",
|
|
206
|
-
toastIcon: "👍"
|
|
231
|
+
toastIcon: "👍",
|
|
232
|
+
emailRequiredError: "Email is required.",
|
|
233
|
+
emailTakenMessage: "Email is already taken",
|
|
234
|
+
nameTakenMessage: "Name has already been taken",
|
|
235
|
+
all: "All",
|
|
236
|
+
proceed: "Proceed",
|
|
237
|
+
settings: "Settings",
|
|
238
|
+
unsavedChangesAlertTitle: "You have unsaved changes!",
|
|
239
|
+
unsavedChangesAlertMessage: "Are you sure you want to continue? All of your unsaved changes will be lost."
|
|
207
240
|
};
|
|
208
241
|
|
|
209
242
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -277,7 +310,9 @@ var initCustomCommands = function initCustomCommands() {
|
|
|
277
310
|
Cypress.Commands.add("apiRequest", function (options) {
|
|
278
311
|
return cy.get("@requestHeaders").then(function (requestHeaders) {
|
|
279
312
|
return requestHeaders ? cy.request(_objectSpread(_objectSpread({}, options), {}, {
|
|
280
|
-
headers: requestHeaders
|
|
313
|
+
headers: _objectSpread(_objectSpread({}, requestHeaders), {}, {
|
|
314
|
+
"accept-encoding": "gzip"
|
|
315
|
+
})
|
|
281
316
|
})) : cy.log("No request headers found");
|
|
282
317
|
});
|
|
283
318
|
});
|
|
@@ -333,6 +368,72 @@ var initCustomCommands = function initCustomCommands() {
|
|
|
333
368
|
if (!$body.find(selector).length) callback();
|
|
334
369
|
});
|
|
335
370
|
});
|
|
371
|
+
Cypress.Commands.add("dragAndDrop", function (_ref2) {
|
|
372
|
+
var subject = _ref2.subject,
|
|
373
|
+
target = _ref2.target,
|
|
374
|
+
_ref2$dragIndex = _ref2.dragIndex,
|
|
375
|
+
dragIndex = _ref2$dragIndex === void 0 ? 0 : _ref2$dragIndex,
|
|
376
|
+
_ref2$dropIndex = _ref2.dropIndex,
|
|
377
|
+
dropIndex = _ref2$dropIndex === void 0 ? 0 : _ref2$dropIndex;
|
|
378
|
+
cy.get(subject).should("be.visible", {
|
|
379
|
+
timeout: 20000
|
|
380
|
+
});
|
|
381
|
+
Cypress.log({
|
|
382
|
+
name: "DRAGNDROP",
|
|
383
|
+
message: "Dragging element ".concat(subject, " to ").concat(target),
|
|
384
|
+
consoleProps: function consoleProps() {
|
|
385
|
+
return {
|
|
386
|
+
subject: subject,
|
|
387
|
+
target: target
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
cy.get(target).eq(dropIndex).then(function ($target) {
|
|
392
|
+
var coordsDrop = $target[0].getBoundingClientRect();
|
|
393
|
+
cy.get(subject).eq(dragIndex).then(function (subject) {
|
|
394
|
+
var coordsDrag = subject[0].getBoundingClientRect();
|
|
395
|
+
cy.wrap(subject).trigger("mousedown", {
|
|
396
|
+
button: 0,
|
|
397
|
+
// BUTTON_INDEX
|
|
398
|
+
clientX: coordsDrag.x,
|
|
399
|
+
clientY: coordsDrag.y,
|
|
400
|
+
force: true
|
|
401
|
+
}).trigger("mousemove", {
|
|
402
|
+
button: 0,
|
|
403
|
+
// BUTTON_INDEX
|
|
404
|
+
clientX: coordsDrag.x + 10,
|
|
405
|
+
// SLOPPY_CLICK_THRESHOLD
|
|
406
|
+
clientY: coordsDrag.y,
|
|
407
|
+
force: true
|
|
408
|
+
});
|
|
409
|
+
cy.get("body").trigger("mousemove", {
|
|
410
|
+
button: 0,
|
|
411
|
+
// BUTTON_INDEX
|
|
412
|
+
clientX: coordsDrop.x,
|
|
413
|
+
clientY: coordsDrop.y,
|
|
414
|
+
force: true
|
|
415
|
+
}).trigger("mouseup");
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
Cypress.Commands.add("verifyPlaceholder", function (textInputSelector, value) {
|
|
420
|
+
cy.get(textInputSelector).should("have.attr", "placeholder").and("eq", value);
|
|
421
|
+
});
|
|
422
|
+
Cypress.Commands.add("enableOrDisableSwitch", function (switchButton, value) {
|
|
423
|
+
cy.get(switchButton).invoke("click");
|
|
424
|
+
cy.get(switchButton).should("have.prop", "value").and("eq", value);
|
|
425
|
+
});
|
|
426
|
+
Cypress.Commands.add("interceptNonVersionedApi", function (_ref3) {
|
|
427
|
+
var _ref3$url = _ref3.url,
|
|
428
|
+
url = _ref3$url === void 0 ? "*" : _ref3$url,
|
|
429
|
+
alias = _ref3.alias,
|
|
430
|
+
_ref3$times = _ref3.times,
|
|
431
|
+
times = _ref3$times === void 0 ? 1 : _ref3$times;
|
|
432
|
+
cy.intercept({
|
|
433
|
+
url: url,
|
|
434
|
+
times: times
|
|
435
|
+
}).as(alias);
|
|
436
|
+
});
|
|
336
437
|
};
|
|
337
438
|
|
|
338
439
|
var loginSelectors = {
|
package/cypress-utils.d.ts
CHANGED
|
@@ -15,6 +15,22 @@ type CommonSelectors = {
|
|
|
15
15
|
toastCloseButton: string;
|
|
16
16
|
windowAlert: string;
|
|
17
17
|
body: string;
|
|
18
|
+
paneModalCrossIcon: string;
|
|
19
|
+
inputField: string;
|
|
20
|
+
alertConfirmationText: string;
|
|
21
|
+
alertCancelButton: string;
|
|
22
|
+
alertModalCrossIcon: string;
|
|
23
|
+
saveChangesButton: string;
|
|
24
|
+
cancelButton: string;
|
|
25
|
+
inputFieldError: string;
|
|
26
|
+
selectDropDownError: string;
|
|
27
|
+
subTitleHeading: (index: string) => string;
|
|
28
|
+
noDataTitle: string;
|
|
29
|
+
noDataDescription: string;
|
|
30
|
+
backDrop: string;
|
|
31
|
+
menuBarHeading: string;
|
|
32
|
+
tabItem: (index: string) => string;
|
|
33
|
+
dropdownWrapper: (index: string) => string;
|
|
18
34
|
};
|
|
19
35
|
|
|
20
36
|
type MemberSelectors = {
|
|
@@ -82,6 +98,15 @@ type CommonTexts = {
|
|
|
82
98
|
new: string;
|
|
83
99
|
takeAction: string;
|
|
84
100
|
unblock: string;
|
|
101
|
+
emailRequiredError: string;
|
|
102
|
+
emailTakenMessage: string;
|
|
103
|
+
nameTakenMessage: string;
|
|
104
|
+
all: string;
|
|
105
|
+
proceed: string;
|
|
106
|
+
settings: string;
|
|
107
|
+
unsavedChangesAlertTitle: string;
|
|
108
|
+
unsavedChangesAlertMessage: string;
|
|
109
|
+
unsavedChangesAlertTitle: string;
|
|
85
110
|
};
|
|
86
111
|
|
|
87
112
|
type MemberText = {
|
package/cypress-utils.js
CHANGED
|
@@ -164,7 +164,29 @@ var commonSelectors = {
|
|
|
164
164
|
toastCloseButton: ".neeto-ui-toastr__close-button",
|
|
165
165
|
windowAlert: "#alert-box",
|
|
166
166
|
body: "body",
|
|
167
|
-
toastIcon: ".Toastify__toast-icon"
|
|
167
|
+
toastIcon: ".Toastify__toast-icon",
|
|
168
|
+
paneModalCrossIcon: ".neeto-ui-pane__close",
|
|
169
|
+
inputField: dataCy("input-field"),
|
|
170
|
+
alertConfirmationText: dataCy("alert-confirmation-text"),
|
|
171
|
+
alertCancelButton: dataCy("alert-cancel-button"),
|
|
172
|
+
alertModalCrossIcon: ".neeto-ui-modal__close",
|
|
173
|
+
saveChangesButton: dataCy("save-changes-button"),
|
|
174
|
+
cancelButton: dataCy("cancel-button"),
|
|
175
|
+
inputFieldError: dataCy("nui-input-error"),
|
|
176
|
+
selectDropDownError: dataCy("nui-select-error"),
|
|
177
|
+
subTitleHeading: function subTitleHeading(index) {
|
|
178
|
+
return dataCy("menubar-subtitle-heading", ":eq(".concat(index, ")"));
|
|
179
|
+
},
|
|
180
|
+
noDataTitle: dataCy("no-data-title"),
|
|
181
|
+
noDataDescription: dataCy("no-data-description"),
|
|
182
|
+
backDrop: "[data-testid='backdrop']",
|
|
183
|
+
menuBarHeading: dataCy("menubar-heading"),
|
|
184
|
+
tabItem: function tabItem(index) {
|
|
185
|
+
return dataCy("tab-item", ":eq(".concat(index, ")"));
|
|
186
|
+
},
|
|
187
|
+
dropdownWrapper: function dropdownWrapper(index) {
|
|
188
|
+
return dataCy("nui-select-container-wrapper", ":eq(".concat(index, ")"));
|
|
189
|
+
}
|
|
168
190
|
};
|
|
169
191
|
var tableSelectors = {
|
|
170
192
|
nthColumn: function nthColumn(n) {
|
|
@@ -173,7 +195,10 @@ var tableSelectors = {
|
|
|
173
195
|
tableBody: ".ant-table-body",
|
|
174
196
|
tableHeader: ".ant-table-thead th",
|
|
175
197
|
tableRow: ".ant-table-tbody tr",
|
|
176
|
-
spinner: ".ant-spin"
|
|
198
|
+
spinner: ".ant-spin",
|
|
199
|
+
nthHeading: function nthHeading(n) {
|
|
200
|
+
return "tr > th:nth-child(".concat(n, ")");
|
|
201
|
+
}
|
|
177
202
|
};
|
|
178
203
|
var profileSelectors = {
|
|
179
204
|
tab: dataCy("profile-section"),
|
|
@@ -195,7 +220,15 @@ var commonTexts = {
|
|
|
195
220
|
"new": "New",
|
|
196
221
|
takeAction: "Take action",
|
|
197
222
|
unblock: "Unblock",
|
|
198
|
-
toastIcon: "👍"
|
|
223
|
+
toastIcon: "👍",
|
|
224
|
+
emailRequiredError: "Email is required.",
|
|
225
|
+
emailTakenMessage: "Email is already taken",
|
|
226
|
+
nameTakenMessage: "Name has already been taken",
|
|
227
|
+
all: "All",
|
|
228
|
+
proceed: "Proceed",
|
|
229
|
+
settings: "Settings",
|
|
230
|
+
unsavedChangesAlertTitle: "You have unsaved changes!",
|
|
231
|
+
unsavedChangesAlertMessage: "Are you sure you want to continue? All of your unsaved changes will be lost."
|
|
199
232
|
};
|
|
200
233
|
|
|
201
234
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -269,7 +302,9 @@ var initCustomCommands = function initCustomCommands() {
|
|
|
269
302
|
Cypress.Commands.add("apiRequest", function (options) {
|
|
270
303
|
return cy.get("@requestHeaders").then(function (requestHeaders) {
|
|
271
304
|
return requestHeaders ? cy.request(_objectSpread(_objectSpread({}, options), {}, {
|
|
272
|
-
headers: requestHeaders
|
|
305
|
+
headers: _objectSpread(_objectSpread({}, requestHeaders), {}, {
|
|
306
|
+
"accept-encoding": "gzip"
|
|
307
|
+
})
|
|
273
308
|
})) : cy.log("No request headers found");
|
|
274
309
|
});
|
|
275
310
|
});
|
|
@@ -325,6 +360,72 @@ var initCustomCommands = function initCustomCommands() {
|
|
|
325
360
|
if (!$body.find(selector).length) callback();
|
|
326
361
|
});
|
|
327
362
|
});
|
|
363
|
+
Cypress.Commands.add("dragAndDrop", function (_ref2) {
|
|
364
|
+
var subject = _ref2.subject,
|
|
365
|
+
target = _ref2.target,
|
|
366
|
+
_ref2$dragIndex = _ref2.dragIndex,
|
|
367
|
+
dragIndex = _ref2$dragIndex === void 0 ? 0 : _ref2$dragIndex,
|
|
368
|
+
_ref2$dropIndex = _ref2.dropIndex,
|
|
369
|
+
dropIndex = _ref2$dropIndex === void 0 ? 0 : _ref2$dropIndex;
|
|
370
|
+
cy.get(subject).should("be.visible", {
|
|
371
|
+
timeout: 20000
|
|
372
|
+
});
|
|
373
|
+
Cypress.log({
|
|
374
|
+
name: "DRAGNDROP",
|
|
375
|
+
message: "Dragging element ".concat(subject, " to ").concat(target),
|
|
376
|
+
consoleProps: function consoleProps() {
|
|
377
|
+
return {
|
|
378
|
+
subject: subject,
|
|
379
|
+
target: target
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
cy.get(target).eq(dropIndex).then(function ($target) {
|
|
384
|
+
var coordsDrop = $target[0].getBoundingClientRect();
|
|
385
|
+
cy.get(subject).eq(dragIndex).then(function (subject) {
|
|
386
|
+
var coordsDrag = subject[0].getBoundingClientRect();
|
|
387
|
+
cy.wrap(subject).trigger("mousedown", {
|
|
388
|
+
button: 0,
|
|
389
|
+
// BUTTON_INDEX
|
|
390
|
+
clientX: coordsDrag.x,
|
|
391
|
+
clientY: coordsDrag.y,
|
|
392
|
+
force: true
|
|
393
|
+
}).trigger("mousemove", {
|
|
394
|
+
button: 0,
|
|
395
|
+
// BUTTON_INDEX
|
|
396
|
+
clientX: coordsDrag.x + 10,
|
|
397
|
+
// SLOPPY_CLICK_THRESHOLD
|
|
398
|
+
clientY: coordsDrag.y,
|
|
399
|
+
force: true
|
|
400
|
+
});
|
|
401
|
+
cy.get("body").trigger("mousemove", {
|
|
402
|
+
button: 0,
|
|
403
|
+
// BUTTON_INDEX
|
|
404
|
+
clientX: coordsDrop.x,
|
|
405
|
+
clientY: coordsDrop.y,
|
|
406
|
+
force: true
|
|
407
|
+
}).trigger("mouseup");
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
Cypress.Commands.add("verifyPlaceholder", function (textInputSelector, value) {
|
|
412
|
+
cy.get(textInputSelector).should("have.attr", "placeholder").and("eq", value);
|
|
413
|
+
});
|
|
414
|
+
Cypress.Commands.add("enableOrDisableSwitch", function (switchButton, value) {
|
|
415
|
+
cy.get(switchButton).invoke("click");
|
|
416
|
+
cy.get(switchButton).should("have.prop", "value").and("eq", value);
|
|
417
|
+
});
|
|
418
|
+
Cypress.Commands.add("interceptNonVersionedApi", function (_ref3) {
|
|
419
|
+
var _ref3$url = _ref3.url,
|
|
420
|
+
url = _ref3$url === void 0 ? "*" : _ref3$url,
|
|
421
|
+
alias = _ref3.alias,
|
|
422
|
+
_ref3$times = _ref3.times,
|
|
423
|
+
times = _ref3$times === void 0 ? 1 : _ref3$times;
|
|
424
|
+
cy.intercept({
|
|
425
|
+
url: url,
|
|
426
|
+
times: times
|
|
427
|
+
}).as(alias);
|
|
428
|
+
});
|
|
328
429
|
};
|
|
329
430
|
|
|
330
431
|
var loginSelectors = {
|
package/initializers.cjs.js
CHANGED
|
@@ -581,6 +581,7 @@ var neetoCommons = {
|
|
|
581
581
|
},
|
|
582
582
|
keyboardShortcuts: {
|
|
583
583
|
title: "Keyboard shortcuts",
|
|
584
|
+
viewFullListOfShortcuts: "View full list of shortcuts",
|
|
584
585
|
global: {
|
|
585
586
|
categoryName: "GLOBAL",
|
|
586
587
|
openKeyboardShortcutsPane: "Open the keyboard shortcuts pane",
|
package/initializers.js
CHANGED
|
@@ -571,6 +571,7 @@ var neetoCommons = {
|
|
|
571
571
|
},
|
|
572
572
|
keyboardShortcuts: {
|
|
573
573
|
title: "Keyboard shortcuts",
|
|
574
|
+
viewFullListOfShortcuts: "View full list of shortcuts",
|
|
574
575
|
global: {
|
|
575
576
|
categoryName: "GLOBAL",
|
|
576
577
|
openKeyboardShortcutsPane: "Open the keyboard shortcuts pane",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.49",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/react-utils.cjs.js
CHANGED
|
@@ -40467,37 +40467,13 @@ var IpRestriction = function IpRestriction() {
|
|
|
40467
40467
|
}, /*#__PURE__*/React__default["default"].createElement(CurrentIp, null), /*#__PURE__*/React__default["default"].createElement(AllowedIpRanges, null)));
|
|
40468
40468
|
};
|
|
40469
40469
|
|
|
40470
|
-
var DisplayHotKey = function DisplayHotKey(_ref) {
|
|
40471
|
-
var hotkey = _ref.hotkey;
|
|
40472
|
-
var isSequentialHotkey = hotkey.includes(" ");
|
|
40473
|
-
var isSimultaneousHotkey = hotkey.includes("+");
|
|
40474
|
-
var isSingleKeyHotkey = !isSequentialHotkey && !isSimultaneousHotkey;
|
|
40475
|
-
var sequences = [];
|
|
40476
|
-
if (isSingleKeyHotkey) return /*#__PURE__*/React__default["default"].createElement(neetoui.Kbd, {
|
|
40477
|
-
keyName: hotkey
|
|
40478
|
-
});
|
|
40479
|
-
if (isSequentialHotkey) {
|
|
40480
|
-
sequences = hotkey.split(" ");
|
|
40481
|
-
} else if (isSimultaneousHotkey) {
|
|
40482
|
-
sequences = hotkey.split("+");
|
|
40483
|
-
}
|
|
40484
|
-
return sequences.map(function (keyName, idx) {
|
|
40485
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
40486
|
-
key: idx
|
|
40487
|
-
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Kbd, {
|
|
40488
|
-
keyName: keyName
|
|
40489
|
-
}), isSequentialHotkey && idx + 1 !== sequences.length && /*#__PURE__*/React__default["default"].createElement(neetoui.Kbd, {
|
|
40490
|
-
keyName: "then"
|
|
40491
|
-
}));
|
|
40492
|
-
});
|
|
40493
|
-
};
|
|
40494
|
-
|
|
40495
40470
|
var KEY_SHORTFORM_MAP = {
|
|
40496
40471
|
command: "cmd",
|
|
40497
40472
|
escape: "esc",
|
|
40498
40473
|
control: "ctrl",
|
|
40499
40474
|
option: "opt"
|
|
40500
40475
|
};
|
|
40476
|
+
var FULL_SHORTCUTS_LINK_PROP_NAME = "fullShortcutsLink";
|
|
40501
40477
|
|
|
40502
40478
|
var shortenHotKey = function shortenHotKey(hotkey) {
|
|
40503
40479
|
var result = hotkey;
|
|
@@ -40522,35 +40498,71 @@ var getGlobalShortcuts = function getGlobalShortcuts() {
|
|
|
40522
40498
|
});
|
|
40523
40499
|
};
|
|
40524
40500
|
|
|
40501
|
+
var HotKey = function HotKey(_ref) {
|
|
40502
|
+
var description = _ref.description,
|
|
40503
|
+
sequence = _ref.sequence;
|
|
40504
|
+
var hotkey = shortenHotKey(convertHotkeyToUsersPlatform(sequence));
|
|
40505
|
+
var isSequentialHotkey = hotkey.includes(" ");
|
|
40506
|
+
var isSimultaneousHotkey = hotkey.includes("+");
|
|
40507
|
+
var isSingleKeyHotkey = !isSequentialHotkey && !isSimultaneousHotkey;
|
|
40508
|
+
var sequences = [];
|
|
40509
|
+
if (isSingleKeyHotkey) {
|
|
40510
|
+
sequences = [hotkey];
|
|
40511
|
+
} else if (isSequentialHotkey) {
|
|
40512
|
+
sequences = hotkey.split(" ");
|
|
40513
|
+
} else if (isSimultaneousHotkey) {
|
|
40514
|
+
sequences = hotkey.split("+");
|
|
40515
|
+
}
|
|
40516
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40517
|
+
className: "my-3 px-4"
|
|
40518
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40519
|
+
className: "flex items-center justify-between gap-3",
|
|
40520
|
+
"data-testid": "hotkey-item"
|
|
40521
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
40522
|
+
className: "neeto-ui-text-gray-800",
|
|
40523
|
+
lineHeight: "normal",
|
|
40524
|
+
style: "body2"
|
|
40525
|
+
}, description), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40526
|
+
className: "flex items-center gap-1"
|
|
40527
|
+
}, sequences.map(function (keyName, idx) {
|
|
40528
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
40529
|
+
key: idx
|
|
40530
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Kbd, {
|
|
40531
|
+
keyName: keyName
|
|
40532
|
+
}), isSequentialHotkey && idx + 1 !== sequences.length && /*#__PURE__*/React__default["default"].createElement(neetoui.Kbd, {
|
|
40533
|
+
keyName: "then"
|
|
40534
|
+
}));
|
|
40535
|
+
}))));
|
|
40536
|
+
};
|
|
40537
|
+
|
|
40525
40538
|
var HotKeyList = function HotKeyList(_ref) {
|
|
40526
40539
|
var hotkeys = _ref.hotkeys;
|
|
40540
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
40541
|
+
t = _useTranslation.t;
|
|
40527
40542
|
return Object.keys(hotkeys).map(function (categoryName) {
|
|
40543
|
+
var categoryValues = hotkeys[categoryName];
|
|
40544
|
+
var fullShortcutsLink = categoryValues[FULL_SHORTCUTS_LINK_PROP_NAME];
|
|
40528
40545
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
40529
40546
|
key: categoryName
|
|
40530
40547
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
40531
40548
|
className: "neeto-ui-text-gray-800 mt-4 px-4 text-xs font-bold",
|
|
40532
40549
|
lineHeight: "normal",
|
|
40533
40550
|
style: "body2"
|
|
40534
|
-
}, categoryName), Object.entries(
|
|
40551
|
+
}, categoryName), Object.entries(categoryValues).map(function (_ref2) {
|
|
40535
40552
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
40536
40553
|
_ref3$ = _ref3[1],
|
|
40537
40554
|
sequence = _ref3$.sequence,
|
|
40538
40555
|
description = _ref3$.description;
|
|
40539
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
40540
|
-
|
|
40541
|
-
key: sequence
|
|
40542
|
-
|
|
40543
|
-
|
|
40544
|
-
|
|
40545
|
-
|
|
40546
|
-
|
|
40547
|
-
|
|
40548
|
-
|
|
40549
|
-
}, description), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40550
|
-
className: "flex items-center gap-1"
|
|
40551
|
-
}, /*#__PURE__*/React__default["default"].createElement(DisplayHotKey, {
|
|
40552
|
-
hotkey: shortenHotKey(convertHotkeyToUsersPlatform(sequence))
|
|
40553
|
-
}))));
|
|
40556
|
+
return sequence && /*#__PURE__*/React__default["default"].createElement(HotKey, {
|
|
40557
|
+
description: description,
|
|
40558
|
+
key: sequence,
|
|
40559
|
+
sequence: sequence
|
|
40560
|
+
});
|
|
40561
|
+
}), fullShortcutsLink && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
40562
|
+
className: "pl-4 mb-3",
|
|
40563
|
+
href: fullShortcutsLink,
|
|
40564
|
+
label: t("neetoCommons.keyboardShortcuts.viewFullListOfShortcuts"),
|
|
40565
|
+
style: "link"
|
|
40554
40566
|
}));
|
|
40555
40567
|
});
|
|
40556
40568
|
};
|
package/react-utils.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { DateTimeType, timeFormat } from "./utils";
|
|
|
18
18
|
import { History } from "history";
|
|
19
19
|
import { StoreApi, UseBoundStore } from "zustand";
|
|
20
20
|
import { Dayjs } from "dayjs";
|
|
21
|
+
import { TFunction } from "i18next";
|
|
21
22
|
|
|
22
23
|
export const HoneybadgerErrorBoundary: React.FC<{
|
|
23
24
|
ErrorComponent?: React.ReactNode | React.ComponentType<any>;
|
|
@@ -264,13 +265,14 @@ export function isMetaKeyPressed(
|
|
|
264
265
|
|
|
265
266
|
interface Shortcut {
|
|
266
267
|
sequence: string;
|
|
267
|
-
description:
|
|
268
|
+
description: TFunction;
|
|
268
269
|
}
|
|
269
270
|
interface Category {
|
|
270
|
-
[index: string]: Shortcut;
|
|
271
|
+
[index: string]: Shortcut | string;
|
|
272
|
+
fullShortcutsLink?: string;
|
|
271
273
|
}
|
|
272
274
|
interface ProductShortcuts {
|
|
273
|
-
[index:
|
|
275
|
+
[index: string | TFunction]: Category;
|
|
274
276
|
}
|
|
275
277
|
export const KeyboardShortcutsPane: React.FC<{
|
|
276
278
|
productShortcuts?: ProductShortcuts;
|
package/react-utils.js
CHANGED
|
@@ -40429,37 +40429,13 @@ var IpRestriction = function IpRestriction() {
|
|
|
40429
40429
|
}, /*#__PURE__*/React__default.createElement(CurrentIp, null), /*#__PURE__*/React__default.createElement(AllowedIpRanges, null)));
|
|
40430
40430
|
};
|
|
40431
40431
|
|
|
40432
|
-
var DisplayHotKey = function DisplayHotKey(_ref) {
|
|
40433
|
-
var hotkey = _ref.hotkey;
|
|
40434
|
-
var isSequentialHotkey = hotkey.includes(" ");
|
|
40435
|
-
var isSimultaneousHotkey = hotkey.includes("+");
|
|
40436
|
-
var isSingleKeyHotkey = !isSequentialHotkey && !isSimultaneousHotkey;
|
|
40437
|
-
var sequences = [];
|
|
40438
|
-
if (isSingleKeyHotkey) return /*#__PURE__*/React__default.createElement(Kbd, {
|
|
40439
|
-
keyName: hotkey
|
|
40440
|
-
});
|
|
40441
|
-
if (isSequentialHotkey) {
|
|
40442
|
-
sequences = hotkey.split(" ");
|
|
40443
|
-
} else if (isSimultaneousHotkey) {
|
|
40444
|
-
sequences = hotkey.split("+");
|
|
40445
|
-
}
|
|
40446
|
-
return sequences.map(function (keyName, idx) {
|
|
40447
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
40448
|
-
key: idx
|
|
40449
|
-
}, /*#__PURE__*/React__default.createElement(Kbd, {
|
|
40450
|
-
keyName: keyName
|
|
40451
|
-
}), isSequentialHotkey && idx + 1 !== sequences.length && /*#__PURE__*/React__default.createElement(Kbd, {
|
|
40452
|
-
keyName: "then"
|
|
40453
|
-
}));
|
|
40454
|
-
});
|
|
40455
|
-
};
|
|
40456
|
-
|
|
40457
40432
|
var KEY_SHORTFORM_MAP = {
|
|
40458
40433
|
command: "cmd",
|
|
40459
40434
|
escape: "esc",
|
|
40460
40435
|
control: "ctrl",
|
|
40461
40436
|
option: "opt"
|
|
40462
40437
|
};
|
|
40438
|
+
var FULL_SHORTCUTS_LINK_PROP_NAME = "fullShortcutsLink";
|
|
40463
40439
|
|
|
40464
40440
|
var shortenHotKey = function shortenHotKey(hotkey) {
|
|
40465
40441
|
var result = hotkey;
|
|
@@ -40484,35 +40460,71 @@ var getGlobalShortcuts = function getGlobalShortcuts() {
|
|
|
40484
40460
|
});
|
|
40485
40461
|
};
|
|
40486
40462
|
|
|
40463
|
+
var HotKey = function HotKey(_ref) {
|
|
40464
|
+
var description = _ref.description,
|
|
40465
|
+
sequence = _ref.sequence;
|
|
40466
|
+
var hotkey = shortenHotKey(convertHotkeyToUsersPlatform(sequence));
|
|
40467
|
+
var isSequentialHotkey = hotkey.includes(" ");
|
|
40468
|
+
var isSimultaneousHotkey = hotkey.includes("+");
|
|
40469
|
+
var isSingleKeyHotkey = !isSequentialHotkey && !isSimultaneousHotkey;
|
|
40470
|
+
var sequences = [];
|
|
40471
|
+
if (isSingleKeyHotkey) {
|
|
40472
|
+
sequences = [hotkey];
|
|
40473
|
+
} else if (isSequentialHotkey) {
|
|
40474
|
+
sequences = hotkey.split(" ");
|
|
40475
|
+
} else if (isSimultaneousHotkey) {
|
|
40476
|
+
sequences = hotkey.split("+");
|
|
40477
|
+
}
|
|
40478
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
40479
|
+
className: "my-3 px-4"
|
|
40480
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
40481
|
+
className: "flex items-center justify-between gap-3",
|
|
40482
|
+
"data-testid": "hotkey-item"
|
|
40483
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
40484
|
+
className: "neeto-ui-text-gray-800",
|
|
40485
|
+
lineHeight: "normal",
|
|
40486
|
+
style: "body2"
|
|
40487
|
+
}, description), /*#__PURE__*/React__default.createElement("div", {
|
|
40488
|
+
className: "flex items-center gap-1"
|
|
40489
|
+
}, sequences.map(function (keyName, idx) {
|
|
40490
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
40491
|
+
key: idx
|
|
40492
|
+
}, /*#__PURE__*/React__default.createElement(Kbd, {
|
|
40493
|
+
keyName: keyName
|
|
40494
|
+
}), isSequentialHotkey && idx + 1 !== sequences.length && /*#__PURE__*/React__default.createElement(Kbd, {
|
|
40495
|
+
keyName: "then"
|
|
40496
|
+
}));
|
|
40497
|
+
}))));
|
|
40498
|
+
};
|
|
40499
|
+
|
|
40487
40500
|
var HotKeyList = function HotKeyList(_ref) {
|
|
40488
40501
|
var hotkeys = _ref.hotkeys;
|
|
40502
|
+
var _useTranslation = useTranslation(),
|
|
40503
|
+
t = _useTranslation.t;
|
|
40489
40504
|
return Object.keys(hotkeys).map(function (categoryName) {
|
|
40505
|
+
var categoryValues = hotkeys[categoryName];
|
|
40506
|
+
var fullShortcutsLink = categoryValues[FULL_SHORTCUTS_LINK_PROP_NAME];
|
|
40490
40507
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
40491
40508
|
key: categoryName
|
|
40492
40509
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
40493
40510
|
className: "neeto-ui-text-gray-800 mt-4 px-4 text-xs font-bold",
|
|
40494
40511
|
lineHeight: "normal",
|
|
40495
40512
|
style: "body2"
|
|
40496
|
-
}, categoryName), Object.entries(
|
|
40513
|
+
}, categoryName), Object.entries(categoryValues).map(function (_ref2) {
|
|
40497
40514
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
40498
40515
|
_ref3$ = _ref3[1],
|
|
40499
40516
|
sequence = _ref3$.sequence,
|
|
40500
40517
|
description = _ref3$.description;
|
|
40501
|
-
return /*#__PURE__*/React__default.createElement(
|
|
40502
|
-
|
|
40503
|
-
key: sequence
|
|
40504
|
-
|
|
40505
|
-
|
|
40506
|
-
|
|
40507
|
-
|
|
40508
|
-
|
|
40509
|
-
|
|
40510
|
-
|
|
40511
|
-
}, description), /*#__PURE__*/React__default.createElement("div", {
|
|
40512
|
-
className: "flex items-center gap-1"
|
|
40513
|
-
}, /*#__PURE__*/React__default.createElement(DisplayHotKey, {
|
|
40514
|
-
hotkey: shortenHotKey(convertHotkeyToUsersPlatform(sequence))
|
|
40515
|
-
}))));
|
|
40518
|
+
return sequence && /*#__PURE__*/React__default.createElement(HotKey, {
|
|
40519
|
+
description: description,
|
|
40520
|
+
key: sequence,
|
|
40521
|
+
sequence: sequence
|
|
40522
|
+
});
|
|
40523
|
+
}), fullShortcutsLink && /*#__PURE__*/React__default.createElement(Button, {
|
|
40524
|
+
className: "pl-4 mb-3",
|
|
40525
|
+
href: fullShortcutsLink,
|
|
40526
|
+
label: t("neetoCommons.keyboardShortcuts.viewFullListOfShortcuts"),
|
|
40527
|
+
style: "link"
|
|
40516
40528
|
}));
|
|
40517
40529
|
});
|
|
40518
40530
|
};
|