@sme.up/ketchup 7.4.1 → 7.5.0-SNAPSHOT

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 (139) hide show
  1. package/dist/cjs/{f-button-5856cd74.js → f-button-a508a0a1.js} +1 -1
  2. package/dist/cjs/{f-cell-9d7a9e97.js → f-cell-52d724f5.js} +4 -4
  3. package/dist/cjs/{f-chip-675ed121.js → f-chip-cbb70aed.js} +2 -2
  4. package/dist/cjs/{f-image-48facc89.js → f-image-510563ed.js} +4 -4
  5. package/dist/cjs/{f-paginator-utils-0c1227f6.js → f-paginator-utils-ff531caa.js} +2 -2
  6. package/dist/cjs/{f-text-field-3d8e7417.js → f-text-field-d17e5aa0.js} +1 -1
  7. package/dist/cjs/ketchup.cjs.js +2 -2
  8. package/dist/cjs/kup-accordion.cjs.entry.js +2 -2
  9. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +18 -12
  10. package/dist/cjs/kup-box.cjs.entry.js +7 -7
  11. package/dist/cjs/kup-calendar.cjs.entry.js +4 -4
  12. package/dist/cjs/kup-cell.cjs.entry.js +5 -5
  13. package/dist/cjs/kup-dash-list.cjs.entry.js +1 -1
  14. package/dist/cjs/kup-dash_2.cjs.entry.js +1 -1
  15. package/dist/cjs/kup-dashboard.cjs.entry.js +4 -7
  16. package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
  17. package/dist/cjs/kup-echart.cjs.entry.js +1 -1
  18. package/dist/cjs/kup-family-tree.cjs.entry.js +4 -4
  19. package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
  20. package/dist/cjs/kup-image-list.cjs.entry.js +6 -6
  21. package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
  22. package/dist/cjs/kup-magic-box.cjs.entry.js +2 -2
  23. package/dist/cjs/{kup-manager-22bb9699.js → kup-manager-9e1680dd.js} +3 -0
  24. package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
  25. package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
  26. package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
  27. package/dist/cjs/kup-planner.cjs.entry.js +1043 -558
  28. package/dist/cjs/kup-probe.cjs.entry.js +1 -1
  29. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  30. package/dist/cjs/kup-snackbar.cjs.entry.js +3 -3
  31. package/dist/cjs/loader.cjs.js +2 -2
  32. package/dist/collection/collection-manifest.json +1 -1
  33. package/dist/collection/components/kup-card/kup-card.css +4 -8
  34. package/dist/collection/components/kup-dashboard/kup-dashboard.js +0 -3
  35. package/dist/collection/components/kup-data-table/kup-data-table.css +3 -6
  36. package/dist/collection/components/kup-data-table/kup-data-table.js +1 -4
  37. package/dist/collection/components/kup-family-tree/kup-family-tree.css +2 -2
  38. package/dist/collection/components/kup-image/kup-image.js +28 -0
  39. package/dist/collection/components/kup-list/kup-list.css +1 -1
  40. package/dist/collection/components/kup-planner/kup-planner-declarations.js +49 -16
  41. package/dist/collection/components/kup-planner/kup-planner-helper.js +54 -0
  42. package/dist/collection/components/kup-planner/kup-planner.css +21 -18
  43. package/dist/collection/components/kup-planner/kup-planner.js +483 -69
  44. package/dist/collection/components/kup-qlik/kup-qlik.css +4 -8
  45. package/dist/collection/components/kup-spinner/kup-spinner.css +2 -4
  46. package/dist/collection/f-components/f-image/f-image.js +3 -3
  47. package/dist/collection/managers/kup-data/kup-data-column-helper.js +1 -0
  48. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +1 -0
  49. package/dist/collection/types/GenericTypes.js +1 -0
  50. package/dist/components/kup-autocomplete2.js +18 -9
  51. package/dist/components/kup-dashboard.js +0 -3
  52. package/dist/components/kup-family-tree.js +1 -1
  53. package/dist/components/kup-planner.js +1039 -547
  54. package/dist/components/kup-progress-bar.js +1 -1
  55. package/dist/components/kup-qlik.js +1 -1
  56. package/dist/components/kup-radio.js +1 -1
  57. package/dist/components/kup-rating.js +1 -1
  58. package/dist/components/kup-spinner.js +1 -1
  59. package/dist/components/kup-switch.js +1 -1
  60. package/dist/components/kup-tab-bar.js +1 -1
  61. package/dist/components/kup-text-field.js +1 -1
  62. package/dist/components/kup-time-picker.js +1 -1
  63. package/dist/components/kup-tree.js +1 -1
  64. package/dist/esm/{f-button-eedbdba1.js → f-button-b7f77b26.js} +1 -1
  65. package/dist/esm/{f-cell-90a418d2.js → f-cell-dc3beffe.js} +4 -4
  66. package/dist/esm/{f-chip-45e7b3f6.js → f-chip-0a678211.js} +2 -2
  67. package/dist/esm/{f-image-3026f0fe.js → f-image-f84dbd7c.js} +4 -4
  68. package/dist/esm/{f-paginator-utils-6369da7c.js → f-paginator-utils-52902bd6.js} +2 -2
  69. package/dist/esm/{f-text-field-3b70a6f0.js → f-text-field-7dd143be.js} +1 -1
  70. package/dist/esm/ketchup.js +2 -2
  71. package/dist/esm/kup-accordion.entry.js +2 -2
  72. package/dist/esm/kup-autocomplete_27.entry.js +18 -12
  73. package/dist/esm/kup-box.entry.js +7 -7
  74. package/dist/esm/kup-calendar.entry.js +4 -4
  75. package/dist/esm/kup-cell.entry.js +5 -5
  76. package/dist/esm/kup-dash-list.entry.js +1 -1
  77. package/dist/esm/kup-dash_2.entry.js +1 -1
  78. package/dist/esm/kup-dashboard.entry.js +4 -7
  79. package/dist/esm/kup-drawer.entry.js +1 -1
  80. package/dist/esm/kup-echart.entry.js +1 -1
  81. package/dist/esm/kup-family-tree.entry.js +4 -4
  82. package/dist/esm/kup-iframe.entry.js +1 -1
  83. package/dist/esm/kup-image-list.entry.js +6 -6
  84. package/dist/esm/kup-lazy.entry.js +1 -1
  85. package/dist/esm/kup-magic-box.entry.js +2 -2
  86. package/dist/esm/{kup-manager-cad802b1.js → kup-manager-a5ab58a0.js} +3 -0
  87. package/dist/esm/kup-nav-bar.entry.js +1 -1
  88. package/dist/esm/kup-numeric-picker.entry.js +2 -2
  89. package/dist/esm/kup-photo-frame.entry.js +1 -1
  90. package/dist/esm/kup-planner.entry.js +1031 -546
  91. package/dist/esm/kup-probe.entry.js +1 -1
  92. package/dist/esm/kup-qlik.entry.js +2 -2
  93. package/dist/esm/kup-snackbar.entry.js +3 -3
  94. package/dist/esm/loader.js +2 -2
  95. package/dist/ketchup/ketchup.esm.js +1 -1
  96. package/dist/ketchup/{p-c1d8fd43.entry.js → p-00fc0f80.entry.js} +1 -1
  97. package/dist/ketchup/{p-b1da7902.entry.js → p-166257d0.entry.js} +1 -1
  98. package/dist/ketchup/{p-ae3e0d31.js → p-28efed63.js} +1 -1
  99. package/dist/ketchup/{p-fe34fa6e.entry.js → p-3ae1409f.entry.js} +1 -1
  100. package/dist/ketchup/p-4fd6c34c.js +30 -0
  101. package/dist/ketchup/{p-73becdb8.entry.js → p-6022c951.entry.js} +1 -1
  102. package/dist/ketchup/{p-4505a48d.js → p-69f3b9da.js} +1 -1
  103. package/dist/ketchup/p-7040cab7.entry.js +1 -0
  104. package/dist/ketchup/{p-a1adab40.js → p-7065b172.js} +1 -1
  105. package/dist/ketchup/p-71cb80ac.entry.js +9 -0
  106. package/dist/ketchup/{p-b0675bce.entry.js → p-78d1fc60.entry.js} +1 -1
  107. package/dist/ketchup/{p-a89f0884.entry.js → p-871cfe60.entry.js} +1 -1
  108. package/dist/ketchup/p-8d0e6825.entry.js +1 -0
  109. package/dist/ketchup/{p-9f1184cd.entry.js → p-98ff4101.entry.js} +6 -6
  110. package/dist/ketchup/{p-eea29062.entry.js → p-9ae47a0d.entry.js} +1 -1
  111. package/dist/ketchup/{p-1cd45a72.entry.js → p-a122b8d3.entry.js} +1 -1
  112. package/dist/ketchup/{p-23288eed.entry.js → p-a32cc181.entry.js} +1 -1
  113. package/dist/ketchup/{p-1ad48de4.entry.js → p-beb0907a.entry.js} +1 -1
  114. package/dist/ketchup/{p-32dc31ad.js → p-c5c6a2fb.js} +1 -1
  115. package/dist/ketchup/{p-138ac8b9.entry.js → p-c797ab39.entry.js} +1 -1
  116. package/dist/ketchup/p-d1e3573f.js +1 -0
  117. package/dist/ketchup/{p-d0f4457e.entry.js → p-d2670436.entry.js} +1 -1
  118. package/dist/ketchup/{p-97afbd71.entry.js → p-d315f7fa.entry.js} +1 -1
  119. package/dist/ketchup/{p-2d8b5bba.entry.js → p-d711e9ae.entry.js} +1 -1
  120. package/dist/ketchup/{p-7bd28eac.js → p-de34eb56.js} +1 -1
  121. package/dist/ketchup/{p-263b2c73.entry.js → p-e92d1972.entry.js} +1 -1
  122. package/dist/ketchup/{p-2217be0a.entry.js → p-efb80719.entry.js} +1 -1
  123. package/dist/ketchup/p-f158836b.entry.js +39 -0
  124. package/dist/ketchup/p-f69a6d89.entry.js +10 -0
  125. package/dist/types/components/kup-image/kup-image.d.ts +2 -0
  126. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +58 -17
  127. package/dist/types/components/kup-planner/kup-planner-helper.d.ts +6 -0
  128. package/dist/types/components/kup-planner/kup-planner.d.ts +120 -5
  129. package/dist/types/components.d.ts +235 -2
  130. package/dist/types/f-components/f-image/f-image-declarations.d.ts +1 -0
  131. package/dist/types/types/GenericTypes.d.ts +1 -0
  132. package/package.json +8 -6
  133. package/dist/ketchup/p-4e68f629.entry.js +0 -1
  134. package/dist/ketchup/p-a7ae0b4d.js +0 -1
  135. package/dist/ketchup/p-b63a5a44.js +0 -30
  136. package/dist/ketchup/p-bb6921bc.entry.js +0 -1
  137. package/dist/ketchup/p-cb6c8417.entry.js +0 -10
  138. package/dist/ketchup/p-fd948af0.entry.js +0 -9
  139. package/dist/ketchup/p-ff11d6d0.entry.js +0 -39
@@ -1,6 +1,10 @@
1
1
  import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-8bd38435.js';
2
- import { as as createCommonjsModule, k as kupManagerInstance, g as getProps, s as setProps } from './kup-manager-cad802b1.js';
2
+ import { as as createCommonjsModule, k as kupManagerInstance, f as KupDatesFormats, am as getCellValueForDisplay, g as getProps, s as setProps, K as KupThemeIconValues, I as KupLanguageSearch } from './kup-manager-a5ab58a0.js';
3
3
  import { c as componentWrapperId } from './GenericVariables-665de00a.js';
4
+ import { F as FTextField } from './f-text-field-7dd143be.js';
5
+ import { F as FTextFieldMDC } from './f-text-field-mdc-d42d3f9e.js';
6
+ import './tslib.es6-3eea2234.js';
7
+ import './component-b1bedf1d.js';
4
8
 
