@seniorsistemas/angular-components 17.1.3 → 17.1.4

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 (34) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +178 -71
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/gantt/components/gantt/bar.d.ts +1 -0
  6. package/components/gantt/components/gantt/gantt.d.ts +1 -1
  7. package/components/gantt/components/gantt/popup.d.ts +4 -1
  8. package/components/gantt/gantt.component.d.ts +9 -1
  9. package/components/gantt/models/options.d.ts +5 -0
  10. package/components/gantt/models/view-mode.d.ts +2 -2
  11. package/esm2015/components/gantt/components/gantt/bar.js +61 -33
  12. package/esm2015/components/gantt/components/gantt/gantt-options.js +5 -1
  13. package/esm2015/components/gantt/components/gantt/gantt.js +44 -31
  14. package/esm2015/components/gantt/components/gantt/popup.js +37 -5
  15. package/esm2015/components/gantt/components/side-table/side-table.component.js +3 -3
  16. package/esm2015/components/gantt/gantt.component.js +41 -4
  17. package/esm2015/components/gantt/gantt.module.js +3 -2
  18. package/esm2015/components/gantt/models/options.js +1 -1
  19. package/esm2015/components/gantt/models/view-mode.js +2 -2
  20. package/esm5/components/gantt/components/gantt/bar.js +62 -34
  21. package/esm5/components/gantt/components/gantt/gantt-options.js +5 -1
  22. package/esm5/components/gantt/components/gantt/gantt.js +43 -30
  23. package/esm5/components/gantt/components/gantt/popup.js +30 -5
  24. package/esm5/components/gantt/components/side-table/side-table.component.js +3 -3
  25. package/esm5/components/gantt/gantt.component.js +41 -4
  26. package/esm5/components/gantt/gantt.module.js +3 -2
  27. package/esm5/components/gantt/models/options.js +1 -1
  28. package/esm5/components/gantt/models/view-mode.js +2 -2
  29. package/fesm2015/seniorsistemas-angular-components.js +186 -72
  30. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  31. package/fesm5/seniorsistemas-angular-components.js +178 -71
  32. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  33. package/package.json +1 -1
  34. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -9110,17 +9110,18 @@
9110
9110
 
9111
9111
 
9112
9112
  (function (ViewMode) {
9113
+ ViewMode["Hour"] = "hour";
9113
9114
  ViewMode["QuarterDay"] = "quarterDay";
9114
9115
  ViewMode["HalfDay"] = "halfDay";
9115
9116
  ViewMode["Day"] = "day";
9116
9117
  ViewMode["Week"] = "week";
9117
9118
  ViewMode["Month"] = "month";
9118
9119
  ViewMode["Year"] = "year";
9119
- ViewMode["Hour"] = "hour";
9120
9120
  })(exports.ViewMode || (exports.ViewMode = {}));
9121
9121
 
