@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/).
96 lines (95 loc) • 4.2 kB
JavaScript
import '../mt-field-error.css';
import { defineComponent, computed, openBlock, createBlock, withCtx, createVNode, createTextVNode, toDisplayString, createCommentVNode } from "vue";
import { _ as _sfc_main$1 } from "../mt-icon.vue_vue_type_style_index_0_lang-2cc5f73e.mjs";
import MtText from "./MtText.js";
import { useI18n } from "vue-i18n";
import { _ as _export_sfc } from "../_plugin-vue_export-helper-cc2b3d55.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "mt-field-error",
props: {
error: {}
},
setup(__props) {
const props = __props;
const errorMessage = 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 } = 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 ? (openBlock(), createBlock(MtText, {
key: 0,
as: "span",
size: "xs",
color: "color-text-critical-default",
class: "mt-field__error"
}, {
default: withCtx(() => [
createVNode(_sfc_main$1, {
name: "solid-exclamation-circle",
size: "0.75rem",
"aria-hidden": "true"
}),
createTextVNode(" " + toDisplayString(errorMessage.value), 1)
]),
_: 1
})) : createCommentVNode("", true);
};
}
});
const mtFieldError_vue_vue_type_style_index_0_scoped_b37505f7_lang = "";
const MtFieldError = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b37505f7"]]);
export {
MtFieldError as default
};
//# sourceMappingURL=MtFieldError.js.map