import { observer } from '@formily/reactive-vue';
import { Space } from '@jeamn/formily-components';
import { Button } from '@gaoding/gd-antd-plus';
import { usePrefix, useTreeNode, useSelected } from '../../hooks';
import { IconWidget } from '../IconWidget';
import { TextWidget } from '../TextWidget';
import cls from 'classnames';
import './styles.less';
import { composeExport } from '@jeamn/formily-components/src/__builtins__';
import { defineComponent } from 'vue-demi';
var NodeActionsWidgetComponent = observer(defineComponent({
    props: ['activeShown'],
    setup: function (props, _a) {
        var slots = _a.slots;
        var nodeRef = useTreeNode();
        var prefixRef = usePrefix('node-actions');
        var selectedRef = useSelected();
        return function () {
            var _a;
            if (selectedRef.value.indexOf(nodeRef.value.id) === -1 &&
                props.activeShown)
                return null;
            return (<div class={cls(prefixRef.value)}>
            <div class={prefixRef.value + '-content'}>
              <Space split="|">{(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)}</Space>
            </div>
          </div>);
        };
    },
}));
var ActionComponent = defineComponent({
    props: ['icon', 'title', 'onClick'],
    setup: function (props, _a) {
        var attrs = _a.attrs, emit = _a.emit;
        var prefixRef = usePrefix('node-actions-item');
        return function () {
            return (<Button text={true} {...attrs} class={cls(prefixRef.value)} data-click-stop-propagation="true" onClick={function () {
                    emit('click');
                }}>
          <span class={prefixRef.value + '-text'}>
            <IconWidget infer={props.icon}/>
            <TextWidget>{props.title}</TextWidget>
          </span>
        </Button>);
        };
    },
});
export var NodeActionsWidget = composeExport(NodeActionsWidgetComponent, {
    Action: ActionComponent,
});
//# sourceMappingURL=index.jsx.map