@opengis/cms 0.0.61 → 0.0.62

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.
Files changed (109) hide show
  1. package/README.md +131 -131
  2. package/dist/{EditCollectionPage-3Q57ptN3.js → EditCollectionPage-C4uNmBJf.js} +1 -1
  3. package/dist/{contentForm-CLStrfSg.js → contentForm-CcFbUeal.js} +144 -146
  4. package/dist/index.js +1 -1
  5. package/dist/{vs-builder-preview-BH4VAM3a.js → vs-builder-preview-DL3RYMp7.js} +11 -12
  6. package/dist/vs-form-custom-datatable-D880w8gx.js +493 -0
  7. package/input-types.json +9 -9
  8. package/locales/en.json +815 -815
  9. package/locales/uk.json +813 -813
  10. package/module/cms/cls/content.status.json +17 -17
  11. package/module/cms/cls/user_type.json +9 -9
  12. package/module/cms/form/admin.users.form.json +77 -77
  13. package/module/cms/select/cms.page_type.sql +1 -1
  14. package/module/cms/select/news_tag_id.sql +11 -11
  15. package/module/cms/table/admin.users.table.json +53 -53
  16. package/module/cms/table/collection.default.table.json +96 -96
  17. package/module/cms/table/single.default.table.json +116 -116
  18. package/package.json +69 -69
  19. package/plugin.js +43 -43
  20. package/server/app.js +35 -35
  21. package/server/config.js +4 -4
  22. package/server/functions/getContent.js +45 -45
  23. package/server/functions/getDraftKey.js +22 -22
  24. package/server/functions/getSearchData.js +31 -31
  25. package/server/functions/getTags.js +30 -30
  26. package/server/functions/getUser.js +27 -27
  27. package/server/functions/utils/mock.reply.js +55 -55
  28. package/server/index.js +22 -22
  29. package/server/migrations/fixes.sql +132 -132
  30. package/server/migrations/site.sql +596 -596
  31. package/server/plugins/adminHook.js +78 -78
  32. package/server/plugins/hook.js +59 -59
  33. package/server/plugins/vite.js +75 -75
  34. package/server/routes/category/controllers/cms.category.delete.js +21 -21
  35. package/server/routes/category/controllers/cms.category.get.js +17 -17
  36. package/server/routes/category/controllers/cms.category.list.js +16 -16
  37. package/server/routes/category/controllers/cms.category.post.js +21 -21
  38. package/server/routes/category/controllers/cms.category.put.js +23 -23
  39. package/server/routes/category/index.mjs +22 -22
  40. package/server/routes/cms/controllers/cmsStat.js +55 -55
  41. package/server/routes/cms/controllers/cmsSuggest.js +57 -57
  42. package/server/routes/cms/controllers/deleteContent.js +113 -113
  43. package/server/routes/cms/controllers/deleteMedia.js +76 -76
  44. package/server/routes/cms/controllers/downloadMedia.js +84 -84
  45. package/server/routes/cms/controllers/getContent.js +113 -113
  46. package/server/routes/cms/controllers/getContentBySlug.js +93 -93
  47. package/server/routes/cms/controllers/insertContent.js +226 -226
  48. package/server/routes/cms/controllers/listMedia.js +155 -155
  49. package/server/routes/cms/controllers/metadataMedia.js +39 -39
  50. package/server/routes/cms/controllers/properties.get.js +18 -18
  51. package/server/routes/cms/controllers/properties.post.js +99 -99
  52. package/server/routes/cms/controllers/searchContent.js +214 -214
  53. package/server/routes/cms/controllers/translate.js +89 -89
  54. package/server/routes/cms/controllers/updateContent.js +231 -231
  55. package/server/routes/cms/controllers/uploadMedia.js +79 -79
  56. package/server/routes/cms/functions/getSettings.js +48 -48
  57. package/server/routes/cms/index.mjs +112 -112
  58. package/server/routes/cms/utils/additionalData.js +35 -35
  59. package/server/routes/cms/utils/getCollection.js +89 -89
  60. package/server/routes/cms/utils/getSingle.js +188 -188
  61. package/server/routes/cms/utils/inputTypes.js +5 -5
  62. package/server/routes/cms/utils/insertContentLocalization.js +104 -104
  63. package/server/routes/cms/utils/requestTranslation.js +135 -135
  64. package/server/routes/cms/utils/updateLocalization.js +42 -42
  65. package/server/routes/cmsSpace/controllers/deleteSpace.js +26 -26
  66. package/server/routes/cmsSpace/controllers/getSpaces.js +28 -28
  67. package/server/routes/cmsSpace/controllers/insertSpace.js +22 -22
  68. package/server/routes/cmsSpace/controllers/updateSpace.js +24 -24
  69. package/server/routes/cmsSpace/index.mjs +20 -20
  70. package/server/routes/contentType/controllers/addContentType.js +160 -160
  71. package/server/routes/contentType/controllers/contentTypeList.js +47 -47
  72. package/server/routes/contentType/controllers/delContentType.js +75 -75
  73. package/server/routes/contentType/controllers/editContentType.js +70 -70
  74. package/server/routes/contentType/controllers/getContentType.js +57 -57
  75. package/server/routes/contentType/index.mjs +35 -35
  76. package/server/routes/contentType/utils/updateContents.js +44 -44
  77. package/server/routes/contentType/utils/updateCustomContentTable.js +53 -53
  78. package/server/routes/feedback/controllers/email.list.js +24 -24
  79. package/server/routes/feedback/controllers/feedback.js +48 -48
  80. package/server/routes/feedback/controllers/feedback.list.js +37 -37
  81. package/server/routes/feedback/controllers/news.subscriptions.js +44 -44
  82. package/server/routes/feedback/index.mjs +71 -71
  83. package/server/routes/logs/controllers/export.user.logs.js +77 -77
  84. package/server/routes/logs/controllers/user.logs.js +44 -44
  85. package/server/routes/logs/index.mjs +9 -9
  86. package/server/routes/menu/controllers/addMenu.js +37 -37
  87. package/server/routes/menu/controllers/delMenu.js +31 -31
  88. package/server/routes/menu/controllers/editMenu.js +41 -41
  89. package/server/routes/menu/controllers/getMenu.js +24 -24
  90. package/server/routes/menu/functions/getMenu.js +50 -50
  91. package/server/routes/menu/index.mjs +13 -13
  92. package/server/routes/migration/controllers/collectionToCustom.js +137 -137
  93. package/server/routes/migration/index.mjs +8 -8
  94. package/server/routes/root.mjs +8 -8
  95. package/server/routes/tags/controllers/add.tags.js +24 -24
  96. package/server/routes/tags/controllers/del.tags.js +19 -19
  97. package/server/routes/tags/controllers/edit.tags.js +25 -25
  98. package/server/routes/tags/controllers/get.tags.js +15 -15
  99. package/server/routes/tags/index.mjs +14 -14
  100. package/server/templates/cls/cms.category_type.json +9 -9
  101. package/server/templates/cls/cms.content_review_status.json +9 -9
  102. package/server/templates/cls/cms.content_status.json +9 -9
  103. package/server/templates/cls/cms.content_type.json +9 -9
  104. package/server/templates/cls/cms.lang.json +9 -9
  105. package/server/templates/page/login.html +126 -126
  106. package/utils.d.ts +52 -52
  107. package/utils.js +8 -8
  108. package/dist/getField-CpwVE28P.js +0 -179
  109. package/dist/vs-form-custom-datatable-BDZo48w3.js +0 -317
