@design.estate/dees-catalog 1.0.202 → 1.0.204
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_bundle/bundle.js +51 -25
- package/dist_bundle/bundle.js.map +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/dees-table.d.ts +2 -0
- package/dist_ts_web/elements/dees-table.demo.js +2 -1
- package/dist_ts_web/elements/dees-table.js +70 -12
- package/dist_watch/bundle.js +79 -20
- package/dist_watch/bundle.js.map +3 -3
- package/package.json +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/dees-table.demo.ts +1 -0
- package/ts_web/elements/dees-table.ts +93 -20
package/package.json
CHANGED
|
@@ -37,7 +37,15 @@ export interface ITableAction<T = any> {
|
|
|
37
37
|
/**
|
|
38
38
|
* the type of the action
|
|
39
39
|
*/
|
|
40
|
-
type: (
|
|
40
|
+
type: (
|
|
41
|
+
| 'inRow'
|
|
42
|
+
| 'contextmenu'
|
|
43
|
+
| 'doubleClick'
|
|
44
|
+
| 'footer'
|
|
45
|
+
| 'header'
|
|
46
|
+
| 'preview'
|
|
47
|
+
| 'keyCombination'
|
|
48
|
+
)[];
|
|
41
49
|
/**
|
|
42
50
|
* allows to check if the action is relevant for the given item
|
|
43
51
|
* @param itemArg
|
|
@@ -96,6 +104,11 @@ export class DeesTable<T> extends DeesElement {
|
|
|
96
104
|
})
|
|
97
105
|
public selectedDataRow: T;
|
|
98
106
|
|
|
107
|
+
@property({
|
|
108
|
+
type: Array,
|
|
109
|
+
})
|
|
110
|
+
public editableFields: string[] = [];
|
|
111
|
+
|
|
99
112
|
public files: File[] = [];
|
|
100
113
|
public fileWeakMap = new WeakMap();
|
|
101
114
|
|
|
@@ -185,7 +198,7 @@ export class DeesTable<T> extends DeesElement {
|
|
|
185
198
|
tr:hover {
|
|
186
199
|
cursor: pointer;
|
|
187
200
|
}
|
|
188
|
-
tr:hover
|
|
201
|
+
tr:hover td {
|
|
189
202
|
background: ${cssManager.bdTheme('#22222210', '#ffffff20')};
|
|
190
203
|
}
|
|
191
204
|
tr:first-child:hover {
|
|
@@ -194,7 +207,7 @@ export class DeesTable<T> extends DeesElement {
|
|
|
194
207
|
tr:first-child:hover .innerCellContainer {
|
|
195
208
|
background: none;
|
|
196
209
|
}
|
|
197
|
-
tr.selected
|
|
210
|
+
tr.selected td {
|
|
198
211
|
background: ${cssManager.bdTheme('#22222220', '#ffffff40')};
|
|
199
212
|
}
|
|
200
213
|
th {
|
|
@@ -202,11 +215,17 @@ export class DeesTable<T> extends DeesElement {
|
|
|
202
215
|
}
|
|
203
216
|
th,
|
|
204
217
|
td {
|
|
205
|
-
|
|
218
|
+
position: relative;
|
|
219
|
+
padding: 0px;
|
|
206
220
|
border-right: 1px dashed ${cssManager.bdTheme('#999', '#808080')};
|
|
207
221
|
}
|
|
208
222
|
.innerCellContainer {
|
|
223
|
+
min-height: 36px;
|
|
224
|
+
position: relative;
|
|
225
|
+
height: 100%;
|
|
226
|
+
width: 100%;
|
|
209
227
|
padding: 6px 8px;
|
|
228
|
+
line-height: 24px;
|
|
210
229
|
}
|
|
211
230
|
th:first-child .innerCellContainer,
|
|
212
231
|
td:first-child .innerCellContainer {
|
|
@@ -220,6 +239,23 @@ export class DeesTable<T> extends DeesElement {
|
|
|
220
239
|
td:last-child {
|
|
221
240
|
border-right: none;
|
|
222
241
|
}
|
|
242
|
+
td input {
|
|
243
|
+
width: 100%;
|
|
244
|
+
height: 100%;
|
|
245
|
+
outline: none;
|
|
246
|
+
border: 2px solid #fa6101;
|
|
247
|
+
top: 0px;
|
|
248
|
+
bottom: 0px;
|
|
249
|
+
right: 0px;
|
|
250
|
+
left: 0px;
|
|
251
|
+
position: absolute;
|
|
252
|
+
background: #00000060;
|
|
253
|
+
color: inherit;
|
|
254
|
+
font-family: inherit;
|
|
255
|
+
font-size: inherit;
|
|
256
|
+
font-weight: inherit;
|
|
257
|
+
padding: 0px 6px
|
|
258
|
+
}
|
|
223
259
|
|
|
224
260
|
.action {
|
|
225
261
|
margin: -8px 0px;
|
|
@@ -383,27 +419,39 @@ export class DeesTable<T> extends DeesElement {
|
|
|
383
419
|
}
|
|
384
420
|
}}
|
|
385
421
|
@contextmenu=${async (eventArg: MouseEvent) => {
|
|
386
|
-
DeesContextmenu.openContextMenuWithOptions(
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
422
|
+
DeesContextmenu.openContextMenuWithOptions(
|
|
423
|
+
eventArg,
|
|
424
|
+
this.getActionsForType('contextmenu').map((action) => {
|
|
425
|
+
const menuItem: plugins.tsclass.website.IMenuItem = {
|
|
426
|
+
name: action.name,
|
|
427
|
+
iconName: action.iconName as any,
|
|
428
|
+
action: async () => {
|
|
429
|
+
await action.actionFunc(itemArg);
|
|
430
|
+
return null;
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
return menuItem;
|
|
434
|
+
})
|
|
435
|
+
);
|
|
397
436
|
}}
|
|
398
437
|
class="${itemArg === this.selectedDataRow ? 'selected' : ''}"
|
|
399
438
|
>
|
|
400
439
|
${headings.map(
|
|
401
440
|
(headingArg) => html`
|
|
402
|
-
<td
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
441
|
+
<td
|
|
442
|
+
@dblclick=${(e: Event) => {
|
|
443
|
+
if (this.editableFields.includes(headingArg)) {
|
|
444
|
+
this.handleCellEditing(e, itemArg, headingArg);
|
|
445
|
+
} else {
|
|
446
|
+
const wantedAction = this.dataActions.find((actionArg) =>
|
|
447
|
+
actionArg.type.includes('doubleClick')
|
|
448
|
+
);
|
|
449
|
+
if (wantedAction) {
|
|
450
|
+
wantedAction.actionFunc(itemArg);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}}
|
|
454
|
+
>
|
|
407
455
|
<div class="innerCellContainer">${transformedItem[headingArg]}</div>
|
|
408
456
|
</td>
|
|
409
457
|
`
|
|
@@ -480,4 +528,29 @@ export class DeesTable<T> extends DeesElement {
|
|
|
480
528
|
}
|
|
481
529
|
return actions;
|
|
482
530
|
}
|
|
531
|
+
|
|
532
|
+
handleCellEditing(event: Event, item: T, key: string) {
|
|
533
|
+
const target = event.target as HTMLElement;
|
|
534
|
+
|
|
535
|
+
// Create an input element
|
|
536
|
+
const input = document.createElement('input');
|
|
537
|
+
input.type = 'text';
|
|
538
|
+
input.value = (item[key] as unknown as string) || '';
|
|
539
|
+
|
|
540
|
+
// When the input loses focus or the Enter key is pressed, update the data
|
|
541
|
+
input.addEventListener('blur', () => {
|
|
542
|
+
item[key] = input.value as any; // Convert string to T (you might need better type casting depending on your data structure)
|
|
543
|
+
target.innerHTML = input.value; // Update the cell's display
|
|
544
|
+
});
|
|
545
|
+
input.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
546
|
+
if (e.key === 'Enter') {
|
|
547
|
+
input.blur(); // This will trigger the blur event handler above
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
// Replace the cell's content with the input
|
|
552
|
+
target.innerHTML = '';
|
|
553
|
+
target.appendChild(input);
|
|
554
|
+
input.focus();
|
|
555
|
+
}
|
|
483
556
|
}
|