@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,688 lines (1,687 loc) • 65.6 kB
JavaScript
var Ue = Object.defineProperty;
var ze = (t, e, l) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
var L = (t, e, l) => ze(t, typeof e != "symbol" ? e + "" : e, l);
import { defineComponent as K, toRefs as fe, createVNode as n, Fragment as G, createTextVNode as F, ref as B, watch as q, inject as J, getCurrentInstance as Le, onMounted as ve, onUnmounted as me, computed as O, reactive as je, createApp as qe, Transition as $e, mergeProps as _e, provide as Ve, resolveComponent as Q, onBeforeMount as Qe } from "vue";
import { resolveAppearance as Ke, createPropsResolver as We } from "../dynamic-resolver/index.esm.js";
import { useDateFormat as Xe, withInstall as Ye } from "../common/index.esm.js";
import { LocaleService as ce } from "../locale/index.esm.js";
import "bignumber.js";
import "lodash-es";
import { useDesignerComponent as Ge } from "../designer-canvas/index.esm.js";
const Je = {
// 是否被选中
checked: { type: Boolean, default: !1 },
// 进度条状态 默认'normal'
id: { type: String, default: "" },
// 禁用
disabled: { type: Boolean, default: !1 }
}, Ze = {
// 是否显示进度条信息
showInfo: { type: Boolean, default: !0 },
// 进度条状态 默认'normal'
status: { type: String, default: "normal" },
// 已完成的分段百分比
percent: { type: Number, default: 0 },
maxWidth: { type: Number, default: 0 }
}, et = {
/**
* 按钮文本
*/
selectText: { type: String, default: "选择文件" },
/**
* 禁用
*/
disabled: { type: Boolean, default: !1 },
/**
* 启用多选
*/
enableMulti: { type: Boolean, default: !0 },
/**
* 允许上传类型
*/
accept: { type: String, default: "*" },
/**
* 配置对象
*/
options: { type: Object, default: {} },
/**
* 已上传附件个数
*/
uploadedCount: { type: Number, default: 0 },
/**
* 发起服务器端请求,某个组件使用的特殊的参数
*/
extendConfig: { type: Object, default: {} },
/**
* 附件服务器端服务注入的Token
*/
uploadServerToken: { type: String, default: "" }
}, tt = /* @__PURE__ */ K({
name: "FUploadProgress",
props: Ze,
setup(t, e) {
const {
showInfo: l,
status: i,
maxWidth: a,
percent: s
} = fe(t);
return () => n("div", {
class: ["f-progress upload-progress", "upload-progress-status-" + i.value, "f-progress-status-" + i.value, "upload-progress-line", l.value ? "upload-progress-show-info" : ""]
}, [n("div", {
class: "upload-progress-outer",
style: {
"max-width": a.value > 0 ? a.value + "px" : "auto"
}
}, [n("div", {
class: "upload-progress-inner"
}, [n("div", {
class: "upload-progress-bg f-progress-bg",
style: {
width: s.value + "%"
}
}, null)])]), l.value ? n("span", {
class: "upload-progress-text"
}, [i.value === "error" || i.value === "success" ? n("span", {
class: ["upload-progress-text-icon f-icon", "f-icon-" + i.value]
}, null) : n(G, null, [s.value, F("%")])]) : ""]);
}
}), ke = /* @__PURE__ */ K({
name: "FPreviewCheckbox",
props: Je,
emits: ["checkedChange"],
setup(t, e) {
const {
disabled: l
} = fe(t), i = B(t.checked), a = (s) => {
s.stopPropagation(), l.value || (i.value = !i.value, e.emit("checkedChange", {
checked: i.value,
id: t.id
}));
};
return q(() => t.checked, (s) => {
i.value = s;
}), () => n("div", {
class: "preview-checkbox d-inline-flex align-middle"
}, [n("div", {
class: "custom-control custom-checkbox f-checkradio-single m-0"
}, [n("input", {
title: "custom-control-input",
class: "custom-control-input",
type: "checkbox",
disabled: l.value,
checked: i.value
}, null), n("label", {
class: "custom-control-label",
onClick: (s) => a(s),
onMousedown: (s) => s.stopPropagation()
}, null)])]);
}
}), Ee = /* @__PURE__ */ K({
name: "FFileSelect",
props: et,
emits: ["change", "stateChange"],
setup(t, e) {
const l = J("uploaderService");
l.setUploadContext(e);
const i = Le(), a = B("*");
let s;
const u = () => {
s.files && (e.emit("change", s.files), l.handleFiles(s.files), s.value = null);
};
function d() {
s.value = null, l.reset();
}
q(() => t.disabled, () => {
d();
}), q(() => t.uploadedCount, (p) => {
l.setOptions({
uploadedCount: p
});
}), q(() => t.extendConfig, (p) => {
l.setExtendServerConfig(p);
}), q(() => t.options, (p) => {
l.setOptions(p);
}, {
deep: !0
});
function v(p) {
p && p.stopPropagation(), s.click();
}
function b(p) {
l.handleUploadEvent(p);
}
return ve(() => {
var p, T;
s = (p = i == null ? void 0 : i.proxy) == null ? void 0 : p.$refs.uploadInput, d(), l.setOptions(t.options), l.setExtendServerConfig(t.extendConfig), a.value = (((T = t.options) == null ? void 0 : T.allowedContentTypes) || ["*"]).join(",");
}), me(() => {
}), e.expose({
handleUploadEvent: b
}), () => n(G, null, [n("input", {
ref: "uploadInput",
type: "file",
class: "ffileupload--browser",
disabled: t.disabled,
multiple: t.enableMulti,
accept: a.value,
onChange: () => u(),
style: "width: 10px",
title: "uploadInput"
}, null), n("div", {
class: ["upload-container", t.disabled ? "f-state-disabled" : ""],
onClick: (p) => v(p),
title: t.selectText
}, [n("i", {
class: "f-icon f-icon-upload upload-icon",
style: "top: 2px;position: relative;"
}, null), t.selectText])]);
}
}), nt = "https://json-schema.org/draft/2020-12/schema", lt = "https://farris-design.gitee.io/uploader.schema.json", it = "uploader", st = "A Farris Component", at = "object", ot = {
id: {
description: "The unique identifier for uploader",
type: "string"
},
type: {
description: "The type string of uploader",
type: "string",
default: "uploader"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disable: {
type: "boolean",
default: !1
},
placeholder: {
description: "",
type: "string",
default: ""
},
readonly: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, rt = [
"id",
"type"
], ut = {
$schema: nt,
$id: lt,
title: it,
description: st,
type: at,
properties: ot,
required: rt
}, dt = /* @__PURE__ */ new Map([
["appearance", Ke]
]);
function ct(t, e, l) {
return e;
}
const pt = "uploader", ft = "A Farris Component", vt = "object", mt = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
},
appearance: {
description: "外观",
title: "外观",
properties: {
contentFill: {
description: "内容填充",
title: "内容填充",
type: "boolean"
}
}
},
server: {
description: "服务器配置",
title: "服务器配置",
properties: {
rootId: {
description: "附件服务器根目录",
title: "附件服务器根目录",
type: "string"
},
formId: {
description: "必填,根据【附件信息】业务字段所在位置区分:1、在子表,二级目录建议绑定主表ID。2:在主表:二级目录建议填写当前表数据ID",
title: "二级目录",
type: "string"
}
}
},
upload: {
description: "上传配置",
title: "上传配置",
properties: {
uploadVisible: {
description: "上传按钮是否可见",
title: "上传是否可见",
type: "boolean"
},
uploadDisabled: {
description: "禁用时,上传按钮可见,但不可用",
title: "上传是否禁用",
type: "boolean"
},
allowEmpty: {
description: "运行时是否允许不上传附件",
title: "是否允许为空",
type: "boolean"
},
uploadSelectText: {
description: "选择文件按钮文本",
title: "选择文件按钮文本",
type: "string"
},
uploadOptions: {
description: "附件上传配置",
title: "附件上传配置",
type: "cascade",
isExpand: !0,
properties: {
maxUploads: {
description: "值为0时表示不限制上传个数",
title: "最大上传个数",
type: "number"
},
maxFileSize: {
description: "单个附件最大值(MB)",
title: "单个附件最大值(MB)",
type: "number"
},
allowedContentTypes: {
description: "允许上传附件类型",
title: "允许上传附件类型",
type: "string"
},
notAllowedCharsInFileName: {
description: "文件名禁用字符",
title: "文件名禁用字符",
type: "string"
}
}
},
enableUploadedCount: {
description: "是否启用已上传个数限制",
title: "是否启用已上传个数限制",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
},
uploadEnableMulti: {
description: "是否启用多选附件上传",
title: "是否启用多选附件上传",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
},
enableSliceUpload: {
description: "是否启用分片上传",
title: "是否启用分片上传",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
},
chunkSize: {
description: "分片上传时,每片的大小。单位:M",
title: "分片大小(M)",
type: "number"
}
}
},
preview: {
description: "附件预览",
title: "附件预览",
properties: {
previewVisible: {
description: "预览是否可见",
title: "预览是否可见",
type: "boolean"
},
previewReadonly: {
description: "预览是否只读",
title: "预览是否只读",
type: "boolean"
},
fieldIdKey: {
description: "附件ID字段",
title: "附件ID字段",
type: "string",
editor: {
type: "field-selector"
}
},
fileNameKey: {
description: "附件名称字段",
title: "附件名称字段",
type: "string",
editor: {
type: "field-selector"
}
},
previewEnableMulti: {
description: "是否启用批量操作",
title: "是否启用批量操作",
type: "boolean"
},
noDelete: {
description: "是否禁止删除附件",
title: "是否禁止删除附件",
type: "boolean"
},
noPreview: {
description: "是否禁止预览",
title: "是否禁止预览",
type: "boolean"
},
previewDateFormat: {
description: "附件上传时间字段的格式化设置,请注意此属性仅针对附件上传时间一个字段,若有自定义预览列,请在预览列编辑器中单独设置时间格式。",
title: "附件上传时间格式化",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
},
fileSortOrderKey: {
description: "排序字段",
title: "排序字段",
type: "string"
},
orderType: {
description: "排序类型",
title: "排序类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, ht = {
title: pt,
description: ft,
type: vt,
categories: mt
}, he = {
/**
* 是否填充父容器的区域
* @default false
*/
contentFill: { type: Boolean, default: !1 },
/**
* 指定排序字段,默认是按照 createTime 上传时间排序
* @default createTime
*/
orderField: { type: String, default: "createTime" },
/**
* 指定预览的字段、宽度、标题,是否可选中
* @default [ { field: "name", width: 200, title: "文件名", checkbox: true }, { field: "size", width: 100, title: "大小" }, { field: "createTime", width: 100, title: "日期" }, { field: "state", width: 100, title: "状态" }, { field: "action", width: 100, title: "操作" }, ]
*/
previewColumns: {
type: Array,
default: [
{ field: "name", width: 200, title: "文件名", checkbox: !0 },
{ field: "size", width: 100, title: "大小" },
{ field: "createTime", width: 100, title: "日期" },
{ field: "state", width: 100, title: "状态" },
{ field: "action", width: 100, title: "操作" }
]
},
/**
* 预览是否可见
* @default true
*/
previewVisible: { type: Boolean, default: !0 },
/**
* 预览是否启用批量操作
* @default true
*/
previewEnableMulti: { type: Boolean, default: !0 },
/**
* 批量下载预览文件指定新的名称
*/
previewDefaultRename: { type: String, default: "" },
/**
* 上传功能是否禁用
* @default false
*/
uploadDisabled: { type: Boolean, default: !1 },
// 附件上传部分是否可见
/**
* 上传功能是否显示
* @default true
*/
uploadVisible: { type: Boolean, default: !0 },
// 需要重置,通过不断的赋值来改变
// @Input() uploadNeedReset: Observable<any> = new Subject();
/**
* 选择上传按钮的文本
* @default 选择文件
*/
uploadSelectText: { type: String, default: "选择文件" },
/**
* 是否支持批量上传
* @default true
*/
uploadEnableMulti: { type: Boolean, default: !0 },
/**
* 已上传的个数
*/
uploadedCount: { type: Number, default: 0 },
/**
* 禁用状态
*/
disabled: { type: Boolean, default: !1 },
/**
* 下载按钮禁用
* @default false
*/
downloadButtonDisable: { type: Boolean, default: !1 },
/**
* 预览按钮禁用
* @default false
*/
previewButtonDisable: { type: Boolean, default: !1 },
/**
* 删除按钮禁用
* @default false
*/
deleteButtonDisable: { type: Boolean, default: !1 },
/**
* 自定义提示信息
* @default ''
*/
customInfo: { type: String, default: "" },
/**
* 处理传递预览的数据
* @default []
*/
fileInfos: { type: Array, default: [] },
/**
* 上传配置
* @default null
*/
uploadOptions: { type: Object, default: null },
/**
* 发起服务器端请求,传递的特殊参数
* @default {}
*/
extendConfig: { type: Object, default: {} },
/**
* 附件服务器端服务注入的 Token
*/
uploadServerToken: { type: String, default: "" },
/**
* 提示服务注入的 Toke
*/
notifyServiceToken: { type: String, default: "" }
}, Be = We(he, ut, dt, ct, ht);
var j = /* @__PURE__ */ ((t) => (t[t.Queue = 0] = "Queue", t[t.Uploading = 1] = "Uploading", t[t.Done = 2] = "Done", t[t.Cancelled = 3] = "Cancelled", t[t.Remove = 4] = "Remove", t[t.Error = 5] = "Error", t))(j || {});
class gt {
constructor(e = {}, l = {}) {
/**
* 上传配置
*/
L(this, "uploadConfig");
/**
* 删除配置
*/
L(this, "removeConfig");
const i = { type: "config", url: "", timeout: 0, headers: null, data: {} };
this.uploadConfig = Object.assign({}, i, e), this.removeConfig = Object.assign({}, i, l);
}
}
function ge(t, e) {
const { formatTo: l } = Xe();
return l(t, e);
}
function be(t, e) {
if (!e)
return "";
let l = "";
return t.indexOf(".") === -1 && e.hasOwnProperty(t) ? l = e[t] : l = t.split(".").reduce((i, a) => i ? i[a] : null, e), l;
}
function wt(t) {
return (e, l) => {
if (!e.hasOwnProperty(t) || e[t] === void 0 || e[t] === null)
return 1;
if (!l.hasOwnProperty(t) || l[t] === void 0 || l[t] === null)
return -1;
if (t !== "createTime") {
let s = "", u = "";
return t.indexOf(".") > -1 ? (s = be(t, e), u = be(t, l)) : (s = e[t], u = l[t]), s > u ? 1 : -1;
}
const i = new Date(e[t]), a = new Date(l[t]);
return i.getTime() > a.getTime() ? -1 : 1;
};
}
function Ae(t) {
return (t || []).findIndex((l) => l === "*") === -1;
}
function He(t) {
return t !== "0 Byte";
}
function se(t) {
if (t === 0)
return "0 Byte";
const e = 1024, l = ["Bytes", "KB", "MB", "GB", "TB", "PB"], i = Math.floor(Math.log(t) / Math.log(e));
return parseFloat((t / e ** i).toFixed(2)) + " " + l[i];
}
function De(t, e) {
return t && (t.hasOwnProperty("allowedContentTypes") && (e.allowedContentTypes = t.allowedContentTypes || ["*"], e.allowedContentTypes = e.allowedContentTypes && e.allowedContentTypes.length > 0 ? e.allowedContentTypes : ["*"]), t.hasOwnProperty("maxUploads") && (e.maxUploads = t.maxUploads || 0), t.hasOwnProperty("maxFileSize") && (e.maxFileSize = se(1024 * 1024 * (parseInt(String(t.maxFileSize), 10) || 1)))), e;
}
function xe(t) {
let e = "ffilepreview--filetype";
if (!t)
return e + "-any";
const l = t.lastIndexOf(".");
let i = "";
switch (l > -1 && (i = t.substring(l + 1).toLocaleLowerCase()), i) {
case "pdf":
e += "-pdf";
break;
case "jpeg":
case "jpg":
case "gif":
case "svg":
case "png":
case "bmp":
e += "-img";
break;
case "ppt":
case "pptx":
e += "-ppt";
break;
case "doc":
case "docx":
e += "-doc";
break;
case "xls":
case "xlsx":
e += "-xls";
break;
case "txt":
e += "-txt";
break;
case "zip":
e += "-zip";
break;
case "wps":
e += "-wps";
break;
case "wpt":
e += "-wpt";
break;
default:
e += "-any";
}
return e;
}
function Ce(t) {
var e;
if (t.type === "done")
return 100;
if (t.file && t.file.progress) {
if (t.file.progress.status === j.Uploading) {
const l = ((e = t.file.progress.data) == null ? void 0 : e.percentage) || 5;
return l > 5 ? l : 5;
}
return 5;
}
return 5;
}
function yt(t) {
let e = t;
return t ? (typeof t == "string" && (e = parseInt(t, 10)), se(e)) : "0 Byte";
}
const bt = () => Math.random().toString(36).substring(7);
function Fe(t, e) {
return {
fileIndex: e,
id: bt(),
name: t.name,
size: t.size,
type: t.type,
form: new FormData(),
progress: {
status: j.Queue,
data: {
percentage: 0,
speed: 0,
speedHuman: `${se(0)}/s`,
startTime: null,
endTime: null,
eta: null,
etaHuman: null
}
},
lastModifiedDate: ge(new Date(t.lastModified), "yyyy-MM-dd HH:mm:ss"),
nativeFile: t
};
}
function Se(t) {
const e = [];
return t.forEach((l) => {
const i = { id: "", name: "", size: 0, type: "", extend: null, extendHeaders: null, createTime: "" };
for (const a in i) {
const s = a.replace("extend", "response").replace("createTime", "lastModifiedDate");
l.hasOwnProperty(s) && (s === "lastModifiedDate" ? i[a] = ge(l[s], "yyyy-MM-dd HH:mm:ss") : i[a] = l[s]);
}
e.push(i);
}), e;
}
function xt(t, e) {
return t ? e <= t * 1024 * 1024 : !0;
}
function Ct(t) {
return t.find((e) => e === "*") !== void 0;
}
function Ft(t, e) {
if (!t || t.length === 0 || Ct(t))
return !0;
if (e.lastIndexOf(".") < 0)
return !1;
const l = e.substr(e.lastIndexOf("."));
return t.findIndex(
(i) => i.toLowerCase() === l.toLowerCase()
) > -1;
}
function St(t) {
if (t)
return t.split(`
`).map((e) => e.split(/: */, 2)).filter((e) => e[0]).reduce((e, l) => (e[l[0]] = l[1], e), {});
}
function Te(t) {
return new Date(t * 1e3).toISOString().substr(11, 8);
}
class Tt extends gt {
upload(e, l, i, a) {
const s = e[0];
return new Promise((u, d) => {
var A, h;
const v = l.url || i.url || "", b = l.method || "POST", p = l.data || {}, T = l.headers || {}, C = new XMLHttpRequest(), H = (/* @__PURE__ */ new Date()).getTime();
let D = ((A = s.progress) == null ? void 0 : A.data) && s.progress.data.startTime || H, E = 0, m = null;
C.upload.addEventListener("progress", (y) => {
var M;
if (y.lengthComputable) {
const k = Math.round(y.loaded * 100 / y.total), z = (/* @__PURE__ */ new Date()).getTime() - H;
E = Math.round(y.loaded / z * 1e3), D = ((M = s.progress) == null ? void 0 : M.data) && s.progress.data.startTime || (/* @__PURE__ */ new Date()).getTime(), m = Math.ceil((y.total - y.loaded) / E), s.progress = {
status: j.Uploading,
data: {
percentage: k,
speed: E,
speedHuman: `${se(E)}/s`,
startTime: D,
endTime: null,
eta: m,
etaHuman: Te(m)
}
}, a({ type: "uploading", files: [s] });
}
}, !1), C.upload.addEventListener("error", (y) => {
d(y);
}), C.onreadystatechange = () => {
if (C.readyState === XMLHttpRequest.DONE) {
const y = Math.round(s.size / ((/* @__PURE__ */ new Date()).getTime() - D) * 1e3);
s.progress = {
status: j.Done,
data: {
percentage: 100,
speed: y,
speedHuman: `${se(y)}/s`,
startTime: D,
endTime: (/* @__PURE__ */ new Date()).getTime(),
eta: m,
etaHuman: Te(m || 0)
}
}, s.responseStatus = C.status;
try {
s.response = JSON.parse(C.response);
} catch {
s.response = C.response;
}
s.responseHeaders = St(C.getAllResponseHeaders()), u({ type: "done", files: [s] });
}
}, C.open(b, v, !0), C.withCredentials = !!l.withCredentials;
try {
const y = s.nativeFile;
Object.keys(T).forEach((k) => C.setRequestHeader(k, T[k]));
let M;
l.includeWebKitFormBoundary !== !1 ? (Object.keys(p).forEach((k) => {
var z;
return (z = s.form) == null ? void 0 : z.append(k, p[k]);
}), (h = s.form) == null || h.append(l.fieldName || "file", y, y.name), M = s.form) : M = y, C.send(M);
} catch (y) {
d(y);
}
return () => {
C.abort();
};
});
}
// 删除附件
remove(e, l, i, a) {
return new Promise((s, u) => {
s({ type: "removed", files: e });
});
}
}
const kt = {
showCloseButton: { type: Boolean, default: !0 },
position: { type: String, default: "top-center" },
timeout: { type: Number, default: 3e3 },
theme: { type: String, default: "bootstrap" },
left: { type: Number },
right: { type: Number },
top: { type: Number },
bottom: { type: Number },
id: { type: String },
animate: { type: String, default: "fadeIn" },
options: { type: Object },
safeHtml: { type: Boolean, default: !0 }
}, Et = {
showCloseButton: { type: Boolean, default: !0 },
animate: { type: String, default: "fadeIn" },
options: { type: Object }
}, pe = /* @__PURE__ */ K({
name: "Toast",
props: Et,
emits: ["close", "click"],
setup: (t, e) => {
const l = B(t.animate), i = "fadeOut", a = O(() => t.options), s = B(!1), u = O(() => a.value.title && a.value.message), d = O(() => !a.value.title && a.value.message), v = O(() => {
const h = {
animated: s.value,
toast: !0,
"toast--only-content": !u.value
};
return h[t.animate] = !1, h[i] = s.value, h["toasty-type-" + a.value.type] = !0, a.value.theme && (h[a.value.theme] = !0), h;
}), b = O(() => {
const M = `f-icon-${a.value && a.value.type ? a.value.type.replace("toasty-type-", "") : "default"}`, k = {
"f-icon": !0
};
return k[M] = !0, k;
}), p = O(() => a.value.title || a.value.message), T = O(() => t.showCloseButton), C = O(() => !!a.value.buttons || !!e.slots.default), H = O(() => ce.getLocale() === "en" ? {
wordBreak: "keep-all",
overflowWrap: "break-word"
} : {});
function D(h) {
h.stopPropagation(), h.preventDefault(), s.value = !1, setTimeout(() => {
e.emit("close", a.value);
}, 200);
}
function E(h, y) {
}
function m(h) {
return `f-preten-link ${h.customClass ? h.customClass : ""}`;
}
q(l, () => {
l.value;
});
const A = () => {
var h;
return n(G, null, [n("div", {
class: "after-toast-msg text-right"
}, [!e.slots.default && ((h = a.value.buttons) == null ? void 0 : h.map((y) => n("span", {
class: m(y),
onClick: (M) => void 0
}, [y.text]))), e.slots.default && e.slots.default()])]);
};
return () => n("div", {
class: v.value,
style: "min-height:44px"
}, [T.value && n("button", {
title: ce.getLocaleValue("messageBox.close"),
class: "toast-close f-btn-icon f-bare",
onClick: D
}, [n("span", {
class: "f-icon modal_close"
}, null)]), p.value && n("section", {
class: "modal-tips"
}, [!u.value && n("div", {
class: "float-left modal-tips-iconwrap"
}, [n("span", {
class: b.value
}, null)]), n("div", {
class: "modal-tips-content"
}, [u.value && n(G, null, [n("h5", {
class: "toast-title modal-tips-title",
innerHTML: a.value.title
}, null), n("p", {
class: "toast-msg",
innerHTML: a.value.message,
style: H.value
}, null), C.value && A()]), d.value && (a.value.buttons ? n("div", {
class: "toast-title-btns-wrapper d-flex"
}, [n("h5", {
class: "toast-title modal-tips-title only-toast-msg",
style: H.value,
innerHTML: a.value.message
}, null), n("div", {
class: "after-toast-title text-right ml-auto"
}, [A()])]) : n("h5", {
class: "toast-title modal-tips-title only-toast-msg",
style: H.value,
innerHTML: a.value.message
}, null))])])]);
}
}), Bt = ["moz", "ms", "webkit"];
function At() {
let t = 0;
return (e) => {
const l = (/* @__PURE__ */ new Date()).getTime(), i = Math.max(0, 16 - (l - t)), a = setTimeout(() => {
e(l + i);
}, i);
return t = l + i, a;
};
}
function Ht() {
if (typeof window > "u")
return () => 0;
if (window.requestAnimationFrame)
return window.requestAnimationFrame.bind(window);
const t = Bt.filter((e) => `${e}RequestAnimationFrame` in window)[0];
return t ? window[`${t}RequestAnimationFrame`] : At();
}
Ht();
B("");
function Me() {
if (typeof window > "u" || typeof navigator > "u")
return !1;
const t = navigator.userAgent || navigator.vendor || window.opera, e = [
/iPhone/i,
/iPod/i,
/Android.*Mobile/i,
// Android 手机通常包含 "Mobile" 字样,而平板不包含
/webOS/i,
/BlackBerry/i,
/IEMobile/i,
/Opera Mini/i,
/Harmony/i
], l = [
/iPad/i,
/Android(?!.*Mobile)/i,
// Android 平板通常不含 "Mobile"
/Tablet/i,
/PlayBook/i,
/Kindle/i,
/Silk/i
];
for (const v of l)
if (v.test(t))
return !1;
for (const v of e)
if (v.test(t))
return !0;
if (typeof screen > "u")
return !1;
const i = "ontouchstart" in window || navigator.maxTouchPoints > 0, a = screen.width, s = screen.height, u = Math.min(a, s);
return !!(i && u <= 768);
}
function Dt() {
const t = Me();
return t && document.body.classList.add("f-mobile"), t;
}
typeof document < "u" && Dt();
const re = /* @__PURE__ */ K({
name: "Notify",
props: kt,
emits: ["close", "empty"],
setup(t, e) {
var E;
const l = Me(), a = `farris-notify-${(E = t.options) != null && E.type ? t.options.type : "info"}}`, s = O(() => ({
"farris-notify": !0,
[a]: l
})), u = {
left: 12,
right: 12,
top: 20,
bottom: 12
}, d = B(), v = B(t.options), b = B(t.showCloseButton), p = O(() => t.position || "bottom-right"), T = O(() => t.timeout != null ? t.timeout : 3e3), C = O(() => {
const m = t.bottom ? t.bottom : u.bottom, A = t.top ? t.top : u.top, h = {
transition: "all 0.2s ease",
left: p.value.indexOf("left") > -1 ? `${t.left ? t.left : u.left}px` : "",
right: p.value.indexOf("right") > -1 ? `${t.right ? t.right : u.right}px` : "",
top: p.value.indexOf("top") > -1 ? `${A}px` : "",
bottom: p.value.indexOf("bottom") > -1 ? `${m}px` : ""
};
return p.value.indexOf("center") > -1 && (h.left = "50%", h.marginLeft = "calc(-24rem / 2)", p.value === "center-center" && (h.top = "50%", h.transform = "translate(-50%, -50%)")), h;
});
function H(m) {
e.emit("close");
}
T.value && setTimeout(() => {
H();
}, T.value), e.expose({
closeToast: H,
container: d,
notifyPosition: p
});
function D(m, A) {
H();
}
return () => {
var m;
return l ? n("div", {
class: s.value,
ref: d
}, [(m = t.options) == null ? void 0 : m.message]) : n("div", {
class: s.value,
style: C.value,
ref: d
}, [n(pe, {
options: v.value,
showCloseButton: b.value,
animate: t.animate,
onClose: (A) => D(A, v.value)
}, null)]);
};
}
});
class Pe {
constructor() {
L(this, "notifyRefs", []);
L(this, "globalConfig", je({}));
}
escapeAllHtml(e) {
if (typeof e != "string" || !e)
return "";
const l = document.createElement("div");
return l.textContent = e || "", l.innerHTML.replace(/\\n/g, "<br>").replace(/\\t/g, " ").replace(/\\r/g, "");
}
createNotifyInstance(e) {
const l = this, a = Object.assign({
timeout: 3e3,
position: "bottom-right",
showCloseButton: !0,
safeHtml: !0
}, this.globalConfig, {
...e
}), s = document.createElement("div");
s.style.display = "contents";
const u = qe({
setup() {
var b;
const d = B();
function v() {
d.value.container.style.transform = "scale(0)", setTimeout(() => {
l.updateNotifyPositionForClose(a, d), u.unmount();
}, 220);
}
if (a.position.indexOf("top") > -1) {
const p = l.getNotifyInstances(a.position), T = p[p.length - 1];
if (T) {
const C = T.value.container.getBoundingClientRect();
a.top = C.bottom;
}
}
return a.safeHtml && ((b = a.options) != null && b.message) && (a.options.message = l.escapeAllHtml(a.options.message)), me(() => {
document.body.removeChild(s);
}), ve(() => {
l.updateNotifyPositionForCreate(a, d);
}), () => n($e, {
mode: "out-in",
name: "fade",
appear: !0
}, {
default: () => [n(re, _e({
ref: d
}, a, {
onClose: v
}), null)]
});
}
});
return u.provide("NotifyService", this), document.body.appendChild(s), u.use(ce.i18n), u.mount(s), u;
}
getNotifyInstances(e) {
return this.notifyRefs.filter((l) => l.value.notifyPosition === e);
}
updateNotifyPositionForCreate(e, l) {
if (this.notifyRefs && this.notifyRefs.length) {
const i = window.innerHeight;
e.position.indexOf("bottom") > -1 && this.getNotifyInstances(e.position).forEach((a) => {
const s = a.value.container.getBoundingClientRect();
a.value.container.style.bottom = s.height + i - s.bottom + "px";
});
}
this.notifyRefs = [...this.notifyRefs, l];
}
updateNotifyPositionForClose(e, l) {
const i = this.notifyRefs.indexOf(l);
if (e.position.indexOf("top") > -1) {
const a = this.getNotifyInstances(e.position), s = a.indexOf(l);
a.slice(s + 1).forEach((u) => {
u.value.container.style.top = u.value.container.offsetTop - u.value.container.offsetHeight + "px";
});
}
i > -1 && this.notifyRefs.splice(i, 1);
}
show(e) {
return this.createNotifyInstance(e);
}
buildNotifyProps(e, l) {
let i = "", a = "", s, u, d;
typeof l == "string" ? i = l : l && (i = l.message || "", a = l.title || "", u = l.position || null, d = l.showCloseButton != null ? l.showCloseButton : null, s = l.timeout != null ? l.timeout : null);
const b = {
options: {
type: e,
message: i,
title: a
}
};
return u != null && (b.position = u), d != null && (b.showCloseButton = d), s != null && (b.timeout = s), b;
}
info(e) {
const l = this.buildNotifyProps("info", e);
return this.show(l);
}
success(e) {
const l = this.buildNotifyProps("success", e);
return this.show(l);
}
warning(e) {
const l = this.buildNotifyProps("warning", e);
return this.show(l);
}
error(e) {
const l = this.buildNotifyProps("error", e);
return this.show(l);
}
close(e) {
e && e.unmount();
}
closeAll() {
this.notifyRefs.forEach((e) => {
e == null || e.value.closeToast();
}), this.notifyRefs.length = 0;
}
}
const Mt = Symbol("NOTIFY_SERVICE_TOKEN");
re.install = (t) => {
t.component(re.name, re), t.component(pe.name, pe);
const e = new Pe();
t.provide(Mt, e), t.provide("FNotifyService", e);
};
const Pt = (t = "") => {
let e;
return t && J(t, null) && (e = J(t)), e || (e = new Pe()), e;
}, Ot = (t = "") => {
let e;
if (t && J(t, null)) {
const l = J(t);
l && l() && (e = l());
}
return e || (e = new Tt()), e;
}, Oe = {
getNotify: Pt,
getServerAPI: Ot
};
function Ne(t, e, l) {
const i = Oe.getNotify(t.notifyServiceToken), a = B(t.fileInfos), {
disabled: s,
uploadVisible: u,
uploadDisabled: d,
previewVisible: v,
orderField: b,
previewEnableMulti: p,
downloadButtonDisable: T,
previewColumns: C,
uploadEnableMulti: H,
previewButtonDisable: D
} = fe(t), E = B(!1), m = B([]), A = O(() => m.value.length), h = B([]), y = B("");
function M(o) {
(!o.length || m.value.length !== o.length) && (E.value = !1);
const w = [...o.map((x) => (x.hasOwnProperty("size") || (x.size = void 0), x.hasOwnProperty("createTime") || (x.createTime = void 0), p.value && (x.checked = !!m.value.find((N) => N.id === x.id) || E.value), x))];
return w.sort(wt(b.value)), p.value && (m.value = [...w].filter((x) => x.checked)), w;
}
const k = B(M(a.value));
q(() => t.fileInfos, (o) => {
k.value = M(o);
});
const z = (o, c) => {
o.stopImmediatePropagation(), e.emit("fileDownloadEvent", { fileInfos: [c], name: "" });
}, Z = (o, c) => {
o.stopImmediatePropagation(), !D.value && e.emit("filePreviewEvent", c);
}, ee = (o, c, w) => {
c.checked && (m.value = m.value.filter((x) => x.id !== c.id)), e.emit("fileRemoveEvent", c), w.handleUploadEvent({ type: "remove", file: c });
}, te = (o, c = "preview") => o.formatter ? !0 : c === "preview" ? ["state", "name", "action", "size", "createTime"].findIndex((x) => x === o.field) > -1 : c === "upload" ? ["state", "name", "size"].findIndex((x) => x === o.field) > -1 : !1, W = (o) => !(o.field === "state" && (d.value || !u.value)), X = (o) => o.lastIndexOf(".") > 0 ? o.substring(0, o.lastIndexOf(".")) : "", ne = (o) => {
if (o.stopImmediatePropagation(), A.value > 1) {
let c = "";
c = X(m.value[0].name), e.emit("fileDownloadEvent", {
fileInfos: m.value,
name: c
});
}
}, $ = (o) => {
o.stopImmediatePropagation(), e.emit("fileRemoveEvent", m.value);
}, le = (o) => {
const c = k.value;
o.checked ? (c.forEach((w) => {
w.checked = !0;
}), m.value = [...k.value], E.value = !0) : (m.value = [], c.forEach((w) => {
w.checked = !1;
}), E.value = !1), e.emit("previewMultiSelectedEvent", m.value);
}, _ = (o, c) => {
o && (o.stopImmediatePropagation(), o.stopPropagation()), (!y.value || c.id !== y.value) && (y.value = c.id, e.emit("selectedEvent", c));
}, g = (o) => {
const c = m.value.findIndex((N) => N.id === o.id), w = c > -1, x = k.value.find((N) => N.id === o.id);
x && (x.checked = o.checked), o.checked && !w && x && m.value.push(x), !o.checked && w && m.value.splice(c, 1), k.value.length > 0 && (m.value.length === k.value.length ? E.value = !0 : E.value = !1), _(null, x), e.emit("previewMultiSelectedEvent", m.value);
}, R = (o) => {
var c;
(c = l == null ? void 0 : l.value) == null || c.handleUploadEvent(o);
}, ie = (o) => {
R({ type: "upload", file: o });
}, U = (o, c) => {
let w = [];
o.files && o.files.length > 0 ? w = o.files : typeof o.file < "u" && (w = [o.file]), c = c || o.type, w.map((x) => {
const N = h.value.findIndex((V) => {
var oe;
return typeof x < "u" && ((oe = V == null ? void 0 : V.file) == null ? void 0 : oe.id) === x.id;
});
N > -1 && (h.value[N] = { type: c, file: x });
});
}, Y = (o) => {
if (o.files) {
const c = o.files.map((w) => w.id);
h.value = h.value.filter((w) => !(c.findIndex((N) => {
var V;
return N === ((V = w == null ? void 0 : w.file) == null ? void 0 : V.id);
}) > -1)), R({
type: "hide",
id: c.join(",")
});
}
}, ae = (o) => {
let c = "warning";
(o.type === "cancelled" || o.type === "removed") && (c = "success");
const w = o.hasOwnProperty("message") ? o.message : "";
i.show({
options: { type: c, message: w },
position: "top-center"
});
}, de = (o) => {
if (o.type === "addedToQueue" && typeof o.file < "u")
h.value.push({ type: o.type, file: o.file }), ie(o.file);
else if (o.type === "start")
U(o, "start");
else if (o.type === "done") {
U(o, "done");
const c = (o.files || []).map((w) => ({
checked: !1,
id: w.id,
name: w.name,
size: w.size,
createTime: ge(/* @__PURE__ */ new Date(), "yyyy-MM-dd HH:mm:ss")
}));
a.value = [...c, ...k.value], Y(o), e.emit("fUploadDoneEvent", Se(o.files || [])), e.emit("uploadDoneEvent", Se(o.files || []));
} else if (o.type === "cancelled" || o.type === "removed" || o.type === "error") {
const c = a.value.filter((w) => o.files && o.files.findIndex((x) => w.id === x.id) < 0);
a.value = [...c], ae(o);
} else o.type === "rejected" && typeof o.file < "u" && ae(o);
};
return me(() => {
}), {
disabled: s,
uploadVisible: u,
uploadDisabled: d,
downloadButtonDisable: T,
previewVisible: v,
previewColumns: C,
uploadFiles: h,
innerFileInfos: k,
previewEnableMulti: p,
previewMultiSelectedLength: A,
previewSelectAllBtnChecked: E,
uploadEnableMulti: H,
previewCurrentId: y,
multiFileRemoveHandler: $,
previewMultiSelectChangeHandler: g,
fileMultiDownloadHandler: ne,
selectOrCancelAllHandler: le,
hasColumnHtmlFunc: te,
showPreviewStateColumn: W,
rowSelectedHandler: _,
fileDownloadHandler: z,
filePreviewHandler: Z,
fileRemoveHandler: ee,
handleStateChange: de
};
}
class Nt {
constructor(e, l) {
// 记录在上传的附件数组
L(this, "queue");
L(this, "uploadOpts", {
// 默认不限制,0代表不限制 Number.POSITIVE_INFINITY
allowedContentTypes: ["*"],
maxUploads: 0,
/** 单位M,默认是12M,0代表不限制 */
maxFileSize: 12,
concurrency: Number.POSITIVE_INFINITY,
uploadedCount: 0
});
/**
* 服务器端扩展
*/
L(this, "extendServerConfig", null);
L(this, "uploadServerSer");
L(this, "uploadContext", null);
this.stateChangeRecord = e, this.serverToken = l, this.queue = [], this.uploadServerSer = Oe.getServerAPI(this.serverToken);
}
setUploadContext(e) {
this.uploadContext = e;
}
/**
* 处理从服务器端返回的结果
*/
handleResultFromServer(e) {
var l, i;
switch (e.type) {
case "removed":
this.queue = this.queue.filter(
(a) => {
var s;
return ((s = a.progress) == null ? void 0 : s.status) !== j.Remove;
}
), e.hasOwnProperty("message") || (e.message = "被删除"), this.stateChangeRecord.value = e;
break;
case "error":
this.queue = this.queue.filter((a) => e.files && e.files.findIndex((s) => a.id === s.id) < 0), (l = this.uploadContext) == null || l.emit("stateChange", e);
break;
default:
(i = this.uploadContext) == null || i.emit("stateChange", e);
}
}
setOptions(e) {
e && (this.uploadOpts = Object.assign(this.uploadOpts, e));
}
/**
* 处理上传的附件信息
* @param incomingFiles
*/
handleFiles(e) {
var i;
const l = Array.from(e).reduce(
(a, s, u) => {
var b;
const d = a.length + this.queue.length + 1, v = this.rejectedReason(
s.name,
d,
s.size
);
if (v.allowed)
a = a.concat(s);
else {
const p = Fe(
s,
u
);
(b = this.uploadContext) == null || b.emit("stateChange", {
type: "rejected",
file: p,
message: v.message
});
}
return a;
},
[]
);
[].map.call(l, (a, s) => {
var d;
const u = Fe(a, s);
this.queue.push(u), (d = this.uploadContext) == null || d.emit("stateChange", { type: "addedToQueue", file: u });
}), (i = this.uploadContext) == null || i.emit("stateChange", { type: "allAddedToQueue" });
}
/**
* 获取上传被拒绝的理由
* @param name
* @param queuelength
* @param size
* @returns
*/
rejectedReason(e, l, i) {
let a = !1, s = "";
return this.queue.findIndex((d) => d.name === e) > -1 ? s = "上传失败:已存在同名文件" : this.uploadOpts.allowedContentTypes && !Ft(this.uploadOpts.allowedContentTypes, e) ? s = `上传失败:只允许上传${this.uploadOpts.allowedContentTypes.join(",")}类型的文档` : this.exceedMaxUpload(l) ? s = `上传失败:文件总个数超出${this.uploadOpts.maxUploads}限制` : xt(this.uploadOpts.maxFileSize, i) ? i === 0 ? s = "上传失败:不允许文件为空" : a = !0 : s = `上传失败:单个文件大小超出${this.uploadOpts.maxFileSize}MB的限制`, {
allowed: a,
message: s
};
}
/**
* 超出最大上传数值
* @param queuelength
* @returns
*/
exceedMaxUpload(e = 0) {
if (!this.uploadOpts || !this.uploadOpts.maxUploads)
return !1;
const l = this.uploadOpts.uploadedCount || 0;
return this.uploadOpts.maxUploads > 0 && (this.uploadOpts.maxUploads <= l || e + l > this.uploadOpts.maxUploads);
}
/**
* 从前端传来事件,进行服务器端方法类型判断
* @param input
*/
handleUploadEvent(e) {
var l, i;
switch (e.type) {
case "upload":
const a = this.queue.findIndex(
(d) => d === e.file
);
a !== -1 && e.file && this.serverMethod({
files: [this.queue[a]],
event: e
});
break;
case "remove":
if (!((l = e == null ? void 0 : e.file) != null && l.id))
return;
const s = this.queue.findIndex(
(d) => {
var v;
return d.id === ((v = e == null ? void 0 : e.file) == null ? void 0 : v.id);
}
);
if (s !== -1 && this.queue[s] && this.queue[s].progress) {
const { progress: d } = this.queue[s];
d && (d.status = j.Remove);
}
this.serverMethod({ files: [e.file], event: e });
break;
case "removeAll":
const u = this.queue.filter(
(d) => {
var v;
return ((v = d == null ? void 0 : d.progress) == null ? void 0 : v.status) === j.Queue;
}
);
u.length && ((i = this.uploadContext) == null || i.emit("stateChange", {
type: "cancelled",
files: u,
message: "删除附件成功"
}), this.queue = this.queue.filter(
(d) => {
var v;
return ((v = d == null ? void 0 : d.progress) == null ? void 0 : v.status) !== j.Queue;
}
)), this.queue.length && (e.type = "remove", this.queue.forEach((d) => {
d.progress && (d.progress.status = j.Remove);
}), this.serverMethod({ files: this.queue, event: e }));
break;
}
}
/**
* 处理上传的扩展参数
* @param extendSer
*/
setExtendServerConfig(e) {
this.extendServerConfig = e;
}
/**
* 处理服务器接口的方法
* @param upload
* @returns
*/
serverMethod(e) {
let l;
switch (e.event.type) {
case "upload":
l = this.upload(e.files, e.event, (i) => this.handleResultFromServer(i));
break;
case "removeAll":
case "remove":
l = this.remove(e.files, e.event, (i) => this.handleResultFromServer(i));
break;
default:
l = null;
}
l && l.then((i) => {
this.handleResultFromServer(i);
}).catch((i) => {
this.handleResultFromServer(i);
});
}
/**
* 上传附件
* @param files
* @param event
* @returns
*/
upload(e, l, i) {
var a;
return (a = this.uploadContext) == null || a.emit("stateChange", { type: "start", files: e }), this.uploadServerSer.upload(e, l, this.extendServerConfig, i);
}
/**
* 删除附件
* @param files
* @param event
* @returns
*/
remove(e, l, i) {
return this.uploadServerSer.remove(e, l, this.extendServerConfig, i);
}
/**
* 重置
*/
reset() {
this.queue = [];
}
/**
* 销毁
*/
destroyed() {
this.reset();
}
}
const ue = /* @__PURE__ */ K({
name: "FUploader",
components: {
"f-upload-progress": tt,
"f-preview-checkbox": ke,
"f-file-select": Ee
},
props: he,
emits: ["filePreviewEvent", "fileDownloadEvent", "previewMultiSelectedEvent", "selectedEvent", "fileRemoveEvent", "fileRemovedEvent", "fUploadDoneEvent", "uploadDoneEvent"],
setup(t, e) {
const l = B(), i = new Nt(l, t.uploadServerToken);
Ve("uploaderService", i);
const a = B(t.customInfo);
function s() {
return De(t.uploadOptions, {
// 允许上传的文件类型
allowedContentTypes: ["*"],
// 默认不限制附件上传个数
maxUploads: 0,
// 单位KB,默认是12M
maxFileSize: "12MB"
});
}
const u = B(s()), d = B(null);
q(() => t.uploadOptions, () => {
u.value = s();
}, {
deep: !0
});
const {
disabled: v,
uploadVisible: b,
uploadDisabled: p,
downloadButtonDisable: T,
previewVisible: C,
previewColumns: H,
uploadFiles: D,
innerFileInfos: E,
previewEnableMulti: m,
previewMultiSelectedLength: A,
previewSelectAllBtnChecked: h,
uploadEnableMulti: y,
previewCurrentId: M,
multiFileRemoveHandler: k,
previewMultiSelectChangeHandler: z,
fileMultiDownloadHandler: Z,
selectOrCancelAllHandler: ee,
rowSelectedHandler: te,
hasColumnHtmlFunc: W,
showPreviewStateColumn: X,
fileDownloadHandler: ne,
filePreviewHandler: $,
fileRemoveHandler: le,
handleStateChange: _
} = Ne(t, e, d);
q(l, (r) => {
switch (_(r), r.type) {
case "removed":
e.emit("fileRemovedEvent", r.files[0]);
break;
}
});
const g = O(() => E.value.length > 0);
function R() {
var r;
return Ae(u.value.allowedContentTypes || []) ? n("li", null, [n("span", null, [F("支持类型:")]), n("span", {
class: "support-info--item-detail",
style: "margin-right:4px;"
}, [(r = u.value.allowedContentTypes) == null ? void 0 : r.join(""), F(",")])]) : "";
}
function ie() {
return He(u.value.maxFileSize || "") ? n("li", null, [n("span", null, [F("单个文件限制:")]), n("span", {
class: "support-info--item-detail"
}, [u.value.maxFileSize, F(", ")])]) : "";
}
function U() {
return (u.value.maxUploads || 0) > 0 && n("li", null, [n("span", null, [F("文件总数限制:")]), n("span", {
class: "support-info--item-detail"
}, [u.value.maxUploads, F("个")])]);
}
function Y() {
return b.value && !p.value && !v.value ? n("div", {
class: "ffileupload--support-info"
}, [a.value ? n("ul", {
class: "support-info--wrapper"
}, [n("li", null, [n("span", {
class: "support-info--item-detail",
innerHTML: a.value
}, null)])]) : n("ul", {
class: "support-info--wrapper"
}, [R(), ie(), U()])]) : null;
}
function ae(r) {
var f, S, I;
return n("div", {
class: "uploadAndpreview--title-container"
}, [n("div", {
class: "ffilepreview--item-icon"
}, [n("span", {
class: ["ffilepreview--filetype-icon", xe(((f = r.file) == null ? void 0 : f.name) || "")]
}, null)]), n("div", {
class: "uploadAndpreview--right"
}, [n("a", {
class: "item-content--title",
title: (S = r.file) == null ? void 0 : S.name
}, [((I = r.file) == null ? void 0 : I.name) || "无名称"]), n(Q("f-upload-progress"), {
status: r.type === "done" ? "success" : "active",
percent: Ce(r),
maxWidth: 300
}, null)])]);
}
function de(r) {
return n("div", {
class: "uploadAndpreview--title-container"
}, [n("div", {
class: "ffilepreview--item-icon"
}, [n("span", {
class: ["ffilepreview--filetype-icon", xe(r.name)]
}, null)]), n("div", {
class: "uploadAndpreview--right"
}, [n("a", {
class: ["item-content--title", "previewButtonDisable.value?'no-preview':''"],
title: r.name,
onClick: (f) => $(f, r)
}, [r.name])])]);
}
function o(r, f, S) {
return n("div", {
class: "uploadAndpreview--filesize-container"
}, [r === "preview" && S ? n("span", null, [yt(S.size)]) : null, r === "upload" && f ? n("span", null, [Ce(f)]) : null]);
}
function c(r, f) {
return f && f.type === "error" ? n("div", {
class: "uploadAndpreview--state-container"
}, [n("p", {
class: "upload-state--uploaded"
}, [n("i", {
class: "f-icon f-icon-message_warning text-danger"
}, null), n("span", null, [F("存在异常")])])]) : n("div", {
class: "uploadAndpreview--state-container"
}, [r === "upload" ? f && f.type !== "done" ? n("p", {
class: "upload-state--uploading"
}, [n("i", {
class: "f-icon f-icon-clock text-warning"
}, null), n("span", null, [F("正在上传...")])]) : n("p", {
class: "upload-state--uploaded"
}, [n("i", {
class: "f-icon f-icon-success text-success"
}, null), n("span", null, [F("上传成功")])]) : r === "preview" ? n("p", {
class: "upload-state--uploaded"
}, [n("i", {
class: "f-icon f-icon-success text-success"
}, null), n("span", null, [F("已上传")])]) : ""]);
}
function w(r) {
return n("div", {
class: "uploadAndpreview--action-container"
}, [T.value ? "" : n("button", {
class: "btn preview-btn",