dasch-swiss / knora-ui

Reusable GUI elements for Knora
https://dasch-swiss.github.io/knora-ui
7 stars 1 forks source link

chore: Upgrade jdncalendar packages #308

Closed flavens closed 5 years ago

flavens commented 5 years ago

Update jdnconvertiblecalendar and jdnconvertiblecalendaradapter version numbers. Update @angular/material and @angular/cdk version numbers. Fix bugs. resolve #306 resolve #312

flavens commented 5 years ago

Why does this affect @knora/action and not only @knora/search?

because there is a directive for jdncalendar that requires your packages..

tobiasschweizer commented 5 years ago

Once this is available on npm, I will make a PR in beol to integrate it.

kilchenmann commented 5 years ago

I'm sorry but I was wondering about the usage as directive in the action module. Yes it's defined there as a directive, but it's used as a component in the search module.

In @knora/action jdn-datepicker.directive.ts:

@Directive({
    selector: 'kuiJdnDatepicker',
    providers: [{ provide: DateAdapter, useClass: JDNConvertibleCalendarDateAdapter, deps: [MAT_DATE_LOCALE] }]
})
export class JdnDatepickerDirective {
    constructor (private adapter: DateAdapter<JDNConvertibleCalendar>) { }
}

But used as a component tag in date-value in @knora/search:

    <kuiJdnDatepicker>
        <input matInput [matDatepicker]="picker" placeholder="Choose a date" [formControl]="form.controls['dateValue']">
        <mat-datepicker #picker [calendarHeaderComponent]="headerComponent"></mat-datepicker>
    </kuiJdnDatepicker>

The directive should be used as an attribute of a known and existing html element e.g. <span kuiJdnDatepicker></span>

Or I'm wrong?

kilchenmann commented 5 years ago

@flavens What do you think about my question about the directive? We can keep it like it is and merge it now, because it seems to work.

tobiasschweizer commented 5 years ago

@kilchenmann I got this from https://github.com/dhlab-basel/JDNConvertibleCalendarDateAdapter/pull/9#issuecomment-407224583

kilchenmann commented 5 years ago

@tobiasschweizer okay. Thanks for clarification. @flavens you can merge it. After merging we have to release and publish new Knora-ui version 9.1.0?

tobiasschweizer commented 5 years ago

I think this is a structural directive:

Angular has two types of directives: structural and attribute. As the name suggest, the attribute directives are altering the properties of an element to which they are attached and the structural ones are changing the layout, basically adding or removing elements in the DOM.

https://medium.com/@adrianfaciu/creating-structural-directives-in-angular-ff17211c7b28

tobiasschweizer commented 5 years ago

note that the directives selector is not in []

tobiasschweizer commented 5 years ago

If you have ever created an Angular directive before, you probably used the brackets ([]) notation as a selector. Most of the time it’s the preferred way, but it’s not a requirement.

https://netbasal.com/angular-directive-selectors-can-do-more-than-you-think-7aefa4e6f30

flavens commented 5 years ago

@flavens you can merge it. After merging we have to release and publish new Knora-ui version 9.1.0?

I have to clean up one spec file, and then we can merge it and publish it.

kilchenmann commented 5 years ago

note that the directives selector is not in []

@tobiasschweizer Yes, I changed it back and kept it as it was before. Commit 2836ce6

I'm sorry for the confusion.