n8n-editor-ui
Version:
Workflow Editor UI for n8n
147 lines (146 loc) • 4.92 kB
JavaScript
import { C as computed, Cn as toDisplayString, D as createElementBlock, E as createCommentVNode, Gt as unref, M as createVNode, P as defineComponent, T as createBlock, et as openBlock, h as withModifiers, w as createBaseVNode } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BwBpWJRZ.js";
var _hoisted_1$6 = {
viewBox: "0 0 24 24",
width: "1.2em",
height: "1.2em"
};
function render$5(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [createBaseVNode("path", {
fill: "currentColor",
d: "M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12z"
}, null, -1)]));
}
var closeThick_default = {
name: "mdi-closeThick",
render: render$5
};
var _hoisted_1$5 = {
viewBox: "0 0 24 24",
width: "1.2em",
height: "1.2em"
};
function render$4(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [createBaseVNode("path", {
fill: "currentColor",
d: "M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m0 18h12v-8l-4 4l-2-2zM8 9a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2"
}, null, -1)]));
}
var fileImage_default = {
name: "mdi-fileImage",
render: render$4
};
var _hoisted_1$4 = {
viewBox: "0 0 24 24",
width: "1.2em",
height: "1.2em"
};
function render$3(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [createBaseVNode("path", {
fill: "currentColor",
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zm-1 11h-2v5a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2c.4 0 .7.1 1 .3V11h3zm0-4V3.5L18.5 9z"
}, null, -1)]));
}
var fileMusic_default = {
name: "mdi-fileMusic",
render: render$3
};
var _hoisted_1$3 = {
viewBox: "0 0 24 24",
width: "1.2em",
height: "1.2em"
};
function render$2(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [createBaseVNode("path", {
fill: "currentColor",
d: "M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m9 16v-2H6v2zm3-4v-2H6v2z"
}, null, -1)]));
}
var fileText_default = {
name: "mdi-fileText",
render: render$2
};
var _hoisted_1$2 = {
viewBox: "0 0 24 24",
width: "1.2em",
height: "1.2em"
};
function render$1(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [createBaseVNode("path", {
fill: "currentColor",
d: "M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m11 17v-6l-3 2.2V13H7v6h7v-2.2z"
}, null, -1)]));
}
var fileVideo_default = {
name: "mdi-fileVideo",
render: render$1
};
var _hoisted_1$1 = {
viewBox: "0 0 24 24",
width: "1.2em",
height: "1.2em"
};
function render(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [createBaseVNode("path", {
fill: "currentColor",
d: "M14 3v2h3.59l-9.83 9.83l1.41 1.41L19 6.41V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2z"
}, null, -1)]));
}
var openInNew_default = {
name: "mdi-openInNew",
render
};
var _hoisted_1 = { class: "chat-file-name" };
var ChatFile_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
__name: "ChatFile",
props: {
file: {},
isRemovable: { type: Boolean },
isPreviewable: { type: Boolean },
href: {}
},
emits: ["remove"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const iconMapper = {
document: fileText_default,
audio: fileMusic_default,
image: fileImage_default,
video: fileVideo_default
};
const TypeIcon = computed(() => {
return iconMapper[props.file?.type.split("/")[0]] || fileText_default;
});
function onClick() {
if (props.href) {
window.open(props.href, "_blank", "noopener noreferrer");
return;
}
if (props.isPreviewable) window.open(URL.createObjectURL(props.file));
}
function onDelete() {
emit("remove", props.file);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: "chat-file",
"data-test-id": "chat-file",
onClick
}, [
createVNode(unref(TypeIcon), { class: "chat-icon" }),
createBaseVNode("p", _hoisted_1, toDisplayString(_ctx.file.name), 1),
_ctx.isRemovable ? (openBlock(), createElementBlock("span", {
key: 0,
class: "chat-file-delete",
"data-test-id": "chat-file-remove",
onClick: withModifiers(onDelete, ["stop"])
}, [createVNode(unref(closeThick_default))])) : _ctx.isPreviewable || _ctx.href ? (openBlock(), createBlock(unref(openInNew_default), {
key: 1,
class: "chat-file-preview"
})) : createCommentVNode("", true)
]);
};
}
}), [["__scopeId", "data-v-06c7b5c1"]]);
export { ChatFile_default as t };