@sme.up/ketchup 7.4.0 → 7.4.2

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 (36) hide show
  1. package/dist/cjs/ketchup.cjs.js +2 -2
  2. package/dist/cjs/kup-planner.cjs.entry.js +1006 -549
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/collection/collection-manifest.json +1 -1
  5. package/dist/collection/components/kup-planner/kup-planner-declarations.js +60 -14
  6. package/dist/collection/components/kup-planner/kup-planner-helper.js +54 -0
  7. package/dist/collection/components/kup-planner/kup-planner.css +16 -18
  8. package/dist/collection/components/kup-planner/kup-planner.js +447 -68
  9. package/dist/components/kup-autocomplete2.js +1 -1
  10. package/dist/components/kup-planner.js +1006 -538
  11. package/dist/components/kup-progress-bar.js +1 -1
  12. package/dist/components/kup-radio.js +1 -1
  13. package/dist/components/kup-rating.js +1 -1
  14. package/dist/components/kup-spinner.js +1 -1
  15. package/dist/components/kup-switch.js +1 -1
  16. package/dist/components/kup-tab-bar.js +1 -1
  17. package/dist/components/kup-text-field.js +1 -1
  18. package/dist/components/kup-time-picker.js +1 -1
  19. package/dist/components/kup-tree.js +1 -1
  20. package/dist/esm/ketchup.js +2 -2
  21. package/dist/esm/kup-planner.entry.js +994 -537
  22. package/dist/esm/loader.js +2 -2
  23. package/dist/ketchup/ketchup.esm.js +1 -1
  24. package/dist/ketchup/p-02a26d59.entry.js +9 -0
  25. package/dist/ketchup/p-462475ac.entry.js +10 -0
  26. package/dist/ketchup/{p-c1137ffd.entry.js → p-4d039705.entry.js} +6 -6
  27. package/dist/ketchup/p-5292ef67.js +3 -3
  28. package/dist/ketchup/p-be61dd36.entry.js +39 -0
  29. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +66 -15
  30. package/dist/types/components/kup-planner/kup-planner-helper.d.ts +6 -0
  31. package/dist/types/components/kup-planner/kup-planner.d.ts +118 -3
  32. package/dist/types/components.d.ts +234 -2
  33. package/package.json +6 -4
  34. package/dist/ketchup/p-4fa7bffd.entry.js +0 -39
  35. package/dist/ketchup/p-8826f5d6.entry.js +0 -11
  36. package/dist/ketchup/p-d5200264.entry.js +0 -9
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
2
- import { a8 as createCommonjsModule, k as kupManagerInstance, g as getProps, s as setProps, c as componentWrapperId, d as defineCustomElement$2, b as defineCustomElement$3, e as defineCustomElement$4, f as defineCustomElement$5, h as defineCustomElement$6, i as defineCustomElement$7, j as defineCustomElement$8, l as defineCustomElement$9, m as defineCustomElement$a, n as defineCustomElement$b, o as defineCustomElement$c, p as defineCustomElement$d, q as defineCustomElement$e, r as defineCustomElement$f, t as defineCustomElement$g, u as defineCustomElement$h, v as defineCustomElement$i, w as defineCustomElement$j, x as defineCustomElement$k, y as defineCustomElement$l, z as defineCustomElement$m, A as defineCustomElement$n, B as defineCustomElement$o, C as defineCustomElement$p, D as defineCustomElement$q, E as defineCustomElement$r, G as defineCustomElement$s } from './kup-autocomplete2.js';
2
+ import { a8 as createCommonjsModule, k as kupManagerInstance, aE as KupDatesFormats, ak as getCellValueForDisplay, g as getProps, s as setProps, c as componentWrapperId, d as defineCustomElement$2, b as defineCustomElement$3, e as defineCustomElement$4, f as defineCustomElement$5, h as defineCustomElement$6, i as defineCustomElement$7, j as defineCustomElement$8, l as defineCustomElement$9, m as defineCustomElement$a, n as defineCustomElement$b, o as defineCustomElement$c, p as defineCustomElement$d, q as defineCustomElement$e, r as defineCustomElement$f, t as defineCustomElement$g, u as defineCustomElement$h, v as defineCustomElement$i, w as defineCustomElement$j, x as defineCustomElement$k, y as defineCustomElement$l, z as defineCustomElement$m, A as defineCustomElement$n, B as defineCustomElement$o, C as defineCustomElement$p, D as defineCustomElement$q, E as defineCustomElement$r, G as defineCustomElement$s } from './kup-autocomplete2.js';
3
3
 
