@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.
@@ -0,0 +1,126 @@
1
+ import { _ as d, e as m, u as f, s as g } from "./import-file-C9RmOGhX.js";
2
+ import { resolveComponent as b, createElementBlock as x, openBlock as h, createElementVNode as i, normalizeClass as y, normalizeStyle as p, createBlock as w, createCommentVNode as v } from "vue";
3
+ const $ = {
4
+ data() {
5
+ return {
6
+ formValues: {},
7
+ scheme: null,
8
+ table: "",
9
+ token: "",
10
+ api: "",
11
+ style: null
12
+ };
13
+ },
14
+ mounted() {
15
+ this.getFormScheme();
16
+ },
17
+ computed: {
18
+ color() {
19
+ return g.value.buttonColor || "blue";
20
+ }
21
+ },
22
+ methods: {
23
+ flattenMenu(t) {
24
+ const e = [];
25
+ return t.forEach((a) => {
26
+ a.menu ? e.push(...this.flattenMenu(a.menu)) : e.push(a);
27
+ }), e;
28
+ },
29
+ async getFormScheme() {
30
+ var l, o;
31
+ const t = this.flattenMenu(f.value);
32
+ t != null && t.length || this.$router.replace("/404");
33
+ const e = t == null ? void 0 : t.find((s) => {
34
+ var r, n;
35
+ return (s == null ? void 0 : s.path) == ((n = (r = this.$route) == null ? void 0 : r.query) == null ? void 0 : n.table);
36
+ });
37
+ e || this.$router.replace("/404");
38
+ const a = e == null ? void 0 : e.table;
39
+ this.table = a;
40
+ try {
41
+ const s = await m.get(`/api/table-data/${a}`), { data: r } = await m.get(
42
+ `/api/template/form/${(l = s == null ? void 0 : s.data) == null ? void 0 : l.form}`
43
+ );
44
+ this.scheme = (r == null ? void 0 : r.schema) || r, this.style = (r == null ? void 0 : r.style) || null, this.api = (r == null ? void 0 : r.api) || "", this.token = (o = s == null ? void 0 : s.data) == null ? void 0 : o.addToken;
45
+ } catch {
46
+ }
47
+ },
48
+ getGroupedErrorNotification(t, e) {
49
+ if (!t || !e) return "";
50
+ const a = {};
51
+ return Object.entries(t).forEach(([o, s]) => {
52
+ var n;
53
+ const r = ((n = e[o]) == null ? void 0 : n.ua) || o;
54
+ s.forEach((c) => {
55
+ const u = c.message;
56
+ a[u] || (a[u] = []), a[u].push(`"${r}"`);
57
+ });
58
+ }), Object.entries(a).map(([o, s]) => `<b>${o}:</b> ${s.join(", ")}`).join("<br>") || "Сталася помилка валідації";
59
+ },
60
+ async createObject() {
61
+ var e, a, l;
62
+ const t = (a = (e = this.$refs.form) == null ? void 0 : e.$refs) == null ? void 0 : a.form;
63
+ try {
64
+ await t.doValidation(), await m.post(
65
+ this.api || `/api/table/${this.token}`,
66
+ this.formValues
67
+ ), await this.$router.back(), await this.$notify({
68
+ title: "Успішно!",
69
+ message: "Об'єкт успішно створено",
70
+ type: "success"
71
+ });
72
+ } catch (o) {
73
+ const s = this.getGroupedErrorNotification(
74
+ t == null ? void 0 : t.formErrors,
75
+ t == null ? void 0 : t.scheme
76
+ );
77
+ this.$notify({
78
+ title: "Помилка!",
79
+ message: ((l = o == null ? void 0 : o.response) == null ? void 0 : l.data) || s,
80
+ type: "error"
81
+ });
82
+ }
83
+ }
84
+ }
85
+ }, k = { class: "bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]" }, V = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, _ = { class: "flex items-center gap-[6px]" }, j = { class: "bg-white w-full rounded-xl" };
86
+ function E(t, e, a, l, o, s) {
87
+ var n;
88
+ const r = b("VsFormWithNavigation");
89
+ return h(), x("div", k, [
90
+ i("div", V, [
91
+ e[3] || (e[3] = i("h2", { class: "text-xl font-medium" }, "Створити", -1)),
92
+ i("div", _, [
93
+ i("button", {
94
+ onClick: e[0] || (e[0] = (c) => t.$router.back()),
95
+ 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"
96
+ }, " Скасувати "),
97
+ i("button", {
98
+ onClick: e[1] || (e[1] = (...c) => s.createObject && s.createObject(...c)),
99
+ class: y(`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`)
100
+ }, " Зберегти ", 2)
101
+ ])
102
+ ]),
103
+ i("div", {
104
+ style: p({
105
+ height: ((n = t.$adminSettings) == null ? void 0 : n.header) === !1 ? "calc(100vh - 100px)" : "calc(100vh - 150px)"
106
+ }),
107
+ class: "bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"
108
+ }, [
109
+ i("div", j, [
110
+ o.scheme ? (h(), w(r, {
111
+ key: 0,
112
+ ref: "form",
113
+ scheme: o.scheme,
114
+ style: p(o.style),
115
+ modelValue: o.formValues,
116
+ "onUpdate:modelValue": e[2] || (e[2] = (c) => o.formValues = c),
117
+ class: "h-full p-[20px]"
118
+ }, null, 8, ["scheme", "style", "modelValue"])) : v("", !0)
119
+ ])
120
+ ], 4)
121
+ ]);
122
+ }
123
+ const N = /* @__PURE__ */ d($, [["render", E]]);
124
+ export {
125
+ N as default
126
+ };
@@ -1,4 +1,4 @@
1
- import { _ as S, g as Je, h as Ge, i as Qe, e as M, I as Xe, s as E, j as Ue, k as Q, V as Ye, l as Ze, m as et, n as tt, A as X, o as st, p as nt, q as lt, r as at, a as rt, t as ot, u as Ee } from "./import-file-Ch8huzhb.js";
1
+ import { _ as S, g as Je, h as Ge, i as Qe, e as M, I as Xe, s as E, j as Ue, k as Q, V as Ye, l as Ze, m as et, n as tt, A as X, o as st, p as nt, q as lt, r as at, a as rt, t as ot, u as Ee } from "./import-file-C9RmOGhX.js";
2
2
  import { createElementBlock as i, openBlock as r, createTextVNode as P, createElementVNode as a, toDisplayString as A, createCommentVNode as k, normalizeClass as w, resolveComponent as f, Fragment as $, createVNode as x, withCtx as D, createBlock as v, renderList as V, withModifiers as it, createStaticVNode as dt, withDirectives as U, vModelCheckbox as ut, Transition as W, vModelText as ct, renderSlot as ht, vShow as Y, Teleport as pt, getCurrentInstance as Re, ref as J, resolveDynamicComponent as G, defineComponent as bt, withKeys as ft, normalizeStyle as K } from "vue";
3
3
  const gt = {
4
4
  data() {
@@ -1,4 +1,4 @@
1
- import { _ as w, I as G, s as f, a as J, u as T, b as K, c as W, d as X, e as Y, f as ee } from "./import-file-Ch8huzhb.js";
1
+ import { _ as w, I as G, s as f, a as J, u as T, b as K, c as W, d as X, e as Y, f as ee } from "./import-file-C9RmOGhX.js";
2
2
  import { createElementBlock as a, openBlock as s, createElementVNode as o, createStaticVNode as A, resolveComponent as g, createCommentVNode as _, createVNode as d, normalizeClass as p, createTextVNode as L, toDisplayString as V, Transition as te, withCtx as C, withDirectives as re, Fragment as Z, renderList as P, vShow as le, createBlock as U, resolveDynamicComponent as S, withModifiers as oe } from "vue";
3
3
  import "./user-B_2kh6ic.js";
4
4
  const ne = {}, se = {
package/dist/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- import { v as f } from "./import-file-Ch8huzhb.js";
1
+ import { v as f } from "./import-file-C9RmOGhX.js";
2
2
  export {
3
3
  f as default
4
4
  };