RelationEditor
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:13
关系字段搜索下拉编辑器(oneToOne / manyToOne)
- 顶部搜索框:实时过滤可选实体列表
- 键盘导航:↑ ↓ 移动焦点,Enter / 点击确认,Escape 取消
- 空值支持:nullable=true 时列表首项为"(空)"
- 存储外键 ID,显示关联实体的 displayName
Implements
IEditor<string>
Constructors
Constructor
new RelationEditor(items?, nullable?): RelationEditor;
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:23
创建关系下拉编辑器
Parameters
| Parameter | Type | Description |
|---|---|---|
items? | | RelatedEntityItem[] | (() => RelatedEntityItem[]) | 候选实体列表,或每次打开时重新求值的工厂函数 |
nullable? | boolean | 是否允许空值,为 true 时列表首项为“(空)” |
Returns
RelationEditor
Properties
editorType
readonly editorType: "relation-editor" = "relation-editor";
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:16
VTable 编辑器类型标识(注册到 VTable 的编辑器名)
Methods
adjustPosition()
adjustPosition(rect): void;
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:33
按新的单元格矩形重新定位浮层
Parameters
| Parameter | Type |
|---|---|
rect | RectProps |
Returns
void
Implementation of
IEditor.adjustPosition
getValue()
getValue(): string;
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:29
返回当前选中的关联实体 ID(未选中为空字符串)
Returns
string
Implementation of
IEditor.getValue
isEditorElement()
isEditorElement(target): boolean;
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:31
判断目标元素是否位于本编辑器浮层内
Parameters
| Parameter | Type |
|---|---|
target | HTMLElement |
Returns
boolean
Implementation of
IEditor.isEditorElement
onEnd()
onEnd(): void;
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:27
移除浮层并解绑全局事件
Returns
void
Implementation of
IEditor.onEnd
onStart()
onStart(ctx): void;
Defined in: packages/rxdb-model/dist/entity-table/editors/relation-editor.d.ts:25
弹出搜索浮层,解析候选列表并绑定键盘与点击事件
Parameters
| Parameter | Type |
|---|---|
ctx | EditContext<string> |
Returns
void
Implementation of
IEditor.onStart