@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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/AddNewItemInTree-05PSSEFi.js +76 -0
  3. package/dist/ArticlesPage-BjYzvTWM.js +298 -0
  4. package/dist/CollectionsBreadcrumb-HePNJb-d.js +4 -0
  5. package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-BJh-tjam.js +53 -0
  6. package/dist/CollectionsPage-DHfPNql6.js +124 -0
  7. package/dist/{CreateForm-BMOBeP4G.js → CreateForm-5FvT45vH.js} +1 -1
  8. package/dist/Dashboard-CXkg_pk8.js +358 -0
  9. package/dist/EditCollectionPage-CqYHpEON.js +187 -0
  10. package/dist/{EmptyData-DaZt_nAm.js → EmptyData-DxPrSXhV.js} +1 -1
  11. package/dist/{MenuAddPage-Bf48Z-ah.js → MenuAddPage-QTnwCoGh.js} +40 -35
  12. package/dist/MenuBody-Bi0ONVZf.js +125 -0
  13. package/dist/MenuItemPage-B7Y9KFyb.js +1027 -0
  14. package/dist/MenuList-BLIpeqSd.js +172 -0
  15. package/dist/MenuPage-3W6jZ15H.js +107 -0
  16. package/dist/MenuWrapper-OrOv6sOb.js +12 -0
  17. package/dist/MonacoEditor-ByPT8pnv.js +4 -0
  18. package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-C8cip9Ci.js +84 -0
  19. package/dist/{UniversalTable.vue_vue_type_script_setup_true_lang-CJGTsd1V.js → UniversalTable-GBd_pStq.js} +81 -81
  20. package/dist/{UniversalTablePagination.vue_vue_type_script_setup_true_lang-GYZd_gkA.js → UniversalTablePagination-Dw2hc0nc.js} +47 -47
  21. package/dist/VsFormTags-CMjiu9sY.js +114 -0
  22. package/dist/VsPreview-DwETkOpb.js +63 -0
  23. package/dist/contentForm-Buku-lel.js +489 -0
  24. package/dist/getField-CpwVE28P.js +179 -0
  25. package/dist/index.d.ts +8 -0
  26. package/dist/index.js +72 -71
  27. package/dist/style.css +1 -1
  28. package/dist/vs-builder-edit-D-q1o8tF.js +604 -0
  29. package/dist/vs-builder-monaco-Cw-f19gc.js +33 -0
  30. package/dist/vs-builder-preview-BH4VAM3a.js +44 -0
  31. package/dist/vs-form-custom-datatable-BDZo48w3.js +317 -0
  32. package/dist/vs-form-integer-BZ855R3g.js +61 -0
  33. package/dist/vs-form-media-select-NY27EaG1.js +837 -0
  34. package/dist/vs-form-reference-list-Dtv8fJJU.js +1536 -0
  35. package/dist/vs-form-reletion-link-BhzNQszm.js +34 -0
  36. package/dist/vs-form-tiptap-DDFQjRjY.js +4 -0
  37. package/dist/vs-form-tiptap.vue_vue_type_script_setup_true_lang-DGgsqXwg.js +11 -0
  38. package/dist/vs-richtext-md-C098v_6Q.js +4 -0
  39. package/dist/vs-richtext-md.vue_vue_type_script_setup_true_lang-Ct8uTV-J.js +14 -0
  40. package/locales/en.json +1 -0
  41. package/locales/uk.json +1 -0
  42. package/package.json +69 -68
  43. package/server/functions/utils/mock.reply.js +7 -7
  44. package/server/routes/cms/controllers/getPermissions.js +15 -15
  45. package/server/routes/cms/controllers/setPermissions.js +49 -49
  46. package/server/templates/select/core.user_mentioned.sql +1 -1
  47. package/dist/ArticlesPage-BcR1hbds.js +0 -286
  48. package/dist/BuilderPage-CK_osM89.js +0 -386
  49. package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-CnOe9ORD.js +0 -45
  50. package/dist/CollectionsPage-JfmrHNR_.js +0 -110
  51. package/dist/EditCollectionPage-Cw3GQYRe.js +0 -809
  52. package/dist/MenuItemPage-CXn5HC8j.js +0 -1366
  53. package/dist/MenuPage-tJZtK46W.js +0 -106
  54. package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-B1DrxmQX.js +0 -84
  55. package/dist/contentForm-B6gHgGkz.js +0 -586
  56. package/dist/getField-Y5WXnRR0.js +0 -2948
