import { TreeNode } from '@oinone/kunlun-shared'; import { SPI } from '@oinone/kunlun-spi'; import { Widget } from '@oinone/kunlun-vue-widget'; import { BaseElementWidget } from '../../../basic'; import type { TreeData } from '../../../typing'; import { ActionBarWidget, type ActionBarWidgetProps } from './ActionBarWidget'; export interface TreeNodeActionsWidgetProps extends ActionBarWidgetProps { node: TreeNode; } @SPI.ClassFactory(BaseElementWidget.Token({ widget: 'TreeNodeActions', inline: true })) export class TreeNodeActionsWidget extends ActionBarWidget< TreeNodeActionsWidgetProps > { @Widget.Reactive() protected node: TreeNode | undefined; public initialize(props: TreeNodeActionsWidgetProps) { super.initialize(props); const { node } = props; this.node = node; if (node) { this.subPath = node.key; this.setCurrentActiveRecords(node.value?.data); } else { this.setCurrentActiveRecords([{}]); } return this; } }