@opengis/cms 0.0.57 → 0.0.59
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.
- package/README.md +1 -1
- package/dist/AddNewItemInTree-05PSSEFi.js +76 -0
- package/dist/ArticlesPage-BjYzvTWM.js +298 -0
- package/dist/CollectionsBreadcrumb-HePNJb-d.js +4 -0
- package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-BJh-tjam.js +53 -0
- package/dist/CollectionsPage-DHfPNql6.js +124 -0
- package/dist/{CreateForm-BMOBeP4G.js → CreateForm-5FvT45vH.js} +1 -1
- package/dist/Dashboard-CXkg_pk8.js +358 -0
- package/dist/EditCollectionPage-CqYHpEON.js +187 -0
- package/dist/{EmptyData-DaZt_nAm.js → EmptyData-DxPrSXhV.js} +1 -1
- package/dist/{MenuAddPage-Bf48Z-ah.js → MenuAddPage-QTnwCoGh.js} +40 -35
- package/dist/MenuBody-Bi0ONVZf.js +125 -0
- package/dist/MenuItemPage-B7Y9KFyb.js +1027 -0
- package/dist/MenuList-BLIpeqSd.js +172 -0
- package/dist/MenuPage-3W6jZ15H.js +107 -0
- package/dist/MenuWrapper-OrOv6sOb.js +12 -0
- package/dist/MonacoEditor-ByPT8pnv.js +4 -0
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-C8cip9Ci.js +84 -0
- package/dist/{UniversalTable.vue_vue_type_script_setup_true_lang-CJGTsd1V.js → UniversalTable-GBd_pStq.js} +81 -81
- package/dist/{UniversalTablePagination.vue_vue_type_script_setup_true_lang-GYZd_gkA.js → UniversalTablePagination-Dw2hc0nc.js} +47 -47
- package/dist/VsFormTags-CMjiu9sY.js +114 -0
- package/dist/VsPreview-DwETkOpb.js +63 -0
- package/dist/contentForm-Buku-lel.js +489 -0
- package/dist/getField-CpwVE28P.js +179 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +72 -71
- package/dist/style.css +1 -1
- package/dist/vs-builder-edit-D-q1o8tF.js +604 -0
- package/dist/vs-builder-monaco-Cw-f19gc.js +33 -0
- package/dist/vs-builder-preview-BH4VAM3a.js +44 -0
- package/dist/vs-form-custom-datatable-BDZo48w3.js +317 -0
- package/dist/vs-form-integer-BZ855R3g.js +61 -0
- package/dist/vs-form-media-select-NY27EaG1.js +837 -0
- package/dist/vs-form-reference-list-Dtv8fJJU.js +1536 -0
- package/dist/vs-form-reletion-link-BhzNQszm.js +34 -0
- package/dist/vs-form-tiptap-DDFQjRjY.js +4 -0
- package/dist/vs-form-tiptap.vue_vue_type_script_setup_true_lang-DGgsqXwg.js +11 -0
- package/dist/vs-richtext-md-C098v_6Q.js +4 -0
- package/dist/vs-richtext-md.vue_vue_type_script_setup_true_lang-Ct8uTV-J.js +14 -0
- package/locales/en.json +1 -0
- package/locales/uk.json +1 -0
- package/package.json +69 -68
- package/server/functions/utils/mock.reply.js +7 -7
- package/server/routes/cms/controllers/getPermissions.js +15 -15
- package/server/routes/cms/controllers/setPermissions.js +49 -49
- package/server/templates/select/core.user_mentioned.sql +1 -1
- package/dist/ArticlesPage-BcR1hbds.js +0 -286
- package/dist/BuilderPage-CK_osM89.js +0 -386
- package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-CnOe9ORD.js +0 -45
- package/dist/CollectionsPage-JfmrHNR_.js +0 -110
- package/dist/EditCollectionPage-Cw3GQYRe.js +0 -809
- package/dist/MenuItemPage-CXn5HC8j.js +0 -1366
- package/dist/MenuPage-tJZtK46W.js +0 -106
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-B1DrxmQX.js +0 -84
- package/dist/contentForm-B6gHgGkz.js +0 -586
- package/dist/getField-Y5WXnRR0.js +0 -2948
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { defineComponent as Pe, defineAsyncComponent as h, inject as le, ref as p, getCurrentInstance as Be, toRef as Ee, computed as m, watch as De, onMounted as Ie, openBlock as w, createElementBlock as $, createElementVNode as u, createVNode as C, unref as v, toDisplayString as j, createCommentVNode as S, createTextVNode as ae, Fragment as Ne, renderList as Me, normalizeClass as ne, createBlock as ie, withDirectives as q, vModelCheckbox as Re, vShow as re, nextTick as ce } from "vue";
|
|
2
|
+
import { useRouter as Ue, useRoute as Oe } from "vue-router";
|
|
3
|
+
import { ArrowLeft as Je, HelpCircle as He, Settings as Ke, Save as qe, Loader2 as Ge } from "lucide-vue-next";
|
|
4
|
+
import { useI18n as Qe } from "vue-i18n";
|
|
5
|
+
import { g as We } from "./getField-CpwVE28P.js";
|
|
6
|
+
import { inputs as x, VForm as ue } from "@opengis/form";
|
|
7
|
+
import { notify as F } from "@opengis/core";
|
|
8
|
+
const Xe = [
|
|
9
|
+
{
|
|
10
|
+
key: "title",
|
|
11
|
+
label: "cms.common.title",
|
|
12
|
+
localization: !0,
|
|
13
|
+
type: "text"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: "description",
|
|
17
|
+
label: "cms.common.description",
|
|
18
|
+
localization: !0,
|
|
19
|
+
type: "text"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: "keywords",
|
|
23
|
+
label: "cms.common.keywords",
|
|
24
|
+
localization: !0,
|
|
25
|
+
type: "text"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "meta",
|
|
29
|
+
label: "cms.common.meta",
|
|
30
|
+
type: "key-value",
|
|
31
|
+
ignore: ["title", "description", "keywords"]
|
|
32
|
+
}
|
|
33
|
+
], Ye = { class: "space-y-6 mx-auto relativ max-w-[90%]" }, Ze = { class: "" }, et = { class: "flex items-center justify-between" }, tt = { class: "flex items-center gap-4" }, st = { class: "text-2xl font-semibold text-gray-900 dark:text-white line-clamp-1" }, ot = ["href", "title"], lt = { class: "flex items-center space-x-3" }, at = ["title"], nt = { class: "w-full mt-6 flex items-center justify-between" }, it = { class: "flex items-center w-full h-10 max-w-md grid-cols-3 p-1 bg-white border border-gray-200 rounded-md text-muted-foreground" }, rt = ["onClick"], ct = { class: "flex items-center gap-4" }, ut = ["disabled"], dt = { class: "flex items-center gap-2" }, mt = {
|
|
34
|
+
for: "is_pin",
|
|
35
|
+
class: "text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer"
|
|
36
|
+
}, pt = { class: "relative" }, vt = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "w-3 h-3 text-white",
|
|
39
|
+
fill: "currentColor",
|
|
40
|
+
viewBox: "0 0 20 20"
|
|
41
|
+
}, ft = { class: "mx-auto bg-white rounded-md p-5" }, yt = { class: "mx-auto bg-white rounded-md p-5" }, gt = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "mx-auto bg-white rounded-md p-5"
|
|
44
|
+
}, bt = {
|
|
45
|
+
key: 1,
|
|
46
|
+
class: "mx-auto bg-white rounded-md p-5"
|
|
47
|
+
}, St = /* @__PURE__ */ Pe({
|
|
48
|
+
__name: "contentForm",
|
|
49
|
+
setup(ht) {
|
|
50
|
+
const de = h(
|
|
51
|
+
() => import("./vs-form-reference-list-Dtv8fJJU.js")
|
|
52
|
+
), me = h(
|
|
53
|
+
() => import("./vs-form-tiptap-DDFQjRjY.js")
|
|
54
|
+
), E = h(
|
|
55
|
+
() => import("./vs-form-media-select-NY27EaG1.js")
|
|
56
|
+
), pe = h(
|
|
57
|
+
() => import("./vs-richtext-md-C098v_6Q.js")
|
|
58
|
+
), ve = h(
|
|
59
|
+
() => import("./vs-form-integer-BZ855R3g.js")
|
|
60
|
+
), fe = h(
|
|
61
|
+
() => import("./vs-form-custom-datatable-BDZo48w3.js")
|
|
62
|
+
), ye = h(
|
|
63
|
+
() => import("./vs-form-reletion-link-BhzNQszm.js")
|
|
64
|
+
), ge = h(
|
|
65
|
+
() => import("./VsFormTags-CMjiu9sY.js")
|
|
66
|
+
), be = h(
|
|
67
|
+
() => import("./VsPreview-DwETkOpb.js")
|
|
68
|
+
), he = h(
|
|
69
|
+
() => import("./CollectionsBreadcrumb-HePNJb-d.js")
|
|
70
|
+
);
|
|
71
|
+
x["vs-input-custom-datatable"] = fe, x["vs-input-reference"] = de, x["vs-input-texteditor"] = me, x["vs-input-mediaselect"] = E, x["vs-input-file"] = E, x["vs-input-image"] = E, x["vs-input-richtext-md"] = pe, x["vs-input-integer"] = ve, x["vs-input-relation-link"] = ye;
|
|
72
|
+
const { t: c, locale: G } = Qe(), V = Ue(), d = Oe(), Q = le("cms.menu", null) || le("menu", p([])), _ = p([]), D = p({}), W = p({}), I = p({}), N = p(""), M = p(!0), R = Be(), U = R == null ? void 0 : R.appContext, we = (U == null ? void 0 : U.config.globalProperties) || {}, X = Ee(we, "$settings"), P = m(() => {
|
|
73
|
+
var e;
|
|
74
|
+
return ((e = X.value) == null ? void 0 : e.cms) || {};
|
|
75
|
+
}), ke = m(() => Array.isArray(P.value.locales) ? P.value.locales : []), O = m(
|
|
76
|
+
() => ke.value.filter(Boolean)
|
|
77
|
+
), Y = m(
|
|
78
|
+
() => P.value.locale || O.value[0] || "uk"
|
|
79
|
+
);
|
|
80
|
+
De(
|
|
81
|
+
X,
|
|
82
|
+
() => {
|
|
83
|
+
_.value.length && (_.value = _.value.map((e) => ({
|
|
84
|
+
...e
|
|
85
|
+
})));
|
|
86
|
+
},
|
|
87
|
+
{ deep: !0 }
|
|
88
|
+
);
|
|
89
|
+
const xe = (e) => {
|
|
90
|
+
const t = [], o = O.value.filter(
|
|
91
|
+
(a) => a !== Y.value
|
|
92
|
+
);
|
|
93
|
+
return Array.isArray(e) && e.forEach((a) => {
|
|
94
|
+
t.push(a), !(!a.localization || o.length === 0) && o.forEach((n) => {
|
|
95
|
+
t.push({
|
|
96
|
+
...a,
|
|
97
|
+
name: `${a.name}:${n}`,
|
|
98
|
+
label: `${a.label} (${n})`
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}), t;
|
|
102
|
+
}, Z = m(() => xe(_.value)), _e = m(
|
|
103
|
+
() => Array.isArray(_.value) && _.value.some(
|
|
104
|
+
(e) => e.localization === !0 && e.name !== "title"
|
|
105
|
+
)
|
|
106
|
+
), z = p(!1), $e = m(() => {
|
|
107
|
+
var e;
|
|
108
|
+
return (e = Z.value) == null ? void 0 : e.map(We);
|
|
109
|
+
}), Ce = m(() => {
|
|
110
|
+
G.value;
|
|
111
|
+
const e = O.value.filter(
|
|
112
|
+
(t) => t !== Y.value
|
|
113
|
+
);
|
|
114
|
+
return Xe.flatMap((t) => {
|
|
115
|
+
const o = {
|
|
116
|
+
...t,
|
|
117
|
+
label: c(t.label)
|
|
118
|
+
};
|
|
119
|
+
if (!t.localization || e.length === 0)
|
|
120
|
+
return [o];
|
|
121
|
+
const a = e.map((n) => ({
|
|
122
|
+
...t,
|
|
123
|
+
key: `${t.key}:${n}`,
|
|
124
|
+
label: `${c(t.label)} (${n})`,
|
|
125
|
+
localization: !1
|
|
126
|
+
}));
|
|
127
|
+
return [o, ...a];
|
|
128
|
+
});
|
|
129
|
+
}), g = p({}), i = p({
|
|
130
|
+
title: "",
|
|
131
|
+
status: "draft"
|
|
132
|
+
}), J = p(null), L = p(""), B = m(
|
|
133
|
+
() => {
|
|
134
|
+
var e;
|
|
135
|
+
return (((e = i.value) == null ? void 0 : e.type) || J.value) === "single";
|
|
136
|
+
}
|
|
137
|
+
), Te = m(() => {
|
|
138
|
+
const e = [
|
|
139
|
+
{ id: "content", name: c("cms.builder.content") },
|
|
140
|
+
{ id: "seo", name: c("cms.builder.seo") },
|
|
141
|
+
{ id: "tags", name: c("cms.builder.tags") }
|
|
142
|
+
];
|
|
143
|
+
return N.value && e.push({ id: "preview", name: c("cms.builder.preview") }), e;
|
|
144
|
+
}), A = p("content"), ee = m(() => {
|
|
145
|
+
var s, r, l, k, f, b, y, T, oe;
|
|
146
|
+
const e = ((s = d.params) == null ? void 0 : s.collection) || ((r = d.params) == null ? void 0 : r.id), t = (l = i.value) == null ? void 0 : l.content_type_id, o = t ? (f = (k = Q.value) == null ? void 0 : k.find((K) => K.id === t)) == null ? void 0 : f.title : null;
|
|
147
|
+
if (o)
|
|
148
|
+
return o;
|
|
149
|
+
if (L.value)
|
|
150
|
+
return L.value;
|
|
151
|
+
const a = (y = (b = Q.value) == null ? void 0 : b.find(
|
|
152
|
+
(K) => K.id === e
|
|
153
|
+
)) == null ? void 0 : y.title;
|
|
154
|
+
if (a)
|
|
155
|
+
return a;
|
|
156
|
+
const n = (T = d.params) == null ? void 0 : T.id;
|
|
157
|
+
return B.value && n && e === n && ((oe = i.value) != null && oe.title) ? i.value.title : e === "pages" ? c("cms.articles.title") : e;
|
|
158
|
+
}), Se = m(() => {
|
|
159
|
+
var t, o;
|
|
160
|
+
const e = B.value ? "cms.builder.editPage" : "cms.builder.editCollection";
|
|
161
|
+
return ((t = i.value) == null ? void 0 : t.title) || ((o = d.params) != null && o.id ? c(e) : c("cms.articles.createArticle"));
|
|
162
|
+
}), Ve = m(() => {
|
|
163
|
+
var s, r, l;
|
|
164
|
+
const e = ((s = d.params) == null ? void 0 : s.collection) || ((r = d.params) == null ? void 0 : r.id), t = (l = d.params) == null ? void 0 : l.id, o = Se.value, a = o === ee.value, n = [
|
|
165
|
+
{
|
|
166
|
+
label: ee.value,
|
|
167
|
+
route: `collections/${e}`
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
return t ? n.push({
|
|
171
|
+
label: a ? c("cms.collections.edit") : o,
|
|
172
|
+
route: `collections/${e}/${t}`
|
|
173
|
+
}) : n.push({
|
|
174
|
+
label: c("cms.articles.createArticle"),
|
|
175
|
+
route: `collections/${e}/create`
|
|
176
|
+
}), n;
|
|
177
|
+
}), Ae = (e) => {
|
|
178
|
+
e === "collections" ? V.push("/collections") : V.push(`/${e}`);
|
|
179
|
+
}, te = async (e, t) => {
|
|
180
|
+
var o, a;
|
|
181
|
+
try {
|
|
182
|
+
if (!t || !e)
|
|
183
|
+
return;
|
|
184
|
+
const n = await fetch(`/api/cms/${e}/${t}`);
|
|
185
|
+
if (!n.ok)
|
|
186
|
+
throw new Error("Failed to fetch article");
|
|
187
|
+
const s = await n.json();
|
|
188
|
+
if (_.value = (s == null ? void 0 : s.columns) || [], s != null && s.preview_path && (N.value = s == null ? void 0 : s.preview_path), J.value = (s == null ? void 0 : s.type) || null, s.rows) {
|
|
189
|
+
let r = s.rows;
|
|
190
|
+
Array.isArray(r) || (r = [r]), i.value = r[0];
|
|
191
|
+
const l = ((o = r[0]) == null ? void 0 : o.content_type_id) || e;
|
|
192
|
+
if (l) {
|
|
193
|
+
const k = await fetch(`/api/cms-type/${l}`);
|
|
194
|
+
if (k.ok) {
|
|
195
|
+
const f = await k.json();
|
|
196
|
+
L.value = (f == null ? void 0 : f.title) || (f == null ? void 0 : f.name) || L.value;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
await ce(), (a = r[0]) != null && a.meta ? g.value = { ...r[0].meta } : g.value = {
|
|
200
|
+
title: "",
|
|
201
|
+
description: "",
|
|
202
|
+
keywords: "",
|
|
203
|
+
meta: {}
|
|
204
|
+
};
|
|
205
|
+
} else
|
|
206
|
+
i.value = s, await ce(), s != null && s.meta ? (g.value = {
|
|
207
|
+
title: s.meta.title || "",
|
|
208
|
+
description: s.meta.description || "",
|
|
209
|
+
keywords: s.meta.keywords || "",
|
|
210
|
+
meta: { ...s.meta }
|
|
211
|
+
}, delete g.value.meta.title, delete g.value.meta.description, delete g.value.meta.keywords) : g.value = {
|
|
212
|
+
title: "",
|
|
213
|
+
description: "",
|
|
214
|
+
keywords: "",
|
|
215
|
+
meta: {}
|
|
216
|
+
};
|
|
217
|
+
} catch (n) {
|
|
218
|
+
console.error("Error fetching article:", n);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
Ie(async () => {
|
|
222
|
+
var n, s;
|
|
223
|
+
M.value = !0, L.value = "";
|
|
224
|
+
const e = (n = d.params) == null ? void 0 : n.collection, t = (s = d.params) == null ? void 0 : s.id, o = e || t, a = e && t ? t : void 0;
|
|
225
|
+
try {
|
|
226
|
+
if (!a) {
|
|
227
|
+
if (!o)
|
|
228
|
+
return;
|
|
229
|
+
const l = await (await fetch(`/api/cms/${o}/`)).json();
|
|
230
|
+
_.value = l.columns, J.value = (l == null ? void 0 : l.type) || null;
|
|
231
|
+
}
|
|
232
|
+
await te(o, a ?? "");
|
|
233
|
+
} finally {
|
|
234
|
+
M.value = !1;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const se = m({
|
|
238
|
+
get: () => {
|
|
239
|
+
var e;
|
|
240
|
+
return ((e = i.value) == null ? void 0 : e.is_pin) || !1;
|
|
241
|
+
},
|
|
242
|
+
set: (e) => {
|
|
243
|
+
i.value && (i.value.is_pin = e);
|
|
244
|
+
}
|
|
245
|
+
}), je = () => {
|
|
246
|
+
i.value && (i.value.is_pin = !i.value.is_pin);
|
|
247
|
+
}, H = m(() => {
|
|
248
|
+
var t;
|
|
249
|
+
const e = (t = i.value) == null ? void 0 : t.content_type_id;
|
|
250
|
+
return e ? `/collections/${e}/edit` : null;
|
|
251
|
+
}), ze = () => {
|
|
252
|
+
var o, a, n;
|
|
253
|
+
if (!H.value)
|
|
254
|
+
return;
|
|
255
|
+
const e = ((o = d.params) == null ? void 0 : o.collection) || ((a = d.params) == null ? void 0 : a.id), t = (n = d.params) == null ? void 0 : n.id;
|
|
256
|
+
if (e && t) {
|
|
257
|
+
V.push(`/collections/${e}/${t}/edit`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
V.push(H.value);
|
|
261
|
+
}, Le = async () => {
|
|
262
|
+
var o, a;
|
|
263
|
+
const e = (o = d.params) == null ? void 0 : o.collection, t = (a = d.params) == null ? void 0 : a.id;
|
|
264
|
+
z.value = !0;
|
|
265
|
+
try {
|
|
266
|
+
(await fetch(
|
|
267
|
+
`/api/cms-translate?id=${t}&collection=${e}&to=en&nocache=1`
|
|
268
|
+
)).ok ? (F({
|
|
269
|
+
title: c("cms.collections.translateContentSuccess"),
|
|
270
|
+
message: c("cms.collections.translateContentSuccess"),
|
|
271
|
+
type: "success"
|
|
272
|
+
}), await te(e, t)) : F({
|
|
273
|
+
title: c("cms.collections.translateContentError"),
|
|
274
|
+
message: c("cms.collections.translateContentError"),
|
|
275
|
+
type: "error"
|
|
276
|
+
});
|
|
277
|
+
} finally {
|
|
278
|
+
z.value = !1;
|
|
279
|
+
}
|
|
280
|
+
}, Fe = async (e) => {
|
|
281
|
+
var r, l, k, f;
|
|
282
|
+
const t = (r = d.params) == null ? void 0 : r.collection, o = (l = d.params) == null ? void 0 : l.id, a = await D.value.validate();
|
|
283
|
+
if (a) {
|
|
284
|
+
F({
|
|
285
|
+
title: c("cms.validation"),
|
|
286
|
+
message: JSON.stringify(a),
|
|
287
|
+
type: "warning"
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
(k = I.value) != null && k.restoreTagsBeforeSubmit && await I.value.restoreTagsBeforeSubmit();
|
|
292
|
+
const n = g.value || {}, s = {
|
|
293
|
+
...i.value,
|
|
294
|
+
meta: {
|
|
295
|
+
...n,
|
|
296
|
+
...n.meta || {}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
console.log("Payload before submit:", s);
|
|
300
|
+
try {
|
|
301
|
+
const b = await fetch(`/api/cms/${t}/${o || ""}`, {
|
|
302
|
+
method: o ? "PUT" : "POST",
|
|
303
|
+
headers: {
|
|
304
|
+
"Content-Type": "application/json"
|
|
305
|
+
},
|
|
306
|
+
body: JSON.stringify(s)
|
|
307
|
+
});
|
|
308
|
+
if (!b.ok) {
|
|
309
|
+
let y;
|
|
310
|
+
try {
|
|
311
|
+
const T = await b.json();
|
|
312
|
+
y = JSON.stringify(T, null, 2);
|
|
313
|
+
} catch {
|
|
314
|
+
y = await b.text();
|
|
315
|
+
}
|
|
316
|
+
throw new Error(`HTTP ${b.status}: ${y}`);
|
|
317
|
+
}
|
|
318
|
+
if (!o)
|
|
319
|
+
try {
|
|
320
|
+
const y = await b.json(), T = y.id || ((f = y.data) == null ? void 0 : f.id);
|
|
321
|
+
T && d.name === "createArticle" && await V.push(`/collections/${t}/${T}`);
|
|
322
|
+
} catch (y) {
|
|
323
|
+
console.warn("Could not parse response to get ID:", y);
|
|
324
|
+
}
|
|
325
|
+
F({
|
|
326
|
+
title: c("cms.common.success"),
|
|
327
|
+
message: c("cms.common.successMessage"),
|
|
328
|
+
type: "success"
|
|
329
|
+
});
|
|
330
|
+
} catch (b) {
|
|
331
|
+
console.error("Submit error:", b), F({
|
|
332
|
+
title: c("cms.common.error"),
|
|
333
|
+
message: "Помилка збереження",
|
|
334
|
+
type: "error"
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
return (e, t) => {
|
|
339
|
+
var o, a, n, s, r;
|
|
340
|
+
return w(), $("div", Ye, [
|
|
341
|
+
u("div", Ze, [
|
|
342
|
+
C(v(he), {
|
|
343
|
+
items: Ve.value,
|
|
344
|
+
loading: M.value,
|
|
345
|
+
onNavigate: Ae
|
|
346
|
+
}, null, 8, ["items", "loading"]),
|
|
347
|
+
u("div", et, [
|
|
348
|
+
u("div", tt, [
|
|
349
|
+
u("button", {
|
|
350
|
+
onClick: t[0] || (t[0] = (l) => v(V).back()),
|
|
351
|
+
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"
|
|
352
|
+
}, [
|
|
353
|
+
C(v(Je), { class: "w-5 h-5" })
|
|
354
|
+
]),
|
|
355
|
+
u("h1", st, j(e.$t(
|
|
356
|
+
B.value ? "cms.builder.editPage" : "cms.builder.editCollection"
|
|
357
|
+
)) + ' "' + j(i.value.title) + '" ', 1),
|
|
358
|
+
u("a", {
|
|
359
|
+
href: `https://cms.opengis.info/${v(G)}/guides/content/`,
|
|
360
|
+
target: "_blank",
|
|
361
|
+
title: e.$t("cms.guide.content")
|
|
362
|
+
}, [
|
|
363
|
+
C(v(He), { class: "w-5 h-5" })
|
|
364
|
+
], 8, ot)
|
|
365
|
+
]),
|
|
366
|
+
u("div", lt, [
|
|
367
|
+
H.value && B.value ? (w(), $("button", {
|
|
368
|
+
key: 0,
|
|
369
|
+
onClick: ze,
|
|
370
|
+
type: "button",
|
|
371
|
+
title: e.$t("cms.builder.editContentType"),
|
|
372
|
+
class: "inline-flex items-center justify-center rounded-md h-9 w-9 border border-gray-200 bg-white text-gray-700 shadow-sm transition-all duration-200 transform hover:text-gray-900 hover:shadow-md focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
373
|
+
"aria-label": "$t('cms.builder.editContentType')"
|
|
374
|
+
}, [
|
|
375
|
+
C(v(Ke), { class: "w-4 h-4" })
|
|
376
|
+
], 8, at)) : S("", !0),
|
|
377
|
+
u("button", {
|
|
378
|
+
onClick: Fe,
|
|
379
|
+
type: "submit",
|
|
380
|
+
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"
|
|
381
|
+
}, [
|
|
382
|
+
C(v(qe), { class: "w-4 h-4 mr-2" }),
|
|
383
|
+
ae(" " + j(e.$t("cms.builder.save")), 1)
|
|
384
|
+
])
|
|
385
|
+
])
|
|
386
|
+
]),
|
|
387
|
+
u("div", nt, [
|
|
388
|
+
u("div", it, [
|
|
389
|
+
(w(!0), $(Ne, null, Me(Te.value, (l) => (w(), $("button", {
|
|
390
|
+
key: l.id,
|
|
391
|
+
onClick: (k) => {
|
|
392
|
+
A.value = l.id, console.log("cmsSettings:", P.value.value);
|
|
393
|
+
},
|
|
394
|
+
class: ne([
|
|
395
|
+
"inline-flex flex-1 items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm data-[state=active]:bg-blue-50 data-[state=active]:text-blue-700 data-[state=active]:border-blue-200",
|
|
396
|
+
l.id === A.value ? "bg-blue-50 text-blue-700 border-blue-200" : ""
|
|
397
|
+
])
|
|
398
|
+
}, j(l.name), 11, rt))), 128))
|
|
399
|
+
]),
|
|
400
|
+
u("div", ct, [
|
|
401
|
+
(o = v(d).params) != null && o.id && _e.value ? (w(), $("button", {
|
|
402
|
+
key: 0,
|
|
403
|
+
type: "button",
|
|
404
|
+
class: "inline-flex items-center justify-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer bg-white border border-gray-200 rounded-md text-muted-foreground px-4 py-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
405
|
+
disabled: z.value,
|
|
406
|
+
onClick: Le
|
|
407
|
+
}, [
|
|
408
|
+
z.value ? (w(), ie(v(Ge), {
|
|
409
|
+
key: 0,
|
|
410
|
+
class: "w-4 h-4 animate-spin shrink-0",
|
|
411
|
+
"aria-hidden": "true"
|
|
412
|
+
})) : S("", !0),
|
|
413
|
+
ae(" " + j(z.value ? e.$t("cms.collections.translating") : e.$t("cms.collections.enLocalization")), 1)
|
|
414
|
+
], 8, ut)) : S("", !0),
|
|
415
|
+
u("div", dt, [
|
|
416
|
+
u("label", mt, j(e.$t("cms.collections.pinPublication")), 1),
|
|
417
|
+
u("div", pt, [
|
|
418
|
+
q(u("input", {
|
|
419
|
+
type: "checkbox",
|
|
420
|
+
id: "is_pin",
|
|
421
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => se.value = l),
|
|
422
|
+
class: "sr-only"
|
|
423
|
+
}, null, 512), [
|
|
424
|
+
[Re, se.value]
|
|
425
|
+
]),
|
|
426
|
+
u("div", {
|
|
427
|
+
class: ne([
|
|
428
|
+
"w-5 h-5 border-2 rounded transition-all duration-200 cursor-pointer flex items-center justify-center",
|
|
429
|
+
(a = i.value) != null && a.is_pin ? "bg-sky-600 border-sky-600" : "bg-white border-gray-300 hover:border-sky-400 dark:bg-gray-700 dark:border-gray-600 dark:hover:border-sky-400"
|
|
430
|
+
]),
|
|
431
|
+
onClick: je
|
|
432
|
+
}, [
|
|
433
|
+
(n = i.value) != null && n.is_pin ? (w(), $("svg", vt, [...t[7] || (t[7] = [
|
|
434
|
+
u("path", {
|
|
435
|
+
"fill-rule": "evenodd",
|
|
436
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
437
|
+
"clip-rule": "evenodd"
|
|
438
|
+
}, null, -1)
|
|
439
|
+
])])) : S("", !0)
|
|
440
|
+
], 2)
|
|
441
|
+
])
|
|
442
|
+
])
|
|
443
|
+
])
|
|
444
|
+
])
|
|
445
|
+
]),
|
|
446
|
+
q(u("div", ft, [
|
|
447
|
+
(s = Z.value) != null && s.length ? (w(), ie(v(ue), {
|
|
448
|
+
key: 0,
|
|
449
|
+
modelValue: i.value,
|
|
450
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => i.value = l),
|
|
451
|
+
schema: $e.value,
|
|
452
|
+
form: D.value,
|
|
453
|
+
"onUpdate:form": t[3] || (t[3] = (l) => D.value = l)
|
|
454
|
+
}, null, 8, ["modelValue", "schema", "form"])) : S("", !0)
|
|
455
|
+
], 512), [
|
|
456
|
+
[re, A.value === "content"]
|
|
457
|
+
]),
|
|
458
|
+
q(u("div", yt, [
|
|
459
|
+
C(v(ue), {
|
|
460
|
+
schema: Ce.value,
|
|
461
|
+
values: g.value,
|
|
462
|
+
"onUpdate:values": t[4] || (t[4] = (l) => g.value = l),
|
|
463
|
+
form: W.value,
|
|
464
|
+
"onUpdate:form": t[5] || (t[5] = (l) => W.value = l)
|
|
465
|
+
}, null, 8, ["schema", "values", "form"])
|
|
466
|
+
], 512), [
|
|
467
|
+
[re, A.value === "seo"]
|
|
468
|
+
]),
|
|
469
|
+
A.value === "tags" ? (w(), $("div", gt, [
|
|
470
|
+
C(v(ge), {
|
|
471
|
+
ref_key: "tagsForm",
|
|
472
|
+
ref: I,
|
|
473
|
+
modelValue: i.value,
|
|
474
|
+
"onUpdate:modelValue": t[6] || (t[6] = (l) => i.value = l)
|
|
475
|
+
}, null, 8, ["modelValue"])
|
|
476
|
+
])) : S("", !0),
|
|
477
|
+
A.value === "preview" ? (w(), $("div", bt, [
|
|
478
|
+
C(v(be), {
|
|
479
|
+
slug: (r = i.value) == null ? void 0 : r.slug,
|
|
480
|
+
preview_path: N.value
|
|
481
|
+
}, null, 8, ["slug", "preview_path"])
|
|
482
|
+
])) : S("", !0)
|
|
483
|
+
]);
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
export {
|
|
488
|
+
St as default
|
|
489
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
const y = (t) => {
|
|
2
|
+
var p, r;
|
|
3
|
+
const e = (p = t == null ? void 0 : t.type) == null ? void 0 : p.toLowerCase(), a = t != null && t.required ? ["required"] : null;
|
|
4
|
+
return e === "array" ? {
|
|
5
|
+
key: t.name,
|
|
6
|
+
label: t.label || t.title,
|
|
7
|
+
type: "multi-text",
|
|
8
|
+
help: t == null ? void 0 : t.help,
|
|
9
|
+
colModel: {
|
|
10
|
+
type: (t == null ? void 0 : t.subtype) || "text",
|
|
11
|
+
placeholder: t == null ? void 0 : t.placeholder
|
|
12
|
+
},
|
|
13
|
+
validators: a
|
|
14
|
+
} : e === "boolean" ? {
|
|
15
|
+
key: t.name,
|
|
16
|
+
label: t.label || t.title,
|
|
17
|
+
type: "Switcher",
|
|
18
|
+
help: t == null ? void 0 : t.help,
|
|
19
|
+
validators: a
|
|
20
|
+
} : e === "tags" ? {
|
|
21
|
+
key: t.name,
|
|
22
|
+
label: t.label || t.title,
|
|
23
|
+
type: "tags",
|
|
24
|
+
help: t == null ? void 0 : t.help,
|
|
25
|
+
validators: a
|
|
26
|
+
} : e === "radio" ? {
|
|
27
|
+
key: t.name,
|
|
28
|
+
label: t.label || t.title,
|
|
29
|
+
type: "radio",
|
|
30
|
+
help: t == null ? void 0 : t.help,
|
|
31
|
+
options: t.options || [],
|
|
32
|
+
validators: a
|
|
33
|
+
} : e === "date" ? {
|
|
34
|
+
key: t.name,
|
|
35
|
+
label: t.label || t.title,
|
|
36
|
+
type: "Date",
|
|
37
|
+
time: !1,
|
|
38
|
+
help: t == null ? void 0 : t.help,
|
|
39
|
+
validators: a
|
|
40
|
+
} : e === "datetime" ? {
|
|
41
|
+
key: t.name,
|
|
42
|
+
label: t.label || t.title,
|
|
43
|
+
type: "Date",
|
|
44
|
+
help: t == null ? void 0 : t.help,
|
|
45
|
+
mode: "datetime",
|
|
46
|
+
time: !0,
|
|
47
|
+
validators: a
|
|
48
|
+
} : e === "number" ? {
|
|
49
|
+
key: t.name,
|
|
50
|
+
label: t.label || t.title,
|
|
51
|
+
help: t == null ? void 0 : t.help,
|
|
52
|
+
type: "Number",
|
|
53
|
+
validators: a
|
|
54
|
+
} : e === "integer" ? {
|
|
55
|
+
key: t.name,
|
|
56
|
+
label: t.label || t.title,
|
|
57
|
+
type: "Integer",
|
|
58
|
+
help: t == null ? void 0 : t.help,
|
|
59
|
+
validators: a
|
|
60
|
+
} : e === "text" ? {
|
|
61
|
+
key: t.name,
|
|
62
|
+
label: t.label || t.title,
|
|
63
|
+
type: "Text",
|
|
64
|
+
help: t == null ? void 0 : t.help,
|
|
65
|
+
validators: a
|
|
66
|
+
} : e === "file" ? {
|
|
67
|
+
key: t.name,
|
|
68
|
+
label: t.label || t.title,
|
|
69
|
+
type: "File",
|
|
70
|
+
multiple: t.multi || t.multiple,
|
|
71
|
+
help: t == null ? void 0 : t.help,
|
|
72
|
+
validators: a,
|
|
73
|
+
api: "/api/cms-media/upload?subdir=",
|
|
74
|
+
dir: "uploads/" + (/* @__PURE__ */ new Date()).toLocaleDateString("en-US").replace(/\//g, "-")
|
|
75
|
+
} : e === "filelist" ? {
|
|
76
|
+
key: t.name,
|
|
77
|
+
label: t.label || t.title,
|
|
78
|
+
type: "file",
|
|
79
|
+
multiple: !0,
|
|
80
|
+
help: t == null ? void 0 : t.help,
|
|
81
|
+
validators: a
|
|
82
|
+
} : e === "slug" ? {
|
|
83
|
+
key: t.name,
|
|
84
|
+
label: t.label || t.title,
|
|
85
|
+
type: "Slug",
|
|
86
|
+
parent: t.parent || "",
|
|
87
|
+
help: t == null ? void 0 : t.help,
|
|
88
|
+
validators: a
|
|
89
|
+
} : e === "image" ? {
|
|
90
|
+
key: t.name,
|
|
91
|
+
label: t.label || t.title,
|
|
92
|
+
type: "File",
|
|
93
|
+
multi: t.multiple,
|
|
94
|
+
help: t == null ? void 0 : t.help,
|
|
95
|
+
validators: a,
|
|
96
|
+
api: "/api/cms-media/upload?subdir=",
|
|
97
|
+
dir: "uploads/" + (/* @__PURE__ */ new Date()).toLocaleDateString("en-US").replace(/\//g, "-")
|
|
98
|
+
} : e === "select" ? t.options ? {
|
|
99
|
+
key: t.name,
|
|
100
|
+
label: t.label || t.title,
|
|
101
|
+
type: "select",
|
|
102
|
+
options: t.options || [],
|
|
103
|
+
help: t == null ? void 0 : t.help,
|
|
104
|
+
validators: a
|
|
105
|
+
} : {
|
|
106
|
+
key: t.name,
|
|
107
|
+
label: t.label || t.title,
|
|
108
|
+
type: "select",
|
|
109
|
+
data: t.data || [],
|
|
110
|
+
help: t == null ? void 0 : t.help,
|
|
111
|
+
validators: a
|
|
112
|
+
} : e === "multiselect" ? {
|
|
113
|
+
key: t.name,
|
|
114
|
+
label: t.label || t.title,
|
|
115
|
+
type: "select",
|
|
116
|
+
data: t.data || [],
|
|
117
|
+
parent: t.parent || "",
|
|
118
|
+
options: t.options || [],
|
|
119
|
+
help: t == null ? void 0 : t.help,
|
|
120
|
+
validators: a,
|
|
121
|
+
multiple: !0
|
|
122
|
+
} : e === "richtext" ? {
|
|
123
|
+
key: t.name,
|
|
124
|
+
label: t.label || t.title,
|
|
125
|
+
type: "Texteditor",
|
|
126
|
+
help: t == null ? void 0 : t.help,
|
|
127
|
+
validators: a
|
|
128
|
+
} : e === "datalist" ? {
|
|
129
|
+
key: t.name,
|
|
130
|
+
label: t.label || t.title,
|
|
131
|
+
type: "Custom-Datatable",
|
|
132
|
+
colModel: ((r = t.colModel) == null ? void 0 : r.map((n) => y(n))) || [],
|
|
133
|
+
help: t == null ? void 0 : t.help,
|
|
134
|
+
validators: a
|
|
135
|
+
} : e === "reference" ? {
|
|
136
|
+
key: t.name,
|
|
137
|
+
label: t.label || t.title,
|
|
138
|
+
type: "reference",
|
|
139
|
+
reference_type: t.reference_type,
|
|
140
|
+
help: t == null ? void 0 : t.help,
|
|
141
|
+
validators: a
|
|
142
|
+
} : e === "reference-list" ? {
|
|
143
|
+
key: t.name,
|
|
144
|
+
label: t.label || t.title,
|
|
145
|
+
type: "reference",
|
|
146
|
+
reference_type: t.reference_type,
|
|
147
|
+
help: t == null ? void 0 : t.help,
|
|
148
|
+
validators: a
|
|
149
|
+
} : e === "relation" ? {
|
|
150
|
+
key: t.name,
|
|
151
|
+
label: t.label || t.title,
|
|
152
|
+
type: "relation-link",
|
|
153
|
+
help: t == null ? void 0 : t.help,
|
|
154
|
+
relation: t.relation,
|
|
155
|
+
validators: a
|
|
156
|
+
} : e === "markdown" ? {
|
|
157
|
+
key: t.name,
|
|
158
|
+
label: t.label || t.title,
|
|
159
|
+
type: "richtext-md",
|
|
160
|
+
help: t == null ? void 0 : t.help,
|
|
161
|
+
validators: a
|
|
162
|
+
} : e === "mediaselect" ? {
|
|
163
|
+
key: t.name,
|
|
164
|
+
label: t.label || t.title,
|
|
165
|
+
type: "mediaselect",
|
|
166
|
+
help: t == null ? void 0 : t.help,
|
|
167
|
+
validators: a
|
|
168
|
+
} : {
|
|
169
|
+
key: t.name,
|
|
170
|
+
label: t.label || t.title,
|
|
171
|
+
placeholder: t.placeholder,
|
|
172
|
+
help: t == null ? void 0 : t.help,
|
|
173
|
+
type: "Text",
|
|
174
|
+
validators: a
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
y as g
|
|
179
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CmsComponent = any;
|
|
2
|
+
/** @type {CmsComponent} */
|
|
3
|
+
export const Content: CmsComponent;
|
|
4
|
+
export const Menu: any;
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('vue').DefineComponent<Record<string, unknown>, Record<string, unknown>, any>} CmsComponent
|
|
7
|
+
*/
|
|
8
|
+
export const Dashboard: any;
|