tav-ui
Version:
241 lines (236 loc) • 8.72 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var antDesignVue = require('ant-design-vue');
require('../../../../../utils/index2.js');
var index$1 = require('../../../../button/index2.js');
require('../../utils/index2.js');
var index = require('../components/FileCardRowEditor/index2.js');
var fileSvg = require('../file-svg2.js');
var consts = require('../../consts2.js');
var ListItemAction = require('../components/ListItemAction2.js');
var visibile = require('../../utils/visibile2.js');
var is = require('../../../../../utils/is2.js');
function defaultItemsBuilder(mode, enabledRowEdit, enabledVersion, actions, handleRowEditClick, hanldeVersionClick) {
const DEFAULT_COLUMNS = [{
field: "avator",
slots: {
default: ({
row
}) => {
const svg = (fileSuffix) => {
if (consts.DEFAULT_FILE_ACCEPT_TYPES.includes(fileSuffix)) {
if (consts.DEFAULT_FILE_OFFICE_TYPES.includes(fileSuffix)) {
if (fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[0]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[1]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[2]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[3])) {
return fileSvg.fileDocSvg;
} else if (fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[4]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[5]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[6]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[7])) {
return fileSvg.fileXlsSvg;
} else if (fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[8]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[9]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[10]) || fileSuffix.includes(consts.DEFAULT_FILE_OFFICE_TYPES[11])) {
return fileSvg.filePptSvg;
} else {
return fileSvg.filePdfSvg;
}
} else if (consts.DEFAULT_FILE_IMAGE_TYPES.includes(fileSuffix)) {
return fileSvg.fileImageSvg;
} else {
return fileSvg.fileUnknownSvg;
}
} else {
return fileSvg.fileUnknownSvg;
}
};
return vue.createVNode(vue.Fragment, null, [row.hyperlink !== 1 ? svg(row.suffix) : fileSvg.fileLinkSvg]);
}
}
}, {
field: "content",
children: [{
field: "fullName",
editRender: {
enabled: mode !== "read" && enabledRowEdit
},
slots: {
edit: ({
row
}) => {
return vue.createVNode(index["default"], {
"row": row,
"onChange": async (payload) => {
await handleRowEditClick(payload, row);
}
}, null);
},
default: ({
row
}) => {
const renderVersion = visibile.isVersionColVisible(enabledVersion, row.hyperlink, row.auto);
const versionContent = renderVersion ? vue.createVNode(vue.Fragment, null, [`\u3010v${row.version}\u3011`]) : null;
const defaultContent = row.hyperlink !== 1 ? vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
"style": "max-width: calc(100% - 70px - 10px)"
}, [vue.createVNode(antDesignVue.Tooltip, {
"placement": "top",
"destroyTooltipOnHide": true
}, {
title: () => vue.createVNode("span", null, [row.fullName]),
default: () => vue.createVNode("span", {
"style": {
display: "inline-block",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
width: "100%"
}
}, [row.fullName])
})]), vue.createVNode("div", {
"style": "max-width: 70px"
}, [vue.createVNode("span", {
"style": {
display: "inline-block",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
width: "100%"
}
}, [versionContent])])]) : vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
"style": "max-width: calc(50% - 10px)"
}, [vue.createVNode(antDesignVue.Tooltip, {
"placement": "top",
"destroyTooltipOnHide": true
}, {
title: () => vue.createVNode("span", null, [row.name]),
default: () => vue.createVNode("span", {
"style": {
display: "inline-block",
lineHeight: "1",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
width: "100%"
}
}, [row.name])
})]), vue.createVNode("div", {
"style": "max-width: calc(50% - 10px)"
}, [vue.createVNode(index$1.TaButton, {
"style": {
minWidth: 0,
padding: 0,
lineHeight: "14px",
height: "14px",
fontSize: "12px",
width: "100%"
},
"type": "link",
"size": "small",
"onClick": (e) => {
e.stopPropagation();
window.open(row.address.includes("//") ? row.address : `//${row.address}`)?.focus();
}
}, {
default: () => [vue.createVNode(antDesignVue.Tooltip, {
"placement": "top",
"destroyTooltipOnHide": true
}, {
title: () => vue.createVNode("span", null, [row.address]),
default: () => vue.createVNode("span", {
"style": {
display: "inline-block",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
width: "100%"
}
}, [row.address])
})]
})])]);
return defaultContent;
}
}
}, {
field: "description",
children: [
{
field: "createByName",
slots: {
default: ({
row
}) => vue.createVNode(antDesignVue.Tooltip, {
"placement": "top",
"destroyTooltipOnHide": true
}, {
title: () => vue.createVNode("span", null, [row.createByName]),
default: () => vue.createVNode("span", {
"style": {
display: "inline-block",
lineHeight: "1",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
width: "100%"
}
}, [row.createByName])
})
}
},
{
field: "updateTime",
slots: {
default: ({
row
}) => vue.createVNode(antDesignVue.Tooltip, {
"placement": "top",
"destroyTooltipOnHide": true
}, {
title: () => vue.createVNode("span", null, [row.updateTime]),
default: () => vue.createVNode("span", {
"style": {
display: "inline-block",
lineHeight: "1",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
width: "100%"
}
}, [row.updateTime])
})
}
}
]
}]
}, {
field: "action",
slots: {
default: ({
row
}) => {
return vue.createVNode(ListItemAction["default"], {
"actions": actions.value(row),
"hideInlineLabel": true,
"hideDropdownIcon": true
}, null);
}
}
}];
return DEFAULT_COLUMNS;
}
function useItems(options) {
const {
mergedProps,
actions,
handleRowEditClick,
hanldeVersionClick
} = options;
return vue.computed(() => {
const items = mergedProps.value.items;
const mode = mergedProps.value.mode;
const enabledRowEdit = mergedProps.value.enabledRowEdit;
const enabledVersion = mergedProps.value.enabledVersion;
let result = defaultItemsBuilder(mode, enabledRowEdit, enabledVersion, actions, handleRowEditClick, hanldeVersionClick);
if (items && is.isFunction(items)) {
result = items(result);
}
return result;
});
}
exports.defaultItemsBuilder = defaultItemsBuilder;
exports.useItems = useItems;
//# sourceMappingURL=use-items2.js.map