@sme.up/ketchup 7.4.2 → 8.0.0

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 (160) hide show
  1. package/dist/cjs/{component-72a5b626.js → component-85c2bd4d.js} +1 -1
  2. package/dist/cjs/{f-button-daddd700.js → f-button-49b2c37c.js} +1 -1
  3. package/dist/cjs/{f-cell-3682fad4.js → f-cell-9a6bc55c.js} +4 -4
  4. package/dist/cjs/{f-chip-9d540d94.js → f-chip-dee84122.js} +2 -2
  5. package/dist/cjs/{f-image-7b42d149.js → f-image-27f965ff.js} +4 -4
  6. package/dist/cjs/{f-paginator-utils-1baeba0f.js → f-paginator-utils-4a30189d.js} +2 -2
  7. package/dist/cjs/{f-text-field-a6ed2d22.js → f-text-field-04a663b4.js} +1 -1
  8. package/dist/cjs/{f-text-field-mdc-85997738.js → f-text-field-mdc-0e22f3e3.js} +2 -2
  9. package/dist/cjs/ketchup.cjs.js +2 -2
  10. package/dist/cjs/kup-accordion.cjs.entry.js +4 -4
  11. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +814 -819
  12. package/dist/cjs/kup-box.cjs.entry.js +10 -10
  13. package/dist/cjs/kup-calendar.cjs.entry.js +5 -5
  14. package/dist/cjs/kup-cell.cjs.entry.js +5 -5
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +1 -1
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +1 -1
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +7 -10
  18. package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
  19. package/dist/cjs/kup-echart.cjs.entry.js +25 -8
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +8 -19
  21. package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
  22. package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
  23. package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
  24. package/dist/cjs/kup-magic-box.cjs.entry.js +2 -2
  25. package/dist/cjs/{kup-manager-10351449.js → kup-manager-2ff5d258.js} +80 -1
  26. package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
  27. package/dist/cjs/kup-numeric-picker.cjs.entry.js +5 -5
  28. package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
  29. package/dist/cjs/kup-planner.cjs.entry.js +1127 -218
  30. package/dist/cjs/kup-probe.cjs.entry.js +1 -1
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
  33. package/dist/cjs/loader.cjs.js +2 -2
  34. package/dist/cjs/{tslib.es6-0ee02c67.js → tslib.es6-386654de.js} +9 -5
  35. package/dist/collection/collection-manifest.json +1 -1
  36. package/dist/collection/components/kup-card/kup-card.css +4 -8
  37. package/dist/collection/components/kup-chip/kup-chip.js +4 -3
  38. package/dist/collection/components/kup-dashboard/kup-dashboard.js +0 -3
  39. package/dist/collection/components/kup-data-table/kup-data-table.css +3 -6
  40. package/dist/collection/components/kup-data-table/kup-data-table.js +6 -20
  41. package/dist/collection/components/kup-echart/kup-echart-declarations.js +2 -0
  42. package/dist/collection/components/kup-echart/kup-echart.js +23 -8
  43. package/dist/collection/components/kup-family-tree/kup-family-tree.css +2 -2
  44. package/dist/collection/components/kup-family-tree/kup-family-tree.js +4 -15
  45. package/dist/collection/components/kup-image/kup-image.js +28 -0
  46. package/dist/collection/components/kup-list/kup-list.css +1 -1
  47. package/dist/collection/components/kup-planner/kup-planner-declarations.js +5 -2
  48. package/dist/collection/components/kup-planner/kup-planner.css +6 -3
  49. package/dist/collection/components/kup-planner/kup-planner.js +347 -65
  50. package/dist/collection/components/kup-qlik/kup-qlik.css +4 -8
  51. package/dist/collection/components/kup-snackbar/kup-snackbar.css +4 -3
  52. package/dist/collection/components/kup-spinner/kup-spinner.css +2 -4
  53. package/dist/collection/components/kup-tree/kup-tree.js +66 -67
  54. package/dist/collection/f-components/f-image/f-image.js +3 -3
  55. package/dist/collection/managers/kup-data/kup-data-column-helper.js +1 -0
  56. package/dist/collection/managers/kup-manager/kup-manager.js +18 -0
  57. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +1 -0
  58. package/dist/collection/types/GenericTypes.js +1 -0
  59. package/dist/components/kup-autocomplete2.js +228 -151
  60. package/dist/components/kup-dashboard.js +0 -3
  61. package/dist/components/kup-echart2.js +24 -7
  62. package/dist/components/kup-family-tree.js +5 -16
  63. package/dist/components/kup-planner.js +1127 -219
  64. package/dist/components/kup-progress-bar.js +1 -1
  65. package/dist/components/kup-qlik.js +1 -1
  66. package/dist/components/kup-radio.js +1 -1
  67. package/dist/components/kup-rating.js +1 -1
  68. package/dist/components/kup-snackbar.js +1 -1
  69. package/dist/components/kup-spinner.js +1 -1
  70. package/dist/components/kup-switch.js +1 -1
  71. package/dist/components/kup-tab-bar.js +1 -1
  72. package/dist/components/kup-text-field.js +1 -1
  73. package/dist/components/kup-time-picker.js +1 -1
  74. package/dist/components/kup-tree.js +1 -1
  75. package/dist/esm/{component-b1bedf1d.js → component-120651a0.js} +1 -1
  76. package/dist/esm/{f-button-8d15b5a0.js → f-button-744cf1f6.js} +1 -1
  77. package/dist/esm/{f-cell-7b706e57.js → f-cell-b319c869.js} +4 -4
  78. package/dist/esm/{f-chip-c671fe90.js → f-chip-7e3e4180.js} +2 -2
  79. package/dist/esm/{f-image-21451b15.js → f-image-098c26ce.js} +4 -4
  80. package/dist/esm/{f-paginator-utils-92bbf277.js → f-paginator-utils-674cb2ae.js} +2 -2
  81. package/dist/esm/{f-text-field-0bb2d109.js → f-text-field-c38ef113.js} +1 -1
  82. package/dist/esm/{f-text-field-mdc-d42d3f9e.js → f-text-field-mdc-cee583ea.js} +2 -2
  83. package/dist/esm/ketchup.js +2 -2
  84. package/dist/esm/kup-accordion.entry.js +4 -4
  85. package/dist/esm/kup-autocomplete_27.entry.js +814 -819
  86. package/dist/esm/kup-box.entry.js +10 -10
  87. package/dist/esm/kup-calendar.entry.js +5 -5
  88. package/dist/esm/kup-cell.entry.js +5 -5
  89. package/dist/esm/kup-dash-list.entry.js +1 -1
  90. package/dist/esm/kup-dash_2.entry.js +1 -1
  91. package/dist/esm/kup-dashboard.entry.js +7 -10
  92. package/dist/esm/kup-drawer.entry.js +1 -1
  93. package/dist/esm/kup-echart.entry.js +25 -8
  94. package/dist/esm/kup-family-tree.entry.js +8 -19
  95. package/dist/esm/kup-iframe.entry.js +1 -1
  96. package/dist/esm/kup-image-list.entry.js +8 -8
  97. package/dist/esm/kup-lazy.entry.js +1 -1
  98. package/dist/esm/kup-magic-box.entry.js +2 -2
  99. package/dist/esm/{kup-manager-6145d980.js → kup-manager-b41eb2a8.js} +80 -2
  100. package/dist/esm/kup-nav-bar.entry.js +1 -1
  101. package/dist/esm/kup-numeric-picker.entry.js +5 -5
  102. package/dist/esm/kup-photo-frame.entry.js +1 -1
  103. package/dist/esm/kup-planner.entry.js +1128 -219
  104. package/dist/esm/kup-probe.entry.js +1 -1
  105. package/dist/esm/kup-qlik.entry.js +2 -2
  106. package/dist/esm/kup-snackbar.entry.js +4 -4
  107. package/dist/esm/loader.js +2 -2
  108. package/dist/esm/{tslib.es6-3eea2234.js → tslib.es6-8c2af864.js} +9 -5
  109. package/dist/ketchup/ketchup.esm.js +1 -1
  110. package/dist/ketchup/{p-439ac105.entry.js → p-0b0b61cb.entry.js} +1 -1
  111. package/dist/ketchup/p-0b91f5f8.entry.js +1 -0
  112. package/dist/ketchup/{p-81605f08.js → p-10d84b1b.js} +1 -1
  113. package/dist/ketchup/{p-a203f78b.js → p-27a56c87.js} +1 -1
  114. package/dist/ketchup/{p-32517a99.entry.js → p-395e1960.entry.js} +1 -1
  115. package/dist/ketchup/{p-76bf53df.entry.js → p-3b41aca7.entry.js} +1 -1
  116. package/dist/ketchup/{p-4d039705.entry.js → p-3efe7f43.entry.js} +1 -1
  117. package/dist/ketchup/{p-a641780a.entry.js → p-4325d965.entry.js} +1 -1
  118. package/dist/ketchup/{p-2915a66a.entry.js → p-4ae2ca6f.entry.js} +1 -1
  119. package/dist/ketchup/{p-e4975ffa.entry.js → p-5ce2b4fc.entry.js} +1 -1
  120. package/dist/ketchup/p-5d398e42.js +1 -0
  121. package/dist/ketchup/{p-7cfdce27.js → p-77e3d537.js} +1 -1
  122. package/dist/ketchup/p-7f59211b.js +1 -0
  123. package/dist/ketchup/p-940a5feb.js +30 -0
  124. package/dist/ketchup/{p-826c91d7.js → p-9700eb32.js} +1 -1
  125. package/dist/ketchup/p-a7e19620.entry.js +39 -0
  126. package/dist/ketchup/p-a877a87b.entry.js +9 -0
  127. package/dist/ketchup/p-a9b7533b.entry.js +25 -0
  128. package/dist/ketchup/{p-89ac80c1.entry.js → p-af82131e.entry.js} +1 -1
  129. package/dist/ketchup/{p-da37c417.entry.js → p-b032f47d.entry.js} +1 -1
  130. package/dist/ketchup/{p-0c1cbf8b.entry.js → p-b244f5ca.entry.js} +1 -1
  131. package/dist/ketchup/{p-2a2dc2a8.entry.js → p-bb17c1ba.entry.js} +1 -1
  132. package/dist/ketchup/{p-0c9b7c80.entry.js → p-bd42562d.entry.js} +1 -1
  133. package/dist/ketchup/{p-849ad5d8.entry.js → p-c8b7790a.entry.js} +1 -1
  134. package/dist/ketchup/{p-c022824e.entry.js → p-c968e93d.entry.js} +1 -1
  135. package/dist/ketchup/{p-1242366a.entry.js → p-d739710a.entry.js} +1 -1
  136. package/dist/ketchup/{p-ae4fffe0.js → p-d98fdb9b.js} +1 -1
  137. package/dist/ketchup/{p-c222d070.entry.js → p-da891093.entry.js} +1 -1
  138. package/dist/ketchup/{p-281cff81.entry.js → p-df316daf.entry.js} +1 -1
  139. package/dist/ketchup/{p-d87fb5ff.entry.js → p-e02b5141.entry.js} +1 -1
  140. package/dist/ketchup/{p-ea16ddc0.js → p-e714f4dc.js} +1 -1
  141. package/dist/ketchup/{p-c4d9e3e2.js → p-ef614656.js} +1 -1
  142. package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +2 -0
  143. package/dist/types/components/kup-image/kup-image.d.ts +2 -0
  144. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +18 -3
  145. package/dist/types/components/kup-planner/kup-planner.d.ts +36 -11
  146. package/dist/types/components/kup-tree/kup-tree.d.ts +1 -5
  147. package/dist/types/components.d.ts +39 -4
  148. package/dist/types/f-components/f-image/f-image-declarations.d.ts +1 -0
  149. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +1 -1
  150. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +1 -0
  151. package/dist/types/managers/kup-manager/kup-manager.d.ts +7 -0
  152. package/dist/types/types/GenericTypes.d.ts +1 -0
  153. package/package.json +8 -20
  154. package/dist/ketchup/p-02a26d59.entry.js +0 -9
  155. package/dist/ketchup/p-462475ac.entry.js +0 -10
  156. package/dist/ketchup/p-5292ef67.js +0 -30
  157. package/dist/ketchup/p-79b0730b.js +0 -15
  158. package/dist/ketchup/p-9f00ad0f.js +0 -1
  159. package/dist/ketchup/p-be61dd36.entry.js +0 -39
  160. package/dist/ketchup/p-e83e70e2.entry.js +0 -1
@@ -3,8 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-74433248.js');
6
- const kupManager$1 = require('./kup-manager-10351449.js');
6
+ const kupManager$1 = require('./kup-manager-2ff5d258.js');
7
7
  const GenericVariables = require('./GenericVariables-a9ed17ee.js');
8
+ const fTextField = require('./f-text-field-04a663b4.js');
9
+ const fTextFieldMdc = require('./f-text-field-mdc-0e22f3e3.js');
10
+ require('./tslib.es6-386654de.js');
11
+ require('./component-85c2bd4d.js');
8
12
 
