carbon-components-angular 5.56.6 → 5.57.1
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/README.md +23 -6
- package/combo-button/combo-button.component.d.ts +99 -0
- package/combo-button/combo-button.module.d.ts +31 -0
- package/combo-button/index.d.ts +22 -0
- package/context-menu/context-menu-divider.component.d.ts +1 -1
- package/context-menu/context-menu-group.component.d.ts +1 -1
- package/context-menu/context-menu-item.component.d.ts +6 -1
- package/context-menu/context-menu.component.d.ts +11 -7
- package/context-menu/context-menu.types.d.ts +27 -0
- package/context-menu/index.d.ts +1 -0
- package/docs/documentation/components/Accordion.html +1 -1
- package/docs/documentation/components/AccordionItem.html +1 -1
- package/docs/documentation/components/ActionableNotification.html +1 -1
- package/docs/documentation/components/AlertModal.html +1 -1
- package/docs/documentation/components/BaseIconButton.html +1 -1
- package/docs/documentation/components/BaseNotification.html +1 -1
- package/docs/documentation/components/BaseTabHeader.html +1 -1
- package/docs/documentation/components/Breadcrumb.html +1 -1
- package/docs/documentation/components/BreadcrumbItemComponent.html +1 -1
- package/docs/documentation/components/ButtonSet.html +1 -1
- package/docs/documentation/components/Checkbox.html +1 -1
- package/docs/documentation/components/ClickableTile.html +1 -1
- package/docs/documentation/components/CodeSnippet.html +1 -1
- package/docs/documentation/components/ComboBox.html +1 -1
- package/docs/documentation/components/ComboButtonComponent.html +2264 -0
- package/docs/documentation/components/ContainedList.html +1 -1
- package/docs/documentation/components/ContainedListItem.html +1 -1
- package/docs/documentation/components/ContentSwitcher.html +1 -1
- package/docs/documentation/components/ContextMenuComponent.html +147 -164
- package/docs/documentation/components/ContextMenuDividerComponent.html +3 -3
- package/docs/documentation/components/ContextMenuGroupComponent.html +4 -4
- package/docs/documentation/components/ContextMenuItemComponent.html +218 -66
- package/docs/documentation/components/DatePicker.html +1 -1
- package/docs/documentation/components/DatePickerInput.html +1 -1
- package/docs/documentation/components/Dialog.html +1 -1
- package/docs/documentation/components/Documentation.html +1 -1
- package/docs/documentation/components/Dropdown.html +1 -1
- package/docs/documentation/components/DropdownList.html +1 -1
- package/docs/documentation/components/ExpandableTile.html +1 -1
- package/docs/documentation/components/FileComponent.html +1 -1
- package/docs/documentation/components/FileUploader.html +1 -1
- package/docs/documentation/components/Hamburger.html +1 -1
- package/docs/documentation/components/Header.html +1 -1
- package/docs/documentation/components/HeaderAction.html +1 -1
- package/docs/documentation/components/HeaderGlobal.html +1 -1
- package/docs/documentation/components/HeaderItem.html +1 -1
- package/docs/documentation/components/HeaderMenu.html +1 -1
- package/docs/documentation/components/HeaderNavigation.html +1 -1
- package/docs/documentation/components/IconButton.html +1 -1
- package/docs/documentation/components/InlineLoading.html +1 -1
- package/docs/documentation/components/Label.html +1 -1
- package/docs/documentation/components/ListColumn.html +1 -1
- package/docs/documentation/components/ListHeader.html +1 -1
- package/docs/documentation/components/ListRow.html +1 -1
- package/docs/documentation/components/Loading.html +1 -1
- package/docs/documentation/components/MenuButtonComponent.html +1931 -0
- package/docs/documentation/components/Modal.html +1 -1
- package/docs/documentation/components/ModalFooter.html +1 -1
- package/docs/documentation/components/ModalHeader.html +1 -1
- package/docs/documentation/components/Notification.html +1 -1
- package/docs/documentation/components/NumberComponent.html +1 -1
- package/docs/documentation/components/OverflowMenu.html +1 -1
- package/docs/documentation/components/OverflowMenuCustomPane.html +1 -1
- package/docs/documentation/components/OverflowMenuOption.html +1 -1
- package/docs/documentation/components/OverflowMenuPane.html +1 -1
- package/docs/documentation/components/Overlay.html +1 -1
- package/docs/documentation/components/Pagination.html +1 -1
- package/docs/documentation/components/PaginationNav.html +1 -1
- package/docs/documentation/components/PaginationNavItem.html +1 -1
- package/docs/documentation/components/PaginationOverflow.html +1 -1
- package/docs/documentation/components/Panel.html +1 -1
- package/docs/documentation/components/PasswordInputLabelComponent.html +1 -1
- package/docs/documentation/components/Placeholder.html +1 -1
- package/docs/documentation/components/PopoverContent.html +1 -1
- package/docs/documentation/components/ProgressBar.html +1 -1
- package/docs/documentation/components/ProgressIndicator.html +1 -1
- package/docs/documentation/components/Radio.html +1 -1
- package/docs/documentation/components/RadioGroup.html +1 -1
- package/docs/documentation/components/Search.html +1 -1
- package/docs/documentation/components/Select.html +1 -1
- package/docs/documentation/components/SelectionTile.html +1 -1
- package/docs/documentation/components/SideNav.html +1 -1
- package/docs/documentation/components/SideNavItem.html +1 -1
- package/docs/documentation/components/SideNavMenu.html +1 -1
- package/docs/documentation/components/SkeletonPlaceholder.html +1 -1
- package/docs/documentation/components/SkeletonText.html +1 -1
- package/docs/documentation/components/Slider.html +1 -1
- package/docs/documentation/components/StructuredList.html +1 -1
- package/docs/documentation/components/SwitcherList.html +1 -1
- package/docs/documentation/components/SwitcherListItem.html +1 -1
- package/docs/documentation/components/Tab.html +1 -1
- package/docs/documentation/components/TabHeaderGroup.html +1 -1
- package/docs/documentation/components/TabHeaders.html +1 -1
- package/docs/documentation/components/TabSkeleton.html +1 -1
- package/docs/documentation/components/Table.html +1 -1
- package/docs/documentation/components/TableBody.html +1 -1
- package/docs/documentation/components/TableCheckbox.html +1 -1
- package/docs/documentation/components/TableContainer.html +1 -1
- package/docs/documentation/components/TableData.html +1 -1
- package/docs/documentation/components/TableExpandButton.html +1 -1
- package/docs/documentation/components/TableExpandedRow.html +1 -1
- package/docs/documentation/components/TableHead.html +1 -1
- package/docs/documentation/components/TableHeadCell.html +1 -1
- package/docs/documentation/components/TableHeadCheckbox.html +1 -1
- package/docs/documentation/components/TableHeadExpand.html +1 -1
- package/docs/documentation/components/TableHeader.html +1 -1
- package/docs/documentation/components/TableRadio.html +1 -1
- package/docs/documentation/components/TableRowComponent.html +1 -1
- package/docs/documentation/components/TableToolbar.html +1 -1
- package/docs/documentation/components/TableToolbarActions.html +1 -1
- package/docs/documentation/components/TableToolbarContent.html +1 -1
- package/docs/documentation/components/TableToolbarSearch.html +1 -1
- package/docs/documentation/components/Tabs.html +1 -1
- package/docs/documentation/components/Tag.html +1 -1
- package/docs/documentation/components/TagFilter.html +1 -1
- package/docs/documentation/components/TagOperationalComponent.html +1 -1
- package/docs/documentation/components/TagSelectableComponent.html +1 -1
- package/docs/documentation/components/TextInputLabelComponent.html +1 -1
- package/docs/documentation/components/TextareaLabelComponent.html +1 -1
- package/docs/documentation/components/Tile.html +1 -1
- package/docs/documentation/components/TileGroup.html +1 -1
- package/docs/documentation/components/TimePicker.html +1 -1
- package/docs/documentation/components/TimePickerSelect.html +1 -1
- package/docs/documentation/components/Toast.html +1 -1
- package/docs/documentation/components/Toggle.html +1 -1
- package/docs/documentation/components/Toggletip.html +4 -4
- package/docs/documentation/components/Tooltip.html +1 -1
- package/docs/documentation/components/TooltipDefinition.html +1 -1
- package/docs/documentation/components/TreeNodeComponent.html +1 -1
- package/docs/documentation/components/TreeViewComponent.html +1 -1
- package/docs/documentation/coverage.html +40 -4
- package/docs/documentation/dependencies.html +1 -1
- package/docs/documentation/graph/dependencies.svg +3058 -2934
- package/docs/documentation/index.html +17 -6
- package/docs/documentation/interfaces/ItemClickEvent.html +437 -0
- package/docs/documentation/js/menu-wc.js +37 -0
- package/docs/documentation/js/menu-wc_es5.js +1 -1
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/miscellaneous/typealiases.html +42 -0
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ComboBoxModule.html +4 -4
- package/docs/documentation/modules/ComboButtonModule/dependencies.svg +106 -0
- package/docs/documentation/modules/ComboButtonModule.html +397 -0
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DatePickerInputModule.html +4 -4
- package/docs/documentation/modules/DatePickerModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DatePickerModule.html +4 -4
- package/docs/documentation/modules/GridModule/dependencies.svg +60 -60
- package/docs/documentation/modules/GridModule.html +60 -60
- package/docs/documentation/modules/LoadingModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LoadingModule.html +4 -4
- package/docs/documentation/modules/MenuButtonModule/dependencies.svg +106 -0
- package/docs/documentation/modules/MenuButtonModule.html +398 -0
- package/docs/documentation/modules/NumberModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NumberModule.html +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +62 -58
- package/docs/documentation/modules/RadioModule.html +62 -58
- package/docs/documentation/modules/SearchModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SearchModule.html +4 -4
- package/docs/documentation/modules/SelectModule/dependencies.svg +43 -43
- package/docs/documentation/modules/SelectModule.html +43 -43
- package/docs/documentation/modules/SliderModule/dependencies.svg +6 -6
- package/docs/documentation/modules/SliderModule.html +6 -6
- package/docs/documentation/modules/TagModule/dependencies.svg +37 -37
- package/docs/documentation/modules/TagModule.html +37 -37
- package/docs/documentation/modules/TilesModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TilesModule.html +4 -4
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +6 -6
- package/docs/documentation/modules/TimePickerModule.html +6 -6
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TimePickerSelectModule.html +4 -4
- package/docs/documentation/modules/ToggleModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggleModule.html +4 -4
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +39 -39
- package/docs/documentation/modules/ToggletipModule.html +39 -39
- package/docs/documentation/modules/TooltipModule/dependencies.svg +29 -29
- package/docs/documentation/modules/TooltipModule.html +29 -29
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +36 -36
- package/docs/documentation/modules/TreeviewModule.html +36 -36
- package/docs/documentation/modules.html +34 -0
- package/docs/documentation/overview.html +3061 -2937
- package/docs/documentation.json +1937 -498
- package/docs/storybook/1125.37c137fa.iframe.bundle.js +1 -0
- package/docs/storybook/4292.3a543fed.iframe.bundle.js +1 -0
- package/docs/storybook/6702.f2acb76e.iframe.bundle.js +1 -0
- package/docs/storybook/combo-button-combo-button-stories.17bfb9ad.iframe.bundle.js +1 -0
- package/docs/storybook/context-menu-context-menu-stories.eb5edb41.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/index.json +1 -1
- package/docs/storybook/main.d513967b.iframe.bundle.js +1 -0
- package/docs/storybook/menu-button-menu-button-stories.869bfd47.iframe.bundle.js +1 -0
- package/docs/storybook/popover-popover-stories.ea5149e0.iframe.bundle.js +1 -0
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/runtime~main.6e5bcadd.iframe.bundle.js +1 -0
- package/docs/storybook/stories.json +1 -1
- package/docs/storybook/tag-tag-stories.7b925787.iframe.bundle.js +1 -0
- package/docs/storybook/{toggletip-toggletip-stories.f20fbe75.iframe.bundle.js → toggletip-toggletip-stories.44da6843.iframe.bundle.js} +1 -1
- package/esm2020/combo-button/carbon-components-angular-combo-button.mjs +5 -0
- package/esm2020/combo-button/combo-button.component.mjs +302 -0
- package/esm2020/combo-button/combo-button.module.mjs +32 -0
- package/esm2020/combo-button/index.mjs +3 -0
- package/esm2020/context-menu/context-menu-divider.component.mjs +3 -3
- package/esm2020/context-menu/context-menu-group.component.mjs +3 -3
- package/esm2020/context-menu/context-menu-item.component.mjs +33 -3
- package/esm2020/context-menu/context-menu.component.mjs +27 -20
- package/esm2020/context-menu/context-menu.types.mjs +2 -0
- package/esm2020/context-menu/index.mjs +2 -1
- package/esm2020/index.mjs +2 -1
- package/esm2020/menu-button/carbon-components-angular-menu-button.mjs +5 -0
- package/esm2020/menu-button/index.mjs +3 -0
- package/esm2020/menu-button/menu-button.component.mjs +265 -0
- package/esm2020/menu-button/menu-button.module.mjs +33 -0
- package/esm2020/toggletip/toggletip.component.mjs +3 -3
- package/fesm2015/carbon-components-angular-combo-button.mjs +338 -0
- package/fesm2015/carbon-components-angular-combo-button.mjs.map +1 -0
- package/fesm2015/carbon-components-angular-context-menu.mjs +62 -25
- package/fesm2015/carbon-components-angular-context-menu.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-menu-button.mjs +302 -0
- package/fesm2015/carbon-components-angular-menu-button.mjs.map +1 -0
- package/fesm2015/carbon-components-angular-toggletip.mjs +2 -2
- package/fesm2015/carbon-components-angular-toggletip.mjs.map +1 -1
- package/fesm2015/carbon-components-angular.mjs +1 -0
- package/fesm2015/carbon-components-angular.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-combo-button.mjs +337 -0
- package/fesm2020/carbon-components-angular-combo-button.mjs.map +1 -0
- package/fesm2020/carbon-components-angular-context-menu.mjs +62 -25
- package/fesm2020/carbon-components-angular-context-menu.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-menu-button.mjs +301 -0
- package/fesm2020/carbon-components-angular-menu-button.mjs.map +1 -0
- package/fesm2020/carbon-components-angular-toggletip.mjs +2 -2
- package/fesm2020/carbon-components-angular-toggletip.mjs.map +1 -1
- package/fesm2020/carbon-components-angular.mjs +1 -0
- package/fesm2020/carbon-components-angular.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/menu-button/index.d.ts +22 -0
- package/menu-button/menu-button.component.d.ts +88 -0
- package/menu-button/menu-button.module.d.ts +31 -0
- package/package.json +18 -2
- package/docs/storybook/1562.1e6a79b6.iframe.bundle.js +0 -1
- package/docs/storybook/6702.8b6fb391.iframe.bundle.js +0 -1
- package/docs/storybook/context-menu-context-menu-stories.7c62ce72.iframe.bundle.js +0 -1
- package/docs/storybook/main.9bc55d67.iframe.bundle.js +0 -1
- package/docs/storybook/popover-popover-stories.a91784a3.iframe.bundle.js +0 -1
- package/docs/storybook/runtime~main.31991a82.iframe.bundle.js +0 -1
- package/docs/storybook/tag-tag-stories.c5c2cc86.iframe.bundle.js +0 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Input, ContentChildren, HostBinding, Output, ViewChild, NgModule } from '@angular/core';
|
|
4
|
+
import { autoUpdate, computePosition, flip } from '@floating-ui/dom';
|
|
5
|
+
import * as i3 from 'carbon-components-angular/context-menu';
|
|
6
|
+
import { ContextMenuItemComponent, ContextMenuModule } from 'carbon-components-angular/context-menu';
|
|
7
|
+
import * as i1 from 'carbon-components-angular/button';
|
|
8
|
+
import { ButtonModule } from 'carbon-components-angular/button';
|
|
9
|
+
import * as i2 from 'carbon-components-angular/icon';
|
|
10
|
+
import { IconModule } from 'carbon-components-angular/icon';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
|
|
13
|
+
class ComboButtonComponent {
|
|
14
|
+
constructor(ngZone, renderer, hostElement, viewContainerRef, changeDetectorRef) {
|
|
15
|
+
this.ngZone = ngZone;
|
|
16
|
+
this.renderer = renderer;
|
|
17
|
+
this.hostElement = hostElement;
|
|
18
|
+
this.viewContainerRef = viewContainerRef;
|
|
19
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
20
|
+
this.comboId = `combo-button-${ComboButtonComponent.comboButtonCounter++}`;
|
|
21
|
+
this.size = "lg";
|
|
22
|
+
this.disabled = false;
|
|
23
|
+
this.menuAlignment = "bottom";
|
|
24
|
+
this.tooltipAutoAlign = false;
|
|
25
|
+
this.tooltipPlacement = "bottom";
|
|
26
|
+
this.open = false;
|
|
27
|
+
this.actionClick = new EventEmitter();
|
|
28
|
+
this.comboButtonContainer = true;
|
|
29
|
+
this.documentClick = this.handleFocusOut.bind(this);
|
|
30
|
+
this.subscriptions = [];
|
|
31
|
+
this._alignment = "bottom";
|
|
32
|
+
}
|
|
33
|
+
// Listen for click & determine if menu should close
|
|
34
|
+
set projectedMenuItems(itemList) {
|
|
35
|
+
// Reset in case user dynamically updates menu item
|
|
36
|
+
this.subscriptions.forEach((sub) => sub === null || sub === void 0 ? void 0 : sub.unsubscribe());
|
|
37
|
+
this.subscriptions = [];
|
|
38
|
+
itemList.forEach((item) => {
|
|
39
|
+
this.subscriptions.push(item.itemClick.subscribe((clickEvent) => this.handleMenuItemClick(clickEvent)));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
get sizeLg() { return this.size === "lg"; }
|
|
43
|
+
get sizeMd() { return this.size === "md"; }
|
|
44
|
+
get sizeSm() { return this.size === "sm"; }
|
|
45
|
+
get ariaOwns() {
|
|
46
|
+
return this.open ? this.comboId : undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* In case user updates alignment, store initial value.
|
|
50
|
+
* This allows us to test user passed alignment on each open
|
|
51
|
+
*/
|
|
52
|
+
ngOnChanges(changes) {
|
|
53
|
+
if (changes.menuAlignment) {
|
|
54
|
+
this._alignment = changes.menuAlignment.currentValue;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* If user has passed in true for open, we dynamically open the menu
|
|
59
|
+
*/
|
|
60
|
+
ngAfterViewInit() {
|
|
61
|
+
if (this.open) {
|
|
62
|
+
this.open = !this.open;
|
|
63
|
+
this.toggleMenu();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Clean up Floating-ui & subscriptions
|
|
68
|
+
*/
|
|
69
|
+
ngOnDestroy() {
|
|
70
|
+
this.cleanUp();
|
|
71
|
+
this.subscriptions.forEach((sub) => sub.unsubscribe());
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* As of now, menu button does not support nexted menu, on button click it should close
|
|
75
|
+
*/
|
|
76
|
+
handleMenuItemClick(event) {
|
|
77
|
+
// If event is not type radio/checkbox, we close the menu
|
|
78
|
+
if (!event.type) {
|
|
79
|
+
this.toggleMenu();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* On body click, close the menu
|
|
84
|
+
* @param event
|
|
85
|
+
*/
|
|
86
|
+
handleFocusOut(event) {
|
|
87
|
+
if (!this.hostElement.nativeElement.contains(event.target)) {
|
|
88
|
+
this.toggleMenu();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Clean up `autoUpdate` if auto alignment is enabled
|
|
93
|
+
*/
|
|
94
|
+
cleanUp() {
|
|
95
|
+
document.removeEventListener("click", this.documentClick);
|
|
96
|
+
if (this.unmountFloatingElement) {
|
|
97
|
+
this.menuRef.remove();
|
|
98
|
+
this.viewContainerRef.clear();
|
|
99
|
+
this.unmountFloatingElement();
|
|
100
|
+
}
|
|
101
|
+
this.unmountFloatingElement = undefined;
|
|
102
|
+
// On all instances of menu closing, make sure icon direction is correct
|
|
103
|
+
this.changeDetectorRef.markForCheck();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* On action click, notify user
|
|
107
|
+
* If the menu is open, close the menu
|
|
108
|
+
* @param event
|
|
109
|
+
*/
|
|
110
|
+
onActionClick(event) {
|
|
111
|
+
if (this.open) {
|
|
112
|
+
this.toggleMenu();
|
|
113
|
+
}
|
|
114
|
+
this.actionClick.emit(event);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Handles emitting open/close event
|
|
118
|
+
*/
|
|
119
|
+
toggleMenu() {
|
|
120
|
+
this.open = !this.open;
|
|
121
|
+
if (this.open) {
|
|
122
|
+
// Render the template & append to view
|
|
123
|
+
const view = this.viewContainerRef.createEmbeddedView(this.menuTemplate);
|
|
124
|
+
this.menuRef = document.body.appendChild(view.rootNodes[0]);
|
|
125
|
+
// Assign button width to the menu ref to align with button
|
|
126
|
+
Object.assign(this.menuRef.style, {
|
|
127
|
+
width: `${this.hostElement.nativeElement.clientWidth}px`,
|
|
128
|
+
top: "0",
|
|
129
|
+
left: "0"
|
|
130
|
+
});
|
|
131
|
+
// Reset & test alignment every open
|
|
132
|
+
this.menuAlignment = this._alignment;
|
|
133
|
+
document.addEventListener("click", this.documentClick);
|
|
134
|
+
// Listen for events such as scrolling to keep menu aligned
|
|
135
|
+
this.unmountFloatingElement = autoUpdate(this.hostElement.nativeElement, this.menuRef, this.recomputePosition.bind(this));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.cleanUp();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
roundByDPR(value) {
|
|
142
|
+
const dpr = window.devicePixelRatio || 1;
|
|
143
|
+
return Math.round(value * dpr) / dpr;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Compute position of menu
|
|
147
|
+
*/
|
|
148
|
+
recomputePosition() {
|
|
149
|
+
if (this.menuTemplate && this.hostElement) {
|
|
150
|
+
// Run outside of angular zone to avoid unnecessary change detection and rely on floating-ui
|
|
151
|
+
this.ngZone.runOutsideAngular(() => __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const { x, y, placement } = yield computePosition(this.hostElement.nativeElement, this.menuRef, {
|
|
153
|
+
placement: this.menuAlignment,
|
|
154
|
+
strategy: "fixed",
|
|
155
|
+
middleware: [
|
|
156
|
+
flip({ crossAxis: false })
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
this.menuAlignment = placement;
|
|
160
|
+
// Using CSSOM to manipulate CSS to avoid content security policy inline-src
|
|
161
|
+
// https://github.com/w3c/webappsec-csp/issues/212
|
|
162
|
+
Object.assign(this.menuRef.style, {
|
|
163
|
+
position: "fixed",
|
|
164
|
+
// Using transform instead of top/left position to improve performance
|
|
165
|
+
transform: `translate(${this.roundByDPR(x)}px,${this.roundByDPR(y)}px)`
|
|
166
|
+
});
|
|
167
|
+
this.changeDetectorRef.markForCheck();
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
ComboButtonComponent.comboButtonCounter = 0;
|
|
173
|
+
ComboButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ComboButtonComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
ComboButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ComboButtonComponent, selector: "cds-combo-button", inputs: { comboId: "comboId", size: "size", label: "label", disabled: "disabled", menuAlignment: "menuAlignment", description: "description", tooltipAutoAlign: "tooltipAutoAlign", tooltipPlacement: "tooltipPlacement", open: "open" }, outputs: { actionClick: "actionClick" }, host: { properties: { "class.cds--combo-button__container--open": "this.open", "class.cds--combo-button__container": "this.comboButtonContainer", "class.cds--combo-button__container--lg": "this.sizeLg", "class.cds--combo-button__container--md": "this.sizeMd", "class.cds--combo-button__container--sm": "this.sizeSm", "attr.aria-owns": "this.ariaOwns" } }, queries: [{ propertyName: "projectedMenuItems", predicate: ContextMenuItemComponent }], viewQueries: [{ propertyName: "menuTemplate", first: true, predicate: ["menuTemplate"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
175
|
+
<div class="cds--combo-button__primary-action" [attr.aria-owns]="open ? comboId : undefined">
|
|
176
|
+
<button
|
|
177
|
+
cdsButton="primary"
|
|
178
|
+
[size]="size"
|
|
179
|
+
[attr.title]="label"
|
|
180
|
+
[disabled]="disabled"
|
|
181
|
+
type="button"
|
|
182
|
+
(click)="onActionClick($event)">
|
|
183
|
+
{{label}}
|
|
184
|
+
</button>
|
|
185
|
+
</div>
|
|
186
|
+
<cds-icon-button
|
|
187
|
+
[buttonNgClass]="{ 'cds--combo-button__trigger': true }"
|
|
188
|
+
[buttonAttributes]="{
|
|
189
|
+
'aria-haspopup': true,
|
|
190
|
+
'aria-expanded': open,
|
|
191
|
+
'aria-controls': open ? comboId : undefined
|
|
192
|
+
}"
|
|
193
|
+
[size]="size"
|
|
194
|
+
[description]="description"
|
|
195
|
+
[disabled]="disabled"
|
|
196
|
+
[autoAlign]="tooltipAutoAlign"
|
|
197
|
+
[align]="tooltipPlacement"
|
|
198
|
+
(click)="toggleMenu()">
|
|
199
|
+
<svg
|
|
200
|
+
cdsIcon="chevron--down"
|
|
201
|
+
size="16">
|
|
202
|
+
</svg>
|
|
203
|
+
</cds-icon-button>
|
|
204
|
+
|
|
205
|
+
<ng-template #menuTemplate>
|
|
206
|
+
<cds-menu
|
|
207
|
+
mode="basic"
|
|
208
|
+
[size]="size"
|
|
209
|
+
[open]="open"
|
|
210
|
+
[attr.id]="comboId">
|
|
211
|
+
<ng-content select="cds-menu-item, cds-menu-divider"></ng-content>
|
|
212
|
+
</cds-menu>
|
|
213
|
+
</ng-template>
|
|
214
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "component", type: i1.IconButton, selector: "cds-icon-button, ibm-icon-button", inputs: ["buttonNgClass", "buttonAttributes", "buttonId", "kind", "size", "type", "isExpressive", "disabled", "description", "showTooltipWhenDisabled"], outputs: ["click", "focus", "blur", "tooltipClick"] }, { kind: "directive", type: i2.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "component", type: i3.ContextMenuComponent, selector: "cds-menu, cds-context-menu, ibm-context-menu", inputs: ["open", "position", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ComboButtonComponent, decorators: [{
|
|
216
|
+
type: Component,
|
|
217
|
+
args: [{
|
|
218
|
+
selector: "cds-combo-button",
|
|
219
|
+
template: `
|
|
220
|
+
<div class="cds--combo-button__primary-action" [attr.aria-owns]="open ? comboId : undefined">
|
|
221
|
+
<button
|
|
222
|
+
cdsButton="primary"
|
|
223
|
+
[size]="size"
|
|
224
|
+
[attr.title]="label"
|
|
225
|
+
[disabled]="disabled"
|
|
226
|
+
type="button"
|
|
227
|
+
(click)="onActionClick($event)">
|
|
228
|
+
{{label}}
|
|
229
|
+
</button>
|
|
230
|
+
</div>
|
|
231
|
+
<cds-icon-button
|
|
232
|
+
[buttonNgClass]="{ 'cds--combo-button__trigger': true }"
|
|
233
|
+
[buttonAttributes]="{
|
|
234
|
+
'aria-haspopup': true,
|
|
235
|
+
'aria-expanded': open,
|
|
236
|
+
'aria-controls': open ? comboId : undefined
|
|
237
|
+
}"
|
|
238
|
+
[size]="size"
|
|
239
|
+
[description]="description"
|
|
240
|
+
[disabled]="disabled"
|
|
241
|
+
[autoAlign]="tooltipAutoAlign"
|
|
242
|
+
[align]="tooltipPlacement"
|
|
243
|
+
(click)="toggleMenu()">
|
|
244
|
+
<svg
|
|
245
|
+
cdsIcon="chevron--down"
|
|
246
|
+
size="16">
|
|
247
|
+
</svg>
|
|
248
|
+
</cds-icon-button>
|
|
249
|
+
|
|
250
|
+
<ng-template #menuTemplate>
|
|
251
|
+
<cds-menu
|
|
252
|
+
mode="basic"
|
|
253
|
+
[size]="size"
|
|
254
|
+
[open]="open"
|
|
255
|
+
[attr.id]="comboId">
|
|
256
|
+
<ng-content select="cds-menu-item, cds-menu-divider"></ng-content>
|
|
257
|
+
</cds-menu>
|
|
258
|
+
</ng-template>
|
|
259
|
+
`,
|
|
260
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
261
|
+
}]
|
|
262
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { comboId: [{
|
|
263
|
+
type: Input
|
|
264
|
+
}], projectedMenuItems: [{
|
|
265
|
+
type: ContentChildren,
|
|
266
|
+
args: [ContextMenuItemComponent]
|
|
267
|
+
}], size: [{
|
|
268
|
+
type: Input
|
|
269
|
+
}], label: [{
|
|
270
|
+
type: Input
|
|
271
|
+
}], disabled: [{
|
|
272
|
+
type: Input
|
|
273
|
+
}], menuAlignment: [{
|
|
274
|
+
type: Input
|
|
275
|
+
}], description: [{
|
|
276
|
+
type: Input
|
|
277
|
+
}], tooltipAutoAlign: [{
|
|
278
|
+
type: Input
|
|
279
|
+
}], tooltipPlacement: [{
|
|
280
|
+
type: Input
|
|
281
|
+
}], open: [{
|
|
282
|
+
type: Input
|
|
283
|
+
}, {
|
|
284
|
+
type: HostBinding,
|
|
285
|
+
args: ["class.cds--combo-button__container--open"]
|
|
286
|
+
}], actionClick: [{
|
|
287
|
+
type: Output
|
|
288
|
+
}], comboButtonContainer: [{
|
|
289
|
+
type: HostBinding,
|
|
290
|
+
args: ["class.cds--combo-button__container"]
|
|
291
|
+
}], sizeLg: [{
|
|
292
|
+
type: HostBinding,
|
|
293
|
+
args: ["class.cds--combo-button__container--lg"]
|
|
294
|
+
}], sizeMd: [{
|
|
295
|
+
type: HostBinding,
|
|
296
|
+
args: ["class.cds--combo-button__container--md"]
|
|
297
|
+
}], sizeSm: [{
|
|
298
|
+
type: HostBinding,
|
|
299
|
+
args: ["class.cds--combo-button__container--sm"]
|
|
300
|
+
}], ariaOwns: [{
|
|
301
|
+
type: HostBinding,
|
|
302
|
+
args: ["attr.aria-owns"]
|
|
303
|
+
}], menuTemplate: [{
|
|
304
|
+
type: ViewChild,
|
|
305
|
+
args: ["menuTemplate"]
|
|
306
|
+
}] } });
|
|
307
|
+
|
|
308
|
+
class ComboButtonModule {
|
|
309
|
+
}
|
|
310
|
+
ComboButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ComboButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
311
|
+
ComboButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ComboButtonModule, declarations: [ComboButtonComponent], imports: [CommonModule,
|
|
312
|
+
ButtonModule,
|
|
313
|
+
IconModule,
|
|
314
|
+
ContextMenuModule], exports: [ComboButtonComponent] });
|
|
315
|
+
ComboButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ComboButtonModule, imports: [CommonModule,
|
|
316
|
+
ButtonModule,
|
|
317
|
+
IconModule,
|
|
318
|
+
ContextMenuModule] });
|
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ComboButtonModule, decorators: [{
|
|
320
|
+
type: NgModule,
|
|
321
|
+
args: [{
|
|
322
|
+
imports: [
|
|
323
|
+
CommonModule,
|
|
324
|
+
ButtonModule,
|
|
325
|
+
IconModule,
|
|
326
|
+
ContextMenuModule
|
|
327
|
+
],
|
|
328
|
+
exports: [ComboButtonComponent],
|
|
329
|
+
declarations: [ComboButtonComponent]
|
|
330
|
+
}]
|
|
331
|
+
}] });
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Generated bundle index. Do not edit.
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
export { ComboButtonComponent, ComboButtonModule };
|
|
338
|
+
//# sourceMappingURL=carbon-components-angular-combo-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carbon-components-angular-combo-button.mjs","sources":["../../src/combo-button/combo-button.component.ts","../../src/combo-button/combo-button.module.ts","../../src/combo-button/carbon-components-angular-combo-button.ts"],"sourcesContent":["import {\n\tAfterViewInit,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tContentChildren,\n\tElementRef,\n\tEventEmitter,\n\tHostBinding,\n\tInput,\n\tNgZone,\n\tOnChanges,\n\tOnDestroy,\n\tOutput,\n\tQueryList,\n\tRenderer2,\n\tSimpleChanges,\n\tTemplateRef,\n\tViewChild,\n\tViewContainerRef\n} from \"@angular/core\";\nimport { Subscription } from \"rxjs\";\nimport {\n\tautoUpdate,\n\tcomputePosition,\n\tflip\n} from \"@floating-ui/dom\";\nimport { ContextMenuItemComponent, ItemClickEvent } from \"carbon-components-angular/context-menu\";\n\ntype ComboButtonPlacement = \"top\" | \"top-start\" | \"top-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\";\n\n@Component({\n\tselector: \"cds-combo-button\",\n\ttemplate: `\n\t\t<div class=\"cds--combo-button__primary-action\" [attr.aria-owns]=\"open ? comboId : undefined\">\n\t\t\t<button\n\t\t\t\tcdsButton=\"primary\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[attr.title]=\"label\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t(click)=\"onActionClick($event)\">\n\t\t\t\t{{label}}\n\t\t\t</button>\n\t\t</div>\n\t\t<cds-icon-button\n\t\t\t[buttonNgClass]=\"{ 'cds--combo-button__trigger': true }\"\n\t\t\t[buttonAttributes]=\"{\n\t\t\t\t'aria-haspopup': true,\n\t\t\t\t'aria-expanded': open,\n\t\t\t\t'aria-controls': open ? comboId : undefined\n\t\t\t}\"\n\t\t\t[size]=\"size\"\n\t\t\t[description]=\"description\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[autoAlign]=\"tooltipAutoAlign\"\n\t\t\t[align]=\"tooltipPlacement\"\n\t\t\t(click)=\"toggleMenu()\">\n\t\t\t<svg\n\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\tsize=\"16\">\n\t\t\t</svg>\n\t\t</cds-icon-button>\n\n\t\t<ng-template #menuTemplate>\n\t\t\t<cds-menu\n\t\t\t\tmode=\"basic\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[open]=\"open\"\n\t\t\t\t[attr.id]=\"comboId\">\n\t\t\t\t<ng-content select=\"cds-menu-item, cds-menu-divider\"></ng-content>\n\t\t\t</cds-menu>\n\t\t</ng-template>\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ComboButtonComponent implements OnChanges, AfterViewInit, OnDestroy {\n\tstatic comboButtonCounter = 0;\n\t@Input() comboId = `combo-button-${ComboButtonComponent.comboButtonCounter++}`;\n\n\t// Listen for click & determine if menu should close\n\t@ContentChildren(ContextMenuItemComponent) set projectedMenuItems(itemList: QueryList<ContextMenuItemComponent>) {\n\t\t// Reset in case user dynamically updates menu item\n\t\tthis.subscriptions.forEach((sub) => sub?.unsubscribe());\n\t\tthis.subscriptions = [];\n\t\titemList.forEach((item) => {\n\t\t\tthis.subscriptions.push(\n\t\t\t\titem.itemClick.subscribe((clickEvent) => this.handleMenuItemClick(clickEvent))\n\t\t\t);\n\t\t});\n\t}\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\t@Input() label: string;\n\t@Input() disabled = false;\n\t@Input() menuAlignment: ComboButtonPlacement = \"bottom\";\n\t@Input() description: string;\n\t@Input() tooltipAutoAlign = false;\n\t@Input() tooltipPlacement = \"bottom\";\n\t@Input() @HostBinding(\"class.cds--combo-button__container--open\") open = false;\n\t@Output() actionClick = new EventEmitter<Event>();\n\t@HostBinding(\"class.cds--combo-button__container\") comboButtonContainer = true;\n\t@HostBinding(\"class.cds--combo-button__container--lg\") get sizeLg() { return this.size === \"lg\"; }\n\t@HostBinding(\"class.cds--combo-button__container--md\") get sizeMd() { return this.size === \"md\"; }\n\t@HostBinding(\"class.cds--combo-button__container--sm\") get sizeSm() { return this.size === \"sm\"; }\n\t@HostBinding(\"attr.aria-owns\") get ariaOwns() {\n\t\treturn this.open ? this.comboId : undefined;\n\t}\n\n\t@ViewChild(\"menuTemplate\") menuTemplate: TemplateRef<any>;\n\n\tprotected documentClick = this.handleFocusOut.bind(this);\n\tprotected unmountFloatingElement: Function;\n\n\tprivate subscriptions: Subscription[] = [];\n\tprivate _alignment: ComboButtonPlacement = \"bottom\";\n\tprivate menuRef: HTMLElement;\n\n\tconstructor(\n\t\tprotected ngZone: NgZone,\n\t\tprotected renderer: Renderer2,\n\t\tprotected hostElement: ElementRef,\n\t\tprotected viewContainerRef: ViewContainerRef,\n\t\tprotected changeDetectorRef: ChangeDetectorRef\n\t) { }\n\n\n\t/**\n\t * In case user updates alignment, store initial value.\n\t * This allows us to test user passed alignment on each open\n\t */\n\tngOnChanges(changes: SimpleChanges): void {\n\t\tif (changes.menuAlignment) {\n\t\t\tthis._alignment = changes.menuAlignment.currentValue;\n\t\t}\n\t}\n\n\n\n\t/**\n\t * If user has passed in true for open, we dynamically open the menu\n\t */\n\tngAfterViewInit(): void {\n\t\tif (this.open) {\n\t\t\tthis.open = !this.open;\n\t\t\tthis.toggleMenu();\n\t\t}\n\t}\n\n\n\n\t/**\n\t* Clean up Floating-ui & subscriptions\n\t*/\n\tngOnDestroy(): void {\n\t\tthis.cleanUp();\n\t\tthis.subscriptions.forEach((sub) => sub.unsubscribe());\n\t}\n\n\n\t/**\n\t * As of now, menu button does not support nexted menu, on button click it should close\n\t */\n\thandleMenuItemClick(event: ItemClickEvent) {\n\t\t// If event is not type radio/checkbox, we close the menu\n\t\tif (!event.type) {\n\t\t\tthis.toggleMenu();\n\t\t}\n\t}\n\n\n\n\t/**\n\t * On body click, close the menu\n\t * @param event\n\t */\n\thandleFocusOut(event) {\n\t\tif (!this.hostElement.nativeElement.contains(event.target)) {\n\t\t\tthis.toggleMenu();\n\t\t}\n\t}\n\n\n\n\t/**\n\t * Clean up `autoUpdate` if auto alignment is enabled\n\t */\n\tcleanUp() {\n\t\tdocument.removeEventListener(\"click\", this.documentClick);\n\t\tif (this.unmountFloatingElement) {\n\t\t\tthis.menuRef.remove();\n\t\t\tthis.viewContainerRef.clear();\n\t\t\tthis.unmountFloatingElement();\n\t\t}\n\t\tthis.unmountFloatingElement = undefined;\n\t\t// On all instances of menu closing, make sure icon direction is correct\n\t\tthis.changeDetectorRef.markForCheck();\n\t}\n\n\n\t/**\n\t * On action click, notify user\n\t * If the menu is open, close the menu\n\t * @param event\n\t */\n\tonActionClick(event: PointerEvent) {\n\t\tif (this.open) {\n\t\t\tthis.toggleMenu();\n\t\t}\n\t\tthis.actionClick.emit(event);\n\t}\n\n\n\n\t/**\n\t * Handles emitting open/close event\n\t */\n\ttoggleMenu() {\n\t\tthis.open = !this.open;\n\t\tif (this.open) {\n\t\t\t// Render the template & append to view\n\t\t\tconst view = this.viewContainerRef.createEmbeddedView(this.menuTemplate);\n\t\t\tthis.menuRef = document.body.appendChild(view.rootNodes[0] as HTMLElement);\n\t\t\t// Assign button width to the menu ref to align with button\n\t\t\tObject.assign(this.menuRef.style, {\n\t\t\t\twidth: `${this.hostElement.nativeElement.clientWidth}px`,\n\t\t\t\ttop: \"0\",\n\t\t\t\tleft: \"0\"\n\t\t\t});\n\n\t\t\t// Reset & test alignment every open\n\t\t\tthis.menuAlignment = this._alignment;\n\n\t\t\tdocument.addEventListener(\"click\", this.documentClick);\n\n\t\t\t// Listen for events such as scrolling to keep menu aligned\n\t\t\tthis.unmountFloatingElement = autoUpdate(\n\t\t\t\tthis.hostElement.nativeElement,\n\t\t\t\tthis.menuRef,\n\t\t\t\tthis.recomputePosition.bind(this)\n\t\t\t);\n\t\t} else {\n\t\t\tthis.cleanUp();\n\t\t}\n\t}\n\n\n\n\troundByDPR(value) {\n\t\tconst dpr = window.devicePixelRatio || 1;\n\t\treturn Math.round(value * dpr) / dpr;\n\t}\n\n\n\n\t/**\n\t * Compute position of menu\n\t */\n\trecomputePosition() {\n\t\tif (this.menuTemplate && this.hostElement) {\n\t\t\t// Run outside of angular zone to avoid unnecessary change detection and rely on floating-ui\n\t\t\tthis.ngZone.runOutsideAngular(async () => {\n\t\t\t\tconst { x, y, placement } = await computePosition(\n\t\t\t\t\tthis.hostElement.nativeElement,\n\t\t\t\t\tthis.menuRef,\n\t\t\t\t\t{\n\t\t\t\t\t\tplacement: this.menuAlignment,\n\t\t\t\t\t\tstrategy: \"fixed\",\n\t\t\t\t\t\tmiddleware: [\n\t\t\t\t\t\t\tflip({ crossAxis: false })\n\t\t\t\t\t\t]\n\t\t\t\t\t});\n\n\t\t\t\tthis.menuAlignment = placement as ComboButtonPlacement;\n\n\t\t\t\t// Using CSSOM to manipulate CSS to avoid content security policy inline-src\n\t\t\t\t// https://github.com/w3c/webappsec-csp/issues/212\n\t\t\t\tObject.assign(this.menuRef.style, {\n\t\t\t\t\tposition: \"fixed\",\n\t\t\t\t\t// Using transform instead of top/left position to improve performance\n\t\t\t\t\ttransform: `translate(${this.roundByDPR(x)}px,${this.roundByDPR(y)}px)`\n\t\t\t\t});\n\t\t\t\tthis.changeDetectorRef.markForCheck();\n\t\t\t});\n\t\t}\n\t}\n}\n","import { NgModule } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\n\nimport { IconModule } from \"carbon-components-angular/icon\";\nimport { ContextMenuModule } from \"carbon-components-angular/context-menu\";\nimport { ButtonModule } from \"carbon-components-angular/button\";\n\nimport { ComboButtonComponent } from \"./combo-button.component\";\n\n@NgModule({\n\timports: [\n\t\tCommonModule,\n\t\tButtonModule,\n\t\tIconModule,\n\t\tContextMenuModule\n\t],\n\texports: [ComboButtonComponent],\n\tdeclarations: [ComboButtonComponent]\n})\nexport class ComboButtonModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA4Ea,oBAAoB,CAAA;IA0ChC,WACW,CAAA,MAAc,EACd,QAAmB,EACnB,WAAuB,EACvB,gBAAkC,EAClC,iBAAoC,EAAA;AAJpC,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;AACd,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAW;AACnB,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAY;AACvB,QAAA,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;AAClC,QAAA,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAmB;QA7CtC,IAAA,CAAA,OAAO,GAAG,CAAA,aAAA,EAAgB,oBAAoB,CAAC,kBAAkB,EAAE,CAAA,CAAE,CAAC;AActE,QAAA,IAAI,CAAA,IAAA,GAAuB,IAAI,CAAC;AAEhC,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AACjB,Q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,EAAA,CAFd,oBAAoB,CAAA,EAAA,OAAA,EAAA,CANlC,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,iBAAiB,aAER,oBAAoB,CAAA,EAAA,CAAA,CAAA;AAGlB,iBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YAR5B,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,iBAAiB,CAAA,EAAA,CAAA,CAAA;2FAKN,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAV7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE;wBACR,YAAY;wBACZ,YAAY;wBACZ,UAAU;wBACV,iBAAiB;AACjB,qBAAA;oBACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;oBAC/B,YAAY,EAAE,CAAC,oBAAoB,CAAC;iBACpC,CAAA;;;AClBD;;AAEG;;;;"}
|
|
@@ -13,11 +13,11 @@ class ContextMenuDividerComponent {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
ContextMenuDividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
16
|
-
ContextMenuDividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuDividerComponent, selector: "cds-context-menu-divider, ibm-context-menu-divider", host: { properties: { "class.cds--menu-item-divider": "this.dividerClass", "attr.role": "this.role" } }, ngImport: i0, template: "", isInline: true });
|
|
16
|
+
ContextMenuDividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuDividerComponent, selector: "cds-menu-divider, cds-context-menu-divider, ibm-context-menu-divider", host: { properties: { "class.cds--menu-item-divider": "this.dividerClass", "attr.role": "this.role" } }, ngImport: i0, template: "", isInline: true });
|
|
17
17
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuDividerComponent, decorators: [{
|
|
18
18
|
type: Component,
|
|
19
19
|
args: [{
|
|
20
|
-
selector: "cds-context-menu-divider, ibm-context-menu-divider",
|
|
20
|
+
selector: "cds-menu-divider, cds-context-menu-divider, ibm-context-menu-divider",
|
|
21
21
|
template: ""
|
|
22
22
|
}]
|
|
23
23
|
}], propDecorators: { dividerClass: [{
|
|
@@ -101,13 +101,13 @@ class ContextMenuGroupComponent {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
ContextMenuGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuGroupComponent, deps: [{ token: ContextMenuSelectionService }], target: i0.ɵɵFactoryTarget.Component });
|
|
104
|
-
ContextMenuGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuGroupComponent, selector: "cds-context-menu-group, ibm-context-menu-group", inputs: { label: "label", value: "value", type: "type" }, outputs: { valueChange: "valueChange" }, host: { properties: { "attr.role": "this.role", "class.cds--menu-item-radio-group": "this.radioGroup", "class.cds--menu-item-group": "this.group", "attr.aria-label": "this.label" } }, providers: [ContextMenuSelectionService], usesOnChanges: true, ngImport: i0, template: `
|
|
104
|
+
ContextMenuGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuGroupComponent, selector: "cds-menu-group, cds-context-menu-group, ibm-context-menu-group", inputs: { label: "label", value: "value", type: "type" }, outputs: { valueChange: "valueChange" }, host: { properties: { "attr.role": "this.role", "class.cds--menu-item-radio-group": "this.radioGroup", "class.cds--menu-item-group": "this.group", "attr.aria-label": "this.label" } }, providers: [ContextMenuSelectionService], usesOnChanges: true, ngImport: i0, template: `
|
|
105
105
|
<ng-content></ng-content>
|
|
106
106
|
`, isInline: true });
|
|
107
107
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuGroupComponent, decorators: [{
|
|
108
108
|
type: Component,
|
|
109
109
|
args: [{
|
|
110
|
-
selector: "cds-context-menu-group, ibm-context-menu-group",
|
|
110
|
+
selector: "cds-menu-group, cds-context-menu-group, ibm-context-menu-group",
|
|
111
111
|
template: `
|
|
112
112
|
<ng-content></ng-content>
|
|
113
113
|
`,
|
|
@@ -152,24 +152,35 @@ class ContextMenuComponent {
|
|
|
152
152
|
left: 0,
|
|
153
153
|
top: 0
|
|
154
154
|
};
|
|
155
|
-
this.
|
|
155
|
+
this.size = "lg";
|
|
156
156
|
this.role = "menu";
|
|
157
157
|
this.tabindex = "-1";
|
|
158
|
+
/**
|
|
159
|
+
* @todo - convert to getter in v6, should resolve expression has changed
|
|
160
|
+
* after switching to on OnPush Change Detection Strategy
|
|
161
|
+
*/
|
|
162
|
+
this.iconClass = false;
|
|
163
|
+
}
|
|
164
|
+
get hostClass() {
|
|
165
|
+
const open = this.open ? "cds--menu--open cds--menu--shown" : "";
|
|
166
|
+
return `cds--menu cds--autoalign cds--menu--${this.size} ${open}`;
|
|
158
167
|
}
|
|
159
|
-
get contextMenuOpen() { return this.open; }
|
|
160
|
-
get showMenu() { return this.open; }
|
|
161
168
|
get leftPosition() { return this.position.left; }
|
|
162
169
|
get topPosition() { return this.position.top; }
|
|
163
|
-
get classIcons() {
|
|
164
|
-
const svgElement = this.elementRef.nativeElement
|
|
165
|
-
.querySelector(".cds--menu-item .cds--menu-item__icon svg");
|
|
166
|
-
return svgElement;
|
|
167
|
-
}
|
|
168
170
|
ngOnChanges(changes) {
|
|
169
171
|
if (changes.open && changes.open.currentValue) {
|
|
170
172
|
this.focusMenu();
|
|
171
173
|
}
|
|
172
174
|
}
|
|
175
|
+
ngAfterViewInit() {
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
const nativeElement = this.elementRef.nativeElement;
|
|
178
|
+
if (nativeElement) {
|
|
179
|
+
this.iconClass = !!nativeElement
|
|
180
|
+
.querySelector(".cds--menu-item .cds--menu-item__icon svg");
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
173
184
|
focusMenu() {
|
|
174
185
|
// wait until the next tick to let the DOM settle before changing the focus
|
|
175
186
|
setTimeout(() => {
|
|
@@ -225,27 +236,23 @@ class ContextMenuComponent {
|
|
|
225
236
|
}
|
|
226
237
|
}
|
|
227
238
|
ContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
228
|
-
ContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuComponent, selector: "cds-context-menu, ibm-context-menu", inputs: { open: "open", position: "position" }, host: { listeners: { "keydown": "handleNavigation($event)" }, properties: { "class
|
|
239
|
+
ContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuComponent, selector: "cds-menu, cds-context-menu, ibm-context-menu", inputs: { open: "open", position: "position", size: "size" }, host: { listeners: { "keydown": "handleNavigation($event)" }, properties: { "class": "this.hostClass", "attr.role": "this.role", "attr.tabindex": "this.tabindex", "style.left.px": "this.leftPosition", "style.top.px": "this.topPosition", "class.cds--menu--with-icons": "this.iconClass" } }, usesOnChanges: true, ngImport: i0, template: `
|
|
229
240
|
<ng-content></ng-content>
|
|
230
241
|
`, isInline: true, styles: [":host{display:block}\n"] });
|
|
231
242
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuComponent, decorators: [{
|
|
232
243
|
type: Component,
|
|
233
|
-
args: [{ selector: "cds-context-menu, ibm-context-menu", template: `
|
|
244
|
+
args: [{ selector: "cds-menu, cds-context-menu, ibm-context-menu", template: `
|
|
234
245
|
<ng-content></ng-content>
|
|
235
246
|
`, styles: [":host{display:block}\n"] }]
|
|
236
247
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { open: [{
|
|
237
248
|
type: Input
|
|
238
249
|
}], position: [{
|
|
239
250
|
type: Input
|
|
240
|
-
}],
|
|
241
|
-
type:
|
|
242
|
-
|
|
243
|
-
}], contextMenuOpen: [{
|
|
244
|
-
type: HostBinding,
|
|
245
|
-
args: ["class.cds--menu--open"]
|
|
246
|
-
}], showMenu: [{
|
|
251
|
+
}], size: [{
|
|
252
|
+
type: Input
|
|
253
|
+
}], hostClass: [{
|
|
247
254
|
type: HostBinding,
|
|
248
|
-
args: ["class
|
|
255
|
+
args: ["class"]
|
|
249
256
|
}], role: [{
|
|
250
257
|
type: HostBinding,
|
|
251
258
|
args: ["attr.role"]
|
|
@@ -258,7 +265,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
258
265
|
}], topPosition: [{
|
|
259
266
|
type: HostBinding,
|
|
260
267
|
args: ["style.top.px"]
|
|
261
|
-
}],
|
|
268
|
+
}], iconClass: [{
|
|
262
269
|
type: HostBinding,
|
|
263
270
|
args: ["class.cds--menu--with-icons"]
|
|
264
271
|
}], handleNavigation: [{
|
|
@@ -275,6 +282,8 @@ class ContextMenuItemComponent {
|
|
|
275
282
|
this.tabindex = -1;
|
|
276
283
|
this.ariaHasPopup = null;
|
|
277
284
|
this.ariaExpanded = null;
|
|
285
|
+
this.disabled = false;
|
|
286
|
+
this.danger = false;
|
|
278
287
|
this.label = "";
|
|
279
288
|
this.info = "";
|
|
280
289
|
this.type = null;
|
|
@@ -282,6 +291,7 @@ class ContextMenuItemComponent {
|
|
|
282
291
|
this.icon = "";
|
|
283
292
|
this.value = "";
|
|
284
293
|
this.checkedChange = new EventEmitter();
|
|
294
|
+
this.itemClick = new EventEmitter();
|
|
285
295
|
this.hasChildren = false;
|
|
286
296
|
this.selectable = false;
|
|
287
297
|
this.subscriptions = new Subscription();
|
|
@@ -290,6 +300,9 @@ class ContextMenuItemComponent {
|
|
|
290
300
|
return this.type === "checkbox" ?
|
|
291
301
|
(this.checked ? true : false) : null;
|
|
292
302
|
}
|
|
303
|
+
get ariaDisabled() {
|
|
304
|
+
return this.disabled;
|
|
305
|
+
}
|
|
293
306
|
ngOnInit() {
|
|
294
307
|
switch (this.type) {
|
|
295
308
|
case "checkbox": {
|
|
@@ -343,6 +356,15 @@ class ContextMenuItemComponent {
|
|
|
343
356
|
this.contextMenuSelectionService.selectCheckbox(this.value);
|
|
344
357
|
}
|
|
345
358
|
}
|
|
359
|
+
if (!this.disabled) {
|
|
360
|
+
this.itemClick.emit({
|
|
361
|
+
event,
|
|
362
|
+
label: this.label,
|
|
363
|
+
info: this.info,
|
|
364
|
+
value: this.value,
|
|
365
|
+
type: this.type
|
|
366
|
+
});
|
|
367
|
+
}
|
|
346
368
|
}
|
|
347
369
|
handleSelection(selected) {
|
|
348
370
|
this.checked = selected;
|
|
@@ -387,7 +409,7 @@ class ContextMenuItemComponent {
|
|
|
387
409
|
}
|
|
388
410
|
}
|
|
389
411
|
ContextMenuItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuItemComponent, deps: [{ token: i0.ElementRef }, { token: ContextMenuSelectionService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
390
|
-
ContextMenuItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuItemComponent, selector: "cds-context-menu-item, ibm-context-menu-item", inputs: { label: "label", info: "info", type: "type", checked: "checked", icon: "icon", value: "value" }, outputs: { checkedChange: "checkedChange" }, host: { listeners: { "keydown.enter": "handleClick($event)", "keydown.space": "handleClick($event)", "click": "handleClick($event)", "mouseover": "handleMouseOver()", "mouseout": "handleMouseOut()", "focus": "handleFocus()", "blur": "handleBlur()" }, properties: { "class.cds--menu-item": "this.optionClass", "attr.role": "this.role", "attr.tabindex": "this.tabindex", "attr.aria-haspopup": "this.ariaHasPopup", "attr.aria-expanded": "this.ariaExpanded", "attr.aria-checked": "this.ariaChecked" } }, queries: [{ propertyName: "childContextMenu", first: true, predicate: ContextMenuComponent, descendants: true, static: true }], ngImport: i0, template: `
|
|
412
|
+
ContextMenuItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ContextMenuItemComponent, selector: "cds-menu-item, cds-context-menu-item, ibm-context-menu-item", inputs: { disabled: "disabled", danger: "danger", label: "label", info: "info", type: "type", checked: "checked", icon: "icon", value: "value" }, outputs: { checkedChange: "checkedChange", itemClick: "itemClick" }, host: { listeners: { "keydown.enter": "handleClick($event)", "keydown.space": "handleClick($event)", "click": "handleClick($event)", "mouseover": "handleMouseOver()", "mouseout": "handleMouseOut()", "focus": "handleFocus()", "blur": "handleBlur()" }, properties: { "class.cds--menu-item": "this.optionClass", "attr.role": "this.role", "attr.tabindex": "this.tabindex", "attr.aria-haspopup": "this.ariaHasPopup", "attr.aria-expanded": "this.ariaExpanded", "attr.aria-checked": "this.ariaChecked", "attr.aria-disabled": "this.ariaDisabled", "class.cds--menu-item--disabled": "this.disabled", "class.cds--menu-item--danger": "this.danger" } }, queries: [{ propertyName: "childContextMenu", first: true, predicate: ContextMenuComponent, descendants: true, static: true }], ngImport: i0, template: `
|
|
391
413
|
<div class="cds--menu-item__icon">
|
|
392
414
|
<svg *ngIf="selectable && checked" cdsIcon="checkmark" size="16"></svg>
|
|
393
415
|
<svg *ngIf="!selectable && icon" [cdsIcon]="icon" size="16"></svg>
|
|
@@ -401,7 +423,7 @@ ContextMenuItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0
|
|
|
401
423
|
`, isInline: true, styles: [":host{grid-template-columns:1rem 1fr max-content}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }] });
|
|
402
424
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ContextMenuItemComponent, decorators: [{
|
|
403
425
|
type: Component,
|
|
404
|
-
args: [{ selector: "cds-context-menu-item, ibm-context-menu-item", template: `
|
|
426
|
+
args: [{ selector: "cds-menu-item, cds-context-menu-item, ibm-context-menu-item", template: `
|
|
405
427
|
<div class="cds--menu-item__icon">
|
|
406
428
|
<svg *ngIf="selectable && checked" cdsIcon="checkmark" size="16"></svg>
|
|
407
429
|
<svg *ngIf="!selectable && icon" [cdsIcon]="icon" size="16"></svg>
|
|
@@ -435,6 +457,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
435
457
|
}], ariaChecked: [{
|
|
436
458
|
type: HostBinding,
|
|
437
459
|
args: ["attr.aria-checked"]
|
|
460
|
+
}], ariaDisabled: [{
|
|
461
|
+
type: HostBinding,
|
|
462
|
+
args: ["attr.aria-disabled"]
|
|
463
|
+
}], disabled: [{
|
|
464
|
+
type: Input
|
|
465
|
+
}, {
|
|
466
|
+
type: HostBinding,
|
|
467
|
+
args: ["class.cds--menu-item--disabled"]
|
|
468
|
+
}], danger: [{
|
|
469
|
+
type: Input
|
|
470
|
+
}, {
|
|
471
|
+
type: HostBinding,
|
|
472
|
+
args: ["class.cds--menu-item--danger"]
|
|
438
473
|
}], label: [{
|
|
439
474
|
type: Input
|
|
440
475
|
}], info: [{
|
|
@@ -449,6 +484,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
449
484
|
type: Input
|
|
450
485
|
}], checkedChange: [{
|
|
451
486
|
type: Output
|
|
487
|
+
}], itemClick: [{
|
|
488
|
+
type: Output
|
|
452
489
|
}], childContextMenu: [{
|
|
453
490
|
type: ContentChild,
|
|
454
491
|
args: [ContextMenuComponent, { static: true }]
|