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