9
13
  /**
10
14
  * Props of the kup-gantt component.
@@ -42,8 +46,11 @@ var KupPlannerProps;
42
46
  })(KupPlannerProps || (KupPlannerProps = {}));
43
47
  var KupPlannerTaskAction;
44
48
  (function (KupPlannerTaskAction) {
45
- KupPlannerTaskAction["onOpening"] = "onOpening";
46
- KupPlannerTaskAction["onClosing"] = "onClosing";
49
+ KupPlannerTaskAction["onTaskOpening"] = "onTaskOpening";
50
+ KupPlannerTaskAction["onTaskClosing"] = "onTaskClosing";
51
+ KupPlannerTaskAction["onClick"] = "onClick";
52
+ KupPlannerTaskAction["onResize"] = "onResize";
53
+ KupPlannerTaskAction["onRightClick"] = "onRightClick";
47
54
  })(KupPlannerTaskAction || (KupPlannerTaskAction = {}));
48
55
  var KupPlannerGanttRowType;
49
56
  (function (KupPlannerGanttRowType) {
@@ -8367,6 +8374,545 @@ exports.Zone = Zone;
8367
8374
  //# sourceMappingURL=luxon.js.map
8368
8375
  });
8369
8376
 
8377
+ var hexToCssFilter = kupManager$1.createCommonjsModule(function (module, exports) {
8378
+ (function (global, factory) {
8379
+ factory(exports) ;
8380
+ }(kupManager$1.commonjsGlobal, (function (exports) {
8381
+ /*! *****************************************************************************
8382
+ Copyright (c) Microsoft Corporation.
8383
+
8384
+ Permission to use, copy, modify, and/or distribute this software for any
8385
+ purpose with or without fee is hereby granted.
8386
+
8387
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8388
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8389
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
8390
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
8391
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
8392
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
8393
+ PERFORMANCE OF THIS SOFTWARE.
8394
+ ***************************************************************************** */
8395
+
8396
+ function __read(o, n) {
8397
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
8398
+ if (!m) return o;
8399
+ var i = m.call(o), r, ar = [], e;
8400
+ try {
8401
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8402
+ }
8403
+ catch (error) { e = { error: error }; }
8404
+ finally {
8405
+ try {
8406
+ if (r && !r.done && (m = i["return"])) m.call(i);
8407
+ }
8408
+ finally { if (e) throw e.error; }
8409
+ }
8410
+ return ar;
8411
+ }
8412
+
8413
+ var Color = /** @class */ (function () {
8414
+ function Color(r, g, b) {
8415
+ this.r = 0;
8416
+ this.g = 0;
8417
+ this.b = 0;
8418
+ this.set(r, g, b);
8419
+ }
8420
+ Color.prototype.set = function (r, g, b) {
8421
+ this.r = this.clamp(r);
8422
+ this.g = this.clamp(g);
8423
+ this.b = this.clamp(b);
8424
+ };
8425
+ /**
8426
+ * Applying cals to get CSS filter for hue-rotate
8427
+ *
8428
+ * @param {number} [angle=0]
8429
+ * @memberof Color
8430
+ */
8431
+ Color.prototype.hueRotate = function (angle) {
8432
+ if (angle === void 0) { angle = 0; }
8433
+ angle = (angle / 180) * Math.PI;
8434
+ var sin = Math.sin(angle);
8435
+ var cos = Math.cos(angle);
8436
+ this.multiply([
8437
+ 0.213 + cos * 0.787 - sin * 0.213,
8438
+ 0.715 - cos * 0.715 - sin * 0.715,
8439
+ 0.072 - cos * 0.072 + sin * 0.928,
8440
+ 0.213 - cos * 0.213 + sin * 0.143,
8441
+ 0.715 + cos * 0.285 + sin * 0.14,
8442
+ 0.072 - cos * 0.072 - sin * 0.283,
8443
+ 0.213 - cos * 0.213 - sin * 0.787,
8444
+ 0.715 - cos * 0.715 + sin * 0.715,
8445
+ 0.072 + cos * 0.928 + sin * 0.072,
8446
+ ]);
8447
+ };
8448
+ /**
8449
+ * Applying cals to get CSS filter for grayscale
8450
+ *
8451
+ * @param {number} [value=1]
8452
+ * @memberof Color
8453
+ */
8454
+ Color.prototype.grayscale = function (value) {
8455
+ if (value === void 0) { value = 1; }
8456
+ this.multiply([
8457
+ 0.2126 + 0.7874 * (1 - value),
8458
+ 0.7152 - 0.7152 * (1 - value),
8459
+ 0.0722 - 0.0722 * (1 - value),
8460
+ 0.2126 - 0.2126 * (1 - value),
8461
+ 0.7152 + 0.2848 * (1 - value),
8462
+ 0.0722 - 0.0722 * (1 - value),
8463
+ 0.2126 - 0.2126 * (1 - value),
8464
+ 0.7152 - 0.7152 * (1 - value),
8465
+ 0.0722 + 0.9278 * (1 - value),
8466
+ ]);
8467
+ };
8468
+ /**
8469
+ * Applying cals to get CSS filter for sepia
8470
+ *
8471
+ * @param {number} [value=1]
8472
+ * @memberof Color
8473
+ */
8474
+ Color.prototype.sepia = function (value) {
8475
+ if (value === void 0) { value = 1; }
8476
+ this.multiply([
8477
+ 0.393 + 0.607 * (1 - value),
8478
+ 0.769 - 0.769 * (1 - value),
8479
+ 0.189 - 0.189 * (1 - value),
8480
+ 0.349 - 0.349 * (1 - value),
8481
+ 0.686 + 0.314 * (1 - value),
8482
+ 0.168 - 0.168 * (1 - value),
8483
+ 0.272 - 0.272 * (1 - value),
8484
+ 0.534 - 0.534 * (1 - value),
8485
+ 0.131 + 0.869 * (1 - value),
8486
+ ]);
8487
+ };
8488
+ /**
8489
+ * Applying cals to get CSS filter for saturate
8490
+ *
8491
+ * @param {number} [value=1]
8492
+ * @memberof Color
8493
+ */
8494
+ Color.prototype.saturate = function (value) {
8495
+ if (value === void 0) { value = 1; }
8496
+ this.multiply([
8497
+ 0.213 + 0.787 * value,
8498
+ 0.715 - 0.715 * value,
8499
+ 0.072 - 0.072 * value,
8500
+ 0.213 - 0.213 * value,
8501
+ 0.715 + 0.285 * value,
8502
+ 0.072 - 0.072 * value,
8503
+ 0.213 - 0.213 * value,
8504
+ 0.715 - 0.715 * value,
8505
+ 0.072 + 0.928 * value,
8506
+ ]);
8507
+ };
8508
+ Color.prototype.multiply = function (matrix) {
8509
+ // These values are needed. It's correct because the returned values will change
8510
+ var newR = this.clamp(this.r * matrix[0] + this.g * matrix[1] + this.b * matrix[2]);
8511
+ var newG = this.clamp(this.r * matrix[3] + this.g * matrix[4] + this.b * matrix[5]);
8512
+ var newB = this.clamp(this.r * matrix[6] + this.g * matrix[7] + this.b * matrix[8]);
8513
+ this.r = newR;
8514
+ this.g = newG;
8515
+ this.b = newB;
8516
+ };
8517
+ /**
8518
+ * Applying cals to get CSS filter for brightness
8519
+ *
8520
+ * @param {number} [value=1]
8521
+ * @memberof Color
8522
+ */
8523
+ Color.prototype.brightness = function (value) {
8524
+ if (value === void 0) { value = 1; }
8525
+ this.linear(value);
8526
+ };
8527
+ /**
8528
+ * Applying cals to get CSS filter for contrast
8529
+ *
8530
+ * @param {number} [value=1]
8531
+ * @memberof Color
8532
+ */
8533
+ Color.prototype.contrast = function (value) {
8534
+ if (value === void 0) { value = 1; }
8535
+ this.linear(value, -(0.5 * value) + 0.5);
8536
+ };
8537
+ Color.prototype.linear = function (slope, intercept) {
8538
+ if (slope === void 0) { slope = 1; }
8539
+ if (intercept === void 0) { intercept = 0; }
8540
+ this.r = this.clamp(this.r * slope + intercept * 255);
8541
+ this.g = this.clamp(this.g * slope + intercept * 255);
8542
+ this.b = this.clamp(this.b * slope + intercept * 255);
8543
+ };
8544
+ /**
8545
+ * Applying cals to get CSS filter for invert
8546
+ *
8547
+ * @param {number} [value=1]
8548
+ * @memberof Color
8549
+ */
8550
+ Color.prototype.invert = function (value) {
8551
+ if (value === void 0) { value = 1; }
8552
+ this.r = this.clamp((value + (this.r / 255) * (1 - 2 * value)) * 255);
8553
+ this.g = this.clamp((value + (this.g / 255) * (1 - 2 * value)) * 255);
8554
+ this.b = this.clamp((value + (this.b / 255) * (1 - 2 * value)) * 255);
8555
+ };
8556
+ /**
8557
+ * transform RGB into HSL values
8558
+ *
8559
+ * @returns {HSLData}
8560
+ * @memberof Color
8561
+ */
8562
+ Color.prototype.hsl = function () {
8563
+ var red = this.r / 255;
8564
+ var green = this.g / 255;
8565
+ var blue = this.b / 255;
8566
+ // find greatest and smallest channel values
8567
+ var max = Math.max(red, green, blue);
8568
+ var min = Math.min(red, green, blue);
8569
+ var hue = 0;
8570
+ var saturation = 0;
8571
+ var lightness = (max + min) / 2;
8572
+ // If min and max have the same values, it means
8573
+ // the given color is achromatic
8574
+ if (max === min) {
8575
+ return {
8576
+ h: 0,
8577
+ s: 0,
8578
+ l: lightness * 100,
8579
+ };
8580
+ }
8581
+ // Adding delta value of greatest and smallest channel values
8582
+ var delta = max - min;
8583
+ saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
8584
+ if (max === red) {
8585
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
8586
+ }
8587
+ else if (max === green) {
8588
+ hue = (blue - red) / delta + 2;
8589
+ }
8590
+ else if (max === blue) {
8591
+ hue = (red - green) / delta + 4;
8592
+ }
8593
+ hue /= 6;
8594
+ return {
8595
+ h: hue * 100,
8596
+ s: saturation * 100,
8597
+ l: lightness * 100,
8598
+ };
8599
+ };
8600
+ /**
8601
+ * Normalize the value to follow the min and max for RGB colors
8602
+ * min: 0
8603
+ * max: 255
8604
+ *
8605
+ * @private
8606
+ * @param {number} value
8607
+ * @returns {number}
8608
+ * @memberof Color
8609
+ */
8610
+ Color.prototype.clamp = function (value) {
8611
+ // Minimum RGB Value = 0;
8612
+ // Maximum RGB Value = 255;
8613
+ return Math.min(Math.max(value, 0), 255);
8614
+ };
8615
+ return Color;
8616
+ }());
8617
+
8618
+ var Solver = /** @class */ (function () {
8619
+ function Solver(target, options) {
8620
+ this.target = target;
8621
+ this.targetHSL = target.hsl();
8622
+ this.options = Object.assign({},
8623
+ // Adding default values for options
8624
+ {
8625
+ acceptanceLossPercentage: 5,
8626
+ maxChecks: 15,
8627
+ }, options);
8628
+ // All the calcs done by the library to generate
8629
+ // a CSS Filter are based on the color `#000`
8630
+ // in this case, `rgb(0, 0, 0)`
8631
+ // Please make sure the background of the element
8632
+ // is `#000` for better performance
8633
+ // and color similarity.
8634
+ this.reusedColor = new Color(0, 0, 0);
8635
+ }
8636
+ /**
8637
+ * Returns the solved values for the
8638
+ *
8639
+ * @returns {(SPSAPayload & { filter: string; })}
8640
+ * @memberof Solver
8641
+ */
8642
+ Solver.prototype.solve = function () {
8643
+ var result = this.solveNarrow(this.solveWide());
8644
+ return {
8645
+ values: result.values,
8646
+ called: result.called,
8647
+ loss: result.loss,
8648
+ filter: this.css(result.values),
8649
+ };
8650
+ };
8651
+ /**
8652
+ * Solve wide values based on the wide values for RGB and HSL values
8653
+ *
8654
+ * @private
8655
+ * @returns {SPSAPayload}
8656
+ * @memberof Solver
8657
+ */
8658
+ Solver.prototype.solveWide = function () {
8659
+ var A = 5;
8660
+ var c = 15;
8661
+ // Wide values for RGB and HSL values
8662
+ // the values in the order: [`r`, `g`, `b`, `h`, `s`, `l`]
8663
+ var a = [60, 180, 18000, 600, 1.2, 1.2];
8664
+ var best = { loss: Infinity };
8665
+ var counter = 0;
8666
+ while (best.loss > this.options.acceptanceLossPercentage) {
8667
+ var initialFilterValues = [50, 20, 3750, 50, 100, 100];
8668
+ var result = this.spsa({
8669
+ A: A,
8670
+ a: a,
8671
+ c: c,
8672
+ values: initialFilterValues,
8673
+ // for wide values we should use the double of tries in
8674
+ // comparison of `solveNarrow()` method
8675
+ maxTriesInLoop: 1000,
8676
+ });
8677
+ if (result.loss < best.loss) {
8678
+ best = result;
8679
+ }
8680
+ counter += 1;
8681
+ if (counter >= this.options.maxChecks) {
8682
+ break;
8683
+ }
8684
+ }
8685
+ return Object.assign({}, best, { called: counter });
8686
+ };
8687
+ /**
8688
+ * Solve narrow values based on the wide values for the filter
8689
+ *
8690
+ * @private
8691
+ * @param {SPSAPayload} wide
8692
+ * @returns {SPSAPayload}
8693
+ * @memberof Solver
8694
+ */
8695
+ Solver.prototype.solveNarrow = function (wide) {
8696
+ var A = wide.loss;
8697
+ var c = 2;
8698
+ var A1 = A + 1;
8699
+ // Narrow values for RGB and HSL values
8700
+ // the values in the order: [`r`, `g`, `b`, `h`, `s`, `l`]
8701
+ var a = [0.25 * A1, 0.25 * A1, A1, 0.25 * A1, 0.2 * A1, 0.2 * A1];
8702
+ return this.spsa({
8703
+ A: A,
8704
+ a: a,
8705
+ c: c,
8706
+ values: wide.values,
8707
+ maxTriesInLoop: 500,
8708
+ called: wide.called,
8709
+ });
8710
+ };
8711
+ /**
8712
+ * Returns final value based on the current filter order
8713
+ * to get the order, please check the returned value
8714
+ * in `css()` method
8715
+ *
8716
+ * @private
8717
+ * @param {number} value
8718
+ * @param {number} idx
8719
+ * @returns {number}
8720
+ * @memberof Solver
8721
+ */
8722
+ Solver.prototype.fixValueByFilterIDX = function (value, idx) {
8723
+ var max = 100;
8724
+ // Fixing max, minimum and value by filter
8725
+ if (idx === 2 /* saturate */) {
8726
+ max = 7500;
8727
+ }
8728
+ else if (idx === 4 /* brightness */ || idx === 5 /* contrast */) {
8729
+ max = 200;
8730
+ }
8731
+ if (idx === 3 /* hue-rotate */) {
8732
+ if (value > max) {
8733
+ value %= max;
8734
+ }
8735
+ else if (value < 0) {
8736
+ value = max + (value % max);
8737
+ }
8738
+ }
8739
+ // Checking if value is below the minimum or above
8740
+ // the maximum allowed by filter
8741
+ else if (value < 0) {
8742
+ value = 0;
8743
+ }
8744
+ else if (value > max) {
8745
+ value = max;
8746
+ }
8747
+ return value;
8748
+ };
8749
+ Solver.prototype.spsa = function (_a) {
8750
+ var A = _a.A, a = _a.a, c = _a.c, values = _a.values, _b = _a.maxTriesInLoop, maxTriesInLoop = _b === void 0 ? 500 : _b, _c = _a.called, called = _c === void 0 ? 0 : _c;
8751
+ var alpha = 1;
8752
+ var gamma = 0.16666666666666666;
8753
+ var best = null;
8754
+ var bestLoss = Infinity;
8755
+ var deltas = new Array(6);
8756
+ var highArgs = new Array(6);
8757
+ var lowArgs = new Array(6);
8758
+ // Size of all CSS filters to be applied to get the correct color
8759
+ var filtersToBeAppliedSize = 6;
8760
+ for (var key = 0; key < maxTriesInLoop; key++) {
8761
+ var ck = c / Math.pow(key + 1, gamma);
8762
+ for (var i = 0; i < filtersToBeAppliedSize; i++) {
8763
+ deltas[i] = Math.random() > 0.5 ? 1 : -1;
8764
+ highArgs[i] = values[i] + ck * deltas[i];
8765
+ lowArgs[i] = values[i] - ck * deltas[i];
8766
+ }
8767
+ var lossDiff = this.loss(highArgs) - this.loss(lowArgs);
8768
+ for (var i = 0; i < filtersToBeAppliedSize; i++) {
8769
+ var g = (lossDiff / (2 * ck)) * deltas[i];
8770
+ var ak = a[i] / Math.pow(A + key + 1, alpha);
8771
+ values[i] = this.fixValueByFilterIDX(values[i] - ak * g, i);
8772
+ }
8773
+ var loss = this.loss(values);
8774
+ if (loss < bestLoss) {
8775
+ best = values.slice(0);
8776
+ bestLoss = loss;
8777
+ }
8778
+ }
8779
+ return { values: best, loss: bestLoss, called: called };
8780
+ };
8781
+ /**
8782
+ * Checks how much is the loss for the filter in RGB and HSL colors
8783
+ *
8784
+ * @private
8785
+ * @param {SPSAPayload['values']} filters
8786
+ * @returns {number}
8787
+ * @memberof Solver
8788
+ */
8789
+ Solver.prototype.loss = function (filters) {
8790
+ // Argument as an Array of percentages.
8791
+ var color = this.reusedColor;
8792
+ // Resetting the color to black in case
8793
+ // it was called more than once
8794
+ color.set(0, 0, 0);
8795
+ color.invert(filters[0] / 100);
8796
+ color.sepia(filters[1] / 100);
8797
+ color.saturate(filters[2] / 100);
8798
+ color.hueRotate(filters[3] * 3.6);
8799
+ color.brightness(filters[4] / 100);
8800
+ color.contrast(filters[5] / 100);
8801
+ var colorHSL = color.hsl();
8802
+ return (Math.abs(color.r - this.target.r) +
8803
+ Math.abs(color.g - this.target.g) +
8804
+ Math.abs(color.b - this.target.b) +
8805
+ Math.abs(colorHSL.h - this.targetHSL.h) +
8806
+ Math.abs(colorHSL.s - this.targetHSL.s) +
8807
+ Math.abs(colorHSL.l - this.targetHSL.l));
8808
+ };
8809
+ /**
8810
+ * Returns the CSS filter list for the received HEX color
8811
+ *
8812
+ * @private
8813
+ * @param {number[]} filters
8814
+ * @returns {string}
8815
+ * @memberof Solver
8816
+ */
8817
+ Solver.prototype.css = function (filters) {
8818
+ var formatCssFilterValueByMultiplier = function (idx, multiplier) {
8819
+ if (multiplier === void 0) { multiplier = 1; }
8820
+ return Math.round(filters[idx] * multiplier);
8821
+ };
8822
+ return [
8823
+ "invert(" + formatCssFilterValueByMultiplier(0) + "%)",
8824
+ "sepia(" + formatCssFilterValueByMultiplier(1) + "%)",
8825
+ "saturate(" + formatCssFilterValueByMultiplier(2) + "%)",
8826
+ "hue-rotate(" + formatCssFilterValueByMultiplier(3, 3.6) + "deg)",
8827
+ "brightness(" + formatCssFilterValueByMultiplier(4) + "%)",
8828
+ "contrast(" + formatCssFilterValueByMultiplier(5) + "%);",
8829
+ ].join(' ');
8830
+ };
8831
+ return Solver;
8832
+ }());
8833
+
8834
+ /**
8835
+ * Transform a CSS Color from Hexadecimal to RGB color
8836
+ *
8837
+ * @param {string} hex hexadecimal color
8838
+ * @returns {([number, number, number] | [])} array with the RGB colors or empty array
8839
+ */
8840
+ var hexToRgb = function (hex) {
8841
+ if (hex.length === 4) {
8842
+ return [parseInt("0x" + hex[1] + hex[1]), parseInt("0x" + hex[2] + hex[2]), parseInt("0x" + hex[3] + hex[3])];
8843
+ }
8844
+ if (hex.length === 7) {
8845
+ return [parseInt("0x" + hex[1] + hex[2]), parseInt("0x" + hex[3] + hex[4]), parseInt("0x" + hex[5] + hex[6])];
8846
+ }
8847
+ return [];
8848
+ };
8849
+ var isNumeric = function (n) { return !isNaN(parseFloat(n)) && isFinite(n); };
8850
+ // Memory cache for the computed results to avoid multiple
8851
+ // calculations for the same color
8852
+ var results = {};
8853
+ /**
8854
+ * A function that transforms a HEX color into CSS filters
8855
+ *
8856
+ * @param colorValue string hexadecimal color
8857
+ * @param opts HexToCssConfiguration function configuration
8858
+ *
8859
+ */
8860
+ var hexToCSSFilter = function (colorValue, opts) {
8861
+ var _a;
8862
+ if (opts === void 0) { opts = {}; }
8863
+ var red;
8864
+ var green;
8865
+ var blue;
8866
+ if (results[colorValue] && !opts.forceFilterRecalculation) {
8867
+ return Object.assign({}, results[colorValue], { cache: true });
8868
+ }
8869
+ var color;
8870
+ try {
8871
+ _a = __read(hexToRgb(colorValue), 3), red = _a[0], green = _a[1], blue = _a[2];
8872
+ if (!isNumeric(red) || !isNumeric(green) || !isNumeric(blue)) {
8873
+ throw new Error("hextToRgb returned an invalid value for '" + colorValue + "'");
8874
+ }
8875
+ color = new Color(Number(red), Number(green), Number(blue));
8876
+ }
8877
+ catch (error) {
8878
+ throw new Error("Color value should be in HEX format. " + error);
8879
+ }
8880
+ var solver = new Solver(color, Object.assign({},
8881
+ // `HexToCssConfiguration` Defaults
8882
+ {
8883
+ acceptanceLossPercentage: 5,
8884
+ maxChecks: 30,
8885
+ forceFilterRecalculation: false,
8886
+ }, opts));
8887
+ return (results[colorValue] = Object.assign({}, solver.solve(), {
8888
+ hex: colorValue,
8889
+ rgb: [red, green, blue],
8890
+ cache: false,
8891
+ }));
8892
+ };
8893
+ /**
8894
+ * A function that clears cached results
8895
+ *
8896
+ * @param {string} key? HEX string value passed previously `#24639C`. If not passed, it clears all cached results
8897
+ * @returns void
8898
+ */
8899
+ var clearCache = function (key) {
8900
+ if (!key) {
8901
+ results = {};
8902
+ }
8903
+ else if (results[key]) {
8904
+ delete results[key];
8905
+ }
8906
+ };
8907
+
8908
+ exports.clearCache = clearCache;
8909
+ exports.hexToCSSFilter = hexToCSSFilter;
8910
+
8911
+ Object.defineProperty(exports, '__esModule', { value: true });
8912
+
8913
+ })));
8914
+ });
8915
+
8370
8916
  function _extends() {
8371
8917
  _extends = Object.assign ? Object.assign.bind() : function (target) {
8372
8918
  for (var i = 1; i < arguments.length; i++) {
@@ -8440,7 +8986,8 @@ var parseToDayEnd = function parseToDayEnd(endDate) {
8440
8986
  }).toJSDate();
8441
8987
  };
8442
8988
  var formatToIsoDate = function formatToIsoDate(date) {
8443
- return luxon.DateTime.fromJSDate(date).toISODate();
8989
+ var _DateTime$fromJSDate$;
8990
+ return (_DateTime$fromJSDate$ = luxon.DateTime.fromJSDate(date).toISODate()) != null ? _DateTime$fromJSDate$ : undefined;
8444
8991
  };
8445
8992
  var formatToLocaleSimple = function formatToLocaleSimple(date) {
8446
8993
  return luxon.DateTime.fromJSDate(date).toFormat("dd/MM/yyyy");
@@ -8458,6 +9005,8 @@ function validDates(startDate, endDate, _name) {
8458
9005
  };
8459
9006
  }
8460
9007
 
9008
+ var MAIN_GANTT_ID = "main";
9009
+ var SECONDARY_GANTT_ID = "secondary";
8461
9010
  var toViewMode = function toViewMode(timeUnit) {
8462
9011
  switch (timeUnit) {
8463
9012
  case TimeUnit.DAY:
@@ -8470,6 +9019,14 @@ var toViewMode = function toViewMode(timeUnit) {
8470
9019
  return ViewMode.Year;
8471
9020
  }
8472
9021
  };
9022
+ var columnWidthForTimeUnit = function columnWidthForTimeUnit(timeUnit) {
9023
+ switch (timeUnit) {
9024
+ case TimeUnit.YEAR:
9025
+ return 60 * 2;
9026
+ default:
9027
+ return 60;
9028
+ }
9029
+ };
8473
9030
  var convertPhaseToTask = function convertPhaseToTask(item) {
8474
9031
  var mapPhase = function mapPhase(_ref) {
8475
9032
  var phaseStart = _ref.startDate,
@@ -8480,7 +9037,8 @@ var convertPhaseToTask = function convertPhaseToTask(item) {
8480
9037
  phaseId = _ref.id,
8481
9038
  color = _ref.color,
8482
9039
  selectedColor = _ref.selectedColor,
8483
- dependencies = _ref.dependencies;
9040
+ dependencies = _ref.dependencies,
9041
+ icon = _ref.icon;
8484
9042
  var _validDates = validDates(phaseStart, phaseEnd),
8485
9043
  start = _validDates.start,
8486
9044
  end = _validDates.end;
@@ -8503,7 +9061,8 @@ var convertPhaseToTask = function convertPhaseToTask(item) {
8503
9061
  progressColor: color,
8504
9062
  backgroundSelectedColor: selectedColor,
8505
9063
  progressSelectedColor: selectedColor
8506
- } : {}
9064
+ } : {},
9065
+ icon: icon
8507
9066
  };
8508
9067
  };
8509
9068
  return mapPhase(item);
@@ -8534,7 +9093,8 @@ var convertDetailToTimeline = function convertDetailToTimeline(item, mainGanttSt
8534
9093
  var startDate = x.startDate,
8535
9094
  endDate = x.endDate,
8536
9095
  color = x.color,
8537
- selectedColor = x.selectedColor;
9096
+ selectedColor = x.selectedColor,
9097
+ icon = x.icon;
8538
9098
  var _validDates3 = validDates(startDate, endDate),
8539
9099
  start = _validDates3.start,
8540
9100
  end = _validDates3.end;
@@ -8542,7 +9102,8 @@ var convertDetailToTimeline = function convertDetailToTimeline(item, mainGanttSt
8542
9102
  start: start,
8543
9103
  end: end,
8544
9104
  backgroundColor: color != null ? color : "0xffffff",
8545
- backgroundSelectedColor: selectedColor != null ? selectedColor : color
9105
+ backgroundSelectedColor: selectedColor != null ? selectedColor : color,
9106
+ icon: icon
8546
9107
  };
8547
9108
  };
8548
9109
  var defaultColor = "#595959";
@@ -8587,7 +9148,8 @@ var convertProjectToTasks = function convertProjectToTasks(item, mainGanttStartD
8587
9148
  secondaryEnd: end2,
8588
9149
  progress: 100,
8589
9150
  isDisabled: false,
8590
- hideChildren: false
9151
+ hideChildren: false,
9152
+ icon: row.icon
8591
9153
  };
8592
9154
  var children1 = ((_row$phases = row.phases) != null ? _row$phases : []).map(convertPhaseToTask);
8593
9155
  return [mainTask].concat(children1);
@@ -8749,8 +9311,8 @@ var ganttDateRangeFromDetail = function ganttDateRangeFromDetail(details, viewMo
8749
9311
  return ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, true);
8750
9312
  };
8751
9313
  var ganttDateRangeGeneric = function ganttDateRangeGeneric(dates, viewMode, preStepsCount, showSecondaryDates, realDates) {
8752
- var newStartDate = dates[0].start;
8753
- var newEndDate = dates[0].end;
9314
+ var newStartDate = dates.length > 0 ? dates[0].start : new Date();
9315
+ var newEndDate = dates.length > 0 ? dates[0].end : new Date();
8754
9316
  for (var _iterator = _createForOfIteratorHelperLoose(dates), _step; !(_step = _iterator()).done;) {
8755
9317
  var d = _step.value;
8756
9318
  if (d.start < newStartDate) {
@@ -9184,7 +9746,8 @@ var TaskList = function TaskList(_ref) {
9184
9746
  taskListRef = _ref.taskListRef,
9185
9747
  horizontalContainerClass = _ref.horizontalContainerClass,
9186
9748
  TaskListHeader = _ref.TaskListHeader,
9187
- TaskListTable = _ref.TaskListTable;
9749
+ TaskListTable = _ref.TaskListTable,
9750
+ filter = _ref.filter;
9188
9751
  var horizontalContainerRef = react.useRef(null);
9189
9752
  react.useEffect(function () {
9190
9753
  if (horizontalContainerRef.current) {
@@ -9209,6 +9772,10 @@ var TaskList = function TaskList(_ref) {
9209
9772
  setSelectedTask: setSelectedTask,
9210
9773
  onExpanderClick: onExpanderClick
9211
9774
  };
9775
+ react.useEffect(function () {
9776
+ var _taskListRef$current;
9777
+ (_taskListRef$current = taskListRef.current) === null || _taskListRef$current === void 0 ? void 0 : _taskListRef$current.prepend(filter);
9778
+ }, [taskListRef, filter]);
9212
9779
  return react.createElement("div", {
9213
9780
  ref: taskListRef,
9214
9781
  className: classes.tasks
@@ -9759,7 +10326,7 @@ var convertToTimeline = function convertToTimeline(task, index, dates, columnWid
9759
10326
  var _task$timeline;
9760
10327
  var y = taskYCoordinate(index, rowHeight, taskHeight);
9761
10328
  function convertFrameToTask(frame, j) {
9762
- var _frame$backgroundSele;
10329
+ var _frame$backgroundSele, _frame$icon;
9763
10330
  var _computeTypeAndXs2 = computeTypeAndXs(frame.start, frame.end, "task", dates, columnWidth, handleWidth, false),
9764
10331
  x1 = _computeTypeAndXs2.x1,
9765
10332
  x2 = _computeTypeAndXs2.x2;
@@ -9791,7 +10358,8 @@ var convertToTimeline = function convertToTimeline(task, index, dates, columnWid
9791
10358
  typeInternal: "timeline",
9792
10359
  x1: x1,
9793
10360
  x2: x2,
9794
- y: y
10361
+ y: y,
10362
+ icon: (_frame$icon = frame.icon) != null ? _frame$icon : undefined
9795
10363
  };
9796
10364
  }
9797
10365
  var _computeTypeAndXs3 = computeTypeAndXs(task.start, task.end, task.type, dates, columnWidth, handleWidth, false),
@@ -10150,6 +10718,25 @@ var BarProgressHandle = function BarProgressHandle(_ref) {
10150
10718
  });
10151
10719
  };
10152
10720
 
10721
+ var TaskIcon = function TaskIcon(_ref) {
10722
+ var _ref$color = _ref.color,
10723
+ color = _ref$color === void 0 ? "#000000" : _ref$color,
10724
+ url = _ref.url,
10725
+ height = _ref.height,
10726
+ width = _ref.width,
10727
+ x = _ref.x,
10728
+ y = _ref.y;
10729
+ var cssFilter = hexToCssFilter.hexToCSSFilter(color);
10730
+ return react.createElement("image", {
10731
+ href: url,
10732
+ filter: cssFilter.filter.replace(";", ""),
10733
+ x: x,
10734
+ y: y,
10735
+ width: width,
10736
+ height: height
10737
+ });
10738
+ };
10739
+
10153
10740
  var Bar = function Bar(_ref) {
10154
10741
  var _task$x2secondary, _task$x1secondary;
10155
10742
  var task = _ref.task,
@@ -10207,7 +10794,14 @@ var Bar = function Bar(_ref) {
10207
10794
  onMouseDown: function onMouseDown(e) {
10208
10795
  onEventStart("progress", task, e);
10209
10796
  }
10210
- })));
10797
+ })), task.icon && task.icon.url && react.createElement(TaskIcon, {
10798
+ color: task.icon.color,
10799
+ url: task.icon.url,
10800
+ width: task.height / 2 + "px",
10801
+ height: task.height / 2 + "px",
10802
+ x: task.x1 + (task.x2 - task.x1) - task.height / 2 / 2,
10803
+ y: task.y - task.height / 2 / 2 / 2 + (showSecondaryDates ? task.height / 2 : 0)
10804
+ }));
10211
10805
  };
10212
10806
 
10213
10807
  var BarSmall = function BarSmall(_ref) {
@@ -10268,7 +10862,9 @@ var Timeline = function Timeline(_ref) {
10268
10862
  rx: 0,
10269
10863
  ry: 0
10270
10864
  }), task.barChildren.map(function (bar) {
10271
- return react.createElement("rect", {
10865
+ return react.createElement(react.Fragment, {
10866
+ key: bar.id + ".rf"
10867
+ }, react.createElement("rect", {
10272
10868
  style: {
10273
10869
  cursor: "pointer"
10274
10870
  },
@@ -10280,7 +10876,14 @@ var Timeline = function Timeline(_ref) {
10280
10876
  height: bar.height,
10281
10877
  rx: bar.barCornerRadius,
10282
10878
  ry: bar.barCornerRadius
10283
- });
10879
+ }), bar.icon && bar.icon.url && react.createElement(TaskIcon, {
10880
+ color: bar.icon.color,
10881
+ url: bar.icon.url,
10882
+ width: bar.height + "px",
10883
+ height: bar.height + "px",
10884
+ x: bar.x1 + (bar.x2 - bar.x1) - bar.height / 2,
10885
+ y: bar.y - bar.height / 2 / 2
10886
+ }));
10284
10887
  }));
10285
10888
  };
10286
10889
 
@@ -10317,7 +10920,7 @@ var TaskItem = function TaskItem(props) {
10317
10920
  setTaskItem(react.createElement(Bar, Object.assign({}, props)));
10318
10921
  break;
10319
10922
  }
10320
- }, [task, isSelected]);
10923
+ }, [task, isSelected, props]);
10321
10924
  react.useEffect(function () {
10322
10925
  if (textRef.current) {
10323
10926
  setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
@@ -10358,6 +10961,9 @@ var TaskItem = function TaskItem(props) {
10358
10961
  onClick: function onClick(e) {
10359
10962
  onEventStart("click", task, e);
10360
10963
  },
10964
+ onContextMenu: function onContextMenu(e) {
10965
+ onEventStart("contextmenu", task, e);
10966
+ },
10361
10967
  onFocus: function onFocus() {
10362
10968
  onEventStart("select", task);
10363
10969
  }
@@ -10398,6 +11004,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10398
11004
  onProgressChange = _ref.onProgressChange,
10399
11005
  onDoubleClick = _ref.onDoubleClick,
10400
11006
  onClick = _ref.onClick,
11007
+ onContextMenu = _ref.onContextMenu,
10401
11008
  onDelete = _ref.onDelete;
10402
11009
  var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
10403
11010
  var _useState = react.useState(0),
@@ -10559,6 +11166,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
10559
11166
  } else if (action === "click") {
10560
11167
  var skipClick = !hasMovedHorizontally(event);
10561
11168
  skipClick && !!onClick && onClick(task);
11169
+ } else if (action === "contextmenu") {
11170
+ event.preventDefault();
11171
+ !!onContextMenu && onContextMenu(event, task);
10562
11172
  } else if (action === "move") {
10563
11173
  var _svg$current$getScree3;
10564
11174
  if (!(svg !== null && svg !== void 0 && svg.current) || !point) return;
@@ -10646,6 +11256,7 @@ var TaskGantt = function TaskGantt(_ref) {
10646
11256
  calendarProps = _ref.calendarProps,
10647
11257
  barProps = _ref.barProps,
10648
11258
  ganttHeight = _ref.ganttHeight,
11259
+ taskGanttRef = _ref.taskGanttRef,
10649
11260
  scrollY = _ref.scrollY,
10650
11261
  scrollX = _ref.scrollX;
10651
11262
  var ganttSVGRef = react.useRef(null);
@@ -10665,7 +11276,8 @@ var TaskGantt = function TaskGantt(_ref) {
10665
11276
  }
10666
11277
  }, [scrollX]);
10667
11278
  return react.createElement("div", {
10668
- className: styles$7.ganttContainer
11279
+ className: styles$7.ganttContainer,
11280
+ ref: taskGanttRef
10669
11281
  }, react.createElement("div", {
10670
11282
  className: styles$7.ganttVerticalContainer,
10671
11283
  ref: verticalGanttContainerRef,
@@ -10696,9 +11308,10 @@ var TaskGantt = function TaskGantt(_ref) {
10696
11308
  var styles$8 = {"scrollWrapper":"_2k9Ys","scroll":"_19jgW"};
10697
11309
 
10698
11310
  var HorizontalScroll = function HorizontalScroll(_ref) {
11311
+ var _taskGanttRef$current;
10699
11312
  var scroll = _ref.scroll,
10700
11313
  svgWidth = _ref.svgWidth,
10701
- taskListWidth = _ref.taskListWidth,
11314
+ taskGanttRef = _ref.taskGanttRef,
10702
11315
  rtl = _ref.rtl,
10703
11316
  onScroll = _ref.onScroll;
10704
11317
  var scrollRef = react.useRef(null);
@@ -10707,12 +11320,12 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
10707
11320
  scrollRef.current.scrollLeft = scroll;
10708
11321
  }
10709
11322
  }, [scroll]);
10710
- console.log("HORIZONTAL-SCROLL svgWidth: " + svgWidth);
11323
+ var rect = (_taskGanttRef$current = taskGanttRef.current) === null || _taskGanttRef$current === void 0 ? void 0 : _taskGanttRef$current.getBoundingClientRect();
10711
11324
  return react.createElement("div", {
10712
11325
  dir: "ltr",
10713
- style: {
10714
- margin: rtl ? "0px " + taskListWidth + "px 0px 0px" : "0px 0px 0px " + taskListWidth + "px"
10715
- },
11326
+ style: rect ? {
11327
+ margin: rtl ? "0px " + rect.x + "px 0px 0px" : "0px 0px 0px " + rect.x + "px"
11328
+ } : undefined,
10716
11329
  className: styles$8.scrollWrapper,
10717
11330
  onScroll: onScroll,
10718
11331
  ref: scrollRef
@@ -10728,13 +11341,14 @@ var Gantt = function Gantt(_ref) {
10728
11341
  var id = _ref.id,
10729
11342
  tasks = _ref.tasks,
10730
11343
  _ref$headerHeight = _ref.headerHeight,
10731
- headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
11344
+ headerHeight = _ref$headerHeight === void 0 ? 114 : _ref$headerHeight,
10732
11345
  _ref$columnWidth = _ref.columnWidth,
10733
11346
  columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
10734
11347
  _ref$listCellWidth = _ref.listCellWidth,
10735
11348
  listCellWidth = _ref$listCellWidth === void 0 ? "297px" : _ref$listCellWidth,
10736
11349
  _ref$rowHeight = _ref.rowHeight,
10737
11350
  rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
11351
+ filter = _ref.filter,
10738
11352
  _ref$ganttHeight = _ref.ganttHeight,
10739
11353
  ganttHeight = _ref$ganttHeight === void 0 ? 0 : _ref$ganttHeight,
10740
11354
  _ref$viewMode = _ref.viewMode,
@@ -10806,10 +11420,12 @@ var Gantt = function Gantt(_ref) {
10806
11420
  onProgressChange = _ref.onProgressChange,
10807
11421
  onDoubleClick = _ref.onDoubleClick,
10808
11422
  onClick = _ref.onClick,
11423
+ onContextMenu = _ref.onContextMenu,
10809
11424
  onDelete = _ref.onDelete,
10810
11425
  onSelect = _ref.onSelect,
10811
11426
  onExpanderClick = _ref.onExpanderClick;
10812
11427
  var wrapperRef = react.useRef(null);
11428
+ var taskGanttRef = react.useRef(null);
10813
11429
  var taskListRef = react.useRef(null);
10814
11430
  var _useState = react.useState(function () {
10815
11431
  var _ganttDateRangeFromTa = ganttDateRangeFromTask(tasks, viewMode, preStepsCount, showSecondaryDates, displayedStartDate, displayedEndDate),
@@ -10822,26 +11438,26 @@ var Gantt = function Gantt(_ref) {
10822
11438
  }),
10823
11439
  dateSetup = _useState[0],
10824
11440
  setDateSetup = _useState[1];
10825
- var _useState2 = react.useState(undefined),
10826
- currentViewDate = _useState2[0],
10827
- setCurrentViewDate = _useState2[1];
10828
- var _useState3 = react.useState(0),
10829
- taskListWidth = _useState3[0],
10830
- setTaskListWidth = _useState3[1];
10831
- var _useState4 = react.useState(0),
10832
- svgContainerWidth = _useState4[0],
10833
- setSvgContainerWidth = _useState4[1];
10834
- var _useState5 = react.useState(ganttHeight),
10835
- svgContainerHeight = _useState5[0],
10836
- setSvgContainerHeight = _useState5[1];
10837
- var _useState6 = react.useState([]),
10838
- barTasks = _useState6[0],
10839
- setBarTasks = _useState6[1];
10840
- var _useState7 = react.useState({
11441
+ var taskListWidth = react.useRef(0);
11442
+ var setTaskListWidth = function setTaskListWidth(width) {
11443
+ taskListWidth.current = width;
11444
+ };
11445
+ var svgContainerWidth = react.useRef(0);
11446
+ var setSvgContainerWidth = function setSvgContainerWidth(width) {
11447
+ svgContainerWidth.current = width;
11448
+ };
11449
+ var svgContainerHeight = react.useRef(ganttHeight);
11450
+ var setSvgContainerHeight = function setSvgContainerHeight(height) {
11451
+ svgContainerHeight.current = height;
11452
+ };
11453
+ var _useState2 = react.useState([]),
11454
+ barTasks = _useState2[0],
11455
+ setBarTasks = _useState2[1];
11456
+ var _useState3 = react.useState({
10841
11457
  action: ""
10842
11458
  }),
10843
- ganttEvent = _useState7[0],
10844
- setGanttEvent = _useState7[1];
11459
+ ganttEvent = _useState3[0],
11460
+ setGanttEvent = _useState3[1];
10845
11461
  var taskHeight = react.useMemo(function () {
10846
11462
  return rowHeight * barFill / 100;
10847
11463
  }, [rowHeight, barFill]);
@@ -10851,29 +11467,30 @@ var Gantt = function Gantt(_ref) {
10851
11467
  var timelineHeight = react.useMemo(function () {
10852
11468
  return rowHeight * timelineFill / 100;
10853
11469
  }, [rowHeight, timelineFill]);
10854
- var _useState8 = react.useState(),
10855
- selectedTask = _useState8[0],
10856
- setSelectedTask = _useState8[1];
10857
- var _useState9 = react.useState(null),
10858
- failedTask = _useState9[0],
10859
- setFailedTask = _useState9[1];
11470
+ var _useState4 = react.useState(),
11471
+ selectedTask = _useState4[0],
11472
+ setSelectedTask = _useState4[1];
11473
+ var _useState5 = react.useState(null),
11474
+ failedTask = _useState5[0],
11475
+ setFailedTask = _useState5[1];
10860
11476
  var svgWidth = dateSetup.dates.length * columnWidth;
10861
11477
  var ganttFullHeight = barTasks.length * rowHeight;
10862
- var _useState10 = react.useState(0),
10863
- scrollY = _useState10[0],
10864
- setScrollY = _useState10[1];
10865
- var _useState11 = react.useState(-1),
10866
- scrollX = _useState11[0],
10867
- setScrollX = _useState11[1];
10868
- var _useState12 = react.useState(false),
10869
- ignoreScrollEvent = _useState12[0],
10870
- setIgnoreScrollEvent = _useState12[1];
10871
- var _useState13 = react.useState(),
10872
- currentDateIndicatorContent = _useState13[0],
10873
- setCurrentDateIndicatorContent = _useState13[1];
10874
- var _useState14 = react.useState(),
10875
- projectionContent = _useState14[0],
10876
- setProjectionContent = _useState14[1];
11478
+ var _useState6 = react.useState(0),
11479
+ scrollY = _useState6[0],
11480
+ setScrollY = _useState6[1];
11481
+ var _useState7 = react.useState(-1),
11482
+ scrollX = _useState7[0],
11483
+ setScrollX = _useState7[1];
11484
+ var ignoreScrollEvent = react.useRef(false);
11485
+ var setIgnoreScrollEvent = function setIgnoreScrollEvent(value) {
11486
+ ignoreScrollEvent.current = value;
11487
+ };
11488
+ var _useState8 = react.useState(),
11489
+ currentDateIndicatorContent = _useState8[0],
11490
+ setCurrentDateIndicatorContent = _useState8[1];
11491
+ var _useState9 = react.useState(),
11492
+ projectionContent = _useState9[0],
11493
+ setProjectionContent = _useState9[1];
10877
11494
  react.useEffect(function () {
10878
11495
  window.addEventListener("gantt-sync-scroll-event", function (e) {
10879
11496
  if (e.detail.id !== id) {
@@ -10899,14 +11516,30 @@ var Gantt = function Gantt(_ref) {
10899
11516
  setScrollX(newDates.length * columnWidth);
10900
11517
  }
10901
11518
  }
10902
- setDateSetup({
10903
- dates: newDates,
10904
- viewMode: viewMode
10905
- });
11519
+ var set = false;
11520
+ if (dateSetup && dateSetup.dates) {
11521
+ var old = dateSetup.dates;
11522
+ if (old.length !== newDates.length) {
11523
+ set = true;
11524
+ } else {
11525
+ for (var i = 0; i < old.length; i++) {
11526
+ if (old[i].valueOf() !== newDates[i].valueOf()) {
11527
+ set = true;
11528
+ break;
11529
+ }
11530
+ }
11531
+ }
11532
+ }
11533
+ if (set) {
11534
+ setDateSetup({
11535
+ dates: newDates,
11536
+ viewMode: viewMode
11537
+ });
11538
+ }
10906
11539
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, projectHeight, timelineHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, showSecondaryDates));
10907
11540
  }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, rtl, scrollX, onExpanderClick, showSecondaryDates, projectHeight, timelineHeight, displayedStartDate, displayedEndDate]);
10908
11541
  react.useEffect(function () {
10909
- if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
11542
+ if (viewMode === dateSetup.viewMode && viewDate) {
10910
11543
  var dates = dateSetup.dates;
10911
11544
  var index = dates.findIndex(function (d, i) {
10912
11545
  return viewDate.valueOf() >= d.valueOf() && i + 1 !== dates.length && viewDate.valueOf() < dates[i + 1].valueOf();
@@ -10914,10 +11547,10 @@ var Gantt = function Gantt(_ref) {
10914
11547
  if (index === -1) {
10915
11548
  return;
10916
11549
  }
10917
- setCurrentViewDate(viewDate);
11550
+ setIgnoreScrollEvent(true);
10918
11551
  setScrollX(columnWidth * index);
10919
11552
  }
10920
- }, [viewDate, columnWidth, dateSetup.dates, dateSetup.viewMode, viewMode, currentViewDate, setCurrentViewDate]);
11553
+ }, [viewDate, columnWidth, dateSetup.dates, dateSetup.viewMode, viewMode]);
10921
11554
  react.useEffect(function () {
10922
11555
  var changedTask = ganttEvent.changedTask,
10923
11556
  action = ganttEvent.action;
@@ -10960,9 +11593,9 @@ var Gantt = function Gantt(_ref) {
10960
11593
  }, [taskListRef, listCellWidth]);
10961
11594
  react.useEffect(function () {
10962
11595
  if (wrapperRef.current) {
10963
- setSvgContainerWidth(wrapperRef.current.offsetWidth - taskListWidth);
11596
+ setSvgContainerWidth(wrapperRef.current.offsetWidth - taskListWidth.current);
10964
11597
  }
10965
- }, [wrapperRef, taskListWidth]);
11598
+ }, [wrapperRef]);
10966
11599
  react.useEffect(function () {
10967
11600
  if (ganttHeight) {
10968
11601
  setSvgContainerHeight(ganttHeight + headerHeight);
@@ -11005,7 +11638,7 @@ var Gantt = function Gantt(_ref) {
11005
11638
  };
11006
11639
  }, [wrapperRef, scrollY, scrollX, ganttHeight, svgWidth, rtl, ganttFullHeight]);
11007
11640
  var handleScrollY = function handleScrollY(event) {
11008
- if (scrollY !== event.currentTarget.scrollTop && !ignoreScrollEvent) {
11641
+ if (scrollY !== event.currentTarget.scrollTop && !ignoreScrollEvent.current) {
11009
11642
  setScrollY(event.currentTarget.scrollTop);
11010
11643
  setIgnoreScrollEvent(true);
11011
11644
  } else {
@@ -11013,7 +11646,7 @@ var Gantt = function Gantt(_ref) {
11013
11646
  }
11014
11647
  };
11015
11648
  var handleScrollX = function handleScrollX(event) {
11016
- if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
11649
+ if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent.current) {
11017
11650
  setScrollX(event.currentTarget.scrollLeft);
11018
11651
  setIgnoreScrollEvent(true);
11019
11652
  window.dispatchEvent(new CustomEvent("gantt-sync-scroll-event", {
@@ -11173,6 +11806,7 @@ var Gantt = function Gantt(_ref) {
11173
11806
  onProgressChange: onProgressChange,
11174
11807
  onDoubleClick: onDoubleClick,
11175
11808
  onClick: onClick,
11809
+ onContextMenu: onContextMenu,
11176
11810
  onDelete: onDelete
11177
11811
  };
11178
11812
  var tableProps = {
@@ -11185,6 +11819,7 @@ var Gantt = function Gantt(_ref) {
11185
11819
  headerHeight: headerHeight,
11186
11820
  scrollY: scrollY,
11187
11821
  ganttHeight: ganttHeight,
11822
+ filter: filter,
11188
11823
  horizontalContainerClass: styles$7.horizontalContainer,
11189
11824
  selectedTask: selectedTask,
11190
11825
  taskListRef: taskListRef,
@@ -11203,20 +11838,21 @@ var Gantt = function Gantt(_ref) {
11203
11838
  calendarProps: calendarProps,
11204
11839
  barProps: barProps,
11205
11840
  ganttHeight: ganttHeight,
11841
+ taskGanttRef: taskGanttRef,
11206
11842
  scrollY: scrollY,
11207
11843
  scrollX: scrollX
11208
11844
  }), ganttEvent.changedTask && react.createElement(Tooltip, {
11209
11845
  arrowIndent: arrowIndent,
11210
11846
  rowHeight: rowHeight,
11211
- svgContainerHeight: svgContainerHeight,
11212
- svgContainerWidth: svgContainerWidth,
11847
+ svgContainerHeight: svgContainerHeight.current,
11848
+ svgContainerWidth: svgContainerWidth.current,
11213
11849
  fontFamily: fontFamily,
11214
11850
  fontSize: fontSize,
11215
11851
  scrollX: scrollX,
11216
11852
  scrollY: scrollY,
11217
11853
  task: ganttEvent.changedTask,
11218
11854
  headerHeight: headerHeight,
11219
- taskListWidth: taskListWidth,
11855
+ taskListWidth: taskListWidth.current,
11220
11856
  TooltipContent: TooltipContent,
11221
11857
  rtl: rtl,
11222
11858
  svgWidth: svgWidth
@@ -11229,7 +11865,8 @@ var Gantt = function Gantt(_ref) {
11229
11865
  rtl: rtl
11230
11866
  })), react.createElement(HorizontalScroll, {
11231
11867
  svgWidth: svgWidth,
11232
- taskListWidth: taskListWidth,
11868
+ taskGanttRef: taskGanttRef,
11869
+ taskListWidth: taskListWidth.current,
11233
11870
  scroll: scrollX,
11234
11871
  rtl: rtl,
11235
11872
  onScroll: handleScrollX
@@ -11250,6 +11887,7 @@ var format = function format(date, locale, options) {
11250
11887
  } catch (e) {
11251
11888
  console.error("time-formatters.ts format", date, locale, options);
11252
11889
  console.error(e);
11890
+ return "FORMAT-ERR";
11253
11891
  }
11254
11892
  };
11255
11893
  var dayFormatter = function dayFormatter(date, locale) {
@@ -11274,16 +11912,15 @@ var ganttDateTimeFormatters = {
11274
11912
 
11275
11913
  var classes$1 = {"wrapper":"_37E9D","title":"_WrYI6","toggler":"_c53zr","switch":"_2eBO5","input":"_hiyro","slider":"_2HI58","label":"_2gSdA","filter":"_2cfRI"};
11276
11914
 
11277
- var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView, onFilterInput) {
11915
+ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView, setDoubleView) {
11278
11916
  var CustomTaskListHeader = function CustomTaskListHeader(_ref) {
11279
- var headerHeight = _ref.headerHeight,
11280
- fontFamily = _ref.fontFamily,
11917
+ var fontFamily = _ref.fontFamily,
11281
11918
  fontSize = _ref.fontSize;
11282
11919
  return react.createElement("div", {
11283
11920
  style: {
11284
11921
  fontFamily: fontFamily,
11285
11922
  fontSize: fontSize,
11286
- height: headerHeight
11923
+ height: "50px"
11287
11924
  },
11288
11925
  className: classes$1.wrapper
11289
11926
  }, react.createElement("div", {
@@ -11305,16 +11942,7 @@ var CustomTaskListHeaderHOC = function CustomTaskListHeaderHOC(label, doubleView
11305
11942
  className: classes$1.slider
11306
11943
  })), react.createElement("span", {
11307
11944
  className: classes$1.label
11308
- }, "Mostra previsioni")), react.createElement("div", {
11309
- className: classes$1.filter
11310
- }, react.createElement("input", {
11311
- type: "text",
11312
- name: "filter",
11313
- size: 30,
11314
- onInput: function onInput(e) {
11315
- return onFilterInput === null || onFilterInput === void 0 ? void 0 : onFilterInput(e);
11316
- }
11317
- })));
11945
+ }, "Previsioni")));
11318
11946
  };
11319
11947
  return CustomTaskListHeader;
11320
11948
  };
@@ -11332,7 +11960,8 @@ var ProjectRow = function ProjectRow(_ref) {
11332
11960
  fontFamily = _ref.fontFamily,
11333
11961
  fontSize = _ref.fontSize,
11334
11962
  setSelectedTask = _ref.setSelectedTask,
11335
- onclickTaskList = _ref.onclickTaskList;
11963
+ onclickTaskList = _ref.onclickTaskList,
11964
+ oncontextmenuTaskList = _ref.oncontextmenuTaskList;
11336
11965
  var str = "";
11337
11966
  for (var i = 0; i < valuesToShow.length; i++) {
11338
11967
  str += "1fr ";
@@ -11351,6 +11980,11 @@ var ProjectRow = function ProjectRow(_ref) {
11351
11980
  onClick: function onClick() {
11352
11981
  setSelectedTask(id);
11353
11982
  onclickTaskList(id);
11983
+ },
11984
+ onContextMenu: function onContextMenu(e) {
11985
+ e.preventDefault();
11986
+ setSelectedTask(id);
11987
+ oncontextmenuTaskList(e, id);
11354
11988
  }
11355
11989
  }, valuesToShow === null || valuesToShow === void 0 ? void 0 : valuesToShow.map(function (v, index) {
11356
11990
  return react.createElement("span", {
@@ -11372,7 +12006,8 @@ var SubRow = function SubRow(_ref2) {
11372
12006
  fontFamily = _ref2.fontFamily,
11373
12007
  fontSize = _ref2.fontSize,
11374
12008
  setSelectedTask = _ref2.setSelectedTask,
11375
- onclickTaskList = _ref2.onclickTaskList;
12009
+ onclickTaskList = _ref2.onclickTaskList,
12010
+ oncontextmenuTaskList = _ref2.oncontextmenuTaskList;
11376
12011
  var str = "";
11377
12012
  for (var i = 0; i < valuesToShow.length + 1; i++) {
11378
12013
  str += "1fr ";
@@ -11391,6 +12026,11 @@ var SubRow = function SubRow(_ref2) {
11391
12026
  onClick: function onClick() {
11392
12027
  setSelectedTask(id);
11393
12028
  onclickTaskList(id);
12029
+ },
12030
+ onContextMenu: function onContextMenu(e) {
12031
+ e.preventDefault();
12032
+ setSelectedTask(id);
12033
+ oncontextmenuTaskList(e, id);
11394
12034
  }
11395
12035
  }, react.createElement("span", {
11396
12036
  key: "phase_" + id + "_valuesToShow_color",
@@ -11414,7 +12054,9 @@ var TimelineSubRow = function TimelineSubRow(_ref3) {
11414
12054
  rowHeight = _ref3.rowHeight,
11415
12055
  rowWidth = _ref3.rowWidth,
11416
12056
  fontFamily = _ref3.fontFamily,
11417
- fontSize = _ref3.fontSize;
12057
+ fontSize = _ref3.fontSize,
12058
+ setSelectedTask = _ref3.setSelectedTask,
12059
+ oncontextmenuTaskList = _ref3.oncontextmenuTaskList;
11418
12060
  var str = "";
11419
12061
  for (var i = 0; i < valuesToShow.length; i++) {
11420
12062
  str += "1fr ";
@@ -11429,7 +12071,12 @@ var TimelineSubRow = function TimelineSubRow(_ref3) {
11429
12071
  return react.createElement("div", {
11430
12072
  key: "detail_" + id,
11431
12073
  className: styles$9.timeline,
11432
- style: customStyle
12074
+ style: customStyle,
12075
+ onContextMenu: function onContextMenu(e) {
12076
+ e.preventDefault();
12077
+ setSelectedTask(id);
12078
+ oncontextmenuTaskList(e, id);
12079
+ }
11433
12080
  }, valuesToShow === null || valuesToShow === void 0 ? void 0 : valuesToShow.map(function (v, index) {
11434
12081
  return react.createElement("span", {
11435
12082
  className: index === 0 ? styles$9.main : undefined,
@@ -11438,7 +12085,7 @@ var TimelineSubRow = function TimelineSubRow(_ref3) {
11438
12085
  }, v);
11439
12086
  }));
11440
12087
  };
11441
- var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id) {
12088
+ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, oncontextmenuTaskList, id) {
11442
12089
  var CustomTaskListTable = function CustomTaskListTable(_ref4) {
11443
12090
  var rowHeight = _ref4.rowHeight,
11444
12091
  rowWidth = _ref4.rowWidth,
@@ -11460,7 +12107,8 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id
11460
12107
  fontFamily: fontFamily,
11461
12108
  fontSize: fontSize,
11462
12109
  setSelectedTask: setSelectedTask,
11463
- onclickTaskList: onclickTaskList
12110
+ onclickTaskList: onclickTaskList,
12111
+ oncontextmenuTaskList: oncontextmenuTaskList
11464
12112
  }), task.type === "task" && react.createElement(SubRow, {
11465
12113
  key: task.id + "_" + task.type,
11466
12114
  task: task,
@@ -11469,7 +12117,8 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id
11469
12117
  fontFamily: fontFamily,
11470
12118
  fontSize: fontSize,
11471
12119
  setSelectedTask: setSelectedTask,
11472
- onclickTaskList: onclickTaskList
12120
+ onclickTaskList: onclickTaskList,
12121
+ oncontextmenuTaskList: oncontextmenuTaskList
11473
12122
  }), task.type === "timeline" && react.createElement(TimelineSubRow, {
11474
12123
  key: task.id + "_" + task.type,
11475
12124
  task: task,
@@ -11478,7 +12127,8 @@ var CustomTaskListTableHOC = function CustomTaskListTableHOC(onclickTaskList, id
11478
12127
  fontFamily: fontFamily,
11479
12128
  fontSize: fontSize,
11480
12129
  setSelectedTask: setSelectedTask,
11481
- onclickTaskList: onclickTaskList
12130
+ onclickTaskList: onclickTaskList,
12131
+ oncontextmenuTaskList: oncontextmenuTaskList
11482
12132
  }));
11483
12133
  }));
11484
12134
  };
@@ -11541,28 +12191,28 @@ var Planner = function Planner(props) {
11541
12191
  var _useState = react.useState(TimeUnit.MONTH),
11542
12192
  timeUnit = _useState[0],
11543
12193
  setTimeUnit = _useState[1];
11544
- var _useState2 = react.useState(props.mainGantt.items),
11545
- currentTasks = _useState2[0],
11546
- setCurrentTasks = _useState2[1];
11547
- var _useState3 = react.useState((_props$secondaryGantt = props.secondaryGantt) === null || _props$secondaryGantt === void 0 ? void 0 : _props$secondaryGantt.items),
11548
- currentDetails = _useState3[0],
11549
- setCurrentDetails = _useState3[1];
11550
- var _useState4 = react.useState((_props$mainGantt$show = props.mainGantt.showSecondaryDates) != null ? _props$mainGantt$show : false),
11551
- mainGanttDoubleView = _useState4[0],
11552
- setMainGanttDoubleView = _useState4[1];
11553
- var _useState5 = react.useState(calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount)),
11554
- displayedDates = _useState5[0],
11555
- setDisplayedDates = _useState5[1];
11556
- var _useState6 = react.useState(),
11557
- viewDate = _useState6[0],
11558
- setViewDate = _useState6[1];
11559
- var _useState7 = react.useState(),
11560
- projection = _useState7[0],
11561
- setProjection = _useState7[1];
11562
- var locale = "it-IT";
11563
- var onFilterInput = function onFilterInput(e) {
11564
- console.log("PLANNER onFilterInput", e);
12194
+ var currentTasks = react.useRef(props.mainGantt.items);
12195
+ var setCurrentTasks = function setCurrentTasks(tasks) {
12196
+ currentTasks.current = tasks;
11565
12197
  };
12198
+ var currentDetails = react.useRef((_props$secondaryGantt = props.secondaryGantt) === null || _props$secondaryGantt === void 0 ? void 0 : _props$secondaryGantt.items);
12199
+ var setCurrentDetails = function setCurrentDetails(details) {
12200
+ currentDetails.current = details;
12201
+ };
12202
+ var _useState2 = react.useState((_props$mainGantt$show = props.mainGantt.showSecondaryDates) != null ? _props$mainGantt$show : false),
12203
+ mainGanttDoubleView = _useState2[0],
12204
+ setMainGanttDoubleView = _useState2[1];
12205
+ var displayedDates = react.useRef(calculateDisplayedDateRange(currentTasks.current, timeUnit, mainGanttDoubleView, currentDetails.current, props.preStepsCount));
12206
+ var setDisplayedDates = function setDisplayedDates(dates) {
12207
+ displayedDates.current = dates;
12208
+ };
12209
+ var _useState3 = react.useState(),
12210
+ viewDate = _useState3[0],
12211
+ setViewDate = _useState3[1];
12212
+ var _useState4 = react.useState(),
12213
+ projection = _useState4[0],
12214
+ setProjection = _useState4[1];
12215
+ var locale = "it-IT";
11566
12216
  var handleClick = function handleClick(row, onClick) {
11567
12217
  if (!row) {
11568
12218
  return;
@@ -11580,6 +12230,28 @@ var Planner = function Planner(props) {
11580
12230
  }
11581
12231
  onClick === null || onClick === void 0 ? void 0 : onClick(row);
11582
12232
  };
12233
+ var handleContextMenu = function handleContextMenu(event, row, onContextMenu) {
12234
+ if (!row) {
12235
+ return;
12236
+ }
12237
+ if (row.type === "task" && props.secondaryGantt) {
12238
+ var _phase$color2;
12239
+ var phase = row;
12240
+ setProjection({
12241
+ start: new Date(phase.startDate),
12242
+ end: new Date(phase.endDate),
12243
+ color: (_phase$color2 = phase.color) != null ? _phase$color2 : "#ED7D31"
12244
+ });
12245
+ } else {
12246
+ setProjection(undefined);
12247
+ }
12248
+ onContextMenu === null || onContextMenu === void 0 ? void 0 : onContextMenu(event, row);
12249
+ };
12250
+ var handleSetDoubleView = function handleSetDoubleView(checked) {
12251
+ var _props$onSetDoubleVie;
12252
+ setMainGanttDoubleView(checked);
12253
+ (_props$onSetDoubleVie = props.onSetDoubleView) === null || _props$onSetDoubleVie === void 0 ? void 0 : _props$onSetDoubleVie.call(props, checked);
12254
+ };
11583
12255
  var handleDateChange = function handleDateChange(task, currentProjects, onDateChange) {
11584
12256
  var id = task === null || task === void 0 ? void 0 : task.id;
11585
12257
  if (!id) {
@@ -11637,25 +12309,32 @@ var Planner = function Planner(props) {
11637
12309
  setProjection(undefined);
11638
12310
  }, [props]);
11639
12311
  react.useEffect(function () {
11640
- var dates = calculateDisplayedDateRange(currentTasks, timeUnit, mainGanttDoubleView, currentDetails, props.preStepsCount);
12312
+ var dates = calculateDisplayedDateRange(currentTasks.current, timeUnit, mainGanttDoubleView, currentDetails.current, props.preStepsCount);
11641
12313
  setDisplayedDates(dates);
11642
12314
  if (!viewDate) {
11643
- setViewDate(dates.displayedStartDate);
12315
+ var now = new Date();
12316
+ if (dates.displayedStartDate <= now && dates.displayedEndDate >= now) {
12317
+ setViewDate(now);
12318
+ } else {
12319
+ setViewDate(dates.displayedStartDate);
12320
+ }
11644
12321
  }
11645
- }, [currentTasks, currentDetails]);
12322
+ }, [timeUnit, mainGanttDoubleView, props.preStepsCount, viewDate]);
11646
12323
  var tasks = [];
11647
- for (var i = 0; i < currentTasks.length; i++) {
11648
- tasks.push.apply(tasks, convertProjectToTasks(currentTasks[i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
12324
+ for (var i = 0; i < currentTasks.current.length; i++) {
12325
+ tasks.push.apply(tasks, convertProjectToTasks(currentTasks.current[i], formatToIsoDate(displayedDates.current.displayedStartDate), formatToIsoDate(displayedDates.current.displayedEndDate)));
11649
12326
  }
11650
12327
  var details = [];
11651
- if (currentDetails) {
11652
- for (var _i = 0; _i < currentDetails.length; _i++) {
11653
- details.push.apply(details, convertProjectToTasks(currentDetails[_i], formatToIsoDate(displayedDates.displayedStartDate), formatToIsoDate(displayedDates.displayedEndDate)));
12328
+ if (currentDetails.current) {
12329
+ for (var _i = 0; _i < currentDetails.current.length; _i++) {
12330
+ details.push.apply(details, convertProjectToTasks(currentDetails.current[_i], formatToIsoDate(displayedDates.current.displayedStartDate), formatToIsoDate(displayedDates.current.displayedEndDate)));
11654
12331
  }
11655
12332
  }
12333
+ console.log("PLANNER render");
11656
12334
  return react.createElement("div", null, react.createElement(Switcher, {
11657
12335
  onTimeUnitChange: function onTimeUnitChange(timeUnit) {
11658
- return setTimeUnit(timeUnit);
12336
+ setTimeUnit(timeUnit);
12337
+ setViewDate(undefined);
11659
12338
  }
11660
12339
  }), react.createElement("div", {
11661
12340
  style: {
@@ -11663,73 +12342,109 @@ var Planner = function Planner(props) {
11663
12342
  flexDirection: "column"
11664
12343
  }
11665
12344
  }, react.createElement(Gantt, Object.assign({
11666
- id: "main",
11667
- key: "main",
12345
+ id: MAIN_GANTT_ID,
12346
+ key: MAIN_GANTT_ID,
12347
+ filter: props.mainGantt.filter,
11668
12348
  hideLabel: props.mainGantt.hideLabel,
11669
12349
  showSecondaryDates: mainGanttDoubleView,
11670
12350
  hideDependencies: props.mainGantt.hideDependencies,
11671
12351
  ganttHeight: props.mainGantt.ganttHeight,
11672
- displayedStartDate: displayedDates.displayedStartDate,
11673
- displayedEndDate: displayedDates.displayedEndDate,
12352
+ displayedStartDate: displayedDates.current.displayedStartDate,
12353
+ displayedEndDate: displayedDates.current.displayedEndDate,
11674
12354
  viewDate: viewDate,
11675
12355
  tasks: tasks,
12356
+ columnWidth: columnWidthForTimeUnit(timeUnit),
11676
12357
  viewMode: toViewMode(timeUnit)
11677
12358
  }, props.mainGantt.stylingOptions, {
11678
- TaskListHeader: (_props$mainGantt$task = props.mainGantt.taskListHeaderProject) != null ? _props$mainGantt$task : CustomTaskListHeaderHOC(props.mainGantt.title, mainGanttDoubleView != null ? mainGanttDoubleView : false, setMainGanttDoubleView, onFilterInput),
12359
+ TaskListHeader: (_props$mainGantt$task = props.mainGantt.taskListHeaderProject) != null ? _props$mainGantt$task : CustomTaskListHeaderHOC(props.mainGantt.title, mainGanttDoubleView != null ? mainGanttDoubleView : false, handleSetDoubleView),
11679
12360
  TaskListTable: (_props$mainGantt$task2 = props.mainGantt.taskListTableProject) != null ? _props$mainGantt$task2 : CustomTaskListTableHOC(function (id) {
11680
- var row = getProjectById(id, currentTasks);
12361
+ var row = getProjectById(id, currentTasks.current);
11681
12362
  if (!row) {
11682
- row = getPhaseById(id, currentTasks);
12363
+ row = getPhaseById(id, currentTasks.current);
11683
12364
  }
11684
12365
  if (row) {
11685
12366
  handleClick(row, props.mainGantt.onClick);
11686
12367
  }
11687
- }, "main"),
12368
+ }, function (event, id) {
12369
+ var row = getProjectById(id, currentTasks.current);
12370
+ if (!row) {
12371
+ row = getPhaseById(id, currentTasks.current);
12372
+ }
12373
+ if (row) {
12374
+ handleContextMenu(event, row, props.mainGantt.onContextMenu);
12375
+ }
12376
+ }, MAIN_GANTT_ID),
11688
12377
  TooltipContent: (_props$mainGantt$tool = props.mainGantt.tooltipContent) != null ? _props$mainGantt$tool : CustomTooltipHOC(),
11689
- onClick: function onClick(e) {
11690
- var row = getProjectById(e.id, currentTasks);
12378
+ onClick: function onClick(task) {
12379
+ var row = getProjectById(task.id, currentTasks.current);
11691
12380
  if (!row) {
11692
- row = getPhaseById(e.id, currentTasks);
12381
+ row = getPhaseById(task.id, currentTasks.current);
11693
12382
  }
11694
12383
  if (row) {
11695
12384
  handleClick(row, props.mainGantt.onClick);
11696
12385
  }
11697
12386
  },
11698
- onDateChange: function onDateChange(e) {
11699
- return handleDateChange(e, currentTasks, props.mainGantt.onDateChange);
12387
+ onContextMenu: function onContextMenu(event, task) {
12388
+ var row = getProjectById(task.id, currentTasks.current);
12389
+ if (!row) {
12390
+ row = getPhaseById(task.id, currentTasks.current);
12391
+ }
12392
+ if (row) {
12393
+ handleContextMenu(event, row, props.mainGantt.onContextMenu);
12394
+ }
12395
+ },
12396
+ onDateChange: function onDateChange(task) {
12397
+ return handleDateChange(task, currentTasks.current, props.mainGantt.onDateChange);
11700
12398
  },
11701
12399
  locale: locale,
11702
12400
  dateTimeFormatters: ganttDateTimeFormatters
11703
12401
  })), props.secondaryGantt && react.createElement(Gantt, Object.assign({
11704
- id: "secondary",
11705
- key: "secondary",
12402
+ id: SECONDARY_GANTT_ID,
12403
+ key: SECONDARY_GANTT_ID,
11706
12404
  hideLabel: props.secondaryGantt.hideLabel,
12405
+ filter: props.secondaryGantt.filter,
11707
12406
  showSecondaryDates: mainGanttDoubleView,
11708
12407
  hideDependencies: props.secondaryGantt.hideDependencies,
11709
12408
  ganttHeight: props.secondaryGantt.ganttHeight,
11710
- displayedStartDate: displayedDates.displayedStartDate,
11711
- displayedEndDate: displayedDates.displayedEndDate,
12409
+ displayedStartDate: displayedDates.current.displayedStartDate,
12410
+ displayedEndDate: displayedDates.current.displayedEndDate,
11712
12411
  viewDate: viewDate,
11713
12412
  tasks: details,
12413
+ columnWidth: columnWidthForTimeUnit(timeUnit),
11714
12414
  viewMode: toViewMode(timeUnit)
11715
12415
  }, props.mainGantt.stylingOptions, {
11716
- TaskListHeader: (_props$secondaryGantt3 = props.secondaryGantt.taskListHeaderProject) != null ? _props$secondaryGantt3 : CustomTaskListHeaderHOC(props.secondaryGantt.title, undefined, undefined, onFilterInput),
12416
+ TaskListHeader: (_props$secondaryGantt3 = props.secondaryGantt.taskListHeaderProject) != null ? _props$secondaryGantt3 : CustomTaskListHeaderHOC(props.secondaryGantt.title),
11717
12417
  TaskListTable: (_props$secondaryGantt4 = (_props$secondaryGantt5 = props.secondaryGantt) === null || _props$secondaryGantt5 === void 0 ? void 0 : _props$secondaryGantt5.taskListTableProject) != null ? _props$secondaryGantt4 : CustomTaskListTableHOC(function (id) {
11718
12418
  console.log("planner.tsx secondaryGantt Clicked on " + id);
11719
- }, "secondary"),
12419
+ }, function (event, id) {
12420
+ if (props.secondaryGantt) {
12421
+ var row = getProjectById(id, currentDetails.current);
12422
+ if (row) {
12423
+ handleContextMenu(event, row, props.secondaryGantt.onContextMenu);
12424
+ }
12425
+ }
12426
+ }, SECONDARY_GANTT_ID),
11720
12427
  TooltipContent: (_props$secondaryGantt6 = props.secondaryGantt.tooltipContent) != null ? _props$secondaryGantt6 : CustomTooltipHOC(),
11721
12428
  projection: projection,
11722
- onClick: function onClick(e) {
12429
+ onClick: function onClick(task) {
11723
12430
  if (props.secondaryGantt) {
11724
- var row = getProjectById(e.id, currentDetails);
12431
+ var row = getProjectById(task.id, currentDetails.current);
11725
12432
  if (row) {
11726
12433
  handleClick(row, props.secondaryGantt.onClick);
11727
12434
  }
11728
12435
  }
11729
12436
  },
11730
- onDateChange: function onDateChange(e) {
12437
+ onContextMenu: function onContextMenu(event, task) {
12438
+ if (props.secondaryGantt) {
12439
+ var row = getProjectById(task.id, currentDetails.current);
12440
+ if (row) {
12441
+ handleContextMenu(event, row, props.secondaryGantt.onContextMenu);
12442
+ }
12443
+ }
12444
+ },
12445
+ onDateChange: function onDateChange(task) {
11731
12446
  var _props$secondaryGantt7;
11732
- return handleDateChange(e, currentDetails, (_props$secondaryGantt7 = props.secondaryGantt) === null || _props$secondaryGantt7 === void 0 ? void 0 : _props$secondaryGantt7.onDateChange);
12447
+ return handleDateChange(task, currentDetails.current, (_props$secondaryGantt7 = props.secondaryGantt) === null || _props$secondaryGantt7 === void 0 ? void 0 : _props$secondaryGantt7.onDateChange);
11733
12448
  },
11734
12449
  locale: locale,
11735
12450
  dateTimeFormatters: ganttDateTimeFormatters
@@ -11788,15 +12503,8 @@ function getValuesToShow(row, idCol, nameCol, dataColumns, columns, customToValu
11788
12503
  return valuesToShow;
11789
12504
  }
11790
12505
 
11791
- const kupPlannerCss = "._3_ygE{display:table;border-bottom:#e6e4e4 1px solid;border-top:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._1nBOt{display:table-row;list-style:none}._2eZzQ{border-right:1px solid rgb(196, 196, 196);opacity:1;margin-left:-2px}._WuQ0f{display:table-cell;vertical-align:-webkit-baseline-middle;vertical-align:middle}._3ZbQT{display:table;border-bottom:#e6e4e4 1px solid;border-left:#e6e4e4 1px solid}._34SS0{display:table-row;text-overflow:ellipsis}._34SS0:nth-of-type(even){}._3lLk3{display:table-cell;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._nI1Xw{display:flex}._2QjE6{color:rgb(86 86 86);font-size:0.6rem;padding:0.15rem 0.2rem 0 0.2rem;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer}._2TfEi{font-size:0.6rem;padding-left:1rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3T42e{background:#fff;padding:12px;box-shadow:0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)}._29NTg{font-size:12px;margin-bottom:6px;color:#666}._25P-K{position:absolute;display:flex;flex-shrink:0;pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}._3gVAq{visibility:hidden;position:absolute;display:flex;pointer-events:none}._1eT-t{overflow:hidden auto;width:1rem;flex-shrink:0;scrollbar-width:thin}._1eT-t::-webkit-scrollbar{width:1.1rem;height:1.1rem}._1eT-t::-webkit-scrollbar-corner{background:transparent}._1eT-t::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._1eT-t::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._EvhC1{border-radius:8px;background:#efefef;margin:12px;padding:12px}._2dZTy{fill:#fff}._2dZTy:nth-child(even){}._3rUKi{stroke:transparent}._RuwuK{stroke:#e6e4e4}._9w8d5{text-anchor:middle;fill:#333;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._1rLuZ{stroke:#e6e4e4}._2q1Kt{text-anchor:middle;fill:#555;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._35nLX{fill:#ffffff;stroke:#e0e0e0;stroke-width:1.4}._KxSXS{cursor:pointer;outline:none}._KxSXS:hover ._3w_5u{visibility:visible;opacity:1}._3w_5u{fill:#ddd;cursor:ew-resize;opacity:0;visibility:hidden}._31ERP{-webkit-user-select:none;-moz-user-select:none;user-select:none;stroke-width:0}._3zRJQ{fill:#fff;text-anchor:middle;font-weight:lighter;dominant-baseline:central;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._3KcaM{fill:#555;text-anchor:start;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}._11iN9{background:#efefef;border-radius:8px;margin:12px;overflow:hidden;padding:12px}._CZjuD{overflow:hidden;font-size:0;margin:0;padding:0}._2B2zv{margin:0;padding:0;overflow:hidden}._3eULf{display:flex;padding:0;margin:0;list-style:none;outline:none;position:relative}._2k9Ys{overflow:auto;max-width:100%;scrollbar-width:thin;height:1.2rem}._2k9Ys::-webkit-scrollbar{width:1.1rem;height:1.1rem}._2k9Ys::-webkit-scrollbar-corner{background:transparent}._2k9Ys::-webkit-scrollbar-thumb{border:6px solid transparent;background:rgba(0, 0, 0, 0.2);background:var(--palette-black-alpha-20, rgba(0, 0, 0, 0.2));border-radius:10px;background-clip:padding-box}._2k9Ys::-webkit-scrollbar-thumb:hover{border:4px solid transparent;background:rgba(0, 0, 0, 0.3);background:var(--palette-black-alpha-30, rgba(0, 0, 0, 0.3));background-clip:padding-box}._19jgW{height:1px}._37E9D{display:flex;justify-content:space-around;max-width:330px;place-items:\"center\";text-align:center;align-items:center}._WrYI6{font-weight:bold;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._c53zr{max-width:-moz-max-content;max-width:max-content;padding:0 4px;text-align:right}._2eBO5{position:relative;display:inline-block;width:30px;height:17px}._hiyro{opacity:0;width:0;height:0}._hiyro:checked+._2HI58{background-color:#003b77}._hiyro:checked+._2HI58:before{transform:translateX(13px)}._hiyro:focus+._2HI58{box-shadow:0 0 1px #003b77}._2HI58{-webkit-transition:0.4s;cursor:pointer;background-color:#ccc;bottom:0;border-radius:17px;left:0;position:absolute;right:0;top:0;transition:0.4s}._2HI58:before{-webkit-transition:0.1s;background-color:white;border-radius:50%;bottom:2px;content:\"\";height:13px;left:2px;position:absolute;transition:0.1s;width:13px}._2gSdA{font-size:12px;padding:6px}._2cfRI{font-size:12px}._lEI6r{padding:0 10px;margin-right:10px}._RU6Aa{background:var(--kup-background-color, #ffffff);border:1px solid var(--kup-border-color, #acacac);border-radius:4px;box-sizing:border-box;color:var(--kup-text-color, #595959);cursor:pointer;display:grid;font-weight:400;grid-template-columns:var(--grid-project-columns, 1fr 1fr 1fr);place-items:center}._RU6Aa>*{font-size:14px;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}._RU6Aa ._30j6y{font-weight:700;width:100%;text-align:center}._T0HQN{cursor:pointer;display:grid;border-width:1px;border-style:solid;border-color:#acacac;border-bottom-left-radius:4px;border-bottom-right-radius:4px;box-sizing:border-box;grid-template-columns:var(--grid-fasi-columns, 1fr 1fr 1fr);place-items:center;background:#ffffff;color:#595959;font-weight:400}._T0HQN>*{font-size:12px;line-height:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%}._T0HQN:has(+._T0HQN),._RU6Aa:has(+._T0HQN){border-bottom-left-radius:0;border-bottom-right-radius:0}._yp2DW{cursor:pointer;display:grid;border-width:1px;border-style:solid;border-color:#cbcbcb;border-radius:4px;grid-template-columns:var(--grid-fasi-columns, 1fr 1fr 1fr);place-items:center;background:#fff;color:#595959;font-weight:400;box-sizing:border-box}._yp2DW>*{font-size:14px;line-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}._yp2DW ._30j6y{font-weight:700;width:100%;text-align:center}._3P0WE{display:grid;grid-auto-flow:column;grid-gap:8px;margin-left:12px;width:-moz-max-content;width:max-content}._1oXbe{background:transparent;border-color:var(--kup-primary-color, #003b77);border-radius:4px;border-width:1px;box-shadow:0 3px 1px -2px rgba(var(--kup-text-color-rgb, 51 51 51), 0.2), 0 2px 2px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.14), 0 1px 5px 0 rgba(var(--kup-text-color-rgb, 51 51 51), 0.12);box-sizing:border-box;color:var(--kup-primary-color, #003b77);cursor:pointer;font-size:11px;height:32px;min-width:64px}._1R9mh{font-family:var(--kup-font-family, inherit);font-size:11px;letter-spacing:0.0892857143em;text-decoration:none;text-transform:uppercase;padding:0 6px}:host{display:block}";
12506
+ 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;-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}";
11792
12507
 
11793
- var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11794
- if (kind === "a" && !f)
11795
- throw new TypeError("Private accessor was defined without a getter");
11796
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
11797
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
11798
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11799
- };
11800
12508
  var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11801
12509
  if (kind === "m")
11802
12510
  throw new TypeError("Private method is not writable");
@@ -11806,21 +12514,31 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
11806
12514
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
11807
12515
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11808
12516
  };
11809
- var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_rootPlanner, _KupPlanner_lastOnChangeReceived, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_toDetails, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase, _KupPlanner_handleOnClickOnDetail, _KupPlanner_emitOnChangeEventsReceived;
12517
+ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12518
+ if (kind === "a" && !f)
12519
+ throw new TypeError("Private accessor was defined without a getter");
12520
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
12521
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
12522
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12523
+ };
12524
+ var _KupPlanner_instances, _KupPlanner_kupManager, _KupPlanner_lastOnChangeReceived, _KupPlanner_rootPlanner, _KupPlanner_phases, _KupPlanner_showSecondaryDatesLocal, _KupPlanner_renderReactPlannerElement, _KupPlanner_toTasks, _KupPlanner_toDetails, _KupPlanner_getTask, _KupPlanner_removePhases, _KupPlanner_handleOnClickOnTask, _KupPlanner_handleOnClickOnPhase, _KupPlanner_handleOnClickOnDetail, _KupPlanner_handleOnContextMenuOnTask, _KupPlanner_handleOnContextMenuOnPhase, _KupPlanner_handleOnContextMenuOnDetail, _KupPlanner_emitOnChangeEventsReceived, _KupPlanner_onFilter, _KupPlanner_getIconUrl, _KupPlanner_getIconColor;
11810
12525
  const KupPlanner = class {
11811
12526
  constructor(hostRef) {
11812
12527
  index.registerInstance(this, hostRef);
11813
12528
  this.kupClick = index.createEvent(this, "kup-planner-click", 6);
11814
12529
  this.kupDateChange = index.createEvent(this, "kup-planner-datechange", 6);
11815
12530
  this.kupReady = index.createEvent(this, "kup-planner-ready", 6);
12531
+ this.kupContextMenu = index.createEvent(this, "kup-planner-contextmenu", 6);
11816
12532
  _KupPlanner_instances.add(this);
11817
12533
  /*-------------------------------------------------*/
11818
12534
  /* I n t e r n a l V a r i a b l e s */
11819
12535
  /*-------------------------------------------------*/
11820
12536
  _KupPlanner_kupManager.set(this, kupManager$1.kupManagerInstance());
11821
- _KupPlanner_rootPlanner.set(this, void 0);
11822
12537
  _KupPlanner_lastOnChangeReceived.set(this, void 0);
11823
- this.plannerProps = undefined;
12538
+ _KupPlanner_rootPlanner.set(this, void 0);
12539
+ _KupPlanner_phases.set(this, {});
12540
+ // no re-render
12541
+ _KupPlanner_showSecondaryDatesLocal.set(this, false);
11824
12542
  this.customStyle = '';
11825
12543
  this.data = undefined;
11826
12544
  this.detailData = undefined;
@@ -11828,6 +12546,7 @@ const KupPlanner = class {
11828
12546
  this.detailColumns = undefined;
11829
12547
  this.detailDates = undefined;
11830
12548
  this.detailHeight = undefined;
12549
+ this.detailIconCol = undefined;
11831
12550
  this.detailIdCol = undefined;
11832
12551
  this.detailNameCol = undefined;
11833
12552
  this.detailPrevDates = undefined;
@@ -11837,6 +12556,7 @@ const KupPlanner = class {
11837
12556
  this.phaseColumns = undefined;
11838
12557
  this.phaseColParDep = undefined;
11839
12558
  this.phaseDates = undefined;
12559
+ this.phaseIconCol = undefined;
11840
12560
  this.phaseIdCol = undefined;
11841
12561
  this.phaseNameCol = undefined;
11842
12562
  this.phasePrevDates = undefined;
@@ -11844,25 +12564,23 @@ const KupPlanner = class {
11844
12564
  this.taskColumns = undefined;
11845
12565
  this.taskDates = undefined;
11846
12566
  this.taskHeight = undefined;
12567
+ this.taskIconCol = undefined;
11847
12568
  this.taskIdCol = undefined;
11848
12569
  this.taskNameCol = undefined;
11849
12570
  this.taskPrevDates = undefined;
11850
12571
  this.titleMess = undefined;
12572
+ this.plannerProps = undefined;
11851
12573
  }
11852
- onKupClick(event, taskAction) {
11853
- this.kupClick.emit({
11854
- comp: this,
11855
- id: this.rootElement.id,
11856
- value: event,
11857
- taskAction: taskAction,
11858
- });
12574
+ dataChanged() {
12575
+ __classPrivateFieldSet(this, _KupPlanner_phases, {}, "f");
11859
12576
  }
11860
- onKupDateChange(event) {
11861
- this.kupDateChange.emit({
11862
- comp: this,
11863
- id: this.rootElement.id,
11864
- value: event,
11865
- });
12577
+ showSecondaryDatesChanged() {
12578
+ var _a;
12579
+ __classPrivateFieldSet(this, _KupPlanner_showSecondaryDatesLocal, this.showSecondaryDates, "f");
12580
+ if ((_a = this.plannerProps) === null || _a === void 0 ? void 0 : _a.mainGantt) {
12581
+ this.plannerProps.mainGantt.showSecondaryDates =
12582
+ this.showSecondaryDates;
12583
+ }
11866
12584
  }
11867
12585
  /*-------------------------------------------------*/
11868
12586
  /* P u b l i c M e t h o d s */
@@ -11897,6 +12615,7 @@ const KupPlanner = class {
11897
12615
  var _a;
11898
12616
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
11899
12617
  if (task) {
12618
+ __classPrivateFieldGet(this, _KupPlanner_phases, "f")[taskId] = data;
11900
12619
  task.phases = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.filter((row) => isAtLeastOneDateValid(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]])).map((row) => {
11901
12620
  const datesSanitized = sanitizeAllDates(row.cells[this.phaseDates[0]], row.cells[this.phaseDates[1]], row.cells[this.phasePrevDates[0]], row.cells[this.phasePrevDates[1]]);
11902
12621
  const valuesToShow = getValuesToShow(row, this.phaseIdCol, this.phaseNameCol, data.columns, this.phaseColumns, () => this.phaseColumns.map((col) => col == this.phaseDates[0]
@@ -11904,6 +12623,8 @@ const KupPlanner = class {
11904
12623
  : col == this.phaseDates[1]
11905
12624
  ? '#END#'
11906
12625
  : kupManager$1.getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
12626
+ let iconUrl = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconUrl).call(this, row, this.phaseIconCol);
12627
+ let iconColor = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconColor).call(this, row, this.phaseIconCol);
11907
12628
  let phase = {
11908
12629
  taskRow: task.taskRow,
11909
12630
  phaseRow: row,
@@ -11920,59 +12641,43 @@ const KupPlanner = class {
11920
12641
  selectedColor: row.cells[this.phaseColorCol].value,
11921
12642
  valuesToShow: valuesToShow,
11922
12643
  rowType: KupPlannerGanttRowType.PHASE,
12644
+ icon: iconUrl
12645
+ ? { url: iconUrl, color: iconColor !== null && iconColor !== void 0 ? iconColor : '#595959' }
12646
+ : undefined,
11923
12647
  };
11924
12648
  return phase;
11925
12649
  });
11926
12650
  }
11927
12651
  this.plannerProps = Object.assign({}, this.plannerProps);
11928
12652
  }
11929
- handleOnClick(nativeEvent) {
11930
- console.log('handleOnClick', nativeEvent);
11931
- switch (nativeEvent.rowType) {
11932
- case KupPlannerGanttRowType.TASK:
11933
- const taskAction = nativeEvent.phases
11934
- ? KupPlannerTaskAction.onClosing
11935
- : KupPlannerTaskAction.onOpening;
11936
- if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnTask).call(this, nativeEvent)) {
11937
- this.onKupClick(nativeEvent, taskAction);
11938
- }
11939
- break;
11940
- case KupPlannerGanttRowType.PHASE:
11941
- if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
11942
- this.onKupClick(nativeEvent);
11943
- }
11944
- break;
11945
- case KupPlannerGanttRowType.DETAIL:
11946
- if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
11947
- this.onKupClick(nativeEvent);
11948
- }
11949
- break;
11950
- }
11951
- }
11952
- handleOnDateChange(nativeEvent) {
11953
- if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_emitOnChangeEventsReceived).call(this, nativeEvent)) {
11954
- console.log('handleOnDateChange', nativeEvent);
11955
- this.onKupDateChange(nativeEvent);
11956
- }
11957
- }
12653
+ //---- Lifecycle hooks ----
11958
12654
  componentWillLoad() {
11959
12655
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logLoad(this, false);
11960
12656
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.register(this);
11961
12657
  }
11962
12658
  componentDidLoad() {
12659
+ __classPrivateFieldSet(this, _KupPlanner_showSecondaryDatesLocal, this.showSecondaryDates, "f");
11963
12660
  let details = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, this.detailData);
11964
12661
  if (details && details.length == 0) {
11965
12662
  details = undefined;
11966
12663
  }
12664
+ const mainFilter = this.rootElement.shadowRoot.querySelector('#main-filter');
12665
+ fTextFieldMdc.FTextFieldMDC(mainFilter);
12666
+ const secondaryFilter = this.rootElement.shadowRoot.querySelector('#secondary-filter');
12667
+ if (details) {
12668
+ fTextFieldMdc.FTextFieldMDC(secondaryFilter);
12669
+ }
11967
12670
  this.plannerProps = {
11968
12671
  mainGantt: {
11969
12672
  title: this.titleMess,
11970
12673
  items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, this.data),
11971
12674
  stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
12675
+ filter: mainFilter,
11972
12676
  hideLabel: true,
11973
12677
  ganttHeight: this.taskHeight,
11974
- showSecondaryDates: this.showSecondaryDates,
12678
+ showSecondaryDates: __classPrivateFieldGet(this, _KupPlanner_showSecondaryDatesLocal, "f"),
11975
12679
  onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
12680
+ onContextMenu: (event, row) => this.handleOnContextMenu(event, row),
11976
12681
  onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11977
12682
  },
11978
12683
  secondaryGantt: details
@@ -11980,14 +12685,16 @@ const KupPlanner = class {
11980
12685
  title: '',
11981
12686
  items: details,
11982
12687
  stylingOptions: Object.assign(Object.assign({}, defaultStylingOptions), { listCellWidth: this.listCellWidth }),
12688
+ filter: secondaryFilter,
11983
12689
  hideLabel: true,
11984
12690
  ganttHeight: this.detailHeight,
11985
12691
  onClick: (nativeEvent) => this.handleOnClick(nativeEvent),
12692
+ onContextMenu: (event, row) => this.handleOnContextMenu(event, row),
11986
12693
  onDateChange: (nativeEvent) => this.handleOnDateChange(nativeEvent),
11987
12694
  }
11988
12695
  : undefined,
12696
+ onSetDoubleView: (checked) => this.handleOnSetDoubleView(checked),
11989
12697
  };
11990
- console.log('kup-planner.tsx componentDidLoad plannerProps', this.plannerProps);
11991
12698
  __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_renderReactPlannerElement).call(this);
11992
12699
  this.kupReady.emit({
11993
12700
  comp: this,
@@ -12002,16 +12709,136 @@ const KupPlanner = class {
12002
12709
  componentDidRender() {
12003
12710
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").debug.logRender(this, true);
12004
12711
  }
12712
+ onKupClick(event, taskAction) {
12713
+ this.kupClick.emit({
12714
+ comp: this,
12715
+ id: this.rootElement.id,
12716
+ value: event,
12717
+ taskAction: taskAction,
12718
+ });
12719
+ }
12720
+ onKupContextMenu(event, ganttRow, taskAction) {
12721
+ let row;
12722
+ let cell;
12723
+ let column;
12724
+ switch (ganttRow.type) {
12725
+ case 'project': {
12726
+ row = ganttRow.taskRow;
12727
+ cell = row.cells[this.taskIdCol];
12728
+ column = this.data.columns[this.taskIdCol];
12729
+ break;
12730
+ }
12731
+ case 'task': {
12732
+ row = ganttRow.phaseRow;
12733
+ cell = row.cells[this.phaseIdCol];
12734
+ //column = this.data.columns[this.taskIdCol];
12735
+ break;
12736
+ }
12737
+ case 'timeline': {
12738
+ row = ganttRow.detailRow;
12739
+ cell = row.cells[this.detailIdCol];
12740
+ column = this.data.columns[this.detailIdCol];
12741
+ break;
12742
+ }
12743
+ }
12744
+ this.kupContextMenu.emit({
12745
+ comp: this,
12746
+ id: this.rootElement.id,
12747
+ value: ganttRow,
12748
+ taskAction: taskAction,
12749
+ details: {
12750
+ cell: cell,
12751
+ column: column,
12752
+ originalEvent: event,
12753
+ row: row,
12754
+ },
12755
+ });
12756
+ }
12757
+ onKupDateChange(event, taskAction) {
12758
+ this.kupDateChange.emit({
12759
+ comp: this,
12760
+ id: this.rootElement.id,
12761
+ value: event,
12762
+ taskAction: taskAction,
12763
+ });
12764
+ }
12765
+ handleOnClick(nativeEvent) {
12766
+ switch (nativeEvent.rowType) {
12767
+ case KupPlannerGanttRowType.TASK:
12768
+ const taskAction = nativeEvent.phases
12769
+ ? KupPlannerTaskAction.onTaskClosing
12770
+ : KupPlannerTaskAction.onTaskOpening;
12771
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnTask).call(this, nativeEvent)) {
12772
+ this.onKupClick(nativeEvent, taskAction);
12773
+ }
12774
+ break;
12775
+ case KupPlannerGanttRowType.PHASE:
12776
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnPhase).call(this)) {
12777
+ this.onKupClick(nativeEvent, KupPlannerTaskAction.onClick);
12778
+ }
12779
+ break;
12780
+ case KupPlannerGanttRowType.DETAIL:
12781
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnClickOnDetail).call(this)) {
12782
+ this.onKupClick(nativeEvent, KupPlannerTaskAction.onClick);
12783
+ }
12784
+ break;
12785
+ }
12786
+ }
12787
+ handleOnContextMenu(event, row) {
12788
+ switch (row.rowType) {
12789
+ case KupPlannerGanttRowType.TASK:
12790
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnContextMenuOnTask).call(this)) {
12791
+ this.onKupContextMenu(event, row, KupPlannerTaskAction.onRightClick);
12792
+ }
12793
+ break;
12794
+ case KupPlannerGanttRowType.PHASE:
12795
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnContextMenuOnPhase).call(this)) {
12796
+ this.onKupContextMenu(event, row, KupPlannerTaskAction.onRightClick);
12797
+ }
12798
+ break;
12799
+ case KupPlannerGanttRowType.DETAIL:
12800
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_handleOnContextMenuOnDetail).call(this)) {
12801
+ this.onKupContextMenu(event, row, KupPlannerTaskAction.onRightClick);
12802
+ }
12803
+ break;
12804
+ }
12805
+ }
12806
+ handleOnSetDoubleView(checked) {
12807
+ var _a;
12808
+ __classPrivateFieldSet(this, _KupPlanner_showSecondaryDatesLocal, checked, "f");
12809
+ if ((_a = this.plannerProps) === null || _a === void 0 ? void 0 : _a.mainGantt) {
12810
+ this.plannerProps.mainGantt.showSecondaryDates = checked;
12811
+ }
12812
+ }
12813
+ handleOnDateChange(nativeEvent) {
12814
+ if (__classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_emitOnChangeEventsReceived).call(this, nativeEvent)) {
12815
+ if (nativeEvent.rowType != KupPlannerGanttRowType.DETAIL) {
12816
+ this.onKupDateChange(nativeEvent, KupPlannerTaskAction.onResize);
12817
+ }
12818
+ }
12819
+ }
12005
12820
  render() {
12006
- //console.log('kup-planner.tsx render');
12007
- return (index.h(index.Host, null, index.h("div", { id: GenericVariables.componentWrapperId, style: { maxWidth: this.maxWidth } })));
12821
+ var _a;
12822
+ return (index.h(index.Host, null, index.h("style", null, __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.setKupStyle(this.rootElement)), index.h("div", { id: GenericVariables.componentWrapperId, style: { maxWidth: this.maxWidth } }), index.h(fTextField.FTextField, { icon: kupManager$1.KupThemeIconValues.SEARCH, id: "main-filter", label: __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").language.translate(kupManager$1.KupLanguageSearch.SEARCH), onKeyDown: (e) => {
12823
+ if (e.key === 'Enter') {
12824
+ __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_onFilter).call(this, e);
12825
+ }
12826
+ }, wrapperClass: "filter" }), ((_a = this.detailData) === null || _a === void 0 ? void 0 : _a.rows) && this.detailData.rows.length > 0 ? (index.h(fTextField.FTextField, { icon: kupManager$1.KupThemeIconValues.SEARCH, id: "secondary-filter", label: __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").language.translate(kupManager$1.KupLanguageSearch.SEARCH), onKeyDown: (e) => {
12827
+ if (e.key === 'Enter') {
12828
+ __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_onFilter).call(this, e, true);
12829
+ }
12830
+ }, wrapperClass: "filter" })) : null));
12008
12831
  }
12009
12832
  disconnectedCallback() {
12010
12833
  __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.unregister(this);
12011
12834
  }
12012
12835
  get rootElement() { return index.getElement(this); }
12836
+ static get watchers() { return {
12837
+ "data": ["dataChanged"],
12838
+ "showSecondaryDates": ["showSecondaryDatesChanged"]
12839
+ }; }
12013
12840
  };
12014
- _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_lastOnChangeReceived = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
12841
+ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_lastOnChangeReceived = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_phases = new WeakMap(), _KupPlanner_showSecondaryDatesLocal = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
12015
12842
  var _a;
12016
12843
  (_a = __classPrivateFieldGet(this, _KupPlanner_rootPlanner, "f")) === null || _a === void 0 ? void 0 : _a.unmount();
12017
12844
  const componentWrapperElement = this.rootElement.shadowRoot.getElementById(GenericVariables.componentWrapperId);
@@ -12023,7 +12850,13 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12023
12850
  var _a;
12024
12851
  let tasks = (_a = data.rows) === null || _a === void 0 ? void 0 : _a.filter((row) => isAtLeastOneDateValid(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]])).map((row) => {
12025
12852
  const datesSanitized = sanitizeAllDates(row.cells[this.taskDates[0]], row.cells[this.taskDates[1]], row.cells[this.taskPrevDates[0]], row.cells[this.taskPrevDates[1]]);
12026
- const valuesToShow = getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns);
12853
+ const valuesToShow = getValuesToShow(row, this.taskIdCol, this.taskNameCol, data.columns, this.taskColumns, () => this.taskColumns.map((col) => col == this.taskDates[0]
12854
+ ? '#START#'
12855
+ : col == this.taskDates[1]
12856
+ ? '#END#'
12857
+ : kupManager$1.getCellValueForDisplay(data.columns.find((kCol) => kCol.name == col), row.cells[col])));
12858
+ let iconUrl = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconUrl).call(this, row, this.taskIconCol);
12859
+ let iconColor = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconColor).call(this, row, this.taskIconCol);
12027
12860
  let task = {
12028
12861
  taskRow: row,
12029
12862
  taskRowId: row.id,
@@ -12036,6 +12869,9 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12036
12869
  type: 'project',
12037
12870
  valuesToShow: valuesToShow,
12038
12871
  rowType: KupPlannerGanttRowType.TASK,
12872
+ icon: iconUrl
12873
+ ? { url: iconUrl, color: iconColor !== null && iconColor !== void 0 ? iconColor : '#595959' }
12874
+ : undefined,
12039
12875
  };
12040
12876
  return task;
12041
12877
  });
@@ -12048,6 +12884,7 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12048
12884
  data.rows
12049
12885
  .filter((row) => isAtLeastOneDateValid(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]))
12050
12886
  .forEach((row) => {
12887
+ var _a, _b;
12051
12888
  const detailId = row.cells[this.detailIdCol].value;
12052
12889
  const detailNameId = row.cells[this.detailNameCol].value;
12053
12890
  const datesSanitized = sanitizeAllDates(row.cells[this.detailDates[0]], row.cells[this.detailDates[1]]);
@@ -12057,6 +12894,7 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12057
12894
  detail = {
12058
12895
  id: detailId,
12059
12896
  name: detailNameId,
12897
+ detailRow: row,
12060
12898
  type: 'timeline',
12061
12899
  valuesToShow: valuesToShow,
12062
12900
  rowType: KupPlannerGanttRowType.DETAIL,
@@ -12064,15 +12902,20 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12064
12902
  };
12065
12903
  details.push(detail);
12066
12904
  }
12905
+ let iconUrl = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconUrl).call(this, row, this.detailIconCol);
12906
+ let iconColor = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getIconColor).call(this, row, this.detailIconCol);
12067
12907
  detail.schedule.push({
12068
12908
  startDate: datesSanitized.dateValues[0],
12069
12909
  endDate: datesSanitized.dateValues[1],
12070
12910
  color: this.detailColorCol
12071
- ? row.cells[this.detailColorCol].value
12911
+ ? (_a = row.cells[this.detailColorCol].value) !== null && _a !== void 0 ? _a : '#D9D9D8'
12072
12912
  : '#D9D9D8',
12073
12913
  selectedColor: this.detailColorCol
12074
- ? row.cells[this.detailColorCol].value
12914
+ ? (_b = row.cells[this.detailColorCol].value) !== null && _b !== void 0 ? _b : '#D9D9D8'
12075
12915
  : '#D9D9D8',
12916
+ icon: iconUrl
12917
+ ? { url: iconUrl, color: iconColor !== null && iconColor !== void 0 ? iconColor : '#595959' }
12918
+ : undefined,
12076
12919
  });
12077
12920
  });
12078
12921
  return details;
@@ -12082,9 +12925,6 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12082
12925
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, taskId);
12083
12926
  if (task)
12084
12927
  task.phases = undefined;
12085
- // this.plannerProps.mainGantt = JSON.parse(
12086
- // JSON.stringify(this.plannerProps.mainGantt)
12087
- // );
12088
12928
  this.plannerProps = Object.assign({}, this.plannerProps);
12089
12929
  }, _KupPlanner_handleOnClickOnTask = function _KupPlanner_handleOnClickOnTask(nativeEvent) {
12090
12930
  const task = __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_getTask).call(this, nativeEvent.id);
@@ -12096,6 +12936,12 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12096
12936
  return true;
12097
12937
  }, _KupPlanner_handleOnClickOnDetail = function _KupPlanner_handleOnClickOnDetail() {
12098
12938
  return true;
12939
+ }, _KupPlanner_handleOnContextMenuOnTask = function _KupPlanner_handleOnContextMenuOnTask() {
12940
+ return true;
12941
+ }, _KupPlanner_handleOnContextMenuOnPhase = function _KupPlanner_handleOnContextMenuOnPhase() {
12942
+ return true;
12943
+ }, _KupPlanner_handleOnContextMenuOnDetail = function _KupPlanner_handleOnContextMenuOnDetail() {
12944
+ return true;
12099
12945
  }, _KupPlanner_emitOnChangeEventsReceived = function _KupPlanner_emitOnChangeEventsReceived(nativeEvent) {
12100
12946
  let emitEvent = false;
12101
12947
  if (!__classPrivateFieldGet(this, _KupPlanner_lastOnChangeReceived, "f")) {
@@ -12107,6 +12953,69 @@ _KupPlanner_kupManager = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(),
12107
12953
  emitEvent = true;
12108
12954
  }
12109
12955
  return emitEvent;
12956
+ }, _KupPlanner_onFilter = function _KupPlanner_onFilter(e, isDetail) {
12957
+ const tempData = {
12958
+ columns: this.data.columns,
12959
+ rows: [],
12960
+ };
12961
+ const value = e.target.value;
12962
+ const data = isDetail ? this.detailData : this.data;
12963
+ const tempRows = [];
12964
+ for (let index = 0; index < data.rows.length; index++) {
12965
+ const row = data.rows[index];
12966
+ const cells = row.cells;
12967
+ for (let index = 0; index < data.columns.length; index++) {
12968
+ const column = data.columns[index];
12969
+ const cell = cells[column.name];
12970
+ if (cell) {
12971
+ const dValue = kupManager$1.getCellValueForDisplay(data.columns[index], cell);
12972
+ const found = !!(dValue.toLowerCase().indexOf(value.toLowerCase()) > -1);
12973
+ if (found) {
12974
+ tempRows.push({ row, weight: index });
12975
+ break;
12976
+ }
12977
+ }
12978
+ }
12979
+ }
12980
+ tempRows
12981
+ .sort((a, b) => a.weight - b.weight)
12982
+ .forEach((tempRow) => {
12983
+ tempData.rows.push(tempRow.row);
12984
+ });
12985
+ const newGantt = isDetail
12986
+ ? {
12987
+ secondaryGantt: Object.assign(Object.assign({}, this.plannerProps.secondaryGantt), { items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toDetails).call(this, tempData) }),
12988
+ }
12989
+ : {
12990
+ mainGantt: Object.assign(Object.assign({}, this.plannerProps.mainGantt), { items: __classPrivateFieldGet(this, _KupPlanner_instances, "m", _KupPlanner_toTasks).call(this, tempData) }),
12991
+ };
12992
+ this.plannerProps = Object.assign(Object.assign({}, this.plannerProps), newGantt);
12993
+ }, _KupPlanner_getIconUrl = function _KupPlanner_getIconUrl(row, columnName) {
12994
+ var _a;
12995
+ let iconUrl = undefined;
12996
+ if (columnName) {
12997
+ const iconCell = row.cells[columnName];
12998
+ let icon = (_a = iconCell === null || iconCell === void 0 ? void 0 : iconCell.data) === null || _a === void 0 ? void 0 : _a.resource;
12999
+ if (!icon) {
13000
+ icon = iconCell.value;
13001
+ }
13002
+ if (icon) {
13003
+ iconUrl = index.getAssetPath('./assets/svg/' + icon + '.svg');
13004
+ }
13005
+ }
13006
+ return iconUrl;
13007
+ }, _KupPlanner_getIconColor = function _KupPlanner_getIconColor(row, columnName) {
13008
+ var _a;
13009
+ let iconColor = undefined;
13010
+ if (columnName) {
13011
+ const iconCell = row.cells[columnName];
13012
+ iconColor = (_a = iconCell === null || iconCell === void 0 ? void 0 : iconCell.data) === null || _a === void 0 ? void 0 : _a.color;
13013
+ if (iconColor) {
13014
+ iconColor =
13015
+ __classPrivateFieldGet(this, _KupPlanner_kupManager, "f").theme.colorCheck(iconColor).hexColor;
13016
+ }
13017
+ }
13018
+ return iconColor;
12110
13019
  };
12111
13020
  KupPlanner.style = kupPlannerCss;
12112
13021