@genexus/genexus-ide-ui 0.0.23 → 0.0.25
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-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/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +13 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -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 +34 -15
- 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-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/gx-ide-team-dev-commit.js +14 -13
- package/dist/components/index.js +4 -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-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/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-team-dev-commit.entry.js +13 -13
- 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/p-097a3eeb.entry.js +1 -0
- package/dist/genexus-ide-ui/p-4bbe1c18.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-9c82381c.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/types.d.ts +1 -0
- package/dist/types/components/team-dev-commit/team-dev-commit.d.ts +13 -6
- package/dist/types/components/team-dev-update/team-dev-update.d.ts +1 -1
- package/dist/types/components.d.ts +9 -1
- package/package.json +3 -3
- 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-66072dce.entry.js +0 -1
- package/dist/genexus-ide-ui/p-c10d5f34.entry.js +0 -1
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './ch-window2.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './ch-window-close2.js';
|
|
4
|
+
|
|
5
|
+
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}";
|
|
6
|
+
|
|
7
|
+
const mapDropdownAlignToChWindowAlign = {
|
|
8
|
+
OutsideStart: "outside-start",
|
|
9
|
+
InsideStart: "inside-start",
|
|
10
|
+
Center: "center",
|
|
11
|
+
InsideEnd: "inside-end",
|
|
12
|
+
OutsideEnd: "outside-end"
|
|
13
|
+
};
|
|
14
|
+
const EXPANDABLE_BUTTON_ID = "expandable-button";
|
|
15
|
+
const SECTION_ID = "section";
|
|
16
|
+
const DROPDOWN_ITEM_TAG_NAME = "ch-dropdown-item";
|
|
17
|
+
const DROPDOWN_ITEM_SELECTOR = `:scope > ${DROPDOWN_ITEM_TAG_NAME}`;
|
|
18
|
+
// Keys
|
|
19
|
+
const TAB_KEY = "Tab";
|
|
20
|
+
const ChDropDown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.__registerHost();
|
|
24
|
+
this.__attachShadow();
|
|
25
|
+
this.expandedChange = createEvent(this, "expandedChange", 7);
|
|
26
|
+
this.keyEventsDictionary = {
|
|
27
|
+
ArrowDown: (event) => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
if (!this.currentFocusedItem) {
|
|
30
|
+
this.focusFirstDropDownItem();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const nextDropDownItem = this.findNextDropDownItemSibling();
|
|
34
|
+
if (nextDropDownItem) {
|
|
35
|
+
// This is wrong, it should call the focusElement Method. StencilJS bug?
|
|
36
|
+
nextDropDownItem.handleFocusElement();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
ArrowUp: (event) => {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
if (!this.currentFocusedItem) {
|
|
42
|
+
this.focusFirstDropDownItem();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const previousDropDownItem = this.findPreviousDropDownItemSibling();
|
|
46
|
+
if (previousDropDownItem) {
|
|
47
|
+
// This is wrong, it should call the focusElement Method. StencilJS bug?
|
|
48
|
+
previousDropDownItem.handleFocusElement();
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
Escape: () => {
|
|
52
|
+
this.closeDropdown();
|
|
53
|
+
this.returnFocusToButton();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this.showHeader = false;
|
|
57
|
+
this.showFooter = false;
|
|
58
|
+
this.expanded = false;
|
|
59
|
+
this.expandedWithHover = false;
|
|
60
|
+
/**
|
|
61
|
+
* This attribute lets you specify the label for the expandable button.
|
|
62
|
+
* Important for accessibility.
|
|
63
|
+
*/
|
|
64
|
+
this.buttonLabel = "Show options";
|
|
65
|
+
/**
|
|
66
|
+
* Determine which actions on the expandable button display the dropdown
|
|
67
|
+
* section.
|
|
68
|
+
*/
|
|
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;
|
|
75
|
+
/**
|
|
76
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
77
|
+
* button of the control is focused.
|
|
78
|
+
*/
|
|
79
|
+
this.openOnFocus = false;
|
|
80
|
+
/**
|
|
81
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
82
|
+
* the expandable button.
|
|
83
|
+
*/
|
|
84
|
+
this.position = "Center_OutsideEnd";
|
|
85
|
+
this.closeDropdown = () => {
|
|
86
|
+
this.closeDropdownWithHover();
|
|
87
|
+
this.expanded = false;
|
|
88
|
+
this.expandedChange.emit(false);
|
|
89
|
+
};
|
|
90
|
+
this.closeDropdownWithHover = () => {
|
|
91
|
+
this.expandedWithHover = false;
|
|
92
|
+
// If the control was not expanded with focus
|
|
93
|
+
if (!this.expanded) {
|
|
94
|
+
this.expandedChange.emit(false);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this.closeDropdownWhenClickingOutside = (event) => {
|
|
98
|
+
if (event.composedPath().find(el => el === this.el) === undefined) {
|
|
99
|
+
this.closeDropdown();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
this.handleKeyDownEvents = (event) => {
|
|
103
|
+
const keyEventHandler = this.keyEventsDictionary[event.code];
|
|
104
|
+
if (keyEventHandler) {
|
|
105
|
+
keyEventHandler(event);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Check if the next focused element is a child element of the dropdown
|
|
110
|
+
* control.
|
|
111
|
+
*/
|
|
112
|
+
this.handleKeyUpEvents = (event) => {
|
|
113
|
+
if (event.code !== TAB_KEY) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const isChildElement = event.composedPath().includes(this.el);
|
|
117
|
+
if (isChildElement) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.closeDropdown();
|
|
121
|
+
};
|
|
122
|
+
this.handleMouseLeave = () => {
|
|
123
|
+
const focusedElementIsInsideDropDown = document.activeElement.closest("ch-dropdown") === this.el;
|
|
124
|
+
if (focusedElementIsInsideDropDown) {
|
|
125
|
+
this.expanded = true;
|
|
126
|
+
}
|
|
127
|
+
this.closeDropdownWithHover();
|
|
128
|
+
};
|
|
129
|
+
this.handleMouseEnter = () => {
|
|
130
|
+
if (this.expandedWithHover) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this.expandedWithHover = true;
|
|
134
|
+
// If not previously expanded, emit the event
|
|
135
|
+
if (!this.expanded) {
|
|
136
|
+
this.expandedChange.emit(true);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
this.handleButtonClick = (event) => {
|
|
140
|
+
event.stopPropagation();
|
|
141
|
+
this.expandedChange.emit(!this.expanded);
|
|
142
|
+
this.expanded = !this.expanded;
|
|
143
|
+
};
|
|
144
|
+
this.handleButtonFocus = (event) => {
|
|
145
|
+
event.stopPropagation();
|
|
146
|
+
if (this.expanded) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.expanded = true;
|
|
150
|
+
// If not previously expanded, emit the event
|
|
151
|
+
if (!this.expandedWithHover) {
|
|
152
|
+
this.expandedChange.emit(true);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
handleExpandedChange(newExpandedValue) {
|
|
157
|
+
if (newExpandedValue) {
|
|
158
|
+
this.currentFocusedItem = undefined;
|
|
159
|
+
// Click
|
|
160
|
+
document.body.addEventListener("click", this.closeDropdownWhenClickingOutside, {
|
|
161
|
+
capture: true
|
|
162
|
+
});
|
|
163
|
+
// Keyboard events
|
|
164
|
+
if (!this.nestedDropdown) {
|
|
165
|
+
document.body.addEventListener("keydown", this.handleKeyDownEvents, {
|
|
166
|
+
capture: true
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
document.body.addEventListener("keyup", this.handleKeyUpEvents, {
|
|
170
|
+
capture: true
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// Click
|
|
175
|
+
document.body.removeEventListener("click", this.closeDropdownWhenClickingOutside, {
|
|
176
|
+
capture: true
|
|
177
|
+
});
|
|
178
|
+
// Keyboard events
|
|
179
|
+
if (!this.nestedDropdown) {
|
|
180
|
+
document.body.removeEventListener("keydown", this.handleKeyDownEvents, {
|
|
181
|
+
capture: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
document.body.removeEventListener("keyup", this.handleKeyUpEvents, {
|
|
185
|
+
capture: true
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
handleActionClick() {
|
|
190
|
+
this.closeDropdown();
|
|
191
|
+
// @todo This behavior must be specified by a property
|
|
192
|
+
// this.returnFocusToButton();
|
|
193
|
+
}
|
|
194
|
+
handleDropDownItemFocusChange(event) {
|
|
195
|
+
this.currentFocusedItem = event.target;
|
|
196
|
+
}
|
|
197
|
+
focusFirstDropDownItem() {
|
|
198
|
+
this.currentFocusedItem = this.el.querySelector(DROPDOWN_ITEM_SELECTOR);
|
|
199
|
+
if (this.currentFocusedItem) {
|
|
200
|
+
this.currentFocusedItem.handleFocusElement();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
findNextDropDownItemSibling() {
|
|
204
|
+
let nextSibling = this.currentFocusedItem
|
|
205
|
+
.nextElementSibling;
|
|
206
|
+
while (nextSibling &&
|
|
207
|
+
nextSibling.tagName.toLowerCase() !== DROPDOWN_ITEM_TAG_NAME) {
|
|
208
|
+
nextSibling = nextSibling.nextElementSibling;
|
|
209
|
+
}
|
|
210
|
+
return nextSibling;
|
|
211
|
+
}
|
|
212
|
+
findPreviousDropDownItemSibling() {
|
|
213
|
+
let previousSibling = this.currentFocusedItem
|
|
214
|
+
.previousElementSibling;
|
|
215
|
+
while (previousSibling &&
|
|
216
|
+
previousSibling.tagName.toLowerCase() !== DROPDOWN_ITEM_TAG_NAME) {
|
|
217
|
+
previousSibling =
|
|
218
|
+
previousSibling.previousElementSibling;
|
|
219
|
+
}
|
|
220
|
+
return previousSibling;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns focus to the expandable button when closing the dropdown. Only
|
|
224
|
+
* works if `openOnFocus = "false"`
|
|
225
|
+
*/
|
|
226
|
+
returnFocusToButton() {
|
|
227
|
+
if (!this.openOnFocus && !this.nestedDropdown) {
|
|
228
|
+
this.expandableButton.focus();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
componentWillLoad() {
|
|
232
|
+
this.showHeader = !!this.el.querySelector(':scope > [slot="header"]');
|
|
233
|
+
this.showFooter = !!this.el.querySelector(':scope > [slot="footer"]');
|
|
234
|
+
}
|
|
235
|
+
render() {
|
|
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];
|
|
242
|
+
const isExpanded = this.expanded || this.expandedWithHover;
|
|
243
|
+
return (h(Host, { onMouseLeave: this.expandBehavior === "ClickOrHover"
|
|
244
|
+
? this.handleMouseLeave
|
|
245
|
+
: 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"
|
|
246
|
+
? this.handleMouseEnter
|
|
247
|
+
: undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })), this.expandBehavior === "ClickOrHover" && (
|
|
248
|
+
// Necessary since the separation between the button and the section
|
|
249
|
+
// triggers the onMouseLeave event
|
|
250
|
+
h("div", { "aria-hidden": "true", class: {
|
|
251
|
+
separation: true,
|
|
252
|
+
[`separation--y separation--y-${yAlignMapping}`]: hasVerticalPosition,
|
|
253
|
+
[`separation--x separation--x-${xAlignMapping}`]: !hasVerticalPosition
|
|
254
|
+
}, 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" }))));
|
|
255
|
+
}
|
|
256
|
+
get el() { return this; }
|
|
257
|
+
static get watchers() { return {
|
|
258
|
+
"expanded": ["handleExpandedChange"]
|
|
259
|
+
}; }
|
|
260
|
+
static get style() { return dropdownCss; }
|
|
261
|
+
}, [1, "ch-dropdown", {
|
|
262
|
+
"buttonLabel": [1, "button-label"],
|
|
263
|
+
"expandBehavior": [1, "expand-behavior"],
|
|
264
|
+
"nestedDropdown": [4, "nested-dropdown"],
|
|
265
|
+
"openOnFocus": [4, "open-on-focus"],
|
|
266
|
+
"position": [1],
|
|
267
|
+
"expanded": [32],
|
|
268
|
+
"expandedWithHover": [32]
|
|
269
|
+
}, [[0, "actionClick", "handleActionClick"], [0, "focusChange", "handleDropDownItemFocusChange"]]]);
|
|
270
|
+
function defineCustomElement() {
|
|
271
|
+
if (typeof customElements === "undefined") {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const components = ["ch-dropdown", "ch-window", "ch-window-close"];
|
|
275
|
+
components.forEach(tagName => { switch (tagName) {
|
|
276
|
+
case "ch-dropdown":
|
|
277
|
+
if (!customElements.get(tagName)) {
|
|
278
|
+
customElements.define(tagName, ChDropDown);
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
case "ch-window":
|
|
282
|
+
if (!customElements.get(tagName)) {
|
|
283
|
+
defineCustomElement$2();
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
case "ch-window-close":
|
|
287
|
+
if (!customElements.get(tagName)) {
|
|
288
|
+
defineCustomElement$1();
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
} });
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { ChDropDown as C, defineCustomElement as d };
|
|
@@ -107,27 +107,25 @@ const GxIdeTeamDevCommit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
107
107
|
this.chGridPendingCommitsEl.addEventListener("rowMarkingChanged", this.pendingCommitsRowMarkingChangedHandler);
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
this.
|
|
110
|
+
this.gridOnContextMenuCallbackHandler = (grid) => async (ev) => {
|
|
111
111
|
ev.preventDefault();
|
|
112
112
|
ev.stopPropagation();
|
|
113
|
-
let markedRowsIds;
|
|
114
|
-
if (grid === "commit") {
|
|
115
|
-
markedRowsIds = await this.chGridPendingCommitsEl.getMarkedRows();
|
|
116
|
-
}
|
|
117
|
-
else if (grid === "ignored") {
|
|
118
|
-
markedRowsIds = await this.chIgnoredObjectsEl.getMarkedRows();
|
|
119
|
-
}
|
|
120
113
|
if (this.gridContextMenuCallback) {
|
|
121
|
-
await this.gridContextMenuCallback(
|
|
114
|
+
await this.gridContextMenuCallback(grid, ev.detail);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
this.gridOnSelectionChangedCallbackHandler = (grid) => async (ev) => {
|
|
118
|
+
if (this.selectCallback) {
|
|
119
|
+
await this.selectCallback(grid, ev.detail.rowsId);
|
|
122
120
|
}
|
|
123
121
|
};
|
|
124
122
|
/* pending commits grid render*/
|
|
125
123
|
this.renderPendingCommitsGrid = () => {
|
|
126
|
-
return (h("gxg-grid", null, h("ch-grid", { rowSelectionMode: "multiple", ref: (el) => (this.chGridPendingCommitsEl = el), part: "ch-grid-pending-commits", class: "no-border",
|
|
124
|
+
return (h("gxg-grid", null, h("ch-grid", { rowSelectionMode: "multiple", ref: (el) => (this.chGridPendingCommitsEl = el), part: "ch-grid-pending-commits", class: "no-border", onRowContextMenu: this.gridOnContextMenuCallbackHandler("commit"), onSelectionChanged: this.gridOnSelectionChangedCallbackHandler("commit") }, h("ch-grid-columnset", null, h("ch-grid-column", { columnType: "rich", richRowSelector: true, richRowSelectorMode: "mark", settingable: false, sortable: false, size: "auto" }), h("ch-grid-column", { columnName: "State", settingable: false, sortable: false, size: "auto" }), h("ch-grid-column", { settingable: false, sortable: false, size: "auto" }), h("ch-grid-column", { sortable: true, columnName: "Name", settingable: false, size: "auto" }), h("ch-grid-column", { sortable: true, columnName: "Type", settingable: false, size: "auto" }), h("ch-grid-column", { columnName: "Description", settingable: false, size: "auto" }), h("ch-grid-column", { sortable: true, columnName: "Modified On", settingable: false }), h("ch-grid-column", { columnName: "Module", settingable: false, size: "auto" }), h("ch-grid-column", { columnName: "Local State", settingable: false, size: "auto" }), h("ch-grid-column", { columnName: "Last Synchronized", settingable: false, size: "150px" }), h("ch-grid-column", { sortable: true, columnName: "User", settingable: false, size: "auto" })), this.pendingCommits.map((obj) => (h("ch-grid-row", { rowid: obj.id }, h("ch-grid-cell", { "cell-type": "rich", "row-selector": true }), h("ch-grid-cell", null, " ", this.renderIconState(obj.state), " "), h("ch-grid-cell", null, h("gxg-icon", { color: "auto", type: obj.iconType })), h("ch-grid-cell", null, " ", obj.name, " "), h("ch-grid-cell", null, " ", obj.type, " "), h("ch-grid-cell", null, " ", obj.description, " "), h("ch-grid-cell", null, `${formatDate(obj.modifiedOn)}`), h("ch-grid-cell", null, " ", obj.module, " "), h("ch-grid-cell", null, " ", obj.localState, " "), h("ch-grid-cell", null, `${formatDate(obj.lastSynchronized)}`), h("ch-grid-cell", null, " ", obj.user, " ")))))));
|
|
127
125
|
};
|
|
128
126
|
/* ignored objects grid render*/
|
|
129
127
|
this.renderIgnoredObjectsGrid = () => {
|
|
130
|
-
return (h("gxg-grid", null, h("ch-grid", { rowSelectionMode: "multiple",
|
|
128
|
+
return (h("gxg-grid", null, h("ch-grid", { rowSelectionMode: "multiple", part: "ch-grid-pending-commits", onRowContextMenu: this.gridOnContextMenuCallbackHandler("ignored"), onSelectionChanged: this.gridOnSelectionChangedCallbackHandler("ignored") }, h("ch-grid-columnset", null, h("ch-grid-column", { columnName: "", settingable: false }), h("ch-grid-column", { columnName: "TypeIcon", settingable: false }), h("ch-grid-column", { columnName: "Name", settingable: false, sortable: true }), h("ch-grid-column", { columnName: "Type", settingable: false }), h("ch-grid-column", { columnName: "Description", settingable: false }), h("ch-grid-column", { columnName: "Modified On", settingable: false }), h("ch-grid-column", { columnName: "Module", settingable: false }), h("ch-grid-column", { columnName: "Local State", settingable: false }), h("ch-grid-column", { columnName: "Last Synchronized", settingable: false }), h("ch-grid-column", { columnName: "User", settingable: false })), this.ignoredObjects.map((obj) => (h("ch-grid-row", { "row-id": obj.id, selected: true }, h("ch-grid-cell", null, " ", this.renderIconState(obj.state), " "), h("ch-grid-cell", null, h("gxg-icon", { color: "auto", type: obj.iconType })), h("ch-grid-cell", null, " ", obj.name, " "), h("ch-grid-cell", null, " ", obj.type, " "), h("ch-grid-cell", null, " ", obj.description, " "), h("ch-grid-cell", null, `${formatDate(obj.modifiedOn)}`), h("ch-grid-cell", null, " ", obj.module, " "), h("ch-grid-cell", null, " ", obj.localState, " "), h("ch-grid-cell", null, `${formatDate(obj.lastSynchronized)}`), h("ch-grid-cell", null, " ", obj.user, " ")))))));
|
|
131
129
|
};
|
|
132
130
|
this.getRecentCommentHandler = async () => {
|
|
133
131
|
if (this.getRecentCommentCallback) {
|
|
@@ -138,10 +136,11 @@ const GxIdeTeamDevCommit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
138
136
|
}
|
|
139
137
|
};
|
|
140
138
|
this.commitCallbackHandler = async () => {
|
|
139
|
+
const commitComment = this.commitComment.value;
|
|
141
140
|
this.chGridPendingCommitsEl
|
|
142
141
|
.getMarkedRows()
|
|
143
142
|
.then(async (pendingCommitsCheckedIds) => {
|
|
144
|
-
await this.commitCallback(pendingCommitsCheckedIds);
|
|
143
|
+
await this.commitCallback(pendingCommitsCheckedIds, commitComment);
|
|
145
144
|
/* returns boolean*/
|
|
146
145
|
});
|
|
147
146
|
};
|
|
@@ -178,6 +177,7 @@ const GxIdeTeamDevCommit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
178
177
|
this.getRecentCommentCallback = undefined;
|
|
179
178
|
this.loadCallback = undefined;
|
|
180
179
|
this.commitCallback = undefined;
|
|
180
|
+
this.selectCallback = undefined;
|
|
181
181
|
this.pendingItemCheckedCallback = undefined;
|
|
182
182
|
this.gridContextMenuCallback = undefined;
|
|
183
183
|
}
|
|
@@ -208,7 +208,7 @@ const GxIdeTeamDevCommit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
208
208
|
}
|
|
209
209
|
// 10.RENDER() FUNCTION //
|
|
210
210
|
render() {
|
|
211
|
-
return (h(Host, { class: "gx-ide-component" }, h("div", { class: "gx-ide-main-wrapper gx-ide-overflow" }, h("gxg-container", null, h("header", { class: "header grid" }, h("gxg-form-textarea", { id: "gxg-textarea", height: "100px", label: this._componentLocale.topMenu.commentLabel, value: this.comment, placeholder: this._componentLocale.topMenu.commentPlaceholder }), h("gxg-button", { type: "outlined", part: "location", onClick: this.getRecentCommentHandler }, this._componentLocale.topMenu.recentCommentsButton))), h("main", { class: "main" }, h("gxg-container", { fieldset: true, noContentPadding: !!this.filtersHidden }, h("div", { class: "grid second-grid" }, h("div", { class: "actions-row grid" }, h("gxg-form-text", { class: this.filtersHidden ? "hidden" : null, "disable-filter": true, label: this._componentLocale.filtersMenu.patternLabel, labelPosition: "start", value: "", ref: (el) => (this.patternEl = el), "display-validation-styles": true, "display-validation-message": true, part: "pattern", onInput: this.loadData }), h("div", { class: "action-buttons", slot: "tab-bar" }, h("gxg-button", { onClick: this.toggleFiltersHandler, type: "secondary-icon-only", icon: "patterns/filters", part: "gxg-button gxg-button--show-filter" }), h("gxg-button", { type: "secondary-icon-only", icon: "gemini-tools/reset", onClick: this.loadData, part: "gxg-button gxg-button--reload" }))), h("div", { class: "filters-grid grid " +
|
|
211
|
+
return (h(Host, { class: "gx-ide-component" }, h("div", { class: "gx-ide-main-wrapper gx-ide-overflow" }, h("gxg-container", null, h("header", { class: "header grid" }, h("gxg-form-textarea", { id: "gxg-textarea", height: "100px", label: this._componentLocale.topMenu.commentLabel, value: this.comment, ref: (el) => (this.commitComment = el), placeholder: this._componentLocale.topMenu.commentPlaceholder }), h("gxg-button", { type: "outlined", part: "location", onClick: this.getRecentCommentHandler }, this._componentLocale.topMenu.recentCommentsButton))), h("main", { class: "main" }, h("gxg-container", { fieldset: true, noContentPadding: !!this.filtersHidden }, h("div", { class: "grid second-grid" }, h("div", { class: "actions-row grid" }, h("gxg-form-text", { class: this.filtersHidden ? "hidden" : null, "disable-filter": true, label: this._componentLocale.filtersMenu.patternLabel, labelPosition: "start", value: "", ref: (el) => (this.patternEl = el), "display-validation-styles": true, "display-validation-message": true, part: "pattern", onInput: this.loadData }), h("div", { class: "action-buttons", slot: "tab-bar" }, h("gxg-button", { onClick: this.toggleFiltersHandler, type: "secondary-icon-only", icon: "patterns/filters", part: "gxg-button gxg-button--show-filter" }), h("gxg-button", { type: "secondary-icon-only", icon: "gemini-tools/reset", onClick: this.loadData, part: "gxg-button gxg-button--reload" }))), h("div", { class: "filters-grid grid " +
|
|
212
212
|
(this.filtersHidden ? "hidden" : null) }, h("div", { class: "first-row grid" }, h("gxg-combo-box", { labelPosition: "start", "disable-filter": true, label: this._componentLocale.filtersMenu.changesetLabel, value: this.changeSet[0]["id"], ref: (el) => (this.changeSetEl = el), part: "change-set", "display-validation-styles": true, "display-validation-message": true, onValueChanged: this.loadData }, renderComboItems(this.changeSet)), h("gxg-combo-box", { labelPosition: "start", "disable-filter": true, label: this._componentLocale.filtersMenu.typeLabel, value: this.types[0]["id"], ref: (el) => (this.typesEl = el), part: "type", onValueChanged: this.loadData }, renderComboItems(this.types))), h("div", { class: "second-row grid" }, h("gxg-combo-box", { labelPosition: "start", "disable-filter": true, label: this._componentLocale.filtersMenu.folderLabel, value: this.folders[0]["id"], ref: (el) => (this.foldersEl = el), part: "folder", "display-validation-styles": true, "display-validation-message": true, onValueChanged: this.loadData }, renderComboItems(this.folders)), h("gxg-combo-box", { labelPosition: "start", "disable-filter": true, label: this._componentLocale.filtersMenu.categoryLabel, value: this.categories[0]["id"], ref: (el) => (this.categoriesEl = el), part: "categories", onValueChanged: this.loadData }, renderComboItems(this.categories)))))), h("gxg-container", null, h("gxg-tabs", { height: "100%", position: "top", class: "gxg-tabs" }, h("gxg-tab-bar", { slot: "tab-bar-container" }, h("gxg-tab-button", { slot: "tab-bar", "tab-label": `${this._componentLocale.tabs.pendingCommits} (${this.pendingCommits.length})`, tab: "pending-commits", "is-selected": true }), h("gxg-tab-button", { slot: "tab-bar", "tab-label": `${this._componentLocale.tabs.ignoredObjects} (${this.ignoredObjects.length})`, tab: "ignored-objects" })), h("gxg-tab", { tab: "pending-commits", "no-padding": true }, this.renderPendingCommitsGrid()), h("gxg-tab", { tab: "ignored-objects", "no-padding": true }, this.renderIgnoredObjectsGrid())), h("gxg-button", { slot: "footer", type: "primary-text-only", onClick: this.commitCallbackHandler, part: "commit-button" }, this._componentLocale.footer.commitButton))))));
|
|
213
213
|
}
|
|
214
214
|
static get assetsDirs() { return ["gx-ide-assets/team-dev-commit"]; }
|
|
@@ -222,6 +222,7 @@ const GxIdeTeamDevCommit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
222
222
|
"getRecentCommentCallback": [16],
|
|
223
223
|
"loadCallback": [16],
|
|
224
224
|
"commitCallback": [16],
|
|
225
|
+
"selectCallback": [16],
|
|
225
226
|
"pendingItemCheckedCallback": [16],
|
|
226
227
|
"gridContextMenuCallback": [16],
|
|
227
228
|
"filtersHidden": [32],
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
2
|
export { ChAccordion, defineCustomElement as defineCustomElementChAccordion } from './ch-accordion.js';
|
|
3
|
+
export { ChActionGroup, defineCustomElement as defineCustomElementChActionGroup } from './ch-action-group.js';
|
|
4
|
+
export { ChActionGroupItem, defineCustomElement as defineCustomElementChActionGroupItem } from './ch-action-group-item.js';
|
|
3
5
|
export { ChCheckbox, defineCustomElement as defineCustomElementChCheckbox } from './ch-checkbox.js';
|
|
4
6
|
export { ChDragBar, defineCustomElement as defineCustomElementChDragBar } from './ch-drag-bar.js';
|
|
5
7
|
export { ChDropdown, defineCustomElement as defineCustomElementChDropdown } from './ch-dropdown.js';
|
|
@@ -43,6 +45,8 @@ export { ChStyle, defineCustomElement as defineCustomElementChStyle } from './ch
|
|
|
43
45
|
export { ChSuggest, defineCustomElement as defineCustomElementChSuggest } from './ch-suggest.js';
|
|
44
46
|
export { ChSuggestList, defineCustomElement as defineCustomElementChSuggestList } from './ch-suggest-list.js';
|
|
45
47
|
export { ChSuggestListItem, defineCustomElement as defineCustomElementChSuggestListItem } from './ch-suggest-list-item.js';
|
|
48
|
+
export { ChTestActionGroup, defineCustomElement as defineCustomElementChTestActionGroup } from './ch-test-action-group.js';
|
|
49
|
+
export { ChTestDropdown, defineCustomElement as defineCustomElementChTestDropdown } from './ch-test-dropdown.js';
|
|
46
50
|
export { ChTestTreeX, defineCustomElement as defineCustomElementChTestTreeX } from './ch-test-tree-x.js';
|
|
47
51
|
export { ChTextblock, defineCustomElement as defineCustomElementChTextblock } from './ch-textblock.js';
|
|
48
52
|
export { ChTree, defineCustomElement as defineCustomElementChTree } from './ch-tree.js';
|
|
@@ -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 };
|