@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
@@ -8963,17 +8963,18 @@ $.attr = function (element, attr, value) {
8963
8963
 
8964
8964
  var ViewMode;
8965
8965
  (function (ViewMode) {
8966
+ ViewMode["Hour"] = "hour";
8966
8967
  ViewMode["QuarterDay"] = "quarterDay";
8967
8968
  ViewMode["HalfDay"] = "halfDay";
8968
8969
  ViewMode["Day"] = "day";
8969
8970
  ViewMode["Week"] = "week";
8970
8971
  ViewMode["Month"] = "month";
8971
8972
  ViewMode["Year"] = "year";
8972
- ViewMode["Hour"] = "hour";
8973
8973
  })(ViewMode || (ViewMode = {}));
8974
8974
 
8975
8975
  var Bar = /** @class */ (function () {
8976
8976
  function Bar(gantt, task) {
8977
+ this._isPopUpOpen = false;
8977
8978
  this._setDefaults(gantt, task);
8978
8979
  this._prepare();
8979
8980
  this._draw();
@@ -9144,38 +9145,62 @@ var Bar = /** @class */ (function () {
9144
9145
  }
9145
9146
  };
9146
9147
  Bar.prototype._setupClickEvent = function () {
9148
+ //TODO
9147
9149
  var _this = this;
9148
- $.on(this.group, "focus " + this._gantt.options.popupTrigger, function (e) {
9149
- // just finished a move action, wait for a few seconds
9150
- if (!_this._actionCompleted) {
9151
- _this._showPopup();
9152
- _this._gantt.unselect_all();
9153
- _this.group.classList.add("active");
9154
- }
9155
- }, null);
9156
- $.on(this.group, "dblclick", function (e) {
9157
- // just finished a move action, wait for a few seconds
9158
- if (!_this._actionCompleted) {
9159
- _this._gantt.trigger_event("onClick", [_this.task]);
9160
- }
9161
- }, null);
9150
+ if (this._gantt.options.hasPopup) {
9151
+ $.on(this.group, "focus " + this._gantt.options.popupTrigger, function (e) {
9152
+ // just finished a move action, wait for a few seconds
9153
+ if (!_this._actionCompleted) {
9154
+ _this._showPopup();
9155
+ _this._gantt.unselect_all();
9156
+ _this.group.classList.add("active");
9157
+ }
9158
+ }, null);
9159
+ $.on(this.group, "dblclick", function (e) {
9160
+ // just finished a move action, wait for a few seconds
9161
+ if (!_this._actionCompleted) {
9162
+ _this._gantt.trigger_event("onClick", [_this.task]);
9163
+ }
9164
+ }, null);
9165
+ }
9166
+ else {
9167
+ $.on(this.group, "mouseenter", function (e) {
9168
+ if (!_this._isPopUpOpen) {
9169
+ _this._showPopup({
9170
+ x: e.clientX,
9171
+ y: _this.group.getBoundingClientRect().top + 30,
9172
+ position: 'middle'
9173
+ });
9174
+ _this._isPopUpOpen = true;
9175
+ }
9176
+ }, null);
9177
+ $.on(this.group, "mouseleave", function (e) {
9178
+ _this._gantt.hide_popup();
9179
+ _this._isPopUpOpen = false;
9180
+ }, null);
9181
+ $.on(this.group, "focus click", function (e) {
9182
+ if (!_this._actionCompleted) {
9183
+ _this._gantt.unselect_all();
9184
+ _this.group.classList.add("active");
9185
+ _this._gantt.trigger_event("onClick", [_this.task]);
9186
+ }
9187
+ }, null);
9188
+ }
9162
9189
  };
9163
- Bar.prototype._showPopup = function () {
9190
+ Bar.prototype._showPopup = function (args) {
9164
9191
  if (this._gantt.bar_being_dragged) {
9165
9192
  return;
9166
9193
  }
9167
- var formatString = this._gantt.view_is(ViewMode.Hour)
9168
- ? "HH:ss"
9169
- : "MMM D";
9170
- var start_date = DateUtils.format(this.task.start, formatString, this._gantt.options.language);
9171
- var end_date = DateUtils.format(DateUtils.add(this.task.end, -1, "second"), formatString, this._gantt.options.language);
9172
- var subtitle = start_date + " - " + end_date;
9173
- this._gantt.show_popup({
9174
- target_element: this.element,
9175
- title: this.task.name,
9176
- subtitle: subtitle,
9177
- task: this.task,
9178
- });
9194
+ var subtitle = {};
9195
+ if (!this._gantt.options.showOnlyHours) {
9196
+ subtitle.startDate = DateUtils.format(this.task.start, 'DD/MM/YYYY', this._gantt.options.language);
9197
+ subtitle.endDate = DateUtils.format(this.task.end, 'DD/MM/YYYY', this._gantt.options.language);
9198
+ }
9199
+ if (!this._gantt.options.showOnlyDays) {
9200
+ subtitle.startHour = DateUtils.format(this.task.start, 'HH:mm:ss', this._gantt.options.language);
9201
+ subtitle.endHour = DateUtils.format(this.task.end, 'HH:mm:ss', this._gantt.options.language);
9202
+ }
9203
+ this._gantt.show_popup(__assign({ target_element: this.element, title: this.task.name, subtitle: subtitle, task: this.task }, args));
9179
9204
  };
9180
9205
  Bar.prototype._computeStartEndDate = function () {
9181
9206
  var bar = this.element;
@@ -9187,11 +9212,14 @@ var Bar = /** @class */ (function () {
9187
9212
  };
9188
9213
  Bar.prototype._computeX = function () {
9189
9214
  var _a = this._gantt.options, step = _a.step, columnWidth = _a.columnWidth;
9190
- var diff = DateUtils.diff(this.task.start, this._gantt.minDate, "hour");
9191
- var x = (diff / step) * columnWidth;
9192
- if (this._gantt.view_is(ViewMode.Month)) {
9193
- var diff_1 = DateUtils.diff(this.task.start, this._gantt.minDate, "day");
9194
- x = (diff_1 * columnWidth) / 30;
9215
+ var x;
9216
+ if (this._gantt.view_is([ViewMode.Hour, ViewMode.QuarterDay, ViewMode.HalfDay, ViewMode.Day])) {
9217
+ var diff = DateUtils.diff(this.task.start, this._gantt.minDate, "minutes");
9218
+ x = (diff / step) * (columnWidth / 60);
9219
+ }
9220
+ else {
9221
+ var diff = DateUtils.diff(this.task.start, this._gantt.minDate, "hour");
9222
+ x = (diff / step) * (columnWidth);
9195
9223
  }
9196
9224
  return x;
9197
9225
  };
@@ -9245,6 +9273,7 @@ var Popup = /** @class */ (function () {
9245
9273
  this.make();
9246
9274
  }
9247
9275
  Popup.prototype.show = function (options) {
9276
+ var _a, _b, _c, _d;
9248
9277
  if (!options.target_element) {
9249
9278
  throw new Error("target_element is required to show popup");
9250
9279
  }
@@ -9252,6 +9281,7 @@ var Popup = /** @class */ (function () {
9252
9281
  options.position = "left";
9253
9282
  }
9254
9283
  var target_element = options.target_element;
9284
+ this.parent.style.display = 'block';
9255
9285
  if (this.customHtml) {
9256
9286
  var html = this.customHtml(options.task);
9257
9287
  html += '<div class="pointer"></div>';
@@ -9261,7 +9291,10 @@ var Popup = /** @class */ (function () {
9261
9291
  else {
9262
9292
  // set data
9263
9293
  this.title.innerHTML = options.title;
9264
- this.subtitle.innerHTML = options.subtitle;
9294
+ this.startDate.innerHTML = (_a = options.subtitle.startDate) !== null && _a !== void 0 ? _a : '';
9295
+ this.startHour.innerHTML = (_b = options.subtitle.startHour) !== null && _b !== void 0 ? _b : '';
9296
+ this.endDate.innerHTML = (_c = options.subtitle.endDate) !== null && _c !== void 0 ? _c : '';
9297
+ this.endHour.innerHTML = (_d = options.subtitle.endHour) !== null && _d !== void 0 ? _d : '';
9265
9298
  this.parent.style.width = this.parent.clientWidth + "px";
9266
9299
  }
9267
9300
  // set position
@@ -9272,7 +9305,23 @@ var Popup = /** @class */ (function () {
9272
9305
  else if (target_element instanceof SVGElement) {
9273
9306
  positionMeta = options.target_element.getBBox();
9274
9307
  }
9275
- if (options.position === 'left') {
9308
+ if (options.position === 'middle') {
9309
+ this.parent.style.position = 'fixed';
9310
+ this.parent.style.top = options.y + "px";
9311
+ this.pointer.style.transform = "rotateZ(180deg)";
9312
+ this.pointer.style.top = "-10px";
9313
+ if ((options.x - 17) + this.parent.offsetWidth > window.innerWidth) {
9314
+ this.parent.style.left = (options.x - this.parent.offsetWidth + 17) + "px";
9315
+ this.pointer.style.right = "16px";
9316
+ this.pointer.style.left = "auto";
9317
+ }
9318
+ else {
9319
+ this.parent.style.left = (options.x - 17) + "px";
9320
+ this.pointer.style.left = "16px";
9321
+ this.pointer.style.right = "auto";
9322
+ }
9323
+ }
9324
+ else if (options.position === 'left') {
9276
9325
  this.parent.style.left = positionMeta.x + (positionMeta.width + 10) + "px";
9277
9326
  this.parent.style.top = positionMeta.y + "px";
9278
9327
  this.pointer.style.transform = "rotateZ(90deg)";
@@ -9283,14 +9332,18 @@ var Popup = /** @class */ (function () {
9283
9332
  this.parent.style.opacity = 1;
9284
9333
  };
9285
9334
  Popup.prototype.make = function () {
9286
- 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 ";
9335
+ 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 ";
9287
9336
  this.hide();
9288
9337
  this.title = this.parent.querySelector(".title");
9289
- this.subtitle = this.parent.querySelector(".subtitle");
9338
+ this.startDate = this.parent.querySelector(".startDate");
9339
+ this.startHour = this.parent.querySelector(".startHour");
9340
+ this.endDate = this.parent.querySelector(".endDate");
9341
+ this.endHour = this.parent.querySelector(".endHour");
9290
9342
  this.pointer = this.parent.querySelector(".pointer");
9291
9343
  };
9292
9344
  Popup.prototype.hide = function () {
9293
9345
  this.parent.style.opacity = 0;
9346
+ this.parent.style.display = 'none';
9294
9347
  this.parent.style.left = 0;
9295
9348
  };
9296
9349
  return Popup;
@@ -9388,12 +9441,16 @@ var defaultOptions = {
9388
9441
  popupTrigger: "click",
9389
9442
  customPopupHtml: null,
9390
9443
  language: "en",
9444
+ allowMovement: true,
9445
+ hasPopup: true,
9446
+ showOnlyHours: false,
9447
+ showOnlyDays: false,
9391
9448
  };
9392
9449
 
9393
9450
  var Gantt = /** @class */ (function () {
9394
9451
  function Gantt(wrapper, tasks, options) {
9395
- this.setup_wrapper(wrapper);
9396
9452
  this.setup_options(options);
9453
+ this.setup_wrapper(wrapper);
9397
9454
  this.setup_tasks(tasks);
9398
9455
  // initialize with default view mode
9399
9456
  this.change_view_mode();
@@ -9445,6 +9502,9 @@ var Gantt = /** @class */ (function () {
9445
9502
  // wrapper element
9446
9503
  this.$container = document.createElement("div");
9447
9504
  this.$container.classList.add("gantt-container");
9505
+ if (this.options.containerWidth) {
9506
+ this.$container.style.width = this.options.containerWidth + 'px';
9507
+ }
9448
9508
  var parent_element = this.$svg.parentElement;
9449
9509
  parent_element.appendChild(this.$container);
9450
9510
  this.$container.appendChild(this.$svg);
@@ -9550,6 +9610,7 @@ var Gantt = /** @class */ (function () {
9550
9610
  };
9551
9611
  Gantt.prototype.change_view_mode = function (mode) {
9552
9612
  if (mode === void 0) { mode = this.options.viewMode; }
9613
+ this.setup_gantt_dates();
9553
9614
  this.update_view_scale(mode);
9554
9615
  this.setup_dates();
9555
9616
  this.render();
@@ -9562,7 +9623,6 @@ var Gantt = /** @class */ (function () {
9562
9623
  if (view_mode === ViewMode.Hour) {
9563
9624
  this.options.step = 24 / 24;
9564
9625
  this.options.columnWidth = 50;
9565
- // this.isHourView = true;
9566
9626
  }
9567
9627
  else if (view_mode === ViewMode.Day) {
9568
9628
  this.options.step = 24;
@@ -9590,7 +9650,6 @@ var Gantt = /** @class */ (function () {
9590
9650
  }
9591
9651
  };
9592
9652
  Gantt.prototype.setup_dates = function () {
9593
- this.setup_gantt_dates();
9594
9653
  this.setup_date_values();
9595
9654
  };
9596
9655
  Gantt.prototype.setup_gantt_dates = function () {
@@ -9603,7 +9662,7 @@ var Gantt = /** @class */ (function () {
9603
9662
  var task = _s.value;
9604
9663
  // set global start and end date
9605
9664
  if (!this.minDate || task.start < this.minDate) {
9606
- this._minDate = task.start;
9665
+ this._minDate = DateUtils.startOf(task.start, 'day');
9607
9666
  }
9608
9667
  if (!this.maxDate || task.end > this.maxDate) {
9609
9668
  this._maxDate = task.end;
@@ -9625,28 +9684,28 @@ var Gantt = /** @class */ (function () {
9625
9684
  this._maxDate = DateUtils.add(this.maxDate, (_c = this.options.marginAfterEnd) !== null && _c !== void 0 ? _c : 1, "hour");
9626
9685
  break;
9627
9686
  case ViewMode.QuarterDay:
9628
- this._minDate = DateUtils.add(this.minDate, -((_d = this.options.marginBeforeStart) !== null && _d !== void 0 ? _d : 12), "hour");
9629
- this._maxDate = DateUtils.add(this.maxDate, (_e = this.options.marginAfterEnd) !== null && _e !== void 0 ? _e : 12, "hour");
9687
+ this._minDate = DateUtils.add(this.minDate, -((_d = this.options.marginBeforeStart) !== null && _d !== void 0 ? _d : 6), "hour");
9688
+ this._maxDate = DateUtils.add(this.maxDate, (_e = this.options.marginAfterEnd) !== null && _e !== void 0 ? _e : 6, "hour");
9630
9689
  break;
9631
9690
  case ViewMode.HalfDay:
9632
- this._minDate = DateUtils.add(this.minDate, -((_f = this.options.marginBeforeStart) !== null && _f !== void 0 ? _f : 1), "day");
9633
- this._maxDate = DateUtils.add(this.maxDate, (_g = this.options.marginAfterEnd) !== null && _g !== void 0 ? _g : 1, "day");
9691
+ this._minDate = DateUtils.add(this.minDate, -((_f = this.options.marginBeforeStart) !== null && _f !== void 0 ? _f : 12), "hour");
9692
+ this._maxDate = DateUtils.add(this.maxDate, (_g = this.options.marginAfterEnd) !== null && _g !== void 0 ? _g : 12, "hour");
9634
9693
  break;
9635
9694
  case ViewMode.Day:
9636
- this._minDate = DateUtils.add(this.minDate, -((_h = this.options.marginBeforeStart) !== null && _h !== void 0 ? _h : 3), "day");
9637
- this._maxDate = DateUtils.add(this.maxDate, (_j = this.options.marginAfterEnd) !== null && _j !== void 0 ? _j : 3, "day");
9695
+ this._minDate = DateUtils.add(this.minDate, -((_h = this.options.marginBeforeStart) !== null && _h !== void 0 ? _h : 1), "day");
9696
+ this._maxDate = DateUtils.add(this.maxDate, (_j = this.options.marginAfterEnd) !== null && _j !== void 0 ? _j : 1, "day");
9638
9697
  break;
9639
9698
  case ViewMode.Week:
9640
- this._minDate = DateUtils.add(this.minDate, -((_k = this.options.marginBeforeStart) !== null && _k !== void 0 ? _k : 1), "month");
9641
- this._maxDate = DateUtils.add(this.maxDate, (_l = this.options.marginAfterEnd) !== null && _l !== void 0 ? _l : 1, "month");
9699
+ this._minDate = DateUtils.add(this.minDate, -((_k = this.options.marginBeforeStart) !== null && _k !== void 0 ? _k : 1), "week");
9700
+ this._maxDate = DateUtils.add(this.maxDate, (_l = this.options.marginAfterEnd) !== null && _l !== void 0 ? _l : 1, "week");
9642
9701
  break;
9643
9702
  case ViewMode.Month:
9644
- this._minDate = DateUtils.add(this.minDate, -((_m = this.options.marginBeforeStart) !== null && _m !== void 0 ? _m : 1), "year");
9645
- this._maxDate = DateUtils.add(this.maxDate, (_o = this.options.marginAfterEnd) !== null && _o !== void 0 ? _o : 1, "year");
9703
+ this._minDate = DateUtils.add(this.minDate, -((_m = this.options.marginBeforeStart) !== null && _m !== void 0 ? _m : 1), "month");
9704
+ this._maxDate = DateUtils.add(this.maxDate, (_o = this.options.marginAfterEnd) !== null && _o !== void 0 ? _o : 1, "month");
9646
9705
  break;
9647
9706
  case ViewMode.Year:
9648
- this._minDate = DateUtils.add(this.minDate, -((_p = this.options.marginBeforeStart) !== null && _p !== void 0 ? _p : 2), "year");
9649
- this._maxDate = DateUtils.add(this.maxDate, (_q = this.options.marginAfterEnd) !== null && _q !== void 0 ? _q : 2, "year");
9707
+ this._minDate = DateUtils.add(this.minDate, -((_p = this.options.marginBeforeStart) !== null && _p !== void 0 ? _p : 1), "year");
9708
+ this._maxDate = DateUtils.add(this.maxDate, (_q = this.options.marginAfterEnd) !== null && _q !== void 0 ? _q : 1, "year");
9650
9709
  break;
9651
9710
  }
9652
9711
  };
@@ -9670,6 +9729,10 @@ var Gantt = /** @class */ (function () {
9670
9729
  }
9671
9730
  this.dates.push(cur_date);
9672
9731
  }
9732
+ if (this.options.containerWidth) {
9733
+ var columnWidth = (this.options.containerWidth - 1) / this.dates.length;
9734
+ this.options.columnWidth = columnWidth < 45 ? 45 : columnWidth;
9735
+ }
9673
9736
  console.log("cur_date", cur_date);
9674
9737
  console.log("dates", this.dates);
9675
9738
  };
@@ -9719,6 +9782,9 @@ var Gantt = /** @class */ (function () {
9719
9782
  };
9720
9783
  Gantt.prototype.make_grid_background = function () {
9721
9784
  var grid_width = this.dates.length * this.options.columnWidth;
9785
+ if (this.options.containerWidth) {
9786
+ grid_width = this.options.containerWidth;
9787
+ }
9722
9788
  var distinct_rows = __spread(new Set(this.tasks.map(function (x) { return x._row_id; })));
9723
9789
  var grid_height = this.options.headerHeight +
9724
9790
  this.options.padding / 2 +
@@ -9802,6 +9868,11 @@ var Gantt = /** @class */ (function () {
9802
9868
  if (this.view_is(ViewMode.Month) && date.getMonth() % 3 === 0) {
9803
9869
  tick_class += " thick";
9804
9870
  }
9871
+ // Thick ticks for hours
9872
+ if (this.view_is(ViewMode.Hour) &&
9873
+ date.getHours() == 0) {
9874
+ tick_class += " thick";
9875
+ }
9805
9876
  createSVG("path", {
9806
9877
  d: "M " + tick_x + " " + tick_y + " v " + tick_height,
9807
9878
  class: tick_class,
@@ -9930,9 +10001,7 @@ var Gantt = /** @class */ (function () {
9930
10001
  hourLower: DateUtils.format(date, "HH:mm", this.options.language),
9931
10002
  quarterDayLower: DateUtils.format(date, "HH:mm", this.options.language),
9932
10003
  halfDayLower: DateUtils.format(date, "HH:mm", this.options.language),
9933
- dayLower: date.getDate() !== last_date.getDate()
9934
- ? DateUtils.format(date, "D", this.options.language)
9935
- : "",
10004
+ dayLower: DateUtils.format(date, "D", this.options.language),
9936
10005
  weekLower: date.getMonth() !== last_date.getMonth()
9937
10006
  ? DateUtils.format(date, "D MMM", this.options.language)
9938
10007
  : DateUtils.format(date, "D", this.options.language),
@@ -9941,12 +10010,12 @@ var Gantt = /** @class */ (function () {
9941
10010
  quarterDayUpper: date.getDate() !== last_date.getDate()
9942
10011
  ? DateUtils.format(date, "D MMM", this.options.language)
9943
10012
  : "",
9944
- halfDayUpper: date.getDate() !== last_date.getDate()
9945
- ? date.getMonth() !== last_date.getMonth()
10013
+ halfDayUpper: (date.getDate() !== last_date.getDate())
10014
+ ? (((date.getMonth() !== last_date.getMonth()) || i < 2)
9946
10015
  ? DateUtils.format(date, "D MMM", this.options.language)
9947
- : DateUtils.format(date, "D", this.options.language)
10016
+ : DateUtils.format(date, "D", this.options.language))
9948
10017
  : "",
9949
- dayUpper: date.getMonth() !== last_date.getMonth()
10018
+ dayUpper: ((date.getMonth() !== last_date.getMonth()) || i === 0)
9950
10019
  ? DateUtils.format(date, "MMMM", this.options.language)
9951
10020
  : "",
9952
10021
  weekUpper: date.getMonth() !== last_date.getMonth()
@@ -9958,8 +10027,8 @@ var Gantt = /** @class */ (function () {
9958
10027
  yearUpper: date.getFullYear() !== last_date.getFullYear()
9959
10028
  ? DateUtils.format(date, "YYYY", this.options.language)
9960
10029
  : "",
9961
- hour: date.getHours() !== last_date.getHours()
9962
- ? DateUtils.format(date, "HH:mm", this.options.language)
10030
+ hourUpper: date.getDate() !== last_date.getDate()
10031
+ ? DateUtils.format(date, "D MMM", this.options.language)
9963
10032
  : "",
9964
10033
  };
9965
10034
  // Descontando 20 para adcionar uma segunda linha de informação no cabeçalho
@@ -9968,15 +10037,16 @@ var Gantt = /** @class */ (function () {
9968
10037
  lower_y: this.options.headerHeight - 20,
9969
10038
  upper_y: this.options.headerHeight - 20 - 25,
9970
10039
  };
10040
+ debugger;
9971
10041
  var x_pos = {
9972
10042
  hourLower: this.options.columnWidth / 2,
9973
- hourUpper: this.options.columnWidth * 24 / 2,
10043
+ hourUpper: (this.dates.length < 14) ? (this.options.columnWidth) : (this.options.columnWidth * 24 / 2),
9974
10044
  quarterDayLower: this.options.columnWidth / 2,
9975
10045
  quarterDayUpper: this.options.columnWidth * 4 / 2,
9976
10046
  halfDayLower: this.options.columnWidth / 2,
9977
10047
  halfDayUpper: this.options.columnWidth * 2 / 2,
9978
10048
  dayLower: this.options.columnWidth / 2,
9979
- dayUpper: (this.options.columnWidth * 30) / 2,
10049
+ dayUpper: (this.dates.length < 15) ? (this.options.columnWidth) : ((this.options.columnWidth * 30) / 2),
9980
10050
  weekLower: 0,
9981
10051
  weekUpper: (this.options.columnWidth * 4) / 2,
9982
10052
  monthLower: this.options.columnWidth / 2,
@@ -10106,7 +10176,7 @@ var Gantt = /** @class */ (function () {
10106
10176
  else if (element.classList.contains("right")) {
10107
10177
  is_resizing_right = true;
10108
10178
  }
10109
- else if (element.classList.contains("bar-wrapper")) {
10179
+ else if (element.classList.contains("bar-wrapper") && _this.options.allowMovement) {
10110
10180
  is_dragging = true;
10111
10181
  }
10112
10182
  bar_wrapper.classList.add("active");
@@ -10160,7 +10230,7 @@ var Gantt = /** @class */ (function () {
10160
10230
  });
10161
10231
  }, null);
10162
10232
  document.addEventListener("mouseup", function (e) {
10163
- if (is_dragging || is_resizing_left || is_resizing_right) {
10233
+ if (is_dragging || is_resizing_left || is_resizing_right || !_this.options.allowMovement) {
10164
10234
  bars.forEach(function (bar) { return bar.group.classList.remove("active"); });
10165
10235
  }
10166
10236
  is_dragging = false;
@@ -10269,6 +10339,11 @@ var GanttComponent = /** @class */ (function () {
10269
10339
  this.multipleTaskPerLine = false;
10270
10340
  this.showSideTable = true;
10271
10341
  this.viewMode = ViewMode.Day;
10342
+ this.allowMovement = true;
10343
+ this.hasPopup = true;
10344
+ this.fullWidth = false;
10345
+ this.showOnlyHours = false;
10346
+ this.showOnlyDays = false;
10272
10347
  this.taskClicked = new EventEmitter();
10273
10348
  this.taskDateChanged = new EventEmitter();
10274
10349
  this.viewChanged = new EventEmitter();
@@ -10278,11 +10353,19 @@ var GanttComponent = /** @class */ (function () {
10278
10353
  };
10279
10354
  GanttComponent.prototype.ngAfterViewInit = function () {
10280
10355
  var _this = this;
10356
+ if (this.fullWidth) {
10357
+ this.containerWidth = this.outer.nativeElement.offsetWidth - this.side.nativeElement.offsetWidth;
10358
+ }
10281
10359
  this._gantt = new Gantt("#gantt", this._filterTask(this.tasks), {
10282
10360
  viewMode: this.viewMode,
10283
10361
  marginBeforeStart: this.marginBeforeStart,
10284
10362
  marginAfterEnd: this.marginAfterEnd,
10285
10363
  language: "pt-BR",
10364
+ allowMovement: this.allowMovement,
10365
+ hasPopup: this.hasPopup,
10366
+ containerWidth: this.containerWidth,
10367
+ showOnlyHours: this.showOnlyHours,
10368
+ showOnlyDays: this.showOnlyDays,
10286
10369
  onClick: function (task) { return _this.taskClicked.emit(task); },
10287
10370
  onDateChange: function (task, start, end) { return _this.taskDateChanged.emit({ task: task, start: start, end: end }); },
10288
10371
  onViewChange: function (viewMode) { return _this.viewChanged.emit(viewMode); },
@@ -10353,6 +10436,24 @@ var GanttComponent = /** @class */ (function () {
10353
10436
  __decorate([
10354
10437
  Input()
10355
10438
  ], GanttComponent.prototype, "marginAfterEnd", void 0);
10439
+ __decorate([
10440
+ Input()
10441
+ ], GanttComponent.prototype, "allowMovement", void 0);
10442
+ __decorate([
10443
+ Input()
10444
+ ], GanttComponent.prototype, "hasPopup", void 0);
10445
+ __decorate([
10446
+ Input()
10447
+ ], GanttComponent.prototype, "containerWidth", void 0);
10448
+ __decorate([
10449
+ Input()
10450
+ ], GanttComponent.prototype, "fullWidth", void 0);
10451
+ __decorate([
10452
+ Input()
10453
+ ], GanttComponent.prototype, "showOnlyHours", void 0);
10454
+ __decorate([
10455
+ Input()
10456
+ ], GanttComponent.prototype, "showOnlyDays", void 0);
10356
10457
  __decorate([
10357
10458
  Output()
10358
10459
  ], GanttComponent.prototype, "taskClicked", void 0);
@@ -10362,12 +10463,18 @@ var GanttComponent = /** @class */ (function () {
10362
10463
  __decorate([
10363
10464
  Output()
10364
10465
  ], GanttComponent.prototype, "viewChanged", void 0);
10466
+ __decorate([
10467
+ ViewChild('outer')
10468
+ ], GanttComponent.prototype, "outer", void 0);
10469
+ __decorate([
10470
+ ViewChild('side')
10471
+ ], GanttComponent.prototype, "side", void 0);
10365
10472
  GanttComponent = __decorate([
10366
10473
  Component({
10367
10474
  selector: "s-gantt",
10368
- 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>",
10475
+ 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",
10369
10476
  encapsulation: ViewEncapsulation.None,
10370
- 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}"]
10477
+ 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}"]
10371
10478
  })
10372
10479
  ], GanttComponent);
10373
10480
  return GanttComponent;
@@ -10390,8 +10497,8 @@ var SideTableComponent = /** @class */ (function () {
10390
10497
  SideTableComponent = __decorate([
10391
10498
  Component({
10392
10499
  selector: 'gantt-side-table',
10393
- 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>",
10394
- 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}"]
10500
+ 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",
10501
+ 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}"]
10395
10502
  })
10396
10503
  ], SideTableComponent);
10397
10504
  return SideTableComponent;
@@ -10402,7 +10509,7 @@ var GanttModule = /** @class */ (function () {
10402
10509
  }
10403
10510
  GanttModule = __decorate([
10404
10511
  NgModule({
10405
- imports: [CommonModule],
10512
+ imports: [CommonModule, TooltipModule],
10406
10513
  declarations: [
10407
10514
  GanttComponent,
10408
10515
  SideTableComponent,