5
9
  /**
6
10
  * Props of the kup-gantt component.
@@ -9,26 +13,46 @@ import { c as componentWrapperId } from './GenericVariables-665de00a.js';
9
13
  var KupPlannerProps;
10
14
  (function (KupPlannerProps) {
11
15
  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";
16
+ KupPlannerProps["data"] = "Dataset containg the tasks list";
17
+ KupPlannerProps["detailData"] = "Dataset containg the details list";
18
+ KupPlannerProps["detailColorCol"] = "Column containing the detail color, in hex format";
19
+ KupPlannerProps["detailColumns"] = "Columns containing informations displayed in the left box, near the gantt of details";
20
+ KupPlannerProps["detailDates"] = "Columns containing detail duration, from (firstDate) to (secondDate)";
21
+ KupPlannerProps["detailHeight"] = "Height for detail gantt";
22
+ KupPlannerProps["detailIdCol"] = "Column containing unique detail identifier";
23
+ KupPlannerProps["detailNameCol"] = "Column containing detail name displayed";
24
+ KupPlannerProps["detailPrevDates"] = "Columns containing forecast detail duration, from (firstDate) to (secondDate)";
25
+ KupPlannerProps["listCellWidth"] = "Total size of the cells inside to the left box, near the gantt";
26
+ KupPlannerProps["maxWidth"] = "Max width for component";
27
+ KupPlannerProps["phaseColorCol"] = "Column containing the phase color in hex format";
28
+ KupPlannerProps["phaseColumns"] = "Columns containing informations displayed in the left box ,near the gantt of phases";
29
+ KupPlannerProps["phaseColParDep"] = "Column containing the name of the parent phases";
30
+ KupPlannerProps["phaseDates"] = "Columns containing phase duration, from (firstDate) to (secondDate)";
31
+ KupPlannerProps["phaseIdCol"] = "Column containing unique phase identifier";
32
+ KupPlannerProps["phaseNameCol"] = "Column containing phase name displayed";
33
+ KupPlannerProps["phasePrevDates"] = "Columns containing forecast phase duration, from (firstDate) to (secondDate)";
34
+ KupPlannerProps["showSecondaryDates"] = "Enable/disable display of secondary dates";
35
+ KupPlannerProps["taskColumns"] = "Columns containing informations displayed in the left box, near the gantt";
36
+ KupPlannerProps["taskDates"] = "Columns containing task duration, from (firstDate) to (secondDate)";
37
+ KupPlannerProps["taskHeight"] = "Height for main gantt";
38
+ KupPlannerProps["taskIdCol"] = "Column containing unique task identifier";
39
+ KupPlannerProps["taskNameCol"] = "Column containing task name displayed";
40
+ KupPlannerProps["taskPrevDates"] = "Columns containing forecast task duration, from (firstDate) to (secondDate)";
41
+ KupPlannerProps["titleMess"] = "Message displayed on top";
26
42
  })(KupPlannerProps || (KupPlannerProps = {}));
27
43
  var KupPlannerTaskAction;
28
44
  (function (KupPlannerTaskAction) {
29
- KupPlannerTaskAction["onOpening"] = "onOpening";
30
- KupPlannerTaskAction["onClosing"] = "onClosing";
45
+ KupPlannerTaskAction["onTaskOpening"] = "onTaskOpening";
46
+ KupPlannerTaskAction["onTaskClosing"] = "onTaskClosing";
47
+ KupPlannerTaskAction["onClick"] = "onClick";
48
+ KupPlannerTaskAction["onResize"] = "onResize";
31
49
  })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
50
+ var KupPlannerGanttRowType;
51
+ (function (KupPlannerGanttRowType) {
52
+ KupPlannerGanttRowType["TASK"] = "task";
53
+ KupPlannerGanttRowType["PHASE"] = "phase";
54
+ KupPlannerGanttRowType["DETAIL"] = "detail";
55
+ })(KupPlannerGanttRowType || (KupPlannerGanttRowType = {}));
32
56
  class KupPlannerLastOnChangeReceived {
33
57
  constructor(event, threshold = 100) {
34
58
  this.dateTime = new Date();
@@ -43,7 +67,20 @@ class KupPlannerLastOnChangeReceived {
43
67
  resetDateTime() {
44
68
  this.dateTime = new Date();
45
69
  }
46
- }
70
+ }
71
+ const defaultStylingOptions = {
72
+ listCellWidth: '300px',
73
+ rowHeight: 40,
74
+ barFill: 90,
75
+ projectProgressColor: '#CBCBCB',
76
+ projectProgressSelectedColor: '#CBCBCB',
77
+ projectBackgroundColor: '#CBCBCB',
78
+ projectBackgroundSelectedColor: '#CBCBCB',
79
+ barProgressColor: '#A2A415',
80
+ barProgressSelectedColor: '#A2A415',
81
+ barBackgroundColor: '#A2A415',
82
+ barBackgroundSelectedColor: '#A2A415',
83
+ };
47
84
 
48
85
  /**
49
86
  * @license React
@@ -8346,18 +8383,6 @@ function _extends() {
8346
8383
  };
8347
8384
  return _extends.apply(this, arguments);
8348
8385
  }
8349
- function _objectWithoutPropertiesLoose(source, excluded) {
8350
- if (source == null) return {};
8351
- var target = {};
8352
- var sourceKeys = Object.keys(source);
8353
- var key, i;
8354
- for (i = 0; i < sourceKeys.length; i++) {
8355
- key = sourceKeys[i];
8356
- if (excluded.indexOf(key) >= 0) continue;
8357
- target[key] = source[key];
8358
- }
8359
- return target;
8360
- }
8361
8386
  function _unsupportedIterableToArray(o, minLen) {
8362
8387
  if (!o) return;
8363
8388
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -8401,6 +8426,233 @@ var ViewMode;
8401
8426
  ViewMode["Year"] = "Year";
8402
8427
  })(ViewMode || (ViewMode = {}));
8403
8428
 
8429
+ var TimeUnit;
8430
+ (function (TimeUnit) {
8431
+ TimeUnit["DAY"] = "days";
8432
+ TimeUnit["WEEK"] = "weeks";
8433
+ TimeUnit["MONTH"] = "months";
8434
+ TimeUnit["YEAR"] = "YEAR";
8435
+ })(TimeUnit || (TimeUnit = {}));
8436
+ var parseToDayStart = function parseToDayStart(ymd) {
8437
+ return luxon.DateTime.fromISO(ymd).toJSDate();
8438
+ };
8439
+ var parseToDayEnd = function parseToDayEnd(endDate) {
8440
+ return luxon.DateTime.fromISO(endDate).plus({
8441
+ seconds: 86400 - 1
8442
+ }).toJSDate();
8443
+ };
8444
+ var formatToIsoDate = function formatToIsoDate(date) {
8445
+ var _DateTime$fromJSDate$;
8446
+ return (_DateTime$fromJSDate$ = luxon.DateTime.fromJSDate(date).toISODate()) != null ? _DateTime$fromJSDate$ : undefined;
8447
+ };
8448
+ var formatToLocaleSimple = function formatToLocaleSimple(date) {
8449
+ return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
8450
+ };
8451
+ function validDates(startDate, endDate, _name) {
8452
+ var _start;
8453
+ var start = parseToDayStart(startDate);
8454
+ var end = parseToDayEnd(endDate);
8455
+ if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
8456
+ start = parseToDayStart(endDate);
8457
+ }
8458
+ return {
8459
+ start: start,
8460
+ end: end
8461
+ };
8462
+ }
8463
+
8464
+ var MAIN_GANTT_ID = "main";
8465
+ var SECONDARY_GANTT_ID = "secondary";
8466
+ var toViewMode = function toViewMode(timeUnit) {
8467
+ switch (timeUnit) {
8468
+ case TimeUnit.DAY:
8469
+ return ViewMode.Day;
8470
+ case TimeUnit.WEEK:
8471
+ return ViewMode.Week;
8472
+ case TimeUnit.MONTH:
8473
+ return ViewMode.Month;
8474
+ case TimeUnit.YEAR:
8475
+ return ViewMode.Year;
8476
+ }
8477
+ };
8478
+ var convertPhaseToTask = function convertPhaseToTask(item) {
8479
+ var mapPhase = function mapPhase(_ref) {
8480
+ var phaseStart = _ref.startDate,
8481
+ phaseEnd = _ref.endDate,
8482
+ secondaryStartDate = _ref.secondaryStartDate,
8483
+ secondaryEndDate = _ref.secondaryEndDate,
8484
+ phaseName = _ref.name,
8485
+ phaseId = _ref.id,
8486
+ color = _ref.color,
8487
+ selectedColor = _ref.selectedColor,
8488
+ dependencies = _ref.dependencies;
8489
+ var _validDates = validDates(phaseStart, phaseEnd),
8490
+ start = _validDates.start,
8491
+ end = _validDates.end;
8492
+ var _validDates2 = validDates(secondaryStartDate, secondaryEndDate),
8493
+ phaseStart2 = _validDates2.start,
8494
+ phaseEnd2 = _validDates2.end;
8495
+ return {
8496
+ start: start,
8497
+ end: end,
8498
+ secondaryStart: phaseStart2,
8499
+ secondaryEnd: phaseEnd2,
8500
+ name: phaseName,
8501
+ valuesToShow: item.valuesToShow,
8502
+ id: phaseId,
8503
+ type: "task",
8504
+ progress: 100,
8505
+ dependencies: dependencies,
8506
+ styles: color ? {
8507
+ backgroundColor: color,
8508
+ progressColor: color,
8509
+ backgroundSelectedColor: selectedColor,
8510
+ progressSelectedColor: selectedColor
8511
+ } : {}
8512
+ };
8513
+ };
8514
+ return mapPhase(item);
8515
+ };
8516
+ var convertDetailToTimeline = function convertDetailToTimeline(item, mainGanttStartDate, mainGanttEndDate) {
8517
+ var id = item.id,
8518
+ name = item.name,
8519
+ schedule = item.schedule;
8520
+ var getDatesForTask = function getDatesForTask(item) {
8521
+ var start = mainGanttStartDate != null ? mainGanttStartDate : "";
8522
+ var end = mainGanttEndDate != null ? mainGanttEndDate : "";
8523
+ for (var i = 0; i < item.schedule.length; i++) {
8524
+ var lstart = item.schedule[i].startDate;
8525
+ var lend = item.schedule[i].endDate;
8526
+ if (!start || lstart.localeCompare(start) < 0) {
8527
+ start = lstart;
8528
+ }
8529
+ if (!end || lend.localeCompare(end) > 0) {
8530
+ end = lend;
8531
+ }
8532
+ }
8533
+ return validDates(start, end);
8534
+ };
8535
+ var _getDatesForTask = getDatesForTask(item),
8536
+ start = _getDatesForTask.start,
8537
+ end = _getDatesForTask.end;
8538
+ var convertToFrame = function convertToFrame(x) {
8539
+ var startDate = x.startDate,
8540
+ endDate = x.endDate,
8541
+ color = x.color,
8542
+ selectedColor = x.selectedColor;
8543
+ var _validDates3 = validDates(startDate, endDate),
8544
+ start = _validDates3.start,
8545
+ end = _validDates3.end;
8546
+ return {
8547
+ start: start,
8548
+ end: end,
8549
+ backgroundColor: color != null ? color : "0xffffff",
8550
+ backgroundSelectedColor: selectedColor != null ? selectedColor : color
8551
+ };
8552
+ };
8553
+ var defaultColor = "#595959";
8554
+ return {
8555
+ id: id,
8556
+ type: "timeline",
8557
+ timeline: schedule.map(convertToFrame),
8558
+ name: name,
8559
+ valuesToShow: item.valuesToShow,
8560
+ start: start,
8561
+ end: end,
8562
+ progress: 100,
8563
+ styles: {
8564
+ backgroundColor: defaultColor,
8565
+ progressColor: defaultColor,
8566
+ backgroundSelectedColor: defaultColor,
8567
+ progressSelectedColor: defaultColor
8568
+ }
8569
+ };
8570
+ };
8571
+ var isDetail = function isDetail(row) {
8572
+ return row && row.schedule && row.schedule.length !== 0;
8573
+ };
8574
+ var convertProjectToTasks = function convertProjectToTasks(item, mainGanttStartDate, mainGanttEndDate) {
8575
+ if (!isDetail(item)) {
8576
+ var _row$phases;
8577
+ var row = item;
8578
+ var _validDates4 = validDates(row.startDate, row.endDate),
8579
+ start = _validDates4.start,
8580
+ end = _validDates4.end;
8581
+ var _validDates5 = validDates(row.secondaryStartDate, row.secondaryEndDate),
8582
+ start2 = _validDates5.start,
8583
+ end2 = _validDates5.end;
8584
+ var mainTask = {
8585
+ start: start,
8586
+ end: end,
8587
+ id: row.id,
8588
+ name: row.name,
8589
+ type: row.type,
8590
+ valuesToShow: row.valuesToShow,
8591
+ secondaryStart: start2,
8592
+ secondaryEnd: end2,
8593
+ progress: 100,
8594
+ isDisabled: false,
8595
+ hideChildren: false
8596
+ };
8597
+ var children1 = ((_row$phases = row.phases) != null ? _row$phases : []).map(convertPhaseToTask);
8598
+ return [mainTask].concat(children1);
8599
+ } else {
8600
+ var _row = item;
8601
+ return [_extends({}, convertDetailToTimeline(_row, mainGanttStartDate, mainGanttEndDate))];
8602
+ }
8603
+ };
8604
+ var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref2) {
8605
+ var id = _ref2.id,
8606
+ start = _ref2.start,
8607
+ end = _ref2.end;
8608
+ return projects.map(function (project) {
8609
+ return project.id === id ? withNewDates(project, start, end) : project;
8610
+ });
8611
+ };
8612
+ var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref3) {
8613
+ var id = _ref3.id,
8614
+ start = _ref3.start,
8615
+ end = _ref3.end;
8616
+ if (phases) {
8617
+ return phases.map(function (phase) {
8618
+ return phase.id === id ? withNewDates(phase, start, end) : phase;
8619
+ });
8620
+ }
8621
+ return undefined;
8622
+ };
8623
+ var withNewDates = function withNewDates(p, start, end) {
8624
+ var startDate = formatToIsoDate(start);
8625
+ var endDate = formatToIsoDate(end);
8626
+ var extra = {
8627
+ startDate: startDate,
8628
+ endDate: endDate
8629
+ };
8630
+ return _extends({}, p, extra);
8631
+ };
8632
+ var getProjectById = function getProjectById(id, items) {
8633
+ for (var i = 0; i < items.length; i++) {
8634
+ if (items[i].id === id) {
8635
+ return items[i];
8636
+ }
8637
+ }
8638
+ return undefined;
8639
+ };
8640
+ var getPhaseById = function getPhaseById(id, items) {
8641
+ for (var i = 0; i < items.length; i++) {
8642
+ if (isDetail(items[i])) {
8643
+ continue;
8644
+ }
8645
+ var item = items[i];
8646
+ if (!item.phases) {
8647
+ continue;
8648
+ }
8649
+ for (var j = 0; j < item.phases.length; j++) if (item.phases[j].id === id) {
8650
+ return item.phases[j];
8651
+ }
8652
+ }
8653
+ return undefined;
8654
+ };
8655
+
8404
8656
  var intlDTCache = {};
8405
8657
  var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts) {
8406
8658
  if (opts === void 0) {
@@ -8415,80 +8667,157 @@ var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts)
8415
8667
  return dtf;
8416
8668
  };
8417
8669
  var addToDate = function addToDate(date, quantity, scale) {
8418
- var newDate = new Date(date.getFullYear() + (scale === 'year' ? quantity : 0), date.getMonth() + (scale === 'month' ? quantity : 0), date.getDate() + (scale === 'day' ? quantity : 0), date.getHours() + (scale === 'hour' ? quantity : 0), date.getMinutes() + (scale === 'minute' ? quantity : 0), date.getSeconds() + (scale === 'second' ? quantity : 0), date.getMilliseconds() + (scale === 'millisecond' ? quantity : 0));
8670
+ var newDate = new Date(date.getFullYear() + (scale === "year" ? quantity : 0), date.getMonth() + (scale === "month" ? quantity : 0), date.getDate() + (scale === "day" ? quantity : 0), date.getHours() + (scale === "hour" ? quantity : 0), date.getMinutes() + (scale === "minute" ? quantity : 0), date.getSeconds() + (scale === "second" ? quantity : 0), date.getMilliseconds() + (scale === "millisecond" ? quantity : 0));
8419
8671
  return newDate;
8420
8672
  };
8421
8673
  var startOfDate = function startOfDate(date, scale) {
8422
- var scores = ['millisecond', 'second', 'minute', 'hour', 'day', 'month', 'year'];
8674
+ var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
8423
8675
  var shouldReset = function shouldReset(_scale) {
8424
8676
  var maxScore = scores.indexOf(scale);
8425
8677
  return scores.indexOf(_scale) <= maxScore;
8426
8678
  };
8427
- var newDate = new Date(date.getFullYear(), shouldReset('year') ? 0 : date.getMonth(), shouldReset('month') ? 1 : date.getDate(), shouldReset('day') ? 0 : date.getHours(), shouldReset('hour') ? 0 : date.getMinutes(), shouldReset('minute') ? 0 : date.getSeconds(), shouldReset('second') ? 0 : date.getMilliseconds());
8679
+ var newDate = new Date(date.getFullYear(), shouldReset("year") ? 0 : date.getMonth(), shouldReset("month") ? 1 : date.getDate(), shouldReset("day") ? 0 : date.getHours(), shouldReset("hour") ? 0 : date.getMinutes(), shouldReset("minute") ? 0 : date.getSeconds(), shouldReset("second") ? 0 : date.getMilliseconds());
8428
8680
  return newDate;
8429
8681
  };
8430
- var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates) {
8431
- var newStartDate = tasks[0].start;
8432
- var newEndDate = tasks[0].start;
8433
- for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8434
- var task = _step.value;
8435
- if (task.start < newStartDate) {
8436
- newStartDate = task.start;
8682
+ var ganttDateRangeFromTask = function ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, mainGanttStartDate, mainGanttEndDate) {
8683
+ var dates = [];
8684
+ tasks.forEach(function (item) {
8685
+ dates.push({
8686
+ start: item.start,
8687
+ end: item.end,
8688
+ secondaryStart: item.secondaryStart,
8689
+ secondaryEnd: item.secondaryEnd
8690
+ });
8691
+ });
8692
+ if (mainGanttStartDate && mainGanttEndDate) {
8693
+ dates.push({
8694
+ start: mainGanttStartDate,
8695
+ end: mainGanttEndDate,
8696
+ secondaryStart: undefined,
8697
+ secondaryEnd: undefined
8698
+ });
8699
+ }
8700
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates);
8701
+ };
8702
+ var calculateDisplayedDateRange = function calculateDisplayedDateRange(mainGanttItems, timeUnit, mainGanttDoubleView, secondaryGanttItems, preStepsCount) {
8703
+ var dates = ganttDateRangeFromGanttTask(mainGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8704
+ if (secondaryGanttItems) {
8705
+ var dates2 = ganttDateRangeFromDetail(secondaryGanttItems, toViewMode(timeUnit), preStepsCount != null ? preStepsCount : 1, mainGanttDoubleView);
8706
+ if (dates2[0] < dates[0]) {
8707
+ dates[0] = dates2[0];
8708
+ }
8709
+ if (dates2[1] > dates[1]) {
8710
+ dates[1] = dates2[1];
8711
+ }
8712
+ }
8713
+ return {
8714
+ displayedStartDate: dates[0],
8715
+ displayedEndDate: dates[1]
8716
+ };
8717
+ };
8718
+ var ganttDateRangeFromGanttTask = function ganttDateRangeFromGanttTask(tasks, viewMode, preStepsCount, showSecondaryDates) {
8719
+ var dates = [];
8720
+ tasks.forEach(function (item) {
8721
+ var _item$phases;
8722
+ dates.push({
8723
+ start: parseToDayStart(item.startDate),
8724
+ end: parseToDayEnd(item.endDate),
8725
+ secondaryStart: parseToDayStart(item.secondaryStartDate),
8726
+ secondaryEnd: parseToDayEnd(item.secondaryEndDate)
8727
+ });
8728
+ (_item$phases = item.phases) === null || _item$phases === void 0 ? void 0 : _item$phases.forEach(function (phase) {
8729
+ dates.push({
8730
+ start: parseToDayStart(phase.startDate),
8731
+ end: parseToDayEnd(phase.endDate),
8732
+ secondaryStart: parseToDayStart(phase.secondaryStartDate),
8733
+ secondaryEnd: parseToDayEnd(phase.secondaryEndDate)
8734
+ });
8735
+ });
8736
+ });
8737
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8738
+ };
8739
+ var ganttDateRangeFromDetail = function ganttDateRangeFromDetail(details, viewMode, preStepsCount, showSecondaryDates) {
8740
+ var dates = [];
8741
+ details.forEach(function (item) {
8742
+ var scheduleItems = item.schedule;
8743
+ if (scheduleItems) {
8744
+ scheduleItems.forEach(function (item) {
8745
+ dates.push({
8746
+ start: parseToDayStart(item.startDate),
8747
+ end: parseToDayEnd(item.endDate),
8748
+ secondaryStart: undefined,
8749
+ secondaryEnd: undefined
8750
+ });
8751
+ });
8437
8752
  }
8438
- if (task.end > newEndDate) {
8439
- newEndDate = task.end;
8753
+ });
8754
+ return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8755
+ };
8756
+ var ganttDateRangeGeneric = function ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, realDates) {
8757
+ var newStartDate = dates.length > 0 ? dates[0].start : new Date();
8758
+ var newEndDate = dates.length > 0 ? dates[0].end : new Date();
8759
+ for (var _iterator = _createForOfIteratorHelperLoose(dates), _step; !(_step = _iterator()).done;) {
8760
+ var d = _step.value;
8761
+ if (d.start < newStartDate) {
8762
+ newStartDate = d.start;
8763
+ }
8764
+ if (d.end > newEndDate) {
8765
+ newEndDate = d.end;
8440
8766
  }
8441
8767
  if (showSecondaryDates) {
8442
- if (task.secondaryStart && task.secondaryStart < newStartDate) {
8443
- newStartDate = task.secondaryStart;
8768
+ if (d.secondaryStart && d.secondaryStart < newStartDate) {
8769
+ newStartDate = d.secondaryStart;
8444
8770
  }
8445
- if (task.secondaryEnd && task.secondaryEnd > newEndDate) {
8446
- newEndDate = task.secondaryEnd;
8771
+ if (d.secondaryEnd && d.secondaryEnd > newEndDate) {
8772
+ newEndDate = d.secondaryEnd;
8447
8773
  }
8448
8774
  }
8449
8775
  }
8776
+ if (realDates) {
8777
+ return [newStartDate, newEndDate];
8778
+ }
8450
8779
  switch (viewMode) {
8451
8780
  case ViewMode.Year:
8452
- newStartDate = addToDate(newStartDate, -1, 'year');
8453
- newStartDate = startOfDate(newStartDate, 'year');
8454
- newEndDate = addToDate(newEndDate, 1, 'year');
8455
- newEndDate = startOfDate(newEndDate, 'year');
8781
+ newStartDate = addToDate(newStartDate, -1, "year");
8782
+ newStartDate = startOfDate(newStartDate, "year");
8783
+ newEndDate = addToDate(newEndDate, 1, "year");
8784
+ newEndDate = startOfDate(newEndDate, "year");
8456
8785
  break;
8457
8786
  case ViewMode.Month:
8458
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'month');
8459
- newStartDate = startOfDate(newStartDate, 'month');
8460
- newEndDate = addToDate(newEndDate, 1, 'year');
8461
- newEndDate = startOfDate(newEndDate, 'year');
8787
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
8788
+ newStartDate = startOfDate(newStartDate, "month");
8789
+ newEndDate = addToDate(newEndDate, 1, "year");
8790
+ newEndDate = startOfDate(newEndDate, "year");
8462
8791
  break;
8463
8792
  case ViewMode.Week:
8464
- newStartDate = startOfDate(newStartDate, 'day');
8465
- newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, 'day');
8466
- newEndDate = startOfDate(newEndDate, 'day');
8467
- newEndDate = addToDate(newEndDate, 1.5, 'month');
8793
+ newStartDate = startOfDate(newStartDate, "day");
8794
+ newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, "day");
8795
+ newEndDate = startOfDate(newEndDate, "day");
8796
+ newEndDate = addToDate(newEndDate, 1.5, "month");
8468
8797
  break;
8469
8798
  case ViewMode.Day:
8470
- newStartDate = startOfDate(newStartDate, 'day');
8471
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8472
- newEndDate = startOfDate(newEndDate, 'day');
8473
- newEndDate = addToDate(newEndDate, 19, 'day');
8799
+ newStartDate = startOfDate(newStartDate, "day");
8800
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8801
+ newEndDate = startOfDate(newEndDate, "day");
8802
+ newEndDate = addToDate(newEndDate, 19, "day");
8474
8803
  break;
8475
8804
  case ViewMode.QuarterDay:
8476
- newStartDate = startOfDate(newStartDate, 'day');
8477
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8478
- newEndDate = startOfDate(newEndDate, 'day');
8479
- newEndDate = addToDate(newEndDate, 66, 'hour');
8805
+ newStartDate = startOfDate(newStartDate, "day");
8806
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8807
+ newEndDate = startOfDate(newEndDate, "day");
8808
+ newEndDate = addToDate(newEndDate, 66, "hour");
8480
8809
  break;
8481
8810
  case ViewMode.HalfDay:
8482
- newStartDate = startOfDate(newStartDate, 'day');
8483
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'day');
8484
- newEndDate = startOfDate(newEndDate, 'day');
8485
- newEndDate = addToDate(newEndDate, 108, 'hour');
8811
+ newStartDate = startOfDate(newStartDate, "day");
8812
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
8813
+ newEndDate = startOfDate(newEndDate, "day");
8814
+ newEndDate = addToDate(newEndDate, 108, "hour");
8486
8815
  break;
8487
8816
  case ViewMode.Hour:
8488
- newStartDate = startOfDate(newStartDate, 'hour');
8489
- newStartDate = addToDate(newStartDate, -1 * preStepsCount, 'hour');
8490
- newEndDate = startOfDate(newEndDate, 'day');
8491
- newEndDate = addToDate(newEndDate, 1, 'day');
8817
+ newStartDate = startOfDate(newStartDate, "hour");
8818
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
8819
+ newEndDate = startOfDate(newEndDate, "day");
8820
+ newEndDate = addToDate(newEndDate, 1, "day");
8492
8821
  break;
8493
8822
  }
8494
8823
  return [newStartDate, newEndDate];
@@ -8499,25 +8828,25 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8499
8828
  while (currentDate < endDate) {
8500
8829
  switch (viewMode) {
8501
8830
  case ViewMode.Year:
8502
- currentDate = addToDate(currentDate, 1, 'year');
8831
+ currentDate = addToDate(currentDate, 1, "year");
8503
8832
  break;
8504
8833
  case ViewMode.Month:
8505
- currentDate = addToDate(currentDate, 1, 'month');
8834
+ currentDate = addToDate(currentDate, 1, "month");
8506
8835
  break;
8507
8836
  case ViewMode.Week:
8508
- currentDate = addToDate(currentDate, 7, 'day');
8837
+ currentDate = addToDate(currentDate, 7, "day");
8509
8838
  break;
8510
8839
  case ViewMode.Day:
8511
- currentDate = addToDate(currentDate, 1, 'day');
8840
+ currentDate = addToDate(currentDate, 1, "day");
8512
8841
  break;
8513
8842
  case ViewMode.HalfDay:
8514
- currentDate = addToDate(currentDate, 12, 'hour');
8843
+ currentDate = addToDate(currentDate, 12, "hour");
8515
8844
  break;
8516
8845
  case ViewMode.QuarterDay:
8517
- currentDate = addToDate(currentDate, 6, 'hour');
8846
+ currentDate = addToDate(currentDate, 6, "hour");
8518
8847
  break;
8519
8848
  case ViewMode.Hour:
8520
- currentDate = addToDate(currentDate, 1, 'hour');
8849
+ currentDate = addToDate(currentDate, 1, "hour");
8521
8850
  break;
8522
8851
  }
8523
8852
  dates.push(currentDate);
@@ -8526,7 +8855,7 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
8526
8855
  };
8527
8856
  var getLocaleMonth = function getLocaleMonth(date, locale) {
8528
8857
  var bottomValue = getCachedDateTimeFormat(locale, {
8529
- month: 'long'
8858
+ month: "long"
8530
8859
  }).format(date);
8531
8860
  bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
8532
8861
  return bottomValue;
@@ -8576,15 +8905,15 @@ var defaultDateTimeFormatters = {
8576
8905
  return "W" + getWeekNumberISO8601(date);
8577
8906
  },
8578
8907
  day: function day(date, locale) {
8579
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate().toString();
8908
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate().toString();
8580
8909
  },
8581
8910
  hour: function hour(date, locale) {
8582
8911
  return "" + getCachedDateTimeFormat(locale, {
8583
- hour: 'numeric'
8912
+ hour: "numeric"
8584
8913
  }).format(date);
8585
8914
  },
8586
8915
  dayAndMonth: function dayAndMonth(date, locale) {
8587
- return getLocalDayOfWeek(date, locale, 'short') + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8916
+ return getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
8588
8917
  }
8589
8918
  };
8590
8919
 
@@ -8860,7 +9189,8 @@ var TaskList = function TaskList(_ref) {
8860
9189
  taskListRef = _ref.taskListRef,
8861
9190
  horizontalContainerClass = _ref.horizontalContainerClass,
8862
9191
  TaskListHeader = _ref.TaskListHeader,
8863
- TaskListTable = _ref.TaskListTable;
9192
+ TaskListTable = _ref.TaskListTable,
9193
+ filter = _ref.filter;
8864
9194
  var horizontalContainerRef = react.useRef(null);
8865
9195
  react.useEffect(function () {
8866
9196
  if (horizontalContainerRef.current) {
@@ -8885,6 +9215,10 @@ var TaskList = function TaskList(_ref) {
8885
9215
  setSelectedTask: setSelectedTask,
8886
9216
  onExpanderClick: onExpanderClick
8887
9217
  };
9218
+ react.useEffect(function () {
9219
+ var _taskListRef$current;
9220
+ (_taskListRef$current = taskListRef.current) === null || _taskListRef$current === void 0 ? void 0 : _taskListRef$current.prepend(filter);
9221
+ }, [taskListRef, filter]);
8888
9222
  return react.createElement("div", {
8889
9223
  ref: taskListRef,
8890
9224
  className: classes.tasks
@@ -8904,9 +9238,7 @@ var GridBody = function GridBody(_ref) {
8904
9238
  dates = _ref.dates,
8905
9239
  rowHeight = _ref.rowHeight,
8906
9240
  svgWidth = _ref.svgWidth,
8907
- columnWidth = _ref.columnWidth,
8908
- todayColor = _ref.todayColor,
8909
- rtl = _ref.rtl;
9241
+ columnWidth = _ref.columnWidth;
8910
9242
  var y = 0;
8911
9243
  var gridRows = [];
8912
9244
  var rowLines = [react.createElement("line", {
@@ -8920,7 +9252,7 @@ var GridBody = function GridBody(_ref) {
8920
9252
  for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
8921
9253
  var task = _step.value;
8922
9254
  gridRows.push(react.createElement("rect", {
8923
- key: 'Row' + task.id,
9255
+ key: "Row" + task.id,
8924
9256
  x: "0",
8925
9257
  y: y,
8926
9258
  width: svgWidth,
@@ -8928,7 +9260,7 @@ var GridBody = function GridBody(_ref) {
8928
9260
  className: styles$4.gridRow
8929
9261
  }));
8930
9262
  rowLines.push(react.createElement("line", {
8931
- key: 'RowLine' + task.id,
9263
+ key: "RowLine" + task.id,
8932
9264
  x: "0",
8933
9265
  y1: y + rowHeight,
8934
9266
  x2: svgWidth,
@@ -8940,7 +9272,6 @@ var GridBody = function GridBody(_ref) {
8940
9272
  var now = new Date();
8941
9273
  var tickX = 0;
8942
9274
  var ticks = [];
8943
- var today = react.createElement("rect", null);
8944
9275
  for (var i = 0; i < dates.length; i++) {
8945
9276
  var date = dates[i];
8946
9277
  ticks.push(react.createElement("line", {
@@ -8951,24 +9282,7 @@ var GridBody = function GridBody(_ref) {
8951
9282
  y2: y,
8952
9283
  className: styles$4.gridTick
8953
9284
  }));
8954
- if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), 'millisecond').getTime() >= now.getTime()) {
8955
- today = react.createElement("rect", {
8956
- x: tickX + columnWidth / 2 - 1,
8957
- y: 0,
8958
- width: 2,
8959
- height: y,
8960
- fill: todayColor
8961
- });
8962
- }
8963
- if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
8964
- today = react.createElement("rect", {
8965
- x: tickX + columnWidth / 2,
8966
- y: 0,
8967
- width: 2,
8968
- height: y,
8969
- fill: todayColor
8970
- });
8971
- }
9285
+ if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) ;
8972
9286
  tickX += columnWidth;
8973
9287
  }
8974
9288
  return react.createElement("g", {
@@ -8979,9 +9293,7 @@ var GridBody = function GridBody(_ref) {
8979
9293
  className: "rowLines"
8980
9294
  }, rowLines), react.createElement("g", {
8981
9295
  className: "ticks"
8982
- }, ticks), react.createElement("g", {
8983
- className: "today"
8984
- }, today));
9296
+ }, ticks));
8985
9297
  };
8986
9298
 
8987
9299
  var Grid = function Grid(props) {
@@ -9051,7 +9363,8 @@ var Calendar = function Calendar(_ref) {
9051
9363
  fontSize = _ref.fontSize,
9052
9364
  dateTimeFormatters = _ref.dateTimeFormatters,
9053
9365
  _ref$singleLineHeader = _ref.singleLineHeader,
9054
- singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader;
9366
+ singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
9367
+ currentDateIndicator = _ref.currentDateIndicator;
9055
9368
  var simplifiedHeader = singleLineHeader && dateSetup.viewMode !== ViewMode.Year;
9056
9369
  var TopCal = simplifiedHeader ? SinglePartOfCalendar : TopPartOfCalendar;
9057
9370
  var formatYear = (_dateTimeFormatters$y = dateTimeFormatters === null || dateTimeFormatters === void 0 ? void 0 : dateTimeFormatters.year) != null ? _dateTimeFormatters$y : defaultDateTimeFormatters.year;
@@ -9137,7 +9450,7 @@ var Calendar = function Calendar(_ref) {
9137
9450
  var dates = dateSetup.dates;
9138
9451
  for (var i = dates.length - 1; i >= 0; i--) {
9139
9452
  var date = dates[i];
9140
- var topValue = '';
9453
+ var topValue = "";
9141
9454
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
9142
9455
  topValue = formatMonthAndYear(date, locale);
9143
9456
  }
@@ -9272,7 +9585,12 @@ var Calendar = function Calendar(_ref) {
9272
9585
  width: columnWidth * dateSetup.dates.length,
9273
9586
  height: headerHeight,
9274
9587
  className: styles$5.calendarHeader
9275
- }), simplifiedHeader ? null : bottomValues, " ", topValues);
9588
+ }), simplifiedHeader ? null : bottomValues, " ", topValues, currentDateIndicator && react.createElement("circle", {
9589
+ fill: currentDateIndicator.color,
9590
+ cx: currentDateIndicator.x + 2.5,
9591
+ cy: headerHeight - 8,
9592
+ r: "8"
9593
+ }));
9276
9594
  };
9277
9595
 
9278
9596
  // A type of promise-like that resolves synchronously and supports only one observer
@@ -9511,6 +9829,9 @@ var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
9511
9829
  var index = dates.findIndex(function (d) {
9512
9830
  return d.getTime() >= xDate.getTime();
9513
9831
  }) - 1;
9832
+ if (index < 0) {
9833
+ return 0;
9834
+ }
9514
9835
  var remainderMillis = xDate.getTime() - dates[index].getTime();
9515
9836
  var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
9516
9837
  var x = index * columnWidth + percentOfInterval * columnWidth;
@@ -9668,6 +9989,15 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
9668
9989
  changedTask: changedTask
9669
9990
  };
9670
9991
  };
9992
+ function calculateCurrentDateCalculator(dates, columnWidth) {
9993
+ return taskXCoordinate(new Date(), dates, columnWidth);
9994
+ }
9995
+ function calculateProjection(start, end, dates, columnWidth) {
9996
+ return {
9997
+ x0: taskXCoordinate(start, dates, columnWidth),
9998
+ xf: taskXCoordinate(end, dates, columnWidth)
9999
+ };
10000
+ }
9671
10001
 
9672
10002
  function isKeyboardEvent(event) {
9673
10003
  return event.key !== undefined;
@@ -9930,11 +10260,15 @@ var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
9930
10260
 
9931
10261
  var Timeline = function Timeline(_ref) {
9932
10262
  var task = _ref.task,
9933
- isSelected = _ref.isSelected;
10263
+ isSelected = _ref.isSelected,
10264
+ onEventStart = _ref.onEventStart;
9934
10265
  var styles = task.styles;
9935
10266
  var col = isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
9936
10267
  return react.createElement("g", {
9937
- tabIndex: 0
10268
+ tabIndex: 0,
10269
+ onMouseDown: function onMouseDown(e) {
10270
+ return onEventStart("move", task, e);
10271
+ }
9938
10272
  }, react.createElement("rect", {
9939
10273
  fill: col,
9940
10274
  x: "0",
@@ -9945,6 +10279,9 @@ var Timeline = function Timeline(_ref) {
9945
10279
  ry: 0
9946
10280
  }), task.barChildren.map(function (bar) {
9947
10281
  return react.createElement("rect", {
10282
+ style: {
10283
+ cursor: "pointer"
10284
+ },
9948
10285
  key: bar.id,
9949
10286
  fill: bar.styles.backgroundColor,
9950
10287
  x: bar.x1,
@@ -9990,7 +10327,7 @@ var TaskItem = function TaskItem(props) {
9990
10327
  setTaskItem(react.createElement(Bar, Object.assign({}, props)));
9991
10328
  break;
9992
10329
  }
9993
- }, [task.typeInternal, isSelected, props]);
10330
+ }, [task, isSelected]);
9994
10331
  react.useEffect(function () {
9995
10332
  if (textRef.current) {
9996
10333
  setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
@@ -10058,6 +10395,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10058
10395
  fontFamily = _ref.fontFamily,
10059
10396
  fontSize = _ref.fontSize,
10060
10397
  rtl = _ref.rtl,
10398
+ _ref$hideLabel = _ref.hideLabel,
10399
+ hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10400
+ _ref$showSecondaryDat = _ref.showSecondaryDates,
10401
+ showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10402
+ currentDateIndicator = _ref.currentDateIndicator,
10403
+ projection = _ref.projection,
10061
10404
  setGanttEvent = _ref.setGanttEvent,
10062
10405
  setFailedTask = _ref.setFailedTask,
10063
10406
  setSelectedTask = _ref.setSelectedTask,
@@ -10065,11 +10408,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10065
10408
  onProgressChange = _ref.onProgressChange,
10066
10409
  onDoubleClick = _ref.onDoubleClick,
10067
10410
  onClick = _ref.onClick,
10068
- onDelete = _ref.onDelete,
10069
- _ref$hideLabel = _ref.hideLabel,
10070
- hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
10071
- _ref$showSecondaryDat = _ref.showSecondaryDates,
10072
- showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat;
10411
+ onDelete = _ref.onDelete;
10073
10412
  var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
10074
10413
  var _useState = react.useState(0),
10075
10414
  xStep = _useState[0],
@@ -10257,7 +10596,20 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10257
10596
  };
10258
10597
  return react.createElement("g", {
10259
10598
  className: "content"
10260
- }, react.createElement("g", {
10599
+ }, currentDateIndicator && react.createElement("rect", {
10600
+ fill: currentDateIndicator.color,
10601
+ x: currentDateIndicator.x + 1.5,
10602
+ y: "0",
10603
+ width: "2",
10604
+ height: "100%"
10605
+ }), projection && react.createElement("rect", {
10606
+ fill: projection.color,
10607
+ x: projection.x0,
10608
+ y: "0",
10609
+ width: projection.xf - projection.x0,
10610
+ height: "100%",
10611
+ fillOpacity: "35%"
10612
+ }), react.createElement("g", {
10261
10613
  className: "arrows",
10262
10614
  fill: arrowColor,
10263
10615
  stroke: arrowColor
@@ -10304,6 +10656,7 @@ var TaskGantt = function TaskGantt(_ref) {
10304
10656
  calendarProps = _ref.calendarProps,
10305
10657
  barProps = _ref.barProps,
10306
10658
  ganttHeight = _ref.ganttHeight,
10659
+ taskGanttRef = _ref.taskGanttRef,
10307
10660
  scrollY = _ref.scrollY,
10308
10661
  scrollX = _ref.scrollX;
10309
10662
  var ganttSVGRef = react.useRef(null);
@@ -10323,7 +10676,8 @@ var TaskGantt = function TaskGantt(_ref) {
10323
10676
  }
10324
10677
  }, [scrollX]);
10325
10678
  return react.createElement("div", {
10326
- className: styles$7.ganttContainer
10679
+ className: styles$7.ganttContainer,
10680
+ ref: taskGanttRef
10327
10681
  }, react.createElement("div", {
10328
10682
  className: styles$7.ganttVerticalContainer,
10329
10683
  ref: verticalGanttContainerRef,
@@ -10354,9 +10708,10 @@ var TaskGantt = function TaskGantt(_ref) {
10354
10708
  var styles$8 = {"scrollWrapper":"_2k9Ys","scroll":"_19jgW"};
10355
10709
 
10356
10710
  var HorizontalScroll = function HorizontalScroll(_ref) {
10711
+ var _taskGanttRef$current;
10357
10712
  var scroll = _ref.scroll,
10358
10713
  svgWidth = _ref.svgWidth,
10359
- taskListWidth = _ref.taskListWidth,
10714
+ taskGanttRef = _ref.taskGanttRef,
10360
10715
  rtl = _ref.rtl,
10361
10716
  onScroll = _ref.onScroll;
10362
10717
  var scrollRef = react.useRef(null);
@@ -10365,11 +10720,12 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10365
10720
  scrollRef.current.scrollLeft = scroll;
10366
10721
  }
10367
10722
  }, [scroll]);
10723
+ var rect = (_taskGanttRef$current = taskGanttRef.current) === null || _taskGanttRef$current === void 0 ? void 0 : _taskGanttRef$current.getBoundingClientRect();
10368
10724
  return react.createElement("div", {
10369
10725
  dir: "ltr",
10370
- style: {
10371
- margin: rtl ? "0px " + taskListWidth + "px 0px 0px" : "0px 0px 0px " + taskListWidth + "px"
10372
- },
10726
+ style: rect ? {
10727
+ margin: rtl ? "0px " + rect.x + "px 0px 0px" : "0px 0px 0px " + rect.x + "px"
10728
+ } : undefined,
10373
10729
  className: styles$8.scrollWrapper,
10374
10730
  onScroll: onScroll,
10375
10731
  ref: scrollRef
@@ -10382,15 +10738,17 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10382
10738
  };
10383
10739
 
10384
10740
  var Gantt = function Gantt(_ref) {
10385
- var tasks = _ref.tasks,
10741
+ var id = _ref.id,
10742
+ tasks = _ref.tasks,
10386
10743
  _ref$headerHeight = _ref.headerHeight,
10387
- headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
10744
+ headerHeight = _ref$headerHeight === void 0 ? 114 : _ref$headerHeight,
10388
10745
  _ref$columnWidth = _ref.columnWidth,
10389
10746
  columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
10390
10747
  _ref$listCellWidth = _ref.listCellWidth,
10391
- listCellWidth = _ref$listCellWidth === void 0 ? "155px" : _ref$listCellWidth,
10748
+ listCellWidth = _ref$listCellWidth === void 0 ? "297px" : _ref$listCellWidth,
10392
10749
  _ref$rowHeight = _ref.rowHeight,
10393
10750
  rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
10751
+ filter = _ref.filter,
10394
10752
  _ref$ganttHeight = _ref.ganttHeight,
10395
10753
  ganttHeight = _ref$ganttHeight === void 0 ? 0 : _ref$ganttHeight,
10396
10754
  _ref$viewMode = _ref.viewMode,
@@ -10438,7 +10796,7 @@ var Gantt = function Gantt(_ref) {
10438
10796
  _ref$arrowIndent = _ref.arrowIndent,
10439
10797
  arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
10440
10798
  _ref$todayColor = _ref.todayColor,
10441
- todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
10799
+ todayColor = _ref$todayColor === void 0 ? "#ff0000" : _ref$todayColor,
10442
10800
  viewDate = _ref.viewDate,
10443
10801
  _ref$TooltipContent = _ref.TooltipContent,
10444
10802
  TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
@@ -10446,13 +10804,6 @@ var Gantt = function Gantt(_ref) {
10446
10804
  TaskListHeader = _ref$TaskListHeader === void 0 ? TaskListHeaderDefault : _ref$TaskListHeader,
10447
10805
  _ref$TaskListTable = _ref.TaskListTable,
10448
10806
  TaskListTable = _ref$TaskListTable === void 0 ? TaskListTableDefault : _ref$TaskListTable,
10449
- onDateChange = _ref.onDateChange,
10450
- onProgressChange = _ref.onProgressChange,
10451
- onDoubleClick = _ref.onDoubleClick,
10452
- onClick = _ref.onClick,
10453
- onDelete = _ref.onDelete,
10454
- onSelect = _ref.onSelect,
10455
- onExpanderClick = _ref.onExpanderClick,
10456
10807
  dateTimeFormatters = _ref.dateTimeFormatters,
10457
10808
  _ref$singleLineHeader = _ref.singleLineHeader,
10458
10809
  singleLineHeader = _ref$singleLineHeader === void 0 ? false : _ref$singleLineHeader,
@@ -10461,13 +10812,24 @@ var Gantt = function Gantt(_ref) {
10461
10812
  _ref$showSecondaryDat = _ref.showSecondaryDates,
10462
10813
  showSecondaryDates = _ref$showSecondaryDat === void 0 ? false : _ref$showSecondaryDat,
10463
10814
  _ref$hideDependencies = _ref.hideDependencies,
10464
- hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies;
10815
+ hideDependencies = _ref$hideDependencies === void 0 ? false : _ref$hideDependencies,
10816
+ projection = _ref.projection,
10817
+ displayedStartDate = _ref.displayedStartDate,
10818
+ displayedEndDate = _ref.displayedEndDate,
10819
+ onDateChange = _ref.onDateChange,
10820
+ onProgressChange = _ref.onProgressChange,
10821
+ onDoubleClick = _ref.onDoubleClick,
10822
+ onClick = _ref.onClick,
10823
+ onDelete = _ref.onDelete,
10824
+ onSelect = _ref.onSelect,
10825
+ onExpanderClick = _ref.onExpanderClick;
10465
10826
  var wrapperRef = react.useRef(null);
10827
+ var taskGanttRef = react.useRef(null);
10466
10828
  var taskListRef = react.useRef(null);
10467
10829
  var _useState = react.useState(function () {
10468
- var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount, showSecondaryDates),
10469
- startDate = _ganttDateRange[0],
10470
- endDate = _ganttDateRange[1];
10830
+ var _ganttDateRangeFromTa = ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10831
+ startDate = _ganttDateRangeFromTa[0],
10832
+ endDate = _ganttDateRangeFromTa[1];
10471
10833
  return {
10472
10834
  viewMode: viewMode,
10473
10835
  dates: seedDates(startDate, endDate, viewMode)
@@ -10521,6 +10883,19 @@ var Gantt = function Gantt(_ref) {
10521
10883
  var _useState12 = react.useState(false),
10522
10884
  ignoreScrollEvent = _useState12[0],
10523
10885
  setIgnoreScrollEvent = _useState12[1];
10886
+ var _useState13 = react.useState(),
10887
+ currentDateIndicatorContent = _useState13[0],
10888
+ setCurrentDateIndicatorContent = _useState13[1];
10889
+ var _useState14 = react.useState(),
10890
+ projectionContent = _useState14[0],
10891
+ setProjectionContent = _useState14[1];
10892
+ react.useEffect(function () {
10893
+ window.addEventListener("gantt-sync-scroll-event", function (e) {
10894
+ if (e.detail.id !== id) {
10895
+ setScrollX(e.detail.scrollX);
10896
+ }
10897
+ });
10898
+ }, [id]);
10524
10899
  react.useEffect(function () {
10525
10900
  var filteredTasks;
10526
10901
  if (onExpanderClick) {
@@ -10529,9 +10904,9 @@ var Gantt = function Gantt(_ref) {
10529
10904
  filteredTasks = tasks;
10530
10905
  }
10531
10906
  filteredTasks = filteredTasks.sort(sortTasks);
10532
- var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount, showSecondaryDates),
10533
- startDate = _ganttDateRange2[0],
10534
- endDate = _ganttDateRange2[1];
10907
+ var _ganttDateRangeFromTa2 = ganttDateRangeFromTask(filteredTasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
10908
+ startDate = _ganttDateRangeFromTa2[0],
10909
+ endDate = _ganttDateRangeFromTa2[1];
10535
10910
  var newDates = seedDates(startDate, endDate, viewMode);
10536
10911
  if (rtl) {
10537
10912
  newDates = newDates.reverse();
@@ -10544,7 +10919,7 @@ var Gantt = function Gantt(_ref) {
10544
10919
  viewMode: viewMode
10545
10920
  });
10546
10921
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, projectHeight, timelineHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, showSecondaryDates));
10547
- }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick]);
10922
+ }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick, showSecondaryDates, projectHeight, timelineHeight, displayedStartDate, displayedEndDate]);
10548
10923
  react.useEffect(function () {
10549
10924
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
10550
10925
  var dates = dateSetup.dates;
@@ -10656,11 +11031,20 @@ var Gantt = function Gantt(_ref) {
10656
11031
  if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
10657
11032
  setScrollX(event.currentTarget.scrollLeft);
10658
11033
  setIgnoreScrollEvent(true);
11034
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11035
+ detail: {
11036
+ componentId: id,
11037
+ scrollX: event.currentTarget.scrollLeft
11038
+ }
11039
+ }));
10659
11040
  } else {
10660
11041
  setIgnoreScrollEvent(false);
10661
11042
  }
10662
11043
  };
10663
11044
  var handleKeyDown = function handleKeyDown(event) {
11045
+ if (event.target.tagName === "INPUT") {
11046
+ return;
11047
+ }
10664
11048
  event.preventDefault();
10665
11049
  var newScrollY = scrollY;
10666
11050
  var newScrollX = scrollX;
@@ -10692,6 +11076,12 @@ var Gantt = function Gantt(_ref) {
10692
11076
  newScrollX = svgWidth;
10693
11077
  }
10694
11078
  setScrollX(newScrollX);
11079
+ window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
11080
+ detail: {
11081
+ componentId: id,
11082
+ scrollX: newScrollX
11083
+ }
11084
+ }));
10695
11085
  } else {
10696
11086
  if (newScrollY < 0) {
10697
11087
  newScrollY = 0;
@@ -10702,6 +11092,29 @@ var Gantt = function Gantt(_ref) {
10702
11092
  }
10703
11093
  setIgnoreScrollEvent(true);
10704
11094
  };
11095
+ react.useEffect(function () {
11096
+ var x = calculateCurrentDateCalculator(dateSetup.dates, columnWidth);
11097
+ if (x !== 0) {
11098
+ setCurrentDateIndicatorContent({
11099
+ color: todayColor,
11100
+ x: x
11101
+ });
11102
+ }
11103
+ }, [columnWidth, dateSetup.dates, todayColor]);
11104
+ react.useEffect(function () {
11105
+ if (projection) {
11106
+ var _calculateProjection = calculateProjection(projection.start, projection.end, dateSetup.dates, columnWidth),
11107
+ x0 = _calculateProjection.x0,
11108
+ xf = _calculateProjection.xf;
11109
+ setProjectionContent({
11110
+ x0: x0,
11111
+ xf: xf,
11112
+ color: projection.color
11113
+ });
11114
+ } else {
11115
+ setProjectionContent(undefined);
11116
+ }
11117
+ }, [columnWidth, dateSetup.dates, projection]);
10705
11118
  var handleSelectedTask = function handleSelectedTask(taskId) {
10706
11119
  var newSelectedTask = barTasks.find(function (t) {
10707
11120
  return t.id === taskId;
@@ -10745,7 +11158,8 @@ var Gantt = function Gantt(_ref) {
10745
11158
  fontSize: fontSize,
10746
11159
  rtl: rtl,
10747
11160
  dateTimeFormatters: dateTimeFormatters,
10748
- singleLineHeader: singleLineHeader
11161
+ singleLineHeader: singleLineHeader,
11162
+ currentDateIndicator: currentDateIndicatorContent
10749
11163
  };
10750
11164
  var barProps = {
10751
11165
  tasks: barTasks,
@@ -10762,6 +11176,11 @@ var Gantt = function Gantt(_ref) {
10762
11176
  arrowIndent: arrowIndent,
10763
11177
  svgWidth: svgWidth,
10764
11178
  rtl: rtl,
11179
+ hideLabel: hideLabel,
11180
+ showSecondaryDates: showSecondaryDates,
11181
+ ganttHeight: ganttHeight,
11182
+ currentDateIndicator: currentDateIndicatorContent,
11183
+ projection: projectionContent,
10765
11184
  setGanttEvent: setGanttEvent,
10766
11185
  setFailedTask: setFailedTask,
10767
11186
  setSelectedTask: handleSelectedTask,
@@ -10769,9 +11188,7 @@ var Gantt = function Gantt(_ref) {
10769
11188
  onProgressChange: onProgressChange,
10770
11189
  onDoubleClick: onDoubleClick,
10771
11190
  onClick: onClick,
10772
- onDelete: onDelete,
10773
- hideLabel: hideLabel,
10774
- showSecondaryDates: showSecondaryDates
11191
+ onDelete: onDelete
10775
11192
  };
10776
11193
  var tableProps = {
10777
11194
  rowHeight: rowHeight,
@@ -10783,6 +11200,7 @@ var Gantt = function Gantt(_ref) {
10783
11200
  headerHeight: headerHeight,
10784
11201
  scrollY: scrollY,
10785
11202
  ganttHeight: ganttHeight,
11203
+ filter: filter,
10786
11204
  horizontalContainerClass: styles$7.horizontalContainer,
10787
11205
  selectedTask: selectedTask,
10788
11206
  taskListRef: taskListRef,
@@ -10801,6 +11219,7 @@ var Gantt = function Gantt(_ref) {
10801
11219
  calendarProps: calendarProps,
10802
11220
  barProps: barProps,
10803
11221
  ganttHeight: ganttHeight,
11222
+ taskGanttRef: taskGanttRef,
10804
11223
  scrollY: scrollY,
10805
11224
  scrollX: scrollX
10806
11225
  }), ganttEvent.changedTask && react.createElement(Tooltip, {
@@ -10827,6 +11246,7 @@ var Gantt = function Gantt(_ref) {
10827
11246
  rtl: rtl
10828
11247
  })), react.createElement(HorizontalScroll, {
10829
11248
  svgWidth: svgWidth,
11249
+ taskGanttRef: taskGanttRef,
10830
11250
  taskListWidth: taskListWidth,
10831
11251
  scroll: scrollX,
10832
11252
  rtl: rtl,
@@ -10834,195 +11254,6 @@ var Gantt = function Gantt(_ref) {
10834
11254
  }));
10835
11255
  };
10836
11256
 
10837
- var TimeUnit;
10838
- (function (TimeUnit) {
10839
- TimeUnit["DAY"] = "days";
10840
- TimeUnit["WEEK"] = "weeks";
10841
- TimeUnit["MONTH"] = "months";
10842
- TimeUnit["YEAR"] = "YEAR";
10843
- })(TimeUnit || (TimeUnit = {}));
10844
-
10845
- var parseToDayStart = function parseToDayStart(ymd) {
10846
- return luxon.DateTime.fromISO(ymd).toJSDate();
10847
- };
10848
- var parseToDayEnd = function parseToDayEnd(endDate) {
10849
- return luxon.DateTime.fromISO(endDate).plus({
10850
- seconds: 86400 - 1
10851
- }).toJSDate();
10852
- };
10853
- var formatToIsoDate = function formatToIsoDate(date) {
10854
- return luxon.DateTime.fromJSDate(date).toISODate();
10855
- };
10856
- var formatToLocaleSimple = function formatToLocaleSimple(date) {
10857
- return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
10858
- };
10859
- function validDates(startDate, endDate, name) {
10860
- var _start;
10861
- var start = parseToDayStart(startDate);
10862
- var end = parseToDayEnd(endDate);
10863
- if (((_start = start) === null || _start === void 0 ? void 0 : _start.getTime()) > (end === null || end === void 0 ? void 0 : end.getTime())) {
10864
- start = parseToDayStart(endDate);
10865
- console.log("time-converters.ts validDates() Error date", {
10866
- name: name,
10867
- start: startDate,
10868
- end: endDate
10869
- });
10870
- }
10871
- return {
10872
- start: start,
10873
- end: end
10874
- };
10875
- }
10876
-
10877
- var toViewMode = function toViewMode(timeUnit) {
10878
- switch (timeUnit) {
10879
- case TimeUnit.DAY:
10880
- return ViewMode.Day;
10881
- case TimeUnit.WEEK:
10882
- return ViewMode.Week;
10883
- case TimeUnit.MONTH:
10884
- return ViewMode.Month;
10885
- case TimeUnit.YEAR:
10886
- return ViewMode.Year;
10887
- }
10888
- };
10889
- var convertPhaseToTask = function convertPhaseToTask(item) {
10890
- var mapPhase = function mapPhase(_ref) {
10891
- var phaseStart = _ref.startDate,
10892
- phaseEnd = _ref.endDate,
10893
- secondaryStartDate = _ref.secondaryStartDate,
10894
- secondaryEndDate = _ref.secondaryEndDate,
10895
- phaseName = _ref.name,
10896
- phaseId = _ref.id,
10897
- color = _ref.color,
10898
- selectedColor = _ref.selectedColor,
10899
- dependencies = _ref.dependencies;
10900
- var _validDates = validDates(phaseStart, phaseEnd, phaseName),
10901
- start = _validDates.start,
10902
- end = _validDates.end;
10903
- var _validDates2 = validDates(secondaryStartDate, secondaryEndDate, phaseName),
10904
- phaseStart2 = _validDates2.start,
10905
- phaseEnd2 = _validDates2.end;
10906
- return {
10907
- start: start,
10908
- end: end,
10909
- secondaryStart: phaseStart2,
10910
- secondaryEnd: phaseEnd2,
10911
- name: phaseName,
10912
- valuesToShow: item.valuesToShow,
10913
- id: phaseId,
10914
- type: "task",
10915
- progress: 100,
10916
- dependencies: dependencies,
10917
- styles: color ? {
10918
- backgroundColor: color,
10919
- progressColor: color,
10920
- backgroundSelectedColor: selectedColor,
10921
- progressSelectedColor: selectedColor
10922
- } : {}
10923
- };
10924
- };
10925
- return mapPhase(item);
10926
- };
10927
- var convertDetailToTimeline = function convertDetailToTimeline(item) {
10928
- var id = item.id,
10929
- name = item.name,
10930
- schedule = item.schedule;
10931
- var convertToFrame = function convertToFrame(x) {
10932
- var startDate = x.startDate,
10933
- endDate = x.endDate,
10934
- color = x.color,
10935
- selectedColor = x.selectedColor;
10936
- var _validDates3 = validDates(startDate, endDate, "time frame"),
10937
- start = _validDates3.start,
10938
- end = _validDates3.end;
10939
- return {
10940
- start: start,
10941
- end: end,
10942
- backgroundColor: color != null ? color : "0xffffff",
10943
- backgroundSelectedColor: selectedColor != null ? selectedColor : color
10944
- };
10945
- };
10946
- var defaultColor = "#595959";
10947
- return {
10948
- id: id,
10949
- type: "timeline",
10950
- timeline: schedule.map(convertToFrame),
10951
- name: name,
10952
- valuesToShow: item.valuesToShow,
10953
- start: new Date(),
10954
- end: new Date(),
10955
- progress: 100,
10956
- styles: {
10957
- backgroundColor: defaultColor,
10958
- progressColor: defaultColor,
10959
- backgroundSelectedColor: defaultColor,
10960
- progressSelectedColor: defaultColor
10961
- }
10962
- };
10963
- };
10964
- var convertProjectToTasks = function convertProjectToTasks(_ref2) {
10965
- var id = _ref2.id,
10966
- name = _ref2.name,
10967
- valuesToShow = _ref2.valuesToShow,
10968
- startDate = _ref2.startDate,
10969
- endDate = _ref2.endDate,
10970
- phases = _ref2.phases,
10971
- details = _ref2.details,
10972
- secondaryStartDate = _ref2.secondaryStartDate,
10973
- secondaryEndDate = _ref2.secondaryEndDate;
10974
- var _validDates4 = validDates(startDate, endDate, name),
10975
- start = _validDates4.start,
10976
- end = _validDates4.end;
10977
- var _validDates5 = validDates(secondaryStartDate, secondaryEndDate, name),
10978
- start2 = _validDates5.start,
10979
- end2 = _validDates5.end;
10980
- var mainTask = {
10981
- start: start,
10982
- end: end,
10983
- id: id,
10984
- name: name,
10985
- valuesToShow: valuesToShow,
10986
- secondaryStart: start2,
10987
- secondaryEnd: end2,
10988
- type: "project",
10989
- progress: 100,
10990
- isDisabled: false,
10991
- hideChildren: false
10992
- };
10993
- var children1 = (phases != null ? phases : []).map(convertPhaseToTask);
10994
- var children2 = (details != null ? details : []).map(convertDetailToTimeline);
10995
- return [mainTask].concat(children1, children2);
10996
- };
10997
- var mergeTaskIntoProjects = function mergeTaskIntoProjects(projects, _ref3) {
10998
- var id = _ref3.id,
10999
- start = _ref3.start,
11000
- end = _ref3.end;
11001
- return projects.map(function (project) {
11002
- return project.id === id ? withNewDates(project, start, end) : project;
11003
- });
11004
- };
11005
- var mergeTaskIntoPhases = function mergeTaskIntoPhases(phases, _ref4) {
11006
- var id = _ref4.id,
11007
- start = _ref4.start,
11008
- end = _ref4.end;
11009
- if (phases) {
11010
- return phases.map(function (phase) {
11011
- return phase.id === id ? withNewDates(phase, start, end) : phase;
11012
- });
11013
- }
11014
- return undefined;
11015
- };
11016
- var withNewDates = function withNewDates(p, start, end) {
11017
- var startDate = formatToIsoDate(start);
11018
- var endDate = formatToIsoDate(end);
11019
- var extra = {
11020
- startDate: startDate,
11021
- endDate: endDate
11022
- };
11023
- return _extends({}, p, extra);
11024
- };
11025
-
11026
11257
  var cachedFormats = {};
11027
11258
  var getOrBuildCachedFormat = function getOrBuildCachedFormat(locale, options) {
11028
11259
  var _cachedFormats$key;
@@ -11035,8 +11266,8 @@ var format = function format(date, locale, options) {
11035
11266
  var format1 = getOrBuildCachedFormat(locale, options).format(date);
11036
11267
  return format1;
11037
11268
  } catch (e) {
11038
- console.log("time-formatters.ts format", date, locale, options);
11039
- console.log(e);
11269
+ console.error("time-formatters.ts format", date, locale, options);
11270
+ console.error(e);
11040
11271
  }
11041
11272
  };
11042
11273
  var dayFormatter = function dayFormatter(date, locale) {
@@ -11059,120 +11290,22 @@ var ganttDateTimeFormatters = {
11059
11290
  month: monthFormatter
11060
11291
  };
11061
11292
 
11062
- var _excluded = ["projects", "timeUnit", "TooltipContent", "TaskListHeader", "TaskListTable", "onDateChange", "onClick", "stylingOptions"];
11063
- var locale = "it-IT";
11064
- var GanttByTask = function GanttByTask(_ref) {
11065
- var _stylingOptions$preSt, _DateTime$now$minus;
11066
- var _ref$projects = _ref.projects,
11067
- projects = _ref$projects === void 0 ? [] : _ref$projects,
11068
- _ref$timeUnit = _ref.timeUnit,
11069
- timeUnit = _ref$timeUnit === void 0 ? TimeUnit.DAY : _ref$timeUnit,
11070
- TooltipContent = _ref.TooltipContent,
11071
- TaskListHeader = _ref.TaskListHeader,
11072
- TaskListTable = _ref.TaskListTable,
11073
- onDateChange = _ref.onDateChange,
11074
- onClick = _ref.onClick,
11075
- _ref$stylingOptions = _ref.stylingOptions,
11076
- stylingOptions = _ref$stylingOptions === void 0 ? {} : _ref$stylingOptions,
11077
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
11078
- var _useState = react.useState(projects),
11079
- currentProjects = _useState[0],
11080
- setCurrentProjects = _useState[1];
11081
- react.useEffect(function () {
11082
- if (projects) setCurrentProjects(projects);
11083
- }, [projects]);
11084
- var _useState2 = react.useState(1),
11085
- key = _useState2[0],
11086
- setKey = _useState2[1];
11087
- var tasks = react.useMemo(function () {
11088
- setKey(function (k) {
11089
- return k + 1;
11090
- });
11091
- return currentProjects.flatMap(convertProjectToTasks);
11092
- }, [currentProjects]);
11093
- var getProjectById = function getProjectById(id) {
11094
- return currentProjects.find(function (p) {
11095
- return p.id === id;
11096
- });
11097
- };
11098
- var handleClick = function handleClick(task) {
11099
- var id = task === null || task === void 0 ? void 0 : task.id;
11100
- console.log("gantt-by-task.tsx onClick", id);
11101
- var project = getProjectById(id);
11102
- if (project) onClick === null || onClick === void 0 ? void 0 : onClick(project);
11103
- var phase = currentProjects.flatMap(function (p) {
11104
- return p.phases;
11105
- }).find(function (ph) {
11106
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11107
- });
11108
- if (phase) onClick === null || onClick === void 0 ? void 0 : onClick(phase);
11109
- };
11110
- var handleDateChange = function handleDateChange(task) {
11111
- var id = task === null || task === void 0 ? void 0 : task.id;
11112
- console.log("gantt-by-task.tsx onDateChange", id);
11113
- var project = getProjectById(id);
11114
- if (project) {
11115
- var result = mergeTaskIntoProjects(currentProjects, task);
11116
- setCurrentProjects(result);
11117
- var _project = result.find(function (p) {
11118
- return p.id === id;
11119
- });
11120
- if (_project) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(_project);
11121
- return;
11122
- }
11123
- var parentOfClickedPhase = currentProjects.find(function (p) {
11124
- var _p$phases;
11125
- return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11126
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11127
- });
11128
- });
11129
- if (parentOfClickedPhase) {
11130
- var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11131
- var updatedProjects = currentProjects.map(function (p) {
11132
- return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11133
- phases: phases
11134
- }) : p;
11135
- });
11136
- setCurrentProjects(updatedProjects);
11137
- var phase = updatedProjects.flatMap(function (p) {
11138
- return p.phases;
11139
- }).find(function (ph) {
11140
- return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11141
- });
11142
- if (phase) onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(phase);
11143
- }
11144
- };
11145
- var viewDate = luxon.DateTime.now().minus((_DateTime$now$minus = {}, _DateTime$now$minus[timeUnit] = (_stylingOptions$preSt = stylingOptions === null || stylingOptions === void 0 ? void 0 : stylingOptions.preStepsCount) != null ? _stylingOptions$preSt : 2, _DateTime$now$minus)).toJSDate();
11146
- console.log("gantt-by-task.tsx TASKS", tasks);
11147
- var returnElement = (tasks === null || tasks === void 0 ? void 0 : tasks.length) > 0 && react.createElement(Gantt, Object.assign({
11148
- key: key,
11149
- tasks: tasks,
11150
- locale: locale,
11151
- viewMode: toViewMode(timeUnit),
11152
- viewDate: viewDate,
11153
- onClick: handleClick,
11154
- onDateChange: handleDateChange,
11155
- TooltipContent: TooltipContent,
11156
- TaskListHeader: TaskListHeader,
11157
- TaskListTable: TaskListTable,
11158
- dateTimeFormatters: ganttDateTimeFormatters
11159
- }, stylingOptions, props));
11160
- if (returnElement) {
11161
- return returnElement;
11162
- } else {
11163
- return react.createElement("div", null);
11164
- }
11165
- };
11166
-
11167
- var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA"};
11293
+ var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA","filter":"_2cfRI"};
11168
11294
 
11169
11295
  var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView) {
11170
- var CustomTaskListHeader = function CustomTaskListHeader() {
11296
+ var CustomTaskListHeader = function CustomTaskListHeader(_ref) {
11297
+ var fontFamily = _ref.fontFamily,
11298
+ fontSize = _ref.fontSize;
11171
11299
  return react.createElement("div", {
11300
+ style: {
11301
+ fontFamily: fontFamily,
11302
+ fontSize: fontSize,
11303
+ height: "50px"
11304
+ },
11172
11305
  className: classes$1.wrapper
11173
11306
  }, react.createElement("div", {
11174
11307
  className: classes$1.title
11175
- }, react.createElement("span", null, label)), react.createElement("div", {
11308
+ }, react.createElement("span", null, label)), setDoubleView && react.createElement("div", {
11176
11309
  className: classes$1.toggler
11177
11310
  }, react.createElement("label", {
11178
11311
  htmlFor: "ch2",
@@ -11189,12 +11322,12 @@ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView
11189
11322
  className: classes$1.slider
11190
11323
  })), react.createElement("span", {
11191
11324
  className: classes$1.label
11192
- }, "Mostra previsioni")));
11325
+ }, "Previsioni")));
11193
11326
  };
11194
11327
  return CustomTaskListHeader;
11195
11328
  };
11196
11329
 
11197
- var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW","timelineWrapper":"_1H4ue"};
11330
+ var styles$9 = {"container":"_lEI6r","project":"_RU6Aa","main":"_30j6y","subrow":"_T0HQN","timeline":"_yp2DW"};
11198
11331
 
11199
11332
  var ProjectRow = function ProjectRow(_ref) {
11200
11333
  var _ref$task = _ref.task,
@@ -11220,7 +11353,7 @@ var ProjectRow = function ProjectRow(_ref) {
11220
11353
  "--grid-project-columns": str
11221
11354
  };
11222
11355
  return react.createElement("div", {
11223
- key: id,
11356
+ key: "task_" + id,
11224
11357
  className: styles$9.project,
11225
11358
  style: customStyle,
11226
11359
  onClick: function onClick() {
@@ -11231,7 +11364,7 @@ var ProjectRow = function ProjectRow(_ref) {
11231
11364
  return react.createElement("span", {
11232
11365
  className: index === 0 ? styles$9.main : undefined,
11233
11366
  title: v.length > 10 ? v : undefined,
11234
- key: id + "_valuesToShow_" + index
11367
+ key: "task_" + id + "_valuesToShow_" + index
11235
11368
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11236
11369
  }));
11237
11370
  };
@@ -11260,7 +11393,7 @@ var SubRow = function SubRow(_ref2) {
11260
11393
  "--grid-fasi-columns": str
11261
11394
  };
11262
11395
  return react.createElement("div", {
11263
- key: id,
11396
+ key: "phase_" + id,
11264
11397
  className: styles$9.subrow,
11265
11398
  style: customStyle,
11266
11399
  onClick: function onClick() {
@@ -11268,7 +11401,7 @@ var SubRow = function SubRow(_ref2) {
11268
11401
  onclickTaskList(id);
11269
11402
  }
11270
11403
  }, react.createElement("span", {
11271
- key: id + "_valuesToShow_color",
11404
+ key: "phase_" + id + "_valuesToShow_color",
11272
11405
  style: {
11273
11406
  height: 16,
11274
11407
  width: 16,
@@ -11278,41 +11411,42 @@ var SubRow = function SubRow(_ref2) {
11278
11411
  return react.createElement("span", {
11279
11412
  className: index === 0 ? styles$9.main : undefined,
11280
11413
  title: v.length > 10 ? v : undefined,
11281
- key: id + "_valuesToShow_" + index
11414
+ key: "phase_" + id + "_valuesToShow_" + index
11282
11415
  }, v === "#START#" ? formatToLocaleSimple(start) : v === "#END#" ? formatToLocaleSimple(end) : v);
11283
11416
  }));
11284
11417
  };
11285
11418
  var TimelineSubRow = function TimelineSubRow(_ref3) {
11286
11419
  var _ref3$task = _ref3.task,
11287
11420
  id = _ref3$task.id,
11288
- name = _ref3$task.name,
11421
+ valuesToShow = _ref3$task.valuesToShow,
11289
11422
  rowHeight = _ref3.rowHeight,
11290
11423
  rowWidth = _ref3.rowWidth,
11291
11424
  fontFamily = _ref3.fontFamily,
11292
11425
  fontSize = _ref3.fontSize;
11426
+ var str = "";
11427
+ for (var i = 0; i < valuesToShow.length; i++) {
11428
+ str += "1fr ";
11429
+ }
11430
+ var customStyle = {
11431
+ height: rowHeight,
11432
+ width: rowWidth,
11433
+ fontFamily: fontFamily,
11434
+ fontSize: fontSize,
11435
+ "--grid-fasi-columns": str
11436
+ };
11293
11437
  return react.createElement("div", {
11294
- key: id,
11295
- className: styles$9.timelineWrapper,
11296
- style: {
11297
- height: rowHeight,
11298
- width: rowWidth,
11299
- fontFamily: fontFamily,
11300
- fontSize: fontSize
11301
- }
11302
- }, react.createElement("div", {
11438
+ key: "detail_" + id,
11303
11439
  className: styles$9.timeline,
11304
- style: {
11305
- height: rowHeight - 5
11306
- }
11307
- }, react.createElement("span", {
11308
- key: id + "_valuesToShow_0"
11309
- }, name), react.createElement("span", {
11310
- key: id + "_valuesToShow_1"
11311
- }, "A"), react.createElement("span", {
11312
- key: id + "_valuesToShow_2"
11313
- }, "A")));
11440
+ style: customStyle
11441
+ }, valuesToShow === null || valuesToShow === void 0 ? void 0 : valuesToShow.map(function (v, index) {
11442
+ return react.createElement("span", {
11443
+ className: index === 0 ? styles$9.main : undefined,
11444
+ title: v.length > 10 ? v : undefined,
11445
+ key: "detail_" + id + "_valuesToShow_" + index
11446
+ }, v);
11447
+ }));
11314
11448
  };
11315
- var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11449
+ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id) {
11316
11450
  var CustomTaskListTable = function CustomTaskListTable(_ref4) {
11317
11451
  var rowHeight = _ref4.rowHeight,
11318
11452
  rowWidth = _ref4.rowWidth,
@@ -11321,9 +11455,12 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList) {
11321
11455
  tasks = _ref4.tasks,
11322
11456
  setSelectedTask = _ref4.setSelectedTask;
11323
11457
  return react.createElement("div", {
11324
- className: styles$9.container
11458
+ className: styles$9.container,
11459
+ key: "tasks_container_" + id
11325
11460
  }, tasks.map(function (task) {
11326
- return react.createElement(react.Fragment, null, task.type === "project" && react.createElement(ProjectRow, {
11461
+ return react.createElement(react.Fragment, {
11462
+ key: task.id
11463
+ }, task.type === "project" && react.createElement(ProjectRow, {
11327
11464
  key: task.id + "_" + task.type,
11328
11465
  task: task,
11329
11466
  rowHeight: rowHeight,
@@ -11408,49 +11545,258 @@ var Switcher = function Switcher(_ref) {
11408
11545
  };
11409
11546
 
11410
11547
  var Planner = function Planner(props) {
11411
- var _props$showSecondaryD, _props$taskListHeader, _props$taskListTableP, _props$tooltipContent;
11548
+ var _props$secondaryGantt, _props$mainGantt$show, _props$mainGantt$task, _props$mainGantt$task2, _props$mainGantt$tool, _props$secondaryGantt3, _props$secondaryGantt4, _props$secondaryGantt5, _props$secondaryGantt6;
11412
11549
  var _useState = react.useState(TimeUnit.MONTH),
11413
11550
  timeUnit = _useState[0],
11414
11551
  setTimeUnit = _useState[1];
11415
- var _useState2 = react.useState((_props$showSecondaryD = props.showSecondaryDates) != null ? _props$showSecondaryD : false),
11416
- doubleView = _useState2[0],
11417
- setDoubleView = _useState2[1];
11418
- var commonProps = {
11419
- hideLabel: props.hideLabel,
11420
- showSecondaryDates: doubleView,
11421
- ganttHeight: props.ganttHeight,
11422
- hideDependencies: props.hideDependencies
11552
+ var _useState2 = react.useState(props.mainGantt.items),
11553
+ currentTasks = _useState2[0],
11554
+ setCurrentTasks = _useState2[1];
11555
+ var _useState3 = react.useState((_props$secondaryGantt = props.secondaryGantt) === null || _props$secondaryGantt === void 0 ? void 0 : _props$secondaryGantt.items),
11556
+ currentDetails = _useState3[0],
11557
+ setCurrentDetails = _useState3[1];
11558
+ var _useState4 = react.useState((_props$mainGantt$show = props.mainGantt.showSecondaryDates) != null ? _props$mainGantt$show : false),
11559
+ mainGanttDoubleView = _useState4[0],
11560
+ setMainGanttDoubleView = _useState4[1];
11561
+ var _useState5 = react.useState(calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount)),
11562
+ displayedDates = _useState5[0],
11563
+ setDisplayedDates = _useState5[1];
11564
+ var _useState6 = react.useState(),
11565
+ viewDate = _useState6[0],
11566
+ setViewDate = _useState6[1];
11567
+ var _useState7 = react.useState(),
11568
+ projection = _useState7[0],
11569
+ setProjection = _useState7[1];
11570
+ var locale = "it-IT";
11571
+ var handleClick = function handleClick(row, onClick) {
11572
+ if (!row) {
11573
+ return;
11574
+ }
11575
+ if (row.type === "task" && props.secondaryGantt) {
11576
+ var _phase$color;
11577
+ var phase = row;
11578
+ setProjection({
11579
+ start: new Date(phase.startDate),
11580
+ end: new Date(phase.endDate),
11581
+ color: (_phase$color = phase.color) != null ? _phase$color : "#ED7D31"
11582
+ });
11583
+ } else {
11584
+ setProjection(undefined);
11585
+ }
11586
+ onClick === null || onClick === void 0 ? void 0 : onClick(row);
11423
11587
  };
11424
- console.log("planner.tsx commonProps", commonProps);
11425
- return react.createElement("div", {
11426
- style: {
11427
- maxWidth: "90vw"
11588
+ var handleDateChange = function handleDateChange(task, currentProjects, onDateChange) {
11589
+ var id = task === null || task === void 0 ? void 0 : task.id;
11590
+ if (!id) {
11591
+ return;
11592
+ }
11593
+ var row = getProjectById(id, currentProjects);
11594
+ if (!row) {
11595
+ row = getPhaseById(id, currentProjects);
11596
+ }
11597
+ if (!row) {
11598
+ return;
11599
+ }
11600
+ if (row.type === "timeline") {
11601
+ console.log("planner.tsx onDateChange for timeline not managed yet", id, row.type);
11602
+ return;
11603
+ }
11604
+ if (row.type === "project") {
11605
+ var result = mergeTaskIntoProjects(currentProjects, task);
11606
+ row = getProjectById(row.id, result);
11607
+ setViewDate(task.start);
11608
+ setCurrentTasks(result);
11609
+ } else if (row.type === "task") {
11610
+ var parentOfClickedPhase = currentProjects.find(function (p) {
11611
+ var _p$phases;
11612
+ return (_p$phases = p.phases) === null || _p$phases === void 0 ? void 0 : _p$phases.some(function (ph) {
11613
+ return (ph === null || ph === void 0 ? void 0 : ph.id) === id;
11614
+ });
11615
+ });
11616
+ if (parentOfClickedPhase) {
11617
+ var phases = mergeTaskIntoPhases(parentOfClickedPhase.phases, task);
11618
+ var updatedProjects = currentProjects.map(function (p) {
11619
+ return p.id === parentOfClickedPhase.id ? _extends({}, p, {
11620
+ phases: phases
11621
+ }) : p;
11622
+ });
11623
+ row = getPhaseById(row.id, updatedProjects);
11624
+ if (props.secondaryGantt && row) {
11625
+ var _row$color;
11626
+ setProjection({
11627
+ start: new Date(row.startDate),
11628
+ end: new Date(row.endDate),
11629
+ color: (_row$color = row.color) != null ? _row$color : "#ED7D31"
11630
+ });
11631
+ }
11632
+ setViewDate(task.start);
11633
+ setCurrentTasks(updatedProjects);
11634
+ }
11635
+ }
11636
+ onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(row);
11637
+ };
11638
+ react.useEffect(function () {
11639
+ var _props$secondaryGantt2;
11640
+ setCurrentTasks(props.mainGantt.items);
11641
+ setCurrentDetails((_props$secondaryGantt2 = props.secondaryGantt) === null || _props$secondaryGantt2 === void 0 ? void 0 : _props$secondaryGantt2.items);
11642
+ setProjection(undefined);
11643
+ }, [props]);
11644
+ react.useEffect(function () {
11645
+ var dates = calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount);
11646
+ setDisplayedDates(dates);
11647
+ if (!viewDate) {
11648
+ setViewDate(dates.displayedStartDate);
11649
+ }
11650
+ }, [currentTasks, currentDetails]);
11651
+ var tasks = [];
11652
+ for (var i = 0; i < currentTasks.length; i++) {
11653
+ tasks.push.apply(tasks, convertProjectToTasks(currentTasks[i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11654
+ }
11655
+ var details = [];
11656
+ if (currentDetails) {
11657
+ for (var _i = 0; _i < currentDetails.length; _i++) {
11658
+ details.push.apply(details, convertProjectToTasks(currentDetails[_i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
11428
11659
  }
11429
- }, react.createElement(Switcher, {
11660
+ }
11661
+ console.log("PLANNER render");
11662
+ return react.createElement("div", null, react.createElement(Switcher, {
11430
11663
  onTimeUnitChange: function onTimeUnitChange(timeUnit) {
11431
11664
  return setTimeUnit(timeUnit);
11432
11665
  }
11433
- }), react.createElement(GanttByTask, Object.assign({}, commonProps, {
11434
- projects: props.items,
11435
- timeUnit: timeUnit,
11436
- stylingOptions: props.stylingOptions,
11437
- onClick: function onClick(row) {
11438
- var _props$onClick;
11439
- return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, row);
11666
+ }), react.createElement("div", {
11667
+ style: {
11668
+ display: "flex",
11669
+ flexDirection: "column"
11670
+ }
11671
+ }, react.createElement(Gantt, Object.assign({
11672
+ id: MAIN_GANTT_ID,
11673
+ key: MAIN_GANTT_ID,
11674
+ filter: props.mainGantt.filter,
11675
+ hideLabel: props.mainGantt.hideLabel,
11676
+ showSecondaryDates: mainGanttDoubleView,
11677
+ hideDependencies: props.mainGantt.hideDependencies,
11678
+ ganttHeight: props.mainGantt.ganttHeight,
11679
+ displayedStartDate: displayedDates.displayedStartDate,
11680
+ displayedEndDate: displayedDates.displayedEndDate,
11681
+ viewDate: viewDate,
11682
+ tasks: tasks,
11683
+ viewMode: toViewMode(timeUnit)
11684
+ }, props.mainGantt.stylingOptions, {
11685
+ TaskListHeader: (_props$mainGantt$task = props.mainGantt.taskListHeaderProject) != null ? _props$mainGantt$task : CustomTaskListHeaderHOC(props.mainGantt.title, mainGanttDoubleView != null ? mainGanttDoubleView : false, setMainGanttDoubleView),
11686
+ TaskListTable: (_props$mainGantt$task2 = props.mainGantt.taskListTableProject) != null ? _props$mainGantt$task2 : CustomTaskListTableHOC(function (id) {
11687
+ var row = getProjectById(id, currentTasks);
11688
+ if (!row) {
11689
+ row = getPhaseById(id, currentTasks);
11690
+ }
11691
+ if (row) {
11692
+ handleClick(row, props.mainGantt.onClick);
11693
+ }
11694
+ }, MAIN_GANTT_ID),
11695
+ TooltipContent: (_props$mainGantt$tool = props.mainGantt.tooltipContent) != null ? _props$mainGantt$tool : CustomTooltipHOC(),
11696
+ onClick: function onClick(e) {
11697
+ var row = getProjectById(e.id, currentTasks);
11698
+ if (!row) {
11699
+ row = getPhaseById(e.id, currentTasks);
11700
+ }
11701
+ if (row) {
11702
+ handleClick(row, props.mainGantt.onClick);
11703
+ }
11440
11704
  },
11441
- onDateChange: function onDateChange(row) {
11442
- var _props$onDateChange;
11443
- return (_props$onDateChange = props.onDateChange) === null || _props$onDateChange === void 0 ? void 0 : _props$onDateChange.call(props, row);
11705
+ onDateChange: function onDateChange(e) {
11706
+ return handleDateChange(e, currentTasks, props.mainGantt.onDateChange);
11444
11707
  },
11445
- TaskListHeader: (_props$taskListHeader = props.taskListHeaderProject) != null ? _props$taskListHeader : CustomTaskListHeaderHOC(props.title, doubleView != null ? doubleView : true, setDoubleView),
11446
- TaskListTable: (_props$taskListTableP = props.taskListTableProject) != null ? _props$taskListTableP : CustomTaskListTableHOC(function (id) {
11447
- console.log("planner.tsx Clicked on " + id);
11448
- }),
11449
- TooltipContent: (_props$tooltipContent = props.tooltipContent) != null ? _props$tooltipContent : CustomTooltipHOC()
11450
- })));
11708
+ locale: locale,
11709
+ dateTimeFormatters: ganttDateTimeFormatters
11710
+ })), props.secondaryGantt && react.createElement(Gantt, Object.assign({
11711
+ id: SECONDARY_GANTT_ID,
11712
+ key: SECONDARY_GANTT_ID,
11713
+ hideLabel: props.secondaryGantt.hideLabel,
11714
+ filter: props.secondaryGantt.filter,
11715
+ showSecondaryDates: mainGanttDoubleView,
11716
+ hideDependencies: props.secondaryGantt.hideDependencies,
11717
+ ganttHeight: props.secondaryGantt.ganttHeight,
11718
+ displayedStartDate: displayedDates.displayedStartDate,
11719
+ displayedEndDate: displayedDates.displayedEndDate,
11720
+ viewDate: viewDate,
11721
+ tasks: details,
11722
+ viewMode: toViewMode(timeUnit)
11723
+ }, props.mainGantt.stylingOptions, {
11724
+ TaskListHeader: (_props$secondaryGantt3 = props.secondaryGantt.taskListHeaderProject) != null ? _props$secondaryGantt3 : CustomTaskListHeaderHOC(props.secondaryGantt.title),
11725
+ TaskListTable: (_props$secondaryGantt4 = (_props$secondaryGantt5 = props.secondaryGantt) === null || _props$secondaryGantt5 === void 0 ? void 0 : _props$secondaryGantt5.taskListTableProject) != null ? _props$secondaryGantt4 : CustomTaskListTableHOC(function (id) {
11726
+ console.log("planner.tsx secondaryGantt Clicked on " + id);
11727
+ }, SECONDARY_GANTT_ID),
11728
+ TooltipContent: (_props$secondaryGantt6 = props.secondaryGantt.tooltipContent) != null ? _props$secondaryGantt6 : CustomTooltipHOC(),
11729
+ projection: projection,
11730
+ onClick: function onClick(e) {
11731
+ if (props.secondaryGantt) {
11732
+ var row = getProjectById(e.id, currentDetails);
11733
+ if (row) {
11734
+ handleClick(row, props.secondaryGantt.onClick);
11735
+ }
11736
+ }
11737
+ },
11738
+ onDateChange: function onDateChange(e) {
11739
+ var _props$secondaryGantt7;
11740
+ return handleDateChange(e, currentDetails, (_props$secondaryGantt7 = props.secondaryGantt) === null || _props$secondaryGantt7 === void 0 ? void 0 : _props$secondaryGantt7.onDateChange);
11741
+ },
11742
+ locale: locale,
11743
+ dateTimeFormatters: ganttDateTimeFormatters
11744
+ }))));
11451
11745
  };
11452
11746
 
11453
- const kupPlannerCss = "._3_ygE{display:table;border-bottom:#e6e4e4 1px solid;border-top:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._1nBOt{display:table-row;list-style:none}._2eZzQ{border-right:1px solid rgb(196, 196, 196);opacity:1;margin-left:-2px}._WuQ0f{display:table-cell;vertical-align:-webkit-baseline-middle;vertical-align:middle}._3ZbQT{display:table;border-bottom:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._34SS0{display:table-row;text-overflow:ellipsis}._34SS0:nth-of-type(even){}._3lLk3{display:table-cell;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._nI1Xw{display:flex}._2QjE6{color:rgb(86 86 86);font-size:0.6rem;padding:0.15rem 0.2rem 0 0.2rem;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer}._2TfEi{font-size:0.6rem;padding-left:1rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3T42e{background:#fff;padding:12px;box-shadow:0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)}._29NTg{font-size:12px;margin-bottom:6px;color:#666}._25P-K{position:absolute;display:flex;flex-shrink:0;pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3gVAq{visibility:hidden;position:absolute;display:flex;pointer-events:none}._1eT-t{overflow:hidden auto;width:1rem;flex-shrink:0;scrollbar-width:thin}._1eT-t::-webkit-scrollbar{width:1.1rem;height:1.1rem}._1eT-t::-webkit-scrollbar-corner{background:transparent}._1eT-t::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._1eT-t::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._EvhC1{border-radius:8px;background:#efefef;margin:12px;padding:12px}._2dZTy{fill:#fff}._2dZTy:nth-child(even){}._3rUKi{stroke:transparent}._RuwuK{stroke:#e6e4e4}._9w8d5{text-anchor:middle;fill:#333;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._1rLuZ{stroke:#e6e4e4}._2q1Kt{text-anchor:middle;fill:#555;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._35nLX{fill:#ffffff;stroke:#e0e0e0;stroke-width:1.4}._KxSXS{cursor:pointer;outline:none}._KxSXS:hover ._3w_5u{visibility:visible;opacity:1}._3w_5u{fill:#ddd;cursor:ew-resize;opacity:0;visibility:hidden}._31ERP{-webkit-user-select:none;-moz-user-select:none;user-select:none;stroke-width:0}._3zRJQ{fill:#fff;text-anchor:middle;font-weight:lighter;dominant-baseline:central;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._3KcaM{fill:#555;text-anchor:start;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._11iN9{background:#efefef;border-radius:8px;margin:12px;overflow:hidden;padding:12px}._CZjuD{overflow:hidden;font-size:0;margin:0;padding:0}._2B2zv{margin:0;padding:0;overflow:hidden}._3eULf{display:flex;padding:0;margin:0;list-style:none;outline:none;position:relative}._2k9Ys{overflow:auto;max-width:100%;scrollbar-width:thin;height:1.2rem}._2k9Ys::-webkit-scrollbar{width:1.1rem;height:1.1rem}._2k9Ys::-webkit-scrollbar-corner{background:transparent}._2k9Ys::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._2k9Ys::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._19jgW{height:1px}._37E9D{display:flex;font-family:var(--kup-font-family, inherit);justify-content:space-around;max-width:330px;padding:16px 0;place-items:\"center\";text-align:center}._WrYI6{font-size:14px;font-weight:bold;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%}._c53zr{max-width:-moz-max-content;max-width:max-content;padding:0 4px;text-align:right;width:100%}._2eBO5{position:relative;display:inline-block;width:30px;height:17px}._hiyro{opacity:0;width:0;height:0}._hiyro:checked+._2HI58{background-color:#003b77}._hiyro:checked+._2HI58:before{transform:translateX(13px)}._hiyro:focus+._2HI58{box-shadow:0 0 1px #003b77}._2HI58{-webkit-transition:0.4s;cursor:pointer;background-color:#ccc;bottom:0;border-radius:17px;left:0;position:absolute;right:0;top:0;transition:0.4s}._2HI58:before{-webkit-transition:0.1s;background-color:white;border-radius:50%;bottom:2px;content:\"\";height:13px;left:2px;position:absolute;transition:0.1s;width:13px}._2gSdA{font-size:12px;padding:6px}._lEI6r{padding:0 10px;margin-right:10px}._RU6Aa{background:var(--kup-background-color, #ffffff);border:1px solid var(--kup-border-color, #acacac);border-radius:4px;box-sizing:border-box;color:var(--kup-text-color, #595959);cursor:pointer;display:grid;font-weight:400;grid-template-columns:var(--grid-project-columns, 1fr 1fr 1fr);place-items:center}._RU6Aa>*{font-size:14px;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}._RU6Aa ._30j6y{font-weight:700;width:100%;text-align:center}._T0HQN{cursor:pointer;display:grid;border-width:0 1px 1px 1px;border-style:solid;border-color:#acacac;border-bottom-left-radius:4px;border-bottom-right-radius:4px;grid-template-columns:var(--grid-fasi-columns, 1fr 1fr 1fr);place-items:center;background:#ffffff;color:#595959;font-weight:400}._T0HQN>*{font-size:12px;line-height:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%}._T0HQN:has(+._T0HQN),._RU6Aa:has(+._T0HQN){border-bottom-left-radius:0;border-bottom-right-radius:0}._yp2DW{cursor:pointer;display:grid;border-width:1px;border-style:solid;border-color:#cbcbcb;border-radius:4px;grid-template-columns:34% 33% 33%;place-items:center;background:#fff;color:#595959;font-weight:400}._yp2DW>*{font-size:12px;line-height:14px;overflow:hidden;text-overflow:ellipsis}._yp2DW>*:first-child{width:100%;white-space:nowrap;padding-left:5.5px}._1H4ue{background:#f2f2f2;padding:3px}._3P0WE{display:grid;grid-auto-flow:column;grid-gap:8px;margin-left:12px;width:-moz-max-content;width:max-content}._1oXbe{background:transparent;border-color:var(--kup-primary-color, #003b77);border-radius:4px;border-width:1px;box-shadow:0 3px 1px -2px rgba(var(--kup-text-color-rgb, 51 51 51), 0.2), 0 2px 2px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.14), 0 1px 5px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.12);box-sizing:border-box;color:var(--kup-primary-color, #003b77);cursor:pointer;font-size:11px;height:32px;min-width:64px}._1R9mh{font-family:var(--kup-font-family, inherit);font-size:11px;letter-spacing:0.0892857143em;text-decoration:none;text-transform:uppercase;padding:0 6px}:host{display:block}";
11747
+ const kupManager = kupManagerInstance();
11748
+ function sanitizeAllDates(startDateCell, endDateCell, secStartDateCell, secEndDateCell) {
11749
+ const sanitizedDateValues = sanitizeDates(startDateCell, endDateCell);
11750
+ let sanitizedSecDateValues = [];
11751
+ if (secStartDateCell && secEndDateCell) {
11752
+ if (isAtLeastOneDateValid(secStartDateCell, secEndDateCell)) {
11753
+ sanitizedSecDateValues = sanitizeDates(secStartDateCell, secEndDateCell);
11754
+ }
11755
+ else {
11756
+ sanitizedSecDateValues = [...sanitizedDateValues];
11757
+ }
11758
+ }
11759
+ return {
11760
+ dateValues: sanitizedDateValues,
11761
+ secDateValues: sanitizedSecDateValues,
11762
+ };
11763
+ }
11764
+ function sanitizeDates(startDateCell, endDateCell) {
11765
+ let returnValues = [startDateCell.value, endDateCell.value];
11766
+ if (isDateValid(startDateCell) && isDateValid(endDateCell)) {
11767
+ return returnValues;
11768
+ }
11769
+ else if (isDateValid(startDateCell)) {
11770
+ return [startDateCell.value, startDateCell.value];
11771
+ }
11772
+ else if (isDateValid(endDateCell)) {
11773
+ return [endDateCell.value, endDateCell.value];
11774
+ }
11775
+ else {
11776
+ return returnValues;
11777
+ }
11778
+ }
11779
+ function isDateValid(dateCell) {
11780
+ return (kupManager.objects.isDate(dateCell.obj) &&
11781
+ kupManager.dates.isValid(dateCell.value, KupDatesFormats.ISO_DATE));
11782
+ }
11783
+ function isAtLeastOneDateValid(startDateCell, endDateCell) {
11784
+ return isDateValid(startDateCell) || isDateValid(endDateCell);
11785
+ }
11786
+ function getValuesToShow(row, idCol, nameCol, dataColumns, columns, customToValuesFunction) {
11787
+ let toValuesFunction = () => columns.map((col) => {
11788
+ return getCellValueForDisplay(dataColumns.find((kCol) => kCol.name == col), row.cells[col]);
11789
+ });
11790
+ if (customToValuesFunction) {
11791
+ toValuesFunction = customToValuesFunction;
11792
+ }
11793
+ const valuesToShow = (columns === null || columns === void 0 ? void 0 : columns.length) >= 2
11794
+ ? toValuesFunction()
11795
+ : [row.cells[idCol].value, row.cells[nameCol].value];
11796
+ return valuesToShow;
11797
+ }
11798
+
11799
+ 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}.filter{margin:12px 10px 12px 0;padding:0 10px}";
11454
11800
 
11455
11801
  var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11456
11802
  if (kind === "a" && !f)
@@ -11468,7 +11814,7 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
11468
11814
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
11469
11815
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11470
11816
  };
11471
- var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_lastOnChangeReceived, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase, _KupPlanner_emitOnChangeEventsReceived;
11817
+ 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, _KupPlanner_onFilter;
11472
11818
  const KupPlanner = class {
11473
11819
  constructor(hostRef) {
11474
11820
  registerInstance(this, hostRef);
@@ -11485,7 +11831,16 @@ const KupPlanner = class {
11485
11831
  this.plannerProps = undefined;
11486
11832
  this.customStyle = '';
11487
11833
  this.data = undefined;
11488
- this.dataRaw = undefined;
11834
+ this.detailData = undefined;
11835
+ this.detailColorCol = undefined;
11836
+ this.detailColumns = undefined;
11837
+ this.detailDates = undefined;
11838
+ this.detailHeight = undefined;
11839
+ this.detailIdCol = undefined;
11840
+ this.detailNameCol = undefined;
11841
+ this.detailPrevDates = undefined;
11842
+ this.listCellWidth = '300px';
11843
+ this.maxWidth = '90vw';
11489
11844
  this.phaseColorCol = undefined;
11490
11845
  this.phaseColumns = undefined;
11491
11846
  this.phaseColParDep = undefined;
@@ -11493,8 +11848,10 @@ const KupPlanner = class {
11493
11848
  this.phaseIdCol = undefined;
11494
11849
  this.phaseNameCol = undefined;
11495
11850
  this.phasePrevDates = undefined;
11851
+ this.showSecondaryDates = false;
11496
11852
  this.taskColumns = undefined;
11497
11853
  this.taskDates = undefined;
11854
+ this.taskHeight = undefined;
11498
11855
  this.taskIdCol = undefined;
11499
11856
  this.taskNameCol = undefined;
11500
11857
  this.taskPrevDates = undefined;
@@ -11508,11 +11865,12 @@ const KupPlanner = class {
11508
11865
  taskAction: taskAction,
11509
11866
  });
11510
11867
  }
11511
- onKupDateChange(event) {
11868
+ onKupDateChange(event, taskAction) {
11512
11869
  this.kupDateChange.emit({
11513
11870
  comp: this,
11514
11871
  id: this.rootElement.id,
11515
11872
  value: event,
11873
+ taskAction: taskAction,
11516
11874
  });
11517
11875
  }
11518
11876
  /*-------------------------------------------------*/
