@genexus/genexus-ide-ui 0.0.30 → 0.0.32
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 +2 -9
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-dropdown-item.cjs.entry.js +8 -8
- package/dist/cjs/ch-dropdown.cjs.entry.js +11 -10
- package/dist/cjs/ch-suggest_4.cjs.entry.js +1 -0
- package/dist/cjs/ch-test-action-group.cjs.entry.js +2 -2
- package/dist/cjs/ch-test-tree-x.cjs.entry.js +150 -80
- package/dist/cjs/ch-tree-x_3.cjs.entry.js +211 -132
- package/dist/cjs/ch-window_2.cjs.entry.js +28 -12
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +3 -3
- package/dist/cjs/gx-ide-team-dev-update-partial-selection.cjs.entry.js +17 -32
- package/dist/cjs/gx-ide-team-dev-update-to-revision.cjs.entry.js +16 -1
- package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +33 -31
- package/dist/cjs/gxg-combo-box_6.cjs.entry.js +10 -4
- package/dist/cjs/gxg-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/team-dev-commit/team-dev-commit.js +12 -18
- package/dist/collection/components/team-dev-update/team-dev-update.js +75 -35
- 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 +4 -2
- package/dist/collection/components/team-dev-update-partial-selection/team-dev-update-partial-selection.css +1 -0
- package/dist/collection/components/team-dev-update-partial-selection/team-dev-update-partial-selection.js +22 -46
- 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 +1 -1
- package/dist/collection/components/team-dev-update-to-revision/team-dev-update-to-revision.js +33 -1
- package/dist/components/action-group-item.js +1 -9
- package/dist/components/action-group.js +1 -1
- package/dist/components/ch-suggest2.js +1 -0
- package/dist/components/ch-test-action-group.js +2 -2
- package/dist/components/ch-test-tree-x.js +157 -83
- package/dist/components/ch-window2.js +31 -13
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combo-box-item.js +2 -2
- package/dist/components/combo-box.js +8 -2
- package/dist/components/dropdown-item.js +8 -8
- package/dist/components/dropdown.js +11 -10
- package/dist/components/gx-ide-team-dev-commit.js +4 -4
- package/dist/components/gx-ide-team-dev-update-partial-selection.js +18 -33
- package/dist/components/gx-ide-team-dev-update-to-revision.js +17 -1
- package/dist/components/gx-ide-team-dev-update.js +36 -32
- package/dist/components/gxg-date-picker.js +4 -4
- package/dist/components/tree-x-list-item.js +31 -17
- package/dist/components/tree-x-list.js +9 -4
- package/dist/components/tree-x.js +182 -117
- package/dist/esm/ch-action-group_2.entry.js +2 -9
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-dropdown-item.entry.js +8 -8
- package/dist/esm/ch-dropdown.entry.js +11 -10
- package/dist/esm/ch-suggest_4.entry.js +1 -0
- package/dist/esm/ch-test-action-group.entry.js +2 -2
- package/dist/esm/ch-test-tree-x.entry.js +150 -80
- package/dist/esm/ch-tree-x_3.entry.js +211 -132
- package/dist/esm/ch-window_2.entry.js +28 -12
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-team-dev-commit.entry.js +3 -3
- package/dist/esm/gx-ide-team-dev-update-partial-selection.entry.js +17 -32
- package/dist/esm/gx-ide-team-dev-update-to-revision.entry.js +16 -1
- package/dist/esm/gx-ide-team-dev-update.entry.js +33 -31
- package/dist/esm/gxg-combo-box_6.entry.js +10 -4
- package/dist/esm/gxg-date-picker.entry.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.css +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-partial-selection/langs/team-dev-update-partial-selection.lang.en.json +4 -2
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-update-to-revision/langs/team-dev-update-to-revision.lang.en.json +1 -1
- package/dist/genexus-ide-ui/p-1b6b11e1.entry.js +1 -0
- package/dist/genexus-ide-ui/p-1fe05a05.entry.js +1 -0
- package/dist/genexus-ide-ui/p-24f47ee2.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-54bab171.entry.js → p-28d0afda.entry.js} +1 -1
- package/dist/genexus-ide-ui/{p-6050cdba.entry.js → p-48412811.entry.js} +1 -1
- package/dist/genexus-ide-ui/p-714bd8ea.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8592f072.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8c2ab053.entry.js +1 -0
- package/dist/genexus-ide-ui/p-976e8118.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a5463fc9.entry.js +1 -0
- package/dist/genexus-ide-ui/p-b2923298.entry.js +1 -0
- package/dist/genexus-ide-ui/p-bb1809cb.entry.js +1 -0
- package/dist/genexus-ide-ui/p-cf41f154.entry.js +1 -0
- package/dist/genexus-ide-ui/p-e8a21ed7.entry.js +1 -0
- package/dist/genexus-ide-ui/p-f794dc13.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +0 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/checkbox/checkbox.css +5 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +15 -33
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +0 -4
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-x.css +0 -10
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x/tree-x.css +20 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x-list-item/tree-x-list-item.css +25 -8
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +51 -2
- package/dist/node_modules/@genexus/gemini/dist/collection/components/combo-box-item/combo-box-item.css +1 -1
- package/dist/types/common/types.d.ts +9 -0
- package/dist/types/components/team-dev-commit/team-dev-commit.d.ts +8 -15
- package/dist/types/components/team-dev-update/team-dev-update.d.ts +16 -13
- package/dist/types/components/team-dev-update-partial-selection/team-dev-update-partial-selection.d.ts +11 -14
- package/dist/types/components/team-dev-update-to-revision/team-dev-update-to-revision.d.ts +8 -0
- package/dist/types/components.d.ts +39 -19
- package/package.json +3 -3
- package/dist/genexus-ide-ui/p-097a3eeb.entry.js +0 -1
- package/dist/genexus-ide-ui/p-32b8abf6.entry.js +0 -1
- package/dist/genexus-ide-ui/p-3d9a4ede.entry.js +0 -1
- package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +0 -1
- package/dist/genexus-ide-ui/p-53d36ef7.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5c64c57f.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +0 -1
- package/dist/genexus-ide-ui/p-6e80380b.entry.js +0 -1
- package/dist/genexus-ide-ui/p-757f8567.entry.js +0 -1
- package/dist/genexus-ide-ui/p-8d46f8d8.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a0e85c2a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-cda1623a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-f8561da6.entry.js +0 -1
|
@@ -4,9 +4,10 @@ import { d as defineCustomElement$4 } from './tree-x.js';
|
|
|
4
4
|
import { d as defineCustomElement$3 } from './tree-x-list.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './tree-x-list-item.js';
|
|
6
6
|
|
|
7
|
-
const testTreeXCss = "ch-test-tree-x{display:grid;grid-template-columns:350px max-content;grid-template-rows:1fr;height:100%}
|
|
7
|
+
const testTreeXCss = "ch-test-tree-x{display:grid;grid-template-columns:350px max-content;grid-template-rows:1fr;height:100%}.tree-buttons{display:grid;grid-auto-rows:max-content;row-gap:8px}:not(.ch-tree-x-dragging-item) ch-tree-x-list-item:not([selected])::part(header):hover{background-color:#e8e8e9}.ch-tree-x-list-item--drag-enter{background-color:#eee;box-shadow:inset 0 0 1px 0px black}.ch-tree-x-list-item--drag-enter[selected]::part(header){background-color:#eee}ch-tree-x-list-item::part(header){border:1px solid transparent}ch-tree-x-list-item[selected]::part(header){background-color:#cfdee6;border-color:#0266a0}ch-tree-x-list-item.ch-tree-x-list-item--editing::part(header){background-color:rgba(207, 222, 230, 0.5);border-color:transparent}ch-tree-x-list-item:not(.ch-tree-x-list-item--editing)::part(header):focus-visible{border-color:black;z-index:1}.ch-tree-x-drag-info{padding-inline:6px;padding-block:2px;background-color:#cfdee6;border:1px solid #0266a0;border-radius:10px;font-size:8px}";
|
|
8
8
|
|
|
9
9
|
const DEFAULT_EXPANDED_VALUE = false;
|
|
10
|
+
const DEFAULT_INDETERMINATE_VALUE = false;
|
|
10
11
|
const DEFAULT_LAZY_VALUE = false;
|
|
11
12
|
const DEFAULT_SELECTED_VALUE = false;
|
|
12
13
|
const ChTestTreeX$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -31,18 +32,20 @@ const ChTestTreeX$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
31
32
|
*/
|
|
32
33
|
this.multiSelection = false;
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
+
* `true` to display the relation between tree items and tree lists using
|
|
35
36
|
* lines.
|
|
36
37
|
*/
|
|
37
|
-
this.showLines =
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
this.showLines = "none";
|
|
39
|
+
this.handleDroppableZoneEnter = (event) => {
|
|
40
|
+
const dropInformation = event.detail;
|
|
41
|
+
if (!this.checkDroppableZoneCallback) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const requestTimestamp = new Date().getTime();
|
|
45
|
+
const promise = this.checkDroppableZoneCallback(dropInformation);
|
|
46
|
+
promise.then(validDrop => {
|
|
47
|
+
this.treeRef.updateValidDroppableZone(requestTimestamp, dropInformation.newContainer.id, dropInformation.draggedItems, validDrop);
|
|
48
|
+
});
|
|
46
49
|
};
|
|
47
50
|
this.handleSelectedItemsChange = (event) => {
|
|
48
51
|
const itemsToProcess = new Map(event.detail);
|
|
@@ -69,22 +72,87 @@ const ChTestTreeX$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
69
72
|
this.selectedItems.add(itemId);
|
|
70
73
|
});
|
|
71
74
|
};
|
|
72
|
-
this.
|
|
73
|
-
|
|
75
|
+
this.handleExpandedItemChange = (event) => {
|
|
76
|
+
const detail = event.detail;
|
|
77
|
+
const itemInfo = this.flattenedTreeModel.get(detail.id).item;
|
|
78
|
+
itemInfo.expanded = detail.expanded;
|
|
79
|
+
};
|
|
80
|
+
this.handleItemsDropped = (event) => {
|
|
81
|
+
const dataTransferInfo = event.detail;
|
|
82
|
+
const newContainer = dataTransferInfo.newContainer;
|
|
83
|
+
const newParentId = newContainer.id;
|
|
84
|
+
// Check if the parent exists in the UI Model
|
|
85
|
+
if (!this.flattenedTreeModel.get(newParentId)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const draggedItems = dataTransferInfo.draggedItems;
|
|
89
|
+
if (draggedItems.length === 0 || !this.dropItemsCallback) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const promise = this.dropItemsCallback(dataTransferInfo);
|
|
93
|
+
this.waitDropProcessing = true;
|
|
94
|
+
promise.then(response => {
|
|
95
|
+
this.waitDropProcessing = false;
|
|
96
|
+
if (!response.acceptDrop) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const newParentUIModel = this.flattenedTreeModel.get(newParentId).item;
|
|
100
|
+
// Only move the items to the new parent, keeping the state
|
|
101
|
+
if (dataTransferInfo.dropInTheSameTree) {
|
|
102
|
+
// Add the UI models to the new container and remove the UI models from
|
|
103
|
+
// the old containers
|
|
104
|
+
draggedItems.forEach(this.moveItemToNewParent(newParentUIModel));
|
|
105
|
+
}
|
|
106
|
+
// Add the new items
|
|
107
|
+
else {
|
|
108
|
+
if (response.items == null) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
// Add new items to the parent
|
|
112
|
+
newParentUIModel.items.push(...response.items);
|
|
113
|
+
// Flatten the new UI models
|
|
114
|
+
response.items.forEach(this.flattenItemUIModel(newParentUIModel));
|
|
115
|
+
}
|
|
116
|
+
this.sortItems(newParentUIModel.items);
|
|
117
|
+
// Open the item to visualize the new subitems
|
|
118
|
+
newParentUIModel.expanded = true;
|
|
119
|
+
// There is no need to force and update, since the waitDropProcessing
|
|
120
|
+
// prop was modified
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
this.moveItemToNewParent = (newParentUIModel) => (dataTransferInfo) => {
|
|
124
|
+
const itemUIModelExtended = this.flattenedTreeModel.get(dataTransferInfo.id);
|
|
125
|
+
const item = itemUIModelExtended.item;
|
|
126
|
+
const oldParentItem = itemUIModelExtended.parentItem;
|
|
127
|
+
// Remove the UI model from the previous parent
|
|
128
|
+
oldParentItem.items.splice(oldParentItem.items.indexOf(item), 1);
|
|
129
|
+
// Add the UI Model to the new parent
|
|
130
|
+
newParentUIModel.items.push(item);
|
|
131
|
+
// Reference the new parent in the item
|
|
132
|
+
itemUIModelExtended.parentItem = newParentUIModel;
|
|
74
133
|
};
|
|
75
|
-
|
|
76
|
-
// this.treeItemsModel = [];
|
|
77
|
-
// };
|
|
78
|
-
this.renderSubModel = (treeSubModel) => (h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: treeSubModel.checkbox, checked: treeSubModel.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, expanded: treeSubModel.expanded, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, toggleCheckboxes: treeSubModel.toggleCheckboxes }, !treeSubModel.leaf &&
|
|
134
|
+
this.renderSubModel = (treeSubModel) => (h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: treeSubModel.checkbox, checked: treeSubModel.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, expanded: treeSubModel.expanded, indeterminate: treeSubModel.indeterminate, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc, metadata: treeSubModel.metadata, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, toggleCheckboxes: treeSubModel.toggleCheckboxes }, !treeSubModel.leaf &&
|
|
79
135
|
treeSubModel.items != null &&
|
|
80
136
|
treeSubModel.items.length !== 0 && (h("ch-tree-x-list", { slot: "tree" }, treeSubModel.items.map(this.renderSubModel)))));
|
|
81
|
-
this.
|
|
82
|
-
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
137
|
+
this.flattenItemUIModel = (parentModel) => (item) => {
|
|
138
|
+
var _a, _b, _c, _d;
|
|
139
|
+
this.flattenedTreeModel.set(item.id, {
|
|
140
|
+
parentItem: parentModel,
|
|
141
|
+
item: item
|
|
142
|
+
});
|
|
143
|
+
// Make sure the properties are with their default values to avoid issues
|
|
144
|
+
// when reusing DOM nodes
|
|
145
|
+
(_a = item.expanded) !== null && _a !== void 0 ? _a : (item.expanded = DEFAULT_EXPANDED_VALUE);
|
|
146
|
+
(_b = item.indeterminate) !== null && _b !== void 0 ? _b : (item.indeterminate = DEFAULT_INDETERMINATE_VALUE);
|
|
147
|
+
(_c = item.lazy) !== null && _c !== void 0 ? _c : (item.lazy = DEFAULT_LAZY_VALUE);
|
|
148
|
+
(_d = item.selected) !== null && _d !== void 0 ? _d : (item.selected = DEFAULT_SELECTED_VALUE);
|
|
149
|
+
if (item.lazy) {
|
|
150
|
+
this.flattenedLazyTreeModel.set(item.id, item);
|
|
151
|
+
}
|
|
152
|
+
if (item.selected) {
|
|
153
|
+
this.selectedItems.add(item.id);
|
|
154
|
+
}
|
|
155
|
+
this.flattenSubModel(item);
|
|
88
156
|
};
|
|
89
157
|
}
|
|
90
158
|
handleTreeModelChange() {
|
|
@@ -113,45 +181,65 @@ const ChTestTreeX$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
113
181
|
// expand the items, we have to delegate the responsibility to the tree-x
|
|
114
182
|
this.treeRef.scrollIntoVisible(treeItemId);
|
|
115
183
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
184
|
+
/**
|
|
185
|
+
* This method is used to toggle a tree item by the tree item id/ids.
|
|
186
|
+
*
|
|
187
|
+
* @param treeItemIds An array id the tree items to be toggled.
|
|
188
|
+
* @param expand A boolean indicating that the tree item should be expanded or collapsed. (optional)
|
|
189
|
+
* @returns The modified items after the method was called.
|
|
190
|
+
*/
|
|
191
|
+
async toggleItems(treeItemIds, expand) {
|
|
192
|
+
if (!treeItemIds) {
|
|
193
|
+
return [];
|
|
123
194
|
}
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
195
|
+
const modifiedTreeItems = [];
|
|
196
|
+
treeItemIds.forEach(treeItemId => {
|
|
197
|
+
const itemInfo = this.flattenedTreeModel.get(treeItemId).item;
|
|
198
|
+
if (itemInfo) {
|
|
199
|
+
itemInfo.expanded = expand !== null && expand !== void 0 ? expand : !itemInfo.expanded;
|
|
200
|
+
modifiedTreeItems.push({
|
|
201
|
+
id: itemInfo.id,
|
|
202
|
+
expanded: itemInfo.expanded
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
// Force re-render
|
|
207
|
+
forceUpdate(this);
|
|
208
|
+
return modifiedTreeItems;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Given a subset of item's properties, it updates all item UI models.
|
|
212
|
+
*/
|
|
213
|
+
async updateAllItemsProperties(properties) {
|
|
214
|
+
[...this.flattenedTreeModel.values()].forEach(itemUIModel => {
|
|
215
|
+
if (properties.expanded != null) {
|
|
216
|
+
itemUIModel.item.expanded = properties.expanded;
|
|
217
|
+
}
|
|
218
|
+
if (properties.checked != null) {
|
|
219
|
+
itemUIModel.item.checked = properties.checked;
|
|
220
|
+
itemUIModel.item.indeterminate = false;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
forceUpdate(this);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Given a item list and the properties to update, it updates the properties
|
|
227
|
+
* of the items in the list.
|
|
228
|
+
*/
|
|
229
|
+
async updateItemsProperties(items, properties) {
|
|
230
|
+
items.forEach(item => {
|
|
231
|
+
const itemUIModel = this.flattenedTreeModel.get(item);
|
|
232
|
+
this.updateItemProperty(itemUIModel, properties);
|
|
233
|
+
});
|
|
234
|
+
forceUpdate(this);
|
|
235
|
+
}
|
|
236
|
+
updateItemProperty(itemUIModel, properties) {
|
|
237
|
+
if (!itemUIModel) {
|
|
127
238
|
return;
|
|
128
239
|
}
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.waitDropProcessing = false;
|
|
133
|
-
if (!acceptDrop) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const newParentItem = this.flattenedTreeModel.get(dropItemId).item;
|
|
137
|
-
// Add the UI models to the new container and remove the UI models from
|
|
138
|
-
// the old containers
|
|
139
|
-
draggedIds.forEach(itemId => {
|
|
140
|
-
const itemUIModelExtended = this.flattenedTreeModel.get(itemId);
|
|
141
|
-
const item = itemUIModelExtended.item;
|
|
142
|
-
const oldParentItem = itemUIModelExtended.parentItem;
|
|
143
|
-
// Remove the UI model from the previous parent
|
|
144
|
-
oldParentItem.items.splice(oldParentItem.items.indexOf(item), 1);
|
|
145
|
-
// Add the UI Model to the new parent
|
|
146
|
-
newParentItem.items.push(item);
|
|
147
|
-
// Reference the new parent in the item
|
|
148
|
-
itemUIModelExtended.parentItem = newParentItem;
|
|
149
|
-
});
|
|
150
|
-
this.sortItems(newParentItem.items);
|
|
151
|
-
// Open the item to visualize the new subitems
|
|
152
|
-
newParentItem.expanded = true;
|
|
153
|
-
// There is no need to force and update, since the waitDropProcessing
|
|
154
|
-
// prop was modified
|
|
240
|
+
const itemInfo = itemUIModel.item;
|
|
241
|
+
Object.keys(properties).forEach(propertyName => {
|
|
242
|
+
itemInfo[propertyName] = properties[propertyName];
|
|
155
243
|
});
|
|
156
244
|
}
|
|
157
245
|
loadLazyChildrenHandler(event) {
|
|
@@ -221,25 +309,7 @@ const ChTestTreeX$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
221
309
|
return;
|
|
222
310
|
}
|
|
223
311
|
this.sortItems(items);
|
|
224
|
-
items.forEach(
|
|
225
|
-
var _a, _b, _c;
|
|
226
|
-
this.flattenedTreeModel.set(item.id, {
|
|
227
|
-
parentItem: model,
|
|
228
|
-
item: item
|
|
229
|
-
});
|
|
230
|
-
// Make sure the properties are with their default values to avoid issues
|
|
231
|
-
// when reusing DOM nodes
|
|
232
|
-
(_a = item.expanded) !== null && _a !== void 0 ? _a : (item.expanded = DEFAULT_EXPANDED_VALUE);
|
|
233
|
-
(_b = item.lazy) !== null && _b !== void 0 ? _b : (item.lazy = DEFAULT_LAZY_VALUE);
|
|
234
|
-
(_c = item.selected) !== null && _c !== void 0 ? _c : (item.selected = DEFAULT_SELECTED_VALUE);
|
|
235
|
-
if (item.lazy) {
|
|
236
|
-
this.flattenedLazyTreeModel.set(item.id, item);
|
|
237
|
-
}
|
|
238
|
-
if (item.selected) {
|
|
239
|
-
this.selectedItems.add(item.id);
|
|
240
|
-
}
|
|
241
|
-
this.flattenSubModel(item);
|
|
242
|
-
});
|
|
312
|
+
items.forEach(this.flattenItemUIModel(model));
|
|
243
313
|
}
|
|
244
314
|
sortItems(items) {
|
|
245
315
|
// Ensure that items are sorted
|
|
@@ -256,23 +326,27 @@ const ChTestTreeX$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
256
326
|
this.flattenModel();
|
|
257
327
|
}
|
|
258
328
|
render() {
|
|
259
|
-
return (h(Host, null, h("
|
|
329
|
+
return (h(Host, null, h("ch-tree-x", { multiSelection: this.multiSelection, showLines: this.showLines, waitDropProcessing: this.waitDropProcessing, onDroppableZoneEnter: this.handleDroppableZoneEnter, onExpandedItemChange: this.handleExpandedItemChange, onItemsDropped: this.handleItemsDropped, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, h("ch-tree-x-list", null, this.treeModel.items.map(this.renderSubModel))), h("div", { class: "tree-buttons" })));
|
|
260
330
|
}
|
|
261
331
|
static get watchers() { return {
|
|
262
332
|
"treeModel": ["handleTreeModelChange"]
|
|
263
333
|
}; }
|
|
264
334
|
static get style() { return testTreeXCss; }
|
|
265
335
|
}, [0, "ch-test-tree-x", {
|
|
336
|
+
"checkDroppableZoneCallback": [16],
|
|
266
337
|
"dropItemsCallback": [16],
|
|
267
338
|
"treeModel": [1040],
|
|
268
339
|
"lazyLoadTreeItemsCallback": [16],
|
|
269
340
|
"modifyItemCaptionCallback": [16],
|
|
270
341
|
"multiSelection": [1028, "multi-selection"],
|
|
271
|
-
"showLines": [
|
|
342
|
+
"showLines": [1025, "show-lines"],
|
|
272
343
|
"sortItemsCallback": [16],
|
|
273
344
|
"waitDropProcessing": [32],
|
|
274
|
-
"scrollIntoVisible": [64]
|
|
275
|
-
|
|
345
|
+
"scrollIntoVisible": [64],
|
|
346
|
+
"toggleItems": [64],
|
|
347
|
+
"updateAllItemsProperties": [64],
|
|
348
|
+
"updateItemsProperties": [64]
|
|
349
|
+
}, [[0, "loadLazyContent", "loadLazyChildrenHandler"], [0, "modifyCaption", "handleCaptionModification"]]]);
|
|
276
350
|
function defineCustomElement$1() {
|
|
277
351
|
if (typeof customElements === "undefined") {
|
|
278
352
|
return;
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
|
2
2
|
import { C as CH_GLOBAL_STYLESHEET } from './ch-global-stylesheet.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './ch-window-close2.js';
|
|
4
4
|
|
|
5
|
-
const chWindowCss = ":host{--ch-window-offset-x:0px;--ch-window-offset-y:0px;--ch-window-x-outside:0px;--ch-window-y-outside:0px}:host(:not([hidden])){display:contents}:host(:is(:not([modal]),[modal=\"false\"])) .mask{pointer-events:none}.window{pointer-events:all}.mask{display:flex;position:fixed;inset:0;
|
|
5
|
+
const chWindowCss = ":host{--ch-window-offset-x:0px;--ch-window-offset-y:0px;--ch-window-separation-x:0px;--ch-window-separation-y:0px;--ch-window-x-outside:0px;--ch-window-y-outside:0px}:host(:not([hidden])){display:contents}:host(:is(:not([modal]),[modal=\"false\"])) .mask{pointer-events:none}.window{pointer-events:all}.mask{display:flex;position:fixed;inset:0;left:calc( var(--ch-window-inset-inline-start) + var(--ch-window-offset-x) + var(--ch-window-separation-x) );inset-block-start:calc( var(--ch-window-inset-block-start) + var(--ch-window-offset-y) + var(--ch-window-separation-y) );width:var(--ch-window-mask-width);height:var(--ch-window-mask-height);z-index:var(--ch-window-mask-z-index, 1000)}:host(:is([x-align=\"outside-start\"],[x-align=\"inside-start\"])) .mask{justify-content:flex-start}:host([x-align=center]) .mask{justify-content:center}:host(:is([x-align=\"outside-end\"],[x-align=\"inside-end\"])) .mask{justify-content:flex-end}:host(:is([y-align=\"outside-start\"],[y-align=\"inside-start\"])) .mask{align-items:flex-start}:host([y-align=center]) .mask{align-items:center}:host(:is([y-align=\"outside-end\"],[y-align=\"inside-end\"])) .mask{align-items:flex-end}.window{display:flex;flex-direction:column;transform:translate(var(--ch-window-x-outside), var(--ch-window-y-outside)) translate(var(--ch-window-x-drag, 0px), var(--ch-window-y-drag, 0px));z-index:inherit}:host([x-align=outside-start]) .window{--ch-window-x-outside:-100%}:host([x-align=outside-end]) .window{--ch-window-x-outside:100%}:host([y-align=outside-start]) .window{--ch-window-y-outside:-100%}:host([y-align=outside-end]) .window{--ch-window-y-outside:100%}.separation{position:fixed;inset:0;pointer-events:all}.separation--x{top:var(--ch-window-inset-block-start);width:var(--ch-window-separation);height:var(--ch-window-mask-height)}.separation--y{left:var(--ch-window-inset-inline-start);width:var(--ch-window-mask-width);height:var(--ch-window-separation)}.separation--both{width:calc(var(--ch-window-separation) * 4);height:calc(var(--ch-window-separation) * 4)}:host([x-align=outside-start]) .separation{left:calc( var(--ch-window-inset-inline-start) - var(--ch-window-separation) )}:host([x-align=outside-start]) .separation--both{left:calc( var(--ch-window-inset-inline-start) - var(--ch-window-separation) * 3 )}:host([x-align=outside-end]) .separation{left:calc( var(--ch-window-inset-inline-start) + var(--ch-window-mask-width) )}:host([x-align=outside-end]) .separation--both{left:calc( var(--ch-window-inset-inline-start) + var(--ch-window-mask-width) - var(--ch-window-separation) )}:host([y-align=outside-start]) .separation{top:calc(var(--ch-window-inset-block-start) - var(--ch-window-separation))}:host([y-align=outside-start]) .separation--both{top:calc( var(--ch-window-inset-block-start) - var(--ch-window-separation) * 3 )}:host([y-align=outside-end]) .separation{top:calc( var(--ch-window-inset-block-start) + var(--ch-window-mask-height) )}:host([y-align=outside-end]) .separation--both{top:calc( var(--ch-window-inset-block-start) + var(--ch-window-mask-height) - var(--ch-window-separation) )}";
|
|
6
6
|
|
|
7
7
|
const CONTAINING_BLOCK_RESET_CUSTOM_VAR = "--ch-window-relative-position";
|
|
8
8
|
const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -44,6 +44,16 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
44
44
|
* This attribute lets you specify if a header is rendered on top of the window.
|
|
45
45
|
*/
|
|
46
46
|
this.showHeader = true;
|
|
47
|
+
/**
|
|
48
|
+
* This attribute lets you specify if a div wrapper is rendered for the
|
|
49
|
+
* default slot.
|
|
50
|
+
*/
|
|
51
|
+
this.showMain = true;
|
|
52
|
+
/**
|
|
53
|
+
* This attribute lets you specify if a div between the container and the window
|
|
54
|
+
* space.
|
|
55
|
+
*/
|
|
56
|
+
this.showSeparation = false;
|
|
47
57
|
this.mousemoveHandler = (eventInfo) => {
|
|
48
58
|
const translateX = this.draggedX + eventInfo.clientX - this.dragStartX;
|
|
49
59
|
const translateY = this.draggedY + eventInfo.clientY - this.dragStartY;
|
|
@@ -61,25 +71,24 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
61
71
|
this.updatePosition = () => {
|
|
62
72
|
if (!this.isContainerCssOverride && this.container && this.mask) {
|
|
63
73
|
const rect = this.container.getBoundingClientRect();
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
74
|
+
this.el.style.setProperty("--ch-window-mask-width", `${rect.width}px`);
|
|
75
|
+
this.el.style.setProperty("--ch-window-mask-height", `${rect.height}px`);
|
|
66
76
|
// Nested windows are positioned relative to its initial containing block,
|
|
67
77
|
// so there is no need to align them relative to the document
|
|
68
78
|
if (this.relativeWindow) {
|
|
69
79
|
return;
|
|
70
80
|
}
|
|
71
|
-
|
|
72
|
-
this.
|
|
73
|
-
this.mask.style.setProperty("--ch-window-inset-block-start", `${rect.top}px`);
|
|
81
|
+
this.el.style.setProperty("--ch-window-inset-inline-start", `${rect.left}px`);
|
|
82
|
+
this.el.style.setProperty("--ch-window-inset-block-start", `${rect.top}px`);
|
|
74
83
|
}
|
|
75
84
|
else if (this.isContainerCssOverride || !this.container) {
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
85
|
+
this.el.style.removeProperty("--ch-window-mask-width");
|
|
86
|
+
this.el.style.removeProperty("--ch-window-mask-height");
|
|
78
87
|
if (this.relativeWindow) {
|
|
79
88
|
return;
|
|
80
89
|
}
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
90
|
+
this.el.style.removeProperty("--ch-window-inset-inline-start");
|
|
91
|
+
this.el.style.removeProperty("--ch-window-inset-block-start");
|
|
83
92
|
}
|
|
84
93
|
};
|
|
85
94
|
this.windowResizeHandler = () => {
|
|
@@ -219,10 +228,17 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
219
228
|
this.el.shadowRoot.adoptedStyleSheets.push(CH_GLOBAL_STYLESHEET);
|
|
220
229
|
}
|
|
221
230
|
render() {
|
|
222
|
-
|
|
231
|
+
const separationY = this.yAlign === "outside-start" || this.yAlign === "outside-end";
|
|
232
|
+
const separationX = this.xAlign === "outside-start" || this.xAlign === "outside-end";
|
|
233
|
+
return (h(Host, { style: this.relativeWindow && {
|
|
223
234
|
"--ch-window-inset-inline-start": "0px",
|
|
224
235
|
"--ch-window-inset-block-start": "0px"
|
|
225
|
-
}, ref: el => (this.mask = el), onClick: this.maskClickHandler }, h("section", { class: "window", part: "window", ref: el => (this.window = el) }, this.showHeader && (h("header", { part: "header", ref: el => (this.header = el) }, h("slot", { name: "header" }, h("span", { part: "caption" }, this.caption), h("ch-window-close", { part: "close", title: this.closeTooltip }, this.closeText)))), h("div", { part: "main" }, h("slot", null)), this.showFooter && (h("footer", { part: "footer" }, h("slot", { name: "footer" }))))
|
|
236
|
+
} }, h("div", { class: "mask", part: "mask", ref: el => (this.mask = el), onClick: this.maskClickHandler }, h("section", { class: "window", part: "window", ref: el => (this.window = el) }, this.showHeader && (h("header", { part: "header", ref: el => (this.header = el) }, h("slot", { name: "header" }, h("span", { part: "caption" }, this.caption), h("ch-window-close", { part: "close", title: this.closeTooltip }, this.closeText)))), this.showMain ? (h("div", { part: "main" }, h("slot", null))) : (h("slot", null)), this.showFooter && (h("footer", { part: "footer" }, h("slot", { name: "footer" })))), this.showSeparation && (h("div", { class: {
|
|
237
|
+
separation: true,
|
|
238
|
+
"separation--x": separationX && !separationY,
|
|
239
|
+
"separation--y": separationY && !separationX,
|
|
240
|
+
"separation--both": separationX && separationY
|
|
241
|
+
}, part: "separation" })))));
|
|
226
242
|
}
|
|
227
243
|
get el() { return this; }
|
|
228
244
|
static get watchers() { return {
|
|
@@ -243,7 +259,9 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
243
259
|
"closeOnEscape": [4, "close-on-escape"],
|
|
244
260
|
"allowDrag": [1, "allow-drag"],
|
|
245
261
|
"showFooter": [4, "show-footer"],
|
|
246
|
-
"showHeader": [4, "show-header"]
|
|
262
|
+
"showHeader": [4, "show-header"],
|
|
263
|
+
"showMain": [4, "show-main"],
|
|
264
|
+
"showSeparation": [4, "show-separation"]
|
|
247
265
|
}, [[1, "mousedown", "mousedownHandler"], [0, "windowCloseClicked", "windowCloseClickedHandler"]]]);
|
|
248
266
|
function defineCustomElement() {
|
|
249
267
|
if (typeof customElements === "undefined") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { D as DISABLED_CLASS } from './reserverd-names.js';
|
|
3
3
|
|
|
4
|
-
const checkboxCss = "*,::before,::after{box-sizing:border-box}:host{display:flex;align-items:center;align-self:stretch;outline:unset;touch-action:manipulation;user-select:none}:host(.ch-checkbox--actionable) :is(.input,.label){cursor:pointer}.container{position:relative;width:min(1em, 20px);height:min(1em, 20px);border:1px solid var(--option-border-color, #000);border-radius:18.75%}.container--checked{background-color:var(--option-checked-color, #ffffff00)}.container:focus-within{box-shadow:0 0 1px 1px #00000040}.input{display:flex;width:100%;height:100%;opacity:0;margin:0;padding:0}.option{position:absolute;
|
|
4
|
+
const checkboxCss = "*,::before,::after{box-sizing:border-box}:host{display:flex;align-items:center;align-self:stretch;outline:unset;touch-action:manipulation;user-select:none}:host(.ch-checkbox--actionable) :is(.input,.label){cursor:pointer}.container{position:relative;width:min(1em, 20px);height:min(1em, 20px);border:1px solid var(--option-border-color, #000);border-radius:18.75%}.container--checked{background-color:var(--option-checked-color, #ffffff00)}.container:focus-within{box-shadow:0 0 1px 1px #00000040}.input{display:flex;width:100%;height:100%;opacity:0;margin:0;padding:0}.option{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);width:50%;height:50%;background-color:#000;opacity:0;pointer-events:none}.option--checked{opacity:1;-webkit-mask:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' %3E%3Cpath fill='currentColor' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z' /%3E%3C/svg%3E\")}.option--indeterminate{opacity:1}.label{margin-inline-start:min(0.35em, 7px)}";
|
|
5
5
|
|
|
6
6
|
const CHECKBOX_ID = "checkbox";
|
|
7
7
|
const PARTS = (checked, indeterminate) => `${checked ? " checked" : ""}${indeterminate ? " indeterminate" : ""}`;
|
|
@@ -4,7 +4,7 @@ import { c as commonClassesNames } from './classesNames.js';
|
|
|
4
4
|
import { d as defineCustomElement$2 } from './icon.js';
|
|
5
5
|
import { d as defineCustomElement$1 } from './icon2.js';
|
|
6
6
|
|
|
7
|
-
const comboBoxItemCss = ":host(.gxg--disabled) .form-element,:host(.gxg--disabled.form-element){pointer-events:none;background-color:var(--color-background-disabled) !important;color:var(--color-on-background--disabled) !important;border-color:var(--gxg-border-color--disabled) !important;cursor:default !important}:host{display:block;cursor:pointer;box-sizing:border-box;display:flex;align-items:center;font-family:var(--font-family-primary);font-size:var(--font-size-sm);background-color:var(--color-background);color:var(--color-on-background);opacity:1;overflow:hidden}:host .container{display:flex;align-items:center;padding:var(--spacing-comp-00) var(--spacing-comp-01);width:100%;height:var(--gxg-list-item-height);box-sizing:border-box;}:host gxg-icon{flex-shrink:0}.description{white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}:host(.no-icon) .container{padding-left:var(--spacing-comp-02)}:host([hidden]){display:none}:host(.display-none){display:none}:host(:hover){background-color:var(--gxg-background-color-item-hover)}:host([selected]){background-color:var(--gxg-background-color-item-selected);color:var(--gxg-color-
|
|
7
|
+
const comboBoxItemCss = ":host(.gxg--disabled) .form-element,:host(.gxg--disabled.form-element){pointer-events:none;background-color:var(--color-background-disabled) !important;color:var(--color-on-background--disabled) !important;border-color:var(--gxg-border-color--disabled) !important;cursor:default !important}:host{display:block;cursor:pointer;box-sizing:border-box;display:flex;align-items:center;font-family:var(--font-family-primary);font-size:var(--font-size-sm);background-color:var(--color-background);color:var(--color-on-background);opacity:1;overflow:hidden}:host .container{display:flex;align-items:center;padding:var(--spacing-comp-00) var(--spacing-comp-01);width:100%;height:var(--gxg-list-item-height);box-sizing:border-box;}:host gxg-icon{flex-shrink:0}.description{white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}:host(.no-icon) .container{padding-left:var(--spacing-comp-02)}:host([hidden]){display:none}:host(.display-none){display:none}:host(:hover){background-color:var(--gxg-background-color-item-hover)}:host([selected]){background-color:var(--gxg-background-color-item-selected);color:var(--gxg-color-selected)}:host(.large){font-size:var(--font-size-lg);min-height:auto}:host(.large) gxg-icon{margin-right:var(--spacing-comp-01)}";
|
|
8
8
|
|
|
9
9
|
const GxgComboBoxItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
@@ -68,7 +68,7 @@ const GxgComboBoxItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
68
68
|
return "disabled";
|
|
69
69
|
}
|
|
70
70
|
else if (this.selected) {
|
|
71
|
-
return "
|
|
71
|
+
return "auto";
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
74
|
return "auto";
|
|
@@ -44,6 +44,7 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
44
44
|
clearButton: "clear-button",
|
|
45
45
|
toggleButton: "toggle-button",
|
|
46
46
|
};
|
|
47
|
+
this.setInitialValueTimes = 0;
|
|
47
48
|
/**
|
|
48
49
|
* The presence of this attribute makes the input disabled
|
|
49
50
|
*/
|
|
@@ -165,11 +166,13 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
165
166
|
}
|
|
166
167
|
else if (e.code === KeyboardKeys.ENTER) {
|
|
167
168
|
this.hideList();
|
|
169
|
+
this.showAllItems();
|
|
168
170
|
}
|
|
169
171
|
else if (e.code === KeyboardKeys.SPACE) {
|
|
170
172
|
this.showList();
|
|
171
173
|
}
|
|
172
174
|
else if (e.code === KeyboardKeys.ESCAPE) {
|
|
175
|
+
this.showAllItems();
|
|
173
176
|
this.hideList();
|
|
174
177
|
}
|
|
175
178
|
else if (e.code === KeyboardKeys.TAB && this.showList) {
|
|
@@ -318,6 +321,7 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
318
321
|
return value;
|
|
319
322
|
};
|
|
320
323
|
this.setInitialValue = () => {
|
|
324
|
+
this.setInitialValueTimes++;
|
|
321
325
|
const firstItem = this.getEnabledItems()[0];
|
|
322
326
|
if (!this.value || this.removedItem !== undefined) {
|
|
323
327
|
if (firstItem) {
|
|
@@ -464,7 +468,9 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
464
468
|
WATCH
|
|
465
469
|
*********************************/
|
|
466
470
|
onValueChanged(newValue) {
|
|
467
|
-
this.
|
|
471
|
+
if (this.setInitialValueTimes > 1) {
|
|
472
|
+
this.valueChanged.emit(newValue);
|
|
473
|
+
}
|
|
468
474
|
this.clearSelectedItem();
|
|
469
475
|
let value;
|
|
470
476
|
let newItem = undefined;
|
|
@@ -472,7 +478,7 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
472
478
|
value = this.getValueByText(newValue);
|
|
473
479
|
}
|
|
474
480
|
else {
|
|
475
|
-
this.showAllItems();
|
|
481
|
+
!this.listIsOpen && this.showAllItems();
|
|
476
482
|
value = newValue;
|
|
477
483
|
}
|
|
478
484
|
newItem = this.getItemByValue(value);
|
|
@@ -3,7 +3,7 @@ import { d as defineCustomElement$3 } from './dropdown.js';
|
|
|
3
3
|
import { d as defineCustomElement$2 } from './ch-window2.js';
|
|
4
4
|
import { d as defineCustomElement$1 } from './ch-window-close2.js';
|
|
5
5
|
|
|
6
|
-
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%}
|
|
6
|
+
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%}";
|
|
7
7
|
|
|
8
8
|
const DROPDOWN_ITEM = "ch-dropdown-item";
|
|
9
9
|
const ChDropDownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -36,17 +36,17 @@ const ChDropDownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
36
36
|
*/
|
|
37
37
|
this.position = "Center_OutsideEnd";
|
|
38
38
|
this.dropDownItemContent = () => [
|
|
39
|
-
!!this.leftImgSrc && (h("img", { "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
|
|
40
|
-
h("span", { class: "content", part: "content" }, h("slot", null)),
|
|
41
|
-
!!this.rightImgSrc && (h("img", { "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
|
|
39
|
+
!!this.leftImgSrc && (h("img", { slot: "action", "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
|
|
40
|
+
h("span", { slot: "action", class: "content", part: "content" }, h("slot", null)),
|
|
41
|
+
!!this.rightImgSrc && (h("img", { slot: "action", "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
|
|
42
42
|
];
|
|
43
43
|
this.checkItems = () => {
|
|
44
|
-
this.hasItems = !!this.
|
|
44
|
+
this.hasItems = !!this.el.querySelector(`:scope>${DROPDOWN_ITEM}`);
|
|
45
45
|
};
|
|
46
46
|
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 })));
|
|
47
|
-
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 },
|
|
47
|
+
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 }, this.dropDownItemContent(), h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
|
|
48
48
|
this.handleActionClick = () => {
|
|
49
|
-
this.actionClick.emit(this.
|
|
49
|
+
this.actionClick.emit(this.el.id);
|
|
50
50
|
};
|
|
51
51
|
this.handleFocus = () => {
|
|
52
52
|
this.focusChange.emit();
|
|
@@ -64,7 +64,7 @@ const ChDropDownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
64
64
|
render() {
|
|
65
65
|
return (h(Host, { role: "listitem" }, this.hasItems ? this.itemsRender() : this.noItemsRender()));
|
|
66
66
|
}
|
|
67
|
-
get
|
|
67
|
+
get el() { return this; }
|
|
68
68
|
static get style() { return dropdownItemCss; }
|
|
69
69
|
}, [1, "ch-dropdown-item", {
|
|
70
70
|
"expandBehavior": [1, "expand-behavior"],
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
|
2
2
|
import { d as defineCustomElement$2 } from './ch-window2.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './ch-window-close2.js';
|
|
4
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}
|
|
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}ch-window[y-align=outside-start]{--ch-window-separation:var(--separation-y);--ch-window-separation-y:calc(var(--separation-y) * -1)}ch-window[y-align=outside-end]{--ch-window-separation:var(--separation-y);--ch-window-separation-y:var(--separation-y)}ch-window[x-align=outside-start]{--ch-window-separation:var(--separation-x);--ch-window-separation-x:calc(var(--separation-x) * -1)}ch-window[x-align=outside-end]{--ch-window-separation:var(--separation-x);--ch-window-separation-x:var(--separation-x)}.list{display:flex;flex-direction:column}";
|
|
6
6
|
|
|
7
7
|
const mapDropdownAlignToChWindowAlign = {
|
|
8
8
|
OutsideStart: "outside-start",
|
|
@@ -55,6 +55,7 @@ const ChDropDown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
55
55
|
};
|
|
56
56
|
this.showHeader = false;
|
|
57
57
|
this.showFooter = false;
|
|
58
|
+
this.firstExpanded = false;
|
|
58
59
|
this.expanded = false;
|
|
59
60
|
this.expandedWithHover = false;
|
|
60
61
|
/**
|
|
@@ -236,22 +237,22 @@ const ChDropDown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
236
237
|
const aligns = this.position.split("_");
|
|
237
238
|
const alignX = aligns[0];
|
|
238
239
|
const alignY = aligns[1];
|
|
239
|
-
const hasVerticalPosition = alignY === "OutsideStart" || alignY === "OutsideEnd";
|
|
240
240
|
const xAlignMapping = mapDropdownAlignToChWindowAlign[alignX];
|
|
241
241
|
const yAlignMapping = mapDropdownAlignToChWindowAlign[alignY];
|
|
242
242
|
const isExpanded = this.expanded || this.expandedWithHover;
|
|
243
|
+
this.firstExpanded || (this.firstExpanded = isExpanded);
|
|
243
244
|
return (h(Host, { onMouseLeave: this.expandBehavior === "ClickOrHover"
|
|
244
245
|
? this.handleMouseLeave
|
|
245
246
|
: 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
247
|
? this.handleMouseEnter
|
|
247
|
-
: undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })),
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
248
|
+
: undefined, ref: el => (this.expandableButton = el) }, h("slot", { name: "action" })), h("ch-window", { part: "window", exportparts: "window:section,mask,header,footer,separation", container: this.expandableButton, closeOnEscape: true, hidden: !isExpanded, modal: false, showFooter: this.showFooter, showHeader: this.showHeader, showMain: false,
|
|
249
|
+
// Necessary since the separation between the button and the section
|
|
250
|
+
// triggers the onMouseLeave event
|
|
251
|
+
showSeparation: this.expandBehavior === "ClickOrHover", xAlign: xAlignMapping, yAlign: yAlignMapping }, this.firstExpanded && [
|
|
252
|
+
this.showHeader && h("slot", { name: "header", slot: "header" }),
|
|
253
|
+
h("div", { role: "list", class: "list", part: "list" }, h("slot", { name: "items" })),
|
|
254
|
+
this.showFooter && h("slot", { name: "footer", slot: "footer" })
|
|
255
|
+
])));
|
|
255
256
|
}
|
|
256
257
|
get el() { return this; }
|
|
257
258
|
static get watchers() { return {
|