@genexus/genexus-ide-ui 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ch-action-group_2.cjs.entry.js +211 -0
- package/dist/cjs/ch-dropdown-item.cjs.entry.js +36 -5
- package/dist/cjs/ch-dropdown.cjs.entry.js +50 -52
- package/dist/cjs/ch-test-action-group.cjs.entry.js +79 -0
- package/dist/cjs/ch-test-dropdown.cjs.entry.js +54 -0
- package/dist/cjs/ch-window_2.cjs.entry.js +25 -6
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +13 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/team-dev-commit/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
- package/dist/collection/components/team-dev-commit/team-dev-commit.js +34 -15
- package/dist/components/action-group-item.js +54 -0
- package/dist/components/action-group.js +214 -0
- package/dist/components/ch-action-group-item.js +6 -0
- package/dist/components/ch-action-group.js +6 -0
- package/dist/components/ch-dropdown-item-separator.js +1 -28
- package/dist/components/ch-dropdown-item.js +1 -53
- package/dist/components/ch-dropdown.js +1 -284
- package/dist/components/ch-test-action-group.js +137 -0
- package/dist/components/ch-test-dropdown.js +104 -0
- package/dist/components/ch-window2.js +25 -6
- package/dist/components/dropdown-item-separator.js +30 -0
- package/dist/components/dropdown-item.js +109 -0
- package/dist/components/dropdown.js +294 -0
- package/dist/components/gx-ide-team-dev-commit.js +14 -13
- package/dist/components/index.js +4 -0
- package/dist/esm/ch-action-group_2.entry.js +206 -0
- package/dist/esm/ch-dropdown-item.entry.js +36 -5
- package/dist/esm/ch-dropdown.entry.js +50 -52
- package/dist/esm/ch-test-action-group.entry.js +75 -0
- package/dist/esm/ch-test-dropdown.entry.js +50 -0
- package/dist/esm/ch-window_2.entry.js +25 -6
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-team-dev-commit.entry.js +13 -13
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
- package/dist/genexus-ide-ui/p-097a3eeb.entry.js +1 -0
- package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +1 -0
- package/dist/genexus-ide-ui/p-5c64c57f.entry.js +1 -0
- package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +1 -0
- package/dist/genexus-ide-ui/p-9c82381c.entry.js +1 -0
- package/dist/genexus-ide-ui/p-dbebb1a0.entry.js +1 -0
- package/dist/genexus-ide-ui/p-f8561da6.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group/action-group.css +48 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +4 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +32 -88
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +9 -22
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-action-group/test-action-group.css +52 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-dropdown/test-dropdown.css +36 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +3 -1
- package/dist/types/common/types.d.ts +1 -0
- package/dist/types/components/team-dev-commit/team-dev-commit.d.ts +13 -6
- package/dist/types/components/team-dev-update/team-dev-update.d.ts +1 -1
- package/dist/types/components.d.ts +9 -1
- package/package.json +3 -3
- package/dist/genexus-ide-ui/p-04f094d1.entry.js +0 -1
- package/dist/genexus-ide-ui/p-192f1342.entry.js +0 -1
- package/dist/genexus-ide-ui/p-66072dce.entry.js +0 -1
- package/dist/genexus-ide-ui/p-c10d5f34.entry.js +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$7 } from './action-group.js';
|
|
3
|
+
import { d as defineCustomElement$6 } from './action-group-item.js';
|
|
4
|
+
import { d as defineCustomElement$5 } from './dropdown.js';
|
|
5
|
+
import { d as defineCustomElement$4 } from './dropdown-item.js';
|
|
6
|
+
import { d as defineCustomElement$3 } from './ch-window2.js';
|
|
7
|
+
import { d as defineCustomElement$2 } from './ch-window-close2.js';
|
|
8
|
+
|
|
9
|
+
const testActionGroupCss = "ch-test-action-group{display:flex;border:2px dashed #00000080;resize:both;overflow:auto;width:500px}.action-group{padding:20px;margin:20px;background-color:#ffffff;border:1px solid}.action-group::part(actions){gap:12px}.action-group::part(more-actions-button){border-radius:50%;width:fit-content;height:fit-content;color:#313aa1;align-self:center;margin-inline-end:8px}.dropdown-item::part(action){--separation:8px;background-color:#f3d0c3;border-radius:4px;padding-inline:16px;padding-block:8px}.dropdown-item::part(action):focus-within{outline:1px solid}.dropdown-item::part(action):hover{background-color:#d3b1a4}.action-group::part(more-actions-list),.dropdown-item::part(list){row-gap:8px;margin-block:8px}.action-group::part(more-actions-section),.dropdown-item::part(section){background-color:#edeaff;padding:8px;box-shadow:0 4px 8px 1px #22222220}";
|
|
10
|
+
|
|
11
|
+
const ChTestActionGroup$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
this.displayedItemsCount = -1;
|
|
16
|
+
/**
|
|
17
|
+
* This attribute lets you specify the label for the expandable button.
|
|
18
|
+
* Important for accessibility.
|
|
19
|
+
*/
|
|
20
|
+
this.buttonLabel = "Show options";
|
|
21
|
+
/**
|
|
22
|
+
* Determine which actions on the expandable button display the dropdown
|
|
23
|
+
* section.
|
|
24
|
+
*/
|
|
25
|
+
this.expandBehavior = "ClickOrHover";
|
|
26
|
+
/**
|
|
27
|
+
* This attribute determines how items behave when the content of the ActionGroup overflows horizontal. This property is needed
|
|
28
|
+
* to make the control responsive to changes in the Width of the container of ActionGroup.
|
|
29
|
+
*
|
|
30
|
+
* | Value | Details |
|
|
31
|
+
* | --------------------- | ------------------------------------------------------------------------------------------------ |
|
|
32
|
+
* | `Add Scroll` | The items of the ActionGroup that overflow horizontally are shown by means of a scroll. |
|
|
33
|
+
* | `Multiline` | The ActionGroup items that overflow horizontally are shown in a second line of the control. |
|
|
34
|
+
* | `Responsive Collapse` | The Action Group items, when they start to overflow the control, are placed in the More Actions. |
|
|
35
|
+
*/
|
|
36
|
+
this.itemsOverflowBehavior = "ResponsiveCollapse";
|
|
37
|
+
/**
|
|
38
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
39
|
+
* button of the control is focused.
|
|
40
|
+
*/
|
|
41
|
+
this.openOnFocus = false;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
44
|
+
* the more actions button.
|
|
45
|
+
*/
|
|
46
|
+
this.moreActionsDropdownPosition = "InsideStart_OutsideEnd";
|
|
47
|
+
/**
|
|
48
|
+
* Specifies the separation (in pixels) between the expandable button and the
|
|
49
|
+
* dropdown section of the control.
|
|
50
|
+
*/
|
|
51
|
+
this.separation = 0;
|
|
52
|
+
// /**
|
|
53
|
+
// * Fired when the visibility of the dropdown section is changed
|
|
54
|
+
// */
|
|
55
|
+
// @Event() expandedChange: EventEmitter<boolean>;
|
|
56
|
+
this.renderItem = (item) => (h("ch-dropdown-item", { slot: "items", id: item.id, class: item.class, expandBehavior: this.expandBehavior, href: item.target, leftImgSrc: item.leftIcon, openOnFocus: this.openOnFocus, position: item.position || "OutsideEnd_InsideStart", rightImgSrc: item.rightIcon }, item.title, item.items != null && item.items.map(this.renderItem)));
|
|
57
|
+
this.firstLevelRenderItem = (item, index) => (h("ch-dropdown-item", { id: item.id, class: item.class, expandBehavior: this.expandBehavior, forceContainingBlock: false, href: item.target, leftImgSrc: item.leftIcon, openOnFocus: this.openOnFocus, position: item.position || "Center_OutsideEnd", rightImgSrc: item.rightIcon }, item.title, this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
58
|
+
(this.displayedItemsCount === -1 || index < this.displayedItemsCount) &&
|
|
59
|
+
item.items != null &&
|
|
60
|
+
item.items.map(this.renderItem)));
|
|
61
|
+
this.firstLevelRenderCollapsedItem = (item) => (h("ch-dropdown-item", { id: item.id, class: item.class, expandBehavior: this.expandBehavior, href: item.target, leftImgSrc: item.leftIcon, openOnFocus: this.openOnFocus, position: item.responsiveCollapsePosition || "OutsideEnd_InsideStart", rightImgSrc: item.rightIcon }, item.title, item.items != null && item.items.map(this.renderItem)));
|
|
62
|
+
this.handleDisplayedItemsCountChange = (event) => {
|
|
63
|
+
this.displayedItemsCount = event.detail;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
return (h(Host, null, h("ch-action-group", { buttonLabel: this.buttonLabel, class: "action-group", expandBehavior: this.expandBehavior, itemsOverflowBehavior: this.itemsOverflowBehavior, openOnFocus: this.openOnFocus, moreActionsDropdownPosition: this.moreActionsDropdownPosition,
|
|
68
|
+
// style={{
|
|
69
|
+
// "--separation": `${this.separation}px`
|
|
70
|
+
// }}
|
|
71
|
+
onDisplayedItemsCountChange: this.handleDisplayedItemsCountChange }, this.itemsModel != null &&
|
|
72
|
+
this.itemsModel.map((item, index) => (h("ch-action-group-item", { slot: "items" }, this.firstLevelRenderItem(item, index)))), this.itemsOverflowBehavior === "ResponsiveCollapse" &&
|
|
73
|
+
this.itemsModel != null &&
|
|
74
|
+
this.itemsModel
|
|
75
|
+
.filter((_, index) => this.displayedItemsCount !== -1 &&
|
|
76
|
+
index >= this.displayedItemsCount)
|
|
77
|
+
.map(item => (h("ch-action-group-item", { slot: "more-items", avoidFloating: true }, this.firstLevelRenderCollapsedItem(item)))))));
|
|
78
|
+
}
|
|
79
|
+
static get style() { return testActionGroupCss; }
|
|
80
|
+
}, [0, "ch-test-action-group", {
|
|
81
|
+
"buttonLabel": [1, "button-label"],
|
|
82
|
+
"expandBehavior": [1, "expand-behavior"],
|
|
83
|
+
"itemsModel": [16],
|
|
84
|
+
"itemsOverflowBehavior": [1, "items-overflow-behavior"],
|
|
85
|
+
"openOnFocus": [4, "open-on-focus"],
|
|
86
|
+
"moreActionsDropdownPosition": [1, "more-actions-dropdown-position"],
|
|
87
|
+
"separation": [2],
|
|
88
|
+
"displayedItemsCount": [32]
|
|
89
|
+
}]);
|
|
90
|
+
function defineCustomElement$1() {
|
|
91
|
+
if (typeof customElements === "undefined") {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const components = ["ch-test-action-group", "ch-action-group", "ch-action-group-item", "ch-dropdown", "ch-dropdown-item", "ch-window", "ch-window-close"];
|
|
95
|
+
components.forEach(tagName => { switch (tagName) {
|
|
96
|
+
case "ch-test-action-group":
|
|
97
|
+
if (!customElements.get(tagName)) {
|
|
98
|
+
customElements.define(tagName, ChTestActionGroup$1);
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case "ch-action-group":
|
|
102
|
+
if (!customElements.get(tagName)) {
|
|
103
|
+
defineCustomElement$7();
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case "ch-action-group-item":
|
|
107
|
+
if (!customElements.get(tagName)) {
|
|
108
|
+
defineCustomElement$6();
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case "ch-dropdown":
|
|
112
|
+
if (!customElements.get(tagName)) {
|
|
113
|
+
defineCustomElement$5();
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
case "ch-dropdown-item":
|
|
117
|
+
if (!customElements.get(tagName)) {
|
|
118
|
+
defineCustomElement$4();
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
case "ch-window":
|
|
122
|
+
if (!customElements.get(tagName)) {
|
|
123
|
+
defineCustomElement$3();
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
case "ch-window-close":
|
|
127
|
+
if (!customElements.get(tagName)) {
|
|
128
|
+
defineCustomElement$2();
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
} });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const ChTestActionGroup = ChTestActionGroup$1;
|
|
135
|
+
const defineCustomElement = defineCustomElement$1;
|
|
136
|
+
|
|
137
|
+
export { ChTestActionGroup, defineCustomElement };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$6 } from './dropdown.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './dropdown-item.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './dropdown-item-separator.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 testDropdownCss = ".dropdown::part(expandable-button){background-color:aliceblue;border:1px solid;border-radius:4px;padding-block:4px;padding-inline:16px}.dropdown::part(expandable-button):focus{box-shadow:0 0 0 1px black}.dropdown-item::part(action){--separation:8px;background-color:#f3d0c3;border-radius:4px;padding-inline:16px;padding-block:8px}.dropdown-item::part(action):focus-within{outline:1px solid}.dropdown-item::part(action):hover{background-color:#d3b1a4}.dropdown::part(section),.dropdown-item::part(section){background-color:#edeaff;padding:8px;box-shadow:0 4px 8px 1px #22222220}.dropdown::part(list),.dropdown-item::part(list){row-gap:8px;margin-block:8px}";
|
|
9
|
+
|
|
10
|
+
const ChTestDropdownX = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
/**
|
|
15
|
+
* This attribute lets you specify the label for the expandable button.
|
|
16
|
+
* Important for accessibility.
|
|
17
|
+
*/
|
|
18
|
+
this.buttonLabel = "Show options";
|
|
19
|
+
/**
|
|
20
|
+
* Determine which actions on the expandable button display the dropdown
|
|
21
|
+
* section.
|
|
22
|
+
*/
|
|
23
|
+
this.expandBehavior = "ClickOrHover";
|
|
24
|
+
/**
|
|
25
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
26
|
+
* button of the control is focused.
|
|
27
|
+
*/
|
|
28
|
+
this.openOnFocus = false;
|
|
29
|
+
/**
|
|
30
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
31
|
+
* the expandable button.
|
|
32
|
+
*/
|
|
33
|
+
this.position = "Center_OutsideEnd";
|
|
34
|
+
/**
|
|
35
|
+
* Specifies the separation (in pixels) between the expandable button and the
|
|
36
|
+
* dropdown section of the control.
|
|
37
|
+
*/
|
|
38
|
+
this.separation = 0;
|
|
39
|
+
// /**
|
|
40
|
+
// * Fired when the visibility of the dropdown section is changed
|
|
41
|
+
// */
|
|
42
|
+
// @Event() expandedChange: EventEmitter<boolean>;
|
|
43
|
+
this.renderItem = (item) => [
|
|
44
|
+
h("ch-dropdown-item", { slot: "items", id: item.id, class: item.class, expandBehavior: this.expandBehavior, href: item.target, leftImgSrc: item.leftIcon, openOnFocus: this.openOnFocus, position: "OutsideEnd_InsideStart", rightImgSrc: item.rightIcon }, item.title, item.items != null && item.items.map(this.renderItem)),
|
|
45
|
+
item.showSeparator && (h("ch-dropdown-item-separator", { class: item.separatorClass }))
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
return (h(Host, null, h("ch-dropdown", { buttonLabel: this.buttonLabel, class: "dropdown", expandBehavior: this.expandBehavior, openOnFocus: this.openOnFocus, position: this.position, style: {
|
|
50
|
+
"--separation": `${this.separation}px`
|
|
51
|
+
} }, h("span", { slot: "action" }, "User info"), h("div", { slot: "header" }, h("h1", null, "John Doe"), h("span", null, "johndoe@example.com")), this.itemsModel != null && this.itemsModel.map(this.renderItem), h("div", { slot: "footer" }, "Footer"))));
|
|
52
|
+
}
|
|
53
|
+
static get style() { return testDropdownCss; }
|
|
54
|
+
}, [0, "ch-test-dropdown", {
|
|
55
|
+
"buttonLabel": [1, "button-label"],
|
|
56
|
+
"expandBehavior": [1, "expand-behavior"],
|
|
57
|
+
"itemsModel": [16],
|
|
58
|
+
"openOnFocus": [4, "open-on-focus"],
|
|
59
|
+
"position": [1],
|
|
60
|
+
"separation": [2]
|
|
61
|
+
}]);
|
|
62
|
+
function defineCustomElement$1() {
|
|
63
|
+
if (typeof customElements === "undefined") {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const components = ["ch-test-dropdown", "ch-dropdown", "ch-dropdown-item", "ch-dropdown-item-separator", "ch-window", "ch-window-close"];
|
|
67
|
+
components.forEach(tagName => { switch (tagName) {
|
|
68
|
+
case "ch-test-dropdown":
|
|
69
|
+
if (!customElements.get(tagName)) {
|
|
70
|
+
customElements.define(tagName, ChTestDropdownX);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case "ch-dropdown":
|
|
74
|
+
if (!customElements.get(tagName)) {
|
|
75
|
+
defineCustomElement$6();
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
case "ch-dropdown-item":
|
|
79
|
+
if (!customElements.get(tagName)) {
|
|
80
|
+
defineCustomElement$5();
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
case "ch-dropdown-item-separator":
|
|
84
|
+
if (!customElements.get(tagName)) {
|
|
85
|
+
defineCustomElement$4();
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case "ch-window":
|
|
89
|
+
if (!customElements.get(tagName)) {
|
|
90
|
+
defineCustomElement$3();
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case "ch-window-close":
|
|
94
|
+
if (!customElements.get(tagName)) {
|
|
95
|
+
defineCustomElement$2();
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
} });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const ChTestDropdown = ChTestDropdownX;
|
|
102
|
+
const defineCustomElement = defineCustomElement$1;
|
|
103
|
+
|
|
104
|
+
export { ChTestDropdown, defineCustomElement };
|
|
@@ -2,8 +2,9 @@ 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}: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;inset-inline-start:calc( var(--ch-window-inset-inline-start) + var(--ch-window-offset-x) );inset-block-start:calc( var(--ch-window-inset-block-start) + var(--ch-window-offset-y) );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
|
|
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;inset-inline-start:calc( var(--ch-window-inset-inline-start) + var(--ch-window-offset-x) );inset-block-start:calc( var(--ch-window-inset-block-start) + var(--ch-window-offset-y) );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))}: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%}";
|
|
6
6
|
|
|
7
|
+
const CONTAINING_BLOCK_RESET_CUSTOM_VAR = "--ch-window-relative-position";
|
|
7
8
|
const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
9
|
constructor() {
|
|
9
10
|
super();
|
|
@@ -12,6 +13,7 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
12
13
|
this.windowOpened = createEvent(this, "windowOpened", 7);
|
|
13
14
|
this.windowClosed = createEvent(this, "windowClosed", 7);
|
|
14
15
|
this.isContainerCssOverride = false;
|
|
16
|
+
this.relativeWindow = false;
|
|
15
17
|
this.validCssAligns = [
|
|
16
18
|
"outside-start",
|
|
17
19
|
"inside-start",
|
|
@@ -59,17 +61,25 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
59
61
|
this.updatePosition = () => {
|
|
60
62
|
if (!this.isContainerCssOverride && this.container && this.mask) {
|
|
61
63
|
const rect = this.container.getBoundingClientRect();
|
|
64
|
+
this.mask.style.width = `${rect.width}px`;
|
|
65
|
+
this.mask.style.height = `${rect.height}px`;
|
|
66
|
+
// Nested windows are positioned relative to its initial containing block,
|
|
67
|
+
// so there is no need to align them relative to the document
|
|
68
|
+
if (this.relativeWindow) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
62
71
|
// TODO: RTL positioning bug
|
|
63
72
|
this.mask.style.setProperty("--ch-window-inset-inline-start", `${rect.left}px`);
|
|
64
73
|
this.mask.style.setProperty("--ch-window-inset-block-start", `${rect.top}px`);
|
|
65
|
-
this.mask.style.width = `${rect.width}px`;
|
|
66
|
-
this.mask.style.height = `${rect.height}px`;
|
|
67
74
|
}
|
|
68
75
|
else if (this.isContainerCssOverride || !this.container) {
|
|
69
|
-
this.mask.style.removeProperty("--ch-window-inset-inline-start");
|
|
70
|
-
this.mask.style.removeProperty("--ch-window-inset-block-start");
|
|
71
76
|
this.mask.style.removeProperty("width");
|
|
72
77
|
this.mask.style.removeProperty("height");
|
|
78
|
+
if (this.relativeWindow) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.mask.style.removeProperty("--ch-window-inset-inline-start");
|
|
82
|
+
this.mask.style.removeProperty("--ch-window-inset-block-start");
|
|
73
83
|
}
|
|
74
84
|
};
|
|
75
85
|
this.windowResizeHandler = () => {
|
|
@@ -91,6 +101,7 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
91
101
|
};
|
|
92
102
|
}
|
|
93
103
|
containerHandler(value, oldValue) {
|
|
104
|
+
this.checkRelativePosition();
|
|
94
105
|
this.containerResizeObserverHandler(value, oldValue);
|
|
95
106
|
this.updatePosition();
|
|
96
107
|
}
|
|
@@ -101,6 +112,7 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
101
112
|
this.windowClosed.emit();
|
|
102
113
|
}
|
|
103
114
|
else {
|
|
115
|
+
this.checkRelativePosition();
|
|
104
116
|
this.updatePosition();
|
|
105
117
|
this.watchCSSAlign();
|
|
106
118
|
this.addListeners();
|
|
@@ -128,6 +140,10 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
140
|
windowCloseClickedHandler() {
|
|
129
141
|
this.hidden = true;
|
|
130
142
|
}
|
|
143
|
+
checkRelativePosition() {
|
|
144
|
+
const computed = getComputedStyle(this.el);
|
|
145
|
+
this.relativeWindow = !!computed.getPropertyValue(CONTAINING_BLOCK_RESET_CUSTOM_VAR);
|
|
146
|
+
}
|
|
131
147
|
resetDrag() {
|
|
132
148
|
this.dragStartX = undefined;
|
|
133
149
|
this.dragStartY = undefined;
|
|
@@ -203,7 +219,10 @@ const ChWindow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
203
219
|
this.el.shadowRoot.adoptedStyleSheets.push(CH_GLOBAL_STYLESHEET);
|
|
204
220
|
}
|
|
205
221
|
render() {
|
|
206
|
-
return (h(Host, null, h("div", { class: "mask", part: "mask",
|
|
222
|
+
return (h(Host, null, h("div", { class: "mask", part: "mask", style: this.relativeWindow && {
|
|
223
|
+
"--ch-window-inset-inline-start": "0px",
|
|
224
|
+
"--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" })))))));
|
|
207
226
|
}
|
|
208
227
|
get el() { return this; }
|
|
209
228
|
static get watchers() { return {
|
|
@@ -0,0 +1,30 @@
|
|
|
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() {
|
|
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
|
+
}
|
|
29
|
+
|
|
30
|
+
export { ChDropDownItemSeparator as C, defineCustomElement as d };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$3 } from './dropdown.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './ch-window2.js';
|
|
4
|
+
import { d as defineCustomElement$1 } from './ch-window-close2.js';
|
|
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%}.dummy-wrapper{display:contents}";
|
|
7
|
+
|
|
8
|
+
const DROPDOWN_ITEM = "ch-dropdown-item";
|
|
9
|
+
const ChDropDownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.actionClick = createEvent(this, "actionClick", 7);
|
|
15
|
+
this.focusChange = createEvent(this, "focusChange", 7);
|
|
16
|
+
this.hasItems = false;
|
|
17
|
+
/**
|
|
18
|
+
* Determine which actions on the expandable button display the dropdown
|
|
19
|
+
* section.
|
|
20
|
+
* Only works if the control has subitems.
|
|
21
|
+
*/
|
|
22
|
+
this.expandBehavior = "ClickOrHover";
|
|
23
|
+
/**
|
|
24
|
+
* `true` to force the control to make its own containing block.
|
|
25
|
+
*/
|
|
26
|
+
this.forceContainingBlock = true;
|
|
27
|
+
/**
|
|
28
|
+
* Determine if the dropdown section should be opened when the expandable
|
|
29
|
+
* button of the control is focused.
|
|
30
|
+
* Only works if the control has subitems.
|
|
31
|
+
*/
|
|
32
|
+
this.openOnFocus = false;
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the position of the dropdown section that is placed relative to
|
|
35
|
+
* the expandable button.
|
|
36
|
+
*/
|
|
37
|
+
this.position = "Center_OutsideEnd";
|
|
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" }))
|
|
42
|
+
];
|
|
43
|
+
this.checkItems = () => {
|
|
44
|
+
this.hasItems = !!this.element.querySelector(`:scope>${DROPDOWN_ITEM}`);
|
|
45
|
+
};
|
|
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 }, h("div", { class: "dummy-wrapper", slot: "action" }, this.dropDownItemContent()), h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
|
|
48
|
+
this.handleActionClick = () => {
|
|
49
|
+
this.actionClick.emit(this.element.id);
|
|
50
|
+
};
|
|
51
|
+
this.handleFocus = () => {
|
|
52
|
+
this.focusChange.emit();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Focuses the control's anchor or button.
|
|
57
|
+
*/
|
|
58
|
+
async handleFocusElement() {
|
|
59
|
+
this.mainElement.focus();
|
|
60
|
+
}
|
|
61
|
+
componentWillLoad() {
|
|
62
|
+
this.checkItems();
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
return (h(Host, { role: "listitem" }, this.hasItems ? this.itemsRender() : this.noItemsRender()));
|
|
66
|
+
}
|
|
67
|
+
get element() { return this; }
|
|
68
|
+
static get style() { return dropdownItemCss; }
|
|
69
|
+
}, [1, "ch-dropdown-item", {
|
|
70
|
+
"expandBehavior": [1, "expand-behavior"],
|
|
71
|
+
"forceContainingBlock": [516, "force-containing-block"],
|
|
72
|
+
"href": [1],
|
|
73
|
+
"leftImgSrc": [1, "left-img-src"],
|
|
74
|
+
"openOnFocus": [4, "open-on-focus"],
|
|
75
|
+
"position": [1],
|
|
76
|
+
"rightImgSrc": [1, "right-img-src"],
|
|
77
|
+
"hasItems": [32],
|
|
78
|
+
"handleFocusElement": [64]
|
|
79
|
+
}]);
|
|
80
|
+
function defineCustomElement() {
|
|
81
|
+
if (typeof customElements === "undefined") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const components = ["ch-dropdown-item", "ch-dropdown", "ch-window", "ch-window-close"];
|
|
85
|
+
components.forEach(tagName => { switch (tagName) {
|
|
86
|
+
case "ch-dropdown-item":
|
|
87
|
+
if (!customElements.get(tagName)) {
|
|
88
|
+
customElements.define(tagName, ChDropDownItem);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
case "ch-dropdown":
|
|
92
|
+
if (!customElements.get(tagName)) {
|
|
93
|
+
defineCustomElement$3();
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case "ch-window":
|
|
97
|
+
if (!customElements.get(tagName)) {
|
|
98
|
+
defineCustomElement$2();
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case "ch-window-close":
|
|
102
|
+
if (!customElements.get(tagName)) {
|
|
103
|
+
defineCustomElement$1();
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
} });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { ChDropDownItem as C, defineCustomElement as d };
|