@@ -11548,21 +11906,29 @@ const KupPlanner = class {
11548
11906
  var _a;
11549
11907
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11550
11908
  if (task) {
11551
- task.phases = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
11909
+ 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) => {
11910
+ const datesSanitized = sanitizeAllDates(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]], row.cells[this.phasePrevDates[0]], row.cells[this.phasePrevDates[1]]);
11911
+ const valuesToShow = getValuesToShow(row, this.phaseIdCol, this.phaseNameCol, data.columns, this.phaseColumns, () => this.phaseColumns.map((col) => col == this.phaseDates[0]
11912
+ ? '#START#'
11913
+ : col == this.phaseDates[1]
11914
+ ? '#END#'
11915
+ : getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
11552
11916
  let phase = {
11553
11917
  taskRow: task.taskRow,
11554
11918
  phaseRow: row,
11555
- id: row.cells[this.phaseIdCol].value,
11919
+ id: task.id + '_' + row.cells[this.phaseIdCol].value,
11556
11920
  phaseRowId: row.id,
11557
11921
  taskRowId: task.taskRowId,
11558
11922
  name: row.cells[this.phaseNameCol].value,
11559
- startDate: row.cells[this.phaseDates[0]].value,
11560
- endDate: row.cells[this.phaseDates[1]].value,
11561
- secondaryStartDate: row.cells[this.phasePrevDates[0]].value,
11562
- secondaryEndDate: row.cells[this.phasePrevDates[1]].value,
11563
- type: 'phase',
11923
+ startDate: datesSanitized.dateValues[0],
11924
+ endDate: datesSanitized.dateValues[1],
11925
+ secondaryStartDate: datesSanitized.secDateValues[0],
11926
+ secondaryEndDate: datesSanitized.secDateValues[1],
11927
+ type: 'task',
11564
11928
  color: row.cells[this.phaseColorCol].value,
11565
- valuesToShow: this.phaseColumns.map((col) => row.cells[col].value),
11929
+ selectedColor: row.cells[this.phaseColorCol].value,
11930
+ valuesToShow: valuesToShow,
11931
+ rowType: KupPlannerGanttRowType.PHASE,
11566
11932
  };
11567
11933
  return phase;
11568
11934
  });