4
4
  /**
5
5
  * Props of the kup-gantt component.
@@ -8,26 +8,72 @@ import { a8 as createCommonjsModule, k as kupManagerInstance, g as getProps, s a
8
8
  var KupPlannerProps;
9
9
  (function (KupPlannerProps) {
10
10
  KupPlannerProps["customStyle"] = "Custom style of the component.";
11
- KupPlannerProps["taskIdCol"] = "Unique task identifier";
12
- KupPlannerProps["taskNameCol"] = "Task name displayed";
13
- KupPlannerProps["taskDates"] = "Task duration, from (firstDate) to (secondDate)";
14
- KupPlannerProps["taskPrevDates"] = "Forecast task duration, from (firstDate) to (secondDate)";
15
- KupPlannerProps["taskColumns"] = "Columns containing informations displayed on the left box near the gantt";
16
- KupPlannerProps["phaseIdCol"] = "Unique phase identifier";
17
- KupPlannerProps["phaseNameCol"] = "Phase name displayed";
18
- KupPlannerProps["phaseDates"] = "Phase duration, from (firstDate) to (secondDate)";
19
- KupPlannerProps["phasePrevDates"] = "Forecast phase duration, from (firstDate) to (secondDate)";
20
- KupPlannerProps["phaseColumns"] = "Columns containing informations displayed on the left box near the gantt";
21
- KupPlannerProps["phaseColorCol"] = "Phase color in hex format";
22
- KupPlannerProps["phaseColParDep"] = "Names of the parent phases";
23
- KupPlannerProps["titleMess"] = "Message displayed";
24
- KupPlannerProps["data"] = "Dataset containg the task list";
11
+ KupPlannerProps["data"] = "Dataset containg the tasks list";
12
+ KupPlannerProps["detailData"] = "Dataset containg the details list";
13
+ KupPlannerProps["detailColorCol"] = "Column containing the detail color, in hex format";
14
+ KupPlannerProps["detailColumns"] = "Columns containing informations displayed in the left box, near the gantt of details";
15
+ KupPlannerProps["detailDates"] = "Columns containing detail duration, from (firstDate) to (secondDate)";
16
+ KupPlannerProps["detailHeight"] = "Height for detail gantt";
17
+ KupPlannerProps["detailIdCol"] = "Column containing unique detail identifier";
18
+ KupPlannerProps["detailNameCol"] = "Column containing detail name displayed";
19
+ KupPlannerProps["detailPrevDates"] = "Columns containing forecast detail duration, from (firstDate) to (secondDate)";
20
+ KupPlannerProps["listCellWidth"] = "Total size of the cells inside to the left box, near the gantt";
21
+ KupPlannerProps["maxWidth"] = "Max width for component";
22
+ KupPlannerProps["phaseColorCol"] = "Column containing the phase color in hex format";
23
+ KupPlannerProps["phaseColumns"] = "Columns containing informations displayed in the left box ,near the gantt of phases";
24
+ KupPlannerProps["phaseColParDep"] = "Column containing the name of the parent phases";
25
+ KupPlannerProps["phaseDates"] = "Columns containing phase duration, from (firstDate) to (secondDate)";
26
+ KupPlannerProps["phaseIdCol"] = "Column containing unique phase identifier";
27
+ KupPlannerProps["phaseNameCol"] = "Column containing phase name displayed";
28
+ KupPlannerProps["phasePrevDates"] = "Columns containing forecast phase duration, from (firstDate) to (secondDate)";
29
+ KupPlannerProps["showSecondaryDates"] = "Enable/disable display of secondary dates";
30
+ KupPlannerProps["taskColumns"] = "Columns containing informations displayed in the left box, near the gantt";
31
+ KupPlannerProps["taskDates"] = "Columns containing task duration, from (firstDate) to (secondDate)";
32
+ KupPlannerProps["taskHeight"] = "Height for main gantt";
33
+ KupPlannerProps["taskIdCol"] = "Column containing unique task identifier";
34
+ KupPlannerProps["taskNameCol"] = "Column containing task name displayed";
35
+ KupPlannerProps["taskPrevDates"] = "Columns containing forecast task duration, from (firstDate) to (secondDate)";
36
+ KupPlannerProps["titleMess"] = "Message displayed on top";
25
37
  })(KupPlannerProps || (KupPlannerProps = {}));
26
38
  var KupPlannerTaskAction;
27
39
  (function (KupPlannerTaskAction) {
28
40
  KupPlannerTaskAction["onOpening"] = "onOpening";
29
41
  KupPlannerTaskAction["onClosing"] = "onClosing";
30
- })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
42
+ })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
43
+ var KupPlannerGanttRowType;
44
+ (function (KupPlannerGanttRowType) {
45
+ KupPlannerGanttRowType["TASK"] = "task";
46
+ KupPlannerGanttRowType["PHASE"] = "phase";
47
+ KupPlannerGanttRowType["DETAIL"] = "detail";
48
+ })(KupPlannerGanttRowType || (KupPlannerGanttRowType = {}));
49
+ class KupPlannerLastOnChangeReceived {
50
+ constructor(event, threshold = 100) {
51
+ this.dateTime = new Date();
52
+ this.event = event;
53
+ this.threshold = threshold;
54
+ }
55
+ isEquivalent(newEvent) {
56
+ const intervalTime = new Date().valueOf() - this.dateTime.valueOf();
57
+ const equals = JSON.stringify(this.event) === JSON.stringify(newEvent);
58
+ return equals && intervalTime < this.threshold;
59
+ }
60
+ resetDateTime() {
61
+ this.dateTime = new Date();
62
+ }
63
+ }
64
+ const defaultStylingOptions = {
65
+ listCellWidth: '300px',
66
+ rowHeight: 40,
67
+ barFill: 90,
68
+ projectProgressColor: '#CBCBCB',
69
+ projectProgressSelectedColor: '#CBCBCB',
70
+ projectBackgroundColor: '#CBCBCB',
71
+ projectBackgroundSelectedColor: '#CBCBCB',
72
+ barProgressColor: '#A2A415',
73
+ barProgressSelectedColor: '#A2A415',
74
+ barBackgroundColor: '#A2A415',
75
+ barBackgroundSelectedColor: '#A2A415',
76
+ };
31
77
 
32
78
  /**
33
79
  * @license React
@@ -8330,18 +8376,6 @@ function _extends() {
8330
8376
  };
8331
8377
  return _extends.apply(this, arguments);
8332
8378
  }
8333
- function _objectWithoutPropertiesLoose(source, excluded) {
8334
- if (source == null) return {};
8335
- var target = {};
8336
- var sourceKeys = Object.keys(source);
8337
- var key, i;
8338
- for (i = 0; i < sourceKeys.length; i++) {
8339
- key = sourceKeys[i];
8340
- if (excluded.indexOf(key) >= 0) continue;
8341
- target[key] = source[key];
8342
- }
8343
- return target;
8344
- }
8345
8379
  function _unsupportedIterableToArray(o, minLen) {
8346
8380
  if (!o) return;
8347
8381
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -8385,6 +8419,230 @@ var ViewMode;
8385
8419
  ViewMode["Year"] = "Year";
8386
8420
  })(ViewMode || (ViewMode = {}));
8387
8421
 
8422
+ var TimeUnit;
8423
+ (function (TimeUnit) {
8424
+ TimeUnit["DAY"] = "days";
8425
+ TimeUnit["WEEK"] = "weeks";
8426
+ TimeUnit["MONTH"] = "months";
8427
+ TimeUnit["YEAR"] = "YEAR";
8428
+ })(TimeUnit || (TimeUnit = {}));
8429
+ var parseToDayStart = function parseToDayStart(ymd) {
8430
+ return luxon.DateTime.fromISO(ymd).toJSDate();
8431
+ };
8432
+ var parseToDayEnd = function parseToDayEnd(endDate) {
8433
+ return luxon.DateTime.fromISO(endDate).plus({
8434
+ seconds: 86400 - 1
8435
+ }).toJSDate();
8436
+ };
8437
+ var formatToIsoDate = function formatToIsoDate(date) {
8438
+ return luxon.DateTime.fromJSDate(date).toISODate();
8439
+ };
8440
+ var formatToLocaleSimple = function formatToLocaleSimple(date) {
8441
+ return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
8442
+ };
8443
+ function validDates(startDate, endDate, _name) {
8444
+ var _start;
8445
+ var start = parseToDayStart(startDate);
8446
+ var end = parseToDayEnd(endDate);
8447
+ if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
8448
+ start = parseToDayStart(endDate);
8449
+ }
8450
+ return {
8451
+ start: start,
8452
+ end: end
8453
+ };
8454
+ }
8455
+
8456
+ var toViewMode = function toViewMode(timeUnit) {
8457
+ switch (timeUnit) {
8458
+ case TimeUnit.DAY:
8459
+ return ViewMode.Day;
8460
+ case TimeUnit.WEEK:
8461
+ return ViewMode.Week;
8462
+ case TimeUnit.MONTH:
8463
+ return ViewMode.Month;
8464
+ case TimeUnit.YEAR:
8465
+ return ViewMode.Year;
8466
+ }
8467
+ };
8468
+ var convertPhaseToTask = function convertPhaseToTask(item) {
8469
+ var mapPhase = function mapPhase(_ref) {
8470
+ var phaseStart = _ref.startDate,
8471
+ phaseEnd = _ref.endDate,
8472
+ secondaryStartDate = _ref.secondaryStartDate,
8473
+ secondaryEndDate = _ref.secondaryEndDate,
8474
+ phaseName = _ref.name,
8475
+ phaseId = _ref.id,
8476
+ color = _ref.color,
8477
+ selectedColor = _ref.selectedColor,
8478
+ dependencies = _ref.dependencies;
8479
+ var _validDates = validDates(phaseStart, phaseEnd),
8480
+ start = _validDates.start,
8481
+ end = _validDates.end;
8482
+ var _validDates2 = validDates(secondaryStartDate, secondaryEndDate),
8483
+ phaseStart2 = _validDates2.start,
8484
+ phaseEnd2 = _validDates2.end;
8485
+ return {
8486
+ start: start,
8487
+ end: end,
8488
+ secondaryStart: phaseStart2,
8489
+ secondaryEnd: phaseEnd2,
8490
+ name: phaseName,
8491
+ valuesToShow: item.valuesToShow,
8492
+ id: phaseId,
8493
+ type: "task",
8494
+ progress: 100,
8495
+ dependencies: dependencies,
8496
+ styles: color ? {
8497
+ backgroundColor: color,
8498
+ progressColor: color,
8499
+ backgroundSelectedColor: selectedColor,
8500
+ progressSelectedColor: selectedColor
8501
+ } : {}
8502
+ };
8503
+ };
8504
+ return mapPhase(item);
8505
+ };
8506
+ var convertDetailToTimeline = function convertDetailToTimeline(item, mainGanttStartDate, mainGanttEndDate) {
8507
+ var id = item.id,
8508
+ name = item.name,
8509
+ schedule = item.schedule;
8510
+ var getDatesForTask = function getDatesForTask(item) {
8511
+ var start = mainGanttStartDate != null ? mainGanttStartDate : "";
8512
+ var end = mainGanttEndDate != null ? mainGanttEndDate : "";
8513
+ for (var i = 0; i < item.schedule.length; i++) {
8514
+ var lstart = item.schedule[i].startDate;
8515
+ var lend = item.schedule[i].endDate;
8516
+ if (!start || lstart.localeCompare(start) < 0) {
8517
+ start = lstart;
8518
+ }
8519
+ if (!end || lend.localeCompare(end) > 0) {
8520
+ end = lend;
8521
+ }
8522
+ }
8523
+ return validDates(start, end);
8524
+ };
8525
+ var _getDatesForTask = getDatesForTask(item),
8526
+ start = _getDatesForTask.start,
8527
+ end = _getDatesForTask.end;
8528
+ var convertToFrame = function convertToFrame(x) {
8529
+ var startDate = x.startDate,
8530
+ endDate = x.endDate,
8531
+ color = x.color,
8532
+ selectedColor = x.selectedColor;
8533
+ var _validDates3 = validDates(startDate, endDate),
8534
+ start = _validDates3.start,
8535
+ end = _validDates3.end;
8536
+ return {
8537
+ start: start,
8538
+ end: end,
8539
+ backgroundColor: color != null ? color : "0xffffff",
8540
+ backgroundSelectedColor: selectedColor != null ? selectedColor : color
8541
+ };
8542
+ };
8543
+ var defaultColor = "#595959";
8544
+ return {
8545
+ id: id,
8546
+ type: "timeline",
8547
+ timeline: schedule.map(convertToFrame),
8548
+ name: name,
8549
+ valuesToShow: item.valuesToShow,
8550
+ start: start,
8551
+ end: end,
8552
+ progress: 100,
8553
+ styles: {
8554
+ backgroundColor: defaultColor,
8555
+ progressColor: defaultColor,
8556
+ backgroundSelectedColor: defaultColor,
8557
+ progressSelectedColor: defaultColor
8558
+ }
8559
+ };
8560
+ };
8561
+ var isDetail = function isDetail(row) {
8562
+ return row && row.schedule && row.schedule.length !== 0;
8563
+ };
8564
+ var convertProjectToTasks = function convertProjectToTasks(item, mainGanttStartDate, mainGanttEndDate) {
8565
+ if (!isDetail(item)) {
8566
+ var _row$phases;
8567
+ var row = item;
8568
+ var _validDates4 = validDates(row.startDate, row.endDate),
8569
+ start = _validDates4.start,
8570
+ end = _validDates4.end;
8571
+ var _validDates5 = validDates(row.secondaryStartDate, row.secondaryEndDate),
8572
+ start2 = _validDates5.start,
8573
+ end2 = _validDates5.end;
8574
+ var mainTask = {
8575
+ start: start,
8576
+ end: end,
8577
+ id: row.id,
8578
+ name: row.name,
8579
+ type: row.type,
8580
+ valuesToShow: row.valuesToShow,
8581
+ secondaryStart: start2,
8582
+ secondaryEnd: end2,
8583
+ progress: 100,
8584
+ isDisabled: false,
8585
+ hideChildren: false
8586
+ };
8587
+ var children1 = ((_row$phases = row.phases) != null ? _row$phases : []).map(convertPhaseToTask);
8588
+ return [mainTask].concat(children1);
8589
+ } else {
8590
+ var _row = item;
8591
+ return [_extends({}, convertDetailToTimeline(_row, mainGanttStartDate, mainGanttEndDate))];
8592
+ }
8593
+ };
8594
+ var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref2) {
8595
+ var id = _ref2.id,
8596
+ start = _ref2.start,
8597
+ end = _ref2.end;
8598
+ return projects.map(function (project) {
8599
+ return project.id === id ? withNewDates(project, start, end) : project;
8600
+ });
8601
+ };
8602
+ var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref3) {
8603
+ var id = _ref3.id,
8604
+ start = _ref3.start,
8605
+ end = _ref3.end;
8606
+ if (phases) {
8607
+ return phases.map(function (phase) {
8608
+ return phase.id === id ? withNewDates(phase, start, end) : phase;
8609
+ });
8610
+ }
8611
+ return undefined;
8612
+ };
8613
+ var withNewDates = function withNewDates(p, start, end) {
8614
+ var startDate = formatToIsoDate(start);
8615
+ var endDate = formatToIsoDate(end);
8616
+ var extra = {
8617
+ startDate: startDate,
8618
+ endDate: endDate
8619
+ };
8620
+ return _extends({}, p, extra);
8621
+ };
8622
+ var getProjectById = function getProjectById(id, items) {
8623
+ for (var i = 0; i < items.length; i++) {
8624
+ if (items[i].id === id) {
8625
+ return items[i];
8626
+ }
8627
+ }
8628
+ return undefined;
8629
+ };
8630
+ var getPhaseById = function getPhaseById(id, items) {
8631
+ for (var i = 0; i < items.length; i++) {
8632
+ if (isDetail(items[i])) {
8633
+ continue;
8634
+ }
8635
+ var item = items[i];
8636
+ if (!item.phases) {
8637
+ continue;
8638
+ }
8639
+ for (var j = 0; j < item.phases.length; j++) if (item.phases[j].id === id) {
8640
+ return item.phases[j];
8641
+ }
8642
+ }
8643
+ return undefined;
8644
+ };
8645
+
8388
8646
  var intlDTCache = {};
8389
8647
  var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts) {
8390
8648
  if (opts === void 0) {
@@ -8399,80 +8657,157 @@ var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts)
8399
8657
  return dtf;
8400
8658
  };
8401
8659
  var addToDate = function addToDate(date, quantity, scale) {
8402
- var newDate = new Date(date.getFullYear() + (scale === 'year' ? quantity : 0), date.getMonth() + (scale === 'month' ? quantity : 0), date.getDate() + (scale === 'day' ? quantity : 0), date.getHours() + (scale === 'hour' ? quantity : 0), date.getMinutes() + (scale === 'minute' ? quantity : 0), date.getSeconds() + (scale === 'second' ? quantity : 0), date.getMilliseconds() + (scale === 'millisecond' ? quantity : 0));
8660
+ var newDate = new Date(date.getFullYear() + (scale === "year" ? quantity : 0), date.getMonth() + (scale === "month" ? quantity : 0), date.getDate() + (scale === "day" ? quantity : 0), date.getHours() + (scale === "hour" ? quantity : 0), date.getMinutes() + (scale === "minute" ? quantity : 0), date.getSeconds() + (scale === "second" ? quantity : 0), date.getMilliseconds() + (scale === "millisecond" ? quantity : 0));
8403
8661
  return newDate;
8404
8662
  };
8405
8663
  var startOfDate = function startOfDate(date, scale) {
8406
- var scores = ['millisecond', 'second', 'minute', 'hour', 'day', 'month', 'year'];
8664
+ var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
8407
8665
  var shouldReset = function shouldReset(_scale) {
8408
8666
  var maxScore = scores.indexOf(scale);
8409
8667
  return scores.indexOf(_scale) <= maxScore;
8410
8668
  };
8411
- var newDate = new Date(date.getFullYear(), shouldReset('year') ? 0 : date.getMonth(), shouldReset('month') ? 1 : date.getDate(), shouldReset('day') ? 0 : date.getHours(), shouldReset('hour') ? 0 : date.getMinutes(), shouldReset('minute') ? 0 : date.getSeconds(), shouldReset('second') ? 0 : date.getMilliseconds());
8669
+ var newDate = new Date(date.getFullYear(), shouldReset("year") ? 0 : date.getMonth(), shouldReset("month") ? 1 : date.getDate(), shouldReset("day") ? 0 : date.getHours(), shouldReset("hour") ? 0 : date.getMinutes(), shouldReset("minute") ? 0 : date.getSeconds(), shouldReset("second") ? 0 : date.getMilliseconds());
8412
8670
  return newDate;
8413
8671
  };
8414
- var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates) {
8415
- var newStartDate = tasks[0].start;
8416
- var newEndDate = tasks[0].start;
8417
- for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8418
- var task = _step.value;
8419
- if (task.start < newStartDate) {
8420
- newStartDate = task.start;
8672
+ var ganttDateRangeFromTask = function ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, mainGanttStartDate, mainGanttEndDate) {
8673
+ var dates = [];
8674
+ tasks.forEach(function (item) {
8675
+ dates.push({
8676
+ start: item.start,
8677
+ end: item.end,
8678
+ secondaryStart: item.secondaryStart,
8679
+ secondaryEnd: item.secondaryEnd
8680
+ });
8681
+ });
8682
+ if (mainGanttStartDate && mainGanttEndDate) {
8683
+ dates.push({
8684
+ start: mainGanttStartDate,
8685
+ end: mainGanttEndDate,
8686
+ secondaryStart: undefined,
8687
+ secondaryEnd: undefined
8688
+ });
8689
+ }
8690
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates);
8691
+ };
8692
+ var calculateDisplayedDateRange = function calculateDisplayedDateRange(mainGanttItems, timeUnit, mainGanttDoubleView, secondaryGanttItems, preStepsCount) {
8693
+ var dates = ganttDateRangeFromGanttTask(mainGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8694
+ if (secondaryGanttItems) {
8695
+ var dates2 = ganttDateRangeFromDetail(secondaryGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8696
+ if (dates2[0] < dates[0]) {
8697
+ dates[0] = dates2[0];
8698
+ }
8699
+ if (dates2[1] > dates[1]) {
8700
+ dates[1] = dates2[1];
8701
+ }
8702
+ }
8703
+ return {
8704
+ displayedStartDate: dates[0],
8705
+ displayedEndDate: dates[1]
8706
+ };
8707
+ };
8708
+ var ganttDateRangeFromGanttTask = function ganttDateRangeFromGanttTask(tasks, viewMode, preStepsCount, showSecondaryDates) {
8709
+ var dates = [];
8710
+ tasks.forEach(function (item) {
8711
+ var _item$phases;
8712
+ dates.push({
8713
+ start: parseToDayStart(item.startDate),
8714
+ end: parseToDayEnd(item.endDate),
8715
+ secondaryStart: parseToDayStart(item.secondaryStartDate),
8716
+ secondaryEnd: parseToDayEnd(item.secondaryEndDate)
8717
+ });
8718
+ (_item$phases = item.phases) === null || _item$phases === void 0 ? void 0 : _item$phases.forEach(function (phase) {
8719
+ dates.push({
8720
+ start: parseToDayStart(phase.startDate),
8721
+ end: parseToDayEnd(phase.endDate),
8722
+ secondaryStart: parseToDayStart(phase.secondaryStartDate),
8723
+ secondaryEnd: parseToDayEnd(phase.secondaryEndDate)
8724
+ });
8725
+ });
8726
+ });
8727
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8728
+ };
8729
+ var ganttDateRangeFromDetail = function ganttDateRangeFromDetail(details, viewMode, preStepsCount, showSecondaryDates) {
8730
+ var dates = [];
8731
+ details.forEach(function (item) {
8732
+ var scheduleItems = item.schedule;
8733
+ if (scheduleItems) {
8734
+ scheduleItems.forEach(function (item) {
8735
+ dates.push({
8736
+ start: parseToDayStart(item.startDate),
8737
+ end: parseToDayEnd(item.endDate),
8738
+ secondaryStart: undefined,
8739
+ secondaryEnd: undefined
8740
+ });
8741
+ });
8742
+ }
8743
+ });
8744
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8745
+ };
8746
+ var ganttDateRangeGeneric = function ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, realDates) {
8747
+ var newStartDate = dates[0].start;
8748
+ var newEndDate = dates[0].end;
8749
+ for (var _iterator = _createForOfIteratorHelperLoose(dates), _step; !(_step = _iterator()).done;) {
8750
+ var d = _step.value;
8751
+ if (d.start < newStartDate) {
8752
+ newStartDate = d.start;
8421
8753
  }
8422
- if (task.end > newEndDate) {
8423
- newEndDate = task.end;
8754
+ if (d.end > newEndDate) {
8755
+ newEndDate = d.end;
8424
8756
  }
8425
8757
  if (showSecondaryDates) {
8426
- if (task.secondaryStart && task.secondaryStart < newStartDate) {
8427
- newStartDate = task.secondaryStart;
8758
+ if (d.secondaryStart && d.secondaryStart < newStartDate) {
8759
+ newStartDate = d.secondaryStart;
8428
8760
  }
8429
- if (task.secondaryEnd && task.secondaryEnd > newEndDate) {
8430
- newEndDate = task.secondaryEnd;
8761
+ if (d.secondaryEnd && d.secondaryEnd > newEndDate) {
8762
+ newEndDate = d.secondaryEnd;
8431
8763
  }
8432
8764
  }
8433
8765
  }
8766
+ if (realDates) {
8767
+ return [newStartDate, newEndDate];
8768
+ }
8434
8769
  switch (viewMode) {
8435
8770
  case ViewMode.Year:
8436
- newStartDate = addToDate(newStartDate, -1, 'year');
8437
- newStartDate = startOfDate(newStartDate, 'year');
8438
- newEndDate = addToDate(newEndDate, 1, 'year');
8439
- newEndDate = startOfDate(newEndDate, 'year');
8771
+ newStartDate = addToDate(newStartDate, -1, "year");
8772
+ newStartDate = startOfDate(newStartDate, "year");
8773
+ newEndDate = addToDate(newEndDate, 1, "year");
8774
+ newEndDate = startOfDate(newEndDate, "year");
8440
8775
  break;
8441
8776
  case ViewMode.Month:
8442
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'month');
8443
- newStartDate = startOfDate(newStartDate, 'month');
8444
- newEndDate = addToDate(newEndDate, 1, 'year');
8445
- newEndDate = startOfDate(newEndDate, 'year');
8777
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
8778
+ newStartDate = startOfDate(newStartDate, "month");
8779
+ newEndDate = addToDate(newEndDate, 1, "year");
8780
+ newEndDate = startOfDate(newEndDate, "year");
8446
8781
  break;
8447
8782
  case ViewMode.Week:
8448
- newStartDate = startOfDate(newStartDate, 'day');
8449
- newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, 'day');
8450
- newEndDate = startOfDate(newEndDate, 'day');
8451
- newEndDate = addToDate(newEndDate, 1.5, 'month');
8783
+ newStartDate = startOfDate(newStartDate, "day");
8784
+ newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, "day");
8785
+ newEndDate = startOfDate(newEndDate, "day");
8786
+ newEndDate = addToDate(newEndDate, 1.5, "month");
8452
8787
  break;
8453
8788
  case ViewMode.Day:
8454
- newStartDate = startOfDate(newStartDate, 'day');
8455
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8456
- newEndDate = startOfDate(newEndDate, 'day');
8457
- newEndDate = addToDate(newEndDate, 19, 'day');
8789
+ newStartDate = startOfDate(newStartDate, "day");
8790
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8791
+ newEndDate = startOfDate(newEndDate, "day");
8792
+ newEndDate = addToDate(newEndDate, 19, "day");
8458
8793
  break;
8459
8794
  case ViewMode.QuarterDay:
8460
- newStartDate = startOfDate(newStartDate, 'day');
8461
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8462
- newEndDate = startOfDate(newEndDate, 'day');
8463
- newEndDate = addToDate(newEndDate, 66, 'hour');
8795
+ newStartDate = startOfDate(newStartDate, "day");
8796
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8797
+ newEndDate = startOfDate(newEndDate, "day");
8798
+ newEndDate = addToDate(newEndDate, 66, "hour");
8464
8799
  break;
8465
8800
  case ViewMode.HalfDay:
8466
- newStartDate = startOfDate(newStartDate, 'day');
8467
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8468
- newEndDate = startOfDate(newEndDate, 'day');
8469
- newEndDate = addToDate(newEndDate, 108, 'hour');
8801
+ newStartDate = startOfDate(newStartDate, "day");
8802
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8803
+ newEndDate = startOfDate(newEndDate, "day");
8804
+ newEndDate = addToDate(newEndDate, 108, "hour");
8470
8805
  break;
8471
8806
  case ViewMode.Hour:
8472
- newStartDate = startOfDate(newStartDate, 'hour');
8473
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'hour');
8474
- newEndDate = startOfDate(newEndDate, 'day');
8475
- newEndDate = addToDate(newEndDate, 1, 'day');
8807
+ newStartDate = startOfDate(newStartDate, "hour");
8808
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
8809
+ newEndDate = startOfDate(newEndDate, "day");
8810
+ newEndDate = addToDate(newEndDate, 1, "day");
8476
8811
  break;
8477
8812
  }
8478
8813
  return [newStartDate, newEndDate];
@@ -8483,25 +8818,25 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8483
8818
  while (currentDate < endDate) {
8484
8819
  switch (viewMode) {
8485
8820
  case ViewMode.Year:
8486
- currentDate = addToDate(currentDate, 1, 'year');
8821
+ currentDate = addToDate(currentDate, 1, "year");
8487
8822
  break;
8488
8823
  case ViewMode.Month:
8489
- currentDate = addToDate(currentDate, 1, 'month');
8824
+ currentDate = addToDate(currentDate, 1, "month");
8490
8825
  break;
8491
8826
  case ViewMode.Week:
8492
- currentDate = addToDate(currentDate, 7, 'day');
8827
+ currentDate = addToDate(currentDate, 7, "day");
8493
8828
  break;
8494
8829
  case ViewMode.Day:
8495
- currentDate = addToDate(currentDate, 1, 'day');
8830
+ currentDate = addToDate(currentDate, 1, "day");
8496
8831
  break;
8497
8832
  case ViewMode.HalfDay:
8498
- currentDate = addToDate(currentDate, 12, 'hour');
8833
+ currentDate = addToDate(currentDate, 12, "hour");
8499
8834
  break;
8500
8835
  case ViewMode.QuarterDay:
8501
- currentDate = addToDate(currentDate, 6, 'hour');
8836
+ currentDate = addToDate(currentDate, 6, "hour");
8502
8837
  break;
8503
8838
  case ViewMode.Hour:
8504
- currentDate = addToDate(currentDate, 1, 'hour');
8839
+ currentDate = addToDate(currentDate, 1, "hour");
8505
8840
  break;
8506
8841
  }
8507
8842
  dates.push(currentDate);
@@ -8510,7 +8845,7 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8510
8845
  };
8511
8846
  var getLocaleMonth = function getLocaleMonth(date, locale) {
8512
8847
  var bottomValue = getCachedDateTimeFormat(locale, {
8513
- month: 'long'
8848
+ month: "long"
8514
8849
  }).format(date);
8515
8850
  bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
8516
8851
  return bottomValue;
@@ -8560,15 +8895,15 @@ var defaultDateTimeFormatters = {
8560
8895
  return "W" + getWeekNumberISO8601(date);
8561
8896
  },
8562
8897
  day: function day(date, locale) {
8563
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate().toString();
8898
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate().toString();
8564
8899
  },
8565
8900
  hour: function hour(date, locale) {
8566
8901
  return "" + getCachedDateTimeFormat(locale, {
8567
- hour: 'numeric'
8902
+ hour: "numeric"
8568
8903
  }).format(date);
8569
8904
  },
8570
8905
  dayAndMonth: function dayAndMonth(date, locale) {
8571
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8906
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8572
8907
  }
8573
8908
  };
8574
8909
 
@@ -8888,9 +9223,7 @@ var GridBody = function GridBody(_ref) {
8888
9223
  dates = _ref.dates,
8889
9224
  rowHeight = _ref.rowHeight,
8890
9225
  svgWidth = _ref.svgWidth,
8891
- columnWidth = _ref.columnWidth,
8892
- todayColor = _ref.todayColor,
8893
- rtl = _ref.rtl;
9226
+ columnWidth = _ref.columnWidth;
8894
9227
  var y = 0;
8895
9228
  var gridRows = [];
8896
9229
  var rowLines = [react.createElement("line", {
@@ -8904,7 +9237,7 @@ var GridBody = function GridBody(_ref) {
8904
9237
  for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8905
9238
  var task = _step.value;
8906
9239
  gridRows.push(react.createElement("rect", {
8907
- key: 'Row' + task.id,
9240
+ key: "Row" + task.id,
8908
9241
  x: "0",
8909
9242
  y: y,
8910
9243
  width: svgWidth,
@@ -8912,7 +9245,7 @@ var GridBody = function GridBody(_ref) {
8912
9245
  className: styles$4.gridRow
8913
9246
  }));
8914
9247
  rowLines.push(react.createElement("line", {
8915
- key: 'RowLine' + task.id,
9248
+ key: "RowLine" + task.id,
8916
9249
  x: "0",
8917
9250
  y1: y + rowHeight,
8918
9251
  x2: svgWidth,
@@ -8924,7 +9257,6 @@ var GridBody = function GridBody(_ref) {
8924
9257
  var now = new Date();
8925
9258
  var tickX = 0;
8926
9259
  var ticks = [];
8927
- var today = react.createElement("rect", null);
8928
9260
  for (var i = 0; i < dates.length; i++) {
8929
9261
  var date = dates[i];
8930
9262
  ticks.push(react.createElement("line", {
@@ -8935,24 +9267,7 @@ var GridBody = function GridBody(_ref) {
8935
9267
  y2: y,
8936
9268
  className: styles$4.gridTick
8937
9269
  }));
8938
- if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), 'millisecond').getTime() >= now.getTime()) {
8939
- today = react.createElement("rect", {
8940
- x: tickX + columnWidth / 2 - 1,
8941
- y: 0,
8942
- width: 2,
8943
- height: y,
8944
- fill: todayColor
8945
- });
8946
- }
8947
- if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
8948
- today = react.createElement("rect", {
8949
- x: tickX + columnWidth / 2,
8950
- y: 0,
8951
- width: 2,
8952
- height: y,
8953
- fill: todayColor
8954
- });
8955
- }
9270
+ if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) ;
8956
9271
  tickX += columnWidth;
8957
9272
  }
8958
9273
  return react.createElement("g", {
@@ -8963,9 +9278,7 @@ var GridBody = function GridBody(_ref) {
8963
9278
  className: "rowLines"
8964
9279
  }, rowLines), react.createElement("g", {
8965
9280
  className: "ticks"
8966
- }, ticks), react.createElement("g", {
8967
- className: "today"
8968
- }, today));
9281
+ }, ticks));
8969
9282
  };
8970
9283
 
8971
9284
  var Grid = function Grid(props) {
@@ -9035,7 +9348,8 @@ var Calendar = function Calendar(_ref) {
9035
9348
  fontSize = _ref.fontSize,
9036
9349
  dateTimeFormatters = _ref.dateTimeFormatters,
9037
9350
  _ref$singleLineHeader = _ref.singleLineHeader,
9038
- singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader;
9351
+ singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
9352
+ currentDateIndicator = _ref.currentDateIndicator;
9039
9353
  var simplifiedHeader = singleLineHeader && dateSetup.viewMode !== ViewMode.Year;
9040
9354
  var TopCal = simplifiedHeader ? SinglePartOfCalendar : TopPartOfCalendar;
9041
9355
  var formatYear = (_dateTimeFormatters$y = dateTimeFormatters === null || dateTimeFormatters === void 0 ? void 0 : dateTimeFormatters.year) != null ? _dateTimeFormatters$y : defaultDateTimeFormatters.year;
@@ -9121,7 +9435,7 @@ var Calendar = function Calendar(_ref) {
9121
9435
  var dates = dateSetup.dates;
9122
9436
  for (var i = dates.length - 1; i >= 0; i--) {
9123
9437
  var date = dates[i];
9124
- var topValue = '';
9438
+ var topValue = "";
9125
9439
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
9126
9440
  topValue = formatMonthAndYear(date, locale);
9127
9441
  }
@@ -9256,7 +9570,12 @@ var Calendar = function Calendar(_ref) {
9256
9570
  width: columnWidth * dateSetup.dates.length,
9257
9571
  height: headerHeight,
9258
9572
  className: styles$5.calendarHeader
9259
- }), simplifiedHeader ? null : bottomValues, " ", topValues);
9573
+ }), simplifiedHeader ? null : bottomValues, " ", topValues, currentDateIndicator && react.createElement("circle", {
9574
+ fill: currentDateIndicator.color,
9575
+ cx: currentDateIndicator.x + 2.5,
9576
+ cy: headerHeight - 8,
9577
+ r: "8"
9578
+ }));
9260
9579
  };
9261
9580
 
9262
9581
  // A type of promise-like that resolves synchronously and supports only one observer
@@ -9495,6 +9814,9 @@ var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
9495
9814
  var index = dates.findIndex(function (d) {
9496
9815
  return d.getTime() >= xDate.getTime();
9497
9816
  }) - 1;
9817
+ if (index < 0) {
9818
+ return 0;
9819
+ }
9498
9820
  var remainderMillis = xDate.getTime() - dates[index].getTime();
9499
9821
  var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
9500
9822
  var x = index * columnWidth + percentOfInterval * columnWidth;
@@ -9652,6 +9974,15 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
9652
9974
  changedTask: changedTask
9653
9975
  };
9654
9976
  };
9977
+ function calculateCurrentDateCalculator(dates, columnWidth) {
9978
+ return taskXCoordinate(new Date(), dates, columnWidth);
9979
+ }
9980
+ function calculateProjection(start, end, dates, columnWidth) {
9981
+ return {
9982
+ x0: taskXCoordinate(start, dates, columnWidth),
9983
+ xf: taskXCoordinate(end, dates, columnWidth)
9984
+ };
9985
+ }
9655
9986
 
9656
9987
  function isKeyboardEvent(event) {
9657
9988
  return event.key !== undefined;
@@ -9914,11 +10245,15 @@ var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
9914
10245
 
9915
10246
  var Timeline = function Timeline(_ref) {
9916
10247
  var task = _ref.task,
9917
- isSelected = _ref.isSelected;
10248
+ isSelected = _ref.isSelected,
10249
+ onEventStart = _ref.onEventStart;
9918
10250
  var styles = task.styles;
9919
10251
  var col = isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
9920
10252
  return react.createElement("g", {
9921
- tabIndex: 0
10253
+ tabIndex: 0,
10254
+ onMouseDown: function onMouseDown(e) {
10255
+ return onEventStart("move", task, e);
10256
+ }
9922
10257
  }, react.createElement("rect", {
9923
10258
  fill: col,
9924
10259
  x: "0",
@@ -9929,6 +10264,9 @@ var Timeline = function Timeline(_ref) {
9929
10264
  ry: 0
9930
10265
  }), task.barChildren.map(function (bar) {
9931
10266
  return react.createElement("rect", {
10267
+ style: {
10268
+ cursor: "pointer"
10269
+ },
9932
10270
  key: bar.id,
9933
10271
  fill: bar.styles.backgroundColor,
9934
10272
  x: bar.x1,
@@ -9974,7 +10312,7 @@ var TaskItem = function TaskItem(props) {
9974
10312
  setTaskItem(react.createElement(Bar, Object.assign({}, props)));
9975
10313
  break;
9976
10314
  }
9977
- }, [task.typeInternal, isSelected, props]);
10315
+ }, [task, isSelected]);
9978
10316
  react.useEffect(function () {
9979
10317
  if (textRef.current) {
9980
10318
  setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
@@ -10042,6 +10380,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10042
10380
  fontFamily = _ref.fontFamily,
10043
10381
  fontSize = _ref.fontSize,
10044
10382
  rtl = _ref.rtl,
10383
+ _ref$hideLabel = _ref.hideLabel,
10384
+ hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10385
+ _ref$showSecondaryDat = _ref.showSecondaryDates,
10386
+ showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10387
+ currentDateIndicator = _ref.currentDateIndicator,
10388
+ projection = _ref.projection,
10045
10389
  setGanttEvent = _ref.setGanttEvent,
10046
10390
  setFailedTask = _ref.setFailedTask,
10047
10391
  setSelectedTask = _ref.setSelectedTask,
@@ -10049,11 +10393,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10049
10393
  onProgressChange = _ref.onProgressChange,
10050
10394
  onDoubleClick = _ref.onDoubleClick,
10051
10395
  onClick = _ref.onClick,
10052
- onDelete = _ref.onDelete,
10053
- _ref$hideLabel = _ref.hideLabel,
10054
- hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10055
- _ref$showSecondaryDat = _ref.showSecondaryDates,
10056
- showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat;
10396
+ onDelete = _ref.onDelete;
10057
10397
  var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
10058
10398
  var _useState = react.useState(0),
10059
10399
  xStep = _useState[0],
@@ -10241,7 +10581,20 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10241
10581
  };
10242
10582
  return react.createElement("g", {
10243
10583
  className: "content"
10244
- }, react.createElement("g", {
10584
+ }, currentDateIndicator && react.createElement("rect", {
10585
+ fill: currentDateIndicator.color,
10586
+ x: currentDateIndicator.x + 1.5,
10587
+ y: "0",
10588
+ width: "2",
10589
+ height: "100%"
10590
+ }), projection && react.createElement("rect", {
10591
+ fill: projection.color,
10592
+ x: projection.x0,
10593
+ y: "0",
10594
+ width: projection.xf - projection.x0,
10595
+ height: "100%",
10596
+ fillOpacity: "35%"
10597
+ }), react.createElement("g", {
10245
10598
  className: "arrows",
10246
10599
  fill: arrowColor,
10247
10600
  stroke: arrowColor
@@ -10349,6 +10702,7 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10349
10702
  scrollRef.current.scrollLeft = scroll;
10350
10703
  }
10351
10704
  }, [scroll]);
10705
+ console.log("HORIZONTAL-SCROLL svgWidth: " + svgWidth);
10352
10706
  return react.createElement("div", {
10353
10707
  dir: "ltr",
10354
10708
  style: {
@@ -10366,13 +10720,14 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10366
10720
  };
10367
10721
 
10368
10722
  var Gantt = function Gantt(_ref) {
10369
- var tasks = _ref.tasks,
10723
+ var id = _ref.id,
10724
+ tasks = _ref.tasks,
10370
10725
  _ref$headerHeight = _ref.headerHeight,
10371
10726
  headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
10372
10727
  _ref$columnWidth = _ref.columnWidth,
10373
10728
  columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
10374
10729
  _ref$listCellWidth = _ref.listCellWidth,
10375
- listCellWidth = _ref$listCellWidth === void 0 ? "155px" : _ref$listCellWidth,
10730
+ listCellWidth = _ref$listCellWidth === void 0 ? "297px" : _ref$listCellWidth,
10376
10731
  _ref$rowHeight = _ref.rowHeight,
10377
10732
  rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
10378
10733
  _ref$ganttHeight = _ref.ganttHeight,
@@ -10422,7 +10777,7 @@ var Gantt = function Gantt(_ref) {
10422
10777
  _ref$arrowIndent = _ref.arrowIndent,
10423
10778
  arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
10424
10779
  _ref$todayColor = _ref.todayColor,
10425
- todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
10780
+ todayColor = _ref$todayColor === void 0 ? "#ff0000" : _ref$todayColor,
10426
10781
  viewDate = _ref.viewDate,
10427
10782
  _ref$TooltipContent = _ref.TooltipContent,
10428
10783
  TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
@@ -10430,13 +10785,6 @@ var Gantt = function Gantt(_ref) {
10430
10785
  TaskListHeader = _ref$TaskListHeader === void 0 ? TaskListHeaderDefault : _ref$TaskListHeader,
10431
10786
  _ref$TaskListTable = _ref.TaskListTable,
10432
10787
  TaskListTable = _ref$TaskListTable === void 0 ? TaskListTableDefault : _ref$TaskListTable,
10433
- onDateChange = _ref.onDateChange,
10434
- onProgressChange = _ref.onProgressChange,
10435
- onDoubleClick = _ref.onDoubleClick,
10436
- onClick = _ref.onClick,
10437
- onDelete = _ref.onDelete,
10438
- onSelect = _ref.onSelect,
10439
- onExpanderClick = _ref.onExpanderClick,
10440
10788
  dateTimeFormatters = _ref.dateTimeFormatters,
10441
10789
  _ref$singleLineHeader = _ref.singleLineHeader,
10442
10790
  singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
@@ -10445,13 +10793,23 @@ var Gantt = function Gantt(_ref) {
10445
10793
  _ref$showSecondaryDat = _ref.showSecondaryDates,
10446
10794
  showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10447
10795
  _ref$hideDependencies = _ref.hideDependencies,
10448
- hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies;
10796
+ hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies,
10797
+ projection = _ref.projection,
10798
+ displayedStartDate = _ref.displayedStartDate,
10799
+ displayedEndDate = _ref.displayedEndDate,
10800
+ onDateChange = _ref.onDateChange,
10801
+ onProgressChange = _ref.onProgressChange,
10802
+ onDoubleClick = _ref.onDoubleClick,
10803
+ onClick = _ref.onClick,
10804
+ onDelete = _ref.onDelete,
10805
+ onSelect = _ref.onSelect,
10806
+ onExpanderClick = _ref.onExpanderClick;
10449
10807
  var wrapperRef = react.useRef(null);
10450
10808
  var taskListRef = react.useRef(null);
10451
10809
  var _useState = react.useState(function () {
10452
- var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates),
10453
- startDate = _ganttDateRange[0],
10454
- endDate = _ganttDateRange[1];
10810
+ var _ganttDateRangeFromTa = ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10811
+ startDate = _ganttDateRangeFromTa[0],
10812
+ endDate = _ganttDateRangeFromTa[1];
10455
10813
  return {
10456
10814
  viewMode: viewMode,
10457
10815
  dates: seedDates(startDate, endDate, viewMode)
@@ -10505,6 +10863,19 @@ var Gantt = function Gantt(_ref) {
10505
10863
  var _useState12 = react.useState(false),
10506
10864
  ignoreScrollEvent = _useState12[0],
10507
10865
  setIgnoreScrollEvent = _useState12[1];
10866
+ var _useState13 = react.useState(),
10867
+ currentDateIndicatorContent = _useState13[0],
10868
+ setCurrentDateIndicatorContent = _useState13[1];
10869
+ var _useState14 = react.useState(),
10870
+ projectionContent = _useState14[0],
10871
+ setProjectionContent = _useState14[1];
10872
+ react.useEffect(function () {
10873
+ window.addEventListener("gantt-sync-scroll-event", function (e) {
10874
+ if (e.detail.id !== id) {
10875
+ setScrollX(e.detail.scrollX);
10876
+ }
10877
+ });
10878
+ }, [id]);
10508
10879
  react.useEffect(function () {
10509
10880
  var filteredTasks;
10510
10881
  if (onExpanderClick) {
@@ -10513,9 +10884,9 @@ var Gantt = function Gantt(_ref) {
10513
10884
  filteredTasks = tasks;
10514
10885
  }
10515
10886
  filteredTasks = filteredTasks.sort(sortTasks);
10516
- var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount, showSecondaryDates),
10517
- startDate = _ganttDateRange2[0],
10518
- endDate = _ganttDateRange2[1];
10887
+ var _ganttDateRangeFromTa2 = ganttDateRangeFromTask(filteredTasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10888
+ startDate = _ganttDateRangeFromTa2[0],
10889
+ endDate = _ganttDateRangeFromTa2[1];
10519
10890
  var newDates = seedDates(startDate, endDate, viewMode);
10520
10891
  if (rtl) {
10521
10892
  newDates = newDates.reverse();
@@ -10528,7 +10899,7 @@ var Gantt = function Gantt(_ref) {
10528
10899
  viewMode: viewMode
10529
10900
  });
10530
10901
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, projectHeight, timelineHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, showSecondaryDates));
10531
- }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick]);
10902
+ }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick, showSecondaryDates, projectHeight, timelineHeight, displayedStartDate, displayedEndDate]);
10532
10903
  react.useEffect(function () {
10533
10904
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
10534
10905
  var dates = dateSetup.dates;
@@ -10640,11 +11011,20 @@ var Gantt = function Gantt(_ref) {
10640
11011
  if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
10641
11012
  setScrollX(event.currentTarget.scrollLeft);
10642
11013
  setIgnoreScrollEvent(true);
11014
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11015
+ detail: {
11016
+ componentId: id,
11017
+ scrollX: event.currentTarget.scrollLeft
11018
+ }
11019
+ }));
10643
11020
  } else {
10644
11021
  setIgnoreScrollEvent(false);
10645
11022
  }
10646
11023
  };
10647
11024
  var handleKeyDown = function handleKeyDown(event) {
11025
+ if (event.target.tagName === "INPUT") {
11026
+ return;
11027
+ }
10648
11028
  event.preventDefault();
10649
11029
  var newScrollY = scrollY;
10650
11030
  var newScrollX = scrollX;
@@ -10676,6 +11056,12 @@ var Gantt = function Gantt(_ref) {
10676
11056
  newScrollX = svgWidth;
10677
11057
  }
10678
11058
  setScrollX(newScrollX);
11059
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11060
+ detail: {
11061
+ componentId: id,
11062
+ scrollX: newScrollX
11063
+ }
11064
+ }));
10679
11065
  } else {
10680
11066
  if (newScrollY < 0) {
10681
11067
  newScrollY = 0;
@@ -10686,6 +11072,29 @@ var Gantt = function Gantt(_ref) {
10686
11072
  }
10687
11073
  setIgnoreScrollEvent(true);
10688
11074
  };
11075
+ react.useEffect(function () {
11076
+ var x = calculateCurrentDateCalculator(dateSetup.dates, columnWidth);
11077
+ if (x !== 0) {
11078
+ setCurrentDateIndicatorContent({
11079
+ color: todayColor,
11080
+ x: x
11081
+ });
11082
+ }
11083
+ }, [columnWidth, dateSetup.dates, todayColor]);
11084
+ react.useEffect(function () {
11085
+ if (projection) {
11086
+ var _calculateProjection = calculateProjection(projection.start, projection.end, dateSetup.dates, columnWidth),
11087
+ x0 = _calculateProjection.x0,
11088
+ xf = _calculateProjection.xf;
11089
+ setProjectionContent({
11090
+ x0: x0,
11091
+ xf: xf,
11092
+ color: projection.color
11093
+ });
11094
+ } else {
11095
+ setProjectionContent(undefined);
11096
+ }
11097
+ }, [columnWidth, dateSetup.dates, projection]);
10689
11098
  var handleSelectedTask = function handleSelectedTask(taskId) {
10690
11099
  var newSelectedTask = barTasks.find(function (t) {
10691
11100
  return t.id === taskId;
@@ -10729,7 +11138,8 @@ var Gantt = function Gantt(_ref) {
10729
11138
  fontSize: fontSize,
10730
11139
  rtl: rtl,
10731
11140
  dateTimeFormatters: dateTimeFormatters,
10732
- singleLineHeader: singleLineHeader
11141
+ singleLineHeader: singleLineHeader,
11142
+ currentDateIndicator: currentDateIndicatorContent
10733
11143
  };
10734
11144
  var barProps = {
10735
11145
  tasks: barTasks,
@@ -10746,6 +11156,11 @@ var Gantt = function Gantt(_ref) {
10746
11156
  arrowIndent: arrowIndent,
10747
11157
  svgWidth: svgWidth,
10748
11158
  rtl: rtl,
11159
+ hideLabel: hideLabel,
11160
+ showSecondaryDates: showSecondaryDates,
11161
+ ganttHeight: ganttHeight,
11162
+ currentDateIndicator: currentDateIndicatorContent,
11163
+ projection: projectionContent,
10749
11164
  setGanttEvent: setGanttEvent,
10750
11165
  setFailedTask: setFailedTask,
10751
11166
  setSelectedTask: handleSelectedTask,
@@ -10753,9 +11168,7 @@ var Gantt = function Gantt(_ref) {
10753
11168
  onProgressChange: onProgressChange,
10754
11169
  onDoubleClick: onDoubleClick,
10755
11170
  onClick: onClick,
10756
- onDelete: onDelete,
10757
- hideLabel: hideLabel,
10758
- showSecondaryDates: showSecondaryDates
11171
+ onDelete: onDelete
10759
11172
  };
10760
11173
  var tableProps = {
10761
11174
  rowHeight: rowHeight,
@@ -10818,195 +11231,6 @@ var Gantt = function Gantt(_ref) {
10818
11231
  }));
10819
11232
  };
10820
11233
 
10821
- var TimeUnit;
10822
- (function (TimeUnit) {
10823
- TimeUnit["DAY"] = "days";
10824
- TimeUnit["WEEK"] = "weeks";
10825
- TimeUnit["MONTH"] = "months";
10826
- TimeUnit["YEAR"] = "YEAR";
10827
- })(TimeUnit || (TimeUnit = {}));
10828
-
10829
- var parseToDayStart = function parseToDayStart(ymd) {
10830
- return luxon.DateTime.fromISO(ymd).toJSDate();
10831
- };
10832
- var parseToDayEnd = function parseToDayEnd(endDate) {
10833
- return luxon.DateTime.fromISO(endDate).plus({
10834
- seconds: 86400 - 1
10835
- }).toJSDate();
10836
- };
10837
- var formatToIsoDate = function formatToIsoDate(date) {
10838
- return luxon.DateTime.fromJSDate(date).toISODate();
10839
- };
10840
- var formatToLocaleSimple = function formatToLocaleSimple(date) {
10841
- return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
10842
- };
10843
- function validDates(startDate, endDate, name) {
10844
- var _start;
10845
- var start = parseToDayStart(startDate);
10846
- var end = parseToDayEnd(endDate);
10847
- if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
10848
- start = parseToDayStart(endDate);
10849
- console.log("time-converters.ts validDates() Error date", {
10850
- name: name,
10851
- start: startDate,
10852
- end: endDate
10853
- });
10854
- }
10855
- return {
10856
- start: start,
10857
- end: end
10858
- };
10859
- }
10860
-
10861
- var toViewMode = function toViewMode(timeUnit) {
10862
- switch (timeUnit) {
10863
- case TimeUnit.DAY:
10864
- return ViewMode.Day;
10865
- case TimeUnit.WEEK:
10866
- return ViewMode.Week;
10867
- case TimeUnit.MONTH:
10868
- return ViewMode.Month;
10869
- case TimeUnit.YEAR:
10870
- return ViewMode.Year;
10871
- }
10872
- };
10873
- var convertPhaseToTask = function convertPhaseToTask(item) {
10874
- var mapPhase = function mapPhase(_ref) {
10875
- var phaseStart = _ref.startDate,
10876
- phaseEnd = _ref.endDate,
10877
- secondaryStartDate = _ref.secondaryStartDate,
10878
- secondaryEndDate = _ref.secondaryEndDate,
10879
- phaseName = _ref.name,
10880
- phaseId = _ref.id,
10881
- color = _ref.color,
10882
- selectedColor = _ref.selectedColor,
10883
- dependencies = _ref.dependencies;
10884
- var _validDates = validDates(phaseStart, phaseEnd, phaseName),
10885
- start = _validDates.start,
10886
- end = _validDates.end;
10887
- var _validDates2 = validDates(secondaryStartDate, secondaryEndDate, phaseName),
10888
- phaseStart2 = _validDates2.start,
10889
- phaseEnd2 = _validDates2.end;
10890
- return {
10891
- start: start,
10892
- end: end,
10893
- secondaryStart: phaseStart2,
10894
- secondaryEnd: phaseEnd2,
10895
- name: phaseName,
10896
- valuesToShow: item.valuesToShow,
10897
- id: phaseId,
10898
- type: "task",
10899
- progress: 100,
10900
- dependencies: dependencies,
10901
- styles: color ? {
10902
- backgroundColor: color,
10903
- progressColor: color,
10904
- backgroundSelectedColor: selectedColor,
10905
- progressSelectedColor: selectedColor
10906
- } : {}
10907
- };
10908
- };
10909
- return mapPhase(item);
10910
- };
10911
- var convertDetailToTimeline = function convertDetailToTimeline(item) {
10912
- var id = item.id,
10913
- name = item.name,
10914
- schedule = item.schedule;
10915
- var convertToFrame = function convertToFrame(x) {
10916
- var startDate = x.startDate,
10917
- endDate = x.endDate,
10918
- color = x.color,
10919
- selectedColor = x.selectedColor;
10920
- var _validDates3 = validDates(startDate, endDate, "time frame"),
10921
- start = _validDates3.start,
10922
- end = _validDates3.end;
10923
- return {
10924
- start: start,
10925
- end: end,
10926
- backgroundColor: color != null ? color : "0xffffff",
10927
- backgroundSelectedColor: selectedColor != null ? selectedColor : color
10928
- };
10929
- };
10930
- var defaultColor = "#595959";
10931
- return {
10932
- id: id,
10933
- type: "timeline",
10934
- timeline: schedule.map(convertToFrame),
10935
- name: name,
10936
- valuesToShow: item.valuesToShow,
10937
- start: new Date(),
10938
- end: new Date(),
10939
- progress: 100,
10940
- styles: {
10941
- backgroundColor: defaultColor,
10942
- progressColor: defaultColor,
10943
- backgroundSelectedColor: defaultColor,
10944
- progressSelectedColor: defaultColor
10945
- }
10946
- };
10947
- };
10948
- var convertProjectToTasks = function convertProjectToTasks(_ref2) {
10949
- var id = _ref2.id,
10950
- name = _ref2.name,
10951
- valuesToShow = _ref2.valuesToShow,
10952
- startDate = _ref2.startDate,
10953
- endDate = _ref2.endDate,
10954
- phases = _ref2.phases,
10955
- details = _ref2.details,
10956
- secondaryStartDate = _ref2.secondaryStartDate,
10957
- secondaryEndDate = _ref2.secondaryEndDate;
10958
- var _validDates4 = validDates(startDate, endDate, name),
10959
- start = _validDates4.start,
10960
- end = _validDates4.end;
10961
- var _validDates5 = validDates(secondaryStartDate, secondaryEndDate, name),
10962
- start2 = _validDates5.start,
10963
- end2 = _validDates5.end;
10964
- var mainTask = {
10965
- start: start,
10966
- end: end,
10967
- id: id,
10968
- name: name,
10969
- valuesToShow: valuesToShow,
10970
- secondaryStart: start2,
10971
- secondaryEnd: end2,
10972
- type: "project",
10973
- progress: 100,
10974
- isDisabled: false,
10975
- hideChildren: false
10976
- };
10977
- var children1 = (phases != null ? phases : []).map(convertPhaseToTask);
10978
- var children2 = (details != null ? details : []).map(convertDetailToTimeline);
10979
- return [mainTask].concat(children1, children2);
10980
- };
10981
- var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref3) {
10982
- var id = _ref3.id,
10983
- start = _ref3.start,
10984
- end = _ref3.end;
10985
- return projects.map(function (project) {
10986
- return project.id === id ? withNewDates(project, start, end) : project;
10987
- });
10988
- };
10989
- var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref4) {
10990
- var id = _ref4.id,
10991
- start = _ref4.start,
10992
- end = _ref4.end;
10993
- if (phases) {
10994
- return phases.map(function (phase) {
10995
- return phase.id === id ? withNewDates(phase, start, end) : phase;
10996
- });
10997
- }
10998
- return undefined;
10999
- };
11000
- var withNewDates = function withNewDates(p, start, end) {
11001
- var startDate = formatToIsoDate(start);
11002
- var endDate = formatToIsoDate(end);
11003
- var extra = {
11004
- startDate: startDate,
11005
- endDate: endDate
11006
- };
11007
- return _extends({}, p, extra);
11008
- };
11009
-
11010
11234
  var cachedFormats = {};
11011
11235
  var getOrBuildCachedFormat = function getOrBuildCachedFormat(locale, options) {
11012
11236
  var _cachedFormats$key;
@@ -11019,8 +11243,8 @@ var format = function format(date, locale, options) {
11019
11243
  var format1 = getOrBuildCachedFormat(locale, options).format(date);
11020
11244
  return format1;
11021
11245
  } catch (e) {
11022
- console.log("time-formatters.ts format", date, locale, options);
11023
- console.log(e);
11246
+ console.error("time-formatters.ts format", date, locale, options);
11247
+ console.error(e);
11024
11248
  }
11025
11249
  };
11026
11250
  var dayFormatter = function dayFormatter(date, locale) {
@@ -11043,120 +11267,23 @@ var ganttDateTimeFormatters = {
11043
11267
  month: monthFormatter
11044
11268
  };
11045
11269
 
11046
- var _excluded = ["projects", "timeUnit", "TooltipContent", "TaskListHeader", "TaskListTable", "onDateChange", "onClick", "stylingOptions"];
11047
- var locale = "it-IT";
11048
- var GanttByTask = function GanttByTask(_ref) {
11049
- var _stylingOptions$preSt, _DateTime$now$minus;
11050
- var _ref$projects = _ref.projects,
11051
- projects = _ref$projects === void 0 ? [] : _ref$projects,
11052
- _ref$timeUnit = _ref.timeUnit,
11053
- timeUnit = _ref$timeUnit === void 0 ? TimeUnit.DAY : _ref$timeUnit,
11054
- TooltipContent = _ref.TooltipContent,
11055
- TaskListHeader = _ref.TaskListHeader,
11056
- TaskListTable = _ref.TaskListTable,
11057
- onDateChange = _ref.onDateChange,
11058
- onClick = _ref.onClick,
11059
- _ref$stylingOptions = _ref.stylingOptions,
11060
- stylingOptions = _ref$stylingOptions === void 0 ? {} : _ref$stylingOptions,
11061
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
11062
- var _useState = react.useState(projects),
11063
- currentProjects = _useState[0],
11064
- setCurrentProjects = _useState[1];
11065
- react.useEffect(function () {
11066
- if (projects) setCurrentProjects(projects);
11067
- }, [projects]);
11068
- var _useState2 = react.useState(1),
11069
- key = _useState2[0],
11070
- setKey = _useState2[1];
11071
- var tasks = react.useMemo(function () {
11072
- setKey(function (k) {
11073
- return k + 1;
11074
- });
11075
- return currentProjects.flatMap(convertProjectToTasks);
11076
- }, [currentProjects]);
11077
- var getProjectById = function getProjectById(id) {
11078
- return currentProjects.find(function (p) {
11079
- return p.id === id;
11080
- });
11081
- };
11082
- var handleClick = function handleClick(task) {
11083
- var id = task === null || task === void 0 ? void 0 : task.id;
11084
- console.log("gantt-by-task.tsx onClick", id);
11085
- var project = getProjectById(id);
11086
- if (project) onClick === null || onClick === void 0 ? void 0 : onClick(project);
11087
- var phase = currentProjects.flatMap(function (p) {
11088
- return p.phases;
11089
- }).find(function (ph) {
11090
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11091
- });
11092
- if (phase) onClick === null || onClick === void 0 ? void 0 : onClick(phase);
11093
- };
11094
- var handleDateChange = function handleDateChange(task) {
11095
- var id = task === null || task === void 0 ? void 0 : task.id;
11096
- console.log("gantt-by-task.tsx onDateChange", id);
11097
- var project = getProjectById(id);
11098
- if (project) {
11099
- var result = mergeTaskIntoProjects(currentProjects, task);
11100
- setCurrentProjects(result);
11101
- var _project = result.find(function (p) {
11102
- return p.id === id;
11103
- });
11104
- if (_project) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(_project);
11105
- return;
11106
- }
11107
- var parentOfClickedPhase = currentProjects.find(function (p) {
11108
- var _p$phases;
11109
- return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11110
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11111
- });
11112
- });
11113
- if (parentOfClickedPhase) {
11114
- var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11115
- var updatedProjects = currentProjects.map(function (p) {
11116
- return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11117
- phases: phases
11118
- }) : p;
11119
- });
11120
- setCurrentProjects(updatedProjects);
11121
- var phase = updatedProjects.flatMap(function (p) {
11122
- return p.phases;
11123
- }).find(function (ph) {
11124
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11125
- });
11126
- if (phase) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(phase);
11127
- }
11128
- };
11129
- var viewDate = luxon.DateTime.now().minus((_DateTime$now$minus = {}, _DateTime$now$minus[timeUnit] = (_stylingOptions$preSt = stylingOptions === null || stylingOptions === void 0 ? void 0 : stylingOptions.preStepsCount) != null ? _stylingOptions$preSt : 2, _DateTime$now$minus)).toJSDate();
11130
- console.log("gantt-by-task.tsx TASKS", tasks);
11131
- var returnElement = (tasks === null || tasks === void 0 ? void 0 : tasks.length) > 0 && react.createElement(Gantt, Object.assign({
11132
- key: key,
11133
- tasks: tasks,
11134
- locale: locale,
11135
- viewMode: toViewMode(timeUnit),
11136
- viewDate: viewDate,
11137
- onClick: handleClick,
11138
- onDateChange: handleDateChange,
11139
- TooltipContent: TooltipContent,
11140
- TaskListHeader: TaskListHeader,
11141
- TaskListTable: TaskListTable,
11142
- dateTimeFormatters: ganttDateTimeFormatters
11143
- }, stylingOptions, props));
11144
- if (returnElement) {
11145
- return returnElement;
11146
- } else {
11147
- return react.createElement("div", null);
11148
- }
11149
- };
11150
-
11151
- var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA"};
11270
+ var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA","filter":"_2cfRI"};
11152
11271
 
11153
- var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView) {
11154
- var CustomTaskListHeader = function CustomTaskListHeader() {
11272
+ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView, onFilterInput) {
11273
+ var CustomTaskListHeader = function CustomTaskListHeader(_ref) {
11274
+ var headerHeight = _ref.headerHeight,
11275
+ fontFamily = _ref.fontFamily,
11276
+ fontSize = _ref.fontSize;
11155
11277
  return react.createElement("div", {
11278
+ style: {
11279
+ fontFamily: fontFamily,
11280
+ fontSize: fontSize,
11281
+ height: headerHeight
11282
+ },
11156
11283
  className: classes$1.wrapper
11157
11284
  }, react.createElement("div", {
11158
11285
  className: classes$1.title
11159
- }, react.createElement("span", null, label)), react.createElement("div", {
11286
+ }, react.createElement("span", null, label)), setDoubleView && react.createElement("div", {
11160
11287
  className: classes$1.toggler
11161
11288
  }, react.createElement("label", {
11162
11289
  htmlFor: "ch2",
@@ -11173,12 +11300,21 @@ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView
11173
11300
  className: classes$1.slider
11174
11301
  })), react.createElement("span", {
11175
11302
  className: classes$1.label
11176
- }, "Mostra previsioni")));
11303
+ }, "Mostra previsioni")), react.createElement("div", {
11304
+ className: classes$1.filter
11305
+ }, react.createElement("input", {
11306
+ type: "text",
11307
+ name: "filter",
11308
+ size: 30,
11309
+ onInput: function onInput(e) {
11310
+ return onFilterInput === null || onFilterInput === void 0 ? void 0 : onFilterInput(e);
11311
+ }
11312
+ })));
11177
11313
  };
11178
11314
  return CustomTaskListHeader;
11179
11315
  };
11180
11316
 
11181
- var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW","timelineWrapper":"_1H4ue"};
11317
+ var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW"};
11182
11318
 
11183
11319
  var ProjectRow = function ProjectRow(_ref) {
11184
11320
  var _ref$task = _ref.task,
@@ -11204,7 +11340,7 @@ var ProjectRow = function ProjectRow(_ref) {
11204
11340
  "--grid-project-columns": str
11205
11341
  };
11206
11342
  return react.createElement("div", {
11207
- key: id,
11343
+ key: "task_" + id,
11208
11344
  className: styles$9.project,
11209
11345
  style: customStyle,
11210
11346
  onClick: function onClick() {
@@ -11215,7 +11351,7 @@ var ProjectRow = function ProjectRow(_ref) {
11215
11351
  return react.createElement("span", {
11216
11352
  className: index === 0 ? styles$9.main : undefined,
11217
11353
  title: v.length > 10 ? v : undefined,
11218
- key: id + "_valuesToShow_" + index
11354
+ key: "task_" + id + "_valuesToShow_" + index
11219
11355
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11220
11356
  }));
11221
11357
  };
@@ -11244,7 +11380,7 @@ var SubRow = function SubRow(_ref2) {
11244
11380
  "--grid-fasi-columns": str
11245
11381
  };
11246
11382
  return react.createElement("div", {
11247
- key: id,
11383
+ key: "phase_" + id,
11248
11384
  className: styles$9.subrow,
11249
11385
  style: customStyle,
11250
11386
  onClick: function onClick() {
@@ -11252,7 +11388,7 @@ var SubRow = function SubRow(_ref2) {
11252
11388
  onclickTaskList(id);
11253
11389
  }
11254
11390
  }, react.createElement("span", {
11255
- key: id + "_valuesToShow_color",
11391
+ key: "phase_" + id + "_valuesToShow_color",
11256
11392
  style: {
11257
11393
  height: 16,
11258
11394
  width: 16,
@@ -11262,41 +11398,42 @@ var SubRow = function SubRow(_ref2) {
11262
11398
  return react.createElement("span", {
11263
11399
  className: index === 0 ? styles$9.main : undefined,
11264
11400
  title: v.length > 10 ? v : undefined,
11265
- key: id + "_valuesToShow_" + index
11401
+ key: "phase_" + id + "_valuesToShow_" + index
11266
11402
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11267
11403
  }));
11268
11404
  };
11269
11405
  var TimelineSubRow = function TimelineSubRow(_ref3) {
11270
11406
  var _ref3$task = _ref3.task,
11271
11407
  id = _ref3$task.id,
11272
- name = _ref3$task.name,
11408
+ valuesToShow = _ref3$task.valuesToShow,
11273
11409
  rowHeight = _ref3.rowHeight,
11274
11410
  rowWidth = _ref3.rowWidth,
11275
11411
  fontFamily = _ref3.fontFamily,
11276
11412
  fontSize = _ref3.fontSize;
11413
+ var str = "";
11414
+ for (var i = 0; i < valuesToShow.length; i++) {
11415
+ str += "1fr ";
11416
+ }
11417
+ var customStyle = {
11418
+ height: rowHeight,
11419
+ width: rowWidth,
11420
+ fontFamily: fontFamily,
11421
+ fontSize: fontSize,
11422
+ "--grid-fasi-columns": str
11423
+ };
11277
11424
  return react.createElement("div", {
11278
- key: id,
11279
- className: styles$9.timelineWrapper,
11280
- style: {
11281
- height: rowHeight,
11282
- width: rowWidth,
11283
- fontFamily: fontFamily,
11284
- fontSize: fontSize
11285
- }
11286
- }, react.createElement("div", {
11425
+ key: "detail_" + id,
11287
11426
  className: styles$9.timeline,
11288
- style: {
11289
- height: rowHeight - 5
11290
- }
11291
- }, react.createElement("span", {
11292
- key: id + "_valuesToShow_0"
11293
- }, name), react.createElement("span", {
11294
- key: id + "_valuesToShow_1"
11295
- }, "A"), react.createElement("span", {
11296
- key: id + "_valuesToShow_2"
11297
- }, "A")));
11427
+ style: customStyle
11428
+ }, valuesToShow === null || valuesToShow === void 0 ? void 0 : valuesToShow.map(function (v, index) {
11429
+ return react.createElement("span", {
11430
+ className: index === 0 ? styles$9.main : undefined,
11431
+ title: v.length > 10 ? v : undefined,
11432
+ key: "detail_" + id + "_valuesToShow_" + index
11433
+ }, v);
11434
+ }));
11298
11435
  };
11299
- var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11436
+ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id) {
11300
11437
  var CustomTaskListTable = function CustomTaskListTable(_ref4) {
11301
11438
  var rowHeight = _ref4.rowHeight,
11302
11439
  rowWidth = _ref4.rowWidth,
@@ -11305,9 +11442,12 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11305
11442
  tasks = _ref4.tasks,
11306
11443
  setSelectedTask = _ref4.setSelectedTask;
11307
11444
  return react.createElement("div", {
11308
- className: styles$9.container
11445
+ className: styles$9.container,
11446
+ key: "tasks_container_" + id
11309
11447
  }, tasks.map(function (task) {
11310
- return react.createElement(react.Fragment, null, task.type === "project" && react.createElement(ProjectRow, {
11448
+ return react.createElement(react.Fragment, {
11449
+ key: task.id
11450
+ }, task.type === "project" && react.createElement(ProjectRow, {
11311
11451
  key: task.id + "_" + task.type,
11312
11452
  task: task,
11313
11453
  rowHeight: rowHeight,
@@ -11392,49 +11532,258 @@ var Switcher = function Switcher(_ref) {
11392
11532
  };
11393
11533
 
11394
11534
  var Planner = function Planner(props) {
11395
- var _props$showSecondaryD, _props$taskListHeader, _props$taskListTableP, _props$tooltipContent;
11535
+ var _props$secondaryGantt, _props$mainGantt$show, _props$mainGantt$task, _props$mainGantt$task2, _props$mainGantt$tool, _props$secondaryGantt3, _props$secondaryGantt4, _props$secondaryGantt5, _props$secondaryGantt6;
11396
11536
  var _useState = react.useState(TimeUnit.MONTH),
11397
11537
  timeUnit = _useState[0],
11398
11538
  setTimeUnit = _useState[1];
11399
- var _useState2 = react.useState((_props$showSecondaryD = props.showSecondaryDates) != null ? _props$showSecondaryD : false),
11400
- doubleView = _useState2[0],
11401
- setDoubleView = _useState2[1];
11402
- var commonProps = {
11403
- hideLabel: props.hideLabel,
11404
- showSecondaryDates: doubleView,
11405
- ganttHeight: props.ganttHeight,
11406
- hideDependencies: props.hideDependencies
11539
+ var _useState2 = react.useState(props.mainGantt.items),
11540
+ currentTasks = _useState2[0],
11541
+ setCurrentTasks = _useState2[1];
11542
+ var _useState3 = react.useState((_props$secondaryGantt = props.secondaryGantt) === null || _props$secondaryGantt === void 0 ? void 0 : _props$secondaryGantt.items),
11543
+ currentDetails = _useState3[0],
11544
+ setCurrentDetails = _useState3[1];
11545
+ var _useState4 = react.useState((_props$mainGantt$show = props.mainGantt.showSecondaryDates) != null ? _props$mainGantt$show : false),
11546
+ mainGanttDoubleView = _useState4[0],
11547
+ setMainGanttDoubleView = _useState4[1];
11548
+ var _useState5 = react.useState(calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount)),
11549
+ displayedDates = _useState5[0],
11550
+ setDisplayedDates = _useState5[1];
11551
+ var _useState6 = react.useState(),
11552
+ viewDate = _useState6[0],
11553
+ setViewDate = _useState6[1];
11554
+ var _useState7 = react.useState(),
11555
+ projection = _useState7[0],
11556
+ setProjection = _useState7[1];
11557
+ var locale = "it-IT";
11558
+ var onFilterInput = function onFilterInput(e) {
11559
+ console.log("PLANNER onFilterInput", e);
11407
11560
  };
11408
- console.log("planner.tsx commonProps", commonProps);
11409
- return react.createElement("div", {
11410
- style: {
11411
- maxWidth: "90vw"
11561
+ var handleClick = function handleClick(row, onClick) {
11562
+ if (!row) {
11563
+ return;
11564
+ }
11565
+ if (row.type === "task" && props.secondaryGantt) {
11566
+ var _phase$color;
11567
+ var phase = row;
11568
+ setProjection({
11569
+ start: new Date(phase.startDate),
11570
+ end: new Date(phase.endDate),
11571
+ color: (_phase$color = phase.color) != null ? _phase$color : "#ED7D31"
11572
+ });
11573
+ } else {
11574
+ setProjection(undefined);
11575
+ }
11576
+ onClick === null || onClick === void 0 ? void 0 : onClick(row);
11577
+ };
11578
+ var handleDateChange = function handleDateChange(task, currentProjects, onDateChange) {
11579
+ var id = task === null || task === void 0 ? void 0 : task.id;
11580
+ if (!id) {
11581
+ return;
11582
+ }
11583
+ var row = getProjectById(id, currentProjects);
11584
+ if (!row) {
11585
+ row = getPhaseById(id, currentProjects);
11586
+ }
11587
+ if (!row) {
11588
+ return;
11589
+ }
11590
+ if (row.type === "timeline") {
11591
+ console.log("planner.tsx onDateChange for timeline not managed yet", id, row.type);
11592
+ return;
11593
+ }
11594
+ if (row.type === "project") {
11595
+ var result = mergeTaskIntoProjects(currentProjects, task);
11596
+ row = getProjectById(row.id, result);
11597
+ setViewDate(task.start);
11598
+ setCurrentTasks(result);
11599
+ } else if (row.type === "task") {
11600
+ var parentOfClickedPhase = currentProjects.find(function (p) {
11601
+ var _p$phases;
11602
+ return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11603
+ return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11604
+ });
11605
+ });
11606
+ if (parentOfClickedPhase) {
11607
+ var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11608
+ var updatedProjects = currentProjects.map(function (p) {
11609
+ return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11610
+ phases: phases
11611
+ }) : p;
11612
+ });
11613
+ row = getPhaseById(row.id, updatedProjects);
11614
+ if (props.secondaryGantt && row) {
11615
+ var _row$color;
11616
+ setProjection({
11617
+ start: new Date(row.startDate),
11618
+ end: new Date(row.endDate),
11619
+ color: (_row$color = row.color) != null ? _row$color : "#ED7D31"
11620
+ });
11621
+ }
11622
+ setViewDate(task.start);
11623
+ setCurrentTasks(updatedProjects);
11624
+ }
11625
+ }
11626
+ onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(row);
11627
+ };
11628
+ react.useEffect(function () {
11629
+ var _props$secondaryGantt2;
11630
+ setCurrentTasks(props.mainGantt.items);
11631
+ setCurrentDetails((_props$secondaryGantt2 = props.secondaryGantt) === null || _props$secondaryGantt2 === void 0 ? void 0 : _props$secondaryGantt2.items);
11632
+ setProjection(undefined);
11633
+ }, [props]);
11634
+ react.useEffect(function () {
11635
+ var dates = calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount);
11636
+ setDisplayedDates(dates);
11637
+ if (!viewDate) {
11638
+ setViewDate(dates.displayedStartDate);
11639
+ }
11640
+ }, [currentTasks, currentDetails]);
11641
+ var tasks = [];
11642
+ for (var i = 0; i < currentTasks.length; i++) {
11643
+ tasks.push.apply(tasks, convertProjectToTasks(currentTasks[i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11644
+ }
11645
+ var details = [];
11646
+ if (currentDetails) {
11647
+ for (var _i = 0; _i < currentDetails.length; _i++) {
11648
+ details.push.apply(details, convertProjectToTasks(currentDetails[_i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11412
11649
  }
11413
- }, react.createElement(Switcher, {
11650
+ }
11651
+ return react.createElement("div", null, react.createElement(Switcher, {
11414
11652
  onTimeUnitChange: function onTimeUnitChange(timeUnit) {
11415
11653
  return setTimeUnit(timeUnit);
11416
11654
  }
11417
- }), react.createElement(GanttByTask, Object.assign({}, commonProps, {
11418
- projects: props.items,
11419
- timeUnit: timeUnit,
11420
- stylingOptions: props.stylingOptions,
11421
- onClick: function onClick(row) {
11422
- var _props$onClick;
11423
- return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, row);
11655
+ }), react.createElement("div", {
11656
+ style: {
11657
+ display: "flex",
11658
+ flexDirection: "column"
11659
+ }
11660
+ }, react.createElement(Gantt, Object.assign({
11661
+ id: "main",
11662
+ key: "main",
11663
+ hideLabel: props.mainGantt.hideLabel,
11664
+ showSecondaryDates: mainGanttDoubleView,
11665
+ hideDependencies: props.mainGantt.hideDependencies,
11666
+ ganttHeight: props.mainGantt.ganttHeight,
11667
+ displayedStartDate: displayedDates.displayedStartDate,
11668
+ displayedEndDate: displayedDates.displayedEndDate,
11669
+ viewDate: viewDate,
11670
+ tasks: tasks,
11671
+ viewMode: toViewMode(timeUnit)
11672
+ }, props.mainGantt.stylingOptions, {
11673
+ TaskListHeader: (_props$mainGantt$task = props.mainGantt.taskListHeaderProject) != null ? _props$mainGantt$task : CustomTaskListHeaderHOC(props.mainGantt.title, mainGanttDoubleView != null ? mainGanttDoubleView : false, setMainGanttDoubleView, onFilterInput),
11674
+ TaskListTable: (_props$mainGantt$task2 = props.mainGantt.taskListTableProject) != null ? _props$mainGantt$task2 : CustomTaskListTableHOC(function (id) {
11675
+ var row = getProjectById(id, currentTasks);
11676
+ if (!row) {
11677
+ row = getPhaseById(id, currentTasks);
11678
+ }
11679
+ if (row) {
11680
+ handleClick(row, props.mainGantt.onClick);
11681
+ }
11682
+ }, "main"),
11683
+ TooltipContent: (_props$mainGantt$tool = props.mainGantt.tooltipContent) != null ? _props$mainGantt$tool : CustomTooltipHOC(),
11684
+ onClick: function onClick(e) {
11685
+ var row = getProjectById(e.id, currentTasks);
11686
+ if (!row) {
11687
+ row = getPhaseById(e.id, currentTasks);
11688
+ }
11689
+ if (row) {
11690
+ handleClick(row, props.mainGantt.onClick);
11691
+ }
11424
11692
  },
11425
- onDateChange: function onDateChange(row) {
11426
- var _props$onDateChange;
11427
- return (_props$onDateChange = props.onDateChange) === null || _props$onDateChange === void 0 ? void 0 : _props$onDateChange.call(props, row);
11693
+ onDateChange: function onDateChange(e) {
11694
+ return handleDateChange(e, currentTasks, props.mainGantt.onDateChange);
11428
11695
  },
11429
- TaskListHeader: (_props$taskListHeader = props.taskListHeaderProject) != null ? _props$taskListHeader : CustomTaskListHeaderHOC(props.title, doubleView != null ? doubleView : true, setDoubleView),
11430
- TaskListTable: (_props$taskListTableP = props.taskListTableProject) != null ? _props$taskListTableP : CustomTaskListTableHOC(function (id) {
11431
- console.log("planner.tsx Clicked on " + id);
11432
- }),
11433
- TooltipContent: (_props$tooltipContent = props.tooltipContent) != null ? _props$tooltipContent : CustomTooltipHOC()
11434
- })));
11696
+ locale: locale,
11697
+ dateTimeFormatters: ganttDateTimeFormatters
11698
+ })), props.secondaryGantt && react.createElement(Gantt, Object.assign({
11699
+ id: "secondary",
11700
+ key: "secondary",
11701
+ hideLabel: props.secondaryGantt.hideLabel,
11702
+ showSecondaryDates: mainGanttDoubleView,
11703
+ hideDependencies: props.secondaryGantt.hideDependencies,
11704
+ ganttHeight: props.secondaryGantt.ganttHeight,
11705
+ displayedStartDate: displayedDates.displayedStartDate,
11706
+ displayedEndDate: displayedDates.displayedEndDate,
11707
+ viewDate: viewDate,
11708
+ tasks: details,
11709
+ viewMode: toViewMode(timeUnit)
11710
+ }, props.mainGantt.stylingOptions, {
11711
+ TaskListHeader: (_props$secondaryGantt3 = props.secondaryGantt.taskListHeaderProject) != null ? _props$secondaryGantt3 : CustomTaskListHeaderHOC(props.secondaryGantt.title, undefined, undefined, onFilterInput),
11712
+ TaskListTable: (_props$secondaryGantt4 = (_props$secondaryGantt5 = props.secondaryGantt) === null || _props$secondaryGantt5 === void 0 ? void 0 : _props$secondaryGantt5.taskListTableProject) != null ? _props$secondaryGantt4 : CustomTaskListTableHOC(function (id) {
11713
+ console.log("planner.tsx secondaryGantt Clicked on " + id);
11714
+ }, "secondary"),
11715
+ TooltipContent: (_props$secondaryGantt6 = props.secondaryGantt.tooltipContent) != null ? _props$secondaryGantt6 : CustomTooltipHOC(),
11716
+ projection: projection,
11717
+ onClick: function onClick(e) {
11718
+ if (props.secondaryGantt) {
11719
+ var row = getProjectById(e.id, currentDetails);
11720
+ if (row) {
11721
+ handleClick(row, props.secondaryGantt.onClick);
11722
+ }
11723
+ }
11724
+ },
11725
+ onDateChange: function onDateChange(e) {
11726
+ var _props$secondaryGantt7;
11727
+ return handleDateChange(e, currentDetails, (_props$secondaryGantt7 = props.secondaryGantt) === null || _props$secondaryGantt7 === void 0 ? void 0 : _props$secondaryGantt7.onDateChange);
11728
+ },
11729
+ locale: locale,
11730
+ dateTimeFormatters: ganttDateTimeFormatters
11731
+ }))));
11435
11732
  };
11436
11733
 
11437
- const kupPlannerCss = "._3_ygE{display:table;border-bottom:#e6e4e4 1px solid;border-top:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._1nBOt{display:table-row;list-style:none}._2eZzQ{border-right:1px solid rgb(196, 196, 196);opacity:1;margin-left:-2px}._WuQ0f{display:table-cell;vertical-align:-webkit-baseline-middle;vertical-align:middle}._3ZbQT{display:table;border-bottom:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._34SS0{display:table-row;text-overflow:ellipsis}._34SS0:nth-of-type(even){}._3lLk3{display:table-cell;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._nI1Xw{display:flex}._2QjE6{color:rgb(86 86 86);font-size:0.6rem;padding:0.15rem 0.2rem 0 0.2rem;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer}._2TfEi{font-size:0.6rem;padding-left:1rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3T42e{background:#fff;padding:12px;box-shadow:0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)}._29NTg{font-size:12px;margin-bottom:6px;color:#666}._25P-K{position:absolute;display:flex;flex-shrink:0;pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3gVAq{visibility:hidden;position:absolute;display:flex;pointer-events:none}._1eT-t{overflow:hidden auto;width:1rem;flex-shrink:0;scrollbar-width:thin}._1eT-t::-webkit-scrollbar{width:1.1rem;height:1.1rem}._1eT-t::-webkit-scrollbar-corner{background:transparent}._1eT-t::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._1eT-t::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._EvhC1{border-radius:8px;background:#efefef;margin:12px;padding:12px}._2dZTy{fill:#fff}._2dZTy:nth-child(even){}._3rUKi{stroke:transparent}._RuwuK{stroke:#e6e4e4}._9w8d5{text-anchor:middle;fill:#333;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._1rLuZ{stroke:#e6e4e4}._2q1Kt{text-anchor:middle;fill:#555;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._35nLX{fill:#ffffff;stroke:#e0e0e0;stroke-width:1.4}._KxSXS{cursor:pointer;outline:none}._KxSXS:hover ._3w_5u{visibility:visible;opacity:1}._3w_5u{fill:#ddd;cursor:ew-resize;opacity:0;visibility:hidden}._31ERP{-webkit-user-select:none;-moz-user-select:none;user-select:none;stroke-width:0}._3zRJQ{fill:#fff;text-anchor:middle;font-weight:lighter;dominant-baseline:central;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._3KcaM{fill:#555;text-anchor:start;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._11iN9{background:#efefef;border-radius:8px;margin:12px;overflow:hidden;padding:12px}._CZjuD{overflow:hidden;font-size:0;margin:0;padding:0}._2B2zv{margin:0;padding:0;overflow:hidden}._3eULf{display:flex;padding:0;margin:0;list-style:none;outline:none;position:relative}._2k9Ys{overflow:auto;max-width:100%;scrollbar-width:thin;height:1.2rem}._2k9Ys::-webkit-scrollbar{width:1.1rem;height:1.1rem}._2k9Ys::-webkit-scrollbar-corner{background:transparent}._2k9Ys::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._2k9Ys::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._19jgW{height:1px}._37E9D{display:flex;font-family:var(--kup-font-family, inherit);justify-content:space-around;max-width:330px;padding:16px 0;place-items:\"center\";text-align:center}._WrYI6{font-size:14px;font-weight:bold;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%}._c53zr{max-width:-moz-max-content;max-width:max-content;padding:0 4px;text-align:right;width:100%}._2eBO5{position:relative;display:inline-block;width:30px;height:17px}._hiyro{opacity:0;width:0;height:0}._hiyro:checked+._2HI58{background-color:#003b77}._hiyro:checked+._2HI58:before{transform:translateX(13px)}._hiyro:focus+._2HI58{box-shadow:0 0 1px #003b77}._2HI58{-webkit-transition:0.4s;cursor:pointer;background-color:#ccc;bottom:0;border-radius:17px;left:0;position:absolute;right:0;top:0;transition:0.4s}._2HI58:before{-webkit-transition:0.1s;background-color:white;border-radius:50%;bottom:2px;content:\"\";height:13px;left:2px;position:absolute;transition:0.1s;width:13px}._2gSdA{font-size:12px;padding:6px}._lEI6r{padding:0 10px;margin-right:10px}._RU6Aa{background:var(--kup-background-color, #ffffff);border:1px solid var(--kup-border-color, #acacac);border-radius:4px;box-sizing:border-box;color:var(--kup-text-color, #595959);cursor:pointer;display:grid;font-weight:400;grid-template-columns:var(--grid-project-columns, 1fr 1fr 1fr);place-items:center}._RU6Aa>*{font-size:14px;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}._RU6Aa ._30j6y{font-weight:700;width:100%;text-align:center}._T0HQN{cursor:pointer;display:grid;border-width:0 1px 1px 1px;border-style:solid;border-color:#acacac;border-bottom-left-radius:4px;border-bottom-right-radius:4px;grid-template-columns:var(--grid-fasi-columns, 1fr 1fr 1fr);place-items:center;background:#ffffff;color:#595959;font-weight:400}._T0HQN>*{font-size:12px;line-height:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%}._T0HQN:has(+._T0HQN),._RU6Aa:has(+._T0HQN){border-bottom-left-radius:0;border-bottom-right-radius:0}._yp2DW{cursor:pointer;display:grid;border-width:1px;border-style:solid;border-color:#cbcbcb;border-radius:4px;grid-template-columns:34% 33% 33%;place-items:center;background:#fff;color:#595959;font-weight:400}._yp2DW>*{font-size:12px;line-height:14px;overflow:hidden;text-overflow:ellipsis}._yp2DW>*:first-child{width:100%;white-space:nowrap;padding-left:5.5px}._1H4ue{background:#f2f2f2;padding:3px}._3P0WE{display:grid;grid-auto-flow:column;grid-gap:8px;margin-left:12px;width:-moz-max-content;width:max-content}._1oXbe{background:transparent;border-color:var(--kup-primary-color, #003b77);border-radius:4px;border-width:1px;box-shadow:0 3px 1px -2px rgba(var(--kup-text-color-rgb, 51 51 51), 0.2), 0 2px 2px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.14), 0 1px 5px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.12);box-sizing:border-box;color:var(--kup-primary-color, #003b77);cursor:pointer;font-size:11px;height:32px;min-width:64px}._1R9mh{font-family:var(--kup-font-family, inherit);font-size:11px;letter-spacing:0.0892857143em;text-decoration:none;text-transform:uppercase;padding:0 6px}:host{display:block}";
11734
+ const kupManager = kupManagerInstance();
11735
+ function sanitizeAllDates(startDateCell, endDateCell, secStartDateCell, secEndDateCell) {
11736
+ const sanitizedDateValues = sanitizeDates(startDateCell, endDateCell);
11737
+ let sanitizedSecDateValues = [];
11738
+ if (secStartDateCell && secEndDateCell) {
11739
+ if (isAtLeastOneDateValid(secStartDateCell, secEndDateCell)) {
11740
+ sanitizedSecDateValues = sanitizeDates(secStartDateCell, secEndDateCell);
11741
+ }
11742
+ else {
11743
+ sanitizedSecDateValues = [...sanitizedDateValues];
11744
+ }
11745
+ }
11746
+ return {
11747
+ dateValues: sanitizedDateValues,
11748
+ secDateValues: sanitizedSecDateValues,
11749
+ };
11750
+ }
11751
+ function sanitizeDates(startDateCell, endDateCell) {
11752
+ let returnValues = [startDateCell.value, endDateCell.value];
11753
+ if (isDateValid(startDateCell) && isDateValid(endDateCell)) {
11754
+ return returnValues;
11755
+ }
11756
+ else if (isDateValid(startDateCell)) {
11757
+ return [startDateCell.value, startDateCell.value];
11758
+ }
11759
+ else if (isDateValid(endDateCell)) {
11760
+ return [endDateCell.value, endDateCell.value];
11761
+ }
11762
+ else {
11763
+ return returnValues;
11764
+ }
11765
+ }
11766
+ function isDateValid(dateCell) {
11767
+ return (kupManager.objects.isDate(dateCell.obj) &&
11768
+ kupManager.dates.isValid(dateCell.value, KupDatesFormats.ISO_DATE));
11769
+ }
11770
+ function isAtLeastOneDateValid(startDateCell, endDateCell) {
11771
+ return isDateValid(startDateCell) || isDateValid(endDateCell);
11772
+ }
11773
+ function getValuesToShow(row, idCol, nameCol, dataColumns, columns, customToValuesFunction) {
11774
+ let toValuesFunction = () => columns.map((col) => {
11775
+ return getCellValueForDisplay(dataColumns.find((kCol) => kCol.name == col), row.cells[col]);
11776
+ });
11777
+ if (customToValuesFunction) {
11778
+ toValuesFunction = customToValuesFunction;
11779
+ }
11780
+ const valuesToShow = (columns === null || columns === void 0 ? void 0 : columns.length) >= 2
11781
+ ? toValuesFunction()
11782
+ : [row.cells[idCol].value, row.cells[nameCol].value];
11783
+ return valuesToShow;
11784
+ }
11785
+
11786
+ const kupPlannerCss = "._3_ygE{display:table;border-bottom:#e6e4e4 1px solid;border-top:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._1nBOt{display:table-row;list-style:none}._2eZzQ{border-right:1px solid rgb(196, 196, 196);opacity:1;margin-left:-2px}._WuQ0f{display:table-cell;vertical-align:-webkit-baseline-middle;vertical-align:middle}._3ZbQT{display:table;border-bottom:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._34SS0{display:table-row;text-overflow:ellipsis}._34SS0:nth-of-type(even){}._3lLk3{display:table-cell;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._nI1Xw{display:flex}._2QjE6{color:rgb(86 86 86);font-size:0.6rem;padding:0.15rem 0.2rem 0 0.2rem;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer}._2TfEi{font-size:0.6rem;padding-left:1rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3T42e{background:#fff;padding:12px;box-shadow:0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)}._29NTg{font-size:12px;margin-bottom:6px;color:#666}._25P-K{position:absolute;display:flex;flex-shrink:0;pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3gVAq{visibility:hidden;position:absolute;display:flex;pointer-events:none}._1eT-t{overflow:hidden auto;width:1rem;flex-shrink:0;scrollbar-width:thin}._1eT-t::-webkit-scrollbar{width:1.1rem;height:1.1rem}._1eT-t::-webkit-scrollbar-corner{background:transparent}._1eT-t::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._1eT-t::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._EvhC1{border-radius:8px;background:#efefef;margin:12px;padding:12px}._2dZTy{fill:#fff}._2dZTy:nth-child(even){}._3rUKi{stroke:transparent}._RuwuK{stroke:#e6e4e4}._9w8d5{text-anchor:middle;fill:#333;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._1rLuZ{stroke:#e6e4e4}._2q1Kt{text-anchor:middle;fill:#555;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._35nLX{fill:#ffffff;stroke:#e0e0e0;stroke-width:1.4}._KxSXS{cursor:pointer;outline:none}._KxSXS:hover ._3w_5u{visibility:visible;opacity:1}._3w_5u{fill:#ddd;cursor:ew-resize;opacity:0;visibility:hidden}._31ERP{-webkit-user-select:none;-moz-user-select:none;user-select:none;stroke-width:0}._3zRJQ{fill:#fff;text-anchor:middle;font-weight:lighter;dominant-baseline:central;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._3KcaM{fill:#555;text-anchor:start;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._11iN9{background:#efefef;border-radius:8px;margin:12px;overflow:hidden;padding:12px}._CZjuD{overflow:hidden;font-size:0;margin:0;padding:0}._2B2zv{margin:0;padding:0;overflow:hidden}._3eULf{display:flex;padding:0;margin:0;list-style:none;outline:none;position:relative}._2k9Ys{overflow:auto;max-width:100%;scrollbar-width:thin;height:1.2rem}._2k9Ys::-webkit-scrollbar{width:1.1rem;height:1.1rem}._2k9Ys::-webkit-scrollbar-corner{background:transparent}._2k9Ys::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._2k9Ys::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._19jgW{height:1px}._37E9D{display:flex;justify-content:space-around;max-width:330px;place-items:\"center\";text-align:center;align-items:center}._WrYI6{font-weight:bold;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._c53zr{max-width:-moz-max-content;max-width:max-content;padding:0 4px;text-align:right}._2eBO5{position:relative;display:inline-block;width:30px;height:17px}._hiyro{opacity:0;width:0;height:0}._hiyro:checked+._2HI58{background-color:#003b77}._hiyro:checked+._2HI58:before{transform:translateX(13px)}._hiyro:focus+._2HI58{box-shadow:0 0 1px #003b77}._2HI58{-webkit-transition:0.4s;cursor:pointer;background-color:#ccc;bottom:0;border-radius:17px;left:0;position:absolute;right:0;top:0;transition:0.4s}._2HI58:before{-webkit-transition:0.1s;background-color:white;border-radius:50%;bottom:2px;content:\"\";height:13px;left:2px;position:absolute;transition:0.1s;width:13px}._2gSdA{font-size:12px;padding:6px}._2cfRI{font-size:12px}._lEI6r{padding:0 10px;margin-right:10px}._RU6Aa{background:var(--kup-background-color, #ffffff);border:1px solid var(--kup-border-color, #acacac);border-radius:4px;box-sizing:border-box;color:var(--kup-text-color, #595959);cursor:pointer;display:grid;font-weight:400;grid-template-columns:var(--grid-project-columns, 1fr 1fr 1fr);place-items:center}._RU6Aa>*{font-size:14px;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}._RU6Aa ._30j6y{font-weight:700;width:100%;text-align:center}._T0HQN{cursor:pointer;display:grid;border-width:1px;border-style:solid;border-color:#acacac;border-bottom-left-radius:4px;border-bottom-right-radius:4px;box-sizing:border-box;grid-template-columns:var(--grid-fasi-columns, 1fr 1fr 1fr);place-items:center;background:#ffffff;color:#595959;font-weight:400}._T0HQN>*{font-size:12px;line-height:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%}._T0HQN:has(+._T0HQN),._RU6Aa:has(+._T0HQN){border-bottom-left-radius:0;border-bottom-right-radius:0}._yp2DW{cursor:pointer;display:grid;border-width:1px;border-style:solid;border-color:#cbcbcb;border-radius:4px;grid-template-columns:var(--grid-fasi-columns, 1fr 1fr 1fr);place-items:center;background:#fff;color:#595959;font-weight:400;box-sizing:border-box}._yp2DW>*{font-size:14px;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}._yp2DW ._30j6y{font-weight:700;width:100%;text-align:center}._3P0WE{display:grid;grid-auto-flow:column;grid-gap:8px;margin-left:12px;width:-moz-max-content;width:max-content}._1oXbe{background:transparent;border-color:var(--kup-primary-color, #003b77);border-radius:4px;border-width:1px;box-shadow:0 3px 1px -2px rgba(var(--kup-text-color-rgb, 51 51 51), 0.2), 0 2px 2px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.14), 0 1px 5px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.12);box-sizing:border-box;color:var(--kup-primary-color, #003b77);cursor:pointer;font-size:11px;height:32px;min-width:64px}._1R9mh{font-family:var(--kup-font-family, inherit);font-size:11px;letter-spacing:0.0892857143em;text-decoration:none;text-transform:uppercase;padding:0 6px}:host{display:block}";
11438
11787
 
11439
11788
  var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11440
11789
  if (kind === "a" && !f)
@@ -11452,7 +11801,7 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
11452
11801
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
11453
11802
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11454
11803
  };
11455
- var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase;
11804
+ var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_lastOnChangeReceived, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_toDetails, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase, _KupPlanner_handleOnClickOnDetail, _KupPlanner_emitOnChangeEventsReceived;
11456
11805
  const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
11457
11806
  constructor() {
11458
11807
  super();
@@ -11467,10 +11816,20 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11467
11816
  /*-------------------------------------------------*/