@@ -1,10 +1,10 @@
1
- import { defineComponent as Pe, defineAsyncComponent as h, inject as le, ref as p, getCurrentInstance as Be, toRef as Ee, computed as m, watch as De, onMounted as Ie, openBlock as w, createElementBlock as $, createElementVNode as u, createVNode as C, unref as v, toDisplayString as j, createCommentVNode as S, createTextVNode as ae, Fragment as Ne, renderList as Me, normalizeClass as ne, createBlock as ie, withDirectives as q, vModelCheckbox as Re, vShow as re, nextTick as ce } from "vue";
2
- import { useRouter as Ue, useRoute as Oe } from "vue-router";
3
- import { ArrowLeft as Je, HelpCircle as He, Settings as Ke, Save as qe, Loader2 as Ge } from "lucide-vue-next";
4
- import { useI18n as Qe } from "vue-i18n";
5
- import { g as We } from "./getField-CpwVE28P.js";
1
+ import { defineComponent as Pe, defineAsyncComponent as k, inject as le, ref as v, getCurrentInstance as Be, toRef as Ee, computed as m, watch as Fe, onMounted as Ie, openBlock as h, createElementBlock as $, createElementVNode as u, createVNode as C, unref as p, toDisplayString as j, createCommentVNode as S, createTextVNode as ne, Fragment as Ne, renderList as De, normalizeClass as ae, createBlock as ie, withDirectives as q, vModelCheckbox as Me, vShow as re, nextTick as ce } from "vue";
2
+ import { useRouter as Re, useRoute as Ue } from "vue-router";
3
+ import { ArrowLeft as Oe, HelpCircle as Je, Settings as He, Save as Ke, Loader2 as qe } from "lucide-vue-next";
4
+ import { useI18n as Ge } from "vue-i18n";
5
+ import { _ as Qe, g as We } from "./vs-form-custom-datatable-D880w8gx.js";
6
6
  import { inputs as x, VForm as ue } from "@opengis/form";
