Skip to content

Commit cc3770f

Browse files
committed
fix: drawer
1 parent e3fa1cd commit cc3770f

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

.changeset/stale-dots-speak.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@alauda/ui': patch
3+
---
4+
5+
- fix: no default config for using component mode

src/drawer/drawer.service.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ export class DrawerService<
4646
}
4747

4848
updateOptions(options: DrawerOptions<T, C>): void {
49-
this.options = {
50-
...(DEFAULT_OPTIONS as DrawerOptions<T, C>),
51-
...options,
52-
};
49+
this.options = merge(
50+
{
51+
...DEFAULT_OPTIONS,
52+
},
53+
options,
54+
);
5355
}
5456

5557
private createOverlay() {
@@ -135,3 +137,13 @@ export class DrawerService<
135137
this.dispose();
136138
}
137139
}
140+
141+
function merge(object: Record<string, any>, source: Record<string, any>) {
142+
Object.keys(source).forEach(key => {
143+
if (source[key] === undefined) {
144+
return;
145+
}
146+
object[key] = source[key];
147+
});
148+
return object;
149+
}

0 commit comments

Comments
 (0)