11468
11817
  _KupPlanner_kupManager.set(this, kupManagerInstance());
11469
11818
  _KupPlanner_rootPlanner.set(this, void 0);
11819
+ _KupPlanner_lastOnChangeReceived.set(this, void 0);
11470
11820
  this.plannerProps = undefined;
11471
11821
  this.customStyle = '';
11472
11822
  this.data = undefined;
11473
- this.dataRaw = undefined;
11823
+ this.detailData = undefined;
11824
+ this.detailColorCol = undefined;
11825
+ this.detailColumns = undefined;
11826
+ this.detailDates = undefined;
11827
+ this.detailHeight = undefined;
11828
+ this.detailIdCol = undefined;
11829
+ this.detailNameCol = undefined;
11830
+ this.detailPrevDates = undefined;
11831
+ this.listCellWidth = '300px';
11832
+ this.maxWidth = '90vw';
11474
11833
  this.phaseColorCol = undefined;
11475
11834
  this.phaseColumns = undefined;
11476
11835
  this.phaseColParDep = undefined;
@@ -11478,8 +11837,10 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11478
11837
  this.phaseIdCol = undefined;
11479
11838
  this.phaseNameCol = undefined;
11480
11839
  this.phasePrevDates = undefined;
11840
+ this.showSecondaryDates = false;
11481
11841
  this.taskColumns = undefined;
