Compare commits

...

20 Commits

Author SHA1 Message Date
c450fb32ea 1.0.62 2021-09-14 17:31:16 +02:00
6554bfd721 fix(core): update 2021-09-14 17:31:16 +02:00
9ce4ca14b8 1.0.61 2021-09-10 15:56:37 +02:00
76bcda760c fix(core): update 2021-09-10 15:56:37 +02:00
6949aed381 1.0.60 2021-09-10 15:51:30 +02:00
1f3502685f fix(core): update 2021-09-10 15:51:30 +02:00
8d1451fffa 1.0.59 2021-09-10 15:42:16 +02:00
8b2fedf1d6 fix(core): update 2021-09-10 15:42:16 +02:00
30ffb2650a 1.0.58 2021-09-10 15:23:54 +02:00
55b65c7e4c fix(core): update 2021-09-10 15:23:54 +02:00
5c81dd540a 1.0.57 2021-09-10 15:02:48 +02:00
cb5bc809ea fix(core): update 2021-09-10 15:02:48 +02:00
ab1956c452 1.0.56 2021-09-09 00:35:11 +02:00
3b99796073 fix(core): update 2021-09-09 00:35:10 +02:00
20755775ea 1.0.55 2021-09-09 00:06:06 +02:00
4e1b797377 fix(core): update 2021-09-09 00:06:05 +02:00
4a3aa2d6d9 1.0.54 2021-09-09 00:02:36 +02:00
4e49045444 fix(core): update 2021-09-09 00:02:35 +02:00
9e54c973d5 1.0.53 2021-09-01 22:44:44 +02:00
122c535dec fix(core): update 2021-09-01 22:44:43 +02:00
3 changed files with 117 additions and 63 deletions

18
package-lock.json generated
View File

