@clr/angular 13.11.1 → 13.11.2
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/clarity.api.md +4 -3
- package/esm2020/data/datagrid/datagrid-column-separator.mjs +5 -4
- package/esm2020/data/datagrid/datagrid-detail.mjs +3 -3
- package/esm2020/data/tree-view/tree-node.mjs +13 -13
- package/esm2020/forms/combobox/combobox.mjs +3 -3
- package/esm2020/forms/combobox/providers/combobox-focus-handler.service.mjs +11 -11
- package/esm2020/forms/datepicker/calendar.mjs +8 -7
- package/esm2020/forms/datepicker/monthpicker.mjs +8 -7
- package/esm2020/forms/datepicker/yearpicker.mjs +8 -7
- package/esm2020/layout/tabs/tabs.mjs +3 -3
- package/esm2020/popover/common/abstract-popover.mjs +4 -3
- package/esm2020/popover/dropdown/providers/dropdown-focus-handler.service.mjs +6 -6
- package/esm2020/popover/tooltip/providers/tooltip-mouse.service.mjs +43 -0
- package/esm2020/popover/tooltip/tooltip-content.mjs +20 -6
- package/esm2020/popover/tooltip/tooltip-trigger.mjs +21 -13
- package/esm2020/popover/tooltip/tooltip.mjs +14 -3
- package/esm2020/utils/enums/keys.enum.mjs +30 -0
- package/esm2020/utils/focus/key-focus/key-focus.mjs +13 -13
- package/esm2020/utils/focus/key-focus/roving-tabindex.mjs +4 -4
- package/esm2020/utils/focus/key-focus/util.mjs +17 -20
- package/fesm2015/clr-angular.mjs +196 -150
- package/fesm2015/clr-angular.mjs.map +1 -1
- package/fesm2020/clr-angular.mjs +196 -150
- package/fesm2020/clr-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/popover/tooltip/providers/tooltip-mouse.service.d.ts +15 -0
- package/popover/tooltip/tooltip-content.d.ts +6 -2
- package/popover/tooltip/tooltip-trigger.d.ts +6 -2
- package/utils/enums/{key-codes.enum.d.ts → keys.enum.d.ts} +3 -7
- package/utils/focus/key-focus/util.d.ts +1 -1
- package/esm2020/utils/enums/key-codes.enum.mjs +0 -34
- package/esm2020/utils/key-codes/key-codes.mjs +0 -16
- package/utils/key-codes/key-codes.d.ts +0 -10
package/fesm2015/clr-angular.mjs
CHANGED
|
@@ -1328,69 +1328,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1328
1328
|
* This software is released under MIT license.
|
|
1329
1329
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1330
1330
|
*/
|
|
1331
|
-
var
|
|
1332
|
-
(function (
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
})(
|
|
1346
|
-
var
|
|
1347
|
-
(function (
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
return KeyCodes.Space;
|
|
1380
|
-
}
|
|
1381
|
-
else if (key === KeyCodes.Escape || key === IEKeyCodes.Escape) {
|
|
1382
|
-
return KeyCodes.Escape;
|
|
1331
|
+
var Keys;
|
|
1332
|
+
(function (Keys) {
|
|
1333
|
+
Keys["ArrowLeft"] = "ArrowLeft";
|
|
1334
|
+
Keys["ArrowUp"] = "ArrowUp";
|
|
1335
|
+
Keys["ArrowRight"] = "ArrowRight";
|
|
1336
|
+
Keys["ArrowDown"] = "ArrowDown";
|
|
1337
|
+
Keys["Backspace"] = "Backspace";
|
|
1338
|
+
Keys["Tab"] = "Tab";
|
|
1339
|
+
Keys["Enter"] = "Enter";
|
|
1340
|
+
Keys["Escape"] = "Escape";
|
|
1341
|
+
Keys["Space"] = "Space";
|
|
1342
|
+
Keys["Spacebar"] = " ";
|
|
1343
|
+
Keys["Home"] = "Home";
|
|
1344
|
+
Keys["End"] = "End";
|
|
1345
|
+
})(Keys || (Keys = {}));
|
|
1346
|
+
var IEKeys;
|
|
1347
|
+
(function (IEKeys) {
|
|
1348
|
+
IEKeys["ArrowUp"] = "Up";
|
|
1349
|
+
IEKeys["ArrowDown"] = "Down";
|
|
1350
|
+
IEKeys["ArrowRight"] = "Right";
|
|
1351
|
+
IEKeys["ArrowLeft"] = "Left";
|
|
1352
|
+
IEKeys["Space"] = "Spacebar";
|
|
1353
|
+
IEKeys["Escape"] = "Esc";
|
|
1354
|
+
})(IEKeys || (IEKeys = {}));
|
|
1355
|
+
|
|
1356
|
+
/*
|
|
1357
|
+
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
1358
|
+
* This software is released under MIT license.
|
|
1359
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1360
|
+
*/
|
|
1361
|
+
function normalizeKey(key) {
|
|
1362
|
+
if (key === Keys.ArrowUp || key === IEKeys.ArrowUp) {
|
|
1363
|
+
return Keys.ArrowUp;
|
|
1364
|
+
}
|
|
1365
|
+
else if (key === Keys.ArrowDown || key === IEKeys.ArrowDown) {
|
|
1366
|
+
return Keys.ArrowDown;
|
|
1367
|
+
}
|
|
1368
|
+
else if (key === Keys.ArrowRight || key === IEKeys.ArrowRight) {
|
|
1369
|
+
return Keys.ArrowRight;
|
|
1370
|
+
}
|
|
1371
|
+
else if (key === Keys.ArrowLeft || key === IEKeys.ArrowLeft) {
|
|
1372
|
+
return Keys.ArrowLeft;
|
|
1373
|
+
}
|
|
1374
|
+
else if (key === Keys.Space || key === IEKeys.Space) {
|
|
1375
|
+
return Keys.Space;
|
|
1376
|
+
}
|
|
1377
|
+
else if (key === Keys.Escape || key === IEKeys.Escape) {
|
|
1378
|
+
return Keys.Escape;
|
|
1383
1379
|
}
|
|
1384
1380
|
else {
|
|
1385
1381
|
return key;
|
|
1386
1382
|
}
|
|
1387
1383
|
}
|
|
1388
1384
|
function preventArrowKeyScroll(event) {
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1391
|
-
validKey === KeyCodes.ArrowDown ||
|
|
1392
|
-
validKey === KeyCodes.ArrowLeft ||
|
|
1393
|
-
validKey === KeyCodes.ArrowRight) {
|
|
1385
|
+
const key = normalizeKey(event.key);
|
|
1386
|
+
if (key === Keys.ArrowUp || key === Keys.ArrowDown || key === Keys.ArrowLeft || key === Keys.ArrowRight) {
|
|
1394
1387
|
// prevent element container scroll
|
|
1395
1388
|
// MDN references this is really the only way to prevent native browser interactions
|
|
1396
1389
|
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets
|
|
@@ -5002,10 +4995,10 @@ class ClrKeyFocus {
|
|
|
5002
4995
|
else if (this.nextKeyPressed(event) && this.currentFocusIsNotLastItem()) {
|
|
5003
4996
|
this.moveTo(this.current + 1);
|
|
5004
4997
|
}
|
|
5005
|
-
else if (event.code ===
|
|
4998
|
+
else if (event.code === Keys.Home) {
|
|
5006
4999
|
this.moveTo(0);
|
|
5007
5000
|
}
|
|
5008
|
-
else if (event.code ===
|
|
5001
|
+
else if (event.code === Keys.End) {
|
|
5009
5002
|
this.moveTo(this.focusableItems.length - 1);
|
|
5010
5003
|
}
|
|
5011
5004
|
preventArrowKeyScroll(event);
|
|
@@ -5053,27 +5046,27 @@ class ClrKeyFocus {
|
|
|
5053
5046
|
});
|
|
5054
5047
|
}
|
|
5055
5048
|
nextKeyPressed(event) {
|
|
5056
|
-
const key =
|
|
5049
|
+
const key = normalizeKey(event.key);
|
|
5057
5050
|
switch (this.direction) {
|
|
5058
5051
|
case ClrFocusDirection.VERTICAL:
|
|
5059
|
-
return key ===
|
|
5052
|
+
return key === Keys.ArrowDown;
|
|
5060
5053
|
case ClrFocusDirection.HORIZONTAL:
|
|
5061
|
-
return key ===
|
|
5054
|
+
return key === Keys.ArrowRight;
|
|
5062
5055
|
case ClrFocusDirection.BOTH:
|
|
5063
|
-
return key ===
|
|
5056
|
+
return key === Keys.ArrowDown || key === Keys.ArrowRight;
|
|
5064
5057
|
default:
|
|
5065
5058
|
return false;
|
|
5066
5059
|
}
|
|
5067
5060
|
}
|
|
5068
5061
|
prevKeyPressed(event) {
|
|
5069
|
-
const key =
|
|
5062
|
+
const key = normalizeKey(event.key);
|
|
5070
5063
|
switch (this.direction) {
|
|
5071
5064
|
case ClrFocusDirection.VERTICAL:
|
|
5072
|
-
return key ===
|
|
5065
|
+
return key === Keys.ArrowUp;
|
|
5073
5066
|
case ClrFocusDirection.HORIZONTAL:
|
|
5074
|
-
return key ===
|
|
5067
|
+
return key === Keys.ArrowLeft;
|
|
5075
5068
|
case ClrFocusDirection.BOTH:
|
|
5076
|
-
return key ===
|
|
5069
|
+
return key === Keys.ArrowUp || key === Keys.ArrowLeft;
|
|
5077
5070
|
default:
|
|
5078
5071
|
return false;
|
|
5079
5072
|
}
|
|
@@ -5141,10 +5134,10 @@ class ClrRovingTabindex extends ClrKeyFocus {
|
|
|
5141
5134
|
else if (this.nextKeyPressed(event) && this.currentFocusIsNotLastItem()) {
|
|
5142
5135
|
this.updateTabindex(this.current + 1);
|
|
5143
5136
|
}
|
|
5144
|
-
else if (event.code ===
|
|
5137
|
+
else if (event.code === Keys.Home) {
|
|
5145
5138
|
this.updateTabindex(0);
|
|
5146
5139
|
}
|
|
5147
|
-
else if (event.code ===
|
|
5140
|
+
else if (event.code === Keys.End) {
|
|
5148
5141
|
this.updateTabindex(this.focusableItems.length - 1);
|
|
5149
5142
|
}
|
|
5150
5143
|
super.handleKeyboardEvent(event);
|
|
@@ -5338,22 +5331,6 @@ const FOCUS_SERVICE_PROVIDER = {
|
|
|
5338
5331
|
deps: [[new Optional(), new SkipSelf(), FocusService$1], Renderer2],
|
|
5339
5332
|
};
|
|
5340
5333
|
|
|
5341
|
-
/*
|
|
5342
|
-
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
5343
|
-
* This software is released under MIT license.
|
|
5344
|
-
* The full license information can be found in LICENSE in the root directory of this project.
|
|
5345
|
-
*/
|
|
5346
|
-
const UP_ARROW = 38;
|
|
5347
|
-
const DOWN_ARROW = 40;
|
|
5348
|
-
const RIGHT_ARROW = 39;
|
|
5349
|
-
const LEFT_ARROW = 37;
|
|
5350
|
-
const ENTER = 13;
|
|
5351
|
-
const SPACE = 32;
|
|
5352
|
-
const SHIFT = 16;
|
|
5353
|
-
const TAB = 9;
|
|
5354
|
-
const ESC = 27;
|
|
5355
|
-
const BACKSPACE = 8;
|
|
5356
|
-
|
|
5357
5334
|
/*
|
|
5358
5335
|
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
5359
5336
|
* This software is released under MIT license.
|
|
@@ -5807,10 +5784,10 @@ class ComboboxFocusHandler {
|
|
|
5807
5784
|
// this service is only interested in keys that may move the focus
|
|
5808
5785
|
handleTextInput(event) {
|
|
5809
5786
|
let preventDefault = false;
|
|
5810
|
-
const key =
|
|
5787
|
+
const key = normalizeKey(event.key);
|
|
5811
5788
|
if (event) {
|
|
5812
5789
|
switch (key) {
|
|
5813
|
-
case
|
|
5790
|
+
case Keys.Enter:
|
|
5814
5791
|
if (this.toggleService.open && this.pseudoFocus.model) {
|
|
5815
5792
|
if (this.selectionService.multiselectable) {
|
|
5816
5793
|
this.selectionService.toggle(this.pseudoFocus.model.value);
|
|
@@ -5821,27 +5798,27 @@ class ComboboxFocusHandler {
|
|
|
5821
5798
|
preventDefault = true;
|
|
5822
5799
|
}
|
|
5823
5800
|
break;
|
|
5824
|
-
case
|
|
5801
|
+
case Keys.Space:
|
|
5825
5802
|
if (!this.toggleService.open) {
|
|
5826
5803
|
this.toggleService.open = true;
|
|
5827
5804
|
preventDefault = true;
|
|
5828
5805
|
}
|
|
5829
5806
|
break;
|
|
5830
|
-
case
|
|
5807
|
+
case Keys.ArrowUp:
|
|
5831
5808
|
this.preventViewportScrolling(event);
|
|
5832
5809
|
this.openAndMoveTo(ArrowKeyDirection.UP);
|
|
5833
5810
|
preventDefault = true;
|
|
5834
5811
|
break;
|
|
5835
|
-
case
|
|
5812
|
+
case Keys.ArrowDown:
|
|
5836
5813
|
this.preventViewportScrolling(event);
|
|
5837
5814
|
this.openAndMoveTo(ArrowKeyDirection.DOWN);
|
|
5838
5815
|
preventDefault = true;
|
|
5839
5816
|
break;
|
|
5840
5817
|
default:
|
|
5841
5818
|
// Any other keypress
|
|
5842
|
-
if (event.key !==
|
|
5843
|
-
!(this.selectionService.multiselectable && event.key ===
|
|
5844
|
-
!(event.key ===
|
|
5819
|
+
if (event.key !== Keys.Tab &&
|
|
5820
|
+
!(this.selectionService.multiselectable && event.key === Keys.Backspace) &&
|
|
5821
|
+
!(event.key === Keys.Escape) &&
|
|
5845
5822
|
!this.toggleService.open) {
|
|
5846
5823
|
this.toggleService.open = true;
|
|
5847
5824
|
}
|
|
@@ -6294,7 +6271,7 @@ class ClrCombobox extends WrappedFormControl {
|
|
|
6294
6271
|
}
|
|
6295
6272
|
onKeyUp(event) {
|
|
6296
6273
|
// if BACKSPACE in multiselect mode, delete the last pill if text is empty
|
|
6297
|
-
if (event.
|
|
6274
|
+
if (event.key === Keys.Backspace && this.multiSelect && this._searchText.length === 0) {
|
|
6298
6275
|
const multiModel = this.optionSelectionService.selectionModel.model;
|
|
6299
6276
|
if (multiModel && multiModel.length > 0) {
|
|
6300
6277
|
const lastItem = multiModel[multiModel.length - 1];
|
|
@@ -8250,20 +8227,20 @@ class ClrCalendar {
|
|
|
8250
8227
|
*/
|
|
8251
8228
|
onKeyDown(event) {
|
|
8252
8229
|
if (event && this.focusedDay) {
|
|
8253
|
-
switch (event.
|
|
8254
|
-
case
|
|
8230
|
+
switch (normalizeKey(event.key)) {
|
|
8231
|
+
case Keys.ArrowUp:
|
|
8255
8232
|
event.preventDefault();
|
|
8256
8233
|
this._dateNavigationService.incrementFocusDay(-1 * NO_OF_DAYS_IN_A_WEEK);
|
|
8257
8234
|
break;
|
|
8258
|
-
case
|
|
8235
|
+
case Keys.ArrowDown:
|
|
8259
8236
|
event.preventDefault();
|
|
8260
8237
|
this._dateNavigationService.incrementFocusDay(NO_OF_DAYS_IN_A_WEEK);
|
|
8261
8238
|
break;
|
|
8262
|
-
case
|
|
8239
|
+
case Keys.ArrowLeft:
|
|
8263
8240
|
event.preventDefault();
|
|
8264
8241
|
this._dateNavigationService.incrementFocusDay(-1);
|
|
8265
8242
|
break;
|
|
8266
|
-
case
|
|
8243
|
+
case Keys.ArrowRight:
|
|
8267
8244
|
event.preventDefault();
|
|
8268
8245
|
this._dateNavigationService.incrementFocusDay(1);
|
|
8269
8246
|
break;
|
|
@@ -8448,23 +8425,23 @@ class ClrMonthpicker {
|
|
|
8448
8425
|
// the logic is fairly simple and it didn't make sense for me
|
|
8449
8426
|
// to create extra observables just to move this logic to the service.
|
|
8450
8427
|
if (event) {
|
|
8451
|
-
const
|
|
8452
|
-
if (
|
|
8428
|
+
const key = normalizeKey(event.key);
|
|
8429
|
+
if (key === Keys.ArrowUp && this._focusedMonthIndex > 0) {
|
|
8453
8430
|
event.preventDefault();
|
|
8454
8431
|
this._focusedMonthIndex--;
|
|
8455
8432
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
8456
8433
|
}
|
|
8457
|
-
else if (
|
|
8434
|
+
else if (key === Keys.ArrowDown && this._focusedMonthIndex < 11) {
|
|
8458
8435
|
event.preventDefault();
|
|
8459
8436
|
this._focusedMonthIndex++;
|
|
8460
8437
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
8461
8438
|
}
|
|
8462
|
-
else if (
|
|
8439
|
+
else if (key === Keys.ArrowRight && this._focusedMonthIndex < 6) {
|
|
8463
8440
|
event.preventDefault();
|
|
8464
8441
|
this._focusedMonthIndex = this._focusedMonthIndex + 6;
|
|
8465
8442
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
8466
8443
|
}
|
|
8467
|
-
else if (
|
|
8444
|
+
else if (key === Keys.ArrowLeft && this._focusedMonthIndex > 5) {
|
|
8468
8445
|
event.preventDefault();
|
|
8469
8446
|
this._focusedMonthIndex = this._focusedMonthIndex - 6;
|
|
8470
8447
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
@@ -8668,20 +8645,20 @@ class ClrYearpicker {
|
|
|
8668
8645
|
// the logic is fairly simple and it didn't make sense for me
|
|
8669
8646
|
// to create extra observables just to move this logic to the service.
|
|
8670
8647
|
if (event) {
|
|
8671
|
-
const
|
|
8672
|
-
if (
|
|
8648
|
+
const key = normalizeKey(event.key);
|
|
8649
|
+
if (key === Keys.ArrowUp) {
|
|
8673
8650
|
event.preventDefault();
|
|
8674
8651
|
this.incrementFocusYearBy(-1);
|
|
8675
8652
|
}
|
|
8676
|
-
else if (
|
|
8653
|
+
else if (key === Keys.ArrowDown) {
|
|
8677
8654
|
event.preventDefault();
|
|
8678
8655
|
this.incrementFocusYearBy(1);
|
|
8679
8656
|
}
|
|
8680
|
-
else if (
|
|
8657
|
+
else if (key === Keys.ArrowRight) {
|
|
8681
8658
|
event.preventDefault();
|
|
8682
8659
|
this.incrementFocusYearBy(5);
|
|
8683
8660
|
}
|
|
8684
|
-
else if (
|
|
8661
|
+
else if (key === Keys.ArrowLeft) {
|
|
8685
8662
|
event.preventDefault();
|
|
8686
8663
|
this.incrementFocusYearBy(-5);
|
|
8687
8664
|
}
|
|
@@ -13464,10 +13441,10 @@ class ClrDatagridColumnSeparator {
|
|
|
13464
13441
|
}
|
|
13465
13442
|
}
|
|
13466
13443
|
isArrowLeftKeyEvent(event) {
|
|
13467
|
-
return event.key ===
|
|
13444
|
+
return normalizeKey(event.key) === Keys.ArrowLeft;
|
|
13468
13445
|
}
|
|
13469
13446
|
isArrowRightKeyEvent(event) {
|
|
13470
|
-
return event.key ===
|
|
13447
|
+
return normalizeKey(event.key) === Keys.ArrowRight;
|
|
13471
13448
|
}
|
|
13472
13449
|
ngOnDestroy() {
|
|
13473
13450
|
this.unlisteners.forEach(unlistener => unlistener());
|
|
@@ -16482,7 +16459,7 @@ class ClrDatagridDetail {
|
|
|
16482
16459
|
}
|
|
16483
16460
|
}
|
|
16484
16461
|
ClrDatagridDetail.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrDatagridDetail, deps: [{ token: DetailService }, { token: ClrCommonStringsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
16485
|
-
ClrDatagridDetail.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrDatagridDetail, selector: "clr-dg-detail", host: { listeners: { "document:keyup.
|
|
16462
|
+
ClrDatagridDetail.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrDatagridDetail, selector: "clr-dg-detail", host: { listeners: { "document:keyup.escape": "closeCheck()" }, properties: { "class.datagrid-detail-pane": "true" } }, queries: [{ propertyName: "header", first: true, predicate: ClrDatagridDetailHeader, descendants: true }], ngImport: i0, template: `
|
|
16486
16463
|
<div
|
|
16487
16464
|
[clrFocusTrap]="{ strict: false }"
|
|
16488
16465
|
class="datagrid-detail-pane-content"
|
|
@@ -16527,7 +16504,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
16527
16504
|
args: [ClrDatagridDetailHeader]
|
|
16528
16505
|
}], closeCheck: [{
|
|
16529
16506
|
type: HostListener,
|
|
16530
|
-
args: ['document:keyup.
|
|
16507
|
+
args: ['document:keyup.escape']
|
|
16531
16508
|
}] } });
|
|
16532
16509
|
|
|
16533
16510
|
/*
|
|
@@ -19816,32 +19793,32 @@ class ClrTreeNode {
|
|
|
19816
19793
|
// By default, pressing arrow key makes AT focus go into the nested content of the item.
|
|
19817
19794
|
preventArrowKeyScroll(event);
|
|
19818
19795
|
// https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard-interaction-22
|
|
19819
|
-
switch (
|
|
19820
|
-
case
|
|
19796
|
+
switch (normalizeKey(event.key)) {
|
|
19797
|
+
case Keys.ArrowUp:
|
|
19821
19798
|
this.focusManager.focusNodeAbove(this._model);
|
|
19822
19799
|
break;
|
|
19823
|
-
case
|
|
19800
|
+
case Keys.ArrowDown:
|
|
19824
19801
|
this.focusManager.focusNodeBelow(this._model);
|
|
19825
19802
|
break;
|
|
19826
|
-
case
|
|
19803
|
+
case Keys.ArrowRight:
|
|
19827
19804
|
this.expandOrFocusFirstChild();
|
|
19828
19805
|
break;
|
|
19829
|
-
case
|
|
19806
|
+
case Keys.ArrowLeft:
|
|
19830
19807
|
this.collapseOrFocusParent();
|
|
19831
19808
|
break;
|
|
19832
|
-
case
|
|
19809
|
+
case Keys.Home:
|
|
19833
19810
|
event.preventDefault();
|
|
19834
19811
|
this.focusManager.focusFirstVisibleNode();
|
|
19835
19812
|
break;
|
|
19836
|
-
case
|
|
19813
|
+
case Keys.End:
|
|
19837
19814
|
event.preventDefault();
|
|
19838
19815
|
this.focusManager.focusLastVisibleNode();
|
|
19839
19816
|
break;
|
|
19840
|
-
case
|
|
19817
|
+
case Keys.Enter:
|
|
19841
19818
|
this.toggleExpandOrTriggerDefault();
|
|
19842
19819
|
break;
|
|
19843
|
-
case
|
|
19844
|
-
case
|
|
19820
|
+
case Keys.Space:
|
|
19821
|
+
case Keys.Spacebar:
|
|
19845
19822
|
// to prevent scrolling on space key in this specific case
|
|
19846
19823
|
event.preventDefault();
|
|
19847
19824
|
this.toggleExpandOrTriggerDefault();
|
|
@@ -20210,10 +20187,10 @@ class DropdownFocusHandler {
|
|
|
20210
20187
|
// whether root container or not, tab key should always toggle (i.e. close) the container
|
|
20211
20188
|
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.tab', event => this.toggleService.toggleWithEvent(event)));
|
|
20212
20189
|
if (this.parent) {
|
|
20213
|
-
// if it's a nested container, pressing
|
|
20190
|
+
// if it's a nested container, pressing escape has the same effect as pressing left key, which closes the current
|
|
20214
20191
|
// popup and moves up to its parent. Here, we stop propagation so that the parent container
|
|
20215
|
-
// doesn't receive the
|
|
20216
|
-
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.
|
|
20192
|
+
// doesn't receive the escape keydown
|
|
20193
|
+
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.escape', event => {
|
|
20217
20194
|
this.focusService.move(ArrowKeyDirection.LEFT);
|
|
20218
20195
|
event.stopPropagation();
|
|
20219
20196
|
}));
|
|
@@ -20221,8 +20198,8 @@ class DropdownFocusHandler {
|
|
|
20221
20198
|
else {
|
|
20222
20199
|
// The root container is the only one we register to the focus service, others do not need focus
|
|
20223
20200
|
this.focusService.registerContainer(el);
|
|
20224
|
-
// The root container will simply close the container when
|
|
20225
|
-
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.
|
|
20201
|
+
// The root container will simply close the container when escape key is pressed
|
|
20202
|
+
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.escape', event => this.toggleService.toggleWithEvent(event)));
|
|
20226
20203
|
// When the user moves focus outside of the menu, we close the dropdown
|
|
20227
20204
|
this._unlistenFuncs.push(this.renderer.listen(el, 'blur', event => {
|
|
20228
20205
|
// we clear out any existing focus on the items
|
|
@@ -20805,7 +20782,6 @@ class Popover {
|
|
|
20805
20782
|
* This software is released under MIT license.
|
|
20806
20783
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
20807
20784
|
*/
|
|
20808
|
-
// Literally any annotation would work here, but writing our own @HoneyBadger annotation feels overkill.
|
|
20809
20785
|
class AbstractPopover {
|
|
20810
20786
|
constructor(injector, parentHost) {
|
|
20811
20787
|
this.parentHost = parentHost;
|
|
@@ -20884,7 +20860,7 @@ class AbstractPopover {
|
|
|
20884
20860
|
this.ngZone.runOutsideAngular(() => {
|
|
20885
20861
|
this.documentESCListener = this.renderer.listen('document', 'keydown', event => {
|
|
20886
20862
|
if (event && event.key) {
|
|
20887
|
-
if (event.key ===
|
|
20863
|
+
if (normalizeKey(event.key) === Keys.Escape) {
|
|
20888
20864
|
this.ngZone.run(() => {
|
|
20889
20865
|
this.toggleService.open = false;
|
|
20890
20866
|
this.ref.markForCheck();
|
|
@@ -22988,7 +22964,7 @@ ClrTabs.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3
|
|
|
22988
22964
|
<!--tab links in overflow menu-->
|
|
22989
22965
|
<clr-tab-overflow-content
|
|
22990
22966
|
*ngIf="toggleService.open"
|
|
22991
|
-
(document:keydown.
|
|
22967
|
+
(document:keydown.escape)="closeOnEscapeKey()"
|
|
22992
22968
|
(document:click)="closeOnOutsideClick($event, tabOverflowTrigger)"
|
|
22993
22969
|
(focusout)="closeOnFocusOut($event)"
|
|
22994
22970
|
>
|
|
@@ -23052,7 +23028,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
23052
23028
|
<!--tab links in overflow menu-->
|
|
23053
23029
|
<clr-tab-overflow-content
|
|
23054
23030
|
*ngIf="toggleService.open"
|
|
23055
|
-
(document:keydown.
|
|
23031
|
+
(document:keydown.escape)="closeOnEscapeKey()"
|
|
23056
23032
|
(document:click)="closeOnOutsideClick($event, tabOverflowTrigger)"
|
|
23057
23033
|
(focusout)="closeOnFocusOut($event)"
|
|
23058
23034
|
>
|
|
@@ -24109,6 +24085,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24109
24085
|
type: Injectable
|
|
24110
24086
|
}] });
|
|
24111
24087
|
|
|
24088
|
+
/*
|
|
24089
|
+
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
24090
|
+
* This software is released under MIT license.
|
|
24091
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
24092
|
+
*/
|
|
24093
|
+
class TooltipMouseService {
|
|
24094
|
+
constructor(toggleService) {
|
|
24095
|
+
this.toggleService = toggleService;
|
|
24096
|
+
}
|
|
24097
|
+
onMouseEnterTrigger() {
|
|
24098
|
+
this.mouseOverTrigger = true;
|
|
24099
|
+
this.toggleService.open = true;
|
|
24100
|
+
}
|
|
24101
|
+
onMouseLeaveTrigger() {
|
|
24102
|
+
this.mouseOverTrigger = false;
|
|
24103
|
+
this.hideIfMouseOut();
|
|
24104
|
+
}
|
|
24105
|
+
onMouseEnterContent() {
|
|
24106
|
+
this.mouseOverContent = true;
|
|
24107
|
+
}
|
|
24108
|
+
onMouseLeaveContent() {
|
|
24109
|
+
this.mouseOverContent = false;
|
|
24110
|
+
this.hideIfMouseOut();
|
|
24111
|
+
}
|
|
24112
|
+
hideIfMouseOut() {
|
|
24113
|
+
// A zero timeout is used so that the code has a chance to update
|
|
24114
|
+
// the `mouseOverContent` property after the user moves the mouse from the trigger to the content.
|
|
24115
|
+
setTimeout(() => {
|
|
24116
|
+
if (!this.mouseOverTrigger && !this.mouseOverContent) {
|
|
24117
|
+
this.toggleService.open = false;
|
|
24118
|
+
}
|
|
24119
|
+
}, 0);
|
|
24120
|
+
}
|
|
24121
|
+
}
|
|
24122
|
+
TooltipMouseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TooltipMouseService, deps: [{ token: ClrPopoverToggleService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
24123
|
+
TooltipMouseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TooltipMouseService });
|
|
24124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TooltipMouseService, decorators: [{
|
|
24125
|
+
type: Injectable
|
|
24126
|
+
}], ctorParameters: function () { return [{ type: ClrPopoverToggleService }]; } });
|
|
24127
|
+
|
|
24112
24128
|
/*
|
|
24113
24129
|
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
24114
24130
|
* This software is released under MIT license.
|
|
@@ -24117,7 +24133,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24117
24133
|
class ClrTooltip {
|
|
24118
24134
|
}
|
|
24119
24135
|
ClrTooltip.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
24120
|
-
ClrTooltip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltip, selector: "clr-tooltip", host: { properties: { "class.tooltip": "true" } }, providers: [
|
|
24136
|
+
ClrTooltip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltip, selector: "clr-tooltip", host: { properties: { "class.tooltip": "true" } }, providers: [
|
|
24137
|
+
ClrPopoverToggleService,
|
|
24138
|
+
{ provide: POPOVER_HOST_ANCHOR, useExisting: ElementRef },
|
|
24139
|
+
TooltipIdService,
|
|
24140
|
+
TooltipMouseService,
|
|
24141
|
+
], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
24121
24142
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltip, decorators: [{
|
|
24122
24143
|
type: Component,
|
|
24123
24144
|
args: [{
|
|
@@ -24126,7 +24147,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24126
24147
|
host: {
|
|
24127
24148
|
'[class.tooltip]': 'true',
|
|
24128
24149
|
},
|
|
24129
|
-
providers: [
|
|
24150
|
+
providers: [
|
|
24151
|
+
ClrPopoverToggleService,
|
|
24152
|
+
{ provide: POPOVER_HOST_ANCHOR, useExisting: ElementRef },
|
|
24153
|
+
TooltipIdService,
|
|
24154
|
+
TooltipMouseService,
|
|
24155
|
+
],
|
|
24130
24156
|
}]
|
|
24131
24157
|
}] });
|
|
24132
24158
|
|
|
@@ -24149,9 +24175,10 @@ const SIZES = ['xs', 'sm', 'md', 'lg'];
|
|
|
24149
24175
|
const defaultPosition = 'right';
|
|
24150
24176
|
const defaultSize = 'sm';
|
|
24151
24177
|
class ClrTooltipContent extends AbstractPopover {
|
|
24152
|
-
constructor(injector, parentHost, tooltipIdService) {
|
|
24178
|
+
constructor(injector, parentHost, tooltipIdService, tooltipMouseService) {
|
|
24153
24179
|
super(injector, parentHost);
|
|
24154
24180
|
this.tooltipIdService = tooltipIdService;
|
|
24181
|
+
this.tooltipMouseService = tooltipMouseService;
|
|
24155
24182
|
if (!parentHost) {
|
|
24156
24183
|
throw new Error('clr-tooltip-content should only be used inside of a clr-tooltip');
|
|
24157
24184
|
}
|
|
@@ -24217,13 +24244,19 @@ class ClrTooltipContent extends AbstractPopover {
|
|
|
24217
24244
|
this.size = this.size || defaultSize;
|
|
24218
24245
|
this.position = this.position || defaultPosition;
|
|
24219
24246
|
}
|
|
24247
|
+
onMouseEnter() {
|
|
24248
|
+
this.tooltipMouseService.onMouseEnterContent();
|
|
24249
|
+
}
|
|
24250
|
+
onMouseLeave() {
|
|
24251
|
+
this.tooltipMouseService.onMouseLeaveContent();
|
|
24252
|
+
}
|
|
24220
24253
|
updateCssClass({ oldClass, newClass }) {
|
|
24221
24254
|
this.renderer.removeClass(this.el.nativeElement, oldClass);
|
|
24222
24255
|
this.renderer.addClass(this.el.nativeElement, newClass);
|
|
24223
24256
|
}
|
|
24224
24257
|
}
|
|
24225
|
-
ClrTooltipContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipContent, deps: [{ token: i0.Injector }, { token: POPOVER_HOST_ANCHOR, optional: true }, { token: TooltipIdService }], target: i0.ɵɵFactoryTarget.Component });
|
|
24226
|
-
ClrTooltipContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltipContent, selector: "clr-tooltip-content", inputs: { id: "id", position: ["clrPosition", "position"], size: ["clrSize", "size"] }, host: { properties: { "class.tooltip-content": "true", "style.opacity": "1", "attr.role": "\"tooltip\"", "id": "id" } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
24258
|
+
ClrTooltipContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipContent, deps: [{ token: i0.Injector }, { token: POPOVER_HOST_ANCHOR, optional: true }, { token: TooltipIdService }, { token: TooltipMouseService }], target: i0.ɵɵFactoryTarget.Component });
|
|
24259
|
+
ClrTooltipContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltipContent, selector: "clr-tooltip-content", inputs: { id: "id", position: ["clrPosition", "position"], size: ["clrSize", "size"] }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" }, properties: { "class.tooltip-content": "true", "style.opacity": "1", "attr.role": "\"tooltip\"", "id": "id" } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
24227
24260
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipContent, decorators: [{
|
|
24228
24261
|
type: Component,
|
|
24229
24262
|
args: [{
|
|
@@ -24242,7 +24275,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24242
24275
|
}, {
|
|
24243
24276
|
type: Inject,
|
|
24244
24277
|
args: [POPOVER_HOST_ANCHOR]
|
|
24245
|
-
}] }, { type: TooltipIdService }];
|
|
24278
|
+
}] }, { type: TooltipIdService }, { type: TooltipMouseService }];
|
|
24246
24279
|
}, propDecorators: { id: [{
|
|
24247
24280
|
type: Input
|
|
24248
24281
|
}], position: [{
|
|
@@ -24251,6 +24284,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24251
24284
|
}], size: [{
|
|
24252
24285
|
type: Input,
|
|
24253
24286
|
args: ['clrSize']
|
|
24287
|
+
}], onMouseEnter: [{
|
|
24288
|
+
type: HostListener,
|
|
24289
|
+
args: ['mouseenter']
|
|
24290
|
+
}], onMouseLeave: [{
|
|
24291
|
+
type: HostListener,
|
|
24292
|
+
args: ['mouseleave']
|
|
24254
24293
|
}] } });
|
|
24255
24294
|
|
|
24256
24295
|
/*
|
|
@@ -24259,25 +24298,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24259
24298
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
24260
24299
|
*/
|
|
24261
24300
|
class ClrTooltipTrigger {
|
|
24262
|
-
constructor(toggleService, tooltipIdService) {
|
|
24301
|
+
constructor(toggleService, tooltipIdService, tooltipMouseService) {
|
|
24263
24302
|
this.toggleService = toggleService;
|
|
24264
24303
|
this.tooltipIdService = tooltipIdService;
|
|
24304
|
+
this.tooltipMouseService = tooltipMouseService;
|
|
24265
24305
|
this.subs = [];
|
|
24266
24306
|
// The aria-described by comes from the id of content. It
|
|
24267
24307
|
this.subs.push(this.tooltipIdService.id.subscribe(tooltipId => (this.ariaDescribedBy = tooltipId)));
|
|
24268
24308
|
}
|
|
24309
|
+
ngOnDestroy() {
|
|
24310
|
+
this.subs.forEach(sub => sub.unsubscribe());
|
|
24311
|
+
}
|
|
24269
24312
|
showTooltip() {
|
|
24270
24313
|
this.toggleService.open = true;
|
|
24271
24314
|
}
|
|
24272
24315
|
hideTooltip() {
|
|
24273
24316
|
this.toggleService.open = false;
|
|
24274
24317
|
}
|
|
24275
|
-
|
|
24276
|
-
this.
|
|
24318
|
+
onMouseEnter() {
|
|
24319
|
+
this.tooltipMouseService.onMouseEnterTrigger();
|
|
24320
|
+
}
|
|
24321
|
+
onMouseLeave() {
|
|
24322
|
+
this.tooltipMouseService.onMouseLeaveTrigger();
|
|
24277
24323
|
}
|
|
24278
24324
|
}
|
|
24279
|
-
ClrTooltipTrigger.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipTrigger, deps: [{ token: ClrPopoverToggleService }, { token: TooltipIdService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
24280
|
-
ClrTooltipTrigger.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltipTrigger, selector: "[clrTooltipTrigger]", host: { attributes: { "tabindex": "0" }, listeners: { "
|
|
24325
|
+
ClrTooltipTrigger.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipTrigger, deps: [{ token: ClrPopoverToggleService }, { token: TooltipIdService }, { token: TooltipMouseService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
24326
|
+
ClrTooltipTrigger.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltipTrigger, selector: "[clrTooltipTrigger]", host: { attributes: { "tabindex": "0" }, listeners: { "focus": "showTooltip()", "blur": "hideTooltip()", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" }, properties: { "class.tooltip-trigger": "true", "attr.aria-describedby": "ariaDescribedBy", "attr.role": "\"button\"" } }, ngImport: i0 });
|
|
24281
24327
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipTrigger, decorators: [{
|
|
24282
24328
|
type: Directive,
|
|
24283
24329
|
args: [{
|
|
@@ -24289,18 +24335,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24289
24335
|
'[attr.role]': '"button"',
|
|
24290
24336
|
},
|
|
24291
24337
|
}]
|
|
24292
|
-
}], ctorParameters: function () { return [{ type: ClrPopoverToggleService }, { type: TooltipIdService }]; }, propDecorators: { showTooltip: [{
|
|
24293
|
-
type: HostListener,
|
|
24294
|
-
args: ['mouseenter']
|
|
24295
|
-
}, {
|
|
24338
|
+
}], ctorParameters: function () { return [{ type: ClrPopoverToggleService }, { type: TooltipIdService }, { type: TooltipMouseService }]; }, propDecorators: { showTooltip: [{
|
|
24296
24339
|
type: HostListener,
|
|
24297
24340
|
args: ['focus']
|
|
24298
24341
|
}], hideTooltip: [{
|
|
24299
|
-
type: HostListener,
|
|
24300
|
-
args: ['mouseleave']
|
|
24301
|
-
}, {
|
|
24302
24342
|
type: HostListener,
|
|
24303
24343
|
args: ['blur']
|
|
24344
|
+
}], onMouseEnter: [{
|
|
24345
|
+
type: HostListener,
|
|
24346
|
+
args: ['mouseenter']
|
|
24347
|
+
}], onMouseLeave: [{
|
|
24348
|
+
type: HostListener,
|
|
24349
|
+
args: ['mouseleave']
|
|
24304
24350
|
}] } });
|
|
24305
24351
|
|
|
24306
24352
|
/*
|