UNPKG

@brizy/ui

Version:
29 lines (28 loc) 1.32 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getChoose = exports.getLoading = exports.isMultiple = exports.isValid = void 0; const react_1 = __importDefault(require("react")); const ramda_1 = require("ramda"); const LoadingOutlined_1 = __importDefault(require("@ant-design/icons/lib/icons/LoadingOutlined")); const constants_1 = require("../../constants"); const isValid = ({ value }) => { if (value) { return !(0, ramda_1.isEmpty)(value === null || value === void 0 ? void 0 : value.name) && !(0, ramda_1.isEmpty)(value === null || value === void 0 ? void 0 : value.source); } return false; }; exports.isValid = isValid; const isMultiple = ({ value }) => { if (value) { return value.filter(value => (0, exports.isValid)({ value })).length > 0; } return false; }; exports.isMultiple = isMultiple; const getLoading = () => react_1.default.createElement(LoadingOutlined_1.default, null); exports.getLoading = getLoading; const getChoose = (t) => (react_1.default.createElement("span", { className: `${constants_1.BRZ_PREFIX}-upload-file__placeholder` }, t("Choose a file"))); exports.getChoose = getChoose;