9122
9122
  var Bar = /** @class */ (function () {
9123
9123
  function Bar(gantt, task) {
9124
+ this._isPopUpOpen = false;
9124
9125
  this._setDefaults(gantt, task);
9125
9126
  this._prepare();
9126
9127
  this._draw();
@@ -9291,38 +9292,62 @@
9291
9292
  }
9292
9293
  };
9293
9294
  Bar.prototype._setupClickEvent = function () {
9295
+ //TODO
9294
9296
  var _this = this;
9295
- $.on(this.group, "focus " + this._gantt.options.popupTrigger, function (e) {
9296
- // just finished a move action, wait for a few seconds
9297
- if (!_this._actionCompleted) {
9298
- _this._showPopup();
9299
- _this._gantt.unselect_all();
9300
- _this.group.classList.add("active");
9301
- }
9302
- }, null);
9303
- $.on(this.group, "dblclick", function (e) {
9304
- // just finished a move action, wait for a few seconds
9305
- if (!_this._actionCompleted) {
9306
- _this._gantt.trigger_event("onClick", [_this.task]);
9307
- }
9308
- }, null);
9297
+ if (this._gantt.options.hasPopup) {
9298
+ $.on(this.group, "focus " + this._gantt.options.popupTrigger, function (e) {
9299
+ // just finished a move action, wait for a few seconds
9300
+ if (!_this._actionCompleted) {
9301
+ _this._showPopup();
9302
+ _this._gantt.unselect_all();
9303
+ _this.group.classList.add("active");
9304
+ }
9305
+ }, null);
9306
+ $.on(this.group, "dblclick", function (e) {
9307
+ // just finished a move action, wait for a few seconds
9308
+ if (!_this._actionCompleted) {
9309
+ _this._gantt.trigger_event("onClick", [_this.task]);
9310
+ }
9311
+ }, null);
9312
+ }
9313
+ else {
9314
+ $.on(this.group, "mouseenter", function (e) {
9315
+ if (!_this._isPopUpOpen) {
9316
+ _this._showPopup({
9317
+ x: e.clientX,
9318
+ y: _this.group.getBoundingClientRect().top + 30,
9319
+ position: 'middle'
9320
+ });
9321
+ _this._isPopUpOpen = true;
9322
+ }
9323
+ }, null);
9324
+ $.on(this.group, "mouseleave", function (e) {
9325
+ _this._gantt.hide_popup();
9326
+ _this._isPopUpOpen = false;
9327
+ }, null);
9328
+ $.on(this.group, "focus click", function (e) {
9329
+ if (!_this._actionCompleted) {
9330
+ _this._gantt.unselect_all();
9331
+ _this.group.classList.add("active");
9332
+ _this._gantt.trigger_event("onClick", [_this.task]);
9333
+ }
9334
+ }, null);
9335
+ }
9309
9336
  };
9310
- Bar.prototype._showPopup = function () {
9337
+ Bar.prototype._showPopup = function (args) {
9311
9338
  if (this._gantt.bar_being_dragged) {
9312
9339
  return;
9313
9340
  }
9314
- var formatString = this._gantt.view_is(exports.ViewMode.Hour)
9315
- ? "HH:ss"
9316
- : "MMM D";
9317
- var start_date = DateUtils.format(this.task.start, formatString, this._gantt.options.language);
9318
- var end_date = DateUtils.format(DateUtils.add(this.task.end, -1, "second"), formatString, this._gantt.options.language);
9319
- var subtitle = start_date + " - " + end_date;
9320
- this._gantt.show_popup({
9321
- target_element: this.element,
9322
- title: this.task.name,
9323
- subtitle: subtitle,
9324
- task: this.task,
9325
- });
9341
+ var subtitle = {};
9342
+ if (!this._gantt.options.showOnlyHours) {
9343
+ subtitle.startDate = DateUtils.format(this.task.start, 'DD/MM/YYYY', this._gantt.options.language);
9344
+ subtitle.endDate = DateUtils.format(this.task.end, 'DD/MM/YYYY', this._gantt.options.language);
9345
+ }
9346
+ if (!this._gantt.options.showOnlyDays) {
9347
+ subtitle.startHour = DateUtils.format(this.task.start, 'HH:mm:ss', this._gantt.options.language);
9348
+ subtitle.endHour = DateUtils.format(this.task.end, 'HH:mm:ss', this._gantt.options.language);
9349
+ }
9350
+ this._gantt.show_popup(__assign({ target_element: this.element, title: this.task.name, subtitle: subtitle, task: this.task }, args));
9326
9351
  };
9327
9352
  Bar.prototype._computeStartEndDate = function () {
9328
9353
  var bar = this.element;
@@ -9334,11 +9359,14 @@
9334
9359
  };
9335
9360
  Bar.prototype._computeX = function () {
9336
9361
  var _a = this._gantt.options, step = _a.step, columnWidth = _a.columnWidth;
9337
- var diff = DateUtils.diff(this.task.start, this._gantt.minDate, "hour");
9338
- var x = (diff / step) * columnWidth;
9339
- if (this._gantt.view_is(exports.ViewMode.Month)) {
9340
- var diff_1 = DateUtils.diff(this.task.start, this._gantt.minDate, "day");
9341
- x = (diff_1 * columnWidth) / 30;
9362
+ var x;
9363
+ if (this._gantt.view_is([exports.ViewMode.Hour, exports.ViewMode.QuarterDay, exports.ViewMode.HalfDay, exports.ViewMode.Day])) {
9364
+ var diff = DateUtils.diff(this.task.start, this._gantt.minDate, "minutes");
9365
+ x = (diff / step) * (columnWidth / 60);
9366
+ }
9367
+ else {
9368
+ var diff = DateUtils.diff(this.task.start, this._gantt.minDate, "hour");
9369
+ x = (diff / step) * (columnWidth);
9342
9370
  }
9343
9371
  return x;
9344
9372
  };
@@ -9392,6 +9420,7 @@
9392
9420
  this.make();
9393
9421
  }
9394
9422
  Popup.prototype.show = function (options) {
9423
+ var _a, _b, _c, _d;
9395
9424
  if (!options.target_element) {
9396
9425
  throw new Error("target_element is required to show popup");
9397
9426
  }
@@ -9399,6 +9428,7 @@
9399
9428
  options.position = "left";
9400
9429
  }
9401
9430
  var target_element = options.target_element;
9431
+ this.parent.style.display = 'block';
9402
9432
  if (this.customHtml) {
9403
9433
  var html = this.customHtml(options.task);
9404
9434
  html += '<div class="pointer"></div>';
@@ -9408,7 +9438,10 @@
9408
9438
  else {
9409
9439
  // set data
9410
9440
  this.title.innerHTML = options.title;
9411
- this.subtitle.innerHTML = options.subtitle;
9441
+ this.startDate.innerHTML = (_a = options.subtitle.startDate) !== null && _a !== void 0 ? _a : '';
9442
+ this.startHour.innerHTML = (_b = options.subtitle.startHour) !== null && _b !== void 0 ? _b : '';
9443
+ this.endDate.innerHTML = (_c = options.subtitle.endDate) !== null && _c !== void 0 ? _c : '';
9444
+ this.endHour.innerHTML = (_d = options.subtitle.endHour) !== null && _d !== void 0 ? _d : '';
9412
9445
  this.parent.style.width = this.parent.clientWidth + "px";
9413
9446
  }
9414
9447
  // set position
@@ -9419,7 +9452,23 @@
9419
9452
  else if (target_element instanceof SVGElement) {
9420
9453
  positionMeta = options.target_element.getBBox();
9421
9454
  }
9422
- if (options.position === 'left') {
9455
+ if (options.position === 'middle') {
9456
+ this.parent.style.position = 'fixed';
9457
+ this.parent.style.top = options.y + "px";
9458
+ this.pointer.style.transform = "rotateZ(180deg)";
9459
+ this.pointer.style.top = "-10px";
9460
+ if ((options.x - 17) + this.parent.offsetWidth > window.innerWidth) {
9461
+ this.parent.style.left = (options.x - this.parent.offsetWidth + 17) + "px";
9462
+ this.pointer.style.right = "16px";
9463
+ this.pointer.style.left = "auto";
9464
+ }
9465
+ else {
9466
+ this.parent.style.left = (options.x - 17) + "px";
9467
+ this.pointer.style.left = "16px";
9468
+ this.pointer.style.right = "auto";
9469
+ }
9470
+ }
9471
+ else if (options.position === 'left') {
9423
9472
  this.parent.style.left = positionMeta.x + (positionMeta.width + 10) + "px";
9424
9473
  this.parent.style.top = positionMeta.y + "px";
9425
9474
  this.pointer.style.transform = "rotateZ(90deg)";
@@ -9430,14 +9479,18 @@
9430
9479
  this.parent.style.opacity = 1;
9431
9480
  };
9432
9481
  Popup.prototype.make = function () {
9433
- this.parent.innerHTML = "\n <div class=\"popup\">\n <div class=\"wrp-title\">\n <span class=\"title\"></span>\n </div>\n <div class=\"wrp-subtitle\">\n <span class=\"icon fas fa-calendar-alt\"></span>\n <span class=\"subtitle\"></span>\n </div>\n <div class=\"pointer\"></div>\n </div>\n ";
9482
+ this.parent.innerHTML = "\n <div class=\"popup\">\n <div class=\"wrp-title\">\n <span class=\"title\"></span>\n </div>\n <div class=\"wrp-subtitle\">\n <span class=\"icon fas fa-calendar-alt\"></span>\n <div style=\"margin-right: 15px\">\n <p class=\"startDate\"></p>\n <p class=\"startHour\"></p>\n </div>\n <div>\n <p class=\"endDate\"></p>\n <p class=\"endHour\"></p>\n </div>\n </div>\n <div class=\"pointer\"></div>\n </div>\n ";
9434
9483
  this.hide();
9435
9484
  this.title = this.parent.querySelector(".title");
9436
- this.subtitle = this.parent.querySelector(".subtitle");
9485
+ this.startDate = this.parent.querySelector(".startDate");
9486
+ this.startHour = this.parent.querySelector(".startHour");
9487
+ this.endDate = this.parent.querySelector(".endDate");
9488
+ this.endHour = this.parent.querySelector(".endHour");
9437
9489
  this.pointer = this.parent.querySelector(".pointer");
9438
9490
  };
9439
9491
  Popup.prototype.hide = function () {
9440
9492
  this.parent.style.opacity = 0;
9493
+ this.parent.style.display = 'none';
9441
9494
  this.parent.style.left = 0;
9442
9495
  };
9443
9496
  return Popup;
@@ -9535,12 +9588,16 @@
9535
9588
  popupTrigger: "click",
9536
9589
  customPopupHtml: null,
9537
9590
  language: "en",
9591
+ allowMovement: true,
9592
+ hasPopup: true,
9593
+ showOnlyHours: false,
9594
+ showOnlyDays: false,
9538
9595
  };
9539
9596
 
9540
9597
  var Gantt = /** @class */ (function () {
9541
9598
  function Gantt(wrapper, tasks, options) {
9542
- this.setup_wrapper(wrapper);
9543
9599
  this.setup_options(options);
9600
+ this.setup_wrapper(wrapper);
9544
9601
  this.setup_tasks(tasks);
9545
9602
  // initialize with default view mode
9546
9603
  this.change_view_mode();
@@ -9592,6 +9649,9 @@
9592
9649
  // wrapper element
9593
9650
  this.$container = document.createElement("div");
9594
9651
  this.$container.classList.add("gantt-container");
9652
+ if (this.options.containerWidth) {
9653
+ this.$container.style.width = this.options.containerWidth + 'px';
9654
+ }
9595
9655
  var parent_element = this.$svg.parentElement;
9596
9656
  parent_element.appendChild(this.$container);
9597
9657
  this.$container.appendChild(this.$svg);
@@ -9697,6 +9757,7 @@
9697
9757
  };
9698
9758
  Gantt.prototype.change_view_mode = function (mode) {
9699
9759
  if (mode === void 0) { mode = this.options.viewMode; }
9760
+ this.setup_gantt_dates();
9700
9761
  this.update_view_scale(mode);
9701
9762
  this.setup_dates();
9702
9763
  this.render();
@@ -9709,7 +9770,6 @@
9709
9770
  if (view_mode === exports.ViewMode.Hour) {
9710
9771
  this.options.step = 24 / 24;
9711
9772
  this.options.columnWidth = 50;
9712
- // this.isHourView = true;
9713
9773
  }
9714
9774
  else if (view_mode === exports.ViewMode.Day) {
9715
9775
  this.options.step = 24;
@@ -9737,7 +9797,6 @@
9737
9797
  }
9738
9798
  };
9739
9799
  Gantt.prototype.setup_dates = function () {
9740
- this.setup_gantt_dates();
9741
9800
  this.setup_date_values();
9742
9801
  };
9743
9802
  Gantt.prototype.setup_gantt_dates = function () {
@@ -9750,7 +9809,7 @@
9750
9809
  var task = _s.value;
9751
9810
  // set global start and end date
9752
9811
  if (!this.minDate || task.start < this.minDate) {
9753
- this._minDate = task.start;
9812
+ this._minDate = DateUtils.startOf(task.start, 'day');
9754
9813
  }
9755
9814
  if (!this.maxDate || task.end > this.maxDate) {
9756
9815
  this._maxDate = task.end;
@@ -9772,28 +9831,28 @@
9772
9831
  this._maxDate = DateUtils.add(this.maxDate, (_c = this.options.marginAfterEnd) !== null && _c !== void 0 ? _c : 1, "hour");
9773
9832
  break;
9774
9833
  case exports.ViewMode.QuarterDay:
9775
- this._minDate = DateUtils.add(this.minDate, -((_d = this.options.marginBeforeStart) !== null && _d !== void 0 ? _d : 12), "hour");
9776
- this._maxDate = DateUtils.add(this.maxDate, (_e = this.options.marginAfterEnd) !== null && _e !== void 0 ? _e : 12, "hour");
9834
+ this._minDate = DateUtils.add(this.minDate, -((_d = this.options.marginBeforeStart) !== null && _d !== void 0 ? _d : 6), "hour");
9835
+ this._maxDate = DateUtils.add(this.maxDate, (_e = this.options.marginAfterEnd) !== null && _e !== void 0 ? _e : 6, "hour");
9777
9836
  break;
9778
9837
  case exports.ViewMode.HalfDay:
9779
- this._minDate = DateUtils.add(this.minDate, -((_f = this.options.marginBeforeStart) !== null && _f !== void 0 ? _f : 1), "day");
9780
- this._maxDate = DateUtils.add(this.maxDate, (_g = this.options.marginAfterEnd) !== null && _g !== void 0 ? _g : 1, "day");
9838
+ this._minDate = DateUtils.add(this.minDate, -((_f = this.options.marginBeforeStart) !== null && _f !== void 0 ? _f : 12), "hour");
9839
+ this._maxDate = DateUtils.add(this.maxDate, (_g = this.options.marginAfterEnd) !== null && _g !== void 0 ? _g : 12, "hour");
9781
9840
  break;
9782
9841
  case exports.ViewMode.Day:
9783
- this._minDate = DateUtils.add(this.minDate, -((_h = this.options.marginBeforeStart) !== null && _h !== void 0 ? _h : 3), "day");
9784
- this._maxDate = DateUtils.add(this.maxDate, (_j = this.options.marginAfterEnd) !== null && _j !== void 0 ? _j : 3, "day");
9842
+ this._minDate = DateUtils.add(this.minDate, -((_h = this.options.marginBeforeStart) !== null && _h !== void 0 ? _h : 1), "day");
9843
+ this._maxDate = DateUtils.add(this.maxDate, (_j = this.options.marginAfterEnd) !== null && _j !== void 0 ? _j : 1, "day");
9785
9844
  break;
9786
9845
  case exports.ViewMode.Week:
9787
- this._minDate = DateUtils.add(this.minDate, -((_k = this.options.marginBeforeStart) !== null && _k !== void 0 ? _k : 1), "month");
9788
- this._maxDate = DateUtils.add(this.maxDate, (_l = this.options.marginAfterEnd) !== null && _l !== void 0 ? _l : 1, "month");
9846
+ this._minDate = DateUtils.add(this.minDate, -((_k = this.options.marginBeforeStart) !== null && _k !== void 0 ? _k : 1), "week");
9847
+ this._maxDate = DateUtils.add(this.maxDate, (_l = this.options.marginAfterEnd) !== null && _l !== void 0 ? _l : 1, "week");
9789
9848
  break;
9790
9849
  case exports.ViewMode.Month:
9791
- this._minDate = DateUtils.add(this.minDate, -((_m = this.options.marginBeforeStart) !== null && _m !== void 0 ? _m : 1), "year");
9792
- this._maxDate = DateUtils.add(this.maxDate, (_o = this.options.marginAfterEnd) !== null && _o !== void 0 ? _o : 1, "year");
9850
+ this._minDate = DateUtils.add(this.minDate, -((_m = this.options.marginBeforeStart) !== null && _m !== void 0 ? _m : 1), "month");
9851
+ this._maxDate = DateUtils.add(this.maxDate, (_o = this.options.marginAfterEnd) !== null && _o !== void 0 ? _o : 1, "month");
9793
9852
  break;
9794
9853
  case exports.ViewMode.Year:
9795
- this._minDate = DateUtils.add(this.minDate, -((_p = this.options.marginBeforeStart) !== null && _p !== void 0 ? _p : 2), "year");
9796
- this._maxDate = DateUtils.add(this.maxDate, (_q = this.options.marginAfterEnd) !== null && _q !== void 0 ? _q : 2, "year");
9854
+ this._minDate = DateUtils.add(this.minDate, -((_p = this.options.marginBeforeStart) !== null && _p !== void 0 ? _p : 1), "year");
9855
+ this._maxDate = DateUtils.add(this.maxDate, (_q = this.options.marginAfterEnd) !== null && _q !== void 0 ? _q : 1, "year");
9797
9856
  break;
9798
9857
  }
9799
9858
  };
@@ -9817,6 +9876,10 @@
9817
9876
  }
9818
9877
  this.dates.push(cur_date);
9819
9878
  }
9879
+ if (this.options.containerWidth) {
9880
+ var columnWidth = (this.options.containerWidth - 1) / this.dates.length;
9881
+ this.options.columnWidth = columnWidth < 45 ? 45 : columnWidth;
9882
+ }
9820
9883
  console.log("cur_date", cur_date);
9821
9884
  console.log("dates", this.dates);
9822
9885
  };
@@ -9866,6 +9929,9 @@
9866
9929
  };
9867
9930
  Gantt.prototype.make_grid_background = function () {
9868
9931
  var grid_width = this.dates.length * this.options.columnWidth;
9932
+ if (this.options.containerWidth) {
9933
+ grid_width = this.options.containerWidth;
9934
+ }
9869
9935
  var distinct_rows = __spread(new Set(this.tasks.map(function (x) { return x._row_id; })));
9870
9936
  var grid_height = this.options.headerHeight +
9871
9937
  this.options.padding / 2 +
@@ -9949,6 +10015,11 @@
9949
10015
  if (this.view_is(exports.ViewMode.Month) && date.getMonth() % 3 === 0) {
9950
10016
  tick_class += " thick";
9951
10017
  }
10018
+ // Thick ticks for hours
10019
+ if (this.view_is(exports.ViewMode.Hour) &&
10020
+ date.getHours() == 0) {
10021
+ tick_class += " thick";
10022
+ }
9952
10023
  createSVG("path", {
9953
10024
  d: "M " + tick_x + " " + tick_y + " v " + tick_height,
9954
10025
  class: tick_class,
@@ -10077,9 +10148,7 @@
10077
10148
  hourLower: DateUtils.format(date, "HH:mm", this.options.language),
10078
10149
  quarterDayLower: DateUtils.format(date, "HH:mm", this.options.language),
10079
10150
  halfDayLower: DateUtils.format(date, "HH:mm", this.options.language),
10080
- dayLower: date.getDate() !== last_date.getDate()
10081
- ? DateUtils.format(date, "D", this.options.language)
10082
- : "",
10151
+ dayLower: DateUtils.format(date, "D", this.options.language),
10083
10152
  weekLower: date.getMonth() !== last_date.getMonth()
10084
10153
  ? DateUtils.format(date, "D MMM", this.options.language)
10085
10154
  : DateUtils.format(date, "D", this.options.language),
@@ -10088,12 +10157,12 @@
10088
10157
  quarterDayUpper: date.getDate() !== last_date.getDate()
10089
10158
  ? DateUtils.format(date, "D MMM", this.options.language)
10090
10159
  : "",
10091
- halfDayUpper: date.getDate() !== last_date.getDate()
10092
- ? date.getMonth() !== last_date.getMonth()
10160
+ halfDayUpper: (date.getDate() !== last_date.getDate())
10161
+ ? (((date.getMonth() !== last_date.getMonth()) || i < 2)
10093
10162
  ? DateUtils.format(date, "D MMM", this.options.language)
10094
- : DateUtils.format(date, "D", this.options.language)
10163
+ : DateUtils.format(date, "D", this.options.language))
10095
10164
  : "",
10096
- dayUpper: date.getMonth() !== last_date.getMonth()
10165
+ dayUpper: ((date.getMonth() !== last_date.getMonth()) || i === 0)
10097
10166
  ? DateUtils.format(date, "MMMM", this.options.language)
10098
10167
  : "",
10099
10168
  weekUpper: date.getMonth() !== last_date.getMonth()
@@ -10105,8 +10174,8 @@
10105
10174
  yearUpper: date.getFullYear() !== last_date.getFullYear()
10106
10175
  ? DateUtils.format(date, "YYYY", this.options.language)
10107
10176
  : "",
10108
- hour: date.getHours() !== last_date.getHours()
10109
- ? DateUtils.format(date, "HH:mm", this.options.language)
10177
+ hourUpper: date.getDate() !== last_date.getDate()
10178
+ ? DateUtils.format(date, "D MMM", this.options.language)
10110
10179
  : "",
10111
10180
  };
10112
10181
  // Descontando 20 para adcionar uma segunda linha de informação no cabeçalho
@@ -10115,15 +10184,16 @@
10115
10184
  lower_y: this.options.headerHeight - 20,
10116
10185
  upper_y: this.options.headerHeight - 20 - 25,
10117
10186
  };
10187
+ debugger;
10118
10188
  var x_pos = {
10119
10189
  hourLower: this.options.columnWidth / 2,
10120
- hourUpper: this.options.columnWidth * 24 / 2,
10190
+ hourUpper: (this.dates.length < 14) ? (this.options.columnWidth) : (this.options.columnWidth * 24 / 2),
10121
10191
  quarterDayLower: this.options.columnWidth / 2,
10122
10192
  quarterDayUpper: this.options.columnWidth * 4 / 2,
10123
10193
  halfDayLower: this.options.columnWidth / 2,
10124
10194
  halfDayUpper: this.options.columnWidth * 2 / 2,
10125
10195
  dayLower: this.options.columnWidth / 2,
10126
- dayUpper: (this.options.columnWidth * 30) / 2,
10196
+ dayUpper: (this.dates.length < 15) ? (this.options.columnWidth) : ((this.options.columnWidth * 30) / 2),
10127
10197
  weekLower: 0,
10128
10198
  weekUpper: (this.options.columnWidth * 4) / 2,
10129
10199
  monthLower: this.options.columnWidth / 2,
@@ -10253,7 +10323,7 @@
10253
10323
  else if (element.classList.contains("right")) {
10254
10324
  is_resizing_right = true;
10255
10325
  }
10256
- else if (element.classList.contains("bar-wrapper")) {
10326
+ else if (element.classList.contains("bar-wrapper") && _this.options.allowMovement) {
10257
10327
  is_dragging = true;
10258
10328
  }
10259
10329
  bar_wrapper.classList.add("active");
@@ -10307,7 +10377,7 @@
10307
10377
  });
10308
10378
  }, null);
