Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
66644364b5 | |||
51febdae06 | |||
745ff299dc | |||
3606d60ba6 | |||
8970a79141 | |||
566a7ce148 | |||
362bef15e3 | |||
446c494863 | |||
dbe2f2f217 | |||
02ca92a431 | |||
a9015e787c | |||
9cd28fa819 | |||
7b3793e943 | |||
a22c04d98d | |||
5367512292 | |||
9c387f8ace | |||
c3ec288d09 | |||
9d952afebb | |||
621262fde7 | |||
e3e79d9a11 |
@ -1,6 +1,6 @@
|
|||||||
// dees tools
|
// dees tools
|
||||||
import * as deesWccTools from '@designestate/dees-wcctools';
|
import * as deesWccTools from '@design.estate/dees-wcctools';
|
||||||
import * as deesDomTools from '@designestate/dees-domtools';
|
import * as deesDomTools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
// elements and pages
|
// elements and pages
|
||||||
import * as elements from '../ts_web/elements/index.js';
|
import * as elements from '../ts_web/elements/index.js';
|
||||||
|
16
package.json
16
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@design.estate/dees-catalog",
|
"name": "@design.estate/dees-catalog",
|
||||||
"version": "1.0.173",
|
"version": "1.0.183",
|
||||||
"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",
|
||||||
@ -15,27 +15,27 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@design.estate/dees-domtools": "^2.0.37",
|
"@design.estate/dees-domtools": "^2.0.38",
|
||||||
"@design.estate/dees-element": "^2.0.25",
|
"@design.estate/dees-element": "^2.0.25",
|
||||||
"@design.estate/dees-wcctools": "^1.0.78",
|
"@design.estate/dees-wcctools": "^1.0.78",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.4.2",
|
"@fortawesome/free-brands-svg-icons": "^6.4.2",
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.4.2",
|
"@fortawesome/free-regular-svg-icons": "^6.4.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
||||||
"@push.rocks/smartpromise": "^4.0.0",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@push.rocks/smartstring": "^4.0.5",
|
"@push.rocks/smartstring": "^4.0.8",
|
||||||
"@tsclass/tsclass": "^4.0.42",
|
"@tsclass/tsclass": "^4.0.42",
|
||||||
"highlight.js": "11.8.0",
|
"highlight.js": "11.8.0",
|
||||||
"pdfjs-dist": "^2.15.349"
|
"pdfjs-dist": "^2.16.105"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.66",
|
"@gitzone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsbundle": "^2.0.8",
|
"@gitzone/tsbundle": "^2.0.8",
|
||||||
"@gitzone/tstest": "^1.0.77",
|
"@gitzone/tstest": "^1.0.77",
|
||||||
"@gitzone/tswatch": "^2.0.7",
|
"@gitzone/tswatch": "^2.0.7",
|
||||||
"@push.rocks/projectinfo": "^5.0.1",
|
"@push.rocks/projectinfo": "^5.0.2",
|
||||||
"@push.rocks/tapbundle": "^5.0.12",
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
"@types/node": "^20.4.8"
|
"@types/node": "^20.5.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
1404
pnpm-lock.yaml
generated
1404
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-catalog',
|
name: '@design.estate/dees-catalog',
|
||||||
version: '1.0.173',
|
version: '1.0.183',
|
||||||
description: 'website for lossless.com'
|
description: 'website for lossless.com'
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ export class DeesFormSubmit extends DeesElement {
|
|||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
reflect: true,
|
||||||
})
|
})
|
||||||
public disabled = false;
|
public disabled = false;
|
||||||
|
|
||||||
|
@ -7,9 +7,15 @@ import { DeesInputQuantitySelector } from './dees-input-quantityselector.js';
|
|||||||
import { DeesInputRadio } from './dees-input-radio.js';
|
import { DeesInputRadio } from './dees-input-radio.js';
|
||||||
import { DeesFormSubmit } from './dees-form-submit.js';
|
import { DeesFormSubmit } from './dees-form-submit.js';
|
||||||
|
|
||||||
export type TFormElement = Array<
|
// Unified set for form input types
|
||||||
DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio
|
const FORM_INPUT_TYPES = [
|
||||||
>;
|
DeesInputCheckbox,
|
||||||
|
DeesInputText,
|
||||||
|
DeesInputQuantitySelector,
|
||||||
|
DeesInputRadio
|
||||||
|
];
|
||||||
|
|
||||||
|
export type TFormInputElement = DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio;
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -19,6 +25,7 @@ declare global {
|
|||||||
|
|
||||||
@customElement('dees-form')
|
@customElement('dees-form')
|
||||||
export class DeesForm extends DeesElement {
|
export class DeesForm extends DeesElement {
|
||||||
|
|
||||||
public static demo = () => html`
|
public static demo = () => html`
|
||||||
<dees-form
|
<dees-form
|
||||||
style="display: block; margin:auto; max-width: 500px; padding: 20px"
|
style="display: block; margin:auto; max-width: 500px; padding: 20px"
|
||||||
@ -31,17 +38,14 @@ export class DeesForm extends DeesElement {
|
|||||||
>
|
>
|
||||||
<dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
|
<dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
|
||||||
<dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
|
<dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
|
||||||
<dees-input-checkbox
|
<dees-input-checkbox .required="${true}" key="hello3" label="another text"></dees-input-checkbox>
|
||||||
.required="${true}"
|
|
||||||
key="hello3"
|
|
||||||
label="another text"
|
|
||||||
></dees-input-checkbox>
|
|
||||||
<dees-form-submit>Submit</dees-form-submit>
|
<dees-form-submit>Submit</dees-form-submit>
|
||||||
</dees-form>
|
</dees-form>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
public name: string = 'myform';
|
public name: string = 'myform';
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
public readyDeferred = domtools.plugins.smartpromise.defer();
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
@ -55,51 +59,38 @@ export class DeesForm extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async firstUpdated() {
|
public async firstUpdated() {
|
||||||
const formChildren = this.getFormChildren();
|
const formChildren = this.getFormElements();
|
||||||
this.checkRequiredStatus();
|
this.updateRequiredStatus();
|
||||||
|
|
||||||
for (const child of formChildren) {
|
for (const child of formChildren) {
|
||||||
child.changeSubject.subscribe(async (elementArg: TFormElement) => {
|
child.changeSubject.subscribe(async () => {
|
||||||
const valueObject = await this.gatherData();
|
const valueObject = await this.collectFormData();
|
||||||
this.changeSubject.next(valueObject);
|
this.changeSubject.next(valueObject);
|
||||||
console.log(valueObject);
|
console.log(valueObject);
|
||||||
this.checkRequiredStatus();
|
this.updateRequiredStatus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await this.instrumentBehaviours();
|
await this.addBehaviours();
|
||||||
|
this.readyDeferred.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getFormChildren() {
|
public getFormElements(): Array<TFormInputElement> {
|
||||||
const children: Array<DeesElement> = this.children as any;
|
return (Array.from(this.children)).filter(child =>
|
||||||
const formChildren: TFormElement = [];
|
FORM_INPUT_TYPES.includes(child.constructor as any)
|
||||||
|
) as unknown as TFormInputElement[];
|
||||||
for (const child of children) {
|
|
||||||
if (
|
|
||||||
child instanceof DeesInputCheckbox ||
|
|
||||||
child instanceof DeesInputText ||
|
|
||||||
child instanceof DeesInputQuantitySelector
|
|
||||||
) {
|
|
||||||
formChildren.push(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return formChildren;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSubmitButton() {
|
public getSubmitButton(): DeesFormSubmit | undefined {
|
||||||
const children: Array<DeesElement> = this.children as any;
|
return Array.from(this.children).find(child =>
|
||||||
let submitButton: DeesFormSubmit;
|
child instanceof DeesFormSubmit
|
||||||
for (const childArg of children) {
|
) as DeesFormSubmit;
|
||||||
if (childArg instanceof DeesFormSubmit) {
|
|
||||||
submitButton = childArg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return submitButton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async checkRequiredStatus() {
|
public async updateRequiredStatus() {
|
||||||
console.log('checking the required status.');
|
console.log('checking the required status.');
|
||||||
|
|
||||||
let requiredOK = true;
|
let requiredOK = true;
|
||||||
for (const childArg of this.getFormChildren()) {
|
for (const childArg of this.getFormElements()) {
|
||||||
if (childArg.required && !childArg.value) {
|
if (childArg.required && !childArg.value) {
|
||||||
requiredOK = false;
|
requiredOK = false;
|
||||||
}
|
}
|
||||||
@ -109,17 +100,20 @@ export class DeesForm extends DeesElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async gatherData() {
|
public async collectFormData() {
|
||||||
const children = this.getFormChildren();
|
const children = this.getFormElements();
|
||||||
const valueObject: { [key: string]: string | number | boolean } = {};
|
const valueObject: { [key: string]: string | number | boolean } = {};
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
|
if (!child.key) {
|
||||||
|
console.log(`form element with label "${child.label}" has no key. skipping.`);
|
||||||
|
}
|
||||||
valueObject[child.key] = child.value;
|
valueObject[child.key] = child.value;
|
||||||
}
|
}
|
||||||
return valueObject;
|
return valueObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async gatherAndDispatch() {
|
public async gatherAndDispatch() {
|
||||||
const valueObject = await this.gatherData();
|
const valueObject = await this.collectFormData();
|
||||||
const formDataEvent = new CustomEvent('formData', {
|
const formDataEvent = new CustomEvent('formData', {
|
||||||
detail: {
|
detail: {
|
||||||
data: valueObject,
|
data: valueObject,
|
||||||
@ -135,7 +129,7 @@ export class DeesForm extends DeesElement {
|
|||||||
visualStateArg: 'normal' | 'pending' | 'error' | 'success',
|
visualStateArg: 'normal' | 'pending' | 'error' | 'success',
|
||||||
textStateArg: string
|
textStateArg: string
|
||||||
) {
|
) {
|
||||||
const inputChildren = this.getFormChildren();
|
const inputChildren = this.getFormElements();
|
||||||
const submitButton = this.getSubmitButton();
|
const submitButton = this.getSubmitButton();
|
||||||
|
|
||||||
switch (visualStateArg) {
|
switch (visualStateArg) {
|
||||||
@ -172,20 +166,35 @@ export class DeesForm extends DeesElement {
|
|||||||
submitButton.text = textStateArg;
|
submitButton.text = textStateArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async instrumentBehaviours() {
|
/**
|
||||||
const children = this.getFormChildren();
|
* resets the form
|
||||||
for (const child of children) {
|
*/
|
||||||
child.addEventListener('keydown', (eventArg) => {
|
reset() {
|
||||||
if (eventArg.key === 'Enter') {
|
const inputChildren = this.getFormElements();
|
||||||
const currentIndex = children.indexOf(child);
|
const submitButton = this.getSubmitButton();
|
||||||
|
|
||||||
|
for (const inputChild of inputChildren) {
|
||||||
|
inputChild.value = null;
|
||||||
|
}
|
||||||
|
this.setStatus('normal', 'Submit');
|
||||||
|
}
|
||||||
|
|
||||||
|
public async addBehaviours() {
|
||||||
|
// Use event delegation
|
||||||
|
this.addEventListener('keydown', (event: KeyboardEvent) => {
|
||||||
|
const target = event.target as DeesElement;
|
||||||
|
if (!FORM_INPUT_TYPES.includes(target.constructor as any)) return;
|
||||||
|
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
const children = this.getFormElements();
|
||||||
|
const currentIndex = children.indexOf(target as any);
|
||||||
if (currentIndex < children.length - 1) {
|
if (currentIndex < children.length - 1) {
|
||||||
children[currentIndex + 1].focus();
|
children[currentIndex + 1].focus();
|
||||||
} else {
|
} else {
|
||||||
children[currentIndex].blur();
|
target.blur();
|
||||||
this.getSubmitButton().focus();
|
this.getSubmitButton()?.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ export class DeesInputCheckbox extends DeesElement {
|
|||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
|
reflect: true,
|
||||||
})
|
})
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ export class DeesInputCheckbox extends DeesElement {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="maincontainer" @click="${this.toggleSelected}">
|
<div class="maincontainer" @click="${this.toggleSelected}">
|
||||||
<div class="checkbox ${this.value ? 'selected' : ''} ${this.disabled ? 'disabled' : ''}">
|
<div class="checkbox ${this.value ? 'selected' : ''} ${this.disabled ? 'disabled' : ''}" tabindex="0">
|
||||||
${this.value
|
${this.value
|
||||||
? html`
|
? html`
|
||||||
<span class="checkmark">
|
<span class="checkmark">
|
||||||
@ -172,4 +173,11 @@ export class DeesInputCheckbox extends DeesElement {
|
|||||||
);
|
);
|
||||||
this.changeSubject.next(this);
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public focus(): void {
|
||||||
|
const checkboxDiv = this.shadowRoot.querySelector('.checkbox');
|
||||||
|
if (checkboxDiv) {
|
||||||
|
(checkboxDiv as any).focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,10 @@ export class DeesInputDropdown extends DeesElement {
|
|||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property({
|
||||||
|
type: String,
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
public label: string = 'Label';
|
public label: string = 'Label';
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
|
@ -32,6 +32,7 @@ export class DeesInputFileupload extends DeesElement {
|
|||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
|
reflect: true,
|
||||||
})
|
})
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@ -155,8 +156,11 @@ export class DeesInputFileupload extends DeesElement {
|
|||||||
public async openFileSelector() {
|
public async openFileSelector() {
|
||||||
const inputFile: HTMLInputElement = this.shadowRoot.querySelector('input[type="file"]');
|
const inputFile: HTMLInputElement = this.shadowRoot.querySelector('input[type="file"]');
|
||||||
inputFile.click();
|
inputFile.click();
|
||||||
|
this.state = 'idle';
|
||||||
|
this.buttonText = 'Upload more files...';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async updateValue(eventArg: Event) {
|
public async updateValue(eventArg: Event) {
|
||||||
const target: any = eventArg.target;
|
const target: any = eventArg.target;
|
||||||
this.value = target.value;
|
this.value = target.value;
|
||||||
@ -164,6 +168,20 @@ export class DeesInputFileupload extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public firstUpdated() {
|
public firstUpdated() {
|
||||||
|
const inputFile: HTMLInputElement = this.shadowRoot.querySelector('input[type="file"]');
|
||||||
|
inputFile.addEventListener('change', (event: Event) => {
|
||||||
|
const target = event.target as HTMLInputElement;
|
||||||
|
for (const file of Array.from(target.files)) {
|
||||||
|
this.value.push(file);
|
||||||
|
}
|
||||||
|
this.requestUpdate();
|
||||||
|
console.log(`Got ${this.value.length} files!`);
|
||||||
|
// Reset the input value to allow selecting the same file again if needed
|
||||||
|
target.value = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// lets handle drag and drop
|
||||||
const dropArea = this.shadowRoot.querySelector('.uploadButton');
|
const dropArea = this.shadowRoot.querySelector('.uploadButton');
|
||||||
const handlerFunction = (eventArg: DragEvent) => {
|
const handlerFunction = (eventArg: DragEvent) => {
|
||||||
eventArg.preventDefault();
|
eventArg.preventDefault();
|
||||||
|
@ -15,6 +15,12 @@ export class DeesInputQuantitySelector extends DeesElement {
|
|||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
|
public label: string = 'Label';
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
|
@ -14,7 +14,10 @@ export class DeesInputRadio extends DeesElement {
|
|||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property({
|
||||||
|
type: String,
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
|
@ -24,7 +24,8 @@ export class DeesInputText extends DeesElement {
|
|||||||
public label: string;
|
public label: string;
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String
|
type: String,
|
||||||
|
reflect: true,
|
||||||
})
|
})
|
||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ export class DeesInputText extends DeesElement {
|
|||||||
</style>
|
</style>
|
||||||
<div class="maincontainer">
|
<div class="maincontainer">
|
||||||
${this.label ? html`<div class="label">${this.label}</div>` : html``}
|
${this.label ? html`<div class="label">${this.label}</div>` : html``}
|
||||||
<input type="${this.isPasswordBool && !this.showPasswordBool ? 'password' : 'text'}" value=${this.value} @input="${this.updateValue}" .disabled=${this.disabled} />
|
<input type="${this.isPasswordBool && !this.showPasswordBool ? 'password' : 'text'}" .value=${this.value} @input="${this.updateValue}" .disabled=${this.disabled} />
|
||||||
${this.isPasswordBool ? html`
|
${this.isPasswordBool ? html`
|
||||||
<div class="showPassword" @click=${this.togglePasswordView}>
|
<div class="showPassword" @click=${this.togglePasswordView}>
|
||||||
<dees-icon .iconFA=${this.showPasswordBool ? 'eye' : 'eyeSlash'}></dees-icon>
|
<dees-icon .iconFA=${this.showPasswordBool ? 'eye' : 'eyeSlash'}></dees-icon>
|
||||||
|
122
ts_web/elements/dees-simple-login.ts
Normal file
122
ts_web/elements/dees-simple-login.ts
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
import {
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
DeesElement,
|
||||||
|
property,
|
||||||
|
type TemplateResult,
|
||||||
|
cssManager,
|
||||||
|
css,
|
||||||
|
unsafeCSS,
|
||||||
|
type CSSResult,
|
||||||
|
state,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-simple-login': DeesSimpleLogin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-simple-login')
|
||||||
|
export class DeesSimpleLogin extends DeesElement {
|
||||||
|
// STATIC
|
||||||
|
public static demo = () => html`
|
||||||
|
<dees-simple-login>
|
||||||
|
Hello there
|
||||||
|
</dees-simple-login>
|
||||||
|
`;
|
||||||
|
// INSTANCE
|
||||||
|
|
||||||
|
@property()
|
||||||
|
public title = 'Dees Simple Login';
|
||||||
|
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
:host {
|
||||||
|
color: ${cssManager.bdTheme('#333', '#fff')};
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.loginContainer {
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center; /* aligns horizontally */
|
||||||
|
align-items: center; /* aligns vertically */
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.login {
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100px;
|
||||||
|
background: ${cssManager.bdTheme('#eeeeeb', '#111')};
|
||||||
|
box-shadow: ${cssManager.bdTheme('0px 1px 4px rgba(0,0,0,0.3)', 'none')};
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 24px;
|
||||||
|
transition: opacity 0.3s, transform 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.slotContainer {
|
||||||
|
opacity:0;
|
||||||
|
transition: opacity 0.3s, transform 0.3s;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<div class="loginContainer">
|
||||||
|
<div class="login">
|
||||||
|
<dees-form>
|
||||||
|
<div class="header">Login to ${this.title}</div>
|
||||||
|
<dees-input-text key="username" label="username" required></dees-input-text>
|
||||||
|
<dees-input-text key="password" label="password" isPasswordBool required></dees-input-text>
|
||||||
|
<dees-form-submit disabled>login</dees-form-submit>
|
||||||
|
</dees-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="slotContainer">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async firstUpdated(_changedProperties): Promise<void> {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
super.firstUpdated(_changedProperties);
|
||||||
|
const form = this.shadowRoot.querySelector('dees-form');
|
||||||
|
await form.readyDeferred.promise;
|
||||||
|
const username = this.shadowRoot.querySelector('dees-input-text[label="username"]');
|
||||||
|
const password = this.shadowRoot.querySelector('dees-input-text[label="password"]');
|
||||||
|
const submit = this.shadowRoot.querySelector('dees-form-submit');
|
||||||
|
form.addEventListener('formData', (event: CustomEvent) => {
|
||||||
|
this.dispatchEvent(new CustomEvent('login', { detail: event.detail }));
|
||||||
|
// this.switchToSlottedContent();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allows switching to slotted content
|
||||||
|
*/
|
||||||
|
public async switchToSlottedContent() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
const loginDiv: HTMLDivElement = this.shadowRoot.querySelector('.login');
|
||||||
|
const loginContainerDiv: HTMLDivElement = this.shadowRoot.querySelector('.loginContainer');
|
||||||
|
const slotContainerDiv: HTMLDivElement = this.shadowRoot.querySelector('.slotContainer');
|
||||||
|
loginDiv.style.opacity = '0';
|
||||||
|
loginDiv.style.transform = 'translateY(20px)';
|
||||||
|
loginContainerDiv.style.pointerEvents = 'none';
|
||||||
|
slotContainerDiv.style.transform = 'translateY(20px)';
|
||||||
|
await domtools.convenience.smartdelay.delayFor(300);
|
||||||
|
slotContainerDiv.style.opacity = '1';
|
||||||
|
slotContainerDiv.style.transform = 'translateY(0px)';
|
||||||
|
await domtools.convenience.smartdelay.delayFor(300);
|
||||||
|
slotContainerDiv.style.pointerEvents = 'all';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
3
ts_web/elements/helperclasses/formcontroller.ts
Normal file
3
ts_web/elements/helperclasses/formcontroller.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export class FormController {
|
||||||
|
|
||||||
|
}
|
@ -4,8 +4,8 @@ export * from './dees-chips.js';
|
|||||||
export * from './dees-contextmenu.js';
|
export * from './dees-contextmenu.js';
|
||||||
export * from './dees-dataview-codebox.js';
|
export * from './dees-dataview-codebox.js';
|
||||||
export * from './dees-dataview-statusobject.js';
|
export * from './dees-dataview-statusobject.js';
|
||||||
export * from './dees-form.js';
|
|
||||||
export * from './dees-form-submit.js';
|
export * from './dees-form-submit.js';
|
||||||
|
export * from './dees-form.js';
|
||||||
export * from './dees-icon.js';
|
export * from './dees-icon.js';
|
||||||
export * from './dees-input-checkbox.js';
|
export * from './dees-input-checkbox.js';
|
||||||
export * from './dees-input-dropdown.js';
|
export * from './dees-input-dropdown.js';
|
||||||
@ -15,6 +15,7 @@ export * from './dees-input-radio.js';
|
|||||||
export * from './dees-input-text.js';
|
export * from './dees-input-text.js';
|
||||||
export * from './dees-mobilenavigation.js';
|
export * from './dees-mobilenavigation.js';
|
||||||
export * from './dees-pdf.js';
|
export * from './dees-pdf.js';
|
||||||
|
export * from './dees-simple-login.js';
|
||||||
export * from './dees-speechbubble.js';
|
export * from './dees-speechbubble.js';
|
||||||
export * from './dees-spinner.js';
|
export * from './dees-spinner.js';
|
||||||
export * from './dees-stepper.js';
|
export * from './dees-stepper.js';
|
||||||
|
@ -6,5 +6,8 @@
|
|||||||
"module": "ES2022",
|
"module": "ES2022",
|
||||||
"moduleResolution": "nodenext",
|
"moduleResolution": "nodenext",
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
}
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user