@opengis/admin 0.3.69 → 0.3.70
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/add-page-DrW4HvNl.js +126 -0
- package/dist/{admin-interface-B5Qi_7Tg.js → admin-interface-IFxDrzbG.js} +1 -1
- package/dist/{admin-view-D9N7IOYE.js → admin-view-Biw3y3VC.js} +1 -1
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +1 -1
- package/dist/{card-view-BJr6noRt.js → card-view-DhbJ0PJ0.js} +1 -1
- package/dist/edit-page-B3y18L5i.js +154 -0
- package/dist/{import-file-Ch8huzhb.js → import-file-C9RmOGhX.js} +7 -7
- package/dist/{profile-page-B0oQUepx.js → profile-page-Bn9naG_j.js} +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/server/helpers/list/descriptionList.js +23 -7
- package/dist/add-page-CgHg3dNM.js +0 -127
- package/dist/edit-page-BPbIUzpb.js +0 -145
@@ -0,0 +1,154 @@
|
|
1
|
+
import { _ as $, e as d, u as k, s as V } from "./import-file-C9RmOGhX.js";
|
2
|
+
import { resolveComponent as j, createElementBlock as g, openBlock as p, createElementVNode as m, createCommentVNode as b, normalizeClass as x, normalizeStyle as y, createBlock as E } from "vue";
|
3
|
+
const O = {
|
4
|
+
data() {
|
5
|
+
return {
|
6
|
+
formValues: {},
|
7
|
+
scheme: null,
|
8
|
+
table: "",
|
9
|
+
token: "",
|
10
|
+
style: null
|
11
|
+
};
|
12
|
+
},
|
13
|
+
mounted() {
|
14
|
+
this.getFormScheme();
|
15
|
+
},
|
16
|
+
computed: {
|
17
|
+
color() {
|
18
|
+
return V.value.buttonColor || "blue";
|
19
|
+
}
|
20
|
+
},
|
21
|
+
methods: {
|
22
|
+
flattenMenu(t) {
|
23
|
+
const e = [];
|
24
|
+
return t.forEach((n) => {
|
25
|
+
n.menu ? e.push(...this.flattenMenu(n.menu)) : e.push(n);
|
26
|
+
}), e;
|
27
|
+
},
|
28
|
+
async getFormScheme() {
|
29
|
+
var i, r;
|
30
|
+
const t = this.flattenMenu(k.value);
|
31
|
+
t != null && t.length || this.$router.replace("/404");
|
32
|
+
const e = t == null ? void 0 : t.find((s) => {
|
33
|
+
var a, o;
|
34
|
+
return (s == null ? void 0 : s.path) == ((o = (a = this.$route) == null ? void 0 : a.query) == null ? void 0 : o.table);
|
35
|
+
});
|
36
|
+
e || this.$router.replace("/404");
|
37
|
+
const n = e == null ? void 0 : e.table;
|
38
|
+
this.table = n;
|
39
|
+
try {
|
40
|
+
const {
|
41
|
+
data: { form: s }
|
42
|
+
} = await d.get(`/api/template/table/${n}`), { data: a } = await d.get(
|
43
|
+
`/api/table/${this.table}/${(r = (i = this.$route) == null ? void 0 : i.query) == null ? void 0 : r.id}`
|
44
|
+
);
|
45
|
+
this.token = (a == null ? void 0 : a.token) || "", this.formValues = a || {};
|
46
|
+
const { data: o } = await d.get(`/api/template/form/${s}`);
|
47
|
+
this.scheme = (o == null ? void 0 : o.schema) || o, this.style = (o == null ? void 0 : o.style) || null;
|
48
|
+
} catch {
|
49
|
+
}
|
50
|
+
},
|
51
|
+
async onlyEditObject() {
|
52
|
+
var e, n, i, r, s, a, o, u, l, c, f;
|
53
|
+
const t = (n = (e = this.$refs.form) == null ? void 0 : e.$refs) == null ? void 0 : n.form;
|
54
|
+
try {
|
55
|
+
await t.doValidation(), await d.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
|
56
|
+
title: "Успішно!",
|
57
|
+
message: "Об'єкт успішно створено",
|
58
|
+
type: "success"
|
59
|
+
});
|
60
|
+
} catch (h) {
|
61
|
+
const w = ((i = h == null ? void 0 : h.response) == null ? void 0 : i.data) || "";
|
62
|
+
let v = ((o = (a = (s = (r = Object.entries(t == null ? void 0 : t.formErrors)) == null ? void 0 : r[0]) == null ? void 0 : s[1]) == null ? void 0 : a[0]) == null ? void 0 : o.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (f = (c = (l = (u = Object.entries(t == null ? void 0 : t.formErrors)) == null ? void 0 : u[0]) == null ? void 0 : l[1]) == null ? void 0 : c[0]) == null ? void 0 : f.message;
|
63
|
+
this.$notify({
|
64
|
+
title: "Помилка!",
|
65
|
+
message: w || v || "Сталася помилка валідаціі",
|
66
|
+
type: "error"
|
67
|
+
});
|
68
|
+
}
|
69
|
+
},
|
70
|
+
getGroupedErrorNotification(t, e) {
|
71
|
+
if (!t || !e) return "";
|
72
|
+
const n = {};
|
73
|
+
return Object.entries(t).forEach(([r, s]) => {
|
74
|
+
var o;
|
75
|
+
const a = ((o = e[r]) == null ? void 0 : o.ua) || r;
|
76
|
+
s.forEach((u) => {
|
77
|
+
const l = u.message;
|
78
|
+
n[l] || (n[l] = []), n[l].push(`"${a}"`);
|
79
|
+
});
|
80
|
+
}), Object.entries(n).map(([r, s]) => `<b>${r}:</b> ${s.join(", ")}`).join("<br>") || "Сталася помилка валідації";
|
81
|
+
},
|
82
|
+
async editObjectAndRedirect(t = !0) {
|
83
|
+
var n, i;
|
84
|
+
const e = (i = (n = this.$refs.form) == null ? void 0 : n.$refs) == null ? void 0 : i.form;
|
85
|
+
try {
|
86
|
+
t && await e.doValidation(), await d.put(
|
87
|
+
`/api/table/${this.token}${t ? "" : "?draft=1"}`,
|
88
|
+
this.formValues
|
89
|
+
), await this.$router.back(), await this.$notify({
|
90
|
+
title: "Успішно!",
|
91
|
+
message: "Об'єкт успішно створено",
|
92
|
+
type: "success"
|
93
|
+
});
|
94
|
+
} catch {
|
95
|
+
const s = this.getGroupedErrorNotification(
|
96
|
+
e == null ? void 0 : e.formErrors,
|
97
|
+
e == null ? void 0 : e.scheme
|
98
|
+
);
|
99
|
+
this.$notify({
|
100
|
+
title: "Помилка!",
|
101
|
+
message: s,
|
102
|
+
type: "error"
|
103
|
+
});
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}, C = { class: "bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]" }, M = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, _ = { class: "flex items-center gap-[6px]" }, N = { class: "bg-white w-full rounded-xl" };
|
108
|
+
function A(t, e, n, i, r, s) {
|
109
|
+
var o, u, l;
|
110
|
+
const a = j("VsFormWithNavigation");
|
111
|
+
return p(), g("div", C, [
|
112
|
+
m("div", M, [
|
113
|
+
e[4] || (e[4] = m("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
|
114
|
+
m("div", _, [
|
115
|
+
m("button", {
|
116
|
+
onClick: e[0] || (e[0] = (c) => t.$router.back()),
|
117
|
+
class: "flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"
|
118
|
+
}, " Скасувати "),
|
119
|
+
(o = r.style) != null && o.draft ? (p(), g("button", {
|
120
|
+
key: 0,
|
121
|
+
onClick: e[1] || (e[1] = (c) => s.editObjectAndRedirect(!1)),
|
122
|
+
class: x(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${s.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${s.color}-800 hover:text-white`)
|
123
|
+
}, " Зберегти DRAFT ", 2)) : b("", !0),
|
124
|
+
m("button", {
|
125
|
+
onClick: e[2] || (e[2] = (...c) => s.editObjectAndRedirect && s.editObjectAndRedirect(...c)),
|
126
|
+
class: x(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${s.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${s.color}-800 hover:text-white`)
|
127
|
+
}, " Зберегти ", 2)
|
128
|
+
])
|
129
|
+
]),
|
130
|
+
m("div", {
|
131
|
+
style: y({
|
132
|
+
height: ((u = t.$adminSettings) == null ? void 0 : u.header) === !1 ? "calc(100vh - 100px)" : "calc(100vh - 150px)"
|
133
|
+
}),
|
134
|
+
class: "bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"
|
135
|
+
}, [
|
136
|
+
m("div", N, [
|
137
|
+
r.scheme ? (p(), E(a, {
|
138
|
+
key: 0,
|
139
|
+
ref: "form",
|
140
|
+
scheme: r.scheme,
|
141
|
+
columns: (l = r.style) == null ? void 0 : l.columns,
|
142
|
+
style: y(r.style),
|
143
|
+
modelValue: r.formValues,
|
144
|
+
"onUpdate:modelValue": e[3] || (e[3] = (c) => r.formValues = c),
|
145
|
+
class: "p-[20px] h-full"
|
146
|
+
}, null, 8, ["scheme", "columns", "style", "modelValue"])) : b("", !0)
|
147
|
+
])
|
148
|
+
], 4)
|
149
|
+
]);
|
150
|
+
}
|
151
|
+
const B = /* @__PURE__ */ $(O, [["render", A]]);
|
152
|
+
export {
|
153
|
+
B as default
|
154
|
+
};
|
@@ -3724,27 +3724,27 @@ const lB = [
|
|
3724
3724
|
{
|
3725
3725
|
name: "edit",
|
3726
3726
|
path: "/edit",
|
3727
|
-
component: () => import("./edit-page-
|
3727
|
+
component: () => import("./edit-page-B3y18L5i.js")
|
3728
3728
|
},
|
3729
3729
|
{
|
3730
3730
|
name: "add",
|
3731
3731
|
path: "/add",
|
3732
|
-
component: () => import("./add-page-
|
3732
|
+
component: () => import("./add-page-DrW4HvNl.js")
|
3733
3733
|
},
|
3734
3734
|
{
|
3735
3735
|
path: "/profile",
|
3736
3736
|
name: "profile",
|
3737
|
-
component: () => import("./profile-page-
|
3737
|
+
component: () => import("./profile-page-Bn9naG_j.js")
|
3738
3738
|
},
|
3739
3739
|
{
|
3740
3740
|
name: "card-view",
|
3741
3741
|
path: "/card",
|
3742
|
-
component: () => import("./card-view-
|
3742
|
+
component: () => import("./card-view-DhbJ0PJ0.js"),
|
3743
3743
|
children: [
|
3744
3744
|
{
|
3745
3745
|
name: "table",
|
3746
3746
|
path: ":table",
|
3747
|
-
component: () => import("./card-view-
|
3747
|
+
component: () => import("./card-view-DhbJ0PJ0.js"),
|
3748
3748
|
children: [
|
3749
3749
|
{
|
3750
3750
|
name: "card",
|
@@ -3805,14 +3805,14 @@ const fB = /* @__PURE__ */ ft(cB, [["render", hB]]), pB = (t) => {
|
|
3805
3805
|
{
|
3806
3806
|
path: "/",
|
3807
3807
|
name: "home",
|
3808
|
-
component: () => import("./admin-view-
|
3808
|
+
component: () => import("./admin-view-Biw3y3VC.js"),
|
3809
3809
|
children: [
|
3810
3810
|
...e,
|
3811
3811
|
...t,
|
3812
3812
|
// { path: '/', redirect: '/home' },
|
3813
3813
|
{
|
3814
3814
|
path: "/:catchAll(.*)",
|
3815
|
-
component: () => import("./admin-interface-
|
3815
|
+
component: () => import("./admin-interface-IFxDrzbG.js")
|
3816
3816
|
}
|
3817
3817
|
]
|
3818
3818
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { _ as n, e as m } from "./import-file-
|
1
|
+
import { _ as n, e as m } from "./import-file-C9RmOGhX.js";
|
2
2
|
import { u as p } from "./user-B_2kh6ic.js";
|
3
3
|
import { resolveComponent as d, createElementBlock as f, openBlock as u, createElementVNode as o, createBlock as h, createCommentVNode as b } from "vue";
|
4
4
|
const x = {
|