11482
11842
  this.taskDates = undefined;
11843
+ this.taskHeight = undefined;
11483
11844
  this.taskIdCol = undefined;
11484
11845
  this.taskNameCol = undefined;
11485
11846
  this.taskPrevDates = undefined;
@@ -11533,19 +11894,29 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11533
11894
  var _a;
11534
11895
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11535
11896
  if (task) {
11536
- task.phases = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
11897
+ 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) => {
11898
+ const datesSanitized = sanitizeAllDates(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]], row.cells[this.phasePrevDates[0]], row.cells[this.phasePrevDates[1]]);
11899
+ const valuesToShow = getValuesToShow(row, this.phaseIdCol, this.phaseNameCol, data.columns, this.phaseColumns, () => this.phaseColumns.map((col) => col == this.phaseDates[0]
11900
+ ? '#START#'
11901
+ : col == this.phaseDates[1]
11902
+ ? '#END#'
11903
+ : getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
11537
11904
  let phase = {
11538
- id: row.cells[this.phaseIdCol].value,
11905
+ taskRow: task.taskRow,
11906
+ phaseRow: row,
11907
+ id: task.id + '_' + row.cells[this.phaseIdCol].value,
11539
11908
  phaseRowId: row.id,
11540
11909
  taskRowId: task.taskRowId,
11541
11910
  name: row.cells[this.phaseNameCol].value,
11542
- startDate: row.cells[this.phaseDates[0]].value,
11543
- endDate: row.cells[this.phaseDates[1]].value,
11544
- secondaryStartDate: row.cells[this.phasePrevDates[0]].value,
11545
- secondaryEndDate: row.cells[this.phasePrevDates[1]].value,
11546
- type: 'phase',
11911
+ startDate: datesSanitized.dateValues[0],
11912
+ endDate: datesSanitized.dateValues[1],
11913
+ secondaryStartDate: datesSanitized.secDateValues[0],
11914
+ secondaryEndDate: datesSanitized.secDateValues[1],
11915
+ type: 'task',
11547
11916
  color: row.cells[this.phaseColorCol].value,
11548
- valuesToShow: this.phaseColumns.map((col) => row.cells[col].value),
11917
+ selectedColor: row.cells[this.phaseColorCol].value,
11918
+ valuesToShow: valuesToShow,
11919
+ rowType: KupPlannerGanttRowType.PHASE,
11549
11920
  };
11550
11921
  return phase;
11551
11922
  });