@@ -11570,27 +11936,34 @@ const KupPlanner = class {
11570
11936
  this.plannerProps = Object.assign({}, this.plannerProps);
11571
11937
  }
11572
11938
  handleOnClick(nativeEvent) {
11573
- console.log('handleOnClick', nativeEvent);
11574
- switch (nativeEvent.type) {
11575
- case 'task':
11939
+ console.log('kup-planner.handleOnClick', nativeEvent);
11940
+ switch (nativeEvent.rowType) {
11941
+ case KupPlannerGanttRowType.TASK:
11576
11942
  const taskAction = nativeEvent.phases
11577
- ? KupPlannerTaskAction.onClosing
11578
- : KupPlannerTaskAction.onOpening;
11943
+ ? KupPlannerTaskAction.onTaskClosing
11944
+ : KupPlannerTaskAction.onTaskOpening;
11579
11945
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnTask).call(this, nativeEvent)) {
11580
11946
  this.onKupClick(nativeEvent, taskAction);
11581
11947
  }
11582
11948
  break;
11583
- case 'phase':
11949
+ case KupPlannerGanttRowType.PHASE:
11584
11950
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
11585
- this.onKupClick(nativeEvent);
11951
+ this.onKupClick(nativeEvent, KupPlannerTaskAction.onClick);
11952
+ }
11953
+ break;
11954
+ case KupPlannerGanttRowType.DETAIL:
11955
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
11956
+ this.onKupClick(nativeEvent, KupPlannerTaskAction.onClick);
11586
11957
  }
