@opengis/admin 0.2.99 → 0.2.101

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,117 @@
1
+ import { _ as h, u as p, e as u } from "./import-file-CIA2eGIc.js";
2
+ import { resolveComponent as d, openBlock as b, createElementBlock as g, createElementVNode as n, createBlock as f, normalizeStyle as x, createCommentVNode as w } from "vue";
3
+ const y = {
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
+ methods: {
18
+ flattenMenu(e) {
19
+ const t = [];
20
+ return e.forEach((s) => {
21
+ s.menu ? t.push(...this.flattenMenu(s.menu)) : t.push(s);
22
+ }), t;
23
+ },
24
+ async getFormScheme() {
25
+ var i, a;
26
+ const e = this.flattenMenu(p.value);
27
+ e != null && e.length || this.$router.replace("/404");
28
+ const t = e == null ? void 0 : e.find((r) => {
29
+ var o, l;
30
+ return (r == null ? void 0 : r.path) == ((l = (o = this.$route) == null ? void 0 : o.query) == null ? void 0 : l.table);
31
+ });
32
+ t || this.$router.replace("/404");
33
+ const s = t == null ? void 0 : t.table;
34
+ this.table = s;
35
+ try {
36
+ const r = await u.get(`/api/table-data/${s}`), { data: o } = await u.get(
37
+ `/api/template/form/${(i = r == null ? void 0 : r.data) == null ? void 0 : i.form}`
38
+ );
39
+ this.scheme = (o == null ? void 0 : o.schema) || o, this.style = (o == null ? void 0 : o.style) || null, this.api = (o == null ? void 0 : o.api) || "", this.token = (a = r == null ? void 0 : r.data) == null ? void 0 : a.addToken;
40
+ } catch {
41
+ }
42
+ },
43
+ getGroupedErrorNotification(e, t) {
44
+ if (!e || !t) return "";
45
+ const s = {};
46
+ return Object.entries(e).forEach(([a, r]) => {
47
+ var l;
48
+ const o = ((l = t[a]) == null ? void 0 : l.ua) || a;
49
+ r.forEach((m) => {
50
+ const c = m.message;
51
+ s[c] || (s[c] = []), s[c].push(`"${o}"`);
52
+ });
53
+ }), Object.entries(s).map(([a, r]) => `<b>${a}:</b> ${r.join(", ")}`).join("<br>") || "Сталася помилка валідації";
54
+ },
55
+ async createObject() {
56
+ const e = this.$refs.form;
57
+ try {
58
+ await e.doValidation(), await u.post(
59
+ this.api || `/api/table/${this.token}`,
60
+ this.formValues
61
+ ), await this.$router.back(), await this.$notify({
62
+ title: "Успішно!",
63
+ message: "Об'єкт успішно створено",
64
+ type: "success"
65
+ });
66
+ } catch {
67
+ const s = this.getGroupedErrorNotification(
68
+ e == null ? void 0 : e.formErrors,
69
+ e == null ? void 0 : e.scheme
70
+ );
71
+ this.$notify({
72
+ title: "Помилка!",
73
+ message: s,
74
+ type: "error"
75
+ });
76
+ }
77
+ }
78
+ }
79
+ }, k = { class: "bg-gray-50 lg:w-[calc(100vw-260px)] w-[100vw]" }, v = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl" }, V = { class: "flex items-center gap-[6px]" }, _ = {
80
+ style: { height: "calc(100vh - 165px)" },
81
+ class: "bg-gray-50 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
82
+ }, $ = { 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" };
83
+ function j(e, t, s, i, a, r) {
84
+ const o = d("VsForm");
85
+ return b(), g("div", k, [
86
+ n("div", v, [
87
+ t[3] || (t[3] = n("h2", { class: "text-xl font-medium" }, "Створити", -1)),
88
+ n("div", V, [
89
+ n("button", {
90
+ onClick: t[0] || (t[0] = (l) => e.$router.back()),
91
+ 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"
92
+ }, " Скасувати "),
93
+ n("button", {
94
+ onClick: t[1] || (t[1] = (...l) => r.createObject && r.createObject(...l)),
95
+ 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"
96
+ }, " Зберегти ")
97
+ ])
98
+ ]),
99
+ n("div", _, [
100
+ n("div", $, [
101
+ a.scheme ? (b(), f(o, {
102
+ key: 0,
103
+ ref: "form",
104
+ scheme: a.scheme,
105
+ style: x(a.style),
106
+ modelValue: a.formValues,
107
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => a.formValues = l),
108
+ class: "p-0 mt-[20px]"
109
+ }, null, 8, ["scheme", "style", "modelValue"])) : w("", !0)
110
+ ])
111
+ ])
112
+ ]);
113
+ }
114
+ const O = /* @__PURE__ */ h(y, [["render", j]]);
115
+ export {
116
+ O as default
117
+ };
@@ -1,4 +1,4 @@
1
- import { _ as T, g as Re, h as Je, i as Ge, e as F, I as Le, j as Me, k as B, A as N, V as Ke, l as Qe, m as Xe, n as Ye, o as Ze, p as et, q as tt, a as st, r as nt, u as je, s as lt } from "./import-file-DGpixqr_.js";
1
+ import { _ as T, g as Re, h as Je, i as Ge, e as F, I as Le, j as Me, k as B, A as N, V as Ke, l as Qe, m as Xe, n as Ye, o as Ze, p as et, q as tt, a as st, r as nt, u as je, s as lt } from "./import-file-CIA2eGIc.js";
2
2
  import { openBlock as o, createElementBlock as i, createTextVNode as P, toDisplayString as $, createElementVNode as l, normalizeClass as S, createCommentVNode as v, resolveComponent as b, Fragment as C, createVNode as g, withCtx as I, createBlock as k, renderList as D, withModifiers as rt, withDirectives as M, vModelRadio as ot, createStaticVNode as at, vModelCheckbox as it, Transition as z, vModelText as dt, renderSlot as ut, vShow as U, Teleport as ct, getCurrentInstance as ze, ref as q, resolveDynamicComponent as O, defineComponent as pt, normalizeStyle as Fe } from "vue";