@@ -11554,8 +11925,8 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11554
11925
  }
11555
11926
  handleOnClick(nativeEvent) {
11556
11927
  console.log('handleOnClick', nativeEvent);
11557
- switch (nativeEvent.type) {
11558
- case 'task':
11928
+ switch (nativeEvent.rowType) {
11929
+ case KupPlannerGanttRowType.TASK:
11559
11930
  const taskAction = nativeEvent.phases
11560
11931
  ? KupPlannerTaskAction.onClosing
11561
11932
  : KupPlannerTaskAction.onOpening;
@@ -11563,28 +11934,57 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11563
11934
  this.onKupClick(nativeEvent, taskAction);
11564
11935
  }
11565
11936
  break;
11566
- case 'phase':
11937
+ case KupPlannerGanttRowType.PHASE:
11567
11938
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
11568
11939
  this.onKupClick(nativeEvent);
11569
11940
  }
11570
11941
  break;
11942
+ case KupPlannerGanttRowType.DETAIL:
11943
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
11944
+ this.onKupClick(nativeEvent);
11945
+ }
11946
+ break;
11571
11947
  }
11572
11948
  }
11573
11949
  handleOnDateChange(nativeEvent) {
11574
- console.log('handleOnDateChange', nativeEvent);
11575
- this.onKupDateChange(nativeEvent);
11950
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_emitOnChangeEventsReceived).call(this, nativeEvent)) {
11951
+ console.log('handleOnDateChange', nativeEvent);
11952
+ this.onKupDateChange(nativeEvent);
11953
+ }
11576
11954
  }