11587
11958
  break;
11588
11959
  }
11589
11960
  }
11590
11961
  handleOnDateChange(nativeEvent) {
11591
11962
  if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_emitOnChangeEventsReceived).call(this, nativeEvent)) {
11592
- console.log('handleOnDateChange', nativeEvent);
11593
- this.onKupDateChange(nativeEvent);
11963
+ if (nativeEvent.rowType != KupPlannerGanttRowType.DETAIL) {
11964
+ console.log('kup-planner.handleOnDateChange', nativeEvent);
11965
+ this.onKupDateChange(nativeEvent, KupPlannerTaskAction.onResize);
11966
+ }
11594
11967
  }
11595
11968
  }
11596
11969
  componentWillLoad() {
@@ -11598,11 +11971,40 @@ const KupPlanner = class {
11598
11971
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.register(this);
11599
11972
  }
11600
11973
  componentDidLoad() {
11974
+ let details = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, this.detailData);
11975
+ if (details && details.length == 0) {
11976
+ details = undefined;
11977
+ }
11978
+ const mainFilter = this.rootElement.shadowRoot.querySelector('#main-filter');
11979
+ FTextFieldMDC(mainFilter);
11980
+ const secondaryFilter = this.rootElement.shadowRoot.querySelector('#secondary-filter');
11981
+ if (details) {
11982
+ FTextFieldMDC(secondaryFilter);
11983
+ }
11601
11984
  this.plannerProps = {
11602
- title: this.titleMess,
11603
- items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11604
- onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11605
- onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11985
+ mainGantt: {
11986
+ title: this.titleMess,
11987
+ items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11988
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
11989
+ filter: mainFilter,
11990
+ hideLabel: true,
11991
+ ganttHeight: this.taskHeight,
11992
+ showSecondaryDates: this.showSecondaryDates,
11993
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
11994
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11995
+ },
11996
+ secondaryGantt: details
11997
+ ? {
11998
+ title: '',
11999
+ items: details,
12000
+ stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
12001
+ filter: secondaryFilter,
12002
+ hideLabel: true,
12003
+ ganttHeight: this.detailHeight,
12004
+ onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
12005
+ onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
12006
+ }
12007
+ : undefined,
11606
12008
  };
11607
12009
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_renderReactPlannerElement).call(this);
11608
12010
  this.kupReady.emit({
@@ -11619,7 +12021,17 @@ const KupPlanner = class {
11619
12021
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logRender(this, true);
11620
12022
  }
11621
12023
  render() {
11622
- return (h(Host, null, h("div", { id: componentWrapperId })));
12024
+ var _a;
12025
+ //console.log('kup-planner.tsx render');
12026
+ return (h(Host, null, h("style", null, __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId, style: { maxWidth: this.maxWidth } }), h(FTextField, { icon: KupThemeIconValues.SEARCH, id: "main-filter", label: __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").language.translate(KupLanguageSearch.SEARCH), onKeyDown: (e) => {
12027
+ if (e.key === 'Enter') {
12028
+ __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_onFilter).call(this, e);
12029
+ }
12030
+ }, wrapperClass: "filter" }), ((_a = this.detailData) === null || _a === void 0 ? void 0 : _a.rows) && this.detailData.rows.length > 0 ? (h(FTextField, { icon: KupThemeIconValues.SEARCH, id: "secondary-filter", label: __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").language.translate(KupLanguageSearch.SEARCH), onKeyDown: (e) => {
12031
+ if (e.key === 'Enter') {
12032
+ __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_onFilter).call(this, e, true);
12033
+ }
12034
+ }, wrapperClass: "filter" })) : null));
11623
12035
  }