10309
10379
  document.addEventListener("mouseup", function (e) {
10310
- if (is_dragging || is_resizing_left || is_resizing_right) {
10380
+ if (is_dragging || is_resizing_left || is_resizing_right || !_this.options.allowMovement) {
10311
10381
  bars.forEach(function (bar) { return bar.group.classList.remove("active"); });
10312
10382
  }
10313
10383
  is_dragging = false;
@@ -10416,6 +10486,11 @@
10416
10486
  this.multipleTaskPerLine = false;
10417
10487
  this.showSideTable = true;
10418
10488
  this.viewMode = exports.ViewMode.Day;
10489
+ this.allowMovement = true;
10490
+ this.hasPopup = true;
10491
+ this.fullWidth = false;
10492
+ this.showOnlyHours = false;
10493
+ this.showOnlyDays = false;
10419
10494
  this.taskClicked = new core.EventEmitter();
10420
10495
  this.taskDateChanged = new core.EventEmitter();
10421
10496
  this.viewChanged = new core.EventEmitter();
@@ -10425,11 +10500,19 @@
10425
10500
  };
10426
10501
  GanttComponent.prototype.ngAfterViewInit = function () {
10427
10502
  var _this = this;
10503
+ if (this.fullWidth) {
10504
+ this.containerWidth = this.outer.nativeElement.offsetWidth - this.side.nativeElement.offsetWidth;
10505
+ }
10428
10506
  this._gantt = new Gantt("#gantt", this._filterTask(this.tasks), {
10429
10507
  viewMode: this.viewMode,
10430
10508
  marginBeforeStart: this.marginBeforeStart,
10431
10509
  marginAfterEnd: this.marginAfterEnd,
10432
10510
  language: "pt-BR",
10511
+ allowMovement: this.allowMovement,
10512
+ hasPopup: this.hasPopup,
10513
+ containerWidth: this.containerWidth,
10514
+ showOnlyHours: this.showOnlyHours,
10515
+ showOnlyDays: this.showOnlyDays,
10433
10516
  onClick: function (task) { return _this.taskClicked.emit(task); },
10434
10517
  onDateChange: function (task, start, end) { return _this.taskDateChanged.emit({ task: task, start: start, end: end }); },
10435
10518
  onViewChange: function (viewMode) { return _this.viewChanged.emit(viewMode); },
@@ -10500,6 +10583,24 @@
10500
10583
  __decorate([
10501
10584
  core.Input()
10502
10585
  ], GanttComponent.prototype, "marginAfterEnd", void 0);
10586
+ __decorate([
10587
+ core.Input()
10588
+ ], GanttComponent.prototype, "allowMovement", void 0);
10589
+ __decorate([
10590
+ core.Input()
10591
+ ], GanttComponent.prototype, "hasPopup", void 0);
10592
+ __decorate([
10593
+ core.Input()
10594
+ ], GanttComponent.prototype, "containerWidth", void 0);
10595
+ __decorate([
10596
+ core.Input()
10597
+ ], GanttComponent.prototype, "fullWidth", void 0);
10598
+ __decorate([
10599
+ core.Input()
10600
+ ], GanttComponent.prototype, "showOnlyHours", void 0);
10601
+ __decorate([
10602
+ core.Input()
10603
+ ], GanttComponent.prototype, "showOnlyDays", void 0);
10503
10604
  __decorate([
10504
10605
  core.Output()
10505
10606
  ], GanttComponent.prototype, "taskClicked", void 0);
@@ -10509,12 +10610,18 @@
10509
10610
  __decorate([
10510
10611
  core.Output()
10511
10612
  ], GanttComponent.prototype, "viewChanged", void 0);
10613
+ __decorate([
10614
+ core.ViewChild('outer')
10615
+ ], GanttComponent.prototype, "outer", void 0);
10616
+ __decorate([
10617
+ core.ViewChild('side')
10618
+ ], GanttComponent.prototype, "side", void 0);
10512
10619
  GanttComponent = __decorate([
10513
10620
  core.Component({
10514
10621
  selector: "s-gantt",
10515
- template: "<div class=\"outer\">\n <gantt-side-table\n *ngIf=\"showSideTable\"\n [tasks]=\"tasks\"\n [columnTitle]=\"columnTitle\"\n [multipleTaskPerLine]=\"multipleTaskPerLine\">\n </gantt-side-table>\n <svg id=\"gantt\"></svg>\n</div>",
10622
+ template: "<div class=\"outer\" #outer>\n <div #side>\n <gantt-side-table\n *ngIf=\"showSideTable\"\n [tasks]=\"tasks\"\n [columnTitle]=\"columnTitle\"\n [multipleTaskPerLine]=\"multipleTaskPerLine\">\n </gantt-side-table>\n </div>\n <svg id=\"gantt\"></svg>\n</div>\n",
10516
10623
  encapsulation: core.ViewEncapsulation.None,
10517
- styles: [".outer{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:start;align-items:flex-start;-ms-flex-line-pack:center;align-content:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-direction:row;flex-direction:row}", ".gantt{border:1px solid #e0e0e0}.gantt .weekend-highlight{fill:#b8c2cc;opacity:.5;stroke:#ebeff2;stroke-width:1}.gantt .grid-background{fill:none}.gantt .grid-header,.gantt .grid-row{fill:#fff}.gantt .grid-row:nth-child(even){fill:#f5f5f5}.gantt .row-line{stroke:#ebeff2}.gantt .tick{stroke:#e0e0e0;stroke-width:.2}.gantt .tick.thick{stroke-width:.4}.gantt .today-highlight{fill:#ffe979;opacity:.5}.gantt .arrow{fill:none;stroke:#666;stroke-width:1.4}.gantt .bar{opacity:.8;stroke:#8d99a6;stroke-width:0;transition:stroke-width .3s;-webkit-user-select:none;-ms-user-select:none;user-select:none}.gantt .bar-invalid{fill:transparent;stroke:#8d99a6;stroke-dasharray:5;stroke-width:1}.gantt .bar-invalid~.bar-label{fill:#555}.gantt .bar-label{fill:#fff;text-anchor:middle;font-size:12px;font-weight:lighter}.gantt .bar-label.big{fill:#555;text-anchor:start}.gantt .bar-wrapper{cursor:pointer;outline:0}.gantt .bar-wrapper.active .bar,.gantt .bar-wrapper:hover .bar{opacity:1}.gantt .bar-wrapper.active .bar{stroke:#212533;stroke-width:2}.gantt .lower-text,.gantt .upper-text{font-size:12px;text-anchor:middle}.gantt .upper-text{fill:#555}.gantt .lower-text{fill:#333}.gantt .hide{display:none}.gantt-container{border-left:1px solid #e0e0e0;font-size:12px;overflow:auto;position:relative}.gantt-container .title-1{fill:#999;font-size:12px;font-weight:400;line-height:150%;text-anchor:middle}.gantt-container .title-2{fill:#333;font-size:14px;font-weight:400;line-height:150%;text-anchor:middle}.gantt-container .popup-wrapper{left:0;position:absolute;top:0}.gantt-container .popup-wrapper .popup{background:#0e1119;border-radius:2px;color:#fff;padding:8px;font-family:\"Open Sans\" sans-serif;line-height:150%;font-weight:400}.gantt-container .popup-wrapper .popup .wrp-title{border-bottom:1px solid #525966;padding-bottom:10px}.gantt-container .popup-wrapper .popup .wrp-title .title{font-size:14px}.gantt-container .popup-wrapper .popup .wrp-subtitle{color:#dfe2e5;padding-top:10px}.gantt-container .popup-wrapper .popup .wrp-subtitle .icon{margin-right:8px}.gantt-container .popup-wrapper .popup .wrp-subtitle .subtitle{font-size:12px}.gantt-container .popup-wrapper .popup .pointer{border:6px solid transparent;border-top-color:#0e1119;height:6px;margin-left:-4px;position:absolute}"]
10624
+ styles: [".outer{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:start;align-items:flex-start;-ms-flex-line-pack:center;align-content:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-direction:row;flex-direction:row}", ".gantt{border:1px solid #e0e0e0}.gantt .weekend-highlight{fill:#b8c2cc;opacity:.5;stroke:#ebeff2;stroke-width:1}.gantt .grid-background{fill:none}.gantt .grid-header,.gantt .grid-row{fill:#fff}.gantt .grid-row:nth-child(even){fill:#f5f5f5}.gantt .row-line{stroke:#ebeff2}.gantt .tick{stroke:#e0e0e0;stroke-width:.4}.gantt .tick.thick{stroke:#533a3a8c;stroke-width:.4}.gantt .today-highlight{fill:#ffe979;opacity:.5}.gantt .arrow{fill:none;stroke:#666;stroke-width:1.4}.gantt .bar{opacity:.8;stroke:#8d99a6;stroke-width:0;transition:stroke-width .3s;-webkit-user-select:none;-ms-user-select:none;user-select:none}.gantt .bar-invalid{fill:transparent;stroke:#8d99a6;stroke-dasharray:5;stroke-width:1}.gantt .bar-invalid~.bar-label{fill:#555}.gantt .bar-label{fill:#fff;text-anchor:middle;font-size:12px;font-weight:lighter}.gantt .bar-label.big{fill:#555;text-anchor:start}.gantt .bar-wrapper{cursor:pointer;outline:0}.gantt .bar-wrapper.active .bar,.gantt .bar-wrapper:hover .bar{opacity:1}.gantt .bar-wrapper.active .bar{stroke:#212533;stroke-width:2}.gantt .lower-text,.gantt .upper-text{font-size:12px;text-anchor:middle}.gantt .upper-text{fill:#555}.gantt .lower-text{fill:#333}.gantt .hide{display:none}.gantt-container{border-left:1px solid #e0e0e0;font-size:12px;overflow:auto;position:relative}.gantt-container .title-1{fill:#999;font-size:12px;font-weight:400;line-height:150%;text-anchor:middle}.gantt-container .title-2{fill:#333;font-size:14px;font-weight:400;line-height:150%;text-anchor:middle}.gantt-container .popup-wrapper{left:0;position:absolute;top:0}.gantt-container .popup-wrapper .popup{background:#0e1119;border-radius:2px;color:#fff;padding:8px;font-family:\"Open Sans\" sans-serif;line-height:150%;font-weight:400}.gantt-container .popup-wrapper .popup .wrp-title{border-bottom:1px solid #525966;padding-bottom:10px}.gantt-container .popup-wrapper .popup .wrp-title .title{font-size:14px}.gantt-container .popup-wrapper .popup .wrp-subtitle{color:#dfe2e5;padding-top:10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.gantt-container .popup-wrapper .popup .wrp-subtitle .icon{margin-right:10px}.gantt-container .popup-wrapper .popup .wrp-subtitle .subtitle{font-size:12px}.gantt-container .popup-wrapper .popup .pointer{border:6px solid transparent;border-top-color:#0e1119;height:6px;margin-left:-4px;position:absolute}"]
10518
10625
  })
10519
10626
  ], GanttComponent);
10520
10627
  return GanttComponent;
@@ -10537,8 +10644,8 @@
10537
10644
  SideTableComponent = __decorate([
10538
10645
  core.Component({
10539
10646
  selector: 'gantt-side-table',
10540
- template: "<div class=\"side-table\">\n <div class=\"column-title\">\n <span>{{ columnTitle }}</span>\n </div>\n <div class=\"tasks\">\n <div *ngFor=\"let task of tasks; let i = index\" class=\"task\" [ngStyle]=\"{'height.px': multipleTaskPerLine\n ? ROW_HEIGHT\n : ROW_HEIGHT * task.tasks.length}\">\n <div class=\"title\">\n {{ task.title }}\n </div>\n <div class=\"subtitle\">\n {{ task.subtitle }}\n </div>\n </div>\n </div>\n</div>",
10541
- styles: [".side-table{background:#fff;height:100%;min-width:175px}.side-table .column-title{height:106px;border:1px solid #e0e0e0;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:center;justify-content:center;padding:8px}.side-table .column-title span{font-family:\"Open Sans\" sans-serif;font-size:14px;font-weight:700;line-height:150%}.side-table .task{-ms-flex-align:center;align-items:center;background-color:#fff;border:1px solid #e0e0e0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:\"Open Sans\" sans-serif;font-weight:400;-ms-flex-pack:center;justify-content:center;line-height:150%;padding:5px}.side-table .task .title{color:#333;font-size:14px}.side-table .task .subtitle{color:#999;font-size:12px}"]
10647
+ template: "<div class=\"side-table\">\n <div class=\"column-title\">\n <span>{{ columnTitle }}</span>\n </div>\n <div class=\"tasks\" >\n <div\n *ngFor=\"let task of tasks; let i = index\"\n class=\"task\"\n [ngStyle]=\"{'height.px': multipleTaskPerLine\n ? ROW_HEIGHT\n : ROW_HEIGHT * task.tasks.length}\"\n [sTooltip]=\"task.title.length > 20 || task.subtitle.length > 20 ? '<span><strong>' + task.title + ' </strong></br><span> ' + task.subtitle + ' </span></span>' : '' \"\n [escape]=\"false\">\n <div class=\"title\">\n {{ task.title }}\n </div>\n <div class=\"subtitle\">\n {{ task.subtitle }}\n </div>\n </div>\n </div>\n</div>\n",
10648
+ styles: [".side-table{background:#fff;height:100%;min-width:175px}.side-table .column-title{height:106px;border:1px solid #e0e0e0;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:center;justify-content:center;padding:8px}.side-table .column-title span{font-family:\"Open Sans\" sans-serif;font-size:14px;font-weight:700;line-height:150%}.side-table .task{-ms-flex-align:center;align-items:center;background-color:#fff;border:1px solid #e0e0e0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:\"Open Sans\",sans-serif;font-weight:400;-ms-flex-pack:center;justify-content:center;line-height:150%;padding:0 5px}.side-table .task .title{color:#333;font-size:14px;max-width:300px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.side-table .task .subtitle{color:#999;font-size:12px;max-width:300px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"]
10542
10649
  })
10543
10650
  ], SideTableComponent);
10544
10651
  return SideTableComponent;
@@ -10549,7 +10656,7 @@
10549
10656
  }
10550
10657
  GanttModule = __decorate([
10551
10658
  core.NgModule({
10552
- imports: [common.CommonModule],
10659
+ imports: [common.CommonModule, TooltipModule],
10553
10660
  declarations: [
10554
10661
  GanttComponent,
10555
10662
  SideTableComponent,