@opengis/cms 0.0.50 → 0.0.52
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/dist/{ArticlesPage-Cuit_90w.js → ArticlesPage-Cddv2qte.js} +5 -5
- package/dist/{BuilderPage-B79YHrmr.js → BuilderPage-BgcBJcw7.js} +139 -139
- package/dist/{CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-B6irHMzL.js → CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-C-k8QGA-.js} +19 -19
- package/dist/{CollectionsPage-JfmrHNR_.js → CollectionsPage-d5MLIIAG.js} +3 -3
- package/dist/{CreateForm-BMOBeP4G.js → CreateForm-B0srHu5e.js} +2 -2
- package/dist/{EditCollectionPage-B4p_iA6h.js → EditCollectionPage-NUVatLkY.js} +65 -59
- package/dist/{EmptyData-DaZt_nAm.js → EmptyData-BSW20VKP.js} +5 -5
- package/dist/{MenuAddPage-CmU4kAUM.js → MenuAddPage-Cn3JN04F.js} +3 -3
- package/dist/{MenuItemPage-UV8JlJvT.js → MenuItemPage-B0Th9EOe.js} +60 -60
- package/dist/{MenuPage-c4TPJgIN.js → MenuPage-DQpD3IXx.js} +4 -4
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-CTKNG0qR.js +84 -0
- package/dist/{UniversalTable.vue_vue_type_script_setup_true_lang-DR4PQwqR.js → UniversalTable.vue_vue_type_script_setup_true_lang-DW6O-xoY.js} +78 -78
- package/dist/{UniversalTablePagination.vue_vue_type_script_setup_true_lang-C8P9DCeX.js → UniversalTablePagination.vue_vue_type_script_setup_true_lang-DBIPBmpm.js} +46 -46
- package/dist/contentForm-C4Jp-FbQ.js +586 -0
- package/dist/{getField-C7EZs-YQ.js → getField-CKcz_b0t.js} +960 -933
- package/dist/index.js +10 -10
- package/dist/style.css +1 -1
- package/dist/{vuedraggable-CoAPPFYd.js → vuedraggable-mqqAYsch.js} +107 -107
- package/locales/en.json +6 -1
- package/locales/uk.json +4 -1
- package/package.json +68 -68
- package/server/functions/getContent.js +6 -15
- package/server/functions/getSearchData.js +3 -13
- package/server/functions/utils/mock.reply.js +56 -0
- package/server/routes/cms/controllers/listMedia.js +30 -3
- package/server/routes/cms/controllers/searchContent.js +12 -5
- package/server/routes/cms/utils/additionalData.js +1 -1
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-C8cip9Ci.js +0 -84
- package/dist/contentForm-S5mXr5B7.js +0 -553
|
@@ -1,553 +0,0 @@
|
|
|
1
|
-
import { defineAsyncComponent as be, useModel as we, ref as y, provide as _e, onMounted as Z, nextTick as J, watch as I, computed as f, openBlock as b, createBlock as le, unref as $, createCommentVNode as B, createElementBlock as _, createElementVNode as v, createTextVNode as re, createVNode as C, defineComponent as ke, inject as xe, getCurrentInstance as $e, toRef as Se, toDisplayString as L, Fragment as Te, renderList as Ae, normalizeClass as se, withDirectives as X, vModelCheckbox as Ve, vShow as ae } from "vue";
|
|
2
|
-
import { useRouter as Ce, useRoute as je } from "vue-router";
|
|
3
|
-
import { ExternalLink as Fe, ArrowLeft as ze, HelpCircle as Ne, Settings as Pe, Save as Ee } from "lucide-vue-next";
|
|
4
|
-
import { _ as Ue, a as Be, V as Oe, b as Y, c as De, d as Le, e as Je, g as Me } from "./getField-C7EZs-YQ.js";
|
|
5
|
-
import { useI18n as ie } from "vue-i18n";
|
|
6
|
-
import { inputs as V, VForm as oe } from "@opengis/form";
|
|
7
|
-
import { notify as q } from "@opengis/core";
|
|
8
|
-
import { _ as Re } from "./CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-B6irHMzL.js";
|
|
9
|
-
const He = [
|
|
10
|
-
{
|
|
11
|
-
key: "title",
|
|
12
|
-
label: "cms.common.title",
|
|
13
|
-
localization: !0,
|
|
14
|
-
type: "text"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
key: "description",
|
|
18
|
-
label: "cms.common.description",
|
|
19
|
-
localization: !0,
|
|
20
|
-
type: "text"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: "keywords",
|
|
24
|
-
label: "cms.common.keywords",
|
|
25
|
-
localization: !0,
|
|
26
|
-
type: "text"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
key: "meta",
|
|
30
|
-
label: "cms.common.meta",
|
|
31
|
-
type: "key-value",
|
|
32
|
-
ignore: ["title", "description", "keywords"]
|
|
33
|
-
}
|
|
34
|
-
], Ke = {
|
|
35
|
-
__name: "VsFormTags",
|
|
36
|
-
props: {
|
|
37
|
-
modelValue: { default: () => [] },
|
|
38
|
-
modelModifiers: {}
|
|
39
|
-
},
|
|
40
|
-
emits: ["update:modelValue"],
|
|
41
|
-
setup(S, { expose: n }) {
|
|
42
|
-
const j = be(() => import("@opengis/form")), { t: w } = ie(), a = we(S, "modelValue"), g = y({}), u = y(!1);
|
|
43
|
-
_e("metaParentValue", a);
|
|
44
|
-
const p = (s) => Array.isArray(s) ? s.map((r) => typeof r == "object" && r !== null && r.id ? r.id : r) : [], F = async (s) => {
|
|
45
|
-
if (!Array.isArray(s) || s.length === 0)
|
|
46
|
-
return [];
|
|
47
|
-
try {
|
|
48
|
-
const k = await (await fetch("/api/tags")).json(), E = (k == null ? void 0 : k.rows) || [];
|
|
49
|
-
return s.map((R) => {
|
|
50
|
-
const z = E.find((H) => H.tag_id === R);
|
|
51
|
-
return z ? { id: z.tag_id, text: z.value, color: z.color } : { id: R, text: "", color: "#ababab" };
|
|
52
|
-
});
|
|
53
|
-
} catch (r) {
|
|
54
|
-
return console.error("Error fetching tags:", r), s.map((k) => ({ id: k, text: "", color: "#ababab" }));
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
Z(async () => {
|
|
58
|
-
await J(), await J(), setTimeout(() => {
|
|
59
|
-
var s;
|
|
60
|
-
if (Array.isArray((s = a.value) == null ? void 0 : s.tag_list)) {
|
|
61
|
-
const r = p(a.value.tag_list);
|
|
62
|
-
JSON.stringify(r) !== JSON.stringify(a.value.tag_list) && (a.value.tag_list = r);
|
|
63
|
-
}
|
|
64
|
-
}, 100);
|
|
65
|
-
}), I(
|
|
66
|
-
() => a.value.tag_list,
|
|
67
|
-
(s) => {
|
|
68
|
-
if (Array.isArray(s) && !u.value) {
|
|
69
|
-
const r = p(s);
|
|
70
|
-
JSON.stringify(r) !== JSON.stringify(s) && (a.value.tag_list = r);
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{ deep: !0 }
|
|
74
|
-
), I(
|
|
75
|
-
() => a.value,
|
|
76
|
-
(s) => {
|
|
77
|
-
if (s && Array.isArray(s.tag_list) && !u.value) {
|
|
78
|
-
const r = p(s.tag_list);
|
|
79
|
-
JSON.stringify(r) !== JSON.stringify(s.tag_list) && (s.tag_list = r);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{ deep: !0, immediate: !0 }
|
|
83
|
-
), I(
|
|
84
|
-
() => {
|
|
85
|
-
var s;
|
|
86
|
-
return (s = a.value) == null ? void 0 : s.tag_list;
|
|
87
|
-
},
|
|
88
|
-
(s) => {
|
|
89
|
-
Array.isArray(s) && g.value && J(() => {
|
|
90
|
-
g.value && g.value.setValue && g.value.setValue("tag_list", s);
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
{ deep: !0 }
|
|
94
|
-
);
|
|
95
|
-
const O = async (s) => {
|
|
96
|
-
if (s.tag_list && (s.tag_list = p(s.tag_list), a.value.tag_list = s.tag_list), await g.value.validate()) {
|
|
97
|
-
q({
|
|
98
|
-
type: "warning",
|
|
99
|
-
title: w("cms.common.actions.warning"),
|
|
100
|
-
message: w("cms.builder.editFieldFailed")
|
|
101
|
-
});
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
n({
|
|
106
|
-
restoreTagsBeforeSubmit: async () => {
|
|
107
|
-
var s;
|
|
108
|
-
if (u.value = !0, Array.isArray((s = a.value) == null ? void 0 : s.tag_list)) {
|
|
109
|
-
const r = await F(a.value.tag_list);
|
|
110
|
-
a.value.tag_list = r;
|
|
111
|
-
}
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
u.value = !1;
|
|
114
|
-
}, 2e3);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
const D = f(() => {
|
|
118
|
-
var s;
|
|
119
|
-
return [
|
|
120
|
-
{
|
|
121
|
-
key: "tag_list",
|
|
122
|
-
type: "select",
|
|
123
|
-
multiple: !0,
|
|
124
|
-
searchable: !1,
|
|
125
|
-
placeholder: w("cms.builder.tags"),
|
|
126
|
-
data: "tag_id",
|
|
127
|
-
value: ((s = a.value) == null ? void 0 : s.tag_list) || []
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
});
|
|
131
|
-
return (s, r) => a.value ? (b(), le($(j), {
|
|
132
|
-
key: 0,
|
|
133
|
-
schema: D.value,
|
|
134
|
-
modelValue: a.value,
|
|
135
|
-
"onUpdate:modelValue": [
|
|
136
|
-
r[0] || (r[0] = (k) => a.value = k),
|
|
137
|
-
O
|
|
138
|
-
]
|
|
139
|
-
}, null, 8, ["schema", "modelValue"])) : B("", !0);
|
|
140
|
-
}
|
|
141
|
-
}, Ie = { class: "flex justify-end mb-4" }, qe = ["href"], Ge = ["src"], Qe = ["src"], We = {
|
|
142
|
-
key: 2,
|
|
143
|
-
class: "w-full h-[80vh] flex items-center justify-center text-gray-500"
|
|
144
|
-
}, Xe = {
|
|
145
|
-
__name: "VsPreview",
|
|
146
|
-
props: {
|
|
147
|
-
preview_path: {
|
|
148
|
-
type: String,
|
|
149
|
-
default: ""
|
|
150
|
-
},
|
|
151
|
-
slug: {
|
|
152
|
-
type: String,
|
|
153
|
-
default: ""
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
setup(S) {
|
|
157
|
-
const n = y(""), j = y(""), w = async () => {
|
|
158
|
-
var g, u;
|
|
159
|
-
try {
|
|
160
|
-
const F = await (await fetch("/api/settings")).json();
|
|
161
|
-
n.value = ((u = (g = F == null ? void 0 : F.settings) == null ? void 0 : g.site_info) == null ? void 0 : u.previewUrl) || "http://ip.local.softpro.ua";
|
|
162
|
-
} catch (p) {
|
|
163
|
-
console.error("Failed to fetch settings:", p), n.value = "http://ip.local.softpro.ua";
|
|
164
|
-
}
|
|
165
|
-
}, a = async () => {
|
|
166
|
-
var g;
|
|
167
|
-
try {
|
|
168
|
-
const p = await (await fetch("/user")).json();
|
|
169
|
-
j.value = (g = p == null ? void 0 : p.user) == null ? void 0 : g.draftKey;
|
|
170
|
-
} catch (u) {
|
|
171
|
-
console.error("Failed to fetch user:", u);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
return Z(() => {
|
|
175
|
-
w(), a();
|
|
176
|
-
}), (g, u) => (b(), _("div", null, [
|
|
177
|
-
v("div", Ie, [
|
|
178
|
-
v("a", {
|
|
179
|
-
href: `${n.value}/uk/${S.preview_path}${S.slug}${j.value ? `?draftKey=${j.value}` : ""}`,
|
|
180
|
-
target: "_blank",
|
|
181
|
-
class: "inline-flex items-center gap-2 px-3 py-1.5 text-black-600 bg-white border border-blue-200 rounded hover:border-blue-300 hover:bg-blue-50 transition-colors duration-200 font-normal cursor-pointer"
|
|
182
|
-
}, [
|
|
183
|
-
u[0] || (u[0] = re(" Переглянути на сайті ", -1)),
|
|
184
|
-
C($(Fe), { class: "w-4 h-4" })
|
|
185
|
-
], 8, qe)
|
|
186
|
-
]),
|
|
187
|
-
n.value && S.preview_path ? (b(), _("iframe", {
|
|
188
|
-
key: 0,
|
|
189
|
-
src: `${n.value}/uk/${S.preview_path}${S.slug}?hideHeader=true&hideFooter=true`,
|
|
190
|
-
class: "w-full h-[80vh]"
|
|
191
|
-
}, null, 8, Ge)) : n.value ? (b(), _("iframe", {
|
|
192
|
-
key: 1,
|
|
193
|
-
src: `${n.value}/uk/${S.slug}?hideHeader=true&hideFooter=true`,
|
|
194
|
-
class: "w-full h-[80vh]"
|
|
195
|
-
}, null, 8, Qe)) : (b(), _("div", We, " Loading preview... "))
|
|
196
|
-
]));
|
|
197
|
-
}
|
|
198
|
-
}, 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" }, at = ["href", "title"], ot = { class: "flex items-center space-x-3" }, lt = ["title"], rt = { 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" }, nt = ["onClick"], ct = { class: "flex items-center gap-2" }, ut = {
|
|
199
|
-
for: "is_pin",
|
|
200
|
-
class: "text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer"
|
|
201
|
-
}, dt = { class: "relative" }, mt = {
|
|
202
|
-
key: 0,
|
|
203
|
-
class: "w-3 h-3 text-white",
|
|
204
|
-
fill: "currentColor",
|
|
205
|
-
viewBox: "0 0 20 20"
|
|
206
|
-
}, vt = { class: "mx-auto bg-white rounded-md p-5" }, pt = { class: "mx-auto bg-white rounded-md p-5" }, ft = {
|
|
207
|
-
key: 0,
|
|
208
|
-
class: "mx-auto bg-white rounded-md p-5"
|
|
209
|
-
}, gt = {
|
|
210
|
-
key: 1,
|
|
211
|
-
class: "mx-auto bg-white rounded-md p-5"
|
|
212
|
-
}, St = /* @__PURE__ */ ke({
|
|
213
|
-
__name: "contentForm",
|
|
214
|
-
setup(S) {
|
|
215
|
-
V["vs-input-custom-datatable"] = Ue, V["vs-input-reference"] = Be, V["vs-input-texteditor"] = Oe, V["vs-input-mediaselect"] = Y, V["vs-input-file"] = Y, V["vs-input-image"] = Y, V["vs-input-richtext-md"] = De, V["vs-input-integer"] = Le, V["vs-input-relation-link"] = Je;
|
|
216
|
-
const { t: n, locale: j } = ie(), w = Ce(), a = je(), g = xe("menu", y([])), u = y([]), p = y({}), F = y({}), O = y({}), M = y(""), D = $e(), s = D == null ? void 0 : D.appContext, r = (s == null ? void 0 : s.config.globalProperties) || {}, k = Se(r, "$settings"), E = f(() => {
|
|
217
|
-
var e;
|
|
218
|
-
return ((e = k.value) == null ? void 0 : e.cms) || {};
|
|
219
|
-
}), R = f(() => Array.isArray(E.value.locales) ? E.value.locales : []), z = f(
|
|
220
|
-
() => R.value.filter(Boolean)
|
|
221
|
-
), H = f(
|
|
222
|
-
() => E.value.locale || z.value[0] || "uk"
|
|
223
|
-
);
|
|
224
|
-
I(
|
|
225
|
-
k,
|
|
226
|
-
() => {
|
|
227
|
-
u.value.length && (u.value = u.value.map((e) => ({
|
|
228
|
-
...e
|
|
229
|
-
})));
|
|
230
|
-
},
|
|
231
|
-
{ deep: !0 }
|
|
232
|
-
);
|
|
233
|
-
const ne = (e) => {
|
|
234
|
-
const t = [], l = z.value.filter(
|
|
235
|
-
(i) => i !== H.value
|
|
236
|
-
);
|
|
237
|
-
return Array.isArray(e) && e.forEach((i) => {
|
|
238
|
-
t.push(i), !(!i.localization || l.length === 0) && l.forEach((m) => {
|
|
239
|
-
t.push({
|
|
240
|
-
...i,
|
|
241
|
-
name: `${i.name}:${m}`,
|
|
242
|
-
label: `${i.label} (${m})`
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
}), t;
|
|
246
|
-
}, ee = f(() => ne(u.value)), ce = f(() => {
|
|
247
|
-
var e;
|
|
248
|
-
return (e = ee.value) == null ? void 0 : e.map(Me);
|
|
249
|
-
}), ue = f(() => {
|
|
250
|
-
j.value;
|
|
251
|
-
const e = z.value.filter(
|
|
252
|
-
(t) => t !== H.value
|
|
253
|
-
);
|
|
254
|
-
return He.flatMap((t) => {
|
|
255
|
-
const l = {
|
|
256
|
-
...t,
|
|
257
|
-
label: n(t.label)
|
|
258
|
-
};
|
|
259
|
-
if (!t.localization || e.length === 0)
|
|
260
|
-
return [l];
|
|
261
|
-
const i = e.map((m) => ({
|
|
262
|
-
...t,
|
|
263
|
-
key: `${t.key}:${m}`,
|
|
264
|
-
label: `${n(t.label)} (${m})`,
|
|
265
|
-
localization: !1
|
|
266
|
-
}));
|
|
267
|
-
return [l, ...i];
|
|
268
|
-
});
|
|
269
|
-
}), x = y({}), d = y({
|
|
270
|
-
title: "",
|
|
271
|
-
status: "draft"
|
|
272
|
-
}), G = y(null), Q = f(
|
|
273
|
-
() => {
|
|
274
|
-
var e;
|
|
275
|
-
return (((e = d.value) == null ? void 0 : e.type) || G.value) === "single";
|
|
276
|
-
}
|
|
277
|
-
), de = f(() => {
|
|
278
|
-
const e = [
|
|
279
|
-
{ id: "content", name: n("cms.builder.content") },
|
|
280
|
-
{ id: "seo", name: n("cms.builder.seo") },
|
|
281
|
-
{ id: "tags", name: n("cms.builder.tags") }
|
|
282
|
-
];
|
|
283
|
-
return M.value && e.push({ id: "preview", name: n("cms.builder.preview") }), e;
|
|
284
|
-
}), U = y("content"), me = f(() => {
|
|
285
|
-
var t, l, i, m;
|
|
286
|
-
const e = ((t = a.params) == null ? void 0 : t.collection) || ((l = a.params) == null ? void 0 : l.id);
|
|
287
|
-
return ((m = (i = g.value) == null ? void 0 : i.find((h) => h.id === e)) == null ? void 0 : m.title) || e;
|
|
288
|
-
}), ve = f(() => {
|
|
289
|
-
var t, l;
|
|
290
|
-
const e = Q.value ? "cms.builder.editPage" : "cms.builder.editCollection";
|
|
291
|
-
return ((t = d.value) == null ? void 0 : t.title) || ((l = a.params) != null && l.id ? n(e) : n("cms.articles.createArticle"));
|
|
292
|
-
}), pe = f(() => {
|
|
293
|
-
var i, m, h;
|
|
294
|
-
const e = ((i = a.params) == null ? void 0 : i.collection) || ((m = a.params) == null ? void 0 : m.id), t = (h = a.params) == null ? void 0 : h.id, l = [
|
|
295
|
-
{
|
|
296
|
-
label: me.value,
|
|
297
|
-
route: `collections/${e}`
|
|
298
|
-
}
|
|
299
|
-
];
|
|
300
|
-
return t ? l.push({
|
|
301
|
-
label: ve.value,
|
|
302
|
-
route: `collections/${e}/${t}`
|
|
303
|
-
}) : l.push({
|
|
304
|
-
label: n("cms.articles.createArticle"),
|
|
305
|
-
route: `collections/${e}/create`
|
|
306
|
-
}), l;
|
|
307
|
-
}), fe = (e) => {
|
|
308
|
-
e === "collections" ? w.push("/collections") : w.push(`/${e}`);
|
|
309
|
-
};
|
|
310
|
-
Z(async () => {
|
|
311
|
-
var m, h, c;
|
|
312
|
-
const e = (m = a.params) == null ? void 0 : m.collection, t = (h = a.params) == null ? void 0 : h.id, l = e || t, i = e && t ? t : void 0;
|
|
313
|
-
if (!i) {
|
|
314
|
-
if (!l)
|
|
315
|
-
return;
|
|
316
|
-
const o = await (await fetch(`/api/cms/${l}/`)).json();
|
|
317
|
-
u.value = o.columns, G.value = (o == null ? void 0 : o.type) || null;
|
|
318
|
-
}
|
|
319
|
-
try {
|
|
320
|
-
if (!i || !l)
|
|
321
|
-
return;
|
|
322
|
-
const T = await fetch(`/api/cms/${l}/${i}`);
|
|
323
|
-
if (!T.ok)
|
|
324
|
-
throw new Error("Failed to fetch article");
|
|
325
|
-
const o = await T.json();
|
|
326
|
-
if (u.value = (o == null ? void 0 : o.columns) || [], o != null && o.preview_path && (M.value = o == null ? void 0 : o.preview_path), G.value = (o == null ? void 0 : o.type) || null, o.rows) {
|
|
327
|
-
let A = o.rows;
|
|
328
|
-
Array.isArray(A) || (A = [A]), d.value = A[0], await J(), (c = A[0]) != null && c.meta ? x.value = {
|
|
329
|
-
...A[0].meta
|
|
330
|
-
} : x.value = {
|
|
331
|
-
title: "",
|
|
332
|
-
description: "",
|
|
333
|
-
keywords: "",
|
|
334
|
-
meta: {}
|
|
335
|
-
};
|
|
336
|
-
} else
|
|
337
|
-
d.value = o, await J(), o != null && o.meta ? (x.value = {
|
|
338
|
-
title: o.meta.title || "",
|
|
339
|
-
description: o.meta.description || "",
|
|
340
|
-
keywords: o.meta.keywords || "",
|
|
341
|
-
meta: { ...o.meta }
|
|
342
|
-
}, delete x.value.meta.title, delete x.value.meta.description, delete x.value.meta.keywords) : x.value = {
|
|
343
|
-
title: "",
|
|
344
|
-
description: "",
|
|
345
|
-
keywords: "",
|
|
346
|
-
meta: {}
|
|
347
|
-
};
|
|
348
|
-
} catch (T) {
|
|
349
|
-
console.error("Error fetching article:", T);
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
const te = f({
|
|
353
|
-
get: () => {
|
|
354
|
-
var e;
|
|
355
|
-
return ((e = d.value) == null ? void 0 : e.is_pin) || !1;
|
|
356
|
-
},
|
|
357
|
-
set: (e) => {
|
|
358
|
-
d.value && (d.value.is_pin = e);
|
|
359
|
-
}
|
|
360
|
-
}), ge = () => {
|
|
361
|
-
d.value && (d.value.is_pin = !d.value.is_pin);
|
|
362
|
-
}, W = f(() => {
|
|
363
|
-
var t;
|
|
364
|
-
const e = (t = d.value) == null ? void 0 : t.content_type_id;
|
|
365
|
-
return e ? `/collections/${e}/edit` : null;
|
|
366
|
-
}), ye = () => {
|
|
367
|
-
W.value && w.push(W.value);
|
|
368
|
-
}, he = async (e) => {
|
|
369
|
-
var c, T, o, A;
|
|
370
|
-
const t = (c = a.params) == null ? void 0 : c.collection, l = (T = a.params) == null ? void 0 : T.id, i = await p.value.validate();
|
|
371
|
-
if (i) {
|
|
372
|
-
q({ title: n("cms.validation"), message: JSON.stringify(i), type: "warning" });
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
(o = O.value) != null && o.restoreTagsBeforeSubmit && await O.value.restoreTagsBeforeSubmit();
|
|
376
|
-
const m = x.value || {}, h = {
|
|
377
|
-
...d.value,
|
|
378
|
-
meta: {
|
|
379
|
-
...m,
|
|
380
|
-
...m.meta || {}
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
console.log("Payload before submit:", h);
|
|
384
|
-
try {
|
|
385
|
-
const P = await fetch(`/api/cms/${t}/${l || ""}`, {
|
|
386
|
-
method: l ? "PUT" : "POST",
|
|
387
|
-
headers: {
|
|
388
|
-
"Content-Type": "application/json"
|
|
389
|
-
},
|
|
390
|
-
body: JSON.stringify(h)
|
|
391
|
-
});
|
|
392
|
-
if (!P.ok) {
|
|
393
|
-
let N;
|
|
394
|
-
try {
|
|
395
|
-
const K = await P.json();
|
|
396
|
-
N = JSON.stringify(K, null, 2);
|
|
397
|
-
} catch {
|
|
398
|
-
N = await P.text();
|
|
399
|
-
}
|
|
400
|
-
throw new Error(`HTTP ${P.status}: ${N}`);
|
|
401
|
-
}
|
|
402
|
-
if (!l)
|
|
403
|
-
try {
|
|
404
|
-
const N = await P.json(), K = N.id || ((A = N.data) == null ? void 0 : A.id);
|
|
405
|
-
K && a.name === "createArticle" && await w.push(`/collections/${t}/${K}`);
|
|
406
|
-
} catch (N) {
|
|
407
|
-
console.warn("Could not parse response to get ID:", N);
|
|
408
|
-
}
|
|
409
|
-
q({
|
|
410
|
-
title: n("cms.common.success"),
|
|
411
|
-
message: n("cms.common.successMessage"),
|
|
412
|
-
type: "success"
|
|
413
|
-
});
|
|
414
|
-
} catch (P) {
|
|
415
|
-
console.error("Submit error:", P), q({
|
|
416
|
-
title: n("cms.common.error"),
|
|
417
|
-
message: "Помилка збереження",
|
|
418
|
-
type: "error"
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
return (e, t) => {
|
|
423
|
-
var l, i, m, h;
|
|
424
|
-
return b(), _("div", Ye, [
|
|
425
|
-
v("div", Ze, [
|
|
426
|
-
C(Re, {
|
|
427
|
-
items: pe.value,
|
|
428
|
-
onNavigate: fe
|
|
429
|
-
}, null, 8, ["items"]),
|
|
430
|
-
v("div", et, [
|
|
431
|
-
v("div", tt, [
|
|
432
|
-
v("button", {
|
|
433
|
-
onClick: t[0] || (t[0] = (c) => $(w).back()),
|
|
434
|
-
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"
|
|
435
|
-
}, [
|
|
436
|
-
C($(ze), { class: "w-5 h-5" })
|
|
437
|
-
]),
|
|
438
|
-
v("h1", st, L(e.$t(
|
|
439
|
-
Q.value ? "cms.builder.editPage" : "cms.builder.editCollection"
|
|
440
|
-
)) + ' "' + L(d.value.title) + '" ', 1),
|
|
441
|
-
v("a", {
|
|
442
|
-
href: `https://cms.opengis.info/${$(j)}/guides/content/`,
|
|
443
|
-
target: "_blank",
|
|
444
|
-
title: e.$t("cms.guide.content")
|
|
445
|
-
}, [
|
|
446
|
-
C($(Ne), { class: "w-5 h-5" })
|
|
447
|
-
], 8, at)
|
|
448
|
-
]),
|
|
449
|
-
v("div", ot, [
|
|
450
|
-
W.value && Q.value ? (b(), _("button", {
|
|
451
|
-
key: 0,
|
|
452
|
-
onClick: ye,
|
|
453
|
-
type: "button",
|
|
454
|
-
title: e.$t("cms.builder.editContentType"),
|
|
455
|
-
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",
|
|
456
|
-
"aria-label": "$t('cms.builder.editContentType')"
|
|
457
|
-
}, [
|
|
458
|
-
C($(Pe), { class: "w-4 h-4" })
|
|
459
|
-
], 8, lt)) : B("", !0),
|
|
460
|
-
v("button", {
|
|
461
|
-
onClick: he,
|
|
462
|
-
type: "submit",
|
|
463
|
-
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"
|
|
464
|
-
}, [
|
|
465
|
-
C($(Ee), { class: "w-4 h-4 mr-2" }),
|
|
466
|
-
re(" " + L(e.$t("cms.builder.save")), 1)
|
|
467
|
-
])
|
|
468
|
-
])
|
|
469
|
-
]),
|
|
470
|
-
v("div", rt, [
|
|
471
|
-
v("div", it, [
|
|
472
|
-
(b(!0), _(Te, null, Ae(de.value, (c) => (b(), _("button", {
|
|
473
|
-
key: c.id,
|
|
474
|
-
onClick: (T) => {
|
|
475
|
-
U.value = c.id, console.log("cmsSettings:", E.value.value);
|
|
476
|
-
},
|
|
477
|
-
class: se([
|
|
478
|
-
"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",
|
|
479
|
-
c.id === U.value ? "bg-blue-50 text-blue-700 border-blue-200" : ""
|
|
480
|
-
])
|
|
481
|
-
}, L(c.name), 11, nt))), 128))
|
|
482
|
-
]),
|
|
483
|
-
v("div", ct, [
|
|
484
|
-
v("label", ut, L(e.$t("cms.collections.pinPublication")), 1),
|
|
485
|
-
v("div", dt, [
|
|
486
|
-
X(v("input", {
|
|
487
|
-
type: "checkbox",
|
|
488
|
-
id: "is_pin",
|
|
489
|
-
"onUpdate:modelValue": t[1] || (t[1] = (c) => te.value = c),
|
|
490
|
-
class: "sr-only"
|
|
491
|
-
}, null, 512), [
|
|
492
|
-
[Ve, te.value]
|
|
493
|
-
]),
|
|
494
|
-
v("div", {
|
|
495
|
-
class: se(["w-5 h-5 border-2 rounded transition-all duration-200 cursor-pointer flex items-center justify-center", (l = d.value) != null && l.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"]),
|
|
496
|
-
onClick: ge
|
|
497
|
-
}, [
|
|
498
|
-
(i = d.value) != null && i.is_pin ? (b(), _("svg", mt, [...t[7] || (t[7] = [
|
|
499
|
-
v("path", {
|
|
500
|
-
"fill-rule": "evenodd",
|
|
501
|
-
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",
|
|
502
|
-
"clip-rule": "evenodd"
|
|
503
|
-
}, null, -1)
|
|
504
|
-
])])) : B("", !0)
|
|
505
|
-
], 2)
|
|
506
|
-
])
|
|
507
|
-
])
|
|
508
|
-
])
|
|
509
|
-
]),
|
|
510
|
-
X(v("div", vt, [
|
|
511
|
-
(m = ee.value) != null && m.length ? (b(), le($(oe), {
|
|
512
|
-
key: 0,
|
|
513
|
-
modelValue: d.value,
|
|
514
|
-
"onUpdate:modelValue": t[2] || (t[2] = (c) => d.value = c),
|
|
515
|
-
schema: ce.value,
|
|
516
|
-
form: p.value,
|
|
517
|
-
"onUpdate:form": t[3] || (t[3] = (c) => p.value = c)
|
|
518
|
-
}, null, 8, ["modelValue", "schema", "form"])) : B("", !0)
|
|
519
|
-
], 512), [
|
|
520
|
-
[ae, U.value === "content"]
|
|
521
|
-
]),
|
|
522
|
-
X(v("div", pt, [
|
|
523
|
-
C($(oe), {
|
|
524
|
-
schema: ue.value,
|
|
525
|
-
values: x.value,
|
|
526
|
-
"onUpdate:values": t[4] || (t[4] = (c) => x.value = c),
|
|
527
|
-
form: F.value,
|
|
528
|
-
"onUpdate:form": t[5] || (t[5] = (c) => F.value = c)
|
|
529
|
-
}, null, 8, ["schema", "values", "form"])
|
|
530
|
-
], 512), [
|
|
531
|
-
[ae, U.value === "seo"]
|
|
532
|
-
]),
|
|
533
|
-
U.value === "tags" ? (b(), _("div", ft, [
|
|
534
|
-
C(Ke, {
|
|
535
|
-
ref_key: "tagsForm",
|
|
536
|
-
ref: O,
|
|
537
|
-
modelValue: d.value,
|
|
538
|
-
"onUpdate:modelValue": t[6] || (t[6] = (c) => d.value = c)
|
|
539
|
-
}, null, 8, ["modelValue"])
|
|
540
|
-
])) : B("", !0),
|
|
541
|
-
U.value === "preview" ? (b(), _("div", gt, [
|
|
542
|
-
C(Xe, {
|
|
543
|
-
slug: (h = d.value) == null ? void 0 : h.slug,
|
|
544
|
-
preview_path: M.value
|
|
545
|
-
}, null, 8, ["slug", "preview_path"])
|
|
546
|
-
])) : B("", !0)
|
|
547
|
-
]);
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
export {
|
|
552
|
-
St as default
|
|
553
|
-
};
|