11624
12036
  disconnectedCallback() {
11625
12037
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.unregister(this);
@@ -11636,28 +12048,71 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11636
12048
  }
11637
12049
  }, _KupPlanner_toTasks = function _KupPlanner_toTasks(data) {
11638
12050
  var _a;
11639
- let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.map((row) => {
12051
+ 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) => {
12052
+ const datesSanitized = sanitizeAllDates(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]], row.cells[this.taskPrevDates[0]], row.cells[this.taskPrevDates[1]]);
12053
+ const valuesToShow = getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns);
11640
12054
  let task = {
11641
12055
  taskRow: row,
11642
12056
  taskRowId: row.id,
11643
12057
  id: row.cells[this.taskIdCol].value,
11644
12058
  name: row.cells[this.taskNameCol].value,
11645
- startDate: row.cells[this.taskDates[0]].value,
11646
- endDate: row.cells[this.taskDates[1]].value,
11647
- secondaryStartDate: row.cells[this.taskPrevDates[0]].value,
11648
- secondaryEndDate: row.cells[this.taskPrevDates[1]].value,
11649
- type: 'task',
11650
- valuesToShow: this.taskColumns.map((col) => row.cells[col].value),
12059
+ startDate: datesSanitized.dateValues[0],
12060
+ endDate: datesSanitized.dateValues[1],
12061
+ secondaryStartDate: datesSanitized.secDateValues[0],
12062
+ secondaryEndDate: datesSanitized.secDateValues[1],
12063
+ type: 'project',
12064
+ valuesToShow: valuesToShow,
12065
+ rowType: KupPlannerGanttRowType.TASK,
11651
12066
  };
