Skip to content

Commit

Permalink
fix(): 给brickTree增加searchBrick
Browse files Browse the repository at this point in the history
close CD-3201
  • Loading branch information
julielai committed Oct 28, 2022
1 parent e8a42f3 commit 6ae438d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
21 changes: 15 additions & 6 deletions bricks/presentational-bricks/src/brick-tree/BrickTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export interface BrickTreeProps {
| { checked: React.Key[]; halfChecked: React.Key[] }
): void;
suffixBrick?: { useBrick: UseBrickConf };
searchBrick?: { useBrick: UseBrickConf };
showSpecificationTitleStyle?: boolean;
defaultExpandAll?: boolean;
deselectable?: boolean;
Expand All @@ -200,6 +201,7 @@ export function BrickTree(props: BrickTreeProps): React.ReactElement {
checkAllEnabled,
checkedFilterConfig: { field, value, operator } = {},
suffixBrick,
searchBrick,
showSpecificationTitleStyle,
defaultExpandAll,
deselectable,
Expand Down Expand Up @@ -361,12 +363,19 @@ export function BrickTree(props: BrickTreeProps): React.ReactElement {
return (
<>
{searchable && (
<Input.Search
placeholder={placeholder}
onChange={(e) => onChange(e.target.value)}
style={{ marginBottom: 8 }}
data-testid="search-input"
/>
<div style={{ display: "flex" }}>
<Input.Search
placeholder={placeholder}
onChange={(e) => onChange(e.target.value)}
style={{ marginBottom: 8 }}
data-testid="search-input"
/>
{!isEmpty(searchBrick?.useBrick) && (
<BrickAsComponent
useBrick={searchBrick?.useBrick}
></BrickAsComponent>
)}
</div>
)}
{configProps.checkable && checkAllEnabled && (
<div style={{ marginBottom: 6, display: "flex", alignItems: "center" }}>
Expand Down
12 changes: 12 additions & 0 deletions bricks/presentational-bricks/src/brick-tree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ export class BrickTreeElement extends UpdatingElement {
})
suffixBrick: { useBrick: UseBrickConf };

/**
* @kind {useBrick:[UseBrickConf](http://docs.developers.easyops.cn/docs/api-reference/brick-types.usebrickconf)}
* @required false
* @default -
* @description 搜索框右边的自定义项,当`searchable`为true时生效
*/
@property({
attribute: false,
})
searchBrick: { useBrick: UseBrickConf };

/**
* @kind boolean
* @required false
Expand Down Expand Up @@ -250,6 +261,7 @@ export class BrickTreeElement extends UpdatingElement {
onCheck={this._handleCheck}
checkedFilterConfig={this.checkedFilterConfig}
suffixBrick={this.suffixBrick}
searchBrick={this.searchBrick}
showSpecificationTitleStyle={this.showSpecificationTitleStyle}
defaultExpandAll={this.defaultExpandAll}
deselectable={this.deselectable}
Expand Down
4 changes: 2 additions & 2 deletions bricks/presentational-bricks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import "./general-list";
// !Lazy: import "./modal-confirm";
import "./brick-quick-entries";
import "./collapsible-card-item";
import "./single-field-edit";
import "./brick-placeholder";
// !Lazy: import "./single-field-edit";
// !Lazy: import "./brick-placeholder";
import "./general-carousel";
import "./agent-status";
import "./dynamic-content";
Expand Down
1 change: 1 addition & 0 deletions bricks/presentational-bricks/src/interfaces/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export interface EasyopsEmptyProps {
description?: string;
imageStyle?: React.CSSProperties;
illustration?: IllustrationProps;
noImage?: boolean;
}

export interface IllustrationProps {
Expand Down

0 comments on commit 6ae438d

Please sign in to comment.