Skip to content

Commit

Permalink
fix: drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
igauch committed Dec 18, 2023
1 parent e3fa1cd commit cc3770f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-dots-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alauda/ui': patch
---

- fix: no default config for using component mode
20 changes: 16 additions & 4 deletions src/drawer/drawer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ export class DrawerService<
}

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

private createOverlay() {
Expand Down Expand Up @@ -135,3 +137,13 @@ export class DrawerService<
this.dispose();
}
}

function merge(object: Record<string, any>, source: Record<string, any>) {
Object.keys(source).forEach(key => {
if (source[key] === undefined) {
return;
}
object[key] = source[key];
});
return object;
}

0 comments on commit cc3770f

Please sign in to comment.