@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,211 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-5a32426a.js');
|
|
6
|
+
|
|
7
|
+
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}";
|
|
8
|
+
|
|
9
|
+
const FLOATING_POINT_ERROR = 1;
|
|
10
|
+
const ChActionGroup = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.displayedItemsCountChange = index.createEvent(this, "displayedItemsCountChange", 7);
|
|
14
|
+
this.needForRAF = true; // To prevent redundant RAF (request animation frame) calls
|
|
15
|
+
this.totalItems = -1;
|
|
16
|
+
/**
|
|
17
|
+
* The visible actions when `itemsOverflowBehavior === "ResponsiveCollapse"`.
|
|
18
|
+
*/
|
|
19
|
+
this.displayedItems = -1;
|
|
20
|
+
/**
|
|
21
|
+
* This attribute lets you specify the label for the more actions button.
|
|
22
|
+
* Important for accessibility.
|
|
23
|
+
*/
|
|
24
|
+
this.buttonLabel = "More actions";
|
|
25
|
+
/**
|
|
26
|
+
* This attribute determines how items behave when the content of the ActionGroup overflows horizontal. This property is needed
|
|
27
|
+
* to make the control responsive to changes in the Width of the container of ActionGroup.
|
|
28
|
+
*
|
|
29
|
+
* | Value | Details |
|
|
30
|
+
* | --------------------- | ------------------------------------------------------------------------------------------------ |
|
|
31
|
+
* | `Add Scroll` | The items of the ActionGroup that overflow horizontally are shown by means of a scroll. |
|
|
32
|
+
* | `Multiline` | The ActionGroup items that overflow horizontally are shown in a second line of the control. |
|
|
33
|
+
* | `Responsive Collapse` | The Action Group items, when they start to overflow the control, are placed in the More Actions. |
|
|
34
|
+
*/
|
|
35
|
+
this.itemsOverflowBehavior = "ResponsiveCollapse";
|
|
36
|
+
/**
|
|
37
|
+
* Determine which mouse actions on the expandable button display the dropdown
|
|
38
|
+
* section.
|
|
39
|
+
*/
|
|
40
|
+
this.expandBehavior = "ClickOrHover";
|
|
41
|
+
/**
|
|
42
|
+
* @todo Check a better convention for this property, for example, "ActionsInlineAlignment"
|
|
43
|
+
* This attribute determines the position of the More Actions button in the Action Group.
|
|
44
|
+
*
|
|
45
|
+
* | Value | Details |
|
|
46
|
+
* | --------| --------------------------------------------------------------------- |
|
|
47
|
+
* | `Start` | The More Actions Button is displayed to the left of the ActionGroup. |
|
|
48
|
+
* | `End` | The More Actions Button is displayed to the right of the ActionGroup. |
|
|
49
|
+
*/
|
|
50
|
+
this.moreActionsButtonPosition = "Start";
|
|
51
|
+
/**
|
|
52
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
53
|
+
* the more actions button.
|
|
54
|
+
*/
|
|
55
|
+
this.moreActionsDropdownPosition = "InsideStart_OutsideEnd";
|
|
56
|
+
/**
|
|
57
|
+
* Determine if the dropdowns should be opened when the action is focused.
|
|
58
|
+
*/
|
|
59
|
+
this.openOnFocus = false;
|
|
60
|
+
/**
|
|
61
|
+
* Update the visibility of the actions.
|
|
62
|
+
* Only works if itemsOverflowBehavior === "ResponsiveCollapse"
|
|
63
|
+
*/
|
|
64
|
+
this.updateDisplayedActions = () => {
|
|
65
|
+
const actionGroupItems = this.slotItems.assignedElements();
|
|
66
|
+
// The column-gap property must be taken into account
|
|
67
|
+
const columnGap = getComputedStyle(this.actionsContainer).columnGap;
|
|
68
|
+
const columnGapValue = columnGap != null && columnGap.endsWith("px")
|
|
69
|
+
? Number(columnGap.replace("px", ""))
|
|
70
|
+
: 0;
|
|
71
|
+
// Since the last item does not add column-gap, we have to adjust the measurement
|
|
72
|
+
let availableWidth = this.actionsContainer.clientWidth + columnGapValue - FLOATING_POINT_ERROR;
|
|
73
|
+
let displayedItems = 0;
|
|
74
|
+
// Check which items are visible
|
|
75
|
+
actionGroupItems.forEach(action => {
|
|
76
|
+
const actionWidth = action.clientWidth;
|
|
77
|
+
availableWidth -= actionWidth + columnGapValue;
|
|
78
|
+
if (availableWidth >= 0) {
|
|
79
|
+
action.floating = false;
|
|
80
|
+
displayedItems++;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
action.floating = true;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
this.totalItems = actionGroupItems.length;
|
|
87
|
+
this.displayedItems = displayedItems;
|
|
88
|
+
this.displayedItemsCountChange.emit(displayedItems);
|
|
89
|
+
};
|
|
90
|
+
this.updateDisplayedActionInFrame = () => {
|
|
91
|
+
if (!this.needForRAF) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.needForRAF = false; // No need to call RAF up until next frame
|
|
95
|
+
requestAnimationFrame(() => {
|
|
96
|
+
this.needForRAF = true; // RAF now consumes the movement instruction so a new one can come
|
|
97
|
+
this.updateDisplayedActions();
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
this.updateActionsWatcher = () => {
|
|
101
|
+
if (this.itemsOverflowBehavior !== "ResponsiveCollapse") {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Avoid memory leaks by disconnecting and re-connecting the observer
|
|
105
|
+
this.disconnectActionsObserver();
|
|
106
|
+
this.connectActionsObserver();
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
handleOverflowBehaviorChange(newValue) {
|
|
110
|
+
if (newValue !== "ResponsiveCollapse") {
|
|
111
|
+
const actionGroupItems = this.slotItems.assignedElements();
|
|
112
|
+
// Reset floating
|
|
113
|
+
actionGroupItems.forEach(item => {
|
|
114
|
+
item.floating = false;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
this.setResponsiveCollapse();
|
|
118
|
+
}
|
|
119
|
+
connectActionsObserver() {
|
|
120
|
+
this.actionsWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
|
|
121
|
+
// Observe the actions
|
|
122
|
+
const actionGroupItems = this.slotItems.assignedElements();
|
|
123
|
+
actionGroupItems.forEach(action => {
|
|
124
|
+
this.actionsWatcher.observe(action);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
connectActionsContainerObserver() {
|
|
128
|
+
this.actionsContainerWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
|
|
129
|
+
this.actionsContainerWatcher.observe(this.el);
|
|
130
|
+
}
|
|
131
|
+
disconnectActionsObserver() {
|
|
132
|
+
if (this.actionsWatcher) {
|
|
133
|
+
this.actionsWatcher.disconnect();
|
|
134
|
+
this.actionsWatcher = null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
disconnectActionsContainerObserver() {
|
|
138
|
+
if (this.actionsContainerWatcher) {
|
|
139
|
+
this.actionsContainerWatcher.disconnect();
|
|
140
|
+
this.actionsContainerWatcher = null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
setResponsiveCollapse() {
|
|
144
|
+
this.disconnectActionsObserver();
|
|
145
|
+
this.disconnectActionsContainerObserver();
|
|
146
|
+
if (this.itemsOverflowBehavior !== "ResponsiveCollapse") {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.connectActionsObserver();
|
|
150
|
+
this.connectActionsContainerObserver();
|
|
151
|
+
}
|
|
152
|
+
componentDidLoad() {
|
|
153
|
+
this.setResponsiveCollapse();
|
|
154
|
+
}
|
|
155
|
+
disconnectedCallback() {
|
|
156
|
+
this.disconnectActionsObserver();
|
|
157
|
+
this.disconnectActionsContainerObserver();
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
// @todo TODO: Improve accessibility and keyboard navigation
|
|
161
|
+
return (index.h(index.Host, { role: "menubar", "aria-label": this.accessibleName }, this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
162
|
+
this.totalItems !== this.displayedItems && (index.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 }, index.h("slot", { name: "more-items", slot: "items" }))), index.h("div", { class: {
|
|
163
|
+
actions: true,
|
|
164
|
+
"actions--scroll": this.itemsOverflowBehavior === "AddScroll",
|
|
165
|
+
"actions--multiline": this.itemsOverflowBehavior === "Multiline",
|
|
166
|
+
"actions--responsive": this.itemsOverflowBehavior === "ResponsiveCollapse"
|
|
167
|
+
}, part: "actions", ref: el => (this.actionsContainer = el) }, index.h("slot", { name: "items", onSlotchange: this.updateActionsWatcher, ref: el => (this.slotItems = el) }))));
|
|
168
|
+
}
|
|
169
|
+
get el() { return index.getElement(this); }
|
|
170
|
+
static get watchers() { return {
|
|
171
|
+
"itemsOverflowBehavior": ["handleOverflowBehaviorChange"]
|
|
172
|
+
}; }
|
|
173
|
+
};
|
|
174
|
+
ChActionGroup.style = actionGroupCss;
|
|
175
|
+
|
|
176
|
+
const actionGroupItemCss = "ch-action-group-item[floating]{position:absolute;visibility:hidden}";
|
|
177
|
+
|
|
178
|
+
const ChActionGroupItem = class {
|
|
179
|
+
constructor(hostRef) {
|
|
180
|
+
index.registerInstance(this, hostRef);
|
|
181
|
+
/**
|
|
182
|
+
* `true` to ignore the floating property value.
|
|
183
|
+
*/
|
|
184
|
+
this.avoidFloating = false;
|
|
185
|
+
/**
|
|
186
|
+
* `true` if the control is floating. Useful to implement the
|
|
187
|
+
* `"ResponsiveCollapse"` value for the `itemsOverflowBehavior` property of
|
|
188
|
+
* the ch-action-group control.
|
|
189
|
+
*/
|
|
190
|
+
this.floating = false;
|
|
191
|
+
}
|
|
192
|
+
componentWillLoad() {
|
|
193
|
+
if (this.avoidFloating) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const parentAction = this.el.closest("ch-action-group");
|
|
197
|
+
// Hide items at the start to improve CLS
|
|
198
|
+
if (parentAction) {
|
|
199
|
+
this.floating =
|
|
200
|
+
parentAction.itemsOverflowBehavior === "ResponsiveCollapse";
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
render() {
|
|
204
|
+
return index.h("slot", null);
|
|
205
|
+
}
|
|
206
|
+
get el() { return index.getElement(this); }
|
|
207
|
+
};
|
|
208
|
+
ChActionGroupItem.style = actionGroupItemCss;
|
|
209
|
+
|
|
210
|
+
exports.ch_action_group = ChActionGroup;
|
|
211
|
+
exports.ch_action_group_item = ChActionGroupItem;
|
|
@@ -4,18 +4,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-5a32426a.js');
|
|
6
6
|
|
|
7
|
-
const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}
|
|
7
|
+
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}";
|
|
8
8
|
|
|
9
|
+
const DROPDOWN_ITEM = "ch-dropdown-item";
|
|
9
10
|
const ChDropDownItem = class {
|
|
10
11
|
constructor(hostRef) {
|
|
11
12
|
index.registerInstance(this, hostRef);
|
|
12
13
|
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
13
14
|
this.focusChange = index.createEvent(this, "focusChange", 7);
|
|
15
|
+
this.hasItems = false;
|
|
16
|
+
/**
|
|
17
|
+
* Determine which actions on the expandable button display the dropdown
|
|
18
|
+
* section.
|
|
19
|
+
* Only works if the control has subitems.
|
|
20
|
+
*/
|
|
21
|
+
this.expandBehavior = "ClickOrHover";
|
|
22
|
+
/**
|
|
23
|
+
* `true` to force the control to make its own containing block.
|
|
24
|
+
*/
|
|
25
|
+
this.forceContainingBlock = true;
|
|
26
|
+
/**
|
|
27
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
28
|
+
* button of the control is focused.
|
|
29
|
+
* Only works if the control has subitems.
|
|
30
|
+
*/
|
|
31
|
+
this.openOnFocus = false;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
34
|
+
* the expandable button.
|
|
35
|
+
*/
|
|
36
|
+
this.position = "Center_OutsideEnd";
|
|
14
37
|
this.dropDownItemContent = () => [
|
|
15
|
-
!!this.leftImgSrc && (index.h("img", { "aria-hidden": "true", class: "left-img", part: "
|
|
16
|
-
index.h("span", { class: "content", part: "
|
|
17
|
-
!!this.rightImgSrc && (index.h("img", { "aria-hidden": "true", class: "right-img", part: "
|
|
38
|
+
!!this.leftImgSrc && (index.h("img", { "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
|
|
39
|
+
index.h("span", { class: "content", part: "content" }, index.h("slot", null)),
|
|
40
|
+
!!this.rightImgSrc && (index.h("img", { "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
|
|
18
41
|
];
|
|
42
|
+
this.checkItems = () => {
|
|
43
|
+
this.hasItems = !!this.element.querySelector(`:scope>${DROPDOWN_ITEM}`);
|
|
44
|
+
};
|
|
45
|
+
this.noItemsRender = () => this.href ? (index.h("a", { class: "action", part: "action target", href: this.href, onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), index.h("slot", { name: "items", onSlotchange: this.checkItems }))) : (index.h("button", { class: "action", part: "action button", type: "button", onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), index.h("slot", { name: "items", onSlotchange: this.checkItems })));
|
|
46
|
+
this.itemsRender = () => (index.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 }, index.h("div", { class: "dummy-wrapper", slot: "action" }, this.dropDownItemContent()), index.h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
|
|
19
47
|
this.handleActionClick = () => {
|
|
20
48
|
this.actionClick.emit(this.element.id);
|
|
21
49
|
};
|
|
@@ -29,8 +57,11 @@ const ChDropDownItem = class {
|
|
|
29
57
|
async handleFocusElement() {
|
|
30
58
|
this.mainElement.focus();
|
|
31
59
|
}
|
|
60
|
+
componentWillLoad() {
|
|
61
|
+
this.checkItems();
|
|
62
|
+
}
|
|
32
63
|
render() {
|
|
33
|
-
return (index.h(index.Host, { role: "listitem" }, this.
|
|
64
|
+
return (index.h(index.Host, { role: "listitem" }, this.hasItems ? this.itemsRender() : this.noItemsRender()));
|
|
34
65
|
}
|
|
35
66
|
get element() { return index.getElement(this); }
|
|
36
67
|
};
|
|
@@ -4,8 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-5a32426a.js');
|
|
6
6
|
|
|
7
|
-
const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}
|
|
7
|
+
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}";
|
|
8
8
|
|
|
9
|
+
const mapDropdownAlignToChWindowAlign = {
|
|
10
|
+
OutsideStart: "outside-start",
|
|
11
|
+
InsideStart: "inside-start",
|
|
12
|
+
Center: "center",
|
|
13
|
+
InsideEnd: "inside-end",
|
|
14
|
+
OutsideEnd: "outside-end"
|
|
15
|
+
};
|
|
9
16
|
const EXPANDABLE_BUTTON_ID = "expandable-button";
|
|
10
17
|
const SECTION_ID = "section";
|
|
11
18
|
const DROPDOWN_ITEM_TAG_NAME = "ch-dropdown-item";
|
|
@@ -50,11 +57,6 @@ const ChDropDown = class {
|
|
|
50
57
|
this.showFooter = false;
|
|
51
58
|
this.expanded = false;
|
|
52
59
|
this.expandedWithHover = false;
|
|
53
|
-
/**
|
|
54
|
-
* Specifies the horizontal alignment the dropdown section has when using
|
|
55
|
-
* `position === "Top"` or `position === "Bottom"`.
|
|
56
|
-
*/
|
|
57
|
-
this.align = "Center";
|
|
58
60
|
/**
|
|
59
61
|
* This attribute lets you specify the label for the expandable button.
|
|
60
62
|
* Important for accessibility.
|
|
@@ -64,7 +66,12 @@ const ChDropDown = class {
|
|
|
64
66
|
* Determine which actions on the expandable button display the dropdown
|
|
65
67
|
* section.
|
|
66
68
|
*/
|
|
67
|
-
this.expandBehavior = "
|
|
69
|
+
this.expandBehavior = "ClickOrHover";
|
|
70
|
+
/**
|
|
71
|
+
* This attribute lets you specify if the control is nested in another
|
|
72
|
+
* dropdown. Useful to manage keyboard interaction.
|
|
73
|
+
*/
|
|
74
|
+
this.nestedDropdown = false;
|
|
68
75
|
/**
|
|
69
76
|
* Determine if the dropdown section should be opened when the expandable
|
|
70
77
|
* button of the control is focused.
|
|
@@ -74,17 +81,7 @@ const ChDropDown = class {
|
|
|
74
81
|
* Specifies the position of the dropdown section that is placed relative to
|
|
75
82
|
* the expandable button.
|
|
76
83
|
*/
|
|
77
|
-
this.position = "
|
|
78
|
-
/**
|
|
79
|
-
* Specifies the separation (in pixels) between the expandable button and the
|
|
80
|
-
* dropdown section of the control.
|
|
81
|
-
*/
|
|
82
|
-
this.dropdownSeparation = 12;
|
|
83
|
-
/**
|
|
84
|
-
* Specifies the vertical alignment the dropdown section has when using
|
|
85
|
-
* `position === "Right"` or `position === "Left"`.
|
|
86
|
-
*/
|
|
87
|
-
this.valign = "Middle";
|
|
84
|
+
this.position = "Center_OutsideEnd";
|
|
88
85
|
this.closeDropdown = () => {
|
|
89
86
|
this.closeDropdownWithHover();
|
|
90
87
|
this.expanded = false;
|
|
@@ -98,7 +95,7 @@ const ChDropDown = class {
|
|
|
98
95
|
}
|
|
99
96
|
};
|
|
100
97
|
this.closeDropdownWhenClickingOutside = (event) => {
|
|
101
|
-
if (event.composedPath().find(el => el === this.
|
|
98
|
+
if (event.composedPath().find(el => el === this.el) === undefined) {
|
|
102
99
|
this.closeDropdown();
|
|
103
100
|
}
|
|
104
101
|
};
|
|
@@ -116,15 +113,14 @@ const ChDropDown = class {
|
|
|
116
113
|
if (event.code !== TAB_KEY) {
|
|
117
114
|
return;
|
|
118
115
|
}
|
|
119
|
-
const
|
|
120
|
-
const isChildElement = nextFocusedElement.closest("ch-dropdown") === this.element;
|
|
116
|
+
const isChildElement = event.composedPath().includes(this.el);
|
|
121
117
|
if (isChildElement) {
|
|
122
118
|
return;
|
|
123
119
|
}
|
|
124
120
|
this.closeDropdown();
|
|
125
121
|
};
|
|
126
122
|
this.handleMouseLeave = () => {
|
|
127
|
-
const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.
|
|
123
|
+
const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.el;
|
|
128
124
|
if (focusedElementIsInsideDropDown) {
|
|
129
125
|
this.expanded = true;
|
|
130
126
|
}
|
|
@@ -140,11 +136,13 @@ const ChDropDown = class {
|
|
|
140
136
|
this.expandedChange.emit(true);
|
|
141
137
|
}
|
|
142
138
|
};
|
|
143
|
-
this.handleButtonClick = () => {
|
|
139
|
+
this.handleButtonClick = (event) => {
|
|
140
|
+
event.stopPropagation();
|
|
144
141
|
this.expandedChange.emit(!this.expanded);
|
|
145
142
|
this.expanded = !this.expanded;
|
|
146
143
|
};
|
|
147
|
-
this.handleButtonFocus = () => {
|
|
144
|
+
this.handleButtonFocus = (event) => {
|
|
145
|
+
event.stopPropagation();
|
|
148
146
|
if (this.expanded) {
|
|
149
147
|
return;
|
|
150
148
|
}
|
|
@@ -163,9 +161,11 @@ const ChDropDown = class {
|
|
|
163
161
|
capture: true
|
|
164
162
|
});
|
|
165
163
|
// Keyboard events
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
if (!this.nestedDropdown) {
|
|
165
|
+
document.body.addEventListener("keydown", this.handleKeyDownEvents, {
|
|
166
|
+
capture: true
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
169
|
document.body.addEventListener("keyup", this.handleKeyUpEvents, {
|
|
170
170
|
capture: true
|
|
171
171
|
});
|
|
@@ -176,9 +176,11 @@ const ChDropDown = class {
|
|
|
176
176
|
capture: true
|
|
177
177
|
});
|
|
178
178
|
// Keyboard events
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
if (!this.nestedDropdown) {
|
|
180
|
+
document.body.removeEventListener("keydown", this.handleKeyDownEvents, {
|
|
181
|
+
capture: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
182
184
|
document.body.removeEventListener("keyup", this.handleKeyUpEvents, {
|
|
183
185
|
capture: true
|
|
184
186
|
});
|
|
@@ -193,7 +195,7 @@ const ChDropDown = class {
|
|
|
193
195
|
this.currentFocusedItem = event.target;
|
|
194
196
|
}
|
|
195
197
|
focusFirstDropDownItem() {
|
|
196
|
-
this.currentFocusedItem = this.
|
|
198
|
+
this.currentFocusedItem = this.el.querySelector(DROPDOWN_ITEM_SELECTOR);
|
|
197
199
|
if (this.currentFocusedItem) {
|
|
198
200
|
this.currentFocusedItem.handleFocusElement();
|
|
199
201
|
}
|
|
@@ -222,40 +224,36 @@ const ChDropDown = class {
|
|
|
222
224
|
* works if `openOnFocus = "false"`
|
|
223
225
|
*/
|
|
224
226
|
returnFocusToButton() {
|
|
225
|
-
if (!this.openOnFocus) {
|
|
227
|
+
if (!this.openOnFocus && !this.nestedDropdown) {
|
|
226
228
|
this.expandableButton.focus();
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
componentWillLoad() {
|
|
230
|
-
this.showHeader = !!this.
|
|
231
|
-
this.showFooter = !!this.
|
|
232
|
+
this.showHeader = !!this.el.querySelector(':scope > [slot="header"]');
|
|
233
|
+
this.showFooter = !!this.el.querySelector(':scope > [slot="footer"]');
|
|
232
234
|
}
|
|
233
235
|
render() {
|
|
234
|
-
const
|
|
236
|
+
const aligns = this.position.split("_");
|
|
237
|
+
const alignX = aligns[0];
|
|
238
|
+
const alignY = aligns[1];
|
|
239
|
+
const hasVerticalPosition = alignY === "OutsideStart" || alignY === "OutsideEnd";
|
|
240
|
+
const xAlignMapping = mapDropdownAlignToChWindowAlign[alignX];
|
|
241
|
+
const yAlignMapping = mapDropdownAlignToChWindowAlign[alignY];
|
|
235
242
|
const isExpanded = this.expanded || this.expandedWithHover;
|
|
236
|
-
return (index.h(index.Host, { onMouseLeave: this.expandBehavior === "
|
|
243
|
+
return (index.h(index.Host, { onMouseLeave: this.expandBehavior === "ClickOrHover"
|
|
237
244
|
? this.handleMouseLeave
|
|
238
|
-
: undefined,
|
|
239
|
-
"--separation-between-button": `-${this.dropdownSeparation}px`,
|
|
240
|
-
"--separation-between-button-size": `${this.dropdownSeparation}px`
|
|
241
|
-
} }, index.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"
|
|
245
|
+
: undefined }, index.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"
|
|
242
246
|
? this.handleMouseEnter
|
|
243
|
-
: undefined, ref: el => (this.expandableButton = el) }, index.h("slot", { name: "action" })), this.expandBehavior === "
|
|
247
|
+
: undefined, ref: el => (this.expandableButton = el) }, index.h("slot", { name: "action" })), this.expandBehavior === "ClickOrHover" && (
|
|
244
248
|
// Necessary since the separation between the button and the section
|
|
245
249
|
// triggers the onMouseLeave event
|
|
246
250
|
index.h("div", { "aria-hidden": "true", class: {
|
|
247
|
-
|
|
248
|
-
[`
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}, part: "dropdown__separation" })), index.h("section", { id: SECTION_ID, "aria-labelledby": EXPANDABLE_BUTTON_ID, class: {
|
|
252
|
-
section: true,
|
|
253
|
-
[`position--${this.position.toLowerCase()}`]: true,
|
|
254
|
-
[`align--${this.align.toLowerCase()}`]: hasVerticalPosition,
|
|
255
|
-
[`valign--${this.valign.toLowerCase()}`]: !hasVerticalPosition
|
|
256
|
-
}, part: "dropdown__section", hidden: !isExpanded }, this.showHeader && (index.h("header", { class: "header", part: "dropdown__header" }, index.h("slot", { name: "header" }))), index.h("div", { role: "list", class: "list", part: "dropdown__list" }, index.h("slot", { name: "items" })), this.showFooter && (index.h("footer", { class: "footer", part: "dropdown__footer" }, index.h("slot", { name: "footer" }))))));
|
|
251
|
+
separation: true,
|
|
252
|
+
[`separation--y separation--y-${yAlignMapping}`]: hasVerticalPosition,
|
|
253
|
+
[`separation--x separation--x-${xAlignMapping}`]: !hasVerticalPosition
|
|
254
|
+
}, part: "separation" })), index.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 && index.h("slot", { name: "header", slot: "header" }), index.h("div", { role: "list", class: "list", part: "list" }, index.h("slot", { name: "items" })), this.showFooter && index.h("slot", { name: "footer", slot: "footer" }))));
|
|
257
255
|
}
|
|
258
|
-
get
|
|
256
|
+
get el() { return index.getElement(this); }
|
|
259
257
|
static get watchers() { return {
|
|
260
258
|
"expanded": ["handleExpandedChange"]
|
|
261
259
|
}; }
|