@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
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-1f177abc.js');
6
- const kupManager = require('./kup-manager-22bb9699.js');
5
+ const index = require('./index-74433248.js');
6
+ const kupManager$1 = require('./kup-manager-10351449.js');
7
7
  const GenericVariables = require('./GenericVariables-a9ed17ee.js');
8
8
 
9
9
  /**
@@ -13,26 +13,44 @@ const GenericVariables = require('./GenericVariables-a9ed17ee.js');
13
13
  var KupPlannerProps;
14
14
  (function (KupPlannerProps) {
15
15
  KupPlannerProps["customStyle"] = "Custom style of the component.";
16
- KupPlannerProps["taskIdCol"] = "Unique task identifier";
17
- KupPlannerProps["taskNameCol"] = "Task name displayed";
18
- KupPlannerProps["taskDates"] = "Task duration, from (firstDate) to (secondDate)";
19
- KupPlannerProps["taskPrevDates"] = "Forecast task duration, from (firstDate) to (secondDate)";
20
- KupPlannerProps["taskColumns"] = "Columns containing informations displayed on the left box near the gantt";
21
- KupPlannerProps["phaseIdCol"] = "Unique phase identifier";
22
- KupPlannerProps["phaseNameCol"] = "Phase name displayed";
23
- KupPlannerProps["phaseDates"] = "Phase duration, from (firstDate) to (secondDate)";
24
- KupPlannerProps["phasePrevDates"] = "Forecast phase duration, from (firstDate) to (secondDate)";
25
- KupPlannerProps["phaseColumns"] = "Columns containing informations displayed on the left box near the gantt";
26
- KupPlannerProps["phaseColorCol"] = "Phase color in hex format";
27
- KupPlannerProps["phaseColParDep"] = "Names of the parent phases";
28
- KupPlannerProps["titleMess"] = "Message displayed";
29
- KupPlannerProps["data"] = "Dataset containg the task list";
16
+ KupPlannerProps["data"] = "Dataset containg the tasks list";
17
+ KupPlannerProps["detailData"] = "Dataset containg the details list";
18
+ KupPlannerProps["detailColorCol"] = "Column containing the detail color, in hex format";
19
+ KupPlannerProps["detailColumns"] = "Columns containing informations displayed in the left box, near the gantt of details";
20
+ KupPlannerProps["detailDates"] = "Columns containing detail duration, from (firstDate) to (secondDate)";
21
+ KupPlannerProps["detailHeight"] = "Height for detail gantt";
22
+ KupPlannerProps["detailIdCol"] = "Column containing unique detail identifier";
23
+ KupPlannerProps["detailNameCol"] = "Column containing detail name displayed";
24
+ KupPlannerProps["detailPrevDates"] = "Columns containing forecast detail duration, from (firstDate) to (secondDate)";
25
+ KupPlannerProps["listCellWidth"] = "Total size of the cells inside to the left box, near the gantt";
26
+ KupPlannerProps["maxWidth"] = "Max width for component";
27
+ KupPlannerProps["phaseColorCol"] = "Column containing the phase color in hex format";
28
+ KupPlannerProps["phaseColumns"] = "Columns containing informations displayed in the left box ,near the gantt of phases";
29
+ KupPlannerProps["phaseColParDep"] = "Column containing the name of the parent phases";
30
+ KupPlannerProps["phaseDates"] = "Columns containing phase duration, from (firstDate) to (secondDate)";
31
+ KupPlannerProps["phaseIdCol"] = "Column containing unique phase identifier";
32
+ KupPlannerProps["phaseNameCol"] = "Column containing phase name displayed";
33
+ KupPlannerProps["phasePrevDates"] = "Columns containing forecast phase duration, from (firstDate) to (secondDate)";
34
+ KupPlannerProps["showSecondaryDates"] = "Enable/disable display of secondary dates";
35
+ KupPlannerProps["taskColumns"] = "Columns containing informations displayed in the left box, near the gantt";
36
+ KupPlannerProps["taskDates"] = "Columns containing task duration, from (firstDate) to (secondDate)";
37
+ KupPlannerProps["taskHeight"] = "Height for main gantt";
38
+ KupPlannerProps["taskIdCol"] = "Column containing unique task identifier";
39
+ KupPlannerProps["taskNameCol"] = "Column containing task name displayed";
40
+ KupPlannerProps["taskPrevDates"] = "Columns containing forecast task duration, from (firstDate) to (secondDate)";
41
+ KupPlannerProps["titleMess"] = "Message displayed on top";
30
42
  })(KupPlannerProps || (KupPlannerProps = {}));
31
43
  var KupPlannerTaskAction;
32
44
  (function (KupPlannerTaskAction) {
33
45
  KupPlannerTaskAction["onOpening"] = "onOpening";
34
46
  KupPlannerTaskAction["onClosing"] = "onClosing";
35
47
  })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
48
+ var KupPlannerGanttRowType;
49
+ (function (KupPlannerGanttRowType) {
50
+ KupPlannerGanttRowType["TASK"] = "task";
51
+ KupPlannerGanttRowType["PHASE"] = "phase";
52
+ KupPlannerGanttRowType["DETAIL"] = "detail";
53
+ })(KupPlannerGanttRowType || (KupPlannerGanttRowType = {}));
36
54
  class KupPlannerLastOnChangeReceived {
37
55
  constructor(event, threshold = 100) {
38
56
  this.dateTime = new Date();
@@ -47,7 +65,20 @@ class KupPlannerLastOnChangeReceived {
47
65
  resetDateTime() {
48
66
  this.dateTime = new Date();
49
67
  }
50
- }
68
+ }
69
+ const defaultStylingOptions = {
70
+ listCellWidth: '300px',
71
+ rowHeight: 40,
72
+ barFill: 90,
73
+ projectProgressColor: '#CBCBCB',
74
+ projectProgressSelectedColor: '#CBCBCB',
75
+ projectBackgroundColor: '#CBCBCB',
76
+ projectBackgroundSelectedColor: '#CBCBCB',
77
+ barProgressColor: '#A2A415',
78
+ barProgressSelectedColor: '#A2A415',
79
+ barBackgroundColor: '#A2A415',
80
+ barBackgroundSelectedColor: '#A2A415',
81
+ };
51
82
 
52
83
  /**
53
84
  * @license React
@@ -114,17 +145,17 @@ var react_production_min = {
114
145
  version: version$1
115
146
  };
116
147
 
117
- kupManager.createCommonjsModule(function (module, exports) {
148
+ kupManager$1.createCommonjsModule(function (module, exports) {
118
149
  });
119
150
 
120
- var react = kupManager.createCommonjsModule(function (module) {
151
+ var react = kupManager$1.createCommonjsModule(function (module) {
121
152
 
122
153
  {
123
154
  module.exports = react_production_min;
124
155
  }
125
156
  });
126
157
 
127
- var scheduler_production_min = kupManager.createCommonjsModule(function (module, exports) {
158
+ var scheduler_production_min = kupManager$1.createCommonjsModule(function (module, exports) {
128
159
  function f(a,b){var c=a.length;a.push(b);a:for(;0<c;){var d=c-1>>>1,e=a[d];if(0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length,w=e>>>1;d<w;){var m=2*(d+1)-1,C=a[m],n=m+1,x=a[n];if(0>g(C,c))n<e&&0>g(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(n<e&&0>g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}
129
160
  function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()};}else {var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q};}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null;
130
161
  "undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t);}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else {var b=h(t);null!==b&&K(H,b.startTime-a);}}
@@ -137,10 +168,10 @@ exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"
137
168
  exports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c;}}};
138
169
  });
139
170
 
140
- kupManager.createCommonjsModule(function (module, exports) {
171
+ kupManager$1.createCommonjsModule(function (module, exports) {
141
172
  });
142
173
 
143
- var scheduler = kupManager.createCommonjsModule(function (module) {
174
+ var scheduler = kupManager$1.createCommonjsModule(function (module) {
144
175
 
145
176
  {
146
177
  module.exports = scheduler_production_min;
@@ -473,10 +504,10 @@ var reactDom_production_min = {
473
504
  version: version
474
505
  };
475
506
 
476
- kupManager.createCommonjsModule(function (module, exports) {
507
+ kupManager$1.createCommonjsModule(function (module, exports) {
477
508
  });
478
509
 
479
- var reactDom = kupManager.createCommonjsModule(function (module) {
510
+ var reactDom = kupManager$1.createCommonjsModule(function (module) {
480
511
 
481
512
  function checkDCE() {
482
513
  /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
@@ -504,7 +535,7 @@ function checkDCE() {
504
535
  }
505
536
  });
506
537
 
507
- var client = kupManager.createCommonjsModule(function (module, exports) {
538
+ var client = kupManager$1.createCommonjsModule(function (module, exports) {
508
539
 
509
540
 
510
541
  {
@@ -513,7 +544,7 @@ var client = kupManager.createCommonjsModule(function (module, exports) {
513
544
  }
514
545
  });
515
546
 
516
- var luxon = kupManager.createCommonjsModule(function (module, exports) {
547
+ var luxon = kupManager$1.createCommonjsModule(function (module, exports) {
517
548
 
518
549
  Object.defineProperty(exports, '__esModule', { value: true });
519
550
 
@@ -8350,18 +8381,6 @@ function _extends() {
8350
8381
  };
8351
8382
  return _extends.apply(this, arguments);
8352
8383
  }
8353
- function _objectWithoutPropertiesLoose(source, excluded) {
8354
- if (source == null) return {};
8355
- var target = {};
8356
- var sourceKeys = Object.keys(source);
8357
- var key, i;
8358
- for (i = 0; i < sourceKeys.length; i++) {
8359
- key = sourceKeys[i];
8360
- if (excluded.indexOf(key) >= 0) continue;
8361
- target[key] = source[key];
8362
- }
8363
- return target;
8364
- }
8365
8384
  function _unsupportedIterableToArray(o, minLen) {
8366
8385
  if (!o) return;
8367
8386
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -8405,6 +8424,230 @@ var ViewMode;
8405
8424
  ViewMode["Year"] = "Year";
8406
8425
  })(ViewMode || (ViewMode = {}));
8407
8426
 
8427
+ var TimeUnit;
8428
+ (function (TimeUnit) {
8429
+ TimeUnit["DAY"] = "days";
8430
+ TimeUnit["WEEK"] = "weeks";
8431
+ TimeUnit["MONTH"] = "months";
8432
+ TimeUnit["YEAR"] = "YEAR";
8433
+ })(TimeUnit || (TimeUnit = {}));
8434
+ var parseToDayStart = function parseToDayStart(ymd) {
8435
+ return luxon.DateTime.fromISO(ymd).toJSDate();
8436
+ };
8437
+ var parseToDayEnd = function parseToDayEnd(endDate) {
8438
+ return luxon.DateTime.fromISO(endDate).plus({
8439
+ seconds: 86400 - 1
8440
+ }).toJSDate();
8441
+ };
8442
+ var formatToIsoDate = function formatToIsoDate(date) {
8443
+ return luxon.DateTime.fromJSDate(date).toISODate();
8444
+ };
8445
+ var formatToLocaleSimple = function formatToLocaleSimple(date) {
8446
+ return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
8447
+ };
8448
+ function validDates(startDate, endDate, _name) {
8449
+ var _start;
8450
+ var start = parseToDayStart(startDate);
8451
+ var end = parseToDayEnd(endDate);
8452
+ if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
8453
+ start = parseToDayStart(endDate);
8454
+ }
8455
+ return {
8456
+ start: start,
8457
+ end: end
8458
+ };
8459
+ }
8460
+
8461
+ var toViewMode = function toViewMode(timeUnit) {
8462
+ switch (timeUnit) {
8463
+ case TimeUnit.DAY:
8464
+ return ViewMode.Day;
8465
+ case TimeUnit.WEEK:
8466
+ return ViewMode.Week;
8467
+ case TimeUnit.MONTH:
8468
+ return ViewMode.Month;
8469
+ case TimeUnit.YEAR:
8470
+ return ViewMode.Year;
8471
+ }
8472
+ };
8473
+ var convertPhaseToTask = function convertPhaseToTask(item) {
8474
+ var mapPhase = function mapPhase(_ref) {
8475
+ var phaseStart = _ref.startDate,
8476
+ phaseEnd = _ref.endDate,
8477
+ secondaryStartDate = _ref.secondaryStartDate,
8478
+ secondaryEndDate = _ref.secondaryEndDate,
8479
+ phaseName = _ref.name,
8480
+ phaseId = _ref.id,
8481
+ color = _ref.color,
8482
+ selectedColor = _ref.selectedColor,
8483
+ dependencies = _ref.dependencies;
8484
+ var _validDates = validDates(phaseStart, phaseEnd),
8485
+ start = _validDates.start,
8486
+ end = _validDates.end;
8487
+ var _validDates2 = validDates(secondaryStartDate, secondaryEndDate),
8488
+ phaseStart2 = _validDates2.start,
8489
+ phaseEnd2 = _validDates2.end;
8490
+ return {
8491
+ start: start,
8492
+ end: end,
8493
+ secondaryStart: phaseStart2,
8494
+ secondaryEnd: phaseEnd2,
8495
+ name: phaseName,
8496
+ valuesToShow: item.valuesToShow,
8497
+ id: phaseId,
8498
+ type: "task",
8499
+ progress: 100,
8500
+ dependencies: dependencies,
8501
+ styles: color ? {
8502
+ backgroundColor: color,
8503
+ progressColor: color,
8504
+ backgroundSelectedColor: selectedColor,
8505
+ progressSelectedColor: selectedColor
8506
+ } : {}
8507
+ };
8508
+ };
8509
+ return mapPhase(item);
8510
+ };
8511
+ var convertDetailToTimeline = function convertDetailToTimeline(item, mainGanttStartDate, mainGanttEndDate) {
8512
+ var id = item.id,
8513
+ name = item.name,
8514
+ schedule = item.schedule;
8515
+ var getDatesForTask = function getDatesForTask(item) {
8516
+ var start = mainGanttStartDate != null ? mainGanttStartDate : "";
8517
+ var end = mainGanttEndDate != null ? mainGanttEndDate : "";
8518
+ for (var i = 0; i < item.schedule.length; i++) {
8519
+ var lstart = item.schedule[i].startDate;
8520
+ var lend = item.schedule[i].endDate;
8521
+ if (!start || lstart.localeCompare(start) < 0) {
8522
+ start = lstart;
8523
+ }
8524
+ if (!end || lend.localeCompare(end) > 0) {
8525
+ end = lend;
8526
+ }
8527
+ }
8528
+ return validDates(start, end);
8529
+ };
8530
+ var _getDatesForTask = getDatesForTask(item),
8531
+ start = _getDatesForTask.start,
8532
+ end = _getDatesForTask.end;
8533
+ var convertToFrame = function convertToFrame(x) {
8534
+ var startDate = x.startDate,
8535
+ endDate = x.endDate,
8536
+ color = x.color,
8537
+ selectedColor = x.selectedColor;
8538
+ var _validDates3 = validDates(startDate, endDate),
8539
+ start = _validDates3.start,
8540
+ end = _validDates3.end;
8541
+ return {
8542
+ start: start,
8543
+ end: end,
8544
+ backgroundColor: color != null ? color : "0xffffff",
8545
+ backgroundSelectedColor: selectedColor != null ? selectedColor : color
8546
+ };
8547
+ };
8548
+ var defaultColor = "#595959";
8549
+ return {
8550
+ id: id,
8551
+ type: "timeline",
8552
+ timeline: schedule.map(convertToFrame),
8553
+ name: name,
8554
+ valuesToShow: item.valuesToShow,
8555
+ start: start,
8556
+ end: end,
8557
+ progress: 100,
8558
+ styles: {
8559
+ backgroundColor: defaultColor,
8560
+ progressColor: defaultColor,
8561
+ backgroundSelectedColor: defaultColor,
8562
+ progressSelectedColor: defaultColor
8563
+ }
8564
+ };
8565
+ };
8566
+ var isDetail = function isDetail(row) {
8567
+ return row && row.schedule && row.schedule.length !== 0;
8568
+ };
8569
+ var convertProjectToTasks = function convertProjectToTasks(item, mainGanttStartDate, mainGanttEndDate) {
8570
+ if (!isDetail(item)) {
8571
+ var _row$phases;
8572
+ var row = item;
8573
+ var _validDates4 = validDates(row.startDate, row.endDate),
8574
+ start = _validDates4.start,
8575
+ end = _validDates4.end;
8576
+ var _validDates5 = validDates(row.secondaryStartDate, row.secondaryEndDate),
8577
+ start2 = _validDates5.start,
8578
+ end2 = _validDates5.end;
8579
+ var mainTask = {
8580
+ start: start,
8581
+ end: end,
8582
+ id: row.id,
8583
+ name: row.name,
8584
+ type: row.type,
8585
+ valuesToShow: row.valuesToShow,
8586
+ secondaryStart: start2,
8587
+ secondaryEnd: end2,
8588
+ progress: 100,
8589
+ isDisabled: false,
8590
+ hideChildren: false
8591
+ };
8592
+ var children1 = ((_row$phases = row.phases) != null ? _row$phases : []).map(convertPhaseToTask);
8593
+ return [mainTask].concat(children1);
8594
+ } else {
8595
+ var _row = item;
8596
+ return [_extends({}, convertDetailToTimeline(_row, mainGanttStartDate, mainGanttEndDate))];
8597
+ }
8598
+ };
8599
+ var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref2) {
8600
+ var id = _ref2.id,
8601
+ start = _ref2.start,
8602
+ end = _ref2.end;
8603
+ return projects.map(function (project) {
8604
+ return project.id === id ? withNewDates(project, start, end) : project;
8605
+ });
8606
+ };
8607
+ var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref3) {
8608
+ var id = _ref3.id,
8609
+ start = _ref3.start,
8610
+ end = _ref3.end;
8611
+ if (phases) {
8612
+ return phases.map(function (phase) {
8613
+ return phase.id === id ? withNewDates(phase, start, end) : phase;
8614
+ });
8615
+ }
8616
+ return undefined;
8617
+ };
8618
+ var withNewDates = function withNewDates(p, start, end) {
8619
+ var startDate = formatToIsoDate(start);
8620
+ var endDate = formatToIsoDate(end);
8621
+ var extra = {
8622
+ startDate: startDate,
8623
+ endDate: endDate
8624
+ };
8625
+ return _extends({}, p, extra);
8626
+ };
8627
+ var getProjectById = function getProjectById(id, items) {
8628
+ for (var i = 0; i < items.length; i++) {
8629
+ if (items[i].id === id) {
8630
+ return items[i];
8631
+ }
8632
+ }
8633
+ return undefined;
8634
+ };
8635
+ var getPhaseById = function getPhaseById(id, items) {
8636
+ for (var i = 0; i < items.length; i++) {
8637
+ if (isDetail(items[i])) {
8638
+ continue;
8639
+ }
8640
+ var item = items[i];
8641
+ if (!item.phases) {
8642
+ continue;
8643
+ }
8644
+ for (var j = 0; j < item.phases.length; j++) if (item.phases[j].id === id) {
8645
+ return item.phases[j];
8646
+ }
8647
+ }
8648
+ return undefined;
8649
+ };
8650
+
8408
8651
  var intlDTCache = {};
8409
8652
  var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts) {
8410
8653
  if (opts === void 0) {
@@ -8419,80 +8662,157 @@ var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts)
8419
8662
  return dtf;
8420
8663
  };
8421
8664
  var addToDate = function addToDate(date, quantity, scale) {
8422
- 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));
8665
+ 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));
8423
8666
  return newDate;
8424
8667
  };
8425
8668
  var startOfDate = function startOfDate(date, scale) {
8426
- var scores = ['millisecond', 'second', 'minute', 'hour', 'day', 'month', 'year'];
8669
+ var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
8427
8670
  var shouldReset = function shouldReset(_scale) {
8428
8671
  var maxScore = scores.indexOf(scale);
8429
8672
  return scores.indexOf(_scale) <= maxScore;
8430
8673
  };
8431
- 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());
8674
+ 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());
8432
8675
  return newDate;
8433
8676
  };
8434
- var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates) {
8435
- var newStartDate = tasks[0].start;
8436
- var newEndDate = tasks[0].start;
8437
- for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8438
- var task = _step.value;
8439
- if (task.start < newStartDate) {
8440
- newStartDate = task.start;
8677
+ var ganttDateRangeFromTask = function ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, mainGanttStartDate, mainGanttEndDate) {
8678
+ var dates = [];
8679
+ tasks.forEach(function (item) {
8680
+ dates.push({
8681
+ start: item.start,
8682
+ end: item.end,
8683
+ secondaryStart: item.secondaryStart,
8684
+ secondaryEnd: item.secondaryEnd
8685
+ });
8686
+ });
8687
+ if (mainGanttStartDate && mainGanttEndDate) {
8688
+ dates.push({
8689
+ start: mainGanttStartDate,
8690
+ end: mainGanttEndDate,
8691
+ secondaryStart: undefined,
8692
+ secondaryEnd: undefined
8693
+ });
8694
+ }
8695
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates);
8696
+ };
8697
+ var calculateDisplayedDateRange = function calculateDisplayedDateRange(mainGanttItems, timeUnit, mainGanttDoubleView, secondaryGanttItems, preStepsCount) {
8698
+ var dates = ganttDateRangeFromGanttTask(mainGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8699
+ if (secondaryGanttItems) {
8700
+ var dates2 = ganttDateRangeFromDetail(secondaryGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8701
+ if (dates2[0] < dates[0]) {
8702
+ dates[0] = dates2[0];
8703
+ }
8704
+ if (dates2[1] > dates[1]) {
8705
+ dates[1] = dates2[1];
8706
+ }
8707
+ }
8708
+ return {
8709
+ displayedStartDate: dates[0],
8710
+ displayedEndDate: dates[1]
8711
+ };
8712
+ };
8713
+ var ganttDateRangeFromGanttTask = function ganttDateRangeFromGanttTask(tasks, viewMode, preStepsCount, showSecondaryDates) {
8714
+ var dates = [];
8715
+ tasks.forEach(function (item) {
8716
+ var _item$phases;
8717
+ dates.push({
8718
+ start: parseToDayStart(item.startDate),
8719
+ end: parseToDayEnd(item.endDate),
8720
+ secondaryStart: parseToDayStart(item.secondaryStartDate),
8721
+ secondaryEnd: parseToDayEnd(item.secondaryEndDate)
8722
+ });
8723
+ (_item$phases = item.phases) === null || _item$phases === void 0 ? void 0 : _item$phases.forEach(function (phase) {
8724
+ dates.push({
8725
+ start: parseToDayStart(phase.startDate),
8726
+ end: parseToDayEnd(phase.endDate),
8727
+ secondaryStart: parseToDayStart(phase.secondaryStartDate),
8728
+ secondaryEnd: parseToDayEnd(phase.secondaryEndDate)
8729
+ });
8730
+ });
8731
+ });
8732
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8733
+ };
8734
+ var ganttDateRangeFromDetail = function ganttDateRangeFromDetail(details, viewMode, preStepsCount, showSecondaryDates) {
8735
+ var dates = [];
8736
+ details.forEach(function (item) {
8737
+ var scheduleItems = item.schedule;
8738
+ if (scheduleItems) {
8739
+ scheduleItems.forEach(function (item) {
8740
+ dates.push({
8741
+ start: parseToDayStart(item.startDate),
8742
+ end: parseToDayEnd(item.endDate),
8743
+ secondaryStart: undefined,
8744
+ secondaryEnd: undefined
8745
+ });
8746
+ });
8747
+ }
8748
+ });
8749
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8750
+ };
8751
+ var ganttDateRangeGeneric = function ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, realDates) {
8752
+ var newStartDate = dates[0].start;
8753
+ var newEndDate = dates[0].end;
8754
+ for (var _iterator = _createForOfIteratorHelperLoose(dates), _step; !(_step = _iterator()).done;) {
8755
+ var d = _step.value;
8756
+ if (d.start < newStartDate) {
8757
+ newStartDate = d.start;
8441
8758
  }
8442
- if (task.end > newEndDate) {
8443
- newEndDate = task.end;
8759
+ if (d.end > newEndDate) {
8760
+ newEndDate = d.end;
8444
8761
  }
8445
8762
  if (showSecondaryDates) {
8446
- if (task.secondaryStart && task.secondaryStart < newStartDate) {
8447
- newStartDate = task.secondaryStart;
8763
+ if (d.secondaryStart && d.secondaryStart < newStartDate) {
8764
+ newStartDate = d.secondaryStart;
8448
8765
  }
8449
- if (task.secondaryEnd && task.secondaryEnd > newEndDate) {
8450
- newEndDate = task.secondaryEnd;
8766
+ if (d.secondaryEnd && d.secondaryEnd > newEndDate) {
8767
+ newEndDate = d.secondaryEnd;
8451
8768
  }
8452
8769
  }
8453
8770
  }
8771
+ if (realDates) {
8772
+ return [newStartDate, newEndDate];
8773
+ }
8454
8774
  switch (viewMode) {
8455
8775
  case ViewMode.Year:
8456
- newStartDate = addToDate(newStartDate, -1, 'year');
8457
- newStartDate = startOfDate(newStartDate, 'year');
8458
- newEndDate = addToDate(newEndDate, 1, 'year');
8459
- newEndDate = startOfDate(newEndDate, 'year');
8776
+ newStartDate = addToDate(newStartDate, -1, "year");
8777
+ newStartDate = startOfDate(newStartDate, "year");
8778
+ newEndDate = addToDate(newEndDate, 1, "year");
8779
+ newEndDate = startOfDate(newEndDate, "year");
8460
8780
  break;
8461
8781
  case ViewMode.Month:
8462
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'month');
8463
- newStartDate = startOfDate(newStartDate, 'month');
8464
- newEndDate = addToDate(newEndDate, 1, 'year');
8465
- newEndDate = startOfDate(newEndDate, 'year');
8782
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
8783
+ newStartDate = startOfDate(newStartDate, "month");
8784
+ newEndDate = addToDate(newEndDate, 1, "year");
8785
+ newEndDate = startOfDate(newEndDate, "year");
8466
8786
  break;
8467
8787
  case ViewMode.Week:
8468
- newStartDate = startOfDate(newStartDate, 'day');
8469
- newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, 'day');
8470
- newEndDate = startOfDate(newEndDate, 'day');
8471
- newEndDate = addToDate(newEndDate, 1.5, 'month');
8788
+ newStartDate = startOfDate(newStartDate, "day");
8789
+ newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, "day");
8790
+ newEndDate = startOfDate(newEndDate, "day");
8791
+ newEndDate = addToDate(newEndDate, 1.5, "month");
8472
8792
  break;
8473
8793
  case ViewMode.Day:
8474
- newStartDate = startOfDate(newStartDate, 'day');
8475
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8476
- newEndDate = startOfDate(newEndDate, 'day');
8477
- newEndDate = addToDate(newEndDate, 19, 'day');
8794
+ newStartDate = startOfDate(newStartDate, "day");
8795
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8796
+ newEndDate = startOfDate(newEndDate, "day");
8797
+ newEndDate = addToDate(newEndDate, 19, "day");
8478
8798
  break;
8479
8799
  case ViewMode.QuarterDay:
8480
- newStartDate = startOfDate(newStartDate, 'day');
8481
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8482
- newEndDate = startOfDate(newEndDate, 'day');
8483
- newEndDate = addToDate(newEndDate, 66, 'hour');
8800
+ newStartDate = startOfDate(newStartDate, "day");
8801
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8802
+ newEndDate = startOfDate(newEndDate, "day");
8803
+ newEndDate = addToDate(newEndDate, 66, "hour");
8484
8804
  break;
8485
8805
  case ViewMode.HalfDay:
8486
- newStartDate = startOfDate(newStartDate, 'day');
8487
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8488
- newEndDate = startOfDate(newEndDate, 'day');
8489
- newEndDate = addToDate(newEndDate, 108, 'hour');
8806
+ newStartDate = startOfDate(newStartDate, "day");
8807
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8808
+ newEndDate = startOfDate(newEndDate, "day");
8809
+ newEndDate = addToDate(newEndDate, 108, "hour");
8490
8810
  break;
8491
8811
  case ViewMode.Hour:
8492
- newStartDate = startOfDate(newStartDate, 'hour');
8493
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'hour');
8494
- newEndDate = startOfDate(newEndDate, 'day');
8495
- newEndDate = addToDate(newEndDate, 1, 'day');
8812
+ newStartDate = startOfDate(newStartDate, "hour");
8813
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
8814
+ newEndDate = startOfDate(newEndDate, "day");
8815
+ newEndDate = addToDate(newEndDate, 1, "day");
8496
8816
  break;
8497
8817
  }
8498
8818
  return [newStartDate, newEndDate];
@@ -8503,25 +8823,25 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8503
8823
  while (currentDate < endDate) {
8504
8824
  switch (viewMode) {
8505
8825
  case ViewMode.Year:
8506
- currentDate = addToDate(currentDate, 1, 'year');
8826
+ currentDate = addToDate(currentDate, 1, "year");
8507
8827
  break;
8508
8828
  case ViewMode.Month:
8509
- currentDate = addToDate(currentDate, 1, 'month');
8829
+ currentDate = addToDate(currentDate, 1, "month");
8510
8830
  break;
8511
8831
  case ViewMode.Week:
8512
- currentDate = addToDate(currentDate, 7, 'day');
8832
+ currentDate = addToDate(currentDate, 7, "day");
8513
8833
  break;
8514
8834
  case ViewMode.Day:
8515
- currentDate = addToDate(currentDate, 1, 'day');
8835
+ currentDate = addToDate(currentDate, 1, "day");
8516
8836
  break;
8517
8837
  case ViewMode.HalfDay:
8518
- currentDate = addToDate(currentDate, 12, 'hour');
8838
+ currentDate = addToDate(currentDate, 12, "hour");
8519
8839
  break;
8520
8840
  case ViewMode.QuarterDay:
8521
- currentDate = addToDate(currentDate, 6, 'hour');
8841
+ currentDate = addToDate(currentDate, 6, "hour");
8522
8842
  break;
8523
8843
  case ViewMode.Hour:
8524
- currentDate = addToDate(currentDate, 1, 'hour');
8844
+ currentDate = addToDate(currentDate, 1, "hour");
8525
8845
  break;
8526
8846
  }
8527
8847
  dates.push(currentDate);
@@ -8530,7 +8850,7 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8530
8850
  };
8531
8851
  var getLocaleMonth = function getLocaleMonth(date, locale) {
8532
8852
  var bottomValue = getCachedDateTimeFormat(locale, {
8533
- month: 'long'
8853
+ month: "long"
8534
8854
  }).format(date);
8535
8855
  bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
8536
8856
  return bottomValue;
@@ -8580,15 +8900,15 @@ var defaultDateTimeFormatters = {
8580
8900
  return "W" + getWeekNumberISO8601(date);
8581
8901
  },
8582
8902
  day: function day(date, locale) {
8583
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate().toString();
8903
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate().toString();
8584
8904
  },
8585
8905
  hour: function hour(date, locale) {
8586
8906
  return "" + getCachedDateTimeFormat(locale, {
8587
- hour: 'numeric'
8907
+ hour: "numeric"
8588
8908
  }).format(date);
8589
8909
  },
8590
8910
  dayAndMonth: function dayAndMonth(date, locale) {
8591
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8911
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8592
8912
  }
8593
8913
  };
8594
8914
 
@@ -8908,9 +9228,7 @@ var GridBody = function GridBody(_ref) {
8908
9228
  dates = _ref.dates,
8909
9229
  rowHeight = _ref.rowHeight,
8910
9230
  svgWidth = _ref.svgWidth,
8911
- columnWidth = _ref.columnWidth,
8912
- todayColor = _ref.todayColor,
8913
- rtl = _ref.rtl;
9231
+ columnWidth = _ref.columnWidth;
8914
9232
  var y = 0;
8915
9233
  var gridRows = [];
8916
9234
  var rowLines = [react.createElement("line", {
@@ -8924,7 +9242,7 @@ var GridBody = function GridBody(_ref) {
8924
9242
  for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8925
9243
  var task = _step.value;
8926
9244
  gridRows.push(react.createElement("rect", {
8927
- key: 'Row' + task.id,
9245
+ key: "Row" + task.id,
8928
9246
  x: "0",
8929
9247
  y: y,
8930
9248
  width: svgWidth,
@@ -8932,7 +9250,7 @@ var GridBody = function GridBody(_ref) {
8932
9250
  className: styles$4.gridRow
8933
9251
  }));
8934
9252
  rowLines.push(react.createElement("line", {
8935
- key: 'RowLine' + task.id,
9253
+ key: "RowLine" + task.id,
8936
9254
  x: "0",
8937
9255
  y1: y + rowHeight,
8938
9256
  x2: svgWidth,
@@ -8944,7 +9262,6 @@ var GridBody = function GridBody(_ref) {
8944
9262
  var now = new Date();
8945
9263
  var tickX = 0;
8946
9264
  var ticks = [];
8947
- var today = react.createElement("rect", null);
8948
9265
  for (var i = 0; i < dates.length; i++) {
8949
9266
  var date = dates[i];
8950
9267
  ticks.push(react.createElement("line", {
@@ -8955,24 +9272,7 @@ var GridBody = function GridBody(_ref) {
8955
9272
  y2: y,
8956
9273
  className: styles$4.gridTick
8957
9274
  }));
8958
- 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()) {
8959
- today = react.createElement("rect", {
8960
- x: tickX + columnWidth / 2 - 1,
8961
- y: 0,
8962
- width: 2,
8963
- height: y,
8964
- fill: todayColor
8965
- });
8966
- }
8967
- if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
8968
- today = react.createElement("rect", {
8969
- x: tickX + columnWidth / 2,
8970
- y: 0,
8971
- width: 2,
8972
- height: y,
8973
- fill: todayColor
8974
- });
8975
- }
9275
+ 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()) ;
8976
9276
  tickX += columnWidth;
8977
9277
  }
8978
9278
  return react.createElement("g", {
@@ -8983,9 +9283,7 @@ var GridBody = function GridBody(_ref) {
8983
9283
  className: "rowLines"
8984
9284
  }, rowLines), react.createElement("g", {
8985
9285
  className: "ticks"
8986
- }, ticks), react.createElement("g", {
8987
- className: "today"
8988
- }, today));
9286
+ }, ticks));
8989
9287
  };
8990
9288
 
8991
9289
  var Grid = function Grid(props) {
@@ -9055,7 +9353,8 @@ var Calendar = function Calendar(_ref) {
9055
9353
  fontSize = _ref.fontSize,
9056
9354
  dateTimeFormatters = _ref.dateTimeFormatters,
9057
9355
  _ref$singleLineHeader = _ref.singleLineHeader,
9058
- singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader;
9356
+ singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
9357
+ currentDateIndicator = _ref.currentDateIndicator;
9059
9358
  var simplifiedHeader = singleLineHeader && dateSetup.viewMode !== ViewMode.Year;
9060
9359
  var TopCal = simplifiedHeader ? SinglePartOfCalendar : TopPartOfCalendar;
9061
9360
  var formatYear = (_dateTimeFormatters$y = dateTimeFormatters === null || dateTimeFormatters === void 0 ? void 0 : dateTimeFormatters.year) != null ? _dateTimeFormatters$y : defaultDateTimeFormatters.year;
@@ -9141,7 +9440,7 @@ var Calendar = function Calendar(_ref) {
9141
9440
  var dates = dateSetup.dates;
9142
9441
  for (var i = dates.length - 1; i >= 0; i--) {
9143
9442
  var date = dates[i];
9144
- var topValue = '';
9443
+ var topValue = "";
9145
9444
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
9146
9445
  topValue = formatMonthAndYear(date, locale);
9147
9446
  }
@@ -9276,7 +9575,12 @@ var Calendar = function Calendar(_ref) {
9276
9575
  width: columnWidth * dateSetup.dates.length,
9277
9576
  height: headerHeight,
9278
9577
  className: styles$5.calendarHeader
9279
- }), simplifiedHeader ? null : bottomValues, " ", topValues);
9578
+ }), simplifiedHeader ? null : bottomValues, " ", topValues, currentDateIndicator && react.createElement("circle", {
9579
+ fill: currentDateIndicator.color,
9580
+ cx: currentDateIndicator.x + 2.5,
9581
+ cy: headerHeight - 8,
9582
+ r: "8"
9583
+ }));
9280
9584
  };
9281
9585
 
9282
9586
  // A type of promise-like that resolves synchronously and supports only one observer
@@ -9515,6 +9819,9 @@ var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
9515
9819
  var index = dates.findIndex(function (d) {
9516
9820
  return d.getTime() >= xDate.getTime();
9517
9821
  }) - 1;
9822
+ if (index < 0) {
9823
+ return 0;
9824
+ }
9518
9825
  var remainderMillis = xDate.getTime() - dates[index].getTime();
9519
9826
  var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
9520
9827
  var x = index * columnWidth + percentOfInterval * columnWidth;
@@ -9672,6 +9979,15 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
9672
9979
  changedTask: changedTask
9673
9980
  };
9674
9981
  };
9982
+ function calculateCurrentDateCalculator(dates, columnWidth) {
9983
+ return taskXCoordinate(new Date(), dates, columnWidth);
9984
+ }
9985
+ function calculateProjection(start, end, dates, columnWidth) {
9986
+ return {
9987
+ x0: taskXCoordinate(start, dates, columnWidth),
9988
+ xf: taskXCoordinate(end, dates, columnWidth)
9989
+ };
9990
+ }
9675
9991
 
9676
9992
  function isKeyboardEvent(event) {
9677
9993
  return event.key !== undefined;
@@ -9934,11 +10250,15 @@ var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
9934
10250
 
9935
10251
  var Timeline = function Timeline(_ref) {
9936
10252
  var task = _ref.task,
9937
- isSelected = _ref.isSelected;
10253
+ isSelected = _ref.isSelected,
10254
+ onEventStart = _ref.onEventStart;
9938
10255
  var styles = task.styles;
9939
10256
  var col = isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
9940
10257
  return react.createElement("g", {
9941
- tabIndex: 0
10258
+ tabIndex: 0,
10259
+ onMouseDown: function onMouseDown(e) {
10260
+ return onEventStart("move", task, e);
10261
+ }
9942
10262
  }, react.createElement("rect", {
9943
10263
  fill: col,
9944
10264
  x: "0",
@@ -9949,6 +10269,9 @@ var Timeline = function Timeline(_ref) {
9949
10269
  ry: 0
9950
10270
  }), task.barChildren.map(function (bar) {
9951
10271
  return react.createElement("rect", {
10272
+ style: {
10273
+ cursor: "pointer"
10274
+ },
9952
10275
  key: bar.id,
9953
10276
  fill: bar.styles.backgroundColor,
9954
10277
  x: bar.x1,
@@ -9994,7 +10317,7 @@ var TaskItem = function TaskItem(props) {
9994
10317
  setTaskItem(react.createElement(Bar, Object.assign({}, props)));
9995
10318
  break;
9996
10319
  }
9997
- }, [task.typeInternal, isSelected, props]);
10320
+ }, [task, isSelected]);
9998
10321
  react.useEffect(function () {
9999
10322
  if (textRef.current) {
10000
10323
  setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
@@ -10062,6 +10385,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10062
10385
  fontFamily = _ref.fontFamily,
10063
10386
  fontSize = _ref.fontSize,
10064
10387
  rtl = _ref.rtl,
10388
+ _ref$hideLabel = _ref.hideLabel,
10389
+ hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10390
+ _ref$showSecondaryDat = _ref.showSecondaryDates,
10391
+ showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10392
+ currentDateIndicator = _ref.currentDateIndicator,
10393
+ projection = _ref.projection,
10065
10394
  setGanttEvent = _ref.setGanttEvent,
10066
10395
  setFailedTask = _ref.setFailedTask,
10067
10396
  setSelectedTask = _ref.setSelectedTask,
@@ -10069,11 +10398,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10069
10398
  onProgressChange = _ref.onProgressChange,
10070
10399
  onDoubleClick = _ref.onDoubleClick,
10071
10400
  onClick = _ref.onClick,
10072
- onDelete = _ref.onDelete,
10073
- _ref$hideLabel = _ref.hideLabel,
10074
- hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10075
- _ref$showSecondaryDat = _ref.showSecondaryDates,
10076
- showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat;
10401
+ onDelete = _ref.onDelete;
10077
10402
  var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
10078
10403
  var _useState = react.useState(0),
10079
10404
  xStep = _useState[0],
@@ -10261,7 +10586,20 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10261
10586
  };
10262
10587
  return react.createElement("g", {
10263
10588
  className: "content"
10264
- }, react.createElement("g", {
10589
+ }, currentDateIndicator && react.createElement("rect", {
10590
+ fill: currentDateIndicator.color,
10591
+ x: currentDateIndicator.x + 1.5,
10592
+ y: "0",
10593
+ width: "2",
10594
+ height: "100%"
10595
+ }), projection && react.createElement("rect", {
10596
+ fill: projection.color,
10597
+ x: projection.x0,
10598
+ y: "0",
10599
+ width: projection.xf - projection.x0,
10600
+ height: "100%",
10601
+ fillOpacity: "35%"
10602
+ }), react.createElement("g", {
10265
10603
  className: "arrows",
10266
10604
  fill: arrowColor,
10267
10605
  stroke: arrowColor
@@ -10369,6 +10707,7 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10369
10707
  scrollRef.current.scrollLeft = scroll;
10370
10708
  }
10371
10709
  }, [scroll]);
10710
+ console.log("HORIZONTAL-SCROLL svgWidth: " + svgWidth);
10372
10711
  return react.createElement("div", {
10373
10712
  dir: "ltr",
10374
10713
  style: {
@@ -10386,13 +10725,14 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10386
10725
  };
10387
10726
 
10388
10727
  var Gantt = function Gantt(_ref) {
10389
- var tasks = _ref.tasks,
10728
+ var id = _ref.id,
10729
+ tasks = _ref.tasks,
10390
10730
  _ref$headerHeight = _ref.headerHeight,
10391
10731
  headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
10392
10732
  _ref$columnWidth = _ref.columnWidth,
10393
10733
  columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
10394
10734
  _ref$listCellWidth = _ref.listCellWidth,
10395
- listCellWidth = _ref$listCellWidth === void 0 ? "155px" : _ref$listCellWidth,
10735
+ listCellWidth = _ref$listCellWidth === void 0 ? "297px" : _ref$listCellWidth,
10396
10736
  _ref$rowHeight = _ref.rowHeight,
10397
10737
  rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
10398
10738
  _ref$ganttHeight = _ref.ganttHeight,
@@ -10442,7 +10782,7 @@ var Gantt = function Gantt(_ref) {
10442
10782
  _ref$arrowIndent = _ref.arrowIndent,
10443
10783
  arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
10444
10784
  _ref$todayColor = _ref.todayColor,
10445
- todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
10785
+ todayColor = _ref$todayColor === void 0 ? "#ff0000" : _ref$todayColor,
10446
10786
  viewDate = _ref.viewDate,
10447
10787
  _ref$TooltipContent = _ref.TooltipContent,
10448
10788
  TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
@@ -10450,13 +10790,6 @@ var Gantt = function Gantt(_ref) {
10450
10790
  TaskListHeader = _ref$TaskListHeader === void 0 ? TaskListHeaderDefault : _ref$TaskListHeader,
10451
10791
  _ref$TaskListTable = _ref.TaskListTable,
10452
10792
  TaskListTable = _ref$TaskListTable === void 0 ? TaskListTableDefault : _ref$TaskListTable,
10453
- onDateChange = _ref.onDateChange,
10454
- onProgressChange = _ref.onProgressChange,
10455
- onDoubleClick = _ref.onDoubleClick,
10456
- onClick = _ref.onClick,
10457
- onDelete = _ref.onDelete,
10458
- onSelect = _ref.onSelect,
10459
- onExpanderClick = _ref.onExpanderClick,
10460
10793
  dateTimeFormatters = _ref.dateTimeFormatters,
10461
10794
  _ref$singleLineHeader = _ref.singleLineHeader,
10462
10795
  singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
@@ -10465,13 +10798,23 @@ var Gantt = function Gantt(_ref) {
10465
10798
  _ref$showSecondaryDat = _ref.showSecondaryDates,
10466
10799
  showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10467
10800
  _ref$hideDependencies = _ref.hideDependencies,
10468
- hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies;
10801
+ hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies,
10802
+ projection = _ref.projection,
10803
+ displayedStartDate = _ref.displayedStartDate,
10804
+ displayedEndDate = _ref.displayedEndDate,
10805
+ onDateChange = _ref.onDateChange,
10806
+ onProgressChange = _ref.onProgressChange,
10807
+ onDoubleClick = _ref.onDoubleClick,
10808
+ onClick = _ref.onClick,
10809
+ onDelete = _ref.onDelete,
10810
+ onSelect = _ref.onSelect,
10811
+ onExpanderClick = _ref.onExpanderClick;
10469
10812
  var wrapperRef = react.useRef(null);
10470
10813
  var taskListRef = react.useRef(null);
10471
10814
  var _useState = react.useState(function () {
10472
- var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates),
10473
- startDate = _ganttDateRange[0],
10474
- endDate = _ganttDateRange[1];
10815
+ var _ganttDateRangeFromTa = ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10816
+ startDate = _ganttDateRangeFromTa[0],
10817
+ endDate = _ganttDateRangeFromTa[1];
10475
10818
  return {
10476
10819
  viewMode: viewMode,
10477
10820
  dates: seedDates(startDate, endDate, viewMode)
@@ -10525,6 +10868,19 @@ var Gantt = function Gantt(_ref) {
10525
10868
  var _useState12 = react.useState(false),
10526
10869
  ignoreScrollEvent = _useState12[0],
10527
10870
  setIgnoreScrollEvent = _useState12[1];
10871
+ var _useState13 = react.useState(),
10872
+ currentDateIndicatorContent = _useState13[0],
10873
+ setCurrentDateIndicatorContent = _useState13[1];
10874
+ var _useState14 = react.useState(),
10875
+ projectionContent = _useState14[0],
10876
+ setProjectionContent = _useState14[1];
10877
+ react.useEffect(function () {
10878
+ window.addEventListener("gantt-sync-scroll-event", function (e) {
10879
+ if (e.detail.id !== id) {
10880
+ setScrollX(e.detail.scrollX);
10881
+ }
10882
+ });
10883
+ }, [id]);
10528
10884
  react.useEffect(function () {
10529
10885
  var filteredTasks;
10530
10886
  if (onExpanderClick) {
@@ -10533,9 +10889,9 @@ var Gantt = function Gantt(_ref) {
10533
10889
  filteredTasks = tasks;
10534
10890
  }
10535
10891
  filteredTasks = filteredTasks.sort(sortTasks);
10536
- var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount, showSecondaryDates),
10537
- startDate = _ganttDateRange2[0],
10538
- endDate = _ganttDateRange2[1];
10892
+ var _ganttDateRangeFromTa2 = ganttDateRangeFromTask(filteredTasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10893
+ startDate = _ganttDateRangeFromTa2[0],
10894
+ endDate = _ganttDateRangeFromTa2[1];
10539
10895
  var newDates = seedDates(startDate, endDate, viewMode);
10540
10896
  if (rtl) {
10541
10897
  newDates = newDates.reverse();
@@ -10548,7 +10904,7 @@ var Gantt = function Gantt(_ref) {
10548
10904
  viewMode: viewMode
10549
10905
  });
10550
10906
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, projectHeight, timelineHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, showSecondaryDates));
10551
- }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick]);
10907
+ }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick, showSecondaryDates, projectHeight, timelineHeight, displayedStartDate, displayedEndDate]);
10552
10908
  react.useEffect(function () {
10553
10909
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
10554
10910
  var dates = dateSetup.dates;
@@ -10660,11 +11016,20 @@ var Gantt = function Gantt(_ref) {
10660
11016
  if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
10661
11017
  setScrollX(event.currentTarget.scrollLeft);
10662
11018
  setIgnoreScrollEvent(true);
11019
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11020
+ detail: {
11021
+ componentId: id,
11022
+ scrollX: event.currentTarget.scrollLeft
11023
+ }
11024
+ }));
10663
11025
  } else {
10664
11026
  setIgnoreScrollEvent(false);
10665
11027
  }
10666
11028
  };
10667
11029
  var handleKeyDown = function handleKeyDown(event) {
11030
+ if (event.target.tagName === "INPUT") {
11031
+ return;
11032
+ }
10668
11033
  event.preventDefault();
10669
11034
  var newScrollY = scrollY;
10670
11035
  var newScrollX = scrollX;
@@ -10696,6 +11061,12 @@ var Gantt = function Gantt(_ref) {
10696
11061
  newScrollX = svgWidth;
10697
11062
  }
10698
11063
  setScrollX(newScrollX);
11064
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11065
+ detail: {
11066
+ componentId: id,
11067
+ scrollX: newScrollX
11068
+ }
11069
+ }));
10699
11070
  } else {
10700
11071
  if (newScrollY < 0) {
10701
11072
  newScrollY = 0;
@@ -10706,6 +11077,29 @@ var Gantt = function Gantt(_ref) {
10706
11077
  }
10707
11078
  setIgnoreScrollEvent(true);
10708
11079
  };
11080
+ react.useEffect(function () {
11081
+ var x = calculateCurrentDateCalculator(dateSetup.dates, columnWidth);
11082
+ if (x !== 0) {
11083
+ setCurrentDateIndicatorContent({
11084
+ color: todayColor,
11085
+ x: x
11086
+ });
11087
+ }
11088
+ }, [columnWidth, dateSetup.dates, todayColor]);
11089
+ react.useEffect(function () {
11090
+ if (projection) {
11091
+ var _calculateProjection = calculateProjection(projection.start, projection.end, dateSetup.dates, columnWidth),
11092
+ x0 = _calculateProjection.x0,
11093
+ xf = _calculateProjection.xf;
11094
+ setProjectionContent({
11095
+ x0: x0,
11096
+ xf: xf,
11097
+ color: projection.color
11098
+ });
11099
+ } else {
11100
+ setProjectionContent(undefined);
11101
+ }
11102
+ }, [columnWidth, dateSetup.dates, projection]);
10709
11103
  var handleSelectedTask = function handleSelectedTask(taskId) {
10710
11104
  var newSelectedTask = barTasks.find(function (t) {
10711
11105
  return t.id === taskId;
@@ -10749,7 +11143,8 @@ var Gantt = function Gantt(_ref) {
10749
11143
  fontSize: fontSize,
10750
11144
  rtl: rtl,
10751
11145
  dateTimeFormatters: dateTimeFormatters,
10752
- singleLineHeader: singleLineHeader
11146
+ singleLineHeader: singleLineHeader,
11147
+ currentDateIndicator: currentDateIndicatorContent
10753
11148
  };
10754
11149
  var barProps = {
10755
11150
  tasks: barTasks,
@@ -10766,6 +11161,11 @@ var Gantt = function Gantt(_ref) {
10766
11161
  arrowIndent: arrowIndent,
10767
11162
  svgWidth: svgWidth,
10768
11163
  rtl: rtl,
11164
+ hideLabel: hideLabel,
11165
+ showSecondaryDates: showSecondaryDates,
11166
+ ganttHeight: ganttHeight,
11167
+ currentDateIndicator: currentDateIndicatorContent,
11168
+ projection: projectionContent,
10769
11169
  setGanttEvent: setGanttEvent,
10770
11170
  setFailedTask: setFailedTask,
10771
11171
  setSelectedTask: handleSelectedTask,
@@ -10773,9 +11173,7 @@ var Gantt = function Gantt(_ref) {
10773
11173
  onProgressChange: onProgressChange,
10774
11174
  onDoubleClick: onDoubleClick,
10775
11175
  onClick: onClick,
10776
- onDelete: onDelete,
10777
- hideLabel: hideLabel,
10778
- showSecondaryDates: showSecondaryDates
11176
+ onDelete: onDelete
10779
11177
  };
10780
11178
  var tableProps = {
10781
11179
  rowHeight: rowHeight,
@@ -10838,195 +11236,6 @@ var Gantt = function Gantt(_ref) {
10838
11236
  }));
10839
11237
  };
10840
11238
 
10841
- var TimeUnit;
10842
- (function (TimeUnit) {
10843
- TimeUnit["DAY"] = "days";
10844
- TimeUnit["WEEK"] = "weeks";
10845
- TimeUnit["MONTH"] = "months";
10846
- TimeUnit["YEAR"] = "YEAR";
10847
- })(TimeUnit || (TimeUnit = {}));
10848
-
10849
- var parseToDayStart = function parseToDayStart(ymd) {
10850
- return luxon.DateTime.fromISO(ymd).toJSDate();
10851
- };
10852
- var parseToDayEnd = function parseToDayEnd(endDate) {
10853
- return luxon.DateTime.fromISO(endDate).plus({
10854
- seconds: 86400 - 1
10855
- }).toJSDate();
10856
- };
10857
- var formatToIsoDate = function formatToIsoDate(date) {
10858
- return luxon.DateTime.fromJSDate(date).toISODate();
10859
- };
10860
- var formatToLocaleSimple = function formatToLocaleSimple(date) {
10861
- return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
10862
- };
10863
- function validDates(startDate, endDate, name) {
10864
- var _start;
10865
- var start = parseToDayStart(startDate);
10866
- var end = parseToDayEnd(endDate);
10867
- if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
10868
- start = parseToDayStart(endDate);
10869
- console.log("time-converters.ts validDates() Error date", {
10870
- name: name,
10871
- start: startDate,
10872
- end: endDate
10873
- });
10874
- }
10875
- return {
10876
- start: start,
10877
- end: end
10878
- };
10879
- }
10880
-
10881
- var toViewMode = function toViewMode(timeUnit) {
10882
- switch (timeUnit) {
10883
- case TimeUnit.DAY:
10884
- return ViewMode.Day;
10885
- case TimeUnit.WEEK:
10886
- return ViewMode.Week;
10887
- case TimeUnit.MONTH:
10888
- return ViewMode.Month;
10889
- case TimeUnit.YEAR:
10890
- return ViewMode.Year;
10891
- }
10892
- };
10893
- var convertPhaseToTask = function convertPhaseToTask(item) {
10894
- var mapPhase = function mapPhase(_ref) {
10895
- var phaseStart = _ref.startDate,
10896
- phaseEnd = _ref.endDate,
10897
- secondaryStartDate = _ref.secondaryStartDate,
10898
- secondaryEndDate = _ref.secondaryEndDate,
10899
- phaseName = _ref.name,
10900
- phaseId = _ref.id,
10901
- color = _ref.color,
10902
- selectedColor = _ref.selectedColor,
10903
- dependencies = _ref.dependencies;
10904
- var _validDates = validDates(phaseStart, phaseEnd, phaseName),
10905
- start = _validDates.start,
10906
- end = _validDates.end;
10907
- var _validDates2 = validDates(secondaryStartDate, secondaryEndDate, phaseName),
10908
- phaseStart2 = _validDates2.start,
10909
- phaseEnd2 = _validDates2.end;
10910
- return {
10911
- start: start,
10912
- end: end,
10913
- secondaryStart: phaseStart2,
10914
- secondaryEnd: phaseEnd2,
10915
- name: phaseName,
10916
- valuesToShow: item.valuesToShow,
10917
- id: phaseId,
10918
- type: "task",
10919
- progress: 100,
10920
- dependencies: dependencies,
10921
- styles: color ? {
10922
- backgroundColor: color,
10923
- progressColor: color,
10924
- backgroundSelectedColor: selectedColor,
10925
- progressSelectedColor: selectedColor
10926
- } : {}
10927
- };
10928
- };
10929
- return mapPhase(item);
10930
- };
10931
- var convertDetailToTimeline = function convertDetailToTimeline(item) {
10932
- var id = item.id,
10933
- name = item.name,
10934
- schedule = item.schedule;
10935
- var convertToFrame = function convertToFrame(x) {
10936
- var startDate = x.startDate,
10937
- endDate = x.endDate,
10938
- color = x.color,
10939
- selectedColor = x.selectedColor;
10940
- var _validDates3 = validDates(startDate, endDate, "time frame"),
10941
- start = _validDates3.start,
10942
- end = _validDates3.end;
10943
- return {
10944
- start: start,
10945
- end: end,
10946
- backgroundColor: color != null ? color : "0xffffff",
10947
- backgroundSelectedColor: selectedColor != null ? selectedColor : color
10948
- };
10949
- };
10950
- var defaultColor = "#595959";
10951
- return {
10952
- id: id,
10953
- type: "timeline",
10954
- timeline: schedule.map(convertToFrame),
10955
- name: name,
10956
- valuesToShow: item.valuesToShow,
10957
- start: new Date(),
10958
- end: new Date(),
10959
- progress: 100,
10960
- styles: {
10961
- backgroundColor: defaultColor,
10962
- progressColor: defaultColor,
10963
- backgroundSelectedColor: defaultColor,
10964
- progressSelectedColor: defaultColor
10965
- }
10966
- };
10967
- };
10968
- var convertProjectToTasks = function convertProjectToTasks(_ref2) {
10969
- var id = _ref2.id,
10970
- name = _ref2.name,
10971
- valuesToShow = _ref2.valuesToShow,
10972
- startDate = _ref2.startDate,
10973
- endDate = _ref2.endDate,
10974
- phases = _ref2.phases,
10975
- details = _ref2.details,
10976
- secondaryStartDate = _ref2.secondaryStartDate,
10977
- secondaryEndDate = _ref2.secondaryEndDate;
10978
- var _validDates4 = validDates(startDate, endDate, name),
10979
- start = _validDates4.start,
10980
- end = _validDates4.end;
10981
- var _validDates5 = validDates(secondaryStartDate, secondaryEndDate, name),
10982
- start2 = _validDates5.start,
10983
- end2 = _validDates5.end;
10984
- var mainTask = {
10985
- start: start,
10986
- end: end,
10987
- id: id,
10988
- name: name,
10989
- valuesToShow: valuesToShow,
10990
- secondaryStart: start2,
10991
- secondaryEnd: end2,
10992
- type: "project",
10993
- progress: 100,
10994
- isDisabled: false,
10995
- hideChildren: false
10996
- };
10997
- var children1 = (phases != null ? phases : []).map(convertPhaseToTask);
10998
- var children2 = (details != null ? details : []).map(convertDetailToTimeline);
10999
- return [mainTask].concat(children1, children2);
11000
- };
11001
- var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref3) {
11002
- var id = _ref3.id,
11003
- start = _ref3.start,
11004
- end = _ref3.end;
11005
- return projects.map(function (project) {
11006
- return project.id === id ? withNewDates(project, start, end) : project;
11007
- });
11008
- };
11009
- var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref4) {
11010
- var id = _ref4.id,
11011
- start = _ref4.start,
11012
- end = _ref4.end;
11013
- if (phases) {
11014
- return phases.map(function (phase) {
11015
- return phase.id === id ? withNewDates(phase, start, end) : phase;
11016
- });
11017
- }
11018
- return undefined;
11019
- };
11020
- var withNewDates = function withNewDates(p, start, end) {
11021
- var startDate = formatToIsoDate(start);
11022
- var endDate = formatToIsoDate(end);
11023
- var extra = {
11024
- startDate: startDate,
11025
- endDate: endDate
11026
- };
11027
- return _extends({}, p, extra);
11028
- };
11029
-
11030
11239
  var cachedFormats = {};
11031
11240
  var getOrBuildCachedFormat = function getOrBuildCachedFormat(locale, options) {
11032
11241
  var _cachedFormats$key;
@@ -11039,8 +11248,8 @@ var format = function format(date, locale, options) {
11039
11248
  var format1 = getOrBuildCachedFormat(locale, options).format(date);
11040
11249
  return format1;
11041
11250
  } catch (e) {
11042
- console.log("time-formatters.ts format", date, locale, options);
11043
- console.log(e);
11251
+ console.error("time-formatters.ts format", date, locale, options);
11252
+ console.error(e);
11044
11253
  }
11045
11254
  };
11046
11255
  var dayFormatter = function dayFormatter(date, locale) {
@@ -11063,120 +11272,23 @@ var ganttDateTimeFormatters = {
11063
11272
  month: monthFormatter
11064
11273
  };
11065
11274
 
11066
- var _excluded = ["projects", "timeUnit", "TooltipContent", "TaskListHeader", "TaskListTable", "onDateChange", "onClick", "stylingOptions"];
11067
- var locale = "it-IT";
11068
- var GanttByTask = function GanttByTask(_ref) {
11069
- var _stylingOptions$preSt, _DateTime$now$minus;
11070
- var _ref$projects = _ref.projects,
11071
- projects = _ref$projects === void 0 ? [] : _ref$projects,
11072
- _ref$timeUnit = _ref.timeUnit,
11073
- timeUnit = _ref$timeUnit === void 0 ? TimeUnit.DAY : _ref$timeUnit,
11074
- TooltipContent = _ref.TooltipContent,
11075
- TaskListHeader = _ref.TaskListHeader,
11076
- TaskListTable = _ref.TaskListTable,
11077
- onDateChange = _ref.onDateChange,
11078
- onClick = _ref.onClick,
11079
- _ref$stylingOptions = _ref.stylingOptions,
11080
- stylingOptions = _ref$stylingOptions === void 0 ? {} : _ref$stylingOptions,
11081
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
11082
- var _useState = react.useState(projects),
11083
- currentProjects = _useState[0],
11084
- setCurrentProjects = _useState[1];
11085
- react.useEffect(function () {
11086
- if (projects) setCurrentProjects(projects);
11087
- }, [projects]);
11088
- var _useState2 = react.useState(1),
11089
- key = _useState2[0],
11090
- setKey = _useState2[1];
11091
- var tasks = react.useMemo(function () {
11092
- setKey(function (k) {
11093
- return k + 1;
11094
- });
11095
- return currentProjects.flatMap(convertProjectToTasks);
11096
- }, [currentProjects]);
11097
- var getProjectById = function getProjectById(id) {
11098
- return currentProjects.find(function (p) {
11099
- return p.id === id;
11100
- });
11101
- };
11102
- var handleClick = function handleClick(task) {
11103
- var id = task === null || task === void 0 ? void 0 : task.id;
11104
- console.log("gantt-by-task.tsx onClick", id);
11105
- var project = getProjectById(id);
11106
- if (project) onClick === null || onClick === void 0 ? void 0 : onClick(project);
11107
- var phase = currentProjects.flatMap(function (p) {
11108
- return p.phases;
11109
- }).find(function (ph) {
11110
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11111
- });
11112
- if (phase) onClick === null || onClick === void 0 ? void 0 : onClick(phase);
11113
- };
11114
- var handleDateChange = function handleDateChange(task) {
11115
- var id = task === null || task === void 0 ? void 0 : task.id;
11116
- console.log("gantt-by-task.tsx onDateChange", id);
11117
- var project = getProjectById(id);
11118
- if (project) {
11119
- var result = mergeTaskIntoProjects(currentProjects, task);
11120
- setCurrentProjects(result);
11121
- var _project = result.find(function (p) {
11122
- return p.id === id;
11123
- });
11124
- if (_project) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(_project);
11125
- return;
11126
- }
11127
- var parentOfClickedPhase = currentProjects.find(function (p) {
11128
- var _p$phases;
11129
- return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11130
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11131
- });
11132
- });
11133
- if (parentOfClickedPhase) {
11134
- var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11135
- var updatedProjects = currentProjects.map(function (p) {
11136
- return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11137
- phases: phases
11138
- }) : p;
11139
- });
11140
- setCurrentProjects(updatedProjects);
11141
- var phase = updatedProjects.flatMap(function (p) {
11142
- return p.phases;
11143
- }).find(function (ph) {
11144
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11145
- });
11146
- if (phase) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(phase);
11147
- }
11148
- };
11149
- 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();
11150
- console.log("gantt-by-task.tsx TASKS", tasks);
11151
- var returnElement = (tasks === null || tasks === void 0 ? void 0 : tasks.length) > 0 && react.createElement(Gantt, Object.assign({
11152
- key: key,
11153
- tasks: tasks,
11154
- locale: locale,
11155
- viewMode: toViewMode(timeUnit),
11156
- viewDate: viewDate,
11157
- onClick: handleClick,
11158
- onDateChange: handleDateChange,
11159
- TooltipContent: TooltipContent,
11160
- TaskListHeader: TaskListHeader,
11161
- TaskListTable: TaskListTable,
11162
- dateTimeFormatters: ganttDateTimeFormatters
11163
- }, stylingOptions, props));
11164
- if (returnElement) {
11165
- return returnElement;
11166
- } else {
11167
- return react.createElement("div", null);
11168
- }
11169
- };
11170
-
11171
- var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA"};
11275
+ var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA","filter":"_2cfRI"};
11172
11276
 
11173
- var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView) {
11174
- var CustomTaskListHeader = function CustomTaskListHeader() {
11277
+ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView, onFilterInput) {
11278
+ var CustomTaskListHeader = function CustomTaskListHeader(_ref) {
11279
+ var headerHeight = _ref.headerHeight,
11280
+ fontFamily = _ref.fontFamily,
11281
+ fontSize = _ref.fontSize;
11175
11282
  return react.createElement("div", {
11283
+ style: {
11284
+ fontFamily: fontFamily,
11285
+ fontSize: fontSize,
11286
+ height: headerHeight
11287
+ },
11176
11288
  className: classes$1.wrapper
11177
11289
  }, react.createElement("div", {
11178
11290
  className: classes$1.title
11179
- }, react.createElement("span", null, label)), react.createElement("div", {
11291
+ }, react.createElement("span", null, label)), setDoubleView && react.createElement("div", {
11180
11292
  className: classes$1.toggler
11181
11293
  }, react.createElement("label", {
11182
11294
  htmlFor: "ch2",
@@ -11193,12 +11305,21 @@ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView
11193
11305
  className: classes$1.slider
11194
11306
  })), react.createElement("span", {
11195
11307
  className: classes$1.label
11196
- }, "Mostra previsioni")));
11308
+ }, "Mostra previsioni")), react.createElement("div", {
11309
+ className: classes$1.filter
11310
+ }, react.createElement("input", {
11311
+ type: "text",
11312
+ name: "filter",
11313
+ size: 30,
11314
+ onInput: function onInput(e) {
11315
+ return onFilterInput === null || onFilterInput === void 0 ? void 0 : onFilterInput(e);
11316
+ }
11317
+ })));
11197
11318
  };
11198
11319
  return CustomTaskListHeader;
11199
11320
  };
11200
11321
 
11201
- var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW","timelineWrapper":"_1H4ue"};
11322
+ var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW"};
11202
11323
 
11203
11324
  var ProjectRow = function ProjectRow(_ref) {
11204
11325
  var _ref$task = _ref.task,
@@ -11224,7 +11345,7 @@ var ProjectRow = function ProjectRow(_ref) {
11224
11345
  "--grid-project-columns": str
11225
11346
  };
11226
11347
  return react.createElement("div", {
11227
- key: id,
11348
+ key: "task_" + id,
11228
11349
  className: styles$9.project,
11229
11350
  style: customStyle,
11230
11351
  onClick: function onClick() {
@@ -11235,7 +11356,7 @@ var ProjectRow = function ProjectRow(_ref) {
11235
11356
  return react.createElement("span", {
11236
11357
  className: index === 0 ? styles$9.main : undefined,
11237
11358
  title: v.length > 10 ? v : undefined,
11238
- key: id + "_valuesToShow_" + index
11359
+ key: "task_" + id + "_valuesToShow_" + index
11239
11360
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11240
11361
  }));
11241
11362
  };
@@ -11264,7 +11385,7 @@ var SubRow = function SubRow(_ref2) {
11264
11385
  "--grid-fasi-columns": str
11265
11386
  };
11266
11387
  return react.createElement("div", {
11267
- key: id,
11388
+ key: "phase_" + id,
11268
11389
  className: styles$9.subrow,
11269
11390
  style: customStyle,
11270
11391
  onClick: function onClick() {
@@ -11272,7 +11393,7 @@ var SubRow = function SubRow(_ref2) {
11272
11393
  onclickTaskList(id);
11273
11394
  }
11274
11395
  }, react.createElement("span", {
11275
- key: id + "_valuesToShow_color",
11396
+ key: "phase_" + id + "_valuesToShow_color",
11276
11397
  style: {
11277
11398
  height: 16,
11278
11399
  width: 16,
@@ -11282,41 +11403,42 @@ var SubRow = function SubRow(_ref2) {
11282
11403
  return react.createElement("span", {
11283
11404
  className: index === 0 ? styles$9.main : undefined,
11284
11405
  title: v.length > 10 ? v : undefined,
11285
- key: id + "_valuesToShow_" + index
11406
+ key: "phase_" + id + "_valuesToShow_" + index
11286
11407
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11287
11408
  }));
11288
11409
  };
11289
11410
  var TimelineSubRow = function TimelineSubRow(_ref3) {
11290
11411
  var _ref3$task = _ref3.task,
11291
11412
  id = _ref3$task.id,
11292
- name = _ref3$task.name,
11413
+ valuesToShow = _ref3$task.valuesToShow,
11293
11414
  rowHeight = _ref3.rowHeight,
11294
11415
  rowWidth = _ref3.rowWidth,
11295
11416
  fontFamily = _ref3.fontFamily,
11296
11417
  fontSize = _ref3.fontSize;
11418
+ var str = "";
11419
+ for (var i = 0; i < valuesToShow.length; i++) {
11420
+ str += "1fr ";
11421
+ }
11422
+ var customStyle = {
11423
+ height: rowHeight,
11424
+ width: rowWidth,
11425
+ fontFamily: fontFamily,
11426
+ fontSize: fontSize,
11427
+ "--grid-fasi-columns": str
11428
+ };
11297
11429
  return react.createElement("div", {
11298
- key: id,
11299
- className: styles$9.timelineWrapper,
11300
- style: {
11301
- height: rowHeight,
11302
- width: rowWidth,
11303
- fontFamily: fontFamily,
11304
- fontSize: fontSize
11305
- }
11306
- }, react.createElement("div", {
11430
+ key: "detail_" + id,
11307
11431
  className: styles$9.timeline,
11308
- style: {
11309
- height: rowHeight - 5
11310
- }
11311
- }, react.createElement("span", {
11312
- key: id + "_valuesToShow_0"
11313
- }, name), react.createElement("span", {
11314
- key: id + "_valuesToShow_1"
11315
- }, "A"), react.createElement("span", {
11316
- key: id + "_valuesToShow_2"
11317
- }, "A")));
11432
+ style: customStyle
11433
+ }, valuesToShow === null || valuesToShow === void 0 ? void 0 : valuesToShow.map(function (v, index) {
11434
+ return react.createElement("span", {
11435
+ className: index === 0 ? styles$9.main : undefined,
11436
+ title: v.length > 10 ? v : undefined,
11437
+ key: "detail_" + id + "_valuesToShow_" + index
11438
+ }, v);
11439
+ }));
11318
11440
  };
11319
- var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11441
+ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id) {
11320
11442
  var CustomTaskListTable = function CustomTaskListTable(_ref4) {
11321
11443
  var rowHeight = _ref4.rowHeight,
11322
11444
  rowWidth = _ref4.rowWidth,
@@ -11325,9 +11447,12 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11325
11447
  tasks = _ref4.tasks,
11326
11448
  setSelectedTask = _ref4.setSelectedTask;
11327
11449
  return react.createElement("div", {
11328
- className: styles$9.container
11450
+ className: styles$9.container,
11451
+ key: "tasks_container_" + id
11329
11452
  }, tasks.map(function (task) {
11330
- return react.createElement(react.Fragment, null, task.type === "project" && react.createElement(ProjectRow, {
11453
+ return react.createElement(react.Fragment, {
11454
+ key: task.id
11455
+ }, task.type === "project" && react.createElement(ProjectRow, {
11331
11456
  key: task.id + "_" + task.type,
11332
11457
  task: task,
11333
11458
  rowHeight: rowHeight,
@@ -11412,49 +11537,258 @@ var Switcher = function Switcher(_ref) {
11412
11537
  };
11413
11538
 
11414
11539
  var Planner = function Planner(props) {
11415
- var _props$showSecondaryD, _props$taskListHeader, _props$taskListTableP, _props$tooltipContent;
11540
+ var _props$secondaryGantt, _props$mainGantt$show, _props$mainGantt$task, _props$mainGantt$task2, _props$mainGantt$tool, _props$secondaryGantt3, _props$secondaryGantt4, _props$secondaryGantt5, _props$secondaryGantt6;
11416
11541
  var _useState = react.useState(TimeUnit.MONTH),
11417
11542
  timeUnit = _useState[0],
11418
11543
  setTimeUnit = _useState[1];
11419
- var _useState2 = react.useState((_props$showSecondaryD = props.showSecondaryDates) != null ? _props$showSecondaryD : false),
11420
- doubleView = _useState2[0],
11421
- setDoubleView = _useState2[1];
11422
- var commonProps = {
11423
- hideLabel: props.hideLabel,
11424
- showSecondaryDates: doubleView,
11425
- ganttHeight: props.ganttHeight,
11426
- hideDependencies: props.hideDependencies
11544
+ var _useState2 = react.useState(props.mainGantt.items),
11545
+ currentTasks = _useState2[0],
11546
+ setCurrentTasks = _useState2[1];
11547
+ var _useState3 = react.useState((_props$secondaryGantt = props.secondaryGantt) === null || _props$secondaryGantt === void 0 ? void 0 : _props$secondaryGantt.items),
11548
+ currentDetails = _useState3[0],
11549
+ setCurrentDetails = _useState3[1];
11550
+ var _useState4 = react.useState((_props$mainGantt$show = props.mainGantt.showSecondaryDates) != null ? _props$mainGantt$show : false),
11551
+ mainGanttDoubleView = _useState4[0],
11552
+ setMainGanttDoubleView = _useState4[1];
11553
+ var _useState5 = react.useState(calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount)),
11554
+ displayedDates = _useState5[0],
11555
+ setDisplayedDates = _useState5[1];
11556
+ var _useState6 = react.useState(),
11557
+ viewDate = _useState6[0],
11558
+ setViewDate = _useState6[1];
11559
+ var _useState7 = react.useState(),
11560
+ projection = _useState7[0],
11561
+ setProjection = _useState7[1];
11562
+ var locale = "it-IT";
11563
+ var onFilterInput = function onFilterInput(e) {
11564
+ console.log("PLANNER onFilterInput", e);
11427
11565
  };
11428
- console.log("planner.tsx commonProps", commonProps);
11429
- return react.createElement("div", {
11430
- style: {
11431
- maxWidth: "90vw"
11566
+ var handleClick = function handleClick(row, onClick) {
11567
+ if (!row) {
11568
+ return;
11569
+ }
11570
+ if (row.type === "task" && props.secondaryGantt) {
11571
+ var _phase$color;
11572
+ var phase = row;
11573
+ setProjection({
11574
+ start: new Date(phase.startDate),
11575
+ end: new Date(phase.endDate),
11576
+ color: (_phase$color = phase.color) != null ? _phase$color : "#ED7D31"
11577
+ });
11578
+ } else {
11579
+ setProjection(undefined);
11432
11580
  }
11433
- }, react.createElement(Switcher, {
11581
+ onClick === null || onClick === void 0 ? void 0 : onClick(row);
11582
+ };
11583
+ var handleDateChange = function handleDateChange(task, currentProjects, onDateChange) {
11584
+ var id = task === null || task === void 0 ? void 0 : task.id;
11585
+ if (!id) {
11586
+ return;
11587
+ }
11588
+ var row = getProjectById(id, currentProjects);
11589
+ if (!row) {
11590
+ row = getPhaseById(id, currentProjects);
11591
+ }
11592
+ if (!row) {
11593
+ return;
11594
+ }
11595
+ if (row.type === "timeline") {
11596
+ console.log("planner.tsx onDateChange for timeline not managed yet", id, row.type);
11597
+ return;
11598
+ }
11599
+ if (row.type === "project") {
11600
+ var result = mergeTaskIntoProjects(currentProjects, task);
11601
+ row = getProjectById(row.id, result);
11602
+ setViewDate(task.start);
11603
+ setCurrentTasks(result);
11604
+ } else if (row.type === "task") {
11605
+ var parentOfClickedPhase = currentProjects.find(function (p) {
11606
+ var _p$phases;
11607
+ return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11608
+ return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11609
+ });
11610
+ });
11611
+ if (parentOfClickedPhase) {
11612
+ var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11613
+ var updatedProjects = currentProjects.map(function (p) {
11614
+ return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11615
+ phases: phases
11616
+ }) : p;
11617
+ });
11618
+ row = getPhaseById(row.id, updatedProjects);
11619
+ if (props.secondaryGantt && row) {
11620
+ var _row$color;
11621
+ setProjection({
11622
+ start: new Date(row.startDate),
11623
+ end: new Date(row.endDate),
11624
+ color: (_row$color = row.color) != null ? _row$color : "#ED7D31"
11625
+ });
11626
+ }
11627
+ setViewDate(task.start);
11628
+ setCurrentTasks(updatedProjects);
11629
+ }
11630
+ }
11631
+ onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(row);
11632
+ };
11633
+ react.useEffect(function () {
11634
+ var _props$secondaryGantt2;
11635
+ setCurrentTasks(props.mainGantt.items);
11636
+ setCurrentDetails((_props$secondaryGantt2 = props.secondaryGantt) === null || _props$secondaryGantt2 === void 0 ? void 0 : _props$secondaryGantt2.items);
11637
+ setProjection(undefined);
11638
+ }, [props]);
11639
+ react.useEffect(function () {
11640
+ var dates = calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount);
11641
+ setDisplayedDates(dates);
11642
+ if (!viewDate) {
11643
+ setViewDate(dates.displayedStartDate);
11644
+ }
11645
+ }, [currentTasks, currentDetails]);
11646
+ var tasks = [];
11647
+ for (var i = 0; i < currentTasks.length; i++) {
11648
+ tasks.push.apply(tasks, convertProjectToTasks(currentTasks[i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11649
+ }
11650
+ var details = [];
11651
+ if (currentDetails) {
11652
+ for (var _i = 0; _i < currentDetails.length; _i++) {
11653
+ details.push.apply(details, convertProjectToTasks(currentDetails[_i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11654
+ }
11655
+ }
11656
+ return react.createElement("div", null, react.createElement(Switcher, {
11434
11657
  onTimeUnitChange: function onTimeUnitChange(timeUnit) {
11435
11658
  return setTimeUnit(timeUnit);
11436
11659
  }
11437
- }), react.createElement(GanttByTask, Object.assign({}, commonProps, {
11438
- projects: props.items,
11439
- timeUnit: timeUnit,
11440
- stylingOptions: props.stylingOptions,
11441
- onClick: function onClick(row) {
11442
- var _props$onClick;
11443
- return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, row);
11660
+ }), react.createElement("div", {
11661
+ style: {
11662
+ display: "flex",
11663
+ flexDirection: "column"
11664
+ }
11665
+ }, react.createElement(Gantt, Object.assign({
11666
+ id: "main",
11667
+ key: "main",
11668
+ hideLabel: props.mainGantt.hideLabel,
11669
+ showSecondaryDates: mainGanttDoubleView,
11670
+ hideDependencies: props.mainGantt.hideDependencies,
11671
+ ganttHeight: props.mainGantt.ganttHeight,
11672
+ displayedStartDate: displayedDates.displayedStartDate,
11673
+ displayedEndDate: displayedDates.displayedEndDate,
11674
+ viewDate: viewDate,
11675
+ tasks: tasks,
11676
+ viewMode: toViewMode(timeUnit)
11677
+ }, props.mainGantt.stylingOptions, {
11678
+ TaskListHeader: (_props$mainGantt$task = props.mainGantt.taskListHeaderProject) != null ? _props$mainGantt$task : CustomTaskListHeaderHOC(props.mainGantt.title, mainGanttDoubleView != null ? mainGanttDoubleView : false, setMainGanttDoubleView, onFilterInput),
11679
+ TaskListTable: (_props$mainGantt$task2 = props.mainGantt.taskListTableProject) != null ? _props$mainGantt$task2 : CustomTaskListTableHOC(function (id) {
11680
+ var row = getProjectById(id, currentTasks);
11681
+ if (!row) {
11682
+ row = getPhaseById(id, currentTasks);
11683
+ }
11684
+ if (row) {
11685
+ handleClick(row, props.mainGantt.onClick);
11686
+ }
11687
+ }, "main"),
11688
+ TooltipContent: (_props$mainGantt$tool = props.mainGantt.tooltipContent) != null ? _props$mainGantt$tool : CustomTooltipHOC(),
11689
+ onClick: function onClick(e) {
11690
+ var row = getProjectById(e.id, currentTasks);
11691
+ if (!row) {
11692
+ row = getPhaseById(e.id, currentTasks);
11693
+ }
11694
+ if (row) {
11695
+ handleClick(row, props.mainGantt.onClick);
11696
+ }
11444
11697
  },
11445
- onDateChange: function onDateChange(row) {
11446
- var _props$onDateChange;
11447
- return (_props$onDateChange = props.onDateChange) === null || _props$onDateChange === void 0 ? void 0 : _props$onDateChange.call(props, row);
11698
+ onDateChange: function onDateChange(e) {
11699
+ return handleDateChange(e, currentTasks, props.mainGantt.onDateChange);
11448
11700
  },
11449
- TaskListHeader: (_props$taskListHeader = props.taskListHeaderProject) != null ? _props$taskListHeader : CustomTaskListHeaderHOC(props.title, doubleView != null ? doubleView : true, setDoubleView),
11450
- TaskListTable: (_props$taskListTableP = props.taskListTableProject) != null ? _props$taskListTableP : CustomTaskListTableHOC(function (id) {
11451
- console.log("planner.tsx Clicked on " + id);
11452
- }),
11453
- TooltipContent: (_props$tooltipContent = props.tooltipContent) != null ? _props$tooltipContent : CustomTooltipHOC()
11454
- })));
11701
+ locale: locale,
11702
+ dateTimeFormatters: ganttDateTimeFormatters
11703
+ })), props.secondaryGantt && react.createElement(Gantt, Object.assign({
11704
+ id: "secondary",
11705
+ key: "secondary",
11706
+ hideLabel: props.secondaryGantt.hideLabel,
11707
+ showSecondaryDates: mainGanttDoubleView,
11708
+ hideDependencies: props.secondaryGantt.hideDependencies,
11709
+ ganttHeight: props.secondaryGantt.ganttHeight,
11710
+ displayedStartDate: displayedDates.displayedStartDate,
11711
+ displayedEndDate: displayedDates.displayedEndDate,
11712
+ viewDate: viewDate,
11713
+ tasks: details,
11714
+ viewMode: toViewMode(timeUnit)
11715
+ }, props.mainGantt.stylingOptions, {
11716
+ TaskListHeader: (_props$secondaryGantt3 = props.secondaryGantt.taskListHeaderProject) != null ? _props$secondaryGantt3 : CustomTaskListHeaderHOC(props.secondaryGantt.title, undefined, undefined, onFilterInput),
11717
+ TaskListTable: (_props$secondaryGantt4 = (_props$secondaryGantt5 = props.secondaryGantt) === null || _props$secondaryGantt5 === void 0 ? void 0 : _props$secondaryGantt5.taskListTableProject) != null ? _props$secondaryGantt4 : CustomTaskListTableHOC(function (id) {
11718
+ console.log("planner.tsx secondaryGantt Clicked on " + id);
11719
+ }, "secondary"),
11720
+ TooltipContent: (_props$secondaryGantt6 = props.secondaryGantt.tooltipContent) != null ? _props$secondaryGantt6 : CustomTooltipHOC(),
11721
+ projection: projection,
11722
+ onClick: function onClick(e) {
11723
+ if (props.secondaryGantt) {
11724
+ var row = getProjectById(e.id, currentDetails);
11725
+ if (row) {
11726
+ handleClick(row, props.secondaryGantt.onClick);
11727
+ }
11728
+ }
11729
+ },
11730
+ onDateChange: function onDateChange(e) {
11731
+ var _props$secondaryGantt7;
11732
+ return handleDateChange(e, currentDetails, (_props$secondaryGantt7 = props.secondaryGantt) === null || _props$secondaryGantt7 === void 0 ? void 0 : _props$secondaryGantt7.onDateChange);
11733
+ },
11734
+ locale: locale,
11735
+ dateTimeFormatters: ganttDateTimeFormatters
11736
+ }))));
11455
11737
  };
11456
11738
 
11457
- 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}";
11739
+ const kupManager = kupManager$1.kupManagerInstance();
11740
+ function sanitizeAllDates(startDateCell, endDateCell, secStartDateCell, secEndDateCell) {
11741
+ const sanitizedDateValues = sanitizeDates(startDateCell, endDateCell);
11742
+ let sanitizedSecDateValues = [];
11743
+ if (secStartDateCell && secEndDateCell) {
11744
+ if (isAtLeastOneDateValid(secStartDateCell, secEndDateCell)) {
11745
+ sanitizedSecDateValues = sanitizeDates(secStartDateCell, secEndDateCell);
11746
+ }
11747
+ else {
11748
+ sanitizedSecDateValues = [...sanitizedDateValues];
11749
+ }
11750
+ }
11751
+ return {
11752
+ dateValues: sanitizedDateValues,
11753
+ secDateValues: sanitizedSecDateValues,
11754
+ };
11755
+ }
11756
+ function sanitizeDates(startDateCell, endDateCell) {
11757
+ let returnValues = [startDateCell.value, endDateCell.value];
11758
+ if (isDateValid(startDateCell) && isDateValid(endDateCell)) {
11759
+ return returnValues;
11760
+ }
11761
+ else if (isDateValid(startDateCell)) {
11762
+ return [startDateCell.value, startDateCell.value];
11763
+ }
11764
+ else if (isDateValid(endDateCell)) {
11765
+ return [endDateCell.value, endDateCell.value];
11766
+ }
11767
+ else {
11768
+ return returnValues;
11769
+ }
11770
+ }
11771
+ function isDateValid(dateCell) {
11772
+ return (kupManager.objects.isDate(dateCell.obj) &&
11773
+ kupManager.dates.isValid(dateCell.value, kupManager$1.KupDatesFormats.ISO_DATE));
11774
+ }
11775
+ function isAtLeastOneDateValid(startDateCell, endDateCell) {
11776
+ return isDateValid(startDateCell) || isDateValid(endDateCell);
11777
+ }
11778
+ function getValuesToShow(row, idCol, nameCol, dataColumns, columns, customToValuesFunction) {
11779
+ let toValuesFunction = () => columns.map((col) => {
11780
+ return kupManager$1.getCellValueForDisplay(dataColumns.find((kCol) => kCol.name == col), row.cells[col]);
11781
+ });
11782
+ if (customToValuesFunction) {
11783
+ toValuesFunction = customToValuesFunction;
11784
+ }
11785
+ const valuesToShow = (columns === null || columns === void 0 ? void 0 : columns.length) >= 2
11786
+ ? toValuesFunction()
11787
+ : [row.cells[idCol].value, row.cells[nameCol].value];
11788
+ return valuesToShow;
11789
+ }
11790
+
11791
+ 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}";
11458
11792
 
11459
11793
  var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11460
11794
  if (kind === "a" && !f)
@@ -11472,7 +11806,7 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
11472
11806
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
11473
11807
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11474
11808
  };
11475
- var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_lastOnChangeReceived, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase, _KupPlanner_emitOnChangeEventsReceived;
11809
+ 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;
11476
11810
  const KupPlanner = class {
11477
11811
  constructor(hostRef) {
11478
11812
  index.registerInstance(this, hostRef);
@@ -11483,13 +11817,22 @@ const KupPlanner = class {
11483
11817
  /*-------------------------------------------------*/
