@genexus/genexus-ide-ui 0.0.85 → 0.0.86
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-render.cjs.entry.js +112 -0
- package/dist/cjs/ch-checkbox_3.cjs.entry.js +21 -10
- package/dist/cjs/ch-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/ch-dropdown-render.cjs.entry.js +73 -0
- package/dist/cjs/ch-shortcuts_2.cjs.entry.js +99 -20
- package/dist/cjs/ch-tree-view-render_2.cjs.entry.js +49 -92
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/genexus-implementation-664b13f0.js +76 -0
- package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +2 -5
- package/dist/cjs/gx-ide-new-environment.cjs.entry.js +16 -9
- package/dist/cjs/gx-ide-new-kb.cjs.entry.js +14 -3
- package/dist/cjs/gx-ide-new-object.cjs.entry.js +21 -3
- package/dist/cjs/gx-ide-object-selector.cjs.entry.js +87 -59
- package/dist/cjs/gx-ide-recent-news.cjs.entry.js +2 -3
- package/dist/cjs/gx-ide-references.cjs.entry.js +2 -7
- package/dist/cjs/gxg-combo-box_2.cjs.entry.js +1 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/kb-manager-import/kb-manager-import.js +2 -5
- package/dist/collection/components/new-environment/new-environment.js +39 -9
- package/dist/collection/components/new-kb/gx-ide-assets/new-kb/shortcuts.json +1 -4
- package/dist/collection/components/new-kb/new-kb.js +37 -3
- package/dist/collection/components/new-object/gx-ide-assets/new-object/shortcuts.json +1 -4
- package/dist/collection/components/new-object/new-object.js +44 -3
- package/dist/collection/components/object-selector/gx-ide-assets/object-selector/langs/object-selector.lang.en.json +4 -0
- package/dist/collection/components/object-selector/object-selector.css +4 -0
- package/dist/collection/components/object-selector/object-selector.js +123 -58
- package/dist/collection/components/references/references.js +3 -10
- package/dist/collection/components/start-page/recent-news.js +2 -3
- package/dist/components/ch-action-group-render.js +175 -0
- package/dist/components/ch-dropdown-item-separator.js +28 -1
- package/dist/components/ch-dropdown-render.js +121 -0
- package/dist/components/ch-shortcuts2.js +97 -19
- package/dist/components/combo-box.js +1 -8
- package/dist/components/dropdown-item.js +1 -1
- package/dist/components/genexus-implementation.js +74 -0
- package/dist/components/gx-ide-kb-manager-import.js +2 -5
- package/dist/components/gx-ide-new-environment.js +18 -10
- package/dist/components/gx-ide-new-kb.js +16 -4
- package/dist/components/gx-ide-new-object.js +24 -5
- package/dist/components/gx-ide-object-selector.js +140 -104
- package/dist/components/gx-ide-references.js +3 -10
- package/dist/components/index.js +2 -2
- package/dist/components/recent-news.js +2 -3
- package/dist/components/shortcuts.js +4 -1
- package/dist/components/tree-view-item.js +21 -10
- package/dist/components/tree-view-render.js +49 -91
- package/dist/esm/ch-action-group-render.entry.js +108 -0
- package/dist/esm/ch-checkbox_3.entry.js +21 -10
- package/dist/esm/ch-dropdown-item.entry.js +1 -1
- package/dist/esm/ch-dropdown-render.entry.js +69 -0
- package/dist/esm/ch-shortcuts_2.entry.js +99 -20
- package/dist/esm/ch-tree-view-render_2.entry.js +48 -91
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/genexus-implementation-3b347d88.js +74 -0
- package/dist/esm/gx-ide-kb-manager-import.entry.js +2 -5
- package/dist/esm/gx-ide-new-environment.entry.js +16 -9
- package/dist/esm/gx-ide-new-kb.entry.js +14 -3
- package/dist/esm/gx-ide-new-object.entry.js +21 -3
- package/dist/esm/gx-ide-object-selector.entry.js +87 -59
- package/dist/esm/gx-ide-recent-news.entry.js +2 -3
- package/dist/esm/gx-ide-references.entry.js +2 -7
- package/dist/esm/gxg-combo-box_2.entry.js +1 -7
- 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/new-kb/shortcuts.json +1 -4
- package/dist/genexus-ide-ui/gx-ide-assets/new-object/shortcuts.json +1 -4
- package/dist/genexus-ide-ui/gx-ide-assets/object-selector/langs/object-selector.lang.en.json +4 -0
- package/dist/genexus-ide-ui/p-021e21a0.entry.js +1 -0
- package/dist/genexus-ide-ui/p-068b6b8d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-06d9d6ff.entry.js +1 -0
- package/dist/genexus-ide-ui/p-356ee19a.js +1 -0
- package/dist/genexus-ide-ui/p-49333316.entry.js +1 -0
- package/dist/genexus-ide-ui/p-4bd7c59a.entry.js +1 -0
- package/dist/genexus-ide-ui/p-54b5628c.entry.js +1 -0
- package/dist/genexus-ide-ui/p-65b5622e.entry.js +1 -0
- package/dist/genexus-ide-ui/p-70b33bae.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8a18798d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8f022c0e.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-20fab805.entry.js → p-90806539.entry.js} +1 -1
- package/dist/genexus-ide-ui/p-cadcd655.entry.js +1 -0
- package/dist/genexus-ide-ui/p-cfbd5a0e.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-005970ac.entry.js → p-eaae6676.entry.js} +1 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/renders/action-group/action-group-render.css +3 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/renders/dropdown/dropdown-render.css +3 -0
- package/dist/types/components/new-environment/new-environment.d.ts +5 -1
- package/dist/types/components/new-kb/new-kb.d.ts +5 -0
- package/dist/types/components/new-object/new-object.d.ts +6 -0
- package/dist/types/components/object-selector/object-selector.d.ts +14 -3
- package/dist/types/components/references/references.d.ts +0 -9
- package/dist/types/components/start-page/recent-news.d.ts +1 -1
- package/dist/types/components.d.ts +24 -0
- package/package.json +3 -3
- package/dist/cjs/ch-test-action-group.cjs.entry.js +0 -79
- package/dist/cjs/ch-test-dropdown.cjs.entry.js +0 -54
- package/dist/components/ch-test-action-group.js +0 -137
- package/dist/components/ch-test-dropdown.js +0 -104
- package/dist/components/dropdown-item-separator.js +0 -30
- package/dist/esm/ch-test-action-group.entry.js +0 -75
- package/dist/esm/ch-test-dropdown.entry.js +0 -50
- package/dist/genexus-ide-ui/p-2d77e2a3.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5757e203.entry.js +0 -1
- package/dist/genexus-ide-ui/p-7a03aa05.entry.js +0 -1
- package/dist/genexus-ide-ui/p-7ae11b35.entry.js +0 -1
- package/dist/genexus-ide-ui/p-85b78e25.entry.js +0 -1
- package/dist/genexus-ide-ui/p-9f08b2a4.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a2c7dc8a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a69aaabc.entry.js +0 -1
- package/dist/genexus-ide-ui/p-c00aa636.entry.js +0 -1
- package/dist/genexus-ide-ui/p-d3428456.entry.js +0 -1
- package/dist/genexus-ide-ui/p-d9910218.entry.js +0 -1
- package/dist/genexus-ide-ui/p-da8ad725.entry.js +0 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-action-group/test-action-group.css +0 -52
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-dropdown/test-dropdown.css +0 -36
|
@@ -7,7 +7,8 @@ function loadShortcuts(name, root, shortcuts) {
|
|
|
7
7
|
shortcuts.forEach(shortcut => {
|
|
8
8
|
const keyShortcuts = parseKeyShortcuts(shortcut.keyShortcuts);
|
|
9
9
|
keyShortcuts.forEach(keyShortcut => {
|
|
10
|
-
|
|
10
|
+
const normalizedKeyShortcut = normalize(keyShortcut.ctrl, keyShortcut.alt, keyShortcut.shift, keyShortcut.meta, keyShortcut.key);
|
|
11
|
+
SHORTCUTS.set(normalizedKeyShortcut, {
|
|
11
12
|
name,
|
|
12
13
|
root,
|
|
13
14
|
shortcut
|
|
@@ -26,11 +27,12 @@ function unloadShortcuts(name) {
|
|
|
26
27
|
removeKeyShortcuts.forEach(key => SHORTCUTS.delete(key));
|
|
27
28
|
removeListener();
|
|
28
29
|
}
|
|
29
|
-
function getShortcuts() {
|
|
30
|
+
function getShortcuts(name) {
|
|
30
31
|
return Array.from(SHORTCUTS.values())
|
|
31
32
|
.filter(shortcutMap => {
|
|
32
33
|
var _a;
|
|
33
|
-
return
|
|
34
|
+
return (shortcutMap.name === name &&
|
|
35
|
+
!((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude));
|
|
34
36
|
})
|
|
35
37
|
.map(shortcutMap => ({
|
|
36
38
|
element: querySelectorPlus(shortcutMap.shortcut.selector, shortcutMap.root),
|
|
@@ -56,27 +58,33 @@ function keydownHandler(eventInfo) {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
function triggerShortcut(eventInfo) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
+
const shortcut = normalize(eventInfo.ctrlKey, eventInfo.altKey, eventInfo.shiftKey, eventInfo.metaKey, eventInfo.key);
|
|
62
|
+
const shortcutMap = SHORTCUTS.get(shortcut);
|
|
63
|
+
const focus = focusComposedPath();
|
|
64
|
+
if (shortcutMap && conditions(shortcutMap, focus)) {
|
|
61
65
|
const element = querySelectorPlus(shortcutMap.shortcut.selector, shortcutMap.root);
|
|
62
|
-
|
|
66
|
+
const keyShortcutPressedEvent = createEvent(shortcut, shortcutMap.shortcut.id, element, focus);
|
|
67
|
+
if (shortcutMap.root.dispatchEvent(keyShortcutPressedEvent)) {
|
|
63
68
|
switch (shortcutMap.shortcut.action) {
|
|
64
69
|
case "click":
|
|
65
|
-
element.dispatchEvent(new Event("click"));
|
|
70
|
+
element === null || element === void 0 ? void 0 : element.dispatchEvent(new Event("click"));
|
|
66
71
|
break;
|
|
67
72
|
default:
|
|
68
|
-
element.focus();
|
|
73
|
+
element === null || element === void 0 ? void 0 : element.focus();
|
|
69
74
|
}
|
|
70
75
|
if (shortcutMap.shortcut.preventDefault !== false) {
|
|
71
76
|
eventInfo.preventDefault();
|
|
72
77
|
}
|
|
73
78
|
}
|
|
79
|
+
else {
|
|
80
|
+
eventInfo.preventDefault();
|
|
81
|
+
}
|
|
74
82
|
}
|
|
75
83
|
return shortcutMap;
|
|
76
84
|
}
|
|
77
85
|
function parseKeyShortcuts(value = "") {
|
|
78
|
-
return value.split(
|
|
79
|
-
return item.split(
|
|
86
|
+
return value.split(/(?<!(?:[+]|^))\s/).map(item => {
|
|
87
|
+
return item.split(/(?<!(?:[+]|^))[+]/).reduce((keyShortcut, key) => {
|
|
80
88
|
switch (key.toLowerCase()) {
|
|
81
89
|
case "ctrl":
|
|
82
90
|
keyShortcut.ctrl = true;
|
|
@@ -116,17 +124,40 @@ function normalize(ctrl, alt, shift, meta, key) {
|
|
|
116
124
|
})
|
|
117
125
|
.join("+");
|
|
118
126
|
}
|
|
119
|
-
function conditions(shortcutMap) {
|
|
120
|
-
var _a, _b
|
|
121
|
-
const focus = focusComposedPath();
|
|
127
|
+
function conditions(shortcutMap, focus) {
|
|
128
|
+
var _a, _b;
|
|
122
129
|
if ((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude) {
|
|
123
|
-
return
|
|
130
|
+
return querySelectorAllPlus(shortcutMap.shortcut.conditions.focusInclude, shortcutMap.root).some((el) => focus.includes(el));
|
|
124
131
|
}
|
|
125
|
-
if ((
|
|
126
|
-
return !
|
|
132
|
+
if ((_b = shortcutMap.shortcut.conditions) === null || _b === void 0 ? void 0 : _b.focusExclude) {
|
|
133
|
+
return !querySelectorAllPlus(shortcutMap.shortcut.conditions.focusExclude, shortcutMap.root).some((el) => focus.includes(el));
|
|
127
134
|
}
|
|
128
135
|
return true;
|
|
129
136
|
}
|
|
137
|
+
function createEvent(keyShortcut, id, target, focusComposedPath) {
|
|
138
|
+
return new CustomEvent("keyShortcutPressed", {
|
|
139
|
+
bubbles: true,
|
|
140
|
+
cancelable: true,
|
|
141
|
+
composed: false,
|
|
142
|
+
detail: {
|
|
143
|
+
keyShortcut,
|
|
144
|
+
id: id,
|
|
145
|
+
target,
|
|
146
|
+
focusComposedPath
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function querySelectorAllPlus(selector, root) {
|
|
151
|
+
var _a;
|
|
152
|
+
return ((_a = selector === null || selector === void 0 ? void 0 : selector.split(",").map(selectorItem => {
|
|
153
|
+
if (selector.includes("::part")) {
|
|
154
|
+
return querySelectorPlus(selectorItem, root);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return Array.from(root.querySelectorAll(selector));
|
|
158
|
+
}
|
|
159
|
+
}).flat()) !== null && _a !== void 0 ? _a : []);
|
|
160
|
+
}
|
|
130
161
|
function querySelectorPlus(selector, root) {
|
|
131
162
|
const querySelectorDeep = (element, parts) => {
|
|
132
163
|
const shadow = element.shadowRoot;
|
|
@@ -151,7 +182,7 @@ function querySelectorPlus(selector, root) {
|
|
|
151
182
|
}
|
|
152
183
|
return null;
|
|
153
184
|
};
|
|
154
|
-
if (selector.includes("::part")) {
|
|
185
|
+
if (selector === null || selector === void 0 ? void 0 : selector.includes("::part")) {
|
|
155
186
|
const selectorItems = selector.match("(.*)::part\\(([^)]+)\\)");
|
|
156
187
|
const entity = selectorItems[1];
|
|
157
188
|
const partName = selectorItems[2];
|
|
@@ -164,22 +195,42 @@ function querySelectorPlus(selector, root) {
|
|
|
164
195
|
|
|
165
196
|
const chShortcutsCss = ":host{display:contents}";
|
|
166
197
|
|
|
198
|
+
const KEY_SYMBOL = {
|
|
199
|
+
" ": "\u2334"
|
|
200
|
+
};
|
|
167
201
|
const ChShortcuts = class {
|
|
168
202
|
constructor(hostRef) {
|
|
169
203
|
registerInstance(this, hostRef);
|
|
170
204
|
this.showShortcuts = false;
|
|
205
|
+
/**
|
|
206
|
+
* Key to show shortcut tooltips.
|
|
207
|
+
*/
|
|
171
208
|
this.showKey = "F10";
|
|
209
|
+
/**
|
|
210
|
+
* Suspend shortcuts.
|
|
211
|
+
*/
|
|
212
|
+
this.suspend = false;
|
|
172
213
|
this.windowClosedHandler = () => {
|
|
173
214
|
this.showShortcuts = false;
|
|
174
215
|
};
|
|
175
216
|
}
|
|
217
|
+
suspendHandler() {
|
|
218
|
+
if (this.suspend) {
|
|
219
|
+
unloadShortcuts(this.src);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
const root = this.el.getRootNode();
|
|
223
|
+
loadShortcuts(this.src, root, this.shortcuts);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
176
226
|
componentDidLoad() {
|
|
177
227
|
if (this.src) {
|
|
178
228
|
fetch(this.src).then(response => {
|
|
179
229
|
if (response.ok) {
|
|
180
230
|
response.json().then(json => {
|
|
181
231
|
const root = this.el.getRootNode();
|
|
182
|
-
|
|
232
|
+
this.shortcuts = json;
|
|
233
|
+
loadShortcuts(this.src, root, this.shortcuts);
|
|
183
234
|
});
|
|
184
235
|
}
|
|
185
236
|
});
|
|
@@ -189,18 +240,44 @@ const ChShortcuts = class {
|
|
|
189
240
|
unloadShortcuts(this.src);
|
|
190
241
|
}
|
|
191
242
|
windowKeyDownHandler(eventInfo) {
|
|
243
|
+
const modifierKeys = ["Ctrl", "Alt", "Shift", "Meta"];
|
|
244
|
+
if (eventInfo.repeat || this.suspend) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
192
247
|
if (eventInfo.key === this.showKey) {
|
|
193
248
|
this.showShortcuts = !this.showShortcuts;
|
|
194
249
|
eventInfo.preventDefault();
|
|
195
250
|
}
|
|
251
|
+
else if (this.showShortcuts && !modifierKeys.includes(eventInfo.key)) {
|
|
252
|
+
this.showShortcuts = false;
|
|
253
|
+
}
|
|
196
254
|
}
|
|
197
255
|
renderShortcuts() {
|
|
198
|
-
return getShortcuts(
|
|
256
|
+
return getShortcuts(this.src)
|
|
257
|
+
.filter(shortcut => shortcut.element)
|
|
258
|
+
.map(shortcut => (h("ch-window", { container: shortcut.element, modal: false, hidden: false, closeOnEscape: true, closeOnOutsideClick: true, xAlign: "outside-end", yAlign: "inside-start", onWindowClosed: this.windowClosedHandler, exportparts: "mask:element, main:tooltip" }, this.renderKeyShortcuts(shortcut.keyShortcuts))));
|
|
259
|
+
}
|
|
260
|
+
renderKeyShortcuts(keyShortcuts) {
|
|
261
|
+
return keyShortcuts.split(/(?<!(?:[+]|^))([+\s])/).map((key, i, items) => {
|
|
262
|
+
var _a;
|
|
263
|
+
if (key === "+" && i > 0 && items[i - 1] !== "+") {
|
|
264
|
+
return h("span", { part: "plus" }, "+");
|
|
265
|
+
}
|
|
266
|
+
else if (key === " " && i > 0 && items[i - 1] !== "+") {
|
|
267
|
+
return h("span", { part: "slash" }, "/");
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
return h("kbd", { part: `key` }, (_a = KEY_SYMBOL[key]) !== null && _a !== void 0 ? _a : key);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
199
273
|
}
|
|
200
274
|
render() {
|
|
201
275
|
return h(Host, null, this.showShortcuts && this.renderShortcuts());
|
|
202
276
|
}
|
|
203
277
|
get el() { return getElement(this); }
|
|
278
|
+
static get watchers() { return {
|
|
279
|
+
"suspend": ["suspendHandler"]
|
|
280
|
+
}; }
|
|
204
281
|
};
|
|
205
282
|
ChShortcuts.style = chShortcutsCss;
|
|
206
283
|
|
|
@@ -210,6 +287,7 @@ const GxgShortcuts = class {
|
|
|
210
287
|
constructor(hostRef) {
|
|
211
288
|
registerInstance(this, hostRef);
|
|
212
289
|
this.showKey = "F10";
|
|
290
|
+
this.suspend = false;
|
|
213
291
|
this.showTooltip = false;
|
|
214
292
|
this.show = false;
|
|
215
293
|
}
|
|
@@ -217,7 +295,8 @@ const GxgShortcuts = class {
|
|
|
217
295
|
this.showTooltip = true;
|
|
218
296
|
}
|
|
219
297
|
render() {
|
|
220
|
-
|
|
298
|
+
console.log("render");
|
|
299
|
+
return (h(Host, null, h("ch-shortcuts", { suspend: this.suspend, src: this.src, showKey: this.showKey })));
|
|
221
300
|
}
|
|
222
301
|
};
|
|
223
302
|
GxgShortcuts.style = shortcutsCss;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, f as forceUpdate, h, a as getAssetPath } from './index-0aa3977d.js';
|
|
2
|
+
import { f as fromGxImageToURL } from './genexus-implementation-3b347d88.js';
|
|
2
3
|
|
|
3
4
|
const filterWithCase = (stringToFilter, filter, matchCase) => matchCase
|
|
4
5
|
? stringToFilter.includes(filter)
|
|
@@ -19,7 +20,7 @@ const filterDictionary = {
|
|
|
19
20
|
!item.indeterminate &&
|
|
20
21
|
((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
+
list: (item, filterInfo) => filterInfo.filterSet.has(item.id),
|
|
23
24
|
metadata: (item, filterInfo) => {
|
|
24
25
|
var _a;
|
|
25
26
|
return filterInfo.filter
|
|
@@ -34,78 +35,11 @@ const filterDictionary = {
|
|
|
34
35
|
!((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
uri = `data:image/svg+xml;base64,${btoa(uri.slice(24).replace(/\\"/g, '"'))}`;
|
|
43
|
-
}
|
|
44
|
-
uri = uri.replace(/\\/g, "");
|
|
45
|
-
uri = uri.replace(/\s/g, "%20");
|
|
46
|
-
return uri;
|
|
47
|
-
}
|
|
48
|
-
function getImage(name, gxImageConstructor) {
|
|
49
|
-
if (!computedStyle) {
|
|
50
|
-
computedStyle = getComputedStyle(document.documentElement);
|
|
51
|
-
}
|
|
52
|
-
let value = computedStyle.getPropertyValue(`--gx-image_${name}`);
|
|
53
|
-
if (value) {
|
|
54
|
-
let matches;
|
|
55
|
-
const gximage = gxImageConstructor(name);
|
|
56
|
-
while ((matches = value.match(URL_REGEX))) {
|
|
57
|
-
gximage.densitySet.push({
|
|
58
|
-
uri: normalizeUri(matches[1] ? matches[2].slice(0, -1) : matches[2]),
|
|
59
|
-
density: matches[3] ? parseFloat(matches[3]) : 1
|
|
60
|
-
});
|
|
61
|
-
value = value.slice(matches[0].length);
|
|
62
|
-
}
|
|
63
|
-
if (gximage.densitySet.length > 0) {
|
|
64
|
-
gximage.uri = gximage.densitySet.reduce((previousValue, currentValue) => {
|
|
65
|
-
return previousValue.density === 1 ||
|
|
66
|
-
previousValue.density < currentValue.density
|
|
67
|
-
? previousValue
|
|
68
|
-
: currentValue;
|
|
69
|
-
}).uri;
|
|
70
|
-
}
|
|
71
|
-
return gximage;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const fromGxImageToURL = (gxImage, Settings, gxImageConstructor) => {
|
|
75
|
-
if (!gxImage) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
let url = "";
|
|
79
|
-
if (gxImage.id) {
|
|
80
|
-
url = getImage(gxImage.id, gxImageConstructor).uri;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
url = gxImage.uri;
|
|
84
|
-
}
|
|
85
|
-
if (!url) {
|
|
86
|
-
return "";
|
|
87
|
-
}
|
|
88
|
-
const baseUrl = Settings.WEBAPP_BASE;
|
|
89
|
-
const urlLower = url.toLowerCase();
|
|
90
|
-
if (urlLower.startsWith("assets/")) {
|
|
91
|
-
// Relative URL to local assets
|
|
92
|
-
return url;
|
|
93
|
-
}
|
|
94
|
-
else if (urlLower.startsWith("http://") ||
|
|
95
|
-
urlLower.startsWith("https://") ||
|
|
96
|
-
urlLower.startsWith("blob:") ||
|
|
97
|
-
urlLower.startsWith("file:") ||
|
|
98
|
-
urlLower.startsWith("data:")) {
|
|
99
|
-
// Absolute URL
|
|
100
|
-
return url;
|
|
101
|
-
}
|
|
102
|
-
else if (urlLower.startsWith(Settings.BASE_PATH.toLowerCase())) {
|
|
103
|
-
// Host relative URL
|
|
104
|
-
return baseUrl + url.substring(Settings.BASE_PATH.length);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
return baseUrl + url;
|
|
108
|
-
}
|
|
38
|
+
const computeFilter = (filterType, item, filterInfo) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return ((_a = filterInfo.filterOptions) === null || _a === void 0 ? void 0 : _a.hideMatchesAndShowNonMatches) === true
|
|
41
|
+
? !filterDictionary[filterType](item, filterInfo)
|
|
42
|
+
: filterDictionary[filterType](item, filterInfo);
|
|
109
43
|
};
|
|
110
44
|
|
|
111
45
|
const treeViewRenderCss = "ch-tree-view-render{display:contents}";
|
|
@@ -119,6 +53,11 @@ const DEFAULT_INDETERMINATE_VALUE = false;
|
|
|
119
53
|
const DEFAULT_LAZY_VALUE = false;
|
|
120
54
|
const DEFAULT_ORDER_VALUE = 0;
|
|
121
55
|
const DEFAULT_SELECTED_VALUE = false;
|
|
56
|
+
// There are a filter applied and, if the type is "caption" or
|
|
57
|
+
// "metadata", the filter property must be set
|
|
58
|
+
const treeViewHasFilters = (filterType, filter) => filterType !== "none" &&
|
|
59
|
+
((filterType !== "caption" && filterType !== "metadata") ||
|
|
60
|
+
(filter != null && filter.trim() !== ""));
|
|
122
61
|
const defaultRenderItem$1 = (itemModel, treeState, treeHasFilter, lastItem, level) => {
|
|
123
62
|
var _a, _b, _c, _d, _e, _f;
|
|
124
63
|
return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, disabled: itemModel.disabled, downloading: itemModel.downloading, dragDisabled: (_c = itemModel.dragDisabled) !== null && _c !== void 0 ? _c : treeState.dragDisabled, dropDisabled: (_d = itemModel.dropDisabled) !== null && _d !== void 0 ? _d : treeState.dropDisabled, editable: (_e = itemModel.editable) !== null && _e !== void 0 ? _e : treeState.editableItems, expanded: itemModel.expanded, indeterminate: itemModel.indeterminate, lastItem: lastItem, lazyLoad: itemModel.lazy, leaf: itemModel.leaf, leftImgSrc: itemModel.leftImgSrc, level: level, metadata: itemModel.metadata, rightImgSrc: itemModel.rightImgSrc, selected: itemModel.selected, showExpandableButton: itemModel.showExpandableButton, showLines: treeState.showLines, toggleCheckboxes: (_f = itemModel.toggleCheckboxes) !== null && _f !== void 0 ? _f : treeState.toggleCheckboxes }, !itemModel.leaf &&
|
|
@@ -126,13 +65,13 @@ const defaultRenderItem$1 = (itemModel, treeState, treeHasFilter, lastItem, leve
|
|
|
126
65
|
itemModel.items.map((subModel, index) => defaultRenderItem$1(subModel, treeState, treeHasFilter, treeState.showLines !== "none" &&
|
|
127
66
|
// If there is a filter applied in the current list, use the
|
|
128
67
|
// lastItemId value to calculate the last item
|
|
129
|
-
(treeHasFilter && itemModel.lastItemId !==
|
|
68
|
+
(treeHasFilter && itemModel.lastItemId !== undefined
|
|
130
69
|
? subModel.id === itemModel.lastItemId
|
|
131
70
|
: index === itemModel.items.length - 1), level + 1))));
|
|
132
71
|
};
|
|
133
72
|
const GXRenderItem = (itemModel, treeState, treeHasFilter, lastItem, level) => {
|
|
134
73
|
var _a, _b, _c, _d;
|
|
135
|
-
return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, downloading: itemModel.downloading, dragDisabled: itemModel.dragEnabled != null
|
|
74
|
+
return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { key: itemModel.id, id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, downloading: itemModel.downloading, dragDisabled: itemModel.dragEnabled != null
|
|
136
75
|
? !itemModel.dragEnabled
|
|
137
76
|
: treeState.dragDisabled, dropDisabled: itemModel.dropEnabled != null
|
|
138
77
|
? !itemModel.dropEnabled
|
|
@@ -141,7 +80,7 @@ const GXRenderItem = (itemModel, treeState, treeHasFilter, lastItem, level) => {
|
|
|
141
80
|
itemModel.items.map((subModel, index) => GXRenderItem(subModel, treeState, treeHasFilter, treeState.showLines !== "none" &&
|
|
142
81
|
// If there is a filter applied in the current list, use the
|
|
143
82
|
// lastItemId value to calculate the last item
|
|
144
|
-
(treeHasFilter && itemModel.lastItemId !==
|
|
83
|
+
(treeHasFilter && itemModel.lastItemId !== undefined
|
|
145
84
|
? subModel.id === itemModel.lastItemId
|
|
146
85
|
: index === itemModel.items.length - 1), level + 1))));
|
|
147
86
|
};
|
|
@@ -213,13 +152,12 @@ const ChTreeViewRender = class {
|
|
|
213
152
|
this.filterDebounce = 250;
|
|
214
153
|
/**
|
|
215
154
|
* This property lets you determine the list of items that will be filtered.
|
|
216
|
-
* Only works if `filterType = "
|
|
155
|
+
* Only works if `filterType = "list"`.
|
|
217
156
|
*/
|
|
218
157
|
this.filterList = [];
|
|
219
158
|
/**
|
|
220
159
|
* This property lets you determine the options that will be applied to the
|
|
221
160
|
* filter.
|
|
222
|
-
* Only works if `filterType = "caption" | "metadata"`.
|
|
223
161
|
*/
|
|
224
162
|
this.filterOptions = {};
|
|
225
163
|
/**
|
|
@@ -232,7 +170,7 @@ const ChTreeViewRender = class {
|
|
|
232
170
|
* | `unchecked` | Show only the items that have a checkbox and are not checked. |
|
|
233
171
|
* | `caption` | Show only the items whose `caption` satisfies the regex determinate by the `filter` property. |
|
|
234
172
|
* | `metadata` | Show only the items whose `metadata` satisfies the regex determinate by the `filter` property. |
|
|
235
|
-
* | `
|
|
173
|
+
* | `list` | Show only the items that are contained in the array determinate by the `filterList` property. |
|
|
236
174
|
* | `none` | Show all items. |
|
|
237
175
|
*/
|
|
238
176
|
this.filterType = "none";
|
|
@@ -306,7 +244,8 @@ const ChTreeViewRender = class {
|
|
|
306
244
|
newSelectedItem.expanded = newSelectedItemInfo.expanded;
|
|
307
245
|
this.selectedItems.add(itemId);
|
|
308
246
|
});
|
|
309
|
-
this.
|
|
247
|
+
const selectedItemsInfo = this._getItemsInfo([...event.detail.keys()]);
|
|
248
|
+
this.selectedItemsChange.emit(selectedItemsInfo);
|
|
310
249
|
};
|
|
311
250
|
this.handleExpandedItemChange = (event) => {
|
|
312
251
|
const detail = event.detail;
|
|
@@ -387,14 +326,14 @@ const ChTreeViewRender = class {
|
|
|
387
326
|
}
|
|
388
327
|
}
|
|
389
328
|
handleFilterListChange() {
|
|
390
|
-
|
|
329
|
+
// Use a Set to efficiently check for ids
|
|
330
|
+
this.filterListAsSet = new Set(this.filterList);
|
|
331
|
+
if (this.filterType === "list") {
|
|
391
332
|
this.processFilters();
|
|
392
333
|
}
|
|
393
334
|
}
|
|
394
335
|
handleFilterOptionsChange() {
|
|
395
|
-
|
|
396
|
-
this.processFilters();
|
|
397
|
-
}
|
|
336
|
+
this.processFilters();
|
|
398
337
|
}
|
|
399
338
|
handleFilterTypeChange() {
|
|
400
339
|
this.processFilters();
|
|
@@ -443,6 +382,23 @@ const ChTreeViewRender = class {
|
|
|
443
382
|
// Force re-render
|
|
444
383
|
forceUpdate(this);
|
|
445
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Given a list of ids, it returns an array of the items that exists in the
|
|
387
|
+
* given list.
|
|
388
|
+
*/
|
|
389
|
+
async getItemsInfo(itemsId) {
|
|
390
|
+
return this._getItemsInfo(itemsId);
|
|
391
|
+
}
|
|
392
|
+
_getItemsInfo(itemsId) {
|
|
393
|
+
const treeViewItemsInfo = [];
|
|
394
|
+
itemsId.forEach(itemId => {
|
|
395
|
+
const itemUIModel = this.flattenedTreeModel.get(itemId);
|
|
396
|
+
if (itemUIModel) {
|
|
397
|
+
treeViewItemsInfo.push(itemUIModel);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
return treeViewItemsInfo;
|
|
401
|
+
}
|
|
446
402
|
/**
|
|
447
403
|
* Given an item id, an array of items to add, the download status and the
|
|
448
404
|
* lazy state, updates the item's UI Model.
|
|
@@ -564,7 +520,9 @@ const ChTreeViewRender = class {
|
|
|
564
520
|
}
|
|
565
521
|
const itemInfo = itemUIModel.item;
|
|
566
522
|
Object.keys(properties).forEach(propertyName => {
|
|
567
|
-
|
|
523
|
+
if (properties[propertyName] !== undefined) {
|
|
524
|
+
itemInfo[propertyName] = properties[propertyName];
|
|
525
|
+
}
|
|
568
526
|
});
|
|
569
527
|
}
|
|
570
528
|
updateCheckboxValue(event) {
|
|
@@ -671,7 +629,7 @@ const ChTreeViewRender = class {
|
|
|
671
629
|
let aSubItemIsRendered = false;
|
|
672
630
|
// Check if a subitem is rendered
|
|
673
631
|
if (item.leaf !== true && item.items != null) {
|
|
674
|
-
let lastItemId =
|
|
632
|
+
let lastItemId = undefined;
|
|
675
633
|
item.items.forEach(subItem => {
|
|
676
634
|
const itemSatisfiesFilter = this.filterSubModel(subItem, filterInfo);
|
|
677
635
|
aSubItemIsRendered || (aSubItemIsRendered = itemSatisfiesFilter);
|
|
@@ -683,7 +641,7 @@ const ChTreeViewRender = class {
|
|
|
683
641
|
}
|
|
684
642
|
// The current item is rendered if it satisfies the filter condition or a
|
|
685
643
|
// subitem exists that needs to be rendered
|
|
686
|
-
const satisfiesFilter =
|
|
644
|
+
const satisfiesFilter = aSubItemIsRendered || computeFilter(this.filterType, item, filterInfo);
|
|
687
645
|
item.render = satisfiesFilter; // Update item render
|
|
688
646
|
return satisfiesFilter;
|
|
689
647
|
}
|
|
@@ -720,8 +678,8 @@ const ChTreeViewRender = class {
|
|
|
720
678
|
defaultCheckbox: this.checkbox,
|
|
721
679
|
defaultChecked: this.checked,
|
|
722
680
|
filter: this.filter,
|
|
723
|
-
|
|
724
|
-
|
|
681
|
+
filterOptions: this.filterOptions,
|
|
682
|
+
filterSet: this.filterListAsSet
|
|
725
683
|
});
|
|
726
684
|
// Check if should filter with debounce
|
|
727
685
|
if (processWithDebounce) {
|
|
@@ -753,8 +711,7 @@ const ChTreeViewRender = class {
|
|
|
753
711
|
}
|
|
754
712
|
}
|
|
755
713
|
render() {
|
|
756
|
-
return (h("ch-tree-view", { class: this.cssClass || null, multiSelection: this.multiSelection, waitDropProcessing: this.waitDropProcessing, onDroppableZoneEnter: this.handleDroppableZoneEnter, onExpandedItemChange: this.handleExpandedItemChange, onItemContextmenu: this.handleItemContextmenu, onItemsDropped: this.handleItemsDropped, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, this.treeModel.map((itemModel, index) => this.renderItem(itemModel, this, (this.filterType
|
|
757
|
-
this.filter != null, this.showLines !== "none" && index === this.treeModel.length - 1, 0))));
|
|
714
|
+
return (h("ch-tree-view", { class: this.cssClass || null, multiSelection: this.multiSelection, waitDropProcessing: this.waitDropProcessing, onDroppableZoneEnter: this.handleDroppableZoneEnter, onExpandedItemChange: this.handleExpandedItemChange, onItemContextmenu: this.handleItemContextmenu, onItemsDropped: this.handleItemsDropped, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, this.treeModel.map((itemModel, index) => this.renderItem(itemModel, this, treeViewHasFilters(this.filterType, this.filter), this.showLines !== "none" && index === this.treeModel.length - 1, 0))));
|
|
758
715
|
}
|
|
759
716
|
static get watchers() { return {
|
|
760
717
|
"filter": ["handleFilterChange"],
|