@ -1,15 +1,15 @@
{ {
"name": "@designestate/dees-catalog", "name": "@designestate/dees-catalog",
"version": "1.0.52", "version": "1.0.62",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@designestate/dees-catalog", "name": "@designestate/dees-catalog",
"version": "1.0.52", "version": "1.0.62",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@designestate/dees-domtools": "^1.0.90", "@designestate/dees-domtools": "^1.0.91",
"@designestate/dees-element": "^1.0.19", "@designestate/dees-element": "^1.0.19",
"@designestate/dees-wcctools": "^1.0.57", "@designestate/dees-wcctools": "^1.0.57",
"@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/fontawesome-svg-core": "^1.2.36",
@ -1893,9 +1893,9 @@
} }
}, },
"node_modules/@designestate/dees-domtools": { "node_modules/@designestate/dees-domtools": {
"version": "1.0.90", "version": "1.0.91",
"resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-1.0.90.tgz", "resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-1.0.91.tgz",
"integrity": "sha512-tQ8tlBunWMSza+kvZaCVExJnl45jgNGuqbK9bdPBczwllUAVNLVRNaAucEeMj1SiDAKOg8zwshkQJ4AWcjSidw==", "integrity": "sha512-1lsp3iBfI7dX1sm+TUI7U5xjSsxlaYjs7May9LmOaxg1M8oYJtcwnFsyQ4yeAAw7Nopucm+rOGjmdODcAr8V/Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.56", "@apiglobal/typedrequest": "^1.0.56",
@ -17435,9 +17435,9 @@
} }
}, },
"@designestate/dees-domtools": { "@designestate/dees-domtools": {
"version": "1.0.90", "version": "1.0.91",
"resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-1.0.90.tgz", "resolved": "https://verdaccio.lossless.one/@designestate%2fdees-domtools/-/dees-domtools-1.0.91.tgz",
"integrity": "sha512-tQ8tlBunWMSza+kvZaCVExJnl45jgNGuqbK9bdPBczwllUAVNLVRNaAucEeMj1SiDAKOg8zwshkQJ4AWcjSidw==", "integrity": "sha512-1lsp3iBfI7dX1sm+TUI7U5xjSsxlaYjs7May9LmOaxg1M8oYJtcwnFsyQ4yeAAw7Nopucm+rOGjmdODcAr8V/Q==",
"requires": { "requires": {
"@apiglobal/typedrequest": "^1.0.56", "@apiglobal/typedrequest": "^1.0.56",
"@designestate/dees-comms": "^1.0.9", "@designestate/dees-comms": "^1.0.9",

View File

@ -1,6 +1,6 @@
{ {
"name": "@designestate/dees-catalog", "name": "@designestate/dees-catalog",
"version": "1.0.52", "version": "1.0.62",
"private": false, "private": false,
"description": "website for lossless.com", "description": "website for lossless.com",
"main": "dist_ts_web/index.js", "main": "dist_ts_web/index.js",
@ -13,7 +13,7 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@designestate/dees-domtools": "^1.0.90", "@designestate/dees-domtools": "^1.0.91",
"@designestate/dees-element": "^1.0.19", "@designestate/dees-element": "^1.0.19",
"@designestate/dees-wcctools": "^1.0.57", "@designestate/dees-wcctools": "^1.0.57",
"@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/fontawesome-svg-core": "^1.2.36",

View File

@ -14,44 +14,69 @@ import * as domtools from '@designestate/dees-domtools';
export interface IStep { export interface IStep {
title: string; title: string;
content: TemplateResult; content: TemplateResult;
validationFunc?: (stepper: DeesStepper, htmlElement: HTMLElement) => Promise<any>;
onReturnToStepFunc?: (stepper: DeesStepper, htmlElement: HTMLElement) => Promise<any>;
validationFuncCalled?: boolean;
}
declare global {
interface HTMLElementTagNameMap {
'dees-stepper': DeesStepper;
}
} }
@customElement('dees-stepper') @customElement('dees-stepper')
export class DeesStepper extends DeesElement { export class DeesStepper extends DeesElement {
public static demo = () => html` <dees-stepper></dees-stepper> `; public static demo = () =>
html`
<dees-stepper
.steps=${[
{
title: 'Whats your name?',
content: html`
<dees-form>
<dees-input-text
key="email"
label="Your Email"
value="hello@something.com"
disabled
></dees-input-text>
<dees-input-text key="firstName" required label="Vorname"></dees-input-text>
<dees-input-text key="lastName" required label="Nachname"></dees-input-text>
<dees-form-submit>Next</dees-form-submit>
</dees-form>
`,
validationFunc: async (stepperArg, elementArg) => {
const deesForm = elementArg.querySelector('dees-form');
deesForm.addEventListener('formData', eventArg => {
stepperArg.goNext();
})
}
},
{
title: 'Whats your mobile number?',
content: html``,
},
{
title: 'Whats the verification code?',
content: html``,
},
{
title: 'Whats your new password?',
content: html``,
},
{
title: 'Verification:',
content: html``,
},
] as IStep[]}
></dees-stepper>
`;
@property({ @property({
type: Array, type: Array,
}) })
public steps: IStep[] = [ public steps: IStep[] = [];
{
title: 'Whats your name?',
content: html`
<dees-form>
<dees-input-text key="email" label="Your Email" value="hello@something.com" disabled></dees-input-text>
<dees-input-text key="firstName" required label="Vorname"></dees-input-text>
<dees-input-text key="lastName" required label="Nachname"></dees-input-text>
<dees-form-submit>Next</dees-form-submit>
</dees-form>
`,
},
{
title: 'Whats your mobile number?',
content: html``,
},
{
title: 'Whats the verification code?',
content: html``,
},
{
title: 'Whats your new password?',
content: html``,
},
{
title: 'Verification:',
content: html``,
},
];
@property({ @property({
type: Object, type: Object,
@ -90,20 +115,26 @@ export class DeesStepper extends DeesElement {
color: ${cssManager.bdTheme('#333', '#fff')}; color: ${cssManager.bdTheme('#333', '#fff')};
margin: auto; margin: auto;
margin-bottom: 20px; margin-bottom: 20px;
filter: opacity(0.5); filter: opacity(0.5) grayscale(1);
box-shadow: 0px 0px 3px #00000010; box-shadow: 0px 0px 3px #00000010;
user-select: none;
} }
.step.selected { .step.selected {
pointer-events: all; pointer-events: all;
filter: opacity(1); filter: opacity(1) grayscale(0);
box-shadow: 0px 0px 5px #00000010; box-shadow: 0px 0px 5px #00000010;
user-select: auto;
} }
.step.hiddenStep { .step.hiddenStep {
filter: opacity(0); filter: opacity(0);
} }
.stp:last-child {
margin-bottom: 100vh;
}
.step .stepCounter { .step .stepCounter {
position: absolute; position: absolute;
top: 0px; top: 0px;
@ -148,9 +179,20 @@ export class DeesStepper extends DeesElement {
<div class="stepperContainer"> <div class="stepperContainer">
${this.steps.map( ${this.steps.map(
(stepArg) => (stepArg) =>
html`<div class="step ${stepArg === this.selectedStep ? 'selected' : null} ${this.getIndexOfStep(stepArg) > this.getIndexOfStep(this.selectedStep) ? 'hiddenStep' : ''}"> html`<div
${this.getIndexOfStep(stepArg) > 0 ? html`<div class="goBack" @click=${this.goBack}><- go to previous step</div>` : ``} class="step ${stepArg === this.selectedStep
<div class="stepCounter">Step ${this.steps.findIndex(elementArg => elementArg === stepArg) + 1} of ${this.steps.length} </div> ? 'selected'
: null} ${this.getIndexOfStep(stepArg) > this.getIndexOfStep(this.selectedStep)
? 'hiddenStep'
: ''}"
>
${this.getIndexOfStep(stepArg) > 0
? html`<div class="goBack" @click=${this.goBack}><- go to previous step</div>`
: ``}
<div class="stepCounter">
Step ${this.steps.findIndex((elementArg) => elementArg === stepArg) + 1} of
${this.steps.length}
</div>
<div class="title">${stepArg.title}</div> <div class="title">${stepArg.title}</div>
<div class="content">${stepArg.content}</div> <div class="content">${stepArg.content}</div>
</div> ` </div> `
@ -160,22 +202,19 @@ export class DeesStepper extends DeesElement {
} }
public getIndexOfStep = (stepArg: IStep): number => { public getIndexOfStep = (stepArg: IStep): number => {
return this.steps.findIndex(stepArg2 => stepArg === stepArg2 ) return this.steps.findIndex((stepArg2) => stepArg === stepArg2);
} };
public firstUpdated() { public firstUpdated() {
this.selectedStep = this.steps[0]; this.selectedStep = this.steps[0];
this.setScrollStatus(); this.setScrollStatus();
domtools.plugins.smartdelay.delayFor(2000).then(() => {
this.goNext();
})
} }
public updated() { public updated() {
this.setScrollStatus(); this.setScrollStatus();
} }
public scroller: typeof domtools.plugins.sweetScroll.prototype; public scroller: typeof domtools.plugins.SweetScroll.prototype;
public async setScrollStatus() { public async setScrollStatus() {
await domtools.plugins.smartdelay.delayFor(50); await domtools.plugins.smartdelay.delayFor(50);
@ -183,30 +222,45 @@ export class DeesStepper extends DeesElement {
const firstStepElement: HTMLElement = this.shadowRoot.querySelector('.step'); const firstStepElement: HTMLElement = this.shadowRoot.querySelector('.step');
const selectedStepElement: HTMLElement = this.shadowRoot.querySelector('.selected'); const selectedStepElement: HTMLElement = this.shadowRoot.querySelector('.selected');
if (!stepperContainer.style.paddingTop) { if (!stepperContainer.style.paddingTop) {
stepperContainer.style.paddingTop = `${(stepperContainer.offsetHeight / 2) - (selectedStepElement.offsetHeight / 2)}px`; stepperContainer.style.paddingTop = `${
stepperContainer.offsetHeight / 2 - selectedStepElement.offsetHeight / 2
}px`;
} }
console.log('Setting scroll status'); console.log('Setting scroll status');
console.log(selectedStepElement); console.log(selectedStepElement);
const scrollPosition = selectedStepElement.offsetTop - (stepperContainer.offsetHeight / 2) + (selectedStepElement.offsetHeight / 2) ; const scrollPosition =
selectedStepElement.offsetTop -
stepperContainer.offsetHeight / 2 +
selectedStepElement.offsetHeight / 2;
console.log(scrollPosition); console.log(scrollPosition);
const domtoolsInstance = await domtools.DomTools.setupDomTools() const domtoolsInstance = await domtools.DomTools.setupDomTools();
if (!this.scroller) { if (!this.scroller) {
this.scroller = new domtools.plugins.sweetScroll({ this.scroller = new domtools.plugins.SweetScroll(
vertical: true, {
horizontal: false, vertical: true,
easing: 'easeInOutQuint' horizontal: false,
}, stepperContainer); easing: 'easeInOutQuint',
},
stepperContainer
);
}
if (!this.selectedStep.validationFuncCalled && this.selectedStep.validationFunc) {
this.selectedStep.validationFuncCalled = true;
await this.selectedStep.validationFunc(this, selectedStepElement);
} }
this.scroller.to(scrollPosition); this.scroller.to(scrollPosition);
} }
public goBack() { public async goBack() {
const currentIndex = this.steps.findIndex(stepArg => stepArg === this.selectedStep); const currentIndex = this.steps.findIndex((stepArg) => stepArg === this.selectedStep);
this.selectedStep = this.steps[currentIndex - 1]; this.selectedStep = this.steps[currentIndex - 1];
await this.domtoolsPromise;
await this.domtools.convenience.smartdelay.delayFor(100);
this.selectedStep.onReturnToStepFunc?.(this, this.shadowRoot.querySelector('.selected'));
} }
public goNext() { public goNext() {
const currentIndex = this.steps.findIndex(stepArg => stepArg === this.selectedStep); const currentIndex = this.steps.findIndex((stepArg) => stepArg === this.selectedStep);
this.selectedStep = this.steps[currentIndex + 1]; this.selectedStep = this.steps[currentIndex + 1];
} }
} }