11484
11818
  /* I n t e r n a l V a r i a b l e s */
11485
11819
  /*-------------------------------------------------*/
11486
- _KupPlanner_kupManager.set(this, kupManager.kupManagerInstance());
11820
+ _KupPlanner_kupManager.set(this, kupManager$1.kupManagerInstance());
11487
11821
  _KupPlanner_rootPlanner.set(this, void 0);
11488
11822
  _KupPlanner_lastOnChangeReceived.set(this, void 0);
11489
11823
  this.plannerProps = undefined;
11490
11824
  this.customStyle = '';
11491
11825
  this.data = undefined;
11492
- this.dataRaw = undefined;
11826
+ this.detailData = undefined;
11827
+ this.detailColorCol = undefined;
11828
+ this.detailColumns = undefined;
11829
+ this.detailDates = undefined;
11830
+ this.detailHeight = undefined;
11831
+ this.detailIdCol = undefined;
11832
+ this.detailNameCol = undefined;
11833
+ this.detailPrevDates = undefined;
11834
+ this.listCellWidth = '300px';
11835
+ this.maxWidth = '90vw';
11493
11836
  this.phaseColorCol = undefined;
11494
11837
  this.phaseColumns = undefined;
11495
11838
  this.phaseColParDep = undefined;
@@ -11497,8 +11840,10 @@ const KupPlanner = class {
11497
11840
  this.phaseIdCol = undefined;
11498
11841
  this.phaseNameCol = undefined;
11499
11842
  this.phasePrevDates = undefined;
11843
+ this.showSecondaryDates = false;
11500
11844
  this.taskColumns = undefined;
11501
11845
  this.taskDates = undefined;
11846
+ this.taskHeight = undefined;
11502
11847
  this.taskIdCol = undefined;
11503
11848
  this.taskNameCol = undefined;
11504
11849
  this.taskPrevDates = undefined;
@@ -11528,7 +11873,7 @@ const KupPlanner = class {
11528
11873
  * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
11529
11874
  */
11530
11875
  async getProps(descriptions) {
11531
- return kupManager.getProps(this, KupPlannerProps, descriptions);
11876
+ return kupManager$1.getProps(this, KupPlannerProps, descriptions);
11532
11877
  }
11533
11878
  /**
11534
11879
  * This method is used to trigger a new render of the component.
@@ -11541,7 +11886,7 @@ const KupPlanner = class {
11541
11886
  * @param {GenericObject} props - Object containing props that will be set to the component.
11542
11887
  */
11543
11888
  async setProps(props) {
11544
- kupManager.setProps(this, KupPlannerProps, props);
11889
+ kupManager$1.setProps(this, KupPlannerProps, props);
11545
11890
  }
11546
11891
  /**
11547
11892
  * Add a list of phases to the project
@@ -11552,21 +11897,29 @@ const KupPlanner = class {
11552
11897
  var _a;
11553
11898
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11554
11899
  if (task) {
11555
- task.phases = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
11900
+ 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) => {
11901
+ const datesSanitized = sanitizeAllDates(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]], row.cells[this.phasePrevDates[0]], row.cells[this.phasePrevDates[1]]);
11902
+ const valuesToShow = getValuesToShow(row, this.phaseIdCol, this.phaseNameCol, data.columns, this.phaseColumns, () => this.phaseColumns.map((col) => col == this.phaseDates[0]
11903
+ ? '#START#'
11904
+ : col == this.phaseDates[1]
11905
+ ? '#END#'
11906
+ : kupManager$1.getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
11556
11907
  let phase = {
11557
11908
  taskRow: task.taskRow,
11558
11909
  phaseRow: row,
11559
- id: row.cells[this.phaseIdCol].value,
11910
+ id: task.id + '_' + row.cells[this.phaseIdCol].value,
11560
11911
  phaseRowId: row.id,
11561
11912
  taskRowId: task.taskRowId,
11562
11913
  name: row.cells[this.phaseNameCol].value,
11563
- startDate: row.cells[this.phaseDates[0]].value,
11564
- endDate: row.cells[this.phaseDates[1]].value,
11565
- secondaryStartDate: row.cells[this.phasePrevDates[0]].value,
11566
- secondaryEndDate: row.cells[this.phasePrevDates[1]].value,
11567
- type: 'phase',
11914
+ startDate: datesSanitized.dateValues[0],
11915
+ endDate: datesSanitized.dateValues[1],
11916
+ secondaryStartDate: datesSanitized.secDateValues[0],
11917
+ secondaryEndDate: datesSanitized.secDateValues[1],
11918
+ type: 'task',
11568
11919
  color: row.cells[this.phaseColorCol].value,
11569
- valuesToShow: this.phaseColumns.map((col) => row.cells[col].value),
11920
+ selectedColor: row.cells[this.phaseColorCol].value,
11921
+ valuesToShow: valuesToShow,
11922
+ rowType: KupPlannerGanttRowType.PHASE,
11570
11923
  };
11571
11924
  return phase;
11572
11925
  });
@@ -11575,8 +11928,8 @@ const KupPlanner = class {
11575
11928
  }
11576
11929
  handleOnClick(nativeEvent) {
11577
11930
  console.log('handleOnClick', nativeEvent);
11578
- switch (nativeEvent.type) {
11579
- case 'task':
11931
+ switch (nativeEvent.rowType) {
11932
+ case KupPlannerGanttRowType.TASK:
11580
11933
  const taskAction = nativeEvent.phases
11581
11934
  ? KupPlannerTaskAction.onClosing
11582
11935
  : KupPlannerTaskAction.onOpening;
@@ -11584,11 +11937,16 @@ const KupPlanner = class {
11584
11937
  this.onKupClick(nativeEvent, taskAction);
11585
11938
  }
11586
11939
  break;
11587
- case 'phase':
11940
+ case KupPlannerGanttRowType.PHASE:
11588
11941
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
11589
11942
  this.onKupClick(nativeEvent);
11590
11943
  }
11591
11944
  break;
11945
+ case KupPlannerGanttRowType.DETAIL:
11946
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
11947
+ this.onKupClick(nativeEvent);
11948
+ }
11949
+ break;
11592
11950
  }
11593
11951
  }
11594
11952
  handleOnDateChange(nativeEvent) {
@@ -11602,12 +11960,34 @@ const KupPlanner = class {
11602
11960
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.register(this);
11603
11961
  }
11604
11962
  componentDidLoad() {
11963
+ let details = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, this.detailData);
11964
+ if (details && details.length == 0) {
11965
+ details = undefined;
11966
+ }
11605
11967
  this.plannerProps = {
11606
- title: this.titleMess,
11607
- items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11608
- onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11609
- onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11968
+ mainGantt: {
11969
+ title: this.titleMess,
11970
+ items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11971
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11972
+ hideLabel: true,
11973
+ ganttHeight: this.taskHeight,
11974
+ showSecondaryDates: this.showSecondaryDates,
11975
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11976
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11977
+ },
11978
+ secondaryGantt: details
11979
+ ? {
11980
+ title: '',
11981
+ items: details,
11982
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11983
+ hideLabel: true,
11984
+ ganttHeight: this.detailHeight,
11985
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11986
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11987
+ }
11988
+ : undefined,
11610
11989
  };
11990
+ console.log('kup-planner.tsx componentDidLoad plannerProps', this.plannerProps);
11611
11991
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_renderReactPlannerElement).call(this);
11612
11992
  this.kupReady.emit({
11613
11993
  comp: this,
@@ -11623,7 +12003,8 @@ const KupPlanner = class {
11623
12003
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logRender(this, true);
11624
12004
  }
11625
12005
  render() {
11626
- return (index.h(index.Host, null, index.h("div", { id: GenericVariables.componentWrapperId })));
12006
+ //console.log('kup-planner.tsx render');
12007
+ return (index.h(index.Host, null, index.h("div", { id: GenericVariables.componentWrapperId, style: { maxWidth: this.maxWidth } })));
11627
12008
  }
11628
12009
  disconnectedCallback() {
11629
12010
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.unregister(this);
@@ -11640,28 +12021,70 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11640
12021
  }
11641
12022
  }, _KupPlanner_toTasks = function _KupPlanner_toTasks(data) {
11642
12023
  var _a;
11643
- let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
12024
+ 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) => {
12025
+ const datesSanitized = sanitizeAllDates(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]], row.cells[this.taskPrevDates[0]], row.cells[this.taskPrevDates[1]]);
12026
+ const valuesToShow = getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns);
11644
12027
  let task = {
11645
12028
  taskRow: row,
11646
12029
  taskRowId: row.id,
11647
12030
  id: row.cells[this.taskIdCol].value,
11648
12031
  name: row.cells[this.taskNameCol].value,
11649
- startDate: row.cells[this.taskDates[0]].value,
11650
- endDate: row.cells[this.taskDates[1]].value,
11651
- secondaryStartDate: row.cells[this.taskPrevDates[0]].value,
11652
- secondaryEndDate: row.cells[this.taskPrevDates[1]].value,
11653
- type: 'task',
11654
- valuesToShow: this.taskColumns.map((col) => row.cells[col].value),
12032
+ startDate: datesSanitized.dateValues[0],
12033
+ endDate: datesSanitized.dateValues[1],
12034
+ secondaryStartDate: datesSanitized.secDateValues[0],
12035
+ secondaryEndDate: datesSanitized.secDateValues[1],
12036
+ type: 'project',
12037
+ valuesToShow: valuesToShow,
12038
+ rowType: KupPlannerGanttRowType.TASK,
11655
12039
  };
11656
12040
  return task;
11657
12041
  });
11658
12042
  return tasks;
12043
+ }, _KupPlanner_toDetails = function _KupPlanner_toDetails(data) {
12044
+ let details = [];
12045
+ if (!data || !data.rows) {
12046
+ return details;
12047
+ }
12048
+ data.rows
12049
+ .filter((row) => isAtLeastOneDateValid(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]))
12050
+ .forEach((row) => {
12051
+ const detailId = row.cells[this.detailIdCol].value;
12052
+ const detailNameId = row.cells[this.detailNameCol].value;
12053
+ const datesSanitized = sanitizeAllDates(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]);
12054
+ const valuesToShow = getValuesToShow(row, this.detailIdCol, this.detailNameCol, data.columns, this.detailColumns);
12055
+ let detail = details.find((det) => det.id == detailId);
12056
+ if (!detail) {
12057
+ detail = {
12058
+ id: detailId,
12059
+ name: detailNameId,
12060
+ type: 'timeline',
12061
+ valuesToShow: valuesToShow,
12062
+ rowType: KupPlannerGanttRowType.DETAIL,
12063
+ schedule: [],
12064
+ };
12065
+ details.push(detail);
12066
+ }
12067
+ detail.schedule.push({
12068
+ startDate: datesSanitized.dateValues[0],
12069
+ endDate: datesSanitized.dateValues[1],
12070
+ color: this.detailColorCol
12071
+ ? row.cells[this.detailColorCol].value
12072
+ : '#D9D9D8',
12073
+ selectedColor: this.detailColorCol
12074
+ ? row.cells[this.detailColorCol].value
12075
+ : '#D9D9D8',
12076
+ });
12077
+ });
12078
+ return details;
11659
12079
  }, _KupPlanner_getTask = function _KupPlanner_getTask(taskId) {
11660
- return this.plannerProps.items.find((task) => task.id == taskId);
12080
+ return this.plannerProps.mainGantt.items.find((task) => task.id == taskId);
11661
12081
  }, _KupPlanner_removePhases = function _KupPlanner_removePhases(taskId) {
11662
12082
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11663
12083
  if (task)
11664
12084
  task.phases = undefined;
12085
+ // this.plannerProps.mainGantt = JSON.parse(
12086
+ // JSON.stringify(this.plannerProps.mainGantt)
12087
+ // );
11665
12088
  this.plannerProps = Object.assign({}, this.plannerProps);
11666
12089
  }, _KupPlanner_handleOnClickOnTask = function _KupPlanner_handleOnClickOnTask(nativeEvent) {
11667
12090
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, nativeEvent.id);
@@ -11671,6 +12094,8 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11671
12094
  return true;
11672
12095
  }, _KupPlanner_handleOnClickOnPhase = function _KupPlanner_handleOnClickOnPhase() {
11673
12096
  return true;
12097
+ }, _KupPlanner_handleOnClickOnDetail = function _KupPlanner_handleOnClickOnDetail() {
12098
+ return true;
11674
12099
  }, _KupPlanner_emitOnChangeEventsReceived = function _KupPlanner_emitOnChangeEventsReceived(nativeEvent) {
11675
12100
  let emitEvent = false;
11676
12101
  if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f")) {