11652
12067
  return task;
11653
12068
  });
11654
12069
  return tasks;
12070
+ }, _KupPlanner_toDetails = function _KupPlanner_toDetails(data) {
12071
+ let details = [];
12072
+ if (!data || !data.rows) {
12073
+ return details;
12074
+ }
12075
+ data.rows
12076
+ .filter((row) => isAtLeastOneDateValid(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]))
12077
+ .forEach((row) => {
12078
+ var _a, _b;
12079
+ const detailId = row.cells[this.detailIdCol].value;
12080
+ const detailNameId = row.cells[this.detailNameCol].value;
12081
+ const datesSanitized = sanitizeAllDates(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]);
12082
+ const valuesToShow = getValuesToShow(row, this.detailIdCol, this.detailNameCol, data.columns, this.detailColumns);
12083
+ let detail = details.find((det) => det.id == detailId);
12084
+ if (!detail) {
12085
+ detail = {
12086
+ id: detailId,
12087
+ name: detailNameId,
12088
+ type: 'timeline',
12089
+ valuesToShow: valuesToShow,
12090
+ rowType: KupPlannerGanttRowType.DETAIL,
12091
+ schedule: [],
12092
+ };
12093
+ details.push(detail);
12094
+ }
12095
+ detail.schedule.push({
12096
+ startDate: datesSanitized.dateValues[0],
12097
+ endDate: datesSanitized.dateValues[1],
12098
+ color: this.detailColorCol
12099
+ ? (_a = row.cells[this.detailColorCol].value) !== null && _a !== void 0 ? _a : '#D9D9D8'
12100
+ : '#D9D9D8',
12101
+ selectedColor: this.detailColorCol
12102
+ ? (_b = row.cells[this.detailColorCol].value) !== null && _b !== void 0 ? _b : '#D9D9D8'
12103
+ : '#D9D9D8',
12104
+ });
12105
+ });
12106
+ return details;
11655
12107
  }, _KupPlanner_getTask = function _KupPlanner_getTask(taskId) {
11656
- return this.plannerProps.items.find((task) => task.id == taskId);
12108
+ return this.plannerProps.mainGantt.items.find((task) => task.id == taskId);
11657
12109
  }, _KupPlanner_removePhases = function _KupPlanner_removePhases(taskId) {
11658
12110
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11659
12111
  if (task)
11660
12112
  task.phases = undefined;
12113
+ // this.plannerProps.mainGantt = JSON.parse(
12114
+ // JSON.stringify(this.plannerProps.mainGantt)
12115
+ // );
11661
12116
  this.plannerProps = Object.assign({}, this.plannerProps);
11662
12117
  }, _KupPlanner_handleOnClickOnTask = function _KupPlanner_handleOnClickOnTask(nativeEvent) {
11663
12118
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, nativeEvent.id);
@@ -11667,6 +12122,8 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11667
12122
  return true;
