@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,172 @@
|
|
|
1
|
+
import { openBlock as a, createElementBlock as d, createStaticVNode as D, defineComponent as E, ref as b, normalizeClass as z, createTextVNode as M, toDisplayString as h, createCommentVNode as _, createBlock as C, unref as p, withModifiers as f, createVNode as v, createElementVNode as m, withDirectives as $, withKeys as w, vModelText as I, watch as N, resolveComponent as T, withCtx as U, nextTick as V } from "vue";
|
|
2
|
+
import { d as A } from "./vuedraggable-CoAPPFYd.js";
|
|
3
|
+
import { _ as L } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import { Pencil as S, Trash2 as j, Check as K, X as O } from "lucide-vue-next";
|
|
5
|
+
import { confirm as P } from "@opengis/core";
|
|
6
|
+
import { useI18n as X } from "vue-i18n";
|
|
7
|
+
const q = {}, F = {
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
width: "24",
|
|
10
|
+
height: "24",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
"stroke-width": "2",
|
|
15
|
+
"stroke-linecap": "round",
|
|
16
|
+
"stroke-linejoin": "round"
|
|
17
|
+
};
|
|
18
|
+
function G(u, o) {
|
|
19
|
+
return a(), d("svg", F, [...o[0] || (o[0] = [
|
|
20
|
+
D('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>', 6)
|
|
21
|
+
])]);
|
|
22
|
+
}
|
|
23
|
+
const H = /* @__PURE__ */ L(q, [["render", G]]), J = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "p-3 flex items-center gap-x-3 cursor-grab bg-gray-100 border border-gray-300 rounded-lg font-medium text-sm text-gray-800 dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-200"
|
|
26
|
+
}, Q = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "text-xs text-gray-500 dark:text-neutral-400 ml-2"
|
|
29
|
+
}, R = {
|
|
30
|
+
key: 1,
|
|
31
|
+
class: "p-3 flex items-center gap-x-2 bg-gray-100 border border-gray-300 rounded-lg dark:bg-neutral-900 dark:border-neutral-700"
|
|
32
|
+
}, W = { class: "text-sm font-medium text-gray-800 dark:text-neutral-200 shrink-0" }, Y = /* @__PURE__ */ E({
|
|
33
|
+
__name: "MenuItem",
|
|
34
|
+
props: {
|
|
35
|
+
title: {},
|
|
36
|
+
value: {}
|
|
37
|
+
},
|
|
38
|
+
emits: ["delete", "update:value"],
|
|
39
|
+
setup(u, { emit: o }) {
|
|
40
|
+
const i = u, g = o, r = b(!1), e = b(""), k = () => {
|
|
41
|
+
typeof i.value == "string" && (e.value = i.value, r.value = !0);
|
|
42
|
+
}, c = () => {
|
|
43
|
+
typeof i.value == "string" && (g("update:value", e.value), r.value = !1);
|
|
44
|
+
}, x = () => {
|
|
45
|
+
r.value = !1, e.value = "";
|
|
46
|
+
};
|
|
47
|
+
return (s, t) => (a(), d("div", {
|
|
48
|
+
class: z([{ "space-y-1": typeof s.value != "string" }, "dark:bg-transparent"])
|
|
49
|
+
}, [
|
|
50
|
+
r.value ? (a(), d("div", R, [
|
|
51
|
+
m("span", W, h(s.title) + ":", 1),
|
|
52
|
+
$(m("input", {
|
|
53
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => e.value = l),
|
|
54
|
+
onKeyup: [
|
|
55
|
+
w(c, ["enter"]),
|
|
56
|
+
w(x, ["esc"])
|
|
57
|
+
],
|
|
58
|
+
onBlur: c,
|
|
59
|
+
class: "flex-1 px-2 py-1 text-sm border border-gray-300 rounded dark:bg-neutral-800 dark:border-neutral-600 dark:text-neutral-200 focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
60
|
+
type: "text",
|
|
61
|
+
placeholder: "/link"
|
|
62
|
+
}, null, 544), [
|
|
63
|
+
[I, e.value]
|
|
64
|
+
]),
|
|
65
|
+
m("button", {
|
|
66
|
+
onClick: f(c, ["stop"]),
|
|
67
|
+
class: "shrink-0 p-1 text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20 rounded",
|
|
68
|
+
title: "Save"
|
|
69
|
+
}, [
|
|
70
|
+
v(p(K), { class: "size-4" })
|
|
71
|
+
]),
|
|
72
|
+
m("button", {
|
|
73
|
+
onClick: f(x, ["stop"]),
|
|
74
|
+
class: "shrink-0 p-1 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded",
|
|
75
|
+
title: "Cancel"
|
|
76
|
+
}, [
|
|
77
|
+
v(p(O), { class: "size-4" })
|
|
78
|
+
])
|
|
79
|
+
])) : (a(), d("div", J, [
|
|
80
|
+
M(h(s.title) + " ", 1),
|
|
81
|
+
typeof s.value == "string" ? (a(), d("span", Q, h(s.value), 1)) : _("", !0),
|
|
82
|
+
typeof s.value == "string" ? (a(), C(p(S), {
|
|
83
|
+
key: 1,
|
|
84
|
+
class: "shrink-0 size-4 ml-auto text-gray-500 dark:text-neutral-500 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",
|
|
85
|
+
onClick: f(k, ["stop"])
|
|
86
|
+
})) : _("", !0),
|
|
87
|
+
v(p(j), {
|
|
88
|
+
class: "shrink-0 size-4 text-gray-500 dark:text-neutral-500 cursor-pointer hover:text-red-600 dark:hover:text-red-400",
|
|
89
|
+
onClick: t[0] || (t[0] = f((l) => g("delete"), ["stop"]))
|
|
90
|
+
}),
|
|
91
|
+
v(H, { class: "shrink-0 size-4 cursor-pointer text-gray-500 dark:text-neutral-500" })
|
|
92
|
+
]))
|
|
93
|
+
], 2));
|
|
94
|
+
}
|
|
95
|
+
}), Z = { class: "space-y-1" }, ne = /* @__PURE__ */ E({
|
|
96
|
+
__name: "MenuList",
|
|
97
|
+
props: {
|
|
98
|
+
list: {
|
|
99
|
+
type: Array,
|
|
100
|
+
default: () => []
|
|
101
|
+
},
|
|
102
|
+
inside: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: !1
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
emits: ["update:list", "delete:item"],
|
|
108
|
+
setup(u, { emit: o }) {
|
|
109
|
+
const { t: i } = X(), g = u, r = o, e = b([]);
|
|
110
|
+
N(
|
|
111
|
+
() => g.list,
|
|
112
|
+
(t) => {
|
|
113
|
+
e.value = t ? [...t] : [];
|
|
114
|
+
},
|
|
115
|
+
{ immediate: !0, deep: !0 }
|
|
116
|
+
);
|
|
117
|
+
const k = () => {
|
|
118
|
+
r("update:list", e.value);
|
|
119
|
+
}, c = (t) => {
|
|
120
|
+
P({
|
|
121
|
+
title: i("cms.builder.deleteTitle"),
|
|
122
|
+
message: i("cms.builder.deleteObject"),
|
|
123
|
+
type: "error",
|
|
124
|
+
onConfirm: () => {
|
|
125
|
+
r("update:list", e.value), r("delete:item", t);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}, x = (t, l) => {
|
|
129
|
+
t.value = l, V(() => {
|
|
130
|
+
e.value = [...e.value], r("update:list", e.value);
|
|
131
|
+
});
|
|
132
|
+
}, s = (t, l) => {
|
|
133
|
+
t.children = l, V(() => {
|
|
134
|
+
e.value = [...e.value], r("update:list", e.value);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
return (t, l) => {
|
|
138
|
+
const B = T("MenuList", !0);
|
|
139
|
+
return a(), C(p(A), {
|
|
140
|
+
tag: "ul",
|
|
141
|
+
list: e.value,
|
|
142
|
+
group: { name: "nested", pull: !0, put: !0 },
|
|
143
|
+
"item-key": "id",
|
|
144
|
+
class: z(["nested-sortable space-y-1", { "ps-5 dark:bg-transparent": u.inside }]),
|
|
145
|
+
onChange: k,
|
|
146
|
+
onEnd: k
|
|
147
|
+
}, {
|
|
148
|
+
item: U(({ element: n }) => [
|
|
149
|
+
m("div", Z, [
|
|
150
|
+
v(Y, {
|
|
151
|
+
title: n.title,
|
|
152
|
+
value: n.value,
|
|
153
|
+
onDelete: (y) => c(n),
|
|
154
|
+
"onUpdate:value": (y) => x(n, y)
|
|
155
|
+
}, null, 8, ["title", "value", "onDelete", "onUpdate:value"]),
|
|
156
|
+
Array.isArray(n.children) ? (a(), C(B, {
|
|
157
|
+
key: 0,
|
|
158
|
+
list: n.children,
|
|
159
|
+
inside: !0,
|
|
160
|
+
"onUpdate:list": (y) => s(n, y),
|
|
161
|
+
"onDelete:item": c
|
|
162
|
+
}, null, 8, ["list", "onUpdate:list"])) : _("", !0)
|
|
163
|
+
])
|
|
164
|
+
]),
|
|
165
|
+
_: 1
|
|
166
|
+
}, 8, ["list", "class"]);
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
export {
|
|
171
|
+
ne as default
|
|
172
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineComponent as S, defineAsyncComponent as V, ref as a, onMounted as j, resolveComponent as F, openBlock as f, createElementBlock as _, createElementVNode as r, toDisplayString as u, unref as c, createVNode as l, withCtx as N, createTextVNode as L, createCommentVNode as T } from "vue";
|
|
2
|
+
import { useRouter as q } from "vue-router";
|
|
3
|
+
import { HelpCircle as A, Plus as B } from "lucide-vue-next";
|
|
4
|
+
import { useI18n as M } from "vue-i18n";
|
|
5
|
+
import P from "@opengis/filter";
|
|
6
|
+
import { notify as w } from "@opengis/core";
|
|
7
|
+
const H = { class: "space-y-6 max-w-7xl mx-auto" }, I = { class: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" }, O = { class: "flex items-center gap-2" }, Q = { class: "text-3xl font-bold text-slate-800 dark:text-slate-100 mb-2" }, R = ["href", "title"], U = { class: "text-slate-600 dark:text-slate-300" }, z = { class: "overflow-hidden bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700" }, G = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "p-4 border-b border-gray-200 sm:p-6 dark:border-gray-700"
|
|
10
|
+
}, se = /* @__PURE__ */ S({
|
|
11
|
+
__name: "MenuPage",
|
|
12
|
+
setup(J) {
|
|
13
|
+
const g = V(
|
|
14
|
+
() => import("./UniversalTable-GBd_pStq.js")
|
|
15
|
+
), { t: o, locale: v } = M(), y = q(), x = a(""), d = a([]), i = a([]), b = a(""), h = a([
|
|
16
|
+
{ name: "name", title: o("cms.menu.form.name"), type: "text" },
|
|
17
|
+
{ name: "description", title: o("cms.menu.form.description"), type: "text" },
|
|
18
|
+
{ name: "locale", title: o("cms.menu.form.language"), type: "select", data: [{ text: "uk", id: "uk" }, { text: "en", id: "en" }] }
|
|
19
|
+
]), p = async () => {
|
|
20
|
+
const t = await (await fetch("/api/cms-menu")).json(), n = t.rows;
|
|
21
|
+
d.value = n;
|
|
22
|
+
const s = (t.filters || []).map((m) => {
|
|
23
|
+
const { extra: K, title: W, ...D } = m;
|
|
24
|
+
return D;
|
|
25
|
+
});
|
|
26
|
+
i.value = s;
|
|
27
|
+
}, k = (e) => {
|
|
28
|
+
y.push(`/menu/${e == null ? void 0 : e.menu_id}`);
|
|
29
|
+
}, C = async (e) => {
|
|
30
|
+
try {
|
|
31
|
+
await fetch(`/api/cms-menu/${e == null ? void 0 : e.menu_id}`, { method: "DELETE" }), await w({
|
|
32
|
+
title: o("cms.menu.menuDeleted"),
|
|
33
|
+
type: "success",
|
|
34
|
+
message: o("cms.menu.menuDeleted")
|
|
35
|
+
}), await p();
|
|
36
|
+
} catch {
|
|
37
|
+
w({
|
|
38
|
+
title: o("cms.menu.menuDeleteError"),
|
|
39
|
+
type: "error",
|
|
40
|
+
message: o("cms.menu.menuDeleteError")
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, E = (e, t) => {
|
|
44
|
+
if (!t)
|
|
45
|
+
return !0;
|
|
46
|
+
const n = t.toLowerCase();
|
|
47
|
+
return h.value.some((s) => {
|
|
48
|
+
const m = e[s.name];
|
|
49
|
+
return m && m.toString().toLowerCase().includes(n);
|
|
50
|
+
});
|
|
51
|
+
}, $ = (e) => {
|
|
52
|
+
const t = Object.entries(e == null ? void 0 : e.data).filter(([, n]) => n != null).map(([n, s]) => `${n}=${s}`).join("|");
|
|
53
|
+
b.value = t;
|
|
54
|
+
};
|
|
55
|
+
return j(p), (e, t) => {
|
|
56
|
+
var s;
|
|
57
|
+
const n = F("router-link");
|
|
58
|
+
return f(), _("div", H, [
|
|
59
|
+
r("div", I, [
|
|
60
|
+
r("div", null, [
|
|
61
|
+
r("div", O, [
|
|
62
|
+
r("h1", Q, u(e.$t("cms.menu.title")), 1),
|
|
63
|
+
r("a", {
|
|
64
|
+
href: `https://cms.opengis.info/${c(v)}/guides/menu/`,
|
|
65
|
+
target: "_blank",
|
|
66
|
+
title: e.$t("cms.guide.menu")
|
|
67
|
+
}, [
|
|
68
|
+
l(c(A), { class: "w-5 h-5" })
|
|
69
|
+
], 8, R)
|
|
70
|
+
]),
|
|
71
|
+
r("p", U, u(e.$t("cms.menu.description")), 1)
|
|
72
|
+
]),
|
|
73
|
+
l(n, {
|
|
74
|
+
to: "/menu/create",
|
|
75
|
+
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"
|
|
76
|
+
}, {
|
|
77
|
+
default: N(() => [
|
|
78
|
+
l(c(B), { class: "w-4 h-4 mr-2" }),
|
|
79
|
+
L(" " + u(e.$t("cms.menu.menuAdd")), 1)
|
|
80
|
+
]),
|
|
81
|
+
_: 1
|
|
82
|
+
})
|
|
83
|
+
]),
|
|
84
|
+
r("div", z, [
|
|
85
|
+
((s = i.value) == null ? void 0 : s.length) > 0 ? (f(), _("div", G, [
|
|
86
|
+
l(c(P), {
|
|
87
|
+
schema: i.value,
|
|
88
|
+
view: "inline",
|
|
89
|
+
onChange: $
|
|
90
|
+
}, null, 8, ["schema"])
|
|
91
|
+
])) : T("", !0),
|
|
92
|
+
l(c(g), {
|
|
93
|
+
rows: d.value,
|
|
94
|
+
columns: h.value,
|
|
95
|
+
query: x.value,
|
|
96
|
+
filterFn: E,
|
|
97
|
+
onEdit: k,
|
|
98
|
+
onDelete: C
|
|
99
|
+
}, null, 8, ["rows", "columns", "query"])
|
|
100
|
+
])
|
|
101
|
+
]);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export {
|
|
106
|
+
se as default
|
|
107
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineComponent as m, defineAsyncComponent as n, computed as t, openBlock as u, createBlock as s, resolveDynamicComponent as i } from "vue";
|
|
2
|
+
import { useRoute as d } from "vue-router";
|
|
3
|
+
const C = /* @__PURE__ */ m({
|
|
4
|
+
__name: "MenuWrapper",
|
|
5
|
+
setup(f) {
|
|
6
|
+
const o = n(() => import("./MenuPage-3W6jZ15H.js")), r = n(() => import("./MenuAddPage-QTnwCoGh.js")), p = n(() => import("./MenuItemPage-B7Y9KFyb.js")), e = d(), a = t(() => e.params.id ? e.params.id === "create" ? r : p : o), c = t(() => String(e.params.id ?? "index"));
|
|
7
|
+
return (_, l) => (u(), s(i(a.value), { key: c.value }));
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
C as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineComponent as s, mergeModels as m, useModel as c, ref as f, onMounted as h, watch as d, onBeforeUnmount as p, openBlock as g, createElementBlock as v, normalizeStyle as w } from "vue";
|
|
2
|
+
async function M() {
|
|
3
|
+
if (window.monaco)
|
|
4
|
+
return window.monaco;
|
|
5
|
+
const i = "https://cdn.jsdelivr.net/npm/monaco-editor@0.45.0/min";
|
|
6
|
+
return window.require || (window.require = { paths: { vs: `${i}/vs` } }, await new Promise((t, l) => {
|
|
7
|
+
const n = document.createElement("script");
|
|
8
|
+
n.src = `${i}/vs/loader.min.js`, n.onload = () => t(), n.onerror = l, document.head.appendChild(n);
|
|
9
|
+
})), new Promise((t) => {
|
|
10
|
+
window.require(["vs/editor/editor.main"], () => t(window.monaco));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
const C = /* @__PURE__ */ s({
|
|
14
|
+
__name: "MonacoEditor",
|
|
15
|
+
props: /* @__PURE__ */ m({
|
|
16
|
+
language: { default: "javascript" },
|
|
17
|
+
theme: { default: "vs-dark" },
|
|
18
|
+
width: { default: "100%" },
|
|
19
|
+
height: { default: "100%" },
|
|
20
|
+
options: { default: () => ({
|
|
21
|
+
minimap: { enabled: !1 }
|
|
22
|
+
}) }
|
|
23
|
+
}, {
|
|
24
|
+
modelValue: {
|
|
25
|
+
required: !0
|
|
26
|
+
},
|
|
27
|
+
modelModifiers: {}
|
|
28
|
+
}),
|
|
29
|
+
emits: ["update:modelValue"],
|
|
30
|
+
setup(i) {
|
|
31
|
+
const t = i, l = c(i, "modelValue"), n = f(null);
|
|
32
|
+
let o = null, r = null;
|
|
33
|
+
return h(async () => {
|
|
34
|
+
var e;
|
|
35
|
+
if (n.value)
|
|
36
|
+
try {
|
|
37
|
+
r = await M();
|
|
38
|
+
const a = ((e = l.value) == null ? void 0 : e.replace(/\\n/g, `
|
|
39
|
+
`)) || "";
|
|
40
|
+
o = r.editor.create(n.value, {
|
|
41
|
+
value: a,
|
|
42
|
+
language: t.language,
|
|
43
|
+
theme: t.theme,
|
|
44
|
+
automaticLayout: !0,
|
|
45
|
+
...t.options
|
|
46
|
+
}), o.onDidChangeModelContent(() => {
|
|
47
|
+
const u = (o == null ? void 0 : o.getValue()) || "";
|
|
48
|
+
l.value = u;
|
|
49
|
+
});
|
|
50
|
+
} catch (a) {
|
|
51
|
+
console.error("Failed to load Monaco Editor:", a);
|
|
52
|
+
}
|
|
53
|
+
}), d(
|
|
54
|
+
() => l.value,
|
|
55
|
+
(e) => {
|
|
56
|
+
if (o) {
|
|
57
|
+
const a = (e == null ? void 0 : e.replace(/\\n/g, `
|
|
58
|
+
`)) || "";
|
|
59
|
+
a !== o.getValue() && o.setValue(a);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{ immediate: !0 }
|
|
63
|
+
), d(
|
|
64
|
+
() => t.language,
|
|
65
|
+
(e) => {
|
|
66
|
+
o && e && r && r.editor.setModelLanguage(o.getModel(), e);
|
|
67
|
+
}
|
|
68
|
+
), d(
|
|
69
|
+
() => t.theme,
|
|
70
|
+
(e) => {
|
|
71
|
+
o && e && r && r.editor.setTheme(e);
|
|
72
|
+
}
|
|
73
|
+
), p(() => {
|
|
74
|
+
o && (o.dispose(), o = null);
|
|
75
|
+
}), (e, a) => (g(), v("div", {
|
|
76
|
+
ref_key: "editorContainer",
|
|
77
|
+
ref: n,
|
|
78
|
+
style: w({ width: e.width, height: e.height })
|
|
79
|
+
}, null, 4));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
export {
|
|
83
|
+
C as _
|
|
84
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as j, ref as L, computed as $, openBlock as s, createElementBlock as
|
|
1
|
+
import { defineComponent as j, ref as L, computed as $, openBlock as s, createElementBlock as r, createElementVNode as a, Fragment as y, renderList as w, normalizeClass as h, createBlock as g, resolveDynamicComponent as C, createCommentVNode as A, createTextVNode as v, toDisplayString as l, createVNode as M, unref as f, withModifiers as D, renderSlot as B } from "vue";
|
|
2
2
|
import { useI18n as q } from "vue-i18n";
|
|
3
3
|
import { Eye as U, File as P, Layers as z, Pencil as H, Trash2 as W, XCircle as X, Edit as G, CheckCircle as J } from "lucide-vue-next";
|
|
4
4
|
const K = { class: "text-card-foreground border-0 bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm" }, O = { class: "p-0" }, Q = { class: "table-scroll overflow-x-auto" }, Y = { class: "relative w-full overflow-auto max-h-[calc(100vh-270px)]" }, Z = { class: "w-full caption-bottom text-sm" }, I = { class: "border-b border-slate-200 dark:border-slate-700 bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors" }, ee = { class: "flex items-center gap-2" }, te = { class: "h-10 text-center px-4 font-semibold text-slate-700 dark:text-slate-300 max-w-32" }, se = ["onClick"], ne = {
|
|
5
5
|
key: 1,
|
|
6
6
|
class: "whitespace-nowrap"
|
|
7
|
-
},
|
|
7
|
+
}, re = {
|
|
8
8
|
key: 2,
|
|
9
9
|
class: "whitespace-nowrap"
|
|
10
|
-
},
|
|
10
|
+
}, ae = {
|
|
11
11
|
key: 3,
|
|
12
12
|
class: "flex items-center"
|
|
13
13
|
}, ie = {
|
|
@@ -22,10 +22,10 @@ const K = { class: "text-card-foreground border-0 bg-white/80 dark:bg-slate-800/
|
|
|
22
22
|
}, le = {
|
|
23
23
|
key: 8,
|
|
24
24
|
class: "flex items-center gap-3"
|
|
25
|
-
},
|
|
25
|
+
}, me = {
|
|
26
26
|
key: 11,
|
|
27
27
|
class: "flex items-center gap-3"
|
|
28
|
-
},
|
|
28
|
+
}, ce = { class: "line-clamp-2" }, ue = { class: "flex justify-end py-2 px-4 align-middle max-w-40" }, be = { class: "flex items-center justify-center gap-1" }, he = ["onClick"], pe = ["onClick"], ye = /* @__PURE__ */ j({
|
|
29
29
|
__name: "UniversalTable",
|
|
30
30
|
props: {
|
|
31
31
|
rows: {},
|
|
@@ -39,16 +39,16 @@ const K = { class: "text-card-foreground border-0 bg-white/80 dark:bg-slate-800/
|
|
|
39
39
|
customRender: {}
|
|
40
40
|
},
|
|
41
41
|
emits: ["edit", "view", "delete", "more"],
|
|
42
|
-
setup(
|
|
42
|
+
setup(N, { emit: E }) {
|
|
43
43
|
const { t: o } = q();
|
|
44
44
|
L(null);
|
|
45
|
-
const d =
|
|
46
|
-
if (!
|
|
45
|
+
const d = N, x = E, T = $(() => !d.query || !d.filterFn ? d.rows : d.rows.filter((n) => d.filterFn(n, d.query))), V = (n) => {
|
|
46
|
+
if (!n)
|
|
47
47
|
return "";
|
|
48
|
-
const i = new Date(
|
|
49
|
-
return isNaN(i.getTime()) ? "" :
|
|
50
|
-
},
|
|
51
|
-
switch (
|
|
48
|
+
const i = new Date(n);
|
|
49
|
+
return isNaN(i.getTime()) ? "" : n.includes("T") || n.includes(" ") || n.includes(":") ? i.toLocaleString("uk-UA", { dateStyle: "medium", timeStyle: "medium" }) : i.toLocaleDateString("uk-UA", { dateStyle: "medium" });
|
|
50
|
+
}, k = (n) => {
|
|
51
|
+
switch (n) {
|
|
52
52
|
case "published":
|
|
53
53
|
return {
|
|
54
54
|
icon: J,
|
|
@@ -70,130 +70,130 @@ const K = { class: "text-card-foreground border-0 bg-white/80 dark:bg-slate-800/
|
|
|
70
70
|
default:
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
switch (
|
|
73
|
+
}, _ = (n, i) => {
|
|
74
|
+
switch (n) {
|
|
75
75
|
case "edit":
|
|
76
|
-
|
|
76
|
+
x("edit", i), d.onEdit && d.onEdit(i);
|
|
77
77
|
break;
|
|
78
78
|
case "view":
|
|
79
|
-
|
|
79
|
+
x("view", i), d.onView && d.onView(i);
|
|
80
80
|
break;
|
|
81
81
|
case "delete":
|
|
82
|
-
|
|
82
|
+
x("delete", i);
|
|
83
83
|
break;
|
|
84
84
|
case "more":
|
|
85
|
-
|
|
85
|
+
x("more", i), d.onMore && d.onMore(i);
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
|
-
}, R = (
|
|
89
|
-
|
|
90
|
-
}, S = (
|
|
91
|
-
const i = /* @__PURE__ */ new Date(), e = new Date(
|
|
92
|
-
return
|
|
88
|
+
}, R = (n) => {
|
|
89
|
+
_("edit", n);
|
|
90
|
+
}, S = (n) => {
|
|
91
|
+
const i = /* @__PURE__ */ new Date(), e = new Date(n), t = i - e, p = Math.floor(t / 1e3), m = Math.floor(p / 60), c = Math.floor(m / 60), u = Number(Math.floor(c / 24)), b = Number(Math.floor(u / 7));
|
|
92
|
+
return b >= 2 ? o("cms.table.time.weeksAgo", { count: b }) : b === 1 ? o("cms.table.time.weekAgo") : u >= 2 ? o("cms.table.time.daysAgo", { count: u }) : u === 1 ? o("cms.table.time.dayAgo") : c >= 2 ? o("cms.table.time.hoursAgo", { count: c }) : c === 1 ? o("cms.table.time.hourAgo") : m >= 2 ? o("cms.table.time.minutesAgo", { count: m }) : o(m === 1 ? "cms.table.time.minuteAgo" : "cms.table.time.justNow");
|
|
93
93
|
};
|
|
94
|
-
return (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
(s(!0),
|
|
94
|
+
return (n, i) => (s(), r("div", K, [
|
|
95
|
+
a("div", O, [
|
|
96
|
+
a("div", Q, [
|
|
97
|
+
a("div", Y, [
|
|
98
|
+
a("table", Z, [
|
|
99
|
+
a("thead", null, [
|
|
100
|
+
a("tr", I, [
|
|
101
|
+
(s(!0), r(y, null, w(n.columns, (e) => (s(), r("th", {
|
|
102
102
|
key: e.name,
|
|
103
|
-
class:
|
|
103
|
+
class: h(["h-10 px-4 text-left align-middle font-semibold text-slate-700 dark:text-slate-300 max-w-80", {
|
|
104
104
|
"min-w-[200px]": ["title", "name"].includes(e.name),
|
|
105
105
|
"min-w-[150px]": e.name === "slug",
|
|
106
106
|
"min-w-[250px]": e.name === "description"
|
|
107
107
|
}])
|
|
108
108
|
}, [
|
|
109
|
-
|
|
110
|
-
e.icon ? (s(),
|
|
109
|
+
a("div", ee, [
|
|
110
|
+
e.icon ? (s(), g(C(e.icon), {
|
|
111
111
|
key: 0,
|
|
112
112
|
class: "w-5 h-5"
|
|
113
|
-
})) :
|
|
114
|
-
|
|
113
|
+
})) : A("", !0),
|
|
114
|
+
v(" " + l(e.label || e.title || e.ua || e.name), 1)
|
|
115
115
|
])
|
|
116
116
|
], 2))), 128)),
|
|
117
|
-
|
|
117
|
+
a("th", te, l(n.$t("cms.table.actions")), 1)
|
|
118
118
|
])
|
|
119
119
|
]),
|
|
120
|
-
|
|
121
|
-
(s(!0),
|
|
120
|
+
a("tbody", null, [
|
|
121
|
+
(s(!0), r(y, null, w(T.value, (e) => (s(), r("tr", {
|
|
122
122
|
key: e.id || e._id || e.name,
|
|
123
123
|
class: "transition-all duration-200 hover:bg-slate-100 dark:hover:bg-slate-700/60"
|
|
124
124
|
}, [
|
|
125
|
-
(s(!0),
|
|
126
|
-
var
|
|
127
|
-
return s(),
|
|
125
|
+
(s(!0), r(y, null, w(n.columns, (t, p) => {
|
|
126
|
+
var m, c, u, b, F;
|
|
127
|
+
return s(), r("td", {
|
|
128
128
|
key: t.name,
|
|
129
|
-
class:
|
|
130
|
-
"font-medium text-slate-800 dark:text-white cursor-pointer":
|
|
131
|
-
"text-slate-600 dark:text-slate-400 font-mono text-sm":
|
|
129
|
+
class: h(["py-2 px-4 align-middle max-w-80", {
|
|
130
|
+
"font-medium text-slate-800 dark:text-white cursor-pointer": p === 0,
|
|
131
|
+
"text-slate-600 dark:text-slate-400 font-mono text-sm": p !== 0
|
|
132
132
|
}]),
|
|
133
|
-
onClick: (
|
|
133
|
+
onClick: (ge) => p === 0 ? R(e) : void 0
|
|
134
134
|
}, [
|
|
135
|
-
|
|
135
|
+
n.customRender && n.customRender[t.name] ? (s(), g(C(n.customRender[t.name](e[t.name], e)), { key: 0 })) : A("", !0),
|
|
136
136
|
[
|
|
137
137
|
"published_at",
|
|
138
138
|
"publish_at",
|
|
139
139
|
"created_at",
|
|
140
140
|
"date"
|
|
141
|
-
].includes(t.name) && e[t.name] ? (s(),
|
|
141
|
+
].includes(t.name) && e[t.name] ? (s(), r("span", ne, l(V(e[t.name])), 1)) : [
|
|
142
142
|
"updated_at",
|
|
143
143
|
"lastModified",
|
|
144
144
|
"last_edit"
|
|
145
|
-
].includes(t.name) ? (s(),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
])) : ["entries", "fields"].includes(t.name) ? (s(),
|
|
149
|
-
|
|
150
|
-
class:
|
|
145
|
+
].includes(t.name) ? (s(), r("span", re, l(S(e[t.name]) || "--"), 1)) : t.name === "views" ? (s(), r("div", ae, [
|
|
146
|
+
M(f(U), { class: "w-4 h-4 mr-1" }),
|
|
147
|
+
v(" " + l(((c = (m = e[t.name]) == null ? void 0 : m.toLocaleString) == null ? void 0 : c.call(m)) ?? e[t.name]), 1)
|
|
148
|
+
])) : ["entries", "fields"].includes(t.name) ? (s(), r("div", ie, l(e[t.name] || "-"), 1)) : t.name === "type" ? (s(), r("div", oe, [
|
|
149
|
+
a("div", {
|
|
150
|
+
class: h(["whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors border-transparent hover:bg-secondary/80", e[t.name] === "pages" ? "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300" : "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300"])
|
|
151
151
|
}, l(e[t.name] || "-"), 3)
|
|
152
|
-
])) : t.name === "name" ? (s(),
|
|
153
|
-
e.type === "single" ? (s(), f(
|
|
152
|
+
])) : t.name === "name" ? (s(), r("div", de, [
|
|
153
|
+
e.type === "single" ? (s(), g(f(P), {
|
|
154
154
|
key: 0,
|
|
155
155
|
class: "shrink-0 lucide lucide-page w-5 h-5 text-blue-600"
|
|
156
|
-
})) : (s(), f(
|
|
156
|
+
})) : (s(), g(f(z), {
|
|
157
157
|
key: 1,
|
|
158
158
|
class: "shrink-0 lucide lucide-layers w-5 h-5 text-blue-600"
|
|
159
159
|
})),
|
|
160
|
-
|
|
161
|
-
])) : t.name === "status" ? (s(),
|
|
162
|
-
|
|
160
|
+
v(" " + l(e[t.name]), 1)
|
|
161
|
+
])) : t.name === "status" ? (s(), r(y, { key: 7 }, [
|
|
162
|
+
k(e[t.name]) ? (s(), r("div", {
|
|
163
163
|
key: 0,
|
|
164
|
-
class:
|
|
164
|
+
class: h(["whitespace-nowrap rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors hover:bg-secondary/80 flex items-center w-fit bg-green-100 text-green-800 border-green-200 dark:bg-green-900/30 dark:text-green-300 dark:border-green-700", (u = k(e[t.name])) == null ? void 0 : u.classes])
|
|
165
165
|
}, [
|
|
166
|
-
(s(),
|
|
167
|
-
|
|
168
|
-
], 2)) :
|
|
169
|
-
], 64)) : t.name === "slug" ? (s(),
|
|
166
|
+
(s(), g(C((b = k(e[t.name])) == null ? void 0 : b.icon), { class: "w-3 h-3 mr-1" })),
|
|
167
|
+
v(" " + l((F = k(e[t.name])) == null ? void 0 : F.text), 1)
|
|
168
|
+
], 2)) : A("", !0)
|
|
169
|
+
], 64)) : t.name === "slug" ? (s(), r("div", le, l(e[t.name] ? "/" + e[t.name] : "-"), 1)) : t.name === "color" ? (s(), r("span", {
|
|
170
170
|
key: 9,
|
|
171
|
-
class:
|
|
172
|
-
}, null, 2)) : t.name === "enabled" ? (s(),
|
|
171
|
+
class: h(["w-4 h-4 rounded-full block ml-2", "bg-[" + e[t.name] + "]"])
|
|
172
|
+
}, null, 2)) : t.name === "enabled" ? (s(), r("span", {
|
|
173
173
|
key: 10,
|
|
174
|
-
class:
|
|
175
|
-
}, l(e[t.name] ? "Доступ" : "Заборонено"), 3)) : (s(),
|
|
176
|
-
|
|
174
|
+
class: h(["whitespace-nowrap rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors hover:bg-secondary/80 flex items-center w-fit", e[t.name] ? "bg-green-100 text-green-800 border-green-200" : "bg-red-100 text-red-800 border-red-200"])
|
|
175
|
+
}, l(e[t.name] ? "Доступ" : "Заборонено"), 3)) : (s(), r("div", me, [
|
|
176
|
+
a("p", ce, l(e[t.name] || "-"), 1)
|
|
177
177
|
]))
|
|
178
178
|
], 10, se);
|
|
179
179
|
}), 128)),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
onClick:
|
|
180
|
+
a("td", ue, [
|
|
181
|
+
a("div", be, [
|
|
182
|
+
a("button", {
|
|
183
|
+
onClick: D((t) => _("edit", e), ["stop"]),
|
|
184
184
|
class: "inline-flex items-center justify-center whitespace-nowrap font-medium border rounded-md text-xs h-8 w-8 p-0 border-slate-300 bg-white transition-all duration-200 shadow-sm dark:border-slate-600 dark:bg-slate-700 dark:hover:bg-slate-600 dark:hover:text-slate-200 hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600",
|
|
185
185
|
title: "Edit"
|
|
186
186
|
}, [
|
|
187
|
-
|
|
187
|
+
M(f(H), { class: "text-slate-800 dark:text-slate-200 w-4 h-4 group-hover:text-green-600 dark:group-hover:text-blue-50" })
|
|
188
188
|
], 8, he),
|
|
189
|
-
|
|
190
|
-
onClick:
|
|
189
|
+
a("button", {
|
|
190
|
+
onClick: D((t) => _("delete", e), ["stop"]),
|
|
191
191
|
class: "inline-flex items-center justify-center whitespace-nowrap font-medium border rounded-md text-xs h-8 w-8 p-0 border-slate-300 bg-white transition-all duration-200 shadow-sm dark:border-slate-600 dark:bg-slate-700 dark:hover:bg-slate-600 dark:hover:text-slate-200 hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600",
|
|
192
192
|
title: "Preview"
|
|
193
193
|
}, [
|
|
194
|
-
|
|
195
|
-
], 8,
|
|
196
|
-
B(
|
|
194
|
+
M(f(W), { class: "w-4 h-4 text-slate-800 dark:text-slate-200 group-hover:text-red-600 dark:group-hover:text-blue-50" })
|
|
195
|
+
], 8, pe),
|
|
196
|
+
B(n.$slots, "actions", { row: e })
|
|
197
197
|
])
|
|
198
198
|
])
|
|
199
199
|
]))), 128))
|
|
@@ -206,5 +206,5 @@ const K = { class: "text-card-foreground border-0 bg-white/80 dark:bg-slate-800/
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
208
|
export {
|
|
209
|
-
ye as
|
|
209
|
+
ye as default
|
|
210
210
|
};
|