diff --git a/.changeset/stale-dots-speak.md b/.changeset/stale-dots-speak.md
new file mode 100644
index 000000000..44a13b6ae
--- /dev/null
+++ b/.changeset/stale-dots-speak.md
@@ -0,0 +1,6 @@
+---
+'@alauda/ui': patch
+---
+
+- fix(drawer): no default config when using component mode
+- feat(drawer): template context support contentParams as $implicit
diff --git a/package.json b/package.json
index ebf2d3c97..d5f2574f1 100644
--- a/package.json
+++ b/package.json
@@ -106,7 +106,7 @@
"zone.js": "^0.13.1"
},
"resolutions": {
- "prettier": "~2.7.1"
+ "prettier": "~2.8.8"
},
"publishConfig": {
"access": "public",
diff --git a/src/date-picker/calendar/range-picker-panel/template.html b/src/date-picker/calendar/range-picker-panel/template.html
index 4adc11d19..f6b3a4f75 100644
--- a/src/date-picker/calendar/range-picker-panel/template.html
+++ b/src/date-picker/calendar/range-picker-panel/template.html
@@ -113,6 +113,6 @@
{{ value | date: FOOTER_DATE_FORMAT }}{{ value | date : FOOTER_DATE_FORMAT }}
diff --git a/src/drawer/component/internal/internal.component.html b/src/drawer/component/internal/internal.component.html
index 008d70265..64dcbf039 100644
--- a/src/drawer/component/internal/internal.component.html
+++ b/src/drawer/component/internal/internal.component.html
@@ -20,7 +20,7 @@
{{ options.title }}
@@ -42,7 +42,7 @@
@@ -54,7 +54,7 @@
{{ options.footer }}
diff --git a/src/drawer/component/internal/internal.component.ts b/src/drawer/component/internal/internal.component.ts
index f706d4922..8d3e10735 100644
--- a/src/drawer/component/internal/internal.component.ts
+++ b/src/drawer/component/internal/internal.component.ts
@@ -119,6 +119,13 @@ export class DrawerInternalComponent {
);
}
+ get context() {
+ return {
+ $implicit: this.options.contentParams,
+ ...this.options.contentParams,
+ };
+ }
+
isTemplateRef = isTemplateRef;
constructor(private readonly injector: Injector) {}
diff --git a/src/drawer/drawer.service.ts b/src/drawer/drawer.service.ts
index fada83d1e..7fae8ed64 100644
--- a/src/drawer/drawer.service.ts
+++ b/src/drawer/drawer.service.ts
@@ -8,14 +8,14 @@ import { DrawerRef } from './drawer-ref';
import { DrawerOptions, DrawerSize } from './types';
const DRAWER_OVERLAY_CLASS = 'aui-drawer-overlay';
-const DEFAULT_OPTIONS: DrawerOptions = {
+const DEFAULT_OPTIONS = {
size: DrawerSize.Medium,
offsetY: '0',
showClose: true,
hideOnClickOutside: false,
divider: true,
disposeWhenHide: true,
-};
+} as const satisfies DrawerOptions;
@Injectable()
export class DrawerService<
@@ -46,10 +46,7 @@ export class DrawerService<
}
updateOptions(options: DrawerOptions): void {
- this.options = {
- ...(DEFAULT_OPTIONS as DrawerOptions),
- ...options,
- };
+ this.options = merge>(DEFAULT_OPTIONS, options);
}
private createOverlay() {
@@ -135,3 +132,18 @@ export class DrawerService<
this.dispose();
}
}
+
+function merge(target: T, source: T) {
+ return Object.keys(source).reduce(
+ (acc, _key) => {
+ const key = _key as keyof T;
+ if (source[key] !== undefined) {
+ acc[key] = source[key];
+ }
+ return acc;
+ },
+ {
+ ...target,
+ },
+ );
+}
diff --git a/src/tabs/tab-group.component.ts b/src/tabs/tab-group.component.ts
index 14ce20617..96417bf39 100644
--- a/src/tabs/tab-group.component.ts
+++ b/src/tabs/tab-group.component.ts
@@ -186,7 +186,8 @@ export class TabGroupComponent
/** Event emitted when focus has changed within a tab group. */
@Output()
- readonly focusChange: EventEmitter = new EventEmitter();
+ readonly focusChange: EventEmitter =
+ new EventEmitter();
constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {}
diff --git a/src/time-picker/panel/panel.template.html b/src/time-picker/panel/panel.template.html
index e74ed5cd6..ddf988eb3 100644
--- a/src/time-picker/panel/panel.template.html
+++ b/src/time-picker/panel/panel.template.html
@@ -20,7 +20,7 @@
}"
(click)="selectValue(item, TimePickerControlType.Hour)"
>
- {{ item | number: '2.0-0' }}
+ {{ item | number : '2.0-0' }}
@@ -44,7 +44,7 @@
}"
(click)="selectValue(item, TimePickerControlType.Minute)"
>
- {{ item | number: '2.0-0' }}
+ {{ item | number : '2.0-0' }}
@@ -67,7 +67,7 @@
}"
(click)="selectValue(item, TimePickerControlType.Second)"
>
- {{ item | number: '2.0-0' }}
+ {{ item | number : '2.0-0' }}
diff --git a/yarn.lock b/yarn.lock
index 1a5a67d73..c9f11f013 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"