@sme.up/ketchup 10.1.1 → 10.1.5

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 (66) hide show
  1. package/dist/cjs/ketchup.cjs.js +1 -1
  2. package/dist/cjs/kup-calendar.cjs.entry.js +1 -1
  3. package/dist/cjs/kup-custom-task-list-header_4.cjs.entry.js +195 -22
  4. package/dist/cjs/kup-gantt_10.cjs.entry.js +19 -17
  5. package/dist/cjs/{kup-planner-declarations-7291d01c.js → kup-planner-declarations-959110da.js} +1 -1
  6. package/dist/cjs/kup-planner-renderer.cjs.entry.js +3 -3
  7. package/dist/cjs/kup-planner.cjs.entry.js +112 -4
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/assets/index.js +4 -0
  10. package/dist/collection/assets/planner-example-7.js +370 -0
  11. package/dist/collection/components/kup-calendar/kup-calendar.css +18 -1
  12. package/dist/collection/components/kup-planner/kup-planner-declarations.js +1 -1
  13. package/dist/collection/components/kup-planner/kup-planner.js +153 -3
  14. package/dist/collection/components/kup-planner/utils/custom-task-list-table.js +30 -12
  15. package/dist/collection/components/kup-planner/utils/kup-gantt/kup-gantt.js +31 -7
  16. package/dist/collection/components/kup-planner/utils/kup-grid-renderer/kup-grid-renderer.js +181 -4
  17. package/dist/collection/components/kup-planner/utils/kup-planner-renderer.js +2 -2
  18. package/dist/collection/components/kup-planner/utils/kup-task-gantt/kup-task-gantt.js +4 -4
  19. package/dist/collection/components/kup-planner/utils/kup-task-list/kup-task-list.css +1 -0
  20. package/dist/components/kup-calendar.js +1 -1
  21. package/dist/components/kup-custom-task-list-table.js +1 -1
  22. package/dist/components/kup-gantt.js +1 -1
  23. package/dist/components/kup-grid-renderer.js +1 -1
  24. package/dist/components/kup-planner-renderer.js +1 -1
  25. package/dist/components/kup-planner.js +122 -12
  26. package/dist/components/kup-task-gantt.js +1 -1
  27. package/dist/components/kup-task-list-header.js +1 -1
  28. package/dist/components/kup-task-list-table.js +1 -1
  29. package/dist/components/kup-task-list.js +1 -1
  30. package/dist/components/{p-76c4c708.js → p-26d3e5b2.js} +1 -1
  31. package/dist/components/{p-2fff7268.js → p-45cdd2a4.js} +10 -10
  32. package/dist/components/{p-a0eeacbd.js → p-4edc1bd0.js} +1 -1
  33. package/dist/components/{p-9da8cd93.js → p-5cbf86c3.js} +13 -10
  34. package/dist/components/{p-53e38c4a.js → p-90c212d2.js} +1 -1
  35. package/dist/components/{p-0e6c0355.js → p-9c8c4e2e.js} +30 -12
  36. package/dist/components/{p-5517e8e8.js → p-c2b9b4ba.js} +4 -4
  37. package/dist/components/{p-4efa19a7.js → p-c8302548.js} +3 -3
  38. package/dist/components/{p-c43d08ab.js → p-d72814f5.js} +161 -5
  39. package/dist/esm/ketchup.js +1 -1
  40. package/dist/esm/kup-calendar.entry.js +1 -1
  41. package/dist/esm/kup-custom-task-list-header_4.entry.js +191 -18
  42. package/dist/esm/kup-gantt_10.entry.js +14 -12
  43. package/dist/esm/{kup-planner-declarations-0704bc6c.js → kup-planner-declarations-5981474b.js} +1 -1
  44. package/dist/esm/kup-planner-renderer.entry.js +3 -3
  45. package/dist/esm/kup-planner.entry.js +112 -4
  46. package/dist/esm/loader.js +1 -1
  47. package/dist/ketchup/ketchup.esm.js +1 -1
  48. package/dist/ketchup/p-088e2f23.entry.js +1 -0
  49. package/dist/ketchup/p-58bc7c00.entry.js +1 -0
  50. package/dist/ketchup/{p-a19d0102.entry.js → p-5f20e6ce.entry.js} +1 -1
  51. package/dist/ketchup/{p-54ebe3bd.entry.js → p-6aec24be.entry.js} +1 -1
  52. package/dist/ketchup/p-78c0ff1b.js +1 -0
  53. package/dist/ketchup/p-ca9ec047.entry.js +16 -0
  54. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +19 -0
  55. package/dist/types/components/kup-planner/kup-planner.d.ts +12 -1
  56. package/dist/types/components/kup-planner/utils/kup-gantt/kup-gantt.d.ts +2 -1
  57. package/dist/types/components/kup-planner/utils/kup-grid-renderer/kup-grid-renderer.d.ts +7 -0
  58. package/dist/types/components.d.ts +24 -2
  59. package/package.json +1 -1
  60. package/dist/ketchup/p-008bdcdc.js +0 -1
  61. package/dist/ketchup/p-792e9244.entry.js +0 -1
  62. package/dist/ketchup/p-e8823224.entry.js +0 -1
  63. package/dist/ketchup/p-f38c2d0e.entry.js +0 -16
  64. package/dist/cjs/{bar.helpers-c481a535.js → other.helpers-8782a839.js} +46 -46
  65. package/dist/esm/{bar.helpers-23a51579.js → other.helpers-83e3225b.js} +46 -46
  66. /package/dist/ketchup/{p-cd3a7d53.js → p-17c9ef50.js} +0 -0
