UNPKG

@cmstops/pro-compo

Version:

[物料平台文档中心](https://arco.design/docs/material/guide)

103 lines (102 loc) 4.05 kB
"use strict"; var vue = require("vue"); var index = require("../../../thumbCard/index.js"); const _hoisted_1 = { class: "card-alias" }; const _hoisted_2 = { key: 0, class: "check-box active" }; const _sfc_main = vue.defineComponent({ __name: "ListCardWrapper", props: { item: {}, extraKeys: {}, selectKeys: {}, disable: { type: Boolean } }, emits: ["select", "select-one", "options"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const filterOptions = vue.inject("filterOptions"); const resourceKey = vue.computed(() => props.item.id || props.item.url); const selectedOrder = vue.computed(() => { var _a; const result = {}; (_a = props.selectKeys) == null ? void 0 : _a.forEach((key, index2) => { result[key] = index2 + 1; }); return result; }); const canIUse = vue.computed(() => { if (props.disable) return false; if (filterOptions == null ? void 0 : filterOptions.value) { const { mediaType, mediaTypeStrict } = filterOptions.value; if (mediaTypeStrict) { return mediaType.split(",").includes(props.item.catalog); } } if (props.item.progress >= 0) return false; return true; }); const handlersKey = vue.computed(() => { var _a, _b; if (props.item.status === 2) { return [ { label: "\u91CD\u65B0\u4E0A\u4F20", key: "reupload" }, { label: "\u5220\u9664\u8BB0\u5F55", key: "remove" } ]; } if (props.item.status === 3) { return [{ label: "\u91CD\u65B0\u8F6C\u7801", key: "retranscode" }]; } if (((_a = props.selectKeys) == null ? void 0 : _a.length) && ((_b = props.selectKeys) == null ? void 0 : _b.length) > 0 || props.disable || !canIUse.value) { return []; } return [{ label: "\u9009\u7528", key: "select-one" }].concat(props.extraKeys || []); }); function handleCheck() { if (!canIUse.value && !selectedOrder.value[resourceKey.value]) return; emits("select", props.item); } return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { class: "card-wrapper-image", onClick: vue.withModifiers(handleCheck, ["stop"]) }, [ vue.createElementVNode("div", { class: vue.normalizeClass(["card-wrapper", { disable: !canIUse.value, active: selectedOrder.value[resourceKey.value] }]) }, [ vue.createVNode(vue.unref(index), { url: _ctx.item.url, thumb: _ctx.item.thumb || _ctx.item.url, catalog: _ctx.item.catalog, meta: _ctx.item, options: { fit: ["image", "video"].includes(_ctx.item.catalog) ? "contain" : "cover" }, "use-mask": true, "handlers-key": handlersKey.value, onHandle: _cache[0] || (_cache[0] = (e) => emits("options", e)) }, null, 8, ["url", "thumb", "catalog", "meta", "options", "handlers-key"]), _cache[1] || (_cache[1] = vue.createElementVNode("div", { class: "mask" }, null, -1)) ], 2), vue.createElementVNode("div", _hoisted_1, vue.toDisplayString(_ctx.item.alias), 1), vue.createElementVNode("div", { class: "check-box-wrapper", onClick: vue.withModifiers(handleCheck, ["stop"]) }, [ vue.createCommentVNode(" \u5DF2\u9009 "), selectedOrder.value[resourceKey.value] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(selectedOrder.value[resourceKey.value]), 1)) : canIUse.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ vue.createCommentVNode(" \u662F\u5426\u53EF\u4EE5\u9009\u62E9 "), _cache[2] || (_cache[2] = vue.createElementVNode("div", { class: "check-box" }, null, -1)) ], 64)) : vue.createCommentVNode("v-if", true) ]) ]); }; } }); module.exports = _sfc_main;