@@ -1,809 +0,0 @@
1
- import { ref as v, useModel as V, onMounted as P, openBlock as m, createElementBlock as g, createVNode as x, createCommentVNode as O, computed as F, createElementVNode as l, unref as w, createTextVNode as H, toDisplayString as a, withCtx as j, mergeModels as ee, defineAsyncComponent as G, Fragment as J, createBlock as U, normalizeClass as Y, resolveDynamicComponent as K, onBeforeUnmount as te, defineComponent as le, inject as ie, renderList as se } from "vue";
2
- import { useRoute as oe, useRouter as re } from "vue-router";
3
- import { _ as ae } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-B1DrxmQX.js";
4
- import { Plus as ne, Edit as de, Trash as ce, Type as M, File as S, Link as B, LayoutTemplate as ue, Image as A, ListTree as D, CheckSquare as E, List as me, Clock as pe, Calendar as be, Hash as R } from "lucide-vue-next";
5
- import { VForm as Q, inputs as $ } from "@opengis/form";
6
- import { VsModal as W, notify as T, confirm as fe } from "@opengis/core";
7
- import { useI18n as I } from "vue-i18n";
8
- import { d as ve } from "./vuedraggable-CoAPPFYd.js";
9
- import { _ as ge, a as ye, V as he, b as z, c as xe, d as we, e as _e, g as ke } from "./getField-Y5WXnRR0.js";
10
- import { _ as $e } from "./CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-CnOe9ORD.js";
11
- const Ce = {
12
- __name: "vs-builder-monaco",
13
- props: {
14
- yaml: { type: String, default: "" },
15
- yamlModifiers: {}
16
- },
17
- emits: ["update:yaml"],
18
- setup(n) {
19
- const e = v("");
20
- V(n, "yaml");
21
- const d = v(null);
22
- return P(() => {
23
- d.value = Math.random().toString(36).substring(2, 15);
24
- }), (i, t) => d.value ? (m(), g("div", { key: d.value }, [
25
- x(ae, {
26
- modelValue: e.value,
27
- "onUpdate:modelValue": t[0] || (t[0] = (s) => e.value = s),
28
- language: "yaml",
29
- theme: "vs-light",
30
- height: "calc(100vh - 200px)",
31
- width: "100%",
32
- options: {
33
- minimap: { enabled: !1 }
34
- }
35
- }, null, 8, ["modelValue"])
36
- ])) : O("", !0);
37
- }
38
- }, q = (n = 0, e) => ({
39
- name: {
40
- type: "text",
41
- label: e("cms.builder.fieldLabels.name"),
42
- required: !0,
43
- placeholder: e("cms.builder.fieldPlaceholders.name"),
44
- validators: ["required"]
45
- },
46
- label: {
47
- type: "text",
48
- label: e("cms.builder.fieldLabels.label"),
49
- required: !0,
50
- placeholder: e("cms.builder.fieldPlaceholders.label"),
51
- validators: ["required"]
52
- },
53
- placeholder: {
54
- type: "text",
55
- label: e("cms.builder.fieldLabels.placeholder"),
56
- required: !0,
57
- placeholder: e("cms.builder.fieldPlaceholders.placeholder")
58
- },
59
- help: {
60
- type: "text",
61
- label: e("cms.builder.fieldLabels.help"),
62
- placeholder: e("cms.builder.fieldPlaceholders.help")
63
- },
64
- type: {
65
- type: "combobox",
66
- mode: "combo",
67
- label: e("cms.builder.fieldLabels.type"),
68
- required: !0,
69
- maxHeight: "300",
70
- slots: {
71
- option: '<div class="flex items-center gap-2 p-2 py-1 rounded hover:bg-gray-100" :class="{ \'bg-gray-100\': selectedNavIndex === ind, \'bg-gray-100\': modelValue == ind }" ><div :class="`flex items-center gap-2 p-1 bg-${color }-100 rounded`"><component :is="`icon-${id}`" class="block" height="24" width="30" /></div><span class="text-sm text-gray-700">{{ text }}</span></div>'
72
- },
73
- options: [
74
- { text: e("cms.builder.fieldOptions.text"), id: "text", color: "blue", icon: "Type" },
75
- { text: e("cms.builder.fieldOptions.number"), id: "number", color: "green", icon: "Hash" },
76
- { text: e("cms.builder.fieldOptions.date"), id: "date", color: "red", icon: "Calendar" },
77
- { text: e("cms.builder.fieldOptions.datetime"), id: "datetime", color: "purple", icon: "CalendarClock" },
78
- { text: e("cms.builder.fieldOptions.file"), id: "file", color: "yellow", icon: "File" },
79
- { text: e("cms.builder.fieldOptions.select"), id: "select", color: "yellow", icon: "Check" },
80
- { text: e("cms.builder.fieldOptions.multiselect"), id: "multiselect", color: "blue", icon: "List" },
81
- { text: e("cms.builder.fieldOptions.mediaselect"), id: "mediaselect", color: "orange", icon: "Image" },
82
- { text: e("cms.builder.fieldOptions.radio"), id: "radio", color: "blue", icon: "Disc" },
83
- { text: e("cms.builder.fieldOptions.boolean"), id: "boolean", color: "red", icon: "ToggleRight" },
84
- { text: e("cms.builder.fieldOptions.datalist"), id: "datalist", color: "orange", icon: "ListChecks" },
85
- { text: e("cms.builder.fieldOptions.image"), id: "image", color: "blue", icon: "Image" },
86
- { text: e("cms.builder.fieldOptions.slug"), id: "slug", color: "green", icon: "Link" },
87
- { text: e("cms.builder.fieldOptions.richtext"), id: "richtext", color: "red", icon: "AlignLeft" },
88
- { text: e("cms.builder.fieldOptions.reference"), id: "reference", color: "yellow", icon: "FileText" },
89
- { text: e("cms.builder.fieldOptions.relation"), id: "relation", color: "pink", icon: "GitBranch" },
90
- { text: e("cms.builder.fieldOptions.fileList"), id: "FileList", color: "orange", icon: "Files" },
91
- { text: e("cms.builder.fieldOptions.tags"), id: "tags", color: "blue", icon: "Tags" }
92
- ].filter((d) => n > 1 ? d.id !== "datalist" : !0),
93
- validators: ["required"]
94
- },
95
- subtype: {
96
- type: "combobox",
97
- mode: "combo",
98
- label: e("cms.builder.fieldLabels.subtype"),
99
- placeholder: e("cms.builder.fieldPlaceholders.subtype"),
100
- options: [
101
- { text: e("cms.builder.fieldOptions.text"), id: "text" },
102
- { text: e("cms.builder.fieldOptions.number"), id: "number" },
103
- { text: e("cms.builder.fieldOptions.date"), id: "date" },
104
- { text: e("cms.builder.fieldOptions.datetime"), id: "datetime" }
105
- ],
106
- conditions: ["type", "==", "array"]
107
- },
108
- parent: {
109
- type: "text",
110
- label: e("cms.builder.fieldLabels.parent"),
111
- placeholder: e("cms.builder.fieldPlaceholders.parent"),
112
- conditions: ["type", "in", ["slug", "select", "multiselect"]]
113
- },
114
- data: {
115
- type: "text",
116
- label: e("cms.builder.fieldLabels.data"),
117
- placeholder: e("cms.builder.fieldPlaceholders.data"),
118
- conditions: ["type", "in", ["select", "multiselect"]]
119
- },
120
- options: {
121
- type: "datatable",
122
- label: e("cms.builder.fieldLabels.options"),
123
- conditions: ["type", "in", ["select", "multiselect", "radio"]],
124
- colModel: [
125
- {
126
- key: "id",
127
- label: "ID",
128
- type: "text",
129
- validators: ["required"],
130
- col: 6
131
- },
132
- {
133
- key: "text",
134
- label: "Text",
135
- type: "text",
136
- validators: ["required"],
137
- col: 6
138
- },
139
- {
140
- key: "icon",
141
- ua: "Icon",
142
- type: "text",
143
- col: 6
144
- }
145
- ]
146
- },
147
- colModel: n <= 1 ? {
148
- type: "datatable",
149
- label: e("cms.builder.fieldLabels.colModel"),
150
- conditions: ["type", "==", "datalist"],
151
- colModel: Object.entries(q(n + 1, e)).map(([d, i]) => ({
152
- key: d,
153
- ...i,
154
- ua: (i == null ? void 0 : i.label) || (i == null ? void 0 : i.ua)
155
- }))
156
- } : {
157
- type: "switcher",
158
- label: e("cms.builder.fieldLabels.required"),
159
- hidden: !0,
160
- required: !0
161
- },
162
- multiple: {
163
- type: "switcher",
164
- label: e("cms.builder.fieldLabels.multiple"),
165
- conditions: ["type", "==", "file"]
166
- },
167
- relation: {
168
- type: "combobox",
169
- data: "collection",
170
- label: e("cms.builder.fieldLabels.relation"),
171
- conditions: ["type", "==", "relation"]
172
- },
173
- required: {
174
- type: "switcher",
175
- label: e("cms.builder.fieldLabels.required"),
176
- required: !0
177
- },
178
- localization: {
179
- type: "switcher",
180
- label: e("cms.builder.fieldLabels.localization"),
181
- conditions: ["type", "in", ["richtext", "text", "reference", "multiselect", "datalist"]],
182
- required: !0
183
- }
184
- }), Ve = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, Le = {
185
- __name: "vs-builder-datatable-form",
186
- props: {
187
- modelValue: {
188
- type: Array,
189
- default: () => []
190
- },
191
- modelModifiers: {}
192
- },
193
- emits: ["update:modelValue"],
194
- setup(n) {
195
- const { t: e } = I(), d = V(n, "modelValue"), i = v(!1), t = v({}), s = v({}), p = F(() => (s.value, q(0, e))), c = async () => {
196
- if (await t.value.validate()) {
197
- T({
198
- type: "warning",
199
- title: e("cms.common.actions.warning"),
200
- message: e("cms.builder.createFieldFailed")
201
- });
202
- return;
203
- }
204
- try {
205
- d.value = [...d.value, s.value], s.value = {}, i.value = !1;
206
- } catch (r) {
207
- console.log(r);
208
- }
209
- };
210
- return (o, r) => (m(), g("div", null, [
211
- l("button", {
212
- onClick: r[0] || (r[0] = (y) => i.value = !0),
213
- class: "inline-flex items-center justify-center h-10 gap-2 px-4 py-2 text-sm font-medium transition-colors border rounded-md hover hover:bg-gray-200 whitespace-nowrap ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring 0"
214
- }, [
215
- x(w(ne), { class: "w-4 h-4 mr-2" }),
216
- H(" " + a(o.$t("cms.common.actions.addField")), 1)
217
- ]),
218
- x(w(W), {
219
- teleport: "#modal",
220
- title: o.$t("cms.builder.createField"),
221
- size: "small",
222
- visible: i.value,
223
- "onUpdate:visible": r[4] || (r[4] = (y) => i.value = y),
224
- onClose: r[5] || (r[5] = (y) => i.value = !1)
225
- }, {
226
- footer: j(() => [
227
- l("div", Ve, [
228
- l("button", {
229
- class: "inline-flex items-center px-3 py-2 text-sm text-black duration-300 border border-gray-200 rounded-lg gap-x-2 whitespace-nowrap hover:bg-gray-100",
230
- onClick: r[3] || (r[3] = (y) => i.value = !1)
231
- }, a(o.$t("cms.common.actions.cancel")), 1),
232
- l("button", {
233
- onClick: c,
234
- class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"
235
- }, a(o.$t("cms.common.actions.save")), 1)
236
- ])
237
- ]),
238
- default: j(() => [
239
- x(w(Q), {
240
- modelValue: s.value,
241
- "onUpdate:modelValue": r[1] || (r[1] = (y) => s.value = y),
242
- schema: p.value,
243
- form: t.value,
244
- "onUpdate:form": r[2] || (r[2] = (y) => t.value = y)
245
- }, null, 8, ["modelValue", "schema", "form"])
246
- ]),
247
- _: 1
248
- }, 8, ["title", "visible"])
249
- ]));
250
- }
251
- }, qe = { class: "flex items-center justify-end col-span-3 gap-2" }, Fe = {
252
- key: 2,
253
- class: "w-8 h-4"
254
- }, Oe = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, Te = {
255
- __name: "vs-builder-datatable-controls",
256
- props: /* @__PURE__ */ ee({
257
- index: {
258
- type: Number,
259
- required: !0
260
- },
261
- data: {
262
- type: Object,
263
- required: !0
264
- }
265
- }, {
266
- columns: {
267
- type: Array,
268
- default: () => []
269
- },
270
- columnsModifiers: {}
271
- }),
272
- emits: ["update:columns"],
273
- setup(n) {
274
- const { t: e } = I(), d = G(() => import("@opengis/form")), i = n, t = V(n, "columns"), s = v(!1), p = v({}), c = v({ ...i.data || {} }), o = v({});
275
- P(() => {
276
- i.data.required ? o.value = {
277
- ...q(0, e),
278
- name: {
279
- ...q(0, e).name,
280
- disabled: !0
281
- },
282
- label: {
283
- ...q(0, e).label,
284
- disabled: !0
285
- },
286
- type: {
287
- ...q(0, e).type,
288
- disabled: !0
289
- }
290
- } : o.value = q(0, e);
291
- });
292
- const r = () => {
293
- fe({
294
- title: e("cms.builder.deleteTitle"),
295
- message: e("cms.builder.deleteField"),
296
- type: "error",
297
- onConfirm: () => {
298
- y();
299
- }
300
- });
301
- }, y = () => {
302
- t.value = t.value.filter((k, b) => b !== i.index);
303
- }, _ = async () => {
304
- if (await p.value.validate()) {
305
- T({
306
- type: "warning",
307
- title: e("cms.common.actions.warning"),
308
- message: e("cms.builder.editFieldFailed")
309
- });
310
- return;
311
- }
312
- try {
313
- t.value[i.index] = c.value, s.value = !1;
314
- } catch (b) {
315
- console.log(b);
316
- }
317
- };
318
- return (k, b) => (m(), g("div", qe, [
319
- ["status"].includes(n.data.name) ? O("", !0) : (m(), g("button", {
320
- key: 0,
321
- onClick: b[0] || (b[0] = (C) => s.value = !0),
322
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:text-accent-foreground h-8 w-8 rounded-full hover:bg-gray-100"
323
- }, [
324
- x(w(de), { class: "w-4 h-4" })
325
- ])),
326
- n.data.required ? (m(), g("button", Fe)) : (m(), g("button", {
327
- key: 1,
328
- onClick: r,
329
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 h-8 w-8 rounded-full hover:bg-red-100 text-red-600 hover:text-red-700"
330
- }, [
331
- x(w(ce), { class: "w-4 h-4" })
332
- ])),
333
- x(w(W), {
334
- teleport: "#modal",
335
- visible: s.value,
336
- title: k.$t("cms.builder.editField"),
337
- onClose: b[4] || (b[4] = (C) => s.value = !1)
338
- }, {
339
- footer: j(() => [
340
- l("div", Oe, [
341
- l("button", {
342
- class: "inline-flex items-center px-3 py-2 text-sm text-black duration-300 border border-gray-200 rounded-lg gap-x-2 whitespace-nowrap hover:bg-gray-100",
343
- onClick: b[3] || (b[3] = (C) => s.value = !1)
344
- }, a(k.$t("cms.common.actions.cancel")), 1),
345
- l("button", {
346
- class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300",
347
- onClick: _
348
- }, a(k.$t("cms.common.actions.save")), 1)
349
- ])
350
- ]),
351
- default: j(() => [
352
- x(w(d), {
353
- modelValue: c.value,
354
- "onUpdate:modelValue": b[1] || (b[1] = (C) => c.value = C),
355
- schema: o.value,
356
- form: p.value,
357
- "onUpdate:form": b[2] || (b[2] = (C) => p.value = C)
358
- }, null, 8, ["modelValue", "schema", "form"])
359
- ]),
360
- _: 1
361
- }, 8, ["visible", "title"])
362
- ]));
363
- }
364
- }, je = { class: "flex items-center justify-between mb-6" }, Me = { class: "text-xl font-semibold text-gray-900" }, Ue = { class: "mt-1 text-sm text-gray-600" }, Ie = { class: "flex items-center gap-2" }, ze = { class: "overflow-hidden bg-white border border-gray-200 shadow-sm rounded-xl" }, Pe = { class: "grid grid-cols-12 gap-4 px-6 py-4 border-b border-gray-200 bg-gray-50" }, Ne = { class: "col-span-5 font-medium text-gray-700" }, Se = { class: "col-span-3 font-medium text-gray-700" }, Be = { class: "col-span-2 font-medium text-gray-700" }, Ae = { class: "col-span-2 font-medium text-right text-gray-700" }, De = { class: "divide-y divide-gray-100" }, Ee = { class: "grid items-center grid-cols-12 gap-4 px-6 py-4 transition-colors hover:bg-gray-50/50" }, Re = { class: "flex items-center col-span-5 gap-3" }, He = { class: "font-medium text-gray-900" }, Ge = { class: "text-xs text-gray-500" }, Je = {
365
- key: 0,
366
- class: "inline-flex items-center px-2 py-1 text-xs font-medium text-blue-700 rounded-full bg-blue-50 ring-1 ring-inset ring-blue-700/10"
367
- }, Ye = { class: "col-span-3" }, Ke = { class: "inline-flex items-center px-2 py-1 text-sm font-medium text-gray-600 rounded-md bg-gray-50 ring-1 ring-inset ring-gray-500/10" }, Qe = { class: "col-span-1" }, We = {
368
- key: 0,
369
- xmlns: "http://www.w3.org/2000/svg",
370
- width: "24",
371
- height: "24",
372
- viewBox: "0 0 24 24",
373
- fill: "none",
374
- stroke: "currentColor",
375
- "stroke-width": "2",
376
- "stroke-linecap": "round",
377
- "stroke-linejoin": "round",
378
- class: "lucide lucide-circle-check w-4 h-4 text-emerald-600"
379
- }, Xe = {
380
- key: 1,
381
- class: "grid items-center grid-cols-12 gap-4 px-6 py-4 transition-colors hover:bg-gray-50/50"
382
- }, Ze = { class: "col-span-5" }, et = { class: "text-gray-500" }, tt = {
383
- __name: "vs-builder-datatable",
384
- props: {
385
- modelValue: {},
386
- modelModifiers: {}
387
- },
388
- emits: ["update:modelValue"],
389
- setup(n) {
390
- const e = V(n, "modelValue"), d = (t) => t === "array" ? "purple" : t === "boolean" || t === "date" ? "red" : t === "datetime" ? "purple" : t === "number" ? "green" : t === "text" ? "blue" : t === "file" || t === "select" ? "yellow" : t === "slug" ? "green" : t === "image" ? "blue" : "gray", i = (t) => {
391
- switch (t) {
392
- case "text":
393
- return M;
394
- case "number":
395
- return R;
396
- case "integer":
397
- return R;
398
- case "date":
399
- return be;
400
- case "datetime":
401
- return pe;
402
- case "file":
403
- return S;
404
- case "select":
405
- return D;
406
- case "multiselect":
407
- return me;
408
- case "mediaselect":
409
- return A;
410
- case "radio":
411
- return E;
412
- case "boolean":
413
- return E;
414
- case "datalist":
415
- return D;
416
- case "image":
417
- return A;
418
- case "slug":
419
- return B;
420
- case "richtext":
421
- return M;
422
- case "markdown":
423
- return M;
424
- case "reference":
425
- return ue;
426
- case "relation":
427
- return B;
428
- case "FileList":
429
- return S;
430
- default:
431
- return M;
432
- }
433
- };
434
- return (t, s) => {
435
- var p, c;
436
- return m(), g(J, null, [
437
- l("div", je, [
438
- l("div", null, [
439
- l("h2", Me, a(t.$t("cms.builder.collectionStructure")), 1),
440
- l("p", Ue, a(t.$t("cms.builder.defineFields")), 1)
441
- ]),
442
- l("div", Ie, [
443
- x(Le, {
444
- modelValue: e.value.columns,
445
- "onUpdate:modelValue": s[0] || (s[0] = (o) => e.value.columns = o)
446
- }, null, 8, ["modelValue"])
447
- ])
448
- ]),
449
- l("div", ze, [
450
- l("div", Pe, [
451
- l("div", Ne, a(t.$t("cms.builder.name")), 1),
452
- l("div", Se, a(t.$t("cms.builder.type")), 1),
453
- l("div", Be, a(t.$t("cms.builder.localization")), 1),
454
- l("div", Ae, a(t.$t("cms.builder.actions")), 1)
455
- ]),
456
- l("div", De, [
457
- (c = (p = e.value) == null ? void 0 : p.columns) != null && c.length ? (m(), U(w(ve), {
458
- key: 0,
459
- modelValue: e.value.columns,
460
- "onUpdate:modelValue": s[2] || (s[2] = (o) => e.value.columns = o),
461
- "item-key": "name",
462
- handle: ".drag-handle",
463
- animation: 200
464
- }, {
465
- item: j(({ element: o, index: r }) => {
466
- var y, _;
467
- return [
468
- l("div", Ee, [
469
- l("div", Re, [
470
- s[3] || (s[3] = l("span", { class: "drag-handle cursor-move mr-2 text-gray-400" }, "☰", -1)),
471
- l("div", {
472
- class: Y(["flex items-center justify-center p-1 rounded", `bg-${d((y = o.type) == null ? void 0 : y.toLowerCase())}-100`])
473
- }, [
474
- (m(), U(K(i((_ = o.type) == null ? void 0 : _.toLowerCase())), { class: "w-4 h-4" }))
475
- ], 2),
476
- l("div", null, [
477
- l("p", He, a(o.label), 1),
478
- l("p", Ge, a(o.name), 1)
479
- ]),
480
- o.required ? (m(), g("span", Je, a(t.$t("cms.builder.required")), 1)) : O("", !0)
481
- ]),
482
- l("div", Ye, [
483
- l("span", Ke, a(o.type), 1)
484
- ]),
485
- l("div", Qe, [
486
- o.localization ? (m(), g("svg", We, [...s[4] || (s[4] = [
487
- l("circle", {
488
- cx: "12",
489
- cy: "12",
490
- r: "10"
491
- }, null, -1),
492
- l("path", { d: "m9 12 2 2 4-4" }, null, -1)
493
- ])])) : O("", !0)
494
- ]),
495
- x(Te, {
496
- columns: e.value.columns,
497
- "onUpdate:columns": s[1] || (s[1] = (k) => e.value.columns = k),
498
- data: e.value.columns[r],
499
- index: r
500
- }, null, 8, ["columns", "data", "index"])
501
- ])
502
- ];
503
- }),
504
- _: 1
505
- }, 8, ["modelValue"])) : (m(), g("div", Xe, [
506
- l("div", Ze, [
507
- l("p", et, a(t.$t("cms.builder.noColumnsFound")), 1)
508
- ])
509
- ]))
510
- ])
511
- ])
512
- ], 64);
513
- };
514
- }
515
- }, lt = {
516
- __name: "vs-builder-edit",
517
- props: {
518
- data: {},
519
- dataModifiers: {},
520
- form: {},
521
- formModifiers: {}
522
- },
523
- emits: ["update:data", "update:form"],
524
- setup(n) {
525
- const { t: e } = I(), d = G(() => import("@opengis/form")), i = V(n, "data"), t = V(n, "form");
526
- v({});
527
- const s = F(() => ({
528
- name: {
529
- type: "text",
530
- disabled: !0,
531
- readonly: !0,
532
- label: e("cms.builder.scheme.name.label"),
533
- required: !0,
534
- placeholder: e("cms.builder.scheme.name.placeholder"),
535
- validators: ["required"],
536
- col: 3
537
- },
538
- title: {
539
- type: "text",
540
- label: e("cms.builder.scheme.title.label"),
541
- required: !0,
542
- placeholder: e("cms.builder.scheme.title.placeholder"),
543
- validators: ["required"],
544
- col: 3
545
- },
546
- preview_path: {
547
- type: "text",
548
- label: e("cms.builder.scheme.preview_path.label"),
549
- placeholder: e("cms.builder.scheme.preview_path.placeholder"),
550
- col: 3,
551
- info: e("cms.builder.scheme.preview_path.info")
552
- },
553
- // slug: {
554
- // type: "slug",
555
- // label: "Title",
556
- // parent: "title",
557
- // required: true,
558
- // placeholder: "Title",
559
- // validators: ["required"],
560
- // col: 4,
561
- // },
562
- type: {
563
- hidden: !0,
564
- type: "select",
565
- label: e("cms.builder.scheme.type.label"),
566
- required: !0,
567
- placeholder: e("cms.builder.scheme.type.placeholder"),
568
- validators: ["required"],
569
- col: 4,
570
- options: [
571
- {
572
- text: e("cms.builder.scheme.type.options.collection"),
573
- id: "collection"
574
- },
575
- {
576
- text: e("cms.builder.scheme.type.options.single"),
577
- id: "single"
578
- }
579
- ]
580
- },
581
- status: {
582
- hidden: !0,
583
- type: "select",
584
- label: e("cms.builder.scheme.status.label"),
585
- required: !0,
586
- placeholder: e("cms.builder.scheme.status.placeholder"),
587
- col: 4,
588
- options: [
589
- {
590
- text: e("cms.builder.scheme.status.options.published"),
591
- id: "published"
592
- },
593
- {
594
- text: e("cms.builder.scheme.status.options.draft"),
595
- id: "draft"
596
- },
597
- {
598
- text: e("cms.builder.scheme.status.options.archived"),
599
- id: "archived"
600
- }
601
- ]
602
- },
603
- include_search: {
604
- type: "switcher",
605
- label: e("cms.builder.scheme.include_search.label"),
606
- placeholder: e("cms.builder.scheme.include_search.placeholder"),
607
- col: 3
608
- },
609
- description: {
610
- type: "textarea",
611
- label: e("cms.builder.scheme.description.label"),
612
- required: !0,
613
- placeholder: e("cms.builder.scheme.description.placeholder")
614
- }
615
- }));
616
- return te(() => {
617
- t.value = null;
618
- }), (p, c) => (m(), g("div", null, [
619
- x(w(d), {
620
- modelValue: i.value,
621
- "onUpdate:modelValue": c[0] || (c[0] = (o) => i.value = o),
622
- schema: s.value,
623
- form: t.value,
624
- "onUpdate:form": c[1] || (c[1] = (o) => t.value = o)
625
- }, null, 8, ["modelValue", "schema", "form"]),
626
- x(tt, {
627
- modelValue: i.value,
628
- "onUpdate:modelValue": c[2] || (c[2] = (o) => i.value = o)
629
- }, null, 8, ["modelValue"])
630
- ]));
631
- }
632
- }, it = {
633
- __name: "vs-builder-preview",
634
- props: {
635
- data: {},
636
- dataModifiers: {},
637
- form: {},
638
- formModifiers: {}
639
- },
640
- emits: ["update:data", "update:form"],
641
- setup(n) {
642
- $["vs-input-custom-datatable"] = ge, $["vs-input-reference"] = ye, $["vs-input-texteditor"] = he, $["vs-input-mediaselect"] = z, $["vs-input-file"] = z, $["vs-input-image"] = z, $["vs-input-richtext-md"] = xe, $["vs-input-integer"] = we, $["vs-input-relation-link"] = _e;
643
- const e = v({}), d = V(n, "data"), i = V(n, "form"), t = F(() => {
644
- var s, p;
645
- return ((p = (s = d.value) == null ? void 0 : s.columns) == null ? void 0 : p.map(ke)) || [];
646
- });
647
- return (s, p) => {
648
- var c;
649
- return m(), g("div", {
650
- ref_key: "form",
651
- ref: i
652
- }, [
653
- ((c = t.value) == null ? void 0 : c.length) > 0 ? (m(), U(w(Q), {
654
- key: 0,
655
- modelValue: e.value,
656
- "onUpdate:modelValue": p[0] || (p[0] = (o) => e.value = o),
657
- schema: t.value
658
- }, null, 8, ["modelValue", "schema"])) : O("", !0)
659
- ], 512);
660
- };
661
- }
662
- }, st = {
663
- monaco: Ce,
664
- edit: lt,
665
- preview: it
666
- }, ot = { class: "mx-auto max-w-[90%]" }, rt = { class: "flex items-center justify-between mb-6" }, at = { class: "mb-2 text-2xl font-semibold text-gray-900" }, nt = { class: "lowercase" }, dt = { class: "text-gray-600" }, ct = { class: "flex items-center gap-2" }, ut = { class: "w-full" }, mt = { class: "flex items-center w-full h-10 max-w-md grid-cols-3 p-1 mb-6 bg-white border border-gray-200 rounded-md text-muted-foreground" }, pt = ["onClick"], bt = {
667
- key: 0,
668
- class: "mx-auto bg-white rounded-md py-4 px-2 bg-opacity-50"
669
- }, Ct = /* @__PURE__ */ le({
670
- __name: "EditCollectionPage",
671
- setup(n) {
672
- const { t: e } = I(), d = ie("cms.fetchContentTypes"), i = v("edit"), t = v({ yaml: "", data: { columns: [], type: "collection" } }), s = v({}), p = v(""), c = oe(), o = re(), r = v(!1), y = F(() => [
673
- // {
674
- // name: "YAML",
675
- // id: "monaco",
676
- // },
677
- {
678
- name: e("cms.builder.edit"),
679
- id: "edit"
680
- },
681
- {
682
- name: e("cms.builder.preview"),
683
- id: "preview"
684
- }
685
- ]), _ = F(() => {
686
- const f = c.params.id;
687
- return f === "edit" ? c.params.collection : f;
688
- }), k = F(() => [
689
- {
690
- label: p.value || _.value,
691
- route: `collections/${_.value}`
692
- },
693
- {
694
- label: e("cms.collections.edit")
695
- }
696
- ]), b = (f) => {
697
- o.push(`/${f}`);
698
- }, C = async () => {
699
- var f;
700
- try {
701
- if (!_.value)
702
- return;
703
- const u = await (await fetch(`/api/cms-type/${_.value}`)).json(), L = {
704
- ...u,
705
- columns: Array.isArray(u.columns) ? u.columns : (f = Object.entries((u == null ? void 0 : u.columns) || {})) == null ? void 0 : f.map(([N, Z]) => ({
706
- ...Z,
707
- name: N
708
- }))
709
- };
710
- t.value = {
711
- ...t.value,
712
- data: L
713
- }, p.value = L.title || L.name;
714
- } catch (h) {
715
- console.error(h);
716
- } finally {
717
- r.value = !0;
718
- }
719
- }, X = async () => {
720
- var f, h;
721
- try {
722
- if (await s.value.validate()) {
723
- T({
724
- type: "warning",
725
- title: e("cms.common.actions.warning"),
726
- message: e("cms.builder.editFieldFailed")
727
- });
728
- return;
729
- }
730
- const L = _.value;
731
- if (!L)
732
- return;
733
- const N = await fetch(
734
- `/api/cms-type/${L}`,
735
- {
736
- method: "PUT",
737
- headers: {
738
- "Content-Type": "application/json"
739
- },
740
- body: JSON.stringify(i.value === "monaco" ? (f = t.value) == null ? void 0 : f.yaml : (h = t.value) == null ? void 0 : h.data)
741
- }
742
- );
743
- o.back(), d && d(), T({
744
- type: "success",
745
- title: e("cms.common.actions.success"),
746
- message: e("cms.collections.collectionCreated")
747
- });
748
- } catch (u) {
749
- console.error(u), T({
750
- type: "error",
751
- title: e("cms.common.actions.error"),
752
- message: e("cms.collections.collectionCreationFailed")
753
- });
754
- }
755
- };
756
- return P(() => {
757
- C();
758
- }), (f, h) => (m(), g("div", ot, [
759
- x($e, {
760
- items: k.value,
761
- onNavigate: b
762
- }, null, 8, ["items"]),
763
- l("div", rt, [
764
- l("div", null, [
765
- l("h1", at, [
766
- H(a(f.$t("cms.builder.editCollection")) + ": ", 1),
767
- l("span", nt, ' "' + a(p.value) + '" ', 1)
768
- ]),
769
- l("p", dt, a(f.$t("cms.builder.editContentForYourSite")), 1)
770
- ]),
771
- l("div", ct, [
772
- l("a", {
773
- onClick: h[0] || (h[0] = (u) => w(o).back()),
774
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border bg-background hover:text-accent-foreground h-10 px-4 py-2 border-gray-300 text-gray-700 hover:bg-gray-50"
775
- }, a(f.$t("cms.common.actions.back")), 1),
776
- l("button", {
777
- onClick: X,
778
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap text-white rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 text-primary-foreground h-10 px-4 py-2 bg-blue-600 hover:bg-blue-700"
779
- }, a(f.$t("cms.common.actions.save")), 1)
780
- ])
781
- ]),
782
- l("div", ut, [
783
- l("div", mt, [
784
- (m(!0), g(J, null, se(y.value, (u) => (m(), g("button", {
785
- key: u.id,
786
- onClick: (L) => i.value = u.id,
787
- class: Y([
788
- "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",
789
- u.id === i.value ? "bg-blue-50 text-blue-700 border-blue-200" : ""
790
- ])
791
- }, a(u.name), 11, pt))), 128))
792
- ])
793
- ]),
794
- r.value ? (m(), g("div", bt, [
795
- (m(), U(K(w(st)[i.value]), {
796
- yaml: t.value.yaml,
797
- "onUpdate:yaml": h[1] || (h[1] = (u) => t.value.yaml = u),
798
- data: t.value.data,
799
- "onUpdate:data": h[2] || (h[2] = (u) => t.value.data = u),
800
- form: s.value,
801
- "onUpdate:form": h[3] || (h[3] = (u) => s.value = u)
802
- }, null, 40, ["yaml", "data", "form"]))
803
- ])) : O("", !0)
804
- ]));
805
- }
806
- });
807
- export {
808
- Ct as default
809
- };