Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
c30736870d | |||
cfd48de885 | |||
462df2b648 | |||
f64da93cf9 | |||
a55db621ef | |||
c033bdfc3b | |||
2610e56ec1 | |||
08aa9e3fe4 | |||
411ae7ee07 | |||
41700c1eb1 | |||
8d7bac9793 | |||
0229eefa4d | |||
61f646743a | |||
e3babde7e8 | |||
c389e43e93 | |||
1511db4eea | |||
d713756034 | |||
17d224332d | |||
32dd5e769b | |||
12ace00a90 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@design.estate/dees-catalog",
|
"name": "@design.estate/dees-catalog",
|
||||||
"version": "1.0.193",
|
"version": "1.0.203",
|
||||||
"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",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-catalog',
|
name: '@design.estate/dees-catalog',
|
||||||
version: '1.0.193',
|
version: '1.0.203',
|
||||||
description: 'website for lossless.com'
|
description: 'website for lossless.com'
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ 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,
|
||||||
@ -82,6 +83,8 @@ export const faIcons = {
|
|||||||
circleCheckSolid: faCircleCheckSolid,
|
circleCheckSolid: faCircleCheckSolid,
|
||||||
circleXmark: faCircleXmarkRegular,
|
circleXmark: faCircleXmarkRegular,
|
||||||
circleXmarkSolid: faCircleXmarkSolid,
|
circleXmarkSolid: faCircleXmarkSolid,
|
||||||
|
clockRotateLeft: faClockRotateLeftSolid,
|
||||||
|
clockRotateLeftSolid: faClockRotateLeftSolid,
|
||||||
copy: faCopyRegular,
|
copy: faCopyRegular,
|
||||||
copySolid: faCopySolid,
|
copySolid: faCopySolid,
|
||||||
desktop: faDesktopSolid,
|
desktop: faDesktopSolid,
|
||||||
@ -95,7 +98,7 @@ export const faIcons = {
|
|||||||
message: faMessageRegular,
|
message: faMessageRegular,
|
||||||
messageSolid: faMessageSolid,
|
messageSolid: faMessageSolid,
|
||||||
mugHot: faMugHotSolid,
|
mugHot: faMugHotSolid,
|
||||||
faMugHotSolid: faMugHotSolid,
|
mugHotSolid: faMugHotSolid,
|
||||||
minus: faMinusSolid,
|
minus: faMinusSolid,
|
||||||
minusSolid: faMinusSolid,
|
minusSolid: faMinusSolid,
|
||||||
paste: faPasteRegular,
|
paste: faPasteRegular,
|
||||||
|
@ -38,7 +38,9 @@ export class DeesModal extends DeesElement {
|
|||||||
modal.heading = optionsArg.heading;
|
modal.heading = optionsArg.heading;
|
||||||
modal.content = optionsArg.content;
|
modal.content = optionsArg.content;
|
||||||
modal.menuOptions = optionsArg.menuOptions;
|
modal.menuOptions = optionsArg.menuOptions;
|
||||||
modal.windowLayer = await DeesWindowLayer.createAndShow();
|
modal.windowLayer = await DeesWindowLayer.createAndShow({
|
||||||
|
blur: true,
|
||||||
|
});
|
||||||
modal.windowLayer.addEventListener('click', async () => {
|
modal.windowLayer.addEventListener('click', async () => {
|
||||||
await modal.destroy();
|
await modal.destroy();
|
||||||
});
|
});
|
||||||
@ -73,6 +75,8 @@ export class DeesModal extends DeesElement {
|
|||||||
.modalContainer {
|
.modalContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -82,7 +86,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;
|
||||||
@ -91,11 +95,17 @@ 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 {
|
||||||
@ -178,7 +188,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();
|
||||||
|
@ -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,7 +58,7 @@ export const demoFunc = () => html`
|
|||||||
iconName: 'bell',
|
iconName: 'bell',
|
||||||
useTableBehaviour: 'upload',
|
useTableBehaviour: 'upload',
|
||||||
type: ['inRow'],
|
type: ['inRow'],
|
||||||
actionFunc: async (itemArg: any) => {
|
actionFunc: async (itemArg) => {
|
||||||
alert(itemArg.amount);
|
alert(itemArg.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.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
|
||||||
@ -84,7 +92,7 @@ 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,
|
||||||
@ -96,6 +104,11 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
})
|
})
|
||||||
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();
|
||||||
|
|
||||||
@ -185,7 +198,7 @@ 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', '#ffffff20')};
|
||||||
}
|
}
|
||||||
tr:first-child:hover {
|
tr:first-child:hover {
|
||||||
@ -194,7 +207,7 @@ 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', '#ffffff40')};
|
||||||
}
|
}
|
||||||
th {
|
th {
|
||||||
@ -202,11 +215,17 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 3px 0px;
|
position: relative;
|
||||||
|
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,6 +239,23 @@ 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: #00000060;
|
||||||
|
color: inherit;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: inherit;
|
||||||
|
padding: 0px 6px
|
||||||
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
margin: -8px 0px;
|
margin: -8px 0px;
|
||||||
@ -383,23 +419,39 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@contextmenu=${async (eventArg: MouseEvent) => {
|
@contextmenu=${async (eventArg: MouseEvent) => {
|
||||||
DeesContextmenu.openContextMenuWithOptions(eventArg, this.getActionsForType('contextmenu').map(action => {
|
DeesContextmenu.openContextMenuWithOptions(
|
||||||
|
eventArg,
|
||||||
|
this.getActionsForType('contextmenu').map((action) => {
|
||||||
const menuItem: plugins.tsclass.website.IMenuItem = {
|
const menuItem: plugins.tsclass.website.IMenuItem = {
|
||||||
name: action.name,
|
name: action.name,
|
||||||
iconName: action.iconName as any,
|
iconName: action.iconName as any,
|
||||||
action: async () => {
|
action: async () => {
|
||||||
await action.actionFunc(itemArg);
|
await action.actionFunc(itemArg);
|
||||||
return null;
|
return null;
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
return menuItem;
|
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(itemArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div class="innerCellContainer">${transformedItem[headingArg]}</div>
|
<div class="innerCellContainer">${transformedItem[headingArg]}</div>
|
||||||
</td>
|
</td>
|
||||||
`
|
`
|
||||||
@ -476,4 +528,29 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleCellEditing(event: Event, item: T, key: string) {
|
||||||
|
const target = event.target as HTMLElement;
|
||||||
|
|
||||||
|
// Create an input element
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'text';
|
||||||
|
input.value = (item[key] as unknown as string) || '';
|
||||||
|
|
||||||
|
// When the input loses focus or the Enter key is pressed, update the data
|
||||||
|
input.addEventListener('blur', () => {
|
||||||
|
item[key] = input.value as any; // Convert string to T (you might need better type casting depending on your data structure)
|
||||||
|
target.innerHTML = input.value; // Update the cell's display
|
||||||
|
});
|
||||||
|
input.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
input.blur(); // This will trigger the blur event handler above
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace the cell's content with the input
|
||||||
|
target.innerHTML = '';
|
||||||
|
target.appendChild(input);
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { customElement, DeesElement, type TemplateResult, html, property, type CSSResult, } from '@design.estate/dees-element';
|
import { customElement, DeesElement, type TemplateResult, html, property, type CSSResult, state, } from '@design.estate/dees-element';
|
||||||
|
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
@ -8,20 +8,33 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IOptions_DeesWindowLayer {
|
||||||
|
blur: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('dees-windowlayer')
|
@customElement('dees-windowlayer')
|
||||||
export class DeesWindowLayer extends DeesElement {
|
export class DeesWindowLayer extends DeesElement {
|
||||||
// STATIC
|
// STATIC
|
||||||
public static demo = () => html`<dees-windowlayer></dees-windowlayer>`;
|
public static demo = () => html`<dees-windowlayer></dees-windowlayer>`;
|
||||||
|
|
||||||
public static async createAndShow() {
|
public static async createAndShow(optionsArg?: IOptions_DeesWindowLayer) {
|
||||||
const domtoolsInstance = domtools.DomTools.getGlobalDomToolsSync();
|
const domtoolsInstance = domtools.DomTools.getGlobalDomToolsSync();
|
||||||
const windowLayer = new DeesWindowLayer();
|
const windowLayer = new DeesWindowLayer();
|
||||||
|
windowLayer.options = {
|
||||||
|
...windowLayer.options,
|
||||||
|
...optionsArg,
|
||||||
|
}
|
||||||
document.body.append(windowLayer);
|
document.body.append(windowLayer);
|
||||||
await domtoolsInstance.convenience.smartdelay.delayFor(0);
|
await domtoolsInstance.convenience.smartdelay.delayFor(0);
|
||||||
windowLayer.show();
|
windowLayer.show();
|
||||||
return windowLayer;
|
return windowLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@state()
|
||||||
|
public options: IOptions_DeesWindowLayer = {
|
||||||
|
blur: false
|
||||||
|
};
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
@property({
|
@property({
|
||||||
type: Boolean
|
type: Boolean
|
||||||
@ -49,14 +62,14 @@ export class DeesWindowLayer extends DeesElement {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: rgba(0, 0, 0, 0.0);
|
background: rgba(0, 0, 0, 0.0);
|
||||||
backdrop-filter: brightness(1);
|
backdrop-filter: brightness(1) ${this.options.blur ? 'blur(0px)' : ''};
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visible {
|
.visible {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgba(0, 0, 0, 0.2);
|
||||||
backdrop-filter: brightness(0.3);
|
backdrop-filter: brightness(0.9) ${this.options.blur ? 'blur(2px)' : ''};
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user