@opengis/cms 0.0.35 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+ import { defineComponent as y, ref as m, openBlock as x, createElementBlock as b, createElementVNode as t, unref as r, createVNode as l, toDisplayString as f, createTextVNode as w } from "vue";
2
+ import { useRouter as k, useRoute as _ } from "vue-router";
3
+ import { u as V, A as q, S, l as C, y as c, Q as M, e as N } from "./index-7TVhDCPx.js";
4
+ const $ = { class: "space-y-6 max-w-7xl mx-auto" }, j = { class: "flex items-center justify-between" }, A = { class: "flex items-center gap-4" }, E = { class: "text-2xl font-semibold text-gray-900 dark:text-white" }, T = { class: "flex items-center space-x-3" }, U = { class: "max-w-[1000px]" }, R = /* @__PURE__ */ y({
5
+ __name: "MenuAddPage",
6
+ setup(B) {
7
+ M["vs-input-monaco-editor"] = N;
8
+ const { t: e } = V(), u = k(), g = _(), h = m([
9
+ {
10
+ key: "name",
11
+ title: e("cms.menu.form.name"),
12
+ type: "text",
13
+ placeholder: e("cms.menu.form.name"),
14
+ required: !0,
15
+ validators: ["required"]
16
+ },
17
+ {
18
+ key: "description",
19
+ title: e("cms.menu.form.description"),
20
+ type: "text",
21
+ placeholder: e("cms.menu.form.description"),
22
+ required: !0,
23
+ validators: ["required"]
24
+ },
25
+ {
26
+ key: "locale",
27
+ title: e("cms.menu.form.language"),
28
+ type: "select",
29
+ placeholder: e("cms.menu.form.language"),
30
+ options: [
31
+ { text: "Ukrainian", id: "uk" },
32
+ { text: "English", id: "en" }
33
+ ],
34
+ required: !0,
35
+ validators: ["required"]
36
+ },
37
+ {
38
+ key: "content",
39
+ title: e("cms.menu.form.content"),
40
+ type: "monaco-editor",
41
+ height: "500px",
42
+ language: "yaml",
43
+ theme: "vs-light"
44
+ }
45
+ ]), a = m({}), i = m({}), v = async () => {
46
+ try {
47
+ if (await i.value.validate()) {
48
+ c({
49
+ type: "warning",
50
+ title: e("cms.common.actions.warning"),
51
+ message: e("cms.menu.createMenuFailed")
52
+ });
53
+ return;
54
+ }
55
+ await fetch("/api/cms-menu", {
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/json"
59
+ },
60
+ body: JSON.stringify(a.value)
61
+ }), c({
62
+ title: e("cms.common.success"),
63
+ type: "success",
64
+ message: e("cms.common.successMessage")
65
+ }), a.value = {}, u.push("/menu");
66
+ } catch (o) {
67
+ console.log(o), c({
68
+ title: e("cms.common.error"),
69
+ type: "error",
70
+ message: e("cms.common.errorMessage")
71
+ });
72
+ }
73
+ };
74
+ return (o, s) => {
75
+ var d, p;
76
+ return x(), b("div", $, [
77
+ t("div", j, [
78
+ t("div", A, [
79
+ t("button", {
80
+ onClick: s[0] || (s[0] = (n) => r(u).back()),
81
+ class: "p-2 text-gray-500 rounded-full hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700"
82
+ }, [
83
+ l(r(q), { class: "w-5 h-5" })
84
+ ]),
85
+ t("h1", E, f(o.$t((p = (d = r(g)) == null ? void 0 : d.meta) == null ? void 0 : p.title)), 1)
86
+ ]),
87
+ t("div", T, [
88
+ t("button", {
89
+ onClick: v,
90
+ class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium h-9 px-4 py-2 bg-blue-600 text-white shadow-md transition-all duration-200 transform hover:bg-blue-700 hover:shadow-lg hover:scale-105 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
91
+ }, [
92
+ l(r(S), { class: "w-4 h-4 mr-2" }),
93
+ w(" " + f(o.$t("cms.common.actions.save")), 1)
94
+ ])
95
+ ])
96
+ ]),
97
+ t("div", U, [
98
+ l(r(C), {
99
+ schema: h.value,
100
+ modelValue: a.value,
101
+ "onUpdate:modelValue": s[1] || (s[1] = (n) => a.value = n),
102
+ form: i.value,
103
+ "onUpdate:form": s[2] || (s[2] = (n) => i.value = n)
104
+ }, null, 8, ["schema", "modelValue", "form"])
105
+ ])
106
+ ]);
107
+ };
108
+ }
109
+ });
110
+ export {
111
+ R as default
112
+ };