Compare commits
72 Commits
Author | SHA1 | Date | |
---|---|---|---|
7b7c469fab | |||
d852186888 | |||
6cfda1ebf3 | |||
8e0062fdd5 | |||
844cc30551 | |||
64074e37fc | |||
cd9b028e9b | |||
81da871e38 | |||
90e78a2e31 | |||
5cec1fea73 | |||
52130d67e2 | |||
a73ad40eb1 | |||
6589818b0b | |||
555fa32ac2 | |||
50a84f2422 | |||
c724a3e85b | |||
b47530e254 | |||
b80fdf113e | |||
963edbffa3 | |||
f3687f724f | |||
a736ee9800 | |||
bea2047092 | |||
7d98ac8f38 | |||
32244bb450 | |||
b154631c77 | |||
466a24ac10 | |||
7db91a2fe6 | |||
46652dec6f | |||
50e591b80c | |||
6710a163a9 | |||
a39f43f79a | |||
964520a2f9 | |||
6e680085a4 | |||
286a843b67 | |||
df7c5ebafc | |||
9927323a9d | |||
66f3e66c8b | |||
c68b0c5090 | |||
53ac03507d | |||
0031b51bcf | |||
67a8c6e591 | |||
806390a068 | |||
508b18bc3b | |||
c2499ea507 | |||
c0c91aec94 | |||
a27008a295 | |||
7e11627618 | |||
968ce63a53 | |||
7c0eb3290f | |||
62403625ba | |||
9a34b03540 | |||
8bb63df7e3 | |||
65cd73845a | |||
8534bc254b | |||
2a2fd324a0 | |||
58e3de2559 | |||
c30736870d | |||
cfd48de885 | |||
462df2b648 | |||
f64da93cf9 | |||
a55db621ef | |||
c033bdfc3b | |||
2610e56ec1 | |||
08aa9e3fe4 | |||
411ae7ee07 | |||
41700c1eb1 | |||
8d7bac9793 | |||
0229eefa4d | |||
61f646743a | |||
e3babde7e8 | |||
c389e43e93 | |||
1511db4eea |
@ -119,6 +119,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npmci node install stable
|
npmci node install stable
|
||||||
npmci npm install
|
npmci npm install
|
||||||
pnpm install -g @gitzone/tsdoc
|
pnpm install -g @git.zone/tsdoc
|
||||||
npmci command tsdoc
|
npmci command tsdoc
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
34
package.json
34
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@design.estate/dees-catalog",
|
"name": "@design.estate/dees-catalog",
|
||||||
"version": "1.0.195",
|
"version": "1.0.231",
|
||||||
"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,29 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@design.estate/dees-domtools": "^2.0.40",
|
"@design.estate/dees-domtools": "^2.0.55",
|
||||||
"@design.estate/dees-element": "^2.0.27",
|
"@design.estate/dees-element": "^2.0.33",
|
||||||
"@design.estate/dees-wcctools": "^1.0.78",
|
"@design.estate/dees-wcctools": "^1.0.81",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
"@fortawesome/fontawesome-svg-core": "^6.5.0",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.4.2",
|
"@fortawesome/free-brands-svg-icons": "^6.5.0",
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.4.2",
|
"@fortawesome/free-regular-svg-icons": "^6.5.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
"@fortawesome/free-solid-svg-icons": "^6.5.0",
|
||||||
|
"@push.rocks/smarti18n": "^1.0.4",
|
||||||
"@push.rocks/smartpromise": "^4.0.3",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@push.rocks/smartstring": "^4.0.9",
|
"@push.rocks/smartstring": "^4.0.9",
|
||||||
"@tsclass/tsclass": "^4.0.43",
|
"@tsclass/tsclass": "^4.0.46",
|
||||||
"highlight.js": "11.8.0",
|
"highlight.js": "11.9.0",
|
||||||
"pdfjs-dist": "^3.10.111"
|
"ibantools": "^4.3.6",
|
||||||
|
"pdfjs-dist": "^3.11.174"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.66",
|
"@git.zone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsbundle": "^2.0.8",
|
"@git.zone/tsbundle": "^2.0.8",
|
||||||
"@gitzone/tstest": "^1.0.77",
|
"@git.zone/tstest": "^1.0.77",
|
||||||
"@gitzone/tswatch": "^2.0.7",
|
"@git.zone/tswatch": "^2.0.7",
|
||||||
"@push.rocks/projectinfo": "^5.0.2",
|
"@push.rocks/projectinfo": "^5.0.2",
|
||||||
"@push.rocks/tapbundle": "^5.0.15",
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
"@types/node": "^20.6.0"
|
"@types/node": "^20.10.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
2511
pnpm-lock.yaml
generated
2511
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.195',
|
version: '1.0.231',
|
||||||
description: 'website for lossless.com'
|
description: 'website for lossless.com'
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ export class DeesButton extends DeesElement {
|
|||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
font-family: 'Roboto', 'monospace';
|
||||||
}
|
}
|
||||||
:host([hidden]) {
|
:host([hidden]) {
|
||||||
display: none;
|
display: none;
|
||||||
|
41
ts_web/elements/dees-chips.demo.ts
Normal file
41
ts_web/elements/dees-chips.demo.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`
|
||||||
|
<style>
|
||||||
|
.demoContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="demoContainer">
|
||||||
|
<dees-chips
|
||||||
|
selectionMode="none"
|
||||||
|
.selectableChips=${[
|
||||||
|
{ key: 'account1', value: 'Payment Account 1' },
|
||||||
|
{ key: 'account2', value: 'PaymentAccount2' },
|
||||||
|
{ key: 'account3', value: 'Payment Account 3' },
|
||||||
|
]}
|
||||||
|
></dees-chips>
|
||||||
|
<dees-chips
|
||||||
|
selectionMode="single"
|
||||||
|
chipsAreRemovable
|
||||||
|
.selectableChips=${[
|
||||||
|
{ key: 'account1', value: 'Payment Account 1' },
|
||||||
|
{ key: 'account2', value: 'PaymentAccount2' },
|
||||||
|
{ key: 'account3', value: 'Payment Account 3' },
|
||||||
|
]}
|
||||||
|
></dees-chips>
|
||||||
|
<dees-chips
|
||||||
|
selectionMode="multiple"
|
||||||
|
.selectableChips=${[
|
||||||
|
{ key: 'account1', value: 'Payment Account 1' },
|
||||||
|
{ key: 'account2', value: 'PaymentAccount2' },
|
||||||
|
{ key: 'account3', value: 'Payment Account 3' },
|
||||||
|
]}
|
||||||
|
></dees-chips>
|
||||||
|
</div>
|
||||||
|
`;
|
@ -11,6 +11,7 @@ import {
|
|||||||
} from '@design.estate/dees-element';
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
import { demoFunc } from './dees-chips.demo.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -18,30 +19,32 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Tag = { key: string; value: string };
|
||||||
|
|
||||||
@customElement('dees-chips')
|
@customElement('dees-chips')
|
||||||
export class DeesChips extends DeesElement {
|
export class DeesChips extends DeesElement {
|
||||||
public static demo = () => html`
|
public static demo = demoFunc;
|
||||||
<dees-chips .selectableChips=${['Payment Account 1', 'PaymentAccount2', 'Payment Account 3']}></dees-chips>
|
|
||||||
<dees-chips selectionMode="multiple" .selectableChips=${['Payment Account 1', 'PaymentAccount2', 'Payment Account 3']}></dees-chips>
|
|
||||||
|
|
||||||
`;
|
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public selectionMode: 'single' | 'multiple' = 'single';
|
public selectionMode: 'none' | 'single' | 'multiple' = 'single';
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Array
|
type: Boolean,
|
||||||
})
|
})
|
||||||
public selectableChips: string[] = [];
|
public chipsAreRemovable: boolean = false;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Array,
|
||||||
|
})
|
||||||
|
public selectableChips: Tag[] = [];
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public selectedChip: string = null;
|
public selectedChip: Tag = null;
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Array
|
type: Array,
|
||||||
})
|
})
|
||||||
public selectedChips: string[] = [];
|
public selectedChips: Tag[] = [];
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -50,47 +53,88 @@ export class DeesChips extends DeesElement {
|
|||||||
public static styles = [
|
public static styles = [
|
||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainbox {
|
.mainbox {
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip {
|
.chip {
|
||||||
background: #494949;
|
border-top: ${cssManager.bdTheme('1px solid #CCC', '1px solid #444')};
|
||||||
display: inline-block;
|
background: #333333;
|
||||||
padding: 8px 12px;
|
display: inline-flex;
|
||||||
font-size: 14px;
|
height: 20px;
|
||||||
|
line-height: 20px;
|
||||||
|
padding: 0px 8px;
|
||||||
|
font-size: 12px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 40px;
|
border-radius: 40px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 4px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip:hover {
|
.chip:hover {
|
||||||
background: #666666;
|
background: #666666;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip.selected {
|
.chip.selected {
|
||||||
background: #00A3FF;
|
background: #00a3ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chipKey {
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
height: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: -8px;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
dees-icon {
|
||||||
|
padding: 0px 6px 0px 4px;
|
||||||
|
margin-left: 4px;
|
||||||
|
margin-right: -8px;
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
dees-icon:hover {
|
||||||
|
background: #e4002b;
|
||||||
}
|
}
|
||||||
|
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="mainbox">
|
<div class="mainbox">
|
||||||
${this.selectableChips.map(chipArg => html`
|
${this.selectableChips.map(
|
||||||
<div @click=${() => this.selectChip(chipArg)} class="chip ${this.selectedChip === chipArg || this.selectedChips.includes(chipArg) ? 'selected' : ''}">
|
(chip) => html`
|
||||||
${chipArg}
|
<div
|
||||||
</div>
|
@click=${() => this.selectChip(chip)}
|
||||||
`)}
|
class="chip ${this.isSelected(chip) ? 'selected' : ''}"
|
||||||
|
>
|
||||||
|
${chip.key ? html`<div class="chipKey">${chip.key}</div>` : html``} ${chip.value}
|
||||||
|
${this.chipsAreRemovable
|
||||||
|
? html`
|
||||||
|
<dees-icon
|
||||||
|
@click=${(event: Event) => {
|
||||||
|
event.stopPropagation(); // prevent the selectChip event from being triggered
|
||||||
|
this.removeChip(chip);
|
||||||
|
}}
|
||||||
|
.iconFA=${'xmark'}
|
||||||
|
></dees-icon>
|
||||||
|
`
|
||||||
|
: html``}
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -102,23 +146,51 @@ export class DeesChips extends DeesElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async selectChip(chipArg: string) {
|
private isSelected(chip: Tag): boolean {
|
||||||
if (this.selectionMode === 'single') {
|
if (this.selectionMode === 'single') {
|
||||||
if (this.selectedChip === chipArg) {
|
return this.selectedChip?.key === chip.key;
|
||||||
|
} else {
|
||||||
|
return this.selectedChips.some((selected) => selected.key === chip.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async selectChip(chip: Tag) {
|
||||||
|
if (this.selectionMode === 'none') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.selectionMode === 'single') {
|
||||||
|
if (this.isSelected(chip)) {
|
||||||
this.selectedChip = null;
|
this.selectedChip = null;
|
||||||
this.selectedChips = [];
|
this.selectedChips = [];
|
||||||
} else {
|
} else {
|
||||||
this.selectedChip = chipArg;
|
this.selectedChip = chip;
|
||||||
this.selectedChips = [chipArg];
|
this.selectedChips = [chip];
|
||||||
}
|
}
|
||||||
} else if(this.selectionMode === 'multiple') {
|
} else if (this.selectionMode === 'multiple') {
|
||||||
if (this.selectedChips.includes(chipArg)) {
|
if (this.isSelected(chip)) {
|
||||||
this.selectedChips = this.selectedChips.filter(chipArg2 => chipArg !== chipArg2)
|
this.selectedChips = this.selectedChips.filter((selected) => selected.key !== chip.key);
|
||||||
} else {
|
} else {
|
||||||
this.selectedChips.push(chipArg);
|
this.selectedChips = [...this.selectedChips, chip];
|
||||||
}
|
}
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
}
|
}
|
||||||
console.log(this.selectedChips);
|
console.log(this.selectedChips);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public removeChip(chipToRemove: Tag): void {
|
||||||
|
// Remove the chip from selectableChips
|
||||||
|
this.selectableChips = this.selectableChips.filter((chip) => chip.key !== chipToRemove.key);
|
||||||
|
|
||||||
|
// Remove the chip from selectedChips if present
|
||||||
|
this.selectedChips = this.selectedChips.filter((chip) => chip.key !== chipToRemove.key);
|
||||||
|
|
||||||
|
// If the removed chip was the selectedChip, set selectedChip to null
|
||||||
|
if (this.selectedChip && this.selectedChip.key === chipToRemove.key) {
|
||||||
|
this.selectedChip = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger an update to re-render the component
|
||||||
|
this.requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,42 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
public static demo = demoFunc
|
public static demo = demoFunc
|
||||||
|
|
||||||
// STATIC
|
// STATIC
|
||||||
|
// This will store all the accumulated menu items
|
||||||
|
public static contextMenuDeactivated = false;
|
||||||
|
public static accumulatedMenuItems: plugins.tsclass.website.IMenuItem[] = [];
|
||||||
|
|
||||||
|
// Add a global event listener for the right-click context menu
|
||||||
|
public static initializeGlobalListener() {
|
||||||
|
document.addEventListener('contextmenu', (event: MouseEvent) => {
|
||||||
|
if (this.contextMenuDeactivated) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Get the target element of the right-click
|
||||||
|
let target: EventTarget | null = event.target;
|
||||||
|
|
||||||
|
// Clear previously accumulated items
|
||||||
|
DeesContextmenu.accumulatedMenuItems = [];
|
||||||
|
|
||||||
|
// Traverse up the DOM tree to accumulate menu items
|
||||||
|
while (target) {
|
||||||
|
if ((target as any).getContextMenuItems) {
|
||||||
|
DeesContextmenu.accumulatedMenuItems.push(...(target as any).getContextMenuItems());
|
||||||
|
}
|
||||||
|
target = (target as Node).parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open the context menu with the accumulated items
|
||||||
|
DeesContextmenu.openContextMenuWithOptions(event, DeesContextmenu.accumulatedMenuItems);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// allows opening of a contextmenu with options
|
||||||
public static async openContextMenuWithOptions(eventArg: MouseEvent, menuItemsArg: plugins.tsclass.website.IMenuItem[]) {
|
public static async openContextMenuWithOptions(eventArg: MouseEvent, menuItemsArg: plugins.tsclass.website.IMenuItem[]) {
|
||||||
|
if (this.contextMenuDeactivated) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
eventArg.preventDefault();
|
eventArg.preventDefault();
|
||||||
eventArg.stopPropagation();
|
eventArg.stopPropagation();
|
||||||
const contextMenu = new DeesContextmenu();
|
const contextMenu = new DeesContextmenu();
|
||||||
@ -49,6 +84,7 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
contextMenu.style.transform = 'scale(1,1)';
|
contextMenu.style.transform = 'scale(1,1)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
@property({
|
@property({
|
||||||
type: Array,
|
type: Array,
|
||||||
})
|
})
|
||||||
@ -59,6 +95,9 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* STATIC STYLES
|
||||||
|
*/
|
||||||
public static styles = [
|
public static styles = [
|
||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
@ -71,11 +110,11 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
color: ${cssManager.bdTheme('#222', '#ccc')};
|
color: ${cssManager.bdTheme('#222', '#ccc')};
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
border: 1px solid #444;
|
border: 1px solid ${cssManager.bdTheme('#fff', '#444')};
|
||||||
min-height: 34px;
|
min-height: 34px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background: #222;
|
background: ${cssManager.bdTheme('#fff', '#222')};
|
||||||
box-shadow: 0px 1px 4px #000;
|
box-shadow: 0px 1px 4px ${cssManager.bdTheme('#00000020', '#000000')};
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +131,7 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
|
|
||||||
.mainbox .menuitem:hover {
|
.mainbox .menuitem:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: #ffffff10;
|
background: ${cssManager.bdTheme('#00000010', '#ffffff10')};
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainbox .menuitem:active {
|
.mainbox .menuitem:active {
|
||||||
@ -115,10 +154,11 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
})}
|
})}
|
||||||
${this.menuItems.length === 0 ? html`
|
${this.menuItems.length === 0 ? html`
|
||||||
<div class="menuitem" @click=${() => {
|
<div class="menuitem" @click=${() => {
|
||||||
alert('No menu items...')
|
DeesContextmenu.contextMenuDeactivated = true;
|
||||||
|
this.destroy();
|
||||||
}}>
|
}}>
|
||||||
<dees-icon .iconFA=${'xmark'}></dees-icon
|
<dees-icon .iconFA=${'xmark'}></dees-icon
|
||||||
>No menu item present...
|
>Deactivate Contextmenu globally.
|
||||||
</div>
|
</div>
|
||||||
` : html``}
|
` : html``}
|
||||||
</div>
|
</div>
|
||||||
@ -144,3 +184,5 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
this.parentElement.removeChild(this);
|
this.parentElement.removeChild(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeesContextmenu.initializeGlobalListener();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { demoFunc } from './dees-dataview-codebox.demo.js';
|
import { demoFunc } from './dees-dataview-codebox.demo.js';
|
||||||
import {
|
import {
|
||||||
DeesElement,
|
DeesElement,
|
||||||
html,
|
html,
|
||||||
@ -6,6 +6,7 @@ import {
|
|||||||
type TemplateResult,
|
type TemplateResult,
|
||||||
property,
|
property,
|
||||||
state,
|
state,
|
||||||
|
cssManager,
|
||||||
} from '@design.estate/dees-element';
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
import hlight from 'highlight.js';
|
import hlight from 'highlight.js';
|
||||||
@ -13,6 +14,7 @@ import hlight from 'highlight.js';
|
|||||||
import * as smartstring from '@push.rocks/smartstring';
|
import * as smartstring from '@push.rocks/smartstring';
|
||||||
|
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
import { DeesContextmenu } from './dees-contextmenu.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -46,6 +48,7 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
display: block;
|
display: block;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
}
|
}
|
||||||
.mainbox {
|
.mainbox {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -58,31 +61,67 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.appbar {
|
.appbar {
|
||||||
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
||||||
|
background: ${cssManager.bdTheme('#ffffff', '#161616')};
|
||||||
|
border-bottom: 1px solid ${cssManager.bdTheme('#eeeeeb', '#222222')};
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: #161616;
|
|
||||||
border-bottom: 1px solid #222222;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #CCC;
|
|
||||||
font-family: 'Hubot Sans', 'monospace';
|
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.appbar .macControls {
|
||||||
|
position: absolute;
|
||||||
|
top: 6px;
|
||||||
|
left: 20px;
|
||||||
|
width: 200px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 24px 24px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appbar .macControls div {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: #222222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appbar .macControls div.close {
|
||||||
|
background: #ff5f57;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appbar .macControls div.toDock {
|
||||||
|
background: #ffbd2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appbar .macControls div.minMax {
|
||||||
|
background: #27c93f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appbar .macControls div:hover {
|
||||||
|
background: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
.appbar .fileName {
|
.appbar .fileName {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottomBar {
|
.bottomBar {
|
||||||
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
||||||
|
background: ${cssManager.bdTheme('#ffffff', '#161616')};
|
||||||
|
border-top: 1px solid ${cssManager.bdTheme('#eeeeeb', '#222222')};
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: #161616;
|
|
||||||
border-top: 1px solid #222222;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #CCC;
|
|
||||||
font-family: 'Hubot Sans', 'monospace';
|
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.languageLabel {
|
.languageLabel {
|
||||||
color: #fff;
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
@ -105,7 +144,6 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.lineNumbers {
|
.lineNumbers {
|
||||||
|
|
||||||
color: ${this.goBright ? '#acacac' : '#666666'};
|
color: ${this.goBright ? '#acacac' : '#666666'};
|
||||||
padding: 30px 16px 0px 0px;
|
padding: 30px 16px 0px 0px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@ -156,8 +194,26 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
color: ${this.goBright ? '#EF9300' : '#ffd765'};
|
color: ${this.goBright ? '#EF9300' : '#ffd765'};
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="mainbox">
|
<div
|
||||||
|
class="mainbox"
|
||||||
|
@contextmenu="${(eventArg) => {
|
||||||
|
DeesContextmenu.openContextMenuWithOptions(eventArg, [
|
||||||
|
{
|
||||||
|
name: 'About',
|
||||||
|
iconName: 'circleInfo',
|
||||||
|
action: async () => {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}}"
|
||||||
|
>
|
||||||
<div class="appbar">
|
<div class="appbar">
|
||||||
|
<div class="macControls">
|
||||||
|
<div class="close"></div>
|
||||||
|
<div class="toDock"></div>
|
||||||
|
<div class="minMax"></div>
|
||||||
|
</div>
|
||||||
<div class="fileName">index.ts</div>
|
<div class="fileName">index.ts</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="codegrid">
|
<div class="codegrid">
|
||||||
|
@ -29,7 +29,7 @@ export class DeesDataviewStatusobject extends DeesElement {
|
|||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
.mainbox {
|
.mainbox {
|
||||||
border-radius: 3px;
|
border-radius: 8px;
|
||||||
background: ${cssManager.bdTheme('#fff', '#1b1b1b')};
|
background: ${cssManager.bdTheme('#fff', '#1b1b1b')};
|
||||||
box-shadow: 0px 1px 3px #00000030;
|
box-shadow: 0px 1px 3px #00000030;
|
||||||
min-height: 48px;
|
min-height: 48px;
|
||||||
|
35
ts_web/elements/dees-form.demo.ts
Normal file
35
ts_web/elements/dees-form.demo.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { html, domtools } from '@design.estate/dees-element';
|
||||||
|
import type { DeesForm } from './dees-form.js';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`
|
||||||
|
<style>
|
||||||
|
.demoContainer {
|
||||||
|
max-width: 400px;
|
||||||
|
margin: auto;
|
||||||
|
padding: 16px;
|
||||||
|
background: #111;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="demoContainer">
|
||||||
|
<dees-form
|
||||||
|
style="display: block; margin:auto; max-width: 500px; padding: 20px"
|
||||||
|
@formData=${async (eventArg) => {
|
||||||
|
const form: DeesForm = eventArg.currentTarget;
|
||||||
|
form.setStatus('pending', 'authenticating...');
|
||||||
|
await domtools.plugins.smartdelay.delayFor(1000);
|
||||||
|
form.setStatus('success', 'authenticated!');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<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="hello3" label="a password" isPasswordBool></dees-input-text>
|
||||||
|
<dees-input-checkbox
|
||||||
|
.required="${true}"
|
||||||
|
key="hello3"
|
||||||
|
label="another text"
|
||||||
|
></dees-input-checkbox>
|
||||||
|
<dees-input-iban></dees-input-iban>
|
||||||
|
<dees-form-submit>Submit</dees-form-submit>
|
||||||
|
</dees-form>
|
||||||
|
</div>
|
||||||
|
`;
|
@ -1,4 +1,10 @@
|
|||||||
import { customElement, html, type TemplateResult, DeesElement, type CSSResult, } from '@design.estate/dees-element';
|
import {
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
type TemplateResult,
|
||||||
|
DeesElement,
|
||||||
|
type CSSResult,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
import { DeesInputCheckbox } from './dees-input-checkbox.js';
|
import { DeesInputCheckbox } from './dees-input-checkbox.js';
|
||||||
@ -6,16 +12,27 @@ import { DeesInputText } from './dees-input-text.js';
|
|||||||
import { DeesInputQuantitySelector } from './dees-input-quantityselector.js';
|
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';
|
||||||
|
import { DeesTable } from './dees-table.js';
|
||||||
|
import { demoFunc } from './dees-form.demo.js';
|
||||||
|
import { DeesInputIban } from './dees-input-iban.js';
|
||||||
|
|
||||||
// Unified set for form input types
|
// Unified set for form input types
|
||||||
const FORM_INPUT_TYPES = [
|
const FORM_INPUT_TYPES = [
|
||||||
DeesInputCheckbox,
|
DeesInputCheckbox,
|
||||||
|
DeesInputIban,
|
||||||
DeesInputText,
|
DeesInputText,
|
||||||
DeesInputQuantitySelector,
|
DeesInputQuantitySelector,
|
||||||
DeesInputRadio
|
DeesInputRadio,
|
||||||
|
DeesTable,
|
||||||
];
|
];
|
||||||
|
|
||||||
export type TFormInputElement = DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio;
|
export type TFormInputElement =
|
||||||
|
| DeesInputCheckbox
|
||||||
|
| DeesInputIban
|
||||||
|
| DeesInputText
|
||||||
|
| DeesInputQuantitySelector
|
||||||
|
| DeesInputRadio
|
||||||
|
| DeesTable<any>;
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -25,26 +42,10 @@ declare global {
|
|||||||
|
|
||||||
@customElement('dees-form')
|
@customElement('dees-form')
|
||||||
export class DeesForm extends DeesElement {
|
export class DeesForm extends DeesElement {
|
||||||
|
public static demo = demoFunc;
|
||||||
public static demo = () => html`
|
|
||||||
<dees-form
|
|
||||||
style="display: block; margin:auto; max-width: 500px; padding: 20px"
|
|
||||||
@formData=${async (eventArg) => {
|
|
||||||
const form: DeesForm = eventArg.currentTarget;
|
|
||||||
form.setStatus('pending', 'authenticating...');
|
|
||||||
await domtools.plugins.smartdelay.delayFor(1000);
|
|
||||||
form.setStatus('success', 'authenticated!');
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<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-checkbox .required="${true}" key="hello3" label="another text"></dees-input-checkbox>
|
|
||||||
<dees-form-submit>Submit</dees-form-submit>
|
|
||||||
</dees-form>
|
|
||||||
`;
|
|
||||||
|
|
||||||
public name: string = 'myform';
|
public name: string = 'myform';
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
public readyDeferred = domtools.plugins.smartpromise.defer();
|
public readyDeferred = domtools.plugins.smartpromise.defer();
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
@ -75,14 +76,14 @@ export class DeesForm extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getFormElements(): Array<TFormInputElement> {
|
public getFormElements(): Array<TFormInputElement> {
|
||||||
return (Array.from(this.children)).filter(child =>
|
return Array.from(this.children).filter((child) =>
|
||||||
FORM_INPUT_TYPES.includes(child.constructor as any)
|
FORM_INPUT_TYPES.includes(child.constructor as any)
|
||||||
) as unknown as TFormInputElement[];
|
) as unknown as TFormInputElement[];
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSubmitButton(): DeesFormSubmit | undefined {
|
public getSubmitButton(): DeesFormSubmit | undefined {
|
||||||
return Array.from(this.children).find(child =>
|
return Array.from(this.children).find(
|
||||||
child instanceof DeesFormSubmit
|
(child) => child instanceof DeesFormSubmit
|
||||||
) as DeesFormSubmit;
|
) as DeesFormSubmit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ export class DeesForm extends DeesElement {
|
|||||||
|
|
||||||
public async collectFormData() {
|
public async collectFormData() {
|
||||||
const children = this.getFormElements();
|
const children = this.getFormElements();
|
||||||
const valueObject: { [key: string]: string | number | boolean } = {};
|
const valueObject: { [key: string]: string | number | boolean | any[] } = {};
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
if (!child.key) {
|
if (!child.key) {
|
||||||
console.log(`form element with label "${child.label}" has no key. skipping.`);
|
console.log(`form element with label "${child.label}" has no key. skipping.`);
|
||||||
|
5
ts_web/elements/dees-hint.demo.ts
Normal file
5
ts_web/elements/dees-hint.demo.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`
|
||||||
|
<dees-hint></dees-hint>
|
||||||
|
`;
|
38
ts_web/elements/dees-hint.ts
Normal file
38
ts_web/elements/dees-hint.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import {
|
||||||
|
DeesElement,
|
||||||
|
css,
|
||||||
|
cssManager,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
property,
|
||||||
|
type CSSResult,
|
||||||
|
type TemplateResult,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
import { demoFunc } from './dees-hint.demo.js';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-hint': DeesHint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-hint')
|
||||||
|
export class DeesHint extends DeesElement {
|
||||||
|
public static demo = demoFunc;
|
||||||
|
|
||||||
|
@property({ type: String })
|
||||||
|
public type: 'info' | 'warn' | 'error' | 'critical' = 'info';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
domtools.elementBasic.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static styles = [cssManager.defaultStyles, css``];
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html` <div class="mainbox"></div> `;
|
||||||
|
}
|
||||||
|
}
|
55
ts_web/elements/dees-icon.demo.ts
Normal file
55
ts_web/elements/dees-icon.demo.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
import { faIcons } from './dees-icon.js';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`
|
||||||
|
<style>
|
||||||
|
.demoContainer {
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
background: #111111;
|
||||||
|
padding: 10px; font-size: 30px;
|
||||||
|
}
|
||||||
|
dees-icon {
|
||||||
|
transition: color 0.02s;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
dees-icon:hover {
|
||||||
|
color: #e4002b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconContainer {
|
||||||
|
display: block;
|
||||||
|
padding: 16px 16px 0px 16px;
|
||||||
|
border: 1px solid #333333;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconName {
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
color: #ccc;
|
||||||
|
background: #333333;
|
||||||
|
padding: 4px 8px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
margin-left: -16px;
|
||||||
|
margin-right: -16px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="demoContainer">
|
||||||
|
${Object.keys(faIcons).map(
|
||||||
|
(iconName) => html`
|
||||||
|
<div class="iconContainer">
|
||||||
|
<dees-icon .iconFA=${iconName as any}></dees-icon>
|
||||||
|
<div class="iconName">${iconName}</div>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
`;
|
@ -29,6 +29,7 @@ import {
|
|||||||
faMessage as faMessageRegular,
|
faMessage as faMessageRegular,
|
||||||
faPaste as faPasteRegular,
|
faPaste as faPasteRegular,
|
||||||
faSun as faSunRegular,
|
faSun as faSunRegular,
|
||||||
|
faTrashCan as faTrashCanRegular,
|
||||||
} from '@fortawesome/free-regular-svg-icons';
|
} from '@fortawesome/free-regular-svg-icons';
|
||||||
import {
|
import {
|
||||||
faArrowRight as faArrowRightSolid,
|
faArrowRight as faArrowRightSolid,
|
||||||
@ -42,74 +43,78 @@ import {
|
|||||||
faCircleInfo as faCircleInfoSolid,
|
faCircleInfo as faCircleInfoSolid,
|
||||||
faCircleCheck as faCircleCheckSolid,
|
faCircleCheck as faCircleCheckSolid,
|
||||||
faCircleXmark as faCircleXmarkSolid,
|
faCircleXmark as faCircleXmarkSolid,
|
||||||
|
faClockRotateLeft as faClockRotateLeftSolid,
|
||||||
faCopy as faCopySolid,
|
faCopy as faCopySolid,
|
||||||
faDesktop as faDesktopSolid,
|
faDesktop as faDesktopSolid,
|
||||||
faEye as faEyeSolid,
|
faEye as faEyeSolid,
|
||||||
faEyeSlash as faEyeSlashSolid,
|
faEyeSlash as faEyeSlashSolid,
|
||||||
|
faFileInvoice as faFileInvoiceSolid,
|
||||||
|
faFileInvoiceDollar as faFileInvoiceDollarSolid,
|
||||||
faGrip as faGripSolid,
|
faGrip as faGripSolid,
|
||||||
faMessage as faMessageSolid,
|
faMessage as faMessageSolid,
|
||||||
|
faMoneyCheckDollar as faMoneyCheckDollarSolid,
|
||||||
faMugHot as faMugHotSolid,
|
faMugHot as faMugHotSolid,
|
||||||
faMinus as faMinusSolid,
|
faMinus as faMinusSolid,
|
||||||
faPaste as faPasteSolid,
|
faPaste as faPasteSolid,
|
||||||
faPenToSquare as faPenToSquareSolid,
|
faPenToSquare as faPenToSquareSolid,
|
||||||
|
faPlus as faPlusSolid,
|
||||||
|
faReceipt as faReceiptSolid,
|
||||||
faRss as faRssSolid,
|
faRss as faRssSolid,
|
||||||
faUsers as faUsersSolid,
|
faUsers as faUsersSolid,
|
||||||
faShare as faShareSolid,
|
faShare as faShareSolid,
|
||||||
faSun as faSunSolid,
|
faSun as faSunSolid,
|
||||||
|
faTrash as faTrashSolid,
|
||||||
|
faTrashCan as faTrashCanSolid,
|
||||||
|
faWallet as faWalletSolid,
|
||||||
faXmark as faXmarkSolid,
|
faXmark as faXmarkSolid,
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { demoFunc } from './dees-icon.demo.js';
|
||||||
|
|
||||||
export const faIcons = {
|
export const faIcons = {
|
||||||
// normal
|
// normal
|
||||||
arrowRight: faArrowRightSolid,
|
arrowRight: faArrowRightSolid,
|
||||||
arrowUpRightFromSquare: faArrowUpRightFromSquareSolid,
|
arrowUpRightFromSquare: faArrowUpRightFromSquareSolid,
|
||||||
arrowUpRightFromSquareSolid: faArrowUpRightFromSquareSolid,
|
|
||||||
bell: faBellSolid,
|
bell: faBellSolid,
|
||||||
bellSolid: faBellSolid,
|
|
||||||
bug: faBugSolid,
|
bug: faBugSolid,
|
||||||
bugSolid: faBugSolid,
|
|
||||||
building: faBuildingSolid,
|
building: faBuildingSolid,
|
||||||
buildingSolid: faBuildingSolid,
|
|
||||||
caretLeft: faCaretLeftSolid,
|
caretLeft: faCaretLeftSolid,
|
||||||
caretLeftSolid: faCaretLeftSolid,
|
|
||||||
caretRight: faCaretRightSolid,
|
caretRight: faCaretRightSolid,
|
||||||
caretRightSolid: faCaretRightSolid,
|
|
||||||
check: faCheckSolid,
|
check: faCheckSolid,
|
||||||
checkSolid: faCheckSolid,
|
|
||||||
circleInfo: faCircleInfoSolid,
|
circleInfo: faCircleInfoSolid,
|
||||||
circleInfoSolid: faCircleInfoSolid,
|
|
||||||
circleCheck: faCircleCheckRegular,
|
circleCheck: faCircleCheckRegular,
|
||||||
circleCheckSolid: faCircleCheckSolid,
|
circleCheckSolid: faCircleCheckSolid,
|
||||||
circleXmark: faCircleXmarkRegular,
|
circleXmark: faCircleXmarkRegular,
|
||||||
circleXmarkSolid: faCircleXmarkSolid,
|
circleXmarkSolid: faCircleXmarkSolid,
|
||||||
|
clockRotateLeft: faClockRotateLeftSolid,
|
||||||
copy: faCopyRegular,
|
copy: faCopyRegular,
|
||||||
copySolid: faCopySolid,
|
copySolid: faCopySolid,
|
||||||
desktop: faDesktopSolid,
|
desktop: faDesktopSolid,
|
||||||
desktopSolid: faDesktopSolid,
|
|
||||||
eye: faEyeSolid,
|
eye: faEyeSolid,
|
||||||
eyeSolid: faEyeSolid,
|
|
||||||
eyeSlash: faEyeSlashSolid,
|
eyeSlash: faEyeSlashSolid,
|
||||||
eyeSlashSolid: faEyeSlashSolid,
|
fileInvoice: faFileInvoiceSolid,
|
||||||
|
fileInvoiceDoller: faFileInvoiceDollarSolid,
|
||||||
grip: faGripSolid,
|
grip: faGripSolid,
|
||||||
gripSolid: faGripSolid,
|
|
||||||
message: faMessageRegular,
|
message: faMessageRegular,
|
||||||
messageSolid: faMessageSolid,
|
messageSolid: faMessageSolid,
|
||||||
|
moneyCheckDollar: faMoneyCheckDollarSolid,
|
||||||
mugHot: faMugHotSolid,
|
mugHot: faMugHotSolid,
|
||||||
faMugHotSolid: faMugHotSolid,
|
|
||||||
minus: faMinusSolid,
|
minus: faMinusSolid,
|
||||||
minusSolid: faMinusSolid,
|
|
||||||
paste: faPasteRegular,
|
paste: faPasteRegular,
|
||||||
pasteSolid: faPasteSolid,
|
pasteSolid: faPasteSolid,
|
||||||
penToSquare: faPenToSquareSolid,
|
penToSquare: faPenToSquareSolid,
|
||||||
penToSquareSolid: faPenToSquareSolid,
|
plus: faPlusSolid,
|
||||||
|
receipt: faReceiptSolid,
|
||||||
rss: faRssSolid,
|
rss: faRssSolid,
|
||||||
rssSolid: faRssSolid,
|
|
||||||
share: faShareSolid,
|
share: faShareSolid,
|
||||||
shareSolid: faShareSolid,
|
|
||||||
sun: faSunRegular,
|
sun: faSunRegular,
|
||||||
sunSolid: faSunSolid,
|
sunSolid: faSunSolid,
|
||||||
|
trash: faTrashSolid,
|
||||||
|
trashSolid: faTrashSolid,
|
||||||
|
trashCan: faTrashCanRegular,
|
||||||
|
trashCanSolid: faTrashCanSolid,
|
||||||
|
users: faUsersSolid,
|
||||||
|
wallet: faWalletSolid,
|
||||||
xmark: faXmarkSolid,
|
xmark: faXmarkSolid,
|
||||||
xmarkSolid: faXmarkSolid,
|
|
||||||
// brands
|
// brands
|
||||||
facebook: faFacebook,
|
facebook: faFacebook,
|
||||||
google: faGoogle,
|
google: faGoogle,
|
||||||
@ -119,7 +124,6 @@ export const faIcons = {
|
|||||||
slack: faSlackHash,
|
slack: faSlackHash,
|
||||||
tiktok: faTiktok,
|
tiktok: faTiktok,
|
||||||
twitter: faTwitter,
|
twitter: faTwitter,
|
||||||
users: faUsersSolid,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TIconKey = keyof typeof faIcons;
|
export type TIconKey = keyof typeof faIcons;
|
||||||
@ -132,24 +136,7 @@ declare global {
|
|||||||
|
|
||||||
@customElement('dees-icon')
|
@customElement('dees-icon')
|
||||||
export class DeesIcon extends DeesElement {
|
export class DeesIcon extends DeesElement {
|
||||||
public static demo = () => html`
|
public static demo = demoFunc;
|
||||||
<dees-icon iconName="visibility"></dees-icon>
|
|
||||||
<div style="background: #fff; padding: 10px; font-size: 30px">
|
|
||||||
<style>
|
|
||||||
dees-icon {
|
|
||||||
transition: color 0.05s;
|
|
||||||
}
|
|
||||||
dees-icon:hover {
|
|
||||||
color: #e4002b;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<dees-icon .iconFA=${'messageSolid'}></dees-icon>
|
|
||||||
<dees-icon .iconFA=${'sun'}></dees-icon>
|
|
||||||
<dees-icon .iconFA=${'sunSolid'}></dees-icon>
|
|
||||||
<dees-icon .iconFA=${'facebook'}></dees-icon>
|
|
||||||
<dees-icon .iconFA=${'arrowUpRightFromSquare'}></dees-icon>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String
|
type: String
|
||||||
|
@ -22,7 +22,7 @@ export class DeesInputCheckbox extends DeesElement {
|
|||||||
public static demo = () => html`<dees-input-checkbox></dees-input-checkbox>`;
|
public static demo = () => html`<dees-input-checkbox></dees-input-checkbox>`;
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
|
11
ts_web/elements/dees-input-dropdown.demo.ts
Normal file
11
ts_web/elements/dees-input-dropdown.demo.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`
|
||||||
|
<dees-input-dropdown
|
||||||
|
.options=${[
|
||||||
|
{option: 'option 1', key: 'option1'},
|
||||||
|
{option: 'option 2', key: 'option2'},
|
||||||
|
{option: 'option 3', key: 'option3'}
|
||||||
|
]}
|
||||||
|
></dees-input-dropdown>
|
||||||
|
`
|
@ -1,5 +1,6 @@
|
|||||||
import { customElement, DeesElement, type TemplateResult, property, html, css, cssManager, type CSSResult, } from '@design.estate/dees-element';
|
import { customElement, DeesElement, type TemplateResult, property, html, css, cssManager, type CSSResult, } from '@design.estate/dees-element';
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
import { demoFunc } from './dees-input-dropdown.demo.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -9,18 +10,10 @@ declare global {
|
|||||||
|
|
||||||
@customElement('dees-input-dropdown')
|
@customElement('dees-input-dropdown')
|
||||||
export class DeesInputDropdown extends DeesElement {
|
export class DeesInputDropdown extends DeesElement {
|
||||||
public static demo = () => html`
|
public static demo = demoFunc
|
||||||
<dees-input-dropdown
|
|
||||||
.options=${[
|
|
||||||
{option: 'option 1', key: 'option1'},
|
|
||||||
{option: 'option 2', key: 'option2'},
|
|
||||||
{option: 'option 3', key: 'option3'}
|
|
||||||
]}
|
|
||||||
></dees-input-dropdown>
|
|
||||||
`
|
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
@ -100,12 +93,11 @@ export class DeesInputDropdown extends DeesElement {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
position: relative;
|
position: absolute;
|
||||||
background: ${cssManager.bdTheme('#ffffff', '#222222')};
|
background: ${cssManager.bdTheme('#ffffff', '#222222')};
|
||||||
max-width: 420px;
|
max-width: 420px;
|
||||||
box-shadow: 0px 0px 5px rgba(0,0,0,0.2);
|
box-shadow: 0px 0px 5px rgba(0,0,0,0.2);
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
margin-top: -40px;
|
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
@ -135,12 +127,8 @@ export class DeesInputDropdown extends DeesElement {
|
|||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
${domtools.elementBasic.styles}
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
<div class="maincontainer">
|
<div class="maincontainer">
|
||||||
<div class="selectedBox show" @click="${event => {this.toggleSelectionBox();}}">
|
<div class="selectedBox show" @click="${event => {this.openSelectionBox();}}">
|
||||||
${this.selectedOption?.option}
|
${this.selectedOption?.option}
|
||||||
</div>
|
</div>
|
||||||
<div class="selectionBox">
|
<div class="selectionBox">
|
||||||
@ -165,12 +153,16 @@ export class DeesInputDropdown extends DeesElement {
|
|||||||
detail: selectedOption,
|
detail: selectedOption,
|
||||||
bubbles: true
|
bubbles: true
|
||||||
}));
|
}));
|
||||||
this.toggleSelectionBox();
|
this.openSelectionBox();
|
||||||
this.changeSubject.next(this);
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public toggleSelectionBox() {
|
public openSelectionBox() {
|
||||||
this.shadowRoot.querySelector('.selectedBox').classList.toggle('show');
|
this.shadowRoot.querySelector('.selectedBox').classList.toggle('show');
|
||||||
this.shadowRoot.querySelector('.selectionBox').classList.toggle('show');
|
this.shadowRoot.querySelector('.selectionBox').classList.toggle('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public closeSelectionBox() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,9 @@ import {
|
|||||||
unsafeCSS,
|
unsafeCSS,
|
||||||
cssManager,
|
cssManager,
|
||||||
type CSSResult,
|
type CSSResult,
|
||||||
|
domtools,
|
||||||
} from '@design.estate/dees-element';
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
'dees-input-fileupload': DeesInputFileupload;
|
'dees-input-fileupload': DeesInputFileupload;
|
||||||
@ -23,7 +22,7 @@ export class DeesInputFileupload extends DeesElement {
|
|||||||
public static demo = () => html`<dees-input-fileupload .label=${'Attachments'}></dees-input-fileupload>`;
|
public static demo = () => html`<dees-input-fileupload .label=${'Attachments'}></dees-input-fileupload>`;
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
@ -124,7 +123,7 @@ export class DeesInputFileupload extends DeesElement {
|
|||||||
border-bottom: 1px dashed #444;
|
border-bottom: 1px dashed #444;
|
||||||
color: ${cssManager.bdTheme('#666', '#ccc')};
|
color: ${cssManager.bdTheme('#666', '#ccc')};
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-family: 'Mona Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uploadButton:hover .uploadCandidate {
|
.uploadButton:hover .uploadCandidate {
|
||||||
|
3
ts_web/elements/dees-input-iban.demo.ts
Normal file
3
ts_web/elements/dees-input-iban.demo.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`<dees-input-iban .label=${'IBAN'}></dees-input-iban>`;
|
98
ts_web/elements/dees-input-iban.ts
Normal file
98
ts_web/elements/dees-input-iban.ts
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import {
|
||||||
|
customElement,
|
||||||
|
DeesElement,
|
||||||
|
type TemplateResult,
|
||||||
|
state,
|
||||||
|
html,
|
||||||
|
domtools,
|
||||||
|
property,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
import * as ibantools from 'ibantools';
|
||||||
|
import { demoFunc } from './dees-input-iban.demo.js';
|
||||||
|
|
||||||
|
@customElement('dees-input-iban')
|
||||||
|
export class DeesInputIban extends DeesElement {
|
||||||
|
// STATIC
|
||||||
|
public static demo = demoFunc;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
@state()
|
||||||
|
enteredString: string = '';
|
||||||
|
|
||||||
|
@state()
|
||||||
|
enteredIbanIsValid: boolean = false;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean,
|
||||||
|
})
|
||||||
|
public disabled = false;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean,
|
||||||
|
})
|
||||||
|
public required = false;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public label = '';
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public key = '';
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public value = '';
|
||||||
|
|
||||||
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject<DeesInputIban>();
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<style>
|
||||||
|
input[type='text'] {
|
||||||
|
line-height: 20px;
|
||||||
|
padding: 5px;
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<dees-input-text
|
||||||
|
.label=${'IBAN'}
|
||||||
|
.value=${this.value}
|
||||||
|
@input=${(eventArg: InputEvent) => {
|
||||||
|
this.validateIban(eventArg);
|
||||||
|
}}
|
||||||
|
></dees-input-text>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async firstUpdated() {
|
||||||
|
const deesInputText = this.shadowRoot.querySelector('dees-input-text');
|
||||||
|
deesInputText.disabled = this.disabled;
|
||||||
|
deesInputText.required = this.required;
|
||||||
|
deesInputText.changeSubject.subscribe(valueArg => {
|
||||||
|
this.value = valueArg.value;
|
||||||
|
this.changeSubject.next(this);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public async validateIban(eventArg: InputEvent): Promise<void> {
|
||||||
|
const inputElement: HTMLInputElement = eventArg.target as HTMLInputElement;
|
||||||
|
let enteredString = inputElement?.value;
|
||||||
|
enteredString = enteredString || '';
|
||||||
|
if (this.enteredString !== enteredString) {
|
||||||
|
this.enteredString = ibantools.friendlyFormatIBAN(enteredString) || '';
|
||||||
|
if (inputElement) {
|
||||||
|
inputElement.value = this.enteredString;
|
||||||
|
this.value = this.enteredString;
|
||||||
|
this.changeSubject.next(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.enteredIbanIsValid = ibantools.isValidIBAN(this.enteredString.replace(/ /g, ''));
|
||||||
|
const deesInputText = this.shadowRoot.querySelector('dees-input-text');
|
||||||
|
deesInputText.validationText = `IBAN is valid: ${this.enteredIbanIsValid}`;
|
||||||
|
}
|
||||||
|
}
|
3
ts_web/elements/dees-input-phone.demo.ts
Normal file
3
ts_web/elements/dees-input-phone.demo.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
export const demoFunc = () => html`<dees-input-phone .label=${'Phone Number'}></dees-input-phone>`;
|
29
ts_web/elements/dees-input-phone.ts
Normal file
29
ts_web/elements/dees-input-phone.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import {
|
||||||
|
customElement,
|
||||||
|
DeesElement,
|
||||||
|
type TemplateResult,
|
||||||
|
property,
|
||||||
|
html,
|
||||||
|
css,
|
||||||
|
unsafeCSS,
|
||||||
|
cssManager,
|
||||||
|
type CSSResult,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
import { demoFunc } from './dees-input-phone.demo.js';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-input-phone': DeesInputPhone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-input-phone')
|
||||||
|
export class DeesInputPhone extends DeesElement {
|
||||||
|
// STATIC
|
||||||
|
public static demo = demoFunc;
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
public render() {
|
||||||
|
return html`<div>Phone Input</div>`;
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@ export class DeesInputQuantitySelector extends DeesElement {
|
|||||||
public static demo = () => html`<dees-input-quantityselector></dees-input-quantityselector>`;
|
public static demo = () => html`<dees-input-quantityselector></dees-input-quantityselector>`;
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public label: string = 'Label';
|
public label: string = 'Label';
|
||||||
|
@ -12,7 +12,7 @@ export class DeesInputRadio extends DeesElement {
|
|||||||
public static demo = () => html`<dees-input-radio></dees-input-radio>`;
|
public static demo = () => html`<dees-input-radio></dees-input-radio>`;
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
|
0
ts_web/elements/dees-input-searchselect.ts
Normal file
0
ts_web/elements/dees-input-searchselect.ts
Normal file
0
ts_web/elements/dees-input-tags.ts
Normal file
0
ts_web/elements/dees-input-tags.ts
Normal file
@ -1,4 +1,13 @@
|
|||||||
import {customElement, DeesElement, type TemplateResult, property, html, cssManager, type CSSResult,} from '@design.estate/dees-element';
|
import {
|
||||||
|
customElement,
|
||||||
|
DeesElement,
|
||||||
|
type TemplateResult,
|
||||||
|
property,
|
||||||
|
html,
|
||||||
|
cssManager,
|
||||||
|
css,
|
||||||
|
type CSSResult,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@ -15,11 +24,10 @@ export class DeesInputText extends DeesElement {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.rxjs.Subject<DeesInputText>();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject<DeesInputText>();
|
||||||
public valueChangeSubject = new domtools.rxjs.Subject<string>();
|
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String
|
type: String,
|
||||||
})
|
})
|
||||||
public label: string;
|
public label: string;
|
||||||
|
|
||||||
@ -36,12 +44,12 @@ export class DeesInputText extends DeesElement {
|
|||||||
public value: string = '';
|
public value: string = '';
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Boolean
|
type: Boolean,
|
||||||
})
|
})
|
||||||
public required: boolean = false;
|
public required: boolean = false;
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Boolean
|
type: Boolean,
|
||||||
})
|
})
|
||||||
public disabled: boolean = false;
|
public disabled: boolean = false;
|
||||||
|
|
||||||
@ -57,93 +65,160 @@ export class DeesInputText extends DeesElement {
|
|||||||
})
|
})
|
||||||
public showPasswordBool = false;
|
public showPasswordBool = false;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean,
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
|
public validationState: 'valid' | 'warn' | 'invalid';
|
||||||
|
|
||||||
|
@property({
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
|
public validationText: string = '';
|
||||||
|
|
||||||
|
@property({})
|
||||||
|
validationFunction: (value: string) => boolean;
|
||||||
|
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
margin: 8px 0px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
z-index: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maincontainer {
|
||||||
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
margin-top: 5px;
|
||||||
|
background: ${cssManager.bdTheme('#fafafa', '#222')};
|
||||||
|
border-top: ${cssManager.bdTheme('1px solid #CCC', '1px solid #444')};
|
||||||
|
border-bottom: ${cssManager.bdTheme('1px solid #CCC', '1px solid #333')};
|
||||||
|
border-right: ${cssManager.bdTheme('1px solid #CCC', 'none')};
|
||||||
|
border-left: ${cssManager.bdTheme('1px solid #CCC', 'none')};
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
border-radius: 2px;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 36px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
outline: none;
|
||||||
|
font-size: 16px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
// see template for more
|
||||||
|
}
|
||||||
|
|
||||||
|
input:disabled {
|
||||||
|
background: ${cssManager.bdTheme('#ffffff00', '#11111100')};
|
||||||
|
border: 1px dashed ${cssManager.bdTheme('#666666', '#666666')};
|
||||||
|
color: #9b9b9e;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-bottom: 1px solid #e4002b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.showPassword {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 7px;
|
||||||
|
right: 10px;
|
||||||
|
border: 1px dashed #444;
|
||||||
|
border-radius: 7px;
|
||||||
|
padding: 4px 0px;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.showPassword:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
background: ${cssManager.bdTheme('#00000010', '#ffffff10')};
|
||||||
|
}
|
||||||
|
|
||||||
|
.validationContainer {
|
||||||
|
text-align: center;
|
||||||
|
padding: 6px 2px 2px 2px;
|
||||||
|
margin-top: -4px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
background: #e4002b;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
border-radius: 3px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html `
|
return html`
|
||||||
<style>
|
<style>
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host {
|
|
||||||
position: relative;
|
|
||||||
display: grid;
|
|
||||||
margin: 10px 0px;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.maincontainer {
|
|
||||||
color: ${this.goBright ? '#333' : '#ccc'};
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
font-size: 14px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
margin-top: 5px;
|
font-family: ${this.isPasswordBool ? 'monospace' : 'Inter'};
|
||||||
background: ${this.goBright ? '#fafafa' : '#222'};
|
letter-spacing: ${this.isPasswordBool ? '1px' : 'normal'};
|
||||||
border-top: ${this.goBright ? '1px solid #CCC' : '1px solid #444'};
|
|
||||||
border-bottom: ${this.goBright ? '1px solid #CCC' : '1px solid #333'};
|
|
||||||
border-right: ${this.goBright ? '1px solid #CCC' : 'none'};
|
|
||||||
border-left: ${this.goBright ? '1px solid #CCC' : 'none'};
|
|
||||||
padding-left:10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
border-radius: 2px;
|
|
||||||
width: 100%;
|
|
||||||
line-height: 48px;
|
|
||||||
transition: all 0.2s;
|
|
||||||
outline: none;
|
|
||||||
font-size: 16px;
|
|
||||||
font-family: ${this.isPasswordBool ? 'monospace': 'Inter'};
|
|
||||||
letter-spacing: ${this.isPasswordBool ? '1px': 'normal'};
|
|
||||||
color: ${this.goBright ? '#333' : '#ccc'};
|
color: ${this.goBright ? '#333' : '#ccc'};
|
||||||
}
|
}
|
||||||
|
${this.validationText ? css`
|
||||||
input:disabled {
|
.validationContainer {
|
||||||
background: ${cssManager.bdTheme('#ffffff00', '#11111100')};
|
height: 22px;
|
||||||
border: 1px dashed ${cssManager.bdTheme('#666666', '#666666')};
|
opacity: 1;
|
||||||
color: #9b9b9e;
|
}
|
||||||
cursor: default;
|
` : css`
|
||||||
}
|
.validationContainer {
|
||||||
|
height: 4px;
|
||||||
input:focus {
|
padding: 2px !important;
|
||||||
outline: none;
|
opacity: 0;
|
||||||
border-bottom: 1px solid #e4002b;
|
}
|
||||||
}
|
`}
|
||||||
|
|
||||||
.showPassword {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 8px;
|
|
||||||
right: 10px;
|
|
||||||
border: 1px dashed #444;
|
|
||||||
border-radius: 7px;
|
|
||||||
padding: 8px 0px;
|
|
||||||
width: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.showPassword:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
background: #333;
|
|
||||||
}
|
|
||||||
</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
|
||||||
${this.isPasswordBool ? html`
|
type="${this.isPasswordBool && !this.showPasswordBool ? 'password' : 'text'}"
|
||||||
<div class="showPassword" @click=${this.togglePasswordView}>
|
.value=${this.value}
|
||||||
<dees-icon .iconFA=${this.showPasswordBool ? 'eye' : 'eyeSlash'}></dees-icon>
|
@input="${this.updateValue}"
|
||||||
</div>
|
.disabled=${this.disabled}
|
||||||
` : html``}
|
/>
|
||||||
|
<div class="validationContainer">
|
||||||
|
${this.validationText}
|
||||||
|
</div>
|
||||||
|
${this.isPasswordBool
|
||||||
|
? html`
|
||||||
|
<div class="showPassword" @click=${this.togglePasswordView}>
|
||||||
|
<dees-icon .iconFA=${this.showPasswordBool ? 'eye' : 'eyeSlash'}></dees-icon>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: html``}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
const input = this.shadowRoot.querySelector('input');
|
||||||
|
input.addEventListener('input', (eventArg: InputEvent) => {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
this.changeSubject.next(this);
|
this.changeSubject.next(this);
|
||||||
this.valueChangeSubject.next(this.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async freeze() {
|
public async freeze() {
|
||||||
@ -154,10 +229,10 @@ export class DeesInputText extends DeesElement {
|
|||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async togglePasswordView () {
|
public async togglePasswordView() {
|
||||||
const domtools = await this.domtoolsPromise;
|
const domtools = await this.domtoolsPromise;
|
||||||
this.showPasswordBool = !this.showPasswordBool;
|
this.showPasswordBool = !this.showPasswordBool;
|
||||||
console.log(`this.showPasswordBool is: ${this.showPasswordBool}`)
|
console.log(`this.showPasswordBool is: ${this.showPasswordBool}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async focus() {
|
public async focus() {
|
||||||
|
@ -89,8 +89,8 @@ export class DeesMobilenavigation extends DeesElement {
|
|||||||
right: 0px;
|
right: 0px;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
background: ${cssManager.bdTheme('#eeeeeb', '#000')};;
|
background: ${cssManager.bdTheme('#eeeeeb', '#000')};
|
||||||
border-left: 1px dashed #444;
|
border-left: 1px solid ${cssManager.bdTheme('#eeeeeb', '#222')};
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ export class DeesMobilenavigation extends DeesElement {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
padding: 8px 0px;
|
padding: 8px 0px;
|
||||||
font-family: 'Mona Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
border-bottom: 1px dashed #444;
|
border-bottom: 1px dashed #444;
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
@ -156,6 +156,7 @@ export class DeesMobilenavigation extends DeesElement {
|
|||||||
const main = this.shadowRoot.querySelector('.main');
|
const main = this.shadowRoot.querySelector('.main');
|
||||||
if (!this.windowLayer) {
|
if (!this.windowLayer) {
|
||||||
this.windowLayer = new DeesWindowLayer();
|
this.windowLayer = new DeesWindowLayer();
|
||||||
|
this.windowLayer.options.blur = true;
|
||||||
this.windowLayer.addEventListener('click', () => {
|
this.windowLayer.addEventListener('click', () => {
|
||||||
this.hide();
|
this.hide();
|
||||||
});
|
});
|
||||||
|
@ -69,8 +69,9 @@ export class DeesModal extends DeesElement {
|
|||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
font-family: 'Mona Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
color: ${cssManager.bdTheme('#333', '#fff')};
|
color: ${cssManager.bdTheme('#333', '#fff')};
|
||||||
|
will-change: transform;
|
||||||
}
|
}
|
||||||
.modalContainer {
|
.modalContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -86,7 +87,7 @@ export class DeesModal extends DeesElement {
|
|||||||
}
|
}
|
||||||
.modal {
|
.modal {
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
transform: translateY(10px);
|
transform: translateY(0px) scale(0.95);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
width: 480px;
|
width: 480px;
|
||||||
min-height: 120px;
|
min-height: 120px;
|
||||||
@ -95,16 +96,22 @@ export class DeesModal extends DeesElement {
|
|||||||
border: 1px solid #222;
|
border: 1px solid #222;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
box-shadow: 0px 2px 5px #00000080;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal.show {
|
.modal.show {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateY(0px);
|
transform: translateY(0px) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal.show.predestroy {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px) scale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal .heading {
|
.modal .heading {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
font-family: 'Hubot Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
@ -182,7 +189,7 @@ export class DeesModal extends DeesElement {
|
|||||||
public async destroy() {
|
public async destroy() {
|
||||||
const domtools = await this.domtoolsPromise;
|
const domtools = await this.domtoolsPromise;
|
||||||
const modal = this.shadowRoot.querySelector('.modal');
|
const modal = this.shadowRoot.querySelector('.modal');
|
||||||
modal.classList.remove('show');
|
modal.classList.add('predestroy');
|
||||||
await domtools.convenience.smartdelay.delayFor(200);
|
await domtools.convenience.smartdelay.delayFor(200);
|
||||||
document.body.removeChild(this);
|
document.body.removeChild(this);
|
||||||
await this.windowLayer.destroy();
|
await this.windowLayer.destroy();
|
||||||
|
@ -32,7 +32,7 @@ export class DeesPdf extends DeesElement {
|
|||||||
return html`
|
return html`
|
||||||
<style>
|
<style>
|
||||||
:host {
|
:host {
|
||||||
font-family: 'Mona Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
|
@ -43,7 +43,7 @@ export class DeesSimpleAppDash extends DeesElement {
|
|||||||
border-bottom: 1px solid ${cssManager.bdTheme('#ccc', '#333')};
|
border-bottom: 1px solid ${cssManager.bdTheme('#ccc', '#333')};
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
font-family: 'Hubot Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
padding: 0px 16px;
|
padding: 0px 16px;
|
||||||
}
|
}
|
||||||
.appcontent {
|
.appcontent {
|
||||||
|
@ -154,7 +154,7 @@ export class DeesStepper extends DeesElement {
|
|||||||
.step .title {
|
.step .title {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
font-family: 'Mona Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,12 @@ import { type ITableAction } from './dees-table.js';
|
|||||||
import * as plugins from './plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
import { html } from '@design.estate/dees-element';
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
interface ITableDemoData {
|
||||||
|
date: string;
|
||||||
|
amount: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const demoFunc = () => html`
|
export const demoFunc = () => html`
|
||||||
<style>
|
<style>
|
||||||
.demoWrapper {
|
.demoWrapper {
|
||||||
@ -17,6 +23,7 @@ export const demoFunc = () => html`
|
|||||||
<dees-table
|
<dees-table
|
||||||
heading1="Current Account Statement"
|
heading1="Current Account Statement"
|
||||||
heading2="Bunq - Payment Account 2 - April 2021"
|
heading2="Bunq - Payment Account 2 - April 2021"
|
||||||
|
.editableFields="${['description']}"
|
||||||
.data=${[
|
.data=${[
|
||||||
{
|
{
|
||||||
date: '2021-04-01',
|
date: '2021-04-01',
|
||||||
@ -51,8 +58,8 @@ export const demoFunc = () => html`
|
|||||||
iconName: 'bell',
|
iconName: 'bell',
|
||||||
useTableBehaviour: 'upload',
|
useTableBehaviour: 'upload',
|
||||||
type: ['inRow'],
|
type: ['inRow'],
|
||||||
actionFunc: async (itemArg: any) => {
|
actionFunc: async (optionsArg) => {
|
||||||
alert(itemArg.amount);
|
alert(optionsArg.item.amount);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -100,7 +107,16 @@ export const demoFunc = () => html`
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
] as ITableAction[]}"
|
{
|
||||||
|
name: 'preview',
|
||||||
|
type: ['doubleClick', 'contextmenu'],
|
||||||
|
iconName: 'eye',
|
||||||
|
actionFunc: async (itemArg) => {
|
||||||
|
alert(itemArg.item.amount);
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
] as (ITableAction<ITableDemoData>)[] as any}"
|
||||||
.displayFunction=${(itemArg) => {
|
.displayFunction=${(itemArg) => {
|
||||||
return {
|
return {
|
||||||
...itemArg,
|
...itemArg,
|
||||||
|
@ -37,7 +37,15 @@ export interface ITableAction<T = any> {
|
|||||||
/**
|
/**
|
||||||
* the type of the action
|
* the type of the action
|
||||||
*/
|
*/
|
||||||
type: ('inRow' | 'contextmenu' | 'footer' | 'header' | 'preview' | 'keyCombination')[];
|
type: (
|
||||||
|
| 'inRow'
|
||||||
|
| 'contextmenu'
|
||||||
|
| 'doubleClick'
|
||||||
|
| 'footer'
|
||||||
|
| 'header'
|
||||||
|
| 'preview'
|
||||||
|
| 'keyCombination'
|
||||||
|
)[];
|
||||||
/**
|
/**
|
||||||
* allows to check if the action is relevant for the given item
|
* allows to check if the action is relevant for the given item
|
||||||
* @param itemArg
|
* @param itemArg
|
||||||
@ -49,7 +57,12 @@ export interface ITableAction<T = any> {
|
|||||||
* @param itemArg
|
* @param itemArg
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
actionFunc: (itemArg: T) => Promise<any>;
|
actionFunc: (actionDataArg: ITableActionDataArg<T>) => Promise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ITableActionDataArg<T> {
|
||||||
|
item: T;
|
||||||
|
table: DeesTable<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TDisplayFunction<T = any> = (itemArg: T) => object;
|
export type TDisplayFunction<T = any> = (itemArg: T) => object;
|
||||||
@ -75,6 +88,34 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
})
|
})
|
||||||
public data: T[] = [];
|
public data: T[] = [];
|
||||||
|
|
||||||
|
// dees-form compatibility -----------------------------------------
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public key: string;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: String,
|
||||||
|
})
|
||||||
|
public label: string;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean,
|
||||||
|
})
|
||||||
|
public disabled: boolean = false;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean,
|
||||||
|
})
|
||||||
|
public required: boolean = false;
|
||||||
|
|
||||||
|
get value() {
|
||||||
|
return this.data;
|
||||||
|
}
|
||||||
|
set value(valueArg) {}
|
||||||
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject<DeesTable<T>>();
|
||||||
|
// end dees-form compatibility -----------------------------------------
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String,
|
type: String,
|
||||||
reflect: true,
|
reflect: true,
|
||||||
@ -84,21 +125,33 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
@property({
|
@property({
|
||||||
type: Array,
|
type: Array,
|
||||||
})
|
})
|
||||||
public dataActions: ITableAction[] = [];
|
public dataActions: ITableAction<T>[] = [];
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
attribute: false,
|
attribute: false,
|
||||||
})
|
})
|
||||||
public displayFunction: TDisplayFunction = (itemArg: T) => itemArg as any;
|
public displayFunction: TDisplayFunction = (itemArg: T) => itemArg as any;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
attribute: false,
|
||||||
|
})
|
||||||
|
public reverseDisplayFunction: (itemArg: any) => T = (itemArg: any) => itemArg as T;
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Object,
|
type: Object,
|
||||||
})
|
})
|
||||||
public selectedDataRow: T;
|
public selectedDataRow: T;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Array,
|
||||||
|
})
|
||||||
|
public editableFields: string[] = [];
|
||||||
|
|
||||||
public files: File[] = [];
|
public files: File[] = [];
|
||||||
public fileWeakMap = new WeakMap();
|
public fileWeakMap = new WeakMap();
|
||||||
|
|
||||||
|
public dataChangeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -108,7 +161,7 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
css`
|
css`
|
||||||
.mainbox {
|
.mainbox {
|
||||||
color: ${cssManager.bdTheme('#333', '#fff')};
|
color: ${cssManager.bdTheme('#333', '#fff')};
|
||||||
font-family: 'Mona Sans', 'Inter', sans-serif;
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
@ -126,13 +179,13 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.headingContainer {
|
.headingContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
font-family: 'Hubot Sans', 'Inter', sans-serif;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading1 {
|
.heading1 {
|
||||||
@ -185,8 +238,8 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
tr:hover {
|
tr:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
tr:hover .innerCellContainer {
|
tr:hover td {
|
||||||
background: ${cssManager.bdTheme('#22222210', '#ffffff20')};
|
background: ${cssManager.bdTheme('#22222210', '#ffffff10')};
|
||||||
}
|
}
|
||||||
tr:first-child:hover {
|
tr:first-child:hover {
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
@ -194,19 +247,34 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
tr:first-child:hover .innerCellContainer {
|
tr:first-child:hover .innerCellContainer {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
tr.selected .innerCellContainer {
|
tr.selected td {
|
||||||
background: ${cssManager.bdTheme('#22222220', '#ffffff40')};
|
background: ${cssManager.bdTheme('#22222220', '#ffffff20')};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr.hasAttachment td {
|
||||||
|
background: ${cssManager.bdTheme('#0098847c', '#0098847c')};
|
||||||
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
text-transform: uppercase;
|
text-transform: none;
|
||||||
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 3px 0px;
|
position: relative;
|
||||||
|
vertical-align: top;
|
||||||
|
|
||||||
|
padding: 0px;
|
||||||
border-right: 1px dashed ${cssManager.bdTheme('#999', '#808080')};
|
border-right: 1px dashed ${cssManager.bdTheme('#999', '#808080')};
|
||||||
}
|
}
|
||||||
.innerCellContainer {
|
.innerCellContainer {
|
||||||
|
min-height: 36px;
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
th:first-child .innerCellContainer,
|
th:first-child .innerCellContainer,
|
||||||
td:first-child .innerCellContainer {
|
td:first-child .innerCellContainer {
|
||||||
@ -220,11 +288,29 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
td:last-child {
|
td:last-child {
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
td input {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
outline: none;
|
||||||
|
border: 2px solid #fa6101;
|
||||||
|
top: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
right: 0px;
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
background: #fa610140;
|
||||||
|
color: ${cssManager.bdTheme('#333', '#fff')};
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: inherit;
|
||||||
|
padding: 0px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
margin: -8px 0px;
|
margin: -6px 0px;
|
||||||
padding: 8px;
|
padding: 10px;
|
||||||
line-height: 16px;
|
line-height: 36px;
|
||||||
|
height: 36px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,10 +320,11 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.action:hover {
|
.action:hover {
|
||||||
background: ${cssManager.bdTheme('#CCC', '#111')};
|
background: ${cssManager.bdTheme('#CCC', '#00000030')};
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
font-family: 'Roboto', 'Inter', sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: ${cssManager.bdTheme('#111', '#ffffff90')};
|
color: ${cssManager.bdTheme('#111', '#ffffff90')};
|
||||||
background: ${cssManager.bdTheme('#eeeeeb', '#00000050')};
|
background: ${cssManager.bdTheme('#eeeeeb', '#00000050')};
|
||||||
@ -278,7 +365,7 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
<!-- the heading part -->
|
<!-- the heading part -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="headingContainer">
|
<div class="headingContainer">
|
||||||
<div class="heading heading1">${this.heading1}</div>
|
<div class="heading heading1">${this.label || this.heading1}</div>
|
||||||
<div class="heading heading2">${this.heading2}</div>
|
<div class="heading heading2">${this.heading2}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="headerActions">
|
<div class="headerActions">
|
||||||
@ -290,7 +377,10 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
html`<div
|
html`<div
|
||||||
class="headerAction"
|
class="headerAction"
|
||||||
@click=${() => {
|
@click=${() => {
|
||||||
action.actionFunc(this.selectedDataRow);
|
action.actionFunc({
|
||||||
|
item: this.selectedDataRow,
|
||||||
|
table: this,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
${action.iconName
|
${action.iconName
|
||||||
@ -306,6 +396,8 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
</div>
|
</div>
|
||||||
<div class="headingSeparation"></div>
|
<div class="headingSeparation"></div>
|
||||||
|
|
||||||
|
<dees-input-text></dees-input-text>
|
||||||
|
|
||||||
<!-- the actual table -->
|
<!-- the actual table -->
|
||||||
<style></style>
|
<style></style>
|
||||||
${this.data.length > 0
|
${this.data.length > 0
|
||||||
@ -355,14 +447,14 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
console.log('dragenter');
|
console.log('dragenter');
|
||||||
console.log(realTarget);
|
console.log(realTarget);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
realTarget.style.background = 'green';
|
realTarget.classList.add('hasAttachment');
|
||||||
}, 0);
|
}, 0);
|
||||||
}}
|
}}
|
||||||
@dragleave=${async (eventArg: DragEvent) => {
|
@dragleave=${async (eventArg: DragEvent) => {
|
||||||
eventArg.preventDefault();
|
eventArg.preventDefault();
|
||||||
eventArg.stopPropagation();
|
eventArg.stopPropagation();
|
||||||
const realTarget = getTr(eventArg.target as HTMLElement);
|
const realTarget = getTr(eventArg.target as HTMLElement);
|
||||||
realTarget.style.background = 'none';
|
realTarget.classList.remove('hasAttachment');
|
||||||
}}
|
}}
|
||||||
@dragover=${async (eventArg: DragEvent) => {
|
@dragover=${async (eventArg: DragEvent) => {
|
||||||
eventArg.preventDefault();
|
eventArg.preventDefault();
|
||||||
@ -383,23 +475,45 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@contextmenu=${async (eventArg: MouseEvent) => {
|
@contextmenu=${async (eventArg: MouseEvent) => {
|
||||||
DeesContextmenu.openContextMenuWithOptions(eventArg, this.getActionsForType('contextmenu').map(action => {
|
DeesContextmenu.openContextMenuWithOptions(
|
||||||
const menuItem: plugins.tsclass.website.IMenuItem = {
|
eventArg,
|
||||||
name: action.name,
|
this.getActionsForType('contextmenu').map((action) => {
|
||||||
iconName: action.iconName as any,
|
const menuItem: plugins.tsclass.website.IMenuItem = {
|
||||||
action: async () => {
|
name: action.name,
|
||||||
await action.actionFunc(itemArg);
|
iconName: action.iconName as any,
|
||||||
return null;
|
action: async () => {
|
||||||
}
|
await action.actionFunc({
|
||||||
}
|
item: itemArg,
|
||||||
return menuItem;
|
table: this,
|
||||||
}));
|
});
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return menuItem;
|
||||||
|
})
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
class="${itemArg === this.selectedDataRow ? 'selected' : ''}"
|
class="${itemArg === this.selectedDataRow ? 'selected' : ''}"
|
||||||
>
|
>
|
||||||
${headings.map(
|
${headings.map(
|
||||||
(headingArg) => html`
|
(headingArg) => html`
|
||||||
<td>
|
<td
|
||||||
|
@dblclick=${(e: Event) => {
|
||||||
|
if (this.editableFields.includes(headingArg)) {
|
||||||
|
this.handleCellEditing(e, itemArg, headingArg);
|
||||||
|
} else {
|
||||||
|
const wantedAction = this.dataActions.find((actionArg) =>
|
||||||
|
actionArg.type.includes('doubleClick')
|
||||||
|
);
|
||||||
|
if (wantedAction) {
|
||||||
|
wantedAction.actionFunc({
|
||||||
|
item: itemArg,
|
||||||
|
table: this,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div class="innerCellContainer">${transformedItem[headingArg]}</div>
|
<div class="innerCellContainer">${transformedItem[headingArg]}</div>
|
||||||
</td>
|
</td>
|
||||||
`
|
`
|
||||||
@ -412,7 +526,11 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
${this.getActionsForType('inRow').map(
|
${this.getActionsForType('inRow').map(
|
||||||
(actionArg) => html`<div
|
(actionArg) => html`<div
|
||||||
class="action"
|
class="action"
|
||||||
@click=${() => actionArg.actionFunc(itemArg)}
|
@click=${() =>
|
||||||
|
actionArg.actionFunc({
|
||||||
|
item: itemArg,
|
||||||
|
table: this,
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
${actionArg.iconName
|
${actionArg.iconName
|
||||||
? html`
|
? html`
|
||||||
@ -448,7 +566,10 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
html`<div
|
html`<div
|
||||||
class="footerAction"
|
class="footerAction"
|
||||||
@click=${() => {
|
@click=${() => {
|
||||||
action.actionFunc(this.selectedDataRow);
|
action.actionFunc({
|
||||||
|
item: this.selectedDataRow,
|
||||||
|
table: this,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
${action.iconName
|
${action.iconName
|
||||||
@ -468,6 +589,55 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
|
|
||||||
public async firstUpdated() {}
|
public async firstUpdated() {}
|
||||||
|
|
||||||
|
public async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
|
||||||
|
super.updated(changedProperties);
|
||||||
|
this.determineColumnWidths();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async determineColumnWidths() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
await domtools.convenience.smartdelay.delayFor(0);
|
||||||
|
// Get the table element
|
||||||
|
const table = this.shadowRoot.querySelector('table');
|
||||||
|
if (!table) return;
|
||||||
|
|
||||||
|
// Get the first row's cells to measure the widths
|
||||||
|
const cells = table.rows[0].cells;
|
||||||
|
|
||||||
|
const handleColumnByIndex = async (i: number, waitForRenderArg: boolean = false) => {
|
||||||
|
const done = plugins.smartpromise.defer();
|
||||||
|
const cell = cells[i];
|
||||||
|
|
||||||
|
// Get computed width
|
||||||
|
const width = window.getComputedStyle(cell).width;
|
||||||
|
if (cell.textContent.includes('Actions')) {
|
||||||
|
const neededWidth =
|
||||||
|
this.dataActions.filter((actionArg) => actionArg.type.includes('inRow')).length * 35;
|
||||||
|
cell.style.width = `${Math.max(neededWidth, 68)}px`;
|
||||||
|
} else {
|
||||||
|
cell.style.width = width;
|
||||||
|
}
|
||||||
|
if (waitForRenderArg) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
await done.promise;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (cells[cells.length - 1].textContent.includes('Actions')) {
|
||||||
|
await handleColumnByIndex(cells.length - 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < cells.length; i++) {
|
||||||
|
if (cells[i].textContent.includes('Actions')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
await handleColumnByIndex(i);
|
||||||
|
}
|
||||||
|
table.style.tableLayout = 'fixed';
|
||||||
|
}
|
||||||
|
|
||||||
getActionsForType(typeArg: ITableAction['type'][0]) {
|
getActionsForType(typeArg: ITableAction['type'][0]) {
|
||||||
const actions: ITableAction[] = [];
|
const actions: ITableAction[] = [];
|
||||||
for (const action of this.dataActions) {
|
for (const action of this.dataActions) {
|
||||||
@ -476,4 +646,44 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async handleCellEditing(event: Event, itemArg: T, key: string) {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
const target = event.target as HTMLElement;
|
||||||
|
const originalColor = target.style.color;
|
||||||
|
target.style.color = 'transparent';
|
||||||
|
const transformedItem = this.displayFunction(itemArg);
|
||||||
|
const initialValue = (transformedItem[key] as unknown as string) || '';
|
||||||
|
// Create an input element
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'text';
|
||||||
|
input.value = initialValue;
|
||||||
|
|
||||||
|
const blurInput = async (blurArg = true, saveArg = false) => {
|
||||||
|
if (blurArg) {
|
||||||
|
input.blur();
|
||||||
|
}
|
||||||
|
if (saveArg) {
|
||||||
|
itemArg[key] = input.value as any; // Convert string to T (you might need better type casting depending on your data structure)
|
||||||
|
this.changeSubject.next(this);
|
||||||
|
}
|
||||||
|
input.remove();
|
||||||
|
target.style.color = originalColor;
|
||||||
|
this.requestUpdate();
|
||||||
|
};
|
||||||
|
|
||||||
|
// When the input loses focus or the Enter key is pressed, update the data
|
||||||
|
input.addEventListener('blur', () => {
|
||||||
|
blurInput(false, false);
|
||||||
|
});
|
||||||
|
input.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
blurInput(true, true); // This will trigger the blur event handler above
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace the cell's content with the input
|
||||||
|
target.appendChild(input);
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
5
ts_web/elements/dees-toast.demo.ts
Normal file
5
ts_web/elements/dees-toast.demo.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
export const demoFunc = async () => {
|
||||||
|
return html`<dees-toast></dees-toast>`;
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import { customElement, DeesElement, type TemplateResult, html, type CSSResult, } from '@design.estate/dees-element';
|
import { customElement, DeesElement, type TemplateResult, html, type CSSResult, } from '@design.estate/dees-element';
|
||||||
|
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
import { demoFunc } from './dees-toast.demo.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -10,6 +11,7 @@ declare global {
|
|||||||
|
|
||||||
@customElement('dees-toast')
|
@customElement('dees-toast')
|
||||||
export class DeesToast extends DeesElement {
|
export class DeesToast extends DeesElement {
|
||||||
|
public static demo = demoFunc;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -66,14 +66,22 @@ export class DeesWindowLayer extends DeesElement {
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
}
|
}
|
||||||
|
.slotContent {
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.visible {
|
.visible {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgba(0, 0, 0, 0.2);
|
||||||
backdrop-filter: brightness(0.9) ${this.options.blur ? 'blur(2px)' : ''};
|
backdrop-filter: brightness(0.9) ${this.options.blur ? 'blur(2px)' : ''};
|
||||||
pointer-events: all;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div @click=${this.dispatchClicked} class="windowOverlay ${this.visible ? 'visible' : null}">
|
<div class="windowOverlay ${this.visible ? 'visible' : null}">
|
||||||
|
</div>
|
||||||
|
<div @click=${this.dispatchClicked} class="slotContent">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -6,10 +6,13 @@ export * from './dees-dataview-codebox.js';
|
|||||||
export * from './dees-dataview-statusobject.js';
|
export * from './dees-dataview-statusobject.js';
|
||||||
export * from './dees-form-submit.js';
|
export * from './dees-form-submit.js';
|
||||||
export * from './dees-form.js';
|
export * from './dees-form.js';
|
||||||
|
export * from './dees-hint.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';
|
||||||
export * from './dees-input-fileupload.js';
|
export * from './dees-input-fileupload.js';
|
||||||
|
export * from './dees-input-iban.js';
|
||||||
|
export * from './dees-input-phone.js';
|
||||||
export * from './dees-input-quantityselector.js';
|
export * from './dees-input-quantityselector.js';
|
||||||
export * from './dees-input-radio.js';
|
export * from './dees-input-radio.js';
|
||||||
export * from './dees-input-text.js';
|
export * from './dees-input-text.js';
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ES2022",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "nodenext",
|
"moduleResolution": "NodeNext",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"verbatimModuleSyntax": true
|
"verbatimModuleSyntax": true
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user