@design.estate/dees-catalog 21.32.3 → 21.33.1

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.
Files changed (73) hide show
  1. package/dist_bundle/bundle.js +1733 -368
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZRD47DC6.js → chunk-B3NM6BL3.js} +3 -3
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-EL3KNDIB.js → chunk-BDUZ7I23.js} +2 -2
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LDC2GECY.js → chunk-IK5OF7M4.js} +33 -2
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LDC2GECY.js.map → chunk-IK5OF7M4.js.map} +1 -1
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-YOX3NS2W.js → de-PTMMQ5DA.js} +33 -2
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-PTMMQ5DA.js.map +1 -0
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-7LJGK5SK.js → dees-modal-BZIJFVRI.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-O3NEQ4DO.js → dees-workspace-terminal-EU377EZY.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/elements/00group-chart/dees-chart-area/component.d.ts +18 -0
  13. package/dist_ts_web/elements/00group-chart/dees-chart-area/component.js +60 -2
  14. package/dist_ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.d.ts +24 -0
  15. package/dist_ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.js +80 -0
  16. package/dist_ts_web/elements/00group-feedback/dees-hint/dees-hint.d.ts +1 -0
  17. package/dist_ts_web/elements/00group-feedback/dees-hint/dees-hint.js +13 -3
  18. package/dist_ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.js +7 -5
  19. package/dist_ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.d.ts +0 -3
  20. package/dist_ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.js +10 -182
  21. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.d.ts +64 -1
  22. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.js +221 -22
  23. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.js +544 -66
  24. package/dist_ts_web/elements/00group-harness/harness.helpers.d.ts +16 -1
  25. package/dist_ts_web/elements/00group-harness/harness.helpers.js +25 -1
  26. package/dist_ts_web/elements/00group-harness/harness.records.d.ts +27 -0
  27. package/dist_ts_web/elements/00group-harness/harness.records.js +193 -0
  28. package/dist_ts_web/elements/00group-harness/interfaces.d.ts +93 -4
  29. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.d.ts +39 -0
  30. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.js +27 -10
  31. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +276 -26
  32. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.d.ts +10 -0
  33. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.js +144 -44
  34. package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +16 -1
  35. package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +188 -5
  36. package/dist_ts_web/elements/00group-kanban/interfaces.d.ts +47 -2
  37. package/dist_ts_web/elements/00group-kanban/kanban.demodata.d.ts +11 -1
  38. package/dist_ts_web/elements/00group-kanban/kanban.demodata.js +141 -7
  39. package/dist_ts_web/elements/00group-kanban/kanban.dragcontroller.js +23 -1
  40. package/dist_ts_web/elements/00group-kanban/kanban.helpers.d.ts +15 -1
  41. package/dist_ts_web/elements/00group-kanban/kanban.helpers.js +31 -1
  42. package/dist_ts_web/i18n/de.d.ts +124 -0
  43. package/dist_ts_web/i18n/de.js +32 -1
  44. package/dist_ts_web/i18n/messages.d.ts +124 -0
  45. package/dist_ts_web/i18n/messages.js +32 -1
  46. package/package.json +2 -2
  47. package/readme.md +88 -15
  48. package/ts_web/00_commitinfo_data.ts +1 -1
  49. package/ts_web/elements/00group-chart/dees-chart-area/component.ts +59 -1
  50. package/ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.ts +97 -0
  51. package/ts_web/elements/00group-feedback/dees-hint/dees-hint.ts +16 -3
  52. package/ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.ts +6 -4
  53. package/ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.ts +16 -186
  54. package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.ts +261 -55
  55. package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts +575 -88
  56. package/ts_web/elements/00group-harness/harness.helpers.ts +39 -0
  57. package/ts_web/elements/00group-harness/harness.records.ts +210 -0
  58. package/ts_web/elements/00group-harness/interfaces.ts +99 -4
  59. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.ts +26 -8
  60. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +267 -25
  61. package/ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts +162 -57
  62. package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +202 -1
  63. package/ts_web/elements/00group-kanban/interfaces.ts +55 -3
  64. package/ts_web/elements/00group-kanban/kanban.demodata.ts +166 -6
  65. package/ts_web/elements/00group-kanban/kanban.dragcontroller.ts +21 -0
  66. package/ts_web/elements/00group-kanban/kanban.helpers.ts +53 -0
  67. package/ts_web/i18n/de.ts +31 -0
  68. package/ts_web/i18n/messages.ts +31 -0
  69. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-YOX3NS2W.js.map +0 -1
  70. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZRD47DC6.js.map → chunk-B3NM6BL3.js.map} +0 -0
  71. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-EL3KNDIB.js.map → chunk-BDUZ7I23.js.map} +0 -0
  72. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-7LJGK5SK.js.map → dees-modal-BZIJFVRI.js.map} +0 -0
  73. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-O3NEQ4DO.js.map → dees-workspace-terminal-EU377EZY.js.map} +0 -0
