"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/* eslint-disable react/prop-types */
var React = (0, tslib_1.__importStar)(require("react"));
var platform_1 = require("../../../utils/platform");
var uploaderH5_1 = require("./uploaderH5");
var classnames_1 = (0, tslib_1.__importDefault)(require("../../../utils/classnames"));
var uploaderPc_1 = require("./uploaderPc");
var formcell_1 = (0, tslib_1.__importDefault)(require("../formcell"));
require("./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 = (0, tslib_1.__rest)(props, ["layout", "className", "id", "style", "labelVisible", "title", "requiredFlag"]);
    var cls = (0, classnames_1.default)((_a = {
            'weda-ui': true
        },
        _a[className] = className,
        _a.cloudbase_standard = true,
        _a));
    return (React.createElement(formcell_1.default, { id: id, className: cls, style: style, label: labelVisible ? title : null, layout: layout, multiCell: false, requiredFlag: requiredFlag },
        React.createElement(uploaderPc_1.UploaderPCInner, (0, tslib_1.__assign)({}, restProps, { style: {
                height: '100%',
                display: 'flex',
                alignItems: 'center',
            } }))));
}
function Uploader(props) {
    var platform = (0, platform_1.usePlatform)();
    if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
        return React.createElement(UploaderPc, (0, tslib_1.__assign)({}, props));
    }
    if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
        return React.createElement(uploaderH5_1.UploaderH5, (0, tslib_1.__assign)({}, props));
    }
    return platform === 'h5' ? (React.createElement(uploaderH5_1.UploaderH5, (0, tslib_1.__assign)({}, props))) : (React.createElement(UploaderPc, (0, tslib_1.__assign)({}, props)));
}
exports.default = Uploader;
//# sourceMappingURL=index.js.map