7
- import { notify as P } from "@opengis/core";
7
+ import { notify as B } from "@opengis/core";
8
8
  const Xe = [
9
9
  {
10
10
  key: "title",
@@ -30,10 +30,10 @@ const Xe = [
30
30
  type: "key-value",
31
31
  ignore: ["title", "description", "keywords"]
32
32
  }
33
- ], Ye = { class: "space-y-6 mx-auto relativ max-w-[90%]" }, Ze = { class: "" }, et = { class: "flex items-center justify-between" }, tt = { class: "flex items-center gap-4" }, st = { class: "text-2xl font-semibold text-gray-900 dark:text-white line-clamp-1" }, ot = ["href", "title"], lt = { class: "flex items-center space-x-3" }, at = ["title"], nt = { class: "w-full mt-6 flex items-center justify-between" }, it = { class: "flex items-center w-full h-10 max-w-md grid-cols-3 p-1 bg-white border border-gray-200 rounded-md text-muted-foreground" }, rt = ["onClick"], ct = { class: "flex items-center gap-4" }, ut = ["disabled"], dt = { class: "flex items-center gap-2" }, mt = {
33
+ ], Ye = { class: "space-y-6 mx-auto relativ max-w-[90%]" }, Ze = { class: "" }, et = { class: "flex items-center justify-between" }, tt = { class: "flex items-center gap-4" }, st = { class: "text-2xl font-semibold text-gray-900 dark:text-white line-clamp-1" }, ot = ["href", "title"], lt = { class: "flex items-center space-x-3" }, nt = ["title"], at = { class: "w-full mt-6 flex items-center justify-between" }, it = { class: "flex items-center w-full h-10 max-w-md grid-cols-3 p-1 bg-white border border-gray-200 rounded-md text-muted-foreground" }, rt = ["onClick"], ct = { class: "flex items-center gap-4" }, ut = ["disabled"], dt = { class: "flex items-center gap-2" }, mt = {
34
34
  for: "is_pin",
35
35
  class: "text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer"
36
- }, pt = { class: "relative" }, vt = {
36
+ }, vt = { class: "relative" }, pt = {
37
37
  key: 0,
38
38
  class: "w-3 h-3 text-white",
39
39
  fill: "currentColor",
@@ -47,37 +47,35 @@ const Xe = [
47
47
  }, St = /* @__PURE__ */ Pe({
48
48
  __name: "contentForm",
49
49
  setup(ht) {
50
- const de = h(
50
+ const de = k(
51
51
  () => import("./vs-form-reference-list-Dtv8fJJU.js")
52
- ), me = h(
52
+ ), me = k(
53
53
  () => import("./vs-form-tiptap-DDFQjRjY.js")
54
- ), E = h(
54
+ ), F = k(
55
55
  () => import("./vs-form-media-select-NY27EaG1.js")
56
- ), pe = h(
56
+ ), ve = k(
57
57
  () => import("./vs-richtext-md-C098v_6Q.js")
58
- ), ve = h(
58
+ ), pe = k(
59
59
  () => import("./vs-form-integer-BZ855R3g.js")
60
- ), fe = h(
61
- () => import("./vs-form-custom-datatable-BDZo48w3.js")
62
- ), ye = h(
60
+ ), fe = k(
63
61
  () => import("./vs-form-reletion-link-BhzNQszm.js")
64
- ), ge = h(
62
+ ), ye = k(
65
63
  () => import("./VsFormTags-CMjiu9sY.js")
66
- ), be = h(
64
+ ), ge = k(
67
65
  () => import("./VsPreview-DwETkOpb.js")
68
- ), he = h(
66
+ ), be = k(
69
67
  () => import("./CollectionsBreadcrumb-BCxeRikP.js")
70
68
  );
71
- x["vs-input-custom-datatable"] = fe, x["vs-input-reference"] = de, x["vs-input-texteditor"] = me, x["vs-input-mediaselect"] = E, x["vs-input-file"] = E, x["vs-input-image"] = E, x["vs-input-richtext-md"] = pe, x["vs-input-integer"] = ve, x["vs-input-relation-link"] = ye;
72
- const { t: r, locale: G } = Qe(), V = Ue(), d = Oe(), Q = le("cms.menu", null) || le("menu", p([])), _ = p([]), D = p({}), W = p({}), I = p({}), N = p(""), M = p(!0), R = Be(), U = R == null ? void 0 : R.appContext, we = (U == null ? void 0 : U.config.globalProperties) || {}, X = Ee(we, "$settings"), B = m(() => {
69
+ x["vs-input-custom-datatable"] = Qe, x["vs-input-reference"] = de, x["vs-input-texteditor"] = me, x["vs-input-mediaselect"] = F, x["vs-input-file"] = F, x["vs-input-image"] = F, x["vs-input-richtext-md"] = ve, x["vs-input-integer"] = pe, x["vs-input-relation-link"] = fe;
70
+ const { t: r, locale: G } = Ge(), A = Re(), d = Ue(), Q = le("cms.menu", null) || le("menu", v([])), _ = v([]), I = v({}), W = v({}), N = v({}), D = v(""), M = v(!0), R = Be(), U = R == null ? void 0 : R.appContext, he = (U == null ? void 0 : U.config.globalProperties) || {}, X = Ee(he, "$settings"), E = m(() => {
73
71
  var e;
74
72
  return ((e = X.value) == null ? void 0 : e.cms) || {};
75
- }), ke = m(() => Array.isArray(B.value.locales) ? B.value.locales : []), O = m(
76
- () => ke.value.filter(Boolean)
73
+ }), we = m(() => Array.isArray(E.value.locales) ? E.value.locales : []), O = m(
74
+ () => we.value.filter(Boolean)
77
75
  ), Y = m(
78
- () => B.value.locale || O.value[0] || "uk"
76
+ () => E.value.locale || O.value[0] || "uk"
79
77
  );
80
- De(
78
+ Fe(
81
79
  X,
82
80
  () => {
83
81
  _.value.length && (_.value = _.value.map((e) => ({
@@ -86,27 +84,27 @@ const Xe = [
86
84
  },
87
85
  { deep: !0 }
88
86
  );
89
- const xe = (e) => {
87
+ const ke = (e) => {
90
88
  const t = [], o = O.value.filter(
91
- (a) => a !== Y.value
89
+ (n) => n !== Y.value
92
90
  );
93
- return Array.isArray(e) && e.forEach((a) => {
94
- t.push(a), !(!a.localization || o.length === 0) && o.forEach((n) => {
91
+ return Array.isArray(e) && e.forEach((n) => {
92
+ t.push(n), !(!n.localization || o.length === 0) && o.forEach((a) => {
95
93
  t.push({
96
- ...a,
97
- name: `${a.name}:${n}`,
98
- label: `${a.label} (${n})`
94
+ ...n,
95
+ name: `${n.name}:${a}`,
96
+ label: `${n.label} (${a})`
99
97
  });
100
98
  });
101
99
  }), t;
102
- }, Z = m(() => xe(_.value)), _e = m(
100
+ }, Z = m(() => ke(_.value)), xe = m(
103
101
  () => Array.isArray(_.value) && _.value.some(
104
102
  (e) => e.localization === !0 && e.name !== "title"
105
103
  )
106
- ), z = p(!1), $e = m(() => {
104
+ ), z = v(!1), _e = m(() => {
107
105
  var e;
108
106
  return (e = Z.value) == null ? void 0 : e.map(We);
109
- }), Ce = m(() => {
107
+ }), $e = m(() => {
110
108
  G.value;
111
109
  const e = O.value.filter(
112
110
  (t) => t !== Y.value
@@ -118,82 +116,82 @@ const Xe = [
118
116
  };
119
117
  if (!t.localization || e.length === 0)
120
118
  return [o];
121
- const a = e.map((n) => ({
119
+ const n = e.map((a) => ({
122
120
  ...t,
123
- key: `${t.key}:${n}`,
124
- label: `${r(t.label)} (${n})`,
121
+ key: `${t.key}:${a}`,
122
+ label: `${r(t.label)} (${a})`,
125
123
  localization: !1
126
124
  }));
127
- return [o, ...a];
125
+ return [o, ...n];
128
126
  });
129
- }), g = p({}), i = p({
127
+ }), g = v({}), i = v({
130
128
  title: "",
131
129
  status: "draft"
132
- }), J = p(null), L = p(""), F = m(
130
+ }), J = v(null), L = v(""), P = m(
133
131
  () => J.value === "single"
134
- ), Te = m(() => {
132
+ ), Ce = m(() => {
135
133
  const e = [
136
134
  { id: "content", name: r("cms.builder.content") },
137
135
  { id: "seo", name: r("cms.builder.seo") },
138
136
  { id: "tags", name: r("cms.builder.tags") }
139
137
  ];
140
- return N.value && e.push({ id: "preview", name: r("cms.builder.preview") }), e;
141
- }), A = p("content"), ee = m(() => {
142
- var s, c, l, k, f, b, y, T, oe;
143
- const e = ((s = d.params) == null ? void 0 : s.collection) || ((c = d.params) == null ? void 0 : c.id), t = (l = i.value) == null ? void 0 : l.content_type_id, o = t ? (f = (k = Q.value) == null ? void 0 : k.find((K) => K.id === t)) == null ? void 0 : f.title : null;
138
+ return D.value && e.push({ id: "preview", name: r("cms.builder.preview") }), e;
139
+ }), V = v("content"), ee = m(() => {
140
+ var s, c, l, w, f, b, y, T, oe;
141
+ const e = ((s = d.params) == null ? void 0 : s.collection) || ((c = d.params) == null ? void 0 : c.id), t = (l = i.value) == null ? void 0 : l.content_type_id, o = t ? (f = (w = Q.value) == null ? void 0 : w.find((K) => K.id === t)) == null ? void 0 : f.title : null;
144
142
  if (o)
145
143
  return o;
146
144
  if (L.value)
147
145
  return L.value;
148
- const a = (y = (b = Q.value) == null ? void 0 : b.find(
146
+ const n = (y = (b = Q.value) == null ? void 0 : b.find(
149
147
  (K) => K.id === e
150
148
  )) == null ? void 0 : y.title;
151
- if (a)
152
- return a;
153
- const n = (T = d.params) == null ? void 0 : T.id;
154
- return F.value && n && e === n && ((oe = i.value) != null && oe.title) ? i.value.title : e === "pages" ? r("cms.articles.title") : e;
155
- }), Se = m(() => {
149
+ if (n)
150
+ return n;
151
+ const a = (T = d.params) == null ? void 0 : T.id;
152
+ return P.value && a && e === a && ((oe = i.value) != null && oe.title) ? i.value.title : e === "pages" ? r("cms.articles.title") : e;
153
+ }), Te = m(() => {
156
154
  var t, o;
157
- const e = F.value ? "cms.builder.editPage" : "cms.builder.editCollection";
155
+ const e = P.value ? "cms.builder.editPage" : "cms.builder.editCollection";
158
156
  return ((t = i.value) == null ? void 0 : t.title) || ((o = d.params) != null && o.id ? r(e) : r("cms.articles.createArticle"));
159
- }), Ve = m(() => {
157
+ }), Se = m(() => {
160
158
  var s, c, l;
161
- const e = ((s = d.params) == null ? void 0 : s.collection) || ((c = d.params) == null ? void 0 : c.id), t = (l = d.params) == null ? void 0 : l.id, o = Se.value, a = o === ee.value, n = [
159
+ const e = ((s = d.params) == null ? void 0 : s.collection) || ((c = d.params) == null ? void 0 : c.id), t = (l = d.params) == null ? void 0 : l.id, o = Te.value, n = o === ee.value, a = [
162
160
  {
163
- label: F.value ? r("cms.navigation.singletons") : ee.value,
161
+ label: P.value ? r("cms.navigation.singletons") : ee.value,
164
162
  route: `collections/${e}`
165
163
  }
166
164
  ];
167
- return t ? n.push({
168
- label: a ? r("cms.collections.edit") : o,
165
+ return t ? a.push({
166
+ label: n ? r("cms.collections.edit") : o,
169
167
  route: `collections/${e}/${t}`
170
- }) : n.push({
168
+ }) : a.push({
171
169
  label: r("cms.articles.createArticle"),
172
170
  route: `collections/${e}/create`
173
- }), n;
171
+ }), a;
174
172
  }), Ae = (e) => {
175
- e === "collections" ? V.push("/collections") : V.push(`/${e}`);
173
+ e === "collections" ? A.push("/collections") : A.push(`/${e}`);
176
174
  }, te = async (e, t) => {
177
- var o, a;
175
+ var o, n;
178
176
  try {
179
177
  if (!t || !e)
180
178
  return;
181
- const n = await fetch(`/api/cms/${e}/${t}`);
182
- if (!n.ok)
179
+ const a = await fetch(`/api/cms/${e}/${t}`);
180
+ if (!a.ok)
183
181
  throw new Error("Failed to fetch article");
184
- const s = await n.json();
185
- if (_.value = (s == null ? void 0 : s.columns) || [], s != null && s.preview_path && (N.value = s == null ? void 0 : s.preview_path), J.value = (s == null ? void 0 : s.type) || null, s.rows) {
182
+ const s = await a.json();
183
+ if (_.value = (s == null ? void 0 : s.columns) || [], s != null && s.preview_path && (D.value = s == null ? void 0 : s.preview_path), J.value = (s == null ? void 0 : s.type) || null, s.rows) {
186
184
  let c = s.rows;
187
185
  Array.isArray(c) || (c = [c]), i.value = c[0];
188
186
  const l = ((o = c[0]) == null ? void 0 : o.content_type_id) || e;
189
187
  if (l) {
190
- const k = await fetch(`/api/cms-type/${l}`);
191
- if (k.ok) {
192
- const f = await k.json();
188
+ const w = await fetch(`/api/cms-type/${l}`);
189
+ if (w.ok) {
190
+ const f = await w.json();
193
191
  L.value = (f == null ? void 0 : f.title) || (f == null ? void 0 : f.name) || L.value;
194
192
  }
195
193
  }
196
- await ce(), (a = c[0]) != null && a.meta ? g.value = { ...c[0].meta } : g.value = {
194
+ await ce(), (n = c[0]) != null && n.meta ? g.value = { ...c[0].meta } : g.value = {
197
195
  title: "",
198
196
  description: "",
199
197
  keywords: "",
@@ -211,22 +209,22 @@ const Xe = [
211
209
  keywords: "",
212
210
  meta: {}
213
211
  };
214
- } catch (n) {
215
- console.error("Error fetching article:", n);
212
+ } catch (a) {
213
+ console.error("Error fetching article:", a);
216
214
  }
217
215
  };
218
216
  Ie(async () => {
219
- var n, s;
217
+ var a, s;
220
218
  M.value = !0, L.value = "";
221
- const e = (n = d.params) == null ? void 0 : n.collection, t = (s = d.params) == null ? void 0 : s.id, o = e || t, a = e && t ? t : void 0;
219
+ const e = (a = d.params) == null ? void 0 : a.collection, t = (s = d.params) == null ? void 0 : s.id, o = e || t, n = e && t ? t : void 0;
222
220
  try {
223
- if (!a) {
221
+ if (!n) {
224
222
  if (!o)
225
223
  return;
226
224
  const l = await (await fetch(`/api/cms/${o}/`)).json();
227
225
  _.value = l.columns, J.value = (l == null ? void 0 : l.type) || null;
228
226
  }
229
- await te(o, a ?? "");
227
+ await te(o, n ?? "");
230
228
  } finally {
231
229
  M.value = !1;
232
230
  }
@@ -239,34 +237,34 @@ const Xe = [
239
237
  set: (e) => {
240
238
  i.value && (i.value.is_pin = e);
241
239
  }
242
- }), je = () => {
240
+ }), Ve = () => {
243
241
  i.value && (i.value.is_pin = !i.value.is_pin);
244
242
  }, H = m(() => {
245
243
  var t;
246
244
  const e = (t = i.value) == null ? void 0 : t.content_type_id;
247
245
  return e ? `/collections/${e}/edit` : null;
248
- }), ze = () => {
249
- var o, a, n, s;
246
+ }), je = () => {
247
+ var o, n, a, s;
250
248
  if (!H.value)
251
249
  return;
252
- const e = ((o = d.params) == null ? void 0 : o.collection) || ((a = d.params) == null ? void 0 : a.id), t = (n = d.params) == null ? void 0 : n.id;
250
+ const e = ((o = d.params) == null ? void 0 : o.collection) || ((n = d.params) == null ? void 0 : n.id), t = (a = d.params) == null ? void 0 : a.id;
253
251
  if (e && t) {
254
- V.push(`/collections/${(s = i.value) == null ? void 0 : s.content_type_id}/edit`);
252
+ A.push(`/collections/${(s = i.value) == null ? void 0 : s.content_type_id}/edit`);
255
253
  return;
256
254
  }
257
- V.push(H.value);
258
- }, Le = async () => {
259
- var o, a;
260
- const e = (o = d.params) == null ? void 0 : o.collection, t = (a = d.params) == null ? void 0 : a.id;
255
+ A.push(H.value);
256
+ }, ze = async () => {
257
+ var o, n;
258
+ const e = (o = d.params) == null ? void 0 : o.collection, t = (n = d.params) == null ? void 0 : n.id;
261
259
  z.value = !0;
262
260
  try {
263
261
  (await fetch(
264
262
  `/api/cms-translate?id=${t}&collection=${e}&to=en&nocache=1`
265
- )).ok ? (P({
263
+ )).ok ? (B({
266
264
  title: r("cms.collections.translateContentSuccess"),
267
265
  message: r("cms.collections.translateContentSuccess"),
268
266
  type: "success"
269
- }), await te(e, t)) : P({
267
+ }), await te(e, t)) : B({
270
268
  title: r("cms.collections.translateContentError"),
271
269
  message: r("cms.collections.translateContentError"),
272
270
  type: "error"
@@ -274,23 +272,23 @@ const Xe = [
274
272
  } finally {
275
273
  z.value = !1;
276
274
  }
277
- }, Fe = async (e) => {
278
- var c, l, k, f;
279
- const t = (c = d.params) == null ? void 0 : c.collection, o = (l = d.params) == null ? void 0 : l.id, a = await D.value.validate();
280
- if (a) {
281
- P({
275
+ }, Le = async (e) => {
276
+ var c, l, w, f;
277
+ const t = (c = d.params) == null ? void 0 : c.collection, o = (l = d.params) == null ? void 0 : l.id, n = await I.value.validate();
278
+ if (n) {
279
+ B({
282
280
  title: r("cms.validation"),
283
- message: JSON.stringify(a),
281
+ message: JSON.stringify(n),
284
282
  type: "warning"
285
283
  });
286
284
  return;
287
285
  }
288
- (k = I.value) != null && k.restoreTagsBeforeSubmit && await I.value.restoreTagsBeforeSubmit();
289
- const n = g.value || {}, s = {
286
+ (w = N.value) != null && w.restoreTagsBeforeSubmit && await N.value.restoreTagsBeforeSubmit();
287
+ const a = g.value || {}, s = {
290
288
  ...i.value,
291
289
  meta: {
292
- ...n,
293
- ...n.meta || {}
290
+ ...a,
291
+ ...a.meta || {}
294
292
  }
295
293
  };
296
294
  console.log("Payload before submit:", s);
@@ -315,17 +313,17 @@ const Xe = [
315
313
  if (!o)
316
314
  try {
317
315
  const y = await b.json(), T = y.id || ((f = y.data) == null ? void 0 : f.id);
318
- T && d.name === "createArticle" && await V.push(`/collections/${t}/${T}`);
316
+ T && d.name === "createArticle" && await A.push(`/collections/${t}/${T}`);
319
317
  } catch (y) {
320
318
  console.warn("Could not parse response to get ID:", y);
321
319
  }
322
- P({
320
+ B({
323
321
  title: r("cms.common.success"),
324
322
  message: r("cms.common.successMessage"),
325
323
  type: "success"
326
324
  });
327
325
  } catch (b) {
328
- console.error("Submit error:", b), P({
326
+ console.error("Submit error:", b), B({
329
327
  title: r("cms.common.error"),
330
328
  message: "Помилка збереження",
331
329
  type: "error"
@@ -333,101 +331,101 @@ const Xe = [
333
331
  }
334
332
  };
335
333
  return (e, t) => {
336
- var o, a, n, s, c;
337
- return w(), $("div", Ye, [
334
+ var o, n, a, s, c;
335
+ return h(), $("div", Ye, [
338
336
  u("div", Ze, [
339
- C(v(he), {
340
- items: Ve.value,
337
+ C(p(be), {
338
+ items: Se.value,
341
339
  loading: M.value,
342
340
  onNavigate: Ae
343
341
  }, null, 8, ["items", "loading"]),
344
342
  u("div", et, [
345
343
  u("div", tt, [
346
344
  u("button", {
347
- onClick: t[0] || (t[0] = (l) => v(V).back()),
345
+ onClick: t[0] || (t[0] = (l) => p(A).back()),
348
346
  class: "p-2 text-gray-500 rounded-full hover:text-gray-900 dark:text-gray-400 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700"
349
347
  }, [
350
- C(v(Je), { class: "w-5 h-5" })
348
+ C(p(Oe), { class: "w-5 h-5" })
351
349
  ]),
352
350
  u("h1", st, j(e.$t(
353
- F.value ? "cms.builder.editPage" : "cms.builder.editCollection"
351
+ P.value ? "cms.builder.editPage" : "cms.builder.editCollection"
354
352
  )) + ' "' + j(i.value.title) + '" ', 1),
355
353
  u("a", {
356
- href: `https://cms.opengis.info/${v(G)}/guides/content/`,
354
+ href: `https://cms.opengis.info/${p(G)}/guides/content/`,
357
355
  target: "_blank",
358
356
  title: e.$t("cms.guide.content")
359
357
  }, [
360
- C(v(He), { class: "w-5 h-5" })
358
+ C(p(Je), { class: "w-5 h-5" })
361
359
  ], 8, ot)
362
360
  ]),
363
361
  u("div", lt, [
364
- H.value && F.value ? (w(), $("button", {
362
+ H.value && P.value ? (h(), $("button", {
365
363
  key: 0,
366
- onClick: ze,
364
+ onClick: je,
367
365
  type: "button",
368
366
  title: e.$t("cms.builder.editContentType"),
369
367
  class: "inline-flex items-center justify-center rounded-md h-9 w-9 border border-gray-200 bg-white text-gray-700 shadow-sm transition-all duration-200 transform hover:text-gray-900 hover:shadow-md focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
370
368
  "aria-label": "$t('cms.builder.editContentType')"
371
369
  }, [
372
- C(v(Ke), { class: "w-4 h-4" })
373
- ], 8, at)) : S("", !0),
370
+ C(p(He), { class: "w-4 h-4" })
371
+ ], 8, nt)) : S("", !0),
374
372
  u("button", {
375
- onClick: Fe,
373
+ onClick: Le,
376
374
  type: "submit",
377
375
  class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium h-9 px-4 py-2 bg-blue-600 text-white shadow-md transition-all duration-200 transform hover:bg-blue-700 hover:shadow-lg hover:scale-105 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
378
376
  }, [
379
- C(v(qe), { class: "w-4 h-4 mr-2" }),
380
- ae(" " + j(e.$t("cms.builder.save")), 1)
377
+ C(p(Ke), { class: "w-4 h-4 mr-2" }),
378
+ ne(" " + j(e.$t("cms.builder.save")), 1)
381
379
  ])
382
380
  ])
383
381
  ]),
384
- u("div", nt, [
382
+ u("div", at, [
385
383
  u("div", it, [
386
- (w(!0), $(Ne, null, Me(Te.value, (l) => (w(), $("button", {
384
+ (h(!0), $(Ne, null, De(Ce.value, (l) => (h(), $("button", {
387
385
  key: l.id,
388
- onClick: (k) => {
389
- A.value = l.id, console.log("cmsSettings:", B.value.value);
386
+ onClick: (w) => {
387
+ V.value = l.id, console.log("cmsSettings:", E.value.value);
390
388
  },
391
- class: ne([
389
+ class: ae([
392
390
  "inline-flex flex-1 items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm data-[state=active]:bg-blue-50 data-[state=active]:text-blue-700 data-[state=active]:border-blue-200",
393
- l.id === A.value ? "bg-blue-50 text-blue-700 border-blue-200" : ""
391
+ l.id === V.value ? "bg-blue-50 text-blue-700 border-blue-200" : ""
394
392
  ])
395
393
  }, j(l.name), 11, rt))), 128))
396
394
  ]),
397
395
  u("div", ct, [
398
- (o = v(d).params) != null && o.id && _e.value ? (w(), $("button", {
396
+ (o = p(d).params) != null && o.id && xe.value ? (h(), $("button", {
399
397
  key: 0,
400
398
  type: "button",
401
399
  class: "inline-flex items-center justify-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer bg-white border border-gray-200 rounded-md text-muted-foreground px-4 py-2 disabled:opacity-50 disabled:cursor-not-allowed",
402
400
  disabled: z.value,
403
- onClick: Le
401
+ onClick: ze
404
402
  }, [
405
- z.value ? (w(), ie(v(Ge), {
403
+ z.value ? (h(), ie(p(qe), {
406
404
  key: 0,
407
405
  class: "w-4 h-4 animate-spin shrink-0",
408
406
  "aria-hidden": "true"
409
407
  })) : S("", !0),
410
- ae(" " + j(z.value ? e.$t("cms.collections.translating") : e.$t("cms.collections.enLocalization")), 1)
408
+ ne(" " + j(z.value ? e.$t("cms.collections.translating") : e.$t("cms.collections.enLocalization")), 1)
411
409
  ], 8, ut)) : S("", !0),
412
410
  u("div", dt, [
413
411
  u("label", mt, j(e.$t("cms.collections.pinPublication")), 1),
414
- u("div", pt, [
412
+ u("div", vt, [
415
413
  q(u("input", {
416
414
  type: "checkbox",
417
415
  id: "is_pin",
418
416
  "onUpdate:modelValue": t[1] || (t[1] = (l) => se.value = l),
419
417
  class: "sr-only"
420
418
  }, null, 512), [
421
- [Re, se.value]
419
+ [Me, se.value]
422
420
  ]),
423
421
  u("div", {
424
- class: ne([
422
+ class: ae([
425
423
  "w-5 h-5 border-2 rounded transition-all duration-200 cursor-pointer flex items-center justify-center",
426
- (a = i.value) != null && a.is_pin ? "bg-sky-600 border-sky-600" : "bg-white border-gray-300 hover:border-sky-400 dark:bg-gray-700 dark:border-gray-600 dark:hover:border-sky-400"
424
+ (n = i.value) != null && n.is_pin ? "bg-sky-600 border-sky-600" : "bg-white border-gray-300 hover:border-sky-400 dark:bg-gray-700 dark:border-gray-600 dark:hover:border-sky-400"
427
425
  ]),
428
- onClick: je
426
+ onClick: Ve
429
427
  }, [
430
- (n = i.value) != null && n.is_pin ? (w(), $("svg", vt, [...t[7] || (t[7] = [
428
+ (a = i.value) != null && a.is_pin ? (h(), $("svg", pt, [...t[7] || (t[7] = [
431
429
  u("path", {
432
430
  "fill-rule": "evenodd",
433
431
  d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
@@ -441,40 +439,40 @@ const Xe = [
441
439
  ])
442
440
  ]),
443
441
  q(u("div", ft, [
444
- (s = Z.value) != null && s.length ? (w(), ie(v(ue), {
442
+ (s = Z.value) != null && s.length ? (h(), ie(p(ue), {
445
443
  key: 0,
446
444
  modelValue: i.value,
447
445
  "onUpdate:modelValue": t[2] || (t[2] = (l) => i.value = l),
448
- schema: $e.value,
449
- form: D.value,
450
- "onUpdate:form": t[3] || (t[3] = (l) => D.value = l)
446
+ schema: _e.value,
447
+ form: I.value,
448
+ "onUpdate:form": t[3] || (t[3] = (l) => I.value = l)
451
449
  }, null, 8, ["modelValue", "schema", "form"])) : S("", !0)
452
450
  ], 512), [
453
- [re, A.value === "content"]
451
+ [re, V.value === "content"]
454
452
  ]),
455
453
  q(u("div", yt, [
456
- C(v(ue), {
457
- schema: Ce.value,
454
+ C(p(ue), {
455
+ schema: $e.value,
458
456
  values: g.value,
459
457
  "onUpdate:values": t[4] || (t[4] = (l) => g.value = l),
460
458
  form: W.value,
461
459
  "onUpdate:form": t[5] || (t[5] = (l) => W.value = l)
462
460
  }, null, 8, ["schema", "values", "form"])
463
461
  ], 512), [
464
- [re, A.value === "seo"]
462
+ [re, V.value === "seo"]
465
463
  ]),
466
- A.value === "tags" ? (w(), $("div", gt, [
467
- C(v(ge), {
464
+ V.value === "tags" ? (h(), $("div", gt, [
465
+ C(p(ye), {
468
466
  ref_key: "tagsForm",
469
- ref: I,
467
+ ref: N,
470
468
  modelValue: i.value,
471
469
  "onUpdate:modelValue": t[6] || (t[6] = (l) => i.value = l)
472
470
  }, null, 8, ["modelValue"])
473
471
  ])) : S("", !0),
474
- A.value === "preview" ? (w(), $("div", bt, [
475
- C(v(be), {
472
+ V.value === "preview" ? (h(), $("div", bt, [
473
+ C(p(ge), {
476
474
  slug: (c = i.value) == null ? void 0 : c.slug,
477
- preview_path: N.value
475
+ preview_path: D.value
478
476
  }, null, 8, ["slug", "preview_path"])
479
477
  ])) : S("", !0)
480
478
  ]);
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { useRoute as $, routeLocationKey as K } from "vue-router";
3
3
  const O = "menu", B = (s, c, a) => {
4
4
  const o = s == null ? void 0 : s.trim(), l = a == null ? void 0 : a.trim();
5
5
  return o ? o === O ? c ? c === "create" ? { type: "createMenu", collection: o } : { type: "editMenu", collection: o, id: c } : { type: "menu", collection: o } : l === "edit" && c ? { type: "editCollection", collection: o, id: c } : c === "edit" ? { type: "editCollection", collection: o } : c ? c === "create" ? { type: "createArticle", collection: o } : { type: "editArticle", collection: o, id: c } : { type: "articles", collection: o } : { type: "collections" };
6
- }, R = u(() => import("./CollectionsPage-DHfPNql6.js")), L = u(() => import("./ArticlesPage-CFjE_cw_.js")), C = u(() => import("./contentForm-CLStrfSg.js")), N = u(() => import("./EditCollectionPage-3Q57ptN3.js")), W = u(
6
+ }, R = u(() => import("./CollectionsPage-DHfPNql6.js")), L = u(() => import("./ArticlesPage-CFjE_cw_.js")), C = u(() => import("./contentForm-CcFbUeal.js")), N = u(() => import("./EditCollectionPage-C4uNmBJf.js")), W = u(
7
7
  () => import("./MenuPage-BCZB_S8j.js")
8
8
  ), j = u(
9
9
  () => import("./MenuItemPage-BoJw885D.js")
@@ -1,14 +1,13 @@
1
- import { ref as c, useModel as s, computed as d, openBlock as u, createElementBlock as v, createBlock as _, unref as g, createCommentVNode as k } from "vue";
2
- import { g as V } from "./getField-CpwVE28P.js";
3
- import { inputs as e, VForm as $ } from "@opengis/form";
4
- import h from "./vs-form-custom-datatable-BDZo48w3.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";
5
4
  import x from "./vs-form-reference-list-Dtv8fJJU.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 A = {
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"] = h, 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;
22
- const a = c({}), f = s(o, "data"), l = s(o, "form"), i = d(() => {
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(V)) || [];
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 n;
28
- return u(), v("div", {
26
+ var s;
27
+ return u(), _("div", {
29
28
  ref_key: "form",
30
29
  ref: l
31
30
  }, [
32
- ((n = i.value) == null ? void 0 : n.length) > 0 ? (u(), _(g($), {
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
- A as default
42
+ z as default
44
43
  };