@@ -0,0 +1,370 @@
1
+ // Example 7 - Planner demo for stacked/grouped dependencies
2
+ // Minimal demo that maps client column names, includes phases with OPEDIP,
3
+ // injects extra tasks and structured dependencies to stress the renderer.
4
+
5
+ const comp = document.getElementById('planner');
6
+ if (!comp) throw new Error('No #planner element found on page');
7
+
8
+ comp.addEventListener('kup-planner-click', onclick);
9
+
10
+ const props = {
11
+ data: {
12
+ columns: [
13
+ { name: 'CODCOM' },
14
+ { name: 'CODSEQ' },
15
+ { name: 'CODFAS' },
16
+ { name: 'DESFAS' },
17
+ { name: 'COLFAS' },
18
+ { name: 'INISIM' },
19
+ { name: 'FINSIM' },
20
+ { name: 'INICON' },
21
+ { name: 'FINCON' },
22
+ { name: 'OPEDIP' },
23
+ ],
24
+ rows: [
25
+ {
26
+ id: 'cm1',
27
+ cells: {
28
+ CODCOM: { value: 'CM1' },
29
+ CODSEQ: { value: '001' },
30
+ DESFAS: { value: 'COMMESSA 1' },
31
+ INICON: {
32
+ value: '2025-03-01',
33
+ obj: { k: '', p: '*YYMD', t: 'D8' },
34
+ },
35
+ FINCON: {
36
+ value: '2025-07-04',
37
+ obj: { k: '', p: '*YYMD', t: 'D8' },
38
+ },
39
+ INISIM: {
40
+ value: '2025-09-01',
41
+ obj: { k: '', p: '*YYMD', t: 'D8' },
42
+ },
43
+ FINSIM: {
44
+ value: '2025-12-05',
45
+ obj: { k: '', p: '*YYMD', t: 'D8' },
46
+ },
47
+ OPEDIP: { value: '' },
48
+ },
49
+ cssClass: 'clickable',
50
+ readOnly: true,
51
+ },
52
+ ],
53
+ },
54
+ taskIdCol: 'CODCOM',
55
+ taskNameCol: 'CODCOM',
56
+ taskDates: ['INICON', 'FINCON'],
57
+ taskPrevDates: ['INISIM', 'FINSIM'],
58
+ phaseIdCol: 'CODFAS',
59
+ phaseNameCol: 'DESFAS',
60
+ phaseDates: ['INICON', 'FINCON'],
61
+ phasePrevDates: ['INISIM', 'FINSIM'],
62
+ phaseColorCol: 'COLFAS',
63
+ dependencyCol: 'OPEDIP',
64
+ dependencies: [],
65
+ };
66
+
67
+ const phases = {
68
+ columns: [
69
+ { name: 'CODCOM' },
70
+ { name: 'CODSEQ' },
71
+ { name: 'CODFAS' },
72
+ { name: 'DESFAS' },
73
+ { name: 'COLFAS' },
74
+ { name: 'INISIM' },
75
+ { name: 'FINSIM' },
76
+ { name: 'INICON' },
77
+ { name: 'FINCON' },
78
+ { name: 'OPEDIP' },
79
+ ],
80
+ rows: [
81
+ {
82
+ id: '1',
83
+ cells: {
84
+ CODCOM: { value: 'CM1' },
85
+ CODSEQ: { value: '110' },
86
+ CODFAS: { value: '010' },
87
+ DESFAS: { value: 'MONTAGGIO' },
88
+ COLFAS: { value: '#000000' },
89
+ INISIM: {
90
+ value: '2025-09-01',
91
+ obj: { k: '', p: '*YYMD', t: 'D8' },
92
+ },
93
+ FINSIM: {
94
+ value: '2025-12-05',
95
+ obj: { k: '', p: '*YYMD', t: 'D8' },
96
+ },
97
+ INICON: {
98
+ value: '2025-03-01',
99
+ obj: { k: '', p: '*YYMD', t: 'D8' },
100
+ },
101
+ FINCON: {
102
+ value: '2025-07-04',
103
+ obj: { k: '', p: '*YYMD', t: 'D8' },
104
+ },
105
+ OPEDIP: { value: '' },
106
+ },
107
+ readOnly: true,
108
+ },
109
+ {
110
+ id: '2',
111
+ cells: {
112
+ CODCOM: { value: 'CM1' },
113
+ CODSEQ: { value: '120' },
114
+ CODFAS: { value: '020' },
115
+ DESFAS: { value: 'COLLAUDO' },
116
+ COLFAS: { value: '#05E808' },
117
+ INISIM: {
118
+ value: '2025-12-08',
119
+ obj: { k: '', p: '*YYMD', t: 'D8' },
120
+ },
121
+ FINSIM: {
122
+ value: '2026-04-08',
123
+ obj: { k: '', p: '*YYMD', t: 'D8' },
124
+ },
125
+ INICON: {
126
+ value: '2025-07-07',
127
+ obj: { k: '', p: '*YYMD', t: 'D8' },
128
+ },
129
+ FINCON: {
130
+ value: '2025-09-29',
131
+ obj: { k: '', p: '*YYMD', t: 'D8' },
132
+ },
133
+ OPEDIP: { value: '010' },
134
+ },
135
+ readOnly: true,
136
+ },
137
+ {
138
+ id: '3',
139
+ cells: {
140
+ CODCOM: { value: 'CM1' },
141
+ CODSEQ: { value: '130' },
142
+ CODFAS: { value: '030' },
143
+ DESFAS: { value: 'SPEDIZIONE' },
144
+ COLFAS: { value: '#05CAE8' },
145
+ INISIM: {
146
+ value: '2026-05-13',
147
+ obj: { k: '', p: '*YYMD', t: 'D8' },
148
+ },
149
+ FINSIM: {
150
+ value: '2026-07-08',
151
+ obj: { k: '', p: '*YYMD', t: 'D8' },
152
+ },
153
+ INICON: {
154
+ value: '2025-09-30',
155
+ obj: { k: '', p: '*YYMD', t: 'D8' },
156
+ },
157
+ FINCON: {
158
+ value: '2025-12-09',
159
+ obj: { k: '', p: '*YYMD', t: 'D8' },
160
+ },
161
+ OPEDIP: { value: '010,020' },
162
+ },
163
+ readOnly: true,
164
+ },
165
+ {
166
+ id: '4',
167
+ cells: {
168
+ CODCOM: { value: 'CM1' },
169
+ CODSEQ: { value: '140' },
170
+ CODFAS: { value: '040' },
171
+ DESFAS: { value: 'INSTALLAZIONE' },
172
+ COLFAS: { value: '#3605E8' },
173
+ INISIM: {
174
+ value: '2026-07-09',
175
+ obj: { k: '', p: '*YYMD', t: 'D8' },
176
+ },
177
+ FINSIM: {
178
+ value: '2026-11-05',
179
+ obj: { k: '', p: '*YYMD', t: 'D8' },
180
+ },
181
+ INICON: {
182
+ value: '2025-12-10',
183
+ obj: { k: '', p: '*YYMD', t: 'D8' },
184
+ },
185
+ FINCON: {
186
+ value: '2026-03-04',
187
+ obj: { k: '', p: '*YYMD', t: 'D8' },
188
+ },
189
+ OPEDIP: { value: '030' },
190
+ },
191
+ readOnly: true,
192
+ },
193
+ {
194
+ id: '5',
195
+ cells: {
196
+ CODCOM: { value: 'CM1' },
197
+ CODSEQ: { value: '150' },
198
+ CODFAS: { value: '050' },
199
+ DESFAS: { value: 'FORMAZIONE' },
200
+ COLFAS: { value: '#BB05E8' },
201
+ INISIM: {
202
+ value: '2026-11-19',
203
+ obj: { k: '', p: '*YYMD', t: 'D8' },
204
+ },
205
+ FINSIM: {
206
+ value: '2028-02-02',
207
+ obj: { k: '', p: '*YYMD', t: 'D8' },
208
+ },
209
+ INICON: {
210
+ value: '2026-03-05',
211
+ obj: { k: '', p: '*YYMD', t: 'D8' },
212
+ },
213
+ FINCON: {
214
+ value: '2026-07-23',
215
+ obj: { k: '', p: '*YYMD', t: 'D8' },
216
+ },
217
+ OPEDIP: { value: '040' },
218
+ },
219
+ readOnly: true,
220
+ },
221
+ ],
222
+ };
223
+
224
+ // Inject extra mock tasks and structured dependencies for stress testing
225
+ const extras = { tasks: [], deps: [] };
226
+ if (
227
+ props &&
228
+ props.data &&
229
+ Array.isArray(props.data.rows) &&
230
+ props.data.rows[0]
231
+ ) {
232
+ const sampleRow = props.data.rows[0];
233
+ ['G419', 'G420', 'G421'].forEach((gid, idx) => {
234
+ const clone = JSON.parse(JSON.stringify(sampleRow));
235
+ clone.id = 'x-' + gid;
236
+ if (!clone.cells) clone.cells = {};
237
+ clone.cells[props.taskIdCol] = { value: gid };
238
+ // ensure visible dates (ISO format with date metadata so planner accepts them)
239
+ clone.cells[props.taskDates[0]] = {
240
+ value: '2025-01-01',
241
+ obj: { k: '', p: '*YYMD', t: 'D8' },
242
+ };
243
+ clone.cells[props.taskDates[1]] = {
244
+ value: '2025-02-01',
245
+ obj: { k: '', p: '*YYMD', t: 'D8' },
246
+ };
247
+ extras.tasks.push(clone);
248
+ });
249
+ if (extras.tasks.length) props.data.rows.splice(1, 0, ...extras.tasks);
250
+ /*
251
+ extras.deps.push(
252
+ { id: 'gd1', sourceId: 'G419', targetId: 'G419_P100', type: 'FS' },
253
+ { id: 'gd2', sourceId: 'G419', targetId: 'G419_P100', type: 'FS' },
254
+ { id: 'gd3', sourceId: 'G419', targetId: 'G419_P100', type: 'FS' },
255
+ { id: 'gd4', sourceId: 'G418', targetId: 'G419', type: 'FS' },
256
+ { id: 'gd5', sourceId: 'G420', targetId: 'G421', type: 'FS' },
257
+ { id: 'gd6', sourceId: 'G420', targetId: 'G418_P750', type: 'FS' },
258
+ { id: 'gd7', sourceId: 'G420', targetId: 'G418_P750', type: 'FS' }
259
+ );
260
+ */
261
+ props.dependencies.push(...extras.deps);
262
+ }
263
+
264
+ // assign props to the component (deep-clone data to ensure watchers trigger)
265
+ for (const key in props) {
266
+ if (key === 'data') comp.data = JSON.parse(JSON.stringify(props.data));
267
+ else comp[key] = props[key];
268
+ }
269
+
270
+ try {
271
+ if (typeof comp.refresh === 'function') comp.refresh();
272
+ } catch (e) {
273
+ // ignore
274
+ }
275
+
276
+ function onclick(event) {
277
+ const clickedId =
278
+ event.detail && event.detail.value && event.detail.value.id;
279
+ console.log('planner-example-7 onclick', {
280
+ clickedId,
281
+ event: event.detail,
282
+ });
283
+ if (clickedId) comp.addPhases(clickedId, phases);
284
+ }
285
+
286
+ // (Extra dependencies already injected above in `extras.deps` and props.dependencies)
287
+
288
+ // Re-assign props to the component so changes apply at runtime when example loads.
289
+ // Use deep clones for `data` and `dependencies` so the kup-planner prop watchers
290
+ // detect new object references and update internal state.
291
+ try {
292
+ if (comp && props) {
293
+ for (const key in props) {
294
+ if (key === 'data' && props.data) {
295
+ // deep clone to ensure a new reference
296
+ try {
297
+ comp.data = JSON.parse(JSON.stringify(props.data));
298
+ continue;
299
+ } catch (e) {
300
+ // fallback to direct assign if cloning fails
301
+ comp.data = props.data;
302
+ continue;
303
+ }
304
+ }
305
+
306
+ if (key === 'dependencies' && props.dependencies) {
307
+ try {
308
+ comp.dependencies = JSON.parse(
309
+ JSON.stringify(props.dependencies)
310
+ );
311
+ continue;
312
+ } catch (e) {
313
+ comp.dependencies = props.dependencies;
314
+ continue;
315
+ }
316
+ }
317
+
318
+ comp[key] = props[key];
319
+ }
320
+ // Trigger a refresh so the component rebuilds its internal items from the
321
+ // newly assigned `data` and `dependencies` (some implementations rely on
322
+ // prop watchers which fire on reference changes; calling refresh ensures
323
+ // the UI syncs immediately).
324
+ try {
325
+ if (typeof comp.refresh === 'function') comp.refresh();
326
+ } catch (e) {
327
+ // ignore
328
+ }
329
+ }
330
+ } catch (e) {
331
+ // ignore assignment failures
332
+ }
333
+
334
+ // Expose phases for manual inspection and auto-invoke addPhases for a quick smoke test.
335
+ try {
336
+ // store phases globally so it's easy to call from the browser console
337
+ window.__planner_example_7_phases = phases;
338
+ // try to auto-invoke addPhases when the component is ready
339
+ const tryInvoke = () => {
340
+ const c = document.getElementById('planner');
341
+ if (c && typeof c.addPhases === 'function') {
342
+ try {
343
+ console.log(
344
+ 'planner-example-7: auto-invoking addPhases for CM1'
345
+ );
346
+ c.addPhases('CM1', phases);
347
+ // also print plannerProps deps if available after a short delay
348
+ setTimeout(() => {
349
+ try {
350
+ // eslint-disable-next-line no-console
351
+ console.log(
352
+ 'planner-example-7: plannerProps deps',
353
+ c.plannerProps && c.plannerProps.mainGantt
354
+ ? c.plannerProps.mainGantt.dependencies
355
+ : undefined
356
+ );
357
+ } catch (e) {}
358
+ }, 300);
359
+ } catch (e) {
360
+ // ignore invocation errors
361
+ }
362
+ } else {
363
+ // retry a few times
364
+ setTimeout(tryInvoke, 200);
365
+ }
366
+ };
367
+ tryInvoke();
368
+ } catch (e) {
369
+ // ignore global attach errors
370
+ }
@@ -316,10 +316,14 @@
316
316
  border-color: var(--kup_calendar_event_background_color);
