@nuralyui/menu 0.0.9 → 0.0.15
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/bundle.js +1305 -0
- package/index.d.ts +2 -0
- package/index.js.map +1 -1
- package/menu.component.d.ts +48 -13
- package/menu.component.js +256 -73
- package/menu.component.js.map +1 -1
- package/menu.style.js +316 -79
- package/menu.style.js.map +1 -1
- package/menu.types.d.ts +41 -1
- package/menu.types.js +6 -1
- package/menu.types.js.map +1 -1
- package/package.json +40 -5
- package/react.d.ts +4 -2
- package/react.js +7 -5
- package/react.js.map +1 -1
- package/demo/menus-demo.d.ts +0 -22
- package/demo/menus-demo.d.ts.map +0 -1
- package/demo/menus-demo.js +0 -157
- package/demo/menus-demo.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/menu.component.d.ts.map +0 -1
- package/menu.constants.d.ts.map +0 -1
- package/menu.style.d.ts.map +0 -1
- package/menu.types.d.ts.map +0 -1
- package/react.d.ts.map +0 -1
- package/templates/hy-menu-link.d.ts +0 -29
- package/templates/hy-menu-link.d.ts.map +0 -1
- package/templates/hy-menu-link.js +0 -122
- package/templates/hy-menu-link.js.map +0 -1
- package/templates/hy-sub-menu.d.ts +0 -32
- package/templates/hy-sub-menu.d.ts.map +0 -1
- package/templates/hy-sub-menu.js +0 -121
- package/templates/hy-sub-menu.js.map +0 -1
- package/templates/menu-link.contants.d.ts +0 -5
- package/templates/menu-link.contants.d.ts.map +0 -1
- package/templates/menu-link.contants.js +0 -6
- package/templates/menu-link.contants.js.map +0 -1
- package/templates/menu-link.style.d.ts +0 -2
- package/templates/menu-link.style.d.ts.map +0 -1
- package/templates/menu-link.style.js +0 -98
- package/templates/menu-link.style.js.map +0 -1
- package/templates/sub-menu.style.d.ts +0 -2
- package/templates/sub-menu.style.d.ts.map +0 -1
- package/templates/sub-menu.style.js +0 -88
- package/templates/sub-menu.style.js.map +0 -1
- package/test/menu-link_test.d.ts +0 -2
- package/test/menu-link_test.d.ts.map +0 -1
- package/test/menu-link_test.js +0 -85
- package/test/menu-link_test.js.map +0 -1
- package/test/menu_test.d.ts +0 -2
- package/test/menu_test.d.ts.map +0 -1
- package/test/menu_test.js +0 -81
- package/test/menu_test.js.map +0 -1
- package/test/sub-menu_test.d.ts +0 -2
- package/test/sub-menu_test.d.ts.map +0 -1
- package/test/sub-menu_test.js +0 -72
- package/test/sub-menu_test.js.map +0 -1
package/demo/menus-demo.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright 2023 Google Laabidi Aymen
|
|
6
|
-
* SPDX-License-Identifier: MIT
|
|
7
|
-
*/
|
|
8
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
9
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
-
};
|
|
14
|
-
import { LitElement, html } from 'lit';
|
|
15
|
-
import { customElement, state } from 'lit/decorators.js';
|
|
16
|
-
import '../menu.component';
|
|
17
|
-
let ElMeenuElement = class ElMeenuElement extends LitElement {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.items = [
|
|
21
|
-
{
|
|
22
|
-
text: 'First Menu',
|
|
23
|
-
selected: true,
|
|
24
|
-
children: [
|
|
25
|
-
{
|
|
26
|
-
text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' },
|
|
30
|
-
children: [
|
|
31
|
-
{
|
|
32
|
-
text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'circle-exclamation', label: 'error' }
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' },
|
|
36
|
-
children: [
|
|
37
|
-
{
|
|
38
|
-
text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'circle-exclamation', label: 'error' }
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' }
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
disabled: false,
|
|
49
|
-
icon: 'bug',
|
|
50
|
-
menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] },
|
|
51
|
-
status: { icon: 'warning', label: 'warning' }
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
text: 'Second Menu',
|
|
55
|
-
children: [
|
|
56
|
-
{ text: 'Submenu 2-1', link: 'Submenu 2-1 link', icon: 'cloud', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] } },
|
|
57
|
-
{ text: 'Submenu 2-2', link: 'Submenu 2-2 link', icon: 'wifi', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] } },
|
|
58
|
-
],
|
|
59
|
-
link: '',
|
|
60
|
-
menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
this.items2 = [
|
|
64
|
-
{
|
|
65
|
-
text: 'First Menu',
|
|
66
|
-
disabled: false,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
text: 'First Menu',
|
|
70
|
-
children: [
|
|
71
|
-
{ text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right' },
|
|
72
|
-
{
|
|
73
|
-
text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', children: [
|
|
74
|
-
{ text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right' },
|
|
75
|
-
{ text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree' },
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
disabled: false,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
text: 'Second Menu',
|
|
83
|
-
children: [
|
|
84
|
-
{ text: 'Submenu 2-1', link: 'Submenu 2-1 link', icon: 'cloud' },
|
|
85
|
-
{ text: 'Submenu 2-2', link: 'Submenu 2-2 link', icon: 'wifi' },
|
|
86
|
-
],
|
|
87
|
-
link: '',
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
this.items3 = [
|
|
91
|
-
{
|
|
92
|
-
text: 'Submenu 0-0', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
text: 'Submenu 0-1', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right',
|
|
96
|
-
}, {
|
|
97
|
-
text: 'Submenu 0-2', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right',
|
|
98
|
-
},
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
render() {
|
|
102
|
-
var _a;
|
|
103
|
-
return html `
|
|
104
|
-
<h3>Treeview</h3>
|
|
105
|
-
<hy-menu
|
|
106
|
-
.items=${this.items}
|
|
107
|
-
@action-click=${(e) => {
|
|
108
|
-
console.log('action name', e.detail.value);
|
|
109
|
-
console.log('option path', e.detail.path);
|
|
110
|
-
}}
|
|
111
|
-
@change=${(e) => {
|
|
112
|
-
this.path = e.detail.path;
|
|
113
|
-
this.value = e.detail.value;
|
|
114
|
-
}}
|
|
115
|
-
></hy-menu>
|
|
116
|
-
path: ${(_a = this.path) === null || _a === void 0 ? void 0 : _a.join('-')} value: ${this.value}
|
|
117
|
-
|
|
118
|
-
<h3>Treeview</h3>
|
|
119
|
-
<hy-menu
|
|
120
|
-
.items=${this.items}
|
|
121
|
-
@change=${(e) => {
|
|
122
|
-
this.path = e.detail.path;
|
|
123
|
-
this.value = e.detail.value;
|
|
124
|
-
}}
|
|
125
|
-
></hy-menu>
|
|
126
|
-
|
|
127
|
-
<h3>Treeview</h3>
|
|
128
|
-
<hy-menu
|
|
129
|
-
.items=${this.items2}
|
|
130
|
-
@change=${(e) => {
|
|
131
|
-
this.path = e.detail.path;
|
|
132
|
-
this.value = e.detail.value;
|
|
133
|
-
}}
|
|
134
|
-
></hy-menu>
|
|
135
|
-
|
|
136
|
-
<h3>Treeview</h3>
|
|
137
|
-
<hy-menu
|
|
138
|
-
.items=${this.items3}
|
|
139
|
-
@change=${(e) => {
|
|
140
|
-
this.path = e.detail.path;
|
|
141
|
-
this.value = e.detail.value;
|
|
142
|
-
}}
|
|
143
|
-
></hy-menu>
|
|
144
|
-
`;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
__decorate([
|
|
148
|
-
state()
|
|
149
|
-
], ElMeenuElement.prototype, "path", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
state()
|
|
152
|
-
], ElMeenuElement.prototype, "value", void 0);
|
|
153
|
-
ElMeenuElement = __decorate([
|
|
154
|
-
customElement('hy-menu-demo')
|
|
155
|
-
], ElMeenuElement);
|
|
156
|
-
export { ElMeenuElement };
|
|
157
|
-
//# sourceMappingURL=menus-demo.js.map
|
package/demo/menus-demo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menus-demo.js","sourceRoot":"","sources":["../../../../src/components/menu/demo/menus-demo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,uDAAuD;AACvD;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,mBAAmB,CAAC;AAI3B,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAKE,UAAK,GAAY;YACf;gBACE,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EA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I,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9B,CAAC;;;;;iBAKU,IAAI,CAAC,MAAM;kBACV,CAAC,CAAc,EAAE,EAAE;YAC7B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9B,CAAC;;;;;iBAKU,IAAI,CAAC,MAAM;kBACV,CAAC,CAAc,EAAE,EAAE;YAC7B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9B,CAAC;;KAEF,CAAC;IACJ,CAAC;CACF,CAAA;AAzIC;IADC,KAAK,EAAE;4CACQ;AAEhB;IADC,KAAK,EAAE;6CACO;AAJJ,cAAc;IAD1B,aAAa,CAAC,cAAc,CAAC;GACjB,cAAc,CA2I1B;SA3IY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport '../menu.component';\nimport { IMenu } from '../menu.types';\n\n@customElement('hy-menu-demo')\nexport class ElMeenuElement extends LitElement {\n @state()\n path!: number[];\n @state()\n value!: string;\n items: IMenu[] = [\n {\n text: 'First Menu',\n selected: true,\n children: [\n {\n text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' }\n },\n {\n text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' }\n , children: [\n {\n text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'circle-exclamation', label: 'error' }\n },\n {\n text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' }\n , children: [\n {\n text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'circle-exclamation', label: 'error' }\n },\n {\n text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }, status: { icon: 'warning', label: 'warning' }\n },\n ],\n },\n ]\n },\n ],\n disabled: false,\n icon: 'bug',\n menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] },\n status: { icon: 'warning', label: 'warning' }\n },\n {\n text: 'Second Menu',\n children: [\n { text: 'Submenu 2-1', link: 'Submenu 2-1 link', icon: 'cloud', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] } },\n { text: 'Submenu 2-2', link: 'Submenu 2-2 link', icon: 'wifi', menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] } },\n\n ],\n link: '',\n menu: { icon: 'bars', actions: [{ label: 'Delete', value: 'delete' }, { label: 'Rename', value: 'rename' }] }\n },\n ];\n\n items2: IMenu[] = [\n {\n text: 'First Menu',\n disabled: false,\n },\n {\n text: 'First Menu',\n children: [\n { text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right' },\n {\n text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree', children: [\n { text: 'Submenu 1-1', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right' },\n { text: 'Submenu 1-2', link: 'Submenu 1-2 link', icon: 'tree' },\n ],\n },\n\n ],\n disabled: false,\n },\n {\n text: 'Second Menu',\n children: [\n { text: 'Submenu 2-1', link: 'Submenu 2-1 link', icon: 'cloud' },\n { text: 'Submenu 2-2', link: 'Submenu 2-2 link', icon: 'wifi' },\n\n ],\n link: '',\n },\n ];\n\n items3: IMenu[] = [\n {\n text: 'Submenu 0-0', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right',\n\n },\n {\n text: 'Submenu 0-1', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right',\n\n }, {\n text: 'Submenu 0-2', link: 'Submenu 1-1 link', icon: 'globe', iconPosition: 'right',\n\n },\n\n ];\n\n protected override render() {\n return html`\n <h3>Treeview</h3>\n <hy-menu\n .items=${this.items}\n @action-click=${(e: CustomEvent) => {\n console.log('action name', e.detail.value)\n console.log('option path', e.detail.path)\n }}\n @change=${(e: CustomEvent) => {\n this.path = e.detail.path;\n this.value = e.detail.value;\n }}\n ></hy-menu>\n path: ${this.path?.join('-')} value: ${this.value}\n\n <h3>Treeview</h3>\n <hy-menu\n .items=${this.items}\n @change=${(e: CustomEvent) => {\n this.path = e.detail.path;\n this.value = e.detail.value;\n }}\n ></hy-menu>\n\n <h3>Treeview</h3>\n <hy-menu\n .items=${this.items2}\n @change=${(e: CustomEvent) => {\n this.path = e.detail.path;\n this.value = e.detail.value;\n }}\n ></hy-menu>\n\n <h3>Treeview</h3>\n <hy-menu\n .items=${this.items3}\n @change=${(e: CustomEvent) => {\n this.path = e.detail.path;\n this.value = e.detail.value;\n }}\n ></hy-menu>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-menu-demo': ElMeenuElement;\n }\n}\n"]}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
package/menu.component.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu.component.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAGrC,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,6BAA6B,CAAC;AACrC,OAAO,4BAA4B,CAAC;AACpC,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAO,CAAC,oBAAoB,CAAU;IAEtC,UAAU,EAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAGrC,UAAU,EAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAGrC,KAAK,EAAG,KAAK,EAAE,CAAC;IAEP,YAAY,IAAI,IAAI;IAI7B,oBAAoB;IAKpB,mBAAmB,CAAC,uBAAuB,EAAE,WAAW;IAoBxD,sBAAsB;IAOtB,WAAW,CAAC,eAAe,EAAC,WAAW;IAWvC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,GAAG;IAkCzC,MAAM;IAQf,OAAgB,MAAM,8BAAY;CACnC"}
|
package/menu.constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu.constants.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,WAAW,iBAAiB;CAC7B"}
|
package/menu.style.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu.style.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.style.ts"],"names":[],"mappings":"AAqFA,eAAO,MAAM,MAAM,2BAAc,CAAC"}
|
package/menu.types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu.types.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAA,OAAO,EAAC,OAAO,EAAE,CAAA;KAAC,CAAC;IACtC,MAAM,CAAC,EAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAA,KAAK,EAAC,MAAM,CAAA;KAAC,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AACD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAC,MAAM,CAAC;IACb,KAAK,EAAC,MAAM,CAAA;CACb"}
|
package/react.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/menu/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,eAAO,MAAM,UAAU,kEAKrB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { ICON_POSITION } from './menu-link.contants.js';
|
|
3
|
-
import { IAction } from '../menu.types.js';
|
|
4
|
-
export declare class HyMenuLink extends LitElement {
|
|
5
|
-
static index: number;
|
|
6
|
-
private linkPosition;
|
|
7
|
-
text: string;
|
|
8
|
-
link: string;
|
|
9
|
-
disabled: boolean;
|
|
10
|
-
icon: string;
|
|
11
|
-
iconPosition: ICON_POSITION;
|
|
12
|
-
selected: boolean;
|
|
13
|
-
menu: {
|
|
14
|
-
icon: string;
|
|
15
|
-
actions: IAction[];
|
|
16
|
-
};
|
|
17
|
-
status: {
|
|
18
|
-
icon: string;
|
|
19
|
-
label: string;
|
|
20
|
-
};
|
|
21
|
-
optionPath: number[];
|
|
22
|
-
connectedCallback(): void;
|
|
23
|
-
firstUpdated(): void;
|
|
24
|
-
_clickLink(event?: Event): void;
|
|
25
|
-
onActionClick(e: CustomEvent): void;
|
|
26
|
-
render(): import("lit").TemplateResult<1>;
|
|
27
|
-
static styles: import("lit").CSSResult;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=hy-menu-link.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-menu-link.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/templates/hy-menu-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgB,MAAM,KAAK,CAAC;AAI9C,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,qBACa,UAAW,SAAQ,UAAU;IACxC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;IAGrB,OAAO,CAAC,YAAY,CAAU;IAG9B,IAAI,SAAgB;IAGpB,IAAI,EAAG,MAAM,CAAC;IAGd,QAAQ,UAAS;IAGjB,IAAI,SAAgB;IAGpB,YAAY,gBAAsB;IAGlC,QAAQ,UAAS;IAGjB,IAAI,EAAE;QAAC,IAAI,EAAC,MAAM,CAAC;QAAA,OAAO,EAAC,OAAO,EAAE,CAAA;KAAC,CAAA;IAGrC,MAAM,EAAE;QAAC,IAAI,EAAC,MAAM,CAAC;QAAA,KAAK,EAAC,MAAM,CAAA;KAAC,CAAA;IAElC,UAAU,EAAE,MAAM,EAAE,CAAC;IAGZ,iBAAiB,IAAI,IAAI;IAYzB,YAAY,IAAI,IAAI;IAM7B,UAAU,CAAC,KAAK,CAAC,EAAC,KAAK;IAYvB,aAAa,CAAC,CAAC,EAAC,WAAW;IAIlB,MAAM;IAsCf,OAAgB,MAAM,0BAAU;CACjC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var HyMenuLink_1;
|
|
8
|
-
import { LitElement, html, nothing } from 'lit';
|
|
9
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
10
|
-
import { styles } from './menu-link.style.js';
|
|
11
|
-
import { EMPTY_STRING } from '../menu.constants.js';
|
|
12
|
-
import { ICON_POSITION } from './menu-link.contants.js';
|
|
13
|
-
let HyMenuLink = HyMenuLink_1 = class HyMenuLink extends LitElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.text = EMPTY_STRING;
|
|
17
|
-
this.disabled = false;
|
|
18
|
-
this.icon = EMPTY_STRING;
|
|
19
|
-
this.iconPosition = ICON_POSITION.LEFT;
|
|
20
|
-
this.selected = false;
|
|
21
|
-
}
|
|
22
|
-
connectedCallback() {
|
|
23
|
-
super.connectedCallback();
|
|
24
|
-
this.optionPath = this.getAttribute('data-path').split('-').map((stringValue) => +stringValue);
|
|
25
|
-
const isTheFirstOption = this.optionPath.filter((path) => path != 0).length == 0;
|
|
26
|
-
if (isTheFirstOption) {
|
|
27
|
-
HyMenuLink_1.index = 0;
|
|
28
|
-
}
|
|
29
|
-
this.linkPosition = HyMenuLink_1.index;
|
|
30
|
-
HyMenuLink_1.index++;
|
|
31
|
-
}
|
|
32
|
-
firstUpdated() {
|
|
33
|
-
if (this.selected) {
|
|
34
|
-
this._clickLink();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
_clickLink(event) {
|
|
38
|
-
var _a;
|
|
39
|
-
if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.id) != 'action-icon') {
|
|
40
|
-
this.dispatchEvent(new CustomEvent('selected-link', {
|
|
41
|
-
detail: { index: this.linkPosition, value: this.text },
|
|
42
|
-
bubbles: true,
|
|
43
|
-
composed: true,
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
onActionClick(e) {
|
|
48
|
-
this.dispatchEvent(new CustomEvent('action-click', { detail: { value: e.detail.value, path: this.optionPath }, composed: true, bubbles: true }));
|
|
49
|
-
}
|
|
50
|
-
render() {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
return html `
|
|
53
|
-
<li tabindex="0" @mousedown=${!this.disabled ? this._clickLink : nothing}>
|
|
54
|
-
<div class="icon-container" >
|
|
55
|
-
${this.icon
|
|
56
|
-
? html `${!this.text
|
|
57
|
-
? html `
|
|
58
|
-
<div id="icon-only">
|
|
59
|
-
<hy-icon name="${this.icon}"></hy-icon>
|
|
60
|
-
</div>
|
|
61
|
-
`
|
|
62
|
-
: html `<hy-icon name="${this.icon}"></hy-icon>`} `
|
|
63
|
-
: nothing}
|
|
64
|
-
|
|
65
|
-
</div>
|
|
66
|
-
${this.text
|
|
67
|
-
? html `
|
|
68
|
-
<div class="action-text-container">
|
|
69
|
-
<div id="text-container">
|
|
70
|
-
<span>${this.text}</span>
|
|
71
|
-
</div>
|
|
72
|
-
<div class="icon-container" >
|
|
73
|
-
${((_a = this.status) === null || _a === void 0 ? void 0 : _a.icon) ? html `
|
|
74
|
-
<hy-icon name=${this.status.icon} class="status-icon"></hy-icon>
|
|
75
|
-
` : nothing}
|
|
76
|
-
${((_b = this.menu) === null || _b === void 0 ? void 0 : _b.actions) ? html `
|
|
77
|
-
<hy-dropdown .options=${this.menu.actions} .trigger=${'click'} @click-item=${this.onActionClick}>
|
|
78
|
-
<hy-icon name="${this.menu.icon}" id="action-icon" ></hy-icon>
|
|
79
|
-
</hy-dropdown>
|
|
80
|
-
` : nothing}
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
</div>
|
|
84
|
-
`
|
|
85
|
-
: nothing}
|
|
86
|
-
</li>
|
|
87
|
-
`;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
HyMenuLink.styles = styles;
|
|
91
|
-
__decorate([
|
|
92
|
-
state()
|
|
93
|
-
], HyMenuLink.prototype, "linkPosition", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
property({ reflect: true })
|
|
96
|
-
], HyMenuLink.prototype, "text", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
property()
|
|
99
|
-
], HyMenuLink.prototype, "link", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
property({ type: Boolean, reflect: true })
|
|
102
|
-
], HyMenuLink.prototype, "disabled", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
property({ reflect: true })
|
|
105
|
-
], HyMenuLink.prototype, "icon", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
property({ reflect: true })
|
|
108
|
-
], HyMenuLink.prototype, "iconPosition", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
property({ type: Boolean, reflect: true })
|
|
111
|
-
], HyMenuLink.prototype, "selected", void 0);
|
|
112
|
-
__decorate([
|
|
113
|
-
property({ reflect: true })
|
|
114
|
-
], HyMenuLink.prototype, "menu", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
property()
|
|
117
|
-
], HyMenuLink.prototype, "status", void 0);
|
|
118
|
-
HyMenuLink = HyMenuLink_1 = __decorate([
|
|
119
|
-
customElement('hy-menu-link')
|
|
120
|
-
], HyMenuLink);
|
|
121
|
-
export { HyMenuLink };
|
|
122
|
-
//# sourceMappingURL=hy-menu-link.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-menu-link.js","sourceRoot":"","sources":["../../../../src/components/menu/templates/hy-menu-link.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AAItD,IAAa,UAAU,kBAAvB,MAAa,UAAW,SAAQ,UAAU;IAA1C;;QAOE,SAAI,GAAG,YAAY,CAAC;QAMpB,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAG,YAAY,CAAC;QAGpB,iBAAY,GAAG,aAAa,CAAC,IAAI,CAAC;QAGlC,aAAQ,GAAG,KAAK,CAAC;IAoFnB,CAAC;IAzEU,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAC,EAAE,CAAA,CAAC,WAAW,CAAC,CAA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;AAGjB;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCACW;AAGrC;IADC,QAAQ,EAAE;0CACuB;AA5BvB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CA0GtB;SA1GY,UAAU","sourcesContent":["import {LitElement, html, nothing} from 'lit';\nimport {customElement, property, state} from 'lit/decorators.js';\nimport {styles} from './menu-link.style.js';\nimport {EMPTY_STRING} from '../menu.constants.js';\nimport {ICON_POSITION} from './menu-link.contants.js';\nimport { IAction } from '../menu.types.js';\n\n@customElement('hy-menu-link')\nexport class HyMenuLink extends LitElement {\n static index: number;\n\n @state()\n private linkPosition!: number;\n\n @property({reflect: true})\n text = EMPTY_STRING;\n\n @property()\n link!: string;\n\n @property({type: Boolean, reflect: true})\n disabled = false;\n\n @property({reflect: true})\n icon = EMPTY_STRING;\n\n @property({reflect: true})\n iconPosition = ICON_POSITION.LEFT;\n\n @property({type: Boolean, reflect: true})\n selected = false;\n\n @property({reflect: true})\n menu!:{icon:string,actions:IAction[]}\n\n @property()\n status!:{icon:string,label:string}\n\n optionPath!:number[];\n\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.optionPath=this.getAttribute('data-path')!.split('-').map((stringValue)=>+stringValue);\n\n const isTheFirstOption=this.optionPath.filter((path)=>path!=0).length==0\n if (isTheFirstOption) {\n HyMenuLink.index = 0;\n }\n this.linkPosition = HyMenuLink.index;\n HyMenuLink.index++;\n }\n\n override firstUpdated(): void {\n if (this.selected) {\n this._clickLink();\n }\n }\n\n _clickLink(event?:Event) {\n if((event?.target as HTMLElement)?.id !='action-icon'){\n this.dispatchEvent(\n new CustomEvent('selected-link', {\n detail: {index: this.linkPosition, value: this.text},\n bubbles: true,\n composed: true,\n })\n );\n }\n }\n\n onActionClick(e:CustomEvent){\n this.dispatchEvent(new CustomEvent('action-click',{detail:{value:e.detail.value,path:this.optionPath},composed:true,bubbles:true}))\n }\n\n override render() {\n return html`\n <li tabindex=\"0\" @mousedown=${!this.disabled ? this._clickLink : nothing}>\n <div class=\"icon-container\" >\n ${this.icon\n ? html`${!this.text\n ? html`\n <div id=\"icon-only\">\n <hy-icon name=\"${this.icon}\"></hy-icon>\n </div>\n `\n : html`<hy-icon name=\"${this.icon}\"></hy-icon>`} `\n : nothing}\n \n </div>\n ${this.text\n ? html`\n <div class=\"action-text-container\">\n <div id=\"text-container\">\n <span>${this.text}</span>\n </div>\n <div class=\"icon-container\" >\n ${this.status?.icon?html`\n <hy-icon name=${this.status.icon} class=\"status-icon\"></hy-icon>\n `:nothing}\n ${this.menu?.actions?html`\n <hy-dropdown .options=${this.menu.actions} .trigger=${'click'} @click-item=${this.onActionClick}>\n <hy-icon name=\"${this.menu.icon}\" id=\"action-icon\" ></hy-icon>\n </hy-dropdown>\n `:nothing}\n </div>\n \n </div>\n `\n : nothing}\n </li>\n `;\n }\n static override styles = styles;\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import { IAction } from '../menu.types.js';
|
|
3
|
-
export declare class HySubMenu extends LitElement {
|
|
4
|
-
text: string;
|
|
5
|
-
icon: string;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
highlighted: boolean;
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
hovered: boolean;
|
|
10
|
-
selected: boolean;
|
|
11
|
-
menu: {
|
|
12
|
-
icon: string;
|
|
13
|
-
actions: IAction[];
|
|
14
|
-
children: any;
|
|
15
|
-
menu: any;
|
|
16
|
-
opened: boolean;
|
|
17
|
-
};
|
|
18
|
-
status: {
|
|
19
|
-
icon: string;
|
|
20
|
-
label: string;
|
|
21
|
-
};
|
|
22
|
-
optionPath: number[];
|
|
23
|
-
connectedCallback(): void;
|
|
24
|
-
_toggleMenu(event: Event): void;
|
|
25
|
-
toggleIcon(): void;
|
|
26
|
-
_handleSelectedChild(): void;
|
|
27
|
-
onActionClick(e: CustomEvent): void;
|
|
28
|
-
protected updated(_changedProperties: PropertyValues): void;
|
|
29
|
-
render(): import("lit").TemplateResult<1>;
|
|
30
|
-
static styles: import("lit").CSSResult;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=hy-sub-menu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-sub-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/templates/hy-sub-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAC;AAIhE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,qBACa,SAAU,SAAQ,UAAU;IAEvC,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,SAAgB;IAGpB,QAAQ,UAAS;IAGjB,WAAW,UAAS;IAGpB,MAAM,UAAS;IAGf,OAAO,UAAS;IAGhB,QAAQ,UAAS;IAGjB,IAAI,EAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAG;QAAC,IAAI,EAAG,GAAG,CAAE;QAAC,MAAM,EAAG,OAAO,CAAA;KAAC,CAAC;IAG3F,MAAM,EAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAEzC,UAAU,EAAG,MAAM,EAAE,CAAC;IAEb,iBAAiB,IAAI,IAAI;IAWlC,WAAW,CAAC,KAAK,EAAE,KAAK;IAcxB,UAAU;IAIV,oBAAoB;IAIpB,aAAa,CAAC,CAAC,EAAE,WAAW;cAIT,OAAO,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAW3D,MAAM;IAsBf,OAAgB,MAAM,0BAAU;CACjC"}
|
package/templates/hy-sub-menu.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, html, nothing } from 'lit';
|
|
8
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
|
-
import { styles } from './sub-menu.style.js';
|
|
10
|
-
import { EMPTY_STRING } from '../menu.constants.js';
|
|
11
|
-
let HySubMenu = class HySubMenu extends LitElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.icon = EMPTY_STRING;
|
|
15
|
-
this.disabled = false;
|
|
16
|
-
this.highlighted = false;
|
|
17
|
-
this.isOpen = false;
|
|
18
|
-
this.hovered = false;
|
|
19
|
-
this.selected = false;
|
|
20
|
-
}
|
|
21
|
-
connectedCallback() {
|
|
22
|
-
super.connectedCallback();
|
|
23
|
-
this.optionPath = this.getAttribute('data-path').split('-').map((stringValue) => +stringValue);
|
|
24
|
-
this.addEventListener('mouseenter', () => {
|
|
25
|
-
this.hovered = true;
|
|
26
|
-
});
|
|
27
|
-
this.addEventListener('mouseleave', () => {
|
|
28
|
-
this.hovered = false;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
_toggleMenu(event) {
|
|
32
|
-
var _a, _b;
|
|
33
|
-
if ((((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.className) != 'action-icon') && (((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.id) != 'toggle-icon')) {
|
|
34
|
-
if (!this.isOpen) {
|
|
35
|
-
this.isOpen = !this.isOpen;
|
|
36
|
-
}
|
|
37
|
-
this.dispatchEvent(new CustomEvent('select-menu', {
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
detail: { value: this.text, path: this.optionPath },
|
|
41
|
-
}));
|
|
42
|
-
this.highlighted = true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
toggleIcon() {
|
|
46
|
-
this.isOpen = !this.isOpen;
|
|
47
|
-
}
|
|
48
|
-
_handleSelectedChild() {
|
|
49
|
-
this.highlighted = true;
|
|
50
|
-
}
|
|
51
|
-
onActionClick(e) {
|
|
52
|
-
console.log(e.detail);
|
|
53
|
-
this.dispatchEvent(new CustomEvent('action-click', { detail: { value: e.detail.value, path: this.optionPath, additionalData: e.detail.additionalData }, composed: true, bubbles: true }));
|
|
54
|
-
}
|
|
55
|
-
updated(_changedProperties) {
|
|
56
|
-
if (_changedProperties.has('menu')) {
|
|
57
|
-
const previousMenu = _changedProperties.get('menu');
|
|
58
|
-
if ((previousMenu === null || previousMenu === void 0 ? void 0 : previousMenu.opened) !== this.menu.opened) {
|
|
59
|
-
if (this.menu.opened) {
|
|
60
|
-
this.isOpen = this.menu.opened;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
return html `
|
|
68
|
-
<ul tabindex="0">
|
|
69
|
-
<div @mousedown=${!this.disabled ? this._toggleMenu : nothing}>
|
|
70
|
-
${this.icon ? html `<hy-icon id="text-icon" name="${this.icon}"></hy-icon>` : nothing}
|
|
71
|
-
<span>${this.text}</span>
|
|
72
|
-
<div class="icons-container">
|
|
73
|
-
${((_a = this.status) === null || _a === void 0 ? void 0 : _a.icon) ? html `
|
|
74
|
-
<hy-icon name=${this.status.icon} class="status-icon" ></hy-icon>
|
|
75
|
-
` : nothing}
|
|
76
|
-
${(this.highlighted || this.hovered) && ((_b = this.menu) === null || _b === void 0 ? void 0 : _b.menu.actions) ? html `
|
|
77
|
-
<hy-dropdown .options=${this.menu.menu.actions} @click-item=${this.onActionClick} .trigger=${"click"}>
|
|
78
|
-
<hy-icon name="${this.menu.menu.icon}" class="action-icon"></hy-icon>
|
|
79
|
-
</hy-dropdown>
|
|
80
|
-
` : nothing}
|
|
81
|
-
${this.menu.children.length ? html `<hy-icon id="toggle-icon" name="${this.isOpen ? 'angle-up' : 'angle-down'}" @mousedown=${!this.disabled ? this.toggleIcon : nothing}></hy-icon>` : nothing}
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
<slot @select-menu=${this._handleSelectedChild} @selected-link=${this._handleSelectedChild} style="display:${this.isOpen ? nothing : 'none'};"></slot>
|
|
85
|
-
</ul>
|
|
86
|
-
`;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
HySubMenu.styles = styles;
|
|
90
|
-
__decorate([
|
|
91
|
-
property()
|
|
92
|
-
], HySubMenu.prototype, "text", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
property({ reflect: true })
|
|
95
|
-
], HySubMenu.prototype, "icon", void 0);
|
|
96
|
-
__decorate([
|
|
97
|
-
property({ type: Boolean })
|
|
98
|
-
], HySubMenu.prototype, "disabled", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
property({ type: Boolean })
|
|
101
|
-
], HySubMenu.prototype, "highlighted", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
state()
|
|
104
|
-
], HySubMenu.prototype, "isOpen", void 0);
|
|
105
|
-
__decorate([
|
|
106
|
-
state()
|
|
107
|
-
], HySubMenu.prototype, "hovered", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
property({ type: Boolean, reflect: true })
|
|
110
|
-
], HySubMenu.prototype, "selected", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
property({ type: Object })
|
|
113
|
-
], HySubMenu.prototype, "menu", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
property({ type: Object })
|
|
116
|
-
], HySubMenu.prototype, "status", void 0);
|
|
117
|
-
HySubMenu = __decorate([
|
|
118
|
-
customElement('hy-sub-menu')
|
|
119
|
-
], HySubMenu);
|
|
120
|
-
export { HySubMenu };
|
|
121
|
-
//# sourceMappingURL=hy-sub-menu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-sub-menu.js","sourceRoot":"","sources":["../../../../src/components/menu/templates/hy-sub-menu.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAAzC;;QAKE,SAAI,GAAG,YAAY,CAAC;QAGpB,aAAQ,GAAG,KAAK,CAAC;QAGjB,gBAAW,GAAG,KAAK,CAAC;QAGpB,WAAM,GAAG,KAAK,CAAC;QAGf,YAAO,GAAG,KAAK,CAAC;QAGhB,aAAQ,GAAG,KAAK,CAAC;IAiFnB,CAAC;IAvEU,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;QAChG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE;YACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACrB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE;YACvC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACtB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AC,UAAU,CAAC,CAAC,CAAC,YAAY,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,OAAO;;;6BAG5K,IAAI,CAAC,oBAAoB,mBAAmB,IAAI,CAAC,oBAAoB,mBAAmB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;;KAE9I,CAAC;IACJ,CAAC;CAEF,CAAA;AADiB,gBAAM,GAAG,MAAO,CAAA;AAlGhC;IADC,QAAQ,EAAE;uCACG;AAGd;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACR;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;8CACP;AAGpB;IADC,KAAK,EAAE;yCACO;AAGf;IADC,KAAK,EAAE;0CACQ;AAGhB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;2CACxB;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCACkE;AAG3F;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACgB;AA1B9B,SAAS;IADrB,aAAa,CAAC,aAAa,CAAC;GAChB,SAAS,CAqGrB;SArGY,SAAS","sourcesContent":["import { LitElement, PropertyValues, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { styles } from './sub-menu.style.js';\nimport { EMPTY_STRING } from '../menu.constants.js';\nimport { IAction } from '../menu.types.js';\n\n@customElement('hy-sub-menu')\nexport class HySubMenu extends LitElement {\n @property()\n text!: string;\n\n @property({ reflect: true })\n icon = EMPTY_STRING;\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: Boolean})\n highlighted = false;\n\n @state()\n isOpen = false;\n\n @state()\n hovered = false;\n\n @property({type: Boolean, reflect: true})\n selected = false;\n \n @property({type: Object})\n menu!: { icon: string, actions: IAction[], children: any , menu : any , opened : boolean};\n\n @property({type: Object})\n status!: { icon: string, label: string };\n\n optionPath!: number[];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.optionPath = this.getAttribute('data-path')!.split('-').map((stringValue) => +stringValue);\n this.addEventListener('mouseenter', () => {\n this.hovered = true\n });\n this.addEventListener('mouseleave', () => {\n this.hovered = false\n });\n }\n\n _toggleMenu(event: Event) {\n if (((event?.target as HTMLElement)?.className != 'action-icon') && ((event?.target as HTMLElement)?.id != 'toggle-icon')) {\n if (!this.isOpen) {\n this.isOpen = !this.isOpen;\n }\n this.dispatchEvent(new CustomEvent('select-menu', {\n bubbles: true,\n composed: true,\n detail: { value: this.text, path: this.optionPath },\n }));\n this.highlighted = true\n }\n }\n\n toggleIcon() {\n this.isOpen = !this.isOpen\n }\n\n _handleSelectedChild() {\n this.highlighted = true;\n }\n\n onActionClick(e: CustomEvent) {\n console.log(e.detail)\n this.dispatchEvent(new CustomEvent('action-click', { detail: { value: e.detail.value, path: this.optionPath, additionalData: e.detail.additionalData}, composed: true, bubbles: true }))\n }\n protected override updated(_changedProperties: PropertyValues): void {\n if (_changedProperties.has('menu')) {\n const previousMenu = _changedProperties.get('menu') as typeof this.menu;\n if (previousMenu?.opened !== this.menu.opened) {\n if(this.menu.opened){\n this.isOpen = this.menu.opened;\n }\n }\n }\n }\n\n override render() {\n return html`\n <ul tabindex=\"0\">\n <div @mousedown=${!this.disabled ? this._toggleMenu : nothing}>\n ${this.icon ? html`<hy-icon id=\"text-icon\" name=\"${this.icon}\"></hy-icon>` : nothing}\n <span>${this.text}</span>\n <div class=\"icons-container\">\n ${this.status?.icon ? html`\n <hy-icon name=${this.status.icon} class=\"status-icon\" ></hy-icon>\n `: nothing}\n ${(this.highlighted || this.hovered) && this.menu?.menu.actions ? html`\n <hy-dropdown .options=${this.menu.menu.actions} @click-item=${this.onActionClick} .trigger=${\"click\"}>\n <hy-icon name=\"${this.menu.menu.icon}\" class=\"action-icon\"></hy-icon>\n </hy-dropdown>\n `: nothing}\n ${this.menu.children.length ? html`<hy-icon id=\"toggle-icon\" name=\"${this.isOpen ? 'angle-up' : 'angle-down'}\" @mousedown=${!this.disabled ? this.toggleIcon : nothing}></hy-icon>` : nothing}\n </div>\n </div>\n <slot @select-menu=${this._handleSelectedChild} @selected-link=${this._handleSelectedChild} style=\"display:${this.isOpen ? nothing : 'none'};\"></slot>\n </ul>\n `;\n }\n static override styles = styles;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu-link.contants.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/templates/menu-link.contants.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu-link.contants.js","sourceRoot":"","sources":["../../../../src/components/menu/templates/menu-link.contants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB","sourcesContent":["export enum ICON_POSITION {\n LEFT = 'left',\n RIGHT = 'right',\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu-link.style.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/templates/menu-link.style.ts"],"names":[],"mappings":"AAgGA,eAAO,MAAM,MAAM,yBAAgB,CAAC"}
|