3
3
  const bt = {
4
4
  data() {
@@ -1806,7 +1806,7 @@ function il(t, e, n, a, s, r) {
1806
1806
  onClick: (j) => {
1807
1807
  r.pushToCard(p == null ? void 0 : p.id), r.pushToLinkCard(r.columns[0], p);
1808
1808
  },
1809
- class: S(["font-medium", [
1809
+ class: S(["font-medium text-start", [
1810
1810
  ...r.getCustomStyles(r.columns[0]),
1811
1811
  (($e = this.tableData) == null ? void 0 : $e.card) === !1 ? "" : " text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"
1812
1812
  ]])
@@ -1901,7 +1901,7 @@ function il(t, e, n, a, s, r) {
1901
1901
  ])
1902
1902
  ]);
1903
1903
  }
1904
- const dl = /* @__PURE__ */ T(Bn, [["render", il], ["__scopeId", "data-v-dc5b48b8"]]), ul = {
1904
+ const dl = /* @__PURE__ */ T(Bn, [["render", il], ["__scopeId", "data-v-40106c61"]]), ul = {
1905
1905
  components: { AdminTable: dl },
1906
1906
  data() {
1907
1907
  return {
@@ -1,4 +1,4 @@
1
- import { _ as x, I as K, s as C, a as W, u as T, b as X, c as Y, d as ee, e as A, f as q } from "./import-file-DGpixqr_.js";
1
+ import { _ as x, I as K, s as C, a as W, u as T, b as X, c as Y, d as ee, e as A, f as q } from "./import-file-CIA2eGIc.js";
2
2
  import { openBlock as n, createElementBlock as i, createElementVNode as o, createStaticVNode as P, resolveComponent as p, normalizeClass as f, createTextVNode as B, toDisplayString as N, createCommentVNode as w, createVNode as h, Transition as te, withCtx as y, withDirectives as re, Fragment as j, renderList as F, vShow as le, createBlock as U, resolveDynamicComponent as S, withModifiers as oe } from "vue";
3
3
  const se = {}, ne = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
package/dist/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./import-file-DGpixqr_.js";
1
+ import { t as e } from "./import-file-CIA2eGIc.js";
2
2
  export {
3
3
  e as default
4
4
  };