317
317
  color: var(--kup_calendar_event_color);
318
318
  }
319
+ #kup-component .fc-event {
320
+ padding: 0.5rem;
321
+ }
319
322
  #kup-component .fc-event-main {
320
323
  color: inherit;
324
+ display: flex;
321
325
  }
322
- #kup-component .fc-event-title {
326
+ #kup-component .fc-event-title .fc-event-time {
323
327
  padding: 0.25em;
324
328
  }
325
329
  #kup-component .fc-event-time {
@@ -346,6 +350,19 @@
346
350
  .calendar .fc-view-harness {
347
351
  min-height: 450px;
348
352
  }
353
+ .fc-event {
354
+ display: flex;
355
+ flex-direction: column;
356
+ padding: 0.2rem;
357
+ gap: var(--kup-space-03);
358
+ }
359
+ .fc-event .fc-event-main {
360
+ display: flex;
361
+ flex-direction: column;
362
+ }
363
+ .fc-event .fc-daygrid-event-dot {
364
+ display: none;
365
+ }
349
366
  .navigation .navigation__left {
350
367
  font-size: 20px;
351
368
  gap: 8px;
@@ -83,7 +83,7 @@ export const defaultStylingOptions = {
83
83
  barProgressSelectedColor: '#A2A415',
84
84
  barBackgroundColor: '#A2A415',
85
85
  barBackgroundSelectedColor: '#A2A415',
86
- barDropZoneColor: '#4d9f0240'
86
+ barDropZoneColor: '#4d9f0240',
87
87
  };
88
88
  export const KUP_PLANNER_MAIN_GANTT_ID = 'main';
89
89
  export const KUP_PLANNER_SECONDARY_GANTT_ID = 'secondary';
@@ -65,6 +65,7 @@ export class KupPlanner {
65
65
  this.listCellWidth = '300px';
66
66
  this.maxWidth = '90vw';
67
67
  this.phaseColorCol = undefined;
68
+ this.dependencyCol = undefined;
68
69
  this.phaseColumns = undefined;
69
70
  this.phaseColParDep = undefined;
70
71
  this.phaseDates = undefined;
@@ -74,6 +75,7 @@ export class KupPlanner {
74
75
  this.phaseNameCol = undefined;
75
76
  this.phasePrevHours = [];
76
77
  this.phasePrevDates = undefined;
78
+ this.dependencies = [];
77
79
  this.readOnly = false;
78
80
  this.showSecondaryDates = false;
79
81
  this.taskColumns = undefined;
@@ -192,11 +194,12 @@ export class KupPlanner {
192
194
  * @param data - Matrix which contains project phases
193
195
  */
194
196
  async addPhases(taskId, data) {
195
- var _a;
197
+ var _a, _b, _c, _d, _e, _f, _g;
196
198
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
197
199
  if (task) {
198
200
  __classPrivateFieldGet(this, _KupPlanner_phases, "f")[taskId] = data;
199
201
  task.phases = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.filter((row) => isAtLeastOneDateValid(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]])).map((row) => {
202
+ var _a, _b;
200
203
  const datesSanitized = sanitizeAllDates(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]], row.cells[this.phasePrevDates[0]], row.cells[this.phasePrevDates[1]], row.cells[this.phaseHours[0]], row.cells[this.phaseHours[1]], row.cells[this.phasePrevHours[0]], row.cells[this.phasePrevHours[1]]);
201
204
  const valuesToShow = getValuesToShow(row, this.phaseIdCol, this.phaseNameCol, data.columns, this.phaseColumns, () => this.phaseColumns.map((col) => col == this.phaseDates[0]
202
205
  ? '#START#'
@@ -205,10 +208,12 @@ export class KupPlanner {
205
208
  : getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
206
209
  let iconUrl = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconUrl).call(this, row, this.phaseIconCol);
207
210
  let iconColor = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconColor).call(this, row, this.phaseIconCol);
211
+ const _phaseIdRaw = ((_b = (_a = row.cells[this.phaseIdCol]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '') + '';
208
212
  let phase = {
209
213
  taskRow: task.taskRow,
210
214
  phaseRow: row,
211
- id: task.id + '_' + row.cells[this.phaseIdCol].value,
215
+ // trim the phase id value to avoid padded/trailing spaces
216
+ id: `${task.id}_${_phaseIdRaw.trim()}`,
212
217
  phaseRowId: row.id,
213
218
  taskRowId: task.taskRowId,
214
219
  name: row.cells[this.phaseNameCol].value,
@@ -231,6 +236,92 @@ export class KupPlanner {
231
236
  };
232
237
  return phase;
233
238
  });
239
+ // Diagnostic: log created phase ids for the task
240
+ try {
241
+ // eslint-disable-next-line no-console
242
+ console.log('kup-planner: addPhases created phases for', taskId, task.phases ? task.phases.map((p) => p.id) : []);
243
+ }
244
+ catch (e) {
245
+ /* ignore */
246
+ }
247
+ // If the phases dataset includes a dependency column, parse it and
248
+ // create structured dependencies. The column may contain a single
249
+ // dependency id or multiple comma-separated ids. The values can be
250
+ // either phase codes (e.g. 'P410') or full runtime ids
251
+ // ('G418_P410'). We'll normalize to runtime ids using the current
252
+ // task id when necessary.
253
+ try {
254
+ if (this.dependencyCol &&
255
+ data.columns.find((c) => c.name == this.dependencyCol)) {
256
+ const parsedDeps = [];
257
+ for (const row of data.rows || []) {
258
+ const raw = ((_d = (_c = (_b = row.cells) === null || _b === void 0 ? void 0 : _b[this.dependencyCol]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '') + '';
259
+ if (!raw)
260
+ continue;
261
+ const parts = raw
262
+ .split(',')
263
+ .map((s) => s.trim())
264
+ .filter(Boolean);
265
+ // compute current phase runtime id (target of dependencies)
266
+ const phaseCode = ((_g = (_f = (_e = row.cells) === null || _e === void 0 ? void 0 : _e[this.phaseIdCol]) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : '') + '';
267
+ const currentPhaseId = `${task.id}_${phaseCode.trim()}`;
268
+ for (const part of parts) {
269
+ // normalize referenced (source) phase id
270
+ let sourcePhaseId = part;
271
+ if (!sourcePhaseId.includes('_')) {
272
+ // assume phase code in the same task -> make runtime id
273
+ sourcePhaseId = `${task.id}_${sourcePhaseId}`;
274
+ }
275
+ // dependency goes from the referenced phase (source) to the current phase (target)
276
+ const depId = `${sourcePhaseId}__${currentPhaseId}`;
277
+ parsedDeps.push({
278
+ id: depId,
279
+ sourceId: sourcePhaseId,
280
+ targetId: currentPhaseId,
281
+ type: 'FS',
282
+ });
283
+ }
284
+ }
285
+ if (parsedDeps.length) {
286
+ // ensure plannerProps.mainGantt.dependencies exists
287
+ try {
288
+ if (!this.plannerProps.mainGantt.dependencies) {
289
+ this.plannerProps.mainGantt.dependencies = [];
290
+ }
291
+ }
292
+ catch (e) {
293
+ // ensure plannerProps in general exists
294
+ if (!this.plannerProps)
295
+ this.plannerProps = {};
296
+ if (!this.plannerProps.mainGantt)
297
+ this.plannerProps.mainGantt = {};
298
+ this.plannerProps.mainGantt.dependencies = [];
299
+ }
300
+ // merge while avoiding duplicates by id
301
+ const existing = new Map((this.plannerProps.mainGantt.dependencies || []).map((d) => [d.id, d]));
302
+ for (const pd of parsedDeps) {
303
+ if (!existing.has(pd.id)) {
304
+ existing.set(pd.id, pd);
305
+ }
306
+ }
307
+ this.plannerProps.mainGantt.dependencies = Array.from(existing.values());
308
+ // also forward to secondary if present
309
+ if (this.plannerProps.secondaryGantt) {
310
+ this.plannerProps.secondaryGantt.dependencies =
311
+ this.plannerProps.mainGantt.dependencies;
312
+ }
313
+ // Diagnostic
314
+ try {
315
+ // eslint-disable-next-line no-console
316
+ console.log('kup-planner: addPhases - injected dependencies', parsedDeps);
317
+ }
318
+ catch (e) { }
319
+ }
320
+ }
321
+ }
322
+ catch (e) {
323
+ // ignore parsing errors
324
+ }
234
325
  }
235
326
  this.plannerProps.mainGantt.initialScrollX =
236
327
  __classPrivateFieldGet(this, _KupPlanner_storedSettings, "f").taskInitialScrollX;
@@ -263,6 +354,7 @@ export class KupPlanner {
263
354
  }, "f");
264
355
  }
265
356
  componentDidLoad() {
357
+ var _a, _b;
266
358
  let details = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getFilteredRows).call(this, __classPrivateFieldGet(this, _KupPlanner_storedSettings, "f").detailFilter, true));
267
359
  const mainFilter = this.rootElement.shadowRoot.querySelector('#main-filter');
268
360
  FTextFieldMDC(mainFilter);
@@ -296,6 +388,8 @@ export class KupPlanner {
296
388
  taskScrollYTimeout = window.setTimeout(() => this.handleTaskGanttScrollY(y), scrollDelay);
297
389
  },
298
390
  onPhaseDrop: (nativeEvent) => this.handleOnPhaseDrop(nativeEvent),
391
+ // forward structured dependencies provided at planner level
392
+ dependencies: this.dependencies,
299
393
  },
300
394
  secondaryGantt: details
301
395
  ? {
@@ -311,6 +405,8 @@ export class KupPlanner {
311
405
  initialScrollX: this.detailInitialScrollX,
312
406
  initialScrollY: this.detailInitialScrollY,
313
407
  readOnly: this.readOnly,
408
+ // forward structured dependencies to secondary gantt as well
409
+ dependencies: this.dependencies,
314
410
  onScrollY: (y) => {
315
411
  window.clearTimeout(detailScrollYTimeout);
316
412
  detailScrollYTimeout = window.setTimeout(() => this.handleDetailGanttScrollY(y), scrollDelay);
@@ -326,6 +422,12 @@ export class KupPlanner {
326
422
  scrollXTimeout = window.setTimeout(() => this.handleOnScrollX(x), scrollDelay);
327
423
  },
328
424
  };
425
+ // Diagnostic: log what was forwarded into plannerProps.mainGantt.dependencies
426
+ try {
427
+ // eslint-disable-next-line no-console
428
+ console.log('kup-planner: componentDidLoad - plannerProps.mainGantt.dependencies', (_b = (_a = this.plannerProps) === null || _a === void 0 ? void 0 : _a.mainGantt) === null || _b === void 0 ? void 0 : _b.dependencies);
429
+ }
430
+ catch (e) { }
329
431
  this.kupReady.emit({
330
432
  comp: this,
331
433
  id: this.rootElement.id,
@@ -523,7 +625,7 @@ export class KupPlanner {
523
625
  if ((_b = this.plannerProps) === null || _b === void 0 ? void 0 : _b.secondaryGantt) {
524
626
  plannerProps.secondaryGantt = Object.assign(Object.assign({}, this.plannerProps.secondaryGantt), { onScrollY: this.handleDetailGanttScrollY.bind(this) });
525
627
  }
526
- return (h(Host, { key: 'b52aea66cafe0bdaaf314087e43f1b7dca63f154' }, h("style", { key: '3ca539838d1025757f092fc0a18e3b7264520f25' }, __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { key: '94527d16797e8f4262cc369cc66b9eed008b4ec6', id: componentWrapperId, style: { maxWidth: this.maxWidth } }, this.plannerProps && (h("kup-planner-renderer", { key: '6845e11fb230fbe0a72c04d5ad1c890820fdb01f', props: plannerProps, ref: (el) => (this.plannerRenderer = el) }))), h("div", { key: '6d911aaab4c3ab12a3022ee890ed449a1404ce44', style: { display: this.plannerProps ? 'none' : '' } }, h(FTextField, { key: 'fa72076cc7117e0f68396625dc4e2ec3f94fd6a6', icon: KupThemeIconValues.SEARCH, id: "main-filter", label: __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").language.translate(KupLanguageSearch.SEARCH), onKeyDown: (e) => {
628
+ return (h(Host, { key: '2be4622d126df65c075552acb7af8c953cef9712' }, h("style", { key: '6ec8c1df4bd0429bfac86ca5cfba8b8eabf012e3' }, __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { key: '1b242d8489b6f0a95d86fb2e088839557cf9ef0d', id: componentWrapperId, style: { maxWidth: this.maxWidth } }, this.plannerProps && (h("kup-planner-renderer", { key: '31f5594e6f34012eabb69ee578ba6a71c3ac3415', props: plannerProps, ref: (el) => (this.plannerRenderer = el) }))), h("div", { key: '83cc5a397427da1a09a662936f03f14d5f0eecbf', style: { display: this.plannerProps ? 'none' : '' } }, h(FTextField, { key: '39c000f13fb6614f1a4196a57a6bbc36581af4a9', icon: KupThemeIconValues.SEARCH, id: "main-filter", label: __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").language.translate(KupLanguageSearch.SEARCH), onKeyDown: (e) => {
527
629
  if (e.key === 'Enter') {
528
630
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_onFilter).call(this, e.target.value);
529
631
  }
@@ -981,6 +1083,26 @@ export class KupPlanner {
981
1083
  "attribute": "phase-color-col",
982
1084
  "reflect": false
983
1085
  },
1086
+ "dependencyCol": {
1087
+ "type": "string",
1088
+ "mutable": false,
1089
+ "complexType": {
1090
+ "original": "string",
1091
+ "resolved": "string",
1092
+ "references": {}
1093
+ },
1094
+ "required": false,
1095
+ "optional": false,
1096
+ "docs": {
1097
+ "tags": [{
1098
+ "name": "default",
1099
+ "text": "undefined"
1100
+ }],
1101
+ "text": "Optional column name inside the phases dataset containing a reference\r\nto a dependent phase (for example: 'OPEDIP'). When set, `addPhases`\r\nwill read that column and create structured dependencies (FS) from the\r\nreferenced phase to the current phase (source -> target).\r\nMultiple references can be separated by commas in the cell."
1102
+ },
1103
+ "attribute": "dependency-col",
1104
+ "reflect": false
1105
+ },
984
1106
  "phaseColumns": {
985
1107
  "type": "unknown",
986
1108
  "mutable": false,
@@ -1153,6 +1275,28 @@ export class KupPlanner {
1153
1275
  "text": "Columns containing forecast phase duration, from (firstDate) to (secondDate)"
1154
1276
  }
1155
1277
  },
1278
+ "dependencies": {
1279
+ "type": "unknown",
1280
+ "mutable": false,
1281
+ "complexType": {
1282
+ "original": "KupPlannerDependency[]",
1283
+ "resolved": "KupPlannerDependency[]",
1284
+ "references": {
1285
+ "KupPlannerDependency": {
1286
+ "location": "import",
1287
+ "path": "./kup-planner-declarations",
1288
+ "id": "src/components/kup-planner/kup-planner-declarations.ts::KupPlannerDependency"
1289
+ }
1290
+ }
1291
+ },
1292
+ "required": false,
1293
+ "optional": false,
1294
+ "docs": {
1295
+ "tags": [],
1296
+ "text": "Structured dependencies to render as arrows"
1297
+ },
1298
+ "defaultValue": "[]"
1299
+ },
1156
1300
  "readOnly": {
1157
1301
  "type": "boolean",
1158
1302
  "mutable": false,
@@ -1970,6 +2114,12 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_lastOnChangeReceived = new W
1970
2114
  : {
1971
2115
  mainGantt: Object.assign(Object.assign({}, this.plannerProps.mainGantt), { items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getFilteredRows).call(this, value, isDetail)) }),
1972
2116
  };
2117
+ // Diagnostic: inspect whether planner-level `dependencies` prop is set
2118
+ try {
2119
+ // eslint-disable-next-line no-console
2120
+ console.log('kup-planner: componentDidLoad - this.dependencies', this.dependencies);
2121
+ }
2122
+ catch (e) { }
1973
2123
  this.plannerProps = Object.assign(Object.assign({}, this.plannerProps), newGantt);
1974
2124
  this.persistState();
1975
2125
  }, _KupPlanner_getFilteredRows = function _KupPlanner_getFilteredRows(value, isDetail) {