@opengis/admin 0.3.25 → 0.3.26
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-BI4K8Lzk.js → add-page-B3H-0GBH.js} +25 -20
- package/dist/{admin-interface-DDP6KpGO.js → admin-interface-CpMI-QOq.js} +502 -481
- package/dist/{admin-view-C--DkpIG.js → admin-view-BuCmto5A.js} +6 -6
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +76 -76
- package/dist/{card-view-CPwz8aJg.js → card-view-C4EvhyJT.js} +3 -3
- package/dist/edit-page-Bk2BoWiz.js +145 -0
- package/dist/{import-file-B8gDejaq.js → import-file-DoPKjOx2.js} +22077 -22178
- package/dist/{profile-page-C5UftUwo.js → profile-page-D2CDkSuS.js} +5 -5
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/server/helpers/list/descriptionList.js +1 -1
- package/server/helpers/list/tableList.js +5 -5
- package/server/helpers/list/utils/button.js +5 -5
- package/server/helpers/list/utils/buttonDel.js +1 -1
- package/server/helpers/list/utils/buttonEdit.js +1 -1
- package/server/routes/data/controllers/utils/conditions.js +20 -20
- package/dist/edit-page-BsDJ8lKP.js +0 -140
@@ -30,7 +30,7 @@ export default async function tableList(data, opt) {
|
|
30
30
|
const keys = hash.columns.split(hash.divider || ',').map(el => hash.comma ? el.trim().replace(new RegExp(hash.comma, 'g'), ',') : el.trim()).concat(hash.uid && hash.table && hash.id && !hash.noactions ? ['Дії', 'actions'] : []);
|
31
31
|
|
32
32
|
const result = [];
|
33
|
-
result.push('<thead class="text-left"> <tr>');
|
33
|
+
result.push('<thead class="text-left font-medium text-gray-700"> <tr>');
|
34
34
|
|
35
35
|
// thead
|
36
36
|
const skip = {}
|
@@ -46,7 +46,7 @@ export default async function tableList(data, opt) {
|
|
46
46
|
skip[name] = name.includes('{{') && !nameHBS;
|
47
47
|
if (skip[name]) continue;
|
48
48
|
|
49
|
-
result.push(`<th class="
|
49
|
+
result.push(`<th class="py-2">
|
50
50
|
${nameHBS || name}
|
51
51
|
</th>`)
|
52
52
|
}
|
@@ -55,7 +55,7 @@ export default async function tableList(data, opt) {
|
|
55
55
|
// body
|
56
56
|
for (let k = 0; k < data.length; k += 1) {
|
57
57
|
const row = data[k];
|
58
|
-
result.push('<tr>');
|
58
|
+
result.push('<tr class="odd:bg-gray-50">');
|
59
59
|
const obj = { form: hash.form, table: hash.table, id: row[hash.id] }
|
60
60
|
const token = hash.table ? setToken({ ids: [JSON.stringify(obj)], uid: hash.uid, array: 1 })[0] : null;
|
61
61
|
for (let i = 0; i < keys.length; i += 2) {
|
@@ -67,7 +67,7 @@ export default async function tableList(data, opt) {
|
|
67
67
|
|
68
68
|
const tokenData = key == 'actions' ? token : null;
|
69
69
|
const d1 = key.includes('{{') ? await handlebars.compile(key)({ ...row, token, hash }) || '-' : null
|
70
|
-
result.push(`<td class="
|
70
|
+
result.push(`<td class="py-2 pr-5">
|
71
71
|
${d1 || format(tokenData || row[key], key, row, hash)}
|
72
72
|
</td>`);
|
73
73
|
|
@@ -79,5 +79,5 @@ export default async function tableList(data, opt) {
|
|
79
79
|
result.push('</tbody>');
|
80
80
|
|
81
81
|
// console.log(Date.now() - time)
|
82
|
-
return '<table class="min-w-full divide-y-2 divide-gray-200 bg-white min-w-full divide-y-2 divide-gray-200 bg-white ">
|
82
|
+
return '<table class="min-w-full divide-y-2 divide-gray-200 bg-white min-w-full divide-y-2 divide-gray-200 bg-white text-[12px] text-gray-600">' + result.join('') + '</table>';
|
83
83
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export default function button(token, title) {
|
4
|
-
return `<button onclick="window.v3plugin.$form({ token: '${token}' })"
|
5
|
-
class="inline-flex items-center px-2 py-1 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white">${title || 'Додати'}</button>`;
|
1
|
+
|
2
|
+
|
3
|
+
export default function button(token, title) {
|
4
|
+
return `<button onclick="window.v3plugin.$form({ token: '${token}' })"
|
5
|
+
class="inline-flex items-center px-2 py-1 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white">${title || 'Додати'}</button>`;
|
6
6
|
}
|
@@ -8,6 +8,6 @@ const newColor = 'red'
|
|
8
8
|
export default function button(token, title) {
|
9
9
|
return `<button onclick="window.v3plugin.$api({ api: '/api/table/${token}', method:'delete',confirm: { title:'Підтвердити операцію', text: 'Ви впевнені що хочете вилучити запис?', cancel: 'Скасувати', confirm : 'Виконати'} })"
|
10
10
|
class="group px-2 py-1 inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border border-transparent hover:text-white ring-offset-white bg-${newColor}-100 text-${newColor}-100 hover:bg-${newColor}-500 focus:ring-${newColor}-500">
|
11
|
-
<svg class="group-hover:fill-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="
|
11
|
+
<svg class="group-hover:fill-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="13" height="13" fill="#ef4444"><path d="M135.2 17.7L128 32 32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0-7.2-14.3C307.4 6.8 296.3 0 284.2 0L163.8 0c-12.1 0-23.2 6.8-28.6 17.7zM416 128L32 128 53.2 467c1.6 25.3 22.6 45 47.9 45l245.8 0c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>
|
12
12
|
</button>`;
|
13
13
|
}
|
@@ -10,6 +10,6 @@ const newColor = 'blue'
|
|
10
10
|
export default function button(token, title) {
|
11
11
|
return `<button onclick="window.v3plugin.$form({ token: '${token}' })"
|
12
12
|
class="group px-2 py-1 inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border border-transparent hover:text-white ring-offset-white bg-${newColor}-100 text-${newColor}-100 hover:bg-${newColor}-500 focus:ring-${newColor}-500">
|
13
|
-
<svg class="group-hover:fill-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="
|
13
|
+
<svg class="group-hover:fill-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="13" height="13" fill="#3b82f6"><path d="M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160L0 416c0 53 43 96 96 96l256 0c53 0 96-43 96-96l0-96c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7-14.3 32-32 32L96 448c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L96 64z"/></svg>
|
14
14
|
</button>`;
|
15
15
|
}
|
@@ -1,21 +1,21 @@
|
|
1
|
-
function onCheck(rule, data) {
|
2
|
-
const val = data[rule[0]];
|
3
|
-
// console.log(val, rule[1], rule[2])
|
4
|
-
if (rule[1] === '==') return val === rule[2];
|
5
|
-
if (rule[1] === '!=') return val !== rule[2];
|
6
|
-
if (rule[1] === 'in' && rule[2].split) return rule[2].split(',').includes(val);
|
7
|
-
if (rule[1] === 'in' && rule[2].includes) return rule[2].includes(val);
|
8
|
-
|
9
|
-
if (rule[1] === 'not in' && rule[2].split) return !rule[2].split(',').includes(val);
|
10
|
-
if (rule[1] === 'not in' && rule[2].includes) return !rule[2].includes(val);
|
11
|
-
|
12
|
-
if (rule[1] === '>') return val > rule[2];
|
13
|
-
if (rule[1] === '<') return val < rule[2];
|
14
|
-
}
|
15
|
-
export default function conditions(rules, data) {
|
16
|
-
if (!rules?.length) return true;
|
17
|
-
const result = Array.isArray(rules[0]) ? !rules.filter(el => !onCheck(el, data)).length : onCheck(rules, data)
|
18
|
-
// console.log(rules, result)
|
19
|
-
return result;
|
20
|
-
|
1
|
+
function onCheck(rule, data) {
|
2
|
+
const val = data[rule[0]];
|
3
|
+
// console.log(val, rule[1], rule[2])
|
4
|
+
if (rule[1] === '==') return val === rule[2];
|
5
|
+
if (rule[1] === '!=') return val !== rule[2];
|
6
|
+
if (rule[1] === 'in' && rule[2].split) return rule[2].split(',').includes(val);
|
7
|
+
if (rule[1] === 'in' && rule[2].includes) return rule[2].includes(val);
|
8
|
+
|
9
|
+
if (rule[1] === 'not in' && rule[2].split) return !rule[2].split(',').includes(val);
|
10
|
+
if (rule[1] === 'not in' && rule[2].includes) return !rule[2].includes(val);
|
11
|
+
|
12
|
+
if (rule[1] === '>') return val > rule[2];
|
13
|
+
if (rule[1] === '<') return val < rule[2];
|
14
|
+
}
|
15
|
+
export default function conditions(rules, data) {
|
16
|
+
if (!rules?.length) return true;
|
17
|
+
const result = Array.isArray(rules[0]) ? !rules.filter(el => !onCheck(el, data)).length : onCheck(rules, data)
|
18
|
+
// console.log(rules, result)
|
19
|
+
return result;
|
20
|
+
|
21
21
|
}
|
@@ -1,140 +0,0 @@
|
|
1
|
-
import { _ as f, e as m, u as y } from "./import-file-B8gDejaq.js";
|
2
|
-
import { resolveComponent as x, createElementBlock as w, openBlock as h, createElementVNode as u, normalizeStyle as d, createBlock as k, createCommentVNode as v } from "vue";
|
3
|
-
const $ = {
|
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
|
-
methods: {
|
17
|
-
flattenMenu(e) {
|
18
|
-
const t = [];
|
19
|
-
return e.forEach((r) => {
|
20
|
-
r.menu ? t.push(...this.flattenMenu(r.menu)) : t.push(r);
|
21
|
-
}), t;
|
22
|
-
},
|
23
|
-
async getFormScheme() {
|
24
|
-
var i, o;
|
25
|
-
const e = this.flattenMenu(y.value);
|
26
|
-
e != null && e.length || this.$router.replace("/404");
|
27
|
-
const t = e == null ? void 0 : e.find((a) => {
|
28
|
-
var n, s;
|
29
|
-
return (a == null ? void 0 : a.path) == ((s = (n = this.$route) == null ? void 0 : n.query) == null ? void 0 : s.table);
|
30
|
-
});
|
31
|
-
t || this.$router.replace("/404");
|
32
|
-
const r = t == null ? void 0 : t.table;
|
33
|
-
this.table = r;
|
34
|
-
try {
|
35
|
-
const {
|
36
|
-
data: { form: a }
|
37
|
-
} = await m.get(`/api/template/table/${r}`), { data: n } = await m.get(
|
38
|
-
`/api/table/${this.table}/${(o = (i = this.$route) == null ? void 0 : i.query) == null ? void 0 : o.id}`
|
39
|
-
);
|
40
|
-
this.token = (n == null ? void 0 : n.token) || "", this.formValues = n || {};
|
41
|
-
const { data: s } = await m.get(`/api/template/form/${a}`);
|
42
|
-
this.scheme = (s == null ? void 0 : s.schema) || s, this.style = (s == null ? void 0 : s.style) || null;
|
43
|
-
} catch {
|
44
|
-
}
|
45
|
-
},
|
46
|
-
async onlyEditObject() {
|
47
|
-
var t, r, i, o, a, n, s, c, l;
|
48
|
-
const e = this.$refs.form;
|
49
|
-
try {
|
50
|
-
await e.doValidation(), await m.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
|
51
|
-
title: "Успішно!",
|
52
|
-
message: "Об'єкт успішно створено",
|
53
|
-
type: "success"
|
54
|
-
});
|
55
|
-
} catch (b) {
|
56
|
-
const p = ((t = b == null ? void 0 : b.response) == null ? void 0 : t.data) || "";
|
57
|
-
let g = ((a = (o = (i = (r = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : r[0]) == null ? void 0 : i[1]) == null ? void 0 : o[0]) == null ? void 0 : a.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (l = (c = (s = (n = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : n[0]) == null ? void 0 : s[1]) == null ? void 0 : c[0]) == null ? void 0 : l.message;
|
58
|
-
this.$notify({
|
59
|
-
title: "Помилка!",
|
60
|
-
message: p || g || "Сталася помилка валідаціі",
|
61
|
-
type: "error"
|
62
|
-
});
|
63
|
-
}
|
64
|
-
},
|
65
|
-
getGroupedErrorNotification(e, t) {
|
66
|
-
if (!e || !t) return "";
|
67
|
-
const r = {};
|
68
|
-
return Object.entries(e).forEach(([o, a]) => {
|
69
|
-
var s;
|
70
|
-
const n = ((s = t[o]) == null ? void 0 : s.ua) || o;
|
71
|
-
a.forEach((c) => {
|
72
|
-
const l = c.message;
|
73
|
-
r[l] || (r[l] = []), r[l].push(`"${n}"`);
|
74
|
-
});
|
75
|
-
}), Object.entries(r).map(([o, a]) => `<b>${o}:</b> ${a.join(", ")}`).join("<br>") || "Сталася помилка валідації";
|
76
|
-
},
|
77
|
-
async editObjectAndRedirect() {
|
78
|
-
const e = this.$refs.form;
|
79
|
-
try {
|
80
|
-
await e.doValidation(), await m.put(`/api/table/${this.token}`, this.formValues), await this.$router.back(), await this.$notify({
|
81
|
-
title: "Успішно!",
|
82
|
-
message: "Об'єкт успішно створено",
|
83
|
-
type: "success"
|
84
|
-
});
|
85
|
-
} catch {
|
86
|
-
const r = this.getGroupedErrorNotification(
|
87
|
-
e == null ? void 0 : e.formErrors,
|
88
|
-
e == null ? void 0 : e.scheme
|
89
|
-
);
|
90
|
-
this.$notify({
|
91
|
-
title: "Помилка!",
|
92
|
-
message: r,
|
93
|
-
type: "error"
|
94
|
-
});
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}, V = { class: "bg-gray-50 lg:w-[calc(100vw-260px)] w-[100vw]" }, j = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl" }, E = { class: "flex items-center gap-[6px]" }, _ = { class: "bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" };
|
99
|
-
function O(e, t, r, i, o, a) {
|
100
|
-
var s, c;
|
101
|
-
const n = x("VsForm");
|
102
|
-
return h(), w("div", V, [
|
103
|
-
u("div", j, [
|
104
|
-
t[3] || (t[3] = u("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
|
105
|
-
u("div", E, [
|
106
|
-
u("button", {
|
107
|
-
onClick: t[0] || (t[0] = (l) => e.$router.back()),
|
108
|
-
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"
|
109
|
-
}, " Скасувати "),
|
110
|
-
u("button", {
|
111
|
-
onClick: t[1] || (t[1] = (...l) => a.editObjectAndRedirect && a.editObjectAndRedirect(...l)),
|
112
|
-
class: "inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"
|
113
|
-
}, " Зберегти ")
|
114
|
-
])
|
115
|
-
]),
|
116
|
-
u("div", {
|
117
|
-
style: d({
|
118
|
-
height: ((s = e.$adminSettings) == null ? void 0 : s.header) === !1 ? "calc(100vh - 100px)" : "calc(100vh - 165px)"
|
119
|
-
}),
|
120
|
-
class: "bg-gray-50 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
|
121
|
-
}, [
|
122
|
-
u("div", _, [
|
123
|
-
o.scheme ? (h(), k(n, {
|
124
|
-
key: 0,
|
125
|
-
ref: "form",
|
126
|
-
scheme: o.scheme,
|
127
|
-
columns: (c = o.style) == null ? void 0 : c.columns,
|
128
|
-
style: d(o.style),
|
129
|
-
modelValue: o.formValues,
|
130
|
-
"onUpdate:modelValue": t[2] || (t[2] = (l) => o.formValues = l),
|
131
|
-
class: "p-0 mt-[20px]"
|
132
|
-
}, null, 8, ["scheme", "columns", "style", "modelValue"])) : v("", !0)
|
133
|
-
])
|
134
|
-
], 4)
|
135
|
-
]);
|
136
|
-
}
|
137
|
-
const F = /* @__PURE__ */ f($, [["render", O]]);
|
138
|
-
export {
|
139
|
-
F as default
|
140
|
-
};
|