11577
11955
  componentWillLoad() {
11578
11956
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logLoad(this, false);
11579
11957
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.register(this);
11580
11958
  }
11581
11959
  componentDidLoad() {
11960
+ let details = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, this.detailData);
11961
+ if (details && details.length == 0) {
11962
+ details = undefined;
11963
+ }
11582
11964
  this.plannerProps = {
11583
- title: this.titleMess,
11584
- items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11585
- onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11586
- onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11965
+ mainGantt: {
11966
+ title: this.titleMess,
11967
+ items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11968
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11969
+ hideLabel: true,
11970
+ ganttHeight: this.taskHeight,
11971
+ showSecondaryDates: this.showSecondaryDates,
11972
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11973
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11974
+ },
11975
+ secondaryGantt: details
11976
+ ? {
11977
+ title: '',
11978
+ items: details,
11979
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11980
+ hideLabel: true,
11981
+ ganttHeight: this.detailHeight,
11982
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11983
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11984
+ }
11985
+ : undefined,
11587
11986
  };
11987
+ console.log('kup-planner.tsx componentDidLoad plannerProps', this.plannerProps);
11588
11988
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_renderReactPlannerElement).call(this);
11589
11989
  this.kupReady.emit({
11590
11990
  comp: this,
@@ -11600,7 +12000,8 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11600
12000
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logRender(this, true);
11601
12001
  }
11602
12002
  render() {
11603
- return (h(Host, null, h("div", { id: componentWrapperId })));
12003
+ //console.log('kup-planner.tsx render');
12004
+ return (h(Host, null, h("div", { id: componentWrapperId, style: { maxWidth: this.maxWidth } })));
11604
12005
  }
11605
12006
  disconnectedCallback() {
11606
12007
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.unregister(this);
@@ -11610,7 +12011,16 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11610
12011
  }, [1, "kup-planner", {
11611
12012
  "customStyle": [1, "custom-style"],
11612
12013
  "data": [16],
11613
- "dataRaw": [8, "data-raw"],
12014
+ "detailData": [16],
12015
+ "detailColorCol": [1, "detail-color-col"],
12016
+ "detailColumns": [16],
12017
+ "detailDates": [16],
12018
+ "detailHeight": [2, "detail-height"],
12019
+ "detailIdCol": [1, "detail-id-col"],
12020
+ "detailNameCol": [1, "detail-name-col"],
12021
+ "detailPrevDates": [16],
12022
+ "listCellWidth": [1, "list-cell-width"],
12023
+ "maxWidth": [1, "max-width"],
11614
12024
  "phaseColorCol": [1, "phase-color-col"],
11615
12025
  "phaseColumns": [16],
11616
12026
  "phaseColParDep": [1, "phase-col-par-dep"],
@@ -11618,8 +12028,10 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11618
12028
  "phaseIdCol": [1, "phase-id-col"],
11619
12029
  "phaseNameCol": [1, "phase-name-col"],
11620
12030
  "phasePrevDates": [16],
12031
+ "showSecondaryDates": [4, "show-secondary-dates"],
11621
12032
  "taskColumns": [16],
11622
12033
  "taskDates": [16],
12034
+ "taskHeight": [2, "task-height"],
11623
12035
  "taskIdCol": [1, "task-id-col"],
11624
12036
  "taskNameCol": [1, "task-name-col"],
11625
12037
  "taskPrevDates": [16],
@@ -11630,7 +12042,7 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
11630
12042
  "setProps": [64],
11631
12043
  "addPhases": [64]
11632
12044
  }]);
