import { __assign, __rest } from "tslib";
var isBoolean = function (val) { return typeof val === 'boolean'; };
export function getTabDataFromChild(child, activeId) {
    var _a = child.props, id = _a.id, disabled = _a.disabled, tab = _a.tab, panelChildren = _a.children, panelClassName = _a.className, unmountOnHide = _a.unmountOnHide, canFixed = _a.canFixed, candel = _a.candel;
    var props = {
        title: tab,
        disabled: disabled,
        key: id,
        actived: activeId === id,
        panelChildren: panelChildren,
        className: panelClassName,
        unmountOnHide: unmountOnHide,
        canFixed: canFixed,
        candel: candel,
    };
    return props;
}
export function commonTransformTabData(tabItem, propCandel, fixedProps) {
    if (fixedProps === void 0) { fixedProps = {}; }
    var candel = propCandel;
    if (isBoolean(tabItem.candel)) {
        candel = tabItem.candel;
    }
    var canFixed = fixedProps.canFixed, restFixedProps = __rest(fixedProps, ["canFixed"]);
    if (isBoolean(tabItem.canFixed)) {
        canFixed = tabItem.canFixed;
    }
    return __assign({ key: tabItem.key, actived: tabItem.actived, disabled: tabItem.disabled, title: tabItem.title, className: tabItem.className, candel: candel && !tabItem.disabled, canFixed: canFixed }, restFixedProps);
}
export var getTabPanelStringTitle = function (title) {
    if (typeof title === 'string')
        return title;
    return undefined;
};
export var getFixedProps = function (props) {
    var canFixed = props.canFixed, fixedIds = props.fixedIds, onFixedChange = props.onFixedChange;
    var fixedProps = {
        canFixed: canFixed,
        onFixedChange: onFixedChange,
    };
    if ('fixedIds' in props) {
        fixedProps.fixedIds = fixedIds;
    }
    return fixedProps;
};
