@genexus/genexus-ide-ui 0.0.22 → 0.0.24
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/dist/cjs/ch-action-group_2.cjs.entry.js +211 -0
- package/dist/cjs/ch-dropdown-item.cjs.entry.js +36 -5
- package/dist/cjs/ch-dropdown.cjs.entry.js +50 -52
- package/dist/cjs/{ch-grid_4.cjs.entry.js → ch-grid_8.cjs.entry.js} +143 -0
- package/dist/cjs/{ch-suggest_5.cjs.entry.js → ch-suggest_4.cjs.entry.js} +0 -65
- package/dist/cjs/ch-test-action-group.cjs.entry.js +79 -0
- package/dist/cjs/ch-test-dropdown.cjs.entry.js +54 -0
- package/dist/cjs/ch-window_2.cjs.entry.js +25 -6
- package/dist/cjs/format-date-f2c49d1a.js +28 -0
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +15 -35
- package/dist/cjs/gx-ide-team-dev-select-recent-comment.cjs.entry.js +5 -15
- package/dist/cjs/gx-ide-team-dev-update-partial-selection.cjs.entry.js +102 -0
- package/dist/cjs/gx-ide-team-dev-update-to-revision.cjs.entry.js +53 -0
- package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +278 -0
- package/dist/cjs/gx-ide-top-bar.cjs.entry.js +37 -0
- package/dist/cjs/{gxg-combo-box_8.cjs.entry.js → gxg-combo-box_6.cjs.entry.js} +0 -132
- package/dist/cjs/gxg-form-checkbox-group_2.cjs.entry.js +140 -0
- package/dist/cjs/{gx-ide-top-bar_2.cjs.entry.js → gxg-form-radio-group.cjs.entry.js} +0 -31
- package/dist/cjs/gxg-text.cjs.entry.js +72 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +7 -0
- package/dist/collection/common/format-date.js +11 -0
- package/dist/collection/components/team-dev-commit/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
- package/dist/collection/components/team-dev-commit/team-dev-commit.js +35 -26
- package/dist/collection/components/team-dev-select-recent-comment/team-dev-select-recent-comment.js +6 -16
- package/dist/collection/components/team-dev-update/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.en.json +45 -0
- package/dist/collection/components/team-dev-update/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.ja.json +3 -0
- package/dist/collection/components/team-dev-update/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.zh.json +3 -0
- package/dist/collection/components/team-dev-update/team-dev-update.css +216 -0
- package/dist/collection/components/team-dev-update/team-dev-update.js +524 -0
- package/dist/collection/components/team-dev-update-partial-selection/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.en.json +15 -0
- package/dist/collection/components/team-dev-update-partial-selection/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.ja.json +3 -0
- package/dist/collection/components/team-dev-update-partial-selection/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.zh.json +3 -0
- package/dist/collection/components/team-dev-update-partial-selection/team-dev-update-partial-selection.css +149 -0
- package/dist/collection/components/team-dev-update-partial-selection/team-dev-update-partial-selection.js +238 -0
- package/dist/collection/components/team-dev-update-to-revision/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.en.json +11 -0
- package/dist/collection/components/team-dev-update-to-revision/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.ja.json +3 -0
- package/dist/collection/components/team-dev-update-to-revision/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.zh.json +3 -0
- package/dist/collection/components/team-dev-update-to-revision/team-dev-update-to-revision.css +147 -0
- package/dist/collection/components/team-dev-update-to-revision/team-dev-update-to-revision.js +136 -0
- package/dist/components/action-group-item.js +54 -0
- package/dist/components/action-group.js +214 -0
- package/dist/components/ch-action-group-item.js +6 -0
- package/dist/components/ch-action-group.js +6 -0
- package/dist/components/ch-dropdown-item-separator.js +1 -28
- package/dist/components/ch-dropdown-item.js +1 -53
- package/dist/components/ch-dropdown.js +1 -284
- package/dist/components/ch-grid-rowset-empty.js +1 -24
- package/dist/components/ch-grid-rowset-empty2.js +26 -0
- package/dist/components/ch-test-action-group.js +137 -0
- package/dist/components/ch-test-dropdown.js +104 -0
- package/dist/components/ch-window2.js +25 -6
- package/dist/components/dropdown-item-separator.js +30 -0
- package/dist/components/dropdown-item.js +109 -0
- package/dist/components/dropdown.js +294 -0
- package/dist/components/format-date.js +25 -0
- package/dist/components/gx-ide-team-dev-commit.js +16 -35
- package/dist/components/gx-ide-team-dev-select-recent-comment.js +5 -15
- package/dist/components/gx-ide-team-dev-update-partial-selection.d.ts +11 -0
- package/dist/components/gx-ide-team-dev-update-partial-selection.js +213 -0
- package/dist/components/gx-ide-team-dev-update-to-revision.d.ts +11 -0
- package/dist/components/gx-ide-team-dev-update-to-revision.js +131 -0
- package/dist/components/gx-ide-team-dev-update.d.ts +11 -0
- package/dist/components/gx-ide-team-dev-update.js +473 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +7 -0
- package/dist/esm/ch-action-group_2.entry.js +206 -0
- package/dist/esm/ch-dropdown-item.entry.js +36 -5
- package/dist/esm/ch-dropdown.entry.js +50 -52
- package/dist/esm/{ch-grid_4.entry.js → ch-grid_8.entry.js} +140 -1
- package/dist/esm/{ch-suggest_5.entry.js → ch-suggest_4.entry.js} +1 -65
- package/dist/esm/ch-test-action-group.entry.js +75 -0
- package/dist/esm/ch-test-dropdown.entry.js +50 -0
- package/dist/esm/ch-window_2.entry.js +25 -6
- package/dist/esm/format-date-e9ca0786.js +25 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-team-dev-commit.entry.js +15 -35
- package/dist/esm/gx-ide-team-dev-select-recent-comment.entry.js +5 -15
- package/dist/esm/gx-ide-team-dev-update-partial-selection.entry.js +98 -0
- package/dist/esm/gx-ide-team-dev-update-to-revision.entry.js +49 -0
- package/dist/esm/gx-ide-team-dev-update.entry.js +274 -0
- package/dist/esm/gx-ide-top-bar.entry.js +33 -0
- package/dist/esm/{gxg-combo-box_8.entry.js → gxg-combo-box_6.entry.js} +2 -132
- package/dist/esm/gxg-form-checkbox-group_2.entry.js +135 -0
- package/dist/esm/{gx-ide-top-bar_2.entry.js → gxg-form-radio-group.entry.js} +2 -32
- package/dist/esm/gxg-text.entry.js +68 -0
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.en.json +45 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.ja.json +3 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update/langs/team-dev-update.lang.zh.json +3 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.en.json +15 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.ja.json +3 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.zh.json +3 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.en.json +11 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.ja.json +3 -0
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.zh.json +3 -0
- package/dist/genexus-ide-ui/p-097a3eeb.entry.js +1 -0
- package/dist/genexus-ide-ui/p-16bd5578.entry.js +1 -0
- package/dist/genexus-ide-ui/p-32b8abf6.entry.js +1 -0
- package/dist/genexus-ide-ui/p-3bdcb73b.entry.js +1 -0
- package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +1 -0
- package/dist/genexus-ide-ui/p-53d36ef7.entry.js +1 -0
- package/dist/genexus-ide-ui/p-5884a014.entry.js +1 -0
- package/dist/genexus-ide-ui/p-5c64c57f.entry.js +1 -0
- package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +1 -0
- package/dist/genexus-ide-ui/p-6e80380b.entry.js +1 -0
- package/dist/genexus-ide-ui/p-718759e7.entry.js +1 -0
- package/dist/genexus-ide-ui/p-72303355.js +1 -0
- package/dist/genexus-ide-ui/p-757f8567.entry.js +1 -0
- package/dist/genexus-ide-ui/p-9c82381c.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a0e85c2a.entry.js +1 -0
- package/dist/genexus-ide-ui/p-afe9515e.entry.js +1 -0
- package/dist/genexus-ide-ui/p-dbebb1a0.entry.js +1 -0
- package/dist/genexus-ide-ui/p-f8561da6.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group/action-group.css +48 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +4 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +32 -88
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +9 -22
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-action-group/test-action-group.css +52 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-dropdown/test-dropdown.css +36 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +3 -1
- package/dist/types/common/format-date.d.ts +1 -0
- package/dist/types/common/types.d.ts +1 -0
- package/dist/types/components/team-dev-commit/team-dev-commit.d.ts +13 -7
- package/dist/types/components/team-dev-select-recent-comment/team-dev-select-recent-comment.d.ts +1 -31
- package/dist/types/components/team-dev-update/team-dev-update.d.ts +173 -0
- package/dist/types/components/team-dev-update-partial-selection/team-dev-update-partial-selection.d.ts +61 -0
- package/dist/types/components/team-dev-update-to-revision/team-dev-update-to-revision.d.ts +41 -0
- package/dist/types/components.d.ts +216 -2
- package/package.json +3 -3
- package/dist/cjs/ch-grid-column-resize_4.cjs.entry.js +0 -150
- package/dist/esm/ch-grid-column-resize_4.entry.js +0 -143
- package/dist/genexus-ide-ui/p-04f094d1.entry.js +0 -1
- package/dist/genexus-ide-ui/p-192f1342.entry.js +0 -1
- package/dist/genexus-ide-ui/p-54cef7ae.entry.js +0 -1
- package/dist/genexus-ide-ui/p-554ed73a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-6d378d61.entry.js +0 -1
- package/dist/genexus-ide-ui/p-b26b5d74.entry.js +0 -1
- package/dist/genexus-ide-ui/p-c10d5f34.entry.js +0 -1
- package/dist/genexus-ide-ui/p-d5c29251.entry.js +0 -1
- package/dist/genexus-ide-ui/p-f1a3397d.entry.js +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
|
|
2
|
+
|
|
3
|
+
const actionGroupCss = "*,::after,::before{box-sizing:border-box}:host{display:grid;position:relative;width:100%;grid-template:\"more-actions actions\" 1fr/min-content 1fr;overflow:hidden}.more-actions{grid-area:more-actions}.more-actions::part(expandable-button){width:1.375em;height:1.375em}.more-actions::part(expandable-button)::before{content:\"\";width:100%;height:100%;background-color:currentColor;-webkit-mask:url('data:image/svg+xml,<svg viewBox=\"0 0 25 25\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.26837 10.5625C4.16837 10.5625 3.26837 11.4625 3.26837 12.5625C3.26837 13.6625 4.16837 14.5625 5.26837 14.5625C6.36837 14.5625 7.26837 13.6625 7.26837 12.5625C7.26837 11.4625 6.36837 10.5625 5.26837 10.5625ZM19.2684 10.5625C18.1684 10.5625 17.2684 11.4625 17.2684 12.5625C17.2684 13.6625 18.1684 14.5625 19.2684 14.5625C20.3684 14.5625 21.2684 13.6625 21.2684 12.5625C21.2684 11.4625 20.3684 10.5625 19.2684 10.5625ZM12.2684 10.5625C11.1684 10.5625 10.2684 11.4625 10.2684 12.5625C10.2684 13.6625 11.1684 14.5625 12.2684 14.5625C13.3684 14.5625 14.2684 13.6625 14.2684 12.5625C14.2684 11.4625 13.3684 10.5625 12.2684 10.5625Z\"/></svg>') 50% 50%/1.25em 1.25em no-repeat}.actions{grid-area:actions;display:grid;grid-auto-flow:column;grid-auto-columns:max-content;width:100%;max-width:100%}.actions--responsive{position:absolute;inset:0}.actions--scroll{overflow-x:auto}.actions--multiline{display:flex;flex-wrap:wrap}";
|
|
4
|
+
|
|
5
|
+
const FLOATING_POINT_ERROR = 1;
|
|
6
|
+
const ChActionGroup = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.displayedItemsCountChange = createEvent(this, "displayedItemsCountChange", 7);
|
|
10
|
+
this.needForRAF = true; // To prevent redundant RAF (request animation frame) calls
|
|
11
|
+
this.totalItems = -1;
|
|
12
|
+
/**
|
|
13
|
+
* The visible actions when `itemsOverflowBehavior === "ResponsiveCollapse"`.
|
|
14
|
+
*/
|
|
15
|
+
this.displayedItems = -1;
|
|
16
|
+
/**
|
|
17
|
+
* This attribute lets you specify the label for the more actions button.
|
|
18
|
+
* Important for accessibility.
|
|
19
|
+
*/
|
|
20
|
+
this.buttonLabel = "More actions";
|
|
21
|
+
/**
|
|
22
|
+
* This attribute determines how items behave when the content of the ActionGroup overflows horizontal. This property is needed
|
|
23
|
+
* to make the control responsive to changes in the Width of the container of ActionGroup.
|
|
24
|
+
*
|
|
25
|
+
* | Value | Details |
|
|
26
|
+
* | --------------------- | ------------------------------------------------------------------------------------------------ |
|
|
27
|
+
* | `Add Scroll` | The items of the ActionGroup that overflow horizontally are shown by means of a scroll. |
|
|
28
|
+
* | `Multiline` | The ActionGroup items that overflow horizontally are shown in a second line of the control. |
|
|
29
|
+
* | `Responsive Collapse` | The Action Group items, when they start to overflow the control, are placed in the More Actions. |
|
|
30
|
+
*/
|
|
31
|
+
this.itemsOverflowBehavior = "ResponsiveCollapse";
|
|
32
|
+
/**
|
|
33
|
+
* Determine which mouse actions on the expandable button display the dropdown
|
|
34
|
+
* section.
|
|
35
|
+
*/
|
|
36
|
+
this.expandBehavior = "ClickOrHover";
|
|
37
|
+
/**
|
|
38
|
+
* @todo Check a better convention for this property, for example, "ActionsInlineAlignment"
|
|
39
|
+
* This attribute determines the position of the More Actions button in the Action Group.
|
|
40
|
+
*
|
|
41
|
+
* | Value | Details |
|
|
42
|
+
* | --------| --------------------------------------------------------------------- |
|
|
43
|
+
* | `Start` | The More Actions Button is displayed to the left of the ActionGroup. |
|
|
44
|
+
* | `End` | The More Actions Button is displayed to the right of the ActionGroup. |
|
|
45
|
+
*/
|
|
46
|
+
this.moreActionsButtonPosition = "Start";
|
|
47
|
+
/**
|
|
48
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
49
|
+
* the more actions button.
|
|
50
|
+
*/
|
|
51
|
+
this.moreActionsDropdownPosition = "InsideStart_OutsideEnd";
|
|
52
|
+
/**
|
|
53
|
+
* Determine if the dropdowns should be opened when the action is focused.
|
|
54
|
+
*/
|
|
55
|
+
this.openOnFocus = false;
|
|
56
|
+
/**
|
|
57
|
+
* Update the visibility of the actions.
|
|
58
|
+
* Only works if itemsOverflowBehavior === "ResponsiveCollapse"
|
|
59
|
+
*/
|
|
60
|
+
this.updateDisplayedActions = () => {
|
|
61
|
+
const actionGroupItems = this.slotItems.assignedElements();
|
|
62
|
+
// The column-gap property must be taken into account
|
|
63
|
+
const columnGap = getComputedStyle(this.actionsContainer).columnGap;
|
|
64
|
+
const columnGapValue = columnGap != null && columnGap.endsWith("px")
|
|
65
|
+
? Number(columnGap.replace("px", ""))
|
|
66
|
+
: 0;
|
|
67
|
+
// Since the last item does not add column-gap, we have to adjust the measurement
|
|
68
|
+
let availableWidth = this.actionsContainer.clientWidth + columnGapValue - FLOATING_POINT_ERROR;
|
|
69
|
+
let displayedItems = 0;
|
|
70
|
+
// Check which items are visible
|
|
71
|
+
actionGroupItems.forEach(action => {
|
|
72
|
+
const actionWidth = action.clientWidth;
|
|
73
|
+
availableWidth -= actionWidth + columnGapValue;
|
|
74
|
+
if (availableWidth >= 0) {
|
|
75
|
+
action.floating = false;
|
|
76
|
+
displayedItems++;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
action.floating = true;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
this.totalItems = actionGroupItems.length;
|
|
83
|
+
this.displayedItems = displayedItems;
|
|
84
|
+
this.displayedItemsCountChange.emit(displayedItems);
|
|
85
|
+
};
|
|
86
|
+
this.updateDisplayedActionInFrame = () => {
|
|
87
|
+
if (!this.needForRAF) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.needForRAF = false; // No need to call RAF up until next frame
|
|
91
|
+
requestAnimationFrame(() => {
|
|
92
|
+
this.needForRAF = true; // RAF now consumes the movement instruction so a new one can come
|
|
93
|
+
this.updateDisplayedActions();
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
this.updateActionsWatcher = () => {
|
|
97
|
+
if (this.itemsOverflowBehavior !== "ResponsiveCollapse") {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Avoid memory leaks by disconnecting and re-connecting the observer
|
|
101
|
+
this.disconnectActionsObserver();
|
|
102
|
+
this.connectActionsObserver();
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
handleOverflowBehaviorChange(newValue) {
|
|
106
|
+
if (newValue !== "ResponsiveCollapse") {
|
|
107
|
+
const actionGroupItems = this.slotItems.assignedElements();
|
|
108
|
+
// Reset floating
|
|
109
|
+
actionGroupItems.forEach(item => {
|
|
110
|
+
item.floating = false;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
this.setResponsiveCollapse();
|
|
114
|
+
}
|
|
115
|
+
connectActionsObserver() {
|
|
116
|
+
this.actionsWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
|
|
117
|
+
// Observe the actions
|
|
118
|
+
const actionGroupItems = this.slotItems.assignedElements();
|
|
119
|
+
actionGroupItems.forEach(action => {
|
|
120
|
+
this.actionsWatcher.observe(action);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
connectActionsContainerObserver() {
|
|
124
|
+
this.actionsContainerWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
|
|
125
|
+
this.actionsContainerWatcher.observe(this.el);
|
|
126
|
+
}
|
|
127
|
+
disconnectActionsObserver() {
|
|
128
|
+
if (this.actionsWatcher) {
|
|
129
|
+
this.actionsWatcher.disconnect();
|
|
130
|
+
this.actionsWatcher = null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
disconnectActionsContainerObserver() {
|
|
134
|
+
if (this.actionsContainerWatcher) {
|
|
135
|
+
this.actionsContainerWatcher.disconnect();
|
|
136
|
+
this.actionsContainerWatcher = null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
setResponsiveCollapse() {
|
|
140
|
+
this.disconnectActionsObserver();
|
|
141
|
+
this.disconnectActionsContainerObserver();
|
|
142
|
+
if (this.itemsOverflowBehavior !== "ResponsiveCollapse") {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.connectActionsObserver();
|
|
146
|
+
this.connectActionsContainerObserver();
|
|
147
|
+
}
|
|
148
|
+
componentDidLoad() {
|
|
149
|
+
this.setResponsiveCollapse();
|
|
150
|
+
}
|
|
151
|
+
disconnectedCallback() {
|
|
152
|
+
this.disconnectActionsObserver();
|
|
153
|
+
this.disconnectActionsContainerObserver();
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
// @todo TODO: Improve accessibility and keyboard navigation
|
|
157
|
+
return (h(Host, { role: "menubar", "aria-label": this.accessibleName }, this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
158
|
+
this.totalItems !== this.displayedItems && (h("ch-dropdown", { exportparts: "expandable-button:more-actions-button,separation:more-actions-separation,list:more-actions-list,section:more-actions-section,mask:more-actions-mask", buttonLabel: this.buttonLabel, class: "more-actions", part: "more-actions", expandBehavior: this.expandBehavior, openOnFocus: this.openOnFocus, position: this.moreActionsDropdownPosition }, h("slot", { name: "more-items", slot: "items" }))), h("div", { class: {
|
|
159
|
+
actions: true,
|
|
160
|
+
"actions--scroll": this.itemsOverflowBehavior === "AddScroll",
|
|
161
|
+
"actions--multiline": this.itemsOverflowBehavior === "Multiline",
|
|
162
|
+
"actions--responsive": this.itemsOverflowBehavior === "ResponsiveCollapse"
|
|
163
|
+
}, part: "actions", ref: el => (this.actionsContainer = el) }, h("slot", { name: "items", onSlotchange: this.updateActionsWatcher, ref: el => (this.slotItems = el) }))));
|
|
164
|
+
}
|
|
165
|
+
get el() { return getElement(this); }
|
|
166
|
+
static get watchers() { return {
|
|
167
|
+
"itemsOverflowBehavior": ["handleOverflowBehaviorChange"]
|
|
168
|
+
}; }
|
|
169
|
+
};
|
|
170
|
+
ChActionGroup.style = actionGroupCss;
|
|
171
|
+
|
|
172
|
+
const actionGroupItemCss = "ch-action-group-item[floating]{position:absolute;visibility:hidden}";
|
|
173
|
+
|
|
174
|
+
const ChActionGroupItem = class {
|
|
175
|
+
constructor(hostRef) {
|
|
176
|
+
registerInstance(this, hostRef);
|
|
177
|
+
/**
|
|
178
|
+
* `true` to ignore the floating property value.
|
|
179
|
+
*/
|
|
180
|
+
this.avoidFloating = false;
|
|
181
|
+
/**
|
|
182
|
+
* `true` if the control is floating. Useful to implement the
|
|
183
|
+
* `"ResponsiveCollapse"` value for the `itemsOverflowBehavior` property of
|
|
184
|
+
* the ch-action-group control.
|
|
185
|
+
*/
|
|
186
|
+
this.floating = false;
|
|
187
|
+
}
|
|
188
|
+
componentWillLoad() {
|
|
189
|
+
if (this.avoidFloating) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const parentAction = this.el.closest("ch-action-group");
|
|
193
|
+
// Hide items at the start to improve CLS
|
|
194
|
+
if (parentAction) {
|
|
195
|
+
this.floating =
|
|
196
|
+
parentAction.itemsOverflowBehavior === "ResponsiveCollapse";
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
render() {
|
|
200
|
+
return h("slot", null);
|
|
201
|
+
}
|
|
202
|
+
get el() { return getElement(this); }
|
|
203
|
+
};
|
|
204
|
+
ChActionGroupItem.style = actionGroupItemCss;
|
|
205
|
+
|
|
206
|
+
export { ChActionGroup as ch_action_group, ChActionGroupItem as ch_action_group_item };
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
|
|
2
2
|
|
|
3
|
-
const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}
|
|
3
|
+
const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}:host{display:flex;width:100%;height:100%}:host([force-containing-block]){transform:translateX(0);--ch-window-relative-position:true}.action{display:flex;align-items:center;width:100%;height:100%;cursor:pointer;text-align:start}.left-img,.right-img{display:block;width:24px;height:24px;min-width:24px}.content{width:100%}.dummy-wrapper{display:contents}";
|
|
4
4
|
|
|
5
|
+
const DROPDOWN_ITEM = "ch-dropdown-item";
|
|
5
6
|
const ChDropDownItem = class {
|
|
6
7
|
constructor(hostRef) {
|
|
7
8
|
registerInstance(this, hostRef);
|
|
8
9
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
9
10
|
this.focusChange = createEvent(this, "focusChange", 7);
|
|
11
|
+
this.hasItems = false;
|
|
12
|
+
/**
|
|
13
|
+
* Determine which actions on the expandable button display the dropdown
|
|
14
|
+
* section.
|
|
15
|
+
* Only works if the control has subitems.
|
|
16
|
+
*/
|
|
17
|
+
this.expandBehavior = "ClickOrHover";
|
|
18
|
+
/**
|
|
19
|
+
* `true` to force the control to make its own containing block.
|
|
20
|
+
*/
|
|
21
|
+
this.forceContainingBlock = true;
|
|
22
|
+
/**
|
|
23
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
24
|
+
* button of the control is focused.
|
|
25
|
+
* Only works if the control has subitems.
|
|
26
|
+
*/
|
|
27
|
+
this.openOnFocus = false;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
30
|
+
* the expandable button.
|
|
31
|
+
*/
|
|
32
|
+
this.position = "Center_OutsideEnd";
|
|
10
33
|
this.dropDownItemContent = () => [
|
|
11
|
-
!!this.leftImgSrc && (h("img", { "aria-hidden": "true", class: "left-img", part: "
|
|
12
|
-
h("span", { class: "content", part: "
|
|
13
|
-
!!this.rightImgSrc && (h("img", { "aria-hidden": "true", class: "right-img", part: "
|
|
34
|
+
!!this.leftImgSrc && (h("img", { "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
|
|
35
|
+
h("span", { class: "content", part: "content" }, h("slot", null)),
|
|
36
|
+
!!this.rightImgSrc && (h("img", { "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
|
|
14
37
|
];
|
|
38
|
+
this.checkItems = () => {
|
|
39
|
+
this.hasItems = !!this.element.querySelector(`:scope>${DROPDOWN_ITEM}`);
|
|
40
|
+
};
|
|
41
|
+
this.noItemsRender = () => this.href ? (h("a", { class: "action", part: "action target", href: this.href, onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), h("slot", { name: "items", onSlotchange: this.checkItems }))) : (h("button", { class: "action", part: "action button", type: "button", onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), h("slot", { name: "items", onSlotchange: this.checkItems })));
|
|
42
|
+
this.itemsRender = () => (h("ch-dropdown", { class: "action", exportparts: "expandable-button:action,expandable-button:button,expandable-button:expandable-action,separation,list,section,mask,header,footer,window", expandBehavior: this.expandBehavior, nestedDropdown: true, openOnFocus: this.openOnFocus, position: this.position }, h("div", { class: "dummy-wrapper", slot: "action" }, this.dropDownItemContent()), h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
|
|
15
43
|
this.handleActionClick = () => {
|
|
16
44
|
this.actionClick.emit(this.element.id);
|
|
17
45
|
};
|
|
@@ -25,8 +53,11 @@ const ChDropDownItem = class {
|
|
|
25
53
|
async handleFocusElement() {
|
|
26
54
|
this.mainElement.focus();
|
|
27
55
|
}
|
|
56
|
+
componentWillLoad() {
|
|
57
|
+
this.checkItems();
|
|
58
|
+
}
|
|
28
59
|
render() {
|
|
29
|
-
return (h(Host, { role: "listitem" }, this.
|
|
60
|
+
return (h(Host, { role: "listitem" }, this.hasItems ? this.itemsRender() : this.noItemsRender()));
|
|
30
61
|
}
|
|
31
62
|
get element() { return getElement(this); }
|
|
32
63
|
};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
|
|
2
2
|
|
|
3
|
-
const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}
|
|
3
|
+
const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}:host{--separation:0px;--separation-x:var(--separation);--separation-y:var(--separation);display:flex;position:relative;width:100%;height:100%}.expandable-button{display:flex;align-items:center;justify-content:center;position:relative;width:100%;height:100%;cursor:pointer;z-index:108}.expandable-button:focus-within{transition:box-shadow 250ms}::slotted([slot=action]){pointer-events:none}.separation{display:flex;position:absolute;z-index:107}.separation--y{width:100%;height:var(--separation-y)}.separation--y-outside-start{inset-block-start:calc(var(--separation-y) * -1)}.separation--y-outside-start+ch-window{--ch-window-offset-y:calc(var(--separation-y) * -1)}.separation--y-outside-end{inset-block-end:calc(var(--separation-y) * -1)}.separation--y-outside-end+ch-window{--ch-window-offset-y:var(--separation-y)}.separation--x{width:var(--separation-x);height:100%}.separation--x-outside-start{inset-inline-start:calc(var(--separation-x) * -1)}.separation--x-outside-start+ch-window{--ch-window-offset-x:calc(var(--separation-x) * -1)}.separation--x-outside-end{inset-inline-end:calc(var(--separation-x) * -1)}.separation--x-outside-end+ch-window{--ch-window-offset-x:var(--separation-x)}.list{display:flex;flex-direction:column}";
|
|
4
4
|
|
|
5
|
+
const mapDropdownAlignToChWindowAlign = {
|
|
6
|
+
OutsideStart: "outside-start",
|
|
7
|
+
InsideStart: "inside-start",
|
|
8
|
+
Center: "center",
|
|
9
|
+
InsideEnd: "inside-end",
|
|
10
|
+
OutsideEnd: "outside-end"
|
|
11
|
+
};
|
|
5
12
|
const EXPANDABLE_BUTTON_ID = "expandable-button";
|
|
6
13
|
const SECTION_ID = "section";
|
|
7
14
|
const DROPDOWN_ITEM_TAG_NAME = "ch-dropdown-item";
|
|
@@ -46,11 +53,6 @@ const ChDropDown = class {
|
|
|
46
53
|
this.showFooter = false;
|
|
47
54
|
this.expanded = false;
|
|
48
55
|
this.expandedWithHover = false;
|
|
49
|
-
/**
|
|
50
|
-
* Specifies the horizontal alignment the dropdown section has when using
|
|
51
|
-
* `position === "Top"` or `position === "Bottom"`.
|
|
52
|
-
*/
|
|
53
|
-
this.align = "Center";
|
|
54
56
|
/**
|
|
55
57
|
* This attribute lets you specify the label for the expandable button.
|
|
56
58
|
* Important for accessibility.
|
|
@@ -60,7 +62,12 @@ const ChDropDown = class {
|
|
|
60
62
|
* Determine which actions on the expandable button display the dropdown
|
|
61
63
|
* section.
|
|
62
64
|
*/
|
|
63
|
-
this.expandBehavior = "
|
|
65
|
+
this.expandBehavior = "ClickOrHover";
|
|
66
|
+
/**
|
|
67
|
+
* This attribute lets you specify if the control is nested in another
|
|
68
|
+
* dropdown. Useful to manage keyboard interaction.
|
|
69
|
+
*/
|
|
70
|
+
this.nestedDropdown = false;
|
|
64
71
|
/**
|
|
65
72
|
* Determine if the dropdown section should be opened when the expandable
|
|
66
73
|
* button of the control is focused.
|
|
@@ -70,17 +77,7 @@ const ChDropDown = class {
|
|
|
70
77
|
* Specifies the position of the dropdown section that is placed relative to
|
|
71
78
|
* the expandable button.
|
|
72
79
|
*/
|
|
73
|
-
this.position = "
|
|
74
|
-
/**
|
|
75
|
-
* Specifies the separation (in pixels) between the expandable button and the
|
|
76
|
-
* dropdown section of the control.
|
|
77
|
-
*/
|
|
78
|
-
this.dropdownSeparation = 12;
|
|
79
|
-
/**
|
|
80
|
-
* Specifies the vertical alignment the dropdown section has when using
|
|
81
|
-
* `position === "Right"` or `position === "Left"`.
|
|
82
|
-
*/
|
|
83
|
-
this.valign = "Middle";
|
|
80
|
+
this.position = "Center_OutsideEnd";
|
|
84
81
|
this.closeDropdown = () => {
|
|
85
82
|
this.closeDropdownWithHover();
|
|
86
83
|
this.expanded = false;
|
|
@@ -94,7 +91,7 @@ const ChDropDown = class {
|
|
|
94
91
|
}
|
|
95
92
|
};
|
|
96
93
|
this.closeDropdownWhenClickingOutside = (event) => {
|
|
97
|
-
if (event.composedPath().find(el => el === this.
|
|
94
|
+
if (event.composedPath().find(el => el === this.el) === undefined) {
|
|
98
95
|
this.closeDropdown();
|
|
99
96
|
}
|
|
100
97
|
};
|
|
@@ -112,15 +109,14 @@ const ChDropDown = class {
|
|
|
112
109
|
if (event.code !== TAB_KEY) {
|
|
113
110
|
return;
|
|
114
111
|
}
|
|
115
|
-
const
|
|
116
|
-
const isChildElement = nextFocusedElement.closest("ch-dropdown") === this.element;
|
|
112
|
+
const isChildElement = event.composedPath().includes(this.el);
|
|
117
113
|
if (isChildElement) {
|
|
118
114
|
return;
|
|
119
115
|
}
|
|
120
116
|
this.closeDropdown();
|
|
121
117
|
};
|
|
122
118
|
this.handleMouseLeave = () => {
|
|
123
|
-
const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.
|
|
119
|
+
const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.el;
|
|
124
120
|
if (focusedElementIsInsideDropDown) {
|
|
125
121
|
this.expanded = true;
|
|
126
122
|
}
|
|
@@ -136,11 +132,13 @@ const ChDropDown = class {
|
|
|
136
132
|
this.expandedChange.emit(true);
|
|
137
133
|
}
|
|
138
134
|
};
|
|
139
|
-
this.handleButtonClick = () => {
|
|
135
|
+
this.handleButtonClick = (event) => {
|
|
136
|
+
event.stopPropagation();
|
|
140
137
|
this.expandedChange.emit(!this.expanded);
|
|
141
138
|
this.expanded = !this.expanded;
|
|
142
139
|
};
|
|
143
|
-
this.handleButtonFocus = () => {
|
|
140
|
+
this.handleButtonFocus = (event) => {
|
|
141
|
+
event.stopPropagation();
|
|
144
142
|
if (this.expanded) {
|
|
145
143
|
return;
|
|
146
144
|
}
|
|
@@ -159,9 +157,11 @@ const ChDropDown = class {
|
|
|
159
157
|
capture: true
|
|
160
158
|
});
|
|
161
159
|
// Keyboard events
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
if (!this.nestedDropdown) {
|
|
161
|
+
document.body.addEventListener("keydown", this.handleKeyDownEvents, {
|
|
162
|
+
capture: true
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
165
|
document.body.addEventListener("keyup", this.handleKeyUpEvents, {
|
|
166
166
|
capture: true
|
|
167
167
|
});
|
|
@@ -172,9 +172,11 @@ const ChDropDown = class {
|
|
|
172
172
|
capture: true
|
|
173
173
|
});
|
|
174
174
|
// Keyboard events
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
if (!this.nestedDropdown) {
|
|
176
|
+
document.body.removeEventListener("keydown", this.handleKeyDownEvents, {
|
|
177
|
+
capture: true
|
|
178
|
+
});
|
|
179
|
+
}
|
|
178
180
|
document.body.removeEventListener("keyup", this.handleKeyUpEvents, {
|
|
179
181
|
capture: true
|
|
180
182
|
});
|
|
@@ -189,7 +191,7 @@ const ChDropDown = class {
|
|
|
189
191
|
this.currentFocusedItem = event.target;
|
|
190
192
|
}
|
|
191
193
|
focusFirstDropDownItem() {
|
|
192
|
-
this.currentFocusedItem = this.
|
|
194
|
+
this.currentFocusedItem = this.el.querySelector(DROPDOWN_ITEM_SELECTOR);
|
|
193
195
|
if (this.currentFocusedItem) {
|
|
194
196
|
this.currentFocusedItem.handleFocusElement();
|
|
195
197
|
}
|
|
@@ -218,40 +220,36 @@ const ChDropDown = class {
|
|
|
218
220
|
* works if `openOnFocus = "false"`
|
|
219
221
|
*/
|
|
220
222
|
returnFocusToButton() {
|
|
221
|
-
if (!this.openOnFocus) {
|
|
223
|
+
if (!this.openOnFocus && !this.nestedDropdown) {
|
|
222
224
|
this.expandableButton.focus();
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
componentWillLoad() {
|
|
226
|
-
this.showHeader = !!this.
|
|
227
|
-
this.showFooter = !!this.
|
|
228
|
+
this.showHeader = !!this.el.querySelector(':scope > [slot="header"]');
|
|
229
|
+
this.showFooter = !!this.el.querySelector(':scope > [slot="footer"]');
|
|
228
230
|
}
|
|
229
231
|
render() {
|
|
230
|
-
const
|
|
232
|
+
const aligns = this.position.split("_");
|
|
233
|
+
const alignX = aligns[0];
|
|
234
|
+
const alignY = aligns[1];
|
|
235
|
+
const hasVerticalPosition = alignY === "OutsideStart" || alignY === "OutsideEnd";
|
|
236
|
+
const xAlignMapping = mapDropdownAlignToChWindowAlign[alignX];
|
|
237
|
+
const yAlignMapping = mapDropdownAlignToChWindowAlign[alignY];
|
|
231
238
|
const isExpanded = this.expanded || this.expandedWithHover;
|
|
232
|
-
return (h(Host, { onMouseLeave: this.expandBehavior === "
|
|
239
|
+
return (h(Host, { onMouseLeave: this.expandBehavior === "ClickOrHover"
|
|
233
240
|
? this.handleMouseLeave
|
|
234
|
-
: undefined,
|
|
235
|
-
"--separation-between-button": `-${this.dropdownSeparation}px`,
|
|
236
|
-
"--separation-between-button-size": `${this.dropdownSeparation}px`
|
|
237
|
-
} }, h("button", { id: EXPANDABLE_BUTTON_ID, "aria-controls": SECTION_ID, "aria-expanded": this.expanded.toString(), "aria-haspopup": "true", "aria-label": this.buttonLabel, class: "expandable-button", part: "dropdown__expandable-button", type: "button", onClick: this.handleButtonClick, onFocus: this.openOnFocus ? this.handleButtonFocus : undefined, onMouseEnter: this.expandBehavior === "Click or Hover"
|
|
241
|
+
: undefined }, h("button", { id: EXPANDABLE_BUTTON_ID, "aria-controls": SECTION_ID, "aria-expanded": this.expanded.toString(), "aria-haspopup": "true", "aria-label": this.buttonLabel, class: "expandable-button", part: "expandable-button", type: "button", onClick: this.handleButtonClick, onFocus: this.openOnFocus ? this.handleButtonFocus : undefined, onMouseEnter: this.expandBehavior === "ClickOrHover"
|
|
238
242
|
? this.handleMouseEnter
|
|
239
|
-
: undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })), this.expandBehavior === "
|
|
243
|
+
: undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })), this.expandBehavior === "ClickOrHover" && (
|
|
240
244
|
// Necessary since the separation between the button and the section
|
|
241
245
|
// triggers the onMouseLeave event
|
|
242
246
|
h("div", { "aria-hidden": "true", class: {
|
|
243
|
-
|
|
244
|
-
[`
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}, part: "dropdown__separation" })), h("section", { id: SECTION_ID, "aria-labelledby": EXPANDABLE_BUTTON_ID, class: {
|
|
248
|
-
section: true,
|
|
249
|
-
[`position--${this.position.toLowerCase()}`]: true,
|
|
250
|
-
[`align--${this.align.toLowerCase()}`]: hasVerticalPosition,
|
|
251
|
-
[`valign--${this.valign.toLowerCase()}`]: !hasVerticalPosition
|
|
252
|
-
}, part: "dropdown__section", hidden: !isExpanded }, this.showHeader && (h("header", { class: "header", part: "dropdown__header" }, h("slot", { name: "header" }))), h("div", { role: "list", class: "list", part: "dropdown__list" }, h("slot", { name: "items" })), this.showFooter && (h("footer", { class: "footer", part: "dropdown__footer" }, h("slot", { name: "footer" }))))));
|
|
247
|
+
separation: true,
|
|
248
|
+
[`separation--y separation--y-${yAlignMapping}`]: hasVerticalPosition,
|
|
249
|
+
[`separation--x separation--x-${xAlignMapping}`]: !hasVerticalPosition
|
|
250
|
+
}, part: "separation" })), h("ch-window", { part: "window", exportparts: "window:section,mask,header,footer", container: this.el, closeOnEscape: true, hidden: !isExpanded, modal: false, showFooter: this.showFooter, showHeader: this.showHeader, xAlign: xAlignMapping, yAlign: yAlignMapping }, this.showHeader && h("slot", { name: "header", slot: "header" }), h("div", { role: "list", class: "list", part: "list" }, h("slot", { name: "items" })), this.showFooter && h("slot", { name: "footer", slot: "footer" }))));
|
|
253
251
|
}
|
|
254
|
-
get
|
|
252
|
+
get el() { return getElement(this); }
|
|
255
253
|
static get watchers() { return {
|
|
256
254
|
"expanded": ["handleExpandedChange"]
|
|
257
255
|
}; }
|