|
|
@@ -178,9 +178,6 @@ class Timeline extends LitElement {
|
|
|
.jc-major-slot{
|
|
|
border-left-style: solid;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
.jc-timeslots{
|
|
|
position:absolute;
|
|
|
top:0px;
|
|
|
@@ -305,7 +302,7 @@ class Timeline extends LitElement {
|
|
|
this.updateLegend();
|
|
|
}
|
|
|
|
|
|
- private _slotDuration: number = 30; // in minute
|
|
|
+ private _slotDuration = 30; // in minute
|
|
|
@property({ type: Number })
|
|
|
public get slotDuration(): number {
|
|
|
return this._slotDuration;
|
|
|
@@ -315,7 +312,7 @@ class Timeline extends LitElement {
|
|
|
this.updateLegend();
|
|
|
}
|
|
|
|
|
|
- private _legendSpan: number = 2; // in slot count
|
|
|
+ private _legendSpan = 2; // in slot count
|
|
|
@property({ type: Number })
|
|
|
public get legendSpan(): number {
|
|
|
return this._legendSpan;
|
|
|
@@ -326,7 +323,7 @@ class Timeline extends LitElement {
|
|
|
}
|
|
|
|
|
|
@property({ type: Number })
|
|
|
- private rowHeight: number = 32 // in px
|
|
|
+ private rowHeight = 32 // in px
|
|
|
|
|
|
@property({ type: Number })
|
|
|
private slotWidth = 20 // in px
|
|
|
@@ -398,7 +395,7 @@ class Timeline extends LitElement {
|
|
|
removeRessourceById(id: string): TimelineContent {
|
|
|
return this._removeRessourceById(id);
|
|
|
}
|
|
|
- _removeRessourceById(id: string, depth:number = 0){
|
|
|
+ _removeRessourceById(id: string, depth = 0){
|
|
|
const output: TimelineContent = { ressources: [], items: [] };
|
|
|
|
|
|
for (let i = 0; i < this.rows.length; i) {
|
|
|
@@ -478,7 +475,7 @@ class Timeline extends LitElement {
|
|
|
const start = this._start.toDate().getTime();
|
|
|
const end = this._end.toDate().getTime();
|
|
|
// List potential interval
|
|
|
- let points = [start, end]
|
|
|
+ const points = [start, end]
|
|
|
const populateInterval = (d: Date) => {
|
|
|
const t = d.getTime()
|
|
|
if (start < t && t < end && !points.includes(t)) {
|
|
|
@@ -491,7 +488,7 @@ class Timeline extends LitElement {
|
|
|
});
|
|
|
points.sort();
|
|
|
// Count maximum number of interval intersection
|
|
|
- let intervals: Array<TimeInterval> = []
|
|
|
+ const intervals: Array<TimeInterval> = []
|
|
|
for (let i = 0; i < points.length - 1; i++) {
|
|
|
const startTime = points[i];
|
|
|
const endTime = points[i+1];
|
|
|
@@ -555,7 +552,7 @@ class Timeline extends LitElement {
|
|
|
|
|
|
if(isLegendPossible){
|
|
|
const row:Array<legendItem> = [];
|
|
|
- let i:number = 0;
|
|
|
+ let i = 0;
|
|
|
while(currentDate.isBefore(this._end)){
|
|
|
i+=this.legendSpan;
|
|
|
if(nextColumn.diff(currentDate,legendUnit) > 0 ){
|
|
|
@@ -701,7 +698,7 @@ class Timeline extends LitElement {
|
|
|
}
|
|
|
private _getEventClickHandler(clickedItem: Selectable) {
|
|
|
const item = clickedItem;
|
|
|
- return (e: MouseEvent, wasModified:boolean = false) => {
|
|
|
+ return (e: MouseEvent, wasModified = false) => {
|
|
|
e.stopPropagation()
|
|
|
const idx = this.selectedList.indexOf(item)
|
|
|
if (idx > -1) {
|
|
|
@@ -722,7 +719,7 @@ class Timeline extends LitElement {
|
|
|
this.selectedList.push(item)
|
|
|
this.updateTimeslotById(item.id)
|
|
|
}
|
|
|
- let myEvent = new CustomEvent('item-selected', {
|
|
|
+ const myEvent = new CustomEvent('item-selected', {
|
|
|
detail: { items: this.selectedList },
|
|
|
bubbles: true,
|
|
|
composed: true
|
|
|
@@ -751,7 +748,7 @@ class Timeline extends LitElement {
|
|
|
if (!slot.isDisplayed) {
|
|
|
return html``
|
|
|
}
|
|
|
- let rowTop: number = 0
|
|
|
+ let rowTop = 0
|
|
|
let ressource: Ressource;
|
|
|
let i: number;
|
|
|
for (i = 0; i < this.rows.length && this.rows[i].id !== slot.ressourceId; i++) {
|
|
|
@@ -783,7 +780,7 @@ class Timeline extends LitElement {
|
|
|
return html`<div class="jc-timeslot empty" style="${styleMap(style)}"></div>`
|
|
|
}
|
|
|
|
|
|
- var content: TemplateResult = html`${slot.title}`
|
|
|
+ let content: TemplateResult = html`${slot.title}`
|
|
|
const resizer = slot.editable === null ? ressource.eventEditable : slot.editable;
|
|
|
const editableRessource = slot.ressourceEditable === null ? ressource.eventRessourceEditable : slot.ressourceEditable;
|
|
|
if (resizer) {
|
|
|
@@ -814,7 +811,7 @@ class Timeline extends LitElement {
|
|
|
}
|
|
|
_onRessourceDragEnter(event:DragEvent){
|
|
|
if (event.target instanceof HTMLElement){
|
|
|
- var tgt = event.target;
|
|
|
+ const tgt = event.target;
|
|
|
tgt.classList.add("target");
|
|
|
}else if(event.target instanceof Node){
|
|
|
}
|
|
|
@@ -879,10 +876,10 @@ class Timeline extends LitElement {
|
|
|
</tr>`;
|
|
|
|
|
|
}
|
|
|
- renderGridRow(columns: Array<Dayjs>, rowId: number = -1, height: number = 30): TemplateResult {
|
|
|
+ renderGridRow(columns: Array<Dayjs>, rowId = -1, height = 30): TemplateResult {
|
|
|
return html`<tr row-id="${rowId}">${columns.map((d,i) => html`<td style="height:${height}px;" class="jc-slot ${(i % this.legendSpan) === 0 ? "jc-major-slot" :""}" start="${d.toISOString()}"> </td>`)}</tr>`
|
|
|
}
|
|
|
- render() {
|
|
|
+ render():TemplateResult {
|
|
|
const nCol = Math.floor(this._end.diff(this._start, 'm') / this.slotDuration) + 1;
|
|
|
const columns: Array<Dayjs> = []
|
|
|
for (let i = 0; i < nCol; i++) {
|