import { BooleanHelper, CallChaining, CastHelper } from '@oinone/kunlun-shared'; import { type ActiveRecordsWidgetProps, executeInvisible, Widget } from '@oinone/kunlun-vue-widget'; import { BaseActionWidget, BaseElementWidget } from './token'; export class BaseActionGroupWidget< T extends ActiveRecordsWidgetProps = ActiveRecordsWidgetProps > extends BaseElementWidget { protected defaultAllInvisible = true; /** * 挂载时 * @protected */ @Widget.Reactive() @Widget.Inject() protected mountedCallChaining: CallChaining | undefined; /** * 刷新时 * @protected */ @Widget.Reactive() @Widget.Inject() protected refreshCallChaining: CallChaining | undefined; @Widget.Reactive() protected showActionNames: string[] | undefined; @Widget.Reactive() protected get overflow() { return BooleanHelper.toBoolean(this.getDsl().overflow); } protected showActionNamesProcess(): string[] { const showActionNames: Set = new Set(); this.getChildren().forEach((widget) => { const showAction = !executeInvisible(CastHelper.cast(widget)); if (showAction) { const name = (widget as BaseActionWidget).action?.name; if (name) { showActionNames.add(name); } } }); return [...showActionNames]; } protected resetShowActionNames() { this.showActionNames = this.showActionNamesProcess(); } protected $$mounted() { super.$$mounted(); this.resetShowActionNames(); } protected resetInvisible() { super.resetInvisible(); this.resetShowActionNames(); } }