@sme.up/ketchup 7.4.0 → 7.4.2

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