@opengis/cms 0.0.61 → 0.0.63
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-CFjE_cw_.js → ArticlesPage-BjYzvTWM.js} +3 -3
- package/dist/{CollectionsBreadcrumb-BCxeRikP.js → CollectionsBreadcrumb-HePNJb-d.js} +1 -1
- package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-BJh-tjam.js +53 -0
- package/dist/{Dashboard-C1eGscNd.js → Dashboard-CXkg_pk8.js} +132 -132
- package/dist/{EditCollectionPage-3Q57ptN3.js → EditCollectionPage-BGZCMcQS.js} +3 -3
- package/dist/{MenuAddPage-D-p3gFgm.js → MenuAddPage-QTnwCoGh.js} +1 -1
- package/dist/{MenuBody-rN5j4YBu.js → MenuBody-Bi0ONVZf.js} +2 -2
- package/dist/{MenuItemPage-BoJw885D.js → MenuItemPage-B7Y9KFyb.js} +3 -3
- package/dist/{MenuList-DFEBS0NB.js → MenuList-BLIpeqSd.js} +53 -53
- package/dist/{MenuPage-BCZB_S8j.js → MenuPage-3W6jZ15H.js} +1 -1
- package/dist/{MenuWrapper-AZ_8s-zd.js → MenuWrapper-OrOv6sOb.js} +1 -1
- package/dist/{MonacoEditor-Db-3Jc3E.js → MonacoEditor-ByPT8pnv.js} +1 -1
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-C8cip9Ci.js +84 -0
- package/dist/{UniversalTable-CzqPG-tY.js → UniversalTable-GBd_pStq.js} +80 -80
- package/dist/{UniversalTablePagination-4gL47A7I.js → UniversalTablePagination-Dw2hc0nc.js} +46 -46
- package/dist/{contentForm-CLStrfSg.js → contentForm-NmskI6Ye.js} +146 -148
- package/dist/index.js +5 -5
- package/dist/{vs-builder-monaco-B3Jj0V31.js → vs-builder-monaco-Cw-f19gc.js} +1 -1
- package/dist/{vs-builder-preview-BH4VAM3a.js → vs-builder-preview-l5KhqlrF.js} +12 -13
- package/dist/vs-form-custom-datatable-D880w8gx.js +493 -0
- package/dist/{vs-form-reference-list-Dtv8fJJU.js → vs-form-reference-list-hZufPxfE.js} +696 -353
- package/locales/en.json +8 -0
- package/locales/uk.json +9 -1
- package/package.json +2 -2
- package/server/routes/cms/controllers/deleteMedia.js +76 -76
- package/server/routes/cms/controllers/getPermissions.js +15 -15
- package/server/routes/cms/controllers/metadataMedia.js +39 -39
- package/server/routes/cms/controllers/setPermissions.js +49 -49
- package/server/routes/cms/controllers/uploadMedia.js +79 -79
- package/server/templates/select/core.user_mentioned.sql +1 -1
- package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-umRzB5mY.js +0 -53
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-B1DrxmQX.js +0 -84
- package/dist/getField-CpwVE28P.js +0 -179
- package/dist/vs-form-custom-datatable-BDZo48w3.js +0 -317
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { defineComponent as s, mergeModels as c, useModel as m, ref as f, onMounted as h, watch as d, onBeforeUnmount as g, openBlock as p, createElementBlock as v, normalizeStyle as w } from "vue";
|
|
2
|
-
async function M() {
|
|
3
|
-
if (window.monaco)
|
|
4
|
-
return window.monaco;
|
|
5
|
-
const a = "https://cdn.jsdelivr.net/npm/monaco-editor@0.45.0/min";
|
|
6
|
-
return window.require || (window.require = { paths: { vs: `${a}/vs` } }, await new Promise((o, l) => {
|
|
7
|
-
const n = document.createElement("script");
|
|
8
|
-
n.src = `${a}/vs/loader.min.js`, n.onload = () => o(), n.onerror = l, document.head.appendChild(n);
|
|
9
|
-
})), new Promise((o) => {
|
|
10
|
-
window.require(["vs/editor/editor.main"], () => o(window.monaco));
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
const C = /* @__PURE__ */ s({
|
|
14
|
-
__name: "MonacoEditor",
|
|
15
|
-
props: /* @__PURE__ */ c({
|
|
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(a) {
|
|
31
|
-
const o = a, l = m(a, "modelValue"), n = f(null);
|
|
32
|
-
let e = null, i = null;
|
|
33
|
-
return h(async () => {
|
|
34
|
-
var t;
|
|
35
|
-
if (n.value)
|
|
36
|
-
try {
|
|
37
|
-
i = await M();
|
|
38
|
-
const r = ((t = l.value) == null ? void 0 : t.replace(/\\n/g, `
|
|
39
|
-
`)) || "";
|
|
40
|
-
e = i.editor.create(n.value, {
|
|
41
|
-
value: r,
|
|
42
|
-
language: o.language,
|
|
43
|
-
theme: o.theme,
|
|
44
|
-
automaticLayout: !0,
|
|
45
|
-
...o.options
|
|
46
|
-
}), e.onDidChangeModelContent(() => {
|
|
47
|
-
const u = (e == null ? void 0 : e.getValue()) || "";
|
|
48
|
-
l.value = u;
|
|
49
|
-
});
|
|
50
|
-
} catch (r) {
|
|
51
|
-
console.error("Failed to load Monaco Editor:", r);
|
|
52
|
-
}
|
|
53
|
-
}), d(
|
|
54
|
-
() => l.value,
|
|
55
|
-
(t) => {
|
|
56
|
-
if (e) {
|
|
57
|
-
const r = (t == null ? void 0 : t.replace(/\\n/g, `
|
|
58
|
-
`)) || "";
|
|
59
|
-
r !== e.getValue() && e.setValue(r);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{ immediate: !0 }
|
|
63
|
-
), d(
|
|
64
|
-
() => o.language,
|
|
65
|
-
(t) => {
|
|
66
|
-
e && t && i && i.editor.setModelLanguage(e.getModel(), t);
|
|
67
|
-
}
|
|
68
|
-
), d(
|
|
69
|
-
() => o.theme,
|
|
70
|
-
(t) => {
|
|
71
|
-
e && t && i && i.editor.setTheme(t);
|
|
72
|
-
}
|
|
73
|
-
), g(() => {
|
|
74
|
-
e && (e.dispose(), e = null);
|
|
75
|
-
}), (t, r) => (p(), v("div", {
|
|
76
|
-
ref_key: "editorContainer",
|
|
77
|
-
ref: n,
|
|
78
|
-
style: w({ width: a.width, height: a.height })
|
|
79
|
-
}, null, 4));
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
export {
|
|
83
|
-
C as _
|
|
84
|
-
};
|
|
@@ -1,179 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import { mergeModels as _, defineAsyncComponent as E, useModel as A, ref as y, watch as S, openBlock as a, createElementBlock as s, createElementVNode as r, createVNode as h, unref as k, withCtx as C, toDisplayString as x, createTextVNode as U, onMounted as z, Fragment as D, renderList as $, normalizeClass as B, createCommentVNode as j } from "vue";
|
|
2
|
-
import { Pencil as O, Trash2 as P, Plus as G, GripVertical as R } from "lucide-vue-next";
|
|
3
|
-
import { VsModal as I, confirm as X, notify as q } from "@opengis/core";
|
|
4
|
-
import { useI18n as H } from "vue-i18n";
|
|
5
|
-
const Y = { class: "flex items-center justify-end gap-2" }, Z = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, J = {
|
|
6
|
-
__name: "vs-form-custom-datatable-controls",
|
|
7
|
-
props: /* @__PURE__ */ _({
|
|
8
|
-
item: {
|
|
9
|
-
type: Object,
|
|
10
|
-
required: !0
|
|
11
|
-
},
|
|
12
|
-
colModel: {
|
|
13
|
-
type: Array,
|
|
14
|
-
required: !0
|
|
15
|
-
}
|
|
16
|
-
}, {
|
|
17
|
-
modelValue: {
|
|
18
|
-
type: Array,
|
|
19
|
-
required: !0
|
|
20
|
-
},
|
|
21
|
-
modelModifiers: {}
|
|
22
|
-
}),
|
|
23
|
-
emits: ["update:modelValue"],
|
|
24
|
-
setup(b) {
|
|
25
|
-
const { t: n } = H(), w = E(() => import("@opengis/form")), c = b, d = A(b, "modelValue"), m = y(!1), p = y({}), V = y({}), v = () => {
|
|
26
|
-
X({
|
|
27
|
-
title: n("cms.builder.deleteTitle"),
|
|
28
|
-
message: n("cms.builder.deleteField"),
|
|
29
|
-
type: "error",
|
|
30
|
-
onConfirm: () => {
|
|
31
|
-
u();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}, u = () => {
|
|
35
|
-
d.value = d.value.filter((g) => g.id !== c.item.id);
|
|
36
|
-
}, f = async () => {
|
|
37
|
-
if (await V.value.validate()) {
|
|
38
|
-
q({
|
|
39
|
-
type: "warning",
|
|
40
|
-
title: n("cms.common.actions.warning"),
|
|
41
|
-
message: n("cms.builder.editFieldFailed")
|
|
42
|
-
});
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
d.value = d.value.map(
|
|
46
|
-
(i) => i.id === c.item.id ? p.value : i
|
|
47
|
-
), m.value = !1;
|
|
48
|
-
};
|
|
49
|
-
return S(m, (g) => {
|
|
50
|
-
g && (p.value = c.item);
|
|
51
|
-
}), (g, i) => (a(), s("div", Y, [
|
|
52
|
-
r("button", {
|
|
53
|
-
class: "inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-8 w-8 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm",
|
|
54
|
-
onClick: i[0] || (i[0] = (t) => m.value = !0)
|
|
55
|
-
}, [
|
|
56
|
-
h(k(O), { class: "w-4 h-4" })
|
|
57
|
-
]),
|
|
58
|
-
r("button", {
|
|
59
|
-
onClick: v,
|
|
60
|
-
class: "inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-8 w-8 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"
|
|
61
|
-
}, [
|
|
62
|
-
h(k(P), { class: "w-4 h-4" })
|
|
63
|
-
]),
|
|
64
|
-
h(k(I), {
|
|
65
|
-
teleport: "#modal",
|
|
66
|
-
title: g.$t("cms.builder.editField"),
|
|
67
|
-
visible: m.value,
|
|
68
|
-
onClose: i[4] || (i[4] = (t) => m.value = !1)
|
|
69
|
-
}, {
|
|
70
|
-
footer: C(() => [
|
|
71
|
-
r("div", Z, [
|
|
72
|
-
r("button", {
|
|
73
|
-
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",
|
|
74
|
-
onClick: i[3] || (i[3] = (t) => m.value = !1)
|
|
75
|
-
}, x(g.$t("cms.common.actions.cancel")), 1),
|
|
76
|
-
r("button", {
|
|
77
|
-
onClick: f,
|
|
78
|
-
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"
|
|
79
|
-
}, x(g.$t("cms.common.actions.save")), 1)
|
|
80
|
-
])
|
|
81
|
-
]),
|
|
82
|
-
default: C(() => [
|
|
83
|
-
h(k(w), {
|
|
84
|
-
form: V.value,
|
|
85
|
-
"onUpdate:form": i[1] || (i[1] = (t) => V.value = t),
|
|
86
|
-
schema: b.colModel,
|
|
87
|
-
modelValue: p.value,
|
|
88
|
-
"onUpdate:modelValue": i[2] || (i[2] = (t) => p.value = t)
|
|
89
|
-
}, null, 8, ["form", "schema", "modelValue"])
|
|
90
|
-
]),
|
|
91
|
-
_: 1
|
|
92
|
-
}, 8, ["title", "visible"])
|
|
93
|
-
]));
|
|
94
|
-
}
|
|
95
|
-
}, K = { class: "p-6 border-t border-slate-200 dark:border-slate-700 bg-slate-50/30 dark:bg-slate-700/30" }, Q = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, W = {
|
|
96
|
-
__name: "vs-form-custom-datatable-add",
|
|
97
|
-
props: /* @__PURE__ */ _({
|
|
98
|
-
colModel: {
|
|
99
|
-
type: Array,
|
|
100
|
-
required: !0
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
modelValue: {
|
|
104
|
-
type: Array,
|
|
105
|
-
required: !0
|
|
106
|
-
},
|
|
107
|
-
modelModifiers: {}
|
|
108
|
-
}),
|
|
109
|
-
emits: ["update:modelValue"],
|
|
110
|
-
setup(b) {
|
|
111
|
-
const { t: n } = H(), w = E(() => import("@opengis/form")), c = A(b, "modelValue"), d = y(!1), m = y({}), p = y({}), V = async () => {
|
|
112
|
-
try {
|
|
113
|
-
if (await p.value.validate()) {
|
|
114
|
-
q({
|
|
115
|
-
type: "warning",
|
|
116
|
-
title: n("cms.common.actions.warning"),
|
|
117
|
-
message: n("cms.builder.editFieldFailed")
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
c.value = [
|
|
122
|
-
...c.value || [],
|
|
123
|
-
{ ...m.value, id: Math.random().toString(36).substring(2, 15) }
|
|
124
|
-
], d.value = !1, m.value = {};
|
|
125
|
-
} catch (v) {
|
|
126
|
-
console.log(v);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
return (v, u) => (a(), s("div", K, [
|
|
130
|
-
r("button", {
|
|
131
|
-
class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 shadow-sm h-9 px-4 w-full border-2 border-dashed border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-slate-50 dark:hover:bg-slate-600 hover:border-blue-400 dark:hover:border-blue-500 text-slate-600 dark:text-slate-300 hover:text-blue-600 dark:hover:text-blue-400 py-3 transition-all duration-200",
|
|
132
|
-
onClick: u[0] || (u[0] = (f) => d.value = !0)
|
|
133
|
-
}, [
|
|
134
|
-
h(k(G), { class: "w-4 h-4 mr-2" }),
|
|
135
|
-
U(" " + x(v.$t("cms.common.actions.add")), 1)
|
|
136
|
-
]),
|
|
137
|
-
h(k(I), {
|
|
138
|
-
teleport: "#modal",
|
|
139
|
-
title: v.$t("cms.common.actions.add"),
|
|
140
|
-
visible: d.value,
|
|
141
|
-
onClose: u[4] || (u[4] = (f) => d.value = !1)
|
|
142
|
-
}, {
|
|
143
|
-
footer: C(() => [
|
|
144
|
-
r("div", Q, [
|
|
145
|
-
r("button", {
|
|
146
|
-
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",
|
|
147
|
-
onClick: u[3] || (u[3] = (f) => d.value = !1)
|
|
148
|
-
}, x(v.$t("cms.common.actions.cancel")), 1),
|
|
149
|
-
r("button", {
|
|
150
|
-
onClick: V,
|
|
151
|
-
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"
|
|
152
|
-
}, x(v.$t("cms.common.actions.save")), 1)
|
|
153
|
-
])
|
|
154
|
-
]),
|
|
155
|
-
default: C(() => [
|
|
156
|
-
h(k(w), {
|
|
157
|
-
form: p.value,
|
|
158
|
-
"onUpdate:form": u[1] || (u[1] = (f) => p.value = f),
|
|
159
|
-
schema: b.colModel,
|
|
160
|
-
modelValue: m.value,
|
|
161
|
-
"onUpdate:modelValue": u[2] || (u[2] = (f) => m.value = f)
|
|
162
|
-
}, null, 8, ["form", "schema", "modelValue"])
|
|
163
|
-
]),
|
|
164
|
-
_: 1
|
|
165
|
-
}, 8, ["title", "visible"])
|
|
166
|
-
]));
|
|
167
|
-
}
|
|
168
|
-
}, ee = { class: "p-0 shadow w-full" }, te = { class: "overflow-x-auto" }, le = { class: "relative w-full overflow-auto" }, re = { class: "w-full caption-bottom text-sm" }, oe = { class: "[&_tr]:border-b" }, ae = { class: "border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors" }, se = { class: "h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-end" }, ne = { class: "[&_tr:last-child]:border-0" }, de = ["onDragstart", "onDragover", "onDrop", "onDragenter"], ie = { class: "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center" }, ue = { class: "flex items-center justify-center text-slate-400" }, ce = ["innerHTML"], me = {
|
|
169
|
-
key: 1,
|
|
170
|
-
class: "flex items-center gap-2"
|
|
171
|
-
}, be = {
|
|
172
|
-
key: 0,
|
|
173
|
-
class: "flex items-center gap-1"
|
|
174
|
-
}, ve = ["src", "alt"], ge = {
|
|
175
|
-
key: 0,
|
|
176
|
-
class: "text-xs text-gray-500 dark:text-gray-400 ml-1"
|
|
177
|
-
}, pe = {
|
|
178
|
-
key: 1,
|
|
179
|
-
class: "w-8 h-8 rounded bg-gray-100 dark:bg-gray-700 flex items-center justify-center"
|
|
180
|
-
}, fe = { key: 2 }, he = { class: "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]" }, xe = {
|
|
181
|
-
key: 0,
|
|
182
|
-
class: "h-2 bg-blue-200 dark:bg-blue-800 transition-all duration-200"
|
|
183
|
-
}, T = 3, Me = {
|
|
184
|
-
__name: "vs-form-custom-datatable",
|
|
185
|
-
props: /* @__PURE__ */ _({
|
|
186
|
-
colModel: {
|
|
187
|
-
type: Array,
|
|
188
|
-
required: !0
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
modelValue: {
|
|
192
|
-
type: Array,
|
|
193
|
-
required: !0
|
|
194
|
-
},
|
|
195
|
-
modelModifiers: {}
|
|
196
|
-
}),
|
|
197
|
-
emits: ["update:modelValue"],
|
|
198
|
-
setup(b) {
|
|
199
|
-
const n = A(b, "modelValue"), w = y(null), c = y(-1), d = y(!1), m = (t, l, e) => {
|
|
200
|
-
w.value = l, c.value = e, t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/html", "");
|
|
201
|
-
}, p = (t, l) => {
|
|
202
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move";
|
|
203
|
-
}, V = (t, l) => {
|
|
204
|
-
c.value !== l && (d.value = !0);
|
|
205
|
-
}, v = (t) => {
|
|
206
|
-
t.currentTarget.contains(t.relatedTarget) || (d.value = !1);
|
|
207
|
-
}, u = (t, l) => {
|
|
208
|
-
if (t.preventDefault(), d.value = !1, c.value === -1 || c.value === l)
|
|
209
|
-
return;
|
|
210
|
-
const e = [...n.value], [M] = e.splice(c.value, 1);
|
|
211
|
-
e.splice(l, 0, M), n.value = e, w.value = null, c.value = -1;
|
|
212
|
-
}, f = (t) => Array.isArray(t) ? t.slice(0, T) : [], g = (t) => Array.isArray(t) ? Math.max(0, t.length - T) : 0, i = (t) => {
|
|
213
|
-
const l = t.target;
|
|
214
|
-
l.style.display = "none";
|
|
215
|
-
const e = document.createElement("cms.div");
|
|
216
|
-
e.className = "w-full h-full flex items-center justify-center bg-gray-200 dark:bg-gray-600", e.innerHTML = `
|
|
217
|
-
<svg class="w-4 h-4 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
|
|
218
|
-
<path fill-rule="evenodd" d="M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z" clip-rule="evenodd" />
|
|
219
|
-
</svg>
|
|
220
|
-
`, l.parentNode.appendChild(e);
|
|
221
|
-
};
|
|
222
|
-
return z(() => {
|
|
223
|
-
var t, l;
|
|
224
|
-
(l = (t = n.value) == null ? void 0 : t.filter((e) => typeof e == "object")) == null || l.forEach(
|
|
225
|
-
(e) => e.id ? e.id : e.id = Math.random().toString(36).substring(2, 15)
|
|
226
|
-
);
|
|
227
|
-
}), (t, l) => (a(), s("div", ee, [
|
|
228
|
-
r("div", te, [
|
|
229
|
-
r("div", le, [
|
|
230
|
-
r("table", re, [
|
|
231
|
-
r("thead", oe, [
|
|
232
|
-
r("tr", ae, [
|
|
233
|
-
l[4] || (l[4] = r("th", { class: "h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center" }, null, -1)),
|
|
234
|
-
(a(!0), s(D, null, $(b.colModel, (e) => (a(), s("th", {
|
|
235
|
-
key: e.name,
|
|
236
|
-
class: "h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"
|
|
237
|
-
}, x(e.label || e.title || e.name), 1))), 128)),
|
|
238
|
-
r("th", se, x(t.$t("cms.table.actions")), 1)
|
|
239
|
-
])
|
|
240
|
-
]),
|
|
241
|
-
r("tbody", ne, [
|
|
242
|
-
(a(!0), s(D, null, $(n.value, (e, M) => (a(), s("tr", {
|
|
243
|
-
key: e == null ? void 0 : e.id,
|
|
244
|
-
class: B(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move", { "opacity-50": w.value === e }]),
|
|
245
|
-
draggable: "true",
|
|
246
|
-
onDragstart: (o) => m(o, e, M),
|
|
247
|
-
onDragover: (o) => p(o),
|
|
248
|
-
onDrop: (o) => u(o, M),
|
|
249
|
-
onDragenter: (o) => V(o, M),
|
|
250
|
-
onDragleave: l[2] || (l[2] = (o) => v(o))
|
|
251
|
-
}, [
|
|
252
|
-
r("td", ie, [
|
|
253
|
-
r("div", ue, [
|
|
254
|
-
h(k(R))
|
|
255
|
-
])
|
|
256
|
-
]),
|
|
257
|
-
(a(!0), s(D, null, $(b.colModel, (o) => (a(), s("td", {
|
|
258
|
-
key: o.name,
|
|
259
|
-
class: "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-slate-600 dark:text-slate-400 text-sm"
|
|
260
|
-
}, [
|
|
261
|
-
o.type === "Texteditor" ? (a(), s("span", {
|
|
262
|
-
key: 0,
|
|
263
|
-
innerHTML: e[o.key] || "-"
|
|
264
|
-
}, null, 8, ce)) : o.type === "File" ? (a(), s("div", me, [
|
|
265
|
-
Array.isArray(e[o.key]) && e[o.key].length > 0 ? (a(), s("div", be, [
|
|
266
|
-
(a(!0), s(D, null, $(f(e[o.key]), (L, F) => (a(), s("div", {
|
|
267
|
-
key: F,
|
|
268
|
-
class: "relative w-8 h-8 rounded overflow-hidden bg-gray-100 dark:bg-gray-700 flex-shrink-0"
|
|
269
|
-
}, [
|
|
270
|
-
r("img", {
|
|
271
|
-
src: L,
|
|
272
|
-
alt: `Image ${F + 1}`,
|
|
273
|
-
class: "w-full h-full object-cover",
|
|
274
|
-
onError: l[0] || (l[0] = (N) => i(N))
|
|
275
|
-
}, null, 40, ve)
|
|
276
|
-
]))), 128)),
|
|
277
|
-
g(e[o.key]) > 0 ? (a(), s("span", ge, " +" + x(g(e[o.key])), 1)) : j("", !0)
|
|
278
|
-
])) : (a(), s("div", pe, [...l[5] || (l[5] = [
|
|
279
|
-
r("svg", {
|
|
280
|
-
class: "w-4 h-4 text-gray-400",
|
|
281
|
-
fill: "currentColor",
|
|
282
|
-
viewBox: "0 0 20 20"
|
|
283
|
-
}, [
|
|
284
|
-
r("path", {
|
|
285
|
-
"fill-rule": "evenodd",
|
|
286
|
-
d: "M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z",
|
|
287
|
-
"clip-rule": "evenodd"
|
|
288
|
-
})
|
|
289
|
-
], -1)
|
|
290
|
-
])]))
|
|
291
|
-
])) : (a(), s("span", fe, x(e[o.key] || "-"), 1))
|
|
292
|
-
]))), 128)),
|
|
293
|
-
r("td", he, [
|
|
294
|
-
h(J, {
|
|
295
|
-
item: e,
|
|
296
|
-
colModel: b.colModel,
|
|
297
|
-
modelValue: n.value,
|
|
298
|
-
"onUpdate:modelValue": l[1] || (l[1] = (o) => n.value = o)
|
|
299
|
-
}, null, 8, ["item", "colModel", "modelValue"])
|
|
300
|
-
])
|
|
301
|
-
], 42, de))), 128)),
|
|
302
|
-
d.value ? (a(), s("tr", xe)) : j("", !0)
|
|
303
|
-
])
|
|
304
|
-
])
|
|
305
|
-
])
|
|
306
|
-
]),
|
|
307
|
-
h(W, {
|
|
308
|
-
colModel: b.colModel,
|
|
309
|
-
modelValue: n.value,
|
|
310
|
-
"onUpdate:modelValue": l[3] || (l[3] = (e) => n.value = e)
|
|
311
|
-
}, null, 8, ["colModel", "modelValue"])
|
|
312
|
-
]));
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
export {
|
|
316
|
-
Me as default
|
|
317
|
-
};
|