@sme.up/ketchup 7.4.1 → 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 (125) hide show
  1. package/dist/cjs/{f-button-5856cd74.js → f-button-daddd700.js} +2 -2
  2. package/dist/cjs/{f-cell-9d7a9e97.js → f-cell-3682fad4.js} +6 -6
  3. package/dist/cjs/{f-checkbox-1148e791.js → f-checkbox-593f72c3.js} +1 -1
  4. package/dist/cjs/{f-chip-675ed121.js → f-chip-9d540d94.js} +3 -3
  5. package/dist/cjs/{f-image-48facc89.js → f-image-7b42d149.js} +2 -2
  6. package/dist/cjs/{f-paginator-utils-0c1227f6.js → f-paginator-utils-1baeba0f.js} +3 -3
  7. package/dist/cjs/{f-text-field-3d8e7417.js → f-text-field-a6ed2d22.js} +2 -2
  8. package/dist/cjs/{index-1f177abc.js → index-74433248.js} +3 -0
  9. package/dist/cjs/ketchup.cjs.js +3 -3
  10. package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
  11. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +9 -9
  12. package/dist/cjs/kup-box.cjs.entry.js +10 -10
  13. package/dist/cjs/kup-calendar.cjs.entry.js +5 -5
  14. package/dist/cjs/kup-cell.cjs.entry.js +7 -7
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +2 -2
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +6 -6
  18. package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
  19. package/dist/cjs/kup-echart.cjs.entry.js +2 -2
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +4 -4
  21. package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
  22. package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
  23. package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
  24. package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
  25. package/dist/cjs/{kup-manager-22bb9699.js → kup-manager-10351449.js} +1 -1
  26. package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
  27. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-photo-frame.cjs.entry.js +2 -2
  29. package/dist/cjs/kup-planner.cjs.entry.js +969 -544
  30. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
  33. package/dist/cjs/loader.cjs.js +3 -3
  34. package/dist/collection/collection-manifest.json +1 -1
  35. package/dist/collection/components/kup-planner/kup-planner-declarations.js +45 -14
  36. package/dist/collection/components/kup-planner/kup-planner-helper.js +54 -0
  37. package/dist/collection/components/kup-planner/kup-planner.css +16 -18
  38. package/dist/collection/components/kup-planner/kup-planner.js +424 -62
  39. package/dist/components/kup-autocomplete2.js +1 -1
  40. package/dist/components/kup-planner.js +968 -532
  41. package/dist/components/kup-progress-bar.js +1 -1
  42. package/dist/components/kup-radio.js +1 -1
  43. package/dist/components/kup-rating.js +1 -1
  44. package/dist/components/kup-spinner.js +1 -1
  45. package/dist/components/kup-switch.js +1 -1
  46. package/dist/components/kup-tab-bar.js +1 -1
  47. package/dist/components/kup-text-field.js +1 -1
  48. package/dist/components/kup-time-picker.js +1 -1
  49. package/dist/components/kup-tree.js +1 -1
  50. package/dist/esm/{f-button-eedbdba1.js → f-button-8d15b5a0.js} +2 -2
  51. package/dist/esm/{f-cell-90a418d2.js → f-cell-7b706e57.js} +6 -6
  52. package/dist/esm/{f-checkbox-9b3f5f5b.js → f-checkbox-ec85b437.js} +1 -1
  53. package/dist/esm/{f-chip-45e7b3f6.js → f-chip-c671fe90.js} +3 -3
  54. package/dist/esm/{f-image-3026f0fe.js → f-image-21451b15.js} +2 -2
  55. package/dist/esm/{f-paginator-utils-6369da7c.js → f-paginator-utils-92bbf277.js} +3 -3
  56. package/dist/esm/{f-text-field-3b70a6f0.js → f-text-field-0bb2d109.js} +2 -2
  57. package/dist/esm/{index-8bd38435.js → index-b326ffc9.js} +3 -1
  58. package/dist/esm/ketchup.js +4 -4
  59. package/dist/esm/kup-accordion.entry.js +3 -3
  60. package/dist/esm/kup-autocomplete_27.entry.js +9 -9
  61. package/dist/esm/kup-box.entry.js +10 -10
  62. package/dist/esm/kup-calendar.entry.js +5 -5
  63. package/dist/esm/kup-cell.entry.js +7 -7
  64. package/dist/esm/kup-dash-list.entry.js +2 -2
  65. package/dist/esm/kup-dash_2.entry.js +2 -2
  66. package/dist/esm/kup-dashboard.entry.js +6 -6
  67. package/dist/esm/kup-drawer.entry.js +2 -2
  68. package/dist/esm/kup-echart.entry.js +2 -2
  69. package/dist/esm/kup-family-tree.entry.js +4 -4
  70. package/dist/esm/kup-iframe.entry.js +2 -2
  71. package/dist/esm/kup-image-list.entry.js +8 -8
  72. package/dist/esm/kup-lazy.entry.js +2 -2
  73. package/dist/esm/kup-magic-box.entry.js +3 -3
  74. package/dist/esm/{kup-manager-cad802b1.js → kup-manager-6145d980.js} +1 -1
  75. package/dist/esm/kup-nav-bar.entry.js +2 -2
  76. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  77. package/dist/esm/kup-photo-frame.entry.js +2 -2
  78. package/dist/esm/kup-planner.entry.js +957 -532
  79. package/dist/esm/kup-probe.entry.js +2 -2
  80. package/dist/esm/kup-qlik.entry.js +2 -2
  81. package/dist/esm/kup-snackbar.entry.js +4 -4
  82. package/dist/esm/loader.js +4 -4
  83. package/dist/ketchup/ketchup.esm.js +1 -1
  84. package/dist/ketchup/p-02a26d59.entry.js +9 -0
  85. package/dist/ketchup/{p-1ad48de4.entry.js → p-0c1cbf8b.entry.js} +1 -1
  86. package/dist/ketchup/{p-97afbd71.entry.js → p-0c9b7c80.entry.js} +1 -1
  87. package/dist/ketchup/{p-138ac8b9.entry.js → p-1242366a.entry.js} +1 -1
  88. package/dist/ketchup/{p-fe34fa6e.entry.js → p-281cff81.entry.js} +1 -1
  89. package/dist/ketchup/{p-73becdb8.entry.js → p-2915a66a.entry.js} +1 -1
  90. package/dist/ketchup/{p-d0f4457e.entry.js → p-2a2dc2a8.entry.js} +1 -1
  91. package/dist/ketchup/{p-a89f0884.entry.js → p-32517a99.entry.js} +1 -1
  92. package/dist/ketchup/{p-eea29062.entry.js → p-439ac105.entry.js} +1 -1
  93. package/dist/ketchup/p-462475ac.entry.js +10 -0
  94. package/dist/ketchup/{p-9f1184cd.entry.js → p-4d039705.entry.js} +6 -6
  95. package/dist/ketchup/p-5292ef67.js +30 -0
  96. package/dist/ketchup/{p-263b2c73.entry.js → p-76bf53df.entry.js} +1 -1
  97. package/dist/ketchup/{p-a1adab40.js → p-7cfdce27.js} +1 -1
  98. package/dist/ketchup/{p-4505a48d.js → p-826c91d7.js} +1 -1
  99. package/dist/ketchup/p-849ad5d8.entry.js +1 -0
  100. package/dist/ketchup/{p-c1d8fd43.entry.js → p-89ac80c1.entry.js} +1 -1
  101. package/dist/ketchup/p-9f00ad0f.js +1 -0
  102. package/dist/ketchup/{p-23288eed.entry.js → p-a641780a.entry.js} +1 -1
  103. package/dist/ketchup/{p-32dc31ad.js → p-ae4fffe0.js} +1 -1
  104. package/dist/ketchup/p-be61dd36.entry.js +39 -0
  105. package/dist/ketchup/{p-bb6921bc.entry.js → p-c022824e.entry.js} +1 -1
  106. package/dist/ketchup/{p-b1da7902.entry.js → p-c222d070.entry.js} +1 -1
  107. package/dist/ketchup/{p-9f9b6656.js → p-c26975bf.js} +1 -1
  108. package/dist/ketchup/{p-7bd28eac.js → p-c4d9e3e2.js} +1 -1
  109. package/dist/ketchup/{p-9dcfbb1e.js → p-d4ece435.js} +2 -2
  110. package/dist/ketchup/{p-2d8b5bba.entry.js → p-d87fb5ff.entry.js} +1 -1
  111. package/dist/ketchup/{p-b0675bce.entry.js → p-da37c417.entry.js} +1 -1
  112. package/dist/ketchup/{p-1cd45a72.entry.js → p-e4975ffa.entry.js} +1 -1
  113. package/dist/ketchup/{p-4e68f629.entry.js → p-e83e70e2.entry.js} +1 -1
  114. package/dist/ketchup/{p-ae3e0d31.js → p-ea16ddc0.js} +1 -1
  115. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +54 -15
  116. package/dist/types/components/kup-planner/kup-planner-helper.d.ts +6 -0
  117. package/dist/types/components/kup-planner/kup-planner.d.ts +118 -3
  118. package/dist/types/components.d.ts +234 -2
  119. package/package.json +6 -4
  120. package/dist/ketchup/p-2217be0a.entry.js +0 -1
  121. package/dist/ketchup/p-a7ae0b4d.js +0 -1
  122. package/dist/ketchup/p-b63a5a44.js +0 -30
  123. package/dist/ketchup/p-cb6c8417.entry.js +0 -10
  124. package/dist/ketchup/p-fd948af0.entry.js +0 -9
  125. package/dist/ketchup/p-ff11d6d0.entry.js +0 -39
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-8bd38435.js';
2
- import { as as createCommonjsModule, k as kupManagerInstance, g as getProps, s as setProps } from './kup-manager-cad802b1.js';
1
+ import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-b326ffc9.js';
2
+ import { as as createCommonjsModule, k as kupManagerInstance, f as KupDatesFormats, am as getCellValueForDisplay, g as getProps, s as setProps } from './kup-manager-6145d980.js';
3
3
  import { c as componentWrapperId } from './GenericVariables-665de00a.js';
4
4
 