@@ -8,12 +8,16 @@ import {
8
8
  directives,
9
9
  } from '@design.estate/dees-element';
10
10
  import { dcLocalize } from '../../../i18n/localize.js';
11
+ import { ScrollEdgeShadowController, scrollEdgeShadowStyles } from '../../00scrolledges.js';
11
12
  import type { IKanbanColumn, IKanbanProject, IKanbanTicket } from '../interfaces.js';
12
13
  import type { IKanbanMotion } from '../kanban.dragcontroller.js';
13
14
  import { kanbanStyles } from '../kanban.styles.js';
14
15
  import { kanbanEvent, kanbanProjectName, sortKanbanTickets } from '../kanban.helpers.js';
15
16
  import '../dees-kanban-card/dees-kanban-card.js';
16
17
 
18
+ /** How many cards a folded column shows. */
19
+ const collapsedCards = 3;
20
+
17
21
  declare global {
18
22
  interface HTMLElementTagNameMap {
19
23
  'dees-kanban-column': DeesKanbanColumn;
@@ -53,6 +57,10 @@ export class DeesKanbanColumn extends DeesElement {
53
57
  @property({ type: Boolean, reflect: true })
54
58
  accessor canCreate = false;
55
59
 
60
+ /** Folded to a narrow lane with the count and the newest cards; the board sets it for a `collapsible` column. */
61
+ @property({ type: Boolean, reflect: true })
62
+ accessor collapsed = false;
63
+
56
64
  @property({ type: String, reflect: true })
57
65
  accessor pendingTicketId = '';
58
66
 
@@ -72,8 +80,24 @@ export class DeesKanbanColumn extends DeesElement {
72
80
  @property({ attribute: false })
73
81
  accessor motion: IKanbanMotion | undefined;
74
82
 
83
+ /** "Show all" unfolded the column and went away with it: focus moves to the header's toggle. */
84
+ private focusToggle = false;
85
+
86
+ private readonly scrollEdges = new ScrollEdgeShadowController(this, () => this.cardScroller);
87
+
88
+ /** The scroller of the column's cards, which a drag scrolls near its edges. */
89
+ public get cardScroller(): HTMLElement | null {
90
+ return this.shadowRoot?.querySelector<HTMLElement>('.body') ?? null;
91
+ }
92
+
93
+ /** Shows the edges of the cards' scroller in the frame a drag scrolled it. */
94
+ public syncScrollEdges(): void {
95
+ this.scrollEdges.sync();
96
+ }
97
+
75
98
  public static styles = [
76
99
  ...kanbanStyles,
100
+ scrollEdgeShadowStyles,
77
101
  css`
78
102
  :host {
79
103
  display: flex;
@@ -83,19 +107,27 @@ export class DeesKanbanColumn extends DeesElement {
83
107
  flex: 1 0 272px;
84
108
  }
85
109
 
110
+ :host([collapsed]) {
111
+ flex: 0 0 224px;
112
+ min-width: 224px;
113
+ max-width: 224px;
114
+ }
115
+
86
116
  section {
117
+ flex: 1 1 auto;
118
+ display: flex;
119
+ flex-direction: column;
87
120
  min-height: 220px;
88
- height: 100%;
89
121
  border-radius: var(--dees-radius-xl);
90
122
  transition: background var(--dees-transition-default) var(--dees-ease-out);
91
123
  }
92
124
 
93
125
  header {
126
+ flex: none;
94
127
  display: flex;
95
128
  align-items: center;
96
129
  gap: 8px;
97
130
  min-height: 40px;
98
- margin-bottom: 10px;
99
131
  padding: 0 var(--dees-spacing-2xs) var(--dees-spacing-sm);
100
132
  border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
101
133
  }
@@ -124,6 +156,29 @@ export class DeesKanbanColumn extends DeesElement {
124
156
  border-color: var(--dees-color-accent-success);
125
157
  }
126
158
 
159
+ /*
160
+ * The column's cards scroll below its header once the board's height runs out, and the edges
161
+ * past which cards lie cast their shadows, the top one from the header's line. The scroller
162
+ * reaches past the column by an inset that keeps card shadows and the drop line in view; the
163
+ * cards stay exactly the column wide.
164
+ */
165
+ .bodyFrame {
166
+ position: relative;
167
+ flex: 1 1 auto;
168
+ min-height: 0;
169
+ display: flex;
170
+ flex-direction: column;
171
+ }
172
+
173
+ .body {
174
+ flex: 1 1 auto;
175
+ min-height: 0;
176
+ overflow-x: hidden;
177
+ overflow-y: auto;
178
+ padding: 10px var(--dees-spacing-2xs) 0;
179
+ margin: 0 calc(var(--dees-spacing-2xs) * -1);
180
+ }
181
+
127
182
  /* One track exactly the column wide: a card never takes its content's width. */
128
183
  .stack {
129
184
  display: grid;
@@ -164,6 +219,11 @@ export class DeesKanbanColumn extends DeesElement {
164
219
  background: var(--dees-color-row-hover);
165
220
  }
166
221
 
222
+ .show-all {
223
+ display: flex;
224
+ margin-top: 8px;
225
+ }
226
+
167
227
  @media (prefers-reduced-motion: reduce) {
168
228
  section {
169
229
  transition: none;
@@ -182,19 +242,27 @@ export class DeesKanbanColumn extends DeesElement {
182
242
 
183
243
  public updated(): void {
184
244
  if (!this.draggingTicketId) this.nativeOver = false;
245
+ if (this.focusToggle) {
246
+ this.focusToggle = false;
247
+ this.shadowRoot?.querySelector<HTMLElement>('header .toggle')?.focus();
248
+ }
185
249
  }
186
250
 
187
251
  public render() {
188
252
  if (!this.column) return html``;
189
253
  const motion = this.motion;
190
- const tickets = sortKanbanTickets(this.tickets).filter(
254
+ const ordered = sortKanbanTickets(this.tickets).filter(
191
255
  ticket => ticket.id !== motion?.move.ticketId,
192
256
  );
193
257
  const active = motion?.move.columnId === this.column.id;
194
258
  if (motion && active) {
195
- const index = tickets.findIndex(ticket => ticket.id === motion.move.beforeTicketId);
196
- tickets.splice(index < 0 ? tickets.length : index, 0, motion.ticket);
259
+ const index = ordered.findIndex(ticket => ticket.id === motion.move.beforeTicketId);
260
+ ordered.splice(index < 0 ? ordered.length : index, 0, motion.ticket);
197
261
  }
262
+ // Folded, the column shows the cards placed in it last, newest first: a move appends to it.
263
+ const tickets = this.collapsed ? [...ordered].reverse().slice(0, collapsedCards) : ordered;
264
+ const hidden = ordered.length - tickets.length;
265
+ const collapsible = !!this.column.collapsible;
198
266
  return html`<section
199
267
  class=${active && motion?.placeholder || this.nativeOver ? 'over' : ''}
200
268
  aria-label=${this.column.title}
@@ -232,8 +300,20 @@ export class DeesKanbanColumn extends DeesElement {
232
300
  <header>
233
301
  <span class="status ${this.column.done ? 'done' : ''}" aria-hidden="true"></span>
234
302
  <h3>${this.column.title}</h3>
235
- <span class="count">${tickets.length}</span>
303
+ <span class="count">${ordered.length}</span>
236
304
  <span class="spacer"></span>
305
+ ${collapsible
306
+ ? html`<dees-button
307
+ class="toggle"
308
+ type="ghost"
309
+ size="icon"
310
+ icon=${this.collapsed ? 'lucide:ChevronsLeftRight' : 'lucide:ChevronsRightLeft'}
311
+ text=${this.t(this.collapsed ? 'kanban.expandColumn' : 'kanban.collapseColumn', {
312
+ column: this.column.title,
313
+ })}
314
+ @clicked=${() => this.toggle()}
315
+ ></dees-button>`
316
+ : ''}
237
317
  ${this.canCreate
238
318
  ? html`<dees-button
239
319
  type="ghost"
@@ -248,60 +328,85 @@ export class DeesKanbanColumn extends DeesElement {
248
328
  ></dees-button>`
249
329
  : ''}
250
330
  </header>
251
- <div class="stack">${directives.repeat(tickets, ticket => ticket.id, ticket => html`
252
- <div
253
- class="target ${this.nativeOver && this.nativeDropBefore === ticket.id
254
- ? 'native-before'
255
- : ''}"
256
- data-ticket-id=${ticket.id}
257
- @dragover=${() => {
258
- if (!this.pointerManaged) this.nativeDropBefore = ticket.id;
259
- }}
260
- >
261
- ${motion?.move.ticketId === ticket.id && motion.placeholder
262
- ? html`<div
263
- class="placeholder"
264
- style=${`height: ${motion.height}px`}
265
- aria-label=${this.t('kanban.dropHere')}
266
- ></div>`
267
- : html`<dees-kanban-card
268
- .ticket=${ticket}
269
- .columns=${this.columns}
270
- .projectName=${this.showProjects && ticket.project
271
- ? kanbanProjectName(this.projects, ticket.project)
272
- : ''}
273
- .epic=${this.allTickets.find(
274
- item => item.id === ticket.parentId && item.kind === 'epic',
275
- )}
276
- .subtasks=${sortKanbanTickets(
277
- this.allTickets.filter(
278
- item => item.parentId === ticket.id && item.kind === 'subtask',
279
- ),
280
- )}
281
- .movable=${this.movable && ticket.permissions?.move !== false}
282
- .pending=${motion?.move.ticketId === ticket.id
283
- ? motion.dimmed
284
- : this.pendingTicketId === ticket.id}
285
- .moveDisabled=${this.movesDisabled}
286
- .saving=${motion?.move.ticketId === ticket.id && motion.saving}
287
- .pointerManaged=${this.pointerManaged}
288
- ></dees-kanban-card>`}
289
- </div>`)}
290
- ${!tickets.length
291
- ? html`<div
292
- class="empty"
331
+ <div class="bodyFrame">
332
+ <div class="body">
333
+ <div class="stack">${directives.repeat(tickets, ticket => ticket.id, ticket => html`
334
+ <div
335
+ class="target ${this.nativeOver && this.nativeDropBefore === ticket.id
336
+ ? 'native-before'
337
+ : ''}"
338
+ data-ticket-id=${ticket.id}
293
339
  @dragover=${() => {
294
- this.nativeDropBefore = undefined;
340
+ if (!this.pointerManaged) this.nativeDropBefore = this.collapsed ? undefined : ticket.id;
295
341
  }}
296
- >${this.t('kanban.noTasks')}</div>`
297
- : ''}
342
+ >
343
+ ${motion?.move.ticketId === ticket.id && motion.placeholder
344
+ ? html`<div
345
+ class="placeholder"
346
+ style=${`height: ${motion.height}px`}
347
+ aria-label=${this.t('kanban.dropHere')}
348
+ ></div>`
349
+ : html`<dees-kanban-card
350
+ .ticket=${ticket}
351
+ .columns=${this.columns}
352
+ .projectName=${this.showProjects && ticket.project
353
+ ? kanbanProjectName(this.projects, ticket.project)
354
+ : ''}
355
+ .epic=${this.allTickets.find(
356
+ item => item.id === ticket.parentId && item.kind === 'epic',
357
+ )}
358
+ .subtasks=${sortKanbanTickets(
359
+ this.allTickets.filter(
360
+ item => item.parentId === ticket.id && item.kind === 'subtask',
361
+ ),
362
+ )}
363
+ .movable=${this.movable && ticket.permissions?.move !== false}
364
+ .pending=${motion?.move.ticketId === ticket.id
365
+ ? motion.dimmed
366
+ : this.pendingTicketId === ticket.id}
367
+ .moveDisabled=${this.movesDisabled}
368
+ .saving=${motion?.move.ticketId === ticket.id && motion.saving}
369
+ .pointerManaged=${this.pointerManaged}
370
+ ></dees-kanban-card>`}
371
+ </div>`)}
372
+ ${!tickets.length
373
+ ? html`<div
374
+ class="empty"
375
+ @dragover=${() => {
376
+ this.nativeDropBefore = undefined;
377
+ }}
378
+ >${this.t('kanban.noTasks')}</div>`
379
+ : ''}
380
+ </div>
381
+ ${hidden > 0
382
+ ? html`<div class="show-all">
383
+ <dees-button
384
+ type="ghost"
385
+ size="sm"
386
+ icon="lucide:ChevronDown"
387
+ text=${this.t('kanban.showAll', { count: ordered.length })}
388
+ @clicked=${() => {
389
+ this.focusToggle = true;
390
+ this.toggle();
391
+ }}
392
+ ></dees-button>
393
+ </div>`
394
+ : ''}
395
+ <div
396
+ class="end-target ${this.nativeOver && !this.nativeDropBefore && !this.collapsed
397
+ ? 'native-before'
398
+ : ''}"
399
+ @dragover=${() => {
400
+ this.nativeDropBefore = undefined;
401
+ }}
402
+ ></div>
403
+ </div>
404
+ ${this.scrollEdges.renderShadows()}
298
405
  </div>
299
- <div
300
- class="end-target ${this.nativeOver && !this.nativeDropBefore ? 'native-before' : ''}"
301
- @dragover=${() => {
302
- this.nativeDropBefore = undefined;
303
- }}
304
- ></div>
305
406
  </section>`;
306
407
  }
408
+
409
+ private toggle(): void {
410
+ kanbanEvent(this, 'kanban-column-toggle', { columnId: this.column!.id });
411
+ }
307
412
  }
@@ -14,12 +14,14 @@ import type {
14
14
  IKanbanActivity,
15
15
  IKanbanColumn,
16
16
  IKanbanComment,
17
+ IKanbanEditConflict,
17
18
  IKanbanPerson,
18
19
  IKanbanProject,
19
20
  IKanbanProvider,
20
21
  IKanbanSource,
21
22
  IKanbanTicket,
22
23
  IKanbanTicketDraft,
24
+ TKanbanDraftField,
23
25
  TKanbanLink,
24
26
  TKanbanPriority,
25
27
  } from '../interfaces.js';
@@ -29,6 +31,7 @@ import type {
29
31
  } from '../../00group-input/dees-input-reference/interfaces.js';
30
32
  import { kanbanStyles } from '../kanban.styles.js';
31
33
  import {
34
+ kanbanDraftFields,
32
35
  kanbanEvent,
33
36
  kanbanHref,
34
37
  kanbanInitials,
@@ -51,6 +54,7 @@ import '../../00group-input/dees-input-dropdown/dees-input-dropdown.js';
51
54
  import '../../00group-input/dees-input-tags/dees-input-tags.js';
52
55
  import '../../00group-input/dees-input-multitoggle/dees-input-multitoggle.js';
53
56
  import '../../00group-utility/dees-icon/dees-icon.js';
57
+ import '../../00group-feedback/dees-hint/dees-hint.js';
54
58
  import '../dees-kanban-discussion/dees-kanban-discussion.js';
55
59
  import '../dees-kanban-activity/dees-kanban-activity.js';
56
60
 
@@ -124,9 +128,16 @@ export class DeesKanbanTicketDetail extends DeesElement {
124
128
  @property({ type: Boolean, reflect: true })
125
129
  accessor showTicketKey = true;
126
130
 
131
+ /** The save of this ticket the provider refused as stale, while the board holds it. */
132
+ @property({ attribute: false })
133
+ accessor conflict: IKanbanEditConflict | undefined;
134
+
127
135
  @state()
128
136
  private accessor editing = false;
129
137
 
138
+ /** The reader pressed a button of the refusal, which leaves with its answer: the focus follows. */
139
+ private conflictFocus = false;
140
+
130
141
  @state()
131
142
  private accessor feed: 'comments' | 'history' = 'comments';
132
143
 
@@ -507,6 +518,72 @@ export class DeesKanbanTicketDetail extends DeesElement {
507
518
  gap: 14px;
508
519
  }
509
520
 
521
+ .conflict p + p,
522
+ .conflict p + dees-button {
523
+ margin-top: 8px;
524
+ }
525
+
526
+ .conflict-reason,
527
+ .conflict h3 {
528
+ color: var(--dees-color-text-primary);
529
+ font-weight: 600;
530
+ }
531
+
532
+ .conflict h3 {
533
+ font-size: inherit;
534
+ }
535
+
536
+ .conflict dl {
537
+ display: grid;
538
+ gap: 8px;
539
+ margin: 10px 0 0;
540
+ }
541
+
542
+ .kept,
543
+ .conflict-actions {
544
+ padding-top: 8px;
545
+ border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
546
+ }
547
+
548
+ .conflict-actions {
549
+ margin-top: 8px;
550
+ }
551
+
552
+ .kept {
553
+ display: grid;
554
+ grid-template-columns: minmax(0, 1fr) auto;
555
+ grid-template-areas: 'name apply' 'value apply';
556
+ align-items: center;
557
+ gap: var(--dees-spacing-2xs) 12px;
558
+ }
559
+
560
+ .kept dt {
561
+ grid-area: name;
562
+ font-size: var(--dees-font-caption1-size);
563
+ }
564
+
565
+ .kept dd {
566
+ grid-area: value;
567
+ margin: 0;
568
+ min-width: 0;
569
+ color: var(--dees-color-text-primary);
570
+ overflow-wrap: anywhere;
571
+ }
572
+
573
+ .kept dd.text {
574
+ white-space: pre-wrap;
575
+ max-height: 9lh;
576
+ overflow-y: auto;
577
+ }
578
+
579
+ .kept dd .badge + .badge {
580
+ margin-left: 4px;
581
+ }
582
+
583
+ .kept dees-button {
584
+ grid-area: apply;
585
+ }
586
+
510
587
  @media (max-width: 700px) {
511
588
  :host {
512
589
  padding: 16px;
@@ -534,6 +611,127 @@ export class DeesKanbanTicketDetail extends DeesElement {
534
611
  const previous = changed.get('ticket') as IKanbanTicket | undefined;
535
612
  if (changed.has('ticket') && previous?.id !== this.ticket?.id)
536
613
  this.editing = Boolean(this.draft);
614
+ // The pressed button left with the refusal's answer: on to the refusal's next button, else the title.
615
+ if (this.conflictFocus && changed.has('conflict') && this.conflict?.state !== 'reloading') {
616
+ this.conflictFocus = false;
617
+ const root = this.shadowRoot!;
618
+ const target =
619
+ root.querySelector<DeesElement>('.conflict dees-button') ??
620
+ root.querySelector<DeesElement>('.edit dees-input-text');
621
+ // A button this render added draws its face, which takes the focus, in its own first update.
622
+ void target?.updateComplete.then(() => target.focus());
623
+ }
624
+ }
625
+
626
+ /**
627
+ * A save the provider refused as stale, at the top of the edit: the server's reason and the
628
+ * reload, then what the person changed that the latest version does not hold, each change to
629
+ * apply on its own.
630
+ */
631
+ private renderConflict(
632
+ ticket: IKanbanTicket,
633
+ conflict: IKanbanEditConflict,
634
+ parents: IKanbanTicket[],
635
+ projects: IKanbanProject[],
636
+ ): TemplateResult {
637
+ const press = (type: 'kanban-ticket-reload' | 'kanban-conflict-dismiss') => () => {
638
+ this.conflictFocus = true;
639
+ kanbanEvent(this, type, { ticketId: ticket.id });
640
+ };
641
+ if (conflict.state !== 'reloaded') {
642
+ const reloading = conflict.state === 'reloading';
643
+ return html`<div class="conflict" role="alert">
644
+ <dees-hint type="warning">
645
+ <p class="conflict-reason">${conflict.message}</p>
646
+ <p>${this.t('kanban.conflictHint')}</p>
647
+ <dees-button
648
+ size="sm"
649
+ type="accent"
650
+ icon="lucide:RefreshCw"
651
+ text=${this.t('kanban.reloadTicket')}
652
+ .status=${reloading ? 'pending' : 'normal'}
653
+ .disabled=${reloading}
654
+ @clicked=${press('kanban-ticket-reload')}
655
+ ></dees-button>
656
+ </dees-hint>
657
+ </div>`;
658
+ }
659
+ const fields = kanbanDraftFields.filter(field => field in conflict.edit);
660
+ return html`<section class="conflict" aria-labelledby="conflict-heading">
661
+ <dees-hint type="info">
662
+ <h3 id="conflict-heading">${this.t('kanban.yourEdit')}</h3>
663
+ <p>${this.t('kanban.yourEditHint')}</p>
664
+ <dl>${fields.map(field => {
665
+ const name = this.fieldName(ticket, field);
666
+ return html`<div class="kept" data-field=${field}>
667
+ <dt>${name}</dt>
668
+ <dd class=${field === 'title' || field === 'description' ? 'text' : ''}>${this.keptValue(
669
+ field,
670
+ conflict.edit,
671
+ parents,
672
+ projects,
673
+ )}</dd>
674
+ <dees-button
675
+ size="sm"
676
+ type="secondary"
677
+ text=${this.t('kanban.applyEdit')}
678
+ aria-label=${this.t('kanban.applyField', { field: name })}
679
+ @clicked=${() => {
680
+ this.conflictFocus = true;
681
+ kanbanEvent(this, 'kanban-conflict-apply', { ticketId: ticket.id, field });
682
+ }}
683
+ ></dees-button>
684
+ </div>`;
685
+ })}</dl>
686
+ <div class="conflict-actions">
687
+ <dees-button
688
+ size="sm"
689
+ type="secondary"
690
+ text=${this.t('kanban.discardEdit')}
691
+ @clicked=${press('kanban-conflict-dismiss')}
692
+ ></dees-button>
693
+ </div>
694
+ </dees-hint>
695
+ </section>`;
696
+ }
697
+
698
+ /** A draft field's name, as its control is labelled. */
699
+ private fieldName(ticket: IKanbanTicket, field: TKanbanDraftField): string {
700
+ switch (field) {
701
+ case 'title': return this.t('kanban.ticketTitle');
702
+ case 'description': return this.t('kanban.description');
703
+ case 'project': return this.t('kanban.project');
704
+ case 'priority': return this.t('kanban.priorityLabel');
705
+ case 'assigneeId': return this.t('kanban.assignee');
706
+ case 'parentId': return this.t(ticket.kind === 'task' ? 'kanban.epic' : 'kanban.parentTask');
707
+ case 'labels': return this.t('kanban.labels');
708
+ }
709
+ }
710
+
711
+ /** A kept change's value, as its control shows it. */
712
+ private keptValue(
713
+ field: TKanbanDraftField,
714
+ edit: IKanbanEditConflict['edit'],
715
+ parents: IKanbanTicket[],
716
+ projects: IKanbanProject[],
717
+ ): TemplateResult | string {
718
+ switch (field) {
719
+ case 'title': return edit.title ?? '';
720
+ case 'description': return edit.description || this.t('kanban.noDescription');
721
+ case 'project':
722
+ return edit.project ? kanbanProjectName(projects, edit.project) : this.t('kanban.noProject');
723
+ case 'priority': return this.t('kanban.priority', { priority: edit.priority ?? 'none' });
724
+ case 'assigneeId':
725
+ return edit.assigneeId
726
+ ? this.people.find(person => person.id === edit.assigneeId)?.name ?? edit.assigneeId
727
+ : this.t('kanban.unassigned');
728
+ case 'parentId':
729
+ return parents.find(item => item.id === edit.parentId)?.title ?? this.t('kanban.none');
730
+ case 'labels':
731
+ return edit.labels?.length
732
+ ? html`${edit.labels.map(label => html`<span class="badge">${label}</span>`)}`
733
+ : this.t('kanban.none');
734
+ }
537
735
  }
538
736
 
539
737
  private changeDraft(change: Partial<IKanbanTicketDraft>): void {
@@ -598,6 +796,7 @@ export class DeesKanbanTicketDetail extends DeesElement {
598
796
  <section class="lead">
599
797
  ${this.editing && editable
600
798
  ? html`<div class="edit">
799
+ ${this.conflict ? this.renderConflict(ticket, this.conflict, parents, projects) : ''}
601
800
  <dees-input-text
602
801
  label=${this.t('kanban.ticketTitle')}
603
802
  .value=${draft.title}
@@ -620,7 +819,9 @@ export class DeesKanbanTicketDetail extends DeesElement {
620
819
  size="sm"
621
820
  type="accent"
622
821
  text=${this.t('kanban.saveChanges')}
623
- .disabled=${this.saving || !draft.title.trim()}
822
+ .disabled=${this.saving ||
823
+ !draft.title.trim() ||
824
+ (this.conflict !== undefined && this.conflict.state !== 'reloaded')}
624
825
  .status=${this.saving ? 'pending' : 'normal'}
625
826
  @clicked=${() =>
626
827
  kanbanEvent(this, 'kanban-ticket-save', { ticketId: ticket.id, draft })}
@@ -3,7 +3,19 @@ import type { TReferenceContent } from '../00group-input/dees-input-reference/in
3
3
  export type TKanbanTicketKind = 'epic' | 'task' | 'subtask';
4
4
  export type TKanbanPriority = 'none' | 'low' | 'normal' | 'high' | 'urgent';
5
5
  export interface IKanbanPerson { id: string; name: string; }
6
- export interface IKanbanColumn { id: string; title: string; /** Marks completed subtasks. */ done?: boolean; }
6
+ export interface IKanbanColumn {
7
+ id: string;
8
+ title: string;
9
+ /** Marks completed subtasks. */
10
+ done?: boolean;
11
+ /**
12
+ * Lets the reader fold the column to a narrow lane with its count and its newest three cards —
13
+ * the ones placed in it last, as a move appends — starting folded (`'collapsed'`) or open
14
+ * (`'expanded'`). A card dropped on a folded column lands at its end. Left out, the column always
15
+ * shows every card.
16
+ */
17
+ collapsible?: 'collapsed' | 'expanded';
18
+ }
7
19
  /** A project tickets belong to: a ticket's `project` is its `id`, the board shows its `name`. */
8
20
  export interface IKanbanProject { id: string; name: string; }
9
21
  /**
@@ -55,6 +67,8 @@ export interface IKanbanTicket {
55
67
  updatedAt?: string;
56
68
  createdBy?: IKanbanPerson;
57
69
  updatedBy?: IKanbanPerson;
70
+ /** The ticket's server revision, advanced by every change to it. */
71
+ revision?: number;
58
72
  /** UI capabilities; the provider must enforce authorization independently. */
59
73
  permissions?: { edit?: boolean; move?: boolean; comment?: boolean; createChild?: boolean };
60
74
  }
@@ -109,6 +123,8 @@ export interface IKanbanTicketDraft {
109
123
  labels?: string[];
110
124
  /** Left out, the ticket keeps its project. */
111
125
  project?: string;
126
+ /** The ticket's `revision` the edit started from, sent back as `expectedRevision`. */
127
+ revision?: number;
112
128
  }
113
129
  export interface IKanbanMove {
114
130
  ticketId: string;
@@ -121,9 +137,37 @@ export interface IKanbanCreate {
121
137
  title: string;
122
138
  columnId: string;
123
139
  parentId?: string;
124
- /** The board's project filter while one is chosen, else the parent's project. */
140
+ /**
141
+ * The project the person chose in the create dialog, which starts at the board's project filter,
142
+ * else the parent's project. A subtask takes its parent's. Left out, the ticket has no project.
143
+ */
125
144
  project?: string;
126
145
  }
146
+ /**
147
+ * The error a provider's `updateTicket` throws when the ticket changed since `expectedRevision`:
148
+ * its `message` is the server's reason, shown to the person with an offer to reload the ticket.
149
+ */
150
+ export interface IKanbanRevisionConflict extends Error {
151
+ code: 'revision_conflict';
152
+ }
153
+ /** A field of the edit draft the person writes or chooses. */
154
+ export type TKanbanDraftField = Exclude<keyof IKanbanTicketDraft, 'revision'>;
155
+ /**
156
+ * A save the provider refused with an `IKanbanRevisionConflict`, while the ticket's detail shows it:
157
+ * the server's reason and, once the ticket is reloaded, what the person changed, kept to apply to
158
+ * the latest version field by field.
159
+ */
160
+ export interface IKanbanEditConflict {
161
+ /** The server's reason. */
162
+ message: string;
163
+ /**
164
+ * The fields the person changed, as they set them, where the reloaded ticket holds something
165
+ * else; empty until the reload.
166
+ */
167
+ edit: Partial<Pick<IKanbanTicketDraft, TKanbanDraftField>>;
168
+ /** `stale` until the person reloads the ticket, `reloading` meanwhile, `reloaded` after. */
169
+ state: 'stale' | 'reloading' | 'reloaded';
170
+ }
127
171
  /**
128
172
  * The board's filters, as the reader chose them. A filter left out, or empty, does not narrow the
129
173
  * board.
@@ -158,7 +202,15 @@ export interface IKanbanProvider {
158
202
  /** The whole board again, for `refresh()`. */
159
203
  loadBoard?: (signal: AbortSignal) => Promise<IKanbanBoardSnapshot>;
160
204
  addComment?: (input: { ticketId: string; body: TReferenceContent }) => Promise<IKanbanComment>;
161
- updateTicket?: (input: { ticketId: string; changes: IKanbanTicketChanges }) => Promise<IKanbanTicket>;
205
+ /**
206
+ * `expectedRevision` is the ticket's `revision` the edit started from; a provider that checks it
207
+ * refuses a stale edit with an `IKanbanRevisionConflict`.
208
+ */
209
+ updateTicket?: (input: {
210
+ ticketId: string;
211
+ changes: IKanbanTicketChanges;
212
+ expectedRevision?: number;
213
+ }) => Promise<IKanbanTicket>;
162
214
  /** Return all records whose order or column changed. */
163
215
  moveTicket?: (input: IKanbanMove) => Promise<IKanbanTicket[]>;
164
216
  createTicket?: (input: IKanbanCreate) => Promise<IKanbanTicket>;