11633
- _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
12045
+ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_lastOnChangeReceived = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
11634
12046
  var _a;
11635
12047
  (_a = __classPrivateFieldGet(this, _KupPlanner_rootPlanner, "f")) === null || _a === void 0 ? void 0 : _a.unmount();
11636
12048
  const componentWrapperElement = this.rootElement.shadowRoot.getElementById(componentWrapperId);
@@ -11640,27 +12052,70 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11640
12052
  }
11641
12053
  }, _KupPlanner_toTasks = function _KupPlanner_toTasks(data) {
11642
12054
  var _a;
11643
- let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((value) => {
12055
+ let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.filter((row) => isAtLeastOneDateValid(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]])).map((row) => {
12056
+ const datesSanitized = sanitizeAllDates(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]], row.cells[this.taskPrevDates[0]], row.cells[this.taskPrevDates[1]]);
12057
+ const valuesToShow = getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns);
11644
12058
  let task = {
11645
- taskRowId: value.id,
11646
- id: value.cells[this.taskIdCol].value,
11647
- name: value.cells[this.taskNameCol].value,
11648
- startDate: value.cells[this.taskDates[0]].value,
11649
- endDate: value.cells[this.taskDates[1]].value,
11650
- secondaryStartDate: value.cells[this.taskPrevDates[0]].value,
11651
- secondaryEndDate: value.cells[this.taskPrevDates[1]].value,
11652
- type: 'task',
11653
- valuesToShow: this.taskColumns.map((col) => value.cells[col].value),
12059
+ taskRow: row,
12060
+ taskRowId: row.id,
12061
+ id: row.cells[this.taskIdCol].value,
12062
+ name: row.cells[this.taskNameCol].value,
12063
+ startDate: datesSanitized.dateValues[0],
12064
+ endDate: datesSanitized.dateValues[1],
12065
+ secondaryStartDate: datesSanitized.secDateValues[0],
12066
+ secondaryEndDate: datesSanitized.secDateValues[1],
12067
+ type: 'project',
12068
+ valuesToShow: valuesToShow,
12069
+ rowType: KupPlannerGanttRowType.TASK,
11654
12070
  };
