Skip to content

Commit

Permalink
fix: drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
igauch committed Dec 19, 2023
1 parent 6c6afc5 commit 2d83f71
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 23 deletions.
1 change: 1 addition & 0 deletions .changeset/stale-dots-speak.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
---

- fix(drawer): no default config when using component mode
- feat(drawer): template context support contentParams as $implicit
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"zone.js": "^0.13.1"
},
"resolutions": {
"prettier": "~2.7.1"
"prettier": "~2.8.8"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/calendar/range-picker-panel/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@
<span
*ngIf="value"
class="date-value date-holder"
>{{ value | date: FOOTER_DATE_FORMAT }}</span
>{{ value | date : FOOTER_DATE_FORMAT }}</span
>
</ng-template>
6 changes: 3 additions & 3 deletions src/drawer/component/internal/internal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ng-container
*ngIf="isTemplateRef(options.title); else normal"
[ngTemplateOutlet]="options.title"
[ngTemplateOutletContext]="options.contentParams"
[ngTemplateOutletContext]="context"
></ng-container>
<ng-template #normal>
{{ options.title }}
Expand All @@ -42,7 +42,7 @@
<ng-container
*ngIf="isTemplateRef(options.content)"
[ngTemplateOutlet]="options.content"
[ngTemplateOutletContext]="options.contentParams"
[ngTemplateOutletContext]="context"
>
</ng-container>
</div>
Expand All @@ -54,7 +54,7 @@
<ng-container
*ngIf="isTemplateRef(options.footer); else normal"
[ngTemplateOutlet]="options.footer"
[ngTemplateOutletContext]="options.contentParams"
[ngTemplateOutletContext]="context"
></ng-container>
<ng-template #normal>
{{ options.footer }}
Expand Down
7 changes: 7 additions & 0 deletions src/drawer/component/internal/internal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ export class DrawerInternalComponent<T = unknown, C extends object = object> {
);
}

get context() {
return {
$implicit: this.options.contentParams,
...this.options.contentParams,
};
}

isTemplateRef = isTemplateRef;

constructor(private readonly injector: Injector) {}
Expand Down
19 changes: 9 additions & 10 deletions src/drawer/drawer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ import { DrawerRef } from './drawer-ref';
import { DrawerOptions, DrawerSize } from './types';

const DRAWER_OVERLAY_CLASS = 'aui-drawer-overlay';
const DEFAULT_OPTIONS = {
size: DrawerSize.Medium,
offsetY: '0',
showClose: true,
hideOnClickOutside: false,
divider: true,
disposeWhenHide: true,
} as const satisfies DrawerOptions;

@Injectable()
export class DrawerService<
Expand All @@ -23,15 +31,6 @@ export class DrawerService<
DrawerInternalComponent<T, C>
>;

private readonly DEFAULT_OPTIONS: DrawerOptions<T, C> = {
size: DrawerSize.Medium,
offsetY: '0',
showClose: true,
hideOnClickOutside: false,
divider: true,
disposeWhenHide: true,
};

constructor(private readonly overlay: Overlay) {}

open(options: DrawerOptions<T, C>) {
Expand All @@ -47,7 +46,7 @@ export class DrawerService<
}

updateOptions(options: DrawerOptions<T, C>): void {
this.options = merge<DrawerOptions<T, C>>(this.DEFAULT_OPTIONS, options);
this.options = merge<DrawerOptions<T, C>>(DEFAULT_OPTIONS, options);
}

private createOverlay() {
Expand Down
3 changes: 2 additions & 1 deletion src/tabs/tab-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ export class TabGroupComponent

/** Event emitted when focus has changed within a tab group. */
@Output()
readonly focusChange: EventEmitter<TabChangeEvent> = new EventEmitter<TabChangeEvent>();
readonly focusChange: EventEmitter<TabChangeEvent> =
new EventEmitter<TabChangeEvent>();

constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {}

Expand Down
6 changes: 3 additions & 3 deletions src/time-picker/panel/panel.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}"
(click)="selectValue(item, TimePickerControlType.Hour)"
>
{{ item | number: '2.0-0' }}
{{ item | number : '2.0-0' }}
</li>
</ul>
<div [class]="bem.element('column-strut')"></div>
Expand All @@ -44,7 +44,7 @@
}"
(click)="selectValue(item, TimePickerControlType.Minute)"
>
{{ item | number: '2.0-0' }}
{{ item | number : '2.0-0' }}
</li>
</ul>
<div [class]="bem.element('column-strut')"></div>
Expand All @@ -67,7 +67,7 @@
}"
(click)="selectValue(item, TimePickerControlType.Second)"
>
{{ item | number: '2.0-0' }}
{{ item | number : '2.0-0' }}
</li>
</ul>
<div [class]="bem.element('column-strut')"></div>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15238,10 +15238,10 @@ prettier-plugin-toml@^0.3.1:
"@toml-tools/parser" "^0.3.1"
prettier "^1.16.0"

prettier@>=2.3, prettier@>=2.3.0, prettier@>=2.4.0, prettier@^1.16.0, prettier@^2.7.1, prettier@^2.8.0, prettier@^2.8.8, prettier@~2.7.1:
version "2.7.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==
prettier@>=2.3, prettier@>=2.3.0, prettier@>=2.4.0, prettier@^1.16.0, prettier@^2.7.1, prettier@^2.8.0, prettier@^2.8.8, prettier@~2.8.8:
version "2.8.8"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==

pretty-bytes@^5.3.0:
version "5.6.0"
Expand Down

0 comments on commit 2d83f71

Please sign in to comment.