@seniorsistemas/angular-components 17.1.2 → 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.
- package/bundles/seniorsistemas-angular-components.umd.js +179 -72
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/gantt/components/gantt/bar.d.ts +1 -0
- package/components/gantt/components/gantt/gantt.d.ts +1 -1
- package/components/gantt/components/gantt/popup.d.ts +4 -1
- package/components/gantt/gantt.component.d.ts +9 -1
- package/components/gantt/models/options.d.ts +5 -0
- package/components/gantt/models/view-mode.d.ts +2 -2
- package/esm2015/components/dynamic-form/components/fields/chips/chips-field.component.js +1 -1
- package/esm2015/components/gantt/components/gantt/bar.js +61 -33
- package/esm2015/components/gantt/components/gantt/gantt-options.js +5 -1
- package/esm2015/components/gantt/components/gantt/gantt.js +44 -31
- package/esm2015/components/gantt/components/gantt/popup.js +37 -5
- package/esm2015/components/gantt/components/side-table/side-table.component.js +3 -3
- package/esm2015/components/gantt/gantt.component.js +41 -4
- package/esm2015/components/gantt/gantt.module.js +3 -2
- package/esm2015/components/gantt/models/options.js +1 -1
- package/esm2015/components/gantt/models/view-mode.js +2 -2
- package/esm5/components/dynamic-form/components/fields/chips/chips-field.component.js +1 -1
- package/esm5/components/gantt/components/gantt/bar.js +62 -34
- package/esm5/components/gantt/components/gantt/gantt-options.js +5 -1
- package/esm5/components/gantt/components/gantt/gantt.js +43 -30
- package/esm5/components/gantt/components/gantt/popup.js +30 -5
- package/esm5/components/gantt/components/side-table/side-table.component.js +3 -3
- package/esm5/components/gantt/gantt.component.js +41 -4
- package/esm5/components/gantt/gantt.module.js +3 -2
- package/esm5/components/gantt/models/options.js +1 -1
- package/esm5/components/gantt/models/view-mode.js +2 -2
- package/fesm2015/seniorsistemas-angular-components.js +187 -73
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +179 -72
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -6082,7 +6082,7 @@ __decorate([
|
|
|
6082
6082
|
ChipsFieldComponent = __decorate([
|
|
6083
6083
|
Component({
|
|
6084
6084
|
template: "<p-chips\n *ngIf=\"field.keyFilter\"\n [inputId]=\"(field.id || field.name)\"\n [formControl]=\"formControl\"\n [placeholder]=\"field.placeholder\"\n [allowDuplicate]=\"false\"\n [addOnTab]=\"true\"\n [addOnBlur]=\"true\"\n (onAdd)=\"field.onAdd ? field.onAdd($event) : null\"\n (onRemove)=\"field.onRemove ? field.onRemove($event) : null\"\n (onChipClick)=\"field.onChipClick ? field.onChipClick($event) : null\"\n (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n [pKeyFilter]=\"field.keyFilter\">\n <ng-template let-item pTemplate=\"item\">\n <span\n class=\"chip-content\"\n [sTooltip]=\"item\">\n {{ item }}\n </span>\n </ng-template>\n</p-chips>\n\n<p-chips\n *ngIf=\"!field.keyFilter\"\n [inputId]=\"(field.id || field.name)\"\n [formControl]=\"formControl\"\n [placeholder]=\"field.placeholder\"\n [allowDuplicate]=\"false\"\n [addOnTab]=\"true\"\n [addOnBlur]=\"true\"\n (onAdd)=\"field.onAdd ? field.onAdd($event) : null\"\n (onRemove)=\"field.onRemove ? field.onRemove($event) : null\"\n (onChipClick)=\"field.onChipClick ? field.onChipClick($event) : null\"\n (onFocus)=\"field.onFocus ? field.onFocus($event) : null\"\n (onBlur)=\"field.onBlur ? field.onBlur($event) : null\">\n <ng-template let-item pTemplate=\"item\">\n <span\n class=\"chip-content\"\n [sTooltip]=\"item\">\n {{ item }}\n </span>\n </ng-template>\n</p-chips>\n",
|
|
6085
|
-
styles: [".chip-content{display:block;padding-right:1rem}"]
|
|
6085
|
+
styles: [".chip-content{display:block;overflow:hidden;padding-right:1rem;text-overflow:ellipsis}"]
|
|
6086
6086
|
})
|
|
6087
6087
|
], ChipsFieldComponent);
|
|
6088
6088
|
|
|
@@ -8319,17 +8319,18 @@ $.attr = (element, attr, value) => {
|
|
|
8319
8319
|
|
|
8320
8320
|
var ViewMode;
|
|
8321
8321
|
(function (ViewMode) {
|
|
8322
|
+
ViewMode["Hour"] = "hour";
|
|
8322
8323
|
ViewMode["QuarterDay"] = "quarterDay";
|
|
8323
8324
|
ViewMode["HalfDay"] = "halfDay";
|
|
8324
8325
|
ViewMode["Day"] = "day";
|
|
8325
8326
|
ViewMode["Week"] = "week";
|
|
8326
8327
|
ViewMode["Month"] = "month";
|
|
8327
8328
|
ViewMode["Year"] = "year";
|
|
8328
|
-
ViewMode["Hour"] = "hour";
|
|
8329
8329
|
})(ViewMode || (ViewMode = {}));
|
|
8330
8330
|
|
|
8331
8331
|
class Bar {
|
|
8332
8332
|
constructor(gantt, task) {
|
|
8333
|
+
this._isPopUpOpen = false;
|
|
8333
8334
|
this._setDefaults(gantt, task);
|
|
8334
8335
|
this._prepare();
|
|
8335
8336
|
this._draw();
|
|
@@ -8480,37 +8481,61 @@ class Bar {
|
|
|
8480
8481
|
}
|
|
8481
8482
|
}
|
|
8482
8483
|
_setupClickEvent() {
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
this.
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8484
|
+
//TODO
|
|
8485
|
+
if (this._gantt.options.hasPopup) {
|
|
8486
|
+
$.on(this.group, "focus " + this._gantt.options.popupTrigger, (e) => {
|
|
8487
|
+
// just finished a move action, wait for a few seconds
|
|
8488
|
+
if (!this._actionCompleted) {
|
|
8489
|
+
this._showPopup();
|
|
8490
|
+
this._gantt.unselect_all();
|
|
8491
|
+
this.group.classList.add("active");
|
|
8492
|
+
}
|
|
8493
|
+
}, null);
|
|
8494
|
+
$.on(this.group, "dblclick", (e) => {
|
|
8495
|
+
// just finished a move action, wait for a few seconds
|
|
8496
|
+
if (!this._actionCompleted) {
|
|
8497
|
+
this._gantt.trigger_event("onClick", [this.task]);
|
|
8498
|
+
}
|
|
8499
|
+
}, null);
|
|
8500
|
+
}
|
|
8501
|
+
else {
|
|
8502
|
+
$.on(this.group, "mouseenter", (e) => {
|
|
8503
|
+
if (!this._isPopUpOpen) {
|
|
8504
|
+
this._showPopup({
|
|
8505
|
+
x: e.clientX,
|
|
8506
|
+
y: this.group.getBoundingClientRect().top + 30,
|
|
8507
|
+
position: 'middle'
|
|
8508
|
+
});
|
|
8509
|
+
this._isPopUpOpen = true;
|
|
8510
|
+
}
|
|
8511
|
+
}, null);
|
|
8512
|
+
$.on(this.group, "mouseleave", (e) => {
|
|
8513
|
+
this._gantt.hide_popup();
|
|
8514
|
+
this._isPopUpOpen = false;
|
|
8515
|
+
}, null);
|
|
8516
|
+
$.on(this.group, "focus click", (e) => {
|
|
8517
|
+
if (!this._actionCompleted) {
|
|
8518
|
+
this._gantt.unselect_all();
|
|
8519
|
+
this.group.classList.add("active");
|
|
8520
|
+
this._gantt.trigger_event("onClick", [this.task]);
|
|
8521
|
+
}
|
|
8522
|
+
}, null);
|
|
8523
|
+
}
|
|
8497
8524
|
}
|
|
8498
|
-
_showPopup() {
|
|
8525
|
+
_showPopup(args) {
|
|
8499
8526
|
if (this._gantt.bar_being_dragged) {
|
|
8500
8527
|
return;
|
|
8501
8528
|
}
|
|
8502
|
-
const
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
task: this.task,
|
|
8513
|
-
});
|
|
8529
|
+
const subtitle = {};
|
|
8530
|
+
if (!this._gantt.options.showOnlyHours) {
|
|
8531
|
+
subtitle.startDate = DateUtils.format(this.task.start, 'DD/MM/YYYY', this._gantt.options.language);
|
|
8532
|
+
subtitle.endDate = DateUtils.format(this.task.end, 'DD/MM/YYYY', this._gantt.options.language);
|
|
8533
|
+
}
|
|
8534
|
+
if (!this._gantt.options.showOnlyDays) {
|
|
8535
|
+
subtitle.startHour = DateUtils.format(this.task.start, 'HH:mm:ss', this._gantt.options.language);
|
|
8536
|
+
subtitle.endHour = DateUtils.format(this.task.end, 'HH:mm:ss', this._gantt.options.language);
|
|
8537
|
+
}
|
|
8538
|
+
this._gantt.show_popup(Object.assign({ target_element: this.element, title: this.task.name, subtitle: subtitle, task: this.task }, args));
|
|
8514
8539
|
}
|
|
8515
8540
|
_computeStartEndDate() {
|
|
8516
8541
|
const bar = this.element;
|
|
@@ -8522,11 +8547,14 @@ class Bar {
|
|
|
8522
8547
|
}
|
|
8523
8548
|
_computeX() {
|
|
8524
8549
|
const { step, columnWidth } = this._gantt.options;
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8550
|
+
let x;
|
|
8551
|
+
if (this._gantt.view_is([ViewMode.Hour, ViewMode.QuarterDay, ViewMode.HalfDay, ViewMode.Day])) {
|
|
8552
|
+
const diff = DateUtils.diff(this.task.start, this._gantt.minDate, "minutes");
|
|
8553
|
+
x = (diff / step) * (columnWidth / 60);
|
|
8554
|
+
}
|
|
8555
|
+
else {
|
|
8556
|
+
const diff = DateUtils.diff(this.task.start, this._gantt.minDate, "hour");
|
|
8557
|
+
x = (diff / step) * (columnWidth);
|
|
8530
8558
|
}
|
|
8531
8559
|
return x;
|
|
8532
8560
|
}
|
|
@@ -8568,6 +8596,7 @@ class Popup {
|
|
|
8568
8596
|
this.make();
|
|
8569
8597
|
}
|
|
8570
8598
|
show(options) {
|
|
8599
|
+
var _a, _b, _c, _d;
|
|
8571
8600
|
if (!options.target_element) {
|
|
8572
8601
|
throw new Error("target_element is required to show popup");
|
|
8573
8602
|
}
|
|
@@ -8575,6 +8604,7 @@ class Popup {
|
|
|
8575
8604
|
options.position = "left";
|
|
8576
8605
|
}
|
|
8577
8606
|
const target_element = options.target_element;
|
|
8607
|
+
this.parent.style.display = 'block';
|
|
8578
8608
|
if (this.customHtml) {
|
|
8579
8609
|
let html = this.customHtml(options.task);
|
|
8580
8610
|
html += '<div class="pointer"></div>';
|
|
@@ -8584,7 +8614,10 @@ class Popup {
|
|
|
8584
8614
|
else {
|
|
8585
8615
|
// set data
|
|
8586
8616
|
this.title.innerHTML = options.title;
|
|
8587
|
-
this.
|
|
8617
|
+
this.startDate.innerHTML = (_a = options.subtitle.startDate) !== null && _a !== void 0 ? _a : '';
|
|
8618
|
+
this.startHour.innerHTML = (_b = options.subtitle.startHour) !== null && _b !== void 0 ? _b : '';
|
|
8619
|
+
this.endDate.innerHTML = (_c = options.subtitle.endDate) !== null && _c !== void 0 ? _c : '';
|
|
8620
|
+
this.endHour.innerHTML = (_d = options.subtitle.endHour) !== null && _d !== void 0 ? _d : '';
|
|
8588
8621
|
this.parent.style.width = this.parent.clientWidth + "px";
|
|
8589
8622
|
}
|
|
8590
8623
|
// set position
|
|
@@ -8595,7 +8628,23 @@ class Popup {
|
|
|
8595
8628
|
else if (target_element instanceof SVGElement) {
|
|
8596
8629
|
positionMeta = options.target_element.getBBox();
|
|
8597
8630
|
}
|
|
8598
|
-
if (options.position === '
|
|
8631
|
+
if (options.position === 'middle') {
|
|
8632
|
+
this.parent.style.position = 'fixed';
|
|
8633
|
+
this.parent.style.top = options.y + "px";
|
|
8634
|
+
this.pointer.style.transform = "rotateZ(180deg)";
|
|
8635
|
+
this.pointer.style.top = "-10px";
|
|
8636
|
+
if ((options.x - 17) + this.parent.offsetWidth > window.innerWidth) {
|
|
8637
|
+
this.parent.style.left = (options.x - this.parent.offsetWidth + 17) + "px";
|
|
8638
|
+
this.pointer.style.right = "16px";
|
|
8639
|
+
this.pointer.style.left = "auto";
|
|
8640
|
+
}
|
|
8641
|
+
else {
|
|
8642
|
+
this.parent.style.left = (options.x - 17) + "px";
|
|
8643
|
+
this.pointer.style.left = "16px";
|
|
8644
|
+
this.pointer.style.right = "auto";
|
|
8645
|
+
}
|
|
8646
|
+
}
|
|
8647
|
+
else if (options.position === 'left') {
|
|
8599
8648
|
this.parent.style.left = positionMeta.x + (positionMeta.width + 10) + "px";
|
|
8600
8649
|
this.parent.style.top = positionMeta.y + "px";
|
|
8601
8650
|
this.pointer.style.transform = "rotateZ(90deg)";
|
|
@@ -8613,18 +8662,29 @@ class Popup {
|
|
|
8613
8662
|
</div>
|
|
8614
8663
|
<div class="wrp-subtitle">
|
|
8615
8664
|
<span class="icon fas fa-calendar-alt"></span>
|
|
8616
|
-
<
|
|
8665
|
+
<div style="margin-right: 15px">
|
|
8666
|
+
<p class="startDate"></p>
|
|
8667
|
+
<p class="startHour"></p>
|
|
8668
|
+
</div>
|
|
8669
|
+
<div>
|
|
8670
|
+
<p class="endDate"></p>
|
|
8671
|
+
<p class="endHour"></p>
|
|
8672
|
+
</div>
|
|
8617
8673
|
</div>
|
|
8618
8674
|
<div class="pointer"></div>
|
|
8619
8675
|
</div>
|
|
8620
8676
|
`;
|
|
8621
8677
|
this.hide();
|
|
8622
8678
|
this.title = this.parent.querySelector(".title");
|
|
8623
|
-
this.
|
|
8679
|
+
this.startDate = this.parent.querySelector(".startDate");
|
|
8680
|
+
this.startHour = this.parent.querySelector(".startHour");
|
|
8681
|
+
this.endDate = this.parent.querySelector(".endDate");
|
|
8682
|
+
this.endHour = this.parent.querySelector(".endHour");
|
|
8624
8683
|
this.pointer = this.parent.querySelector(".pointer");
|
|
8625
8684
|
}
|
|
8626
8685
|
hide() {
|
|
8627
8686
|
this.parent.style.opacity = 0;
|
|
8687
|
+
this.parent.style.display = 'none';
|
|
8628
8688
|
this.parent.style.left = 0;
|
|
8629
8689
|
}
|
|
8630
8690
|
}
|
|
@@ -8723,12 +8783,16 @@ const defaultOptions = {
|
|
|
8723
8783
|
popupTrigger: "click",
|
|
8724
8784
|
customPopupHtml: null,
|
|
8725
8785
|
language: "en",
|
|
8786
|
+
allowMovement: true,
|
|
8787
|
+
hasPopup: true,
|
|
8788
|
+
showOnlyHours: false,
|
|
8789
|
+
showOnlyDays: false,
|
|
8726
8790
|
};
|
|
8727
8791
|
|
|
8728
8792
|
class Gantt {
|
|
8729
8793
|
constructor(wrapper, tasks, options) {
|
|
8730
|
-
this.setup_wrapper(wrapper);
|
|
8731
8794
|
this.setup_options(options);
|
|
8795
|
+
this.setup_wrapper(wrapper);
|
|
8732
8796
|
this.setup_tasks(tasks);
|
|
8733
8797
|
// initialize with default view mode
|
|
8734
8798
|
this.change_view_mode();
|
|
@@ -8772,6 +8836,9 @@ class Gantt {
|
|
|
8772
8836
|
// wrapper element
|
|
8773
8837
|
this.$container = document.createElement("div");
|
|
8774
8838
|
this.$container.classList.add("gantt-container");
|
|
8839
|
+
if (this.options.containerWidth) {
|
|
8840
|
+
this.$container.style.width = this.options.containerWidth + 'px';
|
|
8841
|
+
}
|
|
8775
8842
|
const parent_element = this.$svg.parentElement;
|
|
8776
8843
|
parent_element.appendChild(this.$container);
|
|
8777
8844
|
this.$container.appendChild(this.$svg);
|
|
@@ -8855,6 +8922,7 @@ class Gantt {
|
|
|
8855
8922
|
this.change_view_mode();
|
|
8856
8923
|
}
|
|
8857
8924
|
change_view_mode(mode = this.options.viewMode) {
|
|
8925
|
+
this.setup_gantt_dates();
|
|
8858
8926
|
this.update_view_scale(mode);
|
|
8859
8927
|
this.setup_dates();
|
|
8860
8928
|
this.render();
|
|
@@ -8867,7 +8935,6 @@ class Gantt {
|
|
|
8867
8935
|
if (view_mode === ViewMode.Hour) {
|
|
8868
8936
|
this.options.step = 24 / 24;
|
|
8869
8937
|
this.options.columnWidth = 50;
|
|
8870
|
-
// this.isHourView = true;
|
|
8871
8938
|
}
|
|
8872
8939
|
else if (view_mode === ViewMode.Day) {
|
|
8873
8940
|
this.options.step = 24;
|
|
@@ -8895,7 +8962,6 @@ class Gantt {
|
|
|
8895
8962
|
}
|
|
8896
8963
|
}
|
|
8897
8964
|
setup_dates() {
|
|
8898
|
-
this.setup_gantt_dates();
|
|
8899
8965
|
this.setup_date_values();
|
|
8900
8966
|
}
|
|
8901
8967
|
setup_gantt_dates() {
|
|
@@ -8905,7 +8971,7 @@ class Gantt {
|
|
|
8905
8971
|
for (let task of this.tasks) {
|
|
8906
8972
|
// set global start and end date
|
|
8907
8973
|
if (!this.minDate || task.start < this.minDate) {
|
|
8908
|
-
this._minDate = task.start;
|
|
8974
|
+
this._minDate = DateUtils.startOf(task.start, 'day');
|
|
8909
8975
|
}
|
|
8910
8976
|
if (!this.maxDate || task.end > this.maxDate) {
|
|
8911
8977
|
this._maxDate = task.end;
|
|
@@ -8919,28 +8985,28 @@ class Gantt {
|
|
|
8919
8985
|
this._maxDate = DateUtils.add(this.maxDate, (_b = this.options.marginAfterEnd) !== null && _b !== void 0 ? _b : 1, "hour");
|
|
8920
8986
|
break;
|
|
8921
8987
|
case ViewMode.QuarterDay:
|
|
8922
|
-
this._minDate = DateUtils.add(this.minDate, -((_c = this.options.marginBeforeStart) !== null && _c !== void 0 ? _c :
|
|
8923
|
-
this._maxDate = DateUtils.add(this.maxDate, (_d = this.options.marginAfterEnd) !== null && _d !== void 0 ? _d :
|
|
8988
|
+
this._minDate = DateUtils.add(this.minDate, -((_c = this.options.marginBeforeStart) !== null && _c !== void 0 ? _c : 6), "hour");
|
|
8989
|
+
this._maxDate = DateUtils.add(this.maxDate, (_d = this.options.marginAfterEnd) !== null && _d !== void 0 ? _d : 6, "hour");
|
|
8924
8990
|
break;
|
|
8925
8991
|
case ViewMode.HalfDay:
|
|
8926
|
-
this._minDate = DateUtils.add(this.minDate, -((_e = this.options.marginBeforeStart) !== null && _e !== void 0 ? _e :
|
|
8927
|
-
this._maxDate = DateUtils.add(this.maxDate, (_f = this.options.marginAfterEnd) !== null && _f !== void 0 ? _f :
|
|
8992
|
+
this._minDate = DateUtils.add(this.minDate, -((_e = this.options.marginBeforeStart) !== null && _e !== void 0 ? _e : 12), "hour");
|
|
8993
|
+
this._maxDate = DateUtils.add(this.maxDate, (_f = this.options.marginAfterEnd) !== null && _f !== void 0 ? _f : 12, "hour");
|
|
8928
8994
|
break;
|
|
8929
8995
|
case ViewMode.Day:
|
|
8930
|
-
this._minDate = DateUtils.add(this.minDate, -((_g = this.options.marginBeforeStart) !== null && _g !== void 0 ? _g :
|
|
8931
|
-
this._maxDate = DateUtils.add(this.maxDate, (_h = this.options.marginAfterEnd) !== null && _h !== void 0 ? _h :
|
|
8996
|
+
this._minDate = DateUtils.add(this.minDate, -((_g = this.options.marginBeforeStart) !== null && _g !== void 0 ? _g : 1), "day");
|
|
8997
|
+
this._maxDate = DateUtils.add(this.maxDate, (_h = this.options.marginAfterEnd) !== null && _h !== void 0 ? _h : 1, "day");
|
|
8932
8998
|
break;
|
|
8933
8999
|
case ViewMode.Week:
|
|
8934
|
-
this._minDate = DateUtils.add(this.minDate, -((_j = this.options.marginBeforeStart) !== null && _j !== void 0 ? _j : 1), "
|
|
8935
|
-
this._maxDate = DateUtils.add(this.maxDate, (_k = this.options.marginAfterEnd) !== null && _k !== void 0 ? _k : 1, "
|
|
9000
|
+
this._minDate = DateUtils.add(this.minDate, -((_j = this.options.marginBeforeStart) !== null && _j !== void 0 ? _j : 1), "week");
|
|
9001
|
+
this._maxDate = DateUtils.add(this.maxDate, (_k = this.options.marginAfterEnd) !== null && _k !== void 0 ? _k : 1, "week");
|
|
8936
9002
|
break;
|
|
8937
9003
|
case ViewMode.Month:
|
|
8938
|
-
this._minDate = DateUtils.add(this.minDate, -((_l = this.options.marginBeforeStart) !== null && _l !== void 0 ? _l : 1), "
|
|
8939
|
-
this._maxDate = DateUtils.add(this.maxDate, (_m = this.options.marginAfterEnd) !== null && _m !== void 0 ? _m : 1, "
|
|
9004
|
+
this._minDate = DateUtils.add(this.minDate, -((_l = this.options.marginBeforeStart) !== null && _l !== void 0 ? _l : 1), "month");
|
|
9005
|
+
this._maxDate = DateUtils.add(this.maxDate, (_m = this.options.marginAfterEnd) !== null && _m !== void 0 ? _m : 1, "month");
|
|
8940
9006
|
break;
|
|
8941
9007
|
case ViewMode.Year:
|
|
8942
|
-
this._minDate = DateUtils.add(this.minDate, -((_o = this.options.marginBeforeStart) !== null && _o !== void 0 ? _o :
|
|
8943
|
-
this._maxDate = DateUtils.add(this.maxDate, (_p = this.options.marginAfterEnd) !== null && _p !== void 0 ? _p :
|
|
9008
|
+
this._minDate = DateUtils.add(this.minDate, -((_o = this.options.marginBeforeStart) !== null && _o !== void 0 ? _o : 1), "year");
|
|
9009
|
+
this._maxDate = DateUtils.add(this.maxDate, (_p = this.options.marginAfterEnd) !== null && _p !== void 0 ? _p : 1, "year");
|
|
8944
9010
|
break;
|
|
8945
9011
|
}
|
|
8946
9012
|
}
|
|
@@ -8964,6 +9030,10 @@ class Gantt {
|
|
|
8964
9030
|
}
|
|
8965
9031
|
this.dates.push(cur_date);
|
|
8966
9032
|
}
|
|
9033
|
+
if (this.options.containerWidth) {
|
|
9034
|
+
const columnWidth = (this.options.containerWidth - 1) / this.dates.length;
|
|
9035
|
+
this.options.columnWidth = columnWidth < 45 ? 45 : columnWidth;
|
|
9036
|
+
}
|
|
8967
9037
|
console.log("cur_date", cur_date);
|
|
8968
9038
|
console.log("dates", this.dates);
|
|
8969
9039
|
}
|
|
@@ -9001,7 +9071,10 @@ class Gantt {
|
|
|
9001
9071
|
this.make_grid_ticks();
|
|
9002
9072
|
}
|
|
9003
9073
|
make_grid_background() {
|
|
9004
|
-
|
|
9074
|
+
let grid_width = this.dates.length * this.options.columnWidth;
|
|
9075
|
+
if (this.options.containerWidth) {
|
|
9076
|
+
grid_width = this.options.containerWidth;
|
|
9077
|
+
}
|
|
9005
9078
|
const distinct_rows = [...new Set(this.tasks.map((x) => x._row_id))];
|
|
9006
9079
|
const grid_height = this.options.headerHeight +
|
|
9007
9080
|
this.options.padding / 2 +
|
|
@@ -9081,6 +9154,11 @@ class Gantt {
|
|
|
9081
9154
|
if (this.view_is(ViewMode.Month) && date.getMonth() % 3 === 0) {
|
|
9082
9155
|
tick_class += " thick";
|
|
9083
9156
|
}
|
|
9157
|
+
// Thick ticks for hours
|
|
9158
|
+
if (this.view_is(ViewMode.Hour) &&
|
|
9159
|
+
date.getHours() == 0) {
|
|
9160
|
+
tick_class += " thick";
|
|
9161
|
+
}
|
|
9084
9162
|
createSVG("path", {
|
|
9085
9163
|
d: `M ${tick_x} ${tick_y} v ${tick_height}`,
|
|
9086
9164
|
class: tick_class,
|
|
@@ -9189,9 +9267,7 @@ class Gantt {
|
|
|
9189
9267
|
hourLower: DateUtils.format(date, "HH:mm", this.options.language),
|
|
9190
9268
|
quarterDayLower: DateUtils.format(date, "HH:mm", this.options.language),
|
|
9191
9269
|
halfDayLower: DateUtils.format(date, "HH:mm", this.options.language),
|
|
9192
|
-
dayLower:
|
|
9193
|
-
? DateUtils.format(date, "D", this.options.language)
|
|
9194
|
-
: "",
|
|
9270
|
+
dayLower: DateUtils.format(date, "D", this.options.language),
|
|
9195
9271
|
weekLower: date.getMonth() !== last_date.getMonth()
|
|
9196
9272
|
? DateUtils.format(date, "D MMM", this.options.language)
|
|
9197
9273
|
: DateUtils.format(date, "D", this.options.language),
|
|
@@ -9200,12 +9276,12 @@ class Gantt {
|
|
|
9200
9276
|
quarterDayUpper: date.getDate() !== last_date.getDate()
|
|
9201
9277
|
? DateUtils.format(date, "D MMM", this.options.language)
|
|
9202
9278
|
: "",
|
|
9203
|
-
halfDayUpper: date.getDate() !== last_date.getDate()
|
|
9204
|
-
? date.getMonth() !== last_date.getMonth()
|
|
9279
|
+
halfDayUpper: (date.getDate() !== last_date.getDate())
|
|
9280
|
+
? (((date.getMonth() !== last_date.getMonth()) || i < 2)
|
|
9205
9281
|
? DateUtils.format(date, "D MMM", this.options.language)
|
|
9206
|
-
: DateUtils.format(date, "D", this.options.language)
|
|
9282
|
+
: DateUtils.format(date, "D", this.options.language))
|
|
9207
9283
|
: "",
|
|
9208
|
-
dayUpper: date.getMonth() !== last_date.getMonth()
|
|
9284
|
+
dayUpper: ((date.getMonth() !== last_date.getMonth()) || i === 0)
|
|
9209
9285
|
? DateUtils.format(date, "MMMM", this.options.language)
|
|
9210
9286
|
: "",
|
|
9211
9287
|
weekUpper: date.getMonth() !== last_date.getMonth()
|
|
@@ -9217,8 +9293,8 @@ class Gantt {
|
|
|
9217
9293
|
yearUpper: date.getFullYear() !== last_date.getFullYear()
|
|
9218
9294
|
? DateUtils.format(date, "YYYY", this.options.language)
|
|
9219
9295
|
: "",
|
|
9220
|
-
|
|
9221
|
-
? DateUtils.format(date, "
|
|
9296
|
+
hourUpper: date.getDate() !== last_date.getDate()
|
|
9297
|
+
? DateUtils.format(date, "D MMM", this.options.language)
|
|
9222
9298
|
: "",
|
|
9223
9299
|
};
|
|
9224
9300
|
// Descontando 20 para adcionar uma segunda linha de informação no cabeçalho
|
|
@@ -9227,15 +9303,16 @@ class Gantt {
|
|
|
9227
9303
|
lower_y: this.options.headerHeight - 20,
|
|
9228
9304
|
upper_y: this.options.headerHeight - 20 - 25,
|
|
9229
9305
|
};
|
|
9306
|
+
debugger;
|
|
9230
9307
|
const x_pos = {
|
|
9231
9308
|
hourLower: this.options.columnWidth / 2,
|
|
9232
|
-
hourUpper: this.options.columnWidth * 24 / 2,
|
|
9309
|
+
hourUpper: (this.dates.length < 14) ? (this.options.columnWidth) : (this.options.columnWidth * 24 / 2),
|
|
9233
9310
|
quarterDayLower: this.options.columnWidth / 2,
|
|
9234
9311
|
quarterDayUpper: this.options.columnWidth * 4 / 2,
|
|
9235
9312
|
halfDayLower: this.options.columnWidth / 2,
|
|
9236
9313
|
halfDayUpper: this.options.columnWidth * 2 / 2,
|
|
9237
9314
|
dayLower: this.options.columnWidth / 2,
|
|
9238
|
-
dayUpper: (this.options.columnWidth * 30) / 2,
|
|
9315
|
+
dayUpper: (this.dates.length < 15) ? (this.options.columnWidth) : ((this.options.columnWidth * 30) / 2),
|
|
9239
9316
|
weekLower: 0,
|
|
9240
9317
|
weekUpper: (this.options.columnWidth * 4) / 2,
|
|
9241
9318
|
monthLower: this.options.columnWidth / 2,
|
|
@@ -9331,7 +9408,7 @@ class Gantt {
|
|
|
9331
9408
|
else if (element.classList.contains("right")) {
|
|
9332
9409
|
is_resizing_right = true;
|
|
9333
9410
|
}
|
|
9334
|
-
else if (element.classList.contains("bar-wrapper")) {
|
|
9411
|
+
else if (element.classList.contains("bar-wrapper") && this.options.allowMovement) {
|
|
9335
9412
|
is_dragging = true;
|
|
9336
9413
|
}
|
|
9337
9414
|
bar_wrapper.classList.add("active");
|
|
@@ -9386,7 +9463,7 @@ class Gantt {
|
|
|
9386
9463
|
});
|
|
9387
9464
|
}, null);
|
|
9388
9465
|
document.addEventListener("mouseup", (e) => {
|
|
9389
|
-
if (is_dragging || is_resizing_left || is_resizing_right) {
|
|
9466
|
+
if (is_dragging || is_resizing_left || is_resizing_right || !this.options.allowMovement) {
|
|
9390
9467
|
bars.forEach((bar) => bar.group.classList.remove("active"));
|
|
9391
9468
|
}
|
|
9392
9469
|
is_dragging = false;
|
|
@@ -9490,6 +9567,11 @@ let GanttComponent = class GanttComponent {
|
|
|
9490
9567
|
this.multipleTaskPerLine = false;
|
|
9491
9568
|
this.showSideTable = true;
|
|
9492
9569
|
this.viewMode = ViewMode.Day;
|
|
9570
|
+
this.allowMovement = true;
|
|
9571
|
+
this.hasPopup = true;
|
|
9572
|
+
this.fullWidth = false;
|
|
9573
|
+
this.showOnlyHours = false;
|
|
9574
|
+
this.showOnlyDays = false;
|
|
9493
9575
|
this.taskClicked = new EventEmitter();
|
|
9494
9576
|
this.taskDateChanged = new EventEmitter();
|
|
9495
9577
|
this.viewChanged = new EventEmitter();
|
|
@@ -9498,11 +9580,19 @@ let GanttComponent = class GanttComponent {
|
|
|
9498
9580
|
this._validateViewMode();
|
|
9499
9581
|
}
|
|
9500
9582
|
ngAfterViewInit() {
|
|
9583
|
+
if (this.fullWidth) {
|
|
9584
|
+
this.containerWidth = this.outer.nativeElement.offsetWidth - this.side.nativeElement.offsetWidth;
|
|
9585
|
+
}
|
|
9501
9586
|
this._gantt = new Gantt("#gantt", this._filterTask(this.tasks), {
|
|
9502
9587
|
viewMode: this.viewMode,
|
|
9503
9588
|
marginBeforeStart: this.marginBeforeStart,
|
|
9504
9589
|
marginAfterEnd: this.marginAfterEnd,
|
|
9505
9590
|
language: "pt-BR",
|
|
9591
|
+
allowMovement: this.allowMovement,
|
|
9592
|
+
hasPopup: this.hasPopup,
|
|
9593
|
+
containerWidth: this.containerWidth,
|
|
9594
|
+
showOnlyHours: this.showOnlyHours,
|
|
9595
|
+
showOnlyDays: this.showOnlyDays,
|
|
9506
9596
|
onClick: (task) => this.taskClicked.emit(task),
|
|
9507
9597
|
onDateChange: (task, start, end) => this.taskDateChanged.emit({ task, start, end }),
|
|
9508
9598
|
onViewChange: (viewMode) => this.viewChanged.emit(viewMode),
|
|
@@ -9574,6 +9664,24 @@ __decorate([
|
|
|
9574
9664
|
__decorate([
|
|
9575
9665
|
Input()
|
|
9576
9666
|
], GanttComponent.prototype, "marginAfterEnd", void 0);
|
|
9667
|
+
__decorate([
|
|
9668
|
+
Input()
|
|
9669
|
+
], GanttComponent.prototype, "allowMovement", void 0);
|
|
9670
|
+
__decorate([
|
|
9671
|
+
Input()
|
|
9672
|
+
], GanttComponent.prototype, "hasPopup", void 0);
|
|
9673
|
+
__decorate([
|
|
9674
|
+
Input()
|
|
9675
|
+
], GanttComponent.prototype, "containerWidth", void 0);
|
|
9676
|
+
__decorate([
|
|
9677
|
+
Input()
|
|
9678
|
+
], GanttComponent.prototype, "fullWidth", void 0);
|
|
9679
|
+
__decorate([
|
|
9680
|
+
Input()
|
|
9681
|
+
], GanttComponent.prototype, "showOnlyHours", void 0);
|
|
9682
|
+
__decorate([
|
|
9683
|
+
Input()
|
|
9684
|
+
], GanttComponent.prototype, "showOnlyDays", void 0);
|
|
9577
9685
|
__decorate([
|
|
9578
9686
|
Output()
|
|
9579
9687
|
], GanttComponent.prototype, "taskClicked", void 0);
|
|
@@ -9583,12 +9691,18 @@ __decorate([
|
|
|
9583
9691
|
__decorate([
|
|
9584
9692
|
Output()
|
|
9585
9693
|
], GanttComponent.prototype, "viewChanged", void 0);
|
|
9694
|
+
__decorate([
|
|
9695
|
+
ViewChild('outer')
|
|
9696
|
+
], GanttComponent.prototype, "outer", void 0);
|
|
9697
|
+
__decorate([
|
|
9698
|
+
ViewChild('side')
|
|
9699
|
+
], GanttComponent.prototype, "side", void 0);
|
|
9586
9700
|
GanttComponent = __decorate([
|
|
9587
9701
|
Component({
|
|
9588
9702
|
selector: "s-gantt",
|
|
9589
|
-
template: "<div class=\"outer\">\n <gantt-side-table\n
|
|
9703
|
+
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",
|
|
9590
9704
|
encapsulation: ViewEncapsulation.None,
|
|
9591
|
-
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:.
|
|
9705
|
+
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}"]
|
|
9592
9706
|
})
|
|
9593
9707
|
], GanttComponent);
|
|
9594
9708
|
|
|
@@ -9610,8 +9724,8 @@ __decorate([
|
|
|
9610
9724
|
SideTableComponent = __decorate([
|
|
9611
9725
|
Component({
|
|
9612
9726
|
selector: 'gantt-side-table',
|
|
9613
|
-
template: "<div class=\"side-table\">\n <div class=\"column-title\">\n <span>{{ columnTitle }}</span>\n </div>\n <div class=\"tasks\">\n <div
|
|
9614
|
-
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\"
|
|
9727
|
+
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",
|
|
9728
|
+
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}"]
|
|
9615
9729
|
})
|
|
9616
9730
|
], SideTableComponent);
|
|
9617
9731
|
|
|
@@ -9619,7 +9733,7 @@ let GanttModule = class GanttModule {
|
|
|
9619
9733
|
};
|
|
9620
9734
|
GanttModule = __decorate([
|
|
9621
9735
|
NgModule({
|
|
9622
|
-
imports: [CommonModule],
|
|
9736
|
+
imports: [CommonModule, TooltipModule],
|
|
9623
9737
|
declarations: [
|
|
9624
9738
|
GanttComponent,
|
|
9625
9739
|
SideTableComponent,
|