5
5
  /**
@@ -9,26 +9,44 @@ import { c as componentWrapperId } from './GenericVariables-665de00a.js';
9
9
  var KupPlannerProps;
10
10
  (function (KupPlannerProps) {
11
11
  KupPlannerProps["customStyle"] = "Custom style of the component.";
12
- KupPlannerProps["taskIdCol"] = "Unique task identifier";
13
- KupPlannerProps["taskNameCol"] = "Task name displayed";
14
- KupPlannerProps["taskDates"] = "Task duration, from (firstDate) to (secondDate)";
15
- KupPlannerProps["taskPrevDates"] = "Forecast task duration, from (firstDate) to (secondDate)";
16
- KupPlannerProps["taskColumns"] = "Columns containing informations displayed on the left box near the gantt";
17
- KupPlannerProps["phaseIdCol"] = "Unique phase identifier";
18
- KupPlannerProps["phaseNameCol"] = "Phase name displayed";
19
- KupPlannerProps["phaseDates"] = "Phase duration, from (firstDate) to (secondDate)";
20
- KupPlannerProps["phasePrevDates"] = "Forecast phase duration, from (firstDate) to (secondDate)";
21
- KupPlannerProps["phaseColumns"] = "Columns containing informations displayed on the left box near the gantt";
22
- KupPlannerProps["phaseColorCol"] = "Phase color in hex format";
23
- KupPlannerProps["phaseColParDep"] = "Names of the parent phases";
24
- KupPlannerProps["titleMess"] = "Message displayed";
25
- KupPlannerProps["data"] = "Dataset containg the task list";
12
+ KupPlannerProps["data"] = "Dataset containg the tasks list";
13
+ KupPlannerProps["detailData"] = "Dataset containg the details list";
14
+ KupPlannerProps["detailColorCol"] = "Column containing the detail color, in hex format";
15
+ KupPlannerProps["detailColumns"] = "Columns containing informations displayed in the left box, near the gantt of details";
16
+ KupPlannerProps["detailDates"] = "Columns containing detail duration, from (firstDate) to (secondDate)";
17
+ KupPlannerProps["detailHeight"] = "Height for detail gantt";
18
+ KupPlannerProps["detailIdCol"] = "Column containing unique detail identifier";
19
+ KupPlannerProps["detailNameCol"] = "Column containing detail name displayed";
20
+ KupPlannerProps["detailPrevDates"] = "Columns containing forecast detail duration, from (firstDate) to (secondDate)";
21
+ KupPlannerProps["listCellWidth"] = "Total size of the cells inside to the left box, near the gantt";
22
+ KupPlannerProps["maxWidth"] = "Max width for component";
23
+ KupPlannerProps["phaseColorCol"] = "Column containing the phase color in hex format";
24
+ KupPlannerProps["phaseColumns"] = "Columns containing informations displayed in the left box ,near the gantt of phases";
25
+ KupPlannerProps["phaseColParDep"] = "Column containing the name of the parent phases";
26
+ KupPlannerProps["phaseDates"] = "Columns containing phase duration, from (firstDate) to (secondDate)";
27
+ KupPlannerProps["phaseIdCol"] = "Column containing unique phase identifier";
28
+ KupPlannerProps["phaseNameCol"] = "Column containing phase name displayed";
29
+ KupPlannerProps["phasePrevDates"] = "Columns containing forecast phase duration, from (firstDate) to (secondDate)";
30
+ KupPlannerProps["showSecondaryDates"] = "Enable/disable display of secondary dates";
31
+ KupPlannerProps["taskColumns"] = "Columns containing informations displayed in the left box, near the gantt";
32
+ KupPlannerProps["taskDates"] = "Columns containing task duration, from (firstDate) to (secondDate)";
33
+ KupPlannerProps["taskHeight"] = "Height for main gantt";
34
+ KupPlannerProps["taskIdCol"] = "Column containing unique task identifier";
35
+ KupPlannerProps["taskNameCol"] = "Column containing task name displayed";
36
+ KupPlannerProps["taskPrevDates"] = "Columns containing forecast task duration, from (firstDate) to (secondDate)";
37
+ KupPlannerProps["titleMess"] = "Message displayed on top";
26
38
  })(KupPlannerProps || (KupPlannerProps = {}));
27
39
  var KupPlannerTaskAction;
28
40
  (function (KupPlannerTaskAction) {
29
41
  KupPlannerTaskAction["onOpening"] = "onOpening";
30
42
  KupPlannerTaskAction["onClosing"] = "onClosing";
31
43
  })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
44
+ var KupPlannerGanttRowType;
45
+ (function (KupPlannerGanttRowType) {
46
+ KupPlannerGanttRowType["TASK"] = "task";
47
+ KupPlannerGanttRowType["PHASE"] = "phase";
48
+ KupPlannerGanttRowType["DETAIL"] = "detail";
49
+ })(KupPlannerGanttRowType || (KupPlannerGanttRowType = {}));
32
50
  class KupPlannerLastOnChangeReceived {
33
51
  constructor(event, threshold = 100) {
34
52
  this.dateTime = new Date();
@@ -43,7 +61,20 @@ class KupPlannerLastOnChangeReceived {
43
61
  resetDateTime() {
44
62
  this.dateTime = new Date();
45
63
  }
46
- }
64
+ }
65
+ const defaultStylingOptions = {
66
+ listCellWidth: '300px',
67
+ rowHeight: 40,
68
+ barFill: 90,
69
+ projectProgressColor: '#CBCBCB',
70
+ projectProgressSelectedColor: '#CBCBCB',
71
+ projectBackgroundColor: '#CBCBCB',
72
+ projectBackgroundSelectedColor: '#CBCBCB',
73
+ barProgressColor: '#A2A415',
74
+ barProgressSelectedColor: '#A2A415',
75
+ barBackgroundColor: '#A2A415',
76
+ barBackgroundSelectedColor: '#A2A415',
77
+ };
47
78
 
48
79
  /**
49
80
  * @license React
@@ -8346,18 +8377,6 @@ function _extends() {
8346
8377
  };
8347
8378
  return _extends.apply(this, arguments);
8348
8379
  }
8349
- function _objectWithoutPropertiesLoose(source, excluded) {
8350
- if (source == null) return {};
8351
- var target = {};
8352
- var sourceKeys = Object.keys(source);
8353
- var key, i;
8354
- for (i = 0; i < sourceKeys.length; i++) {
8355
- key = sourceKeys[i];
8356
- if (excluded.indexOf(key) >= 0) continue;
8357
- target[key] = source[key];
8358
- }
8359
- return target;
8360
- }
8361
8380
  function _unsupportedIterableToArray(o, minLen) {
8362
8381
  if (!o) return;
8363
8382
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -8401,6 +8420,230 @@ var ViewMode;
8401
8420
  ViewMode["Year"] = "Year";
8402
8421
  })(ViewMode || (ViewMode = {}));
8403
8422
 
8423
+ var TimeUnit;
8424
+ (function (TimeUnit) {
8425
+ TimeUnit["DAY"] = "days";
8426
+ TimeUnit["WEEK"] = "weeks";
8427
+ TimeUnit["MONTH"] = "months";
8428
+ TimeUnit["YEAR"] = "YEAR";
8429
+ })(TimeUnit || (TimeUnit = {}));
8430
+ var parseToDayStart = function parseToDayStart(ymd) {
8431
+ return luxon.DateTime.fromISO(ymd).toJSDate();
8432
+ };
8433
+ var parseToDayEnd = function parseToDayEnd(endDate) {
8434
+ return luxon.DateTime.fromISO(endDate).plus({
8435
+ seconds: 86400 - 1
8436
+ }).toJSDate();
8437
+ };
8438
+ var formatToIsoDate = function formatToIsoDate(date) {
8439
+ return luxon.DateTime.fromJSDate(date).toISODate();
8440
+ };
8441
+ var formatToLocaleSimple = function formatToLocaleSimple(date) {
8442
+ return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
8443
+ };
8444
+ function validDates(startDate, endDate, _name) {
8445
+ var _start;
8446
+ var start = parseToDayStart(startDate);
8447
+ var end = parseToDayEnd(endDate);
8448
+ if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
8449
+ start = parseToDayStart(endDate);
8450
+ }
8451
+ return {
8452
+ start: start,
8453
+ end: end
8454
+ };
8455
+ }
8456
+
8457
+ var toViewMode = function toViewMode(timeUnit) {
8458
+ switch (timeUnit) {
8459
+ case TimeUnit.DAY:
8460
+ return ViewMode.Day;
8461
+ case TimeUnit.WEEK:
8462
+ return ViewMode.Week;
8463
+ case TimeUnit.MONTH:
8464
+ return ViewMode.Month;
8465
+ case TimeUnit.YEAR:
8466
+ return ViewMode.Year;
8467
+ }
8468
+ };
8469
+ var convertPhaseToTask = function convertPhaseToTask(item) {
8470
+ var mapPhase = function mapPhase(_ref) {
8471
+ var phaseStart = _ref.startDate,
8472
+ phaseEnd = _ref.endDate,
8473
+ secondaryStartDate = _ref.secondaryStartDate,
8474
+ secondaryEndDate = _ref.secondaryEndDate,
8475
+ phaseName = _ref.name,
8476
+ phaseId = _ref.id,
8477
+ color = _ref.color,
8478
+ selectedColor = _ref.selectedColor,
8479
+ dependencies = _ref.dependencies;
8480
+ var _validDates = validDates(phaseStart, phaseEnd),
8481
+ start = _validDates.start,
8482
+ end = _validDates.end;
8483
+ var _validDates2 = validDates(secondaryStartDate, secondaryEndDate),
8484
+ phaseStart2 = _validDates2.start,
8485
+ phaseEnd2 = _validDates2.end;
8486
+ return {
8487
+ start: start,
8488
+ end: end,
8489
+ secondaryStart: phaseStart2,
8490
+ secondaryEnd: phaseEnd2,
8491
+ name: phaseName,
8492
+ valuesToShow: item.valuesToShow,
8493
+ id: phaseId,
8494
+ type: "task",
8495
+ progress: 100,
8496
+ dependencies: dependencies,
8497
+ styles: color ? {
8498
+ backgroundColor: color,
8499
+ progressColor: color,
8500
+ backgroundSelectedColor: selectedColor,
8501
+ progressSelectedColor: selectedColor
8502
+ } : {}
8503
+ };
8504
+ };
8505
+ return mapPhase(item);
8506
+ };
8507
+ var convertDetailToTimeline = function convertDetailToTimeline(item, mainGanttStartDate, mainGanttEndDate) {
8508
+ var id = item.id,
8509
+ name = item.name,
8510
+ schedule = item.schedule;
8511
+ var getDatesForTask = function getDatesForTask(item) {
8512
+ var start = mainGanttStartDate != null ? mainGanttStartDate : "";
8513
+ var end = mainGanttEndDate != null ? mainGanttEndDate : "";
8514
+ for (var i = 0; i < item.schedule.length; i++) {
8515
+ var lstart = item.schedule[i].startDate;
8516
+ var lend = item.schedule[i].endDate;
8517
+ if (!start || lstart.localeCompare(start) < 0) {
8518
+ start = lstart;
8519
+ }
8520
+ if (!end || lend.localeCompare(end) > 0) {
8521
+ end = lend;
8522
+ }
8523
+ }
8524
+ return validDates(start, end);
8525
+ };
8526
+ var _getDatesForTask = getDatesForTask(item),
8527
+ start = _getDatesForTask.start,
8528
+ end = _getDatesForTask.end;
8529
+ var convertToFrame = function convertToFrame(x) {
8530
+ var startDate = x.startDate,
8531
+ endDate = x.endDate,
8532
+ color = x.color,
8533
+ selectedColor = x.selectedColor;
8534
+ var _validDates3 = validDates(startDate, endDate),
8535
+ start = _validDates3.start,
8536
+ end = _validDates3.end;
8537
+ return {
8538
+ start: start,
8539
+ end: end,
8540
+ backgroundColor: color != null ? color : "0xffffff",
8541
+ backgroundSelectedColor: selectedColor != null ? selectedColor : color
8542
+ };
8543
+ };
8544
+ var defaultColor = "#595959";
8545
+ return {
8546
+ id: id,
8547
+ type: "timeline",
8548
+ timeline: schedule.map(convertToFrame),
8549
+ name: name,
8550
+ valuesToShow: item.valuesToShow,
8551
+ start: start,
8552
+ end: end,
8553
+ progress: 100,
8554
+ styles: {
8555
+ backgroundColor: defaultColor,
8556
+ progressColor: defaultColor,
8557
+ backgroundSelectedColor: defaultColor,
8558
+ progressSelectedColor: defaultColor
8559
+ }
8560
+ };
8561
+ };
8562
+ var isDetail = function isDetail(row) {
8563
+ return row && row.schedule && row.schedule.length !== 0;
8564
+ };
8565
+ var convertProjectToTasks = function convertProjectToTasks(item, mainGanttStartDate, mainGanttEndDate) {
8566
+ if (!isDetail(item)) {
8567
+ var _row$phases;
8568
+ var row = item;
8569
+ var _validDates4 = validDates(row.startDate, row.endDate),
8570
+ start = _validDates4.start,
8571
+ end = _validDates4.end;
8572
+ var _validDates5 = validDates(row.secondaryStartDate, row.secondaryEndDate),
8573
+ start2 = _validDates5.start,
8574
+ end2 = _validDates5.end;
8575
+ var mainTask = {
8576
+ start: start,
8577
+ end: end,
8578
+ id: row.id,
8579
+ name: row.name,
8580
+ type: row.type,
8581
+ valuesToShow: row.valuesToShow,
8582
+ secondaryStart: start2,
8583
+ secondaryEnd: end2,
8584
+ progress: 100,
8585
+ isDisabled: false,
8586
+ hideChildren: false
8587
+ };
8588
+ var children1 = ((_row$phases = row.phases) != null ? _row$phases : []).map(convertPhaseToTask);
8589
+ return [mainTask].concat(children1);
8590
+ } else {
8591
+ var _row = item;
8592
+ return [_extends({}, convertDetailToTimeline(_row, mainGanttStartDate, mainGanttEndDate))];
8593
+ }
8594
+ };
8595
+ var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref2) {
8596
+ var id = _ref2.id,
8597
+ start = _ref2.start,
8598
+ end = _ref2.end;
8599
+ return projects.map(function (project) {
8600
+ return project.id === id ? withNewDates(project, start, end) : project;
8601
+ });
8602
+ };
8603
+ var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref3) {
8604
+ var id = _ref3.id,
8605
+ start = _ref3.start,
8606
+ end = _ref3.end;
8607
+ if (phases) {
8608
+ return phases.map(function (phase) {
8609
+ return phase.id === id ? withNewDates(phase, start, end) : phase;
8610
+ });
8611
+ }
8612
+ return undefined;
8613
+ };
8614
+ var withNewDates = function withNewDates(p, start, end) {
8615
+ var startDate = formatToIsoDate(start);
8616
+ var endDate = formatToIsoDate(end);
8617
+ var extra = {
8618
+ startDate: startDate,
8619
+ endDate: endDate
8620
+ };
8621
+ return _extends({}, p, extra);
8622
+ };
8623
+ var getProjectById = function getProjectById(id, items) {
8624
+ for (var i = 0; i < items.length; i++) {
8625
+ if (items[i].id === id) {
8626
+ return items[i];
8627
+ }
8628
+ }
8629
+ return undefined;
8630
+ };
8631
+ var getPhaseById = function getPhaseById(id, items) {
8632
+ for (var i = 0; i < items.length; i++) {
8633
+ if (isDetail(items[i])) {
8634
+ continue;
8635
+ }
8636
+ var item = items[i];
8637
+ if (!item.phases) {
8638
+ continue;
8639
+ }
8640
+ for (var j = 0; j < item.phases.length; j++) if (item.phases[j].id === id) {
8641
+ return item.phases[j];
8642
+ }
8643
+ }
8644
+ return undefined;
8645
+ };
8646
+
8404
8647
  var intlDTCache = {};
8405
8648
  var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts) {
8406
8649
  if (opts === void 0) {
@@ -8415,80 +8658,157 @@ var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts)
8415
8658
  return dtf;
8416
8659
  };
8417
8660
  var addToDate = function addToDate(date, quantity, scale) {
8418
- 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));
8661
+ 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));
8419
8662
  return newDate;
8420
8663
  };
8421
8664
  var startOfDate = function startOfDate(date, scale) {
8422
- var scores = ['millisecond', 'second', 'minute', 'hour', 'day', 'month', 'year'];
8665
+ var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
8423
8666
  var shouldReset = function shouldReset(_scale) {
8424
8667
  var maxScore = scores.indexOf(scale);
8425
8668
  return scores.indexOf(_scale) <= maxScore;
8426
8669
  };
8427
- 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());
8670
+ 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());
8428
8671
  return newDate;
8429
8672
  };
8430
- var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates) {
8431
- var newStartDate = tasks[0].start;
8432
- var newEndDate = tasks[0].start;
8433
- for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8434
- var task = _step.value;
8435
- if (task.start < newStartDate) {
8436
- newStartDate = task.start;
8673
+ var ganttDateRangeFromTask = function ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, mainGanttStartDate, mainGanttEndDate) {
8674
+ var dates = [];
8675
+ tasks.forEach(function (item) {
8676
+ dates.push({
8677
+ start: item.start,
8678
+ end: item.end,
8679
+ secondaryStart: item.secondaryStart,
8680
+ secondaryEnd: item.secondaryEnd
8681
+ });
8682
+ });
8683
+ if (mainGanttStartDate && mainGanttEndDate) {
8684
+ dates.push({
8685
+ start: mainGanttStartDate,
8686
+ end: mainGanttEndDate,
8687
+ secondaryStart: undefined,
8688
+ secondaryEnd: undefined
8689
+ });
8690
+ }
8691
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates);
8692
+ };
8693
+ var calculateDisplayedDateRange = function calculateDisplayedDateRange(mainGanttItems, timeUnit, mainGanttDoubleView, secondaryGanttItems, preStepsCount) {
8694
+ var dates = ganttDateRangeFromGanttTask(mainGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8695
+ if (secondaryGanttItems) {
8696
+ var dates2 = ganttDateRangeFromDetail(secondaryGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8697
+ if (dates2[0] < dates[0]) {
8698
+ dates[0] = dates2[0];
8699
+ }
8700
+ if (dates2[1] > dates[1]) {
8701
+ dates[1] = dates2[1];
8702
+ }
8703
+ }
8704
+ return {
8705
+ displayedStartDate: dates[0],
8706
+ displayedEndDate: dates[1]
8707
+ };
8708
+ };
8709
+ var ganttDateRangeFromGanttTask = function ganttDateRangeFromGanttTask(tasks, viewMode, preStepsCount, showSecondaryDates) {
8710
+ var dates = [];
8711
+ tasks.forEach(function (item) {
8712
+ var _item$phases;
8713
+ dates.push({
8714
+ start: parseToDayStart(item.startDate),
8715
+ end: parseToDayEnd(item.endDate),
8716
+ secondaryStart: parseToDayStart(item.secondaryStartDate),
8717
+ secondaryEnd: parseToDayEnd(item.secondaryEndDate)
8718
+ });
8719
+ (_item$phases = item.phases) === null || _item$phases === void 0 ? void 0 : _item$phases.forEach(function (phase) {
8720
+ dates.push({
8721
+ start: parseToDayStart(phase.startDate),
8722
+ end: parseToDayEnd(phase.endDate),
8723
+ secondaryStart: parseToDayStart(phase.secondaryStartDate),
8724
+ secondaryEnd: parseToDayEnd(phase.secondaryEndDate)
8725
+ });
8726
+ });
8727
+ });
8728
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8729
+ };
8730
+ var ganttDateRangeFromDetail = function ganttDateRangeFromDetail(details, viewMode, preStepsCount, showSecondaryDates) {
8731
+ var dates = [];
8732
+ details.forEach(function (item) {
8733
+ var scheduleItems = item.schedule;
8734
+ if (scheduleItems) {
8735
+ scheduleItems.forEach(function (item) {
8736
+ dates.push({
8737
+ start: parseToDayStart(item.startDate),
8738
+ end: parseToDayEnd(item.endDate),
8739
+ secondaryStart: undefined,
8740
+ secondaryEnd: undefined
8741
+ });
8742
+ });
8743
+ }
8744
+ });
8745
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8746
+ };
8747
+ var ganttDateRangeGeneric = function ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, realDates) {
8748
+ var newStartDate = dates[0].start;
8749
+ var newEndDate = dates[0].end;
8750
+ for (var _iterator = _createForOfIteratorHelperLoose(dates), _step; !(_step = _iterator()).done;) {
8751
+ var d = _step.value;
8752
+ if (d.start < newStartDate) {
8753
+ newStartDate = d.start;
8437
8754
  }
8438
- if (task.end > newEndDate) {
8439
- newEndDate = task.end;
8755
+ if (d.end > newEndDate) {
8756
+ newEndDate = d.end;
8440
8757
  }
8441
8758
  if (showSecondaryDates) {
8442
- if (task.secondaryStart && task.secondaryStart < newStartDate) {
8443
- newStartDate = task.secondaryStart;
8759
+ if (d.secondaryStart && d.secondaryStart < newStartDate) {
8760
+ newStartDate = d.secondaryStart;
8444
8761
  }
8445
- if (task.secondaryEnd && task.secondaryEnd > newEndDate) {
8446
- newEndDate = task.secondaryEnd;
8762
+ if (d.secondaryEnd && d.secondaryEnd > newEndDate) {
8763
+ newEndDate = d.secondaryEnd;
8447
8764
  }
8448
8765
  }
8449
8766
  }
8767
+ if (realDates) {
8768
+ return [newStartDate, newEndDate];
8769
+ }
8450
8770
  switch (viewMode) {
8451
8771
  case ViewMode.Year:
8452
- newStartDate = addToDate(newStartDate, -1, 'year');
8453
- newStartDate = startOfDate(newStartDate, 'year');
8454
- newEndDate = addToDate(newEndDate, 1, 'year');
8455
- newEndDate = startOfDate(newEndDate, 'year');
8772
+ newStartDate = addToDate(newStartDate, -1, "year");
8773
+ newStartDate = startOfDate(newStartDate, "year");
8774
+ newEndDate = addToDate(newEndDate, 1, "year");
8775
+ newEndDate = startOfDate(newEndDate, "year");
8456
8776
  break;
8457
8777
  case ViewMode.Month:
8458
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'month');
8459
- newStartDate = startOfDate(newStartDate, 'month');
8460
- newEndDate = addToDate(newEndDate, 1, 'year');
8461
- newEndDate = startOfDate(newEndDate, 'year');
8778
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
8779
+ newStartDate = startOfDate(newStartDate, "month");
8780
+ newEndDate = addToDate(newEndDate, 1, "year");
8781
+ newEndDate = startOfDate(newEndDate, "year");
8462
8782
  break;
8463
8783
  case ViewMode.Week:
8464
- newStartDate = startOfDate(newStartDate, 'day');
8465
- newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, 'day');
8466
- newEndDate = startOfDate(newEndDate, 'day');
8467
- newEndDate = addToDate(newEndDate, 1.5, 'month');
8784
+ newStartDate = startOfDate(newStartDate, "day");
8785
+ newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, "day");
8786
+ newEndDate = startOfDate(newEndDate, "day");
8787
+ newEndDate = addToDate(newEndDate, 1.5, "month");
8468
8788
  break;
8469
8789
  case ViewMode.Day:
8470
- newStartDate = startOfDate(newStartDate, 'day');
8471
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8472
- newEndDate = startOfDate(newEndDate, 'day');
8473
- newEndDate = addToDate(newEndDate, 19, 'day');
8790
+ newStartDate = startOfDate(newStartDate, "day");
8791
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8792
+ newEndDate = startOfDate(newEndDate, "day");
8793
+ newEndDate = addToDate(newEndDate, 19, "day");
8474
8794
  break;
8475
8795
  case ViewMode.QuarterDay:
8476
- newStartDate = startOfDate(newStartDate, 'day');
8477
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8478
- newEndDate = startOfDate(newEndDate, 'day');
8479
- newEndDate = addToDate(newEndDate, 66, 'hour');
8796
+ newStartDate = startOfDate(newStartDate, "day");
8797
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8798
+ newEndDate = startOfDate(newEndDate, "day");
8799
+ newEndDate = addToDate(newEndDate, 66, "hour");
8480
8800
  break;
8481
8801
  case ViewMode.HalfDay:
8482
- newStartDate = startOfDate(newStartDate, 'day');
8483
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8484
- newEndDate = startOfDate(newEndDate, 'day');
8485
- newEndDate = addToDate(newEndDate, 108, 'hour');
8802
+ newStartDate = startOfDate(newStartDate, "day");
8803
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8804
+ newEndDate = startOfDate(newEndDate, "day");
8805
+ newEndDate = addToDate(newEndDate, 108, "hour");
8486
8806
  break;
8487
8807
  case ViewMode.Hour:
8488
- newStartDate = startOfDate(newStartDate, 'hour');
8489
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'hour');
8490
- newEndDate = startOfDate(newEndDate, 'day');
8491
- newEndDate = addToDate(newEndDate, 1, 'day');
8808
+ newStartDate = startOfDate(newStartDate, "hour");
8809
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
8810
+ newEndDate = startOfDate(newEndDate, "day");
8811
+ newEndDate = addToDate(newEndDate, 1, "day");
8492
8812
  break;
8493
8813
  }
8494
8814
  return [newStartDate, newEndDate];
@@ -8499,25 +8819,25 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8499
8819
  while (currentDate < endDate) {
8500
8820
  switch (viewMode) {
8501
8821
  case ViewMode.Year:
8502
- currentDate = addToDate(currentDate, 1, 'year');
8822
+ currentDate = addToDate(currentDate, 1, "year");
8503
8823
  break;
8504
8824
  case ViewMode.Month:
8505
- currentDate = addToDate(currentDate, 1, 'month');
8825
+ currentDate = addToDate(currentDate, 1, "month");
8506
8826
  break;
8507
8827
  case ViewMode.Week:
8508
- currentDate = addToDate(currentDate, 7, 'day');
8828
+ currentDate = addToDate(currentDate, 7, "day");
8509
8829
  break;
8510
8830
  case ViewMode.Day:
8511
- currentDate = addToDate(currentDate, 1, 'day');
8831
+ currentDate = addToDate(currentDate, 1, "day");
8512
8832
  break;
8513
8833
  case ViewMode.HalfDay:
8514
- currentDate = addToDate(currentDate, 12, 'hour');
8834
+ currentDate = addToDate(currentDate, 12, "hour");
8515
8835
  break;
8516
8836
  case ViewMode.QuarterDay:
8517
- currentDate = addToDate(currentDate, 6, 'hour');
8837
+ currentDate = addToDate(currentDate, 6, "hour");
8518
8838
  break;
8519
8839
  case ViewMode.Hour:
8520
- currentDate = addToDate(currentDate, 1, 'hour');
8840
+ currentDate = addToDate(currentDate, 1, "hour");
8521
8841
  break;
8522
8842
  }
8523
8843
  dates.push(currentDate);
@@ -8526,7 +8846,7 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8526
8846
  };
8527
8847
  var getLocaleMonth = function getLocaleMonth(date, locale) {
8528
8848
  var bottomValue = getCachedDateTimeFormat(locale, {
8529
- month: 'long'
8849
+ month: "long"
8530
8850
  }).format(date);
8531
8851
  bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
8532
8852
  return bottomValue;
@@ -8576,15 +8896,15 @@ var defaultDateTimeFormatters = {
8576
8896
  return "W" + getWeekNumberISO8601(date);
8577
8897
  },
8578
8898
  day: function day(date, locale) {
8579
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate().toString();
8899
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate().toString();
8580
8900
  },
8581
8901
  hour: function hour(date, locale) {
8582
8902
  return "" + getCachedDateTimeFormat(locale, {
8583
- hour: 'numeric'
8903
+ hour: "numeric"
8584
8904
  }).format(date);
8585
8905
  },
8586
8906
  dayAndMonth: function dayAndMonth(date, locale) {
8587
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8907
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8588
8908
  }
8589
8909
  };
8590
8910
 
@@ -8904,9 +9224,7 @@ var GridBody = function GridBody(_ref) {
8904
9224
  dates = _ref.dates,
8905
9225
  rowHeight = _ref.rowHeight,
8906
9226
  svgWidth = _ref.svgWidth,
8907
- columnWidth = _ref.columnWidth,
8908
- todayColor = _ref.todayColor,
8909
- rtl = _ref.rtl;
9227
+ columnWidth = _ref.columnWidth;
8910
9228
  var y = 0;
8911
9229
  var gridRows = [];
8912
9230
  var rowLines = [react.createElement("line", {
@@ -8920,7 +9238,7 @@ var GridBody = function GridBody(_ref) {
8920
9238
  for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8921
9239
  var task = _step.value;
8922
9240
  gridRows.push(react.createElement("rect", {
8923
- key: 'Row' + task.id,
9241
+ key: "Row" + task.id,
8924
9242
  x: "0",
8925
9243
  y: y,
8926
9244
  width: svgWidth,
@@ -8928,7 +9246,7 @@ var GridBody = function GridBody(_ref) {
8928
9246
  className: styles$4.gridRow
8929
9247
  }));
8930
9248
  rowLines.push(react.createElement("line", {
8931
- key: 'RowLine' + task.id,
9249
+ key: "RowLine" + task.id,
8932
9250
  x: "0",
8933
9251
  y1: y + rowHeight,
8934
9252
  x2: svgWidth,
@@ -8940,7 +9258,6 @@ var GridBody = function GridBody(_ref) {
8940
9258
  var now = new Date();
8941
9259
  var tickX = 0;
8942
9260
  var ticks = [];
8943
- var today = react.createElement("rect", null);
8944
9261
  for (var i = 0; i < dates.length; i++) {
8945
9262
  var date = dates[i];
8946
9263
  ticks.push(react.createElement("line", {
@@ -8951,24 +9268,7 @@ var GridBody = function GridBody(_ref) {
8951
9268
  y2: y,
8952
9269
  className: styles$4.gridTick
8953
9270
  }));
8954
- 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()) {
8955
- today = react.createElement("rect", {
8956
- x: tickX + columnWidth / 2 - 1,
8957
- y: 0,
8958
- width: 2,
8959
- height: y,
8960
- fill: todayColor
8961
- });
8962
- }
8963
- if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
8964
- today = react.createElement("rect", {
8965
- x: tickX + columnWidth / 2,
8966
- y: 0,
8967
- width: 2,
8968
- height: y,
8969
- fill: todayColor
8970
- });
8971
- }
9271
+ 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()) ;
8972
9272
  tickX += columnWidth;
8973
9273
  }
8974
9274
  return react.createElement("g", {
@@ -8979,9 +9279,7 @@ var GridBody = function GridBody(_ref) {
8979
9279
  className: "rowLines"
8980
9280
  }, rowLines), react.createElement("g", {
8981
9281
  className: "ticks"
8982
- }, ticks), react.createElement("g", {
8983
- className: "today"
8984
- }, today));
9282
+ }, ticks));
8985
9283
  };
8986
9284
 
8987
9285
  var Grid = function Grid(props) {
@@ -9051,7 +9349,8 @@ var Calendar = function Calendar(_ref) {
9051
9349
  fontSize = _ref.fontSize,
9052
9350
  dateTimeFormatters = _ref.dateTimeFormatters,
9053
9351
  _ref$singleLineHeader = _ref.singleLineHeader,
9054
- singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader;
9352
+ singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
9353
+ currentDateIndicator = _ref.currentDateIndicator;
9055
9354
  var simplifiedHeader = singleLineHeader && dateSetup.viewMode !== ViewMode.Year;
9056
9355
  var TopCal = simplifiedHeader ? SinglePartOfCalendar : TopPartOfCalendar;
9057
9356
  var formatYear = (_dateTimeFormatters$y = dateTimeFormatters === null || dateTimeFormatters === void 0 ? void 0 : dateTimeFormatters.year) != null ? _dateTimeFormatters$y : defaultDateTimeFormatters.year;
@@ -9137,7 +9436,7 @@ var Calendar = function Calendar(_ref) {
9137
9436
  var dates = dateSetup.dates;
9138
9437
  for (var i = dates.length - 1; i >= 0; i--) {
9139
9438
  var date = dates[i];
9140
- var topValue = '';
9439
+ var topValue = "";
9141
9440
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
9142
9441
  topValue = formatMonthAndYear(date, locale);
9143
9442
  }
@@ -9272,7 +9571,12 @@ var Calendar = function Calendar(_ref) {
9272
9571
  width: columnWidth * dateSetup.dates.length,
9273
9572
  height: headerHeight,
9274
9573
  className: styles$5.calendarHeader
9275
- }), simplifiedHeader ? null : bottomValues, " ", topValues);
9574
+ }), simplifiedHeader ? null : bottomValues, " ", topValues, currentDateIndicator && react.createElement("circle", {
9575
+ fill: currentDateIndicator.color,
9576
+ cx: currentDateIndicator.x + 2.5,
9577
+ cy: headerHeight - 8,
9578
+ r: "8"
9579
+ }));
9276
9580
  };
9277
9581
 
9278
9582
  // A type of promise-like that resolves synchronously and supports only one observer
@@ -9511,6 +9815,9 @@ var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
9511
9815
  var index = dates.findIndex(function (d) {
9512
9816
  return d.getTime() >= xDate.getTime();
9513
9817
  }) - 1;
9818
+ if (index < 0) {
9819
+ return 0;
9820
+ }
9514
9821
  var remainderMillis = xDate.getTime() - dates[index].getTime();
9515
9822
  var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
9516
9823
  var x = index * columnWidth + percentOfInterval * columnWidth;
@@ -9668,6 +9975,15 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
9668
9975
  changedTask: changedTask
9669
9976
  };
9670
9977
  };
9978
+ function calculateCurrentDateCalculator(dates, columnWidth) {
9979
+ return taskXCoordinate(new Date(), dates, columnWidth);
9980
+ }
9981
+ function calculateProjection(start, end, dates, columnWidth) {
9982
+ return {
9983
+ x0: taskXCoordinate(start, dates, columnWidth),
9984
+ xf: taskXCoordinate(end, dates, columnWidth)
9985
+ };
9986
+ }
9671
9987
 
9672
9988
  function isKeyboardEvent(event) {
9673
9989
  return event.key !== undefined;
@@ -9930,11 +10246,15 @@ var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
9930
10246
 
9931
10247
  var Timeline = function Timeline(_ref) {
9932
10248
  var task = _ref.task,
9933
- isSelected = _ref.isSelected;
10249
+ isSelected = _ref.isSelected,
10250
+ onEventStart = _ref.onEventStart;
9934
10251
  var styles = task.styles;
9935
10252
  var col = isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
9936
10253
  return react.createElement("g", {
9937
- tabIndex: 0
10254
+ tabIndex: 0,
10255
+ onMouseDown: function onMouseDown(e) {
10256
+ return onEventStart("move", task, e);
10257
+ }
9938
10258
  }, react.createElement("rect", {
9939
10259
  fill: col,
9940
10260
  x: "0",
@@ -9945,6 +10265,9 @@ var Timeline = function Timeline(_ref) {
9945
10265
  ry: 0
9946
10266
  }), task.barChildren.map(function (bar) {
9947
10267
  return react.createElement("rect", {
10268
+ style: {
10269
+ cursor: "pointer"
10270
+ },
9948
10271
  key: bar.id,
9949
10272
  fill: bar.styles.backgroundColor,
9950
10273
  x: bar.x1,
@@ -9990,7 +10313,7 @@ var TaskItem = function TaskItem(props) {
9990
10313
  setTaskItem(react.createElement(Bar, Object.assign({}, props)));
9991
10314
  break;
9992
10315
  }
9993
- }, [task.typeInternal, isSelected, props]);
10316
+ }, [task, isSelected]);
9994
10317
  react.useEffect(function () {
9995
10318
  if (textRef.current) {
9996
10319
  setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
@@ -10058,6 +10381,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10058
10381
  fontFamily = _ref.fontFamily,
10059
10382
  fontSize = _ref.fontSize,
10060
10383
  rtl = _ref.rtl,
10384
+ _ref$hideLabel = _ref.hideLabel,
10385
+ hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10386
+ _ref$showSecondaryDat = _ref.showSecondaryDates,
10387
+ showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10388
+ currentDateIndicator = _ref.currentDateIndicator,
10389
+ projection = _ref.projection,
10061
10390
  setGanttEvent = _ref.setGanttEvent,
10062
10391
  setFailedTask = _ref.setFailedTask,
10063
10392
  setSelectedTask = _ref.setSelectedTask,
@@ -10065,11 +10394,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10065
10394
  onProgressChange = _ref.onProgressChange,
10066
10395
  onDoubleClick = _ref.onDoubleClick,
10067
10396
  onClick = _ref.onClick,
10068
- onDelete = _ref.onDelete,
10069
- _ref$hideLabel = _ref.hideLabel,
10070
- hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10071
- _ref$showSecondaryDat = _ref.showSecondaryDates,
10072
- showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat;
10397
+ onDelete = _ref.onDelete;
10073
10398
  var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
10074
10399
  var _useState = react.useState(0),
10075
10400
  xStep = _useState[0],
@@ -10257,7 +10582,20 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10257
10582
  };
10258
10583
  return react.createElement("g", {
10259
10584
  className: "content"
10260
- }, react.createElement("g", {
10585
+ }, currentDateIndicator && react.createElement("rect", {
10586
+ fill: currentDateIndicator.color,
10587
+ x: currentDateIndicator.x + 1.5,
10588
+ y: "0",
10589
+ width: "2",
10590
+ height: "100%"
10591
+ }), projection && react.createElement("rect", {
10592
+ fill: projection.color,
10593
+ x: projection.x0,
10594
+ y: "0",
10595
+ width: projection.xf - projection.x0,
10596
+ height: "100%",
10597
+ fillOpacity: "35%"
10598
+ }), react.createElement("g", {
10261
10599
  className: "arrows",
10262
10600
  fill: arrowColor,
10263
10601
  stroke: arrowColor
@@ -10365,6 +10703,7 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10365
10703
  scrollRef.current.scrollLeft = scroll;
10366
10704
  }
10367
10705
  }, [scroll]);
10706
+ console.log("HORIZONTAL-SCROLL svgWidth: " + svgWidth);
10368
10707
  return react.createElement("div", {
10369
10708
  dir: "ltr",
10370
10709
  style: {
@@ -10382,13 +10721,14 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10382
10721
  };
10383
10722
 
10384
10723
  var Gantt = function Gantt(_ref) {
10385
- var tasks = _ref.tasks,
10724
+ var id = _ref.id,
10725
+ tasks = _ref.tasks,
10386
10726
  _ref$headerHeight = _ref.headerHeight,
10387
10727
  headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
10388
10728
  _ref$columnWidth = _ref.columnWidth,
10389
10729
  columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
10390
10730
  _ref$listCellWidth = _ref.listCellWidth,
10391
- listCellWidth = _ref$listCellWidth === void 0 ? "155px" : _ref$listCellWidth,
10731
+ listCellWidth = _ref$listCellWidth === void 0 ? "297px" : _ref$listCellWidth,
10392
10732
  _ref$rowHeight = _ref.rowHeight,
10393
10733
  rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
10394
10734
  _ref$ganttHeight = _ref.ganttHeight,
@@ -10438,7 +10778,7 @@ var Gantt = function Gantt(_ref) {
10438
10778
  _ref$arrowIndent = _ref.arrowIndent,
10439
10779
  arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
10440
10780
  _ref$todayColor = _ref.todayColor,
10441
- todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
10781
+ todayColor = _ref$todayColor === void 0 ? "#ff0000" : _ref$todayColor,
10442
10782
  viewDate = _ref.viewDate,
10443
10783
  _ref$TooltipContent = _ref.TooltipContent,
10444
10784
  TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
@@ -10446,13 +10786,6 @@ var Gantt = function Gantt(_ref) {
10446
10786
  TaskListHeader = _ref$TaskListHeader === void 0 ? TaskListHeaderDefault : _ref$TaskListHeader,
10447
10787
  _ref$TaskListTable = _ref.TaskListTable,
10448
10788
  TaskListTable = _ref$TaskListTable === void 0 ? TaskListTableDefault : _ref$TaskListTable,
10449
- onDateChange = _ref.onDateChange,
10450
- onProgressChange = _ref.onProgressChange,
10451
- onDoubleClick = _ref.onDoubleClick,
10452
- onClick = _ref.onClick,
10453
- onDelete = _ref.onDelete,
10454
- onSelect = _ref.onSelect,
10455
- onExpanderClick = _ref.onExpanderClick,
10456
10789
  dateTimeFormatters = _ref.dateTimeFormatters,
10457
10790
  _ref$singleLineHeader = _ref.singleLineHeader,
10458
10791
  singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
@@ -10461,13 +10794,23 @@ var Gantt = function Gantt(_ref) {
10461
10794
  _ref$showSecondaryDat = _ref.showSecondaryDates,
10462
10795
  showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10463
10796
  _ref$hideDependencies = _ref.hideDependencies,
10464
- hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies;
10797
+ hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies,
10798
+ projection = _ref.projection,
10799
+ displayedStartDate = _ref.displayedStartDate,
10800
+ displayedEndDate = _ref.displayedEndDate,
10801
+ onDateChange = _ref.onDateChange,
10802
+ onProgressChange = _ref.onProgressChange,
10803
+ onDoubleClick = _ref.onDoubleClick,
10804
+ onClick = _ref.onClick,
10805
+ onDelete = _ref.onDelete,
10806
+ onSelect = _ref.onSelect,
10807
+ onExpanderClick = _ref.onExpanderClick;
10465
10808
  var wrapperRef = react.useRef(null);
10466
10809
  var taskListRef = react.useRef(null);
10467
10810
  var _useState = react.useState(function () {
10468
- var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates),
10469
- startDate = _ganttDateRange[0],
10470
- endDate = _ganttDateRange[1];
10811
+ var _ganttDateRangeFromTa = ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10812
+ startDate = _ganttDateRangeFromTa[0],
10813
+ endDate = _ganttDateRangeFromTa[1];
10471
10814
  return {
10472
10815
  viewMode: viewMode,
10473
10816
  dates: seedDates(startDate, endDate, viewMode)
@@ -10521,6 +10864,19 @@ var Gantt = function Gantt(_ref) {
10521
10864
  var _useState12 = react.useState(false),
10522
10865
  ignoreScrollEvent = _useState12[0],
10523
10866
  setIgnoreScrollEvent = _useState12[1];
10867
+ var _useState13 = react.useState(),
10868
+ currentDateIndicatorContent = _useState13[0],
10869
+ setCurrentDateIndicatorContent = _useState13[1];
10870
+ var _useState14 = react.useState(),
10871
+ projectionContent = _useState14[0],
10872
+ setProjectionContent = _useState14[1];
10873
+ react.useEffect(function () {
10874
+ window.addEventListener("gantt-sync-scroll-event", function (e) {
10875
+ if (e.detail.id !== id) {
10876
+ setScrollX(e.detail.scrollX);
10877
+ }
10878
+ });
10879
+ }, [id]);
10524
10880
  react.useEffect(function () {
10525
10881
  var filteredTasks;
10526
10882
  if (onExpanderClick) {
@@ -10529,9 +10885,9 @@ var Gantt = function Gantt(_ref) {
10529
10885
  filteredTasks = tasks;
10530
10886
  }
10531
10887
  filteredTasks = filteredTasks.sort(sortTasks);
10532
- var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount, showSecondaryDates),
10533
- startDate = _ganttDateRange2[0],
10534
- endDate = _ganttDateRange2[1];
10888
+ var _ganttDateRangeFromTa2 = ganttDateRangeFromTask(filteredTasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10889
+ startDate = _ganttDateRangeFromTa2[0],
10890
+ endDate = _ganttDateRangeFromTa2[1];
10535
10891
  var newDates = seedDates(startDate, endDate, viewMode);
10536
10892
  if (rtl) {
10537
10893
  newDates = newDates.reverse();
@@ -10544,7 +10900,7 @@ var Gantt = function Gantt(_ref) {
10544
10900
  viewMode: viewMode
10545
10901
  });
10546
10902
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, projectHeight, timelineHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, showSecondaryDates));
10547
- }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick]);
10903
+ }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick, showSecondaryDates, projectHeight, timelineHeight, displayedStartDate, displayedEndDate]);
10548
10904
  react.useEffect(function () {
10549
10905
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
10550
10906
  var dates = dateSetup.dates;
@@ -10656,11 +11012,20 @@ var Gantt = function Gantt(_ref) {
10656
11012
  if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
10657
11013
  setScrollX(event.currentTarget.scrollLeft);
10658
11014
  setIgnoreScrollEvent(true);
11015
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11016
+ detail: {
11017
+ componentId: id,
11018
+ scrollX: event.currentTarget.scrollLeft
11019
+ }
11020
+ }));
10659
11021
  } else {
10660
11022
  setIgnoreScrollEvent(false);
10661
11023
  }
10662
11024
  };
10663
11025
  var handleKeyDown = function handleKeyDown(event) {
11026
+ if (event.target.tagName === "INPUT") {
11027
+ return;
11028
+ }
10664
11029
  event.preventDefault();
10665
11030
  var newScrollY = scrollY;
10666
11031
  var newScrollX = scrollX;
@@ -10692,6 +11057,12 @@ var Gantt = function Gantt(_ref) {
10692
11057
  newScrollX = svgWidth;
10693
11058
  }
10694
11059
  setScrollX(newScrollX);
11060
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11061
+ detail: {
11062
+ componentId: id,
11063
+ scrollX: newScrollX
11064
+ }
11065
+ }));
10695
11066
  } else {
10696
11067
  if (newScrollY < 0) {
10697
11068
  newScrollY = 0;
@@ -10702,6 +11073,29 @@ var Gantt = function Gantt(_ref) {
10702
11073
  }
10703
11074
  setIgnoreScrollEvent(true);
10704
11075
  };
11076
+ react.useEffect(function () {
11077
+ var x = calculateCurrentDateCalculator(dateSetup.dates, columnWidth);
11078
+ if (x !== 0) {
11079
+ setCurrentDateIndicatorContent({
11080
+ color: todayColor,
11081
+ x: x
11082
+ });
11083
+ }
11084
+ }, [columnWidth, dateSetup.dates, todayColor]);
11085
+ react.useEffect(function () {
11086
+ if (projection) {
11087
+ var _calculateProjection = calculateProjection(projection.start, projection.end, dateSetup.dates, columnWidth),
11088
+ x0 = _calculateProjection.x0,
11089
+ xf = _calculateProjection.xf;
11090
+ setProjectionContent({
11091
+ x0: x0,
11092
+ xf: xf,
11093
+ color: projection.color
11094
+ });
11095
+ } else {
11096
+ setProjectionContent(undefined);
11097
+ }
11098
+ }, [columnWidth, dateSetup.dates, projection]);
10705
11099
  var handleSelectedTask = function handleSelectedTask(taskId) {
10706
11100
  var newSelectedTask = barTasks.find(function (t) {
10707
11101
  return t.id === taskId;
@@ -10745,7 +11139,8 @@ var Gantt = function Gantt(_ref) {
10745
11139
  fontSize: fontSize,
10746
11140
  rtl: rtl,
10747
11141
  dateTimeFormatters: dateTimeFormatters,
10748
- singleLineHeader: singleLineHeader
11142
+ singleLineHeader: singleLineHeader,
11143
+ currentDateIndicator: currentDateIndicatorContent
10749
11144
  };
10750
11145
  var barProps = {
10751
11146
  tasks: barTasks,
@@ -10762,6 +11157,11 @@ var Gantt = function Gantt(_ref) {
10762
11157
  arrowIndent: arrowIndent,
10763
11158
  svgWidth: svgWidth,
10764
11159
  rtl: rtl,
11160
+ hideLabel: hideLabel,
11161
+ showSecondaryDates: showSecondaryDates,
11162
+ ganttHeight: ganttHeight,
11163
+ currentDateIndicator: currentDateIndicatorContent,
11164
+ projection: projectionContent,
10765
11165
  setGanttEvent: setGanttEvent,
10766
11166
  setFailedTask: setFailedTask,
10767
11167
  setSelectedTask: handleSelectedTask,
@@ -10769,9 +11169,7 @@ var Gantt = function Gantt(_ref) {
10769
11169
  onProgressChange: onProgressChange,
10770
11170
  onDoubleClick: onDoubleClick,
10771
11171
  onClick: onClick,
10772
- onDelete: onDelete,
10773
- hideLabel: hideLabel,
10774
- showSecondaryDates: showSecondaryDates
11172
+ onDelete: onDelete
10775
11173
  };
10776
11174
  var tableProps = {
10777
11175
  rowHeight: rowHeight,
@@ -10834,195 +11232,6 @@ var Gantt = function Gantt(_ref) {
10834
11232
  }));
10835
11233
  };
10836
11234
 
10837
- var TimeUnit;
10838
- (function (TimeUnit) {
10839
- TimeUnit["DAY"] = "days";
10840
- TimeUnit["WEEK"] = "weeks";
10841
- TimeUnit["MONTH"] = "months";
10842
- TimeUnit["YEAR"] = "YEAR";
10843
- })(TimeUnit || (TimeUnit = {}));
10844
-
10845
- var parseToDayStart = function parseToDayStart(ymd) {
10846
- return luxon.DateTime.fromISO(ymd).toJSDate();
10847
- };
10848
- var parseToDayEnd = function parseToDayEnd(endDate) {
10849
- return luxon.DateTime.fromISO(endDate).plus({
10850
- seconds: 86400 - 1
10851
- }).toJSDate();
10852
- };
10853
- var formatToIsoDate = function formatToIsoDate(date) {
10854
- return luxon.DateTime.fromJSDate(date).toISODate();
10855
- };
10856
- var formatToLocaleSimple = function formatToLocaleSimple(date) {
10857
- return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
10858
- };
10859
- function validDates(startDate, endDate, name) {
10860
- var _start;
10861
- var start = parseToDayStart(startDate);
10862
- var end = parseToDayEnd(endDate);
10863
- if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
10864
- start = parseToDayStart(endDate);
10865
- console.log("time-converters.ts validDates() Error date", {
10866
- name: name,
10867
- start: startDate,
10868
- end: endDate
10869
- });
10870
- }
10871
- return {
10872
- start: start,
10873
- end: end
10874
- };
10875
- }
10876
-
10877
- var toViewMode = function toViewMode(timeUnit) {
10878
- switch (timeUnit) {
10879
- case TimeUnit.DAY:
10880
- return ViewMode.Day;
10881
- case TimeUnit.WEEK:
10882
- return ViewMode.Week;
10883
- case TimeUnit.MONTH:
10884
- return ViewMode.Month;
10885
- case TimeUnit.YEAR:
10886
- return ViewMode.Year;
10887
- }
10888
- };
10889
- var convertPhaseToTask = function convertPhaseToTask(item) {
10890
- var mapPhase = function mapPhase(_ref) {
10891
- var phaseStart = _ref.startDate,
10892
- phaseEnd = _ref.endDate,
10893
- secondaryStartDate = _ref.secondaryStartDate,
10894
- secondaryEndDate = _ref.secondaryEndDate,
10895
- phaseName = _ref.name,
10896
- phaseId = _ref.id,
10897
- color = _ref.color,
10898
- selectedColor = _ref.selectedColor,
10899
- dependencies = _ref.dependencies;
10900
- var _validDates = validDates(phaseStart, phaseEnd, phaseName),
10901
- start = _validDates.start,
10902
- end = _validDates.end;
10903
- var _validDates2 = validDates(secondaryStartDate, secondaryEndDate, phaseName),
10904
- phaseStart2 = _validDates2.start,
10905
- phaseEnd2 = _validDates2.end;
10906
- return {
10907
- start: start,
10908
- end: end,
10909
- secondaryStart: phaseStart2,
10910
- secondaryEnd: phaseEnd2,
10911
- name: phaseName,
10912
- valuesToShow: item.valuesToShow,
10913
- id: phaseId,
10914
- type: "task",
10915
- progress: 100,
10916
- dependencies: dependencies,
10917
- styles: color ? {
10918
- backgroundColor: color,
10919
- progressColor: color,
10920
- backgroundSelectedColor: selectedColor,
10921
- progressSelectedColor: selectedColor
10922
- } : {}
10923
- };
10924
- };
10925
- return mapPhase(item);
10926
- };
10927
- var convertDetailToTimeline = function convertDetailToTimeline(item) {
10928
- var id = item.id,
10929
- name = item.name,
10930
- schedule = item.schedule;
10931
- var convertToFrame = function convertToFrame(x) {
10932
- var startDate = x.startDate,
10933
- endDate = x.endDate,
10934
- color = x.color,
10935
- selectedColor = x.selectedColor;
10936
- var _validDates3 = validDates(startDate, endDate, "time frame"),
10937
- start = _validDates3.start,
10938
- end = _validDates3.end;
10939
- return {
10940
- start: start,
10941
- end: end,
10942
- backgroundColor: color != null ? color : "0xffffff",
10943
- backgroundSelectedColor: selectedColor != null ? selectedColor : color
10944
- };
10945
- };
10946
- var defaultColor = "#595959";
10947
- return {
10948
- id: id,
10949
- type: "timeline",
10950
- timeline: schedule.map(convertToFrame),
10951
- name: name,
10952
- valuesToShow: item.valuesToShow,
10953
- start: new Date(),
10954
- end: new Date(),
10955
- progress: 100,
10956
- styles: {
10957
- backgroundColor: defaultColor,
10958
- progressColor: defaultColor,
10959
- backgroundSelectedColor: defaultColor,
10960
- progressSelectedColor: defaultColor
10961
- }
10962
- };
10963
- };
10964
- var convertProjectToTasks = function convertProjectToTasks(_ref2) {
10965
- var id = _ref2.id,
10966
- name = _ref2.name,
10967
- valuesToShow = _ref2.valuesToShow,
10968
- startDate = _ref2.startDate,
10969
- endDate = _ref2.endDate,
10970
- phases = _ref2.phases,
10971
- details = _ref2.details,
10972
- secondaryStartDate = _ref2.secondaryStartDate,
10973
- secondaryEndDate = _ref2.secondaryEndDate;
10974
- var _validDates4 = validDates(startDate, endDate, name),
10975
- start = _validDates4.start,
10976
- end = _validDates4.end;
10977
- var _validDates5 = validDates(secondaryStartDate, secondaryEndDate, name),
10978
- start2 = _validDates5.start,
10979
- end2 = _validDates5.end;
10980
- var mainTask = {
10981
- start: start,
10982
- end: end,
10983
- id: id,
10984
- name: name,
10985
- valuesToShow: valuesToShow,
10986
- secondaryStart: start2,
10987
- secondaryEnd: end2,
10988
- type: "project",
10989
- progress: 100,
10990
- isDisabled: false,
10991
- hideChildren: false
10992
- };
10993
- var children1 = (phases != null ? phases : []).map(convertPhaseToTask);
10994
- var children2 = (details != null ? details : []).map(convertDetailToTimeline);
10995
- return [mainTask].concat(children1, children2);
10996
- };
10997
- var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref3) {
10998
- var id = _ref3.id,
10999
- start = _ref3.start,
11000
- end = _ref3.end;
11001
- return projects.map(function (project) {
11002
- return project.id === id ? withNewDates(project, start, end) : project;
11003
- });
11004
- };
11005
- var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref4) {
11006
- var id = _ref4.id,
11007
- start = _ref4.start,
11008
- end = _ref4.end;
11009
- if (phases) {
11010
- return phases.map(function (phase) {
11011
- return phase.id === id ? withNewDates(phase, start, end) : phase;
11012
- });
11013
- }
11014
- return undefined;
11015
- };
11016
- var withNewDates = function withNewDates(p, start, end) {
11017
- var startDate = formatToIsoDate(start);
11018
- var endDate = formatToIsoDate(end);
11019
- var extra = {
11020
- startDate: startDate,
11021
- endDate: endDate
11022
- };
11023
- return _extends({}, p, extra);
11024
- };
11025
-
11026
11235
  var cachedFormats = {};
11027
11236
  var getOrBuildCachedFormat = function getOrBuildCachedFormat(locale, options) {
11028
11237
  var _cachedFormats$key;
@@ -11035,8 +11244,8 @@ var format = function format(date, locale, options) {
11035
11244
  var format1 = getOrBuildCachedFormat(locale, options).format(date);
11036
11245
  return format1;
11037
11246
  } catch (e) {
11038
- console.log("time-formatters.ts format", date, locale, options);
11039
- console.log(e);
11247
+ console.error("time-formatters.ts format", date, locale, options);
11248
+ console.error(e);
11040
11249
  }
11041
11250
  };
11042
11251
  var dayFormatter = function dayFormatter(date, locale) {
@@ -11059,120 +11268,23 @@ var ganttDateTimeFormatters = {
11059
11268
  month: monthFormatter
11060
11269
  };
11061
11270
 
11062
- var _excluded = ["projects", "timeUnit", "TooltipContent", "TaskListHeader", "TaskListTable", "onDateChange", "onClick", "stylingOptions"];
11063
- var locale = "it-IT";
11064
- var GanttByTask = function GanttByTask(_ref) {
11065
- var _stylingOptions$preSt, _DateTime$now$minus;
11066
- var _ref$projects = _ref.projects,
11067
- projects = _ref$projects === void 0 ? [] : _ref$projects,
11068
- _ref$timeUnit = _ref.timeUnit,
11069
- timeUnit = _ref$timeUnit === void 0 ? TimeUnit.DAY : _ref$timeUnit,
11070
- TooltipContent = _ref.TooltipContent,
11071
- TaskListHeader = _ref.TaskListHeader,
11072
- TaskListTable = _ref.TaskListTable,
11073
- onDateChange = _ref.onDateChange,
11074
- onClick = _ref.onClick,
11075
- _ref$stylingOptions = _ref.stylingOptions,
11076
- stylingOptions = _ref$stylingOptions === void 0 ? {} : _ref$stylingOptions,
11077
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
11078
- var _useState = react.useState(projects),
11079
- currentProjects = _useState[0],
11080
- setCurrentProjects = _useState[1];
11081
- react.useEffect(function () {
11082
- if (projects) setCurrentProjects(projects);
11083
- }, [projects]);
11084
- var _useState2 = react.useState(1),
11085
- key = _useState2[0],
11086
- setKey = _useState2[1];
11087
- var tasks = react.useMemo(function () {
11088
- setKey(function (k) {
11089
- return k + 1;
11090
- });
11091
- return currentProjects.flatMap(convertProjectToTasks);
11092
- }, [currentProjects]);
11093
- var getProjectById = function getProjectById(id) {
11094
- return currentProjects.find(function (p) {
11095
- return p.id === id;
11096
- });
11097
- };
11098
- var handleClick = function handleClick(task) {
11099
- var id = task === null || task === void 0 ? void 0 : task.id;
11100
- console.log("gantt-by-task.tsx onClick", id);
11101
- var project = getProjectById(id);
11102
- if (project) onClick === null || onClick === void 0 ? void 0 : onClick(project);
11103
- var phase = currentProjects.flatMap(function (p) {
11104
- return p.phases;
11105
- }).find(function (ph) {
11106
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11107
- });
11108
- if (phase) onClick === null || onClick === void 0 ? void 0 : onClick(phase);
11109
- };
11110
- var handleDateChange = function handleDateChange(task) {
11111
- var id = task === null || task === void 0 ? void 0 : task.id;
11112
- console.log("gantt-by-task.tsx onDateChange", id);
11113
- var project = getProjectById(id);
11114
- if (project) {
11115
- var result = mergeTaskIntoProjects(currentProjects, task);
11116
- setCurrentProjects(result);
11117
- var _project = result.find(function (p) {
11118
- return p.id === id;
11119
- });
11120
- if (_project) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(_project);
11121
- return;
11122
- }
11123
- var parentOfClickedPhase = currentProjects.find(function (p) {
11124
- var _p$phases;
11125
- return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11126
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11127
- });
11128
- });
11129
- if (parentOfClickedPhase) {
11130
- var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11131
- var updatedProjects = currentProjects.map(function (p) {
11132
- return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11133
- phases: phases
11134
- }) : p;
11135
- });
11136
- setCurrentProjects(updatedProjects);
11137
- var phase = updatedProjects.flatMap(function (p) {
11138
- return p.phases;
11139
- }).find(function (ph) {
11140
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11141
- });
11142
- if (phase) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(phase);
11143
- }
11144
- };
11145
- 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();
11146
- console.log("gantt-by-task.tsx TASKS", tasks);
11147
- var returnElement = (tasks === null || tasks === void 0 ? void 0 : tasks.length) > 0 && react.createElement(Gantt, Object.assign({
11148
- key: key,
11149
- tasks: tasks,
11150
- locale: locale,
11151
- viewMode: toViewMode(timeUnit),
11152
- viewDate: viewDate,
11153
- onClick: handleClick,
11154
- onDateChange: handleDateChange,
11155
- TooltipContent: TooltipContent,
11156
- TaskListHeader: TaskListHeader,
11157
- TaskListTable: TaskListTable,
11158
- dateTimeFormatters: ganttDateTimeFormatters
11159
- }, stylingOptions, props));
11160
- if (returnElement) {
11161
- return returnElement;
11162
- } else {
11163
- return react.createElement("div", null);
11164
- }
11165
- };
11166
-
11167
- var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA"};
11271
+ var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA","filter":"_2cfRI"};
11168
11272
 
11169
- var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView) {
11170
- var CustomTaskListHeader = function CustomTaskListHeader() {
11273
+ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView, onFilterInput) {
11274
+ var CustomTaskListHeader = function CustomTaskListHeader(_ref) {
11275
+ var headerHeight = _ref.headerHeight,
11276
+ fontFamily = _ref.fontFamily,
11277
+ fontSize = _ref.fontSize;
11171
11278
  return react.createElement("div", {
11279
+ style: {
11280
+ fontFamily: fontFamily,
11281
+ fontSize: fontSize,
11282
+ height: headerHeight
11283
+ },
11172
11284
  className: classes$1.wrapper
11173
11285
  }, react.createElement("div", {
11174
11286
  className: classes$1.title
11175
- }, react.createElement("span", null, label)), react.createElement("div", {
11287
+ }, react.createElement("span", null, label)), setDoubleView && react.createElement("div", {
11176
11288
  className: classes$1.toggler
11177
11289
  }, react.createElement("label", {
11178
11290
  htmlFor: "ch2",
@@ -11189,12 +11301,21 @@ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView
11189
11301
  className: classes$1.slider
11190
11302
  })), react.createElement("span", {
11191
11303
  className: classes$1.label
11192
- }, "Mostra previsioni")));
11304
+ }, "Mostra previsioni")), react.createElement("div", {
11305
+ className: classes$1.filter
11306
+ }, react.createElement("input", {
11307
+ type: "text",
11308
+ name: "filter",
11309
+ size: 30,
11310
+ onInput: function onInput(e) {
11311
+ return onFilterInput === null || onFilterInput === void 0 ? void 0 : onFilterInput(e);
11312
+ }
11313
+ })));
11193
11314
  };
11194
11315
  return CustomTaskListHeader;
11195
11316
  };
11196
11317
 
11197
- var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW","timelineWrapper":"_1H4ue"};
11318
+ var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW"};
11198
11319
 
11199
11320
  var ProjectRow = function ProjectRow(_ref) {
11200
11321
  var _ref$task = _ref.task,
@@ -11220,7 +11341,7 @@ var ProjectRow = function ProjectRow(_ref) {
11220
11341
  "--grid-project-columns": str
11221
11342
  };
11222
11343
  return react.createElement("div", {
11223
- key: id,
11344
+ key: "task_" + id,
11224
11345
  className: styles$9.project,
11225
11346
  style: customStyle,
11226
11347
  onClick: function onClick() {
@@ -11231,7 +11352,7 @@ var ProjectRow = function ProjectRow(_ref) {
11231
11352
  return react.createElement("span", {
11232
11353
  className: index === 0 ? styles$9.main : undefined,
11233
11354
  title: v.length > 10 ? v : undefined,
11234
- key: id + "_valuesToShow_" + index
11355
+ key: "task_" + id + "_valuesToShow_" + index
11235
11356
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11236
11357
  }));
11237
11358
  };
@@ -11260,7 +11381,7 @@ var SubRow = function SubRow(_ref2) {
11260
11381
  "--grid-fasi-columns": str
11261
11382
  };
11262
11383
  return react.createElement("div", {
11263
- key: id,
11384
+ key: "phase_" + id,
11264
11385
  className: styles$9.subrow,
11265
11386
  style: customStyle,
11266
11387
  onClick: function onClick() {
@@ -11268,7 +11389,7 @@ var SubRow = function SubRow(_ref2) {
11268
11389
  onclickTaskList(id);
11269
11390
  }
11270
11391
  }, react.createElement("span", {
11271
- key: id + "_valuesToShow_color",
11392
+ key: "phase_" + id + "_valuesToShow_color",
11272
11393
  style: {
11273
11394
  height: 16,
11274
11395
  width: 16,
@@ -11278,41 +11399,42 @@ var SubRow = function SubRow(_ref2) {
11278
11399
  return react.createElement("span", {
11279
11400
  className: index === 0 ? styles$9.main : undefined,
11280
11401
  title: v.length > 10 ? v : undefined,
11281
- key: id + "_valuesToShow_" + index
11402
+ key: "phase_" + id + "_valuesToShow_" + index
11282
11403
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11283
11404
  }));
11284
11405
  };
11285
11406
  var TimelineSubRow = function TimelineSubRow(_ref3) {
11286
11407
  var _ref3$task = _ref3.task,
11287
11408
  id = _ref3$task.id,
11288
- name = _ref3$task.name,
11409
+ valuesToShow = _ref3$task.valuesToShow,
11289
11410
  rowHeight = _ref3.rowHeight,
11290
11411
  rowWidth = _ref3.rowWidth,
11291
11412
  fontFamily = _ref3.fontFamily,
11292
11413
  fontSize = _ref3.fontSize;
11414
+ var str = "";
11415
+ for (var i = 0; i < valuesToShow.length; i++) {
11416
+ str += "1fr ";
11417
+ }
11418
+ var customStyle = {
11419
+ height: rowHeight,
11420
+ width: rowWidth,
11421
+ fontFamily: fontFamily,
11422
+ fontSize: fontSize,
11423
+ "--grid-fasi-columns": str
11424
+ };
11293
11425
  return react.createElement("div", {
11294
- key: id,
11295
- className: styles$9.timelineWrapper,
11296
- style: {
11297
- height: rowHeight,
11298
- width: rowWidth,
11299
- fontFamily: fontFamily,
11300
- fontSize: fontSize
11301
- }
11302
- }, react.createElement("div", {
11426
+ key: "detail_" + id,
11303
11427
  className: styles$9.timeline,
11304
- style: {
11305
- height: rowHeight - 5
11306
- }
11307
- }, react.createElement("span", {
11308
- key: id + "_valuesToShow_0"
11309
- }, name), react.createElement("span", {
11310
- key: id + "_valuesToShow_1"
11311
- }, "A"), react.createElement("span", {
11312
- key: id + "_valuesToShow_2"
11313
- }, "A")));
11428
+ style: customStyle
11429
+ }, valuesToShow === null || valuesToShow === void 0 ? void 0 : valuesToShow.map(function (v, index) {
11430
+ return react.createElement("span", {
11431
+ className: index === 0 ? styles$9.main : undefined,
11432
+ title: v.length > 10 ? v : undefined,
11433
+ key: "detail_" + id + "_valuesToShow_" + index
11434
+ }, v);
11435
+ }));
11314
11436
  };
11315
- var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11437
+ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id) {
11316
11438
  var CustomTaskListTable = function CustomTaskListTable(_ref4) {
11317
11439
  var rowHeight = _ref4.rowHeight,
11318
11440
  rowWidth = _ref4.rowWidth,
@@ -11321,9 +11443,12 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11321
11443
  tasks = _ref4.tasks,
11322
11444
  setSelectedTask = _ref4.setSelectedTask;
11323
11445
  return react.createElement("div", {
11324
- className: styles$9.container
11446
+ className: styles$9.container,
11447
+ key: "tasks_container_" + id
11325
11448
  }, tasks.map(function (task) {
11326
- return react.createElement(react.Fragment, null, task.type === "project" && react.createElement(ProjectRow, {
11449
+ return react.createElement(react.Fragment, {
11450
+ key: task.id
11451
+ }, task.type === "project" && react.createElement(ProjectRow, {
11327
11452
  key: task.id + "_" + task.type,
11328
11453
  task: task,
11329
11454
  rowHeight: rowHeight,
@@ -11408,49 +11533,258 @@ var Switcher = function Switcher(_ref) {
11408
11533
  };
11409
11534
 
11410
11535
  var Planner = function Planner(props) {
11411
- var _props$showSecondaryD, _props$taskListHeader, _props$taskListTableP, _props$tooltipContent;
11536
+ var _props$secondaryGantt, _props$mainGantt$show, _props$mainGantt$task, _props$mainGantt$task2, _props$mainGantt$tool, _props$secondaryGantt3, _props$secondaryGantt4, _props$secondaryGantt5, _props$secondaryGantt6;
11412
11537
  var _useState = react.useState(TimeUnit.MONTH),
11413
11538
  timeUnit = _useState[0],
11414
11539
  setTimeUnit = _useState[1];
11415
- var _useState2 = react.useState((_props$showSecondaryD = props.showSecondaryDates) != null ? _props$showSecondaryD : false),
11416
- doubleView = _useState2[0],
11417
- setDoubleView = _useState2[1];
11418
- var commonProps = {
11419
- hideLabel: props.hideLabel,
11420
- showSecondaryDates: doubleView,
11421
- ganttHeight: props.ganttHeight,
11422
- hideDependencies: props.hideDependencies
11540
+ var _useState2 = react.useState(props.mainGantt.items),
11541
+ currentTasks = _useState2[0],
11542
+ setCurrentTasks = _useState2[1];
11543
+ var _useState3 = react.useState((_props$secondaryGantt = props.secondaryGantt) === null || _props$secondaryGantt === void 0 ? void 0 : _props$secondaryGantt.items),
11544
+ currentDetails = _useState3[0],
11545
+ setCurrentDetails = _useState3[1];
11546
+ var _useState4 = react.useState((_props$mainGantt$show = props.mainGantt.showSecondaryDates) != null ? _props$mainGantt$show : false),
11547
+ mainGanttDoubleView = _useState4[0],
11548
+ setMainGanttDoubleView = _useState4[1];
11549
+ var _useState5 = react.useState(calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount)),
11550
+ displayedDates = _useState5[0],
11551
+ setDisplayedDates = _useState5[1];
11552
+ var _useState6 = react.useState(),
11553
+ viewDate = _useState6[0],
11554
+ setViewDate = _useState6[1];
11555
+ var _useState7 = react.useState(),
11556
+ projection = _useState7[0],
11557
+ setProjection = _useState7[1];
11558
+ var locale = "it-IT";
11559
+ var onFilterInput = function onFilterInput(e) {
11560
+ console.log("PLANNER onFilterInput", e);
11423
11561
  };
11424
- console.log("planner.tsx commonProps", commonProps);
11425
- return react.createElement("div", {
11426
- style: {
11427
- maxWidth: "90vw"
11562
+ var handleClick = function handleClick(row, onClick) {
11563
+ if (!row) {
11564
+ return;
11565
+ }
11566
+ if (row.type === "task" && props.secondaryGantt) {
11567
+ var _phase$color;
11568
+ var phase = row;
11569
+ setProjection({
11570
+ start: new Date(phase.startDate),
11571
+ end: new Date(phase.endDate),
11572
+ color: (_phase$color = phase.color) != null ? _phase$color : "#ED7D31"
11573
+ });
11574
+ } else {
11575
+ setProjection(undefined);
11428
11576
  }
11429
- }, react.createElement(Switcher, {
11577
+ onClick === null || onClick === void 0 ? void 0 : onClick(row);
11578
+ };
11579
+ var handleDateChange = function handleDateChange(task, currentProjects, onDateChange) {
11580
+ var id = task === null || task === void 0 ? void 0 : task.id;
11581
+ if (!id) {
11582
+ return;
11583
+ }
11584
+ var row = getProjectById(id, currentProjects);
11585
+ if (!row) {
11586
+ row = getPhaseById(id, currentProjects);
11587
+ }
11588
+ if (!row) {
11589
+ return;
11590
+ }
11591
+ if (row.type === "timeline") {
11592
+ console.log("planner.tsx onDateChange for timeline not managed yet", id, row.type);
11593
+ return;
11594
+ }
11595
+ if (row.type === "project") {
11596
+ var result = mergeTaskIntoProjects(currentProjects, task);
11597
+ row = getProjectById(row.id, result);
11598
+ setViewDate(task.start);
11599
+ setCurrentTasks(result);
11600
+ } else if (row.type === "task") {
11601
+ var parentOfClickedPhase = currentProjects.find(function (p) {
11602
+ var _p$phases;
11603
+ return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11604
+ return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11605
+ });
11606
+ });
11607
+ if (parentOfClickedPhase) {
11608
+ var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11609
+ var updatedProjects = currentProjects.map(function (p) {
11610
+ return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11611
+ phases: phases
11612
+ }) : p;
11613
+ });
11614
+ row = getPhaseById(row.id, updatedProjects);
11615
+ if (props.secondaryGantt && row) {
11616
+ var _row$color;
11617
+ setProjection({
11618
+ start: new Date(row.startDate),
11619
+ end: new Date(row.endDate),
11620
+ color: (_row$color = row.color) != null ? _row$color : "#ED7D31"
11621
+ });
11622
+ }
11623
+ setViewDate(task.start);
11624
+ setCurrentTasks(updatedProjects);
11625
+ }
11626
+ }
11627
+ onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(row);
11628
+ };
11629
+ react.useEffect(function () {
11630
+ var _props$secondaryGantt2;
11631
+ setCurrentTasks(props.mainGantt.items);
11632
+ setCurrentDetails((_props$secondaryGantt2 = props.secondaryGantt) === null || _props$secondaryGantt2 === void 0 ? void 0 : _props$secondaryGantt2.items);
11633
+ setProjection(undefined);
11634
+ }, [props]);
11635
+ react.useEffect(function () {
11636
+ var dates = calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount);
11637
+ setDisplayedDates(dates);
11638
+ if (!viewDate) {
11639
+ setViewDate(dates.displayedStartDate);
11640
+ }
11641
+ }, [currentTasks, currentDetails]);
11642
+ var tasks = [];
11643
+ for (var i = 0; i < currentTasks.length; i++) {
11644
+ tasks.push.apply(tasks, convertProjectToTasks(currentTasks[i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11645
+ }
11646
+ var details = [];
11647
+ if (currentDetails) {
11648
+ for (var _i = 0; _i < currentDetails.length; _i++) {
11649
+ details.push.apply(details, convertProjectToTasks(currentDetails[_i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11650
+ }
11651
+ }
11652
+ return react.createElement("div", null, react.createElement(Switcher, {
11430
11653
  onTimeUnitChange: function onTimeUnitChange(timeUnit) {
11431
11654
  return setTimeUnit(timeUnit);
11432
11655
  }
11433
- }), react.createElement(GanttByTask, Object.assign({}, commonProps, {
11434
- projects: props.items,
11435
- timeUnit: timeUnit,
11436
- stylingOptions: props.stylingOptions,
11437
- onClick: function onClick(row) {
11438
- var _props$onClick;
11439
- return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, row);
11656
+ }), react.createElement("div", {
11657
+ style: {
11658
+ display: "flex",
11659
+ flexDirection: "column"
11660
+ }
11661
+ }, react.createElement(Gantt, Object.assign({
11662
+ id: "main",
11663
+ key: "main",
11664
+ hideLabel: props.mainGantt.hideLabel,
11665
+ showSecondaryDates: mainGanttDoubleView,
11666
+ hideDependencies: props.mainGantt.hideDependencies,
11667
+ ganttHeight: props.mainGantt.ganttHeight,
11668
+ displayedStartDate: displayedDates.displayedStartDate,
11669
+ displayedEndDate: displayedDates.displayedEndDate,
11670
+ viewDate: viewDate,
11671
+ tasks: tasks,
11672
+ viewMode: toViewMode(timeUnit)
11673
+ }, props.mainGantt.stylingOptions, {
11674
+ TaskListHeader: (_props$mainGantt$task = props.mainGantt.taskListHeaderProject) != null ? _props$mainGantt$task : CustomTaskListHeaderHOC(props.mainGantt.title, mainGanttDoubleView != null ? mainGanttDoubleView : false, setMainGanttDoubleView, onFilterInput),
11675
+ TaskListTable: (_props$mainGantt$task2 = props.mainGantt.taskListTableProject) != null ? _props$mainGantt$task2 : CustomTaskListTableHOC(function (id) {
11676
+ var row = getProjectById(id, currentTasks);
11677
+ if (!row) {
11678
+ row = getPhaseById(id, currentTasks);
11679
+ }
11680
+ if (row) {
11681
+ handleClick(row, props.mainGantt.onClick);
11682
+ }
11683
+ }, "main"),
11684
+ TooltipContent: (_props$mainGantt$tool = props.mainGantt.tooltipContent) != null ? _props$mainGantt$tool : CustomTooltipHOC(),
11685
+ onClick: function onClick(e) {
11686
+ var row = getProjectById(e.id, currentTasks);
11687
+ if (!row) {
11688
+ row = getPhaseById(e.id, currentTasks);
11689
+ }
11690
+ if (row) {
11691
+ handleClick(row, props.mainGantt.onClick);
11692
+ }
11440
11693
  },
11441
- onDateChange: function onDateChange(row) {
11442
- var _props$onDateChange;
11443
- return (_props$onDateChange = props.onDateChange) === null || _props$onDateChange === void 0 ? void 0 : _props$onDateChange.call(props, row);
11694
+ onDateChange: function onDateChange(e) {
11695
+ return handleDateChange(e, currentTasks, props.mainGantt.onDateChange);
11444
11696
  },
11445
- TaskListHeader: (_props$taskListHeader = props.taskListHeaderProject) != null ? _props$taskListHeader : CustomTaskListHeaderHOC(props.title, doubleView != null ? doubleView : true, setDoubleView),
11446
- TaskListTable: (_props$taskListTableP = props.taskListTableProject) != null ? _props$taskListTableP : CustomTaskListTableHOC(function (id) {
11447
- console.log("planner.tsx Clicked on " + id);
11448
- }),
11449
- TooltipContent: (_props$tooltipContent = props.tooltipContent) != null ? _props$tooltipContent : CustomTooltipHOC()
11450
- })));
11697
+ locale: locale,
11698
+ dateTimeFormatters: ganttDateTimeFormatters
11699
+ })), props.secondaryGantt && react.createElement(Gantt, Object.assign({
11700
+ id: "secondary",
11701
+ key: "secondary",
11702
+ hideLabel: props.secondaryGantt.hideLabel,
11703
+ showSecondaryDates: mainGanttDoubleView,
11704
+ hideDependencies: props.secondaryGantt.hideDependencies,
11705
+ ganttHeight: props.secondaryGantt.ganttHeight,
11706
+ displayedStartDate: displayedDates.displayedStartDate,
11707
+ displayedEndDate: displayedDates.displayedEndDate,
11708
+ viewDate: viewDate,
11709
+ tasks: details,
11710
+ viewMode: toViewMode(timeUnit)
11711
+ }, props.mainGantt.stylingOptions, {
11712
+ TaskListHeader: (_props$secondaryGantt3 = props.secondaryGantt.taskListHeaderProject) != null ? _props$secondaryGantt3 : CustomTaskListHeaderHOC(props.secondaryGantt.title, undefined, undefined, onFilterInput),
11713
+ TaskListTable: (_props$secondaryGantt4 = (_props$secondaryGantt5 = props.secondaryGantt) === null || _props$secondaryGantt5 === void 0 ? void 0 : _props$secondaryGantt5.taskListTableProject) != null ? _props$secondaryGantt4 : CustomTaskListTableHOC(function (id) {
11714
+ console.log("planner.tsx secondaryGantt Clicked on " + id);
11715
+ }, "secondary"),
11716
+ TooltipContent: (_props$secondaryGantt6 = props.secondaryGantt.tooltipContent) != null ? _props$secondaryGantt6 : CustomTooltipHOC(),
11717
+ projection: projection,
11718
+ onClick: function onClick(e) {
11719
+ if (props.secondaryGantt) {
11720
+ var row = getProjectById(e.id, currentDetails);
11721
+ if (row) {
11722
+ handleClick(row, props.secondaryGantt.onClick);
11723
+ }
11724
+ }
11725
+ },
11726
+ onDateChange: function onDateChange(e) {
11727
+ var _props$secondaryGantt7;
11728
+ return handleDateChange(e, currentDetails, (_props$secondaryGantt7 = props.secondaryGantt) === null || _props$secondaryGantt7 === void 0 ? void 0 : _props$secondaryGantt7.onDateChange);
11729
+ },
11730
+ locale: locale,
11731
+ dateTimeFormatters: ganttDateTimeFormatters
11732
+ }))));
11451
11733
  };
11452
11734
 
11453
- 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}";
11735
+ const kupManager = kupManagerInstance();
11736
+ function sanitizeAllDates(startDateCell, endDateCell, secStartDateCell, secEndDateCell) {
11737
+ const sanitizedDateValues = sanitizeDates(startDateCell, endDateCell);
11738
+ let sanitizedSecDateValues = [];
11739
+ if (secStartDateCell && secEndDateCell) {
11740
+ if (isAtLeastOneDateValid(secStartDateCell, secEndDateCell)) {
11741
+ sanitizedSecDateValues = sanitizeDates(secStartDateCell, secEndDateCell);
11742
+ }
11743
+ else {
11744
+ sanitizedSecDateValues = [...sanitizedDateValues];
11745
+ }
11746
+ }
11747
+ return {
11748
+ dateValues: sanitizedDateValues,
11749
+ secDateValues: sanitizedSecDateValues,
11750
+ };
11751
+ }
11752
+ function sanitizeDates(startDateCell, endDateCell) {
11753
+ let returnValues = [startDateCell.value, endDateCell.value];
11754
+ if (isDateValid(startDateCell) && isDateValid(endDateCell)) {
11755
+ return returnValues;
11756
+ }
11757
+ else if (isDateValid(startDateCell)) {
11758
+ return [startDateCell.value, startDateCell.value];
11759
+ }
11760
+ else if (isDateValid(endDateCell)) {
11761
+ return [endDateCell.value, endDateCell.value];
11762
+ }
11763
+ else {
11764
+ return returnValues;
11765
+ }
11766
+ }
11767
+ function isDateValid(dateCell) {
11768
+ return (kupManager.objects.isDate(dateCell.obj) &&
11769
+ kupManager.dates.isValid(dateCell.value, KupDatesFormats.ISO_DATE));
11770
+ }
11771
+ function isAtLeastOneDateValid(startDateCell, endDateCell) {
11772
+ return isDateValid(startDateCell) || isDateValid(endDateCell);
11773
+ }
11774
+ function getValuesToShow(row, idCol, nameCol, dataColumns, columns, customToValuesFunction) {
11775
+ let toValuesFunction = () => columns.map((col) => {
11776
+ return getCellValueForDisplay(dataColumns.find((kCol) => kCol.name == col), row.cells[col]);
11777
+ });
11778
+ if (customToValuesFunction) {
11779
+ toValuesFunction = customToValuesFunction;
11780
+ }
11781
+ const valuesToShow = (columns === null || columns === void 0 ? void 0 : columns.length) >= 2
11782
+ ? toValuesFunction()
11783
+ : [row.cells[idCol].value, row.cells[nameCol].value];
11784
+ return valuesToShow;
11785
+ }
11786
+
11787
+ 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}";
11454
11788
 
11455
11789
  var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11456
11790
  if (kind === "a" && !f)
@@ -11468,7 +11802,7 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
11468
11802
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
11469
11803
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11470
11804
  };
11471
- var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_lastOnChangeReceived, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase, _KupPlanner_emitOnChangeEventsReceived;
11805
+ 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;
11472
11806
  const KupPlanner = class {
11473
11807
  constructor(hostRef) {
11474
11808
  registerInstance(this, hostRef);
@@ -11485,7 +11819,16 @@ const KupPlanner = class {
11485
11819
  this.plannerProps = undefined;
11486
11820
  this.customStyle = '';
11487
11821
  this.data = undefined;
11488
- this.dataRaw = undefined;
11822
+ this.detailData = undefined;
11823
+ this.detailColorCol = undefined;
11824
+ this.detailColumns = undefined;
11825
+ this.detailDates = undefined;
11826
+ this.detailHeight = undefined;
11827
+ this.detailIdCol = undefined;
11828
+ this.detailNameCol = undefined;
11829
+ this.detailPrevDates = undefined;
11830
+ this.listCellWidth = '300px';
11831
+ this.maxWidth = '90vw';
11489
11832
  this.phaseColorCol = undefined;
11490
11833
  this.phaseColumns = undefined;
11491
11834
  this.phaseColParDep = undefined;
@@ -11493,8 +11836,10 @@ const KupPlanner = class {
11493
11836
  this.phaseIdCol = undefined;
11494
11837
  this.phaseNameCol = undefined;
11495
11838
  this.phasePrevDates = undefined;
11839
+ this.showSecondaryDates = false;
11496
11840
  this.taskColumns = undefined;
11497
11841
  this.taskDates = undefined;
11842
+ this.taskHeight = undefined;
11498
11843
  this.taskIdCol = undefined;
11499
11844
  this.taskNameCol = undefined;
11500
11845
  this.taskPrevDates = undefined;
@@ -11548,21 +11893,29 @@ const KupPlanner = class {
11548
11893
  var _a;
11549
11894
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11550
11895
  if (task) {
11551
- task.phases = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
11896
+ 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) => {
11897
+ const datesSanitized = sanitizeAllDates(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]], row.cells[this.phasePrevDates[0]], row.cells[this.phasePrevDates[1]]);
11898
+ const valuesToShow = getValuesToShow(row, this.phaseIdCol, this.phaseNameCol, data.columns, this.phaseColumns, () => this.phaseColumns.map((col) => col == this.phaseDates[0]
11899
+ ? '#START#'
11900
+ : col == this.phaseDates[1]
11901
+ ? '#END#'
11902
+ : getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
11552
11903
  let phase = {
11553
11904
  taskRow: task.taskRow,
11554
11905
  phaseRow: row,
11555
- id: row.cells[this.phaseIdCol].value,
11906
+ id: task.id + '_' + row.cells[this.phaseIdCol].value,
11556
11907
  phaseRowId: row.id,
11557
11908
  taskRowId: task.taskRowId,
11558
11909
  name: row.cells[this.phaseNameCol].value,
11559
- startDate: row.cells[this.phaseDates[0]].value,
11560
- endDate: row.cells[this.phaseDates[1]].value,
11561
- secondaryStartDate: row.cells[this.phasePrevDates[0]].value,
11562
- secondaryEndDate: row.cells[this.phasePrevDates[1]].value,
11563
- type: 'phase',
11910
+ startDate: datesSanitized.dateValues[0],
11911
+ endDate: datesSanitized.dateValues[1],
11912
+ secondaryStartDate: datesSanitized.secDateValues[0],
11913
+ secondaryEndDate: datesSanitized.secDateValues[1],
11914
+ type: 'task',
11564
11915
  color: row.cells[this.phaseColorCol].value,
11565
- valuesToShow: this.phaseColumns.map((col) => row.cells[col].value),
11916
+ selectedColor: row.cells[this.phaseColorCol].value,
11917
+ valuesToShow: valuesToShow,
11918
+ rowType: KupPlannerGanttRowType.PHASE,
11566
11919
  };
11567
11920
  return phase;
11568
11921
  });
@@ -11571,8 +11924,8 @@ const KupPlanner = class {
11571
11924
  }
11572
11925
  handleOnClick(nativeEvent) {
11573
11926
  console.log('handleOnClick', nativeEvent);
11574
- switch (nativeEvent.type) {
11575
- case 'task':
11927
+ switch (nativeEvent.rowType) {
11928
+ case KupPlannerGanttRowType.TASK:
11576
11929
  const taskAction = nativeEvent.phases
11577
11930
  ? KupPlannerTaskAction.onClosing
11578
11931
  : KupPlannerTaskAction.onOpening;
@@ -11580,11 +11933,16 @@ const KupPlanner = class {
11580
11933
  this.onKupClick(nativeEvent, taskAction);
11581
11934
  }
11582
11935
  break;
11583
- case 'phase':
11936
+ case KupPlannerGanttRowType.PHASE:
11584
11937
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
11585
11938
  this.onKupClick(nativeEvent);
11586
11939
  }
11587
11940
  break;
11941
+ case KupPlannerGanttRowType.DETAIL:
11942
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
11943
+ this.onKupClick(nativeEvent);
11944
+ }
11945
+ break;
11588
11946
  }
11589
11947
  }
11590
11948
  handleOnDateChange(nativeEvent) {
@@ -11598,12 +11956,34 @@ const KupPlanner = class {
11598
11956
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.register(this);
11599
11957
  }
11600
11958
  componentDidLoad() {
11959
+ let details = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, this.detailData);
11960
+ if (details && details.length == 0) {
11961
+ details = undefined;
11962
+ }
11601
11963
  this.plannerProps = {
11602
- title: this.titleMess,
11603
- items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11604
- onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11605
- onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11964
+ mainGantt: {
11965
+ title: this.titleMess,
11966
+ items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11967
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11968
+ hideLabel: true,
11969
+ ganttHeight: this.taskHeight,
11970
+ showSecondaryDates: this.showSecondaryDates,
11971
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11972
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11973
+ },
11974
+ secondaryGantt: details
11975
+ ? {
11976
+ title: '',
11977
+ items: details,
11978
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11979
+ hideLabel: true,
11980
+ ganttHeight: this.detailHeight,
11981
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11982
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11983
+ }
11984
+ : undefined,
11606
11985
  };
11986
+ console.log('kup-planner.tsx componentDidLoad plannerProps', this.plannerProps);
11607
11987
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_renderReactPlannerElement).call(this);
11608
11988
  this.kupReady.emit({
11609
11989
  comp: this,
@@ -11619,7 +11999,8 @@ const KupPlanner = class {
11619
11999
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logRender(this, true);
11620
12000
  }
11621
12001
  render() {
11622
- return (h(Host, null, h("div", { id: componentWrapperId })));
12002
+ //console.log('kup-planner.tsx render');
12003
+ return (h(Host, null, h("div", { id: componentWrapperId, style: { maxWidth: this.maxWidth } })));
11623
12004
  }
11624
12005
  disconnectedCallback() {
11625
12006
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.unregister(this);
@@ -11636,28 +12017,70 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11636
12017
  }
11637
12018
  }, _KupPlanner_toTasks = function _KupPlanner_toTasks(data) {
11638
12019
  var _a;
11639
- let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
12020
+ 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) => {
12021
+ const datesSanitized = sanitizeAllDates(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]], row.cells[this.taskPrevDates[0]], row.cells[this.taskPrevDates[1]]);
12022
+ const valuesToShow = getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns);
11640
12023
  let task = {
11641
12024
  taskRow: row,
11642
12025
  taskRowId: row.id,
11643
12026
  id: row.cells[this.taskIdCol].value,
11644
12027
  name: row.cells[this.taskNameCol].value,
11645
- startDate: row.cells[this.taskDates[0]].value,
11646
- endDate: row.cells[this.taskDates[1]].value,
11647
- secondaryStartDate: row.cells[this.taskPrevDates[0]].value,
11648
- secondaryEndDate: row.cells[this.taskPrevDates[1]].value,
11649
- type: 'task',
11650
- valuesToShow: this.taskColumns.map((col) => row.cells[col].value),
12028
+ startDate: datesSanitized.dateValues[0],
12029
+ endDate: datesSanitized.dateValues[1],
12030
+ secondaryStartDate: datesSanitized.secDateValues[0],
12031
+ secondaryEndDate: datesSanitized.secDateValues[1],
12032
+ type: 'project',
12033
+ valuesToShow: valuesToShow,
12034
+ rowType: KupPlannerGanttRowType.TASK,
11651
12035
  };
11652
12036
  return task;
11653
12037
  });
11654
12038
  return tasks;
12039
+ }, _KupPlanner_toDetails = function _KupPlanner_toDetails(data) {
12040
+ let details = [];
12041
+ if (!data || !data.rows) {
12042
+ return details;
12043
+ }
12044
+ data.rows
12045
+ .filter((row) => isAtLeastOneDateValid(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]))
12046
+ .forEach((row) => {
12047
+ const detailId = row.cells[this.detailIdCol].value;
12048
+ const detailNameId = row.cells[this.detailNameCol].value;
12049
+ const datesSanitized = sanitizeAllDates(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]);
12050
+ const valuesToShow = getValuesToShow(row, this.detailIdCol, this.detailNameCol, data.columns, this.detailColumns);
12051
+ let detail = details.find((det) => det.id == detailId);
12052
+ if (!detail) {
12053
+ detail = {
12054
+ id: detailId,
12055
+ name: detailNameId,
12056
+ type: 'timeline',
12057
+ valuesToShow: valuesToShow,
12058
+ rowType: KupPlannerGanttRowType.DETAIL,
12059
+ schedule: [],
12060
+ };
12061
+ details.push(detail);
12062
+ }
12063
+ detail.schedule.push({
12064
+ startDate: datesSanitized.dateValues[0],
12065
+ endDate: datesSanitized.dateValues[1],
12066
+ color: this.detailColorCol
12067
+ ? row.cells[this.detailColorCol].value
12068
+ : '#D9D9D8',
12069
+ selectedColor: this.detailColorCol
12070
+ ? row.cells[this.detailColorCol].value
12071
+ : '#D9D9D8',
12072
+ });
12073
+ });
12074
+ return details;
11655
12075
  }, _KupPlanner_getTask = function _KupPlanner_getTask(taskId) {
11656
- return this.plannerProps.items.find((task) => task.id == taskId);
12076
+ return this.plannerProps.mainGantt.items.find((task) => task.id == taskId);
11657
12077
  }, _KupPlanner_removePhases = function _KupPlanner_removePhases(taskId) {
11658
12078
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11659
12079
  if (task)
11660
12080
  task.phases = undefined;
12081
+ // this.plannerProps.mainGantt = JSON.parse(
12082
+ // JSON.stringify(this.plannerProps.mainGantt)
12083
+ // );
11661
12084
  this.plannerProps = Object.assign({}, this.plannerProps);
11662
12085
  }, _KupPlanner_handleOnClickOnTask = function _KupPlanner_handleOnClickOnTask(nativeEvent) {
11663
12086
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, nativeEvent.id);
@@ -11667,6 +12090,8 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11667
12090
  return true;
11668
12091
  }, _KupPlanner_handleOnClickOnPhase = function _KupPlanner_handleOnClickOnPhase() {
11669
12092
  return true;
12093
+ }, _KupPlanner_handleOnClickOnDetail = function _KupPlanner_handleOnClickOnDetail() {
12094
+ return true;
11670
12095
  }, _KupPlanner_emitOnChangeEventsReceived = function _KupPlanner_emitOnChangeEventsReceived(nativeEvent) {
11671
12096
  let emitEvent = false;
11672
12097
  if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f")) {