Skip to content

Commit

Permalink
Merge branch 'release/5.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
abalad committed Apr 7, 2021
2 parents 0b09bfa + 4835690 commit d26b5d0
Show file tree
Hide file tree
Showing 24 changed files with 226 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[textBefore]="textBefore"
[textAfter]="textAfter"
[height]="height"
[required]="required"
(clear)="close()"
(click)="toggleIsOpen()"
(clickAddon)="clickAddon.emit($event)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui-arrow-up" @overlay *ngIf="overlayPosition === 'bottom'"></div>
<div class="ui-wrapper-calendar-content" @overlay>
<div class="ui-calendar-content">
<tl-calendar [date]="date" (selectDay)="selectDay($event)" (today)="selectDay($event)"></tl-calendar>
<tl-calendar [date]="date" [holidays]="holidays" (selectDay)="selectDay($event)" (today)="selectDay($event)"></tl-calendar>
</div>
<div class="ui-arrow-down" @overlay *ngIf="overlayPosition === 'top'"></div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@angular/core';
import { TlInput } from '../../input/input';
import { OverlayAnimation } from '../../core/directives/overlay-animation';
import { CalendarHoliday } from '../../calendar/interfaces/calendar-holiday.interface';

@Component( {
selector: 'tl-datepicker-content',
Expand All @@ -47,6 +48,8 @@ export class TlDatePickerContent {

@Input('overlayPosition') overlayPosition: string;

@Input() holidays: Array<CalendarHoliday> = [];

@Output() selectDayContent: EventEmitter<any> = new EventEmitter<any>();

@ViewChild(TemplateRef, {static: true} ) template: TemplateRef<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<tl-datepicker-content
[input]="tlinput"
[date]="date"
[holidays]="holidays"
[overlayPosition]="positionOverlay"
(selectDayContent)="onSelectDay($event)">
</tl-datepicker-content>
Expand Down
6 changes: 4 additions & 2 deletions projects/truly-ui/src/components/datepicker/datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import {
Output, Self,
ViewChild
} from '@angular/core';
import {MakeProvider} from '../core/base/value-accessor-provider';
import {FormControlName, NgControl, NgModel} from '@angular/forms';
import {NgControl} from '@angular/forms';
import {TlInput} from '../input/input';
import {TlCalendar} from '../calendar/calendar';

Expand All @@ -41,6 +40,7 @@ import {ConnectedOverlayPositionChange} from '@angular/cdk/overlay';
import {KeyEvent} from '../core/enums/key-events';
import {ValueAccessorBase} from '../input/core/value-accessor';
import {Subscription} from 'rxjs';
import {CalendarHoliday} from '../calendar/interfaces/calendar-holiday.interface';

export interface DateOject {
day: number;
Expand Down Expand Up @@ -84,6 +84,8 @@ export class TlDatePicker extends ValueAccessorBase<Date | string> implements On

@Input() openOnFocus = true;

@Input() holidays: Array<CalendarHoliday> = [];

@Output() selectDay: EventEmitter<any> = new EventEmitter<any>();

@Output() completeMask: EventEmitter<any> = new EventEmitter<any>();
Expand Down
22 changes: 13 additions & 9 deletions projects/truly-ui/src/components/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SOFTWARE.
*/
import {
AfterContentInit,
AfterContentInit, ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Expand All @@ -36,7 +36,7 @@ import {trigger, transition, style, animate} from '@angular/animations';
import {ToolbarConfigModel} from './model/toolbar-config.model';
import {ToolbarConfig} from './interfaces/toolbar-config';
import {I18nService} from '../i18n/i18n.service';
import {ControlValueAccessor, NG_VALUE_ACCESSOR, NgControl} from '@angular/forms';
import {ControlValueAccessor, NgControl} from '@angular/forms';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
import {Subscription} from 'rxjs';
import {EditorService} from './services/editor.service';
Expand Down Expand Up @@ -154,6 +154,7 @@ export class TlEditor implements ControlValueAccessor, AfterContentInit, OnChang
private renderer: Renderer2,
private editorService: EditorService,
private sanitizer: DomSanitizer,
private cd: ChangeDetectorRef,
@Optional() @Self() public ngControl: NgControl) {
this.setControl();
this.fontCollection = [
Expand Down Expand Up @@ -195,18 +196,18 @@ export class TlEditor implements ControlValueAccessor, AfterContentInit, OnChang
listenChangeControl() {
if ( this.control ) {
this.subscription.add(this.control.valueChanges.subscribe(( values ) => {
if (!this.listenerRegistered) {
this.handleFieldsPropagation();
}

}));
}
}

handleFieldsPropagation() {
const fields = this.contentEditor.nativeElement.querySelectorAll('.ui-field');
for (const item of fields) {
this.preventPropagation(item);
}
setTimeout(() => {
const fields = this.contentEditor.nativeElement.querySelectorAll('.ui-field');
for (const item of fields) {
this.preventPropagation(item);
}
}, 100);
}

alignContent(align) {
Expand Down Expand Up @@ -581,7 +582,10 @@ export class TlEditor implements ControlValueAccessor, AfterContentInit, OnChang

writeValue(value: any): void {
this.content = this.sanitizer.bypassSecurityTrustHtml(value);
this.handleFieldsPropagation();
this.recoverCursorPosition();
this.cd.detectChanges();

}

registerOnChange(fn: any): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
<div class="ui-editor-header">
<ul class="ui-tools-list">
<li class="dropdown" [tooltip]="{text: toolbarConfig.font?.family?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig.font?.family?.show">
<li class="dropdown" [tooltip]="{text: toolbarConfig?.font?.family?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig?.font?.family?.show">
<select class="select" [(ngModel)]="fontSelected" (ngModelChange)="changeFont.emit($event)">
<option *ngFor="let item of fontCollection" [ngValue]="item.value">{{ item?.description }}</option>
</select>
</li>
<li class="dropdown" [tooltip]="{text: toolbarConfig.font?.size?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig.font.size?.show">
<li class="dropdown" [tooltip]="{text: toolbarConfig?.font?.size?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig?.font.size?.show">
<select class="select" [(ngModel)]="fontSizeSelected" (ngModelChange)="changeFontSize.emit($event)">
<option *ngFor="let item of fontSizeCollection" [ngValue]="item.value">{{ item?.description }}</option>
</select>
</li>
<li [tooltip]="{text: toolbarConfig.font?.bold?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig.font.bold?.show">
<li [tooltip]="{text: toolbarConfig?.font?.bold?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig?.font.bold?.show">
<button class="ui-command fa fa-bold" [ngClass]="{'ui-active-tool': activeTools.bold}"
(click)="clickBold.emit()"></button>
</li>
<li [tooltip]="{text: toolbarConfig.font.italic?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig.font.italic?.show">
<li [tooltip]="{text: toolbarConfig?.font.italic?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig?.font.italic?.show">
<button class="ui-command fa fa-italic" [ngClass]="{'ui-active-tool': activeTools.italic}"
(click)="clickItalic.emit()"></button>
</li>
<li [tooltip]="{text: toolbarConfig.font.underline?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig.font.underline?.show">
<li [tooltip]="{text: toolbarConfig?.font.underline?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig?.font.underline?.show">
<button class="ui-command fa fa-underline" [ngClass]="{'ui-active-tool': activeTools.underline}"
(click)="clickUnderline.emit()"></button>
</li>
<li [style.border-bottom]="'2px solid ' + colorSelected" #button
[tooltip]="{text: toolbarConfig.font.color?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig.font.color?.show">
[tooltip]="{text: toolbarConfig?.font.color?.tooltipText, placement: 'top-center'}"
*ngIf="toolbarConfig?.font.color?.show">
<button class="ui-command fa fa-font"></button>
<tl-colorpicker [mode]="'fromOrigin'" [elementOrigin]="button" [recentColors]="true"
[(ngModel)]="colorSelected" [returnFormatColor]="true"
(selectColor)="changeColor.emit($event)"></tl-colorpicker>
</li>
<li *ngIf="toolbarConfig.font.highlight?.show"
[tooltip]="{text: toolbarConfig.font.highlight?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.font.highlight?.show"
[tooltip]="{text: toolbarConfig?.font.highlight?.tooltipText, placement: 'top-center'}">
<button class="ui-command fas fas fa-pen-alt" [ngClass]="{'ui-active-tool': cursorHighlight}"
(click)="clickHighlight.emit()"></button>
</li>
<li *ngIf="toolbarConfig.alignment?.left?.show"
[tooltip]="{text: toolbarConfig.alignment?.left?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.alignment?.left?.show"
[tooltip]="{text: toolbarConfig?.alignment?.left?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-align-left" [ngClass]="{'ui-active-tool': activeTools.alignLeft}"
(click)="clickAlignContent.emit('justifyLeft')"></button>
</li>
<li *ngIf="toolbarConfig.alignment?.center?.show"
[tooltip]="{text: toolbarConfig.alignment?.center?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.alignment?.center?.show"
[tooltip]="{text: toolbarConfig?.alignment?.center?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-align-center" [ngClass]="{'ui-active-tool': activeTools.alignCenter}"
(click)="clickAlignContent.emit('justifyCenter')"></button>
</li>
<li *ngIf="toolbarConfig.alignment?.right?.show"
[tooltip]="{text: toolbarConfig.alignment?.right?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.alignment?.right?.show"
[tooltip]="{text: toolbarConfig?.alignment?.right?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-align-right" [ngClass]="{'ui-active-tool': activeTools.alignRight}"
(click)="clickAlignContent.emit('justifyRight')"></button>
</li>
<li *ngIf="toolbarConfig.alignment?.justify?.show"
[tooltip]="{text: toolbarConfig.alignment?.justify?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.alignment?.justify?.show"
[tooltip]="{text: toolbarConfig?.alignment?.justify?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-align-justify" [ngClass]="{'ui-active-tool': activeTools.alignJustify}"
(click)="clickAlignContent.emit('justifyFull')"></button>
</li>
<li *ngIf="toolbarConfig.lists?.ordered?.show"
[tooltip]="{text: toolbarConfig.lists?.ordered?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.lists?.ordered?.show"
[tooltip]="{text: toolbarConfig?.lists?.ordered?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-list-ul" [ngClass]="{'ui-active-tool': activeTools.listUnordered}"
(click)="clickUnorderedList.emit()"></button>
</li>
<li *ngIf="toolbarConfig.lists?.unordered?.show"
[tooltip]="{text: toolbarConfig.lists?.unordered?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.lists?.unordered?.show"
[tooltip]="{text: toolbarConfig?.lists?.unordered?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-list-ol" [ngClass]="{'ui-active-tool': activeTools.listOrdered}"
(click)="clickOrderedList.emit()"></button>
</li>
<li *ngIf="toolbarConfig.others?.link?.show"
[tooltip]="{text: toolbarConfig.others?.link?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.others?.link?.show"
[tooltip]="{text: toolbarConfig?.others?.link?.tooltipText, placement: 'top-center'}">
<button class="ui-command fa fa-link" (click)="clickLink.emit()"></button>
</li>
<li *ngIf="toolbarConfig.others?.imageLink?.show"
[tooltip]="{text: toolbarConfig.others?.imageLink?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.others?.imageLink?.show"
[tooltip]="{text: toolbarConfig?.others?.imageLink?.tooltipText, placement: 'top-center'}">
<button class="ui-command far fa-image" (click)="clickImage.emit()"></button>
</li>
<li *ngIf="toolbarConfig.others?.quote?.show"
[tooltip]="{text: toolbarConfig.others?.quote?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.others?.quote?.show"
[tooltip]="{text: toolbarConfig?.others?.quote?.tooltipText, placement: 'top-center'}">
<button class="ui-command fas fa-quote-right" [ngClass]="{'ui-active-tool': activeTools.blockQuote}"
(click)="clickQuote.emit()"></button>
</li>
<li *ngIf="toolbarConfig.others?.clear?.show"
[tooltip]="{text: toolbarConfig.others?.clear?.tooltipText, placement: 'top-center'}">
<li *ngIf="toolbarConfig?.others?.clear?.show"
[tooltip]="{text: toolbarConfig?.others?.clear?.tooltipText, placement: 'top-center'}">
<button class="ui-command far fa-trash-alt"
(click)="clickClear.emit()"></button>
</li>
<li class="dropdown">
<select class="select" *ngIf="toolbarConfig?.others?.field" [tooltip]="{text: toolbarConfig.others?.field?.tooltipText, placement: 'top-center'}"
<select class="select" *ngIf="toolbarConfig?.others?.field" [tooltip]="{text: toolbarConfig?.others?.field?.tooltipText, placement: 'top-center'}"
[(ngModel)]="defaultField" (ngModelChange)="onChangeField($event)">
<option default>{{ labelAddField }}</option>
<option *ngFor="let item of fields" [ngValue]="item.field">{{ item?.field }}</option>
Expand Down
1 change: 1 addition & 0 deletions projects/truly-ui/src/components/schedule/schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
[slatNumberRowsAsArray]="slatNumberRowsAsArray"
[workScale]="workScale"
(onEventContextmenu)="eventContextmenu.emit($event)"
(onRowClick)="rowClick.emit($event)"
(onRowDbClick)="rowDbClick.emit($event)"
(onEventClick)="eventClick.emit($event)"
(onEventDbClick)="eventDbClick.emit($event)"
Expand Down
12 changes: 11 additions & 1 deletion projects/truly-ui/src/components/schedule/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class TlSchedule implements OnInit, OnChanges {
} else {
this._events = [...events].sort(( a, b ) => a.date.start - b.date.start );
this._events = JSON.parse( JSON.stringify(this._events) );
this.setScrollTopOnChange();
}
}

Expand All @@ -94,6 +95,8 @@ export class TlSchedule implements OnInit, OnChanges {

@Output() rowDbClick = new EventEmitter();

@Output() rowClick = new EventEmitter();

@Output() eventDbClick = new EventEmitter();

@Output() eventClick = new EventEmitter();
Expand All @@ -118,6 +121,8 @@ export class TlSchedule implements OnInit, OnChanges {

private _events: ScheduleDataSource[];

private scrollTopOfscrollView: number;

get events(): ScheduleDataSource[] {
return this._events;
}
Expand Down Expand Up @@ -164,13 +169,18 @@ export class TlSchedule implements OnInit, OnChanges {
this.releaseSchedule.emit( holiday );
}

private setScrollTopOnChange() {
this.scrollTopOfscrollView = this.scheduleviews.nativeElement ? this.scheduleviews.nativeElement.scrollTop : 0;
}

private handleScrollView( date = this.currentDate) {
if ( !this.scheduleviews ) {
return;
}
this.setScrollTopOnChange();
setTimeout(() => {
this.scheduleviews.nativeElement.scrollTop = (
this.isSameDay( date ) ? this.generateEventsService.convertMillisecondsToPixel() : 0
this.isSameDay( date ) ? this.generateEventsService.convertMillisecondsToPixel() : this.scrollTopOfscrollView
);
}, 100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
<!-- CREATE WIDGET CONTENT-->
<div #scheduleSlats class="ui-schedule-widget-content">
<div *ngFor="let time of times; let last = last; let first = first;" class="ui-schedule-widget-rows">
<div class="ui-schedule-row" *ngFor="let slot of slatNumberRowsAsArray; let index = index"
[ngStyle]="{height: slotSettings.slotHight + 'px'}"
<div #scheduleRow class="ui-schedule-row" [attr.data-row-index]="time.getTime() * (index+1)" *ngFor="let slot of slatNumberRowsAsArray; let index = index"
(click)="rowClick( time, index, timesIndex, scheduleRow )"
(dblclick)="rowDbClick( time, index, timesIndex )"
[ngStyle]="{ height: slotSettings.slotHight + 'px' }"
[ngClass]="{ last: last, first: first, lastTurn: lastTurn, firstTurn: firstTurn }"
(dblclick)="rowDbClick( time, index, timesIndex )"></div>
[class.selected]="scheduleRow?.getAttribute('data-row-index') === indexRowSelected">
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
>.ui-schedule-row{
background-color: #f5f5f5;
border-bottom: 1px #D6D6D6 dotted;
cursor: pointer;
&.selected {
background-color: #EDEDED;
}
&:first-child{
border-bottom: 1px #D6D6D6 dotted;
}
Expand Down Expand Up @@ -170,15 +174,15 @@
#FFFFFF 20px
);
> .ui-event-title{
font-size: 0.9em;
font-size: 1.1em;
font-weight: 600;
color: #454e58;
white-space: nowrap;
text-overflow: ellipsis;
font-variant-caps: all-petite-caps;
}
> .ui-event-hour{
font-size: 1.0em;
font-size: 1.1em;
color: #454e58;
justify-content: center;
margin-right: 0;
Expand Down
Loading

0 comments on commit d26b5d0

Please sign in to comment.