11668
12123
  }, _KupPlanner_handleOnClickOnPhase = function _KupPlanner_handleOnClickOnPhase() {
11669
12124
  return true;
12125
+ }, _KupPlanner_handleOnClickOnDetail = function _KupPlanner_handleOnClickOnDetail() {
12126
+ return true;
11670
12127
  }, _KupPlanner_emitOnChangeEventsReceived = function _KupPlanner_emitOnChangeEventsReceived(nativeEvent) {
11671
12128
  let emitEvent = false;
11672
12129
  if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f")) {
@@ -11678,6 +12135,34 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
11678
12135
  emitEvent = true;
11679
12136
  }
11680
12137
  return emitEvent;
12138
+ }, _KupPlanner_onFilter = function _KupPlanner_onFilter(e, isDetail) {
12139
+ const tempData = {
12140
+ columns: this.data.columns,
12141
+ rows: [],
12142
+ };
12143
+ const value = e.target.value;
12144
+ const data = isDetail ? this.detailData : this.data;
12145
+ for (let index = 0; index < data.rows.length; index++) {
12146
+ const row = data.rows[index];
12147
+ const valuesToShow = isDetail
12148
+ ? getValuesToShow(row, this.detailIdCol, this.detailNameCol, data.columns, this.detailColumns)
12149
+ : getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns);
12150
+ for (let index = 0; index < valuesToShow.length; index++) {
12151
+ const valueToShow = valuesToShow[index];
12152
+ if (valueToShow.toLowerCase().indexOf(value.toLowerCase()) > -1) {
12153
+ tempData.rows.push(row);
12154
+ break;
12155
+ }
12156
+ }
12157
+ }
12158
+ const newGantt = isDetail
12159
+ ? {
12160
+ secondaryGantt: Object.assign(Object.assign({}, this.plannerProps.secondaryGantt), { items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, tempData) }),
12161
+ }
12162
+ : {
12163
+ mainGantt: Object.assign(Object.assign({}, this.plannerProps.mainGantt), { items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, tempData) }),
12164
+ };
12165
+ this.plannerProps = Object.assign(Object.assign({}, this.plannerProps), newGantt);
11681
12166
  };
11682
12167
  KupPlanner.style = kupPlannerCss;
11683
12168