@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
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { f as fromGxImageToURL } from './genexus-implementation.js';
|
|
3
|
+
import { d as defineCustomElement$7 } from './action-group.js';
|
|
4
|
+
import { d as defineCustomElement$6 } from './action-group-item.js';
|
|
5
|
+
import { d as defineCustomElement$5 } from './dropdown.js';
|
|
6
|
+
import { d as defineCustomElement$4 } from './dropdown-item.js';
|
|
7
|
+
import { d as defineCustomElement$3 } from './ch-window2.js';
|
|
8
|
+
import { d as defineCustomElement$2 } from './ch-window-close2.js';
|
|
9
|
+
|
|
10
|
+
const actionGroupRenderCss = "ch-action-group-render{display:contents}";
|
|
11
|
+
|
|
12
|
+
const DEFAULT_ACTION_CLASS = "action-group-item";
|
|
13
|
+
const DEFAULT_SUB_ACTION_CLASS = "dropdown-item";
|
|
14
|
+
const ChActionGroupRender$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.__registerHost();
|
|
18
|
+
this.displayedItemsCount = -1;
|
|
19
|
+
/**
|
|
20
|
+
* This attribute lets you specify the label for the expandable button.
|
|
21
|
+
* Important for accessibility.
|
|
22
|
+
*/
|
|
23
|
+
this.buttonLabel = "Show options";
|
|
24
|
+
/**
|
|
25
|
+
* A CSS class to set as the `ch-action-group` element class.
|
|
26
|
+
*/
|
|
27
|
+
this.cssClass = "action-group";
|
|
28
|
+
/**
|
|
29
|
+
* Determine which actions on the expandable button display the dropdown
|
|
30
|
+
* section.
|
|
31
|
+
*/
|
|
32
|
+
this.expandBehavior = "ClickOrHover";
|
|
33
|
+
/**
|
|
34
|
+
* This attribute determines how items behave when the content of the ActionGroup overflows horizontal. This property is needed
|
|
35
|
+
* to make the control responsive to changes in the Width of the container of ActionGroup.
|
|
36
|
+
*
|
|
37
|
+
* | Value | Details |
|
|
38
|
+
* | --------------------- | ------------------------------------------------------------------------------------------------ |
|
|
39
|
+
* | `Add Scroll` | The items of the ActionGroup that overflow horizontally are shown by means of a scroll. |
|
|
40
|
+
* | `Multiline` | The ActionGroup items that overflow horizontally are shown in a second line of the control. |
|
|
41
|
+
* | `Responsive Collapse` | The Action Group items, when they start to overflow the control, are placed in the More Actions. |
|
|
42
|
+
*/
|
|
43
|
+
this.itemsOverflowBehavior = "ResponsiveCollapse";
|
|
44
|
+
/**
|
|
45
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
46
|
+
* button of the control is focused.
|
|
47
|
+
*/
|
|
48
|
+
this.openOnFocus = false;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
51
|
+
* the more actions button.
|
|
52
|
+
*/
|
|
53
|
+
this.moreActionsDropdownPosition = "InsideStart_OutsideEnd";
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the separation (in pixels) between the expandable button and the
|
|
56
|
+
* dropdown section of the control.
|
|
57
|
+
*/
|
|
58
|
+
this.separation = 0;
|
|
59
|
+
/**
|
|
60
|
+
* This property is a WA to implement the Tree View as a UC 2.0 in GeneXus.
|
|
61
|
+
*/
|
|
62
|
+
this.useGxRender = false;
|
|
63
|
+
// /**
|
|
64
|
+
// * Fired when the visibility of the dropdown section is changed
|
|
65
|
+
// */
|
|
66
|
+
// @Event() expandedChange: EventEmitter<boolean>;
|
|
67
|
+
this.handleItemClick = (target, itemId) => (event) => {
|
|
68
|
+
this.itemClickCallback(event, target, itemId);
|
|
69
|
+
};
|
|
70
|
+
this.renderImg = (img) => this.useGxRender
|
|
71
|
+
? fromGxImageToURL(img, this.gxSettings, this.gxImageConstructor)
|
|
72
|
+
: img;
|
|
73
|
+
this.renderItem = (responsiveCollapse) => (item, index) => {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
return (h("ch-dropdown-item", { slot: "items", key: item.id || item.caption || index, id: item.id, class: item.subActionClass || DEFAULT_SUB_ACTION_CLASS, expandBehavior: this.expandBehavior, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.renderImg(item.startImage), openOnFocus: this.openOnFocus, position: (responsiveCollapse
|
|
76
|
+
? item.itemsResponsiveCollapsePosition
|
|
77
|
+
: item.itemsPosition) || "OutsideEnd_InsideStart", rightImgSrc: this.renderImg(item.endImage), onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, item.items != null &&
|
|
78
|
+
item.items.map(this.renderItem(responsiveCollapse))));
|
|
79
|
+
};
|
|
80
|
+
this.firstLevelRenderItem = (item, index) => {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
return (h("ch-dropdown-item", { key: item.id || item.caption || index, id: item.id, class: item.actionClass || DEFAULT_ACTION_CLASS, expandBehavior: this.expandBehavior, forceContainingBlock: false, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.renderImg(item.startImage), openOnFocus: this.openOnFocus, position: item.itemsPosition || "Center_OutsideEnd", rightImgSrc: this.renderImg(item.endImage), onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
83
|
+
(this.displayedItemsCount === -1 || index < this.displayedItemsCount) &&
|
|
84
|
+
item.items != null &&
|
|
85
|
+
item.items.map(this.renderItem(false)),
|
|
86
|
+
// Dummy dropdown item to avoid issues when removing all items from the
|
|
87
|
+
// first level. E. g., if the first level adds a chevron when the item is
|
|
88
|
+
// a dropdown, by removing all items the chevron won't be displayed
|
|
89
|
+
this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
90
|
+
this.displayedItemsCount !== -1 &&
|
|
91
|
+
index >= this.displayedItemsCount &&
|
|
92
|
+
item.items != null &&
|
|
93
|
+
item.items.length !== 0 && h("ch-dropdown-item", null)));
|
|
94
|
+
};
|
|
95
|
+
this.firstLevelRenderCollapsedItem = (item, index) => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return (h("ch-dropdown-item", { slot: "more-items", key: item.id || item.caption || index, id: item.id, class: item.subActionClass || DEFAULT_SUB_ACTION_CLASS, expandBehavior: this.expandBehavior, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.renderImg(item.startImage), openOnFocus: this.openOnFocus, position: item.itemsResponsiveCollapsePosition || "OutsideEnd_InsideStart", rightImgSrc: this.renderImg(item.endImage), onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, item.items != null && item.items.map(this.renderItem(true))));
|
|
98
|
+
};
|
|
99
|
+
this.handleDisplayedItemsCountChange = (event) => {
|
|
100
|
+
this.displayedItemsCount = event.detail;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
render() {
|
|
104
|
+
return (h("ch-action-group", { buttonLabel: this.buttonLabel, class: this.cssClass || null, expandBehavior: this.expandBehavior, itemsOverflowBehavior: this.itemsOverflowBehavior, moreActionsDropdownPosition: this.moreActionsDropdownPosition, openOnFocus: this.openOnFocus, onDisplayedItemsCountChange: this.handleDisplayedItemsCountChange }, this.model != null &&
|
|
105
|
+
this.model.map((item, index) => (h("ch-action-group-item", { slot: "items", key: item.id || item.caption || index }, this.firstLevelRenderItem(item, index)))), this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
106
|
+
this.model != null &&
|
|
107
|
+
this.model
|
|
108
|
+
.filter((_, index) => this.displayedItemsCount !== -1 &&
|
|
109
|
+
index >= this.displayedItemsCount)
|
|
110
|
+
.map(this.firstLevelRenderCollapsedItem)));
|
|
111
|
+
}
|
|
112
|
+
static get style() { return actionGroupRenderCss; }
|
|
113
|
+
}, [0, "ch-action-group-render", {
|
|
114
|
+
"buttonLabel": [1, "button-label"],
|
|
115
|
+
"cssClass": [1, "css-class"],
|
|
116
|
+
"expandBehavior": [1, "expand-behavior"],
|
|
117
|
+
"gxImageConstructor": [16],
|
|
118
|
+
"gxSettings": [8, "gx-settings"],
|
|
119
|
+
"itemClickCallback": [16],
|
|
120
|
+
"itemsOverflowBehavior": [1, "items-overflow-behavior"],
|
|
121
|
+
"model": [16],
|
|
122
|
+
"openOnFocus": [4, "open-on-focus"],
|
|
123
|
+
"moreActionsDropdownPosition": [1, "more-actions-dropdown-position"],
|
|
124
|
+
"separation": [2],
|
|
125
|
+
"useGxRender": [4, "use-gx-render"],
|
|
126
|
+
"displayedItemsCount": [32]
|
|
127
|
+
}]);
|
|
128
|
+
function defineCustomElement$1() {
|
|
129
|
+
if (typeof customElements === "undefined") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const components = ["ch-action-group-render", "ch-action-group", "ch-action-group-item", "ch-dropdown", "ch-dropdown-item", "ch-window", "ch-window-close"];
|
|
133
|
+
components.forEach(tagName => { switch (tagName) {
|
|
134
|
+
case "ch-action-group-render":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
customElements.define(tagName, ChActionGroupRender$1);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "ch-action-group":
|
|
140
|
+
if (!customElements.get(tagName)) {
|
|
141
|
+
defineCustomElement$7();
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case "ch-action-group-item":
|
|
145
|
+
if (!customElements.get(tagName)) {
|
|
146
|
+
defineCustomElement$6();
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
case "ch-dropdown":
|
|
150
|
+
if (!customElements.get(tagName)) {
|
|
151
|
+
defineCustomElement$5();
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
case "ch-dropdown-item":
|
|
155
|
+
if (!customElements.get(tagName)) {
|
|
156
|
+
defineCustomElement$4();
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
case "ch-window":
|
|
160
|
+
if (!customElements.get(tagName)) {
|
|
161
|
+
defineCustomElement$3();
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case "ch-window-close":
|
|
165
|
+
if (!customElements.get(tagName)) {
|
|
166
|
+
defineCustomElement$2();
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
} });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const ChActionGroupRender = ChActionGroupRender$1;
|
|
173
|
+
const defineCustomElement = defineCustomElement$1;
|
|
174
|
+
|
|
175
|
+
export { ChActionGroupRender, defineCustomElement };
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const dropdownItemSeparatorCss = ":host{display:flex;height:1px;background-color:#99999980;margin-block:2px}";
|
|
4
|
+
|
|
5
|
+
const ChDropDownItemSeparator = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
return h(Host, { role: "separator" });
|
|
13
|
+
}
|
|
14
|
+
static get style() { return dropdownItemSeparatorCss; }
|
|
15
|
+
}, [1, "ch-dropdown-item-separator"]);
|
|
16
|
+
function defineCustomElement$1() {
|
|
17
|
+
if (typeof customElements === "undefined") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const components = ["ch-dropdown-item-separator"];
|
|
21
|
+
components.forEach(tagName => { switch (tagName) {
|
|
22
|
+
case "ch-dropdown-item-separator":
|
|
23
|
+
if (!customElements.get(tagName)) {
|
|
24
|
+
customElements.define(tagName, ChDropDownItemSeparator);
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
} });
|
|
28
|
+
}
|
|
2
29
|
|
|
3
30
|
const ChDropdownItemSeparator = ChDropDownItemSeparator;
|
|
4
31
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { f as fromGxImageToURL } from './genexus-implementation.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './dropdown.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './dropdown-item.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './ch-window2.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './ch-window-close2.js';
|
|
7
|
+
|
|
8
|
+
const dropdownRenderCss = "ch-dropdown-render{display:contents}";
|
|
9
|
+
|
|
10
|
+
const DEFAULT_DROPDOWN_ITEM_CLASS = "dropdown-item";
|
|
11
|
+
const ChDropdownRender$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
this.showHeader = false;
|
|
16
|
+
this.showFooter = false;
|
|
17
|
+
/**
|
|
18
|
+
* This attribute lets you specify the label for the expandable button.
|
|
19
|
+
* Important for accessibility.
|
|
20
|
+
*/
|
|
21
|
+
this.buttonLabel = "Show options";
|
|
22
|
+
/**
|
|
23
|
+
* A CSS class to set as the `ch-dropdown` element class.
|
|
24
|
+
*/
|
|
25
|
+
this.cssClass = "dropdown";
|
|
26
|
+
/**
|
|
27
|
+
* Determine which actions on the expandable button display the dropdown
|
|
28
|
+
* section.
|
|
29
|
+
*/
|
|
30
|
+
this.expandBehavior = "ClickOrHover";
|
|
31
|
+
/**
|
|
32
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
33
|
+
* button of the control is focused.
|
|
34
|
+
*/
|
|
35
|
+
this.openOnFocus = false;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
38
|
+
* the expandable button.
|
|
39
|
+
*/
|
|
40
|
+
this.position = "Center_OutsideEnd";
|
|
41
|
+
/**
|
|
42
|
+
* This property is a WA to implement the Tree View as a UC 2.0 in GeneXus.
|
|
43
|
+
*/
|
|
44
|
+
this.useGxRender = false;
|
|
45
|
+
// /**
|
|
46
|
+
// * Fired when the visibility of the dropdown section is changed
|
|
47
|
+
// */
|
|
48
|
+
// @Event() expandedChange: EventEmitter<boolean>;
|
|
49
|
+
this.handleItemClick = (target, itemId) => (event) => {
|
|
50
|
+
this.itemClickCallback(event, target, itemId);
|
|
51
|
+
};
|
|
52
|
+
this.renderItem = (item) => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return [
|
|
55
|
+
h("ch-dropdown-item", { slot: "items", id: item.id, class: item.class || DEFAULT_DROPDOWN_ITEM_CLASS, expandBehavior: this.expandBehavior, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.useGxRender
|
|
56
|
+
? fromGxImageToURL(item.startImage, this.gxSettings, this.gxImageConstructor)
|
|
57
|
+
: item.startImage, openOnFocus: this.openOnFocus, position: item.itemsPosition || "OutsideEnd_InsideStart", rightImgSrc: this.useGxRender
|
|
58
|
+
? fromGxImageToURL(item.endImage, this.gxSettings, this.gxImageConstructor)
|
|
59
|
+
: item.endImage, onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, item.items != null && item.items.map(this.renderItem))
|
|
60
|
+
];
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
componentWillLoad() {
|
|
64
|
+
this.showHeader = !!this.el.querySelector(':scope>[slot="header"]');
|
|
65
|
+
this.showFooter = !!this.el.querySelector(':scope>[slot="footer"]');
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return (h("ch-dropdown", { buttonLabel: this.buttonLabel, class: this.cssClass || null, expandBehavior: this.expandBehavior, openOnFocus: this.openOnFocus, position: this.position }, h("slot", { name: "action", slot: "action" }), this.showHeader && h("slot", { name: "header", slot: "header" }), this.model != null && this.model.map(this.renderItem), this.showFooter && h("slot", { name: "footer", slot: "footer" })));
|
|
69
|
+
}
|
|
70
|
+
get el() { return this; }
|
|
71
|
+
static get style() { return dropdownRenderCss; }
|
|
72
|
+
}, [4, "ch-dropdown-render", {
|
|
73
|
+
"buttonLabel": [1, "button-label"],
|
|
74
|
+
"cssClass": [1, "css-class"],
|
|
75
|
+
"expandBehavior": [1, "expand-behavior"],
|
|
76
|
+
"gxImageConstructor": [16],
|
|
77
|
+
"gxSettings": [8, "gx-settings"],
|
|
78
|
+
"itemClickCallback": [16],
|
|
79
|
+
"model": [16],
|
|
80
|
+
"openOnFocus": [4, "open-on-focus"],
|
|
81
|
+
"position": [1],
|
|
82
|
+
"useGxRender": [4, "use-gx-render"]
|
|
83
|
+
}]);
|
|
84
|
+
function defineCustomElement$1() {
|
|
85
|
+
if (typeof customElements === "undefined") {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const components = ["ch-dropdown-render", "ch-dropdown", "ch-dropdown-item", "ch-window", "ch-window-close"];
|
|
89
|
+
components.forEach(tagName => { switch (tagName) {
|
|
90
|
+
case "ch-dropdown-render":
|
|
91
|
+
if (!customElements.get(tagName)) {
|
|
92
|
+
customElements.define(tagName, ChDropdownRender$1);
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
case "ch-dropdown":
|
|
96
|
+
if (!customElements.get(tagName)) {
|
|
97
|
+
defineCustomElement$5();
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case "ch-dropdown-item":
|
|
101
|
+
if (!customElements.get(tagName)) {
|
|
102
|
+
defineCustomElement$4();
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case "ch-window":
|
|
106
|
+
if (!customElements.get(tagName)) {
|
|
107
|
+
defineCustomElement$3();
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
case "ch-window-close":
|
|
111
|
+
if (!customElements.get(tagName)) {
|
|
112
|
+
defineCustomElement$2();
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
} });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const ChDropdownRender = ChDropdownRender$1;
|
|
119
|
+
const defineCustomElement = defineCustomElement$1;
|
|
120
|
+
|
|
121
|
+
export { ChDropdownRender, defineCustomElement };
|
|
@@ -9,7 +9,8 @@ function loadShortcuts(name, root, shortcuts) {
|
|
|
9
9
|
shortcuts.forEach(shortcut => {
|
|
10
10
|
const keyShortcuts = parseKeyShortcuts(shortcut.keyShortcuts);
|
|
11
11
|
keyShortcuts.forEach(keyShortcut => {
|
|
12
|
-
|
|
12
|
+
const normalizedKeyShortcut = normalize(keyShortcut.ctrl, keyShortcut.alt, keyShortcut.shift, keyShortcut.meta, keyShortcut.key);
|
|
13
|
+
SHORTCUTS.set(normalizedKeyShortcut, {
|
|
13
14
|
name,
|
|
14
15
|
root,
|
|
15
16
|
shortcut
|
|
@@ -28,11 +29,12 @@ function unloadShortcuts(name) {
|
|
|
28
29
|
removeKeyShortcuts.forEach(key => SHORTCUTS.delete(key));
|
|
29
30
|
removeListener();
|
|
30
31
|
}
|
|
31
|
-
function getShortcuts() {
|
|
32
|
+
function getShortcuts(name) {
|
|
32
33
|
return Array.from(SHORTCUTS.values())
|
|
33
34
|
.filter(shortcutMap => {
|
|
34
35
|
var _a;
|
|
35
|
-
return
|
|
36
|
+
return (shortcutMap.name === name &&
|
|
37
|
+
!((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude));
|
|
36
38
|
})
|
|
37
39
|
.map(shortcutMap => ({
|
|
38
40
|
element: querySelectorPlus(shortcutMap.shortcut.selector, shortcutMap.root),
|
|
@@ -58,27 +60,33 @@ function keydownHandler(eventInfo) {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
function triggerShortcut(eventInfo) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
+
const shortcut = normalize(eventInfo.ctrlKey, eventInfo.altKey, eventInfo.shiftKey, eventInfo.metaKey, eventInfo.key);
|
|
64
|
+
const shortcutMap = SHORTCUTS.get(shortcut);
|
|
65
|
+
const focus = focusComposedPath();
|
|
66
|
+
if (shortcutMap && conditions(shortcutMap, focus)) {
|
|
63
67
|
const element = querySelectorPlus(shortcutMap.shortcut.selector, shortcutMap.root);
|
|
64
|
-
|
|
68
|
+
const keyShortcutPressedEvent = createEvent(shortcut, shortcutMap.shortcut.id, element, focus);
|
|
69
|
+
if (shortcutMap.root.dispatchEvent(keyShortcutPressedEvent)) {
|
|
65
70
|
switch (shortcutMap.shortcut.action) {
|
|
66
71
|
case "click":
|
|
67
|
-
element.dispatchEvent(new Event("click"));
|
|
72
|
+
element === null || element === void 0 ? void 0 : element.dispatchEvent(new Event("click"));
|
|
68
73
|
break;
|
|
69
74
|
default:
|
|
70
|
-
element.focus();
|
|
75
|
+
element === null || element === void 0 ? void 0 : element.focus();
|
|
71
76
|
}
|
|
72
77
|
if (shortcutMap.shortcut.preventDefault !== false) {
|
|
73
78
|
eventInfo.preventDefault();
|
|
74
79
|
}
|
|
75
80
|
}
|
|
81
|
+
else {
|
|
82
|
+
eventInfo.preventDefault();
|
|
83
|
+
}
|
|
76
84
|
}
|
|
77
85
|
return shortcutMap;
|
|
78
86
|
}
|
|
79
87
|
function parseKeyShortcuts(value = "") {
|
|
80
|
-
return value.split(
|
|
81
|
-
return item.split(
|
|
88
|
+
return value.split(/(?<!(?:[+]|^))\s/).map(item => {
|
|
89
|
+
return item.split(/(?<!(?:[+]|^))[+]/).reduce((keyShortcut, key) => {
|
|
82
90
|
switch (key.toLowerCase()) {
|
|
83
91
|
case "ctrl":
|
|
84
92
|
keyShortcut.ctrl = true;
|
|
@@ -118,17 +126,40 @@ function normalize(ctrl, alt, shift, meta, key) {
|
|
|
118
126
|
})
|
|
119
127
|
.join("+");
|
|
120
128
|
}
|
|
121
|
-
function conditions(shortcutMap) {
|
|
122
|
-
var _a, _b
|
|
123
|
-
const focus = focusComposedPath();
|
|
129
|
+
function conditions(shortcutMap, focus) {
|
|
130
|
+
var _a, _b;
|
|
124
131
|
if ((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude) {
|
|
125
|
-
return
|
|
132
|
+
return querySelectorAllPlus(shortcutMap.shortcut.conditions.focusInclude, shortcutMap.root).some((el) => focus.includes(el));
|
|
126
133
|
}
|
|
127
|
-
if ((
|
|
128
|
-
return !
|
|
134
|
+
if ((_b = shortcutMap.shortcut.conditions) === null || _b === void 0 ? void 0 : _b.focusExclude) {
|
|
135
|
+
return !querySelectorAllPlus(shortcutMap.shortcut.conditions.focusExclude, shortcutMap.root).some((el) => focus.includes(el));
|
|
129
136
|
}
|
|
130
137
|
return true;
|
|
131
138
|
}
|
|
139
|
+
function createEvent(keyShortcut, id, target, focusComposedPath) {
|
|
140
|
+
return new CustomEvent("keyShortcutPressed", {
|
|
141
|
+
bubbles: true,
|
|
142
|
+
cancelable: true,
|
|
143
|
+
composed: false,
|
|
144
|
+
detail: {
|
|
145
|
+
keyShortcut,
|
|
146
|
+
id: id,
|
|
147
|
+
target,
|
|
148
|
+
focusComposedPath
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function querySelectorAllPlus(selector, root) {
|
|
153
|
+
var _a;
|
|
154
|
+
return ((_a = selector === null || selector === void 0 ? void 0 : selector.split(",").map(selectorItem => {
|
|
155
|
+
if (selector.includes("::part")) {
|
|
156
|
+
return querySelectorPlus(selectorItem, root);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return Array.from(root.querySelectorAll(selector));
|
|
160
|
+
}
|
|
161
|
+
}).flat()) !== null && _a !== void 0 ? _a : []);
|
|
162
|
+
}
|
|
132
163
|
function querySelectorPlus(selector, root) {
|
|
133
164
|
const querySelectorDeep = (element, parts) => {
|
|
134
165
|
const shadow = element.shadowRoot;
|
|
@@ -153,7 +184,7 @@ function querySelectorPlus(selector, root) {
|
|
|
153
184
|
}
|
|
154
185
|
return null;
|
|
155
186
|
};
|
|
156
|
-
if (selector.includes("::part")) {
|
|
187
|
+
if (selector === null || selector === void 0 ? void 0 : selector.includes("::part")) {
|
|
157
188
|
const selectorItems = selector.match("(.*)::part\\(([^)]+)\\)");
|
|
158
189
|
const entity = selectorItems[1];
|
|
159
190
|
const partName = selectorItems[2];
|
|
@@ -166,24 +197,44 @@ function querySelectorPlus(selector, root) {
|
|
|
166
197
|
|
|
167
198
|
const chShortcutsCss = ":host{display:contents}";
|
|
168
199
|
|
|
200
|
+
const KEY_SYMBOL = {
|
|
201
|
+
" ": "\u2334"
|
|
202
|
+
};
|
|
169
203
|
const ChShortcuts = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
170
204
|
constructor() {
|
|
171
205
|
super();
|
|
172
206
|
this.__registerHost();
|
|
173
207
|
this.__attachShadow();
|
|
174
208
|
this.showShortcuts = false;
|
|
209
|
+
/**
|
|
210
|
+
* Key to show shortcut tooltips.
|
|
211
|
+
*/
|
|
175
212
|
this.showKey = "F10";
|
|
213
|
+
/**
|
|
214
|
+
* Suspend shortcuts.
|
|
215
|
+
*/
|
|
216
|
+
this.suspend = false;
|
|
176
217
|
this.windowClosedHandler = () => {
|
|
177
218
|
this.showShortcuts = false;
|
|
178
219
|
};
|
|
179
220
|
}
|
|
221
|
+
suspendHandler() {
|
|
222
|
+
if (this.suspend) {
|
|
223
|
+
unloadShortcuts(this.src);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
const root = this.el.getRootNode();
|
|
227
|
+
loadShortcuts(this.src, root, this.shortcuts);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
180
230
|
componentDidLoad() {
|
|
181
231
|
if (this.src) {
|
|
182
232
|
fetch(this.src).then(response => {
|
|
183
233
|
if (response.ok) {
|
|
184
234
|
response.json().then(json => {
|
|
185
235
|
const root = this.el.getRootNode();
|
|
186
|
-
|
|
236
|
+
this.shortcuts = json;
|
|
237
|
+
loadShortcuts(this.src, root, this.shortcuts);
|
|
187
238
|
});
|
|
188
239
|
}
|
|
189
240
|
});
|
|
@@ -193,22 +244,49 @@ const ChShortcuts = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
193
244
|
unloadShortcuts(this.src);
|
|
194
245
|
}
|
|
195
246
|
windowKeyDownHandler(eventInfo) {
|
|
247
|
+
const modifierKeys = ["Ctrl", "Alt", "Shift", "Meta"];
|
|
248
|
+
if (eventInfo.repeat || this.suspend) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
196
251
|
if (eventInfo.key === this.showKey) {
|
|
197
252
|
this.showShortcuts = !this.showShortcuts;
|
|
198
253
|
eventInfo.preventDefault();
|
|
199
254
|
}
|
|
255
|
+
else if (this.showShortcuts && !modifierKeys.includes(eventInfo.key)) {
|
|
256
|
+
this.showShortcuts = false;
|
|
257
|
+
}
|
|
200
258
|
}
|
|
201
259
|
renderShortcuts() {
|
|
202
|
-
return getShortcuts(
|
|
260
|
+
return getShortcuts(this.src)
|
|
261
|
+
.filter(shortcut => shortcut.element)
|
|
262
|
+
.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))));
|
|
263
|
+
}
|
|
264
|
+
renderKeyShortcuts(keyShortcuts) {
|
|
265
|
+
return keyShortcuts.split(/(?<!(?:[+]|^))([+\s])/).map((key, i, items) => {
|
|
266
|
+
var _a;
|
|
267
|
+
if (key === "+" && i > 0 && items[i - 1] !== "+") {
|
|
268
|
+
return h("span", { part: "plus" }, "+");
|
|
269
|
+
}
|
|
270
|
+
else if (key === " " && i > 0 && items[i - 1] !== "+") {
|
|
271
|
+
return h("span", { part: "slash" }, "/");
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
return h("kbd", { part: `key` }, (_a = KEY_SYMBOL[key]) !== null && _a !== void 0 ? _a : key);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
203
277
|
}
|
|
204
278
|
render() {
|
|
205
279
|
return h(Host, null, this.showShortcuts && this.renderShortcuts());
|
|
206
280
|
}
|
|
207
281
|
get el() { return this; }
|
|
282
|
+
static get watchers() { return {
|
|
283
|
+
"suspend": ["suspendHandler"]
|
|
284
|
+
}; }
|
|
208
285
|
static get style() { return chShortcutsCss; }
|
|
209
286
|
}, [1, "ch-shortcuts", {
|
|
210
287
|
"src": [1],
|
|
211
288
|
"showKey": [1, "show-key"],
|
|
289
|
+
"suspend": [4],
|
|
212
290
|
"showShortcuts": [32]
|
|
213
291
|
}, [[10, "keydown", "windowKeyDownHandler"]]]);
|
|
214
292
|
function defineCustomElement() {
|
|
@@ -53,10 +53,6 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
53
|
* The presence of this attribute displays a tooltip message, instead of a block message below the control
|
|
54
54
|
*/
|
|
55
55
|
this.toolTip = false;
|
|
56
|
-
/**
|
|
57
|
-
* If true, it will prevent Enter key propagation only when the list is open. This prop. was created to prevent issues with ch-shortcuts, when an Enter key has to fire a callback on another element (such as a button) but it has to be ignored when the list is open, since an Enter key on a list-box-item, has to select the item only.
|
|
58
|
-
*/
|
|
59
|
-
this.preventEnterPropagation = false;
|
|
60
56
|
/**
|
|
61
57
|
* The presence of this attribute makes the input disabled
|
|
62
58
|
*/
|
|
@@ -176,9 +172,6 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
176
172
|
repositionScroll(this.itemsContainer, this.selectedItem, KeyboardKeys.ARROW_UP);
|
|
177
173
|
}
|
|
178
174
|
else if (e.code === KeyboardKeys.ENTER) {
|
|
179
|
-
if (this.preventEnterPropagation && this.listIsOpen) {
|
|
180
|
-
e.stopPropagation();
|
|
181
|
-
}
|
|
182
175
|
this.hideList();
|
|
183
176
|
this.showAllItems();
|
|
184
177
|
}
|
|
@@ -616,6 +609,7 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
616
609
|
render() {
|
|
617
610
|
const clearIcon = this.value && !this.disableFilter && !this.disableClear;
|
|
618
611
|
return (h(Host, { class: {
|
|
612
|
+
"list-is-opem": this.listIsOpen,
|
|
619
613
|
"gxg-combo-box--disabled": this.disableFilter,
|
|
620
614
|
tooltip: this.toolTip,
|
|
621
615
|
large: state.large,
|
|
@@ -643,7 +637,6 @@ const GxgComboBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
643
637
|
}, [17, "gxg-combo-box", {
|
|
644
638
|
"popOver": [4, "pop-over"],
|
|
645
639
|
"toolTip": [4, "tool-tip"],
|
|
646
|
-
"preventEnterPropagation": [4, "prevent-enter-propagation"],
|
|
647
640
|
"fixedIcon": [1, "fixed-icon"],
|
|
648
641
|
"disabled": [4],
|
|
649
642
|
"label": [1],
|
|
@@ -43,7 +43,7 @@ const ChDropDownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
43
43
|
this.checkItems = () => {
|
|
44
44
|
this.hasItems = !!this.el.querySelector(`:scope>${DROPDOWN_ITEM}`);
|
|
45
45
|
};
|
|
46
|
-
this.noItemsRender = () => this.href ? (h("a", { class: "action", part: "action
|
|
46
|
+
this.noItemsRender = () => this.href ? (h("a", { class: "action", part: "action link", 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
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
49
|
this.actionClick.emit(this.el.id);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const URL_REGEX = /url\((["']?)([^\)]*)\)(?:\s+([\d.]+)x)?/i;
|
|
2
|
+
let computedStyle;
|
|
3
|
+
function normalizeUri(uri) {
|
|
4
|
+
if (uri.startsWith("data:image/svg+xml;utf8,")) {
|
|
5
|
+
uri = `data:image/svg+xml;base64,${btoa(uri.slice(24).replace(/\\"/g, '"'))}`;
|
|
6
|
+
}
|
|
7
|
+
uri = uri.replace(/\\/g, "");
|
|
8
|
+
uri = uri.replace(/\s/g, "%20");
|
|
9
|
+
return uri;
|
|
10
|
+
}
|
|
11
|
+
function getImage(name, gxImageConstructor) {
|
|
12
|
+
if (!computedStyle) {
|
|
13
|
+
computedStyle = getComputedStyle(document.documentElement);
|
|
14
|
+
}
|
|
15
|
+
let value = computedStyle.getPropertyValue(`--gx-image_${name}`);
|
|
16
|
+
if (value) {
|
|
17
|
+
let matches;
|
|
18
|
+
const gximage = gxImageConstructor(name);
|
|
19
|
+
while ((matches = value.match(URL_REGEX))) {
|
|
20
|
+
gximage.densitySet.push({
|
|
21
|
+
uri: normalizeUri(matches[1] ? matches[2].slice(0, -1) : matches[2]),
|
|
22
|
+
density: matches[3] ? parseFloat(matches[3]) : 1
|
|
23
|
+
});
|
|
24
|
+
value = value.slice(matches[0].length);
|
|
25
|
+
}
|
|
26
|
+
if (gximage.densitySet.length > 0) {
|
|
27
|
+
gximage.uri = gximage.densitySet.reduce((previousValue, currentValue) => {
|
|
28
|
+
return previousValue.density === 1 ||
|
|
29
|
+
previousValue.density < currentValue.density
|
|
30
|
+
? previousValue
|
|
31
|
+
: currentValue;
|
|
32
|
+
}).uri;
|
|
33
|
+
}
|
|
34
|
+
return gximage;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const fromGxImageToURL = (gxImage, Settings, gxImageConstructor) => {
|
|
38
|
+
if (!gxImage) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let url = "";
|
|
42
|
+
if (gxImage.id) {
|
|
43
|
+
url = getImage(gxImage.id, gxImageConstructor).uri;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
url = gxImage.uri;
|
|
47
|
+
}
|
|
48
|
+
if (!url) {
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
const baseUrl = Settings.WEBAPP_BASE;
|
|
52
|
+
const urlLower = url.toLowerCase();
|
|
53
|
+
if (urlLower.startsWith("assets/")) {
|
|
54
|
+
// Relative URL to local assets
|
|
55
|
+
return url;
|
|
56
|
+
}
|
|
57
|
+
else if (urlLower.startsWith("http://") ||
|
|
58
|
+
urlLower.startsWith("https://") ||
|
|
59
|
+
urlLower.startsWith("blob:") ||
|
|
60
|
+
urlLower.startsWith("file:") ||
|
|
61
|
+
urlLower.startsWith("data:")) {
|
|
62
|
+
// Absolute URL
|
|
63
|
+
return url;
|
|
64
|
+
}
|
|
65
|
+
else if (urlLower.startsWith(Settings.BASE_PATH.toLowerCase())) {
|
|
66
|
+
// Host relative URL
|
|
67
|
+
return baseUrl + url.substring(Settings.BASE_PATH.length);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return baseUrl + url;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { fromGxImageToURL as f };
|