@design.estate/dees-catalog 21.32.3 → 21.33.0
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 +1545 -332
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZRD47DC6.js → chunk-B3NM6BL3.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-EL3KNDIB.js → chunk-BDUZ7I23.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LDC2GECY.js → chunk-IK5OF7M4.js} +33 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LDC2GECY.js.map → chunk-IK5OF7M4.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-YOX3NS2W.js → de-PTMMQ5DA.js} +33 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-PTMMQ5DA.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-7LJGK5SK.js → dees-modal-BZIJFVRI.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-O3NEQ4DO.js → dees-workspace-terminal-EU377EZY.js} +4 -4
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-chart/dees-chart-area/component.d.ts +18 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-area/component.js +60 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.d.ts +24 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.js +80 -0
- package/dist_ts_web/elements/00group-feedback/dees-hint/dees-hint.d.ts +1 -0
- package/dist_ts_web/elements/00group-feedback/dees-hint/dees-hint.js +13 -3
- package/dist_ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.js +7 -5
- package/dist_ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.d.ts +0 -3
- package/dist_ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.js +10 -182
- package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.d.ts +64 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.js +221 -22
- package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.js +544 -66
- package/dist_ts_web/elements/00group-harness/harness.helpers.d.ts +16 -1
- package/dist_ts_web/elements/00group-harness/harness.helpers.js +25 -1
- package/dist_ts_web/elements/00group-harness/harness.records.d.ts +27 -0
- package/dist_ts_web/elements/00group-harness/harness.records.js +193 -0
- package/dist_ts_web/elements/00group-harness/interfaces.d.ts +93 -4
- package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.d.ts +39 -0
- package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.js +22 -8
- package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +265 -25
- package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.d.ts +5 -0
- package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.js +70 -11
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +16 -1
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +188 -5
- package/dist_ts_web/elements/00group-kanban/interfaces.d.ts +47 -2
- package/dist_ts_web/elements/00group-kanban/kanban.demodata.d.ts +7 -1
- package/dist_ts_web/elements/00group-kanban/kanban.demodata.js +49 -7
- package/dist_ts_web/elements/00group-kanban/kanban.dragcontroller.js +6 -1
- package/dist_ts_web/elements/00group-kanban/kanban.helpers.d.ts +15 -1
- package/dist_ts_web/elements/00group-kanban/kanban.helpers.js +31 -1
- package/dist_ts_web/i18n/de.d.ts +124 -0
- package/dist_ts_web/i18n/de.js +32 -1
- package/dist_ts_web/i18n/messages.d.ts +124 -0
- package/dist_ts_web/i18n/messages.js +32 -1
- package/package.json +1 -1
- package/readme.md +76 -13
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-chart/dees-chart-area/component.ts +59 -1
- package/ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.ts +97 -0
- package/ts_web/elements/00group-feedback/dees-hint/dees-hint.ts +16 -3
- package/ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.ts +6 -4
- package/ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.ts +16 -186
- package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.ts +261 -55
- package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts +575 -88
- package/ts_web/elements/00group-harness/harness.helpers.ts +39 -0
- package/ts_web/elements/00group-harness/harness.records.ts +210 -0
- package/ts_web/elements/00group-harness/interfaces.ts +99 -4
- package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.ts +21 -5
- package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +256 -24
- package/ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts +67 -6
- package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +202 -1
- package/ts_web/elements/00group-kanban/interfaces.ts +55 -3
- package/ts_web/elements/00group-kanban/kanban.demodata.ts +62 -6
- package/ts_web/elements/00group-kanban/kanban.dragcontroller.ts +5 -0
- package/ts_web/elements/00group-kanban/kanban.helpers.ts +53 -0
- package/ts_web/i18n/de.ts +31 -0
- package/ts_web/i18n/messages.ts +31 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-YOX3NS2W.js.map +0 -1
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZRD47DC6.js.map → chunk-B3NM6BL3.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-EL3KNDIB.js.map → chunk-BDUZ7I23.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-7LJGK5SK.js.map → dees-modal-BZIJFVRI.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-O3NEQ4DO.js.map → dees-workspace-terminal-EU377EZY.js.map} +0 -0
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
IKanbanColumn,
|
|
16
16
|
IKanbanComment,
|
|
17
17
|
IKanbanCreate,
|
|
18
|
+
IKanbanEditConflict,
|
|
18
19
|
IKanbanFilterValues,
|
|
19
20
|
IKanbanMove,
|
|
20
21
|
IKanbanPerson,
|
|
@@ -22,6 +23,7 @@ import type {
|
|
|
22
23
|
IKanbanProvider,
|
|
23
24
|
IKanbanTicket,
|
|
24
25
|
IKanbanTicketDraft,
|
|
26
|
+
TKanbanDraftField,
|
|
25
27
|
} from '../interfaces.js';
|
|
26
28
|
import type {
|
|
27
29
|
TReferenceContent,
|
|
@@ -29,20 +31,30 @@ import type {
|
|
|
29
31
|
} from '../../00group-input/dees-input-reference/interfaces.js';
|
|
30
32
|
import { DeesModal } from '../../00group-overlay/dees-modal/dees-modal.js';
|
|
31
33
|
import { DeesContextmenu } from '../../00group-overlay/dees-contextmenu/dees-contextmenu.js';
|
|
34
|
+
import { DeesInputText } from '../../00group-input/dees-input-text/dees-input-text.js';
|
|
35
|
+
import { DeesInputDropdown } from '../../00group-input/dees-input-dropdown/dees-input-dropdown.js';
|
|
36
|
+
import '../../00group-form/dees-form/dees-form.js';
|
|
32
37
|
import type {
|
|
33
38
|
DeesPopover,
|
|
34
39
|
IDeesPopoverCloseDetail,
|
|
35
40
|
} from '../../00group-overlay/dees-popover/dees-popover.js';
|
|
36
|
-
import
|
|
41
|
+
import {
|
|
42
|
+
catalogAction,
|
|
43
|
+
type IActionFooterAction,
|
|
44
|
+
} from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
37
45
|
import { DeesKanbanTicketDetail } from '../dees-kanban-ticket-detail/dees-kanban-ticket-detail.js';
|
|
38
46
|
import { kanbanStyles } from '../kanban.styles.js';
|
|
39
47
|
import {
|
|
48
|
+
isKanbanRevisionConflict,
|
|
49
|
+
kanbanDraftChanges,
|
|
40
50
|
kanbanError,
|
|
41
51
|
kanbanEvent,
|
|
42
52
|
kanbanProjectName,
|
|
43
53
|
kanbanProjects,
|
|
54
|
+
kanbanTicketVersion,
|
|
44
55
|
sameKanbanLabels,
|
|
45
56
|
sortKanbanTickets,
|
|
57
|
+
ticketDraft,
|
|
46
58
|
ticketLabel,
|
|
47
59
|
} from '../kanban.helpers.js';
|
|
48
60
|
import {
|
|
@@ -82,6 +94,10 @@ const interactionEvents = [
|
|
|
82
94
|
'kanban-comments-refresh',
|
|
83
95
|
'kanban-activity-refresh',
|
|
84
96
|
'kanban-detail-back',
|
|
97
|
+
'kanban-ticket-reload',
|
|
98
|
+
'kanban-conflict-apply',
|
|
99
|
+
'kanban-conflict-dismiss',
|
|
100
|
+
'kanban-column-toggle',
|
|
85
101
|
] as const;
|
|
86
102
|
|
|
87
103
|
interface IKanbanInteractionMap {
|
|
@@ -96,6 +112,10 @@ interface IKanbanInteractionMap {
|
|
|
96
112
|
'kanban-comments-refresh': { ticketId: string };
|
|
97
113
|
'kanban-activity-refresh': { ticketId: string };
|
|
98
114
|
'kanban-detail-back': Record<string, never>;
|
|
115
|
+
'kanban-ticket-reload': { ticketId: string };
|
|
116
|
+
'kanban-conflict-apply': { ticketId: string; field: TKanbanDraftField };
|
|
117
|
+
'kanban-conflict-dismiss': { ticketId: string };
|
|
118
|
+
'kanban-column-toggle': { columnId: string };
|
|
99
119
|
}
|
|
100
120
|
|
|
101
121
|
type TKanbanInteraction = {
|
|
@@ -178,6 +198,10 @@ export class DeesKanban extends DeesElement {
|
|
|
178
198
|
@state()
|
|
179
199
|
private accessor openingTicket = false;
|
|
180
200
|
|
|
201
|
+
/** The reader's folding of collapsible columns, by column id: `true` folded, `false` open. */
|
|
202
|
+
@state()
|
|
203
|
+
private accessor columnsCollapsed: Record<string, boolean> = {};
|
|
204
|
+
|
|
181
205
|
private modal?: DeesModal;
|
|
182
206
|
private modalOpening?: Promise<DeesModal>;
|
|
183
207
|
private detail?: DeesKanbanTicketDetail;
|
|
@@ -198,6 +222,17 @@ export class DeesKanban extends DeesElement {
|
|
|
198
222
|
private commentRevisions = new Map<string, number>();
|
|
199
223
|
private commentDrafts = new Map<string, TReferenceContent>();
|
|
200
224
|
private ticketDrafts = new Map<string, IKanbanTicketDraft>();
|
|
225
|
+
/** Each unsaved edit's ticket as the edit started, by ticket id: what differs from it is the person's change. */
|
|
226
|
+
private draftBases = new Map<string, IKanbanTicketDraft>();
|
|
227
|
+
/** Saves the provider refused as stale, by ticket id, until saved, cancelled or discarded. */
|
|
228
|
+
private conflicts = new Map<string, IKanbanEditConflict>();
|
|
229
|
+
/**
|
|
230
|
+
* The ticket whose move or save the provider refused, and the state of it the refusal answered;
|
|
231
|
+
* the refusal's words leave once the board holds another state of the ticket.
|
|
232
|
+
*/
|
|
233
|
+
private refusal?: { ticketId: string; version: string };
|
|
234
|
+
/** Each ticket's running reload after a refused save, by ticket id. */
|
|
235
|
+
private reloadAborts = new Map<string, AbortController>();
|
|
201
236
|
private resolvedTickets = new Map<string, IKanbanTicket>();
|
|
202
237
|
private activeMove?: symbol;
|
|
203
238
|
private readonly dragController = new KanbanDragController(
|
|
@@ -347,6 +382,19 @@ export class DeesKanban extends DeesElement {
|
|
|
347
382
|
await connection;
|
|
348
383
|
}
|
|
349
384
|
|
|
385
|
+
public willUpdate(changed: Map<PropertyKey, unknown>): void {
|
|
386
|
+
super.willUpdate(changed);
|
|
387
|
+
// Another client's change, or one's own later move, ends a refusal; a reload the refusal itself
|
|
388
|
+
// caused brings the same state, and its words stay.
|
|
389
|
+
const refusal = this.refusal;
|
|
390
|
+
if (
|
|
391
|
+
refusal &&
|
|
392
|
+
changed.has('tickets') &&
|
|
393
|
+
kanbanTicketVersion(this.findTicket(refusal.ticketId)) !== refusal.version
|
|
394
|
+
)
|
|
395
|
+
this.clearOperationError();
|
|
396
|
+
}
|
|
397
|
+
|
|
350
398
|
public updated(): void {
|
|
351
399
|
this.syncDetail();
|
|
352
400
|
this.dragController.sync();
|
|
@@ -479,6 +527,7 @@ export class DeesKanban extends DeesElement {
|
|
|
479
527
|
.canCreate=${Boolean(this.provider.createTicket)}
|
|
480
528
|
.movesDisabled=${Boolean(this.pendingTicketId)}
|
|
481
529
|
.pendingTicketId=${this.pendingTicketId}
|
|
530
|
+
.collapsed=${this.isCollapsed(column)}
|
|
482
531
|
></dees-kanban-column>`)}
|
|
483
532
|
</div>`}`;
|
|
484
533
|
}
|
|
@@ -508,6 +557,13 @@ export class DeesKanban extends DeesElement {
|
|
|
508
557
|
</div>`;
|
|
509
558
|
}
|
|
510
559
|
|
|
560
|
+
/** Whether a collapsible column is folded: as the reader left it, else as it starts. */
|
|
561
|
+
private isCollapsed(column: IKanbanColumn): boolean {
|
|
562
|
+
return column.collapsible
|
|
563
|
+
? this.columnsCollapsed[column.id] ?? column.collapsible === 'collapsed'
|
|
564
|
+
: false;
|
|
565
|
+
}
|
|
566
|
+
|
|
511
567
|
/** Whether a ticket belongs to a project: its own, or for an epic, one of its tasks'. */
|
|
512
568
|
private inProject(ticket: IKanbanTicket, project: string): boolean {
|
|
513
569
|
return ticket.project === project || (
|
|
@@ -731,7 +787,7 @@ export class DeesKanban extends DeesElement {
|
|
|
731
787
|
this.openAbort?.abort();
|
|
732
788
|
const controller = this.openAbort = new AbortController();
|
|
733
789
|
this.openingTicket = true;
|
|
734
|
-
this.
|
|
790
|
+
this.clearOperationError();
|
|
735
791
|
try {
|
|
736
792
|
const ticket = this.provider.getTicket
|
|
737
793
|
? await this.provider.getTicket(id, controller.signal)
|
|
@@ -812,6 +868,7 @@ export class DeesKanban extends DeesElement {
|
|
|
812
868
|
this.detail.activity = this.activityCache.get(this.selectedId) ?? [];
|
|
813
869
|
this.detail.commentDraft = this.commentDrafts.get(this.selectedId) ?? [];
|
|
814
870
|
this.detail.draft = this.ticketDrafts.get(this.selectedId);
|
|
871
|
+
this.detail.conflict = this.conflicts.get(this.selectedId);
|
|
815
872
|
this.detail.canGoBack = this.history.length > 0;
|
|
816
873
|
this.detail.saving = this.pendingTicketId === this.selectedId;
|
|
817
874
|
if (this.modal) this.modal.heading = this.detail.ticket.key;
|
|
@@ -999,7 +1056,7 @@ export class DeesKanban extends DeesElement {
|
|
|
999
1056
|
}
|
|
1000
1057
|
const operation = this.activeMove = Symbol();
|
|
1001
1058
|
this.pendingTicketId = ticket.id;
|
|
1002
|
-
this.
|
|
1059
|
+
this.clearOperationError();
|
|
1003
1060
|
try {
|
|
1004
1061
|
const changed = await this.provider.moveTicket(input);
|
|
1005
1062
|
if (this.activeMove !== operation) return false;
|
|
@@ -1013,7 +1070,7 @@ export class DeesKanban extends DeesElement {
|
|
|
1013
1070
|
}
|
|
1014
1071
|
return true;
|
|
1015
1072
|
} catch (error) {
|
|
1016
|
-
if (this.activeMove === operation) this.reportError(error);
|
|
1073
|
+
if (this.activeMove === operation) this.reportError(error, ticket.id);
|
|
1017
1074
|
return false;
|
|
1018
1075
|
} finally {
|
|
1019
1076
|
if (this.activeMove === operation) {
|
|
@@ -1024,14 +1081,21 @@ export class DeesKanban extends DeesElement {
|
|
|
1024
1081
|
}
|
|
1025
1082
|
}
|
|
1026
1083
|
|
|
1084
|
+
/**
|
|
1085
|
+
* Saves an edit through the provider's `updateTicket`, with the revision it started from. A save
|
|
1086
|
+
* the provider refuses as stale (`IKanbanRevisionConflict`) keeps the edit and holds the refusal
|
|
1087
|
+
* in the detail, which offers to reload the ticket; another save waits for the reload.
|
|
1088
|
+
*/
|
|
1027
1089
|
private async saveTicket(ticketId: string, draft: IKanbanTicketDraft): Promise<void> {
|
|
1028
1090
|
const ticket = this.findTicket(ticketId);
|
|
1091
|
+
const conflict = this.conflicts.get(ticketId);
|
|
1029
1092
|
if (
|
|
1030
1093
|
!ticket ||
|
|
1031
1094
|
!this.provider.updateTicket ||
|
|
1032
1095
|
ticket.permissions?.edit === false ||
|
|
1033
1096
|
this.pendingTicketId ||
|
|
1034
|
-
!draft.title.trim()
|
|
1097
|
+
!draft.title.trim() ||
|
|
1098
|
+
(conflict && conflict.state !== 'reloaded')
|
|
1035
1099
|
)
|
|
1036
1100
|
return;
|
|
1037
1101
|
const parent = draft.parentId ? this.findTicket(draft.parentId) : undefined;
|
|
@@ -1050,7 +1114,7 @@ export class DeesKanban extends DeesElement {
|
|
|
1050
1114
|
return;
|
|
1051
1115
|
}
|
|
1052
1116
|
this.pendingTicketId = ticketId;
|
|
1053
|
-
this.
|
|
1117
|
+
this.clearOperationError();
|
|
1054
1118
|
if (this.detail) this.detail.error = '';
|
|
1055
1119
|
try {
|
|
1056
1120
|
const saved = await this.provider.updateTicket({
|
|
@@ -1068,20 +1132,82 @@ export class DeesKanban extends DeesElement {
|
|
|
1068
1132
|
? { project: draft.project }
|
|
1069
1133
|
: {},
|
|
1070
1134
|
},
|
|
1135
|
+
...draft.revision === undefined ? {} : { expectedRevision: draft.revision },
|
|
1071
1136
|
});
|
|
1072
1137
|
if (saved.id !== ticketId)
|
|
1073
1138
|
throw new Error(this.t('kanban.updateMismatch'));
|
|
1074
1139
|
this.ticketDrafts.delete(ticketId);
|
|
1140
|
+
this.draftBases.delete(ticketId);
|
|
1141
|
+
this.conflicts.delete(ticketId);
|
|
1075
1142
|
this.mergeTickets([saved]);
|
|
1076
1143
|
if (this.selectedId === ticketId) this.detail?.finishEditing();
|
|
1077
1144
|
} catch (error) {
|
|
1078
|
-
|
|
1145
|
+
if (isKanbanRevisionConflict(error)) {
|
|
1146
|
+
const message = kanbanError(error);
|
|
1147
|
+
this.conflicts.set(ticketId, { message, edit: {}, state: 'stale' });
|
|
1148
|
+
kanbanEvent(this, 'kanban-error', { error, message });
|
|
1149
|
+
} else this.reportError(error, ticketId);
|
|
1079
1150
|
} finally {
|
|
1080
1151
|
this.pendingTicketId = '';
|
|
1081
1152
|
this.syncDetail();
|
|
1082
1153
|
}
|
|
1083
1154
|
}
|
|
1084
1155
|
|
|
1156
|
+
/**
|
|
1157
|
+
* Loads a ticket whose save the provider refused as stale and starts its edit again from the
|
|
1158
|
+
* latest version. What the person changed that the latest version does not hold stays in the
|
|
1159
|
+
* refusal, to apply field by field.
|
|
1160
|
+
*/
|
|
1161
|
+
private async reloadTicket(ticketId: string): Promise<void> {
|
|
1162
|
+
const conflict = this.conflicts.get(ticketId);
|
|
1163
|
+
if (!conflict || conflict.state === 'reloading') return;
|
|
1164
|
+
const controller = new AbortController();
|
|
1165
|
+
this.reloadAborts.set(ticketId, controller);
|
|
1166
|
+
const held = this.findTicket(ticketId);
|
|
1167
|
+
this.conflicts.set(ticketId, { ...conflict, state: 'reloading' });
|
|
1168
|
+
this.syncDetail();
|
|
1169
|
+
try {
|
|
1170
|
+
let fresh: IKanbanTicket | undefined;
|
|
1171
|
+
if (this.provider.getTicket) fresh = await this.provider.getTicket(ticketId, controller.signal);
|
|
1172
|
+
else {
|
|
1173
|
+
await this.refresh();
|
|
1174
|
+
fresh = this.findTicket(ticketId);
|
|
1175
|
+
}
|
|
1176
|
+
if (controller.signal.aborted || !this.isConnected) return;
|
|
1177
|
+
if (!fresh || fresh.id !== ticketId) throw new Error(this.t('kanban.ticketUnavailable'));
|
|
1178
|
+
const latest = fresh;
|
|
1179
|
+
this.resolvedTickets.set(latest.id, latest);
|
|
1180
|
+
this.tickets = this.tickets.map(item => item.id === latest.id ? latest : item);
|
|
1181
|
+
// Cancelled, saved or discarded meanwhile.
|
|
1182
|
+
if (this.conflicts.get(ticketId)?.state !== 'reloading') return;
|
|
1183
|
+
const draft = this.ticketDrafts.get(ticketId);
|
|
1184
|
+
const restart = ticketDraft(latest);
|
|
1185
|
+
const base = this.draftBases.get(ticketId) ?? (held ? ticketDraft(held) : restart);
|
|
1186
|
+
const edit = draft ? kanbanDraftChanges(base, draft, restart) : {};
|
|
1187
|
+
this.ticketDrafts.set(ticketId, restart);
|
|
1188
|
+
this.draftBases.set(ticketId, restart);
|
|
1189
|
+
if (Object.keys(edit).length)
|
|
1190
|
+
this.conflicts.set(ticketId, { ...conflict, edit, state: 'reloaded' });
|
|
1191
|
+
else this.conflicts.delete(ticketId);
|
|
1192
|
+
} catch (error) {
|
|
1193
|
+
if (!controller.signal.aborted) this.reportError(error, ticketId);
|
|
1194
|
+
} finally {
|
|
1195
|
+
// A cancelled edit's reload no longer speaks for the ticket's refusal.
|
|
1196
|
+
if (this.reloadAborts.get(ticketId) === controller) {
|
|
1197
|
+
this.reloadAborts.delete(ticketId);
|
|
1198
|
+
// A reload that failed or was aborted leaves the edit to reload again.
|
|
1199
|
+
const left = this.conflicts.get(ticketId);
|
|
1200
|
+
if (left?.state === 'reloading') this.conflicts.set(ticketId, { ...left, state: 'stale' });
|
|
1201
|
+
}
|
|
1202
|
+
this.syncDetail();
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Asks for a new ticket's title and, for a task or an epic while the board knows projects, its
|
|
1208
|
+
* project, then has the provider create it. The project starts at the board's project filter,
|
|
1209
|
+
* else the parent's; a subtask takes its parent's.
|
|
1210
|
+
*/
|
|
1085
1211
|
private async createTicket(input: Omit<IKanbanCreate, 'title'>): Promise<void> {
|
|
1086
1212
|
if (!this.provider.createTicket || !this.columns.some(column => column.id === input.columnId))
|
|
1087
1213
|
return;
|
|
@@ -1094,24 +1220,79 @@ export class DeesKanban extends DeesElement {
|
|
|
1094
1220
|
return;
|
|
1095
1221
|
const parentId =
|
|
1096
1222
|
input.parentId ?? (input.kind === 'task' ? this.filterValues.epic || undefined : undefined);
|
|
1097
|
-
const project
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1223
|
+
const parentProject = parentId ? this.findTicket(parentId)?.project : undefined;
|
|
1224
|
+
const project = (input.kind === 'subtask'
|
|
1225
|
+
? parentProject || input.project
|
|
1226
|
+
: input.project || this.filterValues.project || parentProject) || '';
|
|
1227
|
+
const projects = kanbanProjects(this.projects, this.tickets);
|
|
1228
|
+
let choice: DeesInputDropdown | undefined;
|
|
1229
|
+
if (input.kind !== 'subtask' && projects.length) {
|
|
1230
|
+
choice = new DeesInputDropdown();
|
|
1231
|
+
choice.label = this.t('kanban.project');
|
|
1232
|
+
// As in the detail, a ticket that starts in a project stays in one.
|
|
1233
|
+
choice.options = [
|
|
1234
|
+
...project ? [] : [{ key: '', option: this.t('kanban.noProject') }],
|
|
1235
|
+
...projects.map(item => ({ key: item.id, option: item.name })),
|
|
1236
|
+
...project && !projects.some(item => item.id === project)
|
|
1237
|
+
? [{ key: project, option: project }]
|
|
1238
|
+
: [],
|
|
1239
|
+
];
|
|
1240
|
+
choice.selectedOption = choice.options.find(option => option.key === project) ?? null;
|
|
1241
|
+
}
|
|
1242
|
+
const title = new DeesInputText();
|
|
1243
|
+
title.label = this.t('kanban.ticketTitle');
|
|
1244
|
+
title.required = true;
|
|
1245
|
+
let modal: DeesModal | undefined;
|
|
1246
|
+
let creating = false;
|
|
1247
|
+
const create = async (): Promise<void> => {
|
|
1248
|
+
const value = String(title.value ?? '').trim();
|
|
1249
|
+
if (!value) {
|
|
1250
|
+
title.validationState = 'invalid';
|
|
1251
|
+
title.validationText = this.t('kanban.titleRequired');
|
|
1252
|
+
await title.focus();
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
const chosen = choice ? choice.getValue()?.key ?? '' : project;
|
|
1256
|
+
creating = true;
|
|
1257
|
+
title.disabled = true;
|
|
1258
|
+
if (choice) choice.disabled = true;
|
|
1259
|
+
try {
|
|
1106
1260
|
const ticket = await this.provider.createTicket!({
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
title,
|
|
1110
|
-
...
|
|
1261
|
+
kind: input.kind,
|
|
1262
|
+
columnId: input.columnId,
|
|
1263
|
+
title: value,
|
|
1264
|
+
...parentId ? { parentId } : {},
|
|
1265
|
+
...chosen ? { project: chosen } : {},
|
|
1111
1266
|
});
|
|
1267
|
+
creating = false;
|
|
1112
1268
|
this.mergeTickets([ticket], true);
|
|
1113
|
-
|
|
1269
|
+
await modal?.destroy();
|
|
1270
|
+
} catch (error) {
|
|
1271
|
+
creating = false;
|
|
1272
|
+
title.disabled = false;
|
|
1273
|
+
if (choice) choice.disabled = false;
|
|
1274
|
+
title.validationState = 'invalid';
|
|
1275
|
+
title.validationText = kanbanError(error);
|
|
1276
|
+
await title.updateComplete;
|
|
1277
|
+
await title.focus();
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
// The title last: Enter in it creates the ticket, as in the prompt this dialog extends.
|
|
1281
|
+
modal = await DeesModal.createAndShow({
|
|
1282
|
+
heading: this.t('kanban.newTicket', { kind: input.kind }),
|
|
1283
|
+
width: 'small',
|
|
1284
|
+
content: html`<dees-form>${choice ?? ''}${title}</dees-form>`,
|
|
1285
|
+
menuOptions: [
|
|
1286
|
+
catalogAction<DeesModal>('common.cancel', async () => {
|
|
1287
|
+
await modal?.destroy();
|
|
1288
|
+
}),
|
|
1289
|
+
catalogAction<DeesModal>('common.create', create),
|
|
1290
|
+
],
|
|
1291
|
+
beforeClose: () => !creating,
|
|
1292
|
+
i18n: this.t.i18n,
|
|
1114
1293
|
});
|
|
1294
|
+
await title.updateComplete;
|
|
1295
|
+
await title.focus();
|
|
1115
1296
|
}
|
|
1116
1297
|
|
|
1117
1298
|
private async openMoveMenu(ticketId: string, anchor: HTMLElement): Promise<void> {
|
|
@@ -1167,12 +1348,25 @@ export class DeesKanban extends DeesElement {
|
|
|
1167
1348
|
);
|
|
1168
1349
|
}
|
|
1169
1350
|
|
|
1170
|
-
|
|
1351
|
+
/**
|
|
1352
|
+
* Shows a failure on the board and in the open detail, and tells the host. A failure that answered
|
|
1353
|
+
* a ticket's move or save stays until the board holds another state of that ticket.
|
|
1354
|
+
*/
|
|
1355
|
+
private reportError(error: unknown, ticketId?: string): void {
|
|
1171
1356
|
this.operationError = kanbanError(error);
|
|
1357
|
+
const version = ticketId ? kanbanTicketVersion(this.findTicket(ticketId)) : undefined;
|
|
1358
|
+
this.refusal = ticketId && version !== undefined ? { ticketId, version } : undefined;
|
|
1172
1359
|
if (this.detail && this.modal) this.detail.error = this.operationError;
|
|
1173
1360
|
kanbanEvent(this, 'kanban-error', { error, message: this.operationError });
|
|
1174
1361
|
}
|
|
1175
1362
|
|
|
1363
|
+
/** Takes the last failure's words off the board and out of the detail that shows them. */
|
|
1364
|
+
private clearOperationError(): void {
|
|
1365
|
+
if (this.detail?.error && this.detail.error === this.operationError) this.detail.error = '';
|
|
1366
|
+
this.operationError = '';
|
|
1367
|
+
this.refusal = undefined;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1176
1370
|
private handleInteraction = (event: Event): void => {
|
|
1177
1371
|
event.stopPropagation();
|
|
1178
1372
|
const { type, detail } = event as unknown as TKanbanInteraction;
|
|
@@ -1195,10 +1389,47 @@ export class DeesKanban extends DeesElement {
|
|
|
1195
1389
|
void this.saveTicket(detail.ticketId, detail.draft);
|
|
1196
1390
|
break;
|
|
1197
1391
|
case 'kanban-ticket-draft':
|
|
1198
|
-
if (detail.draft)
|
|
1199
|
-
|
|
1392
|
+
if (detail.draft) {
|
|
1393
|
+
if (!this.ticketDrafts.has(detail.ticketId)) {
|
|
1394
|
+
const ticket = this.findTicket(detail.ticketId);
|
|
1395
|
+
if (ticket) this.draftBases.set(detail.ticketId, ticketDraft(ticket));
|
|
1396
|
+
}
|
|
1397
|
+
this.ticketDrafts.set(detail.ticketId, detail.draft);
|
|
1398
|
+
} else {
|
|
1399
|
+
this.ticketDrafts.delete(detail.ticketId);
|
|
1400
|
+
this.draftBases.delete(detail.ticketId);
|
|
1401
|
+
this.conflicts.delete(detail.ticketId);
|
|
1402
|
+
// A reload still running belongs to the edit just cancelled.
|
|
1403
|
+
this.reloadAborts.get(detail.ticketId)?.abort();
|
|
1404
|
+
this.reloadAborts.delete(detail.ticketId);
|
|
1405
|
+
}
|
|
1200
1406
|
this.syncDetail();
|
|
1201
1407
|
break;
|
|
1408
|
+
case 'kanban-ticket-reload':
|
|
1409
|
+
void this.reloadTicket(detail.ticketId);
|
|
1410
|
+
break;
|
|
1411
|
+
case 'kanban-conflict-apply': {
|
|
1412
|
+
const conflict = this.conflicts.get(detail.ticketId);
|
|
1413
|
+
const draft = this.ticketDrafts.get(detail.ticketId);
|
|
1414
|
+
if (conflict?.state !== 'reloaded' || !draft || !(detail.field in conflict.edit)) break;
|
|
1415
|
+
const edit = { ...conflict.edit };
|
|
1416
|
+
this.ticketDrafts.set(detail.ticketId, { ...draft, [detail.field]: edit[detail.field] });
|
|
1417
|
+
delete edit[detail.field];
|
|
1418
|
+
if (Object.keys(edit).length) this.conflicts.set(detail.ticketId, { ...conflict, edit });
|
|
1419
|
+
else this.conflicts.delete(detail.ticketId);
|
|
1420
|
+
this.syncDetail();
|
|
1421
|
+
break;
|
|
1422
|
+
}
|
|
1423
|
+
case 'kanban-conflict-dismiss':
|
|
1424
|
+
this.conflicts.delete(detail.ticketId);
|
|
1425
|
+
this.syncDetail();
|
|
1426
|
+
break;
|
|
1427
|
+
case 'kanban-column-toggle': {
|
|
1428
|
+
const column = this.columns.find(item => item.id === detail.columnId);
|
|
1429
|
+
if (column?.collapsible)
|
|
1430
|
+
this.columnsCollapsed = { ...this.columnsCollapsed, [column.id]: !this.isCollapsed(column) };
|
|
1431
|
+
break;
|
|
1432
|
+
}
|
|
1202
1433
|
case 'kanban-comment-draft':
|
|
1203
1434
|
this.commentDrafts.set(detail.ticketId, detail.body);
|
|
1204
1435
|
break;
|
|
@@ -1244,6 +1475,7 @@ export class DeesKanban extends DeesElement {
|
|
|
1244
1475
|
this.commentsAbort?.abort();
|
|
1245
1476
|
this.activityAbort?.abort();
|
|
1246
1477
|
this.boardAbort?.abort();
|
|
1478
|
+
for (const controller of this.reloadAborts.values()) controller.abort();
|
|
1247
1479
|
void this.modal?.destroy();
|
|
1248
1480
|
await super.disconnectedCallback();
|
|
1249
1481
|
}
|
|
@@ -14,6 +14,9 @@ import { kanbanStyles } from '../kanban.styles.js';
|
|
|
14
14
|
import { kanbanEvent, kanbanProjectName, sortKanbanTickets } from '../kanban.helpers.js';
|
|
15
15
|
import '../dees-kanban-card/dees-kanban-card.js';
|
|
16
16
|
|
|
17
|
+
/** How many cards a folded column shows. */
|
|
18
|
+
const collapsedCards = 3;
|
|
19
|
+
|
|
17
20
|
declare global {
|
|
18
21
|
interface HTMLElementTagNameMap {
|
|
19
22
|
'dees-kanban-column': DeesKanbanColumn;
|
|
@@ -53,6 +56,10 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
53
56
|
@property({ type: Boolean, reflect: true })
|
|
54
57
|
accessor canCreate = false;
|
|
55
58
|
|
|
59
|
+
/** Folded to a narrow lane with the count and the newest cards; the board sets it for a `collapsible` column. */
|
|
60
|
+
@property({ type: Boolean, reflect: true })
|
|
61
|
+
accessor collapsed = false;
|
|
62
|
+
|
|
56
63
|
@property({ type: String, reflect: true })
|
|
57
64
|
accessor pendingTicketId = '';
|
|
58
65
|
|
|
@@ -72,6 +79,9 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
72
79
|
@property({ attribute: false })
|
|
73
80
|
accessor motion: IKanbanMotion | undefined;
|
|
74
81
|
|
|
82
|
+
/** "Show all" unfolded the column and went away with it: focus moves to the header's toggle. */
|
|
83
|
+
private focusToggle = false;
|
|
84
|
+
|
|
75
85
|
public static styles = [
|
|
76
86
|
...kanbanStyles,
|
|
77
87
|
css`
|
|
@@ -83,6 +93,12 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
83
93
|
flex: 1 0 272px;
|
|
84
94
|
}
|
|
85
95
|
|
|
96
|
+
:host([collapsed]) {
|
|
97
|
+
flex: 0 0 224px;
|
|
98
|
+
min-width: 224px;
|
|
99
|
+
max-width: 224px;
|
|
100
|
+
}
|
|
101
|
+
|
|
86
102
|
section {
|
|
87
103
|
min-height: 220px;
|
|
88
104
|
height: 100%;
|
|
@@ -164,6 +180,11 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
164
180
|
background: var(--dees-color-row-hover);
|
|
165
181
|
}
|
|
166
182
|
|
|
183
|
+
.show-all {
|
|
184
|
+
display: flex;
|
|
185
|
+
margin-top: 8px;
|
|
186
|
+
}
|
|
187
|
+
|
|
167
188
|
@media (prefers-reduced-motion: reduce) {
|
|
168
189
|
section {
|
|
169
190
|
transition: none;
|
|
@@ -182,19 +203,27 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
182
203
|
|
|
183
204
|
public updated(): void {
|
|
184
205
|
if (!this.draggingTicketId) this.nativeOver = false;
|
|
206
|
+
if (this.focusToggle) {
|
|
207
|
+
this.focusToggle = false;
|
|
208
|
+
this.shadowRoot?.querySelector<HTMLElement>('header .toggle')?.focus();
|
|
209
|
+
}
|
|
185
210
|
}
|
|
186
211
|
|
|
187
212
|
public render() {
|
|
188
213
|
if (!this.column) return html``;
|
|
189
214
|
const motion = this.motion;
|
|
190
|
-
const
|
|
215
|
+
const ordered = sortKanbanTickets(this.tickets).filter(
|
|
191
216
|
ticket => ticket.id !== motion?.move.ticketId,
|
|
192
217
|
);
|
|
193
218
|
const active = motion?.move.columnId === this.column.id;
|
|
194
219
|
if (motion && active) {
|
|
195
|
-
const index =
|
|
196
|
-
|
|
220
|
+
const index = ordered.findIndex(ticket => ticket.id === motion.move.beforeTicketId);
|
|
221
|
+
ordered.splice(index < 0 ? ordered.length : index, 0, motion.ticket);
|
|
197
222
|
}
|
|
223
|
+
// Folded, the column shows the cards placed in it last, newest first: a move appends to it.
|
|
224
|
+
const tickets = this.collapsed ? [...ordered].reverse().slice(0, collapsedCards) : ordered;
|
|
225
|
+
const hidden = ordered.length - tickets.length;
|
|
226
|
+
const collapsible = !!this.column.collapsible;
|
|
198
227
|
return html`<section
|
|
199
228
|
class=${active && motion?.placeholder || this.nativeOver ? 'over' : ''}
|
|
200
229
|
aria-label=${this.column.title}
|
|
@@ -232,8 +261,20 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
232
261
|
<header>
|
|
233
262
|
<span class="status ${this.column.done ? 'done' : ''}" aria-hidden="true"></span>
|
|
234
263
|
<h3>${this.column.title}</h3>
|
|
235
|
-
<span class="count">${
|
|
264
|
+
<span class="count">${ordered.length}</span>
|
|
236
265
|
<span class="spacer"></span>
|
|
266
|
+
${collapsible
|
|
267
|
+
? html`<dees-button
|
|
268
|
+
class="toggle"
|
|
269
|
+
type="ghost"
|
|
270
|
+
size="icon"
|
|
271
|
+
icon=${this.collapsed ? 'lucide:ChevronsLeftRight' : 'lucide:ChevronsRightLeft'}
|
|
272
|
+
text=${this.t(this.collapsed ? 'kanban.expandColumn' : 'kanban.collapseColumn', {
|
|
273
|
+
column: this.column.title,
|
|
274
|
+
})}
|
|
275
|
+
@clicked=${() => this.toggle()}
|
|
276
|
+
></dees-button>`
|
|
277
|
+
: ''}
|
|
237
278
|
${this.canCreate
|
|
238
279
|
? html`<dees-button
|
|
239
280
|
type="ghost"
|
|
@@ -255,7 +296,7 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
255
296
|
: ''}"
|
|
256
297
|
data-ticket-id=${ticket.id}
|
|
257
298
|
@dragover=${() => {
|
|
258
|
-
if (!this.pointerManaged) this.nativeDropBefore = ticket.id;
|
|
299
|
+
if (!this.pointerManaged) this.nativeDropBefore = this.collapsed ? undefined : ticket.id;
|
|
259
300
|
}}
|
|
260
301
|
>
|
|
261
302
|
${motion?.move.ticketId === ticket.id && motion.placeholder
|
|
@@ -296,12 +337,32 @@ export class DeesKanbanColumn extends DeesElement {
|
|
|
296
337
|
>${this.t('kanban.noTasks')}</div>`
|
|
297
338
|
: ''}
|
|
298
339
|
</div>
|
|
340
|
+
${hidden > 0
|
|
341
|
+
? html`<div class="show-all">
|
|
342
|
+
<dees-button
|
|
343
|
+
type="ghost"
|
|
344
|
+
size="sm"
|
|
345
|
+
icon="lucide:ChevronDown"
|
|
346
|
+
text=${this.t('kanban.showAll', { count: ordered.length })}
|
|
347
|
+
@clicked=${() => {
|
|
348
|
+
this.focusToggle = true;
|
|
349
|
+
this.toggle();
|
|
350
|
+
}}
|
|
351
|
+
></dees-button>
|
|
352
|
+
</div>`
|
|
353
|
+
: ''}
|
|
299
354
|
<div
|
|
300
|
-
class="end-target ${this.nativeOver && !this.nativeDropBefore
|
|
355
|
+
class="end-target ${this.nativeOver && !this.nativeDropBefore && !this.collapsed
|
|
356
|
+
? 'native-before'
|
|
357
|
+
: ''}"
|
|
301
358
|
@dragover=${() => {
|
|
302
359
|
this.nativeDropBefore = undefined;
|
|
303
360
|
}}
|
|
304
361
|
></div>
|
|
305
362
|
</section>`;
|
|
306
363
|
}
|
|
364
|
+
|
|
365
|
+
private toggle(): void {
|
|
366
|
+
kanbanEvent(this, 'kanban-column-toggle', { columnId: this.column!.id });
|
|
367
|
+
}
|
|
307
368
|
}
|