@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/fesm2020/clr-angular.mjs
CHANGED
|
@@ -1318,69 +1318,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1318
1318
|
* This software is released under MIT license.
|
|
1319
1319
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1320
1320
|
*/
|
|
1321
|
-
var
|
|
1322
|
-
(function (
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
})(
|
|
1336
|
-
var
|
|
1337
|
-
(function (
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
return KeyCodes.Space;
|
|
1370
|
-
}
|
|
1371
|
-
else if (key === KeyCodes.Escape || key === IEKeyCodes.Escape) {
|
|
1372
|
-
return KeyCodes.Escape;
|
|
1321
|
+
var Keys;
|
|
1322
|
+
(function (Keys) {
|
|
1323
|
+
Keys["ArrowLeft"] = "ArrowLeft";
|
|
1324
|
+
Keys["ArrowUp"] = "ArrowUp";
|
|
1325
|
+
Keys["ArrowRight"] = "ArrowRight";
|
|
1326
|
+
Keys["ArrowDown"] = "ArrowDown";
|
|
1327
|
+
Keys["Backspace"] = "Backspace";
|
|
1328
|
+
Keys["Tab"] = "Tab";
|
|
1329
|
+
Keys["Enter"] = "Enter";
|
|
1330
|
+
Keys["Escape"] = "Escape";
|
|
1331
|
+
Keys["Space"] = "Space";
|
|
1332
|
+
Keys["Spacebar"] = " ";
|
|
1333
|
+
Keys["Home"] = "Home";
|
|
1334
|
+
Keys["End"] = "End";
|
|
1335
|
+
})(Keys || (Keys = {}));
|
|
1336
|
+
var IEKeys;
|
|
1337
|
+
(function (IEKeys) {
|
|
1338
|
+
IEKeys["ArrowUp"] = "Up";
|
|
1339
|
+
IEKeys["ArrowDown"] = "Down";
|
|
1340
|
+
IEKeys["ArrowRight"] = "Right";
|
|
1341
|
+
IEKeys["ArrowLeft"] = "Left";
|
|
1342
|
+
IEKeys["Space"] = "Spacebar";
|
|
1343
|
+
IEKeys["Escape"] = "Esc";
|
|
1344
|
+
})(IEKeys || (IEKeys = {}));
|
|
1345
|
+
|
|
1346
|
+
/*
|
|
1347
|
+
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
1348
|
+
* This software is released under MIT license.
|
|
1349
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1350
|
+
*/
|
|
1351
|
+
function normalizeKey(key) {
|
|
1352
|
+
if (key === Keys.ArrowUp || key === IEKeys.ArrowUp) {
|
|
1353
|
+
return Keys.ArrowUp;
|
|
1354
|
+
}
|
|
1355
|
+
else if (key === Keys.ArrowDown || key === IEKeys.ArrowDown) {
|
|
1356
|
+
return Keys.ArrowDown;
|
|
1357
|
+
}
|
|
1358
|
+
else if (key === Keys.ArrowRight || key === IEKeys.ArrowRight) {
|
|
1359
|
+
return Keys.ArrowRight;
|
|
1360
|
+
}
|
|
1361
|
+
else if (key === Keys.ArrowLeft || key === IEKeys.ArrowLeft) {
|
|
1362
|
+
return Keys.ArrowLeft;
|
|
1363
|
+
}
|
|
1364
|
+
else if (key === Keys.Space || key === IEKeys.Space) {
|
|
1365
|
+
return Keys.Space;
|
|
1366
|
+
}
|
|
1367
|
+
else if (key === Keys.Escape || key === IEKeys.Escape) {
|
|
1368
|
+
return Keys.Escape;
|
|
1373
1369
|
}
|
|
1374
1370
|
else {
|
|
1375
1371
|
return key;
|
|
1376
1372
|
}
|
|
1377
1373
|
}
|
|
1378
1374
|
function preventArrowKeyScroll(event) {
|
|
1379
|
-
const
|
|
1380
|
-
if (
|
|
1381
|
-
validKey === KeyCodes.ArrowDown ||
|
|
1382
|
-
validKey === KeyCodes.ArrowLeft ||
|
|
1383
|
-
validKey === KeyCodes.ArrowRight) {
|
|
1375
|
+
const key = normalizeKey(event.key);
|
|
1376
|
+
if (key === Keys.ArrowUp || key === Keys.ArrowDown || key === Keys.ArrowLeft || key === Keys.ArrowRight) {
|
|
1384
1377
|
// prevent element container scroll
|
|
1385
1378
|
// MDN references this is really the only way to prevent native browser interactions
|
|
1386
1379
|
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets
|
|
@@ -4959,10 +4952,10 @@ class ClrKeyFocus {
|
|
|
4959
4952
|
else if (this.nextKeyPressed(event) && this.currentFocusIsNotLastItem()) {
|
|
4960
4953
|
this.moveTo(this.current + 1);
|
|
4961
4954
|
}
|
|
4962
|
-
else if (event.code ===
|
|
4955
|
+
else if (event.code === Keys.Home) {
|
|
4963
4956
|
this.moveTo(0);
|
|
4964
4957
|
}
|
|
4965
|
-
else if (event.code ===
|
|
4958
|
+
else if (event.code === Keys.End) {
|
|
4966
4959
|
this.moveTo(this.focusableItems.length - 1);
|
|
4967
4960
|
}
|
|
4968
4961
|
preventArrowKeyScroll(event);
|
|
@@ -5010,27 +5003,27 @@ class ClrKeyFocus {
|
|
|
5010
5003
|
});
|
|
5011
5004
|
}
|
|
5012
5005
|
nextKeyPressed(event) {
|
|
5013
|
-
const key =
|
|
5006
|
+
const key = normalizeKey(event.key);
|
|
5014
5007
|
switch (this.direction) {
|
|
5015
5008
|
case ClrFocusDirection.VERTICAL:
|
|
5016
|
-
return key ===
|
|
5009
|
+
return key === Keys.ArrowDown;
|
|
5017
5010
|
case ClrFocusDirection.HORIZONTAL:
|
|
5018
|
-
return key ===
|
|
5011
|
+
return key === Keys.ArrowRight;
|
|
5019
5012
|
case ClrFocusDirection.BOTH:
|
|
5020
|
-
return key ===
|
|
5013
|
+
return key === Keys.ArrowDown || key === Keys.ArrowRight;
|
|
5021
5014
|
default:
|
|
5022
5015
|
return false;
|
|
5023
5016
|
}
|
|
5024
5017
|
}
|
|
5025
5018
|
prevKeyPressed(event) {
|
|
5026
|
-
const key =
|
|
5019
|
+
const key = normalizeKey(event.key);
|
|
5027
5020
|
switch (this.direction) {
|
|
5028
5021
|
case ClrFocusDirection.VERTICAL:
|
|
5029
|
-
return key ===
|
|
5022
|
+
return key === Keys.ArrowUp;
|
|
5030
5023
|
case ClrFocusDirection.HORIZONTAL:
|
|
5031
|
-
return key ===
|
|
5024
|
+
return key === Keys.ArrowLeft;
|
|
5032
5025
|
case ClrFocusDirection.BOTH:
|
|
5033
|
-
return key ===
|
|
5026
|
+
return key === Keys.ArrowUp || key === Keys.ArrowLeft;
|
|
5034
5027
|
default:
|
|
5035
5028
|
return false;
|
|
5036
5029
|
}
|
|
@@ -5098,10 +5091,10 @@ class ClrRovingTabindex extends ClrKeyFocus {
|
|
|
5098
5091
|
else if (this.nextKeyPressed(event) && this.currentFocusIsNotLastItem()) {
|
|
5099
5092
|
this.updateTabindex(this.current + 1);
|
|
5100
5093
|
}
|
|
5101
|
-
else if (event.code ===
|
|
5094
|
+
else if (event.code === Keys.Home) {
|
|
5102
5095
|
this.updateTabindex(0);
|
|
5103
5096
|
}
|
|
5104
|
-
else if (event.code ===
|
|
5097
|
+
else if (event.code === Keys.End) {
|
|
5105
5098
|
this.updateTabindex(this.focusableItems.length - 1);
|
|
5106
5099
|
}
|
|
5107
5100
|
super.handleKeyboardEvent(event);
|
|
@@ -5295,22 +5288,6 @@ const FOCUS_SERVICE_PROVIDER = {
|
|
|
5295
5288
|
deps: [[new Optional(), new SkipSelf(), FocusService$1], Renderer2],
|
|
5296
5289
|
};
|
|
5297
5290
|
|
|
5298
|
-
/*
|
|
5299
|
-
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
5300
|
-
* This software is released under MIT license.
|
|
5301
|
-
* The full license information can be found in LICENSE in the root directory of this project.
|
|
5302
|
-
*/
|
|
5303
|
-
const UP_ARROW = 38;
|
|
5304
|
-
const DOWN_ARROW = 40;
|
|
5305
|
-
const RIGHT_ARROW = 39;
|
|
5306
|
-
const LEFT_ARROW = 37;
|
|
5307
|
-
const ENTER = 13;
|
|
5308
|
-
const SPACE = 32;
|
|
5309
|
-
const SHIFT = 16;
|
|
5310
|
-
const TAB = 9;
|
|
5311
|
-
const ESC = 27;
|
|
5312
|
-
const BACKSPACE = 8;
|
|
5313
|
-
|
|
5314
5291
|
/*
|
|
5315
5292
|
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
5316
5293
|
* This software is released under MIT license.
|
|
@@ -5762,10 +5739,10 @@ class ComboboxFocusHandler {
|
|
|
5762
5739
|
// this service is only interested in keys that may move the focus
|
|
5763
5740
|
handleTextInput(event) {
|
|
5764
5741
|
let preventDefault = false;
|
|
5765
|
-
const key =
|
|
5742
|
+
const key = normalizeKey(event.key);
|
|
5766
5743
|
if (event) {
|
|
5767
5744
|
switch (key) {
|
|
5768
|
-
case
|
|
5745
|
+
case Keys.Enter:
|
|
5769
5746
|
if (this.toggleService.open && this.pseudoFocus.model) {
|
|
5770
5747
|
if (this.selectionService.multiselectable) {
|
|
5771
5748
|
this.selectionService.toggle(this.pseudoFocus.model.value);
|
|
@@ -5776,27 +5753,27 @@ class ComboboxFocusHandler {
|
|
|
5776
5753
|
preventDefault = true;
|
|
5777
5754
|
}
|
|
5778
5755
|
break;
|
|
5779
|
-
case
|
|
5756
|
+
case Keys.Space:
|
|
5780
5757
|
if (!this.toggleService.open) {
|
|
5781
5758
|
this.toggleService.open = true;
|
|
5782
5759
|
preventDefault = true;
|
|
5783
5760
|
}
|
|
5784
5761
|
break;
|
|
5785
|
-
case
|
|
5762
|
+
case Keys.ArrowUp:
|
|
5786
5763
|
this.preventViewportScrolling(event);
|
|
5787
5764
|
this.openAndMoveTo(ArrowKeyDirection.UP);
|
|
5788
5765
|
preventDefault = true;
|
|
5789
5766
|
break;
|
|
5790
|
-
case
|
|
5767
|
+
case Keys.ArrowDown:
|
|
5791
5768
|
this.preventViewportScrolling(event);
|
|
5792
5769
|
this.openAndMoveTo(ArrowKeyDirection.DOWN);
|
|
5793
5770
|
preventDefault = true;
|
|
5794
5771
|
break;
|
|
5795
5772
|
default:
|
|
5796
5773
|
// Any other keypress
|
|
5797
|
-
if (event.key !==
|
|
5798
|
-
!(this.selectionService.multiselectable && event.key ===
|
|
5799
|
-
!(event.key ===
|
|
5774
|
+
if (event.key !== Keys.Tab &&
|
|
5775
|
+
!(this.selectionService.multiselectable && event.key === Keys.Backspace) &&
|
|
5776
|
+
!(event.key === Keys.Escape) &&
|
|
5800
5777
|
!this.toggleService.open) {
|
|
5801
5778
|
this.toggleService.open = true;
|
|
5802
5779
|
}
|
|
@@ -6243,7 +6220,7 @@ class ClrCombobox extends WrappedFormControl {
|
|
|
6243
6220
|
}
|
|
6244
6221
|
onKeyUp(event) {
|
|
6245
6222
|
// if BACKSPACE in multiselect mode, delete the last pill if text is empty
|
|
6246
|
-
if (event.
|
|
6223
|
+
if (event.key === Keys.Backspace && this.multiSelect && this._searchText.length === 0) {
|
|
6247
6224
|
const multiModel = this.optionSelectionService.selectionModel.model;
|
|
6248
6225
|
if (multiModel && multiModel.length > 0) {
|
|
6249
6226
|
const lastItem = multiModel[multiModel.length - 1];
|
|
@@ -8183,20 +8160,20 @@ class ClrCalendar {
|
|
|
8183
8160
|
*/
|
|
8184
8161
|
onKeyDown(event) {
|
|
8185
8162
|
if (event && this.focusedDay) {
|
|
8186
|
-
switch (event.
|
|
8187
|
-
case
|
|
8163
|
+
switch (normalizeKey(event.key)) {
|
|
8164
|
+
case Keys.ArrowUp:
|
|
8188
8165
|
event.preventDefault();
|
|
8189
8166
|
this._dateNavigationService.incrementFocusDay(-1 * NO_OF_DAYS_IN_A_WEEK);
|
|
8190
8167
|
break;
|
|
8191
|
-
case
|
|
8168
|
+
case Keys.ArrowDown:
|
|
8192
8169
|
event.preventDefault();
|
|
8193
8170
|
this._dateNavigationService.incrementFocusDay(NO_OF_DAYS_IN_A_WEEK);
|
|
8194
8171
|
break;
|
|
8195
|
-
case
|
|
8172
|
+
case Keys.ArrowLeft:
|
|
8196
8173
|
event.preventDefault();
|
|
8197
8174
|
this._dateNavigationService.incrementFocusDay(-1);
|
|
8198
8175
|
break;
|
|
8199
|
-
case
|
|
8176
|
+
case Keys.ArrowRight:
|
|
8200
8177
|
event.preventDefault();
|
|
8201
8178
|
this._dateNavigationService.incrementFocusDay(1);
|
|
8202
8179
|
break;
|
|
@@ -8379,23 +8356,23 @@ class ClrMonthpicker {
|
|
|
8379
8356
|
// the logic is fairly simple and it didn't make sense for me
|
|
8380
8357
|
// to create extra observables just to move this logic to the service.
|
|
8381
8358
|
if (event) {
|
|
8382
|
-
const
|
|
8383
|
-
if (
|
|
8359
|
+
const key = normalizeKey(event.key);
|
|
8360
|
+
if (key === Keys.ArrowUp && this._focusedMonthIndex > 0) {
|
|
8384
8361
|
event.preventDefault();
|
|
8385
8362
|
this._focusedMonthIndex--;
|
|
8386
8363
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
8387
8364
|
}
|
|
8388
|
-
else if (
|
|
8365
|
+
else if (key === Keys.ArrowDown && this._focusedMonthIndex < 11) {
|
|
8389
8366
|
event.preventDefault();
|
|
8390
8367
|
this._focusedMonthIndex++;
|
|
8391
8368
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
8392
8369
|
}
|
|
8393
|
-
else if (
|
|
8370
|
+
else if (key === Keys.ArrowRight && this._focusedMonthIndex < 6) {
|
|
8394
8371
|
event.preventDefault();
|
|
8395
8372
|
this._focusedMonthIndex = this._focusedMonthIndex + 6;
|
|
8396
8373
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
8397
8374
|
}
|
|
8398
|
-
else if (
|
|
8375
|
+
else if (key === Keys.ArrowLeft && this._focusedMonthIndex > 5) {
|
|
8399
8376
|
event.preventDefault();
|
|
8400
8377
|
this._focusedMonthIndex = this._focusedMonthIndex - 6;
|
|
8401
8378
|
this._datepickerFocusService.focusCell(this._elRef);
|
|
@@ -8599,20 +8576,20 @@ class ClrYearpicker {
|
|
|
8599
8576
|
// the logic is fairly simple and it didn't make sense for me
|
|
8600
8577
|
// to create extra observables just to move this logic to the service.
|
|
8601
8578
|
if (event) {
|
|
8602
|
-
const
|
|
8603
|
-
if (
|
|
8579
|
+
const key = normalizeKey(event.key);
|
|
8580
|
+
if (key === Keys.ArrowUp) {
|
|
8604
8581
|
event.preventDefault();
|
|
8605
8582
|
this.incrementFocusYearBy(-1);
|
|
8606
8583
|
}
|
|
8607
|
-
else if (
|
|
8584
|
+
else if (key === Keys.ArrowDown) {
|
|
8608
8585
|
event.preventDefault();
|
|
8609
8586
|
this.incrementFocusYearBy(1);
|
|
8610
8587
|
}
|
|
8611
|
-
else if (
|
|
8588
|
+
else if (key === Keys.ArrowRight) {
|
|
8612
8589
|
event.preventDefault();
|
|
8613
8590
|
this.incrementFocusYearBy(5);
|
|
8614
8591
|
}
|
|
8615
|
-
else if (
|
|
8592
|
+
else if (key === Keys.ArrowLeft) {
|
|
8616
8593
|
event.preventDefault();
|
|
8617
8594
|
this.incrementFocusYearBy(-5);
|
|
8618
8595
|
}
|
|
@@ -13354,10 +13331,10 @@ class ClrDatagridColumnSeparator {
|
|
|
13354
13331
|
}
|
|
13355
13332
|
}
|
|
13356
13333
|
isArrowLeftKeyEvent(event) {
|
|
13357
|
-
return event.key ===
|
|
13334
|
+
return normalizeKey(event.key) === Keys.ArrowLeft;
|
|
13358
13335
|
}
|
|
13359
13336
|
isArrowRightKeyEvent(event) {
|
|
13360
|
-
return event.key ===
|
|
13337
|
+
return normalizeKey(event.key) === Keys.ArrowRight;
|
|
13361
13338
|
}
|
|
13362
13339
|
ngOnDestroy() {
|
|
13363
13340
|
this.unlisteners.forEach(unlistener => unlistener());
|
|
@@ -16355,7 +16332,7 @@ class ClrDatagridDetail {
|
|
|
16355
16332
|
}
|
|
16356
16333
|
}
|
|
16357
16334
|
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 });
|
|
16358
|
-
ClrDatagridDetail.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrDatagridDetail, selector: "clr-dg-detail", host: { listeners: { "document:keyup.
|
|
16335
|
+
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: `
|
|
16359
16336
|
<div
|
|
16360
16337
|
[clrFocusTrap]="{ strict: false }"
|
|
16361
16338
|
class="datagrid-detail-pane-content"
|
|
@@ -16400,7 +16377,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
16400
16377
|
args: [ClrDatagridDetailHeader]
|
|
16401
16378
|
}], closeCheck: [{
|
|
16402
16379
|
type: HostListener,
|
|
16403
|
-
args: ['document:keyup.
|
|
16380
|
+
args: ['document:keyup.escape']
|
|
16404
16381
|
}] } });
|
|
16405
16382
|
|
|
16406
16383
|
/*
|
|
@@ -19695,32 +19672,32 @@ class ClrTreeNode {
|
|
|
19695
19672
|
// By default, pressing arrow key makes AT focus go into the nested content of the item.
|
|
19696
19673
|
preventArrowKeyScroll(event);
|
|
19697
19674
|
// https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard-interaction-22
|
|
19698
|
-
switch (
|
|
19699
|
-
case
|
|
19675
|
+
switch (normalizeKey(event.key)) {
|
|
19676
|
+
case Keys.ArrowUp:
|
|
19700
19677
|
this.focusManager.focusNodeAbove(this._model);
|
|
19701
19678
|
break;
|
|
19702
|
-
case
|
|
19679
|
+
case Keys.ArrowDown:
|
|
19703
19680
|
this.focusManager.focusNodeBelow(this._model);
|
|
19704
19681
|
break;
|
|
19705
|
-
case
|
|
19682
|
+
case Keys.ArrowRight:
|
|
19706
19683
|
this.expandOrFocusFirstChild();
|
|
19707
19684
|
break;
|
|
19708
|
-
case
|
|
19685
|
+
case Keys.ArrowLeft:
|
|
19709
19686
|
this.collapseOrFocusParent();
|
|
19710
19687
|
break;
|
|
19711
|
-
case
|
|
19688
|
+
case Keys.Home:
|
|
19712
19689
|
event.preventDefault();
|
|
19713
19690
|
this.focusManager.focusFirstVisibleNode();
|
|
19714
19691
|
break;
|
|
19715
|
-
case
|
|
19692
|
+
case Keys.End:
|
|
19716
19693
|
event.preventDefault();
|
|
19717
19694
|
this.focusManager.focusLastVisibleNode();
|
|
19718
19695
|
break;
|
|
19719
|
-
case
|
|
19696
|
+
case Keys.Enter:
|
|
19720
19697
|
this.toggleExpandOrTriggerDefault();
|
|
19721
19698
|
break;
|
|
19722
|
-
case
|
|
19723
|
-
case
|
|
19699
|
+
case Keys.Space:
|
|
19700
|
+
case Keys.Spacebar:
|
|
19724
19701
|
// to prevent scrolling on space key in this specific case
|
|
19725
19702
|
event.preventDefault();
|
|
19726
19703
|
this.toggleExpandOrTriggerDefault();
|
|
@@ -20087,10 +20064,10 @@ class DropdownFocusHandler {
|
|
|
20087
20064
|
// whether root container or not, tab key should always toggle (i.e. close) the container
|
|
20088
20065
|
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.tab', event => this.toggleService.toggleWithEvent(event)));
|
|
20089
20066
|
if (this.parent) {
|
|
20090
|
-
// if it's a nested container, pressing
|
|
20067
|
+
// if it's a nested container, pressing escape has the same effect as pressing left key, which closes the current
|
|
20091
20068
|
// popup and moves up to its parent. Here, we stop propagation so that the parent container
|
|
20092
|
-
// doesn't receive the
|
|
20093
|
-
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.
|
|
20069
|
+
// doesn't receive the escape keydown
|
|
20070
|
+
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.escape', event => {
|
|
20094
20071
|
this.focusService.move(ArrowKeyDirection.LEFT);
|
|
20095
20072
|
event.stopPropagation();
|
|
20096
20073
|
}));
|
|
@@ -20098,8 +20075,8 @@ class DropdownFocusHandler {
|
|
|
20098
20075
|
else {
|
|
20099
20076
|
// The root container is the only one we register to the focus service, others do not need focus
|
|
20100
20077
|
this.focusService.registerContainer(el);
|
|
20101
|
-
// The root container will simply close the container when
|
|
20102
|
-
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.
|
|
20078
|
+
// The root container will simply close the container when escape key is pressed
|
|
20079
|
+
this._unlistenFuncs.push(this.renderer.listen(el, 'keydown.escape', event => this.toggleService.toggleWithEvent(event)));
|
|
20103
20080
|
// When the user moves focus outside of the menu, we close the dropdown
|
|
20104
20081
|
this._unlistenFuncs.push(this.renderer.listen(el, 'blur', event => {
|
|
20105
20082
|
// we clear out any existing focus on the items
|
|
@@ -20676,7 +20653,6 @@ class Popover {
|
|
|
20676
20653
|
* This software is released under MIT license.
|
|
20677
20654
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
20678
20655
|
*/
|
|
20679
|
-
// Literally any annotation would work here, but writing our own @HoneyBadger annotation feels overkill.
|
|
20680
20656
|
class AbstractPopover {
|
|
20681
20657
|
constructor(injector, parentHost) {
|
|
20682
20658
|
this.parentHost = parentHost;
|
|
@@ -20755,7 +20731,7 @@ class AbstractPopover {
|
|
|
20755
20731
|
this.ngZone.runOutsideAngular(() => {
|
|
20756
20732
|
this.documentESCListener = this.renderer.listen('document', 'keydown', event => {
|
|
20757
20733
|
if (event && event.key) {
|
|
20758
|
-
if (event.key ===
|
|
20734
|
+
if (normalizeKey(event.key) === Keys.Escape) {
|
|
20759
20735
|
this.ngZone.run(() => {
|
|
20760
20736
|
this.toggleService.open = false;
|
|
20761
20737
|
this.ref.markForCheck();
|
|
@@ -22838,7 +22814,7 @@ ClrTabs.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3
|
|
|
22838
22814
|
<!--tab links in overflow menu-->
|
|
22839
22815
|
<clr-tab-overflow-content
|
|
22840
22816
|
*ngIf="toggleService.open"
|
|
22841
|
-
(document:keydown.
|
|
22817
|
+
(document:keydown.escape)="closeOnEscapeKey()"
|
|
22842
22818
|
(document:click)="closeOnOutsideClick($event, tabOverflowTrigger)"
|
|
22843
22819
|
(focusout)="closeOnFocusOut($event)"
|
|
22844
22820
|
>
|
|
@@ -22902,7 +22878,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
22902
22878
|
<!--tab links in overflow menu-->
|
|
22903
22879
|
<clr-tab-overflow-content
|
|
22904
22880
|
*ngIf="toggleService.open"
|
|
22905
|
-
(document:keydown.
|
|
22881
|
+
(document:keydown.escape)="closeOnEscapeKey()"
|
|
22906
22882
|
(document:click)="closeOnOutsideClick($event, tabOverflowTrigger)"
|
|
22907
22883
|
(focusout)="closeOnFocusOut($event)"
|
|
22908
22884
|
>
|
|
@@ -23951,6 +23927,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
23951
23927
|
type: Injectable
|
|
23952
23928
|
}] });
|
|
23953
23929
|
|
|
23930
|
+
/*
|
|
23931
|
+
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
23932
|
+
* This software is released under MIT license.
|
|
23933
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
23934
|
+
*/
|
|
23935
|
+
class TooltipMouseService {
|
|
23936
|
+
constructor(toggleService) {
|
|
23937
|
+
this.toggleService = toggleService;
|
|
23938
|
+
}
|
|
23939
|
+
onMouseEnterTrigger() {
|
|
23940
|
+
this.mouseOverTrigger = true;
|
|
23941
|
+
this.toggleService.open = true;
|
|
23942
|
+
}
|
|
23943
|
+
onMouseLeaveTrigger() {
|
|
23944
|
+
this.mouseOverTrigger = false;
|
|
23945
|
+
this.hideIfMouseOut();
|
|
23946
|
+
}
|
|
23947
|
+
onMouseEnterContent() {
|
|
23948
|
+
this.mouseOverContent = true;
|
|
23949
|
+
}
|
|
23950
|
+
onMouseLeaveContent() {
|
|
23951
|
+
this.mouseOverContent = false;
|
|
23952
|
+
this.hideIfMouseOut();
|
|
23953
|
+
}
|
|
23954
|
+
hideIfMouseOut() {
|
|
23955
|
+
// A zero timeout is used so that the code has a chance to update
|
|
23956
|
+
// the `mouseOverContent` property after the user moves the mouse from the trigger to the content.
|
|
23957
|
+
setTimeout(() => {
|
|
23958
|
+
if (!this.mouseOverTrigger && !this.mouseOverContent) {
|
|
23959
|
+
this.toggleService.open = false;
|
|
23960
|
+
}
|
|
23961
|
+
}, 0);
|
|
23962
|
+
}
|
|
23963
|
+
}
|
|
23964
|
+
TooltipMouseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TooltipMouseService, deps: [{ token: ClrPopoverToggleService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
23965
|
+
TooltipMouseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TooltipMouseService });
|
|
23966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TooltipMouseService, decorators: [{
|
|
23967
|
+
type: Injectable
|
|
23968
|
+
}], ctorParameters: function () { return [{ type: ClrPopoverToggleService }]; } });
|
|
23969
|
+
|
|
23954
23970
|
/*
|
|
23955
23971
|
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
|
|
23956
23972
|
* This software is released under MIT license.
|
|
@@ -23959,7 +23975,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
23959
23975
|
class ClrTooltip {
|
|
23960
23976
|
}
|
|
23961
23977
|
ClrTooltip.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
23962
|
-
ClrTooltip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltip, selector: "clr-tooltip", host: { properties: { "class.tooltip": "true" } }, providers: [
|
|
23978
|
+
ClrTooltip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltip, selector: "clr-tooltip", host: { properties: { "class.tooltip": "true" } }, providers: [
|
|
23979
|
+
ClrPopoverToggleService,
|
|
23980
|
+
{ provide: POPOVER_HOST_ANCHOR, useExisting: ElementRef },
|
|
23981
|
+
TooltipIdService,
|
|
23982
|
+
TooltipMouseService,
|
|
23983
|
+
], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
23963
23984
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltip, decorators: [{
|
|
23964
23985
|
type: Component,
|
|
23965
23986
|
args: [{
|
|
@@ -23968,7 +23989,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
23968
23989
|
host: {
|
|
23969
23990
|
'[class.tooltip]': 'true',
|
|
23970
23991
|
},
|
|
23971
|
-
providers: [
|
|
23992
|
+
providers: [
|
|
23993
|
+
ClrPopoverToggleService,
|
|
23994
|
+
{ provide: POPOVER_HOST_ANCHOR, useExisting: ElementRef },
|
|
23995
|
+
TooltipIdService,
|
|
23996
|
+
TooltipMouseService,
|
|
23997
|
+
],
|
|
23972
23998
|
}]
|
|
23973
23999
|
}] });
|
|
23974
24000
|
|
|
@@ -23991,9 +24017,10 @@ const SIZES = ['xs', 'sm', 'md', 'lg'];
|
|
|
23991
24017
|
const defaultPosition = 'right';
|
|
23992
24018
|
const defaultSize = 'sm';
|
|
23993
24019
|
class ClrTooltipContent extends AbstractPopover {
|
|
23994
|
-
constructor(injector, parentHost, tooltipIdService) {
|
|
24020
|
+
constructor(injector, parentHost, tooltipIdService, tooltipMouseService) {
|
|
23995
24021
|
super(injector, parentHost);
|
|
23996
24022
|
this.tooltipIdService = tooltipIdService;
|
|
24023
|
+
this.tooltipMouseService = tooltipMouseService;
|
|
23997
24024
|
if (!parentHost) {
|
|
23998
24025
|
throw new Error('clr-tooltip-content should only be used inside of a clr-tooltip');
|
|
23999
24026
|
}
|
|
@@ -24059,13 +24086,19 @@ class ClrTooltipContent extends AbstractPopover {
|
|
|
24059
24086
|
this.size = this.size || defaultSize;
|
|
24060
24087
|
this.position = this.position || defaultPosition;
|
|
24061
24088
|
}
|
|
24089
|
+
onMouseEnter() {
|
|
24090
|
+
this.tooltipMouseService.onMouseEnterContent();
|
|
24091
|
+
}
|
|
24092
|
+
onMouseLeave() {
|
|
24093
|
+
this.tooltipMouseService.onMouseLeaveContent();
|
|
24094
|
+
}
|
|
24062
24095
|
updateCssClass({ oldClass, newClass }) {
|
|
24063
24096
|
this.renderer.removeClass(this.el.nativeElement, oldClass);
|
|
24064
24097
|
this.renderer.addClass(this.el.nativeElement, newClass);
|
|
24065
24098
|
}
|
|
24066
24099
|
}
|
|
24067
|
-
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 });
|
|
24068
|
-
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 });
|
|
24100
|
+
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 });
|
|
24101
|
+
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 });
|
|
24069
24102
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipContent, decorators: [{
|
|
24070
24103
|
type: Component,
|
|
24071
24104
|
args: [{
|
|
@@ -24083,7 +24116,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24083
24116
|
}, {
|
|
24084
24117
|
type: Inject,
|
|
24085
24118
|
args: [POPOVER_HOST_ANCHOR]
|
|
24086
|
-
}] }, { type: TooltipIdService }]; }, propDecorators: { id: [{
|
|
24119
|
+
}] }, { type: TooltipIdService }, { type: TooltipMouseService }]; }, propDecorators: { id: [{
|
|
24087
24120
|
type: Input
|
|
24088
24121
|
}], position: [{
|
|
24089
24122
|
type: Input,
|
|
@@ -24091,6 +24124,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24091
24124
|
}], size: [{
|
|
24092
24125
|
type: Input,
|
|
24093
24126
|
args: ['clrSize']
|
|
24127
|
+
}], onMouseEnter: [{
|
|
24128
|
+
type: HostListener,
|
|
24129
|
+
args: ['mouseenter']
|
|
24130
|
+
}], onMouseLeave: [{
|
|
24131
|
+
type: HostListener,
|
|
24132
|
+
args: ['mouseleave']
|
|
24094
24133
|
}] } });
|
|
24095
24134
|
|
|
24096
24135
|
/*
|
|
@@ -24099,25 +24138,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24099
24138
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
24100
24139
|
*/
|
|
24101
24140
|
class ClrTooltipTrigger {
|
|
24102
|
-
constructor(toggleService, tooltipIdService) {
|
|
24141
|
+
constructor(toggleService, tooltipIdService, tooltipMouseService) {
|
|
24103
24142
|
this.toggleService = toggleService;
|
|
24104
24143
|
this.tooltipIdService = tooltipIdService;
|
|
24144
|
+
this.tooltipMouseService = tooltipMouseService;
|
|
24105
24145
|
this.subs = [];
|
|
24106
24146
|
// The aria-described by comes from the id of content. It
|
|
24107
24147
|
this.subs.push(this.tooltipIdService.id.subscribe(tooltipId => (this.ariaDescribedBy = tooltipId)));
|
|
24108
24148
|
}
|
|
24149
|
+
ngOnDestroy() {
|
|
24150
|
+
this.subs.forEach(sub => sub.unsubscribe());
|
|
24151
|
+
}
|
|
24109
24152
|
showTooltip() {
|
|
24110
24153
|
this.toggleService.open = true;
|
|
24111
24154
|
}
|
|
24112
24155
|
hideTooltip() {
|
|
24113
24156
|
this.toggleService.open = false;
|
|
24114
24157
|
}
|
|
24115
|
-
|
|
24116
|
-
this.
|
|
24158
|
+
onMouseEnter() {
|
|
24159
|
+
this.tooltipMouseService.onMouseEnterTrigger();
|
|
24160
|
+
}
|
|
24161
|
+
onMouseLeave() {
|
|
24162
|
+
this.tooltipMouseService.onMouseLeaveTrigger();
|
|
24117
24163
|
}
|
|
24118
24164
|
}
|
|
24119
|
-
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 });
|
|
24120
|
-
ClrTooltipTrigger.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ClrTooltipTrigger, selector: "[clrTooltipTrigger]", host: { attributes: { "tabindex": "0" }, listeners: { "
|
|
24165
|
+
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 });
|
|
24166
|
+
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 });
|
|
24121
24167
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClrTooltipTrigger, decorators: [{
|
|
24122
24168
|
type: Directive,
|
|
24123
24169
|
args: [{
|
|
@@ -24129,18 +24175,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
24129
24175
|
'[attr.role]': '"button"',
|
|
24130
24176
|
},
|
|
24131
24177
|
}]
|
|
24132
|
-
}], ctorParameters: function () { return [{ type: ClrPopoverToggleService }, { type: TooltipIdService }]; }, propDecorators: { showTooltip: [{
|
|
24133
|
-
type: HostListener,
|
|
24134
|
-
args: ['mouseenter']
|
|
24135
|
-
}, {
|
|
24178
|
+
}], ctorParameters: function () { return [{ type: ClrPopoverToggleService }, { type: TooltipIdService }, { type: TooltipMouseService }]; }, propDecorators: { showTooltip: [{
|
|
24136
24179
|
type: HostListener,
|
|
24137
24180
|
args: ['focus']
|
|
24138
24181
|
}], hideTooltip: [{
|
|
24139
|
-
type: HostListener,
|
|
24140
|
-
args: ['mouseleave']
|
|
24141
|
-
}, {
|
|
24142
24182
|
type: HostListener,
|
|
24143
24183
|
args: ['blur']
|
|
24184
|
+
}], onMouseEnter: [{
|
|
24185
|
+
type: HostListener,
|
|
24186
|
+
args: ['mouseenter']
|
|
24187
|
+
}], onMouseLeave: [{
|
|
24188
|
+
type: HostListener,
|
|
24189
|
+
args: ['mouseleave']
|
|
24144
24190
|
}] } });
|
|
24145
24191
|
|
|
24146
24192
|
/*
|