@progressive-development/pd-page 0.1.128 → 0.5.0
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/index.js +18 -0
- package/dist/locales/be.js +12 -0
- package/dist/locales/de.js +12 -0
- package/dist/locales/en.js +12 -0
- package/dist/pd-contact-us.js +2 -0
- package/dist/pd-footer.js +2 -0
- package/dist/pd-menu.js +2 -0
- package/dist/pd-teaser.js +4 -0
- package/{src → dist/src}/PdContactUs.js +40 -57
- package/{src → dist/src}/PdFooter.js +23 -34
- package/{src → dist/src}/PdMenu.js +47 -85
- package/{src → dist/src}/PdTeaser.js +25 -49
- package/{src → dist/src}/PdTeaserContent.js +14 -22
- package/package.json +46 -29
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -13
- package/.storybook/preview.js +0 -14
- package/demo/index.html +0 -29
- package/index.js +0 -3
- package/lit-localize.json +0 -18
- package/pd-contact-us.js +0 -3
- package/pd-footer.js +0 -3
- package/pd-menu.js +0 -3
- package/pd-teaser.js +0 -5
- package/src/generated/locale-codes.js +0 -27
- package/src/generated/locales/be.js +0 -20
- package/src/generated/locales/de.js +0 -20
- package/src/generated/locales/en.js +0 -20
- package/src/stories/01_index.stories.js +0 -172
- package/src/stories/contactUs.stories.js +0 -30
- package/src/stories/footer.stories.js +0 -41
- package/src/stories/menu.stories.js +0 -188
- package/src/stories/teaser.stories.js +0 -75
- package/test/pd-page.test.js +0 -32
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
- package/xliff/be.xlf +0 -35
- package/xliff/de.xlf +0 -28
- package/xliff/en.xlf +0 -35
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PdContactUs } from "./src/PdContactUs.js";
|
|
2
|
+
import { PdFooter } from "./src/PdFooter.js";
|
|
3
|
+
import { PdMenu } from "./src/PdMenu.js";
|
|
4
|
+
import { PdTeaser } from "./src/PdTeaser.js";
|
|
5
|
+
import { PdTeaserContent } from "./src/PdTeaserContent.js";
|
|
6
|
+
import { templates } from "./locales/be.js";
|
|
7
|
+
import { templates as templates2 } from "./locales/de.js";
|
|
8
|
+
import { templates as templates3 } from "./locales/en.js";
|
|
9
|
+
export {
|
|
10
|
+
PdContactUs,
|
|
11
|
+
PdFooter,
|
|
12
|
+
PdMenu,
|
|
13
|
+
PdTeaser,
|
|
14
|
+
PdTeaserContent,
|
|
15
|
+
templates as beTemplates,
|
|
16
|
+
templates2 as deTemplates,
|
|
17
|
+
templates3 as enTemplates
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const templates = {
|
|
2
|
+
"pd.contactus.address.email": `E-mail`,
|
|
3
|
+
"pd.contactus.address.message": `Boodschap`,
|
|
4
|
+
"pd.contactus.address.name": `Naam`,
|
|
5
|
+
"pd.contactus.address.phone": `Telefoon`,
|
|
6
|
+
"pd.contactus.address.send": `Verzenden`,
|
|
7
|
+
"pd.contactus.address.title": `Adres`,
|
|
8
|
+
"pd.contactus.title": `Contact`
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
templates
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const templates = {
|
|
2
|
+
"pd.contactus.title": `Kontakt`,
|
|
3
|
+
"pd.contactus.address.title": `Adresse`,
|
|
4
|
+
"pd.contactus.address.name": `Name`,
|
|
5
|
+
"pd.contactus.address.email": `Email`,
|
|
6
|
+
"pd.contactus.address.phone": `Telefon`,
|
|
7
|
+
"pd.contactus.address.message": `Nachricht`,
|
|
8
|
+
"pd.contactus.address.send": `Absenden`
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
templates
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const templates = {
|
|
2
|
+
"pd.contactus.address.email": `Email`,
|
|
3
|
+
"pd.contactus.address.message": `Message`,
|
|
4
|
+
"pd.contactus.address.name": `Name`,
|
|
5
|
+
"pd.contactus.address.phone": `Phone`,
|
|
6
|
+
"pd.contactus.address.send": `Send`,
|
|
7
|
+
"pd.contactus.address.title": `Address`,
|
|
8
|
+
"pd.contactus.title": `Contact`
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
templates
|
|
12
|
+
};
|
package/dist/pd-menu.js
ADDED
|
@@ -1,35 +1,25 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { updateWhenLocaleChanges, msg } from "@lit/localize";
|
|
3
|
+
import "@progressive-development/pd-forms/pd-button";
|
|
4
|
+
import "@progressive-development/pd-forms/pd-form-container";
|
|
5
|
+
import "@progressive-development/pd-forms/pd-form-row";
|
|
6
|
+
import "@progressive-development/pd-forms/pd-input";
|
|
7
|
+
import "@progressive-development/pd-forms/pd-input-area";
|
|
8
|
+
import "@progressive-development/pd-contact/pd-contact";
|
|
9
|
+
import { PDColorStyles, PDFontStyles } from "@progressive-development/pd-shared-styles";
|
|
1
10
|
/**
|
|
2
11
|
* @license
|
|
3
12
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
13
|
*/
|
|
5
|
-
|
|
6
|
-
import { LitElement, html, css } from 'lit';
|
|
7
|
-
import { msg, updateWhenLocaleChanges } from '@lit/localize';
|
|
8
|
-
|
|
9
|
-
import '@progressive-development/pd-forms/pd-button.js';
|
|
10
|
-
import '@progressive-development/pd-forms/pd-form-container.js';
|
|
11
|
-
import '@progressive-development/pd-forms/pd-form-row.js';
|
|
12
|
-
import '@progressive-development/pd-forms/pd-input.js';
|
|
13
|
-
import '@progressive-development/pd-forms/pd-input-area.js';
|
|
14
|
-
import '@progressive-development/pd-contact/pd-contact.js';
|
|
15
|
-
|
|
16
|
-
import { PDColorStyles, PDFontStyles } from '@progressive-development/pd-shared-styles';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* An example element.
|
|
20
|
-
*
|
|
21
|
-
* @slot - This element has a slot
|
|
22
|
-
* @csspart button - The button
|
|
23
|
-
*/
|
|
24
|
-
export class PdContactUs extends LitElement {
|
|
14
|
+
class PdContactUs extends LitElement {
|
|
25
15
|
/**
|
|
26
16
|
* Fired when free date clicked => At the moment only for freeDates
|
|
27
17
|
* @event send-contact-request
|
|
28
18
|
*/
|
|
29
|
-
|
|
30
19
|
static get styles() {
|
|
31
20
|
return [
|
|
32
|
-
PDColorStyles,
|
|
21
|
+
PDColorStyles,
|
|
22
|
+
PDFontStyles,
|
|
33
23
|
css`
|
|
34
24
|
:host {
|
|
35
25
|
|
|
@@ -95,31 +85,29 @@ export class PdContactUs extends LitElement {
|
|
|
95
85
|
justify-content: left;
|
|
96
86
|
}
|
|
97
87
|
}
|
|
98
|
-
`
|
|
88
|
+
`
|
|
89
|
+
];
|
|
99
90
|
}
|
|
100
|
-
|
|
101
91
|
static get properties() {
|
|
102
92
|
return {
|
|
103
|
-
contact: { type: Object }
|
|
93
|
+
contact: { type: Object }
|
|
104
94
|
};
|
|
105
95
|
}
|
|
106
|
-
|
|
107
96
|
constructor() {
|
|
108
97
|
super();
|
|
109
98
|
updateWhenLocaleChanges(this);
|
|
110
|
-
this.contact = {};
|
|
99
|
+
this.contact = {};
|
|
111
100
|
}
|
|
112
|
-
|
|
113
101
|
render() {
|
|
114
102
|
return html`
|
|
115
103
|
<div class="content-block">
|
|
116
|
-
<h2>${msg(
|
|
104
|
+
<h2>${msg("Kontakt", { id: "pd.contactus.title" })}</h2>
|
|
117
105
|
<div class="contact-block">
|
|
118
106
|
<div class="left-content">
|
|
119
107
|
<pd-contact
|
|
120
108
|
class="company-contact"
|
|
121
109
|
.contact="${this.contact}"
|
|
122
|
-
addressTitle="${msg(
|
|
110
|
+
addressTitle="${msg("Adresse", { id: "pd.contactus.address.title" })}"
|
|
123
111
|
summary
|
|
124
112
|
></pd-contact>
|
|
125
113
|
</div>
|
|
@@ -130,7 +118,7 @@ export class PdContactUs extends LitElement {
|
|
|
130
118
|
<pd-input
|
|
131
119
|
id="nameInputId"
|
|
132
120
|
class="quarter3"
|
|
133
|
-
placeHolder="${msg(
|
|
121
|
+
placeHolder="${msg("Name", { id: "pd.contactus.address.name" })}"
|
|
134
122
|
valueName="name"
|
|
135
123
|
autoCompleteName="full-name"
|
|
136
124
|
required
|
|
@@ -141,7 +129,7 @@ export class PdContactUs extends LitElement {
|
|
|
141
129
|
<pd-input
|
|
142
130
|
id="mailInputId"
|
|
143
131
|
class="quarter3"
|
|
144
|
-
placeHolder="${msg(
|
|
132
|
+
placeHolder="${msg("Email", { id: "pd.contactus.address.email" })}"
|
|
145
133
|
valueName="mail"
|
|
146
134
|
autoCompleteName="email"
|
|
147
135
|
name="email"
|
|
@@ -154,7 +142,7 @@ export class PdContactUs extends LitElement {
|
|
|
154
142
|
<pd-input
|
|
155
143
|
id="phoneInputId"
|
|
156
144
|
class="quarter3"
|
|
157
|
-
placeHolder="${msg(
|
|
145
|
+
placeHolder="${msg("Telefon", { id: "pd.contactus.address.phone" })}"
|
|
158
146
|
valueName="phone"
|
|
159
147
|
field-type="phone"
|
|
160
148
|
autoCompleteName="tel"
|
|
@@ -166,7 +154,7 @@ export class PdContactUs extends LitElement {
|
|
|
166
154
|
<pd-input-area
|
|
167
155
|
id="msgInputId"
|
|
168
156
|
class="quarter3-area"
|
|
169
|
-
placeHolder="${msg(
|
|
157
|
+
placeHolder="${msg("Nachricht", { id: "pd.contactus.address.message" })}"
|
|
170
158
|
rows="15"
|
|
171
159
|
required
|
|
172
160
|
valueName="msg"
|
|
@@ -174,7 +162,7 @@ export class PdContactUs extends LitElement {
|
|
|
174
162
|
</pd-form-row>
|
|
175
163
|
|
|
176
164
|
<pd-form-row>
|
|
177
|
-
<pd-button class="quarter3" text="${msg(
|
|
165
|
+
<pd-button class="quarter3" text="${msg("Absenden", { id: "pd.contactus.address.send" })}" @click="${this._sendMail}" primary></pd-button>
|
|
178
166
|
</pd-form-row>
|
|
179
167
|
|
|
180
168
|
</pd-form-container>
|
|
@@ -184,38 +172,33 @@ export class PdContactUs extends LitElement {
|
|
|
184
172
|
</div>
|
|
185
173
|
`;
|
|
186
174
|
}
|
|
187
|
-
|
|
188
175
|
clear() {
|
|
189
|
-
this.shadowRoot.getElementById(
|
|
190
|
-
this.shadowRoot.getElementById(
|
|
191
|
-
this.shadowRoot.getElementById(
|
|
192
|
-
this.shadowRoot.getElementById(
|
|
176
|
+
this.shadowRoot.getElementById("nameInputId").clear();
|
|
177
|
+
this.shadowRoot.getElementById("mailInputId").clear();
|
|
178
|
+
this.shadowRoot.getElementById("phoneInputId").clear();
|
|
179
|
+
this.shadowRoot.getElementById("msgInputId").clear();
|
|
193
180
|
}
|
|
194
|
-
|
|
195
|
-
_sendMail() {
|
|
196
|
-
|
|
181
|
+
_sendMail() {
|
|
197
182
|
const detail = {
|
|
198
|
-
errorMap: new Map()
|
|
183
|
+
errorMap: /* @__PURE__ */ new Map()
|
|
199
184
|
};
|
|
200
|
-
|
|
201
|
-
// current wizard element
|
|
202
185
|
const curentStepEl = this.shadowRoot.getElementById("contactFormId");
|
|
203
|
-
curentStepEl.dispatchEvent(new CustomEvent(
|
|
204
|
-
|
|
186
|
+
curentStepEl.dispatchEvent(new CustomEvent("validate-form", { detail }));
|
|
205
187
|
if (detail.errorMap.size === 0) {
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
const
|
|
210
|
-
const msg1 = this.shadowRoot.getElementById('msgInputId').value;
|
|
188
|
+
const name = this.shadowRoot.getElementById("nameInputId").value;
|
|
189
|
+
const email = this.shadowRoot.getElementById("mailInputId").value;
|
|
190
|
+
const phone = this.shadowRoot.getElementById("phoneInputId").value;
|
|
191
|
+
const msg1 = this.shadowRoot.getElementById("msgInputId").value;
|
|
211
192
|
this.dispatchEvent(
|
|
212
|
-
new CustomEvent(
|
|
193
|
+
new CustomEvent("send-contact-request", {
|
|
213
194
|
detail: {
|
|
214
|
-
msgObj: { name, email, phone, msg1 }
|
|
215
|
-
}
|
|
195
|
+
msgObj: { name, email, phone, msg1 }
|
|
196
|
+
}
|
|
216
197
|
})
|
|
217
198
|
);
|
|
218
199
|
}
|
|
219
200
|
}
|
|
220
|
-
|
|
221
201
|
}
|
|
202
|
+
export {
|
|
203
|
+
PdContactUs
|
|
204
|
+
};
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { PDColorStyles, PDFontStyles } from "@progressive-development/pd-shared-styles";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import { LitElement, html, css } from 'lit';
|
|
9
|
-
import { PDColorStyles, PDFontStyles } from '@progressive-development/pd-shared-styles';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An example element.
|
|
13
|
-
*
|
|
14
|
-
* @slot - This element has a slot
|
|
15
|
-
* @csspart button - The button
|
|
16
|
-
*/
|
|
17
|
-
export class PdFooter extends LitElement {
|
|
7
|
+
class PdFooter extends LitElement {
|
|
18
8
|
/**
|
|
19
9
|
* Fired when footer link clicked.
|
|
20
10
|
* @event footer-link
|
|
21
11
|
*/
|
|
22
|
-
|
|
23
12
|
static get properties() {
|
|
24
13
|
return {
|
|
25
14
|
version: { type: String },
|
|
@@ -28,10 +17,10 @@ export class PdFooter extends LitElement {
|
|
|
28
17
|
footerLinks: { type: Array }
|
|
29
18
|
};
|
|
30
19
|
}
|
|
31
|
-
|
|
32
20
|
static get styles() {
|
|
33
21
|
return [
|
|
34
|
-
PDColorStyles,
|
|
22
|
+
PDColorStyles,
|
|
23
|
+
PDFontStyles,
|
|
35
24
|
css`
|
|
36
25
|
:host {
|
|
37
26
|
display: flex;
|
|
@@ -97,23 +86,22 @@ export class PdFooter extends LitElement {
|
|
|
97
86
|
.madeBy:hover {
|
|
98
87
|
color: var(--pd-default-col);
|
|
99
88
|
}
|
|
100
|
-
`
|
|
101
|
-
|
|
102
|
-
|
|
89
|
+
`
|
|
90
|
+
];
|
|
91
|
+
}
|
|
103
92
|
constructor() {
|
|
104
|
-
super();
|
|
93
|
+
super();
|
|
105
94
|
this.footerLinks = [];
|
|
106
|
-
this._mailTo =
|
|
95
|
+
this._mailTo = "info@progressive-development.com";
|
|
96
|
+
}
|
|
97
|
+
firstUpdated() {
|
|
107
98
|
}
|
|
108
|
-
|
|
109
|
-
firstUpdated() {}
|
|
110
|
-
|
|
111
99
|
render() {
|
|
112
100
|
return html`
|
|
113
101
|
|
|
114
102
|
<div class="footer-links">
|
|
115
103
|
<ul>
|
|
116
|
-
${this.footerLinks.map(link => html`
|
|
104
|
+
${this.footerLinks.map((link) => html`
|
|
117
105
|
<li class="item">
|
|
118
106
|
<a @click="${this._footerLinkClicked}" data-link="${link.key}">${link.name}</a>
|
|
119
107
|
</li>
|
|
@@ -122,30 +110,31 @@ export class PdFooter extends LitElement {
|
|
|
122
110
|
</div>
|
|
123
111
|
<div class="bottom-line">
|
|
124
112
|
<div>
|
|
125
|
-
${this.copyright ? html`<span class="copyright">© ${this.copyright}, </span>` :
|
|
126
|
-
${this.version ? html`<span class="version">${this.version}</span>` :
|
|
113
|
+
${this.copyright ? html`<span class="copyright">© ${this.copyright}, </span>` : ""}
|
|
114
|
+
${this.version ? html`<span class="version">${this.version}</span>` : ""}
|
|
127
115
|
</div>
|
|
128
|
-
${this.madeBy ? html`<span class="madeBy" @click="${this._clickMadeby}">${this.madeBy.txt}</span>` :
|
|
116
|
+
${this.madeBy ? html`<span class="madeBy" @click="${this._clickMadeby}">${this.madeBy.txt}</span>` : ""}
|
|
129
117
|
</div>
|
|
130
118
|
`;
|
|
131
119
|
}
|
|
132
|
-
|
|
133
120
|
_clickMadeby() {
|
|
134
121
|
if (this.madeBy.email) {
|
|
135
122
|
window.location.href = `mailto:${this.madeBy.email}`;
|
|
136
123
|
} else if (this.madeBy.link) {
|
|
137
|
-
window.open(this.madeBy.link,
|
|
124
|
+
window.open(this.madeBy.link, "_blank");
|
|
138
125
|
}
|
|
139
126
|
}
|
|
140
|
-
|
|
141
127
|
_footerLinkClicked(e) {
|
|
142
128
|
const linkKey = e.target.dataset.link;
|
|
143
129
|
this.dispatchEvent(
|
|
144
|
-
new CustomEvent(
|
|
130
|
+
new CustomEvent("footer-link", {
|
|
145
131
|
detail: {
|
|
146
|
-
linkObj: this.footerLinks.filter(fl => fl.key === linkKey)[0]
|
|
132
|
+
linkObj: this.footerLinks.filter((fl) => fl.key === linkKey)[0]
|
|
147
133
|
}
|
|
148
134
|
})
|
|
149
|
-
);
|
|
135
|
+
);
|
|
150
136
|
}
|
|
151
137
|
}
|
|
138
|
+
export {
|
|
139
|
+
PdFooter
|
|
140
|
+
};
|
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { updateWhenLocaleChanges } from "@lit/localize";
|
|
3
|
+
import { installMediaQueryWatcher } from "pwa-helpers/media-query.js";
|
|
4
|
+
import { ICON_TOOGLE_ARROW, ICON_BURGER_MENU } from "@progressive-development/pd-icon";
|
|
5
|
+
import "@progressive-development/pd-icon/pd-icon";
|
|
6
|
+
import { PDColorStyles, PDFontStyles } from "@progressive-development/pd-shared-styles";
|
|
2
7
|
/**
|
|
3
8
|
* @license
|
|
4
9
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
5
10
|
*/
|
|
6
|
-
|
|
7
|
-
import { LitElement, html, css } from 'lit';
|
|
8
|
-
import { updateWhenLocaleChanges } from '@lit/localize';
|
|
9
|
-
import { installMediaQueryWatcher } from 'pwa-helpers/media-query.js';
|
|
10
|
-
import { ICON_TOOGLE_ARROW as toggleArrow, ICON_BURGER_MENU as burgerIcon } from '@progressive-development/pd-icon/src/PdIcon.js';
|
|
11
|
-
import '@progressive-development/pd-icon/pd-icon.js';
|
|
12
|
-
import { PDColorStyles, PDFontStyles } from '@progressive-development/pd-shared-styles';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* An example element.
|
|
16
|
-
*
|
|
17
|
-
* @slot - This element has a slot
|
|
18
|
-
* @csspart button - The button
|
|
19
|
-
*/
|
|
20
|
-
export class PdMenu extends LitElement {
|
|
21
|
-
|
|
11
|
+
class PdMenu extends LitElement {
|
|
22
12
|
/**
|
|
23
13
|
* Fired when route menu item clicked
|
|
24
14
|
* @event route-event
|
|
25
15
|
*/
|
|
26
|
-
|
|
27
16
|
static get styles() {
|
|
28
17
|
return [
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
PDColorStyles,
|
|
19
|
+
PDFontStyles,
|
|
20
|
+
css`
|
|
31
21
|
|
|
32
22
|
:host {
|
|
33
23
|
display: block;
|
|
@@ -260,42 +250,39 @@ export class PdMenu extends LitElement {
|
|
|
260
250
|
pointer-events: none;
|
|
261
251
|
}
|
|
262
252
|
|
|
263
|
-
`
|
|
253
|
+
`
|
|
254
|
+
];
|
|
264
255
|
}
|
|
265
|
-
|
|
266
256
|
static get properties() {
|
|
267
257
|
return {
|
|
268
258
|
activeRoute: { type: String },
|
|
269
259
|
selectedLocale: { type: String },
|
|
270
260
|
locales: { type: Array },
|
|
271
261
|
menuItems: { type: Array },
|
|
272
|
-
topMenuItems: { type: Array },
|
|
273
|
-
noBurgerMenu: { type: Boolean },
|
|
262
|
+
topMenuItems: { type: Array },
|
|
263
|
+
noBurgerMenu: { type: Boolean },
|
|
274
264
|
// At the moment needed for scroll to pistion => Refactor possible?
|
|
275
265
|
headerSize: { type: Number },
|
|
276
266
|
_activeSecIndex: { type: Number },
|
|
277
267
|
_smallScreen: { type: Boolean, state: true },
|
|
278
268
|
_activeBurgerMenu: { type: Boolean, reflect: true },
|
|
279
|
-
_activeLocaleMenu: { type: Boolean, reflect: true }
|
|
269
|
+
_activeLocaleMenu: { type: Boolean, reflect: true }
|
|
280
270
|
};
|
|
281
271
|
}
|
|
282
|
-
|
|
283
272
|
constructor() {
|
|
284
|
-
super();
|
|
273
|
+
super();
|
|
285
274
|
this.menuItems = [];
|
|
286
275
|
this.topMenuItems = [];
|
|
287
276
|
this.noBurgerMenu = false;
|
|
288
277
|
this._activeSecIndex = 0;
|
|
289
278
|
this._activeBurgerMenu = false;
|
|
290
279
|
this.headerSize = 0;
|
|
291
|
-
|
|
292
280
|
updateWhenLocaleChanges(this);
|
|
293
281
|
}
|
|
294
|
-
|
|
295
282
|
firstUpdated() {
|
|
296
283
|
const doSomething = (scrollPos) => {
|
|
297
284
|
let activeSecIndex = -1;
|
|
298
|
-
let distance = scrollPos > 300 ?
|
|
285
|
+
let distance = scrollPos > 300 ? 5e3 : 300;
|
|
299
286
|
this.menuItems.forEach((item, index) => {
|
|
300
287
|
if (item.ref) {
|
|
301
288
|
let distTmp = item.ref.getBoundingClientRect().top;
|
|
@@ -308,9 +295,8 @@ export class PdMenu extends LitElement {
|
|
|
308
295
|
});
|
|
309
296
|
this._activeSecIndex = activeSecIndex >= 0 ? activeSecIndex + 1 : 0;
|
|
310
297
|
};
|
|
311
|
-
|
|
312
298
|
let ticking = false;
|
|
313
|
-
document.addEventListener(
|
|
299
|
+
document.addEventListener("scroll", () => {
|
|
314
300
|
const lastKnownScrollPosition = window.scrollY;
|
|
315
301
|
if (!ticking) {
|
|
316
302
|
window.requestAnimationFrame(() => {
|
|
@@ -320,8 +306,7 @@ export class PdMenu extends LitElement {
|
|
|
320
306
|
ticking = true;
|
|
321
307
|
}
|
|
322
308
|
});
|
|
323
|
-
|
|
324
|
-
installMediaQueryWatcher(`(max-width: 700px)`, matches => {
|
|
309
|
+
installMediaQueryWatcher(`(max-width: 700px)`, (matches) => {
|
|
325
310
|
if (matches) {
|
|
326
311
|
this._smallScreen = !this.noBurgerMenu;
|
|
327
312
|
} else {
|
|
@@ -329,9 +314,7 @@ export class PdMenu extends LitElement {
|
|
|
329
314
|
}
|
|
330
315
|
});
|
|
331
316
|
}
|
|
332
|
-
|
|
333
|
-
render() {
|
|
334
|
-
|
|
317
|
+
render() {
|
|
335
318
|
return html`
|
|
336
319
|
<div class="menu-container">
|
|
337
320
|
|
|
@@ -348,9 +331,9 @@ export class PdMenu extends LitElement {
|
|
|
348
331
|
${(this.locales && this.locales.length) > 1 ? html`
|
|
349
332
|
<li class="item menu-li locale-li" @click="${this._toggleLocaleSelection}">
|
|
350
333
|
${this.selectedLocale}
|
|
351
|
-
<pd-icon class="locale-selection-logo" icon="${
|
|
334
|
+
<pd-icon class="locale-selection-logo" icon="${ICON_TOOGLE_ARROW}" ?activeIcon="${!this._activeLocaleMenu}"></pd-icon>
|
|
352
335
|
<ul class="menu-ul locale-ul">
|
|
353
|
-
${this.locales.filter(l => l !== this.selectedLocale).map(locale => html`
|
|
336
|
+
${this.locales.filter((l) => l !== this.selectedLocale).map((locale) => html`
|
|
354
337
|
<li class="item menu-li burger-li burger-item locale-item"
|
|
355
338
|
data-key="${locale}"
|
|
356
339
|
@click="${this._localeClicked}"
|
|
@@ -360,13 +343,13 @@ export class PdMenu extends LitElement {
|
|
|
360
343
|
`)}
|
|
361
344
|
</ul>
|
|
362
345
|
</li>
|
|
363
|
-
` :
|
|
346
|
+
` : ""}
|
|
364
347
|
</ul>
|
|
365
348
|
` : html`
|
|
366
349
|
<div class="menu-wrapper">
|
|
367
350
|
<div class="burger-menu" @click="${this._toggleBurgerMenu}">
|
|
368
|
-
<pd-icon class="burgerLogo" icon="${
|
|
369
|
-
<span class="item ${this._activeBurgerMenu ?
|
|
351
|
+
<pd-icon class="burgerLogo" icon="${ICON_BURGER_MENU}" ?activeIcon="${!this._activeBurgerMenu}"></pd-icon>
|
|
352
|
+
<span class="item ${this._activeBurgerMenu ? "active" : ""}">Menu</span>
|
|
370
353
|
</div>
|
|
371
354
|
</div>
|
|
372
355
|
`}
|
|
@@ -374,114 +357,93 @@ export class PdMenu extends LitElement {
|
|
|
374
357
|
</div>
|
|
375
358
|
`;
|
|
376
359
|
}
|
|
377
|
-
|
|
378
360
|
_renderItems(items, checkActiveClass, disableIcons) {
|
|
379
361
|
return html`
|
|
380
362
|
${items.map(
|
|
381
|
-
|
|
363
|
+
(item, index) => html`
|
|
382
364
|
<li
|
|
383
365
|
class="item menu-li ${this._smallScreen ? "burger-li burger-item" : ""}
|
|
384
|
-
${
|
|
385
|
-
? 'active'
|
|
386
|
-
: ''}"
|
|
366
|
+
${checkActiveClass && this._activeSecIndex === index + 1 || item.route && item.route === this.activeRoute ? "active" : ""}"
|
|
387
367
|
data-key="${item.key}"
|
|
388
368
|
@click="${this._menuItemClicked}"
|
|
389
369
|
>
|
|
390
|
-
${item.icon && !disableIcons
|
|
391
|
-
? html`<pd-icon
|
|
370
|
+
${item.icon && !disableIcons ? html`<pd-icon
|
|
392
371
|
class="topItemLogo"
|
|
393
372
|
icon="${item.icon}"
|
|
394
|
-
></pd-icon>`
|
|
395
|
-
: ''}
|
|
373
|
+
></pd-icon>` : ""}
|
|
396
374
|
${item.name}
|
|
397
375
|
</li>
|
|
398
376
|
`
|
|
399
|
-
|
|
377
|
+
)}
|
|
400
378
|
`;
|
|
401
379
|
}
|
|
402
|
-
|
|
403
380
|
_toggleBurgerMenu() {
|
|
404
381
|
this._activeBurgerMenu = !this._activeBurgerMenu;
|
|
405
382
|
}
|
|
406
|
-
|
|
407
383
|
_toggleLocaleSelection() {
|
|
408
384
|
this._activeLocaleMenu = !this._activeLocaleMenu;
|
|
409
385
|
}
|
|
410
|
-
|
|
411
386
|
_localeClicked(e) {
|
|
412
387
|
const keyParam = e.target.dataset.key;
|
|
413
388
|
this.dispatchEvent(new CustomEvent("locale-change", {
|
|
414
389
|
detail: keyParam
|
|
415
390
|
}));
|
|
416
391
|
}
|
|
417
|
-
|
|
418
|
-
_menuItemClicked(e) {
|
|
419
|
-
|
|
420
|
-
// get menu item
|
|
392
|
+
_menuItemClicked(e) {
|
|
421
393
|
const keyParam = e.target.dataset.key;
|
|
422
|
-
const menuItem = this.menuItems.filter(mi => mi.key === keyParam)[0]
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if (menuItem.sec && menuItem.sec !== '') {
|
|
426
|
-
// TODO: Check if element exists
|
|
394
|
+
const menuItem = this.menuItems.filter((mi) => mi.key === keyParam)[0] || this.topMenuItems.filter((mi) => mi.key === keyParam)[0];
|
|
395
|
+
if (menuItem.sec && menuItem.sec !== "") {
|
|
427
396
|
this._scrollToContent(menuItem.sec);
|
|
428
|
-
} else if (menuItem.route && menuItem.route !==
|
|
397
|
+
} else if (menuItem.route && menuItem.route !== "") {
|
|
429
398
|
this.dispatchEvent(
|
|
430
|
-
new CustomEvent(
|
|
399
|
+
new CustomEvent("route-event", {
|
|
431
400
|
detail: {
|
|
432
|
-
route: menuItem.route ===
|
|
401
|
+
route: menuItem.route === "back" ? "" : menuItem.route
|
|
433
402
|
},
|
|
434
403
|
composed: true,
|
|
435
|
-
bubbles: true
|
|
404
|
+
bubbles: true
|
|
436
405
|
})
|
|
437
406
|
);
|
|
438
407
|
} else if (menuItem.action) {
|
|
439
|
-
// call action
|
|
440
408
|
menuItem.action();
|
|
441
409
|
}
|
|
442
|
-
|
|
443
|
-
// close menu if open
|
|
444
410
|
if (this._activeBurgerMenu) {
|
|
445
411
|
this._activeBurgerMenu = !this._activeBurgerMenu;
|
|
446
412
|
}
|
|
447
413
|
}
|
|
448
|
-
|
|
449
414
|
static _scrollToTop() {
|
|
450
415
|
window.scrollTo({
|
|
451
416
|
top: 0,
|
|
452
417
|
left: 0,
|
|
453
|
-
behavior:
|
|
418
|
+
behavior: "smooth"
|
|
454
419
|
});
|
|
455
420
|
}
|
|
456
|
-
|
|
457
421
|
_scrollToContent(section) {
|
|
458
|
-
|
|
459
|
-
// check reference
|
|
460
|
-
const selMenuItem =
|
|
461
|
-
this.menuItems.filter(item => item.sec === section)[0] || {};
|
|
422
|
+
const selMenuItem = this.menuItems.filter((item) => item.sec === section)[0] || {};
|
|
462
423
|
const el = selMenuItem.ref;
|
|
463
424
|
if (el) {
|
|
464
425
|
const rect = el.getBoundingClientRect();
|
|
465
|
-
// https://www.mediaevent.de/javascript/scroll.html
|
|
466
426
|
window.scrollBy({
|
|
467
|
-
top: rect.top -
|
|
427
|
+
top: rect.top - this.headerSize,
|
|
468
428
|
left: 0,
|
|
469
|
-
behavior:
|
|
429
|
+
behavior: "smooth"
|
|
470
430
|
});
|
|
471
431
|
}
|
|
472
432
|
}
|
|
473
|
-
|
|
474
433
|
// eslint-disable-next-line class-methods-use-this
|
|
475
434
|
_logoClicked() {
|
|
476
435
|
PdMenu._scrollToTop();
|
|
477
436
|
this.dispatchEvent(
|
|
478
|
-
new CustomEvent(
|
|
437
|
+
new CustomEvent("route-event", {
|
|
479
438
|
detail: {
|
|
480
|
-
route:
|
|
439
|
+
route: ""
|
|
481
440
|
},
|
|
482
441
|
composed: true,
|
|
483
|
-
bubbles: true
|
|
442
|
+
bubbles: true
|
|
484
443
|
})
|
|
485
444
|
);
|
|
486
445
|
}
|
|
487
446
|
}
|
|
447
|
+
export {
|
|
448
|
+
PdMenu
|
|
449
|
+
};
|