11655
12071
  return task;
11656
12072
  });
11657
12073
  return tasks;
12074
+ }, _KupPlanner_toDetails = function _KupPlanner_toDetails(data) {
12075
+ let details = [];
12076
+ if (!data || !data.rows) {
12077
+ return details;
12078
+ }
12079
+ data.rows
12080
+ .filter((row) => isAtLeastOneDateValid(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]))
12081
+ .forEach((row) => {
12082
+ const detailId = row.cells[this.detailIdCol].value;
12083
+ const detailNameId = row.cells[this.detailNameCol].value;
12084
+ const datesSanitized = sanitizeAllDates(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]);
12085
+ const valuesToShow = getValuesToShow(row, this.detailIdCol, this.detailNameCol, data.columns, this.detailColumns);
12086
+ let detail = details.find((det) => det.id == detailId);
12087
+ if (!detail) {
12088
+ detail = {
12089
+ id: detailId,
12090
+ name: detailNameId,
12091
+ type: 'timeline',
12092
+ valuesToShow: valuesToShow,
12093
+ rowType: KupPlannerGanttRowType.DETAIL,
12094
+ schedule: [],
12095
+ };
12096
+ details.push(detail);
12097
+ }
12098
+ detail.schedule.push({
12099
+ startDate: datesSanitized.dateValues[0],
12100
+ endDate: datesSanitized.dateValues[1],
12101
+ color: this.detailColorCol
12102
+ ? row.cells[this.detailColorCol].value
12103
+ : '#D9D9D8',
12104
+ selectedColor: this.detailColorCol
12105
+ ? row.cells[this.detailColorCol].value
12106
+ : '#D9D9D8',
12107
+ });
12108
+ });
12109
+ return details;
11658
12110
  }, _KupPlanner_getTask = function _KupPlanner_getTask(taskId) {
11659
- return this.plannerProps.items.find((task) => task.id == taskId);
12111
+ return this.plannerProps.mainGantt.items.find((task) => task.id == taskId);
11660
12112
  }, _KupPlanner_removePhases = function _KupPlanner_removePhases(taskId) {
11661
12113
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11662
12114
  if (task)
11663
12115
  task.phases = undefined;
12116
+ // this.plannerProps.mainGantt = JSON.parse(
12117
+ // JSON.stringify(this.plannerProps.mainGantt)
12118
+ // );
11664
12119
  this.plannerProps = Object.assign({}, this.plannerProps);
11665
12120
  }, _KupPlanner_handleOnClickOnTask = function _KupPlanner_handleOnClickOnTask(nativeEvent) {
11666
12121
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, nativeEvent.id);
@@ -11670,6 +12125,19 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11670
12125
  return true;
11671
12126
  }, _KupPlanner_handleOnClickOnPhase = function _KupPlanner_handleOnClickOnPhase() {
11672
12127
  return true;
12128
+ }, _KupPlanner_handleOnClickOnDetail = function _KupPlanner_handleOnClickOnDetail() {
12129
+ return true;
12130
+ }, _KupPlanner_emitOnChangeEventsReceived = function _KupPlanner_emitOnChangeEventsReceived(nativeEvent) {
12131
+ let emitEvent = false;
12132
+ if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f")) {
12133
+ emitEvent = true;
12134
+ __classPrivateFieldSet(this, _KupPlanner_lastOnChangeReceived, new KupPlannerLastOnChangeReceived(nativeEvent), "f");
12135
+ }
12136
+ else if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f").isEquivalent(nativeEvent)) {
12137
+ __classPrivateFieldSet(this, _KupPlanner_lastOnChangeReceived, new KupPlannerLastOnChangeReceived(nativeEvent), "f");
12138
+ emitEvent = true;
12139
+ }
12140
+ return emitEvent;
11673
12141
  };
11674
12142
  function defineCustomElement$1() {
11675
12143
  if (typeof customElements === "undefined") {