Skip to content

Commit c952f31

Browse files
authored
Merge pull request #1563 from easyops-cn/steve/drawer-elevo
fix(dropdown-actions): new prop: placement
2 parents 115b648 + fbf79e8 commit c952f31

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

bricks/basic/src/batch-agent/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ const { defineElement, event, method } = createDecorators();
1010
/**
1111
* 批处理事件代理。
1212
*
13-
* 当多次触发同一类型事件时,只会在当前宏任务结束后触发一次该类型事件。
13+
* 注意和 eo-event-agent 的区别:
14+
*
15+
* 触发条件:
16+
* - eo-event-agent 每次触发事件都会立即派发该事件。
17+
* - eo-batch-agent 当多次触发同一类型事件时,只会在当前宏任务结束后触发一次该类型事件。
18+
*
19+
* 方法参数
20+
* - eo-event-agent trigger() 方法的参数会作为 EVENT.detail 传递给 trigger 事件。
21+
* - eo-batch-agent trigger() 方法的参数必须是字符串,表示事件类型,trigger 事件详情 为 { type: string } 形式。
22+
* 因此,如果希望在事件回调时消费其他信息,需通过 context/state 进行传递。
1423
*/
1524
export
1625
@defineElement("eo-batch-agent", {

bricks/basic/src/dropdown-actions/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ReactNextElement, wrapBrick } from "@next-core/react-element";
44
import "@next-core/theme";
55
import styleText from "./styles.shadow.css";
66
import type {
7+
Placement,
78
Popover,
89
PopoverEvents,
910
PopoverEventsMapping,
@@ -45,6 +46,7 @@ export interface DropdownActionsProps
4546
extends Pick<ActionsProps, "actions" | "checkedKeys" | "themeVariant"> {
4647
disabled?: boolean;
4748
strategy?: "absolute" | "fixed";
49+
placement?: Placement;
4850
}
4951

5052
export interface DropdownActionsEvents {
@@ -101,6 +103,14 @@ class EoDropdownActions
101103
@property()
102104
accessor strategy: "absolute" | "fixed" | undefined;
103105

106+
/**
107+
* 弹出层放置位置
108+
*
109+
* @default "bottom-start"
110+
*/
111+
@property()
112+
accessor placement: Placement | undefined;
113+
104114
/** 主题变体 */
105115
@property()
106116
accessor themeVariant: "default" | "elevo" | undefined;
@@ -136,6 +146,7 @@ class EoDropdownActions
136146
actions={this.actions}
137147
disabled={this.disabled}
138148
strategy={this.strategy}
149+
placement={this.placement}
139150
themeVariant={this.themeVariant}
140151
onActionClick={this.#handleClick}
141152
onVisibleChange={this.#handleVisibleChange}
@@ -155,6 +166,7 @@ export function EoDropdownActionsComponent({
155166
checkedKeys,
156167
disabled,
157168
strategy,
169+
placement,
158170
themeVariant,
159171
onActionClick,
160172
onVisibleChange,
@@ -171,7 +183,7 @@ export function EoDropdownActionsComponent({
171183

172184
return (
173185
<WrappedPopover
174-
placement="bottom-start"
186+
placement={placement ?? "bottom-start"}
175187
trigger="click"
176188
disabled={disabled}
177189
active={visible}

0 commit comments

Comments
 (0)