import { __assign } from "tslib";
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import Tag from './Tag';
import Pop from '../../pop';
import { getPathValue, getPathLabel } from '../path-fns';
import { simplify } from '../simplify';
var renderTagCollapsedTrigger = function (length) {
    return (_jsxs("span", __assign({ className: "zent-cascader-v2-tag-collapsed-trigger", "data-zv": 'v10.0.12' }, { children: ["+", length] }), void 0));
};
function CascaderTagList(props) {
    var list = props.list, renderValue = props.renderValue, selectionMap = props.selectionMap, simplifyPaths = props.simplifyPaths, onRemove = props.onRemove, collapse = props.collapse;
    var paths = simplifyPaths ? simplify(list, selectionMap) : list;
    var renderPaths = collapse ? paths.slice(0, 1) : paths;
    var renderCollapsePaths = paths.slice(1);
    return (_jsxs(_Fragment, { children: [renderPaths.map(function (path) {
                var removeCallback = function (e) {
                    e.stopPropagation();
                    onRemove(path[path.length - 1]);
                };
                return (_jsx(Tag, { path: path, onRemove: removeCallback, renderValue: renderValue }, getPathValue(path)));
            }), collapse && renderCollapsePaths.length > 0 && (_jsx(Pop, __assign({ trigger: "hover", position: "auto-top-center", cushion: 15, content: _jsx("div", __assign({ className: "zent-cascader-v2-tag-collapsed-content", "data-zv": 'v10.0.12' }, { children: _jsx("div", __assign({ "data-zv": 'v10.0.12' }, { children: _jsx("span", __assign({ "data-zv": 'v10.0.12' }, { children: renderCollapsePaths
                                .map(function (item) {
                                return getPathLabel(item);
                            })
                                .join('、') }), void 0) }), void 0) }), void 0) }, { children: renderTagCollapsedTrigger(renderCollapsePaths.length) }), void 0))] }, void 0));
}
export default CascaderTagList;
