@shopware-ag/meteor-component-library
Version:
The meteor component library is a Vue component library developed by Shopware. It is based on the [Meteor Design System](https://shopware.design/).
95 lines (94 loc) • 4.22 kB
JavaScript
import '../mt-field-error.css';
"use strict";
const vue = require("vue");
const mtIcon_vue_vue_type_style_index_0_lang = require("../mt-icon.vue_vue_type_style_index_0_lang-0a28c7b6.js");
const MtText = require("./MtText.js");
const vueI18n = require("vue-i18n");
const _pluginVue_exportHelper = require("../_plugin-vue_export-helper-9c783a34.js");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "mt-field-error",
props: {
error: {}
},
setup(__props) {
const props = __props;
const errorMessage = vue.computed(() => {
var _a;
if (!props.error)
return "";
if (!props.error.code) {
return t(((_a = props.error) == null ? void 0 : _a.detail) ?? "");
}
const translationKeys = [
`global.error-codes.${props.error.code}`,
`mt-field-error.${props.error.code}`
];
for (const key of translationKeys) {
const translation = t(key, props.error.parameters || {});
const noTranslationFound = translation === key;
if (!noTranslationFound) {
return translation;
}
}
return props.error.detail;
});
const { t } = vueI18n.useI18n({
useScope: "global",
messages: {
en: {
"mt-field-error": {
FRAMEWORK__MISSING_PRIVILEGE_ERROR: "Missing permissions",
FRAMEWORK__DELETE_RESTRICTED: "Deletion failed",
INVALID_MEDIA_URL: "Please enter a valid URL to upload a file.",
CONTENT__MISSING_RULE_TYPE_EXCEPTION: "You must choose a type for this rule.",
CONTENT__INVALID_CATEGORY_TYPE_AS_ENTRY_POINT: "The type can not be assigned while category is an entry point.",
SHOPWARE_INVALID_IP: "Please enter a valid IP address.",
INVALID_URL: "Please enter a valid url.",
INVALID_MAIL: "Please enter a valid email address.",
FRAMEWORK__RATE_LIMIT_EXCEEDED: "Too many requests. Please wait {seconds} seconds before trying again.",
DUPLICATED_URL: "This URL is already in use. Please choose another URL.",
"c1051bb4-d103-4f74-8988-acbcafc7fdc3": "This field must not be empty."
}
},
de: {
"mt-field-error": {
FRAMEWORK__MISSING_PRIVILEGE_ERROR: "Fehlende Berechtigungen",
FRAMEWORK__DELETE_RESTRICTED: "Löschen fehlgeschlagen",
INVALID_MEDIA_URL: "Bitte gib eine gültige URL ein, um eine Datei hochzuladen.",
CONTENT__MISSING_RULE_TYPE_EXCEPTION: "Du musst einen Typ für diese Regel auswählen.",
CONTENT__INVALID_CATEGORY_TYPE_AS_ENTRY_POINT: "Dieser Typ kann nicht gewählt werden, während die Kategorie als Einstiegspunkt festgelegt ist.",
SHOPWARE_INVALID_IP: "Bitte gib eine gültige IP-Adresse ein.",
INVALID_URL: "Bitte gib eine gültige URL ein.",
INVALID_MAIL: "Bitte gib eine gültige E-Mail-Adresse ein.",
FRAMEWORK__RATE_LIMIT_EXCEEDED: "Zu viele Anfragen. Bitte warten Sie {seconds} Sekunden, bevor Sie es erneut versuchen.",
DUPLICATED_URL: "Diese URL wird bereits genutzt. Bitte wähle eine andere Domain.",
"c1051bb4-d103-4f74-8988-acbcafc7fdc3": "Dieses Feld darf nicht leer sein"
}
}
}
});
return (_ctx, _cache) => {
return !!_ctx.error ? (vue.openBlock(), vue.createBlock(MtText, {
key: 0,
as: "span",
size: "xs",
color: "color-text-critical-default",
class: "mt-field__error"
}, {
default: vue.withCtx(() => [
vue.createVNode(mtIcon_vue_vue_type_style_index_0_lang._sfc_main, {
name: "solid-exclamation-circle",
size: "0.75rem",
"aria-hidden": "true"
}),
vue.createTextVNode(" " + vue.toDisplayString(errorMessage.value), 1)
]),
_: 1
})) : vue.createCommentVNode("", true);
};
}
});
const mtFieldError_vue_vue_type_style_index_0_scoped_b37505f7_lang = "";
const MtFieldError = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-b37505f7"]]);
module.exports = MtFieldError;
//# sourceMappingURL=MtFieldError.js.map