Skip to content

Commit

Permalink
feat(form:tree-select): add change of schema (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Aug 18, 2024
1 parent f8d383a commit f110664
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/form/widgets/tree-select/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Observable } from 'rxjs';

import type { SFSchemaEnum, SFSchemaEnumType, SFUISchemaItem } from '@delon/form';
import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd/core/tree';
import { NgStyleInterface, NzSizeLDSType } from 'ng-zorro-antd/core/types';
import type { NgStyleInterface, NzSafeAny, NzSizeLDSType } from 'ng-zorro-antd/core/types';

export interface SFTreeSelectWidgetSchema extends SFUISchemaItem {
/**
Expand Down Expand Up @@ -129,4 +129,6 @@ export interface SFTreeSelectWidgetSchema extends SFUISchemaItem {
* 点击展开树节点图标调用
*/
expandChange?: (e: NzFormatEmitEvent) => Observable<SFSchemaEnum[]>;

change?: (value: NzSafeAny[] | NzSafeAny) => void;
}
4 changes: 3 additions & 1 deletion packages/form/widgets/tree-select/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormsModule } from '@angular/forms';

import { ControlUIWidget, DelonFormModule, SFSchemaEnum, SFValue, getData, toBool } from '@delon/form';
import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/core/tree';
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select';

import type { SFTreeSelectWidgetSchema } from './schema';
Expand Down Expand Up @@ -90,7 +91,8 @@ export class TreeSelectWidget extends ControlUIWidget<SFTreeSelectWidgetSchema>
});
}

change(value: string[] | string): void {
change(value: NzSafeAny[] | NzSafeAny): void {
console.log(value);
if (this.ui.change) this.ui.change(value);
this.setValue(value);
}
Expand Down

0 comments on commit f110664

Please sign in to comment.