@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,14 +1,13 @@
|
|
|
1
|
-
import { ref as c, useModel as
|
|
2
|
-
import {
|
|
3
|
-
import { inputs as e, VForm as
|
|
4
|
-
import
|
|
5
|
-
import x from "./vs-form-reference-list-Dtv8fJJU.js";
|
|
1
|
+
import { ref as c, useModel as n, computed as d, openBlock as u, createElementBlock as _, createBlock as v, unref as g, createCommentVNode as k } from "vue";
|
|
2
|
+
import { _ as V, g as $ } from "./vs-form-custom-datatable-D880w8gx.js";
|
|
3
|
+
import { inputs as e, VForm as h } from "@opengis/form";
|
|
4
|
+
import x from "./vs-form-reference-list-hZufPxfE.js";
|
|
6
5
|
import { _ as B } from "./vs-form-tiptap.vue_vue_type_script_setup_true_lang-DGgsqXwg.js";
|
|
7
6
|
import r from "./vs-form-media-select-NY27EaG1.js";
|
|
8
7
|
import { _ as M } from "./vs-richtext-md.vue_vue_type_script_setup_true_lang-Ct8uTV-J.js";
|
|
9
8
|
import b from "./vs-form-integer-BZ855R3g.js";
|
|
10
9
|
import y from "./vs-form-reletion-link-BhzNQszm.js";
|
|
11
|
-
const
|
|
10
|
+
const z = {
|
|
12
11
|
__name: "vs-builder-preview",
|
|
13
12
|
props: {
|
|
14
13
|
data: {},
|
|
@@ -18,18 +17,18 @@ const A = {
|
|
|
18
17
|
},
|
|
19
18
|
emits: ["update:data", "update:form"],
|
|
20
19
|
setup(o) {
|
|
21
|
-
e["vs-input-custom-datatable"] =
|
|
22
|
-
const a = c({}), f =
|
|
20
|
+
e["vs-input-custom-datatable"] = V, e["vs-input-reference"] = x, e["vs-input-texteditor"] = B, e["vs-input-mediaselect"] = r, e["vs-input-file"] = r, e["vs-input-image"] = r, e["vs-input-richtext-md"] = M, e["vs-input-integer"] = b, e["vs-input-relation-link"] = y;
|
|
21
|
+
const a = c({}), f = n(o, "data"), l = n(o, "form"), i = d(() => {
|
|
23
22
|
var m, t;
|
|
24
|
-
return ((t = (m = f.value) == null ? void 0 : m.columns) == null ? void 0 : t.map(
|
|
23
|
+
return ((t = (m = f.value) == null ? void 0 : m.columns) == null ? void 0 : t.map($)) || [];
|
|
25
24
|
});
|
|
26
25
|
return (m, t) => {
|
|
27
|
-
var
|
|
28
|
-
return u(),
|
|
26
|
+
var s;
|
|
27
|
+
return u(), _("div", {
|
|
29
28
|
ref_key: "form",
|
|
30
29
|
ref: l
|
|
31
30
|
}, [
|
|
32
|
-
((
|
|
31
|
+
((s = i.value) == null ? void 0 : s.length) > 0 ? (u(), v(g(h), {
|
|
33
32
|
key: 0,
|
|
34
33
|
modelValue: a.value,
|
|
35
34
|
"onUpdate:modelValue": t[0] || (t[0] = (p) => a.value = p),
|
|
@@ -40,5 +39,5 @@ const A = {
|
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
41
|
export {
|
|
43
|
-
|
|
42
|
+
z as default
|
|
44
43
|
};
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { mergeModels as A, defineAsyncComponent as L, useModel as F, ref as w, watch as N, openBlock as c, createElementBlock as p, createElementVNode as s, createVNode as x, unref as V, withCtx as $, toDisplayString as k, createTextVNode as z, onMounted as B, Fragment as _, renderList as C, normalizeClass as O, createCommentVNode as j } from "vue";
|
|
2
|
+
import { Pencil as P, Trash2 as G, Plus as R, GripVertical as X } from "lucide-vue-next";
|
|
3
|
+
import { VsModal as q, confirm as Y, notify as E } from "@opengis/core";
|
|
4
|
+
import { useI18n as I } from "vue-i18n";
|
|
5
|
+
const Z = (e) => {
|
|
6
|
+
var m, u;
|
|
7
|
+
const t = (m = e == null ? void 0 : e.type) == null ? void 0 : m.toLowerCase(), r = e != null && e.required ? ["required"] : null;
|
|
8
|
+
return t === "array" ? {
|
|
9
|
+
key: e.name,
|
|
10
|
+
label: e.label || e.title,
|
|
11
|
+
type: "multi-text",
|
|
12
|
+
help: e == null ? void 0 : e.help,
|
|
13
|
+
colModel: {
|
|
14
|
+
type: (e == null ? void 0 : e.subtype) || "text",
|
|
15
|
+
placeholder: e == null ? void 0 : e.placeholder
|
|
16
|
+
},
|
|
17
|
+
validators: r
|
|
18
|
+
} : t === "boolean" ? {
|
|
19
|
+
key: e.name,
|
|
20
|
+
label: e.label || e.title,
|
|
21
|
+
type: "Switcher",
|
|
22
|
+
help: e == null ? void 0 : e.help,
|
|
23
|
+
validators: r
|
|
24
|
+
} : t === "tags" ? {
|
|
25
|
+
key: e.name,
|
|
26
|
+
label: e.label || e.title,
|
|
27
|
+
type: "tags",
|
|
28
|
+
help: e == null ? void 0 : e.help,
|
|
29
|
+
validators: r
|
|
30
|
+
} : t === "radio" ? {
|
|
31
|
+
key: e.name,
|
|
32
|
+
label: e.label || e.title,
|
|
33
|
+
type: "radio",
|
|
34
|
+
help: e == null ? void 0 : e.help,
|
|
35
|
+
options: e.options || [],
|
|
36
|
+
validators: r
|
|
37
|
+
} : t === "date" ? {
|
|
38
|
+
key: e.name,
|
|
39
|
+
label: e.label || e.title,
|
|
40
|
+
type: "Date",
|
|
41
|
+
time: !1,
|
|
42
|
+
help: e == null ? void 0 : e.help,
|
|
43
|
+
validators: r
|
|
44
|
+
} : t === "datetime" ? {
|
|
45
|
+
key: e.name,
|
|
46
|
+
label: e.label || e.title,
|
|
47
|
+
type: "Date",
|
|
48
|
+
help: e == null ? void 0 : e.help,
|
|
49
|
+
mode: "datetime",
|
|
50
|
+
time: !0,
|
|
51
|
+
validators: r
|
|
52
|
+
} : t === "number" ? {
|
|
53
|
+
key: e.name,
|
|
54
|
+
label: e.label || e.title,
|
|
55
|
+
help: e == null ? void 0 : e.help,
|
|
56
|
+
type: "Number",
|
|
57
|
+
validators: r
|
|
58
|
+
} : t === "integer" ? {
|
|
59
|
+
key: e.name,
|
|
60
|
+
label: e.label || e.title,
|
|
61
|
+
type: "Integer",
|
|
62
|
+
help: e == null ? void 0 : e.help,
|
|
63
|
+
validators: r
|
|
64
|
+
} : t === "text" ? {
|
|
65
|
+
key: e.name,
|
|
66
|
+
label: e.label || e.title,
|
|
67
|
+
type: "Text",
|
|
68
|
+
help: e == null ? void 0 : e.help,
|
|
69
|
+
validators: r
|
|
70
|
+
} : t === "file" ? {
|
|
71
|
+
key: e.name,
|
|
72
|
+
label: e.label || e.title,
|
|
73
|
+
type: "File",
|
|
74
|
+
multiple: e.multi || e.multiple,
|
|
75
|
+
help: e == null ? void 0 : e.help,
|
|
76
|
+
validators: r,
|
|
77
|
+
api: "/api/cms-media/upload?subdir=",
|
|
78
|
+
dir: "uploads/" + (/* @__PURE__ */ new Date()).toLocaleDateString("en-US").replace(/\//g, "-")
|
|
79
|
+
} : t === "filelist" ? {
|
|
80
|
+
key: e.name,
|
|
81
|
+
label: e.label || e.title,
|
|
82
|
+
type: "file",
|
|
83
|
+
multiple: !0,
|
|
84
|
+
help: e == null ? void 0 : e.help,
|
|
85
|
+
validators: r
|
|
86
|
+
} : t === "slug" ? {
|
|
87
|
+
key: e.name,
|
|
88
|
+
label: e.label || e.title,
|
|
89
|
+
type: "Slug",
|
|
90
|
+
parent: e.parent || "",
|
|
91
|
+
help: e == null ? void 0 : e.help,
|
|
92
|
+
validators: r
|
|
93
|
+
} : t === "image" ? {
|
|
94
|
+
key: e.name,
|
|
95
|
+
label: e.label || e.title,
|
|
96
|
+
type: "File",
|
|
97
|
+
multi: e.multiple,
|
|
98
|
+
help: e == null ? void 0 : e.help,
|
|
99
|
+
validators: r,
|
|
100
|
+
api: "/api/cms-media/upload?subdir=",
|
|
101
|
+
dir: "uploads/" + (/* @__PURE__ */ new Date()).toLocaleDateString("en-US").replace(/\//g, "-")
|
|
102
|
+
} : t === "select" ? e.options ? {
|
|
103
|
+
key: e.name,
|
|
104
|
+
label: e.label || e.title,
|
|
105
|
+
type: "select",
|
|
106
|
+
options: e.options || [],
|
|
107
|
+
help: e == null ? void 0 : e.help,
|
|
108
|
+
validators: r
|
|
109
|
+
} : {
|
|
110
|
+
key: e.name,
|
|
111
|
+
label: e.label || e.title,
|
|
112
|
+
type: "select",
|
|
113
|
+
data: e.data || [],
|
|
114
|
+
help: e == null ? void 0 : e.help,
|
|
115
|
+
validators: r
|
|
116
|
+
} : t === "multiselect" ? {
|
|
117
|
+
key: e.name,
|
|
118
|
+
label: e.label || e.title,
|
|
119
|
+
type: "select",
|
|
120
|
+
data: e.data || [],
|
|
121
|
+
parent: e.parent || "",
|
|
122
|
+
options: e.options || [],
|
|
123
|
+
help: e == null ? void 0 : e.help,
|
|
124
|
+
validators: r,
|
|
125
|
+
multiple: !0
|
|
126
|
+
} : t === "richtext" ? {
|
|
127
|
+
key: e.name,
|
|
128
|
+
label: e.label || e.title,
|
|
129
|
+
type: "Texteditor",
|
|
130
|
+
help: e == null ? void 0 : e.help,
|
|
131
|
+
validators: r
|
|
132
|
+
} : t === "datalist" ? {
|
|
133
|
+
key: e.name,
|
|
134
|
+
label: e.label || e.title,
|
|
135
|
+
type: "Custom-Datatable",
|
|
136
|
+
colModel: ((u = e.colModel) == null ? void 0 : u.map((b) => Z(b))) || [],
|
|
137
|
+
help: e == null ? void 0 : e.help,
|
|
138
|
+
validators: r
|
|
139
|
+
} : t === "reference" ? {
|
|
140
|
+
key: e.name,
|
|
141
|
+
label: e.label || e.title,
|
|
142
|
+
type: "reference",
|
|
143
|
+
reference_type: e.reference_type,
|
|
144
|
+
help: e == null ? void 0 : e.help,
|
|
145
|
+
validators: r
|
|
146
|
+
} : t === "reference-list" ? {
|
|
147
|
+
key: e.name,
|
|
148
|
+
label: e.label || e.title,
|
|
149
|
+
type: "reference",
|
|
150
|
+
reference_type: e.reference_type,
|
|
151
|
+
help: e == null ? void 0 : e.help,
|
|
152
|
+
validators: r
|
|
153
|
+
} : t === "relation" ? {
|
|
154
|
+
key: e.name,
|
|
155
|
+
label: e.label || e.title,
|
|
156
|
+
type: "relation-link",
|
|
157
|
+
help: e == null ? void 0 : e.help,
|
|
158
|
+
relation: e.relation,
|
|
159
|
+
validators: r
|
|
160
|
+
} : t === "markdown" ? {
|
|
161
|
+
key: e.name,
|
|
162
|
+
label: e.label || e.title,
|
|
163
|
+
type: "richtext-md",
|
|
164
|
+
help: e == null ? void 0 : e.help,
|
|
165
|
+
validators: r
|
|
166
|
+
} : t === "mediaselect" ? {
|
|
167
|
+
key: e.name,
|
|
168
|
+
label: e.label || e.title,
|
|
169
|
+
type: "mediaselect",
|
|
170
|
+
help: e == null ? void 0 : e.help,
|
|
171
|
+
validators: r
|
|
172
|
+
} : {
|
|
173
|
+
key: e.name,
|
|
174
|
+
label: e.label || e.title,
|
|
175
|
+
placeholder: e.placeholder,
|
|
176
|
+
help: e == null ? void 0 : e.help,
|
|
177
|
+
type: "Text",
|
|
178
|
+
validators: r
|
|
179
|
+
};
|
|
180
|
+
}, J = { class: "flex items-center justify-end gap-2" }, K = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, Q = {
|
|
181
|
+
__name: "vs-form-custom-datatable-controls",
|
|
182
|
+
props: /* @__PURE__ */ A({
|
|
183
|
+
item: {
|
|
184
|
+
type: Object,
|
|
185
|
+
required: !0
|
|
186
|
+
},
|
|
187
|
+
colModel: {
|
|
188
|
+
type: Array,
|
|
189
|
+
required: !0
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
modelValue: {
|
|
193
|
+
type: Array,
|
|
194
|
+
required: !0
|
|
195
|
+
},
|
|
196
|
+
modelModifiers: {}
|
|
197
|
+
}),
|
|
198
|
+
emits: ["update:modelValue"],
|
|
199
|
+
setup(e) {
|
|
200
|
+
const { t } = I(), r = L(() => import("@opengis/form")), m = e, u = F(e, "modelValue"), b = w(!1), g = w({}), M = w({}), y = () => {
|
|
201
|
+
Y({
|
|
202
|
+
title: t("cms.builder.deleteTitle"),
|
|
203
|
+
message: t("cms.builder.deleteField"),
|
|
204
|
+
type: "error",
|
|
205
|
+
onConfirm: () => {
|
|
206
|
+
h();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}, h = () => {
|
|
210
|
+
u.value = u.value.filter((v) => v.id !== m.item.id);
|
|
211
|
+
}, d = async () => {
|
|
212
|
+
if (await M.value.validate()) {
|
|
213
|
+
E({
|
|
214
|
+
type: "warning",
|
|
215
|
+
title: t("cms.common.actions.warning"),
|
|
216
|
+
message: t("cms.builder.editFieldFailed")
|
|
217
|
+
});
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
u.value = u.value.map(
|
|
221
|
+
(i) => i.id === m.item.id ? g.value : i
|
|
222
|
+
), b.value = !1;
|
|
223
|
+
};
|
|
224
|
+
return N(b, (v) => {
|
|
225
|
+
v && (g.value = m.item);
|
|
226
|
+
}), (v, i) => (c(), p("div", J, [
|
|
227
|
+
s("button", {
|
|
228
|
+
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",
|
|
229
|
+
onClick: i[0] || (i[0] = (o) => b.value = !0)
|
|
230
|
+
}, [
|
|
231
|
+
x(V(P), { class: "w-4 h-4" })
|
|
232
|
+
]),
|
|
233
|
+
s("button", {
|
|
234
|
+
onClick: y,
|
|
235
|
+
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"
|
|
236
|
+
}, [
|
|
237
|
+
x(V(G), { class: "w-4 h-4" })
|
|
238
|
+
]),
|
|
239
|
+
x(V(q), {
|
|
240
|
+
teleport: "#modal",
|
|
241
|
+
title: v.$t("cms.builder.editField"),
|
|
242
|
+
visible: b.value,
|
|
243
|
+
onClose: i[4] || (i[4] = (o) => b.value = !1)
|
|
244
|
+
}, {
|
|
245
|
+
footer: $(() => [
|
|
246
|
+
s("div", K, [
|
|
247
|
+
s("button", {
|
|
248
|
+
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",
|
|
249
|
+
onClick: i[3] || (i[3] = (o) => b.value = !1)
|
|
250
|
+
}, k(v.$t("cms.common.actions.cancel")), 1),
|
|
251
|
+
s("button", {
|
|
252
|
+
onClick: d,
|
|
253
|
+
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"
|
|
254
|
+
}, k(v.$t("cms.common.actions.save")), 1)
|
|
255
|
+
])
|
|
256
|
+
]),
|
|
257
|
+
default: $(() => [
|
|
258
|
+
x(V(r), {
|
|
259
|
+
form: M.value,
|
|
260
|
+
"onUpdate:form": i[1] || (i[1] = (o) => M.value = o),
|
|
261
|
+
schema: e.colModel,
|
|
262
|
+
modelValue: g.value,
|
|
263
|
+
"onUpdate:modelValue": i[2] || (i[2] = (o) => g.value = o)
|
|
264
|
+
}, null, 8, ["form", "schema", "modelValue"])
|
|
265
|
+
]),
|
|
266
|
+
_: 1
|
|
267
|
+
}, 8, ["title", "visible"])
|
|
268
|
+
]));
|
|
269
|
+
}
|
|
270
|
+
}, W = { class: "p-6 border-t border-slate-200 dark:border-slate-700 bg-slate-50/30 dark:bg-slate-700/30" }, f = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, ee = {
|
|
271
|
+
__name: "vs-form-custom-datatable-add",
|
|
272
|
+
props: /* @__PURE__ */ A({
|
|
273
|
+
colModel: {
|
|
274
|
+
type: Array,
|
|
275
|
+
required: !0
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
modelValue: {
|
|
279
|
+
type: Array,
|
|
280
|
+
required: !0
|
|
281
|
+
},
|
|
282
|
+
modelModifiers: {}
|
|
283
|
+
}),
|
|
284
|
+
emits: ["update:modelValue"],
|
|
285
|
+
setup(e) {
|
|
286
|
+
const { t } = I(), r = L(() => import("@opengis/form")), m = F(e, "modelValue"), u = w(!1), b = w({}), g = w({}), M = async () => {
|
|
287
|
+
try {
|
|
288
|
+
if (await g.value.validate()) {
|
|
289
|
+
E({
|
|
290
|
+
type: "warning",
|
|
291
|
+
title: t("cms.common.actions.warning"),
|
|
292
|
+
message: t("cms.builder.editFieldFailed")
|
|
293
|
+
});
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
m.value = [
|
|
297
|
+
...m.value || [],
|
|
298
|
+
{ ...b.value, id: Math.random().toString(36).substring(2, 15) }
|
|
299
|
+
], u.value = !1, b.value = {};
|
|
300
|
+
} catch (y) {
|
|
301
|
+
console.log(y);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
return (y, h) => (c(), p("div", W, [
|
|
305
|
+
s("button", {
|
|
306
|
+
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",
|
|
307
|
+
onClick: h[0] || (h[0] = (d) => u.value = !0)
|
|
308
|
+
}, [
|
|
309
|
+
x(V(R), { class: "w-4 h-4 mr-2" }),
|
|
310
|
+
z(" " + k(y.$t("cms.common.actions.add")), 1)
|
|
311
|
+
]),
|
|
312
|
+
x(V(q), {
|
|
313
|
+
teleport: "#modal",
|
|
314
|
+
title: y.$t("cms.common.actions.add"),
|
|
315
|
+
visible: u.value,
|
|
316
|
+
onClose: h[4] || (h[4] = (d) => u.value = !1)
|
|
317
|
+
}, {
|
|
318
|
+
footer: $(() => [
|
|
319
|
+
s("div", f, [
|
|
320
|
+
s("button", {
|
|
321
|
+
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",
|
|
322
|
+
onClick: h[3] || (h[3] = (d) => u.value = !1)
|
|
323
|
+
}, k(y.$t("cms.common.actions.cancel")), 1),
|
|
324
|
+
s("button", {
|
|
325
|
+
onClick: M,
|
|
326
|
+
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"
|
|
327
|
+
}, k(y.$t("cms.common.actions.save")), 1)
|
|
328
|
+
])
|
|
329
|
+
]),
|
|
330
|
+
default: $(() => [
|
|
331
|
+
x(V(r), {
|
|
332
|
+
form: g.value,
|
|
333
|
+
"onUpdate:form": h[1] || (h[1] = (d) => g.value = d),
|
|
334
|
+
schema: e.colModel,
|
|
335
|
+
modelValue: b.value,
|
|
336
|
+
"onUpdate:modelValue": h[2] || (h[2] = (d) => b.value = d)
|
|
337
|
+
}, null, 8, ["form", "schema", "modelValue"])
|
|
338
|
+
]),
|
|
339
|
+
_: 1
|
|
340
|
+
}, 8, ["title", "visible"])
|
|
341
|
+
]));
|
|
342
|
+
}
|
|
343
|
+
}, te = { class: "p-0 shadow w-full" }, ae = { class: "overflow-x-auto" }, re = { class: "relative w-full overflow-auto" }, oe = { class: "w-full caption-bottom text-sm" }, le = { class: "[&_tr]:border-b" }, se = { 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" }, ne = { 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" }, ue = { class: "[&_tr:last-child]:border-0" }, ce = ["onDragstart", "onDragover", "onDrop", "onDragenter"], pe = { class: "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center" }, me = { class: "flex items-center justify-center text-slate-400" }, be = ["innerHTML"], ie = {
|
|
344
|
+
key: 1,
|
|
345
|
+
class: "flex items-center gap-2"
|
|
346
|
+
}, he = {
|
|
347
|
+
key: 0,
|
|
348
|
+
class: "flex items-center gap-1"
|
|
349
|
+
}, ye = ["src", "alt"], ve = {
|
|
350
|
+
key: 0,
|
|
351
|
+
class: "text-xs text-gray-500 dark:text-gray-400 ml-1"
|
|
352
|
+
}, ge = {
|
|
353
|
+
key: 1,
|
|
354
|
+
class: "w-8 h-8 rounded bg-gray-100 dark:bg-gray-700 flex items-center justify-center"
|
|
355
|
+
}, de = { key: 2 }, xe = { class: "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]" }, ke = {
|
|
356
|
+
key: 0,
|
|
357
|
+
class: "h-2 bg-blue-200 dark:bg-blue-800 transition-all duration-200"
|
|
358
|
+
}, S = 3, _e = {
|
|
359
|
+
__name: "vs-form-custom-datatable",
|
|
360
|
+
props: /* @__PURE__ */ A({
|
|
361
|
+
colModel: {
|
|
362
|
+
type: Array,
|
|
363
|
+
required: !0
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
modelValue: {
|
|
367
|
+
type: Array,
|
|
368
|
+
required: !0
|
|
369
|
+
},
|
|
370
|
+
modelModifiers: {}
|
|
371
|
+
}),
|
|
372
|
+
emits: ["update:modelValue"],
|
|
373
|
+
setup(e) {
|
|
374
|
+
const t = F(e, "modelValue"), r = w(null), m = w(-1), u = w(!1), b = (o, l, a) => {
|
|
375
|
+
r.value = l, m.value = a, o.dataTransfer.effectAllowed = "move", o.dataTransfer.setData("text/html", "");
|
|
376
|
+
}, g = (o, l) => {
|
|
377
|
+
o.preventDefault(), o.dataTransfer.dropEffect = "move";
|
|
378
|
+
}, M = (o, l) => {
|
|
379
|
+
m.value !== l && (u.value = !0);
|
|
380
|
+
}, y = (o) => {
|
|
381
|
+
o.currentTarget.contains(o.relatedTarget) || (u.value = !1);
|
|
382
|
+
}, h = (o, l) => {
|
|
383
|
+
if (o.preventDefault(), u.value = !1, m.value === -1 || m.value === l)
|
|
384
|
+
return;
|
|
385
|
+
const a = [...t.value], [D] = a.splice(m.value, 1);
|
|
386
|
+
a.splice(l, 0, D), t.value = a, r.value = null, m.value = -1;
|
|
387
|
+
}, d = (o) => Array.isArray(o) ? o.slice(0, S) : [], v = (o) => Array.isArray(o) ? Math.max(0, o.length - S) : 0, i = (o) => {
|
|
388
|
+
const l = o.target;
|
|
389
|
+
l.style.display = "none";
|
|
390
|
+
const a = document.createElement("cms.div");
|
|
391
|
+
a.className = "w-full h-full flex items-center justify-center bg-gray-200 dark:bg-gray-600", a.innerHTML = `
|
|
392
|
+
<svg class="w-4 h-4 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
|
|
393
|
+
<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" />
|
|
394
|
+
</svg>
|
|
395
|
+
`, l.parentNode.appendChild(a);
|
|
396
|
+
};
|
|
397
|
+
return B(() => {
|
|
398
|
+
var o, l;
|
|
399
|
+
(l = (o = t.value) == null ? void 0 : o.filter((a) => typeof a == "object")) == null || l.forEach(
|
|
400
|
+
(a) => a.id ? a.id : a.id = Math.random().toString(36).substring(2, 15)
|
|
401
|
+
);
|
|
402
|
+
}), (o, l) => (c(), p("div", te, [
|
|
403
|
+
s("div", ae, [
|
|
404
|
+
s("div", re, [
|
|
405
|
+
s("table", oe, [
|
|
406
|
+
s("thead", le, [
|
|
407
|
+
s("tr", se, [
|
|
408
|
+
l[4] || (l[4] = s("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)),
|
|
409
|
+
(c(!0), p(_, null, C(e.colModel, (a) => (c(), p("th", {
|
|
410
|
+
key: a.name,
|
|
411
|
+
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]"
|
|
412
|
+
}, k(a.label || a.title || a.name), 1))), 128)),
|
|
413
|
+
s("th", ne, k(o.$t("cms.table.actions")), 1)
|
|
414
|
+
])
|
|
415
|
+
]),
|
|
416
|
+
s("tbody", ue, [
|
|
417
|
+
(c(!0), p(_, null, C(t.value, (a, D) => (c(), p("tr", {
|
|
418
|
+
key: a == null ? void 0 : a.id,
|
|
419
|
+
class: O(["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": r.value === a }]),
|
|
420
|
+
draggable: "true",
|
|
421
|
+
onDragstart: (n) => b(n, a, D),
|
|
422
|
+
onDragover: (n) => g(n),
|
|
423
|
+
onDrop: (n) => h(n, D),
|
|
424
|
+
onDragenter: (n) => M(n, D),
|
|
425
|
+
onDragleave: l[2] || (l[2] = (n) => y(n))
|
|
426
|
+
}, [
|
|
427
|
+
s("td", pe, [
|
|
428
|
+
s("div", me, [
|
|
429
|
+
x(V(X))
|
|
430
|
+
])
|
|
431
|
+
]),
|
|
432
|
+
(c(!0), p(_, null, C(e.colModel, (n) => (c(), p("td", {
|
|
433
|
+
key: n.name,
|
|
434
|
+
class: "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-slate-600 dark:text-slate-400 text-sm"
|
|
435
|
+
}, [
|
|
436
|
+
n.type === "Texteditor" ? (c(), p("span", {
|
|
437
|
+
key: 0,
|
|
438
|
+
innerHTML: a[n.key] || "-"
|
|
439
|
+
}, null, 8, be)) : n.type === "File" ? (c(), p("div", ie, [
|
|
440
|
+
Array.isArray(a[n.key]) && a[n.key].length > 0 ? (c(), p("div", he, [
|
|
441
|
+
(c(!0), p(_, null, C(d(a[n.key]), (U, T) => (c(), p("div", {
|
|
442
|
+
key: T,
|
|
443
|
+
class: "relative w-8 h-8 rounded overflow-hidden bg-gray-100 dark:bg-gray-700 flex-shrink-0"
|
|
444
|
+
}, [
|
|
445
|
+
s("img", {
|
|
446
|
+
src: U,
|
|
447
|
+
alt: `Image ${T + 1}`,
|
|
448
|
+
class: "w-full h-full object-cover",
|
|
449
|
+
onError: l[0] || (l[0] = (H) => i(H))
|
|
450
|
+
}, null, 40, ye)
|
|
451
|
+
]))), 128)),
|
|
452
|
+
v(a[n.key]) > 0 ? (c(), p("span", ve, " +" + k(v(a[n.key])), 1)) : j("", !0)
|
|
453
|
+
])) : (c(), p("div", ge, [...l[5] || (l[5] = [
|
|
454
|
+
s("svg", {
|
|
455
|
+
class: "w-4 h-4 text-gray-400",
|
|
456
|
+
fill: "currentColor",
|
|
457
|
+
viewBox: "0 0 20 20"
|
|
458
|
+
}, [
|
|
459
|
+
s("path", {
|
|
460
|
+
"fill-rule": "evenodd",
|
|
461
|
+
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",
|
|
462
|
+
"clip-rule": "evenodd"
|
|
463
|
+
})
|
|
464
|
+
], -1)
|
|
465
|
+
])]))
|
|
466
|
+
])) : (c(), p("span", de, k(a[n.key] || "-"), 1))
|
|
467
|
+
]))), 128)),
|
|
468
|
+
s("td", xe, [
|
|
469
|
+
x(Q, {
|
|
470
|
+
item: a,
|
|
471
|
+
colModel: e.colModel,
|
|
472
|
+
modelValue: t.value,
|
|
473
|
+
"onUpdate:modelValue": l[1] || (l[1] = (n) => t.value = n)
|
|
474
|
+
}, null, 8, ["item", "colModel", "modelValue"])
|
|
475
|
+
])
|
|
476
|
+
], 42, ce))), 128)),
|
|
477
|
+
u.value ? (c(), p("tr", ke)) : j("", !0)
|
|
478
|
+
])
|
|
479
|
+
])
|
|
480
|
+
])
|
|
481
|
+
]),
|
|
482
|
+
x(ee, {
|
|
483
|
+
colModel: e.colModel,
|
|
484
|
+
modelValue: t.value,
|
|
485
|
+
"onUpdate:modelValue": l[3] || (l[3] = (a) => t.value = a)
|
|
486
|
+
}, null, 8, ["colModel", "modelValue"])
|
|
487
|
+
]));
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
export {
|
|
491
|
+
_e as _,
|
|
492
|
+
Z as g
|
|
493
|
+
};
|