@sme.up/ketchup 7.4.0 → 7.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/ketchup.cjs.js +2 -2
  2. package/dist/cjs/kup-planner.cjs.entry.js +1006 -549
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/collection/collection-manifest.json +1 -1
  5. package/dist/collection/components/kup-planner/kup-planner-declarations.js +60 -14
  6. package/dist/collection/components/kup-planner/kup-planner-helper.js +54 -0
  7. package/dist/collection/components/kup-planner/kup-planner.css +16 -18
  8. package/dist/collection/components/kup-planner/kup-planner.js +447 -68
  9. package/dist/components/kup-autocomplete2.js +1 -1
  10. package/dist/components/kup-planner.js +1006 -538
  11. package/dist/components/kup-progress-bar.js +1 -1
  12. package/dist/components/kup-radio.js +1 -1
  13. package/dist/components/kup-rating.js +1 -1
  14. package/dist/components/kup-spinner.js +1 -1
  15. package/dist/components/kup-switch.js +1 -1
  16. package/dist/components/kup-tab-bar.js +1 -1
  17. package/dist/components/kup-text-field.js +1 -1
  18. package/dist/components/kup-time-picker.js +1 -1
  19. package/dist/components/kup-tree.js +1 -1
  20. package/dist/esm/ketchup.js +2 -2
  21. package/dist/esm/kup-planner.entry.js +994 -537
  22. package/dist/esm/loader.js +2 -2
  23. package/dist/ketchup/ketchup.esm.js +1 -1
  24. package/dist/ketchup/p-02a26d59.entry.js +9 -0
  25. package/dist/ketchup/p-462475ac.entry.js +10 -0
  26. package/dist/ketchup/{p-c1137ffd.entry.js → p-4d039705.entry.js} +6 -6
  27. package/dist/ketchup/p-5292ef67.js +3 -3
  28. package/dist/ketchup/p-be61dd36.entry.js +39 -0
  29. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +66 -15
  30. package/dist/types/components/kup-planner/kup-planner-helper.d.ts +6 -0
  31. package/dist/types/components/kup-planner/kup-planner.d.ts +118 -3
  32. package/dist/types/components.d.ts +234 -2
  33. package/package.json +6 -4
  34. package/dist/ketchup/p-4fa7bffd.entry.js +0 -39
  35. package/dist/ketchup/p-8826f5d6.entry.js +0 -11
  36. package/dist/ketchup/p-d5200264.entry.js +0 -9
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-74433248.js');
6
- const kupManager = require('./kup-manager-10351449.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,72 @@ 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
- })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
47
+ })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
48
+ var KupPlannerGanttRowType;
49
+ (function (KupPlannerGanttRowType) {
50
+ KupPlannerGanttRowType["TASK"] = "task";
51
+ KupPlannerGanttRowType["PHASE"] = "phase";
52
+ KupPlannerGanttRowType["DETAIL"] = "detail";
53
+ })(KupPlannerGanttRowType || (KupPlannerGanttRowType = {}));
54
+ class KupPlannerLastOnChangeReceived {
55
+ constructor(event, threshold = 100) {
56
+ this.dateTime = new Date();
57
+ this.event = event;
58
+ this.threshold = threshold;
59
+ }
60
+ isEquivalent(newEvent) {
61
+ const intervalTime = new Date().valueOf() - this.dateTime.valueOf();
62
+ const equals = JSON.stringify(this.event) === JSON.stringify(newEvent);
63
+ return equals && intervalTime < this.threshold;
64
+ }
65
+ resetDateTime() {
66
+ this.dateTime = new Date();
67
+ }
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
+ };
36
82
 
37
83
  /**
38
84
  * @license React
@@ -99,17 +145,17 @@ var react_production_min = {
99
145
  version: version$1
100
146
  };
101
147
 
102
- kupManager.createCommonjsModule(function (module, exports) {
148
+ kupManager$1.createCommonjsModule(function (module, exports) {
103
149
  });
104
150
 
105
- var react = kupManager.createCommonjsModule(function (module) {
151
+ var react = kupManager$1.createCommonjsModule(function (module) {
106
152
 
107
153
  {
108
154
  module.exports = react_production_min;
109
155
  }
110
156
  });
111
157
 
112
- var scheduler_production_min = kupManager.createCommonjsModule(function (module, exports) {
158
+ var scheduler_production_min = kupManager$1.createCommonjsModule(function (module, exports) {
113
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}
114
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;
115
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);}}
@@ -122,10 +168,10 @@ exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"
122
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;}}};
123
169
  });
124
170
 
125
- kupManager.createCommonjsModule(function (module, exports) {
171
+ kupManager$1.createCommonjsModule(function (module, exports) {
126
172
  });
127
173
 
128
- var scheduler = kupManager.createCommonjsModule(function (module) {
174
+ var scheduler = kupManager$1.createCommonjsModule(function (module) {
129
175
 
130
176
  {
131
177
  module.exports = scheduler_production_min;
@@ -458,10 +504,10 @@ var reactDom_production_min = {
458
504
  version: version
459
505
  };
460
506
 
461
- kupManager.createCommonjsModule(function (module, exports) {
507
+ kupManager$1.createCommonjsModule(function (module, exports) {
462
508
  });
463
509
 
464
- var reactDom = kupManager.createCommonjsModule(function (module) {
510
+ var reactDom = kupManager$1.createCommonjsModule(function (module) {
465
511
 
466
512
  function checkDCE() {
467
513
  /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
@@ -489,7 +535,7 @@ function checkDCE() {
489
535
  }
490
536
  });
491
537
 
492
- var client = kupManager.createCommonjsModule(function (module, exports) {
538
+ var client = kupManager$1.createCommonjsModule(function (module, exports) {
493
539
 
494
540
 
495
541
  {
@@ -498,7 +544,7 @@ var client = kupManager.createCommonjsModule(function (module, exports) {
498
544
  }
499
545
  });
500
546
 
501
- var luxon = kupManager.createCommonjsModule(function (module, exports) {
547
+ var luxon = kupManager$1.createCommonjsModule(function (module, exports) {
502
548
 
503
549
  Object.defineProperty(exports, '__esModule', { value: true });
504
550
 
@@ -8335,18 +8381,6 @@ function _extends() {
8335
8381
  };
8336
8382
  return _extends.apply(this, arguments);
8337
8383
  }
8338
- function _objectWithoutPropertiesLoose(source, excluded) {
8339
- if (source == null) return {};
8340
- var target = {};
8341
- var sourceKeys = Object.keys(source);
8342
- var key, i;
8343
- for (i = 0; i < sourceKeys.length; i++) {
8344
- key = sourceKeys[i];
8345
- if (excluded.indexOf(key) >= 0) continue;
8346
- target[key] = source[key];
8347
- }
8348
- return target;
8349
- }
8350
8384
  function _unsupportedIterableToArray(o, minLen) {
8351
8385
  if (!o) return;
8352
8386
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -8390,6 +8424,230 @@ var ViewMode;
8390
8424
  ViewMode["Year"] = "Year";
8391
8425
  })(ViewMode || (ViewMode = {}));
8392
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
+
8393
8651
  var intlDTCache = {};
8394
8652
  var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts) {
8395
8653
  if (opts === void 0) {
@@ -8404,80 +8662,157 @@ var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts)
8404
8662
  return dtf;
8405
8663
  };
8406
8664
  var addToDate = function addToDate(date, quantity, scale) {
8407
- 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));
8408
8666
  return newDate;
8409
8667
  };
8410
8668
  var startOfDate = function startOfDate(date, scale) {
8411
- var scores = ['millisecond', 'second', 'minute', 'hour', 'day', 'month', 'year'];
8669
+ var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
8412
8670
  var shouldReset = function shouldReset(_scale) {
8413
8671
  var maxScore = scores.indexOf(scale);
8414
8672
  return scores.indexOf(_scale) <= maxScore;
8415
8673
  };
8416
- 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());
8417
8675
  return newDate;
8418
8676
  };
8419
- var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates) {
8420
- var newStartDate = tasks[0].start;
8421
- var newEndDate = tasks[0].start;
8422
- for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8423
- var task = _step.value;
8424
- if (task.start < newStartDate) {
8425
- 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;
8426
8758
  }
8427
- if (task.end > newEndDate) {
8428
- newEndDate = task.end;
8759
+ if (d.end > newEndDate) {
8760
+ newEndDate = d.end;
8429
8761
  }
8430
8762
  if (showSecondaryDates) {
8431
- if (task.secondaryStart && task.secondaryStart < newStartDate) {
8432
- newStartDate = task.secondaryStart;
8763
+ if (d.secondaryStart && d.secondaryStart < newStartDate) {
8764
+ newStartDate = d.secondaryStart;
8433
8765
  }
8434
- if (task.secondaryEnd && task.secondaryEnd > newEndDate) {
8435
- newEndDate = task.secondaryEnd;
8766
+ if (d.secondaryEnd && d.secondaryEnd > newEndDate) {
8767
+ newEndDate = d.secondaryEnd;
8436
8768
  }
8437
8769
  }
8438
8770
  }
8771
+ if (realDates) {
8772
+ return [newStartDate, newEndDate];
8773
+ }
8439
8774
  switch (viewMode) {
8440
8775
  case ViewMode.Year:
8441
- newStartDate = addToDate(newStartDate, -1, 'year');
8442
- newStartDate = startOfDate(newStartDate, 'year');
8443
- newEndDate = addToDate(newEndDate, 1, 'year');
8444
- 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");
8445
8780
  break;
8446
8781
  case ViewMode.Month:
8447
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'month');
8448
- newStartDate = startOfDate(newStartDate, 'month');
8449
- newEndDate = addToDate(newEndDate, 1, 'year');
8450
- 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");
8451
8786
  break;
8452
8787
  case ViewMode.Week:
8453
- newStartDate = startOfDate(newStartDate, 'day');
8454
- newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, 'day');
8455
- newEndDate = startOfDate(newEndDate, 'day');
8456
- 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");
8457
8792
  break;
8458
8793
  case ViewMode.Day:
8459
- newStartDate = startOfDate(newStartDate, 'day');
8460
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8461
- newEndDate = startOfDate(newEndDate, 'day');
8462
- 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");
8463
8798
  break;
8464
8799
  case ViewMode.QuarterDay:
8465
- newStartDate = startOfDate(newStartDate, 'day');
8466
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8467
- newEndDate = startOfDate(newEndDate, 'day');
8468
- 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");
8469
8804
  break;
8470
8805
  case ViewMode.HalfDay:
8471
- newStartDate = startOfDate(newStartDate, 'day');
8472
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8473
- newEndDate = startOfDate(newEndDate, 'day');
8474
- 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");
8475
8810
  break;
8476
8811
  case ViewMode.Hour:
8477
- newStartDate = startOfDate(newStartDate, 'hour');
8478
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'hour');
8479
- newEndDate = startOfDate(newEndDate, 'day');
8480
- 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");
8481
8816
  break;
8482
8817
  }
8483
8818
  return [newStartDate, newEndDate];
@@ -8488,25 +8823,25 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8488
8823
  while (currentDate < endDate) {
8489
8824
  switch (viewMode) {
8490
8825
  case ViewMode.Year:
8491
- currentDate = addToDate(currentDate, 1, 'year');
8826
+ currentDate = addToDate(currentDate, 1, "year");
8492
8827
  break;
8493
8828
  case ViewMode.Month:
8494
- currentDate = addToDate(currentDate, 1, 'month');
8829
+ currentDate = addToDate(currentDate, 1, "month");
8495
8830
  break;
8496
8831
  case ViewMode.Week:
8497
- currentDate = addToDate(currentDate, 7, 'day');
8832
+ currentDate = addToDate(currentDate, 7, "day");
8498
8833
  break;
8499
8834
  case ViewMode.Day:
8500
- currentDate = addToDate(currentDate, 1, 'day');
8835
+ currentDate = addToDate(currentDate, 1, "day");
8501
8836
  break;
8502
8837
  case ViewMode.HalfDay:
8503
- currentDate = addToDate(currentDate, 12, 'hour');
8838
+ currentDate = addToDate(currentDate, 12, "hour");
8504
8839
  break;
8505
8840
  case ViewMode.QuarterDay:
8506
- currentDate = addToDate(currentDate, 6, 'hour');
8841
+ currentDate = addToDate(currentDate, 6, "hour");
8507
8842
  break;
8508
8843
  case ViewMode.Hour:
8509
- currentDate = addToDate(currentDate, 1, 'hour');
8844
+ currentDate = addToDate(currentDate, 1, "hour");
8510
8845
  break;
8511
8846
  }
8512
8847
  dates.push(currentDate);
@@ -8515,7 +8850,7 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8515
8850
  };
8516
8851
  var getLocaleMonth = function getLocaleMonth(date, locale) {
8517
8852
  var bottomValue = getCachedDateTimeFormat(locale, {
8518
- month: 'long'
8853
+ month: "long"
8519
8854
  }).format(date);
8520
8855
  bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
8521
8856
  return bottomValue;
@@ -8565,15 +8900,15 @@ var defaultDateTimeFormatters = {
8565
8900
  return "W" + getWeekNumberISO8601(date);
8566
8901
  },
8567
8902
  day: function day(date, locale) {
8568
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate().toString();
8903
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate().toString();
8569
8904
  },
8570
8905
  hour: function hour(date, locale) {
8571
8906
  return "" + getCachedDateTimeFormat(locale, {
8572
- hour: 'numeric'
8907
+ hour: "numeric"
8573
8908
  }).format(date);
8574
8909
  },
8575
8910
  dayAndMonth: function dayAndMonth(date, locale) {
8576
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8911
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8577
8912
  }
8578
8913
  };
8579
8914
 
@@ -8893,9 +9228,7 @@ var GridBody = function GridBody(_ref) {
8893
9228
  dates = _ref.dates,
8894
9229
  rowHeight = _ref.rowHeight,
8895
9230
  svgWidth = _ref.svgWidth,
8896
- columnWidth = _ref.columnWidth,
8897
- todayColor = _ref.todayColor,
8898
- rtl = _ref.rtl;
9231
+ columnWidth = _ref.columnWidth;
8899
9232
  var y = 0;
8900
9233
  var gridRows = [];
8901
9234
  var rowLines = [react.createElement("line", {
@@ -8909,7 +9242,7 @@ var GridBody = function GridBody(_ref) {
8909
9242
  for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8910
9243
  var task = _step.value;
8911
9244
  gridRows.push(react.createElement("rect", {
8912
- key: 'Row' + task.id,
9245
+ key: "Row" + task.id,
8913
9246
  x: "0",
8914
9247
  y: y,
8915
9248
  width: svgWidth,
@@ -8917,7 +9250,7 @@ var GridBody = function GridBody(_ref) {
8917
9250
  className: styles$4.gridRow
8918
9251
  }));
8919
9252
  rowLines.push(react.createElement("line", {
8920
- key: 'RowLine' + task.id,
9253
+ key: "RowLine" + task.id,
8921
9254
  x: "0",
8922
9255
  y1: y + rowHeight,
8923
9256
  x2: svgWidth,
@@ -8929,7 +9262,6 @@ var GridBody = function GridBody(_ref) {
8929
9262
  var now = new Date();
8930
9263
  var tickX = 0;
8931
9264
  var ticks = [];
8932
- var today = react.createElement("rect", null);
8933
9265
  for (var i = 0; i < dates.length; i++) {
8934
9266
  var date = dates[i];
8935
9267
  ticks.push(react.createElement("line", {
@@ -8940,24 +9272,7 @@ var GridBody = function GridBody(_ref) {
8940
9272
  y2: y,
8941
9273
  className: styles$4.gridTick
8942
9274
  }));
8943
- 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()) {
8944
- today = react.createElement("rect", {
8945
- x: tickX + columnWidth / 2 - 1,
8946
- y: 0,
8947
- width: 2,
8948
- height: y,
8949
- fill: todayColor
8950
- });
8951
- }
8952
- if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
8953
- today = react.createElement("rect", {
8954
- x: tickX + columnWidth / 2,
8955
- y: 0,
8956
- width: 2,
8957
- height: y,
8958
- fill: todayColor
8959
- });
8960
- }
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()) ;
8961
9276
  tickX += columnWidth;
8962
9277
  }
8963
9278
  return react.createElement("g", {
@@ -8968,9 +9283,7 @@ var GridBody = function GridBody(_ref) {
8968
9283
  className: "rowLines"
8969
9284
  }, rowLines), react.createElement("g", {
8970
9285
  className: "ticks"
8971
- }, ticks), react.createElement("g", {
8972
- className: "today"
8973
- }, today));
9286
+ }, ticks));
8974
9287
  };
8975
9288
 
8976
9289
  var Grid = function Grid(props) {
@@ -9040,7 +9353,8 @@ var Calendar = function Calendar(_ref) {
9040
9353
  fontSize = _ref.fontSize,
9041
9354
  dateTimeFormatters = _ref.dateTimeFormatters,
9042
9355
  _ref$singleLineHeader = _ref.singleLineHeader,
9043
- singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader;
9356
+ singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
9357
+ currentDateIndicator = _ref.currentDateIndicator;
9044
9358
  var simplifiedHeader = singleLineHeader && dateSetup.viewMode !== ViewMode.Year;
9045
9359
  var TopCal = simplifiedHeader ? SinglePartOfCalendar : TopPartOfCalendar;
9046
9360
  var formatYear = (_dateTimeFormatters$y = dateTimeFormatters === null || dateTimeFormatters === void 0 ? void 0 : dateTimeFormatters.year) != null ? _dateTimeFormatters$y : defaultDateTimeFormatters.year;
@@ -9126,7 +9440,7 @@ var Calendar = function Calendar(_ref) {
9126
9440
  var dates = dateSetup.dates;
9127
9441
  for (var i = dates.length - 1; i >= 0; i--) {
9128
9442
  var date = dates[i];
9129
- var topValue = '';
9443
+ var topValue = "";
9130
9444
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
9131
9445
  topValue = formatMonthAndYear(date, locale);
9132
9446
  }
@@ -9261,7 +9575,12 @@ var Calendar = function Calendar(_ref) {
9261
9575
  width: columnWidth * dateSetup.dates.length,
9262
9576
  height: headerHeight,
9263
9577
  className: styles$5.calendarHeader
9264
- }), 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
+ }));
9265
9584
  };
9266
9585
 
9267
9586
  // A type of promise-like that resolves synchronously and supports only one observer
@@ -9500,6 +9819,9 @@ var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
9500
9819
  var index = dates.findIndex(function (d) {
9501
9820
  return d.getTime() >= xDate.getTime();
9502
9821
  }) - 1;
9822
+ if (index < 0) {
9823
+ return 0;
9824
+ }
9503
9825
  var remainderMillis = xDate.getTime() - dates[index].getTime();
9504
9826
  var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
9505
9827
  var x = index * columnWidth + percentOfInterval * columnWidth;
@@ -9657,6 +9979,15 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
9657
9979
  changedTask: changedTask
9658
9980
  };
9659
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
+ }
9660
9991
 
9661
9992
  function isKeyboardEvent(event) {
9662
9993
  return event.key !== undefined;
@@ -9919,11 +10250,15 @@ var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
9919
10250
 
9920
10251
  var Timeline = function Timeline(_ref) {
9921
10252
  var task = _ref.task,
9922
- isSelected = _ref.isSelected;
10253
+ isSelected = _ref.isSelected,
10254
+ onEventStart = _ref.onEventStart;
9923
10255
  var styles = task.styles;
9924
10256
  var col = isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
9925
10257
  return react.createElement("g", {
9926
- tabIndex: 0
10258
+ tabIndex: 0,
10259
+ onMouseDown: function onMouseDown(e) {
10260
+ return onEventStart("move", task, e);
10261
+ }
9927
10262
  }, react.createElement("rect", {
9928
10263
  fill: col,
9929
10264
  x: "0",
@@ -9934,6 +10269,9 @@ var Timeline = function Timeline(_ref) {
9934
10269
  ry: 0
9935
10270
  }), task.barChildren.map(function (bar) {
9936
10271
  return react.createElement("rect", {
10272
+ style: {
10273
+ cursor: "pointer"
10274
+ },
9937
10275
  key: bar.id,
9938
10276
  fill: bar.styles.backgroundColor,
9939
10277
  x: bar.x1,
@@ -9979,7 +10317,7 @@ var TaskItem = function TaskItem(props) {
9979
10317
  setTaskItem(react.createElement(Bar, Object.assign({}, props)));
9980
10318
  break;
9981
10319
  }
9982
- }, [task.typeInternal, isSelected, props]);
10320
+ }, [task, isSelected]);
9983
10321
  react.useEffect(function () {
9984
10322
  if (textRef.current) {
9985
10323
  setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
@@ -10047,6 +10385,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10047
10385
  fontFamily = _ref.fontFamily,
10048
10386
  fontSize = _ref.fontSize,
10049
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,
10050
10394
  setGanttEvent = _ref.setGanttEvent,
10051
10395
  setFailedTask = _ref.setFailedTask,
10052
10396
  setSelectedTask = _ref.setSelectedTask,
@@ -10054,11 +10398,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10054
10398
  onProgressChange = _ref.onProgressChange,
10055
10399
  onDoubleClick = _ref.onDoubleClick,
10056
10400
  onClick = _ref.onClick,
10057
- onDelete = _ref.onDelete,
10058
- _ref$hideLabel = _ref.hideLabel,
10059
- hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10060
- _ref$showSecondaryDat = _ref.showSecondaryDates,
10061
- showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat;
10401
+ onDelete = _ref.onDelete;
10062
10402
  var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
10063
10403
  var _useState = react.useState(0),
10064
10404
  xStep = _useState[0],
@@ -10246,7 +10586,20 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10246
10586
  };
10247
10587
  return react.createElement("g", {
10248
10588
  className: "content"
10249
- }, 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", {
10250
10603
  className: "arrows",
10251
10604
  fill: arrowColor,
10252
10605
  stroke: arrowColor
@@ -10354,6 +10707,7 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10354
10707
  scrollRef.current.scrollLeft = scroll;
10355
10708
  }
10356
10709
  }, [scroll]);
10710
+ console.log("HORIZONTAL-SCROLL svgWidth: " + svgWidth);
10357
10711
  return react.createElement("div", {
10358
10712
  dir: "ltr",
10359
10713
  style: {
@@ -10371,13 +10725,14 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10371
10725
  };
10372
10726
 
10373
10727
  var Gantt = function Gantt(_ref) {
10374
- var tasks = _ref.tasks,
10728
+ var id = _ref.id,
10729
+ tasks = _ref.tasks,
10375
10730
  _ref$headerHeight = _ref.headerHeight,
10376
10731
  headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
10377
10732
  _ref$columnWidth = _ref.columnWidth,
10378
10733
  columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
10379
10734
  _ref$listCellWidth = _ref.listCellWidth,
10380
- listCellWidth = _ref$listCellWidth === void 0 ? "155px" : _ref$listCellWidth,
10735
+ listCellWidth = _ref$listCellWidth === void 0 ? "297px" : _ref$listCellWidth,
10381
10736
  _ref$rowHeight = _ref.rowHeight,
10382
10737
  rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
10383
10738
  _ref$ganttHeight = _ref.ganttHeight,
@@ -10427,7 +10782,7 @@ var Gantt = function Gantt(_ref) {
10427
10782
  _ref$arrowIndent = _ref.arrowIndent,
10428
10783
  arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
10429
10784
  _ref$todayColor = _ref.todayColor,
10430
- todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
10785
+ todayColor = _ref$todayColor === void 0 ? "#ff0000" : _ref$todayColor,
10431
10786
  viewDate = _ref.viewDate,
10432
10787
  _ref$TooltipContent = _ref.TooltipContent,
10433
10788
  TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
@@ -10435,13 +10790,6 @@ var Gantt = function Gantt(_ref) {
10435
10790
  TaskListHeader = _ref$TaskListHeader === void 0 ? TaskListHeaderDefault : _ref$TaskListHeader,
10436
10791
  _ref$TaskListTable = _ref.TaskListTable,
10437
10792
  TaskListTable = _ref$TaskListTable === void 0 ? TaskListTableDefault : _ref$TaskListTable,
10438
- onDateChange = _ref.onDateChange,
10439
- onProgressChange = _ref.onProgressChange,
10440
- onDoubleClick = _ref.onDoubleClick,
10441
- onClick = _ref.onClick,
10442
- onDelete = _ref.onDelete,
10443
- onSelect = _ref.onSelect,
10444
- onExpanderClick = _ref.onExpanderClick,
10445
10793
  dateTimeFormatters = _ref.dateTimeFormatters,
10446
10794
  _ref$singleLineHeader = _ref.singleLineHeader,
10447
10795
  singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
@@ -10450,13 +10798,23 @@ var Gantt = function Gantt(_ref) {
10450
10798
  _ref$showSecondaryDat = _ref.showSecondaryDates,
10451
10799
  showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10452
10800
  _ref$hideDependencies = _ref.hideDependencies,
10453
- 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;
10454
10812
  var wrapperRef = react.useRef(null);
10455
10813
  var taskListRef = react.useRef(null);
10456
10814
  var _useState = react.useState(function () {
10457
- var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates),
10458
- startDate = _ganttDateRange[0],
10459
- endDate = _ganttDateRange[1];
10815
+ var _ganttDateRangeFromTa = ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10816
+ startDate = _ganttDateRangeFromTa[0],
10817
+ endDate = _ganttDateRangeFromTa[1];
10460
10818
  return {
10461
10819
  viewMode: viewMode,
10462
10820
  dates: seedDates(startDate, endDate, viewMode)
@@ -10510,6 +10868,19 @@ var Gantt = function Gantt(_ref) {
10510
10868
  var _useState12 = react.useState(false),
10511
10869
  ignoreScrollEvent = _useState12[0],
10512
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]);
10513
10884
  react.useEffect(function () {
10514
10885
  var filteredTasks;
10515
10886
  if (onExpanderClick) {
@@ -10518,9 +10889,9 @@ var Gantt = function Gantt(_ref) {
10518
10889
  filteredTasks = tasks;
10519
10890
  }
10520
10891
  filteredTasks = filteredTasks.sort(sortTasks);
10521
- var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount, showSecondaryDates),
10522
- startDate = _ganttDateRange2[0],
10523
- endDate = _ganttDateRange2[1];
10892
+ var _ganttDateRangeFromTa2 = ganttDateRangeFromTask(filteredTasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10893
+ startDate = _ganttDateRangeFromTa2[0],
10894
+ endDate = _ganttDateRangeFromTa2[1];
10524
10895
  var newDates = seedDates(startDate, endDate, viewMode);
10525
10896
  if (rtl) {
10526
10897
  newDates = newDates.reverse();
@@ -10533,7 +10904,7 @@ var Gantt = function Gantt(_ref) {
10533
10904
  viewMode: viewMode
10534
10905
  });
10535
10906
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, projectHeight, timelineHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, showSecondaryDates));
10536
- }, [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]);
10537
10908
  react.useEffect(function () {
10538
10909
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
10539
10910
  var dates = dateSetup.dates;
@@ -10645,11 +11016,20 @@ var Gantt = function Gantt(_ref) {
10645
11016
  if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
10646
11017
  setScrollX(event.currentTarget.scrollLeft);
10647
11018
  setIgnoreScrollEvent(true);
11019
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11020
+ detail: {
11021
+ componentId: id,
11022
+ scrollX: event.currentTarget.scrollLeft
11023
+ }
11024
+ }));
10648
11025
  } else {
10649
11026
  setIgnoreScrollEvent(false);
10650
11027
  }
10651
11028
  };
10652
11029
  var handleKeyDown = function handleKeyDown(event) {
11030
+ if (event.target.tagName === "INPUT") {
11031
+ return;
11032
+ }
10653
11033
  event.preventDefault();
10654
11034
  var newScrollY = scrollY;
10655
11035
  var newScrollX = scrollX;
@@ -10681,6 +11061,12 @@ var Gantt = function Gantt(_ref) {
10681
11061
  newScrollX = svgWidth;
10682
11062
  }
10683
11063
  setScrollX(newScrollX);
11064
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11065
+ detail: {
11066
+ componentId: id,
11067
+ scrollX: newScrollX
11068
+ }
11069
+ }));
10684
11070
  } else {
10685
11071
  if (newScrollY < 0) {
10686
11072
  newScrollY = 0;
@@ -10691,6 +11077,29 @@ var Gantt = function Gantt(_ref) {
10691
11077
  }
10692
11078
  setIgnoreScrollEvent(true);
10693
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]);
10694
11103
  var handleSelectedTask = function handleSelectedTask(taskId) {
10695
11104
  var newSelectedTask = barTasks.find(function (t) {
10696
11105
  return t.id === taskId;
@@ -10734,7 +11143,8 @@ var Gantt = function Gantt(_ref) {
10734
11143
  fontSize: fontSize,
10735
11144
  rtl: rtl,
10736
11145
  dateTimeFormatters: dateTimeFormatters,
10737
- singleLineHeader: singleLineHeader
11146
+ singleLineHeader: singleLineHeader,
11147
+ currentDateIndicator: currentDateIndicatorContent
10738
11148
  };
10739
11149
  var barProps = {
10740
11150
  tasks: barTasks,
@@ -10751,6 +11161,11 @@ var Gantt = function Gantt(_ref) {
10751
11161
  arrowIndent: arrowIndent,
10752
11162
  svgWidth: svgWidth,
10753
11163
  rtl: rtl,
11164
+ hideLabel: hideLabel,
11165
+ showSecondaryDates: showSecondaryDates,
11166
+ ganttHeight: ganttHeight,
11167
+ currentDateIndicator: currentDateIndicatorContent,
11168
+ projection: projectionContent,
10754
11169
  setGanttEvent: setGanttEvent,
10755
11170
  setFailedTask: setFailedTask,
10756
11171
  setSelectedTask: handleSelectedTask,
@@ -10758,9 +11173,7 @@ var Gantt = function Gantt(_ref) {
10758
11173
  onProgressChange: onProgressChange,
10759
11174
  onDoubleClick: onDoubleClick,
10760
11175
  onClick: onClick,
10761
- onDelete: onDelete,
10762
- hideLabel: hideLabel,
10763
- showSecondaryDates: showSecondaryDates
11176
+ onDelete: onDelete
10764
11177
  };
10765
11178
  var tableProps = {
10766
11179
  rowHeight: rowHeight,
@@ -10823,195 +11236,6 @@ var Gantt = function Gantt(_ref) {
10823
11236
  }));
10824
11237
  };
10825
11238
 
10826
- var TimeUnit;
10827
- (function (TimeUnit) {
10828
- TimeUnit["DAY"] = "days";
10829
- TimeUnit["WEEK"] = "weeks";
10830
- TimeUnit["MONTH"] = "months";
10831
- TimeUnit["YEAR"] = "YEAR";
10832
- })(TimeUnit || (TimeUnit = {}));
10833
-
10834
- var parseToDayStart = function parseToDayStart(ymd) {
10835
- return luxon.DateTime.fromISO(ymd).toJSDate();
10836
- };
10837
- var parseToDayEnd = function parseToDayEnd(endDate) {
10838
- return luxon.DateTime.fromISO(endDate).plus({
10839
- seconds: 86400 - 1
10840
- }).toJSDate();
10841
- };
10842
- var formatToIsoDate = function formatToIsoDate(date) {
10843
- return luxon.DateTime.fromJSDate(date).toISODate();
10844
- };
10845
- var formatToLocaleSimple = function formatToLocaleSimple(date) {
10846
- return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
10847
- };
10848
- function validDates(startDate, endDate, name) {
10849
- var _start;
10850
- var start = parseToDayStart(startDate);
10851
- var end = parseToDayEnd(endDate);
10852
- if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
10853
- start = parseToDayStart(endDate);
10854
- console.log("time-converters.ts validDates() Error date", {
10855
- name: name,
10856
- start: startDate,
10857
- end: endDate
10858
- });
10859
- }
10860
- return {
10861
- start: start,
10862
- end: end
10863
- };
10864
- }
10865
-
10866
- var toViewMode = function toViewMode(timeUnit) {
10867
- switch (timeUnit) {
10868
- case TimeUnit.DAY:
10869
- return ViewMode.Day;
10870
- case TimeUnit.WEEK:
10871
- return ViewMode.Week;
10872
- case TimeUnit.MONTH:
10873
- return ViewMode.Month;
10874
- case TimeUnit.YEAR:
10875
- return ViewMode.Year;
10876
- }
10877
- };
10878
- var convertPhaseToTask = function convertPhaseToTask(item) {
10879
- var mapPhase = function mapPhase(_ref) {
10880
- var phaseStart = _ref.startDate,
10881
- phaseEnd = _ref.endDate,
10882
- secondaryStartDate = _ref.secondaryStartDate,
10883
- secondaryEndDate = _ref.secondaryEndDate,
10884
- phaseName = _ref.name,
10885
- phaseId = _ref.id,
10886
- color = _ref.color,
10887
- selectedColor = _ref.selectedColor,
10888
- dependencies = _ref.dependencies;
10889
- var _validDates = validDates(phaseStart, phaseEnd, phaseName),
10890
- start = _validDates.start,
10891
- end = _validDates.end;
10892
- var _validDates2 = validDates(secondaryStartDate, secondaryEndDate, phaseName),
10893
- phaseStart2 = _validDates2.start,
10894
- phaseEnd2 = _validDates2.end;
10895
- return {
10896
- start: start,
10897
- end: end,
10898
- secondaryStart: phaseStart2,
10899
- secondaryEnd: phaseEnd2,
10900
- name: phaseName,
10901
- valuesToShow: item.valuesToShow,
10902
- id: phaseId,
10903
- type: "task",
10904
- progress: 100,
10905
- dependencies: dependencies,
10906
- styles: color ? {
10907
- backgroundColor: color,
10908
- progressColor: color,
10909
- backgroundSelectedColor: selectedColor,
10910
- progressSelectedColor: selectedColor
10911
- } : {}
10912
- };
10913
- };
10914
- return mapPhase(item);
10915
- };
10916
- var convertDetailToTimeline = function convertDetailToTimeline(item) {
10917
- var id = item.id,
10918
- name = item.name,
10919
- schedule = item.schedule;
10920
- var convertToFrame = function convertToFrame(x) {
10921
- var startDate = x.startDate,
10922
- endDate = x.endDate,
10923
- color = x.color,
10924
- selectedColor = x.selectedColor;
10925
- var _validDates3 = validDates(startDate, endDate, "time frame"),
10926
- start = _validDates3.start,
10927
- end = _validDates3.end;
10928
- return {
10929
- start: start,
10930
- end: end,
10931
- backgroundColor: color != null ? color : "0xffffff",
10932
- backgroundSelectedColor: selectedColor != null ? selectedColor : color
10933
- };
10934
- };
10935
- var defaultColor = "#595959";
10936
- return {
10937
- id: id,
10938
- type: "timeline",
10939
- timeline: schedule.map(convertToFrame),
10940
- name: name,
10941
- valuesToShow: item.valuesToShow,
10942
- start: new Date(),
10943
- end: new Date(),
10944
- progress: 100,
10945
- styles: {
10946
- backgroundColor: defaultColor,
10947
- progressColor: defaultColor,
10948
- backgroundSelectedColor: defaultColor,
10949
- progressSelectedColor: defaultColor
10950
- }
10951
- };
10952
- };
10953
- var convertProjectToTasks = function convertProjectToTasks(_ref2) {
10954
- var id = _ref2.id,
10955
- name = _ref2.name,
10956
- valuesToShow = _ref2.valuesToShow,
10957
- startDate = _ref2.startDate,
10958
- endDate = _ref2.endDate,
10959
- phases = _ref2.phases,
10960
- details = _ref2.details,
10961
- secondaryStartDate = _ref2.secondaryStartDate,
10962
- secondaryEndDate = _ref2.secondaryEndDate;
10963
- var _validDates4 = validDates(startDate, endDate, name),
10964
- start = _validDates4.start,
10965
- end = _validDates4.end;
10966
- var _validDates5 = validDates(secondaryStartDate, secondaryEndDate, name),
10967
- start2 = _validDates5.start,
10968
- end2 = _validDates5.end;
10969
- var mainTask = {
10970
- start: start,
10971
- end: end,
10972
- id: id,
10973
- name: name,
10974
- valuesToShow: valuesToShow,
10975
- secondaryStart: start2,
10976
- secondaryEnd: end2,
10977
- type: "project",
10978
- progress: 100,
10979
- isDisabled: false,
10980
- hideChildren: false
10981
- };
10982
- var children1 = (phases != null ? phases : []).map(convertPhaseToTask);
10983
- var children2 = (details != null ? details : []).map(convertDetailToTimeline);
10984
- return [mainTask].concat(children1, children2);
10985
- };
10986
- var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref3) {
10987
- var id = _ref3.id,
10988
- start = _ref3.start,
10989
- end = _ref3.end;
10990
- return projects.map(function (project) {
10991
- return project.id === id ? withNewDates(project, start, end) : project;
10992
- });
10993
- };
10994
- var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref4) {
10995
- var id = _ref4.id,
10996
- start = _ref4.start,
10997
- end = _ref4.end;
10998
- if (phases) {
10999
- return phases.map(function (phase) {
11000
- return phase.id === id ? withNewDates(phase, start, end) : phase;
11001
- });
11002
- }
11003
- return undefined;
11004
- };
11005
- var withNewDates = function withNewDates(p, start, end) {
11006
- var startDate = formatToIsoDate(start);
11007
- var endDate = formatToIsoDate(end);
11008
- var extra = {
11009
- startDate: startDate,
11010
- endDate: endDate
11011
- };
11012
- return _extends({}, p, extra);
11013
- };
11014
-
11015
11239
  var cachedFormats = {};
11016
11240
  var getOrBuildCachedFormat = function getOrBuildCachedFormat(locale, options) {
11017
11241
  var _cachedFormats$key;
@@ -11024,8 +11248,8 @@ var format = function format(date, locale, options) {
11024
11248
  var format1 = getOrBuildCachedFormat(locale, options).format(date);
11025
11249
  return format1;
11026
11250
  } catch (e) {
11027
- console.log("time-formatters.ts format", date, locale, options);
11028
- console.log(e);
11251
+ console.error("time-formatters.ts format", date, locale, options);
11252
+ console.error(e);
11029
11253
  }
11030
11254
  };
11031
11255
  var dayFormatter = function dayFormatter(date, locale) {
@@ -11048,120 +11272,23 @@ var ganttDateTimeFormatters = {
11048
11272
  month: monthFormatter
11049
11273
  };
11050
11274
 
11051
- var _excluded = ["projects", "timeUnit", "TooltipContent", "TaskListHeader", "TaskListTable", "onDateChange", "onClick", "stylingOptions"];
11052
- var locale = "it-IT";
11053
- var GanttByTask = function GanttByTask(_ref) {
11054
- var _stylingOptions$preSt, _DateTime$now$minus;
11055
- var _ref$projects = _ref.projects,
11056
- projects = _ref$projects === void 0 ? [] : _ref$projects,
11057
- _ref$timeUnit = _ref.timeUnit,
11058
- timeUnit = _ref$timeUnit === void 0 ? TimeUnit.DAY : _ref$timeUnit,
11059
- TooltipContent = _ref.TooltipContent,
11060
- TaskListHeader = _ref.TaskListHeader,
11061
- TaskListTable = _ref.TaskListTable,
11062
- onDateChange = _ref.onDateChange,
11063
- onClick = _ref.onClick,
11064
- _ref$stylingOptions = _ref.stylingOptions,
11065
- stylingOptions = _ref$stylingOptions === void 0 ? {} : _ref$stylingOptions,
11066
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
11067
- var _useState = react.useState(projects),
11068
- currentProjects = _useState[0],
11069
- setCurrentProjects = _useState[1];
11070
- react.useEffect(function () {
11071
- if (projects) setCurrentProjects(projects);
11072
- }, [projects]);
11073
- var _useState2 = react.useState(1),
11074
- key = _useState2[0],
11075
- setKey = _useState2[1];
11076
- var tasks = react.useMemo(function () {
11077
- setKey(function (k) {
11078
- return k + 1;
11079
- });
11080
- return currentProjects.flatMap(convertProjectToTasks);
11081
- }, [currentProjects]);
11082
- var getProjectById = function getProjectById(id) {
11083
- return currentProjects.find(function (p) {
11084
- return p.id === id;
11085
- });
11086
- };
11087
- var handleClick = function handleClick(task) {
11088
- var id = task === null || task === void 0 ? void 0 : task.id;
11089
- console.log("gantt-by-task.tsx onClick", id);
11090
- var project = getProjectById(id);
11091
- if (project) onClick === null || onClick === void 0 ? void 0 : onClick(project);
11092
- var phase = currentProjects.flatMap(function (p) {
11093
- return p.phases;
11094
- }).find(function (ph) {
11095
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11096
- });
11097
- if (phase) onClick === null || onClick === void 0 ? void 0 : onClick(phase);
11098
- };
11099
- var handleDateChange = function handleDateChange(task) {
11100
- var id = task === null || task === void 0 ? void 0 : task.id;
11101
- console.log("gantt-by-task.tsx onDateChange", id);
11102
- var project = getProjectById(id);
11103
- if (project) {
11104
- var result = mergeTaskIntoProjects(currentProjects, task);
11105
- setCurrentProjects(result);
11106
- var _project = result.find(function (p) {
11107
- return p.id === id;
11108
- });
11109
- if (_project) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(_project);
11110
- return;
11111
- }
11112
- var parentOfClickedPhase = currentProjects.find(function (p) {
11113
- var _p$phases;
11114
- return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11115
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11116
- });
11117
- });
11118
- if (parentOfClickedPhase) {
11119
- var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11120
- var updatedProjects = currentProjects.map(function (p) {
11121
- return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11122
- phases: phases
11123
- }) : p;
11124
- });
11125
- setCurrentProjects(updatedProjects);
11126
- var phase = updatedProjects.flatMap(function (p) {
11127
- return p.phases;
11128
- }).find(function (ph) {
11129
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11130
- });
11131
- if (phase) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(phase);
11132
- }
11133
- };
11134
- 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();
11135
- console.log("gantt-by-task.tsx TASKS", tasks);
11136
- var returnElement = (tasks === null || tasks === void 0 ? void 0 : tasks.length) > 0 && react.createElement(Gantt, Object.assign({
11137
- key: key,
11138
- tasks: tasks,
11139
- locale: locale,
11140
- viewMode: toViewMode(timeUnit),
11141
- viewDate: viewDate,
11142
- onClick: handleClick,
11143
- onDateChange: handleDateChange,
11144
- TooltipContent: TooltipContent,
11145
- TaskListHeader: TaskListHeader,
11146
- TaskListTable: TaskListTable,
11147
- dateTimeFormatters: ganttDateTimeFormatters
11148
- }, stylingOptions, props));
11149
- if (returnElement) {
11150
- return returnElement;
11151
- } else {
11152
- return react.createElement("div", null);
11153
- }
11154
- };
11155
-
11156
- 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"};
11157
11276
 
11158
- var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView) {
11159
- 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;
11160
11282
  return react.createElement("div", {
11283
+ style: {
11284
+ fontFamily: fontFamily,
11285
+ fontSize: fontSize,
11286
+ height: headerHeight
11287
+ },
11161
11288
  className: classes$1.wrapper
11162
11289
  }, react.createElement("div", {
11163
11290
  className: classes$1.title
11164
- }, react.createElement("span", null, label)), react.createElement("div", {
11291
+ }, react.createElement("span", null, label)), setDoubleView && react.createElement("div", {
11165
11292
  className: classes$1.toggler
11166
11293
  }, react.createElement("label", {
11167
11294
  htmlFor: "ch2",
@@ -11178,12 +11305,21 @@ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView
11178
11305
  className: classes$1.slider
11179
11306
  })), react.createElement("span", {
11180
11307
  className: classes$1.label
11181
- }, "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
+ })));
11182
11318
  };
11183
11319
  return CustomTaskListHeader;
11184
11320
  };
11185
11321
 
11186
- 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"};
11187
11323
 
11188
11324
  var ProjectRow = function ProjectRow(_ref) {
11189
11325
  var _ref$task = _ref.task,
@@ -11209,7 +11345,7 @@ var ProjectRow = function ProjectRow(_ref) {
11209
11345
  "--grid-project-columns": str
11210
11346
  };
11211
11347
  return react.createElement("div", {
11212
- key: id,
11348
+ key: "task_" + id,
11213
11349
  className: styles$9.project,
11214
11350
  style: customStyle,
11215
11351
  onClick: function onClick() {
@@ -11220,7 +11356,7 @@ var ProjectRow = function ProjectRow(_ref) {
11220
11356
  return react.createElement("span", {
11221
11357
  className: index === 0 ? styles$9.main : undefined,
11222
11358
  title: v.length > 10 ? v : undefined,
11223
- key: id + "_valuesToShow_" + index
11359
+ key: "task_" + id + "_valuesToShow_" + index
11224
11360
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11225
11361
  }));
11226
11362
  };
@@ -11249,7 +11385,7 @@ var SubRow = function SubRow(_ref2) {
11249
11385
  "--grid-fasi-columns": str
11250
11386
  };
11251
11387
  return react.createElement("div", {
11252
- key: id,
11388
+ key: "phase_" + id,
11253
11389
  className: styles$9.subrow,
11254
11390
  style: customStyle,
11255
11391
  onClick: function onClick() {
@@ -11257,7 +11393,7 @@ var SubRow = function SubRow(_ref2) {
11257
11393
  onclickTaskList(id);
11258
11394
  }
11259
11395
  }, react.createElement("span", {
11260
- key: id + "_valuesToShow_color",
11396
+ key: "phase_" + id + "_valuesToShow_color",
11261
11397
  style: {
11262
11398
  height: 16,
11263
11399
  width: 16,
@@ -11267,41 +11403,42 @@ var SubRow = function SubRow(_ref2) {
11267
11403
  return react.createElement("span", {
11268
11404
  className: index === 0 ? styles$9.main : undefined,
11269
11405
  title: v.length > 10 ? v : undefined,
11270
- key: id + "_valuesToShow_" + index
11406
+ key: "phase_" + id + "_valuesToShow_" + index
11271
11407
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11272
11408
  }));
11273
11409
  };
11274
11410
  var TimelineSubRow = function TimelineSubRow(_ref3) {
11275
11411
  var _ref3$task = _ref3.task,
11276
11412
  id = _ref3$task.id,
11277
- name = _ref3$task.name,
11413
+ valuesToShow = _ref3$task.valuesToShow,
11278
11414
  rowHeight = _ref3.rowHeight,
11279
11415
  rowWidth = _ref3.rowWidth,
11280
11416
  fontFamily = _ref3.fontFamily,
11281
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
+ };
11282
11429
  return react.createElement("div", {
11283
- key: id,
11284
- className: styles$9.timelineWrapper,
11285
- style: {
11286
- height: rowHeight,
11287
- width: rowWidth,
11288
- fontFamily: fontFamily,
11289
- fontSize: fontSize
11290
- }
11291
- }, react.createElement("div", {
11430
+ key: "detail_" + id,
11292
11431
  className: styles$9.timeline,
11293
- style: {
11294
- height: rowHeight - 5
11295
- }
11296
- }, react.createElement("span", {
11297
- key: id + "_valuesToShow_0"
11298
- }, name), react.createElement("span", {
11299
- key: id + "_valuesToShow_1"
11300
- }, "A"), react.createElement("span", {
11301
- key: id + "_valuesToShow_2"
11302
- }, "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
+ }));
11303
11440
  };
11304
- var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11441
+ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id) {
11305
11442
  var CustomTaskListTable = function CustomTaskListTable(_ref4) {
11306
11443
  var rowHeight = _ref4.rowHeight,
11307
11444
  rowWidth = _ref4.rowWidth,
@@ -11310,9 +11447,12 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11310
11447
  tasks = _ref4.tasks,
11311
11448
  setSelectedTask = _ref4.setSelectedTask;
11312
11449
  return react.createElement("div", {
11313
- className: styles$9.container
11450
+ className: styles$9.container,
11451
+ key: "tasks_container_" + id
11314
11452
  }, tasks.map(function (task) {
11315
- 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, {
11316
11456
  key: task.id + "_" + task.type,
11317
11457
  task: task,
11318
11458
  rowHeight: rowHeight,
@@ -11397,49 +11537,258 @@ var Switcher = function Switcher(_ref) {
11397
11537
  };
11398
11538
 
11399
11539
  var Planner = function Planner(props) {
11400
- 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;
11401
11541
  var _useState = react.useState(TimeUnit.MONTH),
11402
11542
  timeUnit = _useState[0],
11403
11543
  setTimeUnit = _useState[1];
11404
- var _useState2 = react.useState((_props$showSecondaryD = props.showSecondaryDates) != null ? _props$showSecondaryD : false),
11405
- doubleView = _useState2[0],
11406
- setDoubleView = _useState2[1];
11407
- var commonProps = {
11408
- hideLabel: props.hideLabel,
11409
- showSecondaryDates: doubleView,
11410
- ganttHeight: props.ganttHeight,
11411
- 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);
11412
11565
  };
11413
- console.log("planner.tsx commonProps", commonProps);
11414
- return react.createElement("div", {
11415
- style: {
11416
- 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);
11580
+ }
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)));
11417
11654
  }
11418
- }, react.createElement(Switcher, {
11655
+ }
11656
+ return react.createElement("div", null, react.createElement(Switcher, {
11419
11657
  onTimeUnitChange: function onTimeUnitChange(timeUnit) {
11420
11658
  return setTimeUnit(timeUnit);
11421
11659
  }
11422
- }), react.createElement(GanttByTask, Object.assign({}, commonProps, {
11423
- projects: props.items,
11424
- timeUnit: timeUnit,
11425
- stylingOptions: props.stylingOptions,
11426
- onClick: function onClick(row) {
11427
- var _props$onClick;
11428
- 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
+ }
11429
11697
  },
11430
- onDateChange: function onDateChange(row) {
11431
- var _props$onDateChange;
11432
- 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);
11433
11700
  },
11434
- TaskListHeader: (_props$taskListHeader = props.taskListHeaderProject) != null ? _props$taskListHeader : CustomTaskListHeaderHOC(props.title, doubleView != null ? doubleView : true, setDoubleView),
11435
- TaskListTable: (_props$taskListTableP = props.taskListTableProject) != null ? _props$taskListTableP : CustomTaskListTableHOC(function (id) {
11436
- console.log("planner.tsx Clicked on " + id);
11437
- }),
11438
- TooltipContent: (_props$tooltipContent = props.tooltipContent) != null ? _props$tooltipContent : CustomTooltipHOC()
11439
- })));
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
+ }))));
11440
11737
  };
11441
11738
 
11442
- 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}";
11443
11792
 
11444
11793
  var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11445
11794
  if (kind === "a" && !f)
@@ -11457,7 +11806,7 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
11457
11806
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
11458
11807
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11459
11808
  };
11460
- var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase;
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;
11461
11810
  const KupPlanner = class {
11462
11811
  constructor(hostRef) {
11463
11812
  index.registerInstance(this, hostRef);
@@ -11468,12 +11817,22 @@ const KupPlanner = class {
11468
11817
  /*-------------------------------------------------*/
11469
11818
  /* I n t e r n a l V a r i a b l e s */
11470
11819
  /*-------------------------------------------------*/
11471
- _KupPlanner_kupManager.set(this, kupManager.kupManagerInstance());
11820
+ _KupPlanner_kupManager.set(this, kupManager$1.kupManagerInstance());
11472
11821
  _KupPlanner_rootPlanner.set(this, void 0);
11822
+ _KupPlanner_lastOnChangeReceived.set(this, void 0);
11473
11823
  this.plannerProps = undefined;
11474
11824
  this.customStyle = '';
11475
11825
  this.data = undefined;
11476
- 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';
11477
11836
  this.phaseColorCol = undefined;
11478
11837
  this.phaseColumns = undefined;
11479
11838
  this.phaseColParDep = undefined;
@@ -11481,8 +11840,10 @@ const KupPlanner = class {
11481
11840
  this.phaseIdCol = undefined;
11482
11841
  this.phaseNameCol = undefined;
11483
11842
  this.phasePrevDates = undefined;
11843
+ this.showSecondaryDates = false;
11484
11844
  this.taskColumns = undefined;
11485
11845
  this.taskDates = undefined;
11846
+ this.taskHeight = undefined;
11486
11847
  this.taskIdCol = undefined;
11487
11848
  this.taskNameCol = undefined;
11488
11849
  this.taskPrevDates = undefined;
@@ -11512,7 +11873,7 @@ const KupPlanner = class {
11512
11873
  * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
11513
11874
  */
11514
11875
  async getProps(descriptions) {
11515
- return kupManager.getProps(this, KupPlannerProps, descriptions);
11876
+ return kupManager$1.getProps(this, KupPlannerProps, descriptions);
11516
11877
  }
11517
11878
  /**
11518
11879
  * This method is used to trigger a new render of the component.
@@ -11525,7 +11886,7 @@ const KupPlanner = class {
11525
11886
  * @param {GenericObject} props - Object containing props that will be set to the component.
11526
11887
  */
11527
11888
  async setProps(props) {
11528
- kupManager.setProps(this, KupPlannerProps, props);
11889
+ kupManager$1.setProps(this, KupPlannerProps, props);
11529
11890
  }
11530
11891
  /**
11531
11892
  * Add a list of phases to the project
@@ -11536,19 +11897,29 @@ const KupPlanner = class {
11536
11897
  var _a;
11537
11898
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11538
11899
  if (task) {
11539
- 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])));
11540
11907
  let phase = {
11541
- id: row.cells[this.phaseIdCol].value,
11908
+ taskRow: task.taskRow,
11909
+ phaseRow: row,
11910
+ id: task.id + '_' + row.cells[this.phaseIdCol].value,
11542
11911
  phaseRowId: row.id,
11543
11912
  taskRowId: task.taskRowId,
11544
11913
  name: row.cells[this.phaseNameCol].value,
11545
- startDate: row.cells[this.phaseDates[0]].value,
11546
- endDate: row.cells[this.phaseDates[1]].value,
11547
- secondaryStartDate: row.cells[this.phasePrevDates[0]].value,
11548
- secondaryEndDate: row.cells[this.phasePrevDates[1]].value,
11549
- 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',
11550
11919
  color: row.cells[this.phaseColorCol].value,
11551
- valuesToShow: this.phaseColumns.map((col) => row.cells[col].value),
11920
+ selectedColor: row.cells[this.phaseColorCol].value,
11921
+ valuesToShow: valuesToShow,
11922
+ rowType: KupPlannerGanttRowType.PHASE,
11552
11923
  };
11553
11924
  return phase;
11554
11925
  });
@@ -11557,8 +11928,8 @@ const KupPlanner = class {
11557
11928
  }
11558
11929
  handleOnClick(nativeEvent) {
11559
11930
  console.log('handleOnClick', nativeEvent);
11560
- switch (nativeEvent.type) {
11561
- case 'task':
11931
+ switch (nativeEvent.rowType) {
11932
+ case KupPlannerGanttRowType.TASK:
11562
11933
  const taskAction = nativeEvent.phases
11563
11934
  ? KupPlannerTaskAction.onClosing
11564
11935
  : KupPlannerTaskAction.onOpening;
@@ -11566,28 +11937,57 @@ const KupPlanner = class {
11566
11937
  this.onKupClick(nativeEvent, taskAction);
11567
11938
  }
11568
11939
  break;
11569
- case 'phase':
11940
+ case KupPlannerGanttRowType.PHASE:
11570
11941
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
11571
11942
  this.onKupClick(nativeEvent);
11572
11943
  }
11573
11944
  break;
11945
+ case KupPlannerGanttRowType.DETAIL:
11946
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
11947
+ this.onKupClick(nativeEvent);
11948
+ }
11949
+ break;
11574
11950
  }
11575
11951
  }
11576
11952
  handleOnDateChange(nativeEvent) {
11577
- console.log('handleOnDateChange', nativeEvent);
11578
- this.onKupDateChange(nativeEvent);
11953
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_emitOnChangeEventsReceived).call(this, nativeEvent)) {
11954
+ console.log('handleOnDateChange', nativeEvent);
11955
+ this.onKupDateChange(nativeEvent);
11956
+ }
11579
11957
  }
11580
11958
  componentWillLoad() {
11581
11959
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logLoad(this, false);
11582
11960
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.register(this);
11583
11961
  }
11584
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
+ }
11585
11967
  this.plannerProps = {
11586
- title: this.titleMess,
11587
- items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11588
- onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11589
- 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,
11590
11989
  };
11990
+ console.log('kup-planner.tsx componentDidLoad plannerProps', this.plannerProps);
11591
11991
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_renderReactPlannerElement).call(this);
11592
11992
  this.kupReady.emit({
11593
11993
  comp: this,
@@ -11603,14 +12003,15 @@ const KupPlanner = class {
11603
12003
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logRender(this, true);
11604
12004
  }
11605
12005
  render() {
11606
- 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 } })));
11607
12008
  }
11608
12009
  disconnectedCallback() {
11609
12010
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.unregister(this);
11610
12011
  }
11611
12012
  get rootElement() { return index.getElement(this); }
11612
12013
  };
11613
- _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
12014
+ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_lastOnChangeReceived = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
11614
12015
  var _a;
11615
12016
  (_a = __classPrivateFieldGet(this, _KupPlanner_rootPlanner, "f")) === null || _a === void 0 ? void 0 : _a.unmount();
11616
12017
  const componentWrapperElement = this.rootElement.shadowRoot.getElementById(GenericVariables.componentWrapperId);
@@ -11620,27 +12021,70 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11620
12021
  }
11621
12022
  }, _KupPlanner_toTasks = function _KupPlanner_toTasks(data) {
11622
12023
  var _a;
11623
- let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((value) => {
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);
11624
12027
  let task = {
11625
- taskRowId: value.id,
11626
- id: value.cells[this.taskIdCol].value,
11627
- name: value.cells[this.taskNameCol].value,
11628
- startDate: value.cells[this.taskDates[0]].value,
11629
- endDate: value.cells[this.taskDates[1]].value,
11630
- secondaryStartDate: value.cells[this.taskPrevDates[0]].value,
11631
- secondaryEndDate: value.cells[this.taskPrevDates[1]].value,
11632
- type: 'task',
11633
- valuesToShow: this.taskColumns.map((col) => value.cells[col].value),
12028
+ taskRow: row,
12029
+ taskRowId: row.id,
12030
+ id: row.cells[this.taskIdCol].value,
12031
+ name: row.cells[this.taskNameCol].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,
11634
12039
  };
11635
12040
  return task;
11636
12041
  });
11637
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;
11638
12079
  }, _KupPlanner_getTask = function _KupPlanner_getTask(taskId) {
11639
- return this.plannerProps.items.find((task) => task.id == taskId);
12080
+ return this.plannerProps.mainGantt.items.find((task) => task.id == taskId);
11640
12081
  }, _KupPlanner_removePhases = function _KupPlanner_removePhases(taskId) {
11641
12082
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11642
12083
  if (task)
11643
12084
  task.phases = undefined;
12085
+ // this.plannerProps.mainGantt = JSON.parse(
12086
+ // JSON.stringify(this.plannerProps.mainGantt)
12087
+ // );
11644
12088
  this.plannerProps = Object.assign({}, this.plannerProps);
11645
12089
  }, _KupPlanner_handleOnClickOnTask = function _KupPlanner_handleOnClickOnTask(nativeEvent) {
11646
12090
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, nativeEvent.id);
@@ -11650,6 +12094,19 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11650
12094
  return true;
11651
12095
  }, _KupPlanner_handleOnClickOnPhase = function _KupPlanner_handleOnClickOnPhase() {
11652
12096
  return true;
12097
+ }, _KupPlanner_handleOnClickOnDetail = function _KupPlanner_handleOnClickOnDetail() {
12098
+ return true;
12099
+ }, _KupPlanner_emitOnChangeEventsReceived = function _KupPlanner_emitOnChangeEventsReceived(nativeEvent) {
12100
+ let emitEvent = false;
12101
+ if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f")) {
12102
+ emitEvent = true;
12103
+ __classPrivateFieldSet(this, _KupPlanner_lastOnChangeReceived, new KupPlannerLastOnChangeReceived(nativeEvent), "f");
12104
+ }
12105
+ else if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f").isEquivalent(nativeEvent)) {
12106
+ __classPrivateFieldSet(this, _KupPlanner_lastOnChangeReceived, new KupPlannerLastOnChangeReceived(nativeEvent), "f");
12107
+ emitEvent = true;
12108
+ }
12109
+ return emitEvent;
11653
12110
  };
11654
12111
  KupPlanner.style = kupPlannerCss;
11655
12112