Skip to content

Commit

Permalink
Merge pull request #2414 from kirbydesign/release/v6.2.0
Browse files Browse the repository at this point in the history
Release version 6.2
  • Loading branch information
jkaltoft authored Aug 11, 2022
2 parents d119944 + c558a6d commit 564cb31
Show file tree
Hide file tree
Showing 24 changed files with 1,600 additions and 7,421 deletions.
29 changes: 22 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,35 @@

Notable changes to the project will be documented in this file.

## [6.2.1](https://github.com/kirbydesign/designsystem/pull/2414) (11-08-2022)

### Bugfixes

- **dropdown** - fix scroll problem on touch devices ([#2396](https://github.com/kirbydesign/designsystem/pull/2396))
- **fabsheet** - add missing close icon ([#2403](https://github.com/kirbydesign/designsystem/pull/2403))
- **fabsheet** - fix missing backdrop on mobile devices ([#2401](https://github.com/kirbydesign/designsystem/pull/2401))
- **item** - fix slotted items being unclickable ([#2381](https://github.com/kirbydesign/designsystem/pull/2381))
- **modal** - refactor moving of modal elements, solves multiple issues ([#2238](https://github.com/kirbydesign/designsystem/pull/2238))
- **segmented-control** - avoid removing focus on embedded badge click ([#2400](https://github.com/kirbydesign/designsystem/pull/2400))

### Features

- **icons** - add menu icons ([#2409](https://github.com/kirbydesign/designsystem/pull/2409))

## [6.1.1](https://github.com/kirbydesign/designsystem/pull/2373) (27-06-2022)

### Bugfixes

- **chart** - fix problem where chart.js plugins imported as default are not loading ([#2369](https://github.com/kirbydesign/designsystem/pull/2369)
- **dropdown** - experimental popover feature: fix item-selection on dropdown with popover in safari ([#2356](https://github.com/kirbydesign/designsystem/pull/2356)
- **flag** - calculate total height correctly using line height ([#2365](https://github.com/kirbydesign/designsystem/pull/2365)
- **modal** - fix modal `closeButton` and `supplementaryButton` too small ([#2350](https://github.com/kirbydesign/designsystem/pull/2350)
- **chart** - fix problem where chart.js plugins imported as default are not loading ([#2369](https://github.com/kirbydesign/designsystem/pull/2369))
- **dropdown** - experimental popover feature: fix item-selection on dropdown with popover in safari ([#2356](https://github.com/kirbydesign/designsystem/pull/2356))
- **flag** - calculate total height correctly using line height ([#2365](https://github.com/kirbydesign/designsystem/pull/2365))
- **modal** - fix modal `closeButton` and `supplementaryButton` too small ([#2350](https://github.com/kirbydesign/designsystem/pull/2350))

### Features

- **flag** - allow flag notification colors to be overridden ([#2361](https://github.com/kirbydesign/designsystem/pull/2361)
- **page** - add backButtonClicked event to page component ([#2316](https://github.com/kirbydesign/designsystem/pull/2316)
- **icons** - add 'insurance' icon ([#2360](https://github.com/kirbydesign/designsystem/pull/2360)
- **flag** - allow flag notification colors to be overridden ([#2361](https://github.com/kirbydesign/designsystem/pull/2361))
- **page** - add backButtonClicked event to page component ([#2316](https://github.com/kirbydesign/designsystem/pull/2316))
- **icons** - add 'insurance' icon ([#2360](https://github.com/kirbydesign/designsystem/pull/2360))

## [6.0.0](https://github.com/kirbydesign/designsystem/pull/2337) (15-06-2022)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,24 @@
</fieldset>
<cookbook-fab-sheet-example [disableFabSheet]="disableFabSheet"></cookbook-fab-sheet-example>
<cookbook-code-viewer [html]="exampleHtml"></cookbook-code-viewer>
(Optional) if you need to obtain data back from the fab sheet, you can pass a callback function:

<p>
The floating action button is always shown with a close-icon when in its opened state. In order
to show the icon correctly it needs to be configured as described in
<a href="https://github.com/kirbydesign/designsystem#icons" class="kirby-external-icon"
>the project readme</a
>.
</p>

<p>
(Optional) if you need to obtain data back from the fab sheet, you can pass a callback function:
</p>
<!-- prettier-ignore -->
<cookbook-code-viewer language="html">(itemSelect)="onItemSelect($event)"</cookbook-code-viewer>
where <code>onItemSelect</code> can be e.g.:
<!-- prettier-ignore -->
<cookbook-code-viewer language="ts">onItemSelect(item: ActionSheetItem) {{ '{' }}...{{ '}' }}</cookbook-code-viewer>

<h4>Fab sheet properties:</h4>
<cookbook-api-description-properties
[properties]="properties"
Expand Down
65 changes: 41 additions & 24 deletions libs/designsystem/src/lib/components/dropdown/dropdown.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
AfterContentChecked,
AfterViewInit,
ChangeDetectorRef,
Component,
Expand Down Expand Up @@ -43,12 +42,9 @@ import { KeyboardHandlerService } from './keyboard-handler.service';
},
],
})
export class DropdownComponent
implements AfterContentChecked, AfterViewInit, OnDestroy, ControlValueAccessor
{
export class DropdownComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {
static readonly OPEN_DELAY_IN_MS = 100;
private state = OpenState.closed;
private hasConfiguredSlottedItems = false;
private horizontalDirection: HorizontalDirection | `${HorizontalDirection}` =
HorizontalDirection.right;
private verticalDirection: VerticalDirection | `${VerticalDirection}` = VerticalDirection.down;
Expand Down Expand Up @@ -183,8 +179,31 @@ export class DropdownComponent
buttonElement: ElementRef<HTMLElement>;
@ViewChildren(ItemComponent, { read: ElementRef })
kirbyItemsDefault: QueryList<ElementRef<HTMLElement>>;

_kirbyItemsSlotted: QueryList<ElementRef<HTMLElement>>;
@ContentChildren(ItemComponent, { read: ElementRef })
kirbyItemsSlotted: QueryList<ElementRef<HTMLElement>>;
set kirbyItemsSlotted(kirbyItems: QueryList<ElementRef<HTMLElement>>) {
const hasSlottedItems = this.itemClickUnlisten?.length > 0;
if (hasSlottedItems) {
this.unlistenAllSlottedItems();
}

// Setup a click listener for each new slotted items
kirbyItems.forEach((kirbyItem, index) => {
this.renderer.setAttribute(kirbyItem.nativeElement, 'role', 'option');
const unlisten = this.renderer.listen(kirbyItem.nativeElement, 'click', () => {
this.onItemSelect(index);
});

this.itemClickUnlisten.push(unlisten);
});

this._kirbyItemsSlotted = kirbyItems;
}

get kirbyItemsSlotted(): QueryList<ElementRef<HTMLElement>> {
return this._kirbyItemsSlotted;
}

private itemClickUnlisten: (() => void)[] = [];
private intersectionObserverRef: IntersectionObserver;
Expand Down Expand Up @@ -217,20 +236,7 @@ export class DropdownComponent
event.preventDefault();
}

ngAfterContentChecked() {
if (!this.hasConfiguredSlottedItems && this.kirbyItemsSlotted.length) {
this.kirbyItemsSlotted.forEach((kirbyItem, index) => {
this.renderer.setAttribute(kirbyItem.nativeElement, 'role', 'option');
const unlisten = this.renderer.listen(kirbyItem.nativeElement, 'click', () => {
this.onItemSelect(index);
});
this.itemClickUnlisten.push(unlisten);
});
this.hasConfiguredSlottedItems = true;
}
}

/* Utility that makes it easier to set styles on card element
/* Utility that makes it easier to set styles on card element
when using popover*/
private setPopoverCardStyle(style: string, value: string) {
if (!this.usePopover) return;
Expand Down Expand Up @@ -457,6 +463,13 @@ export class DropdownComponent
}
}

@HostListener('touchstart', ['$event'])
_onTouchStart(event: TouchEvent) {
if (this.isOpen) {
event.stopPropagation();
}
}

@HostListener('focus')
_onFocus() {
if (this.disabled) {
Expand Down Expand Up @@ -531,11 +544,15 @@ export class DropdownComponent
return false;
}

ngOnDestroy(): void {
let unlisten: () => void;
while ((unlisten = this.itemClickUnlisten.pop()) !== undefined) {
unlisten();
private unlistenAllSlottedItems() {
let unlistenItem: () => void;
while ((unlistenItem = this.itemClickUnlisten.pop()) !== undefined) {
unlistenItem();
}
}

ngOnDestroy(): void {
this.unlistenAllSlottedItems();
if (this.intersectionObserverRef) {
this.intersectionObserverRef.disconnect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
(click)="hideActions(fab)"
></ion-backdrop>
<ion-fab #fab (click)="disabled || onFabClick(fab)">
<ion-fab-button
[disabled]="disabled"
[attr.disabled]="disabled ? true : null"
tabindex="-1"
closeIcon="close-outline"
>
<ion-fab-button [disabled]="disabled" [attr.disabled]="disabled ? true : null" tabindex="-1">
<ng-content select="kirby-icon"></ng-content>
</ion-fab-button>
<ion-fab-list *ngIf="actionSheet" side="top" class="{{ horizontalAlignment }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DOCUMENT } from '@angular/common';
import {
AfterContentInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChild,
ElementRef,
Expand Down Expand Up @@ -42,7 +43,11 @@ export class FabSheetComponent implements AfterContentInit {
@ViewChild(IonFabButton, { static: true, read: ElementRef })
ionFabButton: ElementRef<HTMLElement>;

constructor(private renderer: Renderer2, @Inject(DOCUMENT) private document: any) {}
constructor(
private renderer: Renderer2,
private changeDetectorRef: ChangeDetectorRef,
@Inject(DOCUMENT) private document: any
) {}

ngAfterContentInit(): void {
if (this.actionSheet) {
Expand All @@ -64,6 +69,11 @@ export class FabSheetComponent implements AfterContentInit {
} else {
this.renderer.removeClass(this.document.body, 'fab-sheet-active');
}
setTimeout(() => (this._isBackdropVisible = this.isFabSheetOpen));

// Postpone backdrop visibility update to allow for animation of opacity
setTimeout(() => {
this._isBackdropVisible = this.isFabSheetOpen;
this.changeDetectorRef.markForCheck();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ export const kirbyIconSettings: IconSettings = {
{ name: 'backspace', svg: 'assets/kirby/icons/svg/backspace.svg' },
{ name: 'calendar', svg: 'assets/kirby/icons/svg/calendar.svg' },
{ name: 'camera', svg: 'assets/kirby/icons/svg/camera.svg' },
{ name: 'car', svg: 'assets/kirby/icons/svg/car.svg' },
{ name: 'checkbox-outline', svg: 'assets/kirby/icons/svg/checkbox-outline.svg' },
{ name: 'checkbox', svg: 'assets/kirby/icons/svg/checkbox.svg' },
{ name: 'checkmark-selected', svg: 'assets/kirby/icons/svg/checkmark-selected.svg' },
{ name: 'close', svg: 'assets/kirby/icons/svg/close.svg' },
{ name: 'cog', svg: 'assets/kirby/icons/svg/cog.svg' },
{ name: 'coinstack', svg: 'assets/kirby/icons/svg/coinstack.svg' },
{ name: 'contact', svg: 'assets/kirby/icons/svg/contact.svg' },
{ name: 'copy', svg: 'assets/kirby/icons/svg/copy.svg' },
{ name: 'flag', svg: 'assets/kirby/icons/svg/flag.svg' },
{ name: 'edit', svg: 'assets/kirby/icons/svg/edit.svg' },
Expand Down Expand Up @@ -48,6 +51,8 @@ export const kirbyIconSettings: IconSettings = {
{ name: 'person-outline', svg: 'assets/kirby/icons/svg/person-outline.svg' },
{ name: 'person', svg: 'assets/kirby/icons/svg/person.svg' },
{ name: 'qr', svg: 'assets/kirby/icons/svg/QR.svg' },
{ name: 'recurring', svg: 'assets/kirby/icons/svg/recurring.svg' },
{ name: 'salary', svg: 'assets/kirby/icons/svg/salary.svg' },
{ name: 'search', svg: 'assets/kirby/icons/svg/search.svg' },
{ name: 'share', svg: 'assets/kirby/icons/svg/share.svg' },
{ name: 'sort', svg: 'assets/kirby/icons/svg/sort.svg' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
ElementRef,
HostBinding,
Input,
OnDestroy,
Optional,
} from '@angular/core';

import {
ModalElementComponent,
ModalElementsAdvertiser,
ModalElementType,
} from '../services/modal.interfaces';

@Component({
selector: 'kirby-modal-footer',
templateUrl: './modal-footer.component.html',
styleUrls: ['./modal-footer.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ModalFooterComponent {
export class ModalFooterComponent extends ModalElementComponent {
@HostBinding('class.snap-to-keyboard')
@Input()
snapToKeyboard = false;

@HostBinding('class')
@Input()
type: 'inline' | 'fixed' = 'fixed';

constructor(
elementRef: ElementRef<HTMLElement>,
@Optional() modalElementsAdvertiser: ModalElementsAdvertiser
) {
super(ModalElementType.FOOTER, elementRef, modalElementsAdvertiser);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { ElementRef, Renderer2 } from '@angular/core';

/*
The ModalWrapperComponent class was growing large.
Hence the functions responsible for moving modal elements around
has been encapsulated in this class.
*/

export class ModalElementsMoverDelegate {
constructor(private renderer: Renderer2, private elementRef: ElementRef<HTMLElement>) {}

public addFooter(footerElementRef: ElementRef<HTMLElement>) {
// Move the footer next to ion-content
this.moveChild(footerElementRef, this.elementRef);
}

public removeFooter(footerElementRef: ElementRef<HTMLElement>) {
this.removeChild(footerElementRef);
}

public addPageProgress(
pageProgressElementRef: ElementRef<HTMLElement>,
ionToolbarElement: ElementRef<HTMLIonToolbarElement>
) {
this.moveChild(pageProgressElementRef, ionToolbarElement);
}

public removePageProgress(pageProgressElementRef: ElementRef<HTMLElement>) {
this.removeChild(pageProgressElementRef);
}

/*
contentTitleElement & ionTitleElement has to be passed
as arguments to the method; not part of the constructor, as they
might reference completely different elements between calls.
For example in a multi-page routed modal where the elements are destroyed
and recreated.
*/
public addTitle(
titleElementRef: ElementRef<HTMLElement>,
contentTitleElement: ElementRef<HTMLElement>,
hasCollapsibleTitle: boolean,
ionTitleElement: ElementRef<HTMLIonTitleElement>
) {
this.moveChild(titleElementRef, ionTitleElement);
// If title is collapsible append it to content area; required by ionic implementation.
if (hasCollapsibleTitle) {
const titleElementClone = titleElementRef.nativeElement.cloneNode(true) as HTMLElement;
this.moveChild(new ElementRef(titleElementClone), contentTitleElement);
}
}

public removeTitle(
titleElementRef: ElementRef<HTMLElement>,
hasCollapsibleTitle: boolean,
contentTitleElement: ElementRef<HTMLElement>
) {
this.removeChild(titleElementRef);
if (hasCollapsibleTitle) {
const kirbyPageTitleElement: HTMLElement =
contentTitleElement.nativeElement.querySelector('kirby-page-title');
this.removeChild(new ElementRef(kirbyPageTitleElement));
}
}

private moveChild(
childElementRef: ElementRef<HTMLElement>,
newParentElementRef: ElementRef<HTMLElement>
) {
const child = childElementRef.nativeElement;
const newParent = newParentElementRef.nativeElement;
this.renderer.removeChild(child.parentElement, child);
this.renderer.appendChild(newParent, child);
}

private removeChild(
childElementRef: ElementRef<HTMLElement>,
parentElement?: HTMLElement | ElementRef<HTMLElement>
) {
const child = childElementRef.nativeElement;
if (!!child) {
this.renderer.removeChild(parentElement || child.parentElement, child);
}
}
}
Loading

0 comments on commit 564cb31

Please sign in to comment.