import { __assign, __rest } from "tslib";
/* eslint-disable react/prop-types */
import * as React from 'react';
import { usePlatform } from '../../../utils/platform';
import { UploaderH5 } from './uploaderH5';
import classNames from '../../../utils/classnames';
import { UploaderPCInner } from './uploaderPc';
import FormCell from '../formcell';
import './index.css';
/**
 * 图片组件上传，区分 h5端/pc端
 */
function UploaderPc(props) {
    var _a;
    var layout = props.layout, className = props.className, id = props.id, style = props.style, _b = props.labelVisible, labelVisible = _b === void 0 ? true : _b, _c = props.title, title = _c === void 0 ? '上传图片' : _c, _d = props.requiredFlag, requiredFlag = _d === void 0 ? false : _d, restProps = __rest(props, ["layout", "className", "id", "style", "labelVisible", "title", "requiredFlag"]);
    var cls = classNames((_a = {
            'weda-ui': true
        },
        _a[className] = className,
        _a.cloudbase_standard = true,
        _a));
    return (React.createElement(FormCell, { id: id, className: cls, style: style, label: labelVisible ? title : null, layout: layout, multiCell: false, requiredFlag: requiredFlag },
        React.createElement(UploaderPCInner, __assign({}, restProps, { style: {
                height: '100%',
                display: 'flex',
                alignItems: 'center',
            } }))));
}
export default function Uploader(props) {
    var platform = usePlatform();
    if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
        return React.createElement(UploaderPc, __assign({}, props));
    }
    if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
        return React.createElement(UploaderH5, __assign({}, props));
    }
    return platform === 'h5' ? (React.createElement(UploaderH5, __assign({}, props))) : (React.createElement(UploaderPc, __assign({}, props)